@nldd/design-system 0.8.96 → 0.8.98
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/README.md +14 -10
- package/custom-elements.json +528 -107
- package/dist/components/components.js +894 -267
- package/dist/components/content/code-viewer/code-viewer.d.ts +4 -1
- package/dist/components/content/code-viewer/code-viewer.d.ts.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.js +43 -5
- package/dist/components/content/code-viewer/code-viewer.js.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.styles.d.ts.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.styles.js +11 -0
- package/dist/components/content/code-viewer/code-viewer.styles.js.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.template.d.ts.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.template.js +1 -0
- package/dist/components/content/code-viewer/code-viewer.template.js.map +1 -1
- package/dist/components/content/icon/icon-aliases.js +1 -1
- package/dist/components/content/icon/icon-aliases.js.map +1 -1
- package/dist/components/content/icon/icon-gallery-status.d.ts.map +1 -1
- package/dist/components/content/icon/icon-gallery-status.js +15 -4
- package/dist/components/content/icon/icon-gallery-status.js.map +1 -1
- package/dist/components/content/icon/icon-registry.js +12 -12
- package/dist/components/content/icon/icon-registry.js.map +1 -1
- package/dist/components/content/image/image.d.ts +19 -3
- package/dist/components/content/image/image.d.ts.map +1 -1
- package/dist/components/content/image/image.js +25 -4
- package/dist/components/content/image/image.js.map +1 -1
- package/dist/components/content/image/image.styles.d.ts.map +1 -1
- package/dist/components/content/image/image.styles.js +36 -0
- package/dist/components/content/image/image.styles.js.map +1 -1
- package/dist/components/content/image/image.template.d.ts.map +1 -1
- package/dist/components/content/image/image.template.js +13 -1
- package/dist/components/content/image/image.template.js.map +1 -1
- package/dist/components/content/rich-text/rich-text.d.ts +25 -12
- package/dist/components/content/rich-text/rich-text.d.ts.map +1 -1
- package/dist/components/content/rich-text/rich-text.js +25 -12
- package/dist/components/content/rich-text/rich-text.js.map +1 -1
- package/dist/components/content/tooltip/tooltip.d.ts +7 -0
- package/dist/components/content/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/content/tooltip/tooltip.js +29 -2
- package/dist/components/content/tooltip/tooltip.js.map +1 -1
- package/dist/components/{dist-CH9m014O.js → dist-B2QcygzG.js} +1 -1
- package/dist/components/{dist-DMHTTJRJ.js → dist-BB5mlo7D.js} +2 -2
- package/dist/components/{dist-C3uWRipu.js → dist-Bo5Jeyfn.js} +1 -1
- package/dist/components/{dist-CpW8MF-L.js → dist-Bud_7w5g.js} +232 -214
- package/dist/components/{dist-CvL6_ezZ.js → dist-CA0yDFIt.js} +2 -2
- package/dist/components/{dist-DV6Mp5N1.js → dist-CaxHkqR2.js} +3 -3
- package/dist/components/{dist-BWRYv3Mp.js → dist-Ch3gNAuT.js} +1 -1
- package/dist/components/{dist-PlhQXXtE.js → dist-DbNhCpS5.js} +1 -1
- package/dist/components/{dist-DTOshgo1.js → dist-DkqAbJH8.js} +1 -1
- package/dist/components/{dist-BWEAw34D.js → dist-DnZmcpbQ.js} +1 -1
- package/dist/components/{dist-Bi4EHsFY.js → dist-iC2RTM0V.js} +2 -2
- package/dist/components/forms/validation-list/validation-list.d.ts +19 -9
- package/dist/components/forms/validation-list/validation-list.d.ts.map +1 -1
- package/dist/components/forms/validation-list/validation-list.js +38 -12
- package/dist/components/forms/validation-list/validation-list.js.map +1 -1
- package/dist/components/{icon-DQHT2C7z.js → icon-D_ZGezHx.js} +13 -13
- package/dist/components/{icon-button-mevRsl4C.js → icon-button-CJIikwyu.js} +16 -3
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.d.ts +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.d.ts.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.js +1 -4
- package/dist/components/inputs/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.d.ts +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.js +1 -4
- package/dist/components/inputs/toggle-button/toggle-button.js.map +1 -1
- package/dist/components/layout/box/box.d.ts +1 -1
- package/dist/components/layout/box/box.js +1 -1
- package/dist/components/layout/container/container.d.ts.map +1 -1
- package/dist/components/layout/container/container.js +2 -1
- package/dist/components/layout/container/container.js.map +1 -1
- package/dist/components/layout/page/page.d.ts +9 -3
- package/dist/components/layout/page/page.d.ts.map +1 -1
- package/dist/components/layout/page/page.js +36 -13
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/page/page.styles.js +1 -1
- package/dist/components/layout/page-sections/full-bleed-section/full-bleed-section.d.ts +2 -0
- package/dist/components/layout/page-sections/full-bleed-section/full-bleed-section.d.ts.map +1 -1
- package/dist/components/layout/page-sections/full-bleed-section/full-bleed-section.js +3 -1
- package/dist/components/layout/page-sections/full-bleed-section/full-bleed-section.js.map +1 -1
- package/dist/components/layout/page-sections/full-bleed-section/full-bleed-section.styles.d.ts.map +1 -1
- package/dist/components/layout/page-sections/full-bleed-section/full-bleed-section.styles.js +5 -0
- package/dist/components/layout/page-sections/full-bleed-section/full-bleed-section.styles.js.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.d.ts +57 -11
- package/dist/components/layout/page-sections/hero/hero.d.ts.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.js +158 -15
- package/dist/components/layout/page-sections/hero/hero.js.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.styles.d.ts.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.styles.js +95 -41
- package/dist/components/layout/page-sections/hero/hero.styles.js.map +1 -1
- package/dist/components/layout/page-sections/one-half-one-half-section/one-half-one-half-section.d.ts +4 -0
- package/dist/components/layout/page-sections/one-half-one-half-section/one-half-one-half-section.d.ts.map +1 -1
- package/dist/components/layout/page-sections/one-half-one-half-section/one-half-one-half-section.js +8 -1
- package/dist/components/layout/page-sections/one-half-one-half-section/one-half-one-half-section.js.map +1 -1
- package/dist/components/layout/page-sections/one-half-one-half-section/one-half-one-half-section.styles.d.ts.map +1 -1
- package/dist/components/layout/page-sections/one-half-one-half-section/one-half-one-half-section.styles.js +13 -0
- package/dist/components/layout/page-sections/one-half-one-half-section/one-half-one-half-section.styles.js.map +1 -1
- package/dist/components/layout/page-sections/one-third-two-thirds-section/one-third-two-thirds-section.d.ts +4 -0
- package/dist/components/layout/page-sections/one-third-two-thirds-section/one-third-two-thirds-section.d.ts.map +1 -1
- package/dist/components/layout/page-sections/one-third-two-thirds-section/one-third-two-thirds-section.js +8 -1
- package/dist/components/layout/page-sections/one-third-two-thirds-section/one-third-two-thirds-section.js.map +1 -1
- package/dist/components/layout/page-sections/one-third-two-thirds-section/one-third-two-thirds-section.styles.d.ts.map +1 -1
- package/dist/components/layout/page-sections/one-third-two-thirds-section/one-third-two-thirds-section.styles.js +17 -0
- package/dist/components/layout/page-sections/one-third-two-thirds-section/one-third-two-thirds-section.styles.js.map +1 -1
- package/dist/components/layout/page-sections/page-section-controls.d.ts +11 -1
- package/dist/components/layout/page-sections/page-section-controls.d.ts.map +1 -1
- package/dist/components/layout/page-sections/page-section-controls.js +11 -2
- package/dist/components/layout/page-sections/page-section-controls.js.map +1 -1
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.d.ts +5 -1
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.d.ts.map +1 -1
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.js +6 -2
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.js.map +1 -1
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.styles.d.ts.map +1 -1
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.styles.js +13 -10
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.styles.js.map +1 -1
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.template.js +6 -6
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.template.js.map +1 -1
- package/dist/components/layout/page-sections/simple-section/simple-section.d.ts +2 -0
- package/dist/components/layout/page-sections/simple-section/simple-section.d.ts.map +1 -1
- package/dist/components/layout/page-sections/simple-section/simple-section.js +3 -2
- package/dist/components/layout/page-sections/simple-section/simple-section.js.map +1 -1
- package/dist/components/layout/page-sections/simple-section/simple-section.styles.js +2 -2
- package/dist/components/layout/page-sections/two-thirds-one-third-section/two-thirds-one-third-section.d.ts +4 -0
- package/dist/components/layout/page-sections/two-thirds-one-third-section/two-thirds-one-third-section.d.ts.map +1 -1
- package/dist/components/layout/page-sections/two-thirds-one-third-section/two-thirds-one-third-section.js +8 -1
- package/dist/components/layout/page-sections/two-thirds-one-third-section/two-thirds-one-third-section.js.map +1 -1
- package/dist/components/layout/page-sections/two-thirds-one-third-section/two-thirds-one-third-section.styles.d.ts.map +1 -1
- package/dist/components/layout/page-sections/two-thirds-one-third-section/two-thirds-one-third-section.styles.js +17 -0
- package/dist/components/layout/page-sections/two-thirds-one-third-section/two-thirds-one-third-section.styles.js.map +1 -1
- package/dist/components/layout/sheet/sheet.js +1 -1
- package/dist/components/layout/sheet/sheet.js.map +1 -1
- package/dist/components/layout/{app-view/app-view.d.ts → shell/shell.d.ts} +11 -11
- package/dist/components/layout/shell/shell.d.ts.map +1 -0
- package/dist/components/layout/{app-view/app-view.js → shell/shell.js} +24 -24
- package/dist/components/layout/shell/shell.js.map +1 -0
- package/dist/components/layout/shell/shell.styles.d.ts +2 -0
- package/dist/components/layout/shell/shell.styles.d.ts.map +1 -0
- package/dist/components/layout/{app-view/app-view.styles.js → shell/shell.styles.js} +8 -8
- package/dist/components/layout/shell/shell.styles.js.map +1 -0
- package/dist/components/layout/shell/shell.template.d.ts +4 -0
- package/dist/components/layout/shell/shell.template.d.ts.map +1 -0
- package/dist/components/layout/shell/shell.template.js +9 -0
- package/dist/components/layout/shell/shell.template.js.map +1 -0
- package/dist/components/layout/split-views/bar-split-view/bar-split-view.js +1 -1
- package/dist/components/layout/split-views/bar-split-view/bar-split-view.js.map +1 -1
- package/dist/components/layout/split-views/navigation-split-view/navigation-split-view.d.ts +1 -1
- package/dist/components/layout/split-views/navigation-split-view/navigation-split-view.js +1 -1
- package/dist/components/layout/split-views/side-by-side-split-view/side-by-side-split-view.d.ts +1 -1
- package/dist/components/layout/split-views/side-by-side-split-view/side-by-side-split-view.js +1 -1
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.styles.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.styles.js +2 -0
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.styles.js.map +1 -1
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.styles.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.styles.js +2 -0
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.styles.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.d.ts +6 -1
- package/dist/components/lists-and-tables/list/list.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.js +7 -2
- package/dist/components/lists-and-tables/list/list.js.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.d.ts +31 -6
- package/dist/components/lists-and-tables/list-item/list-item.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.js +55 -11
- package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.template.d.ts +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.template.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.template.js +7 -6
- package/dist/components/lists-and-tables/list-item/list-item.template.js.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts +4 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js +8 -2
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.d.ts +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.js +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.js.map +1 -1
- package/dist/components/navigation/menu-bar/menu-bar.d.ts.map +1 -1
- package/dist/components/navigation/menu-bar/menu-bar.js +19 -2
- package/dist/components/navigation/menu-bar/menu-bar.js.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.d.ts +7 -2
- package/dist/components/navigation/menu-bar-item/menu-bar-item.d.ts.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.js +15 -3
- package/dist/components/navigation/menu-bar-item/menu-bar-item.js.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.styles.d.ts.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.styles.js +12 -2
- package/dist/components/navigation/menu-bar-item/menu-bar-item.styles.js.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.template.d.ts +1 -0
- package/dist/components/navigation/menu-bar-item/menu-bar-item.template.d.ts.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.template.js +55 -40
- package/dist/components/navigation/menu-bar-item/menu-bar-item.template.js.map +1 -1
- package/dist/components/navigation/skip-link/skip-link.d.ts +50 -4
- package/dist/components/navigation/skip-link/skip-link.d.ts.map +1 -1
- package/dist/components/navigation/skip-link/skip-link.js +140 -13
- package/dist/components/navigation/skip-link/skip-link.js.map +1 -1
- package/dist/components/navigation/skip-link/skip-link.template.d.ts.map +1 -1
- package/dist/components/navigation/skip-link/skip-link.template.js +1 -0
- package/dist/components/navigation/skip-link/skip-link.template.js.map +1 -1
- package/dist/components/navigation/top-title-bar/top-title-bar.d.ts +8 -1
- package/dist/components/navigation/top-title-bar/top-title-bar.d.ts.map +1 -1
- package/dist/components/navigation/top-title-bar/top-title-bar.js +9 -2
- package/dist/components/navigation/top-title-bar/top-title-bar.js.map +1 -1
- package/dist/components/status-and-feedback/status-bar/status-bar.d.ts +10 -0
- package/dist/components/status-and-feedback/status-bar/status-bar.d.ts.map +1 -1
- package/dist/components/status-and-feedback/status-bar/status-bar.js +21 -0
- package/dist/components/status-and-feedback/status-bar/status-bar.js.map +1 -1
- package/dist/css/document-reset.css +3 -3
- package/dist/css/rich-text.css +36 -90
- package/dist/nldd.min.js +912 -736
- package/dist/types/vue.d.ts +85 -38
- package/dist/utilities/page-section-mixin.d.ts +5 -0
- package/dist/utilities/page-section-mixin.d.ts.map +1 -1
- package/dist/utilities/page-section-mixin.js +10 -1
- package/dist/utilities/page-section-mixin.js.map +1 -1
- package/dist/utilities/scroll-mode-controller.d.ts +29 -13
- package/dist/utilities/scroll-mode-controller.d.ts.map +1 -1
- package/dist/utilities/scroll-mode-controller.js +48 -13
- package/dist/utilities/scroll-mode-controller.js.map +1 -1
- package/package.json +5 -5
- package/dist/components/layout/app-view/app-view.d.ts.map +0 -1
- package/dist/components/layout/app-view/app-view.js.map +0 -1
- package/dist/components/layout/app-view/app-view.styles.d.ts +0 -2
- package/dist/components/layout/app-view/app-view.styles.d.ts.map +0 -1
- package/dist/components/layout/app-view/app-view.styles.js.map +0 -1
- package/dist/components/layout/app-view/app-view.template.d.ts +0 -4
- package/dist/components/layout/app-view/app-view.template.d.ts.map +0 -1
- package/dist/components/layout/app-view/app-view.template.js +0 -9
- package/dist/components/layout/app-view/app-view.template.js.map +0 -1
- package/dist/components/palettes.html +0 -245
- package/dist/components/sample-images/butterfly-1200.jpg +0 -0
- package/dist/components/sample-images/butterfly-1600.jpg +0 -0
- package/dist/components/sample-images/butterfly-480.jpg +0 -0
- package/dist/components/sample-images/butterfly-960.jpg +0 -0
- package/dist/palettes.html +0 -245
- package/dist/sample-images/butterfly-1200.jpg +0 -0
- package/dist/sample-images/butterfly-1600.jpg +0 -0
- package/dist/sample-images/butterfly-480.jpg +0 -0
- package/dist/sample-images/butterfly-960.jpg +0 -0
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
* custom `<img>` or `<picture>` (e.g. with art-direction sources), slot it
|
|
11
11
|
* into the default slot and we'll style and wrap it like our own image.
|
|
12
12
|
*
|
|
13
|
+
* Without an image (no `src`, `srcset`, `lqip` or slotted media) it shows a
|
|
14
|
+
* neutral area with an image icon, in the box, shape and caption a real image
|
|
15
|
+
* would get: a place where an image belongs, for a prototype or a pattern, or
|
|
16
|
+
* an image someone forgot. Without `aspect-ratio` that area is 16/9. While the
|
|
17
|
+
* built-in `<img>` loads without an `lqip`, the same area shows without the
|
|
18
|
+
* icon, and it goes once the image is in.
|
|
19
|
+
*
|
|
13
20
|
* @element nldd-image
|
|
14
21
|
*
|
|
15
22
|
* @attr {string} src - Image URL
|
|
@@ -37,7 +44,7 @@
|
|
|
37
44
|
* @attr {string} caption - Caption text shown below the image
|
|
38
45
|
* @attr {string} credit - Smaller credit/attribution text shown beside the caption
|
|
39
46
|
* @attr {boolean} decorative - Decorative image: alt is forced empty + aria-hidden
|
|
40
|
-
* @attr {string} lqip -
|
|
47
|
+
* @attr {string} lqip - Loading preview (LQIP, low-quality image placeholder) as a CSV string
|
|
41
48
|
* `"base,c1,c2,c3,c4,c5,c6"` — seven 0-255 bytes, each packing an 8-bit
|
|
42
49
|
* Oklab triplet (2 bits L, 3 bits a, 3 bits b). The first is the base
|
|
43
50
|
* color shown outside the cell gradients; the other six are per-cell
|
|
@@ -46,10 +53,14 @@
|
|
|
46
53
|
* Extends Lean Rada's CSS-only LQIP (https://leanrada.com/notes/css-only-lqip/)
|
|
47
54
|
* with per-cell hue — Lean's original format encodes grayscale cells only;
|
|
48
55
|
* ours encodes a color per cell so multi-color subjects survive the
|
|
49
|
-
*
|
|
56
|
+
* preview.
|
|
50
57
|
* @attr {object} translations - Override translation keys (e.g. the message
|
|
51
58
|
* shown when the image fails to load); unset keys fall back to Dutch.
|
|
52
59
|
*
|
|
60
|
+
* A parent that gives the image a fixed box, such as the media area of
|
|
61
|
+
* nldd-hero, sets `--context-image-height: 100%` on it, so the image fills that
|
|
62
|
+
* box instead of taking the height of the photo.
|
|
63
|
+
*
|
|
53
64
|
* @slot - Custom `<img>`, `<picture>` or inline `<svg>` (overrides the src-based default). An inline svg keeps its own colors and scales by its viewBox, so a drawing gets the same box, ratio and caption as a photo. Slotted media carries its own text alternative: an `alt` on the img (empty when it conveys nothing), or `role="img"` with an `aria-label`, `aria-labelledby` or `<title>` on the svg.
|
|
54
65
|
* The internal `error` listener is attached only to the built-in `<img>`, so
|
|
55
66
|
* slotted content does not trigger the error-state overlay automatically.
|
|
@@ -110,7 +121,7 @@ export declare class NLDDImage extends LitElement {
|
|
|
110
121
|
} | null;
|
|
111
122
|
_hasSlottedCaption: boolean;
|
|
112
123
|
/** Tracks whether the internal <img> has finished loading. While false and
|
|
113
|
-
* an LQIP value is set, the image stays hidden so the
|
|
124
|
+
* an LQIP value is set, the image stays hidden so the loading preview shows. */
|
|
114
125
|
_imageLoaded: boolean;
|
|
115
126
|
/** Set when the internal <img> fires an error event (404, network error,
|
|
116
127
|
* decode failure, …). The template uses this to render a fallback UI
|
|
@@ -154,6 +165,11 @@ export declare class NLDDImage extends LitElement {
|
|
|
154
165
|
* `alt` attribute and would pass every time.
|
|
155
166
|
*/
|
|
156
167
|
private _slottedMedia;
|
|
168
|
+
/** Whether anything sits in the default slot. Read off the light DOM, so
|
|
169
|
+
* the first render already knows and an image does not flash empty. */
|
|
170
|
+
get _hasSlottedMedia(): boolean;
|
|
171
|
+
/** No image at all: the component shows where one belongs. */
|
|
172
|
+
get _isEmpty(): boolean;
|
|
157
173
|
_onMediaSlotChange: () => void;
|
|
158
174
|
firstUpdated(): void;
|
|
159
175
|
_onImageLoad: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../src/components/content/image/image.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"image.d.ts","sour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AAI;IAUhD,oBAAoB,GAAI,GAAG,KAAK,KAAG,IAAI,CAErC;IAEO,MAAM;CAGf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,YAAY,EAAE,SAAS,CAAC;KACxB;CACD"}
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
* custom `<img>` or `<picture>` (e.g. with art-direction sources), slot it
|
|
11
11
|
* into the default slot and we'll style and wrap it like our own image.
|
|
12
12
|
*
|
|
13
|
+
* Without an image (no `src`, `srcset`, `lqip` or slotted media) it shows a
|
|
14
|
+
* neutral area with an image icon, in the box, shape and caption a real image
|
|
15
|
+
* would get: a place where an image belongs, for a prototype or a pattern, or
|
|
16
|
+
* an image someone forgot. Without `aspect-ratio` that area is 16/9. While the
|
|
17
|
+
* built-in `<img>` loads without an `lqip`, the same area shows without the
|
|
18
|
+
* icon, and it goes once the image is in.
|
|
19
|
+
*
|
|
13
20
|
* @element nldd-image
|
|
14
21
|
*
|
|
15
22
|
* @attr {string} src - Image URL
|
|
@@ -37,7 +44,7 @@
|
|
|
37
44
|
* @attr {string} caption - Caption text shown below the image
|
|
38
45
|
* @attr {string} credit - Smaller credit/attribution text shown beside the caption
|
|
39
46
|
* @attr {boolean} decorative - Decorative image: alt is forced empty + aria-hidden
|
|
40
|
-
* @attr {string} lqip -
|
|
47
|
+
* @attr {string} lqip - Loading preview (LQIP, low-quality image placeholder) as a CSV string
|
|
41
48
|
* `"base,c1,c2,c3,c4,c5,c6"` — seven 0-255 bytes, each packing an 8-bit
|
|
42
49
|
* Oklab triplet (2 bits L, 3 bits a, 3 bits b). The first is the base
|
|
43
50
|
* color shown outside the cell gradients; the other six are per-cell
|
|
@@ -46,10 +53,14 @@
|
|
|
46
53
|
* Extends Lean Rada's CSS-only LQIP (https://leanrada.com/notes/css-only-lqip/)
|
|
47
54
|
* with per-cell hue — Lean's original format encodes grayscale cells only;
|
|
48
55
|
* ours encodes a color per cell so multi-color subjects survive the
|
|
49
|
-
*
|
|
56
|
+
* preview.
|
|
50
57
|
* @attr {object} translations - Override translation keys (e.g. the message
|
|
51
58
|
* shown when the image fails to load); unset keys fall back to Dutch.
|
|
52
59
|
*
|
|
60
|
+
* A parent that gives the image a fixed box, such as the media area of
|
|
61
|
+
* nldd-hero, sets `--context-image-height: 100%` on it, so the image fills that
|
|
62
|
+
* box instead of taking the height of the photo.
|
|
63
|
+
*
|
|
53
64
|
* @slot - Custom `<img>`, `<picture>` or inline `<svg>` (overrides the src-based default). An inline svg keeps its own colors and scales by its viewBox, so a drawing gets the same box, ratio and caption as a photo. Slotted media carries its own text alternative: an `alt` on the img (empty when it conveys nothing), or `role="img"` with an `aria-label`, `aria-labelledby` or `<title>` on the svg.
|
|
54
65
|
* The internal `error` listener is attached only to the built-in `<img>`, so
|
|
55
66
|
* slotted content does not trigger the error-state overlay automatically.
|
|
@@ -125,7 +136,7 @@ let NLDDImage = class NLDDImage extends LitElement {
|
|
|
125
136
|
this._parsedLqipValue = null;
|
|
126
137
|
this._hasSlottedCaption = false;
|
|
127
138
|
/** Tracks whether the internal <img> has finished loading. While false and
|
|
128
|
-
* an LQIP value is set, the image stays hidden so the
|
|
139
|
+
* an LQIP value is set, the image stays hidden so the loading preview shows. */
|
|
129
140
|
this._imageLoaded = false;
|
|
130
141
|
/** Set when the internal <img> fires an error event (404, network error,
|
|
131
142
|
* decode failure, …). The template uses this to render a fallback UI
|
|
@@ -136,6 +147,7 @@ let NLDDImage = class NLDDImage extends LitElement {
|
|
|
136
147
|
/** DEV-only "missing alt" warning latch; see _warnMissingAlt(). */
|
|
137
148
|
this._warnedAlt = false;
|
|
138
149
|
this._onMediaSlotChange = () => {
|
|
150
|
+
this.requestUpdate();
|
|
139
151
|
this._warnMissingAlt();
|
|
140
152
|
};
|
|
141
153
|
this._onImageLoad = () => {
|
|
@@ -283,6 +295,15 @@ let NLDDImage = class NLDDImage extends LitElement {
|
|
|
283
295
|
? el.assignedElements({ flatten: true })
|
|
284
296
|
: [el]);
|
|
285
297
|
}
|
|
298
|
+
/** Whether anything sits in the default slot. Read off the light DOM, so
|
|
299
|
+
* the first render already knows and an image does not flash empty. */
|
|
300
|
+
get _hasSlottedMedia() {
|
|
301
|
+
return Array.from(this.children).some(el => !el.hasAttribute('slot'));
|
|
302
|
+
}
|
|
303
|
+
/** No image at all: the component shows where one belongs. */
|
|
304
|
+
get _isEmpty() {
|
|
305
|
+
return !this.src && !this.srcset && !this._parsedLqip && !this._hasSlottedMedia;
|
|
306
|
+
}
|
|
286
307
|
firstUpdated() {
|
|
287
308
|
// If the image was cached or already loaded by the time the listener
|
|
288
309
|
// attached, the load event won't fire — sync state directly.
|
|
@@ -317,7 +338,7 @@ let NLDDImage = class NLDDImage extends LitElement {
|
|
|
317
338
|
};
|
|
318
339
|
NLDDImage.styles = imageStyles;
|
|
319
340
|
__decorate([
|
|
320
|
-
property({
|
|
341
|
+
property({ reflect: true, converter: reflectNonDefault('') })
|
|
321
342
|
], NLDDImage.prototype, "src", void 0);
|
|
322
343
|
__decorate([
|
|
323
344
|
property({ type: String })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../src/components/content/image/image.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../src/components/content/image/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD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Q,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,CAAS,EAAE,CAAC,EAAE,CAAC;yCAC1D;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACxB;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCACjB;AAIV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACuB;AAyClD;IADC,KAAK,EAAE;qDACmB;AAK3B;IADC,KAAK,EAAE;+CACa;AAMrB;IADC,KAAK,EAAE;gDACc;AAjHV,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAmSrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/content/image/image.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"image.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/content/image/image.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,yBAkcvB,CAAC"}
|
|
@@ -21,9 +21,13 @@ export const imageStyles = css `
|
|
|
21
21
|
--_image-error-padding: var(--primitives-space-8);
|
|
22
22
|
--_image-error-gap: var(--primitives-space-2);
|
|
23
23
|
--_image-caption-row-gap: var(--primitives-space-8);
|
|
24
|
+
--_image-pending-background-color: var(--semantics-categories-neutral-tinted-background-color);
|
|
25
|
+
--_image-empty-icon-size: var(--primitives-space-32);
|
|
26
|
+
--_image-empty-icon-color: light-dark(var(--primitives-color-neutral-450), var(--primitives-color-neutral-550));
|
|
24
27
|
--_image-object-fit: cover;
|
|
25
28
|
--_image-object-position: center;
|
|
26
29
|
--_image-max-width: 100%;
|
|
30
|
+
--_image-media-height: var(--context-image-height, auto);
|
|
27
31
|
|
|
28
32
|
${inheritedTextReset}
|
|
29
33
|
box-sizing: border-box;
|
|
@@ -84,6 +88,7 @@ export const imageStyles = css `
|
|
|
84
88
|
position: relative;
|
|
85
89
|
overflow: hidden;
|
|
86
90
|
max-width: 100%;
|
|
91
|
+
height: var(--_image-media-height);
|
|
87
92
|
border-radius: var(--_image-corner-radius);
|
|
88
93
|
}
|
|
89
94
|
|
|
@@ -352,6 +357,37 @@ export const imageStyles = css `
|
|
|
352
357
|
}
|
|
353
358
|
|
|
354
359
|
|
|
360
|
+
/* # Empty and loading */
|
|
361
|
+
|
|
362
|
+
.image__media.is-loading {
|
|
363
|
+
background-color: var(--_image-pending-background-color);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.image__media--empty {
|
|
367
|
+
display: flex;
|
|
368
|
+
background-color: var(--_image-pending-background-color);
|
|
369
|
+
width: 100%;
|
|
370
|
+
height: 100%;
|
|
371
|
+
aspect-ratio: 16 / 9;
|
|
372
|
+
align-items: center;
|
|
373
|
+
justify-content: center;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
@media (forced-colors: active) {
|
|
377
|
+
.image__media--empty {
|
|
378
|
+
outline: 1px solid CanvasText;
|
|
379
|
+
outline-offset: -1px;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.image__empty-icon {
|
|
384
|
+
display: block;
|
|
385
|
+
width: var(--_image-empty-icon-size);
|
|
386
|
+
height: var(--_image-empty-icon-size);
|
|
387
|
+
color: var(--_image-empty-icon-color);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
|
|
355
391
|
/* # Error state
|
|
356
392
|
Centred icon + alt-text shown when the image fails to load. The media is
|
|
357
393
|
painted gray (--_image-background-color) via :host([errored]) so the icon and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.styles.js","sourceRoot":"","sources":["../../../../src/components/content/image/image.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE3F,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"image.styles.js","sourceRoot":"","sources":["../../../../src/components/content/image/image.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE3F,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6B1B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkFlB,YAAY;;;;;;;;;;;;;IAaZ,YAAY;;;;;;;;;;;;IAYZ,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Tf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.template.d.ts","sourceRoot":"","sources":["../../../../src/components/content/image/image.template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"image.template.d.ts","sourceRoot":"","sources":["../../../../src/components/content/image/image.template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,wCAyHjD"}
|
|
@@ -22,8 +22,16 @@ export function imageTemplate(component) {
|
|
|
22
22
|
mediaStyles[`--context-lqip-c${i + 1}`] = String(cell);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
const isEmpty = component._isEmpty;
|
|
25
26
|
const mediaClasses = classMap({
|
|
26
27
|
'image__media': true,
|
|
28
|
+
// No image at all: a neutral area with an icon, where an image belongs.
|
|
29
|
+
'image__media--empty': isEmpty,
|
|
30
|
+
// The built-in img is on its way and there is no LQIP to show meanwhile:
|
|
31
|
+
// the same neutral area, without the icon, so a fast load does not flash
|
|
32
|
+
// one. Slotted media is left alone, since its load cannot be observed and
|
|
33
|
+
// the fill would stay behind a transparent image.
|
|
34
|
+
'is-loading': !isEmpty && !hasLqip && !component._hasSlottedMedia && !component._imageLoaded && !component._imageErrored,
|
|
27
35
|
// LQIP only renders while the image is in-flight. Once it errors we
|
|
28
36
|
// fall back to the neutral background so the error card sits on a
|
|
29
37
|
// calm surface instead of a distracting gradient.
|
|
@@ -82,11 +90,15 @@ export function imageTemplate(component) {
|
|
|
82
90
|
const liveRegion = html `<span class="image__status"
|
|
83
91
|
aria-live="polite"
|
|
84
92
|
>${errorStatusMessage}</span>`;
|
|
93
|
+
// An empty image conveys nothing, so the whole area is hidden from
|
|
94
|
+
// assistive technology. The slot stays, so media that arrives later is seen.
|
|
85
95
|
const media = html `
|
|
86
96
|
<div class=${mediaClasses}
|
|
87
97
|
style=${styleMap(mediaStyles)}
|
|
98
|
+
aria-hidden=${isEmpty ? 'true' : nothing}
|
|
88
99
|
>
|
|
89
|
-
<slot @slotchange=${component._onMediaSlotChange}>${fallbackImg}</slot>
|
|
100
|
+
<slot @slotchange=${component._onMediaSlotChange}>${isEmpty ? nothing : fallbackImg}</slot>
|
|
101
|
+
${isEmpty ? html `<span class="image__empty-icon"><nldd-icon icon="image"></nldd-icon></span>` : nothing}
|
|
90
102
|
${errorOverlay}
|
|
91
103
|
${liveRegion}
|
|
92
104
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.template.js","sourceRoot":"","sources":["../../../../src/components/content/image/image.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD,MAAM,UAAU,aAAa,CAAC,SAAoB;IACjD,mEAAmE;IACnE,uEAAuE;IACvE,+CAA+C;IAC/C,wEAAwE;IACxE,wEAAwE;IACxE,uEAAuE;IACvE,wEAAwE;IACxE,8CAA8C;IAC9C,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC;IACzC,MAAM,OAAO,GAAG,UAAU,KAAK,IAAI,CAAC;IACpC,MAAM,WAAW,GAA2B,EAAE,CAAC;IAC/C,IAAI,SAAS,CAAC,eAAe;QAAE,WAAW,CAAC,WAAW,GAAG,SAAS,CAAC,eAAe,CAAC;IACnF,IAAI,OAAO,EAAE,CAAC;QACb,WAAW,CAAC,qBAAqB,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7D,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YACpC,WAAW,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC;QAC7B,cAAc,EAAE,IAAI;QACpB,oEAAoE;QACpE,kEAAkE;Q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,SAAS,CAAC,EAAE,CAAC,6BAA6B,CAAC,CAAC;IAC9D,MAAM,kBAAkB,GAAG,SAAS,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,UAAU;QAC1E,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAChE,CAAC,CAAC,EAAE,CAAC;IACN,MAAM,UAAU,GAAG,IAAI,CAAA;;IAEpB,kBAAkB,SAAS,CAAC;IAE/B,MAAM,KAAK,GAAG,IAAI,CAAA;eACJ,YAAY;WAChB,QAAQ,CAAC,WAAW,CAAC;;
|
|
1
|
+
{"version":3,"file":"image.template.js","sourceRoot":"","sources":["../../../../src/components/content/image/image.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD,MAAM,UAAU,aAAa,CAAC,SAAoB;IACjD,mEAAmE;IACnE,uEAAuE;IACvE,+CAA+C;IAC/C,wEAAwE;IACxE,wEAAwE;IACxE,uEAAuE;IACvE,wEAAwE;IACxE,8CAA8C;IAC9C,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC;IACzC,MAAM,OAAO,GAAG,UAAU,KAAK,IAAI,CAAC;IACpC,MAAM,WAAW,GAA2B,EAAE,CAAC;IAC/C,IAAI,SAAS,CAAC,eAAe;QAAE,WAAW,CAAC,WAAW,GAAG,SAAS,CAAC,eAAe,CAAC;IACnF,IAAI,OAAO,EAAE,CAAC;QACb,WAAW,CAAC,qBAAqB,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7D,UAAU,CAA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E,CAAC,CAAC,CAAC,OAAO;KACrG,YAAY;KACZ,UAAU;;EAEb,CAAC;IAEF,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAA;;KAEP,KAAK;;;kCAGwB,SAAS,CAAC,oBAAoB;OACzD,SAAS,CAAC,OAAO;MAClB,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA,+BAA+B,SAAS,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC,OAAO;;;EAG7F,CAAC;AACH,CAAC"}
|
|
@@ -9,18 +9,30 @@
|
|
|
9
9
|
* The rich text lays out its direct children in a grid: the vertical rhythm
|
|
10
10
|
* between headings, paragraphs and lists, and the width zones below, apply to
|
|
11
11
|
* those children only. A single wrapper `div` without `class`, `style`, `role`
|
|
12
|
-
* or `data-width`, as a markdown renderer or a component root produces it, is
|
|
12
|
+
* or `data-rich-text-width`, as a markdown renderer or a component root produces it, is
|
|
13
13
|
* passed through with `display: contents`, so its children count as direct.
|
|
14
14
|
* Any other wrapper becomes a single grid item, and the paragraphs inside it
|
|
15
15
|
* lose their spacing.
|
|
16
16
|
*
|
|
17
|
+
* ## Headings
|
|
18
|
+
* The headings keep one size on every width, the one they have on a phone. A
|
|
19
|
+
* heading in running text sits in a column as wide as a line of reading, on
|
|
20
|
+
* any screen, so its relation to the text beside it does not change and it has
|
|
21
|
+
* no reason to grow. Growing, an h2 on a wide screen was more than twice the
|
|
22
|
+
* size of the text, and an article broke into blocks at every heading. Page
|
|
23
|
+
* and section titles do grow: use nldd-title for those.
|
|
24
|
+
*
|
|
17
25
|
* ## Width zones
|
|
18
|
-
* Children are placed in three zones
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
26
|
+
* Children are placed in three zones. A child belongs to the text unless it is
|
|
27
|
+
* listed, so it reads at the `main` size and is never wider than a line: text
|
|
28
|
+
* (headings, paragraphs, lists, blockquote, div/section) and every component
|
|
29
|
+
* that is not named below, such as nldd-box, nldd-card, nldd-banner,
|
|
30
|
+
* nldd-list and a button, and code (pre, nldd-code-viewer), which scrolls
|
|
31
|
+
* inside its block when a line is longer. Media, tables and a step bar (img, figure, video, iframe,
|
|
32
|
+
* table, nldd-table, nldd-image, nldd-step-bar) get the `wide` accent. What
|
|
33
|
+
* needs the room gets the `full` span: hr, nldd-collection and nldd-container. A child takes the room it needs inside its zone
|
|
34
|
+
* (`justify-self: start`), so the room is available without being forced.
|
|
35
|
+
* Overridable per child with `data-rich-text-width="main" | "wide" | "full"`. In the
|
|
24
36
|
* left-aligned layout, wide and full read as a bleed to the right; with
|
|
25
37
|
* `centered` they are symmetrical.
|
|
26
38
|
*
|
|
@@ -36,11 +48,12 @@
|
|
|
36
48
|
* @attr {boolean} centered - Centers the main column inside the container; without it, content is left-aligned
|
|
37
49
|
* @attr {object} translations - Override translation keys; unset keys fall back to Dutch
|
|
38
50
|
* @attr {boolean} hyphens - Opt-in automatic hyphenation for running text (p,
|
|
39
|
-
* li, dd). Needs a correct
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
51
|
+
* li, dd). Needs a correct
|
|
52
|
+
* `lang` on the page (`lang="nl"` on `<html>`, for instance): without
|
|
53
|
+
* language information the browser does not hyphenate. An
|
|
54
|
+
* `overflow-wrap: break-word` safety net on headings, p and li is always on,
|
|
55
|
+
* independent of this attribute, so a word wider than the column breaks
|
|
56
|
+
* instead of overflowing, without a hyphen; headings never get one.
|
|
44
57
|
*/
|
|
45
58
|
import { LitElement } from 'lit';
|
|
46
59
|
import type { NLDDRichTextTranslations } from './rich-text.i18n.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text.d.ts","sourceRoot":"","sources":["../../../../src/components/content/rich-text/rich-text.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rich-text.d.ts","sourceRoot":"","sources":["../../../../src/components/content/rich-text/rich-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAIjC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAGpE,KAAK,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAInD,qBACa,YAAa,SAAQ,UAAU;IAE3C,KAAK,EAAE,SAAS,GAAG,SAAS,CAAa;IAGzC,OAAO,EAAE,OAAO,CAAU;IAG1B,QAAQ,UAAS;IAGjB,YAAY,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAM;IAGrD,OAAO,UAAS;IAET,EAAE,CAAC,GAAG,EAAE,MAAM,wBAAwB,GAAG,MAAM;IAItD,OAAO,CAAC,iBAAiB,CAAC,CAAmB;IAC7C,OAAO,CAAC,eAAe,CAAC,CAAiB;IAEhC,gBAAgB;IAIhB,iBAAiB,IAAI,IAAI;IAezB,oBAAoB,IAAI,IAAI;IAQrC,qEAAqE;IAC5D,OAAO,IAAI,IAAI;IAMxB,OAAO,CAAC,WAAW;CA+BnB;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,YAAY,CAAC;KAC/B;CACD"}
|
|
@@ -15,18 +15,30 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
15
15
|
* The rich text lays out its direct children in a grid: the vertical rhythm
|
|
16
16
|
* between headings, paragraphs and lists, and the width zones below, apply to
|
|
17
17
|
* those children only. A single wrapper `div` without `class`, `style`, `role`
|
|
18
|
-
* or `data-width`, as a markdown renderer or a component root produces it, is
|
|
18
|
+
* or `data-rich-text-width`, as a markdown renderer or a component root produces it, is
|
|
19
19
|
* passed through with `display: contents`, so its children count as direct.
|
|
20
20
|
* Any other wrapper becomes a single grid item, and the paragraphs inside it
|
|
21
21
|
* lose their spacing.
|
|
22
22
|
*
|
|
23
|
+
* ## Headings
|
|
24
|
+
* The headings keep one size on every width, the one they have on a phone. A
|
|
25
|
+
* heading in running text sits in a column as wide as a line of reading, on
|
|
26
|
+
* any screen, so its relation to the text beside it does not change and it has
|
|
27
|
+
* no reason to grow. Growing, an h2 on a wide screen was more than twice the
|
|
28
|
+
* size of the text, and an article broke into blocks at every heading. Page
|
|
29
|
+
* and section titles do grow: use nldd-title for those.
|
|
30
|
+
*
|
|
23
31
|
* ## Width zones
|
|
24
|
-
* Children are placed in three zones
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
32
|
+
* Children are placed in three zones. A child belongs to the text unless it is
|
|
33
|
+
* listed, so it reads at the `main` size and is never wider than a line: text
|
|
34
|
+
* (headings, paragraphs, lists, blockquote, div/section) and every component
|
|
35
|
+
* that is not named below, such as nldd-box, nldd-card, nldd-banner,
|
|
36
|
+
* nldd-list and a button, and code (pre, nldd-code-viewer), which scrolls
|
|
37
|
+
* inside its block when a line is longer. Media, tables and a step bar (img, figure, video, iframe,
|
|
38
|
+
* table, nldd-table, nldd-image, nldd-step-bar) get the `wide` accent. What
|
|
39
|
+
* needs the room gets the `full` span: hr, nldd-collection and nldd-container. A child takes the room it needs inside its zone
|
|
40
|
+
* (`justify-self: start`), so the room is available without being forced.
|
|
41
|
+
* Overridable per child with `data-rich-text-width="main" | "wide" | "full"`. In the
|
|
30
42
|
* left-aligned layout, wide and full read as a bleed to the right; with
|
|
31
43
|
* `centered` they are symmetrical.
|
|
32
44
|
*
|
|
@@ -42,11 +54,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
42
54
|
* @attr {boolean} centered - Centers the main column inside the container; without it, content is left-aligned
|
|
43
55
|
* @attr {object} translations - Override translation keys; unset keys fall back to Dutch
|
|
44
56
|
* @attr {boolean} hyphens - Opt-in automatic hyphenation for running text (p,
|
|
45
|
-
* li, dd). Needs a correct
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
57
|
+
* li, dd). Needs a correct
|
|
58
|
+
* `lang` on the page (`lang="nl"` on `<html>`, for instance): without
|
|
59
|
+
* language information the browser does not hyphenate. An
|
|
60
|
+
* `overflow-wrap: break-word` safety net on headings, p and li is always on,
|
|
61
|
+
* independent of this attribute, so a word wider than the column breaks
|
|
62
|
+
* instead of overflowing, without a hyphen; headings never get one.
|
|
50
63
|
*/
|
|
51
64
|
import { LitElement } from 'lit';
|
|
52
65
|
import { customElement, property } from 'lit/decorators.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text.js","sourceRoot":"","sources":["../../../../src/components/content/rich-text/rich-text.ts"],"names":[],"mappings":";;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"rich-text.js","sourceRoot":"","sources":["../../../../src/components/content/rich-text/rich-text.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAI/D,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAG9C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QAEN,UAAK,GAA0B,SAAS,CAAC;QAGzC,YAAO,GAAY,MAAM,CAAC;QAG1B,aAAQ,GAAG,KAAK,CAAC;QAGjB,iBAAY,GAAsC,EAAE,CAAC;QAGrD,YAAO,GAAG,KAA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,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,CAAU,MAAM,CAAC,EAAE,CAAC;6CACjD;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAC1B;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAC0B;AAGrD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAC3B;AAdJ,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAwFxB"}
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
* @attr {string} placement - Position: 'top' | 'bottom' | 'left' | 'right' (default: 'bottom'; automatically 'top' on touch devices)
|
|
11
11
|
* @attr {string} timing - When the tooltip appears on hover: 'instant' — right away, without a show delay. 'delay' (the default) — after the standard show delay (700ms). 'never' — the tooltip is never shown; hover and focus events are ignored, aria-describedby is suppressed, and a tooltip that is already visible disappears. The hide delay and the touch suppression stay in force under every value. A focus trigger is always instant.
|
|
12
12
|
*
|
|
13
|
+
* Escape closes a tooltip that hover or focus opened, wherever focus is: the
|
|
14
|
+
* pointer can rest on a button while focus sits somewhere else (WCAG 1.4.13).
|
|
15
|
+
* That press closes the tooltip only. A dialog, sheet or menu around it stays
|
|
16
|
+
* open and takes the next one. The tooltip takes the key in the capture phase
|
|
17
|
+
* on `document` and stops it there, so a handler of your own for Escape does
|
|
18
|
+
* not hear that press either.
|
|
19
|
+
*
|
|
13
20
|
* @slot - The element the tooltip is shown for
|
|
14
21
|
*
|
|
15
22
|
* @fires nldd-tooltip-dismiss - When a user presses Escape while `open=true`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/content/tooltip/tooltip.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":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B,mBAAmB,IAAI,IAAI;IAI3B,OAAO,CAAC,cAAc,CA2BpB;YAEY,eAAe;IAyCpB,oBAAoB,IAAI,IAAI;IAmB5B,MAAM;CAGf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,cAAc,EAAE,WAAW,CAAC;KAC5B;CACD"}
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
* @attr {string} placement - Position: 'top' | 'bottom' | 'left' | 'right' (default: 'bottom'; automatically 'top' on touch devices)
|
|
11
11
|
* @attr {string} timing - When the tooltip appears on hover: 'instant' — right away, without a show delay. 'delay' (the default) — after the standard show delay (700ms). 'never' — the tooltip is never shown; hover and focus events are ignored, aria-describedby is suppressed, and a tooltip that is already visible disappears. The hide delay and the touch suppression stay in force under every value. A focus trigger is always instant.
|
|
12
12
|
*
|
|
13
|
+
* Escape closes a tooltip that hover or focus opened, wherever focus is: the
|
|
14
|
+
* pointer can rest on a button while focus sits somewhere else (WCAG 1.4.13).
|
|
15
|
+
* That press closes the tooltip only. A dialog, sheet or menu around it stays
|
|
16
|
+
* open and takes the next one. The tooltip takes the key in the capture phase
|
|
17
|
+
* on `document` and stops it there, so a handler of your own for Escape does
|
|
18
|
+
* not hear that press either.
|
|
19
|
+
*
|
|
13
20
|
* @slot - The element the tooltip is shown for
|
|
14
21
|
*
|
|
15
22
|
* @fires nldd-tooltip-dismiss - When a user presses Escape while `open=true`.
|
|
@@ -77,6 +84,11 @@ let NLDDTooltip = class NLDDTooltip extends LitElement {
|
|
|
77
84
|
if (e.key !== 'Escape' || !this._visible)
|
|
78
85
|
return;
|
|
79
86
|
if (this.open) {
|
|
87
|
+
// A forced tooltip belongs to whoever opened it, so only an Escape
|
|
88
|
+
// from inside it counts: one pressed elsewhere is meant for
|
|
89
|
+
// something else, such as the dialog around it.
|
|
90
|
+
if (!e.composedPath().includes(this))
|
|
91
|
+
return;
|
|
80
92
|
// WCAG 1.4.13 (Content on Hover or Focus): persistent
|
|
81
93
|
// keyboard-triggered overlay content must be dismissible without
|
|
82
94
|
// moving focus. The consumer controls the open lifecycle (e.g.
|
|
@@ -86,10 +98,17 @@ let NLDDTooltip = class NLDDTooltip extends LitElement {
|
|
|
86
98
|
// bubbling to something else (modal close, etc.) when handled.
|
|
87
99
|
this.dispatchEvent(new CustomEvent('nldd-tooltip-dismiss', { bubbles: true, composed: true }));
|
|
88
100
|
e.preventDefault();
|
|
101
|
+
e.stopPropagation();
|
|
89
102
|
return;
|
|
90
103
|
}
|
|
91
104
|
// Hover/focus-shown tooltips: we own the lifecycle, dismiss directly.
|
|
105
|
+
// The key stops here: with a tooltip showing inside a dialog, sheet or
|
|
106
|
+
// menu, the first press takes the tooltip and the second whatever is
|
|
107
|
+
// around it. Two tooltips showing at once both close on that first
|
|
108
|
+
// press, since each hears it on the document.
|
|
92
109
|
this._visible = false;
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
e.stopPropagation();
|
|
93
112
|
};
|
|
94
113
|
}
|
|
95
114
|
get _effectivePlacement() {
|
|
@@ -97,7 +116,8 @@ let NLDDTooltip = class NLDDTooltip extends LitElement {
|
|
|
97
116
|
}
|
|
98
117
|
connectedCallback() {
|
|
99
118
|
super.connectedCallback();
|
|
100
|
-
|
|
119
|
+
if (this._visible)
|
|
120
|
+
document.addEventListener('keydown', this._handleKeyDown, true);
|
|
101
121
|
// Re-register slotchange after reconnect (firstUpdated only runs once)
|
|
102
122
|
if (this.hasUpdated) {
|
|
103
123
|
this.shadowRoot?.querySelector('slot')?.addEventListener('slotchange', this._boundSlotChange);
|
|
@@ -126,6 +146,13 @@ let NLDDTooltip = class NLDDTooltip extends LitElement {
|
|
|
126
146
|
}
|
|
127
147
|
}
|
|
128
148
|
if (changed.has('_visible')) {
|
|
149
|
+
// On the document and only while showing: a tooltip opened by hover
|
|
150
|
+
// has no focus inside it, so a listener on the host never hears the
|
|
151
|
+
// Escape that WCAG 1.4.13 asks for.
|
|
152
|
+
if (this._visible)
|
|
153
|
+
document.addEventListener('keydown', this._handleKeyDown, true);
|
|
154
|
+
else
|
|
155
|
+
document.removeEventListener('keydown', this._handleKeyDown, true);
|
|
129
156
|
const tooltip = this._getTooltipElement();
|
|
130
157
|
if (tooltip) {
|
|
131
158
|
if (this._visible) {
|
|
@@ -368,7 +395,7 @@ let NLDDTooltip = class NLDDTooltip extends LitElement {
|
|
|
368
395
|
}
|
|
369
396
|
disconnectedCallback() {
|
|
370
397
|
super.disconnectedCallback();
|
|
371
|
-
|
|
398
|
+
document.removeEventListener('keydown', this._handleKeyDown, true);
|
|
372
399
|
this.shadowRoot?.querySelector('slot')?.removeEventListener('slotchange', this._boundSlotChange);
|
|
373
400
|
if (this._hideTimeout) {
|
|
374
401
|
clearTimeout(this._hideTimeout);
|