@freestylejs/ani-core 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +675 -401
- package/dist/index.d.cts +370 -270
- package/dist/index.d.ts +370 -270
- package/dist/index.js +667 -387
- package/package.json +1 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/ani/nodes/base.ts","../src/timing/function.ts","../src/timing/linear.ts","../src/timing/bezier.ts","../src/timing/dynamic_spring.ts","../src/timing/spring.ts","../src/timing/index.ts","../src/ani/nodes/segment.ts","../src/ani/nodes/composition.ts","../src/ani/nodes/delay.ts","../src/ani/nodes/loop.ts","../src/ani/nodes/parallel.ts","../src/ani/nodes/sequence.ts","../src/ani/nodes/stagger.ts","../src/loop/clock.ts","../src/utils/time/is_end.ts","../src/ani/engine.ts","../src/ani/timeline.ts","../src/ani/states.ts","../src/event/manager.ts","../src/style/create_sheet.ts"],"sourcesContent":["import {\n ani,\n createStates,\n delay,\n loop,\n parallel,\n sequence,\n stagger,\n timeline,\n} from './ani'\nimport { T } from './timing'\n\nexport * from './ani'\nexport * from './binding_api'\nexport * from './event'\nexport * from './loop'\nexport * from './style'\nexport * from './timing'\n\nexport const a = {\n timing: T,\n ani,\n createStates,\n delay,\n loop,\n parallel,\n sequence,\n stagger,\n timeline,\n} as const\n","import type { ExecutionPlan, Groupable } from '../timeline'\n\nexport type AnimationId = string\nexport type AnimationNodeType = string\nexport type AnimationDuration = number\n\n/**\n * Nodes in the animation tree\n */\nexport abstract class AnimationNode<G extends Groupable> {\n abstract readonly type: AnimationNodeType\n abstract readonly duration: AnimationDuration\n\n readonly id?: AnimationId\n\n constructor(id?: AnimationId) {\n if (id) {\n this.id = id\n }\n }\n\n /**\n * Constructs self node and its children into a flat execution plan.\n * @param plan Execution plans to which segments will be added.\n * @param startTime The absolute current start time for this node within the master timeline.\n */\n public abstract construct(plan: ExecutionPlan<G>, startTime: number): void\n}\n\nexport type ExtractAnimationNode<AnimeNode> = AnimeNode extends AnimationNode<\n infer Group\n>\n ? Group\n : never\n","export interface TimingFunctionContext {\n /**\n * delta t\n */\n dt: number\n /**\n * from value, initial position (`s(0)`)\n */\n from: number\n /**\n * to value, original position (`s(f)`)\n */\n to: number\n /**\n * animation duration, but it is not possible for specific functions\n */\n duration: number\n /**\n * animation end tolerance\n */\n tolerance?: number\n}\nexport abstract class TimingFunction {\n /**\n * Step function\n * @param time Current time\n * @param context Context for step calculation\n */\n public abstract step(\n time: number,\n context: TimingFunctionContext\n ): {\n value: number\n endOfAnimation: boolean\n }\n\n private static DEFAULT_TOLERANCE = 0.01 as const\n /**\n * Checks whether the animation has ended.\n *\n * @param time - The current time.\n * @param value - The computed value at the current time.\n * @param context - The animation context.\n * @returns {boolean} True if the animation is ended, false otherwise.\n */\n protected checkEnd(\n time: number,\n value: number,\n context: TimingFunctionContext,\n checkTimeOnly: boolean = true\n ): boolean {\n const tol =\n context.tolerance !== undefined\n ? context.tolerance\n : TimingFunction.DEFAULT_TOLERANCE\n const timeCondition = time >= context.duration\n const end = checkTimeOnly\n ? timeCondition\n : timeCondition && Math.abs(context.to - value) <= tol\n return end\n }\n}\n\nexport interface Coord {\n x: number\n y: number\n}\n","import { TimingFunction, type TimingFunctionContext } from './function'\n\nexport class LinearTimingFunction extends TimingFunction {\n public step(\n time: number,\n context: TimingFunctionContext\n ): { value: number; endOfAnimation: boolean } {\n const progress =\n context.duration === 0\n ? 1\n : Math.max(0, Math.min(time / context.duration, 1))\n\n const value = context.from + (context.to - context.from) * progress\n\n return { value, endOfAnimation: time >= context.duration }\n }\n}\n","/** biome-ignore-all lint/style/noMagicNumbers: <>*/\nimport {\n type Coord,\n TimingFunction,\n type TimingFunctionContext,\n} from './function'\n\nexport interface BezierTimingFunctionOpt {\n p2: Coord\n p3: Coord\n}\nexport class BezierTimingFunction extends TimingFunction {\n public constructor(public readonly opt: { p2: Coord; p3: Coord }) {\n super()\n }\n private readonly p1: Coord = {\n x: 0,\n y: 0,\n }\n private readonly p4: Coord = {\n x: 1,\n y: 1,\n }\n\n private _bezierFunction(t: number, duration?: number): number {\n const end: number = duration || this.p4.y\n return (\n (1 - t) ** 3 * this.p1.y +\n 3 * (1 - t) ** 2 * t * this.opt.p2.y +\n 3 * (1 - t) * t ** 2 * this.opt.p3.y +\n t ** 3 * end\n )\n }\n\n public step(\n time: number,\n context: TimingFunctionContext\n ): { value: number; endOfAnimation: boolean } {\n const f = this._bezierFunction(time, context.duration)\n return {\n value: f,\n endOfAnimation:\n (context.duration\n ? time >= context.duration\n : time >= this.p4.x) && f >= context.to,\n }\n }\n}\n","import { TimingFunction, type TimingFunctionContext } from './function'\n\nimport type { SpringTimingFunctionOpt } from './spring'\n\nexport class DynamicSpringTimingFunction extends TimingFunction {\n public constructor(public readonly opt: SpringTimingFunctionOpt) {\n super()\n }\n\n private currentValue: number = 0\n private currentVelocity: number = 0\n private isInitialized: boolean = false\n\n public init(startValue: number): void {\n this.currentValue = startValue\n this.currentVelocity = 0\n this.isInitialized = true\n }\n\n private getDerivatives(\n state: { x: number; v: number },\n to: number\n ): { dx: number; dv: number } {\n const { m, k, c } = this.opt\n const displacement = state.x - to\n\n const a = (-k * displacement - c * state.v) / m\n\n return { dx: state.v, dv: a }\n }\n\n public step(\n _time: number,\n context: TimingFunctionContext\n ): {\n value: number\n endOfAnimation: boolean\n } {\n if (!this.isInitialized) {\n this.init(context.from)\n }\n\n const { to, tolerance, dt } = context\n\n if (dt === 0) {\n return {\n value: this.currentValue,\n endOfAnimation: false, // Or check for end state\n }\n }\n\n const x = this.currentValue\n const v = this.currentVelocity\n\n // RK4\n // k1\n const k1 = this.getDerivatives({ x, v }, to)\n // k2\n const k2State = {\n x: x + k1.dx * (dt / 2),\n v: v + k1.dv * (dt / 2),\n }\n const k2 = this.getDerivatives(k2State, to)\n // k3\n const k3State = {\n x: x + k2.dx * (dt / 2),\n v: v + k2.dv * (dt / 2),\n }\n const k3 = this.getDerivatives(k3State, to)\n // k4\n const k4State = {\n x: x + k3.dx * dt,\n v: v + k3.dv * dt,\n }\n const k4 = this.getDerivatives(k4State, to)\n\n const avgDx = (1.0 / 6.0) * (k1.dx + 2 * k2.dx + 2 * k3.dx + k4.dx)\n const avgDv = (1.0 / 6.0) * (k1.dv + 2 * k2.dv + 2 * k3.dv + k4.dv)\n\n this.currentValue = x + avgDx * dt\n this.currentVelocity = v + avgDv * dt\n\n // Check for end of animation\n const tol = tolerance ?? 1e-3\n const displacement = this.currentValue - to\n const isMoving = Math.abs(this.currentVelocity) > tol\n const isDisplaced = Math.abs(displacement) > tol\n const endOfAnimation = !isMoving && !isDisplaced\n\n if (endOfAnimation) {\n // Snap to final value\n this.currentValue = to\n this.currentVelocity = 0\n }\n\n return {\n value: this.currentValue,\n endOfAnimation: endOfAnimation,\n }\n }\n}\n","import { TimingFunction, type TimingFunctionContext } from './function'\n\nexport interface SpringTimingFunctionOpt {\n /**\n * Mass constant.\n */\n m: number\n /**\n * Spring constant.\n */\n k: number\n /**\n * Damping constant.\n */\n c: number\n /**\n * End of spring animation threshold.\n * @default 1e-3\n */\n tolerance?: number\n}\nexport class SpringTimingFunction extends TimingFunction {\n public constructor(public readonly opt: SpringTimingFunctionOpt) {\n super()\n if (!this.opt.tolerance) {\n const DEFAULT_TOLERANCE = 1e-3 as const\n this.opt.tolerance = DEFAULT_TOLERANCE\n }\n }\n\n public step(\n time: number,\n context: TimingFunctionContext\n ): {\n value: number\n endOfAnimation: boolean\n } {\n // mass-spring-damper\n // ODE\n const m = this.opt.m\n const k = this.opt.k\n const c = this.opt.c\n const tolerance = this.opt.tolerance!\n\n // Initial D\n const d0 = context.from - context.to\n\n if (typeof d0 !== 'number') {\n throw new TypeError(\n 'Spring step function, needs initial displacement d(0) = context.start'\n )\n }\n\n const wN = Math.sqrt(k / m)\n const zetta = c / (2 * Math.sqrt(m * k))\n const Ms = 1000 as const\n\n if (zetta < 1) {\n // under-damped system\n const settlingTime = (-1 / (zetta * wN)) * Math.log(tolerance)\n const t = context?.duration\n ? (settlingTime / context.duration) * time\n : time\n\n const C1 = d0\n const C2 = (zetta / Math.sqrt(1 - zetta ** 2)) * d0\n const ode =\n Math.exp(-zetta * wN * t) *\n (C1 * Math.cos(wN * Math.sqrt(1 - zetta ** 2) * t) +\n C2 * Math.sin(wN * Math.sqrt(1 - zetta ** 2) * t)) +\n context.to\n\n return {\n value: ode,\n endOfAnimation: t >= settlingTime && ode >= context.to,\n }\n }\n\n if (zetta === 1) {\n // critically-damped system\n const settlingTime = (-1 / wN) * Math.log(tolerance)\n const t = context?.duration\n ? (settlingTime / context.duration) * time\n : time\n\n const C1 = d0\n const C2 = wN * d0\n const ode = (C1 + C2 * t) * Math.exp(-wN * t) + context.to\n\n return {\n value: ode,\n endOfAnimation:\n t >= settlingTime &&\n Math.abs(ode - context.to) <= context.to / Ms,\n }\n }\n\n if (zetta > 1) {\n // overdamped system\n const settlingTime = (-1 / (zetta * wN)) * Math.log(tolerance)\n const t = context?.duration\n ? (settlingTime / context.duration) * time\n : time\n\n const delta = Math.sqrt(zetta ** 2 - 1)\n const lambda1 = -zetta * wN + wN * delta\n const lambda2 = -zetta * wN - wN * delta\n\n const C2 = (-lambda1 * d0) / (lambda2 - lambda1)\n const C1 = d0 - C2\n\n // ODE solution\n const ode =\n C1 * Math.exp(lambda1 * t) +\n C2 * Math.exp(lambda2 * t) +\n context.to\n\n return {\n value: ode,\n endOfAnimation:\n t >= settlingTime &&\n Math.abs(ode - context.to) <= context.to / Ms,\n }\n }\n\n throw new Error('invalid system')\n }\n}\n","export * from './function'\nexport * from './linear'\n\nimport * as Bezier from './bezier'\nimport { DynamicSpringTimingFunction } from './dynamic_spring'\nimport { LinearTimingFunction } from './linear'\nimport { SpringTimingFunction, type SpringTimingFunctionOpt } from './spring'\n\n/**\n * Core timing functions\n */\nexport const T = {\n /**\n * Creates a new Bezier timing function instance.\n *\n * @param {Bezier.BezierTimingFunctionOpt} opt - Options for configuring the Bezier curve.\n */\n bezier: (opt: Bezier.BezierTimingFunctionOpt) =>\n new Bezier.BezierTimingFunction(opt),\n\n /**\n * Creates a new Spring timing function instance.\n *\n * @param {SpringTimingFunctionOpt} opt - Options for configuring the Spring timing function.\n */\n spring: (opt: SpringTimingFunctionOpt) => new SpringTimingFunction(opt),\n\n /**\n * Creates a new Dynamic Spring timing function instance.\n *\n * @param SpringTimingFunctionOpt} opt - Options for configuring the Spring timing function.\n */\n dynamicSpring: (opt: SpringTimingFunctionOpt) =>\n new DynamicSpringTimingFunction(opt),\n\n /**\n * Creates linear timing function instance.\n */\n linear: () => new LinearTimingFunction(),\n} as const\n","import type { SegmentTiming } from '../engine'\nimport type { ExecutionPlan, Groupable } from '../timeline'\nimport { type AnimationId, AnimationNode } from './base'\n\nexport interface SegmentNodeProps<G extends Groupable> {\n readonly to: G\n readonly duration: number\n readonly timing?: SegmentTiming<G>\n}\n\n/**\n * Leaf node in the animation tree\n */\nexport class SegmentNode<G extends Groupable> extends AnimationNode<G> {\n readonly type = 'SEGMENT'\n readonly props: SegmentNodeProps<G>\n\n constructor(props: SegmentNodeProps<G>, id?: AnimationId) {\n super(id)\n const nodeProps: SegmentNodeProps<G> = {\n to: props.to,\n duration: props.duration,\n ...(props.timing !== undefined && { timing: props.timing }),\n }\n this.props = nodeProps\n }\n\n public get duration(): number {\n return this.props.duration\n }\n\n public construct(plan: ExecutionPlan<G>, startTime: number): void {\n plan.push({\n node: this,\n startTime: startTime,\n endTime: startTime + this.duration,\n })\n }\n}\n\n/**\n * Factory function to create a ani SegmentNode.\n */\nexport function ani<G extends Groupable>(\n props: SegmentNodeProps<G>,\n id?: AnimationId\n): SegmentNode<G> {\n return new SegmentNode(props, id)\n}\n","import { LinearTimingFunction, type TimingFunction } from '~/timing'\nimport type { ExecutionPlan, Groupable } from '../timeline'\nimport {\n type AnimationId,\n AnimationNode,\n type ExtractAnimationNode,\n} from './base'\nimport { SegmentNode } from './segment'\n\nexport type CompositionChildren = readonly AnimationNode<Groupable>[]\nexport type CompositionPlan<Children extends CompositionChildren> =\n ExecutionPlan<ExtractAnimationNode<Children[number]>>\n\n/**\n * Composition animation\n */\nexport abstract class CompositionNode<\n const Children extends CompositionChildren,\n> extends AnimationNode<ExtractAnimationNode<Children[number]>> {\n /**\n * Composition children nodes.\n */\n public readonly children: Children\n\n constructor(children: Children, timing?: TimingFunction, id?: AnimationId) {\n super(id)\n\n const parentTiming: TimingFunction =\n timing ?? new LinearTimingFunction()\n\n const adjustTiming = <T extends CompositionChildren>(\n children: T\n ): T => {\n return children.map((child) => {\n if (\n child instanceof SegmentNode &&\n // child timing none >> override to parent\n child.props.timing === undefined &&\n timing\n ) {\n return new SegmentNode(\n {\n ...child.props,\n timing: parentTiming,\n },\n child.id\n )\n }\n\n if (child instanceof CompositionNode) {\n // @ts-ignore\n child.children = adjustTiming(child.children)\n return child\n }\n\n return child\n }) as unknown as T\n }\n\n const timingOverridingChildren = adjustTiming(children)\n this.children = timingOverridingChildren\n }\n}\n","import type { AnimationId } from './base'\nimport { SegmentNode } from './segment'\n\ntype PreserveRecord = Record<string, any>\n\n/**\n * Creates a pause in an animation sequence.\n * @param duration The duration of the delay in seconds.\n * @param id Optional ID for the node.\n */\nexport function delay(\n duration: number,\n id?: AnimationId\n): SegmentNode<PreserveRecord> {\n return new SegmentNode<PreserveRecord>({ to: {}, duration }, id)\n}\n","import type { TimingFunction } from '~/timing'\nimport type { Groupable } from '../timeline'\nimport type { AnimationId, AnimationNode } from './base'\nimport { CompositionNode, type CompositionPlan } from './composition'\n\n/**\n * Composition node that repeats a child animation node a specified number of times.\n */\nexport class LoopNode<G extends Groupable> extends CompositionNode<\n readonly AnimationNode<G>[]\n> {\n readonly type = 'LOOP'\n readonly duration: number\n readonly count: number\n readonly child: AnimationNode<G>\n\n constructor(\n child: AnimationNode<G>,\n loopCount: number,\n timing?: TimingFunction,\n id?: AnimationId\n ) {\n super([child], timing, id)\n this.child = child\n this.count = loopCount\n this.duration = child.duration * loopCount\n }\n\n public construct(\n plan: CompositionPlan<readonly AnimationNode<G>[]>,\n startTime: number\n ): void {\n let currentTime = startTime\n for (let i = 0; i < this.count; i++) {\n this.child.construct(plan, currentTime)\n currentTime += this.child.duration\n }\n }\n}\n\n/**\n * Repeats a child animation node a specified number of times.\n * @param child The animation node to repeat.\n * @param loopCount The number of times to repeat the child node.\n * @param timing loop timing function.\n * @param id Optional ID for the node.\n */\nexport function loop<G extends Groupable>(\n child: AnimationNode<G>,\n loopCount: number,\n timing?: TimingFunction,\n id?: AnimationId\n): LoopNode<G> {\n return new LoopNode(child, loopCount, timing, id)\n}\n","import type { TimingFunction } from '~/timing'\nimport type { Groupable, GroupableRecord } from '../timeline'\nimport type { AnimationId, AnimationNode } from './base'\nimport {\n type CompositionChildren,\n CompositionNode,\n type CompositionPlan,\n} from './composition'\nimport { SegmentNode } from './segment'\n\n/**\n * Composition node that runs all of its children at the same time.\n */\nexport class ParallelNode<\n const Children extends CompositionChildren,\n> extends CompositionNode<Children> {\n readonly type = 'PARALLEL'\n readonly duration: number\n\n constructor(children: Children, timing?: TimingFunction, id?: AnimationId) {\n // Handle object property conflicts\n const seenProperty = new Set<string>()\n const resolvedChildren: AnimationNode<Groupable>[] = []\n\n for (const child of [...children].reverse()) {\n if (child instanceof SegmentNode) {\n const segment = child as SegmentNode<Groupable>\n const propsTo = segment.props.to\n\n // record shape\n if (propsTo && !Array.isArray(propsTo)) {\n const propsToAnimate = Object.keys(propsTo)\n const finalConstructedTo: Record<string, number> = {}\n let handledCount = 0\n\n for (const propKey of propsToAnimate) {\n if (!seenProperty.has(propKey)) {\n finalConstructedTo[propKey] = (\n propsTo as Record<string, number>\n )[propKey]!\n seenProperty.add(propKey)\n handledCount++\n }\n }\n\n if (handledCount > 0) {\n const newSegment = new SegmentNode<Groupable>(\n {\n ...segment.props,\n to: finalConstructedTo as GroupableRecord,\n },\n segment.id\n )\n resolvedChildren.push(newSegment)\n }\n continue // Go to next child\n }\n }\n\n // Non-conflicts\n resolvedChildren.push(child)\n }\n\n resolvedChildren.reverse()\n\n super(resolvedChildren as unknown as Children, timing, id)\n\n this.duration = Math.max(0, ...children.map((child) => child.duration))\n }\n\n public construct(plan: CompositionPlan<Children>, startTime: number): void {\n for (const child of this.children) {\n child.construct(plan, startTime)\n }\n }\n}\n\n/**\n * Parallel composition animation\n */\nexport function parallel<const Children extends CompositionChildren>(\n children: Children,\n timing?: TimingFunction,\n id?: AnimationId\n): ParallelNode<Children> {\n return new ParallelNode(children, timing, id)\n}\n","import type { TimingFunction } from '~/timing'\nimport type { AnimationId } from './base'\nimport {\n type CompositionChildren,\n CompositionNode,\n type CompositionPlan,\n} from './composition'\n\n/**\n * Composition node that runs its children one after another.\n */\nexport class SequenceNode<\n const Children extends CompositionChildren,\n> extends CompositionNode<Children> {\n readonly type = 'SEQUENCE'\n readonly duration: number\n\n constructor(children: Children, timing?: TimingFunction, id?: AnimationId) {\n super(children, timing, id)\n this.duration = children.reduce((sum, child) => sum + child.duration, 0)\n }\n\n public construct(plan: CompositionPlan<Children>, startTime: number): void {\n let currentTime = startTime\n for (const child of this.children) {\n child.construct(plan, currentTime)\n currentTime += child.duration\n }\n }\n}\n\n/**\n * Sequence composition animation\n */\nexport function sequence<const Children extends CompositionChildren>(\n children: Children,\n timing?: TimingFunction,\n id?: AnimationId\n): SequenceNode<Children> {\n return new SequenceNode(children, timing, id)\n}\n","import type { TimingFunction } from '~/timing'\nimport type { AnimationId } from './base'\nimport {\n type CompositionChildren,\n CompositionNode,\n type CompositionPlan,\n} from './composition'\n\ninterface StaggerNodeProps {\n offset: number\n timing?: TimingFunction\n}\n/**\n * Composition node that runs its children with a fixed delay between each start time.\n */\nexport class StaggerNode<\n const Children extends CompositionChildren,\n> extends CompositionNode<Children> {\n readonly type = 'STAGGER'\n readonly duration: number\n readonly offset: number\n\n constructor(children: Children, props: StaggerNodeProps, id?: AnimationId) {\n super(children, props?.timing, id)\n\n this.offset = props.offset\n\n if (children.length === 0) {\n this.duration = 0\n } else {\n const lastChild = children[children.length - 1]!\n this.duration =\n (children.length - 1) * this.offset + lastChild.duration\n }\n }\n\n public construct(plan: CompositionPlan<Children>, startTime: number): void {\n let currentTime = startTime\n for (const child of this.children) {\n child.construct(plan, currentTime)\n currentTime += this.offset\n }\n }\n}\n\n/**\n * Stagger composition animation\n */\nexport function stagger<const Children extends CompositionChildren>(\n children: Children,\n props: StaggerNodeProps,\n id?: AnimationId\n): StaggerNode<Children> {\n return new StaggerNode(children, props, id)\n}\n","export interface Animatable {\n /**\n * Update animation based on dt\n * @param dt delta time\n */\n update(dt: number): void\n}\n\n/**\n * Animation clock interface, can be user-injected.\n */\nexport interface AnimationClockInterface {\n subscribe(animatable: Animatable): void\n unsubscribe(animatable: Animatable): void\n}\n\nexport class AnimationClock implements AnimationClockInterface {\n private subscribers: Set<Animatable> = new Set()\n private animationFrameId: number | null = null\n private lastTimestamp: number = 0\n private maxDeltaTime: number\n\n protected static clock: AnimationClock\n /**\n * Crete new clock(singleton)\n * @param maxDeltaTime default maxDt = 100ms\n * @returns clock\n */\n public static create(maxDeltaTime: number = 1 / 10): AnimationClock {\n AnimationClock.clock = new AnimationClock(maxDeltaTime)\n return AnimationClock.clock\n }\n private constructor(maxDeltaTime: number) {\n this.maxDeltaTime = maxDeltaTime\n }\n\n public subscribe(animatable: Animatable): void {\n this.subscribers.add(animatable)\n if (!this.animationFrameId) {\n this.start()\n }\n }\n\n public unsubscribe(animatable: Animatable): void {\n this.subscribers.delete(animatable)\n if (this.subscribers.size === 0) {\n this.stop()\n }\n }\n\n private start(): void {\n this.lastTimestamp = performance.now()\n this.animationFrameId = window.requestAnimationFrame(this.tick)\n }\n\n private stop(): void {\n if (this.animationFrameId) {\n window.cancelAnimationFrame(this.animationFrameId)\n this.animationFrameId = null\n }\n }\n\n private tick = (timestamp: number): void => {\n if (!this.animationFrameId) return\n\n const MS = 1000 as const\n let dt = (timestamp - this.lastTimestamp) / MS\n this.lastTimestamp = timestamp\n\n // prevent large jumps or negatives\n if (dt < 0) dt = 0\n if (dt > this.maxDeltaTime) {\n dt = this.maxDeltaTime\n }\n\n for (const subscriber of this.subscribers) {\n subscriber.update(dt)\n }\n\n this.animationFrameId = window.requestAnimationFrame(this.tick)\n }\n}\n","export function isEndOfAnimation(\n currentT: number,\n duration: number,\n tolerance: number = 1e-3\n): boolean {\n return currentT === duration || currentT - duration >= tolerance\n}\n","import type { TimingFunction } from '~/timing'\nimport { isEndOfAnimation } from '~/utils/time'\nimport type { Groupable, GroupableRecord } from './timeline'\n\nexport type AnimePrimitive = readonly number[]\n\nexport interface SegmentDefinition {\n from: AnimePrimitive\n to: AnimePrimitive\n duration: number\n timing: SegmentTiming\n}\n\nexport type SegmentTiming<G extends Groupable = Groupable> =\n G extends AnimePrimitive\n ? readonly TimingFunction[] | TimingFunction\n : G extends GroupableRecord\n ? Record<keyof G, TimingFunction> | TimingFunction\n : never\n\nexport interface SegmentState {\n values: AnimePrimitive\n isComplete: boolean\n}\n\n/**\n * Calculates the animated values for a single segment at a specific local time.\n *\n * @param localTime Time elapsed within this specific segment (from 0 to duration).\n * @param segmentDef Target segment def\n * @parma dt Delta time\n * @returns Calculated values and whether the segment is complete.\n */\nexport function calculateSegmentState(\n localTime: number,\n segmentDef: SegmentDefinition,\n dt: number = 0\n): SegmentState {\n const t = Math.max(0, Math.min(localTime, segmentDef.duration))\n\n const animeValues: Array<number> = []\n let allComplete = true\n\n const isMultipleTiming = Array.isArray(segmentDef.timing)\n\n if (\n isMultipleTiming &&\n (segmentDef.timing as Array<TimingFunction>).length !==\n segmentDef.from.length\n ) {\n throw new TypeError(\n `[calculateSegmentState] timing does not correctly set. It requires multiple timing for ${segmentDef.from}, but received ${segmentDef.timing}`\n )\n }\n\n for (let i = 0; i < segmentDef.from.length; i++) {\n const timingFunction: TimingFunction = isMultipleTiming\n ? (segmentDef.timing as TimingFunction[])[i]!\n : (segmentDef.timing as TimingFunction)\n\n const animeResponse = timingFunction.step(t, {\n dt: dt,\n from: segmentDef.from[i]!,\n to: segmentDef.to[i]!,\n duration: segmentDef.duration,\n })\n\n animeValues.push(animeResponse.value)\n if (!animeResponse.endOfAnimation) {\n allComplete = false\n }\n }\n\n return {\n values: animeValues,\n isComplete: allComplete || isEndOfAnimation(t, segmentDef.duration),\n }\n}\n","import {\n type Animatable,\n AnimationClock,\n type AnimationClockInterface,\n} from '~/loop'\nimport type { Resolver, StylesheetSupportedLiteral } from '~/style'\nimport { TimingFunction } from '~/timing'\nimport { isEndOfAnimation } from '~/utils/time'\nimport type {\n Prettify,\n UnionToIntersection,\n WithLiteral,\n WithLiteralRecord,\n} from '~/utils/types'\nimport {\n type AnimePrimitive,\n calculateSegmentState,\n type SegmentDefinition,\n} from './engine'\nimport { type AnimationNode, SegmentNode, type SegmentNodeProps } from './nodes'\n\n/**\n * Animatable target values\n */\nexport type Groupable = AnimePrimitive | GroupableRecord\n\nexport type GroupableRecordKey = WithLiteral<StylesheetSupportedLiteral>\n\nexport type GroupableRecord = WithLiteralRecord<\n GroupableRecordKey,\n AnimePrimitive[number]\n>\n\nexport type AniGroup<G extends Groupable> = Prettify<UnionToIntersection<G>>\n\nexport interface ExecutionSegment<G extends Groupable> {\n /**\n * Execution segment node\n */\n node: SegmentNode<G>\n /**\n * Animation start time\n */\n startTime: number\n /**\n * Animation end time\n */\n endTime: number\n}\n\nexport type ExecutionPlan<G extends Groupable> = Array<ExecutionSegment<G>>\n\ntype TimelineStatus = 'IDLE' | 'PLAYING' | 'PAUSED' | 'ENDED'\nexport type OnUpdateCallback<G extends Groupable> = (current: {\n state: AniGroup<G>\n status: TimelineStatus\n}) => void\n\ntype ShouldKeepSymbol = 'keep'\ntype Keyframe<G extends Groupable> = Array<G | ShouldKeepSymbol>\ntype Duration = Array<number | ShouldKeepSymbol>\n\nexport interface TimelineStartingConfig<G extends Groupable, Ctx = any> {\n /**\n * Starting dynamic value.\n */\n from: AniGroup<G>\n /**\n * Dynamic `from` values, if passed `keep` for specific index, keep original timeline config.\n */\n keyframes?: Keyframe<G>\n /**\n * Dynamic `duration` values, if passed `keep` for specific index, keep original timeline config.\n */\n durations?: Duration\n /**\n * Custom context definition during animation cycle.\n */\n context?: Ctx\n /**\n * Animation repeat count.\n *\n * - if `Infinity` goes infinity repeat\n */\n repeat?: number\n\n /**\n * Initial delay before animation starts.\n *\n * - unit = `MS`\n */\n delay?: number\n\n /**\n * Custom style property resolver.\n *\n * @example\n * ```ts\n * const timeline = a.timeline(...)\n * timeline.play({\n * propertyResolver: {\n * 'px': (pxValue) => { key: `top`, value: `${pxValue}px` }\n * }\n * })\n * ```\n */\n propertyResolver?: G extends AnimePrimitive ? never : Resolver<G>\n}\n\n/**\n * Public timeline controller\n */\nexport interface TimelineController<G extends Groupable, Ctx = any> {\n /**\n * Play timeline\n * @param config Timeline starting configuration\n * @param canBeIntercepted if `true`, will play animation again even if already PLAYING.\n */\n play(\n config: TimelineStartingConfig<G, Ctx>,\n canBeIntercepted?: boolean\n ): void\n /**\n * Pause timeline\n */\n pause(): void\n /**\n * Resume timeline\n */\n resume(): void\n /**\n * Seek to target time\n * @param time\n */\n seek(time: number): void\n /**\n * Reset timeline\n */\n reset(): void\n}\n\nexport class Timeline<G extends Groupable, Ctx = any>\n implements TimelineController<G, Ctx>, Animatable\n{\n public readonly duration: number\n\n private readonly _baseExecutionPlan: ExecutionPlan<G>\n private _currentExecutionPlan: ExecutionPlan<G> | null = null\n\n private readonly _clock: AnimationClockInterface\n\n private _masterTime = 0\n\n private _delay = 0\n\n private _status: TimelineStatus = 'IDLE'\n private _currentConfig: TimelineStartingConfig<G, Ctx> | null = null\n /**\n * Current animation running config.\n */\n public get currentConfig() {\n return this._currentConfig\n }\n\n private _state: AnimePrimitive = []\n private _initialState: AnimePrimitive = []\n\n private _repeatCount: number = 0\n\n private _propertyKeyMap: Map<string, number> | null = null\n private _segmentStartStates = new Map<number, AnimePrimitive>()\n\n private _onUpdateCallbacks = new Set<OnUpdateCallback<G>>()\n\n constructor(\n /**\n * Animation construction root node.\n */\n protected readonly rootNode: AnimationNode<G>,\n clock?: AnimationClockInterface\n ) {\n this.duration = rootNode.duration\n this._baseExecutionPlan = this._constructExecutionPlan(rootNode)\n\n // default clock\n this._clock = clock ?? AnimationClock.create()\n\n // binding\n this.play.bind(this)\n this.pause.bind(this)\n this.seek.bind(this)\n this.resume.bind(this)\n this.reset.bind(this)\n }\n\n /**\n * Resolves a Group (like {x, y}) into keys and values.\n */\n private _resolveGroup(group: G): {\n keyMap: Map<string, number> | null\n values: AnimePrimitive\n } {\n if (Array.isArray(group)) {\n return { keyMap: null, values: group }\n }\n const keyMap = new Map(Object.keys(group).map((key, i) => [key, i]))\n const values = Object.values(group) as AnimePrimitive\n return { keyMap, values }\n }\n\n /**\n * Resolves the internal state (a number array) back into Group.\n */\n private _resolveStateToGroup(state: AnimePrimitive): AniGroup<G> {\n if (!this._propertyKeyMap) {\n return state as unknown as AniGroup<G>\n }\n const group = {} as Record<string, number>\n\n let i = 0\n for (const key of this._propertyKeyMap.keys()) {\n group[key] = state[i]!\n i++\n }\n return group as AniGroup<G>\n }\n\n /**\n * Compile animation execution plan\n */\n private _constructExecutionPlan(\n rootNode: AnimationNode<G>\n ): ExecutionPlan<G> {\n const plan: ExecutionPlan<G> = []\n rootNode.construct(plan, 0)\n return plan\n }\n\n /**\n * Calculates the exact state of the animation at point.\n */\n private _calculateStateAtTime(\n targetTime: number,\n dt: number = 0\n ): AnimePrimitive {\n if (this._initialState.length === 0 || !this._currentExecutionPlan) {\n return []\n }\n\n const nextState: Array<number> = [...this._initialState]\n let stateAtLastStartTime: Array<number> = [...this._initialState]\n\n for (const segment of this._currentExecutionPlan) {\n // Only for activated animation segment\n if (targetTime < segment.startTime) {\n continue\n }\n\n if (!segment.node.props.timing) {\n throw new Error(\n `[Timeline] timing should be provided. Please specify timing using a.timing.(...). Check target segment: ${JSON.stringify(segment, null, 2)}.`,\n { cause: segment }\n )\n }\n\n // Use the state before this segment for \"from\" calculation\n stateAtLastStartTime = [...nextState]\n\n const { keyMap, values: toValues } = this._resolveGroup(\n segment.node.props.to\n )\n const isRecordAni: boolean =\n this._propertyKeyMap !== null && keyMap !== null\n\n // From value calculations\n let fromValues: Array<number> = []\n const timings: Array<TimingFunction> = []\n const t = segment.node.props.timing\n const isRecordTiming: boolean = t && !(t instanceof TimingFunction)\n\n if (isRecordAni) {\n for (const key of keyMap!.keys()) {\n const index = this._propertyKeyMap!.get(key)!\n fromValues.push(stateAtLastStartTime[index]!)\n if (isRecordTiming) {\n timings.push(\n (t as Record<string, TimingFunction>)[key]!\n )\n }\n }\n } else {\n fromValues = stateAtLastStartTime\n }\n\n let finalAnimeValues: AnimePrimitive = []\n\n const localTime = targetTime - segment.startTime\n\n const segmentDef: SegmentDefinition = {\n from: fromValues,\n to: toValues,\n duration: segment.node.duration,\n timing: isRecordAni && isRecordTiming ? timings : t,\n }\n\n const segmentState = calculateSegmentState(\n localTime,\n segmentDef,\n dt\n )\n\n if (segmentState.isComplete) {\n finalAnimeValues = toValues // End target\n } else {\n finalAnimeValues = segmentState.values // Calculated current target\n }\n\n // Update next state\n if (isRecordAni) {\n // Record ani\n let i = 0\n for (const key of keyMap!.keys()) {\n const stateIndex = this._propertyKeyMap!.get(key)!\n if (stateIndex === -1) {\n continue\n }\n nextState[stateIndex] = finalAnimeValues[i]!\n i++\n }\n } else {\n // Array ani\n for (let i = 0; i < finalAnimeValues.length; i++) {\n nextState[i] = finalAnimeValues[i]!\n }\n }\n }\n\n return nextState\n }\n\n private _resolveExecutionPlan(\n keyframes?: Keyframe<G>,\n durations?: Duration\n ): ExecutionPlan<G> {\n if (!keyframes && !durations) {\n return [...this._baseExecutionPlan]\n }\n\n const segmentNodes = this._baseExecutionPlan.filter(\n (segment) => segment.node.type === 'SEGMENT'\n )\n const segLength = segmentNodes.length\n\n if (keyframes && keyframes.length !== segLength) {\n throw new Error(\n `Timeline keyframe mismatch: Expected ${segLength} keyframes, but received ${keyframes.length}.`\n )\n }\n if (durations && durations.length !== segLength) {\n throw new Error(\n `Timeline keyframe mismatch: Expected ${segLength} durations, but received ${durations.length}.`\n )\n }\n\n const newPlan: ExecutionPlan<G> = []\n\n let keyframeIndex = 0\n\n // Create dynamic to keyframes based plans\n for (const segment of this._baseExecutionPlan) {\n if (segment.node.type === 'SEGMENT') {\n const dynamicTo = keyframes?.[keyframeIndex]\n const dynamicDuration = durations?.[keyframeIndex]\n\n const newSegmentProps: SegmentNodeProps<G> = {\n ...segment.node.props,\n\n // >> dynamic to\n ...(dynamicTo && {\n to:\n dynamicTo === 'keep'\n ? segment.node.props.to\n : dynamicTo,\n }),\n\n // >> dynamic duration\n ...(dynamicDuration && {\n duration:\n dynamicDuration === 'keep'\n ? segment.node.props.duration\n : dynamicDuration,\n }),\n }\n\n const newSegment = new SegmentNode(\n newSegmentProps,\n segment.node.id\n )\n newPlan.push({ ...segment, node: newSegment })\n keyframeIndex++\n } else {\n // non-segment nodes\n newPlan.push({ ...segment })\n }\n }\n\n return newPlan\n }\n\n private notify(): void {\n for (const subscriber of this._onUpdateCallbacks) {\n subscriber({\n state: this._resolveStateToGroup(this._state),\n status: this._status,\n })\n }\n }\n\n public play(\n config: TimelineStartingConfig<G, Ctx>,\n canBeIntercepted: boolean = true\n ): void {\n if (this._status === 'PLAYING' && !canBeIntercepted) {\n return\n }\n\n const isRepeating =\n this._currentConfig?.repeat && this._currentConfig?.repeat >= 1\n const savedRepeatCount = isRepeating ? this._repeatCount : 0\n\n // can be intercepted -> reset\n this.reset(false)\n // recover repeat count\n this._repeatCount = savedRepeatCount\n\n // repeat exceed -> reset repeat\n if (isRepeating && this._repeatCount >= config.repeat!) {\n this._repeatCount = 0\n return\n }\n\n // update current config\n this._currentConfig = config\n\n if (this._repeatCount === 0) {\n this._delay = (this._currentConfig.delay ?? 0) * 1e-3 // MS\n }\n\n this._currentExecutionPlan = this._resolveExecutionPlan(\n config.keyframes,\n config.durations\n )\n\n const { keyMap: keys, values } = this._resolveGroup(config.from as G)\n this._propertyKeyMap = keys\n this._state = values\n this._initialState = values\n\n this._status = 'PLAYING'\n this._clock.subscribe(this)\n this.notify()\n }\n\n public pause(): void {\n this._status = 'PAUSED'\n this._clock.unsubscribe(this)\n }\n\n public resume(): void {\n if (this._status !== 'PAUSED') return\n this._status = 'PLAYING'\n this._clock.subscribe(this)\n }\n\n public reset(notify: boolean = true): void {\n this._status = 'IDLE'\n\n this._currentConfig = null\n\n this._masterTime = 0\n this._delay = 0\n\n this._state = []\n this._initialState = []\n\n this._propertyKeyMap = null\n\n this._segmentStartStates.clear()\n this._currentExecutionPlan = null\n\n this._clock.unsubscribe(this)\n\n this._repeatCount = 0\n\n if (notify) {\n this.notify()\n }\n }\n\n public seek(targetTime: number): void {\n if (this._status === 'PLAYING' || this._status === 'ENDED') {\n this.pause()\n }\n const seekTime = Math.max(0, Math.min(targetTime, this.duration))\n\n this._masterTime = seekTime\n this._state = this._calculateStateAtTime(seekTime, 0)\n\n this.notify()\n }\n\n public getCurrentValue(): AniGroup<G> | null {\n if (this._state.length === 0) return null\n return this._resolveStateToGroup(this._state)\n }\n\n public onUpdate(callback: OnUpdateCallback<G>): () => void {\n this._onUpdateCallbacks.add(callback)\n return () => {\n this._onUpdateCallbacks.delete(callback)\n }\n }\n\n update(dt: number): void {\n if (this._status !== 'PLAYING') {\n return\n }\n\n if (this._delay > 0) {\n this._delay -= dt\n if (this._delay < 0) {\n dt = -this._delay\n this._delay = 0\n } else {\n return\n }\n }\n\n this._masterTime += dt\n if (this._masterTime >= this.duration) {\n this._masterTime = this.duration\n }\n\n this._state = this._calculateStateAtTime(this._masterTime, dt)\n this.notify()\n\n if (isEndOfAnimation(this._masterTime, this.duration)) {\n // repeat update\n this._repeatCount += 1\n\n if (!this._currentConfig) {\n throw new Error(\n `[Timeline] currentConfig can not be null when update(dt)`\n )\n }\n\n // no-repeat -> ended(don't have to reset)\n const noRepeat = (this._currentConfig.repeat ?? 0) === 0\n\n if (noRepeat) {\n this._status = 'ENDED'\n this._clock.unsubscribe(this)\n this.notify()\n } else {\n this.play(this._currentConfig)\n }\n }\n }\n}\n\nexport function timeline<G extends Groupable, Ctx = any>(\n rootNode: AnimationNode<G>,\n clock?: AnimationClockInterface\n): Timeline<G, Ctx> {\n return new Timeline<G, Ctx>(rootNode, clock)\n}\n","import type { AnimationClockInterface } from '~/loop'\nimport type { AnimationNode, ExtractAnimationNode } from './nodes'\nimport {\n type AniGroup,\n type Groupable,\n type Timeline,\n type TimelineStartingConfig,\n timeline,\n} from './timeline'\n\nexport type AnimationStateShape = Record<string, AnimationNode<Groupable>>\n\nexport type GetTimeline<State extends AnimationStateShape> = Timeline<\n ExtractAnimationNode<State[keyof State]>,\n any\n>\n\nexport interface StateController<AnimationStates extends AnimationStateShape> {\n /**\n * Get current timeline.\n */\n timeline: () => GetTimeline<AnimationStates>\n\n /**\n * Transition timeline animation into another state.\n * @param newState transition target.\n *\n * @param timelineConfig animation play config.\n * @param canBeIntercepted animation canBeIntercepted config.\n */\n transitionTo(\n newState: keyof AnimationStates,\n timelineConfig?: TimelineStartingConfig<\n ExtractAnimationNode<AnimationStates[keyof AnimationStates]>,\n any\n >,\n canBeIntercepted?: boolean\n ): void\n\n /**\n * Subscribe to timeline changes.\n * @param callback\n * @returns unsubscribe function\n */\n onTimelineChange(\n callback: (newTimeline: GetTimeline<AnimationStates>) => void\n ): () => void\n}\n\nexport interface StateProps<AnimationStates extends AnimationStateShape> {\n /**\n * Initial animation target state.\n */\n initial: keyof AnimationStates\n /**\n * Initial animation `from` value.\n */\n initialFrom: AniGroup<\n ExtractAnimationNode<AnimationStates[keyof AnimationStates]>\n >\n /**\n * Animating target states.\n */\n states: AnimationStates\n /**\n * Custom timeline clock\n */\n clock?: AnimationClockInterface\n}\n\n/**\n * Creates a state machine controller for managing animations.\n *\n * @param config - The configuration for the state machine.\n * @param clock - Optional custom animation clock.\n * @returns A controller for managing the animation states.\n */\nexport function createStates<AnimationStates extends AnimationStateShape>(\n config: StateProps<AnimationStates>\n): StateController<AnimationStates> {\n let State: keyof AnimationStates = config.initial\n let Timeline: Timeline<Groupable> = timeline(\n config.states[State]!,\n config.clock\n )\n\n const subs = new Set<(newTimeline: GetTimeline<AnimationStates>) => void>()\n const notify = (timeline: GetTimeline<AnimationStates>) => {\n for (const Sub of subs) {\n Sub(timeline)\n }\n }\n\n return {\n timeline: () => Timeline as unknown as GetTimeline<AnimationStates>,\n onTimelineChange(callback) {\n subs.add(callback)\n return () => subs.delete(callback)\n },\n transitionTo(newState, timelineConfig, canBeIntercepted) {\n // keep current timeline\n if (!config.states[newState] || State === newState) {\n return\n }\n\n // new timeline\n const from = (timelineConfig?.from ?? // 1. config\n Timeline.getCurrentValue() ?? // 2. last value\n config.initialFrom) as TimelineStartingConfig<Groupable>['from'] // 3. initial value\n\n State = newState\n Timeline = timeline(config.states[State]!, config.clock)\n notify(Timeline as unknown as GetTimeline<AnimationStates>)\n\n Timeline.play(\n {\n ...timelineConfig,\n from,\n },\n canBeIntercepted\n )\n },\n }\n}\n","import type { Capitalize, PartialRecord, WithPrefix } from '~/utils/types'\n\nexport type EventHandler<\n AnimationContext = any,\n EvtKeys extends EventKey = EventKey,\n> = (\n animationContext: AnimationContext,\n ev: HTMLElementEventMap[EvtKeys]\n) => any\n\nexport type EventHandlerRegistration<\n AnimationContext = any,\n Keys extends EventKey = EventKey,\n> = PartialRecord<\n WithPrefix<'on', Capitalize<Keys>>,\n EventHandler<AnimationContext, Keys>\n>\n\nexport type EventKey = keyof HTMLElementEventMap\nexport class EventManager<\n SupportedEventList extends readonly EventKey[] = EventKey[],\n AnimationContext = any,\n> {\n public constructor(public readonly supportedEvents: SupportedEventList) {}\n\n private _element: HTMLElement | null = null\n public get targetElement(): HTMLElement {\n if (!this._element) throw new Error('EventManger, bind element first')\n return this._element\n }\n\n private _animeGetter: (() => AnimationContext) | null = null\n public get animeGetter(): () => AnimationContext {\n if (!this._animeGetter)\n throw new Error('EventManager, animeGetter should be provided')\n return this._animeGetter\n }\n public setAnimeGetter = (animeGetter: () => AnimationContext) => {\n this._animeGetter = animeGetter\n }\n\n private eventMap: Map<\n string,\n (e: HTMLElementEventMap[SupportedEventList[number]]) => void\n > = new Map()\n\n private withAnimeValue = (\n listener: EventHandler<AnimationContext, SupportedEventList[number]>\n ): ((e: HTMLElementEventMap[SupportedEventList[number]]) => void) => {\n const withAnime = (\n e: HTMLElementEventMap[SupportedEventList[number]]\n ) => {\n listener(this.animeGetter(), e)\n }\n return withAnime\n }\n\n public add = <const EventName extends SupportedEventList[number]>(\n eventName: EventName,\n listener: EventHandler<AnimationContext, SupportedEventList[number]>,\n options?: boolean | AddEventListenerOptions\n ) => {\n const withAnime = this.withAnimeValue(listener)\n this.eventMap.set(eventName, withAnime)\n this.targetElement.addEventListener<EventName>(\n eventName,\n this.eventMap.get(eventName)!,\n options\n )\n }\n\n public cleanupOne = <const EventName extends SupportedEventList[number]>(\n eventName: EventName\n ): boolean => {\n const removeListener = this.eventMap.get(eventName)\n if (!removeListener) return false\n\n this.targetElement.removeEventListener(eventName, removeListener)\n return true\n }\n\n public cleanupAll = (): boolean => {\n const clearResponse: Array<boolean> = []\n for (const evtName of this.eventMap.keys()) {\n const res = this.cleanupOne(evtName as SupportedEventList[number])\n clearResponse.push(res)\n }\n return clearResponse.some((t) => t === false) === false\n }\n\n /**\n * get pure `{event_name}`\n * @param key onX`{event_name}`\n */\n public static getEvtKey(key: string): EventKey {\n const removed = key.substring(2, key.length)\n const Capitalized = `${removed[0]!.toLowerCase()}${removed.substring(1, key.length)}`\n return Capitalized as EventKey\n }\n\n public attach = (\n handlers: EventHandlerRegistration<\n AnimationContext,\n SupportedEventList[number]\n >\n ): void => {\n Object.entries(handlers).forEach(([eventKey, handler]) => {\n this.add(\n EventManager.getEvtKey(eventKey),\n handler as EventHandler<\n AnimationContext,\n SupportedEventList[number]\n >\n )\n })\n }\n\n public bind(element: HTMLElement): void {\n this._element = element\n }\n}\n","const TransformFunctionMap = {\n // deg\n rotate: { fn: 'rotate', unit: 'deg' },\n rotateX: { fn: 'rotateX', unit: 'deg' },\n rotateY: { fn: 'rotateY', unit: 'deg' },\n rotateZ: { fn: 'rotateZ', unit: 'deg' },\n skew: { fn: 'skew', unit: 'deg' },\n skewX: { fn: 'skewX', unit: 'deg' },\n skewY: { fn: 'skewY', unit: 'deg' },\n // px\n translate: { fn: 'translate', unit: 'px' },\n translateX: { fn: 'translateX', unit: 'px' },\n translateY: { fn: 'translateY', unit: 'px' },\n translateZ: { fn: 'translateZ', unit: 'px' },\n // unitless\n scale: { fn: 'scale' },\n scaleX: { fn: 'scaleX' },\n scaleY: { fn: 'scaleY' },\n scaleZ: { fn: 'scaleZ' },\n} as const satisfies Record<string, { fn: string; unit?: string }>\n\ntype TransformPropertiesLiteral = keyof typeof TransformFunctionMap\n\nconst TransformProperties = new Set(Object.keys(TransformFunctionMap))\n\ntype PxPropertiesLiteral =\n | 'width'\n | 'height'\n | 'margin'\n | 'marginTop'\n | 'marginBottom'\n | 'marginLeft'\n | 'marginRight'\n | 'padding'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'top'\n | 'left'\n | 'right'\n | 'bottom'\n | 'borderWidth'\n | 'borderRadius'\n\nconst PxProperties = new Set([\n 'width',\n 'height',\n 'margin',\n 'marginTop',\n 'marginBottom',\n 'marginLeft',\n 'marginRight',\n 'padding',\n 'paddingTop',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingRight',\n 'top',\n 'left',\n 'right',\n 'bottom',\n 'borderWidth',\n 'borderRadius',\n])\n\ntype UnitlessPropertiesLiteral =\n | 'opacity'\n | 'zIndex'\n | 'lineHeight'\n | 'fontWeight'\n\nconst UnitlessProperties = new Set([\n 'opacity',\n 'zIndex',\n 'lineHeight',\n 'fontWeight',\n])\n\nexport type StylesheetSupportedLiteral =\n | TransformPropertiesLiteral\n | PxPropertiesLiteral\n | UnitlessPropertiesLiteral\n\nexport type Resolver<T> = {\n [Key in keyof T]?: (target: T[keyof T]) => {\n key: string\n value: string | number\n }\n}\n\ntype StylesheetValueTarget = Record<string, number>\n\nexport function createStyleSheet(\n animeStyleValue: StylesheetValueTarget,\n resolver?: Resolver<StylesheetValueTarget>\n): Record<string, any> {\n const styleAccumulator: Record<string, any> = {}\n const CssTransformParts: Array<string> = []\n\n for (const key in animeStyleValue) {\n if (!Object.hasOwn(animeStyleValue, key)) {\n continue\n }\n const value = animeStyleValue[key]\n\n if (typeof value !== 'number') {\n continue\n }\n\n // Custom Resolver\n const styleResolver = resolver?.[key]\n if (styleResolver) {\n const { key: resolvedKey, value: resolvedValue } =\n styleResolver(value)\n\n styleAccumulator[resolvedKey] = resolvedValue\n continue\n }\n\n // Transform\n if (TransformProperties.has(key)) {\n const res = TransformFunctionMap[key as TransformPropertiesLiteral]\n\n const transformPart =\n 'unit' in res\n ? `${res.fn}(${value}${res.unit})`\n : `${res.fn}(${value})`\n\n CssTransformParts.push(transformPart)\n continue\n }\n\n // PX\n if (PxProperties.has(key)) {\n styleAccumulator[key] = `${value}px`\n continue\n }\n\n // Unitless\n if (UnitlessProperties.has(key)) {\n styleAccumulator[key] = value\n continue\n }\n\n // Fallback\n styleAccumulator[key] = value\n }\n\n // Combine Transform Syntax\n if (CssTransformParts.length > 0) {\n styleAccumulator['transform'] = CssTransformParts.join(' ')\n }\n\n return styleAccumulator\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAe,gBAAf,MAAkD;AAAA,EAMrD,YAAY,IAAkB;AAC1B,QAAI,IAAI;AACJ,WAAK,KAAK;AAAA,IACd;AAAA,EACJ;AAQJ;;;ACLO,IAAe,iBAAf,MAA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BAAiB,GAAG,IAAI;AAAA,EAC5B;AAGA,MAAI,kBAAkB,SAAS,GAAG;AAC9B,qBAAiB,WAAW,IAAI,kBAAkB,KAAK,GAAG;AAAA,EAC9D;AAEA,SAAO;AACX;;;ArBxIO,IAAM,IAAI;AAAA,EACb,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;","names":["a","children","Timeline","timeline"]}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ani/nodes/base.ts","../src/timing/function.ts","../src/timing/linear.ts","../src/timing/bezier.ts","../src/timing/dynamic_spring.ts","../src/timing/spring.ts","../src/timing/index.ts","../src/ani/nodes/segment.ts","../src/ani/nodes/composition.ts","../src/ani/nodes/delay.ts","../src/ani/nodes/loop.ts","../src/ani/nodes/parallel.ts","../src/ani/nodes/sequence.ts","../src/ani/nodes/stagger.ts","../src/loop/clock.ts","../src/utils/time/is_end.ts","../src/ani/engine.ts","../src/ani/timeline.ts","../src/ani/states.ts","../src/event/manager.ts","../src/style/create_sheet.ts","../src/index.ts"],"sourcesContent":["import type { ExecutionPlan, Groupable } from '../timeline'\n\nexport type AnimationId = string\nexport type AnimationNodeType = string\nexport type AnimationDuration = number\n\n/**\n * Nodes in the animation tree\n */\nexport abstract class AnimationNode<G extends Groupable> {\n abstract readonly type: AnimationNodeType\n abstract readonly duration: AnimationDuration\n\n readonly id?: AnimationId\n\n constructor(id?: AnimationId) {\n if (id) {\n this.id = id\n }\n }\n\n /**\n * Constructs self node and its children into a flat execution plan.\n * @param plan Execution plans to which segments will be added.\n * @param startTime The absolute current start time for this node within the master timeline.\n */\n public abstract construct(plan: ExecutionPlan<G>, startTime: number): void\n}\n\nexport type ExtractAnimationNode<AnimeNode> = AnimeNode extends AnimationNode<\n infer Group\n>\n ? Group\n : never\n","export interface TimingFunctionContext {\n /**\n * delta t\n */\n dt: number\n /**\n * from value, initial position (`s(0)`)\n */\n from: number\n /**\n * to value, original position (`s(f)`)\n */\n to: number\n /**\n * animation duration, but it is not possible for specific functions\n */\n duration: number\n /**\n * animation end tolerance\n */\n tolerance?: number\n}\nexport abstract class TimingFunction {\n /**\n * Step function\n * @param time Current time\n * @param context Context for step calculation\n */\n public abstract step(\n time: number,\n context: TimingFunctionContext\n ): {\n value: number\n endOfAnimation: boolean\n }\n\n private static DEFAULT_TOLERANCE = 0.01 as const\n /**\n * Checks whether the animation has ended.\n *\n * @param time - The current time.\n * @param value - The computed value at the current time.\n * @param context - The animation context.\n * @returns {boolean} True if the animation is ended, false otherwise.\n */\n protected checkEnd(\n time: number,\n value: number,\n context: TimingFunctionContext,\n checkTimeOnly: boolean = true\n ): boolean {\n const tol =\n context.tolerance !== undefined\n ? context.tolerance\n : TimingFunction.DEFAULT_TOLERANCE\n const timeCondition = time >= context.duration\n const end = checkTimeOnly\n ? timeCondition\n : timeCondition && Math.abs(context.to - value) <= tol\n return end\n }\n}\n\nexport interface Coord {\n x: number\n y: number\n}\n","import { TimingFunction, type TimingFunctionContext } from './function'\n\nexport class LinearTimingFunction extends TimingFunction {\n public step(\n time: number,\n context: TimingFunctionContext\n ): { value: number; endOfAnimation: boolean } {\n const progress =\n context.duration === 0\n ? 1\n : Math.max(0, Math.min(time / context.duration, 1))\n\n const value = context.from + (context.to - context.from) * progress\n\n return { value, endOfAnimation: time >= context.duration }\n }\n}\n","/** biome-ignore-all lint/style/noMagicNumbers: <>*/\nimport {\n type Coord,\n TimingFunction,\n type TimingFunctionContext,\n} from './function'\n\nexport interface BezierTimingFunctionOpt {\n p2: Coord\n p3: Coord\n}\nexport class BezierTimingFunction extends TimingFunction {\n public constructor(public readonly opt: { p2: Coord; p3: Coord }) {\n super()\n }\n private readonly p1: Coord = {\n x: 0,\n y: 0,\n }\n private readonly p4: Coord = {\n x: 1,\n y: 1,\n }\n\n private _bezierFunction(t: number, duration?: number): number {\n const end: number = duration || this.p4.y\n return (\n (1 - t) ** 3 * this.p1.y +\n 3 * (1 - t) ** 2 * t * this.opt.p2.y +\n 3 * (1 - t) * t ** 2 * this.opt.p3.y +\n t ** 3 * end\n )\n }\n\n public step(\n time: number,\n context: TimingFunctionContext\n ): { value: number; endOfAnimation: boolean } {\n const f = this._bezierFunction(time, context.duration)\n return {\n value: f,\n endOfAnimation:\n (context.duration\n ? time >= context.duration\n : time >= this.p4.x) && f >= context.to,\n }\n }\n}\n","import { TimingFunction, type TimingFunctionContext } from './function'\n\nimport type { SpringTimingFunctionOpt } from './spring'\n\nexport class DynamicSpringTimingFunction extends TimingFunction {\n public constructor(public readonly opt: SpringTimingFunctionOpt) {\n super()\n }\n\n private currentValue: number = 0\n private currentVelocity: number = 0\n private isInitialized: boolean = false\n\n public init(startValue: number): void {\n this.currentValue = startValue\n this.currentVelocity = 0\n this.isInitialized = true\n }\n\n private getDerivatives(\n state: { x: number; v: number },\n to: number\n ): { dx: number; dv: number } {\n const { m, k, c } = this.opt\n const displacement = state.x - to\n\n const a = (-k * displacement - c * state.v) / m\n\n return { dx: state.v, dv: a }\n }\n\n public step(\n _time: number,\n context: TimingFunctionContext\n ): {\n value: number\n endOfAnimation: boolean\n } {\n if (!this.isInitialized) {\n this.init(context.from)\n }\n\n const { to, tolerance, dt } = context\n\n if (dt === 0) {\n return {\n value: this.currentValue,\n endOfAnimation: false, // Or check for end state\n }\n }\n\n const x = this.currentValue\n const v = this.currentVelocity\n\n // RK4\n // k1\n const k1 = this.getDerivatives({ x, v }, to)\n // k2\n const k2State = {\n x: x + k1.dx * (dt / 2),\n v: v + k1.dv * (dt / 2),\n }\n const k2 = this.getDerivatives(k2State, to)\n // k3\n const k3State = {\n x: x + k2.dx * (dt / 2),\n v: v + k2.dv * (dt / 2),\n }\n const k3 = this.getDerivatives(k3State, to)\n // k4\n const k4State = {\n x: x + k3.dx * dt,\n v: v + k3.dv * dt,\n }\n const k4 = this.getDerivatives(k4State, to)\n\n const avgDx = (1.0 / 6.0) * (k1.dx + 2 * k2.dx + 2 * k3.dx + k4.dx)\n const avgDv = (1.0 / 6.0) * (k1.dv + 2 * k2.dv + 2 * k3.dv + k4.dv)\n\n this.currentValue = x + avgDx * dt\n this.currentVelocity = v + avgDv * dt\n\n // Check for end of animation\n const tol = tolerance ?? 1e-3\n const displacement = this.currentValue - to\n const isMoving = Math.abs(this.currentVelocity) > tol\n const isDisplaced = Math.abs(displacement) > tol\n const endOfAnimation = !isMoving && !isDisplaced\n\n if (endOfAnimation) {\n // Snap to final value\n this.currentValue = to\n this.currentVelocity = 0\n }\n\n return {\n value: this.currentValue,\n endOfAnimation: endOfAnimation,\n }\n }\n}\n","import { TimingFunction, type TimingFunctionContext } from './function'\n\nexport interface SpringTimingFunctionOpt {\n /**\n * Mass constant.\n */\n m: number\n /**\n * Spring constant.\n */\n k: number\n /**\n * Damping constant.\n */\n c: number\n /**\n * End of spring animation threshold.\n * @default 1e-3\n */\n tolerance?: number\n}\nexport class SpringTimingFunction extends TimingFunction {\n public constructor(public readonly opt: SpringTimingFunctionOpt) {\n super()\n if (!this.opt.tolerance) {\n const DEFAULT_TOLERANCE = 1e-3 as const\n this.opt.tolerance = DEFAULT_TOLERANCE\n }\n }\n\n public step(\n time: number,\n context: TimingFunctionContext\n ): {\n value: number\n endOfAnimation: boolean\n } {\n // mass-spring-damper\n // ODE\n const m = this.opt.m\n const k = this.opt.k\n const c = this.opt.c\n const tolerance = this.opt.tolerance!\n\n // Initial D\n const d0 = context.from - context.to\n\n if (typeof d0 !== 'number') {\n throw new TypeError(\n 'Spring step function, needs initial displacement d(0) = context.start'\n )\n }\n\n const wN = Math.sqrt(k / m)\n const zetta = c / (2 * Math.sqrt(m * k))\n const Ms = 1000 as const\n\n if (zetta < 1) {\n // under-damped system\n const settlingTime = (-1 / (zetta * wN)) * Math.log(tolerance)\n const t = context?.duration\n ? (settlingTime / context.duration) * time\n : time\n\n const C1 = d0\n const C2 = (zetta / Math.sqrt(1 - zetta ** 2)) * d0\n const ode =\n Math.exp(-zetta * wN * t) *\n (C1 * Math.cos(wN * Math.sqrt(1 - zetta ** 2) * t) +\n C2 * Math.sin(wN * Math.sqrt(1 - zetta ** 2) * t)) +\n context.to\n\n return {\n value: ode,\n endOfAnimation: t >= settlingTime && ode >= context.to,\n }\n }\n\n if (zetta === 1) {\n // critically-damped system\n const settlingTime = (-1 / wN) * Math.log(tolerance)\n const t = context?.duration\n ? (settlingTime / context.duration) * time\n : time\n\n const C1 = d0\n const C2 = wN * d0\n const ode = (C1 + C2 * t) * Math.exp(-wN * t) + context.to\n\n return {\n value: ode,\n endOfAnimation:\n t >= settlingTime &&\n Math.abs(ode - context.to) <= context.to / Ms,\n }\n }\n\n if (zetta > 1) {\n // overdamped system\n const settlingTime = (-1 / (zetta * wN)) * Math.log(tolerance)\n const t = context?.duration\n ? (settlingTime / context.duration) * time\n : time\n\n const delta = Math.sqrt(zetta ** 2 - 1)\n const lambda1 = -zetta * wN + wN * delta\n const lambda2 = -zetta * wN - wN * delta\n\n const C2 = (-lambda1 * d0) / (lambda2 - lambda1)\n const C1 = d0 - C2\n\n // ODE solution\n const ode =\n C1 * Math.exp(lambda1 * t) +\n C2 * Math.exp(lambda2 * t) +\n context.to\n\n return {\n value: ode,\n endOfAnimation:\n t >= settlingTime &&\n Math.abs(ode - context.to) <= context.to / Ms,\n }\n }\n\n throw new Error('invalid system')\n }\n}\n","export * from './function'\nexport * from './linear'\n\nimport * as Bezier from './bezier'\nimport { DynamicSpringTimingFunction } from './dynamic_spring'\nimport { LinearTimingFunction } from './linear'\nimport { SpringTimingFunction, type SpringTimingFunctionOpt } from './spring'\n\n/**\n * Core timing functions\n */\nexport const T = {\n /**\n * Creates a new Bezier timing function instance.\n *\n * @param {Bezier.BezierTimingFunctionOpt} opt - Options for configuring the Bezier curve.\n */\n bezier: (opt: Bezier.BezierTimingFunctionOpt) =>\n new Bezier.BezierTimingFunction(opt),\n\n /**\n * Creates a new Spring timing function instance.\n *\n * @param {SpringTimingFunctionOpt} opt - Options for configuring the Spring timing function.\n */\n spring: (opt: SpringTimingFunctionOpt) => new SpringTimingFunction(opt),\n\n /**\n * Creates a new Dynamic Spring timing function instance.\n *\n * @param SpringTimingFunctionOpt} opt - Options for configuring the Spring timing function.\n */\n dynamicSpring: (opt: SpringTimingFunctionOpt) =>\n new DynamicSpringTimingFunction(opt),\n\n /**\n * Creates linear timing function instance.\n */\n linear: () => new LinearTimingFunction(),\n} as const\n","import type { SegmentTiming } from '../engine'\nimport type { ExecutionPlan, Groupable } from '../timeline'\nimport { type AnimationId, AnimationNode } from './base'\n\nexport interface SegmentNodeProps<G extends Groupable> {\n readonly to: G\n readonly duration: number\n readonly timing?: SegmentTiming<G>\n}\n\n/**\n * Leaf node in the animation tree\n */\nexport class SegmentNode<G extends Groupable> extends AnimationNode<G> {\n readonly type = 'SEGMENT'\n readonly props: SegmentNodeProps<G>\n\n constructor(props: SegmentNodeProps<G>, id?: AnimationId) {\n super(id)\n const nodeProps: SegmentNodeProps<G> = {\n to: props.to,\n duration: props.duration,\n ...(props.timing !== undefined && { timing: props.timing }),\n }\n this.props = nodeProps\n }\n\n public get duration(): number {\n return this.props.duration\n }\n\n public construct(plan: ExecutionPlan<G>, startTime: number): void {\n plan.push({\n node: this,\n startTime: startTime,\n endTime: startTime + this.duration,\n })\n }\n}\n\n/**\n * Factory function to create a ani SegmentNode.\n */\nexport function ani<G extends Groupable>(\n props: SegmentNodeProps<G>,\n id?: AnimationId\n): SegmentNode<G> {\n return new SegmentNode(props, id)\n}\n","import { LinearTimingFunction, type TimingFunction } from '~/timing'\nimport type { ExecutionPlan, Groupable } from '../timeline'\nimport {\n type AnimationId,\n AnimationNode,\n type ExtractAnimationNode,\n} from './base'\nimport { SegmentNode } from './segment'\n\nexport type CompositionChildren = readonly AnimationNode<Groupable>[]\nexport type CompositionPlan<Children extends CompositionChildren> =\n ExecutionPlan<ExtractAnimationNode<Children[number]>>\n\n/**\n * Composition animation\n */\nexport abstract class CompositionNode<\n const Children extends CompositionChildren,\n> extends AnimationNode<ExtractAnimationNode<Children[number]>> {\n /**\n * Composition children nodes.\n */\n public readonly children: Children\n\n constructor(children: Children, timing?: TimingFunction, id?: AnimationId) {\n super(id)\n\n const parentTiming: TimingFunction =\n timing ?? new LinearTimingFunction()\n\n const adjustTiming = <T extends CompositionChildren>(\n children: T\n ): T => {\n return children.map((child) => {\n if (\n child instanceof SegmentNode &&\n // child timing none >> override to parent\n child.props.timing === undefined &&\n timing\n ) {\n return new SegmentNode(\n {\n ...child.props,\n timing: parentTiming,\n },\n child.id\n )\n }\n\n if (child instanceof CompositionNode) {\n // @ts-ignore\n child.children = adjustTiming(child.children)\n return child\n }\n\n return child\n }) as unknown as T\n }\n\n const timingOverridingChildren = adjustTiming(children)\n this.children = timingOverridingChildren\n }\n}\n","import type { AnimationId } from './base'\nimport { SegmentNode } from './segment'\n\ntype PreserveRecord = Record<string, any>\n\n/**\n * Creates a pause in an animation sequence.\n * @param duration The duration of the delay in seconds.\n * @param id Optional ID for the node.\n */\nexport function delay(\n duration: number,\n id?: AnimationId\n): SegmentNode<PreserveRecord> {\n return new SegmentNode<PreserveRecord>({ to: {}, duration }, id)\n}\n","import type { TimingFunction } from '~/timing'\nimport type { Groupable } from '../timeline'\nimport type { AnimationId, AnimationNode } from './base'\nimport { CompositionNode, type CompositionPlan } from './composition'\n\n/**\n * Composition node that repeats a child animation node a specified number of times.\n */\nexport class LoopNode<G extends Groupable> extends CompositionNode<\n readonly AnimationNode<G>[]\n> {\n readonly type = 'LOOP'\n readonly duration: number\n readonly count: number\n readonly child: AnimationNode<G>\n\n constructor(\n child: AnimationNode<G>,\n loopCount: number,\n timing?: TimingFunction,\n id?: AnimationId\n ) {\n super([child], timing, id)\n this.child = child\n this.count = loopCount\n this.duration = child.duration * loopCount\n }\n\n public construct(\n plan: CompositionPlan<readonly AnimationNode<G>[]>,\n startTime: number\n ): void {\n let currentTime = startTime\n for (let i = 0; i < this.count; i++) {\n this.child.construct(plan, currentTime)\n currentTime += this.child.duration\n }\n }\n}\n\n/**\n * Repeats a child animation node a specified number of times.\n * @param child The animation node to repeat.\n * @param loopCount The number of times to repeat the child node.\n * @param timing loop timing function.\n * @param id Optional ID for the node.\n */\nexport function loop<G extends Groupable>(\n child: AnimationNode<G>,\n loopCount: number,\n timing?: TimingFunction,\n id?: AnimationId\n): LoopNode<G> {\n return new LoopNode(child, loopCount, timing, id)\n}\n","import type { TimingFunction } from '~/timing'\nimport type { Groupable, GroupableRecord } from '../timeline'\nimport type { AnimationId, AnimationNode } from './base'\nimport {\n type CompositionChildren,\n CompositionNode,\n type CompositionPlan,\n} from './composition'\nimport { SegmentNode } from './segment'\n\n/**\n * Composition node that runs all of its children at the same time.\n */\nexport class ParallelNode<\n const Children extends CompositionChildren,\n> extends CompositionNode<Children> {\n readonly type = 'PARALLEL'\n readonly duration: number\n\n constructor(children: Children, timing?: TimingFunction, id?: AnimationId) {\n // Handle object property conflicts\n const seenProperty = new Set<string>()\n const resolvedChildren: AnimationNode<Groupable>[] = []\n\n for (const child of [...children].reverse()) {\n if (child instanceof SegmentNode) {\n const segment = child as SegmentNode<Groupable>\n const propsTo = segment.props.to\n\n // record shape\n if (propsTo && !Array.isArray(propsTo)) {\n const propsToAnimate = Object.keys(propsTo)\n const finalConstructedTo: Record<string, number> = {}\n let handledCount = 0\n\n for (const propKey of propsToAnimate) {\n if (!seenProperty.has(propKey)) {\n finalConstructedTo[propKey] = (\n propsTo as Record<string, number>\n )[propKey]!\n seenProperty.add(propKey)\n handledCount++\n }\n }\n\n if (handledCount > 0) {\n const newSegment = new SegmentNode<Groupable>(\n {\n ...segment.props,\n to: finalConstructedTo as GroupableRecord,\n },\n segment.id\n )\n resolvedChildren.push(newSegment)\n }\n continue // Go to next child\n }\n }\n\n // Non-conflicts\n resolvedChildren.push(child)\n }\n\n resolvedChildren.reverse()\n\n super(resolvedChildren as unknown as Children, timing, id)\n\n this.duration = Math.max(0, ...children.map((child) => child.duration))\n }\n\n public construct(plan: CompositionPlan<Children>, startTime: number): void {\n for (const child of this.children) {\n child.construct(plan, startTime)\n }\n }\n}\n\n/**\n * Parallel composition animation\n */\nexport function parallel<const Children extends CompositionChildren>(\n children: Children,\n timing?: TimingFunction,\n id?: AnimationId\n): ParallelNode<Children> {\n return new ParallelNode(children, timing, id)\n}\n","import type { TimingFunction } from '~/timing'\nimport type { AnimationId } from './base'\nimport {\n type CompositionChildren,\n CompositionNode,\n type CompositionPlan,\n} from './composition'\n\n/**\n * Composition node that runs its children one after another.\n */\nexport class SequenceNode<\n const Children extends CompositionChildren,\n> extends CompositionNode<Children> {\n readonly type = 'SEQUENCE'\n readonly duration: number\n\n constructor(children: Children, timing?: TimingFunction, id?: AnimationId) {\n super(children, timing, id)\n this.duration = children.reduce((sum, child) => sum + child.duration, 0)\n }\n\n public construct(plan: CompositionPlan<Children>, startTime: number): void {\n let currentTime = startTime\n for (const child of this.children) {\n child.construct(plan, currentTime)\n currentTime += child.duration\n }\n }\n}\n\n/**\n * Sequence composition animation\n */\nexport function sequence<const Children extends CompositionChildren>(\n children: Children,\n timing?: TimingFunction,\n id?: AnimationId\n): SequenceNode<Children> {\n return new SequenceNode(children, timing, id)\n}\n","import type { TimingFunction } from '~/timing'\nimport type { AnimationId } from './base'\nimport {\n type CompositionChildren,\n CompositionNode,\n type CompositionPlan,\n} from './composition'\n\ninterface StaggerNodeProps {\n offset: number\n timing?: TimingFunction\n}\n/**\n * Composition node that runs its children with a fixed delay between each start time.\n */\nexport class StaggerNode<\n const Children extends CompositionChildren,\n> extends CompositionNode<Children> {\n readonly type = 'STAGGER'\n readonly duration: number\n readonly offset: number\n\n constructor(children: Children, props: StaggerNodeProps, id?: AnimationId) {\n super(children, props?.timing, id)\n\n this.offset = props.offset\n\n if (children.length === 0) {\n this.duration = 0\n } else {\n const lastChild = children[children.length - 1]!\n this.duration =\n (children.length - 1) * this.offset + lastChild.duration\n }\n }\n\n public construct(plan: CompositionPlan<Children>, startTime: number): void {\n let currentTime = startTime\n for (const child of this.children) {\n child.construct(plan, currentTime)\n currentTime += this.offset\n }\n }\n}\n\n/**\n * Stagger composition animation\n */\nexport function stagger<const Children extends CompositionChildren>(\n children: Children,\n props: StaggerNodeProps,\n id?: AnimationId\n): StaggerNode<Children> {\n return new StaggerNode(children, props, id)\n}\n","export interface Animatable {\n /**\n * Update animation based on dt\n * @param dt delta time\n */\n update(dt: number): void\n}\n\n/**\n * Animation clock interface, can be user-injected.\n */\nexport interface AnimationClockInterface {\n subscribe(animatable: Animatable): void\n unsubscribe(animatable: Animatable): void\n}\n\nexport class AnimationClock implements AnimationClockInterface {\n private subscribers: Set<Animatable> = new Set()\n private animationFrameId: number | null = null\n private lastTimestamp: number = 0\n private maxDeltaTime: number\n\n protected static clock: AnimationClock\n /**\n * Crete new clock(singleton)\n * @param maxDeltaTime default maxDt = 100ms\n * @returns clock\n */\n public static create(maxDeltaTime: number = 1 / 10): AnimationClock {\n AnimationClock.clock = new AnimationClock(maxDeltaTime)\n return AnimationClock.clock\n }\n private constructor(maxDeltaTime: number) {\n this.maxDeltaTime = maxDeltaTime\n }\n\n public subscribe(animatable: Animatable): void {\n this.subscribers.add(animatable)\n if (!this.animationFrameId) {\n this.start()\n }\n }\n\n public unsubscribe(animatable: Animatable): void {\n this.subscribers.delete(animatable)\n if (this.subscribers.size === 0) {\n this.stop()\n }\n }\n\n private start(): void {\n this.lastTimestamp = performance.now()\n this.animationFrameId = window.requestAnimationFrame(this.tick)\n }\n\n private stop(): void {\n if (this.animationFrameId) {\n window.cancelAnimationFrame(this.animationFrameId)\n this.animationFrameId = null\n }\n }\n\n private tick = (timestamp: number): void => {\n if (!this.animationFrameId) return\n\n const MS = 1000 as const\n let dt = (timestamp - this.lastTimestamp) / MS\n this.lastTimestamp = timestamp\n\n // prevent large jumps or negatives\n if (dt < 0) dt = 0\n if (dt > this.maxDeltaTime) {\n dt = this.maxDeltaTime\n }\n\n for (const subscriber of this.subscribers) {\n subscriber.update(dt)\n }\n\n this.animationFrameId = window.requestAnimationFrame(this.tick)\n }\n}\n","export function isEndOfAnimation(\n currentT: number,\n duration: number,\n tolerance: number = 1e-3\n): boolean {\n return currentT === duration || currentT - duration >= tolerance\n}\n","import type { TimingFunction } from '~/timing'\nimport { isEndOfAnimation } from '~/utils/time'\nimport type { Groupable, GroupableRecord } from './timeline'\n\nexport type AnimePrimitive = readonly number[]\n\nexport interface SegmentDefinition {\n from: AnimePrimitive\n to: AnimePrimitive\n duration: number\n timing: SegmentTiming\n}\n\nexport type SegmentTiming<G extends Groupable = Groupable> =\n G extends AnimePrimitive\n ? readonly TimingFunction[] | TimingFunction\n : G extends GroupableRecord\n ? Record<keyof G, TimingFunction> | TimingFunction\n : never\n\nexport interface SegmentState {\n values: AnimePrimitive\n isComplete: boolean\n}\n\n/**\n * Calculates the animated values for a single segment at a specific local time.\n *\n * @param localTime Time elapsed within this specific segment (from 0 to duration).\n * @param segmentDef Target segment def\n * @parma dt Delta time\n * @returns Calculated values and whether the segment is complete.\n */\nexport function calculateSegmentState(\n localTime: number,\n segmentDef: SegmentDefinition,\n dt: number = 0\n): SegmentState {\n const t = Math.max(0, Math.min(localTime, segmentDef.duration))\n\n const animeValues: Array<number> = []\n let allComplete = true\n\n const isMultipleTiming = Array.isArray(segmentDef.timing)\n\n if (\n isMultipleTiming &&\n (segmentDef.timing as Array<TimingFunction>).length !==\n segmentDef.from.length\n ) {\n throw new TypeError(\n `[calculateSegmentState] timing does not correctly set. It requires multiple timing for ${segmentDef.from}, but received ${segmentDef.timing}`\n )\n }\n\n for (let i = 0; i < segmentDef.from.length; i++) {\n const timingFunction: TimingFunction = isMultipleTiming\n ? (segmentDef.timing as TimingFunction[])[i]!\n : (segmentDef.timing as TimingFunction)\n\n const animeResponse = timingFunction.step(t, {\n dt: dt,\n from: segmentDef.from[i]!,\n to: segmentDef.to[i]!,\n duration: segmentDef.duration,\n })\n\n animeValues.push(animeResponse.value)\n if (!animeResponse.endOfAnimation) {\n allComplete = false\n }\n }\n\n return {\n values: animeValues,\n isComplete: allComplete || isEndOfAnimation(t, segmentDef.duration),\n }\n}\n","import {\n type Animatable,\n AnimationClock,\n type AnimationClockInterface,\n} from '~/loop'\nimport type { Resolver, StylesheetSupportedLiteral } from '~/style'\nimport { TimingFunction } from '~/timing'\nimport { isEndOfAnimation } from '~/utils/time'\nimport type {\n Prettify,\n UnionToIntersection,\n WithLiteral,\n WithLiteralRecord,\n} from '~/utils/types'\nimport {\n type AnimePrimitive,\n calculateSegmentState,\n type SegmentDefinition,\n} from './engine'\nimport { type AnimationNode, SegmentNode, type SegmentNodeProps } from './nodes'\n\n/**\n * Animatable target values\n */\nexport type Groupable = AnimePrimitive | GroupableRecord\n\nexport type GroupableRecordKey = WithLiteral<StylesheetSupportedLiteral>\n\nexport type GroupableRecord = WithLiteralRecord<\n GroupableRecordKey,\n AnimePrimitive[number]\n>\n\nexport type AniGroup<G extends Groupable> = Prettify<UnionToIntersection<G>>\n\nexport interface ExecutionSegment<G extends Groupable> {\n /**\n * Execution segment node\n */\n node: SegmentNode<G>\n /**\n * Animation start time\n */\n startTime: number\n /**\n * Animation end time\n */\n endTime: number\n}\n\nexport type ExecutionPlan<G extends Groupable> = Array<ExecutionSegment<G>>\n\ntype TimelineStatus = 'IDLE' | 'PLAYING' | 'PAUSED' | 'ENDED'\nexport type OnUpdateCallback<G extends Groupable> = (current: {\n state: AniGroup<G>\n status: TimelineStatus\n}) => void\n\ntype ShouldKeepSymbol = 'keep'\ntype Keyframe<G extends Groupable> = Array<G | ShouldKeepSymbol>\ntype Duration = Array<number | ShouldKeepSymbol>\n\nexport interface TimelineStartingConfig<G extends Groupable, Ctx = any> {\n /**\n * Starting dynamic value.\n */\n from: AniGroup<G>\n /**\n * Dynamic `from` values, if passed `keep` for specific index, keep original timeline config.\n */\n keyframes?: Keyframe<G>\n /**\n * Dynamic `duration` values, if passed `keep` for specific index, keep original timeline config.\n */\n durations?: Duration\n /**\n * Custom context definition during animation cycle.\n */\n context?: Ctx\n /**\n * Animation repeat count.\n *\n * - if `Infinity` goes infinity repeat\n */\n repeat?: number\n\n /**\n * Initial delay before animation starts.\n *\n * - unit = `MS`\n */\n delay?: number\n\n /**\n * Custom style property resolver.\n *\n * @example\n * ```ts\n * const timeline = a.timeline(...)\n * timeline.play({\n * propertyResolver: {\n * 'px': (pxValue) => { key: `top`, value: `${pxValue}px` }\n * }\n * })\n * ```\n */\n propertyResolver?: G extends AnimePrimitive ? never : Resolver<G>\n}\n\n/**\n * Public timeline controller\n */\nexport interface TimelineController<G extends Groupable, Ctx = any> {\n /**\n * Play timeline\n * @param config Timeline starting configuration\n * @param canBeIntercepted if `true`, will play animation again even if already PLAYING.\n */\n play(\n config: TimelineStartingConfig<G, Ctx>,\n canBeIntercepted?: boolean\n ): void\n /**\n * Pause timeline\n */\n pause(): void\n /**\n * Resume timeline\n */\n resume(): void\n /**\n * Seek to target time\n * @param time\n */\n seek(time: number): void\n /**\n * Reset timeline\n */\n reset(): void\n}\n\nexport class Timeline<G extends Groupable, Ctx = any>\n implements TimelineController<G, Ctx>, Animatable\n{\n public readonly duration: number\n\n private readonly _baseExecutionPlan: ExecutionPlan<G>\n private _currentExecutionPlan: ExecutionPlan<G> | null = null\n\n private readonly _clock: AnimationClockInterface\n\n private _masterTime = 0\n\n private _delay = 0\n\n private _status: TimelineStatus = 'IDLE'\n private _currentConfig: TimelineStartingConfig<G, Ctx> | null = null\n /**\n * Current animation running config.\n */\n public get currentConfig() {\n return this._currentConfig\n }\n\n private _state: AnimePrimitive = []\n private _initialState: AnimePrimitive = []\n\n private _repeatCount: number = 0\n\n private _propertyKeyMap: Map<string, number> | null = null\n private _segmentStartStates = new Map<number, AnimePrimitive>()\n\n private _onUpdateCallbacks = new Set<OnUpdateCallback<G>>()\n\n constructor(\n /**\n * Animation construction root node.\n */\n protected readonly rootNode: AnimationNode<G>,\n clock?: AnimationClockInterface\n ) {\n this.duration = rootNode.duration\n this._baseExecutionPlan = this._constructExecutionPlan(rootNode)\n\n // default clock\n this._clock = clock ?? AnimationClock.create()\n\n // binding\n this.play.bind(this)\n this.pause.bind(this)\n this.seek.bind(this)\n this.resume.bind(this)\n this.reset.bind(this)\n }\n\n /**\n * Resolves a Group (like {x, y}) into keys and values.\n */\n private _resolveGroup(group: G): {\n keyMap: Map<string, number> | null\n values: AnimePrimitive\n } {\n if (Array.isArray(group)) {\n return { keyMap: null, values: group }\n }\n const keyMap = new Map(Object.keys(group).map((key, i) => [key, i]))\n const values = Object.values(group) as AnimePrimitive\n return { keyMap, values }\n }\n\n /**\n * Resolves the internal state (a number array) back into Group.\n */\n private _resolveStateToGroup(state: AnimePrimitive): AniGroup<G> {\n if (!this._propertyKeyMap) {\n return state as unknown as AniGroup<G>\n }\n const group = {} as Record<string, number>\n\n let i = 0\n for (const key of this._propertyKeyMap.keys()) {\n group[key] = state[i]!\n i++\n }\n return group as AniGroup<G>\n }\n\n /**\n * Compile animation execution plan\n */\n private _constructExecutionPlan(\n rootNode: AnimationNode<G>\n ): ExecutionPlan<G> {\n const plan: ExecutionPlan<G> = []\n rootNode.construct(plan, 0)\n return plan\n }\n\n /**\n * Calculates the exact state of the animation at point.\n */\n private _calculateStateAtTime(\n targetTime: number,\n dt: number = 0\n ): AnimePrimitive {\n if (this._initialState.length === 0 || !this._currentExecutionPlan) {\n return []\n }\n\n const nextState: Array<number> = [...this._initialState]\n let stateAtLastStartTime: Array<number> = [...this._initialState]\n\n for (const segment of this._currentExecutionPlan) {\n // Only for activated animation segment\n if (targetTime < segment.startTime) {\n continue\n }\n\n if (!segment.node.props.timing) {\n throw new Error(\n `[Timeline] timing should be provided. Please specify timing using a.timing.(...). Check target segment: ${JSON.stringify(segment, null, 2)}.`,\n { cause: segment }\n )\n }\n\n // Use the state before this segment for \"from\" calculation\n stateAtLastStartTime = [...nextState]\n\n const { keyMap, values: toValues } = this._resolveGroup(\n segment.node.props.to\n )\n const isRecordAni: boolean =\n this._propertyKeyMap !== null && keyMap !== null\n\n // From value calculations\n let fromValues: Array<number> = []\n const timings: Array<TimingFunction> = []\n const t = segment.node.props.timing\n const isRecordTiming: boolean = t && !(t instanceof TimingFunction)\n\n if (isRecordAni) {\n for (const key of keyMap!.keys()) {\n const index = this._propertyKeyMap!.get(key)!\n fromValues.push(stateAtLastStartTime[index]!)\n if (isRecordTiming) {\n timings.push(\n (t as Record<string, TimingFunction>)[key]!\n )\n }\n }\n } else {\n fromValues = stateAtLastStartTime\n }\n\n let finalAnimeValues: AnimePrimitive = []\n\n const localTime = targetTime - segment.startTime\n\n const segmentDef: SegmentDefinition = {\n from: fromValues,\n to: toValues,\n duration: segment.node.duration,\n timing: isRecordAni && isRecordTiming ? timings : t,\n }\n\n const segmentState = calculateSegmentState(\n localTime,\n segmentDef,\n dt\n )\n\n if (segmentState.isComplete) {\n finalAnimeValues = toValues // End target\n } else {\n finalAnimeValues = segmentState.values // Calculated current target\n }\n\n // Update next state\n if (isRecordAni) {\n // Record ani\n let i = 0\n for (const key of keyMap!.keys()) {\n const stateIndex = this._propertyKeyMap!.get(key)!\n if (stateIndex === -1) {\n continue\n }\n nextState[stateIndex] = finalAnimeValues[i]!\n i++\n }\n } else {\n // Array ani\n for (let i = 0; i < finalAnimeValues.length; i++) {\n nextState[i] = finalAnimeValues[i]!\n }\n }\n }\n\n return nextState\n }\n\n private _resolveExecutionPlan(\n keyframes?: Keyframe<G>,\n durations?: Duration\n ): ExecutionPlan<G> {\n if (!keyframes && !durations) {\n return [...this._baseExecutionPlan]\n }\n\n const segmentNodes = this._baseExecutionPlan.filter(\n (segment) => segment.node.type === 'SEGMENT'\n )\n const segLength = segmentNodes.length\n\n if (keyframes && keyframes.length !== segLength) {\n throw new Error(\n `Timeline keyframe mismatch: Expected ${segLength} keyframes, but received ${keyframes.length}.`\n )\n }\n if (durations && durations.length !== segLength) {\n throw new Error(\n `Timeline keyframe mismatch: Expected ${segLength} durations, but received ${durations.length}.`\n )\n }\n\n const newPlan: ExecutionPlan<G> = []\n\n let keyframeIndex = 0\n\n // Create dynamic to keyframes based plans\n for (const segment of this._baseExecutionPlan) {\n if (segment.node.type === 'SEGMENT') {\n const dynamicTo = keyframes?.[keyframeIndex]\n const dynamicDuration = durations?.[keyframeIndex]\n\n const newSegmentProps: SegmentNodeProps<G> = {\n ...segment.node.props,\n\n // >> dynamic to\n ...(dynamicTo && {\n to:\n dynamicTo === 'keep'\n ? segment.node.props.to\n : dynamicTo,\n }),\n\n // >> dynamic duration\n ...(dynamicDuration && {\n duration:\n dynamicDuration === 'keep'\n ? segment.node.props.duration\n : dynamicDuration,\n }),\n }\n\n const newSegment = new SegmentNode(\n newSegmentProps,\n segment.node.id\n )\n newPlan.push({ ...segment, node: newSegment })\n keyframeIndex++\n } else {\n // non-segment nodes\n newPlan.push({ ...segment })\n }\n }\n\n return newPlan\n }\n\n private notify(): void {\n for (const subscriber of this._onUpdateCallbacks) {\n subscriber({\n state: this._resolveStateToGroup(this._state),\n status: this._status,\n })\n }\n }\n\n public play(\n config: TimelineStartingConfig<G, Ctx>,\n canBeIntercepted: boolean = true\n ): void {\n if (this._status === 'PLAYING' && !canBeIntercepted) {\n return\n }\n\n const isRepeating =\n this._currentConfig?.repeat && this._currentConfig?.repeat >= 1\n const savedRepeatCount = isRepeating ? this._repeatCount : 0\n\n // can be intercepted -> reset\n this.reset(false)\n // recover repeat count\n this._repeatCount = savedRepeatCount\n\n // repeat exceed -> reset repeat\n if (isRepeating && this._repeatCount >= config.repeat!) {\n this._repeatCount = 0\n return\n }\n\n // update current config\n this._currentConfig = config\n\n if (this._repeatCount === 0) {\n this._delay = (this._currentConfig.delay ?? 0) * 1e-3 // MS\n }\n\n this._currentExecutionPlan = this._resolveExecutionPlan(\n config.keyframes,\n config.durations\n )\n\n const { keyMap: keys, values } = this._resolveGroup(config.from as G)\n this._propertyKeyMap = keys\n this._state = values\n this._initialState = values\n\n this._status = 'PLAYING'\n this._clock.subscribe(this)\n this.notify()\n }\n\n public pause(): void {\n this._status = 'PAUSED'\n this._clock.unsubscribe(this)\n }\n\n public resume(): void {\n if (this._status !== 'PAUSED') return\n this._status = 'PLAYING'\n this._clock.subscribe(this)\n }\n\n public reset(notify: boolean = true): void {\n this._status = 'IDLE'\n\n this._currentConfig = null\n\n this._masterTime = 0\n this._delay = 0\n\n this._state = []\n this._initialState = []\n\n this._propertyKeyMap = null\n\n this._segmentStartStates.clear()\n this._currentExecutionPlan = null\n\n this._clock.unsubscribe(this)\n\n this._repeatCount = 0\n\n if (notify) {\n this.notify()\n }\n }\n\n public seek(targetTime: number): void {\n if (this._status === 'PLAYING' || this._status === 'ENDED') {\n this.pause()\n }\n const seekTime = Math.max(0, Math.min(targetTime, this.duration))\n\n this._masterTime = seekTime\n this._state = this._calculateStateAtTime(seekTime, 0)\n\n this.notify()\n }\n\n public getCurrentValue(): AniGroup<G> | null {\n if (this._state.length === 0) return null\n return this._resolveStateToGroup(this._state)\n }\n\n public onUpdate(callback: OnUpdateCallback<G>): () => void {\n this._onUpdateCallbacks.add(callback)\n return () => {\n this._onUpdateCallbacks.delete(callback)\n }\n }\n\n update(dt: number): void {\n if (this._status !== 'PLAYING') {\n return\n }\n\n if (this._delay > 0) {\n this._delay -= dt\n if (this._delay < 0) {\n dt = -this._delay\n this._delay = 0\n } else {\n return\n }\n }\n\n this._masterTime += dt\n if (this._masterTime >= this.duration) {\n this._masterTime = this.duration\n }\n\n this._state = this._calculateStateAtTime(this._masterTime, dt)\n this.notify()\n\n if (isEndOfAnimation(this._masterTime, this.duration)) {\n // repeat update\n this._repeatCount += 1\n\n if (!this._currentConfig) {\n throw new Error(\n `[Timeline] currentConfig can not be null when update(dt)`\n )\n }\n\n // no-repeat -> ended(don't have to reset)\n const noRepeat = (this._currentConfig.repeat ?? 0) === 0\n\n if (noRepeat) {\n this._status = 'ENDED'\n this._clock.unsubscribe(this)\n this.notify()\n } else {\n this.play(this._currentConfig)\n }\n }\n }\n}\n\nexport function timeline<G extends Groupable, Ctx = any>(\n rootNode: AnimationNode<G>,\n clock?: AnimationClockInterface\n): Timeline<G, Ctx> {\n return new Timeline<G, Ctx>(rootNode, clock)\n}\n","import type { AnimationClockInterface } from '~/loop'\nimport type { AnimationNode, ExtractAnimationNode } from './nodes'\nimport {\n type AniGroup,\n type Groupable,\n type Timeline,\n type TimelineStartingConfig,\n timeline,\n} from './timeline'\n\nexport type AnimationStateShape = Record<string, AnimationNode<Groupable>>\n\nexport type GetTimeline<State extends AnimationStateShape> = Timeline<\n ExtractAnimationNode<State[keyof State]>,\n any\n>\n\nexport interface StateController<AnimationStates extends AnimationStateShape> {\n /**\n * Get current timeline.\n */\n timeline: () => GetTimeline<AnimationStates>\n\n /**\n * Transition timeline animation into another state.\n * @param newState transition target.\n *\n * @param timelineConfig animation play config.\n * @param canBeIntercepted animation canBeIntercepted config.\n */\n transitionTo(\n newState: keyof AnimationStates,\n timelineConfig?: TimelineStartingConfig<\n ExtractAnimationNode<AnimationStates[keyof AnimationStates]>,\n any\n >,\n canBeIntercepted?: boolean\n ): void\n\n /**\n * Subscribe to timeline changes.\n * @param callback\n * @returns unsubscribe function\n */\n onTimelineChange(\n callback: (newTimeline: GetTimeline<AnimationStates>) => void\n ): () => void\n}\n\nexport interface StateProps<AnimationStates extends AnimationStateShape> {\n /**\n * Initial animation target state.\n */\n initial: keyof AnimationStates\n /**\n * Initial animation `from` value.\n */\n initialFrom: AniGroup<\n ExtractAnimationNode<AnimationStates[keyof AnimationStates]>\n >\n /**\n * Animating target states.\n */\n states: AnimationStates\n /**\n * Custom timeline clock\n */\n clock?: AnimationClockInterface\n}\n\n/**\n * Creates a state machine controller for managing animations.\n *\n * @param config - The configuration for the state machine.\n * @param clock - Optional custom animation clock.\n * @returns A controller for managing the animation states.\n */\nexport function createStates<AnimationStates extends AnimationStateShape>(\n config: StateProps<AnimationStates>\n): StateController<AnimationStates> {\n let State: keyof AnimationStates = config.initial\n let Timeline: Timeline<Groupable> = timeline(\n config.states[State]!,\n config.clock\n )\n\n const subs = new Set<(newTimeline: GetTimeline<AnimationStates>) => void>()\n const notify = (timeline: GetTimeline<AnimationStates>) => {\n for (const Sub of subs) {\n Sub(timeline)\n }\n }\n\n return {\n timeline: () => Timeline as unknown as GetTimeline<AnimationStates>,\n onTimelineChange(callback) {\n subs.add(callback)\n return () => subs.delete(callback)\n },\n transitionTo(newState, timelineConfig, canBeIntercepted) {\n // keep current timeline\n if (!config.states[newState] || State === newState) {\n return\n }\n\n // new timeline\n const from = (timelineConfig?.from ?? // 1. config\n Timeline.getCurrentValue() ?? // 2. last value\n config.initialFrom) as TimelineStartingConfig<Groupable>['from'] // 3. initial value\n\n State = newState\n Timeline = timeline(config.states[State]!, config.clock)\n notify(Timeline as unknown as GetTimeline<AnimationStates>)\n\n Timeline.play(\n {\n ...timelineConfig,\n from,\n },\n canBeIntercepted\n )\n },\n }\n}\n","import type { Capitalize, PartialRecord, WithPrefix } from '~/utils/types'\n\nexport type EventHandler<\n AnimationContext = any,\n EvtKeys extends EventKey = EventKey,\n> = (\n animationContext: AnimationContext,\n ev: HTMLElementEventMap[EvtKeys]\n) => any\n\nexport type EventHandlerRegistration<\n AnimationContext = any,\n Keys extends EventKey = EventKey,\n> = PartialRecord<\n WithPrefix<'on', Capitalize<Keys>>,\n EventHandler<AnimationContext, Keys>\n>\n\nexport type EventKey = keyof HTMLElementEventMap\nexport class EventManager<\n SupportedEventList extends readonly EventKey[] = EventKey[],\n AnimationContext = any,\n> {\n public constructor(public readonly supportedEvents: SupportedEventList) {}\n\n private _element: HTMLElement | null = null\n public get targetElement(): HTMLElement {\n if (!this._element) throw new Error('EventManger, bind element first')\n return this._element\n }\n\n private _animeGetter: (() => AnimationContext) | null = null\n public get animeGetter(): () => AnimationContext {\n if (!this._animeGetter)\n throw new Error('EventManager, animeGetter should be provided')\n return this._animeGetter\n }\n public setAnimeGetter = (animeGetter: () => AnimationContext) => {\n this._animeGetter = animeGetter\n }\n\n private eventMap: Map<\n string,\n (e: HTMLElementEventMap[SupportedEventList[number]]) => void\n > = new Map()\n\n private withAnimeValue = (\n listener: EventHandler<AnimationContext, SupportedEventList[number]>\n ): ((e: HTMLElementEventMap[SupportedEventList[number]]) => void) => {\n const withAnime = (\n e: HTMLElementEventMap[SupportedEventList[number]]\n ) => {\n listener(this.animeGetter(), e)\n }\n return withAnime\n }\n\n public add = <const EventName extends SupportedEventList[number]>(\n eventName: EventName,\n listener: EventHandler<AnimationContext, SupportedEventList[number]>,\n options?: boolean | AddEventListenerOptions\n ) => {\n const withAnime = this.withAnimeValue(listener)\n this.eventMap.set(eventName, withAnime)\n this.targetElement.addEventListener<EventName>(\n eventName,\n this.eventMap.get(eventName)!,\n options\n )\n }\n\n public cleanupOne = <const EventName extends SupportedEventList[number]>(\n eventName: EventName\n ): boolean => {\n const removeListener = this.eventMap.get(eventName)\n if (!removeListener) return false\n\n this.targetElement.removeEventListener(eventName, removeListener)\n return true\n }\n\n public cleanupAll = (): boolean => {\n const clearResponse: Array<boolean> = []\n for (const evtName of this.eventMap.keys()) {\n const res = this.cleanupOne(evtName as SupportedEventList[number])\n clearResponse.push(res)\n }\n return clearResponse.some((t) => t === false) === false\n }\n\n /**\n * get pure `{event_name}`\n * @param key onX`{event_name}`\n */\n public static getEvtKey(key: string): EventKey {\n const removed = key.substring(2, key.length)\n const Capitalized = `${removed[0]!.toLowerCase()}${removed.substring(1, key.length)}`\n return Capitalized as EventKey\n }\n\n public attach = (\n handlers: EventHandlerRegistration<\n AnimationContext,\n SupportedEventList[number]\n >\n ): void => {\n Object.entries(handlers).forEach(([eventKey, handler]) => {\n this.add(\n EventManager.getEvtKey(eventKey),\n handler as EventHandler<\n AnimationContext,\n SupportedEventList[number]\n >\n )\n })\n }\n\n public bind(element: HTMLElement): void {\n this._element = element\n }\n}\n","const TransformFunctionMap = {\n // deg\n rotate: { fn: 'rotate', unit: 'deg' },\n rotateX: { fn: 'rotateX', unit: 'deg' },\n rotateY: { fn: 'rotateY', unit: 'deg' },\n rotateZ: { fn: 'rotateZ', unit: 'deg' },\n skew: { fn: 'skew', unit: 'deg' },\n skewX: { fn: 'skewX', unit: 'deg' },\n skewY: { fn: 'skewY', unit: 'deg' },\n // px\n translate: { fn: 'translate', unit: 'px' },\n translateX: { fn: 'translateX', unit: 'px' },\n translateY: { fn: 'translateY', unit: 'px' },\n translateZ: { fn: 'translateZ', unit: 'px' },\n // unitless\n scale: { fn: 'scale' },\n scaleX: { fn: 'scaleX' },\n scaleY: { fn: 'scaleY' },\n scaleZ: { fn: 'scaleZ' },\n} as const satisfies Record<string, { fn: string; unit?: string }>\n\ntype TransformPropertiesLiteral = keyof typeof TransformFunctionMap\n\nconst TransformProperties = new Set(Object.keys(TransformFunctionMap))\n\ntype PxPropertiesLiteral =\n | 'width'\n | 'height'\n | 'margin'\n | 'marginTop'\n | 'marginBottom'\n | 'marginLeft'\n | 'marginRight'\n | 'padding'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'top'\n | 'left'\n | 'right'\n | 'bottom'\n | 'borderWidth'\n | 'borderRadius'\n\nconst PxProperties = new Set([\n 'width',\n 'height',\n 'margin',\n 'marginTop',\n 'marginBottom',\n 'marginLeft',\n 'marginRight',\n 'padding',\n 'paddingTop',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingRight',\n 'top',\n 'left',\n 'right',\n 'bottom',\n 'borderWidth',\n 'borderRadius',\n])\n\ntype UnitlessPropertiesLiteral =\n | 'opacity'\n | 'zIndex'\n | 'lineHeight'\n | 'fontWeight'\n\nconst UnitlessProperties = new Set([\n 'opacity',\n 'zIndex',\n 'lineHeight',\n 'fontWeight',\n])\n\nexport type StylesheetSupportedLiteral =\n | TransformPropertiesLiteral\n | PxPropertiesLiteral\n | UnitlessPropertiesLiteral\n\nexport type Resolver<T> = {\n [Key in keyof T]?: (target: T[keyof T]) => {\n key: string\n value: string | number\n }\n}\n\ntype StylesheetValueTarget = Record<string, number>\n\nexport function createStyleSheet(\n animeStyleValue: StylesheetValueTarget,\n resolver?: Resolver<StylesheetValueTarget>\n): Record<string, any> {\n const styleAccumulator: Record<string, any> = {}\n const CssTransformParts: Array<string> = []\n\n for (const key in animeStyleValue) {\n if (!Object.hasOwn(animeStyleValue, key)) {\n continue\n }\n const value = animeStyleValue[key]\n\n if (typeof value !== 'number') {\n continue\n }\n\n // Custom Resolver\n const styleResolver = resolver?.[key]\n if (styleResolver) {\n const { key: resolvedKey, value: resolvedValue } =\n styleResolver(value)\n\n styleAccumulator[resolvedKey] = resolvedValue\n continue\n }\n\n // Transform\n if (TransformProperties.has(key)) {\n const res = TransformFunctionMap[key as TransformPropertiesLiteral]\n\n const transformPart =\n 'unit' in res\n ? `${res.fn}(${value}${res.unit})`\n : `${res.fn}(${value})`\n\n CssTransformParts.push(transformPart)\n continue\n }\n\n // PX\n if (PxProperties.has(key)) {\n styleAccumulator[key] = `${value}px`\n continue\n }\n\n // Unitless\n if (UnitlessProperties.has(key)) {\n styleAccumulator[key] = value\n continue\n }\n\n // Fallback\n styleAccumulator[key] = value\n }\n\n // Combine Transform Syntax\n if (CssTransformParts.length > 0) {\n styleAccumulator['transform'] = CssTransformParts.join(' ')\n }\n\n return styleAccumulator\n}\n","import {\n ani,\n createStates,\n delay,\n loop,\n parallel,\n sequence,\n stagger,\n timeline,\n} from './ani'\nimport { T } from './timing'\n\nexport * from './ani'\nexport * from './binding_api'\nexport * from './event'\nexport * from './loop'\nexport * from './style'\nexport * from './timing'\n\nexport const a = {\n timing: T,\n ani,\n createStates,\n delay,\n loop,\n parallel,\n sequence,\n stagger,\n timeline,\n} as const\n"],"mappings":";AASO,IAAe,gBAAf,MAAkD;AAAA,EAMrD,YAAY,IAAkB;AAC1B,QAAI,IAAI;AACJ,WAAK,KAAK;AAAA,IACd;AAAA,EACJ;AAQJ;;;ACLO,IAAe,iBAAf,MAAe,gBAAe;AAAA,EAcjC;AAAA,SAAe,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASzB,SACN,MACA,OACA,SACA,gBAAyB,MAClB;AACP,UA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