@nethesis/phone-island 1.0.12 → 1.0.14-dev.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.
- package/dist/App.js +1 -1
- package/dist/App.js.map +1 -1
- package/dist/components/CallView/index.js +1 -1
- package/dist/components/CallView/index.js.map +1 -1
- package/dist/components/Socket.js +1 -1
- package/dist/components/Socket.js.map +1 -1
- package/dist/components/WebRTC.js +1 -1
- package/dist/components/WebRTC.js.map +1 -1
- package/dist/node_modules/engine.io-client/build/esm/contrib/parseuri.js +1 -1
- package/dist/node_modules/engine.io-client/build/esm/contrib/parseuri.js.map +1 -1
- package/dist/node_modules/engine.io-client/build/esm/globals.js +2 -0
- package/dist/node_modules/engine.io-client/build/esm/globals.js.map +1 -0
- package/dist/node_modules/engine.io-client/build/esm/socket.js +1 -1
- package/dist/node_modules/engine.io-client/build/esm/socket.js.map +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transport.js +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transport.js.map +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/index.js +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/index.js.map +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +2 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/polling-xhr.js.map +1 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/polling.js +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/polling.js.map +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/websocket.js +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/websocket.js.map +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/webtransport.js +1 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/webtransport.js.map +1 -1
- package/dist/node_modules/engine.io-client/build/esm/util.js +1 -1
- package/dist/node_modules/engine.io-client/build/esm/util.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs.js.map +1 -1
- package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs.js.map +1 -1
- package/dist/node_modules/js-base64/base64.mjs.js +1 -1
- package/dist/node_modules/js-base64/base64.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/JSAnimation.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/events/add-dom-event.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/events/add-dom-event.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/frameloop/batcher.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/frameloop/batcher.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/frameloop/render-step.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/frameloop/render-step.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/gestures/press/index.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/gestures/press/index.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.mjs.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.mjs.js.map +1 -1
- package/dist/node_modules/motion-dom/dist/es/utils/border-radius.mjs.js +2 -0
- package/dist/node_modules/motion-dom/dist/es/utils/border-radius.mjs.js.map +1 -0
- package/dist/node_modules/react-redux/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/socket.io-client/build/esm/index.js +1 -1
- package/dist/node_modules/socket.io-client/build/esm/index.js.map +1 -1
- package/dist/node_modules/socket.io-client/build/esm/manager.js +1 -1
- package/dist/node_modules/socket.io-client/build/esm/manager.js.map +1 -1
- package/dist/node_modules/socket.io-client/build/esm/socket.js +1 -1
- package/dist/node_modules/socket.io-client/build/esm/socket.js.map +1 -1
- package/dist/node_modules/socket.io-client/build/esm/url.js +1 -1
- package/dist/node_modules/socket.io-client/build/esm/url.js.map +1 -1
- package/dist/node_modules/socket.io-parser/build/esm/binary.js +1 -1
- package/dist/node_modules/socket.io-parser/build/esm/binary.js.map +1 -1
- package/dist/node_modules/socket.io-parser/build/esm/index.js +1 -1
- package/dist/node_modules/socket.io-parser/build/esm/index.js.map +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/package.json.js +1 -1
- package/package.json +1 -1
- package/dist/node_modules/engine.io-client/build/esm/contrib/yeast.js +0 -2
- package/dist/node_modules/engine.io-client/build/esm/contrib/yeast.js.map +0 -1
- package/dist/node_modules/engine.io-client/build/esm/globalThis.browser.js +0 -2
- package/dist/node_modules/engine.io-client/build/esm/globalThis.browser.js.map +0 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.js +0 -2
- package/dist/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.js.map +0 -1
- package/dist/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.js +0 -2
- package/dist/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.js.map +0 -1
- package/dist/node_modules/motion-dom/dist/es/stats/buffer.mjs.js +0 -2
- package/dist/node_modules/motion-dom/dist/es/stats/buffer.mjs.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/gestures/press/index.mjs"],"sourcesContent":["import { isHTMLElement } from '../../utils/is-html-element.mjs';\nimport { isDragActive } from '../drag/state/is-active.mjs';\nimport { isNodeOrChild } from '../utils/is-node-or-child.mjs';\nimport { isPrimaryPointer } from '../utils/is-primary-pointer.mjs';\nimport { setupGesture } from '../utils/setup.mjs';\nimport { isElementKeyboardAccessible } from './utils/is-keyboard-accessible.mjs';\nimport { enableKeyboardPress } from './utils/keyboard.mjs';\nimport { isPressing } from './utils/state.mjs';\n\n/**\n * Filter out events that are not primary pointer events, or are triggering\n * while a Motion gesture is active.\n */\nfunction isValidPressEvent(event) {\n return isPrimaryPointer(event) && !isDragActive();\n}\nconst claimedPointerDownEvents = new WeakSet();\n/**\n * Create a press gesture.\n *\n * Press is different to `\"pointerdown\"`, `\"pointerup\"` in that it\n * automatically filters out secondary pointer events like right\n * click and multitouch.\n *\n * It also adds accessibility support for keyboards, where\n * an element with a press gesture will receive focus and\n * trigger on Enter `\"keydown\"` and `\"keyup\"` events.\n *\n * This is different to a browser's `\"click\"` event, which does\n * respond to keyboards but only for the `\"click\"` itself, rather\n * than the press start and end/cancel. The element also needs\n * to be focusable for this to work, whereas a press gesture will\n * make an element focusable by default.\n *\n * @public\n */\nfunction press(targetOrSelector, onPressStart, options = {}) {\n const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);\n const startPress = (startEvent) => {\n const target = startEvent.currentTarget;\n if (!isValidPressEvent(startEvent))\n return;\n if (claimedPointerDownEvents.has(startEvent))\n return;\n isPressing.add(target);\n if (options.stopPropagation) {\n claimedPointerDownEvents.add(startEvent);\n }\n const onPressEnd = onPressStart(target, startEvent);\n const onPointerEnd = (endEvent, success) => {\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onPointerCancel);\n if (isPressing.has(target)) {\n isPressing.delete(target);\n }\n if (!isValidPressEvent(endEvent)) {\n return;\n }\n if (typeof onPressEnd === \"function\") {\n onPressEnd(endEvent, { success });\n }\n };\n const onPointerUp = (upEvent) => {\n onPointerEnd(upEvent, target === window ||\n target === document ||\n options.useGlobalTarget ||\n isNodeOrChild(target, upEvent.target));\n };\n const onPointerCancel = (cancelEvent) => {\n onPointerEnd(cancelEvent, false);\n };\n window.addEventListener(\"pointerup\", onPointerUp,
|
|
1
|
+
{"version":3,"file":"index.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/gestures/press/index.mjs"],"sourcesContent":["import { isHTMLElement } from '../../utils/is-html-element.mjs';\nimport { isDragActive } from '../drag/state/is-active.mjs';\nimport { isNodeOrChild } from '../utils/is-node-or-child.mjs';\nimport { isPrimaryPointer } from '../utils/is-primary-pointer.mjs';\nimport { setupGesture } from '../utils/setup.mjs';\nimport { isElementKeyboardAccessible } from './utils/is-keyboard-accessible.mjs';\nimport { enableKeyboardPress } from './utils/keyboard.mjs';\nimport { isPressing } from './utils/state.mjs';\n\n/**\n * Filter out events that are not primary pointer events, or are triggering\n * while a Motion gesture is active.\n */\nfunction isValidPressEvent(event) {\n return isPrimaryPointer(event) && !isDragActive();\n}\nconst claimedPointerDownEvents = new WeakSet();\n/**\n * Create a press gesture.\n *\n * Press is different to `\"pointerdown\"`, `\"pointerup\"` in that it\n * automatically filters out secondary pointer events like right\n * click and multitouch.\n *\n * It also adds accessibility support for keyboards, where\n * an element with a press gesture will receive focus and\n * trigger on Enter `\"keydown\"` and `\"keyup\"` events.\n *\n * This is different to a browser's `\"click\"` event, which does\n * respond to keyboards but only for the `\"click\"` itself, rather\n * than the press start and end/cancel. The element also needs\n * to be focusable for this to work, whereas a press gesture will\n * make an element focusable by default.\n *\n * @public\n */\nfunction press(targetOrSelector, onPressStart, options = {}) {\n const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);\n const startPress = (startEvent) => {\n const target = startEvent.currentTarget;\n if (!isValidPressEvent(startEvent))\n return;\n if (claimedPointerDownEvents.has(startEvent))\n return;\n isPressing.add(target);\n if (options.stopPropagation) {\n claimedPointerDownEvents.add(startEvent);\n }\n const onPressEnd = onPressStart(target, startEvent);\n /**\n * End listeners run in the capture phase so a descendant calling\n * stopPropagation() in its own pointerup handler can't prevent the\n * press gesture from ending. This also keeps the gesture-end\n * ordering consistent with the drag gesture. See #2794.\n */\n const endEventOptions = { ...eventOptions, capture: true };\n const onPointerEnd = (endEvent, success) => {\n window.removeEventListener(\"pointerup\", onPointerUp, endEventOptions);\n window.removeEventListener(\"pointercancel\", onPointerCancel, endEventOptions);\n if (isPressing.has(target)) {\n isPressing.delete(target);\n }\n if (!isValidPressEvent(endEvent)) {\n return;\n }\n if (typeof onPressEnd === \"function\") {\n onPressEnd(endEvent, { success });\n }\n };\n const onPointerUp = (upEvent) => {\n onPointerEnd(upEvent, target === window ||\n target === document ||\n options.useGlobalTarget ||\n isNodeOrChild(target, upEvent.target));\n };\n const onPointerCancel = (cancelEvent) => {\n onPointerEnd(cancelEvent, false);\n };\n window.addEventListener(\"pointerup\", onPointerUp, endEventOptions);\n window.addEventListener(\"pointercancel\", onPointerCancel, endEventOptions);\n };\n targets.forEach((target) => {\n const pointerDownTarget = options.useGlobalTarget ? window : target;\n pointerDownTarget.addEventListener(\"pointerdown\", startPress, eventOptions);\n if (isHTMLElement(target)) {\n target.addEventListener(\"focus\", (event) => enableKeyboardPress(event, eventOptions));\n if (!isElementKeyboardAccessible(target) &&\n !target.hasAttribute(\"tabindex\")) {\n target.tabIndex = 0;\n }\n }\n });\n return cancelEvents;\n}\n\nexport { press };\n//# sourceMappingURL=index.mjs.map\n"],"names":["isValidPressEvent","event","isPrimaryPointer","isDragActive","claimedPointerDownEvents","WeakSet","targetOrSelector","onPressStart","options","arguments","length","undefined","targets","eventOptions","cancelEvents","setupGesture","startPress","startEvent","target","currentTarget","has","isPressing","add","stopPropagation","onPressEnd","endEventOptions","capture","onPointerEnd","endEvent","success","window","removeEventListener","onPointerUp","onPointerCancel","delete","upEvent","document","useGlobalTarget","isNodeOrChild","cancelEvent","addEventListener","forEach","isHTMLElement","enableKeyboardPress","isElementKeyboardAccessible","hasAttribute","tabIndex"],"mappings":"+ZAgBA,SAASA,EAAkBC,GACvB,OAAOC,mBAAiBD,KAAWE,EAAYA,cACnD,CAEA,MAAMC,EAA2B,IAAIC,sBA0B/B,SACFC,EACAC,GACiC,IAAjCC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAA+B,CAAA,EAE/B,MAAOG,EAASC,EAAcC,GAAgBC,eAC1CT,EACAE,GAGEQ,EAAcC,IAChB,MAAMC,EAASD,EAAWE,cAE1B,IAAKnB,EAAkBiB,GAAa,OACpC,GAAIb,EAAyBgB,IAAIH,GAAa,OAE9CI,aAAWC,IAAIJ,GAEXV,EAAQe,iBACRnB,EAAyBkB,IAAIL,GAGjC,MAAMO,EAAajB,EAAaW,EAAQD,GAQlCQ,EAAkB,IAAKZ,EAAca,SAAS,GAE9CC,EAAeA,CAACC,EAAwBC,KAC1CC,OAAOC,oBACH,YACAC,EACAP,GAEJK,OAAOC,oBACH,gBACAE,EACAR,GAGAJ,EAAUA,WAACD,IAAIF,IACfG,aAAWa,OAAOhB,GAGjBlB,EAAkB4B,IAIG,mBAAfJ,GACPA,EAAWI,EAAU,CAAEC,WAC3B,EAGEG,EAAeG,IACjBR,EACIQ,EACCjB,IAAmBY,QACfZ,IAAmBkB,UACpB5B,EAAQ6B,iBACRC,EAAAA,cAAcpB,EAAQiB,EAAQjB,QACrC,EAGCe,EAAmBM,IACrBZ,EAAaY,GAAa,EAAM,EAGpCT,OAAOU,iBAAiB,YAAaR,EAAaP,GAClDK,OAAOU,iBACH,gBACAP,EACAR,EACH,EAyBL,OAtBAb,EAAQ6B,SAASvB,KACaV,EAAQ6B,gBAAkBP,OAASZ,GAC3CsB,iBACd,cACAxB,EACAH,GAGA6B,EAAAA,cAAcxB,KACdA,EAAOsB,iBAAiB,SAAUvC,GAC9B0C,EAAAA,oBAAoB1C,EAAqBY,KAIxC+B,EAA2BA,4BAAC1B,IAC5BA,EAAO2B,aAAa,cAErB3B,EAAO4B,SAAW,GAE1B,IAGGhC,CACX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../utils/mix/number.mjs.js"),t=require("../../value/types/numbers/units.mjs.js"),r=require("../../utils/border-radius.mjs.js"),i=require("../../../../../motion-utils/dist/es/easing/circ.mjs.js"),s=require("../../../../../motion-utils/dist/es/progress.mjs.js"),o=require("../../../../../motion-utils/dist/es/noop.mjs.js");const u=r.cornerRadiusProps.length,n=e=>"string"==typeof e?parseFloat(e):e,a=e=>"number"==typeof e||t.px.test(e);function m(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const c=d(0,.5,i.circOut),p=d(.5,.95,o.noop);function d(e,t,r){return i=>i<e?0:i>t?1:r(s.progress(e,t,i))}exports.mixValues=function(i,s,o,d,j,l){j?(i.opacity=e.mixNumber(0,o.opacity??1,c(d)),i.opacityExit=e.mixNumber(s.opacity??1,0,p(d))):l&&(i.opacity=e.mixNumber(s.opacity??1,o.opacity??1,d));for(let c=0;c<u;c++){const u=r.cornerRadiusProps[c];let p=m(s,u),j=m(o,u);if(void 0===p&&void 0===j)continue;p||(p=0),j||(j=0);0===p||0===j||a(p)===a(j)?(i[u]=Math.max(e.mixNumber(n(p),n(j),d),0),(t.percent.test(j)||t.percent.test(p))&&(i[u]+="%")):i[u]=j}(s.rotate||o.rotate)&&(i.rotate=e.mixNumber(s.rotate||0,o.rotate||0,d))};
|
|
2
2
|
//# sourceMappingURL=mix-values.mjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mix-values.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs"],"sourcesContent":["import { mixNumber } from '../../utils/mix/number.mjs';\nimport { percent, px } from '../../value/types/numbers/units.mjs';\nimport { progress, circOut, noop } from 'motion-utils';\
|
|
1
|
+
{"version":3,"file":"mix-values.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs"],"sourcesContent":["import { mixNumber } from '../../utils/mix/number.mjs';\nimport { percent, px } from '../../value/types/numbers/units.mjs';\nimport { progress, circOut, noop } from 'motion-utils';\nimport { cornerRadiusProps } from '../../utils/border-radius.mjs';\n\nconst numBorders = cornerRadiusProps.length;\nconst asNumber = (value) => typeof value === \"string\" ? parseFloat(value) : value;\nconst isPx = (value) => typeof value === \"number\" || px.test(value);\nfunction mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {\n if (shouldCrossfadeOpacity) {\n target.opacity = mixNumber(0, lead.opacity ?? 1, easeCrossfadeIn(progress));\n target.opacityExit = mixNumber(follow.opacity ?? 1, 0, easeCrossfadeOut(progress));\n }\n else if (isOnlyMember) {\n target.opacity = mixNumber(follow.opacity ?? 1, lead.opacity ?? 1, progress);\n }\n /**\n * Mix border radius\n */\n for (let i = 0; i < numBorders; i++) {\n const borderLabel = cornerRadiusProps[i];\n let followRadius = getRadius(follow, borderLabel);\n let leadRadius = getRadius(lead, borderLabel);\n if (followRadius === undefined && leadRadius === undefined)\n continue;\n followRadius || (followRadius = 0);\n leadRadius || (leadRadius = 0);\n const canMix = followRadius === 0 ||\n leadRadius === 0 ||\n isPx(followRadius) === isPx(leadRadius);\n if (canMix) {\n target[borderLabel] = Math.max(mixNumber(asNumber(followRadius), asNumber(leadRadius), progress), 0);\n if (percent.test(leadRadius) || percent.test(followRadius)) {\n target[borderLabel] += \"%\";\n }\n }\n else {\n target[borderLabel] = leadRadius;\n }\n }\n /**\n * Mix rotation\n */\n if (follow.rotate || lead.rotate) {\n target.rotate = mixNumber(follow.rotate || 0, lead.rotate || 0, progress);\n }\n}\nfunction getRadius(values, radiusName) {\n return values[radiusName] !== undefined\n ? values[radiusName]\n : values.borderRadius;\n}\nconst easeCrossfadeIn = /*@__PURE__*/ compress(0, 0.5, circOut);\nconst easeCrossfadeOut = /*@__PURE__*/ compress(0.5, 0.95, noop);\nfunction compress(min, max, easing) {\n return (p) => {\n // Could replace ifs with clamp\n if (p < min)\n return 0;\n if (p > max)\n return 1;\n return easing(progress(min, max, p));\n };\n}\n\nexport { mixValues };\n//# sourceMappingURL=mix-values.mjs.map\n"],"names":["numBorders","cornerRadiusProps","length","asNumber","value","parseFloat","isPx","px","test","getRadius","values","radiusName","undefined","borderRadius","easeCrossfadeIn","compress","circOut","easeCrossfadeOut","noop","min","max","easing","p","calcProgress","target","follow","lead","progress","shouldCrossfadeOpacity","isOnlyMember","opacity","mixNumber","opacityExit","i","borderLabel","followRadius","leadRadius","Math","percent","rotate"],"mappings":"uZAYA,MAAMA,EAAaC,EAAiBA,kBAACC,OAE/BC,EAAYC,GACG,iBAAVA,EAAqBC,WAAWD,GAASA,EAE9CE,EAAQF,GACO,iBAAVA,GAAsBG,KAAGC,KAAKJ,GA6EzC,SAASK,EAAUC,EAAwBC,GACvC,YAA8BC,IAAvBF,EAAOC,GACRD,EAAOC,GACPD,EAAOG,YACjB,CAEA,MAAMC,EAAgCC,EAAS,EAAG,GAAKC,EAAOA,SACxDC,EAAiCF,EAAS,GAAK,IAAMG,EAAIA,MAE/D,SAASH,EACLI,EACAC,EACAC,GAEA,OAAQC,GAEAA,EAAIH,EAAY,EAChBG,EAAIF,EAAY,EACbC,EAAOE,EAAAA,SAAaJ,EAAKC,EAAKE,GAE7C,mBA/FM,SACFE,EACAC,EACAC,EACAC,EACAC,EACAC,GAEID,GACAJ,EAAOM,QAAUC,EAASA,UACtB,EACCL,EAAKI,SAAsB,EAC5BhB,EAAgBa,IAEpBH,EAAOQ,YAAcD,EAASA,UACzBN,EAAOK,SAAsB,EAC9B,EACAb,EAAiBU,KAEdE,IACPL,EAAOM,QAAUC,YACZN,EAAOK,SAAsB,EAC7BJ,EAAKI,SAAsB,EAC5BH,IAOR,IAAK,IAAIM,EAAI,EAAGA,EAAIjC,EAAYiC,IAAK,CACjC,MAAMC,EAAcjC,oBAAkBgC,GACtC,IAAIE,EAAe1B,EAAUgB,EAAQS,GACjCE,EAAa3B,EAAUiB,EAAMQ,GAEjC,QAAqBtB,IAAjBuB,QAA6CvB,IAAfwB,EAA0B,SAE5DD,IAAAA,EAAiB,GACjBC,IAAAA,EAAe,GAGM,IAAjBD,GACe,IAAfC,GACA9B,EAAK6B,KAAkB7B,EAAK8B,IAG5BZ,EAAOU,GAAeG,KAAKjB,IACvBW,EAASA,UACL5B,EAASgC,GACThC,EAASiC,GACTT,GAEJ,IAGAW,EAAAA,QAAQ9B,KAAK4B,IAAeE,EAAAA,QAAQ9B,KAAK2B,MACzCX,EAAOU,IAAgB,MAG3BV,EAAOU,GAAeE,CAE9B,EAKIX,EAAOc,QAAUb,EAAKa,UACtBf,EAAOe,OAASR,YACXN,EAAOc,QAAqB,EAC5Bb,EAAKa,QAAqB,EAC3BZ,GAGZ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../animation/animate/single-value.mjs.js"),e=require("../../animation/optimized-appear/get-appear-id.mjs.js"),i=require("../../animation/utils/get-value-transition.mjs.js"),s=require("../../frameloop/microtask.mjs.js"),o=require("../../frameloop/sync-time.mjs.js"),a=require("../styles/scale-correction.mjs.js"),r=require("../../utils/delay.mjs.js"),n=require("../../utils/is-svg-element.mjs.js"),l=require("../../utils/is-svg-svg-element.mjs.js"),h=require("../../utils/mix/number.mjs.js"),c=require("../../value/index.mjs.js"),u=require("../../value/utils/resolve-motion-value.mjs.js"),d=require("../animation/mix-values.mjs.js"),m=require("../geometry/copy.mjs.js"),p=require("../geometry/delta-apply.mjs.js"),y=require("../geometry/delta-calc.mjs.js"),g=require("../geometry/delta-remove.mjs.js"),v=require("../geometry/models.mjs.js"),f=require("../geometry/utils.mjs.js"),x=require("../shared/stack.mjs.js"),j=require("../styles/transform.mjs.js"),T=require("../utils/each-axis.mjs.js"),D=require("../utils/flat-tree.mjs.js"),B=require("../utils/has-transform.mjs.js"),P=require("./state.mjs.js"),S=require("../../frameloop/frame.mjs.js"),A=require("../../../../../motion-utils/dist/es/noop.mjs.js"),R=require("../../../../../motion-utils/dist/es/subscription-manager.mjs.js"),V=require("../../../../../motion-utils/dist/es/clamp.mjs.js");const L=["","X","Y","Z"];let k=0;function E(t,e,i,s){const{latestValues:o}=e;o[t]&&(i[t]=o[t],e.setStaticValue(t,0),s&&(s[t]=0))}function w(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:i}=t.options;if(!i)return;const s=e.getOptimisedAppearId(i);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:e,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",S.frame,!(e||i))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&w(o)}function C(t){t.updateLayout()}function U(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:s}=t.layout,{animationType:o}=t.options,a=e.source!==t.layout.source;if("size"===o)T.eachAxis((t=>{const s=a?e.measuredBox[t]:e.layoutBox[t],o=y.calcLength(s);s.min=i[t].min,s.max=s.min+o}));else if("x"===o||"y"===o){const t="x"===o?"y":"x";m.copyAxisInto(a?e.measuredBox[t]:e.layoutBox[t],i[t])}else it(o,e.layoutBox,i)&&T.eachAxis((s=>{const o=a?e.measuredBox[s]:e.layoutBox[s],r=y.calcLength(i[s]);o.max=o.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+r)}));const r=v.createDelta();y.calcBoxDelta(r,i,e.layoutBox);const n=v.createDelta();a?y.calcBoxDelta(n,t.applyTransform(s,!0),e.measuredBox):y.calcBoxDelta(n,i,e.layoutBox);const l=!f.isDeltaZero(r);let h=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:o,layout:a}=s;if(o&&a){const r=t.options.layoutAnchor||void 0,n=v.createBox();y.calcRelativePosition(n,e.layoutBox,o.layoutBox,r);const l=v.createBox();y.calcRelativePosition(l,i,a.layoutBox,r),f.boxEqualsRounded(n,l)||(h=!0),s.options.layoutRoot&&(t.relativeTarget=l,t.relativeTargetOrigin=n,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:n,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function I(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function F(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function q(t){t.clearSnapshot()}function b(t){t.clearMeasurements()}function O(t){t.isLayoutDirty=!0,t.updateLayout()}function M(t){t.isLayoutDirty=!1}function N(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function z(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function H(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function W(t){t.resolveTargetDelta()}function G(t){t.calcProjection()}function Z(t){t.resetSkewAndRotation()}function $(t){t.removeLeadSnapshot()}function X(t,e,i){t.translate=h.mixNumber(e.translate,0,i),t.scale=h.mixNumber(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function Y(t,e,i,s){t.min=h.mixNumber(e.min,i.min,s),t.max=h.mixNumber(e.max,i.max,s)}function _(t,e,i,s){Y(t.x,e.x,i.x,s),Y(t.y,e.y,i.y,s)}function J(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const K={duration:.45,ease:[.4,0,.1,1]},Q=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),tt=Q("applewebkit/")&&!Q("chrome/")?Math.round:A.noop;function et(t){t.min=tt(t.min),t.max=tt(t.max)}function it(t,e,i){return"position"===t||"preserve-aspect"===t&&!y.isNear(f.aspectRatio(e),f.aspectRatio(i),.2)}function st(t){return t!==t.root&&t.scroll?.wasRoot}exports.cleanDirtyNodes=F,exports.createProjectionNode=function(e){let{attachResizeListener:T,defaultParent:A,measureScroll:Y,checkIsScrollRoot:Q,resetTransform:tt}=e;return class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A?.();this.id=k++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(I),this.nodes.forEach(W),this.nodes.forEach(G),this.nodes.forEach(F)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=e?e.root||e:this,this.path=e?[...e.path,e]:[],this.parent=e,this.depth=e?e.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new D.FlatTree)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new R.SubscriptionManager),this.eventHandlers.get(t).add(e)}notifyListeners(t){const e=this.eventHandlers.get(t);for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];e&&e.notify(...s)}hasListeners(t){return this.eventHandlers.has(t)}mount(t){if(this.instance)return;this.isSVG=n.isSVGElement(t)&&!l.isSVGSVGElement(t),this.instance=t;const{layoutId:e,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||e)&&(this.isLayoutDirty=!0),T){let e,i=0;const s=()=>this.root.updateBlockedByResize=!1;S.frame.read((()=>{i=window.innerWidth})),T(t,(()=>{const t=window.innerWidth;t!==i&&(i=t,this.root.updateBlockedByResize=!0,e&&e(),e=r.delay(s,250),P.globalProjectionState.hasAnimatedSinceResize&&(P.globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(H)))}))}e&&this.root.registerSharedNode(e,this),!1!==this.options.animate&&o&&(e||s)&&this.addEventListener("didUpdate",(t=>{let{delta:e,hasLayoutChanged:s,hasRelativeLayoutChanged:a,layout:r}=t;if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const n=this.options.transition||o.getDefaultTransition()||K,{onLayoutAnimationStart:l,onLayoutAnimationComplete:h}=o.getProps(),c=!this.targetLayout||!f.boxEqualsRounded(this.targetLayout,r),u=!s&&a;if(this.options.layoutRoot||this.resumeFrom||u||s&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...i.getValueTransition(n,"layout"),onPlay:l,onComplete:h};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,u,t.path)}else s||H(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),S.cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Z),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&w(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked()){const t=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),t&&this.nodes.forEach(O),void this.nodes.forEach(b)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(M);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(N),this.nodes.forEach(z),this.nodes.forEach(C),this.nodes.forEach(U)):this.nodes.forEach(M),this.clearAllSnapshots();const t=o.time.now();S.frameData.delta=V.clamp(0,1e3/60,t-S.frameData.timestamp),S.frameData.timestamp=t,S.frameData.isProcessing=!0,S.frameSteps.update.process(S.frameData),S.frameSteps.preRender.process(S.frameData),S.frameSteps.render.process(S.frameData),S.frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,s.microtask.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(q),this.sharedNodes.forEach($)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,S.frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){S.frame.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||y.calcLength(this.snapshot.measuredBox.x)||y.calcLength(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=v.createBox()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"measure",e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e&&this.instance){const e=Q(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:Y(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!tt)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!f.isDeltaZero(this.projectionDelta),i=this.getTransformTemplate(),s=i?i(this.latestValues,""):void 0,o=s!==this.prevTransformTemplateValue;t&&this.instance&&(e||B.hasTransform(this.latestValues)||o)&&(tt(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.measurePageBox();let i=this.removeElementScroll(e);var s;return t&&(i=this.removeTransform(i)),et((s=i).x),et(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return v.createBox();const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(st))){const{scroll:t}=this.root;t&&(p.translateAxis(e.x,t.offset.x),p.translateAxis(e.y,t.offset.y))}return e}removeElementScroll(t){const e=v.createBox();if(m.copyBoxInto(e,t),this.scroll?.wasRoot)return e;for(let i=0;i<this.path.length;i++){const s=this.path[i],{scroll:o,options:a}=s;s!==this.root&&o&&a.layoutScroll&&(o.wasRoot&&m.copyBoxInto(e,t),p.translateAxis(e.x,o.offset.x),p.translateAxis(e.y,o.offset.y))}return e}applyTransform(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=(arguments.length>2?arguments[2]:void 0)||v.createBox();m.copyBoxInto(i,t);for(let t=0;t<this.path.length;t++){const s=this.path[t];!e&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(p.translateAxis(i.x,-s.scroll.offset.x),p.translateAxis(i.y,-s.scroll.offset.y)),B.hasTransform(s.latestValues)&&p.transformBox(i,s.latestValues,s.layout?.layoutBox)}return B.hasTransform(this.latestValues)&&p.transformBox(i,this.latestValues,this.layout?.layoutBox),i}removeTransform(t){const e=v.createBox();m.copyBoxInto(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!B.hasTransform(i.latestValues))continue;let s;i.instance&&(B.hasScale(i.latestValues)&&i.updateSnapshot(),s=v.createBox(),m.copyBoxInto(s,i.measurePageBox())),g.removeBoxTransforms(e,i.latestValues,i.snapshot?.layoutBox,s)}return B.hasTransform(this.latestValues)&&g.removeBoxTransforms(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==S.frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=e.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=e.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=e.isSharedProjectionDirty);const i=Boolean(this.resumingFrom)||this!==e;if(!(t||i&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:s,layoutId:o}=this.options;if(!this.layout||!s&&!o)return;this.resolvedRelativeTargetAt=S.frameData.timestamp;const a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=v.createBox(),this.targetWithTransforms=v.createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),y.calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):m.copyBoxInto(this.target,this.layout.layoutBox),p.applyBoxDelta(this.target,this.targetDelta)):m.copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&a&&Boolean(a.resumingFrom)===Boolean(this.resumingFrom)&&!a.options.layoutScroll&&a.target&&1!==this.animationProgress?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!B.hasScale(this.parent.latestValues)&&!B.has2DTranslate(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(t,e,i){this.relativeParent=t,this.linkedParentVersion=t.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=v.createBox(),this.relativeTargetOrigin=v.createBox(),y.calcRelativePosition(this.relativeTargetOrigin,e,i,this.options.layoutAnchor||void 0),m.copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const t=this.getLead(),e=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(i=!1),e&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===S.frameData.timestamp&&(i=!1),i)return;const{layout:s,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!s&&!o)return;m.copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const a=this.treeScale.x,r=this.treeScale.y;p.applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,e),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms=v.createBox());const{target:n}=t;n?(this.projectionDelta&&this.prevProjectionDelta?(m.copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),m.copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),y.calcBoxDelta(this.projectionDelta,this.layoutCorrected,n,this.latestValues),this.treeScale.x===a&&this.treeScale.y===r&&f.axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)&&f.axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",n))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.options.visualElement?.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=v.createDelta(),this.projectionDelta=v.createDelta(),this.projectionDeltaWithTransform=v.createDelta()}setAnimationOrigin(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=this.snapshot,o=s?s.latestValues:{},a={...this.latestValues},r=v.createDelta();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const n=v.createBox(),l=(s?s.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,p=Boolean(l&&!u&&!0===this.options.crossfade&&!this.path.some(J));let g;this.animationProgress=0;const x=i?.interpolateProjection(t);this.mixTargetDelta=e=>{const i=e/1e3,s=x?.(i);s?(r.x.translate=s.x,r.x.scale=h.mixNumber(t.x.scale,1,i),r.x.origin=t.x.origin,r.x.originPoint=t.x.originPoint,r.y.translate=s.y,r.y.scale=h.mixNumber(t.y.scale,1,i),r.y.origin=t.y.origin,r.y.originPoint=t.y.originPoint):(X(r.x,t.x,i),X(r.y,t.y,i)),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(y.calcRelativePosition(n,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),_(this.relativeTarget,this.relativeTargetOrigin,n,i),g&&f.boxEquals(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=v.createBox()),m.copyBoxInto(g,this.relativeTarget)),l&&(this.animationValues=a,d.mixValues(a,o,this.latestValues,i,p,u)),s&&void 0!==s.rotate&&(this.animationValues||(this.animationValues=a),this.animationValues.pathRotation=s.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(S.cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=S.frame.update((()=>{P.globalProjectionState.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=c.motionValue(0)),this.motionValue.jump(0,!1),this.currentAnimation=t.animateSingleValue(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:s,latestValues:o}=t;if(e&&i&&s){if(this!==t&&this.layout&&s&&it(this.options.animationType,this.layout.layoutBox,s.layoutBox)){i=this.target||v.createBox();const e=y.calcLength(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const s=y.calcLength(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+s}m.copyBoxInto(e,i),p.transformBox(e,o),y.calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,e,o)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new x.NodeStack);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){const{layoutId:t}=this.options;return t&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:t}=this.options;return t?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote(){let{needsReset:t,transition:e,preserveFollowOpacity:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this.getStack();s&&s.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const s={};i.z&&E("z",t,s,this.animationValues);for(let e=0;e<L.length;e++)E(`rotate${L[e]}`,t,s,this.animationValues),E(`skew${L[e]}`,t,s,this.animationValues);t.render();for(const e in s)t.setStaticValue(e,s[e]),this.animationValues&&(this.animationValues[e]=s[e]);t.scheduleRender()}applyProjectionStyles(t,e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(t.visibility="hidden");const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.visibility="",t.opacity="",t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||"",void(t.transform=i?i(this.latestValues,""):"none");const s=this.getLead();if(!this.projectionDelta||!this.layout||!s.target)return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||""),void(this.hasProjected&&!B.hasTransform(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1));t.visibility="";const o=s.animationValues||s.latestValues;this.applyTransformsToTarget();let r=j.buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,o);i&&(r=i(o,r)),t.transform=r;const{x:n,y:l}=this.projectionDelta;t.transformOrigin=`${100*n.origin}% ${100*l.origin}% 0`,s.animationValues?t.opacity=s===this?o.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:o.opacityExit:t.opacity=s===this?void 0!==o.opacity?o.opacity:"":void 0!==o.opacityExit?o.opacityExit:0;for(const e in a.scaleCorrectors){if(void 0===o[e])continue;const{correct:i,applyTo:n,isCSSVariable:l}=a.scaleCorrectors[e],h="none"===r?o[e]:i(o[e],s);if(n){const e=n.length;for(let i=0;i<e;i++)t[n[i]]=h}else l?this.options.visualElement.renderState.vars[e]=h:t[e]=h}this.options.layoutId&&(t.pointerEvents=s===this?u.resolveMotionValue(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>t.currentAnimation?.stop())),this.root.nodes.forEach(b),this.root.sharedNodes.clear()}}},exports.mixAxis=Y,exports.mixBox=_,exports.propagateDirtyNodes=I;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../animation/animate/single-value.mjs.js"),e=require("../../animation/optimized-appear/get-appear-id.mjs.js"),i=require("../../animation/utils/get-value-transition.mjs.js"),s=require("../../frameloop/microtask.mjs.js"),o=require("../../frameloop/sync-time.mjs.js"),a=require("../styles/scale-correction.mjs.js"),r=require("../../utils/delay.mjs.js"),n=require("../../utils/is-svg-element.mjs.js"),l=require("../../utils/is-svg-svg-element.mjs.js"),h=require("../../utils/mix/number.mjs.js"),c=require("../../value/index.mjs.js"),u=require("../../value/utils/resolve-motion-value.mjs.js"),d=require("../animation/mix-values.mjs.js"),m=require("../geometry/copy.mjs.js"),p=require("../geometry/delta-apply.mjs.js"),y=require("../geometry/delta-calc.mjs.js"),g=require("../geometry/delta-remove.mjs.js"),v=require("../geometry/models.mjs.js"),f=require("../geometry/utils.mjs.js"),x=require("../shared/stack.mjs.js"),j=require("../styles/transform.mjs.js"),T=require("../utils/each-axis.mjs.js"),D=require("../utils/flat-tree.mjs.js"),B=require("../utils/has-transform.mjs.js"),P=require("./state.mjs.js"),S=require("../../frameloop/frame.mjs.js"),A=require("../../../../../motion-utils/dist/es/noop.mjs.js"),R=require("../../../../../motion-utils/dist/es/subscription-manager.mjs.js"),V=require("../../../../../motion-utils/dist/es/clamp.mjs.js");const L=["","X","Y","Z"];let k=0;function E(t,e,i,s){const{latestValues:o}=e;o[t]&&(i[t]=o[t],e.setStaticValue(t,0),s&&(s[t]=0))}function w(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:i}=t.options;if(!i)return;const s=e.getOptimisedAppearId(i);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:e,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",S.frame,!(e||i))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&w(o)}function C(t){t.updateLayout()}function U(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:s}=t.layout,{animationType:o}=t.options,a=e.source!==t.layout.source;if("size"===o)T.eachAxis((t=>{const s=a?e.measuredBox[t]:e.layoutBox[t],o=y.calcLength(s);s.min=i[t].min,s.max=s.min+o}));else if("x"===o||"y"===o){const t="x"===o?"y":"x";m.copyAxisInto(a?e.measuredBox[t]:e.layoutBox[t],i[t])}else it(o,e.layoutBox,i)&&T.eachAxis((s=>{const o=a?e.measuredBox[s]:e.layoutBox[s],r=y.calcLength(i[s]);o.max=o.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+r)}));const r=v.createDelta();y.calcBoxDelta(r,i,e.layoutBox);const n=v.createDelta();a?y.calcBoxDelta(n,t.applyTransform(s,!0),e.measuredBox):y.calcBoxDelta(n,i,e.layoutBox);const l=!f.isDeltaZero(r);let h=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:o,layout:a}=s;if(o&&a){const r=t.options.layoutAnchor||void 0,n=v.createBox();y.calcRelativePosition(n,e.layoutBox,o.layoutBox,r);const l=v.createBox();y.calcRelativePosition(l,i,a.layoutBox,r),f.boxEqualsRounded(n,l)||(h=!0),s.options.layoutRoot&&(t.relativeTarget=l,t.relativeTargetOrigin=n,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:n,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function I(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function F(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function q(t){t.clearSnapshot()}function b(t){t.clearMeasurements()}function O(t){t.isLayoutDirty=!0,t.updateLayout()}function M(t){t.isLayoutDirty=!1}function N(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function z(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function H(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function W(t){t.resolveTargetDelta()}function G(t){t.calcProjection()}function Z(t){t.resetSkewAndRotation()}function $(t){t.removeLeadSnapshot()}function X(t,e,i){t.translate=h.mixNumber(e.translate,0,i),t.scale=h.mixNumber(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function Y(t,e,i,s){t.min=h.mixNumber(e.min,i.min,s),t.max=h.mixNumber(e.max,i.max,s)}function _(t,e,i,s){Y(t.x,e.x,i.x,s),Y(t.y,e.y,i.y,s)}function J(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const K={duration:.45,ease:[.4,0,.1,1]},Q=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),tt=Q("applewebkit/")&&!Q("chrome/")?Math.round:A.noop;function et(t){t.min=tt(t.min),t.max=tt(t.max)}function it(t,e,i){return"position"===t||"preserve-aspect"===t&&!y.isNear(f.aspectRatio(e),f.aspectRatio(i),.2)}function st(t){return t!==t.root&&t.scroll?.wasRoot}exports.cleanDirtyNodes=F,exports.createProjectionNode=function(e){let{attachResizeListener:T,defaultParent:A,measureScroll:Y,checkIsScrollRoot:Q,resetTransform:tt}=e;return class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A?.();this.id=k++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(I),this.nodes.forEach(W),this.nodes.forEach(G),this.nodes.forEach(F)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=e?e.root||e:this,this.path=e?[...e.path,e]:[],this.parent=e,this.depth=e?e.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new D.FlatTree)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new R.SubscriptionManager),this.eventHandlers.get(t).add(e)}notifyListeners(t){const e=this.eventHandlers.get(t);for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];e&&e.notify(...s)}hasListeners(t){return this.eventHandlers.has(t)}mount(t){if(this.instance)return;this.isSVG=n.isSVGElement(t)&&!l.isSVGSVGElement(t),this.instance=t;const{layoutId:e,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||e)&&(this.isLayoutDirty=!0),T){let e,i=0;const s=()=>this.root.updateBlockedByResize=!1;S.frame.read((()=>{i=window.innerWidth})),T(t,(()=>{const t=window.innerWidth;t!==i&&(i=t,this.root.updateBlockedByResize=!0,e&&e(),e=r.delay(s,250),P.globalProjectionState.hasAnimatedSinceResize&&(P.globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(H)))}))}e&&this.root.registerSharedNode(e,this),!1!==this.options.animate&&o&&(e||s)&&this.addEventListener("didUpdate",(t=>{let{delta:e,hasLayoutChanged:s,hasRelativeLayoutChanged:a,layout:r}=t;if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const n=this.options.transition||o.getDefaultTransition()||K,{onLayoutAnimationStart:l,onLayoutAnimationComplete:h}=o.getProps(),c=!this.targetLayout||!f.boxEqualsRounded(this.targetLayout,r),u=!s&&a;if(this.options.layoutRoot||this.resumeFrom||u||s&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...i.getValueTransition(n,"layout"),onPlay:l,onComplete:h};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,u,t.path)}else s||H(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),S.cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Z),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&w(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked()){const t=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),t&&this.nodes.forEach(O),void this.nodes.forEach(b)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(M);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(N),this.nodes.forEach(z),this.nodes.forEach(C),this.nodes.forEach(U)):this.nodes.forEach(M),this.clearAllSnapshots();const t=o.time.now();S.frameData.delta=V.clamp(0,1e3/60,t-S.frameData.timestamp),S.frameData.timestamp=t,S.frameData.isProcessing=!0,S.frameSteps.update.process(S.frameData),S.frameSteps.preRender.process(S.frameData),S.frameSteps.render.process(S.frameData),S.frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,s.microtask.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(q),this.sharedNodes.forEach($)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,S.frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){S.frame.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||y.calcLength(this.snapshot.measuredBox.x)||y.calcLength(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=v.createBox()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"measure",e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e&&this.instance){const e=Q(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:Y(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!tt)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!f.isDeltaZero(this.projectionDelta),i=this.getTransformTemplate(),s=i?i(this.latestValues,""):void 0,o=s!==this.prevTransformTemplateValue;t&&this.instance&&(e||B.hasTransform(this.latestValues)||o)&&(tt(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.measurePageBox();let i=this.removeElementScroll(e);var s;return t&&(i=this.removeTransform(i)),et((s=i).x),et(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return v.createBox();const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(st))){const{scroll:t}=this.root;t&&(p.translateAxis(e.x,t.offset.x),p.translateAxis(e.y,t.offset.y))}return e}removeElementScroll(t){const e=v.createBox();if(m.copyBoxInto(e,t),this.scroll?.wasRoot)return e;for(let i=0;i<this.path.length;i++){const s=this.path[i],{scroll:o,options:a}=s;s!==this.root&&o&&a.layoutScroll&&(o.wasRoot&&m.copyBoxInto(e,t),p.translateAxis(e.x,o.offset.x),p.translateAxis(e.y,o.offset.y))}return e}applyTransform(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=(arguments.length>2?arguments[2]:void 0)||v.createBox();m.copyBoxInto(i,t);for(let t=0;t<this.path.length;t++){const s=this.path[t];!e&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(p.translateAxis(i.x,-s.scroll.offset.x),p.translateAxis(i.y,-s.scroll.offset.y)),B.hasTransform(s.latestValues)&&p.transformBox(i,s.latestValues,s.layout?.layoutBox)}return B.hasTransform(this.latestValues)&&p.transformBox(i,this.latestValues,this.layout?.layoutBox),i}removeTransform(t){const e=v.createBox();m.copyBoxInto(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!B.hasTransform(i.latestValues))continue;let s;i.instance&&(B.hasScale(i.latestValues)&&i.updateSnapshot(),s=v.createBox(),m.copyBoxInto(s,i.measurePageBox())),g.removeBoxTransforms(e,i.latestValues,i.snapshot?.layoutBox,s)}return B.hasTransform(this.latestValues)&&g.removeBoxTransforms(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==S.frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=e.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=e.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=e.isSharedProjectionDirty);const i=Boolean(this.resumingFrom)||this!==e;if(!(t||i&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:s,layoutId:o}=this.options;if(!this.layout||!s&&!o)return;this.resolvedRelativeTargetAt=S.frameData.timestamp;const a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=v.createBox(),this.targetWithTransforms=v.createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),y.calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):m.copyBoxInto(this.target,this.layout.layoutBox),p.applyBoxDelta(this.target,this.targetDelta)):m.copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&a&&Boolean(a.resumingFrom)===Boolean(this.resumingFrom)&&!a.options.layoutScroll&&a.target&&1!==this.animationProgress?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!B.hasScale(this.parent.latestValues)&&!B.has2DTranslate(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(t,e,i){this.relativeParent=t,this.linkedParentVersion=t.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=v.createBox(),this.relativeTargetOrigin=v.createBox(),y.calcRelativePosition(this.relativeTargetOrigin,e,i,this.options.layoutAnchor||void 0),m.copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const t=this.getLead(),e=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(i=!1),e&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===S.frameData.timestamp&&(i=!1),i)return;const{layout:s,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!s&&!o)return;m.copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const a=this.treeScale.x,r=this.treeScale.y;p.applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,e),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms=v.createBox());const{target:n}=t;n?(this.projectionDelta&&this.prevProjectionDelta?(m.copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),m.copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),y.calcBoxDelta(this.projectionDelta,this.layoutCorrected,n,this.latestValues),this.treeScale.x===a&&this.treeScale.y===r&&f.axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)&&f.axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",n))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.options.visualElement?.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=v.createDelta(),this.projectionDelta=v.createDelta(),this.projectionDeltaWithTransform=v.createDelta()}setAnimationOrigin(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=this.snapshot,o=s?s.latestValues:{},a={...this.latestValues},r=v.createDelta();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const n=v.createBox(),l=(s?s.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,p=Boolean(l&&!u&&!0===this.options.crossfade&&!this.path.some(J));let g;this.animationProgress=0;const x=i?.interpolateProjection(t);this.mixTargetDelta=e=>{const i=e/1e3,s=x?.(i);s?(r.x.translate=s.x,r.x.scale=h.mixNumber(t.x.scale,1,i),r.x.origin=t.x.origin,r.x.originPoint=t.x.originPoint,r.y.translate=s.y,r.y.scale=h.mixNumber(t.y.scale,1,i),r.y.origin=t.y.origin,r.y.originPoint=t.y.originPoint):(X(r.x,t.x,i),X(r.y,t.y,i)),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(y.calcRelativePosition(n,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),_(this.relativeTarget,this.relativeTargetOrigin,n,i),g&&f.boxEquals(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=v.createBox()),m.copyBoxInto(g,this.relativeTarget)),l&&(this.animationValues=a,d.mixValues(a,o,this.latestValues,i,p,u)),s&&void 0!==s.rotate&&(this.animationValues||(this.animationValues=a),this.animationValues.pathRotation=s.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(S.cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=S.frame.update((()=>{P.globalProjectionState.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=c.motionValue(0)),this.motionValue.jump(0,!1),this.currentAnimation=t.animateSingleValue(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:s,latestValues:o}=t;if(e&&i&&s){if(this!==t&&this.layout&&s&&it(this.options.animationType,this.layout.layoutBox,s.layoutBox)){i=this.target||v.createBox();const e=y.calcLength(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const s=y.calcLength(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+s}m.copyBoxInto(e,i),p.transformBox(e,o),y.calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,e,o)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new x.NodeStack);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){const{layoutId:t}=this.options;return t&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:t}=this.options;return t?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote(){let{needsReset:t,transition:e,preserveFollowOpacity:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this.getStack();s&&s.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const s={};i.z&&E("z",t,s,this.animationValues);for(let e=0;e<L.length;e++)E(`rotate${L[e]}`,t,s,this.animationValues),E(`skew${L[e]}`,t,s,this.animationValues);t.render();for(const e in s)t.setStaticValue(e,s[e]),this.animationValues&&(this.animationValues[e]=s[e]);t.scheduleRender()}applyProjectionStyles(t,e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(t.visibility="hidden");const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.visibility="",t.opacity="",t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||"",void(t.transform=i?i(this.latestValues,""):"none");const s=this.getLead();if(!this.projectionDelta||!this.layout||!s.target)return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||""),void(this.hasProjected&&!B.hasTransform(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1));t.visibility="";const o=s.animationValues||s.latestValues;this.applyTransformsToTarget();let r=j.buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,o);i&&(r=i(o,r)),t.transform=r;const{x:n,y:l}=this.projectionDelta;t.transformOrigin=`${100*n.origin}% ${100*l.origin}% 0`,s.animationValues?t.opacity=s===this?o.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:o.opacityExit:t.opacity=s===this?void 0!==o.opacity?o.opacity:"":void 0!==o.opacityExit?o.opacityExit:0;for(const e in a.scaleCorrectors){if(void 0===o[e])continue;const{correct:i,applyTo:n,isCSSVariable:l}=a.scaleCorrectors[e],h="none"===r?o[e]:i(o[e],s);if(n){const e=n.length;for(let i=0;i<e;i++)t[n[i]]=h}else l?this.options.visualElement.renderState.vars[e]=h:t[e]=h}this.options.layoutId&&(t.pointerEvents=s===this?u.resolveMotionValue(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>t.currentAnimation?.stop())),this.root.nodes.forEach(b),this.root.sharedNodes.clear()}}},exports.mixAxis=Y,exports.mixBox=_,exports.propagateDirtyNodes=I;
|
|
2
2
|
//# sourceMappingURL=create-projection-node.mjs.js.map
|