@drincs/pixi-vn-json 1.6.2 → 1.7.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 (140) hide show
  1. package/dist/importer.cjs +1 -0
  2. package/dist/importer.d.cts +613 -0
  3. package/dist/importer.d.ts +613 -0
  4. package/dist/importer.mjs +1 -0
  5. package/dist/index.cjs +2 -2
  6. package/dist/index.d.cts +608 -19
  7. package/dist/index.d.ts +608 -19
  8. package/dist/index.mjs +3 -0
  9. package/dist/unifier.cjs +1 -0
  10. package/dist/unifier.d.cts +594 -0
  11. package/dist/unifier.d.ts +594 -0
  12. package/dist/unifier.mjs +1 -0
  13. package/package.json +26 -3
  14. package/dist/PixiVNJsonConditionalStatements-S3pFEkW9.d.cts +0 -249
  15. package/dist/PixiVNJsonConditionalStatements-S3pFEkW9.d.ts +0 -249
  16. package/dist/classes/LabelJson.cjs +0 -3
  17. package/dist/classes/LabelJson.d.cts +0 -44
  18. package/dist/classes/LabelJson.d.ts +0 -44
  19. package/dist/classes/LabelJson.js +0 -3
  20. package/dist/classes/index.cjs +0 -3
  21. package/dist/classes/index.d.cts +0 -12
  22. package/dist/classes/index.d.ts +0 -12
  23. package/dist/classes/index.js +0 -3
  24. package/dist/constants.cjs +0 -1
  25. package/dist/constants.d.cts +0 -3
  26. package/dist/constants.d.ts +0 -3
  27. package/dist/constants.js +0 -1
  28. package/dist/functions/assets.cjs +0 -3
  29. package/dist/functions/assets.d.cts +0 -14
  30. package/dist/functions/assets.d.ts +0 -14
  31. package/dist/functions/assets.js +0 -3
  32. package/dist/functions/importer.cjs +0 -3
  33. package/dist/functions/importer.d.cts +0 -24
  34. package/dist/functions/importer.d.ts +0 -24
  35. package/dist/functions/importer.js +0 -3
  36. package/dist/functions/index.cjs +0 -3
  37. package/dist/functions/index.d.cts +0 -16
  38. package/dist/functions/index.d.ts +0 -16
  39. package/dist/functions/index.js +0 -3
  40. package/dist/functions/operation-utility.cjs +0 -3
  41. package/dist/functions/operation-utility.d.cts +0 -16
  42. package/dist/functions/operation-utility.d.ts +0 -16
  43. package/dist/functions/operation-utility.js +0 -3
  44. package/dist/functions/utility.cjs +0 -3
  45. package/dist/functions/utility.d.cts +0 -17
  46. package/dist/functions/utility.d.ts +0 -17
  47. package/dist/functions/utility.js +0 -3
  48. package/dist/index.js +0 -3
  49. package/dist/interface/PixiVNJson.cjs +0 -1
  50. package/dist/interface/PixiVNJson.d.cts +0 -30
  51. package/dist/interface/PixiVNJson.d.ts +0 -30
  52. package/dist/interface/PixiVNJson.js +0 -0
  53. package/dist/interface/PixiVNJsonArithmeticOperations.cjs +0 -1
  54. package/dist/interface/PixiVNJsonArithmeticOperations.d.cts +0 -2
  55. package/dist/interface/PixiVNJsonArithmeticOperations.d.ts +0 -2
  56. package/dist/interface/PixiVNJsonArithmeticOperations.js +0 -0
  57. package/dist/interface/PixiVNJsonCanvas.cjs +0 -1
  58. package/dist/interface/PixiVNJsonCanvas.d.cts +0 -71
  59. package/dist/interface/PixiVNJsonCanvas.d.ts +0 -71
  60. package/dist/interface/PixiVNJsonCanvas.js +0 -0
  61. package/dist/interface/PixiVNJsonCanvasAnimate.cjs +0 -1
  62. package/dist/interface/PixiVNJsonCanvasAnimate.d.cts +0 -19
  63. package/dist/interface/PixiVNJsonCanvasAnimate.d.ts +0 -19
  64. package/dist/interface/PixiVNJsonCanvasAnimate.js +0 -0
  65. package/dist/interface/PixiVNJsonCanvasEffect.cjs +0 -1
  66. package/dist/interface/PixiVNJsonCanvasEffect.d.cts +0 -11
  67. package/dist/interface/PixiVNJsonCanvasEffect.d.ts +0 -11
  68. package/dist/interface/PixiVNJsonCanvasEffect.js +0 -0
  69. package/dist/interface/PixiVNJsonCanvasTicker.cjs +0 -1
  70. package/dist/interface/PixiVNJsonCanvasTicker.d.cts +0 -48
  71. package/dist/interface/PixiVNJsonCanvasTicker.d.ts +0 -48
  72. package/dist/interface/PixiVNJsonCanvasTicker.js +0 -0
  73. package/dist/interface/PixiVNJsonConditionalResultToCombine.cjs +0 -1
  74. package/dist/interface/PixiVNJsonConditionalResultToCombine.d.cts +0 -2
  75. package/dist/interface/PixiVNJsonConditionalResultToCombine.d.ts +0 -2
  76. package/dist/interface/PixiVNJsonConditionalResultToCombine.js +0 -0
  77. package/dist/interface/PixiVNJsonConditionalStatements.cjs +0 -1
  78. package/dist/interface/PixiVNJsonConditionalStatements.d.cts +0 -2
  79. package/dist/interface/PixiVNJsonConditionalStatements.d.ts +0 -2
  80. package/dist/interface/PixiVNJsonConditionalStatements.js +0 -0
  81. package/dist/interface/PixiVNJsonConditions.cjs +0 -1
  82. package/dist/interface/PixiVNJsonConditions.d.cts +0 -2
  83. package/dist/interface/PixiVNJsonConditions.d.ts +0 -2
  84. package/dist/interface/PixiVNJsonConditions.js +0 -0
  85. package/dist/interface/PixiVNJsonIfElse.cjs +0 -1
  86. package/dist/interface/PixiVNJsonIfElse.d.cts +0 -2
  87. package/dist/interface/PixiVNJsonIfElse.d.ts +0 -2
  88. package/dist/interface/PixiVNJsonIfElse.js +0 -0
  89. package/dist/interface/PixiVNJsonInput.cjs +0 -1
  90. package/dist/interface/PixiVNJsonInput.d.cts +0 -9
  91. package/dist/interface/PixiVNJsonInput.d.ts +0 -9
  92. package/dist/interface/PixiVNJsonInput.js +0 -0
  93. package/dist/interface/PixiVNJsonLabelStep.cjs +0 -1
  94. package/dist/interface/PixiVNJsonLabelStep.d.cts +0 -114
  95. package/dist/interface/PixiVNJsonLabelStep.d.ts +0 -114
  96. package/dist/interface/PixiVNJsonLabelStep.js +0 -0
  97. package/dist/interface/PixiVNJsonLabels.cjs +0 -1
  98. package/dist/interface/PixiVNJsonLabels.d.cts +0 -20
  99. package/dist/interface/PixiVNJsonLabels.d.ts +0 -20
  100. package/dist/interface/PixiVNJsonLabels.js +0 -0
  101. package/dist/interface/PixiVNJsonMediaTransiotions.cjs +0 -1
  102. package/dist/interface/PixiVNJsonMediaTransiotions.d.cts +0 -30
  103. package/dist/interface/PixiVNJsonMediaTransiotions.d.ts +0 -30
  104. package/dist/interface/PixiVNJsonMediaTransiotions.js +0 -0
  105. package/dist/interface/PixiVNJsonOperations.cjs +0 -1
  106. package/dist/interface/PixiVNJsonOperations.d.cts +0 -18
  107. package/dist/interface/PixiVNJsonOperations.d.ts +0 -18
  108. package/dist/interface/PixiVNJsonOperations.js +0 -0
  109. package/dist/interface/PixiVNJsonSound.cjs +0 -1
  110. package/dist/interface/PixiVNJsonSound.d.cts +0 -27
  111. package/dist/interface/PixiVNJsonSound.d.ts +0 -27
  112. package/dist/interface/PixiVNJsonSound.js +0 -0
  113. package/dist/interface/PixiVNJsonStepSwitch.cjs +0 -1
  114. package/dist/interface/PixiVNJsonStepSwitch.d.cts +0 -2
  115. package/dist/interface/PixiVNJsonStepSwitch.d.ts +0 -2
  116. package/dist/interface/PixiVNJsonStepSwitch.js +0 -0
  117. package/dist/interface/PixiVNJsonUnionCondition.cjs +0 -1
  118. package/dist/interface/PixiVNJsonUnionCondition.d.cts +0 -2
  119. package/dist/interface/PixiVNJsonUnionCondition.d.ts +0 -2
  120. package/dist/interface/PixiVNJsonUnionCondition.js +0 -0
  121. package/dist/interface/PixiVNJsonValue.cjs +0 -1
  122. package/dist/interface/PixiVNJsonValue.d.cts +0 -2
  123. package/dist/interface/PixiVNJsonValue.d.ts +0 -2
  124. package/dist/interface/PixiVNJsonValue.js +0 -0
  125. package/dist/interface/index.cjs +0 -1
  126. package/dist/interface/index.d.cts +0 -13
  127. package/dist/interface/index.d.ts +0 -13
  128. package/dist/interface/index.js +0 -0
  129. package/dist/managers/TranslateManager.cjs +0 -1
  130. package/dist/managers/TranslateManager.d.cts +0 -42
  131. package/dist/managers/TranslateManager.d.ts +0 -42
  132. package/dist/managers/TranslateManager.js +0 -1
  133. package/dist/managers/index.cjs +0 -1
  134. package/dist/managers/index.d.cts +0 -16
  135. package/dist/managers/index.d.ts +0 -16
  136. package/dist/managers/index.js +0 -1
  137. package/dist/utils/log-utility.cjs +0 -1
  138. package/dist/utils/log-utility.d.cts +0 -8
  139. package/dist/utils/log-utility.d.ts +0 -8
  140. package/dist/utils/log-utility.js +0 -1
package/dist/index.d.ts CHANGED
@@ -1,19 +1,608 @@
1
- export { default as LabelJson } from './classes/LabelJson.js';
2
- export { PIXIVNJSON_PARAM_ID } from './constants.js';
3
- export { importPixiVNJson } from './functions/importer.js';
4
- export { getLogichValue, setStorageJson } from './functions/utility.js';
5
- export { default as PixiVNJson } from './interface/PixiVNJson.js';
6
- export { P as PixiVNJsonArithmeticOperations, a as PixiVNJsonArithmeticOperationsArithmetic, b as PixiVNJsonArithmeticOperationsArithmeticSingle, l as PixiVNJsonChoiceGet, e as PixiVNJsonComparation, c as PixiVNJsonConditionalResultToCombine, d as PixiVNJsonConditionalStatements, f as PixiVNJsonConditions, g as PixiVNJsonIfElse, m as PixiVNJsonLabelGet, n as PixiVNJsonLogicGet, o as PixiVNJsonParamGet, h as PixiVNJsonStepSwitch, j as PixiVNJsonStepSwitchElementType, i as PixiVNJsonStepSwitchElementsType, p as PixiVNJsonStorageGet, k as PixiVNJsonUnionCondition, q as PixiVNJsonValueGet, r as PixiVNJsonValueSet } from './PixiVNJsonConditionalStatements-S3pFEkW9.js';
7
- export { default as PixiVNJsonCanvas, PixiVNJsonCanvasEdit, PixiVNJsonCanvasRemove, PixiVNJsonCanvasShow } from './interface/PixiVNJsonCanvas.js';
8
- export { PixiVNJsonAnimateBase, PixiVNJsonAnimateSequence, default as PixiVNJsonCanvasAnimate } from './interface/PixiVNJsonCanvasAnimate.js';
9
- export { default as PixiVNJsonCanvasEffect } from './interface/PixiVNJsonCanvasEffect.js';
10
- export { default as PixiVNJsonCanvasTicker } from './interface/PixiVNJsonCanvasTicker.js';
11
- export { default as PixiVNJsonInput } from './interface/PixiVNJsonInput.js';
12
- export { default as PixiVNJsonLabels } from './interface/PixiVNJsonLabels.js';
13
- export { PixiVNJsonChoice, PixiVNJsonChoices, PixiVNJsonDialog, PixiVNJsonDialogText, default as PixiVNJsonLabelStep, PixiVNJsonLabelToOpen } from './interface/PixiVNJsonLabelStep.js';
14
- export { default as PixiVNJsonMediaTransiotions } from './interface/PixiVNJsonMediaTransiotions.js';
15
- export { default as PixiVNJsonConditionalOperation, PixiVNJsonOperation, PixiVNJsonOperationString } from './interface/PixiVNJsonOperations.js';
16
- export { default as PixiVNJsonSound } from './interface/PixiVNJsonSound.js';
17
- export { translator } from './managers/index.js';
18
- import '@drincs/pixi-vn';
19
- import './managers/TranslateManager.js';
1
+ export * from '@drincs/pixi-vn-json/importer';
2
+ export * from '@drincs/pixi-vn-json/unifier';
3
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
4
+
5
+ declare const PIXIVNJSON_PARAM_ID = "___param___";
6
+
7
+ type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
8
+ type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
9
+ interface PixiVNJsonRandom<Then> {
10
+ type: "stepswitch";
11
+ choiceType: "random";
12
+ elements: PixiVNJsonStepSwitchElementsType<Then>;
13
+ }
14
+ interface PixiVNJsonSequentialRandom<Then> {
15
+ type: "stepswitch";
16
+ choiceType: "sequentialrandom";
17
+ elements: PixiVNJsonStepSwitchElementsType<Then>;
18
+ /**
19
+ * When the sequential ends, what should be the value? If undefined, it will return undefined.
20
+ * If "lastItem", it will return the last item in the array.
21
+ */
22
+ end: undefined | "lastItem";
23
+ /**
24
+ * The subId is used for manager nested switches
25
+ */
26
+ nestedId?: string;
27
+ }
28
+ interface PixiVNJsonSequential<Then> {
29
+ type: "stepswitch";
30
+ choiceType: "sequential";
31
+ elements: PixiVNJsonStepSwitchElementsType<Then>;
32
+ /**
33
+ * When the sequential ends, what should be the value? If undefined, it will return undefined.
34
+ * If "lastItem", it will return the last item in the array.
35
+ */
36
+ end: undefined | "lastItem";
37
+ /**
38
+ * The subId is used for manager nested switches
39
+ */
40
+ nestedId?: string;
41
+ }
42
+ interface PixiVNJsonLoop<Then> {
43
+ type: "stepswitch";
44
+ choiceType: "loop";
45
+ elements: PixiVNJsonStepSwitchElementsType<Then>;
46
+ nestedId?: string;
47
+ }
48
+ type PixiVNJsonStepSwitch<Then> = PixiVNJsonRandom<Then> | PixiVNJsonSequential<Then> | PixiVNJsonLoop<Then> | PixiVNJsonSequentialRandom<Then>;
49
+
50
+ /**
51
+ * This element is used in case a {@link PixiVNJsonConditionalStatements} gives a result that must be combined with another calculated through other {@link PixiVNJsonConditionalStatements}.
52
+ * in case this possibility is not managed, it will be taken into consideration {@link PixiVNJsonConditionalResultToCombine.firstItem}
53
+ */
54
+ type PixiVNJsonConditionalResultToCombine<T> = {
55
+ type: "resulttocombine";
56
+ /**
57
+ * This variable is interpreted differently by Pixi'VN depending on the value
58
+ */
59
+ combine: "cross" | "union";
60
+ firstItem?: T;
61
+ secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
62
+ };
63
+
64
+ type PixiVNJsonStorageGet = {
65
+ type: "value";
66
+ storageOperationType: "get";
67
+ /**
68
+ * Key of the storage
69
+ */
70
+ key: string;
71
+ /**
72
+ * Type of the storage, if it is a flagStorage or a storage.
73
+ * If it is a flagStorage, the value will be get with the function {@link getFlag}
74
+ */
75
+ storageType: "storage" | "flagStorage" | "tempstorage";
76
+ };
77
+ type PixiVNJsonParamGet = {
78
+ type: "value";
79
+ storageOperationType: "get";
80
+ /**
81
+ * Key of the storage
82
+ */
83
+ key: number;
84
+ storageType: "params";
85
+ };
86
+ type PixiVNJsonLabelGet = {
87
+ type: "value";
88
+ storageOperationType: "get";
89
+ /**
90
+ * Id of the label
91
+ */
92
+ label: string;
93
+ /**
94
+ * If it is a label, the value will be get with the function {@link narration.getTimesLabelOpened}
95
+ */
96
+ storageType: "label";
97
+ };
98
+ type PixiVNJsonChoiceGet = {
99
+ type: "value";
100
+ storageOperationType: "get";
101
+ /**
102
+ * index of the choice
103
+ */
104
+ index: number;
105
+ /**
106
+ * If it is a choice, the value will be get with the function {@link narration.getTimesChoiceOpened}
107
+ */
108
+ storageType: "choice";
109
+ };
110
+ type PixiVNJsonLogicGet = {
111
+ type: "value";
112
+ storageOperationType: "get";
113
+ operation: PixiVNJsonArithmeticOperations | PixiVNJsonConditions;
114
+ storageType: "logic";
115
+ };
116
+ type PixiVNJsonValueGet = PixiVNJsonStorageGet | PixiVNJsonParamGet | PixiVNJsonLabelGet | PixiVNJsonChoiceGet | PixiVNJsonLogicGet;
117
+ type PixiVNJsonOnlyStorageSet = {
118
+ type: "value";
119
+ storageOperationType: "set";
120
+ /**
121
+ * Key of the storage
122
+ */
123
+ key: string;
124
+ /**
125
+ * Value to be set in the storage
126
+ */
127
+ value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
128
+ /**
129
+ * Type of the storage, if it is a flagStorage or a storage.
130
+ */
131
+ storageType: "storage" | "tempstorage";
132
+ };
133
+ type PixiVNJsonOnlyParamSet = {
134
+ type: "value";
135
+ storageOperationType: "set";
136
+ /**
137
+ * Key of the storage
138
+ */
139
+ key: number;
140
+ /**
141
+ * Value to be set in the storage
142
+ */
143
+ value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
144
+ storageType: "params";
145
+ };
146
+ type PixiVNJsonFlagSet = {
147
+ type: "value";
148
+ storageOperationType: "set";
149
+ /**
150
+ * Key of the storage
151
+ */
152
+ key: string;
153
+ /**
154
+ * Value to be set in the storage
155
+ */
156
+ value: boolean;
157
+ /**
158
+ * Type of the storage, if it is a flagStorage or a storage.
159
+ */
160
+ storageType: "flagStorage";
161
+ };
162
+ type PixiVNJsonValueSet = PixiVNJsonOnlyStorageSet | PixiVNJsonFlagSet | PixiVNJsonOnlyParamSet;
163
+
164
+ interface PixiVNJsonArithmeticOperationsArithmetic {
165
+ type: "arithmetic";
166
+ /**
167
+ * Left value of the arithmetic operation
168
+ */
169
+ leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
170
+ /**
171
+ * Right value of the arithmetic operation
172
+ */
173
+ rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
174
+ /**
175
+ * Operator of the arithmetic operation
176
+ */
177
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
178
+ }
179
+ interface PixiVNJsonArithmeticOperationsArithmeticSingle {
180
+ type: "arithmeticsingle";
181
+ /**
182
+ * Left value of the arithmetic operation
183
+ */
184
+ leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
185
+ /**
186
+ * Operator of the arithmetic operation
187
+ */
188
+ operator: "INT" | "FLOOR" | "FLOAT";
189
+ }
190
+ /**
191
+ * Arithmetic operations for the PixiVNJson
192
+ */
193
+ type PixiVNJsonArithmeticOperations = PixiVNJsonArithmeticOperationsArithmeticSingle | PixiVNJsonArithmeticOperationsArithmetic;
194
+
195
+ type PixiVNJsonUnionConditionAndOr = {
196
+ type: "union";
197
+ conditions: PixiVNJsonConditions[];
198
+ unionType: "and" | "or";
199
+ };
200
+ type PixiVNJsonUnionConditionNot = {
201
+ type: "union";
202
+ condition: PixiVNJsonConditions;
203
+ unionType: "not";
204
+ };
205
+ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionConditionNot;
206
+
207
+ /**
208
+ * Comparation for PixiVNJson.
209
+ * In this comparation, the values to be converted to string and compared.
210
+ */
211
+ type PixiVNJsonComparation = {
212
+ type: "compare";
213
+ /**
214
+ * Left value of the comparation
215
+ */
216
+ leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
217
+ /**
218
+ * Right value of the comparation
219
+ */
220
+ rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
221
+ /**
222
+ * Operator of the comparation
223
+ */
224
+ operator: "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
225
+ };
226
+ type PixiVNJsonValueCondition = StorageElementType | PixiVNJsonValueGet;
227
+ /**
228
+ * Conditions for PixiVNJson
229
+ */
230
+ type PixiVNJsonConditions = PixiVNJsonComparation | PixiVNJsonValueCondition | PixiVNJsonUnionCondition | PixiVNJsonArithmeticOperations;
231
+
232
+ /**
233
+ * If-Else condition for PixiVNJson
234
+ */
235
+ interface PixiVNJsonIfElse<Then> {
236
+ type: "ifelse";
237
+ /**
238
+ * The list of conditions to be checked.
239
+ */
240
+ condition: PixiVNJsonConditions;
241
+ /**
242
+ * The value to be returned if the condition is true.
243
+ */
244
+ then: Then | PixiVNJsonIfElse<Then>;
245
+ /**
246
+ * The value to be returned if the condition is false.
247
+ */
248
+ else?: Then | PixiVNJsonIfElse<Then>;
249
+ }
250
+
251
+ type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
252
+
253
+ type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
254
+ type: "animate";
255
+ alias: string | string[];
256
+ keyframes: KeyframesType<T>;
257
+ options?: AnimationOptions;
258
+ priority?: UPDATE_PRIORITY;
259
+ };
260
+ type PixiVNJsonAnimateSequence<T extends CanvasBaseInterface<any>> = {
261
+ type: "animate-sequence";
262
+ alias: string;
263
+ sequence: (ObjectSegment<T> | ObjectSegmentWithTransition<T>)[];
264
+ options?: SequenceOptions;
265
+ priority?: UPDATE_PRIORITY;
266
+ };
267
+ type PixiVNJsonCanvasAnimate<T extends CanvasBaseInterface<any> = ImageSprite> = PixiVNJsonAnimateBase<T> | PixiVNJsonAnimateSequence<T>;
268
+
269
+ type PixiVNJsonEffectShake = {
270
+ type: "shake";
271
+ alias: string;
272
+ props: ShakeEffectProps;
273
+ priority?: UPDATE_PRIORITY;
274
+ };
275
+ type PixiVNJsonCanvasEffect = PixiVNJsonEffectShake;
276
+
277
+ /**
278
+ * @deprecated
279
+ */
280
+ type PixiVNJsonTickerFade = {
281
+ type: "fade";
282
+ alias: string | string[];
283
+ duration?: number;
284
+ props: FadeAlphaTickerProps;
285
+ priority?: UPDATE_PRIORITY;
286
+ };
287
+ /**
288
+ * @deprecated
289
+ */
290
+ type PixiVNJsonTickerMove = {
291
+ type: "move";
292
+ alias: string | string[];
293
+ duration?: number;
294
+ props: MoveTickerProps;
295
+ priority?: UPDATE_PRIORITY;
296
+ };
297
+ /**
298
+ * @deprecated
299
+ */
300
+ type PixiVNJsonTickerRotate = {
301
+ type: "rotate";
302
+ alias: string | string[];
303
+ duration?: number;
304
+ props: RotateTickerProps;
305
+ priority?: UPDATE_PRIORITY;
306
+ };
307
+ /**
308
+ * @deprecated
309
+ */
310
+ type PixiVNJsonTickerZoom = {
311
+ type: "zoom";
312
+ alias: string | string[];
313
+ duration?: number;
314
+ props: ZoomTickerProps;
315
+ priority?: UPDATE_PRIORITY;
316
+ };
317
+ /**
318
+ * @deprecated
319
+ */
320
+ type PixiVNJsonCanvasTicker = PixiVNJsonTickerFade | PixiVNJsonTickerMove | PixiVNJsonTickerRotate | PixiVNJsonTickerZoom;
321
+
322
+ type DissolveTransition = {
323
+ type: "dissolve";
324
+ props?: ShowWithDissolveTransitionProps;
325
+ priority?: UPDATE_PRIORITY;
326
+ };
327
+ type FadeTransition = {
328
+ type: "fade";
329
+ props?: ShowWithFadeTransitionProps;
330
+ priority?: UPDATE_PRIORITY;
331
+ };
332
+ type MoveInOutTransition = {
333
+ type: "movein" | "moveout";
334
+ props?: MoveInOutProps;
335
+ priority?: UPDATE_PRIORITY;
336
+ };
337
+ type ZoomInOutTransition = {
338
+ type: "zoomin" | "zoomout";
339
+ props?: ZoomInOutProps;
340
+ priority?: UPDATE_PRIORITY;
341
+ };
342
+ type PushInOutTransition = {
343
+ type: "pushin" | "pushout";
344
+ props?: PushInOutProps;
345
+ priority?: UPDATE_PRIORITY;
346
+ };
347
+ type PixiVNJsonMediaTransiotions = DissolveTransition | FadeTransition | MoveInOutTransition | ZoomInOutTransition | PushInOutTransition;
348
+
349
+ type PixiVNJsonCanvasImageVideoShow = {
350
+ type: "image" | "video";
351
+ operationType: "show";
352
+ alias: string;
353
+ /**
354
+ * The url of the image or video.
355
+ * If the url is not provided, the url will be set to the alias.
356
+ */
357
+ url?: string;
358
+ props?: ImageSpriteOptions;
359
+ transition?: PixiVNJsonMediaTransiotions;
360
+ };
361
+ type PixiVNJsonCanvasImageContainerShow = {
362
+ type: "imagecontainer";
363
+ operationType: "show";
364
+ alias: string;
365
+ urls: string[];
366
+ props?: ImageContainerOptions<ImageSprite>;
367
+ transition?: PixiVNJsonMediaTransiotions;
368
+ };
369
+ type PixiVNJsonImageEdit = {
370
+ type: "image";
371
+ operationType: "edit";
372
+ alias: string;
373
+ props?: Partial<ImageSpriteMemory>;
374
+ };
375
+ type PixiVNJsonVideoEdit = {
376
+ type: "video";
377
+ operationType: "edit";
378
+ alias: string;
379
+ props?: Partial<VideoSpriteMemory>;
380
+ };
381
+ type PixiVNJsonImageContainerEdit = {
382
+ type: "imagecontainer";
383
+ operationType: "edit";
384
+ alias: string;
385
+ props?: Partial<ImageContainerMemory>;
386
+ };
387
+ type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
388
+ type: "canvaselement";
389
+ operationType: "edit";
390
+ alias: string;
391
+ props?: Partial<T>;
392
+ };
393
+ type PixiVNJsonCanvasRemove = {
394
+ type: "image" | "video" | "imagecontainer" | "canvaselement";
395
+ operationType: "remove";
396
+ alias: string;
397
+ transition?: PixiVNJsonMediaTransiotions;
398
+ };
399
+ type PixiVNJsonVideoPauseResume = {
400
+ type: "video";
401
+ operationType: "pause" | "resume";
402
+ alias: string;
403
+ };
404
+ type PixiVNJsonAssetsLoad = {
405
+ type: "assets" | "bundle";
406
+ operationType: "load" | "lazyload";
407
+ aliases: string[];
408
+ };
409
+ type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow;
410
+ type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory>;
411
+ type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasTicker | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
412
+
413
+ type PixiVNJsonInputRequest = {
414
+ type: "input";
415
+ operationType: "request";
416
+ valueType?: string;
417
+ defaultValue?: any;
418
+ };
419
+ type PixiVNJsonInput = PixiVNJsonInputRequest;
420
+
421
+ type PixiVNJsonSoundPlay = {
422
+ type: "sound";
423
+ operationType: "play";
424
+ alias: string;
425
+ props?: SoundPlayOptions;
426
+ };
427
+ type PixiVNJsonSoundRemove = {
428
+ type: "sound";
429
+ operationType: "stop";
430
+ alias: string;
431
+ };
432
+ type PixiVNJsonSoundPauseResume = {
433
+ type: "sound";
434
+ operationType: "pause" | "resume";
435
+ alias: string;
436
+ };
437
+ type PixiVNJsonSoundVolume = {
438
+ type: "sound";
439
+ operationType: "volume";
440
+ alias: string;
441
+ value: number;
442
+ };
443
+ type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundVolume;
444
+
445
+ type PixiVNJsonOperationString = {
446
+ type: "operationtoconvert";
447
+ values: (string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet>)[];
448
+ };
449
+ type PixiVNJsonOperation = PixiVNJsonValueSet | PixiVNJsonCanvas | PixiVNJsonSound | PixiVNJsonInput;
450
+ type PixiVNJsonConditionalOperation = PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString;
451
+
452
+ type PixiVNJsonChoice = {
453
+ /**
454
+ * The text to be displayed.
455
+ */
456
+ text: PixiVNJsonDialogText;
457
+ /**
458
+ * The label id to be opened.
459
+ */
460
+ label: string;
461
+ /**
462
+ * Label opening mode
463
+ */
464
+ type: LabelRunModeType;
465
+ /**
466
+ * The properties to be passed to the label.
467
+ */
468
+ props: StorageObjectType;
469
+ /**
470
+ * If this is true, the choice can only be made once.
471
+ */
472
+ oneTime?: boolean;
473
+ /**
474
+ * If this is true, the choice can see only if there are no other choices. For example, all choices are one-time choices and they are already selected.
475
+ */
476
+ onlyHaveNoChoice?: boolean;
477
+ /**
478
+ * If this is true and if is the only choice, it will be automatically selected, and call/jump to the label.
479
+ */
480
+ autoSelect?: boolean;
481
+ };
482
+ type PixiVNJsonChoices = (PixiVNJsonChoice | PixiVNJsonConditionalStatements<PixiVNJsonChoice>)[];
483
+ type PixiVNJsonDialogText = string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet | string[]> | (string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet | string[]>)[];
484
+ type PixiVNJsonDialog<Text = string> = {
485
+ /**
486
+ * The character id that will speak.
487
+ */
488
+ character: string;
489
+ /**
490
+ * The text to be displayed.
491
+ */
492
+ text: Text;
493
+ } | Text;
494
+ type PixiVNJsonLabelToOpen<T extends {} = {}> = {
495
+ /**
496
+ * The id of the label to open.
497
+ */
498
+ label: string | PixiVNJsonValueGet;
499
+ /**
500
+ * Label opening mode
501
+ */
502
+ type: LabelRunModeType;
503
+ /**
504
+ * The properties to be passed to the label. if you don't want to pass a object, but a list of parameters, you can use the {@link PixiVNJsonLabelToOpen.params} attribute.
505
+ */
506
+ props?: StepLabelPropsType<T>;
507
+ /**
508
+ * **It is not recommended to use it, use it only if necessary**. The parameters to be passed to the label. If you want to pass an object, use the {@link PixiVNJsonLabelToOpen.props} attribute.
509
+ * "params" attribute will be stored in the temp storage with the key: {@link PIXIVNJSON_PARAM_ID} + ({@link narration.openedLabels.length} - 1).
510
+ */
511
+ params?: any[];
512
+ };
513
+ /**
514
+ * Steps of a label.
515
+ * Order of operations:
516
+ * 1. run all {@link PixiVNJsonLabelStep.operations}
517
+ * 2. set {@link PixiVNJsonLabelStep.choices}, {@link PixiVNJsonLabelStep.dialogue}, {@link PixiVNJsonLabelStep.glueEnabled}
518
+ * 3. open {@link PixiVNJsonLabelStep.labelToOpen}
519
+ * 4. go to next step if {@link PixiVNJsonLabelStep.goNextStep} is true
520
+ * 5. end the label if {@link PixiVNJsonLabelStep.end} is "label_end"
521
+ */
522
+ type PixiVNJsonLabelStep = {
523
+ operations?: PixiVNJsonConditionalOperation[];
524
+ /**
525
+ * Variable used to display a choice menu.
526
+ */
527
+ choices?: PixiVNJsonChoices | PixiVNJsonConditionalStatements<PixiVNJsonChoices>;
528
+ /**
529
+ * Variable used to display a dialog.
530
+ */
531
+ dialogue?: PixiVNJsonDialog<PixiVNJsonDialogText> | PixiVNJsonConditionalStatements<PixiVNJsonDialog<PixiVNJsonDialogText>>;
532
+ /**
533
+ * This variable is used to add the next dialog text into the current dialog memory.
534
+ * This value was added to introduce Ink Glue functionality https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#glue
535
+ */
536
+ glueEnabled?: boolean | PixiVNJsonConditionalStatements<boolean>;
537
+ /**
538
+ * Variable used to open a label.
539
+ */
540
+ labelToOpen?: PixiVNJsonLabelToOpen | PixiVNJsonConditionalStatements<PixiVNJsonLabelToOpen> | (PixiVNJsonLabelToOpen | PixiVNJsonConditionalStatements<PixiVNJsonLabelToOpen>)[];
541
+ /**
542
+ * If is true, the next step will be executed automatically.
543
+ */
544
+ goNextStep?: boolean | PixiVNJsonConditionalStatements<boolean>;
545
+ /**
546
+ * Variable used to end some elements of the narrative.
547
+ * - game_end: ends the game
548
+ * - label_end: ends the label
549
+ */
550
+ end?: "game_end" | "label_end" | PixiVNJsonConditionalStatements<"game_end" | "label_end">;
551
+ conditionalStep?: PixiVNJsonConditionalStatements<PixiVNJsonLabelStep | PixiVNJsonLabelStep[]>;
552
+ };
553
+
554
+ /**
555
+ * Collection of labels to be used in the narrative.
556
+ */
557
+ type PixiVNJsonLabels = {
558
+ [labelId: string]: PixiVNJsonLabelStep[];
559
+ };
560
+
561
+ /**
562
+ * PixiVNJson It can be defined as a programming language to write a narrative written in json.
563
+ */
564
+ interface PixiVNJson {
565
+ /**
566
+ * The operations to be executed before the narrative starts.
567
+ * For the set storage: They will be set only if there are no variables with the same key already.
568
+ * For the det tempstorage: if there are variables with the same key already, they will be overwritten.
569
+ */
570
+ initialOperations?: PixiVNJsonConditionalOperation[];
571
+ /**
572
+ * The labels to be used in the narrative. They will be added to the system
573
+ */
574
+ labels?: PixiVNJsonLabels;
575
+ }
576
+
577
+ declare class TranslatorManager {
578
+ private static _beforeToTranslate;
579
+ private static _translate;
580
+ private static _afterToTranslate;
581
+ static t<T = string | string[]>(key: T): T;
582
+ static set beforeToTranslate(value: (key: string) => string);
583
+ static set translate(value: (key: string) => string);
584
+ static get translate(): (key: string) => string;
585
+ static set afterToTranslate(value: (key: string) => string);
586
+ private static addKey;
587
+ private static getConditionalsThenElse;
588
+ /**
589
+ * Generates a JSON translation object from the provided labels.
590
+ * @param labels The labels to translate.
591
+ * @param json The JSON object to populate with translations.
592
+ * @param options Options for translation, including default value handling.
593
+ * @returns The populated JSON object with translations.
594
+ */
595
+ static generateJsonTranslation(labels: PixiVNJsonLabelStep[], json?: object, options?: {
596
+ /**
597
+ * Default value to use when a key is not found.
598
+ * - "empty_string": Use an empty string as the default value.
599
+ * - "copy_key": Use the key itself as the default value.
600
+ * @default "copy_key"
601
+ */
602
+ defaultValue?: "empty_string" | "copy_key";
603
+ }): object;
604
+ }
605
+
606
+ declare const translator: typeof TranslatorManager;
607
+
608
+ export { PIXIVNJSON_PARAM_ID, type PixiVNJson, type PixiVNJsonAnimateBase, type PixiVNJsonAnimateSequence, type PixiVNJsonArithmeticOperations, type PixiVNJsonArithmeticOperationsArithmetic, type PixiVNJsonArithmeticOperationsArithmeticSingle, type PixiVNJsonCanvas, type PixiVNJsonCanvasAnimate, type PixiVNJsonCanvasEdit, type PixiVNJsonCanvasEffect, type PixiVNJsonCanvasRemove, type PixiVNJsonCanvasShow, type PixiVNJsonCanvasTicker, type PixiVNJsonChoice, type PixiVNJsonChoiceGet, type PixiVNJsonChoices, type PixiVNJsonComparation, type PixiVNJsonConditionalOperation, type PixiVNJsonConditionalResultToCombine, type PixiVNJsonConditionalStatements, type PixiVNJsonConditions, type PixiVNJsonDialog, type PixiVNJsonDialogText, type PixiVNJsonIfElse, type PixiVNJsonInput, type PixiVNJsonLabelGet, type PixiVNJsonLabelStep, type PixiVNJsonLabelToOpen, type PixiVNJsonLabels, type PixiVNJsonLogicGet, type PixiVNJsonMediaTransiotions, type PixiVNJsonOperation, type PixiVNJsonOperationString, type PixiVNJsonParamGet, type PixiVNJsonSound, type PixiVNJsonStepSwitch, type PixiVNJsonStepSwitchElementType, type PixiVNJsonStepSwitchElementsType, type PixiVNJsonStorageGet, type PixiVNJsonUnionCondition, type PixiVNJsonValueGet, type PixiVNJsonValueSet, translator };
package/dist/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ export*from'@drincs/pixi-vn-json/importer';import {JsonUnifier}from'@drincs/pixi-vn-json/unifier';export*from'@drincs/pixi-vn-json/unifier';import {createExportableElement,storage,SYSTEM_RESERVED_STORAGE_KEYS,narration,canvas,VideoSprite,showVideo,ZoomTicker,RotateTicker,MoveTicker,FadeAlphaTicker,sound,Assets,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,NarrationManagerStatic,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn';var H=Object.defineProperty;var B=(e,i,t)=>i in e?H(e,i,{enumerable:true,configurable:true,writable:true,value:t}):e[i]=t;var w=(e,i,t)=>B(e,typeof i!="symbol"?i+"":i,t);var J="___param___";var n=class n{static t(i){return Array.isArray(i)?i.map(t=>n.translate(`${t}`)):n.translate(`${i}`)}static set beforeToTranslate(i){n._beforeToTranslate=i;}static set translate(i){n._translate=i;}static get translate(){return i=>{let t=i;return n._beforeToTranslate&&(t=n._beforeToTranslate(t)),t=n._translate(t),n._afterToTranslate&&(t=n._afterToTranslate(t)),t}}static set afterToTranslate(i){n._afterToTranslate=i;}static addKey(i,t,r){let a=r.defaultValue||"empty_string";typeof t=="string"&&(t=[t]),Array.isArray(t)&&t.forEach(s=>{i[s]===void 0&&(a==="empty_string"?i[s]="":a==="copy_key"&&(n._beforeToTranslate?i[s]=n._beforeToTranslate(s):i[s]=s));});}static getConditionalsThenElse(i,t=[]){if(typeof i=="object"&&i&&"type"in i)if(i.type==="ifelse")i.then&&n.getConditionalsThenElse(i.then,t),i.else&&n.getConditionalsThenElse(i.else,t);else if(i.type==="stepswitch"){if(i.elements)if(Array.isArray(i.elements))i.elements.forEach(r=>{n.getConditionalsThenElse(r,t);});else if(i.elements.type==="ifelse"){let r=[];n.getConditionalsThenElse(i.elements,r),r.forEach(a=>{t.push(...a);});}else if(i.elements.type==="stepswitch"){let r=[];n.getConditionalsThenElse(i.elements,r),r.forEach(a=>{t.push(...a);});}else n.getConditionalsThenElse(i.elements,t);}else i.type==="resulttocombine"?(i.firstItem&&n.getConditionalsThenElse(i.firstItem,t),i.secondConditionalItem&&i.secondConditionalItem.forEach(r=>{n.getConditionalsThenElse(r,t);})):t.push(i);else i&&t.push(i);return t}static generateJsonTranslation(i,t={},r={}){let{defaultValue:a="copy_key"}=r;return i.forEach(s=>{if(s.choices){let l=[];Array.isArray(s.choices)?l=[s.choices]:l=n.getConditionalsThenElse(s.choices),l.forEach(c=>c.forEach(u=>{if("type"in u){let p=[];u.type==="ifelse"||u.type==="stepswitch"?n.getConditionalsThenElse(u,p):p=[u],p.map(g=>n.getConditionalsThenElse(g.text)).forEach(g=>{Array.isArray(g)&&g.forEach(T=>{Array.isArray(T)?T.forEach(V=>{typeof V=="string"?n.addKey(t,V,{defaultValue:a}):n.getConditionalsThenElse(V).forEach(N=>{Array.isArray(N)?N.forEach(b=>{typeof b=="string"&&n.addKey(t,b,{defaultValue:a});}):typeof N=="string"&&n.addKey(t,N,{defaultValue:a});});}):typeof T=="string"&&n.addKey(t,T,{defaultValue:a});});});}}));}if(s.dialogue){let l=[];Array.isArray(s.dialogue)?l=[s.dialogue]:l=n.getConditionalsThenElse(s.dialogue),l.forEach(c=>{if(typeof c=="string")n.addKey(t,c,{defaultValue:a});else if("text"in c){let u=n.getConditionalsThenElse(c.text);typeof u=="string"&&(u=[u]),u.forEach(p=>{typeof p=="string"?n.addKey(t,p,{defaultValue:a}):n.getConditionalsThenElse(p).forEach(g=>{typeof g=="string"?n.addKey(t,g,{defaultValue:a}):Array.isArray(g)&&g.forEach(T=>{typeof T=="string"?n.addKey(t,T,{defaultValue:a}):n.getConditionalsThenElse(T).forEach(V=>{typeof V=="string"&&n.addKey(t,V,{defaultValue:a});});});});});}});}s.conditionalStep&&n.getConditionalsThenElse(s.conditionalStep).forEach(c=>{Array.isArray(c)?n.generateJsonTranslation(c,t,r):n.generateJsonTranslation([c],t,r);});}),t}};w(n,"_beforeToTranslate"),w(n,"_translate",i=>i),w(n,"_afterToTranslate");var C=n;var S=C;async function L(e){let i=JsonUnifier.getLogichValue(e);if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await Assets.load(i.aliases);break;case "lazyload":Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await Assets.loadBundle(i.aliases);break;case "lazyload":Assets.backgroundLoadBundle(i.aliases);break}break}}var d;(a=>(a.log=(s,...l)=>console.log(`[Pixi\u2019VN Json] ${s}`,...l),a.warn=(s,...l)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...l),a.error=(s,...l)=>console.error(`[Pixi\u2019VN Json] ${s}`,...l),a.info=(s,...l)=>console.info(`[Pixi\u2019VN Json] ${s}`,...l)))(d||(d={}));async function R(e,i,t){switch(t.type){case "fade":await showWithFade(i.alias,e,t.props,t.priority);break;case "dissolve":await showWithDissolve(i.alias,e,t.props,t.priority);break;case "movein":case "moveout":await moveIn(i.alias,e,t.props,t.priority);break;case "zoomin":case "zoomout":await zoomIn(i.alias,e,t.props,t.priority);break;case "pushin":case "pushout":await pushIn(i.alias,e,t.props,t.priority);break}}function O(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function G(e){switch(e.operationType){case "show":if(e.transition){let t=new ImageSprite(e.props,e.url||e.alias);await R(t,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):d.error(`Image with alias ${e.alias} not found.`);break;case "remove":O(e);break}}async function M(e){switch(e.operationType){case "show":if(e.transition){let a=new VideoSprite(e.props,e.url||e.alias);await R(a,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):d.error(`Video with alias ${e.alias} not found.`);break;case "remove":O(e);break;case "pause":let t=canvas.find(e.alias);t?t.paused=true:d.error(`Video with alias ${e.alias} not found.`);break;case "resume":let r=canvas.find(e.alias);r?r.paused=false:d.error(`Video with alias ${e.alias} not found.`);break}}async function $(e){switch(e.operationType){case "show":if(e.transition){let t=new ImageContainer(e.props,e.urls);await R(t,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):d.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":O(e);break}}async function F(e){switch(e.operationType){case "edit":try{let i=canvas.find(e.alias);i?e.props&&(i.memory={...i.memory,...e.props}):d.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){d.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":O(e);break}}function _(e){switch(e.type){case "fade":let i=new FadeAlphaTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,i);break;case "move":let t=new MoveTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,t);break;case "rotate":let r=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,r);break;case "zoom":let a=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,a);break}}async function K(e){switch(e.type){case "shake":await shakeEffect(e.alias,e.props,e.priority);break}}function U(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function z(e){switch(e.operationType){case "request":narration.requestInput({type:e.valueType},e.defaultValue);break}}function X(e){switch(e.operationType){case "play":sound.play(e.alias,e.props);break;case "stop":sound.stop(e.alias);break;case "pause":sound.pause(e.alias);break;case "resume":sound.resume(e.alias);break;case "volume":sound.volume(e.alias,e.value);break}}function W(e){let i=o(e.value),t;switch(i&&typeof i=="object"&&"type"in i?t=o(i):t=i,e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.setVariable(e.key,t);break;case "tempstorage":storage.setTempVariable(e.key,t);break;case "params":let r=storage.getVariable(`${J}${narration.openedLabels.length-1}`)||[];r&&r.length-1>=e.key&&(r[e.key]=t),storage.setTempVariable(`${J}${narration.openedLabels.length-1}`,r);break}}function o(e){let i=Ee(e);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return be(i);case "arithmetic":case "arithmeticsingle":return Ne(i);case "compare":case "valueCondition":case "union":return Pe(i)}return i}function Ne(e){let i=o(e.leftValue);switch(e.type){case "arithmetic":let t=o(e.rightValue);switch(e.operator){case "*":return i*t;case "/":return i/t;case "+":return i+t;case "-":return i-t;case "%":return i%t;case "POW":return Math.pow(i,t);case "RANDOM":return narration.getRandomNumber(i,t)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(i);case "FLOOR":return Math.floor(i);case "FLOAT":return parseFloat(i)}break}}function be(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.getVariable(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return o(e.operation);case "params":let i=storage.getVariable(`${J}${narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];d.warn("getValue params not found");return}return e}function Pe(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let i=o(e.leftValue),t=o(e.rightValue);switch(e.operator){case "==":return i===t;case "!=":return i!==t;case "<":return i<t;case "<=":return i<=t;case ">":return i>t;case ">=":return i>=t;case "CONTAINS":return i.toString().includes(t.toString())}break;case "valueCondition":return !!o(e.value);case "union":return Je(e)}return !!e}function Je(e){if(e.unionType==="not")return !o(e.condition);let i=e.unionType==="and";for(let t=0;t<e.conditions.length;t++)if(i=o(e.conditions[t])||false,e.unionType==="and"){if(!i)return false}else if(i)return true;return i}function Ce(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function Ee(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return we(e);case "ifelse":return o(e.condition)?o(e.then):o(e.else);case "stepswitch":let t=o(e.elements)||[];if(t.length===0){d.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let r=Ce(0,t.length-1);return o(t[r]);case "loop":let a=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return a>t.length-1&&(a=a%t.length),o(t[a]);case "sequential":let s,l=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(s=o(t[t.length-1])),l>t.length-1?s:o(t[l]);case "sequentialrandom":let c=NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:true});if(c==null&&e.end=="lastItem"){let u=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!u||!u?.usedRandomNumbers){d.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=u.usedRandomNumbers[`0-${t.length-1}`];return o(t[p[p.length-1]])}if(c==null){d.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return o(t[c])}}return e}function v(e){if(e.conditionalStep){let i=createExportableElement(o(e.conditionalStep));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let t={...e,conditionalStep:void 0,...i};return v(t)}else storage.getFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);}return e}function we(e){let i=e.firstItem,t=[];e.secondConditionalItem?.forEach(a=>{if(Array.isArray(a))a.forEach(s=>{let l=o(s);t.push(l);});else {let s=o(a);t.push(s);}});let r=i?[i,...t]:t;if(r.length===0){d.warn("combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return S.t(r);if(typeof r[0]=="object"){let a=r,s,l=a.map((f,x)=>{f=v(f);let m=o(f.dialogue)||"";return x===0?(s=o(f.glueEnabled)||false,m):(typeof m=="object"&&"text"in m&&(m=m.character+": "+m.text),s===false&&(m=`
2
+
3
+ `+m),s=o(f.glueEnabled)||false,m)}),c=o(l[0]),u=typeof c=="object"&&"character"in c?c.character:void 0,p=l.flatMap(f=>{let x;f&&typeof f=="object"&&"text"in f?x=f.text:x=f;let m;return Array.isArray(x)?m=x.map(q=>{let Y=o(q);return S.t(`${Y}`)}):m=o(x)||"",S.t(m)}),A=a.find(f=>f.end),g=a.find(f=>f.choices),T=false,V=false;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),T=a[a.length-1].glueEnabled,V=a.reverse().find(f=>!(f.operations&&(!f.dialogue||!f.choices)))?.goNextStep);let N=a.find(f=>f.labelToOpen),b=[];return a.forEach(f=>{f.operations&&b.forEach(x=>{b.push(x);});}),{dialogue:u?{character:u,text:p}:p,end:A?.end,choices:g?.choices,glueEnabled:T,goNextStep:V,labelToOpen:N?.labelToOpen,operations:b}}}JsonUnifier.init({animateOperation:U,canvasElementOperation:F,effectOperation:K,imageContainerOperation:$,imageOperation:G,inputOperation:z,loadAssets:L,soundOperation:X,tickerOperation:_,videoOperation:M,setStorageValue:W,getLogichValue:o,getConditionalStep:v});export{J as PIXIVNJSON_PARAM_ID,S as translator};
@@ -0,0 +1 @@
1
+ 'use strict';var p=Object.defineProperty;var m=(o,i,s)=>i in o?p(o,i,{enumerable:true,configurable:true,writable:true,value:s}):o[i]=s;var n=(o,i,s)=>m(o,typeof i!="symbol"?i+"":i,s);var t;(d=>(d.log=(a,...r)=>console.log(`[Pixi\u2019VN Json] ${a}`,...r),d.warn=(a,...r)=>console.warn(`[Pixi\u2019VN Json] ${a}`,...r),d.error=(a,...r)=>console.error(`[Pixi\u2019VN Json] ${a}`,...r),d.info=(a,...r)=>console.info(`[Pixi\u2019VN Json] ${a}`,...r)))(t||(t={}));var e=class{static init(i){this._loadAssets=i.loadAssets,this._soundOperation=i.soundOperation,this._imageOperation=i.imageOperation,this._videoOperation=i.videoOperation,this._imageContainerOperation=i.imageContainerOperation,this._canvasElementOperation=i.canvasElementOperation,this._setStorageValue=i.setStorageValue,this._inputOperation=i.inputOperation,this._tickerOperation=i.tickerOperation,this._effectOperation=i.effectOperation,this._animateOperation=i.animateOperation,this._getLogichValue=i.getLogichValue,this._getConditionalStep=i.getConditionalStep;}static get loadAssets(){return this._loadAssets}static get soundOperation(){return this._soundOperation}static get imageOperation(){return this._imageOperation}static get videoOperation(){return this._videoOperation}static get imageContainerOperation(){return this._imageContainerOperation}static get canvasElementOperation(){return this._canvasElementOperation}static get setStorageValue(){return this._setStorageValue}static get inputOperation(){return this._inputOperation}static get tickerOperation(){return this._tickerOperation}static get effectOperation(){return this._effectOperation}static get animateOperation(){return this._animateOperation}static get getLogichValue(){return this._getLogichValue}static get getConditionalStep(){return this._getConditionalStep}};n(e,"_loadAssets",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_soundOperation",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_imageOperation",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_videoOperation",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_imageContainerOperation",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_canvasElementOperation",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_setStorageValue",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_inputOperation",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_tickerOperation",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_effectOperation",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_animateOperation",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_getLogichValue",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")}),n(e,"_getConditionalStep",()=>{throw t.error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()"),new Error("Method not implemented, you should initialize the JsonUnifier: JsonUnifier.init()")});exports.JsonUnifier=e;