@drincs/pixi-vn-json 1.13.17 → 1.15.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.
@@ -1 +1 @@
1
- import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {translator}from'@drincs/pixi-vn-json/translator';import {LabelAbstract,narration,RegisteredLabels}from'@drincs/pixi-vn/narration';import {storage}from'@drincs/pixi-vn/storage';var Z=Object.create;var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var k=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var M=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var oe=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ie(e))!ne.call(n,s)&&s!==o&&$(n,s,{get:()=>e[s],enumerable:!(t=ee(e,s))||t.enumerable});return n};var re=(n,e,o)=>(o=n!=null?Z(te(n)):{},oe($(o,"default",{value:n,enumerable:true}),n));var F=M((T,G)=>{(function(n,e){typeof T=="object"?G.exports=T=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e();})(T,function(){var n=n||(function(e,o){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof k=="function")try{t=k("crypto");}catch{}var s=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||(function(){function i(){}return function(a){var p;return i.prototype=a,p=new i,i.prototype=null,p}})(),r={},x=r.lib={},m=x.Base=(function(){return {extend:function(i){var a=c(this);return i&&a.mixIn(i),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var a in i)i.hasOwnProperty(a)&&(this[a]=i[a]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=x.WordArray=m.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||N).stringify(this)},concat:function(i){var a=this.words,p=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var J=0;J<y;J++){var I=p[J>>>2]>>>24-J%4*8&255;a[d+J>>>2]|=I<<24-(d+J)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=p[C>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=e.ceil(a/4);},clone:function(){var i=m.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],p=0;p<i;p+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},N=u.Hex={stringify:function(i){for(var a=i.words,p=i.sigBytes,d=[],y=0;y<p;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push((J>>>4).toString(16)),d.push((J&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,p=[],d=0;d<a;d+=2)p[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(p,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,p=i.sigBytes,d=[],y=0;y<p;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(J));}return d.join("")},parse:function(i){for(var a=i.length,p=[],d=0;d<a;d++)p[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(p,a)}},g=u.Utf8={stringify:function(i){try{return decodeURIComponent(escape(V.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return V.parse(unescape(encodeURIComponent(i)))}},l=x.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=g.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var a,p=this._data,d=p.words,y=p.sigBytes,J=this.blockSize,I=J*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var A=C*J,H=e.min(A*4,y);if(A){for(var z=0;z<A;z+=J)this._doProcessBlock(d,z);a=d.splice(0,A),p.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=m.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:m.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){l.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(i){return function(a,p){return new i.init(p).finalize(a)}},_createHmacHelper:function(i){return function(a,p){return new v.HMAC.init(i,p).finalize(a)}}});var v=r.algo={};return r})(Math);return n});});var K=M((E,X)=>{(function(n,e){typeof E=="object"?X.exports=E=e(F()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS);})(E,function(n){return (function(){var e=n,o=e.lib,t=o.WordArray,s=o.Hasher,c=e.algo,r=[],x=c.SHA1=s.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(m,h){for(var u=this._hash.words,N=u[0],V=u[1],g=u[2],l=u[3],w=u[4],v=0;v<80;v++){if(v<16)r[v]=m[h+v]|0;else {var i=r[v-3]^r[v-8]^r[v-14]^r[v-16];r[v]=i<<1|i>>>31;}var a=(N<<5|N>>>27)+w+r[v];v<20?a+=(V&g|~V&l)+1518500249:v<40?a+=(V^g^l)+1859775393:v<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=N,N=a;}u[0]=u[0]+N|0,u[1]=u[1]+V|0,u[2]=u[2]+g|0,u[3]=u[3]+l|0,u[4]=u[4]+w|0;},_doFinalize:function(){var m=this._data,h=m.words,u=this._nDataBytes*8,N=m.sigBytes*8;return h[N>>>5]|=128<<24-N%32,h[(N+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(N+64>>>9<<4)+15]=u,m.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var m=s.clone.call(this);return m._hash=this._hash.clone(),m}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),n.SHA1});});var B="___param___";var f;(s=>(s.log=(c,...r)=>console.log(`[Pixi\u2019VN Json] ${c}`,...r),s.warn=(c,...r)=>console.warn(`[Pixi\u2019VN Json] ${c}`,...r),s.error=(c,...r)=>console.error(`[Pixi\u2019VN Json] ${c}`,...r),s.info=(c,...r)=>console.info(`[Pixi\u2019VN Json] ${c}`,...r)))(f||={});var L=class n{static init(e){e.loadAssets&&(n._loadAssets=e.loadAssets),e.soundOperation&&(n._soundOperation=e.soundOperation),e.imageOperation&&(n._imageOperation=e.imageOperation),e.videoOperation&&(n._videoOperation=e.videoOperation),e.imageContainerOperation&&(n._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(n._textOperation=e.textOperation),e.canvasElementOperation&&(n._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(n._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(n._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(n._narrationOperation=e.narrationOperation),e.effectOperation&&(n._effectOperation=e.effectOperation),e.animateOperation&&(n._animateOperation=e.animateOperation),e.canvasOperation&&(n._canvasOperation=e.canvasOperation),e.getLogichValue&&(n._getLogichValue=e.getLogichValue),e.getConditionalStep&&(n._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return n._loadAssets}static _soundOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return n._soundOperation}static _imageOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return n._imageOperation}static _videoOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return n._videoOperation}static _imageContainerOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return n._imageContainerOperation}static _textOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return n._textOperation}static _canvasElementOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return n._canvasElementOperation}static _setStorageValue=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return n._setStorageValue}static _setInitialStorageValue=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return n._setInitialStorageValue}static _narrationOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return n._narrationOperation}static _effectOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return n._effectOperation}static _animateOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return n._animateOperation}static _canvasOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return n._canvasOperation}static _getLogichValue=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return n._getLogichValue}static _getConditionalStep=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return n._getConditionalStep}};function q(n,e){if(e&&typeof e=="object"&&typeof n.functionName=="string"&&n.functionName in e){let o=e[n.functionName];if(typeof o=="function"){let t=n.args.map(s=>L.getLogichValue(s,e));return o(...t)}else f.warn(`getLogichValue function ${n.functionName} not found in props`);}}function W(n,e={}){let o="";return n.values.forEach(t=>{if(typeof t=="string")o+=t;else {let s=JsonUnifier.getLogichValue(t,e);o+=`${s}`;}}),o}async function R(n,e,o){let t=JsonUnifier.getLogichValue(n,e);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 "canvas":JsonUnifier.canvasOperation(t);break;case "value":JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(o){let s=W(t,e),c=await o(s);c&&await R(c,e,o);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break;case "function":await q(t,e);break}}function D(n){let e=JsonUnifier.getLogichValue(n,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var _=class extends LabelAbstract{constructor(e,o,t,s={}){t||(t={}),t.onLoadingLabel=async()=>{for(let c of o){let r;if(typeof c=="function"?r=c():r=c,r=JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(m=>JsonUnifier.loadAssets(m));await Promise.all(x);}catch(x){f.error("The operation in the onLoadingLabel function of the label has an error:",x);}}},super(e,t),this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e];return this.stepConverter(o)}operationStringConvert;skipEmptyDialogs=false;getStepSha(e){if(e<0||e>=this.steps.length)return;let o=this._steps[e];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(e,o){let t="";if(Array.isArray(e)){let s=[];e.forEach(c=>{if(typeof c=="string")s.push(c);else if(c&&typeof c=="object"){let r=JsonUnifier.getLogichValue(c,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${c}`);}else s.push(`${c}`);}),t=s;}else {let s=JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?t=s.map(c=>`${c}`):t=`${s}`;}return t}getDialogue(e,o){if(e==null)return;let t=JsonUnifier.getLogichValue(e,o);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:translator.t(this.getDialogueText(t.text,o))}:translator.t(this.getDialogueText(t,o))}getChoices(e,o){return JsonUnifier.getLogichValue(e,o)?.map(c=>JsonUnifier.getLogichValue(c,o)).filter(c=>c!==void 0)}stepConverter(e){return async o=>{let t=typeof e=="function"?e():e;t=createExportableElement(t),t=JsonUnifier.getConditionalStep(t,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,t,o):void 0,{operations:c=[]}=t;for(let g of c)await R(g,o,s);let{labelToOpen:r=[]}=t,x=this.getChoices(t.choices,o),m=JsonUnifier.getLogichValue(t.glueEnabled,o),h=this.getDialogue(t.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let N=JsonUnifier.getLogichValue(t.goNextStep,o),V=JsonUnifier.getLogichValue(t.end,o);if(x){let g=x.map(l=>{let w="";if(Array.isArray(l.text)){let i=[];l.text.forEach(a=>{if(typeof a=="string")i.push(translator.t(a));else if(a&&typeof a=="object"){let p=JsonUnifier.getLogichValue(a,o);p&&!Array.isArray(p)&&typeof p=="object"&&(p=JsonUnifier.getLogichValue(p,o)||""),p&&(Array.isArray(p)?i=i.concat(translator.t(p)):i.push(translator.t(p)));}}),w=i;}else typeof l.text=="string"&&(w=translator.t(l.text));return {label:l.label,text:w,props:l.props,type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect}});narration.choices=g;}else narration.choices=void 0;h!==void 0&&(narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(N=true)),m?narration.dialogGlue=true:m===false&&(narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(v=>JsonUnifier.getLogichValue(v,o));o={...o,...g.props},g.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${B}${narration.openedLabels.length}`,w),await narration.call(l,o)):(storage.setTempVariable(`${B}${narration.openedLabels.length}`,w),await narration.call(l,o));}V==="game_end"?(narration.closeAllLabels(),await narration.continue(o,{runNow:true})):V==="label_end"&&narration.closeCurrentLabel(),N&&await narration.continue(o,{runNow:true});}}};async function de(n,e={}){if(!Array.isArray(n))if(typeof n=="object"||typeof n=="string")n=[n];else {f.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=n.map(c=>{if(typeof c=="string")try{return JSON.parse(c)}catch(r){return f.error("Error parsing imported Pixi'VN JSON",r),{}}return c}),t=o.map(async c=>{if(c.initialOperations)for(let r of c.initialOperations)r.type==="value"&&(typeof r.value!="object"||!r.value||!("type"in r.value))&&D(r);return Promise.resolve()});await Promise.all(t);let s=o.map(async c=>{if(c.initialOperations)for(let r of c.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(c.labels){let r=c.labels;for(let x in r)try{let m=r[x],h=new _(x,m,void 0,e);RegisteredLabels.add(h);}catch(m){f.error(`Error creating JSON label ${x}`,m);}}return Promise.resolve()});await Promise.all(s);}export{_ as LabelJson,de as importPixiVNJson};
1
+ import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {translator}from'@drincs/pixi-vn-json/translator';import {LabelAbstract,narration,RegisteredLabels}from'@drincs/pixi-vn/narration';import {storage}from'@drincs/pixi-vn/storage';var Z=Object.create;var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var k=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var M=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var oe=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ie(e))!ne.call(n,s)&&s!==o&&$(n,s,{get:()=>e[s],enumerable:!(t=ee(e,s))||t.enumerable});return n};var re=(n,e,o)=>(o=n!=null?Z(te(n)):{},oe($(o,"default",{value:n,enumerable:true}),n));var F=M((T,G)=>{(function(n,e){typeof T=="object"?G.exports=T=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e();})(T,function(){var n=n||(function(e,o){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof k=="function")try{t=k("crypto");}catch{}var s=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||(function(){function i(){}return function(a){var p;return i.prototype=a,p=new i,i.prototype=null,p}})(),r={},x=r.lib={},m=x.Base=(function(){return {extend:function(i){var a=c(this);return i&&a.mixIn(i),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var a in i)i.hasOwnProperty(a)&&(this[a]=i[a]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=x.WordArray=m.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||N).stringify(this)},concat:function(i){var a=this.words,p=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var J=0;J<y;J++){var I=p[J>>>2]>>>24-J%4*8&255;a[d+J>>>2]|=I<<24-(d+J)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=p[C>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=e.ceil(a/4);},clone:function(){var i=m.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],p=0;p<i;p+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},N=u.Hex={stringify:function(i){for(var a=i.words,p=i.sigBytes,d=[],y=0;y<p;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push((J>>>4).toString(16)),d.push((J&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,p=[],d=0;d<a;d+=2)p[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(p,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,p=i.sigBytes,d=[],y=0;y<p;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(J));}return d.join("")},parse:function(i){for(var a=i.length,p=[],d=0;d<a;d++)p[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(p,a)}},g=u.Utf8={stringify:function(i){try{return decodeURIComponent(escape(V.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return V.parse(unescape(encodeURIComponent(i)))}},l=x.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=g.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var a,p=this._data,d=p.words,y=p.sigBytes,J=this.blockSize,I=J*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var A=C*J,H=e.min(A*4,y);if(A){for(var z=0;z<A;z+=J)this._doProcessBlock(d,z);a=d.splice(0,A),p.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=m.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:m.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){l.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(i){return function(a,p){return new i.init(p).finalize(a)}},_createHmacHelper:function(i){return function(a,p){return new v.HMAC.init(i,p).finalize(a)}}});var v=r.algo={};return r})(Math);return n});});var K=M((E,X)=>{(function(n,e){typeof E=="object"?X.exports=E=e(F()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS);})(E,function(n){return (function(){var e=n,o=e.lib,t=o.WordArray,s=o.Hasher,c=e.algo,r=[],x=c.SHA1=s.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(m,h){for(var u=this._hash.words,N=u[0],V=u[1],g=u[2],l=u[3],w=u[4],v=0;v<80;v++){if(v<16)r[v]=m[h+v]|0;else {var i=r[v-3]^r[v-8]^r[v-14]^r[v-16];r[v]=i<<1|i>>>31;}var a=(N<<5|N>>>27)+w+r[v];v<20?a+=(V&g|~V&l)+1518500249:v<40?a+=(V^g^l)+1859775393:v<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=N,N=a;}u[0]=u[0]+N|0,u[1]=u[1]+V|0,u[2]=u[2]+g|0,u[3]=u[3]+l|0,u[4]=u[4]+w|0;},_doFinalize:function(){var m=this._data,h=m.words,u=this._nDataBytes*8,N=m.sigBytes*8;return h[N>>>5]|=128<<24-N%32,h[(N+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(N+64>>>9<<4)+15]=u,m.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var m=s.clone.call(this);return m._hash=this._hash.clone(),m}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),n.SHA1});});var B="___param___";var f;(s=>(s.log=(c,...r)=>console.log(`[Pixi\u2019VN Json] ${c}`,...r),s.warn=(c,...r)=>console.warn(`[Pixi\u2019VN Json] ${c}`,...r),s.error=(c,...r)=>console.error(`[Pixi\u2019VN Json] ${c}`,...r),s.info=(c,...r)=>console.info(`[Pixi\u2019VN Json] ${c}`,...r)))(f||={});var L=class n{static init(e){e.loadAssets&&(n._loadAssets=e.loadAssets),e.soundOperation&&(n._soundOperation=e.soundOperation),e.imageOperation&&(n._imageOperation=e.imageOperation),e.videoOperation&&(n._videoOperation=e.videoOperation),e.imageContainerOperation&&(n._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(n._textOperation=e.textOperation),e.canvasElementOperation&&(n._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(n._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(n._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(n._narrationOperation=e.narrationOperation),e.effectOperation&&(n._effectOperation=e.effectOperation),e.animateOperation&&(n._animateOperation=e.animateOperation),e.canvasOperation&&(n._canvasOperation=e.canvasOperation),e.getLogichValue&&(n._getLogichValue=e.getLogichValue),e.getConditionalStep&&(n._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return n._loadAssets}static _soundOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return n._soundOperation}static _imageOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return n._imageOperation}static _videoOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return n._videoOperation}static _imageContainerOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return n._imageContainerOperation}static _textOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return n._textOperation}static _canvasElementOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return n._canvasElementOperation}static _setStorageValue=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return n._setStorageValue}static _setInitialStorageValue=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return n._setInitialStorageValue}static _narrationOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return n._narrationOperation}static _effectOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return n._effectOperation}static _animateOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return n._animateOperation}static _canvasOperation=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return n._canvasOperation}static _getLogichValue=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return n._getLogichValue}static _getConditionalStep=()=>{throw f.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return n._getConditionalStep}};function q(n,e){if(e&&typeof e=="object"&&typeof n.functionName=="string"&&n.functionName in e){let o=e[n.functionName];if(typeof o=="function"){let t=n.args.map(s=>L.getLogichValue(s,e));return o(...t)}else f.warn(`getLogichValue function ${n.functionName} not found in props`);}}function W(n,e={}){let o="";return n.values.forEach(t=>{if(typeof t=="string")o+=t;else {let s=JsonUnifier.getLogichValue(t,e);o+=`${s}`;}}),o}async function R(n,e,o){let t=JsonUnifier.getLogichValue(n,e);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 "canvas":JsonUnifier.canvasOperation(t);break;case "value":JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(o){let s=W(t,e),c=await o(s);c&&await R(c,e,o);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break;case "function":await q(t,e);break}}function D(n){let e=JsonUnifier.getLogichValue(n,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var _=class extends LabelAbstract{constructor(e,o,t,s={}){t||(t={}),t.onLoadingLabel=async()=>{for(let c of o){let r;if(typeof c=="function"?r=c():r=c,r=JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(m=>JsonUnifier.loadAssets(m));await Promise.all(x);}catch(x){f.error("The operation in the onLoadingLabel function of the label has an error:",x);}}},super(e,t),this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e];return this.stepConverter(o)}operationStringConvert;skipEmptyDialogs=false;getStepSha(e){if(e<0||e>=this.steps.length)return;let o=this._steps[e];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(e,o){let t="";if(Array.isArray(e)){let s=[];e.forEach(c=>{if(typeof c=="string")s.push(c);else if(c&&typeof c=="object"){let r=JsonUnifier.getLogichValue(c,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${c}`);}else s.push(`${c}`);}),t=s;}else {let s=JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?t=s.map(c=>`${c}`):t=`${s}`;}return t}getDialogue(e,o){if(e==null)return;let t=JsonUnifier.getLogichValue(e,o);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:translator.t(this.getDialogueText(t.text,o))}:translator.t(this.getDialogueText(t,o))}getChoices(e,o){return JsonUnifier.getLogichValue(e,o)?.map(c=>JsonUnifier.getLogichValue(c,o)).filter(c=>c!==void 0)}stepConverter(e){return async o=>{let t=typeof e=="function"?e():e;t=createExportableElement(t),t=JsonUnifier.getConditionalStep(t,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,t,o):void 0,{operations:c=[]}=t;for(let g of c)await R(g,o,s);let{labelToOpen:r=[]}=t,x=this.getChoices(t.choices,o),m=JsonUnifier.getLogichValue(t.glueEnabled,o),h=this.getDialogue(t.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let N=JsonUnifier.getLogichValue(t.goNextStep,o),V=JsonUnifier.getLogichValue(t.end,o);if(x){let g=x.map(l=>{let w="";if(Array.isArray(l.text)){let i=[];l.text.forEach(a=>{if(typeof a=="string")i.push(translator.t(a));else if(a&&typeof a=="object"){let p=JsonUnifier.getLogichValue(a,o);p&&!Array.isArray(p)&&typeof p=="object"&&(p=JsonUnifier.getLogichValue(p,o)||""),p&&(Array.isArray(p)?i=i.concat(translator.t(p)):i.push(translator.t(p)));}}),w=i;}else typeof l.text=="string"&&(w=translator.t(l.text));return {label:l.label,text:w,props:l.props,type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect}});narration.choices=g;}else narration.choices=void 0;h!==void 0&&(narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(N=true)),m?narration.dialogGlue=true:m===false&&(narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(v=>JsonUnifier.getLogichValue(v,o));o={...o,...g.props},g.type==="jump"?(narration.labels.opened.length>0&&narration.labels.closeCurrent(),storage.temp.set(`${B}${narration.labels.opened.length}`,w),await narration.call(l,o)):(storage.temp.set(`${B}${narration.labels.opened.length}`,w),await narration.call(l,o));}V==="game_end"?(narration.labels.closeAll(),await narration.continue(o,{runNow:true})):V==="label_end"&&narration.labels.closeCurrent(),N&&await narration.continue(o,{runNow:true});}}};async function de(n,e={}){if(!Array.isArray(n))if(typeof n=="object"||typeof n=="string")n=[n];else {f.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=n.map(c=>{if(typeof c=="string")try{return JSON.parse(c)}catch(r){return f.error("Error parsing imported Pixi'VN JSON",r),{}}return c}),t=o.map(async c=>{if(c.initialOperations)for(let r of c.initialOperations)r.type==="value"&&(typeof r.value!="object"||!r.value||!("type"in r.value))&&D(r);return Promise.resolve()});await Promise.all(t);let s=o.map(async c=>{if(c.initialOperations)for(let r of c.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(c.labels){let r=c.labels;for(let x in r)try{let m=r[x],h=new _(x,m,void 0,e);RegisteredLabels.add(h);}catch(m){f.error(`Error creating JSON label ${x}`,m);}}return Promise.resolve()});await Promise.all(s);}export{_ as LabelJson,de as importPixiVNJson};
package/dist/schema.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as PixiVNJsonValueSet, P as PixiVNJsonIfElse } from './PixiVNJsonIfElse-B_OG8Qs1.cjs';
2
- export { d as PixiVNJsonArithmeticOperations, g as PixiVNJsonArithmeticOperationsArithmetic, h as PixiVNJsonArithmeticOperationsArithmeticSingle, i as PixiVNJsonChoiceGet, j as PixiVNJsonComparation, k as PixiVNJsonComparationOperatorsType, l as PixiVNJsonConditionalResultToCombine, f as PixiVNJsonConditionalStatements, e as PixiVNJsonConditions, m as PixiVNJsonFunction, n as PixiVNJsonLabelGet, o as PixiVNJsonLogicGet, b as PixiVNJsonOnlyStorageSet, p as PixiVNJsonParamGet, q as PixiVNJsonStepSwitch, r as PixiVNJsonStepSwitchElementType, s as PixiVNJsonStepSwitchElementsType, t as PixiVNJsonStorageGet, u as PixiVNJsonUnionCondition, c as PixiVNJsonValueGet } from './PixiVNJsonIfElse-B_OG8Qs1.cjs';
3
- import { q as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-D-FkTLeR.cjs';
4
- export { r as PixiVNJsonAnimateBase, s as PixiVNJsonAnimateSequence, t as PixiVNJsonCanvas, o as PixiVNJsonCanvasAnimate, p as PixiVNJsonCanvasClear, u as PixiVNJsonCanvasEdit, n as PixiVNJsonCanvasEffect, h as PixiVNJsonCanvasImageContainerShow, c as PixiVNJsonCanvasImageVideoShow, e as PixiVNJsonCanvasRemove, v as PixiVNJsonCanvasShow, j as PixiVNJsonCanvasTextShow, w as PixiVNJsonChoice, x as PixiVNJsonChoices, y as PixiVNJsonConditionalOperation, z as PixiVNJsonDialog, A as PixiVNJsonDialogText, B as PixiVNJsonDialogue, i as PixiVNJsonImageContainerEdit, d as PixiVNJsonImageEdit, C as PixiVNJsonInputRequest, D as PixiVNJsonLabelToOpen, E as PixiVNJsonMediaTransiotions, m as PixiVNJsonNarration, P as PixiVNJsonOperation, a as PixiVNJsonOperationString, b as PixiVNJsonSound, F as PixiVNJsonSoundEdit, G as PixiVNJsonSoundPauseResume, H as PixiVNJsonSoundPlay, I as PixiVNJsonSoundRemove, k as PixiVNJsonTextEdit, l as PixiVNJsonUnknownEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume } from './PixiVNJsonLabelStep-D-FkTLeR.cjs';
1
+ import { a as PixiVNJsonValueSet, P as PixiVNJsonIfElse } from './PixiVNJsonIfElse-CgOnelja.cjs';
2
+ export { d as PixiVNJsonArithmeticOperations, g as PixiVNJsonArithmeticOperationsArithmetic, h as PixiVNJsonArithmeticOperationsArithmeticSingle, i as PixiVNJsonChoiceGet, j as PixiVNJsonComparation, k as PixiVNJsonComparationOperatorsType, l as PixiVNJsonConditionalResultToCombine, f as PixiVNJsonConditionalStatements, e as PixiVNJsonConditions, m as PixiVNJsonFunction, n as PixiVNJsonLabelGet, o as PixiVNJsonLogicGet, b as PixiVNJsonOnlyStorageSet, p as PixiVNJsonParamGet, q as PixiVNJsonStepSwitch, r as PixiVNJsonStepSwitchElementType, s as PixiVNJsonStepSwitchElementsType, t as PixiVNJsonStorageGet, u as PixiVNJsonUnionCondition, c as PixiVNJsonValueGet } from './PixiVNJsonIfElse-CgOnelja.cjs';
3
+ import { q as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-Da9gKfRK.cjs';
4
+ export { B as BlurInOutTransition, r as BlurTransitionProps, D as DissolveTransition, s as DissolveTransitionProps, F as FadeTransition, t as FadeTransitionProps, u as FlashInOutTransition, v as FlashTransitionProps, G as GlitchInOutTransition, w as GlitchTransitionProps, I as IrisInOutTransition, x as IrisTransitionProps, M as MoveInOutTransition, y as MoveInOutTransitionProps, N as NoiseDissolveInOutTransition, z as NoiseDissolveTransitionProps, A as PinchInOutTransition, C as PinchTransitionProps, E as PixelateInOutTransition, H as PixelateTransitionProps, J as PixiVNJsonAnimateBase, K as PixiVNJsonAnimateBaseOptions, L as PixiVNJsonAnimateSequence, O as PixiVNJsonAnimateSequenceOptions, Q as PixiVNJsonCanvas, o as PixiVNJsonCanvasAnimate, p as PixiVNJsonCanvasClear, R as PixiVNJsonCanvasEdit, n as PixiVNJsonCanvasEffect, h as PixiVNJsonCanvasImageContainerShow, S as PixiVNJsonCanvasImageContainerShowProps, c as PixiVNJsonCanvasImageVideoShow, T as PixiVNJsonCanvasImageVideoShowProps, e as PixiVNJsonCanvasRemove, U as PixiVNJsonCanvasShow, j as PixiVNJsonCanvasTextShow, V as PixiVNJsonCanvasTextShowProps, W as PixiVNJsonChoice, X as PixiVNJsonChoices, Y as PixiVNJsonConditionalOperation, Z as PixiVNJsonDialog, _ as PixiVNJsonDialogText, $ as PixiVNJsonDialogue, a0 as PixiVNJsonEffectBlurPulse, a1 as PixiVNJsonEffectBounce, a2 as PixiVNJsonEffectChromaticAberration, a3 as PixiVNJsonEffectDesaturate, a4 as PixiVNJsonEffectGlitch, a5 as PixiVNJsonEffectGlowPulse, a6 as PixiVNJsonEffectHop, a7 as PixiVNJsonEffectNod, a8 as PixiVNJsonEffectPulse, a9 as PixiVNJsonEffectPunch, aa as PixiVNJsonEffectRadialBlur, ab as PixiVNJsonEffectShake, ac as PixiVNJsonEffectShockwave, ad as PixiVNJsonEffectSway, ae as PixiVNJsonEffectVignettePulse, af as PixiVNJsonEffectWiggle, i as PixiVNJsonImageContainerEdit, d as PixiVNJsonImageEdit, ag as PixiVNJsonInputRequest, ah as PixiVNJsonLabelToOpen, ai as PixiVNJsonMediaTransiotions, m as PixiVNJsonNarration, P as PixiVNJsonOperation, a as PixiVNJsonOperationString, b as PixiVNJsonSound, aj as PixiVNJsonSoundEdit, ak as PixiVNJsonSoundEditProps, al as PixiVNJsonSoundPauseResume, am as PixiVNJsonSoundPlay, an as PixiVNJsonSoundPlayProps, ao as PixiVNJsonSoundRemove, k as PixiVNJsonTextEdit, l as PixiVNJsonUnknownEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume, ap as PushInOutTransition, aq as PushInOutTransitionProps, ar as RippleInOutTransition, as as RippleTransitionProps, at as SplitInOutTransition, au as SplitTransitionProps, av as TvInOutTransition, aw as TvTransitionProps, ax as TwistInOutTransition, ay as TwistTransitionProps, az as WarpInOutTransition, aA as WarpTransitionProps, aB as WipeInOutTransition, aC as WipeTransitionProps, aD as ZoomInOutTransition, aE as ZoomInOutTransitionProps } from './PixiVNJsonLabelStep-Da9gKfRK.cjs';
5
5
  import '@drincs/pixi-vn';
6
6
  import '@drincs/pixi-vn/motion';
7
7
  import 'pixi.js';
package/dist/schema.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as PixiVNJsonValueSet, P as PixiVNJsonIfElse } from './PixiVNJsonIfElse-B_OG8Qs1.js';
2
- export { d as PixiVNJsonArithmeticOperations, g as PixiVNJsonArithmeticOperationsArithmetic, h as PixiVNJsonArithmeticOperationsArithmeticSingle, i as PixiVNJsonChoiceGet, j as PixiVNJsonComparation, k as PixiVNJsonComparationOperatorsType, l as PixiVNJsonConditionalResultToCombine, f as PixiVNJsonConditionalStatements, e as PixiVNJsonConditions, m as PixiVNJsonFunction, n as PixiVNJsonLabelGet, o as PixiVNJsonLogicGet, b as PixiVNJsonOnlyStorageSet, p as PixiVNJsonParamGet, q as PixiVNJsonStepSwitch, r as PixiVNJsonStepSwitchElementType, s as PixiVNJsonStepSwitchElementsType, t as PixiVNJsonStorageGet, u as PixiVNJsonUnionCondition, c as PixiVNJsonValueGet } from './PixiVNJsonIfElse-B_OG8Qs1.js';
3
- import { q as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-CELQY8TP.js';
4
- export { r as PixiVNJsonAnimateBase, s as PixiVNJsonAnimateSequence, t as PixiVNJsonCanvas, o as PixiVNJsonCanvasAnimate, p as PixiVNJsonCanvasClear, u as PixiVNJsonCanvasEdit, n as PixiVNJsonCanvasEffect, h as PixiVNJsonCanvasImageContainerShow, c as PixiVNJsonCanvasImageVideoShow, e as PixiVNJsonCanvasRemove, v as PixiVNJsonCanvasShow, j as PixiVNJsonCanvasTextShow, w as PixiVNJsonChoice, x as PixiVNJsonChoices, y as PixiVNJsonConditionalOperation, z as PixiVNJsonDialog, A as PixiVNJsonDialogText, B as PixiVNJsonDialogue, i as PixiVNJsonImageContainerEdit, d as PixiVNJsonImageEdit, C as PixiVNJsonInputRequest, D as PixiVNJsonLabelToOpen, E as PixiVNJsonMediaTransiotions, m as PixiVNJsonNarration, P as PixiVNJsonOperation, a as PixiVNJsonOperationString, b as PixiVNJsonSound, F as PixiVNJsonSoundEdit, G as PixiVNJsonSoundPauseResume, H as PixiVNJsonSoundPlay, I as PixiVNJsonSoundRemove, k as PixiVNJsonTextEdit, l as PixiVNJsonUnknownEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume } from './PixiVNJsonLabelStep-CELQY8TP.js';
1
+ import { a as PixiVNJsonValueSet, P as PixiVNJsonIfElse } from './PixiVNJsonIfElse-CgOnelja.js';
2
+ export { d as PixiVNJsonArithmeticOperations, g as PixiVNJsonArithmeticOperationsArithmetic, h as PixiVNJsonArithmeticOperationsArithmeticSingle, i as PixiVNJsonChoiceGet, j as PixiVNJsonComparation, k as PixiVNJsonComparationOperatorsType, l as PixiVNJsonConditionalResultToCombine, f as PixiVNJsonConditionalStatements, e as PixiVNJsonConditions, m as PixiVNJsonFunction, n as PixiVNJsonLabelGet, o as PixiVNJsonLogicGet, b as PixiVNJsonOnlyStorageSet, p as PixiVNJsonParamGet, q as PixiVNJsonStepSwitch, r as PixiVNJsonStepSwitchElementType, s as PixiVNJsonStepSwitchElementsType, t as PixiVNJsonStorageGet, u as PixiVNJsonUnionCondition, c as PixiVNJsonValueGet } from './PixiVNJsonIfElse-CgOnelja.js';
3
+ import { q as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-BFiKq957.js';
4
+ export { B as BlurInOutTransition, r as BlurTransitionProps, D as DissolveTransition, s as DissolveTransitionProps, F as FadeTransition, t as FadeTransitionProps, u as FlashInOutTransition, v as FlashTransitionProps, G as GlitchInOutTransition, w as GlitchTransitionProps, I as IrisInOutTransition, x as IrisTransitionProps, M as MoveInOutTransition, y as MoveInOutTransitionProps, N as NoiseDissolveInOutTransition, z as NoiseDissolveTransitionProps, A as PinchInOutTransition, C as PinchTransitionProps, E as PixelateInOutTransition, H as PixelateTransitionProps, J as PixiVNJsonAnimateBase, K as PixiVNJsonAnimateBaseOptions, L as PixiVNJsonAnimateSequence, O as PixiVNJsonAnimateSequenceOptions, Q as PixiVNJsonCanvas, o as PixiVNJsonCanvasAnimate, p as PixiVNJsonCanvasClear, R as PixiVNJsonCanvasEdit, n as PixiVNJsonCanvasEffect, h as PixiVNJsonCanvasImageContainerShow, S as PixiVNJsonCanvasImageContainerShowProps, c as PixiVNJsonCanvasImageVideoShow, T as PixiVNJsonCanvasImageVideoShowProps, e as PixiVNJsonCanvasRemove, U as PixiVNJsonCanvasShow, j as PixiVNJsonCanvasTextShow, V as PixiVNJsonCanvasTextShowProps, W as PixiVNJsonChoice, X as PixiVNJsonChoices, Y as PixiVNJsonConditionalOperation, Z as PixiVNJsonDialog, _ as PixiVNJsonDialogText, $ as PixiVNJsonDialogue, a0 as PixiVNJsonEffectBlurPulse, a1 as PixiVNJsonEffectBounce, a2 as PixiVNJsonEffectChromaticAberration, a3 as PixiVNJsonEffectDesaturate, a4 as PixiVNJsonEffectGlitch, a5 as PixiVNJsonEffectGlowPulse, a6 as PixiVNJsonEffectHop, a7 as PixiVNJsonEffectNod, a8 as PixiVNJsonEffectPulse, a9 as PixiVNJsonEffectPunch, aa as PixiVNJsonEffectRadialBlur, ab as PixiVNJsonEffectShake, ac as PixiVNJsonEffectShockwave, ad as PixiVNJsonEffectSway, ae as PixiVNJsonEffectVignettePulse, af as PixiVNJsonEffectWiggle, i as PixiVNJsonImageContainerEdit, d as PixiVNJsonImageEdit, ag as PixiVNJsonInputRequest, ah as PixiVNJsonLabelToOpen, ai as PixiVNJsonMediaTransiotions, m as PixiVNJsonNarration, P as PixiVNJsonOperation, a as PixiVNJsonOperationString, b as PixiVNJsonSound, aj as PixiVNJsonSoundEdit, ak as PixiVNJsonSoundEditProps, al as PixiVNJsonSoundPauseResume, am as PixiVNJsonSoundPlay, an as PixiVNJsonSoundPlayProps, ao as PixiVNJsonSoundRemove, k as PixiVNJsonTextEdit, l as PixiVNJsonUnknownEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume, ap as PushInOutTransition, aq as PushInOutTransitionProps, ar as RippleInOutTransition, as as RippleTransitionProps, at as SplitInOutTransition, au as SplitTransitionProps, av as TvInOutTransition, aw as TvTransitionProps, ax as TwistInOutTransition, ay as TwistTransitionProps, az as WarpInOutTransition, aA as WarpTransitionProps, aB as WipeInOutTransition, aC as WipeTransitionProps, aD as ZoomInOutTransition, aE as ZoomInOutTransitionProps } from './PixiVNJsonLabelStep-BFiKq957.js';
5
5
  import '@drincs/pixi-vn';
6
6
  import '@drincs/pixi-vn/motion';
7
7
  import 'pixi.js';
@@ -1,7 +1,7 @@
1
1
  import { ZodType } from 'zod';
2
2
  import { StepLabelPropsType } from '@drincs/pixi-vn';
3
- import { q as PixiVNJsonLabelStep, P as PixiVNJsonOperation } from './PixiVNJsonLabelStep-D-FkTLeR.cjs';
4
- import './PixiVNJsonIfElse-B_OG8Qs1.cjs';
3
+ import { q as PixiVNJsonLabelStep, P as PixiVNJsonOperation } from './PixiVNJsonLabelStep-Da9gKfRK.cjs';
4
+ import './PixiVNJsonIfElse-CgOnelja.cjs';
5
5
  import '@drincs/pixi-vn/motion';
6
6
  import 'pixi.js';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { ZodType } from 'zod';
2
2
  import { StepLabelPropsType } from '@drincs/pixi-vn';
3
- import { q as PixiVNJsonLabelStep, P as PixiVNJsonOperation } from './PixiVNJsonLabelStep-CELQY8TP.js';
4
- import './PixiVNJsonIfElse-B_OG8Qs1.js';
3
+ import { q as PixiVNJsonLabelStep, P as PixiVNJsonOperation } from './PixiVNJsonLabelStep-BFiKq957.js';
4
+ import './PixiVNJsonIfElse-CgOnelja.js';
5
5
  import '@drincs/pixi-vn/motion';
6
6
  import 'pixi.js';
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn-json",
3
- "version": "1.13.17",
3
+ "version": "1.15.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",
@@ -126,7 +126,7 @@
126
126
  "vitest": "^4.1.7"
127
127
  },
128
128
  "peerDependencies": {
129
- "@drincs/pixi-vn": ">=1.8.0",
129
+ "@drincs/pixi-vn": ">=1.9.5",
130
130
  "zod": ">=4.4.0"
131
131
  },
132
132
  "keywords": [
@@ -3,10 +3,10 @@
3
3
  * Generates the JSON Schemas used by `entranceTransitionKeySchemas`
4
4
  * (src/actions/entrance-transitions.ts) from `@drincs/pixi-vn`'s own transition prop types —
5
5
  * `ShowWithDissolveTransitionProps`, `ShowWithFadeTransitionProps`, `MoveInOutProps`,
6
- * `ZoomInOutProps`, `PushInOutProps` — via this package's own generic
6
+ * `ZoomInOutProps`, `PushInOutProps` and the filter/mask based `*InOutProps` — via this package's own generic
7
7
  * TypeScript-interface-to-JSON-Schema generator (`schema-generator.mjs`).
8
8
  *
9
- * These 5 types are read straight off `@drincs/pixi-vn`'s own `.d.ts` (they're not declared
9
+ * These types are read straight off `@drincs/pixi-vn`'s own `.d.ts` (they're not declared
10
10
  * anywhere in this package), so no `interfaceDir` is passed — every one of them is generated via
11
11
  * the depth-capped "external" path, at the default `maxDepth: 1` ("branching" = 1): each prop
12
12
  * type's own direct properties (duration, delay, ease, direction, ...) are typed correctly, but
@@ -33,6 +33,19 @@ const ROOT_TYPE_NAMES = [
33
33
  "MoveInOutProps",
34
34
  "ZoomInOutProps",
35
35
  "PushInOutProps",
36
+ "WipeInOutProps",
37
+ "IrisInOutProps",
38
+ "SplitInOutProps",
39
+ "BlurInOutProps",
40
+ "PixelateInOutProps",
41
+ "FlashInOutProps",
42
+ "GlitchInOutProps",
43
+ "TwistInOutProps",
44
+ "WarpInOutProps",
45
+ "RippleInOutProps",
46
+ "NoiseDissolveInOutProps",
47
+ "TvInOutProps",
48
+ "PinchInOutProps",
36
49
  ];
37
50
 
38
51
  const { schemas, definitions } = generateJsonSchema({
@@ -67,6 +80,19 @@ const entranceTransitionKeySchemas = {
67
80
  movein: toStandaloneSchema(schemas.MoveInOutProps),
68
81
  zoomin: toStandaloneSchema(schemas.ZoomInOutProps),
69
82
  pushin: toStandaloneSchema(schemas.PushInOutProps),
83
+ wipein: toStandaloneSchema(schemas.WipeInOutProps),
84
+ irisin: toStandaloneSchema(schemas.IrisInOutProps),
85
+ splitin: toStandaloneSchema(schemas.SplitInOutProps),
86
+ blurin: toStandaloneSchema(schemas.BlurInOutProps),
87
+ pixelatein: toStandaloneSchema(schemas.PixelateInOutProps),
88
+ flashin: toStandaloneSchema(schemas.FlashInOutProps),
89
+ glitchin: toStandaloneSchema(schemas.GlitchInOutProps),
90
+ twistin: toStandaloneSchema(schemas.TwistInOutProps),
91
+ warpin: toStandaloneSchema(schemas.WarpInOutProps),
92
+ ripplein: toStandaloneSchema(schemas.RippleInOutProps),
93
+ noisedissolvein: toStandaloneSchema(schemas.NoiseDissolveInOutProps),
94
+ tvin: toStandaloneSchema(schemas.TvInOutProps),
95
+ pinchin: toStandaloneSchema(schemas.PinchInOutProps),
70
96
  };
71
97
 
72
98
  const outPath = join(rootDir, "src", "actions", "entrance-transition-schemas.generated.ts");
@@ -354,7 +354,11 @@ export function generateJsonSchema(options) {
354
354
  return mergeUnion(type.types.map((t) => convertExternalType(t, depth)));
355
355
  }
356
356
  if (type.isIntersection()) {
357
- return { allOf: type.types.map((t) => convertExternalType(t, depth)) };
357
+ // Same unsatisfiable-allOf trap as `mergeObjectSchemas` guards against below: an
358
+ // intersection like `A & Omit<B, K>` resolves as two members here (one gets its own
359
+ // named `$ref`, the other doesn't), and wrapping both in a plain `allOf` means each
360
+ // branch's `additionalProperties: false` rejects the other branch's properties.
361
+ return mergeObjectSchemas(type.types.map((t) => convertExternalType(t, depth)));
358
362
  }
359
363
 
360
364
  if (checker.isArrayType(type)) {
@@ -404,7 +408,10 @@ export function generateJsonSchema(options) {
404
408
  }
405
409
 
406
410
  function convertTypeReference(node, ctx) {
407
- const name = getTypeName(node.typeName);
411
+ // `node` is a `TypeReferenceNode` (`.typeName`) when it comes from `convertTypeNode`, but an
412
+ // `ExpressionWithTypeArguments` (`.expression`) when it comes from an interface's heritage
413
+ // clause (`extends Foo<Bar>`) — same shape otherwise, just a different property for the name.
414
+ const name = node.typeName ? getTypeName(node.typeName) : getTypeName(node.expression);
408
415
 
409
416
  if (ctx.has(name)) {
410
417
  const schema = ctx.get(name);
@@ -551,7 +558,7 @@ export function generateJsonSchema(options) {
551
558
 
552
559
  function convertDeclaration(decl, ctx) {
553
560
  if (ts.isInterfaceDeclaration(decl)) {
554
- return convertInterface(decl, ctx);
561
+ return getJsDocAnnotations(decl, convertInterface(decl, ctx));
555
562
  }
556
563
  if (ts.isTypeAliasDeclaration(decl)) {
557
564
  const baseSchema = convertTypeNode(decl.type, ctx);
@@ -599,11 +606,80 @@ export function generateJsonSchema(options) {
599
606
  if (additionalProperties !== undefined) schema.additionalProperties = additionalProperties;
600
607
 
601
608
  if (allOf.length > 0) {
602
- return { allOf: [...allOf, schema] };
609
+ return mergeObjectSchemas([...allOf, schema]);
603
610
  }
604
611
  return schema;
605
612
  }
606
613
 
614
+ /**
615
+ * Combines several object schemas that are meant to merge — an interface's heritage
616
+ * (`extends`) schemas plus its own members, or the branches of a resolved TS intersection
617
+ * type. A plain JSON Schema `allOf` of several `additionalProperties: false` object schemas is
618
+ * unsatisfiable by anything but `{}`: each branch rejects every property it doesn't itself
619
+ * declare, including the ones declared by its siblings. Since both callers are merging types
620
+ * that TypeScript itself treats as one flattened object — an interface's resolved member list,
621
+ * or `A & B` — the result should have exactly the union of members, required exactly where any
622
+ * branch required it. Flatten instead of wrapping in `allOf` whenever every branch is a plain
623
+ * object schema (no nested `allOf`/`anyOf`/`oneOf`/`$ref`). Anything else falls back to a real
624
+ * `allOf`, since it isn't safe to flatten in general (e.g. a branch that's itself a union).
625
+ */
626
+ function mergeObjectSchemas(schemas) {
627
+ // An interface's own body contributes `{ type: "object" }` even when it declares no
628
+ // members of its own (e.g. `interface X extends Y {}`) — drop that no-op contribution
629
+ // first so a single real heritage schema (however it's shaped, `$ref` included) can be
630
+ // returned as-is instead of getting wrapped in a pointless `allOf`.
631
+ const isTrivial = (s) => s && Object.keys(s).length === 1 && s.type === "object";
632
+ const nonTrivial = schemas.filter((s) => !isTrivial(s));
633
+ if (nonTrivial.length === 0) return { type: "object" };
634
+ if (nonTrivial.length === 1) return nonTrivial[0];
635
+
636
+ const isPlainObjectSchema = (s) =>
637
+ s &&
638
+ s.type === "object" &&
639
+ s.allOf === undefined &&
640
+ s.anyOf === undefined &&
641
+ s.oneOf === undefined &&
642
+ s.$ref === undefined;
643
+
644
+ // A branch that's just a `$ref` (e.g. one side of an intersection got its own named
645
+ // definition) is still safe to fold in, as long as what it points to is itself a plain
646
+ // object schema — merge using that dereferenced shape instead of bailing to `allOf`.
647
+ const dereffed = (s) => {
648
+ if (!s || s.$ref === undefined) return s;
649
+ const target = definitions[s.$ref.replace("#/definitions/", "")];
650
+ return isPlainObjectSchema(target) ? target : s;
651
+ };
652
+ const resolved = nonTrivial.map(dereffed);
653
+
654
+ if (!resolved.every(isPlainObjectSchema)) {
655
+ return { allOf: nonTrivial };
656
+ }
657
+
658
+ const properties = {};
659
+ const required = new Set();
660
+ let additionalProperties;
661
+ let anyClosed = false;
662
+ for (const s of resolved) {
663
+ if (s.properties) Object.assign(properties, s.properties);
664
+ if (s.required) for (const name of s.required) required.add(name);
665
+ if (s.additionalProperties === false) {
666
+ anyClosed = true;
667
+ } else if (s.additionalProperties !== undefined) {
668
+ additionalProperties = s.additionalProperties;
669
+ }
670
+ }
671
+ // A closed (`additionalProperties: false`) branch wins over a permissive one: the merged
672
+ // interface's members are exactly the union already collected above, so nothing outside
673
+ // that union should validate either — matches how TS itself treats `A & B`.
674
+ if (anyClosed) additionalProperties = false;
675
+
676
+ const merged = { type: "object" };
677
+ if (Object.keys(properties).length > 0) merged.properties = properties;
678
+ if (required.size > 0) merged.required = [...required];
679
+ if (additionalProperties !== undefined) merged.additionalProperties = additionalProperties;
680
+ return merged;
681
+ }
682
+
607
683
  function getTypeName(entityName) {
608
684
  if (ts.isIdentifier(entityName)) return entityName.text;
609
685
  if (ts.isQualifiedName(entityName)) {