Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .browserslistrc

This file was deleted.

8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
max_line_length = 100
14 changes: 0 additions & 14 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
28 changes: 16 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Run CI Suite

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -14,15 +14,19 @@ jobs:
cypress:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- uses: cypress-io/github-action@224f894ce0b082eba28a3a4562f630c54a17b432
with:
start: npm run serve
wait-on: 'http://localhost:8080'
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version: 22
cache: 'npm'
- run: npm install && npm run build
- uses: cypress-io/github-action@224f894ce0b082eba28a3a4562f630c54a17b432
with:
config-file: cypress.config.ts
start: npm run preview
wait-on: 'http://localhost:4173'
env:
CYPRESS_BASE_URL: http://localhost:4173

deploy:
# needs: cypress
Expand All @@ -31,7 +35,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 22
cache: 'npm'
- name: set deployment parameters
run: |
Expand Down
25 changes: 23 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,42 @@ node_modules
/cypress/videos


# mirador annotation editor, temporarily copied while I wait for a fix on the npm package exports
/mae


# local env files
.env.local
.env.*.local

# Log files

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"singleQuote": true,
"printWidth": 100
}
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"Vue.volar",
"vitest.explorer",
"dbaeumer.vscode-eslint",
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode"
]
}
66 changes: 56 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,70 @@
# dl-viewer

## Project setup
```
This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).

## Recommended Browser Setup

- Chromium-based browsers (Chrome, Edge, Brave, etc.):
- [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)
- [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters)
- Firefox:
- [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/)
- [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/)

## Type Support for `.vue` Imports in TS

TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.

## Customize configuration

See [Vite Configuration Reference](https://vite.dev/config/).

## Project Setup

```sh
npm install
```

### Compiles and hot-reloads for development
### Compile and Hot-Reload for Development

```sh
npm run dev
```
npm run serve

### Type-Check, Compile and Minify for Production

```sh
npm run build
```

### Compiles and minifies for production
### Run Unit Tests with [Vitest](https://vitest.dev/)

```sh
npm run test:unit
```
npm run build

### Run End-to-End Tests with [Cypress](https://www.cypress.io/)

```sh
npm run test:e2e:dev
```

### Lints and fixes files
This runs the end-to-end tests against the Vite development server.
It is much faster than the production build.

But it's still recommended to test the production build with `test:e2e` before deploying (e.g. in CI environments):

```sh
npm run build
npm run test:e2e
```

### Lint with [ESLint](https://eslint.org/)

```sh
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

5 changes: 0 additions & 5 deletions build.sh

This file was deleted.

11 changes: 11 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'cypress'

export default defineConfig({
e2e: {
specPattern: 'cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}',
baseUrl: 'http://localhost:5173',
defaultCommandTimeout: 60000,
viewportWidth: 1200,
viewportHeight: 660,
},
})
7 changes: 0 additions & 7 deletions cypress.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
67 changes: 67 additions & 0 deletions cypress/e2e/manuscript.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
describe('A manuscript', () => {
const URL_PARAMETERS =
'#?manifest=https%3A%2F%2Fiiif.library.ucla.edu%2Fark%253A%252F21198%252Fzz0009gx6g%2Fmanifest'

it('loads Universal Viewer in an iframe', () => {
cy.visit('/' + URL_PARAMETERS)

// UV loads inside an iframe
cy.frameLoaded('#universalviewer-iframe', {
url: '/uv.html' + URL_PARAMETERS,
})
})

it('loads in Universal Viewer!', () => {
cy.visit('/uv.html' + URL_PARAMETERS)

// Shows title
cy.contains('.title', 'Manuscript No. 1: Gladzor Gospels').should('exist').should('be.visible')

// Settings Button
cy.get('button.settings').should('exist').should('be.visible')

// left panel
// is visible, first page selected
cy.get('.leftPanel')
.should('exist')
.should('be.visible')
.get('#thumb-0 > .thumb')
.should('have.class', 'selected')
// navigate to 3rd page by clicking thumbnail
cy.get('#thumb-2 > .thumb').should('not.have.class', 'selected').get('#thumb-2 img').click()
cy.get('#thumb-0 > .thumb')
.should('not.have.class', 'selected')
.get('#thumb-2 > .thumb')
.should('have.class', 'selected')
// navigate to 4th page by clicking thumbnail
cy.get('#thumb-3 > .thumb')
.should('not.have.class', 'selected')
.contains('[Gladzor Gospels: page 2]')
.click()
cy.get('#thumb-2 > .thumb')
.should('not.have.class', 'selected')
.get('#thumb-3 > .thumb')
.should('have.class', 'selected')
// collapse left panel
cy.get('.expandFullButton')
.should('exist')
.should('not.be.visible')
.get('.collapseButton')
.should('exist')
.should('be.visible')
.click()
cy.get('.leftPanel > .main').should('exist').should('not.be.visible')

// "Print" is disabled
cy.contains('Print').should('exist').should('not.be.visible')

// "Share" is disabled
cy.contains('Share').should('exist').should('not.be.visible')

// Fullscreen button
cy.contains('Full Screen').should('exist').should('be.visible')

// Download button
cy.contains('Download').should('exist').should('be.visible')
})
})
25 changes: 25 additions & 0 deletions cypress/e2e/sinaimanuscript.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
describe('With the `site=sinai` parameter set', () => {
const URL_PARAMETERS = `?site=sinai&manifest=${encodeURIComponent('https://iiif.library.ucla.edu/ark%3A%2F21198%2Fz18w4z1w/manifest')}`

it('loads in Mirador', () => {
// http://localhost:8080/?site=sinai&manifest=https%3A%2F%2Fiiif.library.ucla.edu%2Fark%253A%252F21198%252Fz18w4z1w%2Fmanifest
cy.visit('/' + URL_PARAMETERS)

cy.get('.mirador-viewer').should('exist').should('be.visible')

// Image tools loaded
cy.get('[aria-label="Expand image tools"]').should('exist').should('be.visible')

// Annotations plugin loaded
cy.get('button[aria-label="Annotations"]').should('exist').should('be.visible')

// index panel open on load
cy.get('.mirador-companion-area-left')
.contains('h3', 'Index')
.should('exist')
.should('be.visible')

// close window button is present
cy.get('button[aria-label="Close window"').should('exist').should('be.visible')
})
})
30 changes: 30 additions & 0 deletions cypress/e2e/sinaipalimpsest.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
describe('With the `viewer=mirador` parameter set', () => {
const URL_PARAMETERS =
'?site=sinai&manifest=https%3A%2F%2Fsinai-images.library.ucla.edu%2Fiiif%2Fark%3A%252F21198%252Fz1ft92mh%2Fmanifest'

it('loads in Mirador', () => {
// http://localhost:8080/?site=sinai&manifest=https%3A%2F%2Fiiif.library.ucla.edu%2Fark%253A%252F21198%252Fz18w4z1w%2Fmanifest
cy.visit('/' + URL_PARAMETERS)

cy.get('.mirador-viewer').should('exist').should('be.visible')

cy.contains('CPA NF fragment 13').should('exist')

// Image tools loaded
cy.get('[aria-label="Expand image tools"]').should('exist').should('be.visible')

// Annotations plugin loaded
cy.get('button[aria-label="Annotations"]').should('exist').should('be.visible')

// index panel open on load
cy.get('.mirador-companion-area-left')
.contains('h3', 'Index')
.should('exist')
.should('be.visible')

// close window button is present
cy.get('button[aria-label="Close window"').should('exist').should('be.visible')

cy.contains('An error occurred').should('not.exist')
})
})
File renamed without changes.
Loading
Loading