@drincs/pixi-vn-json 1.9.1 → 1.10.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.
package/dist/core.cjs ADDED
@@ -0,0 +1 @@
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var d=Object.defineProperty;var P=(s,i,p)=>i in s?d(s,i,{enumerable:true,configurable:true,writable:true,value:p}):s[i]=p;var o=(s,i,p)=>P(s,typeof i!="symbol"?i+"":i,p);var t;(c=>(c.log=(n,...r)=>console.log(`[Pixi\u2019VN Json] ${n}`,...r),c.warn=(n,...r)=>console.warn(`[Pixi\u2019VN Json] ${n}`,...r),c.error=(n,...r)=>console.error(`[Pixi\u2019VN Json] ${n}`,...r),c.info=(n,...r)=>console.info(`[Pixi\u2019VN Json] ${n}`,...r)))(t||(t={}));var e=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.getConditionalStep);}static get loadAssets(){return e._loadAssets}static get soundOperation(){return e._soundOperation}static get imageOperation(){return e._imageOperation}static get videoOperation(){return e._videoOperation}static get textOperation(){return e._textOperation}static get imageContainerOperation(){return e._imageContainerOperation}static get canvasElementOperation(){return e._canvasElementOperation}static get setStorageValue(){return e._setStorageValue}static get setInitialStorageValue(){return e._setInitialStorageValue}static get narrationOperation(){return e._narrationOperation}static get effectOperation(){return e._effectOperation}static get animateOperation(){return e._animateOperation}static get getLogichValue(){return e._getLogichValue}static get getConditionalStep(){return e._getConditionalStep}};o(e,"_loadAssets",()=>{}),o(e,"_soundOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_videoOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageContainerOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_textOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_canvasElementOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setInitialStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_narrationOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_effectOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_animateOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getLogichValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getConditionalStep",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var x=e;exports.JsonUnifier=x;
@@ -1,4 +1,6 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType, ContainerChild } from '@drincs/pixi-vn';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType, ContainerChild } from '@drincs/pixi-vn';
2
+ import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
3
+ import { UPDATE_PRIORITY } from 'pixi.js';
2
4
 
3
5
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
4
6
  type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
@@ -57,95 +59,8 @@ type PixiVNJsonConditionalResultToCombine<T> = {
57
59
  secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
58
60
  };
59
61
 
60
- type PixiVNJsonUnionConditionAndOr = {
61
- type: "union";
62
- conditions: PixiVNJsonConditions[];
63
- unionType: "and" | "or";
64
- };
65
- type PixiVNJsonUnionConditionNot = {
66
- type: "union";
67
- condition: PixiVNJsonConditions;
68
- unionType: "not";
69
- };
70
- type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionConditionNot;
71
-
72
- /**
73
- * Comparation for PixiVNJson.
74
- * In this comparation, the values to be converted to string and compared.
75
- */
76
- type PixiVNJsonComparation = {
77
- type: "compare";
78
- /**
79
- * Left value of the comparation
80
- */
81
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
82
- /**
83
- * Right value of the comparation
84
- */
85
- rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
86
- /**
87
- * Operator of the comparation
88
- */
89
- operator: "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
90
- };
91
- type PixiVNJsonValueCondition = StorageElementType | PixiVNJsonValueGet;
92
- /**
93
- * Conditions for PixiVNJson
94
- */
95
- type PixiVNJsonConditions = PixiVNJsonComparation | PixiVNJsonValueCondition | PixiVNJsonUnionCondition | PixiVNJsonArithmeticOperations;
96
-
97
- /**
98
- * If-Else condition for PixiVNJson
99
- */
100
- interface PixiVNJsonIfElse<Then> {
101
- type: "ifelse";
102
- /**
103
- * The list of conditions to be checked.
104
- */
105
- condition: PixiVNJsonConditions;
106
- /**
107
- * The value to be returned if the condition is true.
108
- */
109
- then: Then | PixiVNJsonIfElse<Then>;
110
- /**
111
- * The value to be returned if the condition is false.
112
- */
113
- else?: Then | PixiVNJsonIfElse<Then>;
114
- }
115
-
116
62
  type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
117
63
 
118
- interface PixiVNJsonArithmeticOperationsArithmetic {
119
- type: "arithmetic";
120
- /**
121
- * Left value of the arithmetic operation
122
- */
123
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
124
- /**
125
- * Right value of the arithmetic operation
126
- */
127
- rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
128
- /**
129
- * Operator of the arithmetic operation
130
- */
131
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
132
- }
133
- interface PixiVNJsonArithmeticOperationsArithmeticSingle {
134
- type: "arithmeticsingle";
135
- /**
136
- * Left value of the arithmetic operation
137
- */
138
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
139
- /**
140
- * Operator of the arithmetic operation
141
- */
142
- operator: "INT" | "FLOOR" | "FLOAT";
143
- }
144
- /**
145
- * Arithmetic operations for the PixiVNJson
146
- */
147
- type PixiVNJsonArithmeticOperations = PixiVNJsonArithmeticOperationsArithmeticSingle | PixiVNJsonArithmeticOperationsArithmetic;
148
-
149
64
  type PixiVNJsonStorageGet = {
150
65
  type: "value";
151
66
  storageOperationType: "get";
@@ -246,6 +161,93 @@ type PixiVNJsonFlagSet = {
246
161
  };
247
162
  type PixiVNJsonValueSet = PixiVNJsonOnlyStorageSet | PixiVNJsonFlagSet | PixiVNJsonOnlyParamSet;
248
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
+
249
251
  type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
250
252
  type: "animate";
251
253
  alias: string | string[];
@@ -1,4 +1,6 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType, ContainerChild } from '@drincs/pixi-vn';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType, ContainerChild } from '@drincs/pixi-vn';
2
+ import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
3
+ import { UPDATE_PRIORITY } from 'pixi.js';
2
4
 
3
5
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
4
6
  type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
@@ -57,95 +59,8 @@ type PixiVNJsonConditionalResultToCombine<T> = {
57
59
  secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
58
60
  };
59
61
 
60
- type PixiVNJsonUnionConditionAndOr = {
61
- type: "union";
62
- conditions: PixiVNJsonConditions[];
63
- unionType: "and" | "or";
64
- };
65
- type PixiVNJsonUnionConditionNot = {
66
- type: "union";
67
- condition: PixiVNJsonConditions;
68
- unionType: "not";
69
- };
70
- type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionConditionNot;
71
-
72
- /**
73
- * Comparation for PixiVNJson.
74
- * In this comparation, the values to be converted to string and compared.
75
- */
76
- type PixiVNJsonComparation = {
77
- type: "compare";
78
- /**
79
- * Left value of the comparation
80
- */
81
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
82
- /**
83
- * Right value of the comparation
84
- */
85
- rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
86
- /**
87
- * Operator of the comparation
88
- */
89
- operator: "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
90
- };
91
- type PixiVNJsonValueCondition = StorageElementType | PixiVNJsonValueGet;
92
- /**
93
- * Conditions for PixiVNJson
94
- */
95
- type PixiVNJsonConditions = PixiVNJsonComparation | PixiVNJsonValueCondition | PixiVNJsonUnionCondition | PixiVNJsonArithmeticOperations;
96
-
97
- /**
98
- * If-Else condition for PixiVNJson
99
- */
100
- interface PixiVNJsonIfElse<Then> {
101
- type: "ifelse";
102
- /**
103
- * The list of conditions to be checked.
104
- */
105
- condition: PixiVNJsonConditions;
106
- /**
107
- * The value to be returned if the condition is true.
108
- */
109
- then: Then | PixiVNJsonIfElse<Then>;
110
- /**
111
- * The value to be returned if the condition is false.
112
- */
113
- else?: Then | PixiVNJsonIfElse<Then>;
114
- }
115
-
116
62
  type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
117
63
 
118
- interface PixiVNJsonArithmeticOperationsArithmetic {
119
- type: "arithmetic";
120
- /**
121
- * Left value of the arithmetic operation
122
- */
123
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
124
- /**
125
- * Right value of the arithmetic operation
126
- */
127
- rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
128
- /**
129
- * Operator of the arithmetic operation
130
- */
131
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
132
- }
133
- interface PixiVNJsonArithmeticOperationsArithmeticSingle {
134
- type: "arithmeticsingle";
135
- /**
136
- * Left value of the arithmetic operation
137
- */
138
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
139
- /**
140
- * Operator of the arithmetic operation
141
- */
142
- operator: "INT" | "FLOOR" | "FLOAT";
143
- }
144
- /**
145
- * Arithmetic operations for the PixiVNJson
146
- */
147
- type PixiVNJsonArithmeticOperations = PixiVNJsonArithmeticOperationsArithmeticSingle | PixiVNJsonArithmeticOperationsArithmetic;
148
-
149
64
  type PixiVNJsonStorageGet = {
150
65
  type: "value";
151
66
  storageOperationType: "get";
@@ -246,6 +161,93 @@ type PixiVNJsonFlagSet = {
246
161
  };
247
162
  type PixiVNJsonValueSet = PixiVNJsonOnlyStorageSet | PixiVNJsonFlagSet | PixiVNJsonOnlyParamSet;
248
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
+
249
251
  type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
250
252
  type: "animate";
251
253
  alias: string | string[];
package/dist/core.mjs ADDED
@@ -0,0 +1 @@
1
+ import {PixiError}from'@drincs/pixi-vn';var d=Object.defineProperty;var P=(s,i,p)=>i in s?d(s,i,{enumerable:true,configurable:true,writable:true,value:p}):s[i]=p;var o=(s,i,p)=>P(s,typeof i!="symbol"?i+"":i,p);var t;(c=>(c.log=(n,...r)=>console.log(`[Pixi\u2019VN Json] ${n}`,...r),c.warn=(n,...r)=>console.warn(`[Pixi\u2019VN Json] ${n}`,...r),c.error=(n,...r)=>console.error(`[Pixi\u2019VN Json] ${n}`,...r),c.info=(n,...r)=>console.info(`[Pixi\u2019VN Json] ${n}`,...r)))(t||(t={}));var e=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.getConditionalStep);}static get loadAssets(){return e._loadAssets}static get soundOperation(){return e._soundOperation}static get imageOperation(){return e._imageOperation}static get videoOperation(){return e._videoOperation}static get textOperation(){return e._textOperation}static get imageContainerOperation(){return e._imageContainerOperation}static get canvasElementOperation(){return e._canvasElementOperation}static get setStorageValue(){return e._setStorageValue}static get setInitialStorageValue(){return e._setInitialStorageValue}static get narrationOperation(){return e._narrationOperation}static get effectOperation(){return e._effectOperation}static get animateOperation(){return e._animateOperation}static get getLogichValue(){return e._getLogichValue}static get getConditionalStep(){return e._getConditionalStep}};o(e,"_loadAssets",()=>{}),o(e,"_soundOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_videoOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageContainerOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_textOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_canvasElementOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setInitialStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_narrationOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_effectOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_animateOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getLogichValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getConditionalStep",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var x=e;export{x as JsonUnifier};
package/dist/importer.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var narration=require('@drincs/pixi-vn/narration'),unifier=require('@drincs/pixi-vn-json/unifier'),translator=require('@drincs/pixi-vn-json/translator'),storage=require('@drincs/pixi-vn/storage');var Q=Object.create;var I=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var re=(a,i,t)=>i in a?I(a,i,{enumerable:true,configurable:true,writable:true,value:t}):a[i]=t;var H=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(i,t)=>(typeof require<"u"?require:i)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var z=(a,i)=>()=>(i||a((i={exports:{}}).exports,i),i.exports);var ne=(a,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of ee(i))!ie.call(a,r)&&r!==t&&I(a,r,{get:()=>i[r],enumerable:!(o=Z(i,r))||o.enumerable});return a};var oe=(a,i,t)=>(t=a!=null?Q(te(a)):{},ne(I(t,"default",{value:a,enumerable:true}),a));var C=(a,i,t)=>re(a,typeof i!="symbol"?i+"":i,t);var G=z((A,F)=>{(function(a,i){typeof A=="object"?F.exports=A=i():typeof define=="function"&&define.amd?define([],i):a.CryptoJS=i();})(A,function(){var a=a||(function(i,t){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof H=="function")try{o=H("crypto");}catch{}var r=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function e(){}return function(n){var c;return e.prototype=n,c=new e,e.prototype=null,c}})(),l={},u=l.lib={},g=u.Base=(function(){return {extend:function(e){var n=s(this);return e&&n.mixIn(e),(!n.hasOwnProperty("init")||this.init===n.init)&&(n.init=function(){n.$super.init.apply(this,arguments);}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var n in e)e.hasOwnProperty(n)&&(this[n]=e[n]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),x=u.WordArray=g.extend({init:function(e,n){e=this.words=e||[],n!=t?this.sigBytes=n:this.sigBytes=e.length*4;},toString:function(e){return (e||V).stringify(this)},concat:function(e){var n=this.words,c=e.words,f=this.sigBytes,v=e.sigBytes;if(this.clamp(),f%4)for(var S=0;S<v;S++){var D=c[S>>>2]>>>24-S%4*8&255;n[f+S>>>2]|=D<<24-(f+S)%4*8;}else for(var _=0;_<v;_+=4)n[f+_>>>2]=c[_>>>2];return this.sigBytes+=v,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=i.ceil(n/4);},clone:function(){var e=g.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var n=[],c=0;c<e;c+=4)n.push(r());return new x.init(n,e)}}),p=l.enc={},V=p.Hex={stringify:function(e){for(var n=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var S=n[v>>>2]>>>24-v%4*8&255;f.push((S>>>4).toString(16)),f.push((S&15).toString(16));}return f.join("")},parse:function(e){for(var n=e.length,c=[],f=0;f<n;f+=2)c[f>>>3]|=parseInt(e.substr(f,2),16)<<24-f%8*4;return new x.init(c,n/2)}},b=p.Latin1={stringify:function(e){for(var n=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var S=n[v>>>2]>>>24-v%4*8&255;f.push(String.fromCharCode(S));}return f.join("")},parse:function(e){for(var n=e.length,c=[],f=0;f<n;f++)c[f>>>2]|=(e.charCodeAt(f)&255)<<24-f%4*8;return new x.init(c,n)}},N=p.Utf8={stringify:function(e){try{return decodeURIComponent(escape(b.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return b.parse(unescape(encodeURIComponent(e)))}},h=u.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new x.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=N.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var n,c=this._data,f=c.words,v=c.sigBytes,S=this.blockSize,D=S*4,_=v/D;e?_=i.ceil(_):_=i.max((_|0)-this._minBufferSize,0);var T=_*S,j=i.min(T*4,v);if(T){for(var k=0;k<T;k+=S)this._doProcessBlock(f,k);n=f.splice(0,T),c.sigBytes-=j;}return new x.init(n,j)},clone:function(){var e=g.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=h.extend({cfg:g.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){h.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var n=this._doFinalize();return n},blockSize:512/32,_createHelper:function(e){return function(n,c){return new e.init(c).finalize(n)}},_createHmacHelper:function(e){return function(n,c){return new y.HMAC.init(e,c).finalize(n)}}});var y=l.algo={};return l})(Math);return a});});var q=z((E,X)=>{(function(a,i){typeof E=="object"?X.exports=E=i(G()):typeof define=="function"&&define.amd?define(["./core"],i):i(a.CryptoJS);})(E,function(a){return (function(){var i=a,t=i.lib,o=t.WordArray,r=t.Hasher,s=i.algo,l=[],u=s.SHA1=r.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,x){for(var p=this._hash.words,V=p[0],b=p[1],N=p[2],h=p[3],d=p[4],y=0;y<80;y++){if(y<16)l[y]=g[x+y]|0;else {var e=l[y-3]^l[y-8]^l[y-14]^l[y-16];l[y]=e<<1|e>>>31;}var n=(V<<5|V>>>27)+d+l[y];y<20?n+=(b&N|~b&h)+1518500249:y<40?n+=(b^N^h)+1859775393:y<60?n+=(b&N|b&h|N&h)-1894007588:n+=(b^N^h)-899497514,d=h,h=N,N=b<<30|b>>>2,b=V,V=n;}p[0]=p[0]+V|0,p[1]=p[1]+b|0,p[2]=p[2]+N|0,p[3]=p[3]+h|0,p[4]=p[4]+d|0;},_doFinalize:function(){var g=this._data,x=g.words,p=this._nDataBytes*8,V=g.sigBytes*8;return x[V>>>5]|=128<<24-V%32,x[(V+64>>>9<<4)+14]=Math.floor(p/4294967296),x[(V+64>>>9<<4)+15]=p,g.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var g=r.clone.call(this);return g._hash=this._hash.clone(),g}});i.SHA1=r._createHelper(u),i.HmacSHA1=r._createHmacHelper(u);})(),a.SHA1});});var L;(r=>(r.log=(s,...l)=>console.log(`[Pixi\u2019VN Json] ${s}`,...l),r.warn=(s,...l)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...l),r.error=(s,...l)=>console.error(`[Pixi\u2019VN Json] ${s}`,...l),r.info=(s,...l)=>console.info(`[Pixi\u2019VN Json] ${s}`,...l)))(L||(L={}));function W(a){let i="";return a.values.forEach(t=>{if(typeof t=="string")i+=t;else {let o=unifier.JsonUnifier.getLogichValue(t);i+=`${o}`;}}),i}async function R(a,i){let t=unifier.JsonUnifier.getLogichValue(a);if(t)switch(t.type){case "sound":unifier.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await unifier.JsonUnifier.loadAssets(t);break;case "image":await unifier.JsonUnifier.imageOperation(t);break;case "video":await unifier.JsonUnifier.videoOperation(t);break;case "imagecontainer":await unifier.JsonUnifier.imageContainerOperation(t);break;case "text":await unifier.JsonUnifier.textOperation(t);break;case "canvaselement":await unifier.JsonUnifier.canvasElementOperation(t);break;case "value":unifier.JsonUnifier.setStorageValue(t);break;case "operationtoconvert":if(i){let o=W(t),r=await i(o);r&&await R(r,i);}break;case "input":case "dialogue":unifier.JsonUnifier.narrationOperation(t);break;case "shake":await unifier.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":unifier.JsonUnifier.animateOperation(t);break}}function U(a){let i=unifier.JsonUnifier.getLogichValue(a);i&&i.type==="value"&&i.storageOperationType==="set"&&(i.storageType==="storage"||i.storageType==="tempstorage")&&unifier.JsonUnifier.setInitialStorageValue(i);}async function le(a,i={}){if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {L.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let t=a.map(async s=>{if(typeof s=="string")try{s=JSON.parse(s);}catch(l){L.error("Error parsing imported Pixi'VN JSON",l),s={};}return s}),r=(await Promise.all(t)).map(async s=>{let l=[];if(s.initialOperations)for(let u of s.initialOperations)U(u);if(s.labels){let u=s.labels;for(let g in u)try{let x=u[g],p=new w(g,x,void 0,i);narration.RegisteredLabels.add(p);}catch(x){L.error(`Error creating JSON label ${g}`,x);}}return Promise.all(l)});await Promise.all(r);}var K=oe(q());var $="___param___";function M(a){try{if(typeof a>"u")return a;let i=JSON.stringify(a);return JSON.parse(i)}catch(i){throw L.error("Error creating exportable element",a,i),new Error("[Pixi\u2019VN] Error creating exportable element")}}var w=class extends narration.LabelAbstract{constructor(t,o,r,s={}){r||(r={}),r.onLoadingLabel=async()=>{for(let l of o){let u;if(typeof l=="function"?u=l():u=l,u=unifier.JsonUnifier.getConditionalStep(u),u.operations)try{let g=u.operations.map(x=>unifier.JsonUnifier.loadAssets(x));await Promise.all(g);}catch(g){L.error("The operation in the onLoadingLabel function of the label has an error:",g);}}};super(t,r);C(this,"_steps");C(this,"operationStringConvert");C(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let o=this._steps[t];return this.stepConverter(o)}getStepSha(t){if(t<0||t>=this.steps.length)return;let o=this._steps[t];return (0, K.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let o="";if(Array.isArray(t)){let r=[];t.forEach(s=>{if(typeof s=="string")r.push(s);else if(s&&typeof s=="object"){let l=unifier.JsonUnifier.getLogichValue(s);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=unifier.JsonUnifier.getLogichValue(l)||""),Array.isArray(l)?r=r.map(u=>`${u}`).concat(l):r.push(`${l}`)):r.push(`${s}`);}else r.push(`${s}`);}),o=r;}else {let r=unifier.JsonUnifier.getLogichValue(t);r&&!Array.isArray(r)&&typeof r=="object"&&(r=unifier.JsonUnifier.getLogichValue(r)),r&&Array.isArray(r)?o=r.map(s=>`${s}`):o=`${r}`;}return o}getDialogue(t){if(t==null)return;let o=unifier.JsonUnifier.getLogichValue(t);return o==null?`${o}`:typeof o=="object"&&"character"in o&&"text"in o?{character:o.character,text:translator.translator.t(this.getDialogueText(o.text))}:translator.translator.t(this.getDialogueText(o))}getChoices(t){return unifier.JsonUnifier.getLogichValue(t)?.map(s=>unifier.JsonUnifier.getLogichValue(s)).filter(s=>s!==void 0)}stepConverter(t){return async o=>{let r=typeof t=="function"?t():t;r=M(r),r=unifier.JsonUnifier.getConditionalStep(r);let s=this.operationStringConvert?h=>this.operationStringConvert(h,r,o):void 0,{operations:l=[]}=r;for(let h of l)await R(h,s);let{labelToOpen:u=[]}=r,g=this.getChoices(r.choices),x=unifier.JsonUnifier.getLogichValue(r.glueEnabled),p=this.getDialogue(r.dialogue),V=[];Array.isArray(u)||(u=[u]),u.forEach(h=>{let d=unifier.JsonUnifier.getLogichValue(h);d&&V.push(d);});let b=unifier.JsonUnifier.getLogichValue(r.goNextStep),N=unifier.JsonUnifier.getLogichValue(r.end);if(g){let h=g.map(d=>{let y="";if(Array.isArray(d.text)){let n=[];d.text.forEach(c=>{if(typeof c=="string")n.push(translator.translator.t(c));else if(c&&typeof c=="object"){let f=unifier.JsonUnifier.getLogichValue(c);f&&!Array.isArray(f)&&typeof f=="object"&&(f=unifier.JsonUnifier.getLogichValue(f)||""),f&&(Array.isArray(f)?n=n.concat(translator.translator.t(f)):n.push(translator.translator.t(f)));}}),y=n;}else typeof d.text=="string"&&(y=translator.translator.t(d.text));return {label:d.label,text:y,props:d.props,type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect}});narration.narration.choices=h;}else narration.narration.choices=void 0;p!==void 0&&(narration.narration.dialogue=p,this.skipEmptyDialogs&&typeof p=="string"&&(p===""||RegExp(/^\s+$/).test(p))&&(b=true)),x?storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):x===false&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let h of V){let d=h.label;typeof d=="object"&&(d=unifier.JsonUnifier.getLogichValue(d)||"");let y=h.params?.map(e=>unifier.JsonUnifier.getLogichValue(e));o={...o,...h.props},h.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${$}${narration.narration.openedLabels.length}`,y),await narration.narration.call(d,o)):(storage.storage.setTempVariable(`${$}${narration.narration.openedLabels.length}`,y),await narration.narration.call(d,o));}N==="game_end"?(narration.narration.closeAllLabels(),await narration.narration.continue(o,{runNow:true})):N==="label_end"&&narration.narration.closeCurrentLabel(),b&&await narration.narration.continue(o,{runNow:true});}}};exports.LabelJson=w;exports.importPixiVNJson=le;
1
+ 'use strict';var narration=require('@drincs/pixi-vn/narration'),core=require('@drincs/pixi-vn-json/core'),pixiVn=require('@drincs/pixi-vn'),translator=require('@drincs/pixi-vn-json/translator'),storage=require('@drincs/pixi-vn/storage');var K=Object.create;var I=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var ie=(a,i,t)=>i in a?I(a,i,{enumerable:true,configurable:true,writable:true,value:t}):a[i]=t;var H=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(i,t)=>(typeof require<"u"?require:i)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var z=(a,i)=>()=>(i||a((i={exports:{}}).exports,i),i.exports);var ne=(a,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of Z(i))!te.call(a,n)&&n!==t&&I(a,n,{get:()=>i[n],enumerable:!(o=Q(i,n))||o.enumerable});return a};var re=(a,i,t)=>(t=a!=null?K(ee(a)):{},ne(I(t,"default",{value:a,enumerable:true}),a));var C=(a,i,t)=>ie(a,typeof i!="symbol"?i+"":i,t);var G=z((A,F)=>{(function(a,i){typeof A=="object"?F.exports=A=i():typeof define=="function"&&define.amd?define([],i):a.CryptoJS=i();})(A,function(){var a=a||(function(i,t){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof H=="function")try{o=H("crypto");}catch{}var n=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function e(){}return function(r){var c;return e.prototype=r,c=new e,e.prototype=null,c}})(),l={},u=l.lib={},g=u.Base=(function(){return {extend:function(e){var r=s(this);return e&&r.mixIn(e),(!r.hasOwnProperty("init")||this.init===r.init)&&(r.init=function(){r.$super.init.apply(this,arguments);}),r.init.prototype=r,r.$super=this,r},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var r in e)e.hasOwnProperty(r)&&(this[r]=e[r]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),x=u.WordArray=g.extend({init:function(e,r){e=this.words=e||[],r!=t?this.sigBytes=r:this.sigBytes=e.length*4;},toString:function(e){return (e||V).stringify(this)},concat:function(e){var r=this.words,c=e.words,f=this.sigBytes,v=e.sigBytes;if(this.clamp(),f%4)for(var P=0;P<v;P++){var D=c[P>>>2]>>>24-P%4*8&255;r[f+P>>>2]|=D<<24-(f+P)%4*8;}else for(var _=0;_<v;_+=4)r[f+_>>>2]=c[_>>>2];return this.sigBytes+=v,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=i.ceil(r/4);},clone:function(){var e=g.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var r=[],c=0;c<e;c+=4)r.push(n());return new x.init(r,e)}}),p=l.enc={},V=p.Hex={stringify:function(e){for(var r=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var P=r[v>>>2]>>>24-v%4*8&255;f.push((P>>>4).toString(16)),f.push((P&15).toString(16));}return f.join("")},parse:function(e){for(var r=e.length,c=[],f=0;f<r;f+=2)c[f>>>3]|=parseInt(e.substr(f,2),16)<<24-f%8*4;return new x.init(c,r/2)}},b=p.Latin1={stringify:function(e){for(var r=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var P=r[v>>>2]>>>24-v%4*8&255;f.push(String.fromCharCode(P));}return f.join("")},parse:function(e){for(var r=e.length,c=[],f=0;f<r;f++)c[f>>>2]|=(e.charCodeAt(f)&255)<<24-f%4*8;return new x.init(c,r)}},N=p.Utf8={stringify:function(e){try{return decodeURIComponent(escape(b.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return b.parse(unescape(encodeURIComponent(e)))}},h=u.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new x.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=N.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var r,c=this._data,f=c.words,v=c.sigBytes,P=this.blockSize,D=P*4,_=v/D;e?_=i.ceil(_):_=i.max((_|0)-this._minBufferSize,0);var T=_*P,j=i.min(T*4,v);if(T){for(var k=0;k<T;k+=P)this._doProcessBlock(f,k);r=f.splice(0,T),c.sigBytes-=j;}return new x.init(r,j)},clone:function(){var e=g.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=h.extend({cfg:g.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){h.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var r=this._doFinalize();return r},blockSize:512/32,_createHelper:function(e){return function(r,c){return new e.init(c).finalize(r)}},_createHmacHelper:function(e){return function(r,c){return new y.HMAC.init(e,c).finalize(r)}}});var y=l.algo={};return l})(Math);return a});});var q=z((E,X)=>{(function(a,i){typeof E=="object"?X.exports=E=i(G()):typeof define=="function"&&define.amd?define(["./core"],i):i(a.CryptoJS);})(E,function(a){return (function(){var i=a,t=i.lib,o=t.WordArray,n=t.Hasher,s=i.algo,l=[],u=s.SHA1=n.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,x){for(var p=this._hash.words,V=p[0],b=p[1],N=p[2],h=p[3],d=p[4],y=0;y<80;y++){if(y<16)l[y]=g[x+y]|0;else {var e=l[y-3]^l[y-8]^l[y-14]^l[y-16];l[y]=e<<1|e>>>31;}var r=(V<<5|V>>>27)+d+l[y];y<20?r+=(b&N|~b&h)+1518500249:y<40?r+=(b^N^h)+1859775393:y<60?r+=(b&N|b&h|N&h)-1894007588:r+=(b^N^h)-899497514,d=h,h=N,N=b<<30|b>>>2,b=V,V=r;}p[0]=p[0]+V|0,p[1]=p[1]+b|0,p[2]=p[2]+N|0,p[3]=p[3]+h|0,p[4]=p[4]+d|0;},_doFinalize:function(){var g=this._data,x=g.words,p=this._nDataBytes*8,V=g.sigBytes*8;return x[V>>>5]|=128<<24-V%32,x[(V+64>>>9<<4)+14]=Math.floor(p/4294967296),x[(V+64>>>9<<4)+15]=p,g.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var g=n.clone.call(this);return g._hash=this._hash.clone(),g}});i.SHA1=n._createHelper(u),i.HmacSHA1=n._createHmacHelper(u);})(),a.SHA1});});var L;(n=>(n.log=(s,...l)=>console.log(`[Pixi\u2019VN Json] ${s}`,...l),n.warn=(s,...l)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...l),n.error=(s,...l)=>console.error(`[Pixi\u2019VN Json] ${s}`,...l),n.info=(s,...l)=>console.info(`[Pixi\u2019VN Json] ${s}`,...l)))(L||(L={}));function W(a){let i="";return a.values.forEach(t=>{if(typeof t=="string")i+=t;else {let o=core.JsonUnifier.getLogichValue(t);i+=`${o}`;}}),i}async function R(a,i){let t=core.JsonUnifier.getLogichValue(a);if(t)switch(t.type){case "sound":core.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await core.JsonUnifier.loadAssets(t);break;case "image":await core.JsonUnifier.imageOperation(t);break;case "video":await core.JsonUnifier.videoOperation(t);break;case "imagecontainer":await core.JsonUnifier.imageContainerOperation(t);break;case "text":await core.JsonUnifier.textOperation(t);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(t);break;case "value":core.JsonUnifier.setStorageValue(t);break;case "operationtoconvert":if(i){let o=W(t),n=await i(o);n&&await R(n,i);}break;case "input":case "dialogue":core.JsonUnifier.narrationOperation(t);break;case "shake":await core.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":core.JsonUnifier.animateOperation(t);break}}function U(a){let i=core.JsonUnifier.getLogichValue(a);i&&i.type==="value"&&i.storageOperationType==="set"&&(i.storageType==="storage"||i.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(i);}async function se(a,i={}){if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {L.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let t=a.map(async s=>{if(typeof s=="string")try{s=JSON.parse(s);}catch(l){L.error("Error parsing imported Pixi'VN JSON",l),s={};}return s}),n=(await Promise.all(t)).map(async s=>{let l=[];if(s.initialOperations)for(let u of s.initialOperations)U(u);if(s.labels){let u=s.labels;for(let g in u)try{let x=u[g],p=new w(g,x,void 0,i);narration.RegisteredLabels.add(p);}catch(x){L.error(`Error creating JSON label ${g}`,x);}}return Promise.all(l)});await Promise.all(n);}var Y=re(q());var $="___param___";var w=class extends narration.LabelAbstract{constructor(t,o,n,s={}){n||(n={}),n.onLoadingLabel=async()=>{for(let l of o){let u;if(typeof l=="function"?u=l():u=l,u=core.JsonUnifier.getConditionalStep(u),u.operations)try{let g=u.operations.map(x=>core.JsonUnifier.loadAssets(x));await Promise.all(g);}catch(g){L.error("The operation in the onLoadingLabel function of the label has an error:",g);}}};super(t,n);C(this,"_steps");C(this,"operationStringConvert");C(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let o=this._steps[t];return this.stepConverter(o)}getStepSha(t){if(t<0||t>=this.steps.length)return;let o=this._steps[t];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let o="";if(Array.isArray(t)){let n=[];t.forEach(s=>{if(typeof s=="string")n.push(s);else if(s&&typeof s=="object"){let l=core.JsonUnifier.getLogichValue(s);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l)||""),Array.isArray(l)?n=n.map(u=>`${u}`).concat(l):n.push(`${l}`)):n.push(`${s}`);}else n.push(`${s}`);}),o=n;}else {let n=core.JsonUnifier.getLogichValue(t);n&&!Array.isArray(n)&&typeof n=="object"&&(n=core.JsonUnifier.getLogichValue(n)),n&&Array.isArray(n)?o=n.map(s=>`${s}`):o=`${n}`;}return o}getDialogue(t){if(t==null)return;let o=core.JsonUnifier.getLogichValue(t);return o==null?`${o}`:typeof o=="object"&&"character"in o&&"text"in o?{character:o.character,text:translator.translator.t(this.getDialogueText(o.text))}:translator.translator.t(this.getDialogueText(o))}getChoices(t){return core.JsonUnifier.getLogichValue(t)?.map(s=>core.JsonUnifier.getLogichValue(s)).filter(s=>s!==void 0)}stepConverter(t){return async o=>{let n=typeof t=="function"?t():t;n=pixiVn.createExportableElement(n),n=core.JsonUnifier.getConditionalStep(n);let s=this.operationStringConvert?h=>this.operationStringConvert(h,n,o):void 0,{operations:l=[]}=n;for(let h of l)await R(h,s);let{labelToOpen:u=[]}=n,g=this.getChoices(n.choices),x=core.JsonUnifier.getLogichValue(n.glueEnabled),p=this.getDialogue(n.dialogue),V=[];Array.isArray(u)||(u=[u]),u.forEach(h=>{let d=core.JsonUnifier.getLogichValue(h);d&&V.push(d);});let b=core.JsonUnifier.getLogichValue(n.goNextStep),N=core.JsonUnifier.getLogichValue(n.end);if(g){let h=g.map(d=>{let y="";if(Array.isArray(d.text)){let r=[];d.text.forEach(c=>{if(typeof c=="string")r.push(translator.translator.t(c));else if(c&&typeof c=="object"){let f=core.JsonUnifier.getLogichValue(c);f&&!Array.isArray(f)&&typeof f=="object"&&(f=core.JsonUnifier.getLogichValue(f)||""),f&&(Array.isArray(f)?r=r.concat(translator.translator.t(f)):r.push(translator.translator.t(f)));}}),y=r;}else typeof d.text=="string"&&(y=translator.translator.t(d.text));return {label:d.label,text:y,props:d.props,type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect}});narration.narration.choices=h;}else narration.narration.choices=void 0;p!==void 0&&(narration.narration.dialogue=p,this.skipEmptyDialogs&&typeof p=="string"&&(p===""||RegExp(/^\s+$/).test(p))&&(b=true)),x?storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):x===false&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let h of V){let d=h.label;typeof d=="object"&&(d=core.JsonUnifier.getLogichValue(d)||"");let y=h.params?.map(e=>core.JsonUnifier.getLogichValue(e));o={...o,...h.props},h.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${$}${narration.narration.openedLabels.length}`,y),await narration.narration.call(d,o)):(storage.storage.setTempVariable(`${$}${narration.narration.openedLabels.length}`,y),await narration.narration.call(d,o));}N==="game_end"?(narration.narration.closeAllLabels(),await narration.narration.continue(o,{runNow:true})):N==="label_end"&&narration.narration.closeCurrentLabel(),b&&await narration.narration.continue(o,{runNow:true});}}};exports.LabelJson=w;exports.importPixiVNJson=se;
@@ -1,5 +1,7 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
2
- import { StepLabelPropsType as StepLabelPropsType$1, LabelAbstract, LabelProps, StepLabelType } from '@drincs/pixi-vn/narration';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
2
+ import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
3
+ import { UPDATE_PRIORITY } from 'pixi.js';
4
+ import { LabelAbstract, LabelProps, StepLabelPropsType as StepLabelPropsType$1, StepLabelType } from '@drincs/pixi-vn/narration';
3
5
 
4
6
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
5
7
  type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
@@ -1,5 +1,7 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
2
- import { StepLabelPropsType as StepLabelPropsType$1, LabelAbstract, LabelProps, StepLabelType } from '@drincs/pixi-vn/narration';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
2
+ import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
3
+ import { UPDATE_PRIORITY } from 'pixi.js';
4
+ import { LabelAbstract, LabelProps, StepLabelPropsType as StepLabelPropsType$1, StepLabelType } from '@drincs/pixi-vn/narration';
3
5
 
4
6
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
5
7
  type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
package/dist/importer.mjs CHANGED
@@ -1 +1 @@
1
- import {RegisteredLabels,LabelAbstract,narration}from'@drincs/pixi-vn/narration';import {JsonUnifier}from'@drincs/pixi-vn-json/unifier';import {translator}from'@drincs/pixi-vn-json/translator';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';var Q=Object.create;var I=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var re=(a,i,t)=>i in a?I(a,i,{enumerable:true,configurable:true,writable:true,value:t}):a[i]=t;var H=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(i,t)=>(typeof require<"u"?require:i)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var z=(a,i)=>()=>(i||a((i={exports:{}}).exports,i),i.exports);var ne=(a,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of ee(i))!ie.call(a,r)&&r!==t&&I(a,r,{get:()=>i[r],enumerable:!(o=Z(i,r))||o.enumerable});return a};var oe=(a,i,t)=>(t=a!=null?Q(te(a)):{},ne(I(t,"default",{value:a,enumerable:true}),a));var C=(a,i,t)=>re(a,typeof i!="symbol"?i+"":i,t);var G=z((A,F)=>{(function(a,i){typeof A=="object"?F.exports=A=i():typeof define=="function"&&define.amd?define([],i):a.CryptoJS=i();})(A,function(){var a=a||(function(i,t){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof H=="function")try{o=H("crypto");}catch{}var r=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function e(){}return function(n){var c;return e.prototype=n,c=new e,e.prototype=null,c}})(),l={},u=l.lib={},g=u.Base=(function(){return {extend:function(e){var n=s(this);return e&&n.mixIn(e),(!n.hasOwnProperty("init")||this.init===n.init)&&(n.init=function(){n.$super.init.apply(this,arguments);}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var n in e)e.hasOwnProperty(n)&&(this[n]=e[n]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),x=u.WordArray=g.extend({init:function(e,n){e=this.words=e||[],n!=t?this.sigBytes=n:this.sigBytes=e.length*4;},toString:function(e){return (e||V).stringify(this)},concat:function(e){var n=this.words,c=e.words,f=this.sigBytes,v=e.sigBytes;if(this.clamp(),f%4)for(var S=0;S<v;S++){var D=c[S>>>2]>>>24-S%4*8&255;n[f+S>>>2]|=D<<24-(f+S)%4*8;}else for(var _=0;_<v;_+=4)n[f+_>>>2]=c[_>>>2];return this.sigBytes+=v,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=i.ceil(n/4);},clone:function(){var e=g.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var n=[],c=0;c<e;c+=4)n.push(r());return new x.init(n,e)}}),p=l.enc={},V=p.Hex={stringify:function(e){for(var n=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var S=n[v>>>2]>>>24-v%4*8&255;f.push((S>>>4).toString(16)),f.push((S&15).toString(16));}return f.join("")},parse:function(e){for(var n=e.length,c=[],f=0;f<n;f+=2)c[f>>>3]|=parseInt(e.substr(f,2),16)<<24-f%8*4;return new x.init(c,n/2)}},b=p.Latin1={stringify:function(e){for(var n=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var S=n[v>>>2]>>>24-v%4*8&255;f.push(String.fromCharCode(S));}return f.join("")},parse:function(e){for(var n=e.length,c=[],f=0;f<n;f++)c[f>>>2]|=(e.charCodeAt(f)&255)<<24-f%4*8;return new x.init(c,n)}},N=p.Utf8={stringify:function(e){try{return decodeURIComponent(escape(b.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return b.parse(unescape(encodeURIComponent(e)))}},h=u.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new x.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=N.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var n,c=this._data,f=c.words,v=c.sigBytes,S=this.blockSize,D=S*4,_=v/D;e?_=i.ceil(_):_=i.max((_|0)-this._minBufferSize,0);var T=_*S,j=i.min(T*4,v);if(T){for(var k=0;k<T;k+=S)this._doProcessBlock(f,k);n=f.splice(0,T),c.sigBytes-=j;}return new x.init(n,j)},clone:function(){var e=g.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=h.extend({cfg:g.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){h.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var n=this._doFinalize();return n},blockSize:512/32,_createHelper:function(e){return function(n,c){return new e.init(c).finalize(n)}},_createHmacHelper:function(e){return function(n,c){return new y.HMAC.init(e,c).finalize(n)}}});var y=l.algo={};return l})(Math);return a});});var q=z((E,X)=>{(function(a,i){typeof E=="object"?X.exports=E=i(G()):typeof define=="function"&&define.amd?define(["./core"],i):i(a.CryptoJS);})(E,function(a){return (function(){var i=a,t=i.lib,o=t.WordArray,r=t.Hasher,s=i.algo,l=[],u=s.SHA1=r.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,x){for(var p=this._hash.words,V=p[0],b=p[1],N=p[2],h=p[3],d=p[4],y=0;y<80;y++){if(y<16)l[y]=g[x+y]|0;else {var e=l[y-3]^l[y-8]^l[y-14]^l[y-16];l[y]=e<<1|e>>>31;}var n=(V<<5|V>>>27)+d+l[y];y<20?n+=(b&N|~b&h)+1518500249:y<40?n+=(b^N^h)+1859775393:y<60?n+=(b&N|b&h|N&h)-1894007588:n+=(b^N^h)-899497514,d=h,h=N,N=b<<30|b>>>2,b=V,V=n;}p[0]=p[0]+V|0,p[1]=p[1]+b|0,p[2]=p[2]+N|0,p[3]=p[3]+h|0,p[4]=p[4]+d|0;},_doFinalize:function(){var g=this._data,x=g.words,p=this._nDataBytes*8,V=g.sigBytes*8;return x[V>>>5]|=128<<24-V%32,x[(V+64>>>9<<4)+14]=Math.floor(p/4294967296),x[(V+64>>>9<<4)+15]=p,g.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var g=r.clone.call(this);return g._hash=this._hash.clone(),g}});i.SHA1=r._createHelper(u),i.HmacSHA1=r._createHmacHelper(u);})(),a.SHA1});});var L;(r=>(r.log=(s,...l)=>console.log(`[Pixi\u2019VN Json] ${s}`,...l),r.warn=(s,...l)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...l),r.error=(s,...l)=>console.error(`[Pixi\u2019VN Json] ${s}`,...l),r.info=(s,...l)=>console.info(`[Pixi\u2019VN Json] ${s}`,...l)))(L||(L={}));function W(a){let i="";return a.values.forEach(t=>{if(typeof t=="string")i+=t;else {let o=JsonUnifier.getLogichValue(t);i+=`${o}`;}}),i}async function R(a,i){let t=JsonUnifier.getLogichValue(a);if(t)switch(t.type){case "sound":JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await JsonUnifier.loadAssets(t);break;case "image":await JsonUnifier.imageOperation(t);break;case "video":await JsonUnifier.videoOperation(t);break;case "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "text":await JsonUnifier.textOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "value":JsonUnifier.setStorageValue(t);break;case "operationtoconvert":if(i){let o=W(t),r=await i(o);r&&await R(r,i);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break}}function U(a){let i=JsonUnifier.getLogichValue(a);i&&i.type==="value"&&i.storageOperationType==="set"&&(i.storageType==="storage"||i.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(i);}async function le(a,i={}){if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {L.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let t=a.map(async s=>{if(typeof s=="string")try{s=JSON.parse(s);}catch(l){L.error("Error parsing imported Pixi'VN JSON",l),s={};}return s}),r=(await Promise.all(t)).map(async s=>{let l=[];if(s.initialOperations)for(let u of s.initialOperations)U(u);if(s.labels){let u=s.labels;for(let g in u)try{let x=u[g],p=new w(g,x,void 0,i);RegisteredLabels.add(p);}catch(x){L.error(`Error creating JSON label ${g}`,x);}}return Promise.all(l)});await Promise.all(r);}var K=oe(q());var $="___param___";function M(a){try{if(typeof a>"u")return a;let i=JSON.stringify(a);return JSON.parse(i)}catch(i){throw L.error("Error creating exportable element",a,i),new Error("[Pixi\u2019VN] Error creating exportable element")}}var w=class extends LabelAbstract{constructor(t,o,r,s={}){r||(r={}),r.onLoadingLabel=async()=>{for(let l of o){let u;if(typeof l=="function"?u=l():u=l,u=JsonUnifier.getConditionalStep(u),u.operations)try{let g=u.operations.map(x=>JsonUnifier.loadAssets(x));await Promise.all(g);}catch(g){L.error("The operation in the onLoadingLabel function of the label has an error:",g);}}};super(t,r);C(this,"_steps");C(this,"operationStringConvert");C(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let o=this._steps[t];return this.stepConverter(o)}getStepSha(t){if(t<0||t>=this.steps.length)return;let o=this._steps[t];return (0, K.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let o="";if(Array.isArray(t)){let r=[];t.forEach(s=>{if(typeof s=="string")r.push(s);else if(s&&typeof s=="object"){let l=JsonUnifier.getLogichValue(s);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=JsonUnifier.getLogichValue(l)||""),Array.isArray(l)?r=r.map(u=>`${u}`).concat(l):r.push(`${l}`)):r.push(`${s}`);}else r.push(`${s}`);}),o=r;}else {let r=JsonUnifier.getLogichValue(t);r&&!Array.isArray(r)&&typeof r=="object"&&(r=JsonUnifier.getLogichValue(r)),r&&Array.isArray(r)?o=r.map(s=>`${s}`):o=`${r}`;}return o}getDialogue(t){if(t==null)return;let o=JsonUnifier.getLogichValue(t);return o==null?`${o}`:typeof o=="object"&&"character"in o&&"text"in o?{character:o.character,text:translator.t(this.getDialogueText(o.text))}:translator.t(this.getDialogueText(o))}getChoices(t){return JsonUnifier.getLogichValue(t)?.map(s=>JsonUnifier.getLogichValue(s)).filter(s=>s!==void 0)}stepConverter(t){return async o=>{let r=typeof t=="function"?t():t;r=M(r),r=JsonUnifier.getConditionalStep(r);let s=this.operationStringConvert?h=>this.operationStringConvert(h,r,o):void 0,{operations:l=[]}=r;for(let h of l)await R(h,s);let{labelToOpen:u=[]}=r,g=this.getChoices(r.choices),x=JsonUnifier.getLogichValue(r.glueEnabled),p=this.getDialogue(r.dialogue),V=[];Array.isArray(u)||(u=[u]),u.forEach(h=>{let d=JsonUnifier.getLogichValue(h);d&&V.push(d);});let b=JsonUnifier.getLogichValue(r.goNextStep),N=JsonUnifier.getLogichValue(r.end);if(g){let h=g.map(d=>{let y="";if(Array.isArray(d.text)){let n=[];d.text.forEach(c=>{if(typeof c=="string")n.push(translator.t(c));else if(c&&typeof c=="object"){let f=JsonUnifier.getLogichValue(c);f&&!Array.isArray(f)&&typeof f=="object"&&(f=JsonUnifier.getLogichValue(f)||""),f&&(Array.isArray(f)?n=n.concat(translator.t(f)):n.push(translator.t(f)));}}),y=n;}else typeof d.text=="string"&&(y=translator.t(d.text));return {label:d.label,text:y,props:d.props,type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect}});narration.choices=h;}else narration.choices=void 0;p!==void 0&&(narration.dialogue=p,this.skipEmptyDialogs&&typeof p=="string"&&(p===""||RegExp(/^\s+$/).test(p))&&(b=true)),x?storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):x===false&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let h of V){let d=h.label;typeof d=="object"&&(d=JsonUnifier.getLogichValue(d)||"");let y=h.params?.map(e=>JsonUnifier.getLogichValue(e));o={...o,...h.props},h.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${$}${narration.openedLabels.length}`,y),await narration.call(d,o)):(storage.setTempVariable(`${$}${narration.openedLabels.length}`,y),await narration.call(d,o));}N==="game_end"?(narration.closeAllLabels(),await narration.continue(o,{runNow:true})):N==="label_end"&&narration.closeCurrentLabel(),b&&await narration.continue(o,{runNow:true});}}};export{w as LabelJson,le as importPixiVNJson};
1
+ import {RegisteredLabels,LabelAbstract,narration}from'@drincs/pixi-vn/narration';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {createExportableElement}from'@drincs/pixi-vn';import {translator}from'@drincs/pixi-vn-json/translator';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';var K=Object.create;var I=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var ie=(a,i,t)=>i in a?I(a,i,{enumerable:true,configurable:true,writable:true,value:t}):a[i]=t;var H=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(i,t)=>(typeof require<"u"?require:i)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var z=(a,i)=>()=>(i||a((i={exports:{}}).exports,i),i.exports);var ne=(a,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of Z(i))!te.call(a,n)&&n!==t&&I(a,n,{get:()=>i[n],enumerable:!(o=Q(i,n))||o.enumerable});return a};var re=(a,i,t)=>(t=a!=null?K(ee(a)):{},ne(I(t,"default",{value:a,enumerable:true}),a));var C=(a,i,t)=>ie(a,typeof i!="symbol"?i+"":i,t);var G=z((A,F)=>{(function(a,i){typeof A=="object"?F.exports=A=i():typeof define=="function"&&define.amd?define([],i):a.CryptoJS=i();})(A,function(){var a=a||(function(i,t){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof H=="function")try{o=H("crypto");}catch{}var n=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function e(){}return function(r){var c;return e.prototype=r,c=new e,e.prototype=null,c}})(),l={},u=l.lib={},g=u.Base=(function(){return {extend:function(e){var r=s(this);return e&&r.mixIn(e),(!r.hasOwnProperty("init")||this.init===r.init)&&(r.init=function(){r.$super.init.apply(this,arguments);}),r.init.prototype=r,r.$super=this,r},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var r in e)e.hasOwnProperty(r)&&(this[r]=e[r]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),x=u.WordArray=g.extend({init:function(e,r){e=this.words=e||[],r!=t?this.sigBytes=r:this.sigBytes=e.length*4;},toString:function(e){return (e||V).stringify(this)},concat:function(e){var r=this.words,c=e.words,f=this.sigBytes,v=e.sigBytes;if(this.clamp(),f%4)for(var P=0;P<v;P++){var D=c[P>>>2]>>>24-P%4*8&255;r[f+P>>>2]|=D<<24-(f+P)%4*8;}else for(var _=0;_<v;_+=4)r[f+_>>>2]=c[_>>>2];return this.sigBytes+=v,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=i.ceil(r/4);},clone:function(){var e=g.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var r=[],c=0;c<e;c+=4)r.push(n());return new x.init(r,e)}}),p=l.enc={},V=p.Hex={stringify:function(e){for(var r=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var P=r[v>>>2]>>>24-v%4*8&255;f.push((P>>>4).toString(16)),f.push((P&15).toString(16));}return f.join("")},parse:function(e){for(var r=e.length,c=[],f=0;f<r;f+=2)c[f>>>3]|=parseInt(e.substr(f,2),16)<<24-f%8*4;return new x.init(c,r/2)}},b=p.Latin1={stringify:function(e){for(var r=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var P=r[v>>>2]>>>24-v%4*8&255;f.push(String.fromCharCode(P));}return f.join("")},parse:function(e){for(var r=e.length,c=[],f=0;f<r;f++)c[f>>>2]|=(e.charCodeAt(f)&255)<<24-f%4*8;return new x.init(c,r)}},N=p.Utf8={stringify:function(e){try{return decodeURIComponent(escape(b.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return b.parse(unescape(encodeURIComponent(e)))}},h=u.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new x.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=N.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var r,c=this._data,f=c.words,v=c.sigBytes,P=this.blockSize,D=P*4,_=v/D;e?_=i.ceil(_):_=i.max((_|0)-this._minBufferSize,0);var T=_*P,j=i.min(T*4,v);if(T){for(var k=0;k<T;k+=P)this._doProcessBlock(f,k);r=f.splice(0,T),c.sigBytes-=j;}return new x.init(r,j)},clone:function(){var e=g.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=h.extend({cfg:g.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){h.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var r=this._doFinalize();return r},blockSize:512/32,_createHelper:function(e){return function(r,c){return new e.init(c).finalize(r)}},_createHmacHelper:function(e){return function(r,c){return new y.HMAC.init(e,c).finalize(r)}}});var y=l.algo={};return l})(Math);return a});});var q=z((E,X)=>{(function(a,i){typeof E=="object"?X.exports=E=i(G()):typeof define=="function"&&define.amd?define(["./core"],i):i(a.CryptoJS);})(E,function(a){return (function(){var i=a,t=i.lib,o=t.WordArray,n=t.Hasher,s=i.algo,l=[],u=s.SHA1=n.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,x){for(var p=this._hash.words,V=p[0],b=p[1],N=p[2],h=p[3],d=p[4],y=0;y<80;y++){if(y<16)l[y]=g[x+y]|0;else {var e=l[y-3]^l[y-8]^l[y-14]^l[y-16];l[y]=e<<1|e>>>31;}var r=(V<<5|V>>>27)+d+l[y];y<20?r+=(b&N|~b&h)+1518500249:y<40?r+=(b^N^h)+1859775393:y<60?r+=(b&N|b&h|N&h)-1894007588:r+=(b^N^h)-899497514,d=h,h=N,N=b<<30|b>>>2,b=V,V=r;}p[0]=p[0]+V|0,p[1]=p[1]+b|0,p[2]=p[2]+N|0,p[3]=p[3]+h|0,p[4]=p[4]+d|0;},_doFinalize:function(){var g=this._data,x=g.words,p=this._nDataBytes*8,V=g.sigBytes*8;return x[V>>>5]|=128<<24-V%32,x[(V+64>>>9<<4)+14]=Math.floor(p/4294967296),x[(V+64>>>9<<4)+15]=p,g.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var g=n.clone.call(this);return g._hash=this._hash.clone(),g}});i.SHA1=n._createHelper(u),i.HmacSHA1=n._createHmacHelper(u);})(),a.SHA1});});var L;(n=>(n.log=(s,...l)=>console.log(`[Pixi\u2019VN Json] ${s}`,...l),n.warn=(s,...l)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...l),n.error=(s,...l)=>console.error(`[Pixi\u2019VN Json] ${s}`,...l),n.info=(s,...l)=>console.info(`[Pixi\u2019VN Json] ${s}`,...l)))(L||(L={}));function W(a){let i="";return a.values.forEach(t=>{if(typeof t=="string")i+=t;else {let o=JsonUnifier.getLogichValue(t);i+=`${o}`;}}),i}async function R(a,i){let t=JsonUnifier.getLogichValue(a);if(t)switch(t.type){case "sound":JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await JsonUnifier.loadAssets(t);break;case "image":await JsonUnifier.imageOperation(t);break;case "video":await JsonUnifier.videoOperation(t);break;case "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "text":await JsonUnifier.textOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "value":JsonUnifier.setStorageValue(t);break;case "operationtoconvert":if(i){let o=W(t),n=await i(o);n&&await R(n,i);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break}}function U(a){let i=JsonUnifier.getLogichValue(a);i&&i.type==="value"&&i.storageOperationType==="set"&&(i.storageType==="storage"||i.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(i);}async function se(a,i={}){if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {L.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let t=a.map(async s=>{if(typeof s=="string")try{s=JSON.parse(s);}catch(l){L.error("Error parsing imported Pixi'VN JSON",l),s={};}return s}),n=(await Promise.all(t)).map(async s=>{let l=[];if(s.initialOperations)for(let u of s.initialOperations)U(u);if(s.labels){let u=s.labels;for(let g in u)try{let x=u[g],p=new w(g,x,void 0,i);RegisteredLabels.add(p);}catch(x){L.error(`Error creating JSON label ${g}`,x);}}return Promise.all(l)});await Promise.all(n);}var Y=re(q());var $="___param___";var w=class extends LabelAbstract{constructor(t,o,n,s={}){n||(n={}),n.onLoadingLabel=async()=>{for(let l of o){let u;if(typeof l=="function"?u=l():u=l,u=JsonUnifier.getConditionalStep(u),u.operations)try{let g=u.operations.map(x=>JsonUnifier.loadAssets(x));await Promise.all(g);}catch(g){L.error("The operation in the onLoadingLabel function of the label has an error:",g);}}};super(t,n);C(this,"_steps");C(this,"operationStringConvert");C(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let o=this._steps[t];return this.stepConverter(o)}getStepSha(t){if(t<0||t>=this.steps.length)return;let o=this._steps[t];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let o="";if(Array.isArray(t)){let n=[];t.forEach(s=>{if(typeof s=="string")n.push(s);else if(s&&typeof s=="object"){let l=JsonUnifier.getLogichValue(s);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=JsonUnifier.getLogichValue(l)||""),Array.isArray(l)?n=n.map(u=>`${u}`).concat(l):n.push(`${l}`)):n.push(`${s}`);}else n.push(`${s}`);}),o=n;}else {let n=JsonUnifier.getLogichValue(t);n&&!Array.isArray(n)&&typeof n=="object"&&(n=JsonUnifier.getLogichValue(n)),n&&Array.isArray(n)?o=n.map(s=>`${s}`):o=`${n}`;}return o}getDialogue(t){if(t==null)return;let o=JsonUnifier.getLogichValue(t);return o==null?`${o}`:typeof o=="object"&&"character"in o&&"text"in o?{character:o.character,text:translator.t(this.getDialogueText(o.text))}:translator.t(this.getDialogueText(o))}getChoices(t){return JsonUnifier.getLogichValue(t)?.map(s=>JsonUnifier.getLogichValue(s)).filter(s=>s!==void 0)}stepConverter(t){return async o=>{let n=typeof t=="function"?t():t;n=createExportableElement(n),n=JsonUnifier.getConditionalStep(n);let s=this.operationStringConvert?h=>this.operationStringConvert(h,n,o):void 0,{operations:l=[]}=n;for(let h of l)await R(h,s);let{labelToOpen:u=[]}=n,g=this.getChoices(n.choices),x=JsonUnifier.getLogichValue(n.glueEnabled),p=this.getDialogue(n.dialogue),V=[];Array.isArray(u)||(u=[u]),u.forEach(h=>{let d=JsonUnifier.getLogichValue(h);d&&V.push(d);});let b=JsonUnifier.getLogichValue(n.goNextStep),N=JsonUnifier.getLogichValue(n.end);if(g){let h=g.map(d=>{let y="";if(Array.isArray(d.text)){let r=[];d.text.forEach(c=>{if(typeof c=="string")r.push(translator.t(c));else if(c&&typeof c=="object"){let f=JsonUnifier.getLogichValue(c);f&&!Array.isArray(f)&&typeof f=="object"&&(f=JsonUnifier.getLogichValue(f)||""),f&&(Array.isArray(f)?r=r.concat(translator.t(f)):r.push(translator.t(f)));}}),y=r;}else typeof d.text=="string"&&(y=translator.t(d.text));return {label:d.label,text:y,props:d.props,type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect}});narration.choices=h;}else narration.choices=void 0;p!==void 0&&(narration.dialogue=p,this.skipEmptyDialogs&&typeof p=="string"&&(p===""||RegExp(/^\s+$/).test(p))&&(b=true)),x?storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):x===false&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let h of V){let d=h.label;typeof d=="object"&&(d=JsonUnifier.getLogichValue(d)||"");let y=h.params?.map(e=>JsonUnifier.getLogichValue(e));o={...o,...h.props},h.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${$}${narration.openedLabels.length}`,y),await narration.call(d,o)):(storage.setTempVariable(`${$}${narration.openedLabels.length}`,y),await narration.call(d,o));}N==="game_end"?(narration.closeAllLabels(),await narration.continue(o,{runNow:true})):N==="label_end"&&narration.closeCurrentLabel(),b&&await narration.continue(o,{runNow:true});}}};export{w as LabelJson,se as importPixiVNJson};
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var importer=require('@drincs/pixi-vn-json/importer'),translator=require('@drincs/pixi-vn-json/translator'),unifier=require('@drincs/pixi-vn-json/unifier'),canvas=require('@drincs/pixi-vn/canvas'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),storage=require('@drincs/pixi-vn/storage');var V="___param___";async function I(e){let a=unifier.JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await canvas.Assets.load(a.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await canvas.Assets.loadBundle(a.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(a.aliases);break}break}}var o;(n=>(n.log=(r,...u)=>console.log(`[Pixi\u2019VN Json] ${r}`,...u),n.warn=(r,...u)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...u),n.error=(r,...u)=>console.error(`[Pixi\u2019VN Json] ${r}`,...u),n.info=(r,...u)=>console.info(`[Pixi\u2019VN Json] ${r}`,...u)))(o||(o={}));async function b(e,a,i){switch(i.type){case "fade":await canvas.showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await canvas.showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await canvas.moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await canvas.pushIn(a.alias,e,i.props,i.priority);break}}function h(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function v(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageSprite(e.props,e.url||e.alias);await b(i,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Image with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let n=new canvas.VideoSprite(e.props,e.url||e.alias);await b(n,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Video with alias ${e.alias} not found.`);break;case "remove":h(e);break;case "pause":let i=canvas.canvas.find(e.alias);i?i.paused=true:o.error(`Video with alias ${e.alias} not found.`);break;case "resume":let l=canvas.canvas.find(e.alias);l?l.paused=false:o.error(`Video with alias ${e.alias} not found.`);break}}async function _(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageContainer(e.props,e.urls);await b(i,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function R(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let i=new canvas.Text(e.props);await b(i,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Text with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function L(e){switch(e.operationType){case "edit":try{let a=canvas.canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):o.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){o.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":h(e);break}}async function D(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function G(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function $(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function F(e){switch(e.operationType){case "play":sound.sound.play(e.alias,e.props);break;case "stop":sound.sound.stop(e.alias);break;case "pause":sound.sound.pause(e.alias);break;case "resume":sound.sound.resume(e.alias);break;case "volume":sound.sound.volume(e.alias,e.value);break}}function j(e){try{if(typeof e>"u")return e;let a=JSON.stringify(e);return JSON.parse(a)}catch(a){throw o.error("Error creating exportable element",e,a),new Error("[Pixi\u2019VN] Error creating exportable element")}}function U(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,i);break;case "tempstorage":storage.storage.setTempVariable(e.key,i);break;case "params":let l=storage.storage.get(`${V}${narration.narration.openedLabels.length-1}`)||[];l&&l.length-1>=e.key&&(l[e.key]=i),storage.storage.setTempVariable(`${V}${narration.narration.openedLabels.length-1}`,l);break}}function X(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:i};break}}function t(e){let a=be(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return Ve(a);case "arithmetic":case "arithmeticsingle":return ye(a);case "compare":case "valueCondition":case "union":return he(a)}return a}function ye(e){let a=t(e.leftValue);switch(e.type){case "arithmetic":let i=t(e.rightValue);switch(e.operator){case "*":return a*i;case "/":return a/i;case "+":return a+i;case "-":return a-i;case "%":return a%i;case "POW":return Math.pow(a,i);case "RANDOM":return narration.narration.getRandomNumber(a,i)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(a);case "FLOOR":return Math.floor(a);case "FLOAT":return parseFloat(a)}break}}function Ve(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return t(e.operation);case "params":let a=storage.storage.get(`${V}${narration.narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];o.warn("getValue params not found");return}return e}function he(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=t(e.leftValue),i=t(e.rightValue);switch(e.operator){case "==":return a===i;case "!=":return a!==i;case "<":return a<i;case "<=":return a<=i;case ">":return a>i;case ">=":return a>=i;case "CONTAINS":return a.toString().includes(i.toString())}break;case "valueCondition":return !!t(e.value);case "union":return Te(e)}return !!e}function Te(e){if(e.unionType==="not")return !t(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=t(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function Ne(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function be(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return t(e.condition)?t(e.then):t(e.else);case "stepswitch":let i=t(e.elements)||[];if(i.length===0){o.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let l=Ne(0,i.length-1);return t(i[l]);case "loop":let n=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>i.length-1&&(n=n%i.length),t(i[n]);case "sequential":let r,u=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(r=t(i[i.length-1])),u>i.length-1?r:t(i[u]);case "sequentialrandom":let x=narration.NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(x==null&&e.end=="lastItem"){let m=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!m||!m?.usedRandomNumbers){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=m.usedRandomNumbers[`0-${i.length-1}`];return t(i[y[y.length-1]])}if(x==null){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return t(i[x])}}return e}function J(e){if(e.conditionalStep){let a=j(t(e.conditionalStep));if(a?.glueEnabled===void 0&&delete a?.glueEnabled,a?.goNextStep===void 0&&delete a?.goNextStep,a?.end===void 0&&delete a?.end,a?.choices===void 0&&delete a?.choices,a?.dialogue===void 0&&delete a?.dialogue,a?.labelToOpen===void 0&&delete a?.labelToOpen,a?.operations===void 0&&delete a?.operations,a){let i={...e,conditionalStep:void 0,...a};return J(i)}else storage.storage.getFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);}return e}function Pe(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(r=>{let u=t(r);i.push(u);});else {let r=t(n);i.push(r);}});let l=a?[a,...i]:i;if(l.length===0){o.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator.translator.t(l);if(typeof l[0]=="object"){let n=l,r,u=false,x=n.map((s,p)=>{s=J(s);let c=t(s.dialogue)||"";return p===0?(r=t(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),r===false&&u&&(c=`
1
+ 'use strict';var core=require('@drincs/pixi-vn-json/core'),importer=require('@drincs/pixi-vn-json/importer'),translator=require('@drincs/pixi-vn-json/translator'),canvas=require('@drincs/pixi-vn/canvas'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),pixiVn=require('@drincs/pixi-vn'),storage=require('@drincs/pixi-vn/storage');var V="___param___";async function I(e){let a=core.JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await canvas.Assets.load(a.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await canvas.Assets.loadBundle(a.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(a.aliases);break}break}}var r;(n=>(n.log=(o,...u)=>console.log(`[Pixi\u2019VN Json] ${o}`,...u),n.warn=(o,...u)=>console.warn(`[Pixi\u2019VN Json] ${o}`,...u),n.error=(o,...u)=>console.error(`[Pixi\u2019VN Json] ${o}`,...u),n.info=(o,...u)=>console.info(`[Pixi\u2019VN Json] ${o}`,...u)))(r||(r={}));async function b(e,a,i){switch(i.type){case "fade":await canvas.showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await canvas.showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await canvas.moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await canvas.pushIn(a.alias,e,i.props,i.priority);break}}function T(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function v(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageSprite(e.props,e.url||e.alias);await b(i,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):r.error(`Image with alias ${e.alias} not found.`);break;case "remove":T(e);break}}async function _(e){switch(e.operationType){case "show":if(e.transition){let n=new canvas.VideoSprite(e.props,e.url||e.alias);await b(n,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):r.error(`Video with alias ${e.alias} not found.`);break;case "remove":T(e);break;case "pause":let i=canvas.canvas.find(e.alias);i?i.paused=true:r.error(`Video with alias ${e.alias} not found.`);break;case "resume":let l=canvas.canvas.find(e.alias);l?l.paused=false:r.error(`Video with alias ${e.alias} not found.`);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageContainer(e.props,e.urls);await b(i,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):r.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":T(e);break}}async function R(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let i=new canvas.Text(e.props);await b(i,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):r.error(`Text with alias ${e.alias} not found.`);break;case "remove":T(e);break}}async function L(e){switch(e.operationType){case "edit":try{let a=canvas.canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):r.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){r.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":T(e);break}}async function D(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function G(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function $(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function F(e){switch(e.operationType){case "play":sound.sound.play(e.alias,e.props);break;case "stop":sound.sound.stop(e.alias);break;case "pause":sound.sound.pause(e.alias);break;case "resume":sound.sound.resume(e.alias);break;case "volume":sound.sound.volume(e.alias,e.value);break}}function j(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,i);break;case "tempstorage":storage.storage.setTempVariable(e.key,i);break;case "params":let l=storage.storage.get(`${V}${narration.narration.openedLabels.length-1}`)||[];l&&l.length-1>=e.key&&(l[e.key]=i),storage.storage.setTempVariable(`${V}${narration.narration.openedLabels.length-1}`,l);break}}function U(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:i};break}}function t(e){let a=be(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return Ve(a);case "arithmetic":case "arithmeticsingle":return ye(a);case "compare":case "valueCondition":case "union":return Te(a)}return a}function ye(e){let a=t(e.leftValue);switch(e.type){case "arithmetic":let i=t(e.rightValue);switch(e.operator){case "*":return a*i;case "/":return a/i;case "+":return a+i;case "-":return a-i;case "%":return a%i;case "POW":return Math.pow(a,i);case "RANDOM":return narration.narration.getRandomNumber(a,i)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(a);case "FLOOR":return Math.floor(a);case "FLOAT":return parseFloat(a)}break}}function Ve(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return t(e.operation);case "params":let a=storage.storage.get(`${V}${narration.narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];r.warn("getValue params not found");return}return e}function Te(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=t(e.leftValue),i=t(e.rightValue);switch(e.operator){case "==":return a===i;case "!=":return a!==i;case "<":return a<i;case "<=":return a<=i;case ">":return a>i;case ">=":return a>=i;case "CONTAINS":return a.toString().includes(i.toString())}break;case "valueCondition":return !!t(e.value);case "union":return he(e)}return !!e}function he(e){if(e.unionType==="not")return !t(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=t(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function Ne(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function be(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return t(e.condition)?t(e.then):t(e.else);case "stepswitch":let i=t(e.elements)||[];if(i.length===0){r.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let l=Ne(0,i.length-1);return t(i[l]);case "loop":let n=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>i.length-1&&(n=n%i.length),t(i[n]);case "sequential":let o,u=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(o=t(i[i.length-1])),u>i.length-1?o:t(i[u]);case "sequentialrandom":let x=narration.NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(x==null&&e.end=="lastItem"){let m=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!m||!m?.usedRandomNumbers){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=m.usedRandomNumbers[`0-${i.length-1}`];return t(i[y[y.length-1]])}if(x==null){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return t(i[x])}}return e}function J(e){if(e.conditionalStep){let a=pixiVn.createExportableElement(t(e.conditionalStep));if(a?.glueEnabled===void 0&&delete a?.glueEnabled,a?.goNextStep===void 0&&delete a?.goNextStep,a?.end===void 0&&delete a?.end,a?.choices===void 0&&delete a?.choices,a?.dialogue===void 0&&delete a?.dialogue,a?.labelToOpen===void 0&&delete a?.labelToOpen,a?.operations===void 0&&delete a?.operations,a){let i={...e,conditionalStep:void 0,...a};return J(i)}else storage.storage.getFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);}return e}function Pe(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(o=>{let u=t(o);i.push(u);});else {let o=t(n);i.push(o);}});let l=a?[a,...i]:i;if(l.length===0){r.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator.translator.t(l);if(typeof l[0]=="object"){let n=l,o,u=false,x=n.map((s,p)=>{s=J(s);let d=t(s.dialogue)||"";return p===0?(o=t(s.glueEnabled)||false,d):(typeof d=="object"&&"text"in d&&(d=d.character+": "+d.text),o===false&&u&&(d=`
2
2
 
3
- `+c),c&&(u=true),r=t(s.glueEnabled)||false,c)}),m=t(x[0]),y=typeof m=="object"&&"character"in m?m.character:void 0,O=x.flatMap(s=>{let p;s&&typeof s=="object"&&"text"in s?p=s.text:p=s;let c;return Array.isArray(p)?c=p.map(Y=>{let H=t(Y);return translator.translator.t(`${H}`)}):c=t(p)||"",translator.translator.t(c)}),z=n.find(s=>s.end),W=n.find(s=>s.choices),E=false,k=false;n.length>0&&(n[0].glueEnabled&&n[0].goNextStep&&n[0].dialogue===void 0&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),E=n[n.length-1].glueEnabled,k=n.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let q=n.find(s=>s.labelToOpen),S=[];return n.forEach(s=>{s.operations&&(S=[...S,...s.operations]);}),{dialogue:y?{character:y,text:O}:O,end:z?.end,choices:W?.choices,glueEnabled:E,goNextStep:k,labelToOpen:q?.labelToOpen,operations:S}}}function sa(){unifier.JsonUnifier.init({animateOperation:G,canvasElementOperation:L,effectOperation:D,imageContainerOperation:_,imageOperation:v,textOperation:R,narrationOperation:$,loadAssets:I,soundOperation:F,videoOperation:A,setStorageValue:U,setInitialStorageValue:X,getLogichValue:t,getConditionalStep:J});}exports.PIXIVNJSON_PARAM_ID=V;exports.init=sa;Object.keys(importer).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return importer[k]}})});Object.keys(translator).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return translator[k]}})});Object.keys(unifier).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return unifier[k]}})});
3
+ `+d),d&&(u=true),o=t(s.glueEnabled)||false,d)}),m=t(x[0]),y=typeof m=="object"&&"character"in m?m.character:void 0,O=x.flatMap(s=>{let p;s&&typeof s=="object"&&"text"in s?p=s.text:p=s;let d;return Array.isArray(p)?d=p.map(q=>{let Y=t(q);return translator.translator.t(`${Y}`)}):d=t(p)||"",translator.translator.t(d)}),X=n.find(s=>s.end),z=n.find(s=>s.choices),k=false,E=false;n.length>0&&(n[0].glueEnabled&&n[0].goNextStep&&n[0].dialogue===void 0&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),k=n[n.length-1].glueEnabled,E=n.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let W=n.find(s=>s.labelToOpen),S=[];return n.forEach(s=>{s.operations&&(S=[...S,...s.operations]);}),{dialogue:y?{character:y,text:O}:O,end:X?.end,choices:z?.choices,glueEnabled:k,goNextStep:E,labelToOpen:W?.labelToOpen,operations:S}}}function ta({_getLogichValue:e=t}){core.JsonUnifier.init({animateOperation:G,canvasElementOperation:L,effectOperation:D,imageContainerOperation:A,imageOperation:v,textOperation:R,narrationOperation:$,loadAssets:I,soundOperation:F,videoOperation:_,setStorageValue:j,setInitialStorageValue:U,getLogichValue:e,getConditionalStep:J});}exports.PIXIVNJSON_PARAM_ID=V;exports.init=ta;Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(importer).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return importer[k]}})});Object.keys(translator).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return translator[k]}})});
package/dist/index.d.cts CHANGED
@@ -1,7 +1,9 @@
1
+ export * from '@drincs/pixi-vn-json/core';
1
2
  export * from '@drincs/pixi-vn-json/importer';
2
3
  export * from '@drincs/pixi-vn-json/translator';
3
- export * from '@drincs/pixi-vn-json/unifier';
4
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
4
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
5
+ import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
6
+ import { UPDATE_PRIORITY } from 'pixi.js';
5
7
 
6
8
  declare const PIXIVNJSON_PARAM_ID = "___param___";
7
9
 
@@ -548,6 +550,8 @@ interface PixiVNJson {
548
550
  labels?: PixiVNJsonLabels;
549
551
  }
550
552
 
551
- declare function init(): void;
553
+ declare function init({ _getLogichValue, }: {
554
+ _getLogichValue?: <T = StorageElementType>(value: T, defaultFn: (value: T) => T | undefined) => T | undefined;
555
+ }): void;
552
556
 
553
557
  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 PixiVNJsonChoice, type PixiVNJsonChoiceGet, type PixiVNJsonChoices, type PixiVNJsonComparation, type PixiVNJsonConditionalOperation, type PixiVNJsonConditionalResultToCombine, type PixiVNJsonConditionalStatements, type PixiVNJsonConditions, type PixiVNJsonDialog, type PixiVNJsonDialogText, type PixiVNJsonIfElse, type PixiVNJsonLabelGet, type PixiVNJsonLabelStep, type PixiVNJsonLabelToOpen, type PixiVNJsonLabels, type PixiVNJsonLogicGet, type PixiVNJsonMediaTransiotions, type PixiVNJsonNarration, type PixiVNJsonOperation, type PixiVNJsonOperationString, type PixiVNJsonParamGet, type PixiVNJsonSound, type PixiVNJsonStepSwitch, type PixiVNJsonStepSwitchElementType, type PixiVNJsonStepSwitchElementsType, type PixiVNJsonStorageGet, type PixiVNJsonUnionCondition, type PixiVNJsonValueGet, type PixiVNJsonValueSet, init };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
+ export * from '@drincs/pixi-vn-json/core';
1
2
  export * from '@drincs/pixi-vn-json/importer';
2
3
  export * from '@drincs/pixi-vn-json/translator';
3
- export * from '@drincs/pixi-vn-json/unifier';
4
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
4
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
5
+ import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
6
+ import { UPDATE_PRIORITY } from 'pixi.js';
5
7
 
6
8
  declare const PIXIVNJSON_PARAM_ID = "___param___";
7
9
 
@@ -548,6 +550,8 @@ interface PixiVNJson {
548
550
  labels?: PixiVNJsonLabels;
549
551
  }
550
552
 
551
- declare function init(): void;
553
+ declare function init({ _getLogichValue, }: {
554
+ _getLogichValue?: <T = StorageElementType>(value: T, defaultFn: (value: T) => T | undefined) => T | undefined;
555
+ }): void;
552
556
 
553
557
  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 PixiVNJsonChoice, type PixiVNJsonChoiceGet, type PixiVNJsonChoices, type PixiVNJsonComparation, type PixiVNJsonConditionalOperation, type PixiVNJsonConditionalResultToCombine, type PixiVNJsonConditionalStatements, type PixiVNJsonConditions, type PixiVNJsonDialog, type PixiVNJsonDialogText, type PixiVNJsonIfElse, type PixiVNJsonLabelGet, type PixiVNJsonLabelStep, type PixiVNJsonLabelToOpen, type PixiVNJsonLabels, type PixiVNJsonLogicGet, type PixiVNJsonMediaTransiotions, type PixiVNJsonNarration, type PixiVNJsonOperation, type PixiVNJsonOperationString, type PixiVNJsonParamGet, type PixiVNJsonSound, type PixiVNJsonStepSwitch, type PixiVNJsonStepSwitchElementType, type PixiVNJsonStepSwitchElementsType, type PixiVNJsonStorageGet, type PixiVNJsonUnionCondition, type PixiVNJsonValueGet, type PixiVNJsonValueSet, init };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export*from'@drincs/pixi-vn-json/importer';import {translator as translator$1}from'@drincs/pixi-vn-json/translator';export*from'@drincs/pixi-vn-json/translator';import {JsonUnifier}from'@drincs/pixi-vn-json/unifier';export*from'@drincs/pixi-vn-json/unifier';import {canvas,VideoSprite,showVideo,Assets,Text,showText,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {narration,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';var V="___param___";async function I(e){let a=JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await Assets.load(a.aliases);break;case "lazyload":Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await Assets.loadBundle(a.aliases);break;case "lazyload":Assets.backgroundLoadBundle(a.aliases);break}break}}var o;(n=>(n.log=(r,...u)=>console.log(`[Pixi\u2019VN Json] ${r}`,...u),n.warn=(r,...u)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...u),n.error=(r,...u)=>console.error(`[Pixi\u2019VN Json] ${r}`,...u),n.info=(r,...u)=>console.info(`[Pixi\u2019VN Json] ${r}`,...u)))(o||(o={}));async function b(e,a,i){switch(i.type){case "fade":await showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(a.alias,e,i.props,i.priority);break}}function h(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 v(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageSprite(e.props,e.url||e.alias);await b(i,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Image with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let n=new VideoSprite(e.props,e.url||e.alias);await b(n,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Video with alias ${e.alias} not found.`);break;case "remove":h(e);break;case "pause":let i=canvas.find(e.alias);i?i.paused=true:o.error(`Video with alias ${e.alias} not found.`);break;case "resume":let l=canvas.find(e.alias);l?l.paused=false:o.error(`Video with alias ${e.alias} not found.`);break}}async function _(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageContainer(e.props,e.urls);await b(i,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function R(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator$1.t(e.text),e.transition){let i=new Text(e.props);await b(i,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Text with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function L(e){switch(e.operationType){case "edit":try{let a=canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):o.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){o.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":h(e);break}}async function D(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function G(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 $(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function F(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 j(e){try{if(typeof e>"u")return e;let a=JSON.stringify(e);return JSON.parse(a)}catch(a){throw o.error("Error creating exportable element",e,a),new Error("[Pixi\u2019VN] Error creating exportable element")}}function U(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,i);break;case "tempstorage":storage.setTempVariable(e.key,i);break;case "params":let l=storage.get(`${V}${narration.openedLabels.length-1}`)||[];l&&l.length-1>=e.key&&(l[e.key]=i),storage.setTempVariable(`${V}${narration.openedLabels.length-1}`,l);break}}function X(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:i};break}}function t(e){let a=be(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return Ve(a);case "arithmetic":case "arithmeticsingle":return ye(a);case "compare":case "valueCondition":case "union":return he(a)}return a}function ye(e){let a=t(e.leftValue);switch(e.type){case "arithmetic":let i=t(e.rightValue);switch(e.operator){case "*":return a*i;case "/":return a/i;case "+":return a+i;case "-":return a-i;case "%":return a%i;case "POW":return Math.pow(a,i);case "RANDOM":return narration.getRandomNumber(a,i)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(a);case "FLOOR":return Math.floor(a);case "FLOAT":return parseFloat(a)}break}}function Ve(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.get(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 t(e.operation);case "params":let a=storage.get(`${V}${narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];o.warn("getValue params not found");return}return e}function he(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=t(e.leftValue),i=t(e.rightValue);switch(e.operator){case "==":return a===i;case "!=":return a!==i;case "<":return a<i;case "<=":return a<=i;case ">":return a>i;case ">=":return a>=i;case "CONTAINS":return a.toString().includes(i.toString())}break;case "valueCondition":return !!t(e.value);case "union":return Te(e)}return !!e}function Te(e){if(e.unionType==="not")return !t(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=t(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function Ne(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function be(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return t(e.condition)?t(e.then):t(e.else);case "stepswitch":let i=t(e.elements)||[];if(i.length===0){o.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let l=Ne(0,i.length-1);return t(i[l]);case "loop":let n=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>i.length-1&&(n=n%i.length),t(i[n]);case "sequential":let r,u=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(r=t(i[i.length-1])),u>i.length-1?r:t(i[u]);case "sequentialrandom":let x=NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(x==null&&e.end=="lastItem"){let m=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!m||!m?.usedRandomNumbers){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=m.usedRandomNumbers[`0-${i.length-1}`];return t(i[y[y.length-1]])}if(x==null){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return t(i[x])}}return e}function J(e){if(e.conditionalStep){let a=j(t(e.conditionalStep));if(a?.glueEnabled===void 0&&delete a?.glueEnabled,a?.goNextStep===void 0&&delete a?.goNextStep,a?.end===void 0&&delete a?.end,a?.choices===void 0&&delete a?.choices,a?.dialogue===void 0&&delete a?.dialogue,a?.labelToOpen===void 0&&delete a?.labelToOpen,a?.operations===void 0&&delete a?.operations,a){let i={...e,conditionalStep:void 0,...a};return J(i)}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 Pe(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(r=>{let u=t(r);i.push(u);});else {let r=t(n);i.push(r);}});let l=a?[a,...i]:i;if(l.length===0){o.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator$1.t(l);if(typeof l[0]=="object"){let n=l,r,u=false,x=n.map((s,p)=>{s=J(s);let c=t(s.dialogue)||"";return p===0?(r=t(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),r===false&&u&&(c=`
1
+ import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/importer';import {translator as translator$1}from'@drincs/pixi-vn-json/translator';export*from'@drincs/pixi-vn-json/translator';import {canvas,VideoSprite,showVideo,Assets,Text,showText,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {narration,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {createExportableElement}from'@drincs/pixi-vn';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';var V="___param___";async function I(e){let a=JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await Assets.load(a.aliases);break;case "lazyload":Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await Assets.loadBundle(a.aliases);break;case "lazyload":Assets.backgroundLoadBundle(a.aliases);break}break}}var r;(n=>(n.log=(o,...u)=>console.log(`[Pixi\u2019VN Json] ${o}`,...u),n.warn=(o,...u)=>console.warn(`[Pixi\u2019VN Json] ${o}`,...u),n.error=(o,...u)=>console.error(`[Pixi\u2019VN Json] ${o}`,...u),n.info=(o,...u)=>console.info(`[Pixi\u2019VN Json] ${o}`,...u)))(r||(r={}));async function b(e,a,i){switch(i.type){case "fade":await showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(a.alias,e,i.props,i.priority);break}}function T(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 v(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageSprite(e.props,e.url||e.alias);await b(i,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):r.error(`Image with alias ${e.alias} not found.`);break;case "remove":T(e);break}}async function _(e){switch(e.operationType){case "show":if(e.transition){let n=new VideoSprite(e.props,e.url||e.alias);await b(n,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):r.error(`Video with alias ${e.alias} not found.`);break;case "remove":T(e);break;case "pause":let i=canvas.find(e.alias);i?i.paused=true:r.error(`Video with alias ${e.alias} not found.`);break;case "resume":let l=canvas.find(e.alias);l?l.paused=false:r.error(`Video with alias ${e.alias} not found.`);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageContainer(e.props,e.urls);await b(i,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):r.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":T(e);break}}async function R(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator$1.t(e.text),e.transition){let i=new Text(e.props);await b(i,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):r.error(`Text with alias ${e.alias} not found.`);break;case "remove":T(e);break}}async function L(e){switch(e.operationType){case "edit":try{let a=canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):r.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){r.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":T(e);break}}async function D(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function G(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 $(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function F(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 j(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,i);break;case "tempstorage":storage.setTempVariable(e.key,i);break;case "params":let l=storage.get(`${V}${narration.openedLabels.length-1}`)||[];l&&l.length-1>=e.key&&(l[e.key]=i),storage.setTempVariable(`${V}${narration.openedLabels.length-1}`,l);break}}function U(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:i};break}}function t(e){let a=be(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return Ve(a);case "arithmetic":case "arithmeticsingle":return ye(a);case "compare":case "valueCondition":case "union":return Te(a)}return a}function ye(e){let a=t(e.leftValue);switch(e.type){case "arithmetic":let i=t(e.rightValue);switch(e.operator){case "*":return a*i;case "/":return a/i;case "+":return a+i;case "-":return a-i;case "%":return a%i;case "POW":return Math.pow(a,i);case "RANDOM":return narration.getRandomNumber(a,i)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(a);case "FLOOR":return Math.floor(a);case "FLOAT":return parseFloat(a)}break}}function Ve(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.get(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 t(e.operation);case "params":let a=storage.get(`${V}${narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];r.warn("getValue params not found");return}return e}function Te(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=t(e.leftValue),i=t(e.rightValue);switch(e.operator){case "==":return a===i;case "!=":return a!==i;case "<":return a<i;case "<=":return a<=i;case ">":return a>i;case ">=":return a>=i;case "CONTAINS":return a.toString().includes(i.toString())}break;case "valueCondition":return !!t(e.value);case "union":return he(e)}return !!e}function he(e){if(e.unionType==="not")return !t(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=t(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function Ne(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function be(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return t(e.condition)?t(e.then):t(e.else);case "stepswitch":let i=t(e.elements)||[];if(i.length===0){r.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let l=Ne(0,i.length-1);return t(i[l]);case "loop":let n=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>i.length-1&&(n=n%i.length),t(i[n]);case "sequential":let o,u=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(o=t(i[i.length-1])),u>i.length-1?o:t(i[u]);case "sequentialrandom":let x=NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(x==null&&e.end=="lastItem"){let m=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!m||!m?.usedRandomNumbers){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=m.usedRandomNumbers[`0-${i.length-1}`];return t(i[y[y.length-1]])}if(x==null){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return t(i[x])}}return e}function J(e){if(e.conditionalStep){let a=createExportableElement(t(e.conditionalStep));if(a?.glueEnabled===void 0&&delete a?.glueEnabled,a?.goNextStep===void 0&&delete a?.goNextStep,a?.end===void 0&&delete a?.end,a?.choices===void 0&&delete a?.choices,a?.dialogue===void 0&&delete a?.dialogue,a?.labelToOpen===void 0&&delete a?.labelToOpen,a?.operations===void 0&&delete a?.operations,a){let i={...e,conditionalStep:void 0,...a};return J(i)}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 Pe(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(o=>{let u=t(o);i.push(u);});else {let o=t(n);i.push(o);}});let l=a?[a,...i]:i;if(l.length===0){r.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator$1.t(l);if(typeof l[0]=="object"){let n=l,o,u=false,x=n.map((s,p)=>{s=J(s);let d=t(s.dialogue)||"";return p===0?(o=t(s.glueEnabled)||false,d):(typeof d=="object"&&"text"in d&&(d=d.character+": "+d.text),o===false&&u&&(d=`
2
2
 
3
- `+c),c&&(u=true),r=t(s.glueEnabled)||false,c)}),m=t(x[0]),y=typeof m=="object"&&"character"in m?m.character:void 0,O=x.flatMap(s=>{let p;s&&typeof s=="object"&&"text"in s?p=s.text:p=s;let c;return Array.isArray(p)?c=p.map(Y=>{let H=t(Y);return translator$1.t(`${H}`)}):c=t(p)||"",translator$1.t(c)}),z=n.find(s=>s.end),W=n.find(s=>s.choices),E=false,k=false;n.length>0&&(n[0].glueEnabled&&n[0].goNextStep&&n[0].dialogue===void 0&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),E=n[n.length-1].glueEnabled,k=n.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let q=n.find(s=>s.labelToOpen),S=[];return n.forEach(s=>{s.operations&&(S=[...S,...s.operations]);}),{dialogue:y?{character:y,text:O}:O,end:z?.end,choices:W?.choices,glueEnabled:E,goNextStep:k,labelToOpen:q?.labelToOpen,operations:S}}}function sa(){JsonUnifier.init({animateOperation:G,canvasElementOperation:L,effectOperation:D,imageContainerOperation:_,imageOperation:v,textOperation:R,narrationOperation:$,loadAssets:I,soundOperation:F,videoOperation:A,setStorageValue:U,setInitialStorageValue:X,getLogichValue:t,getConditionalStep:J});}export{V as PIXIVNJSON_PARAM_ID,sa as init};
3
+ `+d),d&&(u=true),o=t(s.glueEnabled)||false,d)}),m=t(x[0]),y=typeof m=="object"&&"character"in m?m.character:void 0,O=x.flatMap(s=>{let p;s&&typeof s=="object"&&"text"in s?p=s.text:p=s;let d;return Array.isArray(p)?d=p.map(q=>{let Y=t(q);return translator$1.t(`${Y}`)}):d=t(p)||"",translator$1.t(d)}),X=n.find(s=>s.end),z=n.find(s=>s.choices),k=false,E=false;n.length>0&&(n[0].glueEnabled&&n[0].goNextStep&&n[0].dialogue===void 0&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),k=n[n.length-1].glueEnabled,E=n.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let W=n.find(s=>s.labelToOpen),S=[];return n.forEach(s=>{s.operations&&(S=[...S,...s.operations]);}),{dialogue:y?{character:y,text:O}:O,end:X?.end,choices:z?.choices,glueEnabled:k,goNextStep:E,labelToOpen:W?.labelToOpen,operations:S}}}function ta({_getLogichValue:e=t}){JsonUnifier.init({animateOperation:G,canvasElementOperation:L,effectOperation:D,imageContainerOperation:A,imageOperation:v,textOperation:R,narrationOperation:$,loadAssets:I,soundOperation:F,videoOperation:_,setStorageValue:j,setInitialStorageValue:U,getLogichValue:e,getConditionalStep:J});}export{V as PIXIVNJSON_PARAM_ID,ta as init};
@@ -1 +1 @@
1
- 'use strict';var unifier=require('@drincs/pixi-vn-json/unifier');var V=Object.defineProperty;var J=(y,e,i)=>e in y?V(y,e,{enumerable:true,configurable:true,writable:true,value:i}):y[e]=i;var m=(y,e,i)=>J(y,typeof e!="symbol"?e+"":e,i);function E(y){let e="";return y.values.forEach(i=>{if(typeof i=="string")e+=i;else {let n=unifier.JsonUnifier.getLogichValue(i);e+=`${n}`;}}),e}var t=class t{static t(e){return Array.isArray(e)?e.map(i=>t.translate(`${i}`)):t.translate(`${e}`)}static set beforeToTranslate(e){t._beforeToTranslate=e;}static set translate(e){t._translate=e;}static get translate(){return e=>{let i=e;return t._beforeToTranslate&&(i=t._beforeToTranslate(i)),i=t._translate(i),t._afterToTranslate&&(i=t._afterToTranslate(i)),i}}static set afterToTranslate(e){t._afterToTranslate=e;}static addKey(e,i,n){let s=n.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(f=>{e[f]===void 0&&(s==="empty_string"?e[f]="":s==="copy_key"&&(t._beforeToTranslate?e[f]=t._beforeToTranslate(f):e[f]=f));});}static getConditionalsThenElse(e,i=[]){if(typeof e=="object"&&e&&"type"in e)if(e.type==="ifelse")e.then&&t.getConditionalsThenElse(e.then,i),e.else&&t.getConditionalsThenElse(e.else,i);else if(e.type==="stepswitch"){if(e.elements)if(Array.isArray(e.elements))e.elements.forEach(n=>{t.getConditionalsThenElse(n,i);});else if(e.elements.type==="ifelse"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else if(e.elements.type==="stepswitch"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else t.getConditionalsThenElse(e.elements,i);}else e.type==="resulttocombine"?(e.firstItem&&t.getConditionalsThenElse(e.firstItem,i),e.secondConditionalItem&&e.secondConditionalItem.forEach(n=>{t.getConditionalsThenElse(n,i);})):i.push(e);else e&&i.push(e);return i}static async generateJsonTranslation(e,i={},n={}){let{defaultValue:s="copy_key",operationStringConvert:f}=n,C=e.map(async o=>{if(o.choices){let r=[];Array.isArray(o.choices)?r=[o.choices]:r=t.getConditionalsThenElse(o.choices),r.forEach(l=>l.forEach(a=>{if("type"in a){let T=[];a.type==="ifelse"||a.type==="stepswitch"?t.getConditionalsThenElse(a,T):T=[a],T.map(p=>t.getConditionalsThenElse(p.text)).forEach(p=>{Array.isArray(p)&&p.forEach(g=>{Array.isArray(g)?g.forEach(c=>{typeof c=="string"?t.addKey(i,c,{defaultValue:s}):t.getConditionalsThenElse(c).forEach(d=>{Array.isArray(d)?d.forEach(u=>{typeof u=="string"&&t.addKey(i,u,{defaultValue:s});}):typeof d=="string"&&t.addKey(i,d,{defaultValue:s});});}):typeof g=="string"&&t.addKey(i,g,{defaultValue:s});});});}}));}if(o.dialogue){let r=[];Array.isArray(o.dialogue)?r=[o.dialogue]:r=t.getConditionalsThenElse(o.dialogue),r.forEach(l=>{if(typeof l=="string")t.addKey(i,l,{defaultValue:s});else if("text"in l){let a=t.getConditionalsThenElse(l.text);typeof a=="string"&&(a=[a]),a.forEach(T=>{typeof T=="string"?t.addKey(i,T,{defaultValue:s}):t.getConditionalsThenElse(T).forEach(p=>{typeof p=="string"?t.addKey(i,p,{defaultValue:s}):Array.isArray(p)&&p.forEach(g=>{typeof g=="string"?t.addKey(i,g,{defaultValue:s}):t.getConditionalsThenElse(g).forEach(c=>{typeof c=="string"&&t.addKey(i,c,{defaultValue:s});});});});});}});}if(o.operations)for(let r of o.operations){if(r.type==="operationtoconvert"&&f){let l=E(r),a=await f(l,o,{});if(!a)return;r=a;}r.type==="text"&&r.operationType==="show"&&t.addKey(i,r.text,{defaultValue:s});}o.conditionalStep&&t.getConditionalsThenElse(o.conditionalStep).forEach(l=>{Array.isArray(l)?t.generateJsonTranslation(l,i,n):t.generateJsonTranslation([l],i,n);});});return await Promise.all(C),i}};m(t,"_beforeToTranslate"),m(t,"_translate",e=>e),m(t,"_afterToTranslate");var h=t;var L=h;exports.translator=L;
1
+ 'use strict';var core=require('@drincs/pixi-vn-json/core');var V=Object.defineProperty;var J=(y,e,i)=>e in y?V(y,e,{enumerable:true,configurable:true,writable:true,value:i}):y[e]=i;var m=(y,e,i)=>J(y,typeof e!="symbol"?e+"":e,i);function E(y){let e="";return y.values.forEach(i=>{if(typeof i=="string")e+=i;else {let n=core.JsonUnifier.getLogichValue(i);e+=`${n}`;}}),e}var t=class t{static t(e){return Array.isArray(e)?e.map(i=>t.translate(`${i}`)):t.translate(`${e}`)}static set beforeToTranslate(e){t._beforeToTranslate=e;}static set translate(e){t._translate=e;}static get translate(){return e=>{let i=e;return t._beforeToTranslate&&(i=t._beforeToTranslate(i)),i=t._translate(i),t._afterToTranslate&&(i=t._afterToTranslate(i)),i}}static set afterToTranslate(e){t._afterToTranslate=e;}static addKey(e,i,n){let s=n.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(f=>{e[f]===void 0&&(s==="empty_string"?e[f]="":s==="copy_key"&&(t._beforeToTranslate?e[f]=t._beforeToTranslate(f):e[f]=f));});}static getConditionalsThenElse(e,i=[]){if(typeof e=="object"&&e&&"type"in e)if(e.type==="ifelse")e.then&&t.getConditionalsThenElse(e.then,i),e.else&&t.getConditionalsThenElse(e.else,i);else if(e.type==="stepswitch"){if(e.elements)if(Array.isArray(e.elements))e.elements.forEach(n=>{t.getConditionalsThenElse(n,i);});else if(e.elements.type==="ifelse"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else if(e.elements.type==="stepswitch"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else t.getConditionalsThenElse(e.elements,i);}else e.type==="resulttocombine"?(e.firstItem&&t.getConditionalsThenElse(e.firstItem,i),e.secondConditionalItem&&e.secondConditionalItem.forEach(n=>{t.getConditionalsThenElse(n,i);})):i.push(e);else e&&i.push(e);return i}static async generateJsonTranslation(e,i={},n={}){let{defaultValue:s="copy_key",operationStringConvert:f}=n,C=e.map(async o=>{if(o.choices){let r=[];Array.isArray(o.choices)?r=[o.choices]:r=t.getConditionalsThenElse(o.choices),r.forEach(l=>l.forEach(a=>{if("type"in a){let T=[];a.type==="ifelse"||a.type==="stepswitch"?t.getConditionalsThenElse(a,T):T=[a],T.map(p=>t.getConditionalsThenElse(p.text)).forEach(p=>{Array.isArray(p)&&p.forEach(g=>{Array.isArray(g)?g.forEach(c=>{typeof c=="string"?t.addKey(i,c,{defaultValue:s}):t.getConditionalsThenElse(c).forEach(d=>{Array.isArray(d)?d.forEach(u=>{typeof u=="string"&&t.addKey(i,u,{defaultValue:s});}):typeof d=="string"&&t.addKey(i,d,{defaultValue:s});});}):typeof g=="string"&&t.addKey(i,g,{defaultValue:s});});});}}));}if(o.dialogue){let r=[];Array.isArray(o.dialogue)?r=[o.dialogue]:r=t.getConditionalsThenElse(o.dialogue),r.forEach(l=>{if(typeof l=="string")t.addKey(i,l,{defaultValue:s});else if("text"in l){let a=t.getConditionalsThenElse(l.text);typeof a=="string"&&(a=[a]),a.forEach(T=>{typeof T=="string"?t.addKey(i,T,{defaultValue:s}):t.getConditionalsThenElse(T).forEach(p=>{typeof p=="string"?t.addKey(i,p,{defaultValue:s}):Array.isArray(p)&&p.forEach(g=>{typeof g=="string"?t.addKey(i,g,{defaultValue:s}):t.getConditionalsThenElse(g).forEach(c=>{typeof c=="string"&&t.addKey(i,c,{defaultValue:s});});});});});}});}if(o.operations)for(let r of o.operations){if(r.type==="operationtoconvert"&&f){let l=E(r),a=await f(l,o,{});if(!a)return;r=a;}r.type==="text"&&r.operationType==="show"&&t.addKey(i,r.text,{defaultValue:s});}o.conditionalStep&&t.getConditionalsThenElse(o.conditionalStep).forEach(l=>{Array.isArray(l)?t.generateJsonTranslation(l,i,n):t.generateJsonTranslation([l],i,n);});});return await Promise.all(C),i}};m(t,"_beforeToTranslate"),m(t,"_translate",e=>e),m(t,"_afterToTranslate");var h=t;var L=h;exports.translator=L;
@@ -1,4 +1,6 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
2
+ import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
3
+ import { UPDATE_PRIORITY } from 'pixi.js';
2
4
 
3
5
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
4
6
  type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
@@ -1,4 +1,6 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
2
+ import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
3
+ import { UPDATE_PRIORITY } from 'pixi.js';
2
4
 
3
5
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
4
6
  type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
@@ -1 +1 @@
1
- import {JsonUnifier}from'@drincs/pixi-vn-json/unifier';var V=Object.defineProperty;var J=(y,e,i)=>e in y?V(y,e,{enumerable:true,configurable:true,writable:true,value:i}):y[e]=i;var m=(y,e,i)=>J(y,typeof e!="symbol"?e+"":e,i);function E(y){let e="";return y.values.forEach(i=>{if(typeof i=="string")e+=i;else {let n=JsonUnifier.getLogichValue(i);e+=`${n}`;}}),e}var t=class t{static t(e){return Array.isArray(e)?e.map(i=>t.translate(`${i}`)):t.translate(`${e}`)}static set beforeToTranslate(e){t._beforeToTranslate=e;}static set translate(e){t._translate=e;}static get translate(){return e=>{let i=e;return t._beforeToTranslate&&(i=t._beforeToTranslate(i)),i=t._translate(i),t._afterToTranslate&&(i=t._afterToTranslate(i)),i}}static set afterToTranslate(e){t._afterToTranslate=e;}static addKey(e,i,n){let s=n.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(f=>{e[f]===void 0&&(s==="empty_string"?e[f]="":s==="copy_key"&&(t._beforeToTranslate?e[f]=t._beforeToTranslate(f):e[f]=f));});}static getConditionalsThenElse(e,i=[]){if(typeof e=="object"&&e&&"type"in e)if(e.type==="ifelse")e.then&&t.getConditionalsThenElse(e.then,i),e.else&&t.getConditionalsThenElse(e.else,i);else if(e.type==="stepswitch"){if(e.elements)if(Array.isArray(e.elements))e.elements.forEach(n=>{t.getConditionalsThenElse(n,i);});else if(e.elements.type==="ifelse"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else if(e.elements.type==="stepswitch"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else t.getConditionalsThenElse(e.elements,i);}else e.type==="resulttocombine"?(e.firstItem&&t.getConditionalsThenElse(e.firstItem,i),e.secondConditionalItem&&e.secondConditionalItem.forEach(n=>{t.getConditionalsThenElse(n,i);})):i.push(e);else e&&i.push(e);return i}static async generateJsonTranslation(e,i={},n={}){let{defaultValue:s="copy_key",operationStringConvert:f}=n,C=e.map(async o=>{if(o.choices){let r=[];Array.isArray(o.choices)?r=[o.choices]:r=t.getConditionalsThenElse(o.choices),r.forEach(l=>l.forEach(a=>{if("type"in a){let T=[];a.type==="ifelse"||a.type==="stepswitch"?t.getConditionalsThenElse(a,T):T=[a],T.map(p=>t.getConditionalsThenElse(p.text)).forEach(p=>{Array.isArray(p)&&p.forEach(g=>{Array.isArray(g)?g.forEach(c=>{typeof c=="string"?t.addKey(i,c,{defaultValue:s}):t.getConditionalsThenElse(c).forEach(d=>{Array.isArray(d)?d.forEach(u=>{typeof u=="string"&&t.addKey(i,u,{defaultValue:s});}):typeof d=="string"&&t.addKey(i,d,{defaultValue:s});});}):typeof g=="string"&&t.addKey(i,g,{defaultValue:s});});});}}));}if(o.dialogue){let r=[];Array.isArray(o.dialogue)?r=[o.dialogue]:r=t.getConditionalsThenElse(o.dialogue),r.forEach(l=>{if(typeof l=="string")t.addKey(i,l,{defaultValue:s});else if("text"in l){let a=t.getConditionalsThenElse(l.text);typeof a=="string"&&(a=[a]),a.forEach(T=>{typeof T=="string"?t.addKey(i,T,{defaultValue:s}):t.getConditionalsThenElse(T).forEach(p=>{typeof p=="string"?t.addKey(i,p,{defaultValue:s}):Array.isArray(p)&&p.forEach(g=>{typeof g=="string"?t.addKey(i,g,{defaultValue:s}):t.getConditionalsThenElse(g).forEach(c=>{typeof c=="string"&&t.addKey(i,c,{defaultValue:s});});});});});}});}if(o.operations)for(let r of o.operations){if(r.type==="operationtoconvert"&&f){let l=E(r),a=await f(l,o,{});if(!a)return;r=a;}r.type==="text"&&r.operationType==="show"&&t.addKey(i,r.text,{defaultValue:s});}o.conditionalStep&&t.getConditionalsThenElse(o.conditionalStep).forEach(l=>{Array.isArray(l)?t.generateJsonTranslation(l,i,n):t.generateJsonTranslation([l],i,n);});});return await Promise.all(C),i}};m(t,"_beforeToTranslate"),m(t,"_translate",e=>e),m(t,"_afterToTranslate");var h=t;var L=h;export{L as translator};
1
+ import {JsonUnifier}from'@drincs/pixi-vn-json/core';var V=Object.defineProperty;var J=(y,e,i)=>e in y?V(y,e,{enumerable:true,configurable:true,writable:true,value:i}):y[e]=i;var m=(y,e,i)=>J(y,typeof e!="symbol"?e+"":e,i);function E(y){let e="";return y.values.forEach(i=>{if(typeof i=="string")e+=i;else {let n=JsonUnifier.getLogichValue(i);e+=`${n}`;}}),e}var t=class t{static t(e){return Array.isArray(e)?e.map(i=>t.translate(`${i}`)):t.translate(`${e}`)}static set beforeToTranslate(e){t._beforeToTranslate=e;}static set translate(e){t._translate=e;}static get translate(){return e=>{let i=e;return t._beforeToTranslate&&(i=t._beforeToTranslate(i)),i=t._translate(i),t._afterToTranslate&&(i=t._afterToTranslate(i)),i}}static set afterToTranslate(e){t._afterToTranslate=e;}static addKey(e,i,n){let s=n.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(f=>{e[f]===void 0&&(s==="empty_string"?e[f]="":s==="copy_key"&&(t._beforeToTranslate?e[f]=t._beforeToTranslate(f):e[f]=f));});}static getConditionalsThenElse(e,i=[]){if(typeof e=="object"&&e&&"type"in e)if(e.type==="ifelse")e.then&&t.getConditionalsThenElse(e.then,i),e.else&&t.getConditionalsThenElse(e.else,i);else if(e.type==="stepswitch"){if(e.elements)if(Array.isArray(e.elements))e.elements.forEach(n=>{t.getConditionalsThenElse(n,i);});else if(e.elements.type==="ifelse"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else if(e.elements.type==="stepswitch"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else t.getConditionalsThenElse(e.elements,i);}else e.type==="resulttocombine"?(e.firstItem&&t.getConditionalsThenElse(e.firstItem,i),e.secondConditionalItem&&e.secondConditionalItem.forEach(n=>{t.getConditionalsThenElse(n,i);})):i.push(e);else e&&i.push(e);return i}static async generateJsonTranslation(e,i={},n={}){let{defaultValue:s="copy_key",operationStringConvert:f}=n,C=e.map(async o=>{if(o.choices){let r=[];Array.isArray(o.choices)?r=[o.choices]:r=t.getConditionalsThenElse(o.choices),r.forEach(l=>l.forEach(a=>{if("type"in a){let T=[];a.type==="ifelse"||a.type==="stepswitch"?t.getConditionalsThenElse(a,T):T=[a],T.map(p=>t.getConditionalsThenElse(p.text)).forEach(p=>{Array.isArray(p)&&p.forEach(g=>{Array.isArray(g)?g.forEach(c=>{typeof c=="string"?t.addKey(i,c,{defaultValue:s}):t.getConditionalsThenElse(c).forEach(d=>{Array.isArray(d)?d.forEach(u=>{typeof u=="string"&&t.addKey(i,u,{defaultValue:s});}):typeof d=="string"&&t.addKey(i,d,{defaultValue:s});});}):typeof g=="string"&&t.addKey(i,g,{defaultValue:s});});});}}));}if(o.dialogue){let r=[];Array.isArray(o.dialogue)?r=[o.dialogue]:r=t.getConditionalsThenElse(o.dialogue),r.forEach(l=>{if(typeof l=="string")t.addKey(i,l,{defaultValue:s});else if("text"in l){let a=t.getConditionalsThenElse(l.text);typeof a=="string"&&(a=[a]),a.forEach(T=>{typeof T=="string"?t.addKey(i,T,{defaultValue:s}):t.getConditionalsThenElse(T).forEach(p=>{typeof p=="string"?t.addKey(i,p,{defaultValue:s}):Array.isArray(p)&&p.forEach(g=>{typeof g=="string"?t.addKey(i,g,{defaultValue:s}):t.getConditionalsThenElse(g).forEach(c=>{typeof c=="string"&&t.addKey(i,c,{defaultValue:s});});});});});}});}if(o.operations)for(let r of o.operations){if(r.type==="operationtoconvert"&&f){let l=E(r),a=await f(l,o,{});if(!a)return;r=a;}r.type==="text"&&r.operationType==="show"&&t.addKey(i,r.text,{defaultValue:s});}o.conditionalStep&&t.getConditionalsThenElse(o.conditionalStep).forEach(l=>{Array.isArray(l)?t.generateJsonTranslation(l,i,n):t.generateJsonTranslation([l],i,n);});});return await Promise.all(C),i}};m(t,"_beforeToTranslate"),m(t,"_translate",e=>e),m(t,"_afterToTranslate");var h=t;var L=h;export{L as translator};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn-json",
3
- "version": "1.9.1",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "description": "Pixi'VN can be integrated with JSON files to create a visual novel.",
6
6
  "main": "./dist/index.cjs",
@@ -10,11 +10,7 @@
10
10
  "dist"
11
11
  ],
12
12
  "scripts": {
13
- "build:unifier": "tsup --config tsup.unifier.config.ts",
14
- "build:translator": "tsup --config tsup.translator.config.ts",
15
- "build:submodules": "tsup --config tsup.submodules.config.ts",
16
- "build:index": "tsup --config tsup.config.ts",
17
- "build": "npm run build:unifier && npm run build:translator && npm run build:submodules && npm run build:index",
13
+ "build": "tsup --config tsup.config.ts",
18
14
  "test": "vitest"
19
15
  },
20
16
  "exports": {
@@ -24,11 +20,11 @@
24
20
  "require": "./dist/index.cjs",
25
21
  "default": "./dist/index.mjs"
26
22
  },
27
- "./unifier": {
28
- "types": "./dist/unifier.d.ts",
29
- "import": "./dist/unifier.mjs",
30
- "require": "./dist/unifier.cjs",
31
- "default": "./dist/unifier.mjs"
23
+ "./core": {
24
+ "types": "./dist/core.d.ts",
25
+ "import": "./dist/core.mjs",
26
+ "require": "./dist/core.cjs",
27
+ "default": "./dist/core.mjs"
32
28
  },
33
29
  "./importer": {
34
30
  "types": "./dist/importer.d.ts",
@@ -45,8 +41,8 @@
45
41
  },
46
42
  "typesVersions": {
47
43
  "*": {
48
- "unifier": [
49
- "./dist/unifier.d.ts"
44
+ "core": [
45
+ "./dist/core.d.ts"
50
46
  ],
51
47
  "importer": [
52
48
  "./dist/importer.d.ts"
@@ -71,13 +67,14 @@
71
67
  "@types/crypto-js": "^4.2.2",
72
68
  "crypto-js": "^4.2.0",
73
69
  "jsdom": "^27.4.0",
70
+ "pixi.js": "^8.17.0",
74
71
  "ts-node": "^10.9.2",
75
72
  "tsup": "^8.5.1",
76
73
  "typescript": "^5.9.3",
77
74
  "vite-tsconfig-paths": "^6.0.3"
78
75
  },
79
76
  "peerDependencies": {
80
- "@drincs/pixi-vn": ">=1.4.1"
77
+ "@drincs/pixi-vn": ">=1.5.17"
81
78
  },
82
79
  "keywords": [
83
80
  "game",
package/dist/unifier.cjs DELETED
@@ -1 +0,0 @@
1
- 'use strict';var x=Object.defineProperty;var P=(r,i,s)=>i in r?x(r,i,{enumerable:true,configurable:true,writable:true,value:s}):r[i]=s;var o=(r,i,s)=>P(r,typeof i!="symbol"?i+"":i,s);var t;(c=>(c.log=(a,...n)=>console.log(`[Pixi\u2019VN Json] ${a}`,...n),c.warn=(a,...n)=>console.warn(`[Pixi\u2019VN Json] ${a}`,...n),c.error=(a,...n)=>console.error(`[Pixi\u2019VN Json] ${a}`,...n),c.info=(a,...n)=>console.info(`[Pixi\u2019VN Json] ${a}`,...n)))(t||(t={}));var e=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.getConditionalStep);}static get loadAssets(){return e._loadAssets}static get soundOperation(){return e._soundOperation}static get imageOperation(){return e._imageOperation}static get videoOperation(){return e._videoOperation}static get textOperation(){return e._textOperation}static get imageContainerOperation(){return e._imageContainerOperation}static get canvasElementOperation(){return e._canvasElementOperation}static get setStorageValue(){return e._setStorageValue}static get setInitialStorageValue(){return e._setInitialStorageValue}static get narrationOperation(){return e._narrationOperation}static get effectOperation(){return e._effectOperation}static get animateOperation(){return e._animateOperation}static get getLogichValue(){return e._getLogichValue}static get getConditionalStep(){return e._getConditionalStep}};o(e,"_loadAssets",()=>{}),o(e,"_soundOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_videoOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageContainerOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_textOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_canvasElementOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setInitialStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_narrationOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_effectOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_animateOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getLogichValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getConditionalStep",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var p=e;exports.JsonUnifier=p;
package/dist/unifier.mjs DELETED
@@ -1 +0,0 @@
1
- var x=Object.defineProperty;var P=(r,i,s)=>i in r?x(r,i,{enumerable:true,configurable:true,writable:true,value:s}):r[i]=s;var o=(r,i,s)=>P(r,typeof i!="symbol"?i+"":i,s);var t;(c=>(c.log=(a,...n)=>console.log(`[Pixi\u2019VN Json] ${a}`,...n),c.warn=(a,...n)=>console.warn(`[Pixi\u2019VN Json] ${a}`,...n),c.error=(a,...n)=>console.error(`[Pixi\u2019VN Json] ${a}`,...n),c.info=(a,...n)=>console.info(`[Pixi\u2019VN Json] ${a}`,...n)))(t||(t={}));var e=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.getConditionalStep);}static get loadAssets(){return e._loadAssets}static get soundOperation(){return e._soundOperation}static get imageOperation(){return e._imageOperation}static get videoOperation(){return e._videoOperation}static get textOperation(){return e._textOperation}static get imageContainerOperation(){return e._imageContainerOperation}static get canvasElementOperation(){return e._canvasElementOperation}static get setStorageValue(){return e._setStorageValue}static get setInitialStorageValue(){return e._setInitialStorageValue}static get narrationOperation(){return e._narrationOperation}static get effectOperation(){return e._effectOperation}static get animateOperation(){return e._animateOperation}static get getLogichValue(){return e._getLogichValue}static get getConditionalStep(){return e._getConditionalStep}};o(e,"_loadAssets",()=>{}),o(e,"_soundOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_videoOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageContainerOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_textOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_canvasElementOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setInitialStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_narrationOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_effectOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_animateOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getLogichValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getConditionalStep",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var p=e;export{p as JsonUnifier};