@ssgoi/core 4.0.0 → 4.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.
- package/dist/animator/integrator/double-spring-integrator.d.ts +6 -0
- package/dist/animator/integrator/double-spring-integrator.d.ts.map +1 -1
- package/dist/animator/integrator/inertia-integrator.d.ts +15 -0
- package/dist/animator/integrator/inertia-integrator.d.ts.map +1 -1
- package/dist/animator/integrator/provider.d.ts.map +1 -1
- package/dist/animator/integrator/spring-integrator.d.ts +6 -0
- package/dist/animator/integrator/spring-integrator.d.ts.map +1 -1
- package/dist/animator/multi-animator.d.ts +16 -11
- package/dist/animator/multi-animator.d.ts.map +1 -1
- package/dist/animator/runner/css-runner.d.ts.map +1 -1
- package/dist/animator/single-animator.d.ts +6 -4
- package/dist/animator/single-animator.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +603 -518
- package/dist/provider-Cs5iBqRD.cjs +1 -0
- package/dist/provider-Cu4NSF1Q.js +167 -0
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +4 -1
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +42 -0
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts.map +1 -0
- package/dist/transition/create-transition-callback.d.ts.map +1 -1
- package/dist/transition/transition-strategy.d.ts +6 -6
- package/dist/transition/transition-strategy.d.ts.map +1 -1
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.ts +84 -35
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +39 -46
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/wait-paint.d.ts +15 -0
- package/dist/utils/wait-paint.d.ts.map +1 -0
- package/dist/view-transitions/depth.d.ts.map +1 -1
- package/dist/view-transitions/drill.d.ts.map +1 -1
- package/dist/view-transitions/hero.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +15 -15
- package/dist/view-transitions/index.js +673 -688
- package/dist/view-transitions/pinterest.d.ts.map +1 -1
- package/dist/view-transitions/scroll.d.ts.map +1 -1
- package/dist/view-transitions/sheet.d.ts.map +1 -1
- package/dist/view-transitions/swap.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/provider-B6Xnh0BA.cjs +0 -1
- package/dist/provider-CMBovM_W.js +0 -134
- package/dist/ssgoi-transition/types.d.ts +0 -8
- package/dist/ssgoi-transition/types.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var L=Object.defineProperty;var _=(o,e,t)=>e in o?L(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var n=(o,e,t)=>_(o,typeof e!="symbol"?e+"":e,t);class u{constructor(e){n(this,"omega");n(this,"zeta");n(this,"restDelta");n(this,"restSpeed");const{stiffness:t,damping:s}=e,i=1;this.omega=Math.sqrt(t/i),this.zeta=s/(2*Math.sqrt(t*i)),this.restDelta=e.restDelta??.01,this.restSpeed=e.restSpeed??.01}step(e,t,s){const i=Math.min(s,.033),{omega:r,zeta:p}=this,{position:c,velocity:d}=e,h=-2*i*p*r*d,a=i*r*r*(t-c),l=d+h+a;return{position:c+i*l,velocity:l}}isSettled(e,t){const s=Math.abs(t-e.position),i=Math.abs(e.velocity);return s<this.restDelta&&i<this.restSpeed}}class E{constructor(e){n(this,"leader");n(this,"follower");n(this,"restDelta");n(this,"restSpeed");this.restDelta=e.restDelta??.01,this.restSpeed=e.restSpeed??.01,this.leader=new u({stiffness:e.stiffness,damping:e.damping,restDelta:this.restDelta,restSpeed:this.restSpeed});let t,s,i,r;typeof e.follower=="number"?(t=e.stiffness*e.follower,s=e.damping):e.follower?(t=e.follower.stiffness,s=e.follower.damping,i=e.follower.restDelta,r=e.follower.restSpeed):(t=e.stiffness,s=e.damping),this.follower=new u({stiffness:t,damping:s,restDelta:i??this.restDelta,restSpeed:r??this.restSpeed})}step(e,t,s){const r=e._leader??{position:e.position,velocity:e.velocity},p=this.leader.step(r,t,s),c=this.follower.step(e,p.position,s);return{position:c.position,velocity:c.velocity,_leader:p}}isSettled(e,t){const s=e,i=Math.abs(t-e.position)<this.restDelta&&Math.abs(e.velocity)<this.restSpeed;return s._leader?Math.abs(t-s._leader.position)<this.restDelta&&Math.abs(s._leader.velocity)<this.restSpeed&&i:i}}const v=.01,M=500,R=10;class O{constructor(e){n(this,"acceleration");n(this,"resistance");n(this,"resistanceType");n(this,"min");n(this,"max");n(this,"bounceStiffness");n(this,"bounceDamping");n(this,"restDelta");this.acceleration=e.acceleration,this.resistance=e.resistance,this.resistanceType=e.resistanceType??"quadratic",this.min=e.min,this.max=e.max,this.bounceStiffness=e.bounceStiffness??M,this.bounceDamping=e.bounceDamping??R,this.restDelta=e.restDelta??v}step(e,t,s){const i=Math.min(s,.033),{acceleration:r,resistance:p,resistanceType:c,min:d,max:h}=this,{position:a,velocity:l}=e,f=d!==void 0&&a<d,w=h!==void 0&&a>h;let b;if(f||w){const D=a-(f?d:h),I=-this.bounceStiffness*D,H=-this.bounceDamping*l;b=I+H}else{const m=t>a?1:-1;let D;c==="linear"?D=p*l:D=p*l*Math.abs(l),b=m*r-D}const y=l+b*i;let S=a+y*i;if(!f&&!w){const m=t>a?1:-1;(m>0&&S>t||m<0&&S<t)&&(S=t)}return{position:S,velocity:S===t?0:y}}isSettled(e,t){return Math.abs(t-e.position)<this.restDelta}}class T{static from(e){if(e.spring&&e.inertia)throw new Error("Cannot use both 'spring' and 'inertia' together. Choose one physics type.");if(e.inertia)return new O({acceleration:e.inertia.acceleration,resistance:e.inertia.resistance,resistanceType:e.inertia.resistanceType,min:e.inertia.min,max:e.inertia.max,bounceStiffness:e.inertia.bounceStiffness,bounceDamping:e.inertia.bounceDamping,restDelta:e.inertia.restDelta});const t=e.spring??{stiffness:300,damping:30};if(t.doubleSpring){const s=t.doubleSpring;let i;return typeof s=="number"?i=s:typeof s=="object"&&(i={stiffness:s.stiffness,damping:s.damping}),new E({stiffness:t.stiffness,damping:t.damping,follower:i,restDelta:t.restDelta,restSpeed:t.restSpeed})}return new u({stiffness:t.stiffness,damping:t.damping,restDelta:t.restDelta,restSpeed:t.restSpeed})}static fromSpring(e){return T.from({spring:e})}}exports.DoubleSpringIntegrator=E;exports.InertiaIntegrator=O;exports.IntegratorProvider=T;exports.SETTLE_THRESHOLD=.05;exports.SpringIntegrator=u;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var _ = (a, e, t) => e in a ? I(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var n = (a, e, t) => _(a, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const x = 0.05;
|
|
5
|
+
class b {
|
|
6
|
+
constructor(e) {
|
|
7
|
+
n(this, "omega");
|
|
8
|
+
// Angular frequency
|
|
9
|
+
n(this, "zeta");
|
|
10
|
+
// Damping ratio
|
|
11
|
+
n(this, "restDelta");
|
|
12
|
+
n(this, "restSpeed");
|
|
13
|
+
const { stiffness: t, damping: s } = e, i = 1;
|
|
14
|
+
this.omega = Math.sqrt(t / i), this.zeta = s / (2 * Math.sqrt(t * i)), this.restDelta = e.restDelta ?? 0.01, this.restSpeed = e.restSpeed ?? 0.01;
|
|
15
|
+
}
|
|
16
|
+
step(e, t, s) {
|
|
17
|
+
const i = Math.min(s, 0.033), { omega: r, zeta: p } = this, { position: c, velocity: d } = e, h = -2 * i * p * r * d, o = i * r * r * (t - c), l = d + h + o;
|
|
18
|
+
return {
|
|
19
|
+
position: c + i * l,
|
|
20
|
+
velocity: l
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
isSettled(e, t) {
|
|
24
|
+
const s = Math.abs(t - e.position), i = Math.abs(e.velocity);
|
|
25
|
+
return s < this.restDelta && i < this.restSpeed;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
class H {
|
|
29
|
+
constructor(e) {
|
|
30
|
+
n(this, "leader");
|
|
31
|
+
n(this, "follower");
|
|
32
|
+
n(this, "restDelta");
|
|
33
|
+
n(this, "restSpeed");
|
|
34
|
+
this.restDelta = e.restDelta ?? 0.01, this.restSpeed = e.restSpeed ?? 0.01, this.leader = new b({
|
|
35
|
+
stiffness: e.stiffness,
|
|
36
|
+
damping: e.damping,
|
|
37
|
+
restDelta: this.restDelta,
|
|
38
|
+
restSpeed: this.restSpeed
|
|
39
|
+
});
|
|
40
|
+
let t, s, i, r;
|
|
41
|
+
typeof e.follower == "number" ? (t = e.stiffness * e.follower, s = e.damping) : e.follower ? (t = e.follower.stiffness, s = e.follower.damping, i = e.follower.restDelta, r = e.follower.restSpeed) : (t = e.stiffness, s = e.damping), this.follower = new b({
|
|
42
|
+
stiffness: t,
|
|
43
|
+
damping: s,
|
|
44
|
+
restDelta: i ?? this.restDelta,
|
|
45
|
+
restSpeed: r ?? this.restSpeed
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
step(e, t, s) {
|
|
49
|
+
const r = e._leader ?? {
|
|
50
|
+
position: e.position,
|
|
51
|
+
velocity: e.velocity
|
|
52
|
+
}, p = this.leader.step(r, t, s), c = this.follower.step(
|
|
53
|
+
e,
|
|
54
|
+
p.position,
|
|
55
|
+
s
|
|
56
|
+
);
|
|
57
|
+
return {
|
|
58
|
+
position: c.position,
|
|
59
|
+
velocity: c.velocity,
|
|
60
|
+
_leader: p
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
isSettled(e, t) {
|
|
64
|
+
const s = e, i = Math.abs(t - e.position) < this.restDelta && Math.abs(e.velocity) < this.restSpeed;
|
|
65
|
+
return s._leader ? Math.abs(t - s._leader.position) < this.restDelta && Math.abs(s._leader.velocity) < this.restSpeed && i : i;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const L = 0.01, M = 500, v = 10;
|
|
69
|
+
class F {
|
|
70
|
+
constructor(e) {
|
|
71
|
+
n(this, "acceleration");
|
|
72
|
+
n(this, "resistance");
|
|
73
|
+
n(this, "resistanceType");
|
|
74
|
+
n(this, "min");
|
|
75
|
+
n(this, "max");
|
|
76
|
+
n(this, "bounceStiffness");
|
|
77
|
+
n(this, "bounceDamping");
|
|
78
|
+
n(this, "restDelta");
|
|
79
|
+
this.acceleration = e.acceleration, this.resistance = e.resistance, this.resistanceType = e.resistanceType ?? "quadratic", this.min = e.min, this.max = e.max, this.bounceStiffness = e.bounceStiffness ?? M, this.bounceDamping = e.bounceDamping ?? v, this.restDelta = e.restDelta ?? L;
|
|
80
|
+
}
|
|
81
|
+
step(e, t, s) {
|
|
82
|
+
const i = Math.min(s, 0.033), { acceleration: r, resistance: p, resistanceType: c, min: d, max: h } = this, { position: o, velocity: l } = e, f = d !== void 0 && o < d, w = h !== void 0 && o > h;
|
|
83
|
+
let u;
|
|
84
|
+
if (f || w) {
|
|
85
|
+
const D = o - (f ? d : h), O = -this.bounceStiffness * D, E = -this.bounceDamping * l;
|
|
86
|
+
u = O + E;
|
|
87
|
+
} else {
|
|
88
|
+
const m = t > o ? 1 : -1;
|
|
89
|
+
let D;
|
|
90
|
+
c === "linear" ? D = p * l : D = p * l * Math.abs(l), u = m * r - D;
|
|
91
|
+
}
|
|
92
|
+
const T = l + u * i;
|
|
93
|
+
let S = o + T * i;
|
|
94
|
+
if (!f && !w) {
|
|
95
|
+
const m = t > o ? 1 : -1;
|
|
96
|
+
(m > 0 && S > t || m < 0 && S < t) && (S = t);
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
position: S,
|
|
100
|
+
velocity: S === t ? 0 : T
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
isSettled(e, t) {
|
|
104
|
+
return Math.abs(t - e.position) < this.restDelta;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
class y {
|
|
108
|
+
/**
|
|
109
|
+
* Create an Integrator from physics config
|
|
110
|
+
*
|
|
111
|
+
* @param config Physics configuration (spring or inertia)
|
|
112
|
+
* @returns Appropriate Integrator instance
|
|
113
|
+
* @throws Error if both spring and inertia are provided
|
|
114
|
+
*/
|
|
115
|
+
static from(e) {
|
|
116
|
+
if (e.spring && e.inertia)
|
|
117
|
+
throw new Error(
|
|
118
|
+
"Cannot use both 'spring' and 'inertia' together. Choose one physics type."
|
|
119
|
+
);
|
|
120
|
+
if (e.inertia)
|
|
121
|
+
return new F({
|
|
122
|
+
acceleration: e.inertia.acceleration,
|
|
123
|
+
resistance: e.inertia.resistance,
|
|
124
|
+
resistanceType: e.inertia.resistanceType,
|
|
125
|
+
min: e.inertia.min,
|
|
126
|
+
max: e.inertia.max,
|
|
127
|
+
bounceStiffness: e.inertia.bounceStiffness,
|
|
128
|
+
bounceDamping: e.inertia.bounceDamping,
|
|
129
|
+
restDelta: e.inertia.restDelta
|
|
130
|
+
});
|
|
131
|
+
const t = e.spring ?? { stiffness: 300, damping: 30 };
|
|
132
|
+
if (t.doubleSpring) {
|
|
133
|
+
const s = t.doubleSpring;
|
|
134
|
+
let i;
|
|
135
|
+
return typeof s == "number" ? i = s : typeof s == "object" && (i = {
|
|
136
|
+
stiffness: s.stiffness,
|
|
137
|
+
damping: s.damping
|
|
138
|
+
}), new H({
|
|
139
|
+
stiffness: t.stiffness,
|
|
140
|
+
damping: t.damping,
|
|
141
|
+
follower: i,
|
|
142
|
+
restDelta: t.restDelta,
|
|
143
|
+
restSpeed: t.restSpeed
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return new b({
|
|
147
|
+
stiffness: t.stiffness,
|
|
148
|
+
damping: t.damping,
|
|
149
|
+
restDelta: t.restDelta,
|
|
150
|
+
restSpeed: t.restSpeed
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Create an Integrator from SpringConfig (legacy support)
|
|
155
|
+
* @deprecated Use from({ spring: config }) instead
|
|
156
|
+
*/
|
|
157
|
+
static fromSpring(e) {
|
|
158
|
+
return y.from({ spring: e });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
H as D,
|
|
163
|
+
y as I,
|
|
164
|
+
x as S,
|
|
165
|
+
b as a,
|
|
166
|
+
F as b
|
|
167
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SsgoiConfig, SsgoiContext, SsgoiInternalOptions } from '../types';
|
|
1
|
+
import { SsgoiConfig, SsgoiContext, SsgoiExtendedContext, SsgoiInternalOptions } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* SSGOI Transition Context Operation Principles
|
|
4
4
|
*
|
|
@@ -31,5 +31,8 @@ import { SsgoiConfig, SsgoiContext, SsgoiInternalOptions } from '../types';
|
|
|
31
31
|
* defaultTransition: fade()
|
|
32
32
|
* });
|
|
33
33
|
*/
|
|
34
|
+
export declare function createSggoiTransitionContext(options: SsgoiConfig, internalOptions: SsgoiInternalOptions & {
|
|
35
|
+
createNavigationDetector: NonNullable<SsgoiInternalOptions["createNavigationDetector"]>;
|
|
36
|
+
}): SsgoiExtendedContext;
|
|
34
37
|
export declare function createSggoiTransitionContext(options: SsgoiConfig, internalOptions?: SsgoiInternalOptions): SsgoiContext;
|
|
35
38
|
//# sourceMappingURL=create-ssgoi-transition-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,oBAAoB,
|
|
1
|
+
{"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAclB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,EACpB,eAAe,EAAE,oBAAoB,GAAG;IACtC,wBAAwB,EAAE,WAAW,CACnC,oBAAoB,CAAC,0BAA0B,CAAC,CACjD,CAAC;CACH,GACA,oBAAoB,CAAC;AACxB,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,EACpB,eAAe,CAAC,EAAE,oBAAoB,GACrC,YAAY,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Detector Strategy
|
|
3
|
+
*
|
|
4
|
+
* Collects out/in navigation events and provides navigation pairs.
|
|
5
|
+
* Each strategy handles the timing differently:
|
|
6
|
+
* - OutFirst: OUT must arrive before IN (for Svelte, Vue)
|
|
7
|
+
* - AnyOrder: OUT and IN can arrive in any order (for React)
|
|
8
|
+
*/
|
|
9
|
+
export type NavigationPair = {
|
|
10
|
+
from: string;
|
|
11
|
+
to: string;
|
|
12
|
+
};
|
|
13
|
+
export interface NavigationDetector {
|
|
14
|
+
/**
|
|
15
|
+
* Trigger navigation event
|
|
16
|
+
*/
|
|
17
|
+
trigger(path: string, type: "out" | "in"): void;
|
|
18
|
+
/**
|
|
19
|
+
* Get navigation pair when ready
|
|
20
|
+
* Returns null if should skip (e.g., page refresh in outFirst mode)
|
|
21
|
+
*/
|
|
22
|
+
get(type: "out" | "in"): Promise<NavigationPair | null>;
|
|
23
|
+
}
|
|
24
|
+
export type CreateNavigationDetector = () => NavigationDetector;
|
|
25
|
+
/**
|
|
26
|
+
* OutFirst Strategy
|
|
27
|
+
*
|
|
28
|
+
* OUT must arrive before IN. Best for frameworks with native destroy callbacks.
|
|
29
|
+
* - OUT triggers first, then IN completes the pair
|
|
30
|
+
* - If IN arrives without OUT, returns null (page refresh case)
|
|
31
|
+
*/
|
|
32
|
+
export declare function createOutFirstDetector(): NavigationDetector;
|
|
33
|
+
/**
|
|
34
|
+
* AnyOrder Strategy
|
|
35
|
+
*
|
|
36
|
+
* OUT and IN can arrive in any order. Best for frameworks using MutationObserver.
|
|
37
|
+
* - Either OUT or IN can arrive first
|
|
38
|
+
* - Both wait indefinitely for the other to complete the pair
|
|
39
|
+
* - If a new path arrives, cancels the previous pending transition
|
|
40
|
+
*/
|
|
41
|
+
export declare function createAnyOrderDetector(): NavigationDetector;
|
|
42
|
+
//# sourceMappingURL=navigation-detector-strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-detector-strategy.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/navigation-detector-strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;IAEhD;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACzD;AAED,MAAM,MAAM,wBAAwB,GAAG,MAAM,kBAAkB,CAAC;AAShE;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,kBAAkB,CAmD3D;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,IAAI,kBAAkB,CA+D3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-transition-callback.d.ts","sourceRoot":"","sources":["../../src/lib/transition/create-transition-callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhF,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAExB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-transition-callback.d.ts","sourceRoot":"","sources":["../../src/lib/transition/create-transition-callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhF,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAExB,MAAM,uBAAuB,CAAC;AAI/B,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,UAAU,CAAC,SAAS,CAAC,EAC1C,OAAO,CAAC,EAAE;IACR,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,kBAAkB,CAAC;IAC5D,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB,GACA,kBAAkB,CAwOpB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MultiAnimationConfig } from '../types';
|
|
2
2
|
import { Animator } from '../animator/types';
|
|
3
3
|
export declare const TRANSITION_STRATEGY: unique symbol;
|
|
4
4
|
export interface StrategyContext {
|
|
@@ -9,11 +9,11 @@ export interface StrategyContext {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Internal animation setup returned by strategy
|
|
12
|
-
* Always uses
|
|
12
|
+
* Always uses MultiAnimationConfig (normalized from user's Single/Multi config)
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export interface InternalAnimationSetup {
|
|
16
|
-
config?:
|
|
16
|
+
config?: MultiAnimationConfig;
|
|
17
17
|
state: {
|
|
18
18
|
position: number;
|
|
19
19
|
velocity: number;
|
|
@@ -24,12 +24,12 @@ export interface InternalAnimationSetup {
|
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Internal transition configs passed to strategy
|
|
27
|
-
* Uses Promise<
|
|
27
|
+
* Uses Promise<MultiAnimationConfig> to allow lazy evaluation
|
|
28
28
|
* @internal
|
|
29
29
|
*/
|
|
30
30
|
export interface InternalTransitionConfigs {
|
|
31
|
-
in?: Promise<
|
|
32
|
-
out?: Promise<
|
|
31
|
+
in?: Promise<MultiAnimationConfig>;
|
|
32
|
+
out?: Promise<MultiAnimationConfig>;
|
|
33
33
|
}
|
|
34
34
|
export interface TransitionStrategy {
|
|
35
35
|
runIn: (configs: InternalTransitionConfigs) => Promise<InternalAnimationSetup>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-strategy.d.ts","sourceRoot":"","sources":["../../src/lib/transition/transition-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"transition-strategy.d.ts","sourceRoot":"","sources":["../../src/lib/transition/transition-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,eAAO,MAAM,mBAAmB,eAAoC,CAAC;AAErE,MAAM,WAAW,eAAe;IAE9B,gBAAgB,EAAE;QAChB,UAAU,EAAE,QAAQ,CAAC;QACrB,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;KACzB,GAAG,IAAI,CAAC;CACV;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,EAAE,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACnC,GAAG,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,CACL,OAAO,EAAE,yBAAyB,KAC/B,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrC,MAAM,EAAE,CACN,OAAO,EAAE,yBAAyB,KAC/B,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,eAAO,MAAM,qBAAqB,GAChC,SAAS,eAAe,KACvB,kBA4GF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,QAAO,kBA4D/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../provider-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../provider-Cs5iBqRD.cjs");function m(e,t){return e!=null&&e.spring||e!=null&&e.inertia||e!=null&&e.integrator?e:{spring:t.spring}}const k=(e={})=>{const{from:t=0,to:n=1,key:c}=e,r=m(e.physics,{spring:{stiffness:300,damping:30}});return{in:()=>({physics:r,css:s=>({opacity:t+(n-t)*s})}),out:()=>({physics:r,css:s=>({opacity:t+(n-t)*s})}),...c&&{key:c}}},I=(e={})=>{const{start:t=0,opacity:n=0,axis:c="both",key:r}=e,s=m(e.physics,{spring:{stiffness:300,damping:30}}),g=a=>{switch(c){case"x":return`scaleX(${a})`;case"y":return`scaleY(${a})`;case"both":default:return`scale(${a})`}},u=a=>{const o=t+(1-t)*a;return{transform:g(o),opacity:n+(1-n)*a}};return{in:()=>({physics:s,css:u}),out:()=>({physics:s,css:u}),...r&&{key:r}}},w=(e={})=>{const{direction:t,distance:n=100,opacity:c=0,fade:r=!0,axis:s,key:g}=e,u=m(e.physics,{spring:{stiffness:400,damping:35}}),o=t||(s==="x"?"left":s==="y"?"up":"left"),l=$=>{const i=1-$;if(typeof n=="number"){const d=i*n;switch(o){case"left":return`translate3d(${-d}px, 0, 0)`;case"right":return`translate3d(${d}px, 0, 0)`;case"up":return`translate3d(0, ${-d}px, 0)`;case"down":return`translate3d(0, ${d}px, 0)`}}else switch(o){case"left":return`translate3d(calc(-1 * ${n} * ${i}), 0, 0)`;case"right":return`translate3d(calc(${n} * ${i}), 0, 0)`;case"up":return`translate3d(0, calc(-1 * ${n} * ${i}), 0)`;case"down":return`translate3d(0, calc(${n} * ${i}), 0)`}},f=$=>{const i={transform:l($)};return r&&(i.opacity=c+(1-c)*$),i};return{in:()=>({physics:u,css:f}),out:()=>({physics:u,css:f}),...g&&{key:g}}},C=(e={})=>{const{degrees:t=360,clockwise:n=!0,scale:c=!1,fade:r=!0,origin:s="center",axis:g="2d",perspective:u=800,key:a}=e,o=m(e.physics,{spring:{stiffness:500,damping:25}}),l=n?t:-t,f=i=>{const d=(1-i)*l;switch(g){case"x":return`perspective(${u}px) rotateX(${d}deg)`;case"y":return`perspective(${u}px) rotateY(${d}deg)`;case"z":return`rotateZ(${d}deg)`;case"2d":default:return`rotate(${d}deg)`}},$=i=>{const d={},y=[f(i)];return c&&y.push(`scale(${i})`),d.transform=y.join(" "),d.transformOrigin=s,r&&(d.opacity=i),d};return{in:()=>({physics:o,css:$}),out:()=>({physics:o,css:$}),...a&&{key:a}}},P=(e={})=>{const{height:t=20,intensity:n=1,scale:c=!0,fade:r=!0,direction:s="up",key:g}=e,u=m(e.physics,{spring:{stiffness:800,damping:15}}),a=o=>{const l={},f=[],$=Math.sin(o*Math.PI*(1+n)),i=1-o,d=$*t*i;if(s==="up"?f.push(`translateY(${-Math.abs(d)}px)`):f.push(`translateY(${Math.abs(d)}px)`),c){const y=.8+o*.2+$*.05*i;f.push(`scale(${y})`)}return l.transform=f.join(" "),r&&(l.opacity=o),l};return{in:()=>({physics:u,css:a}),out:()=>({physics:u,css:a}),...g&&{key:g}}},v=(e={})=>{const{amount:t=10,opacity:n=0,scale:c=!1,fade:r=!0,key:s}=e,g=m(e.physics,{spring:{stiffness:300,damping:30}}),u=a=>{const o=1-a,l={};return typeof t=="number"?l.filter=`blur(${o*t}px)`:l.filter=`blur(calc(${t} * ${o}))`,c&&(l.transform=`scale(${.8+a*.2})`),r&&(l.opacity=n+(1-n)*a),l};return{in:()=>({physics:g,css:u}),out:()=>({physics:g,css:u}),...s&&{key:s}}},M=(e={})=>{const{x:t=0,y:n=-100,opacity:c=0,spring:r,key:s}=e,g={stiffness:(r==null?void 0:r.stiffness)??400,damping:(r==null?void 0:r.damping)??35,doubleSpring:(r==null?void 0:r.doubleSpring)??!1},u=a=>{const o=1-a;let l,f;return typeof t=="number"?l=`${o*t}px`:l=`calc(${t} * ${o})`,typeof n=="number"?f=`${o*n}px`:f=`calc(${n} * ${o})`,{transform:`translate3d(${l}, ${f}, 0)`,opacity:c+(1-c)*a}};return{in:()=>({spring:g,css:u}),out:()=>({spring:g,css:u}),...s&&{key:s}}},D=(e={})=>{const{shape:t="circle",origin:n="center",scale:c=1.5,fade:r=!1,spring:s,key:g}=e,u={stiffness:(s==null?void 0:s.stiffness)??300,damping:(s==null?void 0:s.damping)??30,doubleSpring:(s==null?void 0:s.doubleSpring)??!1},a=()=>{switch(n){case"top":return"50% 0%";case"bottom":return"50% 100%";case"left":return"0% 50%";case"right":return"100% 50%";case"top-left":return"0% 0%";case"top-right":return"100% 0%";case"bottom-left":return"0% 100%";case"bottom-right":return"100% 100%";case"center":default:return"50% 50%"}},o=f=>{const $=f*c*100,i=a();switch(t){case"ellipse":return`ellipse(${$}% ${$*.75}% at ${i})`;case"square":{const d=f*c*100,[y,S]=i.split(" "),b=parseFloat(y),h=parseFloat(S),p=d/2;return`polygon(${b-p}% ${h-p}%, ${b+p}% ${h-p}%, ${b+p}% ${h+p}%, ${b-p}% ${h+p}%)`}case"circle":default:return`circle(${$}% at ${i})`}},l=f=>{const $={clipPath:o(f)};return r&&($.opacity=f),$};return{in:()=>({spring:u,css:l}),out:()=>({spring:u,css:l}),...g&&{key:g}}},z=(e={})=>{const{spring:t,key:n}=e,c={stiffness:(t==null?void 0:t.stiffness)??1e3,damping:(t==null?void 0:t.damping)??100,doubleSpring:(t==null?void 0:t.doubleSpring)??!1};return{in:()=>({spring:c,css:()=>({})}),out:()=>({spring:c,css:()=>({})}),...n&&{key:n}}};exports.DoubleSpringIntegrator=x.DoubleSpringIntegrator;exports.InertiaIntegrator=x.InertiaIntegrator;exports.IntegratorProvider=x.IntegratorProvider;exports.SpringIntegrator=x.SpringIntegrator;exports.blur=v;exports.bounce=P;exports.fade=k;exports.fly=M;exports.mask=D;exports.none=z;exports.rotate=C;exports.scale=I;exports.slide=w;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as v, b as T, I as j, a as q } from "../provider-
|
|
1
|
+
import { D as v, b as T, I as j, a as q } from "../provider-Cu4NSF1Q.js";
|
|
2
2
|
function m(e, t) {
|
|
3
3
|
return e != null && e.spring || e != null && e.inertia || e != null && e.integrator ? e : { spring: t.spring };
|
|
4
4
|
}
|
package/dist/types.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m(t){return("tick"in t||"css"in t)&&!("items"in t)}function a(t){return"items"in t}function d(t){return"css"in t&&typeof t.css=="function"}function p(t){return"tick"in t&&typeof t.tick=="function"}async function f(t){const e=await t;return a(e)?{prepare:e.prepare,wait:e.wait,onStart:e.onStart,onEnd:e.onEnd,items:e.items,schedule:e.schedule}:{prepare:e.prepare,wait:e.wait,onStart:e.onStart,onEnd:e.onEnd,items:[{physics:e.physics,tick:e.tick,css:e.css}],schedule:"parallel"}}function h(t,e){const o=t.schedule??"parallel",r=t.items.map(s=>{let i;switch(o){case"parallel":i=0;break;case"sequential":i=1;break;case"stagger":i=Math.max(0,Math.min(1,s.offset??0));break;default:i=0}const{css:n,offset:k,...c}=s,u=n?typeof n=="function"?e?{element:e,style:n}:void 0:{element:n.element,style:n.style}:void 0;return{...c,css:u,normalizedOffset:i}}),{schedule:y,...l}=t;return{...l,items:r}}exports.isCssAnimation=d;exports.isMultiAnimation=a;exports.isSingleAnimation=m;exports.isTickAnimation=p;exports.normalizeSchedule=h;exports.normalizeToMultiAnimation=f;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Integrator } from './animator/integrator';
|
|
2
|
+
import { CreateNavigationDetector } from './ssgoi-transition/navigation-detector-strategy';
|
|
2
3
|
export type TransitionKey = string | symbol;
|
|
3
4
|
/**
|
|
4
5
|
* Double spring follower configuration
|
|
@@ -26,6 +27,18 @@ export type SpringConfig = {
|
|
|
26
27
|
* - Follower spring: tracks the leader's position (this is the output)
|
|
27
28
|
*/
|
|
28
29
|
doubleSpring?: boolean | number | DoubleSpringFollowerConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Position threshold for settling detection
|
|
32
|
+
* When distance to target is below this, position is considered settled
|
|
33
|
+
* @default 0.01
|
|
34
|
+
*/
|
|
35
|
+
restDelta?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Velocity threshold for settling detection
|
|
38
|
+
* When speed is below this, velocity is considered settled
|
|
39
|
+
* @default 0.01
|
|
40
|
+
*/
|
|
41
|
+
restSpeed?: number;
|
|
29
42
|
};
|
|
30
43
|
/**
|
|
31
44
|
* Resistance type for inertia physics
|
|
@@ -44,6 +57,34 @@ export type InertiaConfig = {
|
|
|
44
57
|
resistance: number;
|
|
45
58
|
/** Resistance type (default: 'quadratic') */
|
|
46
59
|
resistanceType?: ResistanceType;
|
|
60
|
+
/**
|
|
61
|
+
* Minimum boundary value
|
|
62
|
+
* When position goes below this, spring bounce is applied
|
|
63
|
+
*/
|
|
64
|
+
min?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Maximum boundary value
|
|
67
|
+
* When position goes above this, spring bounce is applied
|
|
68
|
+
*/
|
|
69
|
+
max?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Spring stiffness for boundary bounce effect
|
|
72
|
+
* Higher value = stiffer bounce
|
|
73
|
+
* @default 500
|
|
74
|
+
*/
|
|
75
|
+
bounceStiffness?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Spring damping for boundary bounce effect
|
|
78
|
+
* Higher value = faster settling
|
|
79
|
+
* @default 10
|
|
80
|
+
*/
|
|
81
|
+
bounceDamping?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Position threshold for settling detection
|
|
84
|
+
* When distance to target is below this, position is considered settled
|
|
85
|
+
* @default 0.01
|
|
86
|
+
*/
|
|
87
|
+
restDelta?: number;
|
|
47
88
|
};
|
|
48
89
|
/**
|
|
49
90
|
* Custom integrator factory function
|
|
@@ -80,7 +121,7 @@ export type ScheduleType = "parallel" | "sequential" | "stagger";
|
|
|
80
121
|
* Base configuration shared by both single and multi-spring transitions
|
|
81
122
|
*/
|
|
82
123
|
export type BaseTransitionConfig = {
|
|
83
|
-
prepare?: (
|
|
124
|
+
prepare?: () => void;
|
|
84
125
|
wait?: () => Promise<void>;
|
|
85
126
|
onStart?: () => void;
|
|
86
127
|
onEnd?: () => void;
|
|
@@ -120,13 +161,13 @@ export type SingleSpringConfig = BaseTransitionConfig & {
|
|
|
120
161
|
css?: (progress: number) => StyleObject;
|
|
121
162
|
};
|
|
122
163
|
/**
|
|
123
|
-
* Individual
|
|
164
|
+
* Individual animation item in a multi-animation config
|
|
124
165
|
*
|
|
125
166
|
* Supports two animation modes (mutually exclusive):
|
|
126
167
|
* - tick: RAF-based animation with callback on each frame
|
|
127
168
|
* - css: Web Animation API with CSS string generation
|
|
128
169
|
*/
|
|
129
|
-
export type
|
|
170
|
+
export type AnimationItem = {
|
|
130
171
|
/**
|
|
131
172
|
* Physics configuration for animation
|
|
132
173
|
* Choose one: spring (ease-out), inertia (ease-in), or custom integrator
|
|
@@ -192,27 +233,27 @@ export type SpringItem = {
|
|
|
192
233
|
offset?: number;
|
|
193
234
|
};
|
|
194
235
|
/**
|
|
195
|
-
* Multi-
|
|
236
|
+
* Multi-animation configuration
|
|
196
237
|
* Used for complex transitions with multiple coordinated animations
|
|
197
238
|
*/
|
|
198
|
-
export type
|
|
199
|
-
|
|
239
|
+
export type MultiAnimationConfig = BaseTransitionConfig & {
|
|
240
|
+
items: AnimationItem[];
|
|
200
241
|
schedule?: ScheduleType;
|
|
201
242
|
onProgress?: (completed: number, total: number) => void;
|
|
202
243
|
};
|
|
203
244
|
/**
|
|
204
|
-
* Transition configuration - supports both single and multi
|
|
245
|
+
* Transition configuration - supports both single and multi animations
|
|
205
246
|
* Uses Union Type for type safety and backward compatibility
|
|
206
247
|
*/
|
|
207
|
-
export type TransitionConfig = SingleSpringConfig |
|
|
248
|
+
export type TransitionConfig = SingleSpringConfig | MultiAnimationConfig;
|
|
208
249
|
/**
|
|
209
|
-
* Type guard to check if config is single
|
|
250
|
+
* Type guard to check if config is single animation
|
|
210
251
|
*/
|
|
211
|
-
export declare function
|
|
252
|
+
export declare function isSingleAnimation(config: TransitionConfig): config is SingleSpringConfig;
|
|
212
253
|
/**
|
|
213
|
-
* Type guard to check if config is multi-
|
|
254
|
+
* Type guard to check if config is multi-animation
|
|
214
255
|
*/
|
|
215
|
-
export declare function
|
|
256
|
+
export declare function isMultiAnimation(config: TransitionConfig): config is MultiAnimationConfig;
|
|
216
257
|
/**
|
|
217
258
|
* Type guard to check if config uses CSS mode (Web Animation API)
|
|
218
259
|
*/
|
|
@@ -226,22 +267,12 @@ export declare function isTickAnimation(config: SingleSpringConfig): config is S
|
|
|
226
267
|
tick: (progress: number) => void;
|
|
227
268
|
};
|
|
228
269
|
/**
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*/
|
|
232
|
-
export declare function validateAnimationMode(config: SingleSpringConfig): void;
|
|
233
|
-
/**
|
|
234
|
-
* Validate SpringItem doesn't have both tick and css defined
|
|
235
|
-
* @throws Error if both tick and css are defined
|
|
236
|
-
*/
|
|
237
|
-
export declare function validateSpringItem(item: SpringItem): void;
|
|
238
|
-
/**
|
|
239
|
-
* Normalize TransitionConfig to MultiSpringConfig
|
|
240
|
-
* Converts SingleSpringConfig to MultiSpringConfig with single spring item
|
|
270
|
+
* Normalize TransitionConfig to MultiAnimationConfig
|
|
271
|
+
* Converts SingleSpringConfig to MultiAnimationConfig with single animation item
|
|
241
272
|
* Accepts both sync config and Promise<TransitionConfig>
|
|
242
273
|
* @internal
|
|
243
274
|
*/
|
|
244
|
-
export declare function
|
|
275
|
+
export declare function normalizeToMultiAnimation(config: TransitionConfig | Promise<TransitionConfig>): Promise<MultiAnimationConfig>;
|
|
245
276
|
export type GetTransitionConfig<TContext = undefined> = TContext extends undefined ? (node: HTMLElement) => TransitionConfig | Promise<TransitionConfig> : (node: HTMLElement, context: TContext) => TransitionConfig | Promise<TransitionConfig>;
|
|
246
277
|
export type Transition<TContext = undefined> = {
|
|
247
278
|
in?: GetTransitionConfig<TContext>;
|
|
@@ -350,10 +381,28 @@ export type SsgoiInternalOptions = {
|
|
|
350
381
|
* @default true
|
|
351
382
|
*/
|
|
352
383
|
outFirst?: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Custom navigation detector factory
|
|
386
|
+
* If provided, overrides the default detector selection based on outFirst
|
|
387
|
+
* Also returns SsgoiExtendedContext instead of SsgoiContext
|
|
388
|
+
*/
|
|
389
|
+
createNavigationDetector?: CreateNavigationDetector;
|
|
353
390
|
};
|
|
354
391
|
export type SsgoiContext = (path: string) => Transition & {
|
|
355
392
|
key: TransitionKey;
|
|
356
393
|
};
|
|
394
|
+
/**
|
|
395
|
+
* Extended context with additional utilities for frameworks that need
|
|
396
|
+
* pre-transition visibility control (e.g., React with Next.js)
|
|
397
|
+
*/
|
|
398
|
+
export type SsgoiExtendedContext = {
|
|
399
|
+
getTransition: SsgoiContext;
|
|
400
|
+
/**
|
|
401
|
+
* Check if a transition is configured for the given from/to paths
|
|
402
|
+
* Useful for determining initial visibility before transition starts
|
|
403
|
+
*/
|
|
404
|
+
hasMatchingTransition: (from: string, to: string) => boolean;
|
|
405
|
+
};
|
|
357
406
|
/**
|
|
358
407
|
* Normalized schedule entry for internal processing
|
|
359
408
|
* All schedule types are normalized to progress-based offsets (0-1)
|
|
@@ -376,12 +425,12 @@ export type NormalizedScheduleEntry = {
|
|
|
376
425
|
offset: number;
|
|
377
426
|
};
|
|
378
427
|
/**
|
|
379
|
-
* Normalized
|
|
428
|
+
* Normalized animation item for internal use
|
|
380
429
|
* - css is always in object form: { element, style }
|
|
381
430
|
* - normalizedOffset is always present
|
|
382
431
|
* @internal
|
|
383
432
|
*/
|
|
384
|
-
export type
|
|
433
|
+
export type NormalizedAnimationItem = Omit<AnimationItem, "css" | "offset"> & {
|
|
385
434
|
css?: {
|
|
386
435
|
element: HTMLElement;
|
|
387
436
|
style: (progress: number) => StyleObject;
|
|
@@ -389,26 +438,26 @@ export type NormalizedSpringItem = Omit<SpringItem, "css" | "offset"> & {
|
|
|
389
438
|
normalizedOffset: number;
|
|
390
439
|
};
|
|
391
440
|
/**
|
|
392
|
-
* Normalized multi-
|
|
441
|
+
* Normalized multi-animation config for internal use
|
|
393
442
|
* Schedule is always normalized to progress-based offsets
|
|
394
443
|
* @internal
|
|
395
444
|
*/
|
|
396
|
-
export type
|
|
397
|
-
|
|
445
|
+
export type NormalizedMultiAnimationConfig = Omit<MultiAnimationConfig, "items" | "schedule"> & {
|
|
446
|
+
items: NormalizedAnimationItem[];
|
|
398
447
|
};
|
|
399
448
|
/**
|
|
400
|
-
* Normalize
|
|
449
|
+
* Normalize MultiAnimationConfig schedule to progress-based offsets
|
|
401
450
|
*
|
|
402
451
|
* Converts user-facing schedule types to unified offset values:
|
|
403
|
-
* - parallel: All
|
|
404
|
-
* - sequential: All
|
|
405
|
-
* - stagger: Use each
|
|
452
|
+
* - parallel: All items get offset 0 (start together)
|
|
453
|
+
* - sequential: All items get offset 1 (wait for previous)
|
|
454
|
+
* - stagger: Use each item's custom offset (0-1)
|
|
406
455
|
*
|
|
407
456
|
* Also normalizes css to object form: { element, style }
|
|
408
457
|
*
|
|
409
458
|
* @internal
|
|
410
459
|
*/
|
|
411
|
-
export declare function
|
|
460
|
+
export declare function normalizeSchedule(config: MultiAnimationConfig, element?: HTMLElement): NormalizedMultiAnimationConfig;
|
|
412
461
|
/**
|
|
413
462
|
* Animation state
|
|
414
463
|
* For MultiAnimator: returns first animator's state
|
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,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAEhG,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,0BAA0B,CAAC;IAC7D;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,wDAAwD;IACxD,YAAY,EAAE,MAAM,C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