@routevn/creator-model 1.11.0 → 1.12.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/model.js +17 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routevn/creator-model",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/model.js CHANGED
@@ -403,7 +403,7 @@ const SAVE_LOAD_DATE_FORMATS = new Set([
403
403
  "DD MMM YYYY",
404
404
  "YYYY年MM月DD日",
405
405
  ]);
406
- export const SCHEMA_VERSION = 11;
406
+ export const SCHEMA_VERSION = 12;
407
407
  const LAYOUT_CONTAINER_ELEMENT_TYPES = [
408
408
  "folder",
409
409
  "container",
@@ -1680,7 +1680,7 @@ const validateAnimationKeyframes = ({ keyframes, path, errorFactory }) => {
1680
1680
  {
1681
1681
  const result = validateAllowedKeys({
1682
1682
  value: keyframe,
1683
- allowedKeys: ["value", "duration", "easing", "relative"],
1683
+ allowedKeys: ["value", "duration", "delay", "easing", "relative"],
1684
1684
  path: keyframePath,
1685
1685
  errorFactory,
1686
1686
  });
@@ -1717,6 +1717,16 @@ const validateAnimationKeyframes = ({ keyframes, path, errorFactory }) => {
1717
1717
  );
1718
1718
  }
1719
1719
 
1720
+ if (
1721
+ keyframe.delay !== undefined &&
1722
+ (!isFiniteNumber(keyframe.delay) || keyframe.delay < 0)
1723
+ ) {
1724
+ return invalidFromErrorFactory(
1725
+ errorFactory,
1726
+ `${keyframePath}.delay must be a finite number >= 0 when provided`,
1727
+ );
1728
+ }
1729
+
1720
1730
  if (
1721
1731
  keyframe.easing !== undefined &&
1722
1732
  !ANIMATION_EASING_KEYS.includes(keyframe.easing)
@@ -3380,10 +3390,7 @@ const validateComputedExpression = ({
3380
3390
  );
3381
3391
  }
3382
3392
 
3383
- if (
3384
- typeof expression === "string" ||
3385
- typeof expression === "boolean"
3386
- ) {
3393
+ if (typeof expression === "string" || typeof expression === "boolean") {
3387
3394
  return validComputedResult(typeof expression);
3388
3395
  }
3389
3396
 
@@ -3538,10 +3545,7 @@ const validateComputedCondition = ({
3538
3545
  );
3539
3546
  }
3540
3547
 
3541
- if (
3542
- typeof condition === "string" ||
3543
- typeof condition === "boolean"
3544
- ) {
3548
+ if (typeof condition === "string" || typeof condition === "boolean") {
3545
3549
  return validComputedResult(typeof condition);
3546
3550
  }
3547
3551
 
@@ -3845,18 +3849,11 @@ const validateVariableComputedConfig = ({
3845
3849
  });
3846
3850
  };
3847
3851
 
3848
- const validateComputedVariableGraph = ({
3849
- items,
3850
- path,
3851
- errorFactory,
3852
- }) => {
3852
+ const validateComputedVariableGraph = ({ items, path, errorFactory }) => {
3853
3853
  const dependencyGraph = new Map();
3854
3854
 
3855
3855
  for (const [variableId, variable] of Object.entries(items)) {
3856
- if (
3857
- variable?.type !== "variable" ||
3858
- !Object.hasOwn(variable, "computed")
3859
- ) {
3856
+ if (variable?.type !== "variable" || !Object.hasOwn(variable, "computed")) {
3860
3857
  continue;
3861
3858
  }
3862
3859
 
@@ -3908,9 +3905,7 @@ const validateComputedVariableGraph = ({
3908
3905
  const cycleStartIndex = activeIndexes.get(dependencyId);
3909
3906
  if (cycleStartIndex !== undefined) {
3910
3907
  const cycle = [
3911
- ...frames
3912
- .slice(cycleStartIndex)
3913
- .map(({ variableId }) => variableId),
3908
+ ...frames.slice(cycleStartIndex).map(({ variableId }) => variableId),
3914
3909
  dependencyId,
3915
3910
  ].join(" -> ");
3916
3911
  return invalidFromErrorFactory(