@pixodesk/svg-animator-web 1.0.44 → 1.0.46

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.
@@ -17,20 +17,8 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
20
 
33
- // ../svg-animator-core/dist/chunk-EFQLDGFY.js
21
+ // ../svg-animator-core/dist/chunk-37OFJ3RX.js
34
22
  var __defProp2 = Object.defineProperty;
35
23
  var __defProps2 = Object.defineProperties;
36
24
  var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
@@ -51,7 +39,7 @@ var __spreadValues2 = (a, b) => {
51
39
  return a;
52
40
  };
53
41
  var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
54
- var __objRest2 = (source, exclude) => {
42
+ var __objRest = (source, exclude) => {
55
43
  var target = {};
56
44
  for (var prop in source)
57
45
  if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -74,19 +62,31 @@ function pathStr(path) {
74
62
  return result;
75
63
  }
76
64
  var Base = class {
65
+ /** Structural schemas (objects, arrays, unions of objects…) pass `false`: they state no scalar default. */
66
+ constructor(_statesDefault) {
67
+ this._statesDefault = _statesDefault;
68
+ }
77
69
  _canSanitize(raw) {
78
70
  return this.isValid(raw);
79
71
  }
72
+ /** A REQUIRED field is never absent; its default is the repair value. */
73
+ absentDefault() {
74
+ return this._default;
75
+ }
80
76
  optional() {
81
77
  return new Optional(this);
82
78
  }
83
79
  };
84
80
  var Optional = class extends Base {
85
81
  constructor(inner) {
86
- super();
82
+ super(inner._statesDefault);
87
83
  this.inner = inner;
88
84
  this._default = void 0;
89
85
  }
86
+ /** Absent means the inner schema's STATED default — or nothing at all when it states none. */
87
+ absentDefault() {
88
+ return this.inner._statesDefault ? this.inner._default : void 0;
89
+ }
90
90
  sanitize(raw) {
91
91
  if (raw === void 0 || raw === null) return void 0;
92
92
  return this.inner._canSanitize(raw) ? this.inner.sanitize(raw) : void 0;
@@ -100,8 +100,8 @@ var Optional = class extends Base {
100
100
  }
101
101
  };
102
102
  var Str = class extends Base {
103
- constructor(_default = "") {
104
- super();
103
+ constructor(_default, statesDefault) {
104
+ super(statesDefault);
105
105
  this._default = _default;
106
106
  }
107
107
  sanitize(raw) {
@@ -114,8 +114,8 @@ var Str = class extends Base {
114
114
  }
115
115
  };
116
116
  var Num = class extends Base {
117
- constructor(_default = 0) {
118
- super();
117
+ constructor(_default, statesDefault) {
118
+ super(statesDefault);
119
119
  this._default = _default;
120
120
  }
121
121
  sanitize(raw) {
@@ -128,8 +128,8 @@ var Num = class extends Base {
128
128
  }
129
129
  };
130
130
  var Bool = class extends Base {
131
- constructor(_default = false) {
132
- super();
131
+ constructor(_default, statesDefault) {
132
+ super(statesDefault);
133
133
  this._default = _default;
134
134
  }
135
135
  sanitize(raw) {
@@ -142,8 +142,9 @@ var Bool = class extends Base {
142
142
  }
143
143
  };
144
144
  var Literal = class extends Base {
145
+ /** A literal IS its own value: absent means it. */
145
146
  constructor(value) {
146
- super();
147
+ super(true);
147
148
  this.value = value;
148
149
  this._default = value;
149
150
  }
@@ -157,8 +158,8 @@ var Literal = class extends Base {
157
158
  }
158
159
  };
159
160
  var Enum = class extends Base {
160
- constructor(values, defaultVal) {
161
- super();
161
+ constructor(values, defaultVal, statesDefault) {
162
+ super(statesDefault);
162
163
  this.values = values;
163
164
  this._default = defaultVal != null ? defaultVal : values[0];
164
165
  }
@@ -173,8 +174,8 @@ var Enum = class extends Base {
173
174
  };
174
175
  var UNION_MEMBER_ERROR_LIMIT = 4;
175
176
  var Union = class extends Base {
176
- constructor(schemas, defaultVal) {
177
- super();
177
+ constructor(schemas, defaultVal, statesDefault) {
178
+ super(statesDefault);
178
179
  this.schemas = schemas;
179
180
  this._kind = "union";
180
181
  this._default = defaultVal != null ? defaultVal : schemas[0]._default;
@@ -227,7 +228,7 @@ var Union = class extends Base {
227
228
  var DiscriminatedUnion = class extends Base {
228
229
  constructor(_key, _schemas, defaultVal) {
229
230
  var _a2;
230
- super();
231
+ super(false);
231
232
  this._key = _key;
232
233
  this._schemas = _schemas;
233
234
  this._kind = "discriminatedUnion";
@@ -266,13 +267,19 @@ var DiscriminatedUnion = class extends Base {
266
267
  return schema ? schema._canSanitize(raw) : this._schemas[0]._canSanitize(raw);
267
268
  }
268
269
  };
270
+ function statedDefaults(shape) {
271
+ const out = {};
272
+ for (const key of Object.keys(shape)) if (shape[key]._statesDefault) out[key] = shape[key].absentDefault();
273
+ return Object.freeze(out);
274
+ }
269
275
  var Obj = class extends Base {
270
276
  constructor(_shape) {
271
- super();
277
+ super(false);
272
278
  this._shape = _shape;
273
279
  const d = {};
274
280
  for (const key of Object.keys(_shape)) d[key] = _shape[key]._default;
275
281
  this._default = d;
282
+ this.defaults = statedDefaults(_shape);
276
283
  }
277
284
  sanitize(raw) {
278
285
  const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
@@ -314,12 +321,13 @@ var Obj = class extends Base {
314
321
  };
315
322
  var OpenObj = class extends Base {
316
323
  constructor(_shape, _openSchema) {
317
- super();
324
+ super(false);
318
325
  this._shape = _shape;
319
326
  this._openSchema = _openSchema;
320
327
  const d = {};
321
328
  for (const key of Object.keys(_shape)) d[key] = _shape[key]._default;
322
329
  this._default = d;
330
+ this.defaults = statedDefaults(_shape);
323
331
  }
324
332
  sanitize(raw) {
325
333
  const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
@@ -364,7 +372,7 @@ var OpenObj = class extends Base {
364
372
  };
365
373
  var Arr = class extends Base {
366
374
  constructor(item) {
367
- super();
375
+ super(false);
368
376
  this.item = item;
369
377
  this._default = [];
370
378
  }
@@ -396,7 +404,7 @@ var Arr = class extends Base {
396
404
  };
397
405
  var Rec = class extends Base {
398
406
  constructor(value) {
399
- super();
407
+ super(false);
400
408
  this.value = value;
401
409
  this._kind = "record";
402
410
  this._default = {};
@@ -429,7 +437,7 @@ var Rec = class extends Base {
429
437
  };
430
438
  var Any = class extends Base {
431
439
  constructor() {
432
- super(...arguments);
440
+ super(false);
433
441
  this._default = void 0;
434
442
  }
435
443
  sanitize(raw) {
@@ -444,7 +452,7 @@ var Any = class extends Base {
444
452
  };
445
453
  var Defined = class extends Base {
446
454
  constructor() {
447
- super(...arguments);
455
+ super(false);
448
456
  this._default = void 0;
449
457
  }
450
458
  sanitize(raw) {
@@ -461,7 +469,7 @@ var Defined = class extends Base {
461
469
  };
462
470
  var Lazy = class extends Base {
463
471
  constructor(fn, _default) {
464
- super();
472
+ super(false);
465
473
  this.fn = fn;
466
474
  this._default = _default;
467
475
  this.resolved = null;
@@ -482,7 +490,7 @@ var Lazy = class extends Base {
482
490
  };
483
491
  var Tuple = class extends Base {
484
492
  constructor(schemas) {
485
- super();
493
+ super(false);
486
494
  this.schemas = schemas;
487
495
  this._kind = "tuple";
488
496
  this._default = schemas.map((s) => s._default);
@@ -513,22 +521,29 @@ var Tuple = class extends Base {
513
521
  function implementsInterface() {
514
522
  return (schema) => schema;
515
523
  }
524
+ function string(defaultVal) {
525
+ return defaultVal === void 0 ? new Str("", false) : new Str(defaultVal, true);
526
+ }
527
+ function number(defaultVal) {
528
+ return defaultVal === void 0 ? new Num(0, false) : new Num(defaultVal, true);
529
+ }
530
+ function boolean(defaultVal) {
531
+ return defaultVal === void 0 ? new Bool(false, false) : new Bool(defaultVal, true);
532
+ }
533
+ function oneOf(values, defaultVal) {
534
+ return defaultVal === void 0 ? new Enum(values, void 0, false) : new Enum(values, defaultVal, true);
535
+ }
536
+ function unionOf(schemas, defaultVal) {
537
+ return defaultVal === void 0 ? new Union(schemas, void 0, false) : new Union(schemas, defaultVal, true);
538
+ }
516
539
  var px = {
517
- /** Matches a string. Default: '' or provided value. */
518
- string: (defaultVal = "") => new Str(defaultVal),
519
- /** Matches a finite number. Default: 0 or provided value. */
520
- number: (defaultVal = 0) => new Num(defaultVal),
521
- /** Matches a boolean. Default: false or provided value. */
522
- boolean: (defaultVal = false) => new Bool(defaultVal),
523
- /** Matches one exact primitive value; its default is the value itself. */
540
+ string,
541
+ number,
542
+ boolean,
543
+ /** Matches one exact primitive value; absent means the value itself. */
524
544
  literal: (value) => new Literal(value),
525
- /** Matches one of a fixed set of string/number values. Default: first value. */
526
- enum: (values, defaultVal) => new Enum(values, defaultVal),
527
- /**
528
- * Returns the first schema whose isValid passes.
529
- * TypeScript infers the union of all member types automatically.
530
- */
531
- union: (schemas, defaultVal) => new Union(schemas, defaultVal),
545
+ enum: oneOf,
546
+ union: unionOf,
532
547
  /**
533
548
  * Discriminated union — reads `raw[key]`, finds the member schema whose
534
549
  * literal at `key` matches, then delegates sanitize/isValid to that member.
@@ -536,7 +551,8 @@ var px = {
536
551
  * TypeScript infers the union of all member types automatically.
537
552
  */
538
553
  discriminatedUnion: (key, schemas) => new DiscriminatedUnion(key, schemas),
539
- /** Typed object — unknown keys are stripped. Required fields fall back to their default. */
554
+ /** Typed object — unknown keys are stripped. Required fields fall back to their default.
555
+ * Its `defaults` say what each stated field means when a document leaves it out. */
540
556
  object: (shape) => new Obj(shape),
541
557
  /**
542
558
  * Open object — validates known keys; passes unknown keys through as-is,
@@ -671,8 +687,11 @@ var PX_TRIGGER_DEFAULTS = {
671
687
  offScreen: "pause",
672
688
  mouseOut: "continue",
673
689
  visibilityThreshold: 0.5,
674
- visibilityDebounce: 150
690
+ visibilityDebounce: 150,
691
+ finish: "hold"
675
692
  };
693
+ var PX_DEFAULT_DURATION_MS = 1e3;
694
+ var PX_DEFAULT_ITERATIONS = 1;
676
695
  function resolveTrigger(trigger) {
677
696
  var _a2, _b, _c, _d, _e;
678
697
  return {
@@ -790,7 +809,7 @@ function flattenAnimatorTimeline(cfg) {
790
809
  if (timeline === void 0 || timeline === null || typeof timeline !== "object") return cfg;
791
810
  const memoised = flattenMemo.get(cfg);
792
811
  if (memoised) return memoised;
793
- const _a2 = cfg, { timeline: _dropped } = _a2, flat = __objRest2(_a2, ["timeline"]);
812
+ const _a2 = cfg, { timeline: _dropped } = _a2, flat = __objRest(_a2, ["timeline"]);
794
813
  if (timeline.engine !== void 0) flat.engine = timeline.engine;
795
814
  if (timeline.frameRate !== void 0) flat.frameRate = timeline.frameRate;
796
815
  if (timeline.type === "scroll" || timeline.type === "view") {
@@ -816,7 +835,7 @@ function flattenAnimatorTimeline(cfg) {
816
835
  } else {
817
836
  if (timeline.duration !== void 0) flat.duration = timeline.duration;
818
837
  if (timeline.trigger !== void 0) {
819
- const _b = timeline.trigger, { finish } = _b, restTrigger = __objRest2(_b, ["finish"]);
838
+ const _b = timeline.trigger, { finish } = _b, restTrigger = __objRest(_b, ["finish"]);
820
839
  if (Object.keys(restTrigger).length) flat.trigger = restTrigger;
821
840
  if (finish !== void 0) flat.resetOnFinish = finish === "reset";
822
841
  }
@@ -885,15 +904,15 @@ var keyframeTangentIn = (kf) => anyKf(kf).tangentIn;
885
904
  var keyframeTangentOut = (kf) => anyKf(kf).tangentOut;
886
905
  var PxLoopSchema = implementsInterface()(px.object({
887
906
  segmentCount: px.number().optional(),
888
- repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end]).optional(),
889
- direction: px.enum([PxLoopDirection.normal, PxLoopDirection.alternate]).optional()
907
+ repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end], PxLoopRepeatAt.end).optional(),
908
+ direction: px.enum([PxLoopDirection.normal, PxLoopDirection.alternate], PxLoopDirection.normal).optional()
890
909
  }));
891
910
  var PxPropertyAnimationSchema = implementsInterface()(px.object({
892
911
  value: PxKeyframeValueSchema.optional(),
893
912
  keyframes: px.array(PxKeyframeSchema).optional(),
894
913
  loop: px.union([PxLoopSchema, px.boolean()]).optional(),
895
914
  autoOrient: px.boolean().optional(),
896
- alongPathMode: px.enum([PxAlongPathMode.sampled, PxAlongPathMode.offsetPath]).optional()
915
+ alongPathMode: px.enum([PxAlongPathMode.sampled, PxAlongPathMode.offsetPath], PxAlongPathMode.sampled).optional()
897
916
  }));
898
917
  var PxTransformPartsSchema = implementsInterface()(px.object({
899
918
  translate: px.tuple([px.number(), px.number()]).optional(),
@@ -923,9 +942,9 @@ var PxTriggerSchema = implementsInterface()(px.object({
923
942
  // What happens after a NATURAL finish — `'hold'` (default: keep the end state per
924
943
  // `fill`) or `'reset'` (snap back to the start state). One of four occasion keys
925
944
  // (`start`, `offScreen`, `mouseOut`, `finish`), all named the same way.
926
- finish: px.enum([PxFinishAction.hold, PxFinishAction.reset]).optional(),
927
- visibilityThreshold: px.number().optional(),
928
- visibilityDebounce: px.number().optional()
945
+ finish: px.enum([PxFinishAction.hold, PxFinishAction.reset], PX_TRIGGER_DEFAULTS.finish).optional(),
946
+ visibilityThreshold: px.number(PX_TRIGGER_DEFAULTS.visibilityThreshold).optional(),
947
+ visibilityDebounce: px.number(PX_TRIGGER_DEFAULTS.visibilityDebounce).optional()
929
948
  }));
930
949
  var PxGlyphSchema = implementsInterface()(px.object({
931
950
  width: px.number(),
@@ -951,7 +970,7 @@ var PxScrollRangePointSchema = implementsInterface()(px.object({
951
970
  PxScrollPhase.exit,
952
971
  PxScrollPhase.entryCrossing,
953
972
  PxScrollPhase.exitCrossing
954
- ]).optional(),
973
+ ], PxScrollPhase.cover).optional(),
955
974
  fraction: px.number().optional()
956
975
  }));
957
976
  var PxScrollRangeSchema = px.object({
@@ -959,37 +978,37 @@ var PxScrollRangeSchema = px.object({
959
978
  end: PxScrollRangePointSchema.optional()
960
979
  });
961
980
  var PxScrollSchema = implementsInterface()(px.object({
962
- kind: px.enum([PxScrollKind.view, PxScrollKind.scroll]).optional(),
963
- axis: px.enum([PxScrollAxis.block, PxScrollAxis.inline, PxScrollAxis.x, PxScrollAxis.y]).optional(),
964
- source: px.enum([PxScrollSource.nearest, PxScrollSource.root]).optional(),
981
+ kind: px.enum([PxScrollKind.view, PxScrollKind.scroll], PxScrollKind.view).optional(),
982
+ axis: px.enum([PxScrollAxis.block, PxScrollAxis.inline, PxScrollAxis.x, PxScrollAxis.y], PxScrollAxis.block).optional(),
983
+ source: px.enum([PxScrollSource.nearest, PxScrollSource.root], PxScrollSource.nearest).optional(),
965
984
  // Free-form: the two keywords `parent`/`scroller` plus any CSS selector.
966
985
  subject: px.string().optional(),
967
986
  smoothing: px.number().optional(),
968
- pin: px.boolean().optional(),
969
- pinAlign: px.enum([PxPinAlign.top, PxPinAlign.center, PxPinAlign.bottom]).optional(),
987
+ pin: px.boolean(false).optional(),
988
+ pinAlign: px.enum([PxPinAlign.top, PxPinAlign.center, PxPinAlign.bottom], PxPinAlign.top).optional(),
970
989
  pinOffset: px.number().optional(),
971
990
  pinDistance: px.number().optional(),
972
991
  range: PxScrollRangeSchema.optional()
973
992
  }));
974
993
  var PxTimelinePinSchema = implementsInterface()(px.object({
975
- align: px.enum([PxPinAlign.top, PxPinAlign.center, PxPinAlign.bottom]).optional(),
994
+ align: px.enum([PxPinAlign.top, PxPinAlign.center, PxPinAlign.bottom], PxPinAlign.top).optional(),
976
995
  offset: px.number().optional(),
977
996
  distance: px.number().optional()
978
997
  }));
979
- var PxTimelineEngineSchema = px.enum([PxTimelineEngineSetting.auto, PxTimelineEngineSetting.native, PxTimelineEngineSetting.js]).optional();
998
+ var PxTimelineEngineSchema = px.enum([PxTimelineEngineSetting.auto, PxTimelineEngineSetting.native, PxTimelineEngineSetting.js], PxTimelineEngineSetting.auto).optional();
980
999
  var PxTimeTimelineSchema = implementsInterface()(px.object({
981
1000
  type: px.literal("time").optional(),
982
1001
  engine: PxTimelineEngineSchema,
983
1002
  frameRate: px.number().optional(),
984
1003
  // §2.8: duration is a property of the TIMELINE — how long one pass takes.
985
- duration: px.number().optional(),
1004
+ duration: px.number(PX_DEFAULT_DURATION_MS).optional(),
986
1005
  trigger: PxTriggerSchema.optional(),
987
- delay: px.number().optional(),
988
- iterations: px.union([px.number(), px.literal("infinite")]).optional(),
1006
+ delay: px.number(0).optional(),
1007
+ iterations: px.union([px.number(PX_DEFAULT_ITERATIONS), px.literal("infinite")], PX_DEFAULT_ITERATIONS).optional(),
989
1008
  // `fillMode` on the wire (CSS `animation-fill-mode`; the runtime view calls it `fill`)
990
1009
  // — never `fill`, which is paint everywhere else in the format.
991
- fillMode: px.enum([PxFillMode.forwards, PxFillMode.backwards, PxFillMode.both, PxFillMode.none]).optional(),
992
- direction: px.enum([PxPlaybackDirection.normal, PxPlaybackDirection.reverse, PxPlaybackDirection.alternate, PxPlaybackDirection.alternateReverse]).optional()
1010
+ fillMode: px.enum([PxFillMode.forwards, PxFillMode.backwards, PxFillMode.both, PxFillMode.none], PxFillMode.forwards).optional(),
1011
+ direction: px.enum([PxPlaybackDirection.normal, PxPlaybackDirection.reverse, PxPlaybackDirection.alternate, PxPlaybackDirection.alternateReverse], PxPlaybackDirection.normal).optional()
993
1012
  }));
994
1013
  var scrollishTimelineShape = {
995
1014
  // §2.8: duration is a property of the TIMELINE — under scrubbing it is the keyframe
@@ -1000,8 +1019,8 @@ var scrollishTimelineShape = {
1000
1019
  iterations: px.number().optional(),
1001
1020
  engine: PxTimelineEngineSchema,
1002
1021
  frameRate: px.number().optional(),
1003
- axis: px.enum([PxScrollAxis.block, PxScrollAxis.inline, PxScrollAxis.x, PxScrollAxis.y]).optional(),
1004
- source: px.enum([PxScrollSource.nearest, PxScrollSource.root]).optional(),
1022
+ axis: px.enum([PxScrollAxis.block, PxScrollAxis.inline, PxScrollAxis.x, PxScrollAxis.y], PxScrollAxis.block).optional(),
1023
+ source: px.enum([PxScrollSource.nearest, PxScrollSource.root], PxScrollSource.nearest).optional(),
1005
1024
  subject: px.string().optional(),
1006
1025
  // 'parent' | 'scroller' | any CSS selector
1007
1026
  smoothing: px.number().optional(),
@@ -1081,9 +1100,10 @@ var PxRepeaterEffectSchema = implementsInterface()(px.object({
1081
1100
  }));
1082
1101
  var PxMaskedByEffectSchema = implementsInterface()(px.object({
1083
1102
  source: px.string().optional(),
1084
- maskType: px.enum([PxMaskType.luminance, PxMaskType.alpha]).optional(),
1085
- maskUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
1086
- maskContentUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
1103
+ // SVG's own initial values — what a <mask> does when the attribute is not there.
1104
+ maskType: px.enum([PxMaskType.luminance, PxMaskType.alpha], PxMaskType.luminance).optional(),
1105
+ maskUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox], PxUnits.objectBoundingBox).optional(),
1106
+ maskContentUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox], PxUnits.userSpaceOnUse).optional(),
1087
1107
  x: px.number().optional(),
1088
1108
  y: px.number().optional(),
1089
1109
  width: px.number().optional(),
@@ -1095,7 +1115,7 @@ var PxClipPathEffectSchema = implementsInterface()(px.object({
1095
1115
  var PxStrokeTrimEffectSchema = implementsInterface()(px.object({
1096
1116
  offset: PxAnimatableNumberSchema.optional(),
1097
1117
  range: PxAnimatableVec2Schema.optional(),
1098
- subPaths: px.enum([PxStrokeTrimSubPaths.separate, PxStrokeTrimSubPaths.combined]).optional()
1118
+ subPaths: px.enum([PxStrokeTrimSubPaths.separate, PxStrokeTrimSubPaths.combined], PxStrokeTrimSubPaths.separate).optional()
1099
1119
  }));
1100
1120
  var PxRetimeEffectSchema = implementsInterface()(px.object({
1101
1121
  start: px.number().optional(),
@@ -1127,17 +1147,20 @@ var PxFillGradientEffectSchema = implementsInterface()(px.object({
1127
1147
  radius: PxAnimatableNumberSchema.optional(),
1128
1148
  focal: PxAnimatableVec2Schema.optional(),
1129
1149
  stops: PxAnimatableGradientStopsSchema.optional(),
1130
- gradientUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
1131
- spreadMethod: px.enum([PxGradientSpreadMethod.pad, PxGradientSpreadMethod.reflect, PxGradientSpreadMethod.repeat]).optional(),
1150
+ // SVG's own initial values — what a gradient does when the attribute is not there.
1151
+ gradientUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox], PxUnits.objectBoundingBox).optional(),
1152
+ spreadMethod: px.enum([PxGradientSpreadMethod.pad, PxGradientSpreadMethod.reflect, PxGradientSpreadMethod.repeat], PxGradientSpreadMethod.pad).optional(),
1132
1153
  gradientTransform: px.string().optional()
1133
1154
  }));
1134
1155
  var PxStrokeGradientEffectSchema = PxFillGradientEffectSchema;
1135
1156
  var PxTextPathEffectSchema = implementsInterface()(px.object({
1136
1157
  pathData: px.string(),
1137
- pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend]).optional(),
1138
- lengthAdjust: px.enum([PxLengthAdjust.spacing, PxLengthAdjust.spacingAndGlyphs]).optional(),
1139
- method: px.enum([PxTextPathMethod.align, PxTextPathMethod.stretch]).optional(),
1140
- spacing: px.enum([PxTextPathSpacing.auto, PxTextPathSpacing.exact]).optional(),
1158
+ // `extend` is what an omitted pathOverflow means (glyphs continue along the tangent); the
1159
+ // other three are SVG's own initial values for the native <textPath> attributes.
1160
+ pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend], PxPathOverflow.extend).optional(),
1161
+ lengthAdjust: px.enum([PxLengthAdjust.spacing, PxLengthAdjust.spacingAndGlyphs], PxLengthAdjust.spacing).optional(),
1162
+ method: px.enum([PxTextPathMethod.align, PxTextPathMethod.stretch], PxTextPathMethod.align).optional(),
1163
+ spacing: px.enum([PxTextPathSpacing.auto, PxTextPathSpacing.exact], PxTextPathSpacing.exact).optional(),
1141
1164
  startOffset: PxAnimatableNumberSchema.optional(),
1142
1165
  textLength: PxAnimatableNumberSchema.optional()
1143
1166
  }));
@@ -1697,7 +1720,6 @@ function parseTransformParts(str2) {
1697
1720
  return Object.keys(out).length ? out : void 0;
1698
1721
  }
1699
1722
  var PX_STYLE_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
1700
- var PX_DEFAULT_DURATION_MS = 1e3;
1701
1723
  function kebabToCamelCaseWord(kebab) {
1702
1724
  return kebab.includes("-") ? kebab.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()) : kebab;
1703
1725
  }
@@ -1947,6 +1969,36 @@ function toDomProps(props) {
1947
1969
  }
1948
1970
  return propsCopy;
1949
1971
  }
1972
+ function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
1973
+ if (!animDef) return animDef;
1974
+ const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
1975
+ if (!staticParts || !Object.keys(staticParts).length) return animDef;
1976
+ const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues2(__spreadValues2({}, staticParts), v) : v;
1977
+ const transformAnim = animDef[TRANSFORM_ATTR];
1978
+ if (transformAnim && typeof transformAnim === "object") {
1979
+ const anim = transformAnim;
1980
+ if (Array.isArray(anim.keyframes)) {
1981
+ const out = __spreadProps2(__spreadValues2({}, anim), {
1982
+ keyframes: anim.keyframes.map((kf) => __spreadProps2(__spreadValues2({}, kf), { value: mergeKfValue(kf.value) }))
1983
+ });
1984
+ if (out.value !== void 0) out.value = mergeKfValue(out.value);
1985
+ return __spreadProps2(__spreadValues2({}, animDef), { transform: out });
1986
+ }
1987
+ return animDef;
1988
+ }
1989
+ const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
1990
+ if (channels.length !== 1) return animDef;
1991
+ const ch = channels[0];
1992
+ const chAnim = animDef[ch];
1993
+ if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
1994
+ const lifted = __spreadProps2(__spreadValues2({}, chAnim), {
1995
+ keyframes: chAnim.keyframes.map((kf) => __spreadProps2(__spreadValues2({}, kf), { value: __spreadProps2(__spreadValues2({}, staticParts), { [ch]: kf.value }) }))
1996
+ });
1997
+ if (lifted.value !== void 0) lifted.value = __spreadProps2(__spreadValues2({}, staticParts), { [ch]: lifted.value });
1998
+ const rest = __spreadValues2({}, animDef);
1999
+ delete rest[ch];
2000
+ return __spreadProps2(__spreadValues2({}, rest), { transform: lifted });
2001
+ }
1950
2002
  function getKfTranslate(kf) {
1951
2003
  const v = keyframeValue(kf);
1952
2004
  if (!v) return void 0;
@@ -2315,7 +2367,7 @@ function walkAndMaterialize(node, opts) {
2315
2367
  let newAnimate;
2316
2368
  const animBucket = node.animate;
2317
2369
  if (animBucket && typeof animBucket === "object" && !Array.isArray(animBucket)) {
2318
- const animDef = animBucket;
2370
+ const animDef = mergeStaticTransformIntoAnimDef(animBucket, node.transform);
2319
2371
  const transformAnim = animDef.transform;
2320
2372
  if (transformAnim && typeof transformAnim === "object" && propAnimIsMotionPath(transformAnim)) {
2321
2373
  const materialized = materializeMotionPathInPropAnim(transformAnim, opts);
@@ -2827,36 +2879,6 @@ var _elementIdCounter = 0;
2827
2879
  function generateElementId() {
2828
2880
  return "_px_el_" + ++_elementIdCounter;
2829
2881
  }
2830
- function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
2831
- if (!animDef) return animDef;
2832
- const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
2833
- if (!staticParts || !Object.keys(staticParts).length) return animDef;
2834
- const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues2(__spreadValues2({}, staticParts), v) : v;
2835
- const transformAnim = animDef[TRANSFORM_ATTR];
2836
- if (transformAnim && typeof transformAnim === "object") {
2837
- const anim = transformAnim;
2838
- if (Array.isArray(anim.keyframes)) {
2839
- const out = __spreadProps2(__spreadValues2({}, anim), {
2840
- keyframes: anim.keyframes.map((kf) => __spreadProps2(__spreadValues2({}, kf), { value: mergeKfValue(kf.value) }))
2841
- });
2842
- if (out.value !== void 0) out.value = mergeKfValue(out.value);
2843
- return __spreadProps2(__spreadValues2({}, animDef), { transform: out });
2844
- }
2845
- return animDef;
2846
- }
2847
- const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
2848
- if (channels.length !== 1) return animDef;
2849
- const ch = channels[0];
2850
- const chAnim = animDef[ch];
2851
- if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
2852
- const lifted = __spreadProps2(__spreadValues2({}, chAnim), {
2853
- keyframes: chAnim.keyframes.map((kf) => __spreadProps2(__spreadValues2({}, kf), { value: __spreadProps2(__spreadValues2({}, staticParts), { [ch]: kf.value }) }))
2854
- });
2855
- if (lifted.value !== void 0) lifted.value = __spreadProps2(__spreadValues2({}, staticParts), { [ch]: lifted.value });
2856
- const rest = __spreadValues2({}, animDef);
2857
- delete rest[ch];
2858
- return __spreadProps2(__spreadValues2({}, rest), { transform: lifted });
2859
- }
2860
2882
  function normalizeAnimationDefinition(animDef, duration, defs, engine = PxTimelineEngine.native) {
2861
2883
  const normalized = {};
2862
2884
  for (const [propName, propAnim] of Object.entries(animDef)) {
@@ -2939,7 +2961,7 @@ function getKeyframesPair(keyframes, progress) {
2939
2961
  return { prevKf, nextKf };
2940
2962
  }
2941
2963
  function calcPropertyValue(propName, propAnim, progress) {
2942
- var _a2, _b, _c, _d;
2964
+ var _a2, _b, _c, _d, _e;
2943
2965
  const keyframes = propAnim.keyframes || [];
2944
2966
  if (keyframes.length === 0) return null;
2945
2967
  const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
@@ -3008,7 +3030,7 @@ function calcPropertyValue(propName, propAnim, progress) {
3008
3030
  !!propAnim.autoOrient
3009
3031
  );
3010
3032
  partsResult.translate = [sample.translate[0], sample.translate[1]];
3011
- if (sample.rotateDeg !== void 0) partsResult.rotate = sample.rotateDeg;
3033
+ if (sample.rotateDeg !== void 0) partsResult.rotate = sample.rotateDeg + ((_e = partsResult.rotate) != null ? _e : 0);
3012
3034
  }
3013
3035
  }
3014
3036
  cssValue = composeTransformParts(partsResult, { withUnits: false });
@@ -3291,12 +3313,12 @@ function deepClonePxNode(value) {
3291
3313
  for (const k of Object.keys(value)) out[k] = deepClonePxNode(value[k]);
3292
3314
  return out;
3293
3315
  }
3294
- function regenerateIdsAndRewriteRefs(root, genId2) {
3316
+ function regenerateIdsAndRewriteRefs(root, genId3) {
3295
3317
  const oldToNew = /* @__PURE__ */ new Map();
3296
3318
  const walkAssign = (n) => {
3297
3319
  var _a2;
3298
3320
  if (typeof n.id === "string") {
3299
- const newId = genId2();
3321
+ const newId = genId3();
3300
3322
  oldToNew.set(n.id, newId);
3301
3323
  n.id = newId;
3302
3324
  }
@@ -3945,68 +3967,6 @@ function applyTextGlyphsAlongPath(node, ctx, pathD, startOffset, textLength, pat
3945
3967
  }
3946
3968
  return materializeGlyphTextAlongPath(node, pathD, startOffset, { glyphs: ctx.glyphs, warnings: ctx.warnings }, textLength, pathOverflow);
3947
3969
  }
3948
- var PxDiagnosticKind = {
3949
- /** The document is wrong — regenerate or repair the file. */
3950
- document: "document",
3951
- /** The page or app cannot provide what the document asks for — fix the mount. */
3952
- host: "host",
3953
- /** The platform cannot do it and the player degraded — usually nothing to fix. */
3954
- platform: "platform",
3955
- /** The call is wrong or self-contradictory — fix the options or props you passed. */
3956
- usage: "usage",
3957
- /** The player failed where it did not expect to — report it to us. */
3958
- internal: "internal"
3959
- };
3960
- var DOCS_URL = "https://github.com/pixodesk/pixodesk-svg-animator/blob/main/docs/diagnostics.md";
3961
- function codeLine(code) {
3962
- return "PX" + code + " " + DOCS_URL + "#px" + code;
3963
- }
3964
- function errorIn(data) {
3965
- return data.find((d) => d instanceof Error);
3966
- }
3967
- function createDiagnostics(config, prefix) {
3968
- const tag = prefix ? prefix + " " : "";
3969
- return {
3970
- warn: (kind, code, ...data) => {
3971
- const message = codeLine(code);
3972
- if (config == null ? void 0 : config.onWarn) {
3973
- config.onWarn({ code, kind, data, message });
3974
- return;
3975
- }
3976
- if (config == null ? void 0 : config.muteWarn) return;
3977
- console.warn(tag + kind + " " + message, ...data);
3978
- },
3979
- error: (kind, code, ...data) => {
3980
- const message = codeLine(code);
3981
- const error = errorIn(data);
3982
- if (config == null ? void 0 : config.onError) {
3983
- config.onError({ code, kind, data, message, error });
3984
- return;
3985
- }
3986
- if (config == null ? void 0 : config.muteError) return;
3987
- console.error(tag + kind + " " + message, ...data);
3988
- }
3989
- };
3990
- }
3991
- var MAX_REPORTED = 6;
3992
- function diagnoseDocument(doc) {
3993
- try {
3994
- return { problems: validateDocument(doc) };
3995
- } catch (e) {
3996
- return { problems: [] };
3997
- }
3998
- }
3999
- function reportDocumentDiagnostics(doc, where) {
4000
- const { problems } = diagnoseDocument(doc);
4001
- if (!problems.length) return;
4002
- const shown = problems.slice(0, MAX_REPORTED);
4003
- const more = problems.length - shown.length;
4004
- console.warn(
4005
- 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."
4006
- );
4007
- }
4008
-
4009
- // ../svg-animator-core/dist/index.js
4010
3970
  function applyTransformByEffect(node, fx, ctx) {
4011
3971
  if (!fx) return node;
4012
3972
  delete node.transform;
@@ -5524,12 +5484,17 @@ function buildOffsetPath(propAnim) {
5524
5484
  const first = keyframeValue(kfs[0]);
5525
5485
  const anchor = (first == null ? void 0 : first.origin) && first.origin.length >= 2 ? [first.origin[0], first.origin[1]] : [0, 0];
5526
5486
  const points = [];
5487
+ let keyframesCarryRotate = false;
5527
5488
  for (const kf of kfs) {
5528
5489
  const v = keyframeValue(kf);
5529
5490
  const tr = v == null ? void 0 : v.translate;
5530
5491
  if (!tr || tr.length < 2) return void 0;
5531
5492
  const parts = Object.keys(v);
5532
- if (parts.some((p) => p !== "translate" && p !== "origin")) return void 0;
5493
+ if (parts.some((p) => p !== TRANSFORM_PART.translate && p !== TRANSFORM_PART.origin && p !== TRANSFORM_PART.rotate)) return void 0;
5494
+ if ((v == null ? void 0 : v.rotate) !== void 0) {
5495
+ if (v.rotate !== 0) return void 0;
5496
+ keyframesCarryRotate = true;
5497
+ }
5533
5498
  const o = (_a2 = v == null ? void 0 : v.origin) != null ? _a2 : [0, 0];
5534
5499
  if (o[0] !== anchor[0] || o[1] !== anchor[1]) return void 0;
5535
5500
  points.push([tr[0] + anchor[0], tr[1] + anchor[1]]);
@@ -5557,7 +5522,7 @@ function buildOffsetPath(propAnim) {
5557
5522
  if (e !== void 0) out.e = e;
5558
5523
  distanceKfs.push(out);
5559
5524
  }
5560
- return { pathStr: d, distanceKfs, autoOrient: !!propAnim.autoOrient, anchor };
5525
+ return { pathStr: d, distanceKfs, autoOrient: !!propAnim.autoOrient, anchor, keyframesCarryRotate };
5561
5526
  }
5562
5527
  function materializeOffsetPathsInTree(root) {
5563
5528
  const walk = (node) => {
@@ -5579,6 +5544,7 @@ function materializeOffsetPathsInTree(root) {
5579
5544
  const t = __spreadValues2({}, staticTr);
5580
5545
  delete t[TRANSFORM_PART.translate];
5581
5546
  delete t[TRANSFORM_PART.origin];
5547
+ if (built.keyframesCarryRotate) delete t[TRANSFORM_PART.rotate];
5582
5548
  newTransform = Object.keys(t).length ? t : void 0;
5583
5549
  }
5584
5550
  out = __spreadProps2(__spreadValues2({}, node), {
@@ -5748,6 +5714,101 @@ function walkAndMaterialize2(node, idMap, animatedIds, genId3, defsCollector, ro
5748
5714
  });
5749
5715
  return changed ? __spreadProps2(__spreadValues2({}, node), { children: newChildren }) : node;
5750
5716
  }
5717
+ var TRANSFORM_CHANNEL = "transform";
5718
+ var REVERSED_DIRECTIONS = /* @__PURE__ */ new Set(["reverse", "alternate-reverse"]);
5719
+ var VERIFY_SAMPLE_FRACTIONS = [0, 0.25, 0.5, 0.75, 1];
5720
+ var SCRATCH_ID_PREFIX = "__px_rest_";
5721
+ function materializeRestPosesInTree(root, engine) {
5722
+ var _a2, _b;
5723
+ const out = deepClone(root);
5724
+ const config = getAnimatorConfig(out) || {};
5725
+ const duration = +(config.duration || PX_DEFAULT_DURATION_MS);
5726
+ const firstFrameTime = REVERSED_DIRECTIONS.has(String(config.direction)) ? duration : 0;
5727
+ const nodes = animatedNodes(out);
5728
+ if (!nodes.size) return out;
5729
+ const before = bindingsOf(out, engine);
5730
+ const added = /* @__PURE__ */ new Map();
5731
+ for (const [key, animate] of before) {
5732
+ const node = nodes.get(key);
5733
+ if (!node) continue;
5734
+ const channels = Object.keys(animate);
5735
+ for (const channel of channels) {
5736
+ if (PX_TRANSFORM_FN_NAMES.has(channel)) continue;
5737
+ if (!mayCarryRestPose(node, channel)) continue;
5738
+ const value = firstFrameValue(animate, channel, firstFrameTime);
5739
+ if (value === void 0) continue;
5740
+ node[channel] = value;
5741
+ added.set(key, [...(_a2 = added.get(key)) != null ? _a2 : [], channel]);
5742
+ }
5743
+ if (channels.some((channel) => PX_TRANSFORM_FN_NAMES.has(channel)) && mayCarryTransformRestPose(node)) {
5744
+ const parts = firstFrameTransformParts(animate, firstFrameTime);
5745
+ if (parts) {
5746
+ node[TRANSFORM_CHANNEL] = parts;
5747
+ added.set(key, [...(_b = added.get(key)) != null ? _b : [], TRANSFORM_CHANNEL]);
5748
+ }
5749
+ }
5750
+ }
5751
+ if (added.size) {
5752
+ const after = bindingsOf(out, engine);
5753
+ for (const [key, channels] of added) {
5754
+ if (writesTheSameFrames(before.get(key), after.get(key), duration)) continue;
5755
+ const node = nodes.get(key);
5756
+ if (node) for (const channel of channels) delete node[channel];
5757
+ }
5758
+ }
5759
+ return out;
5760
+ }
5761
+ function mayCarryRestPose(node, channel) {
5762
+ if (node[channel] !== void 0) return false;
5763
+ if (channel === TRANSFORM_CHANNEL) return mayCarryTransformRestPose(node);
5764
+ return true;
5765
+ }
5766
+ function mayCarryTransformRestPose(node) {
5767
+ if (node[TRANSFORM_CHANNEL] !== void 0) return false;
5768
+ for (const part of PX_TRANSFORM_FN_NAMES) if (node[part] !== void 0) return false;
5769
+ return true;
5770
+ }
5771
+ function firstFrameValue(animate, channel, timeMs) {
5772
+ const values = Object.values(calcAnimationValues({ [channel]: animate[channel] }, timeMs));
5773
+ return values.length === 1 && values[0] !== "" ? values[0] : void 0;
5774
+ }
5775
+ function firstFrameTransformParts(animate, timeMs) {
5776
+ const family = {};
5777
+ for (const channel of Object.keys(animate)) if (PX_TRANSFORM_FN_NAMES.has(channel)) family[channel] = animate[channel];
5778
+ const written = calcAnimationValues(family, timeMs)[TRANSFORM_CHANNEL];
5779
+ if (!written) return void 0;
5780
+ const parts = parseTransformParts(written.replace(/(px|deg)\b/g, ""));
5781
+ return parts && Object.keys(parts).length ? parts : void 0;
5782
+ }
5783
+ function writesTheSameFrames(a, b, durationMs) {
5784
+ if (!a || !b) return a === b;
5785
+ const frame = (animate, t) => JSON.stringify(calcAnimationValues(animate, t)).replace(/\s+/g, "");
5786
+ return VERIFY_SAMPLE_FRACTIONS.every((fraction) => frame(a, fraction * durationMs) === frame(b, fraction * durationMs));
5787
+ }
5788
+ function bindingsOf(tree, engine) {
5789
+ const scratch = deepClone(tree);
5790
+ const keyById = /* @__PURE__ */ new Map();
5791
+ for (const [key, node] of animatedNodes(scratch)) {
5792
+ if (node.id === void 0) node.id = SCRATCH_ID_PREFIX + key;
5793
+ keyById.set(String(node.id), key);
5794
+ }
5795
+ const out = /* @__PURE__ */ new Map();
5796
+ for (const binding of normalizeBindings(scratch, engine)) {
5797
+ const key = keyById.get(binding.id);
5798
+ if (key !== void 0) out.set(key, binding.animate);
5799
+ }
5800
+ return out;
5801
+ }
5802
+ function animatedNodes(tree) {
5803
+ const out = /* @__PURE__ */ new Map();
5804
+ let counter = 0;
5805
+ const visit = (node) => {
5806
+ if (node.animate) out.set(String(counter++), node);
5807
+ if (node.children) for (const child of node.children) visit(child);
5808
+ };
5809
+ if (tree.children) for (const child of tree.children) visit(child);
5810
+ return out;
5811
+ }
5751
5812
  function materializeAllInTree(doc, engine, options) {
5752
5813
  var _a2, _b;
5753
5814
  let root = materializeNodeEffects(doc).root;
@@ -5759,6 +5820,7 @@ function materializeAllInTree(doc, engine, options) {
5759
5820
  root = materializeAnimatedUseInstances(root);
5760
5821
  root = pruneUnreferencedDefs(root);
5761
5822
  }
5823
+ root = materializeRestPosesInTree(root, engine);
5762
5824
  return root;
5763
5825
  }
5764
5826
  function pruneUnreferencedDefs(root) {
@@ -5790,6 +5852,98 @@ function pruneUnreferencedDefs(root) {
5790
5852
  }
5791
5853
  return root;
5792
5854
  }
5855
+ var PxDiagnosticCode = /* @__PURE__ */ ((PxDiagnosticCode2) => {
5856
+ PxDiagnosticCode2[PxDiagnosticCode2["buildFailed"] = 1001] = "buildFailed";
5857
+ PxDiagnosticCode2[PxDiagnosticCode2["invalidDocumentAtSrc"] = 1002] = "invalidDocumentAtSrc";
5858
+ PxDiagnosticCode2[PxDiagnosticCode2["loadFailed"] = 1003] = "loadFailed";
5859
+ PxDiagnosticCode2[PxDiagnosticCode2["animationBuildFailed"] = 1004] = "animationBuildFailed";
5860
+ PxDiagnosticCode2[PxDiagnosticCode2["effectsShape"] = 1101] = "effectsShape";
5861
+ PxDiagnosticCode2[PxDiagnosticCode2["timelineOverrideIgnored"] = 1102] = "timelineOverrideIgnored";
5862
+ PxDiagnosticCode2[PxDiagnosticCode2["blockedTag"] = 1103] = "blockedTag";
5863
+ PxDiagnosticCode2[PxDiagnosticCode2["unsupportedAnimatedAttrs"] = 1104] = "unsupportedAnimatedAttrs";
5864
+ PxDiagnosticCode2[PxDiagnosticCode2["noBindings"] = 1105] = "noBindings";
5865
+ PxDiagnosticCode2[PxDiagnosticCode2["unresolvedBinding"] = 1106] = "unresolvedBinding";
5866
+ PxDiagnosticCode2[PxDiagnosticCode2["triggersNoRoot"] = 1201] = "triggersNoRoot";
5867
+ PxDiagnosticCode2[PxDiagnosticCode2["noRootForSelector"] = 1202] = "noRootForSelector";
5868
+ PxDiagnosticCode2[PxDiagnosticCode2["noRootElement"] = 1203] = "noRootElement";
5869
+ PxDiagnosticCode2[PxDiagnosticCode2["noElementsForSelector"] = 1206] = "noElementsForSelector";
5870
+ PxDiagnosticCode2[PxDiagnosticCode2["setAttributeNoElement"] = 1207] = "setAttributeNoElement";
5871
+ PxDiagnosticCode2[PxDiagnosticCode2["scrollSmoothingNeedsOwnDriver"] = 1301] = "scrollSmoothingNeedsOwnDriver";
5872
+ PxDiagnosticCode2[PxDiagnosticCode2["scrollNativeUnavailable"] = 1302] = "scrollNativeUnavailable";
5873
+ PxDiagnosticCode2[PxDiagnosticCode2["scrollSubjectInvalid"] = 1303] = "scrollSubjectInvalid";
5874
+ PxDiagnosticCode2[PxDiagnosticCode2["scrollSubjectNoMatch"] = 1304] = "scrollSubjectNoMatch";
5875
+ PxDiagnosticCode2[PxDiagnosticCode2["scrollNoRootToObserve"] = 1305] = "scrollNoRootToObserve";
5876
+ PxDiagnosticCode2[PxDiagnosticCode2["scrollTriggerIgnored"] = 1306] = "scrollTriggerIgnored";
5877
+ PxDiagnosticCode2[PxDiagnosticCode2["rateRejected"] = 1401] = "rateRejected";
5878
+ PxDiagnosticCode2[PxDiagnosticCode2["controlPropsConflict"] = 1501] = "controlPropsConflict";
5879
+ PxDiagnosticCode2[PxDiagnosticCode2["rnCompileFailed"] = 1601] = "rnCompileFailed";
5880
+ PxDiagnosticCode2[PxDiagnosticCode2["rnRenderFailed"] = 1602] = "rnRenderFailed";
5881
+ PxDiagnosticCode2[PxDiagnosticCode2["rnBoundaryCaught"] = 1603] = "rnBoundaryCaught";
5882
+ PxDiagnosticCode2[PxDiagnosticCode2["rnUnsupported"] = 1604] = "rnUnsupported";
5883
+ return PxDiagnosticCode2;
5884
+ })(PxDiagnosticCode || {});
5885
+ var PxDiagnosticKind = {
5886
+ /** The document is wrong — regenerate or repair the file. */
5887
+ document: "document",
5888
+ /** The page or app cannot provide what the document asks for — fix the mount. */
5889
+ host: "host",
5890
+ /** The platform cannot do it and the player degraded — usually nothing to fix. */
5891
+ platform: "platform",
5892
+ /** The call is wrong or self-contradictory — fix the options or props you passed. */
5893
+ usage: "usage",
5894
+ /** The player failed where it did not expect to — report it to us. */
5895
+ internal: "internal"
5896
+ };
5897
+ var DOCS_URL = "https://github.com/pixodesk/pixodesk-svg-animator/blob/main/docs/diagnostics.md";
5898
+ function codeLine(code) {
5899
+ return "PX" + code + " " + DOCS_URL + "#px" + code;
5900
+ }
5901
+ function errorIn(data) {
5902
+ return data.find((d) => d instanceof Error);
5903
+ }
5904
+ function createDiagnostics(config, prefix) {
5905
+ const tag = prefix ? prefix + " " : "";
5906
+ return {
5907
+ warn: (kind, code, ...data) => {
5908
+ const message = codeLine(code);
5909
+ if (config == null ? void 0 : config.onWarn) {
5910
+ config.onWarn({ code, kind, data, message });
5911
+ return;
5912
+ }
5913
+ if (config == null ? void 0 : config.muteWarn) return;
5914
+ console.warn(tag + kind + " " + message, ...data);
5915
+ },
5916
+ error: (kind, code, ...data) => {
5917
+ const message = codeLine(code);
5918
+ const error = errorIn(data);
5919
+ if (config == null ? void 0 : config.onError) {
5920
+ config.onError({ code, kind, data, message, error });
5921
+ return;
5922
+ }
5923
+ if (config == null ? void 0 : config.muteError) return;
5924
+ console.error(tag + kind + " " + message, ...data);
5925
+ }
5926
+ };
5927
+ }
5928
+ var MAX_REPORTED = 6;
5929
+ function diagnoseDocument(doc) {
5930
+ try {
5931
+ return { problems: validateDocument(doc) };
5932
+ } catch (e) {
5933
+ return { problems: [] };
5934
+ }
5935
+ }
5936
+ function reportDocumentDiagnostics(doc, where) {
5937
+ const { problems } = diagnoseDocument(doc);
5938
+ if (!problems.length) return;
5939
+ const shown = problems.slice(0, MAX_REPORTED);
5940
+ const more = problems.length - shown.length;
5941
+ console.warn(
5942
+ 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."
5943
+ );
5944
+ }
5945
+
5946
+ // ../svg-animator-core/dist/index.js
5793
5947
  var PX_RATE_REJECTED = "setPlaybackRate: rate must be finite and non-zero";
5794
5948
  function isValidPlaybackRate(rate) {
5795
5949
  return Number.isFinite(rate) && rate !== 0;
@@ -5841,13 +5995,13 @@ function createAdapterAnimator(doc, adapter, callbacks) {
5841
5995
  const bindings = normalizeBindings(doc, PxTimelineEngine.js);
5842
5996
  const _iterations = config.iterations;
5843
5997
  let iterations = 1;
5844
- if (typeof _iterations === "number") iterations = _iterations || 1;
5998
+ if (typeof _iterations === "number") iterations = _iterations || PX_DEFAULT_ITERATIONS;
5845
5999
  if (_iterations === "infinite") iterations = Infinity;
5846
6000
  if (iterations < 1) iterations = 1;
5847
6001
  const duration = +(config.duration || PX_DEFAULT_DURATION_MS);
5848
- const totalDuration = duration && iterations ? duration * (iterations === Infinity ? Infinity : iterations) : duration ? (iterations != null ? iterations : 1) * duration : 0;
5849
- const direction = config.direction || "normal";
5850
- const fill = (_a2 = config.fill) != null ? _a2 : "forwards";
6002
+ const totalDuration = duration && iterations ? duration * (iterations === Infinity ? Infinity : iterations) : duration ? (iterations != null ? iterations : PX_DEFAULT_ITERATIONS) * duration : 0;
6003
+ const direction = config.direction || PxTimeTimelineSchema.defaults.direction;
6004
+ const fill = (_a2 = config.fill) != null ? _a2 : PxTimeTimelineSchema.defaults.fillMode;
5851
6005
  const fillsForwards = fill === "forwards" || fill === "both";
5852
6006
  const fillsBackwards = fill === "backwards" || fill === "both";
5853
6007
  let timerId = null;
@@ -6101,36 +6255,6 @@ function createAdapterAnimator(doc, adapter, callbacks) {
6101
6255
  };
6102
6256
  return api;
6103
6257
  }
6104
- var PxDiagnosticCode = /* @__PURE__ */ ((PxDiagnosticCode2) => {
6105
- PxDiagnosticCode2[PxDiagnosticCode2["buildFailed"] = 1001] = "buildFailed";
6106
- PxDiagnosticCode2[PxDiagnosticCode2["invalidDocumentAtSrc"] = 1002] = "invalidDocumentAtSrc";
6107
- PxDiagnosticCode2[PxDiagnosticCode2["loadFailed"] = 1003] = "loadFailed";
6108
- PxDiagnosticCode2[PxDiagnosticCode2["animationBuildFailed"] = 1004] = "animationBuildFailed";
6109
- PxDiagnosticCode2[PxDiagnosticCode2["effectsShape"] = 1101] = "effectsShape";
6110
- PxDiagnosticCode2[PxDiagnosticCode2["timelineOverrideIgnored"] = 1102] = "timelineOverrideIgnored";
6111
- PxDiagnosticCode2[PxDiagnosticCode2["blockedTag"] = 1103] = "blockedTag";
6112
- PxDiagnosticCode2[PxDiagnosticCode2["unsupportedAnimatedAttrs"] = 1104] = "unsupportedAnimatedAttrs";
6113
- PxDiagnosticCode2[PxDiagnosticCode2["noBindings"] = 1105] = "noBindings";
6114
- PxDiagnosticCode2[PxDiagnosticCode2["unresolvedBinding"] = 1106] = "unresolvedBinding";
6115
- PxDiagnosticCode2[PxDiagnosticCode2["triggersNoRoot"] = 1201] = "triggersNoRoot";
6116
- PxDiagnosticCode2[PxDiagnosticCode2["noRootForSelector"] = 1202] = "noRootForSelector";
6117
- PxDiagnosticCode2[PxDiagnosticCode2["noRootElement"] = 1203] = "noRootElement";
6118
- PxDiagnosticCode2[PxDiagnosticCode2["noElementsForSelector"] = 1206] = "noElementsForSelector";
6119
- PxDiagnosticCode2[PxDiagnosticCode2["setAttributeNoElement"] = 1207] = "setAttributeNoElement";
6120
- PxDiagnosticCode2[PxDiagnosticCode2["scrollSmoothingNeedsOwnDriver"] = 1301] = "scrollSmoothingNeedsOwnDriver";
6121
- PxDiagnosticCode2[PxDiagnosticCode2["scrollNativeUnavailable"] = 1302] = "scrollNativeUnavailable";
6122
- PxDiagnosticCode2[PxDiagnosticCode2["scrollSubjectInvalid"] = 1303] = "scrollSubjectInvalid";
6123
- PxDiagnosticCode2[PxDiagnosticCode2["scrollSubjectNoMatch"] = 1304] = "scrollSubjectNoMatch";
6124
- PxDiagnosticCode2[PxDiagnosticCode2["scrollNoRootToObserve"] = 1305] = "scrollNoRootToObserve";
6125
- PxDiagnosticCode2[PxDiagnosticCode2["scrollTriggerIgnored"] = 1306] = "scrollTriggerIgnored";
6126
- PxDiagnosticCode2[PxDiagnosticCode2["rateRejected"] = 1401] = "rateRejected";
6127
- PxDiagnosticCode2[PxDiagnosticCode2["controlPropsConflict"] = 1501] = "controlPropsConflict";
6128
- PxDiagnosticCode2[PxDiagnosticCode2["rnCompileFailed"] = 1601] = "rnCompileFailed";
6129
- PxDiagnosticCode2[PxDiagnosticCode2["rnRenderFailed"] = 1602] = "rnRenderFailed";
6130
- PxDiagnosticCode2[PxDiagnosticCode2["rnBoundaryCaught"] = 1603] = "rnBoundaryCaught";
6131
- PxDiagnosticCode2[PxDiagnosticCode2["rnUnsupported"] = 1604] = "rnUnsupported";
6132
- return PxDiagnosticCode2;
6133
- })(PxDiagnosticCode || {});
6134
6258
  var FLAT_ONLY_KEYS = [
6135
6259
  "timelineSource",
6136
6260
  "scroll",
@@ -6413,11 +6537,12 @@ export {
6413
6537
  resolveTimelineEngine,
6414
6538
  isNativeForced,
6415
6539
  mayUseNativeScrollTimeline,
6540
+ PX_DEFAULT_DURATION_MS,
6541
+ PX_DEFAULT_ITERATIONS,
6416
6542
  resolveTrigger,
6417
6543
  PX_TEXT_CONTENT_ATTR,
6418
6544
  isPxDocument,
6419
6545
  getAnimatorConfig,
6420
- getDefinitions,
6421
6546
  keyframeValue,
6422
6547
  keyframeEasing,
6423
6548
  PxTriggerSchema,
@@ -6438,7 +6563,6 @@ export {
6438
6563
  PX_PCT_BASED_ATTR_NAMES,
6439
6564
  composeTransformParts,
6440
6565
  PX_STYLE_ATTR_NAMES,
6441
- PX_DEFAULT_DURATION_MS,
6442
6566
  kebabToCamelCaseWord,
6443
6567
  camelCaseToKebabWordIfNeeded,
6444
6568
  clamp,
@@ -6448,21 +6572,21 @@ export {
6448
6572
  toDomProps,
6449
6573
  interpolateValue,
6450
6574
  normalizeBindings,
6575
+ materializeAllInTree,
6576
+ PxDiagnosticCode,
6451
6577
  PxDiagnosticKind,
6452
6578
  createDiagnostics,
6453
6579
  reportDocumentDiagnostics,
6454
- materializeAllInTree,
6455
6580
  isValidPlaybackRate,
6456
6581
  seekCeilingMs,
6457
6582
  clampSeekMs,
6458
6583
  timeToProgress,
6459
6584
  progressToTimeMs,
6460
6585
  createAdapterAnimator,
6461
- PxDiagnosticCode,
6462
6586
  foldTimelineOverride,
6463
6587
  applyAnimatorConfig,
6464
6588
  PLAY_WHEN_VISIBLE_DEFAULTS,
6465
6589
  createVisibilityGate,
6466
6590
  PX_ANIMATOR_DOC_KEY
6467
6591
  };
6468
- //# sourceMappingURL=chunk-ZEMEZT7X.js.map
6592
+ //# sourceMappingURL=chunk-ZBGGXE5W.js.map