@drincs/pixi-vn-json 1.13.15 → 1.13.16
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/actions.cjs +2 -2
- package/dist/actions.d.cts +45 -2
- package/dist/actions.d.ts +45 -2
- package/dist/actions.mjs +2 -2
- package/dist/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +6 -3
- package/scripts/generate-entrance-transition-schemas.mjs +90 -0
- package/scripts/generate-schema.mjs +64 -0
- package/scripts/schema-generator.mjs +763 -0
package/dist/actions.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var core=require('@drincs/pixi-vn-json/core'),canvas=require('@drincs/pixi-vn/canvas'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),pixiVn=require('@drincs/pixi-vn'),storage=require('@drincs/pixi-vn/storage');async function Je(e){let t=core.JsonUnifier.getLogichValue(e,{});if(t)switch(t.type){case "assets":switch(t.operationType){case "load":await canvas.Assets.load(t.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(t.aliases);break}break;case "bundle":switch(t.operationType){case "load":await canvas.Assets.loadBundle(t.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(t.aliases);break}break}}var n;(o=>(o.log=(r,...l)=>console.log(`[Pixi\u2019VN Json] ${r}`,...l),o.warn=(r,...l)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...l),o.error=(r,...l)=>console.error(`[Pixi\u2019VN Json] ${r}`,...l),o.info=(r,...l)=>console.info(`[Pixi\u2019VN Json] ${r}`,...l)))(n||={});async function w(e,t,i){switch(i.type){case "fade":await canvas.showWithFade(t.alias,e,i.props,i.priority);break;case "dissolve":await canvas.showWithDissolve(t.alias,e,i.props,i.priority);break;case "movein":case "moveout":await canvas.moveIn(t.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(t.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await canvas.pushIn(t.alias,e,i.props,i.priority);break}}function v(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function Oe(e){switch(e.operationType){case "show":if(e.transition){let t=new canvas.ImageSprite(e.props,e.url||e.alias);await w(t,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Image with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function Ae(e){switch(e.operationType){case "show":if(e.transition){let t=new canvas.VideoSprite(e.props,e.url||e.alias);await w(t,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Video with alias ${e.alias} not found.`);break}case "remove":v(e);break;case "pause":case "resume":{let t=canvas.canvas.find(e.alias);t?t.paused=e.operationType==="pause":n.error(`Video with alias ${e.alias} not found.`);break}}}async function ke(e){switch(e.operationType){case "show":if(e.transition){let t=new canvas.ImageContainer(e.props,e.urls);await w(t,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function je(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let t=new canvas.Text(e.props);await w(t,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Text with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function Le(e){switch(e.operationType){case "edit":try{let t=canvas.canvas.find(e.alias);t?e.props&&t.setMemory({...t.memory,...e.props}):n.error(`Canvas Element with alias ${e.alias} not found.`);}catch(t){n.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,t);}break;case "remove":v(e);break}}function Ie(e){e.operationType==="clear"&&canvas.canvas.removeAll();}async function Ee(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function Re(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function Me(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function Fe(e){switch(e.operationType){case "play":e.url?sound.sound.play(e.alias,e.url,e.props):sound.sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.sound.stop(e.alias);break;case "all":sound.sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.sound.pause(e.alias);break;case "channel":sound.sound.findChannel(e.alias).pauseAll();break;case "all":sound.sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.sound.resume(e.alias);break;case "channel":sound.sound.findChannel(e.alias).resumeAll();break;case "all":sound.sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([t,i])=>{let a=sound.sound.find(e.alias);a&&(t==="volume"?a.volume.value=i:a.paused=i);});break}}var b="___param___";var h=class e{static init(t){t.loadAssets&&(e._loadAssets=t.loadAssets),t.soundOperation&&(e._soundOperation=t.soundOperation),t.imageOperation&&(e._imageOperation=t.imageOperation),t.videoOperation&&(e._videoOperation=t.videoOperation),t.imageContainerOperation&&(e._imageContainerOperation=t.imageContainerOperation),t.textOperation&&(e._textOperation=t.textOperation),t.canvasElementOperation&&(e._canvasElementOperation=t.canvasElementOperation),t.setStorageValue&&(e._setStorageValue=t.setStorageValue),t.setInitialStorageValue&&(e._setInitialStorageValue=t.setInitialStorageValue),t.narrationOperation&&(e._narrationOperation=t.narrationOperation),t.effectOperation&&(e._effectOperation=t.effectOperation),t.animateOperation&&(e._animateOperation=t.animateOperation),t.canvasOperation&&(e._canvasOperation=t.canvasOperation),t.getLogichValue&&(e._getLogichValue=t.getLogichValue),t.getConditionalStep&&(e._getConditionalStep=t.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return e._loadAssets}static _soundOperation=()=>{throw n.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 e._soundOperation}static _imageOperation=()=>{throw n.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 e._imageOperation}static _videoOperation=()=>{throw n.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 e._videoOperation}static _imageContainerOperation=()=>{throw n.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 e._imageContainerOperation}static _textOperation=()=>{throw n.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 e._textOperation}static _canvasElementOperation=()=>{throw n.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 e._canvasElementOperation}static _setStorageValue=()=>{throw n.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 e._setStorageValue}static _setInitialStorageValue=()=>{throw n.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 e._setInitialStorageValue}static _narrationOperation=()=>{throw n.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 e._narrationOperation}static _effectOperation=()=>{throw n.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 e._effectOperation}static _animateOperation=()=>{throw n.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 e._animateOperation}static _canvasOperation=()=>{throw n.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 e._canvasOperation}static _getLogichValue=()=>{throw n.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 e._getLogichValue}static _getConditionalStep=()=>{throw n.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 e._getConditionalStep}};function _(e,t){if(t&&typeof t=="object"&&typeof e.functionName=="string"&&e.functionName in t){let i=t[e.functionName];if(typeof i=="function"){let a=e.args.map(o=>h.getLogichValue(o,t));return i(...a)}else n.warn(`getLogichValue function ${e.functionName} not found in props`);}}function z(e,t){let i=core.JsonUnifier.getLogichValue(e,t);return i&&typeof i=="object"&&"type"in i?core.JsonUnifier.getLogichValue(i,t):i}function ui(e,t={}){let i=z(e.value,t);switch(e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,i);break;case "tempstorage":storage.storage.setTempVariable(e.key,i);break;case "params":{let a=storage.storage.get(`${b}${narration.narration.openedLabels.length-1}`)||[];a.length>e.key&&(a[e.key]=i),storage.storage.setTempVariable(`${b}${narration.narration.openedLabels.length-1}`,a);break}}}function di(e,t={}){let i=z(e.value,t);switch(e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:i};break}}function k(e,t={}){let i=j(e,t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return xe(i,t);case "arithmetic":case "arithmeticsingle":return me(i,t);case "compare":case "union":return ge(i,t);case "function":return _(i,t)}return i}function me(e,t){let i=core.JsonUnifier.getLogichValue(e.leftValue,t);switch(e.type){case "arithmetic":{let a=core.JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "*":return i*a;case "/":return i/a;case "+":return typeof i=="string"||typeof a=="string"?`${i}${a}`:Array.isArray(i)&&Array.isArray(a)?[...i,...a]:Array.isArray(i)?[...i,a]:Array.isArray(a)?[i,...a]:i+a;case "-":if(Array.isArray(i)&&Array.isArray(a))return i.filter(o=>!a.includes(o));if(Array.isArray(i))return i.filter(o=>o!==a);if(Array.isArray(a)){n.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return i-a;case "%":return i%a;case "POW":return i**a;case "RANDOM":return narration.narration.getRandomNumber(i,a);case "INTERSECTION":if(Array.isArray(i)&&Array.isArray(a))return i.filter(o=>a.includes(o));n.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:n.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(i);case "FLOOR":return Math.floor(i);}break}}function xe(e,t){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.narration.inputValue:storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return core.JsonUnifier.getLogichValue(e.operation,t);case "params":{let i=storage.storage.get(`${b}${narration.narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];n.warn("getValue params not found");return}}return e}function ge(e,t){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let i=core.JsonUnifier.getLogichValue(e.leftValue,t),a=core.JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "==":return Array.isArray(i)&&Array.isArray(a)?i.length===a.length&&i.every(o=>a.includes(o)):i===a;case "!=":return Array.isArray(i)&&Array.isArray(a)?i.length!==a.length||!i.every(o=>a.includes(o)):i!==a;case "<":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<0:Array.isArray(i)&&Array.isArray(a)?i.length<a.length:i<a;case "<=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<=0:Array.isArray(i)&&Array.isArray(a)?i.length<=a.length:i<=a;case ">":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>0:Array.isArray(i)&&Array.isArray(a)?i.length>a.length:i>a;case ">=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>=0:Array.isArray(i)&&Array.isArray(a)?i.length>=a.length:i>=a;case "CONTAINS":return Array.isArray(i)&&Array.isArray(a)?a.every(o=>i.includes(o)):Array.isArray(i)?i.includes(a):i.toString().includes(a.toString())}break}case "value":{let i=core.JsonUnifier.getLogichValue(e,t);return Array.isArray(i)?i.length>0:i&&typeof i=="object"?Object.keys(i).length>0:!!i}case "union":return Ve(e,t)}return !!e}function Ve(e,t){if(e.unionType==="not"){let a=k(e.condition,t);return Array.isArray(a)?a.length===0:a&&typeof a=="object"?Object.keys(a).length===0:!a}let i=a=>core.JsonUnifier.getLogichValue(a,t)||false;return e.unionType==="and"?e.conditions.every(i):e.conditions.some(i)}function fe(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function j(e,t={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return ye(e,t);case "ifelse":return core.JsonUnifier.getLogichValue(e.condition,t)?core.JsonUnifier.getLogichValue(e.then,t):core.JsonUnifier.getLogichValue(e.else,t);case "stepswitch":{let i=core.JsonUnifier.getLogichValue(e.elements,t)||[];if(i.length===0){n.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let a=fe(0,i.length-1);return core.JsonUnifier.getLogichValue(i[a],t)}case "loop":{let a=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return a>i.length-1?(a=a%i.length,core.JsonUnifier.getLogichValue(i[a],t)):core.JsonUnifier.getLogichValue(i[a],t)}case "sequential":{let a,o=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(a=core.JsonUnifier.getLogichValue(i[i.length-1],t)),o>i.length-1?a:core.JsonUnifier.getLogichValue(i[o],t)}case "sequentialrandom":{let a=narration.NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(a===void 0&&e.end==="lastItem"){let o=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!o?.usedRandomNumbers){n.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let r=o.usedRandomNumbers[`0-${i.length-1}`];return core.JsonUnifier.getLogichValue(i[r[r.length-1]],t)}if(a===void 0){n.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return core.JsonUnifier.getLogichValue(i[a],t)}}}}return e}function M(e,t={}){if(e.conditionalStep){let i=pixiVn.createExportableElement(core.JsonUnifier.getLogichValue(e.conditionalStep,t));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let a={...e,conditionalStep:void 0,...i};return M(a,t)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return e}function ye(e,t){let i=e.firstItem,a=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(l=>core.JsonUnifier.getLogichValue(l,t)):[core.JsonUnifier.getLogichValue(r,t)]),o=i?[i,...a]:a;if(o.length===0){n.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator.translator.t(o);if(typeof o[0]=="object"){let r=o,l,P=false,N=r.map((c,f)=>{c=M(c,t);let u=core.JsonUnifier.getLogichValue(c.dialogue,t)||"";return f===0?(l=core.JsonUnifier.getLogichValue(c.glueEnabled,t)||false,u):(typeof u=="object"&&"text"in u&&(u=`${u.character}: ${u.text}`),l===false&&P&&(u=`
|
|
1
|
+
'use strict';var core=require('@drincs/pixi-vn-json/core'),canvas=require('@drincs/pixi-vn/canvas'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),pixiVn=require('@drincs/pixi-vn'),storage=require('@drincs/pixi-vn/storage');async function Ce(e){let i=core.JsonUnifier.getLogichValue(e,{});if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await canvas.Assets.load(i.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await canvas.Assets.loadBundle(i.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(i.aliases);break}break}}var a;(o=>(o.log=(r,...p)=>console.log(`[Pixi\u2019VN Json] ${r}`,...p),o.warn=(r,...p)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...p),o.error=(r,...p)=>console.error(`[Pixi\u2019VN Json] ${r}`,...p),o.info=(r,...p)=>console.info(`[Pixi\u2019VN Json] ${r}`,...p)))(a||={});async function J(e,i,t){switch(t.type){case "fade":await canvas.showWithFade(i.alias,e,t.props,t.priority);break;case "dissolve":await canvas.showWithDissolve(i.alias,e,t.props,t.priority);break;case "movein":case "moveout":await canvas.moveIn(i.alias,e,t.props,t.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(i.alias,e,t.props,t.priority);break;case "pushin":case "pushout":await canvas.pushIn(i.alias,e,t.props,t.priority);break}}function N(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function Ee(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageSprite(e.props,e.url||e.alias);await J(i,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Image with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function Re(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.VideoSprite(e.props,e.url||e.alias);await J(i,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Video with alias ${e.alias} not found.`);break}case "remove":N(e);break;case "pause":case "resume":{let i=canvas.canvas.find(e.alias);i?i.paused=e.operationType==="pause":a.error(`Video with alias ${e.alias} not found.`);break}}}async function _e(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageContainer(e.props,e.urls);await J(i,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function De(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let i=new canvas.Text(e.props);await J(i,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Text with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function ze(e){switch(e.operationType){case "edit":try{let i=canvas.canvas.find(e.alias);i?e.props&&i.setMemory({...i.memory,...e.props}):a.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){a.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":N(e);break}}function Me(e){e.operationType==="clear"&&canvas.canvas.removeAll();}async function Ge(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function $e(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}var ue={dissolve:{type:"object",properties:{forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},fade:{type:"object",properties:{forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},movein:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},zoomin:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},pushin:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false}};var We=["dissolve","fade","movein","zoomin","pushin"];async function Be(e,i,t,n){switch(t){case "dissolve":return canvas.showWithDissolve(e,i,n);case "fade":return canvas.showWithFade(e,i,n);case "movein":return canvas.moveIn(e,i,n);case "zoomin":return canvas.zoomIn(e,i,n);case "pushin":return canvas.pushIn(e,i,n)}}function Ye(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function et(e){switch(e.operationType){case "play":e.url?sound.sound.play(e.alias,e.url,e.props):sound.sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.sound.stop(e.alias);break;case "all":sound.sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.sound.pause(e.alias);break;case "channel":sound.sound.findChannel(e.alias).pauseAll();break;case "all":sound.sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.sound.resume(e.alias);break;case "channel":sound.sound.findChannel(e.alias).resumeAll();break;case "all":sound.sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([i,t])=>{let n=sound.sound.find(e.alias);n&&(i==="volume"?n.volume.value=t:n.paused=t);});break}}var S="___param___";var V=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.canvasOperation&&(e._canvasOperation=i.canvasOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return e._loadAssets}static _soundOperation=()=>{throw a.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 e._soundOperation}static _imageOperation=()=>{throw a.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 e._imageOperation}static _videoOperation=()=>{throw a.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 e._videoOperation}static _imageContainerOperation=()=>{throw a.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 e._imageContainerOperation}static _textOperation=()=>{throw a.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 e._textOperation}static _canvasElementOperation=()=>{throw a.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 e._canvasElementOperation}static _setStorageValue=()=>{throw a.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 e._setStorageValue}static _setInitialStorageValue=()=>{throw a.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 e._setInitialStorageValue}static _narrationOperation=()=>{throw a.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 e._narrationOperation}static _effectOperation=()=>{throw a.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 e._effectOperation}static _animateOperation=()=>{throw a.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 e._animateOperation}static _canvasOperation=()=>{throw a.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 e._canvasOperation}static _getLogichValue=()=>{throw a.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 e._getLogichValue}static _getConditionalStep=()=>{throw a.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 e._getConditionalStep}};function _(e,i){if(i&&typeof i=="object"&&typeof e.functionName=="string"&&e.functionName in i){let t=i[e.functionName];if(typeof t=="function"){let n=e.args.map(o=>V.getLogichValue(o,i));return t(...n)}else a.warn(`getLogichValue function ${e.functionName} not found in props`);}}function D(e,i){let t=core.JsonUnifier.getLogichValue(e,i);return t&&typeof t=="object"&&"type"in t?core.JsonUnifier.getLogichValue(t,i):t}function Nt(e,i={}){let t=D(e.value,i);switch(e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,t);break;case "tempstorage":storage.storage.setTempVariable(e.key,t);break;case "params":{let n=storage.storage.get(`${S}${narration.narration.openedLabels.length-1}`)||[];n.length>e.key&&(n[e.key]=t),storage.storage.setTempVariable(`${S}${narration.narration.openedLabels.length-1}`,n);break}}}function vt(e,i={}){let t=D(e.value,i);switch(e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:t};break}}function A(e,i={}){let t=k(e,i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return he(t,i);case "arithmetic":case "arithmeticsingle":return Ve(t,i);case "compare":case "union":return Pe(t,i);case "function":return _(t,i)}return t}function Ve(e,i){let t=core.JsonUnifier.getLogichValue(e.leftValue,i);switch(e.type){case "arithmetic":{let n=core.JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "*":return t*n;case "/":return t/n;case "+":return typeof t=="string"||typeof n=="string"?`${t}${n}`:Array.isArray(t)&&Array.isArray(n)?[...t,...n]:Array.isArray(t)?[...t,n]:Array.isArray(n)?[t,...n]:t+n;case "-":if(Array.isArray(t)&&Array.isArray(n))return t.filter(o=>!n.includes(o));if(Array.isArray(t))return t.filter(o=>o!==n);if(Array.isArray(n)){a.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return t-n;case "%":return t%n;case "POW":return t**n;case "RANDOM":return narration.narration.getRandomNumber(t,n);case "INTERSECTION":if(Array.isArray(t)&&Array.isArray(n))return t.filter(o=>n.includes(o));a.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:a.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(t);case "FLOOR":return Math.floor(t);}break}}function he(e,i){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.narration.inputValue:storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return core.JsonUnifier.getLogichValue(e.operation,i);case "params":{let t=storage.storage.get(`${S}${narration.narration.openedLabels.length-1}`)||[];if(t&&t.length>e.key)return t[e.key];a.warn("getValue params not found");return}}return e}function Pe(e,i){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let t=core.JsonUnifier.getLogichValue(e.leftValue,i),n=core.JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "==":return Array.isArray(t)&&Array.isArray(n)?t.length===n.length&&t.every(o=>n.includes(o)):t===n;case "!=":return Array.isArray(t)&&Array.isArray(n)?t.length!==n.length||!t.every(o=>n.includes(o)):t!==n;case "<":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)<0:Array.isArray(t)&&Array.isArray(n)?t.length<n.length:t<n;case "<=":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)<=0:Array.isArray(t)&&Array.isArray(n)?t.length<=n.length:t<=n;case ">":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)>0:Array.isArray(t)&&Array.isArray(n)?t.length>n.length:t>n;case ">=":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)>=0:Array.isArray(t)&&Array.isArray(n)?t.length>=n.length:t>=n;case "CONTAINS":return Array.isArray(t)&&Array.isArray(n)?n.every(o=>t.includes(o)):Array.isArray(t)?t.includes(n):t.toString().includes(n.toString())}break}case "value":{let t=core.JsonUnifier.getLogichValue(e,i);return Array.isArray(t)?t.length>0:t&&typeof t=="object"?Object.keys(t).length>0:!!t}case "union":return Ne(e,i)}return !!e}function Ne(e,i){if(e.unionType==="not"){let n=A(e.condition,i);return Array.isArray(n)?n.length===0:n&&typeof n=="object"?Object.keys(n).length===0:!n}let t=n=>core.JsonUnifier.getLogichValue(n,i)||false;return e.unionType==="and"?e.conditions.every(t):e.conditions.some(t)}function ve(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function k(e,i={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Te(e,i);case "ifelse":return core.JsonUnifier.getLogichValue(e.condition,i)?core.JsonUnifier.getLogichValue(e.then,i):core.JsonUnifier.getLogichValue(e.else,i);case "stepswitch":{let t=core.JsonUnifier.getLogichValue(e.elements,i)||[];if(t.length===0){a.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let n=ve(0,t.length-1);return core.JsonUnifier.getLogichValue(t[n],i)}case "loop":{let n=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>t.length-1?(n=n%t.length,core.JsonUnifier.getLogichValue(t[n],i)):core.JsonUnifier.getLogichValue(t[n],i)}case "sequential":{let n,o=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(n=core.JsonUnifier.getLogichValue(t[t.length-1],i)),o>t.length-1?n:core.JsonUnifier.getLogichValue(t[o],i)}case "sequentialrandom":{let n=narration.NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:true});if(n===void 0&&e.end==="lastItem"){let o=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!o?.usedRandomNumbers){a.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let r=o.usedRandomNumbers[`0-${t.length-1}`];return core.JsonUnifier.getLogichValue(t[r[r.length-1]],i)}if(n===void 0){a.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return core.JsonUnifier.getLogichValue(t[n],i)}}}}return e}function z(e,i={}){if(e.conditionalStep){let t=pixiVn.createExportableElement(core.JsonUnifier.getLogichValue(e.conditionalStep,i));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operations===void 0&&delete t?.operations,t){let n={...e,conditionalStep:void 0,...t};return z(n,i)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return e}function Te(e,i){let t=e.firstItem,n=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(p=>core.JsonUnifier.getLogichValue(p,i)):[core.JsonUnifier.getLogichValue(r,i)]),o=t?[t,...n]:n;if(o.length===0){a.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator.translator.t(o);if(typeof o[0]=="object"){let r=o,p,h=false,P=r.map((c,b)=>{c=z(c,i);let l=core.JsonUnifier.getLogichValue(c.dialogue,i)||"";return b===0?(p=core.JsonUnifier.getLogichValue(c.glueEnabled,i)||false,l):(typeof l=="object"&&"text"in l&&(l=`${l.character}: ${l.text}`),p===false&&h&&(l=`
|
|
2
2
|
|
|
3
|
-
${
|
|
3
|
+
${l}`),l&&(h=true),p=core.JsonUnifier.getLogichValue(c.glueEnabled,i)||false,l)}),g=core.JsonUnifier.getLogichValue(P[0],i),x=typeof g=="object"&&"character"in g?g.character:void 0,v=P.flatMap(c=>{let b;c&&typeof c=="object"&&"text"in c?b=c.text:b=c;let l;return Array.isArray(b)?l=b.map($=>{let F=core.JsonUnifier.getLogichValue($,i);return translator.translator.t(`${F}`)}):l=core.JsonUnifier.getLogichValue(b,i)||"",translator.translator.t(l)}),O=r.find(c=>c.end),M=r.find(c=>c.choices),I=false,L=false;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&(narration.narration.dialogGlue=true),I=r[r.length-1].glueEnabled,L=r.reverse().find(c=>!(c.operations&&(!c.dialogue||!c.choices)))?.goNextStep);let G=r.find(c=>c.labelToOpen),C=[];return r.forEach(c=>{c.operations&&(C=[...C,...c.operations]);}),{dialogue:x?{character:x,text:v}:v,end:O?.end,choices:M?.choices,glueEnabled:I,goNextStep:L,labelToOpen:G?.labelToOpen,operations:C}}}exports.VariableGetter=void 0;(o=>{let e=new Set;function i(r){e.add(r);}o.add=i;function t(){e.clear();}o.clear=t;function n(r,p={}){let h=x=>A(x,p)??void 0,P=k(r,p);if(e.size===0)return h(P);let g=h;for(let x of e){let v=g;g=O=>x(O,v)??void 0;}return g(P)}o.getLogichValue=n;})(exports.VariableGetter||={});exports.ENTRANCE_TRANSITION_TYPES=We;exports.animateOperation=$e;exports.canvasElementOperation=ze;exports.canvasOperation=Me;exports.effectOperation=Ge;exports.entranceTransitionKeySchemas=ue;exports.executeEntranceTransition=Be;exports.getConditionalStep=z;exports.getLogichValue=A;exports.getValueFromConditionalStatements=k;exports.imageContainerOperation=_e;exports.imageOperation=Ee;exports.loadAssets=Ce;exports.narrationOperation=Ye;exports.setInitialStorageValue=vt;exports.setStorageValue=Nt;exports.soundOperation=et;exports.textOperation=De;exports.videoOperation=Re;
|
package/dist/actions.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as PixiVNJsonIfElse, c as PixiVNJsonValueGet, d as PixiVNJsonArithmeticOperations, e as PixiVNJsonConditions, m as PixiVNJsonFunction, f as PixiVNJsonConditionalStatements, l as PixiVNJsonConditionalResultToCombine, b as PixiVNJsonOnlyStorageSet, a as PixiVNJsonValueSet } from './PixiVNJsonIfElse-B_OG8Qs1.cjs';
|
|
2
2
|
import { P as PixiVNJsonOperation, a as PixiVNJsonOperationString, o as PixiVNJsonCanvasAnimate, l as PixiVNJsonUnknownEdit, e as PixiVNJsonCanvasRemove, p as PixiVNJsonCanvasClear, n as PixiVNJsonCanvasEffect, h as PixiVNJsonCanvasImageContainerShow, i as PixiVNJsonImageContainerEdit, c as PixiVNJsonCanvasImageVideoShow, d as PixiVNJsonImageEdit, j as PixiVNJsonCanvasTextShow, k as PixiVNJsonTextEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume, m as PixiVNJsonNarration, b as PixiVNJsonSound, q as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-D-FkTLeR.cjs';
|
|
3
|
-
import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild } from '@drincs/pixi-vn/canvas';
|
|
3
|
+
import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild, CanvasBaseInterface } from '@drincs/pixi-vn/canvas';
|
|
4
4
|
import { StepLabelPropsType } from '@drincs/pixi-vn/narration';
|
|
5
5
|
import { StorageElementType } from '@drincs/pixi-vn/storage';
|
|
6
6
|
export { V as VariableGetter, a as VariableGetterHandler } from './VariableGetter-ZDA6kdah.cjs';
|
|
@@ -68,6 +68,49 @@ declare function effectOperation(operation: PixiVNJsonCanvasEffect): Promise<voi
|
|
|
68
68
|
*/
|
|
69
69
|
declare function animateOperation(operation: PixiVNJsonCanvasAnimate): void;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* GENERATED FILE — do not edit by hand.
|
|
73
|
+
* Produced by `scripts/generate-entrance-transition-schemas.mjs` from
|
|
74
|
+
* `@drincs/pixi-vn`'s own transition prop types. Re-run that script (see its header comment) to
|
|
75
|
+
* refresh this file after those types change.
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* JSON Schemas (usable as `@drincs/pixi-vn-ink`'s `HashtagHandlerOptions.keySchemas` values, or
|
|
79
|
+
* with any other JSON Schema validator) for each entrance transition's own props, keyed by
|
|
80
|
+
* transition name.
|
|
81
|
+
*/
|
|
82
|
+
declare const entranceTransitionKeySchemas: Record<string, object>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The transition types used to bring a canvas element **in** (as opposed to
|
|
86
|
+
* `moveout`/`zoomout`/`pushout`, used only to remove one). `dissolve`/`fade` have no direction —
|
|
87
|
+
* they're shared with removal — but are still "entrance" transitions in the sense that
|
|
88
|
+
* {@link entranceTransitionKeySchemas} validates them the same way for a `show`-style command.
|
|
89
|
+
*/
|
|
90
|
+
declare const ENTRANCE_TRANSITION_TYPES: readonly ["dissolve", "fade", "movein", "zoomin", "pushin"];
|
|
91
|
+
/**
|
|
92
|
+
* One of {@link ENTRANCE_TRANSITION_TYPES}.
|
|
93
|
+
*/
|
|
94
|
+
type EntranceTransitionType = (typeof ENTRANCE_TRANSITION_TYPES)[number];
|
|
95
|
+
/**
|
|
96
|
+
* Runs an entrance transition on a canvas element — the same dispatch this package's own
|
|
97
|
+
* interpreter uses internally (see `@/actions/canvas`) for the built-in
|
|
98
|
+
* `image`/`video`/`text`/`imagecontainer` `show` operations (`showWithDissolve`, `showWithFade`,
|
|
99
|
+
* `moveIn`, `zoomIn`, `pushIn`), exposed here so a third-party canvas-component library (e.g.
|
|
100
|
+
* `pixi-vn-spine`) can reuse it for its own custom operation/command instead of re-implementing
|
|
101
|
+
* the type → function mapping.
|
|
102
|
+
*
|
|
103
|
+
* @param alias The unique alias the element is (or will be) registered under on the canvas.
|
|
104
|
+
* @param component The canvas element to show (e.g. a `Spine` instance already built by the
|
|
105
|
+
* caller). Matches the `component` parameter of `@drincs/pixi-vn`'s own `showWithDissolve`/
|
|
106
|
+
* `moveIn`/etc.
|
|
107
|
+
* @param transitionType Which entrance transition to run (e.g. `"dissolve"`).
|
|
108
|
+
* @param props The transition's own props (e.g. `{ duration: 2 }`), typically validated against
|
|
109
|
+
* {@link entranceTransitionKeySchemas} beforehand.
|
|
110
|
+
* @returns The ids of the tickers used by the transition, once it starts.
|
|
111
|
+
*/
|
|
112
|
+
declare function executeEntranceTransition(alias: string, component: CanvasBaseInterface<any> | undefined, transitionType: EntranceTransitionType, props?: object): Promise<string[] | undefined>;
|
|
113
|
+
|
|
71
114
|
/**
|
|
72
115
|
* Handles narration-related operations such as requesting player input or
|
|
73
116
|
* clearing the current dialogue line.
|
|
@@ -132,4 +175,4 @@ declare function getValueFromConditionalStatements<T>(statement: PixiVNJsonCondi
|
|
|
132
175
|
*/
|
|
133
176
|
declare function getConditionalStep(originalStep: PixiVNJsonLabelStep, props?: StepLabelPropsType): PixiVNJsonLabelStep;
|
|
134
177
|
|
|
135
|
-
export { animateOperation, canvasElementOperation, canvasOperation, effectOperation, getConditionalStep, getLogichValue, getValueFromConditionalStatements, imageContainerOperation, imageOperation, loadAssets, narrationOperation, setInitialStorageValue, setStorageValue, soundOperation, textOperation, videoOperation };
|
|
178
|
+
export { ENTRANCE_TRANSITION_TYPES, type EntranceTransitionType, animateOperation, canvasElementOperation, canvasOperation, effectOperation, entranceTransitionKeySchemas, executeEntranceTransition, getConditionalStep, getLogichValue, getValueFromConditionalStatements, imageContainerOperation, imageOperation, loadAssets, narrationOperation, setInitialStorageValue, setStorageValue, soundOperation, textOperation, videoOperation };
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as PixiVNJsonIfElse, c as PixiVNJsonValueGet, d as PixiVNJsonArithmeticOperations, e as PixiVNJsonConditions, m as PixiVNJsonFunction, f as PixiVNJsonConditionalStatements, l as PixiVNJsonConditionalResultToCombine, b as PixiVNJsonOnlyStorageSet, a as PixiVNJsonValueSet } from './PixiVNJsonIfElse-B_OG8Qs1.js';
|
|
2
2
|
import { P as PixiVNJsonOperation, a as PixiVNJsonOperationString, o as PixiVNJsonCanvasAnimate, l as PixiVNJsonUnknownEdit, e as PixiVNJsonCanvasRemove, p as PixiVNJsonCanvasClear, n as PixiVNJsonCanvasEffect, h as PixiVNJsonCanvasImageContainerShow, i as PixiVNJsonImageContainerEdit, c as PixiVNJsonCanvasImageVideoShow, d as PixiVNJsonImageEdit, j as PixiVNJsonCanvasTextShow, k as PixiVNJsonTextEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume, m as PixiVNJsonNarration, b as PixiVNJsonSound, q as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-CELQY8TP.js';
|
|
3
|
-
import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild } from '@drincs/pixi-vn/canvas';
|
|
3
|
+
import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild, CanvasBaseInterface } from '@drincs/pixi-vn/canvas';
|
|
4
4
|
import { StepLabelPropsType } from '@drincs/pixi-vn/narration';
|
|
5
5
|
import { StorageElementType } from '@drincs/pixi-vn/storage';
|
|
6
6
|
export { V as VariableGetter, a as VariableGetterHandler } from './VariableGetter-ZDA6kdah.js';
|
|
@@ -68,6 +68,49 @@ declare function effectOperation(operation: PixiVNJsonCanvasEffect): Promise<voi
|
|
|
68
68
|
*/
|
|
69
69
|
declare function animateOperation(operation: PixiVNJsonCanvasAnimate): void;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* GENERATED FILE — do not edit by hand.
|
|
73
|
+
* Produced by `scripts/generate-entrance-transition-schemas.mjs` from
|
|
74
|
+
* `@drincs/pixi-vn`'s own transition prop types. Re-run that script (see its header comment) to
|
|
75
|
+
* refresh this file after those types change.
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* JSON Schemas (usable as `@drincs/pixi-vn-ink`'s `HashtagHandlerOptions.keySchemas` values, or
|
|
79
|
+
* with any other JSON Schema validator) for each entrance transition's own props, keyed by
|
|
80
|
+
* transition name.
|
|
81
|
+
*/
|
|
82
|
+
declare const entranceTransitionKeySchemas: Record<string, object>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The transition types used to bring a canvas element **in** (as opposed to
|
|
86
|
+
* `moveout`/`zoomout`/`pushout`, used only to remove one). `dissolve`/`fade` have no direction —
|
|
87
|
+
* they're shared with removal — but are still "entrance" transitions in the sense that
|
|
88
|
+
* {@link entranceTransitionKeySchemas} validates them the same way for a `show`-style command.
|
|
89
|
+
*/
|
|
90
|
+
declare const ENTRANCE_TRANSITION_TYPES: readonly ["dissolve", "fade", "movein", "zoomin", "pushin"];
|
|
91
|
+
/**
|
|
92
|
+
* One of {@link ENTRANCE_TRANSITION_TYPES}.
|
|
93
|
+
*/
|
|
94
|
+
type EntranceTransitionType = (typeof ENTRANCE_TRANSITION_TYPES)[number];
|
|
95
|
+
/**
|
|
96
|
+
* Runs an entrance transition on a canvas element — the same dispatch this package's own
|
|
97
|
+
* interpreter uses internally (see `@/actions/canvas`) for the built-in
|
|
98
|
+
* `image`/`video`/`text`/`imagecontainer` `show` operations (`showWithDissolve`, `showWithFade`,
|
|
99
|
+
* `moveIn`, `zoomIn`, `pushIn`), exposed here so a third-party canvas-component library (e.g.
|
|
100
|
+
* `pixi-vn-spine`) can reuse it for its own custom operation/command instead of re-implementing
|
|
101
|
+
* the type → function mapping.
|
|
102
|
+
*
|
|
103
|
+
* @param alias The unique alias the element is (or will be) registered under on the canvas.
|
|
104
|
+
* @param component The canvas element to show (e.g. a `Spine` instance already built by the
|
|
105
|
+
* caller). Matches the `component` parameter of `@drincs/pixi-vn`'s own `showWithDissolve`/
|
|
106
|
+
* `moveIn`/etc.
|
|
107
|
+
* @param transitionType Which entrance transition to run (e.g. `"dissolve"`).
|
|
108
|
+
* @param props The transition's own props (e.g. `{ duration: 2 }`), typically validated against
|
|
109
|
+
* {@link entranceTransitionKeySchemas} beforehand.
|
|
110
|
+
* @returns The ids of the tickers used by the transition, once it starts.
|
|
111
|
+
*/
|
|
112
|
+
declare function executeEntranceTransition(alias: string, component: CanvasBaseInterface<any> | undefined, transitionType: EntranceTransitionType, props?: object): Promise<string[] | undefined>;
|
|
113
|
+
|
|
71
114
|
/**
|
|
72
115
|
* Handles narration-related operations such as requesting player input or
|
|
73
116
|
* clearing the current dialogue line.
|
|
@@ -132,4 +175,4 @@ declare function getValueFromConditionalStatements<T>(statement: PixiVNJsonCondi
|
|
|
132
175
|
*/
|
|
133
176
|
declare function getConditionalStep(originalStep: PixiVNJsonLabelStep, props?: StepLabelPropsType): PixiVNJsonLabelStep;
|
|
134
177
|
|
|
135
|
-
export { animateOperation, canvasElementOperation, canvasOperation, effectOperation, getConditionalStep, getLogichValue, getValueFromConditionalStatements, imageContainerOperation, imageOperation, loadAssets, narrationOperation, setInitialStorageValue, setStorageValue, soundOperation, textOperation, videoOperation };
|
|
178
|
+
export { ENTRANCE_TRANSITION_TYPES, type EntranceTransitionType, animateOperation, canvasElementOperation, canvasOperation, effectOperation, entranceTransitionKeySchemas, executeEntranceTransition, getConditionalStep, getLogichValue, getValueFromConditionalStatements, imageContainerOperation, imageOperation, loadAssets, narrationOperation, setInitialStorageValue, setStorageValue, soundOperation, textOperation, videoOperation };
|
package/dist/actions.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {Assets,canvas,ImageSprite,showImage,VideoSprite,showVideo,ImageContainer,showImageContainer,Text,showText,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {translator}from'@drincs/pixi-vn-json/translator';import {NarrationManagerStatic,narration}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {storage}from'@drincs/pixi-vn/storage';async function Je(e){let t=JsonUnifier.getLogichValue(e,{});if(t)switch(t.type){case "assets":switch(t.operationType){case "load":await Assets.load(t.aliases);break;case "lazyload":Assets.backgroundLoad(t.aliases);break}break;case "bundle":switch(t.operationType){case "load":await Assets.loadBundle(t.aliases);break;case "lazyload":Assets.backgroundLoadBundle(t.aliases);break}break}}var n;(o=>(o.log=(r,...l)=>console.log(`[Pixi\u2019VN Json] ${r}`,...l),o.warn=(r,...l)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...l),o.error=(r,...l)=>console.error(`[Pixi\u2019VN Json] ${r}`,...l),o.info=(r,...l)=>console.info(`[Pixi\u2019VN Json] ${r}`,...l)))(n||={});async function w(e,t,i){switch(i.type){case "fade":await showWithFade(t.alias,e,i.props,i.priority);break;case "dissolve":await showWithDissolve(t.alias,e,i.props,i.priority);break;case "movein":case "moveout":await moveIn(t.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(t.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(t.alias,e,i.props,i.priority);break}}function v(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function Oe(e){switch(e.operationType){case "show":if(e.transition){let t=new ImageSprite(e.props,e.url||e.alias);await w(t,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Image with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function Ae(e){switch(e.operationType){case "show":if(e.transition){let t=new VideoSprite(e.props,e.url||e.alias);await w(t,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Video with alias ${e.alias} not found.`);break}case "remove":v(e);break;case "pause":case "resume":{let t=canvas.find(e.alias);t?t.paused=e.operationType==="pause":n.error(`Video with alias ${e.alias} not found.`);break}}}async function ke(e){switch(e.operationType){case "show":if(e.transition){let t=new ImageContainer(e.props,e.urls);await w(t,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function je(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.t(e.text),e.transition){let t=new Text(e.props);await w(t,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Text with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function Le(e){switch(e.operationType){case "edit":try{let t=canvas.find(e.alias);t?e.props&&t.setMemory({...t.memory,...e.props}):n.error(`Canvas Element with alias ${e.alias} not found.`);}catch(t){n.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,t);}break;case "remove":v(e);break}}function Ie(e){e.operationType==="clear"&&canvas.removeAll();}async function Ee(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function Re(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function Me(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function Fe(e){switch(e.operationType){case "play":e.url?sound.play(e.alias,e.url,e.props):sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.stop(e.alias);break;case "all":sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.pause(e.alias);break;case "channel":sound.findChannel(e.alias).pauseAll();break;case "all":sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.resume(e.alias);break;case "channel":sound.findChannel(e.alias).resumeAll();break;case "all":sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([t,i])=>{let a=sound.find(e.alias);a&&(t==="volume"?a.volume.value=i:a.paused=i);});break}}var b="___param___";var h=class e{static init(t){t.loadAssets&&(e._loadAssets=t.loadAssets),t.soundOperation&&(e._soundOperation=t.soundOperation),t.imageOperation&&(e._imageOperation=t.imageOperation),t.videoOperation&&(e._videoOperation=t.videoOperation),t.imageContainerOperation&&(e._imageContainerOperation=t.imageContainerOperation),t.textOperation&&(e._textOperation=t.textOperation),t.canvasElementOperation&&(e._canvasElementOperation=t.canvasElementOperation),t.setStorageValue&&(e._setStorageValue=t.setStorageValue),t.setInitialStorageValue&&(e._setInitialStorageValue=t.setInitialStorageValue),t.narrationOperation&&(e._narrationOperation=t.narrationOperation),t.effectOperation&&(e._effectOperation=t.effectOperation),t.animateOperation&&(e._animateOperation=t.animateOperation),t.canvasOperation&&(e._canvasOperation=t.canvasOperation),t.getLogichValue&&(e._getLogichValue=t.getLogichValue),t.getConditionalStep&&(e._getConditionalStep=t.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return e._loadAssets}static _soundOperation=()=>{throw n.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 e._soundOperation}static _imageOperation=()=>{throw n.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 e._imageOperation}static _videoOperation=()=>{throw n.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 e._videoOperation}static _imageContainerOperation=()=>{throw n.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 e._imageContainerOperation}static _textOperation=()=>{throw n.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 e._textOperation}static _canvasElementOperation=()=>{throw n.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 e._canvasElementOperation}static _setStorageValue=()=>{throw n.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 e._setStorageValue}static _setInitialStorageValue=()=>{throw n.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 e._setInitialStorageValue}static _narrationOperation=()=>{throw n.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 e._narrationOperation}static _effectOperation=()=>{throw n.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 e._effectOperation}static _animateOperation=()=>{throw n.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 e._animateOperation}static _canvasOperation=()=>{throw n.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 e._canvasOperation}static _getLogichValue=()=>{throw n.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 e._getLogichValue}static _getConditionalStep=()=>{throw n.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 e._getConditionalStep}};function _(e,t){if(t&&typeof t=="object"&&typeof e.functionName=="string"&&e.functionName in t){let i=t[e.functionName];if(typeof i=="function"){let a=e.args.map(o=>h.getLogichValue(o,t));return i(...a)}else n.warn(`getLogichValue function ${e.functionName} not found in props`);}}function z(e,t){let i=JsonUnifier.getLogichValue(e,t);return i&&typeof i=="object"&&"type"in i?JsonUnifier.getLogichValue(i,t):i}function ui(e,t={}){let i=z(e.value,t);switch(e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,i);break;case "tempstorage":storage.setTempVariable(e.key,i);break;case "params":{let a=storage.get(`${b}${narration.openedLabels.length-1}`)||[];a.length>e.key&&(a[e.key]=i),storage.setTempVariable(`${b}${narration.openedLabels.length-1}`,a);break}}}function di(e,t={}){let i=z(e.value,t);switch(e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:i};break}}function k(e,t={}){let i=j(e,t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return xe(i,t);case "arithmetic":case "arithmeticsingle":return me(i,t);case "compare":case "union":return ge(i,t);case "function":return _(i,t)}return i}function me(e,t){let i=JsonUnifier.getLogichValue(e.leftValue,t);switch(e.type){case "arithmetic":{let a=JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "*":return i*a;case "/":return i/a;case "+":return typeof i=="string"||typeof a=="string"?`${i}${a}`:Array.isArray(i)&&Array.isArray(a)?[...i,...a]:Array.isArray(i)?[...i,a]:Array.isArray(a)?[i,...a]:i+a;case "-":if(Array.isArray(i)&&Array.isArray(a))return i.filter(o=>!a.includes(o));if(Array.isArray(i))return i.filter(o=>o!==a);if(Array.isArray(a)){n.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return i-a;case "%":return i%a;case "POW":return i**a;case "RANDOM":return narration.getRandomNumber(i,a);case "INTERSECTION":if(Array.isArray(i)&&Array.isArray(a))return i.filter(o=>a.includes(o));n.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:n.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(i);case "FLOOR":return Math.floor(i);}break}}function xe(e,t){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.inputValue:storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return JsonUnifier.getLogichValue(e.operation,t);case "params":{let i=storage.get(`${b}${narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];n.warn("getValue params not found");return}}return e}function ge(e,t){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let i=JsonUnifier.getLogichValue(e.leftValue,t),a=JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "==":return Array.isArray(i)&&Array.isArray(a)?i.length===a.length&&i.every(o=>a.includes(o)):i===a;case "!=":return Array.isArray(i)&&Array.isArray(a)?i.length!==a.length||!i.every(o=>a.includes(o)):i!==a;case "<":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<0:Array.isArray(i)&&Array.isArray(a)?i.length<a.length:i<a;case "<=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<=0:Array.isArray(i)&&Array.isArray(a)?i.length<=a.length:i<=a;case ">":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>0:Array.isArray(i)&&Array.isArray(a)?i.length>a.length:i>a;case ">=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>=0:Array.isArray(i)&&Array.isArray(a)?i.length>=a.length:i>=a;case "CONTAINS":return Array.isArray(i)&&Array.isArray(a)?a.every(o=>i.includes(o)):Array.isArray(i)?i.includes(a):i.toString().includes(a.toString())}break}case "value":{let i=JsonUnifier.getLogichValue(e,t);return Array.isArray(i)?i.length>0:i&&typeof i=="object"?Object.keys(i).length>0:!!i}case "union":return Ve(e,t)}return !!e}function Ve(e,t){if(e.unionType==="not"){let a=k(e.condition,t);return Array.isArray(a)?a.length===0:a&&typeof a=="object"?Object.keys(a).length===0:!a}let i=a=>JsonUnifier.getLogichValue(a,t)||false;return e.unionType==="and"?e.conditions.every(i):e.conditions.some(i)}function fe(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function j(e,t={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return ye(e,t);case "ifelse":return JsonUnifier.getLogichValue(e.condition,t)?JsonUnifier.getLogichValue(e.then,t):JsonUnifier.getLogichValue(e.else,t);case "stepswitch":{let i=JsonUnifier.getLogichValue(e.elements,t)||[];if(i.length===0){n.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let a=fe(0,i.length-1);return JsonUnifier.getLogichValue(i[a],t)}case "loop":{let a=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return a>i.length-1?(a=a%i.length,JsonUnifier.getLogichValue(i[a],t)):JsonUnifier.getLogichValue(i[a],t)}case "sequential":{let a,o=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(a=JsonUnifier.getLogichValue(i[i.length-1],t)),o>i.length-1?a:JsonUnifier.getLogichValue(i[o],t)}case "sequentialrandom":{let a=NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(a===void 0&&e.end==="lastItem"){let o=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!o?.usedRandomNumbers){n.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let r=o.usedRandomNumbers[`0-${i.length-1}`];return JsonUnifier.getLogichValue(i[r[r.length-1]],t)}if(a===void 0){n.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return JsonUnifier.getLogichValue(i[a],t)}}}}return e}function M(e,t={}){if(e.conditionalStep){let i=createExportableElement(JsonUnifier.getLogichValue(e.conditionalStep,t));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let a={...e,conditionalStep:void 0,...i};return M(a,t)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function ye(e,t){let i=e.firstItem,a=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(l=>JsonUnifier.getLogichValue(l,t)):[JsonUnifier.getLogichValue(r,t)]),o=i?[i,...a]:a;if(o.length===0){n.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator.t(o);if(typeof o[0]=="object"){let r=o,l,P=false,N=r.map((c,f)=>{c=M(c,t);let u=JsonUnifier.getLogichValue(c.dialogue,t)||"";return f===0?(l=JsonUnifier.getLogichValue(c.glueEnabled,t)||false,u):(typeof u=="object"&&"text"in u&&(u=`${u.character}: ${u.text}`),l===false&&P&&(u=`
|
|
1
|
+
import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {Assets,canvas,ImageSprite,showImage,VideoSprite,showVideo,ImageContainer,showImageContainer,Text,showText,shakeEffect,pushIn,zoomIn,moveIn,showWithFade,showWithDissolve,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade}from'@drincs/pixi-vn/canvas';import {translator}from'@drincs/pixi-vn-json/translator';import {NarrationManagerStatic,narration}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {storage}from'@drincs/pixi-vn/storage';async function Ce(e){let i=JsonUnifier.getLogichValue(e,{});if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await Assets.load(i.aliases);break;case "lazyload":Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await Assets.loadBundle(i.aliases);break;case "lazyload":Assets.backgroundLoadBundle(i.aliases);break}break}}var a;(o=>(o.log=(r,...p)=>console.log(`[Pixi\u2019VN Json] ${r}`,...p),o.warn=(r,...p)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...p),o.error=(r,...p)=>console.error(`[Pixi\u2019VN Json] ${r}`,...p),o.info=(r,...p)=>console.info(`[Pixi\u2019VN Json] ${r}`,...p)))(a||={});async function J(e,i,t){switch(t.type){case "fade":await showWithFade(i.alias,e,t.props,t.priority);break;case "dissolve":await showWithDissolve(i.alias,e,t.props,t.priority);break;case "movein":case "moveout":await moveIn(i.alias,e,t.props,t.priority);break;case "zoomin":case "zoomout":await zoomIn(i.alias,e,t.props,t.priority);break;case "pushin":case "pushout":await pushIn(i.alias,e,t.props,t.priority);break}}function N(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function Ee(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageSprite(e.props,e.url||e.alias);await J(i,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Image with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function Re(e){switch(e.operationType){case "show":if(e.transition){let i=new VideoSprite(e.props,e.url||e.alias);await J(i,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Video with alias ${e.alias} not found.`);break}case "remove":N(e);break;case "pause":case "resume":{let i=canvas.find(e.alias);i?i.paused=e.operationType==="pause":a.error(`Video with alias ${e.alias} not found.`);break}}}async function _e(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageContainer(e.props,e.urls);await J(i,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function De(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.t(e.text),e.transition){let i=new Text(e.props);await J(i,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Text with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function ze(e){switch(e.operationType){case "edit":try{let i=canvas.find(e.alias);i?e.props&&i.setMemory({...i.memory,...e.props}):a.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){a.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":N(e);break}}function Me(e){e.operationType==="clear"&&canvas.removeAll();}async function Ge(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function $e(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}var ue={dissolve:{type:"object",properties:{forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},fade:{type:"object",properties:{forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},movein:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},zoomin:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},pushin:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false}};var We=["dissolve","fade","movein","zoomin","pushin"];async function Be(e,i,t,n){switch(t){case "dissolve":return showWithDissolve(e,i,n);case "fade":return showWithFade(e,i,n);case "movein":return moveIn(e,i,n);case "zoomin":return zoomIn(e,i,n);case "pushin":return pushIn(e,i,n)}}function Ye(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function et(e){switch(e.operationType){case "play":e.url?sound.play(e.alias,e.url,e.props):sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.stop(e.alias);break;case "all":sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.pause(e.alias);break;case "channel":sound.findChannel(e.alias).pauseAll();break;case "all":sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.resume(e.alias);break;case "channel":sound.findChannel(e.alias).resumeAll();break;case "all":sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([i,t])=>{let n=sound.find(e.alias);n&&(i==="volume"?n.volume.value=t:n.paused=t);});break}}var S="___param___";var V=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.canvasOperation&&(e._canvasOperation=i.canvasOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return e._loadAssets}static _soundOperation=()=>{throw a.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 e._soundOperation}static _imageOperation=()=>{throw a.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 e._imageOperation}static _videoOperation=()=>{throw a.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 e._videoOperation}static _imageContainerOperation=()=>{throw a.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 e._imageContainerOperation}static _textOperation=()=>{throw a.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 e._textOperation}static _canvasElementOperation=()=>{throw a.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 e._canvasElementOperation}static _setStorageValue=()=>{throw a.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 e._setStorageValue}static _setInitialStorageValue=()=>{throw a.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 e._setInitialStorageValue}static _narrationOperation=()=>{throw a.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 e._narrationOperation}static _effectOperation=()=>{throw a.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 e._effectOperation}static _animateOperation=()=>{throw a.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 e._animateOperation}static _canvasOperation=()=>{throw a.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 e._canvasOperation}static _getLogichValue=()=>{throw a.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 e._getLogichValue}static _getConditionalStep=()=>{throw a.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 e._getConditionalStep}};function _(e,i){if(i&&typeof i=="object"&&typeof e.functionName=="string"&&e.functionName in i){let t=i[e.functionName];if(typeof t=="function"){let n=e.args.map(o=>V.getLogichValue(o,i));return t(...n)}else a.warn(`getLogichValue function ${e.functionName} not found in props`);}}function D(e,i){let t=JsonUnifier.getLogichValue(e,i);return t&&typeof t=="object"&&"type"in t?JsonUnifier.getLogichValue(t,i):t}function Nt(e,i={}){let t=D(e.value,i);switch(e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,t);break;case "tempstorage":storage.setTempVariable(e.key,t);break;case "params":{let n=storage.get(`${S}${narration.openedLabels.length-1}`)||[];n.length>e.key&&(n[e.key]=t),storage.setTempVariable(`${S}${narration.openedLabels.length-1}`,n);break}}}function vt(e,i={}){let t=D(e.value,i);switch(e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:t};break}}function A(e,i={}){let t=k(e,i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return he(t,i);case "arithmetic":case "arithmeticsingle":return Ve(t,i);case "compare":case "union":return Pe(t,i);case "function":return _(t,i)}return t}function Ve(e,i){let t=JsonUnifier.getLogichValue(e.leftValue,i);switch(e.type){case "arithmetic":{let n=JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "*":return t*n;case "/":return t/n;case "+":return typeof t=="string"||typeof n=="string"?`${t}${n}`:Array.isArray(t)&&Array.isArray(n)?[...t,...n]:Array.isArray(t)?[...t,n]:Array.isArray(n)?[t,...n]:t+n;case "-":if(Array.isArray(t)&&Array.isArray(n))return t.filter(o=>!n.includes(o));if(Array.isArray(t))return t.filter(o=>o!==n);if(Array.isArray(n)){a.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return t-n;case "%":return t%n;case "POW":return t**n;case "RANDOM":return narration.getRandomNumber(t,n);case "INTERSECTION":if(Array.isArray(t)&&Array.isArray(n))return t.filter(o=>n.includes(o));a.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:a.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(t);case "FLOOR":return Math.floor(t);}break}}function he(e,i){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.inputValue:storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return JsonUnifier.getLogichValue(e.operation,i);case "params":{let t=storage.get(`${S}${narration.openedLabels.length-1}`)||[];if(t&&t.length>e.key)return t[e.key];a.warn("getValue params not found");return}}return e}function Pe(e,i){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let t=JsonUnifier.getLogichValue(e.leftValue,i),n=JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "==":return Array.isArray(t)&&Array.isArray(n)?t.length===n.length&&t.every(o=>n.includes(o)):t===n;case "!=":return Array.isArray(t)&&Array.isArray(n)?t.length!==n.length||!t.every(o=>n.includes(o)):t!==n;case "<":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)<0:Array.isArray(t)&&Array.isArray(n)?t.length<n.length:t<n;case "<=":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)<=0:Array.isArray(t)&&Array.isArray(n)?t.length<=n.length:t<=n;case ">":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)>0:Array.isArray(t)&&Array.isArray(n)?t.length>n.length:t>n;case ">=":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)>=0:Array.isArray(t)&&Array.isArray(n)?t.length>=n.length:t>=n;case "CONTAINS":return Array.isArray(t)&&Array.isArray(n)?n.every(o=>t.includes(o)):Array.isArray(t)?t.includes(n):t.toString().includes(n.toString())}break}case "value":{let t=JsonUnifier.getLogichValue(e,i);return Array.isArray(t)?t.length>0:t&&typeof t=="object"?Object.keys(t).length>0:!!t}case "union":return Ne(e,i)}return !!e}function Ne(e,i){if(e.unionType==="not"){let n=A(e.condition,i);return Array.isArray(n)?n.length===0:n&&typeof n=="object"?Object.keys(n).length===0:!n}let t=n=>JsonUnifier.getLogichValue(n,i)||false;return e.unionType==="and"?e.conditions.every(t):e.conditions.some(t)}function ve(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function k(e,i={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Te(e,i);case "ifelse":return JsonUnifier.getLogichValue(e.condition,i)?JsonUnifier.getLogichValue(e.then,i):JsonUnifier.getLogichValue(e.else,i);case "stepswitch":{let t=JsonUnifier.getLogichValue(e.elements,i)||[];if(t.length===0){a.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let n=ve(0,t.length-1);return JsonUnifier.getLogichValue(t[n],i)}case "loop":{let n=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>t.length-1?(n=n%t.length,JsonUnifier.getLogichValue(t[n],i)):JsonUnifier.getLogichValue(t[n],i)}case "sequential":{let n,o=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(n=JsonUnifier.getLogichValue(t[t.length-1],i)),o>t.length-1?n:JsonUnifier.getLogichValue(t[o],i)}case "sequentialrandom":{let n=NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:true});if(n===void 0&&e.end==="lastItem"){let o=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!o?.usedRandomNumbers){a.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let r=o.usedRandomNumbers[`0-${t.length-1}`];return JsonUnifier.getLogichValue(t[r[r.length-1]],i)}if(n===void 0){a.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return JsonUnifier.getLogichValue(t[n],i)}}}}return e}function z(e,i={}){if(e.conditionalStep){let t=createExportableElement(JsonUnifier.getLogichValue(e.conditionalStep,i));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operations===void 0&&delete t?.operations,t){let n={...e,conditionalStep:void 0,...t};return z(n,i)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function Te(e,i){let t=e.firstItem,n=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(p=>JsonUnifier.getLogichValue(p,i)):[JsonUnifier.getLogichValue(r,i)]),o=t?[t,...n]:n;if(o.length===0){a.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator.t(o);if(typeof o[0]=="object"){let r=o,p,h=false,P=r.map((c,b)=>{c=z(c,i);let l=JsonUnifier.getLogichValue(c.dialogue,i)||"";return b===0?(p=JsonUnifier.getLogichValue(c.glueEnabled,i)||false,l):(typeof l=="object"&&"text"in l&&(l=`${l.character}: ${l.text}`),p===false&&h&&(l=`
|
|
2
2
|
|
|
3
|
-
${
|
|
3
|
+
${l}`),l&&(h=true),p=JsonUnifier.getLogichValue(c.glueEnabled,i)||false,l)}),g=JsonUnifier.getLogichValue(P[0],i),x=typeof g=="object"&&"character"in g?g.character:void 0,v=P.flatMap(c=>{let b;c&&typeof c=="object"&&"text"in c?b=c.text:b=c;let l;return Array.isArray(b)?l=b.map($=>{let F=JsonUnifier.getLogichValue($,i);return translator.t(`${F}`)}):l=JsonUnifier.getLogichValue(b,i)||"",translator.t(l)}),O=r.find(c=>c.end),M=r.find(c=>c.choices),I=false,L=false;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&(narration.dialogGlue=true),I=r[r.length-1].glueEnabled,L=r.reverse().find(c=>!(c.operations&&(!c.dialogue||!c.choices)))?.goNextStep);let G=r.find(c=>c.labelToOpen),C=[];return r.forEach(c=>{c.operations&&(C=[...C,...c.operations]);}),{dialogue:x?{character:x,text:v}:v,end:O?.end,choices:M?.choices,glueEnabled:I,goNextStep:L,labelToOpen:G?.labelToOpen,operations:C}}}var Je;(o=>{let e=new Set;function i(r){e.add(r);}o.add=i;function t(){e.clear();}o.clear=t;function n(r,p={}){let h=x=>A(x,p)??void 0,P=k(r,p);if(e.size===0)return h(P);let g=h;for(let x of e){let v=g;g=O=>x(O,v)??void 0;}return g(P)}o.getLogichValue=n;})(Je||={});export{We as ENTRANCE_TRANSITION_TYPES,Je as VariableGetter,$e as animateOperation,ze as canvasElementOperation,Me as canvasOperation,Ge as effectOperation,ue as entranceTransitionKeySchemas,Be as executeEntranceTransition,z as getConditionalStep,A as getLogichValue,k as getValueFromConditionalStatements,_e as imageContainerOperation,Ee as imageOperation,Ce as loadAssets,Ye as narrationOperation,vt as setInitialStorageValue,Nt as setStorageValue,et as soundOperation,De as textOperation,Re as videoOperation};
|
package/dist/constants.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var s={version:"1.13.16"};var r="___param___",o=`https://pixi-vn.com/schemas/${s.version}/schema.json`,n=["==","!=","<","<=",">",">=","CONTAINS"];
|
|
2
2
|
exports.PIXIVNJSON_PARAM_ID=r;exports.PIXIVNJSON_SCHEMA_URL=o;exports.PixiVNJsonComparationOperators=n;
|
package/dist/constants.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var s={version:"1.13.16"};var r="___param___",o=`https://pixi-vn.com/schemas/${s.version}/schema.json`,n=["==","!=","<","<=",">",">=","CONTAINS"];
|
|
2
2
|
export{r as PIXIVNJSON_PARAM_ID,o as PIXIVNJSON_SCHEMA_URL,n as PixiVNJsonComparationOperators};
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var actions=require('@drincs/pixi-vn-json/actions'),core=require('@drincs/pixi-vn-json/core'),interpreter=require('@drincs/pixi-vn-json/interpreter'),translator=require('@drincs/pixi-vn-json/translator');var t={version:"1.13.
|
|
2
|
-
Object.defineProperty(exports,"VariableGetter",{enumerable:true,get:function(){return actions.VariableGetter}});exports.PIXIVNJSON_PARAM_ID=
|
|
1
|
+
'use strict';var actions=require('@drincs/pixi-vn-json/actions'),core=require('@drincs/pixi-vn-json/core'),interpreter=require('@drincs/pixi-vn-json/interpreter'),translator=require('@drincs/pixi-vn-json/translator');var t={version:"1.13.16"};var e="___param___",i=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function _(){core.JsonUnifier.init({animateOperation:actions.animateOperation,canvasElementOperation:actions.canvasElementOperation,canvasOperation:actions.canvasOperation,effectOperation:actions.effectOperation,imageContainerOperation:actions.imageContainerOperation,imageOperation:actions.imageOperation,textOperation:actions.textOperation,narrationOperation:actions.narrationOperation,loadAssets:actions.loadAssets,soundOperation:actions.soundOperation,videoOperation:actions.videoOperation,setStorageValue:actions.setStorageValue,setInitialStorageValue:actions.setInitialStorageValue,getLogichValue:actions.VariableGetter.getLogichValue,getConditionalStep:actions.getConditionalStep});}
|
|
2
|
+
Object.defineProperty(exports,"VariableGetter",{enumerable:true,get:function(){return actions.VariableGetter}});exports.PIXIVNJSON_PARAM_ID=e;exports.PIXIVNJSON_SCHEMA_URL=i;exports.PixiVNJsonComparationOperators=r;exports.init=_;Object.keys(interpreter).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return interpreter[k]}})});Object.keys(translator).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return translator[k]}})});
|
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.13.
|
|
2
|
-
export{
|
|
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.13.16"};var e="___param___",i=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function _(){JsonUnifier.init({animateOperation:animateOperation,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,_ as init};
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drincs/pixi-vn-json",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.16",
|
|
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",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"scripts"
|
|
11
12
|
],
|
|
12
13
|
"scripts": {
|
|
13
14
|
"dev": "tsup --watch",
|
|
14
15
|
"build": "tsup --config tsup.config.ts",
|
|
15
16
|
"generate-schema": "node scripts/generate-schema.mjs",
|
|
17
|
+
"generate-entrance-transition-schemas": "node scripts/generate-entrance-transition-schemas.mjs",
|
|
16
18
|
"lint": "biome lint",
|
|
17
19
|
"check": "biome check",
|
|
18
20
|
"format": "biome format --write",
|
|
@@ -67,7 +69,8 @@
|
|
|
67
69
|
"import": "./dist/schema.mjs",
|
|
68
70
|
"require": "./dist/schema.cjs",
|
|
69
71
|
"default": "./dist/schema.mjs"
|
|
70
|
-
}
|
|
72
|
+
},
|
|
73
|
+
"./schema-generator": "./scripts/schema-generator.mjs"
|
|
71
74
|
},
|
|
72
75
|
"typesVersions": {
|
|
73
76
|
"*": {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Generates the JSON Schemas used by `entranceTransitionKeySchemas`
|
|
4
|
+
* (src/actions/entrance-transitions.ts) from `@drincs/pixi-vn`'s own transition prop types —
|
|
5
|
+
* `ShowWithDissolveTransitionProps`, `ShowWithFadeTransitionProps`, `MoveInOutProps`,
|
|
6
|
+
* `ZoomInOutProps`, `PushInOutProps` — via this package's own generic
|
|
7
|
+
* TypeScript-interface-to-JSON-Schema generator (`schema-generator.mjs`).
|
|
8
|
+
*
|
|
9
|
+
* These 5 types are read straight off `@drincs/pixi-vn`'s own `.d.ts` (they're not declared
|
|
10
|
+
* anywhere in this package), so no `interfaceDir` is passed — every one of them is generated via
|
|
11
|
+
* the depth-capped "external" path, at the default `maxDepth: 1` ("branching" = 1): each prop
|
|
12
|
+
* type's own direct properties (duration, delay, ease, direction, ...) are typed correctly, but
|
|
13
|
+
* any property that is itself an object (e.g. a `position: { x, y }` some future transition prop
|
|
14
|
+
* might add) collapses to an opaque `{ type: "object" }` rather than being expanded.
|
|
15
|
+
*
|
|
16
|
+
* Run via `npm run generate-entrance-transition-schemas`; re-run whenever `@drincs/pixi-vn`'s
|
|
17
|
+
* transition prop types change.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { writeFileSync } from "node:fs";
|
|
21
|
+
import { dirname, join, resolve } from "node:path";
|
|
22
|
+
import { fileURLToPath } from "node:url";
|
|
23
|
+
import { generateJsonSchema } from "./schema-generator.mjs";
|
|
24
|
+
|
|
25
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const rootDir = resolve(__dirname, "..");
|
|
27
|
+
|
|
28
|
+
const canvasDts = join(rootDir, "node_modules", "@drincs", "pixi-vn", "dist", "canvas.d.ts");
|
|
29
|
+
|
|
30
|
+
const ROOT_TYPE_NAMES = [
|
|
31
|
+
"ShowWithDissolveTransitionProps",
|
|
32
|
+
"ShowWithFadeTransitionProps",
|
|
33
|
+
"MoveInOutProps",
|
|
34
|
+
"ZoomInOutProps",
|
|
35
|
+
"PushInOutProps",
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const { schemas, definitions } = generateJsonSchema({
|
|
39
|
+
rootFiles: [canvasDts],
|
|
40
|
+
rootTypeNames: ROOT_TYPE_NAMES,
|
|
41
|
+
compilerOptions: { types: [] },
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/** Each entry must be self-contained (it's used standalone as one JSON Schema by any validator). */
|
|
45
|
+
function toStandaloneSchema(rootSchema) {
|
|
46
|
+
if (rootSchema.$ref) {
|
|
47
|
+
const key = rootSchema.$ref.replace("#/definitions/", "");
|
|
48
|
+
const { [key]: own, ...rest } = definitions;
|
|
49
|
+
const usedRefs = JSON.stringify(own).match(/#\/definitions\/[A-Za-z0-9_]+/g) ?? [];
|
|
50
|
+
if (usedRefs.length === 0) return own;
|
|
51
|
+
const neededDefinitions = Object.fromEntries(
|
|
52
|
+
usedRefs
|
|
53
|
+
.map((ref) => ref.replace("#/definitions/", ""))
|
|
54
|
+
.filter((k) => k in rest)
|
|
55
|
+
.map((k) => [k, rest[k]]),
|
|
56
|
+
);
|
|
57
|
+
return Object.keys(neededDefinitions).length > 0
|
|
58
|
+
? { ...own, definitions: neededDefinitions }
|
|
59
|
+
: own;
|
|
60
|
+
}
|
|
61
|
+
return rootSchema;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const entranceTransitionKeySchemas = {
|
|
65
|
+
dissolve: toStandaloneSchema(schemas.ShowWithDissolveTransitionProps),
|
|
66
|
+
fade: toStandaloneSchema(schemas.ShowWithFadeTransitionProps),
|
|
67
|
+
movein: toStandaloneSchema(schemas.MoveInOutProps),
|
|
68
|
+
zoomin: toStandaloneSchema(schemas.ZoomInOutProps),
|
|
69
|
+
pushin: toStandaloneSchema(schemas.PushInOutProps),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const outPath = join(rootDir, "src", "actions", "entrance-transition-schemas.generated.ts");
|
|
73
|
+
const banner = `/**
|
|
74
|
+
* GENERATED FILE — do not edit by hand.
|
|
75
|
+
* Produced by \`scripts/generate-entrance-transition-schemas.mjs\` from
|
|
76
|
+
* \`@drincs/pixi-vn\`'s own transition prop types. Re-run that script (see its header comment) to
|
|
77
|
+
* refresh this file after those types change.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* JSON Schemas (usable as \`@drincs/pixi-vn-ink\`'s \`HashtagHandlerOptions.keySchemas\` values, or
|
|
82
|
+
* with any other JSON Schema validator) for each entrance transition's own props, keyed by
|
|
83
|
+
* transition name.
|
|
84
|
+
*/
|
|
85
|
+
export const entranceTransitionKeySchemas: Record<string, object> = `;
|
|
86
|
+
|
|
87
|
+
writeFileSync(outPath, `${banner}${JSON.stringify(entranceTransitionKeySchemas, null, 4)};\n`);
|
|
88
|
+
|
|
89
|
+
console.log(`Generated: ${outPath}`);
|
|
90
|
+
console.log(`Transitions: ${Object.keys(entranceTransitionKeySchemas).join(", ")}`);
|