@zazz-ui/core 0.5.4 → 0.6.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 +16 -13
- package/CHANGELOG.md +44 -0
- package/README.md +3 -3
- package/dist/sri.json +73 -73
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +3604 -116
- package/editor/zazz.html-data.json +18 -12
- package/editor/zazz.language-data.json +103 -54
- package/editor/zazz.lint-data.json +2 -0
- package/package.json +1 -1
- package/src/base/_properties-2xl.css +16 -0
- package/src/base/_properties-active.css +12 -0
- package/src/base/_properties-checked.css +12 -0
- package/src/base/_properties-current.css +12 -0
- package/src/base/_properties-disabled.css +12 -0
- package/src/base/_properties-focus-visible.css +12 -0
- package/src/base/_properties-focus-within.css +12 -0
- package/src/base/_properties-hover.css +12 -0
- package/src/base/_properties-lg.css +16 -0
- package/src/base/_properties-md.css +16 -0
- package/src/base/_properties-open.css +12 -0
- package/src/base/_properties-sm.css +16 -0
- package/src/base/_properties-starting.css +6 -0
- package/src/base/_properties-stuck.css +6 -0
- package/src/base/_properties-xl.css +16 -0
- package/src/base/_properties.css +22 -1
- package/src/base/_reset.css +8 -2
- package/src/base/_switches.css +3 -0
- package/src/base/_typography.css +0 -1
- package/src/base/_utilities-color.css +5 -5
- package/src/base/_utilities-effects.css +45 -6
- package/src/base/_utilities-flow.css +5 -5
- package/src/base/_utilities-grid.css +10 -10
- package/src/base/_utilities-margin.css +35 -35
- package/src/base/_utilities-pseudo.css +16 -0
- package/src/base/_utilities-sizing.css +20 -20
- package/src/base/_utilities-tier-2xl.css +9 -1
- package/src/base/_utilities-tier-active.css +6 -0
- package/src/base/_utilities-tier-checked.css +6 -0
- package/src/base/_utilities-tier-current.css +6 -0
- package/src/base/_utilities-tier-disabled.css +6 -0
- package/src/base/_utilities-tier-focus-visible.css +6 -0
- package/src/base/_utilities-tier-focus-within.css +6 -0
- package/src/base/_utilities-tier-hover.css +6 -0
- package/src/base/_utilities-tier-lg.css +9 -1
- package/src/base/_utilities-tier-md.css +9 -1
- package/src/base/_utilities-tier-open.css +6 -0
- package/src/base/_utilities-tier-sm.css +9 -1
- package/src/base/_utilities-tier-starting.css +3 -0
- package/src/base/_utilities-tier-stuck.css +3 -0
- package/src/base/_utilities-tier-xl.css +9 -1
- package/src/base/_utilities-typography.css +5 -5
- package/src/base/_variables.css +116 -55
- package/src/base/dialog-lifecycle.d.ts +18 -1
- package/src/base/dialog-lifecycle.d.ts.map +1 -1
- package/src/base/dialog-lifecycle.js +72 -1
- package/src/base/dialog-lifecycle.ts +79 -1
- package/src/base/navigation.d.ts.map +1 -1
- package/src/base/navigation.js +15 -5
- package/src/base/navigation.ts +15 -5
- package/src/base/utilities.d.ts +19 -13
- package/src/base/utilities.d.ts.map +1 -1
- package/src/base/utilities.js +72 -21
- package/src/base/utilities.ts +84 -24
- package/src/head.d.ts +4 -1
- package/src/head.d.ts.map +1 -1
- package/src/head.js +9 -5
- package/src/head.ts +9 -5
- package/src/primitives/accordion/accordion.css +23 -12
- package/src/primitives/accordion/accordion.html +3 -3
- package/src/primitives/badge/badge.css +16 -9
- package/src/primitives/button/button.css +18 -11
- package/src/primitives/checkbox/checkbox-tasklist.html +6 -1
- package/src/primitives/checkbox/checkbox.css +16 -9
- package/src/primitives/checkbox/checkbox.html +1 -1
- package/src/primitives/checkbox/checkbox.js +1 -1
- package/src/primitives/checkbox/checkbox.ts +1 -1
- package/src/primitives/combobox/combobox.css +15 -8
- package/src/primitives/command/command-actions.d.ts.map +1 -1
- package/src/primitives/command/command-actions.html +1 -0
- package/src/primitives/command/command-actions.js +9 -4
- package/src/primitives/command/command-actions.ts +9 -4
- package/src/primitives/command/command-dialog.html +36 -0
- package/src/primitives/command/command.css +12 -1
- package/src/primitives/command/command.html +1 -0
- package/src/primitives/debug/audit-core.d.ts +3 -1
- package/src/primitives/debug/audit-core.d.ts.map +1 -1
- package/src/primitives/debug/audit-core.js +19 -1
- package/src/primitives/debug/audit-core.ts +25 -1
- package/src/primitives/debug/debug.d.ts.map +1 -1
- package/src/primitives/debug/debug.js +1 -0
- package/src/primitives/debug/debug.ts +1 -0
- package/src/primitives/dialog/dialog.css +2 -2
- package/src/primitives/fields/fields.css +15 -2
- package/src/primitives/input/input-icon-leading.html +1 -1
- package/src/primitives/input/input-icon-trailing.html +1 -1
- package/src/primitives/input/input.css +16 -9
- package/src/primitives/input-group/input-group.css +15 -8
- package/src/primitives/lightbox/lightbox.html +1 -2
- package/src/primitives/mobile-menu/mobile-menu.html +50 -10
- package/src/primitives/navigation-menu/navigation-menu-featured.html +5 -1
- package/src/primitives/navigation-menu/navigation-menu-icon-grid.html +5 -1
- package/src/primitives/navigation-menu/navigation-menu-interest.html +10 -2
- package/src/primitives/navigation-menu/navigation-menu-megamenu.html +5 -1
- package/src/primitives/navigation-menu/navigation-menu-simple.html +6 -1
- package/src/primitives/navigation-menu/navigation-menu.css +6 -3
- package/src/primitives/navigation-menu/navigation-menu.html +15 -3
- package/src/primitives/password-group/password-group.css +14 -7
- package/src/primitives/password-group/password-group.js +1 -1
- package/src/primitives/password-group/password-group.ts +1 -1
- package/src/primitives/radio/radio.css +15 -8
- package/src/primitives/select/multiselect.d.ts.map +1 -1
- package/src/primitives/select/multiselect.js +3 -1
- package/src/primitives/select/multiselect.ts +3 -1
- package/src/primitives/select/select.css +14 -7
- package/src/primitives/slider/slider.html +1 -0
- package/src/primitives/switch/switch.css +15 -8
- package/src/primitives/tabs/tabs.css +21 -9
- package/src/primitives/textarea/textarea.css +16 -9
- package/src/primitives/toggle/toggle.css +16 -9
- package/src/primitives/toggle/toggle.html +6 -6
- package/src/primitives/toolbar/toolbar.html +2 -1
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
--_border-b-focus-within: var(--border-b--focus-within);
|
|
22
22
|
--_opacity-focus-within: var(--opacity--focus-within);
|
|
23
23
|
--_shadow-focus-within: var(--shadow--focus-within);
|
|
24
|
+
--_shadow-angle-focus-within: var(--shadow-angle--focus-within);
|
|
24
25
|
--_ring-focus-within: var(--ring--focus-within);
|
|
25
26
|
--_ring-color-focus-within: var(--ring-color--focus-within);
|
|
26
27
|
--_ring-offset-focus-within: var(--ring-offset--focus-within);
|
|
@@ -29,6 +30,8 @@
|
|
|
29
30
|
--_translate-focus-within: var(--translate--focus-within);
|
|
30
31
|
--_rotate-focus-within: var(--rotate--focus-within);
|
|
31
32
|
--_transition-focus-within: var(--transition--focus-within);
|
|
33
|
+
--_transition-duration-focus-within: var(--transition-duration--focus-within);
|
|
34
|
+
--_transition-delay-focus-within: var(--transition-delay--focus-within);
|
|
32
35
|
}
|
|
33
36
|
:where([data-ui~="group"]:focus-within [style*="--group-"]) {
|
|
34
37
|
--_template-cols-g-focus-within: var(--group-template-cols--focus-within);
|
|
@@ -49,6 +52,7 @@
|
|
|
49
52
|
--_border-b-g-focus-within: var(--group-border-b--focus-within);
|
|
50
53
|
--_opacity-g-focus-within: var(--group-opacity--focus-within);
|
|
51
54
|
--_shadow-g-focus-within: var(--group-shadow--focus-within);
|
|
55
|
+
--_shadow-angle-g-focus-within: var(--group-shadow-angle--focus-within);
|
|
52
56
|
--_ring-g-focus-within: var(--group-ring--focus-within);
|
|
53
57
|
--_ring-color-g-focus-within: var(--group-ring-color--focus-within);
|
|
54
58
|
--_ring-offset-g-focus-within: var(--group-ring-offset--focus-within);
|
|
@@ -57,5 +61,7 @@
|
|
|
57
61
|
--_translate-g-focus-within: var(--group-translate--focus-within);
|
|
58
62
|
--_rotate-g-focus-within: var(--group-rotate--focus-within);
|
|
59
63
|
--_transition-g-focus-within: var(--group-transition--focus-within);
|
|
64
|
+
--_transition-duration-g-focus-within: var(--group-transition-duration--focus-within);
|
|
65
|
+
--_transition-delay-g-focus-within: var(--group-transition-delay--focus-within);
|
|
60
66
|
}
|
|
61
67
|
}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
--_border-b-hover: var(--border-b--hover);
|
|
23
23
|
--_opacity-hover: var(--opacity--hover);
|
|
24
24
|
--_shadow-hover: var(--shadow--hover);
|
|
25
|
+
--_shadow-angle-hover: var(--shadow-angle--hover);
|
|
25
26
|
--_ring-hover: var(--ring--hover);
|
|
26
27
|
--_ring-color-hover: var(--ring-color--hover);
|
|
27
28
|
--_ring-offset-hover: var(--ring-offset--hover);
|
|
@@ -30,6 +31,8 @@
|
|
|
30
31
|
--_translate-hover: var(--translate--hover);
|
|
31
32
|
--_rotate-hover: var(--rotate--hover);
|
|
32
33
|
--_transition-hover: var(--transition--hover);
|
|
34
|
+
--_transition-duration-hover: var(--transition-duration--hover);
|
|
35
|
+
--_transition-delay-hover: var(--transition-delay--hover);
|
|
33
36
|
}
|
|
34
37
|
:where([data-ui~="group"]:hover [style*="--group-"]) {
|
|
35
38
|
--_template-cols-g-hover: var(--group-template-cols--hover);
|
|
@@ -50,6 +53,7 @@
|
|
|
50
53
|
--_border-b-g-hover: var(--group-border-b--hover);
|
|
51
54
|
--_opacity-g-hover: var(--group-opacity--hover);
|
|
52
55
|
--_shadow-g-hover: var(--group-shadow--hover);
|
|
56
|
+
--_shadow-angle-g-hover: var(--group-shadow-angle--hover);
|
|
53
57
|
--_ring-g-hover: var(--group-ring--hover);
|
|
54
58
|
--_ring-color-g-hover: var(--group-ring-color--hover);
|
|
55
59
|
--_ring-offset-g-hover: var(--group-ring-offset--hover);
|
|
@@ -58,6 +62,8 @@
|
|
|
58
62
|
--_translate-g-hover: var(--group-translate--hover);
|
|
59
63
|
--_rotate-g-hover: var(--group-rotate--hover);
|
|
60
64
|
--_transition-g-hover: var(--group-transition--hover);
|
|
65
|
+
--_transition-duration-g-hover: var(--group-transition-duration--hover);
|
|
66
|
+
--_transition-delay-g-hover: var(--group-transition-delay--hover);
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/* lg tier setter */
|
|
4
4
|
@layer ui.utilities {
|
|
5
|
-
@container (width >=
|
|
5
|
+
@container (width >= 64rem) {
|
|
6
6
|
:where([style*="--lg:"]) {
|
|
7
7
|
--_display-lg: var(--display--lg);
|
|
8
8
|
--_position-lg: var(--position--lg);
|
|
@@ -88,6 +88,14 @@
|
|
|
88
88
|
--_border-t-lg: var(--border-t--lg);
|
|
89
89
|
--_border-r-lg: var(--border-r--lg);
|
|
90
90
|
--_border-b-lg: var(--border-b--lg);
|
|
91
|
+
--_shadow-angle-lg: var(--shadow-angle--lg);
|
|
92
|
+
--_ring-lg: var(--ring--lg);
|
|
93
|
+
--_ring-color-lg: var(--ring-color--lg);
|
|
94
|
+
--_ring-offset-lg: var(--ring-offset--lg);
|
|
95
|
+
--_ring-offset-color-lg: var(--ring-offset-color--lg);
|
|
96
|
+
--_focus-ring-lg: var(--focus-ring--lg);
|
|
97
|
+
--_transition-duration-lg: var(--transition-duration--lg);
|
|
98
|
+
--_transition-delay-lg: var(--transition-delay--lg);
|
|
91
99
|
}
|
|
92
100
|
}
|
|
93
101
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/* md tier setter */
|
|
4
4
|
@layer ui.utilities {
|
|
5
|
-
@container (width >=
|
|
5
|
+
@container (width >= 48rem) {
|
|
6
6
|
:where([style*="--md:"]) {
|
|
7
7
|
--_display-md: var(--display--md);
|
|
8
8
|
--_position-md: var(--position--md);
|
|
@@ -88,6 +88,14 @@
|
|
|
88
88
|
--_border-t-md: var(--border-t--md);
|
|
89
89
|
--_border-r-md: var(--border-r--md);
|
|
90
90
|
--_border-b-md: var(--border-b--md);
|
|
91
|
+
--_shadow-angle-md: var(--shadow-angle--md);
|
|
92
|
+
--_ring-md: var(--ring--md);
|
|
93
|
+
--_ring-color-md: var(--ring-color--md);
|
|
94
|
+
--_ring-offset-md: var(--ring-offset--md);
|
|
95
|
+
--_ring-offset-color-md: var(--ring-offset-color--md);
|
|
96
|
+
--_focus-ring-md: var(--focus-ring--md);
|
|
97
|
+
--_transition-duration-md: var(--transition-duration--md);
|
|
98
|
+
--_transition-delay-md: var(--transition-delay--md);
|
|
91
99
|
}
|
|
92
100
|
}
|
|
93
101
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
--_border-b-open: var(--border-b--open);
|
|
22
22
|
--_opacity-open: var(--opacity--open);
|
|
23
23
|
--_shadow-open: var(--shadow--open);
|
|
24
|
+
--_shadow-angle-open: var(--shadow-angle--open);
|
|
24
25
|
--_ring-open: var(--ring--open);
|
|
25
26
|
--_ring-color-open: var(--ring-color--open);
|
|
26
27
|
--_ring-offset-open: var(--ring-offset--open);
|
|
@@ -29,6 +30,8 @@
|
|
|
29
30
|
--_translate-open: var(--translate--open);
|
|
30
31
|
--_rotate-open: var(--rotate--open);
|
|
31
32
|
--_transition-open: var(--transition--open);
|
|
33
|
+
--_transition-duration-open: var(--transition-duration--open);
|
|
34
|
+
--_transition-delay-open: var(--transition-delay--open);
|
|
32
35
|
}
|
|
33
36
|
:where([data-ui~="group"]:is([open], :popover-open, [aria-expanded="true"]) [style*="--group-"]) {
|
|
34
37
|
--_template-cols-g-open: var(--group-template-cols--open);
|
|
@@ -49,6 +52,7 @@
|
|
|
49
52
|
--_border-b-g-open: var(--group-border-b--open);
|
|
50
53
|
--_opacity-g-open: var(--group-opacity--open);
|
|
51
54
|
--_shadow-g-open: var(--group-shadow--open);
|
|
55
|
+
--_shadow-angle-g-open: var(--group-shadow-angle--open);
|
|
52
56
|
--_ring-g-open: var(--group-ring--open);
|
|
53
57
|
--_ring-color-g-open: var(--group-ring-color--open);
|
|
54
58
|
--_ring-offset-g-open: var(--group-ring-offset--open);
|
|
@@ -57,5 +61,7 @@
|
|
|
57
61
|
--_translate-g-open: var(--group-translate--open);
|
|
58
62
|
--_rotate-g-open: var(--group-rotate--open);
|
|
59
63
|
--_transition-g-open: var(--group-transition--open);
|
|
64
|
+
--_transition-duration-g-open: var(--group-transition-duration--open);
|
|
65
|
+
--_transition-delay-g-open: var(--group-transition-delay--open);
|
|
60
66
|
}
|
|
61
67
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/* sm tier setter */
|
|
4
4
|
@layer ui.utilities {
|
|
5
|
-
@container (width >=
|
|
5
|
+
@container (width >= 40rem) {
|
|
6
6
|
:where([style*="--sm:"]) {
|
|
7
7
|
--_display-sm: var(--display--sm);
|
|
8
8
|
--_position-sm: var(--position--sm);
|
|
@@ -88,6 +88,14 @@
|
|
|
88
88
|
--_border-t-sm: var(--border-t--sm);
|
|
89
89
|
--_border-r-sm: var(--border-r--sm);
|
|
90
90
|
--_border-b-sm: var(--border-b--sm);
|
|
91
|
+
--_shadow-angle-sm: var(--shadow-angle--sm);
|
|
92
|
+
--_ring-sm: var(--ring--sm);
|
|
93
|
+
--_ring-color-sm: var(--ring-color--sm);
|
|
94
|
+
--_ring-offset-sm: var(--ring-offset--sm);
|
|
95
|
+
--_ring-offset-color-sm: var(--ring-offset-color--sm);
|
|
96
|
+
--_focus-ring-sm: var(--focus-ring--sm);
|
|
97
|
+
--_transition-duration-sm: var(--transition-duration--sm);
|
|
98
|
+
--_transition-delay-sm: var(--transition-delay--sm);
|
|
91
99
|
}
|
|
92
100
|
}
|
|
93
101
|
}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
--_border-b-starting: var(--border-b--starting);
|
|
23
23
|
--_opacity-starting: var(--opacity--starting);
|
|
24
24
|
--_shadow-starting: var(--shadow--starting);
|
|
25
|
+
--_shadow-angle-starting: var(--shadow-angle--starting);
|
|
25
26
|
--_ring-starting: var(--ring--starting);
|
|
26
27
|
--_ring-color-starting: var(--ring-color--starting);
|
|
27
28
|
--_ring-offset-starting: var(--ring-offset--starting);
|
|
@@ -30,6 +31,8 @@
|
|
|
30
31
|
--_translate-starting: var(--translate--starting);
|
|
31
32
|
--_rotate-starting: var(--rotate--starting);
|
|
32
33
|
--_transition-starting: var(--transition--starting);
|
|
34
|
+
--_transition-duration-starting: var(--transition-duration--starting);
|
|
35
|
+
--_transition-delay-starting: var(--transition-delay--starting);
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
}
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
--_border-b-stuck: var(--_stuck-on) var(--border-b--stuck);
|
|
103
103
|
--_opacity-stuck: var(--_stuck-on) var(--opacity--stuck);
|
|
104
104
|
--_shadow-stuck: var(--_stuck-on) var(--shadow--stuck);
|
|
105
|
+
--_shadow-angle-stuck: var(--_stuck-on) var(--shadow-angle--stuck);
|
|
105
106
|
--_ring-stuck: var(--_stuck-on) var(--ring--stuck);
|
|
106
107
|
--_ring-color-stuck: var(--_stuck-on) var(--ring-color--stuck);
|
|
107
108
|
--_ring-offset-stuck: var(--_stuck-on) var(--ring-offset--stuck);
|
|
@@ -110,5 +111,7 @@
|
|
|
110
111
|
--_translate-stuck: var(--_stuck-on) var(--translate--stuck);
|
|
111
112
|
--_rotate-stuck: var(--_stuck-on) var(--rotate--stuck);
|
|
112
113
|
--_transition-stuck: var(--_stuck-on) var(--transition--stuck);
|
|
114
|
+
--_transition-duration-stuck: var(--_stuck-on) var(--transition-duration--stuck);
|
|
115
|
+
--_transition-delay-stuck: var(--_stuck-on) var(--transition-delay--stuck);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/* xl tier setter */
|
|
4
4
|
@layer ui.utilities {
|
|
5
|
-
@container (width >=
|
|
5
|
+
@container (width >= 80rem) {
|
|
6
6
|
:where([style*="--xl:"]) {
|
|
7
7
|
--_display-xl: var(--display--xl);
|
|
8
8
|
--_position-xl: var(--position--xl);
|
|
@@ -88,6 +88,14 @@
|
|
|
88
88
|
--_border-t-xl: var(--border-t--xl);
|
|
89
89
|
--_border-r-xl: var(--border-r--xl);
|
|
90
90
|
--_border-b-xl: var(--border-b--xl);
|
|
91
|
+
--_shadow-angle-xl: var(--shadow-angle--xl);
|
|
92
|
+
--_ring-xl: var(--ring--xl);
|
|
93
|
+
--_ring-color-xl: var(--ring-color--xl);
|
|
94
|
+
--_ring-offset-xl: var(--ring-offset--xl);
|
|
95
|
+
--_ring-offset-color-xl: var(--ring-offset-color--xl);
|
|
96
|
+
--_focus-ring-xl: var(--focus-ring--xl);
|
|
97
|
+
--_transition-duration-xl: var(--transition-duration--xl);
|
|
98
|
+
--_transition-delay-xl: var(--transition-delay--xl);
|
|
91
99
|
}
|
|
92
100
|
}
|
|
93
101
|
}
|
|
@@ -20,27 +20,27 @@
|
|
|
20
20
|
:where([style*="--font-weight: heading"]) { --_font-weight: var(--font-weight-heading); }
|
|
21
21
|
:where([style*="--font-weight: body"]) { --_font-weight: var(--font-weight-body); }
|
|
22
22
|
:where([style*="--font-weight: strong"]) { --_font-weight: var(--font-weight-strong); }
|
|
23
|
-
@container (width >=
|
|
23
|
+
@container (width >= 40rem) {
|
|
24
24
|
:where([style*="--font-weight--sm: heading"]) { --_font-weight-sm: var(--font-weight-heading); }
|
|
25
25
|
:where([style*="--font-weight--sm: body"]) { --_font-weight-sm: var(--font-weight-body); }
|
|
26
26
|
:where([style*="--font-weight--sm: strong"]) { --_font-weight-sm: var(--font-weight-strong); }
|
|
27
27
|
}
|
|
28
|
-
@container (width >=
|
|
28
|
+
@container (width >= 48rem) {
|
|
29
29
|
:where([style*="--font-weight--md: heading"]) { --_font-weight-md: var(--font-weight-heading); }
|
|
30
30
|
:where([style*="--font-weight--md: body"]) { --_font-weight-md: var(--font-weight-body); }
|
|
31
31
|
:where([style*="--font-weight--md: strong"]) { --_font-weight-md: var(--font-weight-strong); }
|
|
32
32
|
}
|
|
33
|
-
@container (width >=
|
|
33
|
+
@container (width >= 64rem) {
|
|
34
34
|
:where([style*="--font-weight--lg: heading"]) { --_font-weight-lg: var(--font-weight-heading); }
|
|
35
35
|
:where([style*="--font-weight--lg: body"]) { --_font-weight-lg: var(--font-weight-body); }
|
|
36
36
|
:where([style*="--font-weight--lg: strong"]) { --_font-weight-lg: var(--font-weight-strong); }
|
|
37
37
|
}
|
|
38
|
-
@container (width >=
|
|
38
|
+
@container (width >= 80rem) {
|
|
39
39
|
:where([style*="--font-weight--xl: heading"]) { --_font-weight-xl: var(--font-weight-heading); }
|
|
40
40
|
:where([style*="--font-weight--xl: body"]) { --_font-weight-xl: var(--font-weight-body); }
|
|
41
41
|
:where([style*="--font-weight--xl: strong"]) { --_font-weight-xl: var(--font-weight-strong); }
|
|
42
42
|
}
|
|
43
|
-
@container (width >=
|
|
43
|
+
@container (width >= 96rem) {
|
|
44
44
|
:where([style*="--font-weight--2xl: heading"]) { --_font-weight-2xl: var(--font-weight-heading); }
|
|
45
45
|
:where([style*="--font-weight--2xl: body"]) { --_font-weight-2xl: var(--font-weight-body); }
|
|
46
46
|
:where([style*="--font-weight--2xl: strong"]) { --_font-weight-2xl: var(--font-weight-strong); }
|
package/src/base/_variables.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @layer variables
|
|
5
5
|
* @requires _layers.css
|
|
6
6
|
* @uses light-dark() — theme roles re-resolve per color-scheme (system,
|
|
7
|
-
*
|
|
7
|
+
* data-ui="theme-dark" | "theme-light"); tokens stay unregistered on purpose
|
|
8
8
|
* @uses oklch(from …) — shade/tint scales and shadow alphas
|
|
9
9
|
* @uses color-mix() — focus ring (--color-ring)
|
|
10
10
|
* @uses interpolate-size: allow-keywords — discrete block-size animations (details, etc.)
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
interpolate-size: allow-keywords;
|
|
50
50
|
|
|
51
51
|
/* ==========================================================================
|
|
52
|
-
* Theme — light/dark via light-dark(); follows color-scheme (system +
|
|
52
|
+
* Theme — light/dark via light-dark(); follows color-scheme (system + the theme-dark | theme-light switches)
|
|
53
53
|
* ========================================================================== */
|
|
54
54
|
|
|
55
55
|
/* base */
|
|
@@ -383,19 +383,25 @@
|
|
|
383
383
|
*
|
|
384
384
|
* --_ring-offset-width: 0px;
|
|
385
385
|
* --_ring-width: 0px;
|
|
386
|
+
* --_focus-in: max(0, -1 * sign(var(--_focus-ring-w, 1px)));
|
|
386
387
|
* --_ring-fill: color-mix(in oklch, var(--ui-x-ring-color) var(--ring-opacity), transparent);
|
|
387
|
-
*
|
|
388
|
-
* 0 0 0 var(--_ring-offset-width) var(--ring-offset-shadow-color),
|
|
389
|
-
* 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width)) var(--_ring-fill, var(--ring-shadow-color)),
|
|
390
|
-
* var(--
|
|
388
|
+
* --_focus-shadow:
|
|
389
|
+
* 0 0 0 calc(var(--_ring-offset-width) * (1 - var(--_focus-in))) var(--ring-offset-shadow-color),
|
|
390
|
+
* 0 0 0 calc((var(--_ring-offset-width) + var(--_ring-width)) * (1 - var(--_focus-in))) var(--_ring-fill, var(--ring-shadow-color)),
|
|
391
|
+
* inset 0 0 0 calc(var(--_ring-offset-width) * var(--_focus-in)) var(--ring-offset-shadow-color),
|
|
392
|
+
* inset 0 0 0 calc((var(--_ring-offset-width) + var(--_ring-width)) * var(--_focus-in)) var(--_ring-fill, var(--ring-shadow-color));
|
|
393
|
+
* box-shadow: var(--_focus-shadow, 0 0 #0000), var(--_shadow-resolved, var(--ui-x-shadow));
|
|
391
394
|
*
|
|
392
395
|
* …then grow it in the focus rule:
|
|
393
396
|
*
|
|
394
397
|
* --_ring-offset-width: var(--ring-offset-width);
|
|
395
|
-
* --_ring-width: var(--ring-width);
|
|
398
|
+
* --_ring-width: abs(var(--_focus-ring-w, var(--ring-width)));
|
|
396
399
|
* outline-color: transparent;
|
|
397
400
|
*
|
|
398
|
-
*
|
|
401
|
+
* The outset and inset pairs are weighted by --_focus-in, so a negative
|
|
402
|
+
* --focus-ring utility draws the ring inside the box (and the outline twin
|
|
403
|
+
* takes a negative offset to match). --_ring-fill is optional: omit it and
|
|
404
|
+
* the ring falls back to --ring-shadow-color. */
|
|
399
405
|
/* --ring, --ring-color, and --ring-offset-color are utility names,
|
|
400
406
|
* registered non-inheriting, so the ring's theme color is --color-ring (with
|
|
401
407
|
* the other roles above); the kit reads it through the inheriting
|
|
@@ -455,31 +461,52 @@
|
|
|
455
461
|
/* falls back to easeOutQuart when linear() easing is unsupported */
|
|
456
462
|
--default-transition-timing-function: var(--spring-easing, var(--bezier-easing));
|
|
457
463
|
--default-transition-duration: var(--spring-duration, 0.333s);
|
|
458
|
-
--default-transition:
|
|
459
|
-
text-decoration-
|
|
460
|
-
|
|
464
|
+
--default-transition-property-colors:
|
|
465
|
+
text-decoration-color, background-color, border-color, color, fill, stroke;
|
|
466
|
+
--default-transition-property-transforms: transform, translate, scale, rotate;
|
|
467
|
+
--default-transition-property-effects:
|
|
468
|
+
opacity, filter, -webkit-backdrop-filter, backdrop-filter, box-shadow;
|
|
469
|
+
--default-transition-property-discrete: display, content-visibility, overlay, pointer-events;
|
|
470
|
+
--default-transition-property:
|
|
471
|
+
var(--default-transition-property-colors), var(--default-transition-property-transforms),
|
|
472
|
+
var(--default-transition-property-effects), var(--default-transition-property-discrete);
|
|
473
|
+
|
|
474
|
+
--default-transition-colors:
|
|
461
475
|
text-decoration-color var(--default-transition-duration)
|
|
462
476
|
var(--default-transition-timing-function),
|
|
463
|
-
box-shadow var(--default-transition-duration) var(--default-transition-timing-function),
|
|
464
477
|
background-color var(--default-transition-duration) var(--default-transition-timing-function),
|
|
465
478
|
border-color var(--default-transition-duration) var(--default-transition-timing-function),
|
|
466
|
-
opacity var(--default-transition-duration) var(--default-transition-timing-function),
|
|
467
479
|
color var(--default-transition-duration) var(--default-transition-timing-function),
|
|
468
480
|
fill var(--default-transition-duration) var(--default-transition-timing-function),
|
|
469
|
-
stroke var(--default-transition-duration) var(--default-transition-timing-function)
|
|
481
|
+
stroke var(--default-transition-duration) var(--default-transition-timing-function);
|
|
482
|
+
|
|
483
|
+
--default-transition-transforms:
|
|
470
484
|
transform var(--default-transition-duration) var(--default-transition-timing-function),
|
|
471
485
|
translate var(--default-transition-duration) var(--default-transition-timing-function),
|
|
472
486
|
scale var(--default-transition-duration) var(--default-transition-timing-function),
|
|
473
|
-
rotate var(--default-transition-duration) var(--default-transition-timing-function)
|
|
487
|
+
rotate var(--default-transition-duration) var(--default-transition-timing-function);
|
|
488
|
+
|
|
489
|
+
--default-transition-effects:
|
|
490
|
+
opacity var(--default-transition-duration) var(--default-transition-timing-function),
|
|
474
491
|
filter var(--default-transition-duration) var(--default-transition-timing-function),
|
|
475
492
|
-webkit-backdrop-filter var(--default-transition-duration)
|
|
476
493
|
var(--default-transition-timing-function),
|
|
477
494
|
backdrop-filter var(--default-transition-duration) var(--default-transition-timing-function),
|
|
478
|
-
|
|
495
|
+
box-shadow var(--default-transition-duration) var(--default-transition-timing-function);
|
|
496
|
+
|
|
497
|
+
--default-transition-content:
|
|
498
|
+
display var(--default-transition-duration) var(--default-transition-timing-function)
|
|
499
|
+
allow-discrete,
|
|
479
500
|
content-visibility var(--default-transition-duration)
|
|
480
|
-
var(--default-transition-timing-function),
|
|
481
|
-
overlay var(--default-transition-duration) var(--default-transition-timing-function)
|
|
482
|
-
|
|
501
|
+
var(--default-transition-timing-function) allow-discrete,
|
|
502
|
+
overlay var(--default-transition-duration) var(--default-transition-timing-function)
|
|
503
|
+
allow-discrete,
|
|
504
|
+
pointer-events var(--default-transition-duration) var(--default-transition-timing-function)
|
|
505
|
+
allow-discrete;
|
|
506
|
+
|
|
507
|
+
--default-transition:
|
|
508
|
+
var(--default-transition-colors), var(--default-transition-transforms),
|
|
509
|
+
var(--default-transition-effects), var(--default-transition-content);
|
|
483
510
|
}
|
|
484
511
|
|
|
485
512
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -513,62 +540,96 @@
|
|
|
513
540
|
* the ancestor, so re-assert them at each scope boundary.
|
|
514
541
|
*/
|
|
515
542
|
|
|
516
|
-
[data-ui-
|
|
543
|
+
[data-ui~="theme-dark"] {
|
|
517
544
|
color-scheme: dark;
|
|
518
545
|
color: var(--color-foreground);
|
|
519
546
|
}
|
|
520
547
|
|
|
521
|
-
[data-ui-
|
|
548
|
+
[data-ui~="theme-light"] {
|
|
522
549
|
color-scheme: light;
|
|
523
550
|
color: var(--color-foreground);
|
|
524
551
|
}
|
|
525
552
|
}
|
|
526
553
|
|
|
527
554
|
/* Shadows: here, not in the :root block above, so the same rule re-declares
|
|
528
|
-
them wherever a --shadow-hue style utility is set. A
|
|
529
|
-
where it is declared, so the element and its subtree
|
|
530
|
-
|
|
555
|
+
them wherever a --shadow-hue or --shadow-angle style utility is set. A
|
|
556
|
+
token's var() resolves where it is declared, so the element and its subtree
|
|
557
|
+
get shadows tinted with that hue and cast at that angle (0deg down,
|
|
558
|
+
clockwise): a --shadow keyword, var(--shadow-md), and any primitive's shadow.
|
|
559
|
+
--_shadow-x and -y are the cast direction, one pixel long. */
|
|
531
560
|
@layer variables {
|
|
532
561
|
:root,
|
|
533
|
-
:where([style*="--shadow-hue:"]) {
|
|
562
|
+
:where([style*="--shadow-hue:"], [style*="--shadow-angle"]) {
|
|
563
|
+
--_shadow-x: calc(-1px * sin(var(--_shadow-angle-resolved, 0deg)));
|
|
564
|
+
--_shadow-y: calc(1px * cos(var(--_shadow-angle-resolved, 0deg)));
|
|
534
565
|
--shadow-2xs:
|
|
535
|
-
|
|
566
|
+
calc(1 * var(--_shadow-x)) calc(1 * var(--_shadow-y)) 1px 0
|
|
567
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.04),
|
|
536
568
|
0 0 1px 0 oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.05);
|
|
537
569
|
--shadow-xs:
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
570
|
+
calc(8 * var(--_shadow-x)) calc(8 * var(--_shadow-y)) 2px 0
|
|
571
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0),
|
|
572
|
+
calc(5 * var(--_shadow-x)) calc(5 * var(--_shadow-y)) 2px 0
|
|
573
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.01),
|
|
574
|
+
calc(3 * var(--_shadow-x)) calc(3 * var(--_shadow-y)) 2px 0
|
|
575
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.03),
|
|
576
|
+
calc(1 * var(--_shadow-x)) calc(1 * var(--_shadow-y)) 1px 0
|
|
577
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.04),
|
|
542
578
|
0 0 1px 0 oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.05);
|
|
543
579
|
--shadow-sm:
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
580
|
+
calc(25 * var(--_shadow-x)) calc(25 * var(--_shadow-y)) 7px 0
|
|
581
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0),
|
|
582
|
+
calc(16 * var(--_shadow-x)) calc(16 * var(--_shadow-y)) 6px 0
|
|
583
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.01),
|
|
584
|
+
calc(9 * var(--_shadow-x)) calc(9 * var(--_shadow-y)) 5px 0
|
|
585
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.03),
|
|
586
|
+
calc(4 * var(--_shadow-x)) calc(4 * var(--_shadow-y)) 4px 0
|
|
587
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.04),
|
|
588
|
+
calc(1 * var(--_shadow-x)) calc(1 * var(--_shadow-y)) 2px 0
|
|
589
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.05);
|
|
549
590
|
--shadow-md:
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
591
|
+
calc(66 * var(--_shadow-x)) calc(66 * var(--_shadow-y)) 18px 0
|
|
592
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0),
|
|
593
|
+
calc(42 * var(--_shadow-x)) calc(42 * var(--_shadow-y)) 17px 0
|
|
594
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.01),
|
|
595
|
+
calc(24 * var(--_shadow-x)) calc(24 * var(--_shadow-y)) 14px 0
|
|
596
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.03),
|
|
597
|
+
calc(11 * var(--_shadow-x)) calc(11 * var(--_shadow-y)) 11px 0
|
|
598
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.04),
|
|
599
|
+
calc(3 * var(--_shadow-x)) calc(3 * var(--_shadow-y)) 6px 0
|
|
600
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.05);
|
|
555
601
|
--shadow-lg:
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
602
|
+
calc(247 * var(--_shadow-x)) calc(247 * var(--_shadow-y)) 69px 0
|
|
603
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0),
|
|
604
|
+
calc(158 * var(--_shadow-x)) calc(158 * var(--_shadow-y)) 63px 0
|
|
605
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.01),
|
|
606
|
+
calc(89 * var(--_shadow-x)) calc(89 * var(--_shadow-y)) 53px 0
|
|
607
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.03),
|
|
608
|
+
calc(39 * var(--_shadow-x)) calc(39 * var(--_shadow-y)) 39px 0
|
|
609
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.05),
|
|
610
|
+
calc(10 * var(--_shadow-x)) calc(10 * var(--_shadow-y)) 22px 0
|
|
611
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.06);
|
|
561
612
|
--shadow-xl:
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
613
|
+
calc(370 * var(--_shadow-x)) calc(370 * var(--_shadow-y)) 104px 0
|
|
614
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0),
|
|
615
|
+
calc(237 * var(--_shadow-x)) calc(237 * var(--_shadow-y)) 95px 0
|
|
616
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.01),
|
|
617
|
+
calc(133 * var(--_shadow-x)) calc(133 * var(--_shadow-y)) 80px 0
|
|
618
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.04),
|
|
619
|
+
calc(59 * var(--_shadow-x)) calc(59 * var(--_shadow-y)) 59px 0
|
|
620
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.06),
|
|
621
|
+
calc(15 * var(--_shadow-x)) calc(15 * var(--_shadow-y)) 33px 0
|
|
622
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.07);
|
|
567
623
|
--shadow-2xl:
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
624
|
+
calc(555 * var(--_shadow-x)) calc(555 * var(--_shadow-y)) 156px 0
|
|
625
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0),
|
|
626
|
+
calc(356 * var(--_shadow-x)) calc(356 * var(--_shadow-y)) 143px 0
|
|
627
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.01),
|
|
628
|
+
calc(200 * var(--_shadow-x)) calc(200 * var(--_shadow-y)) 120px 0
|
|
629
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.04),
|
|
630
|
+
calc(89 * var(--_shadow-x)) calc(89 * var(--_shadow-y)) 89px 0
|
|
631
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.06),
|
|
632
|
+
calc(23 * var(--_shadow-x)) calc(23 * var(--_shadow-y)) 50px 0
|
|
633
|
+
oklch(from var(--shadow-hue, var(--color-shadow)) l c h / 0.08);
|
|
573
634
|
}
|
|
574
635
|
}
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description True when the browser dismisses `closedby="any"` dialogs itself.
|
|
3
|
+
* The property alone is not proof: Safari 26 has `closedBy` with `none` and
|
|
4
|
+
* `closerequest` but not `any`, so `any` must round-trip through the reflected
|
|
5
|
+
* property, which keeps only the keywords the engine knows.
|
|
6
|
+
*/
|
|
7
|
+
declare function hasNativeLightDismiss(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @description The open `closedby="any"` dialog whose backdrop `event` hit, or
|
|
10
|
+
* null. A backdrop hit targets the dialog element itself at a point outside
|
|
11
|
+
* its box; a hit inside the box targets a descendant, or the dialog's own
|
|
12
|
+
* padding, which must not dismiss.
|
|
13
|
+
*
|
|
14
|
+
* @param event - A pointer or mouse event, read for its target and position.
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
declare function backdropHit(event: Event): HTMLDialogElement | null;
|
|
1
18
|
interface InitDialogLifecycleFn {
|
|
2
19
|
(): void;
|
|
3
20
|
_bound?: boolean;
|
|
@@ -7,5 +24,5 @@ interface InitDialogLifecycleFn {
|
|
|
7
24
|
* from double script loads.
|
|
8
25
|
*/
|
|
9
26
|
declare const initDialogLifecycle: InitDialogLifecycleFn;
|
|
10
|
-
export { initDialogLifecycle };
|
|
27
|
+
export { backdropHit, hasNativeLightDismiss, initDialogLifecycle };
|
|
11
28
|
//# sourceMappingURL=dialog-lifecycle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-lifecycle.d.ts","sourceRoot":"","sources":["dialog-lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialog-lifecycle.d.ts","sourceRoot":"","sources":["dialog-lifecycle.ts"],"names":[],"mappings":"AAqCA;;;;;GAKG;AACH,iBAAS,qBAAqB,IAAI,OAAO,CAOxC;AAED;;;;;;;;GAQG;AACH,iBAAS,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,iBAAiB,GAAG,IAAI,CAQ3D;AAmCD,UAAU,qBAAqB;IAC7B,IAAI,IAAI,CAAC;IACT,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,QAAA,MAAM,mBAAmB,EAAE,qBAgC1B,CAAC;AAYF,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -18,11 +18,80 @@
|
|
|
18
18
|
* choreography (ancestor and document level).
|
|
19
19
|
*
|
|
20
20
|
* No `detail` payload: the dialog is the event target.
|
|
21
|
+
*
|
|
22
|
+
* It also fills in light dismiss where the browser lacks it. `closedby="any"`
|
|
23
|
+
* (Chrome 134, Firefox 141) lets a tap on the backdrop close a modal dialog;
|
|
24
|
+
* Safari 26 knows `closedby` but only its `none` and `closerequest` values, so
|
|
25
|
+
* `any` falls back to `closerequest` and the backdrop does nothing there. Where
|
|
26
|
+
* `any` is not supported, a backdrop tap on a `closedby="any"` dialog closes it
|
|
27
|
+
* here, with native semantics: the press and the release both land on the
|
|
28
|
+
* backdrop, and the dialog gets a `cancel` through `requestClose()` where that
|
|
29
|
+
* exists.
|
|
21
30
|
*/
|
|
22
31
|
/** Dispatches a bubbling lifecycle event on a dialog. */
|
|
23
32
|
function emit(dialog, type) {
|
|
24
33
|
dialog.dispatchEvent(new Event(type, { bubbles: true }));
|
|
25
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* @description True when the browser dismisses `closedby="any"` dialogs itself.
|
|
37
|
+
* The property alone is not proof: Safari 26 has `closedBy` with `none` and
|
|
38
|
+
* `closerequest` but not `any`, so `any` must round-trip through the reflected
|
|
39
|
+
* property, which keeps only the keywords the engine knows.
|
|
40
|
+
*/
|
|
41
|
+
function hasNativeLightDismiss() {
|
|
42
|
+
if (typeof HTMLDialogElement === "undefined" || !("closedBy" in HTMLDialogElement.prototype)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const probe = document.createElement("dialog");
|
|
46
|
+
probe.setAttribute("closedby", "any");
|
|
47
|
+
return probe.closedBy === "any";
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @description The open `closedby="any"` dialog whose backdrop `event` hit, or
|
|
51
|
+
* null. A backdrop hit targets the dialog element itself at a point outside
|
|
52
|
+
* its box; a hit inside the box targets a descendant, or the dialog's own
|
|
53
|
+
* padding, which must not dismiss.
|
|
54
|
+
*
|
|
55
|
+
* @param event - A pointer or mouse event, read for its target and position.
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
function backdropHit(event) {
|
|
59
|
+
const dialog = event.target;
|
|
60
|
+
if (!(dialog instanceof HTMLDialogElement) || !dialog.open)
|
|
61
|
+
return null;
|
|
62
|
+
if (dialog.getAttribute("closedby") !== "any")
|
|
63
|
+
return null;
|
|
64
|
+
const { clientX: x, clientY: y } = event;
|
|
65
|
+
const box = dialog.getBoundingClientRect();
|
|
66
|
+
const outside = x < box.left || x > box.right || y < box.top || y > box.bottom;
|
|
67
|
+
return outside ? dialog : null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @description Binds the backdrop-tap fallback for browsers without
|
|
71
|
+
* `closedby="any"`. The press and the release must both land on the backdrop,
|
|
72
|
+
* as in the native algorithm, so a drag from inside the dialog out to the
|
|
73
|
+
* backdrop does not dismiss. Pointer events, not `click`: iOS Safari does not
|
|
74
|
+
* deliver a delegated `click` from a non-interactive element such as a dialog's
|
|
75
|
+
* backdrop, but it does deliver `pointerup`.
|
|
76
|
+
*
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
function bindLightDismissFallback() {
|
|
80
|
+
let pressed = null;
|
|
81
|
+
document.addEventListener("pointerdown", (event) => {
|
|
82
|
+
pressed = backdropHit(event);
|
|
83
|
+
}, true);
|
|
84
|
+
document.addEventListener("pointerup", (event) => {
|
|
85
|
+
const dialog = backdropHit(event);
|
|
86
|
+
if (dialog && dialog === pressed) {
|
|
87
|
+
if (typeof dialog.requestClose === "function")
|
|
88
|
+
dialog.requestClose();
|
|
89
|
+
else
|
|
90
|
+
dialog.close();
|
|
91
|
+
}
|
|
92
|
+
pressed = null;
|
|
93
|
+
}, true);
|
|
94
|
+
}
|
|
26
95
|
/**
|
|
27
96
|
* @description Starts the page-wide dialog watcher. Idempotent and safe to call
|
|
28
97
|
* from double script loads.
|
|
@@ -51,6 +120,8 @@ const initDialogLifecycle = function () {
|
|
|
51
120
|
if (e.target instanceof HTMLDialogElement)
|
|
52
121
|
emit(e.target, "zazz:dialog-close");
|
|
53
122
|
}, true);
|
|
123
|
+
if (!hasNativeLightDismiss())
|
|
124
|
+
bindLightDismissFallback();
|
|
54
125
|
};
|
|
55
126
|
// Auto-initialize when DOM is ready (only in browser environment)
|
|
56
127
|
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
@@ -62,4 +133,4 @@ if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
|
62
133
|
}
|
|
63
134
|
}
|
|
64
135
|
// Exported for tests and manual bootstrapping; the events are the public API.
|
|
65
|
-
export { initDialogLifecycle };
|
|
136
|
+
export { backdropHit, hasNativeLightDismiss, initDialogLifecycle };
|