@ssgoi/core 7.0.4 → 7.1.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 (50) hide show
  1. package/dist/animation/animation.d.ts +4 -66
  2. package/dist/animation/animation.d.ts.map +1 -1
  3. package/dist/animation/integrator/provider.d.ts +1 -1
  4. package/dist/animation/integrator/provider.d.ts.map +1 -1
  5. package/dist/animation/web-animation.d.ts.map +1 -1
  6. package/dist/index.cjs +15 -15
  7. package/dist/index.js +1189 -1345
  8. package/dist/internal.cjs +1 -1
  9. package/dist/internal.js +545 -709
  10. package/dist/multi-animation-B5hEmEgN.cjs +1 -0
  11. package/dist/{multi-animation-ZFZBDBGr.js → multi-animation-DyZGEfKy.js} +72 -128
  12. package/dist/page-motion-gH3WomQO.cjs +1 -0
  13. package/dist/page-motion-wmW7PW6B.js +204 -0
  14. package/dist/resolve-transition-rule-BL12rDDu.cjs +1 -0
  15. package/dist/resolve-transition-rule-DbkMu0rm.js +160 -0
  16. package/dist/runtime/animation.d.ts +68 -0
  17. package/dist/runtime/animation.d.ts.map +1 -0
  18. package/dist/runtime/index.d.ts +12 -0
  19. package/dist/runtime/index.d.ts.map +1 -0
  20. package/dist/runtime/motion-state.d.ts +25 -0
  21. package/dist/runtime/motion-state.d.ts.map +1 -0
  22. package/dist/runtime/page-motion.d.ts +27 -0
  23. package/dist/runtime/page-motion.d.ts.map +1 -0
  24. package/dist/runtime/physics.d.ts +30 -0
  25. package/dist/runtime/physics.d.ts.map +1 -0
  26. package/dist/runtime/presence.d.ts +20 -0
  27. package/dist/runtime/presence.d.ts.map +1 -0
  28. package/dist/runtime/resolve-transition-rule.d.ts +21 -0
  29. package/dist/runtime/resolve-transition-rule.d.ts.map +1 -0
  30. package/dist/runtime/timeline.d.ts +12 -0
  31. package/dist/runtime/timeline.d.ts.map +1 -0
  32. package/dist/runtime/types.d.ts +53 -0
  33. package/dist/runtime/types.d.ts.map +1 -0
  34. package/dist/runtime.cjs +1 -0
  35. package/dist/runtime.d.ts +2 -0
  36. package/dist/runtime.js +51 -0
  37. package/dist/ssgoi-transition/navigation-direction.d.ts +3 -4
  38. package/dist/ssgoi-transition/navigation-direction.d.ts.map +1 -1
  39. package/dist/ssgoi-transition/path-pattern.d.ts +1 -1
  40. package/dist/ssgoi-transition/path-pattern.d.ts.map +1 -1
  41. package/dist/ssgoi-transition/resolve-transition-rule.d.ts +2 -20
  42. package/dist/ssgoi-transition/resolve-transition-rule.d.ts.map +1 -1
  43. package/dist/timeline-L_vXntmP.js +68 -0
  44. package/dist/timeline-Zoo1I4XU.cjs +1 -0
  45. package/dist/transitions/fade/transition.d.ts.map +1 -1
  46. package/dist/transitions/slide/transition.d.ts.map +1 -1
  47. package/dist/types/index.d.ts +17 -147
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/package.json +7 -1
  50. package/dist/multi-animation-6124HEke.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";var S=Object.defineProperty;var v=(a,r,t)=>r in a?S(a,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[r]=t;var i=(a,r,t)=>v(a,typeof r!="symbol"?r+"":r,t);const c=require("./timeline-Zoo1I4XU.cjs");class p extends c.Animation{}function b(a){return new Promise(r=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})})})}const R=1e3/60,g=1e3/30,w=g+1;class C{constructor(){i(this,"drivers",new Set);i(this,"observers",new Set);i(this,"frameRequest",null);i(this,"previousTimestamp",null);i(this,"tick",r=>{this.frameRequest=null;const t=this.previousTimestamp===null?R:Math.max(0,r-this.previousTimestamp);this.previousTimestamp=r;const e={delta:Math.min(t,g),rawDelta:t};this.runPhase(this.drivers,e),this.runPhase(this.observers,e),this.hasCallbacks()?this.requestFrame():this.previousTimestamp=null})}subscribe(r,t="drive"){const e=t==="drive"?this.drivers:this.observers;return e.add(r),this.requestFrame(),()=>{e.delete(r),this.stopIfIdle()}}requestFrame(){this.frameRequest!==null||!this.hasCallbacks()||(this.frameRequest=requestAnimationFrame(this.tick))}runPhase(r,t){for(const e of[...r])r.has(e)&&e(t)}hasCallbacks(){return this.drivers.size>0||this.observers.size>0}stopIfIdle(){this.hasCallbacks()||(this.frameRequest!==null&&typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(this.frameRequest),this.frameRequest=null,this.previousTimestamp=null)}}const y=new C,k=2;class A extends p{constructor(t){super();i(this,"element");i(this,"integrator");i(this,"styleFn");i(this,"lowerBound");i(this,"upperBound");i(this,"currentValue");i(this,"currentVelocity",0);i(this,"frames",[]);i(this,"waapi",null);i(this,"runId",0);i(this,"waitingForStart",!1);i(this,"startReady",!1);i(this,"pendingFirstFrame");i(this,"stopStartupClock",null);i(this,"startupStableFrames",0);i(this,"running",!1);i(this,"paused",!1);i(this,"settled",!1);i(this,"reversing",!1);this.element=t.element,this.integrator=t.integrator,this.styleFn=t.style,this.lowerBound=t.lowerBound??0,this.upperBound=t.upperBound??1,this.currentValue=this.lowerBound,this.onUpdate=t.onUpdate,this.onComplete=t.onComplete}play(){if(this.reversing=!1,this.paused&&this.waapi){if(this.paused=!1,this.running=!0,this.waitingForStart){this.startReady&&this.startFramePacedPlayback(this.waapi);return}this.waapi.play();return}this.runToward(this.upperBound)}reverse(){this.reversing=!0,this.runToward(this.lowerBound)}pause(){var t,e;this.running&&(this.captureLiveState(),(t=this.waapi)==null||t.pause(),(e=this.stopStartupClock)==null||e.call(this),this.stopStartupClock=null,this.running=!1,this.paused=!0)}complete(){var t;this.clearWaapi(),this.running=!1,this.paused=!1,this.currentValue=this.upperBound,this.currentVelocity=0,this.applyStyleAt(this.currentValue),this.settled=!0,(t=this.onComplete)==null||t.call(this)}releaseFill(){this.clearWaapi()}get isAnimating(){return this.running}get isPaused(){return this.paused}get isComplete(){return this.settled}get isReversing(){return this.reversing}get progress(){this.running&&this.captureLiveState();const t=this.upperBound-this.lowerBound;if(t===0)return 0;const e=(this.currentValue-this.lowerBound)/t;return e<0?0:e>1?1:e}findTimeForProgress(t){if(this.frames.length<2)return null;const e=this.upperBound-this.lowerBound;if(e===0)return 0;for(const s of this.frames)if((s.position-this.lowerBound)/e>=t)return s.time;return this.frames[this.frames.length-1].time}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t,this.waapi&&(this.waapi.playbackRate=t)}getPose(){return this.running&&this.captureLiveState(),[{element:this.element,value:this.currentValue,velocity:this.currentVelocity}]}getTimeline(){const t=this.frames.map(e=>{const s=e.position,n=this.lowerBound+this.upperBound-s;return{time:e.time,value:e.position,velocity:e.velocity,style:this.styleFn(s,n)}});return[{element:this.element,frames:t}]}matchInto(t){const e=t.find(s=>s.element===this.element);e&&(this.currentValue=e.value,this.currentVelocity=e.velocity)}runToward(t){var d;if(this.running&&this.captureLiveState(),this.clearWaapi(),this.running=!1,this.paused=!1,this.settled=!1,this.frames=c.simulate(this.integrator,this.currentValue,t,this.currentVelocity),this.frames.length===0){this.currentValue=t,this.currentVelocity=0,this.applyStyleAt(t),this.settled=!0,(d=this.onComplete)==null||d.call(this);return}const e=this.frames.map(o=>{const m=o.position,F=this.lowerBound+this.upperBound-m;return this.styleFn(m,F)}),s=e[0],n=this.frames[this.frames.length-1],h=n.time,u=++this.runId,l=this.element.animate(e,{duration:h,fill:"both",easing:"linear",composite:"replace"});l.playbackRate=this.playbackRate,l.currentTime=0,l.pause(),this.waapi=l,this.waitingForStart=!0,this.startReady=!1,this.pendingFirstFrame=s,this.running=!0,l.onfinish=()=>{var o;!this.running||this.waapi!==l||(this.running=!1,this.settled=!0,this.currentValue=n.position,this.currentVelocity=0,(o=this.onComplete)==null||o.call(this))},this.startWhenReady(l,u)}clearWaapi(){var t,e;this.runId++,(t=this.waapi)==null||t.cancel(),this.waapi=null,this.waitingForStart=!1,this.startReady=!1,this.pendingFirstFrame=void 0,(e=this.stopStartupClock)==null||e.call(this),this.stopStartupClock=null,this.startupStableFrames=0}captureLiveState(){if(this.frames.length===0)return;const t=f(this.waapi);if(t===null)return;const{position:e,velocity:s}=c.interpolateFrame(this.frames,t);this.currentValue=e,this.currentVelocity=s}async startWhenReady(t,e){try{await t.ready,typeof requestAnimationFrame<"u"&&await b(this.element)}catch{return}this.runId!==e||this.waapi!==t||(this.startReady=!0,!(!this.running||this.paused)&&this.startFramePacedPlayback(t))}startFramePacedPlayback(t){if(!(this.waapi!==t||!this.waitingForStart||!this.startReady||this.stopStartupClock)){if(this.pendingFirstFrame)for(const e of Object.keys(this.pendingFirstFrame))this.element.style[e]="";if(this.pendingFirstFrame=void 0,typeof requestAnimationFrame>"u"||this.playbackRate<0){this.handOffToWaapi(t);return}this.startupStableFrames=0,this.stopStartupClock=y.subscribe(e=>{this.advanceFramePacedStartup(t,e)})}}advanceFramePacedStartup(t,e){if(this.waapi!==t||!this.running||this.paused||!this.waitingForStart)return;const s=this.frames[this.frames.length-1];if(!s)return;const n=f(t)??0,h=Math.min(s.time,n+e.delta*Math.max(0,this.playbackRate));if(t.currentTime=h,this.captureLiveState(),h>=s.time){this.finishFramePacedRun(t,s);return}e.rawDelta<=w?this.startupStableFrames++:this.startupStableFrames=0,!(this.startupStableFrames<k)&&this.handOffToWaapi(t)}handOffToWaapi(t){var e;this.waapi!==t||!this.running||this.paused||((e=this.stopStartupClock)==null||e.call(this),this.stopStartupClock=null,this.waitingForStart=!1,this.startReady=!1,this.startupStableFrames=0,t.play())}finishFramePacedRun(t,e){var s,n;this.waapi!==t||!this.running||((s=this.stopStartupClock)==null||s.call(this),this.stopStartupClock=null,this.waitingForStart=!1,this.startReady=!1,this.startupStableFrames=0,this.running=!1,this.settled=!0,this.currentValue=e.position,this.currentVelocity=0,(n=this.onComplete)==null||n.call(this))}applyStyleAt(t){const e=this.lowerBound+this.upperBound-t,s=this.styleFn(t,e);for(const[n,h]of Object.entries(s))this.element.style[n]=typeof h=="number"?String(h):h}}function f(a){const r=a==null?void 0:a.currentTime;return typeof r=="number"?r:null}class T extends p{constructor(t,e={}){super();i(this,"children");i(this,"startAt");i(this,"pendingComplete",0);i(this,"running",!1);i(this,"pendingStartObservers",[]);this.children=t,(e.mode??"parallel")==="sequence"?this.startAt=t.map((s,n)=>n===0?0:1):this.startAt=e.startAt??[]}play(){this.startRun("play")}reverse(){this.startRun("reverse")}pause(){this.running=!1,this.clearPendingStartObservers();for(const t of this.children)t.pause()}complete(){var t;this.running=!1,this.clearPendingStartObservers();for(const e of this.children)e.complete();(t=this.onComplete)==null||t.call(this)}get progress(){if(this.children.length===0)return 0;let t=0;for(const e of this.children)t+=e.progress;return t/this.children.length}getPose(){return this.children.flatMap(t=>t.getPose())}getTimeline(){return this.children.flatMap(t=>t.getTimeline())}matchInto(t){}get isAnimating(){return this.children.some(t=>t.isAnimating)}get isPaused(){return this.children.some(t=>t.isPaused)&&this.children.every(t=>t.isPaused||t.isComplete)}get isComplete(){return this.children.every(t=>t.isComplete)}get isReversing(){return this.children.some(t=>t.isReversing)}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t;for(const e of this.children)e.playbackRate=t}startRun(t){if(this.running&&this.pause(),this.running=!0,this.pendingComplete=this.children.length,this.pendingComplete===0){this.handleFinished();return}for(const e of this.children){const s=e.onComplete;e.onComplete=()=>{s==null||s(),this.handleChildComplete()}}this.scheduleStart(0,t)}scheduleStart(t,e){if(!this.running||t>=this.children.length)return;this.children[t][e]();const s=t+1;if(s>=this.children.length)return;const n=this.startAt[s];if(n===void 0||n<=0){this.scheduleStart(s,e);return}const h=this.children[t];if(this.hasReachedThreshold(h,n,e)){this.scheduleStart(s,e);return}const u=y.subscribe(()=>{this.running&&this.hasReachedThreshold(h,n,e)&&(u(),this.pendingStartObservers=this.pendingStartObservers.filter(l=>l!==u),this.scheduleStart(s,e))},"observe");this.pendingStartObservers.push(u)}hasReachedThreshold(t,e,s){return t.isComplete?!0:(s==="play"?t.progress:1-t.progress)>=e}clearPendingStartObservers(){for(const t of this.pendingStartObservers)t();this.pendingStartObservers=[]}handleChildComplete(){this.pendingComplete--,this.pendingComplete<=0&&this.handleFinished()}handleFinished(){var t;this.running=!1,this.clearPendingStartObservers(),(t=this.onComplete)==null||t.call(this)}findTimeForProgress(t){return null}}exports.Animation=p;exports.MultiAnimation=T;exports.WebAnimation=A;
@@ -1,62 +1,48 @@
1
- var S = Object.defineProperty;
2
- var F = (a, i, t) => i in a ? S(a, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[i] = t;
3
- var r = (a, i, t) => F(a, typeof i != "symbol" ? i + "" : i, t);
4
- class f {
5
- constructor() {
6
- /** Current playback rate (1 = realtime, 0 = paused, negative = backwards) */
7
- r(this, "_playbackRate", 1);
8
- /** Fired every frame with the most recent value. Optional. */
9
- r(this, "onUpdate");
10
- /** Fired once when the animation settles. */
11
- r(this, "onComplete");
12
- }
13
- get playbackRate() {
14
- return this._playbackRate;
15
- }
16
- set playbackRate(i) {
17
- this._playbackRate = i;
18
- }
1
+ var F = Object.defineProperty;
2
+ var S = (a, r, t) => r in a ? F(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
3
+ var i = (a, r, t) => S(a, typeof r != "symbol" ? r + "" : r, t);
4
+ import { A as v, s as b, i as R } from "./timeline-L_vXntmP.js";
5
+ class m extends v {
19
6
  }
20
- const O = 0.01, V = 0.01, b = 0.05;
21
- function R(a) {
22
- return new Promise((i) => {
7
+ function w(a) {
8
+ return new Promise((r) => {
23
9
  requestAnimationFrame(() => {
24
10
  requestAnimationFrame(() => {
25
- i();
11
+ r();
26
12
  });
27
13
  });
28
14
  });
29
15
  }
30
- const T = 1e3 / 60, g = 1e3 / 30, k = g + 1;
31
- class w {
16
+ const C = 1e3 / 60, f = 1e3 / 30, k = f + 1;
17
+ class A {
32
18
  constructor() {
33
- r(this, "drivers", /* @__PURE__ */ new Set());
34
- r(this, "observers", /* @__PURE__ */ new Set());
35
- r(this, "frameRequest", null);
36
- r(this, "previousTimestamp", null);
37
- r(this, "tick", (i) => {
19
+ i(this, "drivers", /* @__PURE__ */ new Set());
20
+ i(this, "observers", /* @__PURE__ */ new Set());
21
+ i(this, "frameRequest", null);
22
+ i(this, "previousTimestamp", null);
23
+ i(this, "tick", (r) => {
38
24
  this.frameRequest = null;
39
- const t = this.previousTimestamp === null ? T : Math.max(0, i - this.previousTimestamp);
40
- this.previousTimestamp = i;
25
+ const t = this.previousTimestamp === null ? C : Math.max(0, r - this.previousTimestamp);
26
+ this.previousTimestamp = r;
41
27
  const e = {
42
- delta: Math.min(t, g),
28
+ delta: Math.min(t, f),
43
29
  rawDelta: t
44
30
  };
45
31
  this.runPhase(this.drivers, e), this.runPhase(this.observers, e), this.hasCallbacks() ? this.requestFrame() : this.previousTimestamp = null;
46
32
  });
47
33
  }
48
- subscribe(i, t = "drive") {
34
+ subscribe(r, t = "drive") {
49
35
  const e = t === "drive" ? this.drivers : this.observers;
50
- return e.add(i), this.requestFrame(), () => {
51
- e.delete(i), this.stopIfIdle();
36
+ return e.add(r), this.requestFrame(), () => {
37
+ e.delete(r), this.stopIfIdle();
52
38
  };
53
39
  }
54
40
  requestFrame() {
55
41
  this.frameRequest !== null || !this.hasCallbacks() || (this.frameRequest = requestAnimationFrame(this.tick));
56
42
  }
57
- runPhase(i, t) {
58
- for (const e of [...i])
59
- i.has(e) && e(t);
43
+ runPhase(r, t) {
44
+ for (const e of [...r])
45
+ r.has(e) && e(t);
60
46
  }
61
47
  hasCallbacks() {
62
48
  return this.drivers.size > 0 || this.observers.size > 0;
@@ -65,29 +51,29 @@ class w {
65
51
  this.hasCallbacks() || (this.frameRequest !== null && typeof cancelAnimationFrame < "u" && cancelAnimationFrame(this.frameRequest), this.frameRequest = null, this.previousTimestamp = null);
66
52
  }
67
53
  }
68
- const y = new w(), p = 1e3 / 60, C = 2;
69
- class _ extends f {
54
+ const g = new A(), T = 2;
55
+ class V extends m {
70
56
  constructor(t) {
71
57
  super();
72
- r(this, "element");
73
- r(this, "integrator");
74
- r(this, "styleFn");
75
- r(this, "lowerBound");
76
- r(this, "upperBound");
77
- r(this, "currentValue");
78
- r(this, "currentVelocity", 0);
79
- r(this, "frames", []);
80
- r(this, "waapi", null);
81
- r(this, "runId", 0);
82
- r(this, "waitingForStart", !1);
83
- r(this, "startReady", !1);
84
- r(this, "pendingFirstFrame");
85
- r(this, "stopStartupClock", null);
86
- r(this, "startupStableFrames", 0);
87
- r(this, "running", !1);
88
- r(this, "paused", !1);
89
- r(this, "settled", !1);
90
- r(this, "reversing", !1);
58
+ i(this, "element");
59
+ i(this, "integrator");
60
+ i(this, "styleFn");
61
+ i(this, "lowerBound");
62
+ i(this, "upperBound");
63
+ i(this, "currentValue");
64
+ i(this, "currentVelocity", 0);
65
+ i(this, "frames", []);
66
+ i(this, "waapi", null);
67
+ i(this, "runId", 0);
68
+ i(this, "waitingForStart", !1);
69
+ i(this, "startReady", !1);
70
+ i(this, "pendingFirstFrame");
71
+ i(this, "stopStartupClock", null);
72
+ i(this, "startupStableFrames", 0);
73
+ i(this, "running", !1);
74
+ i(this, "paused", !1);
75
+ i(this, "settled", !1);
76
+ i(this, "reversing", !1);
91
77
  this.element = t.element, this.integrator = t.integrator, this.styleFn = t.style, this.lowerBound = t.lowerBound ?? 0, this.upperBound = t.upperBound ?? 1, this.currentValue = this.lowerBound, this.onUpdate = t.onUpdate, this.onComplete = t.onComplete;
92
78
  }
93
79
  play() {
@@ -182,19 +168,19 @@ class _ extends f {
182
168
  }
183
169
  /* ───────────────────────────────────────────────────────── private */
184
170
  runToward(t) {
185
- var o;
186
- if (this.running && this.captureLiveState(), this.clearWaapi(), this.running = !1, this.paused = !1, this.settled = !1, this.frames = A(
171
+ var c;
172
+ if (this.running && this.captureLiveState(), this.clearWaapi(), this.running = !1, this.paused = !1, this.settled = !1, this.frames = b(
187
173
  this.integrator,
188
174
  this.currentValue,
189
175
  t,
190
176
  this.currentVelocity
191
177
  ), this.frames.length === 0) {
192
- this.currentValue = t, this.currentVelocity = 0, this.applyStyleAt(t), this.settled = !0, (o = this.onComplete) == null || o.call(this);
178
+ this.currentValue = t, this.currentVelocity = 0, this.applyStyleAt(t), this.settled = !0, (c = this.onComplete) == null || c.call(this);
193
179
  return;
194
180
  }
195
- const e = this.frames.map((c) => {
196
- const d = c.position, v = this.lowerBound + this.upperBound - d;
197
- return this.styleFn(d, v);
181
+ const e = this.frames.map((o) => {
182
+ const p = o.position, y = this.lowerBound + this.upperBound - p;
183
+ return this.styleFn(p, y);
198
184
  }), s = e[0], n = this.frames[this.frames.length - 1], h = n.time, u = ++this.runId, l = this.element.animate(e, {
199
185
  duration: h,
200
186
  fill: "both",
@@ -202,8 +188,8 @@ class _ extends f {
202
188
  composite: "replace"
203
189
  });
204
190
  l.playbackRate = this.playbackRate, l.currentTime = 0, l.pause(), this.waapi = l, this.waitingForStart = !0, this.startReady = !1, this.pendingFirstFrame = s, this.running = !0, l.onfinish = () => {
205
- var c;
206
- !this.running || this.waapi !== l || (this.running = !1, this.settled = !0, this.currentValue = n.position, this.currentVelocity = 0, (c = this.onComplete) == null || c.call(this));
191
+ var o;
192
+ !this.running || this.waapi !== l || (this.running = !1, this.settled = !0, this.currentValue = n.position, this.currentVelocity = 0, (o = this.onComplete) == null || o.call(this));
207
193
  }, this.startWhenReady(l, u);
208
194
  }
209
195
  clearWaapi() {
@@ -212,14 +198,14 @@ class _ extends f {
212
198
  }
213
199
  captureLiveState() {
214
200
  if (this.frames.length === 0) return;
215
- const t = m(this.waapi);
201
+ const t = d(this.waapi);
216
202
  if (t === null) return;
217
- const { position: e, velocity: s } = P(this.frames, t);
203
+ const { position: e, velocity: s } = R(this.frames, t);
218
204
  this.currentValue = e, this.currentVelocity = s;
219
205
  }
220
206
  async startWhenReady(t, e) {
221
207
  try {
222
- await t.ready, typeof requestAnimationFrame < "u" && await R(this.element);
208
+ await t.ready, typeof requestAnimationFrame < "u" && await w(this.element);
223
209
  } catch {
224
210
  return;
225
211
  }
@@ -234,7 +220,7 @@ class _ extends f {
234
220
  this.handOffToWaapi(t);
235
221
  return;
236
222
  }
237
- this.startupStableFrames = 0, this.stopStartupClock = y.subscribe((e) => {
223
+ this.startupStableFrames = 0, this.stopStartupClock = g.subscribe((e) => {
238
224
  this.advanceFramePacedStartup(t, e);
239
225
  });
240
226
  }
@@ -244,7 +230,7 @@ class _ extends f {
244
230
  return;
245
231
  const s = this.frames[this.frames.length - 1];
246
232
  if (!s) return;
247
- const n = m(t) ?? 0, h = Math.min(
233
+ const n = d(t) ?? 0, h = Math.min(
248
234
  s.time,
249
235
  n + e.delta * Math.max(0, this.playbackRate)
250
236
  );
@@ -252,7 +238,7 @@ class _ extends f {
252
238
  this.finishFramePacedRun(t, s);
253
239
  return;
254
240
  }
255
- e.rawDelta <= k ? this.startupStableFrames++ : this.startupStableFrames = 0, !(this.startupStableFrames < C) && this.handOffToWaapi(t);
241
+ e.rawDelta <= k ? this.startupStableFrames++ : this.startupStableFrames = 0, !(this.startupStableFrames < T) && this.handOffToWaapi(t);
256
242
  }
257
243
  handOffToWaapi(t) {
258
244
  var e;
@@ -268,57 +254,18 @@ class _ extends f {
268
254
  this.element.style[n] = typeof h == "number" ? String(h) : h;
269
255
  }
270
256
  }
271
- function A(a, i, t, e) {
272
- if (i === t && e === 0) return [];
273
- const s = 600;
274
- let n = { position: i, velocity: e }, h = 0;
275
- const u = [];
276
- for (let l = 0; l < s; l++) {
277
- const o = l * p;
278
- if (u.push({ time: o, position: n.position, velocity: n.velocity }), n = a.step(n, t, p / 1e3), a.isSettled(n, t)) {
279
- if (h += p / 1e3, h >= b) {
280
- u.push({
281
- time: (l + 1) * p,
282
- position: t,
283
- velocity: 0
284
- });
285
- break;
286
- }
287
- } else
288
- h = 0;
289
- }
290
- return u;
291
- }
292
- function P(a, i) {
293
- if (a.length === 0) return { position: 0, velocity: 0 };
294
- const t = a[0], e = a[a.length - 1];
295
- if (i <= 0)
296
- return { position: t.position, velocity: t.velocity };
297
- if (i >= e.time)
298
- return { position: e.position, velocity: e.velocity };
299
- let s = 0, n = a.length - 1;
300
- for (; s < n - 1; ) {
301
- const o = s + n >> 1;
302
- a[o].time <= i ? s = o : n = o;
303
- }
304
- const h = a[s], u = a[n], l = (i - h.time) / (u.time - h.time);
305
- return {
306
- position: h.position + (u.position - h.position) * l,
307
- velocity: h.velocity + (u.velocity - h.velocity) * l
308
- };
309
- }
310
- function m(a) {
311
- const i = a == null ? void 0 : a.currentTime;
312
- return typeof i == "number" ? i : null;
257
+ function d(a) {
258
+ const r = a == null ? void 0 : a.currentTime;
259
+ return typeof r == "number" ? r : null;
313
260
  }
314
- class M extends f {
261
+ class q extends m {
315
262
  constructor(t, e = {}) {
316
263
  super();
317
- r(this, "children");
318
- r(this, "startAt");
319
- r(this, "pendingComplete", 0);
320
- r(this, "running", !1);
321
- r(this, "pendingStartObservers", []);
264
+ i(this, "children");
265
+ i(this, "startAt");
266
+ i(this, "pendingComplete", 0);
267
+ i(this, "running", !1);
268
+ i(this, "pendingStartObservers", []);
322
269
  this.children = t, (e.mode ?? "parallel") === "sequence" ? this.startAt = t.map((s, n) => n === 0 ? 0 : 1) : this.startAt = e.startAt ?? [];
323
270
  }
324
271
  play() {
@@ -404,7 +351,7 @@ class M extends f {
404
351
  this.scheduleStart(s, e);
405
352
  return;
406
353
  }
407
- const u = y.subscribe(() => {
354
+ const u = g.subscribe(() => {
408
355
  this.running && this.hasReachedThreshold(h, n, e) && (u(), this.pendingStartObservers = this.pendingStartObservers.filter(
409
356
  (l) => l !== u
410
357
  ), this.scheduleStart(s, e));
@@ -430,10 +377,7 @@ class M extends f {
430
377
  }
431
378
  }
432
379
  export {
433
- f as A,
434
- M,
435
- O as P,
436
- b as S,
437
- V,
438
- _ as W
380
+ m as A,
381
+ q as M,
382
+ V as W
439
383
  };
@@ -0,0 +1 @@
1
+ "use strict";var F=Object.defineProperty;var v=(i,e,t)=>e in i?F(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var r=(i,e,t)=>v(i,typeof e!="symbol"?e+"":e,t);const h=require("./timeline-Zoo1I4XU.cjs");class b{constructor(e){r(this,"omega");r(this,"zeta");r(this,"restDelta");r(this,"restSpeed");const{stiffness:t,damping:s}=e,n=1;this.omega=Math.sqrt(t/n),this.zeta=s/(2*Math.sqrt(t*n)),this.restDelta=e.restDelta??h.POSITION_THRESHOLD,this.restSpeed=e.restSpeed??h.VELOCITY_THRESHOLD}step(e,t,s){const n=Math.min(s,.033),{omega:o,zeta:a}=this,{position:p,velocity:d}=e,m=-2*n*a*o*d,l=n*o*o*(t-p),c=d+m+l;return{position:p+n*c,velocity:c}}isSettled(e,t){const s=Math.abs(t-e.position),n=Math.abs(e.velocity);return s<this.restDelta&&n<this.restSpeed}}class H{constructor(e){r(this,"leader");r(this,"follower");r(this,"restDelta");r(this,"restSpeed");this.restDelta=e.restDelta??h.POSITION_THRESHOLD,this.restSpeed=e.restSpeed??h.VELOCITY_THRESHOLD,this.leader=new b({stiffness:e.stiffness,damping:e.damping,restDelta:this.restDelta,restSpeed:this.restSpeed});let t,s,n,o;typeof e.follower=="number"?(t=e.stiffness*e.follower,s=e.damping):e.follower?(t=e.follower.stiffness,s=e.follower.damping,n=e.follower.restDelta,o=e.follower.restSpeed):(t=e.stiffness,s=e.damping),this.follower=new b({stiffness:t,damping:s,restDelta:n??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),p=this.follower.step(e,a.position,s);return{position:p.position,velocity:p.velocity,_leader:a}}isSettled(e,t){const s=e,n=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&&n:n}}const L=.01,C=500,N=10;class x{constructor(e){r(this,"acceleration");r(this,"resistance");r(this,"resistanceType");r(this,"min");r(this,"max");r(this,"bounceStiffness");r(this,"bounceDamping");r(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??C,this.bounceDamping=e.bounceDamping??N,this.restDelta=e.restDelta??L}step(e,t,s){const n=Math.min(s,.033),{acceleration:o,resistance:a,resistanceType:p,min:d,max:m}=this,{position:l,velocity:c}=e,D=d!==void 0&&l<d,_=m!==void 0&&l>m;let I;if(D||_){const u=l-(D?d:m),O=-this.bounceStiffness*u,P=-this.bounceDamping*c;I=O+P}else{const f=t>l?1:-1;let u;p==="linear"?u=a*c:u=a*c*Math.abs(c),I=f*o-u}const T=c+I*n;let S=l+T*n;if(!D&&!_){const f=t>l?1:-1;(f>0&&S>t||f<0&&S<t)&&(S=t)}return{position:S,velocity:S===t?0:T}}isSettled(e,t){return Math.abs(t-e.position)<this.restDelta}}class w{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 x({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 n;return typeof s=="number"?n=s:typeof s=="object"&&(n={stiffness:s.stiffness,damping:s.damping}),new H({stiffness:t.stiffness,damping:t.damping,follower:n,restDelta:t.restDelta,restSpeed:t.restSpeed})}return new b({stiffness:t.stiffness,damping:t.damping,restDelta:t.restDelta,restSpeed:t.restSpeed})}static fromSpring(e){return w.from({spring:e})}}const E={spring:{stiffness:180,damping:20,doubleSpring:!0}},M={spring:{stiffness:170,damping:20,doubleSpring:!0}},y={spring:{stiffness:170,damping:22,doubleSpring:.8}};function g(i,e=0){var n,o;const t=((n=i.integrator)==null?void 0:n.call(i))??w.from(i),s=h.simulate(t,0,1,0);if(s.some(a=>!Number.isFinite(a.position)||!Number.isFinite(a.velocity)))throw new Error("SSGOI: physics produced a non-finite timeline.");return{frames:s,offset:e,duration:((o=s[s.length-1])==null?void 0:o.time)??0}}function A(i,e,t){const s=g(t??(i==="fade"?E:y)),n=g(t??(i==="fade"?M:y),i==="fade"?s.duration:0);return{kind:i,direction:e,out:s,in:n,duration:Math.max(s.duration,n.offset+n.duration)}}function Y(i,e,t,s){"worklet";return i==="fade"?{opacity:e==="in"?s:1-s,x:0}:{opacity:1,x:(t==="forward"?1:-1)*(e==="in"?1-s:-s)}}exports.FADE_IN_PHYSICS=M;exports.FADE_OUT_PHYSICS=E;exports.IntegratorProvider=w;exports.SLIDE_PHYSICS=y;exports.SpringIntegrator=b;exports.createPageMotionPlan=A;exports.pageMotionStyle=Y;
@@ -0,0 +1,204 @@
1
+ var E = Object.defineProperty;
2
+ var O = (i, e, t) => e in i ? E(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var r = (i, e, t) => O(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { P as _, V as g, s as P } from "./timeline-L_vXntmP.js";
5
+ class b {
6
+ constructor(e) {
7
+ r(this, "omega");
8
+ // Angular frequency
9
+ r(this, "zeta");
10
+ // Damping ratio
11
+ r(this, "restDelta");
12
+ r(this, "restSpeed");
13
+ const { stiffness: t, damping: s } = e, n = 1;
14
+ this.omega = Math.sqrt(t / n), this.zeta = s / (2 * Math.sqrt(t * n)), this.restDelta = e.restDelta ?? _, this.restSpeed = e.restSpeed ?? g;
15
+ }
16
+ step(e, t, s) {
17
+ const n = Math.min(s, 0.033), { omega: o, zeta: a } = this, { position: c, velocity: d } = e, f = -2 * n * a * o * d, l = n * o * o * (t - c), p = d + f + l;
18
+ return {
19
+ position: c + n * p,
20
+ velocity: p
21
+ };
22
+ }
23
+ isSettled(e, t) {
24
+ const s = Math.abs(t - e.position), n = Math.abs(e.velocity);
25
+ return s < this.restDelta && n < this.restSpeed;
26
+ }
27
+ }
28
+ class x {
29
+ constructor(e) {
30
+ r(this, "leader");
31
+ r(this, "follower");
32
+ r(this, "restDelta");
33
+ r(this, "restSpeed");
34
+ this.restDelta = e.restDelta ?? _, this.restSpeed = e.restSpeed ?? g, 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, n, o;
41
+ typeof e.follower == "number" ? (t = e.stiffness * e.follower, s = e.damping) : e.follower ? (t = e.follower.stiffness, s = e.follower.damping, n = e.follower.restDelta, o = e.follower.restSpeed) : (t = e.stiffness, s = e.damping), this.follower = new b({
42
+ stiffness: t,
43
+ damping: s,
44
+ restDelta: n ?? this.restDelta,
45
+ restSpeed: o ?? this.restSpeed
46
+ });
47
+ }
48
+ step(e, t, s) {
49
+ const o = e._leader ?? {
50
+ position: e.position,
51
+ velocity: e.velocity
52
+ }, a = this.leader.step(o, t, s), c = this.follower.step(
53
+ e,
54
+ a.position,
55
+ s
56
+ );
57
+ return {
58
+ position: c.position,
59
+ velocity: c.velocity,
60
+ _leader: a
61
+ };
62
+ }
63
+ isSettled(e, t) {
64
+ const s = e, n = 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 && n : n;
66
+ }
67
+ }
68
+ const H = 0.01, L = 500, N = 10;
69
+ class C {
70
+ constructor(e) {
71
+ r(this, "acceleration");
72
+ r(this, "resistance");
73
+ r(this, "resistanceType");
74
+ r(this, "min");
75
+ r(this, "max");
76
+ r(this, "bounceStiffness");
77
+ r(this, "bounceDamping");
78
+ r(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 ?? L, this.bounceDamping = e.bounceDamping ?? N, this.restDelta = e.restDelta ?? H;
80
+ }
81
+ step(e, t, s) {
82
+ const n = Math.min(s, 0.033), { acceleration: o, resistance: a, resistanceType: c, min: d, max: f } = this, { position: l, velocity: p } = e, h = d !== void 0 && l < d, y = f !== void 0 && l > f;
83
+ let D;
84
+ if (h || y) {
85
+ const u = l - (h ? d : f), F = -this.bounceStiffness * u, v = -this.bounceDamping * p;
86
+ D = F + v;
87
+ } else {
88
+ const S = t > l ? 1 : -1;
89
+ let u;
90
+ c === "linear" ? u = a * p : u = a * p * Math.abs(p), D = S * o - u;
91
+ }
92
+ const I = p + D * n;
93
+ let m = l + I * n;
94
+ if (!h && !y) {
95
+ const S = t > l ? 1 : -1;
96
+ (S > 0 && m > t || S < 0 && m < t) && (m = t);
97
+ }
98
+ return {
99
+ position: m,
100
+ velocity: m === t ? 0 : I
101
+ };
102
+ }
103
+ isSettled(e, t) {
104
+ return Math.abs(t - e.position) < this.restDelta;
105
+ }
106
+ }
107
+ class w {
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 C({
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 n;
135
+ return typeof s == "number" ? n = s : typeof s == "object" && (n = {
136
+ stiffness: s.stiffness,
137
+ damping: s.damping
138
+ }), new x({
139
+ stiffness: t.stiffness,
140
+ damping: t.damping,
141
+ follower: n,
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 w.from({ spring: e });
159
+ }
160
+ }
161
+ const A = {
162
+ spring: { stiffness: 180, damping: 20, doubleSpring: !0 }
163
+ }, U = {
164
+ spring: { stiffness: 170, damping: 20, doubleSpring: !0 }
165
+ }, M = {
166
+ spring: { stiffness: 170, damping: 22, doubleSpring: 0.8 }
167
+ };
168
+ function T(i, e = 0) {
169
+ var n, o;
170
+ const t = ((n = i.integrator) == null ? void 0 : n.call(i)) ?? w.from(i), s = P(t, 0, 1, 0);
171
+ if (s.some(
172
+ (a) => !Number.isFinite(a.position) || !Number.isFinite(a.velocity)
173
+ ))
174
+ throw new Error("SSGOI: physics produced a non-finite timeline.");
175
+ return { frames: s, offset: e, duration: ((o = s[s.length - 1]) == null ? void 0 : o.time) ?? 0 };
176
+ }
177
+ function Y(i, e, t) {
178
+ const s = T(
179
+ t ?? (i === "fade" ? A : M)
180
+ ), n = T(
181
+ t ?? (i === "fade" ? U : M),
182
+ i === "fade" ? s.duration : 0
183
+ );
184
+ return {
185
+ kind: i,
186
+ direction: e,
187
+ out: s,
188
+ in: n,
189
+ duration: Math.max(s.duration, n.offset + n.duration)
190
+ };
191
+ }
192
+ function q(i, e, t, s) {
193
+ "worklet";
194
+ return i === "fade" ? { opacity: e === "in" ? s : 1 - s, x: 0 } : { opacity: 1, x: (t === "forward" ? 1 : -1) * (e === "in" ? 1 - s : -s) };
195
+ }
196
+ export {
197
+ U as F,
198
+ w as I,
199
+ b as S,
200
+ A as a,
201
+ M as b,
202
+ Y as c,
203
+ q as p
204
+ };
@@ -0,0 +1 @@
1
+ "use strict";function A(i){const t=i.trim(),m=t.indexOf("#"),n=t.indexOf("?"),r=[m,n].filter(e=>e>=0).reduce((e,l)=>Math.min(e,l),t.length);return t.slice(0,r)}function E(i){const t=A(i);try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t))return E(new URL(t).pathname)}catch{}const n=(t.startsWith("/")?t:`/${t}`).replace(/\/+/g,"/");return(n.length>1?n.replace(/\/+$/g,""):n)||"/"}function R(i){const t=i.trim();return t==="*"?"/**":E(t)}function T(i){return i==="/"?[]:i.slice(1).split("/")}function x(i){return i.startsWith(":")||i.startsWith("[")&&i.endsWith("]")||i.startsWith("{")&&i.endsWith("}")}function v(i,t){const m=E(i),n=R(t);if(m===n)return{matched:!0,specificity:1e6+T(n).length*100,pattern:t};const r=T(m),e=T(n);let l=0;for(let p=0;p<e.length;p++){const s=e[p],f=r[p],d=p===e.length-1;if(s==="**")return{matched:d&&r.length>=p,specificity:l,pattern:t};if(f===void 0||s===void 0)return{matched:!1,specificity:0,pattern:t};if(s==="*"){l+=1;continue}if(x(s)){l+=10;continue}if(s!==f)return{matched:!1,specificity:0,pattern:t};l+=100}return{matched:r.length===e.length,specificity:l,pattern:t}}function S(i,t){const m=typeof t=="string"?[t]:t;let n=null;for(const r of m){const e=v(i,r);e.matched&&(!n||e.specificity>n.specificity)&&(n=e)}return n}function I(i,t){return v(i,t).matched}const g={from:!0,to:!1},L={from:!0,to:!0};function M(i,t){return t?i.priority!==t.priority?i.priority>t.priority:i.specificity!==t.specificity?i.specificity>t.specificity:i.ruleIndex<t.ruleIndex:!0}function _(i,t){return t==="forward"?{from:i.from,to:i.to}:{from:i.to,to:i.from}}function O(i,t,m,n){let r=null;return m.forEach((e,l)=>{const p=e.priority??0;let s=null;if(e.on!==void 0){const f=e.except!==void 0&&S(i,e.except)!==null,d=e.except!==void 0&&S(t,e.except)!==null,c=f?null:S(i,e.on),o=d?null:S(t,e.on);if(c||o){const a=!c&&o?"forward":c&&!o?"backward":n,y=!c&&o?"on-enter":c&&!o?"on-leave":"on-history",h=e.preserveScroll??g;s={transition:e.transition,direction:a,ruleIndex:l,priority:p,specificity:Math.max((c==null?void 0:c.specificity)??0,(o==null?void 0:o.specificity)??0),reason:y,preserveScroll:y==="on-history"?{from:h.to,to:h.to}:_(h,a)}}}else if(e.ordered!==void 0){let f=-1,d=-1,c=-1,o=-1;if(e.ordered.forEach((a,y)=>{const h=S(i,a);h&&h.specificity>c&&(f=y,c=h.specificity);const u=S(t,a);u&&u.specificity>o&&(d=y,o=u.specificity)}),f>=0&&d>=0&&f!==d){const a=f<d?"forward":"backward";s={transition:e.transition,direction:a,ruleIndex:l,priority:p,specificity:c+o,reason:"ordered",preserveScroll:_(e.preserveScroll??L,a)}}}else{const f=S(i,e.from),d=S(t,e.to),c=e.bidirectional===!1?null:S(i,e.to),o=e.bidirectional===!1?null:S(t,e.from),a=f&&d,y=c&&o;if(a||y){const h=a?f.specificity+d.specificity:-1,u=y?c.specificity+o.specificity:-1,C=a&&y&&h===u?n:h>=u?"forward":"backward";s={transition:e.transition,direction:C,ruleIndex:l,priority:p,specificity:Math.max(h,u),reason:"pair",preserveScroll:_(e.preserveScroll??g,C)}}}s&&M(s,r)&&(r=s)}),r}exports.matchPath=I;exports.normalizePath=E;exports.resolveTransitionRule=O;