@hyperframes/parsers 0.8.134 → 0.8.136
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/gsapConstants.d.ts +1 -1
- package/dist/gsapParser.d.ts +2 -2
- package/dist/gsapParser.js +21 -14
- package/dist/gsapParser.js.map +1 -1
- package/dist/gsapParserAcorn.d.ts +9 -3
- package/dist/gsapParserAcorn.js +35 -9
- package/dist/gsapParserAcorn.js.map +1 -1
- package/dist/gsapParserExports.d.ts +1 -1
- package/dist/gsapParserExports.js +0 -3
- package/dist/gsapParserExports.js.map +1 -1
- package/dist/{gsapSerialize-_tuK-qvB.d.ts → gsapSerialize-WJrRO8uT.d.ts} +1 -1
- package/dist/gsapWriterAcorn.d.ts +1 -1
- package/dist/gsapWriterAcorn.js +22 -9
- package/dist/gsapWriterAcorn.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/gsapConstants.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { B as BUILTIN_VAR_KEYS, D as DROPPED_VAR_KEYS, E as EXTRAS_KEYS, u as GSAP_DEFAULT_DURATION, H as HoldScope,
|
|
1
|
+
export { B as BUILTIN_VAR_KEYS, D as DROPPED_VAR_KEYS, E as EXTRAS_KEYS, u as GSAP_DEFAULT_DURATION, H as HoldScope, f as PROPERTY_GROUPS, g as PropertyGroupName, S as SUPPORTED_EASES, h as SUPPORTED_PROPS, i as classifyPropertyGroup, j as classifyTweenPropertyGroup, x as holdScope, y as isTweenConfigKey, z as isXYPositionWrite, C as keyframeHoldForAnimation } from './gsapSerialize-WJrRO8uT.js';
|
|
2
2
|
import './types-Ejqndkej.js';
|
package/dist/gsapParser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { G as GsapAnimation, P as ParsedGsap, A as ArcPathConfig, a as ArcPathSegment } from './gsapSerialize-WJrRO8uT.js';
|
|
2
|
+
export { b as GsapKeyframeFormat, c as GsapKeyframesData, d as GsapMethod, e as GsapPercentageKeyframe, f as PROPERTY_GROUPS, g as PropertyGroupName, S as SUPPORTED_EASES, h as SUPPORTED_PROPS, i as classifyPropertyGroup, j as classifyTweenPropertyGroup, k as getAnimationsForElementId, l as gsapAnimationsToKeyframes, m as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-WJrRO8uT.js';
|
|
3
3
|
export { SPRING_PRESETS, SpringPreset, generateSpringEaseData } from './springEase.js';
|
|
4
4
|
import './types-Ejqndkej.js';
|
|
5
5
|
|
package/dist/gsapParser.js
CHANGED
|
@@ -266,6 +266,10 @@ function serializeValue(value) {
|
|
|
266
266
|
if (typeof value === "string") return JSON.stringify(value);
|
|
267
267
|
return String(value);
|
|
268
268
|
}
|
|
269
|
+
function plainPercentKey(percentage) {
|
|
270
|
+
const text = Math.abs(percentage) < 1e-6 ? percentage.toFixed(20).replace(/\.?0+$/, "") : String(percentage);
|
|
271
|
+
return `${text}%`;
|
|
272
|
+
}
|
|
269
273
|
function safeJsKey(key) {
|
|
270
274
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key) ? key : JSON.stringify(key);
|
|
271
275
|
}
|
|
@@ -1230,9 +1234,6 @@ function tweenCallToAnimation(call, scope) {
|
|
|
1230
1234
|
properties[key] = val;
|
|
1231
1235
|
}
|
|
1232
1236
|
}
|
|
1233
|
-
if (keyframesData && typeof vars.easeEach === "string") {
|
|
1234
|
-
keyframesData.easeEach = vars.easeEach;
|
|
1235
|
-
}
|
|
1236
1237
|
if (motionPathResult) {
|
|
1237
1238
|
const { waypoints } = motionPathResult;
|
|
1238
1239
|
if (!keyframesData) {
|
|
@@ -1934,7 +1935,7 @@ function buildKeyframeObjectCode(keyframes, options) {
|
|
|
1934
1935
|
const props = keyframePropsToCode(kf);
|
|
1935
1936
|
if (kf.ease) props.push(`ease: ${JSON.stringify(kf.ease)}`);
|
|
1936
1937
|
if (kf.auto) props.push(`_auto: 1`);
|
|
1937
|
-
return `${JSON.stringify(
|
|
1938
|
+
return `${JSON.stringify(plainPercentKey(kf.percentage))}: { ${props.join(", ")} }`;
|
|
1938
1939
|
});
|
|
1939
1940
|
if (options?.easeEach) entries.push(`easeEach: ${JSON.stringify(options.easeEach)}`);
|
|
1940
1941
|
return `{ ${entries.join(", ")} }`;
|
|
@@ -2050,7 +2051,7 @@ function convertArrayKeyframesToObjectNode(varsArg, scope) {
|
|
|
2050
2051
|
el.properties = (el.properties ?? []).filter(
|
|
2051
2052
|
(property) => !isObjectProperty(property) || propKeyName(property) !== "duration"
|
|
2052
2053
|
);
|
|
2053
|
-
return `${JSON.stringify(
|
|
2054
|
+
return `${JSON.stringify(plainPercentKey(timing.percentages[i]))}: ${recast.print(el).code}`;
|
|
2054
2055
|
});
|
|
2055
2056
|
prop.value = parseExpr(`{ ${entries.join(", ")}, easeEach: "none" }`);
|
|
2056
2057
|
return prop.value;
|
|
@@ -2075,7 +2076,7 @@ function locateKeyframeCtx(script, animationId, percentage) {
|
|
|
2075
2076
|
if (!loc) return null;
|
|
2076
2077
|
const kfNode = findKeyframesObjectNode(loc.target.call.varsArg);
|
|
2077
2078
|
if (!kfNode) return null;
|
|
2078
|
-
return { loc, kfNode, pctKey:
|
|
2079
|
+
return { loc, kfNode, pctKey: plainPercentKey(percentage) };
|
|
2079
2080
|
}
|
|
2080
2081
|
function addKeyframeToScript(script, animationId, percentage, properties, ease, backfillDefaults) {
|
|
2081
2082
|
let loc = locateAnimationWithFallback(script, animationId);
|
|
@@ -2091,7 +2092,7 @@ function addKeyframeToScript(script, animationId, percentage, properties, ease,
|
|
|
2091
2092
|
kfNode = findKeyframesObjectNode(loc.target.call.varsArg);
|
|
2092
2093
|
if (!kfNode) return script;
|
|
2093
2094
|
}
|
|
2094
|
-
const pctKey =
|
|
2095
|
+
const pctKey = plainPercentKey(percentage);
|
|
2095
2096
|
const newValueNode = buildKeyframeValueNode(properties, ease);
|
|
2096
2097
|
const existing = findKeyframePropByPct(kfNode, percentage);
|
|
2097
2098
|
if (existing) {
|
|
@@ -2219,11 +2220,16 @@ function moveKeyframeInScript(script, animationId, fromPercentage, toPercentage)
|
|
|
2219
2220
|
}
|
|
2220
2221
|
entries.push({ pct: toPercentage, value: movedValue });
|
|
2221
2222
|
entries.sort((a, b) => a.pct - b.pct);
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2223
|
+
const pctProps = new Set(filterPercentageProps(kfNode));
|
|
2224
|
+
const kept = (kfNode.properties ?? []).filter((p) => !pctProps.has(p));
|
|
2225
|
+
kfNode.properties = [
|
|
2226
|
+
...entries.map((e) => {
|
|
2227
|
+
const p = parseExpr(`{ ${JSON.stringify(plainPercentKey(e.pct))}: {} }`).properties[0];
|
|
2228
|
+
p.value = e.value;
|
|
2229
|
+
return p;
|
|
2230
|
+
}),
|
|
2231
|
+
...kept
|
|
2232
|
+
];
|
|
2227
2233
|
return recast.print(loc.parsed.ast).code;
|
|
2228
2234
|
}
|
|
2229
2235
|
function resizeKeyframedTweenInScript(script, animationId, newPosition, newDuration, pctRemap) {
|
|
@@ -2236,7 +2242,7 @@ function resizeKeyframedTweenInScript(script, animationId, newPosition, newDurat
|
|
|
2236
2242
|
const match = findKeyframePropByPct(kfNode, from);
|
|
2237
2243
|
if (!match || seen.has(match.prop)) continue;
|
|
2238
2244
|
seen.add(match.prop);
|
|
2239
|
-
match.prop.key = parseExpr(`{ ${JSON.stringify(
|
|
2245
|
+
match.prop.key = parseExpr(`{ ${JSON.stringify(plainPercentKey(to))}: 0 }`).properties[0].key;
|
|
2240
2246
|
}
|
|
2241
2247
|
applyUpdatesToCall(loc.target.call, {
|
|
2242
2248
|
position: newPosition,
|
|
@@ -2746,7 +2752,8 @@ function splitIntoPropertyGroups(script, animationId) {
|
|
|
2746
2752
|
typeof anim.position === "number" ? anim.position : 0,
|
|
2747
2753
|
anim.duration ?? 0.5,
|
|
2748
2754
|
groupKeyframes,
|
|
2749
|
-
anim.keyframes.
|
|
2755
|
+
anim.keyframes.ease ?? anim.ease,
|
|
2756
|
+
anim.keyframes.easeEach
|
|
2750
2757
|
);
|
|
2751
2758
|
result = addResult.script;
|
|
2752
2759
|
} else {
|