@hyperframes/parsers 0.8.106 → 0.8.107

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,5 +1,21 @@
1
1
  import { K as Keyframe, V as ValidationResult } from './types-Y0NXTiVo.js';
2
- import { PropertyGroupName } from './gsapConstants.js';
2
+
3
+ /**
4
+ * GSAP property and ease constants.
5
+ *
6
+ * Extracted into a standalone module so browser code can import them
7
+ * without pulling in gsapParser (which depends on recast / @babel/parser).
8
+ */
9
+
10
+ declare const SUPPORTED_PROPS: string[];
11
+ type PropertyGroupName = "position" | "scale" | "size" | "rotation" | "visual" | "other";
12
+ declare const PROPERTY_GROUPS: Record<PropertyGroupName, ReadonlySet<string>>;
13
+ type PositionWrite = Pick<GsapAnimation, "propertyGroup" | "properties" | "fromProperties" | "keyframes">;
14
+ /** A position write that sets x or y. An xPercent/yPercent centring set never duplicates one. */
15
+ declare function isXYPositionWrite(a: PositionWrite): boolean;
16
+ declare function classifyPropertyGroup(prop: string): PropertyGroupName;
17
+ declare function classifyTweenPropertyGroup(properties: Record<string, unknown>): PropertyGroupName | undefined;
18
+ declare const SUPPORTED_EASES: string[];
3
19
 
4
20
  /**
5
21
  * Recast-free GSAP helpers: serialization, keyframe<->animation conversion,
@@ -187,4 +203,4 @@ declare function gsapAnimationsToKeyframes(animations: GsapAnimation[], elementS
187
203
  skipBaseSet?: boolean;
188
204
  }): Keyframe[];
189
205
 
190
- export { type ArcPathConfig as A, type GsapAnimation as G, type KeyframeEditability as K, type MotionPathShape as M, type ParsedGsap as P, type SourcedGsapPercentageKeyframe 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 SplitAnimationsOptions as g, type SplitAnimationsResult as h, editabilityForProvenance as i, getAnimationsForElementId as j, gsapAnimationsToKeyframes as k, keyframesToGsapAnimations as l, buildArcPath as m, type GsapKeyframeFormat as n, serializeGsapAnimations as s, validateCompositionGsap as v };
206
+ 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, isXYPositionWrite as w };
@@ -1,6 +1,5 @@
1
- import { G as GsapAnimation, A as ArcPathConfig, g as SplitAnimationsOptions, h as SplitAnimationsResult, a as ArcPathSegment } from './gsapSerialize-D92cSJOu.js';
1
+ import { G as GsapAnimation, A as ArcPathConfig, k as SplitAnimationsOptions, l as SplitAnimationsResult, a as ArcPathSegment } from './gsapSerialize-35P5QhSR.js';
2
2
  import './types-Y0NXTiVo.js';
3
- import './gsapConstants.js';
4
3
 
5
4
  type TweenTarget = Pick<GsapAnimation, "targetSelector" | "hasPartialSelector">;
6
5
  type TweenTime = Pick<GsapAnimation, "position" | "implicitPosition">;
@@ -46,7 +45,7 @@ declare function removeAnimationFromScript(script: string, animationId: string):
46
45
  *
47
46
  * Keeps `keepId` (the write the commit just edited); falls back to the LAST
48
47
  * position write in source order (the runtime-effective one) if `keepId` is stale.
49
- * Removes every OTHER pure-position write (`propertyGroup === "position"`, which
48
+ * Removes every OTHER x/y position write (`isXYPositionWrite`, which
50
49
  * covers tl.to/from/fromTo flat-or-keyframed, tl.set, and standalone gsap.set,
51
50
  * including degenerate duration:0 tweens). Non-position writes for the same
52
51
  * selector (rotation / opacity / size / mixed) are left untouched.
@@ -14,6 +14,10 @@ var PROP_TO_GROUP = /* @__PURE__ */ new Map();
14
14
  for (const [group, props] of Object.entries(PROPERTY_GROUPS)) {
15
15
  for (const p of props) PROP_TO_GROUP.set(p, group);
16
16
  }
17
+ function isXYPositionWrite(a) {
18
+ const xy = (props) => !!props && ("x" in props || "y" in props);
19
+ return a.propertyGroup === "position" && (xy(a.properties) || xy(a.fromProperties) || !!a.keyframes?.keyframes.some((k) => xy(k.properties)));
20
+ }
17
21
  function classifyPropertyGroup(prop) {
18
22
  return PROP_TO_GROUP.get(prop) ?? "other";
19
23
  }
@@ -1718,7 +1722,7 @@ function dedupePositionWritesInScript(script, selector, keepId) {
1718
1722
  const parsed = parseGsapScriptAcornForWrite(script);
1719
1723
  if (!parsed) return script;
1720
1724
  const posWrites = parsed.located.filter(
1721
- (l) => l.animation.targetSelector === selector && l.animation.propertyGroup === "position"
1725
+ (l) => l.animation.targetSelector === selector && isXYPositionWrite(l.animation)
1722
1726
  );
1723
1727
  if (posWrites.length <= 1) return script;
1724
1728
  const keeper = posWrites.find((l) => l.id === keepId) ?? posWrites[posWrites.length - 1];