@pixodesk/svg-animator-web 1.0.22 → 1.0.26
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 +3 -3
- package/dist/index.cjs +727 -423
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +725 -422
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.prerendered-waapi.umd.js +1709 -0
- package/dist/index.prerendered-waapi.umd.js.map +1 -0
- package/dist/index.prerendered-waapi.umd.min.js +1 -0
- package/dist/index.prerendered.umd.js +2221 -0
- package/dist/index.prerendered.umd.js.map +1 -0
- package/dist/index.prerendered.umd.min.js +1 -0
- package/dist/index.umd.js +872 -989
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +17 -12
package/dist/index.umd.js
CHANGED
|
@@ -8,6 +8,7 @@ var PixodeskAnimator = (() => {
|
|
|
8
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
10
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __pow = Math.pow;
|
|
11
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
13
|
var __spreadValues = (a, b) => {
|
|
13
14
|
for (var prop in b || (b = {}))
|
|
@@ -47,130 +48,22 @@ var PixodeskAnimator = (() => {
|
|
|
47
48
|
};
|
|
48
49
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
49
50
|
|
|
50
|
-
// src/index.ts
|
|
51
|
-
var
|
|
52
|
-
__export(
|
|
53
|
-
COLOUR_ATTR_NAMES: () => COLOUR_ATTR_NAMES,
|
|
51
|
+
// src/index.player.ts
|
|
52
|
+
var index_player_exports = {};
|
|
53
|
+
__export(index_player_exports, {
|
|
54
54
|
PX_ANIMATOR_DATA_KEY: () => PX_ANIMATOR_DATA_KEY,
|
|
55
55
|
PX_ANIM_ATTR_NAME: () => PX_ANIM_ATTR_NAME,
|
|
56
56
|
PX_ANIM_SRC_ATTR_NAME: () => PX_ANIM_SRC_ATTR_NAME,
|
|
57
|
-
PX_TRANSFORM_PART_KEYS: () => PX_TRANSFORM_PART_KEYS,
|
|
58
|
-
PxAnimatedSvgDocumentSchema: () => PxAnimatedSvgDocumentSchema,
|
|
59
|
-
PxAnimationDefinitionSchema: () => PxAnimationDefinitionSchema,
|
|
60
|
-
PxAnimatorConfigSchema: () => PxAnimatorConfigSchema,
|
|
61
57
|
PxAnimatorEngine: () => PxAnimatorEngine,
|
|
62
58
|
PxAnimatorMode: () => PxAnimatorMode,
|
|
63
|
-
PxAttrValueSchema: () => PxAttrValueSchema,
|
|
64
|
-
PxBezierPathSchema: () => PxBezierPathSchema,
|
|
65
|
-
PxBindingSchema: () => PxBindingSchema,
|
|
66
|
-
PxCloneEffectSchema: () => PxCloneEffectSchema,
|
|
67
|
-
PxDefsSchema: () => PxDefsSchema,
|
|
68
|
-
PxEasingOrRefSchema: () => PxEasingOrRefSchema,
|
|
69
|
-
PxEffectsSchema: () => PxEffectsSchema,
|
|
70
|
-
PxElementAnimationSchema: () => PxElementAnimationSchema,
|
|
71
|
-
PxFillGradientEffectSchema: () => PxFillGradientEffectSchema,
|
|
72
|
-
PxGradientSpreadMethod: () => PxGradientSpreadMethod,
|
|
73
|
-
PxGradientStopSchema: () => PxGradientStopSchema,
|
|
74
|
-
PxGradientType: () => PxGradientType,
|
|
75
|
-
PxGradientUnits: () => PxGradientUnits,
|
|
76
|
-
PxKeyframeSchema: () => PxKeyframeSchema,
|
|
77
|
-
PxLoopSchema: () => PxLoopSchema,
|
|
78
|
-
PxMaskedByEffectSchema: () => PxMaskedByEffectSchema,
|
|
79
|
-
PxNodeBase: () => PxNodeBase,
|
|
80
|
-
PxNodeSchema: () => PxNodeSchema,
|
|
81
|
-
PxPropertyAnimationSchema: () => PxPropertyAnimationSchema,
|
|
82
|
-
PxRepeaterEffectSchema: () => PxRepeaterEffectSchema,
|
|
83
|
-
PxRetimeEffectSchema: () => PxRetimeEffectSchema,
|
|
84
|
-
PxStrokeGradientEffectSchema: () => PxStrokeGradientEffectSchema,
|
|
85
|
-
PxSvgNodeExtra: () => PxSvgNodeExtra,
|
|
86
|
-
PxTextEffectSchema: () => PxTextEffectSchema,
|
|
87
|
-
PxTextPathEffectSchema: () => PxTextPathEffectSchema,
|
|
88
|
-
PxTransformPartsSchema: () => PxTransformPartsSchema,
|
|
89
|
-
PxTransformValueSchema: () => PxTransformValueSchema,
|
|
90
|
-
PxTransformationEffectSchema: () => PxTransformationEffectSchema,
|
|
91
|
-
PxTriggerSchema: () => PxTriggerSchema,
|
|
92
|
-
PxTrimPathEffectSchema: () => PxTrimPathEffectSchema,
|
|
93
|
-
STYLE_ATTR_NAMES: () => STYLE_ATTR_NAMES,
|
|
94
|
-
TRANSFORM_FN_NAMES: () => TRANSFORM_FN_NAMES,
|
|
95
|
-
applyPlayerEffects: () => applyPlayerEffects,
|
|
96
|
-
calcAnimationValues: () => calcAnimationValues,
|
|
97
|
-
camelCaseToKebabWordIfNeeded: () => camelCaseToKebabWordIfNeeded,
|
|
98
|
-
collectSampleTimes: () => collectSampleTimes,
|
|
99
59
|
createAnimator: () => createAnimator,
|
|
100
60
|
createAnimatorImpl: () => createAnimatorImpl,
|
|
101
|
-
createBasicFrameLoopAnimator: () => createBasicFrameLoopAnimator,
|
|
102
|
-
createFrameLoopAnimator: () => createFrameLoopAnimator,
|
|
103
|
-
createPathSampler: () => createPathSampler,
|
|
104
|
-
createWebApiAnimator: () => createWebApiAnimator,
|
|
105
|
-
describeSchema: () => describeSchema,
|
|
106
|
-
diffInEffect: () => diffInEffect,
|
|
107
|
-
evaluateMotionPathSegment: () => evaluateMotionPathSegment,
|
|
108
|
-
extendedPathForBrowser: () => extendedPathForBrowser,
|
|
109
61
|
generateNewIds: () => generateNewIds,
|
|
110
|
-
getAnimatorConfig: () => getAnimatorConfig,
|
|
111
|
-
getBindings: () => getBindings,
|
|
112
|
-
getChildren: () => getChildren,
|
|
113
|
-
getDefs: () => getDefs,
|
|
114
|
-
getNormalizedProps: () => getNormalizedProps,
|
|
115
|
-
isPxElementFileFormat: () => isPxElementFileFormat,
|
|
116
|
-
isPxElementFileFormatDeep: () => isPxElementFileFormatDeep,
|
|
117
|
-
jsonElementFactory: () => jsonElementFactory,
|
|
118
|
-
layoutGlyphTextChars: () => layoutGlyphTextChars,
|
|
119
62
|
loadTagAnimators: () => loadTagAnimators,
|
|
120
|
-
|
|
121
|
-
materialiseAnimatedUseInstances: () => materialiseAnimatedUseInstances,
|
|
122
|
-
materialiseGlyphText: () => materialiseGlyphText,
|
|
123
|
-
materialiseGlyphTextAlongPath: () => materialiseGlyphTextAlongPath,
|
|
124
|
-
materialiseGlyphTextHorizontal: () => materialiseGlyphTextHorizontal,
|
|
125
|
-
materialiseInternalLoopsInPropAnim: () => materialiseInternalLoopsInPropAnim,
|
|
126
|
-
materialiseInternalLoopsInTree: () => materialiseInternalLoopsInTree,
|
|
127
|
-
materialiseMotionPathInPropAnim: () => materialiseMotionPathInPropAnim,
|
|
128
|
-
materialiseMotionPathsInTree: () => materialiseMotionPathsInTree,
|
|
129
|
-
normalizeDocument: () => getNormalisedBindings,
|
|
130
|
-
propAnimIsMotionPath: () => propAnimIsMotionPath,
|
|
131
|
-
px: () => px,
|
|
132
|
-
renderNode: () => renderNode,
|
|
133
|
-
schemaKeys: () => schemaKeys,
|
|
134
|
-
setupAnimationTriggers: () => setupAnimationTriggers,
|
|
135
|
-
shiftAnimatable: () => shiftAnimatable,
|
|
136
|
-
toRGBA: () => toRGBA,
|
|
137
|
-
validateNodeEffects: () => validateNodeEffects,
|
|
138
|
-
visualModelAt: () => visualModelAt
|
|
63
|
+
setupAnimationTriggers: () => setupAnimationTriggers
|
|
139
64
|
});
|
|
140
65
|
|
|
141
|
-
// ../svg-animator-core/
|
|
142
|
-
var __defProp2 = Object.defineProperty;
|
|
143
|
-
var __defProps2 = Object.defineProperties;
|
|
144
|
-
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
145
|
-
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
146
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
147
|
-
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
148
|
-
var __pow = Math.pow;
|
|
149
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
150
|
-
var __spreadValues2 = (a, b) => {
|
|
151
|
-
for (var prop in b || (b = {}))
|
|
152
|
-
if (__hasOwnProp2.call(b, prop))
|
|
153
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
154
|
-
if (__getOwnPropSymbols2)
|
|
155
|
-
for (var prop of __getOwnPropSymbols2(b)) {
|
|
156
|
-
if (__propIsEnum2.call(b, prop))
|
|
157
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
158
|
-
}
|
|
159
|
-
return a;
|
|
160
|
-
};
|
|
161
|
-
var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
|
|
162
|
-
var __objRest2 = (source, exclude) => {
|
|
163
|
-
var target = {};
|
|
164
|
-
for (var prop in source)
|
|
165
|
-
if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
166
|
-
target[prop] = source[prop];
|
|
167
|
-
if (source != null && __getOwnPropSymbols2)
|
|
168
|
-
for (var prop of __getOwnPropSymbols2(source)) {
|
|
169
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
|
|
170
|
-
target[prop] = source[prop];
|
|
171
|
-
}
|
|
172
|
-
return target;
|
|
173
|
-
};
|
|
66
|
+
// ../svg-animator-core/src/PxSchema.ts
|
|
174
67
|
function pathStr(path) {
|
|
175
68
|
if (!path.length) return ".";
|
|
176
69
|
let result = "";
|
|
@@ -292,8 +185,9 @@ var PixodeskAnimator = (() => {
|
|
|
292
185
|
}
|
|
293
186
|
isValid(raw, ctx, path) {
|
|
294
187
|
var _a;
|
|
295
|
-
|
|
296
|
-
|
|
188
|
+
const probe = ctx && { errors: [], warnings: [], strict: ctx.strict };
|
|
189
|
+
if (this.schemas.some((s) => s.isValid(raw, probe, path ? [...path] : void 0))) return true;
|
|
190
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": no union member matched for value " + ((_a = JSON.stringify(raw)) != null ? _a : "").slice(0, 240));
|
|
297
191
|
return false;
|
|
298
192
|
}
|
|
299
193
|
_canSanitize(raw) {
|
|
@@ -369,6 +263,7 @@ var PixodeskAnimator = (() => {
|
|
|
369
263
|
if (ctx == null ? void 0 : ctx.strict) {
|
|
370
264
|
for (const key of Object.keys(obj)) {
|
|
371
265
|
if (key in this._shape) continue;
|
|
266
|
+
if (obj[key] === void 0) continue;
|
|
372
267
|
p.push(key);
|
|
373
268
|
ctx.errors.push(pathStr(p) + ": unexpected extra key");
|
|
374
269
|
p.pop();
|
|
@@ -392,7 +287,7 @@ var PixodeskAnimator = (() => {
|
|
|
392
287
|
}
|
|
393
288
|
sanitize(raw) {
|
|
394
289
|
const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
395
|
-
const out =
|
|
290
|
+
const out = __spreadValues({}, src);
|
|
396
291
|
for (const key of Object.keys(this._shape)) {
|
|
397
292
|
out[key] = this._shape[key].sanitize(src[key]);
|
|
398
293
|
}
|
|
@@ -509,6 +404,23 @@ var PixodeskAnimator = (() => {
|
|
|
509
404
|
return true;
|
|
510
405
|
}
|
|
511
406
|
};
|
|
407
|
+
var Defined = class extends Base {
|
|
408
|
+
constructor() {
|
|
409
|
+
super(...arguments);
|
|
410
|
+
this._default = void 0;
|
|
411
|
+
}
|
|
412
|
+
sanitize(raw) {
|
|
413
|
+
return raw;
|
|
414
|
+
}
|
|
415
|
+
isValid(raw, ctx, path) {
|
|
416
|
+
if (raw !== void 0) return true;
|
|
417
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": required value is missing");
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
_canSanitize(raw) {
|
|
421
|
+
return raw !== void 0;
|
|
422
|
+
}
|
|
423
|
+
};
|
|
512
424
|
var Lazy = class extends Base {
|
|
513
425
|
constructor(fn, _default) {
|
|
514
426
|
super();
|
|
@@ -562,20 +474,6 @@ var PixodeskAnimator = (() => {
|
|
|
562
474
|
function implementsInterface() {
|
|
563
475
|
return (schema) => schema;
|
|
564
476
|
}
|
|
565
|
-
function schemaKeys(schema) {
|
|
566
|
-
return Object.fromEntries(
|
|
567
|
-
Object.keys(schema["_shape"]).map((k) => [k, k])
|
|
568
|
-
);
|
|
569
|
-
}
|
|
570
|
-
function describeSchema(schema) {
|
|
571
|
-
var _a;
|
|
572
|
-
const s = schema;
|
|
573
|
-
if ("_shape" in s) return { kind: "shape", shape: s._shape };
|
|
574
|
-
if ("item" in s) return { kind: "array", item: s.item };
|
|
575
|
-
if ("inner" in s) return { kind: "optional", inner: s.inner };
|
|
576
|
-
if ("fn" in s) return { kind: "lazy", resolved: (_a = s.resolved) != null ? _a : s.fn() };
|
|
577
|
-
return { kind: "leaf" };
|
|
578
|
-
}
|
|
579
477
|
var px = {
|
|
580
478
|
/** Matches a string. Default: '' or provided value. */
|
|
581
479
|
string: (defaultVal = "") => new Str(defaultVal),
|
|
@@ -613,29 +511,72 @@ var PixodeskAnimator = (() => {
|
|
|
613
511
|
* @example
|
|
614
512
|
* const PxSvgNodeSchema = px.extendedObject(PxNodeBase, { width: px.number().optional() });
|
|
615
513
|
*/
|
|
616
|
-
extendedObject: (base, extra) => new Obj(
|
|
514
|
+
extendedObject: (base, extra) => new Obj(__spreadValues(__spreadValues({}, base._shape), extra)),
|
|
617
515
|
/** Array whose unrecoverable items are filtered out. Default: []. */
|
|
618
516
|
array: (item) => new Arr(item),
|
|
619
517
|
/** String-keyed record whose unrecoverable values are dropped. Default: {}. */
|
|
620
518
|
record: (value) => new Rec(value),
|
|
621
519
|
/** Passes anything through unchanged — always valid. */
|
|
622
520
|
any: () => new Any(),
|
|
521
|
+
/** Anything EXCEPT `undefined` — an open type whose presence is required (V6). */
|
|
522
|
+
defined: () => new Defined(),
|
|
623
523
|
/** Fixed-length tuple — validates element count and each position individually. */
|
|
624
524
|
tuple: (schemas) => new Tuple(schemas),
|
|
625
525
|
/** Defers schema creation — required for recursive types. Must supply a default value. */
|
|
626
526
|
lazy: (fn, defaultVal) => new Lazy(fn, defaultVal)
|
|
627
527
|
};
|
|
528
|
+
|
|
529
|
+
// ../svg-animator-core/src/PxAnimatorConstants.ts
|
|
628
530
|
var PX_ANIM_SRC_ATTR_NAME = "data-px-animation-src";
|
|
629
531
|
var PX_ANIM_ATTR_NAME = "_px_animator";
|
|
630
532
|
var PxAnimatorMode = {
|
|
631
533
|
auto: "auto",
|
|
632
|
-
|
|
534
|
+
waapi: "waapi",
|
|
633
535
|
frames: "frames"
|
|
634
536
|
};
|
|
635
537
|
var PxAnimatorEngine = {
|
|
636
|
-
|
|
538
|
+
waapi: PxAnimatorMode.waapi,
|
|
637
539
|
frames: PxAnimatorMode.frames
|
|
638
540
|
};
|
|
541
|
+
var PxLoopExtend = {
|
|
542
|
+
/** Segment from the START; the animation is extended BEFORE the first keyframe
|
|
543
|
+
* (intro loops that run before the main timeline begins). */
|
|
544
|
+
before: "before",
|
|
545
|
+
/** DEFAULT — segment from the END; extended AFTER the last keyframe (idle/outro
|
|
546
|
+
* loops that continue once the main timeline has finished). */
|
|
547
|
+
after: "after"
|
|
548
|
+
};
|
|
549
|
+
var PxMaskType = {
|
|
550
|
+
luminance: "luminance",
|
|
551
|
+
alpha: "alpha"
|
|
552
|
+
};
|
|
553
|
+
var PxUnits = {
|
|
554
|
+
userSpaceOnUse: "userSpaceOnUse",
|
|
555
|
+
objectBoundingBox: "objectBoundingBox"
|
|
556
|
+
};
|
|
557
|
+
var PxCloneType = {
|
|
558
|
+
content: "content"
|
|
559
|
+
};
|
|
560
|
+
var PxPathOverflow = {
|
|
561
|
+
clip: "clip",
|
|
562
|
+
extend: "extend"
|
|
563
|
+
};
|
|
564
|
+
var PxLengthAdjust = {
|
|
565
|
+
spacing: "spacing",
|
|
566
|
+
spacingAndGlyphs: "spacingAndGlyphs"
|
|
567
|
+
};
|
|
568
|
+
var PxTextPathMethod = {
|
|
569
|
+
align: "align",
|
|
570
|
+
stretch: "stretch"
|
|
571
|
+
};
|
|
572
|
+
var PxTextPathSpacing = {
|
|
573
|
+
auto: "auto",
|
|
574
|
+
exact: "exact"
|
|
575
|
+
};
|
|
576
|
+
var PxTrimSubPaths = {
|
|
577
|
+
separate: "separate",
|
|
578
|
+
combined: "combined"
|
|
579
|
+
};
|
|
639
580
|
var TEXT_ATTR = "text";
|
|
640
581
|
var TEXT_CONTENT_ATTR = "textContent";
|
|
641
582
|
var INTERNAL_ATTRS = /* @__PURE__ */ new Set([
|
|
@@ -644,9 +585,47 @@ var PixodeskAnimator = (() => {
|
|
|
644
585
|
"animator",
|
|
645
586
|
"meta",
|
|
646
587
|
"animate",
|
|
588
|
+
"effects",
|
|
647
589
|
TEXT_ATTR,
|
|
648
590
|
TEXT_CONTENT_ATTR
|
|
649
591
|
]);
|
|
592
|
+
var PxGradientUnits = {
|
|
593
|
+
userSpaceOnUse: "userSpaceOnUse",
|
|
594
|
+
objectBoundingBox: "objectBoundingBox"
|
|
595
|
+
};
|
|
596
|
+
var PxGradientSpreadMethod = {
|
|
597
|
+
pad: "pad",
|
|
598
|
+
reflect: "reflect",
|
|
599
|
+
repeat: "repeat"
|
|
600
|
+
};
|
|
601
|
+
var PxGradientType = {
|
|
602
|
+
linear: "linear",
|
|
603
|
+
radial: "radial"
|
|
604
|
+
};
|
|
605
|
+
function isPxElementFileFormat(fileJson) {
|
|
606
|
+
if (!(fileJson && typeof fileJson === "object" && !Array.isArray(fileJson))) {
|
|
607
|
+
return false;
|
|
608
|
+
}
|
|
609
|
+
return fileJson["type"] === "svg";
|
|
610
|
+
}
|
|
611
|
+
function getAnimatorConfig(doc) {
|
|
612
|
+
var _a;
|
|
613
|
+
return (doc == null ? void 0 : doc.animator) || ((_a = doc == null ? void 0 : doc.meta) == null ? void 0 : _a.animator);
|
|
614
|
+
}
|
|
615
|
+
function getDefs(doc) {
|
|
616
|
+
var _a;
|
|
617
|
+
if (!doc) return void 0;
|
|
618
|
+
return (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.definitions;
|
|
619
|
+
}
|
|
620
|
+
function getBindings(doc) {
|
|
621
|
+
var _a;
|
|
622
|
+
if (!doc) return void 0;
|
|
623
|
+
const animateById = (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.animateById;
|
|
624
|
+
if (!animateById) return void 0;
|
|
625
|
+
return Object.entries(animateById).map(([id, anim]) => ({ id, animate: anim }));
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// ../svg-animator-core/src/PxAnimatorTypes.ts
|
|
650
629
|
var PxEasingOrRefSchema = px.union([
|
|
651
630
|
px.string(),
|
|
652
631
|
px.tuple([px.number(), px.number(), px.number(), px.number()])
|
|
@@ -658,13 +637,15 @@ var PixodeskAnimator = (() => {
|
|
|
658
637
|
px.array(px.number()),
|
|
659
638
|
px.lazy(() => PxTransformPartsSchema, {}),
|
|
660
639
|
px.object({ path: px.string() }),
|
|
661
|
-
px.lazy(() => px.object({ paths: px.array(PxBezierPathSchema) }), { paths: [] })
|
|
640
|
+
px.lazy(() => px.object({ paths: px.array(PxBezierPathSchema) }), { paths: [] }),
|
|
641
|
+
// Gradient `stops` timeline — each kf value is the full stops-array snapshot.
|
|
642
|
+
px.lazy(() => px.array(PxGradientStopSchema), [])
|
|
662
643
|
]));
|
|
663
644
|
var PxKeyframeSchema = implementsInterface()(px.object({
|
|
664
645
|
time: px.number().optional(),
|
|
665
646
|
t: px.number().optional(),
|
|
666
|
-
value:
|
|
667
|
-
v:
|
|
647
|
+
value: PxKeyframeValueSchema.optional(),
|
|
648
|
+
v: PxKeyframeValueSchema.optional(),
|
|
668
649
|
easing: PxEasingOrRefSchema.optional(),
|
|
669
650
|
e: PxEasingOrRefSchema.optional(),
|
|
670
651
|
tangentOut: px.tuple([px.number(), px.number()]).optional(),
|
|
@@ -678,16 +659,16 @@ var PixodeskAnimator = (() => {
|
|
|
678
659
|
}));
|
|
679
660
|
var PxLoopSchema = implementsInterface()(px.object({
|
|
680
661
|
segmentCount: px.number().optional(),
|
|
681
|
-
|
|
662
|
+
extend: px.enum([PxLoopExtend.before, PxLoopExtend.after]).optional(),
|
|
682
663
|
alternate: px.boolean().optional()
|
|
683
664
|
}));
|
|
684
665
|
var PxPropertyAnimationSchema = implementsInterface()(px.object({
|
|
666
|
+
value: PxKeyframeValueSchema.optional(),
|
|
685
667
|
keyframes: px.array(PxKeyframeSchema).optional(),
|
|
686
668
|
kfs: px.array(PxKeyframeSchema).optional(),
|
|
687
669
|
loop: px.union([PxLoopSchema, px.boolean()]).optional(),
|
|
688
670
|
autoOrient: px.boolean().optional()
|
|
689
671
|
}));
|
|
690
|
-
var PX_TRANSFORM_PART_KEYS = ["translate", "rotate", "scale", "origin"];
|
|
691
672
|
var PxTransformPartsSchema = implementsInterface()(px.object({
|
|
692
673
|
translate: px.tuple([px.number(), px.number()]).optional(),
|
|
693
674
|
rotate: px.number().optional(),
|
|
@@ -697,6 +678,7 @@ var PixodeskAnimator = (() => {
|
|
|
697
678
|
}));
|
|
698
679
|
var PxTransformValueSchema = px.union([
|
|
699
680
|
px.string(),
|
|
681
|
+
PxTransformPartsSchema,
|
|
700
682
|
px.object({ value: PxTransformPartsSchema }),
|
|
701
683
|
PxPropertyAnimationSchema
|
|
702
684
|
]);
|
|
@@ -731,9 +713,11 @@ var PixodeskAnimator = (() => {
|
|
|
731
713
|
glyphs: px.record(PxGlyphFontSchema).optional()
|
|
732
714
|
}));
|
|
733
715
|
var PxAnimatorConfigSchema = implementsInterface()(px.object({
|
|
734
|
-
mode: px.enum([PxAnimatorMode.auto, PxAnimatorMode.
|
|
716
|
+
mode: px.enum([PxAnimatorMode.auto, PxAnimatorMode.waapi, PxAnimatorMode.frames]).optional(),
|
|
735
717
|
duration: px.number().optional(),
|
|
736
718
|
delay: px.number().optional(),
|
|
719
|
+
// LAW (SCHEMA-DESIGN R3, S10): the ONE sanctioned string-in-number union
|
|
720
|
+
// (CSS animation-iteration-count familiarity) — do not add more mixed unions.
|
|
737
721
|
iterations: px.union([px.number(), px.literal("infinite")]).optional(),
|
|
738
722
|
fill: px.enum(["forwards", "backwards", "both", "none"]).optional(),
|
|
739
723
|
direction: px.enum(["normal", "reverse", "alternate", "alternate-reverse"]).optional(),
|
|
@@ -741,9 +725,8 @@ var PixodeskAnimator = (() => {
|
|
|
741
725
|
trigger: PxTriggerSchema.optional(),
|
|
742
726
|
resetOnFinish: px.boolean().optional(),
|
|
743
727
|
definitions: PxDefsSchema.optional(),
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
debug: px.boolean().optional(),
|
|
728
|
+
animateById: px.record(PxElementAnimationSchema).optional(),
|
|
729
|
+
timelineSource: px.string().optional(),
|
|
747
730
|
debugInstName: px.string().optional()
|
|
748
731
|
}));
|
|
749
732
|
var PxBindingSchema = implementsInterface()(px.object({
|
|
@@ -753,26 +736,29 @@ var PixodeskAnimator = (() => {
|
|
|
753
736
|
var PxAttrValueSchema = px.union([
|
|
754
737
|
px.string(),
|
|
755
738
|
px.number(),
|
|
756
|
-
px.
|
|
757
|
-
|
|
739
|
+
px.array(px.number()),
|
|
740
|
+
// Structured static — `{value: …}` (read-accepted transitional spelling, S1).
|
|
741
|
+
// `defined`, not `any`: the KEY's presence is what identifies this branch (V6).
|
|
742
|
+
px.object({ value: px.defined() }),
|
|
743
|
+
// Bare transform parts record — the canonical static `transform` on the wire (T2).
|
|
744
|
+
PxTransformPartsSchema
|
|
758
745
|
]);
|
|
759
746
|
var PxAnimatableNumberSchema = px.union([
|
|
760
747
|
px.number(),
|
|
761
748
|
px.object({ value: px.number() }),
|
|
762
|
-
|
|
763
|
-
keyframes: px.array(PxKeyframeSchema),
|
|
764
|
-
autoOrient: px.boolean().optional()
|
|
765
|
-
})
|
|
749
|
+
PxPropertyAnimationSchema
|
|
766
750
|
]);
|
|
767
751
|
var PxAnimatableVec2Schema = px.union([
|
|
768
752
|
px.tuple([px.number(), px.number()]),
|
|
769
753
|
px.object({ value: px.tuple([px.number(), px.number()]) }),
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
754
|
+
PxPropertyAnimationSchema
|
|
755
|
+
]);
|
|
756
|
+
var PxAnimatableStringSchema = px.union([
|
|
757
|
+
px.string(),
|
|
758
|
+
px.object({ value: px.string() }),
|
|
759
|
+
PxPropertyAnimationSchema
|
|
774
760
|
]);
|
|
775
|
-
var
|
|
761
|
+
var PxTransformByEffectSchema = implementsInterface()(px.object({
|
|
776
762
|
translate: PxAnimatableVec2Schema.optional(),
|
|
777
763
|
rotate: PxAnimatableNumberSchema.optional(),
|
|
778
764
|
scale: PxAnimatableVec2Schema.optional(),
|
|
@@ -780,51 +766,46 @@ var PixodeskAnimator = (() => {
|
|
|
780
766
|
origin: PxAnimatableVec2Schema.optional()
|
|
781
767
|
}));
|
|
782
768
|
var PxRepeaterEffectSchema = implementsInterface()(px.object({
|
|
769
|
+
// STATIC config, not a channel (V2/SCHEMA-DESIGN R5): the copy COUNT is read
|
|
770
|
+
// once at expansion time and never sampled — plain number, no `keyframes`.
|
|
783
771
|
copies: px.number().optional(),
|
|
784
772
|
translate: PxAnimatableVec2Schema.optional(),
|
|
785
773
|
rotate: PxAnimatableNumberSchema.optional(),
|
|
774
|
+
skew: PxAnimatableNumberSchema.optional(),
|
|
786
775
|
scale: PxAnimatableVec2Schema.optional(),
|
|
787
776
|
origin: PxAnimatableVec2Schema.optional()
|
|
788
777
|
}));
|
|
789
778
|
var PxMaskedByEffectSchema = implementsInterface()(px.object({
|
|
790
|
-
|
|
791
|
-
maskType: px.
|
|
792
|
-
maskUnits: px.
|
|
793
|
-
maskContentUnits: px.
|
|
779
|
+
sourceId: px.string().optional(),
|
|
780
|
+
maskType: px.enum([PxMaskType.luminance, PxMaskType.alpha]).optional(),
|
|
781
|
+
maskUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
|
|
782
|
+
maskContentUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
|
|
783
|
+
x: px.number().optional(),
|
|
784
|
+
y: px.number().optional(),
|
|
785
|
+
width: px.number().optional(),
|
|
786
|
+
height: px.number().optional()
|
|
794
787
|
}));
|
|
795
788
|
var PxClipPathEffectSchema = implementsInterface()(px.object({
|
|
796
|
-
d:
|
|
789
|
+
d: PxAnimatableStringSchema.optional(),
|
|
797
790
|
animate: PxPropertyAnimationSchema.optional()
|
|
798
791
|
}));
|
|
799
792
|
var PxTrimPathEffectSchema = implementsInterface()(px.object({
|
|
800
793
|
offset: PxAnimatableNumberSchema.optional(),
|
|
801
794
|
range: PxAnimatableVec2Schema.optional(),
|
|
802
|
-
|
|
795
|
+
subPaths: px.enum([PxTrimSubPaths.separate, PxTrimSubPaths.combined]).optional()
|
|
803
796
|
}));
|
|
804
797
|
var PxRetimeEffectSchema = implementsInterface()(px.object({
|
|
805
|
-
|
|
798
|
+
sourceId: px.string().optional(),
|
|
806
799
|
start: px.number().optional(),
|
|
807
800
|
stretch: px.number().optional(),
|
|
808
801
|
timeCrop: px.tuple([px.number(), px.number()]).optional()
|
|
809
802
|
}));
|
|
810
803
|
var PxCloneEffectSchema = implementsInterface()(px.object({
|
|
811
|
-
type
|
|
812
|
-
|
|
804
|
+
// Contextual kind — the `type` convention, see `PxNodeBase.type`.
|
|
805
|
+
type: px.enum([PxCloneType.content]).optional(),
|
|
806
|
+
sourceId: px.string().optional(),
|
|
813
807
|
retime: PxRetimeEffectSchema.optional()
|
|
814
808
|
}));
|
|
815
|
-
var PxGradientUnits = {
|
|
816
|
-
userSpaceOnUse: "userSpaceOnUse",
|
|
817
|
-
objectBoundingBox: "objectBoundingBox"
|
|
818
|
-
};
|
|
819
|
-
var PxGradientSpreadMethod = {
|
|
820
|
-
pad: "pad",
|
|
821
|
-
reflect: "reflect",
|
|
822
|
-
repeat: "repeat"
|
|
823
|
-
};
|
|
824
|
-
var PxGradientType = {
|
|
825
|
-
linear: "linear",
|
|
826
|
-
radial: "radial"
|
|
827
|
-
};
|
|
828
809
|
var PxGradientStopSchema = implementsInterface()(px.object({
|
|
829
810
|
offset: px.number(),
|
|
830
811
|
color: px.string()
|
|
@@ -832,39 +813,28 @@ var PixodeskAnimator = (() => {
|
|
|
832
813
|
var PxAnimatableGradientStopsSchema = px.union([
|
|
833
814
|
px.array(PxGradientStopSchema),
|
|
834
815
|
px.object({ value: px.array(PxGradientStopSchema) }),
|
|
835
|
-
|
|
816
|
+
PxPropertyAnimationSchema
|
|
836
817
|
]);
|
|
837
|
-
var PxGradientGeometryAnimationSchema = implementsInterface()(px.object({
|
|
838
|
-
gradientX1: PxPropertyAnimationSchema.optional(),
|
|
839
|
-
gradientY1: PxPropertyAnimationSchema.optional(),
|
|
840
|
-
gradientX2: PxPropertyAnimationSchema.optional(),
|
|
841
|
-
gradientY2: PxPropertyAnimationSchema.optional(),
|
|
842
|
-
gradientCx: PxPropertyAnimationSchema.optional(),
|
|
843
|
-
gradientCy: PxPropertyAnimationSchema.optional(),
|
|
844
|
-
gradientFx: PxPropertyAnimationSchema.optional(),
|
|
845
|
-
gradientFy: PxPropertyAnimationSchema.optional(),
|
|
846
|
-
gradientR: PxPropertyAnimationSchema.optional()
|
|
847
|
-
}));
|
|
848
818
|
var PxFillGradientEffectSchema = implementsInterface()(px.object({
|
|
819
|
+
// Contextual kind — the `type` convention, see `PxNodeBase.type`.
|
|
849
820
|
type: px.enum([PxGradientType.linear, PxGradientType.radial]),
|
|
850
|
-
p1:
|
|
851
|
-
p2:
|
|
852
|
-
c:
|
|
853
|
-
r:
|
|
854
|
-
fp:
|
|
821
|
+
p1: PxAnimatableVec2Schema.optional(),
|
|
822
|
+
p2: PxAnimatableVec2Schema.optional(),
|
|
823
|
+
c: PxAnimatableVec2Schema.optional(),
|
|
824
|
+
r: PxAnimatableNumberSchema.optional(),
|
|
825
|
+
fp: PxAnimatableVec2Schema.optional(),
|
|
855
826
|
stops: PxAnimatableGradientStopsSchema.optional(),
|
|
856
|
-
gradientUnits: px.
|
|
857
|
-
spreadMethod: px.
|
|
858
|
-
gradientTransform: px.string().optional()
|
|
859
|
-
animate: PxGradientGeometryAnimationSchema.optional()
|
|
827
|
+
gradientUnits: px.enum([PxGradientUnits.userSpaceOnUse, PxGradientUnits.objectBoundingBox]).optional(),
|
|
828
|
+
spreadMethod: px.enum([PxGradientSpreadMethod.pad, PxGradientSpreadMethod.reflect, PxGradientSpreadMethod.repeat]).optional(),
|
|
829
|
+
gradientTransform: px.string().optional()
|
|
860
830
|
}));
|
|
861
831
|
var PxStrokeGradientEffectSchema = PxFillGradientEffectSchema;
|
|
862
832
|
var PxTextPathEffectSchema = implementsInterface()(px.object({
|
|
863
833
|
path: px.string(),
|
|
864
|
-
pathOverflow: px.
|
|
865
|
-
lengthAdjust: px.
|
|
866
|
-
method: px.
|
|
867
|
-
spacing: px.
|
|
834
|
+
pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend]).optional(),
|
|
835
|
+
lengthAdjust: px.enum([PxLengthAdjust.spacing, PxLengthAdjust.spacingAndGlyphs]).optional(),
|
|
836
|
+
method: px.enum([PxTextPathMethod.align, PxTextPathMethod.stretch]).optional(),
|
|
837
|
+
spacing: px.enum([PxTextPathSpacing.auto, PxTextPathSpacing.exact]).optional(),
|
|
868
838
|
startOffset: PxAnimatableNumberSchema.optional(),
|
|
869
839
|
textLength: PxAnimatableNumberSchema.optional()
|
|
870
840
|
}));
|
|
@@ -872,13 +842,12 @@ var PixodeskAnimator = (() => {
|
|
|
872
842
|
useGlyphs: px.boolean().optional()
|
|
873
843
|
}));
|
|
874
844
|
var PxEffectsSchema = implementsInterface()(px.object({
|
|
875
|
-
|
|
845
|
+
transformBy: PxTransformByEffectSchema.optional(),
|
|
876
846
|
repeater: PxRepeaterEffectSchema.optional(),
|
|
877
847
|
maskedBy: PxMaskedByEffectSchema.optional(),
|
|
878
848
|
clipPath: PxClipPathEffectSchema.optional(),
|
|
879
849
|
trimPath: PxTrimPathEffectSchema.optional(),
|
|
880
850
|
clone: PxCloneEffectSchema.optional(),
|
|
881
|
-
isCombinedShape: px.boolean().optional(),
|
|
882
851
|
fillGradient: PxFillGradientEffectSchema.optional(),
|
|
883
852
|
strokeGradient: PxStrokeGradientEffectSchema.optional(),
|
|
884
853
|
textPath: PxTextPathEffectSchema.optional(),
|
|
@@ -902,6 +871,14 @@ var PixodeskAnimator = (() => {
|
|
|
902
871
|
return warnings;
|
|
903
872
|
}
|
|
904
873
|
var PxNodeBase = px.openObject({
|
|
874
|
+
// CONVENTION (SCHEMA-DESIGN R1 / issues N4): `type` is the ONE word for "what
|
|
875
|
+
// kind of thing is this", discriminated by its CARRIER — here the node TAG
|
|
876
|
+
// (`rect`, `text`), and inside a sub-object that object's kind (`clone.type`,
|
|
877
|
+
// `fillGradient.type`, editor `preset.type`). Each sits in its own object, so
|
|
878
|
+
// the carrier disambiguates completely; synonyms (`cloneKind`, `presetShape`)
|
|
879
|
+
// would add words that all mean "type" and still need the carrier to read.
|
|
880
|
+
// Guarding a `type` SLOT against a wrong VALUE is the job of strict enums
|
|
881
|
+
// (issues V3), never of distinct key names.
|
|
905
882
|
type: px.string(),
|
|
906
883
|
id: px.string().optional(),
|
|
907
884
|
meta: px.any().optional(),
|
|
@@ -911,20 +888,22 @@ var PixodeskAnimator = (() => {
|
|
|
911
888
|
effects: PxEffectsSchema.optional(),
|
|
912
889
|
// `PxElementAnimation` (not just `PxAnimationDefinition`) — accepts
|
|
913
890
|
// string ref / array of refs / inline definition / mixed array; mirrors
|
|
914
|
-
// `animator.
|
|
891
|
+
// `animator.animateById` map values and what `processNode` resolves at runtime.
|
|
915
892
|
animate: PxElementAnimationSchema.optional(),
|
|
916
893
|
style: px.union([px.string(), px.record(px.union([px.string(), px.number()]))]).optional()
|
|
917
894
|
}, PxAttrValueSchema);
|
|
918
|
-
var PxNodeSchema = px.openObject(
|
|
895
|
+
var PxNodeSchema = px.openObject(__spreadProps(__spreadValues({}, PxNodeBase._shape), {
|
|
919
896
|
children: px.lazy(() => px.array(PxNodeSchema), []).optional()
|
|
920
897
|
}), PxAttrValueSchema);
|
|
921
898
|
var PxSvgNodeExtra = px.object({
|
|
922
|
-
|
|
923
|
-
|
|
899
|
+
// `"100%"` and other SVG length strings are legal here — a number-only slot rejected
|
|
900
|
+
// real documents (e.g. apple-store-look-14-main.json) at the root <svg>.
|
|
901
|
+
width: px.union([px.number(), px.string()]).optional(),
|
|
902
|
+
height: px.union([px.number(), px.string()]).optional(),
|
|
924
903
|
viewBox: px.string().optional(),
|
|
925
904
|
animator: PxAnimatorConfigSchema.optional()
|
|
926
905
|
});
|
|
927
|
-
var PxAnimatedSvgDocumentSchema = px.openObject(
|
|
906
|
+
var PxAnimatedSvgDocumentSchema = px.openObject(__spreadProps(__spreadValues(__spreadValues({}, PxNodeBase._shape), PxSvgNodeExtra._shape), {
|
|
928
907
|
type: px.literal("svg"),
|
|
929
908
|
// override string → literal to require 'svg'
|
|
930
909
|
children: px.array(PxNodeSchema).optional()
|
|
@@ -935,35 +914,8 @@ var PixodeskAnimator = (() => {
|
|
|
935
914
|
o: px.array(px.array(px.number())).optional(),
|
|
936
915
|
c: px.boolean().optional()
|
|
937
916
|
}));
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
return false;
|
|
941
|
-
}
|
|
942
|
-
return fileJson["type"] === "svg" || fileJson["tagName"] === "svg";
|
|
943
|
-
}
|
|
944
|
-
function isPxElementFileFormatDeep(fileJson) {
|
|
945
|
-
const valid = PxAnimatedSvgDocumentSchema.isValid(fileJson);
|
|
946
|
-
return { valid, errors: valid ? [] : ["Document failed schema validation"] };
|
|
947
|
-
}
|
|
948
|
-
function getAnimatorConfig(doc) {
|
|
949
|
-
var _a, _b;
|
|
950
|
-
return (doc == null ? void 0 : doc.animator) || ((_a = doc == null ? void 0 : doc.meta) == null ? void 0 : _a.animator) || (doc == null ? void 0 : doc.animation) || ((_b = doc == null ? void 0 : doc.meta) == null ? void 0 : _b.animation);
|
|
951
|
-
}
|
|
952
|
-
function getDefs(doc) {
|
|
953
|
-
var _a;
|
|
954
|
-
if (!doc) return void 0;
|
|
955
|
-
return (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.definitions;
|
|
956
|
-
}
|
|
957
|
-
function getBindings(doc) {
|
|
958
|
-
var _a;
|
|
959
|
-
if (!doc) return void 0;
|
|
960
|
-
const animate = (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.animate;
|
|
961
|
-
if (!animate) return void 0;
|
|
962
|
-
return Object.entries(animate).map(([id, anim]) => ({ id, animate: anim }));
|
|
963
|
-
}
|
|
964
|
-
function getChildren(doc) {
|
|
965
|
-
return doc == null ? void 0 : doc.children;
|
|
966
|
-
}
|
|
917
|
+
|
|
918
|
+
// ../svg-animator-core/src/PxAnimatorUtil.ts
|
|
967
919
|
function bezierToSvgPath(path, forceCurves = false) {
|
|
968
920
|
var _a, _b, _c, _d;
|
|
969
921
|
const v = path.v;
|
|
@@ -1378,6 +1330,8 @@ var PixodeskAnimator = (() => {
|
|
|
1378
1330
|
const flipped = [easing[1], easing[0], easing[3], easing[2]];
|
|
1379
1331
|
return cubicBezier(flipped);
|
|
1380
1332
|
}
|
|
1333
|
+
|
|
1334
|
+
// ../svg-animator-core/src/PxIdUtil.ts
|
|
1381
1335
|
var _idCounter = 0;
|
|
1382
1336
|
function generateUniqueId() {
|
|
1383
1337
|
const timestamp = Date.now().toString(36);
|
|
@@ -1414,7 +1368,7 @@ var PixodeskAnimator = (() => {
|
|
|
1414
1368
|
"flood-color",
|
|
1415
1369
|
"lighting-color"
|
|
1416
1370
|
]);
|
|
1417
|
-
const directIdRefAttrs = /* @__PURE__ */ new Set(["
|
|
1371
|
+
const directIdRefAttrs = /* @__PURE__ */ new Set(["sourceId", "targetId", "boundElementId"]);
|
|
1418
1372
|
function collectIds(node) {
|
|
1419
1373
|
if (!node || typeof node !== "object") return;
|
|
1420
1374
|
if (node.id && typeof node.id === "string") {
|
|
@@ -1452,9 +1406,10 @@ var PixodeskAnimator = (() => {
|
|
|
1452
1406
|
} else if (urlRefAttrs.has(key)) {
|
|
1453
1407
|
node[key] = replaceUrlRefs(value, idMap);
|
|
1454
1408
|
} else if (directIdRefAttrs.has(key)) {
|
|
1455
|
-
const
|
|
1409
|
+
const hasHash = value.startsWith("#");
|
|
1410
|
+
const newId = idMap.get(hasHash ? value.slice(1) : value);
|
|
1456
1411
|
if (newId) {
|
|
1457
|
-
node[key] = newId;
|
|
1412
|
+
node[key] = hasHash ? "#" + newId : newId;
|
|
1458
1413
|
}
|
|
1459
1414
|
} else if (value.includes("url(#")) {
|
|
1460
1415
|
node[key] = replaceUrlRefs(value, idMap);
|
|
@@ -1472,14 +1427,14 @@ var PixodeskAnimator = (() => {
|
|
|
1472
1427
|
}
|
|
1473
1428
|
collectIds(cloned);
|
|
1474
1429
|
updateRefs(cloned);
|
|
1475
|
-
const docAnimate = (_a = cloned.animator) == null ? void 0 : _a.
|
|
1430
|
+
const docAnimate = (_a = cloned.animator) == null ? void 0 : _a.animateById;
|
|
1476
1431
|
if (docAnimate && typeof docAnimate === "object") {
|
|
1477
1432
|
const updatedAnimate = {};
|
|
1478
1433
|
for (const [id, anim] of Object.entries(docAnimate)) {
|
|
1479
1434
|
const newId = (_b = idMap.get(id)) != null ? _b : id;
|
|
1480
1435
|
updatedAnimate[newId] = anim;
|
|
1481
1436
|
}
|
|
1482
|
-
cloned.animator =
|
|
1437
|
+
cloned.animator = __spreadProps(__spreadValues({}, cloned.animator), { animateById: updatedAnimate });
|
|
1483
1438
|
}
|
|
1484
1439
|
return cloned;
|
|
1485
1440
|
}
|
|
@@ -1489,6 +1444,8 @@ var PixodeskAnimator = (() => {
|
|
|
1489
1444
|
return newId ? "url(#" + newId + ")" : match;
|
|
1490
1445
|
});
|
|
1491
1446
|
}
|
|
1447
|
+
|
|
1448
|
+
// ../svg-animator-core/src/PxNodeProps.ts
|
|
1492
1449
|
var DISALLOWED_SVG_TAGS_LOWER = /* @__PURE__ */ new Set([
|
|
1493
1450
|
"script",
|
|
1494
1451
|
"foreignobject"
|
|
@@ -1568,8 +1525,9 @@ var PixodeskAnimator = (() => {
|
|
|
1568
1525
|
let value = props[rawKey];
|
|
1569
1526
|
if (COLOUR_ATTR_NAMES.has(key) && Array.isArray(value)) {
|
|
1570
1527
|
propsCopy[key] = toRGBA(value);
|
|
1571
|
-
} else if (key === "transform" && value !== null && typeof value === "object" && !Array.isArray(value) && value.
|
|
1572
|
-
|
|
1528
|
+
} else if (key === "transform" && value !== null && typeof value === "object" && !Array.isArray(value) && !value.keyframes && !value.kfs) {
|
|
1529
|
+
const parts = value.value && typeof value.value === "object" ? value.value : value;
|
|
1530
|
+
propsCopy["transform"] = composeTransformParts(parts, { withUnits: false });
|
|
1573
1531
|
} else if (TRANSFORM_FN_NAMES.has(key)) {
|
|
1574
1532
|
if (Array.isArray(value)) {
|
|
1575
1533
|
if (key === "translate") value = value.map((v) => v + "px");
|
|
@@ -1577,12 +1535,16 @@ var PixodeskAnimator = (() => {
|
|
|
1577
1535
|
}
|
|
1578
1536
|
if (key === "rotate") value = value + "deg";
|
|
1579
1537
|
propsCopy["transform"] = key + "(" + value + ")";
|
|
1538
|
+
} else if (Array.isArray(value)) {
|
|
1539
|
+
propsCopy[key] = value.join(",");
|
|
1580
1540
|
} else if (value !== void 0 && value !== null) {
|
|
1581
1541
|
propsCopy[key] = String(value);
|
|
1582
1542
|
}
|
|
1583
1543
|
}
|
|
1584
1544
|
return propsCopy;
|
|
1585
1545
|
}
|
|
1546
|
+
|
|
1547
|
+
// ../svg-animator-core/src/PxMotionPath.ts
|
|
1586
1548
|
function getKfTranslate(kf) {
|
|
1587
1549
|
var _a;
|
|
1588
1550
|
const v = (_a = kf.value) != null ? _a : kf.v;
|
|
@@ -1964,16 +1926,28 @@ var PixodeskAnimator = (() => {
|
|
|
1964
1926
|
if (transformAnim && typeof transformAnim === "object" && propAnimIsMotionPath(transformAnim)) {
|
|
1965
1927
|
const materialised = materialiseMotionPathInPropAnim(transformAnim, opts);
|
|
1966
1928
|
if (materialised !== transformAnim) {
|
|
1967
|
-
newAnimate =
|
|
1929
|
+
newAnimate = __spreadProps(__spreadValues({}, animDef), { transform: materialised });
|
|
1968
1930
|
}
|
|
1969
1931
|
}
|
|
1970
1932
|
}
|
|
1971
1933
|
if (!newChildren && !newAnimate) return null;
|
|
1972
|
-
const cloned =
|
|
1934
|
+
const cloned = __spreadValues({}, node);
|
|
1973
1935
|
if (newChildren) cloned.children = newChildren;
|
|
1974
1936
|
if (newAnimate) cloned.animate = newAnimate;
|
|
1975
1937
|
return cloned;
|
|
1976
1938
|
}
|
|
1939
|
+
|
|
1940
|
+
// ../svg-animator-core/src/PxDefinitions.ts
|
|
1941
|
+
var LOOP_JUMP_SHIFT_MS = 1;
|
|
1942
|
+
function deepEqualValue(a, b) {
|
|
1943
|
+
if (a === b) return true;
|
|
1944
|
+
if (typeof a !== typeof b || a === null || b === null || typeof a !== "object") return false;
|
|
1945
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
1946
|
+
const ka = Object.keys(a);
|
|
1947
|
+
const kb = Object.keys(b);
|
|
1948
|
+
if (ka.length !== kb.length) return false;
|
|
1949
|
+
return ka.every((k) => deepEqualValue(a[k], b[k]));
|
|
1950
|
+
}
|
|
1977
1951
|
function parsePathCommands(d) {
|
|
1978
1952
|
const tokens = d.split(/([MLCZmlcz]|[\s,]+)/).map((t) => t.trim()).filter((t) => t && t !== ",");
|
|
1979
1953
|
const commands = [];
|
|
@@ -2176,7 +2150,7 @@ var PixodeskAnimator = (() => {
|
|
|
2176
2150
|
const totalIntervals = keyframes.length - 1;
|
|
2177
2151
|
const segCount = clamp((_a = loop.segmentCount) != null ? _a : totalIntervals, 1, totalIntervals);
|
|
2178
2152
|
let segKfs;
|
|
2179
|
-
if (loop.before) {
|
|
2153
|
+
if (loop.extend === PxLoopExtend.before) {
|
|
2180
2154
|
segKfs = keyframes.slice(0, segCount + 1);
|
|
2181
2155
|
} else {
|
|
2182
2156
|
segKfs = keyframes.slice(totalIntervals - segCount);
|
|
@@ -2184,7 +2158,7 @@ var PixodeskAnimator = (() => {
|
|
|
2184
2158
|
const firstT = (_b = keyframes[0].t) != null ? _b : 0;
|
|
2185
2159
|
const lastT = (_c = keyframes[keyframes.length - 1].t) != null ? _c : 0;
|
|
2186
2160
|
let fillStart, fillEnd;
|
|
2187
|
-
if (loop.before) {
|
|
2161
|
+
if (loop.extend === PxLoopExtend.before) {
|
|
2188
2162
|
fillStart = 0;
|
|
2189
2163
|
fillEnd = firstT;
|
|
2190
2164
|
} else {
|
|
@@ -2211,7 +2185,12 @@ var PixodeskAnimator = (() => {
|
|
|
2211
2185
|
const remainder = fillDuration - fullReps * segDuration;
|
|
2212
2186
|
const partialFraction = remainder / segDuration;
|
|
2213
2187
|
const looped = [];
|
|
2188
|
+
const separateBoundary = loop.extend !== PxLoopExtend.before;
|
|
2189
|
+
const originalTerminalKf = keyframes[keyframes.length - 1];
|
|
2190
|
+
let terminalEasingOverride;
|
|
2191
|
+
let hasTerminalEasingOverride = false;
|
|
2214
2192
|
function appendRep(repStart, isReversed, partial) {
|
|
2193
|
+
var _a2;
|
|
2215
2194
|
let entries;
|
|
2216
2195
|
if (isReversed) {
|
|
2217
2196
|
entries = [];
|
|
@@ -2247,8 +2226,26 @@ var PixodeskAnimator = (() => {
|
|
|
2247
2226
|
looped.push({ t: repStart + cutRelT * segDuration, v: cutValue, e: void 0 });
|
|
2248
2227
|
return;
|
|
2249
2228
|
}
|
|
2229
|
+
const prevKf = looped.length > 0 ? looped[looped.length - 1] : originalTerminalKf;
|
|
2230
|
+
const isBoundary = separateBoundary && i === 0 && prevKf !== void 0 && Math.abs(((_a2 = prevKf.t) != null ? _a2 : 0) - (repStart + entry.relT * segDuration)) < 1e-9;
|
|
2231
|
+
if (isBoundary) {
|
|
2232
|
+
if (deepEqualValue(prevKf.v, entry.v)) {
|
|
2233
|
+
if (looped.length > 0) {
|
|
2234
|
+
prevKf.e = entry.e;
|
|
2235
|
+
prevKf.tangentOut = entry.tangentOut;
|
|
2236
|
+
} else {
|
|
2237
|
+
terminalEasingOverride = entry.e;
|
|
2238
|
+
hasTerminalEasingOverride = true;
|
|
2239
|
+
}
|
|
2240
|
+
continue;
|
|
2241
|
+
}
|
|
2242
|
+
if (looped.length > 0) {
|
|
2243
|
+
delete prevKf.tangentIn;
|
|
2244
|
+
delete prevKf.tangentOut;
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2250
2247
|
const pushed = {
|
|
2251
|
-
t: repStart + entry.relT * segDuration,
|
|
2248
|
+
t: repStart + entry.relT * segDuration + (isBoundary ? LOOP_JUMP_SHIFT_MS : 0),
|
|
2252
2249
|
v: entry.v,
|
|
2253
2250
|
e: i < entries.length - 1 ? entry.e : void 0
|
|
2254
2251
|
};
|
|
@@ -2296,7 +2293,7 @@ var PixodeskAnimator = (() => {
|
|
|
2296
2293
|
looped.push(pushed);
|
|
2297
2294
|
}
|
|
2298
2295
|
}
|
|
2299
|
-
if (loop.before) {
|
|
2296
|
+
if (loop.extend === PxLoopExtend.before) {
|
|
2300
2297
|
if (partialFraction > 1e-9) {
|
|
2301
2298
|
const isReversed = !!loop.alternate && fullReps % 2 === 0;
|
|
2302
2299
|
appendRepTail(fillStart, isReversed, partialFraction);
|
|
@@ -2319,9 +2316,14 @@ var PixodeskAnimator = (() => {
|
|
|
2319
2316
|
appendRep(repStart, isReversed, partialFraction);
|
|
2320
2317
|
}
|
|
2321
2318
|
}
|
|
2322
|
-
if (loop.before) {
|
|
2319
|
+
if (loop.extend === PxLoopExtend.before) {
|
|
2323
2320
|
return [...looped, ...keyframes];
|
|
2324
2321
|
} else {
|
|
2322
|
+
if (hasTerminalEasingOverride && keyframes.length > 0) {
|
|
2323
|
+
const head = keyframes.slice(0, -1);
|
|
2324
|
+
const tail = __spreadProps(__spreadValues({}, keyframes[keyframes.length - 1]), { e: terminalEasingOverride });
|
|
2325
|
+
return [...head, tail, ...looped];
|
|
2326
|
+
}
|
|
2325
2327
|
return [...keyframes, ...looped];
|
|
2326
2328
|
}
|
|
2327
2329
|
}
|
|
@@ -2420,13 +2422,13 @@ var PixodeskAnimator = (() => {
|
|
|
2420
2422
|
const propAnim = animDef[propName];
|
|
2421
2423
|
const materialised = materialiseInternalLoopsInPropAnim(propName, propAnim, duration);
|
|
2422
2424
|
if (materialised !== propAnim) {
|
|
2423
|
-
if (!newAnimate) newAnimate =
|
|
2425
|
+
if (!newAnimate) newAnimate = __spreadValues({}, animDef);
|
|
2424
2426
|
newAnimate[propName] = materialised;
|
|
2425
2427
|
}
|
|
2426
2428
|
}
|
|
2427
2429
|
}
|
|
2428
2430
|
if (!newChildren && !newAnimate) return null;
|
|
2429
|
-
const cloned =
|
|
2431
|
+
const cloned = __spreadValues({}, node);
|
|
2430
2432
|
if (newChildren) cloned.children = newChildren;
|
|
2431
2433
|
if (newAnimate) cloned.animate = newAnimate;
|
|
2432
2434
|
return cloned;
|
|
@@ -2435,20 +2437,23 @@ var PixodeskAnimator = (() => {
|
|
|
2435
2437
|
function generateElementId() {
|
|
2436
2438
|
return "_px_el_" + ++_elementIdCounter;
|
|
2437
2439
|
}
|
|
2438
|
-
function normalizeAnimationDefinition(animDef, duration, defs, engine = PxAnimatorEngine.
|
|
2440
|
+
function normalizeAnimationDefinition(animDef, duration, defs, engine = PxAnimatorEngine.waapi) {
|
|
2439
2441
|
const normalized = {};
|
|
2440
2442
|
for (const [propName, propAnim] of Object.entries(animDef)) {
|
|
2443
|
+
if (propName === "transform" && propAnim.alongPathMode === "offsetPath" && animDef["offsetDistance"] !== void 0) {
|
|
2444
|
+
continue;
|
|
2445
|
+
}
|
|
2441
2446
|
const normalizedKfs = normalizeKeyframes(propName, propAnim, duration, defs);
|
|
2442
2447
|
if (normalizedKfs.length > 0) {
|
|
2443
2448
|
const out = { kfs: normalizedKfs };
|
|
2444
2449
|
if (propAnim.autoOrient !== void 0) out.autoOrient = propAnim.autoOrient;
|
|
2445
2450
|
if (propAnim.loop !== void 0) out.loop = propAnim.loop;
|
|
2446
|
-
normalized[propName] = engine === PxAnimatorEngine.
|
|
2451
|
+
normalized[propName] = engine === PxAnimatorEngine.waapi && propName === "transform" ? materialiseMotionPathInPropAnim(out) : out;
|
|
2447
2452
|
}
|
|
2448
2453
|
}
|
|
2449
2454
|
return normalized;
|
|
2450
2455
|
}
|
|
2451
|
-
function getNormalisedBindings(doc, engine = PxAnimatorEngine.
|
|
2456
|
+
function getNormalisedBindings(doc, engine = PxAnimatorEngine.waapi) {
|
|
2452
2457
|
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
2453
2458
|
const defs = getDefs(doc);
|
|
2454
2459
|
const duration = animatorConfig.duration || 1e3;
|
|
@@ -2613,12 +2618,12 @@ var PixodeskAnimator = (() => {
|
|
|
2613
2618
|
cssValue = "scale(" + v.join(",") + ")";
|
|
2614
2619
|
cssAttrName = "transform";
|
|
2615
2620
|
} else {
|
|
2616
|
-
const
|
|
2621
|
+
const num = interpolateNum(
|
|
2617
2622
|
+(prevV || 0),
|
|
2618
2623
|
+(nextV || 0),
|
|
2619
2624
|
localProgress
|
|
2620
2625
|
);
|
|
2621
|
-
cssValue =
|
|
2626
|
+
cssValue = num;
|
|
2622
2627
|
}
|
|
2623
2628
|
if (PCT_BASED_ATTR_NAMES.has(cssAttrName) && typeof cssValue === "number") {
|
|
2624
2629
|
cssValue = cssValue * 100 + "%";
|
|
@@ -2635,6 +2640,8 @@ var PixodeskAnimator = (() => {
|
|
|
2635
2640
|
}
|
|
2636
2641
|
return result;
|
|
2637
2642
|
}
|
|
2643
|
+
|
|
2644
|
+
// ../svg-animator-core/src/PxNodeCloneUtil.ts
|
|
2638
2645
|
function deepClonePxNode(value) {
|
|
2639
2646
|
if (value === null || typeof value !== "object") return value;
|
|
2640
2647
|
if (Array.isArray(value)) return value.map(deepClonePxNode);
|
|
@@ -2697,6 +2704,8 @@ var PixodeskAnimator = (() => {
|
|
|
2697
2704
|
}
|
|
2698
2705
|
return gNode;
|
|
2699
2706
|
}
|
|
2707
|
+
|
|
2708
|
+
// ../svg-animator-core/src/PxAnimatorUseMaterialiser.ts
|
|
2700
2709
|
function materialiseAnimatedUseInstances(root) {
|
|
2701
2710
|
var _a;
|
|
2702
2711
|
const idMap = buildIdMap(root);
|
|
@@ -2710,7 +2719,7 @@ var PixodeskAnimator = (() => {
|
|
|
2710
2719
|
if (defsCollector.length === 0) return walked;
|
|
2711
2720
|
const defsNode = { type: "defs", children: defsCollector };
|
|
2712
2721
|
const newChildren = [...(_a = walked.children) != null ? _a : [], defsNode];
|
|
2713
|
-
return
|
|
2722
|
+
return __spreadProps(__spreadValues({}, walked), { children: newChildren });
|
|
2714
2723
|
}
|
|
2715
2724
|
function readRootViewport(root) {
|
|
2716
2725
|
const vb = parseViewBox(root.viewBox);
|
|
@@ -2788,7 +2797,7 @@ var PixodeskAnimator = (() => {
|
|
|
2788
2797
|
const useH = (_d = (_c = numericAttr(useNode.height)) != null ? _c : symbolViewBox == null ? void 0 : symbolViewBox[3]) != null ? _d : rootViewport[1];
|
|
2789
2798
|
const rewrittenClone = clone2.type === "symbol" ? rewriteSymbolRootToGroup(clone2, genId3, defsCollector, useW, useH) : clone2;
|
|
2790
2799
|
const materialisedClone = walkAndMaterialise2(rewrittenClone, idMap, animatedIds, genId3, defsCollector, rootViewport);
|
|
2791
|
-
const newNode =
|
|
2800
|
+
const newNode = __spreadProps(__spreadValues({}, useNode), { type: "g", children: [materialisedClone] });
|
|
2792
2801
|
delete newNode.href;
|
|
2793
2802
|
delete newNode.width;
|
|
2794
2803
|
delete newNode.height;
|
|
@@ -2796,7 +2805,7 @@ var PixodeskAnimator = (() => {
|
|
|
2796
2805
|
}
|
|
2797
2806
|
function rewriteSymbolRootToGroup(symbolNode, genId3, defsCollector, useW, useH) {
|
|
2798
2807
|
const viewBox = parseViewBox(symbolNode.viewBox);
|
|
2799
|
-
const g =
|
|
2808
|
+
const g = __spreadProps(__spreadValues({}, symbolNode), { type: "g" });
|
|
2800
2809
|
delete g.viewBox;
|
|
2801
2810
|
delete g.preserveAspectRatio;
|
|
2802
2811
|
delete g.width;
|
|
@@ -2841,34 +2850,54 @@ var PixodeskAnimator = (() => {
|
|
|
2841
2850
|
if (m !== ch) changed = true;
|
|
2842
2851
|
return m;
|
|
2843
2852
|
});
|
|
2844
|
-
return changed ?
|
|
2853
|
+
return changed ? __spreadProps(__spreadValues({}, node), { children: newChildren }) : node;
|
|
2845
2854
|
}
|
|
2855
|
+
|
|
2856
|
+
// ../svg-animator-core/src/effects/transformParts.ts
|
|
2846
2857
|
function partsRecord(part, value, origin) {
|
|
2847
2858
|
const rec = {};
|
|
2848
|
-
if (part === "translate") rec.translate = value;
|
|
2849
|
-
else if (part === "rotate") rec.rotate = value;
|
|
2850
|
-
else if (part === "skew") rec.skew = value;
|
|
2859
|
+
if (part === "translate" /* Translate */) rec.translate = value;
|
|
2860
|
+
else if (part === "rotate" /* Rotate */) rec.rotate = value;
|
|
2861
|
+
else if (part === "skew" /* Skew */) rec.skew = value;
|
|
2851
2862
|
else rec.scale = value;
|
|
2852
|
-
if (origin && part !== "translate") rec.origin = origin;
|
|
2863
|
+
if (origin && part !== "translate" /* Translate */) rec.origin = origin;
|
|
2853
2864
|
return rec;
|
|
2854
2865
|
}
|
|
2855
2866
|
function readAnimatable(raw) {
|
|
2856
|
-
var _a, _b;
|
|
2857
|
-
if (raw === void 0) return {
|
|
2858
|
-
|
|
2859
|
-
/* Absent */
|
|
2860
|
-
};
|
|
2861
|
-
if (Array.isArray(raw)) return { kind: "static", value: raw };
|
|
2867
|
+
var _a, _b, _c;
|
|
2868
|
+
if (raw === void 0) return { kind: "absent" /* Absent */ };
|
|
2869
|
+
if (Array.isArray(raw)) return { kind: "static" /* Static */, value: raw };
|
|
2862
2870
|
if (typeof raw === "object") {
|
|
2863
2871
|
const obj = raw;
|
|
2864
2872
|
const kfs = (_a = obj.keyframes) != null ? _a : obj.kfs;
|
|
2865
2873
|
if (kfs) {
|
|
2866
|
-
|
|
2874
|
+
const out = { kind: "animated" /* Animated */, keyframes: kfs.map(normaliseKeyframe), autoOrient: obj.autoOrient, loop: obj.loop };
|
|
2875
|
+
const base = (_b = obj.value) != null ? _b : obj.v;
|
|
2876
|
+
if (base !== void 0 && out.kind === "animated" /* Animated */) out.base = base;
|
|
2877
|
+
return out;
|
|
2867
2878
|
}
|
|
2868
|
-
const staticValue = (
|
|
2869
|
-
if (staticValue !== void 0) return { kind: "static"
|
|
2879
|
+
const staticValue = (_c = obj.value) != null ? _c : obj.v;
|
|
2880
|
+
if (staticValue !== void 0) return { kind: "static" /* Static */, value: staticValue };
|
|
2881
|
+
}
|
|
2882
|
+
return { kind: "static" /* Static */, value: raw };
|
|
2883
|
+
}
|
|
2884
|
+
function writeAnimatableChannel(node, attrName, read, opts) {
|
|
2885
|
+
var _a, _b, _c, _d;
|
|
2886
|
+
const toOut = (v) => (opts == null ? void 0 : opts.asString) && v !== void 0 && v !== null ? String(v) : v;
|
|
2887
|
+
if (read.kind === "absent" /* Absent */) return;
|
|
2888
|
+
if (read.kind === "static" /* Static */) {
|
|
2889
|
+
node[attrName] = toOut(read.value);
|
|
2890
|
+
return;
|
|
2870
2891
|
}
|
|
2871
|
-
|
|
2892
|
+
const prevAnimate = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate : void 0;
|
|
2893
|
+
const animate = __spreadValues({}, prevAnimate || {});
|
|
2894
|
+
const block = { keyframes: read.keyframes };
|
|
2895
|
+
if (read.loop !== void 0) block.loop = read.loop;
|
|
2896
|
+
if (read.autoOrient !== void 0) block.autoOrient = read.autoOrient;
|
|
2897
|
+
animate[attrName] = block;
|
|
2898
|
+
node.animate = animate;
|
|
2899
|
+
const baseline = (_d = (_b = read.base) != null ? _b : (_a = read.keyframes[0]) == null ? void 0 : _a.value) != null ? _d : (_c = read.keyframes[0]) == null ? void 0 : _c.v;
|
|
2900
|
+
if (baseline !== void 0) node[attrName] = toOut(baseline);
|
|
2872
2901
|
}
|
|
2873
2902
|
function normaliseKeyframe(kf) {
|
|
2874
2903
|
if (!kf || typeof kf !== "object") return kf;
|
|
@@ -2876,7 +2905,7 @@ var PixodeskAnimator = (() => {
|
|
|
2876
2905
|
if (k.t === void 0 && k.v === void 0 && k.e === void 0 && k.to === void 0 && k.ti === void 0) {
|
|
2877
2906
|
return kf;
|
|
2878
2907
|
}
|
|
2879
|
-
const out =
|
|
2908
|
+
const out = __spreadValues({}, k);
|
|
2880
2909
|
if (out.time === void 0 && k.t !== void 0) out.time = k.t;
|
|
2881
2910
|
if (out.value === void 0 && k.v !== void 0) out.value = k.v;
|
|
2882
2911
|
if (out.easing === void 0 && k.e !== void 0) out.easing = k.e;
|
|
@@ -2887,9 +2916,9 @@ var PixodeskAnimator = (() => {
|
|
|
2887
2916
|
function readStaticOrigin(raw, ctx) {
|
|
2888
2917
|
var _a;
|
|
2889
2918
|
const o = readAnimatable(raw);
|
|
2890
|
-
if (o.kind === "absent") return void 0;
|
|
2891
|
-
if (o.kind === "static") return o.value;
|
|
2892
|
-
ctx.warnings.push("
|
|
2919
|
+
if (o.kind === "absent" /* Absent */) return void 0;
|
|
2920
|
+
if (o.kind === "static" /* Static */) return o.value;
|
|
2921
|
+
ctx.warnings.push("transformBy.origin: animated origin approximated by its first keyframe");
|
|
2893
2922
|
return (_a = o.keyframes[0]) == null ? void 0 : _a.value;
|
|
2894
2923
|
}
|
|
2895
2924
|
function keyframeWith(kf, value) {
|
|
@@ -2900,7 +2929,9 @@ var PixodeskAnimator = (() => {
|
|
|
2900
2929
|
if (kf.tangentIn !== void 0) out.tangentIn = kf.tangentIn;
|
|
2901
2930
|
return out;
|
|
2902
2931
|
}
|
|
2903
|
-
|
|
2932
|
+
|
|
2933
|
+
// ../svg-animator-core/src/effects/transformationEffect.ts
|
|
2934
|
+
function applyTransformByEffect(node, fx, ctx) {
|
|
2904
2935
|
if (!fx) return node;
|
|
2905
2936
|
delete node.transform;
|
|
2906
2937
|
let n = node;
|
|
@@ -2910,9 +2941,9 @@ var PixodeskAnimator = (() => {
|
|
|
2910
2941
|
/*invert=*/
|
|
2911
2942
|
true
|
|
2912
2943
|
);
|
|
2913
|
-
n = wrapTransformPart(n, "scale"
|
|
2914
|
-
n = wrapTransformPart(n, "skew"
|
|
2915
|
-
n = wrapTransformPart(n, "rotate"
|
|
2944
|
+
n = wrapTransformPart(n, "scale" /* Scale */, normalizeScale(fx.scale), ctx);
|
|
2945
|
+
n = wrapTransformPart(n, "skew" /* Skew */, fx.skew, ctx);
|
|
2946
|
+
n = wrapTransformPart(n, "rotate" /* Rotate */, fx.rotate, ctx);
|
|
2916
2947
|
n = wrapOrigin(
|
|
2917
2948
|
n,
|
|
2918
2949
|
fx.origin,
|
|
@@ -2926,7 +2957,7 @@ var PixodeskAnimator = (() => {
|
|
|
2926
2957
|
/*invert=*/
|
|
2927
2958
|
true
|
|
2928
2959
|
);
|
|
2929
|
-
n = wrapTransformPart(n, "translate"
|
|
2960
|
+
n = wrapTransformPart(n, "translate" /* Translate */, fx.translate, ctx);
|
|
2930
2961
|
n = wrapOrigin(
|
|
2931
2962
|
n,
|
|
2932
2963
|
fx.origin,
|
|
@@ -2934,7 +2965,11 @@ var PixodeskAnimator = (() => {
|
|
|
2934
2965
|
false
|
|
2935
2966
|
);
|
|
2936
2967
|
} else {
|
|
2937
|
-
n = wrapTransformPart(n, "translate"
|
|
2968
|
+
n = wrapTransformPart(n, "translate" /* Translate */, fx.translate, ctx);
|
|
2969
|
+
}
|
|
2970
|
+
if (n !== node && node.id) {
|
|
2971
|
+
n.id = node.id;
|
|
2972
|
+
delete node.id;
|
|
2938
2973
|
}
|
|
2939
2974
|
return n;
|
|
2940
2975
|
}
|
|
@@ -2945,17 +2980,15 @@ var PixodeskAnimator = (() => {
|
|
|
2945
2980
|
return Array.isArray(obj.keyframes) && obj.keyframes.some((kf) => kf.tangentOut || kf.tangentIn);
|
|
2946
2981
|
}
|
|
2947
2982
|
function normalizeScale(raw) {
|
|
2948
|
-
if (raw === void 0) return void 0;
|
|
2949
|
-
if (Array.isArray(raw)) return [raw[0] / 100, raw[1] / 100];
|
|
2950
2983
|
return raw;
|
|
2951
2984
|
}
|
|
2952
2985
|
function wrapTransformPart(inner, part, raw, ctx) {
|
|
2953
2986
|
if (raw === void 0) return inner;
|
|
2954
2987
|
const v = readAnimatable(raw);
|
|
2955
|
-
if (v.kind === "static") {
|
|
2988
|
+
if (v.kind === "static" /* Static */) {
|
|
2956
2989
|
return { type: "g", transform: { value: partsRecord(part, v.value, void 0) }, children: [inner] };
|
|
2957
2990
|
}
|
|
2958
|
-
if (v.kind === "animated") {
|
|
2991
|
+
if (v.kind === "animated" /* Animated */) {
|
|
2959
2992
|
const animTr = { keyframes: v.keyframes.map((kf) => keyframeWith(kf, partsRecord(part, kf.value, void 0))) };
|
|
2960
2993
|
if (v.autoOrient) animTr.autoOrient = true;
|
|
2961
2994
|
if (v.loop !== void 0) animTr.loop = v.loop;
|
|
@@ -2971,12 +3004,12 @@ var PixodeskAnimator = (() => {
|
|
|
2971
3004
|
if (raw === void 0) return inner;
|
|
2972
3005
|
const v = readAnimatable(raw);
|
|
2973
3006
|
const sign = (value) => invert ? [-value[0], -value[1]] : value;
|
|
2974
|
-
if (v.kind === "absent") return inner;
|
|
2975
|
-
if (v.kind === "static") {
|
|
3007
|
+
if (v.kind === "absent" /* Absent */) return inner;
|
|
3008
|
+
if (v.kind === "static" /* Static */) {
|
|
2976
3009
|
if (v.value[0] === 0 && v.value[1] === 0) return inner;
|
|
2977
3010
|
return { type: "g", transform: { value: { translate: sign(v.value) } }, children: [inner] };
|
|
2978
3011
|
}
|
|
2979
|
-
if (v.kind === "animated") {
|
|
3012
|
+
if (v.kind === "animated" /* Animated */) {
|
|
2980
3013
|
const animTr = { keyframes: v.keyframes.map((kf) => keyframeWith(kf, { translate: sign(kf.value) })) };
|
|
2981
3014
|
if (v.loop !== void 0) animTr.loop = v.loop;
|
|
2982
3015
|
return {
|
|
@@ -2987,34 +3020,58 @@ var PixodeskAnimator = (() => {
|
|
|
2987
3020
|
}
|
|
2988
3021
|
return inner;
|
|
2989
3022
|
}
|
|
3023
|
+
|
|
3024
|
+
// ../svg-animator-core/src/effects/util.ts
|
|
3025
|
+
function genId(ctx, prefix) {
|
|
3026
|
+
return "_lw_" + prefix + "_" + ctx.nextId++;
|
|
3027
|
+
}
|
|
3028
|
+
function stripHash2(href) {
|
|
3029
|
+
return typeof href === "string" ? href.replace(/^#/, "") : void 0;
|
|
3030
|
+
}
|
|
3031
|
+
function indexById(node, map) {
|
|
3032
|
+
var _a;
|
|
3033
|
+
if (typeof node.id === "string") map.set(node.id, node);
|
|
3034
|
+
(_a = node.children) == null ? void 0 : _a.forEach((child) => indexById(child, map));
|
|
3035
|
+
}
|
|
3036
|
+
function spliceDefs(root, defs) {
|
|
3037
|
+
if (!defs.length) return;
|
|
3038
|
+
const existing = root.children || (root.children = []);
|
|
3039
|
+
existing.unshift({ type: "defs", children: defs });
|
|
3040
|
+
}
|
|
3041
|
+
var clone = deepClonePxNode;
|
|
3042
|
+
function regenerateIdsInClone(root, ctx) {
|
|
3043
|
+
return regenerateIdsAndRewriteRefs(root, () => genId(ctx, "retimed"));
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
// ../svg-animator-core/src/effects/contentRefSplit.ts
|
|
2990
3047
|
function identifyContentRefTargets(node, ctx, allocator) {
|
|
2991
3048
|
var _a, _b, _c;
|
|
2992
3049
|
if (node.type === "use" && ((_b = (_a = node.effects) == null ? void 0 : _a.clone) == null ? void 0 : _b.type) === "content") {
|
|
2993
|
-
const
|
|
2994
|
-
if (typeof
|
|
2995
|
-
ctx.contentRefInnerIds.set(
|
|
3050
|
+
const sourceId = stripHash2(node.effects.clone.sourceId);
|
|
3051
|
+
if (typeof sourceId === "string" && sourceId && !ctx.contentRefInnerIds.has(sourceId)) {
|
|
3052
|
+
ctx.contentRefInnerIds.set(sourceId, allocator(sourceId));
|
|
2996
3053
|
}
|
|
2997
3054
|
}
|
|
2998
3055
|
(_c = node.children) == null ? void 0 : _c.forEach((c) => identifyContentRefTargets(c, ctx, allocator));
|
|
2999
3056
|
}
|
|
3000
|
-
function splitForContentRef(node,
|
|
3001
|
-
const outerBody = liftBodyTranslate(node,
|
|
3057
|
+
function splitForContentRef(node, transformBy, originalId, innerId, ctx) {
|
|
3058
|
+
const outerBody = liftBodyTranslate(node, transformBy);
|
|
3002
3059
|
if (typeof node.id === "string") delete node.id;
|
|
3003
|
-
const { outer: outerTr, inner: innerTr } =
|
|
3060
|
+
const { outer: outerTr, inner: innerTr } = splitTransformByEffect(transformBy);
|
|
3004
3061
|
let innerNode = node;
|
|
3005
|
-
innerNode =
|
|
3062
|
+
innerNode = applyTransformByEffect(innerNode, innerTr, ctx);
|
|
3006
3063
|
const innerWrapper = { type: "g", id: innerId, children: [innerNode] };
|
|
3007
3064
|
let outerWrapper = { type: "g", id: originalId, children: [innerWrapper] };
|
|
3008
3065
|
if (outerBody.transform !== void 0) outerWrapper.transform = outerBody.transform;
|
|
3009
3066
|
if (outerBody.animate !== void 0) outerWrapper.animate = outerBody.animate;
|
|
3010
3067
|
if (outerTr) {
|
|
3011
3068
|
delete outerWrapper.id;
|
|
3012
|
-
outerWrapper =
|
|
3069
|
+
outerWrapper = applyTransformByEffect(outerWrapper, outerTr, ctx);
|
|
3013
3070
|
outerWrapper.id = originalId;
|
|
3014
3071
|
}
|
|
3015
3072
|
return outerWrapper;
|
|
3016
3073
|
}
|
|
3017
|
-
function liftBodyTranslate(node,
|
|
3074
|
+
function liftBodyTranslate(node, transformBy) {
|
|
3018
3075
|
var _a, _b, _c;
|
|
3019
3076
|
const out = {};
|
|
3020
3077
|
let didLiftAnimate = false;
|
|
@@ -3068,7 +3125,7 @@ var PixodeskAnimator = (() => {
|
|
|
3068
3125
|
didLiftAnimate = true;
|
|
3069
3126
|
}
|
|
3070
3127
|
}
|
|
3071
|
-
const transformationHasTranslate = (
|
|
3128
|
+
const transformationHasTranslate = (transformBy == null ? void 0 : transformBy.translate) !== void 0;
|
|
3072
3129
|
const stripBodyTranslateOnly = didLiftAnimate || transformationHasTranslate;
|
|
3073
3130
|
const liftedAnimateIsAutoOriented = didLiftAnimate && needsOriginOnOuter(((_b = node.animate) == null ? void 0 : _b.transform) || void 0) || didLiftAnimate && needsOriginOnOuter(((_c = out.animate) == null ? void 0 : _c.transform) || void 0);
|
|
3074
3131
|
if (typeof node.transform === "string") {
|
|
@@ -3087,6 +3144,24 @@ var PixodeskAnimator = (() => {
|
|
|
3087
3144
|
if (split.rest) node.transform = split.rest;
|
|
3088
3145
|
else delete node.transform;
|
|
3089
3146
|
}
|
|
3147
|
+
} else if (node.transform && typeof node.transform === "object" && !Array.isArray(node.transform) && !node.transform.keyframes && !node.transform.kfs) {
|
|
3148
|
+
const wrapped = node.transform.value;
|
|
3149
|
+
const isWrapped = !!(wrapped && typeof wrapped === "object");
|
|
3150
|
+
const value = isWrapped ? wrapped : node.transform;
|
|
3151
|
+
const rewrap = (rec) => isWrapped ? { value: rec } : rec;
|
|
3152
|
+
if (Array.isArray(value.translate)) {
|
|
3153
|
+
const rest = __spreadValues({}, value);
|
|
3154
|
+
delete rest.translate;
|
|
3155
|
+
const hasRest = Object.keys(rest).length > 0;
|
|
3156
|
+
if (stripBodyTranslateOnly) {
|
|
3157
|
+
if (hasRest) node.transform = rewrap(rest);
|
|
3158
|
+
else delete node.transform;
|
|
3159
|
+
} else {
|
|
3160
|
+
out.transform = rewrap({ translate: value.translate });
|
|
3161
|
+
if (hasRest) node.transform = rewrap(rest);
|
|
3162
|
+
else delete node.transform;
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3090
3165
|
}
|
|
3091
3166
|
return out;
|
|
3092
3167
|
}
|
|
@@ -3156,7 +3231,7 @@ var PixodeskAnimator = (() => {
|
|
|
3156
3231
|
const nums = m[1].split(/[\s,]+/).filter(Boolean).map(Number);
|
|
3157
3232
|
return [nums[0] || 0, nums[1] || 0];
|
|
3158
3233
|
}
|
|
3159
|
-
function
|
|
3234
|
+
function splitTransformByEffect(fx) {
|
|
3160
3235
|
if (!fx) return {};
|
|
3161
3236
|
const originOnOuter = needsOriginOnOuter(fx.translate);
|
|
3162
3237
|
const innerHasPivotedPart = fx.rotate !== void 0 || fx.scale !== void 0;
|
|
@@ -3182,26 +3257,8 @@ var PixodeskAnimator = (() => {
|
|
|
3182
3257
|
}
|
|
3183
3258
|
return false;
|
|
3184
3259
|
}
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
}
|
|
3188
|
-
function stripHash2(href) {
|
|
3189
|
-
return typeof href === "string" ? href.replace(/^#/, "") : void 0;
|
|
3190
|
-
}
|
|
3191
|
-
function indexById(node, map) {
|
|
3192
|
-
var _a;
|
|
3193
|
-
if (typeof node.id === "string") map.set(node.id, node);
|
|
3194
|
-
(_a = node.children) == null ? void 0 : _a.forEach((child) => indexById(child, map));
|
|
3195
|
-
}
|
|
3196
|
-
function spliceDefs(root, defs) {
|
|
3197
|
-
if (!defs.length) return;
|
|
3198
|
-
const existing = root.children || (root.children = []);
|
|
3199
|
-
existing.unshift({ type: "defs", children: defs });
|
|
3200
|
-
}
|
|
3201
|
-
var clone = deepClonePxNode;
|
|
3202
|
-
function regenerateIdsInClone(root, ctx) {
|
|
3203
|
-
return regenerateIdsAndRewriteRefs(root, () => genId(ctx, "retimed"));
|
|
3204
|
-
}
|
|
3260
|
+
|
|
3261
|
+
// ../svg-animator-core/src/effects/gradientEffect.ts
|
|
3205
3262
|
function applyFillGradientEffect(node, fx, ctx) {
|
|
3206
3263
|
return applyGradient(node, fx, ctx, "fill");
|
|
3207
3264
|
}
|
|
@@ -3222,62 +3279,63 @@ var PixodeskAnimator = (() => {
|
|
|
3222
3279
|
id
|
|
3223
3280
|
};
|
|
3224
3281
|
if (fx.type === PxGradientType.linear) {
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
out.y1 = String(fx.p1[1]);
|
|
3228
|
-
}
|
|
3229
|
-
if (fx.p2) {
|
|
3230
|
-
out.x2 = String(fx.p2[0]);
|
|
3231
|
-
out.y2 = String(fx.p2[1]);
|
|
3232
|
-
}
|
|
3282
|
+
applyGeomVec(out, "x1", "y1", fx.p1);
|
|
3283
|
+
applyGeomVec(out, "x2", "y2", fx.p2);
|
|
3233
3284
|
} else {
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
}
|
|
3238
|
-
if (fx.r !== void 0) out.r = String(fx.r);
|
|
3239
|
-
if (fx.fp) {
|
|
3240
|
-
out.fx = String(fx.fp[0]);
|
|
3241
|
-
out.fy = String(fx.fp[1]);
|
|
3242
|
-
}
|
|
3285
|
+
applyGeomVec(out, "cx", "cy", fx.c);
|
|
3286
|
+
applyGeomNumber(out, "r", fx.r);
|
|
3287
|
+
applyGeomVec(out, "fx", "fy", fx.fp);
|
|
3243
3288
|
}
|
|
3244
3289
|
if (fx.gradientUnits) out.gradientUnits = fx.gradientUnits;
|
|
3245
3290
|
if (fx.spreadMethod) out.spreadMethod = fx.spreadMethod;
|
|
3246
3291
|
if (fx.gradientTransform) out.gradientTransform = fx.gradientTransform;
|
|
3247
|
-
const animate = fx.animate;
|
|
3248
|
-
if (animate) {
|
|
3249
|
-
const mapped = {};
|
|
3250
|
-
for (const wireKey of Object.keys(animate)) {
|
|
3251
|
-
const attr = GRADIENT_ANIM_CHANNEL_TO_ATTR[wireKey];
|
|
3252
|
-
if (attr) mapped[attr] = animate[wireKey];
|
|
3253
|
-
}
|
|
3254
|
-
if (Object.keys(mapped).length) out.animate = mapped;
|
|
3255
|
-
}
|
|
3256
3292
|
out.children = buildStopChildren(fx.stops, ctx);
|
|
3257
3293
|
return out;
|
|
3258
3294
|
}
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3295
|
+
function applyGeomVec(out, xAttr, yAttr, raw) {
|
|
3296
|
+
var _a, _b, _c;
|
|
3297
|
+
const read = readAnimatable(raw);
|
|
3298
|
+
if (read.kind === "absent" /* Absent */) return;
|
|
3299
|
+
if (read.kind === "static" /* Static */) {
|
|
3300
|
+
out[xAttr] = String(read.value[0]);
|
|
3301
|
+
out[yAttr] = String(read.value[1]);
|
|
3302
|
+
return;
|
|
3303
|
+
}
|
|
3304
|
+
const axisChannel = (idx) => {
|
|
3305
|
+
const block = {
|
|
3306
|
+
keyframes: read.keyframes.map((kf) => {
|
|
3307
|
+
const axisKf = { time: kf.time, value: Array.isArray(kf.value) ? kf.value[idx] : void 0 };
|
|
3308
|
+
if (kf.easing !== void 0) axisKf.easing = kf.easing;
|
|
3309
|
+
return axisKf;
|
|
3310
|
+
})
|
|
3311
|
+
};
|
|
3312
|
+
if (read.loop !== void 0) block.loop = read.loop;
|
|
3313
|
+
return block;
|
|
3314
|
+
};
|
|
3315
|
+
const animate = (_a = out.animate) != null ? _a : {};
|
|
3316
|
+
animate[xAttr] = axisChannel(0);
|
|
3317
|
+
animate[yAttr] = axisChannel(1);
|
|
3318
|
+
out.animate = animate;
|
|
3319
|
+
const baseline = (_c = read.base) != null ? _c : (_b = read.keyframes[0]) == null ? void 0 : _b.value;
|
|
3320
|
+
if (Array.isArray(baseline)) {
|
|
3321
|
+
out[xAttr] = String(baseline[0]);
|
|
3322
|
+
out[yAttr] = String(baseline[1]);
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
function applyGeomNumber(out, attrName, raw) {
|
|
3326
|
+
const read = readAnimatable(raw);
|
|
3327
|
+
if (read.kind === "absent" /* Absent */) return;
|
|
3328
|
+
writeAnimatableChannel(out, attrName, read, { asString: true });
|
|
3329
|
+
}
|
|
3270
3330
|
function buildStopChildren(stops, ctx) {
|
|
3271
3331
|
var _a, _b, _c, _d;
|
|
3272
3332
|
if (!stops) return [];
|
|
3273
|
-
|
|
3274
|
-
if (
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
const
|
|
3279
|
-
if (!Array.isArray(kfs) || !kfs.length) return [];
|
|
3280
|
-
const loopFromSource = animBlock.loop;
|
|
3333
|
+
const read = readAnimatable(stops);
|
|
3334
|
+
if (read.kind === "absent" /* Absent */) return [];
|
|
3335
|
+
if (read.kind === "static" /* Static */) return Array.isArray(read.value) ? read.value.map(staticStopNode) : [];
|
|
3336
|
+
const kfs = read.keyframes;
|
|
3337
|
+
if (!kfs.length) return [];
|
|
3338
|
+
const loopFromSource = read.loop;
|
|
3281
3339
|
let stopCount = 0;
|
|
3282
3340
|
for (const kf of kfs) {
|
|
3283
3341
|
const v = (_a = kf.value) != null ? _a : kf.v;
|
|
@@ -3351,37 +3409,65 @@ var PixodeskAnimator = (() => {
|
|
|
3351
3409
|
const pct = Math.round(o * 1e3) / 10;
|
|
3352
3410
|
return pct + "%";
|
|
3353
3411
|
}
|
|
3412
|
+
|
|
3413
|
+
// ../svg-animator-core/src/effects/clipPathEffect.ts
|
|
3354
3414
|
function applyClipPathEffect(node, fx, ctx) {
|
|
3415
|
+
var _a, _b;
|
|
3355
3416
|
if (!fx || !fx.d && !fx.animate) return node;
|
|
3356
3417
|
const clipId = genId(ctx, "clip");
|
|
3357
|
-
const pathChild = { type: "path"
|
|
3358
|
-
|
|
3418
|
+
const pathChild = { type: "path" };
|
|
3419
|
+
const read = readAnimatable(fx.d);
|
|
3420
|
+
if (read.kind !== "absent" /* Absent */) {
|
|
3421
|
+
if (read.kind === "static" /* Static */) {
|
|
3422
|
+
pathChild.d = pathString(read.value);
|
|
3423
|
+
} else {
|
|
3424
|
+
writeAnimatableChannel(pathChild, "d", read);
|
|
3425
|
+
if (pathChild.d !== void 0) pathChild.d = pathString(pathChild.d);
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
if (fx.animate && !((_a = pathChild.animate) == null ? void 0 : _a.d)) {
|
|
3429
|
+
const animate = (_b = pathChild.animate) != null ? _b : {};
|
|
3430
|
+
animate.d = fx.animate;
|
|
3431
|
+
pathChild.animate = animate;
|
|
3432
|
+
}
|
|
3359
3433
|
ctx.defs.push({ type: "clipPath", id: clipId, children: [pathChild] });
|
|
3360
3434
|
node.clipPath = "url(#" + clipId + ")";
|
|
3361
3435
|
return node;
|
|
3362
3436
|
}
|
|
3363
|
-
function
|
|
3437
|
+
function pathString(v) {
|
|
3438
|
+
if (typeof v === "string") return v;
|
|
3439
|
+
if (v && typeof v === "object" && typeof v.path === "string") return v.path;
|
|
3440
|
+
return void 0;
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
// ../svg-animator-core/src/effects/maskedByEffect.ts
|
|
3444
|
+
function applyMaskedByEffect(node, fx, transformBy, ctx) {
|
|
3364
3445
|
if (!fx) return node;
|
|
3365
|
-
|
|
3366
|
-
|
|
3446
|
+
const sourceId = stripHash2(fx.sourceId);
|
|
3447
|
+
if (!sourceId) {
|
|
3448
|
+
ctx.errors.push("maskedBy.sourceId missing \u2014 cannot build mask");
|
|
3367
3449
|
return node;
|
|
3368
3450
|
}
|
|
3369
3451
|
const maskId = genId(ctx, "mask");
|
|
3370
|
-
let content = { type: "use", href: "#" +
|
|
3371
|
-
if (
|
|
3372
|
-
content = wrapInverseTransform(content,
|
|
3452
|
+
let content = { type: "use", href: "#" + sourceId };
|
|
3453
|
+
if (transformBy) {
|
|
3454
|
+
content = wrapInverseTransform(content, transformBy, ctx);
|
|
3373
3455
|
} else if (hasAnimateTransform(node)) {
|
|
3374
3456
|
content = wrapInverseAnimatedBodyTransform(content, node, ctx);
|
|
3375
3457
|
} else {
|
|
3376
3458
|
const bodyStatic = readTransformationFromBody(node);
|
|
3377
3459
|
if (bodyStatic) content = wrapInverseTransform(content, bodyStatic, ctx);
|
|
3378
3460
|
}
|
|
3379
|
-
const includeTargetOwn =
|
|
3380
|
-
content = wrapAncestorChainCompensation(content, node,
|
|
3461
|
+
const includeTargetOwn = transformBy === void 0 && !nodeHasBodyTransform(node);
|
|
3462
|
+
content = wrapAncestorChainCompensation(content, node, sourceId, ctx, includeTargetOwn);
|
|
3381
3463
|
const mask = { type: "mask", id: maskId, children: [content] };
|
|
3382
3464
|
if (fx.maskType) mask.maskType = fx.maskType;
|
|
3383
3465
|
if (fx.maskUnits) mask.maskUnits = fx.maskUnits;
|
|
3384
3466
|
if (fx.maskContentUnits) mask.maskContentUnits = fx.maskContentUnits;
|
|
3467
|
+
if (fx.x !== void 0) mask.x = String(fx.x);
|
|
3468
|
+
if (fx.y !== void 0) mask.y = String(fx.y);
|
|
3469
|
+
if (fx.width !== void 0) mask.width = String(fx.width);
|
|
3470
|
+
if (fx.height !== void 0) mask.height = String(fx.height);
|
|
3385
3471
|
ctx.defs.push(mask);
|
|
3386
3472
|
node.mask = "url(#" + maskId + ")";
|
|
3387
3473
|
return node;
|
|
@@ -3390,22 +3476,22 @@ var PixodeskAnimator = (() => {
|
|
|
3390
3476
|
if (!fx) return inner;
|
|
3391
3477
|
const origin = readStaticOrigin(fx.origin, ctx);
|
|
3392
3478
|
let n = inner;
|
|
3393
|
-
n = wrapInversePart(n, "translate"
|
|
3394
|
-
n = wrapInversePart(n, "rotate"
|
|
3395
|
-
n = wrapInversePart(n, "scale"
|
|
3479
|
+
n = wrapInversePart(n, "translate" /* Translate */, fx.translate, void 0, ctx);
|
|
3480
|
+
n = wrapInversePart(n, "rotate" /* Rotate */, fx.rotate, origin, ctx);
|
|
3481
|
+
n = wrapInversePart(n, "scale" /* Scale */, fx.scale, origin, ctx);
|
|
3396
3482
|
return n;
|
|
3397
3483
|
}
|
|
3398
3484
|
function wrapInversePart(inner, part, raw, origin, ctx) {
|
|
3399
3485
|
if (raw === void 0) return inner;
|
|
3400
|
-
const normalisedRaw = part === "scale" && Array.isArray(raw) ? [raw[0] / 100, raw[1] / 100] : raw;
|
|
3486
|
+
const normalisedRaw = part === "scale" /* Scale */ && Array.isArray(raw) ? [raw[0] / 100, raw[1] / 100] : raw;
|
|
3401
3487
|
const v = readAnimatable(normalisedRaw);
|
|
3402
|
-
if (v.kind === "static") {
|
|
3488
|
+
if (v.kind === "static" /* Static */) {
|
|
3403
3489
|
return { type: "g", transform: { value: partsRecord(part, invertPartValue(part, v.value), origin) }, children: [inner] };
|
|
3404
3490
|
}
|
|
3405
|
-
if (v.kind === "animated") {
|
|
3491
|
+
if (v.kind === "animated" /* Animated */) {
|
|
3406
3492
|
const animTr = { keyframes: v.keyframes.map((kf) => {
|
|
3407
3493
|
const out = keyframeWith(kf, partsRecord(part, invertPartValue(part, kf.value), origin));
|
|
3408
|
-
return part === "translate" ?
|
|
3494
|
+
return part === "translate" /* Translate */ ? __spreadValues(__spreadValues({}, out), negatedSpatialTangents(kf)) : out;
|
|
3409
3495
|
}) };
|
|
3410
3496
|
if (v.loop !== void 0) animTr.loop = v.loop;
|
|
3411
3497
|
return {
|
|
@@ -3417,8 +3503,8 @@ var PixodeskAnimator = (() => {
|
|
|
3417
3503
|
return inner;
|
|
3418
3504
|
}
|
|
3419
3505
|
function invertPartValue(part, value) {
|
|
3420
|
-
if (part === "translate") return [-value[0], -value[1]];
|
|
3421
|
-
if (part === "rotate") return -value;
|
|
3506
|
+
if (part === "translate" /* Translate */) return [-value[0], -value[1]];
|
|
3507
|
+
if (part === "rotate" /* Rotate */) return -value;
|
|
3422
3508
|
return [1 / value[0], 1 / value[1]];
|
|
3423
3509
|
}
|
|
3424
3510
|
function negatedSpatialTangents(kf) {
|
|
@@ -3443,17 +3529,17 @@ var PixodeskAnimator = (() => {
|
|
|
3443
3529
|
const v = ((_a = kf.value) != null ? _a : kf.v) || {};
|
|
3444
3530
|
const baseKf = keyframeWith(kf, void 0);
|
|
3445
3531
|
if (Array.isArray(v.translate)) {
|
|
3446
|
-
translateKfs.push(
|
|
3532
|
+
translateKfs.push(__spreadProps(__spreadValues(__spreadValues({}, baseKf), negatedSpatialTangents(kf)), { value: { translate: [-v.translate[0], -v.translate[1]] } }));
|
|
3447
3533
|
}
|
|
3448
3534
|
if (typeof v.rotate === "number") {
|
|
3449
3535
|
const rec = { rotate: -v.rotate };
|
|
3450
3536
|
if (Array.isArray(v.origin)) rec.origin = [v.origin[0], v.origin[1]];
|
|
3451
|
-
rotateKfs.push(
|
|
3537
|
+
rotateKfs.push(__spreadProps(__spreadValues({}, baseKf), { value: rec }));
|
|
3452
3538
|
}
|
|
3453
3539
|
if (Array.isArray(v.scale)) {
|
|
3454
3540
|
const rec = { scale: [1 / v.scale[0], 1 / v.scale[1]] };
|
|
3455
3541
|
if (Array.isArray(v.origin)) rec.origin = [v.origin[0], v.origin[1]];
|
|
3456
|
-
scaleKfs.push(
|
|
3542
|
+
scaleKfs.push(__spreadProps(__spreadValues({}, baseKf), { value: rec }));
|
|
3457
3543
|
}
|
|
3458
3544
|
}
|
|
3459
3545
|
const srcLoop = animTr == null ? void 0 : animTr.loop;
|
|
@@ -3488,6 +3574,19 @@ var PixodeskAnimator = (() => {
|
|
|
3488
3574
|
if (parts.origin) out.origin = parts.origin;
|
|
3489
3575
|
return Object.keys(out).length ? out : void 0;
|
|
3490
3576
|
}
|
|
3577
|
+
if (node.transform && typeof node.transform === "object" && !node.transform.keyframes && !node.transform.kfs) {
|
|
3578
|
+
const wrapped = node.transform.value;
|
|
3579
|
+
const value = wrapped && typeof wrapped === "object" ? wrapped : node.transform;
|
|
3580
|
+
if (value && typeof value === "object") {
|
|
3581
|
+
const out = {};
|
|
3582
|
+
if (Array.isArray(value.translate)) out.translate = value.translate;
|
|
3583
|
+
if (typeof value.rotate === "number") out.rotate = value.rotate;
|
|
3584
|
+
if (typeof value.skew === "number") out.skew = value.skew;
|
|
3585
|
+
if (Array.isArray(value.scale)) out.scale = { value: value.scale };
|
|
3586
|
+
if (Array.isArray(value.origin)) out.origin = value.origin;
|
|
3587
|
+
return Object.keys(out).length ? out : void 0;
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3491
3590
|
return void 0;
|
|
3492
3591
|
}
|
|
3493
3592
|
function parseTransformStringToParts(s) {
|
|
@@ -3621,10 +3720,10 @@ var PixodeskAnimator = (() => {
|
|
|
3621
3720
|
const interestingNodes = /* @__PURE__ */ new Set();
|
|
3622
3721
|
const collectInterestingNodes = (n) => {
|
|
3623
3722
|
var _a, _b;
|
|
3624
|
-
const
|
|
3625
|
-
if (typeof
|
|
3723
|
+
const maskSourceId = stripHash2((_b = (_a = n.effects) == null ? void 0 : _a.maskedBy) == null ? void 0 : _b.sourceId);
|
|
3724
|
+
if (typeof maskSourceId === "string") {
|
|
3626
3725
|
interestingNodes.add(n);
|
|
3627
|
-
const sourceNode = ctx.idMap.get(
|
|
3726
|
+
const sourceNode = ctx.idMap.get(maskSourceId);
|
|
3628
3727
|
if (sourceNode) interestingNodes.add(sourceNode);
|
|
3629
3728
|
}
|
|
3630
3729
|
if (Array.isArray(n.children)) for (const ch of n.children) collectInterestingNodes(ch);
|
|
@@ -3650,8 +3749,9 @@ var PixodeskAnimator = (() => {
|
|
|
3650
3749
|
if (typeof tr === "string") {
|
|
3651
3750
|
const parts = parseTranslateOnlyFromString(tr, ctx);
|
|
3652
3751
|
if (parts) out.translate = parts;
|
|
3653
|
-
} else if (tr && typeof tr === "object") {
|
|
3654
|
-
const
|
|
3752
|
+
} else if (tr && typeof tr === "object" && !tr.keyframes && !tr.kfs) {
|
|
3753
|
+
const wrapped = tr.value;
|
|
3754
|
+
const value = wrapped && typeof wrapped === "object" ? wrapped : tr;
|
|
3655
3755
|
if (value && typeof value === "object" && Array.isArray(value.translate)) {
|
|
3656
3756
|
out.translate = [value.translate[0] || 0, value.translate[1] || 0];
|
|
3657
3757
|
}
|
|
@@ -3696,21 +3796,25 @@ var PixodeskAnimator = (() => {
|
|
|
3696
3796
|
if (droppedNonTranslate) ctx.warnings.push("maskedBy ancestor: non-translate transform in string ignored: " + s);
|
|
3697
3797
|
return seen ? [x, y] : void 0;
|
|
3698
3798
|
}
|
|
3799
|
+
|
|
3800
|
+
// ../svg-animator-core/src/effects/refEffect.ts
|
|
3699
3801
|
var CONTENT_SUBREF = "content";
|
|
3700
3802
|
function applyRefHref(node, clone2, ctx) {
|
|
3701
3803
|
if (!clone2) return;
|
|
3702
|
-
const
|
|
3703
|
-
if (!
|
|
3704
|
-
if (clone2.type === CONTENT_SUBREF) ctx.errors.push("clone: content ref missing
|
|
3804
|
+
const sourceId = stripHash2(clone2.sourceId);
|
|
3805
|
+
if (!sourceId) {
|
|
3806
|
+
if (clone2.type === CONTENT_SUBREF) ctx.errors.push("clone: content ref missing sourceId");
|
|
3705
3807
|
return;
|
|
3706
3808
|
}
|
|
3707
|
-
const targetId = clone2.type === CONTENT_SUBREF ? ctx.contentRefInnerIds.get(
|
|
3809
|
+
const targetId = clone2.type === CONTENT_SUBREF ? ctx.contentRefInnerIds.get(sourceId) || sourceId : sourceId;
|
|
3708
3810
|
node.href = "#" + targetId;
|
|
3709
3811
|
}
|
|
3710
|
-
function applyRefAndTransformationEffect(node, clone2,
|
|
3812
|
+
function applyRefAndTransformationEffect(node, clone2, transformBy, ctx) {
|
|
3711
3813
|
applyRefHref(node, clone2, ctx);
|
|
3712
|
-
return
|
|
3814
|
+
return applyTransformByEffect(node, transformBy, ctx);
|
|
3713
3815
|
}
|
|
3816
|
+
|
|
3817
|
+
// ../svg-animator-core/src/effects/repeaterEffect.ts
|
|
3714
3818
|
function applyRepeaterEffect(node, fx, ctx) {
|
|
3715
3819
|
var _a, _b;
|
|
3716
3820
|
if (!fx) return node;
|
|
@@ -3732,7 +3836,7 @@ var PixodeskAnimator = (() => {
|
|
|
3732
3836
|
for (let i = 1; i < copies; i++) {
|
|
3733
3837
|
const baseClone = clone(base);
|
|
3734
3838
|
const synthFx = synthesisePerCopyFx(fx, i);
|
|
3735
|
-
const wrapped = synthFx ?
|
|
3839
|
+
const wrapped = synthFx ? applyTransformByEffect(baseClone, synthFx, ctx) : baseClone;
|
|
3736
3840
|
children.push(wrapped);
|
|
3737
3841
|
}
|
|
3738
3842
|
const wrapper = { type: "g", children };
|
|
@@ -3744,10 +3848,13 @@ var PixodeskAnimator = (() => {
|
|
|
3744
3848
|
function synthesisePerCopyFx(fx, i) {
|
|
3745
3849
|
const out = {};
|
|
3746
3850
|
if (fx.translate !== void 0) {
|
|
3747
|
-
out.translate =
|
|
3851
|
+
out.translate = mapAnimatable(fx.translate, (v) => [v[0] * i, v[1] * i]);
|
|
3748
3852
|
}
|
|
3749
3853
|
if (fx.rotate !== void 0) {
|
|
3750
|
-
out.rotate =
|
|
3854
|
+
out.rotate = mapAnimatable(fx.rotate, (v) => v * i);
|
|
3855
|
+
}
|
|
3856
|
+
if (fx.skew !== void 0) {
|
|
3857
|
+
out.skew = mapAnimatable(fx.skew, (v) => v * i);
|
|
3751
3858
|
}
|
|
3752
3859
|
if (fx.scale !== void 0) {
|
|
3753
3860
|
out.scale = synthesiseScale(fx.scale, i);
|
|
@@ -3757,63 +3864,52 @@ var PixodeskAnimator = (() => {
|
|
|
3757
3864
|
}
|
|
3758
3865
|
return Object.keys(out).length ? out : void 0;
|
|
3759
3866
|
}
|
|
3760
|
-
function
|
|
3761
|
-
|
|
3762
|
-
if (
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
});
|
|
3768
|
-
}
|
|
3769
|
-
if (obj.value !== void 0) {
|
|
3770
|
-
return __spreadProps2(__spreadValues2({}, obj), { value: fn(obj.value) });
|
|
3771
|
-
}
|
|
3772
|
-
}
|
|
3773
|
-
return raw;
|
|
3774
|
-
}
|
|
3775
|
-
function mapAnimatableNumber(raw, fn) {
|
|
3776
|
-
if (typeof raw === "number") return fn(raw);
|
|
3777
|
-
if (raw && typeof raw === "object") {
|
|
3778
|
-
const obj = raw;
|
|
3779
|
-
if (Array.isArray(obj.keyframes)) {
|
|
3780
|
-
return __spreadProps2(__spreadValues2({}, obj), {
|
|
3781
|
-
keyframes: obj.keyframes.map((kf) => kf && kf.value !== void 0 ? __spreadProps2(__spreadValues2({}, kf), { value: fn(kf.value) }) : kf)
|
|
3782
|
-
});
|
|
3783
|
-
}
|
|
3784
|
-
if (obj.value !== void 0) {
|
|
3785
|
-
return __spreadProps2(__spreadValues2({}, obj), { value: fn(obj.value) });
|
|
3786
|
-
}
|
|
3867
|
+
function mapAnimatable(raw, fn, wrapStatic = false) {
|
|
3868
|
+
const read = readAnimatable(raw);
|
|
3869
|
+
if (read.kind === "absent" /* Absent */) return raw;
|
|
3870
|
+
if (read.kind === "static" /* Static */) {
|
|
3871
|
+
const mapped = fn(read.value);
|
|
3872
|
+
const wasRawStatic = typeof raw === "number" || Array.isArray(raw);
|
|
3873
|
+
return wasRawStatic && !wrapStatic ? mapped : { value: mapped };
|
|
3787
3874
|
}
|
|
3788
|
-
|
|
3875
|
+
const out = {
|
|
3876
|
+
keyframes: read.keyframes.map((kf) => kf && kf.value !== void 0 ? __spreadProps(__spreadValues({}, kf), { value: fn(kf.value) }) : kf)
|
|
3877
|
+
};
|
|
3878
|
+
if (read.loop !== void 0) out.loop = read.loop;
|
|
3879
|
+
if (read.autoOrient !== void 0) out.autoOrient = read.autoOrient;
|
|
3880
|
+
if (read.base !== void 0) out.value = fn(read.base);
|
|
3881
|
+
return out;
|
|
3789
3882
|
}
|
|
3790
3883
|
function synthesiseScale(raw, i) {
|
|
3791
|
-
const
|
|
3792
|
-
|
|
3793
|
-
if (Array.isArray(raw)) {
|
|
3794
|
-
return { value: scalePowerFromPercent(raw) };
|
|
3795
|
-
}
|
|
3796
|
-
if (raw && typeof raw === "object") {
|
|
3797
|
-
const obj = raw;
|
|
3798
|
-
if (Array.isArray(obj.keyframes)) {
|
|
3799
|
-
return __spreadProps2(__spreadValues2({}, obj), {
|
|
3800
|
-
keyframes: obj.keyframes.map((kf) => kf && kf.value !== void 0 ? __spreadProps2(__spreadValues2({}, kf), { value: scalePowerFromUnits(kf.value) }) : kf)
|
|
3801
|
-
});
|
|
3802
|
-
}
|
|
3803
|
-
if (obj.value !== void 0) {
|
|
3804
|
-
return __spreadProps2(__spreadValues2({}, obj), { value: scalePowerFromPercent(obj.value) });
|
|
3805
|
-
}
|
|
3806
|
-
}
|
|
3807
|
-
return raw;
|
|
3884
|
+
const scalePower = (v) => [Math.pow(v[0], i), Math.pow(v[1], i)];
|
|
3885
|
+
return mapAnimatable(raw, scalePower, true);
|
|
3808
3886
|
}
|
|
3887
|
+
|
|
3888
|
+
// ../svg-animator-core/src/effects/retimeEffect.ts
|
|
3809
3889
|
var RETIME_MATERIALISATION_MODE_INLINE_G = false;
|
|
3810
3890
|
function asRetime(r) {
|
|
3811
3891
|
var _a, _b;
|
|
3812
|
-
if (r.timeCrop) {
|
|
3813
|
-
console.warn("retime: `timeCrop` is not supported yet and will be ignored");
|
|
3814
|
-
}
|
|
3815
3892
|
return { start: (_a = r.start) != null ? _a : 0, stretch: (_b = r.stretch) != null ? _b : 1 };
|
|
3816
3893
|
}
|
|
3894
|
+
var CROP_EDGE_MS = 1;
|
|
3895
|
+
function applyTimeCrop(useNode, crop, ctx) {
|
|
3896
|
+
const [start, end] = crop;
|
|
3897
|
+
if (!Number.isFinite(start) || !Number.isFinite(end)) {
|
|
3898
|
+
ctx.warnings.push("retime: timeCrop is not a pair of finite numbers \u2014 ignored");
|
|
3899
|
+
return;
|
|
3900
|
+
}
|
|
3901
|
+
const keyframes = end <= start ? [{ time: 0, value: 0 }] : [
|
|
3902
|
+
...start > 0 ? [{ time: Math.max(0, start - CROP_EDGE_MS), value: 0 }] : [],
|
|
3903
|
+
{ time: Math.max(0, start), value: 1 },
|
|
3904
|
+
{ time: end, value: 1 },
|
|
3905
|
+
{ time: end + CROP_EDGE_MS, value: 0 }
|
|
3906
|
+
];
|
|
3907
|
+
const inner = __spreadValues({}, useNode);
|
|
3908
|
+
for (const k of Object.keys(useNode)) delete useNode[k];
|
|
3909
|
+
useNode.type = "g";
|
|
3910
|
+
useNode.children = [inner];
|
|
3911
|
+
useNode.animate = { opacity: { keyframes } };
|
|
3912
|
+
}
|
|
3817
3913
|
function concatRetime(child, parent) {
|
|
3818
3914
|
return {
|
|
3819
3915
|
start: parent.start + parent.stretch * child.start,
|
|
@@ -3873,8 +3969,10 @@ var PixodeskAnimator = (() => {
|
|
|
3873
3969
|
for (const useNode of sites) {
|
|
3874
3970
|
const retime = readCloneRetime(useNode);
|
|
3875
3971
|
if (!retime) continue;
|
|
3972
|
+
const crop = retime.timeCrop;
|
|
3876
3973
|
clearCloneRetime(useNode);
|
|
3877
3974
|
materialiseRetime(useNode, asRetime(retime), ctx);
|
|
3975
|
+
if (crop) applyTimeCrop(useNode, crop, ctx);
|
|
3878
3976
|
}
|
|
3879
3977
|
}
|
|
3880
3978
|
function materialiseRetime(useNode, retime, ctx) {
|
|
@@ -3969,6 +4067,8 @@ var PixodeskAnimator = (() => {
|
|
|
3969
4067
|
}
|
|
3970
4068
|
}
|
|
3971
4069
|
}
|
|
4070
|
+
|
|
4071
|
+
// ../svg-animator-core/src/effects/pathSampler.ts
|
|
3972
4072
|
var LUT_STEPS = 48;
|
|
3973
4073
|
var CMD_RE = /[MmLlHhVvCcSsQqTtAaZz]/;
|
|
3974
4074
|
function tokenize(d) {
|
|
@@ -3993,7 +4093,7 @@ var PixodeskAnimator = (() => {
|
|
|
3993
4093
|
let pcx = 0, pcy = 0;
|
|
3994
4094
|
let pqx = 0, pqy = 0;
|
|
3995
4095
|
let prevCmd = "";
|
|
3996
|
-
const
|
|
4096
|
+
const num = () => parseFloat(tokens[i++]);
|
|
3997
4097
|
const push = (P1, P2, P3) => {
|
|
3998
4098
|
const P0 = [cx, cy];
|
|
3999
4099
|
const lut = bezier2D_arcLengthLUT(P0, P1, P2, P3, LUT_STEPS);
|
|
@@ -4022,7 +4122,7 @@ var PixodeskAnimator = (() => {
|
|
|
4022
4122
|
continue;
|
|
4023
4123
|
}
|
|
4024
4124
|
if (U === "M") {
|
|
4025
|
-
const x =
|
|
4125
|
+
const x = num() + (rel ? cx : 0), y = num() + (rel ? cy : 0);
|
|
4026
4126
|
cx = x;
|
|
4027
4127
|
cy = y;
|
|
4028
4128
|
sx = x;
|
|
@@ -4031,29 +4131,29 @@ var PixodeskAnimator = (() => {
|
|
|
4031
4131
|
continue;
|
|
4032
4132
|
}
|
|
4033
4133
|
if (U === "L") {
|
|
4034
|
-
pushLine(
|
|
4134
|
+
pushLine(num() + (rel ? cx : 0), num() + (rel ? cy : 0));
|
|
4035
4135
|
} else if (U === "H") {
|
|
4036
|
-
pushLine(
|
|
4136
|
+
pushLine(num() + (rel ? cx : 0), cy);
|
|
4037
4137
|
} else if (U === "V") {
|
|
4038
|
-
pushLine(cx,
|
|
4138
|
+
pushLine(cx, num() + (rel ? cy : 0));
|
|
4039
4139
|
} else if (U === "C") {
|
|
4040
|
-
const p1 = [
|
|
4041
|
-
const p2 = [
|
|
4042
|
-
const p3 = [
|
|
4140
|
+
const p1 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4141
|
+
const p2 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4142
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4043
4143
|
pcx = p2[0];
|
|
4044
4144
|
pcy = p2[1];
|
|
4045
4145
|
push(p1, p2, p3);
|
|
4046
4146
|
} else if (U === "S") {
|
|
4047
4147
|
const smooth = prevCmd.toUpperCase() === "C" || prevCmd.toUpperCase() === "S";
|
|
4048
4148
|
const p1 = smooth ? [2 * cx - pcx, 2 * cy - pcy] : [cx, cy];
|
|
4049
|
-
const p2 = [
|
|
4050
|
-
const p3 = [
|
|
4149
|
+
const p2 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4150
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4051
4151
|
pcx = p2[0];
|
|
4052
4152
|
pcy = p2[1];
|
|
4053
4153
|
push(p1, p2, p3);
|
|
4054
4154
|
} else if (U === "Q") {
|
|
4055
|
-
const qc = [
|
|
4056
|
-
const p3 = [
|
|
4155
|
+
const qc = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4156
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4057
4157
|
pqx = qc[0];
|
|
4058
4158
|
pqy = qc[1];
|
|
4059
4159
|
const { P1, P2 } = quadToCubic([cx, cy], qc, p3);
|
|
@@ -4061,14 +4161,14 @@ var PixodeskAnimator = (() => {
|
|
|
4061
4161
|
} else if (U === "T") {
|
|
4062
4162
|
const smooth = prevCmd.toUpperCase() === "Q" || prevCmd.toUpperCase() === "T";
|
|
4063
4163
|
const qc = smooth ? [2 * cx - pqx, 2 * cy - pqy] : [cx, cy];
|
|
4064
|
-
const p3 = [
|
|
4164
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4065
4165
|
pqx = qc[0];
|
|
4066
4166
|
pqy = qc[1];
|
|
4067
4167
|
const { P1, P2 } = quadToCubic([cx, cy], qc, p3);
|
|
4068
4168
|
push(P1, P2, p3);
|
|
4069
4169
|
} else if (U === "A") {
|
|
4070
4170
|
i += 5;
|
|
4071
|
-
pushLine(
|
|
4171
|
+
pushLine(num() + (rel ? cx : 0), num() + (rel ? cy : 0));
|
|
4072
4172
|
} else {
|
|
4073
4173
|
i++;
|
|
4074
4174
|
continue;
|
|
@@ -4115,16 +4215,15 @@ var PixodeskAnimator = (() => {
|
|
|
4115
4215
|
}
|
|
4116
4216
|
};
|
|
4117
4217
|
}
|
|
4218
|
+
|
|
4219
|
+
// ../svg-animator-core/src/effects/textPathEffect.ts
|
|
4118
4220
|
var EXTEND_MARGIN_FRAC = 0.15;
|
|
4119
4221
|
function numRange(v) {
|
|
4120
|
-
|
|
4121
|
-
if (
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
const vals = o.keyframes.map((k) => Number(k.value) || 0);
|
|
4126
|
-
return { min: Math.min(...vals), max: Math.max(...vals) };
|
|
4127
|
-
}
|
|
4222
|
+
const read = readAnimatable(v);
|
|
4223
|
+
if (read.kind === "static" /* Static */ && typeof read.value === "number") return { min: read.value, max: read.value };
|
|
4224
|
+
if (read.kind === "animated" /* Animated */ && read.keyframes.length) {
|
|
4225
|
+
const vals = read.keyframes.map((k) => Number(k.value) || 0);
|
|
4226
|
+
return { min: Math.min(...vals), max: Math.max(...vals) };
|
|
4128
4227
|
}
|
|
4129
4228
|
return { min: 0, max: 0 };
|
|
4130
4229
|
}
|
|
@@ -4144,11 +4243,16 @@ var PixodeskAnimator = (() => {
|
|
|
4144
4243
|
var r3 = (n) => Math.round(n * 1e3) / 1e3;
|
|
4145
4244
|
function shiftAnimatable(v, by) {
|
|
4146
4245
|
if (!by || v === void 0 || v === null) return v;
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
if (
|
|
4150
|
-
|
|
4151
|
-
|
|
4246
|
+
const read = readAnimatable(v);
|
|
4247
|
+
if (read.kind === "absent" /* Absent */) return v;
|
|
4248
|
+
if (read.kind === "static" /* Static */) return typeof v === "number" ? read.value + by : { value: read.value + by };
|
|
4249
|
+
const out = {
|
|
4250
|
+
keyframes: read.keyframes.map((k) => __spreadProps(__spreadValues({}, k), { value: (Number(k.value) || 0) + by }))
|
|
4251
|
+
};
|
|
4252
|
+
if (read.loop !== void 0) out.loop = read.loop;
|
|
4253
|
+
if (read.autoOrient !== void 0) out.autoOrient = read.autoOrient;
|
|
4254
|
+
if (read.base !== void 0) out.value = read.base + by;
|
|
4255
|
+
return out;
|
|
4152
4256
|
}
|
|
4153
4257
|
function extendedPathForBrowser(pathD, opts) {
|
|
4154
4258
|
var _a;
|
|
@@ -4204,27 +4308,10 @@ var PixodeskAnimator = (() => {
|
|
|
4204
4308
|
}
|
|
4205
4309
|
function applyAnimatableNumber(node, attrName, raw) {
|
|
4206
4310
|
if (raw === void 0 || raw === null) return;
|
|
4207
|
-
|
|
4208
|
-
node[attrName] = String(raw);
|
|
4209
|
-
return;
|
|
4210
|
-
}
|
|
4211
|
-
if (typeof raw === "object" && raw !== null) {
|
|
4212
|
-
const obj = raw;
|
|
4213
|
-
if (Array.isArray(obj.keyframes)) {
|
|
4214
|
-
const prevAnimate = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate : void 0;
|
|
4215
|
-
const animate = __spreadValues2({}, prevAnimate || {});
|
|
4216
|
-
const block = { keyframes: obj.keyframes };
|
|
4217
|
-
if (obj.loop !== void 0) block.loop = obj.loop;
|
|
4218
|
-
animate[attrName] = block;
|
|
4219
|
-
node.animate = animate;
|
|
4220
|
-
return;
|
|
4221
|
-
}
|
|
4222
|
-
if (typeof obj.value === "number") {
|
|
4223
|
-
node[attrName] = String(obj.value);
|
|
4224
|
-
return;
|
|
4225
|
-
}
|
|
4226
|
-
}
|
|
4311
|
+
writeAnimatableChannel(node, attrName, readAnimatable(raw), { asString: true });
|
|
4227
4312
|
}
|
|
4313
|
+
|
|
4314
|
+
// ../svg-animator-core/src/effects/elementFactory.ts
|
|
4228
4315
|
var jsonElementFactory = (type, props, children) => {
|
|
4229
4316
|
const node = { type };
|
|
4230
4317
|
for (const k in props) if (props[k] !== void 0) node[k] = props[k];
|
|
@@ -4232,6 +4319,8 @@ var PixodeskAnimator = (() => {
|
|
|
4232
4319
|
if (arr.length) node.children = arr;
|
|
4233
4320
|
return node;
|
|
4234
4321
|
};
|
|
4322
|
+
|
|
4323
|
+
// ../svg-animator-core/src/effects/glyphPathBake.ts
|
|
4235
4324
|
function fmt(v, decimals) {
|
|
4236
4325
|
return Math.round(v) === v ? "" + Math.round(v) : v.toFixed(decimals);
|
|
4237
4326
|
}
|
|
@@ -4255,20 +4344,20 @@ var PixodeskAnimator = (() => {
|
|
|
4255
4344
|
while ((match = TOKEN_RE.exec(d)) !== null) tokens.push(match[0]);
|
|
4256
4345
|
let out = "";
|
|
4257
4346
|
let i = 0;
|
|
4258
|
-
const
|
|
4347
|
+
const num = () => parseFloat(tokens[i++]);
|
|
4259
4348
|
while (i < tokens.length) {
|
|
4260
4349
|
const cmd = tokens[i++];
|
|
4261
4350
|
if (cmd === "M" || cmd === "L") {
|
|
4262
|
-
const [x, y] = apply(m,
|
|
4351
|
+
const [x, y] = apply(m, num(), num());
|
|
4263
4352
|
out += cmd + pack([x, y], decimals);
|
|
4264
4353
|
} else if (cmd === "C") {
|
|
4265
|
-
const [x1, y1] = apply(m,
|
|
4266
|
-
const [x2, y2] = apply(m,
|
|
4267
|
-
const [x, y] = apply(m,
|
|
4354
|
+
const [x1, y1] = apply(m, num(), num());
|
|
4355
|
+
const [x2, y2] = apply(m, num(), num());
|
|
4356
|
+
const [x, y] = apply(m, num(), num());
|
|
4268
4357
|
out += "C" + pack([x1, y1, x2, y2, x, y], decimals);
|
|
4269
4358
|
} else if (cmd === "Q") {
|
|
4270
|
-
const [x1, y1] = apply(m,
|
|
4271
|
-
const [x, y] = apply(m,
|
|
4359
|
+
const [x1, y1] = apply(m, num(), num());
|
|
4360
|
+
const [x, y] = apply(m, num(), num());
|
|
4272
4361
|
out += "Q" + pack([x1, y1, x, y], decimals);
|
|
4273
4362
|
} else if (cmd === "Z" || cmd === "z") {
|
|
4274
4363
|
out += "Z";
|
|
@@ -4276,6 +4365,8 @@ var PixodeskAnimator = (() => {
|
|
|
4276
4365
|
}
|
|
4277
4366
|
return out;
|
|
4278
4367
|
}
|
|
4368
|
+
|
|
4369
|
+
// ../svg-animator-core/src/effects/textGlyphsEffect.ts
|
|
4279
4370
|
var DEFAULT_FONT_SIZE = 16;
|
|
4280
4371
|
var TEXT_ATTR_KEYS = [
|
|
4281
4372
|
"fontFamily",
|
|
@@ -4411,13 +4502,13 @@ var PixodeskAnimator = (() => {
|
|
|
4411
4502
|
if (y !== void 0) pen.y = y;
|
|
4412
4503
|
pen.x += (_a2 = parseLen(el.dx)) != null ? _a2 : 0;
|
|
4413
4504
|
pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
|
|
4414
|
-
const content = (_c2 = str(el[
|
|
4505
|
+
const content = (_c2 = str(el[TEXT_CONTENT_ATTR])) != null ? _c2 : str(el[TEXT_ATTR]);
|
|
4415
4506
|
if (content && !((_d2 = el.children) == null ? void 0 : _d2.length)) renderChars(content, s);
|
|
4416
4507
|
if (el.children) for (const ch of el.children) walk(ch, s);
|
|
4417
4508
|
};
|
|
4418
4509
|
const rootStyle = rootStyleOf(node);
|
|
4419
4510
|
if (node.children) for (const ch of node.children) walk(ch, rootStyle);
|
|
4420
|
-
const rootContent = (_c = str(node[
|
|
4511
|
+
const rootContent = (_c = str(node[TEXT_CONTENT_ATTR])) != null ? _c : str(node[TEXT_ATTR]);
|
|
4421
4512
|
if (rootContent && !((_d = node.children) == null ? void 0 : _d.length)) renderChars(rootContent, rootStyle);
|
|
4422
4513
|
const anchor = str(node.textAnchor);
|
|
4423
4514
|
if (anchor === "middle" || anchor === "end") {
|
|
@@ -4429,141 +4520,13 @@ var PixodeskAnimator = (() => {
|
|
|
4429
4520
|
}
|
|
4430
4521
|
return toGroup(node, buildPaths(placements, create, warnings), create);
|
|
4431
4522
|
}
|
|
4432
|
-
function layoutGlyphTextChars(node, opts) {
|
|
4433
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4434
|
-
if ((_a = opts.alongPath) == null ? void 0 : _a.pathD) return layoutGlyphTextCharsAlongPath(node, opts.alongPath.pathD, opts);
|
|
4435
|
-
const { glyphs, warnings } = opts;
|
|
4436
|
-
const soleFont = soleFontOf(glyphs);
|
|
4437
|
-
const pen = { x: (_b = parseLen(node.x)) != null ? _b : 0, y: (_c = parseLen(node.y)) != null ? _c : 0 };
|
|
4438
|
-
const boxes = [];
|
|
4439
|
-
const lines = [{ start: pen.x, end: pen.x }];
|
|
4440
|
-
let line = 0;
|
|
4441
|
-
const renderChars = (content, s) => {
|
|
4442
|
-
var _a2;
|
|
4443
|
-
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
4444
|
-
const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
|
|
4445
|
-
const scale = s.fontSize / upm;
|
|
4446
|
-
const ascent = ((_a2 = gf == null ? void 0 : gf.ascent) != null ? _a2 : 0.9 * upm) * scale;
|
|
4447
|
-
for (let i = 0; i < content.length; i++) {
|
|
4448
|
-
const ch = content.charAt(i);
|
|
4449
|
-
const g = gf == null ? void 0 : gf.glyphs[ch];
|
|
4450
|
-
const advance = (g ? g.width : 0) * scale + s.letterSpacing + (ch === " " ? s.wordSpacing : 0);
|
|
4451
|
-
boxes.push({ x: pen.x, y: pen.y, width: advance, ascent, fontSize: s.fontSize, line });
|
|
4452
|
-
pen.x += advance;
|
|
4453
|
-
lines[line].end = pen.x;
|
|
4454
|
-
}
|
|
4455
|
-
};
|
|
4456
|
-
const walk = (el, parentStyle) => {
|
|
4457
|
-
var _a2, _b2, _c2, _d2;
|
|
4458
|
-
const s = resolveStyle2(el, parentStyle);
|
|
4459
|
-
const x = parseLen(el.x);
|
|
4460
|
-
const y = parseLen(el.y);
|
|
4461
|
-
if (x !== void 0) {
|
|
4462
|
-
pen.x = x;
|
|
4463
|
-
line = lines.length;
|
|
4464
|
-
lines.push({ start: pen.x, end: pen.x });
|
|
4465
|
-
}
|
|
4466
|
-
if (y !== void 0) pen.y = y;
|
|
4467
|
-
pen.x += (_a2 = parseLen(el.dx)) != null ? _a2 : 0;
|
|
4468
|
-
pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
|
|
4469
|
-
const content = (_c2 = str(el[TEXT_ATTR])) != null ? _c2 : str(el[TEXT_CONTENT_ATTR]);
|
|
4470
|
-
if (content && !((_d2 = el.children) == null ? void 0 : _d2.length)) renderChars(content, s);
|
|
4471
|
-
if (el.children) for (const ch of el.children) walk(ch, s);
|
|
4472
|
-
};
|
|
4473
|
-
const rootStyle = rootStyleOf(node);
|
|
4474
|
-
if (node.children) for (const ch of node.children) {
|
|
4475
|
-
const before = boxes.length;
|
|
4476
|
-
walk(ch, rootStyle);
|
|
4477
|
-
if (boxes.length === before) {
|
|
4478
|
-
const s = resolveStyle2(ch, rootStyle);
|
|
4479
|
-
const gf = glyphFontFor(s, glyphs, soleFont);
|
|
4480
|
-
const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
|
|
4481
|
-
boxes.push({ x: pen.x, y: pen.y, width: 0, ascent: ((_d = gf == null ? void 0 : gf.ascent) != null ? _d : 0.9 * upm) * (s.fontSize / upm), fontSize: s.fontSize, line });
|
|
4482
|
-
}
|
|
4483
|
-
}
|
|
4484
|
-
const rootContent = (_e = str(node[TEXT_ATTR])) != null ? _e : str(node[TEXT_CONTENT_ATTR]);
|
|
4485
|
-
if (rootContent && !((_f = node.children) == null ? void 0 : _f.length)) renderChars(rootContent, rootStyle);
|
|
4486
|
-
const anchor = str(node.textAnchor);
|
|
4487
|
-
if (anchor === "middle" || anchor === "end") {
|
|
4488
|
-
for (const b of boxes) {
|
|
4489
|
-
const w = lines[b.line].end - lines[b.line].start;
|
|
4490
|
-
b.x += anchor === "middle" ? -w / 2 : -w;
|
|
4491
|
-
}
|
|
4492
|
-
}
|
|
4493
|
-
return boxes.map((_g) => {
|
|
4494
|
-
var _h = _g, { line: _l } = _h, b = __objRest2(_h, ["line"]);
|
|
4495
|
-
return b;
|
|
4496
|
-
});
|
|
4497
|
-
}
|
|
4498
|
-
function layoutGlyphTextCharsAlongPath(node, pathD, opts) {
|
|
4499
|
-
var _a, _b;
|
|
4500
|
-
const { glyphs, warnings, alongPath } = opts;
|
|
4501
|
-
const sampler = createPathSampler(pathD);
|
|
4502
|
-
if (!sampler) {
|
|
4503
|
-
warnings == null ? void 0 : warnings.push("textGlyphs: unparsable along-path geometry (caret)");
|
|
4504
|
-
return [];
|
|
4505
|
-
}
|
|
4506
|
-
const soleFont = soleFontOf(glyphs);
|
|
4507
|
-
const chars = [];
|
|
4508
|
-
let adv = 0;
|
|
4509
|
-
const walk = (el, parentStyle) => {
|
|
4510
|
-
var _a2, _b2, _c;
|
|
4511
|
-
const s = resolveStyle2(el, parentStyle);
|
|
4512
|
-
const content = (_a2 = str(el[TEXT_ATTR])) != null ? _a2 : str(el[TEXT_CONTENT_ATTR]);
|
|
4513
|
-
if (content && !((_b2 = el.children) == null ? void 0 : _b2.length)) {
|
|
4514
|
-
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
4515
|
-
const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
|
|
4516
|
-
const scale = s.fontSize / upm;
|
|
4517
|
-
const ascent = ((_c = gf == null ? void 0 : gf.ascent) != null ? _c : 0.9 * upm) * scale;
|
|
4518
|
-
for (let i = 0; i < content.length; i++) {
|
|
4519
|
-
const ch = content.charAt(i);
|
|
4520
|
-
const g = gf == null ? void 0 : gf.glyphs[ch];
|
|
4521
|
-
const glyphW = (g ? g.width : 0) * scale;
|
|
4522
|
-
const advance = glyphW + s.letterSpacing + (ch === " " ? s.wordSpacing : 0);
|
|
4523
|
-
chars.push({ advStart: adv, advEnd: adv + advance, glyphW, ascent, fontSize: s.fontSize });
|
|
4524
|
-
adv += advance;
|
|
4525
|
-
}
|
|
4526
|
-
}
|
|
4527
|
-
if (el.children) for (const ch of el.children) walk(ch, s);
|
|
4528
|
-
};
|
|
4529
|
-
walk(node, rootStyleOf(node));
|
|
4530
|
-
const width = adv;
|
|
4531
|
-
const tlr = readAnimatable(alongPath == null ? void 0 : alongPath.textLength);
|
|
4532
|
-
const tlv = tlr.kind === "animated" ? Number((_a = tlr.keyframes[0]) == null ? void 0 : _a.value) || 0 : tlr.kind === "static" ? Number(tlr.value) || 0 : 0;
|
|
4533
|
-
const k = tlv > 0 && width > 0 ? tlv / width : 1;
|
|
4534
|
-
const so = readAnimatable(alongPath == null ? void 0 : alongPath.startOffset);
|
|
4535
|
-
const { along: alongOffset, perp } = alongPathNodeOffsets(node);
|
|
4536
|
-
const base = alongOffset + (so.kind === "animated" ? Number((_b = so.keyframes[0]) == null ? void 0 : _b.value) || 0 : so.kind === "static" ? Number(so.value) || 0 : 0);
|
|
4537
|
-
const withPerp = (p) => ({
|
|
4538
|
-
x: p.x - perp * Math.sin(p.angle),
|
|
4539
|
-
y: p.y + perp * Math.cos(p.angle),
|
|
4540
|
-
angle: p.angle
|
|
4541
|
-
});
|
|
4542
|
-
return chars.map((c) => {
|
|
4543
|
-
const dStart = base + c.advStart * k;
|
|
4544
|
-
const dEnd = base + c.advEnd * k;
|
|
4545
|
-
const p0 = withPerp(sampler.sampleAtDistance(dStart));
|
|
4546
|
-
const p1 = withPerp(sampler.sampleAtDistance(dEnd));
|
|
4547
|
-
const glyphMid = sampler.sampleAtDistance(base + (c.advStart + c.glyphW / 2) * k);
|
|
4548
|
-
return {
|
|
4549
|
-
x: p0.x,
|
|
4550
|
-
y: p0.y,
|
|
4551
|
-
width: c.advEnd - c.advStart,
|
|
4552
|
-
ascent: c.ascent,
|
|
4553
|
-
fontSize: c.fontSize,
|
|
4554
|
-
endX: p1.x,
|
|
4555
|
-
endY: p1.y,
|
|
4556
|
-
rotation: glyphMid.angle * 180 / Math.PI
|
|
4557
|
-
};
|
|
4558
|
-
});
|
|
4559
|
-
}
|
|
4560
4523
|
function collectAlongPathCells(node, glyphs, soleFont, warnings) {
|
|
4561
4524
|
const cells = [];
|
|
4562
4525
|
let adv = 0;
|
|
4563
4526
|
const walk = (el, parentStyle) => {
|
|
4564
4527
|
var _a, _b, _c;
|
|
4565
4528
|
const s = resolveStyle2(el, parentStyle);
|
|
4566
|
-
const content = (_a = str(el[
|
|
4529
|
+
const content = (_a = str(el[TEXT_CONTENT_ATTR])) != null ? _a : str(el[TEXT_ATTR]);
|
|
4567
4530
|
if (content && !((_b = el.children) == null ? void 0 : _b.length)) {
|
|
4568
4531
|
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
4569
4532
|
if (gf) {
|
|
@@ -4643,7 +4606,7 @@ var PixodeskAnimator = (() => {
|
|
|
4643
4606
|
function numTrackOf(raw) {
|
|
4644
4607
|
var _a;
|
|
4645
4608
|
const r = readAnimatable(raw);
|
|
4646
|
-
if (r.kind === "animated" && r.keyframes.length >= 2) {
|
|
4609
|
+
if (r.kind === "animated" /* Animated */ && r.keyframes.length >= 2) {
|
|
4647
4610
|
const kfs = [...r.keyframes].sort((k1, k2) => (Number(k1.time) || 0) - (Number(k2.time) || 0));
|
|
4648
4611
|
const times = kfs.map((kf) => Number(kf.time) || 0);
|
|
4649
4612
|
const vals = kfs.map((kf) => Number(kf.value) || 0);
|
|
@@ -4664,7 +4627,7 @@ var PixodeskAnimator = (() => {
|
|
|
4664
4627
|
}
|
|
4665
4628
|
};
|
|
4666
4629
|
}
|
|
4667
|
-
const v = r.kind === "animated" ? Number((_a = r.keyframes[0]) == null ? void 0 : _a.value) || 0 : r.kind === "static" ? Number(r.value) || 0 : 0;
|
|
4630
|
+
const v = r.kind === "animated" /* Animated */ ? Number((_a = r.keyframes[0]) == null ? void 0 : _a.value) || 0 : r.kind === "static" /* Static */ ? Number(r.value) || 0 : 0;
|
|
4668
4631
|
return { animated: false, times: [], at: () => v };
|
|
4669
4632
|
}
|
|
4670
4633
|
function mergeTrackTimes(a, b) {
|
|
@@ -4692,14 +4655,8 @@ var PixodeskAnimator = (() => {
|
|
|
4692
4655
|
return {
|
|
4693
4656
|
time,
|
|
4694
4657
|
value: {
|
|
4695
|
-
[
|
|
4696
|
-
|
|
4697
|
-
/* Translate */
|
|
4698
|
-
]: [roundN(x - perp * sin, 3), roundN(y + perp * cos, 3)],
|
|
4699
|
-
[
|
|
4700
|
-
"rotate"
|
|
4701
|
-
/* Rotate */
|
|
4702
|
-
]: roundN(angle * 180 / Math.PI, 3)
|
|
4658
|
+
["translate" /* Translate */]: [roundN(x - perp * sin, 3), roundN(y + perp * cos, 3)],
|
|
4659
|
+
["rotate" /* Rotate */]: roundN(angle * 180 / Math.PI, 3)
|
|
4703
4660
|
}
|
|
4704
4661
|
};
|
|
4705
4662
|
};
|
|
@@ -4729,7 +4686,7 @@ var PixodeskAnimator = (() => {
|
|
|
4729
4686
|
if (loop !== void 0) op.loop = loop;
|
|
4730
4687
|
animate.opacity = op;
|
|
4731
4688
|
}
|
|
4732
|
-
out.push(create("path",
|
|
4689
|
+
out.push(create("path", __spreadProps(__spreadValues({ d }, paintProps(c.paint)), { animate }), []));
|
|
4733
4690
|
}
|
|
4734
4691
|
return out;
|
|
4735
4692
|
}
|
|
@@ -4755,7 +4712,7 @@ var PixodeskAnimator = (() => {
|
|
|
4755
4712
|
else byPaint.set(key, { paint: p.paint, d: baked });
|
|
4756
4713
|
}
|
|
4757
4714
|
const out = [];
|
|
4758
|
-
for (const { paint, d } of byPaint.values()) out.push(create("path",
|
|
4715
|
+
for (const { paint, d } of byPaint.values()) out.push(create("path", __spreadValues({ d }, paintProps(paint)), []));
|
|
4759
4716
|
return out;
|
|
4760
4717
|
}
|
|
4761
4718
|
function toGroup(node, children, create) {
|
|
@@ -4765,17 +4722,13 @@ var PixodeskAnimator = (() => {
|
|
|
4765
4722
|
gProps[k] = node[k];
|
|
4766
4723
|
}
|
|
4767
4724
|
if (gProps.style && typeof gProps.style === "object") {
|
|
4768
|
-
const style =
|
|
4725
|
+
const style = __spreadValues({}, gProps.style);
|
|
4769
4726
|
delete style["white-space"];
|
|
4770
4727
|
if (Object.keys(style).length) gProps.style = style;
|
|
4771
4728
|
else delete gProps.style;
|
|
4772
4729
|
}
|
|
4773
4730
|
return create("g", gProps, children);
|
|
4774
4731
|
}
|
|
4775
|
-
function materialiseGlyphText(node, opts) {
|
|
4776
|
-
if (opts.alongPath) return materialiseGlyphTextAlongPath(node, opts.alongPath.pathD, opts.alongPath.startOffset, opts, opts.alongPath.textLength, opts.alongPath.pathOverflow);
|
|
4777
|
-
return materialiseGlyphTextHorizontal(node, opts);
|
|
4778
|
-
}
|
|
4779
4732
|
function applyTextGlyphsEffect(node, fx, ctx) {
|
|
4780
4733
|
if (!(fx == null ? void 0 : fx.useGlyphs)) return node;
|
|
4781
4734
|
if (!ctx.glyphs) {
|
|
@@ -4791,9 +4744,11 @@ var PixodeskAnimator = (() => {
|
|
|
4791
4744
|
}
|
|
4792
4745
|
return materialiseGlyphTextAlongPath(node, pathD, startOffset, { glyphs: ctx.glyphs, warnings: ctx.warnings }, textLength, pathOverflow);
|
|
4793
4746
|
}
|
|
4794
|
-
|
|
4747
|
+
|
|
4748
|
+
// ../svg-animator-core/src/effects/trimPathEffect.ts
|
|
4749
|
+
function applyTrimPathEffect(node, trimPath, ctx) {
|
|
4795
4750
|
if (!trimPath) return node;
|
|
4796
|
-
const
|
|
4751
|
+
const combined = trimPath.subPaths === PxTrimSubPaths.combined;
|
|
4797
4752
|
const leafEntries = [];
|
|
4798
4753
|
const measure = (n) => {
|
|
4799
4754
|
if (Array.isArray(n.children) && n.children.length > 0) {
|
|
@@ -4814,20 +4769,20 @@ var PixodeskAnimator = (() => {
|
|
|
4814
4769
|
measure(node);
|
|
4815
4770
|
if (!leafEntries.length) return node;
|
|
4816
4771
|
let acc = 0;
|
|
4817
|
-
const iterOrder =
|
|
4772
|
+
const iterOrder = combined ? [...leafEntries].reverse() : leafEntries;
|
|
4818
4773
|
for (const entry of iterOrder) {
|
|
4819
4774
|
for (const sp of entry.subpaths) {
|
|
4820
|
-
if (!
|
|
4775
|
+
if (!combined) acc = 0;
|
|
4821
4776
|
sp.startOffsetPx = acc;
|
|
4822
4777
|
acc += sp.lengthPx;
|
|
4823
4778
|
}
|
|
4824
4779
|
}
|
|
4825
4780
|
const chainLengthPx = acc;
|
|
4826
|
-
if (
|
|
4781
|
+
if (combined && chainLengthPx < 1e-3) return node;
|
|
4827
4782
|
const offsetReadRaw = readAnimatable(trimPath.offset);
|
|
4828
|
-
const offsetRead = offsetReadRaw.kind === "absent" ? { kind: "static"
|
|
4783
|
+
const offsetRead = offsetReadRaw.kind === "absent" /* Absent */ ? { kind: "static" /* Static */, value: 0 } : offsetReadRaw;
|
|
4829
4784
|
const rangeReadRaw = readRangeWithCrossings(trimPath.range);
|
|
4830
|
-
const rangeRead = rangeReadRaw.kind === "absent" ? { kind: "static"
|
|
4785
|
+
const rangeRead = rangeReadRaw.kind === "absent" /* Absent */ ? { kind: "static" /* Static */, value: [0, 1] } : rangeReadRaw;
|
|
4831
4786
|
const offsetValues = readScalarValues(offsetRead);
|
|
4832
4787
|
const minOffset = offsetValues.length ? Math.min(...offsetValues) : 0;
|
|
4833
4788
|
const maxOffset = offsetValues.length ? Math.max(...offsetValues) : 0;
|
|
@@ -4835,18 +4790,18 @@ var PixodeskAnimator = (() => {
|
|
|
4835
4790
|
if (leafEntries.length === 1 && leafEntries[0].leaf === node && leafEntries[0].subpaths.length === 1) {
|
|
4836
4791
|
const entry = leafEntries[0];
|
|
4837
4792
|
const sp = entry.subpaths[0];
|
|
4838
|
-
const pathLengthPx =
|
|
4793
|
+
const pathLengthPx = combined ? chainLengthPx : sp.lengthPx;
|
|
4839
4794
|
if (pathLengthPx < 1e-3) return node;
|
|
4840
|
-
const startOffsetPct =
|
|
4795
|
+
const startOffsetPct = combined ? sp.startOffsetPx / pathLengthPx : 0;
|
|
4841
4796
|
return collapseLeafWithTrim(entry.leaf, pathLengthPx, startOffsetPct, minMaxOffset, offsetRead, rangeRead);
|
|
4842
4797
|
}
|
|
4843
4798
|
const replacements = /* @__PURE__ */ new Map();
|
|
4844
4799
|
for (const entry of leafEntries) {
|
|
4845
4800
|
const newChildren = [];
|
|
4846
4801
|
for (const sp of entry.subpaths) {
|
|
4847
|
-
const pathLengthPx =
|
|
4802
|
+
const pathLengthPx = combined ? chainLengthPx : sp.lengthPx;
|
|
4848
4803
|
if (pathLengthPx < 1e-3) continue;
|
|
4849
|
-
const startOffsetPct =
|
|
4804
|
+
const startOffsetPct = combined ? sp.startOffsetPx / pathLengthPx : 0;
|
|
4850
4805
|
newChildren.push(...buildSubpathNodes(entry.leaf, sp.subpath, pathLengthPx, startOffsetPct, minMaxOffset, offsetRead, rangeRead, ctx));
|
|
4851
4806
|
}
|
|
4852
4807
|
replacements.set(entry.leaf, wrapLeafAsGroup(entry.leaf, newChildren));
|
|
@@ -4855,14 +4810,14 @@ var PixodeskAnimator = (() => {
|
|
|
4855
4810
|
const r = replacements.get(n);
|
|
4856
4811
|
if (r) return r;
|
|
4857
4812
|
if (Array.isArray(n.children) && n.children.length > 0) {
|
|
4858
|
-
return
|
|
4813
|
+
return __spreadProps(__spreadValues({}, n), { children: n.children.map(swap) });
|
|
4859
4814
|
}
|
|
4860
4815
|
return n;
|
|
4861
4816
|
};
|
|
4862
4817
|
return swap(node);
|
|
4863
4818
|
}
|
|
4864
4819
|
function wrapLeafAsGroup(leaf, children) {
|
|
4865
|
-
const wrapper =
|
|
4820
|
+
const wrapper = __spreadProps(__spreadValues({}, leaf), { type: "g", children });
|
|
4866
4821
|
delete wrapper.d;
|
|
4867
4822
|
delete wrapper.strokeDasharray;
|
|
4868
4823
|
delete wrapper.strokeDashoffset;
|
|
@@ -4885,7 +4840,7 @@ var PixodeskAnimator = (() => {
|
|
|
4885
4840
|
function collapseLeafWithTrim(leaf, pathLengthPx, startOffsetPct, minMaxOffset, offsetRead, rangeRead) {
|
|
4886
4841
|
const offsetToDashOffset = makeOffsetToDashOffset(startOffsetPct, pathLengthPx, minMaxOffset);
|
|
4887
4842
|
const rangeToDasharray = makeRangeToDasharray(pathLengthPx, minMaxOffset);
|
|
4888
|
-
const node =
|
|
4843
|
+
const node = __spreadValues({}, leaf);
|
|
4889
4844
|
delete node.effects;
|
|
4890
4845
|
applyAttr(node, "strokeDasharray", computeAnimAttr(rangeRead, rangeToDasharray));
|
|
4891
4846
|
applyAttr(node, "strokeDashoffset", computeAnimAttr(offsetRead, offsetToDashOffset));
|
|
@@ -4927,8 +4882,8 @@ var PixodeskAnimator = (() => {
|
|
|
4927
4882
|
}
|
|
4928
4883
|
function readScalarValues(r) {
|
|
4929
4884
|
var _a;
|
|
4930
|
-
if (r.kind === "absent") return [];
|
|
4931
|
-
if (r.kind === "static") return [r.value];
|
|
4885
|
+
if (r.kind === "absent" /* Absent */) return [];
|
|
4886
|
+
if (r.kind === "static" /* Static */) return [r.value];
|
|
4932
4887
|
const out = [];
|
|
4933
4888
|
for (const kf of r.keyframes) {
|
|
4934
4889
|
const v = (_a = kf.value) != null ? _a : kf.v;
|
|
@@ -4937,10 +4892,10 @@ var PixodeskAnimator = (() => {
|
|
|
4937
4892
|
return out;
|
|
4938
4893
|
}
|
|
4939
4894
|
function computeAnimAttr(read, map) {
|
|
4940
|
-
if (read.kind === "absent") return void 0;
|
|
4941
|
-
if (read.kind === "static") return { kind: "static"
|
|
4895
|
+
if (read.kind === "absent" /* Absent */) return void 0;
|
|
4896
|
+
if (read.kind === "static" /* Static */) return { kind: "static" /* Static */, value: map(read.value) };
|
|
4942
4897
|
return {
|
|
4943
|
-
kind: "animated"
|
|
4898
|
+
kind: "animated" /* Animated */,
|
|
4944
4899
|
keyframes: read.keyframes.map((kf) => {
|
|
4945
4900
|
var _a, _b, _c, _d;
|
|
4946
4901
|
return {
|
|
@@ -4953,29 +4908,15 @@ var PixodeskAnimator = (() => {
|
|
|
4953
4908
|
};
|
|
4954
4909
|
}
|
|
4955
4910
|
function applyAttr(node, attrName, attr) {
|
|
4956
|
-
var _a, _b;
|
|
4957
4911
|
if (!attr) return;
|
|
4958
|
-
|
|
4959
|
-
node[attrName] = attr.value;
|
|
4960
|
-
return;
|
|
4961
|
-
}
|
|
4962
|
-
const prevAnimate = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate : void 0;
|
|
4963
|
-
const animate = __spreadValues2({}, prevAnimate || {});
|
|
4964
|
-
const block = { keyframes: attr.keyframes };
|
|
4965
|
-
if (attr.loop !== void 0) block.loop = attr.loop;
|
|
4966
|
-
animate[attrName] = block;
|
|
4967
|
-
node.animate = animate;
|
|
4968
|
-
const firstKf = attr.keyframes[0];
|
|
4969
|
-
if (firstKf && ((_a = firstKf.value) != null ? _a : firstKf.v) !== void 0) {
|
|
4970
|
-
node[attrName] = (_b = firstKf.value) != null ? _b : firstKf.v;
|
|
4971
|
-
}
|
|
4912
|
+
writeAnimatableChannel(node, attrName, attr);
|
|
4972
4913
|
}
|
|
4973
4914
|
var OPACITY_STEP_MS = 10;
|
|
4974
4915
|
function computeOpacityFromRange(rangeRead) {
|
|
4975
4916
|
var _a, _b, _c, _d, _e, _f;
|
|
4976
4917
|
const hide = (v) => v[0] === v[1];
|
|
4977
|
-
if (rangeRead.kind === "absent") return void 0;
|
|
4978
|
-
if (rangeRead.kind === "static") return hide(rangeRead.value) ? { kind: "static"
|
|
4918
|
+
if (rangeRead.kind === "absent" /* Absent */) return void 0;
|
|
4919
|
+
if (rangeRead.kind === "static" /* Static */) return hide(rangeRead.value) ? { kind: "static" /* Static */, value: 0 } : void 0;
|
|
4979
4920
|
const kfs = rangeRead.keyframes;
|
|
4980
4921
|
let anyHide = false;
|
|
4981
4922
|
let allHide = true;
|
|
@@ -4984,7 +4925,7 @@ var PixodeskAnimator = (() => {
|
|
|
4984
4925
|
else allHide = false;
|
|
4985
4926
|
}
|
|
4986
4927
|
if (!anyHide) return void 0;
|
|
4987
|
-
if (allHide) return { kind: "static"
|
|
4928
|
+
if (allHide) return { kind: "static" /* Static */, value: 0 };
|
|
4988
4929
|
const out = [];
|
|
4989
4930
|
for (let i = 0; i < kfs.length; i++) {
|
|
4990
4931
|
const kf = kfs[i];
|
|
@@ -5003,11 +4944,11 @@ var PixodeskAnimator = (() => {
|
|
|
5003
4944
|
}
|
|
5004
4945
|
}
|
|
5005
4946
|
if (out.length <= 1) return void 0;
|
|
5006
|
-
return { kind: "animated"
|
|
4947
|
+
return { kind: "animated" /* Animated */, keyframes: out };
|
|
5007
4948
|
}
|
|
5008
4949
|
function readRangeWithCrossings(raw) {
|
|
5009
4950
|
const r = readAnimatable(raw);
|
|
5010
|
-
if (r.kind !== "animated") return r;
|
|
4951
|
+
if (r.kind !== "animated" /* Animated */) return r;
|
|
5011
4952
|
const kfs = r.keyframes.map((kf) => {
|
|
5012
4953
|
var _a, _b, _c, _d;
|
|
5013
4954
|
return {
|
|
@@ -5019,7 +4960,7 @@ var PixodeskAnimator = (() => {
|
|
|
5019
4960
|
const hasReverse = kfs.some((kf) => kf.value[0] > kf.value[1]);
|
|
5020
4961
|
if (!hasReverse) {
|
|
5021
4962
|
return {
|
|
5022
|
-
kind: "animated"
|
|
4963
|
+
kind: "animated" /* Animated */,
|
|
5023
4964
|
keyframes: kfs.map((kf) => ({ time: kf.time, value: kf.value, easing: kf.easing }))
|
|
5024
4965
|
};
|
|
5025
4966
|
}
|
|
@@ -5055,7 +4996,7 @@ var PixodeskAnimator = (() => {
|
|
|
5055
4996
|
const m = (v[0] + v[1]) / 2;
|
|
5056
4997
|
out.push({ time: t, value: [m, m] });
|
|
5057
4998
|
}
|
|
5058
|
-
return { kind: "animated"
|
|
4999
|
+
return { kind: "animated" /* Animated */, keyframes: out };
|
|
5059
5000
|
}
|
|
5060
5001
|
function bisectionForRangeCrossing(prev, cur) {
|
|
5061
5002
|
const f = (t) => {
|
|
@@ -5140,6 +5081,8 @@ var PixodeskAnimator = (() => {
|
|
|
5140
5081
|
}
|
|
5141
5082
|
return void 0;
|
|
5142
5083
|
}
|
|
5084
|
+
|
|
5085
|
+
// ../svg-animator-core/src/effects/PlayerEffectsUtil.ts
|
|
5143
5086
|
function applyPlayerEffects(root) {
|
|
5144
5087
|
var _a, _b;
|
|
5145
5088
|
const ctx = {
|
|
@@ -5150,9 +5093,9 @@ var PixodeskAnimator = (() => {
|
|
|
5150
5093
|
nextId: 0,
|
|
5151
5094
|
contentRefInnerIds: /* @__PURE__ */ new Map(),
|
|
5152
5095
|
maskAncestorChains: /* @__PURE__ */ new Map(),
|
|
5153
|
-
// Resolved engine: `frames` ONLY when explicitly set; auto/
|
|
5154
|
-
//
|
|
5155
|
-
engine: ((_a = getAnimatorConfig(root)) == null ? void 0 : _a.mode) === PxAnimatorMode.frames ? PxAnimatorEngine.frames : PxAnimatorEngine.
|
|
5096
|
+
// Resolved engine: `frames` ONLY when explicitly set; auto/waapi/unset →
|
|
5097
|
+
// waapi (we're not 100% sure it's frames, and CSS/WAAPI need the inline form).
|
|
5098
|
+
engine: ((_a = getAnimatorConfig(root)) == null ? void 0 : _a.mode) === PxAnimatorMode.frames ? PxAnimatorEngine.frames : PxAnimatorEngine.waapi,
|
|
5156
5099
|
glyphs: (_b = getDefs(root)) == null ? void 0 : _b.glyphs
|
|
5157
5100
|
};
|
|
5158
5101
|
const working = clone(root);
|
|
@@ -5170,8 +5113,7 @@ var PixodeskAnimator = (() => {
|
|
|
5170
5113
|
const originalId = typeof node.id === "string" ? node.id : void 0;
|
|
5171
5114
|
const innerIdForContentRef = originalId ? ctx.contentRefInnerIds.get(originalId) : void 0;
|
|
5172
5115
|
if (!fx && !innerIdForContentRef) return node;
|
|
5173
|
-
const {
|
|
5174
|
-
const isCombinedShape = fx == null ? void 0 : fx.isCombinedShape;
|
|
5116
|
+
const { transformBy, repeater, maskedBy, clipPath, trimPath, clone: cloneFx, fillGradient, strokeGradient, textPath, text } = fx != null ? fx : {};
|
|
5175
5117
|
if (fx) delete node.effects;
|
|
5176
5118
|
let n = node;
|
|
5177
5119
|
let consumedByGlyphs = false;
|
|
@@ -5191,15 +5133,15 @@ var PixodeskAnimator = (() => {
|
|
|
5191
5133
|
if (!consumedByGlyphs) n = applyTextPathEffect(n, textPath, ctx);
|
|
5192
5134
|
n = applyFillGradientEffect(n, fillGradient, ctx);
|
|
5193
5135
|
n = applyStrokeGradientEffect(n, strokeGradient, ctx);
|
|
5194
|
-
n = applyTrimPathEffect(n, trimPath,
|
|
5136
|
+
n = applyTrimPathEffect(n, trimPath, ctx);
|
|
5195
5137
|
n = applyRepeaterEffect(n, repeater, ctx);
|
|
5196
|
-
n = applyMaskedByEffect(n, maskedBy,
|
|
5138
|
+
n = applyMaskedByEffect(n, maskedBy, transformBy, ctx);
|
|
5197
5139
|
n = applyClipPathEffect(n, clipPath, ctx);
|
|
5198
5140
|
if (innerIdForContentRef) {
|
|
5199
5141
|
applyRefHref(n, cloneFx, ctx);
|
|
5200
|
-
n = splitForContentRef(n,
|
|
5142
|
+
n = splitForContentRef(n, transformBy, originalId, innerIdForContentRef, ctx);
|
|
5201
5143
|
} else {
|
|
5202
|
-
n = applyRefAndTransformationEffect(n, cloneFx,
|
|
5144
|
+
n = applyRefAndTransformationEffect(n, cloneFx, transformBy, ctx);
|
|
5203
5145
|
}
|
|
5204
5146
|
if (cloneFx == null ? void 0 : cloneFx.retime) node.effects = { clone: { retime: cloneFx.retime } };
|
|
5205
5147
|
if (originalId) ctx.idMap.set(originalId, n);
|
|
@@ -5209,12 +5151,145 @@ var PixodeskAnimator = (() => {
|
|
|
5209
5151
|
applyAllRetimeEffects(node, ctx);
|
|
5210
5152
|
return node;
|
|
5211
5153
|
}
|
|
5154
|
+
|
|
5155
|
+
// ../svg-animator-core/src/PxOffsetPathMaterialiser.ts
|
|
5156
|
+
var kfTime = (kf) => {
|
|
5157
|
+
var _a, _b;
|
|
5158
|
+
return (_b = (_a = kf.t) != null ? _a : kf.time) != null ? _b : 0;
|
|
5159
|
+
};
|
|
5160
|
+
var kfValue = (kf) => {
|
|
5161
|
+
var _a;
|
|
5162
|
+
return (_a = kf.v) != null ? _a : kf.value;
|
|
5163
|
+
};
|
|
5164
|
+
var kfEasing = (kf) => {
|
|
5165
|
+
var _a;
|
|
5166
|
+
return (_a = kf.e) != null ? _a : kf.easing;
|
|
5167
|
+
};
|
|
5168
|
+
var kfTangentIn = (kf) => {
|
|
5169
|
+
var _a;
|
|
5170
|
+
return (_a = kf.tangentIn) != null ? _a : kf.ti;
|
|
5171
|
+
};
|
|
5172
|
+
var kfTangentOut = (kf) => {
|
|
5173
|
+
var _a;
|
|
5174
|
+
return (_a = kf.tangentOut) != null ? _a : kf.to;
|
|
5175
|
+
};
|
|
5176
|
+
function cubicAt(p0, c1, c2, p1, t) {
|
|
5177
|
+
const u = 1 - t;
|
|
5178
|
+
const a = u * u * u, b = 3 * u * u * t, c = 3 * u * t * t, d = t * t * t;
|
|
5179
|
+
return [
|
|
5180
|
+
a * p0[0] + b * c1[0] + c * c2[0] + d * p1[0],
|
|
5181
|
+
a * p0[1] + b * c1[1] + c * c2[1] + d * p1[1]
|
|
5182
|
+
];
|
|
5183
|
+
}
|
|
5184
|
+
function cubicLength(p0, c1, c2, p1, steps = 64) {
|
|
5185
|
+
let len = 0;
|
|
5186
|
+
let prev = p0;
|
|
5187
|
+
for (let i = 1; i <= steps; i++) {
|
|
5188
|
+
const pt = cubicAt(p0, c1, c2, p1, i / steps);
|
|
5189
|
+
len += Math.hypot(pt[0] - prev[0], pt[1] - prev[1]);
|
|
5190
|
+
prev = pt;
|
|
5191
|
+
}
|
|
5192
|
+
return len;
|
|
5193
|
+
}
|
|
5194
|
+
var fmt2 = (n) => {
|
|
5195
|
+
const r = Math.round(n * 1e4) / 1e4;
|
|
5196
|
+
return Object.is(r, -0) ? "0" : String(r);
|
|
5197
|
+
};
|
|
5198
|
+
function buildOffsetPath(propAnim) {
|
|
5199
|
+
var _a, _b, _c, _d;
|
|
5200
|
+
if (propAnim.alongPathMode !== "offsetPath") return void 0;
|
|
5201
|
+
const kfs = (_a = propAnim.keyframes) != null ? _a : propAnim.kfs;
|
|
5202
|
+
if (!kfs || kfs.length < 2) return void 0;
|
|
5203
|
+
const first = kfValue(kfs[0]);
|
|
5204
|
+
const anchor = (first == null ? void 0 : first.origin) && first.origin.length >= 2 ? [first.origin[0], first.origin[1]] : [0, 0];
|
|
5205
|
+
const points = [];
|
|
5206
|
+
for (const kf of kfs) {
|
|
5207
|
+
const v = kfValue(kf);
|
|
5208
|
+
const tr = v == null ? void 0 : v.translate;
|
|
5209
|
+
if (!tr || tr.length < 2) return void 0;
|
|
5210
|
+
const parts = Object.keys(v);
|
|
5211
|
+
if (parts.some((p) => p !== "translate" && p !== "origin")) return void 0;
|
|
5212
|
+
const o = (_b = v == null ? void 0 : v.origin) != null ? _b : [0, 0];
|
|
5213
|
+
if (o[0] !== anchor[0] || o[1] !== anchor[1]) return void 0;
|
|
5214
|
+
points.push([tr[0] + anchor[0], tr[1] + anchor[1]]);
|
|
5215
|
+
}
|
|
5216
|
+
if (!kfs.some((kf) => kfTangentIn(kf) || kfTangentOut(kf))) return void 0;
|
|
5217
|
+
let d = "M" + fmt2(points[0][0]) + "," + fmt2(points[0][1]);
|
|
5218
|
+
const segLens = [];
|
|
5219
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
5220
|
+
const p0 = points[i], p1 = points[i + 1];
|
|
5221
|
+
const to = (_c = kfTangentOut(kfs[i])) != null ? _c : [0, 0];
|
|
5222
|
+
const ti = (_d = kfTangentIn(kfs[i + 1])) != null ? _d : [0, 0];
|
|
5223
|
+
const c1 = [p0[0] + to[0], p0[1] + to[1]];
|
|
5224
|
+
const c2 = [p1[0] + ti[0], p1[1] + ti[1]];
|
|
5225
|
+
d += "C" + fmt2(c1[0]) + "," + fmt2(c1[1]) + "," + fmt2(c2[0]) + "," + fmt2(c2[1]) + "," + fmt2(p1[0]) + "," + fmt2(p1[1]);
|
|
5226
|
+
segLens.push(cubicLength(p0, c1, c2, p1));
|
|
5227
|
+
}
|
|
5228
|
+
const total = segLens.reduce((a, b) => a + b, 0);
|
|
5229
|
+
if (!(total > 0)) return void 0;
|
|
5230
|
+
const distanceKfs = [];
|
|
5231
|
+
let cum = 0;
|
|
5232
|
+
for (let i = 0; i < kfs.length; i++) {
|
|
5233
|
+
if (i > 0) cum += segLens[i - 1];
|
|
5234
|
+
const out = { t: kfTime(kfs[i]), v: cum / total };
|
|
5235
|
+
const e = kfEasing(kfs[i]);
|
|
5236
|
+
if (e !== void 0) out.e = e;
|
|
5237
|
+
distanceKfs.push(out);
|
|
5238
|
+
}
|
|
5239
|
+
return { pathStr: d, distanceKfs, autoOrient: !!propAnim.autoOrient, anchor };
|
|
5240
|
+
}
|
|
5241
|
+
function materialiseOffsetPathsInTree(root) {
|
|
5242
|
+
const walk = (node) => {
|
|
5243
|
+
var _a;
|
|
5244
|
+
let out = node;
|
|
5245
|
+
const anim = node.animate;
|
|
5246
|
+
const transform = anim == null ? void 0 : anim["transform"];
|
|
5247
|
+
if (transform) {
|
|
5248
|
+
const built = buildOffsetPath(transform);
|
|
5249
|
+
if (built) {
|
|
5250
|
+
const newAnimate = __spreadValues({}, anim);
|
|
5251
|
+
delete newAnimate["transform"];
|
|
5252
|
+
const distance = { keyframes: built.distanceKfs };
|
|
5253
|
+
if (transform.loop !== void 0) distance.loop = transform.loop;
|
|
5254
|
+
newAnimate["offsetDistance"] = distance;
|
|
5255
|
+
const staticTr = node.transform;
|
|
5256
|
+
let newTransform = staticTr;
|
|
5257
|
+
if (staticTr && typeof staticTr === "object") {
|
|
5258
|
+
const t = __spreadValues({}, staticTr);
|
|
5259
|
+
delete t["translate"];
|
|
5260
|
+
delete t["origin"];
|
|
5261
|
+
newTransform = Object.keys(t).length ? t : void 0;
|
|
5262
|
+
}
|
|
5263
|
+
out = __spreadProps(__spreadValues({}, node), {
|
|
5264
|
+
animate: newAnimate,
|
|
5265
|
+
style: __spreadProps(__spreadValues({}, node.style), {
|
|
5266
|
+
offsetPath: "path('" + built.pathStr + "')",
|
|
5267
|
+
offsetAnchor: fmt2(built.anchor[0]) + "px " + fmt2(built.anchor[1]) + "px",
|
|
5268
|
+
offsetRotate: built.autoOrient ? "auto" : "0deg",
|
|
5269
|
+
offsetDistance: "0%"
|
|
5270
|
+
})
|
|
5271
|
+
});
|
|
5272
|
+
if (newTransform !== void 0) out.transform = newTransform;
|
|
5273
|
+
else delete out.transform;
|
|
5274
|
+
}
|
|
5275
|
+
}
|
|
5276
|
+
if ((_a = out.children) == null ? void 0 : _a.length) {
|
|
5277
|
+
const children = out.children.map(walk);
|
|
5278
|
+
if (children.some((c, i) => c !== out.children[i])) out = __spreadProps(__spreadValues({}, out), { children });
|
|
5279
|
+
}
|
|
5280
|
+
return out;
|
|
5281
|
+
};
|
|
5282
|
+
return walk(root);
|
|
5283
|
+
}
|
|
5284
|
+
|
|
5285
|
+
// ../svg-animator-core/src/PxAnimatorMaterialiseAll.ts
|
|
5212
5286
|
function materialiseAllInTree(doc, engine, opts) {
|
|
5213
5287
|
var _a, _b;
|
|
5214
5288
|
let root = applyPlayerEffects(doc).root;
|
|
5289
|
+
root = materialiseOffsetPathsInTree(root);
|
|
5215
5290
|
const duration = (_b = (_a = getAnimatorConfig(root)) == null ? void 0 : _a.duration) != null ? _b : DEFAULT_DURATION_MS;
|
|
5216
5291
|
root = materialiseInternalLoopsInTree(root, duration);
|
|
5217
|
-
if (engine === PxAnimatorEngine.
|
|
5292
|
+
if (engine === PxAnimatorEngine.waapi) {
|
|
5218
5293
|
root = materialiseMotionPathsInTree(root, opts == null ? void 0 : opts.motionPath);
|
|
5219
5294
|
root = materialiseAnimatedUseInstances(root);
|
|
5220
5295
|
root = pruneUnreferencedDefs(root);
|
|
@@ -5250,6 +5325,8 @@ var PixodeskAnimator = (() => {
|
|
|
5250
5325
|
}
|
|
5251
5326
|
return root;
|
|
5252
5327
|
}
|
|
5328
|
+
|
|
5329
|
+
// ../svg-animator-core/src/PxFrameLoop.ts
|
|
5253
5330
|
function requestFrame(cb) {
|
|
5254
5331
|
const g = globalThis;
|
|
5255
5332
|
if (typeof g.requestAnimationFrame === "function") return g.requestAnimationFrame(cb);
|
|
@@ -5526,270 +5603,6 @@ var PixodeskAnimator = (() => {
|
|
|
5526
5603
|
};
|
|
5527
5604
|
return api;
|
|
5528
5605
|
}
|
|
5529
|
-
var IDENTITY = [1, 0, 0, 1, 0, 0];
|
|
5530
|
-
function mul(m, n) {
|
|
5531
|
-
return [
|
|
5532
|
-
m[0] * n[0] + m[2] * n[1],
|
|
5533
|
-
m[1] * n[0] + m[3] * n[1],
|
|
5534
|
-
m[0] * n[2] + m[2] * n[3],
|
|
5535
|
-
m[1] * n[2] + m[3] * n[3],
|
|
5536
|
-
m[0] * n[4] + m[2] * n[5] + m[4],
|
|
5537
|
-
m[1] * n[4] + m[3] * n[5] + m[5]
|
|
5538
|
-
];
|
|
5539
|
-
}
|
|
5540
|
-
var translateM = (x, y) => [1, 0, 0, 1, x, y];
|
|
5541
|
-
var scaleM = (sx, sy) => [sx, 0, 0, sy, 0, 0];
|
|
5542
|
-
function rotateM(deg) {
|
|
5543
|
-
const r = deg * Math.PI / 180;
|
|
5544
|
-
return [Math.cos(r), Math.sin(r), -Math.sin(r), Math.cos(r), 0, 0];
|
|
5545
|
-
}
|
|
5546
|
-
var skewXM = (deg) => [1, 0, Math.tan(deg * Math.PI / 180), 1, 0, 0];
|
|
5547
|
-
var skewYM = (deg) => [1, Math.tan(deg * Math.PI / 180), 0, 1, 0, 0];
|
|
5548
|
-
function parseTransformString(s) {
|
|
5549
|
-
let m = IDENTITY;
|
|
5550
|
-
const re = /(translate|rotate|scale|matrix|skewX|skewY)\(([^)]*)\)/g;
|
|
5551
|
-
let hit;
|
|
5552
|
-
while (hit = re.exec(s)) {
|
|
5553
|
-
const fn = hit[1];
|
|
5554
|
-
const a = hit[2].split(/[\s,]+/).filter(Boolean).map(Number);
|
|
5555
|
-
if (fn === "translate") m = mul(m, translateM(a[0] || 0, a[1] || 0));
|
|
5556
|
-
else if (fn === "scale") m = mul(m, scaleM(a[0], a.length > 1 ? a[1] : a[0]));
|
|
5557
|
-
else if (fn === "rotate") m = mul(m, rotateM(a[0]));
|
|
5558
|
-
else if (fn === "skewX") m = mul(m, skewXM(a[0]));
|
|
5559
|
-
else if (fn === "skewY") m = mul(m, skewYM(a[0]));
|
|
5560
|
-
else if (fn === "matrix") m = mul(m, [a[0], a[1], a[2], a[3], a[4], a[5]]);
|
|
5561
|
-
}
|
|
5562
|
-
return m;
|
|
5563
|
-
}
|
|
5564
|
-
function partsToMatrix(p) {
|
|
5565
|
-
let m = IDENTITY;
|
|
5566
|
-
if (p.translate) m = mul(m, translateM(p.translate[0], p.translate[1]));
|
|
5567
|
-
const pivot = p.origin && (p.rotate !== void 0 || p.scale);
|
|
5568
|
-
if (pivot) m = mul(m, translateM(p.origin[0], p.origin[1]));
|
|
5569
|
-
if (p.rotate !== void 0) m = mul(m, rotateM(p.rotate));
|
|
5570
|
-
if (p.scale) m = mul(m, scaleM(p.scale[0], p.scale[1]));
|
|
5571
|
-
if (pivot) m = mul(m, translateM(-p.origin[0], -p.origin[1]));
|
|
5572
|
-
return m;
|
|
5573
|
-
}
|
|
5574
|
-
function lerp(a, b, f) {
|
|
5575
|
-
return a + (b - a) * f;
|
|
5576
|
-
}
|
|
5577
|
-
function interpParts(kfs, t) {
|
|
5578
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
5579
|
-
if (!kfs.length) return {};
|
|
5580
|
-
if (t <= ((_a = kfs[0].time) != null ? _a : 0)) return kfs[0].value || {};
|
|
5581
|
-
if (t >= ((_b = kfs[kfs.length - 1].time) != null ? _b : 0)) return kfs[kfs.length - 1].value || {};
|
|
5582
|
-
let i = 0;
|
|
5583
|
-
while (i < kfs.length - 1 && ((_c = kfs[i + 1].time) != null ? _c : 0) < t) i++;
|
|
5584
|
-
const a = kfs[i], b = kfs[i + 1];
|
|
5585
|
-
const f = (t - ((_d = a.time) != null ? _d : 0)) / (((_e = b.time) != null ? _e : 0) - ((_f = a.time) != null ? _f : 0) || 1);
|
|
5586
|
-
const va = a.value || {}, vb = b.value || {};
|
|
5587
|
-
const out = {};
|
|
5588
|
-
if (va.translate && vb.translate) out.translate = [lerp(va.translate[0], vb.translate[0], f), lerp(va.translate[1], vb.translate[1], f)];
|
|
5589
|
-
else out.translate = va.translate || vb.translate;
|
|
5590
|
-
if (va.rotate !== void 0 && vb.rotate !== void 0) out.rotate = lerp(va.rotate, vb.rotate, f);
|
|
5591
|
-
else out.rotate = (_g = va.rotate) != null ? _g : vb.rotate;
|
|
5592
|
-
if (va.scale && vb.scale) out.scale = [lerp(va.scale[0], vb.scale[0], f), lerp(va.scale[1], vb.scale[1], f)];
|
|
5593
|
-
else out.scale = va.scale || vb.scale;
|
|
5594
|
-
out.origin = va.origin || vb.origin;
|
|
5595
|
-
return out;
|
|
5596
|
-
}
|
|
5597
|
-
function evalTransformValue(v, t) {
|
|
5598
|
-
if (v === void 0 || v === null) return IDENTITY;
|
|
5599
|
-
if (typeof v === "string") return parseTransformString(v);
|
|
5600
|
-
if (v.keyframes) return partsToMatrix(interpParts(v.keyframes, t));
|
|
5601
|
-
if (v.value) return partsToMatrix(v.value);
|
|
5602
|
-
return IDENTITY;
|
|
5603
|
-
}
|
|
5604
|
-
function nodeMatrix(node, t) {
|
|
5605
|
-
if (node.animate && node.animate.transform) return evalTransformValue(node.animate.transform, t);
|
|
5606
|
-
if (node.transform !== void 0) return evalTransformValue(node.transform, t);
|
|
5607
|
-
return IDENTITY;
|
|
5608
|
-
}
|
|
5609
|
-
function evalScalar(animated, staticVal, fallback, t) {
|
|
5610
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5611
|
-
if (animated && animated.keyframes && animated.keyframes.length) {
|
|
5612
|
-
const kfs = animated.keyframes;
|
|
5613
|
-
if (t <= ((_a = kfs[0].time) != null ? _a : 0)) return kfs[0].value;
|
|
5614
|
-
if (t >= ((_b = kfs[kfs.length - 1].time) != null ? _b : 0)) return kfs[kfs.length - 1].value;
|
|
5615
|
-
let i = 0;
|
|
5616
|
-
while (i < kfs.length - 1 && ((_c = kfs[i + 1].time) != null ? _c : 0) < t) i++;
|
|
5617
|
-
const a = kfs[i], b = kfs[i + 1];
|
|
5618
|
-
const f = (t - ((_d = a.time) != null ? _d : 0)) / (((_e = b.time) != null ? _e : 0) - ((_f = a.time) != null ? _f : 0) || 1);
|
|
5619
|
-
return lerp(a.value, b.value, f);
|
|
5620
|
-
}
|
|
5621
|
-
return staticVal !== void 0 ? Number(staticVal) : fallback;
|
|
5622
|
-
}
|
|
5623
|
-
var CONTAINER_TYPES = /* @__PURE__ */ new Set(["svg", "g", "symbol"]);
|
|
5624
|
-
var SKIP_TYPES = /* @__PURE__ */ new Set(["defs", "mask", "clipPath", "title"]);
|
|
5625
|
-
function buildIdMap2(node, map) {
|
|
5626
|
-
var _a;
|
|
5627
|
-
if (typeof node.id === "string") map.set(node.id, node);
|
|
5628
|
-
(_a = node.children) == null ? void 0 : _a.forEach((c) => buildIdMap2(c, map));
|
|
5629
|
-
}
|
|
5630
|
-
function num(v) {
|
|
5631
|
-
return v === void 0 || v === null ? 0 : Number(v);
|
|
5632
|
-
}
|
|
5633
|
-
function round(n) {
|
|
5634
|
-
return Math.round(n * 100) / 100 + 0;
|
|
5635
|
-
}
|
|
5636
|
-
function geomKey(node) {
|
|
5637
|
-
var _a;
|
|
5638
|
-
switch (node.type) {
|
|
5639
|
-
case "rect":
|
|
5640
|
-
return num(node.width) + "," + num(node.height) + "," + num(node.x) + "," + num(node.y);
|
|
5641
|
-
case "ellipse":
|
|
5642
|
-
return num(node.rx) + "," + num(node.ry) + "," + num(node.cx) + "," + num(node.cy);
|
|
5643
|
-
case "circle":
|
|
5644
|
-
return num(node.r) + "," + num(node.cx) + "," + num(node.cy);
|
|
5645
|
-
case "path":
|
|
5646
|
-
return String((_a = node.d) != null ? _a : "");
|
|
5647
|
-
default:
|
|
5648
|
-
return "";
|
|
5649
|
-
}
|
|
5650
|
-
}
|
|
5651
|
-
function describePrimitive(node, m, t) {
|
|
5652
|
-
var _a, _b, _c, _d, _e;
|
|
5653
|
-
const fill = (_a = node.fill) != null ? _a : "";
|
|
5654
|
-
const stroke = (_b = node.stroke) != null ? _b : "";
|
|
5655
|
-
const sw = (_d = (_c = node["stroke-width"]) != null ? _c : node.strokeWidth) != null ? _d : "";
|
|
5656
|
-
const opacity = round(evalScalar((_e = node.animate) == null ? void 0 : _e.opacity, node.opacity, 1, t));
|
|
5657
|
-
const masked = node.mask ? 1 : 0;
|
|
5658
|
-
const mat = m.map(round).join(",");
|
|
5659
|
-
return node.type + "|" + geomKey(node) + "|[" + mat + "]|f:" + fill + "|s:" + stroke + "|sw:" + (num(sw) || "") + "|o:" + opacity + "|m:" + masked;
|
|
5660
|
-
}
|
|
5661
|
-
function flatten(node, parent, t, idMap, out) {
|
|
5662
|
-
var _a;
|
|
5663
|
-
const type = node.type || "";
|
|
5664
|
-
if (SKIP_TYPES.has(type)) return;
|
|
5665
|
-
const m = mul(parent, nodeMatrix(node, t));
|
|
5666
|
-
if (type === "use") {
|
|
5667
|
-
const targetId = typeof node.href === "string" ? node.href.replace(/^#/, "") : "";
|
|
5668
|
-
const target = idMap.get(targetId);
|
|
5669
|
-
const useM = mul(m, translateM(num(node.x), num(node.y)));
|
|
5670
|
-
if (target) flatten(target, useM, t, idMap, out);
|
|
5671
|
-
else out.push("UNRESOLVED_USE:#" + targetId);
|
|
5672
|
-
return;
|
|
5673
|
-
}
|
|
5674
|
-
if (CONTAINER_TYPES.has(type)) {
|
|
5675
|
-
(_a = node.children) == null ? void 0 : _a.forEach((c) => flatten(c, m, t, idMap, out));
|
|
5676
|
-
return;
|
|
5677
|
-
}
|
|
5678
|
-
out.push(describePrimitive(node, m, t));
|
|
5679
|
-
}
|
|
5680
|
-
function collectSampleTimes(node, into) {
|
|
5681
|
-
var _a;
|
|
5682
|
-
into.add(0);
|
|
5683
|
-
const scanAnim = (anim) => {
|
|
5684
|
-
var _a2;
|
|
5685
|
-
if (!anim || typeof anim !== "object") return;
|
|
5686
|
-
for (const key of Object.keys(anim)) {
|
|
5687
|
-
const kfs = (_a2 = anim[key]) == null ? void 0 : _a2.keyframes;
|
|
5688
|
-
if (Array.isArray(kfs)) kfs.forEach((kf) => {
|
|
5689
|
-
var _a3;
|
|
5690
|
-
return into.add((_a3 = kf.time) != null ? _a3 : 0);
|
|
5691
|
-
});
|
|
5692
|
-
}
|
|
5693
|
-
};
|
|
5694
|
-
scanAnim(node.animate);
|
|
5695
|
-
if (node.transform && typeof node.transform === "object" && node.transform.keyframes) {
|
|
5696
|
-
node.transform.keyframes.forEach((kf) => {
|
|
5697
|
-
var _a2;
|
|
5698
|
-
return into.add((_a2 = kf.time) != null ? _a2 : 0);
|
|
5699
|
-
});
|
|
5700
|
-
}
|
|
5701
|
-
(_a = node.children) == null ? void 0 : _a.forEach((c) => collectSampleTimes(c, into));
|
|
5702
|
-
}
|
|
5703
|
-
function visualModelAt(root, t) {
|
|
5704
|
-
const idMap = /* @__PURE__ */ new Map();
|
|
5705
|
-
buildIdMap2(root, idMap);
|
|
5706
|
-
const out = [];
|
|
5707
|
-
flatten(root, IDENTITY, t, idMap, out);
|
|
5708
|
-
return out.sort();
|
|
5709
|
-
}
|
|
5710
|
-
function diffInEffect(a, b) {
|
|
5711
|
-
const times = /* @__PURE__ */ new Set();
|
|
5712
|
-
collectSampleTimes(a, times);
|
|
5713
|
-
collectSampleTimes(b, times);
|
|
5714
|
-
const diffs = [];
|
|
5715
|
-
for (const t of Array.from(times).sort((x, y) => x - y)) {
|
|
5716
|
-
const ma = visualModelAt(a, t);
|
|
5717
|
-
const mb = visualModelAt(b, t);
|
|
5718
|
-
const onlyInA = subtractMultiset(ma, mb);
|
|
5719
|
-
const onlyInB = subtractMultiset(mb, ma);
|
|
5720
|
-
if (onlyInA.length || onlyInB.length) diffs.push({ time: t, onlyInA, onlyInB });
|
|
5721
|
-
}
|
|
5722
|
-
return diffs;
|
|
5723
|
-
}
|
|
5724
|
-
function subtractMultiset(a, b) {
|
|
5725
|
-
const counts = /* @__PURE__ */ new Map();
|
|
5726
|
-
for (const x of b) counts.set(x, (counts.get(x) || 0) + 1);
|
|
5727
|
-
const extra = [];
|
|
5728
|
-
for (const x of a) {
|
|
5729
|
-
const c = counts.get(x) || 0;
|
|
5730
|
-
if (c > 0) counts.set(x, c - 1);
|
|
5731
|
-
else extra.push(x);
|
|
5732
|
-
}
|
|
5733
|
-
return extra;
|
|
5734
|
-
}
|
|
5735
|
-
|
|
5736
|
-
// src/PxAnimatorDOM.ts
|
|
5737
|
-
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
5738
|
-
function createElement(tagName, normalisedProps, style, children, textContent) {
|
|
5739
|
-
if (DISALLOWED_SVG_TAGS_LOWER.has(tagName.toLowerCase())) {
|
|
5740
|
-
console.warn("SVG tag blocked (dangerous): ", tagName);
|
|
5741
|
-
return null;
|
|
5742
|
-
}
|
|
5743
|
-
const element = document.createElementNS(SVG_NS, tagName);
|
|
5744
|
-
for (const propName in normalisedProps) {
|
|
5745
|
-
const sanitised = sanitiseAttributeValue(propName, normalisedProps[propName]);
|
|
5746
|
-
if (sanitised === void 0) continue;
|
|
5747
|
-
if (CSS_ONLY_STYLE_PROPS.has(propName)) {
|
|
5748
|
-
element.style[propName] = String(sanitised);
|
|
5749
|
-
continue;
|
|
5750
|
-
}
|
|
5751
|
-
element.setAttribute(camelCaseToKebabWordIfNeeded(propName), sanitised);
|
|
5752
|
-
}
|
|
5753
|
-
if (style) {
|
|
5754
|
-
for (const styleProp in style) {
|
|
5755
|
-
element.style[styleProp] = String(style[styleProp]);
|
|
5756
|
-
}
|
|
5757
|
-
}
|
|
5758
|
-
if (children) {
|
|
5759
|
-
for (const child of children) {
|
|
5760
|
-
element.appendChild(child);
|
|
5761
|
-
}
|
|
5762
|
-
}
|
|
5763
|
-
if (textContent) element.textContent = textContent;
|
|
5764
|
-
return element;
|
|
5765
|
-
}
|
|
5766
|
-
function renderNode(node, defs) {
|
|
5767
|
-
if (!node) return null;
|
|
5768
|
-
const _a = node, { type, children, style } = _a, props = __objRest(_a, ["type", "children", "style"]);
|
|
5769
|
-
const feFuncType = props.funcType;
|
|
5770
|
-
if (feFuncType !== void 0) delete props.funcType;
|
|
5771
|
-
const nodeDefs = getDefs(node) || defs;
|
|
5772
|
-
const resolvedStyle = resolveStyle(style, nodeDefs);
|
|
5773
|
-
let childElements;
|
|
5774
|
-
if (children) {
|
|
5775
|
-
for (const ch of children) {
|
|
5776
|
-
const child = renderNode(ch, nodeDefs);
|
|
5777
|
-
if (child) {
|
|
5778
|
-
if (!childElements) childElements = [];
|
|
5779
|
-
childElements.push(child);
|
|
5780
|
-
}
|
|
5781
|
-
}
|
|
5782
|
-
}
|
|
5783
|
-
const element = createElement(
|
|
5784
|
-
type || "g",
|
|
5785
|
-
getNormalizedProps(props),
|
|
5786
|
-
resolvedStyle,
|
|
5787
|
-
childElements,
|
|
5788
|
-
props[TEXT_ATTR] || props[TEXT_CONTENT_ATTR]
|
|
5789
|
-
);
|
|
5790
|
-
if (element && feFuncType !== void 0) element.setAttribute("type", feFuncType);
|
|
5791
|
-
return element;
|
|
5792
|
-
}
|
|
5793
5606
|
|
|
5794
5607
|
// src/PxAnimatorTriggers.ts
|
|
5795
5608
|
function setupAnimationTriggers(api, config) {
|
|
@@ -5977,10 +5790,12 @@ var PixodeskAnimator = (() => {
|
|
|
5977
5790
|
} else if (propName === "d") {
|
|
5978
5791
|
const paths = value && typeof value === "object" && Array.isArray(value.paths) ? value.paths : [];
|
|
5979
5792
|
cssValue = 'path("' + paths.map((bz) => bezierToSvgPath(bz, true)).join("") + '")';
|
|
5793
|
+
} else if (PCT_BASED_ATTR_NAMES.has(propName) && typeof value === "number") {
|
|
5794
|
+
cssValue = value * 100 + "%";
|
|
5980
5795
|
} else {
|
|
5981
5796
|
cssValue = "" + value;
|
|
5982
5797
|
}
|
|
5983
|
-
if (!CSS.supports(cssKey, cssValue)) unsupportedSet.add(cssKey);
|
|
5798
|
+
if (!CSS.supports(camelCaseToKebabWordIfNeeded(cssKey), cssValue)) unsupportedSet.add(cssKey);
|
|
5984
5799
|
cssKey = kebabToCamelCaseWord(cssKey);
|
|
5985
5800
|
cssKf[cssKey] = cssValue;
|
|
5986
5801
|
return cssKf;
|
|
@@ -6057,7 +5872,7 @@ var PixodeskAnimator = (() => {
|
|
|
6057
5872
|
console.warn("createFrameLoopAnimator: No root element provided");
|
|
6058
5873
|
}
|
|
6059
5874
|
}
|
|
6060
|
-
const bindings = getNormalisedBindings(doc, PxAnimatorEngine.
|
|
5875
|
+
const bindings = getNormalisedBindings(doc, PxAnimatorEngine.waapi);
|
|
6061
5876
|
const animations = [];
|
|
6062
5877
|
const _iterations = config.iterations;
|
|
6063
5878
|
let iterations;
|
|
@@ -6203,9 +6018,8 @@ var PixodeskAnimator = (() => {
|
|
|
6203
6018
|
return api;
|
|
6204
6019
|
}
|
|
6205
6020
|
|
|
6206
|
-
// src/
|
|
6207
|
-
function
|
|
6208
|
-
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
6021
|
+
// src/PxAnimatorBind.ts
|
|
6022
|
+
function finaliseAnimator(animatorConfig, callbacks, make) {
|
|
6209
6023
|
let apiRef;
|
|
6210
6024
|
let effectiveCallbacks = callbacks;
|
|
6211
6025
|
if (animatorConfig.resetOnFinish) {
|
|
@@ -6217,29 +6031,99 @@ var PixodeskAnimator = (() => {
|
|
|
6217
6031
|
}
|
|
6218
6032
|
});
|
|
6219
6033
|
}
|
|
6220
|
-
|
|
6221
|
-
if (animatorConfig.mode === PxAnimatorMode.frames) {
|
|
6222
|
-
res = createFrameLoopAnimator(doc, adapter, effectiveCallbacks, rootElement);
|
|
6223
|
-
} else {
|
|
6224
|
-
res = createWebApiAnimator(
|
|
6225
|
-
doc,
|
|
6226
|
-
effectiveCallbacks,
|
|
6227
|
-
rootElement,
|
|
6228
|
-
animatorConfig.mode === PxAnimatorMode.webapi
|
|
6229
|
-
// forcing webapi
|
|
6230
|
-
) || createFrameLoopAnimator(doc, adapter, effectiveCallbacks, rootElement);
|
|
6231
|
-
}
|
|
6034
|
+
const res = make(effectiveCallbacks);
|
|
6232
6035
|
apiRef = res;
|
|
6233
6036
|
if (animatorConfig.debugInstName) {
|
|
6234
6037
|
window[animatorConfig.debugInstName] = res;
|
|
6235
6038
|
}
|
|
6236
6039
|
return res;
|
|
6237
6040
|
}
|
|
6041
|
+
function bindWithEngineChoice(doc, adapter, callbacks, rootElement) {
|
|
6042
|
+
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
6043
|
+
return finaliseAnimator(animatorConfig, callbacks, (cb) => {
|
|
6044
|
+
if (animatorConfig.mode === PxAnimatorMode.frames) {
|
|
6045
|
+
return createFrameLoopAnimator(doc, adapter, cb, rootElement);
|
|
6046
|
+
}
|
|
6047
|
+
return createWebApiAnimator(
|
|
6048
|
+
doc,
|
|
6049
|
+
cb,
|
|
6050
|
+
rootElement,
|
|
6051
|
+
animatorConfig.mode === PxAnimatorMode.waapi
|
|
6052
|
+
// forcing waapi
|
|
6053
|
+
) || createFrameLoopAnimator(doc, adapter, cb, rootElement);
|
|
6054
|
+
});
|
|
6055
|
+
}
|
|
6056
|
+
|
|
6057
|
+
// src/PxAnimatorDOM.ts
|
|
6058
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
6059
|
+
function createElement(tagName, normalisedProps, style, children, textContent) {
|
|
6060
|
+
if (DISALLOWED_SVG_TAGS_LOWER.has(tagName.toLowerCase())) {
|
|
6061
|
+
console.warn("SVG tag blocked (dangerous): ", tagName);
|
|
6062
|
+
return null;
|
|
6063
|
+
}
|
|
6064
|
+
const element = document.createElementNS(SVG_NS, tagName);
|
|
6065
|
+
for (const propName in normalisedProps) {
|
|
6066
|
+
const sanitised = sanitiseAttributeValue(propName, normalisedProps[propName]);
|
|
6067
|
+
if (sanitised === void 0) continue;
|
|
6068
|
+
if (CSS_ONLY_STYLE_PROPS.has(propName)) {
|
|
6069
|
+
element.style[propName] = String(sanitised);
|
|
6070
|
+
continue;
|
|
6071
|
+
}
|
|
6072
|
+
element.setAttribute(camelCaseToKebabWordIfNeeded(propName), sanitised);
|
|
6073
|
+
}
|
|
6074
|
+
if (style) {
|
|
6075
|
+
for (const styleProp in style) {
|
|
6076
|
+
element.style[styleProp] = String(style[styleProp]);
|
|
6077
|
+
}
|
|
6078
|
+
}
|
|
6079
|
+
if (children) {
|
|
6080
|
+
for (const child of children) {
|
|
6081
|
+
element.appendChild(child);
|
|
6082
|
+
}
|
|
6083
|
+
}
|
|
6084
|
+
if (textContent) element.textContent = textContent;
|
|
6085
|
+
return element;
|
|
6086
|
+
}
|
|
6087
|
+
function renderNode(node, defs) {
|
|
6088
|
+
if (!node) return null;
|
|
6089
|
+
const _a = node, { type, children, style } = _a, props = __objRest(_a, ["type", "children", "style"]);
|
|
6090
|
+
const domType = props.domType;
|
|
6091
|
+
if (domType !== void 0) delete props.domType;
|
|
6092
|
+
const nodeDefs = getDefs(node) || defs;
|
|
6093
|
+
const resolvedStyle = resolveStyle(style, nodeDefs);
|
|
6094
|
+
let childElements;
|
|
6095
|
+
if (children) {
|
|
6096
|
+
for (const ch of children) {
|
|
6097
|
+
const child = renderNode(ch, nodeDefs);
|
|
6098
|
+
if (child) {
|
|
6099
|
+
if (!childElements) childElements = [];
|
|
6100
|
+
childElements.push(child);
|
|
6101
|
+
}
|
|
6102
|
+
}
|
|
6103
|
+
}
|
|
6104
|
+
const element = createElement(
|
|
6105
|
+
type || "g",
|
|
6106
|
+
getNormalizedProps(props),
|
|
6107
|
+
resolvedStyle,
|
|
6108
|
+
childElements,
|
|
6109
|
+
props[TEXT_CONTENT_ATTR] || props[TEXT_ATTR]
|
|
6110
|
+
);
|
|
6111
|
+
if (element && domType !== void 0) element.setAttribute("type", domType);
|
|
6112
|
+
return element;
|
|
6113
|
+
}
|
|
6114
|
+
|
|
6115
|
+
// src/PxAnimatorKeys.ts
|
|
6116
|
+
var PX_ANIMATOR_DATA_KEY = "data";
|
|
6117
|
+
|
|
6118
|
+
// src/PxAnimator.ts
|
|
6119
|
+
function createAnimatorFromConfig(doc, adapter, callbacks, rootElement) {
|
|
6120
|
+
return bindWithEngineChoice(doc, adapter, callbacks, rootElement);
|
|
6121
|
+
}
|
|
6238
6122
|
function createAnimatorImpl(doc, adapter, callbacks, containerElement) {
|
|
6239
6123
|
const effectsWarnings = validateNodeEffects(doc);
|
|
6240
6124
|
for (const w of effectsWarnings) console.warn("[PxAnimator] effects shape warning:", w);
|
|
6241
6125
|
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
6242
|
-
const engine = animatorConfig.mode === PxAnimatorMode.frames ? PxAnimatorEngine.frames : PxAnimatorEngine.
|
|
6126
|
+
const engine = animatorConfig.mode === PxAnimatorMode.frames ? PxAnimatorEngine.frames : PxAnimatorEngine.waapi;
|
|
6243
6127
|
doc = materialiseAllInTree(doc, engine);
|
|
6244
6128
|
let rootElement = null;
|
|
6245
6129
|
if (containerElement) {
|
|
@@ -6254,7 +6138,6 @@ var PixodeskAnimator = (() => {
|
|
|
6254
6138
|
}
|
|
6255
6139
|
return createAnimatorFromConfig(doc, adapter, callbacks, rootElement);
|
|
6256
6140
|
}
|
|
6257
|
-
var PX_ANIMATOR_DATA_KEY = "data";
|
|
6258
6141
|
function createAnimator(options) {
|
|
6259
6142
|
const { src, data, adapter, callbacks, container } = options;
|
|
6260
6143
|
if (data !== void 0 && src !== void 0) {
|
|
@@ -6337,6 +6220,6 @@ var PixodeskAnimator = (() => {
|
|
|
6337
6220
|
window["createAnimator"] = createAnimator;
|
|
6338
6221
|
window["setupAnimationTriggers"] = setupAnimationTriggers;
|
|
6339
6222
|
}
|
|
6340
|
-
return __toCommonJS(
|
|
6223
|
+
return __toCommonJS(index_player_exports);
|
|
6341
6224
|
})();
|
|
6342
6225
|
//# sourceMappingURL=index.umd.js.map
|