@ssgoi/core 6.6.3 → 6.7.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/animation/web-animation.d.ts +10 -3
- package/dist/animation/web-animation.d.ts.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.js +771 -693
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +2 -2
- package/dist/{multi-animation-Ch5rI3rB.js → multi-animation-1FueEz2Q.js} +126 -91
- package/dist/multi-animation-qtH1IKNG.cjs +1 -0
- package/dist/transitions/sheet/index.d.ts +7 -1
- package/dist/transitions/sheet/index.d.ts.map +1 -1
- package/dist/transitions/sheet/provider/blur.d.ts +14 -0
- package/dist/transitions/sheet/provider/blur.d.ts.map +1 -0
- package/dist/transitions/sheet/provider/index.d.ts.map +1 -1
- package/dist/transitions/sheet/transition.d.ts +5 -1
- package/dist/transitions/sheet/transition.d.ts.map +1 -1
- package/dist/transitions/sheet/types.d.ts +16 -1
- package/dist/transitions/sheet/types.d.ts.map +1 -1
- package/dist/transitions/zoom/provider/blur.d.ts.map +1 -1
- package/dist/transitions/zoom/transition.d.ts.map +1 -1
- package/dist/transitions/zoom/types.d.ts +6 -1
- package/dist/transitions/zoom/types.d.ts.map +1 -1
- package/dist/utils/get-viewport-rect.d.ts +18 -0
- package/dist/utils/get-viewport-rect.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +14 -13
- package/dist/multi-animation-uzEnQnrG.cjs +0 -1
package/dist/utils/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { getPositionedParent } from './get-positioned-parent';
|
|
|
4
4
|
export { sleep } from './sleep';
|
|
5
5
|
export { getRect } from './get-rect';
|
|
6
6
|
export { getClientRect } from './get-client-rect';
|
|
7
|
-
export { getViewportRect } from './get-viewport-rect';
|
|
7
|
+
export { getViewportRect, getOverlayRect } from './get-viewport-rect';
|
|
8
8
|
export { round, floor, ceil, toFixed } from './number';
|
|
9
9
|
export { withResolvers } from './with-resolvers';
|
|
10
10
|
export { waitPaint } from './wait-paint';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssgoi/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0-beta.0",
|
|
4
4
|
"description": "Core animation engine for SSGOI - Native app-like page transitions with spring physics",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -32,6 +32,18 @@
|
|
|
32
32
|
"!dist/**/*.test.*",
|
|
33
33
|
"!dist/**/*.spec.*"
|
|
34
34
|
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"dev": "vite",
|
|
37
|
+
"watch": "vite build --watch",
|
|
38
|
+
"build": "tsc && vite build",
|
|
39
|
+
"preview": "vite preview",
|
|
40
|
+
"prepare": "pnpm run build",
|
|
41
|
+
"lint": "eslint .",
|
|
42
|
+
"test": "vitest",
|
|
43
|
+
"test:ui": "vitest --ui",
|
|
44
|
+
"test:run": "vitest run",
|
|
45
|
+
"test:coverage": "vitest run --coverage"
|
|
46
|
+
},
|
|
35
47
|
"keywords": [
|
|
36
48
|
"page-transition",
|
|
37
49
|
"page-transitions",
|
|
@@ -76,16 +88,5 @@
|
|
|
76
88
|
"vite": "^6.0.7",
|
|
77
89
|
"vite-plugin-dts": "^4.5.0",
|
|
78
90
|
"vitest": "^3.2.4"
|
|
79
|
-
},
|
|
80
|
-
"scripts": {
|
|
81
|
-
"dev": "vite",
|
|
82
|
-
"watch": "vite build --watch",
|
|
83
|
-
"build": "tsc && vite build",
|
|
84
|
-
"preview": "vite preview",
|
|
85
|
-
"lint": "eslint .",
|
|
86
|
-
"test": "vitest",
|
|
87
|
-
"test:ui": "vitest --ui",
|
|
88
|
-
"test:run": "vitest run",
|
|
89
|
-
"test:coverage": "vitest run --coverage"
|
|
90
91
|
}
|
|
91
|
-
}
|
|
92
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var g=(r,a,t)=>a in r?f(r,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[a]=t;var n=(r,a,t)=>g(r,typeof a!="symbol"?a+"":a,t);class d{constructor(){n(this,"_playbackRate",1);n(this,"onUpdate");n(this,"onComplete")}get playbackRate(){return this._playbackRate}set playbackRate(a){this._playbackRate=a}}const y=.01,T=.01,m=.05,c=1e3/60;class v extends d{constructor(t){super();n(this,"element");n(this,"integrator");n(this,"styleFn");n(this,"lowerBound");n(this,"upperBound");n(this,"currentValue");n(this,"currentVelocity",0);n(this,"frames",[]);n(this,"waapi",null);n(this,"startTime",0);n(this,"running",!1);n(this,"paused",!1);n(this,"settled",!1);n(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){this.paused=!1,this.running=!0,this.waapi.play();return}this.runToward(this.upperBound)}reverse(){this.reversing=!0,this.runToward(this.lowerBound)}pause(){var t;this.running&&(this.captureLiveState(),(t=this.waapi)==null||t.pause(),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 i of this.frames)if((i.position-this.lowerBound)/e>=t)return i.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 i=e.position,s=this.lowerBound+this.upperBound-i;return{time:e.time,value:e.position,velocity:e.velocity,style:this.styleFn(i,s)}});return[{element:this.element,frames:t}]}matchInto(t){const e=t.find(i=>i.element===this.element);e&&(this.currentValue=e.value,this.currentVelocity=e.velocity)}runToward(t){var h;if(this.running&&this.captureLiveState(),this.clearWaapi(),this.running=!1,this.paused=!1,this.settled=!1,this.frames=S(this.integrator,this.currentValue,t,this.currentVelocity),this.frames.length===0){this.currentValue=t,this.currentVelocity=0,this.applyStyleAt(t),this.settled=!0,(h=this.onComplete)==null||h.call(this);return}const e=this.frames.map(o=>{const u=o.position,p=this.lowerBound+this.upperBound-u;return this.styleFn(u,p)}),i=e[0];if(i)for(const o of Object.keys(i))this.element.style[o]="";const s=this.frames[this.frames.length-1],l=s.time;this.waapi=this.element.animate(e,{duration:l,fill:"forwards",easing:"linear",composite:"replace"}),this.waapi.playbackRate=this.playbackRate,this.startTime=performance.now(),this.running=!0,this.waapi.onfinish=()=>{var o;this.running&&(this.running=!1,this.settled=!0,this.currentValue=s.position,this.currentVelocity=0,(o=this.onComplete)==null||o.call(this))}}clearWaapi(){var t;(t=this.waapi)==null||t.cancel(),this.waapi=null}captureLiveState(){if(this.frames.length===0)return;const t=performance.now()-this.startTime,{position:e,velocity:i}=R(this.frames,t);this.currentValue=e,this.currentVelocity=i}applyStyleAt(t){const e=this.lowerBound+this.upperBound-t,i=this.styleFn(t,e);for(const[s,l]of Object.entries(i))this.element.style[s]=typeof l=="number"?String(l):l}}function S(r,a,t,e){if(a===t&&e===0)return[];const i=600;let s={position:a,velocity:e},l=0;const h=[];for(let o=0;o<i;o++){const u=o*c;if(h.push({time:u,position:s.position,velocity:s.velocity}),s=r.step(s,t,c/1e3),r.isSettled(s,t)){if(l+=c/1e3,l>=m){h.push({time:(o+1)*c,position:t,velocity:0});break}}else l=0}return h}function R(r,a){if(r.length===0)return{position:0,velocity:0};const t=r[0],e=r[r.length-1];if(a<=0)return{position:t.position,velocity:t.velocity};if(a>=e.time)return{position:e.position,velocity:e.velocity};let i=0,s=r.length-1;for(;i<s-1;){const u=i+s>>1;r[u].time<=a?i=u:s=u}const l=r[i],h=r[s],o=(a-l.time)/(h.time-l.time);return{position:l.position+(h.position-l.position)*o,velocity:l.velocity+(h.velocity-l.velocity)*o}}class w extends d{constructor(t,e={}){super();n(this,"children");n(this,"startAt");n(this,"pendingComplete",0);n(this,"running",!1);n(this,"pendingStartTimers",[]);this.children=t,(e.mode??"parallel")==="sequence"?this.startAt=t.map((i,s)=>s===0?0:1):this.startAt=e.startAt??[]}play(){this.startRun("play")}reverse(){this.startRun("reverse")}pause(){this.running=!1,this.clearPendingStartTimers();for(const t of this.children)t.pause()}complete(){var t;this.running=!1,this.clearPendingStartTimers();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 i=e.onComplete;e.onComplete=()=>{i==null||i(),this.handleChildComplete()}}this.scheduleStart(0,t)}scheduleStart(t,e){if(!this.running||t>=this.children.length)return;this.children[t][e]();const i=t+1;if(i>=this.children.length)return;const s=this.startAt[i];if(s===void 0||s<=0){this.scheduleStart(i,e);return}const l=this.children[t].findTimeForProgress(s);if(l===null||l<=0){this.scheduleStart(i,e);return}const h=Math.abs(this.playbackRate)||1,o=l/h,u=setTimeout(()=>{this.pendingStartTimers=this.pendingStartTimers.filter(p=>p!==u),this.running&&this.scheduleStart(i,e)},o);this.pendingStartTimers.push(u)}clearPendingStartTimers(){for(const t of this.pendingStartTimers)clearTimeout(t);this.pendingStartTimers=[]}handleChildComplete(){this.pendingComplete--,this.pendingComplete<=0&&this.handleFinished()}handleFinished(){var t;this.running=!1,this.clearPendingStartTimers(),(t=this.onComplete)==null||t.call(this)}findTimeForProgress(t){return null}}exports.Animation=d;exports.MultiAnimation=w;exports.POSITION_THRESHOLD=y;exports.SETTLE_THRESHOLD=m;exports.VELOCITY_THRESHOLD=T;exports.WebAnimation=v;
|