1 line
76 KiB
Plaintext
1 line
76 KiB
Plaintext
|
|
{"version":3,"sources":["../src/globals.ts","../src/helpers.ts","../src/FrameLoop.ts","../src/clamp.ts","../src/colors.ts","../src/colorMatchers.ts","../src/normalizeColor.ts","../src/colorToRgba.ts","../src/createInterpolator.ts","../src/easings.ts","../src/fluids.ts","../src/regexs.ts","../src/variableToRgba.ts","../src/stringInterpolation.ts","../src/deprecations.ts","../src/isAnimatedString.ts","../src/dom-events/scroll/index.ts","../src/dom-events/resize/resizeElement.ts","../src/dom-events/resize/resizeWindow.ts","../src/dom-events/resize/index.ts","../src/progress.ts","../src/dom-events/scroll/ScrollHandler.ts","../src/hooks/useConstant.ts","../src/hooks/useForceUpdate.ts","../src/hooks/useIsMounted.ts","../src/hooks/useIsomorphicLayoutEffect.ts","../src/hooks/useMemoOne.ts","../src/hooks/useOnce.ts","../src/hooks/usePrev.ts","../src/hooks/useReducedMotion.ts","../src/index.ts"],"sourcesContent":["import { raf, Rafz } from '@react-spring/rafz'\nimport {\n OneOrMore,\n InterpolatorConfig,\n InterpolatorArgs,\n} from '@react-spring/types'\n\nimport { FluidValue } from './fluids'\nimport type { OpaqueAnimation } from './FrameLoop'\nimport { noop } from './helpers'\n\n//\n// Required\n//\n\nexport let createStringInterpolator: (\n config: InterpolatorConfig<string>\n) => (input: number) => string\n\n//\n// Optional\n//\n\nexport let to: <Input, Output>(\n source: OneOrMore<FluidValue>,\n args: InterpolatorArgs<Input, Output>\n) => FluidValue<Output>\n\nexport let colors = null as { [key: string]: number } | null\n\nexport let skipAnimation = false as boolean\n\nexport let willAdvance: (animation: OpaqueAnimation) => void = noop\n\n//\n// Configuration\n//\n\nexport interface AnimatedGlobals {\n /** Returns a new `Interpolation` object */\n to?: typeof to\n /** Used to measure frame length. Read more [here](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) */\n now?: typeof raf.now\n /** Provide custom color names for interpolation */\n colors?: typeof colors\n /** Make all animations instant and skip the frameloop entirely */\n skipAnimation?: typeof skipAnimation\n /** Provide custom logic for string interpolation */\n createStringInterpolator?: typeof createStringInterpolator\n /** Schedule a function to run on the next frame */\n requestAnimationFrame?: (cb: () => void) => void\n /** Event props are called with `batchedUpdates` to reduce extraneous renders */\n batchedUpdates?: typeof raf.batchedUpdates\n /** @internal Exposed for testing purposes */\n willAdvance?: typeof willAdvance\n /** sets the global frameLoop setting for the global raf instance */\n frameLoop?: Rafz['frameLoop']\n}\n\nexport const assign = (globals: AnimatedGlobals) => {\n if (globals.to) to = globals.to\n if (globals.now) raf.now = globals.now\n if (globals.colors !== undefined) colors = globals.colors\n if (globals.skipAnimation != null) skipAnimation = globals.skipAnimation\n if (globals.createStringInterpolator)\n createStringInterpolator = globals.createStringInterpolator\n if (globals.requestAnimationFrame) raf.use(globals.requestAnimationFrame)\n if (globals.batchedUpdates) raf.batchedUpdates = globals.batchedUpdates\n if (globals.willAdvance) willAdvance = globals.willAdvance\n if (globals.frameLoop) raf.frameLoop = globals.frameLoop\n}\n","import { Lookup, Arrify, AnyFn, Any } from '@react-spring/types'\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nexport function noop() {}\n\nexport const defineHidden = (obj: any, key: any, value: any) =>\n Object.defineProperty(obj, key, { value, writable: true, configurable: true })\n\ntype IsType<U> = <T>(arg: T & any) => arg is Narrow<T, U>\ntype Narrow<T, U> = [T] extends [Any] ? U : [T] extends [U] ? Extract<T, U> : U\n\ntype PlainObject<T> = Exclude<T & Lookup, Function | readonly any[]>\n\nexport const is = {\n arr: Array.isArray as IsType<readonly any[]>,\n obj: <T>(a: T & any): a is PlainObject<T> =>\n !!a && a.constructor.name === 'Object',\n fun: ((a: unknown) => typeof a === 'function') as IsType<Functio
|