@drincs/pixi-vn 1.9.3 → 1.9.4
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/README.md +1 -1
- package/dist/{ContainerMemory-BpDgacyr.d.cts → ContainerMemory-DNqSVzLY.d.cts} +12 -116
- package/dist/{ContainerMemory-BpDgacyr.d.ts → ContainerMemory-DNqSVzLY.d.ts} +12 -116
- package/dist/canvas.cjs +2 -2
- package/dist/canvas.d.cts +1279 -551
- package/dist/canvas.d.ts +1279 -551
- package/dist/canvas.mjs +2 -2
- package/dist/characters.mjs +1 -1
- package/dist/{chunk-7P46CLKX.mjs → chunk-5MVDNAT4.mjs} +1 -1
- package/dist/chunk-6OABTG5R.mjs +1 -0
- package/dist/chunk-AW5XWF24.mjs +1 -0
- package/dist/chunk-HD353M4B.mjs +1 -0
- package/dist/chunk-LXIKP2K5.mjs +1 -0
- package/dist/chunk-S7HZUIEI.mjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +57 -1
- package/dist/core.d.ts +57 -1
- package/dist/core.mjs +1 -1
- package/dist/filters.cjs +1 -0
- package/dist/filters.d.cts +182 -0
- package/dist/filters.d.ts +182 -0
- package/dist/filters.mjs +1 -0
- package/dist/history.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.mjs +2 -2
- package/dist/motion.cjs +1 -1
- package/dist/motion.d.cts +30 -8
- package/dist/motion.d.ts +30 -8
- package/dist/motion.mjs +1 -1
- package/dist/narration.mjs +1 -1
- package/dist/pixi/browser.js +170 -169
- package/dist/sound.mjs +1 -1
- package/dist/storage.mjs +1 -1
- package/dist/tickers.cjs +1 -0
- package/dist/tickers.d.cts +555 -0
- package/dist/tickers.d.ts +555 -0
- package/dist/tickers.mjs +1 -0
- package/dist/vite.cjs +6 -6
- package/dist/vite.mjs +6 -6
- package/dist/worker.cjs +1 -1
- package/dist/worker.mjs +1 -1
- package/package.json +22 -1
- package/dist/chunk-AWU37VV6.mjs +0 -1
- package/dist/chunk-QOBPVPCY.mjs +0 -1
- package/dist/chunk-U5BSF6X3.mjs +0 -1
- package/dist/chunk-YBA63R27.mjs +0 -1
package/dist/vite.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {a as a$1,b,c as c$1,d}from'./chunk-3BBZHKU4.mjs';export{c as PIXIVN_DEV_API_ASSETS_MANIFEST,d as PIXIVN_DEV_API_CANVAS_OPTIONS,a as PIXIVN_DEV_API_CHARACTERS,b as PIXIVN_DEV_API_LABELS}from'./chunk-3BBZHKU4.mjs';import {a,c}from'./chunk-K7JIC2F2.mjs';import {mkdirSync,writeFileSync,readFileSync}from'fs';import {isAbsolute,resolve,dirname}from'path';import {glob}from'tinyglobby';var
|
|
2
|
-
`),"utf-8");}catch(r){t?.logger.error(`${h} Failed to write worker file "${e}".`,{error:r instanceof Error?r:new Error(String(r)),timestamp:true});}}function
|
|
3
|
-
`),"utf-8");}function
|
|
4
|
-
Game.testing.enable(${
|
|
5
|
-
`;if(e===
|
|
6
|
-
`):""}},transformIndexHtml(){let e=[];return !
|
|
1
|
+
import {a as a$1,b,c as c$1,d}from'./chunk-3BBZHKU4.mjs';export{c as PIXIVN_DEV_API_ASSETS_MANIFEST,d as PIXIVN_DEV_API_CANVAS_OPTIONS,a as PIXIVN_DEV_API_CHARACTERS,b as PIXIVN_DEV_API_LABELS}from'./chunk-3BBZHKU4.mjs';import {a,c}from'./chunk-K7JIC2F2.mjs';import {mkdirSync,writeFileSync,readFileSync}from'fs';import {isAbsolute,resolve,dirname}from'path';import {glob}from'tinyglobby';import {normalizePath}from'vite';var K=a((he,F)=>{var A=process||{},W=A.argv||[],P=A.env||{},ce=!(P.NO_COLOR||W.includes("--no-color"))&&(!!P.FORCE_COLOR||W.includes("--color")||A.platform==="win32"||(A.stdout||{}).isTTY&&P.TERM!=="dumb"||!!P.CI),le=(n,t,m=n)=>f=>{let u=""+f,l=u.indexOf(t,n.length);return ~l?n+ue(u,t,m,l)+t:n+u+t},ue=(n,t,m,f)=>{let u="",l=0;do u+=n.substring(l,f)+m,l=f+t.length,f=n.indexOf(t,l);while(~f);return u+n.substring(l)},X=(n=ce)=>{let t=n?le:()=>String;return {isColorSupported:n,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};F.exports=X();F.exports.createColors=X;});var T=c(K(),1);var h=T.default.cyan("(pixi-vn)"),V="virtual:pixi-vn-testing",q=`\0${V}`,$="virtual:pixi-vn-worker-register",ee=`\0${$}`;function y(n){return n?Array.isArray(n)?n:[n]:[]}function fe(n){return n?n.bundles.map(t=>t.name):[]}function me(n){if(!n)return [];let t=new Set;for(let m of n.bundles){let f=m.assets;if(Array.isArray(f))for(let u of f){let l=u.alias;if(l)for(let g of Array.isArray(l)?l:[l])t.add(g);}else if(f&&typeof f=="object")for(let u of Object.keys(f))t.add(u);}return Array.from(t)}function ge(n){let t=[],m=[];for(let f of n)try{let u=readFileSync(f,"utf-8"),l=/newLabel\(\s*["']([^"']+)["']/g,g;for(;(g=l.exec(u))!==null;)m.push(g[1]);let p=/new\s+\w*[Cc]haracter\(\s*["']([^"']+)["']/g;for(;(g=p.exec(u))!==null;)t.push(g[1]);}catch{}return {charIds:t,labelIds:m}}function be(n){let t,m,f=new Promise(e=>{m=e;}),u=[...y(n?.content),...y(n?.characters),...y(n?.labels)],l=[],g=[],p=new Set,L=[],w=typeof n?.assetsManifest=="function",te=n?.testing===false,B=typeof n?.testing=="object"?n.testing.windowKey:void 0,v=typeof n?.assetsManifest=="function"?void 0:n?.assetsManifest;async function O(e){if(typeof n?.assetsManifest=="function")try{let r=await n.assetsManifest(e);v=r,x.manifest=r??null;}catch(r){t?.logger.error(`${h} Failed to resolve the assets manifest.`,{error:r instanceof Error?r:new Error(String(r)),timestamp:true});}}let _=new Map;function J(){if(!n?.typeFilePath||!t)return null;let e=n.typeFilePath;return isAbsolute(e)?e:resolve(t.root,e)}function I(){if(!n?.workerFilePath||!t)return null;let e=n.workerFilePath;return isAbsolute(e)?e:resolve(t.root,e)}function re(){let e=I();if(e)try{mkdirSync(dirname(e),{recursive:!0}),writeFileSync(e,["/* eslint-disable */","// noinspection JSUnusedGlobalSymbols","// This file is auto-generated by @drincs/pixi-vn vite plugin. Do not edit manually.",'import { handleGameWorkerMessage } from "@drincs/pixi-vn/worker";',"","self.onmessage = async (event) => {"," const response = await handleGameWorkerMessage(event.data);"," if (response) self.postMessage(response);","};",""].join(`
|
|
2
|
+
`),"utf-8");}catch(r){t?.logger.error(`${h} Failed to write worker file "${e}".`,{error:r instanceof Error?r:new Error(String(r)),timestamp:true});}}function D(){let e=[...g,...Array.from(_.values()).flat()];return Array.from(new Set(e))}function ne(e,r,s,a,o){mkdirSync(dirname(e),{recursive:true});let i=["/* eslint-disable */","// noinspection JSUnusedGlobalSymbols","// This file is auto-generated by @drincs/pixi-vn vite plugin. Do not edit manually."];if(r.length>0){i.push('declare module "@drincs/pixi-vn/characters" {'),i.push(" interface PixivnCharacterIds {");for(let c of r)i.push(` ${JSON.stringify(c)}: never;`);i.push(" }"),i.push("}");}if(s.length>0){i.push('declare module "@drincs/pixi-vn/narration" {'),i.push(" interface PixivnLabelIds {");for(let c of s)i.push(` ${JSON.stringify(c)}: never;`);i.push(" }"),i.push("}");}if(a.length>0||o.length>0){if(i.push('declare module "@drincs/pixi-vn/canvas" {'),a.length>0){i.push(" interface PixivnBundleIds {");for(let c of a)i.push(` ${JSON.stringify(c)}: never;`);i.push(" }");}if(o.length>0){i.push(" interface PixivnAssetAliasIds {");for(let c of o)i.push(` ${JSON.stringify(c)}: never;`);i.push(" }");}i.push("}");}i.push(`export const characterIds = ${JSON.stringify(r)} as const;`);{let c=Object.fromEntries(r.map(d=>[d,d]));i.push(`export const characterIdsEnum = ${JSON.stringify(c)} as const;`);}i.push(`export const labelIds = ${JSON.stringify(s)} as const;`);{let c=Object.fromEntries(s.map(d=>[d,d]));i.push(`export const labelIdsEnum = ${JSON.stringify(c)} as const;`);}i.push(`export const bundleIds = ${JSON.stringify(a)} as const;`);{let c=Object.fromEntries(a.map(d=>[d,d]));i.push(`export const bundleIdsEnum = ${JSON.stringify(c)} as const;`);}i.push(`export const assetAliasIds = ${JSON.stringify(o)} as const;`);{let c=Object.fromEntries(o.map(d=>[d,d]));i.push(`export const assetAliasIdsEnum = ${JSON.stringify(c)} as const;`);}i.push(""),writeFileSync(e,i.join(`
|
|
3
|
+
`),"utf-8");}function se(){x.characters=l,x.labels=D();}function b$1(){se();let e=J();if(e)try{ne(e,l.map(r=>r.id),D(),fe(v),me(v));}catch(r){t?.logger.error(`${h} Failed to write keys file "${e}".`,{error:r instanceof Error?r:new Error(String(r)),timestamp:true});}}async function R(e,r=[]){try{l=(await e("@drincs/pixi-vn/characters")).RegisteredCharacters?.values()??[];}catch{l=[];}try{g=(await e("@drincs/pixi-vn/narration")).RegisteredLabels?.keys()??[];}catch{g=[];}if(r.length>0){let{charIds:a,labelIds:o}=ge(r),i=new Set(l.map(d=>d.id)),c=new Set(g);for(let d of a)i.has(d)||l.push({id:d});for(let d of o)c.has(d)||g.push(d);}let s=l.map(a=>a.id).join(", ")||"none";t?.logger.info(`${h} ${T.default.dim(`${l.length} character(s): [${s}], ${g.length} label(s)`)}`,{timestamp:true});}async function G(e,r){let s=[],a=[...y(n?.characters),...y(n?.labels)],o=await glob(a,{cwd:r,absolute:true,onlyFiles:true});for(let c of o){p.add(normalizePath(c));try{await e(c);}catch{s.push(c);}}await R(e,s),b$1();let i=await glob(y(n?.content),{cwd:r,absolute:true,onlyFiles:true});for(let c of i){p.add(normalizePath(c));try{await e(c);}catch{s.push(c);}}return s}async function j(e,r){try{await e("@drincs/pixi-vn/characters");}catch{}try{await e("@drincs/pixi-vn/narration");}catch{}let s=await G(e,r);await R(e,s),await O(e),b$1(),m();}async function ie(e){for(let s of p)for(let a of e.moduleGraph.getModulesByFile(s)??[])e.moduleGraph.invalidateModule(a);try{(await e.ssrLoadModule("@drincs/pixi-vn/characters")).RegisteredCharacters?.clear?.();}catch{}try{(await e.ssrLoadModule("@drincs/pixi-vn/narration")).RegisteredLabels?.clear?.();}catch{}let r=await G(s=>e.ssrLoadModule(s),t.root);await R(s=>e.ssrLoadModule(s),r),await O(s=>e.ssrLoadModule(s)),b$1();for(let s of L)s();}let x={characters:null,labels:null,manifest:v??null,canvasOptions:null};function S(e,r){return (s,a)=>{if(a.setHeader("Content-Type","application/json"),s.method==="GET"){let o=x[e];if(o===null){a.statusCode=404,a.end(JSON.stringify({error:`${r} not initialized`}));return}a.statusCode=200,a.end(JSON.stringify(o));return}if(s.method==="POST"){let o="";s.on("data",i=>{o+=i.toString();}),s.on("end",()=>{try{x[e]=JSON.parse(o),a.statusCode=201,a.end(JSON.stringify({message:`${r} updated successfully`}));}catch{a.statusCode=400,a.end(JSON.stringify({error:`Invalid JSON format for ${r}`}));}});}}}return {name:"vite-plugin-pixi-vn",enforce:"pre",api:{contentLoaded:f,get characters(){return l},onReload(e){L.push(e);},setExternalLabels(e,r){_.set(e,r),b$1();},clearExternalLabels(e){_.delete(e),b$1();},setAssetsManifest(e){v=e,x.manifest=e,b$1();}},resolveId(e){if(e===V)return q;if(e===$)return ee},load(e){if(e===q)return `import { Game } from "@drincs/pixi-vn";
|
|
4
|
+
Game.testing.enable(${B?JSON.stringify({windowKey:B}):""});
|
|
5
|
+
`;if(e===ee){let r=I();return r?['import { Game } from "@drincs/pixi-vn";',`import PixivnWorker from ${JSON.stringify(`${r}?worker`)};`,"Game.worker.register(new PixivnWorker());",""].join(`
|
|
6
|
+
`):""}},transformIndexHtml(){let e=[];return !te&&t?.command==="serve"&&e.push({tag:"script",attrs:{type:"module",src:`/@id/${V}`},injectTo:"head-prepend"}),n?.autoRegisterWorker&&I()&&e.push({tag:"script",attrs:{type:"module",src:`/@id/${$}`},injectTo:"head-prepend"}),e},config(e,r){if(r.command==="serve"&&u.length>0)return {ssr:{noExternal:["@drincs/pixi-vn"]}}},configResolved(e){t=e,re(),n?.autoRegisterWorker&&!I()&&t.logger.warn(`${h} "autoRegisterWorker" has no effect without "workerFilePath" - set both to auto-register the generated worker.`,{timestamp:true}),u.length===0&&!w&&(b$1(),m());},async buildStart(){if(t?.command!=="build"||u.length===0&&!w)return;let{createServer:e}=await import('vite'),r=await e({root:t.root,configFile:false,resolve:t.resolve,server:{middlewareMode:true},appType:"custom",logLevel:"silent",optimizeDeps:{noDiscovery:true},ssr:{noExternal:["@drincs/pixi-vn"]}});try{await j(s=>r.ssrLoadModule(s),t.root);}catch{m();}finally{await r.close();}},configureServer(e){(u.length>0||w)&&j(r=>e.ssrLoadModule(r),t.root).catch(()=>{m();}),e.middlewares.use(a$1,S("characters","Characters")),e.middlewares.use(b,S("labels","Labels")),e.middlewares.use(c$1,S("manifest","Manifest")),e.middlewares.use(d,S("canvasOptions","Canvas options"));},async hotUpdate({file:e,server:r}){let s=normalizePath(e),a=J();if(a&&s===normalizePath(a))return [];if(u.length>0&&p.has(s)){try{await ie(r);}catch(o){t?.logger.error(`${h} Failed to reload content.`,{error:o instanceof Error?o:new Error(String(o)),timestamp:true});}return []}if(w)try{await O(o=>r.ssrLoadModule(o)),b$1();}catch(o){t?.logger.error(`${h} Failed to refresh the assets manifest.`,{error:o instanceof Error?o:new Error(String(o)),timestamp:true});}}}}export{be as vitePluginPixivn};
|
package/dist/worker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var i=class extends Error{code;constructor(t,r,a,o,m){super(`[Pixi\u2019VN] ${r}`),this.code=t,a==="canvas"&&(this.canvasElementInfo=o,this.parent=m);}canvasElementInfo;parent};var n;(o=>(o.log=(m,...l)=>console.log(`[Pixi\u2019VN] ${m}`,...l),o.warn=(m,...l)=>console.warn(`[Pixi\u2019VN] ${m}`,...l),o.error=(m,...l)=>console.error(`[Pixi\u2019VN] ${m}`,...l),o.info=(m,...l)=>console.info(`[Pixi\u2019VN] ${m}`,...l)))(n||={});(class e{static init(t){t.navigate&&(e._navigate=t.navigate),e._getStepCounter=t.getStepCounter,e._setStepCounter=t.setStepCounter,e._getCurrentGameStepState=t.getCurrentGameStepState,e._restoreGameStepState=t.restoreGameStepState,e._getOpenedLabels=t.getOpenedLabels,e._processNavigationRequests=t.processNavigationRequests,e._getVariable=t.getVariable,e._setVariable=t.setVariable,e._removeVariable=t.removeVariable,e._getFlag=t.getFlag,e._setFlag=t.setFlag,t.onLabelClosing&&(e._onLabelClosing=t.onLabelClosing),e._addHistoryItem=t.addHistoryItem,e._getCharacter=t.getCharacter,e._animate=t.animate;}static _navigate=()=>{n.warn("Navigate function not initialized. You should add the navigate function in the Game.init() method.");};static get navigate(){return e._navigate}static set navigate(t){e._navigate=t;}static _getStepCounter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return e._getStepCounter()}static set stepCounter(t){e._setStepCounter(t);}static _getCurrentGameStepState=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return e._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return e._restoreGameStepState}static _getOpenedLabels=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return e._getOpenedLabels()}static _onPreContinueHandlers=[];static addOnPreContinue(t){e._onPreContinueHandlers.push(t);}static removeOnPreContinue(t){e._onPreContinueHandlers=e._onPreContinueHandlers.filter(r=>r!==t);}static clearOnPreContinueHandlers(){e._onPreContinueHandlers=[];}static async runOnPreContinue(){let t=e._onPreContinueHandlers.slice();await Promise.all(t.map(r=>r()));}static get onPreContinue(){return e.runOnPreContinue}static navigationRequestsCount=0;static processNavigationLock=Promise.resolve();static get continueRequestsCount(){return e.navigationRequestsCount}static increaseContinueRequest(t=1){e.navigationRequestsCount+=t;}static get backRequestsCount(){return -1*e.navigationRequestsCount}static increaseBackRequest(t=1){e.navigationRequestsCount-=t;}static _processNavigationRequests=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static async processNavigationRequests(t){let r=e._processNavigationRequests(e.navigationRequestsCount,t);return e.navigationRequestsCount=r.newValue,await r.result}static _getVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return e._getVariable}static _setVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return e._setVariable}static _removeVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return e._removeVariable}static _getFlag=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return e._getFlag}static _setFlag=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return e._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return e._onLabelClosing}static _addHistoryItem=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return e._addHistoryItem}static runningStepsCount=0;static _getCharacter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented.")};static get getCharacter(){return e._getCharacter}static onEnd;static _onErrorHandlers=[];static addOnError(t){return e._onErrorHandlers.push(t),()=>e.removeOnError(t)}static removeOnError(t){e._onErrorHandlers=e._onErrorHandlers.filter(r=>r!==t);}static clearOnErrorHandlers(){e._onErrorHandlers.length=0;}static async runOnError(t,r){for(let a of e._onErrorHandlers.slice())try{await a(t,r);}catch(o){n.error("Error in onError handler",o);}}static _animate=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get animate(){return e._animate}});function y(e){try{if(typeof e>"u")return e;let t=JSON.stringify(e);return JSON.parse(t)}catch(t){throw n.error("Error creating exportable element",e,t),new i("not_json_serializable","Error creating exportable element")}}function h(e,t){let r=y(e);return t.length>1&&"type"in t[0]&&(t=t.slice().reverse()),t.forEach(a=>{E(r,a);}),r}function E(e,t){let r=e;t.path&&t.path.length>0?t.path.forEach((a,o)=>{if(t.path&&o===t.path.length-1)switch(t.type){case "CHANGE":case "REMOVE":r[a]=t.oldValue;break;case "CREATE":Array.isArray(r)&&typeof a=="number"?r.splice(a,1):delete r[a];break}else r=r[a];}):n.warn("No path found, skipping diff",t);}var w=["Date","RegExp","String","Number"],S=Object.getOwnPropertyNames(globalThis.Temporal||{});function c(e,t,r={cyclesFix:true},a=[]){let o=[],m=Array.isArray(e);for(let p in e){let s=e[p],v=m?+p:p;if(!(p in t)){o.push({type:"REMOVE",path:[v],oldValue:s});continue}let u=t[p],G=typeof s=="object"&&typeof u=="object"&&Array.isArray(s)===Array.isArray(u),g=G&&s?Object.getPrototypeOf(s)?.constructor?.name:void 0;if(s&&u&&G&&!w.includes(g)&&!S.includes(g)&&(!r.cyclesFix||!a.includes(s))){r.cyclesFix&&a.push(s);let k=c(s,u,r,a);r.cyclesFix&&a.pop();for(let C of k)C.path.unshift(v),o.push(C);}else Object.is(s,u)||S.includes(g)&&String(s)===String(u)||w.includes(g)&&(isNaN(s)?s+""==u+"":+s==+u)||o.push({path:[v],type:"CHANGE",value:u,oldValue:s});}let l=Array.isArray(t);for(let p in t)p in e||o.push({type:"CREATE",path:[l?+p:p],value:t[p]});return o}var b=new Map;function x(e,t){b.set(e,t);}function P(e){b.delete(e);}function T(e){return b.get(e)}async function M(e){try{switch(e.type){case "restore-diff":{let t=h(e.state,e.diff);return {id:e.id,type:"restore-diff-result",result:t}}case "diff":{let t=c(e.before,e.after);return {id:e.id,type:"diff-result",result:t}}case "clone":{let t=JSON.parse(JSON.stringify(e.value));return {id:e.id,type:"clone-result",result:t}}case "custom":{let t=T(e.kind);if(!t)throw new Error(`No game worker handler registered for kind "${e.kind}"`);let r=await t(e.payload);return {id:e.id,type:"custom-result",result:r}}}}catch(t){return {id:e.id,type:"error",error:t instanceof Error?t.message:String(t)}}}var d=class e{static _worker;static _pending=new Map;static _nextId=0;static get isAvailable(){return e._worker!==void 0}static register(t){e.unregister(),e._worker=t,t.addEventListener("message",e._handleMessage);}static unregister(){let t=e._worker;if(t){t.removeEventListener("message",e._handleMessage),e._worker=void 0;for(let{reject:r}of e._pending.values())r(new Error("Game worker was unregistered"));e._pending.clear();}}static _handleMessage=t=>{let r=e._pending.get(t.data.id);r&&(e._pending.delete(t.data.id),t.data.type==="error"?r.reject(new Error(t.data.error)):r.resolve(t.data.result));};static _request(t){let r=e._worker;if(!r)return Promise.reject(new Error("No game worker is registered"));let a=e._nextId++;return new Promise((o,m)=>{e._pending.set(a,{resolve:o,reject:m});try{r.postMessage({...t,id:a});}catch(l){e._pending.delete(a),n.error("Error posting message to game worker",l),m(l);}})}static async restoreDiff(t,r){return await e._request({type:"restore-diff",state:t,diff:r})}static async diff(t,r){return await e._request({type:"diff",before:t,after:r})}static async clone(t){return await e._request({type:"clone",value:t})}static async custom(t,r){return await e._request({type:"custom",kind:t,payload:r})}};async function R(e,t){if(d.isAvailable)try{return await d.restoreDiff(e,t)}catch(r){n.warn("Game worker failed to restore diff, falling back to the main thread",r);}return h(e,t)}async function O(e,t){if(d.isAvailable)try{return await d.diff(e,t)}catch(r){n.warn("Game worker failed to compute diff, falling back to the main thread",r);}return c(e,t)}async function H(e){if(d.isAvailable)try{return await d.clone(e)}catch(t){n.warn("Game worker failed to clone value, falling back to the main thread",t);}return y(e)}exports.GameWorkerManager=d;exports.cloneMaybeOffloaded=H;exports.diffMaybeOffloaded=O;exports.handleGameWorkerMessage=M;exports.registerGameWorkerHandler=x;exports.restoreDiffMaybeOffloaded=R;exports.unregisterGameWorkerHandler=P;
|
|
1
|
+
'use strict';var i=class extends Error{code;constructor(t,r,a,o,m){super(`[Pixi\u2019VN] ${r}`),this.code=t,a==="canvas"&&(this.canvasElementInfo=o,this.parent=m);}canvasElementInfo;parent};var n;(o=>(o.log=(m,...l)=>console.log(`[Pixi\u2019VN] ${m}`,...l),o.warn=(m,...l)=>console.warn(`[Pixi\u2019VN] ${m}`,...l),o.error=(m,...l)=>console.error(`[Pixi\u2019VN] ${m}`,...l),o.info=(m,...l)=>console.info(`[Pixi\u2019VN] ${m}`,...l)))(n||={});(class e{static init(t){t.navigate&&(e._navigate=t.navigate),e._getStepCounter=t.getStepCounter,e._setStepCounter=t.setStepCounter,e._getCurrentGameStepState=t.getCurrentGameStepState,e._restoreGameStepState=t.restoreGameStepState,e._getOpenedLabels=t.getOpenedLabels,e._processNavigationRequests=t.processNavigationRequests,e._getVariable=t.getVariable,e._setVariable=t.setVariable,e._removeVariable=t.removeVariable,e._getFlag=t.getFlag,e._setFlag=t.setFlag,t.onLabelClosing&&(e._onLabelClosing=t.onLabelClosing),e._addHistoryItem=t.addHistoryItem,e._getCharacter=t.getCharacter,e._animate=t.animate,e._animateFilter=t.animateFilter,e._removeCanvasComponent=t.removeCanvasComponent,e._canvasComponentExists=t.canvasComponentExists;}static _navigate=()=>{n.warn("Navigate function not initialized. You should add the navigate function in the Game.init() method.");};static get navigate(){return e._navigate}static set navigate(t){e._navigate=t;}static _getStepCounter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return e._getStepCounter()}static set stepCounter(t){e._setStepCounter(t);}static _getCurrentGameStepState=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return e._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return e._restoreGameStepState}static _getOpenedLabels=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return e._getOpenedLabels()}static _onPreContinueHandlers=[];static addOnPreContinue(t){e._onPreContinueHandlers.push(t);}static removeOnPreContinue(t){e._onPreContinueHandlers=e._onPreContinueHandlers.filter(r=>r!==t);}static clearOnPreContinueHandlers(){e._onPreContinueHandlers=[];}static async runOnPreContinue(){let t=e._onPreContinueHandlers.slice();await Promise.all(t.map(r=>r()));}static get onPreContinue(){return e.runOnPreContinue}static navigationRequestsCount=0;static processNavigationLock=Promise.resolve();static get continueRequestsCount(){return e.navigationRequestsCount}static increaseContinueRequest(t=1){e.navigationRequestsCount+=t;}static get backRequestsCount(){return -1*e.navigationRequestsCount}static increaseBackRequest(t=1){e.navigationRequestsCount-=t;}static _processNavigationRequests=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static async processNavigationRequests(t){let r=e._processNavigationRequests(e.navigationRequestsCount,t);return e.navigationRequestsCount=r.newValue,await r.result}static _getVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return e._getVariable}static _setVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return e._setVariable}static _removeVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return e._removeVariable}static _getFlag=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return e._getFlag}static _setFlag=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return e._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return e._onLabelClosing}static _addHistoryItem=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return e._addHistoryItem}static runningStepsCount=0;static _getCharacter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented.")};static get getCharacter(){return e._getCharacter}static onEnd;static _onErrorHandlers=[];static addOnError(t){return e._onErrorHandlers.push(t),()=>e.removeOnError(t)}static removeOnError(t){e._onErrorHandlers=e._onErrorHandlers.filter(r=>r!==t);}static clearOnErrorHandlers(){e._onErrorHandlers.length=0;}static async runOnError(t,r){for(let a of e._onErrorHandlers.slice())try{await a(t,r);}catch(o){n.error("Error in onError handler",o);}}static _animate=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get animate(){return e._animate}static _animateFilter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get animateFilter(){return e._animateFilter}static _removeCanvasComponent=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get removeCanvasComponent(){return e._removeCanvasComponent}static _canvasComponentExists=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get canvasComponentExists(){return e._canvasComponentExists}});function y(e){try{if(typeof e>"u")return e;let t=JSON.stringify(e);return JSON.parse(t)}catch(t){throw n.error("Error creating exportable element",e,t),new i("not_json_serializable","Error creating exportable element")}}function h(e,t){let r=y(e);return t.length>1&&"type"in t[0]&&(t=t.slice().reverse()),t.forEach(a=>{k(r,a);}),r}function k(e,t){let r=e;t.path&&t.path.length>0?t.path.forEach((a,o)=>{if(t.path&&o===t.path.length-1)switch(t.type){case "CHANGE":case "REMOVE":r[a]=t.oldValue;break;case "CREATE":Array.isArray(r)&&typeof a=="number"?r.splice(a,1):delete r[a];break}else r=r[a];}):n.warn("No path found, skipping diff",t);}var w=["Date","RegExp","String","Number"],E=Object.getOwnPropertyNames(globalThis.Temporal||{});function c(e,t,r={cyclesFix:true},a=[]){let o=[],m=Array.isArray(e);for(let p in e){let s=e[p],v=m?+p:p;if(!(p in t)){o.push({type:"REMOVE",path:[v],oldValue:s});continue}let u=t[p],G=typeof s=="object"&&typeof u=="object"&&Array.isArray(s)===Array.isArray(u),g=G&&s?Object.getPrototypeOf(s)?.constructor?.name:void 0;if(s&&u&&G&&!w.includes(g)&&!E.includes(g)&&(!r.cyclesFix||!a.includes(s))){r.cyclesFix&&a.push(s);let S=c(s,u,r,a);r.cyclesFix&&a.pop();for(let C of S)C.path.unshift(v),o.push(C);}else Object.is(s,u)||E.includes(g)&&String(s)===String(u)||w.includes(g)&&(isNaN(s)?s+""==u+"":+s==+u)||o.push({path:[v],type:"CHANGE",value:u,oldValue:s});}let l=Array.isArray(t);for(let p in t)p in e||o.push({type:"CREATE",path:[l?+p:p],value:t[p]});return o}var b=new Map;function x(e,t){b.set(e,t);}function P(e){b.delete(e);}function T(e){return b.get(e)}async function M(e){try{switch(e.type){case "restore-diff":{let t=h(e.state,e.diff);return {id:e.id,type:"restore-diff-result",result:t}}case "diff":{let t=c(e.before,e.after);return {id:e.id,type:"diff-result",result:t}}case "clone":{let t=JSON.parse(JSON.stringify(e.value));return {id:e.id,type:"clone-result",result:t}}case "custom":{let t=T(e.kind);if(!t)throw new Error(`No game worker handler registered for kind "${e.kind}"`);let r=await t(e.payload);return {id:e.id,type:"custom-result",result:r}}}}catch(t){return {id:e.id,type:"error",error:t instanceof Error?t.message:String(t)}}}var d=class e{static _worker;static _pending=new Map;static _nextId=0;static get isAvailable(){return e._worker!==void 0}static register(t){e.unregister(),e._worker=t,t.addEventListener("message",e._handleMessage);}static unregister(){let t=e._worker;if(t){t.removeEventListener("message",e._handleMessage),e._worker=void 0;for(let{reject:r}of e._pending.values())r(new Error("Game worker was unregistered"));e._pending.clear();}}static _handleMessage=t=>{let r=e._pending.get(t.data.id);r&&(e._pending.delete(t.data.id),t.data.type==="error"?r.reject(new Error(t.data.error)):r.resolve(t.data.result));};static _request(t){let r=e._worker;if(!r)return Promise.reject(new Error("No game worker is registered"));let a=e._nextId++;return new Promise((o,m)=>{e._pending.set(a,{resolve:o,reject:m});try{r.postMessage({...t,id:a});}catch(l){e._pending.delete(a),n.error("Error posting message to game worker",l),m(l);}})}static async restoreDiff(t,r){return await e._request({type:"restore-diff",state:t,diff:r})}static async diff(t,r){return await e._request({type:"diff",before:t,after:r})}static async clone(t){return await e._request({type:"clone",value:t})}static async custom(t,r){return await e._request({type:"custom",kind:t,payload:r})}};async function R(e,t){if(d.isAvailable)try{return await d.restoreDiff(e,t)}catch(r){n.warn("Game worker failed to restore diff, falling back to the main thread",r);}return h(e,t)}async function O(e,t){if(d.isAvailable)try{return await d.diff(e,t)}catch(r){n.warn("Game worker failed to compute diff, falling back to the main thread",r);}return c(e,t)}async function H(e){if(d.isAvailable)try{return await d.clone(e)}catch(t){n.warn("Game worker failed to clone value, falling back to the main thread",t);}return y(e)}exports.GameWorkerManager=d;exports.cloneMaybeOffloaded=H;exports.diffMaybeOffloaded=O;exports.handleGameWorkerMessage=M;exports.registerGameWorkerHandler=x;exports.restoreDiffMaybeOffloaded=R;exports.unregisterGameWorkerHandler=P;
|
package/dist/worker.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,a as a$1}from'./chunk-
|
|
1
|
+
import {b,a as a$1}from'./chunk-LXIKP2K5.mjs';function u(r){try{if(typeof r>"u")return r;let e=JSON.stringify(r);return JSON.parse(e)}catch(e){throw b.error("Error creating exportable element",r,e),new a$1("not_json_serializable","Error creating exportable element")}}function g(r,e){let t=u(r);return e.length>1&&"type"in e[0]&&(e=e.slice().reverse()),e.forEach(o=>{W(t,o);}),t}function W(r,e){let t=r;e.path&&e.path.length>0?e.path.forEach((o,f)=>{if(e.path&&f===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":t[o]=e.oldValue;break;case "CREATE":Array.isArray(t)&&typeof o=="number"?t.splice(o,1):delete t[o];break}else t=t[o];}):b.warn("No path found, skipping diff",e);}var x=["Date","RegExp","String","Number"],T=Object.getOwnPropertyNames(globalThis.Temporal||{});function l(r,e,t={cyclesFix:true},o=[]){let f=[],d=Array.isArray(r);for(let i in r){let n=r[i],y=d?+i:i;if(!(i in e)){f.push({type:"REMOVE",path:[y],oldValue:n});continue}let c=e[i],w=typeof n=="object"&&typeof c=="object"&&Array.isArray(n)===Array.isArray(c),m=w&&n?Object.getPrototypeOf(n)?.constructor?.name:void 0;if(n&&c&&w&&!x.includes(m)&&!T.includes(m)&&(!t.cyclesFix||!o.includes(n))){t.cyclesFix&&o.push(n);let G=l(n,c,t,o);t.cyclesFix&&o.pop();for(let h of G)h.path.unshift(y),f.push(h);}else Object.is(n,c)||T.includes(m)&&String(n)===String(c)||x.includes(m)&&(isNaN(n)?n+""==c+"":+n==+c)||f.push({path:[y],type:"CHANGE",value:c,oldValue:n});}let p=Array.isArray(e);for(let i in e)i in r||f.push({type:"CREATE",path:[p?+i:i],value:e[i]});return f}var k=new Map;function v(r,e){k.set(r,e);}function D(r){k.delete(r);}function E(r){return k.get(r)}async function M(r){try{switch(r.type){case "restore-diff":{let e=g(r.state,r.diff);return {id:r.id,type:"restore-diff-result",result:e}}case "diff":{let e=l(r.before,r.after);return {id:r.id,type:"diff-result",result:e}}case "clone":{let e=JSON.parse(JSON.stringify(r.value));return {id:r.id,type:"clone-result",result:e}}case "custom":{let e=E(r.kind);if(!e)throw new Error(`No game worker handler registered for kind "${r.kind}"`);let t=await e(r.payload);return {id:r.id,type:"custom-result",result:t}}}}catch(e){return {id:r.id,type:"error",error:e instanceof Error?e.message:String(e)}}}var a=class r{static _worker;static _pending=new Map;static _nextId=0;static get isAvailable(){return r._worker!==void 0}static register(e){r.unregister(),r._worker=e,e.addEventListener("message",r._handleMessage);}static unregister(){let e=r._worker;if(e){e.removeEventListener("message",r._handleMessage),r._worker=void 0;for(let{reject:t}of r._pending.values())t(new Error("Game worker was unregistered"));r._pending.clear();}}static _handleMessage=e=>{let t=r._pending.get(e.data.id);t&&(r._pending.delete(e.data.id),e.data.type==="error"?t.reject(new Error(e.data.error)):t.resolve(e.data.result));};static _request(e){let t=r._worker;if(!t)return Promise.reject(new Error("No game worker is registered"));let o=r._nextId++;return new Promise((f,d)=>{r._pending.set(o,{resolve:f,reject:d});try{t.postMessage({...e,id:o});}catch(p){r._pending.delete(o),b.error("Error posting message to game worker",p),d(p);}})}static async restoreDiff(e,t){return await r._request({type:"restore-diff",state:e,diff:t})}static async diff(e,t){return await r._request({type:"diff",before:e,after:t})}static async clone(e){return await r._request({type:"clone",value:e})}static async custom(e,t){return await r._request({type:"custom",kind:e,payload:t})}};async function A(r,e){if(a.isAvailable)try{return await a.restoreDiff(r,e)}catch(t){b.warn("Game worker failed to restore diff, falling back to the main thread",t);}return g(r,e)}async function O(r,e){if(a.isAvailable)try{return await a.diff(r,e)}catch(t){b.warn("Game worker failed to compute diff, falling back to the main thread",t);}return l(r,e)}async function j(r){if(a.isAvailable)try{return await a.clone(r)}catch(e){b.warn("Game worker failed to clone value, falling back to the main thread",e);}return u(r)}export{a as GameWorkerManager,j as cloneMaybeOffloaded,O as diffMaybeOffloaded,M as handleGameWorkerMessage,v as registerGameWorkerHandler,A as restoreDiffMaybeOffloaded,D as unregisterGameWorkerHandler};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drincs/pixi-vn",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pixi'VN is a very versatile and powerful game/story-driven engine.",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -84,6 +84,12 @@
|
|
|
84
84
|
"require": "./dist/characters.cjs",
|
|
85
85
|
"default": "./dist/characters.mjs"
|
|
86
86
|
},
|
|
87
|
+
"./filters": {
|
|
88
|
+
"types": "./dist/filters.d.ts",
|
|
89
|
+
"import": "./dist/filters.mjs",
|
|
90
|
+
"require": "./dist/filters.cjs",
|
|
91
|
+
"default": "./dist/filters.mjs"
|
|
92
|
+
},
|
|
87
93
|
"./vite": {
|
|
88
94
|
"types": "./dist/vite.d.ts",
|
|
89
95
|
"import": "./dist/vite.mjs",
|
|
@@ -101,6 +107,12 @@
|
|
|
101
107
|
"import": "./dist/motion.mjs",
|
|
102
108
|
"require": "./dist/motion.cjs",
|
|
103
109
|
"default": "./dist/motion.mjs"
|
|
110
|
+
},
|
|
111
|
+
"./tickers": {
|
|
112
|
+
"types": "./dist/tickers.d.ts",
|
|
113
|
+
"import": "./dist/tickers.mjs",
|
|
114
|
+
"require": "./dist/tickers.cjs",
|
|
115
|
+
"default": "./dist/tickers.mjs"
|
|
104
116
|
}
|
|
105
117
|
},
|
|
106
118
|
"typesVersions": {
|
|
@@ -129,6 +141,9 @@
|
|
|
129
141
|
"characters": [
|
|
130
142
|
"./dist/characters.d.ts"
|
|
131
143
|
],
|
|
144
|
+
"filters": [
|
|
145
|
+
"./dist/filters.d.ts"
|
|
146
|
+
],
|
|
132
147
|
"vite": [
|
|
133
148
|
"./dist/vite.d.ts"
|
|
134
149
|
],
|
|
@@ -137,6 +152,9 @@
|
|
|
137
152
|
],
|
|
138
153
|
"motion": [
|
|
139
154
|
"./dist/motion.d.ts"
|
|
155
|
+
],
|
|
156
|
+
"tickers": [
|
|
157
|
+
"./dist/tickers.d.ts"
|
|
140
158
|
]
|
|
141
159
|
}
|
|
142
160
|
},
|
|
@@ -157,6 +175,7 @@
|
|
|
157
175
|
"peerDependencies": {
|
|
158
176
|
"@pixi/devtools": ">=2.0.0",
|
|
159
177
|
"motion": ">=12.38.0",
|
|
178
|
+
"pixi-filters": ">=6.1.0",
|
|
160
179
|
"pixi.js": ">=8.17.0",
|
|
161
180
|
"tone": ">=15.1.0",
|
|
162
181
|
"vite": ">=5.0.0"
|
|
@@ -200,8 +219,10 @@
|
|
|
200
219
|
"novel",
|
|
201
220
|
"pixi",
|
|
202
221
|
"pixi-js",
|
|
222
|
+
"pixi-vn",
|
|
203
223
|
"visual",
|
|
204
224
|
"visual-novel",
|
|
225
|
+
"vn",
|
|
205
226
|
"webgl"
|
|
206
227
|
]
|
|
207
228
|
}
|
package/dist/chunk-AWU37VV6.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a=class extends Error{code;constructor(t,n,m,o,r){super(`[Pixi\u2019VN] ${n}`),this.code=t,m==="canvas"&&(this.canvasElementInfo=o,this.parent=r);}canvasElementInfo;parent};var i;(o=>(o.log=(r,...s)=>console.log(`[Pixi\u2019VN] ${r}`,...s),o.warn=(r,...s)=>console.warn(`[Pixi\u2019VN] ${r}`,...s),o.error=(r,...s)=>console.error(`[Pixi\u2019VN] ${r}`,...s),o.info=(r,...s)=>console.info(`[Pixi\u2019VN] ${r}`,...s)))(i||={});var l=class e{static init(t){t.navigate&&(e._navigate=t.navigate),e._getStepCounter=t.getStepCounter,e._setStepCounter=t.setStepCounter,e._getCurrentGameStepState=t.getCurrentGameStepState,e._restoreGameStepState=t.restoreGameStepState,e._getOpenedLabels=t.getOpenedLabels,e._processNavigationRequests=t.processNavigationRequests,e._getVariable=t.getVariable,e._setVariable=t.setVariable,e._removeVariable=t.removeVariable,e._getFlag=t.getFlag,e._setFlag=t.setFlag,t.onLabelClosing&&(e._onLabelClosing=t.onLabelClosing),e._addHistoryItem=t.addHistoryItem,e._getCharacter=t.getCharacter,e._animate=t.animate;}static _navigate=()=>{i.warn("Navigate function not initialized. You should add the navigate function in the Game.init() method.");};static get navigate(){return e._navigate}static set navigate(t){e._navigate=t;}static _getStepCounter=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return e._getStepCounter()}static set stepCounter(t){e._setStepCounter(t);}static _getCurrentGameStepState=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return e._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return e._restoreGameStepState}static _getOpenedLabels=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return e._getOpenedLabels()}static _onPreContinueHandlers=[];static addOnPreContinue(t){e._onPreContinueHandlers.push(t);}static removeOnPreContinue(t){e._onPreContinueHandlers=e._onPreContinueHandlers.filter(n=>n!==t);}static clearOnPreContinueHandlers(){e._onPreContinueHandlers=[];}static async runOnPreContinue(){let t=e._onPreContinueHandlers.slice();await Promise.all(t.map(n=>n()));}static get onPreContinue(){return e.runOnPreContinue}static navigationRequestsCount=0;static processNavigationLock=Promise.resolve();static get continueRequestsCount(){return e.navigationRequestsCount}static increaseContinueRequest(t=1){e.navigationRequestsCount+=t;}static get backRequestsCount(){return -1*e.navigationRequestsCount}static increaseBackRequest(t=1){e.navigationRequestsCount-=t;}static _processNavigationRequests=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static async processNavigationRequests(t){let n=e._processNavigationRequests(e.navigationRequestsCount,t);return e.navigationRequestsCount=n.newValue,await n.result}static _getVariable=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return e._getVariable}static _setVariable=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return e._setVariable}static _removeVariable=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return e._removeVariable}static _getFlag=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return e._getFlag}static _setFlag=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return e._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return e._onLabelClosing}static _addHistoryItem=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return e._addHistoryItem}static runningStepsCount=0;static _getCharacter=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented.")};static get getCharacter(){return e._getCharacter}static onEnd;static _onErrorHandlers=[];static addOnError(t){return e._onErrorHandlers.push(t),()=>e.removeOnError(t)}static removeOnError(t){e._onErrorHandlers=e._onErrorHandlers.filter(n=>n!==t);}static clearOnErrorHandlers(){e._onErrorHandlers.length=0;}static async runOnError(t,n){for(let m of e._onErrorHandlers.slice())try{await m(t,n);}catch(o){i.error("Error in onError handler",o);}}static _animate=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get animate(){return e._animate}};export{a,i as b,l as c};
|
package/dist/chunk-QOBPVPCY.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-YBA63R27.mjs';import {q,m,o,l,n,p,r}from'./chunk-U5BSF6X3.mjs';import {GameUnifier}from'@drincs/pixi-vn/core';import {cloneMaybeOffloaded}from'@drincs/pixi-vn/worker';var I;(n=>{n.storage=new q({cacheSize:50}),n.defaultStorage=new q({cacheSize:10}),n.tempStorageDeadlines=new Map;let s;function c(r){n.tempStorageDeadlines.forEach((i,o)=>{i>r&&(n.storage.delete(`${m}:${o}`),s?.onClearOldTempVariable?.(o),n.tempStorageDeadlines.delete(o));});}n.clearOldTempVariables=c;function T(r){s=r;}n.setExternalStoreHandler=T;function y(r,i,o){o==null?n.storage.delete(`${r}:${i}`):n.storage.set(`${r}:${i}`,o),s?.onSetVariable?.(i,o);}n.setVariable=y;function V(r,i){let o=n.storage.get(`${r}:${i}`);return a$1(o)}n.getVariable=V;function M(r,i){n.storage.delete(`${r}:${i}`),s?.onRemoveVariable?.(i);}n.removeVariable=M;function R(r,i){let o$1=n.storage.get(o)||[];if(i)o$1.includes(r)||o$1.push(r);else {let h=o$1.indexOf(r);h>-1&&o$1.splice(h,1);}n.storage.set(o,o$1);}n.setFlag=R;function v(r){return (n.storage.get(o)||[]).includes(r)}n.getFlag=v;})(I||={});var a=I;var _=class{get base(){return a.storage.map}get cache(){return a.storage.cache}get tempStorageDeadlines(){return a.tempStorageDeadlines}set default(t){Object.entries(t).forEach(([e,s])=>{a.defaultStorage.map.set(e,s);});}temp={set:(t,e)=>this.setTemp(t,e),remove:t=>this.removeTemp(t),get deadlines(){return a.tempStorageDeadlines}};flags={set:(t,e)=>a.setFlag(t,e),get:t=>a.getFlag(t)};set(t,e){return a.setVariable(l,t,e)}get(t){let e=a.getVariable(m,t);return e===void 0&&(e=a.getVariable(l,t)),e===void 0&&(e=a$1(a.defaultStorage.get(t))),e}remove(t){return this.temp.remove(t),a.removeVariable(l,t)}setTemp(t,e){if(e==null){this.temp.remove(t);return}else a.setVariable(m,t,e),this.temp.deadlines.has(t)||this.temp.deadlines.set(t,GameUnifier.openedLabels);}removeTemp(t){a.removeVariable(m,t),this.temp.deadlines.has(t)&&this.temp.deadlines.delete(t);}setTempVariable(t,e){this.temp.set(t,e);}removeTempVariable(t){this.temp.remove(t);}setFlag(t,e){this.flags.set(t,e);}getFlag(t){return this.flags.get(t)}setStorageHandler(t){a.setExternalStoreHandler(t);}clear(){this.base.clear(),this.cache.clear(),this.temp.deadlines.clear();}async export(){let t=[];[...this.base.keys()].forEach(s=>{t.push({key:s,value:this.base.get(s)});});let e=[];return [...this.temp.deadlines.keys()].forEach(s=>{e.push({key:s,value:this.temp.deadlines.get(s)});}),cloneMaybeOffloaded({main:t,tempDeadlines:e})}restore(t){this.clear();try{t?(t.base?.forEach(e=>{switch(e.key){case "___current_dialogue_memory___":a.setVariable(n,p.CURRENT_DIALOGUE_MEMORY_KEY,e.value);break;case "___last_dialogue_added_in_step_memory___":a.setVariable(n,p.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "___current_menu_options_memory___":a.setVariable(n,p.CURRENT_MENU_OPTIONS_MEMORY_KEY,e.value);break;case "___last_menu_options_added_in_step_memory___":a.setVariable(n,p.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "_input_value_":a.setVariable(n,p.CURRENT_INPUT_VALUE_MEMORY_KEY,e.value);break;case "___last_input_added_in_step_memory___":a.setVariable(n,p.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "___current_input_info_memory___":a.setVariable(n,p.CURRENT_INPUT_INFO_MEMORY_KEY,e.value);break;case "___opened_labels_counter___":a.setVariable(n,p.OPENED_LABELS_COUNTER_KEY,e.value);break;case "___all_choices_made___":a.setVariable(n,p.ALL_CHOICES_MADE_KEY,e.value);break;case "___current_step_times_counter___":a.setVariable(n,p.CURRENT_STEP_TIMES_COUNTER_KEY,e.value);break;case "___last_step_glued___":a.setVariable(n,p.LAST_STEP_GLUED,e.value);break;default:a.setVariable(l,e.key,e.value);}}),t.temp?.forEach(e=>{a.setVariable(m,e.key,e.value);}),t.flags?.forEach(e=>{a.setFlag(e,!0);}),t.main?.forEach(e=>{this.base.set(e.key,e.value);}),t.tempDeadlines?.forEach(e=>{this.temp.deadlines.set(e.key,e.value);})):r.warn("No storage data found");}catch(e){r.error("Error importing data",e);}}};var d=class{constructor(t,e){this.categoryId=t,this.id=e,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let e=a.getVariable(l,t);e&&(Object.entries(e).forEach(([s,c])=>{typeof c=="object"&&c!==null&&Object.entries(c).forEach(([T,y])=>{a.setVariable(this.categoryId,`${s}:${T}`,y);});}),a.removeVariable(l,t));}id;categoryId;setStorageProperty(t,e){a.setVariable(this.categoryId,`${this.id}:${t}`,e);}getStorageProperty(t,e=this.id){return a.getVariable(this.categoryId,`${e}:${t}`)}};var k=new _;export{a,d as b,k as c};
|
package/dist/chunk-U5BSF6X3.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var jt=Object.create;var Rt=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var $t=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty;var Lt=l=>{throw TypeError(l)};var Xt=(l,e,i)=>e in l?Rt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var ee=(l=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(l,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):l)(function(l){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+l+'" is not supported')});var ie=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var qt=(l,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let h of kt(e))!Bt.call(l,h)&&h!==i&&Rt(l,h,{get:()=>e[h],enumerable:!(s=Ht(e,h))||s.enumerable});return l};var se=(l,e,i)=>(i=l!=null?jt($t(l)):{},qt(e||!l||!l.__esModule?Rt(i,"default",{value:l,enumerable:true}):i,l));var x=(l,e,i)=>Xt(l,typeof e!="symbol"?e+"":e,i),xt=(l,e,i)=>e.has(l)||Lt("Cannot "+i);var t=(l,e,i)=>(xt(l,e,"read from private field"),i?i.call(l):e.get(l)),_=(l,e,i)=>e.has(l)?Lt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,i),f=(l,e,i,s)=>(xt(l,e,"write to private field"),e.set(l,i),i),a=(l,e,i)=>(xt(l,e,"access private method"),i);var mt=(l,e,i,s)=>({set _(h){f(l,e,h);},get _(){return t(l,e,s)}});var oe="__game_layer__",ne="Container",re="ImageContainer",le="Image",ae="Sprite",ce="Text",ue="Video",fe="general",de="storage",pe="temp",_e="narration",ge="flags",Se={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var Jt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Wt=new Set,Ft=typeof process=="object"&&process?process:{},Yt=(l,e,i,s)=>{typeof Ft.emitWarning=="function"?Ft.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},yt=globalThis.AbortController,Mt=globalThis.AbortSignal;if(typeof yt>"u"){Mt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},yt=class{constructor(){e();}signal=new Mt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let l=Ft.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,Yt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var Qt=l=>!Wt.has(l);var tt=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),Pt=l=>tt(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?vt:null:null,vt=class extends Array{constructor(l){super(l),this.fill(0);}},J,ut,Zt=(J=class{heap;length;static create(e){let i=Pt(e);if(!i)return [];f(J,ut,true);let s=new J(e,i);return f(J,ut,false),s}constructor(e,i){if(!t(J,ut))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},ut=new WeakMap,_(J,ut,false),J),Ut,Gt,P,L,V,ot,K,ft,dt,j,O,H,T,w,d,N,M,F,y,k,b,$,B,U,G,X,ht,z,pt,r,Ct,nt,Q,At,W,Kt,rt,_t,wt,et,it,Dt,Tt,Ot,A,Nt,Et,st,zt,gt,Vt=(gt=class{constructor(e){_(this,r);_(this,P);_(this,L);_(this,V);_(this,ot);_(this,K);_(this,ft);_(this,dt);_(this,j);x(this,"ttl");x(this,"ttlResolution");x(this,"ttlAutopurge");x(this,"updateAgeOnGet");x(this,"updateAgeOnHas");x(this,"allowStale");x(this,"noDisposeOnSet");x(this,"noUpdateTTL");x(this,"maxEntrySize");x(this,"sizeCalculation");x(this,"noDeleteOnFetchRejection");x(this,"noDeleteOnStaleGet");x(this,"allowStaleOnFetchAbort");x(this,"allowStaleOnFetchRejection");x(this,"ignoreFetchAbort");_(this,O);_(this,H);_(this,T);_(this,w);_(this,d);_(this,N);_(this,M);_(this,F);_(this,y);_(this,k);_(this,b);_(this,$);_(this,B);_(this,U);_(this,G);_(this,X);_(this,ht);_(this,z);_(this,pt);_(this,nt,()=>{});_(this,Q,()=>{});_(this,At,()=>{});_(this,W,()=>false);_(this,rt,e=>{});_(this,_t,(e,i,s)=>{});_(this,wt,(e,i,s,h)=>{if(s||h)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});x(this,Ut,"LRUCache");let{max:i=0,ttl:s,ttlResolution:h=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:u,dispose:g,onInsert:R,disposeAfter:S,noDisposeOnSet:Z,noUpdateTTL:Y,maxSize:q=0,maxEntrySize:m=0,sizeCalculation:E,fetchMethod:p,memoMethod:C,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:D,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:St,ignoreFetchAbort:lt,perf:at}=e;if(at!==void 0&&typeof at?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,j,at??Jt),i!==0&&!tt(i))throw new TypeError("max option must be a nonnegative integer");let ct=i?Pt(i):Array;if(!ct)throw new Error("invalid max value: "+i);if(f(this,P,i),f(this,L,q),this.maxEntrySize=m||t(this,L),this.sizeCalculation=E,this.sizeCalculation){if(!t(this,L)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,dt,C),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,ft,p),f(this,ht,!!p),f(this,T,new Map),f(this,w,new Array(i).fill(void 0)),f(this,d,new Array(i).fill(void 0)),f(this,N,new ct(i)),f(this,M,new ct(i)),f(this,F,0),f(this,y,0),f(this,k,Zt.create(i)),f(this,O,0),f(this,H,0),typeof g=="function"&&f(this,V,g),typeof R=="function"&&f(this,ot,R),typeof S=="function"?(f(this,K,S),f(this,b,[])):(f(this,K,void 0),f(this,b,void 0)),f(this,X,!!t(this,V)),f(this,pt,!!t(this,ot)),f(this,z,!!t(this,K)),this.noDisposeOnSet=!!Z,this.noUpdateTTL=!!Y,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!v,this.allowStaleOnFetchAbort=!!St,this.ignoreFetchAbort=!!lt,this.maxEntrySize!==0){if(t(this,L)!==0&&!tt(t(this,L)))throw new TypeError("maxSize must be a positive integer if specified");if(!tt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");a(this,r,Kt).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!D,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=tt(h)||h===0?h:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!tt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");a(this,r,Ct).call(this);}if(t(this,P)===0&&this.ttl===0&&t(this,L)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,P)&&!t(this,L)){let bt="LRU_CACHE_UNBOUNDED";Qt(bt)&&(Wt.add(bt),Yt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",bt,gt));}}get perf(){return t(this,j)}static unsafeExposeInternals(e){return {starts:t(e,B),ttls:t(e,U),autopurgeTimers:t(e,G),sizes:t(e,$),keyMap:t(e,T),keyList:t(e,w),valList:t(e,d),next:t(e,N),prev:t(e,M),get head(){return t(e,F)},get tail(){return t(e,y)},free:t(e,k),isBackgroundFetch:i=>{var s;return a(s=e,r,A).call(s,i)},backgroundFetch:(i,s,h,n)=>{var o;return a(o=e,r,Ot).call(o,i,s,h,n)},moveToTail:i=>{var s;return a(s=e,r,Et).call(s,i)},indexes:i=>{var s;return a(s=e,r,et).call(s,i)},rindexes:i=>{var s;return a(s=e,r,it).call(s,i)},isStale:i=>{var s;return t(s=e,W).call(s,i)}}}get max(){return t(this,P)}get maxSize(){return t(this,L)}get calculatedSize(){return t(this,H)}get size(){return t(this,O)}get fetchMethod(){return t(this,ft)}get memoMethod(){return t(this,dt)}get dispose(){return t(this,V)}get onInsert(){return t(this,ot)}get disposeAfter(){return t(this,K)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of a(this,r,et).call(this))t(this,d)[e]!==void 0&&t(this,w)[e]!==void 0&&!a(this,r,A).call(this,t(this,d)[e])&&(yield [t(this,w)[e],t(this,d)[e]]);}*rentries(){for(let e of a(this,r,it).call(this))t(this,d)[e]!==void 0&&t(this,w)[e]!==void 0&&!a(this,r,A).call(this,t(this,d)[e])&&(yield [t(this,w)[e],t(this,d)[e]]);}*keys(){for(let e of a(this,r,et).call(this)){let i=t(this,w)[e];i!==void 0&&!a(this,r,A).call(this,t(this,d)[e])&&(yield i);}}*rkeys(){for(let e of a(this,r,it).call(this)){let i=t(this,w)[e];i!==void 0&&!a(this,r,A).call(this,t(this,d)[e])&&(yield i);}}*values(){for(let e of a(this,r,et).call(this))t(this,d)[e]!==void 0&&!a(this,r,A).call(this,t(this,d)[e])&&(yield t(this,d)[e]);}*rvalues(){for(let e of a(this,r,it).call(this))t(this,d)[e]!==void 0&&!a(this,r,A).call(this,t(this,d)[e])&&(yield t(this,d)[e]);}[(Gt=Symbol.iterator,Ut=Symbol.toStringTag,Gt)](){return this.entries()}find(e,i={}){for(let s of a(this,r,et).call(this)){let h=t(this,d)[s],n=a(this,r,A).call(this,h)?h.__staleWhileFetching:h;if(n!==void 0&&e(n,t(this,w)[s],this))return this.get(t(this,w)[s],i)}}forEach(e,i=this){for(let s of a(this,r,et).call(this)){let h=t(this,d)[s],n=a(this,r,A).call(this,h)?h.__staleWhileFetching:h;n!==void 0&&e.call(i,n,t(this,w)[s],this);}}rforEach(e,i=this){for(let s of a(this,r,it).call(this)){let h=t(this,d)[s],n=a(this,r,A).call(this,h)?h.__staleWhileFetching:h;n!==void 0&&e.call(i,n,t(this,w)[s],this);}}purgeStale(){let e=false;for(let i of a(this,r,it).call(this,{allowStale:true}))t(this,W).call(this,i)&&(a(this,r,st).call(this,t(this,w)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,d)[i],h=a(this,r,A).call(this,s)?s.__staleWhileFetching:s;if(h===void 0)return;let n={value:h};if(t(this,U)&&t(this,B)){let o=t(this,U)[i],c=t(this,B)[i];if(o&&c){let u=o-(t(this,j).now()-c);n.ttl=u,n.start=Date.now();}}return t(this,$)&&(n.size=t(this,$)[i]),n}dump(){let e=[];for(let i of a(this,r,et).call(this,{allowStale:true})){let s=t(this,w)[i],h=t(this,d)[i],n=a(this,r,A).call(this,h)?h.__staleWhileFetching:h;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,U)&&t(this,B)){o.ttl=t(this,U)[i];let c=t(this,j).now()-t(this,B)[i];o.start=Math.floor(Date.now()-c);}t(this,$)&&(o.size=t(this,$)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let h=Date.now()-s.start;s.start=t(this,j).now()-h;}this.set(i,s.value,s);}}set(e,i,s={}){var Z,Y,q,m;if(i===void 0)return this.delete(e),this;let{ttl:h=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:u}=s,{noUpdateTTL:g=this.noUpdateTTL}=s,R=t(this,wt).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&R>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),a(this,r,st).call(this,e,"set"),this;let S=t(this,O)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,O)===0?t(this,y):t(this,k).length!==0?t(this,k).pop():t(this,O)===t(this,P)?a(this,r,Tt).call(this,false):t(this,O),t(this,w)[S]=e,t(this,d)[S]=i,t(this,T).set(e,S),t(this,N)[t(this,y)]=S,t(this,M)[S]=t(this,y),f(this,y,S),mt(this,O)._++,t(this,_t).call(this,S,R,u),u&&(u.set="add"),g=false,t(this,pt)&&((Z=t(this,ot))==null||Z.call(this,i,e,"add"));else {a(this,r,Et).call(this,S);let E=t(this,d)[S];if(i!==E){if(t(this,ht)&&a(this,r,A).call(this,E)){E.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=E;p!==void 0&&!o&&(t(this,X)&&((Y=t(this,V))==null||Y.call(this,p,e,"set")),t(this,z)&&t(this,b)?.push([p,e,"set"]));}else o||(t(this,X)&&((q=t(this,V))==null||q.call(this,E,e,"set")),t(this,z)&&t(this,b)?.push([E,e,"set"]));if(t(this,rt).call(this,S),t(this,_t).call(this,S,R,u),t(this,d)[S]=i,u){u.set="replace";let p=E&&a(this,r,A).call(this,E)?E.__staleWhileFetching:E;p!==void 0&&(u.oldValue=p);}}else u&&(u.set="update");t(this,pt)&&this.onInsert?.(i,e,i===E?"update":"replace");}if(h!==0&&!t(this,U)&&a(this,r,Ct).call(this),t(this,U)&&(g||t(this,At).call(this,S,h,n),u&&t(this,Q).call(this,u,S)),!o&&t(this,z)&&t(this,b)){let E=t(this,b),p;for(;p=E?.shift();)(m=t(this,K))==null||m.call(this,...p);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,d)[t(this,F)];if(a(this,r,Tt).call(this,!0),a(this,r,A).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,z)&&t(this,b)){let i=t(this,b),s;for(;s=i?.shift();)(e=t(this,K))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:h}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,d)[n];if(a(this,r,A).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,W).call(this,n))h&&(h.has="stale",t(this,Q).call(this,h,n));else return s&&t(this,nt).call(this,n),h&&(h.has="hit",t(this,Q).call(this,h,n)),true}else h&&(h.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,h=t(this,T).get(e);if(h===void 0||!s&&t(this,W).call(this,h))return;let n=t(this,d)[h];return a(this,r,A).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:h=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:u=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:Y=this.ignoreFetchAbort,allowStaleOnFetchAbort:q=this.allowStaleOnFetchAbort,context:m,forceRefresh:E=false,status:p,signal:C}=i;if(!t(this,ht))return p&&(p.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:h,noDeleteOnStaleGet:n,status:p});let I={allowStale:s,updateAgeOnGet:h,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:u,sizeCalculation:g,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:q,ignoreFetchAbort:Y,status:p,signal:C},D=t(this,T).get(e);if(D===void 0){p&&(p.fetch="miss");let v=a(this,r,Ot).call(this,e,D,I,m);return v.__returned=v}else {let v=t(this,d)[D];if(a(this,r,A).call(this,v)){let ct=s&&v.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",ct&&(p.returnedStale=true)),ct?v.__staleWhileFetching:v.__returned=v}let St=t(this,W).call(this,D);if(!E&&!St)return p&&(p.fetch="hit"),a(this,r,Et).call(this,D),h&&t(this,nt).call(this,D),p&&t(this,Q).call(this,p,D),v;let lt=a(this,r,Ot).call(this,e,D,I,m),at=lt.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=St?"stale":"refresh",at&&St&&(p.returnedStale=true)),at?lt.__staleWhileFetching:lt.__returned=lt}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=t(this,dt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:h,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let u=s(e,c,{options:o,context:h});return this.set(e,u,o),u}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:h=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let u=t(this,d)[c],g=a(this,r,A).call(this,u);return o&&t(this,Q).call(this,o,c),t(this,W).call(this,c)?(o&&(o.get="stale"),g?(o&&s&&u.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?u.__staleWhileFetching:void 0):(n||a(this,r,st).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?u:void 0)):(o&&(o.get="hit"),g?u.__staleWhileFetching:(a(this,r,Et).call(this,c),h&&t(this,nt).call(this,c),u))}else o&&(o.get="miss");}delete(e){return a(this,r,st).call(this,e,"delete")}clear(){return a(this,r,zt).call(this,"delete")}},P=new WeakMap,L=new WeakMap,V=new WeakMap,ot=new WeakMap,K=new WeakMap,ft=new WeakMap,dt=new WeakMap,j=new WeakMap,O=new WeakMap,H=new WeakMap,T=new WeakMap,w=new WeakMap,d=new WeakMap,N=new WeakMap,M=new WeakMap,F=new WeakMap,y=new WeakMap,k=new WeakMap,b=new WeakMap,$=new WeakMap,B=new WeakMap,U=new WeakMap,G=new WeakMap,X=new WeakMap,ht=new WeakMap,z=new WeakMap,pt=new WeakMap,r=new WeakSet,Ct=function(){let e=new vt(t(this,P)),i=new vt(t(this,P));f(this,U,e),f(this,B,i);let s=this.ttlAutopurge?new Array(t(this,P)):void 0;f(this,G,s),f(this,At,(c,u,g=t(this,j).now())=>{i[c]=u!==0?g:0,e[c]=u,h(c,u);}),f(this,nt,c=>{i[c]=e[c]!==0?t(this,j).now():0,h(c,e[c]);});let h=this.ttlAutopurge?(c,u)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),u&&u!==0&&s){let g=setTimeout(()=>{t(this,W).call(this,c)&&a(this,r,st).call(this,t(this,w)[c],"expire");},u+1);g.unref&&g.unref(),s[c]=g;}}:()=>{};f(this,Q,(c,u)=>{if(e[u]){let g=e[u],R=i[u];if(!g||!R)return;c.ttl=g,c.start=R,c.now=n||o();let S=c.now-R;c.remainingTTL=g-S;}});let n=0,o=()=>{let c=t(this,j).now();if(this.ttlResolution>0){n=c;let u=setTimeout(()=>n=0,this.ttlResolution);u.unref&&u.unref();}return c};this.getRemainingTTL=c=>{let u=t(this,T).get(c);if(u===void 0)return 0;let g=e[u],R=i[u];if(!g||!R)return 1/0;let S=(n||o())-R;return g-S},f(this,W,c=>{let u=i[c],g=e[c];return !!g&&!!u&&(n||o())-u>g});},nt=new WeakMap,Q=new WeakMap,At=new WeakMap,W=new WeakMap,Kt=function(){let e=new vt(t(this,P));f(this,H,0),f(this,$,e),f(this,rt,i=>{f(this,H,t(this,H)-e[i]),e[i]=0;}),f(this,wt,(i,s,h,n)=>{if(a(this,r,A).call(this,s))return 0;if(!tt(h))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(h=n(s,i),!tt(h))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return h}),f(this,_t,(i,s,h)=>{if(e[i]=s,t(this,L)){let n=t(this,L)-e[i];for(;t(this,H)>n;)a(this,r,Tt).call(this,true);}f(this,H,t(this,H)+e[i]),h&&(h.entrySize=s,h.totalCalculatedSize=t(this,H));});},rt=new WeakMap,_t=new WeakMap,wt=new WeakMap,et=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,y);!(!a(this,r,Dt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,F)));)i=t(this,M)[i];},it=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,F);!(!a(this,r,Dt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,y)));)i=t(this,N)[i];},Dt=function(e){return e!==void 0&&t(this,T).get(t(this,w)[e])===e},Tt=function(e){var n;let i=t(this,F),s=t(this,w)[i],h=t(this,d)[i];return t(this,ht)&&a(this,r,A).call(this,h)?h.__abortController.abort(new Error("evicted")):(t(this,X)||t(this,z))&&(t(this,X)&&((n=t(this,V))==null||n.call(this,h,s,"evict")),t(this,z)&&t(this,b)?.push([h,s,"evict"])),t(this,rt).call(this,i),t(this,G)?.[i]&&(clearTimeout(t(this,G)[i]),t(this,G)[i]=void 0),e&&(t(this,w)[i]=void 0,t(this,d)[i]=void 0,t(this,k).push(i)),t(this,O)===1?(f(this,F,f(this,y,0)),t(this,k).length=0):f(this,F,t(this,N)[i]),t(this,T).delete(s),mt(this,O)._--,i},Ot=function(e,i,s,h){let n=i===void 0?void 0:t(this,d)[i];if(a(this,r,A).call(this,n))return n;let o=new yt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let u={signal:o.signal,options:s,context:h},g=(m,E=false)=>{let{aborted:p}=o.signal,C=s.ignoreFetchAbort&&m!==void 0,I=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&m!==void 0);if(s.status&&(p&&!E?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,C&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),p&&!C&&!E)return S(o.signal.reason,I);let D=Y,v=t(this,d)[i];return (v===Y||C&&E&&v===void 0)&&(m===void 0?D.__staleWhileFetching!==void 0?t(this,d)[i]=D.__staleWhileFetching:a(this,r,st).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,m,u.options))),m},R=m=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=m),S(m,false)),S=(m,E)=>{let{aborted:p}=o.signal,C=p&&s.allowStaleOnFetchAbort,I=C||s.allowStaleOnFetchRejection,D=I||s.noDeleteOnFetchRejection,v=Y;if(t(this,d)[i]===Y&&(!D||!E&&v.__staleWhileFetching===void 0?a(this,r,st).call(this,e,"fetch"):C||(t(this,d)[i]=v.__staleWhileFetching)),I)return s.status&&v.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),v.__staleWhileFetching;if(v.__returned===v)throw m},Z=(m,E)=>{var C;let p=(C=t(this,ft))==null?void 0:C.call(this,e,n,u);p&&p instanceof Promise&&p.then(I=>m(I===void 0?void 0:I),E),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(m(void 0),s.allowStaleOnFetchAbort&&(m=I=>g(I,true)));});};s.status&&(s.status.fetchDispatched=true);let Y=new Promise(Z).then(g,R),q=Object.assign(Y,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,q,{...u.options,status:void 0}),i=t(this,T).get(e)):t(this,d)[i]=q,q},A=function(e){if(!t(this,ht))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof yt},Nt=function(e,i){t(this,M)[i]=e,t(this,N)[e]=i;},Et=function(e){e!==t(this,y)&&(e===t(this,F)?f(this,F,t(this,N)[e]):a(this,r,Nt).call(this,t(this,M)[e],t(this,N)[e]),a(this,r,Nt).call(this,t(this,y),e),f(this,y,e));},st=function(e,i){var h,n;let s=false;if(t(this,O)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,G)?.[o]&&(clearTimeout(t(this,G)?.[o]),t(this,G)[o]=void 0),s=true,t(this,O)===1)a(this,r,zt).call(this,i);else {t(this,rt).call(this,o);let c=t(this,d)[o];if(a(this,r,A).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,X)||t(this,z))&&(t(this,X)&&((h=t(this,V))==null||h.call(this,c,e,i)),t(this,z)&&t(this,b)?.push([c,e,i])),t(this,T).delete(e),t(this,w)[o]=void 0,t(this,d)[o]=void 0,o===t(this,y))f(this,y,t(this,M)[o]);else if(o===t(this,F))f(this,F,t(this,N)[o]);else {let u=t(this,M)[o];t(this,N)[u]=t(this,N)[o];let g=t(this,N)[o];t(this,M)[g]=t(this,M)[o];}mt(this,O)._--,t(this,k).push(o);}}if(t(this,z)&&t(this,b)?.length){let o=t(this,b),c;for(;c=o?.shift();)(n=t(this,K))==null||n.call(this,...c);}return s},zt=function(e){var i,s;for(let h of a(this,r,it).call(this,{allowStale:true})){let n=t(this,d)[h];if(a(this,r,A).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,w)[h];t(this,X)&&((i=t(this,V))==null||i.call(this,n,o,e)),t(this,z)&&t(this,b)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,d).fill(void 0),t(this,w).fill(void 0),t(this,U)&&t(this,B)){t(this,U).fill(0),t(this,B).fill(0);for(let h of t(this,G)??[])h!==void 0&&clearTimeout(h);t(this,G)?.fill(void 0);}if(t(this,$)&&t(this,$).fill(0),f(this,F,0),f(this,y,0),t(this,k).length=0,f(this,H,0),f(this,O,0),t(this,z)&&t(this,b)){let h=t(this,b),n;for(;n=h?.shift();)(s=t(this,K))==null||s.call(this,...n);}},gt);var It=class{cache;map=new Map;constructor(e){this.cache=new Vt({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var te;(h=>(h.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),h.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),h.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),h.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(te||={});export{ee as a,ie as b,se as c,oe as d,ne as e,re as f,le as g,ae as h,ce as i,ue as j,fe as k,de as l,pe as m,_e as n,ge as o,Se as p,It as q,te as r};
|
package/dist/chunk-YBA63R27.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {r}from'./chunk-U5BSF6X3.mjs';import {PixiError}from'@drincs/pixi-vn/core';function a(r$1){try{if(typeof r$1>"u")return r$1;let e=JSON.stringify(r$1);return JSON.parse(e)}catch(e){throw r.error("Error creating exportable element",r$1,e),new PixiError("not_json_serializable","Error creating exportable element")}}export{a};
|