@pixodesk/svg-animator-core 1.0.40 → 1.0.43
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 +58 -13
- package/dist/{internal-BZSJtt_h.d.ts → PxDocumentDiagnostic-DkBZYJ7X.d.cts} +227 -462
- package/dist/{internal-BZSJtt_h.d.cts → PxDocumentDiagnostic-DkBZYJ7X.d.ts} +227 -462
- package/dist/{chunk-PAE3NF2U.js → chunk-BOTZI36B.js} +183 -580
- package/dist/chunk-BOTZI36B.js.map +1 -0
- package/dist/chunk-CAZFG2HW.min.js +1 -0
- package/dist/index.cjs +240 -926
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +117 -175
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/dist/internal.cjs +93 -91
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +378 -1
- package/dist/internal.d.ts +378 -1
- package/dist/internal.js +413 -34
- package/dist/internal.js.map +1 -1
- package/dist/internal.min.cjs +1 -1
- package/dist/internal.min.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-PAE3NF2U.js.map +0 -1
- package/dist/chunk-WIVGJ5YO.min.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -50,22 +50,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
50
50
|
// src/index.ts
|
|
51
51
|
var index_exports = {};
|
|
52
52
|
__export(index_exports, {
|
|
53
|
-
BASELINE_PLAYER_VERSION: () => BASELINE_PLAYER_VERSION,
|
|
54
|
-
COLOR_ATTR_NAMES: () => COLOR_ATTR_NAMES,
|
|
55
|
-
CSS_ONLY_STYLE_PROPS: () => CSS_ONLY_STYLE_PROPS,
|
|
56
|
-
DEFAULT_DURATION_MS: () => DEFAULT_DURATION_MS,
|
|
57
|
-
DISALLOWED_SVG_TAGS_LOWER: () => DISALLOWED_SVG_TAGS_LOWER,
|
|
58
|
-
LOOP_JUMP_SHIFT_MS: () => LOOP_JUMP_SHIFT_MS,
|
|
59
|
-
PCT_BASED_ATTR_NAMES: () => PCT_BASED_ATTR_NAMES,
|
|
60
|
-
PLAYER_WIRE_STEPS: () => PLAYER_WIRE_STEPS,
|
|
61
|
-
PLAYER_WIRE_VERSION: () => PLAYER_WIRE_VERSION,
|
|
62
|
-
PX_ANIM_ATTR_NAME: () => PX_ANIM_ATTR_NAME,
|
|
63
|
-
PX_ANIM_SRC_ATTR_NAME: () => PX_ANIM_SRC_ATTR_NAME,
|
|
64
|
-
PX_PLAYER_SCHEMA_VERSION: () => PX_PLAYER_SCHEMA_VERSION,
|
|
65
53
|
PX_RATE_REJECTED: () => PX_RATE_REJECTED,
|
|
66
54
|
PX_TRANSFORM_PART_KEYS: () => PX_TRANSFORM_PART_KEYS,
|
|
67
55
|
PX_TRIGGER_DEFAULTS: () => PX_TRIGGER_DEFAULTS,
|
|
68
|
-
|
|
56
|
+
PX_WIRE_BASELINE_VERSION: () => PX_WIRE_BASELINE_VERSION,
|
|
57
|
+
PX_WIRE_SCHEMA_VERSION: () => PX_WIRE_SCHEMA_VERSION,
|
|
58
|
+
PX_WIRE_STEPS: () => PX_WIRE_STEPS,
|
|
59
|
+
PX_WIRE_VERSION: () => PX_WIRE_VERSION,
|
|
60
|
+
PX_WIRE_VERSION_KEY: () => PX_WIRE_VERSION_KEY,
|
|
69
61
|
PxAlongPathMode: () => PxAlongPathMode,
|
|
70
62
|
PxAnimatedSvgDocumentSchema: () => PxAnimatedSvgDocumentSchema,
|
|
71
63
|
PxAnimatorConfigSchema: () => PxAnimatorConfigSchema,
|
|
@@ -75,7 +67,8 @@ __export(index_exports, {
|
|
|
75
67
|
PxCloneEffectSchema: () => PxCloneEffectSchema,
|
|
76
68
|
PxCloneWithout: () => PxCloneWithout,
|
|
77
69
|
PxControlMode: () => PxControlMode,
|
|
78
|
-
|
|
70
|
+
PxDefinitionsSchema: () => PxDefinitionsSchema,
|
|
71
|
+
PxDiagnosticCode: () => PxDiagnosticCode,
|
|
79
72
|
PxDiagnosticKind: () => PxDiagnosticKind,
|
|
80
73
|
PxEffectsSchema: () => PxEffectsSchema,
|
|
81
74
|
PxElementAnimationSchema: () => PxElementAnimationSchema,
|
|
@@ -93,7 +86,7 @@ __export(index_exports, {
|
|
|
93
86
|
PxLoopSchema: () => PxLoopSchema,
|
|
94
87
|
PxMaskType: () => PxMaskType,
|
|
95
88
|
PxMaskedByEffectSchema: () => PxMaskedByEffectSchema,
|
|
96
|
-
|
|
89
|
+
PxNodeBaseSchema: () => PxNodeBaseSchema,
|
|
97
90
|
PxNodeSchema: () => PxNodeSchema,
|
|
98
91
|
PxOutAction: () => PxOutAction,
|
|
99
92
|
PxPathOverflow: () => PxPathOverflow,
|
|
@@ -112,106 +105,66 @@ __export(index_exports, {
|
|
|
112
105
|
PxStartOn: () => PxStartOn,
|
|
113
106
|
PxStrokeTrimEffectSchema: () => PxStrokeTrimEffectSchema,
|
|
114
107
|
PxStrokeTrimSubPaths: () => PxStrokeTrimSubPaths,
|
|
115
|
-
|
|
108
|
+
PxSvgNodeRootSchema: () => PxSvgNodeRootSchema,
|
|
116
109
|
PxTextEffectSchema: () => PxTextEffectSchema,
|
|
117
110
|
PxTextPathEffectSchema: () => PxTextPathEffectSchema,
|
|
118
111
|
PxTextPathMethod: () => PxTextPathMethod,
|
|
119
112
|
PxTextPathSpacing: () => PxTextPathSpacing,
|
|
120
113
|
PxTimelineEngine: () => PxTimelineEngine,
|
|
121
|
-
|
|
114
|
+
PxTimelineEngineSetting: () => PxTimelineEngineSetting,
|
|
122
115
|
PxTimelineSchema: () => PxTimelineSchema,
|
|
123
116
|
PxTransformByEffectSchema: () => PxTransformByEffectSchema,
|
|
124
117
|
PxTransformPartsSchema: () => PxTransformPartsSchema,
|
|
125
118
|
PxTransformValueSchema: () => PxTransformValueSchema,
|
|
126
119
|
PxTriggerSchema: () => PxTriggerSchema,
|
|
127
120
|
PxUnits: () => PxUnits,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
TRANSFORM_FN_NAMES: () => TRANSFORM_FN_NAMES,
|
|
131
|
-
WIRE_VERSION_KEY: () => WIRE_VERSION_KEY,
|
|
132
|
-
WireStepKind: () => WireStepKind,
|
|
133
|
-
WireVersionRelation: () => WireVersionRelation,
|
|
121
|
+
PxWireStepKind: () => PxWireStepKind,
|
|
122
|
+
PxWireVersionRelation: () => PxWireVersionRelation,
|
|
134
123
|
applyAnimatorConfig: () => applyAnimatorConfig,
|
|
135
|
-
applyPlayerEffects: () => applyPlayerEffects,
|
|
136
124
|
applyWireSteps: () => applyWireSteps,
|
|
137
|
-
bezierToSvgPath: () => bezierToSvgPath,
|
|
138
125
|
calcAnimationValues: () => calcAnimationValues,
|
|
139
|
-
camelCaseToKebabWordIfNeeded: () => camelCaseToKebabWordIfNeeded,
|
|
140
|
-
clamp: () => clamp,
|
|
141
126
|
clampSeekMs: () => clampSeekMs,
|
|
142
127
|
compareWireVersion: () => compareWireVersion,
|
|
143
|
-
composeTransformParts: () => composeTransformParts,
|
|
144
128
|
controlModeTakesOverTrigger: () => controlModeTakesOverTrigger,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
createDiagnostics: () => createDiagnostics,
|
|
148
|
-
createPathSampler: () => createPathSampler,
|
|
129
|
+
convertWireDocument: () => convertWireDocument,
|
|
130
|
+
createAdapterAnimator: () => createAdapterAnimator,
|
|
149
131
|
createRunClock: () => createRunClock,
|
|
150
|
-
cubicBezier: () => cubicBezier,
|
|
151
|
-
deepClone: () => deepClone,
|
|
152
132
|
describeSchema: () => describeSchema,
|
|
153
133
|
diagnoseDocument: () => diagnoseDocument,
|
|
154
|
-
|
|
155
|
-
diffInEffect: () => diffInEffect,
|
|
156
|
-
downgradePlayerDocument: () => downgradePlayerDocument,
|
|
157
|
-
extendedPathForBrowser: () => extendedPathForBrowser,
|
|
134
|
+
downgradeWireDocument: () => downgradeWireDocument,
|
|
158
135
|
flattenAnimatorTimeline: () => flattenAnimatorTimeline,
|
|
159
136
|
foldTimelineOverride: () => foldTimelineOverride,
|
|
160
137
|
formatWireVersion: () => formatWireVersion,
|
|
161
138
|
generateNewIds: () => generateNewIds,
|
|
162
|
-
generateUniqueId: () => generateUniqueId,
|
|
163
139
|
getAnimatorConfig: () => getAnimatorConfig,
|
|
164
140
|
getBindings: () => getBindings,
|
|
165
141
|
getChildren: () => getChildren,
|
|
166
|
-
|
|
167
|
-
getNormalizedBindings: () => getNormalizedBindings,
|
|
168
|
-
getNormalizedProps: () => getNormalizedProps,
|
|
169
|
-
interpolateValue: () => interpolateValue,
|
|
142
|
+
getDefinitions: () => getDefinitions,
|
|
170
143
|
isNativeForced: () => isNativeForced,
|
|
171
|
-
|
|
172
|
-
isPxElementFileFormatDeep: () => isPxElementFileFormatDeep,
|
|
173
|
-
isScrollTimeline: () => isScrollTimeline,
|
|
144
|
+
isPxDocument: () => isPxDocument,
|
|
174
145
|
isValidPlaybackRate: () => isValidPlaybackRate,
|
|
175
|
-
|
|
176
|
-
kfEasing: () => kfEasing,
|
|
177
|
-
kfValue: () => kfValue,
|
|
178
|
-
layoutGlyphTextChars: () => layoutGlyphTextChars,
|
|
146
|
+
isValidPxDocument: () => isValidPxDocument,
|
|
179
147
|
materializeAllInTree: () => materializeAllInTree,
|
|
180
|
-
|
|
181
|
-
materializeGlyphTextAlongPath: () => materializeGlyphTextAlongPath,
|
|
182
|
-
materializeMotionPathInPropAnim: () => materializeMotionPathInPropAnim,
|
|
148
|
+
materializeNodeEffects: () => materializeNodeEffects,
|
|
183
149
|
mayUseNativeScrollTimeline: () => mayUseNativeScrollTimeline,
|
|
184
150
|
mergeAnimatorConfig: () => mergeAnimatorConfig,
|
|
185
|
-
mergeStaticTransformIntoAnimDef: () => mergeStaticTransformIntoAnimDef,
|
|
186
151
|
nestAnimatorTimeline: () => nestAnimatorTimeline,
|
|
152
|
+
normalizeBindings: () => normalizeBindings,
|
|
187
153
|
parseWireVersion: () => parseWireVersion,
|
|
188
|
-
planSchemaRelease: () => planSchemaRelease,
|
|
189
154
|
progressSpanMs: () => progressSpanMs,
|
|
190
155
|
progressToTimeMs: () => progressToTimeMs,
|
|
191
156
|
px: () => px,
|
|
192
157
|
readWireVersion: () => readWireVersion,
|
|
193
|
-
releaseLogProblems: () => releaseLogProblems,
|
|
194
|
-
reportDocumentDiagnostics: () => reportDocumentDiagnostics,
|
|
195
158
|
resolveControlMode: () => resolveControlMode,
|
|
196
159
|
resolveTimelineEngine: () => resolveTimelineEngine,
|
|
197
160
|
resolveTrigger: () => resolveTrigger,
|
|
198
|
-
reverseEasing: () => reverseEasing,
|
|
199
|
-
sanitizeAttributeValue: () => sanitizeAttributeValue,
|
|
200
|
-
schemaFieldUniverse: () => schemaFieldUniverse,
|
|
201
161
|
schemaKeys: () => schemaKeys,
|
|
202
|
-
scrollOffsetProgress: () => scrollOffsetProgress,
|
|
203
|
-
scrollPhaseInterval: () => scrollPhaseInterval,
|
|
204
|
-
scrollResolveAxis: () => scrollResolveAxis,
|
|
205
|
-
scrollTotalDurationMs: () => scrollTotalDurationMs,
|
|
206
|
-
scrollViewProgress: () => scrollViewProgress,
|
|
207
162
|
seekCeilingMs: () => seekCeilingMs,
|
|
208
|
-
splitEasing: () => splitEasing,
|
|
209
|
-
subdivideCubicBezier: () => subdivideCubicBezier,
|
|
210
163
|
timeToProgress: () => timeToProgress,
|
|
211
|
-
|
|
164
|
+
toDomProps: () => toDomProps,
|
|
212
165
|
validateDocument: () => validateDocument,
|
|
213
166
|
validateNodeEffects: () => validateNodeEffects,
|
|
214
|
-
|
|
167
|
+
wireVersionAdvice: () => wireVersionAdvice
|
|
215
168
|
});
|
|
216
169
|
module.exports = __toCommonJS(index_exports);
|
|
217
170
|
|
|
@@ -729,7 +682,7 @@ var px = {
|
|
|
729
682
|
* The base can be the result of px.object() or px.openObject() — anything with a _shape property.
|
|
730
683
|
*
|
|
731
684
|
* @example
|
|
732
|
-
* const PxSvgNodeSchema = px.extendedObject(
|
|
685
|
+
* const PxSvgNodeSchema = px.extendedObject(PxNodeBaseSchema, { width: px.number().optional() });
|
|
733
686
|
*/
|
|
734
687
|
extendedObject: (base, extra) => new Obj(__spreadValues(__spreadValues({}, base._shape), extra)),
|
|
735
688
|
/** Array whose unrecoverable items are filtered out. Default: []. */
|
|
@@ -747,20 +700,20 @@ var px = {
|
|
|
747
700
|
};
|
|
748
701
|
|
|
749
702
|
// src/version/PxSchemaVersion.ts
|
|
750
|
-
var
|
|
703
|
+
var PX_WIRE_SCHEMA_VERSION = "1.1";
|
|
751
704
|
|
|
752
705
|
// src/version/PxWireVersion.ts
|
|
753
|
-
var
|
|
706
|
+
var PX_WIRE_VERSION_KEY = "version";
|
|
754
707
|
var ANIMATOR_KEY = "animator";
|
|
755
708
|
var META_KEY = "meta";
|
|
756
|
-
var
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
return
|
|
763
|
-
})(
|
|
709
|
+
var PxWireVersionRelation = /* @__PURE__ */ ((PxWireVersionRelation2) => {
|
|
710
|
+
PxWireVersionRelation2["unstamped"] = "unstamped";
|
|
711
|
+
PxWireVersionRelation2["same"] = "same";
|
|
712
|
+
PxWireVersionRelation2["older"] = "older";
|
|
713
|
+
PxWireVersionRelation2["newer"] = "newer";
|
|
714
|
+
PxWireVersionRelation2["otherGeneration"] = "otherGeneration";
|
|
715
|
+
return PxWireVersionRelation2;
|
|
716
|
+
})(PxWireVersionRelation || {});
|
|
764
717
|
var VERSION_RE = /^(\d+)\.(\d+)(?:\.(\d+))?$/;
|
|
765
718
|
function parseWireVersion(raw) {
|
|
766
719
|
if (typeof raw !== "string") return void 0;
|
|
@@ -772,7 +725,7 @@ function formatWireVersion(v) {
|
|
|
772
725
|
return v.a + "." + v.b + "." + v.c;
|
|
773
726
|
}
|
|
774
727
|
var _a;
|
|
775
|
-
var
|
|
728
|
+
var PX_WIRE_VERSION = (_a = parseWireVersion(PX_WIRE_SCHEMA_VERSION)) != null ? _a : { a: 1, b: 1, c: 0 };
|
|
776
729
|
function getAnimatorBlock(doc) {
|
|
777
730
|
if (!doc || typeof doc !== "object") return void 0;
|
|
778
731
|
const atRoot = readObjectProp(doc, ANIMATOR_KEY);
|
|
@@ -786,7 +739,7 @@ function readObjectProp(obj, key) {
|
|
|
786
739
|
}
|
|
787
740
|
function readWireVersion(doc) {
|
|
788
741
|
const animator = getAnimatorBlock(doc);
|
|
789
|
-
return animator ? parseWireVersion(animator[
|
|
742
|
+
return animator ? parseWireVersion(animator[PX_WIRE_VERSION_KEY]) : void 0;
|
|
790
743
|
}
|
|
791
744
|
function compareWireVersion(file, mine, readerReadsEditorPart) {
|
|
792
745
|
if (!file) return "unstamped" /* unstamped */;
|
|
@@ -795,7 +748,7 @@ function compareWireVersion(file, mine, readerReadsEditorPart) {
|
|
|
795
748
|
if (!readerReadsEditorPart || file.c === mine.c) return "same" /* same */;
|
|
796
749
|
return file.c > mine.c ? "newer" /* newer */ : "older" /* older */;
|
|
797
750
|
}
|
|
798
|
-
function
|
|
751
|
+
function wireVersionAdvice(relation, file, mine, isPlayer) {
|
|
799
752
|
if (!file) return void 0;
|
|
800
753
|
const target = isPlayer ? "player" : "editor";
|
|
801
754
|
const gap = "written for schema " + formatWireVersion(file) + ", this " + target + " reads " + formatWireVersion(mine);
|
|
@@ -810,13 +763,13 @@ function versionAdvice(relation, file, mine, isPlayer) {
|
|
|
810
763
|
return void 0;
|
|
811
764
|
}
|
|
812
765
|
}
|
|
813
|
-
var
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
return
|
|
817
|
-
})(
|
|
818
|
-
var
|
|
819
|
-
var
|
|
766
|
+
var PxWireStepKind = /* @__PURE__ */ ((PxWireStepKind2) => {
|
|
767
|
+
PxWireStepKind2["additive"] = "additive";
|
|
768
|
+
PxWireStepKind2["converted"] = "converted";
|
|
769
|
+
return PxWireStepKind2;
|
|
770
|
+
})(PxWireStepKind || {});
|
|
771
|
+
var PX_WIRE_BASELINE_VERSION = "1.1";
|
|
772
|
+
var PX_WIRE_STEPS = [];
|
|
820
773
|
function applyWireSteps(doc, cfg) {
|
|
821
774
|
const from = readWireVersion(doc);
|
|
822
775
|
const relation = compareWireVersion(from, cfg.target, cfg.readerReadsEditorPart);
|
|
@@ -826,7 +779,7 @@ function applyWireSteps(doc, cfg) {
|
|
|
826
779
|
from,
|
|
827
780
|
relation,
|
|
828
781
|
applied: [],
|
|
829
|
-
advice:
|
|
782
|
+
advice: wireVersionAdvice(relation, from, cfg.target, !cfg.readerReadsEditorPart)
|
|
830
783
|
};
|
|
831
784
|
}
|
|
832
785
|
const due = [];
|
|
@@ -852,10 +805,10 @@ function applyWireSteps(doc, cfg) {
|
|
|
852
805
|
stampVersion(target, cfg.target, cfg.readerReadsEditorPart);
|
|
853
806
|
return { doc: target, from, relation, applied };
|
|
854
807
|
}
|
|
855
|
-
function
|
|
808
|
+
function convertWireDocument(doc) {
|
|
856
809
|
return applyWireSteps(doc, {
|
|
857
|
-
steps:
|
|
858
|
-
target:
|
|
810
|
+
steps: PX_WIRE_STEPS,
|
|
811
|
+
target: PX_WIRE_VERSION,
|
|
859
812
|
readerReadsEditorPart: false
|
|
860
813
|
});
|
|
861
814
|
}
|
|
@@ -866,8 +819,8 @@ function clonePlain(value) {
|
|
|
866
819
|
function stampVersion(doc, target, readerReadsEditorPart) {
|
|
867
820
|
const animator = getAnimatorBlock(doc);
|
|
868
821
|
if (!animator) return;
|
|
869
|
-
const previous = parseWireVersion(animator[
|
|
870
|
-
animator[
|
|
822
|
+
const previous = parseWireVersion(animator[PX_WIRE_VERSION_KEY]);
|
|
823
|
+
animator[PX_WIRE_VERSION_KEY] = formatWireVersion({
|
|
871
824
|
a: target.a,
|
|
872
825
|
b: target.b,
|
|
873
826
|
c: readerReadsEditorPart ? target.c : previous ? previous.c : 0
|
|
@@ -922,8 +875,8 @@ function applyWireStepsDown(doc, cfg) {
|
|
|
922
875
|
stampVersion(target, cfg.target, cfg.readerReadsEditorPart);
|
|
923
876
|
return { ok: true, doc: target, applied };
|
|
924
877
|
}
|
|
925
|
-
function
|
|
926
|
-
return applyWireStepsDown(doc, { steps:
|
|
878
|
+
function downgradeWireDocument(doc, target) {
|
|
879
|
+
return applyWireStepsDown(doc, { steps: PX_WIRE_STEPS, target, readerReadsEditorPart: false });
|
|
927
880
|
}
|
|
928
881
|
|
|
929
882
|
// src/format/PxAnimatorConstants.ts
|
|
@@ -939,8 +892,6 @@ var PxPlaybackDirection = {
|
|
|
939
892
|
alternate: "alternate",
|
|
940
893
|
alternateReverse: "alternate-reverse"
|
|
941
894
|
};
|
|
942
|
-
var PX_ANIM_SRC_ATTR_NAME = "data-px-animation-src";
|
|
943
|
-
var PX_ANIM_ATTR_NAME = "_px_animator";
|
|
944
895
|
var PxStartOn = {
|
|
945
896
|
load: "load",
|
|
946
897
|
mouseOver: "mouseOver",
|
|
@@ -1003,17 +954,17 @@ var PxTimelineEngine = {
|
|
|
1003
954
|
native: "native",
|
|
1004
955
|
js: "js"
|
|
1005
956
|
};
|
|
1006
|
-
var
|
|
957
|
+
var PxTimelineEngineSetting = __spreadProps(__spreadValues({}, PxTimelineEngine), {
|
|
1007
958
|
auto: "auto"
|
|
1008
959
|
});
|
|
1009
960
|
function resolveTimelineEngine(engine) {
|
|
1010
|
-
return engine ===
|
|
961
|
+
return engine === PxTimelineEngineSetting.js ? PxTimelineEngine.js : PxTimelineEngine.native;
|
|
1011
962
|
}
|
|
1012
963
|
function isNativeForced(engine) {
|
|
1013
|
-
return engine ===
|
|
964
|
+
return engine === PxTimelineEngineSetting.native;
|
|
1014
965
|
}
|
|
1015
966
|
function mayUseNativeScrollTimeline(engine) {
|
|
1016
|
-
return engine !==
|
|
967
|
+
return engine !== PxTimelineEngineSetting.js;
|
|
1017
968
|
}
|
|
1018
969
|
var PX_TRIGGER_DEFAULTS = {
|
|
1019
970
|
startOn: "load",
|
|
@@ -1105,7 +1056,7 @@ var PxStrokeTrimSubPaths = {
|
|
|
1105
1056
|
separate: "separate",
|
|
1106
1057
|
combined: "combined"
|
|
1107
1058
|
};
|
|
1108
|
-
var
|
|
1059
|
+
var PX_TEXT_CONTENT_ATTR = "textContent";
|
|
1109
1060
|
var CLASS_ATTR = "class";
|
|
1110
1061
|
var TRANSFORM_ATTR = "transform";
|
|
1111
1062
|
var OFFSET_DISTANCE_ATTR = "offsetDistance";
|
|
@@ -1116,7 +1067,7 @@ var INTERNAL_ATTRS = /* @__PURE__ */ new Set([
|
|
|
1116
1067
|
"meta",
|
|
1117
1068
|
"animate",
|
|
1118
1069
|
"effects",
|
|
1119
|
-
|
|
1070
|
+
PX_TEXT_CONTENT_ATTR
|
|
1120
1071
|
]);
|
|
1121
1072
|
var TRANSFORM_PART = {
|
|
1122
1073
|
translate: "translate",
|
|
@@ -1139,11 +1090,11 @@ var PxGradientType = {
|
|
|
1139
1090
|
linear: "linear",
|
|
1140
1091
|
radial: "radial"
|
|
1141
1092
|
};
|
|
1142
|
-
function
|
|
1143
|
-
if (!(
|
|
1093
|
+
function isPxDocument(doc) {
|
|
1094
|
+
if (!(doc && typeof doc === "object" && !Array.isArray(doc))) {
|
|
1144
1095
|
return false;
|
|
1145
1096
|
}
|
|
1146
|
-
return
|
|
1097
|
+
return doc.type === "svg";
|
|
1147
1098
|
}
|
|
1148
1099
|
function getAnimatorConfig(doc) {
|
|
1149
1100
|
var _a2;
|
|
@@ -1270,7 +1221,7 @@ function nestAnimatorTimeline(cfg) {
|
|
|
1270
1221
|
if (fill !== void 0) timeline.fillMode = fill;
|
|
1271
1222
|
return Object.keys(timeline).length > 0 ? __spreadProps(__spreadValues({}, shared), { timeline }) : shared;
|
|
1272
1223
|
}
|
|
1273
|
-
function
|
|
1224
|
+
function getDefinitions(doc) {
|
|
1274
1225
|
var _a2;
|
|
1275
1226
|
if (!doc) return void 0;
|
|
1276
1227
|
return (_a2 = getAnimatorConfig(doc)) == null ? void 0 : _a2.definitions;
|
|
@@ -1316,20 +1267,20 @@ var PxKeyframeSchema = implementsInterface()(px.object({
|
|
|
1316
1267
|
// its internal COPY-PASTE payload, which never validates against this schema.)
|
|
1317
1268
|
}));
|
|
1318
1269
|
var anyKf = (kf) => kf;
|
|
1319
|
-
var
|
|
1270
|
+
var keyframeTime = (kf) => {
|
|
1320
1271
|
var _a2, _b;
|
|
1321
1272
|
return (_b = (_a2 = anyKf(kf).time) != null ? _a2 : anyKf(kf).t) != null ? _b : 0;
|
|
1322
1273
|
};
|
|
1323
|
-
var
|
|
1274
|
+
var keyframeValue = (kf) => {
|
|
1324
1275
|
var _a2;
|
|
1325
1276
|
return (_a2 = anyKf(kf).value) != null ? _a2 : anyKf(kf).v;
|
|
1326
1277
|
};
|
|
1327
|
-
var
|
|
1278
|
+
var keyframeEasing = (kf) => {
|
|
1328
1279
|
var _a2;
|
|
1329
1280
|
return (_a2 = anyKf(kf).easing) != null ? _a2 : anyKf(kf).e;
|
|
1330
1281
|
};
|
|
1331
|
-
var
|
|
1332
|
-
var
|
|
1282
|
+
var keyframeTangentIn = (kf) => anyKf(kf).tangentIn;
|
|
1283
|
+
var keyframeTangentOut = (kf) => anyKf(kf).tangentOut;
|
|
1333
1284
|
var PxLoopSchema = implementsInterface()(px.object({
|
|
1334
1285
|
segmentCount: px.number().optional(),
|
|
1335
1286
|
repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end]).optional(),
|
|
@@ -1383,7 +1334,7 @@ var PxGlyphFontSchema = implementsInterface()(px.object({
|
|
|
1383
1334
|
unitsPerEm: px.number(),
|
|
1384
1335
|
glyphs: px.record(PxGlyphSchema)
|
|
1385
1336
|
}));
|
|
1386
|
-
var
|
|
1337
|
+
var PxDefinitionsSchema = implementsInterface()(px.object({
|
|
1387
1338
|
easings: px.record(px.tuple([px.number(), px.number(), px.number(), px.number()])).optional(),
|
|
1388
1339
|
animations: px.record(PxAnimationDefinitionSchema).optional(),
|
|
1389
1340
|
fonts: px.record(PxGlyphFontSchema).optional()
|
|
@@ -1421,7 +1372,7 @@ var PxTimelinePinSchema = implementsInterface()(px.object({
|
|
|
1421
1372
|
offset: px.number().optional(),
|
|
1422
1373
|
distance: px.number().optional()
|
|
1423
1374
|
}));
|
|
1424
|
-
var PxTimelineEngineSchema = px.enum([
|
|
1375
|
+
var PxTimelineEngineSchema = px.enum([PxTimelineEngineSetting.auto, PxTimelineEngineSetting.native, PxTimelineEngineSetting.js]).optional();
|
|
1425
1376
|
var PxTimeTimelineSchema = implementsInterface()(px.object({
|
|
1426
1377
|
type: px.literal("time").optional(),
|
|
1427
1378
|
engine: PxTimelineEngineSchema,
|
|
@@ -1475,7 +1426,7 @@ var PxAnimatorConfigSchema = implementsInterface()(px.object({
|
|
|
1475
1426
|
// at this level only on the runtime view, like the rest of the playback dynamics.)
|
|
1476
1427
|
// THE spelling of "what advances progress" — clock / scroll / view (review §2.1).
|
|
1477
1428
|
timeline: PxTimelineSchema.optional(),
|
|
1478
|
-
definitions:
|
|
1429
|
+
definitions: PxDefinitionsSchema.optional(),
|
|
1479
1430
|
bindings: px.array(PxBindingSchema).optional(),
|
|
1480
1431
|
debugGlobalName: px.string().optional(),
|
|
1481
1432
|
// Declared HERE because this is a closed object: an undeclared key would be stripped by
|
|
@@ -1564,7 +1515,7 @@ var PxAnimatableGradientStopsSchema = px.union([
|
|
|
1564
1515
|
PxPropertyAnimationSchema
|
|
1565
1516
|
]);
|
|
1566
1517
|
var PxFillGradientEffectSchema = implementsInterface()(px.object({
|
|
1567
|
-
// Contextual kind — the `type` convention, see `
|
|
1518
|
+
// Contextual kind — the `type` convention, see `PxNodeBaseSchema.type`.
|
|
1568
1519
|
type: px.enum([PxGradientType.linear, PxGradientType.radial]),
|
|
1569
1520
|
start: PxAnimatableVec2Schema.optional(),
|
|
1570
1521
|
end: PxAnimatableVec2Schema.optional(),
|
|
@@ -1601,11 +1552,11 @@ var PxEffectsSchema = implementsInterface()(px.object({
|
|
|
1601
1552
|
textPath: PxTextPathEffectSchema.optional(),
|
|
1602
1553
|
text: PxTextEffectSchema.optional()
|
|
1603
1554
|
}));
|
|
1604
|
-
function validateNodeEffects(root,
|
|
1555
|
+
function validateNodeEffects(root, options) {
|
|
1605
1556
|
const warnings = [];
|
|
1606
1557
|
const walk = (node, path) => {
|
|
1607
1558
|
if (node && node.effects) {
|
|
1608
|
-
const ctx = { errors: [], warnings: [], strict: !!(
|
|
1559
|
+
const ctx = { errors: [], warnings: [], strict: !!(options == null ? void 0 : options.strict) };
|
|
1609
1560
|
const ok = PxEffectsSchema.isValid(node.effects, ctx, [path + ".effects"]);
|
|
1610
1561
|
if (!ok) {
|
|
1611
1562
|
for (const err of ctx.errors) warnings.push(err);
|
|
@@ -1666,9 +1617,9 @@ function validateVersionStamp(doc) {
|
|
|
1666
1617
|
if (parseWireVersion(version) !== void 0) return [];
|
|
1667
1618
|
return ["root.animator.version: " + JSON.stringify(version) + ' is not a version stamp ("a.b" or "a.b.c") \u2014 it reads as unstamped'];
|
|
1668
1619
|
}
|
|
1669
|
-
function validateDocument(doc,
|
|
1620
|
+
function validateDocument(doc, options) {
|
|
1670
1621
|
var _a2;
|
|
1671
|
-
const strict = (
|
|
1622
|
+
const strict = (options == null ? void 0 : options.strict) !== false;
|
|
1672
1623
|
const ctx = { errors: [], warnings: [], strict };
|
|
1673
1624
|
const problems = PxAnimatedSvgDocumentSchema.isValid(doc, ctx, ["root"]) ? [] : [...ctx.errors];
|
|
1674
1625
|
if (doc && typeof doc === "object") {
|
|
@@ -1688,7 +1639,7 @@ function validateDocument(doc, opts) {
|
|
|
1688
1639
|
}
|
|
1689
1640
|
return problems;
|
|
1690
1641
|
}
|
|
1691
|
-
var
|
|
1642
|
+
var PxNodeBaseSchema = px.openObject({
|
|
1692
1643
|
// CONVENTION (SCHEMA-DESIGN R1 / issues N4): `type` is the ONE word for "what
|
|
1693
1644
|
// kind of thing is this", discriminated by its CARRIER — here the node TAG
|
|
1694
1645
|
// (`rect`, `text`), and inside a sub-object that object's kind (`fillGradient.type`,
|
|
@@ -1703,7 +1654,7 @@ var PxNodeBase = px.openObject({
|
|
|
1703
1654
|
// `type` is taken by the tag name, so the attribute travels here and the renderer puts
|
|
1704
1655
|
// it back (`PxAnimatorDOM.renderNode`, `PxRnRender`). Declared here — not merely
|
|
1705
1656
|
// documented — because a wire key that is not in a schema is invisible to the
|
|
1706
|
-
// minifier's reserve list and gets renamed (
|
|
1657
|
+
// minifier's reserve list and gets renamed (dev-docs/plans/minification-boundary.md §1.1).
|
|
1707
1658
|
domType: px.string().optional(),
|
|
1708
1659
|
// Text content of a `<text>` / `<tspan>`. Declared, so a non-string value is a schema error
|
|
1709
1660
|
// and the minifier reserves the key; `text` is NOT an alias for it and is not read anywhere.
|
|
@@ -1711,7 +1662,7 @@ var PxNodeBase = px.openObject({
|
|
|
1711
1662
|
id: px.string().optional(),
|
|
1712
1663
|
meta: px.any().optional(),
|
|
1713
1664
|
// Player-effects bucket emitted by the Editor's lightweight design format.
|
|
1714
|
-
// Consumed and removed by `
|
|
1665
|
+
// Consumed and removed by `materializeNodeEffects` before any other normalization
|
|
1715
1666
|
// (see `createAnimatorImpl`), so downstream code never sees it.
|
|
1716
1667
|
effects: PxEffectsSchema.optional(),
|
|
1717
1668
|
// `PxElementAnimation` (not just `PxAnimationDefinition`) — accepts
|
|
@@ -1720,10 +1671,10 @@ var PxNodeBase = px.openObject({
|
|
|
1720
1671
|
animate: PxElementAnimationSchema.optional(),
|
|
1721
1672
|
style: px.record(px.union([px.string(), px.number()])).optional()
|
|
1722
1673
|
}, PxAttrValueSchema);
|
|
1723
|
-
var PxNodeSchema = px.openObject(__spreadProps(__spreadValues({},
|
|
1674
|
+
var PxNodeSchema = px.openObject(__spreadProps(__spreadValues({}, PxNodeBaseSchema._shape), {
|
|
1724
1675
|
children: px.lazy(() => px.array(PxNodeSchema), []).optional()
|
|
1725
1676
|
}), PxAttrValueSchema);
|
|
1726
|
-
var
|
|
1677
|
+
var PxSvgNodeRootSchema = px.object({
|
|
1727
1678
|
// `"100%"` and other SVG length strings are legal here — a number-only slot rejected
|
|
1728
1679
|
// real documents (e.g. apple-store-look-14-main.json) at the root <svg>.
|
|
1729
1680
|
width: px.union([px.number(), px.string()]).optional(),
|
|
@@ -1731,7 +1682,7 @@ var PxSvgNodeExtra = px.object({
|
|
|
1731
1682
|
viewBox: px.string().optional(),
|
|
1732
1683
|
animator: PxAnimatorConfigSchema.optional()
|
|
1733
1684
|
});
|
|
1734
|
-
var PxAnimatedSvgDocumentSchema = px.openObject(__spreadProps(__spreadValues(__spreadValues({},
|
|
1685
|
+
var PxAnimatedSvgDocumentSchema = px.openObject(__spreadProps(__spreadValues(__spreadValues({}, PxNodeBaseSchema._shape), PxSvgNodeRootSchema._shape), {
|
|
1735
1686
|
type: px.literal("svg"),
|
|
1736
1687
|
// override string → literal to require 'svg'
|
|
1737
1688
|
children: px.array(PxNodeSchema).optional()
|
|
@@ -1742,8 +1693,8 @@ var PxBezierPathSchema = implementsInterface()(px.object({
|
|
|
1742
1693
|
o: px.array(px.array(px.number())).optional(),
|
|
1743
1694
|
c: px.boolean().optional()
|
|
1744
1695
|
}));
|
|
1745
|
-
function
|
|
1746
|
-
const errors = validateDocument(
|
|
1696
|
+
function isValidPxDocument(doc) {
|
|
1697
|
+
const errors = validateDocument(doc, { strict: false });
|
|
1747
1698
|
return { valid: errors.length === 0, errors };
|
|
1748
1699
|
}
|
|
1749
1700
|
|
|
@@ -2094,9 +2045,9 @@ function parseColor(s) {
|
|
|
2094
2045
|
}
|
|
2095
2046
|
return void 0;
|
|
2096
2047
|
}
|
|
2097
|
-
var
|
|
2098
|
-
var
|
|
2099
|
-
var
|
|
2048
|
+
var PX_COLOR_ATTR_NAMES = /* @__PURE__ */ new Set(["color", "fill", "flood-color", "lighting-color", "stop-color", "stroke"]);
|
|
2049
|
+
var PX_TRANSFORM_FN_NAMES = /* @__PURE__ */ new Set(["translate", "rotate", "scale", "skew"]);
|
|
2050
|
+
var PX_PCT_BASED_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
|
|
2100
2051
|
function composeTransformParts(parts, opts) {
|
|
2101
2052
|
var _a2;
|
|
2102
2053
|
if (!parts) return "";
|
|
@@ -2149,8 +2100,7 @@ function parseTransformParts(str2) {
|
|
|
2149
2100
|
if (str2.replace(/([a-zA-Z]+)\s*\(([^)]*)\)/g, "").replace(/[\s,]/g, "").length) return void 0;
|
|
2150
2101
|
return Object.keys(out).length ? out : void 0;
|
|
2151
2102
|
}
|
|
2152
|
-
var
|
|
2153
|
-
var DEFAULT_DURATION_MS = 1e3;
|
|
2103
|
+
var PX_DEFAULT_DURATION_MS = 1e3;
|
|
2154
2104
|
function kebabToCamelCaseWord(kebab) {
|
|
2155
2105
|
return kebab.includes("-") ? kebab.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()) : kebab;
|
|
2156
2106
|
}
|
|
@@ -2313,81 +2263,19 @@ function invertEasing(easing) {
|
|
|
2313
2263
|
}
|
|
2314
2264
|
|
|
2315
2265
|
// src/util/PxNodeProps.ts
|
|
2316
|
-
|
|
2317
|
-
"script",
|
|
2318
|
-
"foreignobject"
|
|
2319
|
-
]);
|
|
2320
|
-
var URL_VALUE_ATTRS_LOWER = /* @__PURE__ */ new Set([
|
|
2321
|
-
"href",
|
|
2322
|
-
// <use>, <image>
|
|
2323
|
-
"xlink:href",
|
|
2324
|
-
// legacy <use>
|
|
2325
|
-
"src",
|
|
2326
|
-
// <image>
|
|
2327
|
-
"filter",
|
|
2328
|
-
// url(#filterId)
|
|
2329
|
-
"clippath",
|
|
2330
|
-
// clip-path="url(#…)"
|
|
2331
|
-
"mask",
|
|
2332
|
-
// url(#maskId)
|
|
2333
|
-
"markerstart",
|
|
2334
|
-
// marker-start="url(#…)"
|
|
2335
|
-
"markermid",
|
|
2336
|
-
// marker-mid="url(#…)"
|
|
2337
|
-
"markerend"
|
|
2338
|
-
// marker-end="url(#…)"
|
|
2339
|
-
]);
|
|
2340
|
-
var IMAGE_REF_ATTRS_LOWER = /* @__PURE__ */ new Set(["href", "xlink:href", "src"]);
|
|
2341
|
-
var CSS_ONLY_STYLE_PROPS = /* @__PURE__ */ new Set(["mixBlendMode", "isolation"]);
|
|
2342
|
-
var DATA_RASTER_IMAGE_RE = /^data:image\/(?:png|jpe?g|gif|webp|bmp);base64,/i;
|
|
2343
|
-
var DATA_SVG_IMAGE_RE = /^data:image\/svg\+xml(?:;[^,]*)?,/i;
|
|
2344
|
-
var DATA_IMAGE_BASE64_PAYLOAD_RE = /^data:image\/[^;,]*;base64,([A-Za-z0-9+/]{8})/i;
|
|
2345
|
-
var BASE64_RASTER_MAGICS = ["iVBORw0K", "/9j/", "R0lGOD", "UklGR", "Qk"];
|
|
2346
|
-
function isContentSniffedRasterImage(str2) {
|
|
2347
|
-
const m = DATA_IMAGE_BASE64_PAYLOAD_RE.exec(str2);
|
|
2348
|
-
return !!m && BASE64_RASTER_MAGICS.some((magic) => m[1].startsWith(magic));
|
|
2349
|
-
}
|
|
2350
|
-
function isDangerousAttrName(nameLower) {
|
|
2351
|
-
if (nameLower.startsWith("on")) return true;
|
|
2352
|
-
return false;
|
|
2353
|
-
}
|
|
2354
|
-
function sanitizeAttributeValue(name, value) {
|
|
2355
|
-
const nameLower = name.toLowerCase();
|
|
2356
|
-
if (isDangerousAttrName(nameLower)) {
|
|
2357
|
-
console.warn("Attribute blocked (event handler / dangerous): ", nameLower);
|
|
2358
|
-
return void 0;
|
|
2359
|
-
}
|
|
2360
|
-
if (nameLower === "fill" || nameLower === "stroke" || nameLower === "stopcolor") {
|
|
2361
|
-
const str2 = String(value);
|
|
2362
|
-
if (str2.includes("url(") && !/^url\(#[^)]+\)$/.test(str2)) {
|
|
2363
|
-
console.warn('Attribute "' + nameLower + '" blocked: url() must be internal url(#id), got:', value);
|
|
2364
|
-
return void 0;
|
|
2365
|
-
}
|
|
2366
|
-
return value;
|
|
2367
|
-
}
|
|
2368
|
-
if (URL_VALUE_ATTRS_LOWER.has(nameLower)) {
|
|
2369
|
-
const str2 = String(value);
|
|
2370
|
-
if (str2.startsWith("#")) return value;
|
|
2371
|
-
if (/^url\(#[^)]+\)$/.test(str2)) return value;
|
|
2372
|
-
if (IMAGE_REF_ATTRS_LOWER.has(nameLower) && (DATA_RASTER_IMAGE_RE.test(str2) || DATA_SVG_IMAGE_RE.test(str2) || isContentSniffedRasterImage(str2))) return value;
|
|
2373
|
-
console.warn('Attribute "' + nameLower + '" blocked: must be #id, url(#id), or data:image/\u2026 URI, got:', value);
|
|
2374
|
-
return void 0;
|
|
2375
|
-
}
|
|
2376
|
-
return value;
|
|
2377
|
-
}
|
|
2378
|
-
function getNormalizedProps(props) {
|
|
2266
|
+
function toDomProps(props) {
|
|
2379
2267
|
const propsCopy = {};
|
|
2380
2268
|
for (const rawKey of Object.keys(props)) {
|
|
2381
2269
|
const key = kebabToCamelCaseWord(rawKey);
|
|
2382
2270
|
if (INTERNAL_ATTRS.has(key)) continue;
|
|
2383
2271
|
if (key === "style") continue;
|
|
2384
2272
|
let value = props[rawKey];
|
|
2385
|
-
if (
|
|
2273
|
+
if (PX_COLOR_ATTR_NAMES.has(key) && Array.isArray(value)) {
|
|
2386
2274
|
propsCopy[key] = toRGBA(value);
|
|
2387
2275
|
} else if (key === "transform" && value !== null && typeof value === "object" && !Array.isArray(value) && !value.keyframes) {
|
|
2388
2276
|
const parts = value.value && typeof value.value === "object" ? value.value : value;
|
|
2389
2277
|
propsCopy[TRANSFORM_ATTR] = composeTransformParts(parts, { withUnits: false });
|
|
2390
|
-
} else if (
|
|
2278
|
+
} else if (PX_TRANSFORM_FN_NAMES.has(key)) {
|
|
2391
2279
|
if (Array.isArray(value)) {
|
|
2392
2280
|
if (key === "translate") value = value.map((v) => v + "px");
|
|
2393
2281
|
value = value.join(",");
|
|
@@ -2405,7 +2293,7 @@ function getNormalizedProps(props) {
|
|
|
2405
2293
|
|
|
2406
2294
|
// src/materialize/PxMotionPath.ts
|
|
2407
2295
|
function getKfTranslate(kf) {
|
|
2408
|
-
const v =
|
|
2296
|
+
const v = keyframeValue(kf);
|
|
2409
2297
|
if (!v) return void 0;
|
|
2410
2298
|
if (Array.isArray(v) && v.length >= 2 && typeof v[0] === "number" && typeof v[1] === "number") {
|
|
2411
2299
|
return [v[0], v[1]];
|
|
@@ -2415,17 +2303,17 @@ function getKfTranslate(kf) {
|
|
|
2415
2303
|
return void 0;
|
|
2416
2304
|
}
|
|
2417
2305
|
function getKfTime(kf) {
|
|
2418
|
-
return
|
|
2306
|
+
return keyframeTime(kf);
|
|
2419
2307
|
}
|
|
2420
2308
|
function getKfEasing(kf) {
|
|
2421
|
-
return
|
|
2309
|
+
return keyframeEasing(kf);
|
|
2422
2310
|
}
|
|
2423
2311
|
function propAnimIsMotionPath(anim) {
|
|
2424
2312
|
const kfs = anim.keyframes;
|
|
2425
2313
|
if (!Array.isArray(kfs)) return false;
|
|
2426
2314
|
if (anim.autoOrient) return true;
|
|
2427
2315
|
for (const kf of kfs) {
|
|
2428
|
-
if (
|
|
2316
|
+
if (keyframeTangentIn(kf) || keyframeTangentOut(kf)) return true;
|
|
2429
2317
|
}
|
|
2430
2318
|
return false;
|
|
2431
2319
|
}
|
|
@@ -2434,8 +2322,8 @@ function getSegmentCache(prevKf, nextKf, prevPos, nextPos) {
|
|
|
2434
2322
|
let byNext = _segmentCache.get(prevKf);
|
|
2435
2323
|
const existing = byNext == null ? void 0 : byNext.get(nextKf);
|
|
2436
2324
|
if (existing) return existing;
|
|
2437
|
-
const to =
|
|
2438
|
-
const ti =
|
|
2325
|
+
const to = keyframeTangentOut(prevKf);
|
|
2326
|
+
const ti = keyframeTangentIn(nextKf);
|
|
2439
2327
|
const P1 = [prevPos[0] + (to ? to[0] : 0), prevPos[1] + (to ? to[1] : 0)];
|
|
2440
2328
|
const P2 = [nextPos[0] + (ti ? ti[0] : 0), nextPos[1] + (ti ? ti[1] : 0)];
|
|
2441
2329
|
const lut = bezier2D_arcLengthLUT(prevPos, P1, P2, nextPos);
|
|
@@ -2528,7 +2416,7 @@ function materializeMotionPathInPropAnim(anim, opts) {
|
|
|
2528
2416
|
function unwrapAutoOrientRotations(kfs) {
|
|
2529
2417
|
let prev;
|
|
2530
2418
|
for (const kf of kfs) {
|
|
2531
|
-
const v =
|
|
2419
|
+
const v = keyframeValue(kf);
|
|
2532
2420
|
if (!v || typeof v.rotate !== "number") continue;
|
|
2533
2421
|
if (prev === void 0) {
|
|
2534
2422
|
prev = v.rotate;
|
|
@@ -2545,7 +2433,7 @@ function makeOutKf(time, value) {
|
|
|
2545
2433
|
return { t: time, v: value };
|
|
2546
2434
|
}
|
|
2547
2435
|
function getKfValueParts(kf) {
|
|
2548
|
-
const v =
|
|
2436
|
+
const v = keyframeValue(kf);
|
|
2549
2437
|
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
2550
2438
|
return v;
|
|
2551
2439
|
}
|
|
@@ -2607,7 +2495,7 @@ function wrappedAngleDelta(a, b) {
|
|
|
2607
2495
|
}
|
|
2608
2496
|
function insertSharpCornerStepKfIfNeeded(out, prevKf, nextKf, prevPos, nextPos, rotationTol) {
|
|
2609
2497
|
const lastKf = out[out.length - 1];
|
|
2610
|
-
const lastV =
|
|
2498
|
+
const lastV = keyframeValue(lastKf);
|
|
2611
2499
|
const prevExit = lastV == null ? void 0 : lastV.rotate;
|
|
2612
2500
|
if (typeof prevExit !== "number") return;
|
|
2613
2501
|
const boundaryV = getKfValueParts(prevKf);
|
|
@@ -2789,7 +2677,7 @@ function walkAndMaterialize(node, opts) {
|
|
|
2789
2677
|
}
|
|
2790
2678
|
|
|
2791
2679
|
// src/animation/PxDefinitions.ts
|
|
2792
|
-
var
|
|
2680
|
+
var PX_LOOP_JUMP_SHIFT_MS = 1;
|
|
2793
2681
|
function deepEqualValue(a, b) {
|
|
2794
2682
|
if (a === b) return true;
|
|
2795
2683
|
if (typeof a !== typeof b || a === null || b === null || typeof a !== "object") return false;
|
|
@@ -2965,7 +2853,7 @@ function interpolateValue(propName, a, b, t) {
|
|
|
2965
2853
|
const bPaths = (_b = b == null ? void 0 : b.paths) != null ? _b : Array.isArray(b) ? b : [];
|
|
2966
2854
|
return { paths: interpolateBeziers(aPaths, bPaths, t) };
|
|
2967
2855
|
}
|
|
2968
|
-
if (
|
|
2856
|
+
if (PX_COLOR_ATTR_NAMES.has(propName)) {
|
|
2969
2857
|
return interpolateColor(a || [0, 0, 0, 1], b || [0, 0, 0, 1], t);
|
|
2970
2858
|
}
|
|
2971
2859
|
if (propName === "transform" && typeof a === "object" && a !== null && !Array.isArray(a) && typeof b === "object" && b !== null && !Array.isArray(b)) {
|
|
@@ -2974,7 +2862,7 @@ function interpolateValue(propName, a, b, t) {
|
|
|
2974
2862
|
if (propName === "rotate" && typeof a === "number" && typeof b === "number") {
|
|
2975
2863
|
return interpolateNum(a, b, t);
|
|
2976
2864
|
}
|
|
2977
|
-
if (
|
|
2865
|
+
if (PX_TRANSFORM_FN_NAMES.has(propName) || propName === "stroke-dasharray" || propName === "strokeDasharray") {
|
|
2978
2866
|
return interpolateVec(a || [], b || [], t);
|
|
2979
2867
|
}
|
|
2980
2868
|
return interpolateNum(+(a || 0), +(b || 0), t);
|
|
@@ -3026,8 +2914,8 @@ function expandLoopKeyframes(propName, keyframes, loop, duration) {
|
|
|
3026
2914
|
relT: (kf.t - segStartT) / segDuration,
|
|
3027
2915
|
v: kf.v,
|
|
3028
2916
|
e: kf.e,
|
|
3029
|
-
tangentIn:
|
|
3030
|
-
tangentOut:
|
|
2917
|
+
tangentIn: keyframeTangentIn(kf),
|
|
2918
|
+
tangentOut: keyframeTangentOut(kf)
|
|
3031
2919
|
}));
|
|
3032
2920
|
const fullReps = Math.floor(fillDuration / segDuration);
|
|
3033
2921
|
const remainder = fillDuration - fullReps * segDuration;
|
|
@@ -3093,7 +2981,7 @@ function expandLoopKeyframes(propName, keyframes, loop, duration) {
|
|
|
3093
2981
|
}
|
|
3094
2982
|
}
|
|
3095
2983
|
const pushed = {
|
|
3096
|
-
t: repStart + entry.relT * segDuration + (isBoundary ?
|
|
2984
|
+
t: repStart + entry.relT * segDuration + (isBoundary ? PX_LOOP_JUMP_SHIFT_MS : 0),
|
|
3097
2985
|
v: entry.v,
|
|
3098
2986
|
e: i < entries.length - 1 ? entry.e : void 0
|
|
3099
2987
|
};
|
|
@@ -3180,14 +3068,14 @@ function normalizeKeyframes(propName, propAnim, duration, defs) {
|
|
|
3180
3068
|
const keyframes = propAnim.keyframes || [];
|
|
3181
3069
|
const normalized = [];
|
|
3182
3070
|
for (const kf of keyframes) {
|
|
3183
|
-
const timePct =
|
|
3184
|
-
let value =
|
|
3185
|
-
const easing =
|
|
3071
|
+
const timePct = keyframeTime(kf);
|
|
3072
|
+
let value = keyframeValue(kf);
|
|
3073
|
+
const easing = keyframeEasing(kf);
|
|
3186
3074
|
if (propName === "d") {
|
|
3187
3075
|
value = normalizePathValue(value);
|
|
3188
3076
|
}
|
|
3189
3077
|
const propNameKebab = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
|
|
3190
|
-
if (
|
|
3078
|
+
if (PX_COLOR_ATTR_NAMES.has(propNameKebab)) {
|
|
3191
3079
|
value = (_a2 = parseColor(value)) != null ? _a2 : value;
|
|
3192
3080
|
}
|
|
3193
3081
|
const normKf = {
|
|
@@ -3195,8 +3083,8 @@ function normalizeKeyframes(propName, propAnim, duration, defs) {
|
|
|
3195
3083
|
v: value,
|
|
3196
3084
|
e: resolveEasing(easing, defs)
|
|
3197
3085
|
};
|
|
3198
|
-
const tIn =
|
|
3199
|
-
const tOut =
|
|
3086
|
+
const tIn = keyframeTangentIn(kf);
|
|
3087
|
+
const tOut = keyframeTangentOut(kf);
|
|
3200
3088
|
if (tIn) normKf.tangentIn = tIn;
|
|
3201
3089
|
if (tOut) normKf.tangentOut = tOut;
|
|
3202
3090
|
normalized.push(normKf);
|
|
@@ -3228,17 +3116,17 @@ function materializeInternalLoopsInPropAnim(propName, propAnim, duration) {
|
|
|
3228
3116
|
const rawKfs = propAnim.keyframes;
|
|
3229
3117
|
if (!Array.isArray(rawKfs) || rawKfs.length < 2) return propAnim;
|
|
3230
3118
|
const propNameKebab = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
|
|
3231
|
-
const isColor =
|
|
3119
|
+
const isColor = PX_COLOR_ATTR_NAMES.has(propNameKebab);
|
|
3232
3120
|
const kfs = rawKfs.map((kf) => {
|
|
3233
3121
|
var _a2;
|
|
3234
|
-
const t =
|
|
3235
|
-
let v =
|
|
3122
|
+
const t = keyframeTime(kf);
|
|
3123
|
+
let v = keyframeValue(kf);
|
|
3236
3124
|
if (propName === "d") v = normalizePathValue(v);
|
|
3237
3125
|
if (isColor) v = (_a2 = parseColor(v)) != null ? _a2 : v;
|
|
3238
|
-
const e =
|
|
3126
|
+
const e = keyframeEasing(kf);
|
|
3239
3127
|
const out2 = { t, v, e };
|
|
3240
|
-
const tIn =
|
|
3241
|
-
const tOut =
|
|
3128
|
+
const tIn = keyframeTangentIn(kf);
|
|
3129
|
+
const tOut = keyframeTangentOut(kf);
|
|
3242
3130
|
if (tIn) out2.tangentIn = tIn;
|
|
3243
3131
|
if (tOut) out2.tangentOut = tOut;
|
|
3244
3132
|
return out2;
|
|
@@ -3303,7 +3191,7 @@ function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
|
|
|
3303
3191
|
}
|
|
3304
3192
|
return animDef;
|
|
3305
3193
|
}
|
|
3306
|
-
const channels = Object.keys(animDef).filter((k) =>
|
|
3194
|
+
const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
|
|
3307
3195
|
if (channels.length !== 1) return animDef;
|
|
3308
3196
|
const ch = channels[0];
|
|
3309
3197
|
const chAnim = animDef[ch];
|
|
@@ -3332,9 +3220,9 @@ function normalizeAnimationDefinition(animDef, duration, defs, engine = PxTimeli
|
|
|
3332
3220
|
}
|
|
3333
3221
|
return normalized;
|
|
3334
3222
|
}
|
|
3335
|
-
function
|
|
3223
|
+
function normalizeBindings(doc, engine = PxTimelineEngine.native) {
|
|
3336
3224
|
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
3337
|
-
const defs =
|
|
3225
|
+
const defs = getDefinitions(doc);
|
|
3338
3226
|
const duration = animatorConfig.duration || 1e3;
|
|
3339
3227
|
const bindings = [];
|
|
3340
3228
|
const processAnimation = (id, animDefs, staticTransform) => {
|
|
@@ -3404,7 +3292,7 @@ function calcPropertyValue(propName, propAnim, progress) {
|
|
|
3404
3292
|
const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
|
|
3405
3293
|
let localProgress = prevKf === nextKf ? 0 : remap(progress, (_a2 = prevKf.t) != null ? _a2 : 0, (_b = nextKf.t) != null ? _b : 0, 0, 1);
|
|
3406
3294
|
localProgress = clamp(localProgress, 0, 1);
|
|
3407
|
-
const easing =
|
|
3295
|
+
const easing = keyframeEasing(prevKf);
|
|
3408
3296
|
if (easing && Array.isArray(easing)) {
|
|
3409
3297
|
try {
|
|
3410
3298
|
localProgress = cubicBezier(easing)(localProgress);
|
|
@@ -3423,7 +3311,7 @@ function calcPropertyValue(propName, propAnim, progress) {
|
|
|
3423
3311
|
nextPaths,
|
|
3424
3312
|
localProgress
|
|
3425
3313
|
).map((bz) => bezierToSvgPath(bz)).join("");
|
|
3426
|
-
} else if (
|
|
3314
|
+
} else if (PX_COLOR_ATTR_NAMES.has(cssAttrName)) {
|
|
3427
3315
|
cssValue = toRGBA(interpolateColor(
|
|
3428
3316
|
prevV || [0, 0, 0, 1],
|
|
3429
3317
|
nextV || [0, 0, 0, 1],
|
|
@@ -3497,14 +3385,14 @@ function calcPropertyValue(propName, propAnim, progress) {
|
|
|
3497
3385
|
cssValue = "scale(" + v.join(",") + ")";
|
|
3498
3386
|
cssAttrName = "transform";
|
|
3499
3387
|
} else {
|
|
3500
|
-
const
|
|
3388
|
+
const num = interpolateNum(
|
|
3501
3389
|
+(prevV || 0),
|
|
3502
3390
|
+(nextV || 0),
|
|
3503
3391
|
localProgress
|
|
3504
3392
|
);
|
|
3505
|
-
cssValue =
|
|
3393
|
+
cssValue = num;
|
|
3506
3394
|
}
|
|
3507
|
-
if (
|
|
3395
|
+
if (PX_PCT_BASED_ATTR_NAMES.has(cssAttrName) && typeof cssValue === "number") {
|
|
3508
3396
|
cssValue = cssValue * 100 + "%";
|
|
3509
3397
|
}
|
|
3510
3398
|
return { k: cssAttrName, v: cssValue === null ? "" : "" + cssValue };
|
|
@@ -4069,11 +3957,11 @@ function buildStopChildren(stops, ctx) {
|
|
|
4069
3957
|
const loopFromSource = read.loop;
|
|
4070
3958
|
let stopCount = 0;
|
|
4071
3959
|
for (const kf of kfs) {
|
|
4072
|
-
const v =
|
|
3960
|
+
const v = keyframeValue(kf);
|
|
4073
3961
|
if (Array.isArray(v) && v.length > stopCount) stopCount = v.length;
|
|
4074
3962
|
}
|
|
4075
3963
|
if (!stopCount) return [];
|
|
4076
|
-
const firstKfValue =
|
|
3964
|
+
const firstKfValue = keyframeValue(kfs[0]);
|
|
4077
3965
|
const baselineStops = [];
|
|
4078
3966
|
for (let i = 0; i < stopCount; i++) {
|
|
4079
3967
|
const s = (_b = (_a2 = firstKfValue == null ? void 0 : firstKfValue[i]) != null ? _a2 : prevDefinedStop(kfs, 0, i)) != null ? _b : { offset: i / Math.max(1, stopCount - 1), color: "#000000" };
|
|
@@ -4094,11 +3982,11 @@ function animatedStopNode(baseline, kfs, stopIdx, _ctx, loop) {
|
|
|
4094
3982
|
const offsetKfs = [];
|
|
4095
3983
|
let offsetVaries = false;
|
|
4096
3984
|
for (const kf of kfs) {
|
|
4097
|
-
const t =
|
|
4098
|
-
const arr =
|
|
3985
|
+
const t = keyframeTime(kf);
|
|
3986
|
+
const arr = keyframeValue(kf);
|
|
4099
3987
|
const sliced = (_a2 = arr == null ? void 0 : arr[stopIdx]) != null ? _a2 : prevDefinedStop(kfs, kfs.indexOf(kf), stopIdx);
|
|
4100
3988
|
if (!sliced) continue;
|
|
4101
|
-
const easing =
|
|
3989
|
+
const easing = keyframeEasing(kf);
|
|
4102
3990
|
const colorOut = { time: t, value: sliced.color };
|
|
4103
3991
|
if (easing !== void 0) colorOut.easing = easing;
|
|
4104
3992
|
colorKfs.push(colorOut);
|
|
@@ -4126,11 +4014,11 @@ function animatedStopNode(baseline, kfs, stopIdx, _ctx, loop) {
|
|
|
4126
4014
|
}
|
|
4127
4015
|
function prevDefinedStop(kfs, fromIdx, stopIdx) {
|
|
4128
4016
|
for (let i = fromIdx; i >= 0; i--) {
|
|
4129
|
-
const arr =
|
|
4017
|
+
const arr = keyframeValue(kfs[i]);
|
|
4130
4018
|
if (arr == null ? void 0 : arr[stopIdx]) return arr[stopIdx];
|
|
4131
4019
|
}
|
|
4132
4020
|
for (let i = fromIdx + 1; i < kfs.length; i++) {
|
|
4133
|
-
const arr =
|
|
4021
|
+
const arr = keyframeValue(kfs[i]);
|
|
4134
4022
|
if (arr == null ? void 0 : arr[stopIdx]) return arr[stopIdx];
|
|
4135
4023
|
}
|
|
4136
4024
|
return void 0;
|
|
@@ -4816,7 +4704,7 @@ function parseCubics(d) {
|
|
|
4816
4704
|
let pcx = 0, pcy = 0;
|
|
4817
4705
|
let pqx = 0, pqy = 0;
|
|
4818
4706
|
let prevCmd = "";
|
|
4819
|
-
const
|
|
4707
|
+
const num = () => parseFloat(tokens[i++]);
|
|
4820
4708
|
const push = (P1, P2, P3) => {
|
|
4821
4709
|
const P0 = [cx, cy];
|
|
4822
4710
|
const lut = bezier2D_arcLengthLUT(P0, P1, P2, P3, LUT_STEPS);
|
|
@@ -4845,7 +4733,7 @@ function parseCubics(d) {
|
|
|
4845
4733
|
continue;
|
|
4846
4734
|
}
|
|
4847
4735
|
if (U === "M") {
|
|
4848
|
-
const x =
|
|
4736
|
+
const x = num() + (rel ? cx : 0), y = num() + (rel ? cy : 0);
|
|
4849
4737
|
cx = x;
|
|
4850
4738
|
cy = y;
|
|
4851
4739
|
sx = x;
|
|
@@ -4854,29 +4742,29 @@ function parseCubics(d) {
|
|
|
4854
4742
|
continue;
|
|
4855
4743
|
}
|
|
4856
4744
|
if (U === "L") {
|
|
4857
|
-
pushLine(
|
|
4745
|
+
pushLine(num() + (rel ? cx : 0), num() + (rel ? cy : 0));
|
|
4858
4746
|
} else if (U === "H") {
|
|
4859
|
-
pushLine(
|
|
4747
|
+
pushLine(num() + (rel ? cx : 0), cy);
|
|
4860
4748
|
} else if (U === "V") {
|
|
4861
|
-
pushLine(cx,
|
|
4749
|
+
pushLine(cx, num() + (rel ? cy : 0));
|
|
4862
4750
|
} else if (U === "C") {
|
|
4863
|
-
const p1 = [
|
|
4864
|
-
const p2 = [
|
|
4865
|
-
const p3 = [
|
|
4751
|
+
const p1 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4752
|
+
const p2 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4753
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4866
4754
|
pcx = p2[0];
|
|
4867
4755
|
pcy = p2[1];
|
|
4868
4756
|
push(p1, p2, p3);
|
|
4869
4757
|
} else if (U === "S") {
|
|
4870
4758
|
const smooth = prevCmd.toUpperCase() === "C" || prevCmd.toUpperCase() === "S";
|
|
4871
4759
|
const p1 = smooth ? [2 * cx - pcx, 2 * cy - pcy] : [cx, cy];
|
|
4872
|
-
const p2 = [
|
|
4873
|
-
const p3 = [
|
|
4760
|
+
const p2 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4761
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4874
4762
|
pcx = p2[0];
|
|
4875
4763
|
pcy = p2[1];
|
|
4876
4764
|
push(p1, p2, p3);
|
|
4877
4765
|
} else if (U === "Q") {
|
|
4878
|
-
const qc = [
|
|
4879
|
-
const p3 = [
|
|
4766
|
+
const qc = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4767
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4880
4768
|
pqx = qc[0];
|
|
4881
4769
|
pqy = qc[1];
|
|
4882
4770
|
const { P1, P2 } = quadToCubic([cx, cy], qc, p3);
|
|
@@ -4884,14 +4772,14 @@ function parseCubics(d) {
|
|
|
4884
4772
|
} else if (U === "T") {
|
|
4885
4773
|
const smooth = prevCmd.toUpperCase() === "Q" || prevCmd.toUpperCase() === "T";
|
|
4886
4774
|
const qc = smooth ? [2 * cx - pqx, 2 * cy - pqy] : [cx, cy];
|
|
4887
|
-
const p3 = [
|
|
4775
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4888
4776
|
pqx = qc[0];
|
|
4889
4777
|
pqy = qc[1];
|
|
4890
4778
|
const { P1, P2 } = quadToCubic([cx, cy], qc, p3);
|
|
4891
4779
|
push(P1, P2, p3);
|
|
4892
4780
|
} else if (U === "A") {
|
|
4893
4781
|
i += 5;
|
|
4894
|
-
pushLine(
|
|
4782
|
+
pushLine(num() + (rel ? cx : 0), num() + (rel ? cy : 0));
|
|
4895
4783
|
} else {
|
|
4896
4784
|
i++;
|
|
4897
4785
|
continue;
|
|
@@ -5067,20 +4955,20 @@ function transformPathData(d, m, decimals = 2) {
|
|
|
5067
4955
|
while ((match = TOKEN_RE.exec(d)) !== null) tokens.push(match[0]);
|
|
5068
4956
|
let out = "";
|
|
5069
4957
|
let i = 0;
|
|
5070
|
-
const
|
|
4958
|
+
const num = () => parseFloat(tokens[i++]);
|
|
5071
4959
|
while (i < tokens.length) {
|
|
5072
4960
|
const cmd = tokens[i++];
|
|
5073
4961
|
if (cmd === "M" || cmd === "L") {
|
|
5074
|
-
const [x, y] = apply(m,
|
|
4962
|
+
const [x, y] = apply(m, num(), num());
|
|
5075
4963
|
out += cmd + pack([x, y], decimals);
|
|
5076
4964
|
} else if (cmd === "C") {
|
|
5077
|
-
const [x1, y1] = apply(m,
|
|
5078
|
-
const [x2, y2] = apply(m,
|
|
5079
|
-
const [x, y] = apply(m,
|
|
4965
|
+
const [x1, y1] = apply(m, num(), num());
|
|
4966
|
+
const [x2, y2] = apply(m, num(), num());
|
|
4967
|
+
const [x, y] = apply(m, num(), num());
|
|
5080
4968
|
out += "C" + pack([x1, y1, x2, y2, x, y], decimals);
|
|
5081
4969
|
} else if (cmd === "Q") {
|
|
5082
|
-
const [x1, y1] = apply(m,
|
|
5083
|
-
const [x, y] = apply(m,
|
|
4970
|
+
const [x1, y1] = apply(m, num(), num());
|
|
4971
|
+
const [x, y] = apply(m, num(), num());
|
|
5084
4972
|
out += "Q" + pack([x1, y1, x, y], decimals);
|
|
5085
4973
|
} else if (cmd === "Z" || cmd === "z") {
|
|
5086
4974
|
out += "Z";
|
|
@@ -5111,7 +4999,7 @@ var TEXT_ATTR_KEYS = [
|
|
|
5111
4999
|
"stroke",
|
|
5112
5000
|
"strokeWidth",
|
|
5113
5001
|
"effects",
|
|
5114
|
-
|
|
5002
|
+
PX_TEXT_CONTENT_ATTR,
|
|
5115
5003
|
"xml:space"
|
|
5116
5004
|
];
|
|
5117
5005
|
var PAINT_STATIC_KEYS = [
|
|
@@ -5265,13 +5153,13 @@ function materializeGlyphTextHorizontal(node, opts) {
|
|
|
5265
5153
|
if (y !== void 0) pen.y = y;
|
|
5266
5154
|
pen.x += (_a3 = parseLen(el.dx)) != null ? _a3 : 0;
|
|
5267
5155
|
pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
|
|
5268
|
-
const content = str(el[
|
|
5156
|
+
const content = str(el[PX_TEXT_CONTENT_ATTR]);
|
|
5269
5157
|
if (content && !((_c2 = el.children) == null ? void 0 : _c2.length)) renderChars(content, s);
|
|
5270
5158
|
if (el.children) for (const ch of el.children) walk(ch, s);
|
|
5271
5159
|
};
|
|
5272
5160
|
const rootStyle = rootStyleOf(node);
|
|
5273
5161
|
if (node.children) for (const ch of node.children) walk(ch, rootStyle);
|
|
5274
|
-
const rootContent = str(node[
|
|
5162
|
+
const rootContent = str(node[PX_TEXT_CONTENT_ATTR]);
|
|
5275
5163
|
if (rootContent && !((_c = node.children) == null ? void 0 : _c.length)) renderChars(rootContent, rootStyle);
|
|
5276
5164
|
const anchor = str(node.textAnchor);
|
|
5277
5165
|
if (anchor === "middle" || anchor === "end") {
|
|
@@ -5283,141 +5171,13 @@ function materializeGlyphTextHorizontal(node, opts) {
|
|
|
5283
5171
|
}
|
|
5284
5172
|
return toGroup(node, buildPaths(placements, create, warnings), create);
|
|
5285
5173
|
}
|
|
5286
|
-
function layoutGlyphTextChars(node, opts) {
|
|
5287
|
-
var _a2, _b, _c, _d, _e;
|
|
5288
|
-
if ((_a2 = opts.alongPath) == null ? void 0 : _a2.pathD) return layoutGlyphTextCharsAlongPath(node, opts.alongPath.pathD, opts);
|
|
5289
|
-
const { glyphs, warnings } = opts;
|
|
5290
|
-
const soleFont = soleFontOf(glyphs);
|
|
5291
|
-
const pen = { x: (_b = parseLen(node.x)) != null ? _b : 0, y: (_c = parseLen(node.y)) != null ? _c : 0 };
|
|
5292
|
-
const boxes = [];
|
|
5293
|
-
const lines = [{ start: pen.x, end: pen.x }];
|
|
5294
|
-
let line = 0;
|
|
5295
|
-
const renderChars = (content, s) => {
|
|
5296
|
-
var _a3;
|
|
5297
|
-
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
5298
|
-
const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
|
|
5299
|
-
const scale = s.fontSize / upm;
|
|
5300
|
-
const ascent = ((_a3 = gf == null ? void 0 : gf.ascent) != null ? _a3 : 0.9 * upm) * scale;
|
|
5301
|
-
for (let i = 0; i < content.length; i++) {
|
|
5302
|
-
const ch = content.charAt(i);
|
|
5303
|
-
const g = gf == null ? void 0 : gf.glyphs[ch];
|
|
5304
|
-
const advance = (g ? g.width : 0) * scale + s.letterSpacing + (ch === " " ? s.wordSpacing : 0);
|
|
5305
|
-
boxes.push({ x: pen.x, y: pen.y, width: advance, ascent, fontSize: s.fontSize, line });
|
|
5306
|
-
pen.x += advance;
|
|
5307
|
-
lines[line].end = pen.x;
|
|
5308
|
-
}
|
|
5309
|
-
};
|
|
5310
|
-
const walk = (el, parentStyle) => {
|
|
5311
|
-
var _a3, _b2, _c2;
|
|
5312
|
-
const s = resolveStyle(el, parentStyle);
|
|
5313
|
-
const x = parseLen(el.x);
|
|
5314
|
-
const y = parseLen(el.y);
|
|
5315
|
-
if (x !== void 0) {
|
|
5316
|
-
pen.x = x;
|
|
5317
|
-
line = lines.length;
|
|
5318
|
-
lines.push({ start: pen.x, end: pen.x });
|
|
5319
|
-
}
|
|
5320
|
-
if (y !== void 0) pen.y = y;
|
|
5321
|
-
pen.x += (_a3 = parseLen(el.dx)) != null ? _a3 : 0;
|
|
5322
|
-
pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
|
|
5323
|
-
const content = str(el[TEXT_CONTENT_ATTR]);
|
|
5324
|
-
if (content && !((_c2 = el.children) == null ? void 0 : _c2.length)) renderChars(content, s);
|
|
5325
|
-
if (el.children) for (const ch of el.children) walk(ch, s);
|
|
5326
|
-
};
|
|
5327
|
-
const rootStyle = rootStyleOf(node);
|
|
5328
|
-
if (node.children) for (const ch of node.children) {
|
|
5329
|
-
const before = boxes.length;
|
|
5330
|
-
walk(ch, rootStyle);
|
|
5331
|
-
if (boxes.length === before) {
|
|
5332
|
-
const s = resolveStyle(ch, rootStyle);
|
|
5333
|
-
const gf = glyphFontFor(s, glyphs, soleFont);
|
|
5334
|
-
const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
|
|
5335
|
-
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 });
|
|
5336
|
-
}
|
|
5337
|
-
}
|
|
5338
|
-
const rootContent = str(node[TEXT_CONTENT_ATTR]);
|
|
5339
|
-
if (rootContent && !((_e = node.children) == null ? void 0 : _e.length)) renderChars(rootContent, rootStyle);
|
|
5340
|
-
const anchor = str(node.textAnchor);
|
|
5341
|
-
if (anchor === "middle" || anchor === "end") {
|
|
5342
|
-
for (const b of boxes) {
|
|
5343
|
-
const w = lines[b.line].end - lines[b.line].start;
|
|
5344
|
-
b.x += anchor === "middle" ? -w / 2 : -w;
|
|
5345
|
-
}
|
|
5346
|
-
}
|
|
5347
|
-
return boxes.map((_f) => {
|
|
5348
|
-
var _g = _f, { line: _l } = _g, b = __objRest(_g, ["line"]);
|
|
5349
|
-
return b;
|
|
5350
|
-
});
|
|
5351
|
-
}
|
|
5352
|
-
function layoutGlyphTextCharsAlongPath(node, pathD, opts) {
|
|
5353
|
-
var _a2, _b;
|
|
5354
|
-
const { glyphs, warnings, alongPath } = opts;
|
|
5355
|
-
const sampler = createPathSampler(pathD);
|
|
5356
|
-
if (!sampler) {
|
|
5357
|
-
warnings == null ? void 0 : warnings.push("textGlyphs: unparsable along-path geometry (caret)");
|
|
5358
|
-
return [];
|
|
5359
|
-
}
|
|
5360
|
-
const soleFont = soleFontOf(glyphs);
|
|
5361
|
-
const chars = [];
|
|
5362
|
-
let adv = 0;
|
|
5363
|
-
const walk = (el, parentStyle) => {
|
|
5364
|
-
var _a3, _b2;
|
|
5365
|
-
const s = resolveStyle(el, parentStyle);
|
|
5366
|
-
const content = str(el[TEXT_CONTENT_ATTR]);
|
|
5367
|
-
if (content && !((_a3 = el.children) == null ? void 0 : _a3.length)) {
|
|
5368
|
-
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
5369
|
-
const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
|
|
5370
|
-
const scale = s.fontSize / upm;
|
|
5371
|
-
const ascent = ((_b2 = gf == null ? void 0 : gf.ascent) != null ? _b2 : 0.9 * upm) * scale;
|
|
5372
|
-
for (let i = 0; i < content.length; i++) {
|
|
5373
|
-
const ch = content.charAt(i);
|
|
5374
|
-
const g = gf == null ? void 0 : gf.glyphs[ch];
|
|
5375
|
-
const glyphW = (g ? g.width : 0) * scale;
|
|
5376
|
-
const advance = glyphW + s.letterSpacing + (ch === " " ? s.wordSpacing : 0);
|
|
5377
|
-
chars.push({ advStart: adv, advEnd: adv + advance, glyphW, ascent, fontSize: s.fontSize });
|
|
5378
|
-
adv += advance;
|
|
5379
|
-
}
|
|
5380
|
-
}
|
|
5381
|
-
if (el.children) for (const ch of el.children) walk(ch, s);
|
|
5382
|
-
};
|
|
5383
|
-
walk(node, rootStyleOf(node));
|
|
5384
|
-
const width = adv;
|
|
5385
|
-
const tlr = readAnimatable(alongPath == null ? void 0 : alongPath.textLength);
|
|
5386
|
-
const tlv = tlr.kind === "animated" /* Animated */ ? Number((_a2 = tlr.keyframes[0]) == null ? void 0 : _a2.value) || 0 : tlr.kind === "static" /* Static */ ? Number(tlr.value) || 0 : 0;
|
|
5387
|
-
const k = tlv > 0 && width > 0 ? tlv / width : 1;
|
|
5388
|
-
const so = readAnimatable(alongPath == null ? void 0 : alongPath.startOffset);
|
|
5389
|
-
const { along: alongOffset, perp } = alongPathNodeOffsets(node);
|
|
5390
|
-
const base = alongOffset + (so.kind === "animated" /* Animated */ ? Number((_b = so.keyframes[0]) == null ? void 0 : _b.value) || 0 : so.kind === "static" /* Static */ ? Number(so.value) || 0 : 0);
|
|
5391
|
-
const withPerp = (p) => ({
|
|
5392
|
-
x: p.x - perp * Math.sin(p.angle),
|
|
5393
|
-
y: p.y + perp * Math.cos(p.angle),
|
|
5394
|
-
angle: p.angle
|
|
5395
|
-
});
|
|
5396
|
-
return chars.map((c) => {
|
|
5397
|
-
const dStart = base + c.advStart * k;
|
|
5398
|
-
const dEnd = base + c.advEnd * k;
|
|
5399
|
-
const p0 = withPerp(sampler.sampleAtDistance(dStart));
|
|
5400
|
-
const p1 = withPerp(sampler.sampleAtDistance(dEnd));
|
|
5401
|
-
const glyphMid = sampler.sampleAtDistance(base + (c.advStart + c.glyphW / 2) * k);
|
|
5402
|
-
return {
|
|
5403
|
-
x: p0.x,
|
|
5404
|
-
y: p0.y,
|
|
5405
|
-
width: c.advEnd - c.advStart,
|
|
5406
|
-
ascent: c.ascent,
|
|
5407
|
-
fontSize: c.fontSize,
|
|
5408
|
-
endX: p1.x,
|
|
5409
|
-
endY: p1.y,
|
|
5410
|
-
rotation: glyphMid.angle * 180 / Math.PI
|
|
5411
|
-
};
|
|
5412
|
-
});
|
|
5413
|
-
}
|
|
5414
5174
|
function collectAlongPathCells(node, glyphs, soleFont, warnings) {
|
|
5415
5175
|
const cells = [];
|
|
5416
5176
|
let adv = 0;
|
|
5417
5177
|
const walk = (el, parentStyle) => {
|
|
5418
5178
|
var _a2, _b;
|
|
5419
5179
|
const s = resolveStyle(el, parentStyle);
|
|
5420
|
-
const content = str(el[
|
|
5180
|
+
const content = str(el[PX_TEXT_CONTENT_ATTR]);
|
|
5421
5181
|
if (content && !((_a2 = el.children) == null ? void 0 : _a2.length)) {
|
|
5422
5182
|
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
5423
5183
|
if (gf) {
|
|
@@ -5632,10 +5392,6 @@ function toGroup(node, children, create) {
|
|
|
5632
5392
|
}
|
|
5633
5393
|
return create("g", gProps, children);
|
|
5634
5394
|
}
|
|
5635
|
-
function materializeGlyphText(node, opts) {
|
|
5636
|
-
if (opts.alongPath) return materializeGlyphTextAlongPath(node, opts.alongPath.pathD, opts.alongPath.startOffset, opts, opts.alongPath.textLength, opts.alongPath.pathOverflow);
|
|
5637
|
-
return materializeGlyphTextHorizontal(node, opts);
|
|
5638
|
-
}
|
|
5639
5395
|
function applyTextGlyphsEffect(node, fx, ctx) {
|
|
5640
5396
|
if (!(fx == null ? void 0 : fx.useGlyphs)) return node;
|
|
5641
5397
|
if (!ctx.glyphs) {
|
|
@@ -5792,7 +5548,7 @@ function readScalarValues(r) {
|
|
|
5792
5548
|
if (r.kind === "static" /* Static */) return [r.value];
|
|
5793
5549
|
const out = [];
|
|
5794
5550
|
for (const kf of r.keyframes) {
|
|
5795
|
-
const v =
|
|
5551
|
+
const v = keyframeValue(kf);
|
|
5796
5552
|
if (typeof v === "number") out.push(v);
|
|
5797
5553
|
}
|
|
5798
5554
|
return out;
|
|
@@ -5803,9 +5559,9 @@ function computeAnimAttr(read, map) {
|
|
|
5803
5559
|
return {
|
|
5804
5560
|
kind: "animated" /* Animated */,
|
|
5805
5561
|
keyframes: read.keyframes.map((kf) => ({
|
|
5806
|
-
time:
|
|
5807
|
-
value: map(
|
|
5808
|
-
easing:
|
|
5562
|
+
time: keyframeTime(kf),
|
|
5563
|
+
value: map(keyframeValue(kf)),
|
|
5564
|
+
easing: keyframeEasing(kf)
|
|
5809
5565
|
})),
|
|
5810
5566
|
loop: read.loop
|
|
5811
5567
|
};
|
|
@@ -5823,7 +5579,7 @@ function computeOpacityFromRange(rangeRead) {
|
|
|
5823
5579
|
let anyHide = false;
|
|
5824
5580
|
let allHide = true;
|
|
5825
5581
|
for (const kf of kfs) {
|
|
5826
|
-
if (hide(
|
|
5582
|
+
if (hide(keyframeValue(kf))) anyHide = true;
|
|
5827
5583
|
else allHide = false;
|
|
5828
5584
|
}
|
|
5829
5585
|
if (!anyHide) return void 0;
|
|
@@ -5833,10 +5589,10 @@ function computeOpacityFromRange(rangeRead) {
|
|
|
5833
5589
|
const kf = kfs[i];
|
|
5834
5590
|
const prevKf = i > 0 ? kfs[i - 1] : void 0;
|
|
5835
5591
|
const nextKf = i < kfs.length - 1 ? kfs[i + 1] : void 0;
|
|
5836
|
-
const t =
|
|
5837
|
-
const thisHide = hide(
|
|
5838
|
-
const prevHide = prevKf ? thisHide && hide(
|
|
5839
|
-
const nextHide = nextKf ? thisHide && hide(
|
|
5592
|
+
const t = keyframeTime(kf);
|
|
5593
|
+
const thisHide = hide(keyframeValue(kf));
|
|
5594
|
+
const prevHide = prevKf ? thisHide && hide(keyframeValue(prevKf)) : thisHide;
|
|
5595
|
+
const nextHide = nextKf ? thisHide && hide(keyframeValue(nextKf)) : thisHide;
|
|
5840
5596
|
if (prevHide && !nextHide) {
|
|
5841
5597
|
out.push({ time: t, value: 0 });
|
|
5842
5598
|
out.push({ time: t + OPACITY_STEP_MS, value: 1 });
|
|
@@ -5852,9 +5608,9 @@ function readRangeWithCrossings(raw) {
|
|
|
5852
5608
|
const r = readAnimatable(raw);
|
|
5853
5609
|
if (r.kind !== "animated" /* Animated */) return r;
|
|
5854
5610
|
const kfs = r.keyframes.map((kf) => ({
|
|
5855
|
-
time:
|
|
5856
|
-
value:
|
|
5857
|
-
easing:
|
|
5611
|
+
time: keyframeTime(kf),
|
|
5612
|
+
value: keyframeValue(kf),
|
|
5613
|
+
easing: keyframeEasing(kf)
|
|
5858
5614
|
}));
|
|
5859
5615
|
const hasReverse = kfs.some((kf) => kf.value[0] > kf.value[1]);
|
|
5860
5616
|
if (!hasReverse) {
|
|
@@ -5982,7 +5738,7 @@ function shapeToPathD(node) {
|
|
|
5982
5738
|
}
|
|
5983
5739
|
|
|
5984
5740
|
// src/effects/PlayerEffectsUtil.ts
|
|
5985
|
-
function
|
|
5741
|
+
function materializeNodeEffects(root) {
|
|
5986
5742
|
var _a2, _b;
|
|
5987
5743
|
const ctx = {
|
|
5988
5744
|
defs: [],
|
|
@@ -5995,7 +5751,7 @@ function applyPlayerEffects(root) {
|
|
|
5995
5751
|
// Resolved engine: `frames` ONLY when explicitly set; auto/waapi/unset →
|
|
5996
5752
|
// waapi (we're not 100% sure it's frames, and CSS/WAAPI need the inline form).
|
|
5997
5753
|
engine: resolveTimelineEngine((_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.engine),
|
|
5998
|
-
glyphs: (_b =
|
|
5754
|
+
glyphs: (_b = getDefinitions(root)) == null ? void 0 : _b.fonts
|
|
5999
5755
|
};
|
|
6000
5756
|
const working = clone(root);
|
|
6001
5757
|
indexById(working, ctx.idMap);
|
|
@@ -6079,11 +5835,11 @@ function buildOffsetPath(propAnim) {
|
|
|
6079
5835
|
if (propAnim.alongPathMode !== "offsetPath") return void 0;
|
|
6080
5836
|
const kfs = propAnim.keyframes;
|
|
6081
5837
|
if (!kfs || kfs.length < 2) return void 0;
|
|
6082
|
-
const first =
|
|
5838
|
+
const first = keyframeValue(kfs[0]);
|
|
6083
5839
|
const anchor = (first == null ? void 0 : first.origin) && first.origin.length >= 2 ? [first.origin[0], first.origin[1]] : [0, 0];
|
|
6084
5840
|
const points = [];
|
|
6085
5841
|
for (const kf of kfs) {
|
|
6086
|
-
const v =
|
|
5842
|
+
const v = keyframeValue(kf);
|
|
6087
5843
|
const tr = v == null ? void 0 : v.translate;
|
|
6088
5844
|
if (!tr || tr.length < 2) return void 0;
|
|
6089
5845
|
const parts = Object.keys(v);
|
|
@@ -6092,13 +5848,13 @@ function buildOffsetPath(propAnim) {
|
|
|
6092
5848
|
if (o[0] !== anchor[0] || o[1] !== anchor[1]) return void 0;
|
|
6093
5849
|
points.push([tr[0] + anchor[0], tr[1] + anchor[1]]);
|
|
6094
5850
|
}
|
|
6095
|
-
if (!kfs.some((kf) =>
|
|
5851
|
+
if (!kfs.some((kf) => keyframeTangentIn(kf) || keyframeTangentOut(kf))) return void 0;
|
|
6096
5852
|
let d = "M" + fmt2(points[0][0]) + "," + fmt2(points[0][1]);
|
|
6097
5853
|
const segLens = [];
|
|
6098
5854
|
for (let i = 0; i < points.length - 1; i++) {
|
|
6099
5855
|
const p0 = points[i], p1 = points[i + 1];
|
|
6100
|
-
const to = (_b =
|
|
6101
|
-
const ti = (_c =
|
|
5856
|
+
const to = (_b = keyframeTangentOut(kfs[i])) != null ? _b : [0, 0];
|
|
5857
|
+
const ti = (_c = keyframeTangentIn(kfs[i + 1])) != null ? _c : [0, 0];
|
|
6102
5858
|
const c1 = [p0[0] + to[0], p0[1] + to[1]];
|
|
6103
5859
|
const c2 = [p1[0] + ti[0], p1[1] + ti[1]];
|
|
6104
5860
|
d += "C" + fmt2(c1[0]) + "," + fmt2(c1[1]) + "," + fmt2(c2[0]) + "," + fmt2(c2[1]) + "," + fmt2(p1[0]) + "," + fmt2(p1[1]);
|
|
@@ -6110,8 +5866,8 @@ function buildOffsetPath(propAnim) {
|
|
|
6110
5866
|
let cum = 0;
|
|
6111
5867
|
for (let i = 0; i < kfs.length; i++) {
|
|
6112
5868
|
if (i > 0) cum += segLens[i - 1];
|
|
6113
|
-
const out = { t:
|
|
6114
|
-
const e =
|
|
5869
|
+
const out = { t: keyframeTime(kfs[i]), v: cum / total };
|
|
5870
|
+
const e = keyframeEasing(kfs[i]);
|
|
6115
5871
|
if (e !== void 0) out.e = e;
|
|
6116
5872
|
distanceKfs.push(out);
|
|
6117
5873
|
}
|
|
@@ -6310,14 +6066,14 @@ function walkAndMaterialize2(node, idMap, animatedIds, genId3, defsCollector, ro
|
|
|
6310
6066
|
}
|
|
6311
6067
|
|
|
6312
6068
|
// src/materialize/PxAnimatorMaterializeAll.ts
|
|
6313
|
-
function materializeAllInTree(doc, engine,
|
|
6069
|
+
function materializeAllInTree(doc, engine, options) {
|
|
6314
6070
|
var _a2, _b;
|
|
6315
|
-
let root =
|
|
6071
|
+
let root = materializeNodeEffects(doc).root;
|
|
6316
6072
|
root = materializeOffsetPathsInTree(root);
|
|
6317
|
-
const duration = (_b = (_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.duration) != null ? _b :
|
|
6073
|
+
const duration = (_b = (_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.duration) != null ? _b : PX_DEFAULT_DURATION_MS;
|
|
6318
6074
|
root = materializeInternalLoopsInTree(root, duration);
|
|
6319
6075
|
if (engine === PxTimelineEngine.native) {
|
|
6320
|
-
root = materializeMotionPathsInTree(root,
|
|
6076
|
+
root = materializeMotionPathsInTree(root, options == null ? void 0 : options.motionPath);
|
|
6321
6077
|
root = materializeAnimatedUseInstances(root);
|
|
6322
6078
|
root = pruneUnreferencedDefs(root);
|
|
6323
6079
|
}
|
|
@@ -6427,16 +6183,16 @@ function cancelFrame(handle) {
|
|
|
6427
6183
|
}
|
|
6428
6184
|
g.clearTimeout(handle);
|
|
6429
6185
|
}
|
|
6430
|
-
function
|
|
6186
|
+
function createAdapterAnimator(doc, adapter, callbacks) {
|
|
6431
6187
|
var _a2;
|
|
6432
6188
|
const config = getAnimatorConfig(doc) || {};
|
|
6433
|
-
const bindings =
|
|
6189
|
+
const bindings = normalizeBindings(doc, PxTimelineEngine.js);
|
|
6434
6190
|
const _iterations = config.iterations;
|
|
6435
6191
|
let iterations = 1;
|
|
6436
6192
|
if (typeof _iterations === "number") iterations = _iterations || 1;
|
|
6437
6193
|
if (_iterations === "infinite") iterations = Infinity;
|
|
6438
6194
|
if (iterations < 1) iterations = 1;
|
|
6439
|
-
const duration = +(config.duration ||
|
|
6195
|
+
const duration = +(config.duration || PX_DEFAULT_DURATION_MS);
|
|
6440
6196
|
const totalDuration = duration && iterations ? duration * (iterations === Infinity ? Infinity : iterations) : duration ? (iterations != null ? iterations : 1) * duration : 0;
|
|
6441
6197
|
const direction = config.direction || "normal";
|
|
6442
6198
|
const fill = (_a2 = config.fill) != null ? _a2 : "forwards";
|
|
@@ -6694,6 +6450,38 @@ function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
|
|
|
6694
6450
|
return api;
|
|
6695
6451
|
}
|
|
6696
6452
|
|
|
6453
|
+
// src/playback/PxDiagnosticCode.ts
|
|
6454
|
+
var PxDiagnosticCode = /* @__PURE__ */ ((PxDiagnosticCode2) => {
|
|
6455
|
+
PxDiagnosticCode2[PxDiagnosticCode2["buildFailed"] = 1001] = "buildFailed";
|
|
6456
|
+
PxDiagnosticCode2[PxDiagnosticCode2["invalidDocumentAtSrc"] = 1002] = "invalidDocumentAtSrc";
|
|
6457
|
+
PxDiagnosticCode2[PxDiagnosticCode2["loadFailed"] = 1003] = "loadFailed";
|
|
6458
|
+
PxDiagnosticCode2[PxDiagnosticCode2["animationBuildFailed"] = 1004] = "animationBuildFailed";
|
|
6459
|
+
PxDiagnosticCode2[PxDiagnosticCode2["effectsShape"] = 1101] = "effectsShape";
|
|
6460
|
+
PxDiagnosticCode2[PxDiagnosticCode2["timelineOverrideIgnored"] = 1102] = "timelineOverrideIgnored";
|
|
6461
|
+
PxDiagnosticCode2[PxDiagnosticCode2["blockedTag"] = 1103] = "blockedTag";
|
|
6462
|
+
PxDiagnosticCode2[PxDiagnosticCode2["unsupportedAnimatedAttrs"] = 1104] = "unsupportedAnimatedAttrs";
|
|
6463
|
+
PxDiagnosticCode2[PxDiagnosticCode2["noBindings"] = 1105] = "noBindings";
|
|
6464
|
+
PxDiagnosticCode2[PxDiagnosticCode2["unresolvedBinding"] = 1106] = "unresolvedBinding";
|
|
6465
|
+
PxDiagnosticCode2[PxDiagnosticCode2["triggersNoRoot"] = 1201] = "triggersNoRoot";
|
|
6466
|
+
PxDiagnosticCode2[PxDiagnosticCode2["noRootForSelector"] = 1202] = "noRootForSelector";
|
|
6467
|
+
PxDiagnosticCode2[PxDiagnosticCode2["noRootElement"] = 1203] = "noRootElement";
|
|
6468
|
+
PxDiagnosticCode2[PxDiagnosticCode2["noElementsForSelector"] = 1206] = "noElementsForSelector";
|
|
6469
|
+
PxDiagnosticCode2[PxDiagnosticCode2["setAttributeNoElement"] = 1207] = "setAttributeNoElement";
|
|
6470
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollSmoothingNeedsOwnDriver"] = 1301] = "scrollSmoothingNeedsOwnDriver";
|
|
6471
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollNativeUnavailable"] = 1302] = "scrollNativeUnavailable";
|
|
6472
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollSubjectInvalid"] = 1303] = "scrollSubjectInvalid";
|
|
6473
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollSubjectNoMatch"] = 1304] = "scrollSubjectNoMatch";
|
|
6474
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollNoRootToObserve"] = 1305] = "scrollNoRootToObserve";
|
|
6475
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollTriggerIgnored"] = 1306] = "scrollTriggerIgnored";
|
|
6476
|
+
PxDiagnosticCode2[PxDiagnosticCode2["rateRejected"] = 1401] = "rateRejected";
|
|
6477
|
+
PxDiagnosticCode2[PxDiagnosticCode2["controlPropsConflict"] = 1501] = "controlPropsConflict";
|
|
6478
|
+
PxDiagnosticCode2[PxDiagnosticCode2["rnCompileFailed"] = 1601] = "rnCompileFailed";
|
|
6479
|
+
PxDiagnosticCode2[PxDiagnosticCode2["rnRenderFailed"] = 1602] = "rnRenderFailed";
|
|
6480
|
+
PxDiagnosticCode2[PxDiagnosticCode2["rnBoundaryCaught"] = 1603] = "rnBoundaryCaught";
|
|
6481
|
+
PxDiagnosticCode2[PxDiagnosticCode2["rnUnsupported"] = 1604] = "rnUnsupported";
|
|
6482
|
+
return PxDiagnosticCode2;
|
|
6483
|
+
})(PxDiagnosticCode || {});
|
|
6484
|
+
|
|
6697
6485
|
// src/playback/PxDiagnostics.ts
|
|
6698
6486
|
var PxDiagnosticKind = {
|
|
6699
6487
|
/** The document is wrong — regenerate or repair the file. */
|
|
@@ -6707,35 +6495,6 @@ var PxDiagnosticKind = {
|
|
|
6707
6495
|
/** The player failed where it did not expect to — report it to us. */
|
|
6708
6496
|
internal: "internal"
|
|
6709
6497
|
};
|
|
6710
|
-
function asError(error) {
|
|
6711
|
-
return typeof error === "string" ? new Error(error) : error;
|
|
6712
|
-
}
|
|
6713
|
-
function createDiagnostics(config, prefix) {
|
|
6714
|
-
const tag = prefix ? prefix + " " : "";
|
|
6715
|
-
return {
|
|
6716
|
-
warn: (kind, message, detail) => {
|
|
6717
|
-
if (config == null ? void 0 : config.onWarn) {
|
|
6718
|
-
config.onWarn({ kind, message, detail });
|
|
6719
|
-
return;
|
|
6720
|
-
}
|
|
6721
|
-
if (config == null ? void 0 : config.muteWarn) return;
|
|
6722
|
-
const line = tag + kind + ": " + message;
|
|
6723
|
-
if (detail === void 0) console.warn(line);
|
|
6724
|
-
else console.warn(line, detail);
|
|
6725
|
-
},
|
|
6726
|
-
error: (kind, error, detail) => {
|
|
6727
|
-
const err = asError(error);
|
|
6728
|
-
if (config == null ? void 0 : config.onError) {
|
|
6729
|
-
config.onError({ kind, message: err.message, error: err, detail });
|
|
6730
|
-
return;
|
|
6731
|
-
}
|
|
6732
|
-
if (config == null ? void 0 : config.muteError) return;
|
|
6733
|
-
const line = tag + kind + ": " + err.message;
|
|
6734
|
-
if (detail === void 0) console.error(line);
|
|
6735
|
-
else console.error(line, detail);
|
|
6736
|
-
}
|
|
6737
|
-
};
|
|
6738
|
-
}
|
|
6739
6498
|
|
|
6740
6499
|
// src/playback/PxAnimatorConfigPatch.ts
|
|
6741
6500
|
var FLAT_ONLY_KEYS = [
|
|
@@ -6855,9 +6614,9 @@ function mergeAnimatorConfig(base, patch) {
|
|
|
6855
6614
|
}
|
|
6856
6615
|
return { config: out, warnings };
|
|
6857
6616
|
}
|
|
6858
|
-
function applyAnimatorConfig(doc, patch,
|
|
6617
|
+
function applyAnimatorConfig(doc, patch, options) {
|
|
6859
6618
|
var _a2, _b;
|
|
6860
|
-
const reset = !!(
|
|
6619
|
+
const reset = !!(options == null ? void 0 : options.resetTimeline);
|
|
6861
6620
|
if (!doc || (patch === void 0 || !reset && (patch === null || !isPlainObject(patch) || !Object.keys(patch).length))) {
|
|
6862
6621
|
return { doc, warnings: [] };
|
|
6863
6622
|
}
|
|
@@ -6890,7 +6649,6 @@ function applyAnimatorConfig(doc, patch, opts) {
|
|
|
6890
6649
|
}
|
|
6891
6650
|
|
|
6892
6651
|
// src/format/PxDocumentDiagnostic.ts
|
|
6893
|
-
var MAX_REPORTED = 6;
|
|
6894
6652
|
function diagnoseDocument(doc) {
|
|
6895
6653
|
try {
|
|
6896
6654
|
return { problems: validateDocument(doc) };
|
|
@@ -6898,421 +6656,16 @@ function diagnoseDocument(doc) {
|
|
|
6898
6656
|
return { problems: [] };
|
|
6899
6657
|
}
|
|
6900
6658
|
}
|
|
6901
|
-
function reportDocumentDiagnostics(doc, where) {
|
|
6902
|
-
const { problems } = diagnoseDocument(doc);
|
|
6903
|
-
if (!problems.length) return;
|
|
6904
|
-
const shown = problems.slice(0, MAX_REPORTED);
|
|
6905
|
-
const more = problems.length - shown.length;
|
|
6906
|
-
console.warn(
|
|
6907
|
-
where + ": this document does not match the animation schema in " + problems.length + " place" + (problems.length === 1 ? "" : "s") + ".\n" + shown.map((p) => " - " + p).join("\n") + (more > 0 ? "\n \u2026 and " + more + " more" : "") + "\n\nIf you did not author these keys, the usual cause is a build that MANGLES PROPERTY NAMES. An animation document is data loaded at runtime, so renaming the property reads inside the player stops them matching the keys in the JSON, and the animation silently does nothing. Feed the published reserved-name list to your minifier \u2014 @pixodesk/svg-animator-web/mangle-reserved.json \u2014 see docs/library/minification.md."
|
|
6908
|
-
);
|
|
6909
|
-
}
|
|
6910
|
-
|
|
6911
|
-
// src/effects/PlayerEffectsUtil.visualModel.ts
|
|
6912
|
-
var IDENTITY = [1, 0, 0, 1, 0, 0];
|
|
6913
|
-
function mul(m, n) {
|
|
6914
|
-
return [
|
|
6915
|
-
m[0] * n[0] + m[2] * n[1],
|
|
6916
|
-
m[1] * n[0] + m[3] * n[1],
|
|
6917
|
-
m[0] * n[2] + m[2] * n[3],
|
|
6918
|
-
m[1] * n[2] + m[3] * n[3],
|
|
6919
|
-
m[0] * n[4] + m[2] * n[5] + m[4],
|
|
6920
|
-
m[1] * n[4] + m[3] * n[5] + m[5]
|
|
6921
|
-
];
|
|
6922
|
-
}
|
|
6923
|
-
var translateM = (x, y) => [1, 0, 0, 1, x, y];
|
|
6924
|
-
var scaleM = (sx, sy) => [sx, 0, 0, sy, 0, 0];
|
|
6925
|
-
function rotateM(deg) {
|
|
6926
|
-
const r = deg * Math.PI / 180;
|
|
6927
|
-
return [Math.cos(r), Math.sin(r), -Math.sin(r), Math.cos(r), 0, 0];
|
|
6928
|
-
}
|
|
6929
|
-
var skewXM = (deg) => [1, 0, Math.tan(deg * Math.PI / 180), 1, 0, 0];
|
|
6930
|
-
var skewYM = (deg) => [1, Math.tan(deg * Math.PI / 180), 0, 1, 0, 0];
|
|
6931
|
-
function parseTransformString(s) {
|
|
6932
|
-
let m = IDENTITY;
|
|
6933
|
-
const re = /(translate|rotate|scale|matrix|skewX|skewY)\(([^)]*)\)/g;
|
|
6934
|
-
let hit;
|
|
6935
|
-
while (hit = re.exec(s)) {
|
|
6936
|
-
const fn = hit[1];
|
|
6937
|
-
const a = hit[2].split(/[\s,]+/).filter(Boolean).map(Number);
|
|
6938
|
-
if (fn === "translate") m = mul(m, translateM(a[0] || 0, a[1] || 0));
|
|
6939
|
-
else if (fn === "scale") m = mul(m, scaleM(a[0], a.length > 1 ? a[1] : a[0]));
|
|
6940
|
-
else if (fn === "rotate") m = mul(m, rotateM(a[0]));
|
|
6941
|
-
else if (fn === "skewX") m = mul(m, skewXM(a[0]));
|
|
6942
|
-
else if (fn === "skewY") m = mul(m, skewYM(a[0]));
|
|
6943
|
-
else if (fn === "matrix") m = mul(m, [a[0], a[1], a[2], a[3], a[4], a[5]]);
|
|
6944
|
-
}
|
|
6945
|
-
return m;
|
|
6946
|
-
}
|
|
6947
|
-
function partsToMatrix(p) {
|
|
6948
|
-
let m = IDENTITY;
|
|
6949
|
-
if (p.translate) m = mul(m, translateM(p.translate[0], p.translate[1]));
|
|
6950
|
-
const pivot = p.origin && (p.rotate !== void 0 || p.scale);
|
|
6951
|
-
if (pivot) m = mul(m, translateM(p.origin[0], p.origin[1]));
|
|
6952
|
-
if (p.rotate !== void 0) m = mul(m, rotateM(p.rotate));
|
|
6953
|
-
if (p.scale) m = mul(m, scaleM(p.scale[0], p.scale[1]));
|
|
6954
|
-
if (pivot) m = mul(m, translateM(-p.origin[0], -p.origin[1]));
|
|
6955
|
-
return m;
|
|
6956
|
-
}
|
|
6957
|
-
function lerp(a, b, f) {
|
|
6958
|
-
return a + (b - a) * f;
|
|
6959
|
-
}
|
|
6960
|
-
function interpParts(kfs, t) {
|
|
6961
|
-
var _a2, _b, _c, _d, _e, _f, _g;
|
|
6962
|
-
if (!kfs.length) return {};
|
|
6963
|
-
if (t <= ((_a2 = kfs[0].time) != null ? _a2 : 0)) return kfs[0].value || {};
|
|
6964
|
-
if (t >= ((_b = kfs[kfs.length - 1].time) != null ? _b : 0)) return kfs[kfs.length - 1].value || {};
|
|
6965
|
-
let i = 0;
|
|
6966
|
-
while (i < kfs.length - 1 && ((_c = kfs[i + 1].time) != null ? _c : 0) < t) i++;
|
|
6967
|
-
const a = kfs[i], b = kfs[i + 1];
|
|
6968
|
-
const f = (t - ((_d = a.time) != null ? _d : 0)) / (((_e = b.time) != null ? _e : 0) - ((_f = a.time) != null ? _f : 0) || 1);
|
|
6969
|
-
const va = a.value || {}, vb = b.value || {};
|
|
6970
|
-
const out = {};
|
|
6971
|
-
if (va.translate && vb.translate) out.translate = [lerp(va.translate[0], vb.translate[0], f), lerp(va.translate[1], vb.translate[1], f)];
|
|
6972
|
-
else out.translate = va.translate || vb.translate;
|
|
6973
|
-
if (va.rotate !== void 0 && vb.rotate !== void 0) out.rotate = lerp(va.rotate, vb.rotate, f);
|
|
6974
|
-
else out.rotate = (_g = va.rotate) != null ? _g : vb.rotate;
|
|
6975
|
-
if (va.scale && vb.scale) out.scale = [lerp(va.scale[0], vb.scale[0], f), lerp(va.scale[1], vb.scale[1], f)];
|
|
6976
|
-
else out.scale = va.scale || vb.scale;
|
|
6977
|
-
out.origin = va.origin || vb.origin;
|
|
6978
|
-
return out;
|
|
6979
|
-
}
|
|
6980
|
-
function evalTransformValue(v, t) {
|
|
6981
|
-
if (v === void 0 || v === null) return IDENTITY;
|
|
6982
|
-
if (typeof v === "string") return parseTransformString(v);
|
|
6983
|
-
if (v.keyframes) return partsToMatrix(interpParts(v.keyframes, t));
|
|
6984
|
-
if (v.value) return partsToMatrix(v.value);
|
|
6985
|
-
if (typeof v === "object" && !Array.isArray(v)) return partsToMatrix(v);
|
|
6986
|
-
return IDENTITY;
|
|
6987
|
-
}
|
|
6988
|
-
function nodeMatrix(node, t) {
|
|
6989
|
-
if (node.animate && node.animate.transform) return evalTransformValue(node.animate.transform, t);
|
|
6990
|
-
if (node.transform !== void 0) return evalTransformValue(node.transform, t);
|
|
6991
|
-
return IDENTITY;
|
|
6992
|
-
}
|
|
6993
|
-
function evalScalar(animated, staticVal, fallback, t) {
|
|
6994
|
-
var _a2, _b, _c, _d, _e, _f;
|
|
6995
|
-
if (animated && animated.keyframes && animated.keyframes.length) {
|
|
6996
|
-
const kfs = animated.keyframes;
|
|
6997
|
-
if (t <= ((_a2 = kfs[0].time) != null ? _a2 : 0)) return kfs[0].value;
|
|
6998
|
-
if (t >= ((_b = kfs[kfs.length - 1].time) != null ? _b : 0)) return kfs[kfs.length - 1].value;
|
|
6999
|
-
let i = 0;
|
|
7000
|
-
while (i < kfs.length - 1 && ((_c = kfs[i + 1].time) != null ? _c : 0) < t) i++;
|
|
7001
|
-
const a = kfs[i], b = kfs[i + 1];
|
|
7002
|
-
const f = (t - ((_d = a.time) != null ? _d : 0)) / (((_e = b.time) != null ? _e : 0) - ((_f = a.time) != null ? _f : 0) || 1);
|
|
7003
|
-
return lerp(a.value, b.value, f);
|
|
7004
|
-
}
|
|
7005
|
-
return staticVal !== void 0 ? Number(staticVal) : fallback;
|
|
7006
|
-
}
|
|
7007
|
-
var CONTAINER_TYPES = /* @__PURE__ */ new Set(["svg", "g", "symbol"]);
|
|
7008
|
-
var SKIP_TYPES = /* @__PURE__ */ new Set(["defs", "mask", "clipPath", "title"]);
|
|
7009
|
-
function buildIdMap2(node, map) {
|
|
7010
|
-
var _a2;
|
|
7011
|
-
if (typeof node.id === "string") map.set(node.id, node);
|
|
7012
|
-
(_a2 = node.children) == null ? void 0 : _a2.forEach((c) => buildIdMap2(c, map));
|
|
7013
|
-
}
|
|
7014
|
-
function num(v) {
|
|
7015
|
-
return v === void 0 || v === null ? 0 : Number(v);
|
|
7016
|
-
}
|
|
7017
|
-
function round(n) {
|
|
7018
|
-
return Math.round(n * 100) / 100 + 0;
|
|
7019
|
-
}
|
|
7020
|
-
function geomKey(node) {
|
|
7021
|
-
var _a2;
|
|
7022
|
-
switch (node.type) {
|
|
7023
|
-
case "rect":
|
|
7024
|
-
return num(node.width) + "," + num(node.height) + "," + num(node.x) + "," + num(node.y);
|
|
7025
|
-
case "ellipse":
|
|
7026
|
-
return num(node.rx) + "," + num(node.ry) + "," + num(node.cx) + "," + num(node.cy);
|
|
7027
|
-
case "circle":
|
|
7028
|
-
return num(node.r) + "," + num(node.cx) + "," + num(node.cy);
|
|
7029
|
-
case "path":
|
|
7030
|
-
return String((_a2 = node.d) != null ? _a2 : "");
|
|
7031
|
-
default:
|
|
7032
|
-
return "";
|
|
7033
|
-
}
|
|
7034
|
-
}
|
|
7035
|
-
function describePrimitive(node, m, t) {
|
|
7036
|
-
var _a2, _b, _c, _d, _e;
|
|
7037
|
-
const fill = (_a2 = node.fill) != null ? _a2 : "";
|
|
7038
|
-
const stroke = (_b = node.stroke) != null ? _b : "";
|
|
7039
|
-
const sw = (_d = (_c = node["stroke-width"]) != null ? _c : node.strokeWidth) != null ? _d : "";
|
|
7040
|
-
const opacity = round(evalScalar((_e = node.animate) == null ? void 0 : _e.opacity, node.opacity, 1, t));
|
|
7041
|
-
const masked = node.mask ? 1 : 0;
|
|
7042
|
-
const mat = m.map(round).join(",");
|
|
7043
|
-
return node.type + "|" + geomKey(node) + "|[" + mat + "]|f:" + fill + "|s:" + stroke + "|sw:" + (num(sw) || "") + "|o:" + opacity + "|m:" + masked;
|
|
7044
|
-
}
|
|
7045
|
-
function flatten(node, parent, t, idMap, out) {
|
|
7046
|
-
var _a2;
|
|
7047
|
-
const type = node.type || "";
|
|
7048
|
-
if (SKIP_TYPES.has(type)) return;
|
|
7049
|
-
const m = mul(parent, nodeMatrix(node, t));
|
|
7050
|
-
if (type === "use") {
|
|
7051
|
-
const targetId = typeof node.href === "string" ? node.href.replace(/^#/, "") : "";
|
|
7052
|
-
const target = idMap.get(targetId);
|
|
7053
|
-
const useM = mul(m, translateM(num(node.x), num(node.y)));
|
|
7054
|
-
if (target) flatten(target, useM, t, idMap, out);
|
|
7055
|
-
else out.push("UNRESOLVED_USE:#" + targetId);
|
|
7056
|
-
return;
|
|
7057
|
-
}
|
|
7058
|
-
if (CONTAINER_TYPES.has(type)) {
|
|
7059
|
-
(_a2 = node.children) == null ? void 0 : _a2.forEach((c) => flatten(c, m, t, idMap, out));
|
|
7060
|
-
return;
|
|
7061
|
-
}
|
|
7062
|
-
out.push(describePrimitive(node, m, t));
|
|
7063
|
-
}
|
|
7064
|
-
function collectSampleTimes(node, into) {
|
|
7065
|
-
var _a2;
|
|
7066
|
-
into.add(0);
|
|
7067
|
-
const scanAnim = (anim) => {
|
|
7068
|
-
var _a3;
|
|
7069
|
-
if (!anim || typeof anim !== "object") return;
|
|
7070
|
-
for (const key of Object.keys(anim)) {
|
|
7071
|
-
const kfs = (_a3 = anim[key]) == null ? void 0 : _a3.keyframes;
|
|
7072
|
-
if (Array.isArray(kfs)) kfs.forEach((kf) => {
|
|
7073
|
-
var _a4;
|
|
7074
|
-
return into.add((_a4 = kf.time) != null ? _a4 : 0);
|
|
7075
|
-
});
|
|
7076
|
-
}
|
|
7077
|
-
};
|
|
7078
|
-
scanAnim(node.animate);
|
|
7079
|
-
if (node.transform && typeof node.transform === "object" && node.transform.keyframes) {
|
|
7080
|
-
node.transform.keyframes.forEach((kf) => {
|
|
7081
|
-
var _a3;
|
|
7082
|
-
return into.add((_a3 = kf.time) != null ? _a3 : 0);
|
|
7083
|
-
});
|
|
7084
|
-
}
|
|
7085
|
-
(_a2 = node.children) == null ? void 0 : _a2.forEach((c) => collectSampleTimes(c, into));
|
|
7086
|
-
}
|
|
7087
|
-
function visualModelAt(root, t) {
|
|
7088
|
-
const idMap = /* @__PURE__ */ new Map();
|
|
7089
|
-
buildIdMap2(root, idMap);
|
|
7090
|
-
const out = [];
|
|
7091
|
-
flatten(root, IDENTITY, t, idMap, out);
|
|
7092
|
-
return out.sort();
|
|
7093
|
-
}
|
|
7094
|
-
function diffInEffect(a, b) {
|
|
7095
|
-
const times = /* @__PURE__ */ new Set();
|
|
7096
|
-
collectSampleTimes(a, times);
|
|
7097
|
-
collectSampleTimes(b, times);
|
|
7098
|
-
const diffs = [];
|
|
7099
|
-
for (const t of Array.from(times).sort((x, y) => x - y)) {
|
|
7100
|
-
const ma = visualModelAt(a, t);
|
|
7101
|
-
const mb = visualModelAt(b, t);
|
|
7102
|
-
const onlyInA = subtractMultiset(ma, mb);
|
|
7103
|
-
const onlyInB = subtractMultiset(mb, ma);
|
|
7104
|
-
if (onlyInA.length || onlyInB.length) diffs.push({ time: t, onlyInA, onlyInB });
|
|
7105
|
-
}
|
|
7106
|
-
return diffs;
|
|
7107
|
-
}
|
|
7108
|
-
function subtractMultiset(a, b) {
|
|
7109
|
-
const counts = /* @__PURE__ */ new Map();
|
|
7110
|
-
for (const x of b) counts.set(x, (counts.get(x) || 0) + 1);
|
|
7111
|
-
const extra = [];
|
|
7112
|
-
for (const x of a) {
|
|
7113
|
-
const c = counts.get(x) || 0;
|
|
7114
|
-
if (c > 0) counts.set(x, c - 1);
|
|
7115
|
-
else extra.push(x);
|
|
7116
|
-
}
|
|
7117
|
-
return extra;
|
|
7118
|
-
}
|
|
7119
|
-
|
|
7120
|
-
// src/playback/PxScrollMath.ts
|
|
7121
|
-
function isScrollTimeline(config) {
|
|
7122
|
-
return (config == null ? void 0 : config.timelineSource) === "scroll";
|
|
7123
|
-
}
|
|
7124
|
-
function scrollTotalDurationMs(config) {
|
|
7125
|
-
const duration = typeof (config == null ? void 0 : config.duration) === "number" && config.duration > 0 ? config.duration : DEFAULT_DURATION_MS;
|
|
7126
|
-
const iterations = typeof (config == null ? void 0 : config.iterations) === "number" && config.iterations > 0 ? config.iterations : 1;
|
|
7127
|
-
return duration * iterations;
|
|
7128
|
-
}
|
|
7129
|
-
function scrollPhaseInterval(phase, subjectSize, scrollportSize) {
|
|
7130
|
-
const s = subjectSize, vp = scrollportSize;
|
|
7131
|
-
switch (phase) {
|
|
7132
|
-
case "cover":
|
|
7133
|
-
return [0, s + vp];
|
|
7134
|
-
case "entry":
|
|
7135
|
-
return [0, Math.min(s, vp)];
|
|
7136
|
-
case "contain":
|
|
7137
|
-
return [Math.min(s, vp), Math.max(s, vp)];
|
|
7138
|
-
case "exit":
|
|
7139
|
-
return [Math.max(s, vp), s + vp];
|
|
7140
|
-
case "entry-crossing":
|
|
7141
|
-
return [0, s];
|
|
7142
|
-
case "exit-crossing":
|
|
7143
|
-
return [vp, s + vp];
|
|
7144
|
-
}
|
|
7145
|
-
}
|
|
7146
|
-
var DEFAULT_PHASE = "cover";
|
|
7147
|
-
function resolveRangePointU(point, defaultFraction, subjectSize, scrollportSize) {
|
|
7148
|
-
var _a2;
|
|
7149
|
-
const [u0, u1] = scrollPhaseInterval((_a2 = point == null ? void 0 : point.phase) != null ? _a2 : DEFAULT_PHASE, subjectSize, scrollportSize);
|
|
7150
|
-
const fraction = typeof (point == null ? void 0 : point.fraction) === "number" ? point.fraction : defaultFraction;
|
|
7151
|
-
return u0 + fraction * (u1 - u0);
|
|
7152
|
-
}
|
|
7153
|
-
function scrollViewProgress(subjectStart, subjectSize, scrollportSize, range) {
|
|
7154
|
-
const u = scrollportSize - subjectStart;
|
|
7155
|
-
const uStart = resolveRangePointU(range == null ? void 0 : range.start, 0, subjectSize, scrollportSize);
|
|
7156
|
-
const uEnd = resolveRangePointU(range == null ? void 0 : range.end, 1, subjectSize, scrollportSize);
|
|
7157
|
-
if (uEnd <= uStart) return u >= uEnd ? 1 : 0;
|
|
7158
|
-
return clamp((u - uStart) / (uEnd - uStart), 0, 1);
|
|
7159
|
-
}
|
|
7160
|
-
function scrollOffsetProgress(offset, maxOffset, range) {
|
|
7161
|
-
var _a2, _b;
|
|
7162
|
-
const raw = maxOffset > 0 ? clamp(offset / maxOffset, 0, 1) : 1;
|
|
7163
|
-
const start = typeof ((_a2 = range == null ? void 0 : range.start) == null ? void 0 : _a2.fraction) === "number" ? range.start.fraction : 0;
|
|
7164
|
-
const end = typeof ((_b = range == null ? void 0 : range.end) == null ? void 0 : _b.fraction) === "number" ? range.end.fraction : 1;
|
|
7165
|
-
if (end <= start) return raw >= end ? 1 : 0;
|
|
7166
|
-
return clamp((raw - start) / (end - start), 0, 1);
|
|
7167
|
-
}
|
|
7168
|
-
function scrollResolveAxis(axis, writingMode) {
|
|
7169
|
-
const a = axis != null ? axis : "block";
|
|
7170
|
-
if (a === "x" || a === "y") return a;
|
|
7171
|
-
const vertical = !!writingMode && writingMode.startsWith("vertical");
|
|
7172
|
-
if (a === "inline") return vertical ? "y" : "x";
|
|
7173
|
-
return vertical ? "x" : "y";
|
|
7174
|
-
}
|
|
7175
|
-
|
|
7176
|
-
// src/version/PxSchemaFieldUniverse.ts
|
|
7177
|
-
function schemaFieldUniverse(root) {
|
|
7178
|
-
const fields = /* @__PURE__ */ new Set();
|
|
7179
|
-
const enumerated = /* @__PURE__ */ new Set();
|
|
7180
|
-
const queue = [{ schema: root, path: "" }];
|
|
7181
|
-
while (queue.length) {
|
|
7182
|
-
const { schema, path } = queue.shift();
|
|
7183
|
-
const d = describeSchema(schema);
|
|
7184
|
-
switch (d.kind) {
|
|
7185
|
-
case "shape": {
|
|
7186
|
-
if (enumerated.has(schema)) break;
|
|
7187
|
-
enumerated.add(schema);
|
|
7188
|
-
for (const key of Object.keys(d.shape)) {
|
|
7189
|
-
const id = path ? path + "." + key : key;
|
|
7190
|
-
fields.add(id);
|
|
7191
|
-
queue.push({ schema: d.shape[key], path: id });
|
|
7192
|
-
}
|
|
7193
|
-
if (d.openValue) queue.push({ schema: d.openValue, path: path + "{*}" });
|
|
7194
|
-
break;
|
|
7195
|
-
}
|
|
7196
|
-
case "optional":
|
|
7197
|
-
queue.push({ schema: d.inner, path });
|
|
7198
|
-
break;
|
|
7199
|
-
case "array":
|
|
7200
|
-
queue.push({ schema: d.item, path: path + "[]" });
|
|
7201
|
-
break;
|
|
7202
|
-
case "lazy":
|
|
7203
|
-
queue.push({ schema: d.resolved, path });
|
|
7204
|
-
break;
|
|
7205
|
-
case "record":
|
|
7206
|
-
queue.push({ schema: d.value, path: path + "{*}" });
|
|
7207
|
-
break;
|
|
7208
|
-
case "union":
|
|
7209
|
-
d.members.forEach((member, i) => queue.push({ schema: member, path: path + "|" + i }));
|
|
7210
|
-
break;
|
|
7211
|
-
case "discriminatedUnion":
|
|
7212
|
-
for (const member of d.members) queue.push({ schema: member, path: path + "|" + discriminantOf(member, d.key) });
|
|
7213
|
-
break;
|
|
7214
|
-
default:
|
|
7215
|
-
break;
|
|
7216
|
-
}
|
|
7217
|
-
}
|
|
7218
|
-
return [...fields].sort();
|
|
7219
|
-
}
|
|
7220
|
-
function discriminantOf(member, key) {
|
|
7221
|
-
const d = describeSchema(member);
|
|
7222
|
-
if (d.kind !== "shape") return "?";
|
|
7223
|
-
const keySchema = d.shape[key];
|
|
7224
|
-
if (keySchema === void 0) return "?";
|
|
7225
|
-
const kd = describeSchema(keySchema);
|
|
7226
|
-
return String((kd.kind === "optional" ? kd.inner : keySchema)._default);
|
|
7227
|
-
}
|
|
7228
|
-
|
|
7229
|
-
// src/version/PxSchemaRelease.ts
|
|
7230
|
-
function diffFieldUniverse(previous, current) {
|
|
7231
|
-
const prev = new Set(previous);
|
|
7232
|
-
const cur = new Set(current);
|
|
7233
|
-
return {
|
|
7234
|
-
added: current.filter((k) => !prev.has(k)).sort(),
|
|
7235
|
-
removed: previous.filter((k) => !cur.has(k)).sort()
|
|
7236
|
-
};
|
|
7237
|
-
}
|
|
7238
|
-
function planSchemaRelease(p) {
|
|
7239
|
-
const changed = p.added.length > 0 || p.removed.length > 0;
|
|
7240
|
-
const last = parseWireVersion(p.lastReleased);
|
|
7241
|
-
const declared = parseWireVersion(p.declared);
|
|
7242
|
-
if (!last || !declared) return { changed, refuse: "Unparseable version: " + p.lastReleased + " / " + p.declared + "." };
|
|
7243
|
-
const requiredVersion = last.a + "." + (last.b + 1);
|
|
7244
|
-
if (!changed) {
|
|
7245
|
-
if (declared.b === last.b && declared.a === last.a) return { changed };
|
|
7246
|
-
const step2 = p.steps.find((s) => s.to === p.declared);
|
|
7247
|
-
return step2 ? { changed, requiredVersion: p.declared } : { changed, refuse: "The version moved to " + p.declared + " with no key change and no step explaining it." };
|
|
7248
|
-
}
|
|
7249
|
-
const requiredKind = p.removed.length ? "converted" /* converted */ : "additive" /* additive */;
|
|
7250
|
-
const summary = p.added.length + " key(s) added, " + p.removed.length + " removed";
|
|
7251
|
-
if (declared.a !== last.a || declared.b !== last.b + 1) {
|
|
7252
|
-
return {
|
|
7253
|
-
changed,
|
|
7254
|
-
requiredKind,
|
|
7255
|
-
requiredVersion,
|
|
7256
|
-
refuse: "The player schema changed (" + summary + ") but PX_PLAYER_SCHEMA_VERSION is " + p.declared + ". Set it to " + requiredVersion + " and add the PLAYER_WIRE_STEPS entry."
|
|
7257
|
-
};
|
|
7258
|
-
}
|
|
7259
|
-
const step = p.steps.find((s) => s.to === p.declared);
|
|
7260
|
-
if (!step) {
|
|
7261
|
-
return { changed, requiredKind, requiredVersion, refuse: "No PLAYER_WIRE_STEPS entry reaches " + p.declared + "." };
|
|
7262
|
-
}
|
|
7263
|
-
if (requiredKind === "converted" /* converted */ && step.kind !== "converted" /* converted */) {
|
|
7264
|
-
return {
|
|
7265
|
-
changed,
|
|
7266
|
-
requiredKind,
|
|
7267
|
-
requiredVersion,
|
|
7268
|
-
refuse: "Keys were REMOVED (" + p.removed.join(", ") + "), which is never additive \u2014 the " + p.declared + " step must be `converted`, with an up()."
|
|
7269
|
-
};
|
|
7270
|
-
}
|
|
7271
|
-
return { changed, requiredKind, requiredVersion };
|
|
7272
|
-
}
|
|
7273
|
-
function releaseLogProblems(releases, steps, declared, baseline) {
|
|
7274
|
-
const problems = [];
|
|
7275
|
-
if (!releases.length) return ["The release log is empty."];
|
|
7276
|
-
if (!releases[0].baseline || releases[0].version !== baseline) {
|
|
7277
|
-
problems.push("The first release must be the baseline " + baseline + ".");
|
|
7278
|
-
}
|
|
7279
|
-
for (let i = 1; i < releases.length; i++) {
|
|
7280
|
-
const prev = parseWireVersion(releases[i - 1].version);
|
|
7281
|
-
const cur = parseWireVersion(releases[i].version);
|
|
7282
|
-
if (!prev || !cur || cur.a !== prev.a || cur.b !== prev.b + 1) {
|
|
7283
|
-
problems.push("Release " + releases[i].version + " does not follow " + releases[i - 1].version + " by one `b` step.");
|
|
7284
|
-
}
|
|
7285
|
-
if (releases[i].date < releases[i - 1].date) problems.push("Release " + releases[i].version + " is dated before its predecessor.");
|
|
7286
|
-
const step = steps.find((s) => s.to === releases[i].version);
|
|
7287
|
-
if (!step) problems.push("Release " + releases[i].version + " has no PLAYER_WIRE_STEPS entry.");
|
|
7288
|
-
else if (releases[i].removed.length && step.kind !== "converted" /* converted */) {
|
|
7289
|
-
problems.push("Release " + releases[i].version + " removed keys, but its step is not `converted`.");
|
|
7290
|
-
}
|
|
7291
|
-
}
|
|
7292
|
-
const latest = releases[releases.length - 1].version;
|
|
7293
|
-
if (latest !== declared) {
|
|
7294
|
-
problems.push("PX_PLAYER_SCHEMA_VERSION is " + declared + " but the last release record is " + latest + " \u2014 a bump needs its changelog entry (run scripts/schema-release.mjs --apply).");
|
|
7295
|
-
}
|
|
7296
|
-
return problems;
|
|
7297
|
-
}
|
|
7298
6659
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7299
6660
|
0 && (module.exports = {
|
|
7300
|
-
BASELINE_PLAYER_VERSION,
|
|
7301
|
-
COLOR_ATTR_NAMES,
|
|
7302
|
-
CSS_ONLY_STYLE_PROPS,
|
|
7303
|
-
DEFAULT_DURATION_MS,
|
|
7304
|
-
DISALLOWED_SVG_TAGS_LOWER,
|
|
7305
|
-
LOOP_JUMP_SHIFT_MS,
|
|
7306
|
-
PCT_BASED_ATTR_NAMES,
|
|
7307
|
-
PLAYER_WIRE_STEPS,
|
|
7308
|
-
PLAYER_WIRE_VERSION,
|
|
7309
|
-
PX_ANIM_ATTR_NAME,
|
|
7310
|
-
PX_ANIM_SRC_ATTR_NAME,
|
|
7311
|
-
PX_PLAYER_SCHEMA_VERSION,
|
|
7312
6661
|
PX_RATE_REJECTED,
|
|
7313
6662
|
PX_TRANSFORM_PART_KEYS,
|
|
7314
6663
|
PX_TRIGGER_DEFAULTS,
|
|
7315
|
-
|
|
6664
|
+
PX_WIRE_BASELINE_VERSION,
|
|
6665
|
+
PX_WIRE_SCHEMA_VERSION,
|
|
6666
|
+
PX_WIRE_STEPS,
|
|
6667
|
+
PX_WIRE_VERSION,
|
|
6668
|
+
PX_WIRE_VERSION_KEY,
|
|
7316
6669
|
PxAlongPathMode,
|
|
7317
6670
|
PxAnimatedSvgDocumentSchema,
|
|
7318
6671
|
PxAnimatorConfigSchema,
|
|
@@ -7322,7 +6675,8 @@ function releaseLogProblems(releases, steps, declared, baseline) {
|
|
|
7322
6675
|
PxCloneEffectSchema,
|
|
7323
6676
|
PxCloneWithout,
|
|
7324
6677
|
PxControlMode,
|
|
7325
|
-
|
|
6678
|
+
PxDefinitionsSchema,
|
|
6679
|
+
PxDiagnosticCode,
|
|
7326
6680
|
PxDiagnosticKind,
|
|
7327
6681
|
PxEffectsSchema,
|
|
7328
6682
|
PxElementAnimationSchema,
|
|
@@ -7340,7 +6694,7 @@ function releaseLogProblems(releases, steps, declared, baseline) {
|
|
|
7340
6694
|
PxLoopSchema,
|
|
7341
6695
|
PxMaskType,
|
|
7342
6696
|
PxMaskedByEffectSchema,
|
|
7343
|
-
|
|
6697
|
+
PxNodeBaseSchema,
|
|
7344
6698
|
PxNodeSchema,
|
|
7345
6699
|
PxOutAction,
|
|
7346
6700
|
PxPathOverflow,
|
|
@@ -7359,105 +6713,65 @@ function releaseLogProblems(releases, steps, declared, baseline) {
|
|
|
7359
6713
|
PxStartOn,
|
|
7360
6714
|
PxStrokeTrimEffectSchema,
|
|
7361
6715
|
PxStrokeTrimSubPaths,
|
|
7362
|
-
|
|
6716
|
+
PxSvgNodeRootSchema,
|
|
7363
6717
|
PxTextEffectSchema,
|
|
7364
6718
|
PxTextPathEffectSchema,
|
|
7365
6719
|
PxTextPathMethod,
|
|
7366
6720
|
PxTextPathSpacing,
|
|
7367
6721
|
PxTimelineEngine,
|
|
7368
|
-
|
|
6722
|
+
PxTimelineEngineSetting,
|
|
7369
6723
|
PxTimelineSchema,
|
|
7370
6724
|
PxTransformByEffectSchema,
|
|
7371
6725
|
PxTransformPartsSchema,
|
|
7372
6726
|
PxTransformValueSchema,
|
|
7373
6727
|
PxTriggerSchema,
|
|
7374
6728
|
PxUnits,
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
TRANSFORM_FN_NAMES,
|
|
7378
|
-
WIRE_VERSION_KEY,
|
|
7379
|
-
WireStepKind,
|
|
7380
|
-
WireVersionRelation,
|
|
6729
|
+
PxWireStepKind,
|
|
6730
|
+
PxWireVersionRelation,
|
|
7381
6731
|
applyAnimatorConfig,
|
|
7382
|
-
applyPlayerEffects,
|
|
7383
6732
|
applyWireSteps,
|
|
7384
|
-
bezierToSvgPath,
|
|
7385
6733
|
calcAnimationValues,
|
|
7386
|
-
camelCaseToKebabWordIfNeeded,
|
|
7387
|
-
clamp,
|
|
7388
6734
|
clampSeekMs,
|
|
7389
6735
|
compareWireVersion,
|
|
7390
|
-
composeTransformParts,
|
|
7391
6736
|
controlModeTakesOverTrigger,
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
createDiagnostics,
|
|
7395
|
-
createPathSampler,
|
|
6737
|
+
convertWireDocument,
|
|
6738
|
+
createAdapterAnimator,
|
|
7396
6739
|
createRunClock,
|
|
7397
|
-
cubicBezier,
|
|
7398
|
-
deepClone,
|
|
7399
6740
|
describeSchema,
|
|
7400
6741
|
diagnoseDocument,
|
|
7401
|
-
|
|
7402
|
-
diffInEffect,
|
|
7403
|
-
downgradePlayerDocument,
|
|
7404
|
-
extendedPathForBrowser,
|
|
6742
|
+
downgradeWireDocument,
|
|
7405
6743
|
flattenAnimatorTimeline,
|
|
7406
6744
|
foldTimelineOverride,
|
|
7407
6745
|
formatWireVersion,
|
|
7408
6746
|
generateNewIds,
|
|
7409
|
-
generateUniqueId,
|
|
7410
6747
|
getAnimatorConfig,
|
|
7411
6748
|
getBindings,
|
|
7412
6749
|
getChildren,
|
|
7413
|
-
|
|
7414
|
-
getNormalizedBindings,
|
|
7415
|
-
getNormalizedProps,
|
|
7416
|
-
interpolateValue,
|
|
6750
|
+
getDefinitions,
|
|
7417
6751
|
isNativeForced,
|
|
7418
|
-
|
|
7419
|
-
isPxElementFileFormatDeep,
|
|
7420
|
-
isScrollTimeline,
|
|
6752
|
+
isPxDocument,
|
|
7421
6753
|
isValidPlaybackRate,
|
|
7422
|
-
|
|
7423
|
-
kfEasing,
|
|
7424
|
-
kfValue,
|
|
7425
|
-
layoutGlyphTextChars,
|
|
6754
|
+
isValidPxDocument,
|
|
7426
6755
|
materializeAllInTree,
|
|
7427
|
-
|
|
7428
|
-
materializeGlyphTextAlongPath,
|
|
7429
|
-
materializeMotionPathInPropAnim,
|
|
6756
|
+
materializeNodeEffects,
|
|
7430
6757
|
mayUseNativeScrollTimeline,
|
|
7431
6758
|
mergeAnimatorConfig,
|
|
7432
|
-
mergeStaticTransformIntoAnimDef,
|
|
7433
6759
|
nestAnimatorTimeline,
|
|
6760
|
+
normalizeBindings,
|
|
7434
6761
|
parseWireVersion,
|
|
7435
|
-
planSchemaRelease,
|
|
7436
6762
|
progressSpanMs,
|
|
7437
6763
|
progressToTimeMs,
|
|
7438
6764
|
px,
|
|
7439
6765
|
readWireVersion,
|
|
7440
|
-
releaseLogProblems,
|
|
7441
|
-
reportDocumentDiagnostics,
|
|
7442
6766
|
resolveControlMode,
|
|
7443
6767
|
resolveTimelineEngine,
|
|
7444
6768
|
resolveTrigger,
|
|
7445
|
-
reverseEasing,
|
|
7446
|
-
sanitizeAttributeValue,
|
|
7447
|
-
schemaFieldUniverse,
|
|
7448
6769
|
schemaKeys,
|
|
7449
|
-
scrollOffsetProgress,
|
|
7450
|
-
scrollPhaseInterval,
|
|
7451
|
-
scrollResolveAxis,
|
|
7452
|
-
scrollTotalDurationMs,
|
|
7453
|
-
scrollViewProgress,
|
|
7454
6770
|
seekCeilingMs,
|
|
7455
|
-
splitEasing,
|
|
7456
|
-
subdivideCubicBezier,
|
|
7457
6771
|
timeToProgress,
|
|
7458
|
-
|
|
6772
|
+
toDomProps,
|
|
7459
6773
|
validateDocument,
|
|
7460
6774
|
validateNodeEffects,
|
|
7461
|
-
|
|
6775
|
+
wireVersionAdvice
|
|
7462
6776
|
});
|
|
7463
6777
|
//# sourceMappingURL=index.cjs.map
|