@hyperframes/core 0.6.104 → 0.6.106
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/lint/rules/gsap.js +6 -6
- package/dist/lint/rules/gsap.js.map +1 -1
- package/dist/parsers/gsapInline.d.ts +47 -0
- package/dist/parsers/gsapInline.d.ts.map +1 -0
- package/dist/parsers/gsapInline.js +513 -0
- package/dist/parsers/gsapInline.js.map +1 -0
- package/dist/parsers/gsapParserAcorn.d.ts +2 -0
- package/dist/parsers/gsapParserAcorn.d.ts.map +1 -1
- package/dist/parsers/gsapParserAcorn.js +40 -37
- package/dist/parsers/gsapParserAcorn.js.map +1 -1
- package/dist/parsers/gsapSerialize.d.ts +46 -0
- package/dist/parsers/gsapSerialize.d.ts.map +1 -1
- package/dist/parsers/gsapSerialize.js +38 -0
- package/dist/parsers/gsapSerialize.js.map +1 -1
- package/dist/parsers/gsapUnroll.d.ts +7 -0
- package/dist/parsers/gsapUnroll.d.ts.map +1 -0
- package/dist/parsers/gsapUnroll.js +137 -0
- package/dist/parsers/gsapUnroll.js.map +1 -0
- package/dist/studio-api/routes/files.d.ts.map +1 -1
- package/dist/studio-api/routes/files.js +4 -0
- package/dist/studio-api/routes/files.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
/** Node keys that are metadata, not child AST to traverse/substitute. */
|
|
2
|
+
const SKIP_KEYS = new Set(["type", "start", "end", "loc", "range", "__hfProvenance", "__hfOrder"]);
|
|
3
|
+
const FUNCTION_TYPES = new Set([
|
|
4
|
+
"ArrowFunctionExpression",
|
|
5
|
+
"FunctionExpression",
|
|
6
|
+
"FunctionDeclaration",
|
|
7
|
+
]);
|
|
8
|
+
const GSAP_METHODS = new Set(["set", "to", "from", "fromTo"]);
|
|
9
|
+
// Bounds on synthetic expansion (recursion + iteration runaway guards).
|
|
10
|
+
const MAX_DEPTH = 8;
|
|
11
|
+
const MAX_ITERS = 512;
|
|
12
|
+
function isFunctionNode(node) {
|
|
13
|
+
return !!node && FUNCTION_TYPES.has(node.type);
|
|
14
|
+
}
|
|
15
|
+
function isNode(x) {
|
|
16
|
+
return !!x && typeof x === "object" && typeof x.type === "string";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Apply `fn` to each child AST node, writing back its return value. Skips
|
|
20
|
+
* metadata keys and key/member slots that must not be treated as values.
|
|
21
|
+
* The one place array-vs-single child traversal lives, so walkers stay flat.
|
|
22
|
+
*/
|
|
23
|
+
function transformChildren(node, fn) {
|
|
24
|
+
for (const key of Object.keys(node)) {
|
|
25
|
+
if (SKIP_KEYS.has(key) || isNonValueIdentifierSlot(node, key))
|
|
26
|
+
continue;
|
|
27
|
+
const child = node[key];
|
|
28
|
+
if (Array.isArray(child)) {
|
|
29
|
+
for (let i = 0; i < child.length; i++)
|
|
30
|
+
child[i] = fn(child[i]);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
node[key] = fn(child);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Deep structural clone preserving `start`/`end`/`loc` (needed for source slicing). */
|
|
38
|
+
export function cloneNode(node) {
|
|
39
|
+
return structuredClone(node);
|
|
40
|
+
}
|
|
41
|
+
// ponytail: Identifier + default + rest only. Destructured bindings (`{x}`, `[x]`)
|
|
42
|
+
// aren't inlined (U2 inlines Identifier-param helpers / loop vars only), so a
|
|
43
|
+
// destructuring shadow is a double-rare miss that just falls back. Add the
|
|
44
|
+
// pattern cases here if that ever bites.
|
|
45
|
+
function collectPatternNames(pattern, out) {
|
|
46
|
+
if (pattern?.type === "Identifier")
|
|
47
|
+
out.add(pattern.name);
|
|
48
|
+
else if (pattern?.type === "AssignmentPattern")
|
|
49
|
+
collectPatternNames(pattern.left, out);
|
|
50
|
+
else if (pattern?.type === "RestElement")
|
|
51
|
+
collectPatternNames(pattern.argument, out);
|
|
52
|
+
}
|
|
53
|
+
/** Every identifier name bound anywhere inside the subtree (fn params, declared vars, catch params). */
|
|
54
|
+
function collectBoundNames(root) {
|
|
55
|
+
const names = new Set();
|
|
56
|
+
const visit = (node) => {
|
|
57
|
+
if (!isNode(node))
|
|
58
|
+
return node;
|
|
59
|
+
if (isFunctionNode(node))
|
|
60
|
+
for (const p of node.params ?? [])
|
|
61
|
+
collectPatternNames(p, names);
|
|
62
|
+
else if (node.type === "VariableDeclarator")
|
|
63
|
+
collectPatternNames(node.id, names);
|
|
64
|
+
else if (node.type === "CatchClause")
|
|
65
|
+
collectPatternNames(node.param, names);
|
|
66
|
+
transformChildren(node, visit);
|
|
67
|
+
return node;
|
|
68
|
+
};
|
|
69
|
+
visit(root);
|
|
70
|
+
return names;
|
|
71
|
+
}
|
|
72
|
+
/** A child in key/property position that must not be treated as a value identifier. */
|
|
73
|
+
function isNonValueIdentifierSlot(node, key) {
|
|
74
|
+
if (node.computed)
|
|
75
|
+
return false;
|
|
76
|
+
return ((node.type === "MemberExpression" && key === "property") ||
|
|
77
|
+
(node.type === "Property" && key === "key"));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Substitute bound identifiers in an already-cloned subtree, returning the
|
|
81
|
+
* (possibly replaced) root. Names shadowed anywhere inside (nested function
|
|
82
|
+
* params, declared vars) are dropped up front rather than tracked per scope —
|
|
83
|
+
* worst case we under-substitute and the caller falls back to current behavior.
|
|
84
|
+
* Never substitutes identifiers in key/member positions. Mutates the passed
|
|
85
|
+
* clone in place — callers pass `cloneNode(...)`.
|
|
86
|
+
*/
|
|
87
|
+
export function substituteParams(node, bindings) {
|
|
88
|
+
const shadowed = collectBoundNames(node);
|
|
89
|
+
let effective = bindings;
|
|
90
|
+
if (shadowed.size > 0) {
|
|
91
|
+
effective = new Map(bindings);
|
|
92
|
+
for (const name of shadowed)
|
|
93
|
+
effective.delete(name);
|
|
94
|
+
}
|
|
95
|
+
if (effective.size === 0)
|
|
96
|
+
return node;
|
|
97
|
+
return replace(node, effective);
|
|
98
|
+
}
|
|
99
|
+
function replace(node, bindings) {
|
|
100
|
+
if (!isNode(node))
|
|
101
|
+
return node;
|
|
102
|
+
if (node.type === "Identifier" && bindings.has(node.name)) {
|
|
103
|
+
return cloneNode(bindings.get(node.name));
|
|
104
|
+
}
|
|
105
|
+
transformChildren(node, (child) => replace(child, bindings));
|
|
106
|
+
return node;
|
|
107
|
+
}
|
|
108
|
+
/** Tag a node (typically a `tl.*` CallExpression) with its construction provenance. */
|
|
109
|
+
export function tagProvenance(node, provenance) {
|
|
110
|
+
if (node && typeof node === "object")
|
|
111
|
+
node.__hfProvenance = provenance;
|
|
112
|
+
return node;
|
|
113
|
+
}
|
|
114
|
+
/** Read a provenance tag previously set by `tagProvenance`, if any. */
|
|
115
|
+
export function readProvenance(node) {
|
|
116
|
+
return node?.__hfProvenance;
|
|
117
|
+
}
|
|
118
|
+
/** Synthesize a numeric `Literal` node (for loop indices, which have no source node). */
|
|
119
|
+
export function numericLiteral(value) {
|
|
120
|
+
return { type: "Literal", value, raw: String(value) };
|
|
121
|
+
}
|
|
122
|
+
function walkNodes(node, fn) {
|
|
123
|
+
if (!isNode(node))
|
|
124
|
+
return;
|
|
125
|
+
fn(node);
|
|
126
|
+
for (const key of Object.keys(node)) {
|
|
127
|
+
if (SKIP_KEYS.has(key))
|
|
128
|
+
continue;
|
|
129
|
+
const child = node[key];
|
|
130
|
+
if (Array.isArray(child))
|
|
131
|
+
for (const c of child)
|
|
132
|
+
walkNodes(c, fn);
|
|
133
|
+
else
|
|
134
|
+
walkNodes(child, fn);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** The identifier a (possibly chained) call's member expression is rooted at. */
|
|
138
|
+
function timelineRootName(call) {
|
|
139
|
+
let obj = call.callee?.object;
|
|
140
|
+
while (obj?.type === "CallExpression")
|
|
141
|
+
obj = obj.callee?.object;
|
|
142
|
+
return obj?.type === "Identifier" ? obj.name : null;
|
|
143
|
+
}
|
|
144
|
+
function isTimelineRooted(call, timelineVar) {
|
|
145
|
+
if (timelineRootName(call) !== timelineVar)
|
|
146
|
+
return false;
|
|
147
|
+
return (call.callee?.property?.type === "Identifier" && GSAP_METHODS.has(call.callee.property.name));
|
|
148
|
+
}
|
|
149
|
+
function containsTimelineCall(node, timelineVar) {
|
|
150
|
+
let found = false;
|
|
151
|
+
walkNodes(node, (n) => {
|
|
152
|
+
if (n.type === "CallExpression" && isTimelineRooted(n, timelineVar))
|
|
153
|
+
found = true;
|
|
154
|
+
});
|
|
155
|
+
return found;
|
|
156
|
+
}
|
|
157
|
+
function rangeOf(node) {
|
|
158
|
+
return typeof node.start === "number" && typeof node.end === "number"
|
|
159
|
+
? [node.start, node.end]
|
|
160
|
+
: undefined;
|
|
161
|
+
}
|
|
162
|
+
/** Plain identifier params + block body (shape we can inline). Timeline content checked separately. */
|
|
163
|
+
function isShapeEligible(fn) {
|
|
164
|
+
return (isFunctionNode(fn) &&
|
|
165
|
+
fn.body?.type === "BlockStatement" &&
|
|
166
|
+
!(fn.params ?? []).some((p) => p.type !== "Identifier"));
|
|
167
|
+
}
|
|
168
|
+
/** True if the subtree calls any function named in `names`. */
|
|
169
|
+
function callsAny(node, names) {
|
|
170
|
+
let hit = false;
|
|
171
|
+
walkNodes(node, (n) => {
|
|
172
|
+
if (n.type === "CallExpression" &&
|
|
173
|
+
n.callee?.type === "Identifier" &&
|
|
174
|
+
names.has(n.callee.name)) {
|
|
175
|
+
hit = true;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
return hit;
|
|
179
|
+
}
|
|
180
|
+
/** `[name, fnNode]` if a single-declarator `const f = fn` is an inlinable-shaped helper. */
|
|
181
|
+
function varDeclHelper(stmt) {
|
|
182
|
+
if (stmt.declarations?.length !== 1)
|
|
183
|
+
return null;
|
|
184
|
+
const d = stmt.declarations[0];
|
|
185
|
+
return d.id?.type === "Identifier" && isShapeEligible(d.init) ? [d.id.name, d.init] : null;
|
|
186
|
+
}
|
|
187
|
+
/** `[name, fnNode]` if `stmt` declares an inlinable-shaped helper, else null. */
|
|
188
|
+
function helperFromStatement(stmt) {
|
|
189
|
+
if (stmt.type === "FunctionDeclaration") {
|
|
190
|
+
return stmt.id && isShapeEligible(stmt) ? [stmt.id.name, stmt] : null;
|
|
191
|
+
}
|
|
192
|
+
if (stmt.type === "VariableDeclaration")
|
|
193
|
+
return varDeclHelper(stmt);
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
/** Top-level functions whose shape we can inline (Identifier params + block body). */
|
|
197
|
+
function gatherHelperCandidates(program) {
|
|
198
|
+
const candidates = new Map();
|
|
199
|
+
for (const stmt of program.body ?? []) {
|
|
200
|
+
const helper = helperFromStatement(stmt);
|
|
201
|
+
if (helper)
|
|
202
|
+
candidates.set(helper[0], helper[1]);
|
|
203
|
+
}
|
|
204
|
+
return candidates;
|
|
205
|
+
}
|
|
206
|
+
/** Names that build the timeline directly or by calling another builder (transitive closure). */
|
|
207
|
+
function timelineBuildingNames(candidates, timelineVar) {
|
|
208
|
+
const building = new Set();
|
|
209
|
+
for (const [name, fn] of candidates) {
|
|
210
|
+
if (containsTimelineCall(fn.body, timelineVar))
|
|
211
|
+
building.add(name);
|
|
212
|
+
}
|
|
213
|
+
for (let changed = true; changed;) {
|
|
214
|
+
changed = false;
|
|
215
|
+
for (const [name, fn] of candidates) {
|
|
216
|
+
if (!building.has(name) && callsAny(fn.body, building)) {
|
|
217
|
+
building.add(name);
|
|
218
|
+
changed = true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return building;
|
|
223
|
+
}
|
|
224
|
+
function bump(counts, key) {
|
|
225
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Keep only candidates safe to drop: every reference to the name is its
|
|
229
|
+
* declaration or a statement-level call. (1 decl id + 1 callee id per
|
|
230
|
+
* statement-level call ⇒ total occurrences with no stray uses.)
|
|
231
|
+
*/
|
|
232
|
+
function safelyDroppable(program, candidates) {
|
|
233
|
+
const names = new Set(candidates.keys());
|
|
234
|
+
const totalIds = new Map();
|
|
235
|
+
const stmtCalls = new Map();
|
|
236
|
+
walkNodes(program, (n) => {
|
|
237
|
+
if (n.type === "Identifier" && names.has(n.name))
|
|
238
|
+
bump(totalIds, n.name);
|
|
239
|
+
const e = n.type === "ExpressionStatement" ? n.expression : undefined;
|
|
240
|
+
if (e?.type === "CallExpression" &&
|
|
241
|
+
e.callee?.type === "Identifier" &&
|
|
242
|
+
names.has(e.callee.name)) {
|
|
243
|
+
bump(stmtCalls, e.callee.name);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
const safe = new Map();
|
|
247
|
+
for (const [name, fn] of candidates) {
|
|
248
|
+
if ((totalIds.get(name) ?? 0) === 1 + (stmtCalls.get(name) ?? 0))
|
|
249
|
+
safe.set(name, fn);
|
|
250
|
+
}
|
|
251
|
+
return safe;
|
|
252
|
+
}
|
|
253
|
+
/** Top-level timeline-building helpers that are safe to inline-and-drop. */
|
|
254
|
+
function collectInlinableHelpers(program, timelineVar) {
|
|
255
|
+
const candidates = gatherHelperCandidates(program);
|
|
256
|
+
if (candidates.size === 0)
|
|
257
|
+
return candidates;
|
|
258
|
+
const building = timelineBuildingNames(candidates, timelineVar);
|
|
259
|
+
for (const name of [...candidates.keys()])
|
|
260
|
+
if (!building.has(name))
|
|
261
|
+
candidates.delete(name);
|
|
262
|
+
if (candidates.size === 0)
|
|
263
|
+
return candidates;
|
|
264
|
+
return safelyDroppable(program, candidates);
|
|
265
|
+
}
|
|
266
|
+
function isHelperDecl(stmt, helpers) {
|
|
267
|
+
if (stmt.type === "FunctionDeclaration")
|
|
268
|
+
return !!stmt.id && helpers.get(stmt.id.name) === stmt;
|
|
269
|
+
if (stmt.type === "VariableDeclaration" && stmt.declarations?.length === 1) {
|
|
270
|
+
const d = stmt.declarations[0];
|
|
271
|
+
return d.id?.type === "Identifier" && helpers.get(d.id.name) === d.init;
|
|
272
|
+
}
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
function bodyStatements(node) {
|
|
276
|
+
if (node?.type === "BlockStatement")
|
|
277
|
+
return node.body ?? [];
|
|
278
|
+
return node ? [{ type: "ExpressionStatement", expression: node }] : [];
|
|
279
|
+
}
|
|
280
|
+
/** Tag this body's direct timeline tweens with provenance + a monotonic expansion-order stamp. */
|
|
281
|
+
function tagTimelineCalls(stmts, prov, ctx) {
|
|
282
|
+
for (const stmt of stmts) {
|
|
283
|
+
walkNodes(stmt, (n) => {
|
|
284
|
+
if (n.type === "CallExpression" && isTimelineRooted(n, ctx.timelineVar)) {
|
|
285
|
+
tagProvenance(n, { ...prov });
|
|
286
|
+
n.__hfOrder = ctx.order.n++;
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
/** Clone a body as one scope, substitute the bindings, tag provenance, recurse. */
|
|
292
|
+
function expandBody(bodyStmts, bindings, prov, ctx) {
|
|
293
|
+
const block = substituteParams(cloneNode({ type: "BlockStatement", body: bodyStmts }), bindings);
|
|
294
|
+
tagTimelineCalls(block.body, prov, ctx);
|
|
295
|
+
return expandStatements(block.body, { ...ctx, depth: ctx.depth + 1 });
|
|
296
|
+
}
|
|
297
|
+
function inlineHelper(call, ctx) {
|
|
298
|
+
const fn = ctx.helpers.get(call.callee.name);
|
|
299
|
+
const bindings = new Map();
|
|
300
|
+
(fn.params ?? []).forEach((p, i) => {
|
|
301
|
+
const arg = call.arguments?.[i];
|
|
302
|
+
if (arg)
|
|
303
|
+
bindings.set(p.name, arg);
|
|
304
|
+
});
|
|
305
|
+
const prov = {
|
|
306
|
+
kind: "helper",
|
|
307
|
+
fn: call.callee.name,
|
|
308
|
+
callSite: ++ctx.site.n,
|
|
309
|
+
sourceRange: rangeOf(call),
|
|
310
|
+
};
|
|
311
|
+
return expandBody(fn.body.body, bindings, prov, ctx);
|
|
312
|
+
}
|
|
313
|
+
function assignStep(update, resolve) {
|
|
314
|
+
if (update.operator === "+=")
|
|
315
|
+
return asNum(resolve(update.right));
|
|
316
|
+
if (update.operator === "-=") {
|
|
317
|
+
const s = asNum(resolve(update.right));
|
|
318
|
+
return s === undefined ? undefined : -s;
|
|
319
|
+
}
|
|
320
|
+
// `i = i + S` — the step is the right operand of the addition.
|
|
321
|
+
if (update.operator === "=" && update.right?.type === "BinaryExpression") {
|
|
322
|
+
return asNum(resolve(update.right.right));
|
|
323
|
+
}
|
|
324
|
+
return undefined;
|
|
325
|
+
}
|
|
326
|
+
/** The loop variable a `for` update clause mutates (`i++` or `i += S`), or null. */
|
|
327
|
+
function updatedVarName(update) {
|
|
328
|
+
if (update?.type === "UpdateExpression")
|
|
329
|
+
return update.argument?.name ?? null;
|
|
330
|
+
if (update?.type === "AssignmentExpression")
|
|
331
|
+
return update.left?.name ?? null;
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
function loopStep(update, varName, resolve) {
|
|
335
|
+
if (updatedVarName(update) !== varName)
|
|
336
|
+
return undefined;
|
|
337
|
+
if (update.type === "UpdateExpression")
|
|
338
|
+
return update.operator === "++" ? 1 : -1;
|
|
339
|
+
return assignStep(update, resolve);
|
|
340
|
+
}
|
|
341
|
+
function asNum(v) {
|
|
342
|
+
return typeof v === "number" && Number.isFinite(v) ? v : undefined;
|
|
343
|
+
}
|
|
344
|
+
function loopSatisfied(op, x, end) {
|
|
345
|
+
if (op === "<")
|
|
346
|
+
return x < end;
|
|
347
|
+
if (op === "<=")
|
|
348
|
+
return x <= end;
|
|
349
|
+
if (op === ">")
|
|
350
|
+
return x > end;
|
|
351
|
+
if (op === ">=")
|
|
352
|
+
return x >= end;
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
/** The single `let v = <init>` of a for-loop init clause, or null. */
|
|
356
|
+
function forInitVar(init) {
|
|
357
|
+
if (init?.type !== "VariableDeclaration" || init.declarations?.length !== 1)
|
|
358
|
+
return null;
|
|
359
|
+
const d = init.declarations[0];
|
|
360
|
+
return d.id?.type === "Identifier" ? { name: d.id.name, initExpr: d.init } : null;
|
|
361
|
+
}
|
|
362
|
+
/** Parse `for (let v = A; v <op> B; v += S)` into resolved bounds, or null if not statically bounded. */
|
|
363
|
+
function parseForHeader(stmt, resolve) {
|
|
364
|
+
const iv = forInitVar(stmt.init);
|
|
365
|
+
const test = stmt.test;
|
|
366
|
+
if (!iv || test?.type !== "BinaryExpression" || test.left?.name !== iv.name)
|
|
367
|
+
return null;
|
|
368
|
+
const start = asNum(resolve(iv.initExpr));
|
|
369
|
+
const end = asNum(resolve(test.right));
|
|
370
|
+
const step = loopStep(stmt.update, iv.name, resolve);
|
|
371
|
+
if (start === undefined || end === undefined || !step)
|
|
372
|
+
return null;
|
|
373
|
+
return { v: iv.name, start, end, op: test.operator, step };
|
|
374
|
+
}
|
|
375
|
+
function unrollFor(stmt, ctx) {
|
|
376
|
+
const h = parseForHeader(stmt, ctx.resolve);
|
|
377
|
+
if (!h)
|
|
378
|
+
return null;
|
|
379
|
+
const body = bodyStatements(stmt.body);
|
|
380
|
+
const out = [];
|
|
381
|
+
const site = ++ctx.site.n;
|
|
382
|
+
let iteration = 0;
|
|
383
|
+
for (let x = h.start; loopSatisfied(h.op, x, h.end); x += h.step) {
|
|
384
|
+
if (iteration >= MAX_ITERS)
|
|
385
|
+
return null;
|
|
386
|
+
const prov = {
|
|
387
|
+
kind: "loop",
|
|
388
|
+
callSite: site,
|
|
389
|
+
iteration,
|
|
390
|
+
sourceRange: rangeOf(stmt),
|
|
391
|
+
};
|
|
392
|
+
out.push(...expandBody(body, new Map([[h.v, numericLiteral(x)]]), prov, ctx));
|
|
393
|
+
iteration++;
|
|
394
|
+
}
|
|
395
|
+
return out;
|
|
396
|
+
}
|
|
397
|
+
function forOfVarName(left) {
|
|
398
|
+
if (left?.type === "VariableDeclaration") {
|
|
399
|
+
const id = left.declarations?.[0]?.id;
|
|
400
|
+
return id?.type === "Identifier" ? id.name : null;
|
|
401
|
+
}
|
|
402
|
+
return left?.type === "Identifier" ? left.name : null;
|
|
403
|
+
}
|
|
404
|
+
/** Expand `for (const el of [literal array]) {...}` and `[literal array].forEach((el, i) => {...})`. */
|
|
405
|
+
function unrollOverArray(elements, body, elName, idxName, range, ctx) {
|
|
406
|
+
const out = [];
|
|
407
|
+
const site = ++ctx.site.n;
|
|
408
|
+
elements.forEach((el, i) => {
|
|
409
|
+
if (!el)
|
|
410
|
+
return;
|
|
411
|
+
const bindings = new Map();
|
|
412
|
+
if (elName)
|
|
413
|
+
bindings.set(elName, el);
|
|
414
|
+
if (idxName)
|
|
415
|
+
bindings.set(idxName, numericLiteral(i));
|
|
416
|
+
const prov = { kind: "loop", callSite: site, iteration: i, sourceRange: range };
|
|
417
|
+
out.push(...expandBody(body, bindings, prov, ctx));
|
|
418
|
+
});
|
|
419
|
+
return out;
|
|
420
|
+
}
|
|
421
|
+
function unrollForOf(stmt, ctx) {
|
|
422
|
+
if (stmt.right?.type !== "ArrayExpression")
|
|
423
|
+
return null;
|
|
424
|
+
const elName = forOfVarName(stmt.left);
|
|
425
|
+
if (!elName)
|
|
426
|
+
return null;
|
|
427
|
+
return unrollOverArray(stmt.right.elements ?? [], bodyStatements(stmt.body), elName, null, rangeOf(stmt), ctx);
|
|
428
|
+
}
|
|
429
|
+
/** The (element, index) param names of a callback, or null if either is non-Identifier. */
|
|
430
|
+
function callbackParamNames(cb) {
|
|
431
|
+
const names = [];
|
|
432
|
+
for (const p of [cb.params?.[0], cb.params?.[1]]) {
|
|
433
|
+
if (!p)
|
|
434
|
+
names.push(null);
|
|
435
|
+
else if (p.type !== "Identifier")
|
|
436
|
+
return null;
|
|
437
|
+
else
|
|
438
|
+
names.push(p.name);
|
|
439
|
+
}
|
|
440
|
+
return { el: names[0], idx: names[1] };
|
|
441
|
+
}
|
|
442
|
+
/** True for `[arrayLiteral].forEach` member callees. */
|
|
443
|
+
function isForEachCall(callee) {
|
|
444
|
+
return (callee?.type === "MemberExpression" &&
|
|
445
|
+
callee.property?.name === "forEach" &&
|
|
446
|
+
callee.object?.type === "ArrayExpression");
|
|
447
|
+
}
|
|
448
|
+
/** The element array + callback of `[...].forEach(cb)`, or null. */
|
|
449
|
+
function forEachTarget(call) {
|
|
450
|
+
if (!isForEachCall(call.callee))
|
|
451
|
+
return null;
|
|
452
|
+
const cb = call.arguments?.[0];
|
|
453
|
+
return isFunctionNode(cb) ? { elements: call.callee.object.elements ?? [], cb } : null;
|
|
454
|
+
}
|
|
455
|
+
function unrollForEach(call, ctx) {
|
|
456
|
+
const target = forEachTarget(call);
|
|
457
|
+
if (!target)
|
|
458
|
+
return null;
|
|
459
|
+
const params = callbackParamNames(target.cb);
|
|
460
|
+
if (!params)
|
|
461
|
+
return null;
|
|
462
|
+
return unrollOverArray(target.elements, bodyStatements(target.cb.body), params.el, params.idx, rangeOf(call), ctx);
|
|
463
|
+
}
|
|
464
|
+
function expandCall(call, ctx) {
|
|
465
|
+
if (call.callee?.type === "Identifier" && ctx.helpers.has(call.callee.name)) {
|
|
466
|
+
return inlineHelper(call, ctx);
|
|
467
|
+
}
|
|
468
|
+
return unrollForEach(call, ctx);
|
|
469
|
+
}
|
|
470
|
+
function expandStatement(stmt, ctx) {
|
|
471
|
+
if (ctx.depth >= MAX_DEPTH)
|
|
472
|
+
return null;
|
|
473
|
+
if (stmt.type === "ForStatement")
|
|
474
|
+
return unrollFor(stmt, ctx);
|
|
475
|
+
if (stmt.type === "ForOfStatement")
|
|
476
|
+
return unrollForOf(stmt, ctx);
|
|
477
|
+
if (stmt.type === "ExpressionStatement" && stmt.expression?.type === "CallExpression") {
|
|
478
|
+
return expandCall(stmt.expression, ctx);
|
|
479
|
+
}
|
|
480
|
+
return null;
|
|
481
|
+
}
|
|
482
|
+
function expandStatements(stmts, ctx) {
|
|
483
|
+
const out = [];
|
|
484
|
+
for (const stmt of stmts) {
|
|
485
|
+
const expanded = expandStatement(stmt, ctx);
|
|
486
|
+
if (expanded)
|
|
487
|
+
out.push(...expanded);
|
|
488
|
+
else
|
|
489
|
+
out.push(stmt);
|
|
490
|
+
}
|
|
491
|
+
return out;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Rewrite the Program body so helper invocations and bounded loops that build
|
|
495
|
+
* the timeline are expanded into concrete per-call / per-iteration `tl.*`
|
|
496
|
+
* statements, each tagged with provenance. Mutates `ast` in place (caller owns
|
|
497
|
+
* the freshly-parsed tree). Constructs it can't statically resolve are left
|
|
498
|
+
* untouched, so the parser falls back to current behavior for them.
|
|
499
|
+
*/
|
|
500
|
+
export function inlineComputedTimelines(ast, timelineVar, resolve) {
|
|
501
|
+
const helpers = collectInlinableHelpers(ast, timelineVar);
|
|
502
|
+
const ctx = {
|
|
503
|
+
helpers,
|
|
504
|
+
timelineVar,
|
|
505
|
+
resolve,
|
|
506
|
+
depth: 0,
|
|
507
|
+
site: { n: 0 },
|
|
508
|
+
order: { n: 0 },
|
|
509
|
+
};
|
|
510
|
+
const body = (ast.body ?? []).filter((stmt) => !isHelperDecl(stmt, helpers));
|
|
511
|
+
ast.body = expandStatements(body, ctx);
|
|
512
|
+
}
|
|
513
|
+
//# sourceMappingURL=gsapInline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gsapInline.js","sourceRoot":"","sources":["../../src/parsers/gsapInline.ts"],"names":[],"mappings":"AAqBA,yEAAyE;AACzE,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC;AAEnG,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,yBAAyB;IACzB,oBAAoB;IACpB,qBAAqB;CACtB,CAAC,CAAC;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE9D,wEAAwE;AACxE,MAAM,SAAS,GAAG,CAAC,CA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
1
1
|
import type { GsapAnimation, GsapMethod, ParsedGsap } from "./gsapSerialize.js";
|
|
2
|
+
export { buildArcPath, editabilityForProvenance } from "./gsapSerialize.js";
|
|
3
|
+
export type { ArcPathConfig, ArcPathSegment, MotionPathShape, GsapProvenance, GsapProvenanceKind, KeyframeEditability, } from "./gsapSerialize.js";
|
|
2
4
|
export interface TweenCallInfo {
|
|
3
5
|
node: any;
|
|
4
6
|
/** acorn-walk ancestor array at the call site (root→call, call is last). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gsapParserAcorn.d.ts","sourceRoot":"","sources":["../../src/parsers/gsapParserAcorn.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"gsapParserAcorn.d.ts","sourceRoot":"","sources":["../../src/parsers/gsapParserAcorn.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAEV,aAAa,EAEb,UAAU,EAEV,UAAU,EACX,MAAM,oBAAoB,CAAC;AAO5B,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,YAAY,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAkZ5B,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,GAAG,CAAC;IACV,4EAA4E;IAC5E,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,WAAW,CAAC,EAAE,GAAG,CAAC;CACnB;AA2lBD,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,GAAG,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,aAAa,CAAC;QAAC,SAAS,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;CAC/E;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI,CA0B3F;AAID;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAoD/D"}
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
import * as acorn from "acorn";
|
|
12
12
|
import * as acornWalk from "acorn-walk";
|
|
13
13
|
import { classifyTweenPropertyGroup } from "./gsapConstants.js";
|
|
14
|
+
import { buildArcPath } from "./gsapSerialize.js";
|
|
15
|
+
import { inlineComputedTimelines, readProvenance } from "./gsapInline.js";
|
|
16
|
+
// Browser-safe re-exports so studio code can build arc config without importing
|
|
17
|
+
// the recast parser (this acorn module is the browser-safe gsap subpath).
|
|
18
|
+
export { buildArcPath, editabilityForProvenance } from "./gsapSerialize.js";
|
|
14
19
|
const GSAP_METHODS = new Set(["set", "to", "from", "fromTo"]);
|
|
15
20
|
const QUERY_METHODS = new Set(["querySelector", "querySelectorAll"]);
|
|
16
21
|
const ITERATION_METHODS = new Set(["forEach", "map"]);
|
|
@@ -658,35 +663,7 @@ function parseMotionPathNode(node, scope, source) {
|
|
|
658
663
|
if (x !== undefined && y !== undefined)
|
|
659
664
|
coords.push({ x, y });
|
|
660
665
|
}
|
|
661
|
-
|
|
662
|
-
return undefined;
|
|
663
|
-
let waypoints;
|
|
664
|
-
const segments = [];
|
|
665
|
-
if (isCubic && coords.length >= 4) {
|
|
666
|
-
waypoints = [];
|
|
667
|
-
const first = coords[0];
|
|
668
|
-
if (first)
|
|
669
|
-
waypoints.push(first);
|
|
670
|
-
for (let i = 1; i + 2 < coords.length; i += 3) {
|
|
671
|
-
const cp1 = coords[i];
|
|
672
|
-
const cp2 = coords[i + 1];
|
|
673
|
-
const anchor = coords[i + 2];
|
|
674
|
-
if (!cp1 || !cp2 || !anchor)
|
|
675
|
-
continue;
|
|
676
|
-
waypoints.push(anchor);
|
|
677
|
-
segments.push({ curviness, cp1, cp2 });
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
else {
|
|
681
|
-
waypoints = coords;
|
|
682
|
-
for (let i = 0; i < waypoints.length - 1; i++) {
|
|
683
|
-
segments.push({ curviness });
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
return {
|
|
687
|
-
arcPath: { enabled: true, autoRotate, segments },
|
|
688
|
-
waypoints,
|
|
689
|
-
};
|
|
666
|
+
return buildArcPath(coords, curviness, autoRotate, isCubic);
|
|
690
667
|
}
|
|
691
668
|
// ── Animation assembly ────────────────────────────────────────────────────────
|
|
692
669
|
// fallow-ignore-next-line complexity
|
|
@@ -806,6 +783,9 @@ function tweenCallToAnimation(call, scope, source) {
|
|
|
806
783
|
anim.hasUnresolvedKeyframes = true;
|
|
807
784
|
if (call.selector === "__unresolved__")
|
|
808
785
|
anim.hasUnresolvedSelector = true;
|
|
786
|
+
const provenance = readProvenance(call.node);
|
|
787
|
+
if (provenance)
|
|
788
|
+
anim.provenance = provenance;
|
|
809
789
|
return anim;
|
|
810
790
|
}
|
|
811
791
|
// ── Timeline position resolution ─────────────────────────────────────────────
|
|
@@ -877,14 +857,28 @@ function resolveTimelinePositions(anims) {
|
|
|
877
857
|
}
|
|
878
858
|
}
|
|
879
859
|
}
|
|
860
|
+
function compareByLoc(a, b) {
|
|
861
|
+
const aLoc = a.node.callee?.property?.loc?.start;
|
|
862
|
+
const bLoc = b.node.callee?.property?.loc?.start;
|
|
863
|
+
if (!aLoc || !bLoc)
|
|
864
|
+
return 0;
|
|
865
|
+
return aLoc.line - bLoc.line || aLoc.column - bLoc.column;
|
|
866
|
+
}
|
|
867
|
+
// Inlined tweens carry a monotonic __hfOrder (clones share source loc, so loc
|
|
868
|
+
// can't order them); they sort by that, after all literal (loc-ordered) tweens.
|
|
869
|
+
function compareCallOrder(a, b) {
|
|
870
|
+
const ao = a.node.__hfOrder;
|
|
871
|
+
const bo = b.node.__hfOrder;
|
|
872
|
+
if (ao === undefined && bo === undefined)
|
|
873
|
+
return compareByLoc(a, b);
|
|
874
|
+
if (ao === undefined)
|
|
875
|
+
return -1;
|
|
876
|
+
if (bo === undefined)
|
|
877
|
+
return 1;
|
|
878
|
+
return ao - bo;
|
|
879
|
+
}
|
|
880
880
|
function sortBySourcePosition(calls) {
|
|
881
|
-
calls.sort(
|
|
882
|
-
const aLoc = a.node.callee?.property?.loc?.start;
|
|
883
|
-
const bLoc = b.node.callee?.property?.loc?.start;
|
|
884
|
-
if (!aLoc || !bLoc)
|
|
885
|
-
return 0;
|
|
886
|
-
return aLoc.line - bLoc.line || aLoc.column - bLoc.column;
|
|
887
|
-
});
|
|
881
|
+
calls.sort(compareCallOrder);
|
|
888
882
|
}
|
|
889
883
|
// ── Stable ID generation ──────────────────────────────────────────────────────
|
|
890
884
|
function assignStableIds(anims) {
|
|
@@ -946,9 +940,18 @@ export function parseGsapScriptAcorn(script) {
|
|
|
946
940
|
locations: true,
|
|
947
941
|
});
|
|
948
942
|
const scope = collectScopeBindings(ast);
|
|
949
|
-
const targetBindings = collectTargetBindings(ast, scope);
|
|
950
943
|
const detection = findTimelineVar(ast, scope);
|
|
951
944
|
const timelineVar = detection.timelineVar ?? "tl";
|
|
945
|
+
// Expand helper-built / bounded-loop timelines before analysis so their
|
|
946
|
+
// tweens resolve at true positions (read path only — the write path keeps
|
|
947
|
+
// original source nodes). Degrades to the un-inlined AST on any failure.
|
|
948
|
+
try {
|
|
949
|
+
inlineComputedTimelines(ast, timelineVar, (node) => resolveNode(node, scope));
|
|
950
|
+
}
|
|
951
|
+
catch {
|
|
952
|
+
/* fall back to current behavior */
|
|
953
|
+
}
|
|
954
|
+
const targetBindings = collectTargetBindings(ast, scope);
|
|
952
955
|
const calls = findAllTweenCalls(ast, timelineVar, scope, targetBindings);
|
|
953
956
|
sortBySourcePosition(calls);
|
|
954
957
|
const rawAnims = calls.map((call) => tweenCallToAnimation(call, scope, script));
|