@pixodesk/svg-animator-core 1.0.43 → 1.0.45

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/dist/index.cjs CHANGED
@@ -86,9 +86,10 @@ __export(index_exports, {
86
86
  PxLoopSchema: () => PxLoopSchema,
87
87
  PxMaskType: () => PxMaskType,
88
88
  PxMaskedByEffectSchema: () => PxMaskedByEffectSchema,
89
+ PxMouseOutAction: () => PxMouseOutAction,
89
90
  PxNodeBaseSchema: () => PxNodeBaseSchema,
90
91
  PxNodeSchema: () => PxNodeSchema,
91
- PxOutAction: () => PxOutAction,
92
+ PxOffScreenAction: () => PxOffScreenAction,
92
93
  PxPathOverflow: () => PxPathOverflow,
93
94
  PxPinAlign: () => PxPinAlign,
94
95
  PxPlaybackDirection: () => PxPlaybackDirection,
@@ -102,7 +103,6 @@ __export(index_exports, {
102
103
  PxScrollRangeSchema: () => PxScrollRangeSchema,
103
104
  PxScrollSchema: () => PxScrollSchema,
104
105
  PxScrollSource: () => PxScrollSource,
105
- PxStartOn: () => PxStartOn,
106
106
  PxStrokeTrimEffectSchema: () => PxStrokeTrimEffectSchema,
107
107
  PxStrokeTrimSubPaths: () => PxStrokeTrimSubPaths,
108
108
  PxSvgNodeRootSchema: () => PxSvgNodeRootSchema,
@@ -117,6 +117,7 @@ __export(index_exports, {
117
117
  PxTransformPartsSchema: () => PxTransformPartsSchema,
118
118
  PxTransformValueSchema: () => PxTransformValueSchema,
119
119
  PxTriggerSchema: () => PxTriggerSchema,
120
+ PxTriggerStart: () => PxTriggerStart,
120
121
  PxUnits: () => PxUnits,
121
122
  PxWireStepKind: () => PxWireStepKind,
122
123
  PxWireVersionRelation: () => PxWireVersionRelation,
@@ -700,7 +701,7 @@ var px = {
700
701
  };
701
702
 
702
703
  // src/version/PxSchemaVersion.ts
703
- var PX_WIRE_SCHEMA_VERSION = "1.1";
704
+ var PX_WIRE_SCHEMA_VERSION = "1.2";
704
705
 
705
706
  // src/version/PxWireVersion.ts
706
707
  var PX_WIRE_VERSION_KEY = "version";
@@ -769,7 +770,46 @@ var PxWireStepKind = /* @__PURE__ */ ((PxWireStepKind2) => {
769
770
  return PxWireStepKind2;
770
771
  })(PxWireStepKind || {});
771
772
  var PX_WIRE_BASELINE_VERSION = "1.1";
772
- var PX_WIRE_STEPS = [];
773
+ var PX_WIRE_STEPS = [
774
+ {
775
+ from: "1.1",
776
+ to: "1.2",
777
+ reason: "The trigger block became two axes: `start` says what STARTS an animation, `offScreen` + `visibilityThreshold` + `visibilityDebounce` say whether it may RUN. `scrollIntoView` is no longer a start value \u2014 it is what `start: 'load'` behind the default gate already means \u2014 and `outAction` split into `offScreen` (scroll) and `mouseOut` (hover), because one field meant three things.",
778
+ kind: "converted" /* converted */,
779
+ up: upTriggerTwoAxes
780
+ // No `down`: 1.2 can express combinations 1.1 could not ("start on click AND pause when
781
+ // scrolled away"), so the mapping is not invertible.
782
+ }
783
+ ];
784
+ function upTriggerTwoAxes(doc) {
785
+ const animator = doc["animator"];
786
+ if (!animator || typeof animator !== "object") return;
787
+ const timeline = animator["timeline"];
788
+ const holder = timeline && typeof timeline === "object" ? timeline : animator;
789
+ const trigger = holder["trigger"];
790
+ if (!trigger || typeof trigger !== "object") return;
791
+ const t = trigger;
792
+ const startOn = t["startOn"];
793
+ const outAction = t["outAction"];
794
+ delete t["startOn"];
795
+ delete t["outAction"];
796
+ if (startOn === "scrollIntoView") {
797
+ if (outAction !== void 0) t["offScreen"] = outAction;
798
+ } else {
799
+ if (startOn === "programmatic") t["start"] = "none";
800
+ else if (startOn !== void 0) t["start"] = startOn;
801
+ if (startOn === "mouseOver" && outAction !== void 0) t["mouseOut"] = outAction;
802
+ if (t["offScreen"] === void 0) t["offScreen"] = "continue";
803
+ }
804
+ if (t["scrollIntoViewThreshold"] !== void 0) {
805
+ t["visibilityThreshold"] = t["scrollIntoViewThreshold"];
806
+ delete t["scrollIntoViewThreshold"];
807
+ }
808
+ if (t["finishAction"] !== void 0) {
809
+ t["finish"] = t["finishAction"];
810
+ delete t["finishAction"];
811
+ }
812
+ }
773
813
  function applyWireSteps(doc, cfg) {
774
814
  const from = readWireVersion(doc);
775
815
  const relation = compareWireVersion(from, cfg.target, cfg.readerReadsEditorPart);
@@ -892,14 +932,18 @@ var PxPlaybackDirection = {
892
932
  alternate: "alternate",
893
933
  alternateReverse: "alternate-reverse"
894
934
  };
895
- var PxStartOn = {
935
+ var PxTriggerStart = {
896
936
  load: "load",
897
937
  mouseOver: "mouseOver",
898
938
  click: "click",
899
- scrollIntoView: "scrollIntoView",
900
- programmatic: "programmatic"
939
+ none: "none"
940
+ };
941
+ var PxOffScreenAction = {
942
+ pause: "pause",
943
+ continue: "continue",
944
+ reset: "reset"
901
945
  };
902
- var PxOutAction = {
946
+ var PxMouseOutAction = {
903
947
  continue: "continue",
904
948
  pause: "pause",
905
949
  reset: "reset",
@@ -967,9 +1011,11 @@ function mayUseNativeScrollTimeline(engine) {
967
1011
  return engine !== PxTimelineEngineSetting.js;
968
1012
  }
969
1013
  var PX_TRIGGER_DEFAULTS = {
970
- startOn: "load",
971
- outAction: "continue",
972
- scrollIntoViewThreshold: 0
1014
+ start: "load",
1015
+ offScreen: "pause",
1016
+ mouseOut: "continue",
1017
+ visibilityThreshold: 0.5,
1018
+ visibilityDebounce: 150
973
1019
  };
974
1020
  var PxControlMode = {
975
1021
  /** No control props — the document's trigger decides, and nothing is taken over. */
@@ -1003,11 +1049,13 @@ function controlModeTakesOverTrigger(mode) {
1003
1049
  return mode !== PxControlMode.autoplay;
1004
1050
  }
1005
1051
  function resolveTrigger(trigger) {
1006
- var _a2, _b, _c;
1052
+ var _a2, _b, _c, _d, _e;
1007
1053
  return {
1008
- startOn: (_a2 = trigger == null ? void 0 : trigger.startOn) != null ? _a2 : PX_TRIGGER_DEFAULTS.startOn,
1009
- outAction: (_b = trigger == null ? void 0 : trigger.outAction) != null ? _b : PX_TRIGGER_DEFAULTS.outAction,
1010
- scrollIntoViewThreshold: (_c = trigger == null ? void 0 : trigger.scrollIntoViewThreshold) != null ? _c : PX_TRIGGER_DEFAULTS.scrollIntoViewThreshold
1054
+ start: (_a2 = trigger == null ? void 0 : trigger.start) != null ? _a2 : PX_TRIGGER_DEFAULTS.start,
1055
+ offScreen: (_b = trigger == null ? void 0 : trigger.offScreen) != null ? _b : PX_TRIGGER_DEFAULTS.offScreen,
1056
+ mouseOut: (_c = trigger == null ? void 0 : trigger.mouseOut) != null ? _c : PX_TRIGGER_DEFAULTS.mouseOut,
1057
+ visibilityThreshold: (_d = trigger == null ? void 0 : trigger.visibilityThreshold) != null ? _d : PX_TRIGGER_DEFAULTS.visibilityThreshold,
1058
+ visibilityDebounce: (_e = trigger == null ? void 0 : trigger.visibilityDebounce) != null ? _e : PX_TRIGGER_DEFAULTS.visibilityDebounce
1011
1059
  };
1012
1060
  }
1013
1061
  var PxLoopRepeatAt = {
@@ -1143,9 +1191,9 @@ function flattenAnimatorTimeline(cfg) {
1143
1191
  } else {
1144
1192
  if (timeline.duration !== void 0) flat.duration = timeline.duration;
1145
1193
  if (timeline.trigger !== void 0) {
1146
- const _b = timeline.trigger, { finishAction } = _b, restTrigger = __objRest(_b, ["finishAction"]);
1194
+ const _b = timeline.trigger, { finish } = _b, restTrigger = __objRest(_b, ["finish"]);
1147
1195
  if (Object.keys(restTrigger).length) flat.trigger = restTrigger;
1148
- if (finishAction !== void 0) flat.resetOnFinish = finishAction === "reset";
1196
+ if (finish !== void 0) flat.resetOnFinish = finish === "reset";
1149
1197
  }
1150
1198
  if (timeline.delay !== void 0) flat.delay = timeline.delay;
1151
1199
  if (timeline.iterations !== void 0) flat.iterations = timeline.iterations;
@@ -1212,7 +1260,7 @@ function nestAnimatorTimeline(cfg) {
1212
1260
  if (duration !== void 0) timeline.duration = duration;
1213
1261
  if (trigger !== void 0 || resetOnFinish) {
1214
1262
  const t = __spreadValues({}, trigger || {});
1215
- if (resetOnFinish) t.finishAction = "reset";
1263
+ if (resetOnFinish) t.finish = "reset";
1216
1264
  timeline.trigger = t;
1217
1265
  }
1218
1266
  if (delay !== void 0) timeline.delay = delay;
@@ -1315,13 +1363,15 @@ var PxElementAnimationSchema = implementsInterface()(px.union([
1315
1363
  PxAnimationDefinitionSchema
1316
1364
  ]));
1317
1365
  var PxTriggerSchema = implementsInterface()(px.object({
1318
- startOn: px.enum([PxStartOn.load, PxStartOn.mouseOver, PxStartOn.click, PxStartOn.scrollIntoView, PxStartOn.programmatic], PX_TRIGGER_DEFAULTS.startOn).optional(),
1319
- outAction: px.enum([PxOutAction.continue, PxOutAction.pause, PxOutAction.reset, PxOutAction.reverse], PX_TRIGGER_DEFAULTS.outAction).optional(),
1366
+ start: px.enum([PxTriggerStart.load, PxTriggerStart.mouseOver, PxTriggerStart.click, PxTriggerStart.none], PX_TRIGGER_DEFAULTS.start).optional(),
1367
+ offScreen: px.enum([PxOffScreenAction.pause, PxOffScreenAction.continue, PxOffScreenAction.reset], PX_TRIGGER_DEFAULTS.offScreen).optional(),
1368
+ mouseOut: px.enum([PxMouseOutAction.continue, PxMouseOutAction.pause, PxMouseOutAction.reset, PxMouseOutAction.reverse], PX_TRIGGER_DEFAULTS.mouseOut).optional(),
1320
1369
  // What happens after a NATURAL finish — `'hold'` (default: keep the end state per
1321
- // `fill`) or `'reset'` (snap back to the start state). Pairs with `outAction` ("what
1322
- // happens when the trigger condition ends"); both end-of-life knobs now read alike.
1323
- finishAction: px.enum([PxFinishAction.hold, PxFinishAction.reset]).optional(),
1324
- scrollIntoViewThreshold: px.number().optional()
1370
+ // `fill`) or `'reset'` (snap back to the start state). One of four occasion keys
1371
+ // (`start`, `offScreen`, `mouseOut`, `finish`), all named the same way.
1372
+ finish: px.enum([PxFinishAction.hold, PxFinishAction.reset]).optional(),
1373
+ visibilityThreshold: px.number().optional(),
1374
+ visibilityDebounce: px.number().optional()
1325
1375
  }));
1326
1376
  var PxGlyphSchema = implementsInterface()(px.object({
1327
1377
  width: px.number(),
@@ -2291,6 +2341,38 @@ function toDomProps(props) {
2291
2341
  return propsCopy;
2292
2342
  }
2293
2343
 
2344
+ // src/animation/PxStaticTransformMerge.ts
2345
+ function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
2346
+ if (!animDef) return animDef;
2347
+ const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
2348
+ if (!staticParts || !Object.keys(staticParts).length) return animDef;
2349
+ const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues(__spreadValues({}, staticParts), v) : v;
2350
+ const transformAnim = animDef[TRANSFORM_ATTR];
2351
+ if (transformAnim && typeof transformAnim === "object") {
2352
+ const anim = transformAnim;
2353
+ if (Array.isArray(anim.keyframes)) {
2354
+ const out = __spreadProps(__spreadValues({}, anim), {
2355
+ keyframes: anim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: mergeKfValue(kf.value) }))
2356
+ });
2357
+ if (out.value !== void 0) out.value = mergeKfValue(out.value);
2358
+ return __spreadProps(__spreadValues({}, animDef), { transform: out });
2359
+ }
2360
+ return animDef;
2361
+ }
2362
+ const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
2363
+ if (channels.length !== 1) return animDef;
2364
+ const ch = channels[0];
2365
+ const chAnim = animDef[ch];
2366
+ if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
2367
+ const lifted = __spreadProps(__spreadValues({}, chAnim), {
2368
+ keyframes: chAnim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: __spreadProps(__spreadValues({}, staticParts), { [ch]: kf.value }) }))
2369
+ });
2370
+ if (lifted.value !== void 0) lifted.value = __spreadProps(__spreadValues({}, staticParts), { [ch]: lifted.value });
2371
+ const rest = __spreadValues({}, animDef);
2372
+ delete rest[ch];
2373
+ return __spreadProps(__spreadValues({}, rest), { transform: lifted });
2374
+ }
2375
+
2294
2376
  // src/materialize/PxMotionPath.ts
2295
2377
  function getKfTranslate(kf) {
2296
2378
  const v = keyframeValue(kf);
@@ -2660,7 +2742,7 @@ function walkAndMaterialize(node, opts) {
2660
2742
  let newAnimate;
2661
2743
  const animBucket = node.animate;
2662
2744
  if (animBucket && typeof animBucket === "object" && !Array.isArray(animBucket)) {
2663
- const animDef = animBucket;
2745
+ const animDef = mergeStaticTransformIntoAnimDef(animBucket, node.transform);
2664
2746
  const transformAnim = animDef.transform;
2665
2747
  if (transformAnim && typeof transformAnim === "object" && propAnimIsMotionPath(transformAnim)) {
2666
2748
  const materialized = materializeMotionPathInPropAnim(transformAnim, opts);
@@ -3174,36 +3256,6 @@ var _elementIdCounter = 0;
3174
3256
  function generateElementId() {
3175
3257
  return "_px_el_" + ++_elementIdCounter;
3176
3258
  }
3177
- function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
3178
- if (!animDef) return animDef;
3179
- const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
3180
- if (!staticParts || !Object.keys(staticParts).length) return animDef;
3181
- const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues(__spreadValues({}, staticParts), v) : v;
3182
- const transformAnim = animDef[TRANSFORM_ATTR];
3183
- if (transformAnim && typeof transformAnim === "object") {
3184
- const anim = transformAnim;
3185
- if (Array.isArray(anim.keyframes)) {
3186
- const out = __spreadProps(__spreadValues({}, anim), {
3187
- keyframes: anim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: mergeKfValue(kf.value) }))
3188
- });
3189
- if (out.value !== void 0) out.value = mergeKfValue(out.value);
3190
- return __spreadProps(__spreadValues({}, animDef), { transform: out });
3191
- }
3192
- return animDef;
3193
- }
3194
- const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
3195
- if (channels.length !== 1) return animDef;
3196
- const ch = channels[0];
3197
- const chAnim = animDef[ch];
3198
- if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
3199
- const lifted = __spreadProps(__spreadValues({}, chAnim), {
3200
- keyframes: chAnim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: __spreadProps(__spreadValues({}, staticParts), { [ch]: kf.value }) }))
3201
- });
3202
- if (lifted.value !== void 0) lifted.value = __spreadProps(__spreadValues({}, staticParts), { [ch]: lifted.value });
3203
- const rest = __spreadValues({}, animDef);
3204
- delete rest[ch];
3205
- return __spreadProps(__spreadValues({}, rest), { transform: lifted });
3206
- }
3207
3259
  function normalizeAnimationDefinition(animDef, duration, defs, engine = PxTimelineEngine.native) {
3208
3260
  const normalized = {};
3209
3261
  for (const [propName, propAnim] of Object.entries(animDef)) {
@@ -3286,7 +3338,7 @@ function getKeyframesPair(keyframes, progress) {
3286
3338
  return { prevKf, nextKf };
3287
3339
  }
3288
3340
  function calcPropertyValue(propName, propAnim, progress) {
3289
- var _a2, _b, _c, _d;
3341
+ var _a2, _b, _c, _d, _e;
3290
3342
  const keyframes = propAnim.keyframes || [];
3291
3343
  if (keyframes.length === 0) return null;
3292
3344
  const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
@@ -3355,7 +3407,7 @@ function calcPropertyValue(propName, propAnim, progress) {
3355
3407
  !!propAnim.autoOrient
3356
3408
  );
3357
3409
  partsResult.translate = [sample.translate[0], sample.translate[1]];
3358
- if (sample.rotateDeg !== void 0) partsResult.rotate = sample.rotateDeg;
3410
+ if (sample.rotateDeg !== void 0) partsResult.rotate = sample.rotateDeg + ((_e = partsResult.rotate) != null ? _e : 0);
3359
3411
  }
3360
3412
  }
3361
3413
  cssValue = composeTransformParts(partsResult, { withUnits: false });
@@ -5838,12 +5890,17 @@ function buildOffsetPath(propAnim) {
5838
5890
  const first = keyframeValue(kfs[0]);
5839
5891
  const anchor = (first == null ? void 0 : first.origin) && first.origin.length >= 2 ? [first.origin[0], first.origin[1]] : [0, 0];
5840
5892
  const points = [];
5893
+ let keyframesCarryRotate = false;
5841
5894
  for (const kf of kfs) {
5842
5895
  const v = keyframeValue(kf);
5843
5896
  const tr = v == null ? void 0 : v.translate;
5844
5897
  if (!tr || tr.length < 2) return void 0;
5845
5898
  const parts = Object.keys(v);
5846
- if (parts.some((p) => p !== "translate" && p !== "origin")) return void 0;
5899
+ if (parts.some((p) => p !== TRANSFORM_PART.translate && p !== TRANSFORM_PART.origin && p !== TRANSFORM_PART.rotate)) return void 0;
5900
+ if ((v == null ? void 0 : v.rotate) !== void 0) {
5901
+ if (v.rotate !== 0) return void 0;
5902
+ keyframesCarryRotate = true;
5903
+ }
5847
5904
  const o = (_a2 = v == null ? void 0 : v.origin) != null ? _a2 : [0, 0];
5848
5905
  if (o[0] !== anchor[0] || o[1] !== anchor[1]) return void 0;
5849
5906
  points.push([tr[0] + anchor[0], tr[1] + anchor[1]]);
@@ -5871,7 +5928,7 @@ function buildOffsetPath(propAnim) {
5871
5928
  if (e !== void 0) out.e = e;
5872
5929
  distanceKfs.push(out);
5873
5930
  }
5874
- return { pathStr: d, distanceKfs, autoOrient: !!propAnim.autoOrient, anchor };
5931
+ return { pathStr: d, distanceKfs, autoOrient: !!propAnim.autoOrient, anchor, keyframesCarryRotate };
5875
5932
  }
5876
5933
  function materializeOffsetPathsInTree(root) {
5877
5934
  const walk = (node) => {
@@ -5893,6 +5950,7 @@ function materializeOffsetPathsInTree(root) {
5893
5950
  const t = __spreadValues({}, staticTr);
5894
5951
  delete t[TRANSFORM_PART.translate];
5895
5952
  delete t[TRANSFORM_PART.origin];
5953
+ if (built.keyframesCarryRotate) delete t[TRANSFORM_PART.rotate];
5896
5954
  newTransform = Object.keys(t).length ? t : void 0;
5897
5955
  }
5898
5956
  out = __spreadProps(__spreadValues({}, node), {
@@ -6065,6 +6123,78 @@ function walkAndMaterialize2(node, idMap, animatedIds, genId3, defsCollector, ro
6065
6123
  return changed ? __spreadProps(__spreadValues({}, node), { children: newChildren }) : node;
6066
6124
  }
6067
6125
 
6126
+ // src/materialize/PxRestPose.ts
6127
+ var TRANSFORM_CHANNEL = "transform";
6128
+ var REVERSED_DIRECTIONS = /* @__PURE__ */ new Set(["reverse", "alternate-reverse"]);
6129
+ var SCRATCH_ID_PREFIX = "__px_rest_";
6130
+ function materializeRestPosesInTree(root, engine) {
6131
+ var _a2;
6132
+ const out = deepClone(root);
6133
+ const config = getAnimatorConfig(out) || {};
6134
+ const duration = +(config.duration || PX_DEFAULT_DURATION_MS);
6135
+ const firstFrameTime = REVERSED_DIRECTIONS.has(String(config.direction)) ? duration : 0;
6136
+ const nodes = animatedNodes(out);
6137
+ if (!nodes.size) return out;
6138
+ const before = bindingsOf(out, engine);
6139
+ const added = /* @__PURE__ */ new Map();
6140
+ for (const [key, animate] of before) {
6141
+ const node = nodes.get(key);
6142
+ if (!node) continue;
6143
+ for (const channel of Object.keys(animate)) {
6144
+ if (!mayCarryRestPose(node, channel)) continue;
6145
+ const value = firstFrameValue(animate, channel, firstFrameTime);
6146
+ if (value === void 0) continue;
6147
+ node[channel] = value;
6148
+ added.set(key, [...(_a2 = added.get(key)) != null ? _a2 : [], channel]);
6149
+ }
6150
+ }
6151
+ if (added.size) {
6152
+ const after = bindingsOf(out, engine);
6153
+ for (const [key, channels] of added) {
6154
+ if (JSON.stringify(after.get(key)) === JSON.stringify(before.get(key))) continue;
6155
+ const node = nodes.get(key);
6156
+ if (node) for (const channel of channels) delete node[channel];
6157
+ }
6158
+ }
6159
+ return out;
6160
+ }
6161
+ function mayCarryRestPose(node, channel) {
6162
+ if (node[channel] !== void 0) return false;
6163
+ if (PX_TRANSFORM_FN_NAMES.has(channel)) return false;
6164
+ if (channel === TRANSFORM_CHANNEL) {
6165
+ for (const part of PX_TRANSFORM_FN_NAMES) if (node[part] !== void 0) return false;
6166
+ }
6167
+ return true;
6168
+ }
6169
+ function firstFrameValue(animate, channel, timeMs) {
6170
+ const values = Object.values(calcAnimationValues({ [channel]: animate[channel] }, timeMs));
6171
+ return values.length === 1 && values[0] !== "" ? values[0] : void 0;
6172
+ }
6173
+ function bindingsOf(tree, engine) {
6174
+ const scratch = deepClone(tree);
6175
+ const keyById = /* @__PURE__ */ new Map();
6176
+ for (const [key, node] of animatedNodes(scratch)) {
6177
+ if (node.id === void 0) node.id = SCRATCH_ID_PREFIX + key;
6178
+ keyById.set(String(node.id), key);
6179
+ }
6180
+ const out = /* @__PURE__ */ new Map();
6181
+ for (const binding of normalizeBindings(scratch, engine)) {
6182
+ const key = keyById.get(binding.id);
6183
+ if (key !== void 0) out.set(key, binding.animate);
6184
+ }
6185
+ return out;
6186
+ }
6187
+ function animatedNodes(tree) {
6188
+ const out = /* @__PURE__ */ new Map();
6189
+ let counter = 0;
6190
+ const visit = (node) => {
6191
+ if (node.animate) out.set(String(counter++), node);
6192
+ if (node.children) for (const child of node.children) visit(child);
6193
+ };
6194
+ if (tree.children) for (const child of tree.children) visit(child);
6195
+ return out;
6196
+ }
6197
+
6068
6198
  // src/materialize/PxAnimatorMaterializeAll.ts
6069
6199
  function materializeAllInTree(doc, engine, options) {
6070
6200
  var _a2, _b;
@@ -6077,6 +6207,7 @@ function materializeAllInTree(doc, engine, options) {
6077
6207
  root = materializeAnimatedUseInstances(root);
6078
6208
  root = pruneUnreferencedDefs(root);
6079
6209
  }
6210
+ root = materializeRestPosesInTree(root, engine);
6080
6211
  return root;
6081
6212
  }
6082
6213
  function pruneUnreferencedDefs(root) {
@@ -6571,16 +6702,16 @@ function foldTimelineOverride(timeline, shortcuts) {
6571
6702
  } else {
6572
6703
  base = timeline != null ? timeline : void 0;
6573
6704
  }
6574
- const { duration, delay, iterations, startOn } = shortcuts;
6575
- if (duration === void 0 && delay === void 0 && iterations === void 0 && startOn === void 0) {
6705
+ const { duration, delay, iterations, start } = shortcuts;
6706
+ if (duration === void 0 && delay === void 0 && iterations === void 0 && start === void 0) {
6576
6707
  return base === void 0 ? void 0 : { timeline: base };
6577
6708
  }
6578
6709
  const out = isPlainObject(base) ? __spreadValues({}, base) : {};
6579
6710
  if (duration !== void 0) out.duration = duration;
6580
6711
  if (delay !== void 0) out.delay = delay;
6581
6712
  if (iterations !== void 0) out.iterations = iterations;
6582
- if (startOn !== void 0) {
6583
- out.trigger = __spreadProps(__spreadValues({}, out.trigger), { startOn });
6713
+ if (start !== void 0) {
6714
+ out.trigger = __spreadProps(__spreadValues({}, out.trigger), { start });
6584
6715
  }
6585
6716
  return { timeline: out };
6586
6717
  }
@@ -6694,9 +6825,10 @@ function diagnoseDocument(doc) {
6694
6825
  PxLoopSchema,
6695
6826
  PxMaskType,
6696
6827
  PxMaskedByEffectSchema,
6828
+ PxMouseOutAction,
6697
6829
  PxNodeBaseSchema,
6698
6830
  PxNodeSchema,
6699
- PxOutAction,
6831
+ PxOffScreenAction,
6700
6832
  PxPathOverflow,
6701
6833
  PxPinAlign,
6702
6834
  PxPlaybackDirection,
@@ -6710,7 +6842,6 @@ function diagnoseDocument(doc) {
6710
6842
  PxScrollRangeSchema,
6711
6843
  PxScrollSchema,
6712
6844
  PxScrollSource,
6713
- PxStartOn,
6714
6845
  PxStrokeTrimEffectSchema,
6715
6846
  PxStrokeTrimSubPaths,
6716
6847
  PxSvgNodeRootSchema,
@@ -6725,6 +6856,7 @@ function diagnoseDocument(doc) {
6725
6856
  PxTransformPartsSchema,
6726
6857
  PxTransformValueSchema,
6727
6858
  PxTriggerSchema,
6859
+ PxTriggerStart,
6728
6860
  PxUnits,
6729
6861
  PxWireStepKind,
6730
6862
  PxWireVersionRelation,