@1337exp/taoui 5.16.1 → 5.19.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
@@ -1,5 +1,60 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.19.1
4
+
5
+ A fix; nothing to migrate.
6
+
7
+ - **`toast()` has no accent bar on the left.** The 5.17.2 bar kept away from the rounded corners, and that left a gap between it and the progress line in the lower left corner. The bar told nothing the icon, the tinted background and the progress line do not: it is gone, and `.tao-toast__accent` with it. The progress line keeps its distance from the corners (`--tao-toast-edge`).
8
+ - Showcase: the buttons in the header of the comments sheet use `icon` (a square of the control height), not an icon in the slot, so the icons sit in the middle.
9
+
10
+ ## 5.19.0
11
+
12
+ Nothing to migrate.
13
+
14
+ - **`TaoDrawer` as a bottom sheet of your own.** A sheet (`side="bottom"`) is pulled down by its grip and header now (`swipeToClose`, on by default): it closes when pulled a third of its height or flung, comes back otherwise, and the backdrop lets go as it goes. The pull starts only from the grip and the header, never from a button or a field in it, so the content still scrolls. It needs `closable`, and if the parent keeps `v-model` open the sheet returns.
15
+ - **`show-close="false"` hides only the cross.** `closable="false"` still means that only the parent closes it (no cross, no backdrop, no Escape, no pull); `showClose` is just the cross, the rest keeps working: a sheet with no cross that is pulled down.
16
+ - **`#header="{ close }"` replaces the whole header** (a title with a counter, a filter, a cross of your own). Name the panel for a screen reader with `aria-label`. The showcase has the comments of a video built from this, with `#footer` as the line to type in.
17
+ - The pull-down is plain pointer events, no dependency on TaoUX; the maths is `src/sheetDrag.ts`.
18
+
19
+ ## 5.18.0
20
+
21
+ One visible change on a phone: a tap no longer flashes.
22
+
23
+ - **No system flash on a tap.** Phone browsers paint a blue (or grey) square over a tapped link or button, and it differs by the shell and fights the theme. `styles.css` sets `-webkit-tap-highlight-color` from the new token `--tao-tap-highlight` (`transparent`) on `<html>`; the property is inherited, so every element gets it. A colour in the token brings a flash of your own back, anywhere in the tree. The kit gives a tap its own feedback instead of leaving it to the system; a row of `TaoList` has none yet, it is next.
24
+
25
+ ## 5.17.2
26
+
27
+ A fix; nothing to migrate.
28
+
29
+ - **`toast()`: a loading toast turns into its result smoothly.** The tone changed at once when the work finished: the bar, the icon and the tinted background jumped from the accent to green or red. Now the colours follow in 0.3 s, the ring gives way to the result icon that comes in, and with `prefers-reduced-motion` nothing is animated.
30
+ - **`toast()`: the accent bar and the progress line are not cut by a large radius.** With `--tao-radius-panel` of 20px and more the curve of the corners cut both marks down to a hair. They keep away from the corners now by 60% of the radius (up to 24px) and have rounded ends, so they lie on the straight part with any radius. `--tao-toast-edge` sets the distance (`0` brings the flush look back). `TaoCard` `stripe` stays clipped by the corners: it is a decoration, the toast marks tell the tone and the time.
31
+
32
+ ## 5.17.1
33
+
34
+ A fix; nothing to migrate.
35
+
36
+ - **`TaoTree` does not loop on a repeated id.** An id is unique in the whole tree. When `load(node)` answered with the same ids at every level (the showcase did: opening `vue` under `node_modules` handed back a `vue`), the node inside its own ancestor sent the walk round in a circle: `RangeError: Maximum call stack size exceeded`. A node whose id is already one of its ancestors is a leaf now. The showcase `load` gives path ids.
37
+ - Inside the repository: `docs/v5-plan.md` (the ideas journal of the 5.0 design) is removed; MIGRATION-5.md no longer points to it.
38
+
39
+ ## 5.17.0
40
+
41
+ Nothing to migrate.
42
+
43
+ - **`TaoFileDrop` `reject` event.** A file that did not pass `accept` was dropped without a word: no `change`, no sign, and the user saw nothing happen. Now `reject` brings the refused files (`File[]`); they are still not in `v-model`, and in a mixed batch the good files go to `change` as before. Say why in your own words (the zone does not guess a message). The `accept` matching moved to `src/fileAccept.ts` with tests. Found by Next Up.
44
+
45
+ ## 5.16.3
46
+
47
+ A fix; nothing to migrate.
48
+
49
+ - **`TaoDivider` follows the theme.** The solid and dashed line read the primitive `--tao-gray-300`, the one thing a component must not read, so a theme or a palette could not recolour it. It reads `--tao-color-text-muted` now (the same grey in the dark theme, a little darker in the light one), at the same 20% opacity.
50
+ - Inside the repository: `tests/component-styles.test.ts` holds that a component reads roles and not primitives, writes no colour of its own, and adds no spacing pixels beyond the recorded ones; the rules in `CONTRIBUTING.md` are regrouped (colour, then component rules).
51
+
52
+ ## 5.16.2
53
+
54
+ A fix; nothing to migrate.
55
+
56
+ - **A light-theme field is the same surface as its neighbours.** `--tao-color-input-bg` is the sunken surface (`--tao-color-surface-sunken`) in the light theme now, as it already was in the dark one, so a field and the segmented track next to it, a switch or a tab bar come out of one role and not of two close greys. It was white in 5.16.0 and translucent white in 5.16.1, and it still stood off its neighbours. The disabled field takes a translucent grey tone, as in the dark theme, because `gray-50` is the field itself now. The text stays at 18:1. The framed fields keep their border.
57
+
3
58
  ## 5.16.1
4
59
 
5
60
  A fix; nothing to migrate.
@@ -224,7 +279,7 @@ Two small additions, nothing to migrate.
224
279
 
225
280
  ## 5.0.0
226
281
 
227
- A foundation release: shared mechanisms instead of per-component copies, and a clean API. Everything deprecated since 2.0 is removed, so read [MIGRATION-5.md](MIGRATION-5.md) first. Why and how: `docs/v5-plan.md`.
282
+ A foundation release: shared mechanisms instead of per-component copies, and a clean API. Everything deprecated since 2.0 is removed, so read [MIGRATION-5.md](MIGRATION-5.md) first.
228
283
 
229
284
  In numbers: the tarball is 329 KB (560 KB before the ESM-only build), 451 tests (183 before), one floating-panel engine instead of eight copies, 27 built-in icons instead of three icon mechanisms, one tone mechanism instead of six. TaoUX 0.2.0 and taofx follow it.
230
285
 
package/MIGRATION-5.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  5.0 is a deliberate breaking release: shared mechanisms instead of per-component copies (one tone, one floating-panel
4
4
  engine, one icon set), and everything that 2.0 deprecated is deleted. Nothing is hidden behind a warning any more, so
5
- go through this page once. The reasons are in `docs/v5-plan.md`; the short list is in [CHANGELOG.md](CHANGELOG.md).
5
+ go through this page once. The short list is in [CHANGELOG.md](CHANGELOG.md).
6
6
 
7
7
  ## The quick pass
8
8
 
package/README.md CHANGED
@@ -59,7 +59,7 @@
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
62
- - **TaoDrawer** — side panel (filters, settings), or a bottom sheet with `side="bottom"`. Esc, backdrop click, focus trap — same as the modal; `surface`, class and attributes on the panel
62
+ - **TaoDrawer** — side panel (filters, settings), or a bottom sheet with `side="bottom"`. Esc, backdrop click, focus trap — same as the modal; `surface`, class and attributes on the panel. The sheet is pulled down by its grip and header (`swipeToClose`); `show-close="false"` hides only the cross, `#header` is a header of your own
63
63
  - **TaoSpoiler** — disclosure. `v-model` and `aria-expanded`. Neighbours do not close each other
64
64
  - **TaoSpoilerGroup** — accordion: `v-model` is the open panel key (`null` = all closed); spoilers take `name`. Without `v-model` the group keeps that key itself
65
65
  - **TaoTabs** — tabbed sections
@@ -98,7 +98,7 @@
98
98
  - **TaoSlider** / **TaoRangeSlider** — one thumb (`v-model` is a number) or two (`[from, to]`, `minGap`). Mouse, touch, arrows. `marks` (ticks, numbers, `{ value, label }`), `discrete` for stepped scales, `vertical`, `flat`, `format`; `variant="thin"` is a thin track for seek / volume
99
99
  - **TaoColorPicker** — saturation / brightness square, hue and opacity strips, swatches, eyedropper (where the browser has `EyeDropper`), HEX / RGB / HSL input modes. `v-model` is a hex string; `colorModel()` adapts your own colour storage
100
100
  - **TaoColorInput** — a field with a swatch and the hex text; the picker opens in a popover
101
- - **TaoFileDrop** — drop zone (drag & drop + click). File names listed under the zone, `v-model` is `File[]`. Clearing the whole batch is the parent’s job (`clear-request`)
101
+ - **TaoFileDrop** — drop zone (drag & drop + click). File names listed under the zone, `v-model` is `File[]`. Clearing the whole batch is the parent’s job (`clear-request`); a file that does not fit `accept` comes back in `reject`
102
102
 
103
103
  ### Data display
104
104
 
@@ -637,11 +637,12 @@ tokens/primitives.css → tokens/semantic.css → themes/*.css → contexts/*.cs
637
637
  | `tokens/primitives.css` | Raw palette, space / radius / shadow scales (`--tao-orange-400`, `--tao-space-3`…) | Usually no |
638
638
  | `tokens/semantic.css` | Theme-independent roles: radii, shadows, type, motion | Rarely |
639
639
  | `themes/dark.css` | The colour roles of the default (dark) theme: `--tao-color-accent`, `--tao-color-surface`, … | **Yes — this is the theming API** |
640
- | `themes/light.css` | The same roles under `[data-tao-theme="light"]` | Yes, as a sample |
640
+ | `themes/light.css` | The same roles under `[data-tao-mode="light"]` (or the old `[data-tao-theme="light"]`) | Yes, as a sample |
641
641
  | `contexts/size.css`, `tone.css`, `surface.css` | `.tao-size-*` and `.tao-density-*`, `.tao-tone-*`, `.tao-surface-*`: what a control reads to know its size, colour and material | Rarely |
642
642
  | `base.css` | Global reset (scrollbar, links, box-sizing) | Rarely |
643
643
 
644
- Everything comes in through `@1337exp/taoui/styles.css` (dark and light both: light turns on with `data-tao-theme="light"`).
644
+ Everything comes in through `@1337exp/taoui/styles.css` (dark and light both: light turns on with `data-tao-mode="light"`).
645
+ A tap on a phone paints no system flash over a link or a button: `--tao-tap-highlight` is `transparent` on `<html>`; a colour there brings a flash of your own back.
645
646
  The raw files are importable as `@1337exp/taoui/styles/tokens/primitives.css` and so on.
646
647
 
647
648
  ### Your own theme
package/README.ru.md CHANGED
@@ -59,7 +59,7 @@
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"`, класс и атрибуты — на панели окна; прокручивается содержимое под шапкой и подвалом, которые на месте
62
- - **TaoDrawer** — боковая панель (фильтры, настройки) или нижний лист с `side="bottom"`. Esc, клик по фону, ловушка фокуса — как у модалки; `surface`, класс и атрибуты — на панели
62
+ - **TaoDrawer** — боковая панель (фильтры, настройки) или нижний лист с `side="bottom"`. Esc, клик по фону, ловушка фокуса — как у модалки; `surface`, класс и атрибуты — на панели. Лист тянут вниз за ручку и шапку (`swipeToClose`); `show-close="false"` прячет только крестик, `#header` — своя шапка
63
63
  - **TaoSpoiler** — раскрывающийся блок. `v-model` и `aria-expanded`. Несколько подряд сами друг друга не закрывают
64
64
  - **TaoSpoilerGroup** — аккордеон: `v-model` — ключ открытой панели (`null` — все закрыты), у спойлера `name`. Без `v-model` группа помнит ключ сама
65
65
  - **TaoTabs** — вкладки для переключения между секциями контента
@@ -98,7 +98,7 @@
98
98
  - **TaoSlider** / **TaoRangeSlider** — один бегунок (`v-model` — число) или два (`[от, до]`, `minGap`). Мышь, тач, стрелки. `marks` (деления, числа, `{ value, label }`), `discrete` для ступенчатых шкал, `vertical`, `flat`, `format`; `variant="thin"` — тонкий трек для seek / громкости
99
99
  - **TaoColorPicker** — квадрат насыщенности и яркости, полосы тона и прозрачности, образцы, пипетка (где есть `EyeDropper`), режимы ввода HEX / RGB / HSL. `v-model` — строка hex; `colorModel()` подключает ваше собственное хранилище цвета
100
100
  - **TaoColorInput** — поле с образцом и hex-текстом; палитра открывается в поповере
101
- - **TaoFileDrop** — зона загрузки (drag & drop + клик). Список имён под зоной, `v-model` — `File[]`. Очистку всей пачки решает родитель (`clear-request`)
101
+ - **TaoFileDrop** — зона загрузки (drag & drop + клик). Список имён под зоной, `v-model` — `File[]`. Очистку всей пачки решает родитель (`clear-request`); файл, не подошедший под `accept`, приходит в `reject`
102
102
 
103
103
  ### Отображение данных
104
104
 
@@ -638,11 +638,12 @@ tokens/primitives.css → tokens/semantic.css → themes/*.css → contexts/*.cs
638
638
  | `tokens/primitives.css` | Сырая палитра, шкалы отступов/радиусов/теней (`--tao-orange-400`, `--tao-space-3`...) | Обычно нет |
639
639
  | `tokens/semantic.css` | Роли, не зависящие от темы: скругления, тени, шрифт, движение | Редко |
640
640
  | `themes/dark.css` | Цветовые роли темы по умолчанию (dark): `--tao-color-accent`, `--tao-color-surface`, ... | **Да — это и есть API темизации** |
641
- | `themes/light.css` | Те же роли под `[data-tao-theme="light"]` | Да, как образец |
641
+ | `themes/light.css` | Те же роли под `[data-tao-mode="light"]` (или старым `[data-tao-theme="light"]`) | Да, как образец |
642
642
  | `contexts/size.css`, `tone.css`, `surface.css` | `.tao-size-*` и `.tao-density-*`, `.tao-tone-*`, `.tao-surface-*`: что контрол читает, чтобы знать размер, цвет и материал | Редко |
643
643
  | `base.css` | Глобальный reset (скроллбар, ссылки, box-sizing) | Редко |
644
644
 
645
- Всё подключается одним файлом `@1337exp/taoui/styles.css` (и dark, и light: light включается атрибутом `data-tao-theme="light"`).
645
+ Всё подключается одним файлом `@1337exp/taoui/styles.css` (и dark, и light: light включается атрибутом `data-tao-mode="light"`).
646
+ Нажатие на телефоне не даёт системной вспышки поверх ссылки или кнопки: `--tao-tap-highlight` на `<html>` равен `transparent`; свой цвет возвращает вспышку.
646
647
  Сырые файлы доступны как `@1337exp/taoui/styles/tokens/primitives.css` и так далее.
647
648
 
648
649
  ### Как сделать свою тему
package/dist/index.d.ts CHANGED
@@ -815,6 +815,7 @@ list: boolean;
815
815
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
816
816
  change: (files: File[]) => void;
817
817
  "update:modelValue": (files: File[]) => void;
818
+ reject: (files: File[]) => void;
818
819
  "clear-request": () => void;
819
820
  }, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_31<__VLS_TypePropsToRuntimeProps_35<Props_15>, {
820
821
  modelValue: () => never[];
@@ -825,6 +826,7 @@ list: boolean;
825
826
  }>>> & Readonly<{
826
827
  onChange?: ((files: File[]) => any) | undefined;
827
828
  "onUpdate:modelValue"?: ((files: File[]) => any) | undefined;
829
+ onReject?: ((files: File[]) => any) | undefined;
828
830
  "onClear-request"?: (() => any) | undefined;
829
831
  }>, {
830
832
  list: boolean;
@@ -2756,13 +2758,31 @@ side?: "left" | "right" | "bottom";
2756
2758
  * стекло (сплошное, где размытия нет).
2757
2759
  */
2758
2760
  surface?: TaoSurface;
2761
+ /**
2762
+ * The user can close it: the cross, a click on the backdrop, Escape and the pull-down of a sheet. `false`: only the
2763
+ * parent closes it.
2764
+ * Пользователь может его закрыть: крестик, клик по подложке, Escape и жест «потянуть вниз» у листа. `false`: закрывает только родитель.
2765
+ */
2759
2766
  closable?: boolean;
2767
+ /**
2768
+ * The cross in the header. `false` hides only the cross: the backdrop, Escape and the pull-down still close it.
2769
+ * Крестик в шапке. `false` прячет только крестик: подложка, Escape и жест «вниз» по-прежнему закрывают.
2770
+ */
2771
+ showClose?: boolean;
2772
+ /**
2773
+ * `side="bottom"`: the sheet is pulled down by its grip and header, and closes when pulled far enough or flung; it
2774
+ * comes back otherwise. Needs `closable`.
2775
+ * `side="bottom"`: лист тянут вниз за ручку и шапку; он закрывается, если утянут далеко или брошен, иначе возвращается. Нужен `closable`.
2776
+ */
2777
+ swipeToClose?: boolean;
2760
2778
  closeLabel?: string;
2761
2779
  }>, {
2762
2780
  title: string;
2763
2781
  side: string;
2764
2782
  surface: string;
2765
2783
  closable: boolean;
2784
+ showClose: boolean;
2785
+ swipeToClose: boolean;
2766
2786
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
2767
2787
  close: (...args: any[]) => void;
2768
2788
  "update:modelValue": (...args: any[]) => void;
@@ -2783,13 +2803,31 @@ side?: "left" | "right" | "bottom";
2783
2803
  * стекло (сплошное, где размытия нет).
2784
2804
  */
2785
2805
  surface?: TaoSurface;
2806
+ /**
2807
+ * The user can close it: the cross, a click on the backdrop, Escape and the pull-down of a sheet. `false`: only the
2808
+ * parent closes it.
2809
+ * Пользователь может его закрыть: крестик, клик по подложке, Escape и жест «потянуть вниз» у листа. `false`: закрывает только родитель.
2810
+ */
2786
2811
  closable?: boolean;
2812
+ /**
2813
+ * The cross in the header. `false` hides only the cross: the backdrop, Escape and the pull-down still close it.
2814
+ * Крестик в шапке. `false` прячет только крестик: подложка, Escape и жест «вниз» по-прежнему закрывают.
2815
+ */
2816
+ showClose?: boolean;
2817
+ /**
2818
+ * `side="bottom"`: the sheet is pulled down by its grip and header, and closes when pulled far enough or flung; it
2819
+ * comes back otherwise. Needs `closable`.
2820
+ * `side="bottom"`: лист тянут вниз за ручку и шапку; он закрывается, если утянут далеко или брошен, иначе возвращается. Нужен `closable`.
2821
+ */
2822
+ swipeToClose?: boolean;
2787
2823
  closeLabel?: string;
2788
2824
  }>, {
2789
2825
  title: string;
2790
2826
  side: string;
2791
2827
  surface: string;
2792
2828
  closable: boolean;
2829
+ showClose: boolean;
2830
+ swipeToClose: boolean;
2793
2831
  }>>> & Readonly<{
2794
2832
  onClose?: ((...args: any[]) => any) | undefined;
2795
2833
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -2798,6 +2836,8 @@ title: string;
2798
2836
  surface: TaoSurface;
2799
2837
  closable: boolean;
2800
2838
  side: "left" | "right" | "bottom";
2839
+ showClose: boolean;
2840
+ swipeToClose: boolean;
2801
2841
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
2802
2842
 
2803
2843
  declare const __VLS_component_66: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_72<__VLS_TypePropsToRuntimeProps_77<{
@@ -4007,6 +4047,9 @@ declare function __VLS_template_64(): {
4007
4047
  };
4008
4048
 
4009
4049
  declare function __VLS_template_65(): {
4050
+ header?(_: {
4051
+ close: typeof close_2;
4052
+ }): any;
4010
4053
  "close-icon"?(_: {}): any;
4011
4054
  default?(_: {}): any;
4012
4055
  footer?(_: {}): any;
@@ -5685,6 +5728,8 @@ export declare function apcaContrast(text: string, background: string): number;
5685
5728
  */
5686
5729
  export declare function applyTaoPalette(def: TaoPaletteDef, mode: TaoPaletteMode, el?: HTMLElement): () => void;
5687
5730
 
5731
+ declare function close_2(): void;
5732
+
5688
5733
  /** Способ ввода цвета в палитре: строка hex, числа RGB или числа HSL. */
5689
5734
  export declare type ColorMode = 'hex' | 'rgb' | 'hsl';
5690
5735
 
package/dist/index.js CHANGED
@@ -3652,7 +3652,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
3652
3652
  };
3653
3653
  }
3654
3654
  });
3655
- const TaoDivider = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-662ed0ea"]]);
3655
+ const TaoDivider = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-5899337f"]]);
3656
3656
  const _hoisted_1$N = {
3657
3657
  key: 0,
3658
3658
  class: "tao-fieldset__legend"
@@ -4138,6 +4138,33 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4138
4138
  };
4139
4139
  }
4140
4140
  });
4141
+ function fileMatchesAccept(file, accept) {
4142
+ const tokens = accept.split(",").map((token) => token.trim().toLowerCase()).filter(Boolean);
4143
+ if (!tokens.length || tokens.includes("*") || tokens.includes("*/*")) {
4144
+ return true;
4145
+ }
4146
+ const name = file.name.toLowerCase();
4147
+ const mime = (file.type || "").toLowerCase();
4148
+ const dot2 = name.lastIndexOf(".");
4149
+ const ext = dot2 >= 0 ? name.slice(dot2) : "";
4150
+ return tokens.some((token) => {
4151
+ if (token.startsWith(".")) {
4152
+ return ext === token;
4153
+ }
4154
+ if (token.endsWith("/*")) {
4155
+ return mime.startsWith(token.slice(0, -1));
4156
+ }
4157
+ return mime === token;
4158
+ });
4159
+ }
4160
+ function partitionByAccept(files, accept) {
4161
+ const accepted = [];
4162
+ const rejected = [];
4163
+ for (const file of files) {
4164
+ (fileMatchesAccept(file, accept) ? accepted : rejected).push(file);
4165
+ }
4166
+ return { accepted, rejected };
4167
+ }
4141
4168
  const _hoisted_1$J = { class: "tao-file-drop__row" };
4142
4169
  const _hoisted_2$D = ["aria-label"];
4143
4170
  const _hoisted_3$y = { "aria-hidden": "true" };
@@ -4164,7 +4191,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
4164
4191
  formatSize: {},
4165
4192
  list: { type: Boolean, default: true }
4166
4193
  },
4167
- emits: ["update:modelValue", "change", "clear-request"],
4194
+ emits: ["update:modelValue", "change", "reject", "clear-request"],
4168
4195
  setup(__props, { emit: __emit }) {
4169
4196
  const { rootAttrs, controlAttrs } = useControlAttrs();
4170
4197
  const appLocale = useTaoLocale();
@@ -4176,28 +4203,6 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
4176
4203
  function sameFile(a, b) {
4177
4204
  return a.name === b.name && a.size === b.size && a.lastModified === b.lastModified;
4178
4205
  }
4179
- function acceptTokens(accept) {
4180
- return accept.split(",").map((token) => token.trim().toLowerCase()).filter(Boolean);
4181
- }
4182
- function fileMatchesAccept(file, accept) {
4183
- const tokens = acceptTokens(accept);
4184
- if (!tokens.length || tokens.includes("*") || tokens.includes("*/*")) {
4185
- return true;
4186
- }
4187
- const name = file.name.toLowerCase();
4188
- const mime = (file.type || "").toLowerCase();
4189
- const dot2 = name.lastIndexOf(".");
4190
- const ext = dot2 >= 0 ? name.slice(dot2) : "";
4191
- return tokens.some((token) => {
4192
- if (token.startsWith(".")) {
4193
- return ext === token;
4194
- }
4195
- if (token.endsWith("/*")) {
4196
- return mime.startsWith(token.slice(0, -1));
4197
- }
4198
- return mime === token;
4199
- });
4200
- }
4201
4206
  function commit(files) {
4202
4207
  emit("update:modelValue", files);
4203
4208
  emit("change", files);
@@ -4237,7 +4242,10 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
4237
4242
  }
4238
4243
  }
4239
4244
  function processFiles(fileList) {
4240
- const incoming = Array.from(fileList).filter((file) => fileMatchesAccept(file, props.accept));
4245
+ const { accepted: incoming, rejected } = partitionByAccept(Array.from(fileList), props.accept);
4246
+ if (rejected.length) {
4247
+ emit("reject", rejected);
4248
+ }
4241
4249
  if (!incoming.length) {
4242
4250
  resetInput();
4243
4251
  return;
@@ -4350,7 +4358,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
4350
4358
  };
4351
4359
  }
4352
4360
  });
4353
- const TaoFileDrop = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-230d5ca0"]]);
4361
+ const TaoFileDrop = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-093403e5"]]);
4354
4362
  function isMenuSelectable(item) {
4355
4363
  return item.type !== "separator" && item.type !== "label" && !item.disabled;
4356
4364
  }
@@ -6079,26 +6087,31 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
6079
6087
  const TaoNav = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-31b1af76"]]);
6080
6088
  function visibleRows(nodes, expanded, children) {
6081
6089
  const rows = [];
6090
+ const ancestors = /* @__PURE__ */ new Set();
6082
6091
  const walk = (list, level, parentId) => {
6083
6092
  list.forEach((node, index) => {
6084
- const own = children(node);
6085
- const branch = Boolean(own?.length) || Boolean(node.hasChildren) && own === void 0;
6093
+ const repeated = ancestors.has(node.id);
6094
+ const own = repeated ? void 0 : children(node);
6095
+ const branch = !repeated && (Boolean(own?.length) || Boolean(node.hasChildren) && own === void 0);
6086
6096
  const open = branch && expanded.has(node.id);
6087
6097
  rows.push({ node, level, parentId, posinset: index + 1, setsize: list.length, branch, expanded: open });
6088
6098
  if (open && own) {
6099
+ ancestors.add(node.id);
6089
6100
  walk(own, level + 1, node.id);
6101
+ ancestors.delete(node.id);
6090
6102
  }
6091
6103
  });
6092
6104
  };
6093
6105
  walk(nodes, 1, null);
6094
6106
  return rows;
6095
6107
  }
6096
- function checkUnits(node, children) {
6097
- const own = children(node);
6108
+ function checkUnits(node, children, ancestors = /* @__PURE__ */ new Set()) {
6109
+ const own = ancestors.has(node.id) ? void 0 : children(node);
6098
6110
  if (!own?.length) {
6099
6111
  return node.disabled ? [] : [node.id];
6100
6112
  }
6101
- return own.flatMap((child) => checkUnits(child, children));
6113
+ const path = new Set(ancestors).add(node.id);
6114
+ return own.flatMap((child) => checkUnits(child, children, path));
6102
6115
  }
6103
6116
  function checkState(node, checked2, children) {
6104
6117
  const units = checkUnits(node, children);
@@ -10643,6 +10656,27 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
10643
10656
  }
10644
10657
  });
10645
10658
  const TaoSkeleton = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-bcd8d820"]]);
10659
+ const SHEET_DISMISS_RATIO = 0.3;
10660
+ const SHEET_FLING_SPEED = 0.5;
10661
+ const SHEET_FLING_MIN = 24;
10662
+ function sheetOffset(delta) {
10663
+ return Math.max(0, delta);
10664
+ }
10665
+ function releaseVelocity(samples, windowMs = 100) {
10666
+ const last = samples[samples.length - 1];
10667
+ if (!last) {
10668
+ return 0;
10669
+ }
10670
+ const first = samples.find((sample) => last.t - sample.t <= windowMs) ?? last;
10671
+ const dt = last.t - first.t;
10672
+ return dt > 0 ? (last.y - first.y) / dt : 0;
10673
+ }
10674
+ function shouldDismissSheet(offset, height, velocity) {
10675
+ if (offset <= 0 || height <= 0) {
10676
+ return false;
10677
+ }
10678
+ return offset >= height * SHEET_DISMISS_RATIO || velocity >= SHEET_FLING_SPEED && offset >= SHEET_FLING_MIN;
10679
+ }
10646
10680
  const _hoisted_1$8 = ["aria-labelledby"];
10647
10681
  const _hoisted_2$7 = {
10648
10682
  key: 0,
@@ -10662,6 +10696,8 @@ const _hoisted_9$1 = {
10662
10696
  key: 2,
10663
10697
  class: "tao-drawer__footer"
10664
10698
  };
10699
+ const SWIPE_FROM = ".tao-drawer__grip, .tao-drawer__header";
10700
+ const SWIPE_NOT_FROM = 'button, a, input, select, textarea, label, [role="button"], [contenteditable]';
10665
10701
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10666
10702
  ...{ name: "TaoDrawer", inheritAttrs: false },
10667
10703
  __name: "TaoDrawer",
@@ -10671,6 +10707,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10671
10707
  side: { default: "right" },
10672
10708
  surface: { default: "flat" },
10673
10709
  closable: { type: Boolean, default: true },
10710
+ showClose: { type: Boolean, default: true },
10711
+ swipeToClose: { type: Boolean, default: true },
10674
10712
  closeLabel: {}
10675
10713
  },
10676
10714
  emits: ["update:modelValue", "close"],
@@ -10679,7 +10717,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10679
10717
  const l10n = useLocaleText(props, "drawer");
10680
10718
  const emit = __emit;
10681
10719
  const panelRef = ref(null);
10720
+ const rootRef = ref(null);
10682
10721
  const titleId = useId();
10722
+ const showCloseButton = computed(() => props.closable && props.showClose);
10683
10723
  function close() {
10684
10724
  if (!props.closable) {
10685
10725
  return;
@@ -10687,6 +10727,86 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10687
10727
  emit("update:modelValue", false);
10688
10728
  emit("close");
10689
10729
  }
10730
+ const swipeable = computed(() => props.side === "bottom" && props.swipeToClose && props.closable);
10731
+ let drag = null;
10732
+ const reducedMotion = () => typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
10733
+ function setSheet(offset, animate) {
10734
+ const panel = panelRef.value;
10735
+ if (!panel) {
10736
+ return;
10737
+ }
10738
+ panel.style.transition = animate && !reducedMotion() ? "transform var(--tao-duration-base) var(--tao-ease-base)" : "none";
10739
+ panel.style.transform = offset === null ? "" : `translateY(${offset}px)`;
10740
+ const height = panel.offsetHeight;
10741
+ rootRef.value?.style.setProperty("--_sheet-progress", offset && height ? String(Math.min(1, offset / height)) : "0");
10742
+ }
10743
+ function settleSheet() {
10744
+ setSheet(null, true);
10745
+ window.setTimeout(() => {
10746
+ if (panelRef.value && !drag) {
10747
+ panelRef.value.style.transition = "";
10748
+ }
10749
+ }, 250);
10750
+ }
10751
+ function capture(pointerId, on) {
10752
+ try {
10753
+ if (on) {
10754
+ panelRef.value?.setPointerCapture?.(pointerId);
10755
+ } else {
10756
+ panelRef.value?.releasePointerCapture?.(pointerId);
10757
+ }
10758
+ } catch {
10759
+ }
10760
+ }
10761
+ function onPointerDown(event) {
10762
+ if (!swipeable.value || drag || !event.isPrimary || event.pointerType === "mouse" && event.button !== 0) {
10763
+ return;
10764
+ }
10765
+ const target = event.target;
10766
+ if (!target?.closest(SWIPE_FROM) || target.closest(SWIPE_NOT_FROM)) {
10767
+ return;
10768
+ }
10769
+ drag = { pointerId: event.pointerId, startY: event.clientY, moved: false, offset: 0, samples: [{ t: event.timeStamp, y: event.clientY }] };
10770
+ capture(event.pointerId, true);
10771
+ }
10772
+ function onPointerMove(event) {
10773
+ if (!drag || event.pointerId !== drag.pointerId) {
10774
+ return;
10775
+ }
10776
+ const delta = event.clientY - drag.startY;
10777
+ if (!drag.moved && Math.abs(delta) < 4) {
10778
+ return;
10779
+ }
10780
+ drag.moved = true;
10781
+ drag.offset = sheetOffset(delta);
10782
+ drag.samples.push({ t: event.timeStamp, y: event.clientY });
10783
+ if (drag.samples.length > 8) {
10784
+ drag.samples.shift();
10785
+ }
10786
+ setSheet(drag.offset, false);
10787
+ }
10788
+ async function onPointerEnd(event) {
10789
+ const current2 = drag;
10790
+ if (!current2 || event.pointerId !== current2.pointerId) {
10791
+ return;
10792
+ }
10793
+ drag = null;
10794
+ capture(event.pointerId, false);
10795
+ if (!current2.moved) {
10796
+ return;
10797
+ }
10798
+ const height = panelRef.value?.offsetHeight ?? 0;
10799
+ if (event.type === "pointerup" && shouldDismissSheet(current2.offset, height, releaseVelocity(current2.samples))) {
10800
+ setSheet(height, true);
10801
+ close();
10802
+ await nextTick();
10803
+ if (props.modelValue) {
10804
+ settleSheet();
10805
+ }
10806
+ } else {
10807
+ settleSheet();
10808
+ }
10809
+ }
10690
10810
  async function focusPanel() {
10691
10811
  await nextTick();
10692
10812
  const panel = panelRef.value;
@@ -10719,6 +10839,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10719
10839
  default: withCtx(() => [
10720
10840
  __props.modelValue ? (openBlock(), createElementBlock("div", {
10721
10841
  key: 0,
10842
+ ref_key: "rootRef",
10843
+ ref: rootRef,
10722
10844
  class: normalizeClass(["tao-drawer", `tao-drawer--${__props.side}`]),
10723
10845
  onKeydown: onKeydown2
10724
10846
  }, [
@@ -10733,28 +10855,34 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10733
10855
  role: "dialog",
10734
10856
  "aria-modal": "true",
10735
10857
  "aria-labelledby": __props.title ? unref(titleId) : void 0,
10736
- tabindex: "-1"
10858
+ tabindex: "-1",
10859
+ onPointerdown: onPointerDown,
10860
+ onPointermove: onPointerMove,
10861
+ onPointerup: onPointerEnd,
10862
+ onPointercancel: onPointerEnd
10737
10863
  }), [
10738
10864
  __props.side === "bottom" ? (openBlock(), createElementBlock("span", _hoisted_2$7)) : createCommentVNode("", true),
10739
- __props.title || __props.closable ? (openBlock(), createElementBlock("div", _hoisted_3$6, [
10740
- __props.title ? (openBlock(), createElementBlock("h2", {
10741
- key: 0,
10742
- id: unref(titleId),
10743
- class: "tao-drawer__title"
10744
- }, toDisplayString(__props.title), 9, _hoisted_4$6)) : (openBlock(), createElementBlock("span", _hoisted_5$5)),
10745
- __props.closable ? (openBlock(), createElementBlock("button", {
10746
- key: 2,
10747
- type: "button",
10748
- class: "tao-drawer__close",
10749
- "aria-label": unref(l10n).closeLabel,
10750
- onClick: close
10751
- }, [
10752
- createElementVNode("span", _hoisted_7$2, [
10753
- renderSlot(_ctx.$slots, "close-icon", {}, () => [
10754
- createVNode(TaoIcon, { name: "tao-close" })
10755
- ], true)
10756
- ])
10757
- ], 8, _hoisted_6$3)) : createCommentVNode("", true)
10865
+ _ctx.$slots.header || __props.title || showCloseButton.value ? (openBlock(), createElementBlock("div", _hoisted_3$6, [
10866
+ renderSlot(_ctx.$slots, "header", { close }, () => [
10867
+ __props.title ? (openBlock(), createElementBlock("h2", {
10868
+ key: 0,
10869
+ id: unref(titleId),
10870
+ class: "tao-drawer__title"
10871
+ }, toDisplayString(__props.title), 9, _hoisted_4$6)) : (openBlock(), createElementBlock("span", _hoisted_5$5)),
10872
+ showCloseButton.value ? (openBlock(), createElementBlock("button", {
10873
+ key: 2,
10874
+ type: "button",
10875
+ class: "tao-drawer__close",
10876
+ "aria-label": unref(l10n).closeLabel,
10877
+ onClick: close
10878
+ }, [
10879
+ createElementVNode("span", _hoisted_7$2, [
10880
+ renderSlot(_ctx.$slots, "close-icon", {}, () => [
10881
+ createVNode(TaoIcon, { name: "tao-close" })
10882
+ ], true)
10883
+ ])
10884
+ ], 8, _hoisted_6$3)) : createCommentVNode("", true)
10885
+ ], true)
10758
10886
  ])) : createCommentVNode("", true),
10759
10887
  createElementVNode("div", _hoisted_8$1, [
10760
10888
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
@@ -10771,7 +10899,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10771
10899
  };
10772
10900
  }
10773
10901
  });
10774
- const TaoDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-45f19c52"]]);
10902
+ const TaoDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-11b7fda2"]]);
10775
10903
  const _hoisted_1$7 = ["title"];
10776
10904
  const _hoisted_2$6 = { class: "tao-avatar__face" };
10777
10905
  const _hoisted_3$5 = ["src", "alt"];
@@ -11275,7 +11403,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
11275
11403
  samples.shift();
11276
11404
  }
11277
11405
  }
11278
- function releaseVelocity() {
11406
+ function releaseVelocity2() {
11279
11407
  const first = samples[0];
11280
11408
  const last = samples[samples.length - 1];
11281
11409
  if (!first || !last || last.t === first.t || performance.now() - last.t > 80) {
@@ -11356,7 +11484,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
11356
11484
  dragMoved = 0;
11357
11485
  }
11358
11486
  const el = track.value;
11359
- const velocity = releaseVelocity();
11487
+ const velocity = releaseVelocity2();
11360
11488
  samples = [];
11361
11489
  if (el) {
11362
11490
  glideTo(glideTarget$1(el.scrollLeft, velocity), velocity);
@@ -11808,10 +11936,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11808
11936
  onMouseenter: pause,
11809
11937
  onMouseleave: resume
11810
11938
  }, [
11811
- _cache[0] || (_cache[0] = createElementVNode("span", {
11812
- class: "tao-toast__accent",
11813
- "aria-hidden": "true"
11814
- }, null, -1)),
11815
11939
  hasIcon.value ? (openBlock(), createElementBlock("span", _hoisted_2$1, [
11816
11940
  __props.toast.loading ? (openBlock(), createElementBlock("span", _hoisted_3$1)) : __props.toast.icon ? (openBlock(), createBlock(TaoIcon, {
11817
11941
  key: 1,
@@ -11874,7 +11998,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11874
11998
  };
11875
11999
  }
11876
12000
  });
11877
- const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-eb76e6db"]]);
12001
+ const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-02a16910"]]);
11878
12002
  const _hoisted_1$1 = { class: "tao-toast-slot__inner" };
11879
12003
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11880
12004
  ...{ name: "TaoToastViewport" },