@ssgoi/core 7.1.2 → 7.1.3-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 (122) hide show
  1. package/README.md +58 -10
  2. package/dist/animation/animation.d.ts +20 -0
  3. package/dist/animation/animation.d.ts.map +1 -1
  4. package/dist/animation/integrator/double-spring-integrator.d.ts +3 -0
  5. package/dist/animation/integrator/double-spring-integrator.d.ts.map +1 -1
  6. package/dist/animation/integrator/inertia-integrator.d.ts +2 -2
  7. package/dist/animation/integrator/inertia-integrator.d.ts.map +1 -1
  8. package/dist/animation/integrator/spring-integrator.d.ts +2 -0
  9. package/dist/animation/integrator/spring-integrator.d.ts.map +1 -1
  10. package/dist/animation/multi-animation.d.ts +37 -9
  11. package/dist/animation/multi-animation.d.ts.map +1 -1
  12. package/dist/animation/web-animation.d.ts +20 -2
  13. package/dist/animation/web-animation.d.ts.map +1 -1
  14. package/dist/index-B_K3Vnj-.js +55 -0
  15. package/dist/index-CtyacfH7.cjs +1 -0
  16. package/dist/index.cjs +4 -4
  17. package/dist/index.d.ts +8 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1612 -1251
  20. package/dist/internal.cjs +1 -1
  21. package/dist/internal.d.ts +1 -0
  22. package/dist/internal.d.ts.map +1 -1
  23. package/dist/internal.js +5 -3
  24. package/dist/motion/index.d.ts +4 -0
  25. package/dist/motion/index.d.ts.map +1 -0
  26. package/dist/motion/presets.d.ts +13 -0
  27. package/dist/motion/presets.d.ts.map +1 -0
  28. package/dist/motion/spring.d.ts +46 -0
  29. package/dist/motion/spring.d.ts.map +1 -0
  30. package/dist/motion/with-override.d.ts +2 -0
  31. package/dist/motion/with-override.d.ts.map +1 -0
  32. package/dist/multi-animation-Du9W3ZS_.js +503 -0
  33. package/dist/multi-animation-hDUcfD7W.cjs +1 -0
  34. package/dist/page-motion-DF3fFkOw.cjs +1 -0
  35. package/dist/page-motion-MEazegOU.js +43 -0
  36. package/dist/provider-Cea0Pfm1.js +232 -0
  37. package/dist/provider-D9Q2URox.cjs +1 -0
  38. package/dist/runtime.cjs +1 -1
  39. package/dist/runtime.js +12 -12
  40. package/dist/transition/define-transition.d.ts +52 -0
  41. package/dist/transition/define-transition.d.ts.map +1 -0
  42. package/dist/transitions/animation-group.d.ts +7 -0
  43. package/dist/transitions/animation-group.d.ts.map +1 -0
  44. package/dist/transitions/axis/index.d.ts +3 -2
  45. package/dist/transitions/axis/index.d.ts.map +1 -1
  46. package/dist/transitions/axis/transition.d.ts +2 -2
  47. package/dist/transitions/axis/transition.d.ts.map +1 -1
  48. package/dist/transitions/blind/index.d.ts +3 -2
  49. package/dist/transitions/blind/index.d.ts.map +1 -1
  50. package/dist/transitions/blind/transition.d.ts +3 -10
  51. package/dist/transitions/blind/transition.d.ts.map +1 -1
  52. package/dist/transitions/drill/index.d.ts +3 -2
  53. package/dist/transitions/drill/index.d.ts.map +1 -1
  54. package/dist/transitions/drill/transition.d.ts +2 -2
  55. package/dist/transitions/drill/transition.d.ts.map +1 -1
  56. package/dist/transitions/fade/index.d.ts +3 -2
  57. package/dist/transitions/fade/index.d.ts.map +1 -1
  58. package/dist/transitions/fade/transition.d.ts +3 -2
  59. package/dist/transitions/fade/transition.d.ts.map +1 -1
  60. package/dist/transitions/film/index.d.ts +3 -2
  61. package/dist/transitions/film/index.d.ts.map +1 -1
  62. package/dist/transitions/film/transition.d.ts +2 -20
  63. package/dist/transitions/film/transition.d.ts.map +1 -1
  64. package/dist/transitions/hero/content-targets.d.ts +3 -0
  65. package/dist/transitions/hero/content-targets.d.ts.map +1 -0
  66. package/dist/transitions/hero/in-place.d.ts +10 -0
  67. package/dist/transitions/hero/in-place.d.ts.map +1 -0
  68. package/dist/transitions/hero/index.d.ts +10 -9
  69. package/dist/transitions/hero/index.d.ts.map +1 -1
  70. package/dist/transitions/hero/provider/chrome/fade.d.ts.map +1 -1
  71. package/dist/transitions/hero/provider/chrome/static.d.ts.map +1 -1
  72. package/dist/transitions/hero/transition.d.ts +11 -10
  73. package/dist/transitions/hero/transition.d.ts.map +1 -1
  74. package/dist/transitions/hero/types.d.ts +7 -6
  75. package/dist/transitions/hero/types.d.ts.map +1 -1
  76. package/dist/transitions/jaemin/index.d.ts +3 -2
  77. package/dist/transitions/jaemin/index.d.ts.map +1 -1
  78. package/dist/transitions/jaemin/transition.d.ts +3 -2
  79. package/dist/transitions/jaemin/transition.d.ts.map +1 -1
  80. package/dist/transitions/rotate/index.d.ts +3 -2
  81. package/dist/transitions/rotate/index.d.ts.map +1 -1
  82. package/dist/transitions/rotate/transition.d.ts +3 -2
  83. package/dist/transitions/rotate/transition.d.ts.map +1 -1
  84. package/dist/transitions/scroll/index.d.ts +3 -2
  85. package/dist/transitions/scroll/index.d.ts.map +1 -1
  86. package/dist/transitions/scroll/transition.d.ts +3 -2
  87. package/dist/transitions/scroll/transition.d.ts.map +1 -1
  88. package/dist/transitions/sheet/index.d.ts +3 -2
  89. package/dist/transitions/sheet/index.d.ts.map +1 -1
  90. package/dist/transitions/sheet/transition.d.ts +2 -6
  91. package/dist/transitions/sheet/transition.d.ts.map +1 -1
  92. package/dist/transitions/slide/index.d.ts +3 -2
  93. package/dist/transitions/slide/index.d.ts.map +1 -1
  94. package/dist/transitions/slide/transition.d.ts +3 -2
  95. package/dist/transitions/slide/transition.d.ts.map +1 -1
  96. package/dist/transitions/strip/index.d.ts +3 -2
  97. package/dist/transitions/strip/index.d.ts.map +1 -1
  98. package/dist/transitions/strip/transition.d.ts +3 -2
  99. package/dist/transitions/strip/transition.d.ts.map +1 -1
  100. package/dist/transitions/zoom/index.d.ts +3 -2
  101. package/dist/transitions/zoom/index.d.ts.map +1 -1
  102. package/dist/transitions/zoom/provider/blur.d.ts +2 -0
  103. package/dist/transitions/zoom/provider/blur.d.ts.map +1 -1
  104. package/dist/transitions/zoom/provider/expand.d.ts +1 -0
  105. package/dist/transitions/zoom/provider/expand.d.ts.map +1 -1
  106. package/dist/transitions/zoom/provider/static.d.ts +1 -0
  107. package/dist/transitions/zoom/provider/static.d.ts.map +1 -1
  108. package/dist/transitions/zoom/transition.d.ts +2 -3
  109. package/dist/transitions/zoom/transition.d.ts.map +1 -1
  110. package/dist/transitions/zoom/types.d.ts +2 -0
  111. package/dist/transitions/zoom/types.d.ts.map +1 -1
  112. package/dist/types/index.d.ts +5 -3
  113. package/dist/types/index.d.ts.map +1 -1
  114. package/dist/types.cjs +1 -1
  115. package/dist/types.js +2 -4
  116. package/package.json +1 -1
  117. package/dist/multi-animation-B5hEmEgN.cjs +0 -1
  118. package/dist/multi-animation-DyZGEfKy.js +0 -383
  119. package/dist/page-motion-gH3WomQO.cjs +0 -1
  120. package/dist/page-motion-wmW7PW6B.js +0 -204
  121. package/dist/timeline-L_vXntmP.js +0 -68
  122. package/dist/timeline-Zoo1I4XU.cjs +0 -1
@@ -1 +0,0 @@
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,383 +0,0 @@
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 {
6
- }
7
- function w(a) {
8
- return new Promise((r) => {
9
- requestAnimationFrame(() => {
10
- requestAnimationFrame(() => {
11
- r();
12
- });
13
- });
14
- });
15
- }
16
- const C = 1e3 / 60, f = 1e3 / 30, k = f + 1;
17
- class A {
18
- constructor() {
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) => {
24
- this.frameRequest = null;
25
- const t = this.previousTimestamp === null ? C : Math.max(0, r - this.previousTimestamp);
26
- this.previousTimestamp = r;
27
- const e = {
28
- delta: Math.min(t, f),
29
- rawDelta: t
30
- };
31
- this.runPhase(this.drivers, e), this.runPhase(this.observers, e), this.hasCallbacks() ? this.requestFrame() : this.previousTimestamp = null;
32
- });
33
- }
34
- subscribe(r, t = "drive") {
35
- const e = t === "drive" ? this.drivers : this.observers;
36
- return e.add(r), this.requestFrame(), () => {
37
- e.delete(r), this.stopIfIdle();
38
- };
39
- }
40
- requestFrame() {
41
- this.frameRequest !== null || !this.hasCallbacks() || (this.frameRequest = requestAnimationFrame(this.tick));
42
- }
43
- runPhase(r, t) {
44
- for (const e of [...r])
45
- r.has(e) && e(t);
46
- }
47
- hasCallbacks() {
48
- return this.drivers.size > 0 || this.observers.size > 0;
49
- }
50
- stopIfIdle() {
51
- this.hasCallbacks() || (this.frameRequest !== null && typeof cancelAnimationFrame < "u" && cancelAnimationFrame(this.frameRequest), this.frameRequest = null, this.previousTimestamp = null);
52
- }
53
- }
54
- const g = new A(), T = 2;
55
- class V extends m {
56
- constructor(t) {
57
- super();
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);
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;
78
- }
79
- play() {
80
- if (this.reversing = !1, this.paused && this.waapi) {
81
- if (this.paused = !1, this.running = !0, this.waitingForStart) {
82
- this.startReady && this.startFramePacedPlayback(this.waapi);
83
- return;
84
- }
85
- this.waapi.play();
86
- return;
87
- }
88
- this.runToward(this.upperBound);
89
- }
90
- reverse() {
91
- this.reversing = !0, this.runToward(this.lowerBound);
92
- }
93
- pause() {
94
- var t, e;
95
- 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);
96
- }
97
- complete() {
98
- var t;
99
- 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);
100
- }
101
- /**
102
- * Drop the WAAPI forwards-fill after the run has settled, letting inline
103
- * styles govern the resting visual. Call only from `onComplete` (the run is
104
- * already finished) — otherwise it cancels mid-flight. Unlike `complete()`,
105
- * it writes no final frame, so a caller can reset the element to its natural
106
- * state without the lingering fill clobbering it.
107
- */
108
- releaseFill() {
109
- this.clearWaapi();
110
- }
111
- get isAnimating() {
112
- return this.running;
113
- }
114
- get isPaused() {
115
- return this.paused;
116
- }
117
- get isComplete() {
118
- return this.settled;
119
- }
120
- get isReversing() {
121
- return this.reversing;
122
- }
123
- get progress() {
124
- this.running && this.captureLiveState();
125
- const t = this.upperBound - this.lowerBound;
126
- if (t === 0) return 0;
127
- const e = (this.currentValue - this.lowerBound) / t;
128
- return e < 0 ? 0 : e > 1 ? 1 : e;
129
- }
130
- findTimeForProgress(t) {
131
- if (this.frames.length < 2) return null;
132
- const e = this.upperBound - this.lowerBound;
133
- if (e === 0) return 0;
134
- for (const s of this.frames)
135
- if ((s.position - this.lowerBound) / e >= t) return s.time;
136
- return this.frames[this.frames.length - 1].time;
137
- }
138
- get playbackRate() {
139
- return super.playbackRate;
140
- }
141
- set playbackRate(t) {
142
- super.playbackRate = t, this.waapi && (this.waapi.playbackRate = t);
143
- }
144
- getPose() {
145
- return this.running && this.captureLiveState(), [
146
- {
147
- element: this.element,
148
- value: this.currentValue,
149
- velocity: this.currentVelocity
150
- }
151
- ];
152
- }
153
- getTimeline() {
154
- const t = this.frames.map((e) => {
155
- const s = e.position, n = this.lowerBound + this.upperBound - s;
156
- return {
157
- time: e.time,
158
- value: e.position,
159
- velocity: e.velocity,
160
- style: this.styleFn(s, n)
161
- };
162
- });
163
- return [{ element: this.element, frames: t }];
164
- }
165
- matchInto(t) {
166
- const e = t.find((s) => s.element === this.element);
167
- e && (this.currentValue = e.value, this.currentVelocity = e.velocity);
168
- }
169
- /* ───────────────────────────────────────────────────────── private */
170
- runToward(t) {
171
- var c;
172
- if (this.running && this.captureLiveState(), this.clearWaapi(), this.running = !1, this.paused = !1, this.settled = !1, this.frames = b(
173
- this.integrator,
174
- this.currentValue,
175
- t,
176
- this.currentVelocity
177
- ), this.frames.length === 0) {
178
- this.currentValue = t, this.currentVelocity = 0, this.applyStyleAt(t), this.settled = !0, (c = this.onComplete) == null || c.call(this);
179
- return;
180
- }
181
- const e = this.frames.map((o) => {
182
- const p = o.position, y = this.lowerBound + this.upperBound - p;
183
- return this.styleFn(p, y);
184
- }), s = e[0], n = this.frames[this.frames.length - 1], h = n.time, u = ++this.runId, l = this.element.animate(e, {
185
- duration: h,
186
- fill: "both",
187
- easing: "linear",
188
- composite: "replace"
189
- });
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 = () => {
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));
193
- }, this.startWhenReady(l, u);
194
- }
195
- clearWaapi() {
196
- var t, e;
197
- 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;
198
- }
199
- captureLiveState() {
200
- if (this.frames.length === 0) return;
201
- const t = d(this.waapi);
202
- if (t === null) return;
203
- const { position: e, velocity: s } = R(this.frames, t);
204
- this.currentValue = e, this.currentVelocity = s;
205
- }
206
- async startWhenReady(t, e) {
207
- try {
208
- await t.ready, typeof requestAnimationFrame < "u" && await w(this.element);
209
- } catch {
210
- return;
211
- }
212
- this.runId !== e || this.waapi !== t || (this.startReady = !0, !(!this.running || this.paused) && this.startFramePacedPlayback(t));
213
- }
214
- startFramePacedPlayback(t) {
215
- if (!(this.waapi !== t || !this.waitingForStart || !this.startReady || this.stopStartupClock)) {
216
- if (this.pendingFirstFrame)
217
- for (const e of Object.keys(this.pendingFirstFrame))
218
- this.element.style[e] = "";
219
- if (this.pendingFirstFrame = void 0, typeof requestAnimationFrame > "u" || this.playbackRate < 0) {
220
- this.handOffToWaapi(t);
221
- return;
222
- }
223
- this.startupStableFrames = 0, this.stopStartupClock = g.subscribe((e) => {
224
- this.advanceFramePacedStartup(t, e);
225
- });
226
- }
227
- }
228
- advanceFramePacedStartup(t, e) {
229
- if (this.waapi !== t || !this.running || this.paused || !this.waitingForStart)
230
- return;
231
- const s = this.frames[this.frames.length - 1];
232
- if (!s) return;
233
- const n = d(t) ?? 0, h = Math.min(
234
- s.time,
235
- n + e.delta * Math.max(0, this.playbackRate)
236
- );
237
- if (t.currentTime = h, this.captureLiveState(), h >= s.time) {
238
- this.finishFramePacedRun(t, s);
239
- return;
240
- }
241
- e.rawDelta <= k ? this.startupStableFrames++ : this.startupStableFrames = 0, !(this.startupStableFrames < T) && this.handOffToWaapi(t);
242
- }
243
- handOffToWaapi(t) {
244
- var e;
245
- 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());
246
- }
247
- finishFramePacedRun(t, e) {
248
- var s, n;
249
- 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));
250
- }
251
- applyStyleAt(t) {
252
- const e = this.lowerBound + this.upperBound - t, s = this.styleFn(t, e);
253
- for (const [n, h] of Object.entries(s))
254
- this.element.style[n] = typeof h == "number" ? String(h) : h;
255
- }
256
- }
257
- function d(a) {
258
- const r = a == null ? void 0 : a.currentTime;
259
- return typeof r == "number" ? r : null;
260
- }
261
- class q extends m {
262
- constructor(t, e = {}) {
263
- super();
264
- i(this, "children");
265
- i(this, "startAt");
266
- i(this, "pendingComplete", 0);
267
- i(this, "running", !1);
268
- i(this, "pendingStartObservers", []);
269
- this.children = t, (e.mode ?? "parallel") === "sequence" ? this.startAt = t.map((s, n) => n === 0 ? 0 : 1) : this.startAt = e.startAt ?? [];
270
- }
271
- play() {
272
- this.startRun("play");
273
- }
274
- reverse() {
275
- this.startRun("reverse");
276
- }
277
- pause() {
278
- this.running = !1, this.clearPendingStartObservers();
279
- for (const t of this.children) t.pause();
280
- }
281
- complete() {
282
- var t;
283
- this.running = !1, this.clearPendingStartObservers();
284
- for (const e of this.children) e.complete();
285
- (t = this.onComplete) == null || t.call(this);
286
- }
287
- get progress() {
288
- if (this.children.length === 0) return 0;
289
- let t = 0;
290
- for (const e of this.children) t += e.progress;
291
- return t / this.children.length;
292
- }
293
- getPose() {
294
- return this.children.flatMap((t) => t.getPose());
295
- }
296
- getTimeline() {
297
- return this.children.flatMap((t) => t.getTimeline());
298
- }
299
- matchInto(t) {
300
- }
301
- get isAnimating() {
302
- return this.children.some((t) => t.isAnimating);
303
- }
304
- get isPaused() {
305
- return this.children.some((t) => t.isPaused) && this.children.every((t) => t.isPaused || t.isComplete);
306
- }
307
- get isComplete() {
308
- return this.children.every((t) => t.isComplete);
309
- }
310
- get isReversing() {
311
- return this.children.some((t) => t.isReversing);
312
- }
313
- get playbackRate() {
314
- return super.playbackRate;
315
- }
316
- set playbackRate(t) {
317
- super.playbackRate = t;
318
- for (const e of this.children) e.playbackRate = t;
319
- }
320
- /* ───────────────────────────────────────────────────────── private */
321
- startRun(t) {
322
- if (this.running && this.pause(), this.running = !0, this.pendingComplete = this.children.length, this.pendingComplete === 0) {
323
- this.handleFinished();
324
- return;
325
- }
326
- for (const e of this.children) {
327
- const s = e.onComplete;
328
- e.onComplete = () => {
329
- s == null || s(), this.handleChildComplete();
330
- };
331
- }
332
- this.scheduleStart(0, t);
333
- }
334
- // Chained start: play child `index`, then observe its actual progress before
335
- // starting the next one. A wall-clock timeout starts counting before WAAPI's
336
- // asynchronous startup has completed, so mount/layout delays can otherwise
337
- // make a sequence or stagger run early. The shared frame scheduler evaluates
338
- // observers after frame-paced drivers, matching the pose painted this frame.
339
- scheduleStart(t, e) {
340
- if (!this.running || t >= this.children.length) return;
341
- this.children[t][e]();
342
- const s = t + 1;
343
- if (s >= this.children.length) return;
344
- const n = this.startAt[s];
345
- if (n === void 0 || n <= 0) {
346
- this.scheduleStart(s, e);
347
- return;
348
- }
349
- const h = this.children[t];
350
- if (this.hasReachedThreshold(h, n, e)) {
351
- this.scheduleStart(s, e);
352
- return;
353
- }
354
- const u = g.subscribe(() => {
355
- this.running && this.hasReachedThreshold(h, n, e) && (u(), this.pendingStartObservers = this.pendingStartObservers.filter(
356
- (l) => l !== u
357
- ), this.scheduleStart(s, e));
358
- }, "observe");
359
- this.pendingStartObservers.push(u);
360
- }
361
- hasReachedThreshold(t, e, s) {
362
- return t.isComplete ? !0 : (s === "play" ? t.progress : 1 - t.progress) >= e;
363
- }
364
- clearPendingStartObservers() {
365
- for (const t of this.pendingStartObservers) t();
366
- this.pendingStartObservers = [];
367
- }
368
- handleChildComplete() {
369
- this.pendingComplete--, this.pendingComplete <= 0 && this.handleFinished();
370
- }
371
- handleFinished() {
372
- var t;
373
- this.running = !1, this.clearPendingStartObservers(), (t = this.onComplete) == null || t.call(this);
374
- }
375
- findTimeForProgress(t) {
376
- return null;
377
- }
378
- }
379
- export {
380
- m as A,
381
- q as M,
382
- V as W
383
- };
@@ -1 +0,0 @@
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;
@@ -1,204 +0,0 @@
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
- };
@@ -1,68 +0,0 @@
1
- var r = Object.defineProperty;
2
- var u = (t, i, o) => i in t ? r(t, i, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[i] = o;
3
- var y = (t, i, o) => u(t, typeof i != "symbol" ? i + "" : i, o);
4
- let E = class {
5
- constructor() {
6
- /** Current playback rate (1 = realtime, 0 = paused, negative = backwards) */
7
- y(this, "_playbackRate", 1);
8
- /** Fired every frame with the most recent value. Optional. */
9
- y(this, "onUpdate");
10
- /** Fired once when the animation settles. */
11
- y(this, "onComplete");
12
- }
13
- get playbackRate() {
14
- return this._playbackRate;
15
- }
16
- set playbackRate(i) {
17
- this._playbackRate = i;
18
- }
19
- };
20
- const S = 0.01, _ = 0.01, R = 0.05, v = 1e3 / 60;
21
- function b(t, i, o, c) {
22
- if (i === o && c === 0) return [];
23
- const p = 600;
24
- let e = { position: i, velocity: c }, n = 0;
25
- const s = [];
26
- for (let l = 0; l < p; l++) {
27
- const a = l * v;
28
- if (s.push({ time: a, position: e.position, velocity: e.velocity }), e = t.step(e, o, v / 1e3), t.isSettled(e, o)) {
29
- if (n += v / 1e3, n >= R) {
30
- s.push({
31
- time: (l + 1) * v,
32
- position: o,
33
- velocity: 0
34
- });
35
- break;
36
- }
37
- } else
38
- n = 0;
39
- }
40
- return s;
41
- }
42
- function k(t, i) {
43
- "worklet";
44
- if (t.length === 0) return { position: 0, velocity: 0 };
45
- const o = t[0], c = t[t.length - 1];
46
- if (i <= 0)
47
- return { position: o.position, velocity: o.velocity };
48
- if (i >= c.time)
49
- return { position: c.position, velocity: c.velocity };
50
- let p = 0, e = t.length - 1;
51
- for (; p < e - 1; ) {
52
- const a = p + e >> 1;
53
- t[a].time <= i ? p = a : e = a;
54
- }
55
- const n = t[p], s = t[e], l = (i - n.time) / (s.time - n.time);
56
- return {
57
- position: n.position + (s.position - n.position) * l,
58
- velocity: n.velocity + (s.velocity - n.velocity) * l
59
- };
60
- }
61
- export {
62
- E as A,
63
- S as P,
64
- R as S,
65
- _ as V,
66
- k as i,
67
- b as s
68
- };