@pixodesk/svg-animator-core 1.0.34 → 1.0.35
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/README.md +7 -7
- package/dist/index.cjs +1054 -436
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1363 -691
- package/dist/index.d.ts +1363 -691
- package/dist/index.js +1014 -433
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
50
50
|
// src/index.ts
|
|
51
51
|
var index_exports = {};
|
|
52
52
|
__export(index_exports, {
|
|
53
|
+
BASELINE_PLAYER_VERSION: () => BASELINE_PLAYER_VERSION,
|
|
53
54
|
COLOUR_ATTR_NAMES: () => COLOUR_ATTR_NAMES,
|
|
54
55
|
CSS_ONLY_STYLE_PROPS: () => CSS_ONLY_STYLE_PROPS,
|
|
55
56
|
DEFAULT_DURATION_MS: () => DEFAULT_DURATION_MS,
|
|
@@ -58,18 +59,21 @@ __export(index_exports, {
|
|
|
58
59
|
LOOP_JUMP_SHIFT_MS: () => LOOP_JUMP_SHIFT_MS,
|
|
59
60
|
MISSING_GLYPH_CLASS_NAME: () => MISSING_GLYPH_CLASS_NAME,
|
|
60
61
|
PCT_BASED_ATTR_NAMES: () => PCT_BASED_ATTR_NAMES,
|
|
62
|
+
PLAYER_WIRE_STEPS: () => PLAYER_WIRE_STEPS,
|
|
63
|
+
PLAYER_WIRE_VERSION: () => PLAYER_WIRE_VERSION,
|
|
61
64
|
PX_ANIM_ATTR_NAME: () => PX_ANIM_ATTR_NAME,
|
|
62
65
|
PX_ANIM_SRC_ATTR_NAME: () => PX_ANIM_SRC_ATTR_NAME,
|
|
66
|
+
PX_PLAYER_SCHEMA_VERSION: () => PX_PLAYER_SCHEMA_VERSION,
|
|
63
67
|
PX_TRANSFORM_PART_KEYS: () => PX_TRANSFORM_PART_KEYS,
|
|
68
|
+
PX_UNKNOWN_KEY_ERROR: () => PX_UNKNOWN_KEY_ERROR,
|
|
64
69
|
PxAnimatedSvgDocumentSchema: () => PxAnimatedSvgDocumentSchema,
|
|
65
70
|
PxAnimationDefinitionSchema: () => PxAnimationDefinitionSchema,
|
|
66
71
|
PxAnimatorConfigSchema: () => PxAnimatorConfigSchema,
|
|
67
|
-
PxAnimatorEngine: () => PxAnimatorEngine,
|
|
68
|
-
PxAnimatorMode: () => PxAnimatorMode,
|
|
69
72
|
PxAttrValueSchema: () => PxAttrValueSchema,
|
|
70
73
|
PxBezierPathSchema: () => PxBezierPathSchema,
|
|
71
74
|
PxBindingSchema: () => PxBindingSchema,
|
|
72
75
|
PxCloneEffectSchema: () => PxCloneEffectSchema,
|
|
76
|
+
PxCloneWithout: () => PxCloneWithout,
|
|
73
77
|
PxDefsSchema: () => PxDefsSchema,
|
|
74
78
|
PxEasingOrRefSchema: () => PxEasingOrRefSchema,
|
|
75
79
|
PxEffectsSchema: () => PxEffectsSchema,
|
|
@@ -81,7 +85,8 @@ __export(index_exports, {
|
|
|
81
85
|
PxGradientUnits: () => PxGradientUnits,
|
|
82
86
|
PxKeyframeSchema: () => PxKeyframeSchema,
|
|
83
87
|
PxKeyframeValueSchema: () => PxKeyframeValueSchema,
|
|
84
|
-
|
|
88
|
+
PxLoopDirection: () => PxLoopDirection,
|
|
89
|
+
PxLoopRepeatAt: () => PxLoopRepeatAt,
|
|
85
90
|
PxLoopSchema: () => PxLoopSchema,
|
|
86
91
|
PxMaskedByEffectSchema: () => PxMaskedByEffectSchema,
|
|
87
92
|
PxNodeBase: () => PxNodeBase,
|
|
@@ -98,6 +103,8 @@ __export(index_exports, {
|
|
|
98
103
|
PxSvgNodeExtra: () => PxSvgNodeExtra,
|
|
99
104
|
PxTextEffectSchema: () => PxTextEffectSchema,
|
|
100
105
|
PxTextPathEffectSchema: () => PxTextPathEffectSchema,
|
|
106
|
+
PxTimelineEngine: () => PxTimelineEngine,
|
|
107
|
+
PxTimelineEngineExtra: () => PxTimelineEngineExtra,
|
|
101
108
|
PxTimelinePinSchema: () => PxTimelinePinSchema,
|
|
102
109
|
PxTimelineSchema: () => PxTimelineSchema,
|
|
103
110
|
PxTransformByEffectSchema: () => PxTransformByEffectSchema,
|
|
@@ -108,22 +115,35 @@ __export(index_exports, {
|
|
|
108
115
|
TEXT_ATTR: () => TEXT_ATTR,
|
|
109
116
|
TEXT_CONTENT_ATTR: () => TEXT_CONTENT_ATTR,
|
|
110
117
|
TRANSFORM_FN_NAMES: () => TRANSFORM_FN_NAMES,
|
|
118
|
+
WIRE_VERSION_KEY: () => WIRE_VERSION_KEY,
|
|
119
|
+
WireStepKind: () => WireStepKind,
|
|
120
|
+
WireVersionRelation: () => WireVersionRelation,
|
|
121
|
+
applyAnimatorConfig: () => applyAnimatorConfig,
|
|
111
122
|
applyPlayerEffects: () => applyPlayerEffects,
|
|
123
|
+
applyWireSteps: () => applyWireSteps,
|
|
124
|
+
applyWireStepsDown: () => applyWireStepsDown,
|
|
112
125
|
bezierToSvgPath: () => bezierToSvgPath,
|
|
113
126
|
calcAnimationValues: () => calcAnimationValues,
|
|
114
127
|
camelCaseToKebabWordIfNeeded: () => camelCaseToKebabWordIfNeeded,
|
|
115
128
|
clamp: () => clamp,
|
|
116
129
|
collectSampleTimes: () => collectSampleTimes,
|
|
130
|
+
compareWireVersion: () => compareWireVersion,
|
|
117
131
|
composeTransformParts: () => composeTransformParts,
|
|
132
|
+
convertPlayerDocument: () => convertPlayerDocument,
|
|
118
133
|
createBasicFrameLoopAnimator: () => createBasicFrameLoopAnimator,
|
|
119
134
|
createPathSampler: () => createPathSampler,
|
|
120
135
|
cubicBezier: () => cubicBezier,
|
|
121
136
|
deepClone: () => deepClone,
|
|
122
137
|
describeSchema: () => describeSchema,
|
|
138
|
+
diagnoseDocument: () => diagnoseDocument,
|
|
139
|
+
diffFieldUniverse: () => diffFieldUniverse,
|
|
123
140
|
diffInEffect: () => diffInEffect,
|
|
141
|
+
downgradePlayerDocument: () => downgradePlayerDocument,
|
|
124
142
|
evaluateMotionPathSegment: () => evaluateMotionPathSegment,
|
|
125
143
|
extendedPathForBrowser: () => extendedPathForBrowser,
|
|
126
144
|
flattenAnimatorTimeline: () => flattenAnimatorTimeline,
|
|
145
|
+
foldAnimatorConfigShortcuts: () => foldAnimatorConfigShortcuts,
|
|
146
|
+
formatWireVersion: () => formatWireVersion,
|
|
127
147
|
generateNewIds: () => generateNewIds,
|
|
128
148
|
generateUniqueId: () => generateUniqueId,
|
|
129
149
|
getAnimatorConfig: () => getAnimatorConfig,
|
|
@@ -134,11 +154,17 @@ __export(index_exports, {
|
|
|
134
154
|
getNormalizedProps: () => getNormalizedProps,
|
|
135
155
|
interpolateBeziers: () => interpolateBeziers,
|
|
136
156
|
interpolateValue: () => interpolateValue,
|
|
157
|
+
isNativeForced: () => isNativeForced,
|
|
137
158
|
isPxElementFileFormat: () => isPxElementFileFormat,
|
|
138
159
|
isPxElementFileFormatDeep: () => isPxElementFileFormatDeep,
|
|
139
160
|
isScrollTimeline: () => isScrollTimeline,
|
|
140
161
|
jsonElementFactory: () => jsonElementFactory,
|
|
141
162
|
kebabToCamelCaseWord: () => kebabToCamelCaseWord,
|
|
163
|
+
kfEasing: () => kfEasing,
|
|
164
|
+
kfTangentIn: () => kfTangentIn,
|
|
165
|
+
kfTangentOut: () => kfTangentOut,
|
|
166
|
+
kfTime: () => kfTime,
|
|
167
|
+
kfValue: () => kfValue,
|
|
142
168
|
layoutGlyphTextChars: () => layoutGlyphTextChars,
|
|
143
169
|
materialiseAllInTree: () => materialiseAllInTree,
|
|
144
170
|
materialiseAnimatedUseInstances: () => materialiseAnimatedUseInstances,
|
|
@@ -149,14 +175,23 @@ __export(index_exports, {
|
|
|
149
175
|
materialiseInternalLoopsInTree: () => materialiseInternalLoopsInTree,
|
|
150
176
|
materialiseMotionPathInPropAnim: () => materialiseMotionPathInPropAnim,
|
|
151
177
|
materialiseMotionPathsInTree: () => materialiseMotionPathsInTree,
|
|
178
|
+
mayUseNativeScrollTimeline: () => mayUseNativeScrollTimeline,
|
|
179
|
+
mergeAnimatorConfig: () => mergeAnimatorConfig,
|
|
152
180
|
mergeStaticTransformIntoAnimDef: () => mergeStaticTransformIntoAnimDef,
|
|
153
181
|
nestAnimatorTimeline: () => nestAnimatorTimeline,
|
|
154
182
|
parseTransformParts: () => parseTransformParts,
|
|
183
|
+
parseWireVersion: () => parseWireVersion,
|
|
184
|
+
planSchemaRelease: () => planSchemaRelease,
|
|
155
185
|
propAnimIsMotionPath: () => propAnimIsMotionPath,
|
|
156
186
|
px: () => px,
|
|
187
|
+
readWireVersion: () => readWireVersion,
|
|
188
|
+
releaseLogProblems: () => releaseLogProblems,
|
|
189
|
+
reportDocumentDiagnostics: () => reportDocumentDiagnostics,
|
|
157
190
|
resolveStyle: () => resolveStyle,
|
|
191
|
+
resolveTimelineEngine: () => resolveTimelineEngine,
|
|
158
192
|
reverseEasing: () => reverseEasing,
|
|
159
193
|
sanitiseAttributeValue: () => sanitiseAttributeValue,
|
|
194
|
+
schemaFieldUniverse: () => schemaFieldUniverse,
|
|
160
195
|
schemaKeys: () => schemaKeys,
|
|
161
196
|
scrollOffsetProgress: () => scrollOffsetProgress,
|
|
162
197
|
scrollPhaseInterval: () => scrollPhaseInterval,
|
|
@@ -167,14 +202,16 @@ __export(index_exports, {
|
|
|
167
202
|
splitEasing: () => splitEasing,
|
|
168
203
|
subdivideCubicBezier: () => subdivideCubicBezier,
|
|
169
204
|
toRGBA: () => toRGBA,
|
|
205
|
+
validateDocument: () => validateDocument,
|
|
170
206
|
validateNodeEffects: () => validateNodeEffects,
|
|
207
|
+
versionAdvice: () => versionAdvice,
|
|
171
208
|
visualModelAt: () => visualModelAt
|
|
172
209
|
});
|
|
173
210
|
module.exports = __toCommonJS(index_exports);
|
|
174
211
|
|
|
175
|
-
// src/PxAnimatorUtil.ts
|
|
212
|
+
// src/util/PxAnimatorUtil.ts
|
|
176
213
|
function bezierToSvgPath(path, forceCurves = false) {
|
|
177
|
-
var
|
|
214
|
+
var _a2, _b, _c, _d;
|
|
178
215
|
const v = path.v;
|
|
179
216
|
const i = path.i;
|
|
180
217
|
const o = path.o;
|
|
@@ -185,7 +222,7 @@ function bezierToSvgPath(path, forceCurves = false) {
|
|
|
185
222
|
d.push("M" + v[0][0] + "," + v[0][1]);
|
|
186
223
|
for (let idx = 1; idx < len; idx++) {
|
|
187
224
|
const prevV = v[idx - 1];
|
|
188
|
-
const prevO = (
|
|
225
|
+
const prevO = (_a2 = o == null ? void 0 : o[idx - 1]) != null ? _a2 : prevV;
|
|
189
226
|
const currI = (_b = i == null ? void 0 : i[idx]) != null ? _b : v[idx];
|
|
190
227
|
const currV = v[idx];
|
|
191
228
|
const isLine = !forceCurves && (prevO[0] === prevV[0] && prevO[1] === prevV[1]) && (currI[0] === currV[0] && currI[1] === currV[1]);
|
|
@@ -236,7 +273,7 @@ function interpolateBeziers(paths1, paths2, progress) {
|
|
|
236
273
|
return res;
|
|
237
274
|
}
|
|
238
275
|
function interpolateBezier(path1, path2, progress) {
|
|
239
|
-
var
|
|
276
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
240
277
|
if (!path1 || !path2) return path1 || path2 || { v: [] };
|
|
241
278
|
const t = Math.min(Math.max(progress, 0), 1);
|
|
242
279
|
const len = Math.min(path1.v.length, path2.v.length);
|
|
@@ -247,7 +284,7 @@ function interpolateBezier(path1, path2, progress) {
|
|
|
247
284
|
const v1 = path1.v[idx];
|
|
248
285
|
const v2 = path2.v[idx];
|
|
249
286
|
v.push(interpolateVec(v1, v2, t));
|
|
250
|
-
const i1 = (_b = (
|
|
287
|
+
const i1 = (_b = (_a2 = path1.i) == null ? void 0 : _a2[idx]) != null ? _b : v1;
|
|
251
288
|
const i2 = (_d = (_c = path2.i) == null ? void 0 : _c[idx]) != null ? _d : v2;
|
|
252
289
|
i.push(interpolateVec(i1, i2, t));
|
|
253
290
|
const o1 = (_f = (_e = path1.o) == null ? void 0 : _e[idx]) != null ? _f : v1;
|
|
@@ -366,8 +403,8 @@ function toRGBA(color) {
|
|
|
366
403
|
return color.length === 4 ? "rgba(" + r + "," + g + "," + b + "," + color[3] + ")" : "rgb(" + r + "," + g + "," + b + ")";
|
|
367
404
|
}
|
|
368
405
|
function parseRgba(s) {
|
|
369
|
-
var
|
|
370
|
-
const inner = (
|
|
406
|
+
var _a2;
|
|
407
|
+
const inner = (_a2 = s.match(/rgba?\((.*)\)/)) == null ? void 0 : _a2[1];
|
|
371
408
|
if (!inner) throw new Error("Invalid rgb/rgba format");
|
|
372
409
|
const parts = inner.split(",").map((v) => +v.trim());
|
|
373
410
|
return [parts[0] / 255, parts[1] / 255, parts[2] / 255, ...parts[3] !== void 0 ? [parts[3]] : []];
|
|
@@ -406,9 +443,9 @@ var COLOUR_ATTR_NAMES = /* @__PURE__ */ new Set(["color", "fill", "flood-color",
|
|
|
406
443
|
var TRANSFORM_FN_NAMES = /* @__PURE__ */ new Set(["translate", "rotate", "scale", "skew"]);
|
|
407
444
|
var PCT_BASED_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
|
|
408
445
|
function composeTransformParts(parts, opts) {
|
|
409
|
-
var
|
|
446
|
+
var _a2;
|
|
410
447
|
if (!parts) return "";
|
|
411
|
-
const withUnits = (
|
|
448
|
+
const withUnits = (_a2 = opts == null ? void 0 : opts.withUnits) != null ? _a2 : true;
|
|
412
449
|
const segs = [];
|
|
413
450
|
const t = parts.translate;
|
|
414
451
|
const o = parts.origin;
|
|
@@ -426,7 +463,7 @@ function composeTransformParts(parts, opts) {
|
|
|
426
463
|
return segs.join("");
|
|
427
464
|
}
|
|
428
465
|
function parseTransformParts(str2) {
|
|
429
|
-
var
|
|
466
|
+
var _a2, _b;
|
|
430
467
|
if (!str2 || typeof str2 !== "string") return void 0;
|
|
431
468
|
const out = {};
|
|
432
469
|
const re = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
|
|
@@ -442,7 +479,7 @@ function parseTransformParts(str2) {
|
|
|
442
479
|
if (nums.some((n) => Number.isNaN(n))) return void 0;
|
|
443
480
|
if (fn === "translate") {
|
|
444
481
|
if (nums.length < 1 || nums.length > 2) return void 0;
|
|
445
|
-
out.translate = [nums[0], (
|
|
482
|
+
out.translate = [nums[0], (_a2 = nums[1]) != null ? _a2 : 0];
|
|
446
483
|
} else if (fn === "rotate") {
|
|
447
484
|
if (nums.length !== 1) return void 0;
|
|
448
485
|
out.rotate = nums[0];
|
|
@@ -620,7 +657,7 @@ function invertEasing(easing) {
|
|
|
620
657
|
return cubicBezier(flipped);
|
|
621
658
|
}
|
|
622
659
|
|
|
623
|
-
// src/PxScrollMath.ts
|
|
660
|
+
// src/playback/PxScrollMath.ts
|
|
624
661
|
function isScrollTimeline(config) {
|
|
625
662
|
return (config == null ? void 0 : config.timelineSource) === "scroll";
|
|
626
663
|
}
|
|
@@ -648,8 +685,8 @@ function scrollPhaseInterval(phase, subjectSize, scrollportSize) {
|
|
|
648
685
|
}
|
|
649
686
|
var DEFAULT_PHASE = "cover";
|
|
650
687
|
function resolveRangePointU(point, defaultFraction, subjectSize, scrollportSize) {
|
|
651
|
-
var
|
|
652
|
-
const [u0, u1] = scrollPhaseInterval((
|
|
688
|
+
var _a2;
|
|
689
|
+
const [u0, u1] = scrollPhaseInterval((_a2 = point == null ? void 0 : point.phase) != null ? _a2 : DEFAULT_PHASE, subjectSize, scrollportSize);
|
|
653
690
|
const fraction = typeof (point == null ? void 0 : point.fraction) === "number" ? point.fraction : defaultFraction;
|
|
654
691
|
return u0 + fraction * (u1 - u0);
|
|
655
692
|
}
|
|
@@ -661,9 +698,9 @@ function scrollViewProgress(subjectStart, subjectSize, scrollportSize, range) {
|
|
|
661
698
|
return clamp((u - uStart) / (uEnd - uStart), 0, 1);
|
|
662
699
|
}
|
|
663
700
|
function scrollOffsetProgress(offset, maxOffset, range) {
|
|
664
|
-
var
|
|
701
|
+
var _a2, _b;
|
|
665
702
|
const raw = maxOffset > 0 ? clamp(offset / maxOffset, 0, 1) : 1;
|
|
666
|
-
const start = typeof ((
|
|
703
|
+
const start = typeof ((_a2 = range == null ? void 0 : range.start) == null ? void 0 : _a2.fraction) === "number" ? range.start.fraction : 0;
|
|
667
704
|
const end = typeof ((_b = range == null ? void 0 : range.end) == null ? void 0 : _b.fraction) === "number" ? range.end.fraction : 1;
|
|
668
705
|
if (end <= start) return raw >= end ? 1 : 0;
|
|
669
706
|
return clamp((raw - start) / (end - start), 0, 1);
|
|
@@ -676,7 +713,8 @@ function scrollResolveAxis(axis, writingMode) {
|
|
|
676
713
|
return vertical ? "x" : "y";
|
|
677
714
|
}
|
|
678
715
|
|
|
679
|
-
// src/PxSchema.ts
|
|
716
|
+
// src/schema/PxSchema.ts
|
|
717
|
+
var PX_UNKNOWN_KEY_ERROR = "unexpected extra key";
|
|
680
718
|
function pathStr(path) {
|
|
681
719
|
if (!path.length) return ".";
|
|
682
720
|
let result = "";
|
|
@@ -799,10 +837,10 @@ var Union = class extends Base {
|
|
|
799
837
|
return this._default;
|
|
800
838
|
}
|
|
801
839
|
isValid(raw, ctx, path) {
|
|
802
|
-
var
|
|
840
|
+
var _a2;
|
|
803
841
|
const probe = ctx && { errors: [], warnings: [], strict: ctx.strict };
|
|
804
842
|
if (this.schemas.some((s) => s.isValid(raw, probe, path ? [...path] : void 0))) return true;
|
|
805
|
-
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": no union member matched for value " + ((
|
|
843
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": no union member matched for value " + ((_a2 = JSON.stringify(raw)) != null ? _a2 : "").slice(0, 240));
|
|
806
844
|
return false;
|
|
807
845
|
}
|
|
808
846
|
_canSanitize(raw) {
|
|
@@ -811,6 +849,7 @@ var Union = class extends Base {
|
|
|
811
849
|
};
|
|
812
850
|
var DiscriminatedUnion = class extends Base {
|
|
813
851
|
constructor(_key, _schemas, defaultVal) {
|
|
852
|
+
var _a2;
|
|
814
853
|
super();
|
|
815
854
|
this._key = _key;
|
|
816
855
|
this._schemas = _schemas;
|
|
@@ -820,18 +859,21 @@ var DiscriminatedUnion = class extends Base {
|
|
|
820
859
|
this._map = /* @__PURE__ */ new Map();
|
|
821
860
|
for (const s of _schemas) {
|
|
822
861
|
const keySchema = s._shape[_key];
|
|
823
|
-
if (keySchema)
|
|
862
|
+
if (!keySchema) continue;
|
|
863
|
+
const literal = (_a2 = keySchema.inner) != null ? _a2 : keySchema;
|
|
864
|
+
this._map.set(literal._default, s);
|
|
865
|
+
if (keySchema.inner) this._absentMember = s;
|
|
824
866
|
}
|
|
825
867
|
}
|
|
826
868
|
_findSchema(raw) {
|
|
827
869
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
828
870
|
const val = raw[this._key];
|
|
829
|
-
if (val === void 0 || val === null) return
|
|
871
|
+
if (val === void 0 || val === null) return this._absentMember;
|
|
830
872
|
return this._map.get(val);
|
|
831
873
|
}
|
|
832
874
|
sanitize(raw) {
|
|
833
|
-
var
|
|
834
|
-
return ((
|
|
875
|
+
var _a2;
|
|
876
|
+
return ((_a2 = this._findSchema(raw)) != null ? _a2 : this._schemas[0]).sanitize(raw);
|
|
835
877
|
}
|
|
836
878
|
isValid(raw, ctx, path) {
|
|
837
879
|
const schema = this._findSchema(raw);
|
|
@@ -860,7 +902,8 @@ var Obj = class extends Base {
|
|
|
860
902
|
const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
861
903
|
const out = {};
|
|
862
904
|
for (const key of Object.keys(this._shape)) {
|
|
863
|
-
|
|
905
|
+
const v = this._shape[key].sanitize(src[key]);
|
|
906
|
+
if (v !== void 0) out[key] = v;
|
|
864
907
|
}
|
|
865
908
|
return out;
|
|
866
909
|
}
|
|
@@ -882,7 +925,7 @@ var Obj = class extends Base {
|
|
|
882
925
|
if (key in this._shape) continue;
|
|
883
926
|
if (obj[key] === void 0) continue;
|
|
884
927
|
p.push(key);
|
|
885
|
-
ctx.errors.push(pathStr(p) + ":
|
|
928
|
+
ctx.errors.push(pathStr(p) + ": " + PX_UNKNOWN_KEY_ERROR);
|
|
886
929
|
p.pop();
|
|
887
930
|
ok = false;
|
|
888
931
|
}
|
|
@@ -906,7 +949,8 @@ var OpenObj = class extends Base {
|
|
|
906
949
|
const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
907
950
|
const out = __spreadValues({}, src);
|
|
908
951
|
for (const key of Object.keys(this._shape)) {
|
|
909
|
-
|
|
952
|
+
const v = this._shape[key].sanitize(src[key]);
|
|
953
|
+
if (v !== void 0) out[key] = v;
|
|
910
954
|
}
|
|
911
955
|
if (this._openSchema) {
|
|
912
956
|
for (const key of Object.keys(src)) {
|
|
@@ -1048,8 +1092,8 @@ var Lazy = class extends Base {
|
|
|
1048
1092
|
this.resolved = null;
|
|
1049
1093
|
}
|
|
1050
1094
|
get schema() {
|
|
1051
|
-
var
|
|
1052
|
-
return (
|
|
1095
|
+
var _a2;
|
|
1096
|
+
return (_a2 = this.resolved) != null ? _a2 : this.resolved = this.fn();
|
|
1053
1097
|
}
|
|
1054
1098
|
sanitize(raw) {
|
|
1055
1099
|
return this.schema.sanitize(raw);
|
|
@@ -1101,7 +1145,7 @@ function schemaKeys(schema) {
|
|
|
1101
1145
|
);
|
|
1102
1146
|
}
|
|
1103
1147
|
function describeSchema(schema) {
|
|
1104
|
-
var
|
|
1148
|
+
var _a2;
|
|
1105
1149
|
const s = schema;
|
|
1106
1150
|
switch (s._kind) {
|
|
1107
1151
|
case "union":
|
|
@@ -1116,7 +1160,7 @@ function describeSchema(schema) {
|
|
|
1116
1160
|
if ("_shape" in s) return { kind: "shape", shape: s._shape, openValue: s._openSchema };
|
|
1117
1161
|
if ("item" in s) return { kind: "array", item: s.item };
|
|
1118
1162
|
if ("inner" in s) return { kind: "optional", inner: s.inner };
|
|
1119
|
-
if ("fn" in s) return { kind: "lazy", resolved: (
|
|
1163
|
+
if ("fn" in s) return { kind: "lazy", resolved: (_a2 = s.resolved) != null ? _a2 : s.resolved = s.fn() };
|
|
1120
1164
|
return { kind: "leaf" };
|
|
1121
1165
|
}
|
|
1122
1166
|
var px = {
|
|
@@ -1171,25 +1215,343 @@ var px = {
|
|
|
1171
1215
|
lazy: (fn, defaultVal) => new Lazy(fn, defaultVal)
|
|
1172
1216
|
};
|
|
1173
1217
|
|
|
1174
|
-
// src/
|
|
1218
|
+
// src/version/PxSchemaVersion.ts
|
|
1219
|
+
var PX_PLAYER_SCHEMA_VERSION = "1.1";
|
|
1220
|
+
|
|
1221
|
+
// src/version/PxWireVersion.ts
|
|
1222
|
+
var WIRE_VERSION_KEY = "version";
|
|
1223
|
+
var ANIMATOR_KEY = "animator";
|
|
1224
|
+
var META_KEY = "meta";
|
|
1225
|
+
var WireVersionRelation = /* @__PURE__ */ ((WireVersionRelation2) => {
|
|
1226
|
+
WireVersionRelation2["unstamped"] = "unstamped";
|
|
1227
|
+
WireVersionRelation2["same"] = "same";
|
|
1228
|
+
WireVersionRelation2["older"] = "older";
|
|
1229
|
+
WireVersionRelation2["newer"] = "newer";
|
|
1230
|
+
WireVersionRelation2["otherGeneration"] = "otherGeneration";
|
|
1231
|
+
return WireVersionRelation2;
|
|
1232
|
+
})(WireVersionRelation || {});
|
|
1233
|
+
var VERSION_RE = /^(\d+)\.(\d+)(?:\.(\d+))?$/;
|
|
1234
|
+
function parseWireVersion(raw) {
|
|
1235
|
+
if (typeof raw !== "string") return void 0;
|
|
1236
|
+
const m = VERSION_RE.exec(raw.trim());
|
|
1237
|
+
if (!m) return void 0;
|
|
1238
|
+
return { a: Number(m[1]), b: Number(m[2]), c: m[3] === void 0 ? 0 : Number(m[3]) };
|
|
1239
|
+
}
|
|
1240
|
+
function formatWireVersion(v) {
|
|
1241
|
+
return v.a + "." + v.b + "." + v.c;
|
|
1242
|
+
}
|
|
1243
|
+
var _a;
|
|
1244
|
+
var PLAYER_WIRE_VERSION = (_a = parseWireVersion(PX_PLAYER_SCHEMA_VERSION)) != null ? _a : { a: 1, b: 1, c: 0 };
|
|
1245
|
+
function getAnimatorBlock(doc) {
|
|
1246
|
+
if (!doc || typeof doc !== "object") return void 0;
|
|
1247
|
+
const atRoot = readObjectProp(doc, ANIMATOR_KEY);
|
|
1248
|
+
if (atRoot) return atRoot;
|
|
1249
|
+
const meta = readObjectProp(doc, META_KEY);
|
|
1250
|
+
return meta ? readObjectProp(meta, ANIMATOR_KEY) : void 0;
|
|
1251
|
+
}
|
|
1252
|
+
function readObjectProp(obj, key) {
|
|
1253
|
+
const value = obj[key];
|
|
1254
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
1255
|
+
}
|
|
1256
|
+
function readWireVersion(doc) {
|
|
1257
|
+
const animator = getAnimatorBlock(doc);
|
|
1258
|
+
return animator ? parseWireVersion(animator[WIRE_VERSION_KEY]) : void 0;
|
|
1259
|
+
}
|
|
1260
|
+
function compareWireVersion(file, mine, readerReadsEditorPart) {
|
|
1261
|
+
if (!file) return "unstamped" /* unstamped */;
|
|
1262
|
+
if (file.a !== mine.a) return "otherGeneration" /* otherGeneration */;
|
|
1263
|
+
if (file.b !== mine.b) return file.b > mine.b ? "newer" /* newer */ : "older" /* older */;
|
|
1264
|
+
if (!readerReadsEditorPart || file.c === mine.c) return "same" /* same */;
|
|
1265
|
+
return file.c > mine.c ? "newer" /* newer */ : "older" /* older */;
|
|
1266
|
+
}
|
|
1267
|
+
function versionAdvice(relation, file, mine, isPlayer) {
|
|
1268
|
+
if (!file) return void 0;
|
|
1269
|
+
const target = isPlayer ? "player" : "editor";
|
|
1270
|
+
const gap = "written for schema " + formatWireVersion(file) + ", this " + target + " reads " + formatWireVersion(mine);
|
|
1271
|
+
switch (relation) {
|
|
1272
|
+
case "newer" /* newer */:
|
|
1273
|
+
return "This file is " + gap + ". Update the " + target + " to open it fully.";
|
|
1274
|
+
case "older" /* older */:
|
|
1275
|
+
return "This file is " + gap + ". Saving it from this " + target + " rewrites it in the current format.";
|
|
1276
|
+
case "otherGeneration" /* otherGeneration */:
|
|
1277
|
+
return "This file is " + gap + " \u2014 a different format generation, which no conversion bridges. Open it in a " + target + " of that generation, or accept this document without the parts named above.";
|
|
1278
|
+
default:
|
|
1279
|
+
return void 0;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
var WireStepKind = /* @__PURE__ */ ((WireStepKind2) => {
|
|
1283
|
+
WireStepKind2["additive"] = "additive";
|
|
1284
|
+
WireStepKind2["converted"] = "converted";
|
|
1285
|
+
return WireStepKind2;
|
|
1286
|
+
})(WireStepKind || {});
|
|
1287
|
+
var BASELINE_PLAYER_VERSION = "1.1";
|
|
1288
|
+
var PLAYER_WIRE_STEPS = [];
|
|
1289
|
+
function applyWireSteps(doc, cfg) {
|
|
1290
|
+
const from = readWireVersion(doc);
|
|
1291
|
+
const relation = compareWireVersion(from, cfg.target, cfg.readerReadsEditorPart);
|
|
1292
|
+
if (!from || relation !== "older" /* older */) {
|
|
1293
|
+
return {
|
|
1294
|
+
doc,
|
|
1295
|
+
from,
|
|
1296
|
+
relation,
|
|
1297
|
+
applied: [],
|
|
1298
|
+
advice: versionAdvice(relation, from, cfg.target, !cfg.readerReadsEditorPart)
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
const due = [];
|
|
1302
|
+
for (const step of cfg.steps) {
|
|
1303
|
+
const stepTo = parseWireVersion(step.to);
|
|
1304
|
+
if (!stepTo) continue;
|
|
1305
|
+
if (compareWireVersion(from, stepTo, cfg.readerReadsEditorPart) !== "older" /* older */) continue;
|
|
1306
|
+
if (!step.up) continue;
|
|
1307
|
+
due.push(step);
|
|
1308
|
+
}
|
|
1309
|
+
if (!due.length || !doc || typeof doc !== "object") return { doc, from, relation, applied: [] };
|
|
1310
|
+
const target = clonePlain(doc);
|
|
1311
|
+
const applied = [];
|
|
1312
|
+
for (const step of due) {
|
|
1313
|
+
try {
|
|
1314
|
+
step.up(target);
|
|
1315
|
+
applied.push(step);
|
|
1316
|
+
} catch (e) {
|
|
1317
|
+
break;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
if (!applied.length) return { doc, from, relation, applied: [] };
|
|
1321
|
+
stampVersion(target, cfg.target, cfg.readerReadsEditorPart);
|
|
1322
|
+
return { doc: target, from, relation, applied };
|
|
1323
|
+
}
|
|
1324
|
+
function convertPlayerDocument(doc) {
|
|
1325
|
+
return applyWireSteps(doc, {
|
|
1326
|
+
steps: PLAYER_WIRE_STEPS,
|
|
1327
|
+
target: PLAYER_WIRE_VERSION,
|
|
1328
|
+
readerReadsEditorPart: false
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
function clonePlain(value) {
|
|
1332
|
+
const structured = globalThis.structuredClone;
|
|
1333
|
+
return structured ? structured(value) : JSON.parse(JSON.stringify(value));
|
|
1334
|
+
}
|
|
1335
|
+
function stampVersion(doc, target, readerReadsEditorPart) {
|
|
1336
|
+
const animator = getAnimatorBlock(doc);
|
|
1337
|
+
if (!animator) return;
|
|
1338
|
+
const previous = parseWireVersion(animator[WIRE_VERSION_KEY]);
|
|
1339
|
+
animator[WIRE_VERSION_KEY] = formatWireVersion({
|
|
1340
|
+
a: target.a,
|
|
1341
|
+
b: target.b,
|
|
1342
|
+
c: readerReadsEditorPart ? target.c : previous ? previous.c : 0
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
function applyWireStepsDown(doc, cfg) {
|
|
1346
|
+
const from = readWireVersion(doc);
|
|
1347
|
+
if (!from) {
|
|
1348
|
+
return { ok: false, blocking: [], reason: "The document carries no version, so there is nothing to convert down from." };
|
|
1349
|
+
}
|
|
1350
|
+
const relation = compareWireVersion(from, cfg.target, cfg.readerReadsEditorPart);
|
|
1351
|
+
if (relation === "otherGeneration" /* otherGeneration */) {
|
|
1352
|
+
return {
|
|
1353
|
+
ok: false,
|
|
1354
|
+
blocking: [],
|
|
1355
|
+
reason: "Schema " + formatWireVersion(from) + " and " + formatWireVersion(cfg.target) + " are different generations; no conversion bridges them."
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
if (relation !== "newer" /* newer */) return { ok: true, doc, applied: [] };
|
|
1359
|
+
const toUndo = [];
|
|
1360
|
+
for (const step of cfg.steps) {
|
|
1361
|
+
const stepTo = parseWireVersion(step.to);
|
|
1362
|
+
if (!stepTo) continue;
|
|
1363
|
+
if (compareWireVersion(stepTo, cfg.target, cfg.readerReadsEditorPart) !== "newer" /* newer */) continue;
|
|
1364
|
+
if (compareWireVersion(stepTo, from, cfg.readerReadsEditorPart) === "newer" /* newer */) continue;
|
|
1365
|
+
toUndo.push(step);
|
|
1366
|
+
}
|
|
1367
|
+
toUndo.reverse();
|
|
1368
|
+
const blocking = toUndo.filter((s) => s.kind === "converted" /* converted */ && !s.down);
|
|
1369
|
+
if (blocking.length) {
|
|
1370
|
+
return {
|
|
1371
|
+
ok: false,
|
|
1372
|
+
blocking,
|
|
1373
|
+
reason: "Cannot convert down to " + formatWireVersion(cfg.target) + ": " + blocking.map((s) => s.from + " \u2192 " + s.to + " (" + s.reason + ")").join("; ") + " cannot be undone."
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
const target = clonePlain(doc);
|
|
1377
|
+
const applied = [];
|
|
1378
|
+
for (const step of toUndo) {
|
|
1379
|
+
if (!step.down) continue;
|
|
1380
|
+
try {
|
|
1381
|
+
step.down(target);
|
|
1382
|
+
applied.push(step);
|
|
1383
|
+
} catch (e) {
|
|
1384
|
+
return {
|
|
1385
|
+
ok: false,
|
|
1386
|
+
blocking: [step],
|
|
1387
|
+
reason: "Undoing " + step.from + " \u2192 " + step.to + " failed: " + String(e)
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
stampVersion(target, cfg.target, cfg.readerReadsEditorPart);
|
|
1392
|
+
return { ok: true, doc: target, applied };
|
|
1393
|
+
}
|
|
1394
|
+
function downgradePlayerDocument(doc, target) {
|
|
1395
|
+
return applyWireStepsDown(doc, { steps: PLAYER_WIRE_STEPS, target, readerReadsEditorPart: false });
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
// src/version/PxSchemaFieldUniverse.ts
|
|
1399
|
+
function schemaFieldUniverse(root) {
|
|
1400
|
+
const fields = /* @__PURE__ */ new Set();
|
|
1401
|
+
const enumerated = /* @__PURE__ */ new Set();
|
|
1402
|
+
const queue = [{ schema: root, path: "" }];
|
|
1403
|
+
while (queue.length) {
|
|
1404
|
+
const { schema, path } = queue.shift();
|
|
1405
|
+
const d = describeSchema(schema);
|
|
1406
|
+
switch (d.kind) {
|
|
1407
|
+
case "shape": {
|
|
1408
|
+
if (enumerated.has(schema)) break;
|
|
1409
|
+
enumerated.add(schema);
|
|
1410
|
+
for (const key of Object.keys(d.shape)) {
|
|
1411
|
+
const id = path ? path + "." + key : key;
|
|
1412
|
+
fields.add(id);
|
|
1413
|
+
queue.push({ schema: d.shape[key], path: id });
|
|
1414
|
+
}
|
|
1415
|
+
if (d.openValue) queue.push({ schema: d.openValue, path: path + "{*}" });
|
|
1416
|
+
break;
|
|
1417
|
+
}
|
|
1418
|
+
case "optional":
|
|
1419
|
+
queue.push({ schema: d.inner, path });
|
|
1420
|
+
break;
|
|
1421
|
+
case "array":
|
|
1422
|
+
queue.push({ schema: d.item, path: path + "[]" });
|
|
1423
|
+
break;
|
|
1424
|
+
case "lazy":
|
|
1425
|
+
queue.push({ schema: d.resolved, path });
|
|
1426
|
+
break;
|
|
1427
|
+
case "record":
|
|
1428
|
+
queue.push({ schema: d.value, path: path + "{*}" });
|
|
1429
|
+
break;
|
|
1430
|
+
case "union":
|
|
1431
|
+
d.members.forEach((member, i) => queue.push({ schema: member, path: path + "|" + i }));
|
|
1432
|
+
break;
|
|
1433
|
+
case "discriminatedUnion":
|
|
1434
|
+
for (const member of d.members) queue.push({ schema: member, path: path + "|" + discriminantOf(member, d.key) });
|
|
1435
|
+
break;
|
|
1436
|
+
default:
|
|
1437
|
+
break;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
return [...fields].sort();
|
|
1441
|
+
}
|
|
1442
|
+
function discriminantOf(member, key) {
|
|
1443
|
+
const d = describeSchema(member);
|
|
1444
|
+
if (d.kind !== "shape") return "?";
|
|
1445
|
+
const keySchema = d.shape[key];
|
|
1446
|
+
if (keySchema === void 0) return "?";
|
|
1447
|
+
const kd = describeSchema(keySchema);
|
|
1448
|
+
return String((kd.kind === "optional" ? kd.inner : keySchema)._default);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
// src/version/PxSchemaRelease.ts
|
|
1452
|
+
function diffFieldUniverse(previous, current) {
|
|
1453
|
+
const prev = new Set(previous);
|
|
1454
|
+
const cur = new Set(current);
|
|
1455
|
+
return {
|
|
1456
|
+
added: current.filter((k) => !prev.has(k)).sort(),
|
|
1457
|
+
removed: previous.filter((k) => !cur.has(k)).sort()
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
function planSchemaRelease(p) {
|
|
1461
|
+
const changed = p.added.length > 0 || p.removed.length > 0;
|
|
1462
|
+
const last = parseWireVersion(p.lastReleased);
|
|
1463
|
+
const declared = parseWireVersion(p.declared);
|
|
1464
|
+
if (!last || !declared) return { changed, refuse: "Unparseable version: " + p.lastReleased + " / " + p.declared + "." };
|
|
1465
|
+
const requiredVersion = last.a + "." + (last.b + 1);
|
|
1466
|
+
if (!changed) {
|
|
1467
|
+
if (declared.b === last.b && declared.a === last.a) return { changed };
|
|
1468
|
+
const step2 = p.steps.find((s) => s.to === p.declared);
|
|
1469
|
+
return step2 ? { changed, requiredVersion: p.declared } : { changed, refuse: "The version moved to " + p.declared + " with no key change and no step explaining it." };
|
|
1470
|
+
}
|
|
1471
|
+
const requiredKind = p.removed.length ? "converted" /* converted */ : "additive" /* additive */;
|
|
1472
|
+
const summary = p.added.length + " key(s) added, " + p.removed.length + " removed";
|
|
1473
|
+
if (declared.a !== last.a || declared.b !== last.b + 1) {
|
|
1474
|
+
return {
|
|
1475
|
+
changed,
|
|
1476
|
+
requiredKind,
|
|
1477
|
+
requiredVersion,
|
|
1478
|
+
refuse: "The player schema changed (" + summary + ") but PX_PLAYER_SCHEMA_VERSION is " + p.declared + ". Set it to " + requiredVersion + " and add the PLAYER_WIRE_STEPS entry."
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
const step = p.steps.find((s) => s.to === p.declared);
|
|
1482
|
+
if (!step) {
|
|
1483
|
+
return { changed, requiredKind, requiredVersion, refuse: "No PLAYER_WIRE_STEPS entry reaches " + p.declared + "." };
|
|
1484
|
+
}
|
|
1485
|
+
if (requiredKind === "converted" /* converted */ && step.kind !== "converted" /* converted */) {
|
|
1486
|
+
return {
|
|
1487
|
+
changed,
|
|
1488
|
+
requiredKind,
|
|
1489
|
+
requiredVersion,
|
|
1490
|
+
refuse: "Keys were REMOVED (" + p.removed.join(", ") + "), which is never additive \u2014 the " + p.declared + " step must be `converted`, with an up()."
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
return { changed, requiredKind, requiredVersion };
|
|
1494
|
+
}
|
|
1495
|
+
function releaseLogProblems(releases, steps, declared, baseline) {
|
|
1496
|
+
const problems = [];
|
|
1497
|
+
if (!releases.length) return ["The release log is empty."];
|
|
1498
|
+
if (!releases[0].baseline || releases[0].version !== baseline) {
|
|
1499
|
+
problems.push("The first release must be the baseline " + baseline + ".");
|
|
1500
|
+
}
|
|
1501
|
+
for (let i = 1; i < releases.length; i++) {
|
|
1502
|
+
const prev = parseWireVersion(releases[i - 1].version);
|
|
1503
|
+
const cur = parseWireVersion(releases[i].version);
|
|
1504
|
+
if (!prev || !cur || cur.a !== prev.a || cur.b !== prev.b + 1) {
|
|
1505
|
+
problems.push("Release " + releases[i].version + " does not follow " + releases[i - 1].version + " by one `b` step.");
|
|
1506
|
+
}
|
|
1507
|
+
if (releases[i].date < releases[i - 1].date) problems.push("Release " + releases[i].version + " is dated before its predecessor.");
|
|
1508
|
+
const step = steps.find((s) => s.to === releases[i].version);
|
|
1509
|
+
if (!step) problems.push("Release " + releases[i].version + " has no PLAYER_WIRE_STEPS entry.");
|
|
1510
|
+
else if (releases[i].removed.length && step.kind !== "converted" /* converted */) {
|
|
1511
|
+
problems.push("Release " + releases[i].version + " removed keys, but its step is not `converted`.");
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
const latest = releases[releases.length - 1].version;
|
|
1515
|
+
if (latest !== declared) {
|
|
1516
|
+
problems.push("PX_PLAYER_SCHEMA_VERSION is " + declared + " but the last release record is " + latest + " \u2014 a bump needs its changelog entry (run scripts/schema-release.mjs --apply).");
|
|
1517
|
+
}
|
|
1518
|
+
return problems;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
// src/format/PxAnimatorConstants.ts
|
|
1175
1522
|
var PX_ANIM_SRC_ATTR_NAME = "data-px-animation-src";
|
|
1176
1523
|
var PX_ANIM_ATTR_NAME = "_px_animator";
|
|
1177
|
-
var
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1524
|
+
var PX_TIMELINE_SHARED_KEYS = ["duration", "iterations", "engine", "frameRate"];
|
|
1525
|
+
var PX_TIME_ONLY_TIMELINE_KEYS = ["trigger", "delay", "fillMode", "direction"];
|
|
1526
|
+
var PxTimelineEngine = {
|
|
1527
|
+
native: "native",
|
|
1528
|
+
js: "js"
|
|
1181
1529
|
};
|
|
1182
|
-
var
|
|
1183
|
-
|
|
1184
|
-
|
|
1530
|
+
var PxTimelineEngineExtra = __spreadProps(__spreadValues({}, PxTimelineEngine), {
|
|
1531
|
+
auto: "auto"
|
|
1532
|
+
});
|
|
1533
|
+
function resolveTimelineEngine(engine) {
|
|
1534
|
+
return engine === PxTimelineEngineExtra.js ? PxTimelineEngine.js : PxTimelineEngine.native;
|
|
1535
|
+
}
|
|
1536
|
+
function isNativeForced(engine) {
|
|
1537
|
+
return engine === PxTimelineEngineExtra.native;
|
|
1538
|
+
}
|
|
1539
|
+
function mayUseNativeScrollTimeline(engine) {
|
|
1540
|
+
return engine !== PxTimelineEngineExtra.js;
|
|
1541
|
+
}
|
|
1542
|
+
var PxLoopRepeatAt = {
|
|
1543
|
+
/** Segment from the START; the repetition runs BEFORE the first keyframe
|
|
1544
|
+
* (intro loops that play until the main timeline begins). */
|
|
1545
|
+
start: "start",
|
|
1546
|
+
/** DEFAULT — segment from the END; the repetition runs AFTER the last keyframe
|
|
1547
|
+
* (idle/outro loops that continue once the main timeline has finished). */
|
|
1548
|
+
end: "end"
|
|
1185
1549
|
};
|
|
1186
|
-
var
|
|
1187
|
-
/**
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
* loops that continue once the main timeline has finished). */
|
|
1192
|
-
after: "after"
|
|
1550
|
+
var PxLoopDirection = {
|
|
1551
|
+
/** DEFAULT — cycle: every repetition replays the segment the same way round. */
|
|
1552
|
+
normal: "normal",
|
|
1553
|
+
/** Ping-pong: repetitions alternate forward / backward. */
|
|
1554
|
+
alternate: "alternate"
|
|
1193
1555
|
};
|
|
1194
1556
|
var PxMaskType = {
|
|
1195
1557
|
luminance: "luminance",
|
|
@@ -1199,8 +1561,9 @@ var PxUnits = {
|
|
|
1199
1561
|
userSpaceOnUse: "userSpaceOnUse",
|
|
1200
1562
|
objectBoundingBox: "objectBoundingBox"
|
|
1201
1563
|
};
|
|
1202
|
-
var
|
|
1203
|
-
|
|
1564
|
+
var PxCloneWithout = {
|
|
1565
|
+
translate: "translate"
|
|
1566
|
+
// transform: 'transform', // future: drop rotate/scale too (content only)
|
|
1204
1567
|
};
|
|
1205
1568
|
var PxPathOverflow = {
|
|
1206
1569
|
clip: "clip",
|
|
@@ -1224,6 +1587,9 @@ var PxStrokeTrimSubPaths = {
|
|
|
1224
1587
|
};
|
|
1225
1588
|
var TEXT_ATTR = "text";
|
|
1226
1589
|
var TEXT_CONTENT_ATTR = "textContent";
|
|
1590
|
+
var CLASS_ATTR = "class";
|
|
1591
|
+
var TRANSFORM_ATTR = "transform";
|
|
1592
|
+
var OFFSET_DISTANCE_ATTR = "offsetDistance";
|
|
1227
1593
|
var INTERNAL_ATTRS = /* @__PURE__ */ new Set([
|
|
1228
1594
|
"type",
|
|
1229
1595
|
"children",
|
|
@@ -1234,7 +1600,18 @@ var INTERNAL_ATTRS = /* @__PURE__ */ new Set([
|
|
|
1234
1600
|
TEXT_ATTR,
|
|
1235
1601
|
TEXT_CONTENT_ATTR
|
|
1236
1602
|
]);
|
|
1237
|
-
var
|
|
1603
|
+
var TRANSFORM_PART = {
|
|
1604
|
+
translate: "translate",
|
|
1605
|
+
rotate: "rotate",
|
|
1606
|
+
scale: "scale",
|
|
1607
|
+
origin: "origin"
|
|
1608
|
+
};
|
|
1609
|
+
var PX_TRANSFORM_PART_KEYS = [
|
|
1610
|
+
TRANSFORM_PART.translate,
|
|
1611
|
+
TRANSFORM_PART.rotate,
|
|
1612
|
+
TRANSFORM_PART.scale,
|
|
1613
|
+
TRANSFORM_PART.origin
|
|
1614
|
+
];
|
|
1238
1615
|
var PxGradientUnits = {
|
|
1239
1616
|
userSpaceOnUse: "userSpaceOnUse",
|
|
1240
1617
|
objectBoundingBox: "objectBoundingBox"
|
|
@@ -1252,11 +1629,11 @@ function isPxElementFileFormat(fileJson) {
|
|
|
1252
1629
|
if (!(fileJson && typeof fileJson === "object" && !Array.isArray(fileJson))) {
|
|
1253
1630
|
return false;
|
|
1254
1631
|
}
|
|
1255
|
-
return fileJson
|
|
1632
|
+
return fileJson.type === "svg";
|
|
1256
1633
|
}
|
|
1257
1634
|
function getAnimatorConfig(doc) {
|
|
1258
|
-
var
|
|
1259
|
-
const cfg = (doc == null ? void 0 : doc.animator) || ((
|
|
1635
|
+
var _a2;
|
|
1636
|
+
const cfg = (doc == null ? void 0 : doc.animator) || ((_a2 = doc == null ? void 0 : doc.meta) == null ? void 0 : _a2.animator);
|
|
1260
1637
|
return cfg ? flattenAnimatorTimeline(cfg) : void 0;
|
|
1261
1638
|
}
|
|
1262
1639
|
var flattenMemo = /* @__PURE__ */ new WeakMap();
|
|
@@ -1265,14 +1642,15 @@ function flattenAnimatorTimeline(cfg) {
|
|
|
1265
1642
|
if (timeline === void 0 || timeline === null || typeof timeline !== "object") return cfg;
|
|
1266
1643
|
const memoised = flattenMemo.get(cfg);
|
|
1267
1644
|
if (memoised) return memoised;
|
|
1268
|
-
const
|
|
1645
|
+
const _a2 = cfg, { timeline: _dropped } = _a2, flat = __objRest(_a2, ["timeline"]);
|
|
1646
|
+
if (timeline.engine !== void 0) flat.engine = timeline.engine;
|
|
1647
|
+
if (timeline.frameRate !== void 0) flat.frameRate = timeline.frameRate;
|
|
1269
1648
|
if (timeline.type === "scroll" || timeline.type === "view") {
|
|
1270
1649
|
flat.timelineSource = "scroll";
|
|
1271
1650
|
if (timeline.duration !== void 0) flat.duration = timeline.duration;
|
|
1272
1651
|
if (timeline.iterations !== void 0) flat.iterations = timeline.iterations;
|
|
1273
1652
|
const scroll = __spreadValues({}, flat.scroll || {});
|
|
1274
1653
|
scroll.kind = timeline.type;
|
|
1275
|
-
if (timeline.engine !== void 0) scroll.driver = timeline.engine;
|
|
1276
1654
|
if (timeline.axis !== void 0) scroll.axis = timeline.axis;
|
|
1277
1655
|
if (timeline.source !== void 0) scroll.source = timeline.source;
|
|
1278
1656
|
if (timeline.subject !== void 0) scroll.subject = timeline.subject;
|
|
@@ -1290,21 +1668,24 @@ function flattenAnimatorTimeline(cfg) {
|
|
|
1290
1668
|
} else {
|
|
1291
1669
|
if (timeline.duration !== void 0) flat.duration = timeline.duration;
|
|
1292
1670
|
if (timeline.trigger !== void 0) {
|
|
1293
|
-
const _b = timeline.trigger, {
|
|
1671
|
+
const _b = timeline.trigger, { finishAction } = _b, restTrigger = __objRest(_b, ["finishAction"]);
|
|
1294
1672
|
if (Object.keys(restTrigger).length) flat.trigger = restTrigger;
|
|
1295
|
-
if (
|
|
1673
|
+
if (finishAction !== void 0) flat.resetOnFinish = finishAction === "reset";
|
|
1296
1674
|
}
|
|
1297
1675
|
if (timeline.delay !== void 0) flat.delay = timeline.delay;
|
|
1298
1676
|
if (timeline.iterations !== void 0) flat.iterations = timeline.iterations;
|
|
1299
1677
|
if (timeline.direction !== void 0) flat.direction = timeline.direction;
|
|
1300
|
-
if (timeline.
|
|
1678
|
+
if (timeline.fillMode !== void 0) flat.fill = timeline.fillMode;
|
|
1301
1679
|
}
|
|
1302
1680
|
flattenMemo.set(cfg, flat);
|
|
1303
1681
|
return flat;
|
|
1304
1682
|
}
|
|
1683
|
+
function scrollKindOrDefault(kind) {
|
|
1684
|
+
return kind === "scroll" ? "scroll" : "view";
|
|
1685
|
+
}
|
|
1305
1686
|
function nestAnimatorTimeline(cfg) {
|
|
1306
1687
|
if (!cfg || cfg.timeline !== void 0) return cfg;
|
|
1307
|
-
const
|
|
1688
|
+
const _a2 = cfg, {
|
|
1308
1689
|
timelineSource,
|
|
1309
1690
|
scroll,
|
|
1310
1691
|
trigger,
|
|
@@ -1313,8 +1694,10 @@ function nestAnimatorTimeline(cfg) {
|
|
|
1313
1694
|
direction,
|
|
1314
1695
|
fill,
|
|
1315
1696
|
resetOnFinish,
|
|
1316
|
-
duration
|
|
1317
|
-
|
|
1697
|
+
duration,
|
|
1698
|
+
engine,
|
|
1699
|
+
frameRate
|
|
1700
|
+
} = _a2, shared = __objRest(_a2, [
|
|
1318
1701
|
"timelineSource",
|
|
1319
1702
|
"scroll",
|
|
1320
1703
|
"trigger",
|
|
@@ -1323,14 +1706,17 @@ function nestAnimatorTimeline(cfg) {
|
|
|
1323
1706
|
"direction",
|
|
1324
1707
|
"fill",
|
|
1325
1708
|
"resetOnFinish",
|
|
1326
|
-
"duration"
|
|
1709
|
+
"duration",
|
|
1710
|
+
"engine",
|
|
1711
|
+
"frameRate"
|
|
1327
1712
|
]);
|
|
1328
1713
|
if (timelineSource === "scroll") {
|
|
1329
|
-
const timeline2 = { type: (scroll == null ? void 0 : scroll.kind)
|
|
1714
|
+
const timeline2 = { type: scrollKindOrDefault(scroll == null ? void 0 : scroll.kind) };
|
|
1715
|
+
if (engine !== void 0) timeline2.engine = engine;
|
|
1716
|
+
if (frameRate !== void 0) timeline2.frameRate = frameRate;
|
|
1330
1717
|
if (duration !== void 0) timeline2.duration = duration;
|
|
1331
1718
|
if (typeof iterations === "number") timeline2.iterations = iterations;
|
|
1332
1719
|
if (scroll) {
|
|
1333
|
-
if (scroll.driver !== void 0) timeline2.engine = scroll.driver;
|
|
1334
1720
|
if (scroll.axis !== void 0) timeline2.axis = scroll.axis;
|
|
1335
1721
|
if (scroll.source !== void 0) timeline2.source = scroll.source;
|
|
1336
1722
|
if (scroll.subject !== void 0) timeline2.subject = scroll.subject;
|
|
@@ -1345,28 +1731,30 @@ function nestAnimatorTimeline(cfg) {
|
|
|
1345
1731
|
}
|
|
1346
1732
|
return __spreadProps(__spreadValues({}, shared), { timeline: timeline2 });
|
|
1347
1733
|
}
|
|
1348
|
-
const timeline = {
|
|
1734
|
+
const timeline = {};
|
|
1735
|
+
if (engine !== void 0) timeline.engine = engine;
|
|
1736
|
+
if (frameRate !== void 0) timeline.frameRate = frameRate;
|
|
1349
1737
|
if (duration !== void 0) timeline.duration = duration;
|
|
1350
1738
|
if (trigger !== void 0 || resetOnFinish) {
|
|
1351
1739
|
const t = __spreadValues({}, trigger || {});
|
|
1352
|
-
if (resetOnFinish) t.
|
|
1740
|
+
if (resetOnFinish) t.finishAction = "reset";
|
|
1353
1741
|
timeline.trigger = t;
|
|
1354
1742
|
}
|
|
1355
1743
|
if (delay !== void 0) timeline.delay = delay;
|
|
1356
1744
|
if (iterations !== void 0) timeline.iterations = iterations;
|
|
1357
1745
|
if (direction !== void 0) timeline.direction = direction;
|
|
1358
|
-
if (fill !== void 0) timeline.
|
|
1359
|
-
return Object.keys(timeline).length >
|
|
1746
|
+
if (fill !== void 0) timeline.fillMode = fill;
|
|
1747
|
+
return Object.keys(timeline).length > 0 ? __spreadProps(__spreadValues({}, shared), { timeline }) : shared;
|
|
1360
1748
|
}
|
|
1361
1749
|
function getDefs(doc) {
|
|
1362
|
-
var
|
|
1750
|
+
var _a2;
|
|
1363
1751
|
if (!doc) return void 0;
|
|
1364
|
-
return (
|
|
1752
|
+
return (_a2 = getAnimatorConfig(doc)) == null ? void 0 : _a2.definitions;
|
|
1365
1753
|
}
|
|
1366
1754
|
function getBindings(doc) {
|
|
1367
|
-
var
|
|
1755
|
+
var _a2;
|
|
1368
1756
|
if (!doc) return void 0;
|
|
1369
|
-
const animateById = (
|
|
1757
|
+
const animateById = (_a2 = getAnimatorConfig(doc)) == null ? void 0 : _a2.animateById;
|
|
1370
1758
|
if (!animateById) return void 0;
|
|
1371
1759
|
return Object.entries(animateById).map(([id, anim]) => ({ id: id.startsWith("#") ? id.slice(1) : id, animate: anim }));
|
|
1372
1760
|
}
|
|
@@ -1374,7 +1762,7 @@ function getChildren(doc) {
|
|
|
1374
1762
|
return doc == null ? void 0 : doc.children;
|
|
1375
1763
|
}
|
|
1376
1764
|
|
|
1377
|
-
// src/PxAnimatorTypes.ts
|
|
1765
|
+
// src/format/PxAnimatorTypes.ts
|
|
1378
1766
|
var PxEasingOrRefSchema = px.union([
|
|
1379
1767
|
px.string(),
|
|
1380
1768
|
px.tuple([px.number(), px.number(), px.number(), px.number()])
|
|
@@ -1406,16 +1794,32 @@ var PxKeyframeSchema = implementsInterface()(px.object({
|
|
|
1406
1794
|
// (review §1.3): editor data lives under `meta`. The editor still carries it on
|
|
1407
1795
|
// its internal COPY-PASTE payload, which never validates against this schema.)
|
|
1408
1796
|
}));
|
|
1797
|
+
var anyKf = (kf) => kf;
|
|
1798
|
+
var kfTime = (kf) => {
|
|
1799
|
+
var _a2, _b;
|
|
1800
|
+
return (_b = (_a2 = anyKf(kf).time) != null ? _a2 : anyKf(kf).t) != null ? _b : 0;
|
|
1801
|
+
};
|
|
1802
|
+
var kfValue = (kf) => {
|
|
1803
|
+
var _a2;
|
|
1804
|
+
return (_a2 = anyKf(kf).value) != null ? _a2 : anyKf(kf).v;
|
|
1805
|
+
};
|
|
1806
|
+
var kfEasing = (kf) => {
|
|
1807
|
+
var _a2;
|
|
1808
|
+
return (_a2 = anyKf(kf).easing) != null ? _a2 : anyKf(kf).e;
|
|
1809
|
+
};
|
|
1810
|
+
var kfTangentIn = (kf) => anyKf(kf).tangentIn;
|
|
1811
|
+
var kfTangentOut = (kf) => anyKf(kf).tangentOut;
|
|
1409
1812
|
var PxLoopSchema = implementsInterface()(px.object({
|
|
1410
1813
|
segmentCount: px.number().optional(),
|
|
1411
|
-
|
|
1412
|
-
|
|
1814
|
+
repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end]).optional(),
|
|
1815
|
+
direction: px.enum([PxLoopDirection.normal, PxLoopDirection.alternate]).optional()
|
|
1413
1816
|
}));
|
|
1414
1817
|
var PxPropertyAnimationSchema = implementsInterface()(px.object({
|
|
1415
1818
|
value: PxKeyframeValueSchema.optional(),
|
|
1416
1819
|
keyframes: px.array(PxKeyframeSchema).optional(),
|
|
1417
1820
|
loop: px.union([PxLoopSchema, px.boolean()]).optional(),
|
|
1418
|
-
autoOrient: px.boolean().optional()
|
|
1821
|
+
autoOrient: px.boolean().optional(),
|
|
1822
|
+
alongPathMode: px.enum(["sampled", "offsetPath"]).optional()
|
|
1419
1823
|
}));
|
|
1420
1824
|
var PxTransformPartsSchema = implementsInterface()(px.object({
|
|
1421
1825
|
translate: px.tuple([px.number(), px.number()]).optional(),
|
|
@@ -1442,10 +1846,9 @@ var PxTriggerSchema = implementsInterface()(px.object({
|
|
|
1442
1846
|
startOn: px.enum(["load", "mouseOver", "click", "scrollIntoView", "programmatic"]).optional(),
|
|
1443
1847
|
outAction: px.enum(["continue", "pause", "reset", "reverse"]).optional(),
|
|
1444
1848
|
// What happens after a NATURAL finish — `'hold'` (default: keep the end state per
|
|
1445
|
-
// `fill`) or `'reset'` (snap back to the start state).
|
|
1446
|
-
// the
|
|
1447
|
-
|
|
1448
|
-
onFinish: px.enum(["hold", "reset"]).optional(),
|
|
1849
|
+
// `fill`) or `'reset'` (snap back to the start state). Pairs with `outAction` ("what
|
|
1850
|
+
// happens when the trigger condition ends"); both end-of-life knobs now read alike.
|
|
1851
|
+
finishAction: px.enum(["hold", "reset"]).optional(),
|
|
1449
1852
|
scrollIntoViewThreshold: px.number().optional()
|
|
1450
1853
|
}));
|
|
1451
1854
|
var PxGlyphSchema = implementsInterface()(px.object({
|
|
@@ -1465,7 +1868,7 @@ var PxDefsSchema = implementsInterface()(px.object({
|
|
|
1465
1868
|
// Review §2.6: the schema now matches the declared type — a style preset is a flat
|
|
1466
1869
|
// record of string|number attribute values, nothing nested.
|
|
1467
1870
|
styles: px.record(px.record(px.union([px.string(), px.number()]))).optional(),
|
|
1468
|
-
|
|
1871
|
+
fonts: px.record(PxGlyphFontSchema).optional()
|
|
1469
1872
|
}));
|
|
1470
1873
|
var PX_SCROLL_PHASES = ["cover", "contain", "entry", "exit", "entry-crossing", "exit-crossing"];
|
|
1471
1874
|
var PxScrollRangePointSchema = implementsInterface()(px.object({
|
|
@@ -1477,7 +1880,6 @@ var PxScrollRangeSchema = px.object({
|
|
|
1477
1880
|
end: PxScrollRangePointSchema.optional()
|
|
1478
1881
|
});
|
|
1479
1882
|
var PxScrollSchema = implementsInterface()(px.object({
|
|
1480
|
-
driver: px.enum(["custom", "native"]).optional(),
|
|
1481
1883
|
kind: px.enum(["view", "scroll"]).optional(),
|
|
1482
1884
|
axis: px.enum(["block", "inline", "x", "y"]).optional(),
|
|
1483
1885
|
source: px.enum(["nearest", "root"]).optional(),
|
|
@@ -1490,21 +1892,26 @@ var PxScrollSchema = implementsInterface()(px.object({
|
|
|
1490
1892
|
pinDistance: px.number().optional(),
|
|
1491
1893
|
range: PxScrollRangeSchema.optional()
|
|
1492
1894
|
}));
|
|
1493
|
-
var PxTimelinePinSchema = px.object({
|
|
1895
|
+
var PxTimelinePinSchema = implementsInterface()(px.object({
|
|
1494
1896
|
align: px.enum(["top", "center", "bottom"]).optional(),
|
|
1495
1897
|
top: px.number().optional(),
|
|
1496
1898
|
distance: px.number().optional()
|
|
1497
|
-
});
|
|
1498
|
-
var
|
|
1499
|
-
|
|
1899
|
+
}));
|
|
1900
|
+
var PxTimelineEngineSchema = px.enum([PxTimelineEngineExtra.auto, PxTimelineEngineExtra.native, PxTimelineEngineExtra.js]).optional();
|
|
1901
|
+
var PxTimeTimelineSchema = implementsInterface()(px.object({
|
|
1902
|
+
type: px.literal("time").optional(),
|
|
1903
|
+
engine: PxTimelineEngineSchema,
|
|
1904
|
+
frameRate: px.number().optional(),
|
|
1500
1905
|
// §2.8: duration is a property of the TIMELINE — how long one pass takes.
|
|
1501
1906
|
duration: px.number().optional(),
|
|
1502
1907
|
trigger: PxTriggerSchema.optional(),
|
|
1503
1908
|
delay: px.number().optional(),
|
|
1504
1909
|
iterations: px.union([px.number(), px.literal("infinite")]).optional(),
|
|
1505
|
-
|
|
1910
|
+
// `fillMode` on the wire (CSS `animation-fill-mode`; the runtime view calls it `fill`)
|
|
1911
|
+
// — never `fill`, which is paint everywhere else in the format.
|
|
1912
|
+
fillMode: px.enum(["forwards", "backwards", "both", "none"]).optional(),
|
|
1506
1913
|
direction: px.enum(["normal", "reverse", "alternate", "alternate-reverse"]).optional()
|
|
1507
|
-
});
|
|
1914
|
+
}));
|
|
1508
1915
|
var scrollishTimelineShape = {
|
|
1509
1916
|
// §2.8: duration is a property of the TIMELINE — under scrubbing it is the keyframe
|
|
1510
1917
|
// span the scroll range maps onto.
|
|
@@ -1512,7 +1919,8 @@ var scrollishTimelineShape = {
|
|
|
1512
1919
|
// Finite repeat count IS meaningful when scrubbing — the scroll range maps onto
|
|
1513
1920
|
// duration × iterations (rule D4; `'infinite'` cannot map to a range, so no literal here).
|
|
1514
1921
|
iterations: px.number().optional(),
|
|
1515
|
-
engine:
|
|
1922
|
+
engine: PxTimelineEngineSchema,
|
|
1923
|
+
frameRate: px.number().optional(),
|
|
1516
1924
|
axis: px.enum(["block", "inline", "x", "y"]).optional(),
|
|
1517
1925
|
source: px.enum(["nearest", "root"]).optional(),
|
|
1518
1926
|
subject: px.string().optional(),
|
|
@@ -1522,23 +1930,29 @@ var scrollishTimelineShape = {
|
|
|
1522
1930
|
pin: px.union([px.boolean(), PxTimelinePinSchema]).optional(),
|
|
1523
1931
|
range: PxScrollRangeSchema.optional()
|
|
1524
1932
|
};
|
|
1525
|
-
var PxScrollTimelineSchema =
|
|
1526
|
-
|
|
1933
|
+
var PxScrollTimelineSchema = implementsInterface()(
|
|
1934
|
+
px.object(__spreadValues({ type: px.literal("scroll") }, scrollishTimelineShape))
|
|
1935
|
+
);
|
|
1936
|
+
var PxViewTimelineSchema = implementsInterface()(
|
|
1937
|
+
px.object(__spreadValues({ type: px.literal("view") }, scrollishTimelineShape))
|
|
1938
|
+
);
|
|
1527
1939
|
var PxTimelineSchema = px.discriminatedUnion("type", [
|
|
1528
|
-
|
|
1940
|
+
PxTimeTimelineSchema,
|
|
1941
|
+
// first = the member an absent `type` selects
|
|
1529
1942
|
PxScrollTimelineSchema,
|
|
1530
1943
|
PxViewTimelineSchema
|
|
1531
1944
|
]);
|
|
1532
1945
|
var PxAnimatorConfigSchema = implementsInterface()(px.object({
|
|
1533
|
-
|
|
1534
|
-
//
|
|
1535
|
-
// exists only on the runtime view, like the rest of the playback dynamics.)
|
|
1536
|
-
frameRate: px.number().optional(),
|
|
1946
|
+
// (`mode`, `duration` and `frameRate` live INSIDE `timeline` on the wire — §2.8; they exist
|
|
1947
|
+
// at this level only on the runtime view, like the rest of the playback dynamics.)
|
|
1537
1948
|
// THE spelling of "what advances progress" — clock / scroll / view (review §2.1).
|
|
1538
1949
|
timeline: PxTimelineSchema.optional(),
|
|
1539
1950
|
definitions: PxDefsSchema.optional(),
|
|
1540
1951
|
animateById: px.record(PxElementAnimationSchema).optional(),
|
|
1541
|
-
|
|
1952
|
+
debugGlobalName: px.string().optional(),
|
|
1953
|
+
// Declared HERE because this is a closed object: an undeclared key would be stripped by
|
|
1954
|
+
// `sanitize` and flagged by strict validation on our own files.
|
|
1955
|
+
version: px.string().optional()
|
|
1542
1956
|
}));
|
|
1543
1957
|
var PxBindingSchema = implementsInterface()(px.object({
|
|
1544
1958
|
id: px.string(),
|
|
@@ -1587,7 +2001,7 @@ var PxRepeaterEffectSchema = implementsInterface()(px.object({
|
|
|
1587
2001
|
origin: PxAnimatableVec2Schema.optional()
|
|
1588
2002
|
}));
|
|
1589
2003
|
var PxMaskedByEffectSchema = implementsInterface()(px.object({
|
|
1590
|
-
|
|
2004
|
+
source: px.string().optional(),
|
|
1591
2005
|
maskType: px.enum([PxMaskType.luminance, PxMaskType.alpha]).optional(),
|
|
1592
2006
|
maskUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
|
|
1593
2007
|
maskContentUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
|
|
@@ -1610,9 +2024,10 @@ var PxRetimeEffectSchema = implementsInterface()(px.object({
|
|
|
1610
2024
|
timeCrop: px.tuple([px.number(), px.number()]).optional()
|
|
1611
2025
|
}));
|
|
1612
2026
|
var PxCloneEffectSchema = implementsInterface()(px.object({
|
|
1613
|
-
//
|
|
1614
|
-
|
|
1615
|
-
|
|
2027
|
+
// Subtractive on purpose: the `<use>` can only point at one wrapper layer of the
|
|
2028
|
+
// source, so the choices form a ladder — 'translate' now, maybe 'transform' later.
|
|
2029
|
+
without: px.enum([PxCloneWithout.translate]).optional(),
|
|
2030
|
+
source: px.string().optional(),
|
|
1616
2031
|
retime: PxRetimeEffectSchema.optional()
|
|
1617
2032
|
}));
|
|
1618
2033
|
var PxGradientStopSchema = implementsInterface()(px.object({
|
|
@@ -1639,7 +2054,7 @@ var PxFillGradientEffectSchema = implementsInterface()(px.object({
|
|
|
1639
2054
|
}));
|
|
1640
2055
|
var PxStrokeGradientEffectSchema = PxFillGradientEffectSchema;
|
|
1641
2056
|
var PxTextPathEffectSchema = implementsInterface()(px.object({
|
|
1642
|
-
|
|
2057
|
+
pathData: px.string(),
|
|
1643
2058
|
pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend]).optional(),
|
|
1644
2059
|
lengthAdjust: px.enum([PxLengthAdjust.spacing, PxLengthAdjust.spacingAndGlyphs]).optional(),
|
|
1645
2060
|
method: px.enum([PxTextPathMethod.align, PxTextPathMethod.stretch]).optional(),
|
|
@@ -1679,16 +2094,33 @@ function validateNodeEffects(root, opts) {
|
|
|
1679
2094
|
walk(root, "root");
|
|
1680
2095
|
return warnings;
|
|
1681
2096
|
}
|
|
2097
|
+
function validateDocument(doc) {
|
|
2098
|
+
const ctx = { errors: [], warnings: [], strict: true };
|
|
2099
|
+
const problems = PxAnimatedSvgDocumentSchema.isValid(doc, ctx, ["root"]) ? [] : [...ctx.errors];
|
|
2100
|
+
if (doc && typeof doc === "object") {
|
|
2101
|
+
for (const w of validateNodeEffects(doc, { strict: true })) {
|
|
2102
|
+
if (!problems.includes(w)) problems.push(w);
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
return problems;
|
|
2106
|
+
}
|
|
1682
2107
|
var PxNodeBase = px.openObject({
|
|
1683
2108
|
// CONVENTION (SCHEMA-DESIGN R1 / issues N4): `type` is the ONE word for "what
|
|
1684
2109
|
// kind of thing is this", discriminated by its CARRIER — here the node TAG
|
|
1685
|
-
// (`rect`, `text`), and inside a sub-object that object's kind (`
|
|
2110
|
+
// (`rect`, `text`), and inside a sub-object that object's kind (`fillGradient.type`,
|
|
1686
2111
|
// `fillGradient.type`, editor `preset.type`). Each sits in its own object, so
|
|
1687
2112
|
// the carrier disambiguates completely; synonyms (`cloneKind`, `presetShape`)
|
|
1688
2113
|
// would add words that all mean "type" and still need the carrier to read.
|
|
1689
2114
|
// Guarding a `type` SLOT against a wrong VALUE is the job of strict enums
|
|
1690
2115
|
// (issues V3), never of distinct key names.
|
|
1691
2116
|
type: px.string(),
|
|
2117
|
+
// The escape hatch for elements that carry a REAL `type` attribute — `<feTurbulence
|
|
2118
|
+
// type="fractalNoise">`, `<feFuncR type="table">`, `<feColorMatrix type="saturate">`.
|
|
2119
|
+
// `type` is taken by the tag name, so the attribute travels here and the renderer puts
|
|
2120
|
+
// it back (`PxAnimatorDOM.renderNode`, `PxRnRender`). Declared here — not merely
|
|
2121
|
+
// documented — because a wire key that is not in a schema is invisible to the
|
|
2122
|
+
// minifier's reserve list and gets renamed (MINIFICATION-BOUNDARY-PLAN.md §1.1).
|
|
2123
|
+
domType: px.string().optional(),
|
|
1692
2124
|
id: px.string().optional(),
|
|
1693
2125
|
meta: px.any().optional(),
|
|
1694
2126
|
// Player-effects bucket emitted by the Editor's lightweight design format.
|
|
@@ -1728,7 +2160,7 @@ function isPxElementFileFormatDeep(fileJson) {
|
|
|
1728
2160
|
return { valid, errors: valid ? [] : ["Document failed schema validation"] };
|
|
1729
2161
|
}
|
|
1730
2162
|
|
|
1731
|
-
// src/PxIdUtil.ts
|
|
2163
|
+
// src/util/PxIdUtil.ts
|
|
1732
2164
|
var _idCounter = 0;
|
|
1733
2165
|
function generateUniqueId() {
|
|
1734
2166
|
const timestamp = Date.now().toString(36);
|
|
@@ -1747,7 +2179,7 @@ function deepClone(value) {
|
|
|
1747
2179
|
return cloned;
|
|
1748
2180
|
}
|
|
1749
2181
|
function generateNewIds(doc) {
|
|
1750
|
-
var
|
|
2182
|
+
var _a2, _b;
|
|
1751
2183
|
const cloned = deepClone(doc);
|
|
1752
2184
|
const idMap = /* @__PURE__ */ new Map();
|
|
1753
2185
|
const hashRefAttrs = /* @__PURE__ */ new Set(["href", "xlink:href"]);
|
|
@@ -1765,7 +2197,8 @@ function generateNewIds(doc) {
|
|
|
1765
2197
|
"flood-color",
|
|
1766
2198
|
"lighting-color"
|
|
1767
2199
|
]);
|
|
1768
|
-
const directIdRefAttrs = /* @__PURE__ */ new Set(["
|
|
2200
|
+
const directIdRefAttrs = /* @__PURE__ */ new Set(["targetId", "boundElementId"]);
|
|
2201
|
+
const isEffectSourceRef = (key, parentKey) => key === "source" && (parentKey === "maskedBy" || parentKey === "clone");
|
|
1769
2202
|
function collectIds(node) {
|
|
1770
2203
|
if (!node || typeof node !== "object") return;
|
|
1771
2204
|
if (node.id && typeof node.id === "string") {
|
|
@@ -1782,7 +2215,7 @@ function generateNewIds(doc) {
|
|
|
1782
2215
|
}
|
|
1783
2216
|
}
|
|
1784
2217
|
}
|
|
1785
|
-
function updateRefs(node) {
|
|
2218
|
+
function updateRefs(node, parentKey) {
|
|
1786
2219
|
if (!node || typeof node !== "object") return;
|
|
1787
2220
|
for (const [key, value] of Object.entries(node)) {
|
|
1788
2221
|
if (key === "children") {
|
|
@@ -1802,7 +2235,7 @@ function generateNewIds(doc) {
|
|
|
1802
2235
|
}
|
|
1803
2236
|
} else if (urlRefAttrs.has(key)) {
|
|
1804
2237
|
node[key] = replaceUrlRefs(value, idMap);
|
|
1805
|
-
} else if (directIdRefAttrs.has(key)) {
|
|
2238
|
+
} else if (directIdRefAttrs.has(key) || isEffectSourceRef(key, parentKey)) {
|
|
1806
2239
|
const hasHash = value.startsWith("#");
|
|
1807
2240
|
const newId = idMap.get(hasHash ? value.slice(1) : value);
|
|
1808
2241
|
if (newId) {
|
|
@@ -1818,13 +2251,13 @@ function generateNewIds(doc) {
|
|
|
1818
2251
|
}
|
|
1819
2252
|
}
|
|
1820
2253
|
} else if (typeof value === "object" && value !== null) {
|
|
1821
|
-
updateRefs(value);
|
|
2254
|
+
updateRefs(value, key);
|
|
1822
2255
|
}
|
|
1823
2256
|
}
|
|
1824
2257
|
}
|
|
1825
2258
|
collectIds(cloned);
|
|
1826
2259
|
updateRefs(cloned);
|
|
1827
|
-
const docAnimate = (
|
|
2260
|
+
const docAnimate = (_a2 = cloned.animator) == null ? void 0 : _a2.animateById;
|
|
1828
2261
|
if (docAnimate && typeof docAnimate === "object") {
|
|
1829
2262
|
const updatedAnimate = {};
|
|
1830
2263
|
for (const [key, anim] of Object.entries(docAnimate)) {
|
|
@@ -1844,7 +2277,7 @@ function replaceUrlRefs(value, idMap) {
|
|
|
1844
2277
|
});
|
|
1845
2278
|
}
|
|
1846
2279
|
|
|
1847
|
-
// src/PxNodeProps.ts
|
|
2280
|
+
// src/util/PxNodeProps.ts
|
|
1848
2281
|
var DISALLOWED_SVG_TAGS_LOWER = /* @__PURE__ */ new Set([
|
|
1849
2282
|
"script",
|
|
1850
2283
|
"foreignobject"
|
|
@@ -1908,10 +2341,10 @@ function sanitiseAttributeValue(name, value) {
|
|
|
1908
2341
|
return value;
|
|
1909
2342
|
}
|
|
1910
2343
|
function resolveStyle(style, defs) {
|
|
1911
|
-
var
|
|
2344
|
+
var _a2;
|
|
1912
2345
|
if (!style) return void 0;
|
|
1913
2346
|
if (typeof style === "string") {
|
|
1914
|
-
return (
|
|
2347
|
+
return (_a2 = defs == null ? void 0 : defs.styles) == null ? void 0 : _a2[style];
|
|
1915
2348
|
}
|
|
1916
2349
|
return style;
|
|
1917
2350
|
}
|
|
@@ -1926,14 +2359,14 @@ function getNormalizedProps(props) {
|
|
|
1926
2359
|
propsCopy[key] = toRGBA(value);
|
|
1927
2360
|
} else if (key === "transform" && value !== null && typeof value === "object" && !Array.isArray(value) && !value.keyframes) {
|
|
1928
2361
|
const parts = value.value && typeof value.value === "object" ? value.value : value;
|
|
1929
|
-
propsCopy[
|
|
2362
|
+
propsCopy[TRANSFORM_ATTR] = composeTransformParts(parts, { withUnits: false });
|
|
1930
2363
|
} else if (TRANSFORM_FN_NAMES.has(key)) {
|
|
1931
2364
|
if (Array.isArray(value)) {
|
|
1932
2365
|
if (key === "translate") value = value.map((v) => v + "px");
|
|
1933
2366
|
value = value.join(",");
|
|
1934
2367
|
}
|
|
1935
2368
|
if (key === "rotate") value = value + "deg";
|
|
1936
|
-
propsCopy[
|
|
2369
|
+
propsCopy[TRANSFORM_ATTR] = key + "(" + value + ")";
|
|
1937
2370
|
} else if (Array.isArray(value)) {
|
|
1938
2371
|
propsCopy[key] = value.join(",");
|
|
1939
2372
|
} else if (value !== void 0 && value !== null) {
|
|
@@ -1943,10 +2376,9 @@ function getNormalizedProps(props) {
|
|
|
1943
2376
|
return propsCopy;
|
|
1944
2377
|
}
|
|
1945
2378
|
|
|
1946
|
-
// src/PxMotionPath.ts
|
|
2379
|
+
// src/materialise/PxMotionPath.ts
|
|
1947
2380
|
function getKfTranslate(kf) {
|
|
1948
|
-
|
|
1949
|
-
const v = (_a = kf.value) != null ? _a : kf.v;
|
|
2381
|
+
const v = kfValue(kf);
|
|
1950
2382
|
if (!v) return void 0;
|
|
1951
2383
|
if (Array.isArray(v) && v.length >= 2 && typeof v[0] === "number" && typeof v[1] === "number") {
|
|
1952
2384
|
return [v[0], v[1]];
|
|
@@ -1956,31 +2388,27 @@ function getKfTranslate(kf) {
|
|
|
1956
2388
|
return void 0;
|
|
1957
2389
|
}
|
|
1958
2390
|
function getKfTime(kf) {
|
|
1959
|
-
|
|
1960
|
-
return (_b = (_a = kf.time) != null ? _a : kf.t) != null ? _b : 0;
|
|
2391
|
+
return kfTime(kf);
|
|
1961
2392
|
}
|
|
1962
2393
|
function getKfEasing(kf) {
|
|
1963
|
-
|
|
1964
|
-
return (_a = kf.easing) != null ? _a : kf.e;
|
|
2394
|
+
return kfEasing(kf);
|
|
1965
2395
|
}
|
|
1966
2396
|
function propAnimIsMotionPath(anim) {
|
|
1967
|
-
var _a, _b;
|
|
1968
2397
|
const kfs = anim.keyframes;
|
|
1969
2398
|
if (!Array.isArray(kfs)) return false;
|
|
1970
2399
|
if (anim.autoOrient) return true;
|
|
1971
2400
|
for (const kf of kfs) {
|
|
1972
|
-
if ((
|
|
2401
|
+
if (kfTangentIn(kf) || kfTangentOut(kf)) return true;
|
|
1973
2402
|
}
|
|
1974
2403
|
return false;
|
|
1975
2404
|
}
|
|
1976
2405
|
var _segmentCache = /* @__PURE__ */ new WeakMap();
|
|
1977
2406
|
function getSegmentCache(prevKf, nextKf, prevPos, nextPos) {
|
|
1978
|
-
var _a, _b;
|
|
1979
2407
|
let byNext = _segmentCache.get(prevKf);
|
|
1980
2408
|
const existing = byNext == null ? void 0 : byNext.get(nextKf);
|
|
1981
2409
|
if (existing) return existing;
|
|
1982
|
-
const to = (
|
|
1983
|
-
const ti = (
|
|
2410
|
+
const to = kfTangentOut(prevKf);
|
|
2411
|
+
const ti = kfTangentIn(nextKf);
|
|
1984
2412
|
const P1 = [prevPos[0] + (to ? to[0] : 0), prevPos[1] + (to ? to[1] : 0)];
|
|
1985
2413
|
const P2 = [nextPos[0] + (ti ? ti[0] : 0), nextPos[1] + (ti ? ti[1] : 0)];
|
|
1986
2414
|
const lut = bezier2D_arcLengthLUT(prevPos, P1, P2, nextPos);
|
|
@@ -2030,12 +2458,12 @@ var DEFAULT_FLATNESS_TOL = 0.5;
|
|
|
2030
2458
|
var DEFAULT_ROTATION_TOL = 5;
|
|
2031
2459
|
var DEFAULT_MAX_SAMPLES = 32;
|
|
2032
2460
|
function materialiseMotionPathInPropAnim(anim, opts) {
|
|
2033
|
-
var
|
|
2461
|
+
var _a2, _b, _c;
|
|
2034
2462
|
if (!propAnimIsMotionPath(anim)) return anim;
|
|
2035
2463
|
const kfs = anim.keyframes;
|
|
2036
2464
|
if (!Array.isArray(kfs) || kfs.length < 2) return anim;
|
|
2037
2465
|
const autoOrient = !!anim.autoOrient;
|
|
2038
|
-
const flatnessTol = (
|
|
2466
|
+
const flatnessTol = (_a2 = opts == null ? void 0 : opts.flatnessTolerance) != null ? _a2 : DEFAULT_FLATNESS_TOL;
|
|
2039
2467
|
const rotationTol = (_b = opts == null ? void 0 : opts.rotationTolerance) != null ? _b : DEFAULT_ROTATION_TOL;
|
|
2040
2468
|
const maxSamples = (_c = opts == null ? void 0 : opts.maxSamplesPerSegment) != null ? _c : DEFAULT_MAX_SAMPLES;
|
|
2041
2469
|
const out = [];
|
|
@@ -2071,10 +2499,9 @@ function materialiseMotionPathInPropAnim(anim, opts) {
|
|
|
2071
2499
|
return result;
|
|
2072
2500
|
}
|
|
2073
2501
|
function unwrapAutoOrientRotations(kfs) {
|
|
2074
|
-
var _a;
|
|
2075
2502
|
let prev;
|
|
2076
2503
|
for (const kf of kfs) {
|
|
2077
|
-
const v = (
|
|
2504
|
+
const v = kfValue(kf);
|
|
2078
2505
|
if (!v || typeof v.rotate !== "number") continue;
|
|
2079
2506
|
if (prev === void 0) {
|
|
2080
2507
|
prev = v.rotate;
|
|
@@ -2091,8 +2518,7 @@ function makeOutKf(time, value) {
|
|
|
2091
2518
|
return { t: time, v: value };
|
|
2092
2519
|
}
|
|
2093
2520
|
function getKfValueParts(kf) {
|
|
2094
|
-
|
|
2095
|
-
const v = (_a = kf.value) != null ? _a : kf.v;
|
|
2521
|
+
const v = kfValue(kf);
|
|
2096
2522
|
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
2097
2523
|
return v;
|
|
2098
2524
|
}
|
|
@@ -2153,9 +2579,8 @@ function wrappedAngleDelta(a, b) {
|
|
|
2153
2579
|
return d;
|
|
2154
2580
|
}
|
|
2155
2581
|
function insertSharpCornerStepKfIfNeeded(out, prevKf, nextKf, prevPos, nextPos, rotationTol) {
|
|
2156
|
-
var _a;
|
|
2157
2582
|
const lastKf = out[out.length - 1];
|
|
2158
|
-
const lastV = (
|
|
2583
|
+
const lastV = kfValue(lastKf);
|
|
2159
2584
|
const prevExit = lastV == null ? void 0 : lastV.rotate;
|
|
2160
2585
|
if (typeof prevExit !== "number") return;
|
|
2161
2586
|
const boundaryV = getKfValueParts(prevKf);
|
|
@@ -2336,7 +2761,7 @@ function walkAndMaterialise(node, opts) {
|
|
|
2336
2761
|
return cloned;
|
|
2337
2762
|
}
|
|
2338
2763
|
|
|
2339
|
-
// src/PxDefinitions.ts
|
|
2764
|
+
// src/animation/PxDefinitions.ts
|
|
2340
2765
|
var LOOP_JUMP_SHIFT_MS = 1;
|
|
2341
2766
|
function deepEqualValue(a, b) {
|
|
2342
2767
|
if (a === b) return true;
|
|
@@ -2468,21 +2893,21 @@ function normalizePathValue(value) {
|
|
|
2468
2893
|
return value;
|
|
2469
2894
|
}
|
|
2470
2895
|
function resolveEasing(easing, defs) {
|
|
2471
|
-
var
|
|
2896
|
+
var _a2;
|
|
2472
2897
|
if (!easing) return void 0;
|
|
2473
2898
|
if (Array.isArray(easing)) {
|
|
2474
2899
|
return easing;
|
|
2475
2900
|
}
|
|
2476
|
-
if ((
|
|
2901
|
+
if ((_a2 = defs == null ? void 0 : defs.easings) == null ? void 0 : _a2[easing]) {
|
|
2477
2902
|
return defs.easings[easing];
|
|
2478
2903
|
}
|
|
2479
2904
|
console.warn("Unknown easing name: " + easing);
|
|
2480
2905
|
return void 0;
|
|
2481
2906
|
}
|
|
2482
2907
|
function resolveAnimation(animRef, defs) {
|
|
2483
|
-
var
|
|
2908
|
+
var _a2;
|
|
2484
2909
|
if (typeof animRef === "string") {
|
|
2485
|
-
const resolved = (
|
|
2910
|
+
const resolved = (_a2 = defs == null ? void 0 : defs.animations) == null ? void 0 : _a2[animRef];
|
|
2486
2911
|
if (!resolved) {
|
|
2487
2912
|
console.warn("Unknown animation name: " + animRef);
|
|
2488
2913
|
}
|
|
@@ -2507,9 +2932,9 @@ function resolveElementAnimation(animate, defs) {
|
|
|
2507
2932
|
return results;
|
|
2508
2933
|
}
|
|
2509
2934
|
function interpolateValue(propName, a, b, t) {
|
|
2510
|
-
var
|
|
2935
|
+
var _a2, _b;
|
|
2511
2936
|
if (propName === "d") {
|
|
2512
|
-
const aPaths = (
|
|
2937
|
+
const aPaths = (_a2 = a == null ? void 0 : a.paths) != null ? _a2 : Array.isArray(a) ? a : [];
|
|
2513
2938
|
const bPaths = (_b = b == null ? void 0 : b.paths) != null ? _b : Array.isArray(b) ? b : [];
|
|
2514
2939
|
return { paths: interpolateBeziers(aPaths, bPaths, t) };
|
|
2515
2940
|
}
|
|
@@ -2545,11 +2970,11 @@ function interpolateTransformParts(a, b, t) {
|
|
|
2545
2970
|
return out;
|
|
2546
2971
|
}
|
|
2547
2972
|
function expandLoopKeyframes(propName, keyframes, loop, duration) {
|
|
2548
|
-
var
|
|
2973
|
+
var _a2, _b, _c, _d, _e;
|
|
2549
2974
|
const totalIntervals = keyframes.length - 1;
|
|
2550
|
-
const segCount = clamp((
|
|
2975
|
+
const segCount = clamp((_a2 = loop.segmentCount) != null ? _a2 : totalIntervals, 1, totalIntervals);
|
|
2551
2976
|
let segKfs;
|
|
2552
|
-
if (loop.
|
|
2977
|
+
if (loop.repeatAt === PxLoopRepeatAt.start) {
|
|
2553
2978
|
segKfs = keyframes.slice(0, segCount + 1);
|
|
2554
2979
|
} else {
|
|
2555
2980
|
segKfs = keyframes.slice(totalIntervals - segCount);
|
|
@@ -2557,7 +2982,7 @@ function expandLoopKeyframes(propName, keyframes, loop, duration) {
|
|
|
2557
2982
|
const firstT = (_b = keyframes[0].t) != null ? _b : 0;
|
|
2558
2983
|
const lastT = (_c = keyframes[keyframes.length - 1].t) != null ? _c : 0;
|
|
2559
2984
|
let fillStart, fillEnd;
|
|
2560
|
-
if (loop.
|
|
2985
|
+
if (loop.repeatAt === PxLoopRepeatAt.start) {
|
|
2561
2986
|
fillStart = 0;
|
|
2562
2987
|
fillEnd = firstT;
|
|
2563
2988
|
} else {
|
|
@@ -2570,26 +2995,23 @@ function expandLoopKeyframes(propName, keyframes, loop, duration) {
|
|
|
2570
2995
|
const segEndT = (_e = segKfs[segKfs.length - 1].t) != null ? _e : 0;
|
|
2571
2996
|
const segDuration = segEndT - segStartT;
|
|
2572
2997
|
if (segDuration <= 0) return keyframes;
|
|
2573
|
-
const template = segKfs.map((kf) => {
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
tangentOut: (_b2 = kf.tangentOut) != null ? _b2 : kf.to
|
|
2581
|
-
};
|
|
2582
|
-
});
|
|
2998
|
+
const template = segKfs.map((kf) => ({
|
|
2999
|
+
relT: (kf.t - segStartT) / segDuration,
|
|
3000
|
+
v: kf.v,
|
|
3001
|
+
e: kf.e,
|
|
3002
|
+
tangentIn: kfTangentIn(kf),
|
|
3003
|
+
tangentOut: kfTangentOut(kf)
|
|
3004
|
+
}));
|
|
2583
3005
|
const fullReps = Math.floor(fillDuration / segDuration);
|
|
2584
3006
|
const remainder = fillDuration - fullReps * segDuration;
|
|
2585
3007
|
const partialFraction = remainder / segDuration;
|
|
2586
3008
|
const looped = [];
|
|
2587
|
-
const separateBoundary = loop.
|
|
3009
|
+
const separateBoundary = loop.repeatAt !== PxLoopRepeatAt.start;
|
|
2588
3010
|
const originalTerminalKf = keyframes[keyframes.length - 1];
|
|
2589
3011
|
let terminalEasingOverride;
|
|
2590
3012
|
let hasTerminalEasingOverride = false;
|
|
2591
3013
|
function appendRep(repStart, isReversed, partial) {
|
|
2592
|
-
var
|
|
3014
|
+
var _a3;
|
|
2593
3015
|
let entries;
|
|
2594
3016
|
if (isReversed) {
|
|
2595
3017
|
entries = [];
|
|
@@ -2626,7 +3048,7 @@ function expandLoopKeyframes(propName, keyframes, loop, duration) {
|
|
|
2626
3048
|
return;
|
|
2627
3049
|
}
|
|
2628
3050
|
const prevKf = looped.length > 0 ? looped[looped.length - 1] : originalTerminalKf;
|
|
2629
|
-
const isBoundary = separateBoundary && i === 0 && prevKf !== void 0 && Math.abs(((
|
|
3051
|
+
const isBoundary = separateBoundary && i === 0 && prevKf !== void 0 && Math.abs(((_a3 = prevKf.t) != null ? _a3 : 0) - (repStart + entry.relT * segDuration)) < 1e-9;
|
|
2630
3052
|
if (isBoundary) {
|
|
2631
3053
|
if (deepEqualValue(prevKf.v, entry.v)) {
|
|
2632
3054
|
if (looped.length > 0) {
|
|
@@ -2692,30 +3114,30 @@ function expandLoopKeyframes(propName, keyframes, loop, duration) {
|
|
|
2692
3114
|
looped.push(pushed);
|
|
2693
3115
|
}
|
|
2694
3116
|
}
|
|
2695
|
-
if (loop.
|
|
3117
|
+
if (loop.repeatAt === PxLoopRepeatAt.start) {
|
|
2696
3118
|
if (partialFraction > 1e-9) {
|
|
2697
|
-
const isReversed =
|
|
3119
|
+
const isReversed = loop.direction === PxLoopDirection.alternate && fullReps % 2 === 0;
|
|
2698
3120
|
appendRepTail(fillStart, isReversed, partialFraction);
|
|
2699
3121
|
}
|
|
2700
3122
|
for (let rep = 0; rep < fullReps; rep++) {
|
|
2701
3123
|
const distFromBoundary = fullReps - 1 - rep;
|
|
2702
|
-
const isReversed =
|
|
3124
|
+
const isReversed = loop.direction === PxLoopDirection.alternate && distFromBoundary % 2 === 0;
|
|
2703
3125
|
const repStart = fillStart + remainder + rep * segDuration;
|
|
2704
3126
|
appendRep(repStart, isReversed);
|
|
2705
3127
|
}
|
|
2706
3128
|
} else {
|
|
2707
3129
|
for (let rep = 0; rep < fullReps; rep++) {
|
|
2708
|
-
const isReversed =
|
|
3130
|
+
const isReversed = loop.direction === PxLoopDirection.alternate && rep % 2 === 0;
|
|
2709
3131
|
const repStart = fillStart + rep * segDuration;
|
|
2710
3132
|
appendRep(repStart, isReversed);
|
|
2711
3133
|
}
|
|
2712
3134
|
if (partialFraction > 1e-9) {
|
|
2713
|
-
const isReversed =
|
|
3135
|
+
const isReversed = loop.direction === PxLoopDirection.alternate && fullReps % 2 === 0;
|
|
2714
3136
|
const repStart = fillStart + fullReps * segDuration;
|
|
2715
3137
|
appendRep(repStart, isReversed, partialFraction);
|
|
2716
3138
|
}
|
|
2717
3139
|
}
|
|
2718
|
-
if (loop.
|
|
3140
|
+
if (loop.repeatAt === PxLoopRepeatAt.start) {
|
|
2719
3141
|
return [...looped, ...keyframes];
|
|
2720
3142
|
} else {
|
|
2721
3143
|
if (hasTerminalEasingOverride && keyframes.length > 0) {
|
|
@@ -2727,34 +3149,34 @@ function expandLoopKeyframes(propName, keyframes, loop, duration) {
|
|
|
2727
3149
|
}
|
|
2728
3150
|
}
|
|
2729
3151
|
function normalizeKeyframes(propName, propAnim, duration, defs) {
|
|
2730
|
-
var
|
|
3152
|
+
var _a2;
|
|
2731
3153
|
const keyframes = propAnim.keyframes || [];
|
|
2732
3154
|
const normalized = [];
|
|
2733
3155
|
for (const kf of keyframes) {
|
|
2734
|
-
const timePct = (
|
|
2735
|
-
let value = (
|
|
2736
|
-
const easing = (
|
|
3156
|
+
const timePct = kfTime(kf);
|
|
3157
|
+
let value = kfValue(kf);
|
|
3158
|
+
const easing = kfEasing(kf);
|
|
2737
3159
|
if (propName === "d") {
|
|
2738
3160
|
value = normalizePathValue(value);
|
|
2739
3161
|
}
|
|
2740
3162
|
const propNameKebab = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
|
|
2741
3163
|
if (COLOUR_ATTR_NAMES.has(propNameKebab)) {
|
|
2742
|
-
value = (
|
|
3164
|
+
value = (_a2 = parseColor(value)) != null ? _a2 : value;
|
|
2743
3165
|
}
|
|
2744
3166
|
const normKf = {
|
|
2745
3167
|
t: timePct,
|
|
2746
3168
|
v: value,
|
|
2747
3169
|
e: resolveEasing(easing, defs)
|
|
2748
3170
|
};
|
|
2749
|
-
const tIn = (
|
|
2750
|
-
const tOut = (
|
|
3171
|
+
const tIn = kfTangentIn(kf);
|
|
3172
|
+
const tOut = kfTangentOut(kf);
|
|
2751
3173
|
if (tIn) normKf.tangentIn = tIn;
|
|
2752
3174
|
if (tOut) normKf.tangentOut = tOut;
|
|
2753
3175
|
normalized.push(normKf);
|
|
2754
3176
|
}
|
|
2755
3177
|
normalized.sort((a, b) => {
|
|
2756
|
-
var
|
|
2757
|
-
return ((
|
|
3178
|
+
var _a3, _b;
|
|
3179
|
+
return ((_a3 = a.t) != null ? _a3 : 0) - ((_b = b.t) != null ? _b : 0);
|
|
2758
3180
|
});
|
|
2759
3181
|
const loopRaw = propAnim.loop;
|
|
2760
3182
|
const loop = loopRaw === true ? {} : loopRaw || void 0;
|
|
@@ -2781,15 +3203,17 @@ function materialiseInternalLoopsInPropAnim(propName, propAnim, duration) {
|
|
|
2781
3203
|
const propNameKebab = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
|
|
2782
3204
|
const isColour = COLOUR_ATTR_NAMES.has(propNameKebab);
|
|
2783
3205
|
const kfs = rawKfs.map((kf) => {
|
|
2784
|
-
var
|
|
2785
|
-
const t = (
|
|
2786
|
-
let v = (
|
|
3206
|
+
var _a2;
|
|
3207
|
+
const t = kfTime(kf);
|
|
3208
|
+
let v = kfValue(kf);
|
|
2787
3209
|
if (propName === "d") v = normalizePathValue(v);
|
|
2788
|
-
if (isColour) v = (
|
|
2789
|
-
const e = (
|
|
3210
|
+
if (isColour) v = (_a2 = parseColor(v)) != null ? _a2 : v;
|
|
3211
|
+
const e = kfEasing(kf);
|
|
2790
3212
|
const out2 = { t, v, e };
|
|
2791
|
-
|
|
2792
|
-
|
|
3213
|
+
const tIn = kfTangentIn(kf);
|
|
3214
|
+
const tOut = kfTangentOut(kf);
|
|
3215
|
+
if (tIn) out2.tangentIn = tIn;
|
|
3216
|
+
if (tOut) out2.tangentOut = tOut;
|
|
2793
3217
|
return out2;
|
|
2794
3218
|
});
|
|
2795
3219
|
const expanded = expandLoopKeyframes(propName, kfs, loop, duration);
|
|
@@ -2840,7 +3264,7 @@ function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
|
|
|
2840
3264
|
const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
|
|
2841
3265
|
if (!staticParts || !Object.keys(staticParts).length) return animDef;
|
|
2842
3266
|
const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues(__spreadValues({}, staticParts), v) : v;
|
|
2843
|
-
const transformAnim = animDef[
|
|
3267
|
+
const transformAnim = animDef[TRANSFORM_ATTR];
|
|
2844
3268
|
if (transformAnim && typeof transformAnim === "object") {
|
|
2845
3269
|
const anim = transformAnim;
|
|
2846
3270
|
if (Array.isArray(anim.keyframes)) {
|
|
@@ -2865,7 +3289,7 @@ function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
|
|
|
2865
3289
|
delete rest[ch];
|
|
2866
3290
|
return __spreadProps(__spreadValues({}, rest), { transform: lifted });
|
|
2867
3291
|
}
|
|
2868
|
-
function normalizeAnimationDefinition(animDef, duration, defs, engine =
|
|
3292
|
+
function normalizeAnimationDefinition(animDef, duration, defs, engine = PxTimelineEngine.native) {
|
|
2869
3293
|
const normalized = {};
|
|
2870
3294
|
for (const [propName, propAnim] of Object.entries(animDef)) {
|
|
2871
3295
|
if (propName === "transform" && propAnim.alongPathMode === "offsetPath" && animDef["offsetDistance"] !== void 0) {
|
|
@@ -2876,12 +3300,12 @@ function normalizeAnimationDefinition(animDef, duration, defs, engine = PxAnimat
|
|
|
2876
3300
|
const out = { keyframes: normalizedKfs };
|
|
2877
3301
|
if (propAnim.autoOrient !== void 0) out.autoOrient = propAnim.autoOrient;
|
|
2878
3302
|
if (propAnim.loop !== void 0) out.loop = propAnim.loop;
|
|
2879
|
-
normalized[propName] = engine ===
|
|
3303
|
+
normalized[propName] = engine === PxTimelineEngine.native && propName === "transform" ? materialiseMotionPathInPropAnim(out) : out;
|
|
2880
3304
|
}
|
|
2881
3305
|
}
|
|
2882
3306
|
return normalized;
|
|
2883
3307
|
}
|
|
2884
|
-
function getNormalisedBindings(doc, engine =
|
|
3308
|
+
function getNormalisedBindings(doc, engine = PxTimelineEngine.native) {
|
|
2885
3309
|
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
2886
3310
|
const defs = getDefs(doc);
|
|
2887
3311
|
const duration = animatorConfig.duration || 1e3;
|
|
@@ -2927,12 +3351,12 @@ function getNormalisedBindings(doc, engine = PxAnimatorEngine.waapi) {
|
|
|
2927
3351
|
return bindings;
|
|
2928
3352
|
}
|
|
2929
3353
|
function getKeyframesPair(keyframes, progress) {
|
|
2930
|
-
var
|
|
3354
|
+
var _a2, _b;
|
|
2931
3355
|
const last = keyframes.length - 1;
|
|
2932
3356
|
let prevKf = keyframes[0];
|
|
2933
3357
|
let nextKf = keyframes[last > 0 ? 1 : 0];
|
|
2934
3358
|
for (let j = 0; j < last; j++) {
|
|
2935
|
-
const aOff = (
|
|
3359
|
+
const aOff = (_a2 = keyframes[j].t) != null ? _a2 : 0;
|
|
2936
3360
|
const bOff = (_b = keyframes[j + 1].t) != null ? _b : 0;
|
|
2937
3361
|
if (aOff <= progress && progress <= bOff) {
|
|
2938
3362
|
prevKf = keyframes[j];
|
|
@@ -2947,13 +3371,13 @@ function getKeyframesPair(keyframes, progress) {
|
|
|
2947
3371
|
return { prevKf, nextKf };
|
|
2948
3372
|
}
|
|
2949
3373
|
function calcPropertyValue(propName, propAnim, progress) {
|
|
2950
|
-
var
|
|
3374
|
+
var _a2, _b, _c, _d;
|
|
2951
3375
|
const keyframes = propAnim.keyframes || [];
|
|
2952
3376
|
if (keyframes.length === 0) return null;
|
|
2953
3377
|
const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
|
|
2954
|
-
let localProgress = prevKf === nextKf ? 0 : remap(progress, (
|
|
3378
|
+
let localProgress = prevKf === nextKf ? 0 : remap(progress, (_a2 = prevKf.t) != null ? _a2 : 0, (_b = nextKf.t) != null ? _b : 0, 0, 1);
|
|
2955
3379
|
localProgress = clamp(localProgress, 0, 1);
|
|
2956
|
-
const easing = (
|
|
3380
|
+
const easing = kfEasing(prevKf);
|
|
2957
3381
|
if (easing && Array.isArray(easing)) {
|
|
2958
3382
|
try {
|
|
2959
3383
|
localProgress = cubicBezier(easing)(localProgress);
|
|
@@ -2962,11 +3386,11 @@ function calcPropertyValue(propName, propAnim, progress) {
|
|
|
2962
3386
|
}
|
|
2963
3387
|
let cssAttrName = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
|
|
2964
3388
|
let cssValue = null;
|
|
2965
|
-
const prevV =
|
|
2966
|
-
const nextV =
|
|
3389
|
+
const prevV = prevKf == null ? void 0 : prevKf.v;
|
|
3390
|
+
const nextV = nextKf == null ? void 0 : nextKf.v;
|
|
2967
3391
|
if (cssAttrName === "d") {
|
|
2968
|
-
const prevPaths = (
|
|
2969
|
-
const nextPaths = (
|
|
3392
|
+
const prevPaths = (_c = prevV == null ? void 0 : prevV.paths) != null ? _c : Array.isArray(prevV) ? prevV : [];
|
|
3393
|
+
const nextPaths = (_d = nextV == null ? void 0 : nextV.paths) != null ? _d : Array.isArray(nextV) ? nextV : [];
|
|
2970
3394
|
cssValue = interpolateBeziers(
|
|
2971
3395
|
prevPaths,
|
|
2972
3396
|
nextPaths,
|
|
@@ -3069,7 +3493,7 @@ function calcAnimationValues(animDef, progress) {
|
|
|
3069
3493
|
return result;
|
|
3070
3494
|
}
|
|
3071
3495
|
|
|
3072
|
-
// src/PxNodeCloneUtil.ts
|
|
3496
|
+
// src/util/PxNodeCloneUtil.ts
|
|
3073
3497
|
function deepClonePxNode(value) {
|
|
3074
3498
|
if (value === null || typeof value !== "object") return value;
|
|
3075
3499
|
if (Array.isArray(value)) return value.map(deepClonePxNode);
|
|
@@ -3080,13 +3504,13 @@ function deepClonePxNode(value) {
|
|
|
3080
3504
|
function regenerateIdsAndRewriteRefs(root, genId3) {
|
|
3081
3505
|
const oldToNew = /* @__PURE__ */ new Map();
|
|
3082
3506
|
const walkAssign = (n) => {
|
|
3083
|
-
var
|
|
3507
|
+
var _a2;
|
|
3084
3508
|
if (typeof n.id === "string") {
|
|
3085
3509
|
const newId = genId3();
|
|
3086
3510
|
oldToNew.set(n.id, newId);
|
|
3087
3511
|
n.id = newId;
|
|
3088
3512
|
}
|
|
3089
|
-
(
|
|
3513
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach(walkAssign);
|
|
3090
3514
|
};
|
|
3091
3515
|
walkAssign(root);
|
|
3092
3516
|
const rewriteUrl = (s) => s.replace(/url\(#([^)]+)\)/g, (m, oldId) => {
|
|
@@ -3094,7 +3518,7 @@ function regenerateIdsAndRewriteRefs(root, genId3) {
|
|
|
3094
3518
|
return newId ? "url(#" + newId + ")" : m;
|
|
3095
3519
|
});
|
|
3096
3520
|
const walkRewrite = (n) => {
|
|
3097
|
-
var
|
|
3521
|
+
var _a2;
|
|
3098
3522
|
if (typeof n.href === "string" && n.href.startsWith("#")) {
|
|
3099
3523
|
const newId = oldToNew.get(n.href.slice(1));
|
|
3100
3524
|
if (newId) n.href = "#" + newId;
|
|
@@ -3106,7 +3530,7 @@ function regenerateIdsAndRewriteRefs(root, genId3) {
|
|
|
3106
3530
|
n[k] = rewriteUrl(v);
|
|
3107
3531
|
}
|
|
3108
3532
|
}
|
|
3109
|
-
(
|
|
3533
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach(walkRewrite);
|
|
3110
3534
|
};
|
|
3111
3535
|
walkRewrite(root);
|
|
3112
3536
|
return oldToNew;
|
|
@@ -3116,7 +3540,7 @@ function toFiniteNum(v) {
|
|
|
3116
3540
|
return Number.isFinite(n) ? n : 0;
|
|
3117
3541
|
}
|
|
3118
3542
|
function applyUseOffsetToG(gNode) {
|
|
3119
|
-
var
|
|
3543
|
+
var _a2;
|
|
3120
3544
|
const x = toFiniteNum(gNode.x);
|
|
3121
3545
|
const y = toFiniteNum(gNode.y);
|
|
3122
3546
|
delete gNode.x;
|
|
@@ -3125,7 +3549,7 @@ function applyUseOffsetToG(gNode) {
|
|
|
3125
3549
|
const offset = "translate(" + x + "," + y + ")";
|
|
3126
3550
|
const carriesTransform = gNode.transform !== void 0 || gNode.animate !== void 0;
|
|
3127
3551
|
if (carriesTransform) {
|
|
3128
|
-
const inner = { type: "g", transform: offset, children: (
|
|
3552
|
+
const inner = { type: "g", transform: offset, children: (_a2 = gNode.children) != null ? _a2 : [] };
|
|
3129
3553
|
gNode.children = [inner];
|
|
3130
3554
|
} else {
|
|
3131
3555
|
gNode.transform = offset;
|
|
@@ -3133,9 +3557,9 @@ function applyUseOffsetToG(gNode) {
|
|
|
3133
3557
|
return gNode;
|
|
3134
3558
|
}
|
|
3135
3559
|
|
|
3136
|
-
// src/PxAnimatorUseMaterialiser.ts
|
|
3560
|
+
// src/materialise/PxAnimatorUseMaterialiser.ts
|
|
3137
3561
|
function materialiseAnimatedUseInstances(root) {
|
|
3138
|
-
var
|
|
3562
|
+
var _a2;
|
|
3139
3563
|
const idMap = buildIdMap(root);
|
|
3140
3564
|
const animatedIds = computeAnimatedSubtreeIds(root, idMap);
|
|
3141
3565
|
if (animatedIds.size === 0) return root;
|
|
@@ -3146,7 +3570,7 @@ function materialiseAnimatedUseInstances(root) {
|
|
|
3146
3570
|
const walked = walkAndMaterialise2(root, idMap, animatedIds, genId3, defsCollector, rootViewport);
|
|
3147
3571
|
if (defsCollector.length === 0) return walked;
|
|
3148
3572
|
const defsNode = { type: "defs", children: defsCollector };
|
|
3149
|
-
const newChildren = [...(
|
|
3573
|
+
const newChildren = [...(_a2 = walked.children) != null ? _a2 : [], defsNode];
|
|
3150
3574
|
return __spreadProps(__spreadValues({}, walked), { children: newChildren });
|
|
3151
3575
|
}
|
|
3152
3576
|
function readRootViewport(root) {
|
|
@@ -3168,9 +3592,9 @@ function numericAttr(v) {
|
|
|
3168
3592
|
function buildIdMap(root) {
|
|
3169
3593
|
const map = /* @__PURE__ */ new Map();
|
|
3170
3594
|
const visit = (n) => {
|
|
3171
|
-
var
|
|
3595
|
+
var _a2;
|
|
3172
3596
|
if (typeof n.id === "string") map.set(n.id, n);
|
|
3173
|
-
(
|
|
3597
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach(visit);
|
|
3174
3598
|
};
|
|
3175
3599
|
visit(root);
|
|
3176
3600
|
return map;
|
|
@@ -3217,11 +3641,11 @@ function stripHash(href) {
|
|
|
3217
3641
|
return href.startsWith("#") ? href.slice(1) : href;
|
|
3218
3642
|
}
|
|
3219
3643
|
function materialiseOneUse(useNode, target, idMap, animatedIds, genId3, defsCollector, rootViewport) {
|
|
3220
|
-
var
|
|
3644
|
+
var _a2, _b, _c, _d;
|
|
3221
3645
|
const clone2 = deepClonePxNode(target);
|
|
3222
3646
|
regenerateIdsAndRewriteRefs(clone2, genId3);
|
|
3223
3647
|
const symbolViewBox = clone2.type === "symbol" ? parseViewBox(clone2.viewBox) : void 0;
|
|
3224
|
-
const useW = (_b = (
|
|
3648
|
+
const useW = (_b = (_a2 = numericAttr(useNode.width)) != null ? _a2 : symbolViewBox == null ? void 0 : symbolViewBox[2]) != null ? _b : rootViewport[0];
|
|
3225
3649
|
const useH = (_d = (_c = numericAttr(useNode.height)) != null ? _c : symbolViewBox == null ? void 0 : symbolViewBox[3]) != null ? _d : rootViewport[1];
|
|
3226
3650
|
const rewrittenClone = clone2.type === "symbol" ? rewriteSymbolRootToGroup(clone2, genId3, defsCollector, useW, useH) : clone2;
|
|
3227
3651
|
const materialisedClone = walkAndMaterialise2(rewrittenClone, idMap, animatedIds, genId3, defsCollector, rootViewport);
|
|
@@ -3281,7 +3705,7 @@ function walkAndMaterialise2(node, idMap, animatedIds, genId3, defsCollector, ro
|
|
|
3281
3705
|
return changed ? __spreadProps(__spreadValues({}, node), { children: newChildren }) : node;
|
|
3282
3706
|
}
|
|
3283
3707
|
|
|
3284
|
-
// src/effects/transformParts.ts
|
|
3708
|
+
// src/effects/shared/transformParts.ts
|
|
3285
3709
|
function partsRecord(part, value, origin) {
|
|
3286
3710
|
const rec = {};
|
|
3287
3711
|
if (part === "translate" /* Translate */) rec.translate = value;
|
|
@@ -3292,25 +3716,25 @@ function partsRecord(part, value, origin) {
|
|
|
3292
3716
|
return rec;
|
|
3293
3717
|
}
|
|
3294
3718
|
function readAnimatable(raw) {
|
|
3295
|
-
var
|
|
3719
|
+
var _a2, _b;
|
|
3296
3720
|
if (raw === void 0) return { kind: "absent" /* Absent */ };
|
|
3297
3721
|
if (Array.isArray(raw)) return { kind: "static" /* Static */, value: raw };
|
|
3298
3722
|
if (typeof raw === "object") {
|
|
3299
3723
|
const obj = raw;
|
|
3300
|
-
const kfs =
|
|
3724
|
+
const kfs = obj.keyframes;
|
|
3301
3725
|
if (kfs) {
|
|
3302
3726
|
const out = { kind: "animated" /* Animated */, keyframes: kfs.map(normaliseKeyframe), autoOrient: obj.autoOrient, loop: obj.loop };
|
|
3303
|
-
const base = (
|
|
3727
|
+
const base = (_a2 = obj.value) != null ? _a2 : obj.v;
|
|
3304
3728
|
if (base !== void 0 && out.kind === "animated" /* Animated */) out.base = base;
|
|
3305
3729
|
return out;
|
|
3306
3730
|
}
|
|
3307
|
-
const staticValue = (
|
|
3731
|
+
const staticValue = (_b = obj.value) != null ? _b : obj.v;
|
|
3308
3732
|
if (staticValue !== void 0) return { kind: "static" /* Static */, value: staticValue };
|
|
3309
3733
|
}
|
|
3310
3734
|
return { kind: "static" /* Static */, value: raw };
|
|
3311
3735
|
}
|
|
3312
3736
|
function writeAnimatableChannel(node, attrName, read, opts) {
|
|
3313
|
-
var
|
|
3737
|
+
var _a2, _b, _c, _d;
|
|
3314
3738
|
const toOut = (v) => (opts == null ? void 0 : opts.asString) && v !== void 0 && v !== null ? String(v) : v;
|
|
3315
3739
|
if (read.kind === "absent" /* Absent */) return;
|
|
3316
3740
|
if (read.kind === "static" /* Static */) {
|
|
@@ -3324,7 +3748,7 @@ function writeAnimatableChannel(node, attrName, read, opts) {
|
|
|
3324
3748
|
if (read.autoOrient !== void 0) block.autoOrient = read.autoOrient;
|
|
3325
3749
|
animate[attrName] = block;
|
|
3326
3750
|
node.animate = animate;
|
|
3327
|
-
const baseline = (_d = (_b = read.base) != null ? _b : (
|
|
3751
|
+
const baseline = (_d = (_b = read.base) != null ? _b : (_a2 = read.keyframes[0]) == null ? void 0 : _a2.value) != null ? _d : (_c = read.keyframes[0]) == null ? void 0 : _c.v;
|
|
3328
3752
|
if (baseline !== void 0) node[attrName] = toOut(baseline);
|
|
3329
3753
|
}
|
|
3330
3754
|
function normaliseKeyframe(kf) {
|
|
@@ -3342,12 +3766,12 @@ function normaliseKeyframe(kf) {
|
|
|
3342
3766
|
return out;
|
|
3343
3767
|
}
|
|
3344
3768
|
function readStaticOrigin(raw, ctx) {
|
|
3345
|
-
var
|
|
3769
|
+
var _a2;
|
|
3346
3770
|
const o = readAnimatable(raw);
|
|
3347
3771
|
if (o.kind === "absent" /* Absent */) return void 0;
|
|
3348
3772
|
if (o.kind === "static" /* Static */) return o.value;
|
|
3349
3773
|
ctx.warnings.push("transformBy.origin: animated origin approximated by its first keyframe");
|
|
3350
|
-
return (
|
|
3774
|
+
return (_a2 = o.keyframes[0]) == null ? void 0 : _a2.value;
|
|
3351
3775
|
}
|
|
3352
3776
|
function keyframeWith(kf, value) {
|
|
3353
3777
|
const out = { value };
|
|
@@ -3358,7 +3782,7 @@ function keyframeWith(kf, value) {
|
|
|
3358
3782
|
return out;
|
|
3359
3783
|
}
|
|
3360
3784
|
|
|
3361
|
-
// src/effects/transformationEffect.ts
|
|
3785
|
+
// src/effects/transform/transformationEffect.ts
|
|
3362
3786
|
function applyTransformByEffect(node, fx, ctx) {
|
|
3363
3787
|
if (!fx) return node;
|
|
3364
3788
|
delete node.transform;
|
|
@@ -3449,7 +3873,7 @@ function wrapOrigin(inner, raw, invert) {
|
|
|
3449
3873
|
return inner;
|
|
3450
3874
|
}
|
|
3451
3875
|
|
|
3452
|
-
// src/effects/util.ts
|
|
3876
|
+
// src/effects/shared/util.ts
|
|
3453
3877
|
function genId(ctx, prefix) {
|
|
3454
3878
|
return "_lw_" + prefix + "_" + ctx.nextId++;
|
|
3455
3879
|
}
|
|
@@ -3457,9 +3881,9 @@ function stripHash2(href) {
|
|
|
3457
3881
|
return typeof href === "string" ? href.replace(/^#/, "") : void 0;
|
|
3458
3882
|
}
|
|
3459
3883
|
function indexById(node, map) {
|
|
3460
|
-
var
|
|
3884
|
+
var _a2;
|
|
3461
3885
|
if (typeof node.id === "string") map.set(node.id, node);
|
|
3462
|
-
(
|
|
3886
|
+
(_a2 = node.children) == null ? void 0 : _a2.forEach((child) => indexById(child, map));
|
|
3463
3887
|
}
|
|
3464
3888
|
function spliceDefs(root, defs) {
|
|
3465
3889
|
if (!defs.length) return;
|
|
@@ -3471,11 +3895,11 @@ function regenerateIdsInClone(root, ctx) {
|
|
|
3471
3895
|
return regenerateIdsAndRewriteRefs(root, () => genId(ctx, "retimed"));
|
|
3472
3896
|
}
|
|
3473
3897
|
|
|
3474
|
-
// src/effects/contentRefSplit.ts
|
|
3898
|
+
// src/effects/reference/contentRefSplit.ts
|
|
3475
3899
|
function identifyContentRefTargets(node, ctx, allocator) {
|
|
3476
|
-
var
|
|
3477
|
-
if (node.type === "use" && ((_b = (
|
|
3478
|
-
const sourceId = stripHash2(node.effects.clone.
|
|
3900
|
+
var _a2, _b, _c;
|
|
3901
|
+
if (node.type === "use" && ((_b = (_a2 = node.effects) == null ? void 0 : _a2.clone) == null ? void 0 : _b.without) === "translate") {
|
|
3902
|
+
const sourceId = stripHash2(node.effects.clone.source);
|
|
3479
3903
|
if (typeof sourceId === "string" && sourceId && !ctx.contentRefInnerIds.has(sourceId)) {
|
|
3480
3904
|
ctx.contentRefInnerIds.set(sourceId, allocator(sourceId));
|
|
3481
3905
|
}
|
|
@@ -3500,10 +3924,10 @@ function splitForContentRef(node, transformBy, originalId, innerId, ctx) {
|
|
|
3500
3924
|
return outerWrapper;
|
|
3501
3925
|
}
|
|
3502
3926
|
function liftBodyTranslate(node, transformBy) {
|
|
3503
|
-
var
|
|
3927
|
+
var _a2, _b, _c;
|
|
3504
3928
|
const out = {};
|
|
3505
3929
|
let didLiftAnimate = false;
|
|
3506
|
-
const animTr = (
|
|
3930
|
+
const animTr = (_a2 = node.animate) == null ? void 0 : _a2.transform;
|
|
3507
3931
|
if (animTr && typeof animTr === "object" && Array.isArray(animTr.keyframes)) {
|
|
3508
3932
|
const kfs = animTr.keyframes;
|
|
3509
3933
|
const hasTranslate = kfs.some((kf) => kf.value && kf.value.translate);
|
|
@@ -3686,7 +4110,7 @@ function needsOriginOnOuter(translateAnim) {
|
|
|
3686
4110
|
return false;
|
|
3687
4111
|
}
|
|
3688
4112
|
|
|
3689
|
-
// src/effects/gradientEffect.ts
|
|
4113
|
+
// src/effects/paint/gradientEffect.ts
|
|
3690
4114
|
function applyFillGradientEffect(node, fx, ctx) {
|
|
3691
4115
|
return applyGradient(node, fx, ctx, "fill");
|
|
3692
4116
|
}
|
|
@@ -3721,7 +4145,7 @@ function synthesiseGradientDef(fx, id, ctx) {
|
|
|
3721
4145
|
return out;
|
|
3722
4146
|
}
|
|
3723
4147
|
function applyGeomVec(out, xAttr, yAttr, raw) {
|
|
3724
|
-
var
|
|
4148
|
+
var _a2, _b, _c;
|
|
3725
4149
|
const read = readAnimatable(raw);
|
|
3726
4150
|
if (read.kind === "absent" /* Absent */) return;
|
|
3727
4151
|
if (read.kind === "static" /* Static */) {
|
|
@@ -3740,7 +4164,7 @@ function applyGeomVec(out, xAttr, yAttr, raw) {
|
|
|
3740
4164
|
if (read.loop !== void 0) block.loop = read.loop;
|
|
3741
4165
|
return block;
|
|
3742
4166
|
};
|
|
3743
|
-
const animate = (
|
|
4167
|
+
const animate = (_a2 = out.animate) != null ? _a2 : {};
|
|
3744
4168
|
animate[xAttr] = axisChannel(0);
|
|
3745
4169
|
animate[yAttr] = axisChannel(1);
|
|
3746
4170
|
out.animate = animate;
|
|
@@ -3756,7 +4180,7 @@ function applyGeomNumber(out, attrName, raw) {
|
|
|
3756
4180
|
writeAnimatableChannel(out, attrName, read, { asString: true });
|
|
3757
4181
|
}
|
|
3758
4182
|
function buildStopChildren(stops, ctx) {
|
|
3759
|
-
var
|
|
4183
|
+
var _a2, _b;
|
|
3760
4184
|
if (!stops) return [];
|
|
3761
4185
|
const read = readAnimatable(stops);
|
|
3762
4186
|
if (read.kind === "absent" /* Absent */) return [];
|
|
@@ -3766,14 +4190,14 @@ function buildStopChildren(stops, ctx) {
|
|
|
3766
4190
|
const loopFromSource = read.loop;
|
|
3767
4191
|
let stopCount = 0;
|
|
3768
4192
|
for (const kf of kfs) {
|
|
3769
|
-
const v = (
|
|
4193
|
+
const v = kfValue(kf);
|
|
3770
4194
|
if (Array.isArray(v) && v.length > stopCount) stopCount = v.length;
|
|
3771
4195
|
}
|
|
3772
4196
|
if (!stopCount) return [];
|
|
3773
|
-
const firstKfValue = (
|
|
4197
|
+
const firstKfValue = kfValue(kfs[0]);
|
|
3774
4198
|
const baselineStops = [];
|
|
3775
4199
|
for (let i = 0; i < stopCount; i++) {
|
|
3776
|
-
const s = (
|
|
4200
|
+
const s = (_b = (_a2 = firstKfValue == null ? void 0 : firstKfValue[i]) != null ? _a2 : prevDefinedStop(kfs, 0, i)) != null ? _b : { offset: i / Math.max(1, stopCount - 1), color: "#000000" };
|
|
3777
4201
|
baselineStops.push({ offset: s.offset, color: s.color });
|
|
3778
4202
|
}
|
|
3779
4203
|
return baselineStops.map((bs, i) => animatedStopNode(bs, kfs, i, ctx, loopFromSource));
|
|
@@ -3786,16 +4210,16 @@ function staticStopNode(s) {
|
|
|
3786
4210
|
};
|
|
3787
4211
|
}
|
|
3788
4212
|
function animatedStopNode(baseline, kfs, stopIdx, _ctx, loop) {
|
|
3789
|
-
var
|
|
4213
|
+
var _a2;
|
|
3790
4214
|
const colorKfs = [];
|
|
3791
4215
|
const offsetKfs = [];
|
|
3792
4216
|
let offsetVaries = false;
|
|
3793
4217
|
for (const kf of kfs) {
|
|
3794
|
-
const t = (
|
|
3795
|
-
const arr = (
|
|
3796
|
-
const sliced = (
|
|
4218
|
+
const t = kfTime(kf);
|
|
4219
|
+
const arr = kfValue(kf);
|
|
4220
|
+
const sliced = (_a2 = arr == null ? void 0 : arr[stopIdx]) != null ? _a2 : prevDefinedStop(kfs, kfs.indexOf(kf), stopIdx);
|
|
3797
4221
|
if (!sliced) continue;
|
|
3798
|
-
const easing = (
|
|
4222
|
+
const easing = kfEasing(kf);
|
|
3799
4223
|
const colorOut = { time: t, value: sliced.color };
|
|
3800
4224
|
if (easing !== void 0) colorOut.easing = easing;
|
|
3801
4225
|
colorKfs.push(colorOut);
|
|
@@ -3822,13 +4246,12 @@ function animatedStopNode(baseline, kfs, stopIdx, _ctx, loop) {
|
|
|
3822
4246
|
return stop;
|
|
3823
4247
|
}
|
|
3824
4248
|
function prevDefinedStop(kfs, fromIdx, stopIdx) {
|
|
3825
|
-
var _a, _b;
|
|
3826
4249
|
for (let i = fromIdx; i >= 0; i--) {
|
|
3827
|
-
const arr = (
|
|
4250
|
+
const arr = kfValue(kfs[i]);
|
|
3828
4251
|
if (arr == null ? void 0 : arr[stopIdx]) return arr[stopIdx];
|
|
3829
4252
|
}
|
|
3830
4253
|
for (let i = fromIdx + 1; i < kfs.length; i++) {
|
|
3831
|
-
const arr = (
|
|
4254
|
+
const arr = kfValue(kfs[i]);
|
|
3832
4255
|
if (arr == null ? void 0 : arr[stopIdx]) return arr[stopIdx];
|
|
3833
4256
|
}
|
|
3834
4257
|
return void 0;
|
|
@@ -3838,7 +4261,7 @@ function formatOffset(o) {
|
|
|
3838
4261
|
return pct + "%";
|
|
3839
4262
|
}
|
|
3840
4263
|
|
|
3841
|
-
// src/effects/clipPathEffect.ts
|
|
4264
|
+
// src/effects/clipping/clipPathEffect.ts
|
|
3842
4265
|
function applyClipPathEffect(node, fx, ctx) {
|
|
3843
4266
|
if (!(fx == null ? void 0 : fx.d)) return node;
|
|
3844
4267
|
const clipId = genId(ctx, "clip");
|
|
@@ -3862,12 +4285,12 @@ function pathString(v) {
|
|
|
3862
4285
|
return void 0;
|
|
3863
4286
|
}
|
|
3864
4287
|
|
|
3865
|
-
// src/effects/maskedByEffect.ts
|
|
4288
|
+
// src/effects/clipping/maskedByEffect.ts
|
|
3866
4289
|
function applyMaskedByEffect(node, fx, transformBy, ctx) {
|
|
3867
4290
|
if (!fx) return node;
|
|
3868
|
-
const sourceId = stripHash2(fx.
|
|
4291
|
+
const sourceId = stripHash2(fx.source);
|
|
3869
4292
|
if (!sourceId) {
|
|
3870
|
-
ctx.errors.push("maskedBy.
|
|
4293
|
+
ctx.errors.push("maskedBy.source missing \u2014 cannot build mask");
|
|
3871
4294
|
return node;
|
|
3872
4295
|
}
|
|
3873
4296
|
const maskId = genId(ctx, "mask");
|
|
@@ -3930,16 +4353,16 @@ function invertPartValue(part, value) {
|
|
|
3930
4353
|
return [1 / value[0], 1 / value[1]];
|
|
3931
4354
|
}
|
|
3932
4355
|
function negatedSpatialTangents(kf) {
|
|
3933
|
-
var
|
|
4356
|
+
var _a2, _b;
|
|
3934
4357
|
const out = {};
|
|
3935
|
-
const to = (
|
|
4358
|
+
const to = (_a2 = kf.tangentOut) != null ? _a2 : kf.to;
|
|
3936
4359
|
const ti = (_b = kf.tangentIn) != null ? _b : kf.ti;
|
|
3937
4360
|
if (Array.isArray(to)) out.tangentOut = [-to[0], -to[1]];
|
|
3938
4361
|
if (Array.isArray(ti)) out.tangentIn = [-ti[0], -ti[1]];
|
|
3939
4362
|
return out;
|
|
3940
4363
|
}
|
|
3941
4364
|
function wrapInverseAnimatedBodyTransform(inner, node, _ctx) {
|
|
3942
|
-
var
|
|
4365
|
+
var _a2;
|
|
3943
4366
|
const animate = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate : void 0;
|
|
3944
4367
|
const animTr = animate == null ? void 0 : animate.transform;
|
|
3945
4368
|
const kfs = animTr && typeof animTr === "object" && Array.isArray(animTr.keyframes) ? animTr.keyframes : void 0;
|
|
@@ -3948,7 +4371,7 @@ function wrapInverseAnimatedBodyTransform(inner, node, _ctx) {
|
|
|
3948
4371
|
const rotateKfs = [];
|
|
3949
4372
|
const scaleKfs = [];
|
|
3950
4373
|
for (const kf of kfs) {
|
|
3951
|
-
const v = ((
|
|
4374
|
+
const v = ((_a2 = kf.value) != null ? _a2 : kf.v) || {};
|
|
3952
4375
|
const baseKf = keyframeWith(kf, void 0);
|
|
3953
4376
|
if (Array.isArray(v.translate)) {
|
|
3954
4377
|
translateKfs.push(__spreadProps(__spreadValues(__spreadValues({}, baseKf), negatedSpatialTangents(kf)), { value: { translate: [-v.translate[0], -v.translate[1]] } }));
|
|
@@ -4012,7 +4435,7 @@ function readTransformationFromBody(node) {
|
|
|
4012
4435
|
return void 0;
|
|
4013
4436
|
}
|
|
4014
4437
|
function parseTransformStringToParts(s) {
|
|
4015
|
-
var
|
|
4438
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
4016
4439
|
const re = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
|
|
4017
4440
|
let m;
|
|
4018
4441
|
const ops = [];
|
|
@@ -4026,7 +4449,7 @@ function parseTransformStringToParts(s) {
|
|
|
4026
4449
|
for (let j = ops.length - 2; j >= 0; j--) {
|
|
4027
4450
|
const cand = ops[j];
|
|
4028
4451
|
if (cand.name !== "translate") continue;
|
|
4029
|
-
const ox = (
|
|
4452
|
+
const ox = (_a2 = cand.args[0]) != null ? _a2 : 0;
|
|
4030
4453
|
const oy = (_b = cand.args[1]) != null ? _b : 0;
|
|
4031
4454
|
const lx = (_c = last.args[0]) != null ? _c : 0;
|
|
4032
4455
|
const ly = (_d = last.args[1]) != null ? _d : 0;
|
|
@@ -4141,8 +4564,8 @@ function interpKfs(kfs, t) {
|
|
|
4141
4564
|
function collectMaskAncestorChains(root, ctx) {
|
|
4142
4565
|
const interestingNodes = /* @__PURE__ */ new Set();
|
|
4143
4566
|
const collectInterestingNodes = (n) => {
|
|
4144
|
-
var
|
|
4145
|
-
const maskSourceId = stripHash2((_b = (
|
|
4567
|
+
var _a2, _b;
|
|
4568
|
+
const maskSourceId = stripHash2((_b = (_a2 = n.effects) == null ? void 0 : _a2.maskedBy) == null ? void 0 : _b.source);
|
|
4146
4569
|
if (typeof maskSourceId === "string") {
|
|
4147
4570
|
interestingNodes.add(n);
|
|
4148
4571
|
const sourceNode = ctx.idMap.get(maskSourceId);
|
|
@@ -4163,7 +4586,7 @@ function collectMaskAncestorChains(root, ctx) {
|
|
|
4163
4586
|
walk(root, []);
|
|
4164
4587
|
}
|
|
4165
4588
|
function extractTranslateOnly(node, ctx) {
|
|
4166
|
-
var
|
|
4589
|
+
var _a2, _b, _c;
|
|
4167
4590
|
const tr = node.transform;
|
|
4168
4591
|
const animateBlock = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate.transform : void 0;
|
|
4169
4592
|
if (tr === void 0 && !animateBlock) return void 0;
|
|
@@ -4171,7 +4594,7 @@ function extractTranslateOnly(node, ctx) {
|
|
|
4171
4594
|
if (typeof tr === "string") {
|
|
4172
4595
|
const parts = parseTranslateOnlyFromString(tr, ctx);
|
|
4173
4596
|
if (parts) out.translate = parts;
|
|
4174
|
-
} else if (tr && typeof tr === "object" && !tr.keyframes
|
|
4597
|
+
} else if (tr && typeof tr === "object" && !tr.keyframes) {
|
|
4175
4598
|
const wrapped = tr.value;
|
|
4176
4599
|
const value = wrapped && typeof wrapped === "object" ? wrapped : tr;
|
|
4177
4600
|
if (value && typeof value === "object" && Array.isArray(value.translate)) {
|
|
@@ -4185,7 +4608,7 @@ function extractTranslateOnly(node, ctx) {
|
|
|
4185
4608
|
const kfs = animateBlock.keyframes;
|
|
4186
4609
|
const translateKfs = [];
|
|
4187
4610
|
for (const kf of kfs) {
|
|
4188
|
-
const v = (
|
|
4611
|
+
const v = (_a2 = kf.value) != null ? _a2 : kf.v;
|
|
4189
4612
|
const t = (_c = (_b = kf.time) != null ? _b : kf.t) != null ? _c : 0;
|
|
4190
4613
|
if (v && typeof v === "object" && Array.isArray(v.translate)) {
|
|
4191
4614
|
translateKfs.push({ time: t, value: [v.translate[0] || 0, v.translate[1] || 0] });
|
|
@@ -4219,16 +4642,15 @@ function parseTranslateOnlyFromString(s, ctx) {
|
|
|
4219
4642
|
return seen ? [x, y] : void 0;
|
|
4220
4643
|
}
|
|
4221
4644
|
|
|
4222
|
-
// src/effects/refEffect.ts
|
|
4223
|
-
var CONTENT_SUBREF = "content";
|
|
4645
|
+
// src/effects/reference/refEffect.ts
|
|
4224
4646
|
function applyRefHref(node, clone2, ctx) {
|
|
4225
4647
|
if (!clone2) return;
|
|
4226
|
-
const sourceId = stripHash2(clone2.
|
|
4648
|
+
const sourceId = stripHash2(clone2.source);
|
|
4227
4649
|
if (!sourceId) {
|
|
4228
|
-
if (clone2.
|
|
4650
|
+
if (clone2.without === PxCloneWithout.translate) ctx.errors.push("clone: content ref missing `source`");
|
|
4229
4651
|
return;
|
|
4230
4652
|
}
|
|
4231
|
-
const targetId = clone2.
|
|
4653
|
+
const targetId = clone2.without === PxCloneWithout.translate ? ctx.contentRefInnerIds.get(sourceId) || sourceId : sourceId;
|
|
4232
4654
|
node.href = "#" + targetId;
|
|
4233
4655
|
}
|
|
4234
4656
|
function applyRefAndTransformationEffect(node, clone2, transformBy, ctx) {
|
|
@@ -4236,11 +4658,11 @@ function applyRefAndTransformationEffect(node, clone2, transformBy, ctx) {
|
|
|
4236
4658
|
return applyTransformByEffect(node, transformBy, ctx);
|
|
4237
4659
|
}
|
|
4238
4660
|
|
|
4239
|
-
// src/effects/repeaterEffect.ts
|
|
4661
|
+
// src/effects/transform/repeaterEffect.ts
|
|
4240
4662
|
function applyRepeaterEffect(node, fx, ctx) {
|
|
4241
|
-
var
|
|
4663
|
+
var _a2, _b;
|
|
4242
4664
|
if (!fx) return node;
|
|
4243
|
-
const copies = (
|
|
4665
|
+
const copies = (_a2 = fx.copies) != null ? _a2 : 1;
|
|
4244
4666
|
if (copies < 1) {
|
|
4245
4667
|
ctx.errors.push("repeater.copies invalid: " + fx.copies);
|
|
4246
4668
|
return node;
|
|
@@ -4307,11 +4729,11 @@ function synthesiseScale(raw, i) {
|
|
|
4307
4729
|
return mapAnimatable(raw, scalePower, true);
|
|
4308
4730
|
}
|
|
4309
4731
|
|
|
4310
|
-
// src/effects/retimeEffect.ts
|
|
4732
|
+
// src/effects/reference/retimeEffect.ts
|
|
4311
4733
|
var RETIME_MATERIALISATION_MODE_INLINE_G = false;
|
|
4312
4734
|
function asRetime(r) {
|
|
4313
|
-
var
|
|
4314
|
-
return { start: (
|
|
4735
|
+
var _a2, _b;
|
|
4736
|
+
return { start: (_a2 = r.start) != null ? _a2 : 0, stretch: (_b = r.stretch) != null ? _b : 1 };
|
|
4315
4737
|
}
|
|
4316
4738
|
var CROP_EDGE_MS = 1;
|
|
4317
4739
|
function applyTimeCrop(useNode, crop, ctx) {
|
|
@@ -4339,12 +4761,12 @@ function concatRetime(child, parent) {
|
|
|
4339
4761
|
};
|
|
4340
4762
|
}
|
|
4341
4763
|
function readCloneRetime(n) {
|
|
4342
|
-
var
|
|
4343
|
-
return (_b = (
|
|
4764
|
+
var _a2, _b;
|
|
4765
|
+
return (_b = (_a2 = n.effects) == null ? void 0 : _a2.clone) == null ? void 0 : _b.retime;
|
|
4344
4766
|
}
|
|
4345
4767
|
function clearCloneRetime(n) {
|
|
4346
|
-
var
|
|
4347
|
-
const clone2 = (
|
|
4768
|
+
var _a2;
|
|
4769
|
+
const clone2 = (_a2 = n.effects) == null ? void 0 : _a2.clone;
|
|
4348
4770
|
if (!clone2) return;
|
|
4349
4771
|
delete clone2.retime;
|
|
4350
4772
|
if (Object.keys(clone2).length === 0) delete n.effects.clone;
|
|
@@ -4355,9 +4777,9 @@ function applyAllRetimeEffects(root, ctx) {
|
|
|
4355
4777
|
indexById(root, ctx.idMap);
|
|
4356
4778
|
const sites = [];
|
|
4357
4779
|
const collect = (n) => {
|
|
4358
|
-
var
|
|
4780
|
+
var _a2;
|
|
4359
4781
|
if (readCloneRetime(n)) sites.push(n);
|
|
4360
|
-
(
|
|
4782
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach(collect);
|
|
4361
4783
|
};
|
|
4362
4784
|
collect(root);
|
|
4363
4785
|
const reachCount = /* @__PURE__ */ new Map();
|
|
@@ -4365,7 +4787,7 @@ function applyAllRetimeEffects(root, ctx) {
|
|
|
4365
4787
|
let count = 0;
|
|
4366
4788
|
const visited = /* @__PURE__ */ new Set();
|
|
4367
4789
|
const walk = (n) => {
|
|
4368
|
-
var
|
|
4790
|
+
var _a2;
|
|
4369
4791
|
if (!n) return;
|
|
4370
4792
|
if (n !== site && readCloneRetime(n)) count++;
|
|
4371
4793
|
if (n.type === "use" && n.href) {
|
|
@@ -4375,7 +4797,7 @@ function applyAllRetimeEffects(root, ctx) {
|
|
|
4375
4797
|
walk(ctx.idMap.get(id));
|
|
4376
4798
|
}
|
|
4377
4799
|
}
|
|
4378
|
-
(
|
|
4800
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach(walk);
|
|
4379
4801
|
};
|
|
4380
4802
|
const rootId = stripHash2(site.href);
|
|
4381
4803
|
if (rootId) {
|
|
@@ -4385,8 +4807,8 @@ function applyAllRetimeEffects(root, ctx) {
|
|
|
4385
4807
|
reachCount.set(site, count);
|
|
4386
4808
|
}
|
|
4387
4809
|
sites.sort((a, b) => {
|
|
4388
|
-
var
|
|
4389
|
-
return ((
|
|
4810
|
+
var _a2, _b;
|
|
4811
|
+
return ((_a2 = reachCount.get(b)) != null ? _a2 : 0) - ((_b = reachCount.get(a)) != null ? _b : 0);
|
|
4390
4812
|
});
|
|
4391
4813
|
for (const useNode of sites) {
|
|
4392
4814
|
const retime = readCloneRetime(useNode);
|
|
@@ -4453,7 +4875,7 @@ function buildChainClone(targetId, accum, ctx, chain) {
|
|
|
4453
4875
|
}
|
|
4454
4876
|
function materialiseNestedRetimeUses(node, accum, ctx, chain, parentTargetId) {
|
|
4455
4877
|
const visit = (n) => {
|
|
4456
|
-
var
|
|
4878
|
+
var _a2;
|
|
4457
4879
|
const retime = readCloneRetime(n);
|
|
4458
4880
|
if (n.type === "use" && retime && n.href) {
|
|
4459
4881
|
const subId = stripHash2(n.href);
|
|
@@ -4466,14 +4888,14 @@ function materialiseNestedRetimeUses(node, accum, ctx, chain, parentTargetId) {
|
|
|
4466
4888
|
}
|
|
4467
4889
|
clearCloneRetime(n);
|
|
4468
4890
|
}
|
|
4469
|
-
(
|
|
4891
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach(visit);
|
|
4470
4892
|
};
|
|
4471
4893
|
visit(node);
|
|
4472
4894
|
}
|
|
4473
4895
|
function remapKeyframeTimes(node, start, stretch) {
|
|
4474
|
-
var
|
|
4896
|
+
var _a2;
|
|
4475
4897
|
remapKeyframeTimesOnly(node, start, stretch);
|
|
4476
|
-
(
|
|
4898
|
+
(_a2 = node.children) == null ? void 0 : _a2.forEach((c) => remapKeyframeTimes(c, start, stretch));
|
|
4477
4899
|
}
|
|
4478
4900
|
function remapKeyframeTimesOnly(node, start, stretch) {
|
|
4479
4901
|
const remap2 = (kfs) => {
|
|
@@ -4490,7 +4912,7 @@ function remapKeyframeTimesOnly(node, start, stretch) {
|
|
|
4490
4912
|
}
|
|
4491
4913
|
}
|
|
4492
4914
|
|
|
4493
|
-
// src/effects/pathSampler.ts
|
|
4915
|
+
// src/effects/text/pathSampler.ts
|
|
4494
4916
|
var LUT_STEPS = 48;
|
|
4495
4917
|
var CMD_RE = /[MmLlHhVvCcSsQqTtAaZz]/;
|
|
4496
4918
|
function tokenize(d) {
|
|
@@ -4638,7 +5060,7 @@ function createPathSampler(d) {
|
|
|
4638
5060
|
};
|
|
4639
5061
|
}
|
|
4640
5062
|
|
|
4641
|
-
// src/effects/textPathEffect.ts
|
|
5063
|
+
// src/effects/text/textPathEffect.ts
|
|
4642
5064
|
var EXTEND_MARGIN_FRAC = 0.15;
|
|
4643
5065
|
function numRange(v) {
|
|
4644
5066
|
const read = readAnimatable(v);
|
|
@@ -4652,8 +5074,8 @@ function numRange(v) {
|
|
|
4652
5074
|
function estimateTextAdvance(node) {
|
|
4653
5075
|
let chars = 0, maxFont = 16;
|
|
4654
5076
|
const walk = (el) => {
|
|
4655
|
-
var
|
|
4656
|
-
const fs = parseFloat(String((
|
|
5077
|
+
var _a2, _b;
|
|
5078
|
+
const fs = parseFloat(String((_a2 = el.fontSize) != null ? _a2 : "")) || 0;
|
|
4657
5079
|
if (fs) maxFont = Math.max(maxFont, fs);
|
|
4658
5080
|
const t = (_b = el.text) != null ? _b : el.textContent;
|
|
4659
5081
|
if (typeof t === "string") chars += t.length;
|
|
@@ -4677,14 +5099,14 @@ function shiftAnimatable(v, by) {
|
|
|
4677
5099
|
return out;
|
|
4678
5100
|
}
|
|
4679
5101
|
function extendedPathForBrowser(pathD, opts) {
|
|
4680
|
-
var
|
|
5102
|
+
var _a2;
|
|
4681
5103
|
if (opts.pathOverflow === "clip") return { d: pathD, startShift: 0 };
|
|
4682
5104
|
const sampler = createPathSampler(pathD);
|
|
4683
5105
|
if (!sampler || sampler.closed || sampler.totalLength <= 0) return { d: pathD, startShift: 0 };
|
|
4684
5106
|
const L = sampler.totalLength;
|
|
4685
5107
|
const margin = EXTEND_MARGIN_FRAC * L;
|
|
4686
5108
|
const so = numRange(opts.startOffset);
|
|
4687
|
-
const runWidth = numRange(opts.textLength).max || ((
|
|
5109
|
+
const runWidth = numRange(opts.textLength).max || ((_a2 = opts.advance) != null ? _a2 : 0);
|
|
4688
5110
|
const startOverflow = Math.max(0, -so.min);
|
|
4689
5111
|
const endOverflow = Math.max(0, so.max + runWidth - L);
|
|
4690
5112
|
const startExt = startOverflow > 0 ? startOverflow + margin : 0;
|
|
@@ -4705,10 +5127,10 @@ function extendedPathForBrowser(pathD, opts) {
|
|
|
4705
5127
|
return { d, startShift: startExt };
|
|
4706
5128
|
}
|
|
4707
5129
|
function applyTextPathEffect(node, fx, ctx) {
|
|
4708
|
-
var
|
|
4709
|
-
if (!fx || typeof fx.
|
|
5130
|
+
var _a2;
|
|
5131
|
+
if (!fx || typeof fx.pathData !== "string" || !fx.pathData) return node;
|
|
4710
5132
|
const pathId = genId(ctx, "tpath");
|
|
4711
|
-
const { d, startShift } = extendedPathForBrowser(fx.
|
|
5133
|
+
const { d, startShift } = extendedPathForBrowser(fx.pathData, {
|
|
4712
5134
|
pathOverflow: fx.pathOverflow,
|
|
4713
5135
|
startOffset: fx.startOffset,
|
|
4714
5136
|
textLength: fx.textLength,
|
|
@@ -4718,7 +5140,7 @@ function applyTextPathEffect(node, fx, ctx) {
|
|
|
4718
5140
|
const textPath = {
|
|
4719
5141
|
type: "textPath",
|
|
4720
5142
|
href: "#" + pathId,
|
|
4721
|
-
children: (
|
|
5143
|
+
children: (_a2 = node.children) != null ? _a2 : []
|
|
4722
5144
|
};
|
|
4723
5145
|
if (fx.lengthAdjust !== void 0) textPath.lengthAdjust = fx.lengthAdjust;
|
|
4724
5146
|
if (fx.method !== void 0) textPath.method = fx.method;
|
|
@@ -4733,7 +5155,7 @@ function applyAnimatableNumber(node, attrName, raw) {
|
|
|
4733
5155
|
writeAnimatableChannel(node, attrName, readAnimatable(raw), { asString: true });
|
|
4734
5156
|
}
|
|
4735
5157
|
|
|
4736
|
-
// src/effects/elementFactory.ts
|
|
5158
|
+
// src/effects/text/elementFactory.ts
|
|
4737
5159
|
var jsonElementFactory = (type, props, children) => {
|
|
4738
5160
|
const node = { type };
|
|
4739
5161
|
for (const k in props) if (props[k] !== void 0) node[k] = props[k];
|
|
@@ -4742,7 +5164,7 @@ var jsonElementFactory = (type, props, children) => {
|
|
|
4742
5164
|
return node;
|
|
4743
5165
|
};
|
|
4744
5166
|
|
|
4745
|
-
// src/effects/glyphPathBake.ts
|
|
5167
|
+
// src/effects/text/glyphPathBake.ts
|
|
4746
5168
|
function fmt(v, decimals) {
|
|
4747
5169
|
return Math.round(v) === v ? "" + Math.round(v) : v.toFixed(decimals);
|
|
4748
5170
|
}
|
|
@@ -4788,7 +5210,7 @@ function transformPathData(d, m, decimals = 2) {
|
|
|
4788
5210
|
return out;
|
|
4789
5211
|
}
|
|
4790
5212
|
|
|
4791
|
-
// src/effects/textGlyphsEffect.ts
|
|
5213
|
+
// src/effects/text/textGlyphsEffect.ts
|
|
4792
5214
|
var DEFAULT_FONT_SIZE = 16;
|
|
4793
5215
|
var TEXT_ATTR_KEYS = [
|
|
4794
5216
|
"fontFamily",
|
|
@@ -4848,15 +5270,15 @@ function paintAnimateOf(node) {
|
|
|
4848
5270
|
return out;
|
|
4849
5271
|
}
|
|
4850
5272
|
function resolveStyle2(node, parent) {
|
|
4851
|
-
var
|
|
5273
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4852
5274
|
const isTextRoot = node.type === "text";
|
|
4853
5275
|
const nodeStyle = node.style;
|
|
4854
5276
|
const own = (key) => {
|
|
4855
|
-
var
|
|
4856
|
-
return isTextRoot ? void 0 : (
|
|
5277
|
+
var _a3;
|
|
5278
|
+
return isTextRoot ? void 0 : (_a3 = node[key]) != null ? _a3 : nodeStyle == null ? void 0 : nodeStyle[key];
|
|
4857
5279
|
};
|
|
4858
5280
|
const res = {
|
|
4859
|
-
fontFamily: (
|
|
5281
|
+
fontFamily: (_a2 = str(node.fontFamily)) != null ? _a2 : parent.fontFamily,
|
|
4860
5282
|
fontSize: (_b = parseLen(node.fontSize)) != null ? _b : parent.fontSize,
|
|
4861
5283
|
fill: (_c = node.fill) != null ? _c : parent.fill,
|
|
4862
5284
|
stroke: (_d = node.stroke) != null ? _d : parent.stroke,
|
|
@@ -4873,10 +5295,10 @@ function resolveStyle2(node, parent) {
|
|
|
4873
5295
|
return res;
|
|
4874
5296
|
}
|
|
4875
5297
|
function rootStyleOf(node) {
|
|
4876
|
-
var
|
|
5298
|
+
var _a2, _b, _c;
|
|
4877
5299
|
return {
|
|
4878
5300
|
fontFamily: str(node.fontFamily),
|
|
4879
|
-
fontSize: (
|
|
5301
|
+
fontSize: (_a2 = parseLen(node.fontSize)) != null ? _a2 : DEFAULT_FONT_SIZE,
|
|
4880
5302
|
fill: node.fill,
|
|
4881
5303
|
stroke: node.stroke,
|
|
4882
5304
|
strokeWidth: node.strokeWidth,
|
|
@@ -4897,9 +5319,9 @@ function paintOf(s) {
|
|
|
4897
5319
|
return p;
|
|
4898
5320
|
}
|
|
4899
5321
|
function glyphFontFor(s, glyphs, soleFont, warnings) {
|
|
4900
|
-
var
|
|
5322
|
+
var _a2;
|
|
4901
5323
|
const gf = s.fontFamily ? glyphs[s.fontFamily] : soleFont;
|
|
4902
|
-
if (!gf) warnings == null ? void 0 : warnings.push('textGlyphs: no glyphs for font "' + ((
|
|
5324
|
+
if (!gf) warnings == null ? void 0 : warnings.push('textGlyphs: no glyphs for font "' + ((_a2 = s.fontFamily) != null ? _a2 : "") + '"');
|
|
4903
5325
|
return gf;
|
|
4904
5326
|
}
|
|
4905
5327
|
function soleFontOf(glyphs) {
|
|
@@ -4921,19 +5343,19 @@ function missingGlyphBoxEm(advanceEm, ascentEm) {
|
|
|
4921
5343
|
return outer + "M" + ix0 + " " + iyb + "L" + ix0 + " " + iyt + "L" + ix1 + " " + iyt + "L" + ix1 + " " + iyb + "Z";
|
|
4922
5344
|
}
|
|
4923
5345
|
function materialiseGlyphTextHorizontal(node, opts) {
|
|
4924
|
-
var
|
|
5346
|
+
var _a2, _b, _c, _d;
|
|
4925
5347
|
const { glyphs, create = jsonElementFactory, warnings } = opts;
|
|
4926
5348
|
const soleFont = soleFontOf(glyphs);
|
|
4927
|
-
const pen = { x: (
|
|
5349
|
+
const pen = { x: (_a2 = parseLen(node.x)) != null ? _a2 : 0, y: (_b = parseLen(node.y)) != null ? _b : 0 };
|
|
4928
5350
|
const placements = [];
|
|
4929
5351
|
const lines = [{ start: pen.x, end: pen.x }];
|
|
4930
5352
|
let line = 0;
|
|
4931
5353
|
const renderChars = (content, s) => {
|
|
4932
|
-
var
|
|
5354
|
+
var _a3;
|
|
4933
5355
|
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
4934
5356
|
const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
|
|
4935
5357
|
const scale = s.fontSize / upm;
|
|
4936
|
-
const ascentEm = (
|
|
5358
|
+
const ascentEm = (_a3 = gf == null ? void 0 : gf.ascent) != null ? _a3 : 0.9 * upm;
|
|
4937
5359
|
const paint = paintOf(s);
|
|
4938
5360
|
for (let i = 0; i < content.length; i++) {
|
|
4939
5361
|
const ch = content.charAt(i);
|
|
@@ -4953,7 +5375,7 @@ function materialiseGlyphTextHorizontal(node, opts) {
|
|
|
4953
5375
|
}
|
|
4954
5376
|
};
|
|
4955
5377
|
const walk = (el, parentStyle) => {
|
|
4956
|
-
var
|
|
5378
|
+
var _a3, _b2, _c2, _d2;
|
|
4957
5379
|
const s = resolveStyle2(el, parentStyle);
|
|
4958
5380
|
const x = parseLen(el.x);
|
|
4959
5381
|
const y = parseLen(el.y);
|
|
@@ -4963,7 +5385,7 @@ function materialiseGlyphTextHorizontal(node, opts) {
|
|
|
4963
5385
|
lines.push({ start: pen.x, end: pen.x });
|
|
4964
5386
|
}
|
|
4965
5387
|
if (y !== void 0) pen.y = y;
|
|
4966
|
-
pen.x += (
|
|
5388
|
+
pen.x += (_a3 = parseLen(el.dx)) != null ? _a3 : 0;
|
|
4967
5389
|
pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
|
|
4968
5390
|
const content = (_c2 = str(el[TEXT_CONTENT_ATTR])) != null ? _c2 : str(el[TEXT_ATTR]);
|
|
4969
5391
|
if (content && !((_d2 = el.children) == null ? void 0 : _d2.length)) renderChars(content, s);
|
|
@@ -4984,8 +5406,8 @@ function materialiseGlyphTextHorizontal(node, opts) {
|
|
|
4984
5406
|
return toGroup(node, buildPaths(placements, create, warnings), create);
|
|
4985
5407
|
}
|
|
4986
5408
|
function layoutGlyphTextChars(node, opts) {
|
|
4987
|
-
var
|
|
4988
|
-
if ((
|
|
5409
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
5410
|
+
if ((_a2 = opts.alongPath) == null ? void 0 : _a2.pathD) return layoutGlyphTextCharsAlongPath(node, opts.alongPath.pathD, opts);
|
|
4989
5411
|
const { glyphs, warnings } = opts;
|
|
4990
5412
|
const soleFont = soleFontOf(glyphs);
|
|
4991
5413
|
const pen = { x: (_b = parseLen(node.x)) != null ? _b : 0, y: (_c = parseLen(node.y)) != null ? _c : 0 };
|
|
@@ -4993,11 +5415,11 @@ function layoutGlyphTextChars(node, opts) {
|
|
|
4993
5415
|
const lines = [{ start: pen.x, end: pen.x }];
|
|
4994
5416
|
let line = 0;
|
|
4995
5417
|
const renderChars = (content, s) => {
|
|
4996
|
-
var
|
|
5418
|
+
var _a3;
|
|
4997
5419
|
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
4998
5420
|
const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
|
|
4999
5421
|
const scale = s.fontSize / upm;
|
|
5000
|
-
const ascent = ((
|
|
5422
|
+
const ascent = ((_a3 = gf == null ? void 0 : gf.ascent) != null ? _a3 : 0.9 * upm) * scale;
|
|
5001
5423
|
for (let i = 0; i < content.length; i++) {
|
|
5002
5424
|
const ch = content.charAt(i);
|
|
5003
5425
|
const g = gf == null ? void 0 : gf.glyphs[ch];
|
|
@@ -5008,7 +5430,7 @@ function layoutGlyphTextChars(node, opts) {
|
|
|
5008
5430
|
}
|
|
5009
5431
|
};
|
|
5010
5432
|
const walk = (el, parentStyle) => {
|
|
5011
|
-
var
|
|
5433
|
+
var _a3, _b2, _c2, _d2;
|
|
5012
5434
|
const s = resolveStyle2(el, parentStyle);
|
|
5013
5435
|
const x = parseLen(el.x);
|
|
5014
5436
|
const y = parseLen(el.y);
|
|
@@ -5018,7 +5440,7 @@ function layoutGlyphTextChars(node, opts) {
|
|
|
5018
5440
|
lines.push({ start: pen.x, end: pen.x });
|
|
5019
5441
|
}
|
|
5020
5442
|
if (y !== void 0) pen.y = y;
|
|
5021
|
-
pen.x += (
|
|
5443
|
+
pen.x += (_a3 = parseLen(el.dx)) != null ? _a3 : 0;
|
|
5022
5444
|
pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
|
|
5023
5445
|
const content = (_c2 = str(el[TEXT_CONTENT_ATTR])) != null ? _c2 : str(el[TEXT_ATTR]);
|
|
5024
5446
|
if (content && !((_d2 = el.children) == null ? void 0 : _d2.length)) renderChars(content, s);
|
|
@@ -5050,7 +5472,7 @@ function layoutGlyphTextChars(node, opts) {
|
|
|
5050
5472
|
});
|
|
5051
5473
|
}
|
|
5052
5474
|
function layoutGlyphTextCharsAlongPath(node, pathD, opts) {
|
|
5053
|
-
var
|
|
5475
|
+
var _a2, _b;
|
|
5054
5476
|
const { glyphs, warnings, alongPath } = opts;
|
|
5055
5477
|
const sampler = createPathSampler(pathD);
|
|
5056
5478
|
if (!sampler) {
|
|
@@ -5061,9 +5483,9 @@ function layoutGlyphTextCharsAlongPath(node, pathD, opts) {
|
|
|
5061
5483
|
const chars = [];
|
|
5062
5484
|
let adv = 0;
|
|
5063
5485
|
const walk = (el, parentStyle) => {
|
|
5064
|
-
var
|
|
5486
|
+
var _a3, _b2, _c;
|
|
5065
5487
|
const s = resolveStyle2(el, parentStyle);
|
|
5066
|
-
const content = (
|
|
5488
|
+
const content = (_a3 = str(el[TEXT_CONTENT_ATTR])) != null ? _a3 : str(el[TEXT_ATTR]);
|
|
5067
5489
|
if (content && !((_b2 = el.children) == null ? void 0 : _b2.length)) {
|
|
5068
5490
|
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
5069
5491
|
const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
|
|
@@ -5083,7 +5505,7 @@ function layoutGlyphTextCharsAlongPath(node, pathD, opts) {
|
|
|
5083
5505
|
walk(node, rootStyleOf(node));
|
|
5084
5506
|
const width = adv;
|
|
5085
5507
|
const tlr = readAnimatable(alongPath == null ? void 0 : alongPath.textLength);
|
|
5086
|
-
const tlv = tlr.kind === "animated" /* Animated */ ? Number((
|
|
5508
|
+
const tlv = tlr.kind === "animated" /* Animated */ ? Number((_a2 = tlr.keyframes[0]) == null ? void 0 : _a2.value) || 0 : tlr.kind === "static" /* Static */ ? Number(tlr.value) || 0 : 0;
|
|
5087
5509
|
const k = tlv > 0 && width > 0 ? tlv / width : 1;
|
|
5088
5510
|
const so = readAnimatable(alongPath == null ? void 0 : alongPath.startOffset);
|
|
5089
5511
|
const { along: alongOffset, perp } = alongPathNodeOffsets(node);
|
|
@@ -5115,9 +5537,9 @@ function collectAlongPathCells(node, glyphs, soleFont, warnings) {
|
|
|
5115
5537
|
const cells = [];
|
|
5116
5538
|
let adv = 0;
|
|
5117
5539
|
const walk = (el, parentStyle) => {
|
|
5118
|
-
var
|
|
5540
|
+
var _a2, _b, _c;
|
|
5119
5541
|
const s = resolveStyle2(el, parentStyle);
|
|
5120
|
-
const content = (
|
|
5542
|
+
const content = (_a2 = str(el[TEXT_CONTENT_ATTR])) != null ? _a2 : str(el[TEXT_ATTR]);
|
|
5121
5543
|
if (content && !((_b = el.children) == null ? void 0 : _b.length)) {
|
|
5122
5544
|
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
5123
5545
|
if (gf) {
|
|
@@ -5154,9 +5576,9 @@ function alongAffine(sampler, dist, scale, widthEm, perp = 0) {
|
|
|
5154
5576
|
return [scale * cos, scale * sin, -scale * sin, scale * cos, x - scale * cos * hw - perp * sin, y - scale * sin * hw + perp * cos];
|
|
5155
5577
|
}
|
|
5156
5578
|
function alongPathNodeOffsets(node) {
|
|
5157
|
-
var
|
|
5579
|
+
var _a2, _b, _c;
|
|
5158
5580
|
return {
|
|
5159
|
-
along: ((
|
|
5581
|
+
along: ((_a2 = parseLen(node.x)) != null ? _a2 : 0) + ((_b = parseLen(node.dx)) != null ? _b : 0),
|
|
5160
5582
|
perp: (_c = parseLen(node.dy)) != null ? _c : 0
|
|
5161
5583
|
};
|
|
5162
5584
|
}
|
|
@@ -5196,7 +5618,7 @@ function materialiseGlyphTextAlongPath(node, pathD, startOffset, opts, textLengt
|
|
|
5196
5618
|
return toGroup(node, buildPaths(placements, create, warnings), create);
|
|
5197
5619
|
}
|
|
5198
5620
|
function numTrackOf(raw) {
|
|
5199
|
-
var
|
|
5621
|
+
var _a2;
|
|
5200
5622
|
const r = readAnimatable(raw);
|
|
5201
5623
|
if (r.kind === "animated" /* Animated */ && r.keyframes.length >= 2) {
|
|
5202
5624
|
const kfs = [...r.keyframes].sort((k1, k2) => (Number(k1.time) || 0) - (Number(k2.time) || 0));
|
|
@@ -5219,7 +5641,7 @@ function numTrackOf(raw) {
|
|
|
5219
5641
|
}
|
|
5220
5642
|
};
|
|
5221
5643
|
}
|
|
5222
|
-
const v = r.kind === "animated" /* Animated */ ? Number((
|
|
5644
|
+
const v = r.kind === "animated" /* Animated */ ? Number((_a2 = r.keyframes[0]) == null ? void 0 : _a2.value) || 0 : r.kind === "static" /* Static */ ? Number(r.value) || 0 : 0;
|
|
5223
5645
|
return { animated: false, times: [], at: () => v };
|
|
5224
5646
|
}
|
|
5225
5647
|
function mergeTrackTimes(a, b) {
|
|
@@ -5295,7 +5717,7 @@ function paintProps(paint) {
|
|
|
5295
5717
|
return p;
|
|
5296
5718
|
}
|
|
5297
5719
|
function missingGlyphProps(isMissing) {
|
|
5298
|
-
return isMissing ? {
|
|
5720
|
+
return isMissing ? { [CLASS_ATTR]: MISSING_GLYPH_CLASS_NAME } : {};
|
|
5299
5721
|
}
|
|
5300
5722
|
function buildPaths(placements, create, warnings) {
|
|
5301
5723
|
if (!placements.length) {
|
|
@@ -5339,20 +5761,20 @@ function materialiseGlyphText(node, opts) {
|
|
|
5339
5761
|
function applyTextGlyphsEffect(node, fx, ctx) {
|
|
5340
5762
|
if (!(fx == null ? void 0 : fx.useGlyphs)) return node;
|
|
5341
5763
|
if (!ctx.glyphs) {
|
|
5342
|
-
ctx.warnings.push("textGlyphs: no definitions.
|
|
5764
|
+
ctx.warnings.push("textGlyphs: no definitions.fonts \u2014 left as native <text>");
|
|
5343
5765
|
return node;
|
|
5344
5766
|
}
|
|
5345
5767
|
return materialiseGlyphTextHorizontal(node, { glyphs: ctx.glyphs, warnings: ctx.warnings });
|
|
5346
5768
|
}
|
|
5347
5769
|
function applyTextGlyphsAlongPath(node, ctx, pathD, startOffset, textLength, pathOverflow) {
|
|
5348
5770
|
if (!ctx.glyphs) {
|
|
5349
|
-
ctx.warnings.push("textGlyphs: no definitions.
|
|
5771
|
+
ctx.warnings.push("textGlyphs: no definitions.fonts");
|
|
5350
5772
|
return null;
|
|
5351
5773
|
}
|
|
5352
5774
|
return materialiseGlyphTextAlongPath(node, pathD, startOffset, { glyphs: ctx.glyphs, warnings: ctx.warnings }, textLength, pathOverflow);
|
|
5353
5775
|
}
|
|
5354
5776
|
|
|
5355
|
-
// src/effects/strokeTrimEffect.ts
|
|
5777
|
+
// src/effects/stroke/strokeTrimEffect.ts
|
|
5356
5778
|
function applyStrokeTrimEffect(node, strokeTrim, ctx) {
|
|
5357
5779
|
if (!strokeTrim) return node;
|
|
5358
5780
|
const combined = strokeTrim.subPaths === PxStrokeTrimSubPaths.combined;
|
|
@@ -5488,12 +5910,11 @@ function getOffsetIndexRange(minMaxOffset) {
|
|
|
5488
5910
|
];
|
|
5489
5911
|
}
|
|
5490
5912
|
function readScalarValues(r) {
|
|
5491
|
-
var _a;
|
|
5492
5913
|
if (r.kind === "absent" /* Absent */) return [];
|
|
5493
5914
|
if (r.kind === "static" /* Static */) return [r.value];
|
|
5494
5915
|
const out = [];
|
|
5495
5916
|
for (const kf of r.keyframes) {
|
|
5496
|
-
const v = (
|
|
5917
|
+
const v = kfValue(kf);
|
|
5497
5918
|
if (typeof v === "number") out.push(v);
|
|
5498
5919
|
}
|
|
5499
5920
|
return out;
|
|
@@ -5503,14 +5924,11 @@ function computeAnimAttr(read, map) {
|
|
|
5503
5924
|
if (read.kind === "static" /* Static */) return { kind: "static" /* Static */, value: map(read.value) };
|
|
5504
5925
|
return {
|
|
5505
5926
|
kind: "animated" /* Animated */,
|
|
5506
|
-
keyframes: read.keyframes.map((kf) => {
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
easing: (_d = kf.easing) != null ? _d : kf.e
|
|
5512
|
-
};
|
|
5513
|
-
}),
|
|
5927
|
+
keyframes: read.keyframes.map((kf) => ({
|
|
5928
|
+
time: kfTime(kf),
|
|
5929
|
+
value: map(kfValue(kf)),
|
|
5930
|
+
easing: kfEasing(kf)
|
|
5931
|
+
})),
|
|
5514
5932
|
loop: read.loop
|
|
5515
5933
|
};
|
|
5516
5934
|
}
|
|
@@ -5520,7 +5938,6 @@ function applyAttr(node, attrName, attr) {
|
|
|
5520
5938
|
}
|
|
5521
5939
|
var OPACITY_STEP_MS = 10;
|
|
5522
5940
|
function computeOpacityFromRange(rangeRead) {
|
|
5523
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5524
5941
|
const hide = (v) => v[0] === v[1];
|
|
5525
5942
|
if (rangeRead.kind === "absent" /* Absent */) return void 0;
|
|
5526
5943
|
if (rangeRead.kind === "static" /* Static */) return hide(rangeRead.value) ? { kind: "static" /* Static */, value: 0 } : void 0;
|
|
@@ -5528,7 +5945,7 @@ function computeOpacityFromRange(rangeRead) {
|
|
|
5528
5945
|
let anyHide = false;
|
|
5529
5946
|
let allHide = true;
|
|
5530
5947
|
for (const kf of kfs) {
|
|
5531
|
-
if (hide((
|
|
5948
|
+
if (hide(kfValue(kf))) anyHide = true;
|
|
5532
5949
|
else allHide = false;
|
|
5533
5950
|
}
|
|
5534
5951
|
if (!anyHide) return void 0;
|
|
@@ -5538,10 +5955,10 @@ function computeOpacityFromRange(rangeRead) {
|
|
|
5538
5955
|
const kf = kfs[i];
|
|
5539
5956
|
const prevKf = i > 0 ? kfs[i - 1] : void 0;
|
|
5540
5957
|
const nextKf = i < kfs.length - 1 ? kfs[i + 1] : void 0;
|
|
5541
|
-
const t = (
|
|
5542
|
-
const thisHide = hide((
|
|
5543
|
-
const prevHide = prevKf ? thisHide && hide((
|
|
5544
|
-
const nextHide = nextKf ? thisHide && hide((
|
|
5958
|
+
const t = kfTime(kf);
|
|
5959
|
+
const thisHide = hide(kfValue(kf));
|
|
5960
|
+
const prevHide = prevKf ? thisHide && hide(kfValue(prevKf)) : thisHide;
|
|
5961
|
+
const nextHide = nextKf ? thisHide && hide(kfValue(nextKf)) : thisHide;
|
|
5545
5962
|
if (prevHide && !nextHide) {
|
|
5546
5963
|
out.push({ time: t, value: 0 });
|
|
5547
5964
|
out.push({ time: t + OPACITY_STEP_MS, value: 1 });
|
|
@@ -5556,14 +5973,11 @@ function computeOpacityFromRange(rangeRead) {
|
|
|
5556
5973
|
function readRangeWithCrossings(raw) {
|
|
5557
5974
|
const r = readAnimatable(raw);
|
|
5558
5975
|
if (r.kind !== "animated" /* Animated */) return r;
|
|
5559
|
-
const kfs = r.keyframes.map((kf) => {
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
easing: (_d = kf.easing) != null ? _d : kf.e
|
|
5565
|
-
};
|
|
5566
|
-
});
|
|
5976
|
+
const kfs = r.keyframes.map((kf) => ({
|
|
5977
|
+
time: kfTime(kf),
|
|
5978
|
+
value: kfValue(kf),
|
|
5979
|
+
easing: kfEasing(kf)
|
|
5980
|
+
}));
|
|
5567
5981
|
const hasReverse = kfs.some((kf) => kf.value[0] > kf.value[1]);
|
|
5568
5982
|
if (!hasReverse) {
|
|
5569
5983
|
return {
|
|
@@ -5660,20 +6074,20 @@ function pxBezierPathLength(path) {
|
|
|
5660
6074
|
return total;
|
|
5661
6075
|
}
|
|
5662
6076
|
function segmentLength(path, from, to) {
|
|
5663
|
-
var
|
|
6077
|
+
var _a2, _b, _c, _d;
|
|
5664
6078
|
const v = path.v;
|
|
5665
6079
|
const p0 = v[from];
|
|
5666
6080
|
const p3 = v[to];
|
|
5667
|
-
const p1 = (_b = (
|
|
6081
|
+
const p1 = (_b = (_a2 = path.o) == null ? void 0 : _a2[from]) != null ? _b : p0;
|
|
5668
6082
|
const p2 = (_d = (_c = path.i) == null ? void 0 : _c[to]) != null ? _d : p3;
|
|
5669
6083
|
const lut = bezier2D_arcLengthLUT(p0, p1, p2, p3);
|
|
5670
6084
|
return lut.ds[lut.ds.length - 1];
|
|
5671
6085
|
}
|
|
5672
6086
|
var ARC_KAPPA = 0.5522847498307936;
|
|
5673
6087
|
function shapeToPathD(node) {
|
|
5674
|
-
var
|
|
6088
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
5675
6089
|
if (node.type === "rect") {
|
|
5676
|
-
const x = Number((
|
|
6090
|
+
const x = Number((_a2 = node.x) != null ? _a2 : 0), y = Number((_b = node.y) != null ? _b : 0);
|
|
5677
6091
|
const w = Number((_c = node.width) != null ? _c : 0), h = Number((_d = node.height) != null ? _d : 0);
|
|
5678
6092
|
return "M" + (x + w) + "," + y + "L" + (x + w) + "," + (y + h) + "L" + x + "," + (y + h) + "L" + x + "," + y + "L" + (x + w) + "," + y + "z";
|
|
5679
6093
|
}
|
|
@@ -5691,7 +6105,7 @@ function shapeToPathD(node) {
|
|
|
5691
6105
|
|
|
5692
6106
|
// src/effects/PlayerEffectsUtil.ts
|
|
5693
6107
|
function applyPlayerEffects(root) {
|
|
5694
|
-
var
|
|
6108
|
+
var _a2, _b;
|
|
5695
6109
|
const ctx = {
|
|
5696
6110
|
defs: [],
|
|
5697
6111
|
warnings: [],
|
|
@@ -5702,8 +6116,8 @@ function applyPlayerEffects(root) {
|
|
|
5702
6116
|
maskAncestorChains: /* @__PURE__ */ new Map(),
|
|
5703
6117
|
// Resolved engine: `frames` ONLY when explicitly set; auto/waapi/unset →
|
|
5704
6118
|
// waapi (we're not 100% sure it's frames, and CSS/WAAPI need the inline form).
|
|
5705
|
-
engine: ((
|
|
5706
|
-
glyphs: (_b = getDefs(root)) == null ? void 0 : _b.
|
|
6119
|
+
engine: resolveTimelineEngine((_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.engine),
|
|
6120
|
+
glyphs: (_b = getDefs(root)) == null ? void 0 : _b.fonts
|
|
5707
6121
|
};
|
|
5708
6122
|
const working = clone(root);
|
|
5709
6123
|
indexById(working, ctx.idMap);
|
|
@@ -5726,7 +6140,7 @@ function applyPlayerEffects_exceptRetime(node, ctx) {
|
|
|
5726
6140
|
let consumedByGlyphs = false;
|
|
5727
6141
|
if (text == null ? void 0 : text.useGlyphs) {
|
|
5728
6142
|
if (textPath) {
|
|
5729
|
-
const pathD = typeof textPath.
|
|
6143
|
+
const pathD = typeof textPath.pathData === "string" ? textPath.pathData : void 0;
|
|
5730
6144
|
const glyphed = applyTextGlyphsAlongPath(n, ctx, pathD, textPath.startOffset, textPath.textLength, textPath.pathOverflow);
|
|
5731
6145
|
if (glyphed) {
|
|
5732
6146
|
n = glyphed;
|
|
@@ -5759,27 +6173,7 @@ function applyPlayerEffects_retime(node, ctx) {
|
|
|
5759
6173
|
return node;
|
|
5760
6174
|
}
|
|
5761
6175
|
|
|
5762
|
-
// src/PxOffsetPathMaterialiser.ts
|
|
5763
|
-
var kfTime = (kf) => {
|
|
5764
|
-
var _a, _b;
|
|
5765
|
-
return (_b = (_a = kf.t) != null ? _a : kf.time) != null ? _b : 0;
|
|
5766
|
-
};
|
|
5767
|
-
var kfValue = (kf) => {
|
|
5768
|
-
var _a;
|
|
5769
|
-
return (_a = kf.v) != null ? _a : kf.value;
|
|
5770
|
-
};
|
|
5771
|
-
var kfEasing = (kf) => {
|
|
5772
|
-
var _a;
|
|
5773
|
-
return (_a = kf.e) != null ? _a : kf.easing;
|
|
5774
|
-
};
|
|
5775
|
-
var kfTangentIn = (kf) => {
|
|
5776
|
-
var _a;
|
|
5777
|
-
return (_a = kf.tangentIn) != null ? _a : kf.ti;
|
|
5778
|
-
};
|
|
5779
|
-
var kfTangentOut = (kf) => {
|
|
5780
|
-
var _a;
|
|
5781
|
-
return (_a = kf.tangentOut) != null ? _a : kf.to;
|
|
5782
|
-
};
|
|
6176
|
+
// src/materialise/PxOffsetPathMaterialiser.ts
|
|
5783
6177
|
function cubicAt(p0, c1, c2, p1, t) {
|
|
5784
6178
|
const u = 1 - t;
|
|
5785
6179
|
const a = u * u * u, b = 3 * u * u * t, c = 3 * u * t * t, d = t * t * t;
|
|
@@ -5803,7 +6197,7 @@ var fmt2 = (n) => {
|
|
|
5803
6197
|
return Object.is(r, -0) ? "0" : String(r);
|
|
5804
6198
|
};
|
|
5805
6199
|
function buildOffsetPath(propAnim) {
|
|
5806
|
-
var
|
|
6200
|
+
var _a2, _b, _c;
|
|
5807
6201
|
if (propAnim.alongPathMode !== "offsetPath") return void 0;
|
|
5808
6202
|
const kfs = propAnim.keyframes;
|
|
5809
6203
|
if (!kfs || kfs.length < 2) return void 0;
|
|
@@ -5816,7 +6210,7 @@ function buildOffsetPath(propAnim) {
|
|
|
5816
6210
|
if (!tr || tr.length < 2) return void 0;
|
|
5817
6211
|
const parts = Object.keys(v);
|
|
5818
6212
|
if (parts.some((p) => p !== "translate" && p !== "origin")) return void 0;
|
|
5819
|
-
const o = (
|
|
6213
|
+
const o = (_a2 = v == null ? void 0 : v.origin) != null ? _a2 : [0, 0];
|
|
5820
6214
|
if (o[0] !== anchor[0] || o[1] !== anchor[1]) return void 0;
|
|
5821
6215
|
points.push([tr[0] + anchor[0], tr[1] + anchor[1]]);
|
|
5822
6216
|
}
|
|
@@ -5847,7 +6241,7 @@ function buildOffsetPath(propAnim) {
|
|
|
5847
6241
|
}
|
|
5848
6242
|
function materialiseOffsetPathsInTree(root) {
|
|
5849
6243
|
const walk = (node) => {
|
|
5850
|
-
var
|
|
6244
|
+
var _a2;
|
|
5851
6245
|
let out = node;
|
|
5852
6246
|
const anim = node.animate;
|
|
5853
6247
|
const transform = anim == null ? void 0 : anim["transform"];
|
|
@@ -5855,16 +6249,16 @@ function materialiseOffsetPathsInTree(root) {
|
|
|
5855
6249
|
const built = buildOffsetPath(transform);
|
|
5856
6250
|
if (built) {
|
|
5857
6251
|
const newAnimate = __spreadValues({}, anim);
|
|
5858
|
-
delete newAnimate[
|
|
6252
|
+
delete newAnimate[TRANSFORM_ATTR];
|
|
5859
6253
|
const distance = { keyframes: built.distanceKfs };
|
|
5860
6254
|
if (transform.loop !== void 0) distance.loop = transform.loop;
|
|
5861
|
-
newAnimate[
|
|
6255
|
+
newAnimate[OFFSET_DISTANCE_ATTR] = distance;
|
|
5862
6256
|
const staticTr = node.transform;
|
|
5863
6257
|
let newTransform = staticTr;
|
|
5864
6258
|
if (staticTr && typeof staticTr === "object") {
|
|
5865
6259
|
const t = __spreadValues({}, staticTr);
|
|
5866
|
-
delete t[
|
|
5867
|
-
delete t[
|
|
6260
|
+
delete t[TRANSFORM_PART.translate];
|
|
6261
|
+
delete t[TRANSFORM_PART.origin];
|
|
5868
6262
|
newTransform = Object.keys(t).length ? t : void 0;
|
|
5869
6263
|
}
|
|
5870
6264
|
out = __spreadProps(__spreadValues({}, node), {
|
|
@@ -5880,7 +6274,7 @@ function materialiseOffsetPathsInTree(root) {
|
|
|
5880
6274
|
else delete out.transform;
|
|
5881
6275
|
}
|
|
5882
6276
|
}
|
|
5883
|
-
if ((
|
|
6277
|
+
if ((_a2 = out.children) == null ? void 0 : _a2.length) {
|
|
5884
6278
|
const children = out.children.map(walk);
|
|
5885
6279
|
if (children.some((c, i) => c !== out.children[i])) out = __spreadProps(__spreadValues({}, out), { children });
|
|
5886
6280
|
}
|
|
@@ -5889,14 +6283,14 @@ function materialiseOffsetPathsInTree(root) {
|
|
|
5889
6283
|
return walk(root);
|
|
5890
6284
|
}
|
|
5891
6285
|
|
|
5892
|
-
// src/PxAnimatorMaterialiseAll.ts
|
|
6286
|
+
// src/materialise/PxAnimatorMaterialiseAll.ts
|
|
5893
6287
|
function materialiseAllInTree(doc, engine, opts) {
|
|
5894
|
-
var
|
|
6288
|
+
var _a2, _b;
|
|
5895
6289
|
let root = applyPlayerEffects(doc).root;
|
|
5896
6290
|
root = materialiseOffsetPathsInTree(root);
|
|
5897
|
-
const duration = (_b = (
|
|
6291
|
+
const duration = (_b = (_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.duration) != null ? _b : DEFAULT_DURATION_MS;
|
|
5898
6292
|
root = materialiseInternalLoopsInTree(root, duration);
|
|
5899
|
-
if (engine ===
|
|
6293
|
+
if (engine === PxTimelineEngine.native) {
|
|
5900
6294
|
root = materialiseMotionPathsInTree(root, opts == null ? void 0 : opts.motionPath);
|
|
5901
6295
|
root = materialiseAnimatedUseInstances(root);
|
|
5902
6296
|
root = pruneUnreferencedDefs(root);
|
|
@@ -5906,9 +6300,9 @@ function materialiseAllInTree(doc, engine, opts) {
|
|
|
5906
6300
|
function pruneUnreferencedDefs(root) {
|
|
5907
6301
|
const stripHash3 = (h) => h.startsWith("#") ? h.slice(1) : h;
|
|
5908
6302
|
const walk = (n, fn) => {
|
|
5909
|
-
var
|
|
6303
|
+
var _a2;
|
|
5910
6304
|
fn(n);
|
|
5911
|
-
(
|
|
6305
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach((c) => walk(c, fn));
|
|
5912
6306
|
};
|
|
5913
6307
|
let changed = true;
|
|
5914
6308
|
while (changed) {
|
|
@@ -5933,7 +6327,7 @@ function pruneUnreferencedDefs(root) {
|
|
|
5933
6327
|
return root;
|
|
5934
6328
|
}
|
|
5935
6329
|
|
|
5936
|
-
// src/PxFrameLoop.ts
|
|
6330
|
+
// src/playback/PxFrameLoop.ts
|
|
5937
6331
|
function requestFrame(cb) {
|
|
5938
6332
|
const g = globalThis;
|
|
5939
6333
|
if (typeof g.requestAnimationFrame === "function") return g.requestAnimationFrame(cb);
|
|
@@ -5948,9 +6342,9 @@ function cancelFrame(handle) {
|
|
|
5948
6342
|
g.clearTimeout(handle);
|
|
5949
6343
|
}
|
|
5950
6344
|
function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
|
|
5951
|
-
var
|
|
6345
|
+
var _a2;
|
|
5952
6346
|
const config = getAnimatorConfig(doc) || {};
|
|
5953
|
-
const bindings = getNormalisedBindings(doc,
|
|
6347
|
+
const bindings = getNormalisedBindings(doc, PxTimelineEngine.js);
|
|
5954
6348
|
const _iterations = config.iterations;
|
|
5955
6349
|
let iterations = 1;
|
|
5956
6350
|
if (typeof _iterations === "number") iterations = _iterations || 1;
|
|
@@ -5959,7 +6353,7 @@ function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
|
|
|
5959
6353
|
const duration = +(config.duration || DEFAULT_DURATION_MS);
|
|
5960
6354
|
const totalDuration = duration && iterations ? duration * (iterations === Infinity ? Infinity : iterations) : duration ? (iterations != null ? iterations : 1) * duration : 0;
|
|
5961
6355
|
const direction = config.direction || "normal";
|
|
5962
|
-
const fill = (
|
|
6356
|
+
const fill = (_a2 = config.fill) != null ? _a2 : "forwards";
|
|
5963
6357
|
const fillsForwards = fill === "forwards" || fill === "both";
|
|
5964
6358
|
const fillsBackwards = fill === "backwards" || fill === "both";
|
|
5965
6359
|
let timerId = null;
|
|
@@ -6021,7 +6415,7 @@ function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
|
|
|
6021
6415
|
}
|
|
6022
6416
|
}
|
|
6023
6417
|
const tick = () => {
|
|
6024
|
-
var
|
|
6418
|
+
var _a3, _b;
|
|
6025
6419
|
if (!adapter.isConnected()) {
|
|
6026
6420
|
pauseAnim();
|
|
6027
6421
|
return;
|
|
@@ -6037,7 +6431,7 @@ function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
|
|
|
6037
6431
|
renderFrame(0);
|
|
6038
6432
|
if (!finishCalled) {
|
|
6039
6433
|
finishCalled = true;
|
|
6040
|
-
(
|
|
6434
|
+
(_a3 = callbacks == null ? void 0 : callbacks.onFinish) == null ? void 0 : _a3.call(callbacks);
|
|
6041
6435
|
}
|
|
6042
6436
|
return;
|
|
6043
6437
|
}
|
|
@@ -6129,17 +6523,17 @@ function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
|
|
|
6129
6523
|
}
|
|
6130
6524
|
};
|
|
6131
6525
|
const cancelAnim = () => {
|
|
6132
|
-
var
|
|
6526
|
+
var _a3;
|
|
6133
6527
|
pauseAnim();
|
|
6134
6528
|
timeBeforeLastStartMs = 0;
|
|
6135
6529
|
lastStartedTs = 0;
|
|
6136
6530
|
playing = false;
|
|
6137
6531
|
finishCalled = false;
|
|
6138
6532
|
renderFrame(timeBeforeLastStartMs);
|
|
6139
|
-
(
|
|
6533
|
+
(_a3 = callbacks == null ? void 0 : callbacks.onCancel) == null ? void 0 : _a3.call(callbacks);
|
|
6140
6534
|
};
|
|
6141
6535
|
const finishAnim = (callOnFinish = true) => {
|
|
6142
|
-
var
|
|
6536
|
+
var _a3;
|
|
6143
6537
|
if (Number.isFinite(totalDuration)) {
|
|
6144
6538
|
timeBeforeLastStartMs = totalDuration;
|
|
6145
6539
|
} else {
|
|
@@ -6154,7 +6548,7 @@ function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
|
|
|
6154
6548
|
renderFrame(fillsForwards ? timeBeforeLastStartMs : 0);
|
|
6155
6549
|
if (callOnFinish && !finishCalled) {
|
|
6156
6550
|
finishCalled = true;
|
|
6157
|
-
(
|
|
6551
|
+
(_a3 = callbacks == null ? void 0 : callbacks.onFinish) == null ? void 0 : _a3.call(callbacks);
|
|
6158
6552
|
}
|
|
6159
6553
|
};
|
|
6160
6554
|
const api = {
|
|
@@ -6164,14 +6558,14 @@ function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
|
|
|
6164
6558
|
return _isPlaying();
|
|
6165
6559
|
},
|
|
6166
6560
|
"play": () => {
|
|
6167
|
-
var
|
|
6561
|
+
var _a3;
|
|
6168
6562
|
startAnim();
|
|
6169
|
-
(
|
|
6563
|
+
(_a3 = callbacks == null ? void 0 : callbacks.onPlay) == null ? void 0 : _a3.call(callbacks);
|
|
6170
6564
|
},
|
|
6171
6565
|
"pause": () => {
|
|
6172
|
-
var
|
|
6566
|
+
var _a3;
|
|
6173
6567
|
pauseAnim();
|
|
6174
|
-
(
|
|
6568
|
+
(_a3 = callbacks == null ? void 0 : callbacks.onPause) == null ? void 0 : _a3.call(callbacks);
|
|
6175
6569
|
},
|
|
6176
6570
|
"cancel": () => {
|
|
6177
6571
|
cancelAnim();
|
|
@@ -6203,9 +6597,9 @@ function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
|
|
|
6203
6597
|
renderFrame(getAnimCurrentTime());
|
|
6204
6598
|
},
|
|
6205
6599
|
"destroy": () => {
|
|
6206
|
-
var
|
|
6600
|
+
var _a3;
|
|
6207
6601
|
api.cancel();
|
|
6208
|
-
(
|
|
6602
|
+
(_a3 = callbacks == null ? void 0 : callbacks.onRemove) == null ? void 0 : _a3.call(callbacks);
|
|
6209
6603
|
}
|
|
6210
6604
|
};
|
|
6211
6605
|
return api;
|
|
@@ -6261,9 +6655,9 @@ function lerp(a, b, f) {
|
|
|
6261
6655
|
return a + (b - a) * f;
|
|
6262
6656
|
}
|
|
6263
6657
|
function interpParts(kfs, t) {
|
|
6264
|
-
var
|
|
6658
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
6265
6659
|
if (!kfs.length) return {};
|
|
6266
|
-
if (t <= ((
|
|
6660
|
+
if (t <= ((_a2 = kfs[0].time) != null ? _a2 : 0)) return kfs[0].value || {};
|
|
6267
6661
|
if (t >= ((_b = kfs[kfs.length - 1].time) != null ? _b : 0)) return kfs[kfs.length - 1].value || {};
|
|
6268
6662
|
let i = 0;
|
|
6269
6663
|
while (i < kfs.length - 1 && ((_c = kfs[i + 1].time) != null ? _c : 0) < t) i++;
|
|
@@ -6294,10 +6688,10 @@ function nodeMatrix(node, t) {
|
|
|
6294
6688
|
return IDENTITY;
|
|
6295
6689
|
}
|
|
6296
6690
|
function evalScalar(animated, staticVal, fallback, t) {
|
|
6297
|
-
var
|
|
6691
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
6298
6692
|
if (animated && animated.keyframes && animated.keyframes.length) {
|
|
6299
6693
|
const kfs = animated.keyframes;
|
|
6300
|
-
if (t <= ((
|
|
6694
|
+
if (t <= ((_a2 = kfs[0].time) != null ? _a2 : 0)) return kfs[0].value;
|
|
6301
6695
|
if (t >= ((_b = kfs[kfs.length - 1].time) != null ? _b : 0)) return kfs[kfs.length - 1].value;
|
|
6302
6696
|
let i = 0;
|
|
6303
6697
|
while (i < kfs.length - 1 && ((_c = kfs[i + 1].time) != null ? _c : 0) < t) i++;
|
|
@@ -6310,9 +6704,9 @@ function evalScalar(animated, staticVal, fallback, t) {
|
|
|
6310
6704
|
var CONTAINER_TYPES = /* @__PURE__ */ new Set(["svg", "g", "symbol"]);
|
|
6311
6705
|
var SKIP_TYPES = /* @__PURE__ */ new Set(["defs", "mask", "clipPath", "title"]);
|
|
6312
6706
|
function buildIdMap2(node, map) {
|
|
6313
|
-
var
|
|
6707
|
+
var _a2;
|
|
6314
6708
|
if (typeof node.id === "string") map.set(node.id, node);
|
|
6315
|
-
(
|
|
6709
|
+
(_a2 = node.children) == null ? void 0 : _a2.forEach((c) => buildIdMap2(c, map));
|
|
6316
6710
|
}
|
|
6317
6711
|
function num(v) {
|
|
6318
6712
|
return v === void 0 || v === null ? 0 : Number(v);
|
|
@@ -6321,7 +6715,7 @@ function round(n) {
|
|
|
6321
6715
|
return Math.round(n * 100) / 100 + 0;
|
|
6322
6716
|
}
|
|
6323
6717
|
function geomKey(node) {
|
|
6324
|
-
var
|
|
6718
|
+
var _a2;
|
|
6325
6719
|
switch (node.type) {
|
|
6326
6720
|
case "rect":
|
|
6327
6721
|
return num(node.width) + "," + num(node.height) + "," + num(node.x) + "," + num(node.y);
|
|
@@ -6330,14 +6724,14 @@ function geomKey(node) {
|
|
|
6330
6724
|
case "circle":
|
|
6331
6725
|
return num(node.r) + "," + num(node.cx) + "," + num(node.cy);
|
|
6332
6726
|
case "path":
|
|
6333
|
-
return String((
|
|
6727
|
+
return String((_a2 = node.d) != null ? _a2 : "");
|
|
6334
6728
|
default:
|
|
6335
6729
|
return "";
|
|
6336
6730
|
}
|
|
6337
6731
|
}
|
|
6338
6732
|
function describePrimitive(node, m, t) {
|
|
6339
|
-
var
|
|
6340
|
-
const fill = (
|
|
6733
|
+
var _a2, _b, _c, _d, _e;
|
|
6734
|
+
const fill = (_a2 = node.fill) != null ? _a2 : "";
|
|
6341
6735
|
const stroke = (_b = node.stroke) != null ? _b : "";
|
|
6342
6736
|
const sw = (_d = (_c = node["stroke-width"]) != null ? _c : node.strokeWidth) != null ? _d : "";
|
|
6343
6737
|
const opacity = round(evalScalar((_e = node.animate) == null ? void 0 : _e.opacity, node.opacity, 1, t));
|
|
@@ -6346,7 +6740,7 @@ function describePrimitive(node, m, t) {
|
|
|
6346
6740
|
return node.type + "|" + geomKey(node) + "|[" + mat + "]|f:" + fill + "|s:" + stroke + "|sw:" + (num(sw) || "") + "|o:" + opacity + "|m:" + masked;
|
|
6347
6741
|
}
|
|
6348
6742
|
function flatten(node, parent, t, idMap, out) {
|
|
6349
|
-
var
|
|
6743
|
+
var _a2;
|
|
6350
6744
|
const type = node.type || "";
|
|
6351
6745
|
if (SKIP_TYPES.has(type)) return;
|
|
6352
6746
|
const m = mul(parent, nodeMatrix(node, t));
|
|
@@ -6359,33 +6753,33 @@ function flatten(node, parent, t, idMap, out) {
|
|
|
6359
6753
|
return;
|
|
6360
6754
|
}
|
|
6361
6755
|
if (CONTAINER_TYPES.has(type)) {
|
|
6362
|
-
(
|
|
6756
|
+
(_a2 = node.children) == null ? void 0 : _a2.forEach((c) => flatten(c, m, t, idMap, out));
|
|
6363
6757
|
return;
|
|
6364
6758
|
}
|
|
6365
6759
|
out.push(describePrimitive(node, m, t));
|
|
6366
6760
|
}
|
|
6367
6761
|
function collectSampleTimes(node, into) {
|
|
6368
|
-
var
|
|
6762
|
+
var _a2;
|
|
6369
6763
|
into.add(0);
|
|
6370
6764
|
const scanAnim = (anim) => {
|
|
6371
|
-
var
|
|
6765
|
+
var _a3;
|
|
6372
6766
|
if (!anim || typeof anim !== "object") return;
|
|
6373
6767
|
for (const key of Object.keys(anim)) {
|
|
6374
|
-
const kfs = (
|
|
6768
|
+
const kfs = (_a3 = anim[key]) == null ? void 0 : _a3.keyframes;
|
|
6375
6769
|
if (Array.isArray(kfs)) kfs.forEach((kf) => {
|
|
6376
|
-
var
|
|
6377
|
-
return into.add((
|
|
6770
|
+
var _a4;
|
|
6771
|
+
return into.add((_a4 = kf.time) != null ? _a4 : 0);
|
|
6378
6772
|
});
|
|
6379
6773
|
}
|
|
6380
6774
|
};
|
|
6381
6775
|
scanAnim(node.animate);
|
|
6382
6776
|
if (node.transform && typeof node.transform === "object" && node.transform.keyframes) {
|
|
6383
6777
|
node.transform.keyframes.forEach((kf) => {
|
|
6384
|
-
var
|
|
6385
|
-
return into.add((
|
|
6778
|
+
var _a3;
|
|
6779
|
+
return into.add((_a3 = kf.time) != null ? _a3 : 0);
|
|
6386
6780
|
});
|
|
6387
6781
|
}
|
|
6388
|
-
(
|
|
6782
|
+
(_a2 = node.children) == null ? void 0 : _a2.forEach((c) => collectSampleTimes(c, into));
|
|
6389
6783
|
}
|
|
6390
6784
|
function visualModelAt(root, t) {
|
|
6391
6785
|
const idMap = /* @__PURE__ */ new Map();
|
|
@@ -6419,8 +6813,196 @@ function subtractMultiset(a, b) {
|
|
|
6419
6813
|
}
|
|
6420
6814
|
return extra;
|
|
6421
6815
|
}
|
|
6816
|
+
|
|
6817
|
+
// src/playback/PxAnimatorConfigPatch.ts
|
|
6818
|
+
var FLAT_ONLY_KEYS = [
|
|
6819
|
+
"timelineSource",
|
|
6820
|
+
"scroll",
|
|
6821
|
+
"trigger",
|
|
6822
|
+
"delay",
|
|
6823
|
+
"iterations",
|
|
6824
|
+
"direction",
|
|
6825
|
+
"fill",
|
|
6826
|
+
"resetOnFinish",
|
|
6827
|
+
"duration",
|
|
6828
|
+
"mode",
|
|
6829
|
+
"frameRate"
|
|
6830
|
+
];
|
|
6831
|
+
var CONTENT_KEYS = ["definitions", "animateById"];
|
|
6832
|
+
var isPlainObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
6833
|
+
var timelineTypeOf = (t) => isPlainObject(t) && typeof t.type === "string" ? t.type : "time";
|
|
6834
|
+
var isScrollish = (type) => type === "scroll" || type === "view";
|
|
6835
|
+
function mergePlain(base, patch) {
|
|
6836
|
+
const out = isPlainObject(base) ? __spreadValues({}, base) : {};
|
|
6837
|
+
for (const key of Object.keys(patch)) {
|
|
6838
|
+
const value = patch[key];
|
|
6839
|
+
if (value === null) {
|
|
6840
|
+
delete out[key];
|
|
6841
|
+
continue;
|
|
6842
|
+
}
|
|
6843
|
+
if (isPlainObject(value)) {
|
|
6844
|
+
out[key] = mergePlain(out[key], value);
|
|
6845
|
+
continue;
|
|
6846
|
+
}
|
|
6847
|
+
out[key] = value;
|
|
6848
|
+
}
|
|
6849
|
+
return out;
|
|
6850
|
+
}
|
|
6851
|
+
function mergeTimeline(base, patch, warn) {
|
|
6852
|
+
const baseType = timelineTypeOf(base);
|
|
6853
|
+
const patchNamesType = isPlainObject(patch) && typeof patch.type === "string";
|
|
6854
|
+
const patchType = patchNamesType ? String(patch.type) : baseType;
|
|
6855
|
+
let merged;
|
|
6856
|
+
if (patchType !== baseType) {
|
|
6857
|
+
const carried = {};
|
|
6858
|
+
if (isPlainObject(base)) {
|
|
6859
|
+
for (const k of PX_TIMELINE_SHARED_KEYS) {
|
|
6860
|
+
if (base[k] !== void 0) carried[k] = base[k];
|
|
6861
|
+
}
|
|
6862
|
+
}
|
|
6863
|
+
merged = mergePlain(carried, patch);
|
|
6864
|
+
} else {
|
|
6865
|
+
merged = mergePlain(base, patch);
|
|
6866
|
+
}
|
|
6867
|
+
if (isScrollish(patchType)) {
|
|
6868
|
+
for (const k of PX_TIME_ONLY_TIMELINE_KEYS) {
|
|
6869
|
+
if (merged[k] === void 0) continue;
|
|
6870
|
+
warn("animator.timeline." + k + ": no slot on a '" + patchType + "' timeline \u2014 dropped");
|
|
6871
|
+
delete merged[k];
|
|
6872
|
+
}
|
|
6873
|
+
if (merged.iterations === "infinite") {
|
|
6874
|
+
warn("animator.timeline.iterations: 'infinite' cannot map onto a scroll range \u2014 dropped");
|
|
6875
|
+
delete merged.iterations;
|
|
6876
|
+
}
|
|
6877
|
+
}
|
|
6878
|
+
return merged;
|
|
6879
|
+
}
|
|
6880
|
+
function foldAnimatorConfigShortcuts(config, shortcuts) {
|
|
6881
|
+
let base;
|
|
6882
|
+
if (typeof config === "string") {
|
|
6883
|
+
try {
|
|
6884
|
+
base = JSON.parse(config);
|
|
6885
|
+
} catch (e) {
|
|
6886
|
+
console.warn("animator config: not valid JSON \u2014 ignored", e);
|
|
6887
|
+
base = void 0;
|
|
6888
|
+
}
|
|
6889
|
+
} else {
|
|
6890
|
+
base = config != null ? config : void 0;
|
|
6891
|
+
}
|
|
6892
|
+
const { duration, delay, iterations, startOn } = shortcuts;
|
|
6893
|
+
if (duration === void 0 && delay === void 0 && iterations === void 0 && startOn === void 0) {
|
|
6894
|
+
return base;
|
|
6895
|
+
}
|
|
6896
|
+
const out = isPlainObject(base) ? __spreadValues({}, base) : {};
|
|
6897
|
+
const timeline = __spreadValues({}, out.timeline);
|
|
6898
|
+
if (duration !== void 0) timeline.duration = duration;
|
|
6899
|
+
if (delay !== void 0) timeline.delay = delay;
|
|
6900
|
+
if (iterations !== void 0) timeline.iterations = iterations;
|
|
6901
|
+
if (startOn !== void 0) {
|
|
6902
|
+
timeline.trigger = __spreadProps(__spreadValues({}, timeline.trigger), { startOn });
|
|
6903
|
+
}
|
|
6904
|
+
out.timeline = timeline;
|
|
6905
|
+
return out;
|
|
6906
|
+
}
|
|
6907
|
+
function mergeAnimatorConfig(base, patch) {
|
|
6908
|
+
const warnings = [];
|
|
6909
|
+
const warn = (m) => warnings.push(m);
|
|
6910
|
+
if (patch === null) return { config: void 0, warnings };
|
|
6911
|
+
if (!isPlainObject(patch) || Object.keys(patch).length === 0) {
|
|
6912
|
+
return { config: base, warnings };
|
|
6913
|
+
}
|
|
6914
|
+
const flatInBase = isPlainObject(base) ? FLAT_ONLY_KEYS.filter((k) => base[k] !== void 0) : [];
|
|
6915
|
+
if (flatInBase.length) {
|
|
6916
|
+
warn("animator: the base carries the flat runtime spelling (" + flatInBase.join(", ") + "); the patch merges the wire spelling only");
|
|
6917
|
+
}
|
|
6918
|
+
const out = isPlainObject(base) ? __spreadValues({}, base) : {};
|
|
6919
|
+
for (const key of Object.keys(patch)) {
|
|
6920
|
+
const value = patch[key];
|
|
6921
|
+
if (value === null) {
|
|
6922
|
+
delete out[key];
|
|
6923
|
+
continue;
|
|
6924
|
+
}
|
|
6925
|
+
if (key === "timeline") {
|
|
6926
|
+
out.timeline = isPlainObject(value) ? mergeTimeline(out.timeline, value, warn) : value;
|
|
6927
|
+
continue;
|
|
6928
|
+
}
|
|
6929
|
+
if (isPlainObject(value)) {
|
|
6930
|
+
out[key] = mergePlain(out[key], value);
|
|
6931
|
+
continue;
|
|
6932
|
+
}
|
|
6933
|
+
out[key] = value;
|
|
6934
|
+
}
|
|
6935
|
+
return { config: out, warnings };
|
|
6936
|
+
}
|
|
6937
|
+
function applyAnimatorConfig(doc, patch, opts) {
|
|
6938
|
+
var _a2, _b;
|
|
6939
|
+
const reset = !!(opts == null ? void 0 : opts.resetDefaults);
|
|
6940
|
+
if (!doc || (patch === void 0 || !reset && (patch === null || !isPlainObject(patch) || !Object.keys(patch).length))) {
|
|
6941
|
+
return { doc, warnings: [] };
|
|
6942
|
+
}
|
|
6943
|
+
const anyDoc = doc;
|
|
6944
|
+
const atRoot = isPlainObject(anyDoc.animator);
|
|
6945
|
+
const atMeta = !atRoot && isPlainObject((_a2 = anyDoc.meta) == null ? void 0 : _a2.animator);
|
|
6946
|
+
const current = atRoot ? anyDoc.animator : atMeta ? anyDoc.meta.animator : void 0;
|
|
6947
|
+
const warnings = [];
|
|
6948
|
+
if (atRoot && isPlainObject((_b = anyDoc.meta) == null ? void 0 : _b.animator)) {
|
|
6949
|
+
warnings.push("animator: doc.meta.animator is shadowed by doc.animator and was not patched");
|
|
6950
|
+
}
|
|
6951
|
+
let base = current;
|
|
6952
|
+
if (reset) {
|
|
6953
|
+
const kept = {};
|
|
6954
|
+
for (const k of CONTENT_KEYS) {
|
|
6955
|
+
if (isPlainObject(current) && current[k] !== void 0) kept[k] = current[k];
|
|
6956
|
+
}
|
|
6957
|
+
base = kept;
|
|
6958
|
+
}
|
|
6959
|
+
const merged = mergeAnimatorConfig(base, patch != null ? patch : {});
|
|
6960
|
+
warnings.push(...merged.warnings);
|
|
6961
|
+
if (merged.config === current) return { doc, warnings };
|
|
6962
|
+
if (atMeta) {
|
|
6963
|
+
return {
|
|
6964
|
+
doc: __spreadProps(__spreadValues({}, anyDoc), { meta: __spreadProps(__spreadValues({}, anyDoc.meta), { animator: merged.config }) }),
|
|
6965
|
+
warnings
|
|
6966
|
+
};
|
|
6967
|
+
}
|
|
6968
|
+
return { doc: __spreadProps(__spreadValues({}, anyDoc), { animator: merged.config }), warnings };
|
|
6969
|
+
}
|
|
6970
|
+
|
|
6971
|
+
// src/format/PxDocumentDiagnostic.ts
|
|
6972
|
+
var MAX_REPORTED = 6;
|
|
6973
|
+
var LEGACY_FLAT_KEYS = [
|
|
6974
|
+
...PX_TIMELINE_SHARED_KEYS,
|
|
6975
|
+
...PX_TIME_ONLY_TIMELINE_KEYS,
|
|
6976
|
+
"fill",
|
|
6977
|
+
"resetOnFinish",
|
|
6978
|
+
"timelineSource",
|
|
6979
|
+
"scroll"
|
|
6980
|
+
];
|
|
6981
|
+
var isLegacyFlatAnimatorKey = (w) => LEGACY_FLAT_KEYS.some((k) => w.indexOf("animator." + k + ":") >= 0);
|
|
6982
|
+
function diagnoseDocument(doc) {
|
|
6983
|
+
let all;
|
|
6984
|
+
try {
|
|
6985
|
+
all = validateDocument(doc);
|
|
6986
|
+
} catch (e) {
|
|
6987
|
+
return { problems: [], legacy: [] };
|
|
6988
|
+
}
|
|
6989
|
+
const problems = [];
|
|
6990
|
+
const legacy = [];
|
|
6991
|
+
for (const w of all) (isLegacyFlatAnimatorKey(w) ? legacy : problems).push(w);
|
|
6992
|
+
return { problems, legacy };
|
|
6993
|
+
}
|
|
6994
|
+
function reportDocumentDiagnostics(doc, where) {
|
|
6995
|
+
const { problems } = diagnoseDocument(doc);
|
|
6996
|
+
if (!problems.length) return;
|
|
6997
|
+
const shown = problems.slice(0, MAX_REPORTED);
|
|
6998
|
+
const more = problems.length - shown.length;
|
|
6999
|
+
console.warn(
|
|
7000
|
+
where + ": this document does not match the animation schema in " + problems.length + " place" + (problems.length === 1 ? "" : "s") + ".\n" + shown.map((p) => " - " + p).join("\n") + (more > 0 ? "\n \u2026 and " + more + " more" : "") + "\n\nIf you did not author these keys, the usual cause is a build that MANGLES PROPERTY NAMES. An animation document is data loaded at runtime, so renaming the property reads inside the player stops them matching the keys in the JSON, and the animation silently does nothing. Feed the published reserved-name list to your minifier \u2014 @pixodesk/svg-animator-web/mangle-reserved.json \u2014 see docs/library/minification.md."
|
|
7001
|
+
);
|
|
7002
|
+
}
|
|
6422
7003
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6423
7004
|
0 && (module.exports = {
|
|
7005
|
+
BASELINE_PLAYER_VERSION,
|
|
6424
7006
|
COLOUR_ATTR_NAMES,
|
|
6425
7007
|
CSS_ONLY_STYLE_PROPS,
|
|
6426
7008
|
DEFAULT_DURATION_MS,
|
|
@@ -6429,18 +7011,21 @@ function subtractMultiset(a, b) {
|
|
|
6429
7011
|
LOOP_JUMP_SHIFT_MS,
|
|
6430
7012
|
MISSING_GLYPH_CLASS_NAME,
|
|
6431
7013
|
PCT_BASED_ATTR_NAMES,
|
|
7014
|
+
PLAYER_WIRE_STEPS,
|
|
7015
|
+
PLAYER_WIRE_VERSION,
|
|
6432
7016
|
PX_ANIM_ATTR_NAME,
|
|
6433
7017
|
PX_ANIM_SRC_ATTR_NAME,
|
|
7018
|
+
PX_PLAYER_SCHEMA_VERSION,
|
|
6434
7019
|
PX_TRANSFORM_PART_KEYS,
|
|
7020
|
+
PX_UNKNOWN_KEY_ERROR,
|
|
6435
7021
|
PxAnimatedSvgDocumentSchema,
|
|
6436
7022
|
PxAnimationDefinitionSchema,
|
|
6437
7023
|
PxAnimatorConfigSchema,
|
|
6438
|
-
PxAnimatorEngine,
|
|
6439
|
-
PxAnimatorMode,
|
|
6440
7024
|
PxAttrValueSchema,
|
|
6441
7025
|
PxBezierPathSchema,
|
|
6442
7026
|
PxBindingSchema,
|
|
6443
7027
|
PxCloneEffectSchema,
|
|
7028
|
+
PxCloneWithout,
|
|
6444
7029
|
PxDefsSchema,
|
|
6445
7030
|
PxEasingOrRefSchema,
|
|
6446
7031
|
PxEffectsSchema,
|
|
@@ -6452,7 +7037,8 @@ function subtractMultiset(a, b) {
|
|
|
6452
7037
|
PxGradientUnits,
|
|
6453
7038
|
PxKeyframeSchema,
|
|
6454
7039
|
PxKeyframeValueSchema,
|
|
6455
|
-
|
|
7040
|
+
PxLoopDirection,
|
|
7041
|
+
PxLoopRepeatAt,
|
|
6456
7042
|
PxLoopSchema,
|
|
6457
7043
|
PxMaskedByEffectSchema,
|
|
6458
7044
|
PxNodeBase,
|
|
@@ -6469,6 +7055,8 @@ function subtractMultiset(a, b) {
|
|
|
6469
7055
|
PxSvgNodeExtra,
|
|
6470
7056
|
PxTextEffectSchema,
|
|
6471
7057
|
PxTextPathEffectSchema,
|
|
7058
|
+
PxTimelineEngine,
|
|
7059
|
+
PxTimelineEngineExtra,
|
|
6472
7060
|
PxTimelinePinSchema,
|
|
6473
7061
|
PxTimelineSchema,
|
|
6474
7062
|
PxTransformByEffectSchema,
|
|
@@ -6479,22 +7067,35 @@ function subtractMultiset(a, b) {
|
|
|
6479
7067
|
TEXT_ATTR,
|
|
6480
7068
|
TEXT_CONTENT_ATTR,
|
|
6481
7069
|
TRANSFORM_FN_NAMES,
|
|
7070
|
+
WIRE_VERSION_KEY,
|
|
7071
|
+
WireStepKind,
|
|
7072
|
+
WireVersionRelation,
|
|
7073
|
+
applyAnimatorConfig,
|
|
6482
7074
|
applyPlayerEffects,
|
|
7075
|
+
applyWireSteps,
|
|
7076
|
+
applyWireStepsDown,
|
|
6483
7077
|
bezierToSvgPath,
|
|
6484
7078
|
calcAnimationValues,
|
|
6485
7079
|
camelCaseToKebabWordIfNeeded,
|
|
6486
7080
|
clamp,
|
|
6487
7081
|
collectSampleTimes,
|
|
7082
|
+
compareWireVersion,
|
|
6488
7083
|
composeTransformParts,
|
|
7084
|
+
convertPlayerDocument,
|
|
6489
7085
|
createBasicFrameLoopAnimator,
|
|
6490
7086
|
createPathSampler,
|
|
6491
7087
|
cubicBezier,
|
|
6492
7088
|
deepClone,
|
|
6493
7089
|
describeSchema,
|
|
7090
|
+
diagnoseDocument,
|
|
7091
|
+
diffFieldUniverse,
|
|
6494
7092
|
diffInEffect,
|
|
7093
|
+
downgradePlayerDocument,
|
|
6495
7094
|
evaluateMotionPathSegment,
|
|
6496
7095
|
extendedPathForBrowser,
|
|
6497
7096
|
flattenAnimatorTimeline,
|
|
7097
|
+
foldAnimatorConfigShortcuts,
|
|
7098
|
+
formatWireVersion,
|
|
6498
7099
|
generateNewIds,
|
|
6499
7100
|
generateUniqueId,
|
|
6500
7101
|
getAnimatorConfig,
|
|
@@ -6505,11 +7106,17 @@ function subtractMultiset(a, b) {
|
|
|
6505
7106
|
getNormalizedProps,
|
|
6506
7107
|
interpolateBeziers,
|
|
6507
7108
|
interpolateValue,
|
|
7109
|
+
isNativeForced,
|
|
6508
7110
|
isPxElementFileFormat,
|
|
6509
7111
|
isPxElementFileFormatDeep,
|
|
6510
7112
|
isScrollTimeline,
|
|
6511
7113
|
jsonElementFactory,
|
|
6512
7114
|
kebabToCamelCaseWord,
|
|
7115
|
+
kfEasing,
|
|
7116
|
+
kfTangentIn,
|
|
7117
|
+
kfTangentOut,
|
|
7118
|
+
kfTime,
|
|
7119
|
+
kfValue,
|
|
6513
7120
|
layoutGlyphTextChars,
|
|
6514
7121
|
materialiseAllInTree,
|
|
6515
7122
|
materialiseAnimatedUseInstances,
|
|
@@ -6520,14 +7127,23 @@ function subtractMultiset(a, b) {
|
|
|
6520
7127
|
materialiseInternalLoopsInTree,
|
|
6521
7128
|
materialiseMotionPathInPropAnim,
|
|
6522
7129
|
materialiseMotionPathsInTree,
|
|
7130
|
+
mayUseNativeScrollTimeline,
|
|
7131
|
+
mergeAnimatorConfig,
|
|
6523
7132
|
mergeStaticTransformIntoAnimDef,
|
|
6524
7133
|
nestAnimatorTimeline,
|
|
6525
7134
|
parseTransformParts,
|
|
7135
|
+
parseWireVersion,
|
|
7136
|
+
planSchemaRelease,
|
|
6526
7137
|
propAnimIsMotionPath,
|
|
6527
7138
|
px,
|
|
7139
|
+
readWireVersion,
|
|
7140
|
+
releaseLogProblems,
|
|
7141
|
+
reportDocumentDiagnostics,
|
|
6528
7142
|
resolveStyle,
|
|
7143
|
+
resolveTimelineEngine,
|
|
6529
7144
|
reverseEasing,
|
|
6530
7145
|
sanitiseAttributeValue,
|
|
7146
|
+
schemaFieldUniverse,
|
|
6531
7147
|
schemaKeys,
|
|
6532
7148
|
scrollOffsetProgress,
|
|
6533
7149
|
scrollPhaseInterval,
|
|
@@ -6538,7 +7154,9 @@ function subtractMultiset(a, b) {
|
|
|
6538
7154
|
splitEasing,
|
|
6539
7155
|
subdivideCubicBezier,
|
|
6540
7156
|
toRGBA,
|
|
7157
|
+
validateDocument,
|
|
6541
7158
|
validateNodeEffects,
|
|
7159
|
+
versionAdvice,
|
|
6542
7160
|
visualModelAt
|
|
6543
7161
|
});
|
|
6544
7162
|
//# sourceMappingURL=index.cjs.map
|