@ssgoi/core 7.2.0 → 7.3.0-beta.1

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 (61) hide show
  1. package/dist/animation/animation.d.ts +21 -0
  2. package/dist/animation/animation.d.ts.map +1 -1
  3. package/dist/animation/host-animation.d.ts +28 -19
  4. package/dist/animation/host-animation.d.ts.map +1 -1
  5. package/dist/animation/multi-animation.d.ts +13 -2
  6. package/dist/animation/multi-animation.d.ts.map +1 -1
  7. package/dist/animation/web-animation.d.ts +69 -3
  8. package/dist/animation/web-animation.d.ts.map +1 -1
  9. package/dist/animation/web-presentation.d.ts +25 -0
  10. package/dist/animation/web-presentation.d.ts.map +1 -0
  11. package/dist/index.cjs +3 -3
  12. package/dist/index.d.ts +4 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1206 -1184
  15. package/dist/internal.cjs +1 -1
  16. package/dist/internal.js +924 -631
  17. package/dist/{page-motion-MEazegOU.js → page-motion-CoPTk-Gd.js} +1 -1
  18. package/dist/{page-motion-DF3fFkOw.cjs → page-motion-Dhj3UfzO.cjs} +1 -1
  19. package/dist/provider-BLf6XeXT.js +291 -0
  20. package/dist/provider-JDtJ5Jzf.cjs +1 -0
  21. package/dist/retain-opacity-BFlsDhI7.cjs +1 -0
  22. package/dist/retain-opacity-Dvv9gi8-.js +1141 -0
  23. package/dist/runtime/index.d.ts +1 -0
  24. package/dist/runtime/index.d.ts.map +1 -1
  25. package/dist/runtime/motion-matching.d.ts +31 -0
  26. package/dist/runtime/motion-matching.d.ts.map +1 -0
  27. package/dist/runtime/timeline.d.ts +6 -2
  28. package/dist/runtime/timeline.d.ts.map +1 -1
  29. package/dist/runtime.cjs +1 -1
  30. package/dist/runtime.js +29 -25
  31. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
  32. package/dist/transitions/blind/transition.d.ts.map +1 -1
  33. package/dist/transitions/crossfade.d.ts +1 -6
  34. package/dist/transitions/crossfade.d.ts.map +1 -1
  35. package/dist/transitions/film/transition.d.ts.map +1 -1
  36. package/dist/transitions/hero/in-place.d.ts +5 -2
  37. package/dist/transitions/hero/in-place.d.ts.map +1 -1
  38. package/dist/transitions/hero/provider/chrome/fade.d.ts.map +1 -1
  39. package/dist/transitions/hero/provider/chrome/static.d.ts.map +1 -1
  40. package/dist/transitions/hero/transition.d.ts.map +1 -1
  41. package/dist/transitions/hero/types.d.ts +2 -1
  42. package/dist/transitions/hero/types.d.ts.map +1 -1
  43. package/dist/transitions/shared-visibility.d.ts +2 -0
  44. package/dist/transitions/shared-visibility.d.ts.map +1 -0
  45. package/dist/transitions/sheet/transition.d.ts.map +1 -1
  46. package/dist/transitions/zoom/crossfade.d.ts.map +1 -1
  47. package/dist/transitions/zoom/provider/blur.d.ts.map +1 -1
  48. package/dist/transitions/zoom/transition.d.ts.map +1 -1
  49. package/dist/transitions/zoom/types.d.ts +2 -1
  50. package/dist/transitions/zoom/types.d.ts.map +1 -1
  51. package/dist/types/index.d.ts +4 -0
  52. package/dist/types/index.d.ts.map +1 -1
  53. package/dist/utils/index.d.ts +1 -0
  54. package/dist/utils/index.d.ts.map +1 -1
  55. package/dist/utils/retain-opacity.d.ts +7 -0
  56. package/dist/utils/retain-opacity.d.ts.map +1 -0
  57. package/package.json +1 -1
  58. package/dist/multi-animation-Du9W3ZS_.js +0 -503
  59. package/dist/multi-animation-hDUcfD7W.cjs +0 -1
  60. package/dist/provider-Cea0Pfm1.js +0 -232
  61. package/dist/provider-D9Q2URox.cjs +0 -1
@@ -1,232 +0,0 @@
1
- var I = Object.defineProperty;
2
- var R = (r, e, t) => e in r ? I(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var n = (r, e, t) => R(r, typeof e != "symbol" ? e + "" : e, t);
4
- let P = class {
5
- constructor() {
6
- /** Current playback rate (1 = realtime, 0 = paused, negative = backwards) */
7
- n(this, "_playbackRate", 1);
8
- /** Fired every frame with the most recent value. Optional. */
9
- n(this, "onUpdate");
10
- /** Fired once when the animation settles. */
11
- n(this, "onComplete");
12
- }
13
- get playbackRate() {
14
- return this._playbackRate;
15
- }
16
- set playbackRate(e) {
17
- this._playbackRate = e;
18
- }
19
- };
20
- const T = 0.01, M = 0.01, A = 0.05, y = 1e3 / 60;
21
- function N(r, e, t, s) {
22
- if (e === t && s === 0) return [];
23
- const i = 600;
24
- let o = { position: e, velocity: s }, a = 0;
25
- const l = [];
26
- for (let p = 0; p < i; p++) {
27
- const c = p * y;
28
- if (l.push({ time: c, position: o.position, velocity: o.velocity }), o = r.step(o, t, y / 1e3), r.isSettled(o, t)) {
29
- if (a += y / 1e3, a >= A) {
30
- l.push({
31
- time: (p + 1) * y,
32
- position: t,
33
- velocity: 0
34
- });
35
- break;
36
- }
37
- } else
38
- a = 0;
39
- }
40
- return l;
41
- }
42
- function U(r, e) {
43
- "worklet";
44
- if (r.length === 0) return { position: 0, velocity: 0 };
45
- const t = r[0], s = r[r.length - 1];
46
- if (e <= 0)
47
- return { position: t.position, velocity: t.velocity };
48
- if (e >= s.time)
49
- return { position: s.position, velocity: s.velocity };
50
- let i = 0, o = r.length - 1;
51
- for (; i < o - 1; ) {
52
- const c = i + o >> 1;
53
- r[c].time <= e ? i = c : o = c;
54
- }
55
- const a = r[i], l = r[o], p = (e - a.time) / (l.time - a.time);
56
- return {
57
- position: a.position + (l.position - a.position) * p,
58
- velocity: a.velocity + (l.velocity - a.velocity) * p
59
- };
60
- }
61
- class b {
62
- constructor(e) {
63
- n(this, "stiffness");
64
- n(this, "damping");
65
- n(this, "omega");
66
- // Angular frequency
67
- n(this, "zeta");
68
- // Damping ratio
69
- n(this, "restDelta");
70
- n(this, "restSpeed");
71
- const { stiffness: t, damping: s } = e, i = 1;
72
- this.stiffness = t, this.damping = s, this.omega = Math.sqrt(t / i), this.zeta = s / (2 * Math.sqrt(t * i)), this.restDelta = e.restDelta ?? T, this.restSpeed = e.restSpeed ?? M;
73
- }
74
- step(e, t, s) {
75
- const i = Math.min(s, 0.033), { omega: o, zeta: a } = this, { position: l, velocity: p } = e, c = -2 * i * a * o * p, d = i * o * o * (t - l), h = p + c + d;
76
- return {
77
- position: l + i * h,
78
- velocity: h
79
- };
80
- }
81
- isSettled(e, t) {
82
- const s = Math.abs(t - e.position), i = Math.abs(e.velocity);
83
- return s < this.restDelta && i < this.restSpeed;
84
- }
85
- }
86
- class O {
87
- constructor(e) {
88
- /** Leader spring values (the follower is derived; see `follower`). */
89
- n(this, "stiffness");
90
- n(this, "damping");
91
- n(this, "leader");
92
- n(this, "follower");
93
- n(this, "restDelta");
94
- n(this, "restSpeed");
95
- this.stiffness = e.stiffness, this.damping = e.damping, this.restDelta = e.restDelta ?? T, this.restSpeed = e.restSpeed ?? M, this.leader = new b({
96
- stiffness: e.stiffness,
97
- damping: e.damping,
98
- restDelta: this.restDelta,
99
- restSpeed: this.restSpeed
100
- });
101
- let t, s, i, o;
102
- 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, o = e.follower.restSpeed) : (t = e.stiffness, s = e.damping), this.follower = new b({
103
- stiffness: t,
104
- damping: s,
105
- restDelta: i ?? this.restDelta,
106
- restSpeed: o ?? this.restSpeed
107
- });
108
- }
109
- step(e, t, s) {
110
- const o = e._leader ?? {
111
- position: e.position,
112
- velocity: e.velocity
113
- }, a = this.leader.step(o, t, s), l = this.follower.step(
114
- e,
115
- a.position,
116
- s
117
- );
118
- return {
119
- position: l.position,
120
- velocity: l.velocity,
121
- _leader: a
122
- };
123
- }
124
- isSettled(e, t) {
125
- const s = e, i = Math.abs(t - e.position) < this.restDelta && Math.abs(e.velocity) < this.restSpeed;
126
- return s._leader ? Math.abs(t - s._leader.position) < this.restDelta && Math.abs(s._leader.velocity) < this.restSpeed && i : i;
127
- }
128
- }
129
- const L = 0.01, g = 500, x = 10;
130
- class H {
131
- constructor(e) {
132
- n(this, "acceleration");
133
- n(this, "resistance");
134
- n(this, "resistanceType");
135
- n(this, "min");
136
- n(this, "max");
137
- n(this, "bounceStiffness");
138
- n(this, "bounceDamping");
139
- n(this, "restDelta");
140
- 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 ?? g, this.bounceDamping = e.bounceDamping ?? x, this.restDelta = e.restDelta ?? L;
141
- }
142
- step(e, t, s) {
143
- const i = Math.min(s, 0.033), { acceleration: o, resistance: a, resistanceType: l, min: p, max: c } = this, { position: d, velocity: h } = e, u = p !== void 0 && d < p, w = c !== void 0 && d > c;
144
- let D;
145
- if (u || w) {
146
- const S = d - (u ? p : c), E = -this.bounceStiffness * S, F = -this.bounceDamping * h;
147
- D = E + F;
148
- } else {
149
- const f = t > d ? 1 : -1;
150
- let S;
151
- l === "linear" ? S = a * h : S = a * h * Math.abs(h), D = f * o - S;
152
- }
153
- const v = h + D * i;
154
- let m = d + v * i;
155
- if (!u && !w) {
156
- const f = t > d ? 1 : -1;
157
- (f > 0 && m > t || f < 0 && m < t) && (m = t);
158
- }
159
- return {
160
- position: m,
161
- velocity: m === t ? 0 : v
162
- };
163
- }
164
- isSettled(e, t) {
165
- return Math.abs(t - e.position) < this.restDelta;
166
- }
167
- }
168
- class _ {
169
- /**
170
- * Create an Integrator from physics config
171
- *
172
- * @param config Physics configuration (spring or inertia)
173
- * @returns Appropriate Integrator instance
174
- * @throws Error if both spring and inertia are provided
175
- */
176
- static from(e) {
177
- if (e.spring && e.inertia)
178
- throw new Error(
179
- "Cannot use both 'spring' and 'inertia' together. Choose one physics type."
180
- );
181
- if (e.inertia)
182
- return new H({
183
- acceleration: e.inertia.acceleration,
184
- resistance: e.inertia.resistance,
185
- resistanceType: e.inertia.resistanceType,
186
- min: e.inertia.min,
187
- max: e.inertia.max,
188
- bounceStiffness: e.inertia.bounceStiffness,
189
- bounceDamping: e.inertia.bounceDamping,
190
- restDelta: e.inertia.restDelta
191
- });
192
- const t = e.spring ?? { stiffness: 300, damping: 30 };
193
- if (t.doubleSpring) {
194
- const s = t.doubleSpring;
195
- let i;
196
- return typeof s == "number" ? i = s : typeof s == "object" && (i = {
197
- stiffness: s.stiffness,
198
- damping: s.damping
199
- }), new O({
200
- stiffness: t.stiffness,
201
- damping: t.damping,
202
- follower: i,
203
- restDelta: t.restDelta,
204
- restSpeed: t.restSpeed
205
- });
206
- }
207
- return new b({
208
- stiffness: t.stiffness,
209
- damping: t.damping,
210
- restDelta: t.restDelta,
211
- restSpeed: t.restSpeed
212
- });
213
- }
214
- /**
215
- * Create an Integrator from SpringConfig (legacy support)
216
- * @deprecated Use from({ spring: config }) instead
217
- */
218
- static fromSpring(e) {
219
- return _.from({ spring: e });
220
- }
221
- }
222
- export {
223
- P as A,
224
- O as D,
225
- _ as I,
226
- T as P,
227
- b as S,
228
- A as a,
229
- H as b,
230
- U as i,
231
- N as s
232
- };
@@ -1 +0,0 @@
1
- "use strict";var g=Object.defineProperty;var L=(r,e,t)=>e in r?g(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var n=(r,e,t)=>L(r,typeof e!="symbol"?e+"":e,t);let H=class{constructor(){n(this,"_playbackRate",1);n(this,"onUpdate");n(this,"onComplete")}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=e}};const w=.01,_=.01,I=.05,D=1e3/60;function A(r,e,t,s){if(e===t&&s===0)return[];const i=600;let o={position:e,velocity:s},a=0;const l=[];for(let p=0;p<i;p++){const c=p*D;if(l.push({time:c,position:o.position,velocity:o.velocity}),o=r.step(o,t,D/1e3),r.isSettled(o,t)){if(a+=D/1e3,a>=I){l.push({time:(p+1)*D,position:t,velocity:0});break}}else a=0}return l}function P(r,e){"worklet";if(r.length===0)return{position:0,velocity:0};const t=r[0],s=r[r.length-1];if(e<=0)return{position:t.position,velocity:t.velocity};if(e>=s.time)return{position:s.position,velocity:s.velocity};let i=0,o=r.length-1;for(;i<o-1;){const c=i+o>>1;r[c].time<=e?i=c:o=c}const a=r[i],l=r[o],p=(e-a.time)/(l.time-a.time);return{position:a.position+(l.position-a.position)*p,velocity:a.velocity+(l.velocity-a.velocity)*p}}class y{constructor(e){n(this,"stiffness");n(this,"damping");n(this,"omega");n(this,"zeta");n(this,"restDelta");n(this,"restSpeed");const{stiffness:t,damping:s}=e,i=1;this.stiffness=t,this.damping=s,this.omega=Math.sqrt(t/i),this.zeta=s/(2*Math.sqrt(t*i)),this.restDelta=e.restDelta??w,this.restSpeed=e.restSpeed??_}step(e,t,s){const i=Math.min(s,.033),{omega:o,zeta:a}=this,{position:l,velocity:p}=e,c=-2*i*a*o*p,d=i*o*o*(t-l),h=p+c+d;return{position:l+i*h,velocity:h}}isSettled(e,t){const s=Math.abs(t-e.position),i=Math.abs(e.velocity);return s<this.restDelta&&i<this.restSpeed}}class M{constructor(e){n(this,"stiffness");n(this,"damping");n(this,"leader");n(this,"follower");n(this,"restDelta");n(this,"restSpeed");this.stiffness=e.stiffness,this.damping=e.damping,this.restDelta=e.restDelta??w,this.restSpeed=e.restSpeed??_,this.leader=new y({stiffness:e.stiffness,damping:e.damping,restDelta:this.restDelta,restSpeed:this.restSpeed});let t,s,i,o;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,o=e.follower.restSpeed):(t=e.stiffness,s=e.damping),this.follower=new y({stiffness:t,damping:s,restDelta:i??this.restDelta,restSpeed:o??this.restSpeed})}step(e,t,s){const o=e._leader??{position:e.position,velocity:e.velocity},a=this.leader.step(o,t,s),l=this.follower.step(e,a.position,s);return{position:l.position,velocity:l.velocity,_leader:a}}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 k=.01,x=500,N=10;class F{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??x,this.bounceDamping=e.bounceDamping??N,this.restDelta=e.restDelta??k}step(e,t,s){const i=Math.min(s,.033),{acceleration:o,resistance:a,resistanceType:l,min:p,max:c}=this,{position:d,velocity:h}=e,u=p!==void 0&&d<p,T=c!==void 0&&d>c;let b;if(u||T){const f=d-(u?p:c),O=-this.bounceStiffness*f,R=-this.bounceDamping*h;b=O+R}else{const S=t>d?1:-1;let f;l==="linear"?f=a*h:f=a*h*Math.abs(h),b=S*o-f}const E=h+b*i;let m=d+E*i;if(!u&&!T){const S=t>d?1:-1;(S>0&&m>t||S<0&&m<t)&&(m=t)}return{position:m,velocity:m===t?0:E}}isSettled(e,t){return Math.abs(t-e.position)<this.restDelta}}class v{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 F({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 M({stiffness:t.stiffness,damping:t.damping,follower:i,restDelta:t.restDelta,restSpeed:t.restSpeed})}return new y({stiffness:t.stiffness,damping:t.damping,restDelta:t.restDelta,restSpeed:t.restSpeed})}static fromSpring(e){return v.from({spring:e})}}exports.Animation=H;exports.DoubleSpringIntegrator=M;exports.InertiaIntegrator=F;exports.IntegratorProvider=v;exports.POSITION_THRESHOLD=w;exports.SETTLE_THRESHOLD=I;exports.SpringIntegrator=y;exports.interpolateFrame=P;exports.simulate=A;