@1337exp/taoui 5.19.1 → 5.20.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,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.20.0
4
+
5
+ Nothing to migrate; the library does not change.
6
+
7
+ - **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.
8
+ - 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.
9
+
10
+ ## 5.19.3
11
+
12
+ A fix; nothing to migrate.
13
+
14
+ - **`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`.
15
+
16
+ ## 5.19.2
17
+
18
+ A polish; nothing to migrate.
19
+
20
+ - **`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`.
21
+
3
22
  ## 5.19.1
4
23
 
5
24
  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.
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.
package/dist/index.js CHANGED
@@ -11075,6 +11075,38 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
11075
11075
  }
11076
11076
  });
11077
11077
  const TaoBreadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-b853fbd5"]]);
11078
+ function rollRanks(previous, next) {
11079
+ if (!previous) {
11080
+ return next.map(() => 0);
11081
+ }
11082
+ const ranks = next.map(() => 0);
11083
+ let rank = 0;
11084
+ for (let offset = 1; offset <= next.length; offset += 1) {
11085
+ const index = next.length - offset;
11086
+ if (previous[previous.length - offset] !== next[index]) {
11087
+ ranks[index] = rank;
11088
+ rank += 1;
11089
+ }
11090
+ }
11091
+ return ranks;
11092
+ }
11093
+ function createRollGate(onIdle) {
11094
+ let rolling = 0;
11095
+ return {
11096
+ get busy() {
11097
+ return rolling > 0;
11098
+ },
11099
+ start() {
11100
+ rolling += 1;
11101
+ },
11102
+ end() {
11103
+ rolling = Math.max(0, rolling - 1);
11104
+ if (rolling === 0) {
11105
+ onIdle();
11106
+ }
11107
+ }
11108
+ };
11109
+ }
11078
11110
  const _hoisted_1$5 = ["aria-label"];
11079
11111
  const _hoisted_2$4 = {
11080
11112
  class: "tao-counter__row",
@@ -11089,22 +11121,32 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
11089
11121
  },
11090
11122
  setup(__props) {
11091
11123
  const props = __props;
11124
+ const shown = ref(props.value);
11125
+ function catchUp() {
11126
+ if (!gate.busy && shown.value !== props.value) {
11127
+ shown.value = props.value;
11128
+ }
11129
+ }
11130
+ const gate = createRollGate(catchUp);
11131
+ watch(() => props.value, catchUp);
11092
11132
  function formatDigits(num, minDigits) {
11093
11133
  const abs = Math.abs(Math.trunc(num));
11094
11134
  return abs.toString().padStart(Math.max(1, minDigits), "0").replace(/\B(?=(\d{3})+(?!\d))/g, " ");
11095
11135
  }
11096
- const slots = computed(() => {
11097
- const formatted = formatDigits(props.value, props.maxDigits);
11098
- const significant = Math.abs(Math.trunc(props.value)).toString();
11136
+ const isDigit = (slot) => /\d/.test(slot.value);
11137
+ const slots = computed((previous) => {
11138
+ const formatted = formatDigits(shown.value, props.maxDigits);
11139
+ const significant = Math.abs(Math.trunc(shown.value)).toString();
11099
11140
  const leadingZeros = Math.max(0, props.maxDigits - significant.length);
11100
11141
  const result = [];
11101
11142
  let digitCount = 0;
11102
- if (props.value < 0) {
11143
+ if (shown.value < 0) {
11103
11144
  result.push({
11104
11145
  value: "−",
11105
11146
  isSpace: false,
11106
11147
  isLeadingZero: false,
11107
- key: "sign"
11148
+ key: "sign",
11149
+ rank: 0
11108
11150
  });
11109
11151
  }
11110
11152
  for (let index = 0; index < formatted.length; index += 1) {
@@ -11114,7 +11156,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
11114
11156
  value: " ",
11115
11157
  isSpace: true,
11116
11158
  isLeadingZero: false,
11117
- key: `space-${index}`
11159
+ key: `space-${index}`,
11160
+ rank: 0
11118
11161
  });
11119
11162
  continue;
11120
11163
  }
@@ -11122,10 +11165,16 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
11122
11165
  value: char,
11123
11166
  isSpace: false,
11124
11167
  isLeadingZero: digitCount < leadingZeros,
11125
- key: `${index}-${char}`
11168
+ key: `${index}-${char}`,
11169
+ rank: 0
11126
11170
  });
11127
11171
  digitCount += 1;
11128
11172
  }
11173
+ const digits = result.filter(isDigit);
11174
+ const ranks = rollRanks(previous?.filter(isDigit).map((slot) => slot.value), digits.map((slot) => slot.value));
11175
+ digits.forEach((slot, index) => {
11176
+ slot.rank = ranks[index] ?? 0;
11177
+ });
11129
11178
  return result;
11130
11179
  });
11131
11180
  return (_ctx, _cache) => {
@@ -11138,9 +11187,18 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
11138
11187
  (openBlock(true), createElementBlock(Fragment, null, renderList(slots.value, (slot, index) => {
11139
11188
  return openBlock(), createElementBlock("div", {
11140
11189
  key: `${index}-${slot.isSpace ? "gap" : "d"}`,
11141
- class: normalizeClass(["tao-counter__slot", { "tao-counter__slot--space": slot.isSpace }])
11190
+ class: normalizeClass(["tao-counter__slot", { "tao-counter__slot--space": slot.isSpace }]),
11191
+ style: normalizeStyle({ "--_rank": slot.rank })
11142
11192
  }, [
11143
- createVNode(TransitionGroup, { name: "tao-digit" }, {
11193
+ createVNode(TransitionGroup, {
11194
+ name: "tao-digit",
11195
+ onBeforeEnter: _cache[0] || (_cache[0] = ($event) => unref(gate).start()),
11196
+ onAfterEnter: _cache[1] || (_cache[1] = ($event) => unref(gate).end()),
11197
+ onEnterCancelled: _cache[2] || (_cache[2] = ($event) => unref(gate).end()),
11198
+ onBeforeLeave: _cache[3] || (_cache[3] = ($event) => unref(gate).start()),
11199
+ onAfterLeave: _cache[4] || (_cache[4] = ($event) => unref(gate).end()),
11200
+ onLeaveCancelled: _cache[5] || (_cache[5] = ($event) => unref(gate).end())
11201
+ }, {
11144
11202
  default: withCtx(() => [
11145
11203
  !slot.isSpace ? (openBlock(), createElementBlock("span", {
11146
11204
  key: slot.key,
@@ -11149,14 +11207,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
11149
11207
  ]),
11150
11208
  _: 2
11151
11209
  }, 1024)
11152
- ], 2);
11210
+ ], 6);
11153
11211
  }), 128))
11154
11212
  ])
11155
11213
  ], 8, _hoisted_1$5);
11156
11214
  };
11157
11215
  }
11158
11216
  });
11159
- const TaoCounter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-9e11d2be"]]);
11217
+ const TaoCounter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-0607352a"]]);
11160
11218
  const GLIDE_TIME = 325;
11161
11219
  const FLICK_SPEED = 0.3;
11162
11220
  function glideTarget(from, velocity, pitch, max) {