@uvalib/web-components 1.1.0 → 1.2.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +563 -47
  3. package/dist/base/url-param.d.ts +23 -0
  4. package/dist/base/url-param.js +49 -0
  5. package/dist/base/url-param.js.map +1 -0
  6. package/dist/base.css +289 -1
  7. package/dist/components/uvalib-card/UvalibCard.d.ts +19 -5
  8. package/dist/components/uvalib-card/UvalibCard.js +112 -9
  9. package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
  10. package/dist/components/uvalib-chip-group/UvalibChipGroup.d.ts +156 -0
  11. package/dist/components/uvalib-chip-group/UvalibChipGroup.js +747 -0
  12. package/dist/components/uvalib-chip-group/UvalibChipGroup.js.map +1 -0
  13. package/dist/components/uvalib-chip-group/uvalib-chip-group.d.ts +1 -0
  14. package/dist/components/uvalib-chip-group/uvalib-chip-group.js +4 -0
  15. package/dist/components/uvalib-chip-group/uvalib-chip-group.js.map +1 -0
  16. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.d.ts +148 -0
  17. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js +1248 -0
  18. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js.map +1 -0
  19. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.d.ts +1 -0
  20. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js +4 -0
  21. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js.map +1 -0
  22. package/dist/components/uvalib-lightbox/UvalibLightbox.js +8 -1
  23. package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
  24. package/dist/components/uvalib-lightbox/media.d.ts +1 -18
  25. package/dist/components/uvalib-lightbox/media.js +1 -42
  26. package/dist/components/uvalib-lightbox/media.js.map +1 -1
  27. package/dist/components/uvalib-pager/UvalibPager.d.ts +58 -4
  28. package/dist/components/uvalib-pager/UvalibPager.js +232 -8
  29. package/dist/components/uvalib-pager/UvalibPager.js.map +1 -1
  30. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +27 -1
  31. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +192 -26
  32. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
  33. package/dist/components/uvalib-results-count/UvalibResultsCount.d.ts +62 -0
  34. package/dist/components/uvalib-results-count/UvalibResultsCount.js +208 -0
  35. package/dist/components/uvalib-results-count/UvalibResultsCount.js.map +1 -0
  36. package/dist/components/uvalib-results-count/uvalib-results-count.d.ts +1 -0
  37. package/dist/components/uvalib-results-count/uvalib-results-count.js +4 -0
  38. package/dist/components/uvalib-results-count/uvalib-results-count.js.map +1 -0
  39. package/dist/components/uvalib-tabs/UvalibTabs.d.ts +127 -0
  40. package/dist/components/uvalib-tabs/UvalibTabs.js +821 -0
  41. package/dist/components/uvalib-tabs/UvalibTabs.js.map +1 -0
  42. package/dist/components/uvalib-tabs/uvalib-tabs.d.ts +1 -0
  43. package/dist/components/uvalib-tabs/uvalib-tabs.js +4 -0
  44. package/dist/components/uvalib-tabs/uvalib-tabs.js.map +1 -0
  45. package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +89 -0
  46. package/dist/components/uvalib-tag-list/UvalibTagList.js +411 -0
  47. package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -0
  48. package/dist/components/uvalib-tag-list/uvalib-tag-list.d.ts +1 -0
  49. package/dist/components/uvalib-tag-list/uvalib-tag-list.js +4 -0
  50. package/dist/components/uvalib-tag-list/uvalib-tag-list.js.map +1 -0
  51. package/dist/custom-elements.json +7140 -2630
  52. package/dist/index.d.ts +8 -0
  53. package/dist/index.js +5 -0
  54. package/dist/index.js.map +1 -1
  55. package/dist/styles/base.js +35 -1
  56. package/dist/styles/base.js.map +1 -1
  57. package/dist/styles/color-scheme.js +4 -0
  58. package/dist/styles/color-scheme.js.map +1 -1
  59. package/dist/styles/controls.js +2 -0
  60. package/dist/styles/controls.js.map +1 -1
  61. package/dist/styles/results.d.ts +1 -0
  62. package/dist/styles/results.js +257 -0
  63. package/dist/styles/results.js.map +1 -0
  64. package/dist/tokens.css +4 -0
  65. package/dist-cdn/base.css +289 -1
  66. package/dist-cdn/chunks/{base-CAFQWnZG.js → base-p5pk0vb2.js} +36 -2
  67. package/dist-cdn/chunks/{base-CAFQWnZG.js.map → base-p5pk0vb2.js.map} +1 -1
  68. package/dist-cdn/chunks/inline-copy-BANQSMIR.js +69 -0
  69. package/dist-cdn/chunks/inline-copy-BANQSMIR.js.map +1 -0
  70. package/dist-cdn/chunks/{site-header-C9V7Wuw2.js → site-header-BlOYvQg1.js} +5 -1
  71. package/dist-cdn/chunks/site-header-BlOYvQg1.js.map +1 -0
  72. package/dist-cdn/chunks/source-children-BHsDwCvL.js +53 -0
  73. package/dist-cdn/chunks/source-children-BHsDwCvL.js.map +1 -0
  74. package/dist-cdn/chunks/url-param-C1sk_F1d.js +28 -0
  75. package/dist-cdn/chunks/url-param-C1sk_F1d.js.map +1 -0
  76. package/dist-cdn/custom-elements.json +7140 -2630
  77. package/dist-cdn/manifest.json +7 -2
  78. package/dist-cdn/site-header.js +1 -1
  79. package/dist-cdn/site-page.js +2 -2
  80. package/dist-cdn/site-style.js +1 -1
  81. package/dist-cdn/skills/uvalib-web-components/SKILL.md +206 -19
  82. package/dist-cdn/skills/uvalib-web-components/reference/components.md +220 -6
  83. package/dist-cdn/tokens.css +4 -0
  84. package/dist-cdn/uvalib-card.js +94 -20
  85. package/dist-cdn/uvalib-card.js.map +1 -1
  86. package/dist-cdn/uvalib-chip-group.js +496 -0
  87. package/dist-cdn/uvalib-chip-group.js.map +1 -0
  88. package/dist-cdn/uvalib-contents.js +2 -1
  89. package/dist-cdn/uvalib-contents.js.map +1 -1
  90. package/dist-cdn/uvalib-date-histogram.js +850 -0
  91. package/dist-cdn/uvalib-date-histogram.js.map +1 -0
  92. package/dist-cdn/uvalib-lightbox.js +26 -48
  93. package/dist-cdn/uvalib-lightbox.js.map +1 -1
  94. package/dist-cdn/uvalib-metadata.js +2 -1
  95. package/dist-cdn/uvalib-metadata.js.map +1 -1
  96. package/dist-cdn/uvalib-pager.js +141 -7
  97. package/dist-cdn/uvalib-pager.js.map +1 -1
  98. package/dist-cdn/uvalib-photo-grid.js +121 -19
  99. package/dist-cdn/uvalib-photo-grid.js.map +1 -1
  100. package/dist-cdn/uvalib-results-count.js +101 -0
  101. package/dist-cdn/uvalib-results-count.js.map +1 -0
  102. package/dist-cdn/uvalib-tabs.js +436 -0
  103. package/dist-cdn/uvalib-tabs.js.map +1 -0
  104. package/dist-cdn/uvalib-tag-list.js +267 -0
  105. package/dist-cdn/uvalib-tag-list.js.map +1 -0
  106. package/package.json +24 -3
  107. package/skills/uvalib-web-components/SKILL.md +206 -19
  108. package/skills/uvalib-web-components/reference/components.md +220 -6
  109. package/dist-cdn/chunks/site-header-C9V7Wuw2.js.map +0 -1
  110. package/dist-cdn/chunks/source-children-RuAec527.js +0 -119
  111. package/dist-cdn/chunks/source-children-RuAec527.js.map +0 -1
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Keep a query parameter in the address, in the search string or, on a hash route, inside the
3
+ * hash. Shared by `<uvalib-lightbox url-param>` and `<uvalib-chip-group url-param>`.
4
+ */
5
+ /** Location pieces the deep-link helpers read and write. `search` includes the leading `?`. */
6
+ export interface PageLocation {
7
+ pathname: string;
8
+ search: string;
9
+ hash: string;
10
+ }
11
+ /** A hash used as a route (`#/…`, `#!/…`) or that already carries a query string. */
12
+ export declare function usesHashParam(hash: string): boolean;
13
+ /** The deep-link id in `loc`, from the hash query on a hash route and the search string otherwise. */
14
+ export declare function paramFromLocation(loc: PageLocation, name: string): string | null;
15
+ /**
16
+ * `loc` with `name` set to `id`, or removed when `id` is null. Hash routes keep the param in
17
+ * the hash (`#/text/d9?photo=2`) and leave `search` alone; every other URL uses `search` and
18
+ * keeps the hash. The hash is written as text so a `?` in it is not percent-encoded.
19
+ * `hashMode` forces the hash (or the search) when the caller is mid-rewrite and the hash no
20
+ * longer shows that it was a route, as when `?photo=` was just removed from `#chapter?photo=1`.
21
+ * `keepEmpty` writes an empty `id` as `?name=` instead of removing the parameter.
22
+ */
23
+ export declare function hrefWithParam(loc: PageLocation, name: string, id: string | null, hashMode?: boolean, keepEmpty?: boolean): string;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Keep a query parameter in the address, in the search string or, on a hash route, inside the
3
+ * hash. Shared by `<uvalib-lightbox url-param>` and `<uvalib-chip-group url-param>`.
4
+ */
5
+ /** A hash used as a route (`#/…`, `#!/…`) or that already carries a query string. */
6
+ export function usesHashParam(hash) {
7
+ return hash.startsWith('#/') || hash.startsWith('#!/') || hash.includes('?');
8
+ }
9
+ /** The deep-link id in `loc`, from the hash query on a hash route and the search string otherwise. */
10
+ export function paramFromLocation(loc, name) {
11
+ if (!name)
12
+ return null;
13
+ if (usesHashParam(loc.hash)) {
14
+ const q = loc.hash.indexOf('?');
15
+ const params = new URLSearchParams(q >= 0 ? loc.hash.slice(q + 1) : '');
16
+ return params.get(name);
17
+ }
18
+ return new URLSearchParams(loc.search).get(name);
19
+ }
20
+ /**
21
+ * `loc` with `name` set to `id`, or removed when `id` is null. Hash routes keep the param in
22
+ * the hash (`#/text/d9?photo=2`) and leave `search` alone; every other URL uses `search` and
23
+ * keeps the hash. The hash is written as text so a `?` in it is not percent-encoded.
24
+ * `hashMode` forces the hash (or the search) when the caller is mid-rewrite and the hash no
25
+ * longer shows that it was a route, as when `?photo=` was just removed from `#chapter?photo=1`.
26
+ * `keepEmpty` writes an empty `id` as `?name=` instead of removing the parameter.
27
+ */
28
+ export function hrefWithParam(loc, name, id, hashMode, keepEmpty = false) {
29
+ const set = id !== null && (id !== '' || keepEmpty);
30
+ if (hashMode ?? usesHashParam(loc.hash)) {
31
+ const q = loc.hash.indexOf('?');
32
+ const path = q >= 0 ? loc.hash.slice(0, q) : loc.hash;
33
+ const params = new URLSearchParams(q >= 0 ? loc.hash.slice(q + 1) : '');
34
+ if (set)
35
+ params.set(name, id);
36
+ else
37
+ params.delete(name);
38
+ const qs = params.toString();
39
+ return loc.pathname + loc.search + (qs ? `${path}?${qs}` : path);
40
+ }
41
+ const params = new URLSearchParams(loc.search);
42
+ if (set)
43
+ params.set(name, id);
44
+ else
45
+ params.delete(name);
46
+ const qs = params.toString();
47
+ return loc.pathname + (qs ? `?${qs}` : '') + loc.hash;
48
+ }
49
+ //# sourceMappingURL=url-param.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-param.js","sourceRoot":"","sources":["../../src/base/url-param.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,qFAAqF;AACrF,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC/E,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,iBAAiB,CAAC,GAAiB,EAAE,IAAY;IAC/D,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACxE,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAiB,EACjB,IAAY,EACZ,EAAiB,EACjB,QAAkB,EAClB,SAAS,GAAG,KAAK;IAEjB,MAAM,GAAG,GAAG,EAAE,KAAK,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,SAAS,CAAC,CAAC;IACpD,IAAI,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;QACtD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACxE,IAAI,GAAG;YAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;;YACzB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC7B,OAAO,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,GAAG;QAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;;QACzB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC7B,OAAO,GAAG,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC;AACxD,CAAC"}
package/dist/base.css CHANGED
@@ -28,12 +28,46 @@
28
28
  uvalib-card-grid:not(:defined),
29
29
  uvalib-pager:not(:defined),
30
30
  uvalib-contents:not(:defined),
31
- uvalib-metadata:not(:defined) {
31
+ uvalib-metadata:not(:defined),
32
+ uvalib-tag-list:not(:defined) {
32
33
  display: block;
33
34
  line-height: 1.5;
34
35
  visibility: hidden;
35
36
  animation: uvalib-site-page-reveal 0s 2s forwards;
36
37
  }
38
+ /* A chip row: hidden, one 44px row tall (with the scrolling row's padding), the raw
39
+ children kept on one line so they cannot make it taller. */
40
+ uvalib-chip-group:not(:defined) {
41
+ display: block;
42
+ min-height: 44px;
43
+ max-width: 100%;
44
+ overflow: hidden;
45
+ white-space: nowrap;
46
+ visibility: hidden;
47
+ animation: uvalib-site-page-reveal 0s 2s forwards;
48
+ }
49
+ uvalib-chip-group[scroll]:not(:defined) {
50
+ min-height: calc(44px + 0.75rem);
51
+ }
52
+ /* Its text is drawn from attributes: hold one line until it upgrades. */
53
+ uvalib-results-count:not(:defined) {
54
+ display: block;
55
+ min-block-size: 1.5em;
56
+ }
57
+ uvalib-tag-list:not(:defined)[hidden],
58
+ uvalib-results-count:not(:defined)[hidden] {
59
+ display: none;
60
+ }
61
+ /* Tabs stay readable before the script runs: a block, one panel, and a gap the
62
+ size of the tab row (44px) plus its 1rem margin, so the first panel does not
63
+ jump when the element upgrades. Later data-tab panels stay hidden. */
64
+ uvalib-tabs:not(:defined) {
65
+ display: block;
66
+ padding-block-start: calc(44px + 1rem);
67
+ }
68
+ uvalib-tabs:not(:defined) > [data-tab] ~ [data-tab] {
69
+ display: none;
70
+ }
37
71
  @keyframes uvalib-site-page-reveal {
38
72
  to {
39
73
  visibility: visible;
@@ -56,6 +90,16 @@
56
90
  --uva-color-control-border: light-dark(var(--uva-grey, #808080), #7a84a0);
57
91
  --uva-color-surface-raised: light-dark(#ffffff, #232d4b);
58
92
  --uva-color-input-text: light-dark(#1f2937, #e8e8e8);
93
+ --uva-color-alert-text: light-dark(var(--uva-grey-darkest, #2b2b2b), #e8e8e8);
94
+ --uva-color-status-success-border: light-dark(var(--uva-green-A, #4e9737), #62bb46);
95
+ --uva-color-status-success-bg: light-dark(var(--uva-green-200, #ddefdc), #173d1c);
96
+ --uva-color-alert-warning-border: light-dark(var(--uva-yellow, #ecc602), #ecc602);
97
+ --uva-color-alert-warning-bg: light-dark(var(--uva-yellow-100, #fef6c8), #3d3510);
98
+ --uva-color-alert-critical-border: light-dark(var(--uva-red-B, #b30000), #ef3f6b);
99
+ --uva-color-alert-critical-bg: light-dark(var(--uva-red-100, #fbcfda), #4a1622);
100
+ --uva-color-alert-info-border: light-dark(var(--uva-blue-alt, #007bac), #55c4ec);
101
+ --uva-color-alert-info-bg: light-dark(var(--uva-blue-alt-300, #bfe7f7), #0d3247);
102
+ --uva-color-on-accent: light-dark(#ffffff, #10172b);
59
103
  }
60
104
  :root[data-uva-color-scheme='system'] {
61
105
  color-scheme: light dark;
@@ -227,3 +271,247 @@
227
271
  color: GrayText;
228
272
  }
229
273
  }
274
+
275
+ .uvalib-badge {
276
+ display: inline-flex;
277
+ align-items: center;
278
+ gap: 0.3em;
279
+ box-sizing: border-box;
280
+ max-inline-size: 100%;
281
+ margin: 0;
282
+ padding: 0.1rem 0.6rem;
283
+ border: 1px solid transparent;
284
+ border-radius: 999px;
285
+ background: var(--uva-color-track, var(--uva-grey-200, #f1f1f1));
286
+ color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
287
+ font-size: 0.875rem;
288
+ font-weight: 400;
289
+ line-height: 1.4;
290
+ overflow-wrap: anywhere;
291
+ vertical-align: middle;
292
+ }
293
+ .uvalib-badge--category {
294
+ background: var(--uva-blue-alt-300, #bfe7f7);
295
+ color: var(--uva-blue-alt-dark, #005679);
296
+ }
297
+ .uvalib-badge--body {
298
+ font-size: 1rem;
299
+ }
300
+ .uvalib-badge > :is(svg, img, .uvalib-badge__icon) {
301
+ flex: none;
302
+ inline-size: 1em;
303
+ block-size: 1em;
304
+ }
305
+ .uvalib-badge--count {
306
+ border-radius: 5px;
307
+ background: rgb(14 17 23 / 0.82);
308
+ color: #ffffff;
309
+ font-weight: 600;
310
+ }
311
+ .uvalib-badge--status {
312
+ font-weight: 600;
313
+ }
314
+ .uvalib-badge:is(
315
+ .uvalib-badge--success,
316
+ .uvalib-badge--warning,
317
+ .uvalib-badge--danger,
318
+ .uvalib-badge--info
319
+ ) {
320
+ color: var(--uva-color-alert-text, var(--uva-grey-darkest, #2b2b2b));
321
+ }
322
+ .uvalib-badge--success {
323
+ border-color: var(--uva-color-status-success-border, var(--uva-green-A, #4e9737));
324
+ background: var(--uva-color-status-success-bg, var(--uva-green-200, #ddefdc));
325
+ }
326
+ .uvalib-badge--warning {
327
+ border-color: var(--uva-color-alert-warning-border, var(--uva-yellow, #ecc602));
328
+ background: var(--uva-color-alert-warning-bg, var(--uva-yellow-100, #fef6c8));
329
+ }
330
+ .uvalib-badge--danger {
331
+ border-color: var(--uva-color-alert-critical-border, var(--uva-red-B, #b30000));
332
+ background: var(--uva-color-alert-critical-bg, var(--uva-red-100, #fbcfda));
333
+ }
334
+ .uvalib-badge--info {
335
+ border-color: var(--uva-color-alert-info-border, var(--uva-blue-alt, #007bac));
336
+ background: var(--uva-color-alert-info-bg, var(--uva-blue-alt-300, #bfe7f7));
337
+ }
338
+ .uvalib-badge--new {
339
+ background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));
340
+ color: var(--uva-color-on-accent, #ffffff);
341
+ font-weight: 700;
342
+ }
343
+ /* Badges over an image: the wrapper is the positioning box; the badge sits top-start. */
344
+ .uvalib-media {
345
+ position: relative;
346
+ display: block;
347
+ }
348
+ .uvalib-media > :is(img, video, picture) {
349
+ display: block;
350
+ inline-size: 100%;
351
+ block-size: auto;
352
+ }
353
+ .uvalib-media > :is(.uvalib-badge, .uvalib-media__badges) {
354
+ position: absolute;
355
+ inset-block-start: 0.5rem;
356
+ inset-inline-start: 0.5rem;
357
+ max-inline-size: calc(100% - 1rem);
358
+ }
359
+ .uvalib-media__badges {
360
+ display: flex;
361
+ flex-wrap: wrap;
362
+ gap: 0.25rem;
363
+ }
364
+
365
+ /* A results toolbar: search, selects, chip groups and the count, wrapping on phones. */
366
+ .uvalib-toolbar {
367
+ display: flex;
368
+ flex-wrap: wrap;
369
+ align-items: flex-end;
370
+ gap: 0.75rem 1rem;
371
+ margin-block: 0 1rem;
372
+ }
373
+ .uvalib-toolbar > * {
374
+ min-inline-size: 0;
375
+ max-inline-size: 100%;
376
+ margin-block: 0;
377
+ }
378
+ .uvalib-toolbar__field {
379
+ display: flex;
380
+ flex-direction: column;
381
+ gap: 0.25rem;
382
+ }
383
+ .uvalib-toolbar__field > .uvalib-input {
384
+ inline-size: 100%;
385
+ }
386
+ /* :where keeps it as specific as the phone rule below, which then wins. */
387
+ .uvalib-toolbar > :where(.uvalib-toolbar__field--grow, .uvalib-search-form) {
388
+ flex: 1 1 16rem;
389
+ }
390
+ .uvalib-toolbar__group {
391
+ display: flex;
392
+ flex-wrap: wrap;
393
+ align-items: center;
394
+ gap: 0.5rem;
395
+ }
396
+ .uvalib-toolbar__summary {
397
+ align-self: center;
398
+ margin-inline-start: auto;
399
+ color: var(--uva-color-text-muted, var(--uva-grey-A, #4f4f4f));
400
+ }
401
+ @media (max-width: 30em) {
402
+ .uvalib-toolbar > * {
403
+ flex: 1 1 100%;
404
+ }
405
+ .uvalib-toolbar__summary {
406
+ margin-inline-start: 0;
407
+ }
408
+ }
409
+
410
+ /* No results: an optional decorative icon, a heading, a sentence and an action. */
411
+ .uvalib-empty-state {
412
+ display: flex;
413
+ flex-direction: column;
414
+ align-items: center;
415
+ gap: 0.75rem;
416
+ margin-block: 1rem;
417
+ padding: 2.5rem 1rem;
418
+ border: 1px dashed var(--uva-color-control-border, var(--uva-grey, #808080));
419
+ border-radius: 0.3rem;
420
+ text-align: center;
421
+ }
422
+ .uvalib-empty-state > * {
423
+ margin: 0;
424
+ max-inline-size: 40rem;
425
+ }
426
+ .uvalib-empty-state__icon {
427
+ inline-size: 3rem;
428
+ block-size: 3rem;
429
+ color: var(--uva-color-text-muted, var(--uva-grey-A, #4f4f4f));
430
+ }
431
+ .uvalib-empty-state > :is(h2, h3, h4, .uvalib-empty-state__heading) {
432
+ font-size: 1.25rem;
433
+ line-height: 1.3;
434
+ }
435
+ .uvalib-empty-state > p {
436
+ color: var(--uva-color-text-muted, var(--uva-grey-A, #4f4f4f));
437
+ }
438
+
439
+ /* Loading placeholders: a box (give it a height or an aspect ratio) and a text line, which
440
+ reserves one line of text (1em plus the 0.25em above and below at line-height 1.5). */
441
+ .uvalib-skeleton,
442
+ .uvalib-skeleton-text {
443
+ display: block;
444
+ border-radius: 0.3rem;
445
+ background-color: var(--uva-color-track, var(--uva-grey-200, #f1f1f1));
446
+ background-image: linear-gradient(
447
+ 90deg,
448
+ transparent 0%,
449
+ color-mix(in srgb, currentColor 9%, transparent) 50%,
450
+ transparent 100%
451
+ );
452
+ background-repeat: no-repeat;
453
+ background-size: 50% 100%;
454
+ animation: uvalib-skeleton-shimmer 1.6s linear infinite;
455
+ }
456
+ .uvalib-skeleton {
457
+ min-block-size: 1em;
458
+ }
459
+ .uvalib-skeleton--media {
460
+ aspect-ratio: 3 / 2;
461
+ }
462
+ .uvalib-skeleton-text {
463
+ block-size: 1em;
464
+ margin-block: 0.25em;
465
+ border-radius: 0.2rem;
466
+ }
467
+ .uvalib-skeleton-text:last-child:not(:first-child) {
468
+ inline-size: 60%;
469
+ }
470
+ @keyframes uvalib-skeleton-shimmer {
471
+ from {
472
+ background-position: -100% 0;
473
+ }
474
+ to {
475
+ background-position: 200% 0;
476
+ }
477
+ }
478
+ @media (prefers-reduced-motion: reduce) {
479
+ .uvalib-skeleton,
480
+ .uvalib-skeleton-text {
481
+ animation: none;
482
+ background-image: none;
483
+ }
484
+ }
485
+ @media (forced-colors: active) {
486
+ .uvalib-badge {
487
+ border-color: CanvasText;
488
+ }
489
+ /* Over a photo, which keeps its pixels: an opaque system-colour box, as the card badge. */
490
+ .uvalib-badge--count {
491
+ forced-color-adjust: none;
492
+ border-color: Canvas;
493
+ background: CanvasText;
494
+ color: Canvas;
495
+ }
496
+ .uvalib-skeleton,
497
+ .uvalib-skeleton-text {
498
+ border: 1px solid GrayText;
499
+ animation: none;
500
+ }
501
+ }
502
+ /* The classes set display, which would beat the hidden attribute's. */
503
+ :is(
504
+ .uvalib-badge,
505
+ .uvalib-media,
506
+ .uvalib-media__badges,
507
+ .uvalib-toolbar,
508
+ .uvalib-toolbar__field,
509
+ .uvalib-toolbar__group,
510
+ .uvalib-toolbar__summary,
511
+ .uvalib-empty-state,
512
+ .uvalib-skeleton,
513
+ .uvalib-skeleton-text
514
+ )[hidden] {
515
+ display: none !important;
516
+ }
517
+
@@ -7,13 +7,17 @@ import { UvalibElement } from '../../base/UvalibElement.js';
7
7
  *
8
8
  * A clickable card must not contain another link, button or other control: the stretched
9
9
  * link covers it. A static card (no `href`, or an empty or unsafe one) has no stretch, so
10
- * its excerpt may contain links. With `href`, the heading needs an accessible name (text,
11
- * or an image `alt` or `aria-label`); otherwise the link is hidden.
10
+ * its excerpt and `actions` slot may contain links. With `href`, the heading needs an
11
+ * accessible name (text, or an image `alt` or `aria-label`); otherwise the link is hidden.
12
+ *
13
+ * `media-shape="circle"` draws the media as a centered circle, for a person or avatar.
14
+ * The image keeps its alt, and the count badge still sits on it. Any other shape is ignored.
12
15
  *
13
16
  * Regions are light-DOM children. Give `slot="media"`, `slot="badge"`, `slot="heading"`,
14
- * `slot="meta"` or `slot="chip"`; anything else (including text) is the excerpt. An image
15
- * needs a real alt, or `alt=""` when the heading already names it. A date belongs in
16
- * `<time>` in the meta slot. One element per chip.
17
+ * `slot="meta"`, `slot="chip"` or `slot="actions"`; anything else (including text) is the
18
+ * excerpt. An image needs a real alt, or `alt=""` when the heading already names it. A date
19
+ * belongs in `<time>` in the meta slot. One element per chip. `actions` is a row of links
20
+ * or buttons on a static card (“Read the story”, “Photos (132)”).
17
21
  *
18
22
  * The heading level defaults like `<events-section>`: one below the nearest heading before
19
23
  * the card, or 3 when there is none. `heading-level` (1–6) wins. An invalid value is
@@ -25,6 +29,7 @@ import { UvalibElement } from '../../base/UvalibElement.js';
25
29
  * @slot heading - The card title. With `href`, this heading’s link is the card, so it needs an accessible name.
26
30
  * @slot meta - Date (`<time>`) or byline, under the title.
27
31
  * @slot chip - Category. One element per chip.
32
+ * @slot actions - Links or buttons on a static card. A clickable card must not contain them; the card link covers them.
28
33
  * @slot - Excerpt. A static card may put links here; a clickable card must not contain other controls.
29
34
  * @fires uvalib-analytics-event - For `<site-analytics>`: a primary-button click on the card link that was not already canceled, including a modified click, `['uvalib-card', 'card-click', 'single']` or, inside `<uvalib-card-grid>`, `['uvalib-card', 'card-click', '<n>', <n>]` (n from 1, the card’s place in that grid). Never the title or URL. Bubbles and is composed.
30
35
  * @fires uvalib-card-navigate - A plain click on the card link: `detail` is `{ href, position }` (`position` is `'single'` or `'1'`, `'2'`, …). Cancel it (`preventDefault()`) to route in the app; the click’s default is then prevented. Bubbles and is composed.
@@ -46,6 +51,11 @@ export declare class UvalibCard extends UvalibElement {
46
51
  static styles: import("lit").CSSResult[];
47
52
  /** Makes the card one link: the heading stretches over the card. Empty is not a link. */
48
53
  href?: string;
54
+ /**
55
+ * `circle` crops the media to a centered circle and keeps the image alt. Anything else
56
+ * is ignored, with one console warning.
57
+ */
58
+ mediaShape: string;
49
59
  /**
50
60
  * Heading level of the title, 1–6. Unset, it is one below the nearest heading before
51
61
  * this card, or 3 when there is none. Any other value is ignored.
@@ -56,6 +66,7 @@ export declare class UvalibCard extends UvalibElement {
56
66
  private warnedHref;
57
67
  private warnedNested;
58
68
  private warnedHeading;
69
+ private warnedShape;
59
70
  private observer?;
60
71
  /** Author nodes captured before the first light-DOM render. */
61
72
  private saved;
@@ -75,6 +86,8 @@ export declare class UvalibCard extends UvalibElement {
75
86
  /** A named shadow slot, or nothing in light DOM (the regions are filled by moving nodes). */
76
87
  private renderSlot;
77
88
  private onSlotChange;
89
+ /** `::slotted` cannot see a host attribute, so the circle image carries a class. */
90
+ private syncShape;
78
91
  /** Place among the cards of the nearest grid, from 1, or `'single'` when there is none. */
79
92
  private position;
80
93
  /**
@@ -102,6 +115,7 @@ export declare class UvalibCard extends UvalibElement {
102
115
  /** Put each author node in the region its slot names; the rest is the excerpt. */
103
116
  private distribute;
104
117
  private syncHidden;
118
+ private warnShape;
105
119
  private warnNested;
106
120
  private arm;
107
121
  private onAuthorChange;