@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/internal.cjs
CHANGED
|
@@ -50,18 +50,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
50
50
|
// src/internal.ts
|
|
51
51
|
var internal_exports = {};
|
|
52
52
|
__export(internal_exports, {
|
|
53
|
-
COLOR_ATTR_NAMES: () => COLOR_ATTR_NAMES,
|
|
54
|
-
CSS_ONLY_STYLE_PROPS: () => CSS_ONLY_STYLE_PROPS,
|
|
55
|
-
DEFAULT_DURATION_MS: () => DEFAULT_DURATION_MS,
|
|
56
|
-
DISALLOWED_SVG_TAGS_LOWER: () => DISALLOWED_SVG_TAGS_LOWER,
|
|
57
|
-
LOOP_JUMP_SHIFT_MS: () => LOOP_JUMP_SHIFT_MS,
|
|
58
|
-
PCT_BASED_ATTR_NAMES: () => PCT_BASED_ATTR_NAMES,
|
|
59
53
|
PX_ANIM_ATTR_NAME: () => PX_ANIM_ATTR_NAME,
|
|
60
54
|
PX_ANIM_SRC_ATTR_NAME: () => PX_ANIM_SRC_ATTR_NAME,
|
|
55
|
+
PX_COLOR_ATTR_NAMES: () => PX_COLOR_ATTR_NAMES,
|
|
56
|
+
PX_CSS_ONLY_STYLE_PROPS: () => PX_CSS_ONLY_STYLE_PROPS,
|
|
57
|
+
PX_DEFAULT_DURATION_MS: () => PX_DEFAULT_DURATION_MS,
|
|
58
|
+
PX_DISALLOWED_SVG_TAGS_LOWER: () => PX_DISALLOWED_SVG_TAGS_LOWER,
|
|
59
|
+
PX_LOOP_JUMP_SHIFT_MS: () => PX_LOOP_JUMP_SHIFT_MS,
|
|
60
|
+
PX_PCT_BASED_ATTR_NAMES: () => PX_PCT_BASED_ATTR_NAMES,
|
|
61
|
+
PX_STYLE_ATTR_NAMES: () => PX_STYLE_ATTR_NAMES,
|
|
62
|
+
PX_TEXT_CONTENT_ATTR: () => PX_TEXT_CONTENT_ATTR,
|
|
63
|
+
PX_TRANSFORM_FN_NAMES: () => PX_TRANSFORM_FN_NAMES,
|
|
61
64
|
PX_UNKNOWN_KEY_ERROR: () => PX_UNKNOWN_KEY_ERROR,
|
|
62
|
-
STYLE_ATTR_NAMES: () => STYLE_ATTR_NAMES,
|
|
63
|
-
TEXT_CONTENT_ATTR: () => TEXT_CONTENT_ATTR,
|
|
64
|
-
TRANSFORM_FN_NAMES: () => TRANSFORM_FN_NAMES,
|
|
65
65
|
bezierToSvgPath: () => bezierToSvgPath,
|
|
66
66
|
camelCaseToKebabWordIfNeeded: () => camelCaseToKebabWordIfNeeded,
|
|
67
67
|
clamp: () => clamp,
|
|
@@ -77,8 +77,8 @@ __export(internal_exports, {
|
|
|
77
77
|
interpolateValue: () => interpolateValue,
|
|
78
78
|
isScrollTimeline: () => isScrollTimeline,
|
|
79
79
|
kebabToCamelCaseWord: () => kebabToCamelCaseWord,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
keyframeEasing: () => keyframeEasing,
|
|
81
|
+
keyframeValue: () => keyframeValue,
|
|
82
82
|
layoutGlyphTextChars: () => layoutGlyphTextChars,
|
|
83
83
|
materializeGlyphText: () => materializeGlyphText,
|
|
84
84
|
materializeGlyphTextAlongPath: () => materializeGlyphTextAlongPath,
|
|
@@ -610,7 +610,7 @@ var px = {
|
|
|
610
610
|
* The base can be the result of px.object() or px.openObject() — anything with a _shape property.
|
|
611
611
|
*
|
|
612
612
|
* @example
|
|
613
|
-
* const PxSvgNodeSchema = px.extendedObject(
|
|
613
|
+
* const PxSvgNodeSchema = px.extendedObject(PxNodeBaseSchema, { width: px.number().optional() });
|
|
614
614
|
*/
|
|
615
615
|
extendedObject: (base, extra) => new Obj(__spreadValues(__spreadValues({}, base._shape), extra)),
|
|
616
616
|
/** Array whose unrecoverable items are filtered out. Default: []. */
|
|
@@ -704,7 +704,7 @@ var PxTimelineEngine = {
|
|
|
704
704
|
native: "native",
|
|
705
705
|
js: "js"
|
|
706
706
|
};
|
|
707
|
-
var
|
|
707
|
+
var PxTimelineEngineSetting = __spreadProps(__spreadValues({}, PxTimelineEngine), {
|
|
708
708
|
auto: "auto"
|
|
709
709
|
});
|
|
710
710
|
var PX_TRIGGER_DEFAULTS = {
|
|
@@ -758,7 +758,7 @@ var PxStrokeTrimSubPaths = {
|
|
|
758
758
|
separate: "separate",
|
|
759
759
|
combined: "combined"
|
|
760
760
|
};
|
|
761
|
-
var
|
|
761
|
+
var PX_TEXT_CONTENT_ATTR = "textContent";
|
|
762
762
|
var CLASS_ATTR = "class";
|
|
763
763
|
var TRANSFORM_ATTR = "transform";
|
|
764
764
|
var TRANSFORM_PART = {
|
|
@@ -843,7 +843,7 @@ function flattenAnimatorTimeline(cfg) {
|
|
|
843
843
|
}
|
|
844
844
|
|
|
845
845
|
// src/version/PxSchemaVersion.ts
|
|
846
|
-
var
|
|
846
|
+
var PX_WIRE_SCHEMA_VERSION = "1.1";
|
|
847
847
|
|
|
848
848
|
// src/version/PxWireVersion.ts
|
|
849
849
|
var VERSION_RE = /^(\d+)\.(\d+)(?:\.(\d+))?$/;
|
|
@@ -854,7 +854,7 @@ function parseWireVersion(raw) {
|
|
|
854
854
|
return { a: Number(m[1]), b: Number(m[2]), c: m[3] === void 0 ? 0 : Number(m[3]) };
|
|
855
855
|
}
|
|
856
856
|
var _a;
|
|
857
|
-
var
|
|
857
|
+
var PX_WIRE_VERSION = (_a = parseWireVersion(PX_WIRE_SCHEMA_VERSION)) != null ? _a : { a: 1, b: 1, c: 0 };
|
|
858
858
|
|
|
859
859
|
// src/format/PxAnimatorTypes.ts
|
|
860
860
|
var PxEasingOrRefSchema = px.union([
|
|
@@ -888,20 +888,20 @@ var PxKeyframeSchema = implementsInterface()(px.object({
|
|
|
888
888
|
// its internal COPY-PASTE payload, which never validates against this schema.)
|
|
889
889
|
}));
|
|
890
890
|
var anyKf = (kf) => kf;
|
|
891
|
-
var
|
|
891
|
+
var keyframeTime = (kf) => {
|
|
892
892
|
var _a2, _b;
|
|
893
893
|
return (_b = (_a2 = anyKf(kf).time) != null ? _a2 : anyKf(kf).t) != null ? _b : 0;
|
|
894
894
|
};
|
|
895
|
-
var
|
|
895
|
+
var keyframeValue = (kf) => {
|
|
896
896
|
var _a2;
|
|
897
897
|
return (_a2 = anyKf(kf).value) != null ? _a2 : anyKf(kf).v;
|
|
898
898
|
};
|
|
899
|
-
var
|
|
899
|
+
var keyframeEasing = (kf) => {
|
|
900
900
|
var _a2;
|
|
901
901
|
return (_a2 = anyKf(kf).easing) != null ? _a2 : anyKf(kf).e;
|
|
902
902
|
};
|
|
903
|
-
var
|
|
904
|
-
var
|
|
903
|
+
var keyframeTangentIn = (kf) => anyKf(kf).tangentIn;
|
|
904
|
+
var keyframeTangentOut = (kf) => anyKf(kf).tangentOut;
|
|
905
905
|
var PxLoopSchema = implementsInterface()(px.object({
|
|
906
906
|
segmentCount: px.number().optional(),
|
|
907
907
|
repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end]).optional(),
|
|
@@ -955,7 +955,7 @@ var PxGlyphFontSchema = implementsInterface()(px.object({
|
|
|
955
955
|
unitsPerEm: px.number(),
|
|
956
956
|
glyphs: px.record(PxGlyphSchema)
|
|
957
957
|
}));
|
|
958
|
-
var
|
|
958
|
+
var PxDefinitionsSchema = implementsInterface()(px.object({
|
|
959
959
|
easings: px.record(px.tuple([px.number(), px.number(), px.number(), px.number()])).optional(),
|
|
960
960
|
animations: px.record(PxAnimationDefinitionSchema).optional(),
|
|
961
961
|
fonts: px.record(PxGlyphFontSchema).optional()
|
|
@@ -993,7 +993,7 @@ var PxTimelinePinSchema = implementsInterface()(px.object({
|
|
|
993
993
|
offset: px.number().optional(),
|
|
994
994
|
distance: px.number().optional()
|
|
995
995
|
}));
|
|
996
|
-
var PxTimelineEngineSchema = px.enum([
|
|
996
|
+
var PxTimelineEngineSchema = px.enum([PxTimelineEngineSetting.auto, PxTimelineEngineSetting.native, PxTimelineEngineSetting.js]).optional();
|
|
997
997
|
var PxTimeTimelineSchema = implementsInterface()(px.object({
|
|
998
998
|
type: px.literal("time").optional(),
|
|
999
999
|
engine: PxTimelineEngineSchema,
|
|
@@ -1047,7 +1047,7 @@ var PxAnimatorConfigSchema = implementsInterface()(px.object({
|
|
|
1047
1047
|
// at this level only on the runtime view, like the rest of the playback dynamics.)
|
|
1048
1048
|
// THE spelling of "what advances progress" — clock / scroll / view (review §2.1).
|
|
1049
1049
|
timeline: PxTimelineSchema.optional(),
|
|
1050
|
-
definitions:
|
|
1050
|
+
definitions: PxDefinitionsSchema.optional(),
|
|
1051
1051
|
bindings: px.array(PxBindingSchema).optional(),
|
|
1052
1052
|
debugGlobalName: px.string().optional(),
|
|
1053
1053
|
// Declared HERE because this is a closed object: an undeclared key would be stripped by
|
|
@@ -1136,7 +1136,7 @@ var PxAnimatableGradientStopsSchema = px.union([
|
|
|
1136
1136
|
PxPropertyAnimationSchema
|
|
1137
1137
|
]);
|
|
1138
1138
|
var PxFillGradientEffectSchema = implementsInterface()(px.object({
|
|
1139
|
-
// Contextual kind — the `type` convention, see `
|
|
1139
|
+
// Contextual kind — the `type` convention, see `PxNodeBaseSchema.type`.
|
|
1140
1140
|
type: px.enum([PxGradientType.linear, PxGradientType.radial]),
|
|
1141
1141
|
start: PxAnimatableVec2Schema.optional(),
|
|
1142
1142
|
end: PxAnimatableVec2Schema.optional(),
|
|
@@ -1173,11 +1173,11 @@ var PxEffectsSchema = implementsInterface()(px.object({
|
|
|
1173
1173
|
textPath: PxTextPathEffectSchema.optional(),
|
|
1174
1174
|
text: PxTextEffectSchema.optional()
|
|
1175
1175
|
}));
|
|
1176
|
-
function validateNodeEffects(root,
|
|
1176
|
+
function validateNodeEffects(root, options) {
|
|
1177
1177
|
const warnings = [];
|
|
1178
1178
|
const walk = (node, path) => {
|
|
1179
1179
|
if (node && node.effects) {
|
|
1180
|
-
const ctx = { errors: [], warnings: [], strict: !!(
|
|
1180
|
+
const ctx = { errors: [], warnings: [], strict: !!(options == null ? void 0 : options.strict) };
|
|
1181
1181
|
const ok = PxEffectsSchema.isValid(node.effects, ctx, [path + ".effects"]);
|
|
1182
1182
|
if (!ok) {
|
|
1183
1183
|
for (const err of ctx.errors) warnings.push(err);
|
|
@@ -1238,9 +1238,9 @@ function validateVersionStamp(doc) {
|
|
|
1238
1238
|
if (parseWireVersion(version) !== void 0) return [];
|
|
1239
1239
|
return ["root.animator.version: " + JSON.stringify(version) + ' is not a version stamp ("a.b" or "a.b.c") \u2014 it reads as unstamped'];
|
|
1240
1240
|
}
|
|
1241
|
-
function validateDocument(doc,
|
|
1241
|
+
function validateDocument(doc, options) {
|
|
1242
1242
|
var _a2;
|
|
1243
|
-
const strict = (
|
|
1243
|
+
const strict = (options == null ? void 0 : options.strict) !== false;
|
|
1244
1244
|
const ctx = { errors: [], warnings: [], strict };
|
|
1245
1245
|
const problems = PxAnimatedSvgDocumentSchema.isValid(doc, ctx, ["root"]) ? [] : [...ctx.errors];
|
|
1246
1246
|
if (doc && typeof doc === "object") {
|
|
@@ -1260,7 +1260,7 @@ function validateDocument(doc, opts) {
|
|
|
1260
1260
|
}
|
|
1261
1261
|
return problems;
|
|
1262
1262
|
}
|
|
1263
|
-
var
|
|
1263
|
+
var PxNodeBaseSchema = px.openObject({
|
|
1264
1264
|
// CONVENTION (SCHEMA-DESIGN R1 / issues N4): `type` is the ONE word for "what
|
|
1265
1265
|
// kind of thing is this", discriminated by its CARRIER — here the node TAG
|
|
1266
1266
|
// (`rect`, `text`), and inside a sub-object that object's kind (`fillGradient.type`,
|
|
@@ -1275,7 +1275,7 @@ var PxNodeBase = px.openObject({
|
|
|
1275
1275
|
// `type` is taken by the tag name, so the attribute travels here and the renderer puts
|
|
1276
1276
|
// it back (`PxAnimatorDOM.renderNode`, `PxRnRender`). Declared here — not merely
|
|
1277
1277
|
// documented — because a wire key that is not in a schema is invisible to the
|
|
1278
|
-
// minifier's reserve list and gets renamed (
|
|
1278
|
+
// minifier's reserve list and gets renamed (dev-docs/plans/minification-boundary.md §1.1).
|
|
1279
1279
|
domType: px.string().optional(),
|
|
1280
1280
|
// Text content of a `<text>` / `<tspan>`. Declared, so a non-string value is a schema error
|
|
1281
1281
|
// and the minifier reserves the key; `text` is NOT an alias for it and is not read anywhere.
|
|
@@ -1283,7 +1283,7 @@ var PxNodeBase = px.openObject({
|
|
|
1283
1283
|
id: px.string().optional(),
|
|
1284
1284
|
meta: px.any().optional(),
|
|
1285
1285
|
// Player-effects bucket emitted by the Editor's lightweight design format.
|
|
1286
|
-
// Consumed and removed by `
|
|
1286
|
+
// Consumed and removed by `materializeNodeEffects` before any other normalization
|
|
1287
1287
|
// (see `createAnimatorImpl`), so downstream code never sees it.
|
|
1288
1288
|
effects: PxEffectsSchema.optional(),
|
|
1289
1289
|
// `PxElementAnimation` (not just `PxAnimationDefinition`) — accepts
|
|
@@ -1292,10 +1292,10 @@ var PxNodeBase = px.openObject({
|
|
|
1292
1292
|
animate: PxElementAnimationSchema.optional(),
|
|
1293
1293
|
style: px.record(px.union([px.string(), px.number()])).optional()
|
|
1294
1294
|
}, PxAttrValueSchema);
|
|
1295
|
-
var PxNodeSchema = px.openObject(__spreadProps(__spreadValues({},
|
|
1295
|
+
var PxNodeSchema = px.openObject(__spreadProps(__spreadValues({}, PxNodeBaseSchema._shape), {
|
|
1296
1296
|
children: px.lazy(() => px.array(PxNodeSchema), []).optional()
|
|
1297
1297
|
}), PxAttrValueSchema);
|
|
1298
|
-
var
|
|
1298
|
+
var PxSvgNodeRootSchema = px.object({
|
|
1299
1299
|
// `"100%"` and other SVG length strings are legal here — a number-only slot rejected
|
|
1300
1300
|
// real documents (e.g. apple-store-look-14-main.json) at the root <svg>.
|
|
1301
1301
|
width: px.union([px.number(), px.string()]).optional(),
|
|
@@ -1303,7 +1303,7 @@ var PxSvgNodeExtra = px.object({
|
|
|
1303
1303
|
viewBox: px.string().optional(),
|
|
1304
1304
|
animator: PxAnimatorConfigSchema.optional()
|
|
1305
1305
|
});
|
|
1306
|
-
var PxAnimatedSvgDocumentSchema = px.openObject(__spreadProps(__spreadValues(__spreadValues({},
|
|
1306
|
+
var PxAnimatedSvgDocumentSchema = px.openObject(__spreadProps(__spreadValues(__spreadValues({}, PxNodeBaseSchema._shape), PxSvgNodeRootSchema._shape), {
|
|
1307
1307
|
type: px.literal("svg"),
|
|
1308
1308
|
// override string → literal to require 'svg'
|
|
1309
1309
|
children: px.array(PxNodeSchema).optional()
|
|
@@ -1503,9 +1503,9 @@ function toRGBA(color) {
|
|
|
1503
1503
|
const b = Math.round(color[2] * 255);
|
|
1504
1504
|
return color.length === 4 ? "rgba(" + r + "," + g + "," + b + "," + color[3] + ")" : "rgb(" + r + "," + g + "," + b + ")";
|
|
1505
1505
|
}
|
|
1506
|
-
var
|
|
1507
|
-
var
|
|
1508
|
-
var
|
|
1506
|
+
var PX_COLOR_ATTR_NAMES = /* @__PURE__ */ new Set(["color", "fill", "flood-color", "lighting-color", "stop-color", "stroke"]);
|
|
1507
|
+
var PX_TRANSFORM_FN_NAMES = /* @__PURE__ */ new Set(["translate", "rotate", "scale", "skew"]);
|
|
1508
|
+
var PX_PCT_BASED_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
|
|
1509
1509
|
function composeTransformParts(parts, opts) {
|
|
1510
1510
|
var _a2;
|
|
1511
1511
|
if (!parts) return "";
|
|
@@ -1558,8 +1558,8 @@ function parseTransformParts(str2) {
|
|
|
1558
1558
|
if (str2.replace(/([a-zA-Z]+)\s*\(([^)]*)\)/g, "").replace(/[\s,]/g, "").length) return void 0;
|
|
1559
1559
|
return Object.keys(out).length ? out : void 0;
|
|
1560
1560
|
}
|
|
1561
|
-
var
|
|
1562
|
-
var
|
|
1561
|
+
var PX_STYLE_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
|
|
1562
|
+
var PX_DEFAULT_DURATION_MS = 1e3;
|
|
1563
1563
|
function kebabToCamelCaseWord(kebab) {
|
|
1564
1564
|
return kebab.includes("-") ? kebab.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()) : kebab;
|
|
1565
1565
|
}
|
|
@@ -1720,7 +1720,7 @@ function invertEasing(easing) {
|
|
|
1720
1720
|
|
|
1721
1721
|
// src/materialize/PxMotionPath.ts
|
|
1722
1722
|
function getKfTranslate(kf) {
|
|
1723
|
-
const v =
|
|
1723
|
+
const v = keyframeValue(kf);
|
|
1724
1724
|
if (!v) return void 0;
|
|
1725
1725
|
if (Array.isArray(v) && v.length >= 2 && typeof v[0] === "number" && typeof v[1] === "number") {
|
|
1726
1726
|
return [v[0], v[1]];
|
|
@@ -1730,17 +1730,17 @@ function getKfTranslate(kf) {
|
|
|
1730
1730
|
return void 0;
|
|
1731
1731
|
}
|
|
1732
1732
|
function getKfTime(kf) {
|
|
1733
|
-
return
|
|
1733
|
+
return keyframeTime(kf);
|
|
1734
1734
|
}
|
|
1735
1735
|
function getKfEasing(kf) {
|
|
1736
|
-
return
|
|
1736
|
+
return keyframeEasing(kf);
|
|
1737
1737
|
}
|
|
1738
1738
|
function propAnimIsMotionPath(anim) {
|
|
1739
1739
|
const kfs = anim.keyframes;
|
|
1740
1740
|
if (!Array.isArray(kfs)) return false;
|
|
1741
1741
|
if (anim.autoOrient) return true;
|
|
1742
1742
|
for (const kf of kfs) {
|
|
1743
|
-
if (
|
|
1743
|
+
if (keyframeTangentIn(kf) || keyframeTangentOut(kf)) return true;
|
|
1744
1744
|
}
|
|
1745
1745
|
return false;
|
|
1746
1746
|
}
|
|
@@ -1749,8 +1749,8 @@ function getSegmentCache(prevKf, nextKf, prevPos, nextPos) {
|
|
|
1749
1749
|
let byNext = _segmentCache.get(prevKf);
|
|
1750
1750
|
const existing = byNext == null ? void 0 : byNext.get(nextKf);
|
|
1751
1751
|
if (existing) return existing;
|
|
1752
|
-
const to =
|
|
1753
|
-
const ti =
|
|
1752
|
+
const to = keyframeTangentOut(prevKf);
|
|
1753
|
+
const ti = keyframeTangentIn(nextKf);
|
|
1754
1754
|
const P1 = [prevPos[0] + (to ? to[0] : 0), prevPos[1] + (to ? to[1] : 0)];
|
|
1755
1755
|
const P2 = [nextPos[0] + (ti ? ti[0] : 0), nextPos[1] + (ti ? ti[1] : 0)];
|
|
1756
1756
|
const lut = bezier2D_arcLengthLUT(prevPos, P1, P2, nextPos);
|
|
@@ -1816,7 +1816,7 @@ function materializeMotionPathInPropAnim(anim, opts) {
|
|
|
1816
1816
|
function unwrapAutoOrientRotations(kfs) {
|
|
1817
1817
|
let prev;
|
|
1818
1818
|
for (const kf of kfs) {
|
|
1819
|
-
const v =
|
|
1819
|
+
const v = keyframeValue(kf);
|
|
1820
1820
|
if (!v || typeof v.rotate !== "number") continue;
|
|
1821
1821
|
if (prev === void 0) {
|
|
1822
1822
|
prev = v.rotate;
|
|
@@ -1833,7 +1833,7 @@ function makeOutKf(time, value) {
|
|
|
1833
1833
|
return { t: time, v: value };
|
|
1834
1834
|
}
|
|
1835
1835
|
function getKfValueParts(kf) {
|
|
1836
|
-
const v =
|
|
1836
|
+
const v = keyframeValue(kf);
|
|
1837
1837
|
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
1838
1838
|
return v;
|
|
1839
1839
|
}
|
|
@@ -1895,7 +1895,7 @@ function wrappedAngleDelta(a, b) {
|
|
|
1895
1895
|
}
|
|
1896
1896
|
function insertSharpCornerStepKfIfNeeded(out, prevKf, nextKf, prevPos, nextPos, rotationTol) {
|
|
1897
1897
|
const lastKf = out[out.length - 1];
|
|
1898
|
-
const lastV =
|
|
1898
|
+
const lastV = keyframeValue(lastKf);
|
|
1899
1899
|
const prevExit = lastV == null ? void 0 : lastV.rotate;
|
|
1900
1900
|
if (typeof prevExit !== "number") return;
|
|
1901
1901
|
const boundaryV = getKfValueParts(prevKf);
|
|
@@ -2043,7 +2043,7 @@ function perpDist(q, pA, pB) {
|
|
|
2043
2043
|
}
|
|
2044
2044
|
|
|
2045
2045
|
// src/animation/PxDefinitions.ts
|
|
2046
|
-
var
|
|
2046
|
+
var PX_LOOP_JUMP_SHIFT_MS = 1;
|
|
2047
2047
|
function interpolateValue(propName, a, b, t) {
|
|
2048
2048
|
var _a2, _b;
|
|
2049
2049
|
if (propName === "d") {
|
|
@@ -2051,7 +2051,7 @@ function interpolateValue(propName, a, b, t) {
|
|
|
2051
2051
|
const bPaths = (_b = b == null ? void 0 : b.paths) != null ? _b : Array.isArray(b) ? b : [];
|
|
2052
2052
|
return { paths: interpolateBeziers(aPaths, bPaths, t) };
|
|
2053
2053
|
}
|
|
2054
|
-
if (
|
|
2054
|
+
if (PX_COLOR_ATTR_NAMES.has(propName)) {
|
|
2055
2055
|
return interpolateColor(a || [0, 0, 0, 1], b || [0, 0, 0, 1], t);
|
|
2056
2056
|
}
|
|
2057
2057
|
if (propName === "transform" && typeof a === "object" && a !== null && !Array.isArray(a) && typeof b === "object" && b !== null && !Array.isArray(b)) {
|
|
@@ -2060,7 +2060,7 @@ function interpolateValue(propName, a, b, t) {
|
|
|
2060
2060
|
if (propName === "rotate" && typeof a === "number" && typeof b === "number") {
|
|
2061
2061
|
return interpolateNum(a, b, t);
|
|
2062
2062
|
}
|
|
2063
|
-
if (
|
|
2063
|
+
if (PX_TRANSFORM_FN_NAMES.has(propName) || propName === "stroke-dasharray" || propName === "strokeDasharray") {
|
|
2064
2064
|
return interpolateVec(a || [], b || [], t);
|
|
2065
2065
|
}
|
|
2066
2066
|
return interpolateNum(+(a || 0), +(b || 0), t);
|
|
@@ -2099,7 +2099,7 @@ function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
|
|
|
2099
2099
|
}
|
|
2100
2100
|
return animDef;
|
|
2101
2101
|
}
|
|
2102
|
-
const channels = Object.keys(animDef).filter((k) =>
|
|
2102
|
+
const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
|
|
2103
2103
|
if (channels.length !== 1) return animDef;
|
|
2104
2104
|
const ch = channels[0];
|
|
2105
2105
|
const chAnim = animDef[ch];
|
|
@@ -2581,7 +2581,7 @@ var TEXT_ATTR_KEYS = [
|
|
|
2581
2581
|
"stroke",
|
|
2582
2582
|
"strokeWidth",
|
|
2583
2583
|
"effects",
|
|
2584
|
-
|
|
2584
|
+
PX_TEXT_CONTENT_ATTR,
|
|
2585
2585
|
"xml:space"
|
|
2586
2586
|
];
|
|
2587
2587
|
var PAINT_STATIC_KEYS = [
|
|
@@ -2735,13 +2735,13 @@ function materializeGlyphTextHorizontal(node, opts) {
|
|
|
2735
2735
|
if (y !== void 0) pen.y = y;
|
|
2736
2736
|
pen.x += (_a3 = parseLen(el.dx)) != null ? _a3 : 0;
|
|
2737
2737
|
pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
|
|
2738
|
-
const content = str(el[
|
|
2738
|
+
const content = str(el[PX_TEXT_CONTENT_ATTR]);
|
|
2739
2739
|
if (content && !((_c2 = el.children) == null ? void 0 : _c2.length)) renderChars(content, s);
|
|
2740
2740
|
if (el.children) for (const ch of el.children) walk(ch, s);
|
|
2741
2741
|
};
|
|
2742
2742
|
const rootStyle = rootStyleOf(node);
|
|
2743
2743
|
if (node.children) for (const ch of node.children) walk(ch, rootStyle);
|
|
2744
|
-
const rootContent = str(node[
|
|
2744
|
+
const rootContent = str(node[PX_TEXT_CONTENT_ATTR]);
|
|
2745
2745
|
if (rootContent && !((_c = node.children) == null ? void 0 : _c.length)) renderChars(rootContent, rootStyle);
|
|
2746
2746
|
const anchor = str(node.textAnchor);
|
|
2747
2747
|
if (anchor === "middle" || anchor === "end") {
|
|
@@ -2790,7 +2790,7 @@ function layoutGlyphTextChars(node, opts) {
|
|
|
2790
2790
|
if (y !== void 0) pen.y = y;
|
|
2791
2791
|
pen.x += (_a3 = parseLen(el.dx)) != null ? _a3 : 0;
|
|
2792
2792
|
pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
|
|
2793
|
-
const content = str(el[
|
|
2793
|
+
const content = str(el[PX_TEXT_CONTENT_ATTR]);
|
|
2794
2794
|
if (content && !((_c2 = el.children) == null ? void 0 : _c2.length)) renderChars(content, s);
|
|
2795
2795
|
if (el.children) for (const ch of el.children) walk(ch, s);
|
|
2796
2796
|
};
|
|
@@ -2805,7 +2805,7 @@ function layoutGlyphTextChars(node, opts) {
|
|
|
2805
2805
|
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 });
|
|
2806
2806
|
}
|
|
2807
2807
|
}
|
|
2808
|
-
const rootContent = str(node[
|
|
2808
|
+
const rootContent = str(node[PX_TEXT_CONTENT_ATTR]);
|
|
2809
2809
|
if (rootContent && !((_e = node.children) == null ? void 0 : _e.length)) renderChars(rootContent, rootStyle);
|
|
2810
2810
|
const anchor = str(node.textAnchor);
|
|
2811
2811
|
if (anchor === "middle" || anchor === "end") {
|
|
@@ -2833,7 +2833,7 @@ function layoutGlyphTextCharsAlongPath(node, pathD, opts) {
|
|
|
2833
2833
|
const walk = (el, parentStyle) => {
|
|
2834
2834
|
var _a3, _b2;
|
|
2835
2835
|
const s = resolveStyle(el, parentStyle);
|
|
2836
|
-
const content = str(el[
|
|
2836
|
+
const content = str(el[PX_TEXT_CONTENT_ATTR]);
|
|
2837
2837
|
if (content && !((_a3 = el.children) == null ? void 0 : _a3.length)) {
|
|
2838
2838
|
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
2839
2839
|
const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
|
|
@@ -2887,7 +2887,7 @@ function collectAlongPathCells(node, glyphs, soleFont, warnings) {
|
|
|
2887
2887
|
const walk = (el, parentStyle) => {
|
|
2888
2888
|
var _a2, _b;
|
|
2889
2889
|
const s = resolveStyle(el, parentStyle);
|
|
2890
|
-
const content = str(el[
|
|
2890
|
+
const content = str(el[PX_TEXT_CONTENT_ATTR]);
|
|
2891
2891
|
if (content && !((_a2 = el.children) == null ? void 0 : _a2.length)) {
|
|
2892
2892
|
const gf = glyphFontFor(s, glyphs, soleFont, warnings);
|
|
2893
2893
|
if (gf) {
|
|
@@ -3203,7 +3203,7 @@ function isScrollTimeline(config) {
|
|
|
3203
3203
|
return (config == null ? void 0 : config.timelineSource) === "scroll";
|
|
3204
3204
|
}
|
|
3205
3205
|
function scrollTotalDurationMs(config) {
|
|
3206
|
-
const duration = typeof (config == null ? void 0 : config.duration) === "number" && config.duration > 0 ? config.duration :
|
|
3206
|
+
const duration = typeof (config == null ? void 0 : config.duration) === "number" && config.duration > 0 ? config.duration : PX_DEFAULT_DURATION_MS;
|
|
3207
3207
|
const iterations = typeof (config == null ? void 0 : config.iterations) === "number" && config.iterations > 0 ? config.iterations : 1;
|
|
3208
3208
|
return duration * iterations;
|
|
3209
3209
|
}
|
|
@@ -3274,7 +3274,7 @@ function deepClone(value) {
|
|
|
3274
3274
|
}
|
|
3275
3275
|
|
|
3276
3276
|
// src/util/PxNodeProps.ts
|
|
3277
|
-
var
|
|
3277
|
+
var PX_DISALLOWED_SVG_TAGS_LOWER = /* @__PURE__ */ new Set([
|
|
3278
3278
|
"script",
|
|
3279
3279
|
"foreignobject"
|
|
3280
3280
|
]);
|
|
@@ -3299,7 +3299,7 @@ var URL_VALUE_ATTRS_LOWER = /* @__PURE__ */ new Set([
|
|
|
3299
3299
|
// marker-end="url(#…)"
|
|
3300
3300
|
]);
|
|
3301
3301
|
var IMAGE_REF_ATTRS_LOWER = /* @__PURE__ */ new Set(["href", "xlink:href", "src"]);
|
|
3302
|
-
var
|
|
3302
|
+
var PX_CSS_ONLY_STYLE_PROPS = /* @__PURE__ */ new Set(["mixBlendMode", "isolation"]);
|
|
3303
3303
|
var DATA_RASTER_IMAGE_RE = /^data:image\/(?:png|jpe?g|gif|webp|bmp);base64,/i;
|
|
3304
3304
|
var DATA_SVG_IMAGE_RE = /^data:image\/svg\+xml(?:;[^,]*)?,/i;
|
|
3305
3305
|
var DATA_IMAGE_BASE64_PAYLOAD_RE = /^data:image\/[^;,]*;base64,([A-Za-z0-9+/]{8})/i;
|
|
@@ -3417,12 +3417,12 @@ function planSchemaRelease(p) {
|
|
|
3417
3417
|
changed,
|
|
3418
3418
|
requiredKind,
|
|
3419
3419
|
requiredVersion,
|
|
3420
|
-
refuse: "The player schema changed (" + summary + ") but
|
|
3420
|
+
refuse: "The player schema changed (" + summary + ") but PX_WIRE_SCHEMA_VERSION is " + p.declared + ". Set it to " + requiredVersion + " and add the PX_WIRE_STEPS entry."
|
|
3421
3421
|
};
|
|
3422
3422
|
}
|
|
3423
3423
|
const step = p.steps.find((s) => s.to === p.declared);
|
|
3424
3424
|
if (!step) {
|
|
3425
|
-
return { changed, requiredKind, requiredVersion, refuse: "No
|
|
3425
|
+
return { changed, requiredKind, requiredVersion, refuse: "No PX_WIRE_STEPS entry reaches " + p.declared + "." };
|
|
3426
3426
|
}
|
|
3427
3427
|
if (requiredKind === "converted" /* converted */ && step.kind !== "converted" /* converted */) {
|
|
3428
3428
|
return {
|
|
@@ -3448,31 +3448,31 @@ function releaseLogProblems(releases, steps, declared, baseline) {
|
|
|
3448
3448
|
}
|
|
3449
3449
|
if (releases[i].date < releases[i - 1].date) problems.push("Release " + releases[i].version + " is dated before its predecessor.");
|
|
3450
3450
|
const step = steps.find((s) => s.to === releases[i].version);
|
|
3451
|
-
if (!step) problems.push("Release " + releases[i].version + " has no
|
|
3451
|
+
if (!step) problems.push("Release " + releases[i].version + " has no PX_WIRE_STEPS entry.");
|
|
3452
3452
|
else if (releases[i].removed.length && step.kind !== "converted" /* converted */) {
|
|
3453
3453
|
problems.push("Release " + releases[i].version + " removed keys, but its step is not `converted`.");
|
|
3454
3454
|
}
|
|
3455
3455
|
}
|
|
3456
3456
|
const latest = releases[releases.length - 1].version;
|
|
3457
3457
|
if (latest !== declared) {
|
|
3458
|
-
problems.push("
|
|
3458
|
+
problems.push("PX_WIRE_SCHEMA_VERSION is " + declared + " but the last release record is " + latest + " \u2014 a bump needs its changelog entry (run scripts/schema-release.mjs --apply).");
|
|
3459
3459
|
}
|
|
3460
3460
|
return problems;
|
|
3461
3461
|
}
|
|
3462
3462
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3463
3463
|
0 && (module.exports = {
|
|
3464
|
-
COLOR_ATTR_NAMES,
|
|
3465
|
-
CSS_ONLY_STYLE_PROPS,
|
|
3466
|
-
DEFAULT_DURATION_MS,
|
|
3467
|
-
DISALLOWED_SVG_TAGS_LOWER,
|
|
3468
|
-
LOOP_JUMP_SHIFT_MS,
|
|
3469
|
-
PCT_BASED_ATTR_NAMES,
|
|
3470
3464
|
PX_ANIM_ATTR_NAME,
|
|
3471
3465
|
PX_ANIM_SRC_ATTR_NAME,
|
|
3466
|
+
PX_COLOR_ATTR_NAMES,
|
|
3467
|
+
PX_CSS_ONLY_STYLE_PROPS,
|
|
3468
|
+
PX_DEFAULT_DURATION_MS,
|
|
3469
|
+
PX_DISALLOWED_SVG_TAGS_LOWER,
|
|
3470
|
+
PX_LOOP_JUMP_SHIFT_MS,
|
|
3471
|
+
PX_PCT_BASED_ATTR_NAMES,
|
|
3472
|
+
PX_STYLE_ATTR_NAMES,
|
|
3473
|
+
PX_TEXT_CONTENT_ATTR,
|
|
3474
|
+
PX_TRANSFORM_FN_NAMES,
|
|
3472
3475
|
PX_UNKNOWN_KEY_ERROR,
|
|
3473
|
-
STYLE_ATTR_NAMES,
|
|
3474
|
-
TEXT_CONTENT_ATTR,
|
|
3475
|
-
TRANSFORM_FN_NAMES,
|
|
3476
3476
|
bezierToSvgPath,
|
|
3477
3477
|
camelCaseToKebabWordIfNeeded,
|
|
3478
3478
|
clamp,
|
|
@@ -3488,8 +3488,8 @@ function releaseLogProblems(releases, steps, declared, baseline) {
|
|
|
3488
3488
|
interpolateValue,
|
|
3489
3489
|
isScrollTimeline,
|
|
3490
3490
|
kebabToCamelCaseWord,
|
|
3491
|
-
|
|
3492
|
-
|
|
3491
|
+
keyframeEasing,
|
|
3492
|
+
keyframeValue,
|
|
3493
3493
|
layoutGlyphTextChars,
|
|
3494
3494
|
materializeGlyphText,
|
|
3495
3495
|
materializeGlyphTextAlongPath,
|