@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,681 @@
1
+ import * as vue from 'vue';
2
+ import { VNode, PropType, ComputedRef } from 'vue';
3
+ import { EasingInput, SpringOptions, springs, StaggerFrom, ColorInput, ReducedMotionMode } from '@ansh-ui/core';
4
+
5
+ /**
6
+ * Declarative motion — the Vue counterpart of `@ansh-ui/react`'s `Motion`/`AnimatePresence`/
7
+ * `Draggable`.
8
+ *
9
+ * A deliberately **small** subset of what a full motion library does: transform properties and
10
+ * opacity, animated from `initial` to `animate`, plus hover and press states and an exit animation
11
+ * when paired with `AnimatePresence`.
12
+ *
13
+ * That scope is a decision, not a gap. Layout animation (FLIP), shared-element transitions and
14
+ * variant propagation each need machinery an order of magnitude larger than this file, and a
15
+ * half-implementation of them is worse than none — it works in the demo and fails on the real page.
16
+ * For those, use a dedicated library; for the 90% case of "fade this in, slide that up, spring the
17
+ * card on hover", this costs a fraction of the bundle.
18
+ *
19
+ * Values are written straight to the element's `style` from the ticker's write phase, outside Vue's
20
+ * reactivity — the same principle `useMotionStyle` documents in `composables/use-motion.ts`. `Motion`
21
+ * and `Draggable` are built on `useAnimate()` (scope-bound imperative animation, auto-stopping the
22
+ * previous run) and `useInView()` (the `whileInView` trigger) rather than calling the ticker
23
+ * primitives from scratch, so cleanup and scope-disposal are inherited for free.
24
+ */
25
+ interface MotionValues {
26
+ opacity?: number;
27
+ x?: number;
28
+ y?: number;
29
+ scale?: number;
30
+ scaleX?: number;
31
+ scaleY?: number;
32
+ rotate?: number;
33
+ /** Blur radius in px. */
34
+ blur?: number;
35
+ }
36
+ interface MotionTransition {
37
+ /** Seconds. Ignored when `spring` is set. Default `0.4`. */
38
+ duration?: number;
39
+ /** Seconds to wait. Default `0`. */
40
+ delay?: number;
41
+ easing?: EasingInput;
42
+ /** Use a spring instead of a tween. `true` uses the `smooth` preset. */
43
+ spring?: boolean | SpringOptions | keyof typeof springs;
44
+ }
45
+ /**
46
+ * An animated element.
47
+ *
48
+ * ```vue
49
+ * <Motion :initial="{ opacity: 0, y: 24 }" :animate="{ opacity: 1, y: 0 }" while-in-view>
50
+ * <Card />
51
+ * </Motion>
52
+ * ```
53
+ */
54
+ declare const Motion: vue.DefineComponent<vue.ExtractPropTypes<{
55
+ as: {
56
+ type: StringConstructor;
57
+ default: string;
58
+ };
59
+ /** Starting values. Applied before the first paint. */
60
+ initial: {
61
+ type: PropType<MotionValues>;
62
+ default: undefined;
63
+ };
64
+ /** Target values. Changing these animates to the new target. */
65
+ animate: {
66
+ type: PropType<MotionValues>;
67
+ default: undefined;
68
+ };
69
+ exit: {
70
+ type: PropType<MotionValues>;
71
+ default: undefined;
72
+ };
73
+ transition: {
74
+ type: PropType<MotionTransition>;
75
+ default: undefined;
76
+ };
77
+ whileHover: {
78
+ type: PropType<MotionValues>;
79
+ default: undefined;
80
+ };
81
+ whileTap: {
82
+ type: PropType<MotionValues>;
83
+ default: undefined;
84
+ };
85
+ /** Animate to `animate` only once scrolled into view. */
86
+ whileInView: {
87
+ type: BooleanConstructor;
88
+ default: boolean;
89
+ };
90
+ /** Fraction visible before `whileInView` triggers. Default `0.2`. */
91
+ inViewAmount: {
92
+ type: NumberConstructor;
93
+ default: number;
94
+ };
95
+ }>, () => VNode<vue.RendererNode, vue.RendererElement, {
96
+ [key: string]: any;
97
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
98
+ as: {
99
+ type: StringConstructor;
100
+ default: string;
101
+ };
102
+ /** Starting values. Applied before the first paint. */
103
+ initial: {
104
+ type: PropType<MotionValues>;
105
+ default: undefined;
106
+ };
107
+ /** Target values. Changing these animates to the new target. */
108
+ animate: {
109
+ type: PropType<MotionValues>;
110
+ default: undefined;
111
+ };
112
+ exit: {
113
+ type: PropType<MotionValues>;
114
+ default: undefined;
115
+ };
116
+ transition: {
117
+ type: PropType<MotionTransition>;
118
+ default: undefined;
119
+ };
120
+ whileHover: {
121
+ type: PropType<MotionValues>;
122
+ default: undefined;
123
+ };
124
+ whileTap: {
125
+ type: PropType<MotionValues>;
126
+ default: undefined;
127
+ };
128
+ /** Animate to `animate` only once scrolled into view. */
129
+ whileInView: {
130
+ type: BooleanConstructor;
131
+ default: boolean;
132
+ };
133
+ /** Fraction visible before `whileInView` triggers. Default `0.2`. */
134
+ inViewAmount: {
135
+ type: NumberConstructor;
136
+ default: number;
137
+ };
138
+ }>> & Readonly<{}>, {
139
+ initial: MotionValues;
140
+ as: string;
141
+ animate: MotionValues;
142
+ exit: MotionValues;
143
+ transition: MotionTransition;
144
+ whileHover: MotionValues;
145
+ whileTap: MotionValues;
146
+ whileInView: boolean;
147
+ inViewAmount: number;
148
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
149
+ interface AnimatePresenceProps {
150
+ /** Seconds to keep a removed child mounted. Default `0.35`. */
151
+ exitDuration?: number;
152
+ }
153
+ /**
154
+ * Keep removed children mounted long enough to animate out.
155
+ *
156
+ * Vue unmounts a `v-for`/`v-if` item the instant it disappears from its source array, so an exit
157
+ * animation never gets a chance to run. This holds departing children in its own state, plays their
158
+ * `exit` values (swapped into `animate` on a cloned vnode), then drops them.
159
+ *
160
+ * Children **must** have stable `:key`s — that is how removals are detected at all. Without keys,
161
+ * Vue reuses vnode positions and this sees no removal to animate, same as the React version.
162
+ *
163
+ * Vue's own `<TransitionGroup>` was considered instead of this hand-rolled reconciliation, but it
164
+ * drives *CSS* transition/animation classes on move — it has no hook for "swap this prop and let the
165
+ * child's own animation system take it from here," which is what `exit` needs to compose with
166
+ * `Motion`. Cloning the departing vnode with its `animate` prop swapped to `exit` is the direct
167
+ * Vue-side equivalent of the React version's `cloneElement`.
168
+ */
169
+ declare const AnimatePresence: vue.DefineComponent<vue.ExtractPropTypes<{
170
+ exitDuration: {
171
+ type: NumberConstructor;
172
+ default: number;
173
+ };
174
+ }>, () => VNode<vue.RendererNode, vue.RendererElement, {
175
+ [key: string]: any;
176
+ }>[], {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
177
+ exitDuration: {
178
+ type: NumberConstructor;
179
+ default: number;
180
+ };
181
+ }>> & Readonly<{}>, {
182
+ exitDuration: number;
183
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
184
+ interface DraggableProps {
185
+ /** Constrain movement. */
186
+ axis?: 'x' | 'y' | 'both';
187
+ /** Bounds relative to the starting position, in px. */
188
+ bounds?: {
189
+ left?: number;
190
+ right?: number;
191
+ top?: number;
192
+ bottom?: number;
193
+ };
194
+ /** Spring back to the origin on release. */
195
+ snapBack?: boolean;
196
+ /** Carry momentum after release. Default `true` when not snapping back. */
197
+ momentum?: boolean;
198
+ }
199
+ /**
200
+ * A draggable surface with inertia.
201
+ *
202
+ * The momentum on release is what separates a drag that feels physical from one that stops dead.
203
+ * Velocity is measured over the last few pointer samples rather than the last two — a single pair
204
+ * of events is dominated by whatever jitter the final sample had, which produces a flick in the
205
+ * wrong direction often enough to be noticeable.
206
+ *
207
+ * `onDragStart`/`onDragEnd` from the React version become `dragStart`/`dragEnd` emits — this
208
+ * package's convention for event-callback props (see `Input`'s `change`/`clear` emits).
209
+ */
210
+ declare const Draggable: vue.DefineComponent<vue.ExtractPropTypes<{
211
+ axis: {
212
+ type: PropType<"x" | "y" | "both">;
213
+ default: string;
214
+ };
215
+ bounds: {
216
+ type: PropType<{
217
+ left?: number;
218
+ right?: number;
219
+ top?: number;
220
+ bottom?: number;
221
+ }>;
222
+ default: undefined;
223
+ };
224
+ snapBack: {
225
+ type: BooleanConstructor;
226
+ default: boolean;
227
+ };
228
+ momentum: {
229
+ type: BooleanConstructor;
230
+ default: undefined;
231
+ };
232
+ }>, () => VNode<vue.RendererNode, vue.RendererElement, {
233
+ [key: string]: any;
234
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("dragStart" | "dragEnd")[], "dragStart" | "dragEnd", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
235
+ axis: {
236
+ type: PropType<"x" | "y" | "both">;
237
+ default: string;
238
+ };
239
+ bounds: {
240
+ type: PropType<{
241
+ left?: number;
242
+ right?: number;
243
+ top?: number;
244
+ bottom?: number;
245
+ }>;
246
+ default: undefined;
247
+ };
248
+ snapBack: {
249
+ type: BooleanConstructor;
250
+ default: boolean;
251
+ };
252
+ momentum: {
253
+ type: BooleanConstructor;
254
+ default: undefined;
255
+ };
256
+ }>> & Readonly<{
257
+ onDragStart?: ((...args: any[]) => any) | undefined;
258
+ onDragEnd?: ((...args: any[]) => any) | undefined;
259
+ }>, {
260
+ axis: "y" | "x" | "both";
261
+ bounds: {
262
+ left?: number;
263
+ right?: number;
264
+ top?: number;
265
+ bottom?: number;
266
+ };
267
+ snapBack: boolean;
268
+ momentum: boolean;
269
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
270
+
271
+ /**
272
+ * Text filled with a perceptual gradient.
273
+ *
274
+ * The stops are generated through the OKLab interpolator rather than handed to CSS as two
275
+ * endpoints. That is the entire point: a CSS `linear-gradient(#0275f4, #9f0550)` passes through a
276
+ * desaturated grey-brown at its midpoint, and on text — where the gradient crosses a narrow band —
277
+ * the midpoint is exactly where the eye lands.
278
+ *
279
+ * The optional animation is a CSS `background-position` shift rather than a JS loop, because for a
280
+ * single non-interactive property the browser's compositor beats anything we could do on the main
281
+ * thread.
282
+ */
283
+ declare const GradientText: vue.DefineComponent<vue.ExtractPropTypes<{
284
+ text: {
285
+ type: StringConstructor;
286
+ default: string;
287
+ };
288
+ colors: {
289
+ type: PropType<readonly ColorInput[] | string>;
290
+ default: undefined;
291
+ };
292
+ /** Gradient angle in degrees. */
293
+ angle: {
294
+ type: NumberConstructor;
295
+ default: number;
296
+ };
297
+ /** Seconds per cycle. `0` holds a static gradient. */
298
+ duration: {
299
+ type: NumberConstructor;
300
+ default: number;
301
+ };
302
+ /** Interpolated stops handed to CSS. More is smoother. */
303
+ stops: {
304
+ type: NumberConstructor;
305
+ default: number;
306
+ };
307
+ as: {
308
+ type: StringConstructor;
309
+ default: string;
310
+ };
311
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
312
+ [key: string]: any;
313
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
314
+ text: {
315
+ type: StringConstructor;
316
+ default: string;
317
+ };
318
+ colors: {
319
+ type: PropType<readonly ColorInput[] | string>;
320
+ default: undefined;
321
+ };
322
+ /** Gradient angle in degrees. */
323
+ angle: {
324
+ type: NumberConstructor;
325
+ default: number;
326
+ };
327
+ /** Seconds per cycle. `0` holds a static gradient. */
328
+ duration: {
329
+ type: NumberConstructor;
330
+ default: number;
331
+ };
332
+ /** Interpolated stops handed to CSS. More is smoother. */
333
+ stops: {
334
+ type: NumberConstructor;
335
+ default: number;
336
+ };
337
+ as: {
338
+ type: StringConstructor;
339
+ default: string;
340
+ };
341
+ }>> & Readonly<{}>, {
342
+ as: string;
343
+ colors: string | readonly ColorInput[];
344
+ angle: number;
345
+ stops: number;
346
+ duration: number;
347
+ text: string;
348
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
349
+ /**
350
+ * Text that reveals unit by unit.
351
+ *
352
+ * The split happens during render, so the markup is server-rendered and the real text is present in
353
+ * the HTML source for SEO and for readers without JavaScript. The animation runs on the shared
354
+ * ticker, so a page full of these shares one clock and cannot drift apart.
355
+ *
356
+ * Under `prefers-reduced-motion` the text renders in its final state and never animates.
357
+ */
358
+ declare const AnimatedText: vue.DefineComponent<vue.ExtractPropTypes<{
359
+ text: {
360
+ type: StringConstructor;
361
+ required: true;
362
+ };
363
+ /** Split granularity. */
364
+ by: {
365
+ type: PropType<"chars" | "words">;
366
+ default: string;
367
+ };
368
+ /** Seconds per unit. */
369
+ duration: {
370
+ type: NumberConstructor;
371
+ default: number;
372
+ };
373
+ /** Seconds between units. */
374
+ each: {
375
+ type: NumberConstructor;
376
+ default: number;
377
+ };
378
+ /** Where the reveal wave begins. */
379
+ from: {
380
+ type: PropType<StaggerFrom>;
381
+ default: string;
382
+ };
383
+ easing: {
384
+ type: PropType<EasingInput>;
385
+ default: string;
386
+ };
387
+ /** Distance each unit travels into place, in pixels. */
388
+ distance: {
389
+ type: NumberConstructor;
390
+ default: number;
391
+ };
392
+ /** Starting blur in pixels — the "focus in" look. */
393
+ blur: {
394
+ type: NumberConstructor;
395
+ default: number;
396
+ };
397
+ /** Starting rotation in degrees. */
398
+ rotate: {
399
+ type: NumberConstructor;
400
+ default: number;
401
+ };
402
+ /** Clip each unit so it rises from behind a mask. */
403
+ mask: {
404
+ type: BooleanConstructor;
405
+ default: boolean;
406
+ };
407
+ /** Wait until scrolled into view. */
408
+ whenInView: {
409
+ type: BooleanConstructor;
410
+ default: boolean;
411
+ };
412
+ /** Replay every time it re-enters the viewport. */
413
+ repeat: {
414
+ type: BooleanConstructor;
415
+ default: boolean;
416
+ };
417
+ /** Seconds to wait before starting. */
418
+ delay: {
419
+ type: NumberConstructor;
420
+ default: number;
421
+ };
422
+ as: {
423
+ type: StringConstructor;
424
+ default: string;
425
+ };
426
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
427
+ [key: string]: any;
428
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "complete"[], "complete", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
429
+ text: {
430
+ type: StringConstructor;
431
+ required: true;
432
+ };
433
+ /** Split granularity. */
434
+ by: {
435
+ type: PropType<"chars" | "words">;
436
+ default: string;
437
+ };
438
+ /** Seconds per unit. */
439
+ duration: {
440
+ type: NumberConstructor;
441
+ default: number;
442
+ };
443
+ /** Seconds between units. */
444
+ each: {
445
+ type: NumberConstructor;
446
+ default: number;
447
+ };
448
+ /** Where the reveal wave begins. */
449
+ from: {
450
+ type: PropType<StaggerFrom>;
451
+ default: string;
452
+ };
453
+ easing: {
454
+ type: PropType<EasingInput>;
455
+ default: string;
456
+ };
457
+ /** Distance each unit travels into place, in pixels. */
458
+ distance: {
459
+ type: NumberConstructor;
460
+ default: number;
461
+ };
462
+ /** Starting blur in pixels — the "focus in" look. */
463
+ blur: {
464
+ type: NumberConstructor;
465
+ default: number;
466
+ };
467
+ /** Starting rotation in degrees. */
468
+ rotate: {
469
+ type: NumberConstructor;
470
+ default: number;
471
+ };
472
+ /** Clip each unit so it rises from behind a mask. */
473
+ mask: {
474
+ type: BooleanConstructor;
475
+ default: boolean;
476
+ };
477
+ /** Wait until scrolled into view. */
478
+ whenInView: {
479
+ type: BooleanConstructor;
480
+ default: boolean;
481
+ };
482
+ /** Replay every time it re-enters the viewport. */
483
+ repeat: {
484
+ type: BooleanConstructor;
485
+ default: boolean;
486
+ };
487
+ /** Seconds to wait before starting. */
488
+ delay: {
489
+ type: NumberConstructor;
490
+ default: number;
491
+ };
492
+ as: {
493
+ type: StringConstructor;
494
+ default: string;
495
+ };
496
+ }>> & Readonly<{
497
+ onComplete?: ((...args: any[]) => any) | undefined;
498
+ }>, {
499
+ repeat: boolean;
500
+ as: string;
501
+ blur: number;
502
+ rotate: number;
503
+ duration: number;
504
+ easing: EasingInput;
505
+ distance: number;
506
+ delay: number;
507
+ by: "chars" | "words";
508
+ each: number;
509
+ from: StaggerFrom;
510
+ mask: boolean;
511
+ whenInView: boolean;
512
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
513
+
514
+ /**
515
+ * Application-level configuration providers — the Vue counterpart of `@ansh-ui/react`'s
516
+ * `providers.tsx`. `provide`/`inject` replace React context; everything else about the two designs
517
+ * is intentionally identical, because the underlying correctness constraints (no hydration
518
+ * mismatch, no theme flash) don't change with the framework.
519
+ */
520
+ interface MotionConfigValue {
521
+ reducedMotion: ReducedMotionMode;
522
+ /** Global playback rate. `0.5` is slow motion across every animation on the page. */
523
+ timeScale: number;
524
+ /** Pin adaptive quality, or `null` to let the frame budget decide. */
525
+ quality: number | null;
526
+ }
527
+ /**
528
+ * Application-level motion configuration.
529
+ *
530
+ * Optional — every component works without it. Mount it once at the root when you need app-wide
531
+ * control:
532
+ *
533
+ * ```vue
534
+ * <MotionConfig :reduced-motion="userPrefersCalm ? 'always' : 'auto'">
535
+ * <App />
536
+ * </MotionConfig>
537
+ * ```
538
+ *
539
+ * `reducedMotion="always"` is genuinely useful in production, as the backing for an in-app "reduce
540
+ * motion" setting — many users who want calmer interfaces have never found the OS toggle.
541
+ */
542
+ declare const MotionConfig: vue.DefineComponent<vue.ExtractPropTypes<{
543
+ reducedMotion: {
544
+ type: PropType<ReducedMotionMode>;
545
+ default: string;
546
+ };
547
+ timeScale: {
548
+ type: NumberConstructor;
549
+ default: number;
550
+ };
551
+ quality: {
552
+ type: PropType<number | null>;
553
+ default: null;
554
+ };
555
+ /**
556
+ * Pause every animation while the document is hidden. Default `true`.
557
+ *
558
+ * Leave this on. Animating a background tab burns battery and spins fans for output nobody can
559
+ * see, and it is the most common performance complaint about animation-heavy sites.
560
+ */
561
+ pauseWhenHidden: {
562
+ type: BooleanConstructor;
563
+ default: boolean;
564
+ };
565
+ pauseWhenBlurred: {
566
+ type: BooleanConstructor;
567
+ default: boolean;
568
+ };
569
+ respectBattery: {
570
+ type: BooleanConstructor;
571
+ default: boolean;
572
+ };
573
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
574
+ [key: string]: any;
575
+ }>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
576
+ reducedMotion: {
577
+ type: PropType<ReducedMotionMode>;
578
+ default: string;
579
+ };
580
+ timeScale: {
581
+ type: NumberConstructor;
582
+ default: number;
583
+ };
584
+ quality: {
585
+ type: PropType<number | null>;
586
+ default: null;
587
+ };
588
+ /**
589
+ * Pause every animation while the document is hidden. Default `true`.
590
+ *
591
+ * Leave this on. Animating a background tab burns battery and spins fans for output nobody can
592
+ * see, and it is the most common performance complaint about animation-heavy sites.
593
+ */
594
+ pauseWhenHidden: {
595
+ type: BooleanConstructor;
596
+ default: boolean;
597
+ };
598
+ pauseWhenBlurred: {
599
+ type: BooleanConstructor;
600
+ default: boolean;
601
+ };
602
+ respectBattery: {
603
+ type: BooleanConstructor;
604
+ default: boolean;
605
+ };
606
+ }>> & Readonly<{}>, {
607
+ quality: number | null;
608
+ reducedMotion: ReducedMotionMode;
609
+ timeScale: number;
610
+ pauseWhenHidden: boolean;
611
+ pauseWhenBlurred: boolean;
612
+ respectBattery: boolean;
613
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
614
+ /** Read the nearest {@link MotionConfig}. Returns sensible defaults with no provider present. */
615
+ declare function useMotionConfig(): ComputedRef<MotionConfigValue>;
616
+ type ThemeSetting = 'light' | 'dark' | 'system';
617
+ interface ThemeContextValue {
618
+ /** What was requested, including `'system'`. */
619
+ theme: ThemeSetting;
620
+ /** What is actually rendering. `'system'` is resolved to one or the other. */
621
+ resolved: 'light' | 'dark';
622
+ setTheme: (theme: ThemeSetting) => void;
623
+ }
624
+ /**
625
+ * Theme control over the `@ansh-ui/tokens` stylesheet.
626
+ *
627
+ * Sets `data-theme` on `<html>`, which the token stylesheet already understands. Two details that
628
+ * are easy to get wrong and are handled here:
629
+ *
630
+ * **`'system'` removes the attribute rather than writing a resolved value.** The token stylesheet
631
+ * guards its `prefers-color-scheme` rule with `:root:not([data-theme])`, so removing the attribute
632
+ * hands control back to the OS — and, importantly, means the theme keeps following the OS if the
633
+ * user changes it while the page is open.
634
+ *
635
+ * **The initial render always reports `'light'`.** Reading `localStorage` during setup would be a
636
+ * hydration mismatch, since the server has no access to it. The stored value is applied `onMounted`.
637
+ * To avoid a flash of the wrong theme, ship the small inline script from {@link themeScript} in your
638
+ * document `<head>` — that is the only way to set the attribute before first paint. `@ansh-ui/nuxt`
639
+ * does this automatically.
640
+ */
641
+ declare const ThemeProvider: vue.DefineComponent<vue.ExtractPropTypes<{
642
+ /** Initial setting. Default `'system'`. */
643
+ defaultTheme: {
644
+ type: PropType<ThemeSetting>;
645
+ default: string;
646
+ };
647
+ /** Persist the choice under this `localStorage` key. Pass `null` to disable. */
648
+ storageKey: {
649
+ type: PropType<string | null>;
650
+ default: string;
651
+ };
652
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
653
+ [key: string]: any;
654
+ }>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
655
+ /** Initial setting. Default `'system'`. */
656
+ defaultTheme: {
657
+ type: PropType<ThemeSetting>;
658
+ default: string;
659
+ };
660
+ /** Persist the choice under this `localStorage` key. Pass `null` to disable. */
661
+ storageKey: {
662
+ type: PropType<string | null>;
663
+ default: string;
664
+ };
665
+ }>> & Readonly<{}>, {
666
+ defaultTheme: ThemeSetting;
667
+ storageKey: string | null;
668
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
669
+ declare function useTheme(): ComputedRef<ThemeContextValue>;
670
+ /**
671
+ * The blocking script that prevents a theme flash.
672
+ *
673
+ * Inject this in `<head>`, before any stylesheet. It reads the stored preference and sets
674
+ * `data-theme` synchronously, before the browser paints — the only point at which it can be done
675
+ * without a visible flash. Deliberately tiny and dependency-free.
676
+ *
677
+ * `@ansh-ui/nuxt` injects this automatically; a bare Vue app should call it from `index.html`.
678
+ */
679
+ declare function themeScript(storageKey?: string): string;
680
+
681
+ export { AnimatePresence, type AnimatePresenceProps, AnimatedText, Draggable, type DraggableProps, GradientText, Motion, MotionConfig, type MotionConfigValue, type MotionTransition, type MotionValues, type ThemeContextValue, ThemeProvider, type ThemeSetting, themeScript, useMotionConfig, useTheme };
package/dist/motion.js ADDED
@@ -0,0 +1,5 @@
1
+ export { AnimatePresence, AnimatedText, Draggable, GradientText, Motion, MotionConfig, ThemeProvider, themeScript, useMotionConfig, useTheme } from './chunk-6ABPGOJP.js';
2
+ import './chunk-EVO23GUS.js';
3
+ import './chunk-NJDDNO4C.js';
4
+ //# sourceMappingURL=motion.js.map
5
+ //# sourceMappingURL=motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"motion.js"}