@zazz-ui/core 0.8.1 → 0.8.3
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/CHANGELOG.md +34 -0
- package/README.md +2 -2
- package/dist/sri.json +47 -47
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +1964 -592
- package/editor/zazz.language-data.json +24 -16
- package/editor/zazz.lint-data.json +588 -567
- package/package.json +1 -1
- package/src/base/_defaults.css +5 -0
- package/src/base/_properties-2xl.css +4 -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 +4 -0
- package/src/base/_properties-md.css +4 -0
- package/src/base/_properties-open.css +12 -0
- package/src/base/_properties-sm.css +4 -0
- package/src/base/_properties-starting.css +6 -0
- package/src/base/_properties-stuck.css +6 -0
- package/src/base/_properties-xl.css +4 -0
- package/src/base/_properties.css +16 -0
- package/src/base/_shadows.css +17 -17
- package/src/base/_utilities-box.css +2 -2
- package/src/base/_utilities-spacing.css +42 -0
- package/src/base/_utilities-tier-2xl.css +2 -0
- 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 +2 -0
- package/src/base/_utilities-tier-md.css +2 -0
- package/src/base/_utilities-tier-open.css +6 -0
- package/src/base/_utilities-tier-sm.css +2 -0
- 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 +2 -0
- package/src/base/_variables.css +2 -2
- package/src/base/embla.d.ts.map +1 -1
- package/src/base/embla.js +48 -5
- package/src/base/embla.ts +63 -5
- package/src/base/kit-styling.d.ts.map +1 -1
- package/src/base/kit-styling.js +118 -116
- package/src/base/kit-styling.ts +118 -116
- package/src/base/utilities.d.ts +5 -2
- package/src/base/utilities.d.ts.map +1 -1
- package/src/base/utilities.js +35 -2
- package/src/base/utilities.ts +49 -4
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +1 -0
- package/src/manifest.ts +1 -0
- package/src/primitives/carousel/carousel.css +8 -7
- package/src/primitives/dialog/dialog.css +54 -0
- package/src/primitives/input/input.css +22 -0
- package/src/primitives/popover/popover.css +2 -2
- package/src/primitives/switch/switch.css +2 -2
- package/src/primitives/utilities/space.html +17 -0
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
--_position-area-focus-visible: var(--position-area--focus-visible);
|
|
9
9
|
--_template-cols-focus-visible: var(--template-cols--focus-visible);
|
|
10
10
|
--_template-rows-focus-visible: var(--template-rows--focus-visible);
|
|
11
|
+
--_space-x-focus-visible: var(--space-x--focus-visible);
|
|
12
|
+
--_space-y-focus-visible: var(--space-y--focus-visible);
|
|
11
13
|
--_text-decoration-focus-visible: var(--text-decoration--focus-visible);
|
|
12
14
|
--_text-focus-visible: var(--text--focus-visible);
|
|
13
15
|
--_bg-focus-visible: var(--bg--focus-visible);
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
--_transition-duration-focus-visible: var(--transition-duration--focus-visible);
|
|
41
43
|
--_transition-delay-focus-visible: var(--transition-delay--focus-visible);
|
|
42
44
|
--_radius-focus-visible: var(--radius--focus-visible);
|
|
45
|
+
--_z-focus-visible: var(--z--focus-visible);
|
|
43
46
|
}
|
|
44
47
|
:where([data-ui~="group"]:focus-visible [style*="--group-"]) {
|
|
45
48
|
--_anchor-name-g-focus-visible: var(--group-anchor-name--focus-visible);
|
|
@@ -47,6 +50,8 @@
|
|
|
47
50
|
--_position-area-g-focus-visible: var(--group-position-area--focus-visible);
|
|
48
51
|
--_template-cols-g-focus-visible: var(--group-template-cols--focus-visible);
|
|
49
52
|
--_template-rows-g-focus-visible: var(--group-template-rows--focus-visible);
|
|
53
|
+
--_space-x-g-focus-visible: var(--group-space-x--focus-visible);
|
|
54
|
+
--_space-y-g-focus-visible: var(--group-space-y--focus-visible);
|
|
50
55
|
--_text-decoration-g-focus-visible: var(--group-text-decoration--focus-visible);
|
|
51
56
|
--_text-g-focus-visible: var(--group-text--focus-visible);
|
|
52
57
|
--_bg-g-focus-visible: var(--group-bg--focus-visible);
|
|
@@ -79,5 +84,6 @@
|
|
|
79
84
|
--_transition-duration-g-focus-visible: var(--group-transition-duration--focus-visible);
|
|
80
85
|
--_transition-delay-g-focus-visible: var(--group-transition-delay--focus-visible);
|
|
81
86
|
--_radius-g-focus-visible: var(--group-radius--focus-visible);
|
|
87
|
+
--_z-g-focus-visible: var(--group-z--focus-visible);
|
|
82
88
|
}
|
|
83
89
|
}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
--_position-area-focus-within: var(--position-area--focus-within);
|
|
9
9
|
--_template-cols-focus-within: var(--template-cols--focus-within);
|
|
10
10
|
--_template-rows-focus-within: var(--template-rows--focus-within);
|
|
11
|
+
--_space-x-focus-within: var(--space-x--focus-within);
|
|
12
|
+
--_space-y-focus-within: var(--space-y--focus-within);
|
|
11
13
|
--_text-decoration-focus-within: var(--text-decoration--focus-within);
|
|
12
14
|
--_text-focus-within: var(--text--focus-within);
|
|
13
15
|
--_bg-focus-within: var(--bg--focus-within);
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
--_transition-duration-focus-within: var(--transition-duration--focus-within);
|
|
41
43
|
--_transition-delay-focus-within: var(--transition-delay--focus-within);
|
|
42
44
|
--_radius-focus-within: var(--radius--focus-within);
|
|
45
|
+
--_z-focus-within: var(--z--focus-within);
|
|
43
46
|
}
|
|
44
47
|
:where([data-ui~="group"]:focus-within [style*="--group-"]) {
|
|
45
48
|
--_anchor-name-g-focus-within: var(--group-anchor-name--focus-within);
|
|
@@ -47,6 +50,8 @@
|
|
|
47
50
|
--_position-area-g-focus-within: var(--group-position-area--focus-within);
|
|
48
51
|
--_template-cols-g-focus-within: var(--group-template-cols--focus-within);
|
|
49
52
|
--_template-rows-g-focus-within: var(--group-template-rows--focus-within);
|
|
53
|
+
--_space-x-g-focus-within: var(--group-space-x--focus-within);
|
|
54
|
+
--_space-y-g-focus-within: var(--group-space-y--focus-within);
|
|
50
55
|
--_text-decoration-g-focus-within: var(--group-text-decoration--focus-within);
|
|
51
56
|
--_text-g-focus-within: var(--group-text--focus-within);
|
|
52
57
|
--_bg-g-focus-within: var(--group-bg--focus-within);
|
|
@@ -79,5 +84,6 @@
|
|
|
79
84
|
--_transition-duration-g-focus-within: var(--group-transition-duration--focus-within);
|
|
80
85
|
--_transition-delay-g-focus-within: var(--group-transition-delay--focus-within);
|
|
81
86
|
--_radius-g-focus-within: var(--group-radius--focus-within);
|
|
87
|
+
--_z-g-focus-within: var(--group-z--focus-within);
|
|
82
88
|
}
|
|
83
89
|
}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
--_position-area-hover: var(--position-area--hover);
|
|
10
10
|
--_template-cols-hover: var(--template-cols--hover);
|
|
11
11
|
--_template-rows-hover: var(--template-rows--hover);
|
|
12
|
+
--_space-x-hover: var(--space-x--hover);
|
|
13
|
+
--_space-y-hover: var(--space-y--hover);
|
|
12
14
|
--_text-decoration-hover: var(--text-decoration--hover);
|
|
13
15
|
--_text-hover: var(--text--hover);
|
|
14
16
|
--_bg-hover: var(--bg--hover);
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
--_transition-duration-hover: var(--transition-duration--hover);
|
|
42
44
|
--_transition-delay-hover: var(--transition-delay--hover);
|
|
43
45
|
--_radius-hover: var(--radius--hover);
|
|
46
|
+
--_z-hover: var(--z--hover);
|
|
44
47
|
}
|
|
45
48
|
:where([data-ui~="group"]:hover [style*="--group-"]) {
|
|
46
49
|
--_anchor-name-g-hover: var(--group-anchor-name--hover);
|
|
@@ -48,6 +51,8 @@
|
|
|
48
51
|
--_position-area-g-hover: var(--group-position-area--hover);
|
|
49
52
|
--_template-cols-g-hover: var(--group-template-cols--hover);
|
|
50
53
|
--_template-rows-g-hover: var(--group-template-rows--hover);
|
|
54
|
+
--_space-x-g-hover: var(--group-space-x--hover);
|
|
55
|
+
--_space-y-g-hover: var(--group-space-y--hover);
|
|
51
56
|
--_text-decoration-g-hover: var(--group-text-decoration--hover);
|
|
52
57
|
--_text-g-hover: var(--group-text--hover);
|
|
53
58
|
--_bg-g-hover: var(--group-bg--hover);
|
|
@@ -80,6 +85,7 @@
|
|
|
80
85
|
--_transition-duration-g-hover: var(--group-transition-duration--hover);
|
|
81
86
|
--_transition-delay-g-hover: var(--group-transition-delay--hover);
|
|
82
87
|
--_radius-g-hover: var(--group-radius--hover);
|
|
88
|
+
--_z-g-hover: var(--group-z--hover);
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
91
|
}
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
--_gap-lg: var(--gap--lg);
|
|
45
45
|
--_gap-x-lg: var(--gap-x--lg);
|
|
46
46
|
--_gap-y-lg: var(--gap-y--lg);
|
|
47
|
+
--_space-x-lg: var(--space-x--lg);
|
|
48
|
+
--_space-y-lg: var(--space-y--lg);
|
|
47
49
|
--_inset-lg: var(--inset--lg);
|
|
48
50
|
--_inset-x-lg: var(--inset-x--lg);
|
|
49
51
|
--_inset-y-lg: var(--inset-y--lg);
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
--_gap-md: var(--gap--md);
|
|
45
45
|
--_gap-x-md: var(--gap-x--md);
|
|
46
46
|
--_gap-y-md: var(--gap-y--md);
|
|
47
|
+
--_space-x-md: var(--space-x--md);
|
|
48
|
+
--_space-y-md: var(--space-y--md);
|
|
47
49
|
--_inset-md: var(--inset--md);
|
|
48
50
|
--_inset-x-md: var(--inset-x--md);
|
|
49
51
|
--_inset-y-md: var(--inset-y--md);
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
--_position-area-open: var(--position-area--open);
|
|
9
9
|
--_template-cols-open: var(--template-cols--open);
|
|
10
10
|
--_template-rows-open: var(--template-rows--open);
|
|
11
|
+
--_space-x-open: var(--space-x--open);
|
|
12
|
+
--_space-y-open: var(--space-y--open);
|
|
11
13
|
--_text-decoration-open: var(--text-decoration--open);
|
|
12
14
|
--_text-open: var(--text--open);
|
|
13
15
|
--_bg-open: var(--bg--open);
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
--_transition-duration-open: var(--transition-duration--open);
|
|
41
43
|
--_transition-delay-open: var(--transition-delay--open);
|
|
42
44
|
--_radius-open: var(--radius--open);
|
|
45
|
+
--_z-open: var(--z--open);
|
|
43
46
|
}
|
|
44
47
|
:where([data-ui~="group"]:is([open], :popover-open, [aria-expanded="true"]) [style*="--group-"]) {
|
|
45
48
|
--_anchor-name-g-open: var(--group-anchor-name--open);
|
|
@@ -47,6 +50,8 @@
|
|
|
47
50
|
--_position-area-g-open: var(--group-position-area--open);
|
|
48
51
|
--_template-cols-g-open: var(--group-template-cols--open);
|
|
49
52
|
--_template-rows-g-open: var(--group-template-rows--open);
|
|
53
|
+
--_space-x-g-open: var(--group-space-x--open);
|
|
54
|
+
--_space-y-g-open: var(--group-space-y--open);
|
|
50
55
|
--_text-decoration-g-open: var(--group-text-decoration--open);
|
|
51
56
|
--_text-g-open: var(--group-text--open);
|
|
52
57
|
--_bg-g-open: var(--group-bg--open);
|
|
@@ -79,5 +84,6 @@
|
|
|
79
84
|
--_transition-duration-g-open: var(--group-transition-duration--open);
|
|
80
85
|
--_transition-delay-g-open: var(--group-transition-delay--open);
|
|
81
86
|
--_radius-g-open: var(--group-radius--open);
|
|
87
|
+
--_z-g-open: var(--group-z--open);
|
|
82
88
|
}
|
|
83
89
|
}
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
--_gap-sm: var(--gap--sm);
|
|
45
45
|
--_gap-x-sm: var(--gap-x--sm);
|
|
46
46
|
--_gap-y-sm: var(--gap-y--sm);
|
|
47
|
+
--_space-x-sm: var(--space-x--sm);
|
|
48
|
+
--_space-y-sm: var(--space-y--sm);
|
|
47
49
|
--_inset-sm: var(--inset--sm);
|
|
48
50
|
--_inset-x-sm: var(--inset-x--sm);
|
|
49
51
|
--_inset-y-sm: var(--inset-y--sm);
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
--_position-area-starting: var(--position-area--starting);
|
|
10
10
|
--_template-cols-starting: var(--template-cols--starting);
|
|
11
11
|
--_template-rows-starting: var(--template-rows--starting);
|
|
12
|
+
--_space-x-starting: var(--space-x--starting);
|
|
13
|
+
--_space-y-starting: var(--space-y--starting);
|
|
12
14
|
--_text-decoration-starting: var(--text-decoration--starting);
|
|
13
15
|
--_text-starting: var(--text--starting);
|
|
14
16
|
--_bg-starting: var(--bg--starting);
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
--_transition-duration-starting: var(--transition-duration--starting);
|
|
42
44
|
--_transition-delay-starting: var(--transition-delay--starting);
|
|
43
45
|
--_radius-starting: var(--radius--starting);
|
|
46
|
+
--_z-starting: var(--z--starting);
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
}
|
|
@@ -89,6 +89,8 @@
|
|
|
89
89
|
--_position-area-stuck: var(--_stuck-on) var(--position-area--stuck);
|
|
90
90
|
--_template-cols-stuck: var(--_stuck-on) var(--template-cols--stuck);
|
|
91
91
|
--_template-rows-stuck: var(--_stuck-on) var(--template-rows--stuck);
|
|
92
|
+
--_space-x-stuck: var(--_stuck-on) var(--space-x--stuck);
|
|
93
|
+
--_space-y-stuck: var(--_stuck-on) var(--space-y--stuck);
|
|
92
94
|
--_text-decoration-stuck: var(--_stuck-on) var(--text-decoration--stuck);
|
|
93
95
|
--_text-stuck: var(--_stuck-on) var(--text--stuck);
|
|
94
96
|
--_bg-stuck: var(--_stuck-on) var(--bg--stuck);
|
|
@@ -121,5 +123,6 @@
|
|
|
121
123
|
--_transition-duration-stuck: var(--_stuck-on) var(--transition-duration--stuck);
|
|
122
124
|
--_transition-delay-stuck: var(--_stuck-on) var(--transition-delay--stuck);
|
|
123
125
|
--_radius-stuck: var(--_stuck-on) var(--radius--stuck);
|
|
126
|
+
--_z-stuck: var(--_stuck-on) var(--z--stuck);
|
|
124
127
|
}
|
|
125
128
|
}
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
--_gap-xl: var(--gap--xl);
|
|
45
45
|
--_gap-x-xl: var(--gap-x--xl);
|
|
46
46
|
--_gap-y-xl: var(--gap-y--xl);
|
|
47
|
+
--_space-x-xl: var(--space-x--xl);
|
|
48
|
+
--_space-y-xl: var(--space-y--xl);
|
|
47
49
|
--_inset-xl: var(--inset--xl);
|
|
48
50
|
--_inset-x-xl: var(--inset-x--xl);
|
|
49
51
|
--_inset-y-xl: var(--inset-y--xl);
|
package/src/base/_variables.css
CHANGED
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
|
|
163
163
|
/* shade — darkened overlays (derived from neutral-950) */
|
|
164
164
|
--color-shade-none: oklch(from var(--color-neutral-950) l c h / 0);
|
|
165
|
-
--color-shade-50: oklch(from var(--color-neutral-950) l c h / 0.
|
|
165
|
+
--color-shade-50: oklch(from var(--color-neutral-950) l c h / 0.05);
|
|
166
166
|
--color-shade-100: oklch(from var(--color-neutral-950) l c h / 0.1);
|
|
167
167
|
--color-shade-200: oklch(from var(--color-neutral-950) l c h / 0.2);
|
|
168
168
|
--color-shade-300: oklch(from var(--color-neutral-950) l c h / 0.3);
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
|
|
178
178
|
/* tint — faded overlays (derived from white) */
|
|
179
179
|
--color-tint-none: oklch(from var(--color-white) l c h / 0);
|
|
180
|
-
--color-tint-50: oklch(from var(--color-white) l c h / 0.
|
|
180
|
+
--color-tint-50: oklch(from var(--color-white) l c h / 0.05);
|
|
181
181
|
--color-tint-100: oklch(from var(--color-white) l c h / 0.1);
|
|
182
182
|
--color-tint-200: oklch(from var(--color-white) l c h / 0.2);
|
|
183
183
|
--color-tint-300: oklch(from var(--color-white) l c h / 0.3);
|
package/src/base/embla.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embla.d.ts","sourceRoot":"","sources":["embla.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"embla.d.ts","sourceRoot":"","sources":["embla.ts"],"names":[],"mappings":"AAiFA,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,gBAAgB,CAAC;AAa3F;;;;;;GAMG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,EAAE,CAG5D;AA4FD;;;;;;;;;;GAUG;AACH,iBAAS,cAAc,CACrB,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC,IAAI,CAWN;AAID;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,aACpB,iBAAiB,YACjB,OAAO,WACR,WAAW,KACnB,CAAC,MAAM,IAAI,CAAC,GAAG,SA4DjB,CAAC;AAIF;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB,iBACX,iBAAiB,iBAChB,iBAAiB,WACvB,WAAW,SAcrB,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,qBAAqB,iBACX,iBAAiB,iBAChB,iBAAiB,SAiBjC,CAAC;AAmJF;;;;;;;;;;;;GAYG;AACH,iBAAS,aAAa,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAwJ/C;AAED;;;;;;;;GAQG;AACH,iBAAS,kBAAkB,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAW5D;AAwGD;;;;;;;;;GASG;AACH,QAAA,MAAM,SAAS;;;;;;CAMd,CAAC;AA2EF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC"}
|
package/src/base/embla.js
CHANGED
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
* - `data-carousel-auto-scroll-*`: Auto scroll plugin options (requires `auto-scroll` in plugins)
|
|
33
33
|
* - `data-carousel-class-names-*`: Class names plugin options (requires `class-names` in plugins)
|
|
34
34
|
*
|
|
35
|
+
* Prev/Next, the dots, the thumbs, and the arrow keys count as interaction for
|
|
36
|
+
* Autoplay and Auto Scroll: they stop the plugin, or restart its delay with
|
|
37
|
+
* `data-carousel-autoplay-stop-on-interaction="false"`.
|
|
38
|
+
*
|
|
35
39
|
* @see https://www.embla-carousel.com/docs/api/options#reference
|
|
36
40
|
* @see https://www.embla-carousel.com/docs/plugins/autoplay#options
|
|
37
41
|
* @see https://www.embla-carousel.com/docs/plugins/auto-scroll#options
|
|
@@ -111,6 +115,27 @@ const PLUGIN_BY_SLUG = {
|
|
|
111
115
|
function readCarouselOptions(node, prefix) {
|
|
112
116
|
return Utils.parseDataAttributes(node, prefix);
|
|
113
117
|
}
|
|
118
|
+
// --- Manual navigation ---
|
|
119
|
+
/**
|
|
120
|
+
* @description Treats a manual step (Prev/Next, a dot, a thumb, an arrow key) as
|
|
121
|
+
* user interaction for the Autoplay and Auto Scroll plugins, which on their own
|
|
122
|
+
* only count a pointer-down on the viewport. Without it the plugin's timer keeps
|
|
123
|
+
* running, and a tick that lands just after a click moves a second slide.
|
|
124
|
+
* `stopOnInteraction` (default true) stops the plugin; `false` restarts its delay.
|
|
125
|
+
* This is the pattern Embla's own examples use for navigation buttons.
|
|
126
|
+
* @private
|
|
127
|
+
*/
|
|
128
|
+
function onManualNavigation(emblaApi) {
|
|
129
|
+
const { autoplay, autoScroll } = emblaApi.plugins();
|
|
130
|
+
for (const plugin of [autoplay, autoScroll]) {
|
|
131
|
+
if (!plugin)
|
|
132
|
+
continue;
|
|
133
|
+
if (plugin.options.stopOnInteraction === false)
|
|
134
|
+
plugin.reset();
|
|
135
|
+
else
|
|
136
|
+
plugin.stop();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
114
139
|
// --- Active-index sync ---
|
|
115
140
|
/**
|
|
116
141
|
* @description Adds or removes one token of an element's `data-carousel-state`
|
|
@@ -201,7 +226,10 @@ const addDotBtnsAndClickHandlers = (emblaApi, dotsNode, signal) => {
|
|
|
201
226
|
const dot = templateDot.cloneNode(true);
|
|
202
227
|
dotNodes.push(dot);
|
|
203
228
|
dotsNode.appendChild(dot);
|
|
204
|
-
dot.addEventListener("click", () =>
|
|
229
|
+
dot.addEventListener("click", () => {
|
|
230
|
+
onManualNavigation(emblaApi);
|
|
231
|
+
emblaApi.scrollTo(i);
|
|
232
|
+
}, { signal });
|
|
205
233
|
}
|
|
206
234
|
};
|
|
207
235
|
/**
|
|
@@ -235,7 +263,10 @@ const addDotBtnsAndClickHandlers = (emblaApi, dotsNode, signal) => {
|
|
|
235
263
|
const addThumbClickHandlers = (emblaApiMain, emblaApiThumb, signal) => {
|
|
236
264
|
const slidesthumbs = emblaApiThumb.slideNodes();
|
|
237
265
|
slidesthumbs.forEach((slideNode, index) => {
|
|
238
|
-
slideNode.addEventListener("click", () =>
|
|
266
|
+
slideNode.addEventListener("click", () => {
|
|
267
|
+
onManualNavigation(emblaApiMain);
|
|
268
|
+
emblaApiMain.scrollTo(index);
|
|
269
|
+
}, { signal });
|
|
239
270
|
});
|
|
240
271
|
};
|
|
241
272
|
/**
|
|
@@ -434,14 +465,19 @@ function initEmblaRoot(emblaNode) {
|
|
|
434
465
|
}
|
|
435
466
|
// The options come from untyped data attributes; Embla validates at runtime.
|
|
436
467
|
const emblaApi = EmblaCarousel(emblaViewportNode, apiOptions, plugins);
|
|
437
|
-
// Drag state is a data-carousel-state token on the viewport
|
|
468
|
+
// Drag state is a data-carousel-state token on the viewport, and
|
|
469
|
+
// data-ui-dragging on the root for the page-wide grabbing cursor (a
|
|
470
|
+
// `body:has(…) *` rule would restyle the whole page on every DOM insertion).
|
|
471
|
+
const root = emblaNode.ownerDocument.documentElement;
|
|
438
472
|
emblaApi.on("pointerDown", () => {
|
|
439
473
|
if (emblaViewportNode)
|
|
440
474
|
setCarouselState(emblaViewportNode, "dragging", true);
|
|
475
|
+
root.setAttribute("data-ui-dragging", "");
|
|
441
476
|
});
|
|
442
477
|
emblaApi.on("pointerUp", () => {
|
|
443
478
|
if (emblaViewportNode)
|
|
444
479
|
setCarouselState(emblaViewportNode, "dragging", false);
|
|
480
|
+
root.removeAttribute("data-ui-dragging");
|
|
445
481
|
});
|
|
446
482
|
bindSlideStates(emblaApi);
|
|
447
483
|
emblaNode._emblaApi = emblaApi;
|
|
@@ -452,10 +488,16 @@ function initEmblaRoot(emblaNode) {
|
|
|
452
488
|
const { signal } = controller;
|
|
453
489
|
emblaNode._emblaController = controller;
|
|
454
490
|
if (emblaPrevButtonNode) {
|
|
455
|
-
emblaPrevButtonNode.addEventListener("click", () =>
|
|
491
|
+
emblaPrevButtonNode.addEventListener("click", () => {
|
|
492
|
+
onManualNavigation(emblaApi);
|
|
493
|
+
emblaApi.scrollPrev();
|
|
494
|
+
}, { signal });
|
|
456
495
|
}
|
|
457
496
|
if (emblaNextButtonNode) {
|
|
458
|
-
emblaNextButtonNode.addEventListener("click", () =>
|
|
497
|
+
emblaNextButtonNode.addEventListener("click", () => {
|
|
498
|
+
onManualNavigation(emblaApi);
|
|
499
|
+
emblaApi.scrollNext();
|
|
500
|
+
}, { signal });
|
|
459
501
|
}
|
|
460
502
|
if (emblaDotsNode) {
|
|
461
503
|
addDotBtnsAndClickHandlers(emblaApi, emblaDotsNode, signal);
|
|
@@ -584,6 +626,7 @@ const initEmblaKeyboardNav = function () {
|
|
|
584
626
|
if (!root)
|
|
585
627
|
return;
|
|
586
628
|
e.preventDefault();
|
|
629
|
+
onManualNavigation(root._emblaApi);
|
|
587
630
|
if (e.key === "ArrowLeft")
|
|
588
631
|
root._emblaApi.scrollPrev();
|
|
589
632
|
else
|
package/src/base/embla.ts
CHANGED
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
* - `data-carousel-auto-scroll-*`: Auto scroll plugin options (requires `auto-scroll` in plugins)
|
|
34
34
|
* - `data-carousel-class-names-*`: Class names plugin options (requires `class-names` in plugins)
|
|
35
35
|
*
|
|
36
|
+
* Prev/Next, the dots, the thumbs, and the arrow keys count as interaction for
|
|
37
|
+
* Autoplay and Auto Scroll: they stop the plugin, or restart its delay with
|
|
38
|
+
* `data-carousel-autoplay-stop-on-interaction="false"`.
|
|
39
|
+
*
|
|
36
40
|
* @see https://www.embla-carousel.com/docs/api/options#reference
|
|
37
41
|
* @see https://www.embla-carousel.com/docs/plugins/autoplay#options
|
|
38
42
|
* @see https://www.embla-carousel.com/docs/plugins/auto-scroll#options
|
|
@@ -135,6 +139,26 @@ function readCarouselOptions<T>(node: Element, prefix: string): T {
|
|
|
135
139
|
return Utils.parseDataAttributes(node, prefix) as T;
|
|
136
140
|
}
|
|
137
141
|
|
|
142
|
+
// --- Manual navigation ---
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @description Treats a manual step (Prev/Next, a dot, a thumb, an arrow key) as
|
|
146
|
+
* user interaction for the Autoplay and Auto Scroll plugins, which on their own
|
|
147
|
+
* only count a pointer-down on the viewport. Without it the plugin's timer keeps
|
|
148
|
+
* running, and a tick that lands just after a click moves a second slide.
|
|
149
|
+
* `stopOnInteraction` (default true) stops the plugin; `false` restarts its delay.
|
|
150
|
+
* This is the pattern Embla's own examples use for navigation buttons.
|
|
151
|
+
* @private
|
|
152
|
+
*/
|
|
153
|
+
function onManualNavigation(emblaApi: EmblaCarouselType): void {
|
|
154
|
+
const { autoplay, autoScroll } = emblaApi.plugins();
|
|
155
|
+
for (const plugin of [autoplay, autoScroll]) {
|
|
156
|
+
if (!plugin) continue;
|
|
157
|
+
if (plugin.options.stopOnInteraction === false) plugin.reset();
|
|
158
|
+
else plugin.stop();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
138
162
|
// --- Active-index sync ---
|
|
139
163
|
|
|
140
164
|
/**
|
|
@@ -241,7 +265,14 @@ const addDotBtnsAndClickHandlers = (
|
|
|
241
265
|
dotNodes.push(dot);
|
|
242
266
|
dotsNode.appendChild(dot);
|
|
243
267
|
|
|
244
|
-
dot.addEventListener(
|
|
268
|
+
dot.addEventListener(
|
|
269
|
+
"click",
|
|
270
|
+
() => {
|
|
271
|
+
onManualNavigation(emblaApi);
|
|
272
|
+
emblaApi.scrollTo(i);
|
|
273
|
+
},
|
|
274
|
+
{ signal },
|
|
275
|
+
);
|
|
245
276
|
}
|
|
246
277
|
};
|
|
247
278
|
|
|
@@ -284,7 +315,14 @@ const addThumbClickHandlers = (
|
|
|
284
315
|
const slidesthumbs = emblaApiThumb.slideNodes();
|
|
285
316
|
|
|
286
317
|
slidesthumbs.forEach((slideNode: HTMLElement, index: number) => {
|
|
287
|
-
slideNode.addEventListener(
|
|
318
|
+
slideNode.addEventListener(
|
|
319
|
+
"click",
|
|
320
|
+
() => {
|
|
321
|
+
onManualNavigation(emblaApiMain);
|
|
322
|
+
emblaApiMain.scrollTo(index);
|
|
323
|
+
},
|
|
324
|
+
{ signal },
|
|
325
|
+
);
|
|
288
326
|
});
|
|
289
327
|
};
|
|
290
328
|
|
|
@@ -536,12 +574,17 @@ function initEmblaRoot(emblaNode: Element): void {
|
|
|
536
574
|
apiOptions as EmblaOptionsType,
|
|
537
575
|
plugins,
|
|
538
576
|
);
|
|
539
|
-
// Drag state is a data-carousel-state token on the viewport
|
|
577
|
+
// Drag state is a data-carousel-state token on the viewport, and
|
|
578
|
+
// data-ui-dragging on the root for the page-wide grabbing cursor (a
|
|
579
|
+
// `body:has(…) *` rule would restyle the whole page on every DOM insertion).
|
|
580
|
+
const root = emblaNode.ownerDocument.documentElement;
|
|
540
581
|
emblaApi.on("pointerDown", () => {
|
|
541
582
|
if (emblaViewportNode) setCarouselState(emblaViewportNode, "dragging", true);
|
|
583
|
+
root.setAttribute("data-ui-dragging", "");
|
|
542
584
|
});
|
|
543
585
|
emblaApi.on("pointerUp", () => {
|
|
544
586
|
if (emblaViewportNode) setCarouselState(emblaViewportNode, "dragging", false);
|
|
587
|
+
root.removeAttribute("data-ui-dragging");
|
|
545
588
|
});
|
|
546
589
|
bindSlideStates(emblaApi);
|
|
547
590
|
|
|
@@ -555,11 +598,25 @@ function initEmblaRoot(emblaNode: Element): void {
|
|
|
555
598
|
emblaNode._emblaController = controller;
|
|
556
599
|
|
|
557
600
|
if (emblaPrevButtonNode) {
|
|
558
|
-
emblaPrevButtonNode.addEventListener(
|
|
601
|
+
emblaPrevButtonNode.addEventListener(
|
|
602
|
+
"click",
|
|
603
|
+
() => {
|
|
604
|
+
onManualNavigation(emblaApi);
|
|
605
|
+
emblaApi.scrollPrev();
|
|
606
|
+
},
|
|
607
|
+
{ signal },
|
|
608
|
+
);
|
|
559
609
|
}
|
|
560
610
|
|
|
561
611
|
if (emblaNextButtonNode) {
|
|
562
|
-
emblaNextButtonNode.addEventListener(
|
|
612
|
+
emblaNextButtonNode.addEventListener(
|
|
613
|
+
"click",
|
|
614
|
+
() => {
|
|
615
|
+
onManualNavigation(emblaApi);
|
|
616
|
+
emblaApi.scrollNext();
|
|
617
|
+
},
|
|
618
|
+
{ signal },
|
|
619
|
+
);
|
|
563
620
|
}
|
|
564
621
|
|
|
565
622
|
if (emblaDotsNode) {
|
|
@@ -726,6 +783,7 @@ const initEmblaKeyboardNav: InitEmblaKeyboardNavFn = function () {
|
|
|
726
783
|
if (!root) return;
|
|
727
784
|
|
|
728
785
|
e.preventDefault();
|
|
786
|
+
onManualNavigation(root._emblaApi);
|
|
729
787
|
if (e.key === "ArrowLeft") root._emblaApi.scrollPrev();
|
|
730
788
|
else root._emblaApi.scrollNext();
|
|
731
789
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit-styling.d.ts","sourceRoot":"","sources":["kit-styling.ts"],"names":[],"mappings":"AAEA,sGAAsG;AACtG,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"kit-styling.d.ts","sourceRoot":"","sources":["kit-styling.ts"],"names":[],"mappings":"AAEA,sGAAsG;AACtG,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EA8Q1C,CAAC;AAEF,0GAA0G;AAC1G,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAoDlE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CA6KnE,CAAC"}
|