@drincs/pixi-vn
Version:
Pixi'VN is a npm package that provides various features for creating visual novels.
1 lines • 1.39 kB
JavaScript
import {a,b,c,d}from'./chunk-3BBZHKU4.mjs';import'./chunk-TTRUPDAB.mjs';import {canvas}from'@drincs/pixi-vn/canvas';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';import {RegisteredLabels}from'@drincs/pixi-vn/narration';import p from'@drincs/pixi-vn/pixi.js';function u(){try{return new Function('return typeof import !== "undefined" && typeof import.meta !== "undefined" && import.meta.env?.DEV === true')()}catch{return false}}function s(t,n,r="data"){try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).catch(e=>{console.warn(`Failed to send ${r} to ${t}:`,e);});}catch(e){console.warn(`Error sending ${r} to ${t}:`,e);}}function h(){let t=p.Assets.resolver._assetMap,n=p.Assets.resolver._bundles;return {bundles:Object.entries(n).map(([r,e])=>({name:r,assets:e.flatMap(f=>t[f]??[])}))}}function A(){if(u()){try{let t=RegisteredCharacters.values();s(a,t,"characters");}catch(t){console.warn("Error collecting characters:",t);}try{let t=RegisteredLabels.keys();s(b,t,"labels");}catch(t){console.warn("Error collecting labels:",t);}try{let t=h();s(c,t,"assets manifest");}catch(t){console.warn("Error collecting assets manifest:",t);}try{let t={height:canvas.app.screen.height,width:canvas.app.screen.width};s(d,t,"canvas options");}catch(t){console.warn("Error collecting canvas options:",t);}}}export{A as setupPixivnViteData};