coily 0.15.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 +131 -55
- package/dist/{config-OOMMRdK8.d.ts → config-B8M2xp26.d.ts} +103 -120
- package/dist/css.d.ts +85 -57
- package/dist/css.js +58 -34
- package/dist/index.d.ts +3 -3
- package/dist/index.js +98 -65
- package/dist/nuxt.d.ts +20 -19
- package/dist/nuxt.js +15 -5
- package/dist/{solver-CVXOTDkZ.js → solver-CAXuxdKj.js} +22 -14
- package/dist/system-C7PbI4L0.d.ts +1213 -0
- package/dist/{system-Br_cPnaN.js → system-WejqGkfv.js} +1948 -1216
- package/dist/vue.d.ts +224 -129
- package/dist/vue.js +161 -41
- package/package.json +1 -1
- package/dist/system-Du_fXXmO.d.ts +0 -940
package/dist/vue.d.ts
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
import { n as SpringDefinitionOptions, t as SpringDefinition } from "./config-
|
|
2
|
-
import {
|
|
3
|
-
import { App, MaybeRefOrGetter, Ref, SlotsType } from "vue";
|
|
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";
|
|
4
4
|
//#region src/vue/reactive-spring.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Config for a scalar `useSpring`: a `SpringDefinition`, any option shape
|
|
7
|
-
* `defineSpring` accepts, or a ref
|
|
8
|
-
* reconfigures the spring in place
|
|
9
|
-
* 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.
|
|
10
10
|
*/
|
|
11
11
|
type UseSpringConfig = MaybeRefOrGetter<SpringDefinitionOptions | SpringDefinition | undefined>;
|
|
12
12
|
/**
|
|
13
|
-
* The
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* Writing the main ref displaces the spring — it springs back toward its
|
|
18
|
-
* 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
|
|
19
17
|
* `useSpring`.
|
|
20
18
|
*
|
|
21
|
-
* The ref is
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* 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.
|
|
27
24
|
*/
|
|
28
|
-
interface ReactiveSpringRef<V, W = V> extends Ref<V, W>,
|
|
25
|
+
interface ReactiveSpringRef<V, W = V> extends Ref<V, W>, TargetedSource<V> {
|
|
29
26
|
/**
|
|
30
27
|
* The current velocity in value units per second, as a writable ref.
|
|
31
|
-
* Writing flings the spring
|
|
28
|
+
* Writing flings the spring, and it settles back to its target.
|
|
32
29
|
*/
|
|
33
30
|
readonly velocity: Ref<V, W>;
|
|
34
31
|
/**
|
|
@@ -39,67 +36,71 @@ interface ReactiveSpringRef<V, W = V> extends Ref<V, W>, SpringSource<V> {
|
|
|
39
36
|
/** Whether the spring is resting, as a reactive ref. Writes are ignored. */
|
|
40
37
|
readonly isResting: Ref<boolean>;
|
|
41
38
|
/**
|
|
42
|
-
* A promise that resolves when the spring next comes to rest
|
|
43
|
-
* resolved while
|
|
44
|
-
* 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.
|
|
45
42
|
*/
|
|
46
43
|
readonly settled: Promise<void>;
|
|
47
|
-
/**
|
|
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
|
+
*/
|
|
48
49
|
readonly jumpTo: (value: W) => void;
|
|
49
50
|
}
|
|
50
51
|
//#endregion
|
|
51
52
|
//#region src/vue/composite-spring.d.ts
|
|
52
53
|
/**
|
|
53
|
-
* Config for an object `useSpring`: a `ConfigShape
|
|
54
|
-
*
|
|
55
|
-
*
|
|
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.
|
|
56
58
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
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.
|
|
60
62
|
*/
|
|
61
63
|
type UseCompositeSpringConfig<T extends object> = MaybeRefOrGetter<ConfigShape<T> | undefined>;
|
|
62
64
|
/**
|
|
63
|
-
* The
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
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`.
|
|
68
70
|
*/
|
|
69
71
|
interface CompositeSpringRef<T extends object> extends ReactiveSpringRef<ReadonlyShape<T>, PartialShape<T>> {}
|
|
70
72
|
//#endregion
|
|
71
73
|
//#region src/vue/spring.d.ts
|
|
72
74
|
/**
|
|
73
|
-
* The
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
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`.
|
|
77
79
|
*/
|
|
78
80
|
interface SpringRef extends ReactiveSpringRef<number> {}
|
|
79
81
|
/**
|
|
80
|
-
* Creates a scalar spring and returns it as a `SpringRef`. The target
|
|
81
|
-
*
|
|
82
|
-
* `useSpring` ref, a `mapSpring` result, a pooled `Spring`
|
|
83
|
-
*
|
|
84
|
-
* they change, momentum intact; a getter of a source re-follows when its
|
|
85
|
-
* own dependencies change, so `useSpring(() => (split.value ? left :
|
|
86
|
-
* right))` switches leaders live. Reactive `config` reconfigures the
|
|
87
|
-
* spring in place; while following, it configures the follower's own
|
|
88
|
-
* 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.
|
|
89
86
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
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.
|
|
93
93
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* is disposed with the component's scope, and composables are loop-safe:
|
|
97
|
-
* 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.
|
|
98
96
|
*
|
|
99
|
-
* `
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
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.
|
|
103
104
|
*
|
|
104
105
|
* @example
|
|
105
106
|
* ```ts
|
|
@@ -107,63 +108,155 @@ interface SpringRef extends ReactiveSpringRef<number> {}
|
|
|
107
108
|
* const x = useSpring(target, { duration: 500, bounce: 0.3 })
|
|
108
109
|
* // template: <div :style="{ translate: `${x}px 0` }" @click="target = 300" />
|
|
109
110
|
*
|
|
110
|
-
* const
|
|
111
|
+
* const shown = ref(false)
|
|
112
|
+
* const opacity = useSpring(() => (shown.value ? 1 : 0), undefined, { purpose: 'nonmotion' })
|
|
111
113
|
* ```
|
|
112
114
|
*/
|
|
113
115
|
declare function useSpring(target: MaybeRefOrGetter<number | SpringSource>, config?: UseSpringConfig, options?: SpringOptions): SpringRef;
|
|
114
116
|
/**
|
|
115
|
-
* Creates a composite spring that follows
|
|
116
|
-
*
|
|
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.
|
|
117
122
|
*
|
|
118
|
-
* Call it during `setup()` below a provided spring system.
|
|
119
|
-
* 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.
|
|
120
125
|
*/
|
|
121
|
-
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>;
|
|
122
127
|
/**
|
|
123
|
-
* Creates a composite spring over a numeric shape
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
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.
|
|
131
137
|
*
|
|
132
|
-
* Call it during `setup()` below a provided spring system.
|
|
133
|
-
* 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.
|
|
134
140
|
*
|
|
135
|
-
* `options.purpose`
|
|
136
|
-
* `Purpose` for all, or a shape
|
|
137
|
-
*
|
|
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.
|
|
138
144
|
*/
|
|
139
145
|
declare function useSpring<T extends object>(target: MaybeRefOrGetter<T & Shape<T>>, config?: UseCompositeSpringConfig<T>, options?: CompositeSpringOptions<T>): CompositeSpringRef<T>;
|
|
140
146
|
/**
|
|
141
|
-
* Creates a composite spring driven by a getter
|
|
142
|
-
*
|
|
143
|
-
*
|
|
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.
|
|
144
230
|
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
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.
|
|
148
234
|
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
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
|
+
* ```
|
|
151
244
|
*/
|
|
152
|
-
declare function
|
|
245
|
+
declare function useRamp(target: MaybeRefOrGetter<number>, rate: MaybeRefOrGetter<number>, options?: UseRampOptions): RampRef;
|
|
153
246
|
//#endregion
|
|
154
247
|
//#region src/vue/pool.d.ts
|
|
155
248
|
/**
|
|
156
|
-
* Imperative spring factories bound to the provided system, for
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* 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.
|
|
161
253
|
*/
|
|
162
254
|
interface SpringPool {
|
|
163
255
|
/**
|
|
164
256
|
* Creates a pooled spring at rest at `value`. Without `config`, the
|
|
165
|
-
* default
|
|
166
|
-
* `'
|
|
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.
|
|
167
260
|
*/
|
|
168
261
|
createSpring(value: number, config?: SpringDefinition, options?: SpringOptions): Spring;
|
|
169
262
|
/**
|
|
@@ -172,39 +265,38 @@ interface SpringPool {
|
|
|
172
265
|
*/
|
|
173
266
|
createSpring(source: SpringSource, config?: SpringDefinition, options?: SpringOptions): Spring;
|
|
174
267
|
/**
|
|
175
|
-
* Creates a pooled composite spring over a
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* 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.
|
|
179
272
|
*/
|
|
180
273
|
createSpring<T extends object>(value: T & Shape<T>, config?: ConfigShape<T>, options?: CompositeSpringOptions<T>): CompositeSpring<T>;
|
|
181
274
|
}
|
|
182
275
|
/**
|
|
183
|
-
* Returns spring factories bound to the provided spring system
|
|
184
|
-
*
|
|
185
|
-
* alive
|
|
186
|
-
* 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.
|
|
187
279
|
*
|
|
188
|
-
* Call it during `setup()`
|
|
189
|
-
*
|
|
190
|
-
*
|
|
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.
|
|
191
283
|
*/
|
|
192
284
|
declare function useSpringPool(): SpringPool;
|
|
193
285
|
//#endregion
|
|
194
286
|
//#region src/vue/component.d.ts
|
|
195
287
|
interface SpringValueProps {
|
|
196
|
-
/** The value to animate toward.
|
|
288
|
+
/** The value to animate toward. A new value retargets the spring and keeps its momentum. */
|
|
197
289
|
target: number;
|
|
198
290
|
/**
|
|
199
291
|
* Spring config: a `SpringDefinition` or any option shape `defineSpring`
|
|
200
|
-
* accepts.
|
|
201
|
-
* the default.
|
|
292
|
+
* accepts. A new config reconfigures the spring in place. Without it,
|
|
293
|
+
* the spring uses the default config.
|
|
202
294
|
*/
|
|
203
295
|
config?: SpringDefinitionOptions | SpringDefinition;
|
|
204
296
|
/**
|
|
205
|
-
* What the spring animates
|
|
206
|
-
* `'
|
|
207
|
-
*
|
|
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.
|
|
208
300
|
* @default 'motion'
|
|
209
301
|
*/
|
|
210
302
|
purpose?: Purpose;
|
|
@@ -221,7 +313,10 @@ interface SpringValueSlotScope {
|
|
|
221
313
|
isResting: boolean;
|
|
222
314
|
/** Estimated milliseconds until the spring rests. */
|
|
223
315
|
timeRemaining: number;
|
|
224
|
-
/**
|
|
316
|
+
/**
|
|
317
|
+
* Snaps the spring to `value` with no animation, target included. The
|
|
318
|
+
* spring rests there until the `target` prop changes.
|
|
319
|
+
*/
|
|
225
320
|
jumpTo: (value: number) => void;
|
|
226
321
|
}
|
|
227
322
|
/** Slot types: `default` receives the live `SpringValueSlotScope`. */
|
|
@@ -229,13 +324,14 @@ type SpringValueSlots = SlotsType<{
|
|
|
229
324
|
default: SpringValueSlotScope;
|
|
230
325
|
}>;
|
|
231
326
|
/**
|
|
232
|
-
*
|
|
233
|
-
* slot
|
|
234
|
-
* 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.
|
|
235
331
|
*
|
|
236
332
|
* @example
|
|
237
333
|
* ```vue
|
|
238
|
-
* <SpringValue :target="expanded ? 1 : 0" purpose="
|
|
334
|
+
* <SpringValue :target="expanded ? 1 : 0" purpose="nonmotion" v-slot="{ value }">
|
|
239
335
|
* <div :style="{ opacity: value }" />
|
|
240
336
|
* </SpringValue>
|
|
241
337
|
* ```
|
|
@@ -246,23 +342,22 @@ declare const SpringValue: import("vue").DefineSetupFnComponent<SpringValueProps
|
|
|
246
342
|
//#endregion
|
|
247
343
|
//#region src/vue/system.d.ts
|
|
248
344
|
/**
|
|
249
|
-
*
|
|
250
|
-
* starts or stops it. With `app`, the
|
|
251
|
-
*
|
|
252
|
-
* component
|
|
253
|
-
*
|
|
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.
|
|
254
350
|
*/
|
|
255
351
|
declare function provideSpringSystem(system: SpringSystem, app?: App): void;
|
|
256
352
|
/**
|
|
257
|
-
* Returns the spring system
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
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.
|
|
261
357
|
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
* 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()`.
|
|
265
360
|
*/
|
|
266
361
|
declare function useSpringSystem(options?: SpringSystemOptions): SpringSystem;
|
|
267
362
|
//#endregion
|
|
268
|
-
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 };
|