@hyperframes/parsers 0.8.106 → 0.8.108
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 +2 -14
- package/dist/gsapConstants.js +6 -1
- package/dist/gsapConstants.js.map +1 -1
- package/dist/gsapParser.d.ts +4 -5
- package/dist/gsapParser.js +5 -1
- package/dist/gsapParser.js.map +1 -1
- package/dist/gsapParserAcorn.d.ts +2 -3
- package/dist/gsapParserAcorn.js.map +1 -1
- package/dist/gsapParserExports.d.ts +1 -2
- package/dist/gsapParserExports.js.map +1 -1
- package/dist/{gsapSerialize-D92cSJOu.d.ts → gsapSerialize-35P5QhSR.d.ts} +18 -2
- package/dist/gsapWriterAcorn.d.ts +2 -3
- package/dist/gsapWriterAcorn.js +5 -1
- package/dist/gsapWriterAcorn.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { K as Keyframe, V as ValidationResult } from './types-Y0NXTiVo.js';
|
|
2
|
-
|
|
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,
|
|
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,
|
|
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
|
|
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.
|
package/dist/gsapWriterAcorn.js
CHANGED
|
@@ -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
|
|
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];
|