@drincs/pixi-vn-json 1.2.5 → 1.2.7
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/classes/LabelJson.cjs +2 -2
- package/dist/classes/LabelJson.js +2 -2
- package/dist/classes/index.cjs +2 -2
- package/dist/classes/index.js +2 -2
- package/dist/functions/assets.cjs +2 -2
- package/dist/functions/assets.js +2 -2
- package/dist/functions/importer.cjs +2 -2
- package/dist/functions/importer.js +2 -2
- package/dist/functions/index.cjs +2 -2
- package/dist/functions/index.js +2 -2
- package/dist/functions/operation-utility.cjs +2 -2
- package/dist/functions/operation-utility.js +2 -2
- package/dist/functions/utility.cjs +2 -2
- package/dist/functions/utility.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/managers/TranslateManager.cjs +1 -1
- package/dist/managers/TranslateManager.js +1 -1
- package/dist/managers/index.cjs +1 -1
- package/dist/managers/index.js +1 -1
- package/package.json +4 -4
package/dist/managers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var g=class t{static _beforeToTranslate=
|
|
1
|
+
var g=class t{static _beforeToTranslate=undefined;static _translate=e=>e;static _afterToTranslate=undefined;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,s){let n=s.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(r=>{e[r]===undefined&&(n==="empty_string"?e[r]="":n==="copy_key"&&(t._beforeToTranslate?e[r]=t._beforeToTranslate(r):e[r]=r));});}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(s=>{t.getConditionalsThenElse(s,i);});else if(e.elements.type==="ifelse"){let s=[];t.getConditionalsThenElse(e.elements,s),s.forEach(n=>{i.push(...n);});}else if(e.elements.type==="stepswitch"){let s=[];t.getConditionalsThenElse(e.elements,s),s.forEach(n=>{i.push(...n);});}else t.getConditionalsThenElse(e.elements,i);}else e.type==="resulttocombine"?(e.firstItem&&t.getConditionalsThenElse(e.firstItem,i),e.secondConditionalItem&&e.secondConditionalItem.forEach(s=>{t.getConditionalsThenElse(s,i);})):i.push(e);else e&&i.push(e);return i}static generateJsonTranslation(e,i={},s={}){return e.forEach(n=>{if(n.choices){let r=[];Array.isArray(n.choices)?r=[n.choices]:r=t.getConditionalsThenElse(n.choices),r.forEach(o=>o.forEach(a=>{if("type"in a){let T=[];a.type==="ifelse"||a.type==="stepswitch"?t.getConditionalsThenElse(a,T):T=[a],T.map(l=>t.getConditionalsThenElse(l.text)).forEach(l=>{Array.isArray(l)&&l.forEach(f=>{Array.isArray(f)?f.forEach(h=>{typeof h=="string"?t.addKey(i,h,s):t.getConditionalsThenElse(h).forEach(c=>{Array.isArray(c)?c.forEach(p=>{typeof p=="string"&&t.addKey(i,p,s);}):typeof c=="string"&&t.addKey(i,c,s);});}):typeof f=="string"&&t.addKey(i,f,s);});});}}));}if(n.dialogue){let r=[];Array.isArray(n.dialogue)?r=[n.dialogue]:r=t.getConditionalsThenElse(n.dialogue),r.forEach(o=>{typeof o=="string"?t.addKey(i,o,s):"text"in o&&Array.isArray(o.text)&&o.text.forEach(a=>{typeof a=="string"?t.addKey(i,a,s):t.getConditionalsThenElse(a).forEach(y=>{typeof y=="string"?t.addKey(i,y,s):Array.isArray(y)&&y.forEach(l=>{typeof l=="string"?t.addKey(i,l,s):t.getConditionalsThenElse(l).forEach(f=>{typeof f=="string"&&t.addKey(i,f,s);});});});});});}n.conditionalStep&&t.getConditionalsThenElse(n.conditionalStep).forEach(o=>{Array.isArray(o)?t.generateJsonTranslation(o,i,s):t.generateJsonTranslation([o],i,s);});}),i}};var u=g;export{u as translator};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drincs/pixi-vn-json",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
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",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/crypto-js": "^4.2.2",
|
|
28
28
|
"crypto-js": "^4.2.0",
|
|
29
|
-
"pixi.js": "^8.6.
|
|
29
|
+
"pixi.js": "^8.6.6",
|
|
30
30
|
"ts-node": "^10.9.2",
|
|
31
31
|
"tsup": "^8.3.5",
|
|
32
|
-
"typescript": "^5.7.
|
|
32
|
+
"typescript": "^5.7.3"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@drincs/pixi-vn": "^0.
|
|
35
|
+
"@drincs/pixi-vn": "^0.10.3"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
38
38
|
"game",
|