diva.js 6.0.1 → 7.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/.clang-format +7 -0
  2. package/.github/workflows/npm-publish.yml +45 -0
  3. package/LICENSE +55 -0
  4. package/Makefile +75 -0
  5. package/README.md +15 -108
  6. package/elm.json +32 -0
  7. package/package.json +12 -59
  8. package/review/elm.json +52 -0
  9. package/review/src/ReviewConfig.elm +87 -0
  10. package/scripts/elm-esm.sh +40 -0
  11. package/scripts/minify-css.mjs +31 -0
  12. package/src/Filters.elm +1044 -0
  13. package/src/Main.elm +1217 -0
  14. package/src/Model.elm +213 -0
  15. package/src/Msg.elm +59 -0
  16. package/src/Utilities.elm +46 -0
  17. package/src/View/CollectionExplorer.elm +172 -0
  18. package/src/View/Helpers.elm +86 -0
  19. package/src/View/HtmlRenderer.elm +136 -0
  20. package/src/View/Icons.elm +159 -0
  21. package/src/View/ManifestInfoModal.elm +363 -0
  22. package/src/View/PageViewModal.elm +1046 -0
  23. package/src/View/Sidebar.elm +786 -0
  24. package/src/View/Toolbar.elm +189 -0
  25. package/src/View.elm +244 -0
  26. package/src/diva.ts +802 -0
  27. package/src/filters.ts +1843 -0
  28. package/src/styles/app.css +328 -0
  29. package/src/styles/collection.css +75 -0
  30. package/src/styles/modal.css +388 -0
  31. package/src/styles/sidebar.css +215 -0
  32. package/src/styles/theme.css +39 -0
  33. package/src/styles/toolbar.css +154 -0
  34. package/src/viewer-element.ts +1307 -0
  35. package/testing/index.html +52 -0
  36. package/testing/testing.html +231 -0
  37. package/tsconfig.json +12 -0
  38. package/AUTHORS +0 -22
  39. package/_site/diva.iml +0 -11
  40. package/build/diva.css +0 -554
  41. package/build/diva.css.map +0 -1
  42. package/build/diva.js +0 -9
  43. package/build/diva.js.map +0 -1
  44. package/build/plugins/download.js +0 -2
  45. package/build/plugins/download.js.map +0 -1
  46. package/build/plugins/manipulation.js +0 -2
  47. package/build/plugins/manipulation.js.map +0 -1
  48. package/build/plugins/metadata.js +0 -2
  49. package/build/plugins/metadata.js.map +0 -1
  50. package/diva.iml +0 -11
  51. package/index.html +0 -28
  52. package/karma.conf.js +0 -87
  53. package/source/css/_mixins.scss +0 -43
  54. package/source/css/_variables.scss +0 -50
  55. package/source/css/_viewer.scss +0 -462
  56. package/source/css/diva.scss +0 -15
  57. package/source/css/plugins/_manipulation.scss +0 -228
  58. package/source/css/plugins/_metadata.scss +0 -31
  59. package/source/img/adjust.svg +0 -11
  60. package/source/img/book-view.svg +0 -6
  61. package/source/img/close.svg +0 -6
  62. package/source/img/download.svg +0 -6
  63. package/source/img/from-fullscreen.svg +0 -8
  64. package/source/img/grid-fewer.svg +0 -6
  65. package/source/img/grid-more.svg +0 -6
  66. package/source/img/grid-view.svg +0 -6
  67. package/source/img/link.svg +0 -6
  68. package/source/img/metadata.svg +0 -9
  69. package/source/img/page-view.svg +0 -6
  70. package/source/img/to-fullscreen.svg +0 -11
  71. package/source/img/zoom-in.svg +0 -6
  72. package/source/img/zoom-out.svg +0 -7
  73. package/source/js/composite-image.js +0 -174
  74. package/source/js/diva-global.js +0 -7
  75. package/source/js/diva.js +0 -1543
  76. package/source/js/document-handler.js +0 -180
  77. package/source/js/document-layout.js +0 -286
  78. package/source/js/exceptions.js +0 -26
  79. package/source/js/gesture-events.js +0 -190
  80. package/source/js/grid-handler.js +0 -122
  81. package/source/js/iiif-source-adapter.js +0 -63
  82. package/source/js/image-cache.js +0 -113
  83. package/source/js/image-manifest.js +0 -157
  84. package/source/js/image-request-handler.js +0 -76
  85. package/source/js/interpolate-animation.js +0 -122
  86. package/source/js/page-layouts/book-layout.js +0 -161
  87. package/source/js/page-layouts/grid-layout.js +0 -97
  88. package/source/js/page-layouts/index.js +0 -38
  89. package/source/js/page-layouts/page-dimensions.js +0 -9
  90. package/source/js/page-layouts/singles-layout.js +0 -27
  91. package/source/js/page-overlay-manager.js +0 -102
  92. package/source/js/page-tools-overlay.js +0 -95
  93. package/source/js/parse-iiif-manifest.js +0 -302
  94. package/source/js/plugins/_filters.js +0 -679
  95. package/source/js/plugins/download.js +0 -83
  96. package/source/js/plugins/manipulation.js +0 -837
  97. package/source/js/plugins/metadata.js +0 -190
  98. package/source/js/renderer.js +0 -584
  99. package/source/js/settings-view.js +0 -30
  100. package/source/js/tile-coverage-map.js +0 -25
  101. package/source/js/toolbar.js +0 -572
  102. package/source/js/utils/dragscroll.js +0 -106
  103. package/source/js/utils/elt.js +0 -94
  104. package/source/js/utils/events.js +0 -190
  105. package/source/js/utils/get-scrollbar-width.js +0 -29
  106. package/source/js/utils/hash-params.js +0 -86
  107. package/source/js/utils/parse-label-value.js +0 -34
  108. package/source/js/utils/vanilla.kinetic.js +0 -527
  109. package/source/js/validation-runner.js +0 -177
  110. package/source/js/viewer-core.js +0 -1505
  111. package/source/js/viewport.js +0 -143
  112. package/test/_setup.js +0 -13
  113. package/test/composite-image_test.js +0 -94
  114. package/test/diva_test.js +0 -43
  115. package/test/hash-params_test.js +0 -221
  116. package/test/image-cache_test.js +0 -106
  117. package/test/main.js +0 -6
  118. package/test/manifests/beromunsterManifest.json +0 -15514
  119. package/test/manifests/iiifv2.json +0 -11032
  120. package/test/manifests/iiifv2pages.json +0 -30437
  121. package/test/manifests/iiifv3.json +0 -10965
  122. package/test/navigation_test.js +0 -355
  123. package/test/parse-iiif-manifest_test.js +0 -68
  124. package/test/public_test.js +0 -881
  125. package/test/settings_test.js +0 -487
  126. package/test/utils/book-layout_test.js +0 -148
  127. package/test/utils/elt_test.js +0 -102
  128. package/test/utils/events_test.js +0 -245
  129. package/test/utils/hash-params_test.js +0 -79
  130. package/test/utils/parse-label-value_test.js +0 -45
  131. package/test/z_plugins_test.js +0 -180
  132. package/webpack.config.js +0 -58
  133. package/webpack.config.test.js +0 -45
@@ -0,0 +1,52 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>Diva.js Viewer</title>
7
+ <!-- <link rel="stylesheet" href="../build/diva.css">-->
8
+ <style>
9
+ html,
10
+ body {
11
+ height: 100%;
12
+ }
13
+ body {
14
+ margin: 0;
15
+ font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
16
+ }
17
+ #diva-wrapper {
18
+ display: flex;
19
+ height: 100%;
20
+ width: 100%;
21
+ }
22
+ </style>
23
+ </head>
24
+ <body>
25
+
26
+ <div id="diva-wrapper"></div>
27
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/openseadragon/5.0.1/openseadragon.min.js"></script>
28
+ <!-- <script src="vendor/openseadragon.js"></script>-->
29
+ <script src="../build/diva.debug.js"></script>
30
+ <script>
31
+ const params = new URLSearchParams(window.location.search);
32
+ const manifestParam = params.get("manifest");
33
+ const objectData = manifestParam && manifestParam.trim()
34
+ ? manifestParam.trim()
35
+ : "https://iiif.bodleian.ox.ac.uk/iiif/manifest/e32a277e-91e2-4a6d-8ba6-cc4bad230410.json";
36
+
37
+ new Diva("diva-wrapper", {
38
+ setLanguage: "ar",
39
+ objectData,
40
+ // objectData: "https://iiif.bodleian.ox.ac.uk/iiif/manifest/ae9f6cca-ae5c-4149-8fe4-95e6eca1f73c.json",
41
+ // objectData: "https://iiif.bodleian.ox.ac.uk/iiif/manifest/22baf2a5-5eb4-4c5b-b074-707aa29c83bc.json",
42
+ // objectData: "https://iiif.bodleian.ox.ac.uk/iiif/manifest/cbcbdb78-1f09-452c-8645-d77bcbf306f0.json",
43
+ // objectData: "https://www.diamm.ac.uk/sources/194/manifest/",
44
+ // objectData: "https://iiif.bodleian.ox.ac.uk/iiif/collection/top",
45
+ // objectData: "https://iiif.bodleian.ox.ac.uk/iiif/collection/all-souls",
46
+ // objectData: "https://iiif.io/api/cookbook/recipe/0033-choice/manifest.json",
47
+ // objectData: "./diamm-manifest.json",
48
+ acceptHeaders: ["application/ld+json;profile=http://iiif.io/api/presentation/3/context.json"],
49
+ });
50
+ </script>
51
+ </body>
52
+ </html>
@@ -0,0 +1,231 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>IIIF Scroll POC - Testing</title>
7
+ <style>
8
+ body {
9
+ margin: 0;
10
+ font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
11
+ background: #f5f2ea;
12
+ color: #222322;
13
+ }
14
+ .controls {
15
+ display: grid;
16
+ grid-template-columns: 1fr;
17
+ gap: 12px;
18
+ padding: 16px 20px;
19
+ border-bottom: 1px solid #e2d9cf;
20
+ background: #fffaf2;
21
+ }
22
+ .controls-row {
23
+ display: flex;
24
+ gap: 12px;
25
+ align-items: center;
26
+ flex-wrap: wrap;
27
+ }
28
+ .controls label {
29
+ font-weight: 600;
30
+ text-transform: uppercase;
31
+ font-size: 12px;
32
+ letter-spacing: 0.08em;
33
+ color: #6a6257;
34
+ }
35
+ .controls input[type="text"],
36
+ .controls select {
37
+ padding: 8px 10px;
38
+ border-radius: 6px;
39
+ border: 1px solid #d6cbbb;
40
+ min-width: 280px;
41
+ font-size: 14px;
42
+ }
43
+ .controls button {
44
+ padding: 8px 16px;
45
+ border-radius: 6px;
46
+ border: 1px solid #9f8c73;
47
+ background: #f0e6d7;
48
+ font-weight: 600;
49
+ cursor: pointer;
50
+ }
51
+ html,
52
+ body {
53
+ height: 100%;
54
+ }
55
+ #diva-wrapper {
56
+ display: flex;
57
+ height: 100%;
58
+ width: 100%;
59
+ }
60
+ </style>
61
+
62
+ </head>
63
+ <body>
64
+ <div class="controls">
65
+ <div class="controls-row">
66
+ <label>Manifest Source</label>
67
+ <label>
68
+ <input type="radio" name="manifest-source" value="list" checked />
69
+ Choose from list
70
+ </label>
71
+ <label>
72
+ <input type="radio" name="manifest-source" value="url" />
73
+ Enter URL
74
+ </label>
75
+ </div>
76
+ <div class="controls-row">
77
+ <label for="version-select">IIIF Version</label>
78
+ <select id="version-select">
79
+ <option value="">Auto</option>
80
+ <option value="v2">IIIF v2</option>
81
+ <option value="v3">IIIF v3</option>
82
+ </select>
83
+ <label for="language-select">Language</label>
84
+ <select id="language-select">
85
+ <option value="auto">auto</option>
86
+ <option value="en">en</option>
87
+ <option value="de">de</option>
88
+ <option value="zh">zh</option>
89
+ </select>
90
+ </div>
91
+ <div class="controls-row" id="list-row">
92
+ <label for="manifest-select">Manifest</label>
93
+ <select id="manifest-select">
94
+ <option value="">(No manifests configured)</option>
95
+ </select>
96
+ </div>
97
+ <div class="controls-row" id="url-row" style="display:none;">
98
+ <label for="manifest-url">Manifest URL</label>
99
+ <input
100
+ id="manifest-url"
101
+ type="text"
102
+ placeholder="https://example.org/iiif/manifest.json"
103
+ />
104
+ </div>
105
+ <div class="controls-row">
106
+ <button id="manifest-go" type="button">Go</button>
107
+ </div>
108
+ </div>
109
+
110
+ <div id="diva-wrapper"></div>
111
+
112
+
113
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/openseadragon/5.0.1/openseadragon.min.js"></script>
114
+ <script src="../build/diva.debug.js"></script>
115
+ <script>
116
+ const manifests = [
117
+ { label: "GB-Ob MS Bodl. 264", url: "https://iiif.bodleian.ox.ac.uk/iiif/manifest/ae9f6cca-ae5c-4149-8fe4-95e6eca1f73c.json" },
118
+ { label: "GB-Cu MS Add. 10062", url: "https://cudl.lib.cam.ac.uk//iiif/MS-ADD-10062" },
119
+ { label: "GB-Och MS. Oppenheim Add. fol. 25 (RTL)", url: "https://iiif.bodleian.ox.ac.uk/iiif/manifest/22baf2a5-5eb4-4c5b-b074-707aa29c83bc.json" },
120
+ { label: "All Souls collection", url: "https://iiif.bodleian.ox.ac.uk/iiif/collection/all-souls" },
121
+ { label: "Madonna with Canon Joris", url: "https://dam.museabrugge.be/iiif/3/418/manifest.json" },
122
+ { label: "Huntingdon 61667, Canterbury Tales", url: "https://hdl.huntington.org/iiif/info/p15150coll3/6983/manifest.json" },
123
+ { label: "Adoration of the Magi, Ftizw. MAR.T.30-1912", url: "https://api.fitz.ms/data-distributor/iiif/object-110472/manifest" },
124
+ { label: "Map of Asia, Quatar 2702", url: "https://www.qdl.qa/en/iiif/qnlhc/2702/manifest" },
125
+ { label: "Wunder der Vererbung, Wellcome Collection", url: "https://iiif.wellcomecollection.org/presentation/b18035723" },
126
+ { label: "Mahabharata Scroll, University of Edinburgh", url: "https://librarylabs.ed.ac.uk/iiif/manifest/mahabharataFinal.json" },
127
+ { label: "Vatican Lat. 5757", url: "https://digi.vatlib.it/iiif/MSS_Vat.lat.5757/manifest.json" },
128
+ { label: "Codex Sang. 194", url: "https://www.e-codices.unifr.ch/metadata/iiif/csg-0194/manifest.json" },
129
+ { label: "San Lorenzo Palimpsest", url: "https://iiif.diamm.net/manifests/I-FL_MS2211/manifest.json" },
130
+ { label: "Barocci 197*", url: "https://iiif.bodleian.ox.ac.uk/iiif/manifest/3a910d94-9e88-4207-9020-8ee0634b01ec.json" },
131
+ { label: "Paris 12044", url: "https://gallica.bnf.fr/iiif/ark:/12148/btv1b8422976g/manifest.json" },
132
+ { label: "HP Lovecraft", url: "https://repository.library.brown.edu/iiif/presentation/bdr:425489/manifest.json" },
133
+ { label: "Onstage", url: "https://iiif.rism.digital/manifest/onstage/CH_Bm/CH_Bm_002/CH_Bm_prg-1391.json" },
134
+ { label: "Durham Breviary", url: "https://iiif.durham.ac.uk/manifests/trifle/32150/t2/m7/w6/t2m7w62f844z/manifest" },
135
+ { label: "Qatar Digital Library MS", url: "https://www.qdl.qa/en/iiif/81055/vdc_100098983347.0x000001/manifest" },
136
+ { label: "U of T Manifest", url: "https://iiif.library.utoronto.ca/presentation/v2/fisherbooks:F10083/manifest" },
137
+ { label: "BSB Manifest", url: "https://api.digitale-sammlungen.de/iiif/presentation/v2/bsb00087481/manifest" },
138
+ ];
139
+
140
+ const selectEl = document.getElementById("manifest-select");
141
+ const urlInput = document.getElementById("manifest-url");
142
+ const versionSelect = document.getElementById("version-select");
143
+ const languageSelect = document.getElementById("language-select");
144
+ const listRow = document.getElementById("list-row");
145
+ const urlRow = document.getElementById("url-row");
146
+ const goButton = document.getElementById("manifest-go");
147
+ const viewerWrap = document.querySelector(".viewer-wrap");
148
+ let wrapper = document.getElementById("diva-wrapper");
149
+
150
+ function populateList() {
151
+ selectEl.innerHTML = "";
152
+ if (manifests.length === 0) {
153
+ const option = document.createElement("option");
154
+ option.value = "";
155
+ option.textContent = "(No manifests configured)";
156
+ selectEl.appendChild(option);
157
+ return;
158
+ }
159
+ for (const manifest of manifests) {
160
+ const option = document.createElement("option");
161
+ option.value = manifest.url;
162
+ option.textContent = manifest.label || manifest.url;
163
+ selectEl.appendChild(option);
164
+ }
165
+ }
166
+
167
+ function getSelectedSource() {
168
+ const selected = document.querySelector('input[name="manifest-source"]:checked');
169
+ return selected ? selected.value : "list";
170
+ }
171
+
172
+ function setSourceVisibility() {
173
+ const source = getSelectedSource();
174
+ listRow.style.display = source === "list" ? "flex" : "none";
175
+ urlRow.style.display = source === "url" ? "flex" : "none";
176
+ }
177
+
178
+ let currentInstance = null;
179
+
180
+ function buildAcceptHeaders() {
181
+ if (versionSelect.value === "v2") {
182
+ return ["application/ld+json;profile=http://iiif.io/api/presentation/2/context.json"];
183
+ }
184
+ if (versionSelect.value === "v3") {
185
+ return ["application/ld+json;profile=http://iiif.io/api/presentation/3/context.json"];
186
+ }
187
+ return [];
188
+ }
189
+
190
+ function loadManifest(url) {
191
+ if (!url) {
192
+ alert("Please select or enter a manifest URL.");
193
+ return;
194
+ }
195
+ if (currentInstance && typeof currentInstance.destroy === "function") {
196
+ currentInstance.destroy();
197
+ }
198
+ if (viewerWrap) {
199
+ viewerWrap.innerHTML = '<div id="diva-wrapper"></div>';
200
+ wrapper = document.getElementById("diva-wrapper");
201
+ }
202
+ const config = {
203
+ objectData: url,
204
+ acceptHeaders: buildAcceptHeaders(),
205
+ };
206
+ if (languageSelect.value !== "auto") {
207
+ config.setLanguage = languageSelect.value;
208
+ }
209
+ currentInstance = new Diva("diva-wrapper", config);
210
+ }
211
+
212
+ document.addEventListener("change", (event) => {
213
+ if (event.target && event.target.name === "manifest-source") {
214
+ setSourceVisibility();
215
+ }
216
+ });
217
+
218
+ goButton.addEventListener("click", () => {
219
+ const source = getSelectedSource();
220
+ if (source === "list") {
221
+ loadManifest(selectEl.value);
222
+ } else {
223
+ loadManifest(urlInput.value.trim());
224
+ }
225
+ });
226
+
227
+ populateList();
228
+ setSourceVisibility();
229
+ </script>
230
+ </body>
231
+ </html>
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2019",
4
+ "module": "ES2015",
5
+ "lib": ["DOM", "ES2019"],
6
+ "rootDir": "src",
7
+ "outDir": "public",
8
+ "strict": true,
9
+ "noEmitOnError": true
10
+ },
11
+ "include": ["src/**/*.ts", "src/**/*.d.ts"]
12
+ }
package/AUTHORS DELETED
@@ -1,22 +0,0 @@
1
- Authors of diva.js
2
-
3
- William Bain (https://github.com/wabain)
4
- Andrew Horwitz (https://github.com/ahwitz)
5
- Eric Liu (https://github.com/erichanliu)
6
- Wendy Liu (https://github.com/dellsystem)
7
- Evan Magoni (https://github.com/magoni)
8
- Jérôme Parent-Lévesque (https://github.com/jeromepl)
9
- Laurent Pugin (https://github.com/lpugin)
10
-
11
- Project Coordinators:
12
- Andrew Hankinson (andrew.hankinson[at]bodleian.ox.ac.uk)
13
- Ichiro Fujinaga (ichiro.fujinaga[at]mcgill.ca)
14
-
15
- Development of Diva.js (past and present versions) was sponsored by the following institutions:
16
-
17
- Swiss National Science Foundation
18
- Social Sciences and Humanities Research Council of Canada
19
- Répertoire International des Sources Musicale (RISM) Switzerland
20
- Canadian Foundation for Innovation
21
- Centre for Interdisciplinary Research in Music Media and Technology (CIRMMT)
22
- Schulich School of Music, McGill University
package/_site/diva.iml DELETED
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- <orderEntry type="library" name="mocha-DefinitelyTyped" level="application" />
9
- <orderEntry type="library" name="expect-DefinitelyTyped" level="application" />
10
- </component>
11
- </module>