@drincs/pixi-vn-json 1.5.3 → 1.6.1

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 (79) hide show
  1. package/dist/{PixiVNJsonConditionalStatements-CdkmXvpt.d.cts → PixiVNJsonConditionalStatements-S3pFEkW9.d.cts} +1 -1
  2. package/dist/{PixiVNJsonConditionalStatements-CdkmXvpt.d.ts → PixiVNJsonConditionalStatements-S3pFEkW9.d.ts} +1 -1
  3. package/dist/classes/LabelJson.cjs +2 -2
  4. package/dist/classes/LabelJson.d.cts +2 -1
  5. package/dist/classes/LabelJson.d.ts +2 -1
  6. package/dist/classes/LabelJson.js +2 -2
  7. package/dist/classes/index.cjs +2 -2
  8. package/dist/classes/index.d.cts +2 -1
  9. package/dist/classes/index.d.ts +2 -1
  10. package/dist/classes/index.js +2 -2
  11. package/dist/functions/assets.cjs +2 -2
  12. package/dist/functions/assets.d.cts +2 -1
  13. package/dist/functions/assets.d.ts +2 -1
  14. package/dist/functions/assets.js +2 -2
  15. package/dist/functions/importer.cjs +2 -2
  16. package/dist/functions/importer.d.cts +2 -1
  17. package/dist/functions/importer.d.ts +2 -1
  18. package/dist/functions/importer.js +2 -2
  19. package/dist/functions/index.cjs +2 -2
  20. package/dist/functions/index.d.cts +2 -1
  21. package/dist/functions/index.d.ts +2 -1
  22. package/dist/functions/index.js +2 -2
  23. package/dist/functions/operation-utility.cjs +2 -2
  24. package/dist/functions/operation-utility.d.cts +2 -1
  25. package/dist/functions/operation-utility.d.ts +2 -1
  26. package/dist/functions/operation-utility.js +2 -2
  27. package/dist/functions/utility.cjs +2 -2
  28. package/dist/functions/utility.d.cts +2 -1
  29. package/dist/functions/utility.d.ts +2 -1
  30. package/dist/functions/utility.js +2 -2
  31. package/dist/index.cjs +2 -2
  32. package/dist/index.d.cts +2 -1
  33. package/dist/index.d.ts +2 -1
  34. package/dist/index.js +2 -2
  35. package/dist/interface/PixiVNJson.d.cts +2 -1
  36. package/dist/interface/PixiVNJson.d.ts +2 -1
  37. package/dist/interface/PixiVNJsonArithmeticOperations.d.cts +1 -1
  38. package/dist/interface/PixiVNJsonArithmeticOperations.d.ts +1 -1
  39. package/dist/interface/PixiVNJsonCanvas.d.cts +2 -1
  40. package/dist/interface/PixiVNJsonCanvas.d.ts +2 -1
  41. package/dist/interface/PixiVNJsonCanvasAnimate.cjs +1 -0
  42. package/dist/interface/PixiVNJsonCanvasAnimate.d.cts +19 -0
  43. package/dist/interface/PixiVNJsonCanvasAnimate.d.ts +19 -0
  44. package/dist/interface/PixiVNJsonCanvasAnimate.js +0 -0
  45. package/dist/interface/PixiVNJsonCanvasTicker.d.cts +15 -0
  46. package/dist/interface/PixiVNJsonCanvasTicker.d.ts +15 -0
  47. package/dist/interface/PixiVNJsonConditionalResultToCombine.d.cts +1 -1
  48. package/dist/interface/PixiVNJsonConditionalResultToCombine.d.ts +1 -1
  49. package/dist/interface/PixiVNJsonConditionalStatements.d.cts +1 -1
  50. package/dist/interface/PixiVNJsonConditionalStatements.d.ts +1 -1
  51. package/dist/interface/PixiVNJsonConditions.d.cts +1 -1
  52. package/dist/interface/PixiVNJsonConditions.d.ts +1 -1
  53. package/dist/interface/PixiVNJsonIfElse.d.cts +1 -1
  54. package/dist/interface/PixiVNJsonIfElse.d.ts +1 -1
  55. package/dist/interface/PixiVNJsonLabelStep.d.cts +2 -1
  56. package/dist/interface/PixiVNJsonLabelStep.d.ts +2 -1
  57. package/dist/interface/PixiVNJsonLabels.d.cts +2 -1
  58. package/dist/interface/PixiVNJsonLabels.d.ts +2 -1
  59. package/dist/interface/PixiVNJsonOperations.d.cts +2 -1
  60. package/dist/interface/PixiVNJsonOperations.d.ts +2 -1
  61. package/dist/interface/PixiVNJsonSound.d.cts +1 -1
  62. package/dist/interface/PixiVNJsonSound.d.ts +1 -1
  63. package/dist/interface/PixiVNJsonStepSwitch.d.cts +1 -1
  64. package/dist/interface/PixiVNJsonStepSwitch.d.ts +1 -1
  65. package/dist/interface/PixiVNJsonUnionCondition.d.cts +1 -1
  66. package/dist/interface/PixiVNJsonUnionCondition.d.ts +1 -1
  67. package/dist/interface/PixiVNJsonValue.d.cts +1 -1
  68. package/dist/interface/PixiVNJsonValue.d.ts +1 -1
  69. package/dist/interface/index.d.cts +2 -1
  70. package/dist/interface/index.d.ts +2 -1
  71. package/dist/managers/TranslateManager.cjs +1 -1
  72. package/dist/managers/TranslateManager.d.cts +15 -1
  73. package/dist/managers/TranslateManager.d.ts +15 -1
  74. package/dist/managers/TranslateManager.js +1 -1
  75. package/dist/managers/index.cjs +1 -1
  76. package/dist/managers/index.d.cts +2 -1
  77. package/dist/managers/index.d.ts +2 -1
  78. package/dist/managers/index.js +1 -1
  79. package/package.json +3 -3
@@ -1,8 +1,9 @@
1
1
  import PixiVNJsonCanvas from './PixiVNJsonCanvas.js';
2
- import { r as PixiVNJsonValueSet, g as PixiVNJsonIfElse, q as PixiVNJsonValueGet, d as PixiVNJsonConditionalStatements } from '../PixiVNJsonConditionalStatements-CdkmXvpt.js';
2
+ import { r as PixiVNJsonValueSet, g as PixiVNJsonIfElse, q as PixiVNJsonValueGet, d as PixiVNJsonConditionalStatements } from '../PixiVNJsonConditionalStatements-S3pFEkW9.js';
3
3
  import PixiVNJsonInput from './PixiVNJsonInput.js';
4
4
  import PixiVNJsonSound from './PixiVNJsonSound.js';
5
5
  import '@drincs/pixi-vn';
6
+ import './PixiVNJsonCanvasAnimate.js';
6
7
  import './PixiVNJsonCanvasEffect.js';
7
8
  import './PixiVNJsonCanvasTicker.js';
8
9
  import './PixiVNJsonMediaTransiotions.js';
@@ -22,6 +22,6 @@ type PixiVNJsonSoundVolume = {
22
22
  alias: string;
23
23
  value: number;
24
24
  };
25
- type PixiVNJsonSound = (PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundVolume);
25
+ type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundVolume;
26
26
 
27
27
  export type { PixiVNJsonSound as default };
@@ -22,6 +22,6 @@ type PixiVNJsonSoundVolume = {
22
22
  alias: string;
23
23
  value: number;
24
24
  };
25
- type PixiVNJsonSound = (PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundVolume);
25
+ type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundVolume;
26
26
 
27
27
  export type { PixiVNJsonSound as default };
@@ -1,2 +1,2 @@
1
- export { j as PixiVNJsonStepSwitchElementType, i as PixiVNJsonStepSwitchElementsType, h as default } from '../PixiVNJsonConditionalStatements-CdkmXvpt.cjs';
1
+ export { j as PixiVNJsonStepSwitchElementType, i as PixiVNJsonStepSwitchElementsType, h as default } from '../PixiVNJsonConditionalStatements-S3pFEkW9.cjs';
2
2
  import '@drincs/pixi-vn';
@@ -1,2 +1,2 @@
1
- export { j as PixiVNJsonStepSwitchElementType, i as PixiVNJsonStepSwitchElementsType, h as default } from '../PixiVNJsonConditionalStatements-CdkmXvpt.js';
1
+ export { j as PixiVNJsonStepSwitchElementType, i as PixiVNJsonStepSwitchElementsType, h as default } from '../PixiVNJsonConditionalStatements-S3pFEkW9.js';
2
2
  import '@drincs/pixi-vn';
@@ -1,2 +1,2 @@
1
- export { k as default } from '../PixiVNJsonConditionalStatements-CdkmXvpt.cjs';
1
+ export { k as default } from '../PixiVNJsonConditionalStatements-S3pFEkW9.cjs';
2
2
  import '@drincs/pixi-vn';
@@ -1,2 +1,2 @@
1
- export { k as default } from '../PixiVNJsonConditionalStatements-CdkmXvpt.js';
1
+ export { k as default } from '../PixiVNJsonConditionalStatements-S3pFEkW9.js';
2
2
  import '@drincs/pixi-vn';
@@ -1,2 +1,2 @@
1
1
  import '@drincs/pixi-vn';
2
- export { l as PixiVNJsonChoiceGet, m as PixiVNJsonLabelGet, n as PixiVNJsonLogicGet, o as PixiVNJsonParamGet, p as PixiVNJsonStorageGet, q as PixiVNJsonValueGet, r as PixiVNJsonValueSet } from '../PixiVNJsonConditionalStatements-CdkmXvpt.cjs';
2
+ export { l as PixiVNJsonChoiceGet, m as PixiVNJsonLabelGet, n as PixiVNJsonLogicGet, o as PixiVNJsonParamGet, p as PixiVNJsonStorageGet, q as PixiVNJsonValueGet, r as PixiVNJsonValueSet } from '../PixiVNJsonConditionalStatements-S3pFEkW9.cjs';
@@ -1,2 +1,2 @@
1
1
  import '@drincs/pixi-vn';
2
- export { l as PixiVNJsonChoiceGet, m as PixiVNJsonLabelGet, n as PixiVNJsonLogicGet, o as PixiVNJsonParamGet, p as PixiVNJsonStorageGet, q as PixiVNJsonValueGet, r as PixiVNJsonValueSet } from '../PixiVNJsonConditionalStatements-CdkmXvpt.js';
2
+ export { l as PixiVNJsonChoiceGet, m as PixiVNJsonLabelGet, n as PixiVNJsonLogicGet, o as PixiVNJsonParamGet, p as PixiVNJsonStorageGet, q as PixiVNJsonValueGet, r as PixiVNJsonValueSet } from '../PixiVNJsonConditionalStatements-S3pFEkW9.js';
@@ -1,6 +1,7 @@
1
1
  export { default as PixiVNJson } from './PixiVNJson.cjs';
2
- export { P as PixiVNJsonArithmeticOperations, a as PixiVNJsonArithmeticOperationsArithmetic, b as PixiVNJsonArithmeticOperationsArithmeticSingle, l as PixiVNJsonChoiceGet, e as PixiVNJsonComparation, c as PixiVNJsonConditionalResultToCombine, d as PixiVNJsonConditionalStatements, f as PixiVNJsonConditions, g as PixiVNJsonIfElse, m as PixiVNJsonLabelGet, n as PixiVNJsonLogicGet, o as PixiVNJsonParamGet, h as PixiVNJsonStepSwitch, j as PixiVNJsonStepSwitchElementType, i as PixiVNJsonStepSwitchElementsType, p as PixiVNJsonStorageGet, k as PixiVNJsonUnionCondition, q as PixiVNJsonValueGet, r as PixiVNJsonValueSet } from '../PixiVNJsonConditionalStatements-CdkmXvpt.cjs';
2
+ export { P as PixiVNJsonArithmeticOperations, a as PixiVNJsonArithmeticOperationsArithmetic, b as PixiVNJsonArithmeticOperationsArithmeticSingle, l as PixiVNJsonChoiceGet, e as PixiVNJsonComparation, c as PixiVNJsonConditionalResultToCombine, d as PixiVNJsonConditionalStatements, f as PixiVNJsonConditions, g as PixiVNJsonIfElse, m as PixiVNJsonLabelGet, n as PixiVNJsonLogicGet, o as PixiVNJsonParamGet, h as PixiVNJsonStepSwitch, j as PixiVNJsonStepSwitchElementType, i as PixiVNJsonStepSwitchElementsType, p as PixiVNJsonStorageGet, k as PixiVNJsonUnionCondition, q as PixiVNJsonValueGet, r as PixiVNJsonValueSet } from '../PixiVNJsonConditionalStatements-S3pFEkW9.cjs';
3
3
  export { default as PixiVNJsonCanvas, PixiVNJsonCanvasEdit, PixiVNJsonCanvasRemove, PixiVNJsonCanvasShow } from './PixiVNJsonCanvas.cjs';
4
+ export { PixiVNJsonAnimateBase, PixiVNJsonAnimateSequence, default as PixiVNJsonCanvasAnimate } from './PixiVNJsonCanvasAnimate.cjs';
4
5
  export { default as PixiVNJsonCanvasEffect } from './PixiVNJsonCanvasEffect.cjs';
5
6
  export { default as PixiVNJsonCanvasTicker } from './PixiVNJsonCanvasTicker.cjs';
6
7
  export { default as PixiVNJsonInput } from './PixiVNJsonInput.cjs';
@@ -1,6 +1,7 @@
1
1
  export { default as PixiVNJson } from './PixiVNJson.js';
2
- export { P as PixiVNJsonArithmeticOperations, a as PixiVNJsonArithmeticOperationsArithmetic, b as PixiVNJsonArithmeticOperationsArithmeticSingle, l as PixiVNJsonChoiceGet, e as PixiVNJsonComparation, c as PixiVNJsonConditionalResultToCombine, d as PixiVNJsonConditionalStatements, f as PixiVNJsonConditions, g as PixiVNJsonIfElse, m as PixiVNJsonLabelGet, n as PixiVNJsonLogicGet, o as PixiVNJsonParamGet, h as PixiVNJsonStepSwitch, j as PixiVNJsonStepSwitchElementType, i as PixiVNJsonStepSwitchElementsType, p as PixiVNJsonStorageGet, k as PixiVNJsonUnionCondition, q as PixiVNJsonValueGet, r as PixiVNJsonValueSet } from '../PixiVNJsonConditionalStatements-CdkmXvpt.js';
2
+ export { P as PixiVNJsonArithmeticOperations, a as PixiVNJsonArithmeticOperationsArithmetic, b as PixiVNJsonArithmeticOperationsArithmeticSingle, l as PixiVNJsonChoiceGet, e as PixiVNJsonComparation, c as PixiVNJsonConditionalResultToCombine, d as PixiVNJsonConditionalStatements, f as PixiVNJsonConditions, g as PixiVNJsonIfElse, m as PixiVNJsonLabelGet, n as PixiVNJsonLogicGet, o as PixiVNJsonParamGet, h as PixiVNJsonStepSwitch, j as PixiVNJsonStepSwitchElementType, i as PixiVNJsonStepSwitchElementsType, p as PixiVNJsonStorageGet, k as PixiVNJsonUnionCondition, q as PixiVNJsonValueGet, r as PixiVNJsonValueSet } from '../PixiVNJsonConditionalStatements-S3pFEkW9.js';
3
3
  export { default as PixiVNJsonCanvas, PixiVNJsonCanvasEdit, PixiVNJsonCanvasRemove, PixiVNJsonCanvasShow } from './PixiVNJsonCanvas.js';
4
+ export { PixiVNJsonAnimateBase, PixiVNJsonAnimateSequence, default as PixiVNJsonCanvasAnimate } from './PixiVNJsonCanvasAnimate.js';
4
5
  export { default as PixiVNJsonCanvasEffect } from './PixiVNJsonCanvasEffect.js';
5
6
  export { default as PixiVNJsonCanvasTicker } from './PixiVNJsonCanvasTicker.js';
6
7
  export { default as PixiVNJsonInput } from './PixiVNJsonInput.js';
@@ -1 +1 @@
1
- 'use strict';var h=class t{static _beforeToTranslate=void 0;static _translate=e=>e;static _afterToTranslate=void 0;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]===void 0&&(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(l=>l.forEach(o=>{if("type"in o){let g=[];o.type==="ifelse"||o.type==="stepswitch"?t.getConditionalsThenElse(o,g):g=[o],g.map(a=>t.getConditionalsThenElse(a.text)).forEach(a=>{Array.isArray(a)&&a.forEach(f=>{Array.isArray(f)?f.forEach(c=>{typeof c=="string"?t.addKey(i,c,s):t.getConditionalsThenElse(c).forEach(T=>{Array.isArray(T)?T.forEach(d=>{typeof d=="string"&&t.addKey(i,d,s);}):typeof T=="string"&&t.addKey(i,T,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(l=>{typeof l=="string"?t.addKey(i,l,s):"text"in l&&Array.isArray(l.text)&&l.text.forEach(o=>{typeof o=="string"?t.addKey(i,o,s):t.getConditionalsThenElse(o).forEach(y=>{typeof y=="string"?t.addKey(i,y,s):Array.isArray(y)&&y.forEach(a=>{typeof a=="string"?t.addKey(i,a,s):t.getConditionalsThenElse(a).forEach(f=>{typeof f=="string"&&t.addKey(i,f,s);});});});});});}n.conditionalStep&&t.getConditionalsThenElse(n.conditionalStep).forEach(l=>{Array.isArray(l)?t.generateJsonTranslation(l,i,s):t.generateJsonTranslation([l],i,s);});}),i}};module.exports=h;
1
+ 'use strict';var p=class t{static _beforeToTranslate=void 0;static _translate=e=>e;static _afterToTranslate=void 0;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,r){let n=r.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(s=>{e[s]===void 0&&(n==="empty_string"?e[s]="":n==="copy_key"&&(t._beforeToTranslate?e[s]=t._beforeToTranslate(s):e[s]=s));});}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(r=>{t.getConditionalsThenElse(r,i);});else if(e.elements.type==="ifelse"){let r=[];t.getConditionalsThenElse(e.elements,r),r.forEach(n=>{i.push(...n);});}else if(e.elements.type==="stepswitch"){let r=[];t.getConditionalsThenElse(e.elements,r),r.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(r=>{t.getConditionalsThenElse(r,i);})):i.push(e);else e&&i.push(e);return i}static generateJsonTranslation(e,i={},r={}){let{defaultValue:n="copy_key"}=r;return e.forEach(s=>{if(s.choices){let a=[];Array.isArray(s.choices)?a=[s.choices]:a=t.getConditionalsThenElse(s.choices),a.forEach(o=>o.forEach(l=>{if("type"in l){let T=[];l.type==="ifelse"||l.type==="stepswitch"?t.getConditionalsThenElse(l,T):T=[l],T.map(f=>t.getConditionalsThenElse(f.text)).forEach(f=>{Array.isArray(f)&&f.forEach(y=>{Array.isArray(y)?y.forEach(h=>{typeof h=="string"?t.addKey(i,h,{defaultValue:n}):t.getConditionalsThenElse(h).forEach(c=>{Array.isArray(c)?c.forEach(d=>{typeof d=="string"&&t.addKey(i,d,{defaultValue:n});}):typeof c=="string"&&t.addKey(i,c,{defaultValue:n});});}):typeof y=="string"&&t.addKey(i,y,{defaultValue:n});});});}}));}if(s.dialogue){let a=[];Array.isArray(s.dialogue)?a=[s.dialogue]:a=t.getConditionalsThenElse(s.dialogue),a.forEach(o=>{typeof o=="string"?t.addKey(i,o,{defaultValue:n}):"text"in o&&Array.isArray(o.text)&&o.text.forEach(l=>{typeof l=="string"?t.addKey(i,l,{defaultValue:n}):t.getConditionalsThenElse(l).forEach(g=>{typeof g=="string"?t.addKey(i,g,{defaultValue:n}):Array.isArray(g)&&g.forEach(f=>{typeof f=="string"?t.addKey(i,f,{defaultValue:n}):t.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"&&t.addKey(i,y,{defaultValue:n});});});});});});}s.conditionalStep&&t.getConditionalsThenElse(s.conditionalStep).forEach(o=>{Array.isArray(o)?t.generateJsonTranslation(o,i,r):t.generateJsonTranslation([o],i,r);});}),i}};module.exports=p;
@@ -1,8 +1,9 @@
1
1
  import PixiVNJsonLabelStep from '../interface/PixiVNJsonLabelStep.cjs';
2
2
  import '@drincs/pixi-vn';
3
- import '../PixiVNJsonConditionalStatements-CdkmXvpt.cjs';
3
+ import '../PixiVNJsonConditionalStatements-S3pFEkW9.cjs';
4
4
  import '../interface/PixiVNJsonOperations.cjs';
5
5
  import '../interface/PixiVNJsonCanvas.cjs';
6
+ import '../interface/PixiVNJsonCanvasAnimate.cjs';
6
7
  import '../interface/PixiVNJsonCanvasEffect.cjs';
7
8
  import '../interface/PixiVNJsonCanvasTicker.cjs';
8
9
  import '../interface/PixiVNJsonMediaTransiotions.cjs';
@@ -20,7 +21,20 @@ declare class TranslatorManager {
20
21
  static set afterToTranslate(value: (key: string) => string);
21
22
  private static addKey;
22
23
  private static getConditionalsThenElse;
24
+ /**
25
+ * Generates a JSON translation object from the provided labels.
26
+ * @param labels The labels to translate.
27
+ * @param json The JSON object to populate with translations.
28
+ * @param options Options for translation, including default value handling.
29
+ * @returns The populated JSON object with translations.
30
+ */
23
31
  static generateJsonTranslation(labels: PixiVNJsonLabelStep[], json?: object, options?: {
32
+ /**
33
+ * Default value to use when a key is not found.
34
+ * - "empty_string": Use an empty string as the default value.
35
+ * - "copy_key": Use the key itself as the default value.
36
+ * @default "copy_key"
37
+ */
24
38
  defaultValue?: "empty_string" | "copy_key";
25
39
  }): object;
26
40
  }
@@ -1,8 +1,9 @@
1
1
  import PixiVNJsonLabelStep from '../interface/PixiVNJsonLabelStep.js';
2
2
  import '@drincs/pixi-vn';
3
- import '../PixiVNJsonConditionalStatements-CdkmXvpt.js';
3
+ import '../PixiVNJsonConditionalStatements-S3pFEkW9.js';
4
4
  import '../interface/PixiVNJsonOperations.js';
5
5
  import '../interface/PixiVNJsonCanvas.js';
6
+ import '../interface/PixiVNJsonCanvasAnimate.js';
6
7
  import '../interface/PixiVNJsonCanvasEffect.js';
7
8
  import '../interface/PixiVNJsonCanvasTicker.js';
8
9
  import '../interface/PixiVNJsonMediaTransiotions.js';
@@ -20,7 +21,20 @@ declare class TranslatorManager {
20
21
  static set afterToTranslate(value: (key: string) => string);
21
22
  private static addKey;
22
23
  private static getConditionalsThenElse;
24
+ /**
25
+ * Generates a JSON translation object from the provided labels.
26
+ * @param labels The labels to translate.
27
+ * @param json The JSON object to populate with translations.
28
+ * @param options Options for translation, including default value handling.
29
+ * @returns The populated JSON object with translations.
30
+ */
23
31
  static generateJsonTranslation(labels: PixiVNJsonLabelStep[], json?: object, options?: {
32
+ /**
33
+ * Default value to use when a key is not found.
34
+ * - "empty_string": Use an empty string as the default value.
35
+ * - "copy_key": Use the key itself as the default value.
36
+ * @default "copy_key"
37
+ */
24
38
  defaultValue?: "empty_string" | "copy_key";
25
39
  }): object;
26
40
  }
@@ -1 +1 @@
1
- var h=class t{static _beforeToTranslate=void 0;static _translate=e=>e;static _afterToTranslate=void 0;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]===void 0&&(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(l=>l.forEach(o=>{if("type"in o){let g=[];o.type==="ifelse"||o.type==="stepswitch"?t.getConditionalsThenElse(o,g):g=[o],g.map(a=>t.getConditionalsThenElse(a.text)).forEach(a=>{Array.isArray(a)&&a.forEach(f=>{Array.isArray(f)?f.forEach(c=>{typeof c=="string"?t.addKey(i,c,s):t.getConditionalsThenElse(c).forEach(T=>{Array.isArray(T)?T.forEach(d=>{typeof d=="string"&&t.addKey(i,d,s);}):typeof T=="string"&&t.addKey(i,T,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(l=>{typeof l=="string"?t.addKey(i,l,s):"text"in l&&Array.isArray(l.text)&&l.text.forEach(o=>{typeof o=="string"?t.addKey(i,o,s):t.getConditionalsThenElse(o).forEach(y=>{typeof y=="string"?t.addKey(i,y,s):Array.isArray(y)&&y.forEach(a=>{typeof a=="string"?t.addKey(i,a,s):t.getConditionalsThenElse(a).forEach(f=>{typeof f=="string"&&t.addKey(i,f,s);});});});});});}n.conditionalStep&&t.getConditionalsThenElse(n.conditionalStep).forEach(l=>{Array.isArray(l)?t.generateJsonTranslation(l,i,s):t.generateJsonTranslation([l],i,s);});}),i}};export{h as default};
1
+ var p=class t{static _beforeToTranslate=void 0;static _translate=e=>e;static _afterToTranslate=void 0;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,r){let n=r.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(s=>{e[s]===void 0&&(n==="empty_string"?e[s]="":n==="copy_key"&&(t._beforeToTranslate?e[s]=t._beforeToTranslate(s):e[s]=s));});}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(r=>{t.getConditionalsThenElse(r,i);});else if(e.elements.type==="ifelse"){let r=[];t.getConditionalsThenElse(e.elements,r),r.forEach(n=>{i.push(...n);});}else if(e.elements.type==="stepswitch"){let r=[];t.getConditionalsThenElse(e.elements,r),r.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(r=>{t.getConditionalsThenElse(r,i);})):i.push(e);else e&&i.push(e);return i}static generateJsonTranslation(e,i={},r={}){let{defaultValue:n="copy_key"}=r;return e.forEach(s=>{if(s.choices){let a=[];Array.isArray(s.choices)?a=[s.choices]:a=t.getConditionalsThenElse(s.choices),a.forEach(o=>o.forEach(l=>{if("type"in l){let T=[];l.type==="ifelse"||l.type==="stepswitch"?t.getConditionalsThenElse(l,T):T=[l],T.map(f=>t.getConditionalsThenElse(f.text)).forEach(f=>{Array.isArray(f)&&f.forEach(y=>{Array.isArray(y)?y.forEach(h=>{typeof h=="string"?t.addKey(i,h,{defaultValue:n}):t.getConditionalsThenElse(h).forEach(c=>{Array.isArray(c)?c.forEach(d=>{typeof d=="string"&&t.addKey(i,d,{defaultValue:n});}):typeof c=="string"&&t.addKey(i,c,{defaultValue:n});});}):typeof y=="string"&&t.addKey(i,y,{defaultValue:n});});});}}));}if(s.dialogue){let a=[];Array.isArray(s.dialogue)?a=[s.dialogue]:a=t.getConditionalsThenElse(s.dialogue),a.forEach(o=>{typeof o=="string"?t.addKey(i,o,{defaultValue:n}):"text"in o&&Array.isArray(o.text)&&o.text.forEach(l=>{typeof l=="string"?t.addKey(i,l,{defaultValue:n}):t.getConditionalsThenElse(l).forEach(g=>{typeof g=="string"?t.addKey(i,g,{defaultValue:n}):Array.isArray(g)&&g.forEach(f=>{typeof f=="string"?t.addKey(i,f,{defaultValue:n}):t.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"&&t.addKey(i,y,{defaultValue:n});});});});});});}s.conditionalStep&&t.getConditionalsThenElse(s.conditionalStep).forEach(o=>{Array.isArray(o)?t.generateJsonTranslation(o,i,r):t.generateJsonTranslation([o],i,r);});}),i}};export{p as default};
@@ -1 +1 @@
1
- 'use strict';var g=class t{static _beforeToTranslate=void 0;static _translate=e=>e;static _afterToTranslate=void 0;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]===void 0&&(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;exports.translator=u;
1
+ 'use strict';var T=class t{static _beforeToTranslate=void 0;static _translate=e=>e;static _afterToTranslate=void 0;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,r){let n=r.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(s=>{e[s]===void 0&&(n==="empty_string"?e[s]="":n==="copy_key"&&(t._beforeToTranslate?e[s]=t._beforeToTranslate(s):e[s]=s));});}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(r=>{t.getConditionalsThenElse(r,i);});else if(e.elements.type==="ifelse"){let r=[];t.getConditionalsThenElse(e.elements,r),r.forEach(n=>{i.push(...n);});}else if(e.elements.type==="stepswitch"){let r=[];t.getConditionalsThenElse(e.elements,r),r.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(r=>{t.getConditionalsThenElse(r,i);})):i.push(e);else e&&i.push(e);return i}static generateJsonTranslation(e,i={},r={}){let{defaultValue:n="copy_key"}=r;return e.forEach(s=>{if(s.choices){let l=[];Array.isArray(s.choices)?l=[s.choices]:l=t.getConditionalsThenElse(s.choices),l.forEach(o=>o.forEach(a=>{if("type"in a){let c=[];a.type==="ifelse"||a.type==="stepswitch"?t.getConditionalsThenElse(a,c):c=[a],c.map(f=>t.getConditionalsThenElse(f.text)).forEach(f=>{Array.isArray(f)&&f.forEach(y=>{Array.isArray(y)?y.forEach(p=>{typeof p=="string"?t.addKey(i,p,{defaultValue:n}):t.getConditionalsThenElse(p).forEach(h=>{Array.isArray(h)?h.forEach(d=>{typeof d=="string"&&t.addKey(i,d,{defaultValue:n});}):typeof h=="string"&&t.addKey(i,h,{defaultValue:n});});}):typeof y=="string"&&t.addKey(i,y,{defaultValue:n});});});}}));}if(s.dialogue){let l=[];Array.isArray(s.dialogue)?l=[s.dialogue]:l=t.getConditionalsThenElse(s.dialogue),l.forEach(o=>{typeof o=="string"?t.addKey(i,o,{defaultValue:n}):"text"in o&&Array.isArray(o.text)&&o.text.forEach(a=>{typeof a=="string"?t.addKey(i,a,{defaultValue:n}):t.getConditionalsThenElse(a).forEach(g=>{typeof g=="string"?t.addKey(i,g,{defaultValue:n}):Array.isArray(g)&&g.forEach(f=>{typeof f=="string"?t.addKey(i,f,{defaultValue:n}):t.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"&&t.addKey(i,y,{defaultValue:n});});});});});});}s.conditionalStep&&t.getConditionalsThenElse(s.conditionalStep).forEach(o=>{Array.isArray(o)?t.generateJsonTranslation(o,i,r):t.generateJsonTranslation([o],i,r);});}),i}};var C=T;exports.translator=C;
@@ -1,9 +1,10 @@
1
1
  import TranslatorManager from './TranslateManager.cjs';
2
2
  import '../interface/PixiVNJsonLabelStep.cjs';
3
3
  import '@drincs/pixi-vn';
4
- import '../PixiVNJsonConditionalStatements-CdkmXvpt.cjs';
4
+ import '../PixiVNJsonConditionalStatements-S3pFEkW9.cjs';
5
5
  import '../interface/PixiVNJsonOperations.cjs';
6
6
  import '../interface/PixiVNJsonCanvas.cjs';
7
+ import '../interface/PixiVNJsonCanvasAnimate.cjs';
7
8
  import '../interface/PixiVNJsonCanvasEffect.cjs';
8
9
  import '../interface/PixiVNJsonCanvasTicker.cjs';
9
10
  import '../interface/PixiVNJsonMediaTransiotions.cjs';
@@ -1,9 +1,10 @@
1
1
  import TranslatorManager from './TranslateManager.js';
2
2
  import '../interface/PixiVNJsonLabelStep.js';
3
3
  import '@drincs/pixi-vn';
4
- import '../PixiVNJsonConditionalStatements-CdkmXvpt.js';
4
+ import '../PixiVNJsonConditionalStatements-S3pFEkW9.js';
5
5
  import '../interface/PixiVNJsonOperations.js';
6
6
  import '../interface/PixiVNJsonCanvas.js';
7
+ import '../interface/PixiVNJsonCanvasAnimate.js';
7
8
  import '../interface/PixiVNJsonCanvasEffect.js';
8
9
  import '../interface/PixiVNJsonCanvasTicker.js';
9
10
  import '../interface/PixiVNJsonMediaTransiotions.js';
@@ -1 +1 @@
1
- var g=class t{static _beforeToTranslate=void 0;static _translate=e=>e;static _afterToTranslate=void 0;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]===void 0&&(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};
1
+ var T=class t{static _beforeToTranslate=void 0;static _translate=e=>e;static _afterToTranslate=void 0;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,r){let n=r.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(s=>{e[s]===void 0&&(n==="empty_string"?e[s]="":n==="copy_key"&&(t._beforeToTranslate?e[s]=t._beforeToTranslate(s):e[s]=s));});}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(r=>{t.getConditionalsThenElse(r,i);});else if(e.elements.type==="ifelse"){let r=[];t.getConditionalsThenElse(e.elements,r),r.forEach(n=>{i.push(...n);});}else if(e.elements.type==="stepswitch"){let r=[];t.getConditionalsThenElse(e.elements,r),r.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(r=>{t.getConditionalsThenElse(r,i);})):i.push(e);else e&&i.push(e);return i}static generateJsonTranslation(e,i={},r={}){let{defaultValue:n="copy_key"}=r;return e.forEach(s=>{if(s.choices){let l=[];Array.isArray(s.choices)?l=[s.choices]:l=t.getConditionalsThenElse(s.choices),l.forEach(o=>o.forEach(a=>{if("type"in a){let c=[];a.type==="ifelse"||a.type==="stepswitch"?t.getConditionalsThenElse(a,c):c=[a],c.map(f=>t.getConditionalsThenElse(f.text)).forEach(f=>{Array.isArray(f)&&f.forEach(y=>{Array.isArray(y)?y.forEach(p=>{typeof p=="string"?t.addKey(i,p,{defaultValue:n}):t.getConditionalsThenElse(p).forEach(h=>{Array.isArray(h)?h.forEach(d=>{typeof d=="string"&&t.addKey(i,d,{defaultValue:n});}):typeof h=="string"&&t.addKey(i,h,{defaultValue:n});});}):typeof y=="string"&&t.addKey(i,y,{defaultValue:n});});});}}));}if(s.dialogue){let l=[];Array.isArray(s.dialogue)?l=[s.dialogue]:l=t.getConditionalsThenElse(s.dialogue),l.forEach(o=>{typeof o=="string"?t.addKey(i,o,{defaultValue:n}):"text"in o&&Array.isArray(o.text)&&o.text.forEach(a=>{typeof a=="string"?t.addKey(i,a,{defaultValue:n}):t.getConditionalsThenElse(a).forEach(g=>{typeof g=="string"?t.addKey(i,g,{defaultValue:n}):Array.isArray(g)&&g.forEach(f=>{typeof f=="string"?t.addKey(i,f,{defaultValue:n}):t.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"&&t.addKey(i,y,{defaultValue:n});});});});});});}s.conditionalStep&&t.getConditionalsThenElse(s.conditionalStep).forEach(o=>{Array.isArray(o)?t.generateJsonTranslation(o,i,r):t.generateJsonTranslation([o],i,r);});}),i}};var C=T;export{C as translator};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn-json",
3
- "version": "1.5.3",
3
+ "version": "1.6.1",
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",
@@ -30,10 +30,10 @@
30
30
  "jsdom": "^26.1.0",
31
31
  "ts-node": "^10.9.2",
32
32
  "tsup": "^8.5.0",
33
- "typescript": "^5.8.3"
33
+ "typescript": "^5.9.2"
34
34
  },
35
35
  "peerDependencies": {
36
- "@drincs/pixi-vn": ">=1.2.3"
36
+ "@drincs/pixi-vn": ">=1.3.0"
37
37
  },
38
38
  "keywords": [
39
39
  "game",