@zazz-ui/core 0.13.0 → 0.14.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +5 -9
  3. package/dist/sri.json +34 -30
  4. package/dist/zazz.css +1 -1
  5. package/dist/zazz.js +1 -1
  6. package/editor/zazz.css-data.json +173 -3
  7. package/editor/zazz.html-data.json +138 -0
  8. package/editor/zazz.language-data.json +313 -125
  9. package/editor/zazz.lint-data.json +1501 -1383
  10. package/package.json +1 -5
  11. package/src/base/_defaults.css +1 -1
  12. package/src/base/_reset.css +16 -2
  13. package/src/base/_variables.css +43 -31
  14. package/src/base/carousel-scroll.d.ts +161 -0
  15. package/src/base/carousel-scroll.d.ts.map +1 -0
  16. package/src/base/carousel-scroll.js +1035 -0
  17. package/src/base/carousel-scroll.ts +1227 -0
  18. package/src/base/carousel.d.ts +34 -0
  19. package/src/base/carousel.d.ts.map +1 -0
  20. package/src/base/carousel.js +279 -0
  21. package/src/base/carousel.ts +292 -0
  22. package/src/base/dialog-lifecycle.js +1 -1
  23. package/src/base/dialog-lifecycle.ts +1 -1
  24. package/src/base/gesture.d.ts +201 -0
  25. package/src/base/gesture.d.ts.map +1 -0
  26. package/src/base/gesture.js +317 -0
  27. package/src/base/gesture.ts +494 -0
  28. package/src/base/kit-styling.d.ts.map +1 -1
  29. package/src/base/kit-styling.js +182 -162
  30. package/src/base/kit-styling.ts +182 -162
  31. package/src/base/utils.d.ts +1 -1
  32. package/src/base/utils.js +2 -2
  33. package/src/base/utils.ts +2 -2
  34. package/src/globals.d.ts +7 -30
  35. package/src/head.d.ts.map +1 -1
  36. package/src/head.js +1 -25
  37. package/src/head.ts +1 -25
  38. package/src/index.css +1 -0
  39. package/src/index.d.ts +6 -5
  40. package/src/index.d.ts.map +1 -1
  41. package/src/index.js +6 -5
  42. package/src/index.ts +6 -5
  43. package/src/manifest.d.ts +1 -1
  44. package/src/manifest.d.ts.map +1 -1
  45. package/src/manifest.js +25 -13
  46. package/src/manifest.ts +26 -14
  47. package/src/primitives/button/button.css +1 -1
  48. package/src/primitives/carousel/carousel.css +103 -20
  49. package/src/primitives/carousel/carousel.d.ts +4 -32
  50. package/src/primitives/carousel/carousel.d.ts.map +1 -1
  51. package/src/primitives/carousel/carousel.js +39 -14
  52. package/src/primitives/carousel/carousel.ts +21 -25
  53. package/src/primitives/dialog/dialog.css +14 -8
  54. package/src/primitives/drawer/drawer-indent.html +27 -0
  55. package/src/primitives/drawer/drawer-nested.html +72 -0
  56. package/src/primitives/drawer/drawer-responsive-dialog.html +44 -0
  57. package/src/primitives/drawer/drawer-snap.html +26 -0
  58. package/src/primitives/drawer/drawer.css +528 -0
  59. package/src/primitives/drawer/drawer.d.ts +24 -0
  60. package/src/primitives/drawer/drawer.d.ts.map +1 -0
  61. package/src/primitives/drawer/drawer.html +42 -0
  62. package/src/primitives/drawer/drawer.js +765 -0
  63. package/src/primitives/drawer/drawer.ts +823 -0
  64. package/src/primitives/fields/fields.css +4 -2
  65. package/src/primitives/input/input.css +4 -3
  66. package/src/primitives/input-group/input-group.css +5 -5
  67. package/src/primitives/lightbox/lightbox.css +2 -2
  68. package/src/primitives/lightbox/lightbox.d.ts.map +1 -1
  69. package/src/primitives/lightbox/lightbox.js +9 -8
  70. package/src/primitives/lightbox/lightbox.ts +9 -8
  71. package/src/primitives/password-group/password-group.css +5 -5
  72. package/src/primitives/radio/radio.css +15 -10
  73. package/src/primitives/slider/slider.css +2 -2
  74. package/src/primitives/switch/switch.css +6 -6
  75. package/src/primitives/tabs/tabs.css +10 -10
  76. package/src/primitives/toaster/toaster.css +29 -1
  77. package/src/primitives/toaster/toaster.d.ts.map +1 -1
  78. package/src/primitives/toaster/toaster.js +117 -9
  79. package/src/primitives/toaster/toaster.ts +136 -9
  80. package/src/primitives/tooltip/tooltip.css +93 -10
  81. package/src/base/embla.d.ts +0 -90
  82. package/src/base/embla.d.ts.map +0 -1
  83. package/src/base/embla.js +0 -878
  84. package/src/base/embla.ts +0 -1066
@@ -48,14 +48,16 @@
48
48
  --ui-field-ring-color: var(--color-ring);
49
49
  --ui-field-radius: var(--radius-md);
50
50
  --ui-field-corner-shape: var(--radius-corner-shape);
51
- --ui-field-inset-child-radius: var(--radius-sm);
51
+ --ui-field-inset-radius: calc(
52
+ var(--ui-field-radius) - var(--ui-field-inset-p) - var(--ui-field-border-width)
53
+ );
54
+ --ui-field-inset-p: calc(var(--spacing) * 0.85);
52
55
  --ui-field-h: calc(var(--spacing) * 8);
53
56
  --ui-field-font-size: var(--font-size-sm);
54
57
  --ui-field-leading: 1;
55
58
  /* a length, like --ui-field-px: several controls read it raw */
56
59
  --ui-field-py: calc(var(--spacing) * 1.75);
57
60
  --ui-field-px: calc(var(--spacing) * 2.5);
58
- --ui-field-addon-p: var(--spacing);
59
61
  --ui-field-gap: calc(var(--spacing) * 2);
60
62
  --ui-field-option-gap: 1px;
61
63
  --ui-field-icon-size: calc(var(--spacing) * 4);
@@ -33,7 +33,7 @@
33
33
  --ui-input-calendar-picker-color: currentColor;
34
34
  --ui-input-calendar-picker-icon-size: calc(var(--spacing) * 4);
35
35
  --ui-input-calendar-picker-size: calc(var(--spacing) * 6);
36
- --ui-input-calendar-picker-radius: var(--ui-field-inset-child-radius);
36
+ --ui-input-calendar-picker-radius: var(--ui-field-inset-radius);
37
37
  --ui-input-calendar-picker-corner-shape: var(--ui-field-corner-shape);
38
38
  --ui-input-calendar-picker-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%3Crect x='40' y='40' width='176' height='176' rx='8' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3Cline x1='176' y1='24' x2='176' y2='56' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3Cline x1='80' y1='24' x2='80' y2='56' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3Cline x1='40' y1='88' x2='216' y2='88' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3C/svg%3E");
39
39
  }
@@ -148,7 +148,8 @@
148
148
 
149
149
  /* iOS WebKit adds a temporal input's padding and border on top of its inline size,
150
150
  whatever box-sizing says (webkit.org/b/301648), so a full-width field overflows;
151
- -webkit-touch-callout is iOS-only, so the correction lands there alone */
151
+ -webkit-touch-callout is iOS-only, so the correction lands there alone. The
152
+ padding includes the touch-target widening (--_touch-px) on both sides. */
152
153
  @supports (-webkit-touch-callout: none) {
153
154
  :where([data-ui~="input"]):is(
154
155
  [type="date"],
@@ -160,7 +161,7 @@
160
161
  inline-size: calc(
161
162
  var(--_w-len) + var(--_w-num) * var(--spacing) -
162
163
  (var(--_pl-len) + var(--_pl-num) * var(--spacing)) -
163
- (var(--_pr-len) + var(--_pr-num) * var(--spacing)) - 2 *
164
+ (var(--_pr-len) + var(--_pr-num) * var(--spacing)) - 2 * var(--_touch-px) - 2 *
164
165
  var(--_border-width-resolved, var(--ui-input-border-width))
165
166
  );
166
167
  }
@@ -194,7 +194,7 @@
194
194
  white-space: nowrap;
195
195
  block-size: max(var(--ui-field-h), var(--_touch-min));
196
196
  min-inline-size: max(var(--ui-field-h), var(--_touch-min));
197
- padding-inline: var(--ui-field-addon-p);
197
+ padding-inline: var(--ui-field-inset-p);
198
198
  }
199
199
 
200
200
  :where([data-ui~="input-group"]) [data-input-group-slot~="addon"] > svg {
@@ -218,7 +218,7 @@
218
218
  [data-input-group-slot~="addon"][data-input-group-align="block-start"] {
219
219
  order: -2;
220
220
  flex-basis: 100%;
221
- padding-block: var(--ui-field-addon-p);
221
+ padding-block: var(--ui-field-inset-p);
222
222
  align-items: flex-start;
223
223
  }
224
224
 
@@ -226,7 +226,7 @@
226
226
  [data-input-group-slot~="addon"][data-input-group-align="block-end"] {
227
227
  order: 2;
228
228
  flex-basis: 100%;
229
- padding-block: var(--ui-field-addon-p);
229
+ padding-block: var(--ui-field-inset-p);
230
230
  align-items: flex-end;
231
231
  }
232
232
 
@@ -235,7 +235,7 @@
235
235
  display: inline-flex;
236
236
  align-items: center;
237
237
  gap: var(--space-xs);
238
- padding-inline: var(--ui-field-addon-p);
238
+ padding-inline: var(--ui-field-inset-p);
239
239
  font-size: var(--ui-input-group-font-size);
240
240
  font-weight: var(--ui-input-group-font-weight);
241
241
  color: var(--ui-input-group-text);
@@ -250,7 +250,7 @@
250
250
  /* Buttons embedded in a group shrink to nest cleanly inside the shell */
251
251
  :where([data-ui~="input-group"]) [data-ui~="button"] {
252
252
  flex-shrink: 0;
253
- border-radius: var(--ui-field-inset-child-radius);
253
+ border-radius: var(--ui-field-inset-radius);
254
254
  corner-shape: var(--ui-field-corner-shape);
255
255
  }
256
256
 
@@ -6,7 +6,7 @@
6
6
  * @uses command="show-modal" — Invoker Commands open fullscreen dialog (no JS)
7
7
  * @uses @container — thumb column count at narrow widths
8
8
  * @uses @starting-style — dialog slide scale/opacity on snap
9
- * @uses Embla sync — requires zazz/scripts/embla.js for carousel behaviour
9
+ * @uses carousel sync — requires base/carousel.js for carousel behaviour
10
10
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
11
11
  * rounded corners
12
12
  * @tokens --ui-lightbox-* (@layer variables)
@@ -46,7 +46,7 @@
46
46
  @layer ui.components {
47
47
  /* ===========================================================================
48
48
  LIGHTBOX — image gallery with fullscreen dialog slideshow
49
- - Inline gallery: main Embla carousel + linked thumb strip.
49
+ - Inline gallery: main carousel + linked thumb strip.
50
50
  - Gallery slides are <button command="show-modal"> — opens dialog at current index.
51
51
  - Dialog repeats main carousel + thumbs with prev/next navigation.
52
52
  - No JavaScript required for open/close — uses Invoker Commands API.
@@ -1 +1 @@
1
- {"version":3,"file":"lightbox.d.ts","sourceRoot":"","sources":["lightbox.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAC;AAE5E,cAAM,UAAW,SAAQ,WAAW;;IAClC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAqBzC;CAoDF;AAID,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"lightbox.d.ts","sourceRoot":"","sources":["lightbox.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAC;AAE5E,cAAM,UAAW,SAAQ,WAAW;;IAClC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAqBzC;CAqDF;AAID,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -12,9 +12,9 @@
12
12
  * - On dialog close: scrolls the inline gallery to the last viewed slide.
13
13
  *
14
14
  * Opening and closing the dialog itself needs no JavaScript — slides carry
15
- * `command="show-modal"` / `command="close"` (Invoker Commands). Drag-aware
16
- * click suppression on the stage and thumbs is wired by `initRoot` in
17
- * embla.js (keyed generically on command-bearing `carousel-slide` slots).
15
+ * `command="show-modal"` / `command="close"` (Invoker Commands). A mouse
16
+ * drag on the stage or the thumbs never also clicks: the gesture layer
17
+ * (base/gesture.js) swallows the click that ends a drag.
18
18
  *
19
19
  * @example
20
20
  * <ui-lightbox>
@@ -67,9 +67,10 @@ class UiLightbox extends ZazzElement {
67
67
  if (dialogRoot instanceof UiCarouselElement) {
68
68
  dialogRoot.init();
69
69
  }
70
- const galleryApi = this.#galleryRoot()?._emblaApi;
71
- if (dialogRoot._emblaApi && galleryApi) {
72
- dialogRoot._emblaApi.goTo(galleryApi.selectedSnap(), true);
70
+ const dialogApi = dialogRoot._carousel;
71
+ const galleryApi = this.#galleryRoot()?._carousel;
72
+ if (dialogApi && galleryApi) {
73
+ dialogApi.goTo(galleryApi.selectedSnap(), true);
73
74
  }
74
75
  const viewport = dialogRoot.querySelector('[data-carousel-slot~="viewport"]');
75
76
  if (viewport instanceof HTMLElement) {
@@ -82,8 +83,8 @@ class UiLightbox extends ZazzElement {
82
83
  * @param dialog - The lightbox dialog.
83
84
  */
84
85
  #syncGalleryToDialog(dialog) {
85
- const dialogApi = dialog.querySelector(':is(ui-carousel, [data-ui~="carousel"])')?._emblaApi;
86
- const galleryApi = this.#galleryRoot()?._emblaApi;
86
+ const dialogApi = dialog.querySelector(':is(ui-carousel, [data-ui~="carousel"])')?._carousel;
87
+ const galleryApi = this.#galleryRoot()?._carousel;
87
88
  if (dialogApi && galleryApi) {
88
89
  galleryApi.goTo(dialogApi.selectedSnap());
89
90
  }
@@ -13,9 +13,9 @@
13
13
  * - On dialog close: scrolls the inline gallery to the last viewed slide.
14
14
  *
15
15
  * Opening and closing the dialog itself needs no JavaScript — slides carry
16
- * `command="show-modal"` / `command="close"` (Invoker Commands). Drag-aware
17
- * click suppression on the stage and thumbs is wired by `initRoot` in
18
- * embla.js (keyed generically on command-bearing `carousel-slide` slots).
16
+ * `command="show-modal"` / `command="close"` (Invoker Commands). A mouse
17
+ * drag on the stage or the thumbs never also clicks: the gesture layer
18
+ * (base/gesture.js) swallows the click that ends a drag.
19
19
  *
20
20
  * @example
21
21
  * <ui-lightbox>
@@ -82,9 +82,10 @@ class UiLightbox extends ZazzElement {
82
82
  dialogRoot.init();
83
83
  }
84
84
 
85
- const galleryApi = this.#galleryRoot()?._emblaApi;
86
- if (dialogRoot._emblaApi && galleryApi) {
87
- dialogRoot._emblaApi.goTo(galleryApi.selectedSnap(), true);
85
+ const dialogApi = dialogRoot._carousel;
86
+ const galleryApi = this.#galleryRoot()?._carousel;
87
+ if (dialogApi && galleryApi) {
88
+ dialogApi.goTo(galleryApi.selectedSnap(), true);
88
89
  }
89
90
 
90
91
  const viewport = dialogRoot.querySelector('[data-carousel-slot~="viewport"]');
@@ -99,8 +100,8 @@ class UiLightbox extends ZazzElement {
99
100
  * @param dialog - The lightbox dialog.
100
101
  */
101
102
  #syncGalleryToDialog(dialog: HTMLDialogElement): void {
102
- const dialogApi = dialog.querySelector(':is(ui-carousel, [data-ui~="carousel"])')?._emblaApi;
103
- const galleryApi = this.#galleryRoot()?._emblaApi;
103
+ const dialogApi = dialog.querySelector(':is(ui-carousel, [data-ui~="carousel"])')?._carousel;
104
+ const galleryApi = this.#galleryRoot()?._carousel;
104
105
  if (dialogApi && galleryApi) {
105
106
  galleryApi.goTo(dialogApi.selectedSnap());
106
107
  }
@@ -187,7 +187,7 @@
187
187
  white-space: nowrap;
188
188
  block-size: max(var(--ui-field-h), var(--_touch-min));
189
189
  min-inline-size: max(var(--ui-field-h), var(--_touch-min));
190
- padding-inline: var(--ui-field-addon-p);
190
+ padding-inline: var(--ui-field-inset-p);
191
191
  }
192
192
 
193
193
  :where([data-ui~="password-group"]) [data-password-group-slot~="addon"] > svg {
@@ -211,7 +211,7 @@
211
211
  [data-password-group-slot~="addon"][data-password-group-align="block-start"] {
212
212
  order: -2;
213
213
  flex-basis: 100%;
214
- padding-block: var(--ui-field-addon-p);
214
+ padding-block: var(--ui-field-inset-p);
215
215
  align-items: flex-start;
216
216
  }
217
217
 
@@ -219,7 +219,7 @@
219
219
  [data-password-group-slot~="addon"][data-password-group-align="block-end"] {
220
220
  order: 2;
221
221
  flex-basis: 100%;
222
- padding-block: var(--ui-field-addon-p);
222
+ padding-block: var(--ui-field-inset-p);
223
223
  align-items: flex-end;
224
224
  }
225
225
 
@@ -227,7 +227,7 @@
227
227
  display: inline-flex;
228
228
  align-items: center;
229
229
  gap: var(--space-xs);
230
- padding-inline: var(--ui-field-addon-p);
230
+ padding-inline: var(--ui-field-inset-p);
231
231
  font-size: var(--ui-password-group-font-size);
232
232
  font-weight: var(--ui-password-group-font-weight);
233
233
  color: var(--ui-password-group-text);
@@ -241,7 +241,7 @@
241
241
 
242
242
  :where([data-ui~="password-group"]) [data-ui~="button"] {
243
243
  flex-shrink: 0;
244
- border-radius: var(--ui-field-inset-child-radius);
244
+ border-radius: var(--ui-field-inset-radius);
245
245
  corner-shape: var(--ui-field-corner-shape);
246
246
  }
247
247
 
@@ -20,12 +20,18 @@
20
20
  --ui-radio-border-style: var(--ui-field-border-style);
21
21
  --ui-radio-border-color: var(--ui-field-border-color);
22
22
  --ui-radio-border-color--hover: var(--ui-field-border-color--hover);
23
- --ui-radio-border-color--checked: var(--color-primary);
23
+ --ui-radio-border-color--checked: var(--ui-field-border-color--hover);
24
24
  --ui-radio-radius: var(--radius-full);
25
25
  --ui-radio-corner-shape: round;
26
- --ui-radio-dot-size: 1.125em;
27
- --ui-radio-dot-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' fill='currentColor' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='6'/%3E%3C/svg%3E")
28
- center / contain no-repeat;
26
+ --ui-radio-dot-size: calc(var(--ui-radio-size) * 0.85);
27
+ /* Drawn over the whole circle, centred: the dot's diameter is half
28
+ --ui-radio-dot-size (as the 24-unit icon it replaced drew it). A
29
+ replacement covers the circle too, e.g. `url(star.svg) center / 50% no-repeat`. */
30
+ --ui-radio-dot-mask: radial-gradient(
31
+ circle calc(var(--ui-radio-dot-size) / 4),
32
+ #000 calc(100% - 0.5px),
33
+ #0000 calc(100% + 0.5px)
34
+ );
29
35
  }
30
36
  }
31
37
 
@@ -116,16 +122,16 @@
116
122
  }
117
123
 
118
124
  /* masked ::before dot painted in currentColor; the :where() closes before
119
- the pseudo-element, which is invalid inside it */
125
+ the pseudo-element, which is invalid inside it. The pseudo and its mask
126
+ cover the circle's whole padding box, so they snap to the pixel grid with
127
+ it: a dot-sized box or mask tile snaps on its own and lands up to a pixel
128
+ off centre at fractional sizes. */
120
129
  :where([data-ui~="radio"]:checked)::before {
121
130
  content: "";
122
131
  position: absolute;
132
+ inset: 0;
123
133
  pointer-events: none;
124
134
  background-color: currentColor;
125
- inline-size: var(--ui-radio-dot-size);
126
- block-size: var(--ui-radio-dot-size);
127
- max-inline-size: 100%;
128
- max-block-size: 100%;
129
135
  mask: var(--ui-radio-dot-mask);
130
136
  transition-property: background-color, opacity, transform;
131
137
  transition-duration: calc(var(--default-transition-duration) * 0.75);
@@ -133,7 +139,6 @@
133
139
  transition-timing-function: var(--default-transition-timing-function);
134
140
  transform: scale(1);
135
141
  opacity: 1;
136
- will-change: transform;
137
142
 
138
143
  @starting-style {
139
144
  transform: scale(0);
@@ -46,13 +46,13 @@
46
46
  --ui-slider-fill-side: start;
47
47
 
48
48
  --ui-slider-thumb-size: max(calc(var(--spacing) * 4), var(--spacing-control-min));
49
- --ui-slider-thumb-bg: var(--color-card);
49
+ --ui-slider-thumb-bg: var(--color-primary);
50
50
 
51
51
  /* composes into the thumb's box-shadow list with its border and ring: use a
52
52
  transparent shadow, never `none` */
53
53
  --ui-slider-thumb-shadow: var(--shadow-xs);
54
54
  --ui-slider-thumb-border-width: 1px;
55
- --ui-slider-thumb-border-color: var(--color-border);
55
+ --ui-slider-thumb-border-color: var(--ui-field-border-color);
56
56
  --ui-slider-thumb-radius: var(--radius-full);
57
57
  --ui-slider-thumb-corner-shape: round;
58
58
  }
@@ -26,10 +26,10 @@
26
26
  --ui-switch-thumb-bg--checked: var(--color-primary-foreground);
27
27
  --ui-switch-thumb-border-width: var(--ui-field-border-width);
28
28
  --ui-switch-thumb-border-style: var(--ui-field-border-style);
29
- --ui-switch-thumb-border-color: transparent;
30
- --ui-switch-thumb-border-color--hover: transparent;
31
- --ui-switch-thumb-border-color--checked: transparent;
32
- --ui-switch-thumb-border-color--checked-hover: transparent;
29
+ --ui-switch-thumb-border-color: var(--ui-field-border-color);
30
+ --ui-switch-thumb-border-color--hover: var(--ui-field-border-color--hover);
31
+ --ui-switch-thumb-border-color--checked: var(--ui-field-border-color--hover);
32
+ --ui-switch-thumb-border-color--checked-hover: var(--ui-field-border-color--hover);
33
33
  /* the thumb is content-box: its border sits outside this size, so take it back out
34
34
  and the gap around the thumb is the same on every side */
35
35
  --ui-switch-thumb-size: calc(
@@ -48,8 +48,8 @@
48
48
  --ui-switch-track-border-style: var(--ui-field-border-style);
49
49
  --ui-switch-track-border-color: var(--ui-field-border-color);
50
50
  --ui-switch-track-border-color--hover: var(--ui-field-border-color--hover);
51
- --ui-switch-track-border-color--checked: var(--ui-switch-track-bg--checked);
52
- --ui-switch-track-border-color--checked-hover: var(--ui-switch-track-bg--checked-hover);
51
+ --ui-switch-track-border-color--checked: var(--ui-field-border-color--hover);
52
+ --ui-switch-track-border-color--checked-hover: var(--ui-field-border-color);
53
53
 
54
54
  /* dual-mode hooks: a scale number or a length */
55
55
  --ui-switch-radius: var(--radius-full);
@@ -32,23 +32,23 @@
32
32
  :root {
33
33
  /* metrics default to the shared --ui-field-* family so the track matches
34
34
  adjacent fields and buttons; --ui-tabs-label-min-h is deliberately shorter */
35
- --ui-tabs-gap: 0;
36
- --ui-tabs-track-p: calc(var(--spacing) * 0.35);
35
+ --ui-tabs-gap: var(--ui-field-option-gap);
36
+ --ui-tabs-track-p: var(--ui-field-inset-p);
37
37
  --ui-tabs-track-radius: var(--ui-field-radius);
38
38
  --ui-tabs-track-corner-shape: var(--ui-field-corner-shape);
39
- --ui-tabs-track-gap: calc(var(--spacing) * 0.35);
39
+ --ui-tabs-track-gap: var(--ui-field-gap);
40
40
  --ui-tabs-track-bg: var(--ui-field-bg);
41
- --ui-tabs-track-border-width: 1px;
42
- --ui-tabs-track-border-style: solid;
43
- --ui-tabs-track-border-color: var(--color-border);
41
+ --ui-tabs-track-border-width: var(--ui-field-border-width);
42
+ --ui-tabs-track-border-style: var(--ui-field-border-style);
43
+ --ui-tabs-track-border-color: var(--ui-field-border-color);
44
44
 
45
45
  --ui-tabs-indicator-bg: var(--color-muted);
46
- --ui-tabs-indicator-radius: var(--ui-field-inset-child-radius);
46
+ --ui-tabs-indicator-radius: calc(var(--ui-tabs-track-radius) - var(--ui-tabs-track-p));
47
47
  --ui-tabs-indicator-corner-shape: var(--ui-field-corner-shape);
48
48
  --ui-tabs-indicator-shadow: none;
49
- --ui-tabs-indicator-inset: var(--ui-tabs-track-p);
50
- --ui-tabs-indicator-border-width: 1px;
51
- --ui-tabs-indicator-border-style: solid;
49
+ --ui-tabs-indicator-inset: calc(var(--ui-tabs-track-p) / 2);
50
+ --ui-tabs-indicator-border-width: var(--ui-field-border-width);
51
+ --ui-tabs-indicator-border-style: var(--ui-field-border-style);
52
52
  --ui-tabs-indicator-border-color: transparent;
53
53
 
54
54
  --ui-tabs-label-font-family: var(--font-family-body);
@@ -2,7 +2,7 @@
2
2
  * toaster.css: Toaster (ui-toaster | [data-ui~="toaster"], [data-toaster-slot~="toast"])
3
3
  *
4
4
  * Stacked toast notifications: newest toast in front, older toasts peeking
5
- * behind, expand on hover.
5
+ * behind, expand on hover, swipe to dismiss.
6
6
  *
7
7
  * @layer variables, components
8
8
  * @requires _layers.css, _variables.css, popover.css, button.css
@@ -13,6 +13,9 @@
13
13
  * _view-transitions.css so page transitions never repaint the stack
14
14
  * @uses JS-maintained custom properties (--toasts-before, --offset, --initial-height,
15
15
  * --front-toast-height + inline z-index): stack math from toaster.js
16
+ * @uses translate + touch-action: none: swipe-to-dismiss; toaster.js writes the
17
+ * inline translate while a pointer drags a toast (state `swiping`, transitions
18
+ * off) and these transitions finish the release (`swiped` = flying out)
16
19
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
17
20
  * rounded corners
18
21
  * @tokens --ui-toaster-* (@layer variables)
@@ -142,12 +145,19 @@
142
145
  box-shadow: var(--ui-toaster-shadow);
143
146
  overflow-wrap: anywhere;
144
147
 
148
+ /* the whole toast is a swipe surface: no native panning, no text selection
149
+ starting under the drag */
150
+ touch-action: none;
151
+ -webkit-user-select: none;
152
+ user-select: none;
153
+
145
154
  --_y: translateY(calc(var(--_lift) * var(--offset, 0px)));
146
155
  transform: var(--_y);
147
156
  opacity: var(--ui-toaster-opacity--end);
148
157
  transition:
149
158
  transform var(--ui-toaster-transition-duration) var(--ui-toaster-transition-timing-function),
150
159
  opacity var(--ui-toaster-transition-duration) var(--ui-toaster-transition-timing-function),
160
+ translate var(--ui-toaster-transition-duration) var(--ui-toaster-transition-timing-function),
151
161
  block-size var(--ui-toaster-transition-duration) var(--ui-toaster-transition-timing-function);
152
162
 
153
163
  /* slide in from the region's edge (JS opens the region before appending) */
@@ -247,6 +257,24 @@
247
257
  scale(calc(1 - var(--ui-toaster-scale-step) * var(--toasts-before, 0)));
248
258
  }
249
259
 
260
+ /* ===========================================================================
261
+ SWIPE: while a pointer drags a toast, toaster.js writes its inline translate
262
+ and nothing may ease it: the toast is the pointer. On release the state
263
+ drops and the transitions above finish the motion. A swiped-out toast keeps
264
+ its stack position and fades, flying on along the swipe instead of sliding
265
+ back toward the entry edge.
266
+ =========================================================================== */
267
+
268
+ :where(ui-toaster, [data-ui~="toaster"])
269
+ [data-toaster-slot~="toast"][data-toaster-state~="swiping"] {
270
+ transition: none;
271
+ }
272
+
273
+ :where(ui-toaster, [data-ui~="toaster"])
274
+ [data-toaster-slot~="toast"][data-toaster-state~="removed"][data-toaster-state~="swiped"] {
275
+ --_y: translateY(calc(var(--_lift) * var(--offset, 0px)));
276
+ }
277
+
250
278
  :where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="icon"] {
251
279
  flex-shrink: 0;
252
280
  inline-size: var(--ui-toaster-icon-size);
@@ -1 +1 @@
1
- {"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["toaster.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAC;AA6B5E,UAAU,WAAW;IACnB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CACvC;AAED,UAAU,YAAY;IACpB,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,CAAC;I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
55
55
  * @fileoverview `<ui-toaster>`: HTML web component for stacked toast notifications.
56
56
  * @description Light-DOM custom element that hosts a top-layer toast stack, plus
57
- * the `window.Toaster` imperative API. Timers pause on hover and in hidden tabs.
57
+ * the `window.Toaster` imperative API. Timers pause on hover, during a swipe,
58
+ * and in hidden tabs.
58
59
  *
59
60
  * The region is a `popover="manual"` element: it enters the top layer via
60
61
  * `showPopover()` when the first toast arrives and leaves it after the last
@@ -70,6 +71,13 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
70
71
  * - Imperatively: `window.Toaster.toast({ title, description, variant, … })`
71
72
  * and the `.success()/.info()/.warning()/.error()` shorthands.
72
73
  *
74
+ * Swipe a toast to dismiss it, with a finger or the mouse: toward the edge it
75
+ * entered from (down for the bottom positions, up for the top ones), or
76
+ * sideways toward the nearest inline edge (either way when centered). A swipe
77
+ * past 45px dismisses, and so does a quick flick; anything less springs back,
78
+ * and the other directions resist. In the collapsed stack only the front toast
79
+ * swipes.
80
+ *
73
81
  * Region attributes:
74
82
  * - `data-toaster-position`: `top-start | top-center | top-end | bottom-start |
75
83
  * bottom-center | bottom-end` (logical; default `bottom-end`).
@@ -78,6 +86,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
78
86
  * <ui-toaster id="toaster" popover="manual"></ui-toaster>
79
87
  * <button commandfor="toaster" command="--toast" data-toaster-title="Saved">Save</button>
80
88
  */
89
+ import { currentTranslate, flickDuration, maxTransitionMs, rubberBand, shouldDismiss, trackDrag, } from "../../base/gesture.js";
81
90
  import { computed, effect, state } from "../../base/signals.js";
82
91
  import { ZazzElement, defineZazzElement } from "../../base/zazz-element.js";
83
92
  // compiled `using` reads Symbol.dispose, which engines without native Explicit
@@ -89,6 +98,12 @@ const TOAST_LIFETIME = 4000;
89
98
  const VISIBLE_TOASTS = 3;
90
99
  /** Safety net for node removal when no exit `transitionend` fires. */
91
100
  const EXIT_FALLBACK_MS = 600;
101
+ /** Swipe travel that dismisses a toast on its own, in px. */
102
+ const SWIPE_DISTANCE = 45;
103
+ /** Swipe speed that dismisses a toast on its own, in px/ms. */
104
+ const SWIPE_VELOCITY = 0.11;
105
+ /** The most a toast follows a swipe in a direction that does not dismiss, in px. */
106
+ const SWIPE_RESIST_LIMIT = 24;
92
107
  const VARIANTS = ["success", "info", "warning", "destructive"];
93
108
  const ICONS = {
94
109
  success: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg>',
@@ -151,7 +166,8 @@ function computeStackLayout(heights) {
151
166
  */
152
167
  /**
153
168
  * @description Adds or removes one token of an element's `data-toaster-state`
154
- * list: `expanded` on the region; `front`, `visible`, `removed` on a toast.
169
+ * list: `expanded` on the region; `front`, `visible`, `removed`, `swiping`,
170
+ * `swiped` on a toast.
155
171
  */
156
172
  function setToasterState(node, token, on) {
157
173
  const tokens = (node.getAttribute("data-toaster-state") ?? "").split(/\s+/).filter(Boolean);
@@ -177,13 +193,18 @@ class UiToaster extends ZazzElement {
177
193
  #expanded = state(false);
178
194
  /** Whether the tab is hidden (mirrors `document.hidden`). */
179
195
  #hidden = state(typeof document !== "undefined" ? document.hidden : false);
180
- /** Timers run only while neither expanded nor hidden. */
181
- #paused = computed(() => this.#expanded.get() || this.#hidden.get());
196
+ /** Whether a toast is being swiped. */
197
+ #swiping = state(false);
198
+ /** Timers run only while not expanded, not hidden, and not mid-swipe. */
199
+ #paused = computed(() => this.#expanded.get() || this.#hidden.get() || this.#swiping.get());
200
+ /** The connected lifetime's signal: toasts bind their swipe tracking to it. */
201
+ #signal = null;
182
202
  /** Measured stack (oldest first): written by `#reindex`'s measure pass. */
183
203
  #stack = state([]);
184
204
  /** Pure placement derived from the measured heights. */
185
205
  #layout = computed(() => computeStackLayout(this.#stack.get().map((entry) => entry.height)));
186
206
  setup(signal) {
207
+ this.#signal = signal;
187
208
  // Region baseline: manual popover (no light dismiss), reachable landmark.
188
209
  if (!this.hasAttribute("popover"))
189
210
  this.setAttribute("popover", "manual");
@@ -270,7 +291,9 @@ class UiToaster extends ZazzElement {
270
291
  // Show the popover before inserting so the insertion is announced and the
271
292
  // toast's @starting-style enter transition runs inside an open region.
272
293
  this.#showRegion();
273
- list.append(this.#buildToast(options, id));
294
+ const toast = this.#buildToast(options, id);
295
+ list.append(toast);
296
+ this.#bindSwipe(toast, id);
274
297
  this.#reindex();
275
298
  this.#startTimer(id, options.duration ?? TOAST_LIFETIME);
276
299
  return id;
@@ -436,6 +459,94 @@ class UiToaster extends ZazzElement {
436
459
  }
437
460
  return toast;
438
461
  }
462
+ /**
463
+ * @description Binds swipe-to-dismiss to one toast. While the pointer is
464
+ * down the toast follows it 1:1 through its inline `translate` (transitions
465
+ * off via the `swiping` state); on release the CSS transitions take over,
466
+ * flying the toast out (`swiped`, then the normal dismissal) or returning it
467
+ * to rest.
468
+ *
469
+ * @param toast - The toast element.
470
+ * @param id - Its toast id.
471
+ */
472
+ #bindSwipe(toast, id) {
473
+ if (!this.#signal)
474
+ return;
475
+ // where the toast was when the swipe caught it (mid snap-back, usually 0)
476
+ let base = 0;
477
+ const place = (axis, px) => {
478
+ const value = typeof px === "number" ? `${px}px` : px;
479
+ toast.style.translate = axis === "x" ? `${value} 0` : `0 ${value}`;
480
+ };
481
+ const rest = () => {
482
+ setToasterState(toast, "swiping", false);
483
+ toast.style.removeProperty("translate");
484
+ this.#swiping.set(false);
485
+ this.#requestCollapse();
486
+ };
487
+ trackDrag(toast, {
488
+ axis: "both",
489
+ signal: this.#signal,
490
+ canStart: () => !isRemoved(toast) &&
491
+ (this.#expanded.get() || toast.matches('[data-toaster-state~="front"]')),
492
+ onStart: ({ axis }) => {
493
+ const at = currentTranslate(toast);
494
+ base = axis === "x" ? at.x : at.y;
495
+ setToasterState(toast, "swiping", true);
496
+ this.#swiping.set(true);
497
+ },
498
+ onMove: ({ axis, offset }) => {
499
+ const travel = base + offset;
500
+ const direction = this.#swipeDirection(axis);
501
+ const dismissing = direction === 0 || Math.sign(travel) === direction;
502
+ place(axis, dismissing ? travel : rubberBand(travel, SWIPE_RESIST_LIMIT));
503
+ },
504
+ onEnd: ({ axis, offset, velocity }) => {
505
+ const travel = base + offset;
506
+ const direction = this.#swipeDirection(axis) || Math.sign(travel) || 1;
507
+ const dismiss = shouldDismiss({
508
+ offset: travel * direction,
509
+ velocity: velocity * direction,
510
+ distance: SWIPE_DISTANCE,
511
+ velocityThreshold: SWIPE_VELOCITY,
512
+ });
513
+ if (!dismiss) {
514
+ rest();
515
+ return;
516
+ }
517
+ // Transitions back on, then one more toast-length out in the swipe
518
+ // direction; the `removed` fade runs alongside. `swiped` keeps the
519
+ // exit from also sliding the toast back toward its entry edge.
520
+ setToasterState(toast, "swiped", true);
521
+ setToasterState(toast, "swiping", false);
522
+ const length = axis === "x" ? toast.offsetWidth : toast.offsetHeight;
523
+ const duration = flickDuration(length, velocity, maxTransitionMs(toast));
524
+ toast.style.transitionDuration = `${duration}ms`;
525
+ place(axis, `calc(${travel}px + ${direction * 100}%)`);
526
+ this.#swiping.set(false);
527
+ this.dismiss(id);
528
+ this.#requestCollapse();
529
+ },
530
+ onCancel: rest,
531
+ });
532
+ }
533
+ /**
534
+ * @description The direction a swipe on `axis` dismisses in, from the
535
+ * region's position: toward the entry edge on the block axis, toward the
536
+ * nearest inline edge on the inline axis.
537
+ *
538
+ * @param axis - The swipe's locked axis.
539
+ * @returns `1` (down / right), `-1` (up / left), or `0` for either way.
540
+ */
541
+ #swipeDirection(axis) {
542
+ const position = this.getAttribute("data-toaster-position") ?? "bottom-end";
543
+ if (axis === "y")
544
+ return position.startsWith("top") ? -1 : 1;
545
+ if (position.endsWith("center"))
546
+ return 0;
547
+ const towardEnd = position.endsWith("start") ? -1 : 1;
548
+ return getComputedStyle(this).direction === "rtl" ? -towardEnd : towardEnd;
549
+ }
439
550
  /**
440
551
  * @description Remeasures the stack: the measure half of the stacking
441
552
  * model. Batch-reads every live toast's natural height and writes the
@@ -609,10 +720,7 @@ class UiToaster extends ZazzElement {
609
720
  // Safety net for when no transitionend fires (reduced motion → duration 0).
610
721
  // Scaled to the computed duration so retuned --ui-toaster-transition-duration
611
722
  // themes aren't yanked out mid-exit.
612
- const duration = getComputedStyle(toast)
613
- .transitionDuration.split(",")
614
- .reduce((max, value) => Math.max(max, Number.parseFloat(value) || 0), 0);
615
- window.setTimeout(remove, Math.max(EXIT_FALLBACK_MS, duration * 1000 + 100));
723
+ window.setTimeout(remove, Math.max(EXIT_FALLBACK_MS, maxTransitionMs(toast) + 100));
616
724
  }
617
725
  }
618
726
  /**