zois-core 1.0.14 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import s from"./styles.css";import{findModByName as u,registerMod as l}from"./modsApi";import{initVirtualDOM as f,useToastsStore as d,useDialogStore as g}from"./popups";import{version as E}from"../package.json";let m;function M(e){if(!window.ZOISCORE){const t=document.createElement("style");t.innerHTML=s,document.head.append(t),window.ZOISCORE=Object.freeze({loaded:!0,useToastsStore:d,useDialogStore:g}),f()}m={...e},l()}function h(e){return new Promise(t=>setTimeout(t,e))}async function b(e,t=()=>!1){for(;!e();){if(t())return!1;await h(10)}return!0}function x(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function D(e,t){const r=e.split("."),o=t.split(".");for(let n=0;n<Math.max(r.length,o.length);n++){const i=parseInt(r[n]||"0",10),a=parseInt(o[n]||"0",10);if(i>a)return!0;if(i<a)return!1}return!1}function w(e,t){return!e&&!t||!e&&t==="Default"||!t&&e==="Default"||e==="Default"&&Array.isArray(t)&&t.filter(r=>r==="Default").length===t.length||t==="Default"&&Array.isArray(e)&&e.filter(r=>r==="Default").length===e.length?!0:JSON.stringify(e)===JSON.stringify(t)}function N(e){return typeof e=="string"?Math.round(new TextEncoder().encode(e).byteLength/100)/10:Math.round(new TextEncoder().encode(JSON.stringify(e)).byteLength/100)/10}function O(e){if(e)return ChatRoomCharacter.find(t=>t.MemberNumber==e||t.Name.toLowerCase()===e||t.Nickname?.toLowerCase()===e)}function C(e){return CharacterNickname(e)}function S(){if(!u("Themed"))return null;const e=JSON.parse(LZString.decompressFromBase64(Player.ExtensionSettings.Themed??""));return!e?.GlobalModule?.themedEnabled||!e?.GlobalModule?.doVanillaGuiOverhaul?null:e.ColorsModule}export{m as MOD_DATA,w as colorsEqual,C as getNickname,O as getPlayer,x as getRandomNumber,N as getSizeInKbytes,S as getThemedColorsModule,D as isVersionNewer,M as registerCore,h as sleep,E as version,b as waitFor};
1
+ import a from"./styles.css";import{findModByName as l,registerMod as u}from"./modsApi";import{initVirtualDOM as g,useToastsStore as d,useDialogStore as f}from"./popups";import{version as v}from"../package.json";let m;function C(e){if(!window.ZOISCORE){const t=document.createElement("style");t.innerHTML=a,document.head.append(t),window.ZOISCORE=Object.freeze({loaded:!0,useToastsStore:d,useDialogStore:f}),g()}m={...e},u()}function c(e){return new Promise(t=>setTimeout(t,e))}async function p(e,t=()=>!1){for(;!e();){if(t())return!1;await c(10)}return!0}function h(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function x(e,t){const r=e.split("."),o=t.split(".");for(let n=0;n<Math.max(r.length,o.length);n++){const i=parseInt(r[n]||"0",10),s=parseInt(o[n]||"0",10);if(i>s)return!0;if(i<s)return!1}return!1}function D(e,t){return!e&&!t||!e&&t==="Default"||!t&&e==="Default"||e==="Default"&&Array.isArray(t)&&t.filter(r=>r==="Default").length===t.length||t==="Default"&&Array.isArray(e)&&e.filter(r=>r==="Default").length===e.length?!0:JSON.stringify(e)===JSON.stringify(t)}function w(e){return typeof e=="string"?Math.round(new TextEncoder().encode(e).byteLength/100)/10:Math.round(new TextEncoder().encode(JSON.stringify(e)).byteLength/100)/10}function T(e){if(e)return ChatRoomCharacter.find(t=>t.MemberNumber==e||t.Name.toLowerCase()===e||t.Nickname?.toLowerCase()===e)}function N(e){return CharacterNickname(e)}function S(){if(!l("Themed"))return null;const e=JSON.parse(LZString.decompressFromBase64(Player.ExtensionSettings.Themed??""));return!e?.GlobalModule?.themedEnabled||!e?.GlobalModule?.doVanillaGuiOverhaul?null:e.ColorsModule}function O(e){const t=document.createElement("style");t.innerHTML=e,document.head.append(t)}function P(e){p(()=>typeof Player.MemberNumber=="number").then(()=>setTimeout(e,h(3e3,6e3)))}export{m as MOD_DATA,D as colorsEqual,N as getNickname,T as getPlayer,h as getRandomNumber,w as getSizeInKbytes,S as getThemedColorsModule,O as injectStyles,x as isVersionNewer,C as registerCore,c as sleep,v as version,p as waitFor,P as waitForStart};
package/dist/messaging.js CHANGED
@@ -1 +1 @@
1
- import{getPlayer as g,MOD_DATA as i}from"./index";import{hookFunction as y,HookPriority as m}from"./modsApi";import{setFontFamily as C}from"./ui";const d=new Map,l=new Map;function q(o,t){const e=d.get(o);e&&e.resolve({data:t})}function P(o,t,e,n){const a=l.get(t);if(!a)return;const s=a(e,n);s!==void 0&&u.sendPacket("requestResponse",{requestId:o,message:t,data:s},n.MemberNumber)}function k(o,t){const e=d.get(o);e&&e.resolve({data:t})}function M(o,t,e,n,a){const s=l.get(t);if(console.log(s),!s)return;const r=s(e,n,a);r!==void 0&&u.sendBeep({type:`${i.key}_requestResponse`,requestId:o,message:t,data:r},n)}class R{sendBeep(t,e){const n={IsSecret:!0,BeepType:"Leash",MemberNumber:e,Message:JSON.stringify({...t})};ServerSend("AccountBeep",n)}sendPacket(t,e,n){const a={Content:i.key,Dictionary:{msg:t},Type:"Hidden"};e&&(a.Dictionary.data=e),n&&(a.Target=n),ServerSend("ChatRoomChat",a)}sendAction(t,e=void 0,n=[]){if(!t||!ServerPlayerIsInChatRoom())return;const a=CharacterPronounDescription(Player)==="She/Her",s=a?"Her":"His",r=a?"Her":"Him",c=a?"Herself":"Himself",p=a?"She":"He";t=t.replaceAll("<Possessive>",s).replaceAll("<possessive>",s.toLocaleLowerCase()).replaceAll("<Intensive>",r).replaceAll("<intensive>",r.toLocaleLowerCase()).replaceAll("<SelfIntensive>",c).replaceAll("<selfIntensive>",c.toLocaleLowerCase()).replaceAll("<Pronoun>",p).replaceAll("<pronoun>",p.toLocaleLowerCase()),ServerSend("ChatRoomChat",{Content:"ZC_CUSTOM_ACTION",Type:"Action",Target:e??void 0,Dictionary:[{Tag:'MISSING TEXT IN "Interface.csv": ZC_CUSTOM_ACTION',Text:t},...n]})}sendRequest({message:t,data:e={},target:n,type:a="packet"}){const s=crypto.randomUUID();return new Promise((r,c)=>{d.set(s,{message:t,data:e,target:n,resolve:r,reject:c}),a==="packet"?u.sendPacket("request",{requestId:s,message:t,data:e},n):u.sendBeep({type:`${i.key}_request`,requestId:s,message:t,data:e},n),setTimeout(()=>{d.delete(s),r({isError:!0})},6e3)})}sendLocal(t){if(!ServerPlayerIsInChatRoom())return;const e=document.createElement("div");e.setAttribute("class","ChatMessage ChatMessageLocalMessage"),e.setAttribute("data-time",ChatRoomCurrentTime()),e.setAttribute("data-sender",`${Player.MemberNumber}`),C(e,i.fontFamily),e.style.background=i.chatMessageBackground??"#55edc095",e.style.color=i.chatMessageColor??"black",e.style.margin="0.15em 0",typeof t=="string"?e.innerHTML=t:e.appendChild(t),document.querySelector("#TextAreaChatLog").appendChild(e),ElementScrollToEnd("TextAreaChatLog")}sendChat(t){ServerSend("ChatRoomChat",{Type:"Chat",Content:t})}onRequest(t,e){l.set(t,e)}onPacket(t,e){y("ChatRoomMessage",m.ADD_BEHAVIOR,(n,a)=>{const s=n[0],r=g(s.Sender);return r&&s.Content===i.key&&s.Dictionary.msg===t&&!r.IsPlayer()&&e(s.Dictionary.data,r),a(n)})}}const u=new R;export{M as handleBeepRequest,k as handleBeepRequestResponse,P as handlePacketRequest,q as handlePacketRequestResponse,u as messagesManager};
1
+ import{getPlayer as g,MOD_DATA as u}from"./index";import{hookFunction as p,HookPriority as m}from"./modsApi";import{setFontFamily as h}from"./ui";import{validateData as f}from"./validation";class k{sendBeep(n,e){const c={IsSecret:!0,BeepType:"Leash",MemberNumber:e,Message:JSON.stringify({...n})};ServerSend("AccountBeep",c)}sendPacket(n,e,c){const o={Content:u.key,Dictionary:{msg:n},Type:"Hidden"};e&&(o.Dictionary.data=e),c&&(o.Target=c),ServerSend("ChatRoomChat",o)}sendAction(n,e=void 0,c=[]){if(!n||!ServerPlayerIsInChatRoom())return;const o=CharacterPronounDescription(Player)==="She/Her",i=o?"Her":"His",s=o?"Her":"Him",r=o?"Herself":"Himself",t=o?"She":"He";n=n.replaceAll("<Possessive>",i).replaceAll("<possessive>",i.toLocaleLowerCase()).replaceAll("<Intensive>",s).replaceAll("<intensive>",s.toLocaleLowerCase()).replaceAll("<SelfIntensive>",r).replaceAll("<selfIntensive>",r.toLocaleLowerCase()).replaceAll("<Pronoun>",t).replaceAll("<pronoun>",t.toLocaleLowerCase()),ServerSend("ChatRoomChat",{Content:"ZC_CUSTOM_ACTION",Type:"Action",Target:e??void 0,Dictionary:[{Tag:'MISSING TEXT IN "Interface.csv": ZC_CUSTOM_ACTION',Text:n},...c]})}sendRequest({message:n,data:e={},target:c,type:o="packet"}){const i=crypto.randomUUID();return new Promise(s=>{let r;o==="packet"?(C.sendPacket("request",{requestId:i,message:n,data:e},c),r=p("ChatRoomMessage",m.ADD_BEHAVIOR,(t,a)=>{const l=t[0],d=g(l.Sender);if(!d)return a(t);if(l.Content===u.key&&!d.IsPlayer()){const y=l.Dictionary.msg,R=l.Dictionary.data;y==="requestResponse"&&R.requestId===i&&(r(),s({data:R.data,isError:!1}))}return a(t)})):(C.sendBeep({type:`${u.key}_request`,requestId:i,message:n,data:e},c),r=p("ServerAccountBeep",m.ADD_BEHAVIOR,(t,a)=>{const l=t[0];if(l.BeepType!=="Leash")return a(t);let d;try{d=JSON.parse(l.Message)}catch{return a(t)}return d.type===`${u.key}_requestResponse`&&d.requestId===i&&(r(),s({data:d.data,isError:!1})),a(t)})),setTimeout(()=>{r(),s({isError:!0})},6e3)})}sendLocal(n){if(!ServerPlayerIsInChatRoom())return;const e=document.createElement("div");e.setAttribute("class","ChatMessage ChatMessageLocalMessage"),e.setAttribute("data-time",ChatRoomCurrentTime()),e.setAttribute("data-sender",`${Player.MemberNumber}`),h(e,u.fontFamily),e.style.background=u.chatMessageBackground??"#55edc095",e.style.color=u.chatMessageColor??"black",e.style.margin="0.15em 0",typeof n=="string"?e.innerHTML=n:e.appendChild(n),document.querySelector("#TextAreaChatLog").appendChild(e),ElementScrollToEnd("TextAreaChatLog")}sendChat(n){ServerSend("ChatRoomChat",{Type:"Chat",Content:n})}onRequest(n,e,c){let o,i;typeof e=="function"&&e.prototype?.constructor==e?(i=e,o=c):o=e,p("ChatRoomMessage",m.ADD_BEHAVIOR,async(s,r)=>{const t=s[0],a=g(t.Sender);if(!a)return r(s);if(t.Content===u.key&&!a.IsPlayer()){const l=t.Dictionary?.msg,d=t.Dictionary?.data;if(l==="request"&&d.message===n){if(typeof d.requestId!="string"||typeof d.message!="string")return;if(i&&!(await f(d.data,i)).isValid)return r(s);const y=o(d.data,a);y!==void 0&&C.sendPacket("requestResponse",{requestId:d.requestId,message:d.message,data:y},a.MemberNumber)}}return r(s)}),p("ServerAccountBeep",m.ADD_BEHAVIOR,async(s,r)=>{const t=s[0];if(t.BeepType!=="Leash")return r(s);let a;try{a=JSON.parse(t.Message)}catch{return r(s)}if(a.type===`${u.key}_request`&&a.message===n){if(typeof a.requestId!="string")return;if(i&&!(await f(a.data,i)).isValid)return r(s);o(a.data,t.MemberNumber,t.MemberName)!==void 0&&C.sendBeep({type:`${u.key}_requestResponse`,requestId:a.requestId,message:a.message,data:a.data},t.MemberNumber)}return r(s)})}onPacket(n,e,c){p("ChatRoomMessage",m.ADD_BEHAVIOR,async(o,i)=>{let s,r;typeof e=="function"&&e.prototype?.constructor==e?(r=e,s=c):s=e;const t=o[0],a=g(t.Sender);if(!a)return i(o);if(t.Content===u.key&&t.Dictionary.msg===n&&!a.IsPlayer()){if(r&&!(await f(t.Dictionary?.data,r)).isValid)return i(o);s(t.Dictionary.data,a)}return i(o)})}}const C=new k;export{C as messagesManager};
package/dist/modsApi.js CHANGED
@@ -1 +1 @@
1
- import d from"bondage-club-mod-sdk";import{getPlayer as p,MOD_DATA as s}from"./index";import{getCurrentSubscreen as c}from"./ui";import{handleBeepRequest as f,handleBeepRequestResponse as m,handlePacketRequest as g,handlePacketRequestResponse as l}from"./messaging";var y=(t=>(t[t.OBSERVE=0]="OBSERVE",t[t.ADD_BEHAVIOR=1]="ADD_BEHAVIOR",t[t.MODIFY_BEHAVIOR=5]="MODIFY_BEHAVIOR",t[t.OVERRIDE_BEHAVIOR=10]="OVERRIDE_BEHAVIOR",t[t.TOP=100]="TOP",t))(y||{});let i;function O(){i=d.registerMod({name:s.name,fullName:s.fullName,version:s.version,repository:s.repository}),a("GameKeyDown",1,(e,r)=>(CommonKey.IsPressed(e[0],"Escape")&&c()&&c().exit(),r(e))),a("ChatRoomMessage",1,(e,r)=>{const o=e[0],n=p(o.Sender);if(!n)return r(e);if(o.Content===s.key&&!n.IsPlayer()){const u=o.Dictionary.msg,t=o.Dictionary.data;if(u==="request"){if(typeof t.requestId!="string"||typeof t.message!="string")return;g(t.requestId,t.message,t.data,n)}if(u==="requestResponse"){if(typeof t.requestId!="string")return;l(t.requestId,t.data)}}return r(e)}),a("ServerAccountBeep",1,(e,r)=>{const o=e[0];if(o.BeepType!=="Leash")return r(e);let n;try{n=JSON.parse(o.Message)}catch{return r(e)}if(n.type===`${s.key}_request`){if(typeof n.requestId!="string"||typeof n.message!="string")return;f(n.requestId,n.message,n.data,o.MemberNumber,o.MemberName)}if(n.type===`${s.key}_requestResponse`){if(typeof n.requestId!="string")return;m(n.requestId,n.data)}return r(e)})}function a(e,r,o){if(!i)throw new Error("zois-core is not registered");return i.hookFunction(e,r,o)}function B(e,r){if(!i)throw new Error("zois-core is not registered");i.patchFunction(e,r)}function T(e,r,o){if(!i)throw new Error("zois-core is not registered");return i.callOriginal(e,r)}function S(){return d.getModsInfo()}function N(e){return!!d.getModsInfo().find(r=>r.name===e)}export{y as HookPriority,T as callOriginal,N as findModByName,S as getLoadedMods,a as hookFunction,B as patchFunction,O as registerMod};
1
+ import i from"bondage-club-mod-sdk";import{MOD_DATA as r}from"./index";import{getCurrentSubscreen as s}from"./ui";var a=(o=>(o[o.OBSERVE=0]="OBSERVE",o[o.ADD_BEHAVIOR=1]="ADD_BEHAVIOR",o[o.MODIFY_BEHAVIOR=5]="MODIFY_BEHAVIOR",o[o.OVERRIDE_BEHAVIOR=10]="OVERRIDE_BEHAVIOR",o[o.TOP=100]="TOP",o))(a||{});let t;function h(){t=i.registerMod({name:r.name,fullName:r.fullName,version:r.version,repository:r.repository}),c("GameKeyDown",1,(e,n)=>(CommonKey.IsPressed(e[0],"Escape")&&s()&&s().exit(),n(e)))}function c(e,n,d){if(!t)throw new Error("zois-core is not registered");return t.hookFunction(e,n,d)}function I(e,n){if(!t)throw new Error("zois-core is not registered");t.patchFunction(e,n)}function E(e,n,d){if(!t)throw new Error("zois-core is not registered");return t.callOriginal(e,n)}function T(){return i.getModsInfo()}function O(e){return!!i.getModsInfo().find(n=>n.name===e)}export{a as HookPriority,E as callOriginal,O as findModByName,T as getLoadedMods,c as hookFunction,I as patchFunction,h as registerMod};
@@ -0,0 +1 @@
1
+ class r{overrideProperties(e,t){return e}layoutEffect(e,t){}effect(e,t){}}export{r as BaseModule};
package/dist/popups.js CHANGED
@@ -1 +1 @@
1
- import{getRelativeWidth as y,getRelativeX as D,getRelativeY as b}from"./ui";import{MOD_DATA as v}from"./index";import{useState as m,useEffect as u}from"react";import x from"react-dom/client";import{create as w}from"zustand";import O from"./assets/warningIcon.svg";import z from"./assets/errorIcon.svg";import C from"./assets/infoIcon.svg";import E from"./assets/successIcon.svg";import{Fragment as f,jsx as a,jsxs as d}from"react/jsx-runtime";function P({children:o}){const[e,t]=m({}),i=window.ZOISCORE.useToastsStore(s=>s.clearToasts);return u(()=>{const s=()=>{t({fontFamily:v.fontFamily??"sans-serif",bottom:b(5)+"px",left:D(5)+"px"})};return window.addEventListener("resize",s),s(),()=>{window.removeEventListener("resize",s)}},[]),a("div",{className:"zcToastsContainer",style:e,onClick:()=>{document.querySelectorAll(".zcToast").forEach(s=>{s.classList.add("exiting")}),setTimeout(i,300)},children:o})}function I({title:o,message:e,type:t,duration:i,id:s}){const[c,n]=m({}),[r,l]=m(!1);return u(()=>{const p=()=>{const T=MainCanvas.canvas.clientWidth,h=MainCanvas.canvas.clientHeight,g=Math.min(T,h)/100;n({position:"relative",width:"100%",borderRadius:"0.1em",fontSize:3*g+"px",padding:1.5*g+"px"})};window.addEventListener("resize",p),p();const S=setTimeout(()=>l(!0),i);return()=>{clearTimeout(S),window.removeEventListener("resize",p)}},[]),d("div",{className:`zcToast ${r&&"exiting"}`,"data-zc-toast-type":t,style:c,children:[d("div",{style:{display:"flex",alignItems:"center",gap:"1vw",position:"relative",zIndex:5},children:[t==="spinner"?a("div",{className:"zcSpinner",style:{width:"2vw",height:"2vw"}}):a("img",{src:t==="info"?C:t==="success"?E:t==="warning"?O:z,style:{width:"2vw"}}),d("div",{children:[o&&e&&d(f,{children:[a("p",{children:o}),a("p",{style:{color:t==="info"?"#b8b8ff":t==="success"?"#c7f9c7":t==="error"?"#f8bcbc":"#ffeec5",fontSize:"70%",overflowWrap:"anywhere"},children:e})]}),(!o&&e||o&&!e)&&a("p",{style:{position:"relative",zIndex:5},children:o||e})]})]}),a("div",{className:"zcToast-ProgressBar",style:{animation:`zcToast-progress ${i}ms linear 0s 1 alternate none`,position:"absolute",top:0,left:0,height:"100%"}})]})}function R({dialog:o}){const e=window.ZOISCORE.useDialogStore(n=>n.clearDialog),[t,i]=m({}),[s,c]=m([]);return u(()=>{const n=()=>{const r=MainCanvas.canvas.clientWidth,l=MainCanvas.canvas.clientHeight,p=Math.min(r,l)/100;i({width:y(o.width),position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(36, 36, 36, 0.96)",zIndex:20,fontFamily:v.fontFamily??"sans-serif",border:"none",padding:2*p})};return window.addEventListener("resize",n),n(),()=>{window.removeEventListener("resize",n)}},[]),d("dialog",{open:Object.keys(t).length>0,"data-zc-dialog-type":o.type,style:t,children:[o.title&&a("p",{style:{position:"absolute",top:0,left:0,fontWeight:"bold",color:"white",fontSize:"clamp(6px, 2vw, 24px)",padding:"0.25em",background:"#2d2d2d",width:"100%"},children:o.title}),a("p",{style:{padding:"1em",marginTop:"2vw",fontSize:"clamp(6px, 2vw, 24px)",color:"white"},children:o.body}),a("div",{style:{display:"flex",flexDirection:o.buttons.direction,justifyContent:"center",gap:"0.5vw"},children:o.buttons?.list?.map((n,r)=>a("button",{className:"zcDialogBtn","data-zc-picked":s.includes(r),style:{width:"100%",position:"relative"},onClick:()=>{o.type==="choice_one"?(e(),o.promise.resolve(n.value)):s.includes(r)?c(s.filter(l=>l!==r)):c([...s,r])},children:n.text}))}),o.type==="choice_multiple"&&a("button",{style:{cursor:"pointer",color:"white",background:"#4d4d4d",border:"none",marginTop:"1vw",fontSize:"clamp(8px,2.5vw,28px)",padding:"0.2em",borderRadius:"4px"},onClick:()=>{e(),o.promise.resolve(o.buttons.list.filter((n,r)=>s.includes(r)).map(n=>n.value))},children:"Confirm"})]})}class M{generateToastId(){const{toasts:e}=window.ZOISCORE.useToastsStore.getState();return`${Date.now()}:${e.length+1}`}process({title:e,message:t,duration:i,type:s,id:c}){const{addToast:n,removeToast:r}=window.ZOISCORE.useToastsStore.getState();n({id:c,title:e,message:t,duration:i,type:s}),setTimeout(()=>r(c),i+300)}info({title:e,message:t,duration:i}){const s=this.generateToastId();this.process({title:e,message:t,duration:i,type:"info",id:s})}success({title:e,message:t,duration:i}){const s=this.generateToastId();this.process({title:e,message:t,duration:i,type:"success",id:s})}warn({title:e,message:t,duration:i}){const s=this.generateToastId();this.process({title:e,message:t,duration:i,type:"warning",id:s})}error({title:e,message:t,duration:i}){const s=this.generateToastId();this.process({title:e,message:t,duration:i,type:"error",id:s})}spinner({title:e,message:t}){const i=this.generateToastId();return this.process({title:e,message:t,duration:1e6,type:"spinner",id:i}),i}removeSpinner(e){const{removeToast:t}=window.ZOISCORE.useToastsStore.getState();t(e)}}class k{showDialog({type:e,title:t,body:i,buttons:s,width:c}){const{setDialog:n}=window.ZOISCORE.useDialogStore.getState();return new Promise((r,l)=>{n({width:c,type:e,title:t,body:i,buttons:s,promise:{resolve:r,reject:l}})})}}function L(){const o=window.ZOISCORE.useToastsStore(t=>t.toasts),e=window.ZOISCORE.useDialogStore(t=>t.dialog);return d(f,{children:[a(P,{children:o.map(({title:t,message:i,type:s,duration:c,id:n})=>a(I,{id:n,title:t,message:i,type:s,duration:c},n))}),e&&a(R,{dialog:e})]})}class N extends HTMLElement{disconnectedCallback(){ServerShowBeep("VirtualDOM was removed, chaos is coming...",5e3,{})}}const Y=w(o=>({toasts:[],addToast:e=>o(t=>({toasts:[...t.toasts,e]})),removeToast:e=>o(t=>({toasts:t.toasts.filter(i=>i.id!==e)})),clearToasts:()=>o({toasts:[]})})),G=w(o=>({dialog:null,setDialog:e=>o({dialog:e}),clearDialog:()=>o({dialog:null})}));function K(){customElements.define("zc-virtual-dom",N);const o=document.createElement("zc-virtual-dom");document.body.append(o),x.createRoot(document.getElementsByTagName("zc-virtual-dom")[0]).render(a(L,{}))}const Q=new M,U=new k;export{U as dialogsManager,K as initVirtualDOM,Q as toastsManager,G as useDialogStore,Y as useToastsStore};
1
+ import{getRelativeWidth as C,getRelativeX as y,getRelativeY as D}from"./ui";import{MOD_DATA as p}from"./index";import{useState as g,useEffect as f}from"react";import x from"react-dom/client";import{create as T}from"zustand";import{CircleAlert as z,CircleCheck as O,CircleX as k,Info as E}from"lucide-react";import{Fragment as w,jsx as a,jsxs as d}from"react/jsx-runtime";function I({children:o}){const[t,e]=g({}),r=window.ZOISCORE.useToastsStore(s=>s.clearToasts);return f(()=>{const s=()=>{e({fontFamily:CommonGetFontName(),bottom:D(5)+"px",left:y(5)+"px"})};return window.addEventListener("resize",s),s(),()=>{window.removeEventListener("resize",s)}},[]),a("div",{className:"zcToastsContainer",style:t,onClick:()=>{document.querySelectorAll(".zcToast").forEach(s=>{s.classList.add("exiting")}),setTimeout(r,300)},children:o})}const P=({type:o,theme:t})=>{switch(o){case"info":return a(E,{style:{width:"1.65em",height:"1.65em",fill:t?t.iconFillColor:"#addbff",stroke:t?t.iconStrokeColor:"#385073"}});case"success":return a(O,{style:{width:"1.65em",height:"1.65em",fill:t?t.iconFillColor:"#c3ffc3",stroke:t?t.iconStrokeColor:"#028f74"}});case"warning":return a(z,{style:{width:"1.65em",height:"1.65em",fill:t?t.iconFillColor:"#ffdfaf",stroke:t?t.iconStrokeColor:"#9c7633"}});case"error":return a(k,{style:{width:"1.65em",height:"1.65em",fill:t?t.iconFillColor:"#ffb2b2",stroke:t?t.iconStrokeColor:"#7f2828"}});case"spinner":return a("div",{style:{width:"1.65em",height:"1.65em",boxSizing:"border-box",border:"2px solid",borderRadius:"100%",borderColor:`transparent ${t?t.iconFillColor:"rgb(154 154 255)"}`,animation:"zcSpin 0.65s linear infinite"}})}};function R({title:o,message:t,type:e,duration:r,id:s,theme:i}){const[n,c]=g({}),[l,m]=g(!1);return f(()=>{const u=()=>{const h=MainCanvas.canvas.clientWidth,b=MainCanvas.canvas.clientHeight,v=Math.min(h,b)/100;c({position:"relative",width:"100%",borderRadius:"0.1em",fontSize:3*v+"px",padding:1.5*v+"px",background:i?i.backgroundColor:e==="success"?"#3ece7e":e==="warning"?"#debf72":e==="error"?"rgb(212, 46, 107)":"rgb(80, 80, 223)"})};window.addEventListener("resize",u),u();const S=setTimeout(()=>m(!0),r);return()=>{clearTimeout(S),window.removeEventListener("resize",u)}},[]),d("div",{className:`zcToast ${l&&"exiting"}`,"data-zc-toast-type":e,style:n,children:[d("div",{style:{display:"flex",alignItems:"center",gap:"1vw",position:"relative",zIndex:5},children:[a(P,{type:e,theme:i}),d("div",{children:[o&&t&&d(w,{children:[a("p",{style:{color:i?i.titleColor:"white"},children:o}),a("p",{style:{color:i?i.messageColor:e==="info"||e==="spinner"?"#b8b8ff":e==="success"?"#c7f9c7":e==="error"?"#f8bcbc":"#ffeec5",fontSize:"70%",overflowWrap:"anywhere",marginTop:"0.25em"},children:t})]}),(!o&&t||o&&!t)&&a("p",{style:{position:"relative",zIndex:5},children:o||t})]})]}),e!=="spinner"&&a("div",{className:"zcToast-ProgressBar",style:{animation:`zcToast-progress ${r}ms linear 0s 1 alternate none`,position:"absolute",top:0,left:0,height:"100%",background:i?i.progressBarColor:e==="info"?"rgb(103, 103, 234)":e==="success"?"#34bc71":e==="warning"?"#d0af5e":"rgb(183, 40, 92)"}})]})}function M({dialog:o}){const t=window.ZOISCORE.useDialogStore(n=>n.clearDialog),[e,r]=g({}),[s,i]=g([]);return f(()=>{const n=()=>{const c=MainCanvas.canvas.clientWidth,l=MainCanvas.canvas.clientHeight,m=Math.min(c,l)/100;r({width:C(o.width),position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(36, 36, 36, 0.96)",zIndex:20,fontFamily:CommonGetFontName(),border:"none",padding:2*m})};return window.addEventListener("resize",n),n(),()=>{window.removeEventListener("resize",n)}},[]),d("dialog",{open:Object.keys(e).length>0,"data-zc-dialog-type":o.type,style:e,children:[o.title&&a("p",{style:{position:"absolute",top:0,left:0,fontWeight:"bold",color:"white",fontSize:"clamp(6px, 2vw, 24px)",padding:"0.25em",background:"#2d2d2d",width:"100%"},children:o.title}),a("p",{style:{padding:"1em",marginTop:"2vw",fontSize:"clamp(6px, 2vw, 24px)",color:"white"},children:o.body}),a("div",{style:{display:"flex",flexDirection:o.buttons.direction,justifyContent:"center",gap:"0.5vw"},children:o.buttons?.list?.map((n,c)=>a("button",{className:"zcDialogBtn","data-zc-picked":s.includes(c),style:{width:"100%",position:"relative"},onClick:()=>{o.type==="choice_one"?(t(),o.promise.resolve(n.value)):s.includes(c)?i(s.filter(l=>l!==c)):i([...s,c])},children:n.text}))}),o.type==="choice_multiple"&&a("button",{style:{cursor:"pointer",color:"white",background:"#4d4d4d",border:"none",marginTop:"1vw",fontSize:"clamp(8px,2.5vw,28px)",padding:"0.2em",borderRadius:"4px"},onClick:()=>{t(),o.promise.resolve(o.buttons.list.filter((n,c)=>s.includes(c)).map(n=>n.value))},children:"Confirm"})]})}class F{generateToastId(){return crypto.randomUUID()}process({title:t,message:e,duration:r,type:s,id:i,theme:n}){const{addToast:c,removeToast:l}=window.ZOISCORE.useToastsStore.getState();c({id:i,title:t,message:e,duration:r,type:s,theme:n}),setTimeout(()=>l(i),r+300)}info({title:t,message:e,duration:r}){const s=this.generateToastId(),i=p.singleToastsTheme;this.process({title:t,message:e,duration:r,type:"info",id:s,theme:i})}success({title:t,message:e,duration:r}){const s=this.generateToastId(),i=p.singleToastsTheme;this.process({title:t,message:e,duration:r,type:"success",id:s,theme:i})}warn({title:t,message:e,duration:r}){const s=this.generateToastId(),i=p.singleToastsTheme;this.process({title:t,message:e,duration:r,type:"warning",id:s,theme:i})}error({title:t,message:e,duration:r}){const s=this.generateToastId(),i=p.singleToastsTheme;this.process({title:t,message:e,duration:r,type:"error",id:s,theme:i})}spinner({title:t,message:e}){const r=this.generateToastId(),s=p.singleToastsTheme;return this.process({title:t,message:e,duration:1e6,type:"spinner",id:r,theme:s}),r}removeSpinner(t){const{removeToast:e}=window.ZOISCORE.useToastsStore.getState();e(t)}}class N{showDialog({type:t,title:e,body:r,buttons:s,width:i}){const{setDialog:n}=window.ZOISCORE.useDialogStore.getState();return new Promise((c,l)=>{n({width:i,type:t,title:e,body:r,buttons:s,promise:{resolve:c,reject:l}})})}}function L(){const o=window.ZOISCORE.useToastsStore(e=>e.toasts),t=window.ZOISCORE.useDialogStore(e=>e.dialog);return d(w,{children:[a(I,{children:o.map(({title:e,message:r,type:s,duration:i,id:n,theme:c})=>a(R,{id:n,title:e,message:r,type:s,duration:i,theme:c},n))}),t&&a(M,{dialog:t})]})}class W extends HTMLElement{disconnectedCallback(){ServerShowBeep("VirtualDOM was removed, chaos is coming...",5e3,{})}}const q=T(o=>({toasts:[],addToast:t=>o(e=>({toasts:[...e.toasts,t]})),removeToast:t=>o(e=>({toasts:e.toasts.filter(r=>r.id!==t)})),clearToasts:()=>o({toasts:[]})})),Y=T(o=>({dialog:null,setDialog:t=>o({dialog:t}),clearDialog:()=>o({dialog:null})}));function K(){customElements.define("zc-virtual-dom",W);const o=document.createElement("zc-virtual-dom");document.body.append(o),x.createRoot(document.getElementsByTagName("zc-virtual-dom")[0]).render(a(L,{}))}const Q=new F,tt=new N;export{tt as dialogsManager,K as initVirtualDOM,Q as toastsManager,Y as useDialogStore,q as useToastsStore};
package/dist/styles.css CHANGED
@@ -1 +1 @@
1
- *{margin:0;padding:0;box-sizing:border-box}.zcButton{cursor:pointer;background:var(--tmd-element, white);color:var(--tmd-text, black);border:2px solid var(--tmd-accent, black);border-radius:4px}.zcButton:hover{background:var(--tmd-element-hover, #ebf7fe);border-color:var(--tmd-accent-hover, #7dd3fc);color:var(--tmd-accent-hover, #015a8c)}.zcButton .tooltip{position:absolute;color:#000;text-align:center;padding:4px;border-radius:4px;background:#ff8;border:2px solid #e7e787;width:max-content;min-height:100%;visibility:hidden;z-index:10}.zcButton .tooltip[position=left]{right:calc(100% + 1vw)}.zcButton .tooltip[position=right]{left:calc(100% + 1vw)}.zcButton:hover .tooltip{visibility:visible}.zcButton[data-zc-style=green]{background:#7cff7c;border-color:#52cc52;color:#000}.zcButton[data-zc-style=green]:hover{background:#5ec55e;color:#000}.zcButton[data-zc-style=inverted]{background:var(--tmd-accent, #303030);border:none;color:var(--tmd-text, white)}.zcButton[data-zc-style=inverted]:hover{background:var(--tmd-accent-hover, #474747)}.zcInput{background:var(--tmd-element, white);color:var(--tmd-text, black);padding:2vw;border:2px solid var(--tmd-accent, black);border-radius:4px}.zcInput::placeholder{color:var(--tmd-text, black)}.zcBackNextButton{display:flex;column-gap:2vw;justify-content:center;align-items:center;background:var(--tmd-element, white);color:var(--tmd-text, black);border:2px solid var(--tmd-accent, black);border-radius:4px}.zcBackNextButton-btnDisabled{background:#ffa590;pointer-events:none}.zcTabs{display:flex}.zcTabs button{cursor:pointer;width:100%;color:var(--tmd-text, black);background:none;border:none;border-bottom:2px solid var(--tmd-element, rgb(214, 214, 214));padding:.25em}.zcTabs button[data-opened=true]{font-weight:700;border-bottom:2px solid var(--tmd-accent, rgb(81, 81, 231))!important}.zcTabs button:hover{background:var(--tmd-element, rgb(235, 235, 235));border-bottom:2px solid var(--tmd-element-hover, rgb(149, 149, 149))}.zcToastsContainer{display:flex;flex-direction:column;gap:.25vw;cursor:pointer;position:fixed;z-index:10}.zcToast[data-zc-toast-type=info],.zcToast[data-zc-toast-type=spinner]{background:#5050df}.zcToast[data-zc-toast-type=success]{background:#3ece7e}.zcToast[data-zc-toast-type=warning]{background:#debf72}.zcToast[data-zc-toast-type=error]{background:#d42e6b}@keyframes zcToast-progress{0%{width:0}to{width:100%}}@keyframes zcSlideInFromLeft{0%{transform:translate(-100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes zcSlideOutToLeft{0%{transform:translate(0);opacity:1}to{transform:translate(-100%);opacity:0}}.zcToast{max-width:25vw;animation:zcSlideInFromLeft .3s ease-out forwards}.zcToast.exiting{animation:zcSlideOutToLeft .3s ease-out forwards}.zcToast[data-zc-toast-type=info] .zcToast-ProgressBar{background:#6767ea}.zcToast[data-zc-toast-type=success] .zcToast-ProgressBar{background:#34bc71}.zcToast[data-zc-toast-type=warning] .zcToast-ProgressBar{background:#d0af5e}.zcToast[data-zc-toast-type=error] .zcToast-ProgressBar{background:#b7285c}.zcToast p{color:#fff}dialog[data-zc-dialog-type=choice_multiple] .zcDialogBtn:before{content:"";position:absolute;left:1vw;top:50%;transform:translateY(-50%);border:2px solid white;width:.5em;aspect-ratio:1/1;border-radius:50%}dialog[data-zc-dialog-type=choice_multiple] .zcDialogBtn[data-zc-picked=true]:before{background:#fff}.zcDialogBtn{cursor:pointer;background:#ffffff17;border:none;font-size:clamp(6px,2vw,24px);color:#fff;padding:.2em;border-radius:.5em}.zcDialogBtn:hover{background:#ffffff24}@keyframes zcSpin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.zcSpinner{box-sizing:border-box;border:2px solid;border-radius:100%;border-color:#fff;border-right-color:#5050df;animation:zcSpin .65s linear infinite}.zcDisabled{pointer-events:none;opacity:.6}
1
+ *{margin:0;padding:0;box-sizing:border-box}.zcButton{cursor:pointer;background:var(--tmd-element, white);color:var(--tmd-text, black);border:2px solid var(--tmd-accent, black);border-radius:4px}.zcButton:hover{background:var(--tmd-element-hover, #ebf7fe);border-color:var(--tmd-accent-hover, #7dd3fc);color:var(--tmd-accent-hover, #015a8c)}.zcButton .tooltip{position:absolute;color:#000;text-align:center;padding:4px;border-radius:4px;background:#ff8;border:2px solid #e7e787;width:max-content;min-height:100%;visibility:hidden;z-index:10}.zcButton .tooltip[position=left]{right:calc(100% + 1vw)}.zcButton .tooltip[position=right]{left:calc(100% + 1vw)}.zcButton:hover .tooltip{visibility:visible}.zcButton[data-zc-style=green]{background:#7cff7c;border-color:#52cc52;color:#000}.zcButton[data-zc-style=green]:hover{background:#5ec55e;color:#000}.zcButton[data-zc-style=inverted]{background:var(--tmd-accent, #303030);border:none;color:var(--tmd-text, white)}.zcButton[data-zc-style=inverted]:hover{background:var(--tmd-accent-hover, #474747)}.zcInput{background:var(--tmd-element, white);color:var(--tmd-text, black);padding:2vw;border:2px solid var(--tmd-accent, black);border-radius:4px}.zcInput::placeholder{color:var(--tmd-text, black)}.zcBackNextButton{display:flex;column-gap:2vw;justify-content:center;align-items:center;background:var(--tmd-element, white);color:var(--tmd-text, black);border:2px solid var(--tmd-accent, black);border-radius:4px}.zcBackNextButton-btnDisabled{background:#ffa590;pointer-events:none}.zcTabs{display:flex}.zcTabs button{cursor:pointer;width:100%;color:var(--tmd-text, black);background:none;border:none;border-bottom:2px solid var(--tmd-element, rgb(214, 214, 214));padding:.25em}.zcTabs button[data-opened=true]{font-weight:700;border-bottom:2px solid var(--tmd-accent, rgb(81, 81, 231))!important}.zcTabs button:hover{background:var(--tmd-element, rgb(235, 235, 235));border-bottom:2px solid var(--tmd-element-hover, rgb(149, 149, 149))}.zcCard{border:2px solid var(--tmd-accent, rgb(195, 195, 195));border-radius:.4em;background:var(--tmd-element, white);color:var(--tmd-text, black);padding:.4em 2.5em .4em .4em}.zcCard:hover{border:2px solid var(--tmd-accent-hover, rgb(170, 170, 170))}.zcCard_name{font-size:.5em;color:var(--tmd-text, rgb(100, 100, 100))}.zcCard_value{color:var(--tmd-text, black);margin-top:.4em;font-weight:700}.zcSelect{cursor:pointer;background:var(--tmd-element, white);color:var(--tmd-text, black);border:2px solid var(--tmd-accent, rgb(195, 195, 195));border-radius:.4em;padding:.45em}.zcSelect[opened=true]{border-color:var(--tmd-accent-hover, rgb(0, 96, 223))}.zcSelect[opened=false]:hover{border-color:var(--tmd-accent-hover, rgb(170, 170, 170))}.zcSelect>svg{position:absolute;right:.45em;top:50%;transform:translateY(-50%);width:1.5em;height:1.5em;color:var(--tmd-accent, rgb(0, 96, 223))}.zcSelect>div[data-zc-position=bottom]{position:absolute;top:calc(100% + .45em);left:0;width:100%;background:var(--tmd-element, #f6f6f6ed);border:2px solid var(--tmd-element-hover, rgb(235 235 235));border-radius:.4em}.zcSelect>div[data-zc-position=top]{position:absolute;bottom:calc(100% + .45em);left:0;width:100%;background:var(--tmd-element, #f6f6f6ed);border:2px solid var(--tmd-element-hover, rgb(235 235 235));border-radius:.4em}.zcSelect>div>div{color:var(--tmd-text, black);width:100%;padding:.45em;border-radius:.25em}.zcSelect>div>div>svg{width:1.25em;height:1.25em;color:var(--tmd-accent, rgb(0, 96, 223))}.zcSelect>div>div:hover{background:var(--tmd-element-hover, #ededed)}.zcToastsContainer{display:flex;flex-direction:column;gap:.25vw;cursor:pointer;position:fixed;z-index:10}@keyframes zcToast-progress{0%{width:0}to{width:100%}}@keyframes zcSlideInFromLeft{0%{transform:translate(-100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes zcSlideOutToLeft{0%{transform:translate(0);opacity:1}to{transform:translate(-100%);opacity:0}}.zcToast{max-width:25vw;animation:zcSlideInFromLeft .3s ease-out forwards}.zcToast.exiting{animation:zcSlideOutToLeft .3s ease-out forwards}.zcToast p{color:#fff}dialog[data-zc-dialog-type=choice_multiple] .zcDialogBtn:before{content:"";position:absolute;left:1vw;top:50%;transform:translateY(-50%);border:2px solid white;width:.5em;aspect-ratio:1/1;border-radius:50%}dialog[data-zc-dialog-type=choice_multiple] .zcDialogBtn[data-zc-picked=true]:before{background:#fff}.zcDialogBtn{cursor:pointer;background:#ffffff17;border:none;font-size:clamp(6px,2vw,24px);color:#fff;padding:.2em;border-radius:.5em}.zcDialogBtn:hover{background:#ffffff24}@keyframes zcSpin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes zcCursorBlink{0%{border-right-color:transparent}to{border-right-color:#2a2a2a}}.zcCursor{border-right:2px solid var(--tmd-text, rgb(42, 42, 42));width:fit-content}.zcDisabled{pointer-events:none;opacity:.6}
@@ -1,4 +1,4 @@
1
- interface ModData {
1
+ export interface ModData {
2
2
  name: string;
3
3
  fullName: string;
4
4
  key: string;
@@ -7,6 +7,37 @@ interface ModData {
7
7
  chatMessageBackground?: string;
8
8
  chatMessageColor?: string;
9
9
  fontFamily?: string;
10
+ singleToastsTheme?: {
11
+ backgroundColor: string;
12
+ progressBarColor: string;
13
+ titleColor: string;
14
+ messageColor: string;
15
+ iconFillColor: string;
16
+ iconStrokeColor: string;
17
+ };
18
+ }
19
+ interface ThemedColorsModule {
20
+ base: {
21
+ accent: string;
22
+ accentDisabled: string;
23
+ accentHover: string;
24
+ element: string;
25
+ elementDisabled: string;
26
+ elementHint: string;
27
+ elementHover: string;
28
+ main: string;
29
+ text: string;
30
+ };
31
+ special: {
32
+ allowed: string;
33
+ blocked: string;
34
+ crafted: string;
35
+ equipped: string;
36
+ limited: string;
37
+ roomBlocked: string;
38
+ roomFriend: string;
39
+ roomGame: string;
40
+ };
10
41
  }
11
42
  export { version } from "../package.json";
12
43
  export declare let MOD_DATA: ModData;
@@ -19,4 +50,6 @@ export declare function colorsEqual(c1: string[] | string | null | undefined, c2
19
50
  export declare function getSizeInKbytes(b: any): number;
20
51
  export declare function getPlayer(value: string | number): Character;
21
52
  export declare function getNickname(target: Character): string;
22
- export declare function getThemedColorsModule(): any;
53
+ export declare function getThemedColorsModule(): ThemedColorsModule | null;
54
+ export declare function injectStyles(stylesToInject: string): void;
55
+ export declare function waitForStart(callback: () => void): void;
@@ -1,11 +1,8 @@
1
+ import { ClassConstructor } from "class-transformer";
1
2
  interface RequestResponse<T> {
2
3
  data?: T;
3
4
  isError: boolean;
4
5
  }
5
- export declare function handlePacketRequestResponse(requestId: string, data: any): void;
6
- export declare function handlePacketRequest(requestId: string, message: string, _data: any, sender: Character): void;
7
- export declare function handleBeepRequestResponse(requestId: string, data: any): void;
8
- export declare function handleBeepRequest(requestId: string, message: string, _data: any, senderNumber: number, senderName: string): void;
9
6
  declare class MessagesManager {
10
7
  sendBeep<T>(data: T, targetId: number): void;
11
8
  sendPacket<T>(msg: string, _data?: T, targetNumber?: number): void;
@@ -19,7 +16,9 @@ declare class MessagesManager {
19
16
  sendLocal(message: string | Node): void;
20
17
  sendChat(message: string): void;
21
18
  onRequest(message: string, listener: (data: any, sender: Character | number, senderName?: string) => unknown): void;
19
+ onRequest(message: string, dto: ClassConstructor<unknown>, listener: (data: any, sender: Character | number, senderName?: string) => unknown): void;
22
20
  onPacket(message: string, listener: (data: any, sender: Character) => void): void;
21
+ onPacket(message: string, dto: ClassConstructor<unknown>, listener: (data: any, sender: Character) => void): void;
23
22
  }
24
23
  export declare const messagesManager: MessagesManager;
25
24
  export {};
@@ -0,0 +1,18 @@
1
+ import { Anchor } from "./ui";
2
+ export interface Context {
3
+ anchor?: Anchor;
4
+ x?: number;
5
+ y?: number;
6
+ width?: number;
7
+ height?: number;
8
+ padding?: number;
9
+ fontSize?: number | "auto";
10
+ place?: boolean;
11
+ element: HTMLElement;
12
+ }
13
+ export type ModuleTarget = HTMLElement | SVGElement;
14
+ export declare abstract class BaseModule {
15
+ overrideProperties(context: Context, target: ModuleTarget): Context;
16
+ layoutEffect(context: Context, target: ModuleTarget): void;
17
+ effect(context: Context, target: ModuleTarget): void;
18
+ }
@@ -1,9 +1,11 @@
1
+ import { ModData } from "./index";
1
2
  interface ToastProps {
2
3
  id: string;
3
4
  title?: string;
4
5
  message: string;
5
6
  type: "info" | "warning" | "error" | "success" | "spinner";
6
7
  duration: number;
8
+ theme?: ModData["singleToastsTheme"];
7
9
  }
8
10
  interface DialogProps {
9
11
  width: number;
@@ -25,11 +27,11 @@ interface DialogProps {
25
27
  declare class ToastsManager {
26
28
  private generateToastId;
27
29
  private process;
28
- info({ title, message, duration }: Omit<ToastProps, "type" | "id">): void;
29
- success({ title, message, duration }: Omit<ToastProps, "type" | "id">): void;
30
- warn({ title, message, duration }: Omit<ToastProps, "type" | "id">): void;
31
- error({ title, message, duration }: Omit<ToastProps, "type" | "id">): void;
32
- spinner({ title, message }: Omit<ToastProps, "type" | "id" | "duration">): string;
30
+ info({ title, message, duration }: Omit<ToastProps, "type" | "id" | "theme">): void;
31
+ success({ title, message, duration }: Omit<ToastProps, "type" | "id" | "theme">): void;
32
+ warn({ title, message, duration }: Omit<ToastProps, "type" | "id" | "theme">): void;
33
+ error({ title, message, duration }: Omit<ToastProps, "type" | "id" | "theme">): void;
34
+ spinner({ title, message }: Omit<ToastProps, "type" | "id" | "duration" | "theme">): string;
33
35
  removeSpinner(id: string): void;
34
36
  }
35
37
  declare class DialogsManager {
@@ -0,0 +1,4 @@
1
+ import { BaseModule, Context } from "../modules";
2
+ export declare class CenterModule extends BaseModule {
3
+ overrideProperties(context: Context): Context;
4
+ }
@@ -0,0 +1,12 @@
1
+ import { BaseModule, Context, ModuleTarget } from "../modules";
2
+ interface CounterUpModuleProps {
3
+ duration: number;
4
+ endValue: number;
5
+ formattingFunction?: (value: number) => string;
6
+ }
7
+ export declare class CounterUpModule extends BaseModule {
8
+ private props;
9
+ constructor(props: CounterUpModuleProps);
10
+ effect(context: Context, target: ModuleTarget): void;
11
+ }
12
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from "./centerModule";
2
+ export * from "./counterUpModule";
3
+ export * from "./typeModule";
4
+ export * from "./styleModule";
@@ -0,0 +1,6 @@
1
+ import { BaseModule, Context, ModuleTarget } from "@/modules";
2
+ export declare class StyleModule extends BaseModule {
3
+ private style;
4
+ constructor(style: Partial<CSSStyleDeclaration>);
5
+ layoutEffect(context: Context, target: ModuleTarget): void;
6
+ }
@@ -0,0 +1,10 @@
1
+ import { BaseModule, Context, ModuleTarget } from "../modules";
2
+ interface TypeModuleProps {
3
+ duration: number;
4
+ }
5
+ export declare class TypeModule extends BaseModule {
6
+ private props;
7
+ constructor(props: TypeModuleProps);
8
+ effect(context: Context, target: ModuleTarget): void;
9
+ }
10
+ export {};
@@ -1,16 +1,20 @@
1
- type Anchor = "top-left" | "top-right" | "bottom-left" | "bottom-right";
2
- interface CreateButtonArgs {
3
- text?: string;
1
+ import { BaseModule } from "./modules";
2
+ export type Anchor = "top-left" | "top-right" | "bottom-left" | "bottom-right";
3
+ interface BaseElementArgs<T extends string> {
4
4
  x?: number;
5
5
  y?: number;
6
+ anchor?: Anchor;
7
+ place?: boolean;
8
+ modules?: Partial<Record<T, BaseModule[]>>;
9
+ }
10
+ interface CreateButtonArgs extends BaseElementArgs<"base" | "icon" | "text"> {
11
+ text?: string;
6
12
  fontSize?: number | "auto";
7
13
  width?: number;
8
14
  height?: number;
9
15
  padding?: number;
10
16
  style?: "default" | "green" | "inverted";
11
- anchor?: Anchor;
12
- place?: boolean;
13
- icon?: string;
17
+ icon?: string | SVGElement;
14
18
  iconAbsolutePosition?: boolean;
15
19
  iconWidth?: string;
16
20
  tooltip?: {
@@ -20,93 +24,64 @@ interface CreateButtonArgs {
20
24
  onClick?: () => void;
21
25
  isDisabled?: () => boolean;
22
26
  }
23
- interface CreateTextArgs {
27
+ interface CreateTextArgs extends BaseElementArgs<"base"> {
24
28
  text?: string;
25
29
  color?: string;
26
- x?: number;
27
- y?: number;
28
30
  fontSize?: number | "auto";
29
31
  withBackground?: boolean;
30
32
  width?: number;
31
33
  height?: number;
32
34
  padding?: number;
33
- anchor?: Anchor;
34
- place?: boolean;
35
35
  }
36
- interface CreateInputArgs {
36
+ interface CreateInputArgs extends BaseElementArgs<"base"> {
37
37
  value?: string;
38
38
  placeholder?: string;
39
- x?: number;
40
- y?: number;
41
39
  width: number;
42
40
  height?: number;
43
41
  textArea?: boolean;
44
42
  fontSize?: number | "auto";
45
- anchor?: Anchor;
46
43
  padding?: number;
47
- place?: boolean;
48
44
  onChange?: () => void;
49
45
  onInput?: () => void;
50
46
  isDisabled?: () => boolean;
51
47
  }
52
- interface CreateCheckboxArgs {
48
+ interface CreateCheckboxArgs extends BaseElementArgs<"base" | "checkbox" | "label"> {
53
49
  isChecked: boolean;
54
- x?: number;
55
- y?: number;
56
50
  width?: number;
57
51
  text: string;
58
- anchor?: Anchor;
59
- place?: boolean;
60
52
  onChange?: () => void;
61
53
  isDisabled?: () => boolean;
62
54
  }
63
- interface CreateScrollViewArgs {
55
+ interface CreateScrollViewArgs extends BaseElementArgs<"base"> {
64
56
  scroll: "x" | "y" | "all";
65
- x: number;
66
- y: number;
67
57
  width: number;
68
58
  height?: number;
69
- anchor?: Anchor;
70
59
  }
71
- interface CreateInputListArgs {
60
+ interface CreateInputListArgs extends BaseElementArgs<"base" | "input"> {
72
61
  value?: string[] | number[];
73
62
  title?: string;
74
- x?: number;
75
- y?: number;
76
63
  width: number;
77
64
  height?: number;
78
65
  fontSize?: number | "auto";
79
- anchor?: Anchor;
80
66
  padding?: number;
81
- place?: boolean;
82
67
  numbersOnly?: boolean;
83
68
  onChange?: (value: string[] | number[]) => void;
84
69
  isDisabled?: () => boolean;
85
70
  }
86
- interface CreateImageArgs {
71
+ interface CreateImageArgs extends BaseElementArgs<"base"> {
87
72
  src: string;
88
- x: number;
89
- y: number;
90
73
  width: number;
91
- anchor?: Anchor;
92
- place?: boolean;
93
74
  }
94
- interface CreateBackNextButtonArgs {
95
- x: number;
96
- y: number;
75
+ interface CreateBackNextButtonArgs extends BaseElementArgs<"base" | "backButton" | "nextButton" | "text"> {
97
76
  width: number;
98
77
  height: number;
99
78
  items: [string, any?][];
100
79
  currentIndex: number;
101
80
  isBold?: boolean;
102
- anchor?: Anchor;
103
- place?: boolean;
104
81
  onChange?: (value: any) => void;
105
82
  isDisabled?: (value: any) => boolean;
106
83
  }
107
- interface CreateTabArgs {
108
- x: number;
109
- y: number;
84
+ interface CreateTabArgs extends BaseElementArgs<"base"> {
110
85
  width: number;
111
86
  tabs: {
112
87
  name: string;
@@ -116,9 +91,24 @@ interface CreateTabArgs {
116
91
  exit?: () => void;
117
92
  }[];
118
93
  currentTabName: string;
119
- anchor?: Anchor;
120
94
  }
121
- interface DrawPolylineArrowArgs {
95
+ interface CreateCardArgs extends BaseElementArgs<"base" | "name" | "value" | "icon"> {
96
+ name: string;
97
+ value: string | number;
98
+ icon?: SVGElement;
99
+ }
100
+ interface CreateSelectArgs extends BaseElementArgs<"base"> {
101
+ width: number;
102
+ options: {
103
+ name: any;
104
+ text: string;
105
+ icon?: SVGElement;
106
+ }[];
107
+ currentOption: string;
108
+ onChange?: (name: any) => void;
109
+ isDisabled?: () => boolean;
110
+ }
111
+ interface DrawPolylineArrowArgs extends Omit<BaseElementArgs<"base">, "x" | "y"> {
122
112
  points: {
123
113
  x: number;
124
114
  y: number;
@@ -145,6 +135,7 @@ export declare abstract class BaseSubscreen {
145
135
  private htmlElements;
146
136
  private resizeEventListeners;
147
137
  private tabHandlers;
138
+ private addElement;
148
139
  get currentSubscreen(): BaseSubscreen | null;
149
140
  get previousSubscreen(): BaseSubscreen | null;
150
141
  get name(): string;
@@ -156,16 +147,18 @@ export declare abstract class BaseSubscreen {
156
147
  update?(): void;
157
148
  setPreviousSubscreen(): void;
158
149
  setSubscreen(subscreen: BaseSubscreen | null): void;
159
- createButton({ text, x, y, width, height, fontSize, anchor, padding, style, place, icon, iconAbsolutePosition, iconWidth, tooltip, onClick, isDisabled }: CreateButtonArgs): HTMLButtonElement;
160
- createText({ text, color, x, y, width, height, withBackground, fontSize, anchor, padding, place }: CreateTextArgs): HTMLParagraphElement;
161
- createInput({ value, placeholder, x, y, width, height, textArea, fontSize, anchor, padding, place, onChange, onInput, isDisabled }: CreateInputArgs): HTMLInputElement | HTMLTextAreaElement;
162
- createCheckbox({ text, x, y, isChecked, width, anchor, place, isDisabled, onChange }: CreateCheckboxArgs): HTMLDivElement;
163
- createScrollView({ scroll, x, y, width, height, anchor }: CreateScrollViewArgs): HTMLDivElement;
164
- createInputList({ x, y, width, height, title, value, anchor, place, numbersOnly, isDisabled, onChange }: CreateInputListArgs): HTMLDivElement;
165
- createImage({ x, y, width, src, place, anchor }: CreateImageArgs): HTMLImageElement;
166
- createBackNextButton({ x, y, width, height, items, currentIndex, isBold, anchor, place, onChange, isDisabled }: CreateBackNextButtonArgs): HTMLDivElement;
167
- createTabs({ x, y, width, tabs, anchor, currentTabName }: CreateTabArgs): HTMLDivElement;
150
+ createButton({ text, x, y, width, height, fontSize, anchor, padding, style, place, icon, iconAbsolutePosition, iconWidth, tooltip, onClick, isDisabled, modules }: CreateButtonArgs): HTMLButtonElement;
151
+ createText({ text, color, x, y, width, height, withBackground, fontSize, anchor, padding, place, modules }: CreateTextArgs): HTMLParagraphElement;
152
+ createInput({ value, placeholder, x, y, width, height, textArea, fontSize, anchor, padding, place, onChange, onInput, isDisabled, modules }: CreateInputArgs): HTMLInputElement | HTMLTextAreaElement;
153
+ createCheckbox({ text, x, y, isChecked, width, modules, anchor, place, isDisabled, onChange }: CreateCheckboxArgs): HTMLDivElement;
154
+ createScrollView({ scroll, x, y, width, height, anchor, modules, place }: CreateScrollViewArgs): HTMLDivElement;
155
+ createInputList({ x, y, width, height, title, value, modules, anchor, place, numbersOnly, isDisabled, onChange }: CreateInputListArgs): HTMLDivElement;
156
+ createImage({ x, y, width, src, place, anchor, modules }: CreateImageArgs): HTMLImageElement;
157
+ createBackNextButton({ x, y, width, height, items, currentIndex, modules, isBold, anchor, place, onChange, isDisabled }: CreateBackNextButtonArgs): HTMLDivElement;
158
+ createTabs({ x, y, width, tabs, anchor, place, currentTabName, modules }: CreateTabArgs): HTMLDivElement;
168
159
  drawPolylineArrow({ points, strokeColor, lineWidth, circleRadius, circleColor }: DrawPolylineArrowArgs): void;
160
+ createCard({ x, y, name, value, icon, anchor, place, modules }: CreateCardArgs): HTMLDivElement;
161
+ createSelect({ x, y, width, options, currentOption, anchor, place, modules, onChange, isDisabled }: CreateSelectArgs): HTMLDivElement;
169
162
  }
170
163
  export declare function hookSubscreen(subscreenName: string, hook: (subscreen: BaseSubscreen) => void): void;
171
164
  export {};
@@ -0,0 +1,6 @@
1
+ export * from "class-validator";
2
+ export declare function validateData(data: any, dtoClass: any): Promise<{
3
+ isValid: boolean;
4
+ validatedData?: any;
5
+ errors?: string[];
6
+ }>;
@@ -0,0 +1 @@
1
+ import{BaseModule as r}from"../modules";class l extends r{overrideProperties(e){return e.element.style.cssText+="transform: translate(-50%, -50%);",e.x=1e3,e.y=500,e}}export{l as CenterModule};
@@ -0,0 +1 @@
1
+ import{BaseModule as d}from"../modules";function f(n,a,r,e){if(!n)throw new Error("Element not found");let s=0,o,t;const i=m=>{o||(o=m);const l=m-o;let u=Math.min(l/r,1);const c=u*(2-u),p=parseInt(s+(a-s)*c);n.textContent=typeof e=="function"?e(p):p.toString(),u<1&&(t=requestAnimationFrame(i))};t&&cancelAnimationFrame(t),t=requestAnimationFrame(i)}class x extends d{constructor(r){super();this.props=r}effect(r,e){f(e,this.props.endValue,this.props.duration,this.props.formattingFunction)}}export{x as CounterUpModule};
@@ -0,0 +1 @@
1
+ export*from"./centerModule";export*from"./counterUpModule";export*from"./typeModule";export*from"./styleModule";
@@ -0,0 +1 @@
1
+ import{BaseModule as r}from"@/modules";class n extends r{constructor(e){super();this.style=e}layoutEffect(e,o){for(const t of Object.keys(this.style))o.style.setProperty(t,this.style[t])}}export{n as StyleModule};
@@ -0,0 +1 @@
1
+ import{BaseModule as d}from"../modules";function l(e,o){if(!e)throw new Error("Element not found");const t=e.textContent;e.textContent="\xA0",e.classList.add("zcCursor");let r,n;const s=u=>{r||(r=u);const c=u-r;let a=Math.min(c/o,1);const i=t.slice(0,parseInt(t.length*a));i.trim()!==""&&(e.textContent=i),a<1?n=requestAnimationFrame(s):setTimeout(()=>e.classList.remove("zcCursor"),o/t.length)};n=requestAnimationFrame(s)}class x extends d{constructor(t){super();this.props=t}effect(t,r){l(r,this.props.duration)}}export{x as TypeModule};
package/dist/ui.js CHANGED
@@ -1,11 +1,11 @@
1
- import{getThemedColorsModule as N,MOD_DATA as w}from"./index";function D(b){return b*(MainCanvas.canvas.clientHeight/1e3)}function F(b){return b*(MainCanvas.canvas.clientWidth/2e3)}function j(b,e="top"){const o=MainCanvas.canvas.clientHeight/1e3;return e==="top"?MainCanvas.canvas.offsetTop+b*o:window.innerHeight-(MainCanvas.canvas.offsetTop+MainCanvas.canvas.clientHeight)+b*o}function R(b,e="left"){const o=MainCanvas.canvas.clientWidth/2e3;return e==="left"?MainCanvas.canvas.offsetLeft+b*o:window.innerWidth-(MainCanvas.canvas.offsetLeft+MainCanvas.canvas.clientWidth)+b*o}function E(b,e,o,u="top-left"){const m=u==="top-left"||u==="top-right"?"top":"bottom",a=u==="top-left"||u==="bottom-left"?"left":"right",n=j(o,m),r=R(e,a);Object.assign(b.style,{position:"fixed",[a]:r+"px",[m]:n+"px"})}function L(b,e,o){Object.assign(b.style,{width:F(e)+"px",height:D(o)+"px"})}function H(b,e){const o=MainCanvas.canvas.clientWidth,u=MainCanvas.canvas.clientHeight,m=Math.min(o,u)/100,a=e*m;Object.assign(b.style,{fontSize:a+"px"})}function z(b,e){b.style.fontFamily=e??"sans-serif"}function P(b,e){const o=MainCanvas.canvas.clientWidth,u=MainCanvas.canvas.clientHeight,m=Math.min(o,u)/100,a=e*m;Object.assign(b.style,{padding:a+"px"})}function A(b){const e=MainCanvas.canvas.clientWidth<=MainCanvas.canvas.clientHeight*2?MainCanvas.canvas.clientWidth/50:MainCanvas.canvas.clientHeight/25;Object.assign(b.style,{fontSize:e+"px"})}function O(){W(M)}function W(b){M=T,T=b,T&&T.load(),M&&M.unload()}function G(){return T}let T,M=null;class X{htmlElements=[];resizeEventListeners=[];tabHandlers={};get currentSubscreen(){return T}get previousSubscreen(){return M}get name(){return""}run(){this.tabHandlers.run?.()}load(){this.createButton({x:1815,y:75,width:90,height:90,icon:"Icons/Exit.png"}).addEventListener("click",()=>this.exit()),this.name&&(this.createText({text:this.name,x:100,y:60,fontSize:10}).style.cssText+="max-width: 85%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.1em;"),B[this.constructor.name]&&B[this.name].forEach(e=>e(this))}unload(){this.tabHandlers.unload?.(),this.htmlElements.forEach(e=>{e.remove()}),this.resizeEventListeners.forEach(e=>{removeEventListener("resize",e)})}click(){}exit(){this.tabHandlers.exit?.(),this.setSubscreen(this.previousSubscreen)}update(){}setPreviousSubscreen(){O()}setSubscreen(e){W(e)}createButton({text:e,x:o,y:u,width:m,height:a,fontSize:n="auto",anchor:r="top-left",padding:l,style:y="default",place:s=!0,icon:d,iconAbsolutePosition:t=!0,iconWidth:c,tooltip:f,onClick:p,isDisabled:h}){const i=document.createElement("button");if(i.classList.add("zcButton"),i.setAttribute("data-zc-style",y),i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.columnGap="1.25vw",z(i,w.fontFamily),d){const v=document.createElement("img");v.src=d,c?v.style.width=c:v.style.height="80%",e&&t&&(v.style.position="absolute",v.style.left="1vw"),e&&!t&&(i.style.justifyContent=""),i.append(v)}if(e){const v=document.createElement("span");v.textContent=e,d&&!t&&c&&(v.style.width="100%",v.style.marginRight=c),i.append(v)}if(f){const v=document.createElement("span");v.classList.add("tooltip"),v.setAttribute("position",f.position),v.textContent=f.text,i.append(v)}const C=()=>{typeof o=="number"&&typeof u=="number"&&E(i,o,u,r),L(i,m,a),l&&P(i,l),n==="auto"?A(i):H(i,n)};return C(),typeof h=="function"&&h()&&i.classList.add("zcDisabled"),i.addEventListener("click",()=>{if(typeof h=="function"&&h())return i.classList.add("zcDisabled");typeof p=="function"&&p()}),window.addEventListener("resize",C),s&&document.body.append(i),this.resizeEventListeners.push(C),this.htmlElements.push(i),i}createText({text:e,color:o,x:u,y:m,width:a,height:n,withBackground:r=!1,fontSize:l="auto",anchor:y="top-left",padding:s,place:d=!0}){const t=document.createElement("p");t.innerHTML=e,t.style.color=o??"var(--tmd-text, black)",r&&(t.style.background="var(--tmd-element,rgb(239, 239, 239))"),z(t,w.fontFamily);const c=()=>{typeof u=="number"&&typeof m=="number"&&E(t,u,m,y),L(t,a,n),s&&P(t,s),l==="auto"?A(t):H(t,l)};return c(),window.addEventListener("resize",c),d&&document.body.append(t),this.resizeEventListeners.push(c),this.htmlElements.push(t),t}createInput({value:e,placeholder:o,x:u,y:m,width:a,height:n,textArea:r=!1,fontSize:l="auto",anchor:y="top-left",padding:s,place:d=!0,onChange:t,onInput:c,isDisabled:f}){const p=document.createElement(r?"textarea":"input");p.classList.add("zcInput"),o&&(p.placeholder=o),e&&(p.value=e),z(p,w.fontFamily);const h=()=>{typeof u=="number"&&typeof m=="number"&&E(p,u,m,y),L(p,a,n),s&&P(p,s),l==="auto"?A(p):H(p,l)};return h(),typeof f=="function"&&f()&&p.classList.add("zcDisabled"),p.addEventListener("change",()=>{if(typeof f=="function"&&f())return p.classList.add("zcDisabled");typeof t=="function"&&t()}),p.addEventListener("input",()=>{if(typeof f=="function"&&f())return p.classList.add("zcDisabled");typeof c=="function"&&c()}),window.addEventListener("resize",h),d&&document.body.append(p),this.resizeEventListeners.push(h),this.htmlElements.push(p),p}createCheckbox({text:e,x:o,y:u,isChecked:m,width:a,anchor:n="top-left",place:r=!0,isDisabled:l,onChange:y}){const s=document.createElement("div");s.style.display="flex",s.style.alignItems="center",s.style.columnGap="1vw";const d=document.createElement("input");d.type="checkbox",d.checked=m,d.style.borderRadius="min(0.8dvh, 0.3dvw)",d.style.aspectRatio="1/1",d.classList.add("zcCheckbox","checkbox");const t=document.createElement("p");t.textContent=e,t.style.color="var(--tmd-text, black)",z(t,w.fontFamily);const c=()=>{typeof o=="number"&&typeof u=="number"&&E(s,o,u,n),a&&(s.style.width=F(a)+"px"),H(t,5)};return c(),typeof l=="function"&&l()&&s.classList.add("zcDisabled"),s.addEventListener("change",()=>{if(typeof l=="function"&&l())return s.classList.add("zcDisabled");typeof y=="function"&&y()}),window.addEventListener("resize",c),s.append(d,t),r&&document.body.append(s),this.resizeEventListeners.push(c),this.htmlElements.push(s,t),s}createScrollView({scroll:e,x:o,y:u,width:m,height:a,anchor:n="top-left"}){const r=document.createElement("div");e==="all"&&(r.style.overflow="scroll"),e==="x"&&(r.style.overflowX="scroll"),e==="y"&&(r.style.overflowY="scroll");const l=()=>{typeof o=="number"&&typeof u=="number"&&E(r,o,u,n),L(r,m,a)};return l(),window.addEventListener("resize",l),document.body.append(r),this.resizeEventListeners.push(l),this.htmlElements.push(r),r}createInputList({x:e,y:o,width:u,height:m,title:a,value:n,anchor:r="top-left",place:l=!0,numbersOnly:y=!1,isDisabled:s,onChange:d}){const t=[],c=document.createElement("div");c.style.cssText=`
1
+ import{Check as N,ChevronDown as I,CircleX as P,createElement as T,Trash2 as D}from"lucide";import{getThemedColorsModule as z,MOD_DATA as L}from"./index";import{StyleModule as R}from"./ui-modules";function S(h){return h*(MainCanvas.canvas.clientHeight/1e3)}function H(h){return h*(MainCanvas.canvas.clientWidth/2e3)}function V(h,e="top"){const r=MainCanvas.canvas.clientHeight/1e3;return e==="top"?MainCanvas.canvas.offsetTop+h*r:window.innerHeight-(MainCanvas.canvas.offsetTop+MainCanvas.canvas.clientHeight)+h*r}function W(h,e="left"){const r=MainCanvas.canvas.clientWidth/2e3;return e==="left"?MainCanvas.canvas.offsetLeft+h*r:window.innerWidth-(MainCanvas.canvas.offsetLeft+MainCanvas.canvas.clientWidth)+h*r}function j(h,e,r,u="top-left"){const m=u==="top-left"||u==="top-right"?"top":"bottom",s=u==="top-left"||u==="bottom-left"?"left":"right",n=V(r,m),p=W(e,s);Object.assign(h.style,{position:"fixed",[s]:p+"px",[m]:n+"px"})}function J(h,e,r){Object.assign(h.style,{width:H(e)+"px",height:S(r)+"px"})}function O(h,e){const r=MainCanvas.canvas.clientWidth,u=MainCanvas.canvas.clientHeight,m=Math.min(r,u)/100,s=e*m;Object.assign(h.style,{fontSize:s+"px"})}function w(h,e){h.style.fontFamily=e??"sans-serif"}function G(h,e){const r=MainCanvas.canvas.clientWidth,u=MainCanvas.canvas.clientHeight,m=Math.min(r,u)/100,s=e*m;Object.assign(h.style,{padding:s+"px"})}function X(h){const e=MainCanvas.canvas.clientWidth<=MainCanvas.canvas.clientHeight*2?MainCanvas.canvas.clientWidth/50:MainCanvas.canvas.clientHeight/25;Object.assign(h.style,{fontSize:e+"px"})}function Y(){F(M)}function F(h){M=k,k=h,k&&k.load(),M&&M.unload()}function K(){return k}let k,M=null;class Q{htmlElements=[];resizeEventListeners=[];tabHandlers={};addElement(e,{x:r,y:u,width:m,height:s,padding:n,fontSize:p="auto",anchor:b,place:d,modules:l={},modulesMap:a}){w(e,L.fontFamily);const o={anchor:b,x:r,y:u,width:m,height:s,padding:n,fontSize:p,place:d,element:e};Object.keys(l)?.forEach(c=>{l[c].forEach(f=>{const i=f.overrideProperties(o,a[c]);b=i.anchor,r=i.x,u=i.y,m=i.width,s=i.height,n=i.padding,p=i.fontSize,d=i.place,e=i.element})});const t=()=>{typeof r=="number"&&typeof u=="number"&&j(e,r,u,b),p==="auto"?X(e):O(e,p),n&&G(e,n),m&&(e.style.width=H(m)+"px"),s&&(e.style.height=S(s)+"px")};t(),window.addEventListener("resize",t),Object.keys(l)?.forEach(c=>{l[c].forEach(f=>{f.layoutEffect(o,a[c])})}),d&&document.body.append(e),this.resizeEventListeners.push(t),this.htmlElements.push(e),Object.keys(l)?.forEach(c=>{l[c].forEach(f=>{f.effect(o,a[c])})})}get currentSubscreen(){return k}get previousSubscreen(){return M}get name(){return""}run(){this.tabHandlers.run?.()}load(){this.createButton({x:1815,y:75,width:90,height:90,icon:"Icons/Exit.png"}).addEventListener("click",()=>this.exit()),this.name&&(this.createText({text:this.name,x:100,y:60,fontSize:10}).style.cssText+="max-width: 85%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.1em;"),B[this.constructor.name]&&B[this.name].forEach(e=>e(this))}unload(){this.tabHandlers.unload?.(),this.htmlElements.forEach(e=>{e.remove()}),this.resizeEventListeners.forEach(e=>{removeEventListener("resize",e)})}click(){}exit(){this.tabHandlers.exit?.(),this.setSubscreen(this.previousSubscreen)}update(){}setPreviousSubscreen(){Y()}setSubscreen(e){F(e)}createButton({text:e,x:r,y:u,width:m,height:s,fontSize:n="auto",anchor:p="top-left",padding:b,style:d="default",place:l=!0,icon:a,iconAbsolutePosition:o=!0,iconWidth:t,tooltip:c,onClick:f,isDisabled:i,modules:v}){let g,C;const y=document.createElement("button");if(y.classList.add("zcButton"),y.setAttribute("data-zc-style",d),y.style.display="flex",y.style.alignItems="center",y.style.justifyContent="center",y.style.columnGap="1.25vw",w(y,L.fontFamily),a&&(typeof a=="string"?(g=document.createElement("img"),g.src=a):g=a,t?g.style.width=t:g.style.height="80%",e&&o&&(g.style.position="absolute",g.style.left="1vw"),e&&!o&&(y.style.justifyContent=""),y.append(g)),e&&(C=document.createElement("span"),C.textContent=e,a&&!o&&t&&(C.style.width="100%",C.style.marginRight=t),y.append(C)),c){const x=document.createElement("span");x.classList.add("tooltip"),x.setAttribute("position",c.position),x.textContent=c.text,y.append(x)}return typeof i=="function"&&i()&&y.classList.add("zcDisabled"),y.addEventListener("click",()=>{if(typeof i=="function"&&i())return y.classList.add("zcDisabled");typeof f=="function"&&f()}),this.addElement(y,{x:r,y:u,width:m,height:s,anchor:p,place:l,fontSize:n,padding:b,modules:v,modulesMap:{base:y,text:C,icon:g}}),y}createText({text:e,color:r,x:u,y:m,width:s,height:n,withBackground:p=!1,fontSize:b="auto",anchor:d="top-left",padding:l,place:a=!0,modules:o}){const t=document.createElement("p");return t.innerHTML=e,t.style.color=r??"var(--tmd-text, black)",p&&(t.style.background="var(--tmd-element,rgb(239, 239, 239))"),w(t,L.fontFamily),this.addElement(t,{x:u,y:m,width:s,height:n,anchor:d,place:a,fontSize:b,padding:l,modules:o,modulesMap:{base:t}}),t}createInput({value:e,placeholder:r,x:u,y:m,width:s,height:n,textArea:p=!1,fontSize:b="auto",anchor:d="top-left",padding:l,place:a=!0,onChange:o,onInput:t,isDisabled:c,modules:f}){const i=document.createElement(p?"textarea":"input");return i.classList.add("zcInput"),r&&(i.placeholder=r),e&&(i.value=e),w(i,L.fontFamily),typeof c=="function"&&c()&&i.classList.add("zcDisabled"),i.addEventListener("change",()=>{if(typeof c=="function"&&c())return i.classList.add("zcDisabled");typeof o=="function"&&o()}),i.addEventListener("input",()=>{if(typeof c=="function"&&c())return i.classList.add("zcDisabled");typeof t=="function"&&t()}),this.addElement(i,{x:u,y:m,width:s,height:n,anchor:d,place:a,fontSize:b,padding:l,modules:f,modulesMap:{base:i}}),i}createCheckbox({text:e,x:r,y:u,isChecked:m,width:s,modules:n,anchor:p="top-left",place:b=!0,isDisabled:d,onChange:l}){const a=document.createElement("div");a.style.display="flex",a.style.alignItems="center",a.style.columnGap="1vw";const o=document.createElement("input");o.type="checkbox",o.checked=m,o.style.borderRadius="min(0.8dvh, 0.3dvw)",o.style.aspectRatio="1/1",o.classList.add("zcCheckbox","checkbox");const t=document.createElement("p");return t.textContent=e,t.style.color="var(--tmd-text, black)",w(t,L.fontFamily),typeof d=="function"&&d()&&a.classList.add("zcDisabled"),a.addEventListener("change",()=>{if(typeof d=="function"&&d())return a.classList.add("zcDisabled");typeof l=="function"&&l()}),a.append(o,t),this.addElement(a,{x:r,y:u,width:s,anchor:p,place:b,modules:n,modulesMap:{base:a,checkbox:o,label:t}}),a}createScrollView({scroll:e,x:r,y:u,width:m,height:s,anchor:n="top-left",modules:p,place:b=!0}){const d=document.createElement("div");return e==="all"&&(d.style.overflow="scroll"),e==="x"&&(d.style.overflowX="scroll"),e==="y"&&(d.style.overflowY="scroll"),this.addElement(d,{x:r,y:u,width:m,height:s,anchor:n,place:b,modules:p,modulesMap:{base:d}}),d}createInputList({x:e,y:r,width:u,height:m,title:s,value:n,modules:p,anchor:b="top-left",place:d=!0,numbersOnly:l=!1,isDisabled:a,onChange:o}){const t=[],c=document.createElement("div");c.style.cssText=`
2
2
  display: flex; flex-direction: column; gap: 1vw; border: 2px solid var(--tmd-accent, black);
3
3
  border-radius: 4px; padding: 0.75vw; background: var(--tmd-element, none);
4
- `,z(c,w.fontFamily);const f=document.createElement("div");f.style.cssText="display: flex; justify-content: center; column-gap: 1vw; width: 100%;";const p=document.createElement("b");p.textContent=a+":",p.style.cssText="width: 100%; font-size: clamp(10px, 2.4vw, 24px); color: var(--tmd-text, black);";const h=document.createElement("div");h.style.cssText=`display: flex; gap: 1vw; flex-wrap: wrap; align-content: flex-start;
5
- overflow-y: scroll;`;const i=document.createElement("input");i.style.cssText="border: none; outline: none; background: none; height: fit-content; flex-grow: 1; padding: 0.8vw; width: 6vw; font-size: clamp(8px, 2vw, 20px);";const C=(g,x)=>{const k=document.createElement("button");k.style.cssText="cursor: pointer; display: grid; place-items: center; background: var(--tmd-element-hover, #e0e0e0); width: 10%; max-width: 40px; aspect-ratio: 1/1; border-radius: 8px; border: none;";const I=DrawGetImage(g);I.style.cssText="width: 90%;",k.append(I),f.append(k),k.addEventListener("click",x)},v=g=>{const x=document.createElement("div");x.style.cssText="cursor: pointer; background: var(--tmd-element-hover, rgb(206, 206, 206)); color: var(--tmd-text, black); height: fit-content; padding: 0.8vw; border-radius: 0.8vw; font-size: clamp(8px, 2vw, 20px);",x.textContent=g,h.insertBefore(x,i),x.addEventListener("click",k=>{x.style.border===""?x.style.border="2px solid red":x.style.border="",k.stopPropagation()}),t.push(g)},S=()=>{typeof e=="number"&&typeof o=="number"&&E(c,e,o,r),L(c,u,m)};return C("Icons/Cancel.png",()=>{if(typeof s=="function"&&s())return c.classList.add("zcDisabled");h.innerHTML="",t.splice(0,t.length),h.append(i),n.forEach(g=>v(String(g))),typeof d=="function"&&d(y?t.map(g=>parseInt(g)):t)}),C("Icons/Trash.png",()=>{if(typeof s=="function"&&s())return c.classList.add("zcDisabled");for(const g of[...h.children])g.getAttribute("style").includes("border: 2px solid red;")&&(t.splice(t.indexOf(g.textContent),1),g.remove());typeof d=="function"&&d(y?t.map(g=>parseInt(g)):t)}),S(),typeof s=="function"&&s()&&c.classList.add("zcDisabled"),window.addEventListener("resize",S),i.addEventListener("keypress",g=>{if(document.activeElement===i)switch(g.key){case"Enter":if(y&&Number.isNaN(parseInt(i.value))||i.value.trim()==="")return;if(typeof s=="function"&&s())return c.classList.add("zcDisabled");v(i.value),i.value="",typeof d=="function"&&d(y?t.map(x=>parseInt(x)):t);break}}),c.addEventListener("click",g=>{g.currentTarget==c&&i.focus()}),h.append(i),c.append(f,p,h),l&&document.body.append(c),this.resizeEventListeners.push(S),this.htmlElements.push(c),n.forEach(g=>v(String(g))),c}createImage({x:e,y:o,width:u,src:m,place:a=!0,anchor:n="top-left"}){const r=document.createElement("img");r.src=m;const l=()=>{typeof e=="number"&&typeof o=="number"&&E(r,e,o,n),L(r,u,0),r.style.height="auto"};return l(),window.addEventListener("resize",l),a&&document.body.append(r),this.resizeEventListeners.push(l),this.htmlElements.push(r),r}createBackNextButton({x:e,y:o,width:u,height:m,items:a,currentIndex:n,isBold:r=!1,anchor:l="top-left",place:y=!0,onChange:s,isDisabled:d}){const t=document.createElement("div");t.classList.add("zcBackNextButton"),z(t,w.fontFamily);const c=()=>{n===0||typeof d=="function"&&d(a[n-1][1])?f.classList.add("zcBackNextButton-btnDisabled"):f.classList.remove("zcBackNextButton-btnDisabled"),n===a.length-1||typeof d=="function"&&d(a[n+1][1])?p.classList.add("zcBackNextButton-btnDisabled"):p.classList.remove("zcBackNextButton-btnDisabled")},f=document.createElement("button");f.style.cssText=`
4
+ `,w(c,L.fontFamily);const f=document.createElement("div");f.style.cssText="display: flex; justify-content: center; column-gap: 1vw; width: 100%;";const i=document.createElement("b");i.textContent=s+":",i.style.cssText="width: 100%; font-size: clamp(10px, 2.4vw, 24px); color: var(--tmd-text, black);";const v=document.createElement("div");v.style.cssText=`display: flex; gap: 1vw; flex-wrap: wrap; align-content: flex-start;
5
+ overflow-y: scroll;`;const g=document.createElement("input");g.style.cssText="border: none; outline: none; background: none; height: fit-content; flex-grow: 1; padding: 0.8vw; width: 6vw; font-size: clamp(8px, 2vw, 20px);";const C=(x,E)=>{const A=this.createButton({icon:x,place:!1,onClick:E,style:"default",modules:{icon:[new R({width:"70%",height:"70%"})]}});A.style.width="2em",A.style.aspectRatio="1/1",f.append(A)},y=x=>{const E=document.createElement("div");E.style.cssText="cursor: pointer; background: var(--tmd-element-hover, rgb(206, 206, 206)); color: var(--tmd-text, black); height: fit-content; padding: 0.8vw; border-radius: 0.8vw; font-size: clamp(8px, 2vw, 20px);",E.textContent=x,v.insertBefore(E,g),E.addEventListener("click",A=>{E.style.border===""?E.style.border="2px solid red":E.style.border="",A.stopPropagation()}),t.push(x)};return C(T(P),()=>{if(typeof a=="function"&&a())return c.classList.add("zcDisabled");v.innerHTML="",t.splice(0,t.length),v.append(g),n.forEach(x=>y(String(x))),typeof o=="function"&&o(l?t.map(x=>parseInt(x)):t)}),C(T(D),()=>{if(typeof a=="function"&&a())return c.classList.add("zcDisabled");for(const x of[...v.children])x.getAttribute("style").includes("border: 2px solid red;")&&(t.splice(t.indexOf(x.textContent),1),x.remove());typeof o=="function"&&o(l?t.map(x=>parseInt(x)):t)}),typeof a=="function"&&a()&&c.classList.add("zcDisabled"),g.addEventListener("keypress",x=>{if(document.activeElement===g)switch(x.key){case"Enter":if(l&&Number.isNaN(parseInt(g.value))||g.value.trim()==="")return;if(typeof a=="function"&&a())return c.classList.add("zcDisabled");y(g.value),g.value="",typeof o=="function"&&o(l?t.map(E=>parseInt(E)):t);break}}),c.addEventListener("click",x=>{x.currentTarget==c&&g.focus()}),v.append(g),c.append(f,i,v),this.addElement(c,{x:e,y:r,width:u,height:m,anchor:b,place:d,modules:p,modulesMap:{base:c,input:g}}),n.forEach(x=>y(String(x))),c}createImage({x:e,y:r,width:u,src:m,place:s=!0,anchor:n="top-left",modules:p}){const b=document.createElement("img");return b.style.height="auto",b.src=m,this.addElement(b,{x:e,y:r,width:u,height:0,anchor:n,place:s,modules:p,modulesMap:{base:b}}),b}createBackNextButton({x:e,y:r,width:u,height:m,items:s,currentIndex:n,modules:p,isBold:b=!1,anchor:d="top-left",place:l=!0,onChange:a,isDisabled:o}){const t=document.createElement("div");t.classList.add("zcBackNextButton"),w(t,L.fontFamily);const c=()=>{n===0||typeof o=="function"&&o(s[n-1][1])?f.classList.add("zcBackNextButton-btnDisabled"):f.classList.remove("zcBackNextButton-btnDisabled"),n===s.length-1||typeof o=="function"&&o(s[n+1][1])?i.classList.add("zcBackNextButton-btnDisabled"):i.classList.remove("zcBackNextButton-btnDisabled")},f=document.createElement("button");f.style.cssText=`
6
6
  position: absolute; left: 1vw; font-size: 3.5vw; aspect-ratio: 1/1;
7
7
  height: 140%; background-image: url("Icons/Prev.png"); background-size: 100%;
8
- `,f.classList.add("zcButton"),f.addEventListener("click",()=>{if(n===0||typeof d=="function"&&d(a[n-1][1]))return f.classList.add("zcDisabled");n--,h.textContent=a[n][0],typeof s=="function"&&s(a[n][1]),c()});const p=document.createElement("button");p.style.cssText=`
8
+ `,f.classList.add("zcButton"),f.addEventListener("click",()=>{if(n===0||typeof o=="function"&&o(s[n-1][1]))return f.classList.add("zcDisabled");n--,v.textContent=s[n][0],typeof a=="function"&&a(s[n][1]),c()});const i=document.createElement("button");i.style.cssText=`
9
9
  position: absolute; right: 1vw; font-size: 3.5vw; aspect-ratio: 1/1;
10
10
  height: 140%; background-image: url("Icons/Next.png"); background-size: 100%;
11
- `,p.classList.add("zcButton"),p.addEventListener("click",()=>{if(n===a.length-1||typeof d=="function"&&d(a[n+1][1]))return p.classList.add("zcDisabled");n++,h.textContent=a[n][0],typeof s=="function"&&s(a[n][1]),c()}),c();const h=document.createElement("p");r&&(h.style.fontWeight="bold"),h.textContent=a[n][0],t.append(f,h,p);const i=()=>{typeof e=="number"&&typeof o=="number"&&E(t,e,o,l),L(t,u,m),A(h)};return i(),window.addEventListener("resize",i),y&&document.body.append(t),this.resizeEventListeners.push(i),this.htmlElements.push(t),t}createTabs({x:e,y:o,width:u,tabs:m,anchor:a="top-left",currentTabName:n}){let r=[];const l=document.createElement("div");l.classList.add("zcTabs"),z(l,w.fontFamily),m.forEach(s=>{const d=()=>{for(const f of l.children)f.removeAttribute("data-opened");for(const f of r)f instanceof Node&&document.body.removeChild(f);r=[],t.setAttribute("data-opened","true");const c=document.body.append.bind(document.body);document.body.append=(...f)=>{r.push(...f),c(...f)},this.tabHandlers.unload?.(),this.tabHandlers.exit?.(),s.load(),this.tabHandlers={run:s.run,load:s.load,unload:s.unload,exit:s.exit},document.body.append=c},t=document.createElement("button");t.textContent=s.name,s.name===n&&d(),t.addEventListener("click",d),l.append(t)});const y=()=>{typeof e=="number"&&typeof o=="number"&&E(l,e,o,a),u&&(l.style.width=F(u)+"px"),A(l)};return y(),window.addEventListener("resize",y),document.body.append(l),this.resizeEventListeners.push(y),this.htmlElements.push(l),l}drawPolylineArrow({points:e,strokeColor:o=N()?.base?.text??"black",lineWidth:u=2,circleRadius:m=5,circleColor:a=N()?.base?.text??"black"}){if(e.length<2)return;const n=MainCanvas.canvas.getContext("2d");n.save(),n.strokeStyle=o,n.lineWidth=u,n.fillStyle=a,n.beginPath(),n.moveTo(e[0].x,e[0].y);for(let r=1;r<e.length;r++)n.lineTo(e[r].x,e[r].y);n.stroke(),n.beginPath(),n.arc(e[0].x,e[0].y,m,0,Math.PI*2),n.fill(),n.beginPath(),n.arc(e[e.length-1].x,e[e.length-1].y,m,0,Math.PI*2),n.fill(),n.restore()}}const B={};function Y(b,e){B[b]||(B[b]=[]),B[b].push(e)}export{X as BaseSubscreen,A as autosetFontSize,G as getCurrentSubscreen,D as getRelativeHeight,F as getRelativeWidth,R as getRelativeX,j as getRelativeY,Y as hookSubscreen,z as setFontFamily,H as setFontSize,P as setPadding,E as setPosition,O as setPreviousSubscreen,L as setSize,W as setSubscreen};
11
+ `,i.classList.add("zcButton"),i.addEventListener("click",()=>{if(n===s.length-1||typeof o=="function"&&o(s[n+1][1]))return i.classList.add("zcDisabled");n++,v.textContent=s[n][0],typeof a=="function"&&a(s[n][1]),c()}),c();const v=document.createElement("p");return b&&(v.style.fontWeight="bold"),v.textContent=s[n][0],t.append(f,v,i),this.addElement(t,{x:e,y:r,width:u,height:m,anchor:d,place:l,modules:p,modulesMap:{base:t,backButton:f,nextButton:i,text:v}}),t}createTabs({x:e,y:r,width:u,tabs:m,anchor:s="top-left",place:n=!0,currentTabName:p,modules:b}){let d=[];const l=document.createElement("div");return l.classList.add("zcTabs"),w(l,L.fontFamily),m.forEach(a=>{const o=()=>{for(const f of l.children)f.removeAttribute("data-opened");for(const f of d)f instanceof Node&&document.body.removeChild(f);d=[],t.setAttribute("data-opened","true");const c=document.body.append.bind(document.body);document.body.append=(...f)=>{d.push(...f),c(...f)},this.tabHandlers.unload?.(),this.tabHandlers.exit?.(),a.load(),this.tabHandlers={run:a.run,load:a.load,unload:a.unload,exit:a.exit},document.body.append=c},t=document.createElement("button");t.textContent=a.name,a.name===p&&o(),t.addEventListener("click",o),l.append(t)}),this.addElement(l,{x:e,y:r,width:u,anchor:s,place:n,modules:b,modulesMap:{base:l}}),l}drawPolylineArrow({points:e,strokeColor:r=z()?.base?.text??"black",lineWidth:u=2,circleRadius:m=5,circleColor:s=z()?.base?.text??"black"}){if(e.length<2)return;const n=MainCanvas.canvas.getContext("2d");n.save(),n.strokeStyle=r,n.lineWidth=u,n.fillStyle=s,n.beginPath(),n.moveTo(e[0].x,e[0].y);for(let p=1;p<e.length;p++)n.lineTo(e[p].x,e[p].y);n.stroke(),n.beginPath(),n.arc(e[0].x,e[0].y,m,0,Math.PI*2),n.fill(),n.beginPath(),n.arc(e[e.length-1].x,e[e.length-1].y,m,0,Math.PI*2),n.fill(),n.restore()}createCard({x:e,y:r,name:u,value:m,icon:s,anchor:n="top-left",place:p=!0,modules:b}){const d=document.createElement("div");d.classList.add("zcCard");const l=document.createElement("p");l.classList.add("zcCard_name"),l.textContent=u;const a=document.createElement("p");return a.classList.add("zcCard_value"),a.textContent=`${m}`,s&&(s.style.cssText+="position: absolute; top: 0.4em; right: 0.4em; width: 1.2em; height: 1.2em;",d.append(s)),d.append(l,a),this.addElement(d,{x:e,y:r,anchor:n,place:p,modules:b,modulesMap:{name:l,value:a,base:d,icon:null}}),d}createSelect({x:e,y:r,width:u,options:m,currentOption:s,anchor:n="top-left",place:p=!0,modules:b,onChange:d,isDisabled:l}){let a=!1,o;const t=document.createElement("div");t.classList.add("zcSelect"),t.setAttribute("opened",!1),t.addEventListener("click",()=>{if(l&&l())return t.classList.add("zcDisabled");a?(a=!1,o.remove()):(a=!0,o=document.createElement("div"),o.setAttribute("data-zc-position",typeof r=="number"&&r>500-t.offsetHeight/2?"top":"bottom"),m.forEach(v=>{const g=document.createElement("div");g.style.cssText="display: flex; align-items: center; column-gap: 0.5em;",v.icon&&(v.icon.style.cssText="color: #bcbcbc;",g.append(v.icon)),g.append(v.text),v.name===s&&g.append(i),g.addEventListener("click",()=>{s=v.name,c.textContent=v.text,o.remove(),d&&d(v.name)}),o.append(g)}),t.append(o))});const c=document.createElement("p");c.textContent=m.find(v=>v.name===s).name;const f=T(I),i=T(N);return i.style.cssText="position: absolute; right: 0.25em;",t.append(c,f),l&&l()&&t.classList.add("zcDisabled"),this.addElement(t,{x:e,y:r,width:u,anchor:n,place:p,modules:b,modulesMap:{base:t}}),t}}const B={};function U(h,e){B[h]||(B[h]=[]),B[h].push(e)}export{Q as BaseSubscreen,X as autosetFontSize,K as getCurrentSubscreen,S as getRelativeHeight,H as getRelativeWidth,W as getRelativeX,V as getRelativeY,U as hookSubscreen,w as setFontFamily,O as setFontSize,G as setPadding,j as setPosition,Y as setPreviousSubscreen,J as setSize,F as setSubscreen};
@@ -0,0 +1 @@
1
+ import{plainToInstance as o}from"class-transformer";import{validate as i}from"class-validator";export*from"class-validator";async function c(e,t){try{const r=o(t,e),a=await i(r);return a.length>0?{isValid:!1,errors:a.flatMap(s=>Object.values(s.constraints||{}))}:{isValid:!0,validatedData:r}}catch(r){return{isValid:!1,errors:["Validation error: "+r.message]}}}export{c as validateData};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zois-core",
3
- "version": "1.0.14",
3
+ "version": "1.1.0",
4
4
  "description": "The core for the my mods, which contains a shared code reused in all my mods",
5
5
  "author": "Zoi",
6
6
  "license": "MIT",
@@ -24,6 +24,14 @@
24
24
  "import": "./dist/ui.js",
25
25
  "types": "./dist/types/ui.d.ts"
26
26
  },
27
+ "./ui-modules": {
28
+ "import": "./dist/ui-modules/index.js",
29
+ "types": "./dist/types/ui-modules/index.d.ts"
30
+ },
31
+ "./modules": {
32
+ "import": "./dist/modules.js",
33
+ "types": "./dist/types/modules.d.ts"
34
+ },
27
35
  "./wardrobe": {
28
36
  "import": "./dist/wardrobe.js",
29
37
  "types": "./dist/types/wardrobe.d.ts"
@@ -31,12 +39,22 @@
31
39
  "./popups": {
32
40
  "import": "./dist/popups.js",
33
41
  "types": "./dist/types/popups.d.ts"
42
+ },
43
+ "./validation": {
44
+ "import": "./dist/validation.js",
45
+ "types": "./dist/types/validation.d.ts"
34
46
  }
35
47
  },
36
48
  "dependencies": {
37
49
  "bondage-club-mod-sdk": "^1.2.0",
50
+ "class-transformer": "^0.5.1",
51
+ "class-validator": "^0.14.2",
52
+ "lucide": "^0.541.0",
53
+ "lucide-react": "^0.542.0",
38
54
  "react": "^19.1.0",
39
55
  "react-dom": "^19.1.0",
56
+ "reflect-metadata": "^0.2.2",
57
+ "zois-core": "link:C:/Users/VolkPC/AppData/Local/pnpm/global/5/node_modules/zois-core",
40
58
  "zustand": "^5.0.5"
41
59
  },
42
60
  "devDependencies": {
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"></path></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM11 11V17H13V11H11ZM11 7V9H13V7H11Z"></path></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM17.4571 9.45711L11 15.9142L6.79289 11.7071L8.20711 10.2929L11 13.0858L16.0429 8.04289L17.4571 9.45711Z"></path></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM11 15V17H13V15H11ZM11 7V13H13V7H11Z"></path></svg>