@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.
@@ -67,19 +67,31 @@ var PixodeskAnimator = (() => {
67
67
  return result;
68
68
  }
69
69
  var Base = class {
70
+ /** Structural schemas (objects, arrays, unions of objects…) pass `false`: they state no scalar default. */
71
+ constructor(_statesDefault) {
72
+ this._statesDefault = _statesDefault;
73
+ }
70
74
  _canSanitize(raw) {
71
75
  return this.isValid(raw);
72
76
  }
77
+ /** A REQUIRED field is never absent; its default is the repair value. */
78
+ absentDefault() {
79
+ return this._default;
80
+ }
73
81
  optional() {
74
82
  return new Optional(this);
75
83
  }
76
84
  };
77
85
  var Optional = class extends Base {
78
86
  constructor(inner) {
79
- super();
87
+ super(inner._statesDefault);
80
88
  this.inner = inner;
81
89
  this._default = void 0;
82
90
  }
91
+ /** Absent means the inner schema's STATED default — or nothing at all when it states none. */
92
+ absentDefault() {
93
+ return this.inner._statesDefault ? this.inner._default : void 0;
94
+ }
83
95
  sanitize(raw) {
84
96
  if (raw === void 0 || raw === null) return void 0;
85
97
  return this.inner._canSanitize(raw) ? this.inner.sanitize(raw) : void 0;
@@ -93,8 +105,8 @@ var PixodeskAnimator = (() => {
93
105
  }
94
106
  };
95
107
  var Str = class extends Base {
96
- constructor(_default = "") {
97
- super();
108
+ constructor(_default, statesDefault) {
109
+ super(statesDefault);
98
110
  this._default = _default;
99
111
  }
100
112
  sanitize(raw) {
@@ -107,8 +119,8 @@ var PixodeskAnimator = (() => {
107
119
  }
108
120
  };
109
121
  var Num = class extends Base {
110
- constructor(_default = 0) {
111
- super();
122
+ constructor(_default, statesDefault) {
123
+ super(statesDefault);
112
124
  this._default = _default;
113
125
  }
114
126
  sanitize(raw) {
@@ -121,8 +133,8 @@ var PixodeskAnimator = (() => {
121
133
  }
122
134
  };
123
135
  var Bool = class extends Base {
124
- constructor(_default = false) {
125
- super();
136
+ constructor(_default, statesDefault) {
137
+ super(statesDefault);
126
138
  this._default = _default;
127
139
  }
128
140
  sanitize(raw) {
@@ -135,8 +147,9 @@ var PixodeskAnimator = (() => {
135
147
  }
136
148
  };
137
149
  var Literal = class extends Base {
150
+ /** A literal IS its own value: absent means it. */
138
151
  constructor(value) {
139
- super();
152
+ super(true);
140
153
  this.value = value;
141
154
  this._default = value;
142
155
  }
@@ -150,8 +163,8 @@ var PixodeskAnimator = (() => {
150
163
  }
151
164
  };
152
165
  var Enum = class extends Base {
153
- constructor(values, defaultVal) {
154
- super();
166
+ constructor(values, defaultVal, statesDefault) {
167
+ super(statesDefault);
155
168
  this.values = values;
156
169
  this._default = defaultVal != null ? defaultVal : values[0];
157
170
  }
@@ -166,8 +179,8 @@ var PixodeskAnimator = (() => {
166
179
  };
167
180
  var UNION_MEMBER_ERROR_LIMIT = 4;
168
181
  var Union = class extends Base {
169
- constructor(schemas, defaultVal) {
170
- super();
182
+ constructor(schemas, defaultVal, statesDefault) {
183
+ super(statesDefault);
171
184
  this.schemas = schemas;
172
185
  /** Structural tag read by {@link describeSchema} — `schemas` alone cannot tell Union from Tuple. */
173
186
  this._kind = "union";
@@ -221,7 +234,7 @@ var PixodeskAnimator = (() => {
221
234
  var DiscriminatedUnion = class extends Base {
222
235
  constructor(_key, _schemas, defaultVal) {
223
236
  var _a;
224
- super();
237
+ super(false);
225
238
  this._key = _key;
226
239
  this._schemas = _schemas;
227
240
  /** Structural tag read by {@link describeSchema}. */
@@ -261,13 +274,19 @@ var PixodeskAnimator = (() => {
261
274
  return schema ? schema._canSanitize(raw) : this._schemas[0]._canSanitize(raw);
262
275
  }
263
276
  };
277
+ function statedDefaults(shape) {
278
+ const out = {};
279
+ for (const key of Object.keys(shape)) if (shape[key]._statesDefault) out[key] = shape[key].absentDefault();
280
+ return Object.freeze(out);
281
+ }
264
282
  var Obj = class extends Base {
265
283
  constructor(_shape) {
266
- super();
284
+ super(false);
267
285
  this._shape = _shape;
268
286
  const d = {};
269
287
  for (const key of Object.keys(_shape)) d[key] = _shape[key]._default;
270
288
  this._default = d;
289
+ this.defaults = statedDefaults(_shape);
271
290
  }
272
291
  sanitize(raw) {
273
292
  const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
@@ -309,12 +328,13 @@ var PixodeskAnimator = (() => {
309
328
  };
310
329
  var OpenObj = class extends Base {
311
330
  constructor(_shape, _openSchema) {
312
- super();
331
+ super(false);
313
332
  this._shape = _shape;
314
333
  this._openSchema = _openSchema;
315
334
  const d = {};
316
335
  for (const key of Object.keys(_shape)) d[key] = _shape[key]._default;
317
336
  this._default = d;
337
+ this.defaults = statedDefaults(_shape);
318
338
  }
319
339
  sanitize(raw) {
320
340
  const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
@@ -359,7 +379,7 @@ var PixodeskAnimator = (() => {
359
379
  };
360
380
  var Arr = class extends Base {
361
381
  constructor(item) {
362
- super();
382
+ super(false);
363
383
  this.item = item;
364
384
  this._default = [];
365
385
  }
@@ -391,7 +411,7 @@ var PixodeskAnimator = (() => {
391
411
  };
392
412
  var Rec = class extends Base {
393
413
  constructor(value) {
394
- super();
414
+ super(false);
395
415
  this.value = value;
396
416
  /** Structural tag read by {@link describeSchema}. */
397
417
  this._kind = "record";
@@ -425,7 +445,7 @@ var PixodeskAnimator = (() => {
425
445
  };
426
446
  var Any = class extends Base {
427
447
  constructor() {
428
- super(...arguments);
448
+ super(false);
429
449
  this._default = void 0;
430
450
  }
431
451
  sanitize(raw) {
@@ -440,7 +460,7 @@ var PixodeskAnimator = (() => {
440
460
  };
441
461
  var Defined = class extends Base {
442
462
  constructor() {
443
- super(...arguments);
463
+ super(false);
444
464
  this._default = void 0;
445
465
  }
446
466
  sanitize(raw) {
@@ -457,7 +477,7 @@ var PixodeskAnimator = (() => {
457
477
  };
458
478
  var Lazy = class extends Base {
459
479
  constructor(fn, _default) {
460
- super();
480
+ super(false);
461
481
  this.fn = fn;
462
482
  this._default = _default;
463
483
  this.resolved = null;
@@ -478,7 +498,7 @@ var PixodeskAnimator = (() => {
478
498
  };
479
499
  var Tuple = class extends Base {
480
500
  constructor(schemas) {
481
- super();
501
+ super(false);
482
502
  this.schemas = schemas;
483
503
  /** Structural tag read by {@link describeSchema} — `schemas` alone cannot tell Tuple from Union. */
484
504
  this._kind = "tuple";
@@ -510,22 +530,29 @@ var PixodeskAnimator = (() => {
510
530
  function implementsInterface() {
511
531
  return (schema) => schema;
512
532
  }
533
+ function string(defaultVal) {
534
+ return defaultVal === void 0 ? new Str("", false) : new Str(defaultVal, true);
535
+ }
536
+ function number(defaultVal) {
537
+ return defaultVal === void 0 ? new Num(0, false) : new Num(defaultVal, true);
538
+ }
539
+ function boolean(defaultVal) {
540
+ return defaultVal === void 0 ? new Bool(false, false) : new Bool(defaultVal, true);
541
+ }
542
+ function oneOf(values, defaultVal) {
543
+ return defaultVal === void 0 ? new Enum(values, void 0, false) : new Enum(values, defaultVal, true);
544
+ }
545
+ function unionOf(schemas, defaultVal) {
546
+ return defaultVal === void 0 ? new Union(schemas, void 0, false) : new Union(schemas, defaultVal, true);
547
+ }
513
548
  var px = {
514
- /** Matches a string. Default: '' or provided value. */
515
- string: (defaultVal = "") => new Str(defaultVal),
516
- /** Matches a finite number. Default: 0 or provided value. */
517
- number: (defaultVal = 0) => new Num(defaultVal),
518
- /** Matches a boolean. Default: false or provided value. */
519
- boolean: (defaultVal = false) => new Bool(defaultVal),
520
- /** Matches one exact primitive value; its default is the value itself. */
549
+ string,
550
+ number,
551
+ boolean,
552
+ /** Matches one exact primitive value; absent means the value itself. */
521
553
  literal: (value) => new Literal(value),
522
- /** Matches one of a fixed set of string/number values. Default: first value. */
523
- enum: (values, defaultVal) => new Enum(values, defaultVal),
524
- /**
525
- * Returns the first schema whose isValid passes.
526
- * TypeScript infers the union of all member types automatically.
527
- */
528
- union: (schemas, defaultVal) => new Union(schemas, defaultVal),
554
+ enum: oneOf,
555
+ union: unionOf,
529
556
  /**
530
557
  * Discriminated union — reads `raw[key]`, finds the member schema whose
531
558
  * literal at `key` matches, then delegates sanitize/isValid to that member.
@@ -533,7 +560,8 @@ var PixodeskAnimator = (() => {
533
560
  * TypeScript infers the union of all member types automatically.
534
561
  */
535
562
  discriminatedUnion: (key, schemas) => new DiscriminatedUnion(key, schemas),
536
- /** Typed object — unknown keys are stripped. Required fields fall back to their default. */
563
+ /** Typed object — unknown keys are stripped. Required fields fall back to their default.
564
+ * Its `defaults` say what each stated field means when a document leaves it out. */
537
565
  object: (shape) => new Obj(shape),
538
566
  /**
539
567
  * Open object — validates known keys; passes unknown keys through as-is,
@@ -655,8 +683,11 @@ var PixodeskAnimator = (() => {
655
683
  offScreen: "pause",
656
684
  mouseOut: "continue",
657
685
  visibilityThreshold: 0.5,
658
- visibilityDebounce: 150
686
+ visibilityDebounce: 150,
687
+ finish: "hold"
659
688
  };
689
+ var PX_DEFAULT_DURATION_MS = 1e3;
690
+ var PX_DEFAULT_ITERATIONS = 1;
660
691
  function resolveTrigger(trigger) {
661
692
  var _a, _b, _c, _d, _e;
662
693
  return {
@@ -853,15 +884,15 @@ var PixodeskAnimator = (() => {
853
884
  var keyframeTangentOut = (kf) => anyKf(kf).tangentOut;
854
885
  var PxLoopSchema = implementsInterface()(px.object({
855
886
  segmentCount: px.number().optional(),
856
- repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end]).optional(),
857
- direction: px.enum([PxLoopDirection.normal, PxLoopDirection.alternate]).optional()
887
+ repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end], PxLoopRepeatAt.end).optional(),
888
+ direction: px.enum([PxLoopDirection.normal, PxLoopDirection.alternate], PxLoopDirection.normal).optional()
858
889
  }));
859
890
  var PxPropertyAnimationSchema = implementsInterface()(px.object({
860
891
  value: PxKeyframeValueSchema.optional(),
861
892
  keyframes: px.array(PxKeyframeSchema).optional(),
862
893
  loop: px.union([PxLoopSchema, px.boolean()]).optional(),
863
894
  autoOrient: px.boolean().optional(),
864
- alongPathMode: px.enum([PxAlongPathMode.sampled, PxAlongPathMode.offsetPath]).optional()
895
+ alongPathMode: px.enum([PxAlongPathMode.sampled, PxAlongPathMode.offsetPath], PxAlongPathMode.sampled).optional()
865
896
  }));
866
897
  var PxTransformPartsSchema = implementsInterface()(px.object({
867
898
  translate: px.tuple([px.number(), px.number()]).optional(),
@@ -891,9 +922,9 @@ var PixodeskAnimator = (() => {
891
922
  // What happens after a NATURAL finish — `'hold'` (default: keep the end state per
892
923
  // `fill`) or `'reset'` (snap back to the start state). One of four occasion keys
893
924
  // (`start`, `offScreen`, `mouseOut`, `finish`), all named the same way.
894
- finish: px.enum([PxFinishAction.hold, PxFinishAction.reset]).optional(),
895
- visibilityThreshold: px.number().optional(),
896
- visibilityDebounce: px.number().optional()
925
+ finish: px.enum([PxFinishAction.hold, PxFinishAction.reset], PX_TRIGGER_DEFAULTS.finish).optional(),
926
+ visibilityThreshold: px.number(PX_TRIGGER_DEFAULTS.visibilityThreshold).optional(),
927
+ visibilityDebounce: px.number(PX_TRIGGER_DEFAULTS.visibilityDebounce).optional()
897
928
  }));
898
929
  var PxGlyphSchema = implementsInterface()(px.object({
899
930
  width: px.number(),
@@ -919,7 +950,7 @@ var PixodeskAnimator = (() => {
919
950
  PxScrollPhase.exit,
920
951
  PxScrollPhase.entryCrossing,
921
952
  PxScrollPhase.exitCrossing
922
- ]).optional(),
953
+ ], PxScrollPhase.cover).optional(),
923
954
  fraction: px.number().optional()
924
955
  }));
925
956
  var PxScrollRangeSchema = px.object({
@@ -927,37 +958,37 @@ var PixodeskAnimator = (() => {
927
958
  end: PxScrollRangePointSchema.optional()
928
959
  });
929
960
  var PxScrollSchema = implementsInterface()(px.object({
930
- kind: px.enum([PxScrollKind.view, PxScrollKind.scroll]).optional(),
931
- axis: px.enum([PxScrollAxis.block, PxScrollAxis.inline, PxScrollAxis.x, PxScrollAxis.y]).optional(),
932
- source: px.enum([PxScrollSource.nearest, PxScrollSource.root]).optional(),
961
+ kind: px.enum([PxScrollKind.view, PxScrollKind.scroll], PxScrollKind.view).optional(),
962
+ axis: px.enum([PxScrollAxis.block, PxScrollAxis.inline, PxScrollAxis.x, PxScrollAxis.y], PxScrollAxis.block).optional(),
963
+ source: px.enum([PxScrollSource.nearest, PxScrollSource.root], PxScrollSource.nearest).optional(),
933
964
  // Free-form: the two keywords `parent`/`scroller` plus any CSS selector.
934
965
  subject: px.string().optional(),
935
966
  smoothing: px.number().optional(),
936
- pin: px.boolean().optional(),
937
- pinAlign: px.enum([PxPinAlign.top, PxPinAlign.center, PxPinAlign.bottom]).optional(),
967
+ pin: px.boolean(false).optional(),
968
+ pinAlign: px.enum([PxPinAlign.top, PxPinAlign.center, PxPinAlign.bottom], PxPinAlign.top).optional(),
938
969
  pinOffset: px.number().optional(),
939
970
  pinDistance: px.number().optional(),
940
971
  range: PxScrollRangeSchema.optional()
941
972
  }));
942
973
  var PxTimelinePinSchema = implementsInterface()(px.object({
943
- align: px.enum([PxPinAlign.top, PxPinAlign.center, PxPinAlign.bottom]).optional(),
974
+ align: px.enum([PxPinAlign.top, PxPinAlign.center, PxPinAlign.bottom], PxPinAlign.top).optional(),
944
975
  offset: px.number().optional(),
945
976
  distance: px.number().optional()
946
977
  }));
947
- var PxTimelineEngineSchema = px.enum([PxTimelineEngineSetting.auto, PxTimelineEngineSetting.native, PxTimelineEngineSetting.js]).optional();
978
+ var PxTimelineEngineSchema = px.enum([PxTimelineEngineSetting.auto, PxTimelineEngineSetting.native, PxTimelineEngineSetting.js], PxTimelineEngineSetting.auto).optional();
948
979
  var PxTimeTimelineSchema = implementsInterface()(px.object({
949
980
  type: px.literal("time").optional(),
950
981
  engine: PxTimelineEngineSchema,
951
982
  frameRate: px.number().optional(),
952
983
  // §2.8: duration is a property of the TIMELINE — how long one pass takes.
953
- duration: px.number().optional(),
984
+ duration: px.number(PX_DEFAULT_DURATION_MS).optional(),
954
985
  trigger: PxTriggerSchema.optional(),
955
- delay: px.number().optional(),
956
- iterations: px.union([px.number(), px.literal("infinite")]).optional(),
986
+ delay: px.number(0).optional(),
987
+ iterations: px.union([px.number(PX_DEFAULT_ITERATIONS), px.literal("infinite")], PX_DEFAULT_ITERATIONS).optional(),
957
988
  // `fillMode` on the wire (CSS `animation-fill-mode`; the runtime view calls it `fill`)
958
989
  // — never `fill`, which is paint everywhere else in the format.
959
- fillMode: px.enum([PxFillMode.forwards, PxFillMode.backwards, PxFillMode.both, PxFillMode.none]).optional(),
960
- direction: px.enum([PxPlaybackDirection.normal, PxPlaybackDirection.reverse, PxPlaybackDirection.alternate, PxPlaybackDirection.alternateReverse]).optional()
990
+ fillMode: px.enum([PxFillMode.forwards, PxFillMode.backwards, PxFillMode.both, PxFillMode.none], PxFillMode.forwards).optional(),
991
+ direction: px.enum([PxPlaybackDirection.normal, PxPlaybackDirection.reverse, PxPlaybackDirection.alternate, PxPlaybackDirection.alternateReverse], PxPlaybackDirection.normal).optional()
961
992
  }));
962
993
  var scrollishTimelineShape = {
963
994
  // §2.8: duration is a property of the TIMELINE — under scrubbing it is the keyframe
@@ -968,8 +999,8 @@ var PixodeskAnimator = (() => {
968
999
  iterations: px.number().optional(),
969
1000
  engine: PxTimelineEngineSchema,
970
1001
  frameRate: px.number().optional(),
971
- axis: px.enum([PxScrollAxis.block, PxScrollAxis.inline, PxScrollAxis.x, PxScrollAxis.y]).optional(),
972
- source: px.enum([PxScrollSource.nearest, PxScrollSource.root]).optional(),
1002
+ axis: px.enum([PxScrollAxis.block, PxScrollAxis.inline, PxScrollAxis.x, PxScrollAxis.y], PxScrollAxis.block).optional(),
1003
+ source: px.enum([PxScrollSource.nearest, PxScrollSource.root], PxScrollSource.nearest).optional(),
973
1004
  subject: px.string().optional(),
974
1005
  // 'parent' | 'scroller' | any CSS selector
975
1006
  smoothing: px.number().optional(),
@@ -1049,9 +1080,10 @@ var PixodeskAnimator = (() => {
1049
1080
  }));
1050
1081
  var PxMaskedByEffectSchema = implementsInterface()(px.object({
1051
1082
  source: px.string().optional(),
1052
- maskType: px.enum([PxMaskType.luminance, PxMaskType.alpha]).optional(),
1053
- maskUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
1054
- maskContentUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
1083
+ // SVG's own initial values — what a <mask> does when the attribute is not there.
1084
+ maskType: px.enum([PxMaskType.luminance, PxMaskType.alpha], PxMaskType.luminance).optional(),
1085
+ maskUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox], PxUnits.objectBoundingBox).optional(),
1086
+ maskContentUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox], PxUnits.userSpaceOnUse).optional(),
1055
1087
  x: px.number().optional(),
1056
1088
  y: px.number().optional(),
1057
1089
  width: px.number().optional(),
@@ -1063,7 +1095,7 @@ var PixodeskAnimator = (() => {
1063
1095
  var PxStrokeTrimEffectSchema = implementsInterface()(px.object({
1064
1096
  offset: PxAnimatableNumberSchema.optional(),
1065
1097
  range: PxAnimatableVec2Schema.optional(),
1066
- subPaths: px.enum([PxStrokeTrimSubPaths.separate, PxStrokeTrimSubPaths.combined]).optional()
1098
+ subPaths: px.enum([PxStrokeTrimSubPaths.separate, PxStrokeTrimSubPaths.combined], PxStrokeTrimSubPaths.separate).optional()
1067
1099
  }));
1068
1100
  var PxRetimeEffectSchema = implementsInterface()(px.object({
1069
1101
  start: px.number().optional(),
@@ -1095,17 +1127,20 @@ var PixodeskAnimator = (() => {
1095
1127
  radius: PxAnimatableNumberSchema.optional(),
1096
1128
  focal: PxAnimatableVec2Schema.optional(),
1097
1129
  stops: PxAnimatableGradientStopsSchema.optional(),
1098
- gradientUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
1099
- spreadMethod: px.enum([PxGradientSpreadMethod.pad, PxGradientSpreadMethod.reflect, PxGradientSpreadMethod.repeat]).optional(),
1130
+ // SVG's own initial values — what a gradient does when the attribute is not there.
1131
+ gradientUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox], PxUnits.objectBoundingBox).optional(),
1132
+ spreadMethod: px.enum([PxGradientSpreadMethod.pad, PxGradientSpreadMethod.reflect, PxGradientSpreadMethod.repeat], PxGradientSpreadMethod.pad).optional(),
1100
1133
  gradientTransform: px.string().optional()
1101
1134
  }));
1102
1135
  var PxStrokeGradientEffectSchema = PxFillGradientEffectSchema;
1103
1136
  var PxTextPathEffectSchema = implementsInterface()(px.object({
1104
1137
  pathData: px.string(),
1105
- pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend]).optional(),
1106
- lengthAdjust: px.enum([PxLengthAdjust.spacing, PxLengthAdjust.spacingAndGlyphs]).optional(),
1107
- method: px.enum([PxTextPathMethod.align, PxTextPathMethod.stretch]).optional(),
1108
- spacing: px.enum([PxTextPathSpacing.auto, PxTextPathSpacing.exact]).optional(),
1138
+ // `extend` is what an omitted pathOverflow means (glyphs continue along the tangent); the
1139
+ // other three are SVG's own initial values for the native <textPath> attributes.
1140
+ pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend], PxPathOverflow.extend).optional(),
1141
+ lengthAdjust: px.enum([PxLengthAdjust.spacing, PxLengthAdjust.spacingAndGlyphs], PxLengthAdjust.spacing).optional(),
1142
+ method: px.enum([PxTextPathMethod.align, PxTextPathMethod.stretch], PxTextPathMethod.align).optional(),
1143
+ spacing: px.enum([PxTextPathSpacing.auto, PxTextPathSpacing.exact], PxTextPathSpacing.exact).optional(),
1109
1144
  startOffset: PxAnimatableNumberSchema.optional(),
1110
1145
  textLength: PxAnimatableNumberSchema.optional()
1111
1146
  }));
@@ -1465,7 +1500,6 @@ var PixodeskAnimator = (() => {
1465
1500
  return Object.keys(out).length ? out : void 0;
1466
1501
  }
1467
1502
  var PX_STYLE_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
1468
- var PX_DEFAULT_DURATION_MS = 1e3;
1469
1503
  function kebabToCamelCaseWord(kebab) {
1470
1504
  return kebab.includes("-") ? kebab.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()) : kebab;
1471
1505
  }
@@ -1609,6 +1643,38 @@ var PixodeskAnimator = (() => {
1609
1643
  return cubicBezier(flipped);
1610
1644
  }
1611
1645
 
1646
+ // ../svg-animator-core/src/animation/PxStaticTransformMerge.ts
1647
+ function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
1648
+ if (!animDef) return animDef;
1649
+ const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
1650
+ if (!staticParts || !Object.keys(staticParts).length) return animDef;
1651
+ const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues(__spreadValues({}, staticParts), v) : v;
1652
+ const transformAnim = animDef[TRANSFORM_ATTR];
1653
+ if (transformAnim && typeof transformAnim === "object") {
1654
+ const anim = transformAnim;
1655
+ if (Array.isArray(anim.keyframes)) {
1656
+ const out = __spreadProps(__spreadValues({}, anim), {
1657
+ keyframes: anim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: mergeKfValue(kf.value) }))
1658
+ });
1659
+ if (out.value !== void 0) out.value = mergeKfValue(out.value);
1660
+ return __spreadProps(__spreadValues({}, animDef), { transform: out });
1661
+ }
1662
+ return animDef;
1663
+ }
1664
+ const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
1665
+ if (channels.length !== 1) return animDef;
1666
+ const ch = channels[0];
1667
+ const chAnim = animDef[ch];
1668
+ if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
1669
+ const lifted = __spreadProps(__spreadValues({}, chAnim), {
1670
+ keyframes: chAnim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: __spreadProps(__spreadValues({}, staticParts), { [ch]: kf.value }) }))
1671
+ });
1672
+ if (lifted.value !== void 0) lifted.value = __spreadProps(__spreadValues({}, staticParts), { [ch]: lifted.value });
1673
+ const rest = __spreadValues({}, animDef);
1674
+ delete rest[ch];
1675
+ return __spreadProps(__spreadValues({}, rest), { transform: lifted });
1676
+ }
1677
+
1612
1678
  // ../svg-animator-core/src/materialize/PxMotionPath.ts
1613
1679
  function getKfTranslate(kf) {
1614
1680
  const v = keyframeValue(kf);
@@ -2397,36 +2463,6 @@ var PixodeskAnimator = (() => {
2397
2463
  function generateElementId() {
2398
2464
  return "_px_el_" + ++_elementIdCounter;
2399
2465
  }
2400
- function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
2401
- if (!animDef) return animDef;
2402
- const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
2403
- if (!staticParts || !Object.keys(staticParts).length) return animDef;
2404
- const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues(__spreadValues({}, staticParts), v) : v;
2405
- const transformAnim = animDef[TRANSFORM_ATTR];
2406
- if (transformAnim && typeof transformAnim === "object") {
2407
- const anim = transformAnim;
2408
- if (Array.isArray(anim.keyframes)) {
2409
- const out = __spreadProps(__spreadValues({}, anim), {
2410
- keyframes: anim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: mergeKfValue(kf.value) }))
2411
- });
2412
- if (out.value !== void 0) out.value = mergeKfValue(out.value);
2413
- return __spreadProps(__spreadValues({}, animDef), { transform: out });
2414
- }
2415
- return animDef;
2416
- }
2417
- const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
2418
- if (channels.length !== 1) return animDef;
2419
- const ch = channels[0];
2420
- const chAnim = animDef[ch];
2421
- if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
2422
- const lifted = __spreadProps(__spreadValues({}, chAnim), {
2423
- keyframes: chAnim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: __spreadProps(__spreadValues({}, staticParts), { [ch]: kf.value }) }))
2424
- });
2425
- if (lifted.value !== void 0) lifted.value = __spreadProps(__spreadValues({}, staticParts), { [ch]: lifted.value });
2426
- const rest = __spreadValues({}, animDef);
2427
- delete rest[ch];
2428
- return __spreadProps(__spreadValues({}, rest), { transform: lifted });
2429
- }
2430
2466
  function normalizeAnimationDefinition(animDef, duration, defs, engine = PxTimelineEngine.native) {
2431
2467
  const normalized = {};
2432
2468
  for (const [propName, propAnim] of Object.entries(animDef)) {
@@ -2509,7 +2545,7 @@ var PixodeskAnimator = (() => {
2509
2545
  return { prevKf, nextKf };
2510
2546
  }
2511
2547
  function calcPropertyValue(propName, propAnim, progress) {
2512
- var _a, _b, _c, _d;
2548
+ var _a, _b, _c, _d, _e;
2513
2549
  const keyframes = propAnim.keyframes || [];
2514
2550
  if (keyframes.length === 0) return null;
2515
2551
  const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
@@ -2578,7 +2614,7 @@ var PixodeskAnimator = (() => {
2578
2614
  !!propAnim.autoOrient
2579
2615
  );
2580
2616
  partsResult.translate = [sample.translate[0], sample.translate[1]];
2581
- if (sample.rotateDeg !== void 0) partsResult.rotate = sample.rotateDeg;
2617
+ if (sample.rotateDeg !== void 0) partsResult.rotate = sample.rotateDeg + ((_e = partsResult.rotate) != null ? _e : 0);
2582
2618
  }
2583
2619
  }
2584
2620
  cssValue = composeTransformParts(partsResult, { withUnits: false });
@@ -2685,13 +2721,13 @@ var PixodeskAnimator = (() => {
2685
2721
  const bindings = normalizeBindings(doc, PxTimelineEngine.js);
2686
2722
  const _iterations = config.iterations;
2687
2723
  let iterations = 1;
2688
- if (typeof _iterations === "number") iterations = _iterations || 1;
2724
+ if (typeof _iterations === "number") iterations = _iterations || PX_DEFAULT_ITERATIONS;
2689
2725
  if (_iterations === "infinite") iterations = Infinity;
2690
2726
  if (iterations < 1) iterations = 1;
2691
2727
  const duration = +(config.duration || PX_DEFAULT_DURATION_MS);
2692
- const totalDuration = duration && iterations ? duration * (iterations === Infinity ? Infinity : iterations) : duration ? (iterations != null ? iterations : 1) * duration : 0;
2693
- const direction = config.direction || "normal";
2694
- const fill = (_a = config.fill) != null ? _a : "forwards";
2728
+ const totalDuration = duration && iterations ? duration * (iterations === Infinity ? Infinity : iterations) : duration ? (iterations != null ? iterations : PX_DEFAULT_ITERATIONS) * duration : 0;
2729
+ const direction = config.direction || PxTimeTimelineSchema.defaults.direction;
2730
+ const fill = (_a = config.fill) != null ? _a : PxTimeTimelineSchema.defaults.fillMode;
2695
2731
  const fillsForwards = fill === "forwards" || fill === "both";
2696
2732
  const fillsBackwards = fill === "backwards" || fill === "both";
2697
2733
  let timerId = null;
@@ -3582,7 +3618,7 @@ var PixodeskAnimator = (() => {
3582
3618
  let seekPosition;
3583
3619
  if (config.delay && config.delay < 0 && config.duration) {
3584
3620
  const rawSeek = -config.delay;
3585
- seekPosition = iterations === Infinity ? rawSeek % config.duration : Math.min(rawSeek, config.duration * (iterations != null ? iterations : 1));
3621
+ seekPosition = iterations === Infinity ? rawSeek % config.duration : Math.min(rawSeek, config.duration * (iterations != null ? iterations : PX_DEFAULT_ITERATIONS));
3586
3622
  }
3587
3623
  const effectOptions = {
3588
3624
  duration: config.duration,
@@ -3689,7 +3725,7 @@ var PixodeskAnimator = (() => {
3689
3725
  },
3690
3726
  "setCurrentTime": (time) => {
3691
3727
  var _a2;
3692
- const ceiling = seekCeilingMs((_a2 = config.duration) != null ? _a2 : 0, iterations != null ? iterations : 1);
3728
+ const ceiling = seekCeilingMs((_a2 = config.duration) != null ? _a2 : 0, iterations != null ? iterations : PX_DEFAULT_ITERATIONS);
3693
3729
  const seek = ceiling > 0 ? clampSeekMs(time, ceiling) : Math.max(0, time);
3694
3730
  finishNotified = false;
3695
3731
  animations.forEach((a) => {
@@ -3699,11 +3735,11 @@ var PixodeskAnimator = (() => {
3699
3735
  "getCurrentProgress": () => {
3700
3736
  var _a2;
3701
3737
  const t = api.getCurrentTime();
3702
- return t === null ? null : timeToProgress(t, (_a2 = config.duration) != null ? _a2 : 0, iterations != null ? iterations : 1);
3738
+ return t === null ? null : timeToProgress(t, (_a2 = config.duration) != null ? _a2 : 0, iterations != null ? iterations : PX_DEFAULT_ITERATIONS);
3703
3739
  },
3704
3740
  "setCurrentProgress": (progress) => {
3705
3741
  var _a2;
3706
- api.setCurrentTime(progressToTimeMs(progress, (_a2 = config.duration) != null ? _a2 : 0, iterations != null ? iterations : 1));
3742
+ api.setCurrentTime(progressToTimeMs(progress, (_a2 = config.duration) != null ? _a2 : 0, iterations != null ? iterations : PX_DEFAULT_ITERATIONS));
3707
3743
  },
3708
3744
  "destroy": () => {
3709
3745
  var _a2;