@zazz-ui/core 0.6.3 → 0.8.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 -20
- package/CHANGELOG.md +158 -0
- package/README.md +4 -4
- package/dist/sri.json +86 -83
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +4491 -1484
- package/editor/zazz.html-data.json +15 -3
- package/editor/zazz.language-data.json +108 -106
- package/editor/zazz.lint-data.json +2356 -2
- package/package.json +1 -1
- package/src/base/_defaults.css +413 -0
- package/src/base/_layers.css +6 -2
- package/src/base/_properties-2xl.css +20 -2
- package/src/base/_properties-active.css +32 -0
- package/src/base/_properties-checked.css +32 -0
- package/src/base/_properties-current.css +32 -0
- package/src/base/_properties-disabled.css +32 -0
- package/src/base/_properties-focus-visible.css +32 -0
- package/src/base/_properties-focus-within.css +32 -0
- package/src/base/_properties-hover.css +32 -0
- package/src/base/_properties-lg.css +20 -2
- package/src/base/_properties-md.css +20 -2
- package/src/base/_properties-open.css +32 -0
- package/src/base/_properties-sm.css +20 -2
- package/src/base/_properties-starting.css +16 -0
- package/src/base/_properties-stuck.css +16 -0
- package/src/base/_properties-xl.css +20 -2
- package/src/base/_properties.css +58 -9
- package/src/base/_shadows.css +46 -0
- package/src/base/_utilities-box.css +181 -23
- package/src/base/_utilities-color.css +1 -3
- package/src/base/_utilities-effects.css +39 -152
- package/src/base/_utilities-flow.css +80 -68
- package/src/base/_utilities-grid.css +21 -32
- package/src/base/_utilities-margin.css +1 -0
- package/src/base/_utilities-pseudo.css +58 -4
- package/src/base/_utilities-sizing.css +1 -3
- package/src/base/_utilities-spacing.css +197 -34
- package/src/base/_utilities-tier-2xl.css +10 -1
- package/src/base/_utilities-tier-active.css +16 -0
- package/src/base/_utilities-tier-checked.css +16 -0
- package/src/base/_utilities-tier-current.css +16 -0
- package/src/base/_utilities-tier-disabled.css +16 -0
- package/src/base/_utilities-tier-focus-visible.css +16 -0
- package/src/base/_utilities-tier-focus-within.css +16 -0
- package/src/base/_utilities-tier-hover.css +16 -0
- package/src/base/_utilities-tier-lg.css +10 -1
- package/src/base/_utilities-tier-md.css +10 -1
- package/src/base/_utilities-tier-open.css +16 -0
- package/src/base/_utilities-tier-sm.css +10 -1
- package/src/base/_utilities-tier-starting.css +8 -0
- package/src/base/_utilities-tier-stuck.css +8 -0
- package/src/base/_utilities-tier-xl.css +10 -1
- package/src/base/_utilities-typography.css +1 -9
- package/src/base/_variables.css +5 -85
- package/src/base/kit-styling.d.ts +11 -0
- package/src/base/kit-styling.d.ts.map +1 -0
- package/src/base/kit-styling.js +504 -0
- package/src/base/kit-styling.ts +507 -0
- package/src/base/reveal.d.ts +3 -3
- package/src/base/reveal.d.ts.map +1 -1
- package/src/base/reveal.js +34 -18
- package/src/base/reveal.ts +42 -20
- package/src/base/utilities.d.ts +28 -10
- package/src/base/utilities.d.ts.map +1 -1
- package/src/base/utilities.js +172 -44
- package/src/base/utilities.ts +188 -54
- package/src/index.css +2 -0
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +3 -1
- package/src/manifest.ts +3 -1
- package/src/primitives/avatar/avatar.html +2 -2
- package/src/primitives/badge/badge.css +14 -10
- package/src/primitives/button/button.css +17 -13
- package/src/primitives/button-group/button-group.css +13 -6
- package/src/primitives/callout/callout.css +6 -2
- package/src/primitives/card/card-subgrid.html +3 -3
- package/src/primitives/card/card.css +8 -4
- package/src/primitives/card/card.html +2 -2
- package/src/primitives/carousel/carousel.html +12 -12
- package/src/primitives/checkbox/checkbox.css +6 -2
- package/src/primitives/combobox/combobox.css +8 -4
- package/src/primitives/debug/audit-core.d.ts +8 -0
- package/src/primitives/debug/audit-core.d.ts.map +1 -1
- package/src/primitives/debug/audit-core.js +30 -6
- package/src/primitives/debug/audit-core.ts +49 -5
- package/src/primitives/debug/debug.d.ts +0 -15
- package/src/primitives/debug/debug.d.ts.map +1 -1
- package/src/primitives/debug/debug.js +11 -2
- package/src/primitives/debug/debug.ts +12 -1
- package/src/primitives/dialog/dialog-with-form.html +1 -1
- package/src/primitives/dialog/dialog.css +35 -14
- package/src/primitives/fields/fields.css +8 -4
- package/src/primitives/input/input.css +6 -2
- package/src/primitives/input-group/input-group.css +5 -1
- package/src/primitives/kbd/kbd.css +6 -2
- package/src/primitives/layout/layout.html +1 -1
- package/src/primitives/lightbox/lightbox.css +12 -16
- package/src/primitives/lightbox/lightbox.html +1 -1
- package/src/primitives/menu/menu.css +3 -3
- package/src/primitives/meter/meter.css +6 -2
- package/src/primitives/mobile-menu/mobile-menu.css +2 -2
- package/src/primitives/mobile-menu/mobile-menu.html +1 -1
- package/src/primitives/navigation-menu/navigation-menu-featured.html +1 -1
- package/src/primitives/navigation-menu/navigation-menu.css +4 -4
- package/src/primitives/navigation-menu/navigation-menu.html +1 -1
- package/src/primitives/otp/otp.css +6 -2
- package/src/primitives/password-group/password-group.css +5 -1
- package/src/primitives/popover/popover.css +8 -4
- package/src/primitives/progress/progress.css +6 -2
- package/src/primitives/radio/radio.css +6 -2
- package/src/primitives/reveal/reveal.css +17 -11
- package/src/primitives/select/select.css +15 -7
- package/src/primitives/slider/slider.css +7 -7
- package/src/primitives/switch/switch.css +6 -2
- package/src/primitives/tabs/tabs.css +10 -6
- package/src/primitives/tabs/tabs.html +6 -6
- package/src/primitives/textarea/textarea.css +6 -2
- package/src/primitives/toaster/toaster.css +2 -2
- package/src/primitives/toggle/toggle.css +9 -5
- package/src/primitives/toggle-group/toggle-group.css +13 -6
- package/src/primitives/toolbar/toolbar.html +1 -1
- package/src/primitives/tooltip/tooltip.css +6 -2
- 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 +2 -2
- package/src/primitives/utilities/flex-align.html +3 -3
- package/src/primitives/utilities/flex-direction.html +6 -6
- package/src/primitives/utilities/flex-grow.html +3 -3
- package/src/primitives/utilities/gap.html +9 -9
- package/src/primitives/utilities/grid-cols.html +6 -6
- package/src/primitives/utilities/grid-responsive.html +8 -8
- package/src/primitives/utilities/margin-auto.html +3 -3
- package/src/primitives/utilities/object-fit.html +3 -3
- package/src/primitives/utilities/order.html +3 -3
- package/src/primitives/utilities/overflow.html +2 -2
- package/src/primitives/utilities/padding-compose.html +6 -6
- package/src/primitives/utilities/padding.html +8 -8
- package/src/primitives/utilities/pile.html +1 -1
- package/src/primitives/utilities/position.html +2 -2
- package/src/primitives/utilities/responsive-flex.html +3 -3
- package/src/primitives/utilities/responsive-grid.html +8 -8
- package/src/primitives/utilities/size.html +5 -5
- package/src/primitives/utilities/width.html +5 -5
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
--ui-button-gap: var(--spacing);
|
|
47
47
|
--ui-button-px: var(--ui-field-px);
|
|
48
48
|
--ui-button-min-h: var(--ui-field-h);
|
|
49
|
-
--ui-button-
|
|
49
|
+
--ui-button-radius: var(--ui-field-radius);
|
|
50
50
|
|
|
51
51
|
--ui-button-icon-size: var(--ui-field-icon-size);
|
|
52
52
|
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
inherits: false;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
@property --_button-
|
|
155
|
+
@property --_button-radius {
|
|
156
156
|
syntax: "*";
|
|
157
157
|
inherits: false;
|
|
158
158
|
}
|
|
@@ -210,7 +210,11 @@
|
|
|
210
210
|
--_border-color-resolved,
|
|
211
211
|
var(--_button-border-color, var(--ui-button-border-color))
|
|
212
212
|
);
|
|
213
|
-
|
|
213
|
+
--_radius-len: var(--_radius-resolved, var(--_button-radius, var(--ui-button-radius)));
|
|
214
|
+
--_radius-num: var(--_radius-resolved, var(--_button-radius, var(--ui-button-radius)));
|
|
215
|
+
border-radius: calc(
|
|
216
|
+
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
|
|
217
|
+
);
|
|
214
218
|
|
|
215
219
|
color: var(--_text-resolved, var(--_button-text, var(--ui-button-text)));
|
|
216
220
|
background-color: var(--_bg-resolved, var(--_button-bg, var(--ui-button-bg)));
|
|
@@ -333,8 +337,8 @@
|
|
|
333
337
|
|
|
334
338
|
:where([data-ui~="button"][data-button-variant="primary"]) {
|
|
335
339
|
--_button-bg: var(--color-primary);
|
|
336
|
-
--_button-bg--hover: oklch(from var(--color-primary) l c h / 0.
|
|
337
|
-
--_button-bg--active: oklch(from var(--color-primary) l c h / 0.
|
|
340
|
+
--_button-bg--hover: oklch(from var(--color-primary) l c h / 0.8);
|
|
341
|
+
--_button-bg--active: oklch(from var(--color-primary) l c h / 0.7);
|
|
338
342
|
|
|
339
343
|
--_button-text: var(--color-primary-foreground);
|
|
340
344
|
--_button-text--hover: var(--color-primary-foreground);
|
|
@@ -349,8 +353,8 @@
|
|
|
349
353
|
|
|
350
354
|
:where([data-ui~="button"][data-button-variant="secondary"]) {
|
|
351
355
|
--_button-bg: var(--color-secondary);
|
|
352
|
-
--_button-bg--hover: oklch(from var(--color-secondary) l c h / 0.
|
|
353
|
-
--_button-bg--active: oklch(from var(--color-secondary) l c h / 0.
|
|
356
|
+
--_button-bg--hover: oklch(from var(--color-secondary) l c h / 0.8);
|
|
357
|
+
--_button-bg--active: oklch(from var(--color-secondary) l c h / 0.7);
|
|
354
358
|
|
|
355
359
|
--_button-text: var(--color-secondary-foreground);
|
|
356
360
|
--_button-text--hover: var(--color-secondary-foreground);
|
|
@@ -365,8 +369,8 @@
|
|
|
365
369
|
|
|
366
370
|
:where([data-ui~="button"][data-button-variant="tertiary"]) {
|
|
367
371
|
--_button-bg: var(--color-tertiary);
|
|
368
|
-
--_button-bg--hover: oklch(from var(--color-tertiary) l c h / 0.
|
|
369
|
-
--_button-bg--active: oklch(from var(--color-tertiary) l c h / 0.
|
|
372
|
+
--_button-bg--hover: oklch(from var(--color-tertiary) l c h / 0.8);
|
|
373
|
+
--_button-bg--active: oklch(from var(--color-tertiary) l c h / 0.7);
|
|
370
374
|
|
|
371
375
|
--_button-text: var(--color-tertiary-foreground);
|
|
372
376
|
--_button-text--hover: var(--color-tertiary-foreground);
|
|
@@ -499,7 +503,7 @@
|
|
|
499
503
|
|
|
500
504
|
--_button-min-h: 0;
|
|
501
505
|
--_button-px: 0;
|
|
502
|
-
--_button-
|
|
506
|
+
--_button-radius: 0;
|
|
503
507
|
|
|
504
508
|
--_button-shadow: 0 0 transparent;
|
|
505
509
|
}
|
|
@@ -511,14 +515,14 @@
|
|
|
511
515
|
:where([data-ui~="button"][data-button-size="sm"]) {
|
|
512
516
|
--_button-min-h: calc(var(--spacing) * 6);
|
|
513
517
|
--_button-px: calc(var(--spacing) * 2);
|
|
514
|
-
--_button-
|
|
518
|
+
--_button-radius: var(--radius-sm);
|
|
515
519
|
--_button-font-size: var(--font-size-xs);
|
|
516
520
|
}
|
|
517
521
|
|
|
518
522
|
:where(
|
|
519
523
|
:is(ui-button-group, [data-ui~="button-group"]):has([data-ui~="button"][data-button-size="sm"])
|
|
520
524
|
) {
|
|
521
|
-
--_button-group-
|
|
525
|
+
--_button-group-radius: var(--radius-sm);
|
|
522
526
|
}
|
|
523
527
|
|
|
524
528
|
:where([data-ui~="button"][data-button-size="icon"]) {
|
|
@@ -531,7 +535,7 @@
|
|
|
531
535
|
:where([data-ui~="button"][data-button-size="icon-sm"]) {
|
|
532
536
|
--_button-min-h: calc(var(--spacing) * 6);
|
|
533
537
|
--_button-px: calc(var(--spacing) * 2);
|
|
534
|
-
--_button-
|
|
538
|
+
--_button-radius: var(--radius-sm);
|
|
535
539
|
/* the hook, not a private: it must inherit to reach the icon */
|
|
536
540
|
--ui-button-icon-size: calc(var(--spacing) * 3.5);
|
|
537
541
|
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
@layer variables {
|
|
13
13
|
:root {
|
|
14
|
-
--ui-button-group-
|
|
14
|
+
--ui-button-group-radius: var(--ui-button-radius);
|
|
15
15
|
--ui-button-group-bg: var(--color-card);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
@property --_button-group-
|
|
19
|
+
@property --_button-group-radius {
|
|
20
20
|
syntax: "*";
|
|
21
21
|
inherits: false;
|
|
22
22
|
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
BUTTON GROUP
|
|
32
32
|
|
|
33
33
|
Joins adjacent controls (buttons, and any child it wraps) into a single
|
|
34
|
-
segmented unit. Children keep their own --ui-button-
|
|
34
|
+
segmented unit. Children keep their own --ui-button-radius, so the outer corners
|
|
35
35
|
follow the buttons' size preset automatically; only the *inner* corners are
|
|
36
36
|
squared off and the doubled border is collapsed by dropping
|
|
37
37
|
each later control's leading border (no overlap).
|
|
@@ -42,9 +42,16 @@
|
|
|
42
42
|
inline-size: fit-content;
|
|
43
43
|
/* stretch so mixed-height children share one edge */
|
|
44
44
|
align-items: stretch;
|
|
45
|
-
|
|
46
|
-
--
|
|
47
|
-
var(--_button-group-
|
|
45
|
+
--_radius-len: var(
|
|
46
|
+
--_radius-resolved,
|
|
47
|
+
var(--_button-group-radius, var(--ui-button-group-radius))
|
|
48
|
+
);
|
|
49
|
+
--_radius-num: var(
|
|
50
|
+
--_radius-resolved,
|
|
51
|
+
var(--_button-group-radius, var(--ui-button-group-radius))
|
|
52
|
+
);
|
|
53
|
+
border-radius: calc(
|
|
54
|
+
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
|
|
48
55
|
);
|
|
49
56
|
background-color: var(--_bg-resolved, var(--_button-group-bg, var(--ui-button-group-bg)));
|
|
50
57
|
position: relative;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
:root {
|
|
27
27
|
--ui-callout-bg: var(--color-card);
|
|
28
28
|
--ui-callout-text: var(--color-card-foreground);
|
|
29
|
-
--ui-callout-
|
|
29
|
+
--ui-callout-radius: var(--radius-md);
|
|
30
30
|
--ui-callout-shadow: none;
|
|
31
31
|
|
|
32
32
|
--ui-callout-border-width: 1px;
|
|
@@ -72,7 +72,11 @@
|
|
|
72
72
|
--_border-color-resolved,
|
|
73
73
|
var(--_callout-border-color, var(--ui-callout-border-color))
|
|
74
74
|
);
|
|
75
|
-
|
|
75
|
+
--_radius-len: var(--_radius-resolved, var(--ui-callout-radius));
|
|
76
|
+
--_radius-num: var(--_radius-resolved, var(--ui-callout-radius));
|
|
77
|
+
border-radius: calc(
|
|
78
|
+
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
|
|
79
|
+
);
|
|
76
80
|
box-shadow: var(--_shadow-resolved, var(--ui-callout-shadow));
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
--row-span: 1;
|
|
29
29
|
--template-rows: subgrid;
|
|
30
30
|
--aspect: 3 / 2;
|
|
31
|
-
--
|
|
31
|
+
--radius-t: 2.5;
|
|
32
32
|
--overflow: clip;
|
|
33
33
|
"
|
|
34
34
|
>
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
--size: 11;
|
|
129
129
|
--border-color: var(--color-border);
|
|
130
130
|
--border-width: 1px;
|
|
131
|
-
--
|
|
131
|
+
--radius: full;
|
|
132
132
|
--overflow: clip;
|
|
133
133
|
"
|
|
134
134
|
>
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
--row-span: 1;
|
|
216
216
|
--template-rows: subgrid;
|
|
217
217
|
--aspect: 3 / 2;
|
|
218
|
-
--
|
|
218
|
+
--radius-t: 2.5;
|
|
219
219
|
--overflow: clip;
|
|
220
220
|
"
|
|
221
221
|
>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
/* a bare card has no surface; the outline and floating variants paint --color-card */
|
|
22
22
|
--ui-card-bg: transparent;
|
|
23
23
|
--ui-card-text: var(--color-card-foreground);
|
|
24
|
-
--ui-card-
|
|
24
|
+
--ui-card-radius: var(--radius-lg);
|
|
25
25
|
--ui-card-shadow: none;
|
|
26
26
|
|
|
27
27
|
--ui-card-border-width: 1px;
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
inherits: false;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
@property --_card-
|
|
63
|
+
@property --_card-radius {
|
|
64
64
|
syntax: "*";
|
|
65
65
|
inherits: false;
|
|
66
66
|
}
|
|
@@ -90,7 +90,11 @@
|
|
|
90
90
|
--_border-color-resolved,
|
|
91
91
|
var(--_card-border-color, var(--ui-card-border-color))
|
|
92
92
|
);
|
|
93
|
-
|
|
93
|
+
--_radius-len: var(--_radius-resolved, var(--_card-radius, var(--ui-card-radius)));
|
|
94
|
+
--_radius-num: var(--_radius-resolved, var(--_card-radius, var(--ui-card-radius)));
|
|
95
|
+
border-radius: calc(
|
|
96
|
+
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
|
|
97
|
+
);
|
|
94
98
|
box-shadow: var(--_shadow-resolved, var(--_card-shadow, var(--ui-card-shadow)));
|
|
95
99
|
overflow: clip;
|
|
96
100
|
transition: var(--default-transition);
|
|
@@ -101,7 +105,7 @@
|
|
|
101
105
|
=========================================================================== */
|
|
102
106
|
|
|
103
107
|
:where([data-ui~="card"]:not([data-card-variant])) {
|
|
104
|
-
--_card-
|
|
108
|
+
--_card-radius: 0;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
:where([data-ui~="card"][data-card-variant="outline"]) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
style="
|
|
11
11
|
--display: grid;
|
|
12
12
|
--aspect: 3 / 2;
|
|
13
|
-
--
|
|
13
|
+
--radius-t: 2.5;
|
|
14
14
|
--overflow: clip;
|
|
15
15
|
"
|
|
16
16
|
>
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
--size: 11;
|
|
109
109
|
--border-color: var(--color-border);
|
|
110
110
|
--border-width: 1px;
|
|
111
|
-
--
|
|
111
|
+
--radius: full;
|
|
112
112
|
--overflow: clip;
|
|
113
113
|
"
|
|
114
114
|
>
|
|
@@ -97,15 +97,15 @@
|
|
|
97
97
|
--gap: 4;
|
|
98
98
|
--text: var(--color-card-foreground);
|
|
99
99
|
--bg: var(--color-card);
|
|
100
|
-
--shadow: sm;
|
|
101
|
-
--
|
|
100
|
+
--shadow: var(--shadow-sm);
|
|
101
|
+
--radius: 2.5;
|
|
102
102
|
--overflow: clip;
|
|
103
103
|
"
|
|
104
104
|
>
|
|
105
105
|
<figure
|
|
106
106
|
style="
|
|
107
107
|
--aspect: 3 / 2;
|
|
108
|
-
--
|
|
108
|
+
--radius-t: 2.5;
|
|
109
109
|
--overflow: clip;
|
|
110
110
|
"
|
|
111
111
|
>
|
|
@@ -239,15 +239,15 @@
|
|
|
239
239
|
--gap: 4;
|
|
240
240
|
--text: var(--color-card-foreground);
|
|
241
241
|
--bg: var(--color-card);
|
|
242
|
-
--shadow: sm;
|
|
243
|
-
--
|
|
242
|
+
--shadow: var(--shadow-sm);
|
|
243
|
+
--radius: 2.5;
|
|
244
244
|
--overflow: clip;
|
|
245
245
|
"
|
|
246
246
|
>
|
|
247
247
|
<figure
|
|
248
248
|
style="
|
|
249
249
|
--aspect: 3 / 2;
|
|
250
|
-
--
|
|
250
|
+
--radius-t: 2.5;
|
|
251
251
|
--overflow: clip;
|
|
252
252
|
"
|
|
253
253
|
>
|
|
@@ -381,15 +381,15 @@
|
|
|
381
381
|
--gap: 4;
|
|
382
382
|
--text: var(--color-card-foreground);
|
|
383
383
|
--bg: var(--color-card);
|
|
384
|
-
--shadow: sm;
|
|
385
|
-
--
|
|
384
|
+
--shadow: var(--shadow-sm);
|
|
385
|
+
--radius: 2.5;
|
|
386
386
|
--overflow: clip;
|
|
387
387
|
"
|
|
388
388
|
>
|
|
389
389
|
<figure
|
|
390
390
|
style="
|
|
391
391
|
--aspect: 3 / 2;
|
|
392
|
-
--
|
|
392
|
+
--radius-t: 2.5;
|
|
393
393
|
--overflow: clip;
|
|
394
394
|
"
|
|
395
395
|
>
|
|
@@ -523,15 +523,15 @@
|
|
|
523
523
|
--gap: 4;
|
|
524
524
|
--text: var(--color-card-foreground);
|
|
525
525
|
--bg: var(--color-card);
|
|
526
|
-
--shadow: sm;
|
|
527
|
-
--
|
|
526
|
+
--shadow: var(--shadow-sm);
|
|
527
|
+
--radius: 2.5;
|
|
528
528
|
--overflow: clip;
|
|
529
529
|
"
|
|
530
530
|
>
|
|
531
531
|
<figure
|
|
532
532
|
style="
|
|
533
533
|
--aspect: 3 / 2;
|
|
534
|
-
--
|
|
534
|
+
--radius-t: 2.5;
|
|
535
535
|
--overflow: clip;
|
|
536
536
|
"
|
|
537
537
|
>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
--ui-checkbox-border-color--hover: var(--ui-field-border-color--hover);
|
|
24
24
|
--ui-checkbox-bg--checked: var(--color-primary);
|
|
25
25
|
--ui-checkbox-border-color--checked: var(--color-primary);
|
|
26
|
-
--ui-checkbox-
|
|
26
|
+
--ui-checkbox-radius: var(--radius-xs);
|
|
27
27
|
--ui-checkbox-glyph-size: 1em;
|
|
28
28
|
--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
29
|
center / contain no-repeat;
|
|
@@ -48,7 +48,11 @@
|
|
|
48
48
|
border-width: var(--_border-width-resolved, var(--ui-checkbox-border-width));
|
|
49
49
|
border-style: var(--_border-style-resolved, var(--ui-checkbox-border-style));
|
|
50
50
|
border-color: var(--_border-color-resolved, var(--ui-checkbox-border-color));
|
|
51
|
-
|
|
51
|
+
--_radius-len: var(--_radius-resolved, var(--ui-checkbox-radius));
|
|
52
|
+
--_radius-num: var(--_radius-resolved, var(--ui-checkbox-radius));
|
|
53
|
+
border-radius: calc(
|
|
54
|
+
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
|
|
55
|
+
);
|
|
52
56
|
|
|
53
57
|
/* centres the ::before glyph */
|
|
54
58
|
display: inline-grid;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
--ui-combobox-border-width: var(--ui-select-border-width);
|
|
33
33
|
--ui-combobox-border-style: var(--ui-select-border-style);
|
|
34
34
|
--ui-combobox-border-color: var(--ui-select-border-color);
|
|
35
|
-
--ui-combobox-
|
|
35
|
+
--ui-combobox-radius: var(--ui-select-radius);
|
|
36
36
|
--ui-combobox-icon-mask: var(--ui-select-picker-icon-mask);
|
|
37
37
|
--ui-combobox-icon-size: var(--ui-select-picker-icon-size);
|
|
38
38
|
--ui-combobox-icon-color: var(--ui-select-picker-icon-color);
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
--ui-combobox-tag-remove-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Crect width='256' height='256' fill='none'/%3E%3Cline x1='200' y1='56' x2='56' y2='200' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3Cline x1='200' y1='200' x2='56' y2='56' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3C/svg%3E");
|
|
59
59
|
--ui-combobox-tag-remove-size: var(--ui-badge-icon-size);
|
|
60
60
|
--ui-combobox-tag-remove-color: currentColor;
|
|
61
|
-
--ui-combobox-tag-remove-
|
|
61
|
+
--ui-combobox-tag-remove-radius: var(--radius-sm);
|
|
62
62
|
--ui-combobox-tag-remove-opacity: 0.65;
|
|
63
63
|
--ui-combobox-tag-remove-opacity--hover: 1;
|
|
64
64
|
}
|
|
@@ -118,7 +118,11 @@
|
|
|
118
118
|
border-width: var(--_border-width-resolved, var(--ui-combobox-border-width));
|
|
119
119
|
border-style: var(--_border-style-resolved, var(--ui-combobox-border-style));
|
|
120
120
|
border-color: var(--_border-color-resolved, var(--ui-combobox-border-color));
|
|
121
|
-
|
|
121
|
+
--_radius-len: var(--_radius-resolved, var(--ui-combobox-radius));
|
|
122
|
+
--_radius-num: var(--_radius-resolved, var(--ui-combobox-radius));
|
|
123
|
+
border-radius: calc(
|
|
124
|
+
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
|
|
125
|
+
);
|
|
122
126
|
|
|
123
127
|
/* Same ring recipe as [data-ui~="select"]: transparent outline twin keeps focus
|
|
124
128
|
visible in forced-colors mode */
|
|
@@ -315,7 +319,7 @@
|
|
|
315
319
|
flex-shrink: 0;
|
|
316
320
|
inline-size: var(--ui-combobox-tag-remove-size);
|
|
317
321
|
block-size: var(--ui-combobox-tag-remove-size);
|
|
318
|
-
border-radius: var(--ui-combobox-tag-remove-
|
|
322
|
+
border-radius: var(--ui-combobox-tag-remove-radius);
|
|
319
323
|
opacity: var(--ui-combobox-tag-remove-opacity);
|
|
320
324
|
cursor: pointer;
|
|
321
325
|
transition: var(--default-transition);
|
|
@@ -25,12 +25,18 @@ export interface AuditNode {
|
|
|
25
25
|
getAttributeNames(): string[];
|
|
26
26
|
/** True when this node or an ancestor carries the identity `name` (see {@link carriesIdentity}). */
|
|
27
27
|
withinIdentity(name: string, identities: readonly string[]): boolean;
|
|
28
|
+
/** `Element.matches`, for the selectors in `reads` and `blocks`. */
|
|
29
|
+
matches(selector: string): boolean;
|
|
28
30
|
}
|
|
29
31
|
export interface AuditContext {
|
|
30
32
|
/** State-bearing hooks per identity as `<utility>--<state>` (`bg--hover`). */
|
|
31
33
|
hooks: Record<string, string[]>;
|
|
32
34
|
/** Identity tokens the kit declares (`button`, `field-group`). */
|
|
33
35
|
identities: readonly string[];
|
|
36
|
+
/** For each utility, the elements the kit reads it on through its own chain, as selectors. */
|
|
37
|
+
reads: Readonly<Record<string, readonly string[]>>;
|
|
38
|
+
/** For each tier-only utility, the elements a kit rule above `@layer defaults` sets its property on. */
|
|
39
|
+
blocks: Readonly<Record<string, readonly string[]>>;
|
|
34
40
|
/** True when `value` is a color identifier (`red`, `currentcolor`); the browser asks `CSS.supports`. */
|
|
35
41
|
isColor: (value: string) => boolean;
|
|
36
42
|
}
|
|
@@ -40,6 +46,8 @@ export interface AuditContext {
|
|
|
40
46
|
* (`field-group` and `<ui-toggle-group>` carry `field` and `toggle`).
|
|
41
47
|
*/
|
|
42
48
|
export declare function carriesIdentity(tagName: string, dataUi: string | null, name: string, identities: readonly string[]): boolean;
|
|
49
|
+
/** `reads` / `blocks` as generated (indices into `selectors`), back as selector lists for {@link AuditContext}. */
|
|
50
|
+
export declare function expandStyling(selectors: readonly string[], record: Readonly<Record<string, readonly number[]>>): Record<string, string[]>;
|
|
43
51
|
/** Audits one element's `style` and `data-*` attributes. */
|
|
44
52
|
export declare function auditNode(node: AuditNode, context: AuditContext): Finding[];
|
|
45
53
|
export interface PersistFinding<T> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-core.d.ts","sourceRoot":"","sources":["audit-core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audit-core.d.ts","sourceRoot":"","sources":["audit-core.ts"],"names":[],"mappings":"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"}
|
|
@@ -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, 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_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",
|
|
@@ -91,11 +91,15 @@ function isBorderValue(value, isColor) {
|
|
|
91
91
|
return isColor(value);
|
|
92
92
|
return false;
|
|
93
93
|
}
|
|
94
|
+
/** The words a dual utility takes besides numbers and lengths: its keywords and alias names (`full`). */
|
|
95
|
+
function dualWords(utility) {
|
|
96
|
+
return [...(utility.keywords ?? []), ...Object.keys(utility.aliases ?? {})];
|
|
97
|
+
}
|
|
94
98
|
function isDualValue(value, utility) {
|
|
95
99
|
return (NUMBER.test(value) ||
|
|
96
100
|
DIMENSION.test(value) ||
|
|
97
101
|
FUNCTION.test(value) ||
|
|
98
|
-
(utility
|
|
102
|
+
dualWords(utility).includes(value));
|
|
99
103
|
}
|
|
100
104
|
/**
|
|
101
105
|
* True when an element with this tag and `data-ui` carries the identity `name`:
|
|
@@ -109,6 +113,10 @@ export function carriesIdentity(tagName, dataUi, name, identities) {
|
|
|
109
113
|
const tokens = (dataUi ?? "").split(/\s+/).filter(Boolean);
|
|
110
114
|
return tokens.some((token) => identities.includes(token) && (token === name || token.startsWith(`${name}-`)));
|
|
111
115
|
}
|
|
116
|
+
/** `reads` / `blocks` as generated (indices into `selectors`), back as selector lists for {@link AuditContext}. */
|
|
117
|
+
export function expandStyling(selectors, record) {
|
|
118
|
+
return Object.fromEntries(Object.entries(record).map(([name, indices]) => [name, indices.map((i) => selectors[i])]));
|
|
119
|
+
}
|
|
112
120
|
/** Audits one element's `style` and `data-*` attributes. */
|
|
113
121
|
export function auditNode(node, context) {
|
|
114
122
|
const found = [];
|
|
@@ -240,15 +248,31 @@ export function auditNode(node, context) {
|
|
|
240
248
|
// a border shorthand is the base a border longhand's tier overrides
|
|
241
249
|
const borderBase = /^border-(?:width|color|style)$/.test(baseName) &&
|
|
242
250
|
BORDER_SHORTHANDS.some((name) => bases.has(name));
|
|
243
|
-
// a
|
|
244
|
-
const
|
|
245
|
-
|
|
251
|
+
// a shorthand's base is the base its longhand's tier overrides (`--p: 4; --px--md: 1`)
|
|
252
|
+
const shorthandBase = (SHORTHAND_OF[baseName] ?? []).some((name) => bases.has(name));
|
|
253
|
+
// the box-shadow composite (ring, shadow, elevation) works tier-only like a no-base
|
|
254
|
+
// utility; the other feeds (`--bg-alpha`, `--focus-ring`, `--shadow-angle`) reach the
|
|
255
|
+
// element through another utility or a token, and are not checked here
|
|
256
|
+
const composite = BOX_SHADOW_COMPOSITE.includes(utility.name);
|
|
257
|
+
const feedsComposite = !composite && (utility.emit === "none" || utility.emit === "px");
|
|
258
|
+
// a tier alone works where the kit reads the utility through its own chain,
|
|
259
|
+
// or where the tier-only rule (`@layer defaults`) applies: a no-base utility
|
|
260
|
+
// whose property no kit rule above that layer sets on this element
|
|
261
|
+
const readByKit = (context.reads[utility.name] ?? []).some((selector) => node.matches(selector));
|
|
262
|
+
const noBase = (utility.noBase !== undefined || composite) &&
|
|
263
|
+
!(context.blocks[utility.name] ?? []).some((selector) => node.matches(selector));
|
|
264
|
+
if (!readByKit &&
|
|
265
|
+
!noBase &&
|
|
266
|
+
!bases.has(baseName) &&
|
|
267
|
+
!borderBase &&
|
|
268
|
+
!shorthandBase &&
|
|
269
|
+
!feedsComposite) {
|
|
246
270
|
warn("tier-without-base", `\`${name}\` has no base \`--${baseName}\`; the tier only overrides a base.`);
|
|
247
271
|
}
|
|
248
272
|
continue;
|
|
249
273
|
}
|
|
250
274
|
if (utility.mode === "dual" && !isDualValue(value, utility)) {
|
|
251
|
-
warn("dual-value", `\`${name}: ${value}\` is neither a scale number, a length, nor a keyword (${(utility
|
|
275
|
+
warn("dual-value", `\`${name}: ${value}\` is neither a scale number, a length, nor a keyword (${dualWords(utility).join(", ") || "none"}).`);
|
|
252
276
|
}
|
|
253
277
|
if (utility.mode === "keyword" && NUMBER.test(value)) {
|
|
254
278
|
warn("keyword-number", `\`${name}: ${value}\` is a number on a keyword utility.`);
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
BORDER_SHORTHANDS,
|
|
14
|
+
BOX_SHADOW_COMPOSITE,
|
|
15
|
+
SHORTHAND_OF,
|
|
14
16
|
DISPLAY_SHORTHANDS,
|
|
15
17
|
GRADIENT_TYPES,
|
|
16
18
|
UTILITIES,
|
|
@@ -95,6 +97,8 @@ export interface AuditNode {
|
|
|
95
97
|
getAttributeNames(): string[];
|
|
96
98
|
/** True when this node or an ancestor carries the identity `name` (see {@link carriesIdentity}). */
|
|
97
99
|
withinIdentity(name: string, identities: readonly string[]): boolean;
|
|
100
|
+
/** `Element.matches`, for the selectors in `reads` and `blocks`. */
|
|
101
|
+
matches(selector: string): boolean;
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
export interface AuditContext {
|
|
@@ -102,6 +106,10 @@ export interface AuditContext {
|
|
|
102
106
|
hooks: Record<string, string[]>;
|
|
103
107
|
/** Identity tokens the kit declares (`button`, `field-group`). */
|
|
104
108
|
identities: readonly string[];
|
|
109
|
+
/** For each utility, the elements the kit reads it on through its own chain, as selectors. */
|
|
110
|
+
reads: Readonly<Record<string, readonly string[]>>;
|
|
111
|
+
/** For each tier-only utility, the elements a kit rule above `@layer defaults` sets its property on. */
|
|
112
|
+
blocks: Readonly<Record<string, readonly string[]>>;
|
|
105
113
|
/** True when `value` is a color identifier (`red`, `currentcolor`); the browser asks `CSS.supports`. */
|
|
106
114
|
isColor: (value: string) => boolean;
|
|
107
115
|
}
|
|
@@ -184,12 +192,17 @@ function isBorderValue(value: string, isColor: (value: string) => boolean): bool
|
|
|
184
192
|
return false;
|
|
185
193
|
}
|
|
186
194
|
|
|
195
|
+
/** The words a dual utility takes besides numbers and lengths: its keywords and alias names (`full`). */
|
|
196
|
+
function dualWords(utility: Utility): string[] {
|
|
197
|
+
return [...(utility.keywords ?? []), ...Object.keys(utility.aliases ?? {})];
|
|
198
|
+
}
|
|
199
|
+
|
|
187
200
|
function isDualValue(value: string, utility: Utility): boolean {
|
|
188
201
|
return (
|
|
189
202
|
NUMBER.test(value) ||
|
|
190
203
|
DIMENSION.test(value) ||
|
|
191
204
|
FUNCTION.test(value) ||
|
|
192
|
-
(utility
|
|
205
|
+
dualWords(utility).includes(value)
|
|
193
206
|
);
|
|
194
207
|
}
|
|
195
208
|
|
|
@@ -212,6 +225,16 @@ export function carriesIdentity(
|
|
|
212
225
|
);
|
|
213
226
|
}
|
|
214
227
|
|
|
228
|
+
/** `reads` / `blocks` as generated (indices into `selectors`), back as selector lists for {@link AuditContext}. */
|
|
229
|
+
export function expandStyling(
|
|
230
|
+
selectors: readonly string[],
|
|
231
|
+
record: Readonly<Record<string, readonly number[]>>,
|
|
232
|
+
): Record<string, string[]> {
|
|
233
|
+
return Object.fromEntries(
|
|
234
|
+
Object.entries(record).map(([name, indices]) => [name, indices.map((i) => selectors[i]!)]),
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
215
238
|
/** Audits one element's `style` and `data-*` attributes. */
|
|
216
239
|
export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
|
|
217
240
|
const found: Finding[] = [];
|
|
@@ -380,9 +403,30 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
|
|
|
380
403
|
const borderBase =
|
|
381
404
|
/^border-(?:width|color|style)$/.test(baseName) &&
|
|
382
405
|
BORDER_SHORTHANDS.some((name) => bases.has(name));
|
|
383
|
-
// a
|
|
384
|
-
const
|
|
385
|
-
|
|
406
|
+
// a shorthand's base is the base its longhand's tier overrides (`--p: 4; --px--md: 1`)
|
|
407
|
+
const shorthandBase = (SHORTHAND_OF[baseName] ?? []).some((name) => bases.has(name));
|
|
408
|
+
// the box-shadow composite (ring, shadow, elevation) works tier-only like a no-base
|
|
409
|
+
// utility; the other feeds (`--bg-alpha`, `--focus-ring`, `--shadow-angle`) reach the
|
|
410
|
+
// element through another utility or a token, and are not checked here
|
|
411
|
+
const composite = (BOX_SHADOW_COMPOSITE as readonly string[]).includes(utility.name);
|
|
412
|
+
const feedsComposite = !composite && (utility.emit === "none" || utility.emit === "px");
|
|
413
|
+
// a tier alone works where the kit reads the utility through its own chain,
|
|
414
|
+
// or where the tier-only rule (`@layer defaults`) applies: a no-base utility
|
|
415
|
+
// whose property no kit rule above that layer sets on this element
|
|
416
|
+
const readByKit = (context.reads[utility.name] ?? []).some((selector) =>
|
|
417
|
+
node.matches(selector),
|
|
418
|
+
);
|
|
419
|
+
const noBase =
|
|
420
|
+
(utility.noBase !== undefined || composite) &&
|
|
421
|
+
!(context.blocks[utility.name] ?? []).some((selector) => node.matches(selector));
|
|
422
|
+
if (
|
|
423
|
+
!readByKit &&
|
|
424
|
+
!noBase &&
|
|
425
|
+
!bases.has(baseName) &&
|
|
426
|
+
!borderBase &&
|
|
427
|
+
!shorthandBase &&
|
|
428
|
+
!feedsComposite
|
|
429
|
+
) {
|
|
386
430
|
warn(
|
|
387
431
|
"tier-without-base",
|
|
388
432
|
`\`${name}\` has no base \`--${baseName}\`; the tier only overrides a base.`,
|
|
@@ -393,7 +437,7 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
|
|
|
393
437
|
if (utility.mode === "dual" && !isDualValue(value, utility)) {
|
|
394
438
|
warn(
|
|
395
439
|
"dual-value",
|
|
396
|
-
`\`${name}: ${value}\` is neither a scale number, a length, nor a keyword (${(utility
|
|
440
|
+
`\`${name}: ${value}\` is neither a scale number, a length, nor a keyword (${dualWords(utility).join(", ") || "none"}).`,
|
|
397
441
|
);
|
|
398
442
|
}
|
|
399
443
|
if (utility.mode === "keyword" && NUMBER.test(value)) {
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview `<ui-debug>`: audits utilities in `style` attributes.
|
|
3
|
-
* @description Development only. On a listed domain the element walks every
|
|
4
|
-
* element once, and again on mutation, and warns about the mistakes the
|
|
5
|
-
* generated gates cannot report: an unknown utility, a wrong mode, a tier without
|
|
6
|
-
* a base, a modifier the family lacks, a base utility that flattens a state a
|
|
7
|
-
* primitive's hook covers, a raw property shadowing a utility, a
|
|
8
|
-
* whitespace form the gates cannot match, and a `data-<name>-*` attribute
|
|
9
|
-
* outside its identity. On an unlisted domain it removes itself and logs
|
|
10
|
-
* {@link DEBUG_WARNING} once. Identities and hooks are read from the page's
|
|
11
|
-
* stylesheets, so the audit needs no manifest. The checks live in
|
|
12
|
-
* `audit-core.ts`, which the html lint rules (`@zazz-ui/eslint-plugin`) share.
|
|
13
|
-
* @example
|
|
14
|
-
* <ui-debug data-debug-domains="localhost, staging.example.com"></ui-debug>
|
|
15
|
-
*/
|
|
16
1
|
import { ZazzElement } from "../../base/zazz-element.ts";
|
|
17
2
|
import { type RuleId } from "./audit-core.ts";
|
|
18
3
|
export interface Warning {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["debug.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["debug.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAML,KAAK,MAAM,EACZ,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,+GAA+G;IAC/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,CAgDzC;CACF;AAID,OAAO,EAAE,OAAO,EAAE,CAAC"}
|