@react-scrollytelling/framer-motion 0.1.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/README.md +11 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.es.js +384 -0
- package/dist/index.es.js.map +1 -0
- package/dist/src/hooks/index.d.ts +3 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/useActiveSectionMotionValue.d.ts +16 -0
- package/dist/src/hooks/useActiveSectionMotionValue.d.ts.map +1 -0
- package/dist/src/hooks/useSectionScrollMotionValue.d.ts +13 -0
- package/dist/src/hooks/useSectionScrollMotionValue.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),k=require("@react-scrollytelling/grouped"),O=require("@react-scrollytelling/core");function U(s){const e=u.useRef(null);return e.current===null&&(e.current=s()),e.current}function N(s,e){s.indexOf(e)===-1&&s.push(e)}function D(s,e){const t=s.indexOf(e);t>-1&&s.splice(t,1)}function L(s,e){return s}const V={},I=s=>s;class j{constructor(){this.subscriptions=[]}add(e){return N(this.subscriptions,e),()=>D(this.subscriptions,e)}notify(e,t,i){const n=this.subscriptions.length;if(n)if(n===1)this.subscriptions[0](e,t,i);else for(let o=0;o<n;o++){const r=this.subscriptions[o];r&&r(e,t,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function K(s,e){return e?s*(1e3/e):0}const w=new Set;function _(s,e,t){w.has(e)||(console.warn(L(e)),w.add(e))}const m=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],C={value:null,addProjectionMetrics:null};function z(s,e){let t=new Set,i=new Set,n=!1,o=!1;const r=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1},f=0;function S(a){r.has(a)&&(h.schedule(a),s()),f++,a(d)}const h={schedule:(a,A=!1,M=!1)=>{const p=M&&n?t:i;return A&&r.add(a),p.has(a)||p.add(a),a},cancel:a=>{i.delete(a),r.delete(a)},process:a=>{if(d=a,n){o=!0;return}n=!0,[t,i]=[i,t],t.forEach(S),e&&C.value&&C.value.frameloop[e].push(f),f=0,t.clear(),n=!1,o&&(o=!1,h.process(a))}};return h}const B=40;function W(s,e){let t=!1,i=!0;const n={delta:0,timestamp:0,isProcessing:!1},o=()=>t=!0,r=m.reduce((c,l)=>(c[l]=z(o,l),c),{}),{setup:d,read:f,resolveKeyframes:S,preUpdate:h,update:a,preRender:A,render:M,postRender:y}=r,p=()=>{const c=V.useManualTiming?n.timestamp:performance.now();t=!1,V.useManualTiming||(n.delta=i?1e3/60:Math.max(Math.min(c-n.timestamp,B),1)),n.timestamp=c,n.isProcessing=!0,d.process(n),f.process(n),S.process(n),h.process(n),a.process(n),A.process(n),M.process(n),y.process(n),n.isProcessing=!1,t&&e&&(i=!1,s(p))},E=()=>{t=!0,i=!0,n.isProcessing||s(p)};return{schedule:m.reduce((c,l)=>{const T=r[l];return c[l]=(b,x=!1,q=!1)=>(t||E(),T.schedule(b,x,q)),c},{}),cancel:c=>{for(let l=0;l<m.length;l++)r[m[l]].cancel(c)},state:n,steps:r}}const{schedule:G,cancel:se,state:F,steps:ne}=W(typeof requestAnimationFrame!="undefined"?requestAnimationFrame:I,!0);let v;function X(){v=void 0}const g={now:()=>(v===void 0&&g.set(F.isProcessing||V.useManualTiming?F.timestamp:performance.now()),v),set:s=>{v=s,queueMicrotask(X)}},P=30,Y=s=>!isNaN(parseFloat(s));class H{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{var o;const n=g.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&((o=this.events.change)==null||o.notify(this.current),this.dependents))for(const r of this.dependents)r.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=g.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Y(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&_(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new j);const i=this.events[e].add(t);return e==="change"?()=>{i(),G.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,i){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=g.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>P)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,P);return K(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,t;(e=this.dependents)==null||e.clear(),(t=this.events.destroy)==null||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function J(s,e){return new H(s,e)}const Q=u.createContext({transformPagePoint:s=>s,isStatic:!1,reducedMotion:"never"});function R(s){const e=U(()=>J(s)),{isStatic:t}=u.useContext(Q);if(t){const[,i]=u.useState(s);u.useEffect(()=>e.on("change",i),[])}return e}function Z(s){const e=u.useRef(R(0)),[t,i]=u.useState(null),n=u.useCallback(o=>{const{trackingId:r,scrolledRatio:d}=o;i(r),e.current.set(d),s&&s(o)},[s]);return k.useActiveSection(n),{trackingId:t,scrolledRatioMotionValue:e.current}}function $(s,e,t=!0,i){const n=u.useRef(R(0)),o=u.useCallback(r=>{const{scrolledRatio:d}=r;n.current.set(d),e&&e(r)},[e]);return O.useSectionScroll(s,o,t,i),{scrolledRatioMotionValue:n.current}}exports.useActiveSectionMotionValue=Z;exports.useSectionScrollMotionValue=$;
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../node_modules/framer-motion/dist/es/utils/use-constant.mjs","../../../node_modules/motion-utils/dist/es/array.mjs","../../../node_modules/motion-utils/dist/es/format-error-message.mjs","../../../node_modules/motion-utils/dist/es/global-config.mjs","../../../node_modules/motion-utils/dist/es/noop.mjs","../../../node_modules/motion-utils/dist/es/subscription-manager.mjs","../../../node_modules/motion-utils/dist/es/velocity-per-second.mjs","../../../node_modules/motion-utils/dist/es/warn-once.mjs","../../../node_modules/motion-dom/dist/es/frameloop/order.mjs","../../../node_modules/motion-dom/dist/es/stats/buffer.mjs","../../../node_modules/motion-dom/dist/es/frameloop/render-step.mjs","../../../node_modules/motion-dom/dist/es/frameloop/batcher.mjs","../../../node_modules/motion-dom/dist/es/frameloop/frame.mjs","../../../node_modules/motion-dom/dist/es/frameloop/sync-time.mjs","../../../node_modules/motion-dom/dist/es/value/index.mjs","../../../node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs","../../../node_modules/framer-motion/dist/es/value/use-motion-value.mjs","../src/hooks/useActiveSectionMotionValue.ts","../src/hooks/useSectionScrollMotionValue.ts"],"sourcesContent":["\"use client\";\nimport { useRef } from 'react';\n\n/**\n * Creates a constant value over the lifecycle of a component.\n *\n * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer\n * a guarantee that it won't re-run for performance reasons later on. By using `useConstant`\n * you can ensure that initialisers don't execute twice or more.\n */\nfunction useConstant(init) {\n const ref = useRef(null);\n if (ref.current === null) {\n ref.current = init();\n }\n return ref.current;\n}\n\nexport { useConstant };\n","function addUniqueItem(arr, item) {\n if (arr.indexOf(item) === -1)\n arr.push(item);\n}\nfunction removeItem(arr, item) {\n const index = arr.indexOf(item);\n if (index > -1)\n arr.splice(index, 1);\n}\n// Adapted from array-move\nfunction moveItem([...arr], fromIndex, toIndex) {\n const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;\n if (startIndex >= 0 && startIndex < arr.length) {\n const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;\n const [item] = arr.splice(fromIndex, 1);\n arr.splice(endIndex, 0, item);\n }\n return arr;\n}\n\nexport { addUniqueItem, moveItem, removeItem };\n","function formatErrorMessage(message, errorCode) {\n return errorCode\n ? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`\n : message;\n}\n\nexport { formatErrorMessage };\n","const MotionGlobalConfig = {};\n\nexport { MotionGlobalConfig };\n","/*#__NO_SIDE_EFFECTS__*/\nconst noop = (any) => any;\n\nexport { noop };\n","import { addUniqueItem, removeItem } from './array.mjs';\n\nclass SubscriptionManager {\n constructor() {\n this.subscriptions = [];\n }\n add(handler) {\n addUniqueItem(this.subscriptions, handler);\n return () => removeItem(this.subscriptions, handler);\n }\n notify(a, b, c) {\n const numSubscriptions = this.subscriptions.length;\n if (!numSubscriptions)\n return;\n if (numSubscriptions === 1) {\n /**\n * If there's only a single handler we can just call it without invoking a loop.\n */\n this.subscriptions[0](a, b, c);\n }\n else {\n for (let i = 0; i < numSubscriptions; i++) {\n /**\n * Check whether the handler exists before firing as it's possible\n * the subscriptions were modified during this loop running.\n */\n const handler = this.subscriptions[i];\n handler && handler(a, b, c);\n }\n }\n }\n getSize() {\n return this.subscriptions.length;\n }\n clear() {\n this.subscriptions.length = 0;\n }\n}\n\nexport { SubscriptionManager };\n","/*\n Convert velocity into velocity per second\n\n @param [number]: Unit per frame\n @param [number]: Frame duration in ms\n*/\nfunction velocityPerSecond(velocity, frameDuration) {\n return frameDuration ? velocity * (1000 / frameDuration) : 0;\n}\n\nexport { velocityPerSecond };\n","import { formatErrorMessage } from './format-error-message.mjs';\n\nconst warned = new Set();\nfunction hasWarned(message) {\n return warned.has(message);\n}\nfunction warnOnce(condition, message, errorCode) {\n if (condition || warned.has(message))\n return;\n console.warn(formatErrorMessage(message, errorCode));\n warned.add(message);\n}\n\nexport { hasWarned, warnOnce };\n","const stepsOrder = [\n \"setup\", // Compute\n \"read\", // Read\n \"resolveKeyframes\", // Write/Read/Write/Read\n \"preUpdate\", // Compute\n \"update\", // Compute\n \"preRender\", // Compute\n \"render\", // Write\n \"postRender\", // Compute\n];\n\nexport { stepsOrder };\n","const statsBuffer = {\n value: null,\n addProjectionMetrics: null,\n};\n\nexport { statsBuffer };\n","import { statsBuffer } from '../stats/buffer.mjs';\n\nfunction createRenderStep(runNextFrame, stepName) {\n /**\n * We create and reuse two queues, one to queue jobs for the current frame\n * and one for the next. We reuse to avoid triggering GC after x frames.\n */\n let thisFrame = new Set();\n let nextFrame = new Set();\n /**\n * Track whether we're currently processing jobs in this step. This way\n * we can decide whether to schedule new jobs for this frame or next.\n */\n let isProcessing = false;\n let flushNextFrame = false;\n /**\n * A set of processes which were marked keepAlive when scheduled.\n */\n const toKeepAlive = new WeakSet();\n let latestFrameData = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n let numCalls = 0;\n function triggerCallback(callback) {\n if (toKeepAlive.has(callback)) {\n step.schedule(callback);\n runNextFrame();\n }\n numCalls++;\n callback(latestFrameData);\n }\n const step = {\n /**\n * Schedule a process to run on the next frame.\n */\n schedule: (callback, keepAlive = false, immediate = false) => {\n const addToCurrentFrame = immediate && isProcessing;\n const queue = addToCurrentFrame ? thisFrame : nextFrame;\n if (keepAlive)\n toKeepAlive.add(callback);\n if (!queue.has(callback))\n queue.add(callback);\n return callback;\n },\n /**\n * Cancel the provided callback from running on the next frame.\n */\n cancel: (callback) => {\n nextFrame.delete(callback);\n toKeepAlive.delete(callback);\n },\n /**\n * Execute all schedule callbacks.\n */\n process: (frameData) => {\n latestFrameData = frameData;\n /**\n * If we're already processing we've probably been triggered by a flushSync\n * inside an existing process. Instead of executing, mark flushNextFrame\n * as true and ensure we flush the following frame at the end of this one.\n */\n if (isProcessing) {\n flushNextFrame = true;\n return;\n }\n isProcessing = true;\n [thisFrame, nextFrame] = [nextFrame, thisFrame];\n // Execute this frame\n thisFrame.forEach(triggerCallback);\n /**\n * If we're recording stats then\n */\n if (stepName && statsBuffer.value) {\n statsBuffer.value.frameloop[stepName].push(numCalls);\n }\n numCalls = 0;\n // Clear the frame so no callbacks remain. This is to avoid\n // memory leaks should this render step not run for a while.\n thisFrame.clear();\n isProcessing = false;\n if (flushNextFrame) {\n flushNextFrame = false;\n step.process(frameData);\n }\n },\n };\n return step;\n}\n\nexport { createRenderStep };\n","import { MotionGlobalConfig } from 'motion-utils';\nimport { stepsOrder } from './order.mjs';\nimport { createRenderStep } from './render-step.mjs';\n\nconst maxElapsed = 40;\nfunction createRenderBatcher(scheduleNextBatch, allowKeepAlive) {\n let runNextFrame = false;\n let useDefaultElapsed = true;\n const state = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n const flagRunNextFrame = () => (runNextFrame = true);\n const steps = stepsOrder.reduce((acc, key) => {\n acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : undefined);\n return acc;\n }, {});\n const { setup, read, resolveKeyframes, preUpdate, update, preRender, render, postRender, } = steps;\n const processBatch = () => {\n const timestamp = MotionGlobalConfig.useManualTiming\n ? state.timestamp\n : performance.now();\n runNextFrame = false;\n if (!MotionGlobalConfig.useManualTiming) {\n state.delta = useDefaultElapsed\n ? 1000 / 60\n : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);\n }\n state.timestamp = timestamp;\n state.isProcessing = true;\n // Unrolled render loop for better per-frame performance\n setup.process(state);\n read.process(state);\n resolveKeyframes.process(state);\n preUpdate.process(state);\n update.process(state);\n preRender.process(state);\n render.process(state);\n postRender.process(state);\n state.isProcessing = false;\n if (runNextFrame && allowKeepAlive) {\n useDefaultElapsed = false;\n scheduleNextBatch(processBatch);\n }\n };\n const wake = () => {\n runNextFrame = true;\n useDefaultElapsed = true;\n if (!state.isProcessing) {\n scheduleNextBatch(processBatch);\n }\n };\n const schedule = stepsOrder.reduce((acc, key) => {\n const step = steps[key];\n acc[key] = (process, keepAlive = false, immediate = false) => {\n if (!runNextFrame)\n wake();\n return step.schedule(process, keepAlive, immediate);\n };\n return acc;\n }, {});\n const cancel = (process) => {\n for (let i = 0; i < stepsOrder.length; i++) {\n steps[stepsOrder[i]].cancel(process);\n }\n };\n return { schedule, cancel, state, steps };\n}\n\nexport { createRenderBatcher };\n","import { noop } from 'motion-utils';\nimport { createRenderBatcher } from './batcher.mjs';\n\nconst { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame : noop, true);\n\nexport { cancelFrame, frame, frameData, frameSteps };\n","import { MotionGlobalConfig } from 'motion-utils';\nimport { frameData } from './frame.mjs';\n\nlet now;\nfunction clearTime() {\n now = undefined;\n}\n/**\n * An eventloop-synchronous alternative to performance.now().\n *\n * Ensures that time measurements remain consistent within a synchronous context.\n * Usually calling performance.now() twice within the same synchronous context\n * will return different values which isn't useful for animations when we're usually\n * trying to sync animations to the same frame.\n */\nconst time = {\n now: () => {\n if (now === undefined) {\n time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming\n ? frameData.timestamp\n : performance.now());\n }\n return now;\n },\n set: (newTime) => {\n now = newTime;\n queueMicrotask(clearTime);\n },\n};\n\nexport { time };\n","import { warnOnce, SubscriptionManager, velocityPerSecond } from 'motion-utils';\nimport { time } from '../frameloop/sync-time.mjs';\nimport { frame } from '../frameloop/frame.mjs';\n\n/**\n * Maximum time between the value of two frames, beyond which we\n * assume the velocity has since been 0.\n */\nconst MAX_VELOCITY_DELTA = 30;\nconst isFloat = (value) => {\n return !isNaN(parseFloat(value));\n};\nconst collectMotionValues = {\n current: undefined,\n};\n/**\n * `MotionValue` is used to track the state and velocity of motion values.\n *\n * @public\n */\nclass MotionValue {\n /**\n * @param init - The initiating value\n * @param config - Optional configuration options\n *\n * - `transformer`: A function to transform incoming values with.\n */\n constructor(init, options = {}) {\n /**\n * Tracks whether this value can output a velocity. Currently this is only true\n * if the value is numerical, but we might be able to widen the scope here and support\n * other value types.\n *\n * @internal\n */\n this.canTrackVelocity = null;\n /**\n * An object containing a SubscriptionManager for each active event.\n */\n this.events = {};\n this.updateAndNotify = (v) => {\n const currentTime = time.now();\n /**\n * If we're updating the value during another frame or eventloop\n * than the previous frame, then the we set the previous frame value\n * to current.\n */\n if (this.updatedAt !== currentTime) {\n this.setPrevFrameValue();\n }\n this.prev = this.current;\n this.setCurrent(v);\n // Update update subscribers\n if (this.current !== this.prev) {\n this.events.change?.notify(this.current);\n if (this.dependents) {\n for (const dependent of this.dependents) {\n dependent.dirty();\n }\n }\n }\n };\n this.hasAnimated = false;\n this.setCurrent(init);\n this.owner = options.owner;\n }\n setCurrent(current) {\n this.current = current;\n this.updatedAt = time.now();\n if (this.canTrackVelocity === null && current !== undefined) {\n this.canTrackVelocity = isFloat(this.current);\n }\n }\n setPrevFrameValue(prevFrameValue = this.current) {\n this.prevFrameValue = prevFrameValue;\n this.prevUpdatedAt = this.updatedAt;\n }\n /**\n * Adds a function that will be notified when the `MotionValue` is updated.\n *\n * It returns a function that, when called, will cancel the subscription.\n *\n * When calling `onChange` inside a React component, it should be wrapped with the\n * `useEffect` hook. As it returns an unsubscribe function, this should be returned\n * from the `useEffect` function to ensure you don't add duplicate subscribers..\n *\n * ```jsx\n * export const MyComponent = () => {\n * const x = useMotionValue(0)\n * const y = useMotionValue(0)\n * const opacity = useMotionValue(1)\n *\n * useEffect(() => {\n * function updateOpacity() {\n * const maxXY = Math.max(x.get(), y.get())\n * const newOpacity = transform(maxXY, [0, 100], [1, 0])\n * opacity.set(newOpacity)\n * }\n *\n * const unsubscribeX = x.on(\"change\", updateOpacity)\n * const unsubscribeY = y.on(\"change\", updateOpacity)\n *\n * return () => {\n * unsubscribeX()\n * unsubscribeY()\n * }\n * }, [])\n *\n * return <motion.div style={{ x }} />\n * }\n * ```\n *\n * @param subscriber - A function that receives the latest value.\n * @returns A function that, when called, will cancel this subscription.\n *\n * @deprecated\n */\n onChange(subscription) {\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on(\"change\", callback).`);\n }\n return this.on(\"change\", subscription);\n }\n on(eventName, callback) {\n if (!this.events[eventName]) {\n this.events[eventName] = new SubscriptionManager();\n }\n const unsubscribe = this.events[eventName].add(callback);\n if (eventName === \"change\") {\n return () => {\n unsubscribe();\n /**\n * If we have no more change listeners by the start\n * of the next frame, stop active animations.\n */\n frame.read(() => {\n if (!this.events.change.getSize()) {\n this.stop();\n }\n });\n };\n }\n return unsubscribe;\n }\n clearListeners() {\n for (const eventManagers in this.events) {\n this.events[eventManagers].clear();\n }\n }\n /**\n * Attaches a passive effect to the `MotionValue`.\n */\n attach(passiveEffect, stopPassiveEffect) {\n this.passiveEffect = passiveEffect;\n this.stopPassiveEffect = stopPassiveEffect;\n }\n /**\n * Sets the state of the `MotionValue`.\n *\n * @remarks\n *\n * ```jsx\n * const x = useMotionValue(0)\n * x.set(10)\n * ```\n *\n * @param latest - Latest value to set.\n * @param render - Whether to notify render subscribers. Defaults to `true`\n *\n * @public\n */\n set(v) {\n if (!this.passiveEffect) {\n this.updateAndNotify(v);\n }\n else {\n this.passiveEffect(v, this.updateAndNotify);\n }\n }\n setWithVelocity(prev, current, delta) {\n this.set(current);\n this.prev = undefined;\n this.prevFrameValue = prev;\n this.prevUpdatedAt = this.updatedAt - delta;\n }\n /**\n * Set the state of the `MotionValue`, stopping any active animations,\n * effects, and resets velocity to `0`.\n */\n jump(v, endAnimation = true) {\n this.updateAndNotify(v);\n this.prev = v;\n this.prevUpdatedAt = this.prevFrameValue = undefined;\n endAnimation && this.stop();\n if (this.stopPassiveEffect)\n this.stopPassiveEffect();\n }\n dirty() {\n this.events.change?.notify(this.current);\n }\n addDependent(dependent) {\n if (!this.dependents) {\n this.dependents = new Set();\n }\n this.dependents.add(dependent);\n }\n removeDependent(dependent) {\n if (this.dependents) {\n this.dependents.delete(dependent);\n }\n }\n /**\n * Returns the latest state of `MotionValue`\n *\n * @returns - The latest state of `MotionValue`\n *\n * @public\n */\n get() {\n if (collectMotionValues.current) {\n collectMotionValues.current.push(this);\n }\n return this.current;\n }\n /**\n * @public\n */\n getPrevious() {\n return this.prev;\n }\n /**\n * Returns the latest velocity of `MotionValue`\n *\n * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.\n *\n * @public\n */\n getVelocity() {\n const currentTime = time.now();\n if (!this.canTrackVelocity ||\n this.prevFrameValue === undefined ||\n currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {\n return 0;\n }\n const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);\n // Casts because of parseFloat's poor typing\n return velocityPerSecond(parseFloat(this.current) -\n parseFloat(this.prevFrameValue), delta);\n }\n /**\n * Registers a new animation to control this `MotionValue`. Only one\n * animation can drive a `MotionValue` at one time.\n *\n * ```jsx\n * value.start()\n * ```\n *\n * @param animation - A function that starts the provided animation\n */\n start(startAnimation) {\n this.stop();\n return new Promise((resolve) => {\n this.hasAnimated = true;\n this.animation = startAnimation(resolve);\n if (this.events.animationStart) {\n this.events.animationStart.notify();\n }\n }).then(() => {\n if (this.events.animationComplete) {\n this.events.animationComplete.notify();\n }\n this.clearAnimation();\n });\n }\n /**\n * Stop the currently active animation.\n *\n * @public\n */\n stop() {\n if (this.animation) {\n this.animation.stop();\n if (this.events.animationCancel) {\n this.events.animationCancel.notify();\n }\n }\n this.clearAnimation();\n }\n /**\n * Returns `true` if this value is currently animating.\n *\n * @public\n */\n isAnimating() {\n return !!this.animation;\n }\n clearAnimation() {\n delete this.animation;\n }\n /**\n * Destroy and clean up subscribers to this `MotionValue`.\n *\n * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically\n * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually\n * created a `MotionValue` via the `motionValue` function.\n *\n * @public\n */\n destroy() {\n this.dependents?.clear();\n this.events.destroy?.notify();\n this.clearListeners();\n this.stop();\n if (this.stopPassiveEffect) {\n this.stopPassiveEffect();\n }\n }\n}\nfunction motionValue(init, options) {\n return new MotionValue(init, options);\n}\n\nexport { MotionValue, collectMotionValues, motionValue };\n","\"use client\";\nimport { createContext } from 'react';\n\n/**\n * @public\n */\nconst MotionConfigContext = createContext({\n transformPagePoint: (p) => p,\n isStatic: false,\n reducedMotion: \"never\",\n});\n\nexport { MotionConfigContext };\n","\"use client\";\nimport { motionValue } from 'motion-dom';\nimport { useContext, useState, useEffect } from 'react';\nimport { MotionConfigContext } from '../context/MotionConfigContext.mjs';\nimport { useConstant } from '../utils/use-constant.mjs';\n\n/**\n * Creates a `MotionValue` to track the state and velocity of a value.\n *\n * Usually, these are created automatically. For advanced use-cases, like use with `useTransform`, you can create `MotionValue`s externally and pass them into the animated component via the `style` prop.\n *\n * ```jsx\n * export const MyComponent = () => {\n * const scale = useMotionValue(1)\n *\n * return <motion.div style={{ scale }} />\n * }\n * ```\n *\n * @param initial - The initial state.\n *\n * @public\n */\nfunction useMotionValue(initial) {\n const value = useConstant(() => motionValue(initial));\n /**\n * If this motion value is being used in static mode, like on\n * the Framer canvas, force components to rerender when the motion\n * value is updated.\n */\n const { isStatic } = useContext(MotionConfigContext);\n if (isStatic) {\n const [, setLatest] = useState(initial);\n useEffect(() => value.on(\"change\", setLatest), []);\n }\n return value;\n}\n\nexport { useMotionValue };\n","import { useCallback, useRef, useState } from 'react';\n\nimport {\n ActiveSectionScrollInfo,\n useActiveSection,\n ActiveSectionObserver,\n} from '@react-scrollytelling/grouped';\nimport { useMotionValue, MotionValue } from 'motion/react';\n\n/**\n * Watches for all tracked sections to find the section closet to the bottom of the viewport\n * through ScrollytellingProvider.\n * It invokes the onActiveSectionChange when the active section changes.\n * Returns the Motion value of the section scroll.\n * @param onActiveSectionChange - The callback needs to be memoized\n * @returns The trackingId of the active section and the Motion value of the section scroll\n */\nexport function useActiveSectionMotionValue(onActiveSectionChange?: ActiveSectionObserver) {\n const scrolledRatioMotionValueRef = useRef<MotionValue<number>>(useMotionValue(0));\n const [trackingId, setTrackingId] = useState<string | null>(null);\n\n const onSectionScroll = useCallback(\n (scrollInfo: ActiveSectionScrollInfo) => {\n const { trackingId: id, scrolledRatio } = scrollInfo;\n setTrackingId(id);\n scrolledRatioMotionValueRef.current.set(scrolledRatio);\n\n if (onActiveSectionChange) {\n onActiveSectionChange(scrollInfo);\n }\n },\n [onActiveSectionChange]\n );\n\n useActiveSection(onSectionScroll);\n\n return { trackingId, scrolledRatioMotionValue: scrolledRatioMotionValueRef.current };\n}\n","import { useCallback, useRef } from 'react';\n\nimport {\n IntersectionObserverOptions,\n SectionScrollInfo,\n useSectionScroll,\n} from '@react-scrollytelling/core';\nimport { useMotionValue, MotionValue } from 'motion/react';\n\n/**\n * Get the Motion value of the section scroll\n * @param sectionRef - The reference to the section element\n * @param shouldObserve - Whether the underlying IntersectionObserver should be active\n * @param onScroll - The callback to track the scroll ratio\n */\nexport function useSectionScrollMotionValue(\n sectionRef: React.RefObject<Element>,\n onScroll?: (scrollInfo: SectionScrollInfo) => void,\n shouldObserve = true,\n options?: IntersectionObserverOptions\n) {\n const scrolledRatioMotionValueRef = useRef<MotionValue<number>>(useMotionValue(0));\n\n const onSectionScroll = useCallback(\n (scrollInfo: SectionScrollInfo) => {\n const { scrolledRatio } = scrollInfo;\n scrolledRatioMotionValueRef.current.set(scrolledRatio);\n\n if (onScroll) {\n onScroll(scrollInfo);\n }\n },\n [onScroll]\n );\n\n useSectionScroll(sectionRef, onSectionScroll, shouldObserve, options);\n\n return { scrolledRatioMotionValue: scrolledRatioMotionValueRef.current };\n}\n"],"names":["useConstant","init","ref","useRef","addUniqueItem","arr","item","removeItem","index","formatErrorMessage","message","errorCode","MotionGlobalConfig","noop","any","SubscriptionManager","handler","a","b","c","numSubscriptions","i","velocityPerSecond","velocity","frameDuration","warned","warnOnce","condition","stepsOrder","statsBuffer","createRenderStep","runNextFrame","stepName","thisFrame","nextFrame","isProcessing","flushNextFrame","toKeepAlive","latestFrameData","numCalls","triggerCallback","callback","step","keepAlive","immediate","queue","frameData","maxElapsed","createRenderBatcher","scheduleNextBatch","allowKeepAlive","useDefaultElapsed","state","flagRunNextFrame","steps","acc","key","setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender","processBatch","timestamp","wake","process","frame","cancelFrame","frameSteps","now","clearTime","time","newTime","MAX_VELOCITY_DELTA","isFloat","value","MotionValue","options","v","currentTime","_a","dependent","current","prevFrameValue","subscription","eventName","unsubscribe","eventManagers","passiveEffect","stopPassiveEffect","prev","delta","endAnimation","startAnimation","resolve","_b","motionValue","MotionConfigContext","createContext","p","useMotionValue","initial","isStatic","useContext","setLatest","useState","useEffect","useActiveSectionMotionValue","onActiveSectionChange","scrolledRatioMotionValueRef","trackingId","setTrackingId","onSectionScroll","useCallback","scrollInfo","id","scrolledRatio","useActiveSection","useSectionScrollMotionValue","sectionRef","onScroll","shouldObserve","useSectionScroll"],"mappings":"4LAUA,SAASA,EAAYC,EAAM,CACvB,MAAMC,EAAMC,SAAO,IAAI,EACvB,OAAID,EAAI,UAAY,OAChBA,EAAI,QAAUD,KAEX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AACN,CAAmB,EACnD,GAAIK,EAAU,CACV,KAAM,EAAGE,CAAS,EAAIC,EAAQ,SAACJ,CAAO,EACtCK,EAAS,UAAC,IAAM/B,EAAM,GAAG,SAAU6B,CAAS,EAAG,CAAA,CAAE,CACpD,CACD,OAAO7B,CACX,CCnBO,SAASgC,EAA4BC,EAA+C,CACzF,MAAMC,EAA8B7G,EAAA,OAA4BoG,EAAe,CAAC,CAAC,EAC3E,CAACU,EAAYC,CAAa,EAAIN,WAAwB,IAAI,EAE1DO,EAAkBC,EAAA,YACrBC,GAAwC,CACvC,KAAM,CAAE,WAAYC,EAAI,cAAAC,CAAA,EAAkBF,EAC1CH,EAAcI,CAAE,EACYN,EAAA,QAAQ,IAAIO,CAAa,EAEjDR,GACFA,EAAsBM,CAAU,CAEpC,EACA,CAACN,CAAqB,CAAA,EAGxBS,OAAAA,EAAA,iBAAiBL,CAAe,EAEzB,CAAE,WAAAF,EAAY,yBAA0BD,EAA4B,OAAQ,CACrF,CCtBO,SAASS,EACdC,EACAC,EACAC,EAAgB,GAChB5C,EACA,CACA,MAAMgC,EAA8B7G,EAAA,OAA4BoG,EAAe,CAAC,CAAC,EAE3EY,EAAkBC,EAAA,YACrBC,GAAkC,CAC3B,KAAA,CAAE,cAAAE,CAAkB,EAAAF,EACEL,EAAA,QAAQ,IAAIO,CAAa,EAEjDI,GACFA,EAASN,CAAU,CAEvB,EACA,CAACM,CAAQ,CAAA,EAGME,OAAAA,EAAAA,iBAAAH,EAAYP,EAAiBS,EAAe5C,CAAO,EAE7D,CAAE,yBAA0BgC,EAA4B,QACjE","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { useRef as y, createContext as O, useContext as q, useState as E, useEffect as D, useCallback as R } from "react";
|
|
2
|
+
import { useActiveSection as L } from "@react-scrollytelling/grouped";
|
|
3
|
+
import { useSectionScroll as I } from "@react-scrollytelling/core";
|
|
4
|
+
function K(s) {
|
|
5
|
+
const e = y(null);
|
|
6
|
+
return e.current === null && (e.current = s()), e.current;
|
|
7
|
+
}
|
|
8
|
+
function _(s, e) {
|
|
9
|
+
s.indexOf(e) === -1 && s.push(e);
|
|
10
|
+
}
|
|
11
|
+
function j(s, e) {
|
|
12
|
+
const t = s.indexOf(e);
|
|
13
|
+
t > -1 && s.splice(t, 1);
|
|
14
|
+
}
|
|
15
|
+
function z(s, e) {
|
|
16
|
+
return s;
|
|
17
|
+
}
|
|
18
|
+
const V = {}, B = /* @__NO_SIDE_EFFECTS__ */ (s) => s;
|
|
19
|
+
class W {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.subscriptions = [];
|
|
22
|
+
}
|
|
23
|
+
add(e) {
|
|
24
|
+
return _(this.subscriptions, e), () => j(this.subscriptions, e);
|
|
25
|
+
}
|
|
26
|
+
notify(e, t, i) {
|
|
27
|
+
const n = this.subscriptions.length;
|
|
28
|
+
if (n)
|
|
29
|
+
if (n === 1)
|
|
30
|
+
this.subscriptions[0](e, t, i);
|
|
31
|
+
else
|
|
32
|
+
for (let o = 0; o < n; o++) {
|
|
33
|
+
const r = this.subscriptions[o];
|
|
34
|
+
r && r(e, t, i);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
getSize() {
|
|
38
|
+
return this.subscriptions.length;
|
|
39
|
+
}
|
|
40
|
+
clear() {
|
|
41
|
+
this.subscriptions.length = 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function G(s, e) {
|
|
45
|
+
return e ? s * (1e3 / e) : 0;
|
|
46
|
+
}
|
|
47
|
+
const w = /* @__PURE__ */ new Set();
|
|
48
|
+
function X(s, e, t) {
|
|
49
|
+
w.has(e) || (console.warn(z(e)), w.add(e));
|
|
50
|
+
}
|
|
51
|
+
const p = [
|
|
52
|
+
"setup",
|
|
53
|
+
// Compute
|
|
54
|
+
"read",
|
|
55
|
+
// Read
|
|
56
|
+
"resolveKeyframes",
|
|
57
|
+
// Write/Read/Write/Read
|
|
58
|
+
"preUpdate",
|
|
59
|
+
// Compute
|
|
60
|
+
"update",
|
|
61
|
+
// Compute
|
|
62
|
+
"preRender",
|
|
63
|
+
// Compute
|
|
64
|
+
"render",
|
|
65
|
+
// Write
|
|
66
|
+
"postRender"
|
|
67
|
+
// Compute
|
|
68
|
+
], F = {
|
|
69
|
+
value: null,
|
|
70
|
+
addProjectionMetrics: null
|
|
71
|
+
};
|
|
72
|
+
function Y(s, e) {
|
|
73
|
+
let t = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = !1, o = !1;
|
|
74
|
+
const r = /* @__PURE__ */ new WeakSet();
|
|
75
|
+
let d = {
|
|
76
|
+
delta: 0,
|
|
77
|
+
timestamp: 0,
|
|
78
|
+
isProcessing: !1
|
|
79
|
+
}, l = 0;
|
|
80
|
+
function g(a) {
|
|
81
|
+
r.has(a) && (f.schedule(a), s()), l++, a(d);
|
|
82
|
+
}
|
|
83
|
+
const f = {
|
|
84
|
+
/**
|
|
85
|
+
* Schedule a process to run on the next frame.
|
|
86
|
+
*/
|
|
87
|
+
schedule: (a, A = !1, S = !1) => {
|
|
88
|
+
const h = S && n ? t : i;
|
|
89
|
+
return A && r.add(a), h.has(a) || h.add(a), a;
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Cancel the provided callback from running on the next frame.
|
|
93
|
+
*/
|
|
94
|
+
cancel: (a) => {
|
|
95
|
+
i.delete(a), r.delete(a);
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Execute all schedule callbacks.
|
|
99
|
+
*/
|
|
100
|
+
process: (a) => {
|
|
101
|
+
if (d = a, n) {
|
|
102
|
+
o = !0;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
n = !0, [t, i] = [i, t], t.forEach(g), e && F.value && F.value.frameloop[e].push(l), l = 0, t.clear(), n = !1, o && (o = !1, f.process(a));
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
return f;
|
|
109
|
+
}
|
|
110
|
+
const H = 40;
|
|
111
|
+
function J(s, e) {
|
|
112
|
+
let t = !1, i = !0;
|
|
113
|
+
const n = {
|
|
114
|
+
delta: 0,
|
|
115
|
+
timestamp: 0,
|
|
116
|
+
isProcessing: !1
|
|
117
|
+
}, o = () => t = !0, r = p.reduce((c, u) => (c[u] = Y(o, u), c), {}), { setup: d, read: l, resolveKeyframes: g, preUpdate: f, update: a, preRender: A, render: S, postRender: M } = r, h = () => {
|
|
118
|
+
const c = V.useManualTiming ? n.timestamp : performance.now();
|
|
119
|
+
t = !1, V.useManualTiming || (n.delta = i ? 1e3 / 60 : Math.max(Math.min(c - n.timestamp, H), 1)), n.timestamp = c, n.isProcessing = !0, d.process(n), l.process(n), g.process(n), f.process(n), a.process(n), A.process(n), S.process(n), M.process(n), n.isProcessing = !1, t && e && (i = !1, s(h));
|
|
120
|
+
}, x = () => {
|
|
121
|
+
t = !0, i = !0, n.isProcessing || s(h);
|
|
122
|
+
};
|
|
123
|
+
return { schedule: p.reduce((c, u) => {
|
|
124
|
+
const b = r[u];
|
|
125
|
+
return c[u] = (U, k = !1, N = !1) => (t || x(), b.schedule(U, k, N)), c;
|
|
126
|
+
}, {}), cancel: (c) => {
|
|
127
|
+
for (let u = 0; u < p.length; u++)
|
|
128
|
+
r[p[u]].cancel(c);
|
|
129
|
+
}, state: n, steps: r };
|
|
130
|
+
}
|
|
131
|
+
const { schedule: Q, cancel: ce, state: C, steps: ue } = /* @__PURE__ */ J(typeof requestAnimationFrame != "undefined" ? requestAnimationFrame : B, !0);
|
|
132
|
+
let m;
|
|
133
|
+
function Z() {
|
|
134
|
+
m = void 0;
|
|
135
|
+
}
|
|
136
|
+
const v = {
|
|
137
|
+
now: () => (m === void 0 && v.set(C.isProcessing || V.useManualTiming ? C.timestamp : performance.now()), m),
|
|
138
|
+
set: (s) => {
|
|
139
|
+
m = s, queueMicrotask(Z);
|
|
140
|
+
}
|
|
141
|
+
}, P = 30, $ = (s) => !isNaN(parseFloat(s));
|
|
142
|
+
class ee {
|
|
143
|
+
/**
|
|
144
|
+
* @param init - The initiating value
|
|
145
|
+
* @param config - Optional configuration options
|
|
146
|
+
*
|
|
147
|
+
* - `transformer`: A function to transform incoming values with.
|
|
148
|
+
*/
|
|
149
|
+
constructor(e, t = {}) {
|
|
150
|
+
this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (i) => {
|
|
151
|
+
var o;
|
|
152
|
+
const n = v.now();
|
|
153
|
+
if (this.updatedAt !== n && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(i), this.current !== this.prev && ((o = this.events.change) == null || o.notify(this.current), this.dependents))
|
|
154
|
+
for (const r of this.dependents)
|
|
155
|
+
r.dirty();
|
|
156
|
+
}, this.hasAnimated = !1, this.setCurrent(e), this.owner = t.owner;
|
|
157
|
+
}
|
|
158
|
+
setCurrent(e) {
|
|
159
|
+
this.current = e, this.updatedAt = v.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = $(this.current));
|
|
160
|
+
}
|
|
161
|
+
setPrevFrameValue(e = this.current) {
|
|
162
|
+
this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
166
|
+
*
|
|
167
|
+
* It returns a function that, when called, will cancel the subscription.
|
|
168
|
+
*
|
|
169
|
+
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
170
|
+
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
171
|
+
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
172
|
+
*
|
|
173
|
+
* ```jsx
|
|
174
|
+
* export const MyComponent = () => {
|
|
175
|
+
* const x = useMotionValue(0)
|
|
176
|
+
* const y = useMotionValue(0)
|
|
177
|
+
* const opacity = useMotionValue(1)
|
|
178
|
+
*
|
|
179
|
+
* useEffect(() => {
|
|
180
|
+
* function updateOpacity() {
|
|
181
|
+
* const maxXY = Math.max(x.get(), y.get())
|
|
182
|
+
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
183
|
+
* opacity.set(newOpacity)
|
|
184
|
+
* }
|
|
185
|
+
*
|
|
186
|
+
* const unsubscribeX = x.on("change", updateOpacity)
|
|
187
|
+
* const unsubscribeY = y.on("change", updateOpacity)
|
|
188
|
+
*
|
|
189
|
+
* return () => {
|
|
190
|
+
* unsubscribeX()
|
|
191
|
+
* unsubscribeY()
|
|
192
|
+
* }
|
|
193
|
+
* }, [])
|
|
194
|
+
*
|
|
195
|
+
* return <motion.div style={{ x }} />
|
|
196
|
+
* }
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
* @param subscriber - A function that receives the latest value.
|
|
200
|
+
* @returns A function that, when called, will cancel this subscription.
|
|
201
|
+
*
|
|
202
|
+
* @deprecated
|
|
203
|
+
*/
|
|
204
|
+
onChange(e) {
|
|
205
|
+
return process.env.NODE_ENV !== "production" && X(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
|
|
206
|
+
}
|
|
207
|
+
on(e, t) {
|
|
208
|
+
this.events[e] || (this.events[e] = new W());
|
|
209
|
+
const i = this.events[e].add(t);
|
|
210
|
+
return e === "change" ? () => {
|
|
211
|
+
i(), Q.read(() => {
|
|
212
|
+
this.events.change.getSize() || this.stop();
|
|
213
|
+
});
|
|
214
|
+
} : i;
|
|
215
|
+
}
|
|
216
|
+
clearListeners() {
|
|
217
|
+
for (const e in this.events)
|
|
218
|
+
this.events[e].clear();
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Attaches a passive effect to the `MotionValue`.
|
|
222
|
+
*/
|
|
223
|
+
attach(e, t) {
|
|
224
|
+
this.passiveEffect = e, this.stopPassiveEffect = t;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Sets the state of the `MotionValue`.
|
|
228
|
+
*
|
|
229
|
+
* @remarks
|
|
230
|
+
*
|
|
231
|
+
* ```jsx
|
|
232
|
+
* const x = useMotionValue(0)
|
|
233
|
+
* x.set(10)
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* @param latest - Latest value to set.
|
|
237
|
+
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
238
|
+
*
|
|
239
|
+
* @public
|
|
240
|
+
*/
|
|
241
|
+
set(e) {
|
|
242
|
+
this.passiveEffect ? this.passiveEffect(e, this.updateAndNotify) : this.updateAndNotify(e);
|
|
243
|
+
}
|
|
244
|
+
setWithVelocity(e, t, i) {
|
|
245
|
+
this.set(t), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - i;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Set the state of the `MotionValue`, stopping any active animations,
|
|
249
|
+
* effects, and resets velocity to `0`.
|
|
250
|
+
*/
|
|
251
|
+
jump(e, t = !0) {
|
|
252
|
+
this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, t && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
253
|
+
}
|
|
254
|
+
dirty() {
|
|
255
|
+
var e;
|
|
256
|
+
(e = this.events.change) == null || e.notify(this.current);
|
|
257
|
+
}
|
|
258
|
+
addDependent(e) {
|
|
259
|
+
this.dependents || (this.dependents = /* @__PURE__ */ new Set()), this.dependents.add(e);
|
|
260
|
+
}
|
|
261
|
+
removeDependent(e) {
|
|
262
|
+
this.dependents && this.dependents.delete(e);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Returns the latest state of `MotionValue`
|
|
266
|
+
*
|
|
267
|
+
* @returns - The latest state of `MotionValue`
|
|
268
|
+
*
|
|
269
|
+
* @public
|
|
270
|
+
*/
|
|
271
|
+
get() {
|
|
272
|
+
return this.current;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* @public
|
|
276
|
+
*/
|
|
277
|
+
getPrevious() {
|
|
278
|
+
return this.prev;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Returns the latest velocity of `MotionValue`
|
|
282
|
+
*
|
|
283
|
+
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
284
|
+
*
|
|
285
|
+
* @public
|
|
286
|
+
*/
|
|
287
|
+
getVelocity() {
|
|
288
|
+
const e = v.now();
|
|
289
|
+
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > P)
|
|
290
|
+
return 0;
|
|
291
|
+
const t = Math.min(this.updatedAt - this.prevUpdatedAt, P);
|
|
292
|
+
return G(parseFloat(this.current) - parseFloat(this.prevFrameValue), t);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Registers a new animation to control this `MotionValue`. Only one
|
|
296
|
+
* animation can drive a `MotionValue` at one time.
|
|
297
|
+
*
|
|
298
|
+
* ```jsx
|
|
299
|
+
* value.start()
|
|
300
|
+
* ```
|
|
301
|
+
*
|
|
302
|
+
* @param animation - A function that starts the provided animation
|
|
303
|
+
*/
|
|
304
|
+
start(e) {
|
|
305
|
+
return this.stop(), new Promise((t) => {
|
|
306
|
+
this.hasAnimated = !0, this.animation = e(t), this.events.animationStart && this.events.animationStart.notify();
|
|
307
|
+
}).then(() => {
|
|
308
|
+
this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Stop the currently active animation.
|
|
313
|
+
*
|
|
314
|
+
* @public
|
|
315
|
+
*/
|
|
316
|
+
stop() {
|
|
317
|
+
this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Returns `true` if this value is currently animating.
|
|
321
|
+
*
|
|
322
|
+
* @public
|
|
323
|
+
*/
|
|
324
|
+
isAnimating() {
|
|
325
|
+
return !!this.animation;
|
|
326
|
+
}
|
|
327
|
+
clearAnimation() {
|
|
328
|
+
delete this.animation;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Destroy and clean up subscribers to this `MotionValue`.
|
|
332
|
+
*
|
|
333
|
+
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
334
|
+
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
335
|
+
* created a `MotionValue` via the `motionValue` function.
|
|
336
|
+
*
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
339
|
+
destroy() {
|
|
340
|
+
var e, t;
|
|
341
|
+
(e = this.dependents) == null || e.clear(), (t = this.events.destroy) == null || t.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function te(s, e) {
|
|
345
|
+
return new ee(s, e);
|
|
346
|
+
}
|
|
347
|
+
const se = O({
|
|
348
|
+
transformPagePoint: (s) => s,
|
|
349
|
+
isStatic: !1,
|
|
350
|
+
reducedMotion: "never"
|
|
351
|
+
});
|
|
352
|
+
function T(s) {
|
|
353
|
+
const e = K(() => te(s)), { isStatic: t } = q(se);
|
|
354
|
+
if (t) {
|
|
355
|
+
const [, i] = E(s);
|
|
356
|
+
D(() => e.on("change", i), []);
|
|
357
|
+
}
|
|
358
|
+
return e;
|
|
359
|
+
}
|
|
360
|
+
function de(s) {
|
|
361
|
+
const e = y(T(0)), [t, i] = E(null), n = R(
|
|
362
|
+
(o) => {
|
|
363
|
+
const { trackingId: r, scrolledRatio: d } = o;
|
|
364
|
+
i(r), e.current.set(d), s && s(o);
|
|
365
|
+
},
|
|
366
|
+
[s]
|
|
367
|
+
);
|
|
368
|
+
return L(n), { trackingId: t, scrolledRatioMotionValue: e.current };
|
|
369
|
+
}
|
|
370
|
+
function le(s, e, t = !0, i) {
|
|
371
|
+
const n = y(T(0)), o = R(
|
|
372
|
+
(r) => {
|
|
373
|
+
const { scrolledRatio: d } = r;
|
|
374
|
+
n.current.set(d), e && e(r);
|
|
375
|
+
},
|
|
376
|
+
[e]
|
|
377
|
+
);
|
|
378
|
+
return I(s, o, t, i), { scrolledRatioMotionValue: n.current };
|
|
379
|
+
}
|
|
380
|
+
export {
|
|
381
|
+
de as useActiveSectionMotionValue,
|
|
382
|
+
le as useSectionScrollMotionValue
|
|
383
|
+
};
|
|
384
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../node_modules/framer-motion/dist/es/utils/use-constant.mjs","../../../node_modules/motion-utils/dist/es/array.mjs","../../../node_modules/motion-utils/dist/es/format-error-message.mjs","../../../node_modules/motion-utils/dist/es/global-config.mjs","../../../node_modules/motion-utils/dist/es/noop.mjs","../../../node_modules/motion-utils/dist/es/subscription-manager.mjs","../../../node_modules/motion-utils/dist/es/velocity-per-second.mjs","../../../node_modules/motion-utils/dist/es/warn-once.mjs","../../../node_modules/motion-dom/dist/es/frameloop/order.mjs","../../../node_modules/motion-dom/dist/es/stats/buffer.mjs","../../../node_modules/motion-dom/dist/es/frameloop/render-step.mjs","../../../node_modules/motion-dom/dist/es/frameloop/batcher.mjs","../../../node_modules/motion-dom/dist/es/frameloop/frame.mjs","../../../node_modules/motion-dom/dist/es/frameloop/sync-time.mjs","../../../node_modules/motion-dom/dist/es/value/index.mjs","../../../node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs","../../../node_modules/framer-motion/dist/es/value/use-motion-value.mjs","../src/hooks/useActiveSectionMotionValue.ts","../src/hooks/useSectionScrollMotionValue.ts"],"sourcesContent":["\"use client\";\nimport { useRef } from 'react';\n\n/**\n * Creates a constant value over the lifecycle of a component.\n *\n * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer\n * a guarantee that it won't re-run for performance reasons later on. By using `useConstant`\n * you can ensure that initialisers don't execute twice or more.\n */\nfunction useConstant(init) {\n const ref = useRef(null);\n if (ref.current === null) {\n ref.current = init();\n }\n return ref.current;\n}\n\nexport { useConstant };\n","function addUniqueItem(arr, item) {\n if (arr.indexOf(item) === -1)\n arr.push(item);\n}\nfunction removeItem(arr, item) {\n const index = arr.indexOf(item);\n if (index > -1)\n arr.splice(index, 1);\n}\n// Adapted from array-move\nfunction moveItem([...arr], fromIndex, toIndex) {\n const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;\n if (startIndex >= 0 && startIndex < arr.length) {\n const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;\n const [item] = arr.splice(fromIndex, 1);\n arr.splice(endIndex, 0, item);\n }\n return arr;\n}\n\nexport { addUniqueItem, moveItem, removeItem };\n","function formatErrorMessage(message, errorCode) {\n return errorCode\n ? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`\n : message;\n}\n\nexport { formatErrorMessage };\n","const MotionGlobalConfig = {};\n\nexport { MotionGlobalConfig };\n","/*#__NO_SIDE_EFFECTS__*/\nconst noop = (any) => any;\n\nexport { noop };\n","import { addUniqueItem, removeItem } from './array.mjs';\n\nclass SubscriptionManager {\n constructor() {\n this.subscriptions = [];\n }\n add(handler) {\n addUniqueItem(this.subscriptions, handler);\n return () => removeItem(this.subscriptions, handler);\n }\n notify(a, b, c) {\n const numSubscriptions = this.subscriptions.length;\n if (!numSubscriptions)\n return;\n if (numSubscriptions === 1) {\n /**\n * If there's only a single handler we can just call it without invoking a loop.\n */\n this.subscriptions[0](a, b, c);\n }\n else {\n for (let i = 0; i < numSubscriptions; i++) {\n /**\n * Check whether the handler exists before firing as it's possible\n * the subscriptions were modified during this loop running.\n */\n const handler = this.subscriptions[i];\n handler && handler(a, b, c);\n }\n }\n }\n getSize() {\n return this.subscriptions.length;\n }\n clear() {\n this.subscriptions.length = 0;\n }\n}\n\nexport { SubscriptionManager };\n","/*\n Convert velocity into velocity per second\n\n @param [number]: Unit per frame\n @param [number]: Frame duration in ms\n*/\nfunction velocityPerSecond(velocity, frameDuration) {\n return frameDuration ? velocity * (1000 / frameDuration) : 0;\n}\n\nexport { velocityPerSecond };\n","import { formatErrorMessage } from './format-error-message.mjs';\n\nconst warned = new Set();\nfunction hasWarned(message) {\n return warned.has(message);\n}\nfunction warnOnce(condition, message, errorCode) {\n if (condition || warned.has(message))\n return;\n console.warn(formatErrorMessage(message, errorCode));\n warned.add(message);\n}\n\nexport { hasWarned, warnOnce };\n","const stepsOrder = [\n \"setup\", // Compute\n \"read\", // Read\n \"resolveKeyframes\", // Write/Read/Write/Read\n \"preUpdate\", // Compute\n \"update\", // Compute\n \"preRender\", // Compute\n \"render\", // Write\n \"postRender\", // Compute\n];\n\nexport { stepsOrder };\n","const statsBuffer = {\n value: null,\n addProjectionMetrics: null,\n};\n\nexport { statsBuffer };\n","import { statsBuffer } from '../stats/buffer.mjs';\n\nfunction createRenderStep(runNextFrame, stepName) {\n /**\n * We create and reuse two queues, one to queue jobs for the current frame\n * and one for the next. We reuse to avoid triggering GC after x frames.\n */\n let thisFrame = new Set();\n let nextFrame = new Set();\n /**\n * Track whether we're currently processing jobs in this step. This way\n * we can decide whether to schedule new jobs for this frame or next.\n */\n let isProcessing = false;\n let flushNextFrame = false;\n /**\n * A set of processes which were marked keepAlive when scheduled.\n */\n const toKeepAlive = new WeakSet();\n let latestFrameData = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n let numCalls = 0;\n function triggerCallback(callback) {\n if (toKeepAlive.has(callback)) {\n step.schedule(callback);\n runNextFrame();\n }\n numCalls++;\n callback(latestFrameData);\n }\n const step = {\n /**\n * Schedule a process to run on the next frame.\n */\n schedule: (callback, keepAlive = false, immediate = false) => {\n const addToCurrentFrame = immediate && isProcessing;\n const queue = addToCurrentFrame ? thisFrame : nextFrame;\n if (keepAlive)\n toKeepAlive.add(callback);\n if (!queue.has(callback))\n queue.add(callback);\n return callback;\n },\n /**\n * Cancel the provided callback from running on the next frame.\n */\n cancel: (callback) => {\n nextFrame.delete(callback);\n toKeepAlive.delete(callback);\n },\n /**\n * Execute all schedule callbacks.\n */\n process: (frameData) => {\n latestFrameData = frameData;\n /**\n * If we're already processing we've probably been triggered by a flushSync\n * inside an existing process. Instead of executing, mark flushNextFrame\n * as true and ensure we flush the following frame at the end of this one.\n */\n if (isProcessing) {\n flushNextFrame = true;\n return;\n }\n isProcessing = true;\n [thisFrame, nextFrame] = [nextFrame, thisFrame];\n // Execute this frame\n thisFrame.forEach(triggerCallback);\n /**\n * If we're recording stats then\n */\n if (stepName && statsBuffer.value) {\n statsBuffer.value.frameloop[stepName].push(numCalls);\n }\n numCalls = 0;\n // Clear the frame so no callbacks remain. This is to avoid\n // memory leaks should this render step not run for a while.\n thisFrame.clear();\n isProcessing = false;\n if (flushNextFrame) {\n flushNextFrame = false;\n step.process(frameData);\n }\n },\n };\n return step;\n}\n\nexport { createRenderStep };\n","import { MotionGlobalConfig } from 'motion-utils';\nimport { stepsOrder } from './order.mjs';\nimport { createRenderStep } from './render-step.mjs';\n\nconst maxElapsed = 40;\nfunction createRenderBatcher(scheduleNextBatch, allowKeepAlive) {\n let runNextFrame = false;\n let useDefaultElapsed = true;\n const state = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n const flagRunNextFrame = () => (runNextFrame = true);\n const steps = stepsOrder.reduce((acc, key) => {\n acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : undefined);\n return acc;\n }, {});\n const { setup, read, resolveKeyframes, preUpdate, update, preRender, render, postRender, } = steps;\n const processBatch = () => {\n const timestamp = MotionGlobalConfig.useManualTiming\n ? state.timestamp\n : performance.now();\n runNextFrame = false;\n if (!MotionGlobalConfig.useManualTiming) {\n state.delta = useDefaultElapsed\n ? 1000 / 60\n : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);\n }\n state.timestamp = timestamp;\n state.isProcessing = true;\n // Unrolled render loop for better per-frame performance\n setup.process(state);\n read.process(state);\n resolveKeyframes.process(state);\n preUpdate.process(state);\n update.process(state);\n preRender.process(state);\n render.process(state);\n postRender.process(state);\n state.isProcessing = false;\n if (runNextFrame && allowKeepAlive) {\n useDefaultElapsed = false;\n scheduleNextBatch(processBatch);\n }\n };\n const wake = () => {\n runNextFrame = true;\n useDefaultElapsed = true;\n if (!state.isProcessing) {\n scheduleNextBatch(processBatch);\n }\n };\n const schedule = stepsOrder.reduce((acc, key) => {\n const step = steps[key];\n acc[key] = (process, keepAlive = false, immediate = false) => {\n if (!runNextFrame)\n wake();\n return step.schedule(process, keepAlive, immediate);\n };\n return acc;\n }, {});\n const cancel = (process) => {\n for (let i = 0; i < stepsOrder.length; i++) {\n steps[stepsOrder[i]].cancel(process);\n }\n };\n return { schedule, cancel, state, steps };\n}\n\nexport { createRenderBatcher };\n","import { noop } from 'motion-utils';\nimport { createRenderBatcher } from './batcher.mjs';\n\nconst { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame : noop, true);\n\nexport { cancelFrame, frame, frameData, frameSteps };\n","import { MotionGlobalConfig } from 'motion-utils';\nimport { frameData } from './frame.mjs';\n\nlet now;\nfunction clearTime() {\n now = undefined;\n}\n/**\n * An eventloop-synchronous alternative to performance.now().\n *\n * Ensures that time measurements remain consistent within a synchronous context.\n * Usually calling performance.now() twice within the same synchronous context\n * will return different values which isn't useful for animations when we're usually\n * trying to sync animations to the same frame.\n */\nconst time = {\n now: () => {\n if (now === undefined) {\n time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming\n ? frameData.timestamp\n : performance.now());\n }\n return now;\n },\n set: (newTime) => {\n now = newTime;\n queueMicrotask(clearTime);\n },\n};\n\nexport { time };\n","import { warnOnce, SubscriptionManager, velocityPerSecond } from 'motion-utils';\nimport { time } from '../frameloop/sync-time.mjs';\nimport { frame } from '../frameloop/frame.mjs';\n\n/**\n * Maximum time between the value of two frames, beyond which we\n * assume the velocity has since been 0.\n */\nconst MAX_VELOCITY_DELTA = 30;\nconst isFloat = (value) => {\n return !isNaN(parseFloat(value));\n};\nconst collectMotionValues = {\n current: undefined,\n};\n/**\n * `MotionValue` is used to track the state and velocity of motion values.\n *\n * @public\n */\nclass MotionValue {\n /**\n * @param init - The initiating value\n * @param config - Optional configuration options\n *\n * - `transformer`: A function to transform incoming values with.\n */\n constructor(init, options = {}) {\n /**\n * Tracks whether this value can output a velocity. Currently this is only true\n * if the value is numerical, but we might be able to widen the scope here and support\n * other value types.\n *\n * @internal\n */\n this.canTrackVelocity = null;\n /**\n * An object containing a SubscriptionManager for each active event.\n */\n this.events = {};\n this.updateAndNotify = (v) => {\n const currentTime = time.now();\n /**\n * If we're updating the value during another frame or eventloop\n * than the previous frame, then the we set the previous frame value\n * to current.\n */\n if (this.updatedAt !== currentTime) {\n this.setPrevFrameValue();\n }\n this.prev = this.current;\n this.setCurrent(v);\n // Update update subscribers\n if (this.current !== this.prev) {\n this.events.change?.notify(this.current);\n if (this.dependents) {\n for (const dependent of this.dependents) {\n dependent.dirty();\n }\n }\n }\n };\n this.hasAnimated = false;\n this.setCurrent(init);\n this.owner = options.owner;\n }\n setCurrent(current) {\n this.current = current;\n this.updatedAt = time.now();\n if (this.canTrackVelocity === null && current !== undefined) {\n this.canTrackVelocity = isFloat(this.current);\n }\n }\n setPrevFrameValue(prevFrameValue = this.current) {\n this.prevFrameValue = prevFrameValue;\n this.prevUpdatedAt = this.updatedAt;\n }\n /**\n * Adds a function that will be notified when the `MotionValue` is updated.\n *\n * It returns a function that, when called, will cancel the subscription.\n *\n * When calling `onChange` inside a React component, it should be wrapped with the\n * `useEffect` hook. As it returns an unsubscribe function, this should be returned\n * from the `useEffect` function to ensure you don't add duplicate subscribers..\n *\n * ```jsx\n * export const MyComponent = () => {\n * const x = useMotionValue(0)\n * const y = useMotionValue(0)\n * const opacity = useMotionValue(1)\n *\n * useEffect(() => {\n * function updateOpacity() {\n * const maxXY = Math.max(x.get(), y.get())\n * const newOpacity = transform(maxXY, [0, 100], [1, 0])\n * opacity.set(newOpacity)\n * }\n *\n * const unsubscribeX = x.on(\"change\", updateOpacity)\n * const unsubscribeY = y.on(\"change\", updateOpacity)\n *\n * return () => {\n * unsubscribeX()\n * unsubscribeY()\n * }\n * }, [])\n *\n * return <motion.div style={{ x }} />\n * }\n * ```\n *\n * @param subscriber - A function that receives the latest value.\n * @returns A function that, when called, will cancel this subscription.\n *\n * @deprecated\n */\n onChange(subscription) {\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on(\"change\", callback).`);\n }\n return this.on(\"change\", subscription);\n }\n on(eventName, callback) {\n if (!this.events[eventName]) {\n this.events[eventName] = new SubscriptionManager();\n }\n const unsubscribe = this.events[eventName].add(callback);\n if (eventName === \"change\") {\n return () => {\n unsubscribe();\n /**\n * If we have no more change listeners by the start\n * of the next frame, stop active animations.\n */\n frame.read(() => {\n if (!this.events.change.getSize()) {\n this.stop();\n }\n });\n };\n }\n return unsubscribe;\n }\n clearListeners() {\n for (const eventManagers in this.events) {\n this.events[eventManagers].clear();\n }\n }\n /**\n * Attaches a passive effect to the `MotionValue`.\n */\n attach(passiveEffect, stopPassiveEffect) {\n this.passiveEffect = passiveEffect;\n this.stopPassiveEffect = stopPassiveEffect;\n }\n /**\n * Sets the state of the `MotionValue`.\n *\n * @remarks\n *\n * ```jsx\n * const x = useMotionValue(0)\n * x.set(10)\n * ```\n *\n * @param latest - Latest value to set.\n * @param render - Whether to notify render subscribers. Defaults to `true`\n *\n * @public\n */\n set(v) {\n if (!this.passiveEffect) {\n this.updateAndNotify(v);\n }\n else {\n this.passiveEffect(v, this.updateAndNotify);\n }\n }\n setWithVelocity(prev, current, delta) {\n this.set(current);\n this.prev = undefined;\n this.prevFrameValue = prev;\n this.prevUpdatedAt = this.updatedAt - delta;\n }\n /**\n * Set the state of the `MotionValue`, stopping any active animations,\n * effects, and resets velocity to `0`.\n */\n jump(v, endAnimation = true) {\n this.updateAndNotify(v);\n this.prev = v;\n this.prevUpdatedAt = this.prevFrameValue = undefined;\n endAnimation && this.stop();\n if (this.stopPassiveEffect)\n this.stopPassiveEffect();\n }\n dirty() {\n this.events.change?.notify(this.current);\n }\n addDependent(dependent) {\n if (!this.dependents) {\n this.dependents = new Set();\n }\n this.dependents.add(dependent);\n }\n removeDependent(dependent) {\n if (this.dependents) {\n this.dependents.delete(dependent);\n }\n }\n /**\n * Returns the latest state of `MotionValue`\n *\n * @returns - The latest state of `MotionValue`\n *\n * @public\n */\n get() {\n if (collectMotionValues.current) {\n collectMotionValues.current.push(this);\n }\n return this.current;\n }\n /**\n * @public\n */\n getPrevious() {\n return this.prev;\n }\n /**\n * Returns the latest velocity of `MotionValue`\n *\n * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.\n *\n * @public\n */\n getVelocity() {\n const currentTime = time.now();\n if (!this.canTrackVelocity ||\n this.prevFrameValue === undefined ||\n currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {\n return 0;\n }\n const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);\n // Casts because of parseFloat's poor typing\n return velocityPerSecond(parseFloat(this.current) -\n parseFloat(this.prevFrameValue), delta);\n }\n /**\n * Registers a new animation to control this `MotionValue`. Only one\n * animation can drive a `MotionValue` at one time.\n *\n * ```jsx\n * value.start()\n * ```\n *\n * @param animation - A function that starts the provided animation\n */\n start(startAnimation) {\n this.stop();\n return new Promise((resolve) => {\n this.hasAnimated = true;\n this.animation = startAnimation(resolve);\n if (this.events.animationStart) {\n this.events.animationStart.notify();\n }\n }).then(() => {\n if (this.events.animationComplete) {\n this.events.animationComplete.notify();\n }\n this.clearAnimation();\n });\n }\n /**\n * Stop the currently active animation.\n *\n * @public\n */\n stop() {\n if (this.animation) {\n this.animation.stop();\n if (this.events.animationCancel) {\n this.events.animationCancel.notify();\n }\n }\n this.clearAnimation();\n }\n /**\n * Returns `true` if this value is currently animating.\n *\n * @public\n */\n isAnimating() {\n return !!this.animation;\n }\n clearAnimation() {\n delete this.animation;\n }\n /**\n * Destroy and clean up subscribers to this `MotionValue`.\n *\n * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically\n * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually\n * created a `MotionValue` via the `motionValue` function.\n *\n * @public\n */\n destroy() {\n this.dependents?.clear();\n this.events.destroy?.notify();\n this.clearListeners();\n this.stop();\n if (this.stopPassiveEffect) {\n this.stopPassiveEffect();\n }\n }\n}\nfunction motionValue(init, options) {\n return new MotionValue(init, options);\n}\n\nexport { MotionValue, collectMotionValues, motionValue };\n","\"use client\";\nimport { createContext } from 'react';\n\n/**\n * @public\n */\nconst MotionConfigContext = createContext({\n transformPagePoint: (p) => p,\n isStatic: false,\n reducedMotion: \"never\",\n});\n\nexport { MotionConfigContext };\n","\"use client\";\nimport { motionValue } from 'motion-dom';\nimport { useContext, useState, useEffect } from 'react';\nimport { MotionConfigContext } from '../context/MotionConfigContext.mjs';\nimport { useConstant } from '../utils/use-constant.mjs';\n\n/**\n * Creates a `MotionValue` to track the state and velocity of a value.\n *\n * Usually, these are created automatically. For advanced use-cases, like use with `useTransform`, you can create `MotionValue`s externally and pass them into the animated component via the `style` prop.\n *\n * ```jsx\n * export const MyComponent = () => {\n * const scale = useMotionValue(1)\n *\n * return <motion.div style={{ scale }} />\n * }\n * ```\n *\n * @param initial - The initial state.\n *\n * @public\n */\nfunction useMotionValue(initial) {\n const value = useConstant(() => motionValue(initial));\n /**\n * If this motion value is being used in static mode, like on\n * the Framer canvas, force components to rerender when the motion\n * value is updated.\n */\n const { isStatic } = useContext(MotionConfigContext);\n if (isStatic) {\n const [, setLatest] = useState(initial);\n useEffect(() => value.on(\"change\", setLatest), []);\n }\n return value;\n}\n\nexport { useMotionValue };\n","import { useCallback, useRef, useState } from 'react';\n\nimport {\n ActiveSectionScrollInfo,\n useActiveSection,\n ActiveSectionObserver,\n} from '@react-scrollytelling/grouped';\nimport { useMotionValue, MotionValue } from 'motion/react';\n\n/**\n * Watches for all tracked sections to find the section closet to the bottom of the viewport\n * through ScrollytellingProvider.\n * It invokes the onActiveSectionChange when the active section changes.\n * Returns the Motion value of the section scroll.\n * @param onActiveSectionChange - The callback needs to be memoized\n * @returns The trackingId of the active section and the Motion value of the section scroll\n */\nexport function useActiveSectionMotionValue(onActiveSectionChange?: ActiveSectionObserver) {\n const scrolledRatioMotionValueRef = useRef<MotionValue<number>>(useMotionValue(0));\n const [trackingId, setTrackingId] = useState<string | null>(null);\n\n const onSectionScroll = useCallback(\n (scrollInfo: ActiveSectionScrollInfo) => {\n const { trackingId: id, scrolledRatio } = scrollInfo;\n setTrackingId(id);\n scrolledRatioMotionValueRef.current.set(scrolledRatio);\n\n if (onActiveSectionChange) {\n onActiveSectionChange(scrollInfo);\n }\n },\n [onActiveSectionChange]\n );\n\n useActiveSection(onSectionScroll);\n\n return { trackingId, scrolledRatioMotionValue: scrolledRatioMotionValueRef.current };\n}\n","import { useCallback, useRef } from 'react';\n\nimport {\n IntersectionObserverOptions,\n SectionScrollInfo,\n useSectionScroll,\n} from '@react-scrollytelling/core';\nimport { useMotionValue, MotionValue } from 'motion/react';\n\n/**\n * Get the Motion value of the section scroll\n * @param sectionRef - The reference to the section element\n * @param shouldObserve - Whether the underlying IntersectionObserver should be active\n * @param onScroll - The callback to track the scroll ratio\n */\nexport function useSectionScrollMotionValue(\n sectionRef: React.RefObject<Element>,\n onScroll?: (scrollInfo: SectionScrollInfo) => void,\n shouldObserve = true,\n options?: IntersectionObserverOptions\n) {\n const scrolledRatioMotionValueRef = useRef<MotionValue<number>>(useMotionValue(0));\n\n const onSectionScroll = useCallback(\n (scrollInfo: SectionScrollInfo) => {\n const { scrolledRatio } = scrollInfo;\n scrolledRatioMotionValueRef.current.set(scrolledRatio);\n\n if (onScroll) {\n onScroll(scrollInfo);\n }\n },\n [onScroll]\n );\n\n useSectionScroll(sectionRef, onSectionScroll, shouldObserve, options);\n\n return { scrolledRatioMotionValue: scrolledRatioMotionValueRef.current };\n}\n"],"names":["useConstant","init","ref","useRef","addUniqueItem","arr","item","removeItem","index","formatErrorMessage","message","errorCode","MotionGlobalConfig","noop","any","SubscriptionManager","handler","a","b","c","numSubscriptions","i","velocityPerSecond","velocity","frameDuration","warned","warnOnce","condition","stepsOrder","statsBuffer","createRenderStep","runNextFrame","stepName","thisFrame","nextFrame","isProcessing","flushNextFrame","toKeepAlive","latestFrameData","numCalls","triggerCallback","callback","step","keepAlive","immediate","queue","frameData","maxElapsed","createRenderBatcher","scheduleNextBatch","allowKeepAlive","useDefaultElapsed","state","flagRunNextFrame","steps","acc","key","setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender","processBatch","timestamp","wake","process","frame","cancelFrame","frameSteps","now","clearTime","time","newTime","MAX_VELOCITY_DELTA","isFloat","value","MotionValue","options","v","currentTime","_a","dependent","current","prevFrameValue","subscription","eventName","unsubscribe","eventManagers","passiveEffect","stopPassiveEffect","prev","delta","endAnimation","startAnimation","resolve","_b","motionValue","MotionConfigContext","createContext","p","useMotionValue","initial","isStatic","useContext","setLatest","useState","useEffect","useActiveSectionMotionValue","onActiveSectionChange","scrolledRatioMotionValueRef","trackingId","setTrackingId","onSectionScroll","useCallback","scrollInfo","id","scrolledRatio","useActiveSection","useSectionScrollMotionValue","sectionRef","onScroll","shouldObserve","useSectionScroll"],"mappings":";;;AAUA,SAASA,EAAYC,GAAM;AACvB,QAAMC,IAAMC,EAAO,IAAI;AACvB,SAAID,EAAI,YAAY,SAChBA,EAAI,UAAUD,MAEXC,EAAI;AACf;AChBA,SAASE,EAAcC,GAAKC,GAAM;AAC9B,EAAID,EAAI,QAAQC,CAAI,MAAM,MACtBD,EAAI,KAAKC,CAAI;AACrB;AACA,SAASC,EAAWF,GAAKC,GAAM;AAC3B,QAAME,IAAQH,EAAI,QAAQC,CAAI;AAC9B,EAAIE,IAAQ,MACRH,EAAI,OAAOG,GAAO,CAAC;AAC3B;ACRA,SAASC,EAAmBC,GAASC,GAAW;AAC5C,SAEMD;AACV;ACJA,MAAME,IAAqB,CAAE,GCCvBC,+BAAO,CAACC,MAAQA;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mB;AACnD,MAAIK,GAAU;AACV,UAAM,GAAGE,CAAS,IAAIC,EAASJ,CAAO;AACtC,IAAAK,EAAU,MAAM/B,EAAM,GAAG,UAAU6B,CAAS,GAAG,CAAA,CAAE;AAAA,EACpD;AACD,SAAO7B;AACX;ACnBO,SAASgC,GAA4BC,GAA+C;AACzF,QAAMC,IAA8B7G,EAA4BoG,EAAe,CAAC,CAAC,GAC3E,CAACU,GAAYC,CAAa,IAAIN,EAAwB,IAAI,GAE1DO,IAAkBC;AAAA,IACtB,CAACC,MAAwC;AACvC,YAAM,EAAE,YAAYC,GAAI,eAAAC,EAAA,IAAkBF;AAC1C,MAAAH,EAAcI,CAAE,GACYN,EAAA,QAAQ,IAAIO,CAAa,GAEjDR,KACFA,EAAsBM,CAAU;AAAA,IAEpC;AAAA,IACA,CAACN,CAAqB;AAAA,EAAA;AAGxB,SAAAS,EAAiBL,CAAe,GAEzB,EAAE,YAAAF,GAAY,0BAA0BD,EAA4B,QAAQ;AACrF;ACtBO,SAASS,GACdC,GACAC,GACAC,IAAgB,IAChB5C,GACA;AACA,QAAMgC,IAA8B7G,EAA4BoG,EAAe,CAAC,CAAC,GAE3EY,IAAkBC;AAAA,IACtB,CAACC,MAAkC;AAC3B,YAAA,EAAE,eAAAE,EAAkB,IAAAF;AACE,MAAAL,EAAA,QAAQ,IAAIO,CAAa,GAEjDI,KACFA,EAASN,CAAU;AAAA,IAEvB;AAAA,IACA,CAACM,CAAQ;AAAA,EAAA;AAGM,SAAAE,EAAAH,GAAYP,GAAiBS,GAAe5C,CAAO,GAE7D,EAAE,0BAA0BgC,EAA4B;AACjE;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MotionValue } from 'motion/react';
|
|
2
|
+
import { ActiveSectionObserver } from '@react-scrollytelling/grouped';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Watches for all tracked sections to find the section closet to the bottom of the viewport
|
|
6
|
+
* through ScrollytellingProvider.
|
|
7
|
+
* It invokes the onActiveSectionChange when the active section changes.
|
|
8
|
+
* Returns the Motion value of the section scroll.
|
|
9
|
+
* @param onActiveSectionChange - The callback needs to be memoized
|
|
10
|
+
* @returns The trackingId of the active section and the Motion value of the section scroll
|
|
11
|
+
*/
|
|
12
|
+
export declare function useActiveSectionMotionValue(onActiveSectionChange?: ActiveSectionObserver): {
|
|
13
|
+
trackingId: string | null;
|
|
14
|
+
scrolledRatioMotionValue: MotionValue<number>;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useActiveSectionMotionValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveSectionMotionValue.d.ts","sourceRoot":"","sources":["../../../src/hooks/useActiveSectionMotionValue.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAkB,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,qBAAqB,CAAC,EAAE,qBAAqB;;;EAoBxF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MotionValue } from 'motion/react';
|
|
2
|
+
import { IntersectionObserverOptions, SectionScrollInfo } from '@react-scrollytelling/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get the Motion value of the section scroll
|
|
6
|
+
* @param sectionRef - The reference to the section element
|
|
7
|
+
* @param shouldObserve - Whether the underlying IntersectionObserver should be active
|
|
8
|
+
* @param onScroll - The callback to track the scroll ratio
|
|
9
|
+
*/
|
|
10
|
+
export declare function useSectionScrollMotionValue(sectionRef: React.RefObject<Element>, onScroll?: (scrollInfo: SectionScrollInfo) => void, shouldObserve?: boolean, options?: IntersectionObserverOptions): {
|
|
11
|
+
scrolledRatioMotionValue: MotionValue<number>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useSectionScrollMotionValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSectionScrollMotionValue.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSectionScrollMotionValue.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EAElB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAkB,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EACpC,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,EAClD,aAAa,UAAO,EACpB,OAAO,CAAC,EAAE,2BAA2B;;EAmBtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-scrollytelling/framer-motion",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "> TODO: description",
|
|
5
|
+
"author": "@hsunpei",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/hsunpei/react-scrollytelling#readme",
|
|
11
|
+
"main": "dist/index.cjs.js",
|
|
12
|
+
"module": "dist/index.es.js",
|
|
13
|
+
"types": "./dist/src/index.d.ts",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/hsunpei/react-scrollytelling.git"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "BUILD_MODE=dev yarn dev:dist",
|
|
24
|
+
"dev:dist": "yarn build:dist --watch",
|
|
25
|
+
"dev:declarations": "tsc -p . --emitDeclarationOnly --watch --outDir dist_types",
|
|
26
|
+
"build": "run-s build:dist build:declarations",
|
|
27
|
+
"build:dist": "vite build",
|
|
28
|
+
"build:declarations": "tsc -p . --emitDeclarationOnly --outDir dist_types",
|
|
29
|
+
"clean": "rimraf -rf ./dist && rimraf -rf ./dist_types",
|
|
30
|
+
"test": "jest",
|
|
31
|
+
"test:watch": "jest --watch"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/hsunpei/react-scrollytelling/issues"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@testing-library/dom": "^10.4.0",
|
|
38
|
+
"@testing-library/jest-dom": "^6.4.8",
|
|
39
|
+
"@testing-library/react": "^16.0.0",
|
|
40
|
+
"jest": "^29.7.0",
|
|
41
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
42
|
+
"motion": "^12.23.11",
|
|
43
|
+
"ts-jest": "^29.2.4",
|
|
44
|
+
"vite": "^5.2.11"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@react-scrollytelling/core": "workspace:^",
|
|
48
|
+
"@react-scrollytelling/grouped": "workspace:^",
|
|
49
|
+
"motion": "^12.23.11",
|
|
50
|
+
"react": "^18.2.0",
|
|
51
|
+
"react-dom": "^18.2.0"
|
|
52
|
+
},
|
|
53
|
+
"gitHead": "1ed64caa3c433482e0f6fcebb04f9f2539b776e6"
|
|
54
|
+
}
|