@zazz-ui/core 0.13.1 → 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 +87 -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 +1 -1
  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
@@ -3,7 +3,8 @@
3
3
  /**
4
4
  * @fileoverview `<ui-toaster>`: HTML web component for stacked toast notifications.
5
5
  * @description Light-DOM custom element that hosts a top-layer toast stack, plus
6
- * the `window.Toaster` imperative API. Timers pause on hover and in hidden tabs.
6
+ * the `window.Toaster` imperative API. Timers pause on hover, during a swipe,
7
+ * and in hidden tabs.
7
8
  *
8
9
  * The region is a `popover="manual"` element: it enters the top layer via
9
10
  * `showPopover()` when the first toast arrives and leaves it after the last
@@ -19,6 +20,13 @@
19
20
  * - Imperatively: `window.Toaster.toast({ title, description, variant, … })`
20
21
  * and the `.success()/.info()/.warning()/.error()` shorthands.
21
22
  *
23
+ * Swipe a toast to dismiss it, with a finger or the mouse: toward the edge it
24
+ * entered from (down for the bottom positions, up for the top ones), or
25
+ * sideways toward the nearest inline edge (either way when centered). A swipe
26
+ * past 45px dismisses, and so does a quick flick; anything less springs back,
27
+ * and the other directions resist. In the collapsed stack only the front toast
28
+ * swipes.
29
+ *
22
30
  * Region attributes:
23
31
  * - `data-toaster-position`: `top-start | top-center | top-end | bottom-start |
24
32
  * bottom-center | bottom-end` (logical; default `bottom-end`).
@@ -28,6 +36,15 @@
28
36
  * <button commandfor="toaster" command="--toast" data-toaster-title="Saved">Save</button>
29
37
  */
30
38
 
39
+ import {
40
+ currentTranslate,
41
+ flickDuration,
42
+ maxTransitionMs,
43
+ rubberBand,
44
+ shouldDismiss,
45
+ trackDrag,
46
+ } from "../../base/gesture.ts";
47
+ import type { DragAxis } from "../../base/gesture.ts";
31
48
  import { computed, effect, state } from "../../base/signals.ts";
32
49
  import { ZazzElement, defineZazzElement } from "../../base/zazz-element.ts";
33
50
 
@@ -44,6 +61,15 @@ const VISIBLE_TOASTS = 3;
44
61
  /** Safety net for node removal when no exit `transitionend` fires. */
45
62
  const EXIT_FALLBACK_MS = 600;
46
63
 
64
+ /** Swipe travel that dismisses a toast on its own, in px. */
65
+ const SWIPE_DISTANCE = 45;
66
+
67
+ /** Swipe speed that dismisses a toast on its own, in px/ms. */
68
+ const SWIPE_VELOCITY = 0.11;
69
+
70
+ /** The most a toast follows a swipe in a direction that does not dismiss, in px. */
71
+ const SWIPE_RESIST_LIMIT = 24;
72
+
47
73
  const VARIANTS: ReadonlyArray<string> = ["success", "info", "warning", "destructive"];
48
74
 
49
75
  const ICONS: Record<string, string> = {
@@ -173,7 +199,8 @@ function computeStackLayout(heights: number[]): {
173
199
 
174
200
  /**
175
201
  * @description Adds or removes one token of an element's `data-toaster-state`
176
- * list: `expanded` on the region; `front`, `visible`, `removed` on a toast.
202
+ * list: `expanded` on the region; `front`, `visible`, `removed`, `swiping`,
203
+ * `swiped` on a toast.
177
204
  */
178
205
  function setToasterState(node: Element, token: string, on: boolean): void {
179
206
  const tokens = (node.getAttribute("data-toaster-state") ?? "").split(/\s+/).filter(Boolean);
@@ -206,8 +233,14 @@ class UiToaster extends ZazzElement {
206
233
  /** Whether the tab is hidden (mirrors `document.hidden`). */
207
234
  #hidden = state(typeof document !== "undefined" ? document.hidden : false);
208
235
 
209
- /** Timers run only while neither expanded nor hidden. */
210
- #paused = computed(() => this.#expanded.get() || this.#hidden.get());
236
+ /** Whether a toast is being swiped. */
237
+ #swiping = state(false);
238
+
239
+ /** Timers run only while not expanded, not hidden, and not mid-swipe. */
240
+ #paused = computed(() => this.#expanded.get() || this.#hidden.get() || this.#swiping.get());
241
+
242
+ /** The connected lifetime's signal: toasts bind their swipe tracking to it. */
243
+ #signal: AbortSignal | null = null;
211
244
 
212
245
  /** Measured stack (oldest first): written by `#reindex`'s measure pass. */
213
246
  #stack = state<ToastStackEntry[]>([]);
@@ -216,6 +249,8 @@ class UiToaster extends ZazzElement {
216
249
  #layout = computed(() => computeStackLayout(this.#stack.get().map((entry) => entry.height)));
217
250
 
218
251
  protected setup(signal: AbortSignal): void {
252
+ this.#signal = signal;
253
+
219
254
  // Region baseline: manual popover (no light dismiss), reachable landmark.
220
255
  if (!this.hasAttribute("popover")) this.setAttribute("popover", "manual");
221
256
  if (!this.hasAttribute("role")) this.setAttribute("role", "region");
@@ -326,7 +361,9 @@ class UiToaster extends ZazzElement {
326
361
  // toast's @starting-style enter transition runs inside an open region.
327
362
  this.#showRegion();
328
363
 
329
- list.append(this.#buildToast(options, id));
364
+ const toast = this.#buildToast(options, id);
365
+ list.append(toast);
366
+ this.#bindSwipe(toast, id);
330
367
  this.#reindex();
331
368
  this.#startTimer(id, options.duration ?? TOAST_LIFETIME);
332
369
 
@@ -510,6 +547,99 @@ class UiToaster extends ZazzElement {
510
547
  return toast;
511
548
  }
512
549
 
550
+ /**
551
+ * @description Binds swipe-to-dismiss to one toast. While the pointer is
552
+ * down the toast follows it 1:1 through its inline `translate` (transitions
553
+ * off via the `swiping` state); on release the CSS transitions take over,
554
+ * flying the toast out (`swiped`, then the normal dismissal) or returning it
555
+ * to rest.
556
+ *
557
+ * @param toast - The toast element.
558
+ * @param id - Its toast id.
559
+ */
560
+ #bindSwipe(toast: HTMLElement, id: string): void {
561
+ if (!this.#signal) return;
562
+
563
+ // where the toast was when the swipe caught it (mid snap-back, usually 0)
564
+ let base = 0;
565
+
566
+ const place = (axis: DragAxis, px: number | string) => {
567
+ const value = typeof px === "number" ? `${px}px` : px;
568
+ toast.style.translate = axis === "x" ? `${value} 0` : `0 ${value}`;
569
+ };
570
+
571
+ const rest = () => {
572
+ setToasterState(toast, "swiping", false);
573
+ toast.style.removeProperty("translate");
574
+ this.#swiping.set(false);
575
+ this.#requestCollapse();
576
+ };
577
+
578
+ trackDrag(toast, {
579
+ axis: "both",
580
+ signal: this.#signal,
581
+ canStart: () =>
582
+ !isRemoved(toast) &&
583
+ (this.#expanded.get() || toast.matches('[data-toaster-state~="front"]')),
584
+ onStart: ({ axis }) => {
585
+ const at = currentTranslate(toast);
586
+ base = axis === "x" ? at.x : at.y;
587
+ setToasterState(toast, "swiping", true);
588
+ this.#swiping.set(true);
589
+ },
590
+ onMove: ({ axis, offset }) => {
591
+ const travel = base + offset;
592
+ const direction = this.#swipeDirection(axis);
593
+ const dismissing = direction === 0 || Math.sign(travel) === direction;
594
+ place(axis, dismissing ? travel : rubberBand(travel, SWIPE_RESIST_LIMIT));
595
+ },
596
+ onEnd: ({ axis, offset, velocity }) => {
597
+ const travel = base + offset;
598
+ const direction = this.#swipeDirection(axis) || Math.sign(travel) || 1;
599
+ const dismiss = shouldDismiss({
600
+ offset: travel * direction,
601
+ velocity: velocity * direction,
602
+ distance: SWIPE_DISTANCE,
603
+ velocityThreshold: SWIPE_VELOCITY,
604
+ });
605
+ if (!dismiss) {
606
+ rest();
607
+ return;
608
+ }
609
+
610
+ // Transitions back on, then one more toast-length out in the swipe
611
+ // direction; the `removed` fade runs alongside. `swiped` keeps the
612
+ // exit from also sliding the toast back toward its entry edge.
613
+ setToasterState(toast, "swiped", true);
614
+ setToasterState(toast, "swiping", false);
615
+ const length = axis === "x" ? toast.offsetWidth : toast.offsetHeight;
616
+ const duration = flickDuration(length, velocity, maxTransitionMs(toast));
617
+ toast.style.transitionDuration = `${duration}ms`;
618
+ place(axis, `calc(${travel}px + ${direction * 100}%)`);
619
+ this.#swiping.set(false);
620
+ this.dismiss(id);
621
+ this.#requestCollapse();
622
+ },
623
+ onCancel: rest,
624
+ });
625
+ }
626
+
627
+ /**
628
+ * @description The direction a swipe on `axis` dismisses in, from the
629
+ * region's position: toward the entry edge on the block axis, toward the
630
+ * nearest inline edge on the inline axis.
631
+ *
632
+ * @param axis - The swipe's locked axis.
633
+ * @returns `1` (down / right), `-1` (up / left), or `0` for either way.
634
+ */
635
+ #swipeDirection(axis: DragAxis): -1 | 0 | 1 {
636
+ const position = this.getAttribute("data-toaster-position") ?? "bottom-end";
637
+ if (axis === "y") return position.startsWith("top") ? -1 : 1;
638
+ if (position.endsWith("center")) return 0;
639
+ const towardEnd = position.endsWith("start") ? -1 : 1;
640
+ return getComputedStyle(this).direction === "rtl" ? (-towardEnd as -1 | 1) : towardEnd;
641
+ }
642
+
513
643
  /**
514
644
  * @description Remeasures the stack: the measure half of the stacking
515
645
  * model. Batch-reads every live toast's natural height and writes the
@@ -675,10 +805,7 @@ class UiToaster extends ZazzElement {
675
805
  // Safety net for when no transitionend fires (reduced motion → duration 0).
676
806
  // Scaled to the computed duration so retuned --ui-toaster-transition-duration
677
807
  // themes aren't yanked out mid-exit.
678
- const duration = getComputedStyle(toast)
679
- .transitionDuration.split(",")
680
- .reduce((max, value) => Math.max(max, Number.parseFloat(value) || 0), 0);
681
- window.setTimeout(remove, Math.max(EXIT_FALLBACK_MS, duration * 1000 + 100));
808
+ window.setTimeout(remove, Math.max(EXIT_FALLBACK_MS, maxTransitionMs(toast) + 100));
682
809
  }
683
810
  }
684
811
 
@@ -15,7 +15,10 @@
15
15
  * the delay on its first entry.
16
16
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
17
17
  * rounded corners
18
- * @uses :dir(rtl): inline-side origins and slide-in mirror; the arrow uses logical insets
18
+ * @uses :dir(rtl): inline-side origins, slide-in, and arrow turn mirror; the arrow uses
19
+ * logical insets
20
+ * @uses border-*: inherit — the arrow's two outer edges take the content's computed
21
+ * border (utilities included), so it stays outlined over a matching background
19
22
  * @uses @media not (hover: hover) — hidden on touch screens (no hover to show it, and a
20
23
  * tap would cover the trigger's own action); keep essential text visible
21
24
  * @tokens --ui-tooltip-* (@layer variables; read on the content slot)
@@ -25,23 +28,28 @@
25
28
  :root {
26
29
  --ui-tooltip-bg: var(--color-foreground);
27
30
  --ui-tooltip-text: var(--color-background);
28
- --ui-tooltip-border-color: transparent;
31
+ --ui-tooltip-border-width: 1px;
32
+ --ui-tooltip-border-style: solid;
33
+ --ui-tooltip-border-color: var(--color-background);
29
34
  --ui-tooltip-radius: var(--radius-sm);
30
35
  --ui-tooltip-corner-shape: var(--radius-corner-shape);
31
- --ui-tooltip-shadow: var(--shadow-sm);
36
+ --ui-tooltip-shadow: none;
32
37
  --ui-tooltip-px: var(--space-xs);
33
38
  --ui-tooltip-py: var(--spacing);
34
39
  --ui-tooltip-gap: var(--spacing);
35
40
  --ui-tooltip-font-family: var(--font-family-mono);
41
+ --ui-tooltip-font-weight: var(--font-weight-body);
42
+ --ui-tooltip-font-settings: var(--font-settings-body);
43
+
36
44
  --ui-tooltip-font-size: var(--font-size-xs);
37
45
  --ui-tooltip-leading: var(--leading-xs);
38
- --ui-tooltip-font-weight: var(--font-weight-body);
39
46
  --ui-tooltip-max-w: 16ch;
40
47
 
41
48
  /* Arrow */
49
+ --ui-tooltip-display: none;
42
50
  --ui-tooltip-arrow-size: calc(var(--spacing) * 2);
43
51
  --ui-tooltip-arrow-color: var(--ui-tooltip-bg);
44
- --ui-tooltip-arrow-radius: calc(var(--spacing) * 0.5);
52
+ --ui-tooltip-arrow-radius: 0;
45
53
 
46
54
  /* Reveal transitions: lighter than popover */
47
55
  --ui-tooltip-transition-duration: calc(var(--default-transition-duration) / 2);
@@ -69,6 +77,32 @@
69
77
  }
70
78
  }
71
79
 
80
+ @property --_tooltip-border-width {
81
+ syntax: "*";
82
+ inherits: false;
83
+ }
84
+
85
+ @property --_tooltip-border-style {
86
+ syntax: "*";
87
+ inherits: false;
88
+ }
89
+
90
+ @property --_tooltip-border-color {
91
+ syntax: "*";
92
+ inherits: false;
93
+ }
94
+
95
+ /* set on the content, read by its arrow */
96
+ @property --_tooltip-arrow-edge {
97
+ syntax: "*";
98
+ inherits: true;
99
+ }
100
+
101
+ @property --_tooltip-arrow-turn {
102
+ syntax: "*";
103
+ inherits: false;
104
+ }
105
+
72
106
  /* Popover overrides, on the tooltip content (declared on :root they would retheme
73
107
  every popover in the kit, since tooltip.css loads after popover.css). */
74
108
  @layer ui.components {
@@ -167,7 +201,23 @@
167
201
  --_py-num: var(--_py-resolved, var(--ui-tooltip-py));
168
202
  padding-block: calc(var(--_py-len) + var(--_py-num) * var(--spacing));
169
203
 
170
- border: 1px solid var(--_border-color-resolved, var(--ui-tooltip-border-color));
204
+ border-width: var(
205
+ --_border-width-resolved,
206
+ var(--_tooltip-border-width, var(--ui-tooltip-border-width))
207
+ );
208
+ border-style: var(
209
+ --_border-style-resolved,
210
+ var(--_tooltip-border-style, var(--ui-tooltip-border-style))
211
+ );
212
+ border-color: var(
213
+ --_border-color-resolved,
214
+ var(--_tooltip-border-color, var(--ui-tooltip-border-color))
215
+ );
216
+ /* inherits: the arrow centers on the border's outer edge */
217
+ --_tooltip-arrow-edge: var(
218
+ --_border-width-resolved,
219
+ var(--_tooltip-border-width, var(--ui-tooltip-border-width))
220
+ );
171
221
  --_radius-len: var(--_radius-resolved, var(--ui-tooltip-radius));
172
222
  --_radius-num: var(--_radius-resolved, var(--ui-tooltip-radius));
173
223
  border-radius: calc(
@@ -180,6 +230,7 @@
180
230
  font-size: var(--_font-size-resolved, var(--ui-tooltip-font-size));
181
231
  line-height: var(--_leading-resolved, var(--ui-tooltip-leading));
182
232
  font-weight: var(--_font-weight-resolved, var(--ui-tooltip-font-weight));
233
+ font-variation-settings: var(--ui-tooltip-font-settings);
183
234
  text-wrap: balance;
184
235
  }
185
236
 
@@ -256,18 +307,34 @@
256
307
  It stays on the declared side when a position-try fallback flips the tooltip:
257
308
  container-type: anchored + @container anchored(fallback: …) would move it
258
309
  (Chromium 143+), but Lightning CSS 1.33 (vp pack, Vite 8's CSS minifier)
259
- cannot parse anchored(). Add it once it can. */
310
+ cannot parse anchored(). Add it once it can.
311
+ The border: a rotated square whose physical right and bottom sides inherit the
312
+ content's computed border, turned so that corner (the tip) points at the anchor.
313
+ Its borderless inner half covers the content's border across the base, so the two
314
+ outlines join. clip-path / shape() would clip the border away instead. */
260
315
  :where(ui-tooltip, [data-ui~="tooltip"]) [data-tooltip-slot~="arrow"] {
261
- --_arrow-offset: calc(var(--ui-tooltip-arrow-size) / -2);
316
+ --_arrow-offset: calc(var(--ui-tooltip-arrow-size) / -2 - var(--_tooltip-arrow-edge, 0px));
317
+ --_tooltip-arrow-turn: 45deg;
318
+ display: var(--ui-tooltip-display);
262
319
  position: absolute;
263
320
  inset-block: auto var(--_arrow-offset);
264
321
  inset-inline: 0;
265
322
  margin: 0 auto;
266
- transform: rotate(45deg);
323
+ transform: rotate(var(--_tooltip-arrow-turn));
324
+ box-sizing: border-box;
267
325
  inline-size: var(--ui-tooltip-arrow-size);
268
326
  block-size: var(--ui-tooltip-arrow-size);
269
327
  background-color: var(--ui-tooltip-arrow-color);
270
- border-radius: var(--ui-tooltip-arrow-radius);
328
+ border-top: none;
329
+ border-left: none;
330
+ border-right-width: inherit;
331
+ border-right-style: inherit;
332
+ border-right-color: inherit;
333
+ border-bottom-width: inherit;
334
+ border-bottom-style: inherit;
335
+ border-bottom-color: inherit;
336
+ /* only the tip: rounded side corners would gap where the arrow meets the edge */
337
+ border-radius: 0 0 var(--ui-tooltip-arrow-radius) 0;
271
338
  pointer-events: none;
272
339
  }
273
340
 
@@ -275,12 +342,14 @@
275
342
  :where(ui-tooltip, [data-ui~="tooltip"])
276
343
  [data-tooltip-slot~="content"][data-popover-side="bottom"]
277
344
  [data-tooltip-slot~="arrow"] {
345
+ --_tooltip-arrow-turn: 225deg;
278
346
  inset-block: var(--_arrow-offset) auto;
279
347
  }
280
348
 
281
349
  :where(ui-tooltip, [data-ui~="tooltip"])
282
350
  [data-tooltip-slot~="content"][data-popover-side="left"]
283
351
  [data-tooltip-slot~="arrow"] {
352
+ --_tooltip-arrow-turn: -45deg;
284
353
  inset-block: 0;
285
354
  inset-inline: auto var(--_arrow-offset);
286
355
  margin: auto 0;
@@ -289,11 +358,25 @@
289
358
  :where(ui-tooltip, [data-ui~="tooltip"])
290
359
  [data-tooltip-slot~="content"][data-popover-side="right"]
291
360
  [data-tooltip-slot~="arrow"] {
361
+ --_tooltip-arrow-turn: 135deg;
292
362
  inset-block: 0;
293
363
  inset-inline: var(--_arrow-offset) auto;
294
364
  margin: auto 0;
295
365
  }
296
366
 
367
+ /* rotate() is physical: the inline sides' tips point the other way in RTL */
368
+ :where(ui-tooltip, [data-ui~="tooltip"])
369
+ [data-tooltip-slot~="content"][data-popover-side="left"]:dir(rtl)
370
+ [data-tooltip-slot~="arrow"] {
371
+ --_tooltip-arrow-turn: 135deg;
372
+ }
373
+
374
+ :where(ui-tooltip, [data-ui~="tooltip"])
375
+ [data-tooltip-slot~="content"][data-popover-side="right"]:dir(rtl)
376
+ [data-tooltip-slot~="arrow"] {
377
+ --_tooltip-arrow-turn: -45deg;
378
+ }
379
+
297
380
  @media not (hover: hover) {
298
381
  :where(ui-tooltip, [data-ui~="tooltip"]) {
299
382
  display: none !important;
@@ -1,90 +0,0 @@
1
- import type { EmblaCarouselType } from "embla-carousel";
2
- /**
3
- * @description Parses a space-separated `data-carousel-plugins` value into
4
- * plugin slug tokens. Empty / null / whitespace-only values yield `[]`.
5
- *
6
- * @param value - Raw attribute value (or `null` when absent).
7
- * @returns Plugin slug tokens in authoring order.
8
- */
9
- declare function parseCarouselPlugins(value: string | null): string[];
10
- /**
11
- * @description Sets `data-carousel-state="active"` on the node at `selected` and clears it
12
- * from every other node: the shared "which one is current" marker used by
13
- * both dot pagination and thumb navigation.
14
- *
15
- * @param nodes - Candidate nodes, in slide order.
16
- * @param selected - The active index.
17
- * @param options - Set `ariaCurrent` to also toggle `aria-current` (thumbs only;
18
- * dot pagination is purely visual).
19
- * @private
20
- */
21
- declare function setActiveIndex(nodes: readonly HTMLElement[], selected: number, options?: {
22
- ariaCurrent?: boolean;
23
- }): void;
24
- /**
25
- * @description Adds dot navigation buttons and click handlers for an Embla carousel.
26
- *
27
- * @param emblaApi - The Embla carousel API instance.
28
- * @param dotsNode - Container element for dot navigation.
29
- * @param signal - Aborts the dot click listeners on teardown.
30
- * @returns Cleanup function to remove dots.
31
- */
32
- declare const addDotBtnsAndClickHandlers: (emblaApi: EmblaCarouselType, dotsNode: Element, signal?: AbortSignal) => (() => void) | undefined;
33
- /**
34
- * @description Adds click handlers on thumb slides to scroll the main carousel.
35
- *
36
- * @param emblaApiMain - Main carousel API instance.
37
- * @param emblaApiThumb - thumb carousel API instance.
38
- * @param signal - Aborts the thumb click listeners on teardown.
39
- */
40
- declare const addThumbClickHandlers: (emblaApiMain: EmblaCarouselType, emblaApiThumb: EmblaCarouselType, signal?: AbortSignal) => void;
41
- /**
42
- * @description Keeps the thumb carousel and active state in sync with the main carousel.
43
- *
44
- * @param emblaApiMain - Main carousel API instance.
45
- * @param emblaApiThumb - thumb carousel API instance.
46
- */
47
- declare const addTogglethumbsActive: (emblaApiMain: EmblaCarouselType, emblaApiThumb: EmblaCarouselType) => void;
48
- /**
49
- * @description Initializes a single Embla carousel root.
50
- *
51
- * Configures the carousel from its `data-carousel-*` attributes, wires navigation
52
- * (prev/next, dots, thumbs), and stores the API on `root._emblaApi`. Idempotent:
53
- * skips roots that are already initialized or inside a closed dialog (no
54
- * measurable viewport until open).
55
- *
56
- * Called by `initEmblaCarousels()` for attribute-form (`[data-ui~="carousel"]`) markup and by
57
- * the `<ui-carousel>` web component on connect.
58
- *
59
- * @param emblaNode - The carousel root element.
60
- */
61
- declare function initEmblaRoot(emblaNode: Element): void;
62
- /**
63
- * @description Initializes all Embla carousels within a scope.
64
- *
65
- * Discovers carousel elements via `:is(ui-carousel, [data-ui~="carousel"])` and configures them
66
- * based on their data attributes. Roots managed by the `<ui-carousel>` web
67
- * component are skipped: they initialize themselves via `connectedCallback()`.
68
- *
69
- * @param scope - Root element to search within. Defaults to `document`.
70
- */
71
- declare function initEmblaCarousels(scope?: Document | Element): void;
72
- /**
73
- * @namespace EmblaInit
74
- * @description Public API for Embla carousel initialization and helpers.
75
- *
76
- * @property init - Initializes all carousels within a scope.
77
- * @property initRoot - Initializes a single carousel root (used by `<ui-carousel>`).
78
- * @property addDotBtnsAndClickHandlers - Wires dot pagination.
79
- * @property addThumbClickHandlers - Wires thumb click handlers.
80
- * @property addTogglethumbsActive - Syncs thumb active state.
81
- */
82
- declare const EmblaInit: {
83
- init: typeof initEmblaCarousels;
84
- initRoot: typeof initEmblaRoot;
85
- addDotBtnsAndClickHandlers: typeof addDotBtnsAndClickHandlers;
86
- addThumbClickHandlers: typeof addThumbClickHandlers;
87
- addTogglethumbsActive: typeof addTogglethumbsActive;
88
- };
89
- export { EmblaInit, setActiveIndex, parseCarouselPlugins };
90
- //# sourceMappingURL=embla.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"embla.d.ts","sourceRoot":"","sources":["embla.ts"],"names":[],"mappings":"AA0FA,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,gBAAgB,CAAC;AAa3F;;;;;;GAMG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,EAAE,CAG5D;AA0RD;;;;;;;;;;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,CAwI/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"}