@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.
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 HeyGen, Inc.
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * GSAP property and ease constants.
3
+ *
4
+ * Extracted into a standalone module so browser code can import them
5
+ * without pulling in gsapParser (which depends on recast / @babel/parser).
6
+ */
7
+ declare const SUPPORTED_PROPS: string[];
8
+ type PropertyGroupName = "position" | "scale" | "size" | "rotation" | "visual" | "other";
9
+ declare const PROPERTY_GROUPS: Record<PropertyGroupName, ReadonlySet<string>>;
10
+ declare function classifyPropertyGroup(prop: string): PropertyGroupName;
11
+ declare function classifyTweenPropertyGroup(properties: Record<string, unknown>): PropertyGroupName | undefined;
12
+ declare const SUPPORTED_EASES: string[];
13
+
14
+ export { PROPERTY_GROUPS, type PropertyGroupName, SUPPORTED_EASES, SUPPORTED_PROPS, classifyPropertyGroup, classifyTweenPropertyGroup };
@@ -0,0 +1,107 @@
1
+ // src/gsapConstants.ts
2
+ var SUPPORTED_PROPS = [
3
+ // 2D Transforms
4
+ "x",
5
+ "y",
6
+ "scale",
7
+ "scaleX",
8
+ "scaleY",
9
+ "rotation",
10
+ "skewX",
11
+ "skewY",
12
+ // 3D Transforms
13
+ "z",
14
+ "rotationX",
15
+ "rotationY",
16
+ "rotationZ",
17
+ "perspective",
18
+ "transformPerspective",
19
+ "transformOrigin",
20
+ // Visibility
21
+ "opacity",
22
+ "visibility",
23
+ "autoAlpha",
24
+ // Dimensions
25
+ "width",
26
+ "height",
27
+ // Colors
28
+ "color",
29
+ "backgroundColor",
30
+ "borderColor",
31
+ // Box model
32
+ "borderRadius",
33
+ // Typography
34
+ "fontSize",
35
+ "letterSpacing",
36
+ // Filter & Clipping
37
+ "filter",
38
+ "clipPath",
39
+ // DOM content (number counters, text roll-ups)
40
+ "innerText"
41
+ ];
42
+ var PROPERTY_GROUPS = {
43
+ position: /* @__PURE__ */ new Set(["x", "y", "xPercent", "yPercent"]),
44
+ scale: /* @__PURE__ */ new Set(["scale", "scaleX", "scaleY"]),
45
+ size: /* @__PURE__ */ new Set(["width", "height"]),
46
+ rotation: /* @__PURE__ */ new Set(["rotation", "skewX", "skewY"]),
47
+ visual: /* @__PURE__ */ new Set(["opacity", "autoAlpha"]),
48
+ other: /* @__PURE__ */ new Set()
49
+ };
50
+ var PROP_TO_GROUP = /* @__PURE__ */ new Map();
51
+ for (const [group, props] of Object.entries(PROPERTY_GROUPS)) {
52
+ for (const p of props) PROP_TO_GROUP.set(p, group);
53
+ }
54
+ function classifyPropertyGroup(prop) {
55
+ return PROP_TO_GROUP.get(prop) ?? "other";
56
+ }
57
+ function classifyTweenPropertyGroup(properties) {
58
+ const groups = /* @__PURE__ */ new Set();
59
+ for (const key of Object.keys(properties)) {
60
+ if (key === "transformOrigin" || key === "_auto" || key === "data") continue;
61
+ const g = classifyPropertyGroup(key);
62
+ groups.add(g);
63
+ }
64
+ if (groups.size === 1) return groups.values().next().value;
65
+ return void 0;
66
+ }
67
+ var SUPPORTED_EASES = [
68
+ "none",
69
+ "power1.in",
70
+ "power1.out",
71
+ "power1.inOut",
72
+ "power2.in",
73
+ "power2.out",
74
+ "power2.inOut",
75
+ "power3.in",
76
+ "power3.out",
77
+ "power3.inOut",
78
+ "power4.in",
79
+ "power4.out",
80
+ "power4.inOut",
81
+ "back.in",
82
+ "back.out",
83
+ "back.inOut",
84
+ "elastic.in",
85
+ "elastic.out",
86
+ "elastic.inOut",
87
+ "bounce.in",
88
+ "bounce.out",
89
+ "bounce.inOut",
90
+ "expo.in",
91
+ "expo.out",
92
+ "expo.inOut",
93
+ "spring-gentle",
94
+ "spring-bouncy",
95
+ "spring-stiff",
96
+ "spring-wobbly",
97
+ "spring-heavy",
98
+ "steps(1)"
99
+ ];
100
+ export {
101
+ PROPERTY_GROUPS,
102
+ SUPPORTED_EASES,
103
+ SUPPORTED_PROPS,
104
+ classifyPropertyGroup,
105
+ classifyTweenPropertyGroup
106
+ };
107
+ //# sourceMappingURL=gsapConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/gsapConstants.ts"],"sourcesContent":["/**\n * GSAP property and ease constants.\n *\n * Extracted into a standalone module so browser code can import them\n * without pulling in gsapParser (which depends on recast / @babel/parser).\n */\n\nexport const SUPPORTED_PROPS = [\n // 2D Transforms\n \"x\",\n \"y\",\n \"scale\",\n \"scaleX\",\n \"scaleY\",\n \"rotation\",\n \"skewX\",\n \"skewY\",\n // 3D Transforms\n \"z\",\n \"rotationX\",\n \"rotationY\",\n \"rotationZ\",\n \"perspective\",\n \"transformPerspective\",\n \"transformOrigin\",\n // Visibility\n \"opacity\",\n \"visibility\",\n \"autoAlpha\",\n // Dimensions\n \"width\",\n \"height\",\n // Colors\n \"color\",\n \"backgroundColor\",\n \"borderColor\",\n // Box model\n \"borderRadius\",\n // Typography\n \"fontSize\",\n \"letterSpacing\",\n // Filter & Clipping\n \"filter\",\n \"clipPath\",\n // DOM content (number counters, text roll-ups)\n \"innerText\",\n];\n\n// ── Property Groups ─────────────────────────────────────────────────────────\n// Each group maps to an independent GSAP tween so editing one property\n// (e.g. drag → x/y) never contaminates another (e.g. scale, rotation).\n\nexport type PropertyGroupName = \"position\" | \"scale\" | \"size\" | \"rotation\" | \"visual\" | \"other\";\n\nexport const PROPERTY_GROUPS: Record<PropertyGroupName, ReadonlySet<string>> = {\n position: new Set([\"x\", \"y\", \"xPercent\", \"yPercent\"]),\n scale: new Set([\"scale\", \"scaleX\", \"scaleY\"]),\n size: new Set([\"width\", \"height\"]),\n rotation: new Set([\"rotation\", \"skewX\", \"skewY\"]),\n visual: new Set([\"opacity\", \"autoAlpha\"]),\n other: new Set<string>(),\n};\n\nconst PROP_TO_GROUP = new Map<string, PropertyGroupName>();\nfor (const [group, props] of Object.entries(PROPERTY_GROUPS) as [\n PropertyGroupName,\n ReadonlySet<string>,\n][]) {\n for (const p of props) PROP_TO_GROUP.set(p, group);\n}\n\nexport function classifyPropertyGroup(prop: string): PropertyGroupName {\n return PROP_TO_GROUP.get(prop) ?? \"other\";\n}\n\nexport function classifyTweenPropertyGroup(\n properties: Record<string, unknown>,\n): PropertyGroupName | undefined {\n const groups = new Set<PropertyGroupName>();\n for (const key of Object.keys(properties)) {\n // transformOrigin is a modifier; `_auto` is Studio's internal endpoint marker;\n // `data` is GSAP-reserved (carries the Studio hold-set tag). None is an animated\n // property, so none should affect the group.\n if (key === \"transformOrigin\" || key === \"_auto\" || key === \"data\") continue;\n const g = classifyPropertyGroup(key);\n groups.add(g);\n }\n if (groups.size === 1) return groups.values().next().value;\n return undefined;\n}\n\nexport const SUPPORTED_EASES = [\n \"none\",\n \"power1.in\",\n \"power1.out\",\n \"power1.inOut\",\n \"power2.in\",\n \"power2.out\",\n \"power2.inOut\",\n \"power3.in\",\n \"power3.out\",\n \"power3.inOut\",\n \"power4.in\",\n \"power4.out\",\n \"power4.inOut\",\n \"back.in\",\n \"back.out\",\n \"back.inOut\",\n \"elastic.in\",\n \"elastic.out\",\n \"elastic.inOut\",\n \"bounce.in\",\n \"bounce.out\",\n \"bounce.inOut\",\n \"expo.in\",\n \"expo.out\",\n \"expo.inOut\",\n \"spring-gentle\",\n \"spring-bouncy\",\n \"spring-stiff\",\n \"spring-wobbly\",\n \"spring-heavy\",\n \"steps(1)\",\n];\n"],"mappings":";AAOO,IAAM,kBAAkB;AAAA;AAAA,EAE7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA;AAAA,EAEA;AACF;AAQO,IAAM,kBAAkE;AAAA,EAC7E,UAAU,oBAAI,IAAI,CAAC,KAAK,KAAK,YAAY,UAAU,CAAC;AAAA,EACpD,OAAO,oBAAI,IAAI,CAAC,SAAS,UAAU,QAAQ,CAAC;AAAA,EAC5C,MAAM,oBAAI,IAAI,CAAC,SAAS,QAAQ,CAAC;AAAA,EACjC,UAAU,oBAAI,IAAI,CAAC,YAAY,SAAS,OAAO,CAAC;AAAA,EAChD,QAAQ,oBAAI,IAAI,CAAC,WAAW,WAAW,CAAC;AAAA,EACxC,OAAO,oBAAI,IAAY;AACzB;AAEA,IAAM,gBAAgB,oBAAI,IAA+B;AACzD,WAAW,CAAC,OAAO,KAAK,KAAK,OAAO,QAAQ,eAAe,GAGtD;AACH,aAAW,KAAK,MAAO,eAAc,IAAI,GAAG,KAAK;AACnD;AAEO,SAAS,sBAAsB,MAAiC;AACrE,SAAO,cAAc,IAAI,IAAI,KAAK;AACpC;AAEO,SAAS,2BACd,YAC+B;AAC/B,QAAM,SAAS,oBAAI,IAAuB;AAC1C,aAAW,OAAO,OAAO,KAAK,UAAU,GAAG;AAIzC,QAAI,QAAQ,qBAAqB,QAAQ,WAAW,QAAQ,OAAQ;AACpE,UAAM,IAAI,sBAAsB,GAAG;AACnC,WAAO,IAAI,CAAC;AAAA,EACd;AACA,MAAI,OAAO,SAAS,EAAG,QAAO,OAAO,OAAO,EAAE,KAAK,EAAE;AACrD,SAAO;AACT;AAEO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,157 @@
1
+ import { G as GsapAnimation, P as ParsedGsap, A as ArcPathConfig, a as ArcPathSegment } from './gsapSerialize-B_JRTCeV.js';
2
+ export { m as GsapKeyframeFormat, b as GsapKeyframesData, c as GsapMethod, d as GsapPercentageKeyframe, i as getAnimationsForElementId, j as gsapAnimationsToKeyframes, k as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-B_JRTCeV.js';
3
+ export { PROPERTY_GROUPS, PropertyGroupName, SUPPORTED_EASES, SUPPORTED_PROPS, classifyPropertyGroup, classifyTweenPropertyGroup } from './gsapConstants.js';
4
+ export { SPRING_PRESETS, SpringPreset, generateSpringEaseData } from './springEase.js';
5
+
6
+ declare function parseGsapScript(script: string): ParsedGsap;
7
+ declare function updateAnimationInScript(script: string, animationId: string, updates: Partial<GsapAnimation> & {
8
+ easeEach?: string;
9
+ resetKeyframeEases?: boolean;
10
+ }): string;
11
+ declare function shiftPositionsInScript(script: string, targetSelector: string, delta: number): string;
12
+ declare function scalePositionsInScript(script: string, targetSelector: string, oldStart: number, oldDuration: number, newStart: number, newDuration: number): string;
13
+ declare function addAnimationToScript(script: string, animation: Omit<GsapAnimation, "id">): {
14
+ script: string;
15
+ id: string;
16
+ };
17
+ declare function addAnimationWithKeyframesToScript(script: string, targetSelector: string, position: number, duration: number, keyframes: Array<{
18
+ percentage: number;
19
+ properties: Record<string, number | string>;
20
+ ease?: string;
21
+ auto?: boolean;
22
+ }>, ease?: string, easeEach?: string): {
23
+ script: string;
24
+ id: string;
25
+ };
26
+ declare function removeAnimationFromScript(script: string, animationId: string): string;
27
+ /** True for a `tl.set(...)` this module emitted to hold a keyframe before its tween.
28
+ * The Studio filters these out so they never appear as user keyframes/diamonds. */
29
+ declare function isStudioHoldSet(anim: GsapAnimation): boolean;
30
+ /**
31
+ * Keep a `tl.set(selector, {x,y}, 0)` "hold" in front of every position-keyframed
32
+ * tween that starts after t=0, so the element holds its first keyframe's position
33
+ * BEFORE the tween plays instead of snapping to its CSS base (the universal NLE
34
+ * "hold before first keyframe" behavior). The set is tagged with `data: "hf-hold"`
35
+ * so this pass owns it: every call wipes the prior holds and recomputes from the
36
+ * current keyframes, keeping them in sync as keyframes are added/moved/deleted.
37
+ *
38
+ * Idempotent. Only position props (x/y/xPercent/yPercent) are held — opacity/scale
39
+ * keep their authored pre-tween behavior. A tween already starting at 0 needs no
40
+ * hold (no gap before it).
41
+ */
42
+ declare function syncPositionHoldsBeforeKeyframes(script: string): string;
43
+ interface SplitAnimationsOptions {
44
+ originalId: string;
45
+ newId: string;
46
+ splitTime: number;
47
+ elementStart: number;
48
+ elementDuration: number;
49
+ }
50
+ interface SplitAnimationsResult {
51
+ script: string;
52
+ /** Non-ID-selector animations that the engine cannot safely retarget. */
53
+ skippedSelectors: string[];
54
+ }
55
+ declare function splitAnimationsInScript(script: string, opts: SplitAnimationsOptions): SplitAnimationsResult;
56
+ /**
57
+ * Insert a keyframe at the given percentage in an existing percentage-keyframes
58
+ * object. If the percentage already exists, its value is replaced.
59
+ */
60
+ declare function addKeyframeToScript(script: string, animationId: string, percentage: number, properties: Record<string, number | string>, ease?: string, backfillDefaults?: Record<string, number | string>): string;
61
+ /**
62
+ * Remove a keyframe at the given percentage. If fewer than 2 keyframes remain
63
+ * after removal, collapse the keyframes object to a flat tween using the
64
+ * remaining keyframe's properties.
65
+ */
66
+ declare function removeKeyframeFromScript(script: string, animationId: string, percentage: number): string;
67
+ /**
68
+ * Replace the properties (and optionally ease) at an existing keyframe percentage.
69
+ */
70
+ declare function updateKeyframeInScript(script: string, animationId: string, percentage: number, properties: Record<string, number | string>, ease?: string): string;
71
+ /**
72
+ * Convert a flat tween (to/from/fromTo) to percentage-keyframes format.
73
+ * `resolvedFromValues` supplies the "from" state for `to()` tweens or
74
+ * the "to" state for `from()` tweens (the values the DOM would resolve to).
75
+ */
76
+ declare function convertToKeyframesInScript(script: string, animationId: string, resolvedFromValues?: Record<string, number | string>, setDuration?: number): string;
77
+ /**
78
+ * Remove all keyframes from a tween, collapsing to a flat tween with the
79
+ * last keyframe's properties.
80
+ */
81
+ declare function removeAllKeyframesFromScript(script: string, animationId: string): string;
82
+ /**
83
+ * Replace a dynamic `keyframes: <expr>` with a static percentage-keyframes object.
84
+ * Called when the user first edits a dynamically-generated keyframe in the studio.
85
+ */
86
+ declare function materializeKeyframesInScript(script: string, animationId: string, keyframes: Array<{
87
+ percentage: number;
88
+ properties: Record<string, number | string>;
89
+ ease?: string;
90
+ }>, easeEach?: string, resolvedSelector?: string): string;
91
+ declare function setArcPathInScript(script: string, animationId: string, config: ArcPathConfig): string;
92
+ declare function updateArcSegmentInScript(script: string, animationId: string, segmentIndex: number, update: Partial<ArcPathSegment>): string;
93
+ /**
94
+ * Move a single motionPath waypoint (anchor) to a new position. The waypoint
95
+ * list is normalized to anchors for both straight and cubic paths, so
96
+ * `pointIndex` matches the node order the studio overlay renders; cubic control
97
+ * points are preserved. No-op when the animation/arc is missing or the index is
98
+ * out of range.
99
+ */
100
+ declare function updateMotionPathPointInScript(script: string, animationId: string, pointIndex: number, point: {
101
+ x: number;
102
+ y: number;
103
+ }): string;
104
+ /**
105
+ * Insert a waypoint at `index` (between existing anchors), splitting the segment
106
+ * it lands on so the new neighbor inherits its curviness. Non-cubic paths only.
107
+ * No-op for missing animation/arc, out-of-range index, or cubic paths.
108
+ */
109
+ declare function addMotionPathPointInScript(script: string, animationId: string, index: number, point: {
110
+ x: number;
111
+ y: number;
112
+ }): string;
113
+ /**
114
+ * Remove the waypoint at `index`. Refuses to drop below two anchors (a path
115
+ * can't have fewer). Non-cubic paths only. No-op for missing animation/arc,
116
+ * out-of-range index, cubic paths, or a 2-point path.
117
+ */
118
+ declare function removeMotionPathPointInScript(script: string, animationId: string, index: number): string;
119
+ /**
120
+ * Author a fresh 2-anchor motionPath tween on a target element: a straight line
121
+ * from the element's home (0,0) to `point`, gentle ease, ready for waypoint
122
+ * editing. Mirrors `addAnimationWithKeyframesToScript`.
123
+ */
124
+ declare function addMotionPathToScript(script: string, targetSelector: string, position: number, duration: number, point: {
125
+ x: number;
126
+ y: number;
127
+ }, ease?: string): {
128
+ script: string;
129
+ id: string | null;
130
+ };
131
+ declare function removeArcPathFromScript(script: string, animationId: string): string;
132
+ /**
133
+ * Split a multi-group tween into separate per-group tweens. Each resulting
134
+ * tween contains only properties belonging to one property group (position,
135
+ * scale, rotation, visual, etc.). `transformOrigin` stays with the group that
136
+ * has the most properties. If the tween already belongs to a single group,
137
+ * returns the script unchanged with the original ID.
138
+ */
139
+ declare function splitIntoPropertyGroups(script: string, animationId: string): {
140
+ script: string;
141
+ ids: string[];
142
+ };
143
+ /**
144
+ * Replace a dynamic loop that generates multiple tween calls with individual
145
+ * static `tl.to()` calls — one per element. Finds the loop containing the
146
+ * animation and replaces the entire loop body with unrolled static calls.
147
+ */
148
+ declare function unrollDynamicAnimations(script: string, animationId: string, elements: Array<{
149
+ selector: string;
150
+ keyframes: Array<{
151
+ percentage: number;
152
+ properties: Record<string, number | string>;
153
+ }>;
154
+ easeEach?: string;
155
+ }>): string;
156
+
157
+ export { ArcPathConfig, ArcPathSegment, GsapAnimation, ParsedGsap, type SplitAnimationsOptions, type SplitAnimationsResult, addAnimationToScript, addAnimationWithKeyframesToScript, addKeyframeToScript, addMotionPathPointInScript, addMotionPathToScript, convertToKeyframesInScript, isStudioHoldSet, materializeKeyframesInScript, parseGsapScript, removeAllKeyframesFromScript, removeAnimationFromScript, removeArcPathFromScript, removeKeyframeFromScript, removeMotionPathPointInScript, scalePositionsInScript, setArcPathInScript, shiftPositionsInScript, splitAnimationsInScript, splitIntoPropertyGroups, syncPositionHoldsBeforeKeyframes, unrollDynamicAnimations, updateAnimationInScript, updateArcSegmentInScript, updateKeyframeInScript, updateMotionPathPointInScript };