@routevn/creator-model 1.1.1 → 1.1.2

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 (3) hide show
  1. package/README.md +2 -0
  2. package/package.json +1 -1
  3. package/src/model.js +13 -13
package/README.md CHANGED
@@ -85,6 +85,8 @@ Design rules:
85
85
  this package
86
86
  - `project` may start empty; fields like `resolution` are optional until the
87
87
  model starts owning them
88
+ - random ids across RouteVN should use `nanoid` with the RouteVN base58 variant;
89
+ deterministic derived tokens such as partition hashes are a separate case
88
90
 
89
91
  ## File Structure
90
92
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routevn/creator-model",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/model.js CHANGED
@@ -54,7 +54,7 @@ const normalizeStateCollections = (state) => {
54
54
  const isString = (value) => typeof value === "string";
55
55
  const isHexColor = (value) =>
56
56
  typeof value === "string" && /^#[0-9a-fA-F]{6}$/.test(value);
57
- const LIVE_TWEEN_PROPERTY_KEYS = [
57
+ const UPDATE_TWEEN_PROPERTY_KEYS = [
58
58
  "alpha",
59
59
  "x",
60
60
  "y",
@@ -62,7 +62,7 @@ const LIVE_TWEEN_PROPERTY_KEYS = [
62
62
  "scaleY",
63
63
  "rotation",
64
64
  ];
65
- const REPLACE_TWEEN_PROPERTY_KEYS = [
65
+ const TRANSITION_TWEEN_PROPERTY_KEYS = [
66
66
  "translateX",
67
67
  "translateY",
68
68
  "alpha",
@@ -1325,14 +1325,14 @@ const validateAnimationDefinition = ({ animation, path, errorFactory }) => {
1325
1325
  );
1326
1326
  }
1327
1327
 
1328
- if (animation.type !== "live" && animation.type !== "replace") {
1328
+ if (animation.type !== "update" && animation.type !== "transition") {
1329
1329
  return invalidFromErrorFactory(
1330
1330
  errorFactory,
1331
- `${path}.type must be 'live' or 'replace'`,
1331
+ `${path}.type must be 'update' or 'transition'`,
1332
1332
  );
1333
1333
  }
1334
1334
 
1335
- if (animation.type === "live") {
1335
+ if (animation.type === "update") {
1336
1336
  if (
1337
1337
  animation.prev !== undefined ||
1338
1338
  animation.next !== undefined ||
@@ -1340,23 +1340,23 @@ const validateAnimationDefinition = ({ animation, path, errorFactory }) => {
1340
1340
  ) {
1341
1341
  return invalidFromErrorFactory(
1342
1342
  errorFactory,
1343
- `${path}.live animations cannot define prev, next, or mask`,
1343
+ `${path}.update animations cannot define prev, next, or mask`,
1344
1344
  );
1345
1345
  }
1346
1346
 
1347
1347
  if (animation.tween === undefined) {
1348
1348
  return invalidFromErrorFactory(
1349
1349
  errorFactory,
1350
- `${path}.tween is required when ${path}.type is 'live'`,
1350
+ `${path}.tween is required when ${path}.type is 'update'`,
1351
1351
  );
1352
1352
  }
1353
1353
 
1354
1354
  {
1355
1355
  const result = validateTweenDefinition({
1356
1356
  tween: animation.tween,
1357
- allowedProperties: LIVE_TWEEN_PROPERTY_KEYS,
1357
+ allowedProperties: UPDATE_TWEEN_PROPERTY_KEYS,
1358
1358
  path: `${path}.tween`,
1359
- unsupportedMessage: "is not a supported live tween property",
1359
+ unsupportedMessage: "is not a supported update tween property",
1360
1360
  errorFactory,
1361
1361
  });
1362
1362
  if (result?.valid === false) {
@@ -1370,7 +1370,7 @@ const validateAnimationDefinition = ({ animation, path, errorFactory }) => {
1370
1370
  if (animation.tween !== undefined) {
1371
1371
  return invalidFromErrorFactory(
1372
1372
  errorFactory,
1373
- `${path}.replace animations cannot define tween`,
1373
+ `${path}.transition animations cannot define tween`,
1374
1374
  );
1375
1375
  }
1376
1376
 
@@ -1381,7 +1381,7 @@ const validateAnimationDefinition = ({ animation, path, errorFactory }) => {
1381
1381
  ) {
1382
1382
  return invalidFromErrorFactory(
1383
1383
  errorFactory,
1384
- `${path} must define at least one of prev, next, or mask when ${path}.type is 'replace'`,
1384
+ `${path} must define at least one of prev, next, or mask when ${path}.type is 'transition'`,
1385
1385
  );
1386
1386
  }
1387
1387
 
@@ -1405,9 +1405,9 @@ const validateAnimationDefinition = ({ animation, path, errorFactory }) => {
1405
1405
  {
1406
1406
  const result = validateTweenDefinition({
1407
1407
  tween: animation[side].tween,
1408
- allowedProperties: REPLACE_TWEEN_PROPERTY_KEYS,
1408
+ allowedProperties: TRANSITION_TWEEN_PROPERTY_KEYS,
1409
1409
  path: `${path}.${side}.tween`,
1410
- unsupportedMessage: "is not a supported replace tween property",
1410
+ unsupportedMessage: "is not a supported transition tween property",
1411
1411
  errorFactory,
1412
1412
  });
1413
1413
  if (result?.valid === false) {