@drincs/pixi-vn-json 1.9.0 → 1.9.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.
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var importer=require('@drincs/pixi-vn-json/importer'),translator=require('@drincs/pixi-vn-json/translator'),unifier=require('@drincs/pixi-vn-json/unifier'),canvas=require('@drincs/pixi-vn/canvas'),narration=require('@drincs/pixi-vn/narration'),pixiVn=require('@drincs/pixi-vn'),storage=require('@drincs/pixi-vn/storage');var V="___param___";async function I(e){let a=unifier.JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await canvas.Assets.load(a.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await canvas.Assets.loadBundle(a.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(a.aliases);break}break}}var o;(n=>(n.log=(r,...u)=>console.log(`[Pixi\u2019VN Json] ${r}`,...u),n.warn=(r,...u)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...u),n.error=(r,...u)=>console.error(`[Pixi\u2019VN Json] ${r}`,...u),n.info=(r,...u)=>console.info(`[Pixi\u2019VN Json] ${r}`,...u)))(o||(o={}));async function b(e,a,i){switch(i.type){case "fade":await canvas.showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await canvas.showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await canvas.moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await canvas.pushIn(a.alias,e,i.props,i.priority);break}}function h(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function v(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageSprite(e.props,e.url||e.alias);await b(i,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Image with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let n=new canvas.VideoSprite(e.props,e.url||e.alias);await b(n,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Video with alias ${e.alias} not found.`);break;case "remove":h(e);break;case "pause":let i=canvas.canvas.find(e.alias);i?i.paused=true:o.error(`Video with alias ${e.alias} not found.`);break;case "resume":let l=canvas.canvas.find(e.alias);l?l.paused=false:o.error(`Video with alias ${e.alias} not found.`);break}}async function _(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageContainer(e.props,e.urls);await b(i,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function R(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let i=new canvas.Text(e.props);await b(i,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Text with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function L(e){switch(e.operationType){case "edit":try{let a=canvas.canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):o.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){o.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":h(e);break}}async function D(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function G(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function $(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function F(e){switch(e.operationType){case "play":pixiVn.sound.play(e.alias,e.props);break;case "stop":pixiVn.sound.stop(e.alias);break;case "pause":pixiVn.sound.pause(e.alias);break;case "resume":pixiVn.sound.resume(e.alias);break;case "volume":pixiVn.sound.volume(e.alias,e.value);break}}function j(e){try{if(typeof e>"u")return e;let a=JSON.stringify(e);return JSON.parse(a)}catch(a){throw o.error("Error creating exportable element",e,a),new Error("[Pixi\u2019VN] Error creating exportable element")}}function U(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,i);break;case "tempstorage":storage.storage.setTempVariable(e.key,i);break;case "params":let l=storage.storage.get(`${V}${narration.narration.openedLabels.length-1}`)||[];l&&l.length-1>=e.key&&(l[e.key]=i),storage.storage.setTempVariable(`${V}${narration.narration.openedLabels.length-1}`,l);break}}function X(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:i};break}}function t(e){let a=be(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return Ve(a);case "arithmetic":case "arithmeticsingle":return ye(a);case "compare":case "valueCondition":case "union":return he(a)}return a}function ye(e){let a=t(e.leftValue);switch(e.type){case "arithmetic":let i=t(e.rightValue);switch(e.operator){case "*":return a*i;case "/":return a/i;case "+":return a+i;case "-":return a-i;case "%":return a%i;case "POW":return Math.pow(a,i);case "RANDOM":return narration.narration.getRandomNumber(a,i)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(a);case "FLOOR":return Math.floor(a);case "FLOAT":return parseFloat(a)}break}}function Ve(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return t(e.operation);case "params":let a=storage.storage.get(`${V}${narration.narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];o.warn("getValue params not found");return}return e}function he(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=t(e.leftValue),i=t(e.rightValue);switch(e.operator){case "==":return a===i;case "!=":return a!==i;case "<":return a<i;case "<=":return a<=i;case ">":return a>i;case ">=":return a>=i;case "CONTAINS":return a.toString().includes(i.toString())}break;case "valueCondition":return !!t(e.value);case "union":return Te(e)}return !!e}function Te(e){if(e.unionType==="not")return !t(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=t(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function Ne(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function be(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return t(e.condition)?t(e.then):t(e.else);case "stepswitch":let i=t(e.elements)||[];if(i.length===0){o.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let l=Ne(0,i.length-1);return t(i[l]);case "loop":let n=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>i.length-1&&(n=n%i.length),t(i[n]);case "sequential":let r,u=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(r=t(i[i.length-1])),u>i.length-1?r:t(i[u]);case "sequentialrandom":let x=narration.NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(x==null&&e.end=="lastItem"){let m=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!m||!m?.usedRandomNumbers){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=m.usedRandomNumbers[`0-${i.length-1}`];return t(i[y[y.length-1]])}if(x==null){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return t(i[x])}}return e}function J(e){if(e.conditionalStep){let a=j(t(e.conditionalStep));if(a?.glueEnabled===void 0&&delete a?.glueEnabled,a?.goNextStep===void 0&&delete a?.goNextStep,a?.end===void 0&&delete a?.end,a?.choices===void 0&&delete a?.choices,a?.dialogue===void 0&&delete a?.dialogue,a?.labelToOpen===void 0&&delete a?.labelToOpen,a?.operations===void 0&&delete a?.operations,a){let i={...e,conditionalStep:void 0,...a};return J(i)}else storage.storage.getFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);}return e}function Pe(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(r=>{let u=t(r);i.push(u);});else {let r=t(n);i.push(r);}});let l=a?[a,...i]:i;if(l.length===0){o.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator.translator.t(l);if(typeof l[0]=="object"){let n=l,r,u=false,x=n.map((s,p)=>{s=J(s);let c=t(s.dialogue)||"";return p===0?(r=t(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),r===false&&u&&(c=`
1
+ 'use strict';var importer=require('@drincs/pixi-vn-json/importer'),translator=require('@drincs/pixi-vn-json/translator'),unifier=require('@drincs/pixi-vn-json/unifier'),canvas=require('@drincs/pixi-vn/canvas'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),storage=require('@drincs/pixi-vn/storage');var V="___param___";async function I(e){let a=unifier.JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await canvas.Assets.load(a.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await canvas.Assets.loadBundle(a.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(a.aliases);break}break}}var o;(n=>(n.log=(r,...u)=>console.log(`[Pixi\u2019VN Json] ${r}`,...u),n.warn=(r,...u)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...u),n.error=(r,...u)=>console.error(`[Pixi\u2019VN Json] ${r}`,...u),n.info=(r,...u)=>console.info(`[Pixi\u2019VN Json] ${r}`,...u)))(o||(o={}));async function b(e,a,i){switch(i.type){case "fade":await canvas.showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await canvas.showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await canvas.moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await canvas.pushIn(a.alias,e,i.props,i.priority);break}}function h(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function v(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageSprite(e.props,e.url||e.alias);await b(i,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Image with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let n=new canvas.VideoSprite(e.props,e.url||e.alias);await b(n,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Video with alias ${e.alias} not found.`);break;case "remove":h(e);break;case "pause":let i=canvas.canvas.find(e.alias);i?i.paused=true:o.error(`Video with alias ${e.alias} not found.`);break;case "resume":let l=canvas.canvas.find(e.alias);l?l.paused=false:o.error(`Video with alias ${e.alias} not found.`);break}}async function _(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageContainer(e.props,e.urls);await b(i,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function R(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let i=new canvas.Text(e.props);await b(i,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Text with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function L(e){switch(e.operationType){case "edit":try{let a=canvas.canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):o.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){o.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":h(e);break}}async function D(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function G(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function $(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function F(e){switch(e.operationType){case "play":sound.sound.play(e.alias,e.props);break;case "stop":sound.sound.stop(e.alias);break;case "pause":sound.sound.pause(e.alias);break;case "resume":sound.sound.resume(e.alias);break;case "volume":sound.sound.volume(e.alias,e.value);break}}function j(e){try{if(typeof e>"u")return e;let a=JSON.stringify(e);return JSON.parse(a)}catch(a){throw o.error("Error creating exportable element",e,a),new Error("[Pixi\u2019VN] Error creating exportable element")}}function U(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,i);break;case "tempstorage":storage.storage.setTempVariable(e.key,i);break;case "params":let l=storage.storage.get(`${V}${narration.narration.openedLabels.length-1}`)||[];l&&l.length-1>=e.key&&(l[e.key]=i),storage.storage.setTempVariable(`${V}${narration.narration.openedLabels.length-1}`,l);break}}function X(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:i};break}}function t(e){let a=be(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return Ve(a);case "arithmetic":case "arithmeticsingle":return ye(a);case "compare":case "valueCondition":case "union":return he(a)}return a}function ye(e){let a=t(e.leftValue);switch(e.type){case "arithmetic":let i=t(e.rightValue);switch(e.operator){case "*":return a*i;case "/":return a/i;case "+":return a+i;case "-":return a-i;case "%":return a%i;case "POW":return Math.pow(a,i);case "RANDOM":return narration.narration.getRandomNumber(a,i)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(a);case "FLOOR":return Math.floor(a);case "FLOAT":return parseFloat(a)}break}}function Ve(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return t(e.operation);case "params":let a=storage.storage.get(`${V}${narration.narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];o.warn("getValue params not found");return}return e}function he(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=t(e.leftValue),i=t(e.rightValue);switch(e.operator){case "==":return a===i;case "!=":return a!==i;case "<":return a<i;case "<=":return a<=i;case ">":return a>i;case ">=":return a>=i;case "CONTAINS":return a.toString().includes(i.toString())}break;case "valueCondition":return !!t(e.value);case "union":return Te(e)}return !!e}function Te(e){if(e.unionType==="not")return !t(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=t(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function Ne(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function be(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return t(e.condition)?t(e.then):t(e.else);case "stepswitch":let i=t(e.elements)||[];if(i.length===0){o.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let l=Ne(0,i.length-1);return t(i[l]);case "loop":let n=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>i.length-1&&(n=n%i.length),t(i[n]);case "sequential":let r,u=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(r=t(i[i.length-1])),u>i.length-1?r:t(i[u]);case "sequentialrandom":let x=narration.NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(x==null&&e.end=="lastItem"){let m=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!m||!m?.usedRandomNumbers){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=m.usedRandomNumbers[`0-${i.length-1}`];return t(i[y[y.length-1]])}if(x==null){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return t(i[x])}}return e}function J(e){if(e.conditionalStep){let a=j(t(e.conditionalStep));if(a?.glueEnabled===void 0&&delete a?.glueEnabled,a?.goNextStep===void 0&&delete a?.goNextStep,a?.end===void 0&&delete a?.end,a?.choices===void 0&&delete a?.choices,a?.dialogue===void 0&&delete a?.dialogue,a?.labelToOpen===void 0&&delete a?.labelToOpen,a?.operations===void 0&&delete a?.operations,a){let i={...e,conditionalStep:void 0,...a};return J(i)}else storage.storage.getFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);}return e}function Pe(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(r=>{let u=t(r);i.push(u);});else {let r=t(n);i.push(r);}});let l=a?[a,...i]:i;if(l.length===0){o.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator.translator.t(l);if(typeof l[0]=="object"){let n=l,r,u=false,x=n.map((s,p)=>{s=J(s);let c=t(s.dialogue)||"";return p===0?(r=t(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),r===false&&u&&(c=`
2
2
 
3
3
  `+c),c&&(u=true),r=t(s.glueEnabled)||false,c)}),m=t(x[0]),y=typeof m=="object"&&"character"in m?m.character:void 0,O=x.flatMap(s=>{let p;s&&typeof s=="object"&&"text"in s?p=s.text:p=s;let c;return Array.isArray(p)?c=p.map(Y=>{let H=t(Y);return translator.translator.t(`${H}`)}):c=t(p)||"",translator.translator.t(c)}),z=n.find(s=>s.end),W=n.find(s=>s.choices),E=false,k=false;n.length>0&&(n[0].glueEnabled&&n[0].goNextStep&&n[0].dialogue===void 0&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),E=n[n.length-1].glueEnabled,k=n.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let q=n.find(s=>s.labelToOpen),S=[];return n.forEach(s=>{s.operations&&(S=[...S,...s.operations]);}),{dialogue:y?{character:y,text:O}:O,end:z?.end,choices:W?.choices,glueEnabled:E,goNextStep:k,labelToOpen:q?.labelToOpen,operations:S}}}function sa(){unifier.JsonUnifier.init({animateOperation:G,canvasElementOperation:L,effectOperation:D,imageContainerOperation:_,imageOperation:v,textOperation:R,narrationOperation:$,loadAssets:I,soundOperation:F,videoOperation:A,setStorageValue:U,setInitialStorageValue:X,getLogichValue:t,getConditionalStep:J});}exports.PIXIVNJSON_PARAM_ID=V;exports.init=sa;Object.keys(importer).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return importer[k]}})});Object.keys(translator).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return translator[k]}})});Object.keys(unifier).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return unifier[k]}})});
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export*from'@drincs/pixi-vn-json/importer';import {translator as translator$1}from'@drincs/pixi-vn-json/translator';export*from'@drincs/pixi-vn-json/translator';import {JsonUnifier}from'@drincs/pixi-vn-json/unifier';export*from'@drincs/pixi-vn-json/unifier';import {canvas,VideoSprite,showVideo,Assets,Text,showText,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {narration,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';var V="___param___";async function I(e){let a=JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await Assets.load(a.aliases);break;case "lazyload":Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await Assets.loadBundle(a.aliases);break;case "lazyload":Assets.backgroundLoadBundle(a.aliases);break}break}}var o;(n=>(n.log=(r,...u)=>console.log(`[Pixi\u2019VN Json] ${r}`,...u),n.warn=(r,...u)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...u),n.error=(r,...u)=>console.error(`[Pixi\u2019VN Json] ${r}`,...u),n.info=(r,...u)=>console.info(`[Pixi\u2019VN Json] ${r}`,...u)))(o||(o={}));async function b(e,a,i){switch(i.type){case "fade":await showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(a.alias,e,i.props,i.priority);break}}function h(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function v(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageSprite(e.props,e.url||e.alias);await b(i,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Image with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let n=new VideoSprite(e.props,e.url||e.alias);await b(n,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Video with alias ${e.alias} not found.`);break;case "remove":h(e);break;case "pause":let i=canvas.find(e.alias);i?i.paused=true:o.error(`Video with alias ${e.alias} not found.`);break;case "resume":let l=canvas.find(e.alias);l?l.paused=false:o.error(`Video with alias ${e.alias} not found.`);break}}async function _(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageContainer(e.props,e.urls);await b(i,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function R(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator$1.t(e.text),e.transition){let i=new Text(e.props);await b(i,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Text with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function L(e){switch(e.operationType){case "edit":try{let a=canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):o.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){o.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":h(e);break}}async function D(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function G(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function $(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function F(e){switch(e.operationType){case "play":sound.play(e.alias,e.props);break;case "stop":sound.stop(e.alias);break;case "pause":sound.pause(e.alias);break;case "resume":sound.resume(e.alias);break;case "volume":sound.volume(e.alias,e.value);break}}function j(e){try{if(typeof e>"u")return e;let a=JSON.stringify(e);return JSON.parse(a)}catch(a){throw o.error("Error creating exportable element",e,a),new Error("[Pixi\u2019VN] Error creating exportable element")}}function U(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,i);break;case "tempstorage":storage.setTempVariable(e.key,i);break;case "params":let l=storage.get(`${V}${narration.openedLabels.length-1}`)||[];l&&l.length-1>=e.key&&(l[e.key]=i),storage.setTempVariable(`${V}${narration.openedLabels.length-1}`,l);break}}function X(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:i};break}}function t(e){let a=be(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return Ve(a);case "arithmetic":case "arithmeticsingle":return ye(a);case "compare":case "valueCondition":case "union":return he(a)}return a}function ye(e){let a=t(e.leftValue);switch(e.type){case "arithmetic":let i=t(e.rightValue);switch(e.operator){case "*":return a*i;case "/":return a/i;case "+":return a+i;case "-":return a-i;case "%":return a%i;case "POW":return Math.pow(a,i);case "RANDOM":return narration.getRandomNumber(a,i)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(a);case "FLOOR":return Math.floor(a);case "FLOAT":return parseFloat(a)}break}}function Ve(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return t(e.operation);case "params":let a=storage.get(`${V}${narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];o.warn("getValue params not found");return}return e}function he(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=t(e.leftValue),i=t(e.rightValue);switch(e.operator){case "==":return a===i;case "!=":return a!==i;case "<":return a<i;case "<=":return a<=i;case ">":return a>i;case ">=":return a>=i;case "CONTAINS":return a.toString().includes(i.toString())}break;case "valueCondition":return !!t(e.value);case "union":return Te(e)}return !!e}function Te(e){if(e.unionType==="not")return !t(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=t(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function Ne(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function be(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return t(e.condition)?t(e.then):t(e.else);case "stepswitch":let i=t(e.elements)||[];if(i.length===0){o.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let l=Ne(0,i.length-1);return t(i[l]);case "loop":let n=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>i.length-1&&(n=n%i.length),t(i[n]);case "sequential":let r,u=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(r=t(i[i.length-1])),u>i.length-1?r:t(i[u]);case "sequentialrandom":let x=NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(x==null&&e.end=="lastItem"){let m=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!m||!m?.usedRandomNumbers){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=m.usedRandomNumbers[`0-${i.length-1}`];return t(i[y[y.length-1]])}if(x==null){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return t(i[x])}}return e}function J(e){if(e.conditionalStep){let a=j(t(e.conditionalStep));if(a?.glueEnabled===void 0&&delete a?.glueEnabled,a?.goNextStep===void 0&&delete a?.goNextStep,a?.end===void 0&&delete a?.end,a?.choices===void 0&&delete a?.choices,a?.dialogue===void 0&&delete a?.dialogue,a?.labelToOpen===void 0&&delete a?.labelToOpen,a?.operations===void 0&&delete a?.operations,a){let i={...e,conditionalStep:void 0,...a};return J(i)}else storage.getFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);}return e}function Pe(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(r=>{let u=t(r);i.push(u);});else {let r=t(n);i.push(r);}});let l=a?[a,...i]:i;if(l.length===0){o.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator$1.t(l);if(typeof l[0]=="object"){let n=l,r,u=false,x=n.map((s,p)=>{s=J(s);let c=t(s.dialogue)||"";return p===0?(r=t(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),r===false&&u&&(c=`
1
+ export*from'@drincs/pixi-vn-json/importer';import {translator as translator$1}from'@drincs/pixi-vn-json/translator';export*from'@drincs/pixi-vn-json/translator';import {JsonUnifier}from'@drincs/pixi-vn-json/unifier';export*from'@drincs/pixi-vn-json/unifier';import {canvas,VideoSprite,showVideo,Assets,Text,showText,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {narration,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';var V="___param___";async function I(e){let a=JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await Assets.load(a.aliases);break;case "lazyload":Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await Assets.loadBundle(a.aliases);break;case "lazyload":Assets.backgroundLoadBundle(a.aliases);break}break}}var o;(n=>(n.log=(r,...u)=>console.log(`[Pixi\u2019VN Json] ${r}`,...u),n.warn=(r,...u)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...u),n.error=(r,...u)=>console.error(`[Pixi\u2019VN Json] ${r}`,...u),n.info=(r,...u)=>console.info(`[Pixi\u2019VN Json] ${r}`,...u)))(o||(o={}));async function b(e,a,i){switch(i.type){case "fade":await showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(a.alias,e,i.props,i.priority);break}}function h(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function v(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageSprite(e.props,e.url||e.alias);await b(i,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Image with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let n=new VideoSprite(e.props,e.url||e.alias);await b(n,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Video with alias ${e.alias} not found.`);break;case "remove":h(e);break;case "pause":let i=canvas.find(e.alias);i?i.paused=true:o.error(`Video with alias ${e.alias} not found.`);break;case "resume":let l=canvas.find(e.alias);l?l.paused=false:o.error(`Video with alias ${e.alias} not found.`);break}}async function _(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageContainer(e.props,e.urls);await b(i,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function R(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator$1.t(e.text),e.transition){let i=new Text(e.props);await b(i,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):o.error(`Text with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function L(e){switch(e.operationType){case "edit":try{let a=canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):o.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){o.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":h(e);break}}async function D(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function G(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function $(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function F(e){switch(e.operationType){case "play":sound.play(e.alias,e.props);break;case "stop":sound.stop(e.alias);break;case "pause":sound.pause(e.alias);break;case "resume":sound.resume(e.alias);break;case "volume":sound.volume(e.alias,e.value);break}}function j(e){try{if(typeof e>"u")return e;let a=JSON.stringify(e);return JSON.parse(a)}catch(a){throw o.error("Error creating exportable element",e,a),new Error("[Pixi\u2019VN] Error creating exportable element")}}function U(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,i);break;case "tempstorage":storage.setTempVariable(e.key,i);break;case "params":let l=storage.get(`${V}${narration.openedLabels.length-1}`)||[];l&&l.length-1>=e.key&&(l[e.key]=i),storage.setTempVariable(`${V}${narration.openedLabels.length-1}`,l);break}}function X(e){let a=t(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=t(a):i=a,e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:i};break}}function t(e){let a=be(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return Ve(a);case "arithmetic":case "arithmeticsingle":return ye(a);case "compare":case "valueCondition":case "union":return he(a)}return a}function ye(e){let a=t(e.leftValue);switch(e.type){case "arithmetic":let i=t(e.rightValue);switch(e.operator){case "*":return a*i;case "/":return a/i;case "+":return a+i;case "-":return a-i;case "%":return a%i;case "POW":return Math.pow(a,i);case "RANDOM":return narration.getRandomNumber(a,i)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(a);case "FLOOR":return Math.floor(a);case "FLOAT":return parseFloat(a)}break}}function Ve(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return t(e.operation);case "params":let a=storage.get(`${V}${narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];o.warn("getValue params not found");return}return e}function he(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=t(e.leftValue),i=t(e.rightValue);switch(e.operator){case "==":return a===i;case "!=":return a!==i;case "<":return a<i;case "<=":return a<=i;case ">":return a>i;case ">=":return a>=i;case "CONTAINS":return a.toString().includes(i.toString())}break;case "valueCondition":return !!t(e.value);case "union":return Te(e)}return !!e}function Te(e){if(e.unionType==="not")return !t(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=t(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function Ne(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function be(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return t(e.condition)?t(e.then):t(e.else);case "stepswitch":let i=t(e.elements)||[];if(i.length===0){o.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let l=Ne(0,i.length-1);return t(i[l]);case "loop":let n=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>i.length-1&&(n=n%i.length),t(i[n]);case "sequential":let r,u=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(r=t(i[i.length-1])),u>i.length-1?r:t(i[u]);case "sequentialrandom":let x=NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(x==null&&e.end=="lastItem"){let m=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!m||!m?.usedRandomNumbers){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=m.usedRandomNumbers[`0-${i.length-1}`];return t(i[y[y.length-1]])}if(x==null){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return t(i[x])}}return e}function J(e){if(e.conditionalStep){let a=j(t(e.conditionalStep));if(a?.glueEnabled===void 0&&delete a?.glueEnabled,a?.goNextStep===void 0&&delete a?.goNextStep,a?.end===void 0&&delete a?.end,a?.choices===void 0&&delete a?.choices,a?.dialogue===void 0&&delete a?.dialogue,a?.labelToOpen===void 0&&delete a?.labelToOpen,a?.operations===void 0&&delete a?.operations,a){let i={...e,conditionalStep:void 0,...a};return J(i)}else storage.getFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);}return e}function Pe(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(r=>{let u=t(r);i.push(u);});else {let r=t(n);i.push(r);}});let l=a?[a,...i]:i;if(l.length===0){o.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator$1.t(l);if(typeof l[0]=="object"){let n=l,r,u=false,x=n.map((s,p)=>{s=J(s);let c=t(s.dialogue)||"";return p===0?(r=t(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),r===false&&u&&(c=`
2
2
 
3
3
  `+c),c&&(u=true),r=t(s.glueEnabled)||false,c)}),m=t(x[0]),y=typeof m=="object"&&"character"in m?m.character:void 0,O=x.flatMap(s=>{let p;s&&typeof s=="object"&&"text"in s?p=s.text:p=s;let c;return Array.isArray(p)?c=p.map(Y=>{let H=t(Y);return translator$1.t(`${H}`)}):c=t(p)||"",translator$1.t(c)}),z=n.find(s=>s.end),W=n.find(s=>s.choices),E=false,k=false;n.length>0&&(n[0].glueEnabled&&n[0].goNextStep&&n[0].dialogue===void 0&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),E=n[n.length-1].glueEnabled,k=n.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let q=n.find(s=>s.labelToOpen),S=[];return n.forEach(s=>{s.operations&&(S=[...S,...s.operations]);}),{dialogue:y?{character:y,text:O}:O,end:z?.end,choices:W?.choices,glueEnabled:E,goNextStep:k,labelToOpen:q?.labelToOpen,operations:S}}}function sa(){JsonUnifier.init({animateOperation:G,canvasElementOperation:L,effectOperation:D,imageContainerOperation:_,imageOperation:v,textOperation:R,narrationOperation:$,loadAssets:I,soundOperation:F,videoOperation:A,setStorageValue:U,setInitialStorageValue:X,getLogichValue:t,getConditionalStep:J});}export{V as PIXIVNJSON_PARAM_ID,sa as init};
package/dist/unifier.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var x=Object.defineProperty;var P=(n,i,s)=>i in n?x(n,i,{enumerable:true,configurable:true,writable:true,value:s}):n[i]=s;var o=(n,i,s)=>P(n,typeof i!="symbol"?i+"":i,s);var t;(c=>(c.log=(a,...r)=>console.log(`[Pixi\u2019VN Json] ${a}`,...r),c.warn=(a,...r)=>console.warn(`[Pixi\u2019VN Json] ${a}`,...r),c.error=(a,...r)=>console.error(`[Pixi\u2019VN Json] ${a}`,...r),c.info=(a,...r)=>console.info(`[Pixi\u2019VN Json] ${a}`,...r)))(t||(t={}));var e=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.getConditionalStep);}static get loadAssets(){return e._loadAssets}static get soundOperation(){return e._soundOperation}static get imageOperation(){return e._imageOperation}static get videoOperation(){return e._videoOperation}static get textOperation(){return e._textOperation}static get imageContainerOperation(){return e._imageContainerOperation}static get canvasElementOperation(){return e._canvasElementOperation}static get setStorageValue(){return e._setStorageValue}static get setInitialStorageValue(){return e._setInitialStorageValue}static get narrationOperation(){return e._narrationOperation}static get effectOperation(){return e._effectOperation}static get animateOperation(){return e._animateOperation}static get getLogichValue(){return e._getLogichValue}static get getConditionalStep(){return e._getConditionalStep}};o(e,"_loadAssets",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_soundOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_videoOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageContainerOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_textOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_canvasElementOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setInitialStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_narrationOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_effectOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_animateOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getLogichValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getConditionalStep",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var p=e;exports.JsonUnifier=p;
1
+ 'use strict';var x=Object.defineProperty;var P=(r,i,s)=>i in r?x(r,i,{enumerable:true,configurable:true,writable:true,value:s}):r[i]=s;var o=(r,i,s)=>P(r,typeof i!="symbol"?i+"":i,s);var t;(c=>(c.log=(a,...n)=>console.log(`[Pixi\u2019VN Json] ${a}`,...n),c.warn=(a,...n)=>console.warn(`[Pixi\u2019VN Json] ${a}`,...n),c.error=(a,...n)=>console.error(`[Pixi\u2019VN Json] ${a}`,...n),c.info=(a,...n)=>console.info(`[Pixi\u2019VN Json] ${a}`,...n)))(t||(t={}));var e=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.getConditionalStep);}static get loadAssets(){return e._loadAssets}static get soundOperation(){return e._soundOperation}static get imageOperation(){return e._imageOperation}static get videoOperation(){return e._videoOperation}static get textOperation(){return e._textOperation}static get imageContainerOperation(){return e._imageContainerOperation}static get canvasElementOperation(){return e._canvasElementOperation}static get setStorageValue(){return e._setStorageValue}static get setInitialStorageValue(){return e._setInitialStorageValue}static get narrationOperation(){return e._narrationOperation}static get effectOperation(){return e._effectOperation}static get animateOperation(){return e._animateOperation}static get getLogichValue(){return e._getLogichValue}static get getConditionalStep(){return e._getConditionalStep}};o(e,"_loadAssets",()=>{}),o(e,"_soundOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_videoOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageContainerOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_textOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_canvasElementOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setInitialStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_narrationOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_effectOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_animateOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getLogichValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getConditionalStep",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var p=e;exports.JsonUnifier=p;
@@ -522,7 +522,7 @@ type PixiVNJsonLabelStep = {
522
522
 
523
523
  declare class JsonUnifier {
524
524
  static init(options: {
525
- loadAssets?: (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void>;
525
+ loadAssets?: (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void> | void;
526
526
  soundOperation?: (operation: PixiVNJsonSound) => void;
527
527
  imageOperation?: (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonImageEdit | PixiVNJsonCanvasRemove) => Promise<void>;
528
528
  videoOperation?: (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasRemove | PixiVNJsonVideoEdit | PixiVNJsonVideoPauseResume) => Promise<void>;
@@ -538,7 +538,7 @@ declare class JsonUnifier {
538
538
  getConditionalStep?: (originalStep: PixiVNJsonLabelStep) => PixiVNJsonLabelStep;
539
539
  }): void;
540
540
  private static _loadAssets;
541
- static get loadAssets(): (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void>;
541
+ static get loadAssets(): (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void> | void;
542
542
  private static _soundOperation;
543
543
  static get soundOperation(): (operation: PixiVNJsonSound) => void;
544
544
  private static _imageOperation;
package/dist/unifier.d.ts CHANGED
@@ -522,7 +522,7 @@ type PixiVNJsonLabelStep = {
522
522
 
523
523
  declare class JsonUnifier {
524
524
  static init(options: {
525
- loadAssets?: (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void>;
525
+ loadAssets?: (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void> | void;
526
526
  soundOperation?: (operation: PixiVNJsonSound) => void;
527
527
  imageOperation?: (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonImageEdit | PixiVNJsonCanvasRemove) => Promise<void>;
528
528
  videoOperation?: (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasRemove | PixiVNJsonVideoEdit | PixiVNJsonVideoPauseResume) => Promise<void>;
@@ -538,7 +538,7 @@ declare class JsonUnifier {
538
538
  getConditionalStep?: (originalStep: PixiVNJsonLabelStep) => PixiVNJsonLabelStep;
539
539
  }): void;
540
540
  private static _loadAssets;
541
- static get loadAssets(): (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void>;
541
+ static get loadAssets(): (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void> | void;
542
542
  private static _soundOperation;
543
543
  static get soundOperation(): (operation: PixiVNJsonSound) => void;
544
544
  private static _imageOperation;
package/dist/unifier.mjs CHANGED
@@ -1 +1 @@
1
- var x=Object.defineProperty;var P=(n,i,s)=>i in n?x(n,i,{enumerable:true,configurable:true,writable:true,value:s}):n[i]=s;var o=(n,i,s)=>P(n,typeof i!="symbol"?i+"":i,s);var t;(c=>(c.log=(a,...r)=>console.log(`[Pixi\u2019VN Json] ${a}`,...r),c.warn=(a,...r)=>console.warn(`[Pixi\u2019VN Json] ${a}`,...r),c.error=(a,...r)=>console.error(`[Pixi\u2019VN Json] ${a}`,...r),c.info=(a,...r)=>console.info(`[Pixi\u2019VN Json] ${a}`,...r)))(t||(t={}));var e=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.getConditionalStep);}static get loadAssets(){return e._loadAssets}static get soundOperation(){return e._soundOperation}static get imageOperation(){return e._imageOperation}static get videoOperation(){return e._videoOperation}static get textOperation(){return e._textOperation}static get imageContainerOperation(){return e._imageContainerOperation}static get canvasElementOperation(){return e._canvasElementOperation}static get setStorageValue(){return e._setStorageValue}static get setInitialStorageValue(){return e._setInitialStorageValue}static get narrationOperation(){return e._narrationOperation}static get effectOperation(){return e._effectOperation}static get animateOperation(){return e._animateOperation}static get getLogichValue(){return e._getLogichValue}static get getConditionalStep(){return e._getConditionalStep}};o(e,"_loadAssets",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_soundOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_videoOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageContainerOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_textOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_canvasElementOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setInitialStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_narrationOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_effectOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_animateOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getLogichValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getConditionalStep",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var p=e;export{p as JsonUnifier};
1
+ var x=Object.defineProperty;var P=(r,i,s)=>i in r?x(r,i,{enumerable:true,configurable:true,writable:true,value:s}):r[i]=s;var o=(r,i,s)=>P(r,typeof i!="symbol"?i+"":i,s);var t;(c=>(c.log=(a,...n)=>console.log(`[Pixi\u2019VN Json] ${a}`,...n),c.warn=(a,...n)=>console.warn(`[Pixi\u2019VN Json] ${a}`,...n),c.error=(a,...n)=>console.error(`[Pixi\u2019VN Json] ${a}`,...n),c.info=(a,...n)=>console.info(`[Pixi\u2019VN Json] ${a}`,...n)))(t||(t={}));var e=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.getConditionalStep);}static get loadAssets(){return e._loadAssets}static get soundOperation(){return e._soundOperation}static get imageOperation(){return e._imageOperation}static get videoOperation(){return e._videoOperation}static get textOperation(){return e._textOperation}static get imageContainerOperation(){return e._imageContainerOperation}static get canvasElementOperation(){return e._canvasElementOperation}static get setStorageValue(){return e._setStorageValue}static get setInitialStorageValue(){return e._setInitialStorageValue}static get narrationOperation(){return e._narrationOperation}static get effectOperation(){return e._effectOperation}static get animateOperation(){return e._animateOperation}static get getLogichValue(){return e._getLogichValue}static get getConditionalStep(){return e._getConditionalStep}};o(e,"_loadAssets",()=>{}),o(e,"_soundOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_videoOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_imageContainerOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_textOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_canvasElementOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_setInitialStorageValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_narrationOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_effectOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_animateOperation",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getLogichValue",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),o(e,"_getConditionalStep",()=>{throw t.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var p=e;export{p as JsonUnifier};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn-json",
3
- "version": "1.9.0",
3
+ "version": "1.9.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",
@@ -61,7 +61,7 @@
61
61
  "url": "git+https://github.com/DRincs-Productions/pixi-vn-json.git"
62
62
  },
63
63
  "author": "DRincs-Productions",
64
- "license": "GPL-3.0",
64
+ "license": "LGPL-2.1",
65
65
  "bugs": {
66
66
  "url": "https://github.com/DRincs-Productions/pixi-vn-json/issues"
67
67
  },
@@ -77,7 +77,7 @@
77
77
  "vite-tsconfig-paths": "^6.0.3"
78
78
  },
79
79
  "peerDependencies": {
80
- "@drincs/pixi-vn": ">=1.4.0"
80
+ "@drincs/pixi-vn": ">=1.4.1"
81
81
  },
82
82
  "keywords": [
83
83
  "game",