@uvalib/web-components 1.6.0 → 1.8.0
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/CHANGELOG.md +36 -0
- package/README.md +133 -12
- package/dist/base/states.d.ts +12 -0
- package/dist/base/states.js +33 -0
- package/dist/base/states.js.map +1 -0
- package/dist/base.css +15 -5
- package/dist/components/bento-box/BentoBox.js +1 -0
- package/dist/components/bento-box/BentoBox.js.map +1 -1
- package/dist/components/events-section/EventsSection.js +1 -0
- package/dist/components/events-section/EventsSection.js.map +1 -1
- package/dist/components/library-hours/hours-data.js +1 -1
- package/dist/components/library-hours/hours-data.js.map +1 -1
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +1 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -1
- package/dist/components/uvalib-card/UvalibCard.js +6 -0
- package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
- package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +27 -0
- package/dist/components/uvalib-combobox/UvalibCombobox.js +85 -1
- package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -1
- package/dist/components/uvalib-contents/UvalibContents.js +5 -0
- package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +6 -0
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +10 -0
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -1
- package/dist/components/uvalib-image-regions/UvalibImageRegions.d.ts +1 -0
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js +4 -1
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -1
- package/dist/components/uvalib-image-regions/regions.d.ts +6 -2
- package/dist/components/uvalib-image-regions/regions.js +6 -3
- package/dist/components/uvalib-image-regions/regions.js.map +1 -1
- package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +100 -7
- package/dist/components/uvalib-lightbox/UvalibLightbox.js +310 -83
- package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
- package/dist/components/uvalib-lightbox/compare.d.ts +48 -8
- package/dist/components/uvalib-lightbox/compare.js +226 -22
- package/dist/components/uvalib-lightbox/compare.js.map +1 -1
- package/dist/components/uvalib-map/UvalibMap.js +2 -2
- package/dist/components/uvalib-map/UvalibMap.js.map +1 -1
- package/dist/components/uvalib-metadata/UvalibMetadata.js +3 -0
- package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js +3 -1
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js.map +1 -1
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +3 -3
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +16 -8
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
- package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +4 -1
- package/dist/components/uvalib-tag-list/UvalibTagList.js +9 -2
- package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -1
- package/dist/custom-elements.json +596 -19
- package/dist/styles/message.js +4 -0
- package/dist/styles/message.js.map +1 -1
- package/dist/styles/result-list.js +25 -4
- package/dist/styles/result-list.js.map +1 -1
- package/dist/styles/results.js +17 -2
- package/dist/styles/results.js.map +1 -1
- package/dist-cdn/base.css +15 -5
- package/dist-cdn/bento-box.js +1 -0
- package/dist-cdn/bento-box.js.map +1 -1
- package/dist-cdn/chunks/{compare-D4VdaIJN.js → compare-C0nhByn7.js} +185 -56
- package/dist-cdn/chunks/compare-C0nhByn7.js.map +1 -0
- package/dist-cdn/chunks/{hours-data-Bw6vkIw7.js → hours-data-gMu5uT7H.js} +2 -2
- package/dist-cdn/chunks/hours-data-gMu5uT7H.js.map +1 -0
- package/dist-cdn/chunks/{library-weekly-hours-CrV3TlP5.js → library-weekly-hours-BJgxAyah.js} +3 -2
- package/dist-cdn/chunks/library-weekly-hours-BJgxAyah.js.map +1 -0
- package/dist-cdn/chunks/{regions-B8ExwUGP.js → regions-B-rOwa-v.js} +15 -15
- package/dist-cdn/chunks/regions-B-rOwa-v.js.map +1 -0
- package/dist-cdn/chunks/states-DGXGzcte.js +17 -0
- package/dist-cdn/chunks/states-DGXGzcte.js.map +1 -0
- package/dist-cdn/custom-elements.json +596 -19
- package/dist-cdn/events-section.js +1 -0
- package/dist-cdn/events-section.js.map +1 -1
- package/dist-cdn/library-hours-setup.js +1 -1
- package/dist-cdn/library-weekly-hours.js +1 -1
- package/dist-cdn/manifest.json +1 -1
- package/dist-cdn/site-hours-section.js +1 -1
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +8 -6
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +37 -6
- package/dist-cdn/uvalib-card.js +6 -0
- package/dist-cdn/uvalib-card.js.map +1 -1
- package/dist-cdn/uvalib-combobox.js +107 -68
- package/dist-cdn/uvalib-combobox.js.map +1 -1
- package/dist-cdn/uvalib-contents.js +5 -0
- package/dist-cdn/uvalib-contents.js.map +1 -1
- package/dist-cdn/uvalib-filter-drawer.js +27 -25
- package/dist-cdn/uvalib-filter-drawer.js.map +1 -1
- package/dist-cdn/uvalib-image-regions.js +4 -2
- package/dist-cdn/uvalib-image-regions.js.map +1 -1
- package/dist-cdn/uvalib-lightbox.js +230 -129
- package/dist-cdn/uvalib-lightbox.js.map +1 -1
- package/dist-cdn/uvalib-map.js +2 -2
- package/dist-cdn/uvalib-map.js.map +1 -1
- package/dist-cdn/uvalib-metadata.js +3 -0
- package/dist-cdn/uvalib-metadata.js.map +1 -1
- package/dist-cdn/uvalib-pagefind-search.js +2 -1
- package/dist-cdn/uvalib-pagefind-search.js.map +1 -1
- package/dist-cdn/uvalib-photo-grid.js +4 -5
- package/dist-cdn/uvalib-photo-grid.js.map +1 -1
- package/dist-cdn/uvalib-tag-list.js +21 -16
- package/dist-cdn/uvalib-tag-list.js.map +1 -1
- package/package.json +1 -1
- package/skills/uvalib-web-components/SKILL.md +8 -6
- package/skills/uvalib-web-components/reference/components.md +37 -6
- package/dist-cdn/chunks/compare-D4VdaIJN.js.map +0 -1
- package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +0 -1
- package/dist-cdn/chunks/library-weekly-hours-CrV3TlP5.js.map +0 -1
- package/dist-cdn/chunks/regions-B8ExwUGP.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regions.js","sourceRoot":"","sources":["../../../src/components/uvalib-image-regions/regions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoCH
|
|
1
|
+
{"version":3,"file":"regions.js","sourceRoot":"","sources":["../../../src/components/uvalib-image-regions/regions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoCH;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CACvB,KAAgC,EAChC,UAAgC,EAAE;IAElC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,EAAE,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,EAAE,IAAI,CAAC;QAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACjC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,IAAI,GAAsB,IAAI,CAAC;IACnC,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5C,IAAI,MAAM,EAAE,CAAC;QACX,IAAI,GAAG,MAAM,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,C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,GAAG,EAAE,CAAC,EAAE,KAAK,GAAG,IAAI,EAAE,CAAC,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAChF,CAAC"}
|
|
@@ -27,6 +27,34 @@ export interface LightboxVersion {
|
|
|
27
27
|
export type LightboxVersions = (item: LightboxRegionsItem) => readonly LightboxVersion[] | null | undefined;
|
|
28
28
|
/** Returns the page's own region list for an image: an `<ol>` or `<ul>` of `<li data-xywh>`. */
|
|
29
29
|
export type LightboxRegionsList = (item: LightboxRegionsItem) => Element | null | undefined;
|
|
30
|
+
/** Why the viewer closed, in `uvalib-lightbox-close`. */
|
|
31
|
+
export type LightboxCloseReason = 'close' | 'api' | 'history' | 'empty';
|
|
32
|
+
/** `detail` of `uvalib-lightbox-open`. */
|
|
33
|
+
export interface LightboxOpenDetail {
|
|
34
|
+
/** The item's id (as `url-param` writes it). */
|
|
35
|
+
id: string;
|
|
36
|
+
/** Its place in the set, from 0. */
|
|
37
|
+
index: number;
|
|
38
|
+
/** True when the viewer was restored from the address (a reload, Back or Forward). */
|
|
39
|
+
restored: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** `detail` of `uvalib-lightbox-close`. */
|
|
42
|
+
export interface LightboxCloseDetail {
|
|
43
|
+
/** The item that was shown. */
|
|
44
|
+
id: string;
|
|
45
|
+
/** Its place in the set, from 0. */
|
|
46
|
+
index: number;
|
|
47
|
+
/**
|
|
48
|
+
* `close` (Close, Escape or the backdrop), `api` (`close()`), `history` (Back or Forward)
|
|
49
|
+
* or `empty` (the last image left the page).
|
|
50
|
+
*/
|
|
51
|
+
reason: LightboxCloseReason;
|
|
52
|
+
}
|
|
53
|
+
/** Options for `close()`. */
|
|
54
|
+
export interface LightboxCloseOptions {
|
|
55
|
+
/** Where focus goes instead of the item's link (for example the page's heading). */
|
|
56
|
+
focus?: HTMLElement | null;
|
|
57
|
+
}
|
|
30
58
|
/**
|
|
31
59
|
* An accessible image viewer over a set of plain links. With JavaScript a primary click opens
|
|
32
60
|
* a modal dialog; without it (or with a modified click) the link opens the image as before.
|
|
@@ -46,7 +74,14 @@ export type LightboxRegionsList = (item: LightboxRegionsItem) => Element | null
|
|
|
46
74
|
* Optional details: children with `slot="details"` (and `data-for` equal to the item's id or
|
|
47
75
|
* its position from 1; without `data-for` they show for every image), or `data-details-id` on
|
|
48
76
|
* a link pointing at an element elsewhere on the page. Either is shown inside the dialog and
|
|
49
|
-
* put back when the viewer moves on or closes.
|
|
77
|
+
* put back exactly (same place, `hidden` and `slot`) when the viewer moves on or closes. The
|
|
78
|
+
* `data-details-id` element stays in the page (in shadow mode it becomes a child of the
|
|
79
|
+
* lightbox slotted into the dialog), so `getElementById`, the page's CSS (except selectors
|
|
80
|
+
* through its old ancestors) and listeners keep working; nothing is cloned. Details that appear
|
|
81
|
+
* while their image is open (rendered after a fetch) are shown then.
|
|
82
|
+
*
|
|
83
|
+
* `open(idOrIndex)` and `close({ focus })` let the page open or close the viewer itself;
|
|
84
|
+
* `uvalib-lightbox-open` and `uvalib-lightbox-close` say when it did.
|
|
50
85
|
*
|
|
51
86
|
* Optional regions (people, objects, inscriptions): `data-regions` on a link, a JSON array of
|
|
52
87
|
* `{ label, x, y, w, h, unit? }` or `xywh` values each followed by its label, separated by
|
|
@@ -73,11 +108,19 @@ export type LightboxRegionsList = (item: LightboxRegionsItem) => Element | null
|
|
|
73
108
|
* the image's accessible name ends with the label of the version shown. `version-param`
|
|
74
109
|
* (with `url-param`) keeps the comparison in the address: `?version=2` (Switch, the version
|
|
75
110
|
* from 0), `?version=wipe:40` or `?version=fade:60` (the percentage of the other version
|
|
76
|
-
* shown; `wipe:40:2` compares the original with version 2).
|
|
111
|
+
* shown; `wipe:40:2` compares the original with version 2). `data-version` on a link (the
|
|
112
|
+
* same values) opens that image on that version, from a click, `open()` or Previous and
|
|
113
|
+
* Next; an address with `version-param` wins. A version with a different
|
|
114
|
+
* framing (an AI-expanded frame, a crop, the whole plate) gives `frame`, the original's box
|
|
115
|
+
* in it (`percent:x,y,w,h`, or pixels of its `width` × `height`): the viewer draws every
|
|
116
|
+
* version at the original's scale in one box, the original lined up, and regions stay on it.
|
|
117
|
+
*
|
|
118
|
+
* Pages can style the element while the viewer is open with `:state(open)`.
|
|
77
119
|
*
|
|
78
120
|
* @tagname uvalib-lightbox
|
|
79
121
|
* @slot - The image links. A plain click opens the viewer; without JavaScript they open the image.
|
|
80
122
|
* @slot details - Details for the open image. `data-for` selects one item by its id or position (from 1); without it the details show for every image.
|
|
123
|
+
* @cssstate open - The viewer is open.
|
|
81
124
|
* @csspart dialog - The modal dialog.
|
|
82
125
|
* @csspart panel - The surface inside the dialog.
|
|
83
126
|
* @csspart caption - The caption that names the dialog.
|
|
@@ -86,6 +129,8 @@ export type LightboxRegionsList = (item: LightboxRegionsItem) => Element | null
|
|
|
86
129
|
* @csspart details - The details panel.
|
|
87
130
|
* @csspart regions - The `<uvalib-image-regions>` around an image with regions.
|
|
88
131
|
* @csspart compare - The version comparison controls and notes under the photo.
|
|
132
|
+
* @fires uvalib-lightbox-open - The viewer opened (a click, `open()`, or restored from the address): `detail` is `{ id, index, restored }` (`index` from 0; `restored` true for the address, Back and Forward). Not fired when it moves to another image. Bubbles and is composed.
|
|
133
|
+
* @fires uvalib-lightbox-close - The viewer closed: `detail` is `{ id, index, reason }`, the image shown and `reason` `close` (Close, Escape, the backdrop), `api` (`close()`), `history` (Back or Forward) or `empty` (the last image left the page). Not fired when the element is removed. Bubbles and is composed.
|
|
89
134
|
* @fires uvalib-lightbox-version - The visitor changed the comparison (mode, version or position; once a slider settles): `detail` is `{ id, mode, index, value }` (`mode` `switch`, `wipe` or `fade`; `index` the version shown or compared, from 0; `value` the percentage of it shown, null for Switch). Not fired on open or for a comparison restored from the URL. Bubbles and is composed.
|
|
90
135
|
* @fires uvalib-analytics-event - For `<site-analytics>`: `['uvalib-lightbox', 'open'|'next'|'previous'|'full-size', 'image N', N]` (N from 1, the image's place in the set), and `['uvalib-lightbox', 'compare', 'switch'|'wipe'|'fade', N]` when the visitor changes a comparison (N the version's place from 1; once a slider settles). Never the URL, the caption or a version's label. Not fired for a viewer restored from the URL or from Back and Forward. Bubbles and is composed.
|
|
91
136
|
* @cssprop --uva-color-surface-raised - Dark-mode role token: dialog surface (else `--uva-color-surface`, else #fff).
|
|
@@ -135,7 +180,8 @@ export declare class UvalibLightbox extends UvalibElement {
|
|
|
135
180
|
/**
|
|
136
181
|
* Versions of each image, instead of `data-versions`: called with
|
|
137
182
|
* `{ element, id, href, index }`, it returns `{ label, href?, note? }` objects, the first
|
|
138
|
-
* being the link's own image (null: none).
|
|
183
|
+
* being the link's own image (null: none). The link's `data-version` still picks the
|
|
184
|
+
* version it opens on.
|
|
139
185
|
*/
|
|
140
186
|
versions?: LightboxVersions;
|
|
141
187
|
/**
|
|
@@ -152,13 +198,14 @@ export declare class UvalibLightbox extends UvalibElement {
|
|
|
152
198
|
versionParam: string;
|
|
153
199
|
private slides;
|
|
154
200
|
private index;
|
|
155
|
-
private
|
|
201
|
+
private shown;
|
|
156
202
|
private status;
|
|
157
203
|
private fitW;
|
|
158
204
|
private fitH;
|
|
159
205
|
/** The "Show regions" toggle: outlines over an image that has regions. */
|
|
160
206
|
private showRegions;
|
|
161
207
|
private readonly captionId;
|
|
208
|
+
private readonly internals;
|
|
162
209
|
/** Where the dialog is rendered. Light DOM renders here so the author's links stay put. */
|
|
163
210
|
private mount?;
|
|
164
211
|
private trigger;
|
|
@@ -202,6 +249,13 @@ export declare class UvalibLightbox extends UvalibElement {
|
|
|
202
249
|
/** Details elements moved into the dialog, and where they go back to. */
|
|
203
250
|
private parked;
|
|
204
251
|
private parkedKey;
|
|
252
|
+
/** Watches for the open image's `data-details-id` element while it is missing. */
|
|
253
|
+
private lateDetails?;
|
|
254
|
+
private lateDetailsId;
|
|
255
|
+
/** The details panel, observed (shadow mode) for `data-for` changes on details moved into it. */
|
|
256
|
+
private watchedBox?;
|
|
257
|
+
/** The open image after its link left the page: still shown, dropped once the viewer moves on. */
|
|
258
|
+
private orphan;
|
|
205
259
|
/** The page's region list lent to the viewer, and how to give it back as it was. */
|
|
206
260
|
private lent;
|
|
207
261
|
/** Each entry's own `tabindex` (null: none), so one the viewer added is removed. */
|
|
@@ -251,6 +305,22 @@ export declare class UvalibLightbox extends UvalibElement {
|
|
|
251
305
|
private readonly onResize;
|
|
252
306
|
private readonly onClick;
|
|
253
307
|
private linkFrom;
|
|
308
|
+
/**
|
|
309
|
+
* Opens an item as a click on its link would: `item` is its id (as `url-param` writes it)
|
|
310
|
+
* or its place in the set from 0. Returns false when there is no such item. Focus goes back
|
|
311
|
+
* to the item's link on close. With the viewer open it shows that item instead. Fires
|
|
312
|
+
* `uvalib-lightbox-open` (when the viewer was closed), not analytics: it is the page's call.
|
|
313
|
+
*/
|
|
314
|
+
open(item: string | number): boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Closes the viewer as Close does, `url-param` and `version-param` included (Back when the
|
|
317
|
+
* viewer pushed the entry, else they are removed). Focus goes to `focus` when given, else to
|
|
318
|
+
* the item's link; when that link has left the page, to the first image link left, else to
|
|
319
|
+
* the lightbox itself (made focusable with `tabindex="-1"` until it loses focus). Returns
|
|
320
|
+
* false when the viewer was not open.
|
|
321
|
+
*/
|
|
322
|
+
close(options?: LightboxCloseOptions): boolean;
|
|
323
|
+
private announce;
|
|
254
324
|
/** A visitor chose `slides[i]`. The first open pushes a history entry; a later choice replaces it. */
|
|
255
325
|
private activate;
|
|
256
326
|
/** Restore a viewer the URL already points at. No analytics: it is not a new action. */
|
|
@@ -289,7 +359,12 @@ export declare class UvalibLightbox extends UvalibElement {
|
|
|
289
359
|
private get dialogEl();
|
|
290
360
|
private get closeBtn();
|
|
291
361
|
private get detailsBox();
|
|
292
|
-
|
|
362
|
+
/**
|
|
363
|
+
* Focus after a close: `focus` when the page gave one, else the trigger; when the trigger
|
|
364
|
+
* has left the page, the first image link left, else the lightbox itself (focusable with
|
|
365
|
+
* `tabindex="-1"` until it loses focus), so focus is never dropped on the body.
|
|
366
|
+
*/
|
|
367
|
+
private focusAfterClose;
|
|
293
368
|
/**
|
|
294
369
|
* Open the dialog and focus Close. `showModal` can throw while a dialog is still leaving
|
|
295
370
|
* the top layer (a reopen from Back/Forward, or the first paint), so try again on the next
|
|
@@ -313,10 +388,28 @@ export declare class UvalibLightbox extends UvalibElement {
|
|
|
313
388
|
* set, so this does not move them again.
|
|
314
389
|
*/
|
|
315
390
|
private matchingDetails;
|
|
391
|
+
/**
|
|
392
|
+
* Show the open image's details. `slot="details"` children move into the details panel. A
|
|
393
|
+
* `data-details-id` element stays in the page: in shadow mode it becomes a light-DOM child of
|
|
394
|
+
* the lightbox slotted into the panel (so `getElementById`, the page's CSS and its listeners
|
|
395
|
+
* keep working); in light DOM it moves into the panel, which is in the page too. Nothing is
|
|
396
|
+
* cloned. Called again for late details; a key keeps it from moving anything twice.
|
|
397
|
+
*/
|
|
316
398
|
private placeDetails;
|
|
399
|
+
/** The panel shows only while it has something in it. */
|
|
400
|
+
private markDetailsBox;
|
|
401
|
+
/**
|
|
402
|
+
* The open image names a details element that is not in the page yet (a framework renders
|
|
403
|
+
* it after a fetch): watch this root, only while open and only for that id, and show it
|
|
404
|
+
* when it appears.
|
|
405
|
+
*/
|
|
406
|
+
private awaitDetails;
|
|
407
|
+
private stopAwaitingDetails;
|
|
317
408
|
/**
|
|
318
|
-
* Put a parked element back
|
|
319
|
-
* if it is not (it was parked
|
|
409
|
+
* Put a parked element back as it was: same parent and place, same `hidden` and `slot`.
|
|
410
|
+
* Restoring later siblings first keeps `next` inside `parent`; if it is not (it was parked
|
|
411
|
+
* too), insert at the end instead of throwing NotFoundError. An element the page has
|
|
412
|
+
* removed or moved meanwhile stays where the page put it.
|
|
320
413
|
*/
|
|
321
414
|
private putBack;
|
|
322
415
|
private restoreDetails;
|