@pixodesk/svg-animator-core 1.0.40 → 1.0.41
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-COGEjBbg.d.cts} +74 -448
- package/dist/{internal-BZSJtt_h.d.cts → PxDocumentDiagnostic-COGEjBbg.d.ts} +74 -448
- package/dist/chunk-7ZO7PQKZ.min.js +1 -0
- package/dist/{chunk-PAE3NF2U.js → chunk-L6GJ6Y2M.js} +168 -567
- package/dist/chunk-L6GJ6Y2M.js.map +1 -0
- package/dist/index.cjs +206 -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 +84 -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 +78 -78
- 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,7 @@ __export(index_exports, {
|
|
|
75
67
|
PxCloneEffectSchema: () => PxCloneEffectSchema,
|
|
76
68
|
PxCloneWithout: () => PxCloneWithout,
|
|
77
69
|
PxControlMode: () => PxControlMode,
|
|
78
|
-
|
|
70
|
+
PxDefinitionsSchema: () => PxDefinitionsSchema,
|
|
79
71
|
PxDiagnosticKind: () => PxDiagnosticKind,
|
|
80
72
|
PxEffectsSchema: () => PxEffectsSchema,
|
|
81
73
|
PxElementAnimationSchema: () => PxElementAnimationSchema,
|
|
@@ -93,7 +85,7 @@ __export(index_exports, {
|
|
|
93
85
|
PxLoopSchema: () => PxLoopSchema,
|
|
94
86
|
PxMaskType: () => PxMaskType,
|
|
95
87
|
PxMaskedByEffectSchema: () => PxMaskedByEffectSchema,
|
|
96
|
-
|
|
88
|
+
PxNodeBaseSchema: () => PxNodeBaseSchema,
|
|
97
89
|
PxNodeSchema: () => PxNodeSchema,
|
|
98
90
|
PxOutAction: () => PxOutAction,
|
|
99
91
|
PxPathOverflow: () => PxPathOverflow,
|
|
@@ -112,106 +104,66 @@ __export(index_exports, {
|
|
|
112
104
|
PxStartOn: () => PxStartOn,
|
|
113
105
|
PxStrokeTrimEffectSchema: () => PxStrokeTrimEffectSchema,
|
|
114
106
|
PxStrokeTrimSubPaths: () => PxStrokeTrimSubPaths,
|
|
115
|
-
|
|
107
|
+
PxSvgNodeRootSchema: () => PxSvgNodeRootSchema,
|
|
116
108
|
PxTextEffectSchema: () => PxTextEffectSchema,
|
|
117
109
|
PxTextPathEffectSchema: () => PxTextPathEffectSchema,
|
|
118
110
|
PxTextPathMethod: () => PxTextPathMethod,
|
|
119
111
|
PxTextPathSpacing: () => PxTextPathSpacing,
|
|
120
112
|
PxTimelineEngine: () => PxTimelineEngine,
|
|
121
|
-
|
|
113
|
+
PxTimelineEngineSetting: () => PxTimelineEngineSetting,
|
|
122
114
|
PxTimelineSchema: () => PxTimelineSchema,
|
|
123
115
|
PxTransformByEffectSchema: () => PxTransformByEffectSchema,
|
|
124
116
|
PxTransformPartsSchema: () => PxTransformPartsSchema,
|
|
125
117
|
PxTransformValueSchema: () => PxTransformValueSchema,
|
|
126
118
|
PxTriggerSchema: () => PxTriggerSchema,
|
|
127
119
|
PxUnits: () => PxUnits,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
TRANSFORM_FN_NAMES: () => TRANSFORM_FN_NAMES,
|
|
131
|
-
WIRE_VERSION_KEY: () => WIRE_VERSION_KEY,
|
|
132
|
-
WireStepKind: () => WireStepKind,
|
|
133
|
-
WireVersionRelation: () => WireVersionRelation,
|
|
120
|
+
PxWireStepKind: () => PxWireStepKind,
|
|
121
|
+
PxWireVersionRelation: () => PxWireVersionRelation,
|
|
134
122
|
applyAnimatorConfig: () => applyAnimatorConfig,
|
|
135
|
-
applyPlayerEffects: () => applyPlayerEffects,
|
|
136
123
|
applyWireSteps: () => applyWireSteps,
|
|
137
|
-
bezierToSvgPath: () => bezierToSvgPath,
|
|
138
124
|
calcAnimationValues: () => calcAnimationValues,
|
|
139
|
-
camelCaseToKebabWordIfNeeded: () => camelCaseToKebabWordIfNeeded,
|
|
140
|
-
clamp: () => clamp,
|
|
141
125
|
clampSeekMs: () => clampSeekMs,
|
|
142
126
|
compareWireVersion: () => compareWireVersion,
|
|
143
|
-
composeTransformParts: () => composeTransformParts,
|
|
144
127
|
controlModeTakesOverTrigger: () => controlModeTakesOverTrigger,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
createDiagnostics: () => createDiagnostics,
|
|
148
|
-
createPathSampler: () => createPathSampler,
|
|
128
|
+
convertWireDocument: () => convertWireDocument,
|
|
129
|
+
createAdapterAnimator: () => createAdapterAnimator,
|
|
149
130
|
createRunClock: () => createRunClock,
|
|
150
|
-
cubicBezier: () => cubicBezier,
|
|
151
|
-
deepClone: () => deepClone,
|
|
152
131
|
describeSchema: () => describeSchema,
|
|
153
132
|
diagnoseDocument: () => diagnoseDocument,
|
|
154
|
-
|
|
155
|
-
diffInEffect: () => diffInEffect,
|
|
156
|
-
downgradePlayerDocument: () => downgradePlayerDocument,
|
|
157
|
-
extendedPathForBrowser: () => extendedPathForBrowser,
|
|
133
|
+
downgradeWireDocument: () => downgradeWireDocument,
|
|
158
134
|
flattenAnimatorTimeline: () => flattenAnimatorTimeline,
|
|
159
135
|
foldTimelineOverride: () => foldTimelineOverride,
|
|
160
136
|
formatWireVersion: () => formatWireVersion,
|
|
161
137
|
generateNewIds: () => generateNewIds,
|
|
162
|
-
generateUniqueId: () => generateUniqueId,
|
|
163
138
|
getAnimatorConfig: () => getAnimatorConfig,
|
|
164
139
|
getBindings: () => getBindings,
|
|
165
140
|
getChildren: () => getChildren,
|
|
166
|
-
|
|
167
|
-
getNormalizedBindings: () => getNormalizedBindings,
|
|
168
|
-
getNormalizedProps: () => getNormalizedProps,
|
|
169
|
-
interpolateValue: () => interpolateValue,
|
|
141
|
+
getDefinitions: () => getDefinitions,
|
|
170
142
|
isNativeForced: () => isNativeForced,
|
|
171
|
-
|
|
172
|
-
isPxElementFileFormatDeep: () => isPxElementFileFormatDeep,
|
|
173
|
-
isScrollTimeline: () => isScrollTimeline,
|
|
143
|
+
isPxDocument: () => isPxDocument,
|
|
174
144
|
isValidPlaybackRate: () => isValidPlaybackRate,
|
|
175
|
-
|
|
176
|
-
kfEasing: () => kfEasing,
|
|
177
|
-
kfValue: () => kfValue,
|
|
178
|
-
layoutGlyphTextChars: () => layoutGlyphTextChars,
|
|
145
|
+
isValidPxDocument: () => isValidPxDocument,
|
|
179
146
|
materializeAllInTree: () => materializeAllInTree,
|
|
180
|
-
|
|
181
|
-
materializeGlyphTextAlongPath: () => materializeGlyphTextAlongPath,
|
|
182
|
-
materializeMotionPathInPropAnim: () => materializeMotionPathInPropAnim,
|
|
147
|
+
materializeNodeEffects: () => materializeNodeEffects,
|
|
183
148
|
mayUseNativeScrollTimeline: () => mayUseNativeScrollTimeline,
|
|
184
149
|
mergeAnimatorConfig: () => mergeAnimatorConfig,
|
|
185
|
-
mergeStaticTransformIntoAnimDef: () => mergeStaticTransformIntoAnimDef,
|
|
186
150
|
nestAnimatorTimeline: () => nestAnimatorTimeline,
|
|
151
|
+
normalizeBindings: () => normalizeBindings,
|
|
187
152
|
parseWireVersion: () => parseWireVersion,
|
|
188
|
-
planSchemaRelease: () => planSchemaRelease,
|
|
189
153
|
progressSpanMs: () => progressSpanMs,
|
|
190
154
|
progressToTimeMs: () => progressToTimeMs,
|
|
191
155
|
px: () => px,
|
|
192
156
|
readWireVersion: () => readWireVersion,
|
|
193
|
-
releaseLogProblems: () => releaseLogProblems,
|
|
194
|
-
reportDocumentDiagnostics: () => reportDocumentDiagnostics,
|
|
195
157
|
resolveControlMode: () => resolveControlMode,
|
|
196
158
|
resolveTimelineEngine: () => resolveTimelineEngine,
|
|
197
159
|
resolveTrigger: () => resolveTrigger,
|
|
198
|
-
reverseEasing: () => reverseEasing,
|
|
199
|
-
sanitizeAttributeValue: () => sanitizeAttributeValue,
|
|
200
|
-
schemaFieldUniverse: () => schemaFieldUniverse,
|
|
201
160
|
schemaKeys: () => schemaKeys,
|
|
202
|
-
scrollOffsetProgress: () => scrollOffsetProgress,
|
|
203
|
-
scrollPhaseInterval: () => scrollPhaseInterval,
|
|
204
|
-
scrollResolveAxis: () => scrollResolveAxis,
|
|
205
|
-
scrollTotalDurationMs: () => scrollTotalDurationMs,
|
|
206
|
-
scrollViewProgress: () => scrollViewProgress,
|
|
207
161
|
seekCeilingMs: () => seekCeilingMs,
|
|
208
|
-
splitEasing: () => splitEasing,
|
|
209
|
-
subdivideCubicBezier: () => subdivideCubicBezier,
|
|
210
162
|
timeToProgress: () => timeToProgress,
|
|
211
|
-
|
|
163
|
+
toDomProps: () => toDomProps,
|
|
212
164
|
validateDocument: () => validateDocument,
|
|
213
165
|
validateNodeEffects: () => validateNodeEffects,
|
|
214
|
-
|
|
166
|
+
wireVersionAdvice: () => wireVersionAdvice
|
|
215
167
|
});
|
|
216
168
|
module.exports = __toCommonJS(index_exports);
|
|
217
169
|
|
|
@@ -729,7 +681,7 @@ var px = {
|
|
|
729
681
|
* The base can be the result of px.object() or px.openObject() — anything with a _shape property.
|
|
730
682
|
*
|
|
731
683
|
* @example
|
|
732
|
-
* const PxSvgNodeSchema = px.extendedObject(
|
|
684
|
+
* const PxSvgNodeSchema = px.extendedObject(PxNodeBaseSchema, { width: px.number().optional() });
|
|
733
685
|
*/
|
|
734
686
|
extendedObject: (base, extra) => new Obj(__spreadValues(__spreadValues({}, base._shape), extra)),
|
|
735
687
|
/** Array whose unrecoverable items are filtered out. Default: []. */
|
|
@@ -747,20 +699,20 @@ var px = {
|
|
|
747
699
|
};
|
|
748
700
|
|
|
749
701
|
// src/version/PxSchemaVersion.ts
|
|
750
|
-
var
|
|
702
|
+
var PX_WIRE_SCHEMA_VERSION = "1.1";
|
|
751
703
|
|
|
752
704
|
// src/version/PxWireVersion.ts
|
|
753
|
-
var
|
|
705
|
+
var PX_WIRE_VERSION_KEY = "version";
|
|
754
706
|
var ANIMATOR_KEY = "animator";
|
|
755
707
|
var META_KEY = "meta";
|
|
756
|
-
var
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
return
|
|
763
|
-
})(
|
|
708
|
+
var PxWireVersionRelation = /* @__PURE__ */ ((PxWireVersionRelation2) => {
|
|
709
|
+
PxWireVersionRelation2["unstamped"] = "unstamped";
|
|
710
|
+
PxWireVersionRelation2["same"] = "same";
|
|
711
|
+
PxWireVersionRelation2["older"] = "older";
|
|
712
|
+
PxWireVersionRelation2["newer"] = "newer";
|
|
713
|
+
PxWireVersionRelation2["otherGeneration"] = "otherGeneration";
|
|
714
|
+
return PxWireVersionRelation2;
|
|
715
|
+
})(PxWireVersionRelation || {});
|
|
764
716
|
var VERSION_RE = /^(\d+)\.(\d+)(?:\.(\d+))?$/;
|
|
765
717
|
function parseWireVersion(raw) {
|
|
766
718
|
if (typeof raw !== "string") return void 0;
|
|
@@ -772,7 +724,7 @@ function formatWireVersion(v) {
|
|
|
772
724
|
return v.a + "." + v.b + "." + v.c;
|
|
773
725
|
}
|
|
774
726
|
var _a;
|
|
775
|
-
var
|
|
727
|
+
var PX_WIRE_VERSION = (_a = parseWireVersion(PX_WIRE_SCHEMA_VERSION)) != null ? _a : { a: 1, b: 1, c: 0 };
|
|
776
728
|
function getAnimatorBlock(doc) {
|
|
777
729
|
if (!doc || typeof doc !== "object") return void 0;
|
|
778
730
|
const atRoot = readObjectProp(doc, ANIMATOR_KEY);
|
|
@@ -786,7 +738,7 @@ function readObjectProp(obj, key) {
|
|
|
786
738
|
}
|
|
787
739
|
function readWireVersion(doc) {
|
|
788
740
|
const animator = getAnimatorBlock(doc);
|
|
789
|
-
return animator ? parseWireVersion(animator[
|
|
741
|
+
return animator ? parseWireVersion(animator[PX_WIRE_VERSION_KEY]) : void 0;
|
|
790
742
|
}
|
|
791
743
|
function compareWireVersion(file, mine, readerReadsEditorPart) {
|
|
792
744
|
if (!file) return "unstamped" /* unstamped */;
|
|
@@ -795,7 +747,7 @@ function compareWireVersion(file, mine, readerReadsEditorPart) {
|
|
|
795
747
|
if (!readerReadsEditorPart || file.c === mine.c) return "same" /* same */;
|
|
796
748
|
return file.c > mine.c ? "newer" /* newer */ : "older" /* older */;
|
|
797
749
|
}
|
|
798
|
-
function
|
|
750
|
+
function wireVersionAdvice(relation, file, mine, isPlayer) {
|
|
799
751
|
if (!file) return void 0;
|
|
800
752
|
const target = isPlayer ? "player" : "editor";
|
|
801
753
|
const gap = "written for schema " + formatWireVersion(file) + ", this " + target + " reads " + formatWireVersion(mine);
|
|
@@ -810,13 +762,13 @@ function versionAdvice(relation, file, mine, isPlayer) {
|
|
|
810
762
|
return void 0;
|
|
811
763
|
}
|
|
812
764
|
}
|
|
813
|
-
var
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
return
|
|
817
|
-
})(
|
|
818
|
-
var
|
|
819
|
-
var
|
|
765
|
+
var PxWireStepKind = /* @__PURE__ */ ((PxWireStepKind2) => {
|
|
766
|
+
PxWireStepKind2["additive"] = "additive";
|
|
767
|
+
PxWireStepKind2["converted"] = "converted";
|
|
768
|
+
return PxWireStepKind2;
|
|
769
|
+
})(PxWireStepKind || {});
|
|
770
|
+
var PX_WIRE_BASELINE_VERSION = "1.1";
|
|
771
|
+
var PX_WIRE_STEPS = [];
|
|
820
772
|
function applyWireSteps(doc, cfg) {
|
|
821
773
|
const from = readWireVersion(doc);
|
|
822
774
|
const relation = compareWireVersion(from, cfg.target, cfg.readerReadsEditorPart);
|
|
@@ -826,7 +778,7 @@ function applyWireSteps(doc, cfg) {
|
|
|
826
778
|
from,
|
|
827
779
|
relation,
|
|
828
780
|
applied: [],
|
|
829
|
-
advice:
|
|
781
|
+
advice: wireVersionAdvice(relation, from, cfg.target, !cfg.readerReadsEditorPart)
|
|
830
782
|
};
|
|
831
783
|
}
|
|
832
784
|
const due = [];
|
|
@@ -852,10 +804,10 @@ function applyWireSteps(doc, cfg) {
|
|
|
852
804
|
stampVersion(target, cfg.target, cfg.readerReadsEditorPart);
|
|
853
805
|
return { doc: target, from, relation, applied };
|
|
854
806
|
}
|
|
855
|
-
function
|
|
807
|
+
function convertWireDocument(doc) {
|
|
856
808
|
return applyWireSteps(doc, {
|
|
857
|
-
steps:
|
|
858
|
-
target:
|
|
809
|
+
steps: PX_WIRE_STEPS,
|
|
810
|
+
target: PX_WIRE_VERSION,
|
|
859
811
|
readerReadsEditorPart: false
|
|
860
812
|
});
|
|
861
813
|
}
|
|
@@ -866,8 +818,8 @@ function clonePlain(value) {
|
|
|
866
818
|
function stampVersion(doc, target, readerReadsEditorPart) {
|
|
867
819
|
const animator = getAnimatorBlock(doc);
|
|
868
820
|
if (!animator) return;
|
|
869
|
-
const previous = parseWireVersion(animator[
|
|
870
|
-
animator[
|
|
821
|
+
const previous = parseWireVersion(animator[PX_WIRE_VERSION_KEY]);
|
|
822
|
+
animator[PX_WIRE_VERSION_KEY] = formatWireVersion({
|
|
871
823
|
a: target.a,
|
|
872
824
|
b: target.b,
|
|
873
825
|
c: readerReadsEditorPart ? target.c : previous ? previous.c : 0
|
|
@@ -922,8 +874,8 @@ function applyWireStepsDown(doc, cfg) {
|
|
|
922
874
|
stampVersion(target, cfg.target, cfg.readerReadsEditorPart);
|
|
923
875
|
return { ok: true, doc: target, applied };
|
|
924
876
|
}
|
|
925
|
-
function
|
|
926
|
-
return applyWireStepsDown(doc, { steps:
|
|
877
|
+
function downgradeWireDocument(doc, target) {
|
|
878
|
+
return applyWireStepsDown(doc, { steps: PX_WIRE_STEPS, target, readerReadsEditorPart: false });
|
|
927
879
|
}
|
|
928
880
|
|
|
929
881
|
// src/format/PxAnimatorConstants.ts
|
|
@@ -939,8 +891,6 @@ var PxPlaybackDirection = {
|
|
|
939
891
|
alternate: "alternate",
|
|
940
892
|
alternateReverse: "alternate-reverse"
|
|
941
893
|
};
|
|
942
|
-
var PX_ANIM_SRC_ATTR_NAME = "data-px-animation-src";
|
|
943
|
-
var PX_ANIM_ATTR_NAME = "_px_animator";
|
|
944
894
|
var PxStartOn = {
|
|
945
895
|
load: "load",
|
|
946
896
|
mouseOver: "mouseOver",
|
|
@@ -1003,17 +953,17 @@ var PxTimelineEngine = {
|
|
|
1003
953
|
native: "native",
|
|
1004
954
|
js: "js"
|
|
1005
955
|
};
|
|
1006
|
-
var
|
|
956
|
+
var PxTimelineEngineSetting = __spreadProps(__spreadValues({}, PxTimelineEngine), {
|
|
1007
957
|
auto: "auto"
|
|
1008
958
|
});
|
|
1009
959
|
function resolveTimelineEngine(engine) {
|
|
1010
|
-
return engine ===
|
|
960
|
+
return engine === PxTimelineEngineSetting.js ? PxTimelineEngine.js : PxTimelineEngine.native;
|
|
1011
961
|
}
|
|
1012
962
|
function isNativeForced(engine) {
|
|
1013
|
-
return engine ===
|
|
963
|
+
return engine === PxTimelineEngineSetting.native;
|
|
1014
964
|
}
|
|
1015
965
|
function mayUseNativeScrollTimeline(engine) {
|
|
1016
|
-
return engine !==
|
|
966
|
+
return engine !== PxTimelineEngineSetting.js;
|
|
1017
967
|
}
|
|
1018
968
|
var PX_TRIGGER_DEFAULTS = {
|
|
1019
969
|
startOn: "load",
|
|
@@ -1105,7 +1055,7 @@ var PxStrokeTrimSubPaths = {
|
|
|
1105
1055
|
separate: "separate",
|
|
1106
1056
|
combined: "combined"
|
|
1107
1057
|
};
|
|
1108
|
-
var
|
|
1058
|
+
var PX_TEXT_CONTENT_ATTR = "textContent";
|
|
1109
1059
|
var CLASS_ATTR = "class";
|
|
1110
1060
|
var TRANSFORM_ATTR = "transform";
|
|
1111
1061
|
var OFFSET_DISTANCE_ATTR = "offsetDistance";
|
|
@@ -1116,7 +1066,7 @@ var INTERNAL_ATTRS = /* @__PURE__ */ new Set([
|
|
|
1116
1066
|
"meta",
|
|
1117
1067
|
"animate",
|
|
1118
1068
|
"effects",
|
|
1119
|
-
|
|
1069
|
+
PX_TEXT_CONTENT_ATTR
|
|
1120
1070
|
]);
|
|
1121
1071
|
var TRANSFORM_PART = {
|
|
1122
1072
|
translate: "translate",
|
|
@@ -1139,11 +1089,11 @@ var PxGradientType = {
|
|
|
1139
1089
|
linear: "linear",
|
|
1140
1090
|
radial: "radial"
|
|
1141
1091
|
};
|
|
1142
|
-
function
|
|
1143
|
-
if (!(
|
|
1092
|
+
function isPxDocument(doc) {
|
|
1093
|
+
if (!(doc && typeof doc === "object" && !Array.isArray(doc))) {
|
|
1144
1094
|
return false;
|
|
1145
1095
|
}
|
|
1146
|
-
return
|
|
1096
|
+
return doc.type === "svg";
|
|
1147
1097
|
}
|
|
1148
1098
|
function getAnimatorConfig(doc) {
|
|
1149
1099
|
var _a2;
|
|
@@ -1270,7 +1220,7 @@ function nestAnimatorTimeline(cfg) {
|
|
|
1270
1220
|
if (fill !== void 0) timeline.fillMode = fill;
|
|
1271
1221
|
return Object.keys(timeline).length > 0 ? __spreadProps(__spreadValues({}, shared), { timeline }) : shared;
|
|
1272
1222
|
}
|
|
1273
|
-
function
|
|
1223
|
+
function getDefinitions(doc) {
|
|
1274
1224
|
var _a2;
|
|
1275
1225
|
if (!doc) return void 0;
|
|
1276
1226
|
return (_a2 = getAnimatorConfig(doc)) == null ? void 0 : _a2.definitions;
|
|
@@ -1316,20 +1266,20 @@ var PxKeyframeSchema = implementsInterface()(px.object({
|
|
|
1316
1266
|
// its internal COPY-PASTE payload, which never validates against this schema.)
|
|
1317
1267
|
}));
|
|
1318
1268
|
var anyKf = (kf) => kf;
|
|
1319
|
-
var
|
|
1269
|
+
var keyframeTime = (kf) => {
|
|
1320
1270
|
var _a2, _b;
|
|
1321
1271
|
return (_b = (_a2 = anyKf(kf).time) != null ? _a2 : anyKf(kf).t) != null ? _b : 0;
|
|
1322
1272
|
};
|
|
1323
|
-
var
|
|
1273
|
+
var keyframeValue = (kf) => {
|
|
1324
1274
|
var _a2;
|
|
1325
1275
|
return (_a2 = anyKf(kf).value) != null ? _a2 : anyKf(kf).v;
|
|
1326
1276
|
};
|
|
1327
|
-
var
|
|
1277
|
+
var keyframeEasing = (kf) => {
|
|
1328
1278
|
var _a2;
|
|
1329
1279
|
return (_a2 = anyKf(kf).easing) != null ? _a2 : anyKf(kf).e;
|
|
1330
1280
|
};
|
|
1331
|
-
var
|
|
1332
|
-
var
|
|
1281
|
+
var keyframeTangentIn = (kf) => anyKf(kf).tangentIn;
|
|
1282
|
+
var keyframeTangentOut = (kf) => anyKf(kf).tangentOut;
|
|
1333
1283
|
var PxLoopSchema = implementsInterface()(px.object({
|
|
1334
1284
|
segmentCount: px.number().optional(),
|
|
1335
1285
|
repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end]).optional(),
|
|
@@ -1383,7 +1333,7 @@ var PxGlyphFontSchema = implementsInterface()(px.object({
|
|
|
1383
1333
|
unitsPerEm: px.number(),
|
|
1384
1334
|
glyphs: px.record(PxGlyphSchema)
|
|
1385
1335
|
}));
|
|
1386
|
-
var
|
|
1336
|
+
var PxDefinitionsSchema = implementsInterface()(px.object({
|
|
1387
1337
|
easings: px.record(px.tuple([px.number(), px.number(), px.number(), px.number()])).optional(),
|
|
1388
1338
|
animations: px.record(PxAnimationDefinitionSchema).optional(),
|
|
1389
1339
|
fonts: px.record(PxGlyphFontSchema).optional()
|
|
@@ -1421,7 +1371,7 @@ var PxTimelinePinSchema = implementsInterface()(px.object({
|
|
|
1421
1371
|
offset: px.number().optional(),
|
|
1422
1372
|
distance: px.number().optional()
|
|
1423
1373
|
}));
|
|
1424
|
-
var PxTimelineEngineSchema = px.enum([
|
|
1374
|
+
var PxTimelineEngineSchema = px.enum([PxTimelineEngineSetting.auto, PxTimelineEngineSetting.native, PxTimelineEngineSetting.js]).optional();
|
|
1425
1375
|
var PxTimeTimelineSchema = implementsInterface()(px.object({
|
|
1426
1376
|
type: px.literal("time").optional(),
|
|
1427
1377
|
engine: PxTimelineEngineSchema,
|
|
@@ -1475,7 +1425,7 @@ var PxAnimatorConfigSchema = implementsInterface()(px.object({
|
|
|
1475
1425
|
// at this level only on the runtime view, like the rest of the playback dynamics.)
|
|
1476
1426
|
// THE spelling of "what advances progress" — clock / scroll / view (review §2.1).
|
|
1477
1427
|
timeline: PxTimelineSchema.optional(),
|
|
1478
|
-
definitions:
|
|
1428
|
+
definitions: PxDefinitionsSchema.optional(),
|
|
1479
1429
|
bindings: px.array(PxBindingSchema).optional(),
|
|
1480
1430
|
debugGlobalName: px.string().optional(),
|
|
1481
1431
|
// Declared HERE because this is a closed object: an undeclared key would be stripped by
|
|
@@ -1564,7 +1514,7 @@ var PxAnimatableGradientStopsSchema = px.union([
|
|
|
1564
1514
|
PxPropertyAnimationSchema
|
|
1565
1515
|
]);
|
|
1566
1516
|
var PxFillGradientEffectSchema = implementsInterface()(px.object({
|
|
1567
|
-
// Contextual kind — the `type` convention, see `
|
|
1517
|
+
// Contextual kind — the `type` convention, see `PxNodeBaseSchema.type`.
|
|
1568
1518
|
type: px.enum([PxGradientType.linear, PxGradientType.radial]),
|
|
1569
1519
|
start: PxAnimatableVec2Schema.optional(),
|
|
1570
1520
|
end: PxAnimatableVec2Schema.optional(),
|
|
@@ -1601,11 +1551,11 @@ var PxEffectsSchema = implementsInterface()(px.object({
|
|
|
1601
1551
|
textPath: PxTextPathEffectSchema.optional(),
|
|
1602
1552
|
text: PxTextEffectSchema.optional()
|
|
1603
1553
|
}));
|
|
1604
|
-
function validateNodeEffects(root,
|
|
1554
|
+
function validateNodeEffects(root, options) {
|
|
1605
1555
|
const warnings = [];
|
|
1606
1556
|
const walk = (node, path) => {
|
|
1607
1557
|
if (node && node.effects) {
|
|
1608
|
-
const ctx = { errors: [], warnings: [], strict: !!(
|
|
1558
|
+
const ctx = { errors: [], warnings: [], strict: !!(options == null ? void 0 : options.strict) };
|
|
1609
1559
|
const ok = PxEffectsSchema.isValid(node.effects, ctx, [path + ".effects"]);
|
|
1610
1560
|
if (!ok) {
|
|
1611
1561
|
for (const err of ctx.errors) warnings.push(err);
|
|
@@ -1666,9 +1616,9 @@ function validateVersionStamp(doc) {
|
|
|
1666
1616
|
if (parseWireVersion(version) !== void 0) return [];
|
|
1667
1617
|
return ["root.animator.version: " + JSON.stringify(version) + ' is not a version stamp ("a.b" or "a.b.c") \u2014 it reads as unstamped'];
|
|
1668
1618
|
}
|
|
1669
|
-
function validateDocument(doc,
|
|
1619
|
+
function validateDocument(doc, options) {
|
|
1670
1620
|
var _a2;
|
|
1671
|
-
const strict = (
|
|
1621
|
+
const strict = (options == null ? void 0 : options.strict) !== false;
|
|
1672
1622
|
const ctx = { errors: [], warnings: [], strict };
|
|
1673
1623
|
const problems = PxAnimatedSvgDocumentSchema.isValid(doc, ctx, ["root"]) ? [] : [...ctx.errors];
|
|
1674
1624
|
if (doc && typeof doc === "object") {
|
|
@@ -1688,7 +1638,7 @@ function validateDocument(doc, opts) {
|
|
|
1688
1638
|
}
|
|
1689
1639
|
return problems;
|
|
1690
1640
|
}
|
|
1691
|
-
var
|
|
1641
|
+
var PxNodeBaseSchema = px.openObject({
|
|
1692
1642
|
// CONVENTION (SCHEMA-DESIGN R1 / issues N4): `type` is the ONE word for "what
|
|
1693
1643
|
// kind of thing is this", discriminated by its CARRIER — here the node TAG
|
|
1694
1644
|
// (`rect`, `text`), and inside a sub-object that object's kind (`fillGradient.type`,
|
|
@@ -1703,7 +1653,7 @@ var PxNodeBase = px.openObject({
|
|
|
1703
1653
|
// `type` is taken by the tag name, so the attribute travels here and the renderer puts
|
|
1704
1654
|
// it back (`PxAnimatorDOM.renderNode`, `PxRnRender`). Declared here — not merely
|
|
1705
1655
|
// documented — because a wire key that is not in a schema is invisible to the
|
|
1706
|
-
// minifier's reserve list and gets renamed (
|
|
1656
|
+
// minifier's reserve list and gets renamed (dev-docs/plans/minification-boundary.md §1.1).
|
|
1707
1657
|
domType: px.string().optional(),
|
|
1708
1658
|
// Text content of a `<text>` / `<tspan>`. Declared, so a non-string value is a schema error
|
|
1709
1659
|
// and the minifier reserves the key; `text` is NOT an alias for it and is not read anywhere.
|
|
@@ -1711,7 +1661,7 @@ var PxNodeBase = px.openObject({
|
|
|
1711
1661
|
id: px.string().optional(),
|
|
1712
1662
|
meta: px.any().optional(),
|
|
1713
1663
|
// Player-effects bucket emitted by the Editor's lightweight design format.
|
|
1714
|
-
// Consumed and removed by `
|
|
1664
|
+
// Consumed and removed by `materializeNodeEffects` before any other normalization
|
|
1715
1665
|
// (see `createAnimatorImpl`), so downstream code never sees it.
|
|
1716
1666
|
effects: PxEffectsSchema.optional(),
|
|
1717
1667
|
// `PxElementAnimation` (not just `PxAnimationDefinition`) — accepts
|
|
@@ -1720,10 +1670,10 @@ var PxNodeBase = px.openObject({
|
|
|
1720
1670
|
animate: PxElementAnimationSchema.optional(),
|
|
1721
1671
|
style: px.record(px.union([px.string(), px.number()])).optional()
|
|
1722
1672
|
}, PxAttrValueSchema);
|
|
1723
|
-
var PxNodeSchema = px.openObject(__spreadProps(__spreadValues({},
|
|
1673
|
+
var PxNodeSchema = px.openObject(__spreadProps(__spreadValues({}, PxNodeBaseSchema._shape), {
|
|
1724
1674
|
children: px.lazy(() => px.array(PxNodeSchema), []).optional()
|
|
1725
1675
|
}), PxAttrValueSchema);
|
|
1726
|
-
var
|
|
1676
|
+
var PxSvgNodeRootSchema = px.object({
|
|
1727
1677
|
// `"100%"` and other SVG length strings are legal here — a number-only slot rejected
|
|
1728
1678
|
// real documents (e.g. apple-store-look-14-main.json) at the root <svg>.
|
|
1729
1679
|
width: px.union([px.number(), px.string()]).optional(),
|
|
@@ -1731,7 +1681,7 @@ var PxSvgNodeExtra = px.object({
|
|
|
1731
1681
|
viewBox: px.string().optional(),
|
|
1732
1682
|
animator: PxAnimatorConfigSchema.optional()
|
|
1733
1683
|
});
|
|
1734
|
-
var PxAnimatedSvgDocumentSchema = px.openObject(__spreadProps(__spreadValues(__spreadValues({},
|
|
1684
|
+
var PxAnimatedSvgDocumentSchema = px.openObject(__spreadProps(__spreadValues(__spreadValues({}, PxNodeBaseSchema._shape), PxSvgNodeRootSchema._shape), {
|
|
1735
1685
|
type: px.literal("svg"),
|
|
1736
1686
|
// override string → literal to require 'svg'
|
|
1737
1687
|
children: px.array(PxNodeSchema).optional()
|
|
@@ -1742,8 +1692,8 @@ var PxBezierPathSchema = implementsInterface()(px.object({
|
|
|
1742
1692
|
o: px.array(px.array(px.number())).optional(),
|
|
1743
1693
|
c: px.boolean().optional()
|
|
1744
1694
|
}));
|
|
1745
|
-
function
|
|
1746
|
-
const errors = validateDocument(
|
|
1695
|
+
function isValidPxDocument(doc) {
|
|
1696
|
+
const errors = validateDocument(doc, { strict: false });
|
|
1747
1697
|
return { valid: errors.length === 0, errors };
|
|
1748
1698
|
}
|
|
1749
1699
|
|
|
@@ -2094,9 +2044,9 @@ function parseColor(s) {
|
|
|
2094
2044
|
}
|
|
2095
2045
|
return void 0;
|
|
2096
2046
|
}
|
|
2097
|
-
var
|
|
2098
|
-
var
|
|
2099
|
-
var
|
|
2047
|
+
var PX_COLOR_ATTR_NAMES = /* @__PURE__ */ new Set(["color", "fill", "flood-color", "lighting-color", "stop-color", "stroke"]);
|
|
2048
|
+
var PX_TRANSFORM_FN_NAMES = /* @__PURE__ */ new Set(["translate", "rotate", "scale", "skew"]);
|
|
2049
|
+
var PX_PCT_BASED_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
|
|
2100
2050
|
function composeTransformParts(parts, opts) {
|
|
2101
2051
|
var _a2;
|
|
2102
2052
|
if (!parts) return "";
|
|
@@ -2149,8 +2099,7 @@ function parseTransformParts(str2) {
|
|
|
2149
2099
|
if (str2.replace(/([a-zA-Z]+)\s*\(([^)]*)\)/g, "").replace(/[\s,]/g, "").length) return void 0;
|
|
2150
2100
|
return Object.keys(out).length ? out : void 0;
|
|
2151
2101
|
}
|
|
2152
|
-
var
|
|
2153
|
-
var DEFAULT_DURATION_MS = 1e3;
|
|
2102
|
+
var PX_DEFAULT_DURATION_MS = 1e3;
|
|
2154
2103
|
function kebabToCamelCaseWord(kebab) {
|
|
2155
2104
|
return kebab.includes("-") ? kebab.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()) : kebab;
|
|
2156
2105
|
}
|
|
@@ -2313,81 +2262,19 @@ function invertEasing(easing) {
|
|
|
2313
2262
|
}
|
|
2314
2263
|
|
|
2315
2264
|
// 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) {
|
|
2265
|
+
function toDomProps(props) {
|
|
2379
2266
|
const propsCopy = {};
|
|
2380
2267
|
for (const rawKey of Object.keys(props)) {
|
|
2381
2268
|
const key = kebabToCamelCaseWord(rawKey);
|
|
2382
2269
|
if (INTERNAL_ATTRS.has(key)) continue;
|
|
2383
2270
|
if (key === "style") continue;
|
|
2384
2271
|
let value = props[rawKey];
|
|
2385
|
-
if (
|
|
2272
|
+
if (PX_COLOR_ATTR_NAMES.has(key) && Array.isArray(value)) {
|
|
2386
2273
|
propsCopy[key] = toRGBA(value);
|
|
2387
2274
|
} else if (key === "transform" && value !== null && typeof value === "object" && !Array.isArray(value) && !value.keyframes) {
|
|
2388
2275
|
const parts = value.value && typeof value.value === "object" ? value.value : value;
|
|
2389
2276
|
propsCopy[TRANSFORM_ATTR] = composeTransformParts(parts, { withUnits: false });
|
|
2390
|
-
} else if (
|
|
2277
|
+
} else if (PX_TRANSFORM_FN_NAMES.has(key)) {
|
|
2391
2278
|
if (Array.isArray(value)) {
|
|
2392
2279
|
if (key === "translate") value = value.map((v) => v + "px");
|
|
2393
2280
|
value = value.join(",");
|
|
@@ -2405,7 +2292,7 @@ function getNormalizedProps(props) {
|
|
|
2405
2292
|
|
|
2406
2293
|
// src/materialize/PxMotionPath.ts
|
|
2407
2294
|
function getKfTranslate(kf) {
|
|
2408
|
-
const v =
|
|
2295
|
+
const v = keyframeValue(kf);
|
|
2409
2296
|
if (!v) return void 0;
|
|
2410
2297
|
if (Array.isArray(v) && v.length >= 2 && typeof v[0] === "number" && typeof v[1] === "number") {
|
|
2411
2298
|
return [v[0], v[1]];
|
|
@@ -2415,17 +2302,17 @@ function getKfTranslate(kf) {
|
|
|
2415
2302
|
return void 0;
|
|
2416
2303
|
}
|
|
2417
2304
|
function getKfTime(kf) {
|
|
2418
|
-
return
|
|
2305
|
+
return keyframeTime(kf);
|
|
2419
2306
|
}
|
|
2420
2307
|
function getKfEasing(kf) {
|
|
2421
|
-
return
|
|
2308
|
+
return keyframeEasing(kf);
|
|
2422
2309
|
}
|
|
2423
2310
|
function propAnimIsMotionPath(anim) {
|
|
2424
2311
|
const kfs = anim.keyframes;
|
|
2425
2312
|
if (!Array.isArray(kfs)) return false;
|
|
2426
2313
|
if (anim.autoOrient) return true;
|
|
2427
2314
|
for (const kf of kfs) {
|
|
2428
|
-
if (
|
|
2315
|
+
if (keyframeTangentIn(kf) || keyframeTangentOut(kf)) return true;
|
|
2429
2316
|
}
|
|
2430
2317
|
return false;
|
|
2431
2318
|
}
|
|
@@ -2434,8 +2321,8 @@ function getSegmentCache(prevKf, nextKf, prevPos, nextPos) {
|
|
|
2434
2321
|
let byNext = _segmentCache.get(prevKf);
|
|
2435
2322
|
const existing = byNext == null ? void 0 : byNext.get(nextKf);
|
|
2436
2323
|
if (existing) return existing;
|
|
2437
|
-
const to =
|
|
2438
|
-
const ti =
|
|
2324
|
+
const to = keyframeTangentOut(prevKf);
|
|
2325
|
+
const ti = keyframeTangentIn(nextKf);
|
|
2439
2326
|
const P1 = [prevPos[0] + (to ? to[0] : 0), prevPos[1] + (to ? to[1] : 0)];
|
|
2440
2327
|
const P2 = [nextPos[0] + (ti ? ti[0] : 0), nextPos[1] + (ti ? ti[1] : 0)];
|
|
2441
2328
|
const lut = bezier2D_arcLengthLUT(prevPos, P1, P2, nextPos);
|
|
@@ -2528,7 +2415,7 @@ function materializeMotionPathInPropAnim(anim, opts) {
|
|
|
2528
2415
|
function unwrapAutoOrientRotations(kfs) {
|
|
2529
2416
|
let prev;
|
|
2530
2417
|
for (const kf of kfs) {
|
|
2531
|
-
const v =
|
|
2418
|
+
const v = keyframeValue(kf);
|
|
2532
2419
|
if (!v || typeof v.rotate !== "number") continue;
|
|
2533
2420
|
if (prev === void 0) {
|
|
2534
2421
|
prev = v.rotate;
|
|
@@ -2545,7 +2432,7 @@ function makeOutKf(time, value) {
|
|
|
2545
2432
|
return { t: time, v: value };
|
|
2546
2433
|
}
|
|
2547
2434
|
function getKfValueParts(kf) {
|
|
2548
|
-
const v =
|
|
2435
|
+
const v = keyframeValue(kf);
|
|
2549
2436
|
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
2550
2437
|
return v;
|
|
2551
2438
|
}
|
|
@@ -2607,7 +2494,7 @@ function wrappedAngleDelta(a, b) {
|
|
|
2607
2494
|
}
|
|
2608
2495
|
function insertSharpCornerStepKfIfNeeded(out, prevKf, nextKf, prevPos, nextPos, rotationTol) {
|
|
2609
2496
|
const lastKf = out[out.length - 1];
|
|
2610
|
-
const lastV =
|
|
2497
|
+
const lastV = keyframeValue(lastKf);
|
|
2611
2498
|
const prevExit = lastV == null ? void 0 : lastV.rotate;
|
|
2612
2499
|
if (typeof prevExit !== "number") return;
|
|
2613
2500
|
const boundaryV = getKfValueParts(prevKf);
|
|
@@ -2789,7 +2676,7 @@ function walkAndMaterialize(node, opts) {
|
|
|
2789
2676
|
}
|
|
2790
2677
|
|
|
2791
2678
|
// src/animation/PxDefinitions.ts
|
|
2792
|
-
var
|
|
2679
|
+
var PX_LOOP_JUMP_SHIFT_MS = 1;
|
|
2793
2680
|
function deepEqualValue(a, b) {
|
|
2794
2681
|
if (a === b) return true;
|
|
2795
2682
|
if (typeof a !== typeof b || a === null || b === null || typeof a !== "object") return false;
|
|
@@ -2965,7 +2852,7 @@ function interpolateValue(propName, a, b, t) {
|
|
|
2965
2852
|
const bPaths = (_b = b == null ? void 0 : b.paths) != null ? _b : Array.isArray(b) ? b : [];
|
|
2966
2853
|
return { paths: interpolateBeziers(aPaths, bPaths, t) };
|
|
2967
2854
|
}
|
|
2968
|
-
if (
|
|
2855
|
+
if (PX_COLOR_ATTR_NAMES.has(propName)) {
|
|
2969
2856
|
return interpolateColor(a || [0, 0, 0, 1], b || [0, 0, 0, 1], t);
|
|
2970
2857
|
}
|
|
2971
2858
|
if (propName === "transform" && typeof a === "object" && a !== null && !Array.isArray(a) && typeof b === "object" && b !== null && !Array.isArray(b)) {
|
|
@@ -2974,7 +2861,7 @@ function interpolateValue(propName, a, b, t) {
|
|
|
2974
2861
|
if (propName === "rotate" && typeof a === "number" && typeof b === "number") {
|
|
2975
2862
|
return interpolateNum(a, b, t);
|
|
2976
2863
|
}
|
|
2977
|
-
if (
|
|
2864
|
+
if (PX_TRANSFORM_FN_NAMES.has(propName) || propName === "stroke-dasharray" || propName === "strokeDasharray") {
|
|
2978
2865
|
return interpolateVec(a || [], b || [], t);
|
|
2979
2866
|
}
|
|
2980
2867
|
return interpolateNum(+(a || 0), +(b || 0), t);
|
|
@@ -3026,8 +2913,8 @@ function expandLoopKeyframes(propName, keyframes, loop, duration) {
|
|
|
3026
2913
|
relT: (kf.t - segStartT) / segDuration,
|
|
3027
2914
|
v: kf.v,
|
|
3028
2915
|
e: kf.e,
|
|
3029
|
-
tangentIn:
|
|
3030
|
-
tangentOut:
|
|
2916
|
+
tangentIn: keyframeTangentIn(kf),
|
|
2917
|
+
tangentOut: keyframeTangentOut(kf)
|
|
3031
2918
|
}));
|
|
3032
2919
|
const fullReps = Math.floor(fillDuration / segDuration);
|
|
3033
2920
|
const remainder = fillDuration - fullReps * segDuration;
|
|
@@ -3093,7 +2980,7 @@ function expandLoopKeyframes(propName, keyframes, loop, duration) {
|
|
|
3093
2980
|
}
|
|
3094
2981
|
}
|
|
3095
2982
|
const pushed = {
|
|
3096
|
-
t: repStart + entry.relT * segDuration + (isBoundary ?
|
|
2983
|
+
t: repStart + entry.relT * segDuration + (isBoundary ? PX_LOOP_JUMP_SHIFT_MS : 0),
|
|
3097
2984
|
v: entry.v,
|
|
3098
2985
|
e: i < entries.length - 1 ? entry.e : void 0
|
|
3099
2986
|
};
|
|
@@ -3180,14 +3067,14 @@ function normalizeKeyframes(propName, propAnim, duration, defs) {
|
|
|
3180
3067
|
const keyframes = propAnim.keyframes || [];
|
|
3181
3068
|
const normalized = [];
|
|
3182
3069
|
for (const kf of keyframes) {
|
|
3183
|
-
const timePct =
|
|
3184
|
-
let value =
|
|
3185
|
-
const easing =
|
|
3070
|
+
const timePct = keyframeTime(kf);
|
|
3071
|
+
let value = keyframeValue(kf);
|
|
3072
|
+
const easing = keyframeEasing(kf);
|
|
3186
3073
|
if (propName === "d") {
|
|
3187
3074
|
value = normalizePathValue(value);
|
|
3188
3075
|
}
|
|
3189
3076
|
const propNameKebab = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
|
|
3190
|
-
if (
|
|
3077
|
+
if (PX_COLOR_ATTR_NAMES.has(propNameKebab)) {
|
|
3191
3078
|
value = (_a2 = parseColor(value)) != null ? _a2 : value;
|
|
3192
3079
|
}
|
|
3193
3080
|
const normKf = {
|
|
@@ -3195,8 +3082,8 @@ function normalizeKeyframes(propName, propAnim, duration, defs) {
|
|
|
3195
3082
|
v: value,
|
|
3196
3083
|
e: resolveEasing(easing, defs)
|
|
3197
3084
|
};
|
|
3198
|
-
const tIn =
|
|
3199
|
-
const tOut =
|
|
3085
|
+
const tIn = keyframeTangentIn(kf);
|
|
3086
|
+
const tOut = keyframeTangentOut(kf);
|
|
3200
3087
|
if (tIn) normKf.tangentIn = tIn;
|
|
3201
3088
|
if (tOut) normKf.tangentOut = tOut;
|
|
3202
3089
|
normalized.push(normKf);
|
|
@@ -3228,17 +3115,17 @@ function materializeInternalLoopsInPropAnim(propName, propAnim, duration) {
|
|
|
3228
3115
|
const rawKfs = propAnim.keyframes;
|
|
3229
3116
|
if (!Array.isArray(rawKfs) || rawKfs.length < 2) return propAnim;
|
|
3230
3117
|
const propNameKebab = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
|
|
3231
|
-
const isColor =
|
|
3118
|
+
const isColor = PX_COLOR_ATTR_NAMES.has(propNameKebab);
|
|
3232
3119
|
const kfs = rawKfs.map((kf) => {
|
|
3233
3120
|
var _a2;
|
|
3234
|
-
const t =
|
|
3235
|
-
let v =
|
|
3121
|
+
const t = keyframeTime(kf);
|
|
3122
|
+
let v = keyframeValue(kf);
|
|
3236
3123
|
if (propName === "d") v = normalizePathValue(v);
|
|
3237
3124
|
if (isColor) v = (_a2 = parseColor(v)) != null ? _a2 : v;
|
|
3238
|
-
const e =
|
|
3125
|
+
const e = keyframeEasing(kf);
|
|
3239
3126
|
const out2 = { t, v, e };
|
|
3240
|
-
const tIn =
|
|
3241
|
-
const tOut =
|
|
3127
|
+
const tIn = keyframeTangentIn(kf);
|
|
3128
|
+
const tOut = keyframeTangentOut(kf);
|
|
3242
3129
|
if (tIn) out2.tangentIn = tIn;
|
|
3243
3130
|
if (tOut) out2.tangentOut = tOut;
|
|
3244
3131
|
return out2;
|
|
@@ -3303,7 +3190,7 @@ function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
|
|
|
3303
3190
|
}
|
|
3304
3191
|
return animDef;
|
|
3305
3192
|
}
|
|
3306
|
-
const channels = Object.keys(animDef).filter((k) =>
|
|
3193
|
+
const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
|
|
3307
3194
|
if (channels.length !== 1) return animDef;
|
|
3308
3195
|
const ch = channels[0];
|
|
3309
3196
|
const chAnim = animDef[ch];
|
|
@@ -3332,9 +3219,9 @@ function normalizeAnimationDefinition(animDef, duration, defs, engine = PxTimeli
|
|
|
3332
3219
|
}
|
|
3333
3220
|
return normalized;
|
|
3334
3221
|
}
|
|
3335
|
-
function
|
|
3222
|
+
function normalizeBindings(doc, engine = PxTimelineEngine.native) {
|
|
3336
3223
|
const animatorConfig = getAnimatorConfig(doc) || {};
|
|
3337
|
-
const defs =
|
|
3224
|
+
const defs = getDefinitions(doc);
|
|
3338
3225
|
const duration = animatorConfig.duration || 1e3;
|
|
3339
3226
|
const bindings = [];
|
|
3340
3227
|
const processAnimation = (id, animDefs, staticTransform) => {
|
|
@@ -3404,7 +3291,7 @@ function calcPropertyValue(propName, propAnim, progress) {
|
|
|
3404
3291
|
const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
|
|
3405
3292
|
let localProgress = prevKf === nextKf ? 0 : remap(progress, (_a2 = prevKf.t) != null ? _a2 : 0, (_b = nextKf.t) != null ? _b : 0, 0, 1);
|
|
3406
3293
|
localProgress = clamp(localProgress, 0, 1);
|
|
3407
|
-
const easing =
|
|
3294
|
+
const easing = keyframeEasing(prevKf);
|
|
3408
3295
|
if (easing && Array.isArray(easing)) {
|
|
3409
3296
|
try {
|
|
3410
3297
|
localProgress = cubicBezier(easing)(localProgress);
|
|
@@ -3423,7 +3310,7 @@ function calcPropertyValue(propName, propAnim, progress) {
|
|
|
3423
3310
|
nextPaths,
|
|
3424
3311
|
localProgress
|
|
3425
3312
|
).map((bz) => bezierToSvgPath(bz)).join("");
|
|
3426
|
-
} else if (
|
|
3313
|
+
} else if (PX_COLOR_ATTR_NAMES.has(cssAttrName)) {
|
|
3427
3314
|
cssValue = toRGBA(interpolateColor(
|
|
3428
3315
|
prevV || [0, 0, 0, 1],
|
|
3429
3316
|
nextV || [0, 0, 0, 1],
|
|
@@ -3497,14 +3384,14 @@ function calcPropertyValue(propName, propAnim, progress) {
|
|
|
3497
3384
|
cssValue = "scale(" + v.join(",") + ")";
|
|
3498
3385
|
cssAttrName = "transform";
|
|
3499
3386
|
} else {
|
|
3500
|
-
const
|
|
3387
|
+
const num = interpolateNum(
|
|
3501
3388
|
+(prevV || 0),
|
|
3502
3389
|
+(nextV || 0),
|
|
3503
3390
|
localProgress
|
|
3504
3391
|
);
|
|
3505
|
-
cssValue =
|
|
3392
|
+
cssValue = num;
|
|
3506
3393
|
}
|
|
3507
|
-
if (
|
|
3394
|
+
if (PX_PCT_BASED_ATTR_NAMES.has(cssAttrName) && typeof cssValue === "number") {
|
|
3508
3395
|
cssValue = cssValue * 100 + "%";
|
|
3509
3396
|
}
|
|
3510
3397
|
return { k: cssAttrName, v: cssValue === null ? "" : "" + cssValue };
|
|
@@ -4069,11 +3956,11 @@ function buildStopChildren(stops, ctx) {
|
|
|
4069
3956
|
const loopFromSource = read.loop;
|
|
4070
3957
|
let stopCount = 0;
|
|
4071
3958
|
for (const kf of kfs) {
|
|
4072
|
-
const v =
|
|
3959
|
+
const v = keyframeValue(kf);
|
|
4073
3960
|
if (Array.isArray(v) && v.length > stopCount) stopCount = v.length;
|
|
4074
3961
|
}
|
|
4075
3962
|
if (!stopCount) return [];
|
|
4076
|
-
const firstKfValue =
|
|
3963
|
+
const firstKfValue = keyframeValue(kfs[0]);
|
|
4077
3964
|
const baselineStops = [];
|
|
4078
3965
|
for (let i = 0; i < stopCount; i++) {
|
|
4079
3966
|
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 +3981,11 @@ function animatedStopNode(baseline, kfs, stopIdx, _ctx, loop) {
|
|
|
4094
3981
|
const offsetKfs = [];
|
|
4095
3982
|
let offsetVaries = false;
|
|
4096
3983
|
for (const kf of kfs) {
|
|
4097
|
-
const t =
|
|
4098
|
-
const arr =
|
|
3984
|
+
const t = keyframeTime(kf);
|
|
3985
|
+
const arr = keyframeValue(kf);
|
|
4099
3986
|
const sliced = (_a2 = arr == null ? void 0 : arr[stopIdx]) != null ? _a2 : prevDefinedStop(kfs, kfs.indexOf(kf), stopIdx);
|
|
4100
3987
|
if (!sliced) continue;
|
|
4101
|
-
const easing =
|
|
3988
|
+
const easing = keyframeEasing(kf);
|
|
4102
3989
|
const colorOut = { time: t, value: sliced.color };
|
|
4103
3990
|
if (easing !== void 0) colorOut.easing = easing;
|
|
4104
3991
|
colorKfs.push(colorOut);
|
|
@@ -4126,11 +4013,11 @@ function animatedStopNode(baseline, kfs, stopIdx, _ctx, loop) {
|
|
|
4126
4013
|
}
|
|
4127
4014
|
function prevDefinedStop(kfs, fromIdx, stopIdx) {
|
|
4128
4015
|
for (let i = fromIdx; i >= 0; i--) {
|
|
4129
|
-
const arr =
|
|
4016
|
+
const arr = keyframeValue(kfs[i]);
|
|
4130
4017
|
if (arr == null ? void 0 : arr[stopIdx]) return arr[stopIdx];
|
|
4131
4018
|
}
|
|
4132
4019
|
for (let i = fromIdx + 1; i < kfs.length; i++) {
|
|
4133
|
-
const arr =
|
|
4020
|
+
const arr = keyframeValue(kfs[i]);
|
|
4134
4021
|
if (arr == null ? void 0 : arr[stopIdx]) return arr[stopIdx];
|
|
4135
4022
|
}
|
|
4136
4023
|
return void 0;
|
|
@@ -4816,7 +4703,7 @@ function parseCubics(d) {
|
|
|
4816
4703
|
let pcx = 0, pcy = 0;
|
|
4817
4704
|
let pqx = 0, pqy = 0;
|
|
4818
4705
|
let prevCmd = "";
|
|
4819
|
-
const
|
|
4706
|
+
const num = () => parseFloat(tokens[i++]);
|
|
4820
4707
|
const push = (P1, P2, P3) => {
|
|
4821
4708
|
const P0 = [cx, cy];
|
|
4822
4709
|
const lut = bezier2D_arcLengthLUT(P0, P1, P2, P3, LUT_STEPS);
|
|
@@ -4845,7 +4732,7 @@ function parseCubics(d) {
|
|
|
4845
4732
|
continue;
|
|
4846
4733
|
}
|
|
4847
4734
|
if (U === "M") {
|
|
4848
|
-
const x =
|
|
4735
|
+
const x = num() + (rel ? cx : 0), y = num() + (rel ? cy : 0);
|
|
4849
4736
|
cx = x;
|
|
4850
4737
|
cy = y;
|
|
4851
4738
|
sx = x;
|
|
@@ -4854,29 +4741,29 @@ function parseCubics(d) {
|
|
|
4854
4741
|
continue;
|
|
4855
4742
|
}
|
|
4856
4743
|
if (U === "L") {
|
|
4857
|
-
pushLine(
|
|
4744
|
+
pushLine(num() + (rel ? cx : 0), num() + (rel ? cy : 0));
|
|
4858
4745
|
} else if (U === "H") {
|
|
4859
|
-
pushLine(
|
|
4746
|
+
pushLine(num() + (rel ? cx : 0), cy);
|
|
4860
4747
|
} else if (U === "V") {
|
|
4861
|
-
pushLine(cx,
|
|
4748
|
+
pushLine(cx, num() + (rel ? cy : 0));
|
|
4862
4749
|
} else if (U === "C") {
|
|
4863
|
-
const p1 = [
|
|
4864
|
-
const p2 = [
|
|
4865
|
-
const p3 = [
|
|
4750
|
+
const p1 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4751
|
+
const p2 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4752
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4866
4753
|
pcx = p2[0];
|
|
4867
4754
|
pcy = p2[1];
|
|
4868
4755
|
push(p1, p2, p3);
|
|
4869
4756
|
} else if (U === "S") {
|
|
4870
4757
|
const smooth = prevCmd.toUpperCase() === "C" || prevCmd.toUpperCase() === "S";
|
|
4871
4758
|
const p1 = smooth ? [2 * cx - pcx, 2 * cy - pcy] : [cx, cy];
|
|
4872
|
-
const p2 = [
|
|
4873
|
-
const p3 = [
|
|
4759
|
+
const p2 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4760
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4874
4761
|
pcx = p2[0];
|
|
4875
4762
|
pcy = p2[1];
|
|
4876
4763
|
push(p1, p2, p3);
|
|
4877
4764
|
} else if (U === "Q") {
|
|
4878
|
-
const qc = [
|
|
4879
|
-
const p3 = [
|
|
4765
|
+
const qc = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4766
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4880
4767
|
pqx = qc[0];
|
|
4881
4768
|
pqy = qc[1];
|
|
4882
4769
|
const { P1, P2 } = quadToCubic([cx, cy], qc, p3);
|
|
@@ -4884,14 +4771,14 @@ function parseCubics(d) {
|
|
|
4884
4771
|
} else if (U === "T") {
|
|
4885
4772
|
const smooth = prevCmd.toUpperCase() === "Q" || prevCmd.toUpperCase() === "T";
|
|
4886
4773
|
const qc = smooth ? [2 * cx - pqx, 2 * cy - pqy] : [cx, cy];
|
|
4887
|
-
const p3 = [
|
|
4774
|
+
const p3 = [num() + (rel ? cx : 0), num() + (rel ? cy : 0)];
|
|
4888
4775
|
pqx = qc[0];
|
|
4889
4776
|
pqy = qc[1];
|
|
4890
4777
|
const { P1, P2 } = quadToCubic([cx, cy], qc, p3);
|
|
4891
4778
|
push(P1, P2, p3);
|
|
4892
4779
|
} else if (U === "A") {
|
|
4893
4780
|
i += 5;
|
|
4894
|
-
pushLine(
|
|
4781
|
+
pushLine(num() + (rel ? cx : 0), num() + (rel ? cy : 0));
|
|
4895
4782
|
} else {
|
|
4896
4783
|
i++;
|
|
4897
4784
|
continue;
|
|
@@ -5067,20 +4954,20 @@ function transformPathData(d, m, decimals = 2) {
|
|
|
5067
4954
|
while ((match = TOKEN_RE.exec(d)) !== null) tokens.push(match[0]);
|
|
5068
4955
|
let out = "";
|
|
5069
4956
|
let i = 0;
|
|
5070
|
-
const
|
|
4957
|
+
const num = () => parseFloat(tokens[i++]);
|
|
5071
4958
|
while (i < tokens.length) {
|
|
5072
4959
|
const cmd = tokens[i++];
|
|
5073
4960
|
if (cmd === "M" || cmd === "L") {
|
|
5074
|
-
const [x, y] = apply(m,
|
|
4961
|
+
const [x, y] = apply(m, num(), num());
|
|
5075
4962
|
out += cmd + pack([x, y], decimals);
|
|
5076
4963
|
} else if (cmd === "C") {
|
|
5077
|
-
const [x1, y1] = apply(m,
|
|
5078
|
-
const [x2, y2] = apply(m,
|
|
5079
|
-
const [x, y] = apply(m,
|
|
4964
|
+
const [x1, y1] = apply(m, num(), num());
|
|
4965
|
+
const [x2, y2] = apply(m, num(), num());
|
|
4966
|
+
const [x, y] = apply(m, num(), num());
|
|
5080
4967
|
out += "C" + pack([x1, y1, x2, y2, x, y], decimals);
|
|
5081
4968
|
} else if (cmd === "Q") {
|
|
5082
|
-
const [x1, y1] = apply(m,
|
|
5083
|
-
const [x, y] = apply(m,
|
|
4969
|
+
const [x1, y1] = apply(m, num(), num());
|
|
4970
|
+
const [x, y] = apply(m, num(), num());
|
|
5084
4971
|
out += "Q" + pack([x1, y1, x, y], decimals);
|
|
5085
4972
|
} else if (cmd === "Z" || cmd === "z") {
|
|
5086
4973
|
out += "Z";
|
|
@@ -5111,7 +4998,7 @@ var TEXT_ATTR_KEYS = [
|
|
|
5111
4998
|
"stroke",
|
|
5112
4999
|
"strokeWidth",
|
|
5113
5000
|
"effects",
|
|
5114
|
-
|
|
5001
|
+
PX_TEXT_CONTENT_ATTR,
|
|
5115
5002
|
"xml:space"
|
|
5116
5003
|
];
|
|
5117
5004
|
var PAINT_STATIC_KEYS = [
|
|
@@ -5265,13 +5152,13 @@ function materializeGlyphTextHorizontal(node, opts) {
|
|
|
5265
5152
|
if (y !== void 0) pen.y = y;
|
|
5266
5153
|
pen.x += (_a3 = parseLen(el.dx)) != null ? _a3 : 0;
|
|
5267
5154
|
pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
|
|
5268
|
-
const content = str(el[
|
|
5155
|
+
const content = str(el[PX_TEXT_CONTENT_ATTR]);
|
|
5269
5156
|
if (content && !((_c2 = el.children) == null ? void 0 : _c2.length)) renderChars(content, s);
|
|
5270
5157
|
if (el.children) for (const ch of el.children) walk(ch, s);
|
|
5271
5158
|
};
|
|
5272
5159
|
const rootStyle = rootStyleOf(node);
|
|
5273
5160
|
if (node.children) for (const ch of node.children) walk(ch, rootStyle);
|
|
5274
|
-
const rootContent = str(node[
|
|
5161
|
+
const rootContent = str(node[PX_TEXT_CONTENT_ATTR]);
|
|
5275
5162
|
if (rootContent && !((_c = node.children) == null ? void 0 : _c.length)) renderChars(rootContent, rootStyle);
|
|
5276
5163
|
const anchor = str(node.textAnchor);
|
|
5277
5164
|
if (anchor === "middle" || anchor === "end") {
|
|
@@ -5283,141 +5170,13 @@ function materializeGlyphTextHorizontal(node, opts) {
|
|
|
5283
5170
|
}
|
|
5284
5171
|
return toGroup(node, buildPaths(placements, create, warnings), create);
|
|
5285
5172
|
}
|
|
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
5173
|
function collectAlongPathCells(node, glyphs, soleFont, warnings) {
|
|
5415
5174
|
const cells = [];
|
|
5416
5175
|
let adv = 0;
|
|
5417
5176
|
const walk = (el, parentStyle) => {
|
|
5418
5177
|
var _a2, _b;
|
|
5419
5178
|
const s = resolveStyle(el, parentStyle);
|
|
5420
|
-
const content = str(el[
|
|
5179
|
+
const content = str(el[PX_TEXT_CONTENT_ATTR]);
|
|
5421
5180
|
if (content && !((_a2 = el.children) == null ? void 0 : _a2.length)) {
|
|
5422
5181
|
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
5423
5182
|
if (gf) {
|
|
@@ -5632,10 +5391,6 @@ function toGroup(node, children, create) {
|
|
|
5632
5391
|
}
|
|
5633
5392
|
return create("g", gProps, children);
|
|
5634
5393
|
}
|
|
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
5394
|
function applyTextGlyphsEffect(node, fx, ctx) {
|
|
5640
5395
|
if (!(fx == null ? void 0 : fx.useGlyphs)) return node;
|
|
5641
5396
|
if (!ctx.glyphs) {
|
|
@@ -5792,7 +5547,7 @@ function readScalarValues(r) {
|
|
|
5792
5547
|
if (r.kind === "static" /* Static */) return [r.value];
|
|
5793
5548
|
const out = [];
|
|
5794
5549
|
for (const kf of r.keyframes) {
|
|
5795
|
-
const v =
|
|
5550
|
+
const v = keyframeValue(kf);
|
|
5796
5551
|
if (typeof v === "number") out.push(v);
|
|
5797
5552
|
}
|
|
5798
5553
|
return out;
|
|
@@ -5803,9 +5558,9 @@ function computeAnimAttr(read, map) {
|
|
|
5803
5558
|
return {
|
|
5804
5559
|
kind: "animated" /* Animated */,
|
|
5805
5560
|
keyframes: read.keyframes.map((kf) => ({
|
|
5806
|
-
time:
|
|
5807
|
-
value: map(
|
|
5808
|
-
easing:
|
|
5561
|
+
time: keyframeTime(kf),
|
|
5562
|
+
value: map(keyframeValue(kf)),
|
|
5563
|
+
easing: keyframeEasing(kf)
|
|
5809
5564
|
})),
|
|
5810
5565
|
loop: read.loop
|
|
5811
5566
|
};
|
|
@@ -5823,7 +5578,7 @@ function computeOpacityFromRange(rangeRead) {
|
|
|
5823
5578
|
let anyHide = false;
|
|
5824
5579
|
let allHide = true;
|
|
5825
5580
|
for (const kf of kfs) {
|
|
5826
|
-
if (hide(
|
|
5581
|
+
if (hide(keyframeValue(kf))) anyHide = true;
|
|
5827
5582
|
else allHide = false;
|
|
5828
5583
|
}
|
|
5829
5584
|
if (!anyHide) return void 0;
|
|
@@ -5833,10 +5588,10 @@ function computeOpacityFromRange(rangeRead) {
|
|
|
5833
5588
|
const kf = kfs[i];
|
|
5834
5589
|
const prevKf = i > 0 ? kfs[i - 1] : void 0;
|
|
5835
5590
|
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(
|
|
5591
|
+
const t = keyframeTime(kf);
|
|
5592
|
+
const thisHide = hide(keyframeValue(kf));
|
|
5593
|
+
const prevHide = prevKf ? thisHide && hide(keyframeValue(prevKf)) : thisHide;
|
|
5594
|
+
const nextHide = nextKf ? thisHide && hide(keyframeValue(nextKf)) : thisHide;
|
|
5840
5595
|
if (prevHide && !nextHide) {
|
|
5841
5596
|
out.push({ time: t, value: 0 });
|
|
5842
5597
|
out.push({ time: t + OPACITY_STEP_MS, value: 1 });
|
|
@@ -5852,9 +5607,9 @@ function readRangeWithCrossings(raw) {
|
|
|
5852
5607
|
const r = readAnimatable(raw);
|
|
5853
5608
|
if (r.kind !== "animated" /* Animated */) return r;
|
|
5854
5609
|
const kfs = r.keyframes.map((kf) => ({
|
|
5855
|
-
time:
|
|
5856
|
-
value:
|
|
5857
|
-
easing:
|
|
5610
|
+
time: keyframeTime(kf),
|
|
5611
|
+
value: keyframeValue(kf),
|
|
5612
|
+
easing: keyframeEasing(kf)
|
|
5858
5613
|
}));
|
|
5859
5614
|
const hasReverse = kfs.some((kf) => kf.value[0] > kf.value[1]);
|
|
5860
5615
|
if (!hasReverse) {
|
|
@@ -5982,7 +5737,7 @@ function shapeToPathD(node) {
|
|
|
5982
5737
|
}
|
|
5983
5738
|
|
|
5984
5739
|
// src/effects/PlayerEffectsUtil.ts
|
|
5985
|
-
function
|
|
5740
|
+
function materializeNodeEffects(root) {
|
|
5986
5741
|
var _a2, _b;
|
|
5987
5742
|
const ctx = {
|
|
5988
5743
|
defs: [],
|
|
@@ -5995,7 +5750,7 @@ function applyPlayerEffects(root) {
|
|
|
5995
5750
|
// Resolved engine: `frames` ONLY when explicitly set; auto/waapi/unset →
|
|
5996
5751
|
// waapi (we're not 100% sure it's frames, and CSS/WAAPI need the inline form).
|
|
5997
5752
|
engine: resolveTimelineEngine((_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.engine),
|
|
5998
|
-
glyphs: (_b =
|
|
5753
|
+
glyphs: (_b = getDefinitions(root)) == null ? void 0 : _b.fonts
|
|
5999
5754
|
};
|
|
6000
5755
|
const working = clone(root);
|
|
6001
5756
|
indexById(working, ctx.idMap);
|
|
@@ -6079,11 +5834,11 @@ function buildOffsetPath(propAnim) {
|
|
|
6079
5834
|
if (propAnim.alongPathMode !== "offsetPath") return void 0;
|
|
6080
5835
|
const kfs = propAnim.keyframes;
|
|
6081
5836
|
if (!kfs || kfs.length < 2) return void 0;
|
|
6082
|
-
const first =
|
|
5837
|
+
const first = keyframeValue(kfs[0]);
|
|
6083
5838
|
const anchor = (first == null ? void 0 : first.origin) && first.origin.length >= 2 ? [first.origin[0], first.origin[1]] : [0, 0];
|
|
6084
5839
|
const points = [];
|
|
6085
5840
|
for (const kf of kfs) {
|
|
6086
|
-
const v =
|
|
5841
|
+
const v = keyframeValue(kf);
|
|
6087
5842
|
const tr = v == null ? void 0 : v.translate;
|
|
6088
5843
|
if (!tr || tr.length < 2) return void 0;
|
|
6089
5844
|
const parts = Object.keys(v);
|
|
@@ -6092,13 +5847,13 @@ function buildOffsetPath(propAnim) {
|
|
|
6092
5847
|
if (o[0] !== anchor[0] || o[1] !== anchor[1]) return void 0;
|
|
6093
5848
|
points.push([tr[0] + anchor[0], tr[1] + anchor[1]]);
|
|
6094
5849
|
}
|
|
6095
|
-
if (!kfs.some((kf) =>
|
|
5850
|
+
if (!kfs.some((kf) => keyframeTangentIn(kf) || keyframeTangentOut(kf))) return void 0;
|
|
6096
5851
|
let d = "M" + fmt2(points[0][0]) + "," + fmt2(points[0][1]);
|
|
6097
5852
|
const segLens = [];
|
|
6098
5853
|
for (let i = 0; i < points.length - 1; i++) {
|
|
6099
5854
|
const p0 = points[i], p1 = points[i + 1];
|
|
6100
|
-
const to = (_b =
|
|
6101
|
-
const ti = (_c =
|
|
5855
|
+
const to = (_b = keyframeTangentOut(kfs[i])) != null ? _b : [0, 0];
|
|
5856
|
+
const ti = (_c = keyframeTangentIn(kfs[i + 1])) != null ? _c : [0, 0];
|
|
6102
5857
|
const c1 = [p0[0] + to[0], p0[1] + to[1]];
|
|
6103
5858
|
const c2 = [p1[0] + ti[0], p1[1] + ti[1]];
|
|
6104
5859
|
d += "C" + fmt2(c1[0]) + "," + fmt2(c1[1]) + "," + fmt2(c2[0]) + "," + fmt2(c2[1]) + "," + fmt2(p1[0]) + "," + fmt2(p1[1]);
|
|
@@ -6110,8 +5865,8 @@ function buildOffsetPath(propAnim) {
|
|
|
6110
5865
|
let cum = 0;
|
|
6111
5866
|
for (let i = 0; i < kfs.length; i++) {
|
|
6112
5867
|
if (i > 0) cum += segLens[i - 1];
|
|
6113
|
-
const out = { t:
|
|
6114
|
-
const e =
|
|
5868
|
+
const out = { t: keyframeTime(kfs[i]), v: cum / total };
|
|
5869
|
+
const e = keyframeEasing(kfs[i]);
|
|
6115
5870
|
if (e !== void 0) out.e = e;
|
|
6116
5871
|
distanceKfs.push(out);
|
|
6117
5872
|
}
|
|
@@ -6310,14 +6065,14 @@ function walkAndMaterialize2(node, idMap, animatedIds, genId3, defsCollector, ro
|
|
|
6310
6065
|
}
|
|
6311
6066
|
|
|
6312
6067
|
// src/materialize/PxAnimatorMaterializeAll.ts
|
|
6313
|
-
function materializeAllInTree(doc, engine,
|
|
6068
|
+
function materializeAllInTree(doc, engine, options) {
|
|
6314
6069
|
var _a2, _b;
|
|
6315
|
-
let root =
|
|
6070
|
+
let root = materializeNodeEffects(doc).root;
|
|
6316
6071
|
root = materializeOffsetPathsInTree(root);
|
|
6317
|
-
const duration = (_b = (_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.duration) != null ? _b :
|
|
6072
|
+
const duration = (_b = (_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.duration) != null ? _b : PX_DEFAULT_DURATION_MS;
|
|
6318
6073
|
root = materializeInternalLoopsInTree(root, duration);
|
|
6319
6074
|
if (engine === PxTimelineEngine.native) {
|
|
6320
|
-
root = materializeMotionPathsInTree(root,
|
|
6075
|
+
root = materializeMotionPathsInTree(root, options == null ? void 0 : options.motionPath);
|
|
6321
6076
|
root = materializeAnimatedUseInstances(root);
|
|
6322
6077
|
root = pruneUnreferencedDefs(root);
|
|
6323
6078
|
}
|
|
@@ -6427,16 +6182,16 @@ function cancelFrame(handle) {
|
|
|
6427
6182
|
}
|
|
6428
6183
|
g.clearTimeout(handle);
|
|
6429
6184
|
}
|
|
6430
|
-
function
|
|
6185
|
+
function createAdapterAnimator(doc, adapter, callbacks) {
|
|
6431
6186
|
var _a2;
|
|
6432
6187
|
const config = getAnimatorConfig(doc) || {};
|
|
6433
|
-
const bindings =
|
|
6188
|
+
const bindings = normalizeBindings(doc, PxTimelineEngine.js);
|
|
6434
6189
|
const _iterations = config.iterations;
|
|
6435
6190
|
let iterations = 1;
|
|
6436
6191
|
if (typeof _iterations === "number") iterations = _iterations || 1;
|
|
6437
6192
|
if (_iterations === "infinite") iterations = Infinity;
|
|
6438
6193
|
if (iterations < 1) iterations = 1;
|
|
6439
|
-
const duration = +(config.duration ||
|
|
6194
|
+
const duration = +(config.duration || PX_DEFAULT_DURATION_MS);
|
|
6440
6195
|
const totalDuration = duration && iterations ? duration * (iterations === Infinity ? Infinity : iterations) : duration ? (iterations != null ? iterations : 1) * duration : 0;
|
|
6441
6196
|
const direction = config.direction || "normal";
|
|
6442
6197
|
const fill = (_a2 = config.fill) != null ? _a2 : "forwards";
|
|
@@ -6707,35 +6462,6 @@ var PxDiagnosticKind = {
|
|
|
6707
6462
|
/** The player failed where it did not expect to — report it to us. */
|
|
6708
6463
|
internal: "internal"
|
|
6709
6464
|
};
|
|
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
6465
|
|
|
6740
6466
|
// src/playback/PxAnimatorConfigPatch.ts
|
|
6741
6467
|
var FLAT_ONLY_KEYS = [
|
|
@@ -6855,9 +6581,9 @@ function mergeAnimatorConfig(base, patch) {
|
|
|
6855
6581
|
}
|
|
6856
6582
|
return { config: out, warnings };
|
|
6857
6583
|
}
|
|
6858
|
-
function applyAnimatorConfig(doc, patch,
|
|
6584
|
+
function applyAnimatorConfig(doc, patch, options) {
|
|
6859
6585
|
var _a2, _b;
|
|
6860
|
-
const reset = !!(
|
|
6586
|
+
const reset = !!(options == null ? void 0 : options.resetTimeline);
|
|
6861
6587
|
if (!doc || (patch === void 0 || !reset && (patch === null || !isPlainObject(patch) || !Object.keys(patch).length))) {
|
|
6862
6588
|
return { doc, warnings: [] };
|
|
6863
6589
|
}
|
|
@@ -6890,7 +6616,6 @@ function applyAnimatorConfig(doc, patch, opts) {
|
|
|
6890
6616
|
}
|
|
6891
6617
|
|
|
6892
6618
|
// src/format/PxDocumentDiagnostic.ts
|
|
6893
|
-
var MAX_REPORTED = 6;
|
|
6894
6619
|
function diagnoseDocument(doc) {
|
|
6895
6620
|
try {
|
|
6896
6621
|
return { problems: validateDocument(doc) };
|
|
@@ -6898,421 +6623,16 @@ function diagnoseDocument(doc) {
|
|
|
6898
6623
|
return { problems: [] };
|
|
6899
6624
|
}
|
|
6900
6625
|
}
|
|
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
6626
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7299
6627
|
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
6628
|
PX_RATE_REJECTED,
|
|
7313
6629
|
PX_TRANSFORM_PART_KEYS,
|
|
7314
6630
|
PX_TRIGGER_DEFAULTS,
|
|
7315
|
-
|
|
6631
|
+
PX_WIRE_BASELINE_VERSION,
|
|
6632
|
+
PX_WIRE_SCHEMA_VERSION,
|
|
6633
|
+
PX_WIRE_STEPS,
|
|
6634
|
+
PX_WIRE_VERSION,
|
|
6635
|
+
PX_WIRE_VERSION_KEY,
|
|
7316
6636
|
PxAlongPathMode,
|
|
7317
6637
|
PxAnimatedSvgDocumentSchema,
|
|
7318
6638
|
PxAnimatorConfigSchema,
|
|
@@ -7322,7 +6642,7 @@ function releaseLogProblems(releases, steps, declared, baseline) {
|
|
|
7322
6642
|
PxCloneEffectSchema,
|
|
7323
6643
|
PxCloneWithout,
|
|
7324
6644
|
PxControlMode,
|
|
7325
|
-
|
|
6645
|
+
PxDefinitionsSchema,
|
|
7326
6646
|
PxDiagnosticKind,
|
|
7327
6647
|
PxEffectsSchema,
|
|
7328
6648
|
PxElementAnimationSchema,
|
|
@@ -7340,7 +6660,7 @@ function releaseLogProblems(releases, steps, declared, baseline) {
|
|
|
7340
6660
|
PxLoopSchema,
|
|
7341
6661
|
PxMaskType,
|
|
7342
6662
|
PxMaskedByEffectSchema,
|
|
7343
|
-
|
|
6663
|
+
PxNodeBaseSchema,
|
|
7344
6664
|
PxNodeSchema,
|
|
7345
6665
|
PxOutAction,
|
|
7346
6666
|
PxPathOverflow,
|
|
@@ -7359,105 +6679,65 @@ function releaseLogProblems(releases, steps, declared, baseline) {
|
|
|
7359
6679
|
PxStartOn,
|
|
7360
6680
|
PxStrokeTrimEffectSchema,
|
|
7361
6681
|
PxStrokeTrimSubPaths,
|
|
7362
|
-
|
|
6682
|
+
PxSvgNodeRootSchema,
|
|
7363
6683
|
PxTextEffectSchema,
|
|
7364
6684
|
PxTextPathEffectSchema,
|
|
7365
6685
|
PxTextPathMethod,
|
|
7366
6686
|
PxTextPathSpacing,
|
|
7367
6687
|
PxTimelineEngine,
|
|
7368
|
-
|
|
6688
|
+
PxTimelineEngineSetting,
|
|
7369
6689
|
PxTimelineSchema,
|
|
7370
6690
|
PxTransformByEffectSchema,
|
|
7371
6691
|
PxTransformPartsSchema,
|
|
7372
6692
|
PxTransformValueSchema,
|
|
7373
6693
|
PxTriggerSchema,
|
|
7374
6694
|
PxUnits,
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
TRANSFORM_FN_NAMES,
|
|
7378
|
-
WIRE_VERSION_KEY,
|
|
7379
|
-
WireStepKind,
|
|
7380
|
-
WireVersionRelation,
|
|
6695
|
+
PxWireStepKind,
|
|
6696
|
+
PxWireVersionRelation,
|
|
7381
6697
|
applyAnimatorConfig,
|
|
7382
|
-
applyPlayerEffects,
|
|
7383
6698
|
applyWireSteps,
|
|
7384
|
-
bezierToSvgPath,
|
|
7385
6699
|
calcAnimationValues,
|
|
7386
|
-
camelCaseToKebabWordIfNeeded,
|
|
7387
|
-
clamp,
|
|
7388
6700
|
clampSeekMs,
|
|
7389
6701
|
compareWireVersion,
|
|
7390
|
-
composeTransformParts,
|
|
7391
6702
|
controlModeTakesOverTrigger,
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
createDiagnostics,
|
|
7395
|
-
createPathSampler,
|
|
6703
|
+
convertWireDocument,
|
|
6704
|
+
createAdapterAnimator,
|
|
7396
6705
|
createRunClock,
|
|
7397
|
-
cubicBezier,
|
|
7398
|
-
deepClone,
|
|
7399
6706
|
describeSchema,
|
|
7400
6707
|
diagnoseDocument,
|
|
7401
|
-
|
|
7402
|
-
diffInEffect,
|
|
7403
|
-
downgradePlayerDocument,
|
|
7404
|
-
extendedPathForBrowser,
|
|
6708
|
+
downgradeWireDocument,
|
|
7405
6709
|
flattenAnimatorTimeline,
|
|
7406
6710
|
foldTimelineOverride,
|
|
7407
6711
|
formatWireVersion,
|
|
7408
6712
|
generateNewIds,
|
|
7409
|
-
generateUniqueId,
|
|
7410
6713
|
getAnimatorConfig,
|
|
7411
6714
|
getBindings,
|
|
7412
6715
|
getChildren,
|
|
7413
|
-
|
|
7414
|
-
getNormalizedBindings,
|
|
7415
|
-
getNormalizedProps,
|
|
7416
|
-
interpolateValue,
|
|
6716
|
+
getDefinitions,
|
|
7417
6717
|
isNativeForced,
|
|
7418
|
-
|
|
7419
|
-
isPxElementFileFormatDeep,
|
|
7420
|
-
isScrollTimeline,
|
|
6718
|
+
isPxDocument,
|
|
7421
6719
|
isValidPlaybackRate,
|
|
7422
|
-
|
|
7423
|
-
kfEasing,
|
|
7424
|
-
kfValue,
|
|
7425
|
-
layoutGlyphTextChars,
|
|
6720
|
+
isValidPxDocument,
|
|
7426
6721
|
materializeAllInTree,
|
|
7427
|
-
|
|
7428
|
-
materializeGlyphTextAlongPath,
|
|
7429
|
-
materializeMotionPathInPropAnim,
|
|
6722
|
+
materializeNodeEffects,
|
|
7430
6723
|
mayUseNativeScrollTimeline,
|
|
7431
6724
|
mergeAnimatorConfig,
|
|
7432
|
-
mergeStaticTransformIntoAnimDef,
|
|
7433
6725
|
nestAnimatorTimeline,
|
|
6726
|
+
normalizeBindings,
|
|
7434
6727
|
parseWireVersion,
|
|
7435
|
-
planSchemaRelease,
|
|
7436
6728
|
progressSpanMs,
|
|
7437
6729
|
progressToTimeMs,
|
|
7438
6730
|
px,
|
|
7439
6731
|
readWireVersion,
|
|
7440
|
-
releaseLogProblems,
|
|
7441
|
-
reportDocumentDiagnostics,
|
|
7442
6732
|
resolveControlMode,
|
|
7443
6733
|
resolveTimelineEngine,
|
|
7444
6734
|
resolveTrigger,
|
|
7445
|
-
reverseEasing,
|
|
7446
|
-
sanitizeAttributeValue,
|
|
7447
|
-
schemaFieldUniverse,
|
|
7448
6735
|
schemaKeys,
|
|
7449
|
-
scrollOffsetProgress,
|
|
7450
|
-
scrollPhaseInterval,
|
|
7451
|
-
scrollResolveAxis,
|
|
7452
|
-
scrollTotalDurationMs,
|
|
7453
|
-
scrollViewProgress,
|
|
7454
6736
|
seekCeilingMs,
|
|
7455
|
-
splitEasing,
|
|
7456
|
-
subdivideCubicBezier,
|
|
7457
6737
|
timeToProgress,
|
|
7458
|
-
|
|
6738
|
+
toDomProps,
|
|
7459
6739
|
validateDocument,
|
|
7460
6740
|
validateNodeEffects,
|
|
7461
|
-
|
|
6741
|
+
wireVersionAdvice
|
|
7462
6742
|
});
|
|
7463
6743
|
//# sourceMappingURL=index.cjs.map
|