@micropasts/iiif-manifest-summary 0.0.0-stage → 0.1.1
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.
- package/LICENSE.md +21 -0
- package/README.md +450 -2
- package/dist/iiif-manifest-summary.esm.js +661 -0
- package/dist/iiif-manifest-summary.iife.js +671 -0
- package/package.json +39 -4
- package/src/core.js +286 -0
- package/src/demo.html +154 -0
- package/src/index.js +12 -0
- package/src/shadow.js +229 -0
- package/src/tailwind.js +147 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Pett
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,451 @@
|
|
|
1
|
-
#
|
|
1
|
+
# IIIF Manifest Summary
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Zero-dependency JavaScript web components for displaying compact summaries of IIIF Presentation API v2 and v3 manifests. The components show the manifest title, summary, rights/license, thumbnail, canvas count, and up to four metadata fields without loading a heavy IIIF viewer.
|
|
4
|
+
|
|
5
|
+
Package: `@micropasts/iiif-manifest-summary`
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- IIIF Presentation API v2 and v3 support
|
|
10
|
+
- Named shadow-DOM and Tailwind CSS/light-DOM components
|
|
11
|
+
- Fetches manifests with the browser `fetch()` API
|
|
12
|
+
- Shared in-memory fetch and summary cache
|
|
13
|
+
- Loading and fetch-error states
|
|
14
|
+
- HTML-safe plain-text summaries and metadata
|
|
15
|
+
- Creative Commons and RightsStatements-friendly license labels
|
|
16
|
+
- Clickable thumbnails with a native modal/overlay
|
|
17
|
+
- Copy-to-clipboard URI button
|
|
18
|
+
- Composed `heritage:select` event
|
|
19
|
+
- Support for IIIF language maps and legacy v2 values
|
|
20
|
+
- Custom templates for the shadow-DOM component
|
|
21
|
+
- No runtime dependencies
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### npm
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @micropasts/iiif-manifest-summary
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
ESM usage:
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<script type="module">
|
|
35
|
+
import '@micropasts/iiif-manifest-summary';
|
|
36
|
+
</script>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### CDN
|
|
40
|
+
|
|
41
|
+
The IIFE build exposes `window.IiifManifestSummaryLib`:
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<script src="https://cdn.jsdelivr.net/npm/@micropasts/iiif-manifest-summary/dist/iiif-manifest-summary.iife.js"></script>
|
|
45
|
+
|
|
46
|
+
<iiif-manifest-summary
|
|
47
|
+
manifest="https://example.org/iiif/manifest.json"
|
|
48
|
+
></iiif-manifest-summary>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The ESM build can also be loaded directly:
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<script type="module">
|
|
55
|
+
import {
|
|
56
|
+
IiifManifestSummary,
|
|
57
|
+
IiifManifestSummaryTailwind,
|
|
58
|
+
} from 'https://cdn.jsdelivr.net/npm/@micropasts/iiif-manifest-summary/dist/iiif-manifest-summary.esm.js';
|
|
59
|
+
</script>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
CDNs do not rewrite package subpath exports. When importing individual source exports, use an npm-aware environment or configure the appropriate source/specifier paths.
|
|
63
|
+
|
|
64
|
+
## Components
|
|
65
|
+
|
|
66
|
+
### `<iiif-manifest-summary>` — Shadow DOM
|
|
67
|
+
|
|
68
|
+
The default component renders inside an open shadow root and is isolated from page styles.
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<iiif-manifest-summary
|
|
72
|
+
manifest="https://example.org/iiif/manifest.json"
|
|
73
|
+
theme="dark"
|
|
74
|
+
></iiif-manifest-summary>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
It is registered globally under `iiif-manifest-summary` when it is not already defined.
|
|
78
|
+
|
|
79
|
+
#### Attributes
|
|
80
|
+
|
|
81
|
+
| Attribute | Required | Values | Description |
|
|
82
|
+
| --- | --- | --- | --- |
|
|
83
|
+
| `manifest` | Yes | Manifest URL | URI to fetch and summarize. Initial load and subsequent changes are supported. |
|
|
84
|
+
| `listen` | No | Custom event name | Listens for the named window event and uses `event.detail.manifest` to change manifests. |
|
|
85
|
+
| `theme` | No | `light`, `dark`, or omitted | Controls the built-in theme. `light` forces the light colors; `dark` forces dark colors; omitted follows `prefers-color-scheme: dark`. |
|
|
86
|
+
|
|
87
|
+
#### CSS custom properties
|
|
88
|
+
|
|
89
|
+
These variables can be set on the host element:
|
|
90
|
+
|
|
91
|
+
| Variable | Default in light mode | Purpose |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| `--iiif-bg` | `#ffffff` | Card background |
|
|
94
|
+
| `--iiif-fg` | `#18181b` | Primary text |
|
|
95
|
+
| `--iiif-muted` | `#52525b` | Secondary text |
|
|
96
|
+
| `--iiif-border` | `#e4e4e7` | Card and thumbnail borders |
|
|
97
|
+
| `--iiif-surface` | `rgba(127, 127, 127, 0.08)` | Metadata and hover surface |
|
|
98
|
+
| `--iiif-accent` | `#0284c7` | IIIF version badge |
|
|
99
|
+
| `--iiif-radius` | `0.5rem` | Card radius |
|
|
100
|
+
| `--iiif-font` | `system-ui, -apple-system, sans-serif` | Component font |
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
iiif-manifest-summary {
|
|
106
|
+
--iiif-accent: #7c3aed;
|
|
107
|
+
--iiif-radius: 0.75rem;
|
|
108
|
+
--iiif-bg: #fafafa;
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Dark-mode defaults for `--iiif-bg`, `--iiif-fg`, `--iiif-muted`, and `--iiif-border` are applied automatically for dark system preference unless the host has `theme="light"`. The `theme="dark"` attribute overrides system preference.
|
|
113
|
+
|
|
114
|
+
#### Shadow parts
|
|
115
|
+
|
|
116
|
+
The built-in template exposes the following parts for `::part(...)` styling:
|
|
117
|
+
|
|
118
|
+
| Part | Element |
|
|
119
|
+
| --- | --- |
|
|
120
|
+
| `card` | Outer card |
|
|
121
|
+
| `header` | Header row |
|
|
122
|
+
| `badge` | Version badge |
|
|
123
|
+
| `canvases` | Canvas-count text |
|
|
124
|
+
| `thumb` | Thumbnail image |
|
|
125
|
+
| `title` | Manifest title |
|
|
126
|
+
| `summary` | Summary text |
|
|
127
|
+
| `meta` | Metadata grid |
|
|
128
|
+
|
|
129
|
+
```css
|
|
130
|
+
iiif-manifest-summary::part(card) {
|
|
131
|
+
max-width: 32rem;
|
|
132
|
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
iiif-manifest-summary::part(badge) {
|
|
136
|
+
background: #7c3aed;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### Custom template
|
|
141
|
+
|
|
142
|
+
Pass a render function to `IiifManifestSummary.setTemplate(...)` to replace the built-in card template for every shadow-DOM component:
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
import { IiifManifestSummary } from '@micropasts/iiif-manifest-summary';
|
|
146
|
+
|
|
147
|
+
IiifManifestSummary.setTemplate((summary, escapeHtml) => `
|
|
148
|
+
<article>
|
|
149
|
+
<h2>${escapeHtml(summary.label)}</h2>
|
|
150
|
+
<p>${escapeHtml(summary.canvasCount)} canvases</p>
|
|
151
|
+
</article>
|
|
152
|
+
`);
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Set the template on an individual instance before or after connected content is loaded:
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
const element = document.querySelector('iiif-manifest-summary');
|
|
159
|
+
|
|
160
|
+
element.template = (summary, escapeHtml) => `
|
|
161
|
+
<strong>${escapeHtml(summary.label)}</strong>
|
|
162
|
+
`;
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The instance template takes precedence over the global template. The escape callback HTML-escapes `&`, `<`, `>`, `"`, and control text used in templates.
|
|
166
|
+
|
|
167
|
+
### `<iiif-manifest-summary-tw>` — Tailwind/light DOM
|
|
168
|
+
|
|
169
|
+
This component renders directly into the host element, so its utility classes can be scanned and provided by Tailwind in the host application.
|
|
170
|
+
|
|
171
|
+
```html
|
|
172
|
+
<iiif-manifest-summary-tw
|
|
173
|
+
manifest="https://example.org/iiif/manifest.json"
|
|
174
|
+
card-class="border-sky-300 shadow-lg"
|
|
175
|
+
></iiif-manifest-summary-tw>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
It is registered globally under `iiif-manifest-summary-tw` when it is not already defined.
|
|
179
|
+
|
|
180
|
+
#### Attributes
|
|
181
|
+
|
|
182
|
+
| Attribute | Required | Values | Description |
|
|
183
|
+
| --- | --- | --- | --- |
|
|
184
|
+
| `manifest` | Yes | Manifest URL | Initial URI to fetch and summarize. |
|
|
185
|
+
| `listen` | No | Custom event name | Listens for the named window event and uses `event.detail.manifest` to change manifests. |
|
|
186
|
+
| `card-class` | No | Tailwind/CSS classes | Extra classes appended to the built-in card classes. |
|
|
187
|
+
|
|
188
|
+
The component's `dark:` utilities follow the host application's Tailwind dark-mode
|
|
189
|
+
configuration. With Tailwind's default media-based strategy, they automatically
|
|
190
|
+
follow the system color scheme, including changes while the page is open. If the
|
|
191
|
+
application configures a class- or selector-based dark variant instead, the
|
|
192
|
+
application is responsible for updating that selector; the component does not
|
|
193
|
+
change the page's theme.
|
|
194
|
+
|
|
195
|
+
Ensure Tailwind scans the component's source (including dependencies if installed
|
|
196
|
+
from npm), or otherwise includes its utility classes in the generated CSS. For
|
|
197
|
+
example, Tailwind v3 can include
|
|
198
|
+
`./node_modules/@micropasts/iiif-manifest-summary/src/tailwind.js` in its
|
|
199
|
+
`content` configuration; Tailwind v4 can register the same file with `@source`.
|
|
200
|
+
The demo uses a class-based variant, follows system changes until its theme toggle
|
|
201
|
+
is used, and then preserves the chosen theme in local storage.
|
|
202
|
+
|
|
203
|
+
#### Static Tailwind classes
|
|
204
|
+
|
|
205
|
+
The Tailwind component's default class groups are available as `IiifManifestSummaryTailwind.classes` and can be overridden before rendering:
|
|
206
|
+
|
|
207
|
+
```js
|
|
208
|
+
import { IiifManifestSummaryTailwind } from '@micropasts/iiif-manifest-summary';
|
|
209
|
+
|
|
210
|
+
IiifManifestSummaryTailwind.classes.card =
|
|
211
|
+
'rounded-lg border border-slate-300 bg-white p-4';
|
|
212
|
+
IiifManifestSummaryTailwind.classes.btn =
|
|
213
|
+
'rounded border px-2 py-1 text-xs';
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Listening to external selection events
|
|
217
|
+
|
|
218
|
+
Set `listen` to an event name on either component:
|
|
219
|
+
|
|
220
|
+
```html
|
|
221
|
+
<iiif-manifest-summary listen="catalog:select"></iiif-manifest-summary>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Dispatch the event on `window`:
|
|
225
|
+
|
|
226
|
+
```js
|
|
227
|
+
window.dispatchEvent(
|
|
228
|
+
new CustomEvent('catalog:select', {
|
|
229
|
+
detail: {
|
|
230
|
+
manifest: 'https://example.org/iiif/manifest.json',
|
|
231
|
+
},
|
|
232
|
+
}),
|
|
233
|
+
);
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
The listener is added on `connectedCallback()` and removed on `disconnectedCallback()`.
|
|
237
|
+
|
|
238
|
+
## Selection event
|
|
239
|
+
|
|
240
|
+
Both components dispatch a bubbling, composed `heritage:select` event when **Inspect** is clicked. `composed: true` allows the event to cross the shadow-DOM boundary.
|
|
241
|
+
|
|
242
|
+
```js
|
|
243
|
+
document.addEventListener('heritage:select', (event) => {
|
|
244
|
+
const { uri, label, canvasCount, version } = event.detail;
|
|
245
|
+
console.log(uri, label, canvasCount, version);
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
| Detail field | Type | Description |
|
|
250
|
+
| --- | --- | --- |
|
|
251
|
+
| `uri` | `string` | Resolved manifest URI |
|
|
252
|
+
| `label` | `string` | Displayed manifest label |
|
|
253
|
+
| `canvasCount` | `number` | Number of canvases/items found |
|
|
254
|
+
| `version` | `string` | `IIIF v2`, `IIIF v3`, or `IIIF` for fetch failures |
|
|
255
|
+
|
|
256
|
+
## Public methods
|
|
257
|
+
|
|
258
|
+
Methods are available on component instances:
|
|
259
|
+
|
|
260
|
+
| Method | Class | Description |
|
|
261
|
+
| --- | --- | --- |
|
|
262
|
+
| `load(url)` | Both | Fetch or retrieve a manifest summary and render it |
|
|
263
|
+
| `setTemplate(fn)` | `IiifManifestSummary` only (static) | Set a global custom shadow-DOM render function |
|
|
264
|
+
|
|
265
|
+
The shadow-DOM component also supports an instance `template` property that is checked before the global template.
|
|
266
|
+
|
|
267
|
+
## JavaScript API
|
|
268
|
+
|
|
269
|
+
All named exports are exported from the package entry point.
|
|
270
|
+
|
|
271
|
+
```js
|
|
272
|
+
import {
|
|
273
|
+
summarizeManifest,
|
|
274
|
+
seedManifest,
|
|
275
|
+
clearManifestCache,
|
|
276
|
+
fetchManifestSummary,
|
|
277
|
+
emitManifestSelect,
|
|
278
|
+
copyTextToClipboard,
|
|
279
|
+
stripHtml,
|
|
280
|
+
formatRightsLabel,
|
|
281
|
+
IiifManifestSummary,
|
|
282
|
+
IiifManifestSummaryTailwind,
|
|
283
|
+
} from '@micropasts/iiif-manifest-summary';
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Subpath exports are also declared:
|
|
287
|
+
|
|
288
|
+
| Import | Exports |
|
|
289
|
+
| --- | --- |
|
|
290
|
+
| `@micropasts/iiif-manifest-summary/core` | Core utilities |
|
|
291
|
+
| `@micropasts/iiif-manifest-summary/shadow` | Shadow-DOM component |
|
|
292
|
+
| `@micropasts/iiif-manifest-summary/tailwind` | Tailwind component |
|
|
293
|
+
|
|
294
|
+
### `summarizeManifest(manifest, manifestUri?)`
|
|
295
|
+
|
|
296
|
+
Normalizes a raw IIIF v2 or v3 manifest object into a summary object.
|
|
297
|
+
|
|
298
|
+
```js
|
|
299
|
+
const summary = summarizeManifest(rawManifest, 'https://example.org/manifest');
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
The returned shape is:
|
|
303
|
+
|
|
304
|
+
```js
|
|
305
|
+
{
|
|
306
|
+
uri: 'https://example.org/manifest',
|
|
307
|
+
version: 'IIIF v3',
|
|
308
|
+
label: 'Manifest title',
|
|
309
|
+
summary: 'Short description',
|
|
310
|
+
rights: 'http://creativecommons.org/licenses/by/4.0/',
|
|
311
|
+
rightsLabel: 'CC BY 4.0',
|
|
312
|
+
thumbnail: 'https://example.org/thumbnail.jpg',
|
|
313
|
+
canvasCount: 12,
|
|
314
|
+
metadata: [
|
|
315
|
+
{ label: 'Repository', value: 'Example Archive' },
|
|
316
|
+
],
|
|
317
|
+
// present on fetch failure only:
|
|
318
|
+
error: true,
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
The normalizer:
|
|
323
|
+
|
|
324
|
+
- Detects v3 from a Presentation 3 context or a top-level `items` array
|
|
325
|
+
- Prefers v3 `summary`, then v2 `description`
|
|
326
|
+
- Uses v3 `rights`, or v2 `license`
|
|
327
|
+
- Checks a v3 manifest thumbnail, v2 sequence thumbnail, or v3 first-canvas thumbnail
|
|
328
|
+
- Counts `items` that are canvases or falls back to v2 sequence canvases
|
|
329
|
+
- Includes at most four metadata entries
|
|
330
|
+
|
|
331
|
+
Language-map values prefer the `en` language, then `none`, then the first available language. Arrays are joined with ` · `.
|
|
332
|
+
|
|
333
|
+
### `fetchManifestSummary(uri)`
|
|
334
|
+
|
|
335
|
+
Fetches and summarizes a manifest URI.
|
|
336
|
+
|
|
337
|
+
```js
|
|
338
|
+
const summary = await fetchManifestSummary(
|
|
339
|
+
'https://example.org/iiif/manifest.json',
|
|
340
|
+
);
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
The request sends `Accept: application/json`. Concurrent requests for the same URI share an in-flight promise. HTTP and network failures return an error summary rather than rejecting:
|
|
344
|
+
|
|
345
|
+
```js
|
|
346
|
+
{
|
|
347
|
+
uri,
|
|
348
|
+
version: 'IIIF',
|
|
349
|
+
label: uri,
|
|
350
|
+
summary: 'Unable to load manifest (HTTP 404).',
|
|
351
|
+
rights: 'Unavailable',
|
|
352
|
+
thumbnail: null,
|
|
353
|
+
canvasCount: 0,
|
|
354
|
+
metadata: [],
|
|
355
|
+
error: true,
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### `seedManifest(uri, manifestJson)`
|
|
360
|
+
|
|
361
|
+
Places a raw manifest into the summary cache. This is useful for server-rendered data, testing, demos, and offline sandboxes.
|
|
362
|
+
|
|
363
|
+
```js
|
|
364
|
+
seedManifest('https://example.org/manifest.json', rawManifestJson);
|
|
365
|
+
|
|
366
|
+
const summary = await fetchManifestSummary(
|
|
367
|
+
'https://example.org/manifest.json',
|
|
368
|
+
);
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### `clearManifestCache()`
|
|
372
|
+
|
|
373
|
+
Clears the successful summary cache. In-flight fetches are not cancelled or cleared.
|
|
374
|
+
|
|
375
|
+
```js
|
|
376
|
+
clearManifestCache();
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### `emitManifestSelect(target, summary)`
|
|
380
|
+
|
|
381
|
+
Dispatches `heritage:select` from `target` with a selected subset of summary fields. It is also used internally by the components.
|
|
382
|
+
|
|
383
|
+
```js
|
|
384
|
+
emitManifestSelect(document.querySelector('.container'), summary);
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### `copyTextToClipboard(text)`
|
|
388
|
+
|
|
389
|
+
Copies text using `navigator.clipboard` in a secure context and falls back to a temporary textarea and `document.execCommand('copy')`.
|
|
390
|
+
|
|
391
|
+
```js
|
|
392
|
+
const copied = await copyTextToClipboard('https://example.org/manifest.json');
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Returns `true` when the copy operation reports success, otherwise `false`.
|
|
396
|
+
|
|
397
|
+
### `stripHtml(value)`
|
|
398
|
+
|
|
399
|
+
Converts HTML markup to plain text. It is used for manifest labels, summaries, and metadata values. The browser implementation uses `DOMParser`; a built-in fallback handles tags and common character references.
|
|
400
|
+
|
|
401
|
+
```js
|
|
402
|
+
stripHtml('<p>A <strong>plain</strong> description & title.</p>');
|
|
403
|
+
// 'A plain description & title.'
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### `formatRightsLabel(rights)`
|
|
407
|
+
|
|
408
|
+
Converts common Creative Commons and RightsStatements URIs into readable labels.
|
|
409
|
+
|
|
410
|
+
```js
|
|
411
|
+
formatRightsLabel('http://creativecommons.org/licenses/by-sa/4.0/');
|
|
412
|
+
// 'CC BY-SA 4.0'
|
|
413
|
+
|
|
414
|
+
formatRightsLabel('http://rightsstatements.org/vocab/InC-EDU/1.0/');
|
|
415
|
+
// 'In Copyright - Educational Use'
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
## Demo
|
|
419
|
+
|
|
420
|
+
Run the local demo:
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
npm run dev
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
This builds `dist/` and `docs/`, then serves the demo directory on a local development server.
|
|
427
|
+
|
|
428
|
+
Open the demo to compare the Tailwind light-DOM component with the shadow-DOM component. The demo seeds both v2 and v3 sample manifests, so it can render without live manifest requests.
|
|
429
|
+
|
|
430
|
+
## Build
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
npm run build
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
The build script creates:
|
|
437
|
+
|
|
438
|
+
- `dist/iiif-manifest-summary.esm.js`
|
|
439
|
+
- `dist/iiif-manifest-summary.iife.js`
|
|
440
|
+
- `docs/iiif-manifest-summary.esm.js`
|
|
441
|
+
- `docs/index.html`
|
|
442
|
+
|
|
443
|
+
The IIFE build exposes the package API through `window.IiifManifestSummaryLib`.
|
|
444
|
+
|
|
445
|
+
## Browser support
|
|
446
|
+
|
|
447
|
+
The components use standard custom elements, shadow DOM, `fetch`, `Map`, `async`/`await`, and template literals. Serve module builds over HTTP(S); opening module files directly with `file://` may be restricted by browser module-loading rules.
|
|
448
|
+
|
|
449
|
+
## License
|
|
450
|
+
|
|
451
|
+
MIT
|