orio-ui 1.27.0 → 1.28.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.
Files changed (64) hide show
  1. package/README.md +76 -1
  2. package/bin/orio-ui.mjs +72 -0
  3. package/dist/agents/ROUTING.md +140 -0
  4. package/dist/agents/component-finder.md +142 -0
  5. package/dist/agents/component-worker.md +152 -0
  6. package/dist/agents/snippet.md +6 -0
  7. package/dist/module.json +1 -1
  8. package/dist/runtime/components/AnimatedContainer.USAGE.md +79 -0
  9. package/dist/runtime/components/Badge.USAGE.md +75 -0
  10. package/dist/runtime/components/Banner.USAGE.md +52 -0
  11. package/dist/runtime/components/Button.USAGE.md +78 -0
  12. package/dist/runtime/components/Calendar.USAGE.md +8 -0
  13. package/dist/runtime/components/Canvas/USAGE.md +8 -0
  14. package/dist/runtime/components/CheckBox.USAGE.md +63 -0
  15. package/dist/runtime/components/CheckboxGroup.USAGE.md +95 -0
  16. package/dist/runtime/components/ControlElement.USAGE.md +8 -0
  17. package/dist/runtime/components/DashedContainer.USAGE.md +65 -0
  18. package/dist/runtime/components/EmptyState.USAGE.md +65 -0
  19. package/dist/runtime/components/Form.USAGE.md +102 -0
  20. package/dist/runtime/components/Icon.USAGE.md +61 -0
  21. package/dist/runtime/components/Input.USAGE.md +8 -0
  22. package/dist/runtime/components/ListItem.USAGE.md +84 -0
  23. package/dist/runtime/components/LoadingSpinner.USAGE.md +50 -0
  24. package/dist/runtime/components/LocaleSwitcher.USAGE.md +73 -0
  25. package/dist/runtime/components/Modal.USAGE.md +8 -0
  26. package/dist/runtime/components/NavButton.USAGE.md +80 -0
  27. package/dist/runtime/components/NumberInput/Horizontal.USAGE.md +61 -0
  28. package/dist/runtime/components/NumberInput/USAGE.md +74 -0
  29. package/dist/runtime/components/NumberInput/Vertical.USAGE.md +55 -0
  30. package/dist/runtime/components/Popover.USAGE.md +103 -0
  31. package/dist/runtime/components/RadioButton.USAGE.md +72 -0
  32. package/dist/runtime/components/Selector.USAGE.md +131 -0
  33. package/dist/runtime/components/SwitchButton.USAGE.md +62 -0
  34. package/dist/runtime/components/Tag.USAGE.md +51 -0
  35. package/dist/runtime/components/TaggableSelector.USAGE.md +73 -0
  36. package/dist/runtime/components/Textarea.USAGE.md +72 -0
  37. package/dist/runtime/components/Tooltip.USAGE.md +84 -0
  38. package/dist/runtime/components/ZoomableContainer.USAGE.md +108 -0
  39. package/dist/runtime/components/date/Picker.USAGE.md +8 -0
  40. package/dist/runtime/components/date/PickerTrigger.USAGE.md +65 -0
  41. package/dist/runtime/components/date/RangePicker.USAGE.md +97 -0
  42. package/dist/runtime/components/gallery/Carousel.USAGE.md +98 -0
  43. package/dist/runtime/components/gallery/CarouselPreview.USAGE.md +51 -0
  44. package/dist/runtime/components/upload/USAGE.md +91 -0
  45. package/dist/runtime/components/view/Dates.USAGE.md +67 -0
  46. package/dist/runtime/components/view/KeyBinds.USAGE.md +58 -0
  47. package/dist/runtime/components/view/Separator.USAGE.md +57 -0
  48. package/dist/runtime/components/view/Text.USAGE.md +68 -0
  49. package/dist/runtime/composables/useApi.USAGE.md +64 -0
  50. package/dist/runtime/composables/useControlSize.USAGE.md +73 -0
  51. package/dist/runtime/composables/useDecimalFormatter.USAGE.md +72 -0
  52. package/dist/runtime/composables/useFilter.USAGE.md +120 -0
  53. package/dist/runtime/composables/useFuzzySearch.USAGE.md +68 -0
  54. package/dist/runtime/composables/useInertia.USAGE.md +80 -0
  55. package/dist/runtime/composables/useListKeyboard.USAGE.md +97 -0
  56. package/dist/runtime/composables/useModal.USAGE.md +82 -0
  57. package/dist/runtime/composables/usePinchZoom.USAGE.md +95 -0
  58. package/dist/runtime/composables/usePressAndHold.USAGE.md +70 -0
  59. package/dist/runtime/composables/useRovingGrid.USAGE.md +106 -0
  60. package/dist/runtime/composables/useSound.USAGE.md +74 -0
  61. package/dist/runtime/composables/useTheme.USAGE.md +76 -0
  62. package/dist/runtime/composables/useUrlSync.USAGE.md +91 -0
  63. package/dist/runtime/composables/useValidation.USAGE.md +100 -0
  64. package/package.json +12 -2
@@ -0,0 +1,57 @@
1
+ ---
2
+ kind: component
3
+ category: Media & misc
4
+ purpose: separator, divider, horizontal rule, divider line
5
+ short: horizontal separator line with configurable border style, size in px, and block margin in rem
6
+ invariants: false
7
+ ---
8
+
9
+ # view/Separator — agent-only invariants
10
+
11
+ `<orio-view-separator>` is a horizontal rule rendered as a `<div>` with a
12
+ `border-block-end`. It is **not** an `<hr>` element.
13
+
14
+ ## Invariants
15
+
16
+ - **`style` prop** is the CSS border style: `"solid"` (default),
17
+ `"dotted"`, `"dashed"`, `"double"`, `"groove"`, `"ridge"`.
18
+ - **`size`** (number, default `1`) is the border width in **pixels**.
19
+ - **`margin`** (number, default `1`) is the **rem** spacing above and
20
+ below via `margin-block`. So `margin: 1` → `1rem` top + `1rem`
21
+ bottom.
22
+ - **Color is `var(--color-border)`** — not themable per-instance. Use
23
+ CSS overrides if you need a different color.
24
+ - **Block-direction aware**: `border-block-end` and `margin-block`
25
+ respect the writing mode. In a horizontal writing mode it's a bottom
26
+ border + vertical margins; in vertical writing modes it flips.
27
+
28
+ ## Gotchas
29
+
30
+ - **Renders a `<div>`, not an `<hr>`.** Screen readers may not announce
31
+ a section break. For semantic separation, add `role="separator"` via
32
+ `$attrs`.
33
+ - **`size` is unitless number → px** by template binding. Strings get
34
+ used verbatim (`"2px"` works, but loses the type signal).
35
+ - **No vertical orientation.** For a vertical divider, write a custom
36
+ `<div>` with `border-inline-start` rather than using this component.
37
+
38
+ ## Quick reference
39
+
40
+ ```vue
41
+ <template>
42
+ <p>First section</p>
43
+
44
+ <orio-view-separator />
45
+
46
+ <p>Second section</p>
47
+
48
+ <orio-view-separator style="dashed" :size="2" :margin="2" />
49
+
50
+ <p>Third section</p>
51
+ </template>
52
+ ```
53
+
54
+ ## Related
55
+
56
+ - Public API reference: `docs/components/view/separator.md` (if
57
+ present).
@@ -0,0 +1,68 @@
1
+ ---
2
+ kind: component
3
+ category: Media & misc
4
+ purpose: read-only text display, formatted view, typography primitive, label
5
+ short: typed text primitive (text/title/subtitle/italics) with size, uppercase, line-clamp, and inline icon
6
+ invariants: true
7
+ ---
8
+
9
+ # view/Text — agent-only invariants
10
+
11
+ `<orio-view-text>` is the typography primitive for read-only labels and
12
+ text blocks. Use it instead of bare `<p>` / `<span>` / `<h*>` for inline
13
+ icons, theming, and line-clamping.
14
+
15
+ ## Invariants
16
+
17
+ - **`type`**: `"text"` (default) / `"title"` (bold) / `"subtitle"`
18
+ (semi-bold, muted) / `"italics"` (italic, muted). Affects font-weight,
19
+ style, and color.
20
+ - **`size`**: `"small"` / `"medium"` (default) / `"large"` /
21
+ `"extra-large"`. Maps to `--font-sm` … `--font-xl` tokens.
22
+ - **`uppercase: true`** applies `text-transform: uppercase`.
23
+ - **`icon` prop** renders `<orio-icon>` inline before the text/slot. The
24
+ wrapper is `display: flex; align-items: center; gap: 0.25rem` so the
25
+ icon sits inline with the text.
26
+ - **`lineClamp` (number or string)** enables `-webkit-line-clamp` line
27
+ truncation with ellipsis. Defaults to 1 line when the prop is present
28
+ but unset.
29
+ - **Content sources**: default slot or `v-model:modelValue` string. Slot
30
+ wins. v-model is bound so the component plays nicely with
31
+ `<orio-form>` auto-bind by `name`.
32
+ - **`--view-text-color` CSS var** overrides the type's default color
33
+ without changing the type prop. Useful for accent/error states from
34
+ the consumer.
35
+ - **No `inheritAttrs: false`** — attrs flow to the wrapper `<div>`.
36
+
37
+ ## Gotchas
38
+
39
+ - **The wrapper is a `<div>`, not a heading element.** Title type does
40
+ not produce an `<h1>` / `<h2>` etc. For semantic headings, write
41
+ `<h2><orio-view-text type="title">...</orio-view-text></h2>` or use a
42
+ plain heading element.
43
+ - **`lineClamp` requires multi-line content** to show the ellipsis. A
44
+ single-line value with `lineClamp: 2` simply renders as one line.
45
+ - **`white-space: pre-wrap`** is set globally on the wrapper —
46
+ whitespace and newlines from the source are preserved.
47
+
48
+ ## Quick reference
49
+
50
+ ```vue
51
+ <template>
52
+ <orio-view-text type="title" size="large">
53
+ {{ $t("article.title") }}
54
+ </orio-view-text>
55
+
56
+ <orio-view-text type="subtitle" :line-clamp="3" icon="info">
57
+ {{ description }}
58
+ </orio-view-text>
59
+
60
+ <orio-view-text type="italics" uppercase v-model="badgeLabel" />
61
+ </template>
62
+ ```
63
+
64
+ ## Related
65
+
66
+ - `<orio-view-dates>` — locale-aware date range display built on top.
67
+ - `<orio-empty-state>` — uses this internally for title and description.
68
+ - Public API reference: `docs/components/view/text.md` (if present).
@@ -0,0 +1,64 @@
1
+ ---
2
+ kind: composable
3
+ category: Composables
4
+ purpose: fetch, API client, HTTP request, JSON fetch
5
+ short: thin typed wrapper around ofetch's `$fetch` for GET/POST/PUT/DELETE/PATCH requests
6
+ invariants: false
7
+ ---
8
+
9
+ # useApi — agent-only invariants
10
+
11
+ `useApi` is a typed async function (not a reactive composable) that
12
+ wraps `ofetch`'s `$fetch`. It returns a `Promise<T>` — no loading/error
13
+ refs, no Vue lifecycle.
14
+
15
+ ## Invariants
16
+
17
+ - **Not a Vue composable.** It is a plain typed async function, safe to
18
+ call anywhere — outside `setup`, inside event handlers, in route
19
+ middleware.
20
+ - **Two overloads**: `useApi<T>(url)` for GET, `useApi<T>(url, options)`
21
+ for everything else.
22
+ - **`ApiOptions`** fields:
23
+ - `method`: `"GET"` (default), `"POST"`, `"PUT"`, `"DELETE"`, `"PATCH"`.
24
+ - `body`: `Record<string, unknown>` — JSON object. Not FormData, not
25
+ a string.
26
+ - `query`: `Record<string, unknown>` — appended as query params.
27
+ - `signal`: `AbortSignal` for cancellation.
28
+ - **Return type is `T`** — pass the generic for type safety. Without
29
+ it, you get `unknown`.
30
+
31
+ ## Gotchas
32
+
33
+ - **No retry, no caching, no de-dupe.** Bring `@tanstack/vue-query` or
34
+ similar if you need those.
35
+ - **`body` does not handle non-JSON payloads.** For file uploads,
36
+ use `fetch` directly or extend the composable.
37
+ - **Errors throw.** Wrap calls in try/catch — `ofetch` throws on non-2xx
38
+ responses.
39
+
40
+ ## Quick reference
41
+
42
+ ```ts
43
+ import { useApi } from "../composables/useApi";
44
+
45
+ interface User { id: string; name: string }
46
+
47
+ const user = await useApi<User>("/api/users/123");
48
+
49
+ const created = await useApi<User>("/api/users", {
50
+ method: "POST",
51
+ body: { name: "Vlad" },
52
+ });
53
+
54
+ const controller = new AbortController();
55
+ const results = await useApi<User[]>("/api/users", {
56
+ query: { search: "vl" },
57
+ signal: controller.signal,
58
+ });
59
+ controller.abort(); // cancels the request
60
+ ```
61
+
62
+ ## Related
63
+
64
+ - Public API reference: `docs/composables/use-api.md` (if present).
@@ -0,0 +1,73 @@
1
+ ---
2
+ kind: composable
3
+ category: Composables
4
+ purpose: control size tokens, sizing tokens for form controls, control variant sizing
5
+ short: provide/inject `ControlSize` (sm/md/lg/xl) and read a CSS-var token bag for the active size
6
+ invariants: true
7
+ ---
8
+
9
+ # useControlSize — agent-only invariants
10
+
11
+ This composable owns the **CSS variable bag** that maps a `ControlSize`
12
+ (`sm` / `md` / `lg` / `xl`) to concrete padding, font, gap, radius, and
13
+ icon-size tokens. Used internally by ControlElement and friends.
14
+
15
+ ## Invariants
16
+
17
+ - **Two exports**: `provideControlSize(size)` and `useControlTokens(explicit?, fallback?)`.
18
+ Most consumers don't need either — ControlElement wires them — but you
19
+ can use them to size custom controls.
20
+ - **Provide key is a module-local `Symbol`** — there is exactly one
21
+ channel per app. `provideControlSize(ref("lg"))` from a parent scopes
22
+ every nested `useControlTokens()` call to that size.
23
+ - **`useControlTokens(explicit, fallback = "md")`** returns:
24
+ - `size: ComputedRef<ControlSize>` — resolved size (explicit ?? injected
25
+ ?? fallback).
26
+ - `tokens: ComputedRef<Record<string, string>>` — the CSS-var bag for
27
+ that size. Spread it onto a `style` binding to apply the sizing.
28
+ - **Token keys** include `--control-font-size`, `--control-label-font-size`,
29
+ `--control-py`, `--control-px`, `--control-gap`, `--control-radius`,
30
+ `--control-icon-size`, `--control-inner-block-start`, `--control-inner-block-end`,
31
+ `--control-label-block-start`. Adding new tokens requires extending
32
+ every size in `sizeTokens`.
33
+ - **`sizeTokens` is exported** as the raw record — useful for previews or
34
+ ad-hoc lookups outside Vue.
35
+
36
+ ## Gotchas
37
+
38
+ - **`useControlTokens` works outside an `<orio-control-element>`** — it
39
+ falls back to `md` (or the provided fallback) when no provider exists.
40
+ No error is thrown.
41
+ - **The `explicit` argument wins over the injection.** Use it when the
42
+ caller takes an own `size` prop and wants it to override an ambient
43
+ one.
44
+ - **Style binding requires the `tokens` value, not the ref.** Spread it
45
+ on `:style`:
46
+ ```vue
47
+ <div :style="tokens">...</div>
48
+ ```
49
+
50
+ ## Quick reference — custom control consuming the tokens
51
+
52
+ ```ts
53
+ import { computed, toRef } from "vue";
54
+ import { useControlTokens } from "../composables/useControlSize";
55
+ import type { ControlSize } from "../components/ControlElement.vue";
56
+
57
+ interface Props { size?: ControlSize }
58
+ const props = defineProps<Props>();
59
+ const { tokens } = useControlTokens(toRef(props, "size"));
60
+ ```
61
+
62
+ ```vue
63
+ <template>
64
+ <div :style="tokens" class="my-control">…</div>
65
+ </template>
66
+ ```
67
+
68
+ ## Related
69
+
70
+ - `<orio-control-element>` — provides and consumes this composable.
71
+ - `<orio-selector>` — uses `useControlTokens(size)` to size the
72
+ dropdown popover content.
73
+ - Public API reference: `docs/composables/use-control-size.md`.
@@ -0,0 +1,72 @@
1
+ ---
2
+ kind: composable
3
+ category: Composables
4
+ purpose: locale-aware number formatting, decimal parser, currency-safe parser
5
+ short: parse numeric strings (US or EU separator) and format via Intl.NumberFormat with locale defaults
6
+ invariants: true
7
+ ---
8
+
9
+ # useDecimalFormatter — agent-only invariants
10
+
11
+ Returns `{ toNumber, formatDecimal }`. Stateless, no Vue reactivity —
12
+ call it once and reuse the two helpers.
13
+
14
+ ## Invariants
15
+
16
+ - **`toNumber(input: string | number)`**:
17
+ - Numbers pass through as-is (non-finite → `null`).
18
+ - Strings are stripped of any character except digits, `,`, `.`, `-`.
19
+ - **Decimal separator auto-detected** by checking the position of the
20
+ last `,` and last `.`:
21
+ - If last `,` is after last `.` → European format. Strip `.` (thousands)
22
+ and convert `,` to `.` (decimal).
23
+ - Otherwise → US format. Strip `,` and keep `.`.
24
+ - Returns `null` for empty / unparseable input.
25
+ - **`formatDecimal(input, options?)`**:
26
+ - `locale`: defaults to `navigator.languages[0] ?? navigator.language`
27
+ on client, `"de-DE"` on server.
28
+ - `decimals`: shortcut that sets both `minimumFractionDigits` and
29
+ `maximumFractionDigits` (default `2`).
30
+ - Explicit `minimumFractionDigits` / `maximumFractionDigits` override
31
+ the `decimals` shortcut.
32
+ - Returns `null` if `toNumber` fails.
33
+ - **Uses `Intl.NumberFormat`** under the hood — output respects the
34
+ locale's group separator and decimal mark.
35
+
36
+ ## Gotchas
37
+
38
+ - **Auto-separator detection is heuristic.** `"1,000"` is ambiguous; the
39
+ parser treats it as US (1000), not EU (1.0). For unambiguous behavior,
40
+ strip separators before passing.
41
+ - **No currency symbol handling.** `"$1,234.56"` is stripped to
42
+ `"1234.56"` and parsed. To format as currency, build your own with
43
+ `Intl.NumberFormat(locale, { style: "currency", currency: "USD" })`.
44
+ - **SSR fallback locale is `"de-DE"`**, not `"en-US"`. EU number
45
+ formatting in SSR pre-hydration may surprise US consumers — pass
46
+ `locale` explicitly to avoid hydration mismatches.
47
+ - **Negative numbers**: `-` is allowed in the cleaning regex anywhere in
48
+ the string. `"100-50"` becomes `"100-50"` then `Number("100-50") = NaN`
49
+ → null. No expression evaluation.
50
+
51
+ ## Quick reference
52
+
53
+ ```ts
54
+ import { useDecimalFormatter } from "../composables/useDecimalFormatter";
55
+
56
+ const { toNumber, formatDecimal } = useDecimalFormatter();
57
+
58
+ toNumber("1.234,56"); // 1234.56 (EU)
59
+ toNumber("1,234.56"); // 1234.56 (US)
60
+ toNumber("abc"); // null
61
+
62
+ formatDecimal(1234.5, { locale: "de-DE" }); // "1.234,50"
63
+ formatDecimal(1234.5, { locale: "en-US" }); // "1,234.50"
64
+ formatDecimal(1234.567, { decimals: 0 }); // "1,235"
65
+ formatDecimal("$1,234.567", { maximumFractionDigits: 1 }); // "1,234.6"
66
+ ```
67
+
68
+ ## Related
69
+
70
+ - `<orio-number-input>` — uses similar fraction-digit semantics via its
71
+ `decimalPlaces` prop.
72
+ - Public API reference: `docs/composables/use-decimal-formatter.md`.
@@ -0,0 +1,120 @@
1
+ ---
2
+ kind: composable
3
+ category: Composables
4
+ purpose: named filter group, v-bind bags for pickers, active chips, URL-synced filters, filter state
5
+ short: named filter group with v-bind bags, $-helpers, $active chips, $clearAll, optional URL sync via lazy import
6
+ invariants: true
7
+ ---
8
+
9
+ # useFilter — agent-only invariants
10
+
11
+ `useFilter` defines or retrieves a **named filter group** stored in a
12
+ module-level registry. Any component that knows the `id` can read and
13
+ mutate the same reactive state — independent of the component tree.
14
+
15
+ There's a dedicated `use-filter-onboarder` subagent that owns the canonical
16
+ integration patterns. Trigger it for non-trivial setups (filter bars,
17
+ chip rows, URL-synced filters).
18
+
19
+ ## Invariants
20
+
21
+ - **Two overloads**:
22
+ - `useFilter(id, config, options?)` — defines a group.
23
+ - `useFilter(id)` — retrieves an existing group. Throws if no group
24
+ by that id has been defined.
25
+ - **Module-level `registry`** — calls with the same `id` return the
26
+ same `FilterGroup` reference. Defining twice warns and returns the
27
+ existing group (the new config is ignored).
28
+ - **`FilterDefinition.value` is both the initial value AND the
29
+ "empty" baseline.** Used to compute `isActive` (deep `!== initial`)
30
+ and to reset via `clear()`.
31
+ - **`structuredClone`** copies the initial values so mutating the
32
+ returned `value` does not mutate the baseline.
33
+ - **`isEqual`** is a hand-rolled deep equality (`===` for primitives,
34
+ recursive for arrays and plain objects). Custom classes / Date /
35
+ Map / Set fall back to `===` → likely a false negative.
36
+ - **Each filter exposes a v-bind bag** via `filters[name]`:
37
+ ```ts
38
+ { modelValue, "onUpdate:modelValue": (v) => state[name] = v }
39
+ ```
40
+ Spread on any `v-model`-compatible component:
41
+ `<orio-selector v-bind="filters.category" />`.
42
+ - **`filters.$.<name>`** has helpers per filter: `value`, `initial`,
43
+ `isActive`, `clear()`.
44
+ - **`filters.$active`** is a `ComputedRef<ActiveFilter[]>` — array of
45
+ `{ name, value, clear }` for filters whose value differs from the
46
+ initial. Use for chip rows.
47
+ - **`filters.$clearAll()`** resets every filter to its initial value.
48
+ - **`filters.$state`** is the raw `Ref<Record<string, unknown>>` —
49
+ serialize for API calls or persist externally.
50
+ - **URL sync (`options.url: true`)** lazy-imports `./useUrlSync`. The
51
+ Nuxt `#imports` dep is **not** loaded unless this flag is set,
52
+ keeping `useFilter` runnable in non-Nuxt contexts.
53
+ - **URL-synced watcher lives in a detached `effectScope`** owned by
54
+ the registry, not by the component that defined the group — the
55
+ watcher outlives the defining component.
56
+ - **`disposeFilter(id)`** removes the group and stops its URL-sync
57
+ effect scope. Use in SPAs to clear page-scoped filter groups on
58
+ route change.
59
+
60
+ ## Gotchas
61
+
62
+ - **Filter names become top-level URL keys** when `url: true`.
63
+ Collisions across multiple URL-synced groups on the same page
64
+ silently overwrite each other.
65
+ - **`structuredClone` doesn't handle Functions, DOM nodes, or class
66
+ instances** — passing them in `value` will throw at define time.
67
+ - **`$active` recomputes on every state change**, doing a deep
68
+ comparison per filter. For large filter groups with deep objects,
69
+ consider shallow representations.
70
+ - **Lazy URL sync arrives one microtask late** — the initial render
71
+ may flash the default values before the URL values land. Acceptable
72
+ for chips/dropdowns; not for visibly-important first paint.
73
+ - **Retrieving an undefined group throws** — always define first
74
+ somewhere in the tree (layout / page setup) before retrieving in
75
+ children.
76
+
77
+ ## Quick reference — define + bind + chips
78
+
79
+ ```ts
80
+ const filters = useFilter(
81
+ "appointments",
82
+ {
83
+ category: { value: null as string | null },
84
+ status: { value: [] as string[] },
85
+ dateRange:{ value: { from: null, to: null } as { from: string | null; to: string | null } },
86
+ },
87
+ { url: true },
88
+ );
89
+ ```
90
+
91
+ ```vue
92
+ <template>
93
+ <orio-selector v-bind="filters.category" :options="categories" />
94
+ <orio-taggable-selector v-bind="filters.status" :options="statuses" />
95
+
96
+ <orio-tag
97
+ v-for="active in filters.$active"
98
+ :key="active.name"
99
+ :text="active.name"
100
+ variant="accent"
101
+ />
102
+ <orio-button v-if="filters.$active.length" @click="filters.$clearAll">
103
+ Clear all
104
+ </orio-button>
105
+ </template>
106
+ ```
107
+
108
+ ## Quick reference — retrieve elsewhere
109
+
110
+ ```ts
111
+ const filters = useFilter("appointments"); // same instance
112
+ ```
113
+
114
+ ## Related
115
+
116
+ - `useUrlSync` — lazy-loaded when `url: true`.
117
+ - `use-filter-onboarder` subagent — canonical patterns for filter
118
+ bars, chip rows, URL sync, and splitting filter UI across the page
119
+ tree.
120
+ - Public API reference: `docs/composables/use-filter.md`.
@@ -0,0 +1,68 @@
1
+ ---
2
+ kind: composable
3
+ category: Composables
4
+ purpose: fuzzy search, client-side filter, in-memory search, search-as-you-type
5
+ short: typed Fuse.js wrapper that returns a computed list of matched items (strings or objects)
6
+ invariants: false
7
+ ---
8
+
9
+ # useFuzzySearch — agent-only invariants
10
+
11
+ `useFuzzySearch(dataSource, search, options?)` is a thin wrapper around
12
+ `@vueuse/integrations/useFuse`. It accepts either a `string[]` (no options)
13
+ or a `T[]` of objects (with `FuseOptions<T>`) and returns a `ComputedRef`
14
+ of matches — items only, no scores.
15
+
16
+ ## Invariants
17
+
18
+ - **Two overloads**:
19
+ - `useFuzzySearch(dataSource: MaybeRef<string[]>, search: MaybeRef<string>)`
20
+ → matches against the strings directly.
21
+ - `useFuzzySearch<T>(dataSource: MaybeRef<T[]>, search: MaybeRef<string>, options: FuseOptions<T>)`
22
+ → matches against keys you specify in `options.keys`.
23
+ - **`matchAllWhenSearchEmpty: true`** is forced — when `search` is `""`,
24
+ the returned list equals the full dataSource. No empty results on
25
+ empty query.
26
+ - **Returns a `ComputedRef`**, so it updates as `search` or `dataSource`
27
+ changes (when passed as refs).
28
+ - **The result is item-only**, not Fuse's `{ item, score }` records.
29
+ Score data is not exposed — if you need it, use `useFuse` directly.
30
+
31
+ ## Gotchas
32
+
33
+ - **No debouncing.** Every keystroke runs the match against the full
34
+ dataset. For very large lists (10k+ items) or expensive options,
35
+ debounce `search` upstream.
36
+ - **No highlighting of matched substrings.** Use `useFuse` directly if
37
+ you need the match indices for highlighting.
38
+ - **`MaybeRef` means raw arrays work too** — but they won't be
39
+ reactive. Wrap in `ref` / `computed` if the underlying data changes.
40
+
41
+ ## Quick reference — string list
42
+
43
+ ```ts
44
+ import { ref } from "vue";
45
+ import { useFuzzySearch } from "../composables/useFuzzySearch";
46
+
47
+ const query = ref("");
48
+ const colors = ["red", "green", "blue", "yellow"];
49
+ const matches = useFuzzySearch(colors, query);
50
+ ```
51
+
52
+ ## Quick reference — object list
53
+
54
+ ```ts
55
+ interface User { id: string; name: string; email: string }
56
+ const users = ref<User[]>([...]);
57
+ const query = ref("");
58
+ const matches = useFuzzySearch(users, query, {
59
+ keys: ["name", "email"],
60
+ threshold: 0.3,
61
+ });
62
+ ```
63
+
64
+ ## Related
65
+
66
+ - `<orio-selector>` — pair with this composable + the `#options-addon`
67
+ slot to build a filterable dropdown.
68
+ - Public API reference: `docs/composables/use-fuzzy-search.md`.
@@ -0,0 +1,80 @@
1
+ ---
2
+ kind: composable
3
+ category: Composables
4
+ purpose: inertia, momentum decay for gestures, fling-and-decelerate, momentum scroll
5
+ short: post-drag momentum loop that calls a tick callback with decaying velocity each frame
6
+ invariants: true
7
+ ---
8
+
9
+ # useInertia — agent-only invariants
10
+
11
+ `useInertia(onTick, options?)` runs a `requestAnimationFrame` loop that
12
+ decays velocity by `friction` each frame and calls `onTick(vx, vy)`. The
13
+ consumer applies the delta to its own state (pan offset, scroll, etc.).
14
+
15
+ ## Invariants
16
+
17
+ - **`onTick(dx, dy)`** is called every frame while velocity exceeds
18
+ `minVelocity` (default `0.5`). The consumer is responsible for
19
+ applying the delta to its state.
20
+ - **`friction` defaults to `0.92`** — velocity multiplier per frame.
21
+ Lower = quicker decay.
22
+ - **`trackMove(dx, dy)`** must be called on every pointermove during
23
+ the drag — it captures the velocity from the delta and time since
24
+ the last call (`16 / dt` factor to normalize to ~60fps).
25
+ - **`resetTime()`** must be called at drag start (and on
26
+ resume-after-release) so the first `trackMove` doesn't compute a
27
+ velocity from a stale timestamp.
28
+ - **`release()`** must be called on drag end. It starts the inertia
29
+ loop only if:
30
+ - The last `trackMove` was less than 50ms ago, AND
31
+ - The captured velocity exceeds `minVelocity`.
32
+ Otherwise it does nothing — slow / paused releases don't fling.
33
+ - **`stop()`** cancels any in-flight inertia and zeroes velocity. Call
34
+ it on a new pointer-down to interrupt momentum.
35
+ - **Time-gap larger than 100ms in `trackMove` resets velocity to 0** —
36
+ catching a pause mid-drag prevents a stale fling on release.
37
+
38
+ ## Gotchas
39
+
40
+ - **The composable owns no DOM**. It's just math + RAF. The consumer
41
+ must wire `trackMove` to `pointermove`, `release` to `pointerup`,
42
+ `stop` to new `pointerdown`, `resetTime` to drag-start.
43
+ - **Velocity units are "pixels per ~16ms frame"** because of the
44
+ `16 / dt` normalization. The `onTick` deltas can be directly applied
45
+ to translate values without further scaling.
46
+ - **No max-velocity clamp.** Very fast flings produce very fast inertia
47
+ — clamp upstream if needed.
48
+ - **No multi-axis independence**: friction is symmetric. To decay axes
49
+ at different rates, scale `dx` / `dy` inside `onTick`.
50
+
51
+ ## Quick reference
52
+
53
+ ```ts
54
+ import { useInertia } from "../composables/useInertia";
55
+
56
+ const tx = ref(0);
57
+ const ty = ref(0);
58
+
59
+ const inertia = useInertia(
60
+ (dx, dy) => {
61
+ tx.value += dx;
62
+ ty.value += dy;
63
+ },
64
+ { friction: 0.9, minVelocity: 0.3 },
65
+ );
66
+
67
+ function onPointerDown() { inertia.stop(); inertia.resetTime(); }
68
+ function onPointerMove(dx: number, dy: number) {
69
+ tx.value += dx;
70
+ ty.value += dy;
71
+ inertia.trackMove(dx, dy);
72
+ }
73
+ function onPointerUp() { inertia.release(); }
74
+ ```
75
+
76
+ ## Related
77
+
78
+ - `<orio-zoomable-container>` — uses this for post-pan momentum.
79
+ - `<orio-canvas>` — same.
80
+ - Public API reference: `docs/composables/use-inertia.md`.