Mission Control Dashboard - Initial implementation

This commit is contained in:
Daniel Arroyo
2026-03-27 18:36:05 +00:00
parent 257cea2c7d
commit a8fb4d4555
12516 changed files with 2307128 additions and 2 deletions

124
node_modules/motion-dom/dist/es/value/follow-value.mjs generated vendored Normal file
View File

@@ -0,0 +1,124 @@
import { motionValue } from './index.mjs';
import { JSAnimation } from '../animation/JSAnimation.mjs';
import { isMotionValue } from './utils/is-motion-value.mjs';
import { frame } from '../frameloop/frame.mjs';
/**
* Create a `MotionValue` that animates to its latest value using any transition type.
* Can either be a value or track another `MotionValue`.
*
* ```jsx
* const x = motionValue(0)
* const y = followValue(x, { type: "spring", stiffness: 300 })
* // or with tween
* const z = followValue(x, { type: "tween", duration: 0.5, ease: "easeOut" })
* ```
*
* @param source - Initial value or MotionValue to track
* @param options - Animation transition options
* @returns `MotionValue`
*
* @public
*/
function followValue(source, options) {
const initialValue = isMotionValue(source) ? source.get() : source;
const value = motionValue(initialValue);
attachFollow(value, source, options);
return value;
}
/**
* Attach an animation to a MotionValue that will animate whenever the value changes.
* Similar to attachSpring but supports any transition type (spring, tween, inertia, etc.)
*
* @param value - The MotionValue to animate
* @param source - Initial value or MotionValue to track
* @param options - Animation transition options
* @returns Cleanup function
*
* @public
*/
function attachFollow(value, source, options = {}) {
const initialValue = value.get();
let activeAnimation = null;
let latestValue = initialValue;
let latestSetter;
const unit = typeof initialValue === "string"
? initialValue.replace(/[\d.-]/g, "")
: undefined;
const stopAnimation = () => {
if (activeAnimation) {
activeAnimation.stop();
activeAnimation = null;
}
value.animation = undefined;
};
const startAnimation = () => {
const currentValue = asNumber(value.get());
const targetValue = asNumber(latestValue);
// Don't animate if we're already at the target
if (currentValue === targetValue) {
stopAnimation();
return;
}
// Use the running animation's analytical velocity for accuracy,
// falling back to the MotionValue's velocity for the initial animation.
// This prevents systematic velocity loss at high frame rates (240hz+).
const velocity = activeAnimation
? activeAnimation.getGeneratorVelocity()
: value.getVelocity();
stopAnimation();
activeAnimation = new JSAnimation({
keyframes: [currentValue, targetValue],
velocity,
// Default to spring if no type specified (matches useSpring behavior)
type: "spring",
restDelta: 0.001,
restSpeed: 0.01,
...options,
onUpdate: latestSetter,
});
};
// Use a stable function reference so the frame loop Set deduplicates
// multiple calls within the same frame (e.g. rapid mouse events)
const scheduleAnimation = () => {
startAnimation();
value.animation = activeAnimation ?? undefined;
value["events"].animationStart?.notify();
activeAnimation?.then(() => {
value.animation = undefined;
value["events"].animationComplete?.notify();
});
};
value.attach((v, set) => {
latestValue = v;
latestSetter = (latest) => set(parseValue(latest, unit));
frame.postRender(scheduleAnimation);
}, stopAnimation);
if (isMotionValue(source)) {
let skipNextAnimation = options.skipInitialAnimation === true;
const removeSourceOnChange = source.on("change", (v) => {
if (skipNextAnimation) {
skipNextAnimation = false;
value.jump(parseValue(v, unit), false);
}
else {
value.set(parseValue(v, unit));
}
});
const removeValueOnDestroy = value.on("destroy", removeSourceOnChange);
return () => {
removeSourceOnChange();
removeValueOnDestroy();
};
}
return stopAnimation;
}
function parseValue(v, unit) {
return unit ? v + unit : v;
}
function asNumber(v) {
return typeof v === "number" ? v : parseFloat(v);
}
export { attachFollow, followValue };
//# sourceMappingURL=follow-value.mjs.map

File diff suppressed because one or more lines are too long

324
node_modules/motion-dom/dist/es/value/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,324 @@
import { warnOnce, SubscriptionManager, velocityPerSecond } from 'motion-utils';
import { time } from '../frameloop/sync-time.mjs';
import { frame } from '../frameloop/frame.mjs';
/**
* Maximum time between the value of two frames, beyond which we
* assume the velocity has since been 0.
*/
const MAX_VELOCITY_DELTA = 30;
const isFloat = (value) => {
return !isNaN(parseFloat(value));
};
const collectMotionValues = {
current: undefined,
};
/**
* `MotionValue` is used to track the state and velocity of motion values.
*
* @public
*/
class MotionValue {
/**
* @param init - The initiating value
* @param config - Optional configuration options
*
* - `transformer`: A function to transform incoming values with.
*/
constructor(init, options = {}) {
/**
* Tracks whether this value can output a velocity. Currently this is only true
* if the value is numerical, but we might be able to widen the scope here and support
* other value types.
*
* @internal
*/
this.canTrackVelocity = null;
/**
* An object containing a SubscriptionManager for each active event.
*/
this.events = {};
this.updateAndNotify = (v) => {
const currentTime = time.now();
/**
* If we're updating the value during another frame or eventloop
* than the previous frame, then the we set the previous frame value
* to current.
*/
if (this.updatedAt !== currentTime) {
this.setPrevFrameValue();
}
this.prev = this.current;
this.setCurrent(v);
// Update update subscribers
if (this.current !== this.prev) {
this.events.change?.notify(this.current);
if (this.dependents) {
for (const dependent of this.dependents) {
dependent.dirty();
}
}
}
};
this.hasAnimated = false;
this.setCurrent(init);
this.owner = options.owner;
}
setCurrent(current) {
this.current = current;
this.updatedAt = time.now();
if (this.canTrackVelocity === null && current !== undefined) {
this.canTrackVelocity = isFloat(this.current);
}
}
setPrevFrameValue(prevFrameValue = this.current) {
this.prevFrameValue = prevFrameValue;
this.prevUpdatedAt = this.updatedAt;
}
/**
* Adds a function that will be notified when the `MotionValue` is updated.
*
* It returns a function that, when called, will cancel the subscription.
*
* When calling `onChange` inside a React component, it should be wrapped with the
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
* from the `useEffect` function to ensure you don't add duplicate subscribers..
*
* ```jsx
* export const MyComponent = () => {
* const x = useMotionValue(0)
* const y = useMotionValue(0)
* const opacity = useMotionValue(1)
*
* useEffect(() => {
* function updateOpacity() {
* const maxXY = Math.max(x.get(), y.get())
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
* opacity.set(newOpacity)
* }
*
* const unsubscribeX = x.on("change", updateOpacity)
* const unsubscribeY = y.on("change", updateOpacity)
*
* return () => {
* unsubscribeX()
* unsubscribeY()
* }
* }, [])
*
* return <motion.div style={{ x }} />
* }
* ```
*
* @param subscriber - A function that receives the latest value.
* @returns A function that, when called, will cancel this subscription.
*
* @deprecated
*/
onChange(subscription) {
if (process.env.NODE_ENV !== "production") {
warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
}
return this.on("change", subscription);
}
on(eventName, callback) {
if (!this.events[eventName]) {
this.events[eventName] = new SubscriptionManager();
}
const unsubscribe = this.events[eventName].add(callback);
if (eventName === "change") {
return () => {
unsubscribe();
/**
* If we have no more change listeners by the start
* of the next frame, stop active animations.
*/
frame.read(() => {
if (!this.events.change.getSize()) {
this.stop();
}
});
};
}
return unsubscribe;
}
clearListeners() {
for (const eventManagers in this.events) {
this.events[eventManagers].clear();
}
}
/**
* Attaches a passive effect to the `MotionValue`.
*/
attach(passiveEffect, stopPassiveEffect) {
this.passiveEffect = passiveEffect;
this.stopPassiveEffect = stopPassiveEffect;
}
/**
* Sets the state of the `MotionValue`.
*
* @remarks
*
* ```jsx
* const x = useMotionValue(0)
* x.set(10)
* ```
*
* @param latest - Latest value to set.
* @param render - Whether to notify render subscribers. Defaults to `true`
*
* @public
*/
set(v) {
if (!this.passiveEffect) {
this.updateAndNotify(v);
}
else {
this.passiveEffect(v, this.updateAndNotify);
}
}
setWithVelocity(prev, current, delta) {
this.set(current);
this.prev = undefined;
this.prevFrameValue = prev;
this.prevUpdatedAt = this.updatedAt - delta;
}
/**
* Set the state of the `MotionValue`, stopping any active animations,
* effects, and resets velocity to `0`.
*/
jump(v, endAnimation = true) {
this.updateAndNotify(v);
this.prev = v;
this.prevUpdatedAt = this.prevFrameValue = undefined;
endAnimation && this.stop();
if (this.stopPassiveEffect)
this.stopPassiveEffect();
}
dirty() {
this.events.change?.notify(this.current);
}
addDependent(dependent) {
if (!this.dependents) {
this.dependents = new Set();
}
this.dependents.add(dependent);
}
removeDependent(dependent) {
if (this.dependents) {
this.dependents.delete(dependent);
}
}
/**
* Returns the latest state of `MotionValue`
*
* @returns - The latest state of `MotionValue`
*
* @public
*/
get() {
if (collectMotionValues.current) {
collectMotionValues.current.push(this);
}
return this.current;
}
/**
* @public
*/
getPrevious() {
return this.prev;
}
/**
* Returns the latest velocity of `MotionValue`
*
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
*
* @public
*/
getVelocity() {
const currentTime = time.now();
if (!this.canTrackVelocity ||
this.prevFrameValue === undefined ||
currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
return 0;
}
const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
// Casts because of parseFloat's poor typing
return velocityPerSecond(parseFloat(this.current) -
parseFloat(this.prevFrameValue), delta);
}
/**
* Registers a new animation to control this `MotionValue`. Only one
* animation can drive a `MotionValue` at one time.
*
* ```jsx
* value.start()
* ```
*
* @param animation - A function that starts the provided animation
*/
start(startAnimation) {
this.stop();
return new Promise((resolve) => {
this.hasAnimated = true;
this.animation = startAnimation(resolve);
if (this.events.animationStart) {
this.events.animationStart.notify();
}
}).then(() => {
if (this.events.animationComplete) {
this.events.animationComplete.notify();
}
this.clearAnimation();
});
}
/**
* Stop the currently active animation.
*
* @public
*/
stop() {
if (this.animation) {
this.animation.stop();
if (this.events.animationCancel) {
this.events.animationCancel.notify();
}
}
this.clearAnimation();
}
/**
* Returns `true` if this value is currently animating.
*
* @public
*/
isAnimating() {
return !!this.animation;
}
clearAnimation() {
delete this.animation;
}
/**
* Destroy and clean up subscribers to this `MotionValue`.
*
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
* created a `MotionValue` via the `motionValue` function.
*
* @public
*/
destroy() {
this.dependents?.clear();
this.events.destroy?.notify();
this.clearListeners();
this.stop();
if (this.stopPassiveEffect) {
this.stopPassiveEffect();
}
}
}
function motionValue(init, options) {
return new MotionValue(init, options);
}
export { MotionValue, collectMotionValues, motionValue };
//# sourceMappingURL=index.mjs.map

1
node_modules/motion-dom/dist/es/value/index.mjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

47
node_modules/motion-dom/dist/es/value/map-value.mjs generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import { transform } from '../utils/transform.mjs';
import { transformValue } from './transform-value.mjs';
/**
* Create a `MotionValue` that maps the output of another `MotionValue` by
* mapping it from one range of values into another.
*
* @remarks
*
* Given an input range of `[-200, -100, 100, 200]` and an output range of
* `[0, 1, 1, 0]`, the returned `MotionValue` will:
*
* - When provided a value between `-200` and `-100`, will return a value between `0` and `1`.
* - When provided a value between `-100` and `100`, will return `1`.
* - When provided a value between `100` and `200`, will return a value between `1` and `0`
*
* The input range must be a linear series of numbers. The output range
* can be any value type supported by Motion: numbers, colors, shadows, etc.
*
* Every value in the output range must be of the same type and in the same format.
*
* ```jsx
* const x = motionValue(0)
* const xRange = [-200, -100, 100, 200]
* const opacityRange = [0, 1, 1, 0]
* const opacity = mapValue(x, xRange, opacityRange)
* ```
*
* @param inputValue - `MotionValue`
* @param inputRange - A linear series of numbers (either all increasing or decreasing)
* @param outputRange - A series of numbers, colors or strings. Must be the same length as `inputRange`.
* @param options -
*
* - clamp: boolean. Clamp values to within the given range. Defaults to `true`
* - ease: EasingFunction[]. Easing functions to use on the interpolations between each value in the input and output ranges. If provided as an array, the array must be one item shorter than the input and output ranges, as the easings apply to the transition between each.
*
* @returns `MotionValue`
*
* @public
*/
function mapValue(inputValue, inputRange, outputRange, options) {
const map = transform(inputRange, outputRange, options);
return transformValue(() => map(inputValue.get()));
}
export { mapValue };
//# sourceMappingURL=map-value.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"map-value.mjs","sources":["../../../src/value/map-value.ts"],"sourcesContent":["import { MotionValue } from \".\"\nimport { transform, TransformOptions } from \"../utils/transform\"\nimport { transformValue } from \"./transform-value\"\n\nexport type MapInputRange = number[]\n\n/**\n * Create a `MotionValue` that maps the output of another `MotionValue` by\n * mapping it from one range of values into another.\n *\n * @remarks\n *\n * Given an input range of `[-200, -100, 100, 200]` and an output range of\n * `[0, 1, 1, 0]`, the returned `MotionValue` will:\n *\n * - When provided a value between `-200` and `-100`, will return a value between `0` and `1`.\n * - When provided a value between `-100` and `100`, will return `1`.\n * - When provided a value between `100` and `200`, will return a value between `1` and `0`\n *\n * The input range must be a linear series of numbers. The output range\n * can be any value type supported by Motion: numbers, colors, shadows, etc.\n *\n * Every value in the output range must be of the same type and in the same format.\n *\n * ```jsx\n * const x = motionValue(0)\n * const xRange = [-200, -100, 100, 200]\n * const opacityRange = [0, 1, 1, 0]\n * const opacity = mapValue(x, xRange, opacityRange)\n * ```\n *\n * @param inputValue - `MotionValue`\n * @param inputRange - A linear series of numbers (either all increasing or decreasing)\n * @param outputRange - A series of numbers, colors or strings. Must be the same length as `inputRange`.\n * @param options -\n *\n * - clamp: boolean. Clamp values to within the given range. Defaults to `true`\n * - ease: EasingFunction[]. Easing functions to use on the interpolations between each value in the input and output ranges. If provided as an array, the array must be one item shorter than the input and output ranges, as the easings apply to the transition between each.\n *\n * @returns `MotionValue`\n *\n * @public\n */\nexport function mapValue<O>(\n inputValue: MotionValue<number>,\n inputRange: MapInputRange,\n outputRange: O[],\n options?: TransformOptions<O>\n): MotionValue<O> {\n const map = transform(inputRange, outputRange, options)\n return transformValue(() => map(inputValue.get()))\n}\n"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCG;AACG,SAAU,QAAQ,CACpB,UAA+B,EAC/B,UAAyB,EACzB,WAAgB,EAChB,OAA6B,EAAA;IAE7B,MAAM,GAAG,GAAG,SAAS,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC;AACvD,IAAA,OAAO,cAAc,CAAC,MAAM,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC;AACtD;;;;"}

36
node_modules/motion-dom/dist/es/value/spring-value.mjs generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import { attachFollow, followValue } from './follow-value.mjs';
/**
* Create a `MotionValue` that animates to its latest value using a spring.
* Can either be a value or track another `MotionValue`.
*
* ```jsx
* const x = motionValue(0)
* const y = springValue(x, { stiffness: 300 })
* ```
*
* @param source - Initial value or MotionValue to track
* @param options - Spring configuration options
* @returns `MotionValue`
*
* @public
*/
function springValue(source, options) {
return followValue(source, { type: "spring", ...options });
}
/**
* Attach a spring animation to a MotionValue that will animate whenever the value changes.
*
* @param value - The MotionValue to animate
* @param source - Initial value or MotionValue to track
* @param options - Spring configuration options
* @returns Cleanup function
*
* @public
*/
function attachSpring(value, source, options) {
return attachFollow(value, source, { type: "spring", ...options });
}
export { attachSpring, springValue };
//# sourceMappingURL=spring-value.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"spring-value.mjs","sources":["../../../src/value/spring-value.ts"],"sourcesContent":["import { MotionValue } from \".\"\nimport { AnyResolvedKeyframe, SpringOptions } from \"../animation/types\"\nimport { attachFollow, followValue } from \"./follow-value\"\n\n/**\n * Create a `MotionValue` that animates to its latest value using a spring.\n * Can either be a value or track another `MotionValue`.\n *\n * ```jsx\n * const x = motionValue(0)\n * const y = springValue(x, { stiffness: 300 })\n * ```\n *\n * @param source - Initial value or MotionValue to track\n * @param options - Spring configuration options\n * @returns `MotionValue`\n *\n * @public\n */\nexport function springValue<T extends AnyResolvedKeyframe>(\n source: T | MotionValue<T>,\n options?: SpringOptions\n) {\n return followValue(source, { type: \"spring\", ...options })\n}\n\n/**\n * Attach a spring animation to a MotionValue that will animate whenever the value changes.\n *\n * @param value - The MotionValue to animate\n * @param source - Initial value or MotionValue to track\n * @param options - Spring configuration options\n * @returns Cleanup function\n *\n * @public\n */\nexport function attachSpring<T extends AnyResolvedKeyframe>(\n value: MotionValue<T>,\n source: T | MotionValue<T>,\n options?: SpringOptions\n): VoidFunction {\n return attachFollow(value, source, { type: \"spring\", ...options })\n}\n"],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;AAcG;AACG,SAAU,WAAW,CACvB,MAA0B,EAC1B,OAAuB,EAAA;AAEvB,IAAA,OAAO,WAAW,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;AAC9D;AAEA;;;;;;;;;AASG;SACa,YAAY,CACxB,KAAqB,EACrB,MAA0B,EAC1B,OAAuB,EAAA;AAEvB,IAAA,OAAO,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;AACtE;;;;"}

View File

@@ -0,0 +1,14 @@
import { cancelFrame, frame } from '../frameloop/frame.mjs';
function subscribeValue(inputValues, outputValue, getLatest) {
const update = () => outputValue.set(getLatest());
const scheduleUpdate = () => frame.preRender(update, false, true);
const subscriptions = inputValues.map((v) => v.on("change", scheduleUpdate));
outputValue.on("destroy", () => {
subscriptions.forEach((unsubscribe) => unsubscribe());
cancelFrame(update);
});
}
export { subscribeValue };
//# sourceMappingURL=subscribe-value.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"subscribe-value.mjs","sources":["../../../src/value/subscribe-value.ts"],"sourcesContent":["import { MotionValue } from \".\"\nimport { cancelFrame, frame } from \"../frameloop\"\n\nexport function subscribeValue<O>(\n inputValues: MotionValue[],\n outputValue: MotionValue<O>,\n getLatest: () => O\n) {\n const update = () => outputValue.set(getLatest())\n const scheduleUpdate = () => frame.preRender(update, false, true)\n\n const subscriptions = inputValues.map((v) => v.on(\"change\", scheduleUpdate))\n\n outputValue.on(\"destroy\", () => {\n subscriptions.forEach((unsubscribe) => unsubscribe())\n cancelFrame(update)\n })\n}\n"],"names":[],"mappings":";;SAGgB,cAAc,CAC1B,WAA0B,EAC1B,WAA2B,EAC3B,SAAkB,EAAA;AAElB,IAAA,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;AACjD,IAAA,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC;IAEjE,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AAE5E,IAAA,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAK;QAC3B,aAAa,CAAC,OAAO,CAAC,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;QACrD,WAAW,CAAC,MAAM,CAAC;AACvB,IAAA,CAAC,CAAC;AACN;;;;"}

View File

@@ -0,0 +1,36 @@
import { collectMotionValues, motionValue } from './index.mjs';
import { subscribeValue } from './subscribe-value.mjs';
/**
* Create a `MotionValue` that transforms the output of other `MotionValue`s by
* passing their latest values through a transform function.
*
* Whenever a `MotionValue` referred to in the provided function is updated,
* it will be re-evaluated.
*
* ```jsx
* const x = motionValue(0)
* const y = transformValue(() => x.get() * 2) // double x
* ```
*
* @param transformer - A transform function. This function must be pure with no side-effects or conditional statements.
* @returns `MotionValue`
*
* @public
*/
function transformValue(transform) {
const collectedValues = [];
/**
* Open session of collectMotionValues. Any MotionValue that calls get()
* inside transform will be saved into this array.
*/
collectMotionValues.current = collectedValues;
const initialValue = transform();
collectMotionValues.current = undefined;
const value = motionValue(initialValue);
subscribeValue(collectedValues, value, transform);
return value;
}
export { transformValue };
//# sourceMappingURL=transform-value.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"transform-value.mjs","sources":["../../../src/value/transform-value.ts"],"sourcesContent":["import { MotionValue, collectMotionValues, motionValue } from \".\"\nimport { subscribeValue } from \"./subscribe-value\"\n\nexport type TransformInputRange = number[]\nexport type SingleTransformer<I, O> = (input: I) => O\nexport type MultiTransformer<I, O> = (input: I[]) => O\nexport type ValueTransformer<I, O> =\n | SingleTransformer<I, O>\n | MultiTransformer<I, O>\n\n/**\n * Create a `MotionValue` that transforms the output of other `MotionValue`s by\n * passing their latest values through a transform function.\n *\n * Whenever a `MotionValue` referred to in the provided function is updated,\n * it will be re-evaluated.\n *\n * ```jsx\n * const x = motionValue(0)\n * const y = transformValue(() => x.get() * 2) // double x\n * ```\n *\n * @param transformer - A transform function. This function must be pure with no side-effects or conditional statements.\n * @returns `MotionValue`\n *\n * @public\n */\nexport function transformValue<O>(transform: () => O): MotionValue<O> {\n const collectedValues: MotionValue[] = []\n\n /**\n * Open session of collectMotionValues. Any MotionValue that calls get()\n * inside transform will be saved into this array.\n */\n collectMotionValues.current = collectedValues\n const initialValue = transform()\n collectMotionValues.current = undefined\n\n const value = motionValue(initialValue)\n\n subscribeValue(collectedValues, value, transform)\n\n return value\n}\n"],"names":[],"mappings":";;;AAUA;;;;;;;;;;;;;;;;AAgBG;AACG,SAAU,cAAc,CAAI,SAAkB,EAAA;IAChD,MAAM,eAAe,GAAkB,EAAE;AAEzC;;;AAGG;AACH,IAAA,mBAAmB,CAAC,OAAO,GAAG,eAAe;AAC7C,IAAA,MAAM,YAAY,GAAG,SAAS,EAAE;AAChC,IAAA,mBAAmB,CAAC,OAAO,GAAG,SAAS;AAEvC,IAAA,MAAM,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC;AAEvC,IAAA,cAAc,CAAC,eAAe,EAAE,KAAK,EAAE,SAAS,CAAC;AAEjD,IAAA,OAAO,KAAK;AAChB;;;;"}

10
node_modules/motion-dom/dist/es/value/types/auto.mjs generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* ValueType for "auto"
*/
const auto = {
test: (v) => v === "auto",
parse: (v) => v,
};
export { auto };
//# sourceMappingURL=auto.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"auto.mjs","sources":["../../../../src/value/types/auto.ts"],"sourcesContent":["import { ValueType } from \"./types\"\n\n/**\n * ValueType for \"auto\"\n */\nexport const auto: ValueType = {\n test: (v: any) => v === \"auto\",\n parse: (v) => v,\n}\n"],"names":[],"mappings":"AAEA;;AAEG;AACI,MAAM,IAAI,GAAc;IAC3B,IAAI,EAAE,CAAC,CAAM,KAAK,CAAC,KAAK,MAAM;AAC9B,IAAA,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;;;;;"}

View File

@@ -0,0 +1,41 @@
import { rgba } from './rgba.mjs';
import { isColorString } from './utils.mjs';
function parseHex(v) {
let r = "";
let g = "";
let b = "";
let a = "";
// If we have 6 characters, ie #FF0000
if (v.length > 5) {
r = v.substring(1, 3);
g = v.substring(3, 5);
b = v.substring(5, 7);
a = v.substring(7, 9);
// Or we have 3 characters, ie #F00
}
else {
r = v.substring(1, 2);
g = v.substring(2, 3);
b = v.substring(3, 4);
a = v.substring(4, 5);
r += r;
g += g;
b += b;
a += a;
}
return {
red: parseInt(r, 16),
green: parseInt(g, 16),
blue: parseInt(b, 16),
alpha: a ? parseInt(a, 16) / 255 : 1,
};
}
const hex = {
test: /*@__PURE__*/ isColorString("#"),
parse: parseHex,
transform: rgba.transform,
};
export { hex };
//# sourceMappingURL=hex.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"hex.mjs","sources":["../../../../../src/value/types/color/hex.ts"],"sourcesContent":["import { RGBA } from \"../types\"\nimport { rgba } from \"./rgba\"\nimport { isColorString } from \"./utils\"\n\nfunction parseHex(v: string): RGBA {\n let r = \"\"\n let g = \"\"\n let b = \"\"\n let a = \"\"\n\n // If we have 6 characters, ie #FF0000\n if (v.length > 5) {\n r = v.substring(1, 3)\n g = v.substring(3, 5)\n b = v.substring(5, 7)\n a = v.substring(7, 9)\n\n // Or we have 3 characters, ie #F00\n } else {\n r = v.substring(1, 2)\n g = v.substring(2, 3)\n b = v.substring(3, 4)\n a = v.substring(4, 5)\n r += r\n g += g\n b += b\n a += a\n }\n\n return {\n red: parseInt(r, 16),\n green: parseInt(g, 16),\n blue: parseInt(b, 16),\n alpha: a ? parseInt(a, 16) / 255 : 1,\n }\n}\n\nexport const hex = {\n test: /*@__PURE__*/ isColorString(\"#\"),\n parse: parseHex,\n transform: rgba.transform,\n}\n"],"names":[],"mappings":";;;AAIA,SAAS,QAAQ,CAAC,CAAS,EAAA;IACvB,IAAI,CAAC,GAAG,EAAE;IACV,IAAI,CAAC,GAAG,EAAE;IACV,IAAI,CAAC,GAAG,EAAE;IACV,IAAI,CAAC,GAAG,EAAE;;AAGV,IAAA,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QACd,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;;IAGzB;SAAO;QACH,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,IAAI,CAAC;QACN,CAAC,IAAI,CAAC;QACN,CAAC,IAAI,CAAC;QACN,CAAC,IAAI,CAAC;IACV;IAEA,OAAO;AACH,QAAA,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;AACpB,QAAA,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;AACtB,QAAA,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;AACrB,QAAA,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC;KACvC;AACL;AAEO,MAAM,GAAG,GAAG;AACf,IAAA,IAAI,gBAAgB,aAAa,CAAC,GAAG,CAAC;AACtC,IAAA,KAAK,EAAE,QAAQ;IACf,SAAS,EAAE,IAAI,CAAC,SAAS;;;;;"}

View File

@@ -0,0 +1,43 @@
// Adapted from https://gist.github.com/mjackson/5311256
function hueToRgb(p, q, t) {
if (t < 0)
t += 1;
if (t > 1)
t -= 1;
if (t < 1 / 6)
return p + (q - p) * 6 * t;
if (t < 1 / 2)
return q;
if (t < 2 / 3)
return p + (q - p) * (2 / 3 - t) * 6;
return p;
}
function hslaToRgba({ hue, saturation, lightness, alpha }) {
hue /= 360;
saturation /= 100;
lightness /= 100;
let red = 0;
let green = 0;
let blue = 0;
if (!saturation) {
red = green = blue = lightness;
}
else {
const q = lightness < 0.5
? lightness * (1 + saturation)
: lightness + saturation - lightness * saturation;
const p = 2 * lightness - q;
red = hueToRgb(p, q, hue + 1 / 3);
green = hueToRgb(p, q, hue);
blue = hueToRgb(p, q, hue - 1 / 3);
}
return {
red: Math.round(red * 255),
green: Math.round(green * 255),
blue: Math.round(blue * 255),
alpha,
};
}
export { hslaToRgba };
//# sourceMappingURL=hsla-to-rgba.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"hsla-to-rgba.mjs","sources":["../../../../../src/value/types/color/hsla-to-rgba.ts"],"sourcesContent":["import { HSLA, RGBA } from \"../types\"\n\n// Adapted from https://gist.github.com/mjackson/5311256\nfunction hueToRgb(p: number, q: number, t: number) {\n if (t < 0) t += 1\n if (t > 1) t -= 1\n if (t < 1 / 6) return p + (q - p) * 6 * t\n if (t < 1 / 2) return q\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6\n return p\n}\n\nexport function hslaToRgba({ hue, saturation, lightness, alpha }: HSLA): RGBA {\n hue /= 360\n saturation /= 100\n lightness /= 100\n\n let red = 0\n let green = 0\n let blue = 0\n\n if (!saturation) {\n red = green = blue = lightness\n } else {\n const q =\n lightness < 0.5\n ? lightness * (1 + saturation)\n : lightness + saturation - lightness * saturation\n const p = 2 * lightness - q\n\n red = hueToRgb(p, q, hue + 1 / 3)\n green = hueToRgb(p, q, hue)\n blue = hueToRgb(p, q, hue - 1 / 3)\n }\n\n return {\n red: Math.round(red * 255),\n green: Math.round(green * 255),\n blue: Math.round(blue * 255),\n alpha,\n }\n}\n"],"names":[],"mappings":"AAEA;AACA,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;IAC7C,IAAI,CAAC,GAAG,CAAC;QAAE,CAAC,IAAI,CAAC;IACjB,IAAI,CAAC,GAAG,CAAC;QAAE,CAAC,IAAI,CAAC;AACjB,IAAA,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;AACzC,IAAA,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,CAAC;AACvB,IAAA,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;AACnD,IAAA,OAAO,CAAC;AACZ;AAEM,SAAU,UAAU,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAQ,EAAA;IAClE,GAAG,IAAI,GAAG;IACV,UAAU,IAAI,GAAG;IACjB,SAAS,IAAI,GAAG;IAEhB,IAAI,GAAG,GAAG,CAAC;IACX,IAAI,KAAK,GAAG,CAAC;IACb,IAAI,IAAI,GAAG,CAAC;IAEZ,IAAI,CAAC,UAAU,EAAE;AACb,QAAA,GAAG,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS;IAClC;SAAO;AACH,QAAA,MAAM,CAAC,GACH,SAAS,GAAG;AACR,cAAE,SAAS,IAAI,CAAC,GAAG,UAAU;cAC3B,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU;AACzD,QAAA,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC;AAE3B,QAAA,GAAG,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACjC,KAAK,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;AAC3B,QAAA,IAAI,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC;IAEA,OAAO;QACH,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;QAC1B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC;QAC9B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC;QAC5B,KAAK;KACR;AACL;;;;"}

View File

@@ -0,0 +1,23 @@
import { alpha } from '../numbers/index.mjs';
import { percent } from '../numbers/units.mjs';
import { sanitize } from '../utils/sanitize.mjs';
import { splitColor, isColorString } from './utils.mjs';
const hsla = {
test: /*@__PURE__*/ isColorString("hsl", "hue"),
parse: /*@__PURE__*/ splitColor("hue", "saturation", "lightness"),
transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
return ("hsla(" +
Math.round(hue) +
", " +
percent.transform(sanitize(saturation)) +
", " +
percent.transform(sanitize(lightness)) +
", " +
sanitize(alpha.transform(alpha$1)) +
")");
},
};
export { hsla };
//# sourceMappingURL=hsla.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"hsla.mjs","sources":["../../../../../src/value/types/color/hsla.ts"],"sourcesContent":["import { alpha as alphaType } from \"../numbers\"\nimport { percent } from \"../numbers/units\"\nimport { HSLA } from \"../types\"\nimport { sanitize } from \"../utils/sanitize\"\nimport { isColorString, splitColor } from \"./utils\"\n\nexport const hsla = {\n test: /*@__PURE__*/ isColorString(\"hsl\", \"hue\"),\n parse: /*@__PURE__*/ splitColor<HSLA>(\"hue\", \"saturation\", \"lightness\"),\n transform: ({ hue, saturation, lightness, alpha = 1 }: HSLA) => {\n return (\n \"hsla(\" +\n Math.round(hue) +\n \", \" +\n percent.transform(sanitize(saturation)) +\n \", \" +\n percent.transform(sanitize(lightness)) +\n \", \" +\n sanitize(alphaType.transform(alpha)) +\n \")\"\n )\n },\n}\n"],"names":["alpha","alphaType"],"mappings":";;;;;AAMO,MAAM,IAAI,GAAG;IAChB,IAAI,gBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;IAC/C,KAAK,gBAAgB,UAAU,CAAO,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC;AACvE,IAAA,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,SAAEA,OAAK,GAAG,CAAC,EAAQ,KAAI;AAC3D,QAAA,QACI,OAAO;AACP,YAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YACf,IAAI;AACJ,YAAA,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACvC,IAAI;AACJ,YAAA,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI;AACJ,YAAA,QAAQ,CAACC,KAAS,CAAC,SAAS,CAACD,OAAK,CAAC,CAAC;AACpC,YAAA,GAAG;IAEX,CAAC;;;;;"}

View File

@@ -0,0 +1,33 @@
import { hex } from './hex.mjs';
import { hsla } from './hsla.mjs';
import { rgba } from './rgba.mjs';
const color = {
test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
parse: (v) => {
if (rgba.test(v)) {
return rgba.parse(v);
}
else if (hsla.test(v)) {
return hsla.parse(v);
}
else {
return hex.parse(v);
}
},
transform: (v) => {
return typeof v === "string"
? v
: v.hasOwnProperty("red")
? rgba.transform(v)
: hsla.transform(v);
},
getAnimatableNone: (v) => {
const parsed = color.parse(v);
parsed.alpha = 0;
return color.transform(parsed);
},
};
export { color };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../src/value/types/color/index.ts"],"sourcesContent":["import { HSLA, RGBA } from \"../types\"\nimport { hex } from \"./hex\"\nimport { hsla } from \"./hsla\"\nimport { rgba } from \"./rgba\"\n\nexport const color = {\n test: (v: any) => rgba.test(v) || hex.test(v) || hsla.test(v),\n parse: (v: any): RGBA | HSLA => {\n if (rgba.test(v)) {\n return rgba.parse(v)\n } else if (hsla.test(v)) {\n return hsla.parse(v)\n } else {\n return hex.parse(v)\n }\n },\n transform: (v: HSLA | RGBA | string) => {\n return typeof v === \"string\"\n ? v\n : v.hasOwnProperty(\"red\")\n ? rgba.transform(v as RGBA)\n : hsla.transform(v as HSLA)\n },\n getAnimatableNone: (v: string) => {\n const parsed = color.parse(v)\n parsed.alpha = 0\n return color.transform(parsed)\n },\n}\n"],"names":[],"mappings":";;;;AAKO,MAAM,KAAK,GAAG;IACjB,IAAI,EAAE,CAAC,CAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7D,IAAA,KAAK,EAAE,CAAC,CAAM,KAAiB;AAC3B,QAAA,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;AACd,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACxB;AAAO,aAAA,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;AACrB,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACxB;aAAO;AACH,YAAA,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QACvB;IACJ,CAAC;AACD,IAAA,SAAS,EAAE,CAAC,CAAuB,KAAI;QACnC,OAAO,OAAO,CAAC,KAAK;AAChB,cAAE;AACF,cAAE,CAAC,CAAC,cAAc,CAAC,KAAK;AACxB,kBAAE,IAAI,CAAC,SAAS,CAAC,CAAS;AAC1B,kBAAE,IAAI,CAAC,SAAS,CAAC,CAAS,CAAC;IACnC,CAAC;AACD,IAAA,iBAAiB,EAAE,CAAC,CAAS,KAAI;QAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,QAAA,MAAM,CAAC,KAAK,GAAG,CAAC;AAChB,QAAA,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;IAClC,CAAC;;;;;"}

View File

@@ -0,0 +1,26 @@
import { clamp } from 'motion-utils';
import { number, alpha } from '../numbers/index.mjs';
import { sanitize } from '../utils/sanitize.mjs';
import { splitColor, isColorString } from './utils.mjs';
const clampRgbUnit = (v) => clamp(0, 255, v);
const rgbUnit = {
...number,
transform: (v) => Math.round(clampRgbUnit(v)),
};
const rgba = {
test: /*@__PURE__*/ isColorString("rgb", "red"),
parse: /*@__PURE__*/ splitColor("red", "green", "blue"),
transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" +
rgbUnit.transform(red) +
", " +
rgbUnit.transform(green) +
", " +
rgbUnit.transform(blue) +
", " +
sanitize(alpha.transform(alpha$1)) +
")",
};
export { rgbUnit, rgba };
//# sourceMappingURL=rgba.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"rgba.mjs","sources":["../../../../../src/value/types/color/rgba.ts"],"sourcesContent":["import { clamp } from \"motion-utils\"\nimport { alpha as alphaType, number } from \"../numbers\"\nimport { RGBA } from \"../types\"\nimport { sanitize } from \"../utils/sanitize\"\nimport { isColorString, splitColor } from \"./utils\"\n\nconst clampRgbUnit = (v: number) => clamp(0, 255, v)\nexport const rgbUnit = {\n ...number,\n transform: (v: number) => Math.round(clampRgbUnit(v)),\n}\n\nexport const rgba = {\n test: /*@__PURE__*/ isColorString(\"rgb\", \"red\"),\n parse: /*@__PURE__*/ splitColor<RGBA>(\"red\", \"green\", \"blue\"),\n transform: ({ red, green, blue, alpha = 1 }: RGBA) =>\n \"rgba(\" +\n rgbUnit.transform(red) +\n \", \" +\n rgbUnit.transform(green) +\n \", \" +\n rgbUnit.transform(blue) +\n \", \" +\n sanitize(alphaType.transform(alpha)) +\n \")\",\n}\n"],"names":["alpha","alphaType"],"mappings":";;;;;AAMA,MAAM,YAAY,GAAG,CAAC,CAAS,KAAK,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;AAC7C,MAAM,OAAO,GAAG;AACnB,IAAA,GAAG,MAAM;AACT,IAAA,SAAS,EAAE,CAAC,CAAS,KAAK,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;;AAGlD,MAAM,IAAI,GAAG;IAChB,IAAI,gBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;IAC/C,KAAK,gBAAgB,UAAU,CAAO,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC;AAC7D,IAAA,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,SAAEA,OAAK,GAAG,CAAC,EAAQ,KAC7C,OAAO;AACP,QAAA,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC;QACtB,IAAI;AACJ,QAAA,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;QACxB,IAAI;AACJ,QAAA,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;QACvB,IAAI;AACJ,QAAA,QAAQ,CAACC,KAAS,CAAC,SAAS,CAACD,OAAK,CAAC,CAAC;QACpC,GAAG;;;;;"}

View File

@@ -0,0 +1,30 @@
import { floatRegex } from '../utils/float-regex.mjs';
import { isNullish } from '../utils/is-nullish.mjs';
import { singleColorRegex } from '../utils/single-color-regex.mjs';
/**
* Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000,
* but false if a number or multiple colors
*/
const isColorString = (type, testProp) => (v) => {
return Boolean((typeof v === "string" &&
singleColorRegex.test(v) &&
v.startsWith(type)) ||
(testProp &&
!isNullish(v) &&
Object.prototype.hasOwnProperty.call(v, testProp)));
};
const splitColor = (aName, bName, cName) => (v) => {
if (typeof v !== "string")
return v;
const [a, b, c, alpha] = v.match(floatRegex);
return {
[aName]: parseFloat(a),
[bName]: parseFloat(b),
[cName]: parseFloat(c),
alpha: alpha !== undefined ? parseFloat(alpha) : 1,
};
};
export { isColorString, splitColor };
//# sourceMappingURL=utils.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.mjs","sources":["../../../../../src/value/types/color/utils.ts"],"sourcesContent":["import { Color, HSLA, RGBA } from \"../types\"\nimport { floatRegex } from \"../utils/float-regex\"\nimport { isNullish } from \"../utils/is-nullish\"\nimport { singleColorRegex } from \"../utils/single-color-regex\"\n\n/**\n * Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000,\n * but false if a number or multiple colors\n */\nexport const isColorString = (type: string, testProp?: string) => (v: any) => {\n return Boolean(\n (typeof v === \"string\" &&\n singleColorRegex.test(v) &&\n v.startsWith(type)) ||\n (testProp &&\n !isNullish(v) &&\n Object.prototype.hasOwnProperty.call(v, testProp))\n )\n}\n\nexport const splitColor =\n <V extends RGBA | HSLA>(aName: string, bName: string, cName: string) =>\n (v: string | Color): V => {\n if (typeof v !== \"string\") return v as any\n\n const [a, b, c, alpha] = v.match(floatRegex) as any\n\n return {\n [aName]: parseFloat(a),\n [bName]: parseFloat(b),\n [cName]: parseFloat(c),\n alpha: alpha !== undefined ? parseFloat(alpha) : 1,\n } as V\n }\n"],"names":[],"mappings":";;;;AAKA;;;AAGG;AACI,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,QAAiB,KAAK,CAAC,CAAM,KAAI;AACzE,IAAA,OAAO,OAAO,CACV,CAAC,OAAO,CAAC,KAAK,QAAQ;AAClB,QAAA,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AACxB,QAAA,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;AAClB,SAAC,QAAQ;YACL,CAAC,SAAS,CAAC,CAAC,CAAC;AACb,YAAA,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAC7D;AACL;AAEO,MAAM,UAAU,GACnB,CAAwB,KAAa,EAAE,KAAa,EAAE,KAAa,KACnE,CAAC,CAAiB,KAAO;IACrB,IAAI,OAAO,CAAC,KAAK,QAAQ;AAAE,QAAA,OAAO,CAAQ;AAE1C,IAAA,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAQ;IAEnD,OAAO;AACH,QAAA,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC;AACtB,QAAA,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC;AACtB,QAAA,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC;AACtB,QAAA,KAAK,EAAE,KAAK,KAAK,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC;KAChD;AACV;;;;"}

View File

@@ -0,0 +1,31 @@
import { complex } from './index.mjs';
import { floatRegex } from '../utils/float-regex.mjs';
/**
* Properties that should default to 1 or 100%
*/
const maxDefaults = new Set(["brightness", "contrast", "saturate", "opacity"]);
function applyDefaultFilter(v) {
const [name, value] = v.slice(0, -1).split("(");
if (name === "drop-shadow")
return v;
const [number] = value.match(floatRegex) || [];
if (!number)
return v;
const unit = value.replace(number, "");
let defaultValue = maxDefaults.has(name) ? 1 : 0;
if (number !== value)
defaultValue *= 100;
return name + "(" + defaultValue + unit + ")";
}
const functionRegex = /\b([a-z-]*)\(.*?\)/gu;
const filter = {
...complex,
getAnimatableNone: (v) => {
const functions = v.match(functionRegex);
return functions ? functions.map(applyDefaultFilter).join(" ") : v;
},
};
export { filter };
//# sourceMappingURL=filter.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"filter.mjs","sources":["../../../../../src/value/types/complex/filter.ts"],"sourcesContent":["import { complex } from \".\"\nimport { floatRegex } from \"../utils/float-regex\"\n\n/**\n * Properties that should default to 1 or 100%\n */\nconst maxDefaults = new Set([\"brightness\", \"contrast\", \"saturate\", \"opacity\"])\n\nfunction applyDefaultFilter(v: string) {\n const [name, value] = v.slice(0, -1).split(\"(\")\n\n if (name === \"drop-shadow\") return v\n\n const [number] = value.match(floatRegex) || []\n if (!number) return v\n\n const unit = value.replace(number, \"\")\n let defaultValue = maxDefaults.has(name) ? 1 : 0\n if (number !== value) defaultValue *= 100\n\n return name + \"(\" + defaultValue + unit + \")\"\n}\n\nconst functionRegex = /\\b([a-z-]*)\\(.*?\\)/gu\n\nexport const filter = {\n ...complex,\n getAnimatableNone: (v: string) => {\n const functions = v.match(functionRegex)\n return functions ? functions.map(applyDefaultFilter).join(\" \") : v\n },\n}\n"],"names":[],"mappings":";;;AAGA;;AAEG;AACH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AAE9E,SAAS,kBAAkB,CAAC,CAAS,EAAA;IACjC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;IAE/C,IAAI,IAAI,KAAK,aAAa;AAAE,QAAA,OAAO,CAAC;AAEpC,IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE;AAC9C,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,CAAC;IAErB,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;AACtC,IAAA,IAAI,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAChD,IAAI,MAAM,KAAK,KAAK;QAAE,YAAY,IAAI,GAAG;IAEzC,OAAO,IAAI,GAAG,GAAG,GAAG,YAAY,GAAG,IAAI,GAAG,GAAG;AACjD;AAEA,MAAM,aAAa,GAAG,sBAAsB;AAErC,MAAM,MAAM,GAAG;AAClB,IAAA,GAAG,OAAO;AACV,IAAA,iBAAiB,EAAE,CAAC,CAAS,KAAI;QAC7B,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;AACxC,QAAA,OAAO,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACtE,CAAC;;;;;"}

View File

@@ -0,0 +1,114 @@
import { color } from '../color/index.mjs';
import { colorRegex } from '../utils/color-regex.mjs';
import { floatRegex } from '../utils/float-regex.mjs';
import { sanitize } from '../utils/sanitize.mjs';
function test(v) {
return (isNaN(v) &&
typeof v === "string" &&
(v.match(floatRegex)?.length || 0) +
(v.match(colorRegex)?.length || 0) >
0);
}
const NUMBER_TOKEN = "number";
const COLOR_TOKEN = "color";
const VAR_TOKEN = "var";
const VAR_FUNCTION_TOKEN = "var(";
const SPLIT_TOKEN = "${}";
// this regex consists of the `singleCssVariableRegex|rgbHSLValueRegex|digitRegex`
const complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
function analyseComplexValue(value) {
const originalValue = value.toString();
const values = [];
const indexes = {
color: [],
number: [],
var: [],
};
const types = [];
let i = 0;
const tokenised = originalValue.replace(complexRegex, (parsedValue) => {
if (color.test(parsedValue)) {
indexes.color.push(i);
types.push(COLOR_TOKEN);
values.push(color.parse(parsedValue));
}
else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
indexes.var.push(i);
types.push(VAR_TOKEN);
values.push(parsedValue);
}
else {
indexes.number.push(i);
types.push(NUMBER_TOKEN);
values.push(parseFloat(parsedValue));
}
++i;
return SPLIT_TOKEN;
});
const split = tokenised.split(SPLIT_TOKEN);
return { values, split, indexes, types };
}
function parseComplexValue(v) {
return analyseComplexValue(v).values;
}
function buildTransformer({ split, types }) {
const numSections = split.length;
return (v) => {
let output = "";
for (let i = 0; i < numSections; i++) {
output += split[i];
if (v[i] !== undefined) {
const type = types[i];
if (type === NUMBER_TOKEN) {
output += sanitize(v[i]);
}
else if (type === COLOR_TOKEN) {
output += color.transform(v[i]);
}
else {
output += v[i];
}
}
}
return output;
};
}
function createTransformer(source) {
return buildTransformer(analyseComplexValue(source));
}
const convertNumbersToZero = (v) => typeof v === "number" ? 0 : color.test(v) ? color.getAnimatableNone(v) : v;
/**
* Convert a parsed value to its zero equivalent, but preserve numbers
* that act as divisors in CSS calc() expressions.
*
* analyseComplexValue extracts numbers from CSS strings and puts the
* surrounding text into a `split` template array. For example:
* "calc(var(--gap) / 5)" → values: [var(--gap), 5]
* split: ["calc(", " / ", ")"]
*
* When building a zero-equivalent for animation, naively zeroing all
* numbers turns the divisor into 0 → "calc(var(--gap) / 0)" → NaN.
* We detect this by checking whether the text preceding a number
* (split[i]) ends with "/" — the CSS calc division operator.
*/
const convertToZero = (value, splitBefore) => {
if (typeof value === "number") {
return splitBefore?.trim().endsWith("/") ? value : 0;
}
return convertNumbersToZero(value);
};
function getAnimatableNone(v) {
const info = analyseComplexValue(v);
const transformer = buildTransformer(info);
return transformer(info.values.map((value, i) => convertToZero(value, info.split[i])));
}
const complex = {
test,
parse: parseComplexValue,
createTransformer,
getAnimatableNone,
};
export { analyseComplexValue, complex };
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
import { complex } from './index.mjs';
const mask = {
...complex,
getAnimatableNone: (v) => {
const parsed = complex.parse(v);
const transformer = complex.createTransformer(v);
return transformer(parsed.map((v) => typeof v === "number" ? 0 : typeof v === "object" ? { ...v, alpha: 1 } : v));
},
};
export { mask };
//# sourceMappingURL=mask.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"mask.mjs","sources":["../../../../../src/value/types/complex/mask.ts"],"sourcesContent":["import { complex } from \".\"\nimport { AnyResolvedKeyframe } from \"../../../animation/types\"\n\nexport const mask = {\n ...complex,\n getAnimatableNone: (v: AnyResolvedKeyframe) => {\n const parsed = complex.parse(v)\n const transformer = complex.createTransformer(v)\n return transformer(\n parsed.map((v) =>\n typeof v === \"number\" ? 0 : typeof v === \"object\" ? { ...v, alpha: 1 } : v\n )\n )\n },\n}\n"],"names":[],"mappings":";;AAGO,MAAM,IAAI,GAAG;AAChB,IAAA,GAAG,OAAO;AACV,IAAA,iBAAiB,EAAE,CAAC,CAAsB,KAAI;QAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/B,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAChD,QAAA,OAAO,WAAW,CACd,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KACT,OAAO,CAAC,KAAK,QAAQ,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,QAAQ,GAAG,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,CAC7E,CACJ;IACL,CAAC;;;;;"}

View File

@@ -0,0 +1,16 @@
import { auto } from './auto.mjs';
import { number } from './numbers/index.mjs';
import { px, percent, degrees, vw, vh } from './numbers/units.mjs';
import { testValueType } from './test.mjs';
/**
* A list of value types commonly used for dimensions
*/
const dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
/**
* Tests a dimensional value against the list of dimension ValueTypes
*/
const findDimensionValueType = (v) => dimensionValueTypes.find(testValueType(v));
export { dimensionValueTypes, findDimensionValueType };
//# sourceMappingURL=dimensions.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dimensions.mjs","sources":["../../../../src/value/types/dimensions.ts"],"sourcesContent":["import { auto } from \"./auto\"\nimport { number } from \"./numbers\"\nimport { degrees, percent, px, vh, vw } from \"./numbers/units\"\nimport { testValueType } from \"./test\"\n\n/**\n * A list of value types commonly used for dimensions\n */\nexport const dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto]\n\n/**\n * Tests a dimensional value against the list of dimension ValueTypes\n */\nexport const findDimensionValueType = (v: any) =>\n dimensionValueTypes.find(testValueType(v))\n"],"names":[],"mappings":";;;;;AAKA;;AAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI;AAE9E;;AAEG;AACI,MAAM,sBAAsB,GAAG,CAAC,CAAM,KACzC,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;;;;"}

9
node_modules/motion-dom/dist/es/value/types/int.mjs generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import { number } from './numbers/index.mjs';
const int = {
...number,
transform: Math.round,
};
export { int };
//# sourceMappingURL=int.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"int.mjs","sources":["../../../../src/value/types/int.ts"],"sourcesContent":["import { number } from \"./numbers\"\n\nexport const int = {\n ...number,\n transform: Math.round,\n}\n"],"names":[],"mappings":";;AAEO,MAAM,GAAG,GAAG;AACf,IAAA,GAAG,MAAM;IACT,SAAS,EAAE,IAAI,CAAC,KAAK;;;;;"}

View File

@@ -0,0 +1,34 @@
import { color } from '../color/index.mjs';
import { filter } from '../complex/filter.mjs';
import { mask } from '../complex/mask.mjs';
import { numberValueTypes } from './number.mjs';
/**
* A map of default value types for common values
*/
const defaultValueTypes = {
...numberValueTypes,
// Color props
color,
backgroundColor: color,
outlineColor: color,
fill: color,
stroke: color,
// Border props
borderColor: color,
borderTopColor: color,
borderRightColor: color,
borderBottomColor: color,
borderLeftColor: color,
filter,
WebkitFilter: filter,
mask,
WebkitMask: mask,
};
/**
* Gets the default ValueType for the provided value key
*/
const getDefaultValueType = (key) => defaultValueTypes[key];
export { defaultValueTypes, getDefaultValueType };
//# sourceMappingURL=defaults.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"defaults.mjs","sources":["../../../../../src/value/types/maps/defaults.ts"],"sourcesContent":["import { color } from \"../color\"\nimport { filter } from \"../complex/filter\"\nimport { mask } from \"../complex/mask\"\nimport { numberValueTypes } from \"./number\"\nimport { ValueTypeMap } from \"./types\"\n\n/**\n * A map of default value types for common values\n */\nexport const defaultValueTypes: ValueTypeMap = {\n ...numberValueTypes,\n\n // Color props\n color,\n backgroundColor: color,\n outlineColor: color,\n fill: color,\n stroke: color,\n\n // Border props\n borderColor: color,\n borderTopColor: color,\n borderRightColor: color,\n borderBottomColor: color,\n borderLeftColor: color,\n filter,\n WebkitFilter: filter,\n mask,\n WebkitMask: mask,\n}\n\n/**\n * Gets the default ValueType for the provided value key\n */\nexport const getDefaultValueType = (key: string) => defaultValueTypes[key]\n"],"names":[],"mappings":";;;;;AAMA;;AAEG;AACI,MAAM,iBAAiB,GAAiB;AAC3C,IAAA,GAAG,gBAAgB;;IAGnB,KAAK;AACL,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,MAAM,EAAE,KAAK;;AAGb,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,cAAc,EAAE,KAAK;AACrB,IAAA,gBAAgB,EAAE,KAAK;AACvB,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,eAAe,EAAE,KAAK;IACtB,MAAM;AACN,IAAA,YAAY,EAAE,MAAM;IACpB,IAAI;AACJ,IAAA,UAAU,EAAE,IAAI;;AAGpB;;AAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,GAAW,KAAK,iBAAiB,CAAC,GAAG;;;;"}

View File

@@ -0,0 +1,71 @@
import { int } from '../int.mjs';
import { alpha } from '../numbers/index.mjs';
import { px } from '../numbers/units.mjs';
import { transformValueTypes } from './transform.mjs';
const numberValueTypes = {
// Border props
borderWidth: px,
borderTopWidth: px,
borderRightWidth: px,
borderBottomWidth: px,
borderLeftWidth: px,
borderRadius: px,
borderTopLeftRadius: px,
borderTopRightRadius: px,
borderBottomRightRadius: px,
borderBottomLeftRadius: px,
// Positioning props
width: px,
maxWidth: px,
height: px,
maxHeight: px,
top: px,
right: px,
bottom: px,
left: px,
inset: px,
insetBlock: px,
insetBlockStart: px,
insetBlockEnd: px,
insetInline: px,
insetInlineStart: px,
insetInlineEnd: px,
// Spacing props
padding: px,
paddingTop: px,
paddingRight: px,
paddingBottom: px,
paddingLeft: px,
paddingBlock: px,
paddingBlockStart: px,
paddingBlockEnd: px,
paddingInline: px,
paddingInlineStart: px,
paddingInlineEnd: px,
margin: px,
marginTop: px,
marginRight: px,
marginBottom: px,
marginLeft: px,
marginBlock: px,
marginBlockStart: px,
marginBlockEnd: px,
marginInline: px,
marginInlineStart: px,
marginInlineEnd: px,
// Typography
fontSize: px,
// Misc
backgroundPositionX: px,
backgroundPositionY: px,
...transformValueTypes,
zIndex: int,
// SVG
fillOpacity: alpha,
strokeOpacity: alpha,
numOctaves: int,
};
export { numberValueTypes };
//# sourceMappingURL=number.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"number.mjs","sources":["../../../../../src/value/types/maps/number.ts"],"sourcesContent":["import { int } from \"../int\"\nimport { alpha } from \"../numbers\"\nimport { px } from \"../numbers/units\"\nimport { transformValueTypes } from \"./transform\"\nimport { ValueTypeMap } from \"./types\"\n\nexport const numberValueTypes: ValueTypeMap = {\n // Border props\n borderWidth: px,\n borderTopWidth: px,\n borderRightWidth: px,\n borderBottomWidth: px,\n borderLeftWidth: px,\n borderRadius: px,\n borderTopLeftRadius: px,\n borderTopRightRadius: px,\n borderBottomRightRadius: px,\n borderBottomLeftRadius: px,\n\n // Positioning props\n width: px,\n maxWidth: px,\n height: px,\n maxHeight: px,\n top: px,\n right: px,\n bottom: px,\n left: px,\n inset: px,\n insetBlock: px,\n insetBlockStart: px,\n insetBlockEnd: px,\n insetInline: px,\n insetInlineStart: px,\n insetInlineEnd: px,\n\n // Spacing props\n padding: px,\n paddingTop: px,\n paddingRight: px,\n paddingBottom: px,\n paddingLeft: px,\n paddingBlock: px,\n paddingBlockStart: px,\n paddingBlockEnd: px,\n paddingInline: px,\n paddingInlineStart: px,\n paddingInlineEnd: px,\n margin: px,\n marginTop: px,\n marginRight: px,\n marginBottom: px,\n marginLeft: px,\n marginBlock: px,\n marginBlockStart: px,\n marginBlockEnd: px,\n marginInline: px,\n marginInlineStart: px,\n marginInlineEnd: px,\n\n // Typography\n fontSize: px,\n\n // Misc\n backgroundPositionX: px,\n backgroundPositionY: px,\n\n ...transformValueTypes,\n zIndex: int,\n\n // SVG\n fillOpacity: alpha,\n strokeOpacity: alpha,\n numOctaves: int,\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,gBAAgB,GAAiB;;AAE1C,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,gBAAgB,EAAE,EAAE;AACpB,IAAA,iBAAiB,EAAE,EAAE;AACrB,IAAA,eAAe,EAAE,EAAE;AACnB,IAAA,YAAY,EAAE,EAAE;AAChB,IAAA,mBAAmB,EAAE,EAAE;AACvB,IAAA,oBAAoB,EAAE,EAAE;AACxB,IAAA,uBAAuB,EAAE,EAAE;AAC3B,IAAA,sBAAsB,EAAE,EAAE;;AAG1B,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,QAAQ,EAAE,EAAE;AACZ,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,SAAS,EAAE,EAAE;AACb,IAAA,GAAG,EAAE,EAAE;AACP,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,IAAI,EAAE,EAAE;AACR,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,eAAe,EAAE,EAAE;AACnB,IAAA,aAAa,EAAE,EAAE;AACjB,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,gBAAgB,EAAE,EAAE;AACpB,IAAA,cAAc,EAAE,EAAE;;AAGlB,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,YAAY,EAAE,EAAE;AAChB,IAAA,aAAa,EAAE,EAAE;AACjB,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,YAAY,EAAE,EAAE;AAChB,IAAA,iBAAiB,EAAE,EAAE;AACrB,IAAA,eAAe,EAAE,EAAE;AACnB,IAAA,aAAa,EAAE,EAAE;AACjB,IAAA,kBAAkB,EAAE,EAAE;AACtB,IAAA,gBAAgB,EAAE,EAAE;AACpB,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,SAAS,EAAE,EAAE;AACb,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,YAAY,EAAE,EAAE;AAChB,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,gBAAgB,EAAE,EAAE;AACpB,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,YAAY,EAAE,EAAE;AAChB,IAAA,iBAAiB,EAAE,EAAE;AACrB,IAAA,eAAe,EAAE,EAAE;;AAGnB,IAAA,QAAQ,EAAE,EAAE;;AAGZ,IAAA,mBAAmB,EAAE,EAAE;AACvB,IAAA,mBAAmB,EAAE,EAAE;AAEvB,IAAA,GAAG,mBAAmB;AACtB,IAAA,MAAM,EAAE,GAAG;;AAGX,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,UAAU,EAAE,GAAG;;;;;"}

View File

@@ -0,0 +1,32 @@
import { alpha, scale } from '../numbers/index.mjs';
import { px, progressPercentage, degrees } from '../numbers/units.mjs';
const transformValueTypes = {
rotate: degrees,
rotateX: degrees,
rotateY: degrees,
rotateZ: degrees,
scale,
scaleX: scale,
scaleY: scale,
scaleZ: scale,
skew: degrees,
skewX: degrees,
skewY: degrees,
distance: px,
translateX: px,
translateY: px,
translateZ: px,
x: px,
y: px,
z: px,
perspective: px,
transformPerspective: px,
opacity: alpha,
originX: progressPercentage,
originY: progressPercentage,
originZ: px,
};
export { transformValueTypes };
//# sourceMappingURL=transform.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"transform.mjs","sources":["../../../../../src/value/types/maps/transform.ts"],"sourcesContent":["import { alpha, scale } from \"../numbers\"\nimport { degrees, progressPercentage, px } from \"../numbers/units\"\nimport { ValueTypeMap } from \"./types\"\n\nexport const transformValueTypes: ValueTypeMap = {\n rotate: degrees,\n rotateX: degrees,\n rotateY: degrees,\n rotateZ: degrees,\n scale,\n scaleX: scale,\n scaleY: scale,\n scaleZ: scale,\n skew: degrees,\n skewX: degrees,\n skewY: degrees,\n distance: px,\n translateX: px,\n translateY: px,\n translateZ: px,\n x: px,\n y: px,\n z: px,\n perspective: px,\n transformPerspective: px,\n opacity: alpha,\n originX: progressPercentage,\n originY: progressPercentage,\n originZ: px,\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,GAAiB;AAC7C,IAAA,MAAM,EAAE,OAAO;AACf,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,OAAO,EAAE,OAAO;IAChB,KAAK;AACL,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,IAAI,EAAE,OAAO;AACb,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,QAAQ,EAAE,EAAE;AACZ,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,oBAAoB,EAAE,EAAE;AACxB,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,OAAO,EAAE,kBAAkB;AAC3B,IAAA,OAAO,EAAE,kBAAkB;AAC3B,IAAA,OAAO,EAAE,EAAE;;;;;"}

View File

@@ -0,0 +1,18 @@
import { clamp } from 'motion-utils';
const number = {
test: (v) => typeof v === "number",
parse: parseFloat,
transform: (v) => v,
};
const alpha = {
...number,
transform: (v) => clamp(0, 1, v),
};
const scale = {
...number,
default: 1,
};
export { alpha, number, scale };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../src/value/types/numbers/index.ts"],"sourcesContent":["import { clamp } from \"motion-utils\"\n\nexport const number = {\n test: (v: number) => typeof v === \"number\",\n parse: parseFloat,\n transform: (v: number) => v,\n}\n\nexport const alpha = {\n ...number,\n transform: (v: number) => clamp(0, 1, v),\n}\n\nexport const scale = {\n ...number,\n default: 1,\n}\n"],"names":[],"mappings":";;AAEO,MAAM,MAAM,GAAG;IAClB,IAAI,EAAE,CAAC,CAAS,KAAK,OAAO,CAAC,KAAK,QAAQ;AAC1C,IAAA,KAAK,EAAE,UAAU;AACjB,IAAA,SAAS,EAAE,CAAC,CAAS,KAAK,CAAC;;AAGxB,MAAM,KAAK,GAAG;AACjB,IAAA,GAAG,MAAM;AACT,IAAA,SAAS,EAAE,CAAC,CAAS,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;;AAGrC,MAAM,KAAK,GAAG;AACjB,IAAA,GAAG,MAAM;AACT,IAAA,OAAO,EAAE,CAAC;;;;;"}

View File

@@ -0,0 +1,19 @@
/*#__NO_SIDE_EFFECTS__*/
const createUnitType = (unit) => ({
test: (v) => typeof v === "string" && v.endsWith(unit) && v.split(" ").length === 1,
parse: parseFloat,
transform: (v) => `${v}${unit}`,
});
const degrees = /*@__PURE__*/ createUnitType("deg");
const percent = /*@__PURE__*/ createUnitType("%");
const px = /*@__PURE__*/ createUnitType("px");
const vh = /*@__PURE__*/ createUnitType("vh");
const vw = /*@__PURE__*/ createUnitType("vw");
const progressPercentage = /*@__PURE__*/ (() => ({
...percent,
parse: (v) => percent.parse(v) / 100,
transform: (v) => percent.transform(v * 100),
}))();
export { degrees, percent, progressPercentage, px, vh, vw };
//# sourceMappingURL=units.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"units.mjs","sources":["../../../../../src/value/types/numbers/units.ts"],"sourcesContent":["import { AnyResolvedKeyframe } from \"../../../animation/types\"\n\n/*#__NO_SIDE_EFFECTS__*/\nconst createUnitType = (unit: string) => ({\n test: (v: AnyResolvedKeyframe) =>\n typeof v === \"string\" && v.endsWith(unit) && v.split(\" \").length === 1,\n parse: parseFloat,\n transform: (v: number | string) => `${v}${unit}`,\n})\n\nexport const degrees = /*@__PURE__*/ createUnitType(\"deg\")\nexport const percent = /*@__PURE__*/ createUnitType(\"%\")\nexport const px = /*@__PURE__*/ createUnitType(\"px\")\nexport const vh = /*@__PURE__*/ createUnitType(\"vh\")\nexport const vw = /*@__PURE__*/ createUnitType(\"vw\")\n\nexport const progressPercentage = /*@__PURE__*/ (() => ({\n ...percent,\n parse: (v: string) => percent.parse(v) / 100,\n transform: (v: number) => percent.transform(v * 100),\n}))()\n"],"names":[],"mappings":"AAEA;AACA,MAAM,cAAc,GAAG,CAAC,IAAY,MAAM;IACtC,IAAI,EAAE,CAAC,CAAsB,KACzB,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC;AAC1E,IAAA,KAAK,EAAE,UAAU;IACjB,SAAS,EAAE,CAAC,CAAkB,KAAK,CAAA,EAAG,CAAC,CAAA,EAAG,IAAI,CAAA,CAAE;AACnD,CAAA,CAAC;AAEK,MAAM,OAAO,iBAAiB,cAAc,CAAC,KAAK;AAClD,MAAM,OAAO,iBAAiB,cAAc,CAAC,GAAG;AAChD,MAAM,EAAE,iBAAiB,cAAc,CAAC,IAAI;AAC5C,MAAM,EAAE,iBAAiB,cAAc,CAAC,IAAI;AAC5C,MAAM,EAAE,iBAAiB,cAAc,CAAC,IAAI;AAE5C,MAAM,kBAAkB,iBAAiB,CAAC,OAAO;AACpD,IAAA,GAAG,OAAO;AACV,IAAA,KAAK,EAAE,CAAC,CAAS,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG;AAC5C,IAAA,SAAS,EAAE,CAAC,CAAS,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC;CACvD,CAAC;;;;"}

7
node_modules/motion-dom/dist/es/value/types/test.mjs generated vendored Normal file
View File

@@ -0,0 +1,7 @@
/**
* Tests a provided value against a ValueType
*/
const testValueType = (v) => (type) => type.test(v);
export { testValueType };
//# sourceMappingURL=test.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"test.mjs","sources":["../../../../src/value/types/test.ts"],"sourcesContent":["import { ValueType } from \"./types\"\n\n/**\n * Tests a provided value against a ValueType\n */\nexport const testValueType = (v: any) => (type: ValueType) => type.test(v)\n"],"names":[],"mappings":"AAEA;;AAEG;MACU,aAAa,GAAG,CAAC,CAAM,KAAK,CAAC,IAAe,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC;;;;"}

View File

@@ -0,0 +1,18 @@
import { complex } from '../complex/index.mjs';
import { filter } from '../complex/filter.mjs';
import { mask } from '../complex/mask.mjs';
import { getDefaultValueType } from '../maps/defaults.mjs';
const customTypes = /*@__PURE__*/ new Set([filter, mask]);
function getAnimatableNone(key, value) {
let defaultValueType = getDefaultValueType(key);
if (!customTypes.has(defaultValueType))
defaultValueType = complex;
// If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
return defaultValueType.getAnimatableNone
? defaultValueType.getAnimatableNone(value)
: undefined;
}
export { getAnimatableNone };
//# sourceMappingURL=animatable-none.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"animatable-none.mjs","sources":["../../../../../src/value/types/utils/animatable-none.ts"],"sourcesContent":["import { complex } from \"../complex\"\nimport { filter } from \"../complex/filter\"\nimport { mask } from \"../complex/mask\"\nimport { getDefaultValueType } from \"../maps/defaults\"\n\nconst customTypes = /*@__PURE__*/ new Set([filter, mask])\n\nexport function getAnimatableNone(key: string, value: string) {\n let defaultValueType = getDefaultValueType(key)\n if (!customTypes.has(defaultValueType as any)) defaultValueType = complex\n // If value is not recognised as animatable, ie \"none\", create an animatable version origin based on the target\n return defaultValueType.getAnimatableNone\n ? defaultValueType.getAnimatableNone(value)\n : undefined\n}\n"],"names":[],"mappings":";;;;;AAKA,MAAM,WAAW,iBAAiB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAEnD,SAAU,iBAAiB,CAAC,GAAW,EAAE,KAAa,EAAA;AACxD,IAAA,IAAI,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,CAAC;AAC/C,IAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAuB,CAAC;QAAE,gBAAgB,GAAG,OAAO;;IAEzE,OAAO,gBAAgB,CAAC;AACpB,UAAE,gBAAgB,CAAC,iBAAiB,CAAC,KAAK;UACxC,SAAS;AACnB;;;;"}

View File

@@ -0,0 +1,4 @@
const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
export { colorRegex };
//# sourceMappingURL=color-regex.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"color-regex.mjs","sources":["../../../../../src/value/types/utils/color-regex.ts"],"sourcesContent":["export const colorRegex =\n /(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))/giu\n"],"names":[],"mappings":"AAAO,MAAM,UAAU,GACnB;;;;"}

View File

@@ -0,0 +1,16 @@
import { color } from '../color/index.mjs';
import { complex } from '../complex/index.mjs';
import { dimensionValueTypes } from '../dimensions.mjs';
import { testValueType } from '../test.mjs';
/**
* A list of all ValueTypes
*/
const valueTypes = [...dimensionValueTypes, color, complex];
/**
* Tests a value against the list of ValueTypes
*/
const findValueType = (v) => valueTypes.find(testValueType(v));
export { findValueType };
//# sourceMappingURL=find.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"find.mjs","sources":["../../../../../src/value/types/utils/find.ts"],"sourcesContent":["import { color } from \"../color\"\nimport { complex } from \"../complex\"\nimport { dimensionValueTypes } from \"../dimensions\"\nimport { testValueType } from \"../test\"\n\n/**\n * A list of all ValueTypes\n */\nconst valueTypes = [...dimensionValueTypes, color, complex]\n\n/**\n * Tests a value against the list of ValueTypes\n */\nexport const findValueType = (v: any) => valueTypes.find(testValueType(v))\n"],"names":[],"mappings":";;;;;AAKA;;AAEG;AACH,MAAM,UAAU,GAAG,CAAC,GAAG,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC;AAE3D;;AAEG;AACI,MAAM,aAAa,GAAG,CAAC,CAAM,KAAK,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;;;;"}

View File

@@ -0,0 +1,4 @@
const floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
export { floatRegex };
//# sourceMappingURL=float-regex.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"float-regex.mjs","sources":["../../../../../src/value/types/utils/float-regex.ts"],"sourcesContent":["export const floatRegex = /-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)/gu\n"],"names":[],"mappings":"AAAO,MAAM,UAAU,GAAG;;;;"}

View File

@@ -0,0 +1,11 @@
/**
* Provided a value and a ValueType, returns the value as that value type.
*/
const getValueAsType = (value, type) => {
return type && typeof value === "number"
? type.transform(value)
: value;
};
export { getValueAsType };
//# sourceMappingURL=get-as-type.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"get-as-type.mjs","sources":["../../../../../src/value/types/utils/get-as-type.ts"],"sourcesContent":["import { ValueType } from \"../types\"\n\n/**\n * Provided a value and a ValueType, returns the value as that value type.\n */\nexport const getValueAsType = (value: any, type?: ValueType) => {\n return type && typeof value === \"number\"\n ? (type as any).transform(value)\n : value\n}\n"],"names":[],"mappings":"AAEA;;AAEG;MACU,cAAc,GAAG,CAAC,KAAU,EAAE,IAAgB,KAAI;AAC3D,IAAA,OAAO,IAAI,IAAI,OAAO,KAAK,KAAK;AAC5B,UAAG,IAAY,CAAC,SAAS,CAAC,KAAK;UAC7B,KAAK;AACf;;;;"}

View File

@@ -0,0 +1,6 @@
function isNullish(v) {
return v == null;
}
export { isNullish };
//# sourceMappingURL=is-nullish.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"is-nullish.mjs","sources":["../../../../../src/value/types/utils/is-nullish.ts"],"sourcesContent":["export function isNullish(v: any): v is null | undefined {\n return v == null\n}\n"],"names":[],"mappings":"AAAM,SAAU,SAAS,CAAC,CAAM,EAAA;IAC5B,OAAO,CAAC,IAAI,IAAI;AACpB;;;;"}

View File

@@ -0,0 +1,6 @@
// If this number is a decimal, make it just five decimal places
// to avoid exponents
const sanitize = (v) => Math.round(v * 100000) / 100000;
export { sanitize };
//# sourceMappingURL=sanitize.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sanitize.mjs","sources":["../../../../../src/value/types/utils/sanitize.ts"],"sourcesContent":["// If this number is a decimal, make it just five decimal places\n// to avoid exponents\nexport const sanitize = (v: number) => Math.round(v * 100000) / 100000\n"],"names":[],"mappings":"AAAA;AACA;AACO,MAAM,QAAQ,GAAG,CAAC,CAAS,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG;;;;"}

View File

@@ -0,0 +1,4 @@
const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
export { singleColorRegex };
//# sourceMappingURL=single-color-regex.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"single-color-regex.mjs","sources":["../../../../../src/value/types/utils/single-color-regex.ts"],"sourcesContent":["export const singleColorRegex =\n /^(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))$/iu\n"],"names":[],"mappings":"AAAO,MAAM,gBAAgB,GACzB;;;;"}

View File

@@ -0,0 +1,4 @@
const isMotionValue = (value) => Boolean(value && value.getVelocity);
export { isMotionValue };
//# sourceMappingURL=is-motion-value.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"is-motion-value.mjs","sources":["../../../../src/value/utils/is-motion-value.ts"],"sourcesContent":["import type { MotionValue } from \"..\"\n\nexport const isMotionValue = (value: any): value is MotionValue =>\n Boolean(value && value.getVelocity)\n"],"names":[],"mappings":"AAEO,MAAM,aAAa,GAAG,CAAC,KAAU,KACpC,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,WAAW;;;;"}

View File

@@ -0,0 +1,11 @@
import { isMotionValue } from './is-motion-value.mjs';
/**
* If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
*/
function resolveMotionValue(value) {
return isMotionValue(value) ? value.get() : value;
}
export { resolveMotionValue };
//# sourceMappingURL=resolve-motion-value.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"resolve-motion-value.mjs","sources":["../../../../src/value/utils/resolve-motion-value.ts"],"sourcesContent":["import type { AnyResolvedKeyframe } from \"../../animation/types\"\nimport { isMotionValue } from \"./is-motion-value\"\nimport type { MotionValue } from \"../index\"\n\n/**\n * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself\n */\nexport function resolveMotionValue(\n value?: AnyResolvedKeyframe | MotionValue\n): AnyResolvedKeyframe {\n return isMotionValue(value) ? value.get() : value\n}\n"],"names":[],"mappings":";;AAIA;;AAEG;AACG,SAAU,kBAAkB,CAC9B,KAAyC,EAAA;AAEzC,IAAA,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,GAAG,KAAK;AACrD;;;;"}

View File

@@ -0,0 +1,21 @@
import { MotionGlobalConfig } from 'motion-utils';
import { isWillChangeMotionValue } from './is.mjs';
function addValueToWillChange(visualElement, key) {
const willChange = visualElement.getValue("willChange");
/**
* It could be that a user has set willChange to a regular MotionValue,
* in which case we can't add the value to it.
*/
if (isWillChangeMotionValue(willChange)) {
return willChange.add(key);
}
else if (!willChange && MotionGlobalConfig.WillChange) {
const newWillChange = new MotionGlobalConfig.WillChange("auto");
visualElement.addValue("willChange", newWillChange);
newWillChange.add(key);
}
}
export { addValueToWillChange };
//# sourceMappingURL=add-will-change.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"add-will-change.mjs","sources":["../../../../src/value/will-change/add-will-change.ts"],"sourcesContent":["import { MotionGlobalConfig } from \"motion-utils\"\nimport type { VisualElement } from \"../../render/VisualElement\"\nimport { isWillChangeMotionValue } from \"./is\"\n\nexport function addValueToWillChange(\n visualElement: VisualElement,\n key: string\n) {\n const willChange = visualElement.getValue(\"willChange\")\n\n /**\n * It could be that a user has set willChange to a regular MotionValue,\n * in which case we can't add the value to it.\n */\n if (isWillChangeMotionValue(willChange)) {\n return willChange.add(key)\n } else if (!willChange && MotionGlobalConfig.WillChange) {\n const newWillChange = new MotionGlobalConfig.WillChange(\"auto\")\n\n visualElement.addValue(\"willChange\", newWillChange)\n newWillChange.add(key)\n }\n}\n"],"names":[],"mappings":";;;AAIM,SAAU,oBAAoB,CAChC,aAA4B,EAC5B,GAAW,EAAA;IAEX,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC;AAEvD;;;AAGG;AACH,IAAA,IAAI,uBAAuB,CAAC,UAAU,CAAC,EAAE;AACrC,QAAA,OAAO,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;IAC9B;AAAO,SAAA,IAAI,CAAC,UAAU,IAAI,kBAAkB,CAAC,UAAU,EAAE;QACrD,MAAM,aAAa,GAAG,IAAI,kBAAkB,CAAC,UAAU,CAAC,MAAM,CAAC;AAE/D,QAAA,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;AACnD,QAAA,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC;IAC1B;AACJ;;;;"}

View File

@@ -0,0 +1,8 @@
import { isMotionValue } from '../utils/is-motion-value.mjs';
function isWillChangeMotionValue(value) {
return Boolean(isMotionValue(value) && value.add);
}
export { isWillChangeMotionValue };
//# sourceMappingURL=is.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"is.mjs","sources":["../../../../src/value/will-change/is.ts"],"sourcesContent":["import { isMotionValue } from \"../utils/is-motion-value\"\nimport type { WillChange } from \"./types\"\n\nexport function isWillChangeMotionValue(value: any): value is WillChange {\n return Boolean(isMotionValue(value) && (value as WillChange).add)\n}\n"],"names":[],"mappings":";;AAGM,SAAU,uBAAuB,CAAC,KAAU,EAAA;IAC9C,OAAO,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,IAAK,KAAoB,CAAC,GAAG,CAAC;AACrE;;;;"}