@1337exp/taoui 5.13.0 → 5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.14.0
4
+
5
+ Nothing to migrate.
6
+
7
+ - **`TaoList` `roving`.** One Tab stop for the whole list: the arrows move between the rows, Home / End to the first and the last, disabled rows are skipped, and Tab comes back to the row it left (the selected one the first time). The stop of a row is its button (`clickable`) or the row itself, with the focus ring of a clickable row. Rows added or removed are followed; a key pressed in a row's own control (an input, a menu) stays with it. An app no longer writes its own roving tabindex for a list of records.
8
+ - **`TaoListItem` focus ring round the whole row.** On a `clickable` row the ring was drawn on its button, inside the row's padding, so it stood off the edges while the highlight ran the full width. It goes round the row now (`:has()`; older browsers keep the ring on the button).
9
+ - Showcase: the «People» list is roving.
10
+
3
11
  ## 5.13.0
4
12
 
5
13
  Nothing to migrate.
package/README.md CHANGED
@@ -107,7 +107,7 @@
107
107
  - **TaoHeatmap** — a value for each pair of two things (orders by weekday and hour): `values` by `rows` × `cols`, the colour by thresholds (`steps`, round numbers by default) that the legend names («500+»), the faint levels striped, a tip with the exact number. A `role="grid"` the arrows move through, a screen reader reads the row, the column and the number; it fits its container and shows the column names as often as they fit
108
108
  - **TaoPagination** — pages with ellipsis. Clicking “…” jumps `jump` pages (5 by default). `pageSizes` adds a «Per page» choice (`v-model:page-size`); the first row on screen stays on screen
109
109
  - **TaoEmpty** — empty list, no results, no access
110
- - **TaoList** / **TaoListItem** — list row: icon, title, caption, hover action. Not Select, not a table
110
+ - **TaoList** / **TaoListItem** — list row: icon, title, caption, hover action. Not Select, not a table; `roving` makes it one Tab stop with the arrows between the rows
111
111
  - **TaoTree** — files or objects as a tree: `v-model:expanded`, selection `none | single | multiple` (`v-model:selected`), checkboxes with mixed parents (`checkable`, `v-model:checked`), lazy children (`hasChildren` + `load`). ARIA tree: one tab stop, arrows, `→` / `←` in and out, Home / End, `*`, type-ahead. Slots `#icon`, `#label`, `#actions`; rows on the control tokens (size and density)
112
112
  - **TaoStages** — stage list: `wait` / `work` / `ok` / `bad`. Not a linear stepper
113
113
  - **TaoTimeline** — a vertical feed of events: order steps, releases, a log. `active` fills the line up to the current event (`aria-current="step"`), without it the feed is a log of the past; `tone` and `icon` per marker, `#marker` / `#title` / `#content` slots; `align="alternate"` puts events on both sides and folds into one below 480px of its own width
package/README.ru.md CHANGED
@@ -107,7 +107,7 @@
107
107
  - **TaoHeatmap** — значение для каждой пары (заказы по дню недели и часу): `values` по `rows` × `cols`, цвет по порогам (`steps`, по умолчанию круглые числа), которые называет легенда («500+»), бледные уровни в полоску, подсказка с точным числом. `role="grid"`, по которому ходят стрелками; скринридер читает строку, столбец и число; занимает ширину контейнера и показывает имена столбцов так часто, как они помещаются
108
108
  - **TaoPagination** — страницы с многоточием. Клик по «…» прыгает на `jump` страниц (5 по умолчанию). `pageSizes` добавляет выбор «На странице» (`v-model:page-size`); первая видимая строка остаётся на экране
109
109
  - **TaoEmpty** — пустой список, нет результатов, нет прав
110
- - **TaoList** / **TaoListItem** — строка списка: иконка, заголовок, подпись, действие по ховеру. Не Select и не таблица
110
+ - **TaoList** / **TaoListItem** — строка списка: иконка, заголовок, подпись, действие по ховеру. Не Select и не таблица; `roving` — одна остановка Tab, стрелки ходят по строкам
111
111
  - **TaoTree** — файлы или объекты деревом: `v-model:expanded`, выбор `none | single | multiple` (`v-model:selected`), чекбоксы с промежуточным состоянием родителя (`checkable`, `v-model:checked`), ленивая подгрузка (`hasChildren` + `load`). ARIA tree: одна остановка Tab, стрелки, `→` / `←` внутрь и наружу, Home / End, `*`, поиск по буквам. Слоты `#icon`, `#label`, `#actions`; строки на токенах контролов (размер и плотность)
112
112
  - **TaoStages** — список стадий: `wait` / `work` / `ok` / `bad`. Не линейный степпер
113
113
  - **TaoTimeline** — вертикальная лента событий: шаги заказа, релизы, журнал. `active` заливает линию до текущего события (`aria-current="step"`), без него лента — журнал прошедшего; `tone` и `icon` у маркера, слоты `#marker` / `#title` / `#content`; `align="alternate"` раскладывает события по обе стороны и складывается в одну уже 480px своей ширины
package/dist/index.d.ts CHANGED
@@ -2580,11 +2580,21 @@ maxHeight?: TaoLength;
2580
2580
  /** Показать `#empty` вместо строк. */
2581
2581
  empty?: boolean;
2582
2582
  ariaLabel?: string;
2583
+ /**
2584
+ * One Tab stop for the whole list: the arrows move between the rows, Home / End to the first and the last;
2585
+ * disabled rows are skipped. Tab comes back to the row it left (the selected one the first time). A row's
2586
+ * stop is its button (`clickable`) or the row itself.
2587
+ * Одна остановка Tab на весь список: стрелки ходят по строкам, Home / End — в начало и в конец; недоступные
2588
+ * пропускаются. Tab возвращается в строку, из которой ушёл (в первый раз — в выбранную). Остановка строки — её
2589
+ * кнопка (`clickable`) или сама строка.
2590
+ */
2591
+ roving?: boolean;
2583
2592
  }>, {
2584
2593
  bordered: boolean;
2585
2594
  divided: boolean;
2586
2595
  empty: boolean;
2587
2596
  ariaLabel: string;
2597
+ roving: boolean;
2588
2598
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_65<__VLS_TypePropsToRuntimeProps_70<{
2589
2599
  /** Row height; items inherit it. Without it — the size of ancestors. / Высота строк, item наследует. Без него — размер предков. */
2590
2600
  size?: TaoSize;
@@ -2597,16 +2607,27 @@ maxHeight?: TaoLength;
2597
2607
  /** Показать `#empty` вместо строк. */
2598
2608
  empty?: boolean;
2599
2609
  ariaLabel?: string;
2610
+ /**
2611
+ * One Tab stop for the whole list: the arrows move between the rows, Home / End to the first and the last;
2612
+ * disabled rows are skipped. Tab comes back to the row it left (the selected one the first time). A row's
2613
+ * stop is its button (`clickable`) or the row itself.
2614
+ * Одна остановка Tab на весь список: стрелки ходят по строкам, Home / End — в начало и в конец; недоступные
2615
+ * пропускаются. Tab возвращается в строку, из которой ушёл (в первый раз — в выбранную). Остановка строки — её
2616
+ * кнопка (`clickable`) или сама строка.
2617
+ */
2618
+ roving?: boolean;
2600
2619
  }>, {
2601
2620
  bordered: boolean;
2602
2621
  divided: boolean;
2603
2622
  empty: boolean;
2604
2623
  ariaLabel: string;
2624
+ roving: boolean;
2605
2625
  }>>> & Readonly<{}>, {
2606
2626
  empty: boolean;
2607
2627
  ariaLabel: string;
2608
2628
  bordered: boolean;
2609
2629
  divided: boolean;
2630
+ roving: boolean;
2610
2631
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
2611
2632
 
2612
2633
  declare const __VLS_component_64: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_66<__VLS_TypePropsToRuntimeProps_71<{
package/dist/index.js CHANGED
@@ -10390,7 +10390,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
10390
10390
  divided: { type: Boolean, default: true },
10391
10391
  maxHeight: {},
10392
10392
  empty: { type: Boolean, default: false },
10393
- ariaLabel: { default: "" }
10393
+ ariaLabel: { default: "" },
10394
+ roving: { type: Boolean, default: false }
10394
10395
  },
10395
10396
  setup(__props) {
10396
10397
  const appLocale = useTaoLocale();
@@ -10399,8 +10400,85 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
10399
10400
  const value = toCssLength(props.maxHeight);
10400
10401
  return value ? { maxHeight: value } : void 0;
10401
10402
  });
10403
+ const listRef = ref(null);
10404
+ const current2 = ref(-1);
10405
+ function rows() {
10406
+ const list = listRef.value;
10407
+ if (!list) {
10408
+ return [];
10409
+ }
10410
+ return [...list.children].filter((el) => el instanceof HTMLElement && el.tagName === "LI" && !el.classList.contains("tao-list__empty")).map((el) => {
10411
+ const hit = [...el.children].find((child) => child.matches("button.tao-list-item__hit"));
10412
+ return { el, target: hit ?? el, enabled: el.getAttribute("aria-disabled") !== "true" && !hit?.disabled };
10413
+ });
10414
+ }
10415
+ const isSelected = (row) => row.el.classList.contains("tao-list-item--selected") || row.el.getAttribute("aria-current") === "true" || row.target.getAttribute("aria-current") === "true";
10416
+ function sync() {
10417
+ if (!props.roving) {
10418
+ return;
10419
+ }
10420
+ const all = rows();
10421
+ let index = current2.value;
10422
+ if (!all[index]?.enabled) {
10423
+ const selected = all.findIndex((row) => row.enabled && isSelected(row));
10424
+ index = selected >= 0 ? selected : all.findIndex((row) => row.enabled);
10425
+ }
10426
+ current2.value = index;
10427
+ all.forEach((row, i) => row.target.setAttribute("tabindex", i === index ? "0" : "-1"));
10428
+ }
10429
+ function release() {
10430
+ for (const row of rows()) {
10431
+ row.target.removeAttribute("tabindex");
10432
+ }
10433
+ }
10434
+ function onKeydown2(event) {
10435
+ if (!props.roving || event.altKey || event.metaKey) {
10436
+ return;
10437
+ }
10438
+ const all = rows();
10439
+ const from = all.findIndex((row) => row.target === event.target);
10440
+ if (from < 0) {
10441
+ return;
10442
+ }
10443
+ const enabled = all.map((row) => row.enabled);
10444
+ const to = event.key === "ArrowDown" ? stepEnabled(enabled, from, 1, false) : event.key === "ArrowUp" ? stepEnabled(enabled, from, -1, false) : event.key === "Home" ? firstEnabled(enabled) : event.key === "End" ? lastEnabled(enabled) : -2;
10445
+ if (to === -2) {
10446
+ return;
10447
+ }
10448
+ event.preventDefault();
10449
+ if (to >= 0 && to !== from) {
10450
+ current2.value = to;
10451
+ sync();
10452
+ all[to].target.focus();
10453
+ }
10454
+ }
10455
+ function onFocusIn(event) {
10456
+ if (!props.roving) {
10457
+ return;
10458
+ }
10459
+ const index = rows().findIndex((row) => row.target === event.target);
10460
+ if (index >= 0 && index !== current2.value) {
10461
+ current2.value = index;
10462
+ sync();
10463
+ }
10464
+ }
10465
+ let observer;
10466
+ onMounted(() => {
10467
+ sync();
10468
+ if (typeof MutationObserver !== "undefined" && listRef.value) {
10469
+ observer = new MutationObserver(() => sync());
10470
+ observer.observe(listRef.value, { childList: true, subtree: true });
10471
+ }
10472
+ });
10473
+ onBeforeUnmount(() => observer?.disconnect());
10474
+ watch(
10475
+ () => props.roving,
10476
+ (on) => nextTick(() => on ? sync() : release())
10477
+ );
10402
10478
  return (_ctx, _cache) => {
10403
10479
  return openBlock(), createElementBlock("ul", {
10480
+ ref_key: "listRef",
10481
+ ref: listRef,
10404
10482
  class: normalizeClass(["tao-list", [
10405
10483
  unref(sizeClass)(__props.size),
10406
10484
  {
@@ -10408,22 +10486,25 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
10408
10486
  "tao-list--divided": __props.divided,
10409
10487
  "tao-list--plain": !__props.bordered,
10410
10488
  "tao-list--empty": __props.empty,
10411
- "tao-list--scroll": Boolean(__props.maxHeight)
10489
+ "tao-list--scroll": Boolean(__props.maxHeight),
10490
+ "tao-list--roving": __props.roving
10412
10491
  }
10413
10492
  ]]),
10414
10493
  style: normalizeStyle(listStyle.value),
10415
- "aria-label": __props.ariaLabel || void 0
10494
+ "aria-label": __props.ariaLabel || void 0,
10495
+ onKeydown: onKeydown2,
10496
+ onFocusin: onFocusIn
10416
10497
  }, [
10417
10498
  __props.empty ? (openBlock(), createElementBlock("li", _hoisted_2$9, [
10418
10499
  renderSlot(_ctx.$slots, "empty", {}, () => [
10419
10500
  createTextVNode(toDisplayString(unref(appLocale).list.emptyText), 1)
10420
10501
  ], true)
10421
10502
  ])) : renderSlot(_ctx.$slots, "default", {}, void 0, true, 1)
10422
- ], 14, _hoisted_1$b);
10503
+ ], 46, _hoisted_1$b);
10423
10504
  };
10424
10505
  }
10425
10506
  });
10426
- const TaoList = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-c883af92"]]);
10507
+ const TaoList = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-ddec81f4"]]);
10427
10508
  const _hoisted_1$a = ["aria-current", "aria-disabled"];
10428
10509
  const _hoisted_2$8 = {
10429
10510
  key: 0,
@@ -10526,7 +10607,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10526
10607
  };
10527
10608
  }
10528
10609
  });
10529
- const TaoListItem = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-5b58c12a"]]);
10610
+ const TaoListItem = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-dd4f25c2"]]);
10530
10611
  const _hoisted_1$9 = {
10531
10612
  class: "tao-skeleton-group",
10532
10613
  "aria-hidden": true