coily 0.14.0 → 0.16.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.
- package/README.md +133 -51
- package/dist/config-B8M2xp26.d.ts +295 -0
- package/dist/css.d.ts +203 -0
- package/dist/css.js +318 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +99 -53
- package/dist/nuxt.d.ts +24 -15
- package/dist/nuxt.js +16 -5
- package/dist/solver-CAXuxdKj.js +243 -0
- package/dist/system-C7PbI4L0.d.ts +1213 -0
- package/dist/system-WejqGkfv.js +2920 -0
- package/dist/vue.d.ts +224 -128
- package/dist/vue.js +161 -41
- package/package.json +2 -1
- package/dist/system-BXxAHM2a.js +0 -1758
- package/dist/system-Ci-R4RaI.d.ts +0 -1032
package/dist/vue.d.ts
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as SpringDefinitionOptions, t as SpringDefinition } from "./config-B8M2xp26.js";
|
|
2
|
+
import { O as SpringSource, _ as Spring, c as CompositeSpring, d as PartialShape, g as Purpose, i as SpringSystemOptions, m as Shape, n as SpringOptions, p as ReadonlyShape, r as SpringSystem, t as CompositeSpringOptions, u as ConfigShape, x as TargetedSource } from "./system-C7PbI4L0.js";
|
|
3
|
+
import { App, MaybeRef, MaybeRefOrGetter, Ref, SlotsType } from "vue";
|
|
3
4
|
//#region src/vue/reactive-spring.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* Config for a scalar `useSpring`: a `SpringDefinition`, any option shape
|
|
6
|
-
* `defineSpring` accepts, or a ref
|
|
7
|
-
* reconfigures the spring in place
|
|
8
|
-
* default config.
|
|
7
|
+
* `defineSpring` accepts, or a ref or getter of either. A changed
|
|
8
|
+
* reactive config reconfigures the spring in place. `undefined` means
|
|
9
|
+
* the default config.
|
|
9
10
|
*/
|
|
10
11
|
type UseSpringConfig = MaybeRefOrGetter<SpringDefinitionOptions | SpringDefinition | undefined>;
|
|
11
12
|
/**
|
|
12
|
-
* The
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* Writing the main ref displaces the spring — it springs back toward its
|
|
17
|
-
* target. To move the spring, drive the target you passed to
|
|
13
|
+
* The ref `useSpring` returns: a writable ref of the animated value, with
|
|
14
|
+
* the rest of the spring attached. It triggers once per frame while the
|
|
15
|
+
* spring moves. Writing it displaces the spring, which springs back
|
|
16
|
+
* toward its target. To move the spring, change the target passed to
|
|
18
17
|
* `useSpring`.
|
|
19
18
|
*
|
|
20
|
-
* The ref is
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* independent of the leader's animation.
|
|
19
|
+
* The ref is a `TargetedSource`, so another `useSpring` can follow it,
|
|
20
|
+
* and `velocityOf`, `accelerationOf`, and `targetOf` accept it. A scalar
|
|
21
|
+
* ref also works as a `mapSpring` leaf or a composite channel target.
|
|
22
|
+
* Followers read the backing spring directly, so following never adds a
|
|
23
|
+
* Vue dependency, even inside an effect that moves the leader.
|
|
26
24
|
*/
|
|
27
|
-
interface ReactiveSpringRef<V, W = V> extends Ref<V, W>,
|
|
25
|
+
interface ReactiveSpringRef<V, W = V> extends Ref<V, W>, TargetedSource<V> {
|
|
28
26
|
/**
|
|
29
27
|
* The current velocity in value units per second, as a writable ref.
|
|
30
|
-
* Writing flings the spring
|
|
28
|
+
* Writing flings the spring, and it settles back to its target.
|
|
31
29
|
*/
|
|
32
30
|
readonly velocity: Ref<V, W>;
|
|
33
31
|
/**
|
|
@@ -38,67 +36,71 @@ interface ReactiveSpringRef<V, W = V> extends Ref<V, W>, SpringSource<V> {
|
|
|
38
36
|
/** Whether the spring is resting, as a reactive ref. Writes are ignored. */
|
|
39
37
|
readonly isResting: Ref<boolean>;
|
|
40
38
|
/**
|
|
41
|
-
* A promise that resolves when the spring next comes to rest
|
|
42
|
-
* resolved while
|
|
43
|
-
* disposal resolves it.
|
|
39
|
+
* A promise that resolves when the spring next comes to rest. It is
|
|
40
|
+
* already resolved while the spring rests. A retarget mid-flight
|
|
41
|
+
* extends the wait, and disposal resolves it.
|
|
44
42
|
*/
|
|
45
43
|
readonly settled: Promise<void>;
|
|
46
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Snaps the spring to `value` with no animation, target included. The
|
|
46
|
+
* spring rests there until the target you passed to `useSpring`
|
|
47
|
+
* changes, or until a leader it follows moves.
|
|
48
|
+
*/
|
|
47
49
|
readonly jumpTo: (value: W) => void;
|
|
48
50
|
}
|
|
49
51
|
//#endregion
|
|
50
52
|
//#region src/vue/composite-spring.d.ts
|
|
51
53
|
/**
|
|
52
|
-
* Config for an object `useSpring`: a `ConfigShape
|
|
53
|
-
*
|
|
54
|
-
*
|
|
54
|
+
* Config for an object `useSpring`: a `ConfigShape`, or a ref or getter
|
|
55
|
+
* of one. A `ConfigShape` is one `SpringDefinition` for every channel,
|
|
56
|
+
* `null` for the default, or a shape with configs at any level. A
|
|
57
|
+
* changed reactive config reconfigures the channels in place.
|
|
55
58
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
+
* Each config position takes only a `SpringDefinition` from
|
|
60
|
+
* `defineSpring`. A plain object reads as a nested level of the shape,
|
|
61
|
+
* never as spring options.
|
|
59
62
|
*/
|
|
60
63
|
type UseCompositeSpringConfig<T extends object> = MaybeRefOrGetter<ConfigShape<T> | undefined>;
|
|
61
64
|
/**
|
|
62
|
-
* The
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
65
|
+
* The ref an object `useSpring` returns. Reads return the deep-readonly
|
|
66
|
+
* composite value, and writes accept partial shapes. It carries
|
|
67
|
+
* `velocity`, `timeRemaining`, and `isResting` refs plus `settled` and
|
|
68
|
+
* `jumpTo`. Writing it displaces the named channels, which spring back.
|
|
69
|
+
* To move them, change the target passed to `useSpring`.
|
|
67
70
|
*/
|
|
68
71
|
interface CompositeSpringRef<T extends object> extends ReactiveSpringRef<ReadonlyShape<T>, PartialShape<T>> {}
|
|
69
72
|
//#endregion
|
|
70
73
|
//#region src/vue/spring.d.ts
|
|
71
74
|
/**
|
|
72
|
-
* The
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
75
|
+
* The writable ref a scalar `useSpring` returns, carrying `velocity`,
|
|
76
|
+
* `timeRemaining`, and `isResting` refs plus `settled` and `jumpTo`.
|
|
77
|
+
* Writing it displaces the spring, which springs back. To move it,
|
|
78
|
+
* change the target passed to `useSpring`.
|
|
76
79
|
*/
|
|
77
80
|
interface SpringRef extends ReactiveSpringRef<number> {}
|
|
78
81
|
/**
|
|
79
|
-
* Creates a scalar spring and returns it as a `SpringRef`. The target
|
|
80
|
-
*
|
|
81
|
-
* `useSpring` ref, a `mapSpring` result, a pooled `Spring`
|
|
82
|
-
*
|
|
83
|
-
* they change, momentum intact; a getter of a source re-follows when its
|
|
84
|
-
* own dependencies change, so `useSpring(() => (split.value ? left :
|
|
85
|
-
* right))` switches leaders live. Reactive `config` reconfigures the
|
|
86
|
-
* spring in place; while following, it configures the follower's own
|
|
87
|
-
* motion — the leader's config plays no part.
|
|
82
|
+
* Creates a scalar spring and returns it as a `SpringRef`. The target is
|
|
83
|
+
* a number to animate toward or a `SpringSource` to follow (another
|
|
84
|
+
* `useSpring` ref, a `mapSpring` result, or a pooled `Spring`), or a ref
|
|
85
|
+
* or getter of either.
|
|
88
86
|
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
87
|
+
* A changed reactive number retargets the spring, which keeps its
|
|
88
|
+
* momentum. A getter of a source re-follows when its own dependencies
|
|
89
|
+
* change, so `useSpring(() => (split.value ? left : right))` switches
|
|
90
|
+
* leaders mid-flight. A changed reactive `config` reconfigures the
|
|
91
|
+
* spring in place. While following, the spring uses its own `config`,
|
|
92
|
+
* never the leader's.
|
|
92
93
|
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* is disposed with the component's scope, and composables are loop-safe:
|
|
96
|
-
* map over targets for several independent springs.
|
|
94
|
+
* The spring subscribes to a followed source directly, so no effect or
|
|
95
|
+
* getter gains a dependency on the leader's animation.
|
|
97
96
|
*
|
|
98
|
-
* `
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
97
|
+
* Call it during `setup()` below a provided spring system (the coily/nuxt
|
|
98
|
+
* module, or `useSpringSystem()` in an ancestor). It throws without one.
|
|
99
|
+
* The spring is disposed with the component's scope.
|
|
100
|
+
*
|
|
101
|
+
* `options.purpose` is read once, at creation. Under reduced motion, a
|
|
102
|
+
* `'motion'` spring, the default, snaps. A `'nonmotion'` spring, such as
|
|
103
|
+
* a cross-fade or a color, keeps animating.
|
|
102
104
|
*
|
|
103
105
|
* @example
|
|
104
106
|
* ```ts
|
|
@@ -106,63 +108,155 @@ interface SpringRef extends ReactiveSpringRef<number> {}
|
|
|
106
108
|
* const x = useSpring(target, { duration: 500, bounce: 0.3 })
|
|
107
109
|
* // template: <div :style="{ translate: `${x}px 0` }" @click="target = 300" />
|
|
108
110
|
*
|
|
109
|
-
* const
|
|
111
|
+
* const shown = ref(false)
|
|
112
|
+
* const opacity = useSpring(() => (shown.value ? 1 : 0), undefined, { purpose: 'nonmotion' })
|
|
110
113
|
* ```
|
|
111
114
|
*/
|
|
112
115
|
declare function useSpring(target: MaybeRefOrGetter<number | SpringSource>, config?: UseSpringConfig, options?: SpringOptions): SpringRef;
|
|
113
116
|
/**
|
|
114
|
-
* Creates a composite spring that follows
|
|
115
|
-
*
|
|
117
|
+
* Creates a composite spring that follows a leader channel by channel,
|
|
118
|
+
* animating toward its live values. The leader is an object `useSpring`
|
|
119
|
+
* ref or a pooled `CompositeSpring` of the same shape. A ref of a
|
|
120
|
+
* leader, such as a `computed`, works too, and the spring follows each
|
|
121
|
+
* new leader the ref holds.
|
|
116
122
|
*
|
|
117
|
-
* Call it during `setup()` below a provided spring system.
|
|
118
|
-
* are disposed with the component's scope.
|
|
123
|
+
* Call it during `setup()` below a provided spring system. It throws
|
|
124
|
+
* without one. The springs are disposed with the component's scope.
|
|
119
125
|
*/
|
|
120
|
-
declare function useSpring<T extends object>(target: CompositeSpringRef<T
|
|
126
|
+
declare function useSpring<T extends object>(target: MaybeRef<CompositeSpringRef<T> | CompositeSpring<T>>, config?: UseCompositeSpringConfig<T>, options?: CompositeSpringOptions<T>): CompositeSpringRef<T>;
|
|
121
127
|
/**
|
|
122
|
-
* Creates a composite spring over a numeric shape
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
128
|
+
* Creates a composite spring over a numeric shape and returns a
|
|
129
|
+
* `CompositeSpringRef`. The shape is a plain object or array whose
|
|
130
|
+
* leaves are all numbers, or a ref or getter of one, and it is fixed at
|
|
131
|
+
* creation. Reads return the deep-readonly value, and writes take
|
|
132
|
+
* partial shapes.
|
|
133
|
+
*
|
|
134
|
+
* A reactive target retargets the channels, which keep their momentum.
|
|
135
|
+
* A ref retargets when you replace its value or mutate a nested channel.
|
|
136
|
+
* `config` takes a per-channel config shape and may be reactive.
|
|
130
137
|
*
|
|
131
|
-
* Call it during `setup()` below a provided spring system.
|
|
132
|
-
* are disposed with the component's scope.
|
|
138
|
+
* Call it during `setup()` below a provided spring system. It throws
|
|
139
|
+
* without one. The springs are disposed with the component's scope.
|
|
133
140
|
*
|
|
134
|
-
* `options.purpose`
|
|
135
|
-
* `Purpose` for all, or a shape
|
|
136
|
-
*
|
|
141
|
+
* `options.purpose` sets reduced-motion behavior per channel: one
|
|
142
|
+
* `Purpose` for all channels, or a shape that mirrors the value. It is
|
|
143
|
+
* read once, at creation.
|
|
137
144
|
*/
|
|
138
145
|
declare function useSpring<T extends object>(target: MaybeRefOrGetter<T & Shape<T>>, config?: UseCompositeSpringConfig<T>, options?: CompositeSpringOptions<T>): CompositeSpringRef<T>;
|
|
139
146
|
/**
|
|
140
|
-
* Creates a composite spring driven by a getter
|
|
141
|
-
*
|
|
142
|
-
*
|
|
147
|
+
* Creates a composite spring driven by a getter that returns a numeric
|
|
148
|
+
* shape to animate toward, or a leader to follow (an object `useSpring`
|
|
149
|
+
* ref or a pooled `CompositeSpring`). When the getter's dependencies
|
|
150
|
+
* change, the spring retargets or follows the new leader, so
|
|
151
|
+
* `useSpring(() => (split.value ? left : right))` switches leaders
|
|
152
|
+
* mid-flight. Every shape and leader must match the spring's shape,
|
|
153
|
+
* which is fixed at creation.
|
|
154
|
+
*
|
|
155
|
+
* Call it during `setup()` below a provided spring system. It throws
|
|
156
|
+
* without one. The springs are disposed with the component's scope.
|
|
157
|
+
*/
|
|
158
|
+
declare function useSpring<T extends object>(target: () => (T & Shape<T>) | CompositeSpringRef<T> | CompositeSpring<T>, config?: UseCompositeSpringConfig<T>, options?: CompositeSpringOptions<T>): CompositeSpringRef<T>;
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/vue/ramp.d.ts
|
|
161
|
+
/** Options for `useRamp`, read once at creation. */
|
|
162
|
+
interface UseRampOptions {
|
|
163
|
+
/**
|
|
164
|
+
* The value the ramp starts from. Must be finite, so it is required
|
|
165
|
+
* when the initial target is infinite.
|
|
166
|
+
* @default the initial target, so the ramp starts at rest
|
|
167
|
+
*/
|
|
168
|
+
from?: number | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* What the ramp drives. Under reduced motion, a `'motion'` ramp jumps
|
|
171
|
+
* to a bounded target and holds still on an endless one. A
|
|
172
|
+
* `'nonmotion'` ramp keeps moving. See `Purpose`.
|
|
173
|
+
* @default 'motion'
|
|
174
|
+
*/
|
|
175
|
+
purpose?: Purpose | undefined;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The writable ref `useRamp` returns, carrying `velocity`,
|
|
179
|
+
* `timeRemaining`, and `isResting` refs plus `settled` and `jumpTo`.
|
|
180
|
+
* Writing it places the ramp at the written value, and the ramp
|
|
181
|
+
* continues toward its target from there.
|
|
182
|
+
*
|
|
183
|
+
* Reading any of the refs puts the ramp in the frame loop, and it leaves
|
|
184
|
+
* when reads stop. In a rendering template it updates every frame. Read
|
|
185
|
+
* only in an event handler, it stays in the loop for about two frames
|
|
186
|
+
* after each read. Unread, it still moves, and the next read returns its
|
|
187
|
+
* current value.
|
|
188
|
+
*
|
|
189
|
+
* The ref is a `TargetedSource`, so `useSpring` can follow it, and
|
|
190
|
+
* `velocityOf` and `targetOf` accept it. Followers subscribe to the
|
|
191
|
+
* ramp directly, so following never depends on reads of the ref.
|
|
192
|
+
*/
|
|
193
|
+
interface RampRef extends Ref<number>, TargetedSource<number> {
|
|
194
|
+
/**
|
|
195
|
+
* The current velocity in value units per second, as a reactive ref.
|
|
196
|
+
* It is `rate` with the sign of the direction to the target while the
|
|
197
|
+
* ramp moves, and 0 at rest. Writes are ignored.
|
|
198
|
+
*/
|
|
199
|
+
readonly velocity: Ref<number>;
|
|
200
|
+
/**
|
|
201
|
+
* Milliseconds until the ramp reaches its target, as a reactive ref. It
|
|
202
|
+
* is 0 at rest and `Infinity` toward an infinite target. Writes are
|
|
203
|
+
* ignored.
|
|
204
|
+
*/
|
|
205
|
+
readonly timeRemaining: Ref<number>;
|
|
206
|
+
/** Whether the ramp is at rest, as a reactive ref. Writes are ignored. */
|
|
207
|
+
readonly isResting: Ref<boolean>;
|
|
208
|
+
/**
|
|
209
|
+
* A promise that resolves when the ramp next comes to rest. It is
|
|
210
|
+
* already resolved while the ramp rests. While the promise is pending,
|
|
211
|
+
* a bounded ramp stays in the frame loop until it arrives.
|
|
212
|
+
*/
|
|
213
|
+
readonly settled: Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Places the ramp at `value` and rests it there, target included, until
|
|
216
|
+
* the `target` passed to `useRamp` next changes.
|
|
217
|
+
*/
|
|
218
|
+
readonly jumpTo: (value: number) => void;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Creates a ramp and returns it as a `RampRef`. A ramp moves toward
|
|
222
|
+
* `target` in a straight line at `rate` value units per second, and
|
|
223
|
+
* stops there. A target of `Infinity` or `-Infinity` makes it endless.
|
|
224
|
+
* A spring following the ref with the default `arrival` tracks its
|
|
225
|
+
* steady motion exactly, with no frame-to-frame steps. On an endless
|
|
226
|
+
* ramp, that spring lags behind like a heavy spinning object.
|
|
227
|
+
*
|
|
228
|
+
* A new `target` sends the ramp there from its current value. A new
|
|
229
|
+
* `rate` applies from the current value on.
|
|
143
230
|
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
231
|
+
* Call it during `setup()` below a provided spring system (the coily/nuxt
|
|
232
|
+
* module, or `useSpringSystem()` in an ancestor). It throws without one.
|
|
233
|
+
* The ramp is disposed with the component's scope.
|
|
147
234
|
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* const angle = useRamp(Infinity, 270, { from: 0 })
|
|
238
|
+
* const ring = useSpring(angle, { duration: 300, dampingRatio: 1 })
|
|
239
|
+
* // template: <div :style="{ rotate: `${ring}deg` }" />
|
|
240
|
+
*
|
|
241
|
+
* const heading = ref(0)
|
|
242
|
+
* const slew = useRamp(heading, 400) // turns toward heading at 400 deg/s
|
|
243
|
+
* ```
|
|
150
244
|
*/
|
|
151
|
-
declare function
|
|
245
|
+
declare function useRamp(target: MaybeRefOrGetter<number>, rate: MaybeRefOrGetter<number>, options?: UseRampOptions): RampRef;
|
|
152
246
|
//#endregion
|
|
153
247
|
//#region src/vue/pool.d.ts
|
|
154
248
|
/**
|
|
155
|
-
* Imperative spring factories bound to the provided system, for
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* before that is fine.
|
|
249
|
+
* Imperative spring factories bound to the provided system, for springs
|
|
250
|
+
* you create and dispose at any time, such as particles or per-item
|
|
251
|
+
* effects. When the creating scope stops, the pool disposes every pooled
|
|
252
|
+
* spring still alive. You can dispose one yourself before then.
|
|
160
253
|
*/
|
|
161
254
|
interface SpringPool {
|
|
162
255
|
/**
|
|
163
256
|
* Creates a pooled spring at rest at `value`. Without `config`, the
|
|
164
|
-
* default
|
|
165
|
-
* `'
|
|
257
|
+
* spring uses the default config. `options.purpose` sets reduced-motion
|
|
258
|
+
* behavior: a `'nonmotion'` spring keeps animating, and a `'motion'`
|
|
259
|
+
* spring, the default, snaps.
|
|
166
260
|
*/
|
|
167
261
|
createSpring(value: number, config?: SpringDefinition, options?: SpringOptions): Spring;
|
|
168
262
|
/**
|
|
@@ -171,39 +265,38 @@ interface SpringPool {
|
|
|
171
265
|
*/
|
|
172
266
|
createSpring(source: SpringSource, config?: SpringDefinition, options?: SpringOptions): Spring;
|
|
173
267
|
/**
|
|
174
|
-
* Creates a pooled composite spring over a
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
* reduced-motion behavior per channel the same way.
|
|
268
|
+
* Creates a pooled composite spring over a shape whose leaves are all
|
|
269
|
+
* numbers. `config` applies per channel: one `SpringDefinition` for all
|
|
270
|
+
* channels, or a shape with configs at any level. `options.purpose` sets
|
|
271
|
+
* reduced-motion behavior per channel in the same way.
|
|
178
272
|
*/
|
|
179
273
|
createSpring<T extends object>(value: T & Shape<T>, config?: ConfigShape<T>, options?: CompositeSpringOptions<T>): CompositeSpring<T>;
|
|
180
274
|
}
|
|
181
275
|
/**
|
|
182
|
-
* Returns spring factories bound to the provided spring system
|
|
183
|
-
*
|
|
184
|
-
* alive
|
|
185
|
-
* structurally impossible.
|
|
276
|
+
* Returns spring factories bound to the provided spring system. When
|
|
277
|
+
* the current effect scope stops, the pool disposes every pooled spring
|
|
278
|
+
* still alive.
|
|
186
279
|
*
|
|
187
|
-
* Call it during `setup()`
|
|
188
|
-
*
|
|
189
|
-
*
|
|
280
|
+
* Call it during `setup()` or inside an effect scope, below a provided
|
|
281
|
+
* spring system. It throws without one. Outside a scope, you must
|
|
282
|
+
* dispose each pooled spring yourself.
|
|
190
283
|
*/
|
|
191
284
|
declare function useSpringPool(): SpringPool;
|
|
192
285
|
//#endregion
|
|
193
286
|
//#region src/vue/component.d.ts
|
|
194
287
|
interface SpringValueProps {
|
|
195
|
-
/** The value to animate toward.
|
|
288
|
+
/** The value to animate toward. A new value retargets the spring and keeps its momentum. */
|
|
196
289
|
target: number;
|
|
197
290
|
/**
|
|
198
291
|
* Spring config: a `SpringDefinition` or any option shape `defineSpring`
|
|
199
|
-
* accepts.
|
|
200
|
-
* the default.
|
|
292
|
+
* accepts. A new config reconfigures the spring in place. Without it,
|
|
293
|
+
* the spring uses the default config.
|
|
201
294
|
*/
|
|
202
295
|
config?: SpringDefinitionOptions | SpringDefinition;
|
|
203
296
|
/**
|
|
204
|
-
* What the spring animates
|
|
205
|
-
* `'
|
|
206
|
-
*
|
|
297
|
+
* What the spring animates. Under reduced motion, a `'motion'` spring
|
|
298
|
+
* snaps, and a `'nonmotion'` spring, such as a cross-fade or a color,
|
|
299
|
+
* keeps animating. Read once in `setup()`, so later changes are ignored.
|
|
207
300
|
* @default 'motion'
|
|
208
301
|
*/
|
|
209
302
|
purpose?: Purpose;
|
|
@@ -220,7 +313,10 @@ interface SpringValueSlotScope {
|
|
|
220
313
|
isResting: boolean;
|
|
221
314
|
/** Estimated milliseconds until the spring rests. */
|
|
222
315
|
timeRemaining: number;
|
|
223
|
-
/**
|
|
316
|
+
/**
|
|
317
|
+
* Snaps the spring to `value` with no animation, target included. The
|
|
318
|
+
* spring rests there until the `target` prop changes.
|
|
319
|
+
*/
|
|
224
320
|
jumpTo: (value: number) => void;
|
|
225
321
|
}
|
|
226
322
|
/** Slot types: `default` receives the live `SpringValueSlotScope`. */
|
|
@@ -228,13 +324,14 @@ type SpringValueSlots = SlotsType<{
|
|
|
228
324
|
default: SpringValueSlotScope;
|
|
229
325
|
}>;
|
|
230
326
|
/**
|
|
231
|
-
*
|
|
232
|
-
* slot
|
|
233
|
-
* provided spring system.
|
|
327
|
+
* A renderless component that passes one spring's state to its default
|
|
328
|
+
* slot: the template-only form of `useSpring`. It must render below a
|
|
329
|
+
* provided spring system, and throws otherwise. A template ref to it
|
|
330
|
+
* reads the same fields as the slot scope.
|
|
234
331
|
*
|
|
235
332
|
* @example
|
|
236
333
|
* ```vue
|
|
237
|
-
* <SpringValue :target="expanded ? 1 : 0" purpose="
|
|
334
|
+
* <SpringValue :target="expanded ? 1 : 0" purpose="nonmotion" v-slot="{ value }">
|
|
238
335
|
* <div :style="{ opacity: value }" />
|
|
239
336
|
* </SpringValue>
|
|
240
337
|
* ```
|
|
@@ -245,23 +342,22 @@ declare const SpringValue: import("vue").DefineSetupFnComponent<SpringValueProps
|
|
|
245
342
|
//#endregion
|
|
246
343
|
//#region src/vue/system.d.ts
|
|
247
344
|
/**
|
|
248
|
-
*
|
|
249
|
-
* starts or stops it. With `app`, the
|
|
250
|
-
*
|
|
251
|
-
* component
|
|
252
|
-
*
|
|
345
|
+
* Provides a spring system you create and manage yourself. Coily never
|
|
346
|
+
* starts or stops it. With `app`, the whole app gets it, as with the
|
|
347
|
+
* Nuxt module. Without `app`, call it in `setup()`, and it reaches the
|
|
348
|
+
* current component, including its own `useSpring` calls, and its
|
|
349
|
+
* descendants. Mostly useful in tests.
|
|
253
350
|
*/
|
|
254
351
|
declare function provideSpringSystem(system: SpringSystem, app?: App): void;
|
|
255
352
|
/**
|
|
256
|
-
* Returns the spring system
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
353
|
+
* Returns the spring system this component or an ancestor provides, or
|
|
354
|
+
* creates one. A created system is provided to this component and its
|
|
355
|
+
* descendants, starts when the component mounts, and is disposed before
|
|
356
|
+
* it unmounts.
|
|
260
357
|
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* Throws outside `setup()`.
|
|
358
|
+
* A call below a provider returns the provided system, and `options`
|
|
359
|
+
* applies only when the call creates one. Throws outside `setup()`.
|
|
264
360
|
*/
|
|
265
361
|
declare function useSpringSystem(options?: SpringSystemOptions): SpringSystem;
|
|
266
362
|
//#endregion
|
|
267
|
-
export { type CompositeSpringRef, type SpringPool, type SpringRef, SpringValue, type SpringValueProps, type SpringValueSlots, provideSpringSystem, useSpring, useSpringPool, useSpringSystem };
|
|
363
|
+
export { type CompositeSpringRef, type RampRef, type SpringPool, type SpringRef, SpringValue, type SpringValueProps, type SpringValueSlotScope, type SpringValueSlots, type UseCompositeSpringConfig, type UseRampOptions, type UseSpringConfig, provideSpringSystem, useRamp, useSpring, useSpringPool, useSpringSystem };
|