@ssgoi/core 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/animator/integrator/double-spring-integrator.d.ts +6 -0
  2. package/dist/animator/integrator/double-spring-integrator.d.ts.map +1 -1
  3. package/dist/animator/integrator/inertia-integrator.d.ts +15 -0
  4. package/dist/animator/integrator/inertia-integrator.d.ts.map +1 -1
  5. package/dist/animator/integrator/provider.d.ts.map +1 -1
  6. package/dist/animator/integrator/spring-integrator.d.ts +6 -0
  7. package/dist/animator/integrator/spring-integrator.d.ts.map +1 -1
  8. package/dist/animator/multi-animator.d.ts +16 -11
  9. package/dist/animator/multi-animator.d.ts.map +1 -1
  10. package/dist/animator/runner/css-runner.d.ts.map +1 -1
  11. package/dist/animator/single-animator.d.ts +6 -4
  12. package/dist/animator/single-animator.d.ts.map +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +299 -263
  15. package/dist/provider-Cs5iBqRD.cjs +1 -0
  16. package/dist/provider-Cu4NSF1Q.js +167 -0
  17. package/dist/transition/create-transition-callback.d.ts.map +1 -1
  18. package/dist/transition/transition-strategy.d.ts +6 -6
  19. package/dist/transition/transition-strategy.d.ts.map +1 -1
  20. package/dist/transitions/index.cjs +1 -1
  21. package/dist/transitions/index.js +1 -1
  22. package/dist/types.cjs +1 -1
  23. package/dist/types.d.ts +65 -35
  24. package/dist/types.d.ts.map +1 -1
  25. package/dist/types.js +39 -46
  26. package/dist/utils/index.d.ts +1 -0
  27. package/dist/utils/index.d.ts.map +1 -1
  28. package/dist/utils/wait-paint.d.ts +15 -0
  29. package/dist/utils/wait-paint.d.ts.map +1 -0
  30. package/dist/view-transitions/depth.d.ts.map +1 -1
  31. package/dist/view-transitions/drill.d.ts.map +1 -1
  32. package/dist/view-transitions/hero.d.ts.map +1 -1
  33. package/dist/view-transitions/index.cjs +15 -15
  34. package/dist/view-transitions/index.js +673 -688
  35. package/dist/view-transitions/pinterest.d.ts.map +1 -1
  36. package/dist/view-transitions/scroll.d.ts.map +1 -1
  37. package/dist/view-transitions/sheet.d.ts.map +1 -1
  38. package/dist/view-transitions/swap.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/provider-B6Xnh0BA.cjs +0 -1
  41. package/dist/provider-CMBovM_W.js +0 -134
@@ -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 +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;AAG/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,CAkOpB"}
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 { MultiSpringConfig } from '../types';
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 MultiSpringConfig (normalized from user's Single/Multi config)
12
+ * Always uses MultiAnimationConfig (normalized from user's Single/Multi config)
13
13
  * @internal
14
14
  */
15
15
  export interface InternalAnimationSetup {
16
- config?: MultiSpringConfig;
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<MultiSpringConfig> to allow lazy evaluation
27
+ * Uses Promise<MultiAnimationConfig> to allow lazy evaluation
28
28
  * @internal
29
29
  */
30
30
  export interface InternalTransitionConfigs {
31
- in?: Promise<MultiSpringConfig>;
32
- out?: Promise<MultiSpringConfig>;
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,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,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,iBAAiB,CAAC;IAC3B,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,iBAAiB,CAAC,CAAC;IAChC,GAAG,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAClC;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
+ {"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-B6Xnh0BA.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
+ "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-CMBovM_W.js";
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 S(n){return("tick"in n||"css"in n)&&!("springs"in n)}function r(n){return"springs"in n}function o(n){return"css"in n&&typeof n.css=="function"}function a(n){return"tick"in n&&typeof n.tick=="function"}function c(n){if(o(n)&&a(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.")}async function g(n){const i=await n;return r(i)?(i.springs.forEach(l),i):(c(i),{prepare:i.prepare,wait:i.wait,onStart:i.onStart,onEnd:i.onEnd,springs:[{physics:i.physics,tick:i.tick,css:i.css}],schedule:"parallel"})}function m(n,i){const u=n.schedule??"parallel",p=n.springs.map(s=>{let e;switch(u){case"parallel":e=0;break;case"sequential":e=1;break;case"stagger":e=Math.max(0,Math.min(1,s.offset??0));break;default:e=0}const{css:t,offset:y,...f}=s,h=t?typeof t=="function"?i?{element:i,style:t}:void 0:{element:t.element,style:t.style}:void 0;return{...f,css:h,normalizedOffset:e}}),{schedule:k,...d}=n;return{...d,springs:p}}exports.isCssAnimation=o;exports.isMultiSpring=r;exports.isSingleSpring=S;exports.isTickAnimation=a;exports.normalizeMultiSpringSchedule=m;exports.normalizeToMultiSpring=g;exports.validateAnimationMode=c;exports.validateSpringItem=l;
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
@@ -26,6 +26,18 @@ export type SpringConfig = {
26
26
  * - Follower spring: tracks the leader's position (this is the output)
27
27
  */
28
28
  doubleSpring?: boolean | number | DoubleSpringFollowerConfig;
29
+ /**
30
+ * Position threshold for settling detection
31
+ * When distance to target is below this, position is considered settled
32
+ * @default 0.01
33
+ */
34
+ restDelta?: number;
35
+ /**
36
+ * Velocity threshold for settling detection
37
+ * When speed is below this, velocity is considered settled
38
+ * @default 0.01
39
+ */
40
+ restSpeed?: number;
29
41
  };
30
42
  /**
31
43
  * Resistance type for inertia physics
@@ -44,6 +56,34 @@ export type InertiaConfig = {
44
56
  resistance: number;
45
57
  /** Resistance type (default: 'quadratic') */
46
58
  resistanceType?: ResistanceType;
59
+ /**
60
+ * Minimum boundary value
61
+ * When position goes below this, spring bounce is applied
62
+ */
63
+ min?: number;
64
+ /**
65
+ * Maximum boundary value
66
+ * When position goes above this, spring bounce is applied
67
+ */
68
+ max?: number;
69
+ /**
70
+ * Spring stiffness for boundary bounce effect
71
+ * Higher value = stiffer bounce
72
+ * @default 500
73
+ */
74
+ bounceStiffness?: number;
75
+ /**
76
+ * Spring damping for boundary bounce effect
77
+ * Higher value = faster settling
78
+ * @default 10
79
+ */
80
+ bounceDamping?: number;
81
+ /**
82
+ * Position threshold for settling detection
83
+ * When distance to target is below this, position is considered settled
84
+ * @default 0.01
85
+ */
86
+ restDelta?: number;
47
87
  };
48
88
  /**
49
89
  * Custom integrator factory function
@@ -80,7 +120,7 @@ export type ScheduleType = "parallel" | "sequential" | "stagger";
80
120
  * Base configuration shared by both single and multi-spring transitions
81
121
  */
82
122
  export type BaseTransitionConfig = {
83
- prepare?: (element: HTMLElement) => void;
123
+ prepare?: () => void;
84
124
  wait?: () => Promise<void>;
85
125
  onStart?: () => void;
86
126
  onEnd?: () => void;
@@ -120,13 +160,13 @@ export type SingleSpringConfig = BaseTransitionConfig & {
120
160
  css?: (progress: number) => StyleObject;
121
161
  };
122
162
  /**
123
- * Individual spring item in a multi-spring animation
163
+ * Individual animation item in a multi-animation config
124
164
  *
125
165
  * Supports two animation modes (mutually exclusive):
126
166
  * - tick: RAF-based animation with callback on each frame
127
167
  * - css: Web Animation API with CSS string generation
128
168
  */
129
- export type SpringItem = {
169
+ export type AnimationItem = {
130
170
  /**
131
171
  * Physics configuration for animation
132
172
  * Choose one: spring (ease-out), inertia (ease-in), or custom integrator
@@ -192,27 +232,27 @@ export type SpringItem = {
192
232
  offset?: number;
193
233
  };
194
234
  /**
195
- * Multi-spring configuration
235
+ * Multi-animation configuration
196
236
  * Used for complex transitions with multiple coordinated animations
197
237
  */
198
- export type MultiSpringConfig = BaseTransitionConfig & {
199
- springs: SpringItem[];
238
+ export type MultiAnimationConfig = BaseTransitionConfig & {
239
+ items: AnimationItem[];
200
240
  schedule?: ScheduleType;
201
241
  onProgress?: (completed: number, total: number) => void;
202
242
  };
203
243
  /**
204
- * Transition configuration - supports both single and multi-spring animations
244
+ * Transition configuration - supports both single and multi animations
205
245
  * Uses Union Type for type safety and backward compatibility
206
246
  */
207
- export type TransitionConfig = SingleSpringConfig | MultiSpringConfig;
247
+ export type TransitionConfig = SingleSpringConfig | MultiAnimationConfig;
208
248
  /**
209
- * Type guard to check if config is single spring
249
+ * Type guard to check if config is single animation
210
250
  */
211
- export declare function isSingleSpring(config: TransitionConfig): config is SingleSpringConfig;
251
+ export declare function isSingleAnimation(config: TransitionConfig): config is SingleSpringConfig;
212
252
  /**
213
- * Type guard to check if config is multi-spring
253
+ * Type guard to check if config is multi-animation
214
254
  */
215
- export declare function isMultiSpring(config: TransitionConfig): config is MultiSpringConfig;
255
+ export declare function isMultiAnimation(config: TransitionConfig): config is MultiAnimationConfig;
216
256
  /**
217
257
  * Type guard to check if config uses CSS mode (Web Animation API)
218
258
  */
@@ -226,22 +266,12 @@ export declare function isTickAnimation(config: SingleSpringConfig): config is S
226
266
  tick: (progress: number) => void;
227
267
  };
228
268
  /**
229
- * Validate that config doesn't have both tick and css defined
230
- * @throws Error if both tick and css are defined
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
269
+ * Normalize TransitionConfig to MultiAnimationConfig
270
+ * Converts SingleSpringConfig to MultiAnimationConfig with single animation item
241
271
  * Accepts both sync config and Promise<TransitionConfig>
242
272
  * @internal
243
273
  */
244
- export declare function normalizeToMultiSpring(config: TransitionConfig | Promise<TransitionConfig>): Promise<MultiSpringConfig>;
274
+ export declare function normalizeToMultiAnimation(config: TransitionConfig | Promise<TransitionConfig>): Promise<MultiAnimationConfig>;
245
275
  export type GetTransitionConfig<TContext = undefined> = TContext extends undefined ? (node: HTMLElement) => TransitionConfig | Promise<TransitionConfig> : (node: HTMLElement, context: TContext) => TransitionConfig | Promise<TransitionConfig>;
246
276
  export type Transition<TContext = undefined> = {
247
277
  in?: GetTransitionConfig<TContext>;
@@ -376,12 +406,12 @@ export type NormalizedScheduleEntry = {
376
406
  offset: number;
377
407
  };
378
408
  /**
379
- * Normalized spring item for internal use
409
+ * Normalized animation item for internal use
380
410
  * - css is always in object form: { element, style }
381
411
  * - normalizedOffset is always present
382
412
  * @internal
383
413
  */
384
- export type NormalizedSpringItem = Omit<SpringItem, "css" | "offset"> & {
414
+ export type NormalizedAnimationItem = Omit<AnimationItem, "css" | "offset"> & {
385
415
  css?: {
386
416
  element: HTMLElement;
387
417
  style: (progress: number) => StyleObject;
@@ -389,26 +419,26 @@ export type NormalizedSpringItem = Omit<SpringItem, "css" | "offset"> & {
389
419
  normalizedOffset: number;
390
420
  };
391
421
  /**
392
- * Normalized multi-spring config for internal use
422
+ * Normalized multi-animation config for internal use
393
423
  * Schedule is always normalized to progress-based offsets
394
424
  * @internal
395
425
  */
396
- export type NormalizedMultiSpringConfig = Omit<MultiSpringConfig, "springs" | "schedule"> & {
397
- springs: NormalizedSpringItem[];
426
+ export type NormalizedMultiAnimationConfig = Omit<MultiAnimationConfig, "items" | "schedule"> & {
427
+ items: NormalizedAnimationItem[];
398
428
  };
399
429
  /**
400
- * Normalize MultiSpringConfig schedule to progress-based offsets
430
+ * Normalize MultiAnimationConfig schedule to progress-based offsets
401
431
  *
402
432
  * Converts user-facing schedule types to unified offset values:
403
- * - parallel: All springs get offset 0 (start together)
404
- * - sequential: All springs get offset 1 (wait for previous)
405
- * - stagger: Use each spring's custom offset (0-1)
433
+ * - parallel: All items get offset 0 (start together)
434
+ * - sequential: All items get offset 1 (wait for previous)
435
+ * - stagger: Use each item's custom offset (0-1)
406
436
  *
407
437
  * Also normalizes css to object form: { element, style }
408
438
  *
409
439
  * @internal
410
440
  */
411
- export declare function normalizeMultiSpringSchedule(config: MultiSpringConfig, element?: HTMLElement): NormalizedMultiSpringConfig;
441
+ export declare function normalizeSchedule(config: MultiAnimationConfig, element?: HTMLElement): NormalizedMultiAnimationConfig;
412
442
  /**
413
443
  * Animation state
414
444
  * For MultiAnimator: returns first animator's state
@@ -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;AAExD,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;CAC9D,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,CAAC;IACrB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAA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AAE,EAAE,MAAM,CAAC;CACZ,CAAC"}
package/dist/types.js CHANGED
@@ -1,35 +1,30 @@
1
- function S(n) {
2
- return ("tick" in n || "css" in n) && !("springs" in n);
1
+ function p(t) {
2
+ return ("tick" in t || "css" in t) && !("items" in t);
3
3
  }
4
- function u(n) {
5
- return "springs" in n;
4
+ function u(t) {
5
+ return "items" in t;
6
6
  }
7
- function p(n) {
8
- return "css" in n && typeof n.css == "function";
7
+ function f(t) {
8
+ return "css" in t && typeof t.css == "function";
9
9
  }
10
- function d(n) {
11
- return "tick" in n && typeof n.tick == "function";
10
+ function h(t) {
11
+ return "tick" in t && typeof t.tick == "function";
12
12
  }
13
- function f(n) {
14
- if (p(n) && d(n))
15
- throw new Error(
16
- "SingleSpringConfig cannot have both 'tick' and 'css' defined. Use one or the other."
17
- );
18
- }
19
- function h(n) {
20
- if (n.tick && n.css)
21
- throw new Error(
22
- "SpringItem cannot have both 'tick' and 'css' defined. Use one or the other."
23
- );
24
- }
25
- async function k(n) {
26
- const e = await n;
27
- return u(e) ? (e.springs.forEach(h), e) : (f(e), {
13
+ async function k(t) {
14
+ const e = await t;
15
+ return u(e) ? {
28
16
  prepare: e.prepare,
29
17
  wait: e.wait,
30
18
  onStart: e.onStart,
31
19
  onEnd: e.onEnd,
32
- springs: [
20
+ items: e.items,
21
+ schedule: e.schedule
22
+ } : {
23
+ prepare: e.prepare,
24
+ wait: e.wait,
25
+ onStart: e.onStart,
26
+ onEnd: e.onEnd,
27
+ items: [
33
28
  {
34
29
  physics: e.physics,
35
30
  tick: e.tick,
@@ -37,41 +32,39 @@ async function k(n) {
37
32
  }
38
33
  ],
39
34
  schedule: "parallel"
40
- });
35
+ };
41
36
  }
42
- function y(n, e) {
43
- const r = n.schedule ?? "parallel", o = n.springs.map(
37
+ function y(t, e) {
38
+ const a = t.schedule ?? "parallel", r = t.items.map(
44
39
  (i) => {
45
- let t;
46
- switch (r) {
40
+ let n;
41
+ switch (a) {
47
42
  case "parallel":
48
- t = 0;
43
+ n = 0;
49
44
  break;
50
45
  case "sequential":
51
- t = 1;
46
+ n = 1;
52
47
  break;
53
48
  case "stagger":
54
- t = Math.max(0, Math.min(1, i.offset ?? 0));
49
+ n = Math.max(0, Math.min(1, i.offset ?? 0));
55
50
  break;
56
51
  default:
57
- t = 0;
52
+ n = 0;
58
53
  }
59
- const { css: s, offset: m, ...c } = i, l = s ? typeof s == "function" ? e ? { element: e, style: s } : void 0 : { element: s.element, style: s.style } : void 0;
60
- return { ...c, css: l, normalizedOffset: t };
54
+ const { css: s, offset: d, ...c } = i, l = s ? typeof s == "function" ? e ? { element: e, style: s } : void 0 : { element: s.element, style: s.style } : void 0;
55
+ return { ...c, css: l, normalizedOffset: n };
61
56
  }
62
- ), { schedule: g, ...a } = n;
57
+ ), { schedule: m, ...o } = t;
63
58
  return {
64
- ...a,
65
- springs: o
59
+ ...o,
60
+ items: r
66
61
  };
67
62
  }
68
63
  export {
69
- p as isCssAnimation,
70
- u as isMultiSpring,
71
- S as isSingleSpring,
72
- d as isTickAnimation,
73
- y as normalizeMultiSpringSchedule,
74
- k as normalizeToMultiSpring,
75
- f as validateAnimationMode,
76
- h as validateSpringItem
64
+ f as isCssAnimation,
65
+ u as isMultiAnimation,
66
+ p as isSingleAnimation,
67
+ h as isTickAnimation,
68
+ y as normalizeSchedule,
69
+ k as normalizeToMultiAnimation
77
70
  };
@@ -5,4 +5,5 @@ export { sleep } from './sleep';
5
5
  export { getRect } from './get-rect';
6
6
  export { round, floor, ceil, toFixed } from './number';
7
7
  export { withResolvers } from './with-resolvers';
8
+ export { waitPaint } from './wait-paint';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Waits for the browser to complete a paint cycle.
3
+ *
4
+ * This ensures that any style changes have been applied and the element
5
+ * has been painted to the screen before starting animations.
6
+ *
7
+ * Currently uses double requestAnimationFrame as a reliable cross-browser
8
+ * approach. In the future, this could be replaced with a native API when
9
+ * available (e.g., a proposed `element.waitForPaint()` or similar).
10
+ *
11
+ * @param _element - The element to wait for (reserved for future API usage)
12
+ * @returns A promise that resolves after the paint cycle completes
13
+ */
14
+ export declare function waitPaint(_element?: Element): Promise<void>;
15
+ //# sourceMappingURL=wait-paint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-paint.d.ts","sourceRoot":"","sources":["../../src/lib/utils/wait-paint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,wBAAgB,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAW3D"}