@hyperframes/parsers 0.8.115 → 0.8.117

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.
@@ -1,2 +1,2 @@
1
- export { P as PROPERTY_GROUPS, h as PropertyGroupName, S as SUPPORTED_EASES, i as SUPPORTED_PROPS, m as classifyPropertyGroup, n as classifyTweenPropertyGroup, w as isXYPositionWrite } from './gsapSerialize-g8oprts9.js';
1
+ export { P as PROPERTY_GROUPS, h as PropertyGroupName, S as SUPPORTED_EASES, i as SUPPORTED_PROPS, m as classifyPropertyGroup, n as classifyTweenPropertyGroup, w as isXYPositionWrite, x as positionHoldForAnimation } from './gsapSerialize-CVwsMItk.js';
2
2
  import './types-Ejqndkej.js';
@@ -51,9 +51,11 @@ var PROP_TO_GROUP = /* @__PURE__ */ new Map();
51
51
  for (const [group, props] of Object.entries(PROPERTY_GROUPS)) {
52
52
  for (const p of props) PROP_TO_GROUP.set(p, group);
53
53
  }
54
+ function writesProperty(animation, property) {
55
+ return property in animation.properties || !!animation.fromProperties && property in animation.fromProperties || !!animation.keyframes?.keyframes.some((k) => property in k.properties);
56
+ }
54
57
  function isXYPositionWrite(a) {
55
- const xy = (props) => !!props && ("x" in props || "y" in props);
56
- return a.propertyGroup === "position" && (xy(a.properties) || xy(a.fromProperties) || !!a.keyframes?.keyframes.some((k) => xy(k.properties)));
58
+ return a.propertyGroup === "position" && (writesProperty(a, "x") || writesProperty(a, "y"));
57
59
  }
58
60
  function classifyPropertyGroup(prop) {
59
61
  return PROP_TO_GROUP.get(prop) ?? "other";
@@ -68,6 +70,30 @@ function classifyTweenPropertyGroup(properties) {
68
70
  if (groups.size === 1) return groups.values().next().value;
69
71
  return void 0;
70
72
  }
73
+ function knownStart(animation) {
74
+ if (animation.resolvedStart !== void 0) return animation.resolvedStart;
75
+ return typeof animation.position === "number" ? animation.position : void 0;
76
+ }
77
+ function positionHoldForAnimation(animation, animations) {
78
+ if (!animation.keyframes) return null;
79
+ const start = knownStart(animation) ?? 0;
80
+ if (!(start > 1e-3)) return null;
81
+ const first = [...animation.keyframes.keyframes].sort(
82
+ (left, right) => left.percentage - right.percentage
83
+ )[0];
84
+ if (!first) return null;
85
+ const earlier = animations.filter((other) => {
86
+ const otherStart = knownStart(other);
87
+ return other !== animation && !other.global && other.targetSelector === animation.targetSelector && otherStart !== void 0 && otherStart < start - 1e-3;
88
+ });
89
+ const position = {};
90
+ for (const [property, value] of Object.entries(first.properties)) {
91
+ if (classifyPropertyGroup(property) !== "position" || typeof value !== "number") continue;
92
+ if (earlier.some((other) => writesProperty(other, property))) continue;
93
+ position[property] = value;
94
+ }
95
+ return Object.keys(position).length > 0 ? position : null;
96
+ }
71
97
  var SUPPORTED_EASES = [
72
98
  "none",
73
99
  "power1.in",
@@ -111,6 +137,7 @@ export {
111
137
  SUPPORTED_PROPS,
112
138
  classifyPropertyGroup,
113
139
  classifyTweenPropertyGroup,
114
- isXYPositionWrite
140
+ isXYPositionWrite,
141
+ positionHoldForAnimation
115
142
  };
116
143
  //# sourceMappingURL=gsapConstants.js.map
@@ -1 +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\nimport type { GsapAnimation } from \"./gsapSerialize.js\";\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\ntype PositionWrite = Pick<\n GsapAnimation,\n \"propertyGroup\" | \"properties\" | \"fromProperties\" | \"keyframes\"\n>;\n\n/** A position write that sets x or y. An xPercent/yPercent centring set never duplicates one. */\nexport function isXYPositionWrite(a: PositionWrite): boolean {\n const xy = (props?: Record<string, unknown>) => !!props && (\"x\" in props || \"y\" in props);\n return (\n a.propertyGroup === \"position\" &&\n (xy(a.properties) ||\n xy(a.fromProperties) ||\n !!a.keyframes?.keyframes.some((k) => xy(k.properties)))\n );\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 \"circ.inOut\",\n \"expo.in\",\n \"expo.out\",\n \"expo.inOut\",\n \"elastic.out(1,0.3)\",\n \"elastic.inOut(1,0.3)\",\n \"spring-gentle\",\n \"spring-bouncy\",\n \"spring-stiff\",\n \"spring-wobbly\",\n \"spring-heavy\",\n \"hold\",\n \"steps(1)\",\n];\n"],"mappings":";AASO,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,oBAA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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":[]}
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\nimport type { GsapAnimation } from \"./gsapSerialize.js\";\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\ntype PositionWrite = Pick<\n GsapAnimation,\n \"propertyGroup\" | \"properties\" | \"fromProperties\" | \"keyframes\"\n>;\n\nfunction writesProperty(animation: PositionWrite, property: string): boolean {\n return (\n property in animation.properties ||\n (!!animation.fromProperties && property in animation.fromProperties) ||\n !!animation.keyframes?.keyframes.some((k) => property in k.properties)\n );\n}\n\n/** A position write that sets x or y. An xPercent/yPercent centring set never duplicates one. */\nexport function isXYPositionWrite(a: PositionWrite): boolean {\n return a.propertyGroup === \"position\" && (writesProperty(a, \"x\") || writesProperty(a, \"y\"));\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\nfunction knownStart(animation: GsapAnimation): number | undefined {\n if (animation.resolvedStart !== undefined) return animation.resolvedStart;\n return typeof animation.position === \"number\" ? animation.position : undefined;\n}\n\n/**\n * What a Studio hold pins from t=0 before a later keyframed tween: its first keyframe's position props,\n * minus those an earlier timeline tween on the target writes (a global `gsap.set` is a base value).\n */\nexport function positionHoldForAnimation(\n animation: GsapAnimation,\n animations: readonly GsapAnimation[],\n): Record<string, number> | null {\n if (!animation.keyframes) return null;\n const start = knownStart(animation) ?? 0;\n if (!(start > 0.001)) return null;\n const first = [...animation.keyframes.keyframes].sort(\n (left, right) => left.percentage - right.percentage,\n )[0];\n if (!first) return null;\n // A tween whose start the parser could not resolve (a label, say) is not known to come first.\n const earlier = animations.filter((other) => {\n const otherStart = knownStart(other);\n return (\n other !== animation &&\n !other.global &&\n other.targetSelector === animation.targetSelector &&\n otherStart !== undefined &&\n otherStart < start - 0.001\n );\n });\n const position: Record<string, number> = {};\n for (const [property, value] of Object.entries(first.properties)) {\n if (classifyPropertyGroup(property) !== \"position\" || typeof value !== \"number\") continue;\n if (earlier.some((other) => writesProperty(other, property))) continue;\n position[property] = value;\n }\n return Object.keys(position).length > 0 ? position : null;\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 \"circ.inOut\",\n \"expo.in\",\n \"expo.out\",\n \"expo.inOut\",\n \"elastic.out(1,0.3)\",\n \"elastic.inOut(1,0.3)\",\n \"spring-gentle\",\n \"spring-bouncy\",\n \"spring-stiff\",\n \"spring-wobbly\",\n \"spring-heavy\",\n \"hold\",\n \"steps(1)\",\n];\n"],"mappings":";AASO,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;AA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,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":[]}
@@ -1,5 +1,5 @@
1
- import { G as GsapAnimation, g as ParsedGsap, A as ArcPathConfig, a as ArcPathSegment } from './gsapSerialize-g8oprts9.js';
2
- export { u as GsapKeyframeFormat, b as GsapKeyframesData, c as GsapMethod, d as GsapPercentageKeyframe, P as PROPERTY_GROUPS, h as PropertyGroupName, S as SUPPORTED_EASES, i as SUPPORTED_PROPS, m as classifyPropertyGroup, n as classifyTweenPropertyGroup, p as getAnimationsForElementId, q as gsapAnimationsToKeyframes, r as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-g8oprts9.js';
1
+ import { G as GsapAnimation, g as ParsedGsap, A as ArcPathConfig, a as ArcPathSegment } from './gsapSerialize-CVwsMItk.js';
2
+ export { u as GsapKeyframeFormat, b as GsapKeyframesData, c as GsapMethod, d as GsapPercentageKeyframe, P as PROPERTY_GROUPS, h as PropertyGroupName, S as SUPPORTED_EASES, i as SUPPORTED_PROPS, m as classifyPropertyGroup, n as classifyTweenPropertyGroup, p as getAnimationsForElementId, q as gsapAnimationsToKeyframes, r as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-CVwsMItk.js';
3
3
  export { SPRING_PRESETS, SpringPreset, generateSpringEaseData } from './springEase.js';
4
4
  import './types-Ejqndkej.js';
5
5
 
@@ -55,9 +55,11 @@ var PROP_TO_GROUP = /* @__PURE__ */ new Map();
55
55
  for (const [group, props] of Object.entries(PROPERTY_GROUPS)) {
56
56
  for (const p of props) PROP_TO_GROUP.set(p, group);
57
57
  }
58
+ function writesProperty(animation, property) {
59
+ return property in animation.properties || !!animation.fromProperties && property in animation.fromProperties || !!animation.keyframes?.keyframes.some((k) => property in k.properties);
60
+ }
58
61
  function isXYPositionWrite(a) {
59
- const xy = (props) => !!props && ("x" in props || "y" in props);
60
- return a.propertyGroup === "position" && (xy(a.properties) || xy(a.fromProperties) || !!a.keyframes?.keyframes.some((k) => xy(k.properties)));
62
+ return a.propertyGroup === "position" && (writesProperty(a, "x") || writesProperty(a, "y"));
61
63
  }
62
64
  function classifyPropertyGroup(prop) {
63
65
  return PROP_TO_GROUP.get(prop) ?? "other";
@@ -72,6 +74,30 @@ function classifyTweenPropertyGroup(properties) {
72
74
  if (groups.size === 1) return groups.values().next().value;
73
75
  return void 0;
74
76
  }
77
+ function knownStart(animation) {
78
+ if (animation.resolvedStart !== void 0) return animation.resolvedStart;
79
+ return typeof animation.position === "number" ? animation.position : void 0;
80
+ }
81
+ function positionHoldForAnimation(animation, animations) {
82
+ if (!animation.keyframes) return null;
83
+ const start = knownStart(animation) ?? 0;
84
+ if (!(start > 1e-3)) return null;
85
+ const first = [...animation.keyframes.keyframes].sort(
86
+ (left, right) => left.percentage - right.percentage
87
+ )[0];
88
+ if (!first) return null;
89
+ const earlier = animations.filter((other) => {
90
+ const otherStart = knownStart(other);
91
+ return other !== animation && !other.global && other.targetSelector === animation.targetSelector && otherStart !== void 0 && otherStart < start - 1e-3;
92
+ });
93
+ const position = {};
94
+ for (const [property, value] of Object.entries(first.properties)) {
95
+ if (classifyPropertyGroup(property) !== "position" || typeof value !== "number") continue;
96
+ if (earlier.some((other) => writesProperty(other, property))) continue;
97
+ position[property] = value;
98
+ }
99
+ return Object.keys(position).length > 0 ? position : null;
100
+ }
75
101
  var SUPPORTED_EASES = [
76
102
  "none",
77
103
  "power1.in",
@@ -1733,16 +1759,8 @@ function syncPositionHoldsBeforeKeyframes(script) {
1733
1759
  return result;
1734
1760
  }
1735
1761
  for (const anim of reparsed.animations) {
1736
- if (!anim.keyframes) continue;
1737
- const start = anim.resolvedStart ?? (typeof anim.position === "number" ? anim.position : 0);
1738
- if (!(start > 1e-3)) continue;
1739
- const firstKf = [...anim.keyframes.keyframes].sort((a, b) => a.percentage - b.percentage)[0];
1740
- if (!firstKf) continue;
1741
- const posProps = {};
1742
- for (const [k, v] of Object.entries(firstKf.properties)) {
1743
- if (classifyPropertyGroup(k) === "position" && typeof v === "number") posProps[k] = v;
1744
- }
1745
- if (Object.keys(posProps).length === 0) continue;
1762
+ const posProps = positionHoldForAnimation(anim, reparsed.animations);
1763
+ if (!posProps) continue;
1746
1764
  result = insertInheritedStateSet(result, anim.targetSelector, 0, {
1747
1765
  ...posProps,
1748
1766
  data: STUDIO_HOLD_MARKER