@hyperframes/parsers 0.8.125 → 0.8.127
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/gsapConstants.js +23 -0
- package/dist/gsapConstants.js.map +1 -1
- package/dist/gsapParser.d.ts +2 -2
- package/dist/gsapParser.js +20 -12
- package/dist/gsapParser.js.map +1 -1
- package/dist/gsapParserAcorn.d.ts +2 -2
- package/dist/gsapParserAcorn.js +20 -12
- package/dist/gsapParserAcorn.js.map +1 -1
- package/dist/gsapParserExports.d.ts +1 -1
- package/dist/gsapParserExports.js +20 -12
- package/dist/gsapParserExports.js.map +1 -1
- package/dist/{gsapSerialize-CVwsMItk.d.ts → gsapSerialize-CFUDcLqX.d.ts} +7 -1
- package/dist/gsapWriterAcorn.d.ts +1 -1
- package/dist/gsapWriterAcorn.js +24 -29
- package/dist/gsapWriterAcorn.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -8,6 +8,12 @@ import { K as Keyframe, V as ValidationResult } from './types-Ejqndkej.js';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
declare const SUPPORTED_PROPS: string[];
|
|
11
|
+
/** Keys stored on dedicated GsapAnimation fields (not in properties/extras). */
|
|
12
|
+
declare const BUILTIN_VAR_KEYS: ReadonlySet<string>;
|
|
13
|
+
declare const DROPPED_VAR_KEYS: ReadonlySet<string>;
|
|
14
|
+
/** Keys that go in `extras`: non-editable GSAP config that must survive round-trips. */
|
|
15
|
+
declare const EXTRAS_KEYS: ReadonlySet<string>;
|
|
16
|
+
declare function isTweenConfigKey(key: string): boolean;
|
|
11
17
|
type PropertyGroupName = "position" | "scale" | "size" | "rotation" | "visual" | "other";
|
|
12
18
|
declare const PROPERTY_GROUPS: Record<PropertyGroupName, ReadonlySet<string>>;
|
|
13
19
|
type PositionWrite = Pick<GsapAnimation, "propertyGroup" | "properties" | "fromProperties" | "keyframes">;
|
|
@@ -208,4 +214,4 @@ declare function gsapAnimationsToKeyframes(animations: GsapAnimation[], elementS
|
|
|
208
214
|
skipBaseSet?: boolean;
|
|
209
215
|
}): Keyframe[];
|
|
210
216
|
|
|
211
|
-
export { type ArcPathConfig as A, type GsapAnimation as G, type KeyframeEditability as K, type MotionPathShape as M, PROPERTY_GROUPS as P, SUPPORTED_EASES as S, type ArcPathSegment as a, type GsapKeyframesData as b, type GsapMethod as c, type GsapPercentageKeyframe as d, type GsapProvenance as e, type GsapProvenanceKind as f, type ParsedGsap as g, type PropertyGroupName as h, SUPPORTED_PROPS as i, type SourcedGsapPercentageKeyframe as j, type SplitAnimationsOptions as k, type SplitAnimationsResult as l, classifyPropertyGroup as m, classifyTweenPropertyGroup as n, editabilityForProvenance as o, getAnimationsForElementId as p, gsapAnimationsToKeyframes as q, keyframesToGsapAnimations as r, serializeGsapAnimations as s, buildArcPath as t, type GsapKeyframeFormat as u, validateCompositionGsap as v,
|
|
217
|
+
export { type ArcPathConfig as A, BUILTIN_VAR_KEYS as B, DROPPED_VAR_KEYS as D, EXTRAS_KEYS as E, type GsapAnimation as G, type KeyframeEditability as K, type MotionPathShape as M, PROPERTY_GROUPS as P, SUPPORTED_EASES as S, type ArcPathSegment as a, type GsapKeyframesData as b, type GsapMethod as c, type GsapPercentageKeyframe as d, type GsapProvenance as e, type GsapProvenanceKind as f, type ParsedGsap as g, type PropertyGroupName as h, SUPPORTED_PROPS as i, type SourcedGsapPercentageKeyframe as j, type SplitAnimationsOptions as k, type SplitAnimationsResult as l, classifyPropertyGroup as m, classifyTweenPropertyGroup as n, editabilityForProvenance as o, getAnimationsForElementId as p, gsapAnimationsToKeyframes as q, keyframesToGsapAnimations as r, serializeGsapAnimations as s, buildArcPath as t, type GsapKeyframeFormat as u, validateCompositionGsap as v, isTweenConfigKey as w, isXYPositionWrite as x, positionHoldForAnimation as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GsapAnimation, A as ArcPathConfig, k as SplitAnimationsOptions, l as SplitAnimationsResult, a as ArcPathSegment } from './gsapSerialize-
|
|
1
|
+
import { G as GsapAnimation, A as ArcPathConfig, k as SplitAnimationsOptions, l as SplitAnimationsResult, a as ArcPathSegment } from './gsapSerialize-CFUDcLqX.js';
|
|
2
2
|
import './types-Ejqndkej.js';
|
|
3
3
|
|
|
4
4
|
type TweenTarget = Pick<GsapAnimation, "targetSelector" | "hasPartialSelector">;
|
package/dist/gsapWriterAcorn.js
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
import MagicString from "magic-string";
|
|
3
3
|
|
|
4
4
|
// src/gsapConstants.ts
|
|
5
|
+
var BUILTIN_VAR_KEYS = /* @__PURE__ */ new Set(["duration", "ease", "delay"]);
|
|
6
|
+
var DROPPED_VAR_KEYS = /* @__PURE__ */ new Set([
|
|
7
|
+
"onComplete",
|
|
8
|
+
"onStart",
|
|
9
|
+
"onUpdate",
|
|
10
|
+
"onRepeat"
|
|
11
|
+
]);
|
|
12
|
+
var EXTRAS_KEYS = /* @__PURE__ */ new Set([
|
|
13
|
+
"stagger",
|
|
14
|
+
"yoyo",
|
|
15
|
+
"repeat",
|
|
16
|
+
"repeatDelay",
|
|
17
|
+
"snap",
|
|
18
|
+
"overwrite",
|
|
19
|
+
"immediateRender"
|
|
20
|
+
]);
|
|
21
|
+
function isTweenConfigKey(key) {
|
|
22
|
+
return BUILTIN_VAR_KEYS.has(key) || DROPPED_VAR_KEYS.has(key) || EXTRAS_KEYS.has(key);
|
|
23
|
+
}
|
|
5
24
|
var PROPERTY_GROUPS = {
|
|
6
25
|
position: /* @__PURE__ */ new Set(["x", "y", "xPercent", "yPercent"]),
|
|
7
26
|
scale: /* @__PURE__ */ new Set(["scale", "scaleX", "scaleY"]),
|
|
@@ -755,17 +774,6 @@ function findTimelineVar(ast, scope) {
|
|
|
755
774
|
});
|
|
756
775
|
return { timelineVar, ref, timelineCount, defaults };
|
|
757
776
|
}
|
|
758
|
-
var BUILTIN_VAR_KEYS = /* @__PURE__ */ new Set(["duration", "ease", "delay"]);
|
|
759
|
-
var DROPPED_VAR_KEYS = /* @__PURE__ */ new Set(["onComplete", "onStart", "onUpdate", "onRepeat"]);
|
|
760
|
-
var EXTRAS_KEYS = /* @__PURE__ */ new Set([
|
|
761
|
-
"stagger",
|
|
762
|
-
"yoyo",
|
|
763
|
-
"repeat",
|
|
764
|
-
"repeatDelay",
|
|
765
|
-
"snap",
|
|
766
|
-
"overwrite",
|
|
767
|
-
"immediateRender"
|
|
768
|
-
]);
|
|
769
777
|
function isTimelineRootedCall(callNode, ref) {
|
|
770
778
|
let obj = callNode.callee?.object;
|
|
771
779
|
while (obj?.type === "CallExpression") {
|
|
@@ -885,11 +893,12 @@ function computeKeyframesTotalDuration(varsNode, scope, source) {
|
|
|
885
893
|
}
|
|
886
894
|
return getObjectArrayKeyframeTiming(durations)?.totalDuration;
|
|
887
895
|
}
|
|
896
|
+
var isFullyReadableStep = (el) => el?.type === "ObjectExpression" && !el.properties.some((p) => p.type === "SpreadElement");
|
|
888
897
|
function parseObjectArrayKeyframes(node, scope, source) {
|
|
889
898
|
const elements = node.elements ?? [];
|
|
890
899
|
const raw = [];
|
|
891
900
|
for (const el of elements) {
|
|
892
|
-
if (!el
|
|
901
|
+
if (!isFullyReadableStep(el)) return void 0;
|
|
893
902
|
const record = objectExpressionToRecord(el, scope, source);
|
|
894
903
|
const properties = {};
|
|
895
904
|
let duration;
|
|
@@ -901,6 +910,8 @@ function parseObjectArrayKeyframes(node, scope, source) {
|
|
|
901
910
|
ease = v;
|
|
902
911
|
} else if (typeof v === "number" || typeof v === "string") {
|
|
903
912
|
properties[k] = v;
|
|
913
|
+
} else {
|
|
914
|
+
return void 0;
|
|
904
915
|
}
|
|
905
916
|
}
|
|
906
917
|
raw.push({ properties, duration, ease });
|
|
@@ -1486,24 +1497,8 @@ function upsertProp(ms, objNode, key, value) {
|
|
|
1486
1497
|
ms.appendLeft(objNode.end - 1, `${sep}${safeKey(key)}: ${valueToCode(value)}`);
|
|
1487
1498
|
}
|
|
1488
1499
|
}
|
|
1489
|
-
var NON_EDITABLE_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
1490
|
-
"duration",
|
|
1491
|
-
"ease",
|
|
1492
|
-
"delay",
|
|
1493
|
-
"onComplete",
|
|
1494
|
-
"onStart",
|
|
1495
|
-
"onUpdate",
|
|
1496
|
-
"onRepeat",
|
|
1497
|
-
"stagger",
|
|
1498
|
-
"yoyo",
|
|
1499
|
-
"repeat",
|
|
1500
|
-
"repeatDelay",
|
|
1501
|
-
"snap",
|
|
1502
|
-
"overwrite",
|
|
1503
|
-
"immediateRender"
|
|
1504
|
-
]);
|
|
1505
1500
|
function isEditableVarKey(key) {
|
|
1506
|
-
return !
|
|
1501
|
+
return !isTweenConfigKey(key);
|
|
1507
1502
|
}
|
|
1508
1503
|
function preservedEntries(objNode, source, drop, overrides) {
|
|
1509
1504
|
const entries = [];
|