@zazz-ui/core 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORING.md +21 -16
- package/CHANGELOG.md +111 -0
- package/README.md +3 -3
- package/dist/sri.json +89 -88
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +9042 -1944
- package/editor/zazz.html-data.json +31 -41
- package/editor/zazz.language-data.json +468 -233
- package/editor/zazz.lint-data.json +412 -396
- package/package.json +2 -3
- package/src/base/_defaults.css +59 -40
- package/src/base/_layers.css +5 -2
- package/src/base/_properties-2xl.css +10 -0
- package/src/base/_properties-active.css +8 -0
- package/src/base/_properties-checked.css +8 -0
- package/src/base/_properties-current.css +8 -0
- package/src/base/_properties-disabled.css +8 -0
- package/src/base/_properties-focus-visible.css +8 -0
- package/src/base/_properties-focus-within.css +8 -0
- package/src/base/_properties-hover.css +8 -0
- package/src/base/_properties-lg.css +10 -0
- package/src/base/_properties-md.css +10 -0
- package/src/base/_properties-open.css +8 -0
- package/src/base/_properties-sm.css +10 -0
- package/src/base/_properties-starting.css +4 -0
- package/src/base/_properties-stuck.css +4 -0
- package/src/base/_properties-xl.css +10 -0
- package/src/base/_properties.css +55 -15
- package/src/base/_reset.css +8 -4
- package/src/base/_typography.css +26 -9
- package/src/base/_utilities-box.css +63 -59
- package/src/base/_utilities-color.css +55 -8
- package/src/base/_utilities-effects.css +8 -0
- package/src/base/_utilities-flow.css +28 -5
- package/src/base/_utilities-pseudo.css +4 -0
- package/src/base/_utilities-spacing.css +8 -8
- package/src/base/_utilities-sr.css +98 -0
- package/src/base/_utilities-tier-2xl.css +5 -0
- package/src/base/_utilities-tier-active.css +5 -1
- package/src/base/_utilities-tier-checked.css +5 -1
- package/src/base/_utilities-tier-current.css +5 -1
- package/src/base/_utilities-tier-disabled.css +5 -1
- package/src/base/_utilities-tier-focus-visible.css +5 -1
- package/src/base/_utilities-tier-focus-within.css +5 -1
- package/src/base/_utilities-tier-hover.css +5 -1
- package/src/base/_utilities-tier-lg.css +5 -0
- package/src/base/_utilities-tier-md.css +5 -0
- package/src/base/_utilities-tier-open.css +5 -1
- package/src/base/_utilities-tier-sm.css +5 -0
- package/src/base/_utilities-tier-starting.css +2 -0
- package/src/base/_utilities-tier-stuck.css +3 -0
- package/src/base/_utilities-tier-xl.css +5 -0
- package/src/base/_utilities-typography.css +263 -3
- package/src/base/_variables.css +123 -57
- package/src/base/dialog-lifecycle.d.ts.map +1 -1
- package/src/base/dialog-lifecycle.js +4 -1
- package/src/base/dialog-lifecycle.ts +4 -1
- package/src/base/kit-styling.d.ts.map +1 -1
- package/src/base/kit-styling.js +90 -86
- package/src/base/kit-styling.ts +90 -86
- package/src/base/utilities.d.ts +23 -8
- package/src/base/utilities.d.ts.map +1 -1
- package/src/base/utilities.js +78 -3
- package/src/base/utilities.ts +95 -11
- package/src/head.d.ts.map +1 -1
- package/src/head.js +4 -5
- package/src/head.ts +4 -5
- package/src/index.css +3 -2
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +13 -3
- package/src/manifest.ts +13 -3
- package/src/primitives/alert-dialog/alert-dialog.css +1 -1
- package/src/primitives/autocomplete/autocomplete.css +4 -2
- package/src/primitives/avatar/avatar.html +4 -6
- package/src/primitives/badge/badge.css +66 -62
- package/src/primitives/breadcrumbs/breadcrumbs.html +1 -7
- package/src/primitives/button/button.css +47 -63
- package/src/primitives/button-group/button-group.css +4 -0
- package/src/primitives/callout/callout.css +22 -43
- package/src/primitives/card/card-subgrid.html +2 -3
- package/src/primitives/card/card.css +4 -0
- package/src/primitives/card/card.html +2 -3
- package/src/primitives/checkbox/checkbox.css +4 -0
- package/src/primitives/combobox/combobox.css +8 -1
- package/src/primitives/combobox/combobox.d.ts +23 -0
- package/src/primitives/combobox/combobox.d.ts.map +1 -1
- package/src/primitives/combobox/combobox.js +53 -2
- package/src/primitives/combobox/combobox.ts +51 -2
- package/src/primitives/command/command-actions.d.ts.map +1 -1
- package/src/primitives/command/command-actions.js +4 -9
- package/src/primitives/command/command-actions.ts +4 -9
- package/src/primitives/debug/audit-core.d.ts +1 -1
- package/src/primitives/debug/audit-core.d.ts.map +1 -1
- package/src/primitives/debug/audit-core.js +30 -3
- package/src/primitives/debug/audit-core.ts +40 -2
- package/src/primitives/debug/debug.d.ts.map +1 -1
- package/src/primitives/debug/debug.js +4 -1
- package/src/primitives/debug/debug.ts +4 -1
- package/src/primitives/dialog/dialog-with-form.html +1 -1
- package/src/primitives/dialog/dialog.css +19 -4
- package/src/primitives/fields/fields.css +11 -5
- package/src/primitives/group/group.css +18 -0
- package/src/primitives/group/group.html +26 -0
- package/src/primitives/input/input.css +14 -8
- package/src/primitives/input-group/input-group-password-group.html +1 -1
- package/src/primitives/input-group/input-group.css +12 -8
- package/src/primitives/kbd/kbd.css +4 -0
- package/src/primitives/lightbox/lightbox.css +13 -0
- package/src/primitives/lightbox/lightbox.html +2 -1
- package/src/primitives/menu/menu.css +3 -1
- package/src/primitives/meter/meter.css +10 -3
- package/src/primitives/navigation-menu/navigation-menu.css +5 -0
- package/src/primitives/navigation-menu/navigation-menu.html +2 -2
- package/src/primitives/otp/otp.css +4 -0
- package/src/primitives/password-group/password-group.css +13 -9
- package/src/primitives/password-group/password-group.html +1 -1
- package/src/primitives/popover/popover.css +6 -0
- package/src/primitives/progress/progress.css +5 -0
- package/src/primitives/radio/radio.css +3 -0
- package/src/primitives/select/select.css +17 -9
- package/src/primitives/slider/slider.css +8 -0
- package/src/primitives/switch/switch.css +56 -20
- package/src/primitives/tabs/tabs.css +18 -0
- package/src/primitives/textarea/textarea.css +19 -10
- package/src/primitives/toaster/toaster.css +8 -4
- package/src/primitives/toggle/toggle.css +10 -6
- package/src/primitives/toggle-group/toggle-group.css +4 -0
- package/src/primitives/tooltip/tooltip.css +4 -0
- package/src/primitives/utilities/pile.html +2 -3
- package/src/base/_switches.css +0 -148
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* @requires _layers.css, _variables.css, _properties.css (--_*-resolved, --_focus-shadow), fields.css (--ui-field-* background/border)
|
|
6
6
|
* @uses appearance: none — redraws the native control from theme tokens
|
|
7
7
|
* @uses checked/indeterminate fill with --primary and layer a glyph (never color alone)
|
|
8
|
+
* @uses corner-shape — superellipse corners; unsupported browsers keep plain
|
|
9
|
+
* rounded corners
|
|
8
10
|
* @tokens --ui-checkbox-* (@layer variables; named after the utilities they back;
|
|
9
11
|
* surface/border default to the --ui-field-* family)
|
|
10
12
|
* @see checkbox.ts: derives select-all group state (data-checkbox-controls)
|
|
@@ -24,6 +26,7 @@
|
|
|
24
26
|
--ui-checkbox-bg--checked: var(--color-primary);
|
|
25
27
|
--ui-checkbox-border-color--checked: var(--color-primary);
|
|
26
28
|
--ui-checkbox-radius: var(--radius-xs);
|
|
29
|
+
--ui-checkbox-corner-shape: var(--radius-corner-shape);
|
|
27
30
|
--ui-checkbox-glyph-size: 1em;
|
|
28
31
|
--ui-checkbox-checkmark-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' fill='none' stroke='currentColor' stroke-linecap='square' stroke-linejoin='square' stroke-width='3' viewBox='0 0 24 24'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
|
|
29
32
|
center / contain no-repeat;
|
|
@@ -53,6 +56,7 @@
|
|
|
53
56
|
border-radius: calc(
|
|
54
57
|
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
|
|
55
58
|
);
|
|
59
|
+
corner-shape: var(--_corner-shape-resolved, var(--ui-checkbox-corner-shape));
|
|
56
60
|
|
|
57
61
|
/* centres the ::before glyph */
|
|
58
62
|
display: inline-grid;
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* @layer variables, components
|
|
5
5
|
* @requires _layers.css, _variables.css, popover.css, button.css, fields.css,
|
|
6
6
|
* badge.css (--ui-badge-* for the default tag template [data-ui~="badge"]),
|
|
7
|
-
* select.css (--ui-option-*, --ui-select-picker-icon-*)
|
|
7
|
+
* select.css (--ui-option-*, --ui-select-picker-icon-*),
|
|
8
|
+
* menu.css (--ui-menu-shadow)
|
|
8
9
|
* @uses [popover="manual"]: panel opened/closed by combobox.ts
|
|
9
10
|
* @uses anchor-name, anchor-scope, position-anchor: tether panel to the control
|
|
10
11
|
* @uses anchor-size(width): match panel width to the control (Baseline 2026)
|
|
@@ -16,6 +17,8 @@
|
|
|
16
17
|
* <template data-combobox-slot="tag-template"> (or its muted-badge
|
|
17
18
|
* default) per option carrying aria-selected="true". Tag rules key
|
|
18
19
|
* off the slots, so a custom template keeps this styling.
|
|
20
|
+
* @uses corner-shape — superellipse corners; unsupported browsers keep plain
|
|
21
|
+
* rounded corners
|
|
19
22
|
* @tokens --ui-combobox-* (@layer variables); control mirrors --ui-select-*,
|
|
20
23
|
* items alias --ui-option-*, tags alias --ui-badge-*
|
|
21
24
|
* @see combobox.ts: filtering, commit/revert, tags, and keyboard behavior
|
|
@@ -33,6 +36,7 @@
|
|
|
33
36
|
--ui-combobox-border-style: var(--ui-select-border-style);
|
|
34
37
|
--ui-combobox-border-color: var(--ui-select-border-color);
|
|
35
38
|
--ui-combobox-radius: var(--ui-select-radius);
|
|
39
|
+
--ui-combobox-corner-shape: var(--ui-select-corner-shape);
|
|
36
40
|
--ui-combobox-icon-mask: var(--ui-select-picker-icon-mask);
|
|
37
41
|
--ui-combobox-icon-size: var(--ui-select-picker-icon-size);
|
|
38
42
|
--ui-combobox-icon-color: var(--ui-select-picker-icon-color);
|
|
@@ -59,6 +63,7 @@
|
|
|
59
63
|
--ui-combobox-tag-remove-size: var(--ui-badge-icon-size);
|
|
60
64
|
--ui-combobox-tag-remove-color: currentColor;
|
|
61
65
|
--ui-combobox-tag-remove-radius: var(--radius-sm);
|
|
66
|
+
--ui-combobox-tag-remove-corner-shape: var(--radius-corner-shape);
|
|
62
67
|
--ui-combobox-tag-remove-opacity: 0.65;
|
|
63
68
|
--ui-combobox-tag-remove-opacity--hover: 1;
|
|
64
69
|
}
|
|
@@ -123,6 +128,7 @@
|
|
|
123
128
|
border-radius: calc(
|
|
124
129
|
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
|
|
125
130
|
);
|
|
131
|
+
corner-shape: var(--_corner-shape-resolved, var(--ui-combobox-corner-shape));
|
|
126
132
|
|
|
127
133
|
/* Same ring recipe as [data-ui~="select"]: transparent outline twin keeps focus
|
|
128
134
|
visible in forced-colors mode */
|
|
@@ -320,6 +326,7 @@
|
|
|
320
326
|
inline-size: var(--ui-combobox-tag-remove-size);
|
|
321
327
|
block-size: var(--ui-combobox-tag-remove-size);
|
|
322
328
|
border-radius: var(--ui-combobox-tag-remove-radius);
|
|
329
|
+
corner-shape: var(--ui-combobox-tag-remove-corner-shape);
|
|
323
330
|
opacity: var(--ui-combobox-tag-remove-opacity);
|
|
324
331
|
cursor: pointer;
|
|
325
332
|
transition: var(--default-transition);
|
|
@@ -29,6 +29,11 @@
|
|
|
29
29
|
* this control is inert without its script (the hidden input still submits a
|
|
30
30
|
* server-set value, but no tags render).
|
|
31
31
|
*
|
|
32
|
+
* Scripts read and set the selection through the element's `value` property,
|
|
33
|
+
* which mirrors `<select>.value`: setting it moves the selection, the label,
|
|
34
|
+
* and the hidden input without focusing the input or dispatching `change`; an
|
|
35
|
+
* unknown value clears the selection.
|
|
36
|
+
*
|
|
32
37
|
* Attributes on the root: `data-combobox-variant="multiselect"`, `data-combobox-sort="score"`,
|
|
33
38
|
* `data-combobox-filter="none"` (another source filters; the engine only navigates),
|
|
34
39
|
* `data-combobox-min-length="<n>"`, `data-combobox-label-remove="Remove {label}"`.
|
|
@@ -95,6 +100,24 @@ declare class UiCombobox extends TypeaheadElement {
|
|
|
95
100
|
* @param item - The committed option.
|
|
96
101
|
*/
|
|
97
102
|
protected commit(item: HTMLElement, _source: "keyboard" | "pointer"): void;
|
|
103
|
+
/**
|
|
104
|
+
* @description The selected item's form value (`data-combobox-value`, or its
|
|
105
|
+
* label), like `<select>.value`; the empty string when nothing is selected.
|
|
106
|
+
* In the multiselect variant it is the first selected value.
|
|
107
|
+
*
|
|
108
|
+
* @returns The committed form value.
|
|
109
|
+
*/
|
|
110
|
+
get value(): string;
|
|
111
|
+
/**
|
|
112
|
+
* @description Selects the item carrying this form value, as a script sets
|
|
113
|
+
* `<select>.value`: the label, the hidden input, and `aria-selected` follow,
|
|
114
|
+
* but no `change` is dispatched and focus stays where it was. A value no
|
|
115
|
+
* row carries clears the selection; in the multiselect variant the value
|
|
116
|
+
* becomes the whole selection, as `<select multiple>.value` does.
|
|
117
|
+
*
|
|
118
|
+
* @param value - The form value to select.
|
|
119
|
+
*/
|
|
120
|
+
set value(value: string);
|
|
98
121
|
}
|
|
99
122
|
export { UiCombobox, resolveBlur, resolveRemoveLabel };
|
|
100
123
|
export type { BlurOutcome };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["combobox.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["combobox.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AA0B3D,2EAA2E;AAC3E,UAAU,WAAW;IACnB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,WAAW,CAI7F;AAED;;;;;;GAMG;AACH,iBAAS,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,cAAM,UAAW,SAAQ,gBAAgB;;IACvC,SAAS,CAAC,QAAQ,CAAC,UAAU,cAAc;IAC3C,gFAAgF;IAChF,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAS;IAOhD,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAgIzC;IAED,SAAS,CAAC,QAAQ,IAAI,IAAI,CAOzB;IAED;;;;;;OAMG;IACH,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAE7C;IAED;;;;OAIG;IACH,SAAS,CAAC,UAAU,IAAI,IAAI,CAK3B;IAED;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI,CA+BzE;IAwND;;;;;;OAMG;IACH,IAAI,KAAK,IAAI,MAAM,CAGlB;IAED;;;;;;;;OAQG;IACH,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAiBtB;CAqBF;AAID,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -30,6 +30,11 @@
|
|
|
30
30
|
* this control is inert without its script (the hidden input still submits a
|
|
31
31
|
* server-set value, but no tags render).
|
|
32
32
|
*
|
|
33
|
+
* Scripts read and set the selection through the element's `value` property,
|
|
34
|
+
* which mirrors `<select>.value`: setting it moves the selection, the label,
|
|
35
|
+
* and the hidden input without focusing the input or dispatching `change`; an
|
|
36
|
+
* unknown value clears the selection.
|
|
37
|
+
*
|
|
33
38
|
* Attributes on the root: `data-combobox-variant="multiselect"`, `data-combobox-sort="score"`,
|
|
34
39
|
* `data-combobox-filter="none"` (another source filters; the engine only navigates),
|
|
35
40
|
* `data-combobox-min-length="<n>"`, `data-combobox-label-remove="Remove {label}"`.
|
|
@@ -457,9 +462,11 @@ class UiCombobox extends TypeaheadElement {
|
|
|
457
462
|
/**
|
|
458
463
|
* @description Empties the committed state: label, hidden value, tags, and
|
|
459
464
|
* `aria-selected` all clear together.
|
|
465
|
+
*
|
|
466
|
+
* @param notify - Whether to dispatch `change` (a script setting `value` stays silent).
|
|
460
467
|
* @private
|
|
461
468
|
*/
|
|
462
|
-
#clearSelection() {
|
|
469
|
+
#clearSelection(notify = true) {
|
|
463
470
|
this.#committedLabel = "";
|
|
464
471
|
const multiselect = this.#multiselect();
|
|
465
472
|
for (const item of this.items()) {
|
|
@@ -468,7 +475,51 @@ class UiCombobox extends TypeaheadElement {
|
|
|
468
475
|
else
|
|
469
476
|
item.removeAttribute("aria-selected");
|
|
470
477
|
}
|
|
471
|
-
this
|
|
478
|
+
if (this.searchInput)
|
|
479
|
+
this.searchInput.value = "";
|
|
480
|
+
this.query.set("");
|
|
481
|
+
this.#syncSelection(notify);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* @description The selected item's form value (`data-combobox-value`, or its
|
|
485
|
+
* label), like `<select>.value`; the empty string when nothing is selected.
|
|
486
|
+
* In the multiselect variant it is the first selected value.
|
|
487
|
+
*
|
|
488
|
+
* @returns The committed form value.
|
|
489
|
+
*/
|
|
490
|
+
get value() {
|
|
491
|
+
const selected = this.#selectedItems()[0];
|
|
492
|
+
return selected ? this.#itemFormValue(selected) : "";
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* @description Selects the item carrying this form value, as a script sets
|
|
496
|
+
* `<select>.value`: the label, the hidden input, and `aria-selected` follow,
|
|
497
|
+
* but no `change` is dispatched and focus stays where it was. A value no
|
|
498
|
+
* row carries clears the selection; in the multiselect variant the value
|
|
499
|
+
* becomes the whole selection, as `<select multiple>.value` does.
|
|
500
|
+
*
|
|
501
|
+
* @param value - The form value to select.
|
|
502
|
+
*/
|
|
503
|
+
set value(value) {
|
|
504
|
+
const match = this.items().find((item) => this.#itemFormValue(item) === value);
|
|
505
|
+
if (!match) {
|
|
506
|
+
this.#clearSelection(false);
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
const multiselect = this.#multiselect();
|
|
510
|
+
for (const other of this.items()) {
|
|
511
|
+
if (multiselect)
|
|
512
|
+
other.setAttribute("aria-selected", "false");
|
|
513
|
+
else
|
|
514
|
+
other.removeAttribute("aria-selected");
|
|
515
|
+
}
|
|
516
|
+
match.setAttribute("aria-selected", "true");
|
|
517
|
+
this.#committedLabel = multiselect ? "" : this.itemValue(match);
|
|
518
|
+
const input = this.searchInput;
|
|
519
|
+
if (input)
|
|
520
|
+
input.value = this.#committedLabel;
|
|
521
|
+
this.query.set("");
|
|
522
|
+
this.#syncSelection(false);
|
|
472
523
|
}
|
|
473
524
|
/**
|
|
474
525
|
* @description Restores the selection the markup shipped with (form reset).
|
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
* this control is inert without its script (the hidden input still submits a
|
|
32
32
|
* server-set value, but no tags render).
|
|
33
33
|
*
|
|
34
|
+
* Scripts read and set the selection through the element's `value` property,
|
|
35
|
+
* which mirrors `<select>.value`: setting it moves the selection, the label,
|
|
36
|
+
* and the hidden input without focusing the input or dispatching `change`; an
|
|
37
|
+
* unknown value clears the selection.
|
|
38
|
+
*
|
|
34
39
|
* Attributes on the root: `data-combobox-variant="multiselect"`, `data-combobox-sort="score"`,
|
|
35
40
|
* `data-combobox-filter="none"` (another source filters; the engine only navigates),
|
|
36
41
|
* `data-combobox-min-length="<n>"`, `data-combobox-label-remove="Remove {label}"`.
|
|
@@ -513,16 +518,60 @@ class UiCombobox extends TypeaheadElement {
|
|
|
513
518
|
/**
|
|
514
519
|
* @description Empties the committed state: label, hidden value, tags, and
|
|
515
520
|
* `aria-selected` all clear together.
|
|
521
|
+
*
|
|
522
|
+
* @param notify - Whether to dispatch `change` (a script setting `value` stays silent).
|
|
516
523
|
* @private
|
|
517
524
|
*/
|
|
518
|
-
#clearSelection(): void {
|
|
525
|
+
#clearSelection(notify = true): void {
|
|
519
526
|
this.#committedLabel = "";
|
|
520
527
|
const multiselect = this.#multiselect();
|
|
521
528
|
for (const item of this.items()) {
|
|
522
529
|
if (multiselect) item.setAttribute("aria-selected", "false");
|
|
523
530
|
else item.removeAttribute("aria-selected");
|
|
524
531
|
}
|
|
525
|
-
this
|
|
532
|
+
if (this.searchInput) this.searchInput.value = "";
|
|
533
|
+
this.query.set("");
|
|
534
|
+
this.#syncSelection(notify);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* @description The selected item's form value (`data-combobox-value`, or its
|
|
539
|
+
* label), like `<select>.value`; the empty string when nothing is selected.
|
|
540
|
+
* In the multiselect variant it is the first selected value.
|
|
541
|
+
*
|
|
542
|
+
* @returns The committed form value.
|
|
543
|
+
*/
|
|
544
|
+
get value(): string {
|
|
545
|
+
const selected = this.#selectedItems()[0];
|
|
546
|
+
return selected ? this.#itemFormValue(selected) : "";
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* @description Selects the item carrying this form value, as a script sets
|
|
551
|
+
* `<select>.value`: the label, the hidden input, and `aria-selected` follow,
|
|
552
|
+
* but no `change` is dispatched and focus stays where it was. A value no
|
|
553
|
+
* row carries clears the selection; in the multiselect variant the value
|
|
554
|
+
* becomes the whole selection, as `<select multiple>.value` does.
|
|
555
|
+
*
|
|
556
|
+
* @param value - The form value to select.
|
|
557
|
+
*/
|
|
558
|
+
set value(value: string) {
|
|
559
|
+
const match = this.items().find((item) => this.#itemFormValue(item) === value);
|
|
560
|
+
if (!match) {
|
|
561
|
+
this.#clearSelection(false);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
const multiselect = this.#multiselect();
|
|
565
|
+
for (const other of this.items()) {
|
|
566
|
+
if (multiselect) other.setAttribute("aria-selected", "false");
|
|
567
|
+
else other.removeAttribute("aria-selected");
|
|
568
|
+
}
|
|
569
|
+
match.setAttribute("aria-selected", "true");
|
|
570
|
+
this.#committedLabel = multiselect ? "" : this.itemValue(match);
|
|
571
|
+
const input = this.searchInput;
|
|
572
|
+
if (input) input.value = this.#committedLabel;
|
|
573
|
+
this.query.set("");
|
|
574
|
+
this.#syncSelection(false);
|
|
526
575
|
}
|
|
527
576
|
|
|
528
577
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-actions.d.ts","sourceRoot":"","sources":["command-actions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;GAGG;AACH,iBAAS,kBAAkB,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"command-actions.d.ts","sourceRoot":"","sources":["command-actions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;GAGG;AACH,iBAAS,kBAAkB,IAAI,IAAI,CA4BlC;AAED;;;GAGG;AACH,iBAAS,wBAAwB,IAAI,IAAI,CAKxC;AAWD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -35,17 +35,12 @@ function initCommandActions() {
|
|
|
35
35
|
const command = event.command;
|
|
36
36
|
switch (command) {
|
|
37
37
|
case "--theme-toggle": {
|
|
38
|
-
//
|
|
38
|
+
// data-theme pins the scheme; without it the page follows the system
|
|
39
39
|
const root = document.documentElement;
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const dark = pinned
|
|
43
|
-
? pinned === "theme-dark"
|
|
40
|
+
const dark = root.dataset.theme
|
|
41
|
+
? root.dataset.theme === "dark"
|
|
44
42
|
: matchMedia("(prefers-color-scheme: dark)").matches;
|
|
45
|
-
root.dataset.
|
|
46
|
-
...tokens.filter((t) => !t.startsWith("theme-")),
|
|
47
|
-
dark ? "theme-light" : "theme-dark",
|
|
48
|
-
].join(" ");
|
|
43
|
+
root.dataset.theme = dark ? "light" : "dark";
|
|
49
44
|
break;
|
|
50
45
|
}
|
|
51
46
|
case "--copy-link":
|
|
@@ -38,17 +38,12 @@ function initCommandActions(): void {
|
|
|
38
38
|
const command = (event as CommandEvent).command;
|
|
39
39
|
switch (command) {
|
|
40
40
|
case "--theme-toggle": {
|
|
41
|
-
//
|
|
41
|
+
// data-theme pins the scheme; without it the page follows the system
|
|
42
42
|
const root = document.documentElement;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
const dark = pinned
|
|
46
|
-
? pinned === "theme-dark"
|
|
43
|
+
const dark = root.dataset.theme
|
|
44
|
+
? root.dataset.theme === "dark"
|
|
47
45
|
: matchMedia("(prefers-color-scheme: dark)").matches;
|
|
48
|
-
root.dataset.
|
|
49
|
-
...tokens.filter((t) => !t.startsWith("theme-")),
|
|
50
|
-
dark ? "theme-light" : "theme-dark",
|
|
51
|
-
].join(" ");
|
|
46
|
+
root.dataset.theme = dark ? "light" : "dark";
|
|
52
47
|
break;
|
|
53
48
|
}
|
|
54
49
|
case "--copy-link":
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** A stable name per finding, so a linter can switch each one off. */
|
|
2
|
-
export type RuleId = "unknown-utility" | "pseudo-form" | "group-needs-state" | "border-value" | "not-integer" | "tier-unsupported" | "tier-without-base" | "dual-value" | "keyword-number" | "raw-shadows-utility" | "flattens-state" | "gradient-incomplete" | "font-weight-name" | "scroll-state" | "whitespace-before-colon" | "whitespace-after-colon" | "attribute-outside-identity" | "field-id-or-name" | "persist";
|
|
2
|
+
export type RuleId = "unknown-utility" | "pseudo-form" | "group-needs-state" | "border-value" | "not-integer" | "tier-unsupported" | "tier-without-base" | "dual-value" | "keyword-number" | "raw-shadows-utility" | "flattens-state" | "gradient-incomplete" | "font-weight-name" | "scroll-state" | "whitespace-before-colon" | "whitespace-after-colon" | "attribute-outside-identity" | "retired-token" | "field-id-or-name" | "persist";
|
|
3
3
|
export declare const RULE_IDS: readonly RuleId[];
|
|
4
4
|
/** `[start, end)` offsets into the `style` attribute's value. */
|
|
5
5
|
export type Span = [number, number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-core.d.ts","sourceRoot":"","sources":["audit-core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audit-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AI,EAAE,OAAO,EACb,SAAS,EAAE,CAAC,EAAE,EACd,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,MAAM,EACvB,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,YAAY,GAAG,IAAI,EACvC,SAAS,GAAE,iBAAiB,GAAG,wBAA4C,GAC1E;IAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAA;CAAE,CAgD9C"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* where it can, the span of the declaration it is about (offsets into the
|
|
8
8
|
* `style` attribute) and a suggested rewrite.
|
|
9
9
|
*/
|
|
10
|
-
import { BORDER_SHORTHANDS, BOX_SHADOW_COMPOSITE, SHORTHAND_OF, DISPLAY_SHORTHANDS, GRADIENT_TYPES, UTILITIES, PSEUDO_ONLY, FONT_WEIGHT_NAMES, STUCK_STATE, STATES, parseUtilityName, tiersOf, } from "../../base/utilities.js";
|
|
10
|
+
import { BORDER_SHORTHANDS, BOX_SHADOW_COMPOSITE, SHORTHAND_OF, DISPLAY_PILE, RETIRED_TOKENS, DISPLAY_SHORTHANDS, GRADIENT_TYPES, UTILITIES, PSEUDO_ONLY, FONT_WEIGHT_NAMES, STUCK_STATE, STATES, parseUtilityName, tiersOf, } from "../../base/utilities.js";
|
|
11
11
|
export const RULE_IDS = [
|
|
12
12
|
"unknown-utility",
|
|
13
13
|
"pseudo-form",
|
|
@@ -26,6 +26,7 @@ export const RULE_IDS = [
|
|
|
26
26
|
"whitespace-before-colon",
|
|
27
27
|
"whitespace-after-colon",
|
|
28
28
|
"attribute-outside-identity",
|
|
29
|
+
"retired-token",
|
|
29
30
|
"field-id-or-name",
|
|
30
31
|
"persist",
|
|
31
32
|
];
|
|
@@ -47,7 +48,8 @@ const FUNCTION = /^(calc|clamp|min|max|var|env|round|mod|rem|abs|sign)\(/;
|
|
|
47
48
|
function gatedValue(utility, value) {
|
|
48
49
|
return ((utility.keywords ?? []).includes(value) ||
|
|
49
50
|
value in (utility.aliases ?? {}) ||
|
|
50
|
-
(utility.name === "display" && value in DISPLAY_SHORTHANDS) ||
|
|
51
|
+
(utility.name === "display" && (value in DISPLAY_SHORTHANDS || value === DISPLAY_PILE)) ||
|
|
52
|
+
(utility.emit === "text-wrap" && value === "truncate") ||
|
|
51
53
|
(utility.name === "bg" && value === "none") ||
|
|
52
54
|
(utility.name === "position" && value === "sticky"));
|
|
53
55
|
}
|
|
@@ -149,6 +151,18 @@ export function auditNode(node, context) {
|
|
|
149
151
|
bases.add((parsed.side ? `${parsed.side}-` : "") + parsed.name);
|
|
150
152
|
}
|
|
151
153
|
const tokens = (node.getAttribute("data-ui") ?? "").split(/\s+/).filter(Boolean);
|
|
154
|
+
for (const token of tokens) {
|
|
155
|
+
const replacement = RETIRED_TOKENS[token];
|
|
156
|
+
if (replacement) {
|
|
157
|
+
found.push({
|
|
158
|
+
rule: "retired-token",
|
|
159
|
+
message: `\`data-ui="${token}"\` is gone: \`data-ui\` holds identities only. Use ${replacement}.`,
|
|
160
|
+
attribute: "data-ui",
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const sticky = parsedPairs.some(([parsed, , declaration]) => parsed.name === STUCK_STATE.modifier ||
|
|
165
|
+
(parsed.name === "position" && declaration.value === "sticky"));
|
|
152
166
|
for (const [parsed, name, declaration] of parsedPairs) {
|
|
153
167
|
const { value, span } = declaration;
|
|
154
168
|
const warn = (rule, message, suggestion) => found.push({ rule, message, span, ...(suggestion ? { suggestion } : {}) });
|
|
@@ -197,6 +211,13 @@ export function auditNode(node, context) {
|
|
|
197
211
|
}
|
|
198
212
|
if (!parsed.side && gatedValue(utility, value))
|
|
199
213
|
spacing();
|
|
214
|
+
// only --container-type keeps the scroll-state type beside its own, and only
|
|
215
|
+
// beside a size type: the kit cannot read a part of a raw shorthand
|
|
216
|
+
if (sticky &&
|
|
217
|
+
(utility.name === "container" ||
|
|
218
|
+
(utility.name === "container-type" && /normal|scroll-state/.test(value)))) {
|
|
219
|
+
warn("scroll-state", `\`${name}: ${value}\` replaces this sticky element's container type, so its stuck state stops working. Use \`--container-name\` with \`--container-type: inline-size\`.`);
|
|
220
|
+
}
|
|
200
221
|
const baseName = (parsed.side ? `${parsed.side}-` : "") + utility.name;
|
|
201
222
|
if (parsed.group && parsed.tier === "stuck") {
|
|
202
223
|
warn("scroll-state", `\`${name}\` has no group form: the sticky container is the trigger, so write \`--${utility.name}--stuck\` inside it.`);
|
|
@@ -217,6 +238,9 @@ export function auditNode(node, context) {
|
|
|
217
238
|
warn("group-needs-state", `\`${name}\` needs a state tier: group utilities take \`--group-${utility.name}--<state>\`.`);
|
|
218
239
|
continue;
|
|
219
240
|
}
|
|
241
|
+
if (utility.emit === "divide" && value !== "none" && !isBorderValue(value, context.isColor)) {
|
|
242
|
+
warn("border-value", `\`${name}: ${value}\` is not one color, number, length, or \`none\`.`);
|
|
243
|
+
}
|
|
220
244
|
if (utility.emit === "border" && !isBorderValue(value, context.isColor)) {
|
|
221
245
|
warn("border-value", `\`${name}: ${value}\` is not one color, number, or length; it draws a 1px transparent border. Use \`--border: 2\`, \`--border: var(--color-primary)\`, or set \`--border-style\` separately.`);
|
|
222
246
|
}
|
|
@@ -255,6 +279,8 @@ export function auditNode(node, context) {
|
|
|
255
279
|
// element through another utility or a token, and are not checked here
|
|
256
280
|
const composite = BOX_SHADOW_COMPOSITE.includes(utility.name);
|
|
257
281
|
const feedsComposite = !composite && (utility.emit === "none" || utility.emit === "px");
|
|
282
|
+
// each of these declares its own property or resolves on its own gate
|
|
283
|
+
const standalone = utility.emit === "direct" || utility.emit === "divide";
|
|
258
284
|
// a tier alone works where the kit reads the utility through its own chain,
|
|
259
285
|
// or where the tier-only rule (`@layer defaults`) applies: a no-base utility
|
|
260
286
|
// whose property no kit rule above that layer sets on this element
|
|
@@ -266,7 +292,8 @@ export function auditNode(node, context) {
|
|
|
266
292
|
!bases.has(baseName) &&
|
|
267
293
|
!borderBase &&
|
|
268
294
|
!shorthandBase &&
|
|
269
|
-
!feedsComposite
|
|
295
|
+
!feedsComposite &&
|
|
296
|
+
!standalone) {
|
|
270
297
|
warn("tier-without-base", `\`${name}\` has no base \`--${baseName}\`; the tier only overrides a base.`);
|
|
271
298
|
}
|
|
272
299
|
continue;
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
BORDER_SHORTHANDS,
|
|
14
14
|
BOX_SHADOW_COMPOSITE,
|
|
15
15
|
SHORTHAND_OF,
|
|
16
|
+
DISPLAY_PILE,
|
|
17
|
+
RETIRED_TOKENS,
|
|
16
18
|
DISPLAY_SHORTHANDS,
|
|
17
19
|
GRADIENT_TYPES,
|
|
18
20
|
UTILITIES,
|
|
@@ -45,6 +47,7 @@ export type RuleId =
|
|
|
45
47
|
| "whitespace-before-colon"
|
|
46
48
|
| "whitespace-after-colon"
|
|
47
49
|
| "attribute-outside-identity"
|
|
50
|
+
| "retired-token"
|
|
48
51
|
| "field-id-or-name"
|
|
49
52
|
| "persist";
|
|
50
53
|
|
|
@@ -66,6 +69,7 @@ export const RULE_IDS: readonly RuleId[] = [
|
|
|
66
69
|
"whitespace-before-colon",
|
|
67
70
|
"whitespace-after-colon",
|
|
68
71
|
"attribute-outside-identity",
|
|
72
|
+
"retired-token",
|
|
69
73
|
"field-id-or-name",
|
|
70
74
|
"persist",
|
|
71
75
|
];
|
|
@@ -148,7 +152,8 @@ function gatedValue(utility: Utility, value: string): boolean {
|
|
|
148
152
|
return (
|
|
149
153
|
(utility.keywords ?? []).includes(value) ||
|
|
150
154
|
value in (utility.aliases ?? {}) ||
|
|
151
|
-
(utility.name === "display" && value in DISPLAY_SHORTHANDS) ||
|
|
155
|
+
(utility.name === "display" && (value in DISPLAY_SHORTHANDS || value === DISPLAY_PILE)) ||
|
|
156
|
+
(utility.emit === "text-wrap" && value === "truncate") ||
|
|
152
157
|
(utility.name === "bg" && value === "none") ||
|
|
153
158
|
(utility.name === "position" && value === "sticky")
|
|
154
159
|
);
|
|
@@ -266,6 +271,21 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
|
|
|
266
271
|
if (!parsed.tier) bases.add((parsed.side ? `${parsed.side}-` : "") + parsed.name);
|
|
267
272
|
}
|
|
268
273
|
const tokens = (node.getAttribute("data-ui") ?? "").split(/\s+/).filter(Boolean);
|
|
274
|
+
for (const token of tokens) {
|
|
275
|
+
const replacement = RETIRED_TOKENS[token];
|
|
276
|
+
if (replacement) {
|
|
277
|
+
found.push({
|
|
278
|
+
rule: "retired-token",
|
|
279
|
+
message: `\`data-ui="${token}"\` is gone: \`data-ui\` holds identities only. Use ${replacement}.`,
|
|
280
|
+
attribute: "data-ui",
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
const sticky = parsedPairs.some(
|
|
285
|
+
([parsed, , declaration]) =>
|
|
286
|
+
parsed.name === STUCK_STATE.modifier ||
|
|
287
|
+
(parsed.name === "position" && declaration.value === "sticky"),
|
|
288
|
+
);
|
|
269
289
|
for (const [parsed, name, declaration] of parsedPairs) {
|
|
270
290
|
const { value, span } = declaration;
|
|
271
291
|
const warn = (rule: RuleId, message: string, suggestion?: Suggestion) =>
|
|
@@ -326,6 +346,18 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
|
|
|
326
346
|
continue;
|
|
327
347
|
}
|
|
328
348
|
if (!parsed.side && gatedValue(utility, value)) spacing();
|
|
349
|
+
// only --container-type keeps the scroll-state type beside its own, and only
|
|
350
|
+
// beside a size type: the kit cannot read a part of a raw shorthand
|
|
351
|
+
if (
|
|
352
|
+
sticky &&
|
|
353
|
+
(utility.name === "container" ||
|
|
354
|
+
(utility.name === "container-type" && /normal|scroll-state/.test(value)))
|
|
355
|
+
) {
|
|
356
|
+
warn(
|
|
357
|
+
"scroll-state",
|
|
358
|
+
`\`${name}: ${value}\` replaces this sticky element's container type, so its stuck state stops working. Use \`--container-name\` with \`--container-type: inline-size\`.`,
|
|
359
|
+
);
|
|
360
|
+
}
|
|
329
361
|
const baseName = (parsed.side ? `${parsed.side}-` : "") + utility.name;
|
|
330
362
|
if (parsed.group && parsed.tier === "stuck") {
|
|
331
363
|
warn(
|
|
@@ -358,6 +390,9 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
|
|
|
358
390
|
);
|
|
359
391
|
continue;
|
|
360
392
|
}
|
|
393
|
+
if (utility.emit === "divide" && value !== "none" && !isBorderValue(value, context.isColor)) {
|
|
394
|
+
warn("border-value", `\`${name}: ${value}\` is not one color, number, length, or \`none\`.`);
|
|
395
|
+
}
|
|
361
396
|
if (utility.emit === "border" && !isBorderValue(value, context.isColor)) {
|
|
362
397
|
warn(
|
|
363
398
|
"border-value",
|
|
@@ -410,6 +445,8 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
|
|
|
410
445
|
// element through another utility or a token, and are not checked here
|
|
411
446
|
const composite = (BOX_SHADOW_COMPOSITE as readonly string[]).includes(utility.name);
|
|
412
447
|
const feedsComposite = !composite && (utility.emit === "none" || utility.emit === "px");
|
|
448
|
+
// each of these declares its own property or resolves on its own gate
|
|
449
|
+
const standalone = utility.emit === "direct" || utility.emit === "divide";
|
|
413
450
|
// a tier alone works where the kit reads the utility through its own chain,
|
|
414
451
|
// or where the tier-only rule (`@layer defaults`) applies: a no-base utility
|
|
415
452
|
// whose property no kit rule above that layer sets on this element
|
|
@@ -425,7 +462,8 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
|
|
|
425
462
|
!bases.has(baseName) &&
|
|
426
463
|
!borderBase &&
|
|
427
464
|
!shorthandBase &&
|
|
428
|
-
!feedsComposite
|
|
465
|
+
!feedsComposite &&
|
|
466
|
+
!standalone
|
|
429
467
|
) {
|
|
430
468
|
warn(
|
|
431
469
|
"tier-without-base",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["debug.ts"],"names":[],"mappings":"AAmBA,OAAO,EA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G,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACjC,mGAAmG;IACnG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AA+CD,8EAA8E;AAC9E,wBAAgB,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,EAAE,CAmB1E;AAED,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,GAAG;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;CAAE,CAyCtF;AAED,eAAO,MAAM,aAAa,8KACiJ,CAAC;AAI5K,cAAM,OAAQ,SAAQ,WAAW;IAC/B,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAmDzC;CACF;AAID,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -160,7 +160,10 @@ class UiDebug extends ZazzElement {
|
|
|
160
160
|
report();
|
|
161
161
|
});
|
|
162
162
|
});
|
|
163
|
-
|
|
163
|
+
// The root, not <body>: swap navigation replaces the whole <body>, and a
|
|
164
|
+
// persisted <ui-debug> would otherwise watch the old one. `report` reads
|
|
165
|
+
// `document.body` on each run, so it always audits the current page.
|
|
166
|
+
observer.observe(document.documentElement, {
|
|
164
167
|
attributes: true,
|
|
165
168
|
attributeFilter: ["style", "data-ui"],
|
|
166
169
|
childList: true,
|
|
@@ -204,7 +204,10 @@ class UiDebug extends ZazzElement {
|
|
|
204
204
|
report();
|
|
205
205
|
});
|
|
206
206
|
});
|
|
207
|
-
|
|
207
|
+
// The root, not <body>: swap navigation replaces the whole <body>, and a
|
|
208
|
+
// persisted <ui-debug> would otherwise watch the old one. `report` reads
|
|
209
|
+
// `document.body` on each run, so it always audits the current page.
|
|
210
|
+
observer.observe(document.documentElement, {
|
|
208
211
|
attributes: true,
|
|
209
212
|
attributeFilter: ["style", "data-ui"],
|
|
210
213
|
childList: true,
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
* is open (WebKit ignores overscroll-behavior on boxes that do not overflow)
|
|
10
10
|
* @uses @starting-style + allow-discrete — open/close opacity, transform, overlay
|
|
11
11
|
* @uses anchor-name, container-type — layout hooks for sized variants
|
|
12
|
-
* @
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* @uses corner-shape — superellipse corners; unsupported browsers keep plain
|
|
13
|
+
* rounded corners
|
|
14
|
+
* @tokens --ui-dialog-* (@layer variables; --ui-dialog-h defaults to a keyword, so the hook
|
|
15
|
+
* is read raw and takes a length or keyword; a --h utility or tier takes a scale
|
|
16
|
+
* number or a length; a keyword tier needs a base --h, or it renders as auto)
|
|
15
17
|
* @presets data-dialog-size="sm | md | lg | xl | 2xl | full | bleed" (the layout bands; sm when absent)
|
|
16
18
|
* @uses @media (width < 40rem) + @container style(--ui-dialog-mobile-size) — below the sm
|
|
17
19
|
* band every dialog takes the hook's size (layout-bleed by default) over its preset;
|
|
@@ -53,6 +55,7 @@
|
|
|
53
55
|
--ui-dialog-bg: var(--color-card);
|
|
54
56
|
--ui-dialog-text: var(--color-card-foreground);
|
|
55
57
|
--ui-dialog-radius: var(--radius-lg);
|
|
58
|
+
--ui-dialog-corner-shape: var(--radius-corner-shape);
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
|
|
@@ -140,6 +143,10 @@
|
|
|
140
143
|
inherits: false;
|
|
141
144
|
}
|
|
142
145
|
|
|
146
|
+
@property --_dialog-h-typed {
|
|
147
|
+
syntax: "*";
|
|
148
|
+
inherits: false;
|
|
149
|
+
}
|
|
143
150
|
@property --_dialog-h {
|
|
144
151
|
syntax: "*";
|
|
145
152
|
inherits: false;
|
|
@@ -165,7 +172,14 @@
|
|
|
165
172
|
--_w-len: var(--_w-resolved, var(--_dialog-w, var(--ui-dialog-w)));
|
|
166
173
|
--_w-num: var(--_w-resolved, var(--_dialog-w, var(--ui-dialog-w)));
|
|
167
174
|
inline-size: calc(var(--_w-len) + var(--_w-num) * var(--spacing));
|
|
168
|
-
|
|
175
|
+
/* The typed pair can't carry the hook's keyword. sign() adds nothing to the sum:
|
|
176
|
+
its var() leaves --_dialog-h-typed unset without a --h, so the chain reaches the hook */
|
|
177
|
+
--_h-len: var(--_h-resolved);
|
|
178
|
+
--_h-num: var(--_h-resolved);
|
|
179
|
+
--_dialog-h-typed: calc(
|
|
180
|
+
var(--_h-len) + var(--_h-num) * var(--spacing) + 0px * sign(var(--_h-resolved))
|
|
181
|
+
);
|
|
182
|
+
block-size: var(--_dialog-h-typed, var(--_dialog-h, var(--ui-dialog-h)));
|
|
169
183
|
background-color: var(--_bg-resolved, var(--ui-dialog-bg));
|
|
170
184
|
color: var(--_text-resolved, var(--ui-dialog-text));
|
|
171
185
|
box-shadow: var(--_shadow-resolved, var(--_dialog-shadow, var(--ui-dialog-shadow)));
|
|
@@ -174,6 +188,7 @@
|
|
|
174
188
|
border-radius: calc(
|
|
175
189
|
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
|
|
176
190
|
);
|
|
191
|
+
corner-shape: var(--_corner-shape-resolved, var(--ui-dialog-corner-shape));
|
|
177
192
|
|
|
178
193
|
anchor-name: --ui-dialog-root;
|
|
179
194
|
container-type: inline-size;
|