@routevn/creator-model 1.6.2 → 1.6.4
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/package.json +1 -1
- package/src/model.js +104 -3
package/package.json
CHANGED
package/src/model.js
CHANGED
|
@@ -283,11 +283,18 @@ const UPDATE_TWEEN_PROPERTY_KEYS = [
|
|
|
283
283
|
"alpha",
|
|
284
284
|
"x",
|
|
285
285
|
"y",
|
|
286
|
+
"translateX",
|
|
287
|
+
"translateY",
|
|
286
288
|
"scaleX",
|
|
287
289
|
"scaleY",
|
|
288
290
|
"rotation",
|
|
291
|
+
"blurX",
|
|
292
|
+
"blurY",
|
|
293
|
+
"uProgress",
|
|
289
294
|
];
|
|
290
295
|
const TRANSITION_TWEEN_PROPERTY_KEYS = [
|
|
296
|
+
"x",
|
|
297
|
+
"y",
|
|
291
298
|
"translateX",
|
|
292
299
|
"translateY",
|
|
293
300
|
"alpha",
|
|
@@ -340,6 +347,7 @@ const LAYOUT_TYPE_KEYS = [
|
|
|
340
347
|
"dialogue-nvl",
|
|
341
348
|
"choice",
|
|
342
349
|
"history",
|
|
350
|
+
"input",
|
|
343
351
|
];
|
|
344
352
|
const LAYOUT_ELEMENT_TEXT_STYLE_ALIGN_KEYS = ["left", "center", "right"];
|
|
345
353
|
const LAYOUT_TEXT_REVEAL_EFFECT_KEYS = ["typewriter", "softWipe", "none"];
|
|
@@ -364,6 +372,7 @@ const LAYOUT_ELEMENT_BASE_TYPES = [
|
|
|
364
372
|
"spritesheet-animation",
|
|
365
373
|
"text",
|
|
366
374
|
"text-revealing",
|
|
375
|
+
"input",
|
|
367
376
|
"slider",
|
|
368
377
|
"text-ref-character-name",
|
|
369
378
|
"text-revealing-ref-dialogue-content",
|
|
@@ -3440,6 +3449,13 @@ const validateLayoutElementData = ({
|
|
|
3440
3449
|
"textStyleId",
|
|
3441
3450
|
"hoverTextStyleId",
|
|
3442
3451
|
"clickTextStyleId",
|
|
3452
|
+
"field",
|
|
3453
|
+
"value",
|
|
3454
|
+
"placeholder",
|
|
3455
|
+
"multiline",
|
|
3456
|
+
"disabled",
|
|
3457
|
+
"maxLength",
|
|
3458
|
+
"padding",
|
|
3443
3459
|
"conditionalOverrides",
|
|
3444
3460
|
"direction",
|
|
3445
3461
|
"gapX",
|
|
@@ -3451,6 +3467,13 @@ const validateLayoutElementData = ({
|
|
|
3451
3467
|
"rightClick",
|
|
3452
3468
|
"scrollUp",
|
|
3453
3469
|
"scrollDown",
|
|
3470
|
+
"submit",
|
|
3471
|
+
"focusEvent",
|
|
3472
|
+
"blurEvent",
|
|
3473
|
+
"selectionChange",
|
|
3474
|
+
"compositionStart",
|
|
3475
|
+
"compositionUpdate",
|
|
3476
|
+
"compositionEnd",
|
|
3454
3477
|
"anchorToBottom",
|
|
3455
3478
|
"thumbImageId",
|
|
3456
3479
|
"barImageId",
|
|
@@ -3518,6 +3541,7 @@ const validateLayoutElementData = ({
|
|
|
3518
3541
|
"step",
|
|
3519
3542
|
"paginationSize",
|
|
3520
3543
|
"opacity",
|
|
3544
|
+
"maxLength",
|
|
3521
3545
|
]) {
|
|
3522
3546
|
if (data[key] !== undefined && !isFiniteNumber(data[key])) {
|
|
3523
3547
|
return invalidFromErrorFactory(
|
|
@@ -3591,6 +3615,9 @@ const validateLayoutElementData = ({
|
|
|
3591
3615
|
"textStyleId",
|
|
3592
3616
|
"hoverTextStyleId",
|
|
3593
3617
|
"clickTextStyleId",
|
|
3618
|
+
"field",
|
|
3619
|
+
"value",
|
|
3620
|
+
"placeholder",
|
|
3594
3621
|
"containerType",
|
|
3595
3622
|
"variableId",
|
|
3596
3623
|
"fragmentLayoutId",
|
|
@@ -3645,6 +3672,18 @@ const validateLayoutElementData = ({
|
|
|
3645
3672
|
}
|
|
3646
3673
|
}
|
|
3647
3674
|
|
|
3675
|
+
if (data.type === "input") {
|
|
3676
|
+
if (
|
|
3677
|
+
(!allowPartial || data.field !== undefined) &&
|
|
3678
|
+
!isNonEmptyString(data.field)
|
|
3679
|
+
) {
|
|
3680
|
+
return invalidFromErrorFactory(
|
|
3681
|
+
errorFactory,
|
|
3682
|
+
`${path}.field must be a non-empty string`,
|
|
3683
|
+
);
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3648
3687
|
if (data.conditionalOverrides !== undefined) {
|
|
3649
3688
|
if (!Array.isArray(data.conditionalOverrides)) {
|
|
3650
3689
|
return invalidFromErrorFactory(
|
|
@@ -3946,6 +3985,27 @@ const validateLayoutElementData = ({
|
|
|
3946
3985
|
}
|
|
3947
3986
|
}
|
|
3948
3987
|
|
|
3988
|
+
for (const key of [
|
|
3989
|
+
"submit",
|
|
3990
|
+
"focusEvent",
|
|
3991
|
+
"blurEvent",
|
|
3992
|
+
"selectionChange",
|
|
3993
|
+
"compositionStart",
|
|
3994
|
+
"compositionUpdate",
|
|
3995
|
+
"compositionEnd",
|
|
3996
|
+
]) {
|
|
3997
|
+
if (data[key] !== undefined) {
|
|
3998
|
+
const result = validateLayoutElementInteraction({
|
|
3999
|
+
interaction: data[key],
|
|
4000
|
+
path: `${path}.${key}`,
|
|
4001
|
+
errorFactory,
|
|
4002
|
+
});
|
|
4003
|
+
if (result?.valid === false) {
|
|
4004
|
+
return result;
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
}
|
|
4008
|
+
|
|
3949
4009
|
if (
|
|
3950
4010
|
data.anchorToBottom !== undefined &&
|
|
3951
4011
|
typeof data.anchorToBottom !== "boolean"
|
|
@@ -3956,6 +4016,33 @@ const validateLayoutElementData = ({
|
|
|
3956
4016
|
);
|
|
3957
4017
|
}
|
|
3958
4018
|
|
|
4019
|
+
for (const key of ["multiline", "disabled"]) {
|
|
4020
|
+
if (data[key] !== undefined && typeof data[key] !== "boolean") {
|
|
4021
|
+
return invalidFromErrorFactory(
|
|
4022
|
+
errorFactory,
|
|
4023
|
+
`${path}.${key} must be a boolean when provided`,
|
|
4024
|
+
);
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
|
|
4028
|
+
if (data.maxLength !== undefined && data.maxLength < 0) {
|
|
4029
|
+
return invalidFromErrorFactory(
|
|
4030
|
+
errorFactory,
|
|
4031
|
+
`${path}.maxLength must be a finite number greater than or equal to 0 when provided`,
|
|
4032
|
+
);
|
|
4033
|
+
}
|
|
4034
|
+
|
|
4035
|
+
if (
|
|
4036
|
+
data.padding !== undefined &&
|
|
4037
|
+
!isFiniteNumber(data.padding) &&
|
|
4038
|
+
!isPlainObject(data.padding)
|
|
4039
|
+
) {
|
|
4040
|
+
return invalidFromErrorFactory(
|
|
4041
|
+
errorFactory,
|
|
4042
|
+
`${path}.padding must be a finite number or object when provided`,
|
|
4043
|
+
);
|
|
4044
|
+
}
|
|
4045
|
+
|
|
3959
4046
|
if (data.textStyle !== undefined) {
|
|
3960
4047
|
{
|
|
3961
4048
|
const result = validateLayoutElementTextStyle({
|
|
@@ -4037,6 +4124,13 @@ const validateLayoutElementItems = ({ items, path, errorFactory }) => {
|
|
|
4037
4124
|
"textStyleId",
|
|
4038
4125
|
"hoverTextStyleId",
|
|
4039
4126
|
"clickTextStyleId",
|
|
4127
|
+
"field",
|
|
4128
|
+
"value",
|
|
4129
|
+
"placeholder",
|
|
4130
|
+
"multiline",
|
|
4131
|
+
"disabled",
|
|
4132
|
+
"maxLength",
|
|
4133
|
+
"padding",
|
|
4040
4134
|
"conditionalOverrides",
|
|
4041
4135
|
"direction",
|
|
4042
4136
|
"gapX",
|
|
@@ -4048,6 +4142,13 @@ const validateLayoutElementItems = ({ items, path, errorFactory }) => {
|
|
|
4048
4142
|
"rightClick",
|
|
4049
4143
|
"scrollUp",
|
|
4050
4144
|
"scrollDown",
|
|
4145
|
+
"submit",
|
|
4146
|
+
"focusEvent",
|
|
4147
|
+
"blurEvent",
|
|
4148
|
+
"selectionChange",
|
|
4149
|
+
"compositionStart",
|
|
4150
|
+
"compositionUpdate",
|
|
4151
|
+
"compositionEnd",
|
|
4051
4152
|
"anchorToBottom",
|
|
4052
4153
|
"thumbImageId",
|
|
4053
4154
|
"barImageId",
|
|
@@ -5250,7 +5351,7 @@ const validateLayoutItems = ({ items, path, errorFactory }) => {
|
|
|
5250
5351
|
if (!LAYOUT_TYPE_KEYS.includes(item.layoutType)) {
|
|
5251
5352
|
return invalidFromErrorFactory(
|
|
5252
5353
|
errorFactory,
|
|
5253
|
-
`${itemPath}.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', or '
|
|
5354
|
+
`${itemPath}.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', 'history', or 'input'`,
|
|
5254
5355
|
);
|
|
5255
5356
|
}
|
|
5256
5357
|
|
|
@@ -10769,7 +10870,7 @@ const validateLayoutCreateData = ({ data, errorFactory }) => {
|
|
|
10769
10870
|
if (!LAYOUT_TYPE_KEYS.includes(data.layoutType)) {
|
|
10770
10871
|
return invalidFromErrorFactory(
|
|
10771
10872
|
errorFactory,
|
|
10772
|
-
"payload.data.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', or '
|
|
10873
|
+
"payload.data.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', 'history', or 'input'",
|
|
10773
10874
|
);
|
|
10774
10875
|
}
|
|
10775
10876
|
|
|
@@ -10885,7 +10986,7 @@ const validateLayoutUpdateData = ({ data, errorFactory }) => {
|
|
|
10885
10986
|
) {
|
|
10886
10987
|
return invalidFromErrorFactory(
|
|
10887
10988
|
errorFactory,
|
|
10888
|
-
"payload.data.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', or '
|
|
10989
|
+
"payload.data.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', 'history', or 'input' when provided",
|
|
10889
10990
|
);
|
|
10890
10991
|
}
|
|
10891
10992
|
|