@pixodesk/svg-animator-web 1.0.30 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -15
- package/dist/index.cjs +936 -514
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -4
- package/dist/index.d.ts +29 -4
- package/dist/index.js +926 -512
- 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 +1109 -95
- package/dist/index.prerendered-waapi.umd.js.map +1 -1
- package/dist/index.prerendered-waapi.umd.min.js +1 -1
- package/dist/index.prerendered.umd.js +1135 -116
- package/dist/index.prerendered.umd.js.map +1 -1
- package/dist/index.prerendered.umd.min.js +1 -1
- package/dist/{index.umd.js → pixodesk-svg-animator.umd.js} +726 -330
- package/dist/pixodesk-svg-animator.umd.js.map +1 -0
- package/dist/pixodesk-svg-animator.umd.min.js +1 -0
- package/mangle-reserved.json +232 -0
- package/package.json +10 -7
- package/dist/index.umd.js.map +0 -1
- package/dist/index.umd.min.js +0 -1
|
@@ -21,6 +21,18 @@ var PixodeskAnimator = (() => {
|
|
|
21
21
|
return a;
|
|
22
22
|
};
|
|
23
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
24
36
|
var __export = (target, all) => {
|
|
25
37
|
for (var name in all)
|
|
26
38
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -43,7 +55,7 @@ var PixodeskAnimator = (() => {
|
|
|
43
55
|
setupAnimationTriggers: () => setupAnimationTriggers
|
|
44
56
|
});
|
|
45
57
|
|
|
46
|
-
// ../svg-animator-core/src/PxAnimatorUtil.ts
|
|
58
|
+
// ../svg-animator-core/src/util/PxAnimatorUtil.ts
|
|
47
59
|
function bezierToSvgPath(path, forceCurves = false) {
|
|
48
60
|
var _a, _b, _c, _d;
|
|
49
61
|
const v = path.v;
|
|
@@ -296,6 +308,38 @@ var PixodeskAnimator = (() => {
|
|
|
296
308
|
if (o) segs.push("translate(" + -o[0] + tu + "," + -o[1] + tu + ")");
|
|
297
309
|
return segs.join("");
|
|
298
310
|
}
|
|
311
|
+
function parseTransformParts(str) {
|
|
312
|
+
var _a, _b;
|
|
313
|
+
if (!str || typeof str !== "string") return void 0;
|
|
314
|
+
const out = {};
|
|
315
|
+
const re = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
|
|
316
|
+
const order = ["translate", "rotate", "skewX", "scale"];
|
|
317
|
+
let lastIdx = -1;
|
|
318
|
+
let m;
|
|
319
|
+
while ((m = re.exec(str)) !== null) {
|
|
320
|
+
const fn = m[1];
|
|
321
|
+
const idx = order.indexOf(fn);
|
|
322
|
+
if (idx < 0 || idx <= lastIdx) return void 0;
|
|
323
|
+
lastIdx = idx;
|
|
324
|
+
const nums = m[2].split(/[\s,]+/).filter(Boolean).map(Number);
|
|
325
|
+
if (nums.some((n) => Number.isNaN(n))) return void 0;
|
|
326
|
+
if (fn === "translate") {
|
|
327
|
+
if (nums.length < 1 || nums.length > 2) return void 0;
|
|
328
|
+
out.translate = [nums[0], (_a = nums[1]) != null ? _a : 0];
|
|
329
|
+
} else if (fn === "rotate") {
|
|
330
|
+
if (nums.length !== 1) return void 0;
|
|
331
|
+
out.rotate = nums[0];
|
|
332
|
+
} else if (fn === "skewX") {
|
|
333
|
+
if (nums.length !== 1) return void 0;
|
|
334
|
+
out.skew = nums[0];
|
|
335
|
+
} else {
|
|
336
|
+
if (nums.length < 1 || nums.length > 2) return void 0;
|
|
337
|
+
out.scale = [nums[0], (_b = nums[1]) != null ? _b : nums[0]];
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (str.replace(/([a-zA-Z]+)\s*\(([^)]*)\)/g, "").replace(/[\s,]/g, "").length) return void 0;
|
|
341
|
+
return Object.keys(out).length ? out : void 0;
|
|
342
|
+
}
|
|
299
343
|
var STYLE_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
|
|
300
344
|
var DEFAULT_DURATION_MS = 1e3;
|
|
301
345
|
function kebabToCamelCaseWord(kebab) {
|
|
@@ -441,7 +485,7 @@ var PixodeskAnimator = (() => {
|
|
|
441
485
|
return cubicBezier(flipped);
|
|
442
486
|
}
|
|
443
487
|
|
|
444
|
-
// ../svg-animator-core/src/PxScrollMath.ts
|
|
488
|
+
// ../svg-animator-core/src/playback/PxScrollMath.ts
|
|
445
489
|
function isScrollTimeline(config) {
|
|
446
490
|
return (config == null ? void 0 : config.timelineSource) === "scroll";
|
|
447
491
|
}
|
|
@@ -497,27 +541,618 @@ var PixodeskAnimator = (() => {
|
|
|
497
541
|
return vertical ? "x" : "y";
|
|
498
542
|
}
|
|
499
543
|
|
|
500
|
-
// ../svg-animator-core/src/
|
|
501
|
-
var
|
|
544
|
+
// ../svg-animator-core/src/schema/PxSchema.ts
|
|
545
|
+
var PX_UNKNOWN_KEY_ERROR = "unexpected extra key";
|
|
546
|
+
function pathStr(path) {
|
|
547
|
+
if (!path.length) return ".";
|
|
548
|
+
let result = "";
|
|
549
|
+
for (const seg of path) {
|
|
550
|
+
if (seg.startsWith("[")) result += seg;
|
|
551
|
+
else result += (result ? "." : "") + seg;
|
|
552
|
+
}
|
|
553
|
+
return result;
|
|
554
|
+
}
|
|
555
|
+
var Base = class {
|
|
556
|
+
_canSanitize(raw) {
|
|
557
|
+
return this.isValid(raw);
|
|
558
|
+
}
|
|
559
|
+
optional() {
|
|
560
|
+
return new Optional(this);
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
var Optional = class extends Base {
|
|
564
|
+
constructor(inner) {
|
|
565
|
+
super();
|
|
566
|
+
this.inner = inner;
|
|
567
|
+
this._default = void 0;
|
|
568
|
+
}
|
|
569
|
+
sanitize(raw) {
|
|
570
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
571
|
+
return this.inner._canSanitize(raw) ? this.inner.sanitize(raw) : void 0;
|
|
572
|
+
}
|
|
573
|
+
isValid(raw, ctx, path) {
|
|
574
|
+
if (raw === void 0 || raw === null) return true;
|
|
575
|
+
return this.inner.isValid(raw, ctx, path);
|
|
576
|
+
}
|
|
577
|
+
_canSanitize(raw) {
|
|
578
|
+
return raw === void 0 || raw === null || this.inner._canSanitize(raw);
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
var Str = class extends Base {
|
|
582
|
+
constructor(_default = "") {
|
|
583
|
+
super();
|
|
584
|
+
this._default = _default;
|
|
585
|
+
}
|
|
586
|
+
sanitize(raw) {
|
|
587
|
+
return typeof raw === "string" ? raw : this._default;
|
|
588
|
+
}
|
|
589
|
+
isValid(raw, ctx, path) {
|
|
590
|
+
if (typeof raw === "string") return true;
|
|
591
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected string, got " + typeof raw);
|
|
592
|
+
return false;
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
var Num = class extends Base {
|
|
596
|
+
constructor(_default = 0) {
|
|
597
|
+
super();
|
|
598
|
+
this._default = _default;
|
|
599
|
+
}
|
|
600
|
+
sanitize(raw) {
|
|
601
|
+
return typeof raw === "number" && isFinite(raw) ? raw : this._default;
|
|
602
|
+
}
|
|
603
|
+
isValid(raw, ctx, path) {
|
|
604
|
+
if (typeof raw === "number" && isFinite(raw)) return true;
|
|
605
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected finite number, got " + JSON.stringify(raw));
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
var Bool = class extends Base {
|
|
610
|
+
constructor(_default = false) {
|
|
611
|
+
super();
|
|
612
|
+
this._default = _default;
|
|
613
|
+
}
|
|
614
|
+
sanitize(raw) {
|
|
615
|
+
return typeof raw === "boolean" ? raw : this._default;
|
|
616
|
+
}
|
|
617
|
+
isValid(raw, ctx, path) {
|
|
618
|
+
if (typeof raw === "boolean") return true;
|
|
619
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected boolean, got " + typeof raw);
|
|
620
|
+
return false;
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
var Literal = class extends Base {
|
|
624
|
+
constructor(value) {
|
|
625
|
+
super();
|
|
626
|
+
this.value = value;
|
|
627
|
+
this._default = value;
|
|
628
|
+
}
|
|
629
|
+
sanitize(raw) {
|
|
630
|
+
return raw === this.value ? this.value : this._default;
|
|
631
|
+
}
|
|
632
|
+
isValid(raw, ctx, path) {
|
|
633
|
+
if (raw === this.value) return true;
|
|
634
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected " + JSON.stringify(this.value) + ", got " + JSON.stringify(raw));
|
|
635
|
+
return false;
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
var Enum = class extends Base {
|
|
639
|
+
constructor(values, defaultVal) {
|
|
640
|
+
super();
|
|
641
|
+
this.values = values;
|
|
642
|
+
this._default = defaultVal != null ? defaultVal : values[0];
|
|
643
|
+
}
|
|
644
|
+
sanitize(raw) {
|
|
645
|
+
return this.values.includes(raw) ? raw : this._default;
|
|
646
|
+
}
|
|
647
|
+
isValid(raw, ctx, path) {
|
|
648
|
+
if (this.values.includes(raw)) return true;
|
|
649
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected one of " + this.values.map((v) => JSON.stringify(v)).join(" | ") + ", got " + JSON.stringify(raw));
|
|
650
|
+
return false;
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
var Union = class extends Base {
|
|
654
|
+
constructor(schemas, defaultVal) {
|
|
655
|
+
super();
|
|
656
|
+
this.schemas = schemas;
|
|
657
|
+
/** Structural tag read by {@link describeSchema} — `schemas` alone cannot tell Union from Tuple. */
|
|
658
|
+
this._kind = "union";
|
|
659
|
+
this._default = defaultVal != null ? defaultVal : schemas[0]._default;
|
|
660
|
+
}
|
|
661
|
+
sanitize(raw) {
|
|
662
|
+
for (const s of this.schemas) {
|
|
663
|
+
if (s.isValid(raw)) return s.sanitize(raw);
|
|
664
|
+
}
|
|
665
|
+
return this._default;
|
|
666
|
+
}
|
|
667
|
+
isValid(raw, ctx, path) {
|
|
668
|
+
var _a;
|
|
669
|
+
const probe = ctx && { errors: [], warnings: [], strict: ctx.strict };
|
|
670
|
+
if (this.schemas.some((s) => s.isValid(raw, probe, path ? [...path] : void 0))) return true;
|
|
671
|
+
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));
|
|
672
|
+
return false;
|
|
673
|
+
}
|
|
674
|
+
_canSanitize(raw) {
|
|
675
|
+
return this.schemas.some((s) => s._canSanitize(raw));
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
var DiscriminatedUnion = class extends Base {
|
|
679
|
+
constructor(_key, _schemas, defaultVal) {
|
|
680
|
+
var _a;
|
|
681
|
+
super();
|
|
682
|
+
this._key = _key;
|
|
683
|
+
this._schemas = _schemas;
|
|
684
|
+
/** Structural tag read by {@link describeSchema}. */
|
|
685
|
+
this._kind = "discriminatedUnion";
|
|
686
|
+
this._default = defaultVal != null ? defaultVal : _schemas[0]._default;
|
|
687
|
+
this._map = /* @__PURE__ */ new Map();
|
|
688
|
+
for (const s of _schemas) {
|
|
689
|
+
const keySchema = s._shape[_key];
|
|
690
|
+
if (!keySchema) continue;
|
|
691
|
+
const literal = (_a = keySchema.inner) != null ? _a : keySchema;
|
|
692
|
+
this._map.set(literal._default, s);
|
|
693
|
+
if (keySchema.inner) this._absentMember = s;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
_findSchema(raw) {
|
|
697
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
698
|
+
const val = raw[this._key];
|
|
699
|
+
if (val === void 0 || val === null) return this._absentMember;
|
|
700
|
+
return this._map.get(val);
|
|
701
|
+
}
|
|
702
|
+
sanitize(raw) {
|
|
703
|
+
var _a;
|
|
704
|
+
return ((_a = this._findSchema(raw)) != null ? _a : this._schemas[0]).sanitize(raw);
|
|
705
|
+
}
|
|
706
|
+
isValid(raw, ctx, path) {
|
|
707
|
+
const schema = this._findSchema(raw);
|
|
708
|
+
if (!schema) {
|
|
709
|
+
const val = raw !== null && typeof raw === "object" && !Array.isArray(raw) ? raw[this._key] : void 0;
|
|
710
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": no discriminated union member matched " + this._key + "=" + JSON.stringify(val));
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
return schema.isValid(raw, ctx, path);
|
|
714
|
+
}
|
|
715
|
+
_canSanitize(raw) {
|
|
716
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return false;
|
|
717
|
+
const schema = this._findSchema(raw);
|
|
718
|
+
return schema ? schema._canSanitize(raw) : this._schemas[0]._canSanitize(raw);
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
var Obj = class extends Base {
|
|
722
|
+
constructor(_shape) {
|
|
723
|
+
super();
|
|
724
|
+
this._shape = _shape;
|
|
725
|
+
const d = {};
|
|
726
|
+
for (const key of Object.keys(_shape)) d[key] = _shape[key]._default;
|
|
727
|
+
this._default = d;
|
|
728
|
+
}
|
|
729
|
+
sanitize(raw) {
|
|
730
|
+
const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
731
|
+
const out = {};
|
|
732
|
+
for (const key of Object.keys(this._shape)) {
|
|
733
|
+
const v = this._shape[key].sanitize(src[key]);
|
|
734
|
+
if (v !== void 0) out[key] = v;
|
|
735
|
+
}
|
|
736
|
+
return out;
|
|
737
|
+
}
|
|
738
|
+
isValid(raw, ctx, path) {
|
|
739
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
740
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected object, got " + (Array.isArray(raw) ? "array" : typeof raw));
|
|
741
|
+
return false;
|
|
742
|
+
}
|
|
743
|
+
const obj = raw;
|
|
744
|
+
const p = path != null ? path : [];
|
|
745
|
+
let ok = true;
|
|
746
|
+
for (const key of Object.keys(this._shape)) {
|
|
747
|
+
p.push(key);
|
|
748
|
+
if (!this._shape[key].isValid(obj[key], ctx, p)) ok = false;
|
|
749
|
+
p.pop();
|
|
750
|
+
}
|
|
751
|
+
if (ctx == null ? void 0 : ctx.strict) {
|
|
752
|
+
for (const key of Object.keys(obj)) {
|
|
753
|
+
if (key in this._shape) continue;
|
|
754
|
+
if (obj[key] === void 0) continue;
|
|
755
|
+
p.push(key);
|
|
756
|
+
ctx.errors.push(pathStr(p) + ": " + PX_UNKNOWN_KEY_ERROR);
|
|
757
|
+
p.pop();
|
|
758
|
+
ok = false;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
return ok;
|
|
762
|
+
}
|
|
763
|
+
_canSanitize(raw) {
|
|
764
|
+
return !!raw && typeof raw === "object" && !Array.isArray(raw);
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
var OpenObj = class extends Base {
|
|
768
|
+
constructor(_shape, _openSchema) {
|
|
769
|
+
super();
|
|
770
|
+
this._shape = _shape;
|
|
771
|
+
this._openSchema = _openSchema;
|
|
772
|
+
const d = {};
|
|
773
|
+
for (const key of Object.keys(_shape)) d[key] = _shape[key]._default;
|
|
774
|
+
this._default = d;
|
|
775
|
+
}
|
|
776
|
+
sanitize(raw) {
|
|
777
|
+
const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
778
|
+
const out = __spreadValues({}, src);
|
|
779
|
+
for (const key of Object.keys(this._shape)) {
|
|
780
|
+
const v = this._shape[key].sanitize(src[key]);
|
|
781
|
+
if (v !== void 0) out[key] = v;
|
|
782
|
+
}
|
|
783
|
+
if (this._openSchema) {
|
|
784
|
+
for (const key of Object.keys(src)) {
|
|
785
|
+
if (!(key in this._shape)) out[key] = this._openSchema.sanitize(src[key]);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return out;
|
|
789
|
+
}
|
|
790
|
+
isValid(raw, ctx, path) {
|
|
791
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
792
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected object, got " + (Array.isArray(raw) ? "array" : typeof raw));
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
const obj = raw;
|
|
796
|
+
const p = path != null ? path : [];
|
|
797
|
+
let ok = true;
|
|
798
|
+
for (const key of Object.keys(this._shape)) {
|
|
799
|
+
p.push(key);
|
|
800
|
+
if (!this._shape[key].isValid(obj[key], ctx, p)) ok = false;
|
|
801
|
+
p.pop();
|
|
802
|
+
}
|
|
803
|
+
if (this._openSchema) {
|
|
804
|
+
for (const key of Object.keys(obj)) {
|
|
805
|
+
if (key in this._shape) continue;
|
|
806
|
+
p.push(key);
|
|
807
|
+
if (!this._openSchema.isValid(obj[key], ctx, p)) ok = false;
|
|
808
|
+
p.pop();
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return ok;
|
|
812
|
+
}
|
|
813
|
+
_canSanitize(raw) {
|
|
814
|
+
return !!raw && typeof raw === "object" && !Array.isArray(raw);
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
var Arr = class extends Base {
|
|
818
|
+
constructor(item) {
|
|
819
|
+
super();
|
|
820
|
+
this.item = item;
|
|
821
|
+
this._default = [];
|
|
822
|
+
}
|
|
823
|
+
sanitize(raw) {
|
|
824
|
+
if (!Array.isArray(raw)) return [];
|
|
825
|
+
const out = [];
|
|
826
|
+
for (const el of raw) {
|
|
827
|
+
if (this.item._canSanitize(el)) out.push(this.item.sanitize(el));
|
|
828
|
+
}
|
|
829
|
+
return out;
|
|
830
|
+
}
|
|
831
|
+
isValid(raw, ctx, path) {
|
|
832
|
+
if (!Array.isArray(raw)) {
|
|
833
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected array, got " + typeof raw);
|
|
834
|
+
return false;
|
|
835
|
+
}
|
|
836
|
+
const p = path != null ? path : [];
|
|
837
|
+
let ok = true;
|
|
838
|
+
for (let i = 0; i < raw.length; i++) {
|
|
839
|
+
p.push("[" + i + "]");
|
|
840
|
+
if (!this.item.isValid(raw[i], ctx, p)) ok = false;
|
|
841
|
+
p.pop();
|
|
842
|
+
}
|
|
843
|
+
return ok;
|
|
844
|
+
}
|
|
845
|
+
_canSanitize(raw) {
|
|
846
|
+
return Array.isArray(raw);
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
var Rec = class extends Base {
|
|
850
|
+
constructor(value) {
|
|
851
|
+
super();
|
|
852
|
+
this.value = value;
|
|
853
|
+
/** Structural tag read by {@link describeSchema}. */
|
|
854
|
+
this._kind = "record";
|
|
855
|
+
this._default = {};
|
|
856
|
+
}
|
|
857
|
+
sanitize(raw) {
|
|
858
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
|
|
859
|
+
const out = {};
|
|
860
|
+
for (const [k, v] of Object.entries(raw)) {
|
|
861
|
+
if (this.value._canSanitize(v)) out[k] = this.value.sanitize(v);
|
|
862
|
+
}
|
|
863
|
+
return out;
|
|
864
|
+
}
|
|
865
|
+
isValid(raw, ctx, path) {
|
|
866
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
867
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected object/record, got " + (Array.isArray(raw) ? "array" : typeof raw));
|
|
868
|
+
return false;
|
|
869
|
+
}
|
|
870
|
+
const p = path != null ? path : [];
|
|
871
|
+
let ok = true;
|
|
872
|
+
for (const [k, v] of Object.entries(raw)) {
|
|
873
|
+
p.push(k);
|
|
874
|
+
if (!this.value.isValid(v, ctx, p)) ok = false;
|
|
875
|
+
p.pop();
|
|
876
|
+
}
|
|
877
|
+
return ok;
|
|
878
|
+
}
|
|
879
|
+
_canSanitize(raw) {
|
|
880
|
+
return !!raw && typeof raw === "object" && !Array.isArray(raw);
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
var Any = class extends Base {
|
|
884
|
+
constructor() {
|
|
885
|
+
super(...arguments);
|
|
886
|
+
this._default = void 0;
|
|
887
|
+
}
|
|
888
|
+
sanitize(raw) {
|
|
889
|
+
return raw;
|
|
890
|
+
}
|
|
891
|
+
isValid(_raw, _ctx, _path) {
|
|
892
|
+
return true;
|
|
893
|
+
}
|
|
894
|
+
_canSanitize(_raw) {
|
|
895
|
+
return true;
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
var Defined = class extends Base {
|
|
899
|
+
constructor() {
|
|
900
|
+
super(...arguments);
|
|
901
|
+
this._default = void 0;
|
|
902
|
+
}
|
|
903
|
+
sanitize(raw) {
|
|
904
|
+
return raw;
|
|
905
|
+
}
|
|
906
|
+
isValid(raw, ctx, path) {
|
|
907
|
+
if (raw !== void 0) return true;
|
|
908
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": required value is missing");
|
|
909
|
+
return false;
|
|
910
|
+
}
|
|
911
|
+
_canSanitize(raw) {
|
|
912
|
+
return raw !== void 0;
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
var Lazy = class extends Base {
|
|
916
|
+
constructor(fn, _default) {
|
|
917
|
+
super();
|
|
918
|
+
this.fn = fn;
|
|
919
|
+
this._default = _default;
|
|
920
|
+
this.resolved = null;
|
|
921
|
+
}
|
|
922
|
+
get schema() {
|
|
923
|
+
var _a;
|
|
924
|
+
return (_a = this.resolved) != null ? _a : this.resolved = this.fn();
|
|
925
|
+
}
|
|
926
|
+
sanitize(raw) {
|
|
927
|
+
return this.schema.sanitize(raw);
|
|
928
|
+
}
|
|
929
|
+
isValid(raw, ctx, path) {
|
|
930
|
+
return this.schema.isValid(raw, ctx, path);
|
|
931
|
+
}
|
|
932
|
+
_canSanitize(raw) {
|
|
933
|
+
return this.schema._canSanitize(raw);
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
var Tuple = class extends Base {
|
|
937
|
+
constructor(schemas) {
|
|
938
|
+
super();
|
|
939
|
+
this.schemas = schemas;
|
|
940
|
+
/** Structural tag read by {@link describeSchema} — `schemas` alone cannot tell Tuple from Union. */
|
|
941
|
+
this._kind = "tuple";
|
|
942
|
+
this._default = schemas.map((s) => s._default);
|
|
943
|
+
}
|
|
944
|
+
sanitize(raw) {
|
|
945
|
+
if (!Array.isArray(raw) || raw.length !== this.schemas.length) return this._default;
|
|
946
|
+
return this.schemas.map((s, i) => s.sanitize(raw[i]));
|
|
947
|
+
}
|
|
948
|
+
isValid(raw, ctx, path) {
|
|
949
|
+
if (!Array.isArray(raw) || raw.length !== this.schemas.length) {
|
|
950
|
+
ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": expected tuple of length " + this.schemas.length + ", got " + (Array.isArray(raw) ? "array[" + raw.length + "]" : typeof raw));
|
|
951
|
+
return false;
|
|
952
|
+
}
|
|
953
|
+
const p = path != null ? path : [];
|
|
954
|
+
let ok = true;
|
|
955
|
+
for (let i = 0; i < this.schemas.length; i++) {
|
|
956
|
+
p.push("[" + i + "]");
|
|
957
|
+
if (!this.schemas[i].isValid(raw[i], ctx, p)) ok = false;
|
|
958
|
+
p.pop();
|
|
959
|
+
}
|
|
960
|
+
return ok;
|
|
961
|
+
}
|
|
962
|
+
// Require exact length so wrong-length arrays are dropped rather than repaired to default.
|
|
963
|
+
_canSanitize(raw) {
|
|
964
|
+
return Array.isArray(raw) && raw.length === this.schemas.length;
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
function implementsInterface() {
|
|
968
|
+
return (schema) => schema;
|
|
969
|
+
}
|
|
970
|
+
var px = {
|
|
971
|
+
/** Matches a string. Default: '' or provided value. */
|
|
972
|
+
string: (defaultVal = "") => new Str(defaultVal),
|
|
973
|
+
/** Matches a finite number. Default: 0 or provided value. */
|
|
974
|
+
number: (defaultVal = 0) => new Num(defaultVal),
|
|
975
|
+
/** Matches a boolean. Default: false or provided value. */
|
|
976
|
+
boolean: (defaultVal = false) => new Bool(defaultVal),
|
|
977
|
+
/** Matches one exact primitive value; its default is the value itself. */
|
|
978
|
+
literal: (value) => new Literal(value),
|
|
979
|
+
/** Matches one of a fixed set of string/number values. Default: first value. */
|
|
980
|
+
enum: (values, defaultVal) => new Enum(values, defaultVal),
|
|
981
|
+
/**
|
|
982
|
+
* Returns the first schema whose isValid passes.
|
|
983
|
+
* TypeScript infers the union of all member types automatically.
|
|
984
|
+
*/
|
|
985
|
+
union: (schemas, defaultVal) => new Union(schemas, defaultVal),
|
|
986
|
+
/**
|
|
987
|
+
* Discriminated union — reads `raw[key]`, finds the member schema whose
|
|
988
|
+
* literal at `key` matches, then delegates sanitize/isValid to that member.
|
|
989
|
+
* Each member must be an object schema with a `px.literal(...)` at `key`.
|
|
990
|
+
* TypeScript infers the union of all member types automatically.
|
|
991
|
+
*/
|
|
992
|
+
discriminatedUnion: (key, schemas) => new DiscriminatedUnion(key, schemas),
|
|
993
|
+
/** Typed object — unknown keys are stripped. Required fields fall back to their default. */
|
|
994
|
+
object: (shape) => new Obj(shape),
|
|
995
|
+
/**
|
|
996
|
+
* Open object — validates known keys; passes unknown keys through as-is,
|
|
997
|
+
* or validates/sanitizes them against `openSchema` when provided.
|
|
998
|
+
*/
|
|
999
|
+
openObject: (shape, openSchema) => new OpenObj(shape, openSchema),
|
|
1000
|
+
/**
|
|
1001
|
+
* Creates a new closed object schema by merging a base schema's shape with additional fields.
|
|
1002
|
+
* The base can be the result of px.object() or px.openObject() — anything with a _shape property.
|
|
1003
|
+
*
|
|
1004
|
+
* @example
|
|
1005
|
+
* const PxSvgNodeSchema = px.extendedObject(PxNodeBase, { width: px.number().optional() });
|
|
1006
|
+
*/
|
|
1007
|
+
extendedObject: (base, extra) => new Obj(__spreadValues(__spreadValues({}, base._shape), extra)),
|
|
1008
|
+
/** Array whose unrecoverable items are filtered out. Default: []. */
|
|
1009
|
+
array: (item) => new Arr(item),
|
|
1010
|
+
/** String-keyed record whose unrecoverable values are dropped. Default: {}. */
|
|
1011
|
+
record: (value) => new Rec(value),
|
|
1012
|
+
/** Passes anything through unchanged — always valid. */
|
|
1013
|
+
any: () => new Any(),
|
|
1014
|
+
/** Anything EXCEPT `undefined` — an open type whose presence is required (V6). */
|
|
1015
|
+
defined: () => new Defined(),
|
|
1016
|
+
/** Fixed-length tuple — validates element count and each position individually. */
|
|
1017
|
+
tuple: (schemas) => new Tuple(schemas),
|
|
1018
|
+
/** Defers schema creation — required for recursive types. Must supply a default value. */
|
|
1019
|
+
lazy: (fn, defaultVal) => new Lazy(fn, defaultVal)
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
// ../svg-animator-core/src/format/PxAnimatorConstants.ts
|
|
1023
|
+
var PxTimelineEngine = {
|
|
1024
|
+
native: "native",
|
|
1025
|
+
js: "js"
|
|
1026
|
+
};
|
|
1027
|
+
var PxTimelineEngineExtra = __spreadProps(__spreadValues({}, PxTimelineEngine), {
|
|
1028
|
+
auto: "auto"
|
|
1029
|
+
});
|
|
1030
|
+
function isNativeForced(engine) {
|
|
1031
|
+
return engine === PxTimelineEngineExtra.native;
|
|
1032
|
+
}
|
|
1033
|
+
function mayUseNativeScrollTimeline(engine) {
|
|
1034
|
+
return engine !== PxTimelineEngineExtra.js;
|
|
1035
|
+
}
|
|
1036
|
+
var PxLoopRepeatAt = {
|
|
1037
|
+
/** Segment from the START; the repetition runs BEFORE the first keyframe
|
|
1038
|
+
* (intro loops that play until the main timeline begins). */
|
|
1039
|
+
start: "start",
|
|
1040
|
+
/** DEFAULT — segment from the END; the repetition runs AFTER the last keyframe
|
|
1041
|
+
* (idle/outro loops that continue once the main timeline has finished). */
|
|
1042
|
+
end: "end"
|
|
1043
|
+
};
|
|
1044
|
+
var PxLoopDirection = {
|
|
1045
|
+
/** DEFAULT — cycle: every repetition replays the segment the same way round. */
|
|
1046
|
+
normal: "normal",
|
|
1047
|
+
/** Ping-pong: repetitions alternate forward / backward. */
|
|
1048
|
+
alternate: "alternate"
|
|
1049
|
+
};
|
|
1050
|
+
var PxMaskType = {
|
|
1051
|
+
luminance: "luminance",
|
|
1052
|
+
alpha: "alpha"
|
|
1053
|
+
};
|
|
1054
|
+
var PxUnits = {
|
|
1055
|
+
userSpaceOnUse: "userSpaceOnUse",
|
|
1056
|
+
objectBoundingBox: "objectBoundingBox"
|
|
1057
|
+
};
|
|
1058
|
+
var PxCloneWithout = {
|
|
1059
|
+
translate: "translate"
|
|
1060
|
+
// transform: 'transform', // future: drop rotate/scale too (content only)
|
|
1061
|
+
};
|
|
1062
|
+
var PxPathOverflow = {
|
|
1063
|
+
clip: "clip",
|
|
1064
|
+
extend: "extend"
|
|
1065
|
+
};
|
|
1066
|
+
var PxLengthAdjust = {
|
|
1067
|
+
spacing: "spacing",
|
|
1068
|
+
spacingAndGlyphs: "spacingAndGlyphs"
|
|
1069
|
+
};
|
|
1070
|
+
var PxTextPathMethod = {
|
|
1071
|
+
align: "align",
|
|
1072
|
+
stretch: "stretch"
|
|
1073
|
+
};
|
|
1074
|
+
var PxTextPathSpacing = {
|
|
502
1075
|
auto: "auto",
|
|
503
|
-
|
|
504
|
-
|
|
1076
|
+
exact: "exact"
|
|
1077
|
+
};
|
|
1078
|
+
var PxStrokeTrimSubPaths = {
|
|
1079
|
+
separate: "separate",
|
|
1080
|
+
combined: "combined"
|
|
505
1081
|
};
|
|
506
|
-
var
|
|
507
|
-
|
|
508
|
-
|
|
1082
|
+
var TRANSFORM_ATTR = "transform";
|
|
1083
|
+
var TRANSFORM_PART = {
|
|
1084
|
+
translate: "translate",
|
|
1085
|
+
rotate: "rotate",
|
|
1086
|
+
scale: "scale",
|
|
1087
|
+
origin: "origin"
|
|
509
1088
|
};
|
|
510
|
-
var
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
1089
|
+
var PX_TRANSFORM_PART_KEYS = [
|
|
1090
|
+
TRANSFORM_PART.translate,
|
|
1091
|
+
TRANSFORM_PART.rotate,
|
|
1092
|
+
TRANSFORM_PART.scale,
|
|
1093
|
+
TRANSFORM_PART.origin
|
|
1094
|
+
];
|
|
1095
|
+
var PxGradientUnits = {
|
|
1096
|
+
userSpaceOnUse: "userSpaceOnUse",
|
|
1097
|
+
objectBoundingBox: "objectBoundingBox"
|
|
1098
|
+
};
|
|
1099
|
+
var PxGradientSpreadMethod = {
|
|
1100
|
+
pad: "pad",
|
|
1101
|
+
reflect: "reflect",
|
|
1102
|
+
repeat: "repeat"
|
|
1103
|
+
};
|
|
1104
|
+
var PxGradientType = {
|
|
1105
|
+
linear: "linear",
|
|
1106
|
+
radial: "radial"
|
|
517
1107
|
};
|
|
518
1108
|
function getAnimatorConfig(doc) {
|
|
519
1109
|
var _a;
|
|
520
|
-
|
|
1110
|
+
const cfg = (doc == null ? void 0 : doc.animator) || ((_a = doc == null ? void 0 : doc.meta) == null ? void 0 : _a.animator);
|
|
1111
|
+
return cfg ? flattenAnimatorTimeline(cfg) : void 0;
|
|
1112
|
+
}
|
|
1113
|
+
var flattenMemo = /* @__PURE__ */ new WeakMap();
|
|
1114
|
+
function flattenAnimatorTimeline(cfg) {
|
|
1115
|
+
const timeline = cfg.timeline;
|
|
1116
|
+
if (timeline === void 0 || timeline === null || typeof timeline !== "object") return cfg;
|
|
1117
|
+
const memoised = flattenMemo.get(cfg);
|
|
1118
|
+
if (memoised) return memoised;
|
|
1119
|
+
const _a = cfg, { timeline: _dropped } = _a, flat = __objRest(_a, ["timeline"]);
|
|
1120
|
+
if (timeline.engine !== void 0) flat.engine = timeline.engine;
|
|
1121
|
+
if (timeline.frameRate !== void 0) flat.frameRate = timeline.frameRate;
|
|
1122
|
+
if (timeline.type === "scroll" || timeline.type === "view") {
|
|
1123
|
+
flat.timelineSource = "scroll";
|
|
1124
|
+
if (timeline.duration !== void 0) flat.duration = timeline.duration;
|
|
1125
|
+
if (timeline.iterations !== void 0) flat.iterations = timeline.iterations;
|
|
1126
|
+
const scroll = __spreadValues({}, flat.scroll || {});
|
|
1127
|
+
scroll.kind = timeline.type;
|
|
1128
|
+
if (timeline.axis !== void 0) scroll.axis = timeline.axis;
|
|
1129
|
+
if (timeline.source !== void 0) scroll.source = timeline.source;
|
|
1130
|
+
if (timeline.subject !== void 0) scroll.subject = timeline.subject;
|
|
1131
|
+
if (timeline.smoothing !== void 0) scroll.smoothing = timeline.smoothing;
|
|
1132
|
+
if (timeline.range !== void 0) scroll.range = timeline.range;
|
|
1133
|
+
const pin = timeline.pin;
|
|
1134
|
+
if (typeof pin === "boolean") scroll.pin = pin;
|
|
1135
|
+
else if (pin && typeof pin === "object") {
|
|
1136
|
+
scroll.pin = true;
|
|
1137
|
+
if (pin.align !== void 0) scroll.pinAlign = pin.align;
|
|
1138
|
+
if (pin.top !== void 0) scroll.pinTop = pin.top;
|
|
1139
|
+
if (pin.distance !== void 0) scroll.pinDistance = pin.distance;
|
|
1140
|
+
}
|
|
1141
|
+
flat.scroll = scroll;
|
|
1142
|
+
} else {
|
|
1143
|
+
if (timeline.duration !== void 0) flat.duration = timeline.duration;
|
|
1144
|
+
if (timeline.trigger !== void 0) {
|
|
1145
|
+
const _b = timeline.trigger, { finishAction } = _b, restTrigger = __objRest(_b, ["finishAction"]);
|
|
1146
|
+
if (Object.keys(restTrigger).length) flat.trigger = restTrigger;
|
|
1147
|
+
if (finishAction !== void 0) flat.resetOnFinish = finishAction === "reset";
|
|
1148
|
+
}
|
|
1149
|
+
if (timeline.delay !== void 0) flat.delay = timeline.delay;
|
|
1150
|
+
if (timeline.iterations !== void 0) flat.iterations = timeline.iterations;
|
|
1151
|
+
if (timeline.direction !== void 0) flat.direction = timeline.direction;
|
|
1152
|
+
if (timeline.fillMode !== void 0) flat.fill = timeline.fillMode;
|
|
1153
|
+
}
|
|
1154
|
+
flattenMemo.set(cfg, flat);
|
|
1155
|
+
return flat;
|
|
521
1156
|
}
|
|
522
1157
|
function getDefs(doc) {
|
|
523
1158
|
var _a;
|
|
@@ -529,13 +1164,379 @@ var PixodeskAnimator = (() => {
|
|
|
529
1164
|
if (!doc) return void 0;
|
|
530
1165
|
const animateById = (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.animateById;
|
|
531
1166
|
if (!animateById) return void 0;
|
|
532
|
-
return Object.entries(animateById).map(([id, anim]) => ({ id, animate: anim }));
|
|
1167
|
+
return Object.entries(animateById).map(([id, anim]) => ({ id: id.startsWith("#") ? id.slice(1) : id, animate: anim }));
|
|
533
1168
|
}
|
|
534
1169
|
|
|
535
|
-
// ../svg-animator-core/src/
|
|
536
|
-
|
|
1170
|
+
// ../svg-animator-core/src/format/PxAnimatorTypes.ts
|
|
1171
|
+
var PxEasingOrRefSchema = px.union([
|
|
1172
|
+
px.string(),
|
|
1173
|
+
px.tuple([px.number(), px.number(), px.number(), px.number()])
|
|
1174
|
+
]);
|
|
1175
|
+
var PxKeyframeValueSchema = implementsInterface()(px.union([
|
|
1176
|
+
px.string(),
|
|
1177
|
+
// e.g. for colors
|
|
1178
|
+
px.number(),
|
|
1179
|
+
px.array(px.number()),
|
|
1180
|
+
// ORDER LAW: the key-discriminated object shapes (`{path}`, `{paths}`) come BEFORE the
|
|
1181
|
+
// all-optional transform-parts record. In default (non-strict) mode that record accepts
|
|
1182
|
+
// ANY object (every key optional, unknown keys ignored), so listing it earlier made
|
|
1183
|
+
// Union.sanitize route `{path}`/`{paths}` values into it and strip them to `{}` —
|
|
1184
|
+
// silent morph-data loss (repro: the editor's keyframeValueSanitize spec). Validity is
|
|
1185
|
+
// order-independent (`some()`); only sanitize routing depends on this order.
|
|
1186
|
+
px.object({ path: px.string() }),
|
|
1187
|
+
px.lazy(() => px.object({ paths: px.array(PxBezierPathSchema) }), { paths: [] }),
|
|
1188
|
+
// Gradient `stops` timeline — each kf value is the full stops-array snapshot.
|
|
1189
|
+
px.lazy(() => px.array(PxGradientStopSchema), []),
|
|
1190
|
+
px.lazy(() => PxTransformPartsSchema, {})
|
|
1191
|
+
]));
|
|
1192
|
+
var PxKeyframeSchema = implementsInterface()(px.object({
|
|
1193
|
+
time: px.number().optional(),
|
|
1194
|
+
value: PxKeyframeValueSchema.optional(),
|
|
1195
|
+
easing: PxEasingOrRefSchema.optional(),
|
|
1196
|
+
tangentOut: px.tuple([px.number(), px.number()]).optional(),
|
|
1197
|
+
tangentIn: px.tuple([px.number(), px.number()]).optional()
|
|
1198
|
+
// (`selected` — editor timeline-selection UI state — was REMOVED from the wire
|
|
1199
|
+
// (review §1.3): editor data lives under `meta`. The editor still carries it on
|
|
1200
|
+
// its internal COPY-PASTE payload, which never validates against this schema.)
|
|
1201
|
+
}));
|
|
1202
|
+
var anyKf = (kf) => kf;
|
|
1203
|
+
var kfTime = (kf) => {
|
|
1204
|
+
var _a, _b;
|
|
1205
|
+
return (_b = (_a = anyKf(kf).time) != null ? _a : anyKf(kf).t) != null ? _b : 0;
|
|
1206
|
+
};
|
|
1207
|
+
var kfValue = (kf) => {
|
|
1208
|
+
var _a;
|
|
1209
|
+
return (_a = anyKf(kf).value) != null ? _a : anyKf(kf).v;
|
|
1210
|
+
};
|
|
1211
|
+
var kfEasing = (kf) => {
|
|
537
1212
|
var _a;
|
|
538
|
-
|
|
1213
|
+
return (_a = anyKf(kf).easing) != null ? _a : anyKf(kf).e;
|
|
1214
|
+
};
|
|
1215
|
+
var kfTangentIn = (kf) => anyKf(kf).tangentIn;
|
|
1216
|
+
var kfTangentOut = (kf) => anyKf(kf).tangentOut;
|
|
1217
|
+
var PxLoopSchema = implementsInterface()(px.object({
|
|
1218
|
+
segmentCount: px.number().optional(),
|
|
1219
|
+
repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end]).optional(),
|
|
1220
|
+
direction: px.enum([PxLoopDirection.normal, PxLoopDirection.alternate]).optional()
|
|
1221
|
+
}));
|
|
1222
|
+
var PxPropertyAnimationSchema = implementsInterface()(px.object({
|
|
1223
|
+
value: PxKeyframeValueSchema.optional(),
|
|
1224
|
+
keyframes: px.array(PxKeyframeSchema).optional(),
|
|
1225
|
+
loop: px.union([PxLoopSchema, px.boolean()]).optional(),
|
|
1226
|
+
autoOrient: px.boolean().optional(),
|
|
1227
|
+
alongPathMode: px.enum(["sampled", "offsetPath"]).optional()
|
|
1228
|
+
}));
|
|
1229
|
+
var PxTransformPartsSchema = implementsInterface()(px.object({
|
|
1230
|
+
translate: px.tuple([px.number(), px.number()]).optional(),
|
|
1231
|
+
rotate: px.number().optional(),
|
|
1232
|
+
skew: px.number().optional(),
|
|
1233
|
+
scale: px.tuple([px.number(), px.number()]).optional(),
|
|
1234
|
+
origin: px.tuple([px.number(), px.number()]).optional()
|
|
1235
|
+
}));
|
|
1236
|
+
var PxTransformValueSchema = px.union([
|
|
1237
|
+
px.string(),
|
|
1238
|
+
PxTransformPartsSchema,
|
|
1239
|
+
px.object({ value: PxTransformPartsSchema }),
|
|
1240
|
+
PxPropertyAnimationSchema
|
|
1241
|
+
]);
|
|
1242
|
+
var PxAnimationDefinitionSchema = implementsInterface()(
|
|
1243
|
+
px.record(PxPropertyAnimationSchema)
|
|
1244
|
+
);
|
|
1245
|
+
var PxElementAnimationSchema = implementsInterface()(px.union([
|
|
1246
|
+
px.string(),
|
|
1247
|
+
px.array(px.union([px.string(), PxAnimationDefinitionSchema])),
|
|
1248
|
+
PxAnimationDefinitionSchema
|
|
1249
|
+
]));
|
|
1250
|
+
var PxTriggerSchema = implementsInterface()(px.object({
|
|
1251
|
+
startOn: px.enum(["load", "mouseOver", "click", "scrollIntoView", "programmatic"]).optional(),
|
|
1252
|
+
outAction: px.enum(["continue", "pause", "reset", "reverse"]).optional(),
|
|
1253
|
+
// What happens after a NATURAL finish — `'hold'` (default: keep the end state per
|
|
1254
|
+
// `fill`) or `'reset'` (snap back to the start state). Pairs with `outAction` ("what
|
|
1255
|
+
// happens when the trigger condition ends"); both end-of-life knobs now read alike.
|
|
1256
|
+
finishAction: px.enum(["hold", "reset"]).optional(),
|
|
1257
|
+
scrollIntoViewThreshold: px.number().optional()
|
|
1258
|
+
}));
|
|
1259
|
+
var PxGlyphSchema = implementsInterface()(px.object({
|
|
1260
|
+
width: px.number(),
|
|
1261
|
+
d: px.string()
|
|
1262
|
+
}));
|
|
1263
|
+
var PxGlyphFontSchema = implementsInterface()(px.object({
|
|
1264
|
+
fontFamily: px.string(),
|
|
1265
|
+
fontStyle: px.string(),
|
|
1266
|
+
ascent: px.number(),
|
|
1267
|
+
unitsPerEm: px.number(),
|
|
1268
|
+
glyphs: px.record(PxGlyphSchema)
|
|
1269
|
+
}));
|
|
1270
|
+
var PxDefsSchema = implementsInterface()(px.object({
|
|
1271
|
+
easings: px.record(px.tuple([px.number(), px.number(), px.number(), px.number()])).optional(),
|
|
1272
|
+
animations: px.record(PxAnimationDefinitionSchema).optional(),
|
|
1273
|
+
// Review §2.6: the schema now matches the declared type — a style preset is a flat
|
|
1274
|
+
// record of string|number attribute values, nothing nested.
|
|
1275
|
+
styles: px.record(px.record(px.union([px.string(), px.number()]))).optional(),
|
|
1276
|
+
fonts: px.record(PxGlyphFontSchema).optional()
|
|
1277
|
+
}));
|
|
1278
|
+
var PX_SCROLL_PHASES = ["cover", "contain", "entry", "exit", "entry-crossing", "exit-crossing"];
|
|
1279
|
+
var PxScrollRangePointSchema = implementsInterface()(px.object({
|
|
1280
|
+
phase: px.enum(PX_SCROLL_PHASES).optional(),
|
|
1281
|
+
fraction: px.number().optional()
|
|
1282
|
+
}));
|
|
1283
|
+
var PxScrollRangeSchema = px.object({
|
|
1284
|
+
start: PxScrollRangePointSchema.optional(),
|
|
1285
|
+
end: PxScrollRangePointSchema.optional()
|
|
1286
|
+
});
|
|
1287
|
+
var PxScrollSchema = implementsInterface()(px.object({
|
|
1288
|
+
kind: px.enum(["view", "scroll"]).optional(),
|
|
1289
|
+
axis: px.enum(["block", "inline", "x", "y"]).optional(),
|
|
1290
|
+
source: px.enum(["nearest", "root"]).optional(),
|
|
1291
|
+
// Free-form: the two keywords `parent`/`scroller` plus any CSS selector.
|
|
1292
|
+
subject: px.string().optional(),
|
|
1293
|
+
smoothing: px.number().optional(),
|
|
1294
|
+
pin: px.boolean().optional(),
|
|
1295
|
+
pinAlign: px.enum(["top", "center", "bottom"]).optional(),
|
|
1296
|
+
pinTop: px.number().optional(),
|
|
1297
|
+
pinDistance: px.number().optional(),
|
|
1298
|
+
range: PxScrollRangeSchema.optional()
|
|
1299
|
+
}));
|
|
1300
|
+
var PxTimelinePinSchema = implementsInterface()(px.object({
|
|
1301
|
+
align: px.enum(["top", "center", "bottom"]).optional(),
|
|
1302
|
+
top: px.number().optional(),
|
|
1303
|
+
distance: px.number().optional()
|
|
1304
|
+
}));
|
|
1305
|
+
var PxTimelineEngineSchema = px.enum([PxTimelineEngineExtra.auto, PxTimelineEngineExtra.native, PxTimelineEngineExtra.js]).optional();
|
|
1306
|
+
var PxTimeTimelineSchema = implementsInterface()(px.object({
|
|
1307
|
+
type: px.literal("time").optional(),
|
|
1308
|
+
engine: PxTimelineEngineSchema,
|
|
1309
|
+
frameRate: px.number().optional(),
|
|
1310
|
+
// §2.8: duration is a property of the TIMELINE — how long one pass takes.
|
|
1311
|
+
duration: px.number().optional(),
|
|
1312
|
+
trigger: PxTriggerSchema.optional(),
|
|
1313
|
+
delay: px.number().optional(),
|
|
1314
|
+
iterations: px.union([px.number(), px.literal("infinite")]).optional(),
|
|
1315
|
+
// `fillMode` on the wire (CSS `animation-fill-mode`; the runtime view calls it `fill`)
|
|
1316
|
+
// — never `fill`, which is paint everywhere else in the format.
|
|
1317
|
+
fillMode: px.enum(["forwards", "backwards", "both", "none"]).optional(),
|
|
1318
|
+
direction: px.enum(["normal", "reverse", "alternate", "alternate-reverse"]).optional()
|
|
1319
|
+
}));
|
|
1320
|
+
var scrollishTimelineShape = {
|
|
1321
|
+
// §2.8: duration is a property of the TIMELINE — under scrubbing it is the keyframe
|
|
1322
|
+
// span the scroll range maps onto.
|
|
1323
|
+
duration: px.number().optional(),
|
|
1324
|
+
// Finite repeat count IS meaningful when scrubbing — the scroll range maps onto
|
|
1325
|
+
// duration × iterations (rule D4; `'infinite'` cannot map to a range, so no literal here).
|
|
1326
|
+
iterations: px.number().optional(),
|
|
1327
|
+
engine: PxTimelineEngineSchema,
|
|
1328
|
+
frameRate: px.number().optional(),
|
|
1329
|
+
axis: px.enum(["block", "inline", "x", "y"]).optional(),
|
|
1330
|
+
source: px.enum(["nearest", "root"]).optional(),
|
|
1331
|
+
subject: px.string().optional(),
|
|
1332
|
+
// 'parent' | 'scroller' | any CSS selector
|
|
1333
|
+
smoothing: px.number().optional(),
|
|
1334
|
+
// ms
|
|
1335
|
+
pin: px.union([px.boolean(), PxTimelinePinSchema]).optional(),
|
|
1336
|
+
range: PxScrollRangeSchema.optional()
|
|
1337
|
+
};
|
|
1338
|
+
var PxScrollTimelineSchema = implementsInterface()(
|
|
1339
|
+
px.object(__spreadValues({ type: px.literal("scroll") }, scrollishTimelineShape))
|
|
1340
|
+
);
|
|
1341
|
+
var PxViewTimelineSchema = implementsInterface()(
|
|
1342
|
+
px.object(__spreadValues({ type: px.literal("view") }, scrollishTimelineShape))
|
|
1343
|
+
);
|
|
1344
|
+
var PxTimelineSchema = px.discriminatedUnion("type", [
|
|
1345
|
+
PxTimeTimelineSchema,
|
|
1346
|
+
// first = the member an absent `type` selects
|
|
1347
|
+
PxScrollTimelineSchema,
|
|
1348
|
+
PxViewTimelineSchema
|
|
1349
|
+
]);
|
|
1350
|
+
var PxAnimatorConfigSchema = implementsInterface()(px.object({
|
|
1351
|
+
// (`mode`, `duration` and `frameRate` live INSIDE `timeline` on the wire — §2.8; they exist
|
|
1352
|
+
// at this level only on the runtime view, like the rest of the playback dynamics.)
|
|
1353
|
+
// THE spelling of "what advances progress" — clock / scroll / view (review §2.1).
|
|
1354
|
+
timeline: PxTimelineSchema.optional(),
|
|
1355
|
+
definitions: PxDefsSchema.optional(),
|
|
1356
|
+
animateById: px.record(PxElementAnimationSchema).optional(),
|
|
1357
|
+
debugGlobalName: px.string().optional(),
|
|
1358
|
+
// Declared HERE because this is a closed object: an undeclared key would be stripped by
|
|
1359
|
+
// `sanitize` and flagged by strict validation on our own files.
|
|
1360
|
+
version: px.string().optional()
|
|
1361
|
+
}));
|
|
1362
|
+
var PxBindingSchema = implementsInterface()(px.object({
|
|
1363
|
+
id: px.string(),
|
|
1364
|
+
animate: PxElementAnimationSchema
|
|
1365
|
+
}));
|
|
1366
|
+
var PxAttrValueSchema = px.union([
|
|
1367
|
+
px.string(),
|
|
1368
|
+
px.number(),
|
|
1369
|
+
px.array(px.number()),
|
|
1370
|
+
// Structured static — `{value: …}` (read-accepted transitional spelling, S1).
|
|
1371
|
+
// `defined`, not `any`: the KEY's presence is what identifies this branch (V6).
|
|
1372
|
+
px.object({ value: px.defined() }),
|
|
1373
|
+
// Bare transform parts record — the canonical static `transform` on the wire (T2).
|
|
1374
|
+
PxTransformPartsSchema
|
|
1375
|
+
]);
|
|
1376
|
+
var PxAnimatableNumberSchema = px.union([
|
|
1377
|
+
px.number(),
|
|
1378
|
+
PxPropertyAnimationSchema,
|
|
1379
|
+
px.object({ value: px.number() })
|
|
1380
|
+
]);
|
|
1381
|
+
var PxAnimatableVec2Schema = px.union([
|
|
1382
|
+
px.tuple([px.number(), px.number()]),
|
|
1383
|
+
PxPropertyAnimationSchema,
|
|
1384
|
+
px.object({ value: px.tuple([px.number(), px.number()]) })
|
|
1385
|
+
]);
|
|
1386
|
+
var PxAnimatableStringSchema = px.union([
|
|
1387
|
+
px.string(),
|
|
1388
|
+
PxPropertyAnimationSchema,
|
|
1389
|
+
px.object({ value: px.string() })
|
|
1390
|
+
]);
|
|
1391
|
+
var PxTransformByEffectSchema = implementsInterface()(px.object({
|
|
1392
|
+
translate: PxAnimatableVec2Schema.optional(),
|
|
1393
|
+
rotate: PxAnimatableNumberSchema.optional(),
|
|
1394
|
+
scale: PxAnimatableVec2Schema.optional(),
|
|
1395
|
+
skew: PxAnimatableNumberSchema.optional(),
|
|
1396
|
+
origin: PxAnimatableVec2Schema.optional()
|
|
1397
|
+
}));
|
|
1398
|
+
var PxRepeaterEffectSchema = implementsInterface()(px.object({
|
|
1399
|
+
// STATIC config, not a channel (V2/SCHEMA-DESIGN R5): the copy COUNT is read
|
|
1400
|
+
// once at expansion time and never sampled — plain number, no `keyframes`.
|
|
1401
|
+
copies: px.number().optional(),
|
|
1402
|
+
translate: PxAnimatableVec2Schema.optional(),
|
|
1403
|
+
rotate: PxAnimatableNumberSchema.optional(),
|
|
1404
|
+
skew: PxAnimatableNumberSchema.optional(),
|
|
1405
|
+
scale: PxAnimatableVec2Schema.optional(),
|
|
1406
|
+
origin: PxAnimatableVec2Schema.optional()
|
|
1407
|
+
}));
|
|
1408
|
+
var PxMaskedByEffectSchema = implementsInterface()(px.object({
|
|
1409
|
+
source: px.string().optional(),
|
|
1410
|
+
maskType: px.enum([PxMaskType.luminance, PxMaskType.alpha]).optional(),
|
|
1411
|
+
maskUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
|
|
1412
|
+
maskContentUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
|
|
1413
|
+
x: px.number().optional(),
|
|
1414
|
+
y: px.number().optional(),
|
|
1415
|
+
width: px.number().optional(),
|
|
1416
|
+
height: px.number().optional()
|
|
1417
|
+
}));
|
|
1418
|
+
var PxClipPathEffectSchema = implementsInterface()(px.object({
|
|
1419
|
+
d: PxAnimatableStringSchema.optional()
|
|
1420
|
+
}));
|
|
1421
|
+
var PxStrokeTrimEffectSchema = implementsInterface()(px.object({
|
|
1422
|
+
offset: PxAnimatableNumberSchema.optional(),
|
|
1423
|
+
range: PxAnimatableVec2Schema.optional(),
|
|
1424
|
+
subPaths: px.enum([PxStrokeTrimSubPaths.separate, PxStrokeTrimSubPaths.combined]).optional()
|
|
1425
|
+
}));
|
|
1426
|
+
var PxRetimeEffectSchema = implementsInterface()(px.object({
|
|
1427
|
+
start: px.number().optional(),
|
|
1428
|
+
stretch: px.number().optional(),
|
|
1429
|
+
timeCrop: px.tuple([px.number(), px.number()]).optional()
|
|
1430
|
+
}));
|
|
1431
|
+
var PxCloneEffectSchema = implementsInterface()(px.object({
|
|
1432
|
+
// Subtractive on purpose: the `<use>` can only point at one wrapper layer of the
|
|
1433
|
+
// source, so the choices form a ladder — 'translate' now, maybe 'transform' later.
|
|
1434
|
+
without: px.enum([PxCloneWithout.translate]).optional(),
|
|
1435
|
+
source: px.string().optional(),
|
|
1436
|
+
retime: PxRetimeEffectSchema.optional()
|
|
1437
|
+
}));
|
|
1438
|
+
var PxGradientStopSchema = implementsInterface()(px.object({
|
|
1439
|
+
offset: px.number(),
|
|
1440
|
+
color: px.string()
|
|
1441
|
+
}));
|
|
1442
|
+
var PxAnimatableGradientStopsSchema = px.union([
|
|
1443
|
+
px.array(PxGradientStopSchema),
|
|
1444
|
+
px.object({ value: px.array(PxGradientStopSchema) }),
|
|
1445
|
+
PxPropertyAnimationSchema
|
|
1446
|
+
]);
|
|
1447
|
+
var PxFillGradientEffectSchema = implementsInterface()(px.object({
|
|
1448
|
+
// Contextual kind — the `type` convention, see `PxNodeBase.type`.
|
|
1449
|
+
type: px.enum([PxGradientType.linear, PxGradientType.radial]),
|
|
1450
|
+
start: PxAnimatableVec2Schema.optional(),
|
|
1451
|
+
end: PxAnimatableVec2Schema.optional(),
|
|
1452
|
+
center: PxAnimatableVec2Schema.optional(),
|
|
1453
|
+
radius: PxAnimatableNumberSchema.optional(),
|
|
1454
|
+
focal: PxAnimatableVec2Schema.optional(),
|
|
1455
|
+
stops: PxAnimatableGradientStopsSchema.optional(),
|
|
1456
|
+
gradientUnits: px.enum([PxGradientUnits.userSpaceOnUse, PxGradientUnits.objectBoundingBox]).optional(),
|
|
1457
|
+
spreadMethod: px.enum([PxGradientSpreadMethod.pad, PxGradientSpreadMethod.reflect, PxGradientSpreadMethod.repeat]).optional(),
|
|
1458
|
+
gradientTransform: px.string().optional()
|
|
1459
|
+
}));
|
|
1460
|
+
var PxStrokeGradientEffectSchema = PxFillGradientEffectSchema;
|
|
1461
|
+
var PxTextPathEffectSchema = implementsInterface()(px.object({
|
|
1462
|
+
pathData: px.string(),
|
|
1463
|
+
pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend]).optional(),
|
|
1464
|
+
lengthAdjust: px.enum([PxLengthAdjust.spacing, PxLengthAdjust.spacingAndGlyphs]).optional(),
|
|
1465
|
+
method: px.enum([PxTextPathMethod.align, PxTextPathMethod.stretch]).optional(),
|
|
1466
|
+
spacing: px.enum([PxTextPathSpacing.auto, PxTextPathSpacing.exact]).optional(),
|
|
1467
|
+
startOffset: PxAnimatableNumberSchema.optional(),
|
|
1468
|
+
textLength: PxAnimatableNumberSchema.optional()
|
|
1469
|
+
}));
|
|
1470
|
+
var PxTextEffectSchema = implementsInterface()(px.object({
|
|
1471
|
+
useGlyphs: px.boolean().optional()
|
|
1472
|
+
}));
|
|
1473
|
+
var PxEffectsSchema = implementsInterface()(px.object({
|
|
1474
|
+
transformBy: PxTransformByEffectSchema.optional(),
|
|
1475
|
+
repeater: PxRepeaterEffectSchema.optional(),
|
|
1476
|
+
maskedBy: PxMaskedByEffectSchema.optional(),
|
|
1477
|
+
clipPath: PxClipPathEffectSchema.optional(),
|
|
1478
|
+
strokeTrim: PxStrokeTrimEffectSchema.optional(),
|
|
1479
|
+
clone: PxCloneEffectSchema.optional(),
|
|
1480
|
+
fillGradient: PxFillGradientEffectSchema.optional(),
|
|
1481
|
+
strokeGradient: PxStrokeGradientEffectSchema.optional(),
|
|
1482
|
+
textPath: PxTextPathEffectSchema.optional(),
|
|
1483
|
+
text: PxTextEffectSchema.optional()
|
|
1484
|
+
}));
|
|
1485
|
+
var PxNodeBase = px.openObject({
|
|
1486
|
+
// CONVENTION (SCHEMA-DESIGN R1 / issues N4): `type` is the ONE word for "what
|
|
1487
|
+
// kind of thing is this", discriminated by its CARRIER — here the node TAG
|
|
1488
|
+
// (`rect`, `text`), and inside a sub-object that object's kind (`fillGradient.type`,
|
|
1489
|
+
// `fillGradient.type`, editor `preset.type`). Each sits in its own object, so
|
|
1490
|
+
// the carrier disambiguates completely; synonyms (`cloneKind`, `presetShape`)
|
|
1491
|
+
// would add words that all mean "type" and still need the carrier to read.
|
|
1492
|
+
// Guarding a `type` SLOT against a wrong VALUE is the job of strict enums
|
|
1493
|
+
// (issues V3), never of distinct key names.
|
|
1494
|
+
type: px.string(),
|
|
1495
|
+
// The escape hatch for elements that carry a REAL `type` attribute — `<feTurbulence
|
|
1496
|
+
// type="fractalNoise">`, `<feFuncR type="table">`, `<feColorMatrix type="saturate">`.
|
|
1497
|
+
// `type` is taken by the tag name, so the attribute travels here and the renderer puts
|
|
1498
|
+
// it back (`PxAnimatorDOM.renderNode`, `PxRnRender`). Declared here — not merely
|
|
1499
|
+
// documented — because a wire key that is not in a schema is invisible to the
|
|
1500
|
+
// minifier's reserve list and gets renamed (MINIFICATION-BOUNDARY-PLAN.md §1.1).
|
|
1501
|
+
domType: px.string().optional(),
|
|
1502
|
+
id: px.string().optional(),
|
|
1503
|
+
meta: px.any().optional(),
|
|
1504
|
+
// Player-effects bucket emitted by the Editor's lightweight design format.
|
|
1505
|
+
// Consumed and removed by `applyPlayerEffects` before any other normalisation
|
|
1506
|
+
// (see `createAnimatorImpl`), so downstream code never sees it.
|
|
1507
|
+
effects: PxEffectsSchema.optional(),
|
|
1508
|
+
// `PxElementAnimation` (not just `PxAnimationDefinition`) — accepts
|
|
1509
|
+
// string ref / array of refs / inline definition / mixed array; mirrors
|
|
1510
|
+
// `animator.animateById` map values and what `processNode` resolves at runtime.
|
|
1511
|
+
animate: PxElementAnimationSchema.optional(),
|
|
1512
|
+
style: px.union([px.string(), px.record(px.union([px.string(), px.number()]))]).optional()
|
|
1513
|
+
}, PxAttrValueSchema);
|
|
1514
|
+
var PxNodeSchema = px.openObject(__spreadProps(__spreadValues({}, PxNodeBase._shape), {
|
|
1515
|
+
children: px.lazy(() => px.array(PxNodeSchema), []).optional()
|
|
1516
|
+
}), PxAttrValueSchema);
|
|
1517
|
+
var PxSvgNodeExtra = px.object({
|
|
1518
|
+
// `"100%"` and other SVG length strings are legal here — a number-only slot rejected
|
|
1519
|
+
// real documents (e.g. apple-store-look-14-main.json) at the root <svg>.
|
|
1520
|
+
width: px.union([px.number(), px.string()]).optional(),
|
|
1521
|
+
height: px.union([px.number(), px.string()]).optional(),
|
|
1522
|
+
viewBox: px.string().optional(),
|
|
1523
|
+
animator: PxAnimatorConfigSchema.optional()
|
|
1524
|
+
});
|
|
1525
|
+
var PxAnimatedSvgDocumentSchema = px.openObject(__spreadProps(__spreadValues(__spreadValues({}, PxNodeBase._shape), PxSvgNodeExtra._shape), {
|
|
1526
|
+
type: px.literal("svg"),
|
|
1527
|
+
// override string → literal to require 'svg'
|
|
1528
|
+
children: px.array(PxNodeSchema).optional()
|
|
1529
|
+
}), PxAttrValueSchema);
|
|
1530
|
+
var PxBezierPathSchema = implementsInterface()(px.object({
|
|
1531
|
+
v: px.array(px.array(px.number())),
|
|
1532
|
+
i: px.array(px.array(px.number())).optional(),
|
|
1533
|
+
o: px.array(px.array(px.number())).optional(),
|
|
1534
|
+
c: px.boolean().optional()
|
|
1535
|
+
}));
|
|
1536
|
+
|
|
1537
|
+
// ../svg-animator-core/src/materialise/PxMotionPath.ts
|
|
1538
|
+
function getKfTranslate(kf) {
|
|
1539
|
+
const v = kfValue(kf);
|
|
539
1540
|
if (!v) return void 0;
|
|
540
1541
|
if (Array.isArray(v) && v.length >= 2 && typeof v[0] === "number" && typeof v[1] === "number") {
|
|
541
1542
|
return [v[0], v[1]];
|
|
@@ -545,31 +1546,27 @@ var PixodeskAnimator = (() => {
|
|
|
545
1546
|
return void 0;
|
|
546
1547
|
}
|
|
547
1548
|
function getKfTime(kf) {
|
|
548
|
-
|
|
549
|
-
return (_b = (_a = kf.time) != null ? _a : kf.t) != null ? _b : 0;
|
|
1549
|
+
return kfTime(kf);
|
|
550
1550
|
}
|
|
551
1551
|
function getKfEasing(kf) {
|
|
552
|
-
|
|
553
|
-
return (_a = kf.easing) != null ? _a : kf.e;
|
|
1552
|
+
return kfEasing(kf);
|
|
554
1553
|
}
|
|
555
1554
|
function propAnimIsMotionPath(anim) {
|
|
556
|
-
|
|
557
|
-
const kfs = (_a = anim.keyframes) != null ? _a : anim.kfs;
|
|
1555
|
+
const kfs = anim.keyframes;
|
|
558
1556
|
if (!Array.isArray(kfs)) return false;
|
|
559
1557
|
if (anim.autoOrient) return true;
|
|
560
1558
|
for (const kf of kfs) {
|
|
561
|
-
if ((
|
|
1559
|
+
if (kfTangentIn(kf) || kfTangentOut(kf)) return true;
|
|
562
1560
|
}
|
|
563
1561
|
return false;
|
|
564
1562
|
}
|
|
565
1563
|
var _segmentCache = /* @__PURE__ */ new WeakMap();
|
|
566
1564
|
function getSegmentCache(prevKf, nextKf, prevPos, nextPos) {
|
|
567
|
-
var _a, _b;
|
|
568
1565
|
let byNext = _segmentCache.get(prevKf);
|
|
569
1566
|
const existing = byNext == null ? void 0 : byNext.get(nextKf);
|
|
570
1567
|
if (existing) return existing;
|
|
571
|
-
const to = (
|
|
572
|
-
const ti = (
|
|
1568
|
+
const to = kfTangentOut(prevKf);
|
|
1569
|
+
const ti = kfTangentIn(nextKf);
|
|
573
1570
|
const P1 = [prevPos[0] + (to ? to[0] : 0), prevPos[1] + (to ? to[1] : 0)];
|
|
574
1571
|
const P2 = [nextPos[0] + (ti ? ti[0] : 0), nextPos[1] + (ti ? ti[1] : 0)];
|
|
575
1572
|
const lut = bezier2D_arcLengthLUT(prevPos, P1, P2, nextPos);
|
|
@@ -619,14 +1616,14 @@ var PixodeskAnimator = (() => {
|
|
|
619
1616
|
var DEFAULT_ROTATION_TOL = 5;
|
|
620
1617
|
var DEFAULT_MAX_SAMPLES = 32;
|
|
621
1618
|
function materialiseMotionPathInPropAnim(anim, opts) {
|
|
622
|
-
var _a, _b, _c
|
|
1619
|
+
var _a, _b, _c;
|
|
623
1620
|
if (!propAnimIsMotionPath(anim)) return anim;
|
|
624
|
-
const kfs =
|
|
1621
|
+
const kfs = anim.keyframes;
|
|
625
1622
|
if (!Array.isArray(kfs) || kfs.length < 2) return anim;
|
|
626
1623
|
const autoOrient = !!anim.autoOrient;
|
|
627
|
-
const flatnessTol = (
|
|
628
|
-
const rotationTol = (
|
|
629
|
-
const maxSamples = (
|
|
1624
|
+
const flatnessTol = (_a = opts == null ? void 0 : opts.flatnessTolerance) != null ? _a : DEFAULT_FLATNESS_TOL;
|
|
1625
|
+
const rotationTol = (_b = opts == null ? void 0 : opts.rotationTolerance) != null ? _b : DEFAULT_ROTATION_TOL;
|
|
1626
|
+
const maxSamples = (_c = opts == null ? void 0 : opts.maxSamplesPerSegment) != null ? _c : DEFAULT_MAX_SAMPLES;
|
|
630
1627
|
const out = [];
|
|
631
1628
|
const firstPos = getKfTranslate(kfs[0]);
|
|
632
1629
|
if (!firstPos) return anim;
|
|
@@ -655,15 +1652,14 @@ var PixodeskAnimator = (() => {
|
|
|
655
1652
|
const lastInE = getKfEasing(kfs[kfs.length - 1]);
|
|
656
1653
|
if (lastInE) out[out.length - 1].e = lastInE;
|
|
657
1654
|
if (autoOrient) unwrapAutoOrientRotations(out);
|
|
658
|
-
const result = {
|
|
1655
|
+
const result = { keyframes: out };
|
|
659
1656
|
if (anim.loop !== void 0) result.loop = anim.loop;
|
|
660
1657
|
return result;
|
|
661
1658
|
}
|
|
662
1659
|
function unwrapAutoOrientRotations(kfs) {
|
|
663
|
-
var _a;
|
|
664
1660
|
let prev;
|
|
665
1661
|
for (const kf of kfs) {
|
|
666
|
-
const v = (
|
|
1662
|
+
const v = kfValue(kf);
|
|
667
1663
|
if (!v || typeof v.rotate !== "number") continue;
|
|
668
1664
|
if (prev === void 0) {
|
|
669
1665
|
prev = v.rotate;
|
|
@@ -680,8 +1676,7 @@ var PixodeskAnimator = (() => {
|
|
|
680
1676
|
return { t: time, v: value };
|
|
681
1677
|
}
|
|
682
1678
|
function getKfValueParts(kf) {
|
|
683
|
-
|
|
684
|
-
const v = (_a = kf.value) != null ? _a : kf.v;
|
|
1679
|
+
const v = kfValue(kf);
|
|
685
1680
|
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
686
1681
|
return v;
|
|
687
1682
|
}
|
|
@@ -742,9 +1737,8 @@ var PixodeskAnimator = (() => {
|
|
|
742
1737
|
return d;
|
|
743
1738
|
}
|
|
744
1739
|
function insertSharpCornerStepKfIfNeeded(out, prevKf, nextKf, prevPos, nextPos, rotationTol) {
|
|
745
|
-
var _a;
|
|
746
1740
|
const lastKf = out[out.length - 1];
|
|
747
|
-
const lastV = (
|
|
1741
|
+
const lastV = kfValue(lastKf);
|
|
748
1742
|
const prevExit = lastV == null ? void 0 : lastV.rotate;
|
|
749
1743
|
if (typeof prevExit !== "number") return;
|
|
750
1744
|
const boundaryV = getKfValueParts(prevKf);
|
|
@@ -891,7 +1885,7 @@ var PixodeskAnimator = (() => {
|
|
|
891
1885
|
return Math.abs(cross) / Math.sqrt(len2);
|
|
892
1886
|
}
|
|
893
1887
|
|
|
894
|
-
// ../svg-animator-core/src/PxDefinitions.ts
|
|
1888
|
+
// ../svg-animator-core/src/animation/PxDefinitions.ts
|
|
895
1889
|
var LOOP_JUMP_SHIFT_MS = 1;
|
|
896
1890
|
function deepEqualValue(a, b) {
|
|
897
1891
|
if (a === b) return true;
|
|
@@ -992,8 +1986,8 @@ var PixodeskAnimator = (() => {
|
|
|
992
1986
|
if (Array.isArray(pathsArray) && pathsArray.length > 0) {
|
|
993
1987
|
if (isPathString(pathsArray[0])) {
|
|
994
1988
|
const paths = [];
|
|
995
|
-
for (const
|
|
996
|
-
const d = extractPathData(
|
|
1989
|
+
for (const pathStr2 of pathsArray) {
|
|
1990
|
+
const d = extractPathData(pathStr2);
|
|
997
1991
|
if (d) {
|
|
998
1992
|
paths.push(...parseSvgPathToBezier(d));
|
|
999
1993
|
}
|
|
@@ -1006,8 +2000,8 @@ var PixodeskAnimator = (() => {
|
|
|
1006
2000
|
if (Array.isArray(value)) {
|
|
1007
2001
|
if (value.length > 0 && isPathString(value[0])) {
|
|
1008
2002
|
const paths = [];
|
|
1009
|
-
for (const
|
|
1010
|
-
const d = extractPathData(
|
|
2003
|
+
for (const pathStr2 of value) {
|
|
2004
|
+
const d = extractPathData(pathStr2);
|
|
1011
2005
|
if (d) {
|
|
1012
2006
|
paths.push(...parseSvgPathToBezier(d));
|
|
1013
2007
|
}
|
|
@@ -1104,7 +2098,7 @@ var PixodeskAnimator = (() => {
|
|
|
1104
2098
|
const totalIntervals = keyframes.length - 1;
|
|
1105
2099
|
const segCount = clamp((_a = loop.segmentCount) != null ? _a : totalIntervals, 1, totalIntervals);
|
|
1106
2100
|
let segKfs;
|
|
1107
|
-
if (loop.
|
|
2101
|
+
if (loop.repeatAt === PxLoopRepeatAt.start) {
|
|
1108
2102
|
segKfs = keyframes.slice(0, segCount + 1);
|
|
1109
2103
|
} else {
|
|
1110
2104
|
segKfs = keyframes.slice(totalIntervals - segCount);
|
|
@@ -1112,7 +2106,7 @@ var PixodeskAnimator = (() => {
|
|
|
1112
2106
|
const firstT = (_b = keyframes[0].t) != null ? _b : 0;
|
|
1113
2107
|
const lastT = (_c = keyframes[keyframes.length - 1].t) != null ? _c : 0;
|
|
1114
2108
|
let fillStart, fillEnd;
|
|
1115
|
-
if (loop.
|
|
2109
|
+
if (loop.repeatAt === PxLoopRepeatAt.start) {
|
|
1116
2110
|
fillStart = 0;
|
|
1117
2111
|
fillEnd = firstT;
|
|
1118
2112
|
} else {
|
|
@@ -1125,21 +2119,18 @@ var PixodeskAnimator = (() => {
|
|
|
1125
2119
|
const segEndT = (_e = segKfs[segKfs.length - 1].t) != null ? _e : 0;
|
|
1126
2120
|
const segDuration = segEndT - segStartT;
|
|
1127
2121
|
if (segDuration <= 0) return keyframes;
|
|
1128
|
-
const template = segKfs.map((kf) => {
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
tangentOut: (_b2 = kf.tangentOut) != null ? _b2 : kf.to
|
|
1136
|
-
};
|
|
1137
|
-
});
|
|
2122
|
+
const template = segKfs.map((kf) => ({
|
|
2123
|
+
relT: (kf.t - segStartT) / segDuration,
|
|
2124
|
+
v: kf.v,
|
|
2125
|
+
e: kf.e,
|
|
2126
|
+
tangentIn: kfTangentIn(kf),
|
|
2127
|
+
tangentOut: kfTangentOut(kf)
|
|
2128
|
+
}));
|
|
1138
2129
|
const fullReps = Math.floor(fillDuration / segDuration);
|
|
1139
2130
|
const remainder = fillDuration - fullReps * segDuration;
|
|
1140
2131
|
const partialFraction = remainder / segDuration;
|
|
1141
2132
|
const looped = [];
|
|
1142
|
-
const separateBoundary = loop.
|
|
2133
|
+
const separateBoundary = loop.repeatAt !== PxLoopRepeatAt.start;
|
|
1143
2134
|
const originalTerminalKf = keyframes[keyframes.length - 1];
|
|
1144
2135
|
let terminalEasingOverride;
|
|
1145
2136
|
let hasTerminalEasingOverride = false;
|
|
@@ -1247,30 +2238,30 @@ var PixodeskAnimator = (() => {
|
|
|
1247
2238
|
looped.push(pushed);
|
|
1248
2239
|
}
|
|
1249
2240
|
}
|
|
1250
|
-
if (loop.
|
|
2241
|
+
if (loop.repeatAt === PxLoopRepeatAt.start) {
|
|
1251
2242
|
if (partialFraction > 1e-9) {
|
|
1252
|
-
const isReversed =
|
|
2243
|
+
const isReversed = loop.direction === PxLoopDirection.alternate && fullReps % 2 === 0;
|
|
1253
2244
|
appendRepTail(fillStart, isReversed, partialFraction);
|
|
1254
2245
|
}
|
|
1255
2246
|
for (let rep = 0; rep < fullReps; rep++) {
|
|
1256
2247
|
const distFromBoundary = fullReps - 1 - rep;
|
|
1257
|
-
const isReversed =
|
|
2248
|
+
const isReversed = loop.direction === PxLoopDirection.alternate && distFromBoundary % 2 === 0;
|
|
1258
2249
|
const repStart = fillStart + remainder + rep * segDuration;
|
|
1259
2250
|
appendRep(repStart, isReversed);
|
|
1260
2251
|
}
|
|
1261
2252
|
} else {
|
|
1262
2253
|
for (let rep = 0; rep < fullReps; rep++) {
|
|
1263
|
-
const isReversed =
|
|
2254
|
+
const isReversed = loop.direction === PxLoopDirection.alternate && rep % 2 === 0;
|
|
1264
2255
|
const repStart = fillStart + rep * segDuration;
|
|
1265
2256
|
appendRep(repStart, isReversed);
|
|
1266
2257
|
}
|
|
1267
2258
|
if (partialFraction > 1e-9) {
|
|
1268
|
-
const isReversed =
|
|
2259
|
+
const isReversed = loop.direction === PxLoopDirection.alternate && fullReps % 2 === 0;
|
|
1269
2260
|
const repStart = fillStart + fullReps * segDuration;
|
|
1270
2261
|
appendRep(repStart, isReversed, partialFraction);
|
|
1271
2262
|
}
|
|
1272
2263
|
}
|
|
1273
|
-
if (loop.
|
|
2264
|
+
if (loop.repeatAt === PxLoopRepeatAt.start) {
|
|
1274
2265
|
return [...looped, ...keyframes];
|
|
1275
2266
|
} else {
|
|
1276
2267
|
if (hasTerminalEasingOverride && keyframes.length > 0) {
|
|
@@ -1282,34 +2273,34 @@ var PixodeskAnimator = (() => {
|
|
|
1282
2273
|
}
|
|
1283
2274
|
}
|
|
1284
2275
|
function normalizeKeyframes(propName, propAnim, duration, defs) {
|
|
1285
|
-
var _a
|
|
1286
|
-
const keyframes = propAnim.keyframes ||
|
|
2276
|
+
var _a;
|
|
2277
|
+
const keyframes = propAnim.keyframes || [];
|
|
1287
2278
|
const normalized = [];
|
|
1288
2279
|
for (const kf of keyframes) {
|
|
1289
|
-
const timePct = (
|
|
1290
|
-
let value = (
|
|
1291
|
-
const easing = (
|
|
2280
|
+
const timePct = kfTime(kf);
|
|
2281
|
+
let value = kfValue(kf);
|
|
2282
|
+
const easing = kfEasing(kf);
|
|
1292
2283
|
if (propName === "d") {
|
|
1293
2284
|
value = normalizePathValue(value);
|
|
1294
2285
|
}
|
|
1295
2286
|
const propNameKebab = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
|
|
1296
2287
|
if (COLOUR_ATTR_NAMES.has(propNameKebab)) {
|
|
1297
|
-
value = (
|
|
2288
|
+
value = (_a = parseColor(value)) != null ? _a : value;
|
|
1298
2289
|
}
|
|
1299
2290
|
const normKf = {
|
|
1300
2291
|
t: timePct,
|
|
1301
2292
|
v: value,
|
|
1302
2293
|
e: resolveEasing(easing, defs)
|
|
1303
2294
|
};
|
|
1304
|
-
const tIn = (
|
|
1305
|
-
const tOut = (
|
|
2295
|
+
const tIn = kfTangentIn(kf);
|
|
2296
|
+
const tOut = kfTangentOut(kf);
|
|
1306
2297
|
if (tIn) normKf.tangentIn = tIn;
|
|
1307
2298
|
if (tOut) normKf.tangentOut = tOut;
|
|
1308
2299
|
normalized.push(normKf);
|
|
1309
2300
|
}
|
|
1310
2301
|
normalized.sort((a, b) => {
|
|
1311
|
-
var _a2,
|
|
1312
|
-
return ((_a2 = a.t) != null ? _a2 : 0) - ((
|
|
2302
|
+
var _a2, _b;
|
|
2303
|
+
return ((_a2 = a.t) != null ? _a2 : 0) - ((_b = b.t) != null ? _b : 0);
|
|
1313
2304
|
});
|
|
1314
2305
|
const loopRaw = propAnim.loop;
|
|
1315
2306
|
const loop = loopRaw === true ? {} : loopRaw || void 0;
|
|
@@ -1331,7 +2322,37 @@ var PixodeskAnimator = (() => {
|
|
|
1331
2322
|
function generateElementId() {
|
|
1332
2323
|
return "_px_el_" + ++_elementIdCounter;
|
|
1333
2324
|
}
|
|
1334
|
-
function
|
|
2325
|
+
function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
|
|
2326
|
+
if (!animDef) return animDef;
|
|
2327
|
+
const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
|
|
2328
|
+
if (!staticParts || !Object.keys(staticParts).length) return animDef;
|
|
2329
|
+
const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues(__spreadValues({}, staticParts), v) : v;
|
|
2330
|
+
const transformAnim = animDef[TRANSFORM_ATTR];
|
|
2331
|
+
if (transformAnim && typeof transformAnim === "object") {
|
|
2332
|
+
const anim = transformAnim;
|
|
2333
|
+
if (Array.isArray(anim.keyframes)) {
|
|
2334
|
+
const out = __spreadProps(__spreadValues({}, anim), {
|
|
2335
|
+
keyframes: anim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: mergeKfValue(kf.value) }))
|
|
2336
|
+
});
|
|
2337
|
+
if (out.value !== void 0) out.value = mergeKfValue(out.value);
|
|
2338
|
+
return __spreadProps(__spreadValues({}, animDef), { transform: out });
|
|
2339
|
+
}
|
|
2340
|
+
return animDef;
|
|
2341
|
+
}
|
|
2342
|
+
const channels = Object.keys(animDef).filter((k) => TRANSFORM_FN_NAMES.has(k));
|
|
2343
|
+
if (channels.length !== 1) return animDef;
|
|
2344
|
+
const ch = channels[0];
|
|
2345
|
+
const chAnim = animDef[ch];
|
|
2346
|
+
if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
|
|
2347
|
+
const lifted = __spreadProps(__spreadValues({}, chAnim), {
|
|
2348
|
+
keyframes: chAnim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: __spreadProps(__spreadValues({}, staticParts), { [ch]: kf.value }) }))
|
|
2349
|
+
});
|
|
2350
|
+
if (lifted.value !== void 0) lifted.value = __spreadProps(__spreadValues({}, staticParts), { [ch]: lifted.value });
|
|
2351
|
+
const rest = __spreadValues({}, animDef);
|
|
2352
|
+
delete rest[ch];
|
|
2353
|
+
return __spreadProps(__spreadValues({}, rest), { transform: lifted });
|
|
2354
|
+
}
|
|
2355
|
+
function normalizeAnimationDefinition(animDef, duration, defs, engine = PxTimelineEngine.native) {
|
|
1335
2356
|
const normalized = {};
|
|
1336
2357
|
for (const [propName, propAnim] of Object.entries(animDef)) {
|
|
1337
2358
|
if (propName === "transform" && propAnim.alongPathMode === "offsetPath" && animDef["offsetDistance"] !== void 0) {
|
|
@@ -1339,24 +2360,24 @@ var PixodeskAnimator = (() => {
|
|
|
1339
2360
|
}
|
|
1340
2361
|
const normalizedKfs = normalizeKeyframes(propName, propAnim, duration, defs);
|
|
1341
2362
|
if (normalizedKfs.length > 0) {
|
|
1342
|
-
const out = {
|
|
2363
|
+
const out = { keyframes: normalizedKfs };
|
|
1343
2364
|
if (propAnim.autoOrient !== void 0) out.autoOrient = propAnim.autoOrient;
|
|
1344
2365
|
if (propAnim.loop !== void 0) out.loop = propAnim.loop;
|
|
1345
|
-
normalized[propName] = engine ===
|
|
2366
|
+
normalized[propName] = engine === PxTimelineEngine.native && propName === "transform" ? materialiseMotionPathInPropAnim(out) : out;
|
|
1346
2367
|
}
|
|
1347
2368
|
}
|
|
1348
2369
|
return normalized;
|
|
1349
2370
|
}
|
|
1350
|
-
function getNormalisedBindings(doc, engine =
|
|
2371
|
+
function getNormalisedBindings(doc, engine = PxTimelineEngine.native) {
|
|
1351
2372
|
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
1352
2373
|
const defs = getDefs(doc);
|
|
1353
2374
|
const duration = animatorConfig.duration || 1e3;
|
|
1354
2375
|
const bindings = [];
|
|
1355
|
-
const processAnimation = (id, animate) => {
|
|
2376
|
+
const processAnimation = (id, animate, staticTransform) => {
|
|
1356
2377
|
if (!animate) return null;
|
|
1357
2378
|
const animDefs = resolveElementAnimation(animate, defs);
|
|
1358
2379
|
if (animDefs.length === 0) return null;
|
|
1359
|
-
const merged = mergeAnimationDefinitions(animDefs);
|
|
2380
|
+
const merged = mergeStaticTransformIntoAnimDef(mergeAnimationDefinitions(animDefs), staticTransform);
|
|
1360
2381
|
const normalizedAnim = normalizeAnimationDefinition(merged, duration, defs, engine);
|
|
1361
2382
|
if (Object.keys(normalizedAnim).length === 0) return null;
|
|
1362
2383
|
return {
|
|
@@ -1376,7 +2397,7 @@ var PixodeskAnimator = (() => {
|
|
|
1376
2397
|
if (inlineAnim && Object.keys(inlineAnim).length > 0) {
|
|
1377
2398
|
const nodeId = node.id || generateElementId();
|
|
1378
2399
|
node.id = nodeId;
|
|
1379
|
-
const normalized = processAnimation(nodeId, inlineAnim);
|
|
2400
|
+
const normalized = processAnimation(nodeId, inlineAnim, node.transform);
|
|
1380
2401
|
if (normalized) bindings.push(normalized);
|
|
1381
2402
|
}
|
|
1382
2403
|
if (node.children) {
|
|
@@ -1413,13 +2434,13 @@ var PixodeskAnimator = (() => {
|
|
|
1413
2434
|
return { prevKf, nextKf };
|
|
1414
2435
|
}
|
|
1415
2436
|
function calcPropertyValue(propName, propAnim, progress) {
|
|
1416
|
-
var _a, _b, _c, _d
|
|
1417
|
-
const keyframes = propAnim.
|
|
2437
|
+
var _a, _b, _c, _d;
|
|
2438
|
+
const keyframes = propAnim.keyframes || [];
|
|
1418
2439
|
if (keyframes.length === 0) return null;
|
|
1419
2440
|
const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
|
|
1420
2441
|
let localProgress = prevKf === nextKf ? 0 : remap(progress, (_a = prevKf.t) != null ? _a : 0, (_b = nextKf.t) != null ? _b : 0, 0, 1);
|
|
1421
2442
|
localProgress = clamp(localProgress, 0, 1);
|
|
1422
|
-
const easing = (
|
|
2443
|
+
const easing = kfEasing(prevKf);
|
|
1423
2444
|
if (easing && Array.isArray(easing)) {
|
|
1424
2445
|
try {
|
|
1425
2446
|
localProgress = cubicBezier(easing)(localProgress);
|
|
@@ -1428,11 +2449,11 @@ var PixodeskAnimator = (() => {
|
|
|
1428
2449
|
}
|
|
1429
2450
|
let cssAttrName = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
|
|
1430
2451
|
let cssValue = null;
|
|
1431
|
-
const prevV =
|
|
1432
|
-
const nextV =
|
|
2452
|
+
const prevV = prevKf == null ? void 0 : prevKf.v;
|
|
2453
|
+
const nextV = nextKf == null ? void 0 : nextKf.v;
|
|
1433
2454
|
if (cssAttrName === "d") {
|
|
1434
|
-
const prevPaths = (
|
|
1435
|
-
const nextPaths = (
|
|
2455
|
+
const prevPaths = (_c = prevV == null ? void 0 : prevV.paths) != null ? _c : Array.isArray(prevV) ? prevV : [];
|
|
2456
|
+
const nextPaths = (_d = nextV == null ? void 0 : nextV.paths) != null ? _d : Array.isArray(nextV) ? nextV : [];
|
|
1436
2457
|
cssValue = interpolateBeziers(
|
|
1437
2458
|
prevPaths,
|
|
1438
2459
|
nextPaths,
|
|
@@ -1535,7 +2556,7 @@ var PixodeskAnimator = (() => {
|
|
|
1535
2556
|
return result;
|
|
1536
2557
|
}
|
|
1537
2558
|
|
|
1538
|
-
// ../svg-animator-core/src/PxFrameLoop.ts
|
|
2559
|
+
// ../svg-animator-core/src/playback/PxFrameLoop.ts
|
|
1539
2560
|
function requestFrame(cb) {
|
|
1540
2561
|
const g = globalThis;
|
|
1541
2562
|
if (typeof g.requestAnimationFrame === "function") return g.requestAnimationFrame(cb);
|
|
@@ -1552,7 +2573,7 @@ var PixodeskAnimator = (() => {
|
|
|
1552
2573
|
function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
|
|
1553
2574
|
var _a;
|
|
1554
2575
|
const config = getAnimatorConfig(doc) || {};
|
|
1555
|
-
const bindings = getNormalisedBindings(doc,
|
|
2576
|
+
const bindings = getNormalisedBindings(doc, PxTimelineEngine.js);
|
|
1556
2577
|
const _iterations = config.iterations;
|
|
1557
2578
|
let iterations = 1;
|
|
1558
2579
|
if (typeof _iterations === "number") iterations = _iterations || 1;
|
|
@@ -1813,7 +2834,7 @@ var PixodeskAnimator = (() => {
|
|
|
1813
2834
|
return api;
|
|
1814
2835
|
}
|
|
1815
2836
|
|
|
1816
|
-
// src/PxAnimatorTriggers.ts
|
|
2837
|
+
// src/triggers/PxAnimatorTriggers.ts
|
|
1817
2838
|
function setupAnimationTriggers(api, config) {
|
|
1818
2839
|
const { startOn, outAction = "continue", scrollIntoViewThreshold = 0 } = config;
|
|
1819
2840
|
const root = api.getRootElement();
|
|
@@ -1918,7 +2939,7 @@ var PixodeskAnimator = (() => {
|
|
|
1918
2939
|
return api;
|
|
1919
2940
|
}
|
|
1920
2941
|
|
|
1921
|
-
// src/PxAnimatorFrameLoop.ts
|
|
2942
|
+
// src/engines/PxAnimatorFrameLoop.ts
|
|
1922
2943
|
function getSelector(id) {
|
|
1923
2944
|
return "#" + id;
|
|
1924
2945
|
}
|
|
@@ -1978,11 +2999,10 @@ var PixodeskAnimator = (() => {
|
|
|
1978
2999
|
return adapter;
|
|
1979
3000
|
}
|
|
1980
3001
|
|
|
1981
|
-
// src/PxAnimatorWebApi.ts
|
|
3002
|
+
// src/engines/PxAnimatorWebApi.ts
|
|
1982
3003
|
function createCssKf(kf, t, propName, unsupportedSet) {
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
const e = (_b = kf.e) != null ? _b : kf.easing;
|
|
3004
|
+
let value = kfValue(kf);
|
|
3005
|
+
const e = kfEasing(kf);
|
|
1986
3006
|
const cssKf = {
|
|
1987
3007
|
offset: t,
|
|
1988
3008
|
easing: e && Array.isArray(e) ? "cubic-bezier(" + e.join(",") + ")" : void 0
|
|
@@ -2053,7 +3073,7 @@ var PixodeskAnimator = (() => {
|
|
|
2053
3073
|
const result = /* @__PURE__ */ new Map();
|
|
2054
3074
|
for (const [propName, propAnim] of Object.entries(animDef)) {
|
|
2055
3075
|
const duration = config.duration || 1;
|
|
2056
|
-
const clippedKeyframes = clipKeyframesToDuration(propName, propAnim.
|
|
3076
|
+
const clippedKeyframes = clipKeyframesToDuration(propName, propAnim.keyframes || [], duration);
|
|
2057
3077
|
const cssKeyframes = [];
|
|
2058
3078
|
for (let i = 0; i < clippedKeyframes.length; i++) {
|
|
2059
3079
|
const kf = clippedKeyframes[i];
|
|
@@ -2087,7 +3107,7 @@ var PixodeskAnimator = (() => {
|
|
|
2087
3107
|
console.warn("createFrameLoopAnimator: No root element provided");
|
|
2088
3108
|
}
|
|
2089
3109
|
}
|
|
2090
|
-
const bindings = getNormalisedBindings(doc,
|
|
3110
|
+
const bindings = getNormalisedBindings(doc, PxTimelineEngine.native);
|
|
2091
3111
|
const animations = [];
|
|
2092
3112
|
const _iterations = config.iterations;
|
|
2093
3113
|
let iterations;
|
|
@@ -2245,7 +3265,7 @@ var PixodeskAnimator = (() => {
|
|
|
2245
3265
|
return api;
|
|
2246
3266
|
}
|
|
2247
3267
|
|
|
2248
|
-
// src/PxScrollDriver.ts
|
|
3268
|
+
// src/scroll/PxScrollDriver.ts
|
|
2249
3269
|
function nativeRangeOffset(point, defaultFraction, view) {
|
|
2250
3270
|
var _a, _b, _c;
|
|
2251
3271
|
const fraction = typeof (point == null ? void 0 : point.fraction) === "number" ? point.fraction : defaultFraction;
|
|
@@ -2259,7 +3279,7 @@ var PixodeskAnimator = (() => {
|
|
|
2259
3279
|
const scroll = config.scroll || {};
|
|
2260
3280
|
const kind = (_a = scroll.kind) != null ? _a : "view";
|
|
2261
3281
|
if (scroll.smoothing) {
|
|
2262
|
-
console.warn(
|
|
3282
|
+
console.warn("scroll timeline: `smoothing` needs the built-in driver \u2014 using the built-in driver instead of the browser timeline");
|
|
2263
3283
|
return null;
|
|
2264
3284
|
}
|
|
2265
3285
|
const g = globalThis;
|
|
@@ -2276,7 +3296,7 @@ var PixodeskAnimator = (() => {
|
|
|
2276
3296
|
timeline = new Ctor({ source, axis });
|
|
2277
3297
|
}
|
|
2278
3298
|
} catch (e) {
|
|
2279
|
-
console.warn("scroll timeline: native timeline construction failed \u2014 falling back to the
|
|
3299
|
+
console.warn("scroll timeline: native timeline construction failed \u2014 falling back to the player measuring progress itself", e);
|
|
2280
3300
|
return null;
|
|
2281
3301
|
}
|
|
2282
3302
|
return {
|
|
@@ -2495,7 +3515,7 @@ var PixodeskAnimator = (() => {
|
|
|
2495
3515
|
};
|
|
2496
3516
|
}
|
|
2497
3517
|
|
|
2498
|
-
// src/PxAnimatorBind.ts
|
|
3518
|
+
// src/engines/PxAnimatorBind.ts
|
|
2499
3519
|
function finaliseAnimator(animatorConfig, callbacks, make) {
|
|
2500
3520
|
let apiRef;
|
|
2501
3521
|
let effectiveCallbacks = callbacks;
|
|
@@ -2510,8 +3530,8 @@ var PixodeskAnimator = (() => {
|
|
|
2510
3530
|
}
|
|
2511
3531
|
const res = make(effectiveCallbacks);
|
|
2512
3532
|
apiRef = res;
|
|
2513
|
-
if (animatorConfig.
|
|
2514
|
-
window[animatorConfig.
|
|
3533
|
+
if (animatorConfig.debugGlobalName) {
|
|
3534
|
+
window[animatorConfig.debugGlobalName] = res;
|
|
2515
3535
|
}
|
|
2516
3536
|
return res;
|
|
2517
3537
|
}
|
|
@@ -2519,10 +3539,10 @@ var PixodeskAnimator = (() => {
|
|
|
2519
3539
|
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
2520
3540
|
if (isScrollTimeline(animatorConfig)) {
|
|
2521
3541
|
return finaliseAnimator(animatorConfig, callbacks, (cb) => {
|
|
2522
|
-
var _a
|
|
3542
|
+
var _a;
|
|
2523
3543
|
let unpin = () => {
|
|
2524
3544
|
};
|
|
2525
|
-
if (
|
|
3545
|
+
if (mayUseNativeScrollTimeline(animatorConfig.engine) && rootElement) {
|
|
2526
3546
|
unpin = applyScrollPin(rootElement, animatorConfig.scroll);
|
|
2527
3547
|
const native = createNativeScrollTimeline(rootElement, animatorConfig);
|
|
2528
3548
|
if (native) {
|
|
@@ -2530,7 +3550,7 @@ var PixodeskAnimator = (() => {
|
|
|
2530
3550
|
doc,
|
|
2531
3551
|
cb,
|
|
2532
3552
|
rootElement,
|
|
2533
|
-
animatorConfig.
|
|
3553
|
+
isNativeForced(animatorConfig.engine),
|
|
2534
3554
|
native
|
|
2535
3555
|
);
|
|
2536
3556
|
if (api2) {
|
|
@@ -2546,8 +3566,8 @@ var PixodeskAnimator = (() => {
|
|
|
2546
3566
|
unpin = () => {
|
|
2547
3567
|
};
|
|
2548
3568
|
}
|
|
2549
|
-
const api = (animatorConfig.
|
|
2550
|
-
const subject = ((
|
|
3569
|
+
const api = (animatorConfig.engine !== PxTimelineEngineExtra.js ? createWebApiAnimator(doc, cb, rootElement, isNativeForced(animatorConfig.engine)) : null) || createFrameLoopAnimator(doc, adapter, cb, rootElement);
|
|
3570
|
+
const subject = ((_a = api.getRootElement) == null ? void 0 : _a.call(api)) || rootElement;
|
|
2551
3571
|
if (subject) {
|
|
2552
3572
|
unpin = applyScrollPin(subject, animatorConfig.scroll);
|
|
2553
3573
|
const totalMs = scrollTotalDurationMs(animatorConfig);
|
|
@@ -2571,15 +3591,14 @@ var PixodeskAnimator = (() => {
|
|
|
2571
3591
|
});
|
|
2572
3592
|
}
|
|
2573
3593
|
return finaliseAnimator(animatorConfig, callbacks, (cb) => {
|
|
2574
|
-
if (animatorConfig.
|
|
3594
|
+
if (animatorConfig.engine === PxTimelineEngineExtra.js) {
|
|
2575
3595
|
return createFrameLoopAnimator(doc, adapter, cb, rootElement);
|
|
2576
3596
|
}
|
|
2577
3597
|
return createWebApiAnimator(
|
|
2578
3598
|
doc,
|
|
2579
3599
|
cb,
|
|
2580
3600
|
rootElement,
|
|
2581
|
-
animatorConfig.
|
|
2582
|
-
// forcing waapi
|
|
3601
|
+
isNativeForced(animatorConfig.engine)
|
|
2583
3602
|
) || createFrameLoopAnimator(doc, adapter, cb, rootElement);
|
|
2584
3603
|
});
|
|
2585
3604
|
}
|
|
@@ -2591,7 +3610,7 @@ var PixodeskAnimator = (() => {
|
|
|
2591
3610
|
return bindWithEngineChoice(requireData(options), options.adapter, options.callbacks, null);
|
|
2592
3611
|
}
|
|
2593
3612
|
|
|
2594
|
-
// src/PxAnimatorKeys.ts
|
|
3613
|
+
// src/shared/PxAnimatorKeys.ts
|
|
2595
3614
|
var PX_ANIMATOR_DATA_KEY = "data";
|
|
2596
3615
|
return __toCommonJS(index_prerendered_exports);
|
|
2597
3616
|
})();
|