@drincs/pixi-vn-json 1.7.9 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/importer.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage'),translator=require('@drincs/pixi-vn-json/translator'),unifier=require('@drincs/pixi-vn-json/unifier');var K=Object.create;var H=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var ie=(a,n,t)=>n in a?H(a,n,{enumerable:true,configurable:true,writable:true,value:t}):a[n]=t;var I=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var W=(a,n)=>()=>(n||a((n={exports:{}}).exports,n),n.exports);var re=(a,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Z(n))!te.call(a,r)&&r!==t&&H(a,r,{get:()=>n[r],enumerable:!(o=Q(n,r))||o.enumerable});return a};var ne=(a,n,t)=>(t=a!=null?K(ee(a)):{},re(H(t,"default",{value:a,enumerable:true}),a));var C=(a,n,t)=>ie(a,typeof n!="symbol"?n+"":n,t);var F=W((E,U)=>{(function(a,n){typeof E=="object"?U.exports=E=n():typeof define=="function"&&define.amd?define([],n):a.CryptoJS=n();})(E,function(){var a=a||(function(n,t){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof I=="function")try{o=I("crypto");}catch{}var r=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},f=Object.create||(function(){function e(){}return function(i){var p;return e.prototype=i,p=new e,e.prototype=null,p}})(),s={},u=s.lib={},d=u.Base=(function(){return {extend:function(e){var i=f(this);return e&&i.mixIn(e),(!i.hasOwnProperty("init")||this.init===i.init)&&(i.init=function(){i.$super.init.apply(this,arguments);}),i.init.prototype=i,i.$super=this,i},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var i in e)e.hasOwnProperty(i)&&(this[i]=e[i]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),y=u.WordArray=d.extend({init:function(e,i){e=this.words=e||[],i!=t?this.sigBytes=i:this.sigBytes=e.length*4;},toString:function(e){return (e||m).stringify(this)},concat:function(e){var i=this.words,p=e.words,l=this.sigBytes,S=e.sigBytes;if(this.clamp(),l%4)for(var V=0;V<S;V++){var D=p[V>>>2]>>>24-V%4*8&255;i[l+V>>>2]|=D<<24-(l+V)%4*8;}else for(var _=0;_<S;_+=4)i[l+_>>>2]=p[_>>>2];return this.sigBytes+=S,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=n.ceil(i/4);},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var i=[],p=0;p<e;p+=4)i.push(r());return new y.init(i,e)}}),c=s.enc={},m=c.Hex={stringify:function(e){for(var i=e.words,p=e.sigBytes,l=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;l.push((V>>>4).toString(16)),l.push((V&15).toString(16));}return l.join("")},parse:function(e){for(var i=e.length,p=[],l=0;l<i;l+=2)p[l>>>3]|=parseInt(e.substr(l,2),16)<<24-l%8*4;return new y.init(p,i/2)}},b=c.Latin1={stringify:function(e){for(var i=e.words,p=e.sigBytes,l=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(V));}return l.join("")},parse:function(e){for(var i=e.length,p=[],l=0;l<i;l++)p[l>>>2]|=(e.charCodeAt(l)&255)<<24-l%4*8;return new y.init(p,i)}},P=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(b.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return b.parse(unescape(encodeURIComponent(e)))}},g=u.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=P.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var i,p=this._data,l=p.words,S=p.sigBytes,V=this.blockSize,D=V*4,_=S/D;e?_=n.ceil(_):_=n.max((_|0)-this._minBufferSize,0);var O=_*V,z=n.min(O*4,S);if(O){for(var k=0;k<O;k+=V)this._doProcessBlock(l,k);i=l.splice(0,O),p.sigBytes-=z;}return new y.init(i,z)},clone:function(){var e=d.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=g.extend({cfg:d.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){g.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var i=this._doFinalize();return i},blockSize:512/32,_createHelper:function(e){return function(i,p){return new e.init(p).finalize(i)}},_createHmacHelper:function(e){return function(i,p){return new x.HMAC.init(e,p).finalize(i)}}});var x=s.algo={};return s})(Math);return a});});var M=W((A,G)=>{(function(a,n){typeof A=="object"?G.exports=A=n(F()):typeof define=="function"&&define.amd?define(["./core"],n):n(a.CryptoJS);})(A,function(a){return (function(){var n=a,t=n.lib,o=t.WordArray,r=t.Hasher,f=n.algo,s=[],u=f.SHA1=r.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var c=this._hash.words,m=c[0],b=c[1],P=c[2],g=c[3],h=c[4],x=0;x<80;x++){if(x<16)s[x]=d[y+x]|0;else {var e=s[x-3]^s[x-8]^s[x-14]^s[x-16];s[x]=e<<1|e>>>31;}var i=(m<<5|m>>>27)+h+s[x];x<20?i+=(b&P|~b&g)+1518500249:x<40?i+=(b^P^g)+1859775393:x<60?i+=(b&P|b&g|P&g)-1894007588:i+=(b^P^g)-899497514,h=g,g=P,P=b<<30|b>>>2,b=m,m=i;}c[0]=c[0]+m|0,c[1]=c[1]+b|0,c[2]=c[2]+P|0,c[3]=c[3]+g|0,c[4]=c[4]+h|0;},_doFinalize:function(){var d=this._data,y=d.words,c=this._nDataBytes*8,m=d.sigBytes*8;return y[m>>>5]|=128<<24-m%32,y[(m+64>>>9<<4)+14]=Math.floor(c/4294967296),y[(m+64>>>9<<4)+15]=c,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});n.SHA1=r._createHelper(u),n.HmacSHA1=r._createHmacHelper(u);})(),a.SHA1});});var L;(r=>(r.log=(f,...s)=>console.log(`[Pixi\u2019VN Json] ${f}`,...s),r.warn=(f,...s)=>console.warn(`[Pixi\u2019VN Json] ${f}`,...s),r.error=(f,...s)=>console.error(`[Pixi\u2019VN Json] ${f}`,...s),r.info=(f,...s)=>console.info(`[Pixi\u2019VN Json] ${f}`,...s)))(L||(L={}));async function ae(a,n={}){let{operationStringConvert:t,skipEmptyDialogs:o}=n;if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {L.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let r=a.map(async u=>{if(typeof u=="string")try{u=JSON.parse(u);}catch(d){L.error("Error parsing imported Pixi'VN JSON",d),u={};}return u}),s=(await Promise.all(r)).map(async u=>{let d=[];if(u.initialOperations){let y={};[...storage.storage.storage.keys()].forEach((c,m)=>{y[c]=storage.storage.storage.get(c);}),storage.storage.startingStorage=y;}if(u.labels){let y=u.labels;for(let c in y)try{let m=y[c],b=new w(c,m,void 0,n);narration.RegisteredLabels.add(b);}catch(m){L.error(`Error creating JSON label ${c}`,m);}}return Promise.all(d)});await Promise.all(s);}var Y=ne(M());var $="___param___";function X(a){try{if(typeof a>"u")return a;let n=JSON.stringify(a);return JSON.parse(n)}catch(n){throw L.error("Error creating exportable element",a,n),new Error("[Pixi\u2019VN] Error creating exportable element")}}async function j(a,n){let t=unifier.JsonUnifier.getLogichValue(a);if(t)switch(t.type){case "sound":unifier.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await unifier.JsonUnifier.loadAssets(t);break;case "image":await unifier.JsonUnifier.imageOperation(t);break;case "video":await unifier.JsonUnifier.videoOperation(t);break;case "imagecontainer":await unifier.JsonUnifier.imageContainerOperation(t);break;case "canvaselement":await unifier.JsonUnifier.canvasElementOperation(t);break;case "value":unifier.JsonUnifier.setStorageValue(t);break;case "operationtoconvert":if(n){let o="";t.values.forEach(f=>{if(typeof f=="string")o+=f;else {let s=unifier.JsonUnifier.getLogichValue(f);o+=`${s}`;}});let r=await n(o);r&&await j(r,n);}break;case "input":case "dialogue":unifier.JsonUnifier.narrationOperation(t);break;case "fade":case "move":case "rotate":case "zoom":unifier.JsonUnifier.tickerOperation(t);break;case "shake":await unifier.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":unifier.JsonUnifier.animateOperation(t);break}}var w=class extends narration.LabelAbstract{constructor(t,o,r,f={}){r||(r={}),r.onLoadingLabel=async()=>{for(let s of o){let u;if(typeof s=="function"?u=s():u=s,u=unifier.JsonUnifier.getConditionalStep(u),u.operations){let d=u.operations.map(y=>unifier.JsonUnifier.loadAssets(y));await Promise.all(d);}}};super(t,r);C(this,"_steps");C(this,"operationStringConvert");C(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=f.operationStringConvert,this.skipEmptyDialogs=f.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let o=this._steps[t];return this.stepConverter(o)}getStepSha(t){if(t<0||t>=this.steps.length)return;let o=this._steps[t];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let o="";if(Array.isArray(t)){let r=[];t.forEach(f=>{if(typeof f=="string")r.push(f);else if(f&&typeof f=="object"){let s=unifier.JsonUnifier.getLogichValue(f);s?(s&&!Array.isArray(s)&&typeof s=="object"&&(s=unifier.JsonUnifier.getLogichValue(s)||""),Array.isArray(s)?r=r.concat(s):r.push(`${s}`)):r.push(`${f}`);}}),o=r;}else {let r=unifier.JsonUnifier.getLogichValue(t)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=unifier.JsonUnifier.getLogichValue(r)||""),o=r;}return `${o}`}getDialogue(t){if(t==null)return;let o=unifier.JsonUnifier.getLogichValue(t);return o==null?"":typeof o=="object"&&"character"in o&&"text"in o?{character:o.character,text:translator.translator.t(this.getDialogueText(o.text))}:translator.translator.t(this.getDialogueText(o))}getChoices(t){return unifier.JsonUnifier.getLogichValue(t)?.map(f=>unifier.JsonUnifier.getLogichValue(f)).filter(f=>f!==void 0)}stepConverter(t){return async o=>{let r=typeof t=="function"?t():t;r=X(r),r=unifier.JsonUnifier.getConditionalStep(r);let f=this.operationStringConvert?g=>this.operationStringConvert(g,r,o):void 0,{operations:s=[]}=r;for(let g of s)await j(g,f);let{labelToOpen:u=[]}=r,d=this.getChoices(r.choices),y=unifier.JsonUnifier.getLogichValue(r.glueEnabled),c=this.getDialogue(r.dialogue),m=[];Array.isArray(u)||(u=[u]),u.forEach(g=>{let h=unifier.JsonUnifier.getLogichValue(g);h&&m.push(h);});let b=unifier.JsonUnifier.getLogichValue(r.goNextStep),P=unifier.JsonUnifier.getLogichValue(r.end);if(d){let g=d.map(h=>{let x="";if(Array.isArray(h.text)){let i=[];h.text.forEach(p=>{if(typeof p=="string")i.push(translator.translator.t(p));else if(p&&typeof p=="object"){let l=unifier.JsonUnifier.getLogichValue(p);l&&!Array.isArray(l)&&typeof l=="object"&&(l=unifier.JsonUnifier.getLogichValue(l)||""),l&&(Array.isArray(l)?i=i.concat(translator.translator.t(l)):i.push(translator.translator.t(l)));}}),x=i;}else typeof h.text=="string"&&(x=translator.translator.t(h.text));return {label:h.label,text:x,props:h.props,type:h.type,oneTime:h.oneTime,onlyHaveNoChoice:h.onlyHaveNoChoice,autoSelect:h.autoSelect}});narration.narration.choiceMenuOptions=g;}else narration.narration.choiceMenuOptions=void 0;c!==void 0&&(narration.narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(b=true)),y?storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):y===false&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let g of m){let h=g.label;typeof h=="object"&&(h=unifier.JsonUnifier.getLogichValue(h)||"");let x=g.params?.map(e=>unifier.JsonUnifier.getLogichValue(e));o={...o,...g.props},g.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${$}${narration.narration.openedLabels.length}`,x),await narration.narration.callLabel(h,o)):(storage.storage.setTempVariable(`${$}${narration.narration.openedLabels.length}`,x),await narration.narration.callLabel(h,o));}P==="game_end"?(narration.narration.closeAllLabels(),await narration.narration.goNext(o,{runNow:true})):P==="label_end"&&narration.narration.closeCurrentLabel(),b&&await narration.narration.goNext(o,{runNow:true});}}};exports.LabelJson=w;exports.importPixiVNJson=ae;
1
+ 'use strict';var narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage'),translator=require('@drincs/pixi-vn-json/translator'),unifier=require('@drincs/pixi-vn-json/unifier');var K=Object.create;var H=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var ie=(a,n,t)=>n in a?H(a,n,{enumerable:true,configurable:true,writable:true,value:t}):a[n]=t;var I=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var W=(a,n)=>()=>(n||a((n={exports:{}}).exports,n),n.exports);var re=(a,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Z(n))!te.call(a,r)&&r!==t&&H(a,r,{get:()=>n[r],enumerable:!(o=Q(n,r))||o.enumerable});return a};var ne=(a,n,t)=>(t=a!=null?K(ee(a)):{},re(H(t,"default",{value:a,enumerable:true}),a));var C=(a,n,t)=>ie(a,typeof n!="symbol"?n+"":n,t);var F=W((E,U)=>{(function(a,n){typeof E=="object"?U.exports=E=n():typeof define=="function"&&define.amd?define([],n):a.CryptoJS=n();})(E,function(){var a=a||(function(n,t){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof I=="function")try{o=I("crypto");}catch{}var r=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},f=Object.create||(function(){function e(){}return function(i){var p;return e.prototype=i,p=new e,e.prototype=null,p}})(),s={},u=s.lib={},d=u.Base=(function(){return {extend:function(e){var i=f(this);return e&&i.mixIn(e),(!i.hasOwnProperty("init")||this.init===i.init)&&(i.init=function(){i.$super.init.apply(this,arguments);}),i.init.prototype=i,i.$super=this,i},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var i in e)e.hasOwnProperty(i)&&(this[i]=e[i]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),y=u.WordArray=d.extend({init:function(e,i){e=this.words=e||[],i!=t?this.sigBytes=i:this.sigBytes=e.length*4;},toString:function(e){return (e||m).stringify(this)},concat:function(e){var i=this.words,p=e.words,l=this.sigBytes,S=e.sigBytes;if(this.clamp(),l%4)for(var V=0;V<S;V++){var D=p[V>>>2]>>>24-V%4*8&255;i[l+V>>>2]|=D<<24-(l+V)%4*8;}else for(var _=0;_<S;_+=4)i[l+_>>>2]=p[_>>>2];return this.sigBytes+=S,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=n.ceil(i/4);},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var i=[],p=0;p<e;p+=4)i.push(r());return new y.init(i,e)}}),c=s.enc={},m=c.Hex={stringify:function(e){for(var i=e.words,p=e.sigBytes,l=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;l.push((V>>>4).toString(16)),l.push((V&15).toString(16));}return l.join("")},parse:function(e){for(var i=e.length,p=[],l=0;l<i;l+=2)p[l>>>3]|=parseInt(e.substr(l,2),16)<<24-l%8*4;return new y.init(p,i/2)}},b=c.Latin1={stringify:function(e){for(var i=e.words,p=e.sigBytes,l=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(V));}return l.join("")},parse:function(e){for(var i=e.length,p=[],l=0;l<i;l++)p[l>>>2]|=(e.charCodeAt(l)&255)<<24-l%4*8;return new y.init(p,i)}},N=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(b.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return b.parse(unescape(encodeURIComponent(e)))}},g=u.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=N.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var i,p=this._data,l=p.words,S=p.sigBytes,V=this.blockSize,D=V*4,_=S/D;e?_=n.ceil(_):_=n.max((_|0)-this._minBufferSize,0);var T=_*V,z=n.min(T*4,S);if(T){for(var k=0;k<T;k+=V)this._doProcessBlock(l,k);i=l.splice(0,T),p.sigBytes-=z;}return new y.init(i,z)},clone:function(){var e=d.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=g.extend({cfg:d.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){g.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var i=this._doFinalize();return i},blockSize:512/32,_createHelper:function(e){return function(i,p){return new e.init(p).finalize(i)}},_createHmacHelper:function(e){return function(i,p){return new x.HMAC.init(e,p).finalize(i)}}});var x=s.algo={};return s})(Math);return a});});var M=W((A,G)=>{(function(a,n){typeof A=="object"?G.exports=A=n(F()):typeof define=="function"&&define.amd?define(["./core"],n):n(a.CryptoJS);})(A,function(a){return (function(){var n=a,t=n.lib,o=t.WordArray,r=t.Hasher,f=n.algo,s=[],u=f.SHA1=r.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var c=this._hash.words,m=c[0],b=c[1],N=c[2],g=c[3],h=c[4],x=0;x<80;x++){if(x<16)s[x]=d[y+x]|0;else {var e=s[x-3]^s[x-8]^s[x-14]^s[x-16];s[x]=e<<1|e>>>31;}var i=(m<<5|m>>>27)+h+s[x];x<20?i+=(b&N|~b&g)+1518500249:x<40?i+=(b^N^g)+1859775393:x<60?i+=(b&N|b&g|N&g)-1894007588:i+=(b^N^g)-899497514,h=g,g=N,N=b<<30|b>>>2,b=m,m=i;}c[0]=c[0]+m|0,c[1]=c[1]+b|0,c[2]=c[2]+N|0,c[3]=c[3]+g|0,c[4]=c[4]+h|0;},_doFinalize:function(){var d=this._data,y=d.words,c=this._nDataBytes*8,m=d.sigBytes*8;return y[m>>>5]|=128<<24-m%32,y[(m+64>>>9<<4)+14]=Math.floor(c/4294967296),y[(m+64>>>9<<4)+15]=c,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});n.SHA1=r._createHelper(u),n.HmacSHA1=r._createHmacHelper(u);})(),a.SHA1});});var L;(r=>(r.log=(f,...s)=>console.log(`[Pixi\u2019VN Json] ${f}`,...s),r.warn=(f,...s)=>console.warn(`[Pixi\u2019VN Json] ${f}`,...s),r.error=(f,...s)=>console.error(`[Pixi\u2019VN Json] ${f}`,...s),r.info=(f,...s)=>console.info(`[Pixi\u2019VN Json] ${f}`,...s)))(L||(L={}));async function ae(a,n={}){let{operationStringConvert:t,skipEmptyDialogs:o}=n;if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {L.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let r=a.map(async u=>{if(typeof u=="string")try{u=JSON.parse(u);}catch(d){L.error("Error parsing imported Pixi'VN JSON",d),u={};}return u}),s=(await Promise.all(r)).map(async u=>{let d=[];if(u.initialOperations){let y={};[...storage.storage.storage.keys()].forEach((c,m)=>{y[c]=storage.storage.storage.get(c);}),storage.storage.startingStorage=y;}if(u.labels){let y=u.labels;for(let c in y)try{let m=y[c],b=new w(c,m,void 0,n);narration.RegisteredLabels.add(b);}catch(m){L.error(`Error creating JSON label ${c}`,m);}}return Promise.all(d)});await Promise.all(s);}var Y=ne(M());var $="___param___";function X(a){try{if(typeof a>"u")return a;let n=JSON.stringify(a);return JSON.parse(n)}catch(n){throw L.error("Error creating exportable element",a,n),new Error("[Pixi\u2019VN] Error creating exportable element")}}async function j(a,n){let t=unifier.JsonUnifier.getLogichValue(a);if(t)switch(t.type){case "sound":unifier.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await unifier.JsonUnifier.loadAssets(t);break;case "image":await unifier.JsonUnifier.imageOperation(t);break;case "video":await unifier.JsonUnifier.videoOperation(t);break;case "imagecontainer":await unifier.JsonUnifier.imageContainerOperation(t);break;case "text":await unifier.JsonUnifier.textOperation(t);break;case "canvaselement":await unifier.JsonUnifier.canvasElementOperation(t);break;case "value":unifier.JsonUnifier.setStorageValue(t);break;case "operationtoconvert":if(n){let o="";t.values.forEach(f=>{if(typeof f=="string")o+=f;else {let s=unifier.JsonUnifier.getLogichValue(f);o+=`${s}`;}});let r=await n(o);r&&await j(r,n);}break;case "input":case "dialogue":unifier.JsonUnifier.narrationOperation(t);break;case "fade":case "move":case "rotate":case "zoom":unifier.JsonUnifier.tickerOperation(t);break;case "shake":await unifier.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":unifier.JsonUnifier.animateOperation(t);break}}var w=class extends narration.LabelAbstract{constructor(t,o,r,f={}){r||(r={}),r.onLoadingLabel=async()=>{for(let s of o){let u;if(typeof s=="function"?u=s():u=s,u=unifier.JsonUnifier.getConditionalStep(u),u.operations){let d=u.operations.map(y=>unifier.JsonUnifier.loadAssets(y));await Promise.all(d);}}};super(t,r);C(this,"_steps");C(this,"operationStringConvert");C(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=f.operationStringConvert,this.skipEmptyDialogs=f.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let o=this._steps[t];return this.stepConverter(o)}getStepSha(t){if(t<0||t>=this.steps.length)return;let o=this._steps[t];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let o="";if(Array.isArray(t)){let r=[];t.forEach(f=>{if(typeof f=="string")r.push(f);else if(f&&typeof f=="object"){let s=unifier.JsonUnifier.getLogichValue(f);s?(s&&!Array.isArray(s)&&typeof s=="object"&&(s=unifier.JsonUnifier.getLogichValue(s)||""),Array.isArray(s)?r=r.map(u=>`${u}`).concat(s):r.push(`${s}`)):r.push(`${f}`);}else r.push(`${f}`);}),o=r;}else {let r=unifier.JsonUnifier.getLogichValue(t)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=unifier.JsonUnifier.getLogichValue(r)||""),o=r;}return `${o}`}getDialogue(t){if(t==null)return;let o=unifier.JsonUnifier.getLogichValue(t);return o==null?"":typeof o=="object"&&"character"in o&&"text"in o?{character:o.character,text:translator.translator.t(this.getDialogueText(o.text))}:translator.translator.t(this.getDialogueText(o))}getChoices(t){return unifier.JsonUnifier.getLogichValue(t)?.map(f=>unifier.JsonUnifier.getLogichValue(f)).filter(f=>f!==void 0)}stepConverter(t){return async o=>{let r=typeof t=="function"?t():t;r=X(r),r=unifier.JsonUnifier.getConditionalStep(r);let f=this.operationStringConvert?g=>this.operationStringConvert(g,r,o):void 0,{operations:s=[]}=r;for(let g of s)await j(g,f);let{labelToOpen:u=[]}=r,d=this.getChoices(r.choices),y=unifier.JsonUnifier.getLogichValue(r.glueEnabled),c=this.getDialogue(r.dialogue),m=[];Array.isArray(u)||(u=[u]),u.forEach(g=>{let h=unifier.JsonUnifier.getLogichValue(g);h&&m.push(h);});let b=unifier.JsonUnifier.getLogichValue(r.goNextStep),N=unifier.JsonUnifier.getLogichValue(r.end);if(d){let g=d.map(h=>{let x="";if(Array.isArray(h.text)){let i=[];h.text.forEach(p=>{if(typeof p=="string")i.push(translator.translator.t(p));else if(p&&typeof p=="object"){let l=unifier.JsonUnifier.getLogichValue(p);l&&!Array.isArray(l)&&typeof l=="object"&&(l=unifier.JsonUnifier.getLogichValue(l)||""),l&&(Array.isArray(l)?i=i.concat(translator.translator.t(l)):i.push(translator.translator.t(l)));}}),x=i;}else typeof h.text=="string"&&(x=translator.translator.t(h.text));return {label:h.label,text:x,props:h.props,type:h.type,oneTime:h.oneTime,onlyHaveNoChoice:h.onlyHaveNoChoice,autoSelect:h.autoSelect}});narration.narration.choiceMenuOptions=g;}else narration.narration.choiceMenuOptions=void 0;c!==void 0&&(narration.narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(b=true)),y?storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):y===false&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let g of m){let h=g.label;typeof h=="object"&&(h=unifier.JsonUnifier.getLogichValue(h)||"");let x=g.params?.map(e=>unifier.JsonUnifier.getLogichValue(e));o={...o,...g.props},g.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${$}${narration.narration.openedLabels.length}`,x),await narration.narration.callLabel(h,o)):(storage.storage.setTempVariable(`${$}${narration.narration.openedLabels.length}`,x),await narration.narration.callLabel(h,o));}N==="game_end"?(narration.narration.closeAllLabels(),await narration.narration.goNext(o,{runNow:true})):N==="label_end"&&narration.narration.closeCurrentLabel(),b&&await narration.narration.goNext(o,{runNow:true});}}};exports.LabelJson=w;exports.importPixiVNJson=ae;
@@ -1,4 +1,4 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
2
2
  import { StepLabelPropsType as StepLabelPropsType$1, LabelAbstract, LabelProps, StepLabelType } from '@drincs/pixi-vn/narration';
3
3
 
4
4
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
@@ -363,6 +363,14 @@ type PixiVNJsonCanvasImageContainerShow = {
363
363
  props?: ImageContainerOptions<ImageSprite>;
364
364
  transition?: PixiVNJsonMediaTransiotions;
365
365
  };
366
+ type PixiVNJsonCanvasTextShow = {
367
+ type: "text";
368
+ operationType: "show";
369
+ alias: string;
370
+ text: string;
371
+ props?: TextOptions;
372
+ transition?: PixiVNJsonMediaTransiotions;
373
+ };
366
374
  type PixiVNJsonImageEdit = {
367
375
  type: "image";
368
376
  operationType: "edit";
@@ -381,6 +389,12 @@ type PixiVNJsonImageContainerEdit = {
381
389
  alias: string;
382
390
  props?: Partial<ImageContainerMemory>;
383
391
  };
392
+ type PixiVNJsonTextEdit = {
393
+ type: "text";
394
+ operationType: "edit";
395
+ alias: string;
396
+ props?: Partial<TextMemory>;
397
+ };
384
398
  type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
385
399
  type: "canvaselement";
386
400
  operationType: "edit";
@@ -388,7 +402,7 @@ type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
388
402
  props?: Partial<T>;
389
403
  };
390
404
  type PixiVNJsonCanvasRemove = {
391
- type: "image" | "video" | "imagecontainer" | "canvaselement";
405
+ type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
392
406
  operationType: "remove";
393
407
  alias: string;
394
408
  transition?: PixiVNJsonMediaTransiotions;
@@ -403,8 +417,8 @@ type PixiVNJsonAssetsLoad = {
403
417
  operationType: "load" | "lazyload";
404
418
  aliases: string[];
405
419
  };
406
- type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow;
407
- type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory>;
420
+ type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
421
+ type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
408
422
  type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasTicker | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
409
423
 
410
424
  type PixiVNJsonInputRequest = {
@@ -1,4 +1,4 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
2
2
  import { StepLabelPropsType as StepLabelPropsType$1, LabelAbstract, LabelProps, StepLabelType } from '@drincs/pixi-vn/narration';
3
3
 
4
4
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
@@ -363,6 +363,14 @@ type PixiVNJsonCanvasImageContainerShow = {
363
363
  props?: ImageContainerOptions<ImageSprite>;
364
364
  transition?: PixiVNJsonMediaTransiotions;
365
365
  };
366
+ type PixiVNJsonCanvasTextShow = {
367
+ type: "text";
368
+ operationType: "show";
369
+ alias: string;
370
+ text: string;
371
+ props?: TextOptions;
372
+ transition?: PixiVNJsonMediaTransiotions;
373
+ };
366
374
  type PixiVNJsonImageEdit = {
367
375
  type: "image";
368
376
  operationType: "edit";
@@ -381,6 +389,12 @@ type PixiVNJsonImageContainerEdit = {
381
389
  alias: string;
382
390
  props?: Partial<ImageContainerMemory>;
383
391
  };
392
+ type PixiVNJsonTextEdit = {
393
+ type: "text";
394
+ operationType: "edit";
395
+ alias: string;
396
+ props?: Partial<TextMemory>;
397
+ };
384
398
  type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
385
399
  type: "canvaselement";
386
400
  operationType: "edit";
@@ -388,7 +402,7 @@ type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
388
402
  props?: Partial<T>;
389
403
  };
390
404
  type PixiVNJsonCanvasRemove = {
391
- type: "image" | "video" | "imagecontainer" | "canvaselement";
405
+ type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
392
406
  operationType: "remove";
393
407
  alias: string;
394
408
  transition?: PixiVNJsonMediaTransiotions;
@@ -403,8 +417,8 @@ type PixiVNJsonAssetsLoad = {
403
417
  operationType: "load" | "lazyload";
404
418
  aliases: string[];
405
419
  };
406
- type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow;
407
- type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory>;
420
+ type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
421
+ type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
408
422
  type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasTicker | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
409
423
 
410
424
  type PixiVNJsonInputRequest = {
package/dist/importer.mjs CHANGED
@@ -1 +1 @@
1
- import {RegisteredLabels,LabelAbstract,narration}from'@drincs/pixi-vn/narration';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';import {translator}from'@drincs/pixi-vn-json/translator';import {JsonUnifier}from'@drincs/pixi-vn-json/unifier';var K=Object.create;var H=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var ie=(a,n,t)=>n in a?H(a,n,{enumerable:true,configurable:true,writable:true,value:t}):a[n]=t;var I=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var W=(a,n)=>()=>(n||a((n={exports:{}}).exports,n),n.exports);var re=(a,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Z(n))!te.call(a,r)&&r!==t&&H(a,r,{get:()=>n[r],enumerable:!(o=Q(n,r))||o.enumerable});return a};var ne=(a,n,t)=>(t=a!=null?K(ee(a)):{},re(H(t,"default",{value:a,enumerable:true}),a));var C=(a,n,t)=>ie(a,typeof n!="symbol"?n+"":n,t);var F=W((E,U)=>{(function(a,n){typeof E=="object"?U.exports=E=n():typeof define=="function"&&define.amd?define([],n):a.CryptoJS=n();})(E,function(){var a=a||(function(n,t){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof I=="function")try{o=I("crypto");}catch{}var r=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},f=Object.create||(function(){function e(){}return function(i){var p;return e.prototype=i,p=new e,e.prototype=null,p}})(),s={},u=s.lib={},d=u.Base=(function(){return {extend:function(e){var i=f(this);return e&&i.mixIn(e),(!i.hasOwnProperty("init")||this.init===i.init)&&(i.init=function(){i.$super.init.apply(this,arguments);}),i.init.prototype=i,i.$super=this,i},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var i in e)e.hasOwnProperty(i)&&(this[i]=e[i]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),y=u.WordArray=d.extend({init:function(e,i){e=this.words=e||[],i!=t?this.sigBytes=i:this.sigBytes=e.length*4;},toString:function(e){return (e||m).stringify(this)},concat:function(e){var i=this.words,p=e.words,l=this.sigBytes,S=e.sigBytes;if(this.clamp(),l%4)for(var V=0;V<S;V++){var D=p[V>>>2]>>>24-V%4*8&255;i[l+V>>>2]|=D<<24-(l+V)%4*8;}else for(var _=0;_<S;_+=4)i[l+_>>>2]=p[_>>>2];return this.sigBytes+=S,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=n.ceil(i/4);},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var i=[],p=0;p<e;p+=4)i.push(r());return new y.init(i,e)}}),c=s.enc={},m=c.Hex={stringify:function(e){for(var i=e.words,p=e.sigBytes,l=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;l.push((V>>>4).toString(16)),l.push((V&15).toString(16));}return l.join("")},parse:function(e){for(var i=e.length,p=[],l=0;l<i;l+=2)p[l>>>3]|=parseInt(e.substr(l,2),16)<<24-l%8*4;return new y.init(p,i/2)}},b=c.Latin1={stringify:function(e){for(var i=e.words,p=e.sigBytes,l=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(V));}return l.join("")},parse:function(e){for(var i=e.length,p=[],l=0;l<i;l++)p[l>>>2]|=(e.charCodeAt(l)&255)<<24-l%4*8;return new y.init(p,i)}},P=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(b.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return b.parse(unescape(encodeURIComponent(e)))}},g=u.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=P.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var i,p=this._data,l=p.words,S=p.sigBytes,V=this.blockSize,D=V*4,_=S/D;e?_=n.ceil(_):_=n.max((_|0)-this._minBufferSize,0);var O=_*V,z=n.min(O*4,S);if(O){for(var k=0;k<O;k+=V)this._doProcessBlock(l,k);i=l.splice(0,O),p.sigBytes-=z;}return new y.init(i,z)},clone:function(){var e=d.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=g.extend({cfg:d.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){g.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var i=this._doFinalize();return i},blockSize:512/32,_createHelper:function(e){return function(i,p){return new e.init(p).finalize(i)}},_createHmacHelper:function(e){return function(i,p){return new x.HMAC.init(e,p).finalize(i)}}});var x=s.algo={};return s})(Math);return a});});var M=W((A,G)=>{(function(a,n){typeof A=="object"?G.exports=A=n(F()):typeof define=="function"&&define.amd?define(["./core"],n):n(a.CryptoJS);})(A,function(a){return (function(){var n=a,t=n.lib,o=t.WordArray,r=t.Hasher,f=n.algo,s=[],u=f.SHA1=r.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var c=this._hash.words,m=c[0],b=c[1],P=c[2],g=c[3],h=c[4],x=0;x<80;x++){if(x<16)s[x]=d[y+x]|0;else {var e=s[x-3]^s[x-8]^s[x-14]^s[x-16];s[x]=e<<1|e>>>31;}var i=(m<<5|m>>>27)+h+s[x];x<20?i+=(b&P|~b&g)+1518500249:x<40?i+=(b^P^g)+1859775393:x<60?i+=(b&P|b&g|P&g)-1894007588:i+=(b^P^g)-899497514,h=g,g=P,P=b<<30|b>>>2,b=m,m=i;}c[0]=c[0]+m|0,c[1]=c[1]+b|0,c[2]=c[2]+P|0,c[3]=c[3]+g|0,c[4]=c[4]+h|0;},_doFinalize:function(){var d=this._data,y=d.words,c=this._nDataBytes*8,m=d.sigBytes*8;return y[m>>>5]|=128<<24-m%32,y[(m+64>>>9<<4)+14]=Math.floor(c/4294967296),y[(m+64>>>9<<4)+15]=c,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});n.SHA1=r._createHelper(u),n.HmacSHA1=r._createHmacHelper(u);})(),a.SHA1});});var L;(r=>(r.log=(f,...s)=>console.log(`[Pixi\u2019VN Json] ${f}`,...s),r.warn=(f,...s)=>console.warn(`[Pixi\u2019VN Json] ${f}`,...s),r.error=(f,...s)=>console.error(`[Pixi\u2019VN Json] ${f}`,...s),r.info=(f,...s)=>console.info(`[Pixi\u2019VN Json] ${f}`,...s)))(L||(L={}));async function ae(a,n={}){let{operationStringConvert:t,skipEmptyDialogs:o}=n;if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {L.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let r=a.map(async u=>{if(typeof u=="string")try{u=JSON.parse(u);}catch(d){L.error("Error parsing imported Pixi'VN JSON",d),u={};}return u}),s=(await Promise.all(r)).map(async u=>{let d=[];if(u.initialOperations){let y={};[...storage.storage.keys()].forEach((c,m)=>{y[c]=storage.storage.get(c);}),storage.startingStorage=y;}if(u.labels){let y=u.labels;for(let c in y)try{let m=y[c],b=new w(c,m,void 0,n);RegisteredLabels.add(b);}catch(m){L.error(`Error creating JSON label ${c}`,m);}}return Promise.all(d)});await Promise.all(s);}var Y=ne(M());var $="___param___";function X(a){try{if(typeof a>"u")return a;let n=JSON.stringify(a);return JSON.parse(n)}catch(n){throw L.error("Error creating exportable element",a,n),new Error("[Pixi\u2019VN] Error creating exportable element")}}async function j(a,n){let t=JsonUnifier.getLogichValue(a);if(t)switch(t.type){case "sound":JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await JsonUnifier.loadAssets(t);break;case "image":await JsonUnifier.imageOperation(t);break;case "video":await JsonUnifier.videoOperation(t);break;case "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "value":JsonUnifier.setStorageValue(t);break;case "operationtoconvert":if(n){let o="";t.values.forEach(f=>{if(typeof f=="string")o+=f;else {let s=JsonUnifier.getLogichValue(f);o+=`${s}`;}});let r=await n(o);r&&await j(r,n);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "fade":case "move":case "rotate":case "zoom":JsonUnifier.tickerOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break}}var w=class extends LabelAbstract{constructor(t,o,r,f={}){r||(r={}),r.onLoadingLabel=async()=>{for(let s of o){let u;if(typeof s=="function"?u=s():u=s,u=JsonUnifier.getConditionalStep(u),u.operations){let d=u.operations.map(y=>JsonUnifier.loadAssets(y));await Promise.all(d);}}};super(t,r);C(this,"_steps");C(this,"operationStringConvert");C(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=f.operationStringConvert,this.skipEmptyDialogs=f.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let o=this._steps[t];return this.stepConverter(o)}getStepSha(t){if(t<0||t>=this.steps.length)return;let o=this._steps[t];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let o="";if(Array.isArray(t)){let r=[];t.forEach(f=>{if(typeof f=="string")r.push(f);else if(f&&typeof f=="object"){let s=JsonUnifier.getLogichValue(f);s?(s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s)||""),Array.isArray(s)?r=r.concat(s):r.push(`${s}`)):r.push(`${f}`);}}),o=r;}else {let r=JsonUnifier.getLogichValue(t)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=JsonUnifier.getLogichValue(r)||""),o=r;}return `${o}`}getDialogue(t){if(t==null)return;let o=JsonUnifier.getLogichValue(t);return o==null?"":typeof o=="object"&&"character"in o&&"text"in o?{character:o.character,text:translator.t(this.getDialogueText(o.text))}:translator.t(this.getDialogueText(o))}getChoices(t){return JsonUnifier.getLogichValue(t)?.map(f=>JsonUnifier.getLogichValue(f)).filter(f=>f!==void 0)}stepConverter(t){return async o=>{let r=typeof t=="function"?t():t;r=X(r),r=JsonUnifier.getConditionalStep(r);let f=this.operationStringConvert?g=>this.operationStringConvert(g,r,o):void 0,{operations:s=[]}=r;for(let g of s)await j(g,f);let{labelToOpen:u=[]}=r,d=this.getChoices(r.choices),y=JsonUnifier.getLogichValue(r.glueEnabled),c=this.getDialogue(r.dialogue),m=[];Array.isArray(u)||(u=[u]),u.forEach(g=>{let h=JsonUnifier.getLogichValue(g);h&&m.push(h);});let b=JsonUnifier.getLogichValue(r.goNextStep),P=JsonUnifier.getLogichValue(r.end);if(d){let g=d.map(h=>{let x="";if(Array.isArray(h.text)){let i=[];h.text.forEach(p=>{if(typeof p=="string")i.push(translator.t(p));else if(p&&typeof p=="object"){let l=JsonUnifier.getLogichValue(p);l&&!Array.isArray(l)&&typeof l=="object"&&(l=JsonUnifier.getLogichValue(l)||""),l&&(Array.isArray(l)?i=i.concat(translator.t(l)):i.push(translator.t(l)));}}),x=i;}else typeof h.text=="string"&&(x=translator.t(h.text));return {label:h.label,text:x,props:h.props,type:h.type,oneTime:h.oneTime,onlyHaveNoChoice:h.onlyHaveNoChoice,autoSelect:h.autoSelect}});narration.choiceMenuOptions=g;}else narration.choiceMenuOptions=void 0;c!==void 0&&(narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(b=true)),y?storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):y===false&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let g of m){let h=g.label;typeof h=="object"&&(h=JsonUnifier.getLogichValue(h)||"");let x=g.params?.map(e=>JsonUnifier.getLogichValue(e));o={...o,...g.props},g.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${$}${narration.openedLabels.length}`,x),await narration.callLabel(h,o)):(storage.setTempVariable(`${$}${narration.openedLabels.length}`,x),await narration.callLabel(h,o));}P==="game_end"?(narration.closeAllLabels(),await narration.goNext(o,{runNow:true})):P==="label_end"&&narration.closeCurrentLabel(),b&&await narration.goNext(o,{runNow:true});}}};export{w as LabelJson,ae as importPixiVNJson};
1
+ import {RegisteredLabels,LabelAbstract,narration}from'@drincs/pixi-vn/narration';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';import {translator}from'@drincs/pixi-vn-json/translator';import {JsonUnifier}from'@drincs/pixi-vn-json/unifier';var K=Object.create;var H=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var ie=(a,n,t)=>n in a?H(a,n,{enumerable:true,configurable:true,writable:true,value:t}):a[n]=t;var I=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var W=(a,n)=>()=>(n||a((n={exports:{}}).exports,n),n.exports);var re=(a,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Z(n))!te.call(a,r)&&r!==t&&H(a,r,{get:()=>n[r],enumerable:!(o=Q(n,r))||o.enumerable});return a};var ne=(a,n,t)=>(t=a!=null?K(ee(a)):{},re(H(t,"default",{value:a,enumerable:true}),a));var C=(a,n,t)=>ie(a,typeof n!="symbol"?n+"":n,t);var F=W((E,U)=>{(function(a,n){typeof E=="object"?U.exports=E=n():typeof define=="function"&&define.amd?define([],n):a.CryptoJS=n();})(E,function(){var a=a||(function(n,t){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof I=="function")try{o=I("crypto");}catch{}var r=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},f=Object.create||(function(){function e(){}return function(i){var p;return e.prototype=i,p=new e,e.prototype=null,p}})(),s={},u=s.lib={},d=u.Base=(function(){return {extend:function(e){var i=f(this);return e&&i.mixIn(e),(!i.hasOwnProperty("init")||this.init===i.init)&&(i.init=function(){i.$super.init.apply(this,arguments);}),i.init.prototype=i,i.$super=this,i},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var i in e)e.hasOwnProperty(i)&&(this[i]=e[i]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),y=u.WordArray=d.extend({init:function(e,i){e=this.words=e||[],i!=t?this.sigBytes=i:this.sigBytes=e.length*4;},toString:function(e){return (e||m).stringify(this)},concat:function(e){var i=this.words,p=e.words,l=this.sigBytes,S=e.sigBytes;if(this.clamp(),l%4)for(var V=0;V<S;V++){var D=p[V>>>2]>>>24-V%4*8&255;i[l+V>>>2]|=D<<24-(l+V)%4*8;}else for(var _=0;_<S;_+=4)i[l+_>>>2]=p[_>>>2];return this.sigBytes+=S,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=n.ceil(i/4);},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var i=[],p=0;p<e;p+=4)i.push(r());return new y.init(i,e)}}),c=s.enc={},m=c.Hex={stringify:function(e){for(var i=e.words,p=e.sigBytes,l=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;l.push((V>>>4).toString(16)),l.push((V&15).toString(16));}return l.join("")},parse:function(e){for(var i=e.length,p=[],l=0;l<i;l+=2)p[l>>>3]|=parseInt(e.substr(l,2),16)<<24-l%8*4;return new y.init(p,i/2)}},b=c.Latin1={stringify:function(e){for(var i=e.words,p=e.sigBytes,l=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(V));}return l.join("")},parse:function(e){for(var i=e.length,p=[],l=0;l<i;l++)p[l>>>2]|=(e.charCodeAt(l)&255)<<24-l%4*8;return new y.init(p,i)}},N=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(b.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return b.parse(unescape(encodeURIComponent(e)))}},g=u.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=N.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var i,p=this._data,l=p.words,S=p.sigBytes,V=this.blockSize,D=V*4,_=S/D;e?_=n.ceil(_):_=n.max((_|0)-this._minBufferSize,0);var T=_*V,z=n.min(T*4,S);if(T){for(var k=0;k<T;k+=V)this._doProcessBlock(l,k);i=l.splice(0,T),p.sigBytes-=z;}return new y.init(i,z)},clone:function(){var e=d.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=g.extend({cfg:d.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){g.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var i=this._doFinalize();return i},blockSize:512/32,_createHelper:function(e){return function(i,p){return new e.init(p).finalize(i)}},_createHmacHelper:function(e){return function(i,p){return new x.HMAC.init(e,p).finalize(i)}}});var x=s.algo={};return s})(Math);return a});});var M=W((A,G)=>{(function(a,n){typeof A=="object"?G.exports=A=n(F()):typeof define=="function"&&define.amd?define(["./core"],n):n(a.CryptoJS);})(A,function(a){return (function(){var n=a,t=n.lib,o=t.WordArray,r=t.Hasher,f=n.algo,s=[],u=f.SHA1=r.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var c=this._hash.words,m=c[0],b=c[1],N=c[2],g=c[3],h=c[4],x=0;x<80;x++){if(x<16)s[x]=d[y+x]|0;else {var e=s[x-3]^s[x-8]^s[x-14]^s[x-16];s[x]=e<<1|e>>>31;}var i=(m<<5|m>>>27)+h+s[x];x<20?i+=(b&N|~b&g)+1518500249:x<40?i+=(b^N^g)+1859775393:x<60?i+=(b&N|b&g|N&g)-1894007588:i+=(b^N^g)-899497514,h=g,g=N,N=b<<30|b>>>2,b=m,m=i;}c[0]=c[0]+m|0,c[1]=c[1]+b|0,c[2]=c[2]+N|0,c[3]=c[3]+g|0,c[4]=c[4]+h|0;},_doFinalize:function(){var d=this._data,y=d.words,c=this._nDataBytes*8,m=d.sigBytes*8;return y[m>>>5]|=128<<24-m%32,y[(m+64>>>9<<4)+14]=Math.floor(c/4294967296),y[(m+64>>>9<<4)+15]=c,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});n.SHA1=r._createHelper(u),n.HmacSHA1=r._createHmacHelper(u);})(),a.SHA1});});var L;(r=>(r.log=(f,...s)=>console.log(`[Pixi\u2019VN Json] ${f}`,...s),r.warn=(f,...s)=>console.warn(`[Pixi\u2019VN Json] ${f}`,...s),r.error=(f,...s)=>console.error(`[Pixi\u2019VN Json] ${f}`,...s),r.info=(f,...s)=>console.info(`[Pixi\u2019VN Json] ${f}`,...s)))(L||(L={}));async function ae(a,n={}){let{operationStringConvert:t,skipEmptyDialogs:o}=n;if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {L.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let r=a.map(async u=>{if(typeof u=="string")try{u=JSON.parse(u);}catch(d){L.error("Error parsing imported Pixi'VN JSON",d),u={};}return u}),s=(await Promise.all(r)).map(async u=>{let d=[];if(u.initialOperations){let y={};[...storage.storage.keys()].forEach((c,m)=>{y[c]=storage.storage.get(c);}),storage.startingStorage=y;}if(u.labels){let y=u.labels;for(let c in y)try{let m=y[c],b=new w(c,m,void 0,n);RegisteredLabels.add(b);}catch(m){L.error(`Error creating JSON label ${c}`,m);}}return Promise.all(d)});await Promise.all(s);}var Y=ne(M());var $="___param___";function X(a){try{if(typeof a>"u")return a;let n=JSON.stringify(a);return JSON.parse(n)}catch(n){throw L.error("Error creating exportable element",a,n),new Error("[Pixi\u2019VN] Error creating exportable element")}}async function j(a,n){let t=JsonUnifier.getLogichValue(a);if(t)switch(t.type){case "sound":JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await JsonUnifier.loadAssets(t);break;case "image":await JsonUnifier.imageOperation(t);break;case "video":await JsonUnifier.videoOperation(t);break;case "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "text":await JsonUnifier.textOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "value":JsonUnifier.setStorageValue(t);break;case "operationtoconvert":if(n){let o="";t.values.forEach(f=>{if(typeof f=="string")o+=f;else {let s=JsonUnifier.getLogichValue(f);o+=`${s}`;}});let r=await n(o);r&&await j(r,n);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "fade":case "move":case "rotate":case "zoom":JsonUnifier.tickerOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break}}var w=class extends LabelAbstract{constructor(t,o,r,f={}){r||(r={}),r.onLoadingLabel=async()=>{for(let s of o){let u;if(typeof s=="function"?u=s():u=s,u=JsonUnifier.getConditionalStep(u),u.operations){let d=u.operations.map(y=>JsonUnifier.loadAssets(y));await Promise.all(d);}}};super(t,r);C(this,"_steps");C(this,"operationStringConvert");C(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=f.operationStringConvert,this.skipEmptyDialogs=f.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let o=this._steps[t];return this.stepConverter(o)}getStepSha(t){if(t<0||t>=this.steps.length)return;let o=this._steps[t];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let o="";if(Array.isArray(t)){let r=[];t.forEach(f=>{if(typeof f=="string")r.push(f);else if(f&&typeof f=="object"){let s=JsonUnifier.getLogichValue(f);s?(s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s)||""),Array.isArray(s)?r=r.map(u=>`${u}`).concat(s):r.push(`${s}`)):r.push(`${f}`);}else r.push(`${f}`);}),o=r;}else {let r=JsonUnifier.getLogichValue(t)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=JsonUnifier.getLogichValue(r)||""),o=r;}return `${o}`}getDialogue(t){if(t==null)return;let o=JsonUnifier.getLogichValue(t);return o==null?"":typeof o=="object"&&"character"in o&&"text"in o?{character:o.character,text:translator.t(this.getDialogueText(o.text))}:translator.t(this.getDialogueText(o))}getChoices(t){return JsonUnifier.getLogichValue(t)?.map(f=>JsonUnifier.getLogichValue(f)).filter(f=>f!==void 0)}stepConverter(t){return async o=>{let r=typeof t=="function"?t():t;r=X(r),r=JsonUnifier.getConditionalStep(r);let f=this.operationStringConvert?g=>this.operationStringConvert(g,r,o):void 0,{operations:s=[]}=r;for(let g of s)await j(g,f);let{labelToOpen:u=[]}=r,d=this.getChoices(r.choices),y=JsonUnifier.getLogichValue(r.glueEnabled),c=this.getDialogue(r.dialogue),m=[];Array.isArray(u)||(u=[u]),u.forEach(g=>{let h=JsonUnifier.getLogichValue(g);h&&m.push(h);});let b=JsonUnifier.getLogichValue(r.goNextStep),N=JsonUnifier.getLogichValue(r.end);if(d){let g=d.map(h=>{let x="";if(Array.isArray(h.text)){let i=[];h.text.forEach(p=>{if(typeof p=="string")i.push(translator.t(p));else if(p&&typeof p=="object"){let l=JsonUnifier.getLogichValue(p);l&&!Array.isArray(l)&&typeof l=="object"&&(l=JsonUnifier.getLogichValue(l)||""),l&&(Array.isArray(l)?i=i.concat(translator.t(l)):i.push(translator.t(l)));}}),x=i;}else typeof h.text=="string"&&(x=translator.t(h.text));return {label:h.label,text:x,props:h.props,type:h.type,oneTime:h.oneTime,onlyHaveNoChoice:h.onlyHaveNoChoice,autoSelect:h.autoSelect}});narration.choiceMenuOptions=g;}else narration.choiceMenuOptions=void 0;c!==void 0&&(narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(b=true)),y?storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):y===false&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let g of m){let h=g.label;typeof h=="object"&&(h=JsonUnifier.getLogichValue(h)||"");let x=g.params?.map(e=>JsonUnifier.getLogichValue(e));o={...o,...g.props},g.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${$}${narration.openedLabels.length}`,x),await narration.callLabel(h,o)):(storage.setTempVariable(`${$}${narration.openedLabels.length}`,x),await narration.callLabel(h,o));}N==="game_end"?(narration.closeAllLabels(),await narration.goNext(o,{runNow:true})):N==="label_end"&&narration.closeCurrentLabel(),b&&await narration.goNext(o,{runNow:true});}}};export{w as LabelJson,ae as importPixiVNJson};
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var importer=require('@drincs/pixi-vn-json/importer'),translator=require('@drincs/pixi-vn-json/translator'),unifier=require('@drincs/pixi-vn-json/unifier'),pixiVn=require('@drincs/pixi-vn'),narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage');var y="___param___";async function E(e){let a=unifier.JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await pixiVn.Assets.load(a.aliases);break;case "lazyload":pixiVn.Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await pixiVn.Assets.loadBundle(a.aliases);break;case "lazyload":pixiVn.Assets.backgroundLoadBundle(a.aliases);break}break}}var l;(t=>(t.log=(o,...u)=>console.log(`[Pixi\u2019VN Json] ${o}`,...u),t.warn=(o,...u)=>console.warn(`[Pixi\u2019VN Json] ${o}`,...u),t.error=(o,...u)=>console.error(`[Pixi\u2019VN Json] ${o}`,...u),t.info=(o,...u)=>console.info(`[Pixi\u2019VN Json] ${o}`,...u)))(l||(l={}));async function w(e,a,i){switch(i.type){case "fade":await pixiVn.showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await pixiVn.showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await pixiVn.moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await pixiVn.zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await pixiVn.pushIn(a.alias,e,i.props,i.priority);break}}function N(e){if(e.transition)switch(e.transition.type){case "fade":pixiVn.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":pixiVn.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pixiVn.pushOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);}async function I(e){switch(e.operationType){case "show":if(e.transition){let i=new pixiVn.ImageSprite(e.props,e.url||e.alias);await w(i,e,e.transition);}else await pixiVn.showImage(e.alias,e.url,e.props);break;case "edit":let a=pixiVn.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`Image with alias ${e.alias} not found.`);break;case "remove":N(e);break}}async function v(e){switch(e.operationType){case "show":if(e.transition){let t=new pixiVn.VideoSprite(e.props,e.url||e.alias);await w(t,e,e.transition);}else await pixiVn.showVideo(e.alias,e.url,e.props);break;case "edit":let a=pixiVn.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`Video with alias ${e.alias} not found.`);break;case "remove":N(e);break;case "pause":let i=pixiVn.canvas.find(e.alias);i?i.paused=true:l.error(`Video with alias ${e.alias} not found.`);break;case "resume":let r=pixiVn.canvas.find(e.alias);r?r.paused=false:l.error(`Video with alias ${e.alias} not found.`);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let i=new pixiVn.ImageContainer(e.props,e.urls);await w(i,e,e.transition);}else await pixiVn.showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=pixiVn.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":N(e);break}}async function _(e){switch(e.operationType){case "edit":try{let a=pixiVn.canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):l.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){l.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":N(e);break}}function R(e){switch(e.type){case "fade":let a=new pixiVn.FadeAlphaTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,a);break;case "move":let i=new pixiVn.MoveTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,i);break;case "rotate":let r=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,r);break;case "zoom":let t=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,t);break}}async function L(e){switch(e.type){case "shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}function D(e){switch(e.type){case "animate":pixiVn.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":pixiVn.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function M(e){switch(e.type){case "input":pixiVn.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":pixiVn.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 $(e){try{if(typeof e>"u")return e;let a=JSON.stringify(e);return JSON.parse(a)}catch(a){throw l.error("Error creating exportable element",e,a),new Error("[Pixi\u2019VN] Error creating exportable element")}}function j(e){let a=n(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=n(a):i=a,e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.setVariable(e.key,i);break;case "tempstorage":storage.storage.setTempVariable(e.key,i);break;case "params":let r=storage.storage.getVariable(`${y}${narration.narration.openedLabels.length-1}`)||[];r&&r.length-1>=e.key&&(r[e.key]=i),storage.storage.setTempVariable(`${y}${narration.narration.openedLabels.length-1}`,r);break}}function n(e){let a=Ne(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return xe(a);case "arithmetic":case "arithmeticsingle":return Ve(a);case "compare":case "valueCondition":case "union":return ye(a)}return a}function Ve(e){let a=n(e.leftValue);switch(e.type){case "arithmetic":let i=n(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 xe(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.getVariable(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 n(e.operation);case "params":let a=storage.storage.getVariable(`${y}${narration.narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];l.warn("getValue params not found");return}return e}function ye(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=n(e.leftValue),i=n(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 !!n(e.value);case "union":return he(e)}return !!e}function he(e){if(e.unionType==="not")return !n(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=n(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function Te(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function Ne(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return be(e);case "ifelse":return n(e.condition)?n(e.then):n(e.else);case "stepswitch":let i=n(e.elements)||[];if(i.length===0){l.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let r=Te(0,i.length-1);return n(i[r]);case "loop":let t=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return t>i.length-1&&(t=t%i.length),n(i[t]);case "sequential":let o,u=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(o=n(i[i.length-1])),u>i.length-1?o:n(i[u]);case "sequentialrandom":let p=narration.NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(p==null&&e.end=="lastItem"){let g=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!g||!g?.usedRandomNumbers){l.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let x=g.usedRandomNumbers[`0-${i.length-1}`];return n(i[x[x.length-1]])}if(p==null){l.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return n(i[p])}}return e}function P(e){if(e.conditionalStep){let a=$(n(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 P(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 be(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(t=>{if(Array.isArray(t))t.forEach(o=>{let u=n(o);i.push(u);});else {let o=n(t);i.push(o);}});let r=a?[a,...i]:i;if(r.length===0){l.warn("combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return translator.translator.t(r);if(typeof r[0]=="object"){let t=r,o,u=t.map((s,m)=>{s=P(s);let c=n(s.dialogue)||"";return m===0?(o=n(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),o===false&&(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'),pixiVn=require('@drincs/pixi-vn'),narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage');var y="___param___";async function E(e){let i=unifier.JsonUnifier.getLogichValue(e);if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await pixiVn.Assets.load(i.aliases);break;case "lazyload":pixiVn.Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await pixiVn.Assets.loadBundle(i.aliases);break;case "lazyload":pixiVn.Assets.backgroundLoadBundle(i.aliases);break}break}}var r;(n=>(n.log=(l,...u)=>console.log(`[Pixi\u2019VN Json] ${l}`,...u),n.warn=(l,...u)=>console.warn(`[Pixi\u2019VN Json] ${l}`,...u),n.error=(l,...u)=>console.error(`[Pixi\u2019VN Json] ${l}`,...u),n.info=(l,...u)=>console.info(`[Pixi\u2019VN Json] ${l}`,...u)))(r||(r={}));async function b(e,i,a){switch(a.type){case "fade":await pixiVn.showWithFade(i.alias,e,a.props,a.priority);break;case "dissolve":await pixiVn.showWithDissolve(i.alias,e,a.props,a.priority);break;case "movein":case "moveout":await pixiVn.moveIn(i.alias,e,a.props,a.priority);break;case "zoomin":case "zoomout":await pixiVn.zoomIn(i.alias,e,a.props,a.priority);break;case "pushin":case "pushout":await pixiVn.pushIn(i.alias,e,a.props,a.priority);break}}function h(e){if(e.transition)switch(e.transition.type){case "fade":pixiVn.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":pixiVn.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pixiVn.pushOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);}async function I(e){switch(e.operationType){case "show":if(e.transition){let a=new pixiVn.ImageSprite(e.props,e.url||e.alias);await b(a,e,e.transition);}else await pixiVn.showImage(e.alias,e.url,e.props);break;case "edit":let i=pixiVn.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Image with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function v(e){switch(e.operationType){case "show":if(e.transition){let n=new pixiVn.VideoSprite(e.props,e.url||e.alias);await b(n,e,e.transition);}else await pixiVn.showVideo(e.alias,e.url,e.props);break;case "edit":let i=pixiVn.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Video with alias ${e.alias} not found.`);break;case "remove":h(e);break;case "pause":let a=pixiVn.canvas.find(e.alias);a?a.paused=true:r.error(`Video with alias ${e.alias} not found.`);break;case "resume":let o=pixiVn.canvas.find(e.alias);o?o.paused=false:r.error(`Video with alias ${e.alias} not found.`);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let a=new pixiVn.ImageContainer(e.props,e.urls);await b(a,e,e.transition);}else await pixiVn.showImageContainer(e.alias,e.urls,e.props);break;case "edit":let i=pixiVn.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function _(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=e.text,e.transition){let a=new pixiVn.Text(e.props);await b(a,e,e.transition);}else pixiVn.showText(e.alias,e.text,e.props);break;case "edit":let i=pixiVn.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Text with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function R(e){switch(e.operationType){case "edit":try{let i=pixiVn.canvas.find(e.alias);i?e.props&&(i.memory={...i.memory,...e.props}):r.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){r.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":h(e);break}}function L(e){switch(e.type){case "fade":let i=new pixiVn.FadeAlphaTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,i);break;case "move":let a=new pixiVn.MoveTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,a);break;case "rotate":let o=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,o);break;case "zoom":let n=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,n);break}}async function D(e){switch(e.type){case "shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}function M(e){switch(e.type){case "animate":pixiVn.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":pixiVn.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function F(e){switch(e.type){case "input":pixiVn.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":pixiVn.narration.dialogue=void 0;break}}function $(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 i=JSON.stringify(e);return JSON.parse(i)}catch(i){throw r.error("Error creating exportable element",e,i),new Error("[Pixi\u2019VN] Error creating exportable element")}}function U(e){let i=t(e.value),a;switch(i&&typeof i=="object"&&"type"in i?a=t(i):a=i,e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.setVariable(e.key,a);break;case "tempstorage":storage.storage.setTempVariable(e.key,a);break;case "params":let o=storage.storage.getVariable(`${y}${narration.narration.openedLabels.length-1}`)||[];o&&o.length-1>=e.key&&(o[e.key]=a),storage.storage.setTempVariable(`${y}${narration.narration.openedLabels.length-1}`,o);break}}function t(e){let i=Je(e);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return Te(i);case "arithmetic":case "arithmeticsingle":return he(i);case "compare":case "valueCondition":case "union":return Ne(i)}return i}function he(e){let i=t(e.leftValue);switch(e.type){case "arithmetic":let a=t(e.rightValue);switch(e.operator){case "*":return i*a;case "/":return i/a;case "+":return i+a;case "-":return i-a;case "%":return i%a;case "POW":return Math.pow(i,a);case "RANDOM":return narration.narration.getRandomNumber(i,a)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(i);case "FLOOR":return Math.floor(i);case "FLOAT":return parseFloat(i)}break}}function Te(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.getVariable(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 i=storage.storage.getVariable(`${y}${narration.narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];r.warn("getValue params not found");return}return e}function Ne(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let i=t(e.leftValue),a=t(e.rightValue);switch(e.operator){case "==":return i===a;case "!=":return i!==a;case "<":return i<a;case "<=":return i<=a;case ">":return i>a;case ">=":return i>=a;case "CONTAINS":return i.toString().includes(a.toString())}break;case "valueCondition":return !!t(e.value);case "union":return be(e)}return !!e}function be(e){if(e.unionType==="not")return !t(e.condition);let i=e.unionType==="and";for(let a=0;a<e.conditions.length;a++)if(i=t(e.conditions[a])||false,e.unionType==="and"){if(!i)return false}else if(i)return true;return i}function Pe(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function Je(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return we(e);case "ifelse":return t(e.condition)?t(e.then):t(e.else);case "stepswitch":let a=t(e.elements)||[];if(a.length===0){r.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let o=Pe(0,a.length-1);return t(a[o]);case "loop":let n=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>a.length-1&&(n=n%a.length),t(a[n]);case "sequential":let l,u=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(l=t(a[a.length-1])),u>a.length-1?l:t(a[u]);case "sequentialrandom":let p=narration.NarrationManagerStatic.getRandomNumber(0,a.length-1,{nestedId:e.nestedId,onceOnly:true});if(p==null&&e.end=="lastItem"){let x=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!x||!x?.usedRandomNumbers){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let V=x.usedRandomNumbers[`0-${a.length-1}`];return t(a[V[V.length-1]])}if(p==null){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return t(a[p])}}return e}function J(e){if(e.conditionalStep){let i=j(t(e.conditionalStep));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let a={...e,conditionalStep:void 0,...i};return J(a)}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 we(e){let i=e.firstItem,a=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(l=>{let u=t(l);a.push(u);});else {let l=t(n);a.push(l);}});let o=i?[i,...a]:a;if(o.length===0){r.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator.translator.t(o);if(typeof o[0]=="object"){let n=o,l,u=n.map((s,m)=>{s=J(s);let d=t(s.dialogue)||"";return m===0?(l=t(s.glueEnabled)||false,d):(typeof d=="object"&&"text"in d&&(d=d.character+": "+d.text),l===false&&(d=`
2
2
 
3
- `+c),o=n(s.glueEnabled)||false,c)}),p=n(u[0]),g=typeof p=="object"&&"character"in p?p.character:void 0,x=u.flatMap(s=>{let m;s&&typeof s=="object"&&"text"in s?m=s.text:m=s;let c;return Array.isArray(m)?c=m.map(W=>{let q=n(W);return translator.translator.t(`${q}`)}):c=n(m)||"",translator.translator.t(c)}),U=t.find(s=>s.end),z=t.find(s=>s.choices),C=false,O=false;t.length>0&&(t[0].glueEnabled&&t[0].goNextStep&&t[0].dialogue===void 0&&storage.storage.setFlag(storage.SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),C=t[t.length-1].glueEnabled,O=t.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let X=t.find(s=>s.labelToOpen),J=[];return t.forEach(s=>{s.operations&&J.forEach(m=>{J.push(m);});}),{dialogue:g?{character:g,text:x}:x,end:U?.end,choices:z?.choices,glueEnabled:C,goNextStep:O,labelToOpen:X?.labelToOpen,operations:J}}}function na(){unifier.JsonUnifier.init({animateOperation:D,canvasElementOperation:_,effectOperation:L,imageContainerOperation:A,imageOperation:I,narrationOperation:M,loadAssets:E,soundOperation:F,tickerOperation:R,videoOperation:v,setStorageValue:j,getLogichValue:n,getConditionalStep:P});}exports.PIXIVNJSON_PARAM_ID=y;exports.init=na;Object.keys(importer).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return importer[k]}})});Object.keys(translator).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return translator[k]}})});Object.keys(unifier).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return unifier[k]}})});
3
+ `+d),l=t(s.glueEnabled)||false,d)}),p=t(u[0]),x=typeof p=="object"&&"character"in p?p.character:void 0,V=u.flatMap(s=>{let m;s&&typeof s=="object"&&"text"in s?m=s.text:m=s;let d;return Array.isArray(m)?d=m.map(q=>{let Y=t(q);return translator.translator.t(`${Y}`)}):d=t(m)||"",translator.translator.t(d)}),z=n.find(s=>s.end),X=n.find(s=>s.choices),C=false,O=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),C=n[n.length-1].glueEnabled,O=n.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let W=n.find(s=>s.labelToOpen),w=[];return n.forEach(s=>{s.operations&&w.forEach(m=>{w.push(m);});}),{dialogue:x?{character:x,text:V}:V,end:z?.end,choices:X?.choices,glueEnabled:C,goNextStep:O,labelToOpen:W?.labelToOpen,operations:w}}}function ri(){unifier.JsonUnifier.init({animateOperation:M,canvasElementOperation:R,effectOperation:D,imageContainerOperation:A,imageOperation:I,textOperation:_,narrationOperation:F,loadAssets:E,soundOperation:$,tickerOperation:L,videoOperation:v,setStorageValue:U,getLogichValue:t,getConditionalStep:J});}exports.PIXIVNJSON_PARAM_ID=y;exports.init=ri;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.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from '@drincs/pixi-vn-json/importer';
2
2
  export * from '@drincs/pixi-vn-json/translator';
3
3
  export * from '@drincs/pixi-vn-json/unifier';
4
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
4
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
5
5
 
6
6
  declare const PIXIVNJSON_PARAM_ID = "___param___";
7
7
 
@@ -367,6 +367,14 @@ type PixiVNJsonCanvasImageContainerShow = {
367
367
  props?: ImageContainerOptions<ImageSprite>;
368
368
  transition?: PixiVNJsonMediaTransiotions;
369
369
  };
370
+ type PixiVNJsonCanvasTextShow = {
371
+ type: "text";
372
+ operationType: "show";
373
+ alias: string;
374
+ text: string;
375
+ props?: TextOptions;
376
+ transition?: PixiVNJsonMediaTransiotions;
377
+ };
370
378
  type PixiVNJsonImageEdit = {
371
379
  type: "image";
372
380
  operationType: "edit";
@@ -385,6 +393,12 @@ type PixiVNJsonImageContainerEdit = {
385
393
  alias: string;
386
394
  props?: Partial<ImageContainerMemory>;
387
395
  };
396
+ type PixiVNJsonTextEdit = {
397
+ type: "text";
398
+ operationType: "edit";
399
+ alias: string;
400
+ props?: Partial<TextMemory>;
401
+ };
388
402
  type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
389
403
  type: "canvaselement";
390
404
  operationType: "edit";
@@ -392,7 +406,7 @@ type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
392
406
  props?: Partial<T>;
393
407
  };
394
408
  type PixiVNJsonCanvasRemove = {
395
- type: "image" | "video" | "imagecontainer" | "canvaselement";
409
+ type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
396
410
  operationType: "remove";
397
411
  alias: string;
398
412
  transition?: PixiVNJsonMediaTransiotions;
@@ -407,8 +421,8 @@ type PixiVNJsonAssetsLoad = {
407
421
  operationType: "load" | "lazyload";
408
422
  aliases: string[];
409
423
  };
410
- type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow;
411
- type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory>;
424
+ type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
425
+ type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
412
426
  type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasTicker | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
413
427
 
414
428
  type PixiVNJsonInputRequest = {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from '@drincs/pixi-vn-json/importer';
2
2
  export * from '@drincs/pixi-vn-json/translator';
3
3
  export * from '@drincs/pixi-vn-json/unifier';
4
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
4
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
5
5
 
6
6
  declare const PIXIVNJSON_PARAM_ID = "___param___";
7
7
 
@@ -367,6 +367,14 @@ type PixiVNJsonCanvasImageContainerShow = {
367
367
  props?: ImageContainerOptions<ImageSprite>;
368
368
  transition?: PixiVNJsonMediaTransiotions;
369
369
  };
370
+ type PixiVNJsonCanvasTextShow = {
371
+ type: "text";
372
+ operationType: "show";
373
+ alias: string;
374
+ text: string;
375
+ props?: TextOptions;
376
+ transition?: PixiVNJsonMediaTransiotions;
377
+ };
370
378
  type PixiVNJsonImageEdit = {
371
379
  type: "image";
372
380
  operationType: "edit";
@@ -385,6 +393,12 @@ type PixiVNJsonImageContainerEdit = {
385
393
  alias: string;
386
394
  props?: Partial<ImageContainerMemory>;
387
395
  };
396
+ type PixiVNJsonTextEdit = {
397
+ type: "text";
398
+ operationType: "edit";
399
+ alias: string;
400
+ props?: Partial<TextMemory>;
401
+ };
388
402
  type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
389
403
  type: "canvaselement";
390
404
  operationType: "edit";
@@ -392,7 +406,7 @@ type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
392
406
  props?: Partial<T>;
393
407
  };
394
408
  type PixiVNJsonCanvasRemove = {
395
- type: "image" | "video" | "imagecontainer" | "canvaselement";
409
+ type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
396
410
  operationType: "remove";
397
411
  alias: string;
398
412
  transition?: PixiVNJsonMediaTransiotions;
@@ -407,8 +421,8 @@ type PixiVNJsonAssetsLoad = {
407
421
  operationType: "load" | "lazyload";
408
422
  aliases: string[];
409
423
  };
410
- type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow;
411
- type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory>;
424
+ type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
425
+ type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
412
426
  type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasTicker | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
413
427
 
414
428
  type PixiVNJsonInputRequest = {
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,ZoomTicker,RotateTicker,MoveTicker,FadeAlphaTicker,sound,Assets,narration as narration$1,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn';import {narration,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';var y="___param___";async function E(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 l;(t=>(t.log=(o,...u)=>console.log(`[Pixi\u2019VN Json] ${o}`,...u),t.warn=(o,...u)=>console.warn(`[Pixi\u2019VN Json] ${o}`,...u),t.error=(o,...u)=>console.error(`[Pixi\u2019VN Json] ${o}`,...u),t.info=(o,...u)=>console.info(`[Pixi\u2019VN Json] ${o}`,...u)))(l||(l={}));async function w(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 N(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 I(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageSprite(e.props,e.url||e.alias);await w(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}):l.error(`Image with alias ${e.alias} not found.`);break;case "remove":N(e);break}}async function v(e){switch(e.operationType){case "show":if(e.transition){let t=new VideoSprite(e.props,e.url||e.alias);await w(t,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}):l.error(`Video with alias ${e.alias} not found.`);break;case "remove":N(e);break;case "pause":let i=canvas.find(e.alias);i?i.paused=true:l.error(`Video with alias ${e.alias} not found.`);break;case "resume":let r=canvas.find(e.alias);r?r.paused=false:l.error(`Video with alias ${e.alias} not found.`);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageContainer(e.props,e.urls);await w(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}):l.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":N(e);break}}async function _(e){switch(e.operationType){case "edit":try{let a=canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):l.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){l.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":N(e);break}}function R(e){switch(e.type){case "fade":let a=new FadeAlphaTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,a);break;case "move":let i=new MoveTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,i);break;case "rotate":let r=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,r);break;case "zoom":let t=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,t);break}}async function L(e){switch(e.type){case "shake":await shakeEffect(e.alias,e.props,e.priority);break}}function D(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 M(e){switch(e.type){case "input":narration$1.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration$1.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 $(e){try{if(typeof e>"u")return e;let a=JSON.stringify(e);return JSON.parse(a)}catch(a){throw l.error("Error creating exportable element",e,a),new Error("[Pixi\u2019VN] Error creating exportable element")}}function j(e){let a=n(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=n(a):i=a,e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.setVariable(e.key,i);break;case "tempstorage":storage.setTempVariable(e.key,i);break;case "params":let r=storage.getVariable(`${y}${narration.openedLabels.length-1}`)||[];r&&r.length-1>=e.key&&(r[e.key]=i),storage.setTempVariable(`${y}${narration.openedLabels.length-1}`,r);break}}function n(e){let a=Ne(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return xe(a);case "arithmetic":case "arithmeticsingle":return Ve(a);case "compare":case "valueCondition":case "union":return ye(a)}return a}function Ve(e){let a=n(e.leftValue);switch(e.type){case "arithmetic":let i=n(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 xe(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.getVariable(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 n(e.operation);case "params":let a=storage.getVariable(`${y}${narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];l.warn("getValue params not found");return}return e}function ye(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=n(e.leftValue),i=n(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 !!n(e.value);case "union":return he(e)}return !!e}function he(e){if(e.unionType==="not")return !n(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=n(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function Te(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function Ne(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return be(e);case "ifelse":return n(e.condition)?n(e.then):n(e.else);case "stepswitch":let i=n(e.elements)||[];if(i.length===0){l.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let r=Te(0,i.length-1);return n(i[r]);case "loop":let t=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return t>i.length-1&&(t=t%i.length),n(i[t]);case "sequential":let o,u=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(o=n(i[i.length-1])),u>i.length-1?o:n(i[u]);case "sequentialrandom":let p=NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(p==null&&e.end=="lastItem"){let g=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!g||!g?.usedRandomNumbers){l.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let x=g.usedRandomNumbers[`0-${i.length-1}`];return n(i[x[x.length-1]])}if(p==null){l.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return n(i[p])}}return e}function P(e){if(e.conditionalStep){let a=$(n(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 P(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 be(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(t=>{if(Array.isArray(t))t.forEach(o=>{let u=n(o);i.push(u);});else {let o=n(t);i.push(o);}});let r=a?[a,...i]:i;if(r.length===0){l.warn("combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return translator$1.t(r);if(typeof r[0]=="object"){let t=r,o,u=t.map((s,m)=>{s=P(s);let c=n(s.dialogue)||"";return m===0?(o=n(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),o===false&&(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,ZoomTicker,RotateTicker,MoveTicker,FadeAlphaTicker,sound,Assets,narration as narration$1,Text,showText,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn';import {narration,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';var y="___param___";async function E(e){let i=JsonUnifier.getLogichValue(e);if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await Assets.load(i.aliases);break;case "lazyload":Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await Assets.loadBundle(i.aliases);break;case "lazyload":Assets.backgroundLoadBundle(i.aliases);break}break}}var r;(n=>(n.log=(l,...u)=>console.log(`[Pixi\u2019VN Json] ${l}`,...u),n.warn=(l,...u)=>console.warn(`[Pixi\u2019VN Json] ${l}`,...u),n.error=(l,...u)=>console.error(`[Pixi\u2019VN Json] ${l}`,...u),n.info=(l,...u)=>console.info(`[Pixi\u2019VN Json] ${l}`,...u)))(r||(r={}));async function b(e,i,a){switch(a.type){case "fade":await showWithFade(i.alias,e,a.props,a.priority);break;case "dissolve":await showWithDissolve(i.alias,e,a.props,a.priority);break;case "movein":case "moveout":await moveIn(i.alias,e,a.props,a.priority);break;case "zoomin":case "zoomout":await zoomIn(i.alias,e,a.props,a.priority);break;case "pushin":case "pushout":await pushIn(i.alias,e,a.props,a.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 I(e){switch(e.operationType){case "show":if(e.transition){let a=new ImageSprite(e.props,e.url||e.alias);await b(a,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Image with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function v(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 i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Video with alias ${e.alias} not found.`);break;case "remove":h(e);break;case "pause":let a=canvas.find(e.alias);a?a.paused=true:r.error(`Video with alias ${e.alias} not found.`);break;case "resume":let o=canvas.find(e.alias);o?o.paused=false:r.error(`Video with alias ${e.alias} not found.`);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let a=new ImageContainer(e.props,e.urls);await b(a,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function _(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=e.text,e.transition){let a=new Text(e.props);await b(a,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Text with alias ${e.alias} not found.`);break;case "remove":h(e);break}}async function R(e){switch(e.operationType){case "edit":try{let i=canvas.find(e.alias);i?e.props&&(i.memory={...i.memory,...e.props}):r.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){r.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":h(e);break}}function L(e){switch(e.type){case "fade":let i=new FadeAlphaTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,i);break;case "move":let a=new MoveTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,a);break;case "rotate":let o=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,o);break;case "zoom":let n=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,n);break}}async function D(e){switch(e.type){case "shake":await shakeEffect(e.alias,e.props,e.priority);break}}function M(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 F(e){switch(e.type){case "input":narration$1.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration$1.dialogue=void 0;break}}function $(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 i=JSON.stringify(e);return JSON.parse(i)}catch(i){throw r.error("Error creating exportable element",e,i),new Error("[Pixi\u2019VN] Error creating exportable element")}}function U(e){let i=t(e.value),a;switch(i&&typeof i=="object"&&"type"in i?a=t(i):a=i,e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.setVariable(e.key,a);break;case "tempstorage":storage.setTempVariable(e.key,a);break;case "params":let o=storage.getVariable(`${y}${narration.openedLabels.length-1}`)||[];o&&o.length-1>=e.key&&(o[e.key]=a),storage.setTempVariable(`${y}${narration.openedLabels.length-1}`,o);break}}function t(e){let i=Je(e);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return Te(i);case "arithmetic":case "arithmeticsingle":return he(i);case "compare":case "valueCondition":case "union":return Ne(i)}return i}function he(e){let i=t(e.leftValue);switch(e.type){case "arithmetic":let a=t(e.rightValue);switch(e.operator){case "*":return i*a;case "/":return i/a;case "+":return i+a;case "-":return i-a;case "%":return i%a;case "POW":return Math.pow(i,a);case "RANDOM":return narration.getRandomNumber(i,a)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(i);case "FLOOR":return Math.floor(i);case "FLOAT":return parseFloat(i)}break}}function Te(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.getVariable(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 i=storage.getVariable(`${y}${narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];r.warn("getValue params not found");return}return e}function Ne(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let i=t(e.leftValue),a=t(e.rightValue);switch(e.operator){case "==":return i===a;case "!=":return i!==a;case "<":return i<a;case "<=":return i<=a;case ">":return i>a;case ">=":return i>=a;case "CONTAINS":return i.toString().includes(a.toString())}break;case "valueCondition":return !!t(e.value);case "union":return be(e)}return !!e}function be(e){if(e.unionType==="not")return !t(e.condition);let i=e.unionType==="and";for(let a=0;a<e.conditions.length;a++)if(i=t(e.conditions[a])||false,e.unionType==="and"){if(!i)return false}else if(i)return true;return i}function Pe(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function Je(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return we(e);case "ifelse":return t(e.condition)?t(e.then):t(e.else);case "stepswitch":let a=t(e.elements)||[];if(a.length===0){r.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let o=Pe(0,a.length-1);return t(a[o]);case "loop":let n=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>a.length-1&&(n=n%a.length),t(a[n]);case "sequential":let l,u=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(l=t(a[a.length-1])),u>a.length-1?l:t(a[u]);case "sequentialrandom":let p=NarrationManagerStatic.getRandomNumber(0,a.length-1,{nestedId:e.nestedId,onceOnly:true});if(p==null&&e.end=="lastItem"){let x=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!x||!x?.usedRandomNumbers){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let V=x.usedRandomNumbers[`0-${a.length-1}`];return t(a[V[V.length-1]])}if(p==null){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return t(a[p])}}return e}function J(e){if(e.conditionalStep){let i=j(t(e.conditionalStep));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let a={...e,conditionalStep:void 0,...i};return J(a)}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 we(e){let i=e.firstItem,a=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(l=>{let u=t(l);a.push(u);});else {let l=t(n);a.push(l);}});let o=i?[i,...a]:a;if(o.length===0){r.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator$1.t(o);if(typeof o[0]=="object"){let n=o,l,u=n.map((s,m)=>{s=J(s);let d=t(s.dialogue)||"";return m===0?(l=t(s.glueEnabled)||false,d):(typeof d=="object"&&"text"in d&&(d=d.character+": "+d.text),l===false&&(d=`
2
2
 
3
- `+c),o=n(s.glueEnabled)||false,c)}),p=n(u[0]),g=typeof p=="object"&&"character"in p?p.character:void 0,x=u.flatMap(s=>{let m;s&&typeof s=="object"&&"text"in s?m=s.text:m=s;let c;return Array.isArray(m)?c=m.map(W=>{let q=n(W);return translator$1.t(`${q}`)}):c=n(m)||"",translator$1.t(c)}),U=t.find(s=>s.end),z=t.find(s=>s.choices),C=false,O=false;t.length>0&&(t[0].glueEnabled&&t[0].goNextStep&&t[0].dialogue===void 0&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),C=t[t.length-1].glueEnabled,O=t.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let X=t.find(s=>s.labelToOpen),J=[];return t.forEach(s=>{s.operations&&J.forEach(m=>{J.push(m);});}),{dialogue:g?{character:g,text:x}:x,end:U?.end,choices:z?.choices,glueEnabled:C,goNextStep:O,labelToOpen:X?.labelToOpen,operations:J}}}function na(){JsonUnifier.init({animateOperation:D,canvasElementOperation:_,effectOperation:L,imageContainerOperation:A,imageOperation:I,narrationOperation:M,loadAssets:E,soundOperation:F,tickerOperation:R,videoOperation:v,setStorageValue:j,getLogichValue:n,getConditionalStep:P});}export{y as PIXIVNJSON_PARAM_ID,na as init};
3
+ `+d),l=t(s.glueEnabled)||false,d)}),p=t(u[0]),x=typeof p=="object"&&"character"in p?p.character:void 0,V=u.flatMap(s=>{let m;s&&typeof s=="object"&&"text"in s?m=s.text:m=s;let d;return Array.isArray(m)?d=m.map(q=>{let Y=t(q);return translator$1.t(`${Y}`)}):d=t(m)||"",translator$1.t(d)}),z=n.find(s=>s.end),X=n.find(s=>s.choices),C=false,O=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),C=n[n.length-1].glueEnabled,O=n.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let W=n.find(s=>s.labelToOpen),w=[];return n.forEach(s=>{s.operations&&w.forEach(m=>{w.push(m);});}),{dialogue:x?{character:x,text:V}:V,end:z?.end,choices:X?.choices,glueEnabled:C,goNextStep:O,labelToOpen:W?.labelToOpen,operations:w}}}function ri(){JsonUnifier.init({animateOperation:M,canvasElementOperation:R,effectOperation:D,imageContainerOperation:A,imageOperation:I,textOperation:_,narrationOperation:F,loadAssets:E,soundOperation:$,tickerOperation:L,videoOperation:v,setStorageValue:U,getLogichValue:t,getConditionalStep:J});}export{y as PIXIVNJSON_PARAM_ID,ri as init};
@@ -1,4 +1,4 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
2
2
 
3
3
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
4
4
  type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
@@ -362,6 +362,14 @@ type PixiVNJsonCanvasImageContainerShow = {
362
362
  props?: ImageContainerOptions<ImageSprite>;
363
363
  transition?: PixiVNJsonMediaTransiotions;
364
364
  };
365
+ type PixiVNJsonCanvasTextShow = {
366
+ type: "text";
367
+ operationType: "show";
368
+ alias: string;
369
+ text: string;
370
+ props?: TextOptions;
371
+ transition?: PixiVNJsonMediaTransiotions;
372
+ };
365
373
  type PixiVNJsonImageEdit = {
366
374
  type: "image";
367
375
  operationType: "edit";
@@ -380,6 +388,12 @@ type PixiVNJsonImageContainerEdit = {
380
388
  alias: string;
381
389
  props?: Partial<ImageContainerMemory>;
382
390
  };
391
+ type PixiVNJsonTextEdit = {
392
+ type: "text";
393
+ operationType: "edit";
394
+ alias: string;
395
+ props?: Partial<TextMemory>;
396
+ };
383
397
  type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
384
398
  type: "canvaselement";
385
399
  operationType: "edit";
@@ -387,7 +401,7 @@ type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
387
401
  props?: Partial<T>;
388
402
  };
389
403
  type PixiVNJsonCanvasRemove = {
390
- type: "image" | "video" | "imagecontainer" | "canvaselement";
404
+ type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
391
405
  operationType: "remove";
392
406
  alias: string;
393
407
  transition?: PixiVNJsonMediaTransiotions;
@@ -402,8 +416,8 @@ type PixiVNJsonAssetsLoad = {
402
416
  operationType: "load" | "lazyload";
403
417
  aliases: string[];
404
418
  };
405
- type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow;
406
- type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory>;
419
+ type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
420
+ type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
407
421
  type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasTicker | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
408
422
 
409
423
  type PixiVNJsonInputRequest = {
@@ -1,4 +1,4 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
2
2
 
3
3
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
4
4
  type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
@@ -362,6 +362,14 @@ type PixiVNJsonCanvasImageContainerShow = {
362
362
  props?: ImageContainerOptions<ImageSprite>;
363
363
  transition?: PixiVNJsonMediaTransiotions;
364
364
  };
365
+ type PixiVNJsonCanvasTextShow = {
366
+ type: "text";
367
+ operationType: "show";
368
+ alias: string;
369
+ text: string;
370
+ props?: TextOptions;
371
+ transition?: PixiVNJsonMediaTransiotions;
372
+ };
365
373
  type PixiVNJsonImageEdit = {
366
374
  type: "image";
367
375
  operationType: "edit";
@@ -380,6 +388,12 @@ type PixiVNJsonImageContainerEdit = {
380
388
  alias: string;
381
389
  props?: Partial<ImageContainerMemory>;
382
390
  };
391
+ type PixiVNJsonTextEdit = {
392
+ type: "text";
393
+ operationType: "edit";
394
+ alias: string;
395
+ props?: Partial<TextMemory>;
396
+ };
383
397
  type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
384
398
  type: "canvaselement";
385
399
  operationType: "edit";
@@ -387,7 +401,7 @@ type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
387
401
  props?: Partial<T>;
388
402
  };
389
403
  type PixiVNJsonCanvasRemove = {
390
- type: "image" | "video" | "imagecontainer" | "canvaselement";
404
+ type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
391
405
  operationType: "remove";
392
406
  alias: string;
393
407
  transition?: PixiVNJsonMediaTransiotions;
@@ -402,8 +416,8 @@ type PixiVNJsonAssetsLoad = {
402
416
  operationType: "load" | "lazyload";
403
417
  aliases: string[];
404
418
  };
405
- type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow;
406
- type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory>;
419
+ type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
420
+ type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
407
421
  type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasTicker | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
408
422
 
409
423
  type PixiVNJsonInputRequest = {
package/dist/unifier.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var P=Object.defineProperty;var V=(a,e,s)=>e in a?P(a,e,{enumerable:true,configurable:true,writable:true,value:s}):a[e]=s;var o=(a,e,s)=>V(a,typeof e!="symbol"?e+"":e,s);var t;(c=>(c.log=(n,...r)=>console.log(`[Pixi\u2019VN Json] ${n}`,...r),c.warn=(n,...r)=>console.warn(`[Pixi\u2019VN Json] ${n}`,...r),c.error=(n,...r)=>console.error(`[Pixi\u2019VN Json] ${n}`,...r),c.info=(n,...r)=>console.info(`[Pixi\u2019VN Json] ${n}`,...r)))(t||(t={}));var i=class i{static init(e){i._loadAssets=e.loadAssets,i._soundOperation=e.soundOperation,i._imageOperation=e.imageOperation,i._videoOperation=e.videoOperation,i._imageContainerOperation=e.imageContainerOperation,i._canvasElementOperation=e.canvasElementOperation,i._setStorageValue=e.setStorageValue,i._narrationOperation=e.narrationOperation,i._tickerOperation=e.tickerOperation,i._effectOperation=e.effectOperation,i._animateOperation=e.animateOperation,i._getLogichValue=e.getLogichValue,i._getConditionalStep=e.getConditionalStep;}static get loadAssets(){return i._loadAssets}static get soundOperation(){return i._soundOperation}static get imageOperation(){return i._imageOperation}static get videoOperation(){return i._videoOperation}static get imageContainerOperation(){return i._imageContainerOperation}static get canvasElementOperation(){return i._canvasElementOperation}static get setStorageValue(){return i._setStorageValue}static get narrationOperation(){return i._narrationOperation}static get tickerOperation(){return i._tickerOperation}static get effectOperation(){return i._effectOperation}static get animateOperation(){return i._animateOperation}static get getLogichValue(){return i._getLogichValue}static get getConditionalStep(){return i._getConditionalStep}};o(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_tickerOperation",()=>{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(i,"_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(i,"_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(i,"_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(i,"_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=i;exports.JsonUnifier=p;
1
+ 'use strict';var x=Object.defineProperty;var P=(a,e,s)=>e in a?x(a,e,{enumerable:true,configurable:true,writable:true,value:s}):a[e]=s;var o=(a,e,s)=>P(a,typeof e!="symbol"?e+"":e,s);var t;(c=>(c.log=(n,...r)=>console.log(`[Pixi\u2019VN Json] ${n}`,...r),c.warn=(n,...r)=>console.warn(`[Pixi\u2019VN Json] ${n}`,...r),c.error=(n,...r)=>console.error(`[Pixi\u2019VN Json] ${n}`,...r),c.info=(n,...r)=>console.info(`[Pixi\u2019VN Json] ${n}`,...r)))(t||(t={}));var i=class i{static init(e){i._loadAssets=e.loadAssets,i._soundOperation=e.soundOperation,i._imageOperation=e.imageOperation,i._videoOperation=e.videoOperation,i._imageContainerOperation=e.imageContainerOperation,i._textOperation=e.textOperation,i._canvasElementOperation=e.canvasElementOperation,i._setStorageValue=e.setStorageValue,i._narrationOperation=e.narrationOperation,i._tickerOperation=e.tickerOperation,i._effectOperation=e.effectOperation,i._animateOperation=e.animateOperation,i._getLogichValue=e.getLogichValue,i._getConditionalStep=e.getConditionalStep;}static get loadAssets(){return i._loadAssets}static get soundOperation(){return i._soundOperation}static get imageOperation(){return i._imageOperation}static get videoOperation(){return i._videoOperation}static get textOperation(){return i._textOperation}static get imageContainerOperation(){return i._imageContainerOperation}static get canvasElementOperation(){return i._canvasElementOperation}static get setStorageValue(){return i._setStorageValue}static get narrationOperation(){return i._narrationOperation}static get tickerOperation(){return i._tickerOperation}static get effectOperation(){return i._effectOperation}static get animateOperation(){return i._animateOperation}static get getLogichValue(){return i._getLogichValue}static get getConditionalStep(){return i._getConditionalStep}};o(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_tickerOperation",()=>{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(i,"_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(i,"_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(i,"_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(i,"_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=i;exports.JsonUnifier=p;
@@ -1,4 +1,4 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType, ContainerChild } from '@drincs/pixi-vn';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType, ContainerChild } from '@drincs/pixi-vn';
2
2
 
3
3
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
4
4
  type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
@@ -362,6 +362,14 @@ type PixiVNJsonCanvasImageContainerShow = {
362
362
  props?: ImageContainerOptions<ImageSprite>;
363
363
  transition?: PixiVNJsonMediaTransiotions;
364
364
  };
365
+ type PixiVNJsonCanvasTextShow = {
366
+ type: "text";
367
+ operationType: "show";
368
+ alias: string;
369
+ text: string;
370
+ props?: TextOptions;
371
+ transition?: PixiVNJsonMediaTransiotions;
372
+ };
365
373
  type PixiVNJsonImageEdit = {
366
374
  type: "image";
367
375
  operationType: "edit";
@@ -380,6 +388,12 @@ type PixiVNJsonImageContainerEdit = {
380
388
  alias: string;
381
389
  props?: Partial<ImageContainerMemory>;
382
390
  };
391
+ type PixiVNJsonTextEdit = {
392
+ type: "text";
393
+ operationType: "edit";
394
+ alias: string;
395
+ props?: Partial<TextMemory>;
396
+ };
383
397
  type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
384
398
  type: "canvaselement";
385
399
  operationType: "edit";
@@ -387,7 +401,7 @@ type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
387
401
  props?: Partial<T>;
388
402
  };
389
403
  type PixiVNJsonCanvasRemove = {
390
- type: "image" | "video" | "imagecontainer" | "canvaselement";
404
+ type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
391
405
  operationType: "remove";
392
406
  alias: string;
393
407
  transition?: PixiVNJsonMediaTransiotions;
@@ -402,8 +416,8 @@ type PixiVNJsonAssetsLoad = {
402
416
  operationType: "load" | "lazyload";
403
417
  aliases: string[];
404
418
  };
405
- type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow;
406
- type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory>;
419
+ type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
420
+ type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
407
421
  type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasTicker | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
408
422
 
409
423
  type PixiVNJsonInputRequest = {
@@ -558,6 +572,7 @@ declare class JsonUnifier {
558
572
  imageOperation: (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonImageEdit | PixiVNJsonCanvasRemove) => Promise<void>;
559
573
  videoOperation: (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasRemove | PixiVNJsonVideoEdit | PixiVNJsonVideoPauseResume) => Promise<void>;
560
574
  imageContainerOperation: (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasImageContainerShow | PixiVNJsonImageContainerEdit) => Promise<void>;
575
+ textOperation: (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasTextShow | PixiVNJsonTextEdit) => Promise<void>;
561
576
  canvasElementOperation: (operation: PixiVNJsonCanvasRemove | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory<ContainerChild>>) => Promise<void>;
562
577
  setStorageValue: (value: PixiVNJsonValueSet) => void;
563
578
  narrationOperation: (operation: PixiVNJsonNarration) => void;
@@ -576,6 +591,8 @@ declare class JsonUnifier {
576
591
  private static _videoOperation;
577
592
  static get videoOperation(): (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasRemove | PixiVNJsonVideoEdit | PixiVNJsonVideoPauseResume) => Promise<void>;
578
593
  private static _imageContainerOperation;
594
+ static get textOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasTextShow | PixiVNJsonTextEdit) => Promise<void>;
595
+ private static _textOperation;
579
596
  static get imageContainerOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasImageContainerShow | PixiVNJsonImageContainerEdit) => Promise<void>;
580
597
  private static _canvasElementOperation;
581
598
  static get canvasElementOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory<ContainerChild>>) => Promise<void>;
package/dist/unifier.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType, ContainerChild } from '@drincs/pixi-vn';
1
+ import { StorageElementType, CanvasBaseInterface, ImageSprite, KeyframesType, AnimationOptions, UPDATE_PRIORITY, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions, ShakeEffectProps, FadeAlphaTickerProps, MoveTickerProps, RotateTickerProps, ZoomTickerProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptions, LabelRunModeType, StorageObjectType, StepLabelPropsType, ContainerChild } from '@drincs/pixi-vn';
2
2
 
3
3
  type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
4
4
  type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
@@ -362,6 +362,14 @@ type PixiVNJsonCanvasImageContainerShow = {
362
362
  props?: ImageContainerOptions<ImageSprite>;
363
363
  transition?: PixiVNJsonMediaTransiotions;
364
364
  };
365
+ type PixiVNJsonCanvasTextShow = {
366
+ type: "text";
367
+ operationType: "show";
368
+ alias: string;
369
+ text: string;
370
+ props?: TextOptions;
371
+ transition?: PixiVNJsonMediaTransiotions;
372
+ };
365
373
  type PixiVNJsonImageEdit = {
366
374
  type: "image";
367
375
  operationType: "edit";
@@ -380,6 +388,12 @@ type PixiVNJsonImageContainerEdit = {
380
388
  alias: string;
381
389
  props?: Partial<ImageContainerMemory>;
382
390
  };
391
+ type PixiVNJsonTextEdit = {
392
+ type: "text";
393
+ operationType: "edit";
394
+ alias: string;
395
+ props?: Partial<TextMemory>;
396
+ };
383
397
  type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
384
398
  type: "canvaselement";
385
399
  operationType: "edit";
@@ -387,7 +401,7 @@ type PixiVNJsonUnknownEdit<T extends ContainerOptions> = {
387
401
  props?: Partial<T>;
388
402
  };
389
403
  type PixiVNJsonCanvasRemove = {
390
- type: "image" | "video" | "imagecontainer" | "canvaselement";
404
+ type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
391
405
  operationType: "remove";
392
406
  alias: string;
393
407
  transition?: PixiVNJsonMediaTransiotions;
@@ -402,8 +416,8 @@ type PixiVNJsonAssetsLoad = {
402
416
  operationType: "load" | "lazyload";
403
417
  aliases: string[];
404
418
  };
405
- type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow;
406
- type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory>;
419
+ type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
420
+ type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
407
421
  type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasTicker | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
408
422
 
409
423
  type PixiVNJsonInputRequest = {
@@ -558,6 +572,7 @@ declare class JsonUnifier {
558
572
  imageOperation: (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonImageEdit | PixiVNJsonCanvasRemove) => Promise<void>;
559
573
  videoOperation: (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasRemove | PixiVNJsonVideoEdit | PixiVNJsonVideoPauseResume) => Promise<void>;
560
574
  imageContainerOperation: (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasImageContainerShow | PixiVNJsonImageContainerEdit) => Promise<void>;
575
+ textOperation: (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasTextShow | PixiVNJsonTextEdit) => Promise<void>;
561
576
  canvasElementOperation: (operation: PixiVNJsonCanvasRemove | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory<ContainerChild>>) => Promise<void>;
562
577
  setStorageValue: (value: PixiVNJsonValueSet) => void;
563
578
  narrationOperation: (operation: PixiVNJsonNarration) => void;
@@ -576,6 +591,8 @@ declare class JsonUnifier {
576
591
  private static _videoOperation;
577
592
  static get videoOperation(): (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasRemove | PixiVNJsonVideoEdit | PixiVNJsonVideoPauseResume) => Promise<void>;
578
593
  private static _imageContainerOperation;
594
+ static get textOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasTextShow | PixiVNJsonTextEdit) => Promise<void>;
595
+ private static _textOperation;
579
596
  static get imageContainerOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasImageContainerShow | PixiVNJsonImageContainerEdit) => Promise<void>;
580
597
  private static _canvasElementOperation;
581
598
  static get canvasElementOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory<ContainerChild>>) => Promise<void>;
package/dist/unifier.mjs CHANGED
@@ -1 +1 @@
1
- var P=Object.defineProperty;var V=(a,e,s)=>e in a?P(a,e,{enumerable:true,configurable:true,writable:true,value:s}):a[e]=s;var o=(a,e,s)=>V(a,typeof e!="symbol"?e+"":e,s);var t;(c=>(c.log=(n,...r)=>console.log(`[Pixi\u2019VN Json] ${n}`,...r),c.warn=(n,...r)=>console.warn(`[Pixi\u2019VN Json] ${n}`,...r),c.error=(n,...r)=>console.error(`[Pixi\u2019VN Json] ${n}`,...r),c.info=(n,...r)=>console.info(`[Pixi\u2019VN Json] ${n}`,...r)))(t||(t={}));var i=class i{static init(e){i._loadAssets=e.loadAssets,i._soundOperation=e.soundOperation,i._imageOperation=e.imageOperation,i._videoOperation=e.videoOperation,i._imageContainerOperation=e.imageContainerOperation,i._canvasElementOperation=e.canvasElementOperation,i._setStorageValue=e.setStorageValue,i._narrationOperation=e.narrationOperation,i._tickerOperation=e.tickerOperation,i._effectOperation=e.effectOperation,i._animateOperation=e.animateOperation,i._getLogichValue=e.getLogichValue,i._getConditionalStep=e.getConditionalStep;}static get loadAssets(){return i._loadAssets}static get soundOperation(){return i._soundOperation}static get imageOperation(){return i._imageOperation}static get videoOperation(){return i._videoOperation}static get imageContainerOperation(){return i._imageContainerOperation}static get canvasElementOperation(){return i._canvasElementOperation}static get setStorageValue(){return i._setStorageValue}static get narrationOperation(){return i._narrationOperation}static get tickerOperation(){return i._tickerOperation}static get effectOperation(){return i._effectOperation}static get animateOperation(){return i._animateOperation}static get getLogichValue(){return i._getLogichValue}static get getConditionalStep(){return i._getConditionalStep}};o(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_tickerOperation",()=>{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(i,"_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(i,"_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(i,"_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(i,"_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=i;export{p as JsonUnifier};
1
+ var x=Object.defineProperty;var P=(a,e,s)=>e in a?x(a,e,{enumerable:true,configurable:true,writable:true,value:s}):a[e]=s;var o=(a,e,s)=>P(a,typeof e!="symbol"?e+"":e,s);var t;(c=>(c.log=(n,...r)=>console.log(`[Pixi\u2019VN Json] ${n}`,...r),c.warn=(n,...r)=>console.warn(`[Pixi\u2019VN Json] ${n}`,...r),c.error=(n,...r)=>console.error(`[Pixi\u2019VN Json] ${n}`,...r),c.info=(n,...r)=>console.info(`[Pixi\u2019VN Json] ${n}`,...r)))(t||(t={}));var i=class i{static init(e){i._loadAssets=e.loadAssets,i._soundOperation=e.soundOperation,i._imageOperation=e.imageOperation,i._videoOperation=e.videoOperation,i._imageContainerOperation=e.imageContainerOperation,i._textOperation=e.textOperation,i._canvasElementOperation=e.canvasElementOperation,i._setStorageValue=e.setStorageValue,i._narrationOperation=e.narrationOperation,i._tickerOperation=e.tickerOperation,i._effectOperation=e.effectOperation,i._animateOperation=e.animateOperation,i._getLogichValue=e.getLogichValue,i._getConditionalStep=e.getConditionalStep;}static get loadAssets(){return i._loadAssets}static get soundOperation(){return i._soundOperation}static get imageOperation(){return i._imageOperation}static get videoOperation(){return i._videoOperation}static get textOperation(){return i._textOperation}static get imageContainerOperation(){return i._imageContainerOperation}static get canvasElementOperation(){return i._canvasElementOperation}static get setStorageValue(){return i._setStorageValue}static get narrationOperation(){return i._narrationOperation}static get tickerOperation(){return i._tickerOperation}static get effectOperation(){return i._effectOperation}static get animateOperation(){return i._animateOperation}static get getLogichValue(){return i._getLogichValue}static get getConditionalStep(){return i._getConditionalStep}};o(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_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(i,"_tickerOperation",()=>{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(i,"_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(i,"_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(i,"_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(i,"_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=i;export{p as JsonUnifier};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn-json",
3
- "version": "1.7.9",
3
+ "version": "1.8.0",
4
4
  "type": "module",
5
5
  "description": "Pixi'VN can be integrated with JSON files to create a visual novel.",
6
6
  "main": "./dist/index.cjs",
@@ -64,13 +64,13 @@
64
64
  "devDependencies": {
65
65
  "@types/crypto-js": "^4.2.2",
66
66
  "crypto-js": "^4.2.0",
67
- "jsdom": "^26.1.0",
67
+ "jsdom": "^27.0.0",
68
68
  "ts-node": "^10.9.2",
69
69
  "tsup": "^8.5.0",
70
- "typescript": "^5.9.2"
70
+ "typescript": "^5.9.3"
71
71
  },
72
72
  "peerDependencies": {
73
- "@drincs/pixi-vn": ">=1.3.19"
73
+ "@drincs/pixi-vn": ">=1.3.31"
74
74
  },
75
75
  "keywords": [
76
76
  "game",