@ansh-ui/vue 0.2.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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chunk-2VSROZ2N.js +1281 -0
  3. package/dist/chunk-2VSROZ2N.js.map +1 -0
  4. package/dist/chunk-5BQEZYG6.cjs +1294 -0
  5. package/dist/chunk-5BQEZYG6.cjs.map +1 -0
  6. package/dist/chunk-6732H4BQ.cjs +28 -0
  7. package/dist/chunk-6732H4BQ.cjs.map +1 -0
  8. package/dist/chunk-6ABPGOJP.js +722 -0
  9. package/dist/chunk-6ABPGOJP.js.map +1 -0
  10. package/dist/chunk-6XJOB6LE.js +62 -0
  11. package/dist/chunk-6XJOB6LE.js.map +1 -0
  12. package/dist/chunk-774WBLDR.cjs +24 -0
  13. package/dist/chunk-774WBLDR.cjs.map +1 -0
  14. package/dist/chunk-B6OXKW5Q.js +567 -0
  15. package/dist/chunk-B6OXKW5Q.js.map +1 -0
  16. package/dist/chunk-DMPNT3MY.cjs +64 -0
  17. package/dist/chunk-DMPNT3MY.cjs.map +1 -0
  18. package/dist/chunk-EISHOEB6.cjs +158 -0
  19. package/dist/chunk-EISHOEB6.cjs.map +1 -0
  20. package/dist/chunk-EVO23GUS.js +223 -0
  21. package/dist/chunk-EVO23GUS.js.map +1 -0
  22. package/dist/chunk-FVKLCGA4.js +1035 -0
  23. package/dist/chunk-FVKLCGA4.js.map +1 -0
  24. package/dist/chunk-IOXGBPOV.cjs +3681 -0
  25. package/dist/chunk-IOXGBPOV.cjs.map +1 -0
  26. package/dist/chunk-J2LA4GRP.cjs +1051 -0
  27. package/dist/chunk-J2LA4GRP.cjs.map +1 -0
  28. package/dist/chunk-JQ4YLXXM.cjs +580 -0
  29. package/dist/chunk-JQ4YLXXM.cjs.map +1 -0
  30. package/dist/chunk-KCA7RNJ4.cjs +781 -0
  31. package/dist/chunk-KCA7RNJ4.cjs.map +1 -0
  32. package/dist/chunk-NJDDNO4C.js +23 -0
  33. package/dist/chunk-NJDDNO4C.js.map +1 -0
  34. package/dist/chunk-OAQ7MDYX.js +22 -0
  35. package/dist/chunk-OAQ7MDYX.js.map +1 -0
  36. package/dist/chunk-PP6OYURM.cjs +238 -0
  37. package/dist/chunk-PP6OYURM.cjs.map +1 -0
  38. package/dist/chunk-SHX2JGID.cjs +269 -0
  39. package/dist/chunk-SHX2JGID.cjs.map +1 -0
  40. package/dist/chunk-SOYRICHU.js +3645 -0
  41. package/dist/chunk-SOYRICHU.js.map +1 -0
  42. package/dist/chunk-T425FIC7.js +773 -0
  43. package/dist/chunk-T425FIC7.js.map +1 -0
  44. package/dist/chunk-TMG3M6TK.js +152 -0
  45. package/dist/chunk-TMG3M6TK.js.map +1 -0
  46. package/dist/chunk-XLLSS464.cjs +286 -0
  47. package/dist/chunk-XLLSS464.cjs.map +1 -0
  48. package/dist/chunk-XZ5ZFLZM.js +280 -0
  49. package/dist/chunk-XZ5ZFLZM.js.map +1 -0
  50. package/dist/chunk-Z7XOFKM4.cjs +733 -0
  51. package/dist/chunk-Z7XOFKM4.cjs.map +1 -0
  52. package/dist/chunk-ZGMXOMCB.js +266 -0
  53. package/dist/chunk-ZGMXOMCB.js.map +1 -0
  54. package/dist/data.cjs +70 -0
  55. package/dist/data.cjs.map +1 -0
  56. package/dist/data.d.cts +963 -0
  57. package/dist/data.d.ts +963 -0
  58. package/dist/data.js +5 -0
  59. package/dist/data.js.map +1 -0
  60. package/dist/form.cjs +151 -0
  61. package/dist/form.cjs.map +1 -0
  62. package/dist/form.d.cts +2639 -0
  63. package/dist/form.d.ts +2639 -0
  64. package/dist/form.js +6 -0
  65. package/dist/form.js.map +1 -0
  66. package/dist/index.cjs +1158 -0
  67. package/dist/index.cjs.map +1 -0
  68. package/dist/index.d.cts +439 -0
  69. package/dist/index.d.ts +439 -0
  70. package/dist/index.js +547 -0
  71. package/dist/index.js.map +1 -0
  72. package/dist/layout.cjs +67 -0
  73. package/dist/layout.cjs.map +1 -0
  74. package/dist/layout.d.cts +729 -0
  75. package/dist/layout.d.ts +729 -0
  76. package/dist/layout.js +6 -0
  77. package/dist/layout.js.map +1 -0
  78. package/dist/motion.cjs +50 -0
  79. package/dist/motion.cjs.map +1 -0
  80. package/dist/motion.d.cts +681 -0
  81. package/dist/motion.d.ts +681 -0
  82. package/dist/motion.js +5 -0
  83. package/dist/motion.js.map +1 -0
  84. package/dist/navigation.cjs +48 -0
  85. package/dist/navigation.cjs.map +1 -0
  86. package/dist/navigation.d.cts +515 -0
  87. package/dist/navigation.d.ts +515 -0
  88. package/dist/navigation.js +7 -0
  89. package/dist/navigation.js.map +1 -0
  90. package/dist/overlay.cjs +61 -0
  91. package/dist/overlay.cjs.map +1 -0
  92. package/dist/overlay.d.cts +772 -0
  93. package/dist/overlay.d.ts +772 -0
  94. package/dist/overlay.js +8 -0
  95. package/dist/overlay.js.map +1 -0
  96. package/dist/position-Cn7qP1pn.d.cts +50 -0
  97. package/dist/position-Cn7qP1pn.d.ts +50 -0
  98. package/dist/primitives.cjs +129 -0
  99. package/dist/primitives.cjs.map +1 -0
  100. package/dist/primitives.d.cts +300 -0
  101. package/dist/primitives.d.ts +300 -0
  102. package/dist/primitives.js +8 -0
  103. package/dist/primitives.js.map +1 -0
  104. package/dist/sidebar-CQqEmpid.d.cts +124 -0
  105. package/dist/sidebar-CTZ-Ckko.d.ts +124 -0
  106. package/dist/styles.css +5593 -0
  107. package/dist/utils-IKPG3zcC.d.cts +46 -0
  108. package/dist/utils-IKPG3zcC.d.ts +46 -0
  109. package/package.json +91 -0
@@ -0,0 +1,8 @@
1
+ export { AlertDialog, ContextMenu, Dialog, DialogFooter, Drawer, DropdownMenu, HoverCard, Popover, PopoverContent, PopoverTrigger, Tooltip, TooltipProvider } from './chunk-2VSROZ2N.js';
2
+ import './chunk-6XJOB6LE.js';
3
+ import './chunk-XZ5ZFLZM.js';
4
+ import './chunk-TMG3M6TK.js';
5
+ import './chunk-OAQ7MDYX.js';
6
+ import './chunk-NJDDNO4C.js';
7
+ //# sourceMappingURL=overlay.js.map
8
+ //# sourceMappingURL=overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"overlay.js"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Anchored positioning.
3
+ *
4
+ * Popovers, tooltips, menus and comboboxes all need the same thing: place a floating box next to an
5
+ * anchor, keep it on screen, and report where it actually ended up so the arrow can point the right
6
+ * way. This is that calculation, as a **pure function** of rectangles — verbatim from
7
+ * `@ansh-ui/react`'s `primitives/position.ts`.
8
+ *
9
+ * It is duplicated rather than imported across the workspace boundary on purpose: the function has
10
+ * zero framework dependency, so copying costs nothing in drift (a bug fix here is a five-line diff
11
+ * to mirror) and avoids making `@ansh-ui/vue` depend on `@ansh-ui/react` for one pure function.
12
+ */
13
+ type Side = 'top' | 'right' | 'bottom' | 'left';
14
+ type Align = 'start' | 'center' | 'end';
15
+ type Placement = Side | `${Side}-${Align}`;
16
+ interface Rect {
17
+ x: number;
18
+ y: number;
19
+ width: number;
20
+ height: number;
21
+ }
22
+ interface PositionOptions {
23
+ /** Preferred placement. Default `'bottom'`. */
24
+ placement?: Placement;
25
+ /** Gap between anchor and floating element, in px. Default `8`. */
26
+ offset?: number;
27
+ /** Minimum distance to keep from the viewport edge, in px. Default `8`. */
28
+ padding?: number;
29
+ /** Flip to the opposite side when there isn't room. Default `true`. */
30
+ flip?: boolean;
31
+ /** Slide along the cross axis to stay on screen. Default `true`. */
32
+ shift?: boolean;
33
+ /** Size of the arrow, in px, if one is being positioned. Default `0` (no arrow). */
34
+ arrowSize?: number;
35
+ }
36
+ interface PositionResult {
37
+ x: number;
38
+ y: number;
39
+ placement: Placement;
40
+ side: Side;
41
+ align: Align;
42
+ arrow: {
43
+ x: number;
44
+ y: number;
45
+ } | null;
46
+ hidden: boolean;
47
+ }
48
+ declare function computePosition(anchor: Rect, floating: Rect, viewport: Rect, options?: PositionOptions): PositionResult;
49
+
50
+ export { type Align as A, type Placement as P, type Rect as R, type Side as S, type PositionOptions as a, type PositionResult as b, computePosition as c };
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Anchored positioning.
3
+ *
4
+ * Popovers, tooltips, menus and comboboxes all need the same thing: place a floating box next to an
5
+ * anchor, keep it on screen, and report where it actually ended up so the arrow can point the right
6
+ * way. This is that calculation, as a **pure function** of rectangles — verbatim from
7
+ * `@ansh-ui/react`'s `primitives/position.ts`.
8
+ *
9
+ * It is duplicated rather than imported across the workspace boundary on purpose: the function has
10
+ * zero framework dependency, so copying costs nothing in drift (a bug fix here is a five-line diff
11
+ * to mirror) and avoids making `@ansh-ui/vue` depend on `@ansh-ui/react` for one pure function.
12
+ */
13
+ type Side = 'top' | 'right' | 'bottom' | 'left';
14
+ type Align = 'start' | 'center' | 'end';
15
+ type Placement = Side | `${Side}-${Align}`;
16
+ interface Rect {
17
+ x: number;
18
+ y: number;
19
+ width: number;
20
+ height: number;
21
+ }
22
+ interface PositionOptions {
23
+ /** Preferred placement. Default `'bottom'`. */
24
+ placement?: Placement;
25
+ /** Gap between anchor and floating element, in px. Default `8`. */
26
+ offset?: number;
27
+ /** Minimum distance to keep from the viewport edge, in px. Default `8`. */
28
+ padding?: number;
29
+ /** Flip to the opposite side when there isn't room. Default `true`. */
30
+ flip?: boolean;
31
+ /** Slide along the cross axis to stay on screen. Default `true`. */
32
+ shift?: boolean;
33
+ /** Size of the arrow, in px, if one is being positioned. Default `0` (no arrow). */
34
+ arrowSize?: number;
35
+ }
36
+ interface PositionResult {
37
+ x: number;
38
+ y: number;
39
+ placement: Placement;
40
+ side: Side;
41
+ align: Align;
42
+ arrow: {
43
+ x: number;
44
+ y: number;
45
+ } | null;
46
+ hidden: boolean;
47
+ }
48
+ declare function computePosition(anchor: Rect, floating: Rect, viewport: Rect, options?: PositionOptions): PositionResult;
49
+
50
+ export { type Align as A, type Placement as P, type Rect as R, type Side as S, type PositionOptions as a, type PositionResult as b, computePosition as c };
@@ -0,0 +1,129 @@
1
+ 'use strict';
2
+
3
+ var chunkDMPNT3MY_cjs = require('./chunk-DMPNT3MY.cjs');
4
+ var chunkXLLSS464_cjs = require('./chunk-XLLSS464.cjs');
5
+ var chunkEISHOEB6_cjs = require('./chunk-EISHOEB6.cjs');
6
+ var chunk774WBLDR_cjs = require('./chunk-774WBLDR.cjs');
7
+ var chunkPP6OYURM_cjs = require('./chunk-PP6OYURM.cjs');
8
+ var chunk6732H4BQ_cjs = require('./chunk-6732H4BQ.cjs');
9
+
10
+
11
+
12
+ Object.defineProperty(exports, "usePresence", {
13
+ enumerable: true,
14
+ get: function () { return chunkDMPNT3MY_cjs.usePresence; }
15
+ });
16
+ Object.defineProperty(exports, "computePosition", {
17
+ enumerable: true,
18
+ get: function () { return chunkXLLSS464_cjs.computePosition; }
19
+ });
20
+ Object.defineProperty(exports, "getLayerStack", {
21
+ enumerable: true,
22
+ get: function () { return chunkXLLSS464_cjs.getLayerStack; }
23
+ });
24
+ Object.defineProperty(exports, "useAnchoredPosition", {
25
+ enumerable: true,
26
+ get: function () { return chunkXLLSS464_cjs.useAnchoredPosition; }
27
+ });
28
+ Object.defineProperty(exports, "useDismiss", {
29
+ enumerable: true,
30
+ get: function () { return chunkXLLSS464_cjs.useDismiss; }
31
+ });
32
+ Object.defineProperty(exports, "useScrollLock", {
33
+ enumerable: true,
34
+ get: function () { return chunkXLLSS464_cjs.useScrollLock; }
35
+ });
36
+ Object.defineProperty(exports, "getTabbable", {
37
+ enumerable: true,
38
+ get: function () { return chunkEISHOEB6_cjs.getTabbable; }
39
+ });
40
+ Object.defineProperty(exports, "useAutoFocus", {
41
+ enumerable: true,
42
+ get: function () { return chunkEISHOEB6_cjs.useAutoFocus; }
43
+ });
44
+ Object.defineProperty(exports, "useFocusRestore", {
45
+ enumerable: true,
46
+ get: function () { return chunkEISHOEB6_cjs.useFocusRestore; }
47
+ });
48
+ Object.defineProperty(exports, "useFocusTrap", {
49
+ enumerable: true,
50
+ get: function () { return chunkEISHOEB6_cjs.useFocusTrap; }
51
+ });
52
+ Object.defineProperty(exports, "useRovingFocus", {
53
+ enumerable: true,
54
+ get: function () { return chunkEISHOEB6_cjs.useRovingFocus; }
55
+ });
56
+ Object.defineProperty(exports, "useControllableState", {
57
+ enumerable: true,
58
+ get: function () { return chunk774WBLDR_cjs.useControllableState; }
59
+ });
60
+ Object.defineProperty(exports, "useAnimate", {
61
+ enumerable: true,
62
+ get: function () { return chunkPP6OYURM_cjs.useAnimate; }
63
+ });
64
+ Object.defineProperty(exports, "useAnimatedFrom", {
65
+ enumerable: true,
66
+ get: function () { return chunkPP6OYURM_cjs.useAnimatedFrom; }
67
+ });
68
+ Object.defineProperty(exports, "useElementSize", {
69
+ enumerable: true,
70
+ get: function () { return chunkPP6OYURM_cjs.useElementSize; }
71
+ });
72
+ Object.defineProperty(exports, "useFrameBudget", {
73
+ enumerable: true,
74
+ get: function () { return chunkPP6OYURM_cjs.useFrameBudget; }
75
+ });
76
+ Object.defineProperty(exports, "useInView", {
77
+ enumerable: true,
78
+ get: function () { return chunkPP6OYURM_cjs.useInView; }
79
+ });
80
+ Object.defineProperty(exports, "useMotionRef", {
81
+ enumerable: true,
82
+ get: function () { return chunkPP6OYURM_cjs.useMotionRef; }
83
+ });
84
+ Object.defineProperty(exports, "useMotionStyle", {
85
+ enumerable: true,
86
+ get: function () { return chunkPP6OYURM_cjs.useMotionStyle; }
87
+ });
88
+ Object.defineProperty(exports, "useMotionValue", {
89
+ enumerable: true,
90
+ get: function () { return chunkPP6OYURM_cjs.useMotionValue; }
91
+ });
92
+ Object.defineProperty(exports, "usePointer", {
93
+ enumerable: true,
94
+ get: function () { return chunkPP6OYURM_cjs.usePointer; }
95
+ });
96
+ Object.defineProperty(exports, "useReducedMotion", {
97
+ enumerable: true,
98
+ get: function () { return chunkPP6OYURM_cjs.useReducedMotion; }
99
+ });
100
+ Object.defineProperty(exports, "useScrollProgress", {
101
+ enumerable: true,
102
+ get: function () { return chunkPP6OYURM_cjs.useScrollProgress; }
103
+ });
104
+ Object.defineProperty(exports, "useSpringValue", {
105
+ enumerable: true,
106
+ get: function () { return chunkPP6OYURM_cjs.useSpringValue; }
107
+ });
108
+ Object.defineProperty(exports, "useTicker", {
109
+ enumerable: true,
110
+ get: function () { return chunkPP6OYURM_cjs.useTicker; }
111
+ });
112
+ Object.defineProperty(exports, "useWindowScroll", {
113
+ enumerable: true,
114
+ get: function () { return chunkPP6OYURM_cjs.useWindowScroll; }
115
+ });
116
+ Object.defineProperty(exports, "cx", {
117
+ enumerable: true,
118
+ get: function () { return chunk6732H4BQ_cjs.cx; }
119
+ });
120
+ Object.defineProperty(exports, "resolveSlotContent", {
121
+ enumerable: true,
122
+ get: function () { return chunk6732H4BQ_cjs.resolveSlotContent; }
123
+ });
124
+ Object.defineProperty(exports, "useId", {
125
+ enumerable: true,
126
+ get: function () { return chunk6732H4BQ_cjs.useId; }
127
+ });
128
+ //# sourceMappingURL=primitives.cjs.map
129
+ //# sourceMappingURL=primitives.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"primitives.cjs"}
@@ -0,0 +1,300 @@
1
+ import { R as ReadonlyRef } from './utils-IKPG3zcC.cjs';
2
+ export { S as SlotContent, c as cx, r as resolveSlotContent, u as useId } from './utils-IKPG3zcC.cjs';
3
+ import { b as PositionResult, a as PositionOptions } from './position-Cn7qP1pn.cjs';
4
+ export { A as Align, P as Placement, R as Rect, S as Side, c as computePosition } from './position-Cn7qP1pn.cjs';
5
+ import { ComputedRef, Ref, ShallowRef } from 'vue';
6
+ import * as _ansh_ui_core from '@ansh-ui/core';
7
+ import { BudgetReport, PointerState, ScrollTrackOptions, ScrollProgress, FrameState, MotionValue, AnimationOptions, SpringOptions } from '@ansh-ui/core';
8
+
9
+ /**
10
+ * State that works both controlled and uncontrolled — the Vue counterpart of
11
+ * `@ansh-ui/react`'s hook of the same name, and just as load-bearing here.
12
+ *
13
+ * A `<Select>` must work as `<Select />` (owns its value), `<Select :default-value="a" />` (owns
14
+ * its value, seeded), `v-model="v"` (the parent owns it via `modelValue`/`update:modelValue`), and
15
+ * `<Select :open="open" @update:open="…" />` for a named prop like a dialog's `open`. All four are
16
+ * the same shape: **the prop is controlled when the reactive getter returns something other than
17
+ * `undefined`**, evaluated on every read rather than latched once — so a component that starts
18
+ * uncontrolled and later receives a value (an async-loaded form) switches over instead of silently
19
+ * ignoring the prop from then on.
20
+ *
21
+ * ```ts
22
+ * const [value, setValue] = useControllableState(
23
+ * () => props.modelValue,
24
+ * defaultValue,
25
+ * (next) => emit('update:modelValue', next),
26
+ * )
27
+ * ```
28
+ *
29
+ * `getProp` is a plain function rather than a `Ref` so it can read straight off `props` — Vue's
30
+ * `computed` tracks whatever reactive properties it touches, `props.foo` included, with no need to
31
+ * wrap the caller's access pattern.
32
+ */
33
+ declare function useControllableState<T>(getProp: () => T | undefined, defaultValue: T, onChange?: (value: T) => void): [ComputedRef<T>, (next: T | ((previous: T) => T)) => void];
34
+
35
+ /** Ids of the currently open dismissable layers, outermost first. Exposed for tests. */
36
+ declare function getLayerStack(): readonly string[];
37
+ interface DismissOptions {
38
+ /** Close on pointer press outside the surface. Default `true`. */
39
+ outsidePress?: boolean;
40
+ /** Close on Escape. Only the topmost layer responds. Default `true`. */
41
+ escapeKey?: boolean;
42
+ /**
43
+ * Extra elements that count as "inside" — normally the trigger.
44
+ *
45
+ * Without this the trigger's own click closes the surface via the outside handler and then
46
+ * immediately reopens it via its own click handler, so the surface appears not to close at all.
47
+ */
48
+ ignore?: Array<Ref<HTMLElement | null | undefined>>;
49
+ }
50
+ declare function useDismiss(target: Ref<HTMLElement | null | undefined>, open: ReadonlyRef<boolean>, onDismiss: () => void, options?: DismissOptions): void;
51
+ declare function useScrollLock(active: ReadonlyRef<boolean>): void;
52
+
53
+ /** Every tabbable descendant, in tab order. */
54
+ declare function getTabbable(container: HTMLElement | null | undefined): HTMLElement[];
55
+ /**
56
+ * Trap Tab within a container while `active`.
57
+ *
58
+ * Implemented on `keydown` at the container rather than with sentinel elements at either end. The
59
+ * sentinel approach adds two focusable nodes to the accessibility tree that screen readers can land
60
+ * on and announce as blank; intercepting the key does not.
61
+ */
62
+ declare function useFocusTrap(target: Ref<HTMLElement | null | undefined>, active: ReadonlyRef<boolean>): void;
63
+ /**
64
+ * Restore focus to whatever was focused before `active` became true.
65
+ *
66
+ * The element is captured on activation, not on mount, because a component can be mounted long
67
+ * before it opens.
68
+ */
69
+ declare function useFocusRestore(active: ReadonlyRef<boolean>): void;
70
+ /**
71
+ * Move focus into a surface when it opens.
72
+ *
73
+ * Prefers an explicitly marked element, then the first tabbable one, then the container itself. The
74
+ * container fallback matters for a dialog whose only content is text: focus must land inside it so a
75
+ * screen reader announces the dialog rather than continuing from the page behind.
76
+ */
77
+ declare function useAutoFocus(target: Ref<HTMLElement | null | undefined>, active: ReadonlyRef<boolean>, initialFocus?: Ref<HTMLElement | null | undefined>): void;
78
+ /**
79
+ * Roving tabindex for a composite widget (toolbar, tab list, menu).
80
+ *
81
+ * The ARIA authoring practice: a composite has exactly **one** tab stop, and arrow keys move within
82
+ * it. Returns a keydown handler to bind on the composite's container.
83
+ */
84
+ declare function useRovingFocus(options: {
85
+ /** Items in DOM order. */
86
+ items: Ref<Array<HTMLElement | null>>;
87
+ /** Index that currently owns the tab stop. */
88
+ active: () => number;
89
+ onActiveChange: (index: number) => void;
90
+ orientation?: 'horizontal' | 'vertical' | 'both';
91
+ loop?: boolean;
92
+ }): (event: KeyboardEvent) => void;
93
+
94
+ interface AnchoredPositionOptions extends PositionOptions {
95
+ /** Set the floating element's width to the anchor's — what a combobox listbox wants. */
96
+ matchWidth?: boolean;
97
+ }
98
+ interface AnchoredPosition {
99
+ style: Record<string, string>;
100
+ arrowStyle: Record<string, string> | undefined;
101
+ placement: PositionResult['placement'];
102
+ side: PositionResult['side'];
103
+ }
104
+ /**
105
+ * Keep a floating element positioned against an anchor — the Vue counterpart of `@ansh-ui/react`'s
106
+ * `useAnchoredPosition`.
107
+ *
108
+ * Recomputes on scroll (capture phase, so nested scroll containers are caught), on viewport resize,
109
+ * and whenever either element changes size. It deliberately does **not** poll on every frame: that
110
+ * costs a forced layout per frame for a value that changes only on discrete events.
111
+ *
112
+ * Bound to `open` rather than a separate `enabled` flag — every consumer in this package positions
113
+ * only while its surface is open, so a second flag would be unused surface area.
114
+ */
115
+ declare function useAnchoredPosition(anchorRef: Ref<HTMLElement | null | undefined>, floatingRef: Ref<HTMLElement | null | undefined>, open: ReadonlyRef<boolean>, options?: AnchoredPositionOptions): {
116
+ position: ComputedRef<AnchoredPosition>;
117
+ update: () => void;
118
+ };
119
+
120
+ /**
121
+ * Keep an element mounted while it animates out — the Vue counterpart of `@ansh-ui/react`'s
122
+ * `usePresence`.
123
+ *
124
+ * The problem: `v-if="open"` cannot animate on close, because Vue removes the node the instant
125
+ * `open` flips (Vue's own `<Transition>` solves this for simple cases, but our overlay components
126
+ * need the resolved `mounted`/`state` pair to drive `data-state` for CSS *and* to gate focus
127
+ * trapping and scroll locking off the same signal). The fix is the same as React's: keep rendering
128
+ * it and unmount when the exit animation actually finishes.
129
+ *
130
+ * Finishing is detected from `animationend`/`transitionend` rather than a duration prop, which would
131
+ * have to be kept in sync with the CSS by hand and drifts the moment someone retimes the animation
132
+ * in the stylesheet. The timeout is only a safety net for the case where no animation is declared at
133
+ * all and no event ever fires.
134
+ */
135
+ declare function usePresence(open: ReadonlyRef<boolean>, target: Ref<HTMLElement | null | undefined>): {
136
+ mounted: Ref<boolean>;
137
+ state: Ref<'open' | 'closed'>;
138
+ };
139
+
140
+ /**
141
+ * Observer and lifecycle composables.
142
+ *
143
+ * A consistent pattern throughout: composables that take an element accept a **ref you bind in the
144
+ * template**, and watch it rather than reading it once. This matters because a template ref is
145
+ * `null` during `setup()` and only populated after mount — and stays null across a `v-if` toggle,
146
+ * then repopulates. Watching handles all of that; reading once in `onMounted` silently fails for
147
+ * conditionally-rendered elements, which is the most common bug in hand-written Vue composables.
148
+ */
149
+ /** Subscribe to the shared ticker for the current scope's lifetime. */
150
+ declare function useTicker(callback: (state: FrameState) => void, options?: {
151
+ phase?: 'read' | 'compute' | 'write' | 'post';
152
+ priority?: number;
153
+ enabled?: Ref<boolean> | boolean;
154
+ }): () => void;
155
+ interface UseInViewOptions {
156
+ threshold?: number;
157
+ rootMargin?: string;
158
+ once?: boolean;
159
+ }
160
+ /**
161
+ * Is the element in view?
162
+ *
163
+ * @param target A template ref. Watched, so it works with `v-if` and with elements that mount late.
164
+ */
165
+ declare function useInView(target: Ref<HTMLElement | null | undefined>, options?: UseInViewOptions): Ref<boolean>;
166
+ /** Track an element's size as a reactive value. */
167
+ declare function useElementSize(target: Ref<HTMLElement | null | undefined>): Ref<{
168
+ width: number;
169
+ height: number;
170
+ }>;
171
+ /**
172
+ * Track an element's scroll progress.
173
+ *
174
+ * Returns a **shallowRef holding a mutable state object**, not a reactive number. Scroll progress
175
+ * changes every frame; making it reactive would flush an effect per frame and undo the phase
176
+ * separation the kernel provides. Read `progress.value.progress` inside a `useTicker` callback, or
177
+ * pass `onChange` and write to the DOM directly.
178
+ */
179
+ declare function useScrollProgress(target: Ref<HTMLElement | null | undefined>, options?: ScrollTrackOptions & {
180
+ onChange?: (progress: ScrollProgress) => void;
181
+ }): ShallowRef<ScrollProgress>;
182
+ /** Track the window's (or a container's) overall scroll. */
183
+ declare function useWindowScroll(onChange?: (info: {
184
+ progress: number;
185
+ scroll: number;
186
+ velocity: number;
187
+ max: number;
188
+ }) => void, options?: {
189
+ axis?: 'y' | 'x';
190
+ container?: HTMLElement | null;
191
+ }): ShallowRef<{
192
+ progress: number;
193
+ scroll: number;
194
+ velocity: number;
195
+ max: number;
196
+ }>;
197
+ /**
198
+ * Track pointer position over an element.
199
+ *
200
+ * The returned object is mutated in place by the tracker each frame and is deliberately **not**
201
+ * reactive — reading it in a template would flush on every pointer move.
202
+ */
203
+ declare function usePointer(target: Ref<HTMLElement | null | undefined>, options?: {
204
+ smoothing?: number;
205
+ trackOutside?: boolean;
206
+ }): ShallowRef<Readonly<PointerState> | null>;
207
+ /**
208
+ * Does the user prefer reduced motion?
209
+ *
210
+ * Returns `false` during SSR, which is the hydration-safe default: the server cannot know, and
211
+ * differing between server and first client render would be a mismatch.
212
+ */
213
+ declare function useReducedMotion(): Ref<boolean>;
214
+ /**
215
+ * Live frame-budget telemetry for a development overlay.
216
+ *
217
+ * Sampled at 4 Hz rather than per frame: a number changing 60 times a second is unreadable, and
218
+ * rendering it that often distorts the measurement it is reporting.
219
+ */
220
+ declare function useFrameBudget(): Ref<BudgetReport | null>;
221
+
222
+ /**
223
+ * Vue motion composables.
224
+ *
225
+ * The design principle mirrors the React package: animated values live **outside** Vue's
226
+ * reactivity. A `ref` that updates 60 times a second triggers 60 reactive effect flushes and, if
227
+ * anything in a template reads it, 60 patch cycles — which is precisely the cost that makes
228
+ * "animation in a framework" slow.
229
+ *
230
+ * So {@link useMotionValue} returns the engine's `MotionValue` directly and writes to the DOM. Where
231
+ * a value genuinely belongs in a template, {@link useMotionRef} bridges it into a `shallowRef` and
232
+ * says plainly what that costs.
233
+ *
234
+ * Cleanup uses `onScopeDispose` rather than `onBeforeUnmount`, so these compose correctly inside
235
+ * `effectScope()` — including in Pinia stores and outside a component instance entirely.
236
+ */
237
+ /**
238
+ * Create a {@link MotionValue} bound to the current effect scope.
239
+ *
240
+ * Does not trigger re-renders. Pass it to `useMotionStyle` or read it in a `useTicker` callback.
241
+ */
242
+ declare function useMotionValue<T>(initial: T): MotionValue<T>;
243
+ /**
244
+ * Bridge a MotionValue into a Vue ref.
245
+ *
246
+ * **This makes the value reactive, which means a component update on every change.** For a value
247
+ * being animated continuously that is 60 updates per second. Use it for values that change at
248
+ * interaction rate — a settled spring, a toggle — not for anything mid-animation.
249
+ *
250
+ * A `shallowRef` rather than `ref` because the value is replaced wholesale, never mutated, so deep
251
+ * reactivity would be pure overhead.
252
+ */
253
+ declare function useMotionRef<T>(value: MotionValue<T>): Readonly<ShallowRef<T>>;
254
+ /**
255
+ * Write a MotionValue straight to an element's style property, bypassing Vue's renderer.
256
+ *
257
+ * This is the mechanism for smooth animation in Vue. Bind the returned ref to an element:
258
+ *
259
+ * ```vue
260
+ * <script setup>
261
+ * const x = useMotionValue(0)
262
+ * const el = useMotionStyle(x, (v) => `translateX(${v}px)`)
263
+ * </script>
264
+ * <template><div :ref="el" /></template>
265
+ * ```
266
+ */
267
+ declare function useMotionStyle<T, El extends HTMLElement = HTMLElement>(value: MotionValue<T>, format: (value: T) => string, property?: string): ShallowRef<El | null>;
268
+ /**
269
+ * A spring that continuously chases a target.
270
+ *
271
+ * The target is a plain setter rather than a reactive ref, deliberately: reading a ref inside the
272
+ * spring's per-frame callback would register a reactive dependency and flush an effect every
273
+ * frame, which defeats the purpose of keeping the animation outside the reactivity system.
274
+ */
275
+ declare function useSpringValue(initial: number, options?: SpringOptions): {
276
+ value: MotionValue<number>;
277
+ set: (target: number) => void;
278
+ };
279
+ /**
280
+ * Scope-bound imperative animation.
281
+ *
282
+ * Any in-flight animation is stopped when the scope disposes, and when `start` is called again —
283
+ * which is the behaviour you want, since two animations driving one value fight each other.
284
+ */
285
+ declare function useAnimate(): <T>(from: T | MotionValue<T>, to: T | readonly T[], options?: AnimationOptions<T>) => _ansh_ui_core.AnimationControls;
286
+ /**
287
+ * Drive a MotionValue from a reactive source.
288
+ *
289
+ * The bridge in the other direction: when a `ref` in your component changes, animate toward the new
290
+ * value. This is the idiomatic way to connect Vue state to Ansh motion.
291
+ *
292
+ * ```ts
293
+ * const open = ref(false)
294
+ * const height = useMotionValue(0)
295
+ * useAnimatedFrom(open, height, (isOpen) => (isOpen ? 320 : 0), { spring: 'snappy' })
296
+ * ```
297
+ */
298
+ declare function useAnimatedFrom<Source, T>(source: Ref<Source>, target: MotionValue<T>, map: (value: Source) => T, options?: AnimationOptions<T>): void;
299
+
300
+ export { type AnchoredPosition, type AnchoredPositionOptions, type DismissOptions, PositionOptions, PositionResult, ReadonlyRef, type UseInViewOptions, getLayerStack, getTabbable, useAnchoredPosition, useAnimate, useAnimatedFrom, useAutoFocus, useControllableState, useDismiss, useElementSize, useFocusRestore, useFocusTrap, useFrameBudget, useInView, useMotionRef, useMotionStyle, useMotionValue, usePointer, usePresence, useReducedMotion, useRovingFocus, useScrollLock, useScrollProgress, useSpringValue, useTicker, useWindowScroll };