@drincs/pixi-vn-json 1.7.7 → 1.7.9
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 +1 -1
- package/dist/importer.d.cts +3 -3
- package/dist/importer.d.ts +3 -3
- package/dist/importer.mjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/translator.d.cts +2 -2
- package/dist/translator.d.ts +2 -2
- package/dist/unifier.d.cts +2 -2
- package/dist/unifier.d.ts +2 -2
- package/package.json +1 -1
package/dist/importer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage'),unifier=require('@drincs/pixi-vn-json/unifier'),translator=require('@drincs/pixi-vn-json/translator');var K=Object.create;var I=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?I(a,n,{enumerable:true,configurable:true,writable:true,value:t}):a[n]=t;var R=(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&&I(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(I(t,"default",{value:a,enumerable:true}),a));var E=(a,n,t)=>ie(a,typeof n!="symbol"?n+"":n,t);var F=W((A,U)=>{(function(a,n){typeof A=="object"?U.exports=A=n():typeof define=="function"&&define.amd?define([],n):a.CryptoJS=n();})(A,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 R=="function")try{o=R("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.")},c=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={},g=u.Base=(function(){return {extend:function(e){var i=c(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=g.extend({init:function(e,i){e=this.words=e||[],i!=t?this.sigBytes=i:this.sigBytes=e.length*4;},toString:function(e){return (e||x).stringify(this)},concat:function(e){var i=this.words,p=e.words,f=this.sigBytes,S=e.sigBytes;if(this.clamp(),f%4)for(var V=0;V<S;V++){var k=p[V>>>2]>>>24-V%4*8&255;i[f+V>>>2]|=k<<24-(f+V)%4*8;}else for(var _=0;_<S;_+=4)i[f+_>>>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=g.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)}}),l=s.enc={},x=l.Hex={stringify:function(e){for(var i=e.words,p=e.sigBytes,f=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;f.push((V>>>4).toString(16)),f.push((V&15).toString(16));}return f.join("")},parse:function(e){for(var i=e.length,p=[],f=0;f<i;f+=2)p[f>>>3]|=parseInt(e.substr(f,2),16)<<24-f%8*4;return new y.init(p,i/2)}},b=l.Latin1={stringify:function(e){for(var i=e.words,p=e.sigBytes,f=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;f.push(String.fromCharCode(V));}return f.join("")},parse:function(e){for(var i=e.length,p=[],f=0;f<i;f++)p[f>>>2]|=(e.charCodeAt(f)&255)<<24-f%4*8;return new y.init(p,i)}},P=l.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)))}},h=u.BufferedBlockAlgorithm=g.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,f=p.words,S=p.sigBytes,V=this.blockSize,k=V*4,_=S/k;e?_=n.ceil(_):_=n.max((_|0)-this._minBufferSize,0);var C=_*V,z=n.min(C*4,S);if(C){for(var H=0;H<C;H+=V)this._doProcessBlock(f,H);i=f.splice(0,C),p.sigBytes-=z;}return new y.init(i,z)},clone:function(){var e=g.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=h.extend({cfg:g.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){h.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 m.HMAC.init(e,p).finalize(i)}}});var m=s.algo={};return s})(Math);return a});});var M=W((B,G)=>{(function(a,n){typeof B=="object"?G.exports=B=n(F()):typeof define=="function"&&define.amd?define(["./core"],n):n(a.CryptoJS);})(B,function(a){return (function(){var n=a,t=n.lib,o=t.WordArray,r=t.Hasher,c=n.algo,s=[],u=c.SHA1=r.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,y){for(var l=this._hash.words,x=l[0],b=l[1],P=l[2],h=l[3],d=l[4],m=0;m<80;m++){if(m<16)s[m]=g[y+m]|0;else {var e=s[m-3]^s[m-8]^s[m-14]^s[m-16];s[m]=e<<1|e>>>31;}var i=(x<<5|x>>>27)+d+s[m];m<20?i+=(b&P|~b&h)+1518500249:m<40?i+=(b^P^h)+1859775393:m<60?i+=(b&P|b&h|P&h)-1894007588:i+=(b^P^h)-899497514,d=h,h=P,P=b<<30|b>>>2,b=x,x=i;}l[0]=l[0]+x|0,l[1]=l[1]+b|0,l[2]=l[2]+P|0,l[3]=l[3]+h|0,l[4]=l[4]+d|0;},_doFinalize:function(){var g=this._data,y=g.words,l=this._nDataBytes*8,x=g.sigBytes*8;return y[x>>>5]|=128<<24-x%32,y[(x+64>>>9<<4)+14]=Math.floor(l/4294967296),y[(x+64>>>9<<4)+15]=l,g.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var g=r.clone.call(this);return g._hash=this._hash.clone(),g}});n.SHA1=r._createHelper(u),n.HmacSHA1=r._createHmacHelper(u);})(),a.SHA1});});var L;(r=>(r.log=(c,...s)=>console.log(`[Pixi\u2019VN Json] ${c}`,...s),r.warn=(c,...s)=>console.warn(`[Pixi\u2019VN Json] ${c}`,...s),r.error=(c,...s)=>console.error(`[Pixi\u2019VN Json] ${c}`,...s),r.info=(c,...s)=>console.info(`[Pixi\u2019VN Json] ${c}`,...s)))(L||(L={}));async function T(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(c=>{if(typeof c=="string")o+=c;else {let s=unifier.JsonUnifier.getLogichValue(c);o+=`${s}`;}});let r=await n(o);r&&await T(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}}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(g){L.error("Error parsing imported Pixi'VN JSON",g),u={};}return u}),s=(await Promise.all(r)).map(async u=>{let g=[];if(u.initialOperations){u.initialOperations.forEach(l=>{let x=T(l,t?b=>t(b,{},{}):void 0);g.push(x);});let y={};[...storage.storage.storage.keys()].forEach((l,x)=>{y[l]=storage.storage.storage.get(l);}),storage.storage.startingStorage=y;}if(u.labels){let y=u.labels;for(let l in y)try{let x=y[l],b=new w(l,x,void 0,n);narration.RegisteredLabels.add(b);}catch(x){L.error(`Error creating JSON label ${l}`,x);}}return Promise.all(g)});await Promise.all(s);}var Y=ne(M());var j="___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")}}var w=class extends narration.LabelAbstract{constructor(t,o,r,c={}){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 g=u.operations.map(y=>unifier.JsonUnifier.loadAssets(y));await Promise.all(g);}}};super(t,r);E(this,"_steps");E(this,"operationStringConvert");E(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=c.operationStringConvert,this.skipEmptyDialogs=c.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(c=>{if(typeof c=="string")r.push(c);else if(c&&typeof c=="object"){let s=unifier.JsonUnifier.getLogichValue(c);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(`${c}`);}}),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(c=>unifier.JsonUnifier.getLogichValue(c)).filter(c=>c!==void 0)}stepConverter(t){return async o=>{let r=typeof t=="function"?t():t;r=X(r),r=unifier.JsonUnifier.getConditionalStep(r);let c=this.operationStringConvert?h=>this.operationStringConvert(h,r,o):void 0,{operations:s=[]}=r;for(let h of s)await T(h,c);let{labelToOpen:u=[]}=r,g=this.getChoices(r.choices),y=unifier.JsonUnifier.getLogichValue(r.glueEnabled),l=this.getDialogue(r.dialogue),x=[];Array.isArray(u)||(u=[u]),u.forEach(h=>{let d=unifier.JsonUnifier.getLogichValue(h);d&&x.push(d);});let b=unifier.JsonUnifier.getLogichValue(r.goNextStep),P=unifier.JsonUnifier.getLogichValue(r.end);if(g){let h=g.map(d=>{let m="";if(Array.isArray(d.text)){let i=[];d.text.forEach(p=>{if(typeof p=="string")i.push(translator.translator.t(p));else if(p&&typeof p=="object"){let f=unifier.JsonUnifier.getLogichValue(p);f&&!Array.isArray(f)&&typeof f=="object"&&(f=unifier.JsonUnifier.getLogichValue(f)||""),f&&(Array.isArray(f)?i=i.concat(translator.translator.t(f)):i.push(translator.translator.t(f)));}}),m=i;}else typeof d.text=="string"&&(m=translator.translator.t(d.text));return {label:d.label,text:m,props:d.props,type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect}});narration.narration.choiceMenuOptions=h;}else narration.narration.choiceMenuOptions=void 0;l!==void 0&&(narration.narration.dialogue=l,this.skipEmptyDialogs&&typeof l=="string"&&(l===""||RegExp(/^\s+$/).test(l))&&(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 h of x){let d=h.label;typeof d=="object"&&(d=unifier.JsonUnifier.getLogichValue(d)||"");let m=h.params?.map(e=>unifier.JsonUnifier.getLogichValue(e));o={...o,...h.props},h.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${j}${narration.narration.openedLabels.length}`,m),await narration.narration.callLabel(d,o)):(storage.storage.setTempVariable(`${j}${narration.narration.openedLabels.length}`,m),await narration.narration.callLabel(d,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)}},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;
|
package/dist/importer.d.cts
CHANGED
|
@@ -58,6 +58,8 @@ type PixiVNJsonConditionalResultToCombine<T> = {
|
|
|
58
58
|
secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
62
|
+
|
|
61
63
|
type PixiVNJsonStorageGet = {
|
|
62
64
|
type: "value";
|
|
63
65
|
storageOperationType: "get";
|
|
@@ -245,8 +247,6 @@ interface PixiVNJsonIfElse<Then> {
|
|
|
245
247
|
else?: Then | PixiVNJsonIfElse<Then>;
|
|
246
248
|
}
|
|
247
249
|
|
|
248
|
-
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
249
|
-
|
|
250
250
|
type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
|
|
251
251
|
type: "animate";
|
|
252
252
|
alias: string | string[];
|
|
@@ -568,7 +568,7 @@ interface PixiVNJson {
|
|
|
568
568
|
* For the set storage: They will be set only if there are no variables with the same key already.
|
|
569
569
|
* For the det tempstorage: if there are variables with the same key already, they will be overwritten.
|
|
570
570
|
*/
|
|
571
|
-
initialOperations?:
|
|
571
|
+
initialOperations?: (PixiVNJsonValueSet | PixiVNJsonIfElse<PixiVNJsonValueSet>)[];
|
|
572
572
|
/**
|
|
573
573
|
* The labels to be used in the narrative. They will be added to the system
|
|
574
574
|
*/
|
package/dist/importer.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ type PixiVNJsonConditionalResultToCombine<T> = {
|
|
|
58
58
|
secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
62
|
+
|
|
61
63
|
type PixiVNJsonStorageGet = {
|
|
62
64
|
type: "value";
|
|
63
65
|
storageOperationType: "get";
|
|
@@ -245,8 +247,6 @@ interface PixiVNJsonIfElse<Then> {
|
|
|
245
247
|
else?: Then | PixiVNJsonIfElse<Then>;
|
|
246
248
|
}
|
|
247
249
|
|
|
248
|
-
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
249
|
-
|
|
250
250
|
type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
|
|
251
251
|
type: "animate";
|
|
252
252
|
alias: string | string[];
|
|
@@ -568,7 +568,7 @@ interface PixiVNJson {
|
|
|
568
568
|
* For the set storage: They will be set only if there are no variables with the same key already.
|
|
569
569
|
* For the det tempstorage: if there are variables with the same key already, they will be overwritten.
|
|
570
570
|
*/
|
|
571
|
-
initialOperations?:
|
|
571
|
+
initialOperations?: (PixiVNJsonValueSet | PixiVNJsonIfElse<PixiVNJsonValueSet>)[];
|
|
572
572
|
/**
|
|
573
573
|
* The labels to be used in the narrative. They will be added to the system
|
|
574
574
|
*/
|
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 {JsonUnifier}from'@drincs/pixi-vn-json/unifier';import {translator}from'@drincs/pixi-vn-json/translator';var K=Object.create;var I=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?I(a,n,{enumerable:true,configurable:true,writable:true,value:t}):a[n]=t;var R=(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&&I(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(I(t,"default",{value:a,enumerable:true}),a));var E=(a,n,t)=>ie(a,typeof n!="symbol"?n+"":n,t);var F=W((A,U)=>{(function(a,n){typeof A=="object"?U.exports=A=n():typeof define=="function"&&define.amd?define([],n):a.CryptoJS=n();})(A,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 R=="function")try{o=R("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.")},c=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={},g=u.Base=(function(){return {extend:function(e){var i=c(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=g.extend({init:function(e,i){e=this.words=e||[],i!=t?this.sigBytes=i:this.sigBytes=e.length*4;},toString:function(e){return (e||x).stringify(this)},concat:function(e){var i=this.words,p=e.words,f=this.sigBytes,S=e.sigBytes;if(this.clamp(),f%4)for(var V=0;V<S;V++){var k=p[V>>>2]>>>24-V%4*8&255;i[f+V>>>2]|=k<<24-(f+V)%4*8;}else for(var _=0;_<S;_+=4)i[f+_>>>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=g.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)}}),l=s.enc={},x=l.Hex={stringify:function(e){for(var i=e.words,p=e.sigBytes,f=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;f.push((V>>>4).toString(16)),f.push((V&15).toString(16));}return f.join("")},parse:function(e){for(var i=e.length,p=[],f=0;f<i;f+=2)p[f>>>3]|=parseInt(e.substr(f,2),16)<<24-f%8*4;return new y.init(p,i/2)}},b=l.Latin1={stringify:function(e){for(var i=e.words,p=e.sigBytes,f=[],S=0;S<p;S++){var V=i[S>>>2]>>>24-S%4*8&255;f.push(String.fromCharCode(V));}return f.join("")},parse:function(e){for(var i=e.length,p=[],f=0;f<i;f++)p[f>>>2]|=(e.charCodeAt(f)&255)<<24-f%4*8;return new y.init(p,i)}},P=l.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)))}},h=u.BufferedBlockAlgorithm=g.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,f=p.words,S=p.sigBytes,V=this.blockSize,k=V*4,_=S/k;e?_=n.ceil(_):_=n.max((_|0)-this._minBufferSize,0);var C=_*V,z=n.min(C*4,S);if(C){for(var H=0;H<C;H+=V)this._doProcessBlock(f,H);i=f.splice(0,C),p.sigBytes-=z;}return new y.init(i,z)},clone:function(){var e=g.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=h.extend({cfg:g.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){h.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 m.HMAC.init(e,p).finalize(i)}}});var m=s.algo={};return s})(Math);return a});});var M=W((B,G)=>{(function(a,n){typeof B=="object"?G.exports=B=n(F()):typeof define=="function"&&define.amd?define(["./core"],n):n(a.CryptoJS);})(B,function(a){return (function(){var n=a,t=n.lib,o=t.WordArray,r=t.Hasher,c=n.algo,s=[],u=c.SHA1=r.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,y){for(var l=this._hash.words,x=l[0],b=l[1],P=l[2],h=l[3],d=l[4],m=0;m<80;m++){if(m<16)s[m]=g[y+m]|0;else {var e=s[m-3]^s[m-8]^s[m-14]^s[m-16];s[m]=e<<1|e>>>31;}var i=(x<<5|x>>>27)+d+s[m];m<20?i+=(b&P|~b&h)+1518500249:m<40?i+=(b^P^h)+1859775393:m<60?i+=(b&P|b&h|P&h)-1894007588:i+=(b^P^h)-899497514,d=h,h=P,P=b<<30|b>>>2,b=x,x=i;}l[0]=l[0]+x|0,l[1]=l[1]+b|0,l[2]=l[2]+P|0,l[3]=l[3]+h|0,l[4]=l[4]+d|0;},_doFinalize:function(){var g=this._data,y=g.words,l=this._nDataBytes*8,x=g.sigBytes*8;return y[x>>>5]|=128<<24-x%32,y[(x+64>>>9<<4)+14]=Math.floor(l/4294967296),y[(x+64>>>9<<4)+15]=l,g.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var g=r.clone.call(this);return g._hash=this._hash.clone(),g}});n.SHA1=r._createHelper(u),n.HmacSHA1=r._createHmacHelper(u);})(),a.SHA1});});var L;(r=>(r.log=(c,...s)=>console.log(`[Pixi\u2019VN Json] ${c}`,...s),r.warn=(c,...s)=>console.warn(`[Pixi\u2019VN Json] ${c}`,...s),r.error=(c,...s)=>console.error(`[Pixi\u2019VN Json] ${c}`,...s),r.info=(c,...s)=>console.info(`[Pixi\u2019VN Json] ${c}`,...s)))(L||(L={}));async function T(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(c=>{if(typeof c=="string")o+=c;else {let s=JsonUnifier.getLogichValue(c);o+=`${s}`;}});let r=await n(o);r&&await T(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}}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(g){L.error("Error parsing imported Pixi'VN JSON",g),u={};}return u}),s=(await Promise.all(r)).map(async u=>{let g=[];if(u.initialOperations){u.initialOperations.forEach(l=>{let x=T(l,t?b=>t(b,{},{}):void 0);g.push(x);});let y={};[...storage.storage.keys()].forEach((l,x)=>{y[l]=storage.storage.get(l);}),storage.startingStorage=y;}if(u.labels){let y=u.labels;for(let l in y)try{let x=y[l],b=new w(l,x,void 0,n);RegisteredLabels.add(b);}catch(x){L.error(`Error creating JSON label ${l}`,x);}}return Promise.all(g)});await Promise.all(s);}var Y=ne(M());var j="___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")}}var w=class extends LabelAbstract{constructor(t,o,r,c={}){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 g=u.operations.map(y=>JsonUnifier.loadAssets(y));await Promise.all(g);}}};super(t,r);E(this,"_steps");E(this,"operationStringConvert");E(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=c.operationStringConvert,this.skipEmptyDialogs=c.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(c=>{if(typeof c=="string")r.push(c);else if(c&&typeof c=="object"){let s=JsonUnifier.getLogichValue(c);s?(s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s)||""),Array.isArray(s)?r=r.concat(s):r.push(`${s}`)):r.push(`${c}`);}}),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(c=>JsonUnifier.getLogichValue(c)).filter(c=>c!==void 0)}stepConverter(t){return async o=>{let r=typeof t=="function"?t():t;r=X(r),r=JsonUnifier.getConditionalStep(r);let c=this.operationStringConvert?h=>this.operationStringConvert(h,r,o):void 0,{operations:s=[]}=r;for(let h of s)await T(h,c);let{labelToOpen:u=[]}=r,g=this.getChoices(r.choices),y=JsonUnifier.getLogichValue(r.glueEnabled),l=this.getDialogue(r.dialogue),x=[];Array.isArray(u)||(u=[u]),u.forEach(h=>{let d=JsonUnifier.getLogichValue(h);d&&x.push(d);});let b=JsonUnifier.getLogichValue(r.goNextStep),P=JsonUnifier.getLogichValue(r.end);if(g){let h=g.map(d=>{let m="";if(Array.isArray(d.text)){let i=[];d.text.forEach(p=>{if(typeof p=="string")i.push(translator.t(p));else if(p&&typeof p=="object"){let f=JsonUnifier.getLogichValue(p);f&&!Array.isArray(f)&&typeof f=="object"&&(f=JsonUnifier.getLogichValue(f)||""),f&&(Array.isArray(f)?i=i.concat(translator.t(f)):i.push(translator.t(f)));}}),m=i;}else typeof d.text=="string"&&(m=translator.t(d.text));return {label:d.label,text:m,props:d.props,type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect}});narration.choiceMenuOptions=h;}else narration.choiceMenuOptions=void 0;l!==void 0&&(narration.dialogue=l,this.skipEmptyDialogs&&typeof l=="string"&&(l===""||RegExp(/^\s+$/).test(l))&&(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 h of x){let d=h.label;typeof d=="object"&&(d=JsonUnifier.getLogichValue(d)||"");let m=h.params?.map(e=>JsonUnifier.getLogichValue(e));o={...o,...h.props},h.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${j}${narration.openedLabels.length}`,m),await narration.callLabel(d,o)):(storage.setTempVariable(`${j}${narration.openedLabels.length}`,m),await narration.callLabel(d,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)}},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};
|
package/dist/index.d.cts
CHANGED
|
@@ -62,6 +62,8 @@ type PixiVNJsonConditionalResultToCombine<T> = {
|
|
|
62
62
|
secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
66
|
+
|
|
65
67
|
type PixiVNJsonStorageGet = {
|
|
66
68
|
type: "value";
|
|
67
69
|
storageOperationType: "get";
|
|
@@ -249,8 +251,6 @@ interface PixiVNJsonIfElse<Then> {
|
|
|
249
251
|
else?: Then | PixiVNJsonIfElse<Then>;
|
|
250
252
|
}
|
|
251
253
|
|
|
252
|
-
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
253
|
-
|
|
254
254
|
type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
|
|
255
255
|
type: "animate";
|
|
256
256
|
alias: string | string[];
|
|
@@ -572,7 +572,7 @@ interface PixiVNJson {
|
|
|
572
572
|
* For the set storage: They will be set only if there are no variables with the same key already.
|
|
573
573
|
* For the det tempstorage: if there are variables with the same key already, they will be overwritten.
|
|
574
574
|
*/
|
|
575
|
-
initialOperations?:
|
|
575
|
+
initialOperations?: (PixiVNJsonValueSet | PixiVNJsonIfElse<PixiVNJsonValueSet>)[];
|
|
576
576
|
/**
|
|
577
577
|
* The labels to be used in the narrative. They will be added to the system
|
|
578
578
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,8 @@ type PixiVNJsonConditionalResultToCombine<T> = {
|
|
|
62
62
|
secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
66
|
+
|
|
65
67
|
type PixiVNJsonStorageGet = {
|
|
66
68
|
type: "value";
|
|
67
69
|
storageOperationType: "get";
|
|
@@ -249,8 +251,6 @@ interface PixiVNJsonIfElse<Then> {
|
|
|
249
251
|
else?: Then | PixiVNJsonIfElse<Then>;
|
|
250
252
|
}
|
|
251
253
|
|
|
252
|
-
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
253
|
-
|
|
254
254
|
type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
|
|
255
255
|
type: "animate";
|
|
256
256
|
alias: string | string[];
|
|
@@ -572,7 +572,7 @@ interface PixiVNJson {
|
|
|
572
572
|
* For the set storage: They will be set only if there are no variables with the same key already.
|
|
573
573
|
* For the det tempstorage: if there are variables with the same key already, they will be overwritten.
|
|
574
574
|
*/
|
|
575
|
-
initialOperations?:
|
|
575
|
+
initialOperations?: (PixiVNJsonValueSet | PixiVNJsonIfElse<PixiVNJsonValueSet>)[];
|
|
576
576
|
/**
|
|
577
577
|
* The labels to be used in the narrative. They will be added to the system
|
|
578
578
|
*/
|
package/dist/translator.d.cts
CHANGED
|
@@ -57,6 +57,8 @@ type PixiVNJsonConditionalResultToCombine<T> = {
|
|
|
57
57
|
secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
61
|
+
|
|
60
62
|
type PixiVNJsonStorageGet = {
|
|
61
63
|
type: "value";
|
|
62
64
|
storageOperationType: "get";
|
|
@@ -244,8 +246,6 @@ interface PixiVNJsonIfElse<Then> {
|
|
|
244
246
|
else?: Then | PixiVNJsonIfElse<Then>;
|
|
245
247
|
}
|
|
246
248
|
|
|
247
|
-
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
248
|
-
|
|
249
249
|
type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
|
|
250
250
|
type: "animate";
|
|
251
251
|
alias: string | string[];
|
package/dist/translator.d.ts
CHANGED
|
@@ -57,6 +57,8 @@ type PixiVNJsonConditionalResultToCombine<T> = {
|
|
|
57
57
|
secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
61
|
+
|
|
60
62
|
type PixiVNJsonStorageGet = {
|
|
61
63
|
type: "value";
|
|
62
64
|
storageOperationType: "get";
|
|
@@ -244,8 +246,6 @@ interface PixiVNJsonIfElse<Then> {
|
|
|
244
246
|
else?: Then | PixiVNJsonIfElse<Then>;
|
|
245
247
|
}
|
|
246
248
|
|
|
247
|
-
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
248
|
-
|
|
249
249
|
type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
|
|
250
250
|
type: "animate";
|
|
251
251
|
alias: string | string[];
|
package/dist/unifier.d.cts
CHANGED
|
@@ -57,6 +57,8 @@ type PixiVNJsonConditionalResultToCombine<T> = {
|
|
|
57
57
|
secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
61
|
+
|
|
60
62
|
type PixiVNJsonStorageGet = {
|
|
61
63
|
type: "value";
|
|
62
64
|
storageOperationType: "get";
|
|
@@ -244,8 +246,6 @@ interface PixiVNJsonIfElse<Then> {
|
|
|
244
246
|
else?: Then | PixiVNJsonIfElse<Then>;
|
|
245
247
|
}
|
|
246
248
|
|
|
247
|
-
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
248
|
-
|
|
249
249
|
type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
|
|
250
250
|
type: "animate";
|
|
251
251
|
alias: string | string[];
|
package/dist/unifier.d.ts
CHANGED
|
@@ -57,6 +57,8 @@ type PixiVNJsonConditionalResultToCombine<T> = {
|
|
|
57
57
|
secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
61
|
+
|
|
60
62
|
type PixiVNJsonStorageGet = {
|
|
61
63
|
type: "value";
|
|
62
64
|
storageOperationType: "get";
|
|
@@ -244,8 +246,6 @@ interface PixiVNJsonIfElse<Then> {
|
|
|
244
246
|
else?: Then | PixiVNJsonIfElse<Then>;
|
|
245
247
|
}
|
|
246
248
|
|
|
247
|
-
type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
|
|
248
|
-
|
|
249
249
|
type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
|
|
250
250
|
type: "animate";
|
|
251
251
|
alias: string | string[];
|