@1337exp/taoui 5.52.0 → 5.52.1

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
@@ -7,6 +7,7 @@ One look changes by default: a `TaoLink` is underlined now. To keep the old look
7
7
  - **`TaoLink` is underlined, `underline="always" | "hover" | "none"`.** In the light theme the link colour is the text colour (`--tao-color-link` is black, 1.4:1 to the text; in the dark theme 1.1:1, the hue alone), so a link in a list or a line of text did not read as a link without the underline: not by sight and not by WCAG 1.4.1 (a link is told from text by a line or by 3:1). The line was only in `.tao-prose`. Now the link has the class `tao-link` and the line by default (the same one as `.tao-prose`: 1px, offset 0.18em); `hover` shows it only under the pointer and the focus (a menu entry, a card title, anything clear from its place), `none` never. The rule weighs one class, so a class of your own, written later, wins. `TaoStretchedLink` is `none` by default (the card is the sign of a link), a crumb of `TaoBreadcrumb` is `hover`. The «Contrast & keyboard» bench of the showcase rates the new pair «link on the page» (4.5:1) too. Found by an agent that made the cheat sheet ai-gen: it had added the line with its own CSS.
8
8
  - **`TaoTable` is generic: a row can be an interface.** The rows were `Record<string, unknown>[]`, and an interface has no index signature, so `TaoTable :rows="flags"` with `interface Flag { … }` did not compile: the type had to be written as `type Flag = { … }`. Now `TaoTable<T>`: `T` comes from `rows` (an interface, a class, a plain object), `rows` and `columns` may be `readonly` (`as const` data, props), and the row is a `T` in the cell slots (`#cell-flag="{ row }"` knows `row.flag`), in `@row-click`, in `rowKey` and in `TaoTableColumn<T>.value(row)`. `columns` do not take part in the inference (`NoInfer`, TypeScript 5.4+), so the rows decide, and a list typed `TaoTableColumn[]` (the row type `any` by default) fits a table of any rows. `value` of a column is a method: a column of `Record` rows goes to a table of `Flag` rows too. New: the type `TaoTableRowKey`, the pure `tableCellValue` and `tableRowId` in `table.ts` (tested). Found by the cheat sheet ai-gen, where the agent had to give the flag its type with `type`.
9
9
  - **`TaoTable` in a narrow place: `stack` and `minWidth`.** A table kept its columns as wide as the words allowed, so on a phone prose was squeezed into stacks of 100px (4 columns, a row 177px high), and the sideways scroll of its wrap began only after that. `stack`: under 600px of the table's own width (a container query on the wrap, so it follows the room it is given inside a shell, not the window; no JavaScript) every row is a card, each cell under its column label (`data-label`, with an empty alternative so a screen reader does not say it twice); the header stays in the DOM, hidden by sight, and the cells carry the table roles, so the table is still a table for a screen reader after it turned into blocks. The wrap needs a width of its own to be a container (it has `width: 100%`); in a shrink-to-fit parent give it one. `minWidth` (a number is px): the table is never narrower, and a narrower place scrolls it sideways; `stack` cards ignore it. A column takes `nowrap` (a code, a date, a flag) and its own `minWidth`. The alignment of a column is now the private variable `--_tao-align` read by `text-align` (it was the inline `text-align`), so the cards put everything at the start; nothing changes by sight. Found by the cheat sheet ai-gen, where a wrapper with `min-width` and `overflow-x` had to do it.
10
+ - **`TaoTextarea` follows its width, not only its text.** The autosized height was measured on mount and when the value changed, so after the field changed its width (a window resize, a drawer opening beside it) the height was stale: a scrollbar instead of wrapping, or a height measured once at a tiny width that stayed huge. A `ResizeObserver` on the field now measures again when its width changes (height-only changes, such as our own write, are ignored, so there is no loop); nothing is attached where `ResizeObserver` does not exist.
10
11
  - **The rows of a `clickable` `TaoTable` work from the keyboard.** A row was a `<tr>` with only `@click`: no `tabindex`, no key, so with the keyboard a list of records could not be opened at all. Now the table is one Tab stop (a roving `tabindex`: the first row, then the row that had the focus last), the arrows and Home / End walk the rows (no wrap at the ends, as in `TaoList roving`), Enter and Space emit `row-click` as a click does (Space does not scroll the page), and the focused row has a tint and a bar of 2px in the accent at its start (on every cell of a `stack` card). Not a ring: a ring is a rectangle, and the rounded frame of the table cut its corners on the first and the last row, while a fill is clipped by the frame cleanly; the bar is on the logical edge, so in RTL it is at the right. A key that comes from a control inside the row (a button, a field, a menu) stays with that control and is not a row click. A click with the mouse is as before: a click on a button in a row still reaches `row-click` (stop it with `@click.stop` on the button). The pure step is `tableRowTarget` in `table.ts`. For a screen reader a row stays a row: when the action matters, also put a real link or button in the row. Found while reading `TaoTable` for the cheat sheet ai-gen.
11
12
 
12
13
  ## 5.51.0
package/dist/index.js CHANGED
@@ -5743,11 +5743,32 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
5743
5743
  nextTick(autoResize);
5744
5744
  }
5745
5745
  );
5746
+ let resizeObserver;
5747
+ let lastWidth = -1;
5748
+ let frame = 0;
5746
5749
  onMounted(() => {
5747
5750
  if (props.autofocus) {
5748
5751
  textareaRef.value?.focus();
5749
5752
  }
5750
5753
  nextTick(autoResize);
5754
+ const textarea = textareaRef.value;
5755
+ if (textarea && typeof ResizeObserver !== "undefined") {
5756
+ resizeObserver = new ResizeObserver((entries) => {
5757
+ const width = entries[entries.length - 1]?.contentRect.width ?? textarea.offsetWidth;
5758
+ if (width === lastWidth) {
5759
+ return;
5760
+ }
5761
+ lastWidth = width;
5762
+ cancelAnimationFrame(frame);
5763
+ frame = requestAnimationFrame(autoResize);
5764
+ });
5765
+ resizeObserver.observe(textarea);
5766
+ }
5767
+ });
5768
+ onBeforeUnmount(() => {
5769
+ cancelAnimationFrame(frame);
5770
+ resizeObserver?.disconnect();
5771
+ resizeObserver = void 0;
5751
5772
  });
5752
5773
  return (_ctx, _cache) => {
5753
5774
  return openBlock(), createElementBlock("div", mergeProps(unref(rootAttrs)(), {
@@ -5793,7 +5814,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
5793
5814
  };
5794
5815
  }
5795
5816
  });
5796
- const TaoTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-9aaf7131"]]);
5817
+ const TaoTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-7fac72d5"]]);
5797
5818
  const _hoisted_1$N = ["aria-label"];
5798
5819
  const _hoisted_2$I = { class: "tao-scroll-top__content" };
5799
5820
  const _hoisted_3$B = {