@nldd/design-system 0.8.85 → 0.8.87
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/custom-elements.json +1011 -355
- package/dist/components/actions/icon-button/icon-button.d.ts +2 -2
- package/dist/components/actions/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/actions/icon-button/icon-button.js +3 -3
- package/dist/components/actions/icon-button/icon-button.js.map +1 -1
- package/dist/components/components.js +1546 -371
- package/dist/components/content/avatar/avatar.d.ts +6 -6
- package/dist/components/content/avatar/avatar.d.ts.map +1 -1
- package/dist/components/content/avatar/avatar.js +9 -9
- package/dist/components/content/avatar/avatar.js.map +1 -1
- package/dist/components/content/icon/icon-aliases.d.ts.map +1 -1
- package/dist/components/content/icon/icon-aliases.js +4 -0
- 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 +3 -26
- package/dist/components/content/icon/icon-gallery-status.js.map +1 -1
- package/dist/components/content/icon/icon-registry.d.ts.map +1 -1
- package/dist/components/content/icon/icon-registry.js +2 -0
- package/dist/components/content/icon/icon-registry.js.map +1 -1
- package/dist/components/content/icon/icon.d.ts +2 -2
- package/dist/components/content/icon/icon.d.ts.map +1 -1
- package/dist/components/content/icon/icon.js +3 -3
- package/dist/components/content/icon/icon.js.map +1 -1
- package/dist/components/content/icon/icon.styles.d.ts.map +1 -1
- package/dist/components/content/icon/icon.styles.js +8 -2
- package/dist/components/content/icon/icon.styles.js.map +1 -1
- package/dist/components/content/rich-text/rich-text.d.ts +7 -6
- package/dist/components/content/rich-text/rich-text.d.ts.map +1 -1
- package/dist/components/content/rich-text/rich-text.js +8 -7
- package/dist/components/content/rich-text/rich-text.js.map +1 -1
- package/dist/components/content/text/text.d.ts +2 -2
- package/dist/components/content/text/text.js +3 -3
- package/dist/components/content/title/title.d.ts +5 -5
- package/dist/components/content/title/title.d.ts.map +1 -1
- package/dist/components/content/title/title.js +6 -6
- package/dist/components/content/title/title.js.map +1 -1
- package/dist/components/content/tooltip/tooltip.d.ts +2 -2
- package/dist/components/content/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/content/tooltip/tooltip.js +4 -4
- package/dist/components/content/tooltip/tooltip.js.map +1 -1
- package/dist/components/{dist-C09E9-dJ.js → dist-B_Mnmrj4.js} +1 -1
- package/dist/components/{dist-CjaG8dOI.js → dist-ByH8hQze.js} +2 -2
- package/dist/components/{dist-BB7TxeMK.js → dist-CRwuSgMM.js} +2 -2
- package/dist/components/{dist-la_b3ZSq.js → dist-CSrO_mYe.js} +1 -1
- package/dist/components/{dist-762GHPyH.js → dist-CX3DK4i7.js} +3 -3
- package/dist/components/{dist-DZoFKUO-.js → dist-CbCO0WCd.js} +1 -1
- package/dist/components/{dist-B_3OW7pC.js → dist-CgDuh26K.js} +1 -1
- package/dist/components/{dist-DaavuU6W.js → dist-DXZ-cFAl.js} +2 -2
- package/dist/components/{dist-CRsR6ckU.js → dist-LX8LuMac.js} +1 -1
- package/dist/components/{dist-BJI4-6iQ.js → dist-eVFegyjM.js} +1 -1
- package/dist/components/{dist-C6gnorjP.js → dist-fIxe0l7k.js} +9 -1
- package/dist/components/{icon-Cd4BloIM.js → icon-C_zwJZ_g.js} +14 -4
- package/dist/components/{icon-button-CXN0yaVx.js → icon-button-CEz4MB9H.js} +10 -10
- package/dist/components/inputs/code-editor/code-editor.styles.js +2 -2
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.d.ts +3 -5
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.js +30 -44
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.annotations.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.annotations.js +31 -5
- package/dist/components/inputs/text-editor/text-editor.annotations.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.commands.d.ts +14 -2
- package/dist/components/inputs/text-editor/text-editor.commands.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.commands.js +115 -36
- package/dist/components/inputs/text-editor/text-editor.commands.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.cursor.d.ts +7 -0
- package/dist/components/inputs/text-editor/text-editor.cursor.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.cursor.js +207 -0
- package/dist/components/inputs/text-editor/text-editor.cursor.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.d.ts +65 -13
- package/dist/components/inputs/text-editor/text-editor.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.emphasis.d.ts +32 -0
- package/dist/components/inputs/text-editor/text-editor.emphasis.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.emphasis.js +229 -0
- package/dist/components/inputs/text-editor/text-editor.emphasis.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.js +177 -18
- package/dist/components/inputs/text-editor/text-editor.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.links.d.ts +8 -0
- package/dist/components/inputs/text-editor/text-editor.links.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.links.js +30 -4
- package/dist/components/inputs/text-editor/text-editor.links.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.markdown.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.markdown.js +52 -18
- package/dist/components/inputs/text-editor/text-editor.markdown.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.mentions.d.ts +78 -11
- package/dist/components/inputs/text-editor/text-editor.mentions.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.mentions.js +190 -41
- package/dist/components/inputs/text-editor/text-editor.mentions.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.ordered-list.d.ts +0 -2
- package/dist/components/inputs/text-editor/text-editor.ordered-list.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.ordered-list.js +21 -1
- package/dist/components/inputs/text-editor/text-editor.ordered-list.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.styles.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.styles.js +11 -10
- package/dist/components/inputs/text-editor/text-editor.styles.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.syntax.d.ts +9 -0
- package/dist/components/inputs/text-editor/text-editor.syntax.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.syntax.js +20 -0
- package/dist/components/inputs/text-editor/text-editor.syntax.js.map +1 -0
- package/dist/components/layout/collection/collection.d.ts +15 -8
- package/dist/components/layout/collection/collection.d.ts.map +1 -1
- package/dist/components/layout/collection/collection.js +38 -13
- package/dist/components/layout/collection/collection.js.map +1 -1
- package/dist/components/layout/collection/collection.styles.d.ts.map +1 -1
- package/dist/components/layout/collection/collection.styles.js +36 -23
- package/dist/components/layout/collection/collection.styles.js.map +1 -1
- package/dist/components/layout/container/container.d.ts +11 -3
- package/dist/components/layout/container/container.d.ts.map +1 -1
- package/dist/components/layout/container/container.js +30 -17
- package/dist/components/layout/container/container.js.map +1 -1
- package/dist/components/layout/container/container.styles.d.ts.map +1 -1
- package/dist/components/layout/container/container.styles.js +19 -21
- package/dist/components/layout/container/container.styles.js.map +1 -1
- package/dist/components/layout/page/page.d.ts +23 -2
- package/dist/components/layout/page/page.d.ts.map +1 -1
- package/dist/components/layout/page/page.js +56 -2
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/page/page.styles.d.ts.map +1 -1
- package/dist/components/layout/page/page.styles.js +33 -8
- package/dist/components/layout/page/page.styles.js.map +1 -1
- package/dist/components/layout/page-sections/page-section-controls.d.ts +0 -70
- package/dist/components/layout/page-sections/page-section-controls.d.ts.map +1 -1
- package/dist/components/layout/page-sections/page-section-controls.js +0 -3
- package/dist/components/layout/page-sections/page-section-controls.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 +7 -5
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.styles.js.map +1 -1
- package/dist/components/layout/sheet/sheet.d.ts +3 -7
- package/dist/components/layout/sheet/sheet.d.ts.map +1 -1
- package/dist/components/layout/sheet/sheet.js +4 -18
- package/dist/components/layout/sheet/sheet.js.map +1 -1
- package/dist/components/layout/sheet/sheet.styles.d.ts.map +1 -1
- package/dist/components/layout/sheet/sheet.styles.js +2 -6
- package/dist/components/layout/sheet/sheet.styles.js.map +1 -1
- package/dist/components/layout/sheet/sheet.template.js +2 -2
- package/dist/components/layout/sheet/sheet.template.js.map +1 -1
- package/dist/components/layout/split-views/bar-split-view/bar-split-view.d.ts +1 -1
- package/dist/components/layout/split-views/bar-split-view/bar-split-view.d.ts.map +1 -1
- package/dist/components/layout/split-views/bar-split-view/bar-split-view.js +13 -13
- package/dist/components/layout/split-views/bar-split-view/bar-split-view.js.map +1 -1
- package/dist/components/layout/split-views/bar-split-view/bar-split-view.styles.js +1 -1
- package/dist/components/layout/window/window.d.ts +2 -4
- package/dist/components/layout/window/window.d.ts.map +1 -1
- package/dist/components/layout/window/window.js +4 -14
- package/dist/components/layout/window/window.js.map +1 -1
- package/dist/components/layout/window/window.template.d.ts.map +1 -1
- package/dist/components/layout/window/window.template.js +2 -2
- package/dist/components/layout/window/window.template.js.map +1 -1
- package/dist/components/lists-and-tables/cells/icon-cell/icon-cell.d.ts +2 -2
- package/dist/components/lists-and-tables/cells/icon-cell/icon-cell.js +3 -3
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.d.ts +2 -2
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.js +3 -3
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.d.ts +2 -2
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.js +3 -3
- package/dist/components/lists-and-tables/list/list.d.ts +17 -5
- package/dist/components/lists-and-tables/list/list.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.js +62 -8
- package/dist/components/lists-and-tables/list/list.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.styles.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.styles.js +8 -1
- package/dist/components/lists-and-tables/list/list.styles.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.template.d.ts +4 -1
- package/dist/components/lists-and-tables/list/list.template.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.template.js +31 -12
- package/dist/components/lists-and-tables/list/list.template.js.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.d.ts +8 -3
- 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 +35 -9
- 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 +18 -1
- package/dist/components/lists-and-tables/list-item/list-item.template.js.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js.map +1 -1
- package/dist/components/navigation/link/link.d.ts +2 -2
- package/dist/components/navigation/link/link.d.ts.map +1 -1
- package/dist/components/navigation/link/link.js +3 -2
- package/dist/components/navigation/link/link.js.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.d.ts.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.js +50 -12
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.js.map +1 -1
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.d.ts +3 -3
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.d.ts.map +1 -1
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.js +4 -4
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.js.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.d.ts +8 -0
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.d.ts.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.js +14 -0
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.js.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.styles.js +22 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.styles.js.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.template.d.ts.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.template.js +6 -2
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.template.js.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.d.ts +3 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.js +5 -0
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.styles.js +3 -3
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.template.d.ts.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.template.js +1 -0
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.template.js.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.styles.js +15 -0
- package/dist/components/status-and-feedback/progress-circle/progress-circle.styles.js.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.template.d.ts.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.template.js +4 -3
- package/dist/components/status-and-feedback/progress-circle/progress-circle.template.js.map +1 -1
- package/dist/components/visibility-mixin-BU1vIMW7.js +161 -0
- package/dist/favicon.svg +10 -0
- package/dist/nldd.min.js +834 -676
- package/dist/touch-icon.png +0 -0
- package/dist/types/vue.d.ts +55 -33
- package/dist/utilities/spacing-scale.d.ts +26 -0
- package/dist/utilities/spacing-scale.d.ts.map +1 -0
- package/dist/utilities/spacing-scale.js +54 -0
- package/dist/utilities/spacing-scale.js.map +1 -0
- package/dist/utilities/visibility-mixin.d.ts +11 -8
- package/dist/utilities/visibility-mixin.d.ts.map +1 -1
- package/dist/utilities/visibility-mixin.js +58 -45
- package/dist/utilities/visibility-mixin.js.map +1 -1
- package/dist/utilities/visibility-mixin.styles.d.ts +14 -0
- package/dist/utilities/visibility-mixin.styles.d.ts.map +1 -0
- package/dist/utilities/visibility-mixin.styles.js +52 -0
- package/dist/utilities/visibility-mixin.styles.js.map +1 -0
- package/package.json +5 -2
- package/dist/components/visibility-mixin-vbfhyo7f.js +0 -104
|
@@ -5,37 +5,25 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { property } from 'lit/decorators.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
// breakpoint
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return breakpoints.mdMax; // hidden in sm + md
|
|
17
|
-
if (value === 'sm')
|
|
18
|
-
return null; // nothing below sm
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
function resolveHideAbove(value) {
|
|
22
|
-
if (value === 'sm')
|
|
23
|
-
return breakpoints.mdMin; // hidden in md + lg
|
|
24
|
-
if (value === 'md')
|
|
25
|
-
return breakpoints.lgMin; // hidden in lg
|
|
26
|
-
if (value === 'lg')
|
|
27
|
-
return null; // nothing above lg
|
|
8
|
+
import { visibilityStyles } from './visibility-mixin.styles.js';
|
|
9
|
+
const NAMED_BREAKPOINTS = new Set(['sm', 'md', 'lg']);
|
|
10
|
+
// A named breakpoint is already covered by the static stylesheet. Only a custom
|
|
11
|
+
// CSS length has to become a rule at runtime, because a container query cannot
|
|
12
|
+
// read its threshold from a variable.
|
|
13
|
+
function customThreshold(value) {
|
|
14
|
+
if (value === undefined || NAMED_BREAKPOINTS.has(value))
|
|
15
|
+
return null;
|
|
28
16
|
return value;
|
|
29
17
|
}
|
|
30
18
|
/**
|
|
31
|
-
* The open edges
|
|
32
|
-
*
|
|
19
|
+
* The open edges hide nothing, so the attribute is written but never applies.
|
|
20
|
+
* That reads like a working value, and the name invites it: `hide-below`
|
|
33
21
|
* names the breakpoint you hide BELOW, so "hide it at sm" comes out as
|
|
34
22
|
* `hide-below="md"` and `hide-below="sm"` does nothing at all. Say so once,
|
|
35
23
|
* rather than let it look applied.
|
|
36
24
|
*/
|
|
37
|
-
function warnNoOp(host, attribute, value,
|
|
38
|
-
if (value !== openEdge
|
|
25
|
+
function warnNoOp(host, attribute, value, openEdge, edgeLabel) {
|
|
26
|
+
if (value !== openEdge)
|
|
39
27
|
return;
|
|
40
28
|
console.warn(`[${host.localName}] ${attribute}="${openEdge}" never hides anything: there is no `
|
|
41
29
|
+ `breakpoint ${edgeLabel}. The value names the breakpoint you hide below, so the `
|
|
@@ -46,8 +34,8 @@ function warnNoOp(host, attribute, value, resolved, openEdge, edgeLabel) {
|
|
|
46
34
|
* Adds `hide-below` and `hide-above` attributes that toggle visibility based
|
|
47
35
|
* on the inline-size of an ancestor CSS container.
|
|
48
36
|
*
|
|
49
|
-
* Without a `containerName` argument the
|
|
50
|
-
*
|
|
37
|
+
* Without a `containerName` argument the rule is an anonymous `@container (…)`
|
|
38
|
+
* query — it matches the nearest ancestor that declares
|
|
51
39
|
* `container-type: inline-size`. Pass a name to target a specific container
|
|
52
40
|
* (e.g. `'cells-container'` for cells inside `nldd-list`, which sets that
|
|
53
41
|
* name inline on its host as a Safari shadow-DOM workaround).
|
|
@@ -56,12 +44,15 @@ function warnNoOp(host, attribute, value, resolved, openEdge, edgeLabel) {
|
|
|
56
44
|
* (e.g. '320px', '20rem'). Named values resolve to the standard breakpoint
|
|
57
45
|
* thresholds: `hide-below` uses the breakpoint's lower bound (e.g.
|
|
58
46
|
* `hide-below="lg"` hides in sm+md and shows in lg), `hide-above` its upper
|
|
59
|
-
* bound; the open edges (below sm, above lg) are no-ops.
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
47
|
+
* bound; the open edges (below sm, above lg) are no-ops.
|
|
48
|
+
*
|
|
49
|
+
* The named values are static CSS (see `visibility-mixin.styles.ts`), added
|
|
50
|
+
* through `finalizeStyles` so that a component's own `static styles` does not
|
|
51
|
+
* have to know about them. A custom length has no static form: the threshold
|
|
52
|
+
* is only known at runtime and a container query cannot read one from a CSS
|
|
53
|
+
* variable, so its rule is written at runtime into a constructable stylesheet
|
|
54
|
+
* the shadow root adopts. Neither path is an inline stylesheet, so no consumer
|
|
55
|
+
* needs `'unsafe-inline'` in its `style-src` for either.
|
|
65
56
|
*
|
|
66
57
|
* @mixin VisibilityMixin
|
|
67
58
|
*
|
|
@@ -79,37 +70,59 @@ function warnNoOp(host, attribute, value, resolved, openEdge, edgeLabel) {
|
|
|
79
70
|
*/
|
|
80
71
|
export function VisibilityMixin(Base, containerName) {
|
|
81
72
|
class WithVisibility extends Base {
|
|
73
|
+
// Lit calls this from finalize() with whatever the most-derived class put
|
|
74
|
+
// in `static styles`, which is why the mixin can add its sheet here and a
|
|
75
|
+
// component's own `static styles =` never clobbers it.
|
|
76
|
+
//
|
|
77
|
+
// `Base` is the direct superclass, so this is `super.finalizeStyles` with
|
|
78
|
+
// the receiver kept; it is reached through the cast because a
|
|
79
|
+
// `Constructor<LitElement>` type parameter does not carry Lit's statics.
|
|
80
|
+
/** @internal */
|
|
81
|
+
static finalizeStyles(styles) {
|
|
82
|
+
const inherited = Base.finalizeStyles.call(this, styles);
|
|
83
|
+
return [...inherited, visibilityStyles(containerName)];
|
|
84
|
+
}
|
|
82
85
|
updated(changed) {
|
|
83
86
|
super.updated(changed);
|
|
84
87
|
if (changed.has('hideBelow') || changed.has('hideAbove')) {
|
|
85
|
-
this.
|
|
88
|
+
this._updateVisibilityRules();
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
// The rule for a custom length is built here, into a stylesheet the shadow
|
|
92
|
+
// root adopts rather than a <style> element written into it. A CSP judges
|
|
93
|
+
// the element and leaves the CSSOM alone, so this path needs no
|
|
94
|
+
// 'unsafe-inline' either.
|
|
95
|
+
_updateVisibilityRules() {
|
|
96
|
+
const root = this.shadowRoot;
|
|
97
|
+
if (!root)
|
|
90
98
|
return;
|
|
91
99
|
const containerPrefix = containerName ? `${containerName} ` : '';
|
|
92
100
|
const rules = [];
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
warnNoOp(this, 'hide-below', this.hideBelow, 'sm', 'below sm');
|
|
102
|
+
const below = customThreshold(this.hideBelow);
|
|
95
103
|
if (below) {
|
|
96
104
|
rules.push(`:host { @container ${containerPrefix}(max-width: ${below}) { display: none !important; } }`);
|
|
97
105
|
}
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
warnNoOp(this, 'hide-above', this.hideAbove, 'lg', 'above lg');
|
|
107
|
+
const above = customThreshold(this.hideAbove);
|
|
100
108
|
if (above) {
|
|
101
109
|
rules.push(`:host { @container ${containerPrefix}(min-width: ${above}) { display: none !important; } }`);
|
|
102
110
|
}
|
|
103
111
|
if (rules.length === 0) {
|
|
104
|
-
this.
|
|
105
|
-
|
|
112
|
+
if (this._visibilitySheet) {
|
|
113
|
+
const dropped = this._visibilitySheet;
|
|
114
|
+
root.adoptedStyleSheets = Array.from(root.adoptedStyleSheets)
|
|
115
|
+
.filter((sheet) => sheet !== dropped);
|
|
116
|
+
this._visibilitySheet = undefined;
|
|
117
|
+
}
|
|
106
118
|
return;
|
|
107
119
|
}
|
|
108
|
-
if (!this.
|
|
109
|
-
this.
|
|
110
|
-
|
|
120
|
+
if (!this._visibilitySheet) {
|
|
121
|
+
this._visibilitySheet = new CSSStyleSheet();
|
|
122
|
+
// Last, so it outranks the static sheet on a tie.
|
|
123
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, this._visibilitySheet];
|
|
111
124
|
}
|
|
112
|
-
this.
|
|
125
|
+
this._visibilitySheet.replaceSync(rules.join('\n'));
|
|
113
126
|
}
|
|
114
127
|
}
|
|
115
128
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visibility-mixin.js","sourceRoot":"","sources":["../../src/utilities/visibility-mixin.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"visibility-mixin.js","sourceRoot":"","sources":["../../src/utilities/visibility-mixin.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CSSResult } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* The `@container` rules for the named `hide-below` / `hide-above` values.
|
|
4
|
+
*
|
|
5
|
+
* Static, so they reach the shadow root through `adoptedStyleSheets` instead
|
|
6
|
+
* of a `<style>` element. That keeps consumers on a `style-src` without
|
|
7
|
+
* `'unsafe-inline'`; a custom CSS length has no static form and gets its rule
|
|
8
|
+
* from the mixin at runtime, into an adopted sheet of its own.
|
|
9
|
+
*
|
|
10
|
+
* The rules are nested (`:host { @container … }`) rather than flattened, because
|
|
11
|
+
* `@container { :host { … } }` is unreliable in Safari.
|
|
12
|
+
*/
|
|
13
|
+
export declare function visibilityStyles(containerName?: string): CSSResult;
|
|
14
|
+
//# sourceMappingURL=visibility-mixin.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility-mixin.styles.d.ts","sourceRoot":"","sources":["../../src/utilities/visibility-mixin.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AAYrD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CA+BlE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
|
2
|
+
import { breakpoints } from '../assets/styles/breakpoints.js';
|
|
3
|
+
const smMax = unsafeCSS(breakpoints.smMax);
|
|
4
|
+
const mdMin = unsafeCSS(breakpoints.mdMin);
|
|
5
|
+
const mdMax = unsafeCSS(breakpoints.mdMax);
|
|
6
|
+
const lgMin = unsafeCSS(breakpoints.lgMin);
|
|
7
|
+
// One sheet per container name, so every component passing the same name
|
|
8
|
+
// shares a single constructable stylesheet instead of each adopting its own.
|
|
9
|
+
const sheets = new Map();
|
|
10
|
+
/**
|
|
11
|
+
* The `@container` rules for the named `hide-below` / `hide-above` values.
|
|
12
|
+
*
|
|
13
|
+
* Static, so they reach the shadow root through `adoptedStyleSheets` instead
|
|
14
|
+
* of a `<style>` element. That keeps consumers on a `style-src` without
|
|
15
|
+
* `'unsafe-inline'`; a custom CSS length has no static form and gets its rule
|
|
16
|
+
* from the mixin at runtime, into an adopted sheet of its own.
|
|
17
|
+
*
|
|
18
|
+
* The rules are nested (`:host { @container … }`) rather than flattened, because
|
|
19
|
+
* `@container { :host { … } }` is unreliable in Safari.
|
|
20
|
+
*/
|
|
21
|
+
export function visibilityStyles(containerName) {
|
|
22
|
+
const key = containerName ?? '';
|
|
23
|
+
const cached = sheets.get(key);
|
|
24
|
+
if (cached)
|
|
25
|
+
return cached;
|
|
26
|
+
const container = unsafeCSS(containerName ? `${containerName} ` : '');
|
|
27
|
+
const sheet = css `
|
|
28
|
+
/* # Hide below: the value names the breakpoint you hide BELOW */
|
|
29
|
+
|
|
30
|
+
:host([hide-below="md"]) {
|
|
31
|
+
@container ${container}(max-width: ${smMax}) { display: none !important; }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([hide-below="lg"]) {
|
|
35
|
+
@container ${container}(max-width: ${mdMax}) { display: none !important; }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/* # Hide above */
|
|
40
|
+
|
|
41
|
+
:host([hide-above="sm"]) {
|
|
42
|
+
@container ${container}(min-width: ${mdMin}) { display: none !important; }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host([hide-above="md"]) {
|
|
46
|
+
@container ${container}(min-width: ${lgMin}) { display: none !important; }
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
sheets.set(key, sheet);
|
|
50
|
+
return sheet;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=visibility-mixin.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility-mixin.styles.js","sourceRoot":"","sources":["../../src/utilities/visibility-mixin.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAkB,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,KAAK,GAAG,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC3C,MAAM,KAAK,GAAG,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC3C,MAAM,KAAK,GAAG,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC3C,MAAM,KAAK,GAAG,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAE3C,yEAAyE;AACzE,6EAA6E;AAC7E,MAAM,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,aAAsB;IACtD,MAAM,GAAG,GAAG,aAAa,IAAI,EAAE,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,MAAM,SAAS,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACtE,MAAM,KAAK,GAAG,GAAG,CAAA;;;;gBAIF,SAAS,eAAe,KAAK;;;;gBAI7B,SAAS,eAAe,KAAK;;;;;;;gBAO7B,SAAS,eAAe,KAAK;;;;gBAI7B,SAAS,eAAe,KAAK;;EAE3C,CAAC;IAEF,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACvB,OAAO,KAAK,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nldd/design-system",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.87",
|
|
4
4
|
"description": "Design System voor Nederlandse Digitale Dienst",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/components/components.js",
|
|
@@ -455,6 +455,8 @@
|
|
|
455
455
|
"./styles/variables": "./dist/css/variables.css",
|
|
456
456
|
"./styles/tokens": "./dist/css/tokens.css",
|
|
457
457
|
"./styles/fouc": "./dist/css/fouc.css",
|
|
458
|
+
"./favicon.svg": "./dist/favicon.svg",
|
|
459
|
+
"./touch-icon.png": "./dist/touch-icon.png",
|
|
458
460
|
"./breakpoints": {
|
|
459
461
|
"types": "./dist/assets/styles/breakpoints.d.ts",
|
|
460
462
|
"default": "./dist/assets/styles/breakpoints.js"
|
|
@@ -478,8 +480,9 @@
|
|
|
478
480
|
"registry": "https://registry.npmjs.org"
|
|
479
481
|
},
|
|
480
482
|
"scripts": {
|
|
481
|
-
"build": "npm run build:styles && npm run validate:styles && npm run validate:host-styles && npm run build:components",
|
|
483
|
+
"build": "npm run build:styles && npm run build:assets && npm run validate:styles && npm run validate:host-styles && npm run build:components",
|
|
482
484
|
"build:styles": "rm -rf dist/css dist/fonts && mkdir -p dist/css dist/fonts && cp src/assets/styles/variables.css src/assets/styles/colors.generated.css src/assets/styles/rijksoverheid-fonts.css src/assets/styles/document-reset.css src/assets/styles/fouc.css dist/css/ && cp src/components/content/rich-text/rich-text.css src/components/forms/form/form.css src/components/forms/form-section/form-section.css dist/css/ && printf '@import \"./rijksoverheid-fonts.css\";\\n@import \"./variables.css\";\\n@import \"./document-reset.css\";\\n@import \"./rich-text.css\";\\n@import \"./form-section.css\";\\n@import \"./form.css\";\\n@import \"./fouc.css\";\\n' > dist/css/global.css && printf '@import \"./variables.css\";\\n@import \"./document-reset.css\";\\n@import \"./rich-text.css\";\\n@import \"./form-section.css\";\\n@import \"./form.css\";\\n@import \"./fouc.css\";\\n' > dist/css/global-system-font.css && printf '@import \"./rijksoverheid-fonts.css\";\\n@import \"./variables.css\";\\n' > dist/css/tokens.css && cp src/assets/fonts/*.woff2 dist/fonts/",
|
|
485
|
+
"build:assets": "mkdir -p dist && cp src/assets/favicon/favicon.svg src/assets/favicon/touch-icon.png dist/",
|
|
483
486
|
"generate:colors": "node scripts/generate-colors.js",
|
|
484
487
|
"generate:component-reference": "node scripts/generate-component-reference.js",
|
|
485
488
|
"generate:cem": "cem analyze && npm run generate:vue-types",
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { t as __decorate } from "./decorate-lwt_OrAG.js";
|
|
2
|
-
import { t as breakpoints } from "./breakpoints-CkxsiRgH.js";
|
|
3
|
-
import { property } from "lit/decorators.js";
|
|
4
|
-
//#region src/utilities/visibility-mixin.ts
|
|
5
|
-
function resolveHideBelow(value) {
|
|
6
|
-
if (value === "md") return breakpoints.smMax;
|
|
7
|
-
if (value === "lg") return breakpoints.mdMax;
|
|
8
|
-
if (value === "sm") return null;
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
function resolveHideAbove(value) {
|
|
12
|
-
if (value === "sm") return breakpoints.mdMin;
|
|
13
|
-
if (value === "md") return breakpoints.lgMin;
|
|
14
|
-
if (value === "lg") return null;
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The open edges resolve to null, so the attribute is written but nothing ever
|
|
19
|
-
* hides. That reads like a working value, and the name invites it: `hide-below`
|
|
20
|
-
* names the breakpoint you hide BELOW, so "hide it at sm" comes out as
|
|
21
|
-
* `hide-below="md"` and `hide-below="sm"` does nothing at all. Say so once,
|
|
22
|
-
* rather than let it look applied.
|
|
23
|
-
*/
|
|
24
|
-
function warnNoOp(host, attribute, value, resolved, openEdge, edgeLabel) {
|
|
25
|
-
if (value !== openEdge || resolved !== null) return;
|
|
26
|
-
console.warn(`[${host.localName}] ${attribute}="${openEdge}" never hides anything: there is no breakpoint ${edgeLabel}. The value names the breakpoint you hide below, so the smallest one that hides is "${attribute === "hide-below" ? "md" : "sm"}". Leave the attribute off if you meant "always visible".`);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Adds `hide-below` and `hide-above` attributes that toggle visibility based
|
|
30
|
-
* on the inline-size of an ancestor CSS container.
|
|
31
|
-
*
|
|
32
|
-
* Without a `containerName` argument the generated rule is an anonymous
|
|
33
|
-
* `@container (…)` query — it matches the nearest ancestor that declares
|
|
34
|
-
* `container-type: inline-size`. Pass a name to target a specific container
|
|
35
|
-
* (e.g. `'cells-container'` for cells inside `nldd-list`, which sets that
|
|
36
|
-
* name inline on its host as a Safari shadow-DOM workaround).
|
|
37
|
-
*
|
|
38
|
-
* Values are either a named breakpoint — `sm` / `md` / `lg` — or a CSS length
|
|
39
|
-
* (e.g. '320px', '20rem'). Named values resolve to the standard breakpoint
|
|
40
|
-
* thresholds: `hide-below` uses the breakpoint's lower bound (e.g.
|
|
41
|
-
* `hide-below="lg"` hides in sm+md and shows in lg), `hide-above` its upper
|
|
42
|
-
* bound; the open edges (below sm, above lg) are no-ops. Container queries can't
|
|
43
|
-
* read CSS variables in their conditions, so the query rule is generated at
|
|
44
|
-
* runtime and injected as a <style> element in the component's shadow root,
|
|
45
|
-
* wrapped in `:host { @container <name>? (…) { display: none !important; } }`
|
|
46
|
-
* (nested form — the flattened `@container { :host { … } }` is unreliable in
|
|
47
|
-
* Safari).
|
|
48
|
-
*
|
|
49
|
-
* @mixin VisibilityMixin
|
|
50
|
-
*
|
|
51
|
-
* @attr {string} hide-below - Hides the element below this breakpoint: `sm` | `md` | `lg`, or a CSS length. The value names the breakpoint you hide BELOW, so `hide-below="md"` is hidden in sm and visible from md up. `sm` is the open edge and never hides (DEV-warns).
|
|
52
|
-
* @attr {string} hide-above - Hides the element above this breakpoint: `sm` | `md` | `lg`, or a CSS length. `hide-above="sm"` is hidden in md and lg. `lg` is the open edge and never hides (DEV-warns).
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```ts
|
|
56
|
-
* // Cell inside nldd-list — target the named cells-container
|
|
57
|
-
* class NLDDTextCell extends VisibilityMixin(LitElement, 'cells-container') { … }
|
|
58
|
-
*
|
|
59
|
-
* // Other component — fall back to the nearest unnamed container
|
|
60
|
-
* class SomeComponent extends VisibilityMixin(LitElement) { … }
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
function VisibilityMixin(Base, containerName) {
|
|
64
|
-
class WithVisibility extends Base {
|
|
65
|
-
updated(changed) {
|
|
66
|
-
super.updated(changed);
|
|
67
|
-
if (changed.has("hideBelow") || changed.has("hideAbove")) this._updateVisibilityStyle();
|
|
68
|
-
}
|
|
69
|
-
_updateVisibilityStyle() {
|
|
70
|
-
if (!this.shadowRoot) return;
|
|
71
|
-
const containerPrefix = containerName ? `${containerName} ` : "";
|
|
72
|
-
const rules = [];
|
|
73
|
-
const below = this.hideBelow ? resolveHideBelow(this.hideBelow) : null;
|
|
74
|
-
warnNoOp(this, "hide-below", this.hideBelow, below, "sm", "below sm");
|
|
75
|
-
if (below) rules.push(`:host { @container ${containerPrefix}(max-width: ${below}) { display: none !important; } }`);
|
|
76
|
-
const above = this.hideAbove ? resolveHideAbove(this.hideAbove) : null;
|
|
77
|
-
warnNoOp(this, "hide-above", this.hideAbove, above, "lg", "above lg");
|
|
78
|
-
if (above) rules.push(`:host { @container ${containerPrefix}(min-width: ${above}) { display: none !important; } }`);
|
|
79
|
-
if (rules.length === 0) {
|
|
80
|
-
this._visibilityStyle?.remove();
|
|
81
|
-
this._visibilityStyle = void 0;
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
if (!this._visibilityStyle) {
|
|
85
|
-
this._visibilityStyle = document.createElement("style");
|
|
86
|
-
this.shadowRoot.appendChild(this._visibilityStyle);
|
|
87
|
-
}
|
|
88
|
-
this._visibilityStyle.textContent = rules.join("\n");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
__decorate([property({
|
|
92
|
-
type: String,
|
|
93
|
-
reflect: true,
|
|
94
|
-
attribute: "hide-below"
|
|
95
|
-
})], WithVisibility.prototype, "hideBelow", void 0);
|
|
96
|
-
__decorate([property({
|
|
97
|
-
type: String,
|
|
98
|
-
reflect: true,
|
|
99
|
-
attribute: "hide-above"
|
|
100
|
-
})], WithVisibility.prototype, "hideAbove", void 0);
|
|
101
|
-
return WithVisibility;
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
export { VisibilityMixin as t };
|