@drincs/pixi-vn-ink 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +68 -14
  2. package/dist/constant.cjs +1 -7
  3. package/dist/constant.js +1 -3
  4. package/dist/functions/{ChoiceInfoConverter.cjs → choice-info-converter.cjs} +2 -9
  5. package/dist/functions/{ChoiceInfoConverter.d.cts → choice-info-converter.d.cts} +2 -2
  6. package/dist/functions/{ChoiceInfoConverter.d.ts → choice-info-converter.d.ts} +2 -2
  7. package/dist/functions/{ChoiceInfoConverter.js → choice-info-converter.js} +2 -6
  8. package/dist/functions/hashtag-script.cjs +1 -0
  9. package/dist/functions/hashtag-script.d.cts +42 -0
  10. package/dist/functions/hashtag-script.d.ts +42 -0
  11. package/dist/functions/hashtag-script.js +1 -0
  12. package/dist/functions/{Importer.cjs → importer.cjs} +34 -40
  13. package/dist/functions/{Importer.d.cts → importer.d.cts} +6 -4
  14. package/dist/functions/{Importer.d.ts → importer.d.ts} +6 -4
  15. package/dist/functions/{Importer.js → importer.js} +34 -38
  16. package/dist/functions/index.cjs +34 -41
  17. package/dist/functions/index.d.cts +5 -2
  18. package/dist/functions/index.d.ts +5 -2
  19. package/dist/functions/index.js +34 -38
  20. package/dist/functions/{InkToPixivn.cjs → ink-to-pixivn.cjs} +2 -8
  21. package/dist/functions/{InkToPixivn.js → ink-to-pixivn.js} +2 -6
  22. package/dist/functions/{StoryInfoConverter.cjs → story-info-converter.cjs} +2 -9
  23. package/dist/functions/{StoryInfoConverter.d.cts → story-info-converter.d.cts} +1 -1
  24. package/dist/functions/{StoryInfoConverter.d.ts → story-info-converter.d.ts} +1 -1
  25. package/dist/functions/{StoryInfoConverter.js → story-info-converter.js} +2 -6
  26. package/dist/functions/translate.cjs +1 -0
  27. package/dist/functions/translate.d.cts +41 -0
  28. package/dist/functions/translate.d.ts +41 -0
  29. package/dist/functions/translate.js +1 -0
  30. package/dist/index.cjs +34 -41
  31. package/dist/index.d.cts +5 -2
  32. package/dist/index.d.ts +5 -2
  33. package/dist/index.js +34 -38
  34. package/dist/managers/HashtagScriptManager.cjs +1 -0
  35. package/dist/managers/HashtagScriptManager.d.cts +27 -0
  36. package/dist/managers/HashtagScriptManager.d.ts +27 -0
  37. package/dist/managers/HashtagScriptManager.js +1 -0
  38. package/dist/parser/{AddingElements.cjs → adding-elements.cjs} +2 -10
  39. package/dist/parser/{AddingElements.js → adding-elements.js} +2 -6
  40. package/dist/{functions/ArithmeticUtility.cjs → parser/arithmetic-parser.cjs} +2 -6
  41. package/dist/{functions/ArithmeticUtility.js → parser/arithmetic-parser.js} +1 -3
  42. package/dist/parser/{ConditionaAritmeticParser.cjs → conditiona-aritmetic-parser.cjs} +2 -6
  43. package/dist/parser/{ConditionaAritmeticParser.js → conditiona-aritmetic-parser.js} +1 -3
  44. package/dist/parser/{ConditionalStatementsParser.cjs → conditional-statements-parser.cjs} +2 -9
  45. package/dist/parser/{ConditionalStatementsParser.d.cts → conditional-statements-parser.d.cts} +1 -1
  46. package/dist/parser/{ConditionalStatementsParser.d.ts → conditional-statements-parser.d.ts} +1 -1
  47. package/dist/parser/{ConditionalStatementsParser.js → conditional-statements-parser.js} +2 -6
  48. package/dist/parser/{LabelParser.cjs → label-parser.cjs} +3 -9
  49. package/dist/parser/{LabelParser.js → label-parser.js} +3 -7
  50. package/dist/parser/{SwitchParser.cjs → switch-parser.cjs} +2 -8
  51. package/dist/parser/{SwitchParser.d.cts → switch-parser.d.cts} +1 -1
  52. package/dist/parser/{SwitchParser.d.ts → switch-parser.d.ts} +1 -1
  53. package/dist/parser/{SwitchParser.js → switch-parser.js} +2 -6
  54. package/dist/types/InkRootType.cjs +1 -2
  55. package/dist/types/InkRootType.js +0 -1
  56. package/dist/types/InkStoryType.cjs +1 -2
  57. package/dist/types/InkStoryType.js +0 -1
  58. package/dist/types/LabelChoiceRes.cjs +1 -2
  59. package/dist/types/LabelChoiceRes.js +0 -1
  60. package/dist/types/parserItems/ChoicePoint.cjs +1 -2
  61. package/dist/types/parserItems/ChoicePoint.js +0 -1
  62. package/dist/types/parserItems/Cond.cjs +1 -2
  63. package/dist/types/parserItems/Cond.js +0 -1
  64. package/dist/types/parserItems/ContainerType.cjs +1 -2
  65. package/dist/types/parserItems/ContainerType.js +0 -1
  66. package/dist/types/parserItems/ControlCommands.cjs +1 -2
  67. package/dist/types/parserItems/ControlCommands.js +0 -1
  68. package/dist/types/parserItems/Divert.cjs +1 -2
  69. package/dist/types/parserItems/Divert.js +0 -1
  70. package/dist/types/parserItems/NativeFunctions.cjs +1 -8
  71. package/dist/types/parserItems/NativeFunctions.js +1 -3
  72. package/dist/types/parserItems/ReadCount.cjs +1 -2
  73. package/dist/types/parserItems/ReadCount.js +0 -1
  74. package/dist/types/parserItems/RootParserItemType.cjs +1 -2
  75. package/dist/types/parserItems/RootParserItemType.js +0 -1
  76. package/dist/types/parserItems/TextType.cjs +1 -2
  77. package/dist/types/parserItems/TextType.js +0 -1
  78. package/dist/types/parserItems/VariableAssignment.cjs +1 -2
  79. package/dist/types/parserItems/VariableAssignment.js +0 -1
  80. package/dist/types/parserItems/VariableReference.cjs +1 -2
  81. package/dist/types/parserItems/VariableReference.js +0 -1
  82. package/dist/utility/array-utility.cjs +1 -0
  83. package/dist/utility/array-utility.js +1 -0
  84. package/dist/utility/divert-utility.cjs +1 -0
  85. package/dist/utility/{DivertUtility.js → divert-utility.js} +1 -3
  86. package/dist/utility/text-utility.cjs +2 -0
  87. package/dist/utility/{TextUtility.js → text-utility.js} +1 -3
  88. package/dist/utility/{ValueUtility.cjs → value-utility.cjs} +2 -8
  89. package/dist/utility/{ValueUtility.js → value-utility.js} +1 -3
  90. package/package.json +5 -5
  91. package/dist/utility/ArrayUtility.cjs +0 -5
  92. package/dist/utility/ArrayUtility.js +0 -3
  93. package/dist/utility/CommandUtility.cjs +0 -5
  94. package/dist/utility/CommandUtility.d.cts +0 -5
  95. package/dist/utility/CommandUtility.d.ts +0 -5
  96. package/dist/utility/CommandUtility.js +0 -3
  97. package/dist/utility/DivertUtility.cjs +0 -5
  98. package/dist/utility/TextUtility.cjs +0 -6
  99. /package/dist/functions/{InkToPixivn.d.cts → ink-to-pixivn.d.cts} +0 -0
  100. /package/dist/functions/{InkToPixivn.d.ts → ink-to-pixivn.d.ts} +0 -0
  101. /package/dist/parser/{AddingElements.d.cts → adding-elements.d.cts} +0 -0
  102. /package/dist/parser/{AddingElements.d.ts → adding-elements.d.ts} +0 -0
  103. /package/dist/{functions/ArithmeticUtility.d.cts → parser/arithmetic-parser.d.cts} +0 -0
  104. /package/dist/{functions/ArithmeticUtility.d.ts → parser/arithmetic-parser.d.ts} +0 -0
  105. /package/dist/parser/{ConditionaAritmeticParser.d.cts → conditiona-aritmetic-parser.d.cts} +0 -0
  106. /package/dist/parser/{ConditionaAritmeticParser.d.ts → conditiona-aritmetic-parser.d.ts} +0 -0
  107. /package/dist/parser/{LabelParser.d.cts → label-parser.d.cts} +0 -0
  108. /package/dist/parser/{LabelParser.d.ts → label-parser.d.ts} +0 -0
  109. /package/dist/utility/{ArrayUtility.d.cts → array-utility.d.cts} +0 -0
  110. /package/dist/utility/{ArrayUtility.d.ts → array-utility.d.ts} +0 -0
  111. /package/dist/utility/{DivertUtility.d.cts → divert-utility.d.cts} +0 -0
  112. /package/dist/utility/{DivertUtility.d.ts → divert-utility.d.ts} +0 -0
  113. /package/dist/utility/{TextUtility.d.cts → text-utility.d.cts} +0 -0
  114. /package/dist/utility/{TextUtility.d.ts → text-utility.d.ts} +0 -0
  115. /package/dist/utility/{ValueUtility.d.cts → value-utility.d.cts} +0 -0
  116. /package/dist/utility/{ValueUtility.d.ts → value-utility.d.ts} +0 -0
package/README.md CHANGED
@@ -1,26 +1,26 @@
1
1
  # Ink Language Integration
2
2
 
3
+ ![pixi-vn-cover-ink](https://github.com/user-attachments/assets/cc96d260-d909-4fa4-834e-85e4405b6dd1)
4
+
3
5
  Pixi’VN gives you the ability to write your own narrative using Ink.
4
6
 
5
- ## What is ink?
7
+ **What is ink?**
6
8
 
7
9
  Ink is a scripting language for writing interactive narrative. It is used in games like 80 Days, Heaven's Vault, and Sorcery! to create branching stories.
8
10
 
9
- This language is very simple to learn, you can learn the basics in a few minutes. Go on [ink website](https://www.inklestudios.com/ink/) to learn more about it.
11
+ This language is very simple to learn. Go on [ink website](https://www.inklestudios.com/ink/) to learn more about it.
10
12
 
11
13
  ## Why use Ink integration?
12
14
 
13
15
  Programming a game narrative in **Javascript/Typescript** has the advantage of having total development freedom, but the disadvantage is that it slows down the writing of a narrative (it makes you write a lot of code).
14
16
 
15
- **Ink** is a language that allows you to write a narrative easily, without having to write a lot of code. Plus, it only takes you about ten minutes to learn the basic functions. Ink is basically designed only for writing narratives, so it doesn't require a canvas or other features outside of narrative.
16
-
17
- Launching narrative labels (or knots) from Javascript/Typescript to Ink sharing the same memory and canvas is a double benefit. You can use Ink to write the narration, while using Javascript/Typescript to handle everything that is not possible with Ink.
17
+ Javascript/Typescript and Ink share the same memory and canvas, and it is also possible to launch Ink labels (or knots) from Javascript/Typescript and vice versa. This allows you to use the best of both languages. You can use Ink to write the narration, while using Javascript/Typescript to create minigames or complex animations.
18
18
 
19
- Furthermore, novice developers can use a template to start writing narratives with Ink. After becoming familiar with Javascript/Typescript they can start to create more laborious features, like minigames or complex animations.
19
+ The novice developers can use a [ink template](/start/getting-started.md#project-initialization) to start developing just with Ink, and then gradually learn Javascript/Typescript to create more complex features.
20
20
 
21
21
  ## Start using Ink in Pixi’VN
22
22
 
23
- If you have not created a project yet then it is recommended to use the [template](https://pixi-vn.web.app/start/getting-started.html#project-initialization) and select a template that is based on ink.
23
+ If you have not created a project yet then it is recommended to use the [template](https://pixi-vn.web.app/start/getting-started.html#project-initialization) to start your project with Ink.
24
24
 
25
25
  Otherwise to add ink to your Pixi’VN project you need to install the `@drincs/pixi-vn-ink` package.
26
26
 
@@ -38,7 +38,7 @@ pnpm add @drincs/pixi-vn-ink
38
38
  bun add @drincs/pixi-vn-ink
39
39
  ```
40
40
 
41
- After installing the package you need to import the `importInkText()` function from the package and use it to import the ink script into your project.
41
+ After installing the package you need to use the `importInkText()` function to import the ink script into your project.
42
42
 
43
43
  ```typescript
44
44
  // main.ts
@@ -53,15 +53,17 @@ Hello
53
53
  importInkText([inkText, ...])
54
54
  ```
55
55
 
56
- Now you can run the `start` knot (or label) with [Pixi’VN functions](https://pixi-vn.web.app/start/labels.html#run-a-label).
56
+ Now you can run the ink knot (or label) with [Pixi’VN functions](https://pixi-vn.web.app/start/labels.html#run-a-label).
57
57
 
58
58
  ```typescript
59
+ import { narration } from '@drincs/pixi-vn'
60
+
59
61
  narration.callLabel(`start`, {})
60
62
  ```
61
63
 
62
64
  ### Import text contained in .ink files
63
65
 
64
- ( This method has been tested only on projects generated with vitejs )
66
+ For this guide we will use the [Vite](https://vitejs.dev/) project, but you can use the same logic in other projects.
65
67
 
66
68
  To import text contained in .ink files you need create the file `ink.d.ts`:
67
69
 
@@ -98,7 +100,7 @@ importInkText([startLabel, ...])
98
100
 
99
101
  The following features are in development and will be added in the future:
100
102
 
101
- ( Add a like or comment to the issue to show your interest in the feature )
103
+ ( Add a like or comment to the issue to show your interest )
102
104
 
103
105
  * [Functions and Game Queries](https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#9-game-queries-and-functions) (issue [#11](https://github.com/DRincs-Productions/pixi-vn-ink/issues/11)):
104
106
  * [User-created functions](https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#5-functions) (issue [#32](https://github.com/DRincs-Productions/pixi-vn-ink/issues/32))
@@ -112,7 +114,7 @@ The following features are in development and will be added in the future:
112
114
 
113
115
  ## Ink syntax that will be ignored by Pixi’VN
114
116
 
115
- The following syntax will be ignored by Pixi’VN (They will not create errors).
117
+ The following syntax will be ignored by Pixi’VN. You can use them in your ink script ( For example if you want test your script with **Inky editor** ), but they will be ignored by Pixi’VN.
116
118
 
117
119
  ### INCLUDE
118
120
 
@@ -122,12 +124,12 @@ In Pixi’VN you can use the `importInkText()` function to import the ink files.
122
124
 
123
125
  ### Narration outside the knots
124
126
 
125
- The narration outside the knots (or labels) will be ignored.
126
- The reason is that as explained by Pixi’VN you can't start a whole ink file, but you have to use this [functions](https://pixi-vn.web.app/start/labels.html#run-a-label) for run a knot (or label).
127
+ The narration outside the knots (or labels) will be ignored, except for variables. The reason is that you must run the first knot (or label) with the [Pixi’VN functions](https://pixi-vn.web.app/start/labels.html#run-a-label).
127
128
 
128
129
  So for example the following cases will be ignored:
129
130
 
130
131
  ```ink
132
+ VAR my_var = false ✅ This will be handled (because it is a variable)
131
133
  Hello # ❌ This will be ignored
132
134
  -> start # ❌ This will be ignored
133
135
  === start === # ✅ This will be handled
@@ -135,6 +137,56 @@ My name is John # ✅ This will be handled
135
137
  -> DONE # ✅ This will be handled
136
138
  ```
137
139
 
140
+ ## Differences between Native Ink and Pixi’VN Ink
141
+
142
+ * in this case:
143
+
144
+ ```ink
145
+ { shuffle:
146
+ - 2 of Diamonds.
147
+ 'You lose this time!' crowed the croupier.
148
+ }
149
+ ```
150
+
151
+ **In Native Ink**, you will see 2 different dialogues, the first one will be `2 of Diamonds.` and the second one will be `'You lose this time!' crowed the croupier.`.
152
+
153
+ **In Pixi’VN Ink**, you will not see 2 different dialogues, but the following dialogue: `2 of Diamonds.\n\n'You lose this time!' crowed the croupier.`. In [Markdown](/ink/ink-markdown.md) it will be displayed as:
154
+
155
+ ```txt
156
+ 2 of Diamonds.
157
+ 'You lose this time!' crowed the croupier.
158
+ ```
159
+
160
+ * if a `weave` (In following example `shove`) is attached to a one time choice, and it is opened with `-> shove` it will not invalidate the one time choice. To invalidate it you will have to select the choice as usual.
161
+
162
+ Here is an example:
163
+
164
+ ```ink
165
+ -> start
166
+ === start ===
167
+ * [1] -> shove
168
+ * (shove) [2] 2
169
+ * {shove} [3] -> END
170
+ - -> start
171
+ -> DONE
172
+ ```
173
+
174
+ In case you take choice 1, the second time it will be opened `start`:
175
+ * if you use **Native Ink**, you will only be able to choose choice `3`. The choice `2` is hidden because being "one time" Native Ink will know that you have already made this decision with `-> shove`.
176
+ * if you use **Pixi’VN Ink**, you will be able to choose choice `2` or `3`. The choice `2` is not hidden because Pixi'VN Ink doesn't know that `shove` is paired with a choice.
177
+
178
+ To get the same logic as `start` both in Native Ink and Pixi'VN Ink you will have to write the following code:
179
+
180
+ ```ink
181
+ -> start
182
+ === start ===
183
+ * [1] -> shove
184
+ * (shove) {!shove} [2] 2
185
+ * {shove} [3] -> END
186
+ - -> start
187
+ -> DONE
188
+ ```
189
+
138
190
  ## Using Pixi’VN Features from Ink
139
191
 
140
192
  * [Use Character in ink](https://pixi-vn.web.app/ink/ink-character.html)
@@ -142,3 +194,5 @@ My name is John # ✅ This will be handled
142
194
  * [Use PixiJS Canvas in Ink](https://pixi-vn.web.app/ink/ink-canvas.html)
143
195
  * [Use Sounds and Music in Ink](https://pixi-vn.web.app/ink/ink-sound.html)
144
196
  * [Use input in Ink](https://pixi-vn.web.app/ink/ink-input.html)
197
+ * [How translate Ink text](https://pixi-vn.web.app/ink/ink-translate.html)
198
+ * [Custome Hashtag Script](https://pixi-vn.web.app/ink/ink-hashtag.html)
package/dist/constant.cjs CHANGED
@@ -1,7 +1 @@
1
- 'use strict';
2
-
3
- var _="_|_",E="global decl",L="___external_value___";
4
-
5
- exports.CHOISE_LABEL_KEY_SEPARATOR = _;
6
- exports.GLOBAL_DECL = E;
7
- exports.MY_LABEL_KER_EXTERNAL_VALUE = L;
1
+ 'use strict';var _="_|_",E="global decl",L="___external_value___";exports.CHOISE_LABEL_KEY_SEPARATOR=_;exports.GLOBAL_DECL=E;exports.MY_LABEL_KER_EXTERNAL_VALUE=L;
package/dist/constant.js CHANGED
@@ -1,3 +1 @@
1
- var _="_|_",E="global decl",L="___external_value___";
2
-
3
- export { _ as CHOISE_LABEL_KEY_SEPARATOR, E as GLOBAL_DECL, L as MY_LABEL_KER_EXTERNAL_VALUE };
1
+ var _="_|_",E="global decl",L="___external_value___";export{_ as CHOISE_LABEL_KEY_SEPARATOR,E as GLOBAL_DECL,L as MY_LABEL_KER_EXTERNAL_VALUE};
@@ -1,10 +1,3 @@
1
- 'use strict';
2
-
3
- require('@drincs/pixi-vn');
4
-
5
- var T="_|_";function m(i,e){if(new RegExp(/.*\.[0-9]+\..*$/).test(i)&&(i=i.split(".").filter(o=>!o.match(/^[0-9]+$/)).join("."),!i.startsWith(".")))return i.replaceAll(".",T);if(!new RegExp(/^\.\^.*$/).test(i)&&i.includes("g-")){let n=i.split("g-");return F(e)+T+"g-"+n[n.length-1]}let l=0;for(;new RegExp(/^\.\^.*$/).test(i);)l++,i=i.substring(2);if(l=l-1,new RegExp(/^\..*$/).test(i)&&e){let n=i.substring(1);return F(e,l)+T+n.replaceAll(".",T)}return i.replaceAll(".",T)||F(e,l).replaceAll(".",T)}function F(i,e=0){let l=i.split(T);for(;l.length>1&&e>0;)l.pop()?.includes("g-")&&e--,e--;return l.join(T)}var B="\xA7DOUBLE_SLASH_CONVERTOR\xA7";function C(i){return i.startsWith("^")&&(i=i.substring(1)),i=i.replaceAll("\\\\",B),i=i.replaceAll("\\n",`
1
+ 'use strict';require('@drincs/pixi-vn');var T="_|_";function m(i,e){if(new RegExp(/.*\.[0-9]+\..*$/).test(i)&&(i=i.split(".").filter(o=>!o.match(/^[0-9]+$/)).join("."),!i.startsWith(".")))return i.replaceAll(".",T);if(!new RegExp(/^\.\^.*$/).test(i)&&i.includes("g-")){let n=i.split("g-");return F(e)+T+"g-"+n[n.length-1]}let l=0;for(;new RegExp(/^\.\^.*$/).test(i);)l++,i=i.substring(2);if(l=l-1,new RegExp(/^\..*$/).test(i)&&e){let n=i.substring(1);return F(e,l)+T+n.replaceAll(".",T)}return i.replaceAll(".",T)||F(e,l).replaceAll(".",T)}function F(i,e=0){let l=i.split(T);for(;l.length>1&&e>0;)l.pop()?.includes("g-")&&e--,e--;return l.join(T)}var B="\xA7DOUBLE_SLASH_CONVERTOR\xA7";function C(i){return i.startsWith("^")&&(i=i.substring(1)),i=i.replaceAll("\\\\",B),i=i.replaceAll("\\n",`
6
2
  `),i=i.replaceAll("\\t"," "),i=i.replaceAll(" "," "),i=i.replaceAll(B,"\\\\"),i}var G=["+","-","/","*","%","_","==",">","<",">=","<=","!=","!","&&","||","MIN","MAX"],w=["+","-","/","*","%","POW","RANDOM"],$=["INT","FLOOR","FLOAT"],W=["==",">","<",">=","<=","!=","CONTAINS"];function v(i,e,l){i=i.map(o=>{if(typeof o=="string"){if(o==="rnd")return "RANDOM";if(o==="?")return "CONTAINS"}return o});let n=[];return i.forEach(o=>{if(typeof o=="object"&&"CNT?"in o)if(new RegExp(/.*\.[0-9]\..*/).test(o["CNT?"])){let p=o["CNT?"].split("."),h=p.pop(),g=p.pop();if(g===void 0||h===void 0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);return}let c=parseInt(g),s=p.join(".");if(s.includes("^.")){let r=s.split("."),u=r[r.length-1].replaceAll(".",T);r.pop(),s=r.join(".")+"."+u,h.includes("c-")&&(s=s+T+h);}else s=s.replaceAll(".",T);n.push({type:"compare",leftValue:H(m(s,e)),operator:">=",rightValue:{type:"value",value:c}});}else n.push(H(m(o["CNT?"],e)));else if(typeof o=="object"&&"VAR?"in o)n.push(N(o["VAR?"],l));else if(o==="&&"||o==="||"){if(n.length>=2){let p={type:"union",unionType:o==="&&"?"and":"or",conditions:[n[n.length-2],n[n.length-1]]};n.pop(),n.pop(),n.push(p);}}else if(o==="!")if(n.length===0)console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);else {let p={type:"union",unionType:"not",condition:n[n.length-1]};n[n.length-1]=p;}else if(o&&typeof o=="string"&&W.includes(o))if(n.length<2)console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);else {let p={type:"compare",operator:o,rightValue:n[n.length-1],leftValue:n[n.length-2]};n.pop(),n.pop(),n.push(p);}else if(o&&typeof o=="string"&&w.includes(o))if(n.length<2)console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);else {let p={type:"arithmetic",operator:o,rightValue:n[n.length-1],leftValue:n[n.length-2]};n.pop(),n.pop(),n.push(p);}else if(o&&typeof o=="string"&&$.includes(o)){let p={type:"arithmeticsingle",operator:o,leftValue:n[n.length-1]};n.pop(),n.push(p);}else o&&typeof o=="string"?o.startsWith("^")&&n.push(C(o)):typeof o=="object"&&"^->"in o?o["^->"].includes("$r")||n.push(o["^->"]):n.push(o);}),n}function H(i){return {type:"value",storageType:"label",storageOperationType:"get",label:i}}function Y(i,e,l){return v(i,e,l)}function N(i,e,l="storage"){let n=e.indexOf(i);return n>=0?{type:"value",storageType:"params",storageOperationType:"get",key:n}:{type:"value",storageOperationType:"get",storageType:l,key:i}}function _(i,e,l,n="storage"){let o=e.indexOf(i);return o>=0?{type:"value",storageType:"params",storageOperationType:"set",key:o,value:l}:{type:"value",storageOperationType:"set",storageType:n,key:i,value:l}}function q(i,e){e&&(typeof e=="string"?e.startsWith("^")&&i.push(C(e)):typeof e=="object"&&"type"in e&&e.type!=="value"&&i.push(e));}function D(i,e,l,n=!0,o=!1){return z(i,e,l,n,o)}function z(i,e,l,n,o=!1){e&&(typeof e=="string"&&e.startsWith("^")||e&&typeof e=="object"&&"type"in e&&e.type=="value"&&e.storageOperationType==="get"?typeof e=="string"?i.push(C(e)):i.push(e):typeof e=="object"&&"type"in e&&i.push(e));}function R(i,e,l){if(i.length===0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Arithmetic statement is not valid",i);return}let n=v(i,e,l);if(n.length===1){let o=n[0];return o&&typeof o=="object"&&"type"in o?{type:"value",storageType:"logic",storageOperationType:"get",operation:o}:o}}function E(i,e,l,n="",o,p,h=void 0){let g=[],c="sequential",s=!1,r=!0;i.forEach(V=>{V==="%"&&(c="loop"),V==="seq"&&(c="random"),V==="MIN"&&(s=!0);});let u=i[i.length-1];return Object.keys(u).forEach(V=>{let y=u[V];if(Array.isArray(y)&&y.length>3){y=y.slice(1,y.length-2);let S=[];J(y,n,o,S,e,e,l,O,h,!0,p),S.length===1?g.push(S[0]):g.push({type:"resulttocombine",combine:"cross",secondConditionalItem:S});}else Array.isArray(y)&&y.length===3&&(r=!1);}),c==="sequential"?{type:"stepswitch",elements:g,choiceType:c,end:r?"lastItem":void 0,nestedId:h}:s&&c==="random"?{type:"stepswitch",elements:g,choiceType:"sequentialrandom",end:r?"lastItem":void 0,nestedId:h}:{type:"stepswitch",elements:g,choiceType:c}}function J(i,e,l,n=[],o,p,h,g,c=void 0,s=!0,r=[]){let u=!1,a=[],V=!1,y=!1,S=[],A=[];if(l.preDialog[e]&&(s=!1,o(n,"^"+l.preDialog[e].text,e,r,s,y),l.preDialog[e].glue&&o(n,"<>",e,r,s,y),delete l.preDialog[e]),i.includes("visit")){let t=E(i,p,h,e,l,r,c);t&&(!s&&n.length>0&&o(n,"<>",e,r,s,y),o(n,t,e,r,s,y));return}let b=i[0];if(b&&typeof b=="object"&&"temp="in b){for(;i[0]&&typeof i[0]=="object"&&"temp="in i[0];)r.push(i[0]["temp="]),i.shift();r=r.reverse();}if(i.forEach((t,x)=>{if(y){if(typeof t=="string"&&t=="/#"){let f=[];J(A,e,l,f,D,D,h,g,c,s),o(n,f,e,r,s,y),y=!1,A=[];}else A.push(t);return}else if(u)if(Array.isArray(t))a.push(t);else if(t&&typeof t=="object")if("CNT?"in t)x>0&&i[x-1]=="ev"?(V=!0,S.push(t)):V?S.push(t):(a.push(t),s=!1);else if("VAR="in t||"temp="in t){let f=_("VAR="in t?t["VAR="]:t["temp="],r,i[x-1],"VAR="in t?"storage":"tempstorage");if(f.value&&typeof f.value=="string"&&f.value=="/str"&&(f.value=i[x-2]),f.value&&typeof f.value=="object"&&"^->"in f.value&&(f.value=f.value["^->"]),a.length>1){let d=R(a,e,r);a=[],d&&typeof d=="object"&&"type"in d&&d.type=="value"&&"storageType"in d&&d.storageType=="logic"&&(f.value=d.operation);}(typeof f.key!="string"||!f.key.includes("$r"))&&(o(n,f,e,r,s,y),s=!0);}else "VAR?"in t?a.push(t):"^->"in t&&(t["^->"].includes("$r")||a.push(t));else if(typeof t=="string"&&t=="/ev")V&&S.push(t),u=!1,a.push(t);else if(typeof t=="string"&&t=="out"){if(a.length>0){let f=a[a.length-1];if(f&&typeof f=="object"&&"VAR?"in f){a.pop();let d=N(f["VAR?"],r,"storage");o(n,d,e,r,s,y);}else {let d=[];for(;a.length>0&&a[a.length-1]!="/ev";)d.push(a.pop());d=d.reverse();let P=R(d,e,r);a=[],P&&typeof P=="object"&&"type"in P&&P.type=="value"&&"storageType"in P&&P.storageType=="logic"?o(n,{storageOperationType:"get",storageType:"logic",operation:P.operation,type:"value"},e,r,s,y):(o(n,"<>",e,r,s,y),P=`^${P}`,o(n,P,e,r,s,y));}s=!1;}}else a.push(t);else if(typeof t=="string")if(t.startsWith("^"))o(n,t,e,r,s,y),s=!1;else if(t=="ev")u=!0;else if(t==`
7
- `)s=!0;else if(t=="done"||t=="end")o(n,t,e,r,s,y),s=!1;else if(t=="<>")o(n,t,e,r,s,y),s=!1;else if(t=="nop"&&V){let f=L(S,p,h,e,l,r,c);f&&o(n,f,e,r,s,y),V=!1,S=[];}else t=="#"&&(y=!0);else if(t instanceof Array)if(V)S.push(t);else if(t.length>1&&typeof t[t.length-2]=="object"&&t[t.length-2]&&"c"in t[t.length-2]&&typeof t[t.length-1]=="object"&&t[t.length-1]&&"b"in t[t.length-1]){a.pop();let f=[],d=[];for(;a.length>0&&a[a.length-1]!="/ev";)f.push(a.pop());S=[...S,...f.reverse()],V=!0,d.push(t.pop()),d.push(t.pop()),S=[...S,...t],S.push(d);}else if(t.length>1&&typeof t[t.length-1]=="object"&&t[t.length-1]&&"#n"in t[t.length-1]){let f=t.pop();if(!f){console.error("[Pixi\u2019VN Ink] Error parsing ink file: el is undefined");return}let d=f["#n"];delete f["#n"],t.push(f),o(n,{"->":e?e+T+d:d},e,r,s,y),h({[d]:t},e,l);}else J(t,e,l,n,o,p,h,g,c,s);else if(t&&typeof t=="object")if("->"in t&&typeof t["->"]=="string"&&!new RegExp(/^\.\^\.\^\.\d\.s$/).test(t["->"])){let f=[];a.length>0&&(f=Y(["ev",...a],e,r)),t.params=f,o(n,t,e,r,s,y),s=!1;}else if("*"in t&&typeof t["*"]=="string")t["*"].includes("c")&&(a.push(t),s=!1);else if("s"in t&&t.s instanceof Array)a.push(t),s=!1;else if("CNT?"in t)a.push(t),s=!1;else if("VAR="in t||"temp="in t){let f=[],d=_("VAR="in t?t["VAR="]:t["temp="],r,void 0,"VAR="in t?"storage":"tempstorage");if(d.key!=="$r"){for(a.pop(),a[a.length-1]=="/ev"&&a.pop();a.length>0&&a[a.length-1]!="/ev";)f.push(a.pop());f=f.reverse(),d.value=R(f,e,r),a=[],(d.value!==void 0||d.value!==null)&&o(n,d,e,r,s,y),s=!1;}}else h(t,e,l);}),g(a,n,e,l,r),e.includes(T)&&n.length==2){let t=n[0],x=n[1];t&&x&&typeof t=="object"&&"dialogue"in t&&typeof x=="object"&&"labelToOpen"in x&&t.dialogue==" "&&x.labelToOpen&&(n.shift(),delete x.glueEnabled,n[0]=x);}}function k(i,e,l,n,o){if(e.length===0)return;let p=v(e,n,l);if(p.length===1){let h={type:"ifelse",condition:p[0],then:i,else:o};return h.else||delete h.else,h}else if(p.length>1){let h={type:"ifelse",condition:{type:"union",unionType:"and",conditions:p},then:i,else:o};return h.else||delete h.else,h}}function L(i,e,l,n,o,p,h=void 0){if(i.length===0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);return}let g=[],c=[];if(i.forEach(u=>{Array.isArray(u)?c.push(u):typeof u=="string"&&u==="du"?o.du?g.push(o.du):o.du=g[g.length-1]:(typeof u!="string"||u!=="/ev")&&g.push(u);}),c.length===0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",c);return}let s=j(c[0],e,l,n+T+"then",o,p,`${h||""}then`),r;return c.length===2?r=j(c[1],e,l,n+T+"else",o,p,`${h||""}else`):c.length>2&&(c.shift(),c.push("nop"),c=[{b:c}],r=j(c,e,l,n+T+"else",o,p,`${h||""}else`)),o.du=void 0,k(s,g,p,n,r)}function j(i,e,l,n,o,p,h=void 0){let g=[];for(let s of i)typeof s=="object"&&"b"in s&&(s.b=s.b.filter(r=>r!==null&&!(typeof r=="object"&&"->"in r&&new RegExp(/.*\.[0-9]/).test(r["->"]))),J(s.b,n,o,g,e,e,l,O,h,!0,p));return g.length===1?g[0]:{type:"resulttocombine",combine:"cross",secondConditionalItem:g}}function M(i="",e=""){let l=Array.isArray(i)?i:[i],n=Array.isArray(e)?e:[e];return [...new Set([...l,...n])]}function O(i,e,l,n,o){if(i.length>0){let p={};U(i,p,o);for(let[h,g]of Object.entries(p)){let c=l+T+h,s={text:g.text.length===1?g.text[0]:g.text,label:c,props:{},type:"jump",oneTime:g.onetime};g.text.length===0&&(s.onlyHaveNoChoice=!0,s.autoSelect=!0),s.oneTime===!1&&delete s.oneTime;let r=k(s,g.conditions,o,l)||s,u=e[e.length-1];if(typeof u=="object"&&u&&"type"in u&&(u={conditionalStep:u}),e.length>0&&typeof u=="object"&&u&&"choices"in u&&u.choices){let a=u.choices;a&&Array.isArray(a)?a.push(r):console.error("[Pixi\u2019VN Ink] Unhandled case: choices is PixiVNJsonConditionalStatements<PixiVNJsonChoices> | undefined",g,a),u.choices=a.sort((V,y)=>{try{let S=V.label.split("."),A=S[S.length-1].replaceAll(".",T),b=y.label.split("."),t=b[b.length-1].replaceAll(".",T);if(A.includes("c-")&&t.includes("c-")){let x=A.split("c-")[1],f=parseInt(x),d=t.split("c-")[1],P=parseInt(d);return f-P}}catch{}return 0});}else e.push({choices:[r]});g.preDialog&&(n.preDialog[c]={...g.preDialog});}}}function U(i,e,l,n){let o=[],p="",h="",g=!1,c=[];for(let s=0;s<i.length;s++){let r=i[s];if(typeof r=="string")r.startsWith("^")?o.push(C(r)):G.includes(r)&&c.push(r);else if(Array.isArray(r)&&r.includes("visit")){let u=E(r,q,(a,V,y)=>{},n,{preDialog:{}},l);o.push(u);}else if(r&&typeof r=="object")if("*"in r&&typeof r["*"]&&typeof r["*"]=="string")r["*"].includes("c")&&(p="c"+r["*"].split("c")[1],r.flg&16&&(g=!0));else if("s"in r&&r.s instanceof Array){let u=X(r.s),a=r.s.includes("<>");u&&(n&&e[n]?(e[n].preDialog={text:u,glue:a},e[n].text=M(u,e[n].text)):(o.push(u),h=u));}else "CNT?"in r&&c.push(r);else c.push(r);if(p){e[p]?e[p].text=M(o,e[p].text):e[p]={text:o,onetime:g,conditions:c},h&&(e[p].preDialog={text:h,glue:!1});let u=i.slice(s+1);U(u,e,l,p);return}}}function X(i){for(let e of i)if(typeof e=="string"){if(e.startsWith("^"))return C(e)}else if(e instanceof Array){let l=X(e);if(l)return l}}
8
-
9
- exports.addChoiseIntoList = O;
10
- exports.getLabelChoice = U;
3
+ `)s=!0;else if(t=="done"||t=="end")o(n,t,e,r,s,y),s=!1;else if(t=="<>")o(n,t,e,r,s,y),s=!1;else if(t=="nop"&&V){let f=L(S,p,h,e,l,r,c);f&&o(n,f,e,r,s,y),V=!1,S=[];}else t=="#"&&(y=!0);else if(t instanceof Array)if(V)S.push(t);else if(t.length>1&&typeof t[t.length-2]=="object"&&t[t.length-2]&&"c"in t[t.length-2]&&typeof t[t.length-1]=="object"&&t[t.length-1]&&"b"in t[t.length-1]){a.pop();let f=[],d=[];for(;a.length>0&&a[a.length-1]!="/ev";)f.push(a.pop());S=[...S,...f.reverse()],V=!0,d.push(t.pop()),d.push(t.pop()),S=[...S,...t],S.push(d);}else if(t.length>1&&typeof t[t.length-1]=="object"&&t[t.length-1]&&"#n"in t[t.length-1]){let f=t.pop();if(!f){console.error("[Pixi\u2019VN Ink] Error parsing ink file: el is undefined");return}let d=f["#n"];delete f["#n"],t.push(f),o(n,{"->":e?e+T+d:d},e,r,s,y),h({[d]:t},e,l);}else J(t,e,l,n,o,p,h,g,c,s);else if(t&&typeof t=="object")if("->"in t&&typeof t["->"]=="string"&&!new RegExp(/^\.\^\.\^\.\d\.s$/).test(t["->"])){let f=[];a.length>0&&(f=Y(["ev",...a],e,r)),t.params=f,o(n,t,e,r,s,y),s=!1;}else if("*"in t&&typeof t["*"]=="string")t["*"].includes("c")&&(a.push(t),s=!1);else if("s"in t&&t.s instanceof Array)a.push(t),s=!1;else if("CNT?"in t)a.push(t),s=!1;else if("VAR="in t||"temp="in t){let f=[],d=_("VAR="in t?t["VAR="]:t["temp="],r,void 0,"VAR="in t?"storage":"tempstorage");if(d.key!=="$r"){for(a.pop(),a[a.length-1]=="/ev"&&a.pop();a.length>0&&a[a.length-1]!="/ev";)f.push(a.pop());f=f.reverse(),d.value=R(f,e,r),a=[],(d.value!==void 0||d.value!==null)&&o(n,d,e,r,s,y),s=!1;}}else h(t,e,l);}),g(a,n,e,l,r),e.includes(T)&&n.length==2){let t=n[0],x=n[1];t&&x&&typeof t=="object"&&"dialogue"in t&&typeof x=="object"&&"labelToOpen"in x&&t.dialogue==" "&&x.labelToOpen&&(n.shift(),delete x.glueEnabled,n[0]=x);}}function k(i,e,l,n,o){if(e.length===0)return;let p=v(e,n,l);if(p.length===1){let h={type:"ifelse",condition:p[0],then:i,else:o};return h.else||delete h.else,h}else if(p.length>1){let h={type:"ifelse",condition:{type:"union",unionType:"and",conditions:p},then:i,else:o};return h.else||delete h.else,h}}function L(i,e,l,n,o,p,h=void 0){if(i.length===0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);return}let g=[],c=[];if(i.forEach(u=>{Array.isArray(u)?c.push(u):typeof u=="string"&&u==="du"?o.du?g.push(o.du):o.du=g[g.length-1]:(typeof u!="string"||u!=="/ev")&&g.push(u);}),c.length===0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",c);return}let s=j(c[0],e,l,n+T+"then",o,p,`${h||""}then`),r;return c.length===2?r=j(c[1],e,l,n+T+"else",o,p,`${h||""}else`):c.length>2&&(c.shift(),c.push("nop"),c=[{b:c}],r=j(c,e,l,n+T+"else",o,p,`${h||""}else`)),o.du=void 0,k(s,g,p,n,r)}function j(i,e,l,n,o,p,h=void 0){let g=[];for(let s of i)typeof s=="object"&&"b"in s&&(s.b=s.b.filter(r=>r!==null&&!(typeof r=="object"&&"->"in r&&new RegExp(/.*\.[0-9]/).test(r["->"]))),J(s.b,n,o,g,e,e,l,O,h,!0,p));return g.length===1?g[0]:{type:"resulttocombine",combine:"cross",secondConditionalItem:g}}function M(i="",e=""){let l=Array.isArray(i)?i:[i],n=Array.isArray(e)?e:[e];return [...new Set([...l,...n])]}function O(i,e,l,n,o){if(i.length>0){let p={};U(i,p,o);for(let[h,g]of Object.entries(p)){let c=l+T+h,s={text:g.text.length===1?g.text[0]:g.text,label:c,props:{},type:"jump",oneTime:g.onetime};g.text.length===0&&(s.onlyHaveNoChoice=!0,s.autoSelect=!0),s.oneTime===!1&&delete s.oneTime;let r=k(s,g.conditions,o,l)||s,u=e[e.length-1];if(typeof u=="object"&&u&&"type"in u&&(u={conditionalStep:u}),e.length>0&&typeof u=="object"&&u&&"choices"in u&&u.choices){let a=u.choices;a&&Array.isArray(a)?a.push(r):console.error("[Pixi\u2019VN Ink] Unhandled case: choices is PixiVNJsonConditionalStatements<PixiVNJsonChoices> | undefined",g,a),u.choices=a.sort((V,y)=>{try{let S=V.label.split("."),A=S[S.length-1].replaceAll(".",T),b=y.label.split("."),t=b[b.length-1].replaceAll(".",T);if(A.includes("c-")&&t.includes("c-")){let x=A.split("c-")[1],f=parseInt(x),d=t.split("c-")[1],P=parseInt(d);return f-P}}catch{}return 0});}else e.push({choices:[r]});g.preDialog&&(n.preDialog[c]={...g.preDialog});}}}function U(i,e,l,n){let o=[],p="",h="",g=!1,c=[];for(let s=0;s<i.length;s++){let r=i[s];if(typeof r=="string")r.startsWith("^")?o.push(C(r)):G.includes(r)&&c.push(r);else if(Array.isArray(r)&&r.includes("visit")){let u=E(r,q,(a,V,y)=>{},n,{preDialog:{}},l);o.push(u);}else if(r&&typeof r=="object")if("*"in r&&typeof r["*"]&&typeof r["*"]=="string")r["*"].includes("c")&&(p="c"+r["*"].split("c")[1],r.flg&16&&(g=!0));else if("s"in r&&r.s instanceof Array){let u=X(r.s),a=r.s.includes("<>");u&&(n&&e[n]?(e[n].preDialog={text:u,glue:a},e[n].text=M(u,e[n].text)):(o.push(u),h=u));}else "CNT?"in r&&c.push(r);else c.push(r);if(p){e[p]?e[p].text=M(o,e[p].text):e[p]={text:o,onetime:g,conditions:c},h&&(e[p].preDialog={text:h,glue:!1});let u=i.slice(s+1);U(u,e,l,p);return}}}function X(i){for(let e of i)if(typeof e=="string"){if(e.startsWith("^"))return C(e)}else if(e instanceof Array){let l=X(e);if(l)return l}}exports.addChoiseIntoList=O;exports.getLabelChoice=U;
@@ -1,6 +1,6 @@
1
1
  import { PixiVNJsonConditionalStatements } from '@drincs/pixi-vn-json';
2
- import { ShareDataParserLabel } from '../parser/LabelParser.cjs';
3
- import { ConditionalList } from '../parser/SwitchParser.cjs';
2
+ import { ShareDataParserLabel } from '../parser/label-parser.cjs';
3
+ import { ConditionalList } from '../parser/switch-parser.cjs';
4
4
  import LabelChoiceRes from '../types/LabelChoiceRes.cjs';
5
5
  import { R as RootParserItemType, C as ChoicePoint, a as ChoiceInfo } from '../RootParserItemType-DV41SbdA.cjs';
6
6
  import NativeFunctions from '../types/parserItems/NativeFunctions.cjs';
@@ -1,6 +1,6 @@
1
1
  import { PixiVNJsonConditionalStatements } from '@drincs/pixi-vn-json';
2
- import { ShareDataParserLabel } from '../parser/LabelParser.js';
3
- import { ConditionalList } from '../parser/SwitchParser.js';
2
+ import { ShareDataParserLabel } from '../parser/label-parser.js';
3
+ import { ConditionalList } from '../parser/switch-parser.js';
4
4
  import LabelChoiceRes from '../types/LabelChoiceRes.js';
5
5
  import { R as RootParserItemType, C as ChoicePoint, a as ChoiceInfo } from '../RootParserItemType-BeypaLqW.js';
6
6
  import NativeFunctions from '../types/parserItems/NativeFunctions.js';
@@ -1,7 +1,3 @@
1
- import '@drincs/pixi-vn';
2
-
3
- var T="_|_";function m(i,e){if(new RegExp(/.*\.[0-9]+\..*$/).test(i)&&(i=i.split(".").filter(o=>!o.match(/^[0-9]+$/)).join("."),!i.startsWith(".")))return i.replaceAll(".",T);if(!new RegExp(/^\.\^.*$/).test(i)&&i.includes("g-")){let n=i.split("g-");return F(e)+T+"g-"+n[n.length-1]}let l=0;for(;new RegExp(/^\.\^.*$/).test(i);)l++,i=i.substring(2);if(l=l-1,new RegExp(/^\..*$/).test(i)&&e){let n=i.substring(1);return F(e,l)+T+n.replaceAll(".",T)}return i.replaceAll(".",T)||F(e,l).replaceAll(".",T)}function F(i,e=0){let l=i.split(T);for(;l.length>1&&e>0;)l.pop()?.includes("g-")&&e--,e--;return l.join(T)}var B="\xA7DOUBLE_SLASH_CONVERTOR\xA7";function C(i){return i.startsWith("^")&&(i=i.substring(1)),i=i.replaceAll("\\\\",B),i=i.replaceAll("\\n",`
1
+ import'@drincs/pixi-vn';var T="_|_";function m(i,e){if(new RegExp(/.*\.[0-9]+\..*$/).test(i)&&(i=i.split(".").filter(o=>!o.match(/^[0-9]+$/)).join("."),!i.startsWith(".")))return i.replaceAll(".",T);if(!new RegExp(/^\.\^.*$/).test(i)&&i.includes("g-")){let n=i.split("g-");return F(e)+T+"g-"+n[n.length-1]}let l=0;for(;new RegExp(/^\.\^.*$/).test(i);)l++,i=i.substring(2);if(l=l-1,new RegExp(/^\..*$/).test(i)&&e){let n=i.substring(1);return F(e,l)+T+n.replaceAll(".",T)}return i.replaceAll(".",T)||F(e,l).replaceAll(".",T)}function F(i,e=0){let l=i.split(T);for(;l.length>1&&e>0;)l.pop()?.includes("g-")&&e--,e--;return l.join(T)}var B="\xA7DOUBLE_SLASH_CONVERTOR\xA7";function C(i){return i.startsWith("^")&&(i=i.substring(1)),i=i.replaceAll("\\\\",B),i=i.replaceAll("\\n",`
4
2
  `),i=i.replaceAll("\\t"," "),i=i.replaceAll(" "," "),i=i.replaceAll(B,"\\\\"),i}var G=["+","-","/","*","%","_","==",">","<",">=","<=","!=","!","&&","||","MIN","MAX"],w=["+","-","/","*","%","POW","RANDOM"],$=["INT","FLOOR","FLOAT"],W=["==",">","<",">=","<=","!=","CONTAINS"];function v(i,e,l){i=i.map(o=>{if(typeof o=="string"){if(o==="rnd")return "RANDOM";if(o==="?")return "CONTAINS"}return o});let n=[];return i.forEach(o=>{if(typeof o=="object"&&"CNT?"in o)if(new RegExp(/.*\.[0-9]\..*/).test(o["CNT?"])){let p=o["CNT?"].split("."),h=p.pop(),g=p.pop();if(g===void 0||h===void 0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);return}let c=parseInt(g),s=p.join(".");if(s.includes("^.")){let r=s.split("."),u=r[r.length-1].replaceAll(".",T);r.pop(),s=r.join(".")+"."+u,h.includes("c-")&&(s=s+T+h);}else s=s.replaceAll(".",T);n.push({type:"compare",leftValue:H(m(s,e)),operator:">=",rightValue:{type:"value",value:c}});}else n.push(H(m(o["CNT?"],e)));else if(typeof o=="object"&&"VAR?"in o)n.push(N(o["VAR?"],l));else if(o==="&&"||o==="||"){if(n.length>=2){let p={type:"union",unionType:o==="&&"?"and":"or",conditions:[n[n.length-2],n[n.length-1]]};n.pop(),n.pop(),n.push(p);}}else if(o==="!")if(n.length===0)console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);else {let p={type:"union",unionType:"not",condition:n[n.length-1]};n[n.length-1]=p;}else if(o&&typeof o=="string"&&W.includes(o))if(n.length<2)console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);else {let p={type:"compare",operator:o,rightValue:n[n.length-1],leftValue:n[n.length-2]};n.pop(),n.pop(),n.push(p);}else if(o&&typeof o=="string"&&w.includes(o))if(n.length<2)console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);else {let p={type:"arithmetic",operator:o,rightValue:n[n.length-1],leftValue:n[n.length-2]};n.pop(),n.pop(),n.push(p);}else if(o&&typeof o=="string"&&$.includes(o)){let p={type:"arithmeticsingle",operator:o,leftValue:n[n.length-1]};n.pop(),n.push(p);}else o&&typeof o=="string"?o.startsWith("^")&&n.push(C(o)):typeof o=="object"&&"^->"in o?o["^->"].includes("$r")||n.push(o["^->"]):n.push(o);}),n}function H(i){return {type:"value",storageType:"label",storageOperationType:"get",label:i}}function Y(i,e,l){return v(i,e,l)}function N(i,e,l="storage"){let n=e.indexOf(i);return n>=0?{type:"value",storageType:"params",storageOperationType:"get",key:n}:{type:"value",storageOperationType:"get",storageType:l,key:i}}function _(i,e,l,n="storage"){let o=e.indexOf(i);return o>=0?{type:"value",storageType:"params",storageOperationType:"set",key:o,value:l}:{type:"value",storageOperationType:"set",storageType:n,key:i,value:l}}function q(i,e){e&&(typeof e=="string"?e.startsWith("^")&&i.push(C(e)):typeof e=="object"&&"type"in e&&e.type!=="value"&&i.push(e));}function D(i,e,l,n=!0,o=!1){return z(i,e,l,n,o)}function z(i,e,l,n,o=!1){e&&(typeof e=="string"&&e.startsWith("^")||e&&typeof e=="object"&&"type"in e&&e.type=="value"&&e.storageOperationType==="get"?typeof e=="string"?i.push(C(e)):i.push(e):typeof e=="object"&&"type"in e&&i.push(e));}function R(i,e,l){if(i.length===0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Arithmetic statement is not valid",i);return}let n=v(i,e,l);if(n.length===1){let o=n[0];return o&&typeof o=="object"&&"type"in o?{type:"value",storageType:"logic",storageOperationType:"get",operation:o}:o}}function E(i,e,l,n="",o,p,h=void 0){let g=[],c="sequential",s=!1,r=!0;i.forEach(V=>{V==="%"&&(c="loop"),V==="seq"&&(c="random"),V==="MIN"&&(s=!0);});let u=i[i.length-1];return Object.keys(u).forEach(V=>{let y=u[V];if(Array.isArray(y)&&y.length>3){y=y.slice(1,y.length-2);let S=[];J(y,n,o,S,e,e,l,O,h,!0,p),S.length===1?g.push(S[0]):g.push({type:"resulttocombine",combine:"cross",secondConditionalItem:S});}else Array.isArray(y)&&y.length===3&&(r=!1);}),c==="sequential"?{type:"stepswitch",elements:g,choiceType:c,end:r?"lastItem":void 0,nestedId:h}:s&&c==="random"?{type:"stepswitch",elements:g,choiceType:"sequentialrandom",end:r?"lastItem":void 0,nestedId:h}:{type:"stepswitch",elements:g,choiceType:c}}function J(i,e,l,n=[],o,p,h,g,c=void 0,s=!0,r=[]){let u=!1,a=[],V=!1,y=!1,S=[],A=[];if(l.preDialog[e]&&(s=!1,o(n,"^"+l.preDialog[e].text,e,r,s,y),l.preDialog[e].glue&&o(n,"<>",e,r,s,y),delete l.preDialog[e]),i.includes("visit")){let t=E(i,p,h,e,l,r,c);t&&(!s&&n.length>0&&o(n,"<>",e,r,s,y),o(n,t,e,r,s,y));return}let b=i[0];if(b&&typeof b=="object"&&"temp="in b){for(;i[0]&&typeof i[0]=="object"&&"temp="in i[0];)r.push(i[0]["temp="]),i.shift();r=r.reverse();}if(i.forEach((t,x)=>{if(y){if(typeof t=="string"&&t=="/#"){let f=[];J(A,e,l,f,D,D,h,g,c,s),o(n,f,e,r,s,y),y=!1,A=[];}else A.push(t);return}else if(u)if(Array.isArray(t))a.push(t);else if(t&&typeof t=="object")if("CNT?"in t)x>0&&i[x-1]=="ev"?(V=!0,S.push(t)):V?S.push(t):(a.push(t),s=!1);else if("VAR="in t||"temp="in t){let f=_("VAR="in t?t["VAR="]:t["temp="],r,i[x-1],"VAR="in t?"storage":"tempstorage");if(f.value&&typeof f.value=="string"&&f.value=="/str"&&(f.value=i[x-2]),f.value&&typeof f.value=="object"&&"^->"in f.value&&(f.value=f.value["^->"]),a.length>1){let d=R(a,e,r);a=[],d&&typeof d=="object"&&"type"in d&&d.type=="value"&&"storageType"in d&&d.storageType=="logic"&&(f.value=d.operation);}(typeof f.key!="string"||!f.key.includes("$r"))&&(o(n,f,e,r,s,y),s=!0);}else "VAR?"in t?a.push(t):"^->"in t&&(t["^->"].includes("$r")||a.push(t));else if(typeof t=="string"&&t=="/ev")V&&S.push(t),u=!1,a.push(t);else if(typeof t=="string"&&t=="out"){if(a.length>0){let f=a[a.length-1];if(f&&typeof f=="object"&&"VAR?"in f){a.pop();let d=N(f["VAR?"],r,"storage");o(n,d,e,r,s,y);}else {let d=[];for(;a.length>0&&a[a.length-1]!="/ev";)d.push(a.pop());d=d.reverse();let P=R(d,e,r);a=[],P&&typeof P=="object"&&"type"in P&&P.type=="value"&&"storageType"in P&&P.storageType=="logic"?o(n,{storageOperationType:"get",storageType:"logic",operation:P.operation,type:"value"},e,r,s,y):(o(n,"<>",e,r,s,y),P=`^${P}`,o(n,P,e,r,s,y));}s=!1;}}else a.push(t);else if(typeof t=="string")if(t.startsWith("^"))o(n,t,e,r,s,y),s=!1;else if(t=="ev")u=!0;else if(t==`
5
- `)s=!0;else if(t=="done"||t=="end")o(n,t,e,r,s,y),s=!1;else if(t=="<>")o(n,t,e,r,s,y),s=!1;else if(t=="nop"&&V){let f=L(S,p,h,e,l,r,c);f&&o(n,f,e,r,s,y),V=!1,S=[];}else t=="#"&&(y=!0);else if(t instanceof Array)if(V)S.push(t);else if(t.length>1&&typeof t[t.length-2]=="object"&&t[t.length-2]&&"c"in t[t.length-2]&&typeof t[t.length-1]=="object"&&t[t.length-1]&&"b"in t[t.length-1]){a.pop();let f=[],d=[];for(;a.length>0&&a[a.length-1]!="/ev";)f.push(a.pop());S=[...S,...f.reverse()],V=!0,d.push(t.pop()),d.push(t.pop()),S=[...S,...t],S.push(d);}else if(t.length>1&&typeof t[t.length-1]=="object"&&t[t.length-1]&&"#n"in t[t.length-1]){let f=t.pop();if(!f){console.error("[Pixi\u2019VN Ink] Error parsing ink file: el is undefined");return}let d=f["#n"];delete f["#n"],t.push(f),o(n,{"->":e?e+T+d:d},e,r,s,y),h({[d]:t},e,l);}else J(t,e,l,n,o,p,h,g,c,s);else if(t&&typeof t=="object")if("->"in t&&typeof t["->"]=="string"&&!new RegExp(/^\.\^\.\^\.\d\.s$/).test(t["->"])){let f=[];a.length>0&&(f=Y(["ev",...a],e,r)),t.params=f,o(n,t,e,r,s,y),s=!1;}else if("*"in t&&typeof t["*"]=="string")t["*"].includes("c")&&(a.push(t),s=!1);else if("s"in t&&t.s instanceof Array)a.push(t),s=!1;else if("CNT?"in t)a.push(t),s=!1;else if("VAR="in t||"temp="in t){let f=[],d=_("VAR="in t?t["VAR="]:t["temp="],r,void 0,"VAR="in t?"storage":"tempstorage");if(d.key!=="$r"){for(a.pop(),a[a.length-1]=="/ev"&&a.pop();a.length>0&&a[a.length-1]!="/ev";)f.push(a.pop());f=f.reverse(),d.value=R(f,e,r),a=[],(d.value!==void 0||d.value!==null)&&o(n,d,e,r,s,y),s=!1;}}else h(t,e,l);}),g(a,n,e,l,r),e.includes(T)&&n.length==2){let t=n[0],x=n[1];t&&x&&typeof t=="object"&&"dialogue"in t&&typeof x=="object"&&"labelToOpen"in x&&t.dialogue==" "&&x.labelToOpen&&(n.shift(),delete x.glueEnabled,n[0]=x);}}function k(i,e,l,n,o){if(e.length===0)return;let p=v(e,n,l);if(p.length===1){let h={type:"ifelse",condition:p[0],then:i,else:o};return h.else||delete h.else,h}else if(p.length>1){let h={type:"ifelse",condition:{type:"union",unionType:"and",conditions:p},then:i,else:o};return h.else||delete h.else,h}}function L(i,e,l,n,o,p,h=void 0){if(i.length===0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);return}let g=[],c=[];if(i.forEach(u=>{Array.isArray(u)?c.push(u):typeof u=="string"&&u==="du"?o.du?g.push(o.du):o.du=g[g.length-1]:(typeof u!="string"||u!=="/ev")&&g.push(u);}),c.length===0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",c);return}let s=j(c[0],e,l,n+T+"then",o,p,`${h||""}then`),r;return c.length===2?r=j(c[1],e,l,n+T+"else",o,p,`${h||""}else`):c.length>2&&(c.shift(),c.push("nop"),c=[{b:c}],r=j(c,e,l,n+T+"else",o,p,`${h||""}else`)),o.du=void 0,k(s,g,p,n,r)}function j(i,e,l,n,o,p,h=void 0){let g=[];for(let s of i)typeof s=="object"&&"b"in s&&(s.b=s.b.filter(r=>r!==null&&!(typeof r=="object"&&"->"in r&&new RegExp(/.*\.[0-9]/).test(r["->"]))),J(s.b,n,o,g,e,e,l,O,h,!0,p));return g.length===1?g[0]:{type:"resulttocombine",combine:"cross",secondConditionalItem:g}}function M(i="",e=""){let l=Array.isArray(i)?i:[i],n=Array.isArray(e)?e:[e];return [...new Set([...l,...n])]}function O(i,e,l,n,o){if(i.length>0){let p={};U(i,p,o);for(let[h,g]of Object.entries(p)){let c=l+T+h,s={text:g.text.length===1?g.text[0]:g.text,label:c,props:{},type:"jump",oneTime:g.onetime};g.text.length===0&&(s.onlyHaveNoChoice=!0,s.autoSelect=!0),s.oneTime===!1&&delete s.oneTime;let r=k(s,g.conditions,o,l)||s,u=e[e.length-1];if(typeof u=="object"&&u&&"type"in u&&(u={conditionalStep:u}),e.length>0&&typeof u=="object"&&u&&"choices"in u&&u.choices){let a=u.choices;a&&Array.isArray(a)?a.push(r):console.error("[Pixi\u2019VN Ink] Unhandled case: choices is PixiVNJsonConditionalStatements<PixiVNJsonChoices> | undefined",g,a),u.choices=a.sort((V,y)=>{try{let S=V.label.split("."),A=S[S.length-1].replaceAll(".",T),b=y.label.split("."),t=b[b.length-1].replaceAll(".",T);if(A.includes("c-")&&t.includes("c-")){let x=A.split("c-")[1],f=parseInt(x),d=t.split("c-")[1],P=parseInt(d);return f-P}}catch{}return 0});}else e.push({choices:[r]});g.preDialog&&(n.preDialog[c]={...g.preDialog});}}}function U(i,e,l,n){let o=[],p="",h="",g=!1,c=[];for(let s=0;s<i.length;s++){let r=i[s];if(typeof r=="string")r.startsWith("^")?o.push(C(r)):G.includes(r)&&c.push(r);else if(Array.isArray(r)&&r.includes("visit")){let u=E(r,q,(a,V,y)=>{},n,{preDialog:{}},l);o.push(u);}else if(r&&typeof r=="object")if("*"in r&&typeof r["*"]&&typeof r["*"]=="string")r["*"].includes("c")&&(p="c"+r["*"].split("c")[1],r.flg&16&&(g=!0));else if("s"in r&&r.s instanceof Array){let u=X(r.s),a=r.s.includes("<>");u&&(n&&e[n]?(e[n].preDialog={text:u,glue:a},e[n].text=M(u,e[n].text)):(o.push(u),h=u));}else "CNT?"in r&&c.push(r);else c.push(r);if(p){e[p]?e[p].text=M(o,e[p].text):e[p]={text:o,onetime:g,conditions:c},h&&(e[p].preDialog={text:h,glue:!1});let u=i.slice(s+1);U(u,e,l,p);return}}}function X(i){for(let e of i)if(typeof e=="string"){if(e.startsWith("^"))return C(e)}else if(e instanceof Array){let l=X(e);if(l)return l}}
6
-
7
- export { O as addChoiseIntoList, U as getLabelChoice };
3
+ `)s=!0;else if(t=="done"||t=="end")o(n,t,e,r,s,y),s=!1;else if(t=="<>")o(n,t,e,r,s,y),s=!1;else if(t=="nop"&&V){let f=L(S,p,h,e,l,r,c);f&&o(n,f,e,r,s,y),V=!1,S=[];}else t=="#"&&(y=!0);else if(t instanceof Array)if(V)S.push(t);else if(t.length>1&&typeof t[t.length-2]=="object"&&t[t.length-2]&&"c"in t[t.length-2]&&typeof t[t.length-1]=="object"&&t[t.length-1]&&"b"in t[t.length-1]){a.pop();let f=[],d=[];for(;a.length>0&&a[a.length-1]!="/ev";)f.push(a.pop());S=[...S,...f.reverse()],V=!0,d.push(t.pop()),d.push(t.pop()),S=[...S,...t],S.push(d);}else if(t.length>1&&typeof t[t.length-1]=="object"&&t[t.length-1]&&"#n"in t[t.length-1]){let f=t.pop();if(!f){console.error("[Pixi\u2019VN Ink] Error parsing ink file: el is undefined");return}let d=f["#n"];delete f["#n"],t.push(f),o(n,{"->":e?e+T+d:d},e,r,s,y),h({[d]:t},e,l);}else J(t,e,l,n,o,p,h,g,c,s);else if(t&&typeof t=="object")if("->"in t&&typeof t["->"]=="string"&&!new RegExp(/^\.\^\.\^\.\d\.s$/).test(t["->"])){let f=[];a.length>0&&(f=Y(["ev",...a],e,r)),t.params=f,o(n,t,e,r,s,y),s=!1;}else if("*"in t&&typeof t["*"]=="string")t["*"].includes("c")&&(a.push(t),s=!1);else if("s"in t&&t.s instanceof Array)a.push(t),s=!1;else if("CNT?"in t)a.push(t),s=!1;else if("VAR="in t||"temp="in t){let f=[],d=_("VAR="in t?t["VAR="]:t["temp="],r,void 0,"VAR="in t?"storage":"tempstorage");if(d.key!=="$r"){for(a.pop(),a[a.length-1]=="/ev"&&a.pop();a.length>0&&a[a.length-1]!="/ev";)f.push(a.pop());f=f.reverse(),d.value=R(f,e,r),a=[],(d.value!==void 0||d.value!==null)&&o(n,d,e,r,s,y),s=!1;}}else h(t,e,l);}),g(a,n,e,l,r),e.includes(T)&&n.length==2){let t=n[0],x=n[1];t&&x&&typeof t=="object"&&"dialogue"in t&&typeof x=="object"&&"labelToOpen"in x&&t.dialogue==" "&&x.labelToOpen&&(n.shift(),delete x.glueEnabled,n[0]=x);}}function k(i,e,l,n,o){if(e.length===0)return;let p=v(e,n,l);if(p.length===1){let h={type:"ifelse",condition:p[0],then:i,else:o};return h.else||delete h.else,h}else if(p.length>1){let h={type:"ifelse",condition:{type:"union",unionType:"and",conditions:p},then:i,else:o};return h.else||delete h.else,h}}function L(i,e,l,n,o,p,h=void 0){if(i.length===0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",i);return}let g=[],c=[];if(i.forEach(u=>{Array.isArray(u)?c.push(u):typeof u=="string"&&u==="du"?o.du?g.push(o.du):o.du=g[g.length-1]:(typeof u!="string"||u!=="/ev")&&g.push(u);}),c.length===0){console.error("[Pixi\u2019VN Ink] Error parsing ink file: Conditional statement is not valid",c);return}let s=j(c[0],e,l,n+T+"then",o,p,`${h||""}then`),r;return c.length===2?r=j(c[1],e,l,n+T+"else",o,p,`${h||""}else`):c.length>2&&(c.shift(),c.push("nop"),c=[{b:c}],r=j(c,e,l,n+T+"else",o,p,`${h||""}else`)),o.du=void 0,k(s,g,p,n,r)}function j(i,e,l,n,o,p,h=void 0){let g=[];for(let s of i)typeof s=="object"&&"b"in s&&(s.b=s.b.filter(r=>r!==null&&!(typeof r=="object"&&"->"in r&&new RegExp(/.*\.[0-9]/).test(r["->"]))),J(s.b,n,o,g,e,e,l,O,h,!0,p));return g.length===1?g[0]:{type:"resulttocombine",combine:"cross",secondConditionalItem:g}}function M(i="",e=""){let l=Array.isArray(i)?i:[i],n=Array.isArray(e)?e:[e];return [...new Set([...l,...n])]}function O(i,e,l,n,o){if(i.length>0){let p={};U(i,p,o);for(let[h,g]of Object.entries(p)){let c=l+T+h,s={text:g.text.length===1?g.text[0]:g.text,label:c,props:{},type:"jump",oneTime:g.onetime};g.text.length===0&&(s.onlyHaveNoChoice=!0,s.autoSelect=!0),s.oneTime===!1&&delete s.oneTime;let r=k(s,g.conditions,o,l)||s,u=e[e.length-1];if(typeof u=="object"&&u&&"type"in u&&(u={conditionalStep:u}),e.length>0&&typeof u=="object"&&u&&"choices"in u&&u.choices){let a=u.choices;a&&Array.isArray(a)?a.push(r):console.error("[Pixi\u2019VN Ink] Unhandled case: choices is PixiVNJsonConditionalStatements<PixiVNJsonChoices> | undefined",g,a),u.choices=a.sort((V,y)=>{try{let S=V.label.split("."),A=S[S.length-1].replaceAll(".",T),b=y.label.split("."),t=b[b.length-1].replaceAll(".",T);if(A.includes("c-")&&t.includes("c-")){let x=A.split("c-")[1],f=parseInt(x),d=t.split("c-")[1],P=parseInt(d);return f-P}}catch{}return 0});}else e.push({choices:[r]});g.preDialog&&(n.preDialog[c]={...g.preDialog});}}}function U(i,e,l,n){let o=[],p="",h="",g=!1,c=[];for(let s=0;s<i.length;s++){let r=i[s];if(typeof r=="string")r.startsWith("^")?o.push(C(r)):G.includes(r)&&c.push(r);else if(Array.isArray(r)&&r.includes("visit")){let u=E(r,q,(a,V,y)=>{},n,{preDialog:{}},l);o.push(u);}else if(r&&typeof r=="object")if("*"in r&&typeof r["*"]&&typeof r["*"]=="string")r["*"].includes("c")&&(p="c"+r["*"].split("c")[1],r.flg&16&&(g=!0));else if("s"in r&&r.s instanceof Array){let u=X(r.s),a=r.s.includes("<>");u&&(n&&e[n]?(e[n].preDialog={text:u,glue:a},e[n].text=M(u,e[n].text)):(o.push(u),h=u));}else "CNT?"in r&&c.push(r);else c.push(r);if(p){e[p]?e[p].text=M(o,e[p].text):e[p]={text:o,onetime:g,conditions:c},h&&(e[p].preDialog={text:h,glue:!1});let u=i.slice(s+1);U(u,e,l,p);return}}}function X(i){for(let e of i)if(typeof e=="string"){if(e.startsWith("^"))return C(e)}else if(e instanceof Array){let l=X(e);if(l)return l}}export{O as addChoiseIntoList,U as getLabelChoice};
@@ -0,0 +1 @@
1
+ 'use strict';require('@drincs/pixi-vn');function L(i){}exports.onInkHashtagScript=L;
@@ -0,0 +1,42 @@
1
+ import { StepLabelPropsType } from '@drincs/pixi-vn';
2
+
3
+ /**
4
+ * This function is called before the system interprets a possible Hashtag-Script that starts with `#`.
5
+ * The developer can use this function to run a custom Hashtag-Script. If the function returns `true`, the system will not interpret the Hashtag-Script.
6
+ * @param runCustomHashtagScript The function to run a custom Hashtag-Script
7
+ * @example
8
+ * ```ts
9
+ * import { onInkHashtagScript } from 'pixi-vn-ink'
10
+ *
11
+ * onInkHashtagScript((script, convertListStringToObj) => {
12
+ * // script: # navigate scene_name prop1 "value 1" prop2 "value 2"
13
+ * if (script[0] === "navigate" && script.length > 1) {
14
+ * let prop = undefined
15
+ * if (script.length > 2) {
16
+ * prop = convertListStringToObj(script.slice(2))
17
+ * }
18
+ * navigateTo(script[1], prop)
19
+ * }
20
+ * })
21
+ * ```
22
+ */
23
+ declare function onInkHashtagScript(runCustomHashtagScript: (
24
+ /**
25
+ * A Hashtag-Script to run. It corresponds to a line of code that starts with `#`.
26
+ * This is an array of strings, it is the Hashtag-Script that was split by spaces. For add a space in a string, you need to use `""`.
27
+ * For example, the Hashtag-Script `# command "Hello World"` will be split into `["command", "Hello World"]`.
28
+ */
29
+ script: string[],
30
+ /**
31
+ * The properties of the step. It is an object that contains the properties of the step.
32
+ */
33
+ props: {} | StepLabelPropsType,
34
+ /**
35
+ * It is often useful after writing a basic Hashtag-Script to add parameters with the following logic: "field name" "value".
36
+ * Furthermore, these parameters can be written in a different order, to simplify writing.
37
+ * This function is used to convert an array that has the following logic into a json. Here is an example:
38
+ * This is the array: `["name", "John", "age", "20", "position", "{ x: 2, y 3 }"]` and this is the json: `{name: "John", age: 20, position: { x: 2, y: 3 }}`.
39
+ */
40
+ convertListStringToObj: (listParm: string[]) => object) => boolean): void;
41
+
42
+ export { onInkHashtagScript };
@@ -0,0 +1,42 @@
1
+ import { StepLabelPropsType } from '@drincs/pixi-vn';
2
+
3
+ /**
4
+ * This function is called before the system interprets a possible Hashtag-Script that starts with `#`.
5
+ * The developer can use this function to run a custom Hashtag-Script. If the function returns `true`, the system will not interpret the Hashtag-Script.
6
+ * @param runCustomHashtagScript The function to run a custom Hashtag-Script
7
+ * @example
8
+ * ```ts
9
+ * import { onInkHashtagScript } from 'pixi-vn-ink'
10
+ *
11
+ * onInkHashtagScript((script, convertListStringToObj) => {
12
+ * // script: # navigate scene_name prop1 "value 1" prop2 "value 2"
13
+ * if (script[0] === "navigate" && script.length > 1) {
14
+ * let prop = undefined
15
+ * if (script.length > 2) {
16
+ * prop = convertListStringToObj(script.slice(2))
17
+ * }
18
+ * navigateTo(script[1], prop)
19
+ * }
20
+ * })
21
+ * ```
22
+ */
23
+ declare function onInkHashtagScript(runCustomHashtagScript: (
24
+ /**
25
+ * A Hashtag-Script to run. It corresponds to a line of code that starts with `#`.
26
+ * This is an array of strings, it is the Hashtag-Script that was split by spaces. For add a space in a string, you need to use `""`.
27
+ * For example, the Hashtag-Script `# command "Hello World"` will be split into `["command", "Hello World"]`.
28
+ */
29
+ script: string[],
30
+ /**
31
+ * The properties of the step. It is an object that contains the properties of the step.
32
+ */
33
+ props: {} | StepLabelPropsType,
34
+ /**
35
+ * It is often useful after writing a basic Hashtag-Script to add parameters with the following logic: "field name" "value".
36
+ * Furthermore, these parameters can be written in a different order, to simplify writing.
37
+ * This function is used to convert an array that has the following logic into a json. Here is an example:
38
+ * This is the array: `["name", "John", "age", "20", "position", "{ x: 2, y 3 }"]` and this is the json: `{name: "John", age: 20, position: { x: 2, y: 3 }}`.
39
+ */
40
+ convertListStringToObj: (listParm: string[]) => object) => boolean): void;
41
+
42
+ export { onInkHashtagScript };
@@ -0,0 +1 @@
1
+ import'@drincs/pixi-vn';function L(i){}export{L as onInkHashtagScript};