BOC v1.0: RS256 auth, Ledger integration, Prometheus metrics, CI/CD, backup

This commit is contained in:
Bernt
2026-07-28 23:08:32 +00:00
parent 0b4f160af1
commit af874040ca
11541 changed files with 1654104 additions and 1103 deletions
+27
View File
@@ -0,0 +1,27 @@
class WithPromise {
constructor() {
this.updateFinished();
}
get finished() {
return this._finished;
}
updateFinished() {
this._finished = new Promise((resolve) => {
this.resolve = resolve;
});
}
notifyFinished() {
this.resolve();
}
/**
* Allows the animation to be awaited.
*
* @deprecated Use `finished` instead.
*/
then(onResolve, onReject) {
return this.finished.then(onResolve, onReject);
}
}
export { WithPromise };
//# sourceMappingURL=WithPromise.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"WithPromise.mjs","sources":["../../../../src/animation/utils/WithPromise.ts"],"sourcesContent":["export class WithPromise {\n protected _finished: Promise<void>\n\n resolve: VoidFunction\n\n constructor() {\n this.updateFinished()\n }\n\n get finished() {\n return this._finished\n }\n\n protected updateFinished() {\n this._finished = new Promise<void>((resolve) => {\n this.resolve = resolve\n })\n }\n\n protected notifyFinished() {\n this.resolve()\n }\n\n /**\n * Allows the animation to be awaited.\n *\n * @deprecated Use `finished` instead.\n */\n then(onResolve: VoidFunction, onReject?: VoidFunction) {\n return this.finished.then(onResolve, onReject)\n }\n}\n"],"names":[],"mappings":"MAAa,WAAW,CAAA;AAKpB,IAAA,WAAA,GAAA;QACI,IAAI,CAAC,cAAc,EAAE;IACzB;AAEA,IAAA,IAAI,QAAQ,GAAA;QACR,OAAO,IAAI,CAAC,SAAS;IACzB;IAEU,cAAc,GAAA;QACpB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,KAAI;AAC3C,YAAA,IAAI,CAAC,OAAO,GAAG,OAAO;AAC1B,QAAA,CAAC,CAAC;IACN;IAEU,cAAc,GAAA;QACpB,IAAI,CAAC,OAAO,EAAE;IAClB;AAEA;;;;AAIG;IACH,IAAI,CAAC,SAAuB,EAAE,QAAuB,EAAA;QACjD,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;IAClD;AACH;;;;"}
@@ -0,0 +1,13 @@
const animationMaps = new WeakMap();
const animationMapKey = (name, pseudoElement = "") => `${name}:${pseudoElement}`;
function getAnimationMap(element) {
let map = animationMaps.get(element);
if (!map) {
map = new Map();
animationMaps.set(element, map);
}
return map;
}
export { animationMapKey, getAnimationMap };
//# sourceMappingURL=active-animations.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"active-animations.mjs","sources":["../../../../src/animation/utils/active-animations.ts"],"sourcesContent":["import { NativeAnimation } from \"../NativeAnimation\"\nimport { AnyResolvedKeyframe } from \"../types\"\n\nconst animationMaps = new WeakMap<\n Element,\n Map<string, NativeAnimation<AnyResolvedKeyframe>>\n>()\nexport const animationMapKey = (name: string, pseudoElement: string = \"\") =>\n `${name}:${pseudoElement}`\n\nexport function getAnimationMap(element: Element) {\n let map = animationMaps.get(element)\n if (!map) {\n map = new Map()\n animationMaps.set(element, map)\n }\n return map\n}\n"],"names":[],"mappings":"AAGA,MAAM,aAAa,GAAG,IAAI,OAAO,EAG9B;AACI,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,aAAA,GAAwB,EAAE,KACpE,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,aAAa;AAEtB,SAAU,eAAe,CAAC,OAAgB,EAAA;IAC5C,IAAI,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;IACpC,IAAI,CAAC,GAAG,EAAE;AACN,QAAA,GAAG,GAAG,IAAI,GAAG,EAAE;AACf,QAAA,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC;IACnC;AACA,IAAA,OAAO,GAAG;AACd;;;;"}
+188
View File
@@ -0,0 +1,188 @@
import { wrap } from 'motion-utils';
import { motionValue } from '../../value/index.mjs';
import { animateMotionValue } from '../interfaces/motion-value.mjs';
import { getValueTransition } from './get-value-transition.mjs';
const MIN_LAYOUT_DISTANCE = 20;
function bezierPoint(t, origin, control, target) {
const inv = 1 - t;
return inv * inv * origin + 2 * inv * t * control + t * t * target;
}
function bezierTangentAngle(t, originX, controlX, targetX, originY, controlY, targetY) {
const dx = 2 * (1 - t) * (controlX - originX) + 2 * t * (targetX - controlX);
const dy = 2 * (1 - t) * (controlY - originY) + 2 * t * (targetY - controlY);
return Math.atan2(dy, dx) * (180 / Math.PI);
}
function computeArcControlPoint(fromX, fromY, toX, toY, strength, peak) {
const deltaX = toX - fromX;
const deltaY = toY - fromY;
const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
if (distance > 0) {
const normalPerpX = -deltaY / distance;
const normalPerpY = deltaX / distance;
const desiredHeight = strength * distance;
return {
x: fromX + deltaX * peak + normalPerpX * desiredHeight,
y: fromY + deltaY * peak + normalPerpY * desiredHeight,
};
}
return { x: fromX, y: fromY };
}
/**
* The pure sampling factory: `(from, to) => (t) => point`. Internal —
* used by {@link arc} and the unit tests. Not part of the public surface.
*/
function createArcPath({ strength = 0.5, peak = 0.5, direction, rotate = false, } = {}) {
const rotationScale = rotate === true ? 1 : typeof rotate === "number" ? rotate : 0;
// Auto-direction only: persists across calls to flip the bulge back
// onto the same screen side when the dominant axis changes between
// calls. Reuse the factory (module scope / useMemo) to keep this alive.
let prevBulgeSign;
const createInterpolator = (from, to) => {
const dx = to.x - from.x;
const dy = to.y - from.y;
let signed;
if (direction === "cw") {
signed = -strength;
}
else if (direction === "ccw") {
signed = strength;
}
else {
const dom = Math.abs(dx) >= Math.abs(dy) ? dx : dy;
signed = dom < 0 ? -strength : strength;
}
let control = computeArcControlPoint(from.x, from.y, to.x, to.y, signed, peak);
if (direction === undefined) {
const isVertical = Math.abs(dx) < Math.abs(dy);
const midX = from.x + dx * peak;
const midY = from.y + dy * peak;
const bulgeSign = isVertical
? Math.sign(control.x - midX)
: Math.sign(control.y - midY);
if (prevBulgeSign !== undefined &&
bulgeSign !== 0 &&
bulgeSign !== prevBulgeSign) {
signed = -signed;
control = computeArcControlPoint(from.x, from.y, to.x, to.y, signed, peak);
}
else if (bulgeSign !== 0) {
prevBulgeSign = bulgeSign;
}
}
const tangent0 = rotationScale
? bezierTangentAngle(0, from.x, control.x, to.x, from.y, control.y, to.y)
: 0;
const tangent1 = rotationScale
? bezierTangentAngle(1, from.x, control.x, to.x, from.y, control.y, to.y)
: 0;
const tangentDelta = rotationScale
? wrap(-180, 180, tangent1 - tangent0)
: 0;
return (t) => {
const out = {
x: bezierPoint(t, from.x, control.x, to.x),
y: bezierPoint(t, from.y, control.y, to.y),
};
if (rotationScale) {
const raw = bezierTangentAngle(t, from.x, control.x, to.x, from.y, control.y, to.y);
const baseline = tangent0 + tangentDelta * t;
out.rotate = wrap(-180, 180, raw - baseline) * rotationScale;
}
return out;
};
};
return createInterpolator;
}
/**
* Creates a curved path for `transition.path`:
*
* ```ts
* <motion.div animate={{ x: 200, y: 100 }} transition={{ path: arc() }} />
* ```
*
* Reuse the returned value (module scope / useMemo / useRef) so its
* continuity closure survives re-renders — a fresh `arc()` has no memory.
*/
function arc(options = {}) {
const sample = createArcPath(options);
const path = {
interpolateProjection(delta) {
// `from` is the current translate offset (carries any in-flight
// displacement when interrupted); `to` is the new layout origin.
// The distance floor avoids visible wobble on tiny shifts.
const tx = delta.x.translate;
const ty = delta.y.translate;
if (Math.sqrt(tx * tx + ty * ty) < MIN_LAYOUT_DISTANCE) {
return undefined;
}
return sample({ x: tx, y: ty }, { x: 0, y: 0 });
},
animateVisualElement(visualElement, target, transition, delay, animations) {
if (!("x" in target || "y" in target))
return;
const xValue = visualElement.getValue("x", visualElement.latestValues["x"] ?? 0);
const yValue = visualElement.getValue("y", visualElement.latestValues["y"] ?? 0);
const xRaw = target.x;
const yRaw = target.y;
const xFrom = (Array.isArray(xRaw) && xRaw[0] != null
? xRaw[0]
: xValue?.get()) ?? 0;
const yFrom = (Array.isArray(yRaw) && yRaw[0] != null
? yRaw[0]
: yValue?.get()) ?? 0;
const xTo = (Array.isArray(xRaw)
? xRaw[xRaw.length - 1]
: xRaw ?? xFrom);
const yTo = (Array.isArray(yRaw)
? yRaw[yRaw.length - 1]
: yRaw ?? yFrom);
// Interruption needs no flag: x/y already hold the displaced
// mid-arc position, so xFrom/yFrom carry the continuity geometry.
const interpolate = sample({ x: xFrom, y: yFrom }, { x: xTo, y: yTo });
// Drive a dedicated `pathRotation` value (composed onto `rotate`
// at the build sites) rather than `rotate` itself, so a
// concurrent rotate animation composes and nothing accumulates
// on interrupt.
const pathRotationValue = interpolate(0).rotate !== undefined
? visualElement.getValue("pathRotation", 0)
: undefined;
const pathTransition = {
delay,
...getValueTransition(transition || {}, "x"),
};
delete pathTransition.path;
const progress = motionValue(0);
progress.start(animateMotionValue("", progress, [0, 1000], {
...pathTransition,
isSync: true,
velocity: 0,
onUpdate: (latest) => {
const point = interpolate(latest / 1000);
xValue?.set(point.x);
yValue?.set(point.y);
if (pathRotationValue && point.rotate !== undefined) {
pathRotationValue.set(point.rotate);
}
},
onComplete: () => {
xValue?.set(xTo);
yValue?.set(yTo);
pathRotationValue?.set(0);
},
// Interrupt/cancel must clear our additive contribution
// so it can't linger on top of the user's `rotate`.
onStop: () => pathRotationValue?.set(0),
onCancel: () => pathRotationValue?.set(0),
}));
if (progress.animation)
animations.push(progress.animation);
delete target.x;
delete target.y;
},
};
return path;
}
export { arc, createArcPath };
//# sourceMappingURL=arc.mjs.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,16 @@
function calcChildStagger(children, child, delayChildren, staggerChildren = 0, staggerDirection = 1) {
const index = Array.from(children)
.sort((a, b) => a.sortNodePosition(b))
.indexOf(child);
const numChildren = children.size;
const maxStaggerDuration = (numChildren - 1) * staggerChildren;
const delayIsFunction = typeof delayChildren === "function";
return delayIsFunction
? delayChildren(index, numChildren)
: staggerDirection === 1
? index * staggerChildren
: maxStaggerDuration - index * staggerChildren;
}
export { calcChildStagger };
//# sourceMappingURL=calc-child-stagger.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"calc-child-stagger.mjs","sources":["../../../../src/animation/utils/calc-child-stagger.ts"],"sourcesContent":["import type { DynamicOption } from \"../types\"\nimport type { VisualElement } from \"../../render/VisualElement\"\n\nexport function calcChildStagger(\n children: Set<VisualElement>,\n child: VisualElement,\n delayChildren?: number | DynamicOption<number>,\n staggerChildren: number = 0,\n staggerDirection: number = 1\n): number {\n const index = Array.from(children)\n .sort((a, b) => a.sortNodePosition(b))\n .indexOf(child)\n const numChildren = children.size\n const maxStaggerDuration = (numChildren - 1) * staggerChildren\n const delayIsFunction = typeof delayChildren === \"function\"\n\n return delayIsFunction\n ? delayChildren(index, numChildren)\n : staggerDirection === 1\n ? index * staggerChildren\n : maxStaggerDuration - index * staggerChildren\n}\n"],"names":[],"mappings":"AAGM,SAAU,gBAAgB,CAC5B,QAA4B,EAC5B,KAAoB,EACpB,aAA8C,EAC9C,eAAA,GAA0B,CAAC,EAC3B,mBAA2B,CAAC,EAAA;AAE5B,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ;AAC5B,SAAA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;SACpC,OAAO,CAAC,KAAK,CAAC;AACnB,IAAA,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI;IACjC,MAAM,kBAAkB,GAAG,CAAC,WAAW,GAAG,CAAC,IAAI,eAAe;AAC9D,IAAA,MAAM,eAAe,GAAG,OAAO,aAAa,KAAK,UAAU;AAE3D,IAAA,OAAO;AACH,UAAE,aAAa,CAAC,KAAK,EAAE,WAAW;UAChC,gBAAgB,KAAK;cACrB,KAAK,GAAG;AACV,cAAE,kBAAkB,GAAG,KAAK,GAAG,eAAe;AACtD;;;;"}
+44
View File
@@ -0,0 +1,44 @@
import { warning } from 'motion-utils';
import { isGenerator } from '../generators/utils/is-generator.mjs';
import { isAnimatable } from './is-animatable.mjs';
function hasKeyframesChanged(keyframes) {
const current = keyframes[0];
if (keyframes.length === 1)
return true;
for (let i = 0; i < keyframes.length; i++) {
if (keyframes[i] !== current)
return true;
}
}
function canAnimate(keyframes, name, type, velocity) {
/**
* Check if we're able to animate between the start and end keyframes,
* and throw a warning if we're attempting to animate between one that's
* animatable and another that isn't.
*/
const originKeyframe = keyframes[0];
if (originKeyframe === null) {
return false;
}
/**
* These aren't traditionally animatable but we do support them.
* In future we could look into making this more generic or replacing
* this function with mix() === mixImmediate
*/
if (name === "display" || name === "visibility")
return true;
const targetKeyframe = keyframes[keyframes.length - 1];
const isOriginAnimatable = isAnimatable(originKeyframe, name);
const isTargetAnimatable = isAnimatable(targetKeyframe, name);
warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". "${isOriginAnimatable ? targetKeyframe : originKeyframe}" is not an animatable value.`, "value-not-animatable");
// Always skip if any of these are true
if (!isOriginAnimatable || !isTargetAnimatable) {
return false;
}
return (hasKeyframesChanged(keyframes) ||
((type === "spring" || isGenerator(type)) && velocity));
}
export { canAnimate };
//# sourceMappingURL=can-animate.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"can-animate.mjs","sources":["../../../../src/animation/utils/can-animate.ts"],"sourcesContent":["import { warning } from \"motion-utils\"\nimport { isGenerator } from \"../generators/utils/is-generator\"\nimport { ResolvedKeyframes } from \"../keyframes/KeyframesResolver\"\nimport { AnimationGeneratorType } from \"../types\"\nimport { isAnimatable } from \"./is-animatable\"\n\nfunction hasKeyframesChanged(keyframes: ResolvedKeyframes<any>) {\n const current = keyframes[0]\n if (keyframes.length === 1) return true\n for (let i = 0; i < keyframes.length; i++) {\n if (keyframes[i] !== current) return true\n }\n}\n\nexport function canAnimate(\n keyframes: ResolvedKeyframes<any>,\n name?: string,\n type?: AnimationGeneratorType,\n velocity?: number\n) {\n /**\n * Check if we're able to animate between the start and end keyframes,\n * and throw a warning if we're attempting to animate between one that's\n * animatable and another that isn't.\n */\n const originKeyframe = keyframes[0]\n if (originKeyframe === null) {\n return false\n }\n\n /**\n * These aren't traditionally animatable but we do support them.\n * In future we could look into making this more generic or replacing\n * this function with mix() === mixImmediate\n */\n if (name === \"display\" || name === \"visibility\") return true\n\n const targetKeyframe = keyframes[keyframes.length - 1]\n const isOriginAnimatable = isAnimatable(originKeyframe, name)\n const isTargetAnimatable = isAnimatable(targetKeyframe, name)\n\n warning(\n isOriginAnimatable === isTargetAnimatable,\n `You are trying to animate ${name} from \"${originKeyframe}\" to \"${targetKeyframe}\". \"${\n isOriginAnimatable ? targetKeyframe : originKeyframe\n }\" is not an animatable value.`,\n \"value-not-animatable\"\n )\n\n // Always skip if any of these are true\n if (!isOriginAnimatable || !isTargetAnimatable) {\n return false\n }\n\n return (\n hasKeyframesChanged(keyframes) ||\n ((type === \"spring\" || isGenerator(type)) && velocity)\n )\n}\n"],"names":[],"mappings":";;;;AAMA,SAAS,mBAAmB,CAAC,SAAiC,EAAA;AAC1D,IAAA,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC;AAC5B,IAAA,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,IAAI;AACvC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACvC,QAAA,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,OAAO;AAAE,YAAA,OAAO,IAAI;IAC7C;AACJ;AAEM,SAAU,UAAU,CACtB,SAAiC,EACjC,IAAa,EACb,IAA6B,EAC7B,QAAiB,EAAA;AAEjB;;;;AAIG;AACH,IAAA,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC;AACnC,IAAA,IAAI,cAAc,KAAK,IAAI,EAAE;AACzB,QAAA,OAAO,KAAK;IAChB;AAEA;;;;AAIG;AACH,IAAA,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,YAAY;AAAE,QAAA,OAAO,IAAI;IAE5D,MAAM,cAAc,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IACtD,MAAM,kBAAkB,GAAG,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC;IAC7D,MAAM,kBAAkB,GAAG,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC;IAE7D,OAAO,CACH,kBAAkB,KAAK,kBAAkB,EACzC,6BAA6B,IAAI,CAAA,OAAA,EAAU,cAAc,CAAA,MAAA,EAAS,cAAc,CAAA,IAAA,EAC5E,kBAAkB,GAAG,cAAc,GAAG,cAC1C,CAAA,6BAAA,CAA+B,EAC/B,sBAAsB,CACzB;;AAGD,IAAA,IAAI,CAAC,kBAAkB,IAAI,CAAC,kBAAkB,EAAE;AAC5C,QAAA,OAAO,KAAK;IAChB;AAEA,IAAA,QACI,mBAAmB,CAAC,SAAS,CAAC;AAC9B,SAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC;AAE9D;;;;"}
@@ -0,0 +1,42 @@
import { invariant, isNumericalString } from 'motion-utils';
import { isCSSVariableToken } from './is-css-variable.mjs';
/**
* Parse Framer's special CSS variable format into a CSS token and a fallback.
*
* ```
* `var(--foo, #fff)` => [`--foo`, '#fff']
* ```
*
* @param current
*/
const splitCSSVariableRegex =
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;
function parseCSSVariable(current) {
const match = splitCSSVariableRegex.exec(current);
if (!match)
return [,];
const [, token1, token2, fallback] = match;
return [`--${token1 ?? token2}`, fallback];
}
const maxDepth = 4;
function getVariableValue(current, element, depth = 1) {
invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
const [token, fallback] = parseCSSVariable(current);
// No CSS variable detected
if (!token)
return;
// Attempt to read this CSS variable off the element
const resolved = window.getComputedStyle(element).getPropertyValue(token);
if (resolved) {
const trimmed = resolved.trim();
return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;
}
return isCSSVariableToken(fallback)
? getVariableValue(fallback, element, depth + 1)
: fallback;
}
export { getVariableValue, parseCSSVariable };
//# sourceMappingURL=css-variables-conversion.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"css-variables-conversion.mjs","sources":["../../../../src/animation/utils/css-variables-conversion.ts"],"sourcesContent":["import { invariant, isNumericalString } from \"motion-utils\"\nimport { AnyResolvedKeyframe } from \"../types\"\nimport { CSSVariableToken, isCSSVariableToken } from \"./is-css-variable\"\n\n/**\n * Parse Framer's special CSS variable format into a CSS token and a fallback.\n *\n * ```\n * `var(--foo, #fff)` => [`--foo`, '#fff']\n * ```\n *\n * @param current\n */\n\nconst splitCSSVariableRegex =\n // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words\n /^var\\(--(?:([\\w-]+)|([\\w-]+), ?([a-zA-Z\\d ()%#.,-]+))\\)/u\nexport function parseCSSVariable(current: string) {\n const match = splitCSSVariableRegex.exec(current)\n if (!match) return [,]\n\n const [, token1, token2, fallback] = match\n return [`--${token1 ?? token2}`, fallback]\n}\n\nconst maxDepth = 4\nexport function getVariableValue(\n current: CSSVariableToken,\n element: Element,\n depth = 1\n): AnyResolvedKeyframe | undefined {\n invariant(\n depth <= maxDepth,\n `Max CSS variable fallback depth detected in property \"${current}\". This may indicate a circular fallback dependency.`,\n \"max-css-var-depth\"\n )\n\n const [token, fallback] = parseCSSVariable(current)\n\n // No CSS variable detected\n if (!token) return\n\n // Attempt to read this CSS variable off the element\n const resolved = window.getComputedStyle(element).getPropertyValue(token)\n\n if (resolved) {\n const trimmed = resolved.trim()\n return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed\n }\n\n return isCSSVariableToken(fallback)\n ? getVariableValue(fallback, element, depth + 1)\n : fallback\n}\n"],"names":[],"mappings":";;;AAIA;;;;;;;;AAQG;AAEH,MAAM,qBAAqB;AACvB;AACA,0DAA0D;AACxD,SAAU,gBAAgB,CAAC,OAAe,EAAA;IAC5C,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC;AACjD,IAAA,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG;IAEtB,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,KAAK;IAC1C,OAAO,CAAC,KAAK,MAAM,IAAI,MAAM,CAAA,CAAE,EAAE,QAAQ,CAAC;AAC9C;AAEA,MAAM,QAAQ,GAAG,CAAC;AACZ,SAAU,gBAAgB,CAC5B,OAAyB,EACzB,OAAgB,EAChB,KAAK,GAAG,CAAC,EAAA;IAET,SAAS,CACL,KAAK,IAAI,QAAQ,EACjB,CAAA,sDAAA,EAAyD,OAAO,CAAA,oDAAA,CAAsD,EACtH,mBAAmB,CACtB;IAED,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC;;AAGnD,IAAA,IAAI,CAAC,KAAK;QAAE;;AAGZ,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC;IAEzE,IAAI,QAAQ,EAAE;AACV,QAAA,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE;AAC/B,QAAA,OAAO,iBAAiB,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO;IACrE;IAEA,OAAO,kBAAkB,CAAC,QAAQ;UAC5B,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC;UAC7C,QAAQ;AAClB;;;;"}
@@ -0,0 +1,41 @@
import { transformProps } from '../../render/utils/keys-transform.mjs';
const underDampedSpring = {
type: "spring",
stiffness: 500,
damping: 25,
restSpeed: 10,
};
const criticallyDampedSpring = (target) => ({
type: "spring",
stiffness: 550,
damping: target === 0 ? 2 * Math.sqrt(550) : 30,
restSpeed: 10,
});
const keyframesTransition = {
type: "keyframes",
duration: 0.8,
};
/**
* Default easing curve is a slightly shallower version of
* the default browser easing curve.
*/
const ease = {
type: "keyframes",
ease: [0.25, 0.1, 0.35, 1],
duration: 0.3,
};
const getDefaultTransition = (valueKey, { keyframes }) => {
if (keyframes.length > 2) {
return keyframesTransition;
}
else if (transformProps.has(valueKey)) {
return valueKey.startsWith("scale")
? criticallyDampedSpring(keyframes[1])
: underDampedSpring;
}
return ease;
};
export { getDefaultTransition };
//# sourceMappingURL=default-transitions.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"default-transitions.mjs","sources":["../../../../src/animation/utils/default-transitions.ts"],"sourcesContent":["import { transformProps } from \"../../render/utils/keys-transform\"\nimport type { ValueAnimationOptions } from \"../types\"\n\nconst underDampedSpring: Partial<ValueAnimationOptions> = {\n type: \"spring\",\n stiffness: 500,\n damping: 25,\n restSpeed: 10,\n}\n\nconst criticallyDampedSpring = (\n target: unknown\n): Partial<ValueAnimationOptions> => ({\n type: \"spring\",\n stiffness: 550,\n damping: target === 0 ? 2 * Math.sqrt(550) : 30,\n restSpeed: 10,\n})\n\nconst keyframesTransition: Partial<ValueAnimationOptions> = {\n type: \"keyframes\",\n duration: 0.8,\n}\n\n/**\n * Default easing curve is a slightly shallower version of\n * the default browser easing curve.\n */\nconst ease: Partial<ValueAnimationOptions> = {\n type: \"keyframes\",\n ease: [0.25, 0.1, 0.35, 1],\n duration: 0.3,\n}\n\nexport const getDefaultTransition = (\n valueKey: string,\n { keyframes }: ValueAnimationOptions\n): Partial<ValueAnimationOptions> => {\n if (keyframes.length > 2) {\n return keyframesTransition\n } else if (transformProps.has(valueKey)) {\n return valueKey.startsWith(\"scale\")\n ? criticallyDampedSpring(keyframes[1])\n : underDampedSpring\n }\n\n return ease\n}\n"],"names":[],"mappings":";;AAGA,MAAM,iBAAiB,GAAmC;AACtD,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,SAAS,EAAE,EAAE;CAChB;AAED,MAAM,sBAAsB,GAAG,CAC3B,MAAe,MACmB;AAClC,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,OAAO,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;AAC/C,IAAA,SAAS,EAAE,EAAE;AAChB,CAAA,CAAC;AAEF,MAAM,mBAAmB,GAAmC;AACxD,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,QAAQ,EAAE,GAAG;CAChB;AAED;;;AAGG;AACH,MAAM,IAAI,GAAmC;AACzC,IAAA,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1B,IAAA,QAAQ,EAAE,GAAG;CAChB;AAEM,MAAM,oBAAoB,GAAG,CAChC,QAAgB,EAChB,EAAE,SAAS,EAAyB,KACJ;AAChC,IAAA,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;AACtB,QAAA,OAAO,mBAAmB;IAC9B;AAAO,SAAA,IAAI,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;AACrC,QAAA,OAAO,QAAQ,CAAC,UAAU,CAAC,OAAO;AAC9B,cAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC;cACnC,iBAAiB;IAC3B;AAEA,IAAA,OAAO,IAAI;AACf;;;;"}
@@ -0,0 +1,14 @@
import { resolveTransition } from './resolve-transition.mjs';
function getValueTransition(transition, key) {
const valueTransition = transition?.[key] ??
transition?.["default"] ??
transition;
if (valueTransition !== transition) {
return resolveTransition(valueTransition, transition);
}
return valueTransition;
}
export { getValueTransition };
//# sourceMappingURL=get-value-transition.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"get-value-transition.mjs","sources":["../../../../src/animation/utils/get-value-transition.ts"],"sourcesContent":["import { resolveTransition } from \"./resolve-transition\"\n\nexport function getValueTransition(transition: any, key: string) {\n const valueTransition =\n transition?.[key as keyof typeof transition] ??\n transition?.[\"default\"] ??\n transition\n\n if (valueTransition !== transition) {\n return resolveTransition(valueTransition, transition)\n }\n\n return valueTransition\n}\n"],"names":[],"mappings":";;AAEM,SAAU,kBAAkB,CAAC,UAAe,EAAE,GAAW,EAAA;AAC3D,IAAA,MAAM,eAAe,GACjB,UAAU,GAAG,GAA8B,CAAC;QAC5C,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,UAAU;AAEd,IAAA,IAAI,eAAe,KAAK,UAAU,EAAE;AAChC,QAAA,OAAO,iBAAiB,CAAC,eAAe,EAAE,UAAU,CAAC;IACzD;AAEA,IAAA,OAAO,eAAe;AAC1B;;;;"}
@@ -0,0 +1,31 @@
import { complex } from '../../value/types/complex/index.mjs';
/**
* Check if a value is animatable. Examples:
*
* ✅: 100, "100px", "#fff"
* ❌: "block", "url(2.jpg)"
* @param value
*
* @internal
*/
const isAnimatable = (value, name) => {
// If the list of keys that might be non-animatable grows, replace with Set
if (name === "zIndex")
return false;
// If it's a number or a keyframes array, we can animate it. We might at some point
// need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,
// but for now lets leave it like this for performance reasons
if (typeof value === "number" || Array.isArray(value))
return true;
if (typeof value === "string" && // It's animatable if we have a string
(complex.test(value) || value === "0") && // And it contains numbers and/or colors
!value.startsWith("url(") // Unless it starts with "url("
) {
return true;
}
return false;
};
export { isAnimatable };
//# sourceMappingURL=is-animatable.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"is-animatable.mjs","sources":["../../../../src/animation/utils/is-animatable.ts"],"sourcesContent":["import { complex } from \"../../value/types/complex\"\nimport { ValueKeyframesDefinition } from \"../types\"\n\n/**\n * Check if a value is animatable. Examples:\n *\n * ✅: 100, \"100px\", \"#fff\"\n * ❌: \"block\", \"url(2.jpg)\"\n * @param value\n *\n * @internal\n */\nexport const isAnimatable = (\n value: ValueKeyframesDefinition,\n name?: string\n) => {\n // If the list of keys that might be non-animatable grows, replace with Set\n if (name === \"zIndex\") return false\n\n // If it's a number or a keyframes array, we can animate it. We might at some point\n // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,\n // but for now lets leave it like this for performance reasons\n if (typeof value === \"number\" || Array.isArray(value)) return true\n\n if (\n typeof value === \"string\" && // It's animatable if we have a string\n (complex.test(value) || value === \"0\") && // And it contains numbers and/or colors\n !value.startsWith(\"url(\") // Unless it starts with \"url(\"\n ) {\n return true\n }\n\n return false\n}\n"],"names":[],"mappings":";;AAGA;;;;;;;;AAQG;MACU,YAAY,GAAG,CACxB,KAA+B,EAC/B,IAAa,KACb;;IAEA,IAAI,IAAI,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK;;;;IAKnC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,IAAI;AAElE,IAAA,IACI,OAAO,KAAK,KAAK,QAAQ;AACzB,SAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,GAAG,CAAC;AACtC,QAAA,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;MAC3B;AACE,QAAA,OAAO,IAAI;IACf;AAEA,IAAA,OAAO,KAAK;AAChB;;;;"}
@@ -0,0 +1,27 @@
const checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token);
const isCSSVariableName =
/*@__PURE__*/ checkStringStartsWith("--");
const startsAsVariableToken =
/*@__PURE__*/ checkStringStartsWith("var(--");
const isCSSVariableToken = (value) => {
const startsWithToken = startsAsVariableToken(value);
if (!startsWithToken)
return false;
// Ensure any comments are stripped from the value as this can harm performance of the regex.
return singleCssVariableRegex.test(value.split("/*")[0].trim());
};
const singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
/**
* Check if a value contains a CSS variable anywhere (e.g. inside calc()).
* Unlike isCSSVariableToken which checks if the value IS a var() token,
* this checks if the value CONTAINS var() somewhere in the string.
*/
function containsCSSVariable(value) {
if (typeof value !== "string")
return false;
// Strip comments to avoid false positives
return value.split("/*")[0].includes("var(--");
}
export { containsCSSVariable, isCSSVariableName, isCSSVariableToken };
//# sourceMappingURL=is-css-variable.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"is-css-variable.mjs","sources":["../../../../src/animation/utils/is-css-variable.ts"],"sourcesContent":["import { AnyResolvedKeyframe } from \"../types\"\n\nexport type CSSVariableName = `--${string}`\n\nexport type CSSVariableToken = `var(${CSSVariableName})`\n\nconst checkStringStartsWith =\n <T extends string>(token: string) =>\n (key?: AnyResolvedKeyframe | null): key is T =>\n typeof key === \"string\" && key.startsWith(token)\n\nexport const isCSSVariableName =\n /*@__PURE__*/ checkStringStartsWith<CSSVariableName>(\"--\")\n\nconst startsAsVariableToken =\n /*@__PURE__*/ checkStringStartsWith<CSSVariableToken>(\"var(--\")\nexport const isCSSVariableToken = (\n value?: string\n): value is CSSVariableToken => {\n const startsWithToken = startsAsVariableToken(value)\n\n if (!startsWithToken) return false\n\n // Ensure any comments are stripped from the value as this can harm performance of the regex.\n return singleCssVariableRegex.test(value.split(\"/*\")[0].trim())\n}\n\nconst singleCssVariableRegex =\n /var\\(--(?:[\\w-]+\\s*|[\\w-]+\\s*,(?:\\s*[^)(\\s]|\\s*\\((?:[^)(]|\\([^)(]*\\))*\\))+\\s*)\\)$/iu\n\n/**\n * Check if a value contains a CSS variable anywhere (e.g. inside calc()).\n * Unlike isCSSVariableToken which checks if the value IS a var() token,\n * this checks if the value CONTAINS var() somewhere in the string.\n */\nexport function containsCSSVariable(\n value?: AnyResolvedKeyframe | null\n): boolean {\n if (typeof value !== \"string\") return false\n // Strip comments to avoid false positives\n return value.split(\"/*\")[0].includes(\"var(--\")\n}\n"],"names":[],"mappings":"AAMA,MAAM,qBAAqB,GACvB,CAAmB,KAAa,KAChC,CAAC,GAAgC,KAC7B,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC;MAE3C,iBAAiB;AAC1B,cAAc,qBAAqB,CAAkB,IAAI;AAE7D,MAAM,qBAAqB;AACvB,cAAc,qBAAqB,CAAmB,QAAQ,CAAC;AAC5D,MAAM,kBAAkB,GAAG,CAC9B,KAAc,KACa;AAC3B,IAAA,MAAM,eAAe,GAAG,qBAAqB,CAAC,KAAK,CAAC;AAEpD,IAAA,IAAI,CAAC,eAAe;AAAE,QAAA,OAAO,KAAK;;AAGlC,IAAA,OAAO,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACnE;AAEA,MAAM,sBAAsB,GACxB,qFAAqF;AAEzF;;;;AAIG;AACG,SAAU,mBAAmB,CAC/B,KAAkC,EAAA;IAElC,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK;;AAE3C,IAAA,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAClD;;;;"}
@@ -0,0 +1,27 @@
const orchestrationKeys = new Set([
"when",
"delay",
"delayChildren",
"staggerChildren",
"staggerDirection",
"repeat",
"repeatType",
"repeatDelay",
"from",
"elapsed",
]);
/**
* Decide whether a transition is defined on a given Transition.
* This filters out orchestration options and returns true
* if any options are left.
*/
function isTransitionDefined(transition) {
for (const key in transition) {
if (!orchestrationKeys.has(key))
return true;
}
return false;
}
export { isTransitionDefined };
//# sourceMappingURL=is-transition-defined.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"is-transition-defined.mjs","sources":["../../../../src/animation/utils/is-transition-defined.ts"],"sourcesContent":["import type { AnyResolvedKeyframe } from \"../types\"\nimport type { Transition } from \"../types\"\n\nconst orchestrationKeys = new Set([\n \"when\",\n \"delay\",\n \"delayChildren\",\n \"staggerChildren\",\n \"staggerDirection\",\n \"repeat\",\n \"repeatType\",\n \"repeatDelay\",\n \"from\",\n \"elapsed\",\n])\n\n/**\n * Decide whether a transition is defined on a given Transition.\n * This filters out orchestration options and returns true\n * if any options are left.\n */\nexport function isTransitionDefined(\n transition: Transition & { elapsed?: number; from?: AnyResolvedKeyframe }\n) {\n for (const key in transition) {\n if (!orchestrationKeys.has(key)) return true\n }\n return false\n}\n"],"names":[],"mappings":"AAGA,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAC9B,MAAM;IACN,OAAO;IACP,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,QAAQ;IACR,YAAY;IACZ,aAAa;IACb,MAAM;IACN,SAAS;AACZ,CAAA,CAAC;AAEF;;;;AAIG;AACG,SAAU,mBAAmB,CAC/B,UAAyE,EAAA;AAEzE,IAAA,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;AAC1B,QAAA,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC;AAAE,YAAA,OAAO,IAAI;IAChD;AACA,IAAA,OAAO,KAAK;AAChB;;;;"}
@@ -0,0 +1,7 @@
function makeAnimationInstant(options) {
options.duration = 0;
options.type = "keyframes";
}
export { makeAnimationInstant };
//# sourceMappingURL=make-animation-instant.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"make-animation-instant.mjs","sources":["../../../../src/animation/utils/make-animation-instant.ts"],"sourcesContent":["import { ValueAnimationOptions } from \"../types\"\n\nexport function makeAnimationInstant(\n options: Partial<{\n duration: ValueAnimationOptions[\"duration\"]\n type: ValueAnimationOptions[\"type\"]\n }>\n): void {\n options.duration = 0\n options.type = \"keyframes\"\n}\n"],"names":[],"mappings":"AAEM,SAAU,oBAAoB,CAChC,OAGE,EAAA;AAEF,IAAA,OAAO,CAAC,QAAQ,GAAG,CAAC;AACpB,IAAA,OAAO,CAAC,IAAI,GAAG,WAAW;AAC9B;;;;"}
@@ -0,0 +1,19 @@
import { inertia } from '../generators/inertia.mjs';
import { keyframes } from '../generators/keyframes.mjs';
import { spring } from '../generators/spring.mjs';
const transitionTypeMap = {
decay: inertia,
inertia,
tween: keyframes,
keyframes: keyframes,
spring,
};
function replaceTransitionType(transition) {
if (typeof transition.type === "string") {
transition.type = transitionTypeMap[transition.type];
}
}
export { replaceTransitionType };
//# sourceMappingURL=replace-transition-type.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"replace-transition-type.mjs","sources":["../../../../src/animation/utils/replace-transition-type.ts"],"sourcesContent":["import { inertia } from \"../generators/inertia\"\nimport { keyframes } from \"../generators/keyframes\"\nimport { spring } from \"../generators/spring\"\nimport { GeneratorFactory, ValueAnimationTransition } from \"../types\"\n\nconst transitionTypeMap: { [key: string]: GeneratorFactory } = {\n decay: inertia,\n inertia,\n tween: keyframes,\n keyframes: keyframes,\n spring,\n}\n\nexport function replaceTransitionType(transition: ValueAnimationTransition) {\n if (typeof transition.type === \"string\") {\n transition.type = transitionTypeMap[transition.type]\n }\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,iBAAiB,GAAwC;AAC3D,IAAA,KAAK,EAAE,OAAO;IACd,OAAO;AACP,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,SAAS,EAAE,SAAS;IACpB,MAAM;CACT;AAEK,SAAU,qBAAqB,CAAC,UAAoC,EAAA;AACtE,IAAA,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE;QACrC,UAAU,CAAC,IAAI,GAAG,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC;IACxD;AACJ;;;;"}
@@ -0,0 +1,15 @@
/**
* If `transition` has `inherit: true`, shallow-merge it with
* `parentTransition` (child keys win) and strip the `inherit` key.
* Otherwise return `transition` unchanged.
*/
function resolveTransition(transition, parentTransition) {
if (transition?.inherit && parentTransition) {
const { inherit: _, ...rest } = transition;
return { ...parentTransition, ...rest };
}
return transition;
}
export { resolveTransition };
//# sourceMappingURL=resolve-transition.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"resolve-transition.mjs","sources":["../../../../src/animation/utils/resolve-transition.ts"],"sourcesContent":["/**\n * If `transition` has `inherit: true`, shallow-merge it with\n * `parentTransition` (child keys win) and strip the `inherit` key.\n * Otherwise return `transition` unchanged.\n */\nexport function resolveTransition(\n transition: any,\n parentTransition?: any\n) {\n if (transition?.inherit && parentTransition) {\n const { inherit: _, ...rest } = transition\n return { ...parentTransition, ...rest }\n }\n\n return transition\n}\n"],"names":[],"mappings":"AAAA;;;;AAIG;AACG,SAAU,iBAAiB,CAC7B,UAAe,EACf,gBAAsB,EAAA;AAEtB,IAAA,IAAI,UAAU,EAAE,OAAO,IAAI,gBAAgB,EAAE;QACzC,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,UAAU;AAC1C,QAAA,OAAO,EAAE,GAAG,gBAAgB,EAAE,GAAG,IAAI,EAAE;IAC3C;AAEA,IAAA,OAAO,UAAU;AACrB;;;;"}