@zazz-ui/core 0.15.1 → 0.16.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 +29 -14
- package/CHANGELOG.md +156 -0
- package/README.md +6 -5
- package/dist/{csp-LRx1fynI.js → csp-C1f62vyT.js} +1 -1
- package/dist/sri.json +70 -65
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +74 -2
- package/editor/zazz.html-data.json +119 -79
- package/editor/zazz.language-data.json +401 -313
- package/editor/zazz.lint-data.json +1752 -1731
- package/package.json +2 -1
- package/src/base/_defaults.css +11 -11
- package/src/base/_reset.css +2 -10
- package/src/base/_typography.css +17 -568
- package/src/base/_utilities-box.css +17 -17
- package/src/base/_utilities-pseudo.css +2 -2
- package/src/base/_variables.css +142 -97
- package/src/base/carousel-scroll.d.ts +1 -1
- package/src/base/carousel-scroll.js +6 -6
- package/src/base/carousel-scroll.ts +6 -6
- package/src/base/carousel.d.ts.map +1 -1
- package/src/base/carousel.js +6 -2
- package/src/base/carousel.ts +6 -2
- package/src/base/csp.js +2 -2
- package/src/base/csp.ts +2 -2
- package/src/base/kit-styling.d.ts.map +1 -1
- package/src/base/kit-styling.js +186 -183
- package/src/base/kit-styling.ts +186 -183
- package/src/base/navigation.d.ts +2 -2
- package/src/base/navigation.d.ts.map +1 -1
- package/src/base/navigation.js +25 -21
- package/src/base/navigation.ts +27 -21
- package/src/base/utilities.d.ts +1 -1
- package/src/base/utilities.d.ts.map +1 -1
- package/src/base/utilities.js +20 -4
- package/src/base/utilities.ts +21 -5
- package/src/base/zazz-element.d.ts +1 -1
- package/src/base/zazz-element.js +1 -1
- package/src/base/zazz-element.ts +1 -1
- package/src/{base → behaviors}/gesture.d.ts +4 -3
- package/src/behaviors/gesture.d.ts.map +1 -0
- package/src/{base → behaviors}/gesture.js +1 -1
- package/src/{base → behaviors}/gesture.ts +5 -4
- package/src/{base → behaviors}/hotkeys.d.ts +2 -1
- package/src/behaviors/hotkeys.d.ts.map +1 -0
- package/src/{base → behaviors}/hotkeys.ts +2 -1
- package/src/behaviors/list-navigation.d.ts +64 -0
- package/src/behaviors/list-navigation.d.ts.map +1 -0
- package/src/behaviors/list-navigation.js +66 -0
- package/src/behaviors/list-navigation.ts +107 -0
- package/src/{base → behaviors}/typeahead.d.ts +3 -1
- package/src/behaviors/typeahead.d.ts.map +1 -0
- package/src/{base → behaviors}/typeahead.js +12 -17
- package/src/{base → behaviors}/typeahead.ts +12 -17
- package/src/css-properties.json +704 -0
- package/src/index.css +7 -0
- package/src/manifest.d.ts +20 -9
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +125 -37
- package/src/manifest.ts +132 -38
- package/src/primitives/accordion/accordion.json +49 -0
- package/src/primitives/alert-dialog/alert-dialog.json +35 -0
- package/src/primitives/autocomplete/autocomplete.d.ts +2 -2
- package/src/primitives/autocomplete/autocomplete.d.ts.map +1 -1
- package/src/primitives/autocomplete/autocomplete.js +2 -2
- package/src/primitives/autocomplete/autocomplete.json +65 -0
- package/src/primitives/autocomplete/autocomplete.ts +2 -2
- package/src/primitives/avatar/avatar.css +108 -0
- package/src/primitives/avatar/avatar.html +20 -74
- package/src/primitives/avatar/avatar.json +48 -0
- package/src/primitives/badge/badge.css +45 -10
- package/src/primitives/badge/badge.html +4 -0
- package/src/primitives/badge/badge.json +83 -0
- package/src/primitives/breadcrumbs/breadcrumbs.json +20 -0
- package/src/primitives/button/button.css +50 -66
- package/src/primitives/button/button.html +4 -0
- package/src/primitives/button/button.json +85 -0
- package/src/primitives/button-group/button-group.css +4 -15
- package/src/primitives/button-group/button-group.json +40 -0
- package/src/primitives/callout/callout.css +1 -1
- package/src/primitives/callout/callout.html +12 -12
- package/src/primitives/callout/callout.json +54 -0
- package/src/primitives/card/card-article.html +13 -37
- package/src/primitives/card/card-horizontal.html +11 -14
- package/src/primitives/card/card-login.html +4 -4
- package/src/primitives/card/card-product.html +3 -3
- package/src/primitives/card/card-subgrid.html +4 -4
- package/src/primitives/card/card.css +1 -1
- package/src/primitives/card/card.html +8 -8
- package/src/primitives/card/card.json +73 -0
- package/src/primitives/carousel/carousel.css +1 -1
- package/src/primitives/carousel/carousel.json +89 -0
- package/src/primitives/checkbox/checkbox.css +1 -2
- package/src/primitives/checkbox/checkbox.json +51 -0
- package/src/primitives/combobox/combobox.css +3 -2
- package/src/primitives/combobox/combobox.d.ts +2 -2
- package/src/primitives/combobox/combobox.d.ts.map +1 -1
- package/src/primitives/combobox/combobox.js +2 -2
- package/src/primitives/combobox/combobox.json +113 -0
- package/src/primitives/combobox/combobox.ts +2 -2
- package/src/primitives/command/command-actions.html +1 -1
- package/src/primitives/command/command.d.ts +4 -3
- package/src/primitives/command/command.d.ts.map +1 -1
- package/src/primitives/command/command.js +7 -6
- package/src/primitives/command/command.json +86 -0
- package/src/primitives/command/command.ts +7 -6
- package/src/primitives/debug/audit-core.d.ts +19 -12
- package/src/primitives/debug/audit-core.d.ts.map +1 -1
- package/src/primitives/debug/audit-core.js +78 -16
- package/src/primitives/debug/audit-core.ts +94 -22
- package/src/primitives/debug/debug.d.ts +6 -4
- package/src/primitives/debug/debug.d.ts.map +1 -1
- package/src/primitives/debug/debug.js +50 -21
- package/src/primitives/debug/debug.json +29 -0
- package/src/primitives/debug/debug.ts +57 -35
- package/src/primitives/dialog/dialog.css +1 -4
- package/src/primitives/dialog/dialog.json +78 -0
- package/src/primitives/drawer/drawer.css +4 -2
- package/src/primitives/drawer/drawer.d.ts.map +1 -1
- package/src/primitives/drawer/drawer.js +76 -4
- package/src/primitives/drawer/drawer.json +98 -0
- package/src/primitives/drawer/drawer.ts +78 -5
- package/src/primitives/fields/fields.css +11 -4
- package/src/primitives/fields/fields.json +92 -0
- package/src/primitives/font/font.css +188 -0
- package/src/primitives/font/font.html +14 -0
- package/src/primitives/font/font.json +39 -0
- package/src/primitives/group/group.json +25 -0
- package/src/primitives/input/input.css +1 -2
- package/src/primitives/input/input.json +56 -0
- package/src/primitives/input-group/input-group-password-group.html +1 -1
- package/src/primitives/input-group/input-group.css +32 -3
- package/src/primitives/input-group/input-group.html +5 -8
- package/src/primitives/input-group/input-group.json +69 -0
- package/src/primitives/kbd/kbd.css +1 -1
- package/src/primitives/kbd/kbd.json +52 -0
- package/src/primitives/layout/layout.json +45 -0
- package/src/primitives/lightbox/lightbox.css +4 -3
- package/src/primitives/lightbox/lightbox.html +2 -2
- package/src/primitives/lightbox/lightbox.js +1 -1
- package/src/primitives/lightbox/lightbox.json +87 -0
- package/src/primitives/lightbox/lightbox.ts +1 -1
- package/src/primitives/link/link.css +28 -0
- package/src/primitives/link/link.html +5 -0
- package/src/primitives/link/link.json +23 -0
- package/src/primitives/menu/menu.d.ts +3 -0
- package/src/primitives/menu/menu.d.ts.map +1 -1
- package/src/primitives/menu/menu.js +10 -25
- package/src/primitives/menu/menu.json +51 -0
- package/src/primitives/menu/menu.ts +10 -27
- package/src/primitives/menubar/menubar.json +23 -0
- package/src/primitives/meter/meter.css +24 -3
- package/src/primitives/meter/meter.json +41 -0
- package/src/primitives/mobile-menu/mobile-menu.html +1 -1
- package/src/primitives/mobile-menu/mobile-menu.json +64 -0
- package/src/primitives/navigation-menu/navigation-menu-featured.html +58 -58
- package/src/primitives/navigation-menu/navigation-menu-megamenu.html +6 -113
- package/src/primitives/navigation-menu/navigation-menu.css +11 -5
- package/src/primitives/navigation-menu/navigation-menu.html +1 -1
- package/src/primitives/navigation-menu/navigation-menu.json +82 -0
- package/src/primitives/otp/otp.css +1 -1
- package/src/primitives/otp/otp.d.ts +3 -3
- package/src/primitives/otp/otp.js +5 -5
- package/src/primitives/otp/otp.json +75 -0
- package/src/primitives/otp/otp.ts +5 -5
- package/src/primitives/password-group/password-group.css +32 -2
- package/src/primitives/password-group/password-group.html +1 -1
- package/src/primitives/password-group/password-group.json +74 -0
- package/src/primitives/popover/popover.css +1 -1
- package/src/primitives/popover/popover.json +64 -0
- package/src/primitives/progress/progress.css +25 -3
- package/src/primitives/progress/progress.json +41 -0
- package/src/primitives/prose/prose.css +341 -0
- package/src/primitives/prose/prose.html +11 -11
- package/src/primitives/prose/prose.json +47 -0
- package/src/primitives/radio/radio.css +1 -1
- package/src/primitives/radio/radio.json +48 -0
- package/src/primitives/reveal/reveal.json +72 -0
- package/src/primitives/scroll-fade/scroll-fade.css +0 -3
- package/src/primitives/scroll-fade/scroll-fade.json +34 -0
- package/src/primitives/select/select.css +2 -2
- package/src/primitives/select/select.json +119 -0
- package/src/primitives/separator/separator.json +34 -0
- package/src/primitives/slider/slider.css +87 -13
- package/src/primitives/slider/slider.json +49 -0
- package/src/primitives/style-guard/style-guard.js +1 -1
- package/src/primitives/style-guard/style-guard.json +22 -0
- package/src/primitives/style-guard/style-guard.ts +2 -2
- package/src/primitives/switch/switch.css +107 -18
- package/src/primitives/switch/switch.json +71 -0
- package/src/primitives/table/table.json +74 -0
- package/src/primitives/tabs/tabs.css +24 -12
- package/src/primitives/tabs/tabs.d.ts +4 -2
- package/src/primitives/tabs/tabs.d.ts.map +1 -1
- package/src/primitives/tabs/tabs.js +14 -24
- package/src/primitives/tabs/tabs.json +94 -0
- package/src/primitives/tabs/tabs.ts +14 -26
- package/src/primitives/textarea/textarea.css +1 -1
- package/src/primitives/textarea/textarea.json +48 -0
- package/src/primitives/toaster/toaster.d.ts.map +1 -1
- package/src/primitives/toaster/toaster.js +4 -4
- package/src/primitives/toaster/toaster.json +101 -0
- package/src/primitives/toaster/toaster.ts +5 -5
- package/src/primitives/toggle/toggle.css +2 -52
- package/src/primitives/toggle/toggle.json +84 -0
- package/src/primitives/toggle-group/toggle-group.css +1 -1
- package/src/primitives/toggle-group/toggle-group.json +41 -0
- package/src/primitives/toolbar/toolbar.json +26 -0
- package/src/primitives/tooltip/tooltip.css +1 -1
- package/src/primitives/tooltip/tooltip.json +85 -0
- package/src/primitives/utilities/aspect-ratio.html +3 -3
- package/src/primitives/utilities/basis.html +5 -5
- package/src/primitives/utilities/col-span.html +5 -5
- package/src/primitives/utilities/compose.html +3 -3
- package/src/primitives/utilities/flex-align.html +3 -3
- package/src/primitives/utilities/flex-direction.html +8 -8
- package/src/primitives/utilities/flex-grow.html +3 -3
- package/src/primitives/utilities/flex-reverse.html +8 -8
- package/src/primitives/utilities/gallery.html +19 -19
- package/src/primitives/utilities/gap.html +12 -12
- package/src/primitives/utilities/grid-cols.html +6 -6
- package/src/primitives/utilities/grid-responsive.html +9 -9
- package/src/primitives/utilities/inline-flex.html +2 -2
- package/src/primitives/utilities/margin-auto.html +1 -1
- package/src/primitives/utilities/object-fit.html +3 -3
- package/src/primitives/utilities/order.html +3 -3
- package/src/primitives/utilities/overflow.html +14 -14
- package/src/primitives/utilities/padding-compose.html +3 -3
- package/src/primitives/utilities/padding.html +4 -4
- package/src/primitives/utilities/position.html +1 -1
- package/src/primitives/utilities/responsive-flex.html +4 -4
- package/src/primitives/utilities/responsive-grid.html +9 -9
- package/src/primitives/utilities/size.html +5 -5
- package/src/primitives/utilities/subgrid-col.html +7 -7
- package/src/primitives/utilities/subgrid-row.html +9 -9
- package/src/primitives/utilities/subgrid.html +9 -9
- package/src/primitives/utilities/utilities.json +48 -0
- package/src/primitives/utilities/width.html +5 -5
- package/src/base/gesture.d.ts.map +0 -1
- package/src/base/hotkeys.d.ts.map +0 -1
- package/src/base/typeahead.d.ts.map +0 -1
- /package/src/{base → behaviors}/command-score.d.ts +0 -0
- /package/src/{base → behaviors}/command-score.d.ts.map +0 -0
- /package/src/{base → behaviors}/command-score.js +0 -0
- /package/src/{base → behaviors}/command-score.ts +0 -0
- /package/src/{base → behaviors}/hotkeys.js +0 -0
|
@@ -35,38 +35,65 @@ function auditNodeOf(el) {
|
|
|
35
35
|
}
|
|
36
36
|
const READS = expandStyling(KIT_SELECTORS, TIER_READS);
|
|
37
37
|
const BLOCKS = expandStyling(KIT_SELECTORS, TIER_BLOCKS);
|
|
38
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Identity tokens, typography roles, and state-bearing hooks, read from the
|
|
40
|
+
* page's stylesheets, `@import`ed ones included. `complete` is false when a
|
|
41
|
+
* sheet could not be read (cross-origin without `crossorigin`): what it
|
|
42
|
+
* declares is then unknown.
|
|
43
|
+
*/
|
|
39
44
|
function fromStylesheets() {
|
|
40
45
|
const identities = new Set();
|
|
46
|
+
const roles = new Set();
|
|
41
47
|
const hooks = {};
|
|
48
|
+
let complete = true;
|
|
42
49
|
const hookPattern = /--ui-([a-z]+(?:-[a-z]+)*?)-([a-z-]+?)--(hover|active|focus-visible|focus-within|checked|open|disabled)\b/g;
|
|
43
|
-
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
const read = (sheet) => {
|
|
52
|
+
if (!sheet || seen.has(sheet))
|
|
53
|
+
return;
|
|
54
|
+
seen.add(sheet);
|
|
44
55
|
let rules;
|
|
45
56
|
try {
|
|
46
57
|
rules = sheet.cssRules;
|
|
47
58
|
}
|
|
48
59
|
catch {
|
|
49
|
-
|
|
60
|
+
complete = false;
|
|
61
|
+
return;
|
|
50
62
|
}
|
|
51
63
|
for (const rule of rules) {
|
|
64
|
+
// an @import's text is only its own line; its rules are in the sheet it loads
|
|
65
|
+
if ("styleSheet" in rule) {
|
|
66
|
+
read(rule.styleSheet);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
52
69
|
const text = rule.cssText;
|
|
53
70
|
for (const m of text.matchAll(/\[data-ui~="([^"]+)"\]/g))
|
|
54
71
|
identities.add(m[1]);
|
|
72
|
+
for (const m of text.matchAll(/\[data-font="([^"]+)"\]/g))
|
|
73
|
+
roles.add(m[1]);
|
|
55
74
|
for (const m of text.matchAll(hookPattern)) {
|
|
56
75
|
const list = (hooks[m[1]] ??= []);
|
|
57
76
|
if (!list.includes(`${m[2]}--${m[3]}`))
|
|
58
77
|
list.push(`${m[2]}--${m[3]}`);
|
|
59
78
|
}
|
|
60
79
|
}
|
|
61
|
-
}
|
|
62
|
-
|
|
80
|
+
};
|
|
81
|
+
for (const sheet of document.styleSheets)
|
|
82
|
+
read(sheet);
|
|
83
|
+
return { identities: [...identities], roles: [...roles], hooks, complete };
|
|
63
84
|
}
|
|
64
85
|
/** Audits every element under `root` (inclusive) and returns the findings. */
|
|
65
86
|
export function audit(root, options = {}) {
|
|
66
|
-
const sheets = options.hooks && options.identities ? null : fromStylesheets();
|
|
87
|
+
const sheets = options.hooks && options.identities && options.roles !== undefined ? null : fromStylesheets();
|
|
67
88
|
const resolved = {
|
|
68
89
|
hooks: options.hooks ?? sheets.hooks,
|
|
69
90
|
identities: options.identities ?? sheets.identities,
|
|
91
|
+
// no role found and a sheet unread: font.css may be the one that was not read
|
|
92
|
+
roles: options.roles !== undefined
|
|
93
|
+
? options.roles
|
|
94
|
+
: sheets.roles.length || sheets.complete
|
|
95
|
+
? sheets.roles
|
|
96
|
+
: null,
|
|
70
97
|
};
|
|
71
98
|
const context = {
|
|
72
99
|
...resolved,
|
|
@@ -84,33 +111,35 @@ export function audit(root, options = {}) {
|
|
|
84
111
|
return found;
|
|
85
112
|
}
|
|
86
113
|
/**
|
|
87
|
-
* Calls out what survives an in-page navigation: on a `data-
|
|
88
|
-
* page, which `data-
|
|
89
|
-
* `data-
|
|
90
|
-
* persistence that cannot work as written.
|
|
114
|
+
* Calls out what survives an in-page navigation: on a `data-navigation="swap"`
|
|
115
|
+
* page, which `data-navigation-persist` elements are kept and which
|
|
116
|
+
* (`data-navigation-persist-mode="scroll"`) carry only their scroll offset;
|
|
117
|
+
* warnings for persistence that cannot work as written.
|
|
91
118
|
*/
|
|
92
119
|
export function navigationReport(doc) {
|
|
93
|
-
const swap = doc.documentElement.getAttribute("data-
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
120
|
+
const swap = doc.documentElement.getAttribute("data-navigation") === "swap";
|
|
121
|
+
const SCROLL = '[data-navigation-persist-mode="scroll"]';
|
|
122
|
+
const CARRIED = `[data-navigation-persist]:not(${SCROLL})`;
|
|
123
|
+
const idOf = (el) => el.getAttribute("data-navigation-persist") ?? "";
|
|
124
|
+
const owner = (el) => {
|
|
125
|
+
const around = el.parentElement?.closest(CARRIED);
|
|
126
|
+
return around ? idOf(around) : null;
|
|
127
|
+
};
|
|
128
|
+
const persisted = auditPersistence(swap, [...doc.querySelectorAll(CARRIED)], idOf, owner);
|
|
129
|
+
const scrolled = auditPersistence(swap, [...doc.querySelectorAll(SCROLL)], idOf, owner, "scroll");
|
|
101
130
|
const warnings = [...persisted.warnings, ...scrolled.warnings];
|
|
102
131
|
if (!swap)
|
|
103
132
|
return { notes: [], warnings };
|
|
104
133
|
const kept = persisted.kept;
|
|
105
|
-
const ids = (els
|
|
134
|
+
const ids = (els) => els.map((el) => `"${idOf(el)}"`).join(", ");
|
|
106
135
|
const one = scrolled.kept.length === 1;
|
|
107
136
|
const scroll = scrolled.kept.length
|
|
108
|
-
? ` ${scrolled.kept.length} element${one ? " comes" : "s come"} from the next page but keep${one ? "s its" : " their"} scroll offset (${ids(scrolled.kept
|
|
137
|
+
? ` ${scrolled.kept.length} element${one ? " comes" : "s come"} from the next page but keep${one ? "s its" : " their"} scroll offset (${ids(scrolled.kept)}).`
|
|
109
138
|
: "";
|
|
110
139
|
const notes = [
|
|
111
140
|
{
|
|
112
141
|
message: (kept.length
|
|
113
|
-
? `In-page navigation is on. ${kept.length} element${kept.length === 1 ? " persists" : "s persist"} across navigations (${ids(kept
|
|
142
|
+
? `In-page navigation is on. ${kept.length} element${kept.length === 1 ? " persists" : "s persist"} across navigations (${ids(kept)}); everything else is replaced by the next page.`
|
|
114
143
|
: "In-page navigation is on, and nothing persists: every navigation replaces the whole body.") +
|
|
115
144
|
scroll,
|
|
116
145
|
elements: [...kept, ...scrolled.kept],
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "debug",
|
|
3
|
+
"identities": [],
|
|
4
|
+
"tags": [
|
|
5
|
+
"ui-debug"
|
|
6
|
+
],
|
|
7
|
+
"hooks": {},
|
|
8
|
+
"attributes": {
|
|
9
|
+
"data-debug-domains": [],
|
|
10
|
+
"data-debug-warnings": [
|
|
11
|
+
"false"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"slots": {},
|
|
15
|
+
"states": {},
|
|
16
|
+
"requires": [],
|
|
17
|
+
"files": {
|
|
18
|
+
"css": [],
|
|
19
|
+
"js": [
|
|
20
|
+
"primitives/debug/audit-core.js",
|
|
21
|
+
"primitives/debug/debug.js"
|
|
22
|
+
],
|
|
23
|
+
"base": [
|
|
24
|
+
"base/kit-styling.js",
|
|
25
|
+
"base/utilities.js"
|
|
26
|
+
],
|
|
27
|
+
"examples": []
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -38,6 +38,8 @@ export interface AuditOptions {
|
|
|
38
38
|
hooks?: Record<string, string[]>;
|
|
39
39
|
/** Identity tokens the kit declares (`button`, `field-group`); default: the page's stylesheets. */
|
|
40
40
|
identities?: string[];
|
|
41
|
+
/** Typography roles the kit styles (the values of `data-font`), or `null` when unknown; default: the page's stylesheets. */
|
|
42
|
+
roles?: string[] | null;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/** A live element as the audit core reads it. */
|
|
@@ -60,37 +62,68 @@ function auditNodeOf(el: Element): AuditNode {
|
|
|
60
62
|
const READS = expandStyling(KIT_SELECTORS, TIER_READS);
|
|
61
63
|
const BLOCKS = expandStyling(KIT_SELECTORS, TIER_BLOCKS);
|
|
62
64
|
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Identity tokens, typography roles, and state-bearing hooks, read from the
|
|
67
|
+
* page's stylesheets, `@import`ed ones included. `complete` is false when a
|
|
68
|
+
* sheet could not be read (cross-origin without `crossorigin`): what it
|
|
69
|
+
* declares is then unknown.
|
|
70
|
+
*/
|
|
71
|
+
function fromStylesheets(): {
|
|
72
|
+
identities: string[];
|
|
73
|
+
roles: string[];
|
|
74
|
+
hooks: Record<string, string[]>;
|
|
75
|
+
complete: boolean;
|
|
76
|
+
} {
|
|
65
77
|
const identities = new Set<string>();
|
|
78
|
+
const roles = new Set<string>();
|
|
66
79
|
const hooks: Record<string, string[]> = {};
|
|
80
|
+
let complete = true;
|
|
67
81
|
const hookPattern =
|
|
68
82
|
/--ui-([a-z]+(?:-[a-z]+)*?)-([a-z-]+?)--(hover|active|focus-visible|focus-within|checked|open|disabled)\b/g;
|
|
69
|
-
|
|
83
|
+
const seen = new Set<CSSStyleSheet>();
|
|
84
|
+
const read = (sheet: CSSStyleSheet | null): void => {
|
|
85
|
+
if (!sheet || seen.has(sheet)) return;
|
|
86
|
+
seen.add(sheet);
|
|
70
87
|
let rules: CSSRuleList;
|
|
71
88
|
try {
|
|
72
89
|
rules = sheet.cssRules;
|
|
73
90
|
} catch {
|
|
74
|
-
|
|
91
|
+
complete = false;
|
|
92
|
+
return;
|
|
75
93
|
}
|
|
76
94
|
for (const rule of rules) {
|
|
95
|
+
// an @import's text is only its own line; its rules are in the sheet it loads
|
|
96
|
+
if ("styleSheet" in rule) {
|
|
97
|
+
read((rule as CSSImportRule).styleSheet);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
77
100
|
const text = rule.cssText;
|
|
78
101
|
for (const m of text.matchAll(/\[data-ui~="([^"]+)"\]/g)) identities.add(m[1]!);
|
|
102
|
+
for (const m of text.matchAll(/\[data-font="([^"]+)"\]/g)) roles.add(m[1]!);
|
|
79
103
|
for (const m of text.matchAll(hookPattern)) {
|
|
80
104
|
const list = (hooks[m[1]!] ??= []);
|
|
81
105
|
if (!list.includes(`${m[2]}--${m[3]}`)) list.push(`${m[2]}--${m[3]}`);
|
|
82
106
|
}
|
|
83
107
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
108
|
+
};
|
|
109
|
+
for (const sheet of document.styleSheets) read(sheet);
|
|
110
|
+
return { identities: [...identities], roles: [...roles], hooks, complete };
|
|
86
111
|
}
|
|
87
112
|
|
|
88
113
|
/** Audits every element under `root` (inclusive) and returns the findings. */
|
|
89
114
|
export function audit(root: Element, options: AuditOptions = {}): Warning[] {
|
|
90
|
-
const sheets =
|
|
115
|
+
const sheets =
|
|
116
|
+
options.hooks && options.identities && options.roles !== undefined ? null : fromStylesheets();
|
|
91
117
|
const resolved: Required<AuditOptions> = {
|
|
92
118
|
hooks: options.hooks ?? sheets!.hooks,
|
|
93
119
|
identities: options.identities ?? sheets!.identities,
|
|
120
|
+
// no role found and a sheet unread: font.css may be the one that was not read
|
|
121
|
+
roles:
|
|
122
|
+
options.roles !== undefined
|
|
123
|
+
? options.roles
|
|
124
|
+
: sheets!.roles.length || sheets!.complete
|
|
125
|
+
? sheets!.roles
|
|
126
|
+
: null,
|
|
94
127
|
};
|
|
95
128
|
const context = {
|
|
96
129
|
...resolved,
|
|
@@ -113,46 +146,35 @@ export interface Note {
|
|
|
113
146
|
}
|
|
114
147
|
|
|
115
148
|
/**
|
|
116
|
-
* Calls out what survives an in-page navigation: on a `data-
|
|
117
|
-
* page, which `data-
|
|
118
|
-
* `data-
|
|
119
|
-
* persistence that cannot work as written.
|
|
149
|
+
* Calls out what survives an in-page navigation: on a `data-navigation="swap"`
|
|
150
|
+
* page, which `data-navigation-persist` elements are kept and which
|
|
151
|
+
* (`data-navigation-persist-mode="scroll"`) carry only their scroll offset;
|
|
152
|
+
* warnings for persistence that cannot work as written.
|
|
120
153
|
*/
|
|
121
154
|
export function navigationReport(doc: Document): { notes: Note[]; warnings: Warning[] } {
|
|
122
|
-
const swap = doc.documentElement.getAttribute("data-
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
);
|
|
132
|
-
const scrolled = auditPersistence(
|
|
133
|
-
swap,
|
|
134
|
-
[...doc.querySelectorAll("[data-ui-persist-scroll]")],
|
|
135
|
-
idOf("data-ui-persist-scroll"),
|
|
136
|
-
(el) =>
|
|
137
|
-
el.hasAttribute("data-ui-persist")
|
|
138
|
-
? { id: persists(el), self: true }
|
|
139
|
-
: owner(el.closest("[data-ui-persist]")),
|
|
140
|
-
"data-ui-persist-scroll",
|
|
141
|
-
);
|
|
155
|
+
const swap = doc.documentElement.getAttribute("data-navigation") === "swap";
|
|
156
|
+
const SCROLL = '[data-navigation-persist-mode="scroll"]';
|
|
157
|
+
const CARRIED = `[data-navigation-persist]:not(${SCROLL})`;
|
|
158
|
+
const idOf = (el: Element) => el.getAttribute("data-navigation-persist") ?? "";
|
|
159
|
+
const owner = (el: Element) => {
|
|
160
|
+
const around = el.parentElement?.closest(CARRIED);
|
|
161
|
+
return around ? idOf(around) : null;
|
|
162
|
+
};
|
|
163
|
+
const persisted = auditPersistence(swap, [...doc.querySelectorAll(CARRIED)], idOf, owner);
|
|
164
|
+
const scrolled = auditPersistence(swap, [...doc.querySelectorAll(SCROLL)], idOf, owner, "scroll");
|
|
142
165
|
const warnings = [...persisted.warnings, ...scrolled.warnings];
|
|
143
166
|
if (!swap) return { notes: [], warnings };
|
|
144
167
|
const kept = persisted.kept;
|
|
145
|
-
const ids = (els: Element[]
|
|
146
|
-
els.map((el) => `"${el.getAttribute(attribute)}"`).join(", ");
|
|
168
|
+
const ids = (els: Element[]) => els.map((el) => `"${idOf(el)}"`).join(", ");
|
|
147
169
|
const one = scrolled.kept.length === 1;
|
|
148
170
|
const scroll = scrolled.kept.length
|
|
149
|
-
? ` ${scrolled.kept.length} element${one ? " comes" : "s come"} from the next page but keep${one ? "s its" : " their"} scroll offset (${ids(scrolled.kept
|
|
171
|
+
? ` ${scrolled.kept.length} element${one ? " comes" : "s come"} from the next page but keep${one ? "s its" : " their"} scroll offset (${ids(scrolled.kept)}).`
|
|
150
172
|
: "";
|
|
151
173
|
const notes: Note[] = [
|
|
152
174
|
{
|
|
153
175
|
message:
|
|
154
176
|
(kept.length
|
|
155
|
-
? `In-page navigation is on. ${kept.length} element${kept.length === 1 ? " persists" : "s persist"} across navigations (${ids(kept
|
|
177
|
+
? `In-page navigation is on. ${kept.length} element${kept.length === 1 ? " persists" : "s persist"} across navigations (${ids(kept)}); everything else is replaced by the next page.`
|
|
156
178
|
: "In-page navigation is on, and nothing persists: every navigation replaces the whole body.") +
|
|
157
179
|
scroll,
|
|
158
180
|
elements: [...kept, ...scrolled.kept],
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
--_radius-len: var(--_radius-resolved, var(--_dialog-radius, var(--ui-dialog-radius)));
|
|
199
199
|
--_radius-num: var(--_radius-resolved, var(--_dialog-radius, var(--ui-dialog-radius)));
|
|
200
200
|
border-radius: calc(
|
|
201
|
-
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-
|
|
201
|
+
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-coefficient)
|
|
202
202
|
);
|
|
203
203
|
corner-shape: var(--_corner-shape-resolved, var(--ui-dialog-corner-shape));
|
|
204
204
|
|
|
@@ -277,11 +277,8 @@
|
|
|
277
277
|
overscroll-behavior: contain;
|
|
278
278
|
overflow-y: auto;
|
|
279
279
|
|
|
280
|
-
-webkit-mask-image: var(--ui-scroll-fade-mask, var(--_scroll-fade-gradient));
|
|
281
280
|
mask-image: var(--ui-scroll-fade-mask, var(--_scroll-fade-gradient));
|
|
282
|
-
-webkit-mask-composite: source-in;
|
|
283
281
|
mask-composite: intersect;
|
|
284
|
-
-webkit-mask-repeat: no-repeat;
|
|
285
282
|
mask-repeat: no-repeat;
|
|
286
283
|
|
|
287
284
|
@supports (animation-timeline: scroll()) {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dialog",
|
|
3
|
+
"summary": "dialog.css — Dialog ([data-ui~=\"dialog\"] on native <dialog>; slots data-dialog-slot=\"content | header | body | footer | close\")",
|
|
4
|
+
"identities": [
|
|
5
|
+
"dialog"
|
|
6
|
+
],
|
|
7
|
+
"tags": [],
|
|
8
|
+
"hooks": {
|
|
9
|
+
"Box Model & Sizing": {
|
|
10
|
+
"--ui-dialog-h": "fit-content",
|
|
11
|
+
"--ui-dialog-mobile-size": "layout-bleed",
|
|
12
|
+
"--ui-dialog-w": "min(var(--layout-sm), 100% - var(--gutters) * 2)"
|
|
13
|
+
},
|
|
14
|
+
"Color & Backgrounds": {
|
|
15
|
+
"--ui-dialog-backdrop-color": "var(--color-shade-900)",
|
|
16
|
+
"--ui-dialog-bg": "var(--color-card)",
|
|
17
|
+
"--ui-dialog-text": "var(--color-card-foreground)"
|
|
18
|
+
},
|
|
19
|
+
"Borders & Outlines": {
|
|
20
|
+
"--ui-dialog-border-color": "var(--color-border)",
|
|
21
|
+
"--ui-dialog-border-style": "solid",
|
|
22
|
+
"--ui-dialog-border-width": "1px",
|
|
23
|
+
"--ui-dialog-corner-shape": "var(--radius-corner-shape)",
|
|
24
|
+
"--ui-dialog-radius": "var(--radius-lg)"
|
|
25
|
+
},
|
|
26
|
+
"Visual Effects": {
|
|
27
|
+
"--ui-dialog-backdrop-filter": "none",
|
|
28
|
+
"--ui-dialog-opacity--end": "1",
|
|
29
|
+
"--ui-dialog-opacity--start": "0",
|
|
30
|
+
"--ui-dialog-shadow": "var(--shadow-lg)"
|
|
31
|
+
},
|
|
32
|
+
"Transforms & Animation": {
|
|
33
|
+
"--ui-dialog-backdrop-transition-duration": "calc(var(--ui-dialog-transition-duration) / 2)",
|
|
34
|
+
"--ui-dialog-backdrop-transition-timing-function": "var(--bezier-easing)",
|
|
35
|
+
"--ui-dialog-scale--end": "1",
|
|
36
|
+
"--ui-dialog-scale--start": "0.98",
|
|
37
|
+
"--ui-dialog-transition-delay--end": "0ms",
|
|
38
|
+
"--ui-dialog-transition-delay--start": "0ms",
|
|
39
|
+
"--ui-dialog-transition-duration": "var(--default-transition-duration)",
|
|
40
|
+
"--ui-dialog-transition-timing-function": "var(--default-transition-timing-function)",
|
|
41
|
+
"--ui-dialog-translate--end": "0, 0, 0",
|
|
42
|
+
"--ui-dialog-translate--start": "0, 0, 0"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"attributes": {
|
|
46
|
+
"data-dialog-size": [
|
|
47
|
+
"2xl",
|
|
48
|
+
"bleed",
|
|
49
|
+
"full",
|
|
50
|
+
"lg",
|
|
51
|
+
"md",
|
|
52
|
+
"sm",
|
|
53
|
+
"xl"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"slots": {
|
|
57
|
+
"data-dialog-slot": [
|
|
58
|
+
"body",
|
|
59
|
+
"close",
|
|
60
|
+
"content",
|
|
61
|
+
"footer",
|
|
62
|
+
"header"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"states": {},
|
|
66
|
+
"requires": [],
|
|
67
|
+
"files": {
|
|
68
|
+
"css": [
|
|
69
|
+
"primitives/dialog/dialog.css"
|
|
70
|
+
],
|
|
71
|
+
"js": [],
|
|
72
|
+
"base": [],
|
|
73
|
+
"examples": [
|
|
74
|
+
"primitives/dialog/dialog.html",
|
|
75
|
+
"primitives/dialog/dialog-with-form.html"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -478,14 +478,16 @@
|
|
|
478
478
|
|
|
479
479
|
/* A corner piece: a square the size of the radius whose outer corner is rounded
|
|
480
480
|
and whose spread shadow, cut off at the square, paints only the notch outside
|
|
481
|
-
the curve. Scaling it from that corner is the radius growing.
|
|
481
|
+
the curve. Scaling it from that corner is the radius growing.
|
|
482
|
+
The two pieces are a mirrored pair on the screen's own corners, and each scales
|
|
483
|
+
from a physical transform-origin, so their sides stay physical. */
|
|
482
484
|
:where(ui-drawer-indent, [data-ui~="drawer-indent"])[data-drawer-indent-state~="on"]::before,
|
|
483
485
|
:where(ui-drawer-indent, [data-ui~="drawer-indent"])[data-drawer-indent-state~="on"]::after {
|
|
484
486
|
--_drawer-indent-amount: inherit;
|
|
485
487
|
--_drawer-indent-top: inherit;
|
|
486
488
|
content: "";
|
|
487
489
|
position: absolute;
|
|
488
|
-
z-index:
|
|
490
|
+
z-index: 999;
|
|
489
491
|
inset-block-start: var(--_drawer-indent-top, 0px);
|
|
490
492
|
inline-size: var(--ui-drawer-indent-radius);
|
|
491
493
|
block-size: var(--ui-drawer-indent-radius);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["drawer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["drawer.ts"],"names":[],"mappings":"AA8kBA;;;;GAIG;AACH,iBAAS,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAsPnD;AAmBD;;;;;GAKG;AACH,iBAAS,UAAU,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAElE;AAED,UAAU,aAAa;IACrB,IAAI,IAAI,CAAC;IACT,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,EAAE,aAmClB,CAAC;AAWF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* past its resting place meets resistance.
|
|
19
19
|
*
|
|
20
20
|
* A drag starts anywhere on the drawer except on form fields, selected text,
|
|
21
|
-
* and anything inside `[data-
|
|
21
|
+
* and anything inside `[data-draggable="false"]`. Inside scrolling content it starts
|
|
22
22
|
* only once that content is scrolled to the top and the pointer moves down,
|
|
23
23
|
* so the body scrolls first and the drawer follows; the handle
|
|
24
24
|
* (`data-drawer-slot="handle"`) always drags. There is no custom element and
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* height, a `px` or `rem` length is a visible height. It opens at the first.
|
|
30
30
|
* Letting go settles on the nearest; a flick moves one stop in its direction,
|
|
31
31
|
* a very fast one goes all the way (or one stop, with
|
|
32
|
-
* `data-drawer-snap-sequential`), and from the lowest stop a flick or enough
|
|
32
|
+
* `data-drawer-snap-behavior="sequential"`), and from the lowest stop a flick or enough
|
|
33
33
|
* travel downward closes the drawer. Below the largest stop the drawer takes
|
|
34
34
|
* every vertical drag and its content does not scroll. A click on the handle
|
|
35
35
|
* steps to the next stop; make the handle a `<button>` to give the keyboard
|
|
@@ -43,6 +43,13 @@
|
|
|
43
43
|
* edge (its surface runs on underneath), the focused field scrolls into what
|
|
44
44
|
* is still visible, and the page behind stays where it was. Nothing to author.
|
|
45
45
|
*
|
|
46
|
+
* On a touch screen a drawer does not raise the keyboard or a picker by
|
|
47
|
+
* opening: a dialog focuses its first control, and a text field focused while
|
|
48
|
+
* the drawer is still below the screen makes iOS push the page up to show it.
|
|
49
|
+
* A drawer that holds a text field, a select, or a date, time, or color input
|
|
50
|
+
* takes focus itself. Put `autofocus` on a field to focus it anyway; on iOS
|
|
51
|
+
* the page may then move as the drawer opens.
|
|
52
|
+
*
|
|
46
53
|
* **Stacked drawers.** A drawer opened over another scales the one behind back
|
|
47
54
|
* and lifts it, and that one follows as the front drawer is dragged. Nothing
|
|
48
55
|
* to author: the script counts the open drawers.
|
|
@@ -64,7 +71,7 @@
|
|
|
64
71
|
* </div>
|
|
65
72
|
* </dialog>
|
|
66
73
|
*/
|
|
67
|
-
import { currentTranslate, maxTransitionMs, pickSnap, rubberBand, trackDrag, } from "../../
|
|
74
|
+
import { currentTranslate, maxTransitionMs, pickSnap, rubberBand, trackDrag, } from "../../behaviors/gesture.js";
|
|
68
75
|
import { registerRefresh } from "../../base/zazz-element.js";
|
|
69
76
|
// --- Tuning ---
|
|
70
77
|
/** Share of the drawer's visible height, at its lowest stop, that dismisses on its own. */
|
|
@@ -474,6 +481,63 @@ function trackKeyboard(dialog, signal, alive, onChange) {
|
|
|
474
481
|
});
|
|
475
482
|
update();
|
|
476
483
|
}
|
|
484
|
+
/**
|
|
485
|
+
* @description Input types that open a picker when focused on a touch screen.
|
|
486
|
+
* @private
|
|
487
|
+
*/
|
|
488
|
+
const PICKER = /^(?:color|date|datetime-local|month|time|week)$/;
|
|
489
|
+
/**
|
|
490
|
+
* @description Whether focus on an element brings up the software keyboard or
|
|
491
|
+
* a picker on a touch screen.
|
|
492
|
+
*
|
|
493
|
+
* @param element - The element.
|
|
494
|
+
* @returns Whether it is a text field, a select, or a picker input.
|
|
495
|
+
* @private
|
|
496
|
+
*/
|
|
497
|
+
function summonsInput(element) {
|
|
498
|
+
if (element instanceof HTMLSelectElement)
|
|
499
|
+
return true;
|
|
500
|
+
if (element instanceof HTMLInputElement && PICKER.test(element.type))
|
|
501
|
+
return true;
|
|
502
|
+
return typesText(element);
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* @description Keeps a drawer that is about to open from focusing a field on
|
|
506
|
+
* a touch screen. `showModal()` focuses the dialog's first focusable control
|
|
507
|
+
* while the drawer is still below the screen; when that is a text field, iOS
|
|
508
|
+
* raises the keyboard and scrolls the page up to reveal it, so the page jumps
|
|
509
|
+
* before the drawer has risen. A drawer that holds a field has its children
|
|
510
|
+
* made inert while the dialog runs its focusing steps, so focus goes to the
|
|
511
|
+
* dialog, in every engine and without scrolling its content. They are
|
|
512
|
+
* released when focus lands, or on the next task if it never does. A drawer
|
|
513
|
+
* with a usable `autofocus` inside is left alone. Fields an author's own
|
|
514
|
+
* `beforetoggle` listener adds afterwards are not seen.
|
|
515
|
+
*
|
|
516
|
+
* @param dialog - The drawer about to open.
|
|
517
|
+
* @private
|
|
518
|
+
*/
|
|
519
|
+
function holdFocus(dialog) {
|
|
520
|
+
if (window.matchMedia("(hover: hover)").matches || !inDrawerMode(dialog))
|
|
521
|
+
return;
|
|
522
|
+
if (dialog.autofocus || dialog.querySelector("[autofocus]:not(:disabled)"))
|
|
523
|
+
return;
|
|
524
|
+
const fields = dialog.querySelectorAll("input, textarea, select, [contenteditable]");
|
|
525
|
+
if (![...fields].some((field) => summonsInput(field) && !field.closest("[inert]")))
|
|
526
|
+
return;
|
|
527
|
+
const held = [...dialog.children].filter((child) => child instanceof HTMLElement && !child.inert);
|
|
528
|
+
for (const child of held)
|
|
529
|
+
child.inert = true;
|
|
530
|
+
const release = () => {
|
|
531
|
+
window.clearTimeout(timer);
|
|
532
|
+
dialog.removeEventListener("focus", release, true);
|
|
533
|
+
for (const child of held)
|
|
534
|
+
child.inert = false;
|
|
535
|
+
};
|
|
536
|
+
// focus landing on the drawer ends it; the timer covers an open that was
|
|
537
|
+
// canceled, or a page without focus, where no focus event fires
|
|
538
|
+
dialog.addEventListener("focus", release, true);
|
|
539
|
+
const timer = window.setTimeout(release);
|
|
540
|
+
}
|
|
477
541
|
/** Open drawers and what unbinds or moves each. */
|
|
478
542
|
const bound = new WeakMap();
|
|
479
543
|
/** Each drawer's backdrop animation, kept past its close so the next open can drop it. */
|
|
@@ -711,7 +775,7 @@ function bindDrawer(dialog) {
|
|
|
711
775
|
closeRatio: CLOSE_RATIO,
|
|
712
776
|
flick: FLICK_VELOCITY,
|
|
713
777
|
fling: FLING_VELOCITY,
|
|
714
|
-
sequential: dialog.
|
|
778
|
+
sequential: dialog.getAttribute("data-drawer-snap-behavior") === "sequential",
|
|
715
779
|
});
|
|
716
780
|
// transitions back on: the inline translate now eases to wherever it is set
|
|
717
781
|
setDragging(dialog, false);
|
|
@@ -756,6 +820,14 @@ const initDrawers = function () {
|
|
|
756
820
|
if (initDrawers._bound)
|
|
757
821
|
return;
|
|
758
822
|
initDrawers._bound = true;
|
|
823
|
+
// beforetoggle does not bubble: caught on its way down, before the dialog focuses anything
|
|
824
|
+
document.addEventListener("beforetoggle", (event) => {
|
|
825
|
+
if (event.newState !== "open")
|
|
826
|
+
return;
|
|
827
|
+
if (event.target instanceof HTMLDialogElement && event.target.matches(DRAWER)) {
|
|
828
|
+
holdFocus(event.target);
|
|
829
|
+
}
|
|
830
|
+
}, true);
|
|
759
831
|
document.addEventListener("zazz:dialog-open", (event) => {
|
|
760
832
|
if (event.target instanceof HTMLDialogElement && event.target.matches(DRAWER)) {
|
|
761
833
|
bindDrawer(event.target);
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "drawer",
|
|
3
|
+
"summary": "drawer.css: Drawer ([data-ui~=\"drawer\"] on native <dialog>; slots data-drawer-slot=\"handle | content | header | body | footer | close\"; <ui-drawer-indent> / [data-ui~=\"drawer-indent\"], the page wrapper that scales back behind an open drawer) A bottom sheet: a modal dialog that rises from the bottom edge and is dragged back down to dismiss. Alone (`data-ui=\"drawer\"`) it is a drawer everywhere; on a dialog (`data-ui=\"dialog drawer\"`) it is a drawer below the sm band on a touch screen and the plain dialog otherwise. `data-drawer-snap` gives it resting heights; a drawer opened over another pushes that one back.",
|
|
4
|
+
"identities": [
|
|
5
|
+
"drawer",
|
|
6
|
+
"drawer-indent"
|
|
7
|
+
],
|
|
8
|
+
"tags": [
|
|
9
|
+
"ui-drawer-indent"
|
|
10
|
+
],
|
|
11
|
+
"hooks": {
|
|
12
|
+
"Layout & Positioning": {
|
|
13
|
+
"--ui-drawer-indent-inset": "calc(var(--spacing) * 3)"
|
|
14
|
+
},
|
|
15
|
+
"Box Model & Sizing": {
|
|
16
|
+
"--ui-drawer-handle-h": "calc(var(--spacing) * 1.25)",
|
|
17
|
+
"--ui-drawer-handle-w": "calc(var(--spacing) * 12)",
|
|
18
|
+
"--ui-drawer-max-h": "calc(100dvb - var(--space-lg))",
|
|
19
|
+
"--ui-drawer-w": "100%"
|
|
20
|
+
},
|
|
21
|
+
"Color & Backgrounds": {
|
|
22
|
+
"--ui-drawer-bg": "var(--ui-dialog-bg)",
|
|
23
|
+
"--ui-drawer-handle-bg": "var(--color-muted)",
|
|
24
|
+
"--ui-drawer-handle-bg--active": "var(--color-muted-foreground)",
|
|
25
|
+
"--ui-drawer-handle-bg--dragging": "var(--color-foreground)",
|
|
26
|
+
"--ui-drawer-handle-bg--hover": "var(--color-muted-foreground)",
|
|
27
|
+
"--ui-drawer-indent-backing": "var(--color-black)",
|
|
28
|
+
"--ui-drawer-indent-bg": "var(--color-background)",
|
|
29
|
+
"--ui-drawer-nested-backdrop-color": "transparent",
|
|
30
|
+
"--ui-drawer-text": "var(--ui-dialog-text)"
|
|
31
|
+
},
|
|
32
|
+
"Borders & Outlines": {
|
|
33
|
+
"--ui-drawer-corner-shape": "var(--ui-dialog-corner-shape)",
|
|
34
|
+
"--ui-drawer-indent-radius": "var(--ui-drawer-radius)",
|
|
35
|
+
"--ui-drawer-radius": "var(--radius-xl)"
|
|
36
|
+
},
|
|
37
|
+
"Visual Effects": {
|
|
38
|
+
"--ui-drawer-shadow": "var(--shadow-lg)"
|
|
39
|
+
},
|
|
40
|
+
"Transforms & Animation": {
|
|
41
|
+
"--ui-drawer-indent-offset": "calc(env(safe-area-inset-top, 0px) + var(--space-sm))",
|
|
42
|
+
"--ui-drawer-stack-lift": "var(--space-sm)",
|
|
43
|
+
"--ui-drawer-stack-scale": "0.05",
|
|
44
|
+
"--ui-drawer-transition-duration": "calc(var(--default-transition-duration) * 2)",
|
|
45
|
+
"--ui-drawer-transition-timing-function": "cubic-bezier(0.32, 0.72, 0, 1)"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"attributes": {
|
|
49
|
+
"data-drawer-snap": [],
|
|
50
|
+
"data-drawer-snap-behavior": []
|
|
51
|
+
},
|
|
52
|
+
"slots": {
|
|
53
|
+
"data-drawer-slot": [
|
|
54
|
+
"body",
|
|
55
|
+
"close",
|
|
56
|
+
"content",
|
|
57
|
+
"footer",
|
|
58
|
+
"handle",
|
|
59
|
+
"header"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"states": {
|
|
63
|
+
"data-drawer-indent-state": [
|
|
64
|
+
"active",
|
|
65
|
+
"dragging",
|
|
66
|
+
"on"
|
|
67
|
+
],
|
|
68
|
+
"data-drawer-state": [
|
|
69
|
+
"dragging",
|
|
70
|
+
"following",
|
|
71
|
+
"nested",
|
|
72
|
+
"partial",
|
|
73
|
+
"stacked"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"requires": [
|
|
77
|
+
"dialog",
|
|
78
|
+
"button"
|
|
79
|
+
],
|
|
80
|
+
"files": {
|
|
81
|
+
"css": [
|
|
82
|
+
"primitives/drawer/drawer.css"
|
|
83
|
+
],
|
|
84
|
+
"js": [
|
|
85
|
+
"primitives/drawer/drawer.js"
|
|
86
|
+
],
|
|
87
|
+
"base": [
|
|
88
|
+
"behaviors/gesture.js"
|
|
89
|
+
],
|
|
90
|
+
"examples": [
|
|
91
|
+
"primitives/drawer/drawer.html",
|
|
92
|
+
"primitives/drawer/drawer-responsive-dialog.html",
|
|
93
|
+
"primitives/drawer/drawer-snap.html",
|
|
94
|
+
"primitives/drawer/drawer-nested.html",
|
|
95
|
+
"primitives/drawer/drawer-indent.html"
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
}
|