@ssgoi/core 6.7.0-beta.1 → 7.0.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 (100) hide show
  1. package/README.md +80 -230
  2. package/dist/animation/animation.d.ts +2 -2
  3. package/dist/animation/frame-scheduler.d.ts +36 -0
  4. package/dist/animation/frame-scheduler.d.ts.map +1 -0
  5. package/dist/animation/multi-animation.d.ts +3 -2
  6. package/dist/animation/multi-animation.d.ts.map +1 -1
  7. package/dist/animation/web-animation.d.ts +16 -4
  8. package/dist/animation/web-animation.d.ts.map +1 -1
  9. package/dist/index.cjs +15 -15
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1282 -1125
  13. package/dist/internal.cjs +1 -1
  14. package/dist/internal.d.ts +1 -1
  15. package/dist/internal.d.ts.map +1 -1
  16. package/dist/internal.js +692 -521
  17. package/dist/multi-animation-6124HEke.cjs +1 -0
  18. package/dist/multi-animation-ZFZBDBGr.js +439 -0
  19. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
  20. package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +24 -9
  21. package/dist/ssgoi-transition/navigation-detector-strategy.d.ts.map +1 -1
  22. package/dist/ssgoi-transition/navigation-direction.d.ts +13 -0
  23. package/dist/ssgoi-transition/navigation-direction.d.ts.map +1 -0
  24. package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts +1 -0
  25. package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts.map +1 -1
  26. package/dist/ssgoi-transition/path-pattern.d.ts +15 -0
  27. package/dist/ssgoi-transition/path-pattern.d.ts.map +1 -0
  28. package/dist/ssgoi-transition/resolve-transition-rule.d.ts +16 -0
  29. package/dist/ssgoi-transition/resolve-transition-rule.d.ts.map +1 -0
  30. package/dist/ssgoi-transition/unmount-observer.d.ts +11 -2
  31. package/dist/ssgoi-transition/unmount-observer.d.ts.map +1 -1
  32. package/dist/transitions/axis/index.d.ts +5 -7
  33. package/dist/transitions/axis/index.d.ts.map +1 -1
  34. package/dist/transitions/axis/types.d.ts +0 -1
  35. package/dist/transitions/axis/types.d.ts.map +1 -1
  36. package/dist/transitions/blind/index.d.ts +2 -3
  37. package/dist/transitions/blind/index.d.ts.map +1 -1
  38. package/dist/transitions/drill/index.d.ts +6 -7
  39. package/dist/transitions/drill/index.d.ts.map +1 -1
  40. package/dist/transitions/drill/provider/crossfade.d.ts.map +1 -1
  41. package/dist/transitions/drill/provider/parallax.d.ts.map +1 -1
  42. package/dist/transitions/drill/transition.d.ts.map +1 -1
  43. package/dist/transitions/drill/types.d.ts +0 -1
  44. package/dist/transitions/drill/types.d.ts.map +1 -1
  45. package/dist/transitions/fade/index.d.ts +3 -5
  46. package/dist/transitions/fade/index.d.ts.map +1 -1
  47. package/dist/transitions/film/index.d.ts +3 -5
  48. package/dist/transitions/film/index.d.ts.map +1 -1
  49. package/dist/transitions/hero/fit.d.ts +5 -0
  50. package/dist/transitions/hero/fit.d.ts.map +1 -0
  51. package/dist/transitions/hero/index.d.ts +3 -5
  52. package/dist/transitions/hero/index.d.ts.map +1 -1
  53. package/dist/transitions/hero/transition.d.ts +12 -1
  54. package/dist/transitions/hero/transition.d.ts.map +1 -1
  55. package/dist/transitions/hero/types.d.ts +2 -1
  56. package/dist/transitions/hero/types.d.ts.map +1 -1
  57. package/dist/transitions/jaemin/index.d.ts +3 -5
  58. package/dist/transitions/jaemin/index.d.ts.map +1 -1
  59. package/dist/transitions/media-geometry.d.ts +55 -0
  60. package/dist/transitions/media-geometry.d.ts.map +1 -0
  61. package/dist/transitions/rotate/index.d.ts +3 -5
  62. package/dist/transitions/rotate/index.d.ts.map +1 -1
  63. package/dist/transitions/scroll/index.d.ts +4 -5
  64. package/dist/transitions/scroll/index.d.ts.map +1 -1
  65. package/dist/transitions/scroll/transition.d.ts +1 -1
  66. package/dist/transitions/scroll/transition.d.ts.map +1 -1
  67. package/dist/transitions/sheet/index.d.ts +6 -7
  68. package/dist/transitions/sheet/index.d.ts.map +1 -1
  69. package/dist/transitions/sheet/provider/static.d.ts.map +1 -1
  70. package/dist/transitions/sheet/transition.d.ts.map +1 -1
  71. package/dist/transitions/sheet/types.d.ts +0 -1
  72. package/dist/transitions/sheet/types.d.ts.map +1 -1
  73. package/dist/transitions/slide/index.d.ts +3 -5
  74. package/dist/transitions/slide/index.d.ts.map +1 -1
  75. package/dist/transitions/slide/transition.d.ts +0 -1
  76. package/dist/transitions/slide/transition.d.ts.map +1 -1
  77. package/dist/transitions/strip/index.d.ts +3 -5
  78. package/dist/transitions/strip/index.d.ts.map +1 -1
  79. package/dist/transitions/utils.d.ts +3 -21
  80. package/dist/transitions/utils.d.ts.map +1 -1
  81. package/dist/transitions/zoom/index.d.ts +3 -4
  82. package/dist/transitions/zoom/index.d.ts.map +1 -1
  83. package/dist/transitions/zoom/provider/blur.d.ts.map +1 -1
  84. package/dist/transitions/zoom/transition.d.ts +6 -1
  85. package/dist/transitions/zoom/transition.d.ts.map +1 -1
  86. package/dist/transitions/zoom/types.d.ts +5 -0
  87. package/dist/transitions/zoom/types.d.ts.map +1 -1
  88. package/dist/transitions/zoom/zoom-element.d.ts +2 -2
  89. package/dist/transitions/zoom/zoom-element.d.ts.map +1 -1
  90. package/dist/types/index.d.ts +66 -10
  91. package/dist/types/index.d.ts.map +1 -1
  92. package/dist/utils/wait-paint.d.ts +8 -7
  93. package/dist/utils/wait-paint.d.ts.map +1 -1
  94. package/package.json +13 -14
  95. package/dist/multi-animation-1FueEz2Q.js +0 -367
  96. package/dist/multi-animation-qtH1IKNG.cjs +0 -1
  97. package/dist/ssgoi-transition/find-matching-transition.d.ts +0 -30
  98. package/dist/ssgoi-transition/find-matching-transition.d.ts.map +0 -1
  99. package/dist/ssgoi-transition/process-symmetric-transitions.d.ts +0 -7
  100. package/dist/ssgoi-transition/process-symmetric-transitions.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ "use strict";var F=Object.defineProperty;var b=(a,i,t)=>i in a?F(a,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[i]=t;var r=(a,i,t)=>b(a,typeof i!="symbol"?i+"":i,t);class d{constructor(){r(this,"_playbackRate",1);r(this,"onUpdate");r(this,"onComplete")}get playbackRate(){return this._playbackRate}set playbackRate(i){this._playbackRate=i}}const R=.01,T=.01,g=.05;function k(a){return new Promise(i=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{i()})})})}const w=1e3/60,y=1e3/30,C=y+1;class A{constructor(){r(this,"drivers",new Set);r(this,"observers",new Set);r(this,"frameRequest",null);r(this,"previousTimestamp",null);r(this,"tick",i=>{this.frameRequest=null;const t=this.previousTimestamp===null?w:Math.max(0,i-this.previousTimestamp);this.previousTimestamp=i;const e={delta:Math.min(t,y),rawDelta:t};this.runPhase(this.drivers,e),this.runPhase(this.observers,e),this.hasCallbacks()?this.requestFrame():this.previousTimestamp=null})}subscribe(i,t="drive"){const e=t==="drive"?this.drivers:this.observers;return e.add(i),this.requestFrame(),()=>{e.delete(i),this.stopIfIdle()}}requestFrame(){this.frameRequest!==null||!this.hasCallbacks()||(this.frameRequest=requestAnimationFrame(this.tick))}runPhase(i,t){for(const e of[...i])i.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 S=new A,p=1e3/60,P=2;class O extends d{constructor(t){super();r(this,"element");r(this,"integrator");r(this,"styleFn");r(this,"lowerBound");r(this,"upperBound");r(this,"currentValue");r(this,"currentVelocity",0);r(this,"frames",[]);r(this,"waapi",null);r(this,"runId",0);r(this,"waitingForStart",!1);r(this,"startReady",!1);r(this,"pendingFirstFrame");r(this,"stopStartupClock",null);r(this,"startupStableFrames",0);r(this,"running",!1);r(this,"paused",!1);r(this,"settled",!1);r(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 o;if(this.running&&this.captureLiveState(),this.clearWaapi(),this.running=!1,this.paused=!1,this.settled=!1,this.frames=B(this.integrator,this.currentValue,t,this.currentVelocity),this.frames.length===0){this.currentValue=t,this.currentVelocity=0,this.applyStyleAt(t),this.settled=!0,(o=this.onComplete)==null||o.call(this);return}const e=this.frames.map(c=>{const m=c.position,v=this.lowerBound+this.upperBound-m;return this.styleFn(m,v)}),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 c;!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))},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}=E(this.frames,t);this.currentValue=e,this.currentVelocity=s}async startWhenReady(t,e){try{await t.ready,typeof requestAnimationFrame<"u"&&await k(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=S.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<=C?this.startupStableFrames++:this.startupStableFrames=0,!(this.startupStableFrames<P)&&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 B(a,i,t,e){if(i===t&&e===0)return[];const s=600;let n={position:i,velocity:e},h=0;const u=[];for(let l=0;l<s;l++){const o=l*p;if(u.push({time:o,position:n.position,velocity:n.velocity}),n=a.step(n,t,p/1e3),a.isSettled(n,t)){if(h+=p/1e3,h>=g){u.push({time:(l+1)*p,position:t,velocity:0});break}}else h=0}return u}function E(a,i){if(a.length===0)return{position:0,velocity:0};const t=a[0],e=a[a.length-1];if(i<=0)return{position:t.position,velocity:t.velocity};if(i>=e.time)return{position:e.position,velocity:e.velocity};let s=0,n=a.length-1;for(;s<n-1;){const o=s+n>>1;a[o].time<=i?s=o:n=o}const h=a[s],u=a[n],l=(i-h.time)/(u.time-h.time);return{position:h.position+(u.position-h.position)*l,velocity:h.velocity+(u.velocity-h.velocity)*l}}function f(a){const i=a==null?void 0:a.currentTime;return typeof i=="number"?i:null}class _ extends d{constructor(t,e={}){super();r(this,"children");r(this,"startAt");r(this,"pendingComplete",0);r(this,"running",!1);r(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=S.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=d;exports.MultiAnimation=_;exports.POSITION_THRESHOLD=R;exports.SETTLE_THRESHOLD=g;exports.VELOCITY_THRESHOLD=T;exports.WebAnimation=O;
@@ -0,0 +1,439 @@
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
+ }
19
+ }
20
+ const O = 0.01, V = 0.01, b = 0.05;
21
+ function R(a) {
22
+ return new Promise((i) => {
23
+ requestAnimationFrame(() => {
24
+ requestAnimationFrame(() => {
25
+ i();
26
+ });
27
+ });
28
+ });
29
+ }
30
+ const T = 1e3 / 60, g = 1e3 / 30, k = g + 1;
31
+ class w {
32
+ 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) => {
38
+ this.frameRequest = null;
39
+ const t = this.previousTimestamp === null ? T : Math.max(0, i - this.previousTimestamp);
40
+ this.previousTimestamp = i;
41
+ const e = {
42
+ delta: Math.min(t, g),
43
+ rawDelta: t
44
+ };
45
+ this.runPhase(this.drivers, e), this.runPhase(this.observers, e), this.hasCallbacks() ? this.requestFrame() : this.previousTimestamp = null;
46
+ });
47
+ }
48
+ subscribe(i, t = "drive") {
49
+ const e = t === "drive" ? this.drivers : this.observers;
50
+ return e.add(i), this.requestFrame(), () => {
51
+ e.delete(i), this.stopIfIdle();
52
+ };
53
+ }
54
+ requestFrame() {
55
+ this.frameRequest !== null || !this.hasCallbacks() || (this.frameRequest = requestAnimationFrame(this.tick));
56
+ }
57
+ runPhase(i, t) {
58
+ for (const e of [...i])
59
+ i.has(e) && e(t);
60
+ }
61
+ hasCallbacks() {
62
+ return this.drivers.size > 0 || this.observers.size > 0;
63
+ }
64
+ stopIfIdle() {
65
+ this.hasCallbacks() || (this.frameRequest !== null && typeof cancelAnimationFrame < "u" && cancelAnimationFrame(this.frameRequest), this.frameRequest = null, this.previousTimestamp = null);
66
+ }
67
+ }
68
+ const y = new w(), p = 1e3 / 60, C = 2;
69
+ class _ extends f {
70
+ constructor(t) {
71
+ 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);
91
+ 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
+ }
93
+ play() {
94
+ if (this.reversing = !1, this.paused && this.waapi) {
95
+ if (this.paused = !1, this.running = !0, this.waitingForStart) {
96
+ this.startReady && this.startFramePacedPlayback(this.waapi);
97
+ return;
98
+ }
99
+ this.waapi.play();
100
+ return;
101
+ }
102
+ this.runToward(this.upperBound);
103
+ }
104
+ reverse() {
105
+ this.reversing = !0, this.runToward(this.lowerBound);
106
+ }
107
+ pause() {
108
+ var t, e;
109
+ 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);
110
+ }
111
+ complete() {
112
+ var t;
113
+ 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);
114
+ }
115
+ /**
116
+ * Drop the WAAPI forwards-fill after the run has settled, letting inline
117
+ * styles govern the resting visual. Call only from `onComplete` (the run is
118
+ * already finished) — otherwise it cancels mid-flight. Unlike `complete()`,
119
+ * it writes no final frame, so a caller can reset the element to its natural
120
+ * state without the lingering fill clobbering it.
121
+ */
122
+ releaseFill() {
123
+ this.clearWaapi();
124
+ }
125
+ get isAnimating() {
126
+ return this.running;
127
+ }
128
+ get isPaused() {
129
+ return this.paused;
130
+ }
131
+ get isComplete() {
132
+ return this.settled;
133
+ }
134
+ get isReversing() {
135
+ return this.reversing;
136
+ }
137
+ get progress() {
138
+ this.running && this.captureLiveState();
139
+ const t = this.upperBound - this.lowerBound;
140
+ if (t === 0) return 0;
141
+ const e = (this.currentValue - this.lowerBound) / t;
142
+ return e < 0 ? 0 : e > 1 ? 1 : e;
143
+ }
144
+ findTimeForProgress(t) {
145
+ if (this.frames.length < 2) return null;
146
+ const e = this.upperBound - this.lowerBound;
147
+ if (e === 0) return 0;
148
+ for (const s of this.frames)
149
+ if ((s.position - this.lowerBound) / e >= t) return s.time;
150
+ return this.frames[this.frames.length - 1].time;
151
+ }
152
+ get playbackRate() {
153
+ return super.playbackRate;
154
+ }
155
+ set playbackRate(t) {
156
+ super.playbackRate = t, this.waapi && (this.waapi.playbackRate = t);
157
+ }
158
+ getPose() {
159
+ return this.running && this.captureLiveState(), [
160
+ {
161
+ element: this.element,
162
+ value: this.currentValue,
163
+ velocity: this.currentVelocity
164
+ }
165
+ ];
166
+ }
167
+ getTimeline() {
168
+ const t = this.frames.map((e) => {
169
+ const s = e.position, n = this.lowerBound + this.upperBound - s;
170
+ return {
171
+ time: e.time,
172
+ value: e.position,
173
+ velocity: e.velocity,
174
+ style: this.styleFn(s, n)
175
+ };
176
+ });
177
+ return [{ element: this.element, frames: t }];
178
+ }
179
+ matchInto(t) {
180
+ const e = t.find((s) => s.element === this.element);
181
+ e && (this.currentValue = e.value, this.currentVelocity = e.velocity);
182
+ }
183
+ /* ───────────────────────────────────────────────────────── private */
184
+ 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(
187
+ this.integrator,
188
+ this.currentValue,
189
+ t,
190
+ this.currentVelocity
191
+ ), this.frames.length === 0) {
192
+ this.currentValue = t, this.currentVelocity = 0, this.applyStyleAt(t), this.settled = !0, (o = this.onComplete) == null || o.call(this);
193
+ return;
194
+ }
195
+ const e = this.frames.map((c) => {
196
+ const d = c.position, v = this.lowerBound + this.upperBound - d;
197
+ return this.styleFn(d, v);
198
+ }), s = e[0], n = this.frames[this.frames.length - 1], h = n.time, u = ++this.runId, l = this.element.animate(e, {
199
+ duration: h,
200
+ fill: "both",
201
+ easing: "linear",
202
+ composite: "replace"
203
+ });
204
+ 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));
207
+ }, this.startWhenReady(l, u);
208
+ }
209
+ clearWaapi() {
210
+ var t, e;
211
+ 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;
212
+ }
213
+ captureLiveState() {
214
+ if (this.frames.length === 0) return;
215
+ const t = m(this.waapi);
216
+ if (t === null) return;
217
+ const { position: e, velocity: s } = P(this.frames, t);
218
+ this.currentValue = e, this.currentVelocity = s;
219
+ }
220
+ async startWhenReady(t, e) {
221
+ try {
222
+ await t.ready, typeof requestAnimationFrame < "u" && await R(this.element);
223
+ } catch {
224
+ return;
225
+ }
226
+ this.runId !== e || this.waapi !== t || (this.startReady = !0, !(!this.running || this.paused) && this.startFramePacedPlayback(t));
227
+ }
228
+ startFramePacedPlayback(t) {
229
+ if (!(this.waapi !== t || !this.waitingForStart || !this.startReady || this.stopStartupClock)) {
230
+ if (this.pendingFirstFrame)
231
+ for (const e of Object.keys(this.pendingFirstFrame))
232
+ this.element.style[e] = "";
233
+ if (this.pendingFirstFrame = void 0, typeof requestAnimationFrame > "u" || this.playbackRate < 0) {
234
+ this.handOffToWaapi(t);
235
+ return;
236
+ }
237
+ this.startupStableFrames = 0, this.stopStartupClock = y.subscribe((e) => {
238
+ this.advanceFramePacedStartup(t, e);
239
+ });
240
+ }
241
+ }
242
+ advanceFramePacedStartup(t, e) {
243
+ if (this.waapi !== t || !this.running || this.paused || !this.waitingForStart)
244
+ return;
245
+ const s = this.frames[this.frames.length - 1];
246
+ if (!s) return;
247
+ const n = m(t) ?? 0, h = Math.min(
248
+ s.time,
249
+ n + e.delta * Math.max(0, this.playbackRate)
250
+ );
251
+ if (t.currentTime = h, this.captureLiveState(), h >= s.time) {
252
+ this.finishFramePacedRun(t, s);
253
+ return;
254
+ }
255
+ e.rawDelta <= k ? this.startupStableFrames++ : this.startupStableFrames = 0, !(this.startupStableFrames < C) && this.handOffToWaapi(t);
256
+ }
257
+ handOffToWaapi(t) {
258
+ var e;
259
+ 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());
260
+ }
261
+ finishFramePacedRun(t, e) {
262
+ var s, n;
263
+ 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));
264
+ }
265
+ applyStyleAt(t) {
266
+ const e = this.lowerBound + this.upperBound - t, s = this.styleFn(t, e);
267
+ for (const [n, h] of Object.entries(s))
268
+ this.element.style[n] = typeof h == "number" ? String(h) : h;
269
+ }
270
+ }
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;
313
+ }
314
+ class M extends f {
315
+ constructor(t, e = {}) {
316
+ super();
317
+ r(this, "children");
318
+ r(this, "startAt");
319
+ r(this, "pendingComplete", 0);
320
+ r(this, "running", !1);
321
+ r(this, "pendingStartObservers", []);
322
+ this.children = t, (e.mode ?? "parallel") === "sequence" ? this.startAt = t.map((s, n) => n === 0 ? 0 : 1) : this.startAt = e.startAt ?? [];
323
+ }
324
+ play() {
325
+ this.startRun("play");
326
+ }
327
+ reverse() {
328
+ this.startRun("reverse");
329
+ }
330
+ pause() {
331
+ this.running = !1, this.clearPendingStartObservers();
332
+ for (const t of this.children) t.pause();
333
+ }
334
+ complete() {
335
+ var t;
336
+ this.running = !1, this.clearPendingStartObservers();
337
+ for (const e of this.children) e.complete();
338
+ (t = this.onComplete) == null || t.call(this);
339
+ }
340
+ get progress() {
341
+ if (this.children.length === 0) return 0;
342
+ let t = 0;
343
+ for (const e of this.children) t += e.progress;
344
+ return t / this.children.length;
345
+ }
346
+ getPose() {
347
+ return this.children.flatMap((t) => t.getPose());
348
+ }
349
+ getTimeline() {
350
+ return this.children.flatMap((t) => t.getTimeline());
351
+ }
352
+ matchInto(t) {
353
+ }
354
+ get isAnimating() {
355
+ return this.children.some((t) => t.isAnimating);
356
+ }
357
+ get isPaused() {
358
+ return this.children.some((t) => t.isPaused) && this.children.every((t) => t.isPaused || t.isComplete);
359
+ }
360
+ get isComplete() {
361
+ return this.children.every((t) => t.isComplete);
362
+ }
363
+ get isReversing() {
364
+ return this.children.some((t) => t.isReversing);
365
+ }
366
+ get playbackRate() {
367
+ return super.playbackRate;
368
+ }
369
+ set playbackRate(t) {
370
+ super.playbackRate = t;
371
+ for (const e of this.children) e.playbackRate = t;
372
+ }
373
+ /* ───────────────────────────────────────────────────────── private */
374
+ startRun(t) {
375
+ if (this.running && this.pause(), this.running = !0, this.pendingComplete = this.children.length, this.pendingComplete === 0) {
376
+ this.handleFinished();
377
+ return;
378
+ }
379
+ for (const e of this.children) {
380
+ const s = e.onComplete;
381
+ e.onComplete = () => {
382
+ s == null || s(), this.handleChildComplete();
383
+ };
384
+ }
385
+ this.scheduleStart(0, t);
386
+ }
387
+ // Chained start: play child `index`, then observe its actual progress before
388
+ // starting the next one. A wall-clock timeout starts counting before WAAPI's
389
+ // asynchronous startup has completed, so mount/layout delays can otherwise
390
+ // make a sequence or stagger run early. The shared frame scheduler evaluates
391
+ // observers after frame-paced drivers, matching the pose painted this frame.
392
+ scheduleStart(t, e) {
393
+ if (!this.running || t >= this.children.length) return;
394
+ this.children[t][e]();
395
+ const s = t + 1;
396
+ if (s >= this.children.length) return;
397
+ const n = this.startAt[s];
398
+ if (n === void 0 || n <= 0) {
399
+ this.scheduleStart(s, e);
400
+ return;
401
+ }
402
+ const h = this.children[t];
403
+ if (this.hasReachedThreshold(h, n, e)) {
404
+ this.scheduleStart(s, e);
405
+ return;
406
+ }
407
+ const u = y.subscribe(() => {
408
+ this.running && this.hasReachedThreshold(h, n, e) && (u(), this.pendingStartObservers = this.pendingStartObservers.filter(
409
+ (l) => l !== u
410
+ ), this.scheduleStart(s, e));
411
+ }, "observe");
412
+ this.pendingStartObservers.push(u);
413
+ }
414
+ hasReachedThreshold(t, e, s) {
415
+ return t.isComplete ? !0 : (s === "play" ? t.progress : 1 - t.progress) >= e;
416
+ }
417
+ clearPendingStartObservers() {
418
+ for (const t of this.pendingStartObservers) t();
419
+ this.pendingStartObservers = [];
420
+ }
421
+ handleChildComplete() {
422
+ this.pendingComplete--, this.pendingComplete <= 0 && this.handleFinished();
423
+ }
424
+ handleFinished() {
425
+ var t;
426
+ this.running = !1, this.clearPendingStartObservers(), (t = this.onComplete) == null || t.call(this);
427
+ }
428
+ findTimeForProgress(t) {
429
+ return null;
430
+ }
431
+ }
432
+ export {
433
+ f as A,
434
+ M,
435
+ O as P,
436
+ b as S,
437
+ V,
438
+ _ as W
439
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,YAAY,EAOb,MAAM,QAAQ,CAAC;AAShB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AA8C5D;;;;;;;;;GASG;AACH,MAAM,WAAW,mCAAmC;IAClD;;;;OAIG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,EACpB,cAAc,GAAE,mCAAwC,GACvD,YAAY,CA+hBd"}
1
+ {"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,YAAY,EAOb,MAAM,QAAQ,CAAC;AAShB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AA0B5D;;;;;;;;;GASG;AACH,MAAM,WAAW,mCAAmC;IAClD;;;;OAIG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,EACpB,cAAc,GAAE,mCAAwC,GACvD,YAAY,CAmkBd"}
@@ -4,22 +4,37 @@
4
4
  * Collects out/in navigation events and provides navigation pairs.
5
5
  * OUT and IN can arrive in any order.
6
6
  */
7
- export type NavigationPair = {
7
+ export type NavigationPair<TPayload> = {
8
8
  from: string;
9
9
  to: string;
10
+ out: TPayload;
11
+ in: TPayload;
10
12
  };
11
- export interface NavigationDetector {
13
+ export type NavigationArrivalType = "out" | "in";
14
+ export type NavigationCollision<TPayload> = {
15
+ type: NavigationArrivalType;
16
+ path: string;
17
+ current: TPayload;
18
+ next: TPayload;
19
+ };
20
+ export type NavigationDetectorOptions<TPayload> = {
21
+ /**
22
+ * Select which payload owns a repeated arrival for the same side and path.
23
+ * The default keeps the latest arrival.
24
+ */
25
+ keepCurrent?: (collision: NavigationCollision<TPayload>) => boolean;
26
+ };
27
+ export interface NavigationDetector<TPayload> {
12
28
  /**
13
- * Trigger navigation event
29
+ * Add one side of a navigation. The promise resolves after its matching side
30
+ * arrives, or with null when this arrival is superseded/cancelled.
14
31
  */
15
- trigger(path: string, type: "out" | "in"): void;
32
+ arrive(path: string, type: NavigationArrivalType, payload: TPayload): Promise<NavigationPair<TPayload> | null>;
16
33
  /**
17
- * Get navigation pair when ready
18
- * Returns null if a pending transition is cancelled.
34
+ * Cancel a pending navigation when either side matches the predicate.
19
35
  */
20
- get(type: "out" | "in"): Promise<NavigationPair | null>;
36
+ cancel(predicate: (payload: TPayload) => boolean): void;
21
37
  }
22
- export type CreateNavigationDetector = () => NavigationDetector;
23
38
  /**
24
39
  * Navigation detector
25
40
  *
@@ -28,5 +43,5 @@ export type CreateNavigationDetector = () => NavigationDetector;
28
43
  * - Both wait indefinitely for the other to complete the pair
29
44
  * - If a new path arrives, cancels the previous pending transition
30
45
  */
31
- export declare function createNavigationDetector(): NavigationDetector;
46
+ export declare function createNavigationDetector<TPayload>(options?: NavigationDetectorOptions<TPayload>): NavigationDetector<TPayload>;
32
47
  //# sourceMappingURL=navigation-detector-strategy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-detector-strategy.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/navigation-detector-strategy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;IAEhD;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACzD;AAED,MAAM,MAAM,wBAAwB,GAAG,MAAM,kBAAkB,CAAC;AAShE;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,kBAAkB,CA+E7D"}
1
+ {"version":3,"file":"navigation-detector-strategy.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/navigation-detector-strategy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,CAAC,QAAQ,IAAI;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,QAAQ,CAAC;IACd,EAAE,EAAE,QAAQ,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,IAAI,CAAC;AAEjD,MAAM,MAAM,mBAAmB,CAAC,QAAQ,IAAI;IAC1C,IAAI,EAAE,qBAAqB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,QAAQ,IAAI;IAChD;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,OAAO,CAAC;CACrE,CAAC;AAEF,MAAM,WAAW,kBAAkB,CAAC,QAAQ;IAC1C;;;OAGG;IACH,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,QAAQ,GAChB,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;IAE5C;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,GAAG,IAAI,CAAC;CACzD;AAaD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAC/C,OAAO,GAAE,yBAAyB,CAAC,QAAQ,CAAM,GAChD,kBAAkB,CAAC,QAAQ,CAAC,CA0F9B"}
@@ -0,0 +1,13 @@
1
+ import { NavigationDirection } from '../types/index.ts';
2
+ export interface NavigationDirectionTracker {
3
+ resolve(from: string, to: string): NavigationDirection;
4
+ dispose(): void;
5
+ }
6
+ /**
7
+ * Lightweight semantic history used only where a route rule cannot determine
8
+ * direction from its own boundary/order. A browser pop wins; otherwise a
9
+ * navigation to the immediately previous route is backward even when an app
10
+ * implemented its back button with push().
11
+ */
12
+ export declare function createNavigationDirectionTracker(): NavigationDirectionTracker;
13
+ //# sourceMappingURL=navigation-direction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-direction.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/navigation-direction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAGlD,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,mBAAmB,CAAC;IACvD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,IAAI,0BAA0B,CA6C7E"}
@@ -1,3 +1,4 @@
1
1
  import { SsgoiContext } from '../types/index.ts';
2
+ export declare function registerTransitionBatch(elements: ReadonlySet<HTMLElement>, ssgoi: SsgoiContext, mountedElements?: ReadonlySet<HTMLElement>): void;
2
3
  export declare function observeSsgoiTransitions(root: Element, ssgoi: SsgoiContext): () => void;
3
4
  //# sourceMappingURL=observe-ssgoi-transitions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"observe-ssgoi-transitions.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/observe-ssgoi-transitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAwB3C,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,YAAY,GAClB,MAAM,IAAI,CAyDZ"}
1
+ {"version":3,"file":"observe-ssgoi-transitions.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/observe-ssgoi-transitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAkC3C,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,WAAW,CAAC,WAAW,CAAC,EAClC,KAAK,EAAE,YAAY,EACnB,eAAe,GAAE,WAAW,CAAC,WAAW,CAAY,GACnD,IAAI,CAuBN;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,YAAY,GAClB,MAAM,IAAI,CAoEZ"}
@@ -0,0 +1,15 @@
1
+ import { PathPatterns } from '../types/index.ts';
2
+ export type PathMatch = {
3
+ matched: boolean;
4
+ specificity: number;
5
+ pattern: string;
6
+ };
7
+ export declare function normalizePath(path: string): string;
8
+ export declare function getPathMatch(path: string, pattern: string): PathMatch;
9
+ export declare function getBestPathMatch(path: string, patterns: PathPatterns): PathMatch | null;
10
+ /**
11
+ * Match a normalized path against an exact path, `:id` segment, `*` single
12
+ * segment, or suffix `**` deep wildcard.
13
+ */
14
+ export declare function matchPath(path: string, pattern: string): boolean;
15
+ //# sourceMappingURL=path-pattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-pattern.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/path-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkBF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBlD;AAsBD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CA2DrE;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,YAAY,GACrB,SAAS,GAAG,IAAI,CAYlB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhE"}
@@ -0,0 +1,16 @@
1
+ import { AnyTransitionConfig, NavigationDirection, SsgoiTransitionRule } from '../types/index.ts';
2
+ export type ResolvedTransitionRule = {
3
+ transition: AnyTransitionConfig;
4
+ direction: NavigationDirection;
5
+ ruleIndex: number;
6
+ priority: number;
7
+ specificity: number;
8
+ reason: "on-enter" | "on-leave" | "on-history" | "pair" | "ordered";
9
+ };
10
+ /**
11
+ * Resolve a flat route-rule list. `historyDirection` is consulted only when
12
+ * the rule itself cannot prove a direction (both endpoints inside one `on`
13
+ * scope, or an intentionally overlapping pair).
14
+ */
15
+ export declare function resolveTransitionRule(from: string, to: string, rules: readonly SsgoiTransitionRule[], historyDirection: NavigationDirection): ResolvedTransitionRule | null;
16
+ //# sourceMappingURL=resolve-transition-rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-transition-rule.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/resolve-transition-rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,QAAQ,CAAC;AAGhB,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,mBAAmB,CAAC;IAChC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;CACrE,CAAC;AAeF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,SAAS,mBAAmB,EAAE,EACrC,gBAAgB,EAAE,mBAAmB,GACpC,sBAAsB,GAAG,IAAI,CA2G/B"}
@@ -14,8 +14,17 @@ export type UnmountAnchor = {
14
14
  parent: Node;
15
15
  nextSibling: Node | null;
16
16
  };
17
- type UnmountCallback = (anchor?: UnmountAnchor) => void;
17
+ export type UnmountOptions = {
18
+ /**
19
+ * `false` when this element left inside another watched boundary owned by
20
+ * the same transition context. The nested element still needs cleanup, but
21
+ * the outer boundary owns the navigation OUT event.
22
+ */
23
+ emit: boolean;
24
+ };
25
+ type UnmountCallback = (anchor?: UnmountAnchor, options?: UnmountOptions) => void;
26
+ type WatchGroup = object;
18
27
  /** Register `cb` to fire when `element` is removed from the DOM. */
19
- export declare function watchUnmount(element: HTMLElement, cb: UnmountCallback): () => void;
28
+ export declare function watchUnmount(element: HTMLElement, cb: UnmountCallback, group?: WatchGroup): () => void;
20
29
  export {};
21
30
  //# sourceMappingURL=unmount-observer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unmount-observer.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/unmount-observer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,IAAI,CAAC;IACb,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,MAAM,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;AAuDxD,oEAAoE;AACpE,wBAAgB,YAAY,CAC1B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,eAAe,GAClB,MAAM,IAAI,CAMZ"}
1
+ {"version":3,"file":"unmount-observer.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/unmount-observer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,IAAI,CAAC;IACb,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;OAIG;IACH,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,KAAK,eAAe,GAAG,CACrB,MAAM,CAAC,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE,cAAc,KACrB,IAAI,CAAC;AAEV,KAAK,UAAU,GAAG,MAAM,CAAC;AAgGzB,oEAAoE;AACpE,wBAAgB,YAAY,CAC1B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,eAAe,EACnB,KAAK,GAAE,UAAyB,GAC/B,MAAM,IAAI,CAwBZ"}