@ssgoi/core 2.5.5 → 3.0.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/dist/animator/animate/css-runner.d.ts +17 -0
- package/dist/animator/animate/css-runner.d.ts.map +1 -0
- package/dist/animator/animate/index.d.ts +42 -0
- package/dist/animator/animate/index.d.ts.map +1 -0
- package/dist/animator/animate/tick-runner.d.ts +16 -0
- package/dist/animator/animate/tick-runner.d.ts.map +1 -0
- package/dist/animator/animate/types.d.ts +31 -0
- package/dist/animator/animate/types.d.ts.map +1 -0
- package/dist/animator/animation.d.ts +57 -0
- package/dist/animator/animation.d.ts.map +1 -0
- package/dist/animator/index.d.ts +34 -33
- package/dist/animator/index.d.ts.map +1 -1
- package/dist/animator/multi-animator.d.ts +98 -0
- package/dist/animator/multi-animator.d.ts.map +1 -0
- package/dist/animator/spring-core.d.ts +63 -0
- package/dist/animator/spring-core.d.ts.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +700 -818
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/create-swipe-detector.d.ts +1 -0
- package/dist/ssgoi-transition/create-swipe-detector.d.ts.map +1 -1
- package/dist/transition/create-transition-callback.d.ts +2 -2
- package/dist/transition/create-transition-callback.d.ts.map +1 -1
- package/dist/transition/transition-strategy.d.ts +28 -17
- package/dist/transition/transition-strategy.d.ts.map +1 -1
- package/dist/transition/transition.d.ts +2 -18
- package/dist/transition/transition.d.ts.map +1 -1
- package/dist/transitions/blur.d.ts +5 -5
- package/dist/transitions/blur.d.ts.map +1 -1
- package/dist/transitions/bounce.d.ts +5 -5
- package/dist/transitions/bounce.d.ts.map +1 -1
- package/dist/transitions/fade.d.ts +5 -5
- package/dist/transitions/fade.d.ts.map +1 -1
- package/dist/transitions/fly.d.ts +5 -5
- package/dist/transitions/fly.d.ts.map +1 -1
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +206 -207
- package/dist/transitions/mask.d.ts +5 -5
- package/dist/transitions/mask.d.ts.map +1 -1
- package/dist/transitions/none.d.ts +3 -3
- package/dist/transitions/none.d.ts.map +1 -1
- package/dist/transitions/rotate.d.ts +5 -5
- package/dist/transitions/rotate.d.ts.map +1 -1
- package/dist/transitions/scale.d.ts +5 -5
- package/dist/transitions/scale.d.ts.map +1 -1
- package/dist/transitions/slide.d.ts +5 -5
- package/dist/transitions/slide.d.ts.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.ts +142 -102
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +69 -6
- package/dist/view-transitions/blind.d.ts +0 -1
- package/dist/view-transitions/blind.d.ts.map +1 -1
- package/dist/view-transitions/drill.d.ts.map +1 -1
- package/dist/view-transitions/fade.d.ts.map +1 -1
- package/dist/view-transitions/hero.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +13 -13
- package/dist/view-transitions/index.js +499 -492
- package/dist/view-transitions/scroll.d.ts.map +1 -1
- package/dist/view-transitions/slide.d.ts.map +1 -1
- package/dist/view-transitions/strip.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/animator/animate.d.ts +0 -35
- package/dist/animator/animate.d.ts.map +0 -1
- package/dist/animator/animation-scheduler.d.ts +0 -47
- package/dist/animator/animation-scheduler.d.ts.map +0 -1
- package/dist/test-utils.d.ts +0 -46
- package/dist/test-utils.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TransitionKey } from '../types';
|
|
1
|
+
import { StyleObject, TransitionKey } from '../types';
|
|
2
2
|
interface SlideOptions {
|
|
3
3
|
direction?: "left" | "right" | "up" | "down";
|
|
4
4
|
distance?: number | string;
|
|
@@ -13,19 +13,19 @@ interface SlideOptions {
|
|
|
13
13
|
}
|
|
14
14
|
export declare const slide: (options?: SlideOptions) => {
|
|
15
15
|
key?: TransitionKey | undefined;
|
|
16
|
-
in: (
|
|
16
|
+
in: () => {
|
|
17
17
|
spring: {
|
|
18
18
|
stiffness?: number;
|
|
19
19
|
damping?: number;
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
css: (progress: number) => StyleObject;
|
|
22
22
|
};
|
|
23
|
-
out: (
|
|
23
|
+
out: () => {
|
|
24
24
|
spring: {
|
|
25
25
|
stiffness?: number;
|
|
26
26
|
damping?: number;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
css: (progress: number) => StyleObject;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/slide.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"slide.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/slide.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE3D,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACjB,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,KAAK,GAAI,UAAS,YAAiB;;;;wBANhC,MAAM;sBACR,MAAM;;wBAuDQ,MAAM,KAAG,WAAW;;;;wBAxDhC,MAAM;sBACR,MAAM;;wBAuDQ,MAAM,KAAG,WAAW;;CAqB/C,CAAC"}
|
package/dist/types.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(n){return("tick"in n||"css"in n)&&!("springs"in n)}function t(n){return"springs"in n}function r(n){return"css"in n&&typeof n.css=="function"}function s(n){return"tick"in n&&typeof n.tick=="function"}function a(n){if(r(n)&&s(n))throw new Error("SingleSpringConfig cannot have both 'tick' and 'css' defined. Use one or the other.")}function l(n){if(n.tick&&n.css)throw new Error("SpringItem cannot have both 'tick' and 'css' defined. Use one or the other.")}function d(n){return t(n)?(n.springs.forEach(l),n):(a(n),{prepare:n.prepare,wait:n.wait,onStart:n.onStart,onEnd:n.onEnd,springs:[{spring:n.spring,tick:n.tick,css:n.css}],schedule:"parallel"})}function S(n){const o=n.schedule??"parallel",u=n.springs.map(i=>{let e;switch(o){case"parallel":e=0;break;case"sequential":e=1;break;case"stagger":e=Math.max(0,Math.min(1,i.offset??0));break;default:e=0}return{...i,normalizedOffset:e}}),{schedule:h,...p}=n;return{...p,springs:u}}exports.isCssAnimation=r;exports.isMultiSpring=t;exports.isSingleSpring=c;exports.isTickAnimation=s;exports.normalizeMultiSpringSchedule=S;exports.normalizeToMultiSpring=d;exports.validateAnimationMode=a;exports.validateSpringItem=l;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
export type TransitionKey = string | symbol;
|
|
2
2
|
export type SpringConfig = {
|
|
3
|
-
stiffness
|
|
4
|
-
damping
|
|
3
|
+
stiffness: number;
|
|
4
|
+
damping: number;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* - overlap: All springs start immediately (parallel execution)
|
|
9
|
-
* - wait: Each spring waits for previous to complete (sequential)
|
|
10
|
-
* - chain: Springs start with offset delays
|
|
7
|
+
* CSS style object type
|
|
11
8
|
*/
|
|
12
|
-
export type
|
|
9
|
+
export type StyleObject = Record<string, number | string>;
|
|
10
|
+
/**
|
|
11
|
+
* Schedule strategy for multi-spring animations (user-facing)
|
|
12
|
+
* - parallel: All springs start immediately (offset = 0)
|
|
13
|
+
* - sequential: Each spring waits for previous to complete (offset = 1)
|
|
14
|
+
* - stagger: Springs start at custom progress offsets (0-1)
|
|
15
|
+
*/
|
|
16
|
+
export type ScheduleType = "parallel" | "sequential" | "stagger";
|
|
13
17
|
/**
|
|
14
18
|
* Base configuration shared by both single and multi-spring transitions
|
|
15
19
|
*/
|
|
@@ -20,68 +24,92 @@ export type BaseTransitionConfig = {
|
|
|
20
24
|
onEnd?: () => void;
|
|
21
25
|
};
|
|
22
26
|
/**
|
|
23
|
-
* Single spring configuration
|
|
27
|
+
* Single spring configuration
|
|
24
28
|
* Used for simple transitions with a single animation value
|
|
29
|
+
*
|
|
30
|
+
* Supports two animation modes:
|
|
31
|
+
* - tick: RAF-based animation with callback on each frame
|
|
32
|
+
* - css: Web Animation API with CSS string generation
|
|
25
33
|
*/
|
|
26
|
-
export type SingleSpringConfig
|
|
34
|
+
export type SingleSpringConfig = BaseTransitionConfig & {
|
|
27
35
|
spring?: SpringConfig;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
tick?: (progress: number) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Style generator for Web Animation API mode
|
|
39
|
+
*
|
|
40
|
+
* When provided, the animation uses Web Animation API instead of RAF.
|
|
41
|
+
* Spring physics are pre-computed and converted to keyframes.
|
|
42
|
+
*
|
|
43
|
+
* @param progress - Current progress value (0 to 1)
|
|
44
|
+
* @returns Style object for Web Animation API
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* css: (progress) => ({
|
|
49
|
+
* opacity: progress,
|
|
50
|
+
* transform: `translateY(${(1 - progress) * 20}px)`,
|
|
51
|
+
* })
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
css?: (progress: number) => StyleObject;
|
|
31
55
|
};
|
|
32
56
|
/**
|
|
33
57
|
* Individual spring item in a multi-spring animation
|
|
58
|
+
*
|
|
59
|
+
* Supports two animation modes (mutually exclusive):
|
|
60
|
+
* - tick: RAF-based animation with callback on each frame
|
|
61
|
+
* - css: Web Animation API with CSS string generation
|
|
34
62
|
*/
|
|
35
|
-
export type SpringItem
|
|
36
|
-
from?: TAnimationValue;
|
|
37
|
-
to?: TAnimationValue;
|
|
63
|
+
export type SpringItem = {
|
|
38
64
|
spring?: SpringConfig;
|
|
39
65
|
/**
|
|
40
|
-
* Frame callback - called on each animation frame with progress value
|
|
66
|
+
* Frame callback - called on each animation frame with progress value (RAF-based)
|
|
41
67
|
*
|
|
42
68
|
* **Performance Warning:** Use WRITE-ONLY operations for best performance.
|
|
43
69
|
* Avoid reading layout properties inside tick to prevent layout thrashing.
|
|
44
70
|
*
|
|
45
|
-
* Layout-triggering properties (causes forced synchronous layout):
|
|
46
|
-
* - element.offsetWidth, offsetHeight, offsetTop, offsetLeft
|
|
47
|
-
* - element.clientWidth, clientHeight
|
|
48
|
-
* - element.getBoundingClientRect()
|
|
49
|
-
* - element.scrollWidth, scrollHeight, scrollTop, scrollLeft
|
|
50
|
-
* - window.getComputedStyle(element)
|
|
51
|
-
*
|
|
52
71
|
* @example
|
|
53
|
-
* // ❌ Bad: Layout read in tick (causes thrashing)
|
|
54
72
|
* tick: (progress) => {
|
|
55
|
-
*
|
|
56
|
-
* element.style.height = height * progress
|
|
73
|
+
* element.style.opacity = String(progress)
|
|
57
74
|
* }
|
|
75
|
+
*/
|
|
76
|
+
tick?: (progress: number) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Style generator for Web Animation API mode
|
|
79
|
+
*
|
|
80
|
+
* When provided, the animation uses Web Animation API instead of RAF.
|
|
81
|
+
* Spring physics are pre-computed and converted to keyframes.
|
|
82
|
+
*
|
|
83
|
+
* @param progress - Current progress value (0 to 1)
|
|
84
|
+
* @returns Style object for Web Animation API
|
|
58
85
|
*
|
|
59
86
|
* @example
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* },
|
|
65
|
-
* tick: (progress) => {
|
|
66
|
-
* const height = parseFloat(element.dataset.height)
|
|
67
|
-
* element.style.height = height * progress // WRITE only
|
|
68
|
-
* }
|
|
87
|
+
* css: (progress) => ({
|
|
88
|
+
* opacity: progress,
|
|
89
|
+
* transform: `translateY(${(1 - progress) * 20}px)`,
|
|
90
|
+
* })
|
|
69
91
|
*/
|
|
70
|
-
|
|
92
|
+
css?: (progress: number) => StyleObject;
|
|
71
93
|
onStart?: () => void;
|
|
72
94
|
onComplete?: () => void;
|
|
73
95
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
96
|
+
* Progress offset (0-1) before this spring starts
|
|
97
|
+
* - 0: Start immediately (parallel behavior)
|
|
98
|
+
* - 1: Start after previous spring completes (sequential behavior)
|
|
99
|
+
* - 0.5: Start when previous spring is 50% complete
|
|
100
|
+
*
|
|
101
|
+
* Only applies to 'stagger' schedule mode.
|
|
102
|
+
* For 'parallel' mode, all springs start at 0.
|
|
103
|
+
* For 'sequential' mode, all springs use offset 1.
|
|
76
104
|
*/
|
|
77
105
|
offset?: number;
|
|
78
106
|
};
|
|
79
107
|
/**
|
|
80
|
-
* Multi-spring configuration
|
|
108
|
+
* Multi-spring configuration
|
|
81
109
|
* Used for complex transitions with multiple coordinated animations
|
|
82
110
|
*/
|
|
83
|
-
export type MultiSpringConfig
|
|
84
|
-
springs: SpringItem
|
|
111
|
+
export type MultiSpringConfig = BaseTransitionConfig & {
|
|
112
|
+
springs: SpringItem[];
|
|
85
113
|
schedule?: ScheduleType;
|
|
86
114
|
onProgress?: (completed: number, total: number) => void;
|
|
87
115
|
};
|
|
@@ -89,22 +117,50 @@ export type MultiSpringConfig<TAnimationValue = number> = BaseTransitionConfig &
|
|
|
89
117
|
* Transition configuration - supports both single and multi-spring animations
|
|
90
118
|
* Uses Union Type for type safety and backward compatibility
|
|
91
119
|
*/
|
|
92
|
-
export type TransitionConfig
|
|
120
|
+
export type TransitionConfig = SingleSpringConfig | MultiSpringConfig;
|
|
93
121
|
/**
|
|
94
122
|
* Type guard to check if config is single spring
|
|
95
123
|
*/
|
|
96
|
-
export declare function isSingleSpring
|
|
124
|
+
export declare function isSingleSpring(config: TransitionConfig): config is SingleSpringConfig;
|
|
97
125
|
/**
|
|
98
126
|
* Type guard to check if config is multi-spring
|
|
99
127
|
*/
|
|
100
|
-
export declare function isMultiSpring
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
128
|
+
export declare function isMultiSpring(config: TransitionConfig): config is MultiSpringConfig;
|
|
129
|
+
/**
|
|
130
|
+
* Type guard to check if config uses CSS mode (Web Animation API)
|
|
131
|
+
*/
|
|
132
|
+
export declare function isCssAnimation(config: SingleSpringConfig): config is SingleSpringConfig & {
|
|
133
|
+
css: (progress: number) => string;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Type guard to check if config uses tick mode (RAF-based)
|
|
137
|
+
*/
|
|
138
|
+
export declare function isTickAnimation(config: SingleSpringConfig): config is SingleSpringConfig & {
|
|
139
|
+
tick: (progress: number) => void;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Validate that config doesn't have both tick and css defined
|
|
143
|
+
* @throws Error if both tick and css are defined
|
|
144
|
+
*/
|
|
145
|
+
export declare function validateAnimationMode(config: SingleSpringConfig): void;
|
|
146
|
+
/**
|
|
147
|
+
* Validate SpringItem doesn't have both tick and css defined
|
|
148
|
+
* @throws Error if both tick and css are defined
|
|
149
|
+
*/
|
|
150
|
+
export declare function validateSpringItem(item: SpringItem): void;
|
|
151
|
+
/**
|
|
152
|
+
* Normalize TransitionConfig to MultiSpringConfig
|
|
153
|
+
* Converts SingleSpringConfig to MultiSpringConfig with single spring item
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
export declare function normalizeToMultiSpring(config: TransitionConfig): MultiSpringConfig;
|
|
157
|
+
export type GetTransitionConfig<TContext = undefined> = TContext extends undefined ? (node: HTMLElement) => TransitionConfig | Promise<TransitionConfig> : (node: HTMLElement, context: TContext) => TransitionConfig | Promise<TransitionConfig>;
|
|
158
|
+
export type Transition<TContext = undefined> = {
|
|
159
|
+
in?: GetTransitionConfig<TContext>;
|
|
160
|
+
out?: GetTransitionConfig<TContext>;
|
|
105
161
|
key?: TransitionKey;
|
|
106
162
|
};
|
|
107
|
-
export type TransitionOptions<TContext = undefined
|
|
163
|
+
export type TransitionOptions<TContext = undefined> = Transition<TContext> & {
|
|
108
164
|
key?: TransitionKey;
|
|
109
165
|
ref?: object;
|
|
110
166
|
};
|
|
@@ -170,72 +226,56 @@ export type SsgoiContext = (path: string) => Transition & {
|
|
|
170
226
|
key: TransitionKey;
|
|
171
227
|
};
|
|
172
228
|
/**
|
|
173
|
-
* Normalized schedule entry for internal processing
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* - delay>0: delayed start with fixed timing (chain)
|
|
229
|
+
* Normalized schedule entry for internal processing
|
|
230
|
+
* All schedule types are normalized to progress-based offsets (0-1)
|
|
231
|
+
*
|
|
232
|
+
* Progress offset determines when each spring starts relative to previous spring:
|
|
233
|
+
* - 0: Start immediately (parallel)
|
|
234
|
+
* - 1: Start after previous completes (sequential)
|
|
235
|
+
* - 0.5: Start when previous is 50% complete
|
|
236
|
+
*
|
|
182
237
|
* @internal
|
|
183
238
|
*/
|
|
184
|
-
export type
|
|
185
|
-
type: "offset";
|
|
239
|
+
export type NormalizedScheduleEntry = {
|
|
186
240
|
id: string;
|
|
187
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Progress offset (0-1) relative to previous spring
|
|
243
|
+
* - 0: Start immediately with previous spring
|
|
244
|
+
* - 1: Start after previous spring completes
|
|
245
|
+
* - 0-1: Start when previous spring reaches this progress
|
|
246
|
+
*/
|
|
247
|
+
offset: number;
|
|
188
248
|
};
|
|
189
249
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
250
|
+
* Normalized multi-spring config for internal use
|
|
251
|
+
* Schedule is always normalized to progress-based offsets
|
|
192
252
|
* @internal
|
|
193
253
|
*/
|
|
194
|
-
export type
|
|
195
|
-
|
|
196
|
-
|
|
254
|
+
export type NormalizedMultiSpringConfig = Omit<MultiSpringConfig, "springs" | "schedule"> & {
|
|
255
|
+
springs: Array<SpringItem & {
|
|
256
|
+
normalizedOffset: number;
|
|
257
|
+
}>;
|
|
197
258
|
};
|
|
198
259
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
*
|
|
206
|
-
* Supports both number and object animations
|
|
260
|
+
* Normalize MultiSpringConfig schedule to progress-based offsets
|
|
261
|
+
*
|
|
262
|
+
* Converts user-facing schedule types to unified offset values:
|
|
263
|
+
* - parallel: All springs get offset 0 (start together)
|
|
264
|
+
* - sequential: All springs get offset 1 (wait for previous)
|
|
265
|
+
* - stagger: Use each spring's custom offset (0-1)
|
|
266
|
+
*
|
|
207
267
|
* @internal
|
|
208
268
|
*/
|
|
209
|
-
export
|
|
210
|
-
type: "single";
|
|
211
|
-
position: T;
|
|
212
|
-
velocity: T extends number ? number : Record<string, number>;
|
|
213
|
-
from: T;
|
|
214
|
-
to: T;
|
|
215
|
-
};
|
|
269
|
+
export declare function normalizeMultiSpringSchedule(config: MultiSpringConfig): NormalizedMultiSpringConfig;
|
|
216
270
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
271
|
+
* Animation state
|
|
272
|
+
* For MultiAnimator: returns first animator's state
|
|
219
273
|
* @internal
|
|
220
274
|
*/
|
|
221
|
-
export type
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
275
|
+
export type AnimationState = {
|
|
276
|
+
position: number;
|
|
277
|
+
velocity: number;
|
|
278
|
+
from: number;
|
|
279
|
+
to: number;
|
|
226
280
|
};
|
|
227
|
-
/**
|
|
228
|
-
* Common interface for animation controllers
|
|
229
|
-
* Implemented by both Animator (single spring) and AnimationScheduler (multi-spring)
|
|
230
|
-
* @internal
|
|
231
|
-
*/
|
|
232
|
-
export interface AnimationController<T = number> {
|
|
233
|
-
forward(): void;
|
|
234
|
-
backward(): void;
|
|
235
|
-
stop(): void;
|
|
236
|
-
reverse(options?: {
|
|
237
|
-
offsetMode?: "immediate" | "mirror" | "reverse";
|
|
238
|
-
}): void;
|
|
239
|
-
getCurrentState(): AnimationState<T>;
|
|
240
|
-
}
|
|
241
281
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAEjC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAGzC,IAAI,CAAC,EAAE,MAAM,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,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,iBAAiB,EACjB,SAAS,GAAG,UAAU,CACvB,GAAG;IACF,OAAO,EAAE,KAAK,CAAC,UAAU,GAAG;QAAE,gBAAgB,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,iBAAiB,GACxB,2BAA2B,CAiC7B;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -1,10 +1,73 @@
|
|
|
1
|
-
function
|
|
2
|
-
return "tick" in
|
|
1
|
+
function d(e) {
|
|
2
|
+
return ("tick" in e || "css" in e) && !("springs" in e);
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
return "springs" in
|
|
4
|
+
function a(e) {
|
|
5
|
+
return "springs" in e;
|
|
6
|
+
}
|
|
7
|
+
function o(e) {
|
|
8
|
+
return "css" in e && typeof e.css == "function";
|
|
9
|
+
}
|
|
10
|
+
function l(e) {
|
|
11
|
+
return "tick" in e && typeof e.tick == "function";
|
|
12
|
+
}
|
|
13
|
+
function u(e) {
|
|
14
|
+
if (o(e) && l(e))
|
|
15
|
+
throw new Error(
|
|
16
|
+
"SingleSpringConfig cannot have both 'tick' and 'css' defined. Use one or the other."
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
function p(e) {
|
|
20
|
+
if (e.tick && e.css)
|
|
21
|
+
throw new Error(
|
|
22
|
+
"SpringItem cannot have both 'tick' and 'css' defined. Use one or the other."
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function h(e) {
|
|
26
|
+
return a(e) ? (e.springs.forEach(p), e) : (u(e), {
|
|
27
|
+
prepare: e.prepare,
|
|
28
|
+
wait: e.wait,
|
|
29
|
+
onStart: e.onStart,
|
|
30
|
+
onEnd: e.onEnd,
|
|
31
|
+
springs: [
|
|
32
|
+
{
|
|
33
|
+
spring: e.spring,
|
|
34
|
+
tick: e.tick,
|
|
35
|
+
css: e.css
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
schedule: "parallel"
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function S(e) {
|
|
42
|
+
const r = e.schedule ?? "parallel", i = e.springs.map((t) => {
|
|
43
|
+
let n;
|
|
44
|
+
switch (r) {
|
|
45
|
+
case "parallel":
|
|
46
|
+
n = 0;
|
|
47
|
+
break;
|
|
48
|
+
case "sequential":
|
|
49
|
+
n = 1;
|
|
50
|
+
break;
|
|
51
|
+
case "stagger":
|
|
52
|
+
n = Math.max(0, Math.min(1, t.offset ?? 0));
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
n = 0;
|
|
56
|
+
}
|
|
57
|
+
return { ...t, normalizedOffset: n };
|
|
58
|
+
}), { schedule: c, ...s } = e;
|
|
59
|
+
return {
|
|
60
|
+
...s,
|
|
61
|
+
springs: i
|
|
62
|
+
};
|
|
6
63
|
}
|
|
7
64
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
65
|
+
o as isCssAnimation,
|
|
66
|
+
a as isMultiSpring,
|
|
67
|
+
d as isSingleSpring,
|
|
68
|
+
l as isTickAnimation,
|
|
69
|
+
S as normalizeMultiSpringSchedule,
|
|
70
|
+
h as normalizeToMultiSpring,
|
|
71
|
+
u as validateAnimationMode,
|
|
72
|
+
p as validateSpringItem
|
|
10
73
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blind.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/blind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EAEhB,MAAM,UAAU,CAAC;AAWlB,UAAU,YAAY;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,
|
|
1
|
+
{"version":3,"file":"blind.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/blind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EAEhB,MAAM,UAAU,CAAC;AAWlB,UAAU,YAAY;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,KAAK,GAAI,UAAS,YAAiB,KAAG,eA2LlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drill.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/drill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"drill.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/drill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAa3E,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,KAAK,GAAI,UAAS,YAAiB,KAAG,eAkHlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/fade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/fade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAQ3E,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,eA0DhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/hero.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI9D,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,
|
|
1
|
+
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/hero.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI9D,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,eA4KhD,CAAC"}
|