@drincs/pixi-vn-json 1.15.0 → 1.16.2
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/{PixiVNJsonLabelStep-BFiKq957.d.ts → PixiVNJsonLabelStep-BrRDO4iZ.d.ts} +48 -5
- package/dist/{PixiVNJsonLabelStep-Da9gKfRK.d.cts → PixiVNJsonLabelStep-D1MiCvp5.d.cts} +48 -5
- package/dist/actions.cjs +2 -2
- package/dist/actions.d.cts +4 -2
- package/dist/actions.d.ts +4 -2
- package/dist/actions.mjs +2 -2
- package/dist/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +6 -1
- package/dist/core.d.ts +6 -1
- package/dist/core.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +2 -2
- package/dist/interpreter.cjs +1 -1
- package/dist/interpreter.d.cts +5 -3
- package/dist/interpreter.d.ts +5 -3
- package/dist/interpreter.mjs +1 -1
- package/dist/schema.d.cts +3 -2
- package/dist/schema.d.ts +3 -2
- package/dist/translator.d.cts +2 -1
- package/dist/translator.d.ts +2 -1
- package/package.json +2 -2
- package/scripts/schema-generator.mjs +13 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export { PIXIVNJSON_PARAM_ID, PIXIVNJSON_SCHEMA_URL, PixiVNJsonComparationOperators } from './constants.cjs';
|
|
2
2
|
export { PixiVNJson, PixiVNJsonLabels } from './schema.cjs';
|
|
3
3
|
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, P as PixiVNJsonIfElse, 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, a as PixiVNJsonValueSet } from './PixiVNJsonIfElse-CgOnelja.cjs';
|
|
4
|
-
export { B as BlurInOutTransition,
|
|
4
|
+
export { B as BlurInOutTransition, u as BlurTransitionProps, D as DissolveTransition, v as DissolveTransitionProps, F as FadeTransition, w as FadeTransitionProps, x as FlashInOutTransition, y as FlashTransitionProps, G as GlitchInOutTransition, z as GlitchTransitionProps, I as IrisInOutTransition, A as IrisTransitionProps, M as MoveInOutTransition, C as MoveInOutTransitionProps, N as NoiseDissolveInOutTransition, E as NoiseDissolveTransitionProps, H as PinchInOutTransition, J as PinchTransitionProps, K as PixelateInOutTransition, L as PixelateTransitionProps, O as PixiVNJsonAnimateBase, Q as PixiVNJsonAnimateBaseOptions, R as PixiVNJsonAnimateSequence, S as PixiVNJsonAnimateSequenceOptions, j as PixiVNJsonAnimatedSpriteControl, i as PixiVNJsonAnimatedSpriteEdit, T as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, h as PixiVNJsonCanvasAnimatedSpriteShow, s as PixiVNJsonCanvasClear, U as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, k as PixiVNJsonCanvasImageContainerShow, V as PixiVNJsonCanvasImageContainerShowProps, c as PixiVNJsonCanvasImageVideoShow, W as PixiVNJsonCanvasImageVideoShowProps, e as PixiVNJsonCanvasRemove, X as PixiVNJsonCanvasShow, m as PixiVNJsonCanvasTextShow, Y as PixiVNJsonCanvasTextShowProps, Z as PixiVNJsonChoice, _ as PixiVNJsonChoices, $ as PixiVNJsonConditionalOperation, a0 as PixiVNJsonDialog, a1 as PixiVNJsonDialogText, a2 as PixiVNJsonDialogue, a3 as PixiVNJsonEffectBlurPulse, a4 as PixiVNJsonEffectBounce, a5 as PixiVNJsonEffectChromaticAberration, a6 as PixiVNJsonEffectDesaturate, a7 as PixiVNJsonEffectGlitch, a8 as PixiVNJsonEffectGlowPulse, a9 as PixiVNJsonEffectHop, aa as PixiVNJsonEffectNod, ab as PixiVNJsonEffectPulse, ac as PixiVNJsonEffectPunch, ad as PixiVNJsonEffectRadialBlur, ae as PixiVNJsonEffectShake, af as PixiVNJsonEffectShockwave, ag as PixiVNJsonEffectSway, ah as PixiVNJsonEffectVignettePulse, ai as PixiVNJsonEffectWiggle, l as PixiVNJsonImageContainerEdit, d as PixiVNJsonImageEdit, aj as PixiVNJsonInputRequest, t as PixiVNJsonLabelStep, ak as PixiVNJsonLabelToOpen, al as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, P as PixiVNJsonOperation, a as PixiVNJsonOperationString, b as PixiVNJsonSound, am as PixiVNJsonSoundEdit, an as PixiVNJsonSoundEditProps, ao as PixiVNJsonSoundPauseResume, ap as PixiVNJsonSoundPlay, aq as PixiVNJsonSoundPlayProps, ar as PixiVNJsonSoundRemove, n as PixiVNJsonTextEdit, o as PixiVNJsonUnknownEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume, as as PushInOutTransition, at as PushInOutTransitionProps, au as RippleInOutTransition, av as RippleTransitionProps, aw as SplitInOutTransition, ax as SplitTransitionProps, ay as TvInOutTransition, az as TvTransitionProps, aA as TwistInOutTransition, aB as TwistTransitionProps, aC as WarpInOutTransition, aD as WarpTransitionProps, aE as WipeInOutTransition, aF as WipeTransitionProps, aG as ZoomInOutTransition, aH as ZoomInOutTransitionProps } from './PixiVNJsonLabelStep-D1MiCvp5.cjs';
|
|
5
5
|
export { V as VariableGetter, a as VariableGetterHandler } from './VariableGetter-ZDA6kdah.cjs';
|
|
6
6
|
export { LabelJson, importPixiVNJson } from './interpreter.cjs';
|
|
7
7
|
export { ReplaceHandler, ReplaceHandlerOptions, TextReplaces, translator } from './translator.cjs';
|
|
8
8
|
import '@drincs/pixi-vn';
|
|
9
9
|
import '@drincs/pixi-vn/motion';
|
|
10
10
|
import 'pixi.js';
|
|
11
|
+
import '@drincs/pixi-vn/canvas';
|
|
11
12
|
import '@drincs/pixi-vn/narration';
|
|
12
13
|
import 'zod';
|
|
13
14
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export { PIXIVNJSON_PARAM_ID, PIXIVNJSON_SCHEMA_URL, PixiVNJsonComparationOperators } from './constants.js';
|
|
2
2
|
export { PixiVNJson, PixiVNJsonLabels } from './schema.js';
|
|
3
3
|
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, P as PixiVNJsonIfElse, 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, a as PixiVNJsonValueSet } from './PixiVNJsonIfElse-CgOnelja.js';
|
|
4
|
-
export { B as BlurInOutTransition,
|
|
4
|
+
export { B as BlurInOutTransition, u as BlurTransitionProps, D as DissolveTransition, v as DissolveTransitionProps, F as FadeTransition, w as FadeTransitionProps, x as FlashInOutTransition, y as FlashTransitionProps, G as GlitchInOutTransition, z as GlitchTransitionProps, I as IrisInOutTransition, A as IrisTransitionProps, M as MoveInOutTransition, C as MoveInOutTransitionProps, N as NoiseDissolveInOutTransition, E as NoiseDissolveTransitionProps, H as PinchInOutTransition, J as PinchTransitionProps, K as PixelateInOutTransition, L as PixelateTransitionProps, O as PixiVNJsonAnimateBase, Q as PixiVNJsonAnimateBaseOptions, R as PixiVNJsonAnimateSequence, S as PixiVNJsonAnimateSequenceOptions, j as PixiVNJsonAnimatedSpriteControl, i as PixiVNJsonAnimatedSpriteEdit, T as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, h as PixiVNJsonCanvasAnimatedSpriteShow, s as PixiVNJsonCanvasClear, U as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, k as PixiVNJsonCanvasImageContainerShow, V as PixiVNJsonCanvasImageContainerShowProps, c as PixiVNJsonCanvasImageVideoShow, W as PixiVNJsonCanvasImageVideoShowProps, e as PixiVNJsonCanvasRemove, X as PixiVNJsonCanvasShow, m as PixiVNJsonCanvasTextShow, Y as PixiVNJsonCanvasTextShowProps, Z as PixiVNJsonChoice, _ as PixiVNJsonChoices, $ as PixiVNJsonConditionalOperation, a0 as PixiVNJsonDialog, a1 as PixiVNJsonDialogText, a2 as PixiVNJsonDialogue, a3 as PixiVNJsonEffectBlurPulse, a4 as PixiVNJsonEffectBounce, a5 as PixiVNJsonEffectChromaticAberration, a6 as PixiVNJsonEffectDesaturate, a7 as PixiVNJsonEffectGlitch, a8 as PixiVNJsonEffectGlowPulse, a9 as PixiVNJsonEffectHop, aa as PixiVNJsonEffectNod, ab as PixiVNJsonEffectPulse, ac as PixiVNJsonEffectPunch, ad as PixiVNJsonEffectRadialBlur, ae as PixiVNJsonEffectShake, af as PixiVNJsonEffectShockwave, ag as PixiVNJsonEffectSway, ah as PixiVNJsonEffectVignettePulse, ai as PixiVNJsonEffectWiggle, l as PixiVNJsonImageContainerEdit, d as PixiVNJsonImageEdit, aj as PixiVNJsonInputRequest, t as PixiVNJsonLabelStep, ak as PixiVNJsonLabelToOpen, al as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, P as PixiVNJsonOperation, a as PixiVNJsonOperationString, b as PixiVNJsonSound, am as PixiVNJsonSoundEdit, an as PixiVNJsonSoundEditProps, ao as PixiVNJsonSoundPauseResume, ap as PixiVNJsonSoundPlay, aq as PixiVNJsonSoundPlayProps, ar as PixiVNJsonSoundRemove, n as PixiVNJsonTextEdit, o as PixiVNJsonUnknownEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume, as as PushInOutTransition, at as PushInOutTransitionProps, au as RippleInOutTransition, av as RippleTransitionProps, aw as SplitInOutTransition, ax as SplitTransitionProps, ay as TvInOutTransition, az as TvTransitionProps, aA as TwistInOutTransition, aB as TwistTransitionProps, aC as WarpInOutTransition, aD as WarpTransitionProps, aE as WipeInOutTransition, aF as WipeTransitionProps, aG as ZoomInOutTransition, aH as ZoomInOutTransitionProps } from './PixiVNJsonLabelStep-BrRDO4iZ.js';
|
|
5
5
|
export { V as VariableGetter, a as VariableGetterHandler } from './VariableGetter-ZDA6kdah.js';
|
|
6
6
|
export { LabelJson, importPixiVNJson } from './interpreter.js';
|
|
7
7
|
export { ReplaceHandler, ReplaceHandlerOptions, TextReplaces, translator } from './translator.js';
|
|
8
8
|
import '@drincs/pixi-vn';
|
|
9
9
|
import '@drincs/pixi-vn/motion';
|
|
10
10
|
import 'pixi.js';
|
|
11
|
+
import '@drincs/pixi-vn/canvas';
|
|
11
12
|
import '@drincs/pixi-vn/narration';
|
|
12
13
|
import 'zod';
|
|
13
14
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {getConditionalStep,VariableGetter,setInitialStorageValue,setStorageValue,videoOperation,soundOperation,loadAssets,narrationOperation,textOperation,imageOperation,imageContainerOperation,effectOperation,canvasOperation,canvasElementOperation,animateOperation}from'@drincs/pixi-vn-json/actions';export{VariableGetter}from'@drincs/pixi-vn-json/actions';import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/interpreter';export*from'@drincs/pixi-vn-json/translator';var t={version:"1.
|
|
2
|
-
export{e as PIXIVNJSON_PARAM_ID,i as PIXIVNJSON_SCHEMA_URL,r as PixiVNJsonComparationOperators,
|
|
1
|
+
import {getConditionalStep,VariableGetter,setInitialStorageValue,setStorageValue,videoOperation,soundOperation,loadAssets,narrationOperation,textOperation,imageOperation,imageContainerOperation,effectOperation,canvasOperation,canvasElementOperation,animatedSpriteOperation,animateOperation}from'@drincs/pixi-vn-json/actions';export{VariableGetter}from'@drincs/pixi-vn-json/actions';import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/interpreter';export*from'@drincs/pixi-vn-json/translator';var t={version:"1.16.2"};var e="___param___",i=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function I(){JsonUnifier.init({animateOperation:animateOperation,animatedSpriteOperation:animatedSpriteOperation,canvasElementOperation:canvasElementOperation,canvasOperation:canvasOperation,effectOperation:effectOperation,imageContainerOperation:imageContainerOperation,imageOperation:imageOperation,textOperation:textOperation,narrationOperation:narrationOperation,loadAssets:loadAssets,soundOperation:soundOperation,videoOperation:videoOperation,setStorageValue:setStorageValue,setInitialStorageValue:setInitialStorageValue,getLogichValue:VariableGetter.getLogichValue,getConditionalStep:getConditionalStep});}
|
|
2
|
+
export{e as PIXIVNJSON_PARAM_ID,i as PIXIVNJSON_SCHEMA_URL,r as PixiVNJsonComparationOperators,I as init};
|
package/dist/interpreter.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var pixiVn=require('@drincs/pixi-vn'),core=require('@drincs/pixi-vn-json/core'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),storage=require('@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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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 pixiVn.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=core.JsonUnifier.getLogichValue(t,e);o+=`${s}`;}}),o}async function R(n,e,o){let t=core.JsonUnifier.getLogichValue(n,e);if(t)switch(t.type){case "sound":core.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await core.JsonUnifier.loadAssets(t);break;case "image":await core.JsonUnifier.imageOperation(t);break;case "video":await core.JsonUnifier.videoOperation(t);break;case "imagecontainer":await core.JsonUnifier.imageContainerOperation(t);break;case "text":await core.JsonUnifier.textOperation(t);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(t);break;case "canvas":core.JsonUnifier.canvasOperation(t);break;case "value":core.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":core.JsonUnifier.narrationOperation(t);break;case "shake":await core.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":core.JsonUnifier.animateOperation(t);break;case "function":await q(t,e);break}}function D(n){let e=core.JsonUnifier.getLogichValue(n,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var _=class extends narration.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=core.JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(m=>core.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=core.JsonUnifier.getLogichValue(c,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=core.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=core.JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=core.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=core.JsonUnifier.getLogichValue(e,o);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:translator.translator.t(this.getDialogueText(t.text,o))}:translator.translator.t(this.getDialogueText(t,o))}getChoices(e,o){return core.JsonUnifier.getLogichValue(e,o)?.map(c=>core.JsonUnifier.getLogichValue(c,o)).filter(c=>c!==void 0)}stepConverter(e){return async o=>{let t=typeof e=="function"?e():e;t=pixiVn.createExportableElement(t),t=core.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=core.JsonUnifier.getLogichValue(t.glueEnabled,o),h=this.getDialogue(t.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=core.JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let N=core.JsonUnifier.getLogichValue(t.goNextStep,o),V=core.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.translator.t(a));else if(a&&typeof a=="object"){let p=core.JsonUnifier.getLogichValue(a,o);p&&!Array.isArray(p)&&typeof p=="object"&&(p=core.JsonUnifier.getLogichValue(p,o)||""),p&&(Array.isArray(p)?i=i.concat(translator.translator.t(p)):i.push(translator.translator.t(p)));}}),w=i;}else typeof l.text=="string"&&(w=translator.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.narration.choices=g;}else narration.narration.choices=void 0;h!==void 0&&(narration.narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(N=true)),m?narration.narration.dialogGlue=true:m===false&&(narration.narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(v=>core.JsonUnifier.getLogichValue(v,o));o={...o,...g.props},g.type==="jump"?(narration.narration.labels.opened.length>0&&narration.narration.labels.closeCurrent(),storage.storage.temp.set(`${B}${narration.narration.labels.opened.length}`,w),await narration.narration.call(l,o)):(storage.storage.temp.set(`${B}${narration.narration.labels.opened.length}`,w),await narration.narration.call(l,o));}V==="game_end"?(narration.narration.labels.closeAll(),await narration.narration.continue(o,{runNow:true})):V==="label_end"&&narration.narration.labels.closeCurrent(),N&&await narration.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);narration.RegisteredLabels.add(h);}catch(m){f.error(`Error creating JSON label ${x}`,m);}}return Promise.resolve()});await Promise.all(s);}exports.LabelJson=_;exports.importPixiVNJson=de;
|
|
1
|
+
'use strict';var pixiVn=require('@drincs/pixi-vn'),core=require('@drincs/pixi-vn-json/core'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),storage=require('@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.")},p=Object.create||(function(){function i(){}return function(a){var c;return i.prototype=a,c=new i,i.prototype=null,c}})(),r={},x=r.lib={},f=x.Base=(function(){return {extend:function(i){var a=p(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=f.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var a=this.words,c=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var S=0;S<y;S++){var I=c[S>>>2]>>>24-S%4*8&255;a[d+S>>>2]|=I<<24-(d+S)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=c[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=f.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],c=0;c<i;c+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},J=u.Hex={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push((S>>>4).toString(16)),d.push((S&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d+=2)c[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(c,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(S));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d++)c[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(c,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=f.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,c=this._data,d=c.words,y=c.sigBytes,S=this.blockSize,I=S*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var _=C*S,H=e.min(_*4,y);if(_){for(var z=0;z<_;z+=S)this._doProcessBlock(d,z);a=d.splice(0,_),c.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=f.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:f.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,c){return new i.init(c).finalize(a)}},_createHmacHelper:function(i){return function(a,c){return new P.HMAC.init(i,c).finalize(a)}}});var P=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,p=e.algo,r=[],x=p.SHA1=s.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(f,h){for(var u=this._hash.words,J=u[0],V=u[1],g=u[2],l=u[3],w=u[4],P=0;P<80;P++){if(P<16)r[P]=f[h+P]|0;else {var i=r[P-3]^r[P-8]^r[P-14]^r[P-16];r[P]=i<<1|i>>>31;}var a=(J<<5|J>>>27)+w+r[P];P<20?a+=(V&g|~V&l)+1518500249:P<40?a+=(V^g^l)+1859775393:P<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=J,J=a;}u[0]=u[0]+J|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 f=this._data,h=f.words,u=this._nDataBytes*8,J=f.sigBytes*8;return h[J>>>5]|=128<<24-J%32,h[(J+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(J+64>>>9<<4)+15]=u,f.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var f=s.clone.call(this);return f._hash=this._hash.clone(),f}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),n.SHA1});});var B="___param___";var m;(s=>(s.log=(p,...r)=>console.log(`[Pixi\u2019VN Json] ${p}`,...r),s.warn=(p,...r)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...r),s.error=(p,...r)=>console.error(`[Pixi\u2019VN Json] ${p}`,...r),s.info=(p,...r)=>console.info(`[Pixi\u2019VN Json] ${p}`,...r)))(m||={});var j=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.animatedSpriteOperation&&(n._animatedSpriteOperation=e.animatedSpriteOperation),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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 _animatedSpriteOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animatedSpriteOperation(){return n._animatedSpriteOperation}static _imageContainerOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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 m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.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=>j.getLogichValue(s,e));return o(...t)}else m.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=core.JsonUnifier.getLogichValue(t,e);o+=`${s}`;}}),o}async function R(n,e,o){let t=core.JsonUnifier.getLogichValue(n,e);if(t)switch(t.type){case "sound":core.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await core.JsonUnifier.loadAssets(t);break;case "image":await core.JsonUnifier.imageOperation(t);break;case "video":await core.JsonUnifier.videoOperation(t);break;case "asprite":await core.JsonUnifier.animatedSpriteOperation(t);break;case "imagecontainer":await core.JsonUnifier.imageContainerOperation(t);break;case "text":await core.JsonUnifier.textOperation(t);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(t);break;case "canvas":core.JsonUnifier.canvasOperation(t);break;case "value":core.JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(o){let s=W(t,e),p=await o(s);p&&await R(p,e,o);}break;case "input":case "dialogue":core.JsonUnifier.narrationOperation(t);break;case "shake":await core.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":core.JsonUnifier.animateOperation(t);break;case "function":await q(t,e);break}}function D(n){let e=core.JsonUnifier.getLogichValue(n,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var A=class extends narration.LabelAbstract{constructor(e,o,t,s={}){t||(t={}),t.onLoadingLabel=async()=>{for(let p of o){let r;if(typeof p=="function"?r=p():r=p,r=core.JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(f=>core.JsonUnifier.loadAssets(f));await Promise.all(x);}catch(x){m.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],t=typeof o=="function"?o.toString():JSON.stringify(o);return (0, Y.default)(t).toString()}getDialogueText(e,o){let t="";if(Array.isArray(e)){let s=[];e.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let r=core.JsonUnifier.getLogichValue(p,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=core.JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${p}`);}else s.push(`${p}`);}),t=s;}else {let s=core.JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=core.JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?t=s.map(p=>`${p}`):t=`${s}`;}return t}getDialogue(e,o){if(e==null)return;let t=core.JsonUnifier.getLogichValue(e,o);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:translator.translator.t(this.getDialogueText(t.text,o))}:translator.translator.t(this.getDialogueText(t,o))}getChoices(e,o){return core.JsonUnifier.getLogichValue(e,o)?.map(p=>core.JsonUnifier.getLogichValue(p,o)).filter(p=>p!==void 0)}stepConverter(e){return async o=>{let t=typeof e=="function"?e():e;t=pixiVn.createExportableElement(t),t=core.JsonUnifier.getConditionalStep(t,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,t,o):void 0,{operations:p=[]}=t;for(let g of p)await R(g,o,s);let{labelToOpen:r=[]}=t,x=this.getChoices(t.choices,o),f=core.JsonUnifier.getLogichValue(t.glueEnabled,o),h=this.getDialogue(t.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=core.JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let J=core.JsonUnifier.getLogichValue(t.goNextStep,o),V=core.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.translator.t(a));else if(a&&typeof a=="object"){let c=core.JsonUnifier.getLogichValue(a,o);c&&!Array.isArray(c)&&typeof c=="object"&&(c=core.JsonUnifier.getLogichValue(c,o)||""),c&&(Array.isArray(c)?i=i.concat(translator.translator.t(c)):i.push(translator.translator.t(c)));}}),w=i;}else typeof l.text=="string"&&(w=translator.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.narration.choices=g;}else narration.narration.choices=void 0;h!==void 0&&(narration.narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(J=true)),f?narration.narration.dialogGlue=true:f===false&&(narration.narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(P=>core.JsonUnifier.getLogichValue(P,o));o={...o,...g.props},g.type==="jump"?(narration.narration.labels.opened.length>0&&narration.narration.labels.closeCurrent(),storage.storage.temp.set(`${B}${narration.narration.labels.opened.length}`,w),await narration.narration.call(l,o)):(storage.storage.temp.set(`${B}${narration.narration.labels.opened.length}`,w),await narration.narration.call(l,o));}V==="game_end"?(narration.narration.labels.closeAll(),await narration.narration.continue(o,{runNow:true})):V==="label_end"&&narration.narration.labels.closeCurrent(),J&&await narration.narration.continue(o,{runNow:true});}}};async function de(n,e={}){if(!Array.isArray(n))if(typeof n=="object"||typeof n=="string")n=[n];else {m.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=n.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(r){return m.error("Error parsing imported Pixi'VN JSON",r),{}}return p}),t=o.map(async p=>{if(p.initialOperations)for(let r of p.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 p=>{if(p.initialOperations)for(let r of p.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(p.labels){let r=p.labels;for(let x in r)try{let f=r[x],h=new A(x,f,void 0,e);narration.RegisteredLabels.add(h);}catch(f){m.error(`Error creating JSON label ${x}`,f);}}return Promise.resolve()});await Promise.all(s);}exports.LabelJson=A;exports.importPixiVNJson=de;
|
package/dist/interpreter.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as PixiVNJsonLabelStep, P as PixiVNJsonOperation } from './PixiVNJsonLabelStep-D1MiCvp5.cjs';
|
|
2
2
|
import { LabelAbstract, LabelProps, StepLabelPropsType, StepLabelType } from '@drincs/pixi-vn/narration';
|
|
3
3
|
import { PixiVNJson } from './schema.cjs';
|
|
4
4
|
import './PixiVNJsonIfElse-CgOnelja.cjs';
|
|
5
5
|
import '@drincs/pixi-vn';
|
|
6
6
|
import '@drincs/pixi-vn/motion';
|
|
7
7
|
import 'pixi.js';
|
|
8
|
+
import '@drincs/pixi-vn/canvas';
|
|
8
9
|
|
|
9
10
|
type LabelJsonOptions = {
|
|
10
11
|
/**
|
|
@@ -40,8 +41,9 @@ declare class LabelJson<T extends {} = object> extends LabelAbstract<LabelJson<T
|
|
|
40
41
|
private operationStringConvert?;
|
|
41
42
|
private skipEmptyDialogs;
|
|
42
43
|
/**
|
|
43
|
-
* Returns the SHA-1 hash of the raw step at the given index
|
|
44
|
-
*
|
|
44
|
+
* Returns the SHA-1 hash of the raw step at the given index: its JSON for a plain step, its
|
|
45
|
+
* source code for a step factory function. Pixi'VN uses it to detect step changes when a save
|
|
46
|
+
* is loaded after a game update.
|
|
45
47
|
*
|
|
46
48
|
* @param index - Zero-based index of the step.
|
|
47
49
|
* @returns The hex SHA-1 string, or `undefined` if the index is out of range.
|
package/dist/interpreter.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as PixiVNJsonLabelStep, P as PixiVNJsonOperation } from './PixiVNJsonLabelStep-BrRDO4iZ.js';
|
|
2
2
|
import { LabelAbstract, LabelProps, StepLabelPropsType, StepLabelType } from '@drincs/pixi-vn/narration';
|
|
3
3
|
import { PixiVNJson } from './schema.js';
|
|
4
4
|
import './PixiVNJsonIfElse-CgOnelja.js';
|
|
5
5
|
import '@drincs/pixi-vn';
|
|
6
6
|
import '@drincs/pixi-vn/motion';
|
|
7
7
|
import 'pixi.js';
|
|
8
|
+
import '@drincs/pixi-vn/canvas';
|
|
8
9
|
|
|
9
10
|
type LabelJsonOptions = {
|
|
10
11
|
/**
|
|
@@ -40,8 +41,9 @@ declare class LabelJson<T extends {} = object> extends LabelAbstract<LabelJson<T
|
|
|
40
41
|
private operationStringConvert?;
|
|
41
42
|
private skipEmptyDialogs;
|
|
42
43
|
/**
|
|
43
|
-
* Returns the SHA-1 hash of the raw step at the given index
|
|
44
|
-
*
|
|
44
|
+
* Returns the SHA-1 hash of the raw step at the given index: its JSON for a plain step, its
|
|
45
|
+
* source code for a step factory function. Pixi'VN uses it to detect step changes when a save
|
|
46
|
+
* is loaded after a game update.
|
|
45
47
|
*
|
|
46
48
|
* @param index - Zero-based index of the step.
|
|
47
49
|
* @returns The hex SHA-1 string, or `undefined` if the index is out of range.
|
package/dist/interpreter.mjs
CHANGED
|
@@ -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.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};
|
|
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.")},p=Object.create||(function(){function i(){}return function(a){var c;return i.prototype=a,c=new i,i.prototype=null,c}})(),r={},x=r.lib={},f=x.Base=(function(){return {extend:function(i){var a=p(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=f.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var a=this.words,c=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var S=0;S<y;S++){var I=c[S>>>2]>>>24-S%4*8&255;a[d+S>>>2]|=I<<24-(d+S)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=c[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=f.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],c=0;c<i;c+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},J=u.Hex={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push((S>>>4).toString(16)),d.push((S&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d+=2)c[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(c,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(S));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d++)c[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(c,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=f.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,c=this._data,d=c.words,y=c.sigBytes,S=this.blockSize,I=S*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var _=C*S,H=e.min(_*4,y);if(_){for(var z=0;z<_;z+=S)this._doProcessBlock(d,z);a=d.splice(0,_),c.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=f.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:f.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,c){return new i.init(c).finalize(a)}},_createHmacHelper:function(i){return function(a,c){return new P.HMAC.init(i,c).finalize(a)}}});var P=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,p=e.algo,r=[],x=p.SHA1=s.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(f,h){for(var u=this._hash.words,J=u[0],V=u[1],g=u[2],l=u[3],w=u[4],P=0;P<80;P++){if(P<16)r[P]=f[h+P]|0;else {var i=r[P-3]^r[P-8]^r[P-14]^r[P-16];r[P]=i<<1|i>>>31;}var a=(J<<5|J>>>27)+w+r[P];P<20?a+=(V&g|~V&l)+1518500249:P<40?a+=(V^g^l)+1859775393:P<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=J,J=a;}u[0]=u[0]+J|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 f=this._data,h=f.words,u=this._nDataBytes*8,J=f.sigBytes*8;return h[J>>>5]|=128<<24-J%32,h[(J+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(J+64>>>9<<4)+15]=u,f.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var f=s.clone.call(this);return f._hash=this._hash.clone(),f}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),n.SHA1});});var B="___param___";var m;(s=>(s.log=(p,...r)=>console.log(`[Pixi\u2019VN Json] ${p}`,...r),s.warn=(p,...r)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...r),s.error=(p,...r)=>console.error(`[Pixi\u2019VN Json] ${p}`,...r),s.info=(p,...r)=>console.info(`[Pixi\u2019VN Json] ${p}`,...r)))(m||={});var j=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.animatedSpriteOperation&&(n._animatedSpriteOperation=e.animatedSpriteOperation),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 m.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 m.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 m.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 _animatedSpriteOperation=()=>{throw m.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 animatedSpriteOperation(){return n._animatedSpriteOperation}static _imageContainerOperation=()=>{throw m.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 m.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 m.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 m.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 m.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 m.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 m.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 m.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 m.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 m.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 m.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=>j.getLogichValue(s,e));return o(...t)}else m.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 "asprite":await JsonUnifier.animatedSpriteOperation(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),p=await o(s);p&&await R(p,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 A=class extends LabelAbstract{constructor(e,o,t,s={}){t||(t={}),t.onLoadingLabel=async()=>{for(let p of o){let r;if(typeof p=="function"?r=p():r=p,r=JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(f=>JsonUnifier.loadAssets(f));await Promise.all(x);}catch(x){m.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],t=typeof o=="function"?o.toString():JSON.stringify(o);return (0, Y.default)(t).toString()}getDialogueText(e,o){let t="";if(Array.isArray(e)){let s=[];e.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let r=JsonUnifier.getLogichValue(p,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(`${p}`);}else s.push(`${p}`);}),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(p=>`${p}`):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(p=>JsonUnifier.getLogichValue(p,o)).filter(p=>p!==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:p=[]}=t;for(let g of p)await R(g,o,s);let{labelToOpen:r=[]}=t,x=this.getChoices(t.choices,o),f=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 J=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 c=JsonUnifier.getLogichValue(a,o);c&&!Array.isArray(c)&&typeof c=="object"&&(c=JsonUnifier.getLogichValue(c,o)||""),c&&(Array.isArray(c)?i=i.concat(translator.t(c)):i.push(translator.t(c)));}}),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))&&(J=true)),f?narration.dialogGlue=true:f===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(P=>JsonUnifier.getLogichValue(P,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(),J&&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 {m.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=n.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(r){return m.error("Error parsing imported Pixi'VN JSON",r),{}}return p}),t=o.map(async p=>{if(p.initialOperations)for(let r of p.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 p=>{if(p.initialOperations)for(let r of p.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(p.labels){let r=p.labels;for(let x in r)try{let f=r[x],h=new A(x,f,void 0,e);RegisteredLabels.add(h);}catch(f){m.error(`Error creating JSON label ${x}`,f);}}return Promise.resolve()});await Promise.all(s);}export{A as LabelJson,de as importPixiVNJson};
|
package/dist/schema.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { a as PixiVNJsonValueSet, P as PixiVNJsonIfElse } from './PixiVNJsonIfElse-CgOnelja.cjs';
|
|
2
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 {
|
|
4
|
-
export { B as BlurInOutTransition,
|
|
3
|
+
import { t as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-D1MiCvp5.cjs';
|
|
4
|
+
export { B as BlurInOutTransition, u as BlurTransitionProps, D as DissolveTransition, v as DissolveTransitionProps, F as FadeTransition, w as FadeTransitionProps, x as FlashInOutTransition, y as FlashTransitionProps, G as GlitchInOutTransition, z as GlitchTransitionProps, I as IrisInOutTransition, A as IrisTransitionProps, M as MoveInOutTransition, C as MoveInOutTransitionProps, N as NoiseDissolveInOutTransition, E as NoiseDissolveTransitionProps, H as PinchInOutTransition, J as PinchTransitionProps, K as PixelateInOutTransition, L as PixelateTransitionProps, O as PixiVNJsonAnimateBase, Q as PixiVNJsonAnimateBaseOptions, R as PixiVNJsonAnimateSequence, S as PixiVNJsonAnimateSequenceOptions, j as PixiVNJsonAnimatedSpriteControl, i as PixiVNJsonAnimatedSpriteEdit, T as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, h as PixiVNJsonCanvasAnimatedSpriteShow, s as PixiVNJsonCanvasClear, U as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, k as PixiVNJsonCanvasImageContainerShow, V as PixiVNJsonCanvasImageContainerShowProps, c as PixiVNJsonCanvasImageVideoShow, W as PixiVNJsonCanvasImageVideoShowProps, e as PixiVNJsonCanvasRemove, X as PixiVNJsonCanvasShow, m as PixiVNJsonCanvasTextShow, Y as PixiVNJsonCanvasTextShowProps, Z as PixiVNJsonChoice, _ as PixiVNJsonChoices, $ as PixiVNJsonConditionalOperation, a0 as PixiVNJsonDialog, a1 as PixiVNJsonDialogText, a2 as PixiVNJsonDialogue, a3 as PixiVNJsonEffectBlurPulse, a4 as PixiVNJsonEffectBounce, a5 as PixiVNJsonEffectChromaticAberration, a6 as PixiVNJsonEffectDesaturate, a7 as PixiVNJsonEffectGlitch, a8 as PixiVNJsonEffectGlowPulse, a9 as PixiVNJsonEffectHop, aa as PixiVNJsonEffectNod, ab as PixiVNJsonEffectPulse, ac as PixiVNJsonEffectPunch, ad as PixiVNJsonEffectRadialBlur, ae as PixiVNJsonEffectShake, af as PixiVNJsonEffectShockwave, ag as PixiVNJsonEffectSway, ah as PixiVNJsonEffectVignettePulse, ai as PixiVNJsonEffectWiggle, l as PixiVNJsonImageContainerEdit, d as PixiVNJsonImageEdit, aj as PixiVNJsonInputRequest, ak as PixiVNJsonLabelToOpen, al as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, P as PixiVNJsonOperation, a as PixiVNJsonOperationString, b as PixiVNJsonSound, am as PixiVNJsonSoundEdit, an as PixiVNJsonSoundEditProps, ao as PixiVNJsonSoundPauseResume, ap as PixiVNJsonSoundPlay, aq as PixiVNJsonSoundPlayProps, ar as PixiVNJsonSoundRemove, n as PixiVNJsonTextEdit, o as PixiVNJsonUnknownEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume, as as PushInOutTransition, at as PushInOutTransitionProps, au as RippleInOutTransition, av as RippleTransitionProps, aw as SplitInOutTransition, ax as SplitTransitionProps, ay as TvInOutTransition, az as TvTransitionProps, aA as TwistInOutTransition, aB as TwistTransitionProps, aC as WarpInOutTransition, aD as WarpTransitionProps, aE as WipeInOutTransition, aF as WipeTransitionProps, aG as ZoomInOutTransition, aH as ZoomInOutTransitionProps } from './PixiVNJsonLabelStep-D1MiCvp5.cjs';
|
|
5
5
|
import '@drincs/pixi-vn';
|
|
6
6
|
import '@drincs/pixi-vn/motion';
|
|
7
7
|
import 'pixi.js';
|
|
8
|
+
import '@drincs/pixi-vn/canvas';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Collection of labels to be used in the narrative.
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { a as PixiVNJsonValueSet, P as PixiVNJsonIfElse } from './PixiVNJsonIfElse-CgOnelja.js';
|
|
2
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 {
|
|
4
|
-
export { B as BlurInOutTransition,
|
|
3
|
+
import { t as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-BrRDO4iZ.js';
|
|
4
|
+
export { B as BlurInOutTransition, u as BlurTransitionProps, D as DissolveTransition, v as DissolveTransitionProps, F as FadeTransition, w as FadeTransitionProps, x as FlashInOutTransition, y as FlashTransitionProps, G as GlitchInOutTransition, z as GlitchTransitionProps, I as IrisInOutTransition, A as IrisTransitionProps, M as MoveInOutTransition, C as MoveInOutTransitionProps, N as NoiseDissolveInOutTransition, E as NoiseDissolveTransitionProps, H as PinchInOutTransition, J as PinchTransitionProps, K as PixelateInOutTransition, L as PixelateTransitionProps, O as PixiVNJsonAnimateBase, Q as PixiVNJsonAnimateBaseOptions, R as PixiVNJsonAnimateSequence, S as PixiVNJsonAnimateSequenceOptions, j as PixiVNJsonAnimatedSpriteControl, i as PixiVNJsonAnimatedSpriteEdit, T as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, h as PixiVNJsonCanvasAnimatedSpriteShow, s as PixiVNJsonCanvasClear, U as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, k as PixiVNJsonCanvasImageContainerShow, V as PixiVNJsonCanvasImageContainerShowProps, c as PixiVNJsonCanvasImageVideoShow, W as PixiVNJsonCanvasImageVideoShowProps, e as PixiVNJsonCanvasRemove, X as PixiVNJsonCanvasShow, m as PixiVNJsonCanvasTextShow, Y as PixiVNJsonCanvasTextShowProps, Z as PixiVNJsonChoice, _ as PixiVNJsonChoices, $ as PixiVNJsonConditionalOperation, a0 as PixiVNJsonDialog, a1 as PixiVNJsonDialogText, a2 as PixiVNJsonDialogue, a3 as PixiVNJsonEffectBlurPulse, a4 as PixiVNJsonEffectBounce, a5 as PixiVNJsonEffectChromaticAberration, a6 as PixiVNJsonEffectDesaturate, a7 as PixiVNJsonEffectGlitch, a8 as PixiVNJsonEffectGlowPulse, a9 as PixiVNJsonEffectHop, aa as PixiVNJsonEffectNod, ab as PixiVNJsonEffectPulse, ac as PixiVNJsonEffectPunch, ad as PixiVNJsonEffectRadialBlur, ae as PixiVNJsonEffectShake, af as PixiVNJsonEffectShockwave, ag as PixiVNJsonEffectSway, ah as PixiVNJsonEffectVignettePulse, ai as PixiVNJsonEffectWiggle, l as PixiVNJsonImageContainerEdit, d as PixiVNJsonImageEdit, aj as PixiVNJsonInputRequest, ak as PixiVNJsonLabelToOpen, al as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, P as PixiVNJsonOperation, a as PixiVNJsonOperationString, b as PixiVNJsonSound, am as PixiVNJsonSoundEdit, an as PixiVNJsonSoundEditProps, ao as PixiVNJsonSoundPauseResume, ap as PixiVNJsonSoundPlay, aq as PixiVNJsonSoundPlayProps, ar as PixiVNJsonSoundRemove, n as PixiVNJsonTextEdit, o as PixiVNJsonUnknownEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume, as as PushInOutTransition, at as PushInOutTransitionProps, au as RippleInOutTransition, av as RippleTransitionProps, aw as SplitInOutTransition, ax as SplitTransitionProps, ay as TvInOutTransition, az as TvTransitionProps, aA as TwistInOutTransition, aB as TwistTransitionProps, aC as WarpInOutTransition, aD as WarpTransitionProps, aE as WipeInOutTransition, aF as WipeTransitionProps, aG as ZoomInOutTransition, aH as ZoomInOutTransitionProps } from './PixiVNJsonLabelStep-BrRDO4iZ.js';
|
|
5
5
|
import '@drincs/pixi-vn';
|
|
6
6
|
import '@drincs/pixi-vn/motion';
|
|
7
7
|
import 'pixi.js';
|
|
8
|
+
import '@drincs/pixi-vn/canvas';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Collection of labels to be used in the narrative.
|
package/dist/translator.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ZodType } from 'zod';
|
|
2
2
|
import { StepLabelPropsType } from '@drincs/pixi-vn';
|
|
3
|
-
import {
|
|
3
|
+
import { t as PixiVNJsonLabelStep, P as PixiVNJsonOperation } from './PixiVNJsonLabelStep-D1MiCvp5.cjs';
|
|
4
4
|
import './PixiVNJsonIfElse-CgOnelja.cjs';
|
|
5
5
|
import '@drincs/pixi-vn/motion';
|
|
6
6
|
import 'pixi.js';
|
|
7
|
+
import '@drincs/pixi-vn/canvas';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* A handler function invoked for each `[key]` token found in the text that passes the
|
package/dist/translator.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ZodType } from 'zod';
|
|
2
2
|
import { StepLabelPropsType } from '@drincs/pixi-vn';
|
|
3
|
-
import {
|
|
3
|
+
import { t as PixiVNJsonLabelStep, P as PixiVNJsonOperation } from './PixiVNJsonLabelStep-BrRDO4iZ.js';
|
|
4
4
|
import './PixiVNJsonIfElse-CgOnelja.js';
|
|
5
5
|
import '@drincs/pixi-vn/motion';
|
|
6
6
|
import 'pixi.js';
|
|
7
|
+
import '@drincs/pixi-vn/canvas';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* A handler function invoked for each `[key]` token found in the text that passes the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drincs/pixi-vn-json",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.2",
|
|
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.9.
|
|
129
|
+
"@drincs/pixi-vn": ">=1.9.9",
|
|
130
130
|
"zod": ">=4.4.0"
|
|
131
131
|
},
|
|
132
132
|
"keywords": [
|
|
@@ -122,8 +122,20 @@ export function generateJsonSchema(options) {
|
|
|
122
122
|
const typeParams = new Map();
|
|
123
123
|
|
|
124
124
|
if (interfaceDir) {
|
|
125
|
+
const path = require("node:path");
|
|
126
|
+
const normalizedInterfaceDir = `${path.resolve(interfaceDir).replaceAll("\\", "/").replace(/\/$/, "")}/`;
|
|
125
127
|
for (const sourceFile of program.getSourceFiles()) {
|
|
126
|
-
|
|
128
|
+
const fileName = sourceFile.fileName.replaceAll("\\", "/");
|
|
129
|
+
const directory =
|
|
130
|
+
process.platform === "win32"
|
|
131
|
+
? normalizedInterfaceDir.toLowerCase()
|
|
132
|
+
: normalizedInterfaceDir;
|
|
133
|
+
if (
|
|
134
|
+
!(process.platform === "win32" ? fileName.toLowerCase() : fileName).startsWith(
|
|
135
|
+
directory,
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
continue;
|
|
127
139
|
collectDeclarations(sourceFile);
|
|
128
140
|
}
|
|
129
141
|
}
|