@hyperframes/parsers 0.7.15

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,535 @@
1
+ import { PropertyGroupName } from './gsapConstants.js';
2
+
3
+ interface Asset {
4
+ id: string;
5
+ url: string;
6
+ type: string;
7
+ is_reference?: boolean;
8
+ /** Duration in seconds for video/audio assets */
9
+ duration?: number;
10
+ }
11
+ type TimelineElementType = "video" | "image" | "text" | "audio" | "composition";
12
+ type MediaElementType = "video" | "image" | "audio";
13
+ declare const CANVAS_DIMENSIONS: {
14
+ readonly landscape: {
15
+ readonly width: 1920;
16
+ readonly height: 1080;
17
+ };
18
+ readonly portrait: {
19
+ readonly width: 1080;
20
+ readonly height: 1920;
21
+ };
22
+ readonly "landscape-4k": {
23
+ readonly width: 3840;
24
+ readonly height: 2160;
25
+ };
26
+ readonly "portrait-4k": {
27
+ readonly width: 2160;
28
+ readonly height: 3840;
29
+ };
30
+ readonly square: {
31
+ readonly width: 1080;
32
+ readonly height: 1080;
33
+ };
34
+ readonly "square-4k": {
35
+ readonly width: 2160;
36
+ readonly height: 2160;
37
+ };
38
+ };
39
+ type CanvasResolution = keyof typeof CANVAS_DIMENSIONS;
40
+ declare const VALID_CANVAS_RESOLUTIONS: readonly CanvasResolution[];
41
+ /**
42
+ * Map a user-facing resolution string (canonical name or alias) to a
43
+ * `CanvasResolution`. Returns undefined for unknown values so callers
44
+ * can produce their own "invalid" UX (CLI exit, route validation, etc.).
45
+ */
46
+ declare function normalizeResolutionFlag(input: string | undefined): CanvasResolution | undefined;
47
+ interface TimelineElementBase {
48
+ id: string;
49
+ type: TimelineElementType;
50
+ name: string;
51
+ startTime: number;
52
+ duration: number;
53
+ zIndex: number;
54
+ x?: number;
55
+ y?: number;
56
+ scale?: number;
57
+ opacity?: number;
58
+ }
59
+ interface TimelineMediaElement extends TimelineElementBase {
60
+ type: MediaElementType;
61
+ src: string;
62
+ mediaStartTime?: number;
63
+ sourceDuration?: number;
64
+ isAroll?: boolean;
65
+ sourceWidth?: number;
66
+ sourceHeight?: number;
67
+ volume?: number;
68
+ hasAudio?: boolean;
69
+ }
70
+ interface WaveformData {
71
+ peaks: number[];
72
+ duration: number;
73
+ sampleRate?: number;
74
+ }
75
+ interface TimelineTextElement extends TimelineElementBase {
76
+ type: "text";
77
+ content: string;
78
+ color?: string;
79
+ fontSize?: number;
80
+ textShadow?: boolean;
81
+ fontFamily?: string;
82
+ fontWeight?: number;
83
+ textOutline?: boolean;
84
+ textOutlineColor?: string;
85
+ textOutlineWidth?: number;
86
+ textHighlight?: boolean;
87
+ textHighlightColor?: string;
88
+ textHighlightPadding?: number;
89
+ textHighlightRadius?: number;
90
+ }
91
+ interface TimelineCompositionElement extends TimelineElementBase {
92
+ type: "composition";
93
+ src: string;
94
+ compositionId: string;
95
+ scale?: number;
96
+ sourceDuration?: number;
97
+ variableValues?: Record<string, string | number | boolean>;
98
+ sourceWidth?: number;
99
+ sourceHeight?: number;
100
+ }
101
+ type CompositionVariableType = "string" | "number" | "color" | "boolean" | "enum" | "font" | "image";
102
+ /**
103
+ * Runtime list of every valid `CompositionVariableType`. Use this anywhere
104
+ * a Set/array of valid type strings is needed (lint rules, validators).
105
+ * The `satisfies` guard turns adding a new variant to the union without
106
+ * also adding it here into a compile error.
107
+ */
108
+ declare const COMPOSITION_VARIABLE_TYPES: readonly ["string", "number", "color", "boolean", "enum", "font", "image"];
109
+ interface CompositionVariableBase {
110
+ id: string;
111
+ type: CompositionVariableType;
112
+ label: string;
113
+ description?: string;
114
+ }
115
+ interface StringVariable extends CompositionVariableBase {
116
+ type: "string";
117
+ default: string;
118
+ placeholder?: string;
119
+ maxLength?: number;
120
+ }
121
+ interface NumberVariable extends CompositionVariableBase {
122
+ type: "number";
123
+ default: number;
124
+ min?: number;
125
+ max?: number;
126
+ step?: number;
127
+ unit?: string;
128
+ }
129
+ interface ColorVariable extends CompositionVariableBase {
130
+ type: "color";
131
+ default: string;
132
+ /** Brand role identifier, e.g. "color:primary". */
133
+ brandRole?: string;
134
+ }
135
+ interface BooleanVariable extends CompositionVariableBase {
136
+ type: "boolean";
137
+ default: boolean;
138
+ }
139
+ interface EnumVariable extends CompositionVariableBase {
140
+ type: "enum";
141
+ default: string;
142
+ options: {
143
+ value: string;
144
+ label: string;
145
+ }[];
146
+ }
147
+ /**
148
+ * Font variable — value is a `{name, source}` object (object-valued; LOCKED §7).
149
+ * `default` is the fallback font-family name string.
150
+ * `source` is the font stylesheet URL (e.g. Google Fonts CSS).
151
+ * `default_name` / `default_source` are the CSS-level fallbacks when the
152
+ * brand font is absent.
153
+ */
154
+ interface FontVariable extends CompositionVariableBase {
155
+ type: "font";
156
+ /** Fallback font-family name, e.g. "Inter". */
157
+ default: string;
158
+ /** Font stylesheet URL (e.g. Google Fonts CSS link). */
159
+ source?: string;
160
+ /** CSS font-family name to use when source is unavailable, e.g. "sans-serif". */
161
+ default_name?: string;
162
+ /** Fallback font stylesheet URL (empty string = system font). */
163
+ default_source?: string;
164
+ }
165
+ /**
166
+ * Image variable — value is a `{url, …}` object (object-valued; LOCKED §7).
167
+ * `default` is the fallback image URL string.
168
+ * `brandRole` is an optional semantic label, e.g. "logo:primary".
169
+ */
170
+ interface ImageVariable extends CompositionVariableBase {
171
+ type: "image";
172
+ /** Fallback image URL. */
173
+ default: string;
174
+ /** Brand role identifier, e.g. "logo:primary". */
175
+ brandRole?: string;
176
+ }
177
+ type CompositionVariable = StringVariable | NumberVariable | ColorVariable | BooleanVariable | EnumVariable | FontVariable | ImageVariable;
178
+ interface CompositionSpec {
179
+ id: string;
180
+ duration: number;
181
+ variables: CompositionVariable[];
182
+ }
183
+ type TimelineElement = TimelineMediaElement | TimelineTextElement | TimelineCompositionElement;
184
+ declare function isTextElement(el: TimelineElement): el is TimelineTextElement;
185
+ declare function isMediaElement(el: TimelineElement): el is TimelineMediaElement;
186
+ declare function isCompositionElement(el: TimelineElement): el is TimelineCompositionElement;
187
+ interface MediaFile {
188
+ id: string;
189
+ name: string;
190
+ type: TimelineElementType;
191
+ src: string;
192
+ file?: File;
193
+ duration?: number;
194
+ compositionId?: string;
195
+ sourceWidth?: number;
196
+ sourceHeight?: number;
197
+ }
198
+ declare const TIMELINE_COLORS: Record<TimelineElementType, string>;
199
+ declare const DEFAULT_DURATIONS: Record<TimelineElementType, number>;
200
+ interface CompositionAPI {
201
+ id: string;
202
+ duration: number;
203
+ seek(time: number): void;
204
+ getTime(): number;
205
+ getDuration(): number;
206
+ }
207
+ interface PlayerAPI {
208
+ play(): void;
209
+ pause(): void;
210
+ seek(time: number, options?: {
211
+ keepPlaying?: boolean;
212
+ }): void;
213
+ getTime(): number;
214
+ getDuration(): number;
215
+ isPlaying(): boolean;
216
+ getMainTimeline(): unknown;
217
+ getElementBounds(elementId: string): void;
218
+ getElementsAtPoint(x: number, y: number): void;
219
+ setElementPosition(elementId: string, x: number, y: number): void;
220
+ previewElementPosition(elementId: string, x: number, y: number): void;
221
+ setElementKeyframes(elementId: string, keyframes: Array<{
222
+ id: string;
223
+ time: number;
224
+ properties: {
225
+ x?: number;
226
+ y?: number;
227
+ };
228
+ }> | null): void;
229
+ setElementScale(elementId: string, scale: number): void;
230
+ setElementFontSize(elementId: string, fontSize: number): void;
231
+ setElementTextContent(elementId: string, content: string): void;
232
+ setElementTextColor(elementId: string, color: string): void;
233
+ setElementTextShadow(elementId: string, enabled: boolean): void;
234
+ setElementTextFontWeight(elementId: string, weight: number): void;
235
+ setElementTextFontFamily(elementId: string, fontFamily: string): void;
236
+ setElementTextOutline(elementId: string, enabled: boolean, color?: string, width?: number): void;
237
+ setElementTextHighlight(elementId: string, enabled: boolean, color?: string, padding?: number, radius?: number): void;
238
+ setElementVolume(elementId: string, volume: number): void;
239
+ setStageZoom(scale: number, focusX: number, focusY: number): void;
240
+ getStageZoom(): {
241
+ scale: number;
242
+ focusX: number;
243
+ focusY: number;
244
+ };
245
+ setStageZoomKeyframes(keyframes: Array<{
246
+ id: string;
247
+ time: number;
248
+ zoom: {
249
+ scale: number;
250
+ focusX: number;
251
+ focusY: number;
252
+ };
253
+ ease?: string;
254
+ }> | null): void;
255
+ getStageZoomKeyframes(): Array<{
256
+ id: string;
257
+ time: number;
258
+ zoom: {
259
+ scale: number;
260
+ focusX: number;
261
+ focusY: number;
262
+ };
263
+ ease?: string;
264
+ }>;
265
+ addElement(data: AddElementData): boolean;
266
+ removeElement(elementId: string): boolean;
267
+ updateElementTiming(elementId: string, start?: number, end?: number): boolean;
268
+ setElementTiming(elementId: string, startTime: number, duration: number, mediaStartTime?: number): void;
269
+ updateElementSrc(elementId: string, src: string): boolean;
270
+ updateElementLayer(elementId: string, zIndex: number): boolean;
271
+ updateElementBasePosition(elementId: string, x?: number, y?: number, scale?: number): boolean;
272
+ markTimelineDirty(): void;
273
+ isTimelineDirty(): boolean;
274
+ rebuildTimeline(): void;
275
+ ensureTimeline(): void;
276
+ enableRenderMode(): void;
277
+ disableRenderMode(): void;
278
+ renderSeek(time: number): void;
279
+ getElementVisibility(elementId: string): {
280
+ visible: boolean;
281
+ opacity?: number;
282
+ };
283
+ getVisibleElements(): Array<{
284
+ id: string;
285
+ tagName: string;
286
+ start: number;
287
+ end: number;
288
+ }>;
289
+ getRenderState(): {
290
+ time: number;
291
+ duration: number;
292
+ isPlaying: boolean;
293
+ renderMode: boolean;
294
+ timelineDirty: boolean;
295
+ };
296
+ }
297
+ interface AddElementData {
298
+ id: string;
299
+ type: "video" | "image" | "text" | "audio" | "composition";
300
+ name?: string;
301
+ src?: string;
302
+ content?: string;
303
+ start: number;
304
+ end: number;
305
+ zIndex?: number;
306
+ x?: number;
307
+ y?: number;
308
+ scale?: number;
309
+ fontSize?: number;
310
+ color?: string;
311
+ textShadow?: boolean;
312
+ fontWeight?: number;
313
+ textOutline?: boolean;
314
+ textOutlineColor?: string;
315
+ textOutlineWidth?: number;
316
+ textHighlight?: boolean;
317
+ textHighlightColor?: string;
318
+ textHighlightPadding?: number;
319
+ textHighlightRadius?: number;
320
+ compositionId?: string;
321
+ sourceWidth?: number;
322
+ sourceHeight?: number;
323
+ isAroll?: boolean;
324
+ }
325
+ interface ValidationResult {
326
+ valid: boolean;
327
+ errors: string[];
328
+ warnings: string[];
329
+ }
330
+ interface CompositionAsset {
331
+ id: string;
332
+ name: string;
333
+ type: "composition";
334
+ src: string;
335
+ duration: number;
336
+ compositionId: string;
337
+ thumbnail?: string;
338
+ }
339
+ interface Keyframe {
340
+ id: string;
341
+ time: number;
342
+ properties: Partial<KeyframeProperties>;
343
+ ease?: string;
344
+ }
345
+ interface KeyframeProperties {
346
+ x: number;
347
+ y: number;
348
+ opacity: number;
349
+ scale: number;
350
+ scaleX: number;
351
+ scaleY: number;
352
+ rotation: number;
353
+ width: number;
354
+ height: number;
355
+ }
356
+ interface ElementKeyframes {
357
+ elementId: string;
358
+ keyframes: Keyframe[];
359
+ }
360
+ interface StageZoom {
361
+ scale: number;
362
+ focusX: number;
363
+ focusY: number;
364
+ }
365
+ interface StageZoomKeyframe {
366
+ id: string;
367
+ time: number;
368
+ zoom: StageZoom;
369
+ ease?: string;
370
+ }
371
+ declare function getDefaultStageZoom(resolution: CanvasResolution): StageZoom;
372
+
373
+ /**
374
+ * Recast-free GSAP helpers: serialization, keyframe<->animation conversion,
375
+ * validation, and shared types.
376
+ *
377
+ * This module MUST NOT import recast / @babel/parser. It is part of the
378
+ * isomorphic core layer that the barrel and browser code depend on. AST
379
+ * parsing of GSAP source lives in the Node-only `./gsapParser` module.
380
+ */
381
+
382
+ type GsapMethod = "set" | "to" | "from" | "fromTo";
383
+ /** How a tween was constructed in source — drives display classification and editability. */
384
+ type GsapProvenanceKind = "literal" | "helper" | "loop" | "runtime-dynamic";
385
+ /**
386
+ * Origin of a parsed tween. `literal` tweens map 1:1 to a source call and edit
387
+ * directly; `helper`/`loop` tweens are expanded from a reused construct (unroll
388
+ * to edit); `runtime-dynamic` tweens come from live introspection (override to
389
+ * edit). Absent provenance is treated as `literal`.
390
+ */
391
+ interface GsapProvenance {
392
+ kind: GsapProvenanceKind;
393
+ /** Helper function name (kind === "helper"). */
394
+ fn?: string;
395
+ /** 1-based ordinal of the originating call site / loop construct in source order. */
396
+ callSite?: number;
397
+ /** 0-based iteration index (kind === "loop"). */
398
+ iteration?: number;
399
+ /** Source offset [start, end] of the originating call/loop, when known. */
400
+ sourceRange?: [number, number];
401
+ }
402
+ /** How a tween's keyframes can be edited, derived from its provenance. */
403
+ type KeyframeEditability = "direct" | "unroll" | "source";
404
+ /**
405
+ * Map provenance to an editing strategy:
406
+ * - `direct` — literal tween, maps 1:1 to source; edit in place.
407
+ * - `unroll` — helper/loop expansion; unroll to literal tweens, then edit.
408
+ * - `source` — runtime-dynamic value; not statically editable, edit the code.
409
+ */
410
+ declare function editabilityForProvenance(provenance?: GsapProvenance): KeyframeEditability;
411
+ interface GsapAnimation {
412
+ id: string;
413
+ targetSelector: string;
414
+ method: GsapMethod;
415
+ position: number | string;
416
+ properties: Record<string, number | string>;
417
+ fromProperties?: Record<string, number | string>;
418
+ duration?: number;
419
+ ease?: string;
420
+ /** Non-editable GSAP config (stagger, yoyo, repeat, etc.) preserved for round-trips. */
421
+ extras?: Record<string, unknown>;
422
+ /** Native GSAP keyframes data — present when the tween uses keyframes: { ... }. */
423
+ keyframes?: GsapKeyframesData;
424
+ /** Arc motion path config — present when the tween uses motionPath for curved position interpolation. */
425
+ arcPath?: ArcPathConfig;
426
+ /** True when the tween has a `keyframes` property that couldn't be statically resolved (dynamic). */
427
+ hasUnresolvedKeyframes?: boolean;
428
+ /** True when the tween's target selector couldn't be statically resolved (dynamic). */
429
+ hasUnresolvedSelector?: boolean;
430
+ /** Absolute start time computed by walking the timeline chain (handles +=, -=, <, >, labels). */
431
+ resolvedStart?: number;
432
+ /** True when no position arg was authored — the tween is sequentially placed by GSAP. */
433
+ implicitPosition?: boolean;
434
+ /** Which property group this tween belongs to (position, scale, size, rotation, visual, other).
435
+ * Undefined for legacy mixed tweens that bundle multiple groups. */
436
+ propertyGroup?: PropertyGroupName;
437
+ /** True for a base `gsap.set(...)` (a static hold that runs immediately, OFF the
438
+ * timeline) rather than `tl.set(...)`. Carries no timeline position and shows no
439
+ * keyframe marker — used to persist a static value (e.g. a 3D transform) without
440
+ * introducing a 0% keyframe. */
441
+ global?: boolean;
442
+ /** How this tween was constructed in source. Absent ⇒ literal. */
443
+ provenance?: GsapProvenance;
444
+ }
445
+ interface GsapPercentageKeyframe {
446
+ percentage: number;
447
+ properties: Record<string, number | string>;
448
+ ease?: string;
449
+ }
450
+ type GsapKeyframeFormat = "percentage" | "object-array" | "simple-array";
451
+ interface GsapKeyframesData {
452
+ format: GsapKeyframeFormat;
453
+ keyframes: GsapPercentageKeyframe[];
454
+ ease?: string;
455
+ easeEach?: string;
456
+ }
457
+ interface ArcPathSegment {
458
+ curviness: number;
459
+ cp1?: {
460
+ x: number;
461
+ y: number;
462
+ };
463
+ cp2?: {
464
+ x: number;
465
+ y: number;
466
+ };
467
+ }
468
+ interface ArcPathConfig {
469
+ enabled: boolean;
470
+ autoRotate: boolean | number;
471
+ segments: ArcPathSegment[];
472
+ }
473
+ interface MotionPathShape {
474
+ arcPath: ArcPathConfig;
475
+ waypoints: Array<{
476
+ x: number;
477
+ y: number;
478
+ }>;
479
+ }
480
+ /**
481
+ * Build arcPath segments + waypoints from resolved path coordinates. Shared by
482
+ * the AST parser (coords from literal nodes) and the runtime scanner (coords
483
+ * from a live `vars.motionPath`), so both produce identical arc config.
484
+ */
485
+ declare function buildArcPath(coords: Array<{
486
+ x: number;
487
+ y: number;
488
+ }>, curviness: number, autoRotate: boolean | number, isCubic: boolean): MotionPathShape | undefined;
489
+ interface ParsedGsap {
490
+ animations: GsapAnimation[];
491
+ timelineVar: string;
492
+ preamble: string;
493
+ postamble: string;
494
+ multipleTimelines?: boolean;
495
+ unsupportedTimelinePattern?: boolean;
496
+ }
497
+
498
+ interface SplitAnimationsOptions {
499
+ originalId: string;
500
+ newId: string;
501
+ splitTime: number;
502
+ elementStart: number;
503
+ elementDuration: number;
504
+ }
505
+ interface SplitAnimationsResult {
506
+ script: string;
507
+ /** Non-ID-selector animations that the engine cannot safely retarget. */
508
+ skippedSelectors: string[];
509
+ }
510
+ declare function serializeGsapAnimations(animations: GsapAnimation[], timelineVar?: string, options?: {
511
+ includeMediaSync?: boolean;
512
+ preamble?: string;
513
+ postamble?: string;
514
+ }): string;
515
+ /**
516
+ * Filter animations to those targeting `#<elementId>` (id-only match). For the
517
+ * studio panel's id-OR-selector matching, see `getAnimationsForElement` in
518
+ * `useGsapTweenCache.ts` — distinct on purpose, hence the distinct name.
519
+ */
520
+ declare function getAnimationsForElementId(animations: GsapAnimation[], elementId: string): GsapAnimation[];
521
+ declare function validateCompositionGsap(script: string): ValidationResult;
522
+ declare function keyframesToGsapAnimations(elementId: string, keyframes: Keyframe[], elementStartTime: number, base?: {
523
+ x?: number;
524
+ y?: number;
525
+ scale?: number;
526
+ }): GsapAnimation[];
527
+ declare function gsapAnimationsToKeyframes(animations: GsapAnimation[], elementStartTime: number, options?: {
528
+ baseX?: number;
529
+ baseY?: number;
530
+ baseScale?: number;
531
+ clampTimeToZero?: boolean;
532
+ skipBaseSet?: boolean;
533
+ }): Keyframe[];
534
+
535
+ export { type TimelineElementType as $, type ArcPathConfig as A, type BooleanVariable as B, type CompositionVariable as C, type CompositionVariableBase as D, type CompositionVariableType as E, DEFAULT_DURATIONS as F, type GsapAnimation as G, type ElementKeyframes as H, type EnumVariable as I, type FontVariable as J, type KeyframeEditability as K, type ImageVariable as L, type MotionPathShape as M, type KeyframeProperties as N, type MediaElementType as O, type ParsedGsap as P, type MediaFile as Q, type NumberVariable as R, type SplitAnimationsOptions as S, type TimelineElement as T, type PlayerAPI as U, type ValidationResult as V, type StageZoom as W, type StringVariable as X, TIMELINE_COLORS as Y, type TimelineCompositionElement as Z, type TimelineElementBase as _, type ArcPathSegment as a, type TimelineMediaElement as a0, type TimelineTextElement as a1, VALID_CANVAS_RESOLUTIONS as a2, type WaveformData as a3, getDefaultStageZoom as a4, isCompositionElement as a5, isMediaElement as a6, isTextElement as a7, normalizeResolutionFlag as a8, type GsapKeyframesData as b, type GsapMethod as c, type GsapPercentageKeyframe as d, type GsapProvenance as e, type GsapProvenanceKind as f, type SplitAnimationsResult as g, editabilityForProvenance as h, getAnimationsForElementId as i, gsapAnimationsToKeyframes as j, keyframesToGsapAnimations as k, buildArcPath as l, type GsapKeyframeFormat as m, type CanvasResolution as n, type Keyframe as o, type StageZoomKeyframe as p, type AddElementData as q, type Asset as r, serializeGsapAnimations as s, CANVAS_DIMENSIONS as t, COMPOSITION_VARIABLE_TYPES as u, validateCompositionGsap as v, type ColorVariable as w, type CompositionAPI as x, type CompositionAsset as y, type CompositionSpec as z };
@@ -0,0 +1,93 @@
1
+ import { G as GsapAnimation, A as ArcPathConfig, S as SplitAnimationsOptions, g as SplitAnimationsResult, a as ArcPathSegment } from './gsapSerialize-B_JRTCeV.js';
2
+ import './gsapConstants.js';
3
+
4
+ declare function updateAnimationInScript(script: string, animationId: string, updates: Partial<GsapAnimation> & {
5
+ easeEach?: string;
6
+ resetKeyframeEases?: boolean;
7
+ }): string;
8
+ /**
9
+ * Shift every tween targeting `targetSelector` by `delta` seconds (clamped ≥0),
10
+ * rewriting each call's position argument. Mirrors recast's shiftPositionsInScript
11
+ * (used by timeline clip-move to keep GSAP positions in sync with the clip start).
12
+ */
13
+ declare function shiftPositionsInScript(script: string, targetSelector: string, delta: number): string;
14
+ /**
15
+ * Linearly remap every tween targeting `targetSelector` from the old clip
16
+ * [oldStart, oldDuration] onto the new [newStart, newDuration] (position and,
17
+ * when present, duration scaled by the duration ratio). Mirrors recast's
18
+ * scalePositionsInScript (used by timeline clip-resize).
19
+ */
20
+ declare function scalePositionsInScript(script: string, targetSelector: string, oldStart: number, oldDuration: number, newStart: number, newDuration: number): string;
21
+ declare function addAnimationToScript(script: string, animation: Omit<GsapAnimation, "id">): {
22
+ script: string;
23
+ id: string;
24
+ };
25
+ declare function removeAnimationFromScript(script: string, animationId: string): string;
26
+ declare function updateKeyframeInScript(script: string, animationId: string, percentage: number, properties: Record<string, number | string>, ease?: string): string;
27
+ declare function addKeyframeToScript(script: string, animationId: string, percentage: number, properties: Record<string, number | string>, ease?: string, backfillDefaults?: Record<string, number | string>): string;
28
+ declare function removeKeyframeFromScript(script: string, animationId: string, percentage: number): string;
29
+ declare function removePropertyFromAnimation(script: string, animationId: string, property: string, from?: boolean): string;
30
+ /**
31
+ * Remove all keyframes from a tween, collapsing to a flat tween with one
32
+ * keyframe's properties: the first for `from()`, the last otherwise (the
33
+ * destination = the visible resting state).
34
+ */
35
+ declare function removeAllKeyframesFromScript(script: string, animationId: string): string;
36
+ /**
37
+ * Convert a flat tween (to/from/fromTo) to percentage-keyframes format.
38
+ * `resolvedFromValues` supplies the current DOM state: overrides the 0% endpoint
39
+ * for `to()`, the 100% endpoint for `from()`, or merges into toProps for `fromTo()`.
40
+ */
41
+ declare function convertToKeyframesFromScript(script: string, animationId: string, resolvedFromValues?: Record<string, number | string>, setDuration?: number): string;
42
+ /**
43
+ * Replace a dynamic or static keyframes expression with a fully-resolved
44
+ * percentage-keyframes object. Called when a user first edits a dynamically-
45
+ * generated keyframe in the studio so it becomes statically editable.
46
+ */
47
+ declare function materializeKeyframesFromScript(script: string, animationId: string, keyframes: Array<{
48
+ percentage: number;
49
+ properties: Record<string, number | string>;
50
+ ease?: string;
51
+ }>, easeEach?: string, resolvedSelector?: string): string;
52
+ /** Insert a new keyframed `to()` call and return the new animation ID. */
53
+ declare function addAnimationWithKeyframesToScript(script: string, targetSelector: string, position: number, duration: number, keyframes: Array<{
54
+ percentage: number;
55
+ properties: Record<string, number | string>;
56
+ ease?: string;
57
+ auto?: boolean;
58
+ }>, ease?: string, easeEach?: string): {
59
+ script: string;
60
+ id: string;
61
+ };
62
+ /**
63
+ * Split a mixed-property tween into one tween per property group (position,
64
+ * scale, visual, etc.) so each group can be edited independently.
65
+ * Returns the updated script and the IDs of the newly-created tweens.
66
+ */
67
+ declare function splitIntoPropertyGroupsFromScript(script: string, animationId: string): {
68
+ script: string;
69
+ ids: string[];
70
+ };
71
+ declare function addLabelToScript(script: string, name: string, position: number): string;
72
+ declare function removeLabelFromScript(script: string, name: string): string;
73
+ declare function setArcPathInScript(script: string, animationId: string, config: ArcPathConfig): string;
74
+ declare function updateArcSegmentInScript(script: string, animationId: string, segmentIndex: number, update: Partial<ArcPathSegment>): string;
75
+ declare function removeArcPathFromScript(script: string, animationId: string): string;
76
+ declare function splitAnimationsInScript(script: string, opts: SplitAnimationsOptions): SplitAnimationsResult;
77
+ type UnrollElement = {
78
+ selector: string;
79
+ keyframes: Array<{
80
+ percentage: number;
81
+ properties: Record<string, number | string>;
82
+ }>;
83
+ easeEach?: string;
84
+ };
85
+ /**
86
+ * Replace a dynamic loop that generates multiple tween calls with individual
87
+ * static `tl.to()` calls — one per element. Finds the loop containing the
88
+ * animation and replaces the loop with unrolled static calls, preserving every
89
+ * non-target statement in the loop body per iteration.
90
+ */
91
+ declare function unrollDynamicAnimations(script: string, animationId: string, elements: UnrollElement[]): string;
92
+
93
+ export { type UnrollElement, addAnimationToScript, addAnimationWithKeyframesToScript, addKeyframeToScript, addLabelToScript, convertToKeyframesFromScript, materializeKeyframesFromScript, removeAllKeyframesFromScript, removeAnimationFromScript, removeArcPathFromScript, removeKeyframeFromScript, removeLabelFromScript, removePropertyFromAnimation, scalePositionsInScript, setArcPathInScript, shiftPositionsInScript, splitAnimationsInScript, splitIntoPropertyGroupsFromScript, unrollDynamicAnimations, updateAnimationInScript, updateArcSegmentInScript, updateKeyframeInScript };