@1337exp/taoui 5.19.1 → 5.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.21.0
4
+
5
+ Nothing to migrate; the defaults do not change.
6
+
7
+ - **`TaoMarquee` `decorative`: a line that is only a picture.** For a marquee used as a design feature, in the background. A ghost: `aria-hidden` and `inert` (not a tab stop, nothing to select, no reaction to a cursor or a tap), `pointer-events: none`, and it runs round without a pause, like a looped GIF. Under «reduce motion» it stands still and is clipped, it does not wrap. Use it only for text nobody needs to read: the stop that WCAG 2.2.2 asks of moving content does not apply to pure decoration, and a screen reader will not see it.
8
+ - **`TaoMarquee` `roundPause`.** The rest at the start of every round can be turned off for any line (`:round-pause="false"`): the round is one line plus the gap and the loop has no seam. Not set, it follows `decorative` (no rest) and an ordinary line keeps its rest.
9
+
10
+ ## 5.20.1
11
+
12
+ Nothing to migrate; the defaults do not change.
13
+
14
+ - **`TaoMarquee`: `pauseOnHover="false"` is a background line now.** The prop was there, but a line used as a design feature still stopped for a tap and could be selected while it ran. With `pauseOnHover` off a cursor or a finger passing by does not stop it, and the running text has `user-select: none`. Focus still stops it and a running line stays a tab stop, so the keyboard keeps its way to stop moving content (WCAG 2.2.2). The showcase has a background line.
15
+ - Showcase: the numbers promised by the palettes sit under the palette lab, with the other colour blocks of the section.
16
+
17
+ ## 5.20.0
18
+
19
+ Nothing to migrate; the library does not change.
20
+
21
+ - **Showcase: a section "Contrast & keyboard".** What the README only promised can be tried now. A live look reads the colour roles of this very page from the computed styles and judges every pair with `contrastRatio()` and `apcaContrast()` (the numbers follow the palette and the mode in the header). A pair picker shows the two questions on one colour, with the well-known green `#2ea85c` where WCAG 2 and the eye disagree. A palette lab turns four stops into a whole theme with `applyTaoPalette()` on a preview (or on the page, and takes it off again) and rates the roles it made. A key map lists what the keys do in toolbars, menus, trees and lists, and the numbers the palettes are tested for. Every key line is one a test of the component or its code shows.
22
+ - The section is a frame (`showcase/components/DemoA11y.vue`); each block and its data live apart in `showcase/a11y/`, and `tests/showcase.a11y.test.ts` keeps the roles it reads real and its promises equal to the palette constants.
23
+
24
+ ## 5.19.3
25
+
26
+ A fix; nothing to migrate.
27
+
28
+ - **`TaoCounter`: a fast run of increments no longer leaves empty and half-rolled slots.** A new value that came while the digits were still rolling cut the roll short and piled several digits in one slot. Now the wheels take the next value only when the last digit has landed: the parent already holds the sum of the increments, so the counter rolls once to the latest value, and again if more came during that roll. `aria-label` tells the real value at once. The gate is `createRollGate` in `src/counterRoll.ts`.
29
+
30
+ ## 5.19.2
31
+
32
+ A polish; nothing to migrate.
33
+
34
+ - **`TaoCounter`: the digits roll in turn, not all at once.** All the digits that changed started at the same moment, and `+1337` looked like four wheels jerked together. Now the one on the right goes first and the others follow to the left, 55 ms apart, so they land one after another like an odometer. Only the digits that change take a turn: `1000 → 2000` does not wait for the three that stay. `--tao-counter-stagger` sets the step (`0` brings the old all-at-once back). With `prefers-reduced-motion` the digits change at once. The order is `src/counterRoll.ts`.
35
+
3
36
  ## 5.19.1
4
37
 
5
38
  A fix; nothing to migrate.
package/README.md CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  - **Tokens first.** Colours, radii, spacing and type come from CSS variables in three layers (primitives, semantic, theme). Re-theme the kit, or one panel of it, without touching a component. Size and density are contexts too: set them once on a panel and everything inside follows.
30
30
  - **Palettes.** Seven ready palettes built from four colours each, or your own at run time (`applyTaoPalette`). The status colours step away from the accent by themselves, and the charts recolour with the theme.
31
- - **Contrast you can trust.** The colour pairs of the themes and palettes are checked by tests against WCAG 2 (4.5:1 for text, 3:1 for a label on a fill); APCA picks whether a label is dark or white.
31
+ - **Contrast you can trust.** The colour pairs of the themes and palettes are checked by tests against WCAG 2 (4.5:1 for text, 3:1 for a label on a fill); APCA picks whether a label is dark or white. The showcase section **Contrast & keyboard** measures the page you are on, lets you build a palette from four stops with `applyTaoPalette()`, and lists what the keys do.
32
32
  - **Adapts without JS.** `TaoNav` turns from a bottom bar into a rail and a side panel, the bento grid reflows, the main action moves with the navigation — by the width of their own container (container queries), not of the window. Nothing jumps after hydration.
33
33
  - **Keyboard and screen readers.** Menus, the menu bar, the toolbar, the tree and the navigation follow the WAI-ARIA patterns: one Tab stop and arrows inside (roving tabindex), `aria-pressed` toggles, `role="meter"`, focus traps in overlays.
34
34
  - **Charts the honest way.** Small `TaoSparkline` / `TaoMeter` / `TaoDonut` / `TaoHeatmap` for cards and lines of text; for real charts `taoChartTheme()` hands the theme colours to Chart.js, ECharts or uPlot.
@@ -55,7 +55,7 @@
55
55
  - **TaoButton** — `variant`: `primary` / `secondary` / `ghost` / `text`; `tone` colours any of them (accent by default, neutral, success, danger, warning, info). `v-model:pressed` makes it a toggle (`aria-pressed`); `shortcut="N"` shows the key at the end of the button (`aria-keyshortcuts`; listening to it is the app's job)
56
56
  - **TaoCard** — card with media / header / title / footer slots and a `#corner` (a tag, a menu button). `#media` can be a photo or `TaoCarousel`; `closable` adds a cross and the `close` event. `flush` is a tile (no padding/shadow, fills the cell); `#overlay` is a scrim on the media; `stripe="top | left | bottom"` with `stripeTone` (a tone or the palette `gradient`) draws a coloured stripe the corners clip
57
57
  - **TaoCopy** — clipboard icon. After a click, a “Copied” tooltip; if the trigger is gone, the tooltip is too
58
- - **TaoMarquee** — one line that never wraps: when it does not fit it runs round with fading edges and a pause at the start of every round, when it fits it stands still. Stops on hover, on focus and on a tap (WCAG 2.2.2); wraps with «reduce motion»; a screen reader reads it once. `text` or inline content in the slot, `speed`, `gap`, `fade` (the left fade takes that much room left of the text: give the parent the padding), `paused`
58
+ - **TaoMarquee** — one line that never wraps: when it does not fit it runs round with fading edges and a pause at the start of every round, when it fits it stands still. Stops on hover, on focus and on a tap (WCAG 2.2.2); wraps with «reduce motion»; a screen reader reads it once. `text` or inline content in the slot, `speed`, `gap`, `fade` (the left fade takes that much room left of the text: give the parent the padding), `paused`, `pauseOnHover`, `roundPause` (`false`: no rest at the start of a round), `decorative` (a ghost for a background line: hidden from a screen reader, no tab stop, no reaction to a cursor or a tap, no selection, no pause between rounds)
59
59
  - **TaoInput** — text field with v-model, validation, and `#prefix` / `#suffix` slots (icon or text inside the frame); `variant` `outline` / `filled` / `plain` (no frame: an item of a list being edited; `TaoInputNumber`, `TaoCombobox` and `TaoTextarea` take it too)
60
60
  - **TaoInputGroup** — outer glue: `#before` | field | `#after` (protocol, unit, button)
61
61
  - **TaoModal** — modal with animation and slots; `fullscreen` (or `fullscreen="narrow"`: a page on a phone, a dialog on a computer); `surface="grain"` / `"glass"`, class and attributes on the dialog panel; the content scrolls under a header and a footer that stay
package/README.ru.md CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  - **Сначала токены.** Цвета, радиусы, отступы и шрифты — CSS-переменные в три слоя (примитивы, семантика, тема). Перекрасить набор или одну панель можно, не трогая компоненты. Размер и плотность — тоже контексты: задайте их один раз на панели, и всё внутри последует.
30
30
  - **Палитры.** Семь готовых палитр, каждая из четырёх цветов, или своя в рантайме (`applyTaoPalette`). Статусные цвета сами отходят от акцента, а графики перекрашиваются вместе с темой.
31
- - **Контраст, которому можно верить.** Цветовые пары тем и палитр проверяются тестами по WCAG 2 (4.5:1 для текста, 3:1 для подписи на заливке); тёмной или белой быть подписи, решает APCA.
31
+ - **Контраст, которому можно верить.** Цветовые пары тем и палитр проверяются тестами по WCAG 2 (4.5:1 для текста, 3:1 для подписи на заливке); тёмной или белой быть подписи, решает APCA. Раздел витрины **Контраст и клавиатура** измеряет страницу, на которой вы стоите, собирает палитру из четырёх стопов через `applyTaoPalette()` и перечисляет, что делают клавиши.
32
32
  - **Подстраивается без JS.** `TaoNav` превращается из нижней панели в рейку и боковую панель, bento-сетка перестраивается, главное действие переезжает вместе с навигацией — по ширине своего контейнера (container queries), а не окна. После гидратации ничего не прыгает.
33
33
  - **Клавиатура и скринридеры.** Меню, полоса меню, панель инструментов, дерево и навигация сделаны по шаблонам WAI-ARIA: одна остановка Tab и стрелки внутри (roving tabindex), переключатели с `aria-pressed`, `role="meter"`, ловушки фокуса в оверлеях.
34
34
  - **Графики по-честному.** Маленькие `TaoSparkline` / `TaoMeter` / `TaoDonut` / `TaoHeatmap` для карточек и строк текста; для настоящих графиков `taoChartTheme()` отдаёт цвета темы в Chart.js, ECharts или uPlot.
@@ -55,7 +55,7 @@
55
55
  - **TaoButton** — кнопка. `variant`: `primary` / `secondary` / `ghost` / `text`; `tone` красит любой из них (по умолчанию акцент, neutral, success, danger, warning, info). `v-model:pressed` делает её переключателем (`aria-pressed`); `shortcut="N"` показывает клавишу в конце кнопки (`aria-keyshortcuts`; слушать её — дело приложения)
56
56
  - **TaoCard** — карточка со слотами media / header / title / footer и `#corner` (тег, кнопка меню). В `#media` — фото или `TaoCarousel`; `closable` добавляет крестик и событие `close`. `flush` — плитка без padding/тени на всю ячейку; `#overlay` — scrim на media; `stripe="top | left | bottom"` со `stripeTone` (тон или `gradient` палитры) рисует цветную полосу, которую обрезают углы
57
57
  - **TaoCopy** — иконка копирования в буфер. После клика сверху тултип «Скопировано»; если кнопку убрали — тултип тоже
58
- - **TaoMarquee** — одна строка без переносов: не помещается — бежит по кругу с гаснущими краями и паузой в начале каждого круга, помещается — стоит. Останавливается при наведении, фокусе и тапе (WCAG 2.2.2); при «уменьшить движение» переносится; скринридер читает один раз. `text` или строчное содержимое в слоте, `speed`, `gap`, `fade` (левое затухание занимает столько места слева от текста: дайте родителю такой padding), `paused`
58
+ - **TaoMarquee** — одна строка без переносов: не помещается — бежит по кругу с гаснущими краями и паузой в начале каждого круга, помещается — стоит. Останавливается при наведении, фокусе и тапе (WCAG 2.2.2); при «уменьшить движение» переносится; скринридер читает один раз. `text` или строчное содержимое в слоте, `speed`, `gap`, `fade` (левое затухание занимает столько места слева от текста: дайте родителю такой padding), `paused`, `pauseOnHover`, `roundPause` (`false`: без паузы в начале круга), `decorative` (призрак для строки-фона: скрыта от скринридера, не остановка Tab, не реагирует на курсор и тап, не выделяется, без пауз между кругами)
59
59
  - **TaoInput** — поле ввода с поддержкой v-model, валидации и слотов `#prefix` / `#suffix` (иконка или текст внутри рамки); `variant` `outline` / `filled` / `plain` (без рамки: пункт списка в правке; его берут и `TaoInputNumber`, `TaoCombobox`, `TaoTextarea`)
60
60
  - **TaoInputGroup** — склейка снаружи: `#before` | поле | `#after` (протокол, единица, кнопка)
61
61
  - **TaoModal** — модальное окно с анимацией и слотами; `fullscreen` (или `fullscreen="narrow"`: страница на телефоне, окно на компьютере); `surface="grain"` / `"glass"`, класс и атрибуты — на панели окна; прокручивается содержимое под шапкой и подвалом, которые на месте
package/dist/index.d.ts CHANGED
@@ -1520,7 +1520,33 @@ gap?: number;
1520
1520
  * родителю нужно столько места слева (его padding), иначе бегущий текст покажется за его краем. 0 — без затухания.
1521
1521
  */
1522
1522
  fade?: number;
1523
+ /**
1524
+ * Stops under the pointer, and a tap stops and starts it. Turn it off when the line is a background (a design
1525
+ * feature): a cursor or a finger passing by does not stop it, and its text cannot be selected (a line that runs
1526
+ * away from a selection is no text to copy). Focus still stops it, and it is still a tab stop while it runs.
1527
+ * Останавливается под курсором, а тап останавливает и запускает. Выключите, когда строка — фон (приём дизайна):
1528
+ * мимо идущий курсор или палец её не останавливает, а текст не выделяется (убегающую строку не скопировать).
1529
+ * Фокус всё равно останавливает, и пока строка бежит, она остаётся остановкой Tab.
1530
+ */
1523
1531
  pauseOnHover?: boolean;
1532
+ /**
1533
+ * A pause at the start of every round, to read the beginning. Off, the line runs round without a stop, like a
1534
+ * looped picture. Without it set, a decorative line has no pause and an ordinary one has.
1535
+ * Пауза в начале каждого круга, чтобы прочитать начало. Выключенная — строка бежит по кругу без остановок, как
1536
+ * зацикленная картинка. Если не задана: у декоративной строки паузы нет, у обычной есть.
1537
+ */
1538
+ roundPause?: boolean;
1539
+ /**
1540
+ * A line that is only decoration (a background, a design feature) and carries no meaning: a ghost. Hidden from a
1541
+ * screen reader, not a tab stop, nothing under a cursor or a finger reacts, the text cannot be selected, and it
1542
+ * runs round without a pause. Only for text nobody needs to read: the stop that WCAG 2.2.2 asks of moving content
1543
+ * does not apply to pure decoration. With «reduce motion» it stands still and is clipped, it does not wrap.
1544
+ * Строка-декор (фон, приём дизайна) без смысла: призрак. Скрыта от скринридера, не остановка Tab, курсор и палец
1545
+ * для неё пустое место, текст не выделяется, бежит по кругу без пауз. Только для текста, который никому не нужно
1546
+ * читать: остановка, которую WCAG 2.2.2 требует от движения, чистому декору не нужна. При «уменьшить движение» стоит
1547
+ * и обрезана, не переносится.
1548
+ */
1549
+ decorative?: boolean;
1524
1550
  /** Stopped by the app. / Остановлена приложением. */
1525
1551
  paused?: boolean;
1526
1552
  }>, {
@@ -1529,6 +1555,8 @@ speed: number;
1529
1555
  gap: number;
1530
1556
  fade: number;
1531
1557
  pauseOnHover: boolean;
1558
+ roundPause: undefined;
1559
+ decorative: boolean;
1532
1560
  paused: boolean;
1533
1561
  }>>, {
1534
1562
  /** Measures again (after the content changed in a way the marquee cannot see). / Перемерить. */
@@ -1548,7 +1576,33 @@ gap?: number;
1548
1576
  * родителю нужно столько места слева (его padding), иначе бегущий текст покажется за его краем. 0 — без затухания.
1549
1577
  */
1550
1578
  fade?: number;
1579
+ /**
1580
+ * Stops under the pointer, and a tap stops and starts it. Turn it off when the line is a background (a design
1581
+ * feature): a cursor or a finger passing by does not stop it, and its text cannot be selected (a line that runs
1582
+ * away from a selection is no text to copy). Focus still stops it, and it is still a tab stop while it runs.
1583
+ * Останавливается под курсором, а тап останавливает и запускает. Выключите, когда строка — фон (приём дизайна):
1584
+ * мимо идущий курсор или палец её не останавливает, а текст не выделяется (убегающую строку не скопировать).
1585
+ * Фокус всё равно останавливает, и пока строка бежит, она остаётся остановкой Tab.
1586
+ */
1551
1587
  pauseOnHover?: boolean;
1588
+ /**
1589
+ * A pause at the start of every round, to read the beginning. Off, the line runs round without a stop, like a
1590
+ * looped picture. Without it set, a decorative line has no pause and an ordinary one has.
1591
+ * Пауза в начале каждого круга, чтобы прочитать начало. Выключенная — строка бежит по кругу без остановок, как
1592
+ * зацикленная картинка. Если не задана: у декоративной строки паузы нет, у обычной есть.
1593
+ */
1594
+ roundPause?: boolean;
1595
+ /**
1596
+ * A line that is only decoration (a background, a design feature) and carries no meaning: a ghost. Hidden from a
1597
+ * screen reader, not a tab stop, nothing under a cursor or a finger reacts, the text cannot be selected, and it
1598
+ * runs round without a pause. Only for text nobody needs to read: the stop that WCAG 2.2.2 asks of moving content
1599
+ * does not apply to pure decoration. With «reduce motion» it stands still and is clipped, it does not wrap.
1600
+ * Строка-декор (фон, приём дизайна) без смысла: призрак. Скрыта от скринридера, не остановка Tab, курсор и палец
1601
+ * для неё пустое место, текст не выделяется, бежит по кругу без пауз. Только для текста, который никому не нужно
1602
+ * читать: остановка, которую WCAG 2.2.2 требует от движения, чистому декору не нужна. При «уменьшить движение» стоит
1603
+ * и обрезана, не переносится.
1604
+ */
1605
+ decorative?: boolean;
1552
1606
  /** Stopped by the app. / Остановлена приложением. */
1553
1607
  paused?: boolean;
1554
1608
  }>, {
@@ -1557,6 +1611,8 @@ speed: number;
1557
1611
  gap: number;
1558
1612
  fade: number;
1559
1613
  pauseOnHover: boolean;
1614
+ roundPause: undefined;
1615
+ decorative: boolean;
1560
1616
  paused: boolean;
1561
1617
  }>>> & Readonly<{}>, {
1562
1618
  text: string;
@@ -1565,6 +1621,8 @@ gap: number;
1565
1621
  paused: boolean;
1566
1622
  fade: number;
1567
1623
  pauseOnHover: boolean;
1624
+ roundPause: boolean;
1625
+ decorative: boolean;
1568
1626
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
1569
1627
 
1570
1628
  declare const __VLS_component_46: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_46<__VLS_TypePropsToRuntimeProps_50<{
package/dist/index.js CHANGED
@@ -6668,7 +6668,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
6668
6668
  }
6669
6669
  });
6670
6670
  const TaoTimeline = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-48847c47"]]);
6671
- const _hoisted_1$u = ["tabindex"];
6671
+ const _hoisted_1$u = ["tabindex", "aria-hidden", "inert"];
6672
6672
  const _hoisted_2$r = { class: "tao-marquee__item" };
6673
6673
  const _hoisted_3$n = {
6674
6674
  key: 0,
@@ -6685,6 +6685,8 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
6685
6685
  gap: { default: 48 },
6686
6686
  fade: { default: 22 },
6687
6687
  pauseOnHover: { type: Boolean, default: true },
6688
+ roundPause: { type: Boolean, default: void 0 },
6689
+ decorative: { type: Boolean, default: false },
6688
6690
  paused: { type: Boolean, default: false }
6689
6691
  },
6690
6692
  setup(__props, { expose: __expose }) {
@@ -6700,7 +6702,8 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
6700
6702
  let motionQuery = null;
6701
6703
  const overflowing = computed(() => itemWidth.value > boxWidth.value + 1);
6702
6704
  const running = computed(() => overflowing.value && !reduce.value);
6703
- const wrapping = computed(() => overflowing.value && reduce.value);
6705
+ const wrapping = computed(() => overflowing.value && reduce.value && !props.decorative);
6706
+ const restAtStart = computed(() => props.roundPause ?? !props.decorative);
6704
6707
  const stopped = computed(() => props.paused || tapped.value);
6705
6708
  const trackStyle = computed(() => {
6706
6709
  const shift = itemWidth.value + props.gap;
@@ -6722,7 +6725,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
6722
6725
  reduce.value = Boolean(motionQuery?.matches);
6723
6726
  }
6724
6727
  function onPointerUp(event) {
6725
- if (running.value && event.pointerType !== "mouse") {
6728
+ if (!props.decorative && props.pauseOnHover && running.value && event.pointerType !== "mouse") {
6726
6729
  tapped.value = !tapped.value;
6727
6730
  }
6728
6731
  }
@@ -6761,10 +6764,14 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
6761
6764
  "tao-marquee--run": running.value,
6762
6765
  "tao-marquee--wrap": wrapping.value,
6763
6766
  "tao-marquee--stopped": stopped.value,
6764
- "tao-marquee--hover-pause": __props.pauseOnHover
6767
+ "tao-marquee--hover-pause": __props.pauseOnHover && !__props.decorative,
6768
+ "tao-marquee--seamless": !restAtStart.value,
6769
+ "tao-marquee--ghost": __props.decorative
6765
6770
  }]),
6766
6771
  style: normalizeStyle({ "--_fade": `${__props.fade}px` }),
6767
- tabindex: running.value ? 0 : void 0,
6772
+ tabindex: running.value && !__props.decorative ? 0 : void 0,
6773
+ "aria-hidden": __props.decorative ? "true" : void 0,
6774
+ inert: __props.decorative || void 0,
6768
6775
  onPointerup: onPointerUp
6769
6776
  }, [
6770
6777
  createElementVNode("span", {
@@ -6797,7 +6804,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
6797
6804
  };
6798
6805
  }
6799
6806
  });
6800
- const TaoMarquee = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-baa9520c"]]);
6807
+ const TaoMarquee = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-300f470a"]]);
6801
6808
  const PIN_CELL = "#";
6802
6809
  function parsePinFormat(format) {
6803
6810
  const mask = [...format];
@@ -11075,6 +11082,38 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
11075
11082
  }
11076
11083
  });
11077
11084
  const TaoBreadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-b853fbd5"]]);
11085
+ function rollRanks(previous, next) {
11086
+ if (!previous) {
11087
+ return next.map(() => 0);
11088
+ }
11089
+ const ranks = next.map(() => 0);
11090
+ let rank = 0;
11091
+ for (let offset = 1; offset <= next.length; offset += 1) {
11092
+ const index = next.length - offset;
11093
+ if (previous[previous.length - offset] !== next[index]) {
11094
+ ranks[index] = rank;
11095
+ rank += 1;
11096
+ }
11097
+ }
11098
+ return ranks;
11099
+ }
11100
+ function createRollGate(onIdle) {
11101
+ let rolling = 0;
11102
+ return {
11103
+ get busy() {
11104
+ return rolling > 0;
11105
+ },
11106
+ start() {
11107
+ rolling += 1;
11108
+ },
11109
+ end() {
11110
+ rolling = Math.max(0, rolling - 1);
11111
+ if (rolling === 0) {
11112
+ onIdle();
11113
+ }
11114
+ }
11115
+ };
11116
+ }
11078
11117
  const _hoisted_1$5 = ["aria-label"];
11079
11118
  const _hoisted_2$4 = {
11080
11119
  class: "tao-counter__row",
@@ -11089,22 +11128,32 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
11089
11128
  },
11090
11129
  setup(__props) {
11091
11130
  const props = __props;
11131
+ const shown = ref(props.value);
11132
+ function catchUp() {
11133
+ if (!gate.busy && shown.value !== props.value) {
11134
+ shown.value = props.value;
11135
+ }
11136
+ }
11137
+ const gate = createRollGate(catchUp);
11138
+ watch(() => props.value, catchUp);
11092
11139
  function formatDigits(num, minDigits) {
11093
11140
  const abs = Math.abs(Math.trunc(num));
11094
11141
  return abs.toString().padStart(Math.max(1, minDigits), "0").replace(/\B(?=(\d{3})+(?!\d))/g, " ");
11095
11142
  }
11096
- const slots = computed(() => {
11097
- const formatted = formatDigits(props.value, props.maxDigits);
11098
- const significant = Math.abs(Math.trunc(props.value)).toString();
11143
+ const isDigit = (slot) => /\d/.test(slot.value);
11144
+ const slots = computed((previous) => {
11145
+ const formatted = formatDigits(shown.value, props.maxDigits);
11146
+ const significant = Math.abs(Math.trunc(shown.value)).toString();
11099
11147
  const leadingZeros = Math.max(0, props.maxDigits - significant.length);
11100
11148
  const result = [];
11101
11149
  let digitCount = 0;
11102
- if (props.value < 0) {
11150
+ if (shown.value < 0) {
11103
11151
  result.push({
11104
11152
  value: "−",
11105
11153
  isSpace: false,
11106
11154
  isLeadingZero: false,
11107
- key: "sign"
11155
+ key: "sign",
11156
+ rank: 0
11108
11157
  });
11109
11158
  }
11110
11159
  for (let index = 0; index < formatted.length; index += 1) {
@@ -11114,7 +11163,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
11114
11163
  value: " ",
11115
11164
  isSpace: true,
11116
11165
  isLeadingZero: false,
11117
- key: `space-${index}`
11166
+ key: `space-${index}`,
11167
+ rank: 0
11118
11168
  });
11119
11169
  continue;
11120
11170
  }
@@ -11122,10 +11172,16 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
11122
11172
  value: char,
11123
11173
  isSpace: false,
11124
11174
  isLeadingZero: digitCount < leadingZeros,
11125
- key: `${index}-${char}`
11175
+ key: `${index}-${char}`,
11176
+ rank: 0
11126
11177
  });
11127
11178
  digitCount += 1;
11128
11179
  }
11180
+ const digits = result.filter(isDigit);
11181
+ const ranks = rollRanks(previous?.filter(isDigit).map((slot) => slot.value), digits.map((slot) => slot.value));
11182
+ digits.forEach((slot, index) => {
11183
+ slot.rank = ranks[index] ?? 0;
11184
+ });
11129
11185
  return result;
11130
11186
  });
11131
11187
  return (_ctx, _cache) => {
@@ -11138,9 +11194,18 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
11138
11194
  (openBlock(true), createElementBlock(Fragment, null, renderList(slots.value, (slot, index) => {
11139
11195
  return openBlock(), createElementBlock("div", {
11140
11196
  key: `${index}-${slot.isSpace ? "gap" : "d"}`,
11141
- class: normalizeClass(["tao-counter__slot", { "tao-counter__slot--space": slot.isSpace }])
11197
+ class: normalizeClass(["tao-counter__slot", { "tao-counter__slot--space": slot.isSpace }]),
11198
+ style: normalizeStyle({ "--_rank": slot.rank })
11142
11199
  }, [
11143
- createVNode(TransitionGroup, { name: "tao-digit" }, {
11200
+ createVNode(TransitionGroup, {
11201
+ name: "tao-digit",
11202
+ onBeforeEnter: _cache[0] || (_cache[0] = ($event) => unref(gate).start()),
11203
+ onAfterEnter: _cache[1] || (_cache[1] = ($event) => unref(gate).end()),
11204
+ onEnterCancelled: _cache[2] || (_cache[2] = ($event) => unref(gate).end()),
11205
+ onBeforeLeave: _cache[3] || (_cache[3] = ($event) => unref(gate).start()),
11206
+ onAfterLeave: _cache[4] || (_cache[4] = ($event) => unref(gate).end()),
11207
+ onLeaveCancelled: _cache[5] || (_cache[5] = ($event) => unref(gate).end())
11208
+ }, {
11144
11209
  default: withCtx(() => [
11145
11210
  !slot.isSpace ? (openBlock(), createElementBlock("span", {
11146
11211
  key: slot.key,
@@ -11149,14 +11214,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
11149
11214
  ]),
11150
11215
  _: 2
11151
11216
  }, 1024)
11152
- ], 2);
11217
+ ], 6);
11153
11218
  }), 128))
11154
11219
  ])
11155
11220
  ], 8, _hoisted_1$5);
11156
11221
  };
11157
11222
  }
11158
11223
  });
11159
- const TaoCounter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-9e11d2be"]]);
11224
+ const TaoCounter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-0607352a"]]);
11160
11225
  const GLIDE_TIME = 325;
11161
11226
  const FLICK_SPEED = 0.3;
11162
11227
  function glideTarget(from, velocity, pitch, max) {