@freestylejs/ani-core 1.0.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.
@@ -0,0 +1,653 @@
1
+ interface TimingFunctionContext {
2
+ /**
3
+ * delta t
4
+ */
5
+ dt: number;
6
+ /**
7
+ * from value, initial position (`s(0)`)
8
+ */
9
+ from: number;
10
+ /**
11
+ * to value, original position (`s(f)`)
12
+ */
13
+ to: number;
14
+ /**
15
+ * animation duration, but it is not possible for specific functions
16
+ */
17
+ duration: number;
18
+ /**
19
+ * animation end tolerance
20
+ */
21
+ tolerance?: number;
22
+ }
23
+ declare abstract class TimingFunction {
24
+ /**
25
+ * Step function
26
+ * @param time Current time
27
+ * @param context Context for step calculation
28
+ */
29
+ abstract step(time: number, context: TimingFunctionContext): {
30
+ value: number;
31
+ endOfAnimation: boolean;
32
+ };
33
+ private static DEFAULT_TOLERANCE;
34
+ /**
35
+ * Checks whether the animation has ended.
36
+ *
37
+ * @param time - The current time.
38
+ * @param value - The computed value at the current time.
39
+ * @param context - The animation context.
40
+ * @returns {boolean} True if the animation is ended, false otherwise.
41
+ */
42
+ protected checkEnd(time: number, value: number, context: TimingFunctionContext, checkTimeOnly?: boolean): boolean;
43
+ }
44
+ interface Coord {
45
+ x: number;
46
+ y: number;
47
+ }
48
+
49
+ declare class LinearTimingFunction extends TimingFunction {
50
+ step(time: number, context: TimingFunctionContext): {
51
+ value: number;
52
+ endOfAnimation: boolean;
53
+ };
54
+ }
55
+
56
+ /** biome-ignore-all lint/style/noMagicNumbers: <>*/
57
+
58
+ interface BezierTimingFunctionOpt {
59
+ p2: Coord;
60
+ p3: Coord;
61
+ }
62
+ declare class BezierTimingFunction extends TimingFunction {
63
+ readonly opt: {
64
+ p2: Coord;
65
+ p3: Coord;
66
+ };
67
+ constructor(opt: {
68
+ p2: Coord;
69
+ p3: Coord;
70
+ });
71
+ private readonly p1;
72
+ private readonly p4;
73
+ private _bezierFunction;
74
+ step(time: number, context: TimingFunctionContext): {
75
+ value: number;
76
+ endOfAnimation: boolean;
77
+ };
78
+ }
79
+
80
+ interface SpringTimingFunctionOpt {
81
+ /**
82
+ * Mass constant.
83
+ */
84
+ m: number;
85
+ /**
86
+ * Spring constant.
87
+ */
88
+ k: number;
89
+ /**
90
+ * Damping constant.
91
+ */
92
+ c: number;
93
+ /**
94
+ * End of spring animation threshold.
95
+ * @default 1e-3
96
+ */
97
+ tolerance?: number;
98
+ }
99
+ declare class SpringTimingFunction extends TimingFunction {
100
+ readonly opt: SpringTimingFunctionOpt;
101
+ constructor(opt: SpringTimingFunctionOpt);
102
+ step(time: number, context: TimingFunctionContext): {
103
+ value: number;
104
+ endOfAnimation: boolean;
105
+ };
106
+ }
107
+
108
+ /**
109
+ * Core timing functions
110
+ */
111
+ declare const T: {
112
+ /**
113
+ * Creates a new Bezier timing function instance.
114
+ *
115
+ * @param {Bezier.BezierTimingFunctionOpt} opt - Options for configuring the Bezier curve.
116
+ * A new instance of BezierTimingFunction.
117
+ */
118
+ readonly bezier: (opt: BezierTimingFunctionOpt) => BezierTimingFunction;
119
+ /**
120
+ * Creates a new Spring timing function instance.
121
+ *
122
+ * @param {Spring.SpringTimingFunctionOpt} opt - Options for configuring the Spring timing function.
123
+ * A new instance of SpringTimingFunction.
124
+ */
125
+ readonly spring: (opt: SpringTimingFunctionOpt) => SpringTimingFunction;
126
+ /**
127
+ * Creates linear timing function instance.
128
+ */
129
+ readonly linear: () => LinearTimingFunction;
130
+ };
131
+
132
+ interface Animatable {
133
+ /**
134
+ * Update animation based on dt
135
+ * @param dt delta time
136
+ */
137
+ update(dt: number): void;
138
+ }
139
+ /**
140
+ * Animation clock interface, can be user-injected.
141
+ */
142
+ interface AnimationClockInterface {
143
+ subscribe(animatable: Animatable): void;
144
+ unsubscribe(animatable: Animatable): void;
145
+ }
146
+ declare class AnimationClock implements AnimationClockInterface {
147
+ private subscribers;
148
+ private animationFrameId;
149
+ private lastTimestamp;
150
+ private maxDeltaTime;
151
+ protected static clock: AnimationClock;
152
+ /**
153
+ * Crete new clock(singleton)
154
+ * @param maxDeltaTime default maxDt = 100ms
155
+ * @returns clock
156
+ */
157
+ static create(maxDeltaTime?: number): AnimationClock;
158
+ private constructor();
159
+ subscribe(animatable: Animatable): void;
160
+ unsubscribe(animatable: Animatable): void;
161
+ private start;
162
+ private stop;
163
+ private tick;
164
+ }
165
+
166
+ declare const TransformFunctionMap: {
167
+ readonly rotate: {
168
+ readonly fn: "rotate";
169
+ readonly unit: "deg";
170
+ };
171
+ readonly rotateX: {
172
+ readonly fn: "rotateX";
173
+ readonly unit: "deg";
174
+ };
175
+ readonly rotateY: {
176
+ readonly fn: "rotateY";
177
+ readonly unit: "deg";
178
+ };
179
+ readonly rotateZ: {
180
+ readonly fn: "rotateZ";
181
+ readonly unit: "deg";
182
+ };
183
+ readonly skew: {
184
+ readonly fn: "skew";
185
+ readonly unit: "deg";
186
+ };
187
+ readonly skewX: {
188
+ readonly fn: "skewX";
189
+ readonly unit: "deg";
190
+ };
191
+ readonly skewY: {
192
+ readonly fn: "skewY";
193
+ readonly unit: "deg";
194
+ };
195
+ readonly translate: {
196
+ readonly fn: "translate";
197
+ readonly unit: "px";
198
+ };
199
+ readonly translateX: {
200
+ readonly fn: "translateX";
201
+ readonly unit: "px";
202
+ };
203
+ readonly translateY: {
204
+ readonly fn: "translateY";
205
+ readonly unit: "px";
206
+ };
207
+ readonly translateZ: {
208
+ readonly fn: "translateZ";
209
+ readonly unit: "px";
210
+ };
211
+ readonly scale: {
212
+ readonly fn: "scale";
213
+ };
214
+ readonly scaleX: {
215
+ readonly fn: "scaleX";
216
+ };
217
+ readonly scaleY: {
218
+ readonly fn: "scaleY";
219
+ };
220
+ readonly scaleZ: {
221
+ readonly fn: "scaleZ";
222
+ };
223
+ };
224
+ type TransformPropertiesLiteral = keyof typeof TransformFunctionMap;
225
+ type PxPropertiesLiteral = 'width' | 'height' | 'margin' | 'marginTop' | 'marginBottom' | 'marginLeft' | 'marginRight' | 'padding' | 'paddingTop' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'top' | 'left' | 'right' | 'bottom' | 'borderWidth' | 'borderRadius';
226
+ type UnitlessPropertiesLiteral = 'opacity' | 'zIndex' | 'lineHeight' | 'fontWeight';
227
+ type StylesheetSupportedLiteral = TransformPropertiesLiteral | PxPropertiesLiteral | UnitlessPropertiesLiteral;
228
+ type Resolver<T> = {
229
+ [Key in keyof T]?: (target: T[keyof T]) => {
230
+ key: string;
231
+ value: string | number;
232
+ };
233
+ };
234
+ type StylesheetValueTarget = Record<string, number>;
235
+ declare function createStyleSheet(animeStyleValue: StylesheetValueTarget, resolver?: Resolver<StylesheetValueTarget>): Record<string, any>;
236
+
237
+ type PartialRecord<K extends keyof any, T> = {
238
+ [P in K]?: T;
239
+ };
240
+ type Capitalize<T extends string> = T extends `${infer R}${infer Rest}` ? `${Uppercase<R>}${Rest}` : never;
241
+ type WithPrefix<Prefix extends string, T extends string> = `${Prefix}${T}`;
242
+ type Prettify<T> = {
243
+ [K in keyof T]: T[K];
244
+ } & {};
245
+ type UnionToIntersection<Union> = (Union extends any ? (k: Union) => void : never) extends (k: infer I) => void ? I : never;
246
+ type WithLiteral<Literal extends string> = Literal | (string & {});
247
+ type WithLiteralRecord<Literal extends string, Value> = {
248
+ [key: string]: Value;
249
+ } & {
250
+ [Key in Literal]?: Value;
251
+ };
252
+
253
+ type AnimePrimitive = readonly number[];
254
+ type SegmentTiming = TimingFunction | readonly TimingFunction[];
255
+
256
+ /**
257
+ * Animatable target values
258
+ */
259
+ type Groupable = AnimePrimitive | GroupableRecord;
260
+ type GroupableRecordKey = WithLiteral<StylesheetSupportedLiteral>;
261
+ type GroupableRecord = WithLiteralRecord<GroupableRecordKey, AnimePrimitive[number]>;
262
+ type AniGroup<G extends Groupable> = Prettify<UnionToIntersection<G>>;
263
+ interface ExecutionSegment<G extends Groupable> {
264
+ /**
265
+ * Execution segment node
266
+ */
267
+ node: SegmentNode<G>;
268
+ /**
269
+ * Animation start time
270
+ */
271
+ startTime: number;
272
+ /**
273
+ * Animation end time
274
+ */
275
+ endTime: number;
276
+ }
277
+ type ExecutionPlan<G extends Groupable> = Array<ExecutionSegment<G>>;
278
+ type TimelineStatus = 'IDLE' | 'PLAYING' | 'PAUSED' | 'ENDED';
279
+ type OnUpdateCallback<G extends Groupable> = (current: {
280
+ state: AniGroup<G>;
281
+ status: TimelineStatus;
282
+ }) => void;
283
+ type ShouldKeepSymbol = 'keep';
284
+ type Keyframe<G extends Groupable> = Array<G | ShouldKeepSymbol>;
285
+ type Duration = Array<number | ShouldKeepSymbol>;
286
+ interface TimelineStartingConfig<G extends Groupable, Ctx = any> {
287
+ /**
288
+ * Starting dynamic value.
289
+ */
290
+ from: AniGroup<G>;
291
+ /**
292
+ * Dynamic `from` values, if passed `keep` for specific index, keep original timeline config.
293
+ */
294
+ keyframes?: Keyframe<G>;
295
+ /**
296
+ * Dynamic `duration` values, if passed `keep` for specific index, keep original timeline config.
297
+ */
298
+ durations?: Duration;
299
+ /**
300
+ * Custom context definition during animation cycle.
301
+ */
302
+ context?: Ctx;
303
+ /**
304
+ * Animation repeat count.
305
+ *
306
+ * - if `Infinity` goes infinity repeat
307
+ */
308
+ repeat?: number;
309
+ /**
310
+ * Custom style property resolver.
311
+ *
312
+ * @example
313
+ * ```ts
314
+ * const timeline = a.timeline(...)
315
+ * timeline.play({
316
+ * propertyResolver: {
317
+ * 'px': (pxValue) => { key: `top`, value: `${pxValue}px` }
318
+ * }
319
+ * })
320
+ * ```
321
+ */
322
+ propertyResolver?: G extends AnimePrimitive ? never : Resolver<G>;
323
+ }
324
+ /**
325
+ * Public timeline controller
326
+ */
327
+ interface TimelineController<G extends Groupable, Ctx = any> {
328
+ /**
329
+ * Play timeline
330
+ * @param config Timeline starting configuration
331
+ * @param canBeIntercepted if `true`, will play animation again even if already PLAYING.
332
+ */
333
+ play(config: TimelineStartingConfig<G, Ctx>, canBeIntercepted?: boolean): void;
334
+ /**
335
+ * Pause timeline
336
+ */
337
+ pause(): void;
338
+ /**
339
+ * Resume timeline
340
+ */
341
+ resume(): void;
342
+ /**
343
+ * Seek to target time
344
+ * @param time
345
+ */
346
+ seek(time: number): void;
347
+ /**
348
+ * Reset timeline
349
+ */
350
+ reset(): void;
351
+ }
352
+ declare class Timeline<G extends Groupable, Ctx = any> implements TimelineController<G, Ctx>, Animatable {
353
+ /**
354
+ * Animation construction root node.
355
+ */
356
+ protected readonly rootNode: AnimationNode<G>;
357
+ readonly duration: number;
358
+ private readonly _baseExecutionPlan;
359
+ private _currentExecutionPlan;
360
+ private readonly _clock;
361
+ private _masterTime;
362
+ private _status;
363
+ private _currentConfig;
364
+ /**
365
+ * Current animation running config.
366
+ */
367
+ get currentConfig(): TimelineStartingConfig<G, Ctx> | null;
368
+ private _state;
369
+ private _initialState;
370
+ private _repeatCount;
371
+ private _propertyKeyMap;
372
+ private _segmentStartStates;
373
+ private _onUpdateCallbacks;
374
+ constructor(
375
+ /**
376
+ * Animation construction root node.
377
+ */
378
+ rootNode: AnimationNode<G>, clock?: AnimationClockInterface);
379
+ /**
380
+ * Resolves a Group (like {x, y}) into keys and values.
381
+ */
382
+ private _resolveGroup;
383
+ /**
384
+ * Resolves the internal state (a number array) back into Group.
385
+ */
386
+ private _resolveStateToGroup;
387
+ /**
388
+ * Compile animation execution plan
389
+ */
390
+ private _constructExecutionPlan;
391
+ /**
392
+ * Calculates the exact state of the animation at point.
393
+ */
394
+ private _calculateStateAtTime;
395
+ private _resolveExecutionPlan;
396
+ private notify;
397
+ play(config: TimelineStartingConfig<G, Ctx>, canBeIntercepted?: boolean): void;
398
+ pause(): void;
399
+ resume(): void;
400
+ reset(notify?: boolean): void;
401
+ seek(targetTime: number): void;
402
+ getCurrentValue(): AniGroup<G> | null;
403
+ onUpdate(callback: OnUpdateCallback<G>): () => void;
404
+ update(dt: number): void;
405
+ }
406
+ declare function timeline<G extends Groupable, Ctx = any>(rootNode: AnimationNode<G>, clock?: AnimationClockInterface): Timeline<G, Ctx>;
407
+
408
+ type AnimationId = string;
409
+ type AnimationNodeType = string;
410
+ type AnimationDuration = number;
411
+ /**
412
+ * Nodes in the animation tree
413
+ */
414
+ declare abstract class AnimationNode<G extends Groupable> {
415
+ abstract readonly type: AnimationNodeType;
416
+ abstract readonly duration: AnimationDuration;
417
+ readonly id?: AnimationId;
418
+ constructor(id?: AnimationId);
419
+ /**
420
+ * Constructs self node and its children into a flat execution plan.
421
+ * @param plan Execution plans to which segments will be added.
422
+ * @param startTime The absolute current start time for this node within the master timeline.
423
+ */
424
+ abstract construct(plan: ExecutionPlan<G>, startTime: number): void;
425
+ }
426
+ type ExtractAnimationNode<AnimeNode> = AnimeNode extends AnimationNode<infer Group> ? Group : never;
427
+
428
+ type CompositionChildren = readonly AnimationNode<Groupable>[];
429
+ type CompositionPlan<Children extends CompositionChildren> = ExecutionPlan<ExtractAnimationNode<Children[number]>>;
430
+ /**
431
+ * Composition animation
432
+ */
433
+ declare abstract class CompositionNode<const Children extends CompositionChildren> extends AnimationNode<ExtractAnimationNode<Children[number]>> {
434
+ /**
435
+ * Composition children nodes.
436
+ */
437
+ readonly children: Children;
438
+ constructor(children: Children, timing?: TimingFunction, id?: AnimationId);
439
+ }
440
+
441
+ interface SegmentNodeProps<G extends Groupable> {
442
+ readonly to: G;
443
+ readonly duration?: number;
444
+ readonly timing?: SegmentTiming;
445
+ }
446
+ /**
447
+ * Leaf node in the animation tree
448
+ */
449
+ declare class SegmentNode<G extends Groupable> extends AnimationNode<G> {
450
+ readonly type = "SEGMENT";
451
+ readonly props: SegmentNodeProps<G>;
452
+ constructor(props: SegmentNodeProps<G>, id?: AnimationId);
453
+ get duration(): number;
454
+ construct(plan: ExecutionPlan<G>, startTime: number): void;
455
+ }
456
+ /**
457
+ * Factory function to create a ani SegmentNode.
458
+ */
459
+ declare function ani<G extends Groupable>(props: SegmentNodeProps<G>, id?: AnimationId): SegmentNode<G>;
460
+
461
+ type PreserveRecord = Record<string, any>;
462
+ /**
463
+ * Creates a pause in an animation sequence.
464
+ * @param duration The duration of the delay in seconds.
465
+ * @param id Optional ID for the node.
466
+ */
467
+ declare function delay(duration: number, id?: AnimationId): SegmentNode<PreserveRecord>;
468
+
469
+ /**
470
+ * Composition node that repeats a child animation node a specified number of times.
471
+ */
472
+ declare class LoopNode<G extends Groupable> extends CompositionNode<readonly AnimationNode<G>[]> {
473
+ readonly type = "LOOP";
474
+ readonly duration: number;
475
+ readonly count: number;
476
+ readonly child: AnimationNode<G>;
477
+ constructor(child: AnimationNode<G>, loopCount: number, timing?: TimingFunction, id?: AnimationId);
478
+ construct(plan: CompositionPlan<readonly AnimationNode<G>[]>, startTime: number): void;
479
+ }
480
+ /**
481
+ * Repeats a child animation node a specified number of times.
482
+ * @param child The animation node to repeat.
483
+ * @param loopCount The number of times to repeat the child node.
484
+ * @param timing loop timing function.
485
+ * @param id Optional ID for the node.
486
+ */
487
+ declare function loop<G extends Groupable>(child: AnimationNode<G>, loopCount: number, timing?: TimingFunction, id?: AnimationId): LoopNode<G>;
488
+
489
+ /**
490
+ * Composition node that runs all of its children at the same time.
491
+ */
492
+ declare class ParallelNode<const Children extends CompositionChildren> extends CompositionNode<Children> {
493
+ readonly type = "PARALLEL";
494
+ readonly duration: number;
495
+ constructor(children: Children, timing?: TimingFunction, id?: AnimationId);
496
+ construct(plan: CompositionPlan<Children>, startTime: number): void;
497
+ }
498
+ /**
499
+ * Parallel composition animation
500
+ */
501
+ declare function parallel<const Children extends CompositionChildren>(children: Children, timing?: TimingFunction, id?: AnimationId): ParallelNode<Children>;
502
+
503
+ /**
504
+ * Composition node that runs its children one after another.
505
+ */
506
+ declare class SequenceNode<const Children extends CompositionChildren> extends CompositionNode<Children> {
507
+ readonly type = "SEQUENCE";
508
+ readonly duration: number;
509
+ constructor(children: Children, timing?: TimingFunction, id?: AnimationId);
510
+ construct(plan: CompositionPlan<Children>, startTime: number): void;
511
+ }
512
+ /**
513
+ * Sequence composition animation
514
+ */
515
+ declare function sequence<const Children extends CompositionChildren>(children: Children, timing?: TimingFunction, id?: AnimationId): SequenceNode<Children>;
516
+
517
+ interface StaggerNodeProps {
518
+ offset: number;
519
+ timing?: TimingFunction;
520
+ }
521
+ /**
522
+ * Composition node that runs its children with a fixed delay between each start time.
523
+ */
524
+ declare class StaggerNode<const Children extends CompositionChildren> extends CompositionNode<Children> {
525
+ readonly type = "STAGGER";
526
+ readonly duration: number;
527
+ readonly offset: number;
528
+ constructor(children: Children, props: StaggerNodeProps, id?: AnimationId);
529
+ construct(plan: CompositionPlan<Children>, startTime: number): void;
530
+ }
531
+ /**
532
+ * Stagger composition animation
533
+ */
534
+ declare function stagger<const Children extends CompositionChildren>(children: Children, props: StaggerNodeProps, id?: AnimationId): StaggerNode<Children>;
535
+
536
+ type AnimationStateShape = Record<string, AnimationNode<Groupable>>;
537
+ type GetTimeline<State extends AnimationStateShape> = Timeline<ExtractAnimationNode<State[keyof State]>, any>;
538
+ interface StateController<AnimationStates extends AnimationStateShape> {
539
+ /**
540
+ * Get current timeline.
541
+ */
542
+ timeline: () => GetTimeline<AnimationStates>;
543
+ /**
544
+ * Transition timeline animation into another state.
545
+ * @param newState transition target.
546
+ *
547
+ * @param timelineConfig animation play config.
548
+ * @param canBeIntercepted animation canBeIntercepted config.
549
+ */
550
+ transitionTo(newState: keyof AnimationStates, timelineConfig?: TimelineStartingConfig<ExtractAnimationNode<AnimationStates[keyof AnimationStates]>, any>, canBeIntercepted?: boolean): void;
551
+ /**
552
+ * Subscribe to timeline changes.
553
+ * @param callback
554
+ * @returns unsubscribe function
555
+ */
556
+ onTimelineChange(callback: (newTimeline: GetTimeline<AnimationStates>) => void): () => void;
557
+ }
558
+ interface StateProps<AnimationStates extends AnimationStateShape> {
559
+ /**
560
+ * Initial animation target state.
561
+ */
562
+ initial: keyof AnimationStates;
563
+ /**
564
+ * Initial animation `from` value.
565
+ */
566
+ initialFrom: AniGroup<ExtractAnimationNode<AnimationStates[keyof AnimationStates]>>;
567
+ /**
568
+ * Animating target states.
569
+ */
570
+ states: AnimationStates;
571
+ /**
572
+ * Custom timeline clock
573
+ */
574
+ clock?: AnimationClockInterface;
575
+ }
576
+ /**
577
+ * Creates a state machine controller for managing animations.
578
+ *
579
+ * @param config - The configuration for the state machine.
580
+ * @param clock - Optional custom animation clock.
581
+ * @returns A controller for managing the animation states.
582
+ */
583
+ declare function createStates<AnimationStates extends AnimationStateShape>(config: StateProps<AnimationStates>): StateController<AnimationStates>;
584
+
585
+ type EventHandler<AnimationContext = any, EvtKeys extends EventKey = EventKey> = (animationContext: AnimationContext, ev: HTMLElementEventMap[EvtKeys]) => any;
586
+ type EventHandlerRegistration<AnimationContext = any, Keys extends EventKey = EventKey> = PartialRecord<WithPrefix<'on', Capitalize<Keys>>, EventHandler<AnimationContext, Keys>>;
587
+ type EventKey = keyof HTMLElementEventMap;
588
+ declare class EventManager<SupportedEventList extends readonly EventKey[] = EventKey[], AnimationContext = any> {
589
+ readonly supportedEvents: SupportedEventList;
590
+ constructor(supportedEvents: SupportedEventList);
591
+ private _element;
592
+ get targetElement(): HTMLElement;
593
+ private _animeGetter;
594
+ get animeGetter(): () => AnimationContext;
595
+ setAnimeGetter: (animeGetter: () => AnimationContext) => void;
596
+ private eventMap;
597
+ private withAnimeValue;
598
+ add: <const EventName extends SupportedEventList[number]>(eventName: EventName, listener: EventHandler<AnimationContext, SupportedEventList[number]>, options?: boolean | AddEventListenerOptions) => void;
599
+ cleanupOne: <const EventName extends SupportedEventList[number]>(eventName: EventName) => boolean;
600
+ cleanupAll: () => boolean;
601
+ /**
602
+ * get pure `{event_name}`
603
+ * @param key onX`{event_name}`
604
+ */
605
+ static getEvtKey(key: string): EventKey;
606
+ attach: (handlers: EventHandlerRegistration<AnimationContext, SupportedEventList[number]>) => void;
607
+ bind(element: HTMLElement): void;
608
+ }
609
+
610
+ type AniRefContext<G extends Groupable> = TimelineController<G> & {
611
+ /**
612
+ * Current animation value
613
+ */
614
+ current: AniGroup<G> | null;
615
+ };
616
+ interface AniRefProps<G extends Groupable, AsGetter extends boolean = false> {
617
+ /**
618
+ * The compositional timeline to bind to the element.
619
+ */
620
+ timeline: AsGetter extends true ? () => Timeline<G> : Timeline<G>;
621
+ /**
622
+ * The initial style to apply to the element before the animation plays.
623
+ */
624
+ initialValue?: AniGroup<G>;
625
+ /**
626
+ * Event handlers to attach to the element.
627
+ */
628
+ events?: EventHandlerRegistration<AniRefContext<G>>;
629
+ /**
630
+ * If `true`, all event listeners will be removed on cleanup.
631
+ *
632
+ * @default true
633
+ */
634
+ cleanupEvents?: boolean;
635
+ }
636
+
637
+ declare const a: {
638
+ readonly timing: {
639
+ readonly bezier: (opt: BezierTimingFunctionOpt) => BezierTimingFunction;
640
+ readonly spring: (opt: SpringTimingFunctionOpt) => SpringTimingFunction;
641
+ readonly linear: () => LinearTimingFunction;
642
+ };
643
+ readonly ani: typeof ani;
644
+ readonly createStates: typeof createStates;
645
+ readonly delay: typeof delay;
646
+ readonly loop: typeof loop;
647
+ readonly parallel: typeof parallel;
648
+ readonly sequence: typeof sequence;
649
+ readonly stagger: typeof stagger;
650
+ readonly timeline: typeof timeline;
651
+ };
652
+
653
+ export { type AniGroup, type AniRefContext, type AniRefProps, type Animatable, AnimationClock, type AnimationClockInterface, type AnimationDuration, type AnimationId, AnimationNode, type AnimationNodeType, type AnimationStateShape, CompositionNode, type Coord, type EventHandler, type EventHandlerRegistration, type EventKey, EventManager, type ExecutionPlan, type ExecutionSegment, type GetTimeline, type Groupable, type GroupableRecord, type GroupableRecordKey, LinearTimingFunction, type OnUpdateCallback, ParallelNode, type Resolver, SegmentNode, SequenceNode, StaggerNode, type StateController, type StateProps, type StylesheetSupportedLiteral, T, Timeline, type TimelineController, type TimelineStartingConfig, TimingFunction, type TimingFunctionContext, a, ani, createStates, createStyleSheet, delay, loop, parallel, sequence, stagger, timeline };