zois-core 1.0.7 → 1.0.8
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/modsApi.js +1 -1
- package/dist/popups.js +1 -1
- package/dist/ui.js +3 -3
- package/package.json +1 -1
package/dist/modsApi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import a from"bondage-club-mod-sdk";import{getPlayer as f,MOD_DATA as s}from"./index";import{getCurrentSubscreen as u}from"./ui";import{handleRequest as m,handleRequestResponse as p}from"./messaging";var g=(e=>(e[e.OBSERVE=0]="OBSERVE",e[e.ADD_BEHAVIOR=1]="ADD_BEHAVIOR",e[e.MODIFY_BEHAVIOR=5]="MODIFY_BEHAVIOR",e[e.OVERRIDE_BEHAVIOR=10]="OVERRIDE_BEHAVIOR",e[e.TOP=100]="TOP",e))(g||{});let r;function A(){r=a.registerMod({name:s.name,fullName:s.fullName,version:s.version,repository:s.repository}),c("GameKeyDown",1,(t,n)=>(CommonKey.IsPressed(t[0],"Escape")&&u()&&u().exit(),n(t))),c("ChatRoomMessage",1,(t,n)=>{const o=t[0],i=f(o.Sender);if(!i)return n(t);if(o.Content===s.key&&!i.IsPlayer()){const d=o.Dictionary.msg,e=o.Dictionary.data;if(d==="request"){if(typeof e.requestId!="number"||typeof e.message!="string")return;m(e.requestId,e.message,e.data,i)}if(d==="requestResponse"){if(typeof e.requestId!="number")return;p(e.requestId,e.data)}}})}function c(t,n,o){if(!r)throw new Error("zois-core is not registered");return r.hookFunction(t,n,o)}function O(t,n){if(!r)throw new Error("zois-core is not registered");r.patchFunction(t,n)}function T(t,n,o){if(!r)throw new Error("zois-core is not registered");return r.callOriginal(t,n)}function x(){return a.getModsInfo()}function F(t){return!!a.getModsInfo().find(n=>n.name===t)}export{g as HookPriority,T as callOriginal,F as findModByName,x as getLoadedMods,c as hookFunction,O as patchFunction,A as registerMod};
|
|
1
|
+
import a from"bondage-club-mod-sdk";import{getPlayer as f,MOD_DATA as s}from"./index";import{getCurrentSubscreen as u}from"./ui";import{handleRequest as m,handleRequestResponse as p}from"./messaging";var g=(e=>(e[e.OBSERVE=0]="OBSERVE",e[e.ADD_BEHAVIOR=1]="ADD_BEHAVIOR",e[e.MODIFY_BEHAVIOR=5]="MODIFY_BEHAVIOR",e[e.OVERRIDE_BEHAVIOR=10]="OVERRIDE_BEHAVIOR",e[e.TOP=100]="TOP",e))(g||{});let r;function A(){r=a.registerMod({name:s.name,fullName:s.fullName,version:s.version,repository:s.repository}),c("GameKeyDown",1,(t,n)=>(CommonKey.IsPressed(t[0],"Escape")&&u()&&u().exit(),n(t))),c("ChatRoomMessage",1,(t,n)=>{const o=t[0],i=f(o.Sender);if(!i)return n(t);if(o.Content===s.key&&!i.IsPlayer()){const d=o.Dictionary.msg,e=o.Dictionary.data;if(d==="request"){if(typeof e.requestId!="number"||typeof e.message!="string")return;m(e.requestId,e.message,e.data,i)}if(d==="requestResponse"){if(typeof e.requestId!="number")return;p(e.requestId,e.data)}}return n(t)})}function c(t,n,o){if(!r)throw new Error("zois-core is not registered");return r.hookFunction(t,n,o)}function O(t,n){if(!r)throw new Error("zois-core is not registered");r.patchFunction(t,n)}function T(t,n,o){if(!r)throw new Error("zois-core is not registered");return r.callOriginal(t,n)}function x(){return a.getModsInfo()}function F(t){return!!a.getModsInfo().find(n=>n.name===t)}export{g as HookPriority,T as callOriginal,F as findModByName,x as getLoadedMods,c as hookFunction,O as patchFunction,A as registerMod};
|
package/dist/popups.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getRelativeWidth as D,getRelativeX as x,getRelativeY as z}from"./ui";import{MOD_DATA as T}from"./index";import{useState as m,useEffect as g}from"react";import P from"react-dom/client";import{create as y}from"zustand";import C from"./assets/errorWarningIcon.svg";import E from"
|
|
1
|
+
import{getRelativeWidth as D,getRelativeX as x,getRelativeY as z}from"./ui";import{MOD_DATA as T}from"./index";import{useState as m,useEffect as g}from"react";import P from"react-dom/client";import{create as y}from"zustand";import C from"./assets/errorWarningIcon.svg";import E from"./assets/infoIcon.svg";import M from"./assets/successIcon.svg";import{Fragment as h,jsx as n,jsxs as d}from"react/jsx-runtime";const u=y(t=>({toasts:[],addToast:e=>t(o=>({toasts:[...o.toasts,e]})),removeToast:e=>t(o=>({toasts:o.toasts.filter(i=>i.id!==e)})),clearToasts:()=>t({toasts:[]})})),v=y(t=>({dialog:null,setDialog:e=>t({dialog:e}),clearDialog:()=>t({dialog:null})}));function k({children:t}){const[e,o]=m({}),i=u(s=>s.clearToasts);return g(()=>{const s=()=>{o({fontFamily:T.fontFamily??"sans-serif",top:z(5)+"px",left:x(5)+"px"})};return window.addEventListener("resize",s),s(),()=>{window.removeEventListener("resize",s)}},[]),n("div",{className:"zcToastsContainer",style:e,onClick:()=>{document.querySelectorAll(".zcToast").forEach(s=>{s.classList.add("exiting")}),setTimeout(i,300)},children:t})}function I({title:t,message:e,type:o,duration:i,id:s}){const[c,a]=m({}),[r,l]=m(!1);return g(()=>{const p=()=>{const S=MainCanvas.canvas.clientWidth,b=MainCanvas.canvas.clientHeight,f=Math.min(S,b)/100;a({position:"relative",width:"100%",borderRadius:"0.1em",fontSize:3*f+"px",padding:1.5*f+"px"})};window.addEventListener("resize",p),p();const w=setTimeout(()=>l(!0),i);return()=>{clearTimeout(w),window.removeEventListener("resize",p)}},[]),d("div",{className:`zcToast ${r&&"exiting"}`,"data-zc-toast-type":o,style:c,children:[d("div",{style:{display:"flex",gap:"1vw",position:"relative",zIndex:5},children:[n("img",{src:o==="info"?E:o==="success"?M:C,style:{width:"2vw",gap:"0.5em"}}),d("div",{children:[t&&e&&d(h,{children:[n("p",{children:t}),n("p",{style:{color:o==="info"?"#b8b8ff":o==="success"?"#c7f9c7":o==="error"?"#f8bcbc":"#ffeec5",fontSize:"70%"},children:e})]}),(!t&&e||t&&!e)&&n("p",{style:{position:"relative",zIndex:5},children:t||e})]})]}),n("div",{className:"zcToast-ProgressBar",style:{animation:`zcToast-progress ${i}ms linear 0s 1 alternate none`,position:"absolute",top:0,left:0,height:"100%"}})]})}function O({dialog:t}){const e=v(a=>a.clearDialog),[o,i]=m({}),[s,c]=m([]);return g(()=>{const a=()=>{const r=MainCanvas.canvas.clientWidth,l=MainCanvas.canvas.clientHeight,p=Math.min(r,l)/100;i({width:D(t.width),position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(36, 36, 36, 0.96)",zIndex:20,fontFamily:T.fontFamily??"sans-serif",border:"none",padding:2*p})};return window.addEventListener("resize",a),a(),()=>{window.removeEventListener("resize",a)}},[]),d("dialog",{open:Object.keys(o).length>0,"data-zc-dialog-type":t.type,style:o,children:[t.title&&n("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:t.title}),n("p",{style:{padding:"1em",marginTop:"2vw",fontSize:"clamp(6px, 2vw, 24px)",color:"white"},children:t.body}),n("div",{style:{display:"flex",flexDirection:t.buttons.direction,justifyContent:"center",gap:"0.5vw"},children:t.buttons?.list?.map((a,r)=>n("button",{className:"zcDialogBtn","data-zc-picked":s.includes(r),style:{width:"100%",position:"relative"},onClick:()=>{t.type==="choice_one"?(e(),t.promise.resolve(a.value)):s.includes(r)?c(s.filter(l=>l!==r)):c([...s,r])},children:a.text}))}),t.type==="choice_multiple"&&n("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(),t.promise.resolve(t.buttons.list.filter((a,r)=>s.includes(r)).map(a=>a.value))},children:"Confirm"})]})}class R{generateToastId(){const{toasts:e}=u.getState();return`${Date.now()}:${e.length+1}`}process({title:e,message:o,duration:i,type:s,id:c}){const{addToast:a,removeToast:r}=u.getState();a({id:c,title:e,message:o,duration:i,type:s}),setTimeout(()=>r(c),i+300)}info({title:e,message:o,duration:i}){const s=this.generateToastId();this.process({title:e,message:o,duration:i,type:"info",id:s})}success({title:e,message:o,duration:i}){const s=this.generateToastId();this.process({title:e,message:o,duration:i,type:"success",id:s})}warn({title:e,message:o,duration:i}){const s=this.generateToastId();this.process({title:e,message:o,duration:i,type:"warning",id:s})}error({title:e,message:o,duration:i}){const s=this.generateToastId();this.process({title:e,message:o,duration:i,type:"error",id:s})}}class L{showDialog({type:e,title:o,body:i,buttons:s,width:c}){const{setDialog:a}=v.getState();return new Promise((r,l)=>{a({width:c,type:e,title:o,body:i,buttons:s,promise:{resolve:r,reject:l}})})}}function N(){const t=u(o=>o.toasts),e=v(o=>o.dialog);return d(h,{children:[n(k,{children:t.map(({title:o,message:i,type:s,duration:c,id:a})=>n(I,{id:a,title:o,message:i,type:s,duration:c},a))}),e&&n(O,{dialog:e})]})}class W extends HTMLElement{disconnectedCallback(){ServerShowBeep("VirtualDOM was removed, chaos is coming...",4e3)}}function G(){customElements.define("zc-virtual-dom",W);const t=document.createElement("zc-virtual-dom");document.body.append(t),P.createRoot(document.getElementsByTagName("zc-virtual-dom")[0]).render(n(N,{}))}const K=new R,Q=new L;export{Q as dialogsManager,G as initVirtualDOM,K as toastsManager};
|
package/dist/ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{getThemedColorsModule as W,MOD_DATA as L}from"./index";function j(s){return s*(MainCanvas.canvas.clientHeight/1e3)}function I(s){return s*(MainCanvas.canvas.clientWidth/2e3)}function
|
|
1
|
+
import{getThemedColorsModule as W,MOD_DATA as L}from"./index";function j(s){return s*(MainCanvas.canvas.clientHeight/1e3)}function I(s){return s*(MainCanvas.canvas.clientWidth/2e3)}function D(s,e="top"){const o=MainCanvas.canvas.clientHeight/1e3;return e==="top"?MainCanvas.canvas.offsetTop+s*o:window.innerHeight-(MainCanvas.canvas.offsetTop+MainCanvas.canvas.clientHeight)+s*o}function O(s,e="left"){const o=MainCanvas.canvas.clientWidth/2e3;return e==="left"?MainCanvas.canvas.offsetLeft+s*o:window.innerWidth-(MainCanvas.canvas.offsetLeft+MainCanvas.canvas.clientWidth)+s*o}function E(s,e,o,c="top-left"){const f=c==="top-left"||c==="top-right"?"top":"bottom",a=c==="top-left"||c==="bottom-left"?"left":"right",t=D(o,f),d=O(e,a);Object.assign(s.style,{position:"fixed",[a]:d+"px",[f]:t+"px"})}function C(s,e,o){Object.assign(s.style,{width:I(e)+"px",height:j(o)+"px"})}function H(s,e){const o=MainCanvas.canvas.clientWidth,c=MainCanvas.canvas.clientHeight,f=Math.min(o,c)/100,a=e*f;Object.assign(s.style,{fontSize:a+"px"})}function z(s,e){s.style.fontFamily=e??"sans-serif"}function P(s,e){const o=MainCanvas.canvas.clientWidth,c=MainCanvas.canvas.clientHeight,f=Math.min(o,c)/100,a=e*f;Object.assign(s.style,{padding:a+"px"})}function k(s){const e=MainCanvas.canvas.clientWidth<=MainCanvas.canvas.clientHeight*2?MainCanvas.canvas.clientWidth/50:MainCanvas.canvas.clientHeight/25;Object.assign(s.style,{fontSize:e+"px"})}function V(s){s.createButton({x:1815,y:75,width:90,height:90,icon:"Icons/Exit.png"}).addEventListener("click",()=>s.exit()),s.name&&s.createText({text:s.name,x:100,y:60,fontSize:10}),s.load(),M[s.name]&&M[s.name].forEach(e=>e(s))}function R(){N(S)}function N(s){S=A,A=s,A&&V(A),S&&S.unload()}function X(){return A}let A,S=null;class Y{htmlElements=[];resizeEventListeners=[];tabRunHandler;get currentSubscreen(){return A}get name(){return""}run(){this.tabRunHandler&&this.tabRunHandler()}load(){}unload(){this.htmlElements.forEach(e=>{e.remove()}),this.resizeEventListeners.forEach(e=>{removeEventListener("resize",e)})}click(){}exit(){R()}update(){}setPreviousSubscreen(){R()}setSubscreen(e){N(e)}createButton({text:e,x:o,y:c,width:f,height:a,fontSize:t="auto",anchor:d="top-left",padding:l,style:h="default",place:n=!0,icon:p,iconAbsolutePosition:r=!0,iconWidth:i,tooltip:m,onClick:b,isDisabled:g}){const u=document.createElement("button");if(u.classList.add("zcButton"),u.setAttribute("data-zc-style",h),u.style.display="flex",u.style.alignItems="center",u.style.justifyContent="center",u.style.columnGap="1.25vw",z(u,L.fontFamily),p){const v=document.createElement("img");v.src=p,i?v.style.width=i:v.style.height="80%",e&&r&&(v.style.position="absolute",v.style.left="1vw"),e&&!r&&(u.style.justifyContent=""),u.append(v)}if(e){const v=document.createElement("span");v.textContent=e,p&&!r&&i&&(v.style.width="100%",v.style.marginRight=i),u.append(v)}if(m){const v=document.createElement("span");v.classList.add("tooltip"),v.setAttribute("position",m.position),v.textContent=m.text,u.append(v)}const T=()=>{typeof o=="number"&&typeof c=="number"&&E(u,o,c,d),C(u,f,a),l&&P(u,l),t==="auto"?k(u):H(u,t)};return T(),typeof g=="function"&&g()&&u.classList.add("zcDisabled"),u.addEventListener("click",()=>{if(typeof g=="function"&&g())return u.classList.add("zcDisabled");typeof b=="function"&&b()}),window.addEventListener("resize",T),n&&document.body.append(u),this.resizeEventListeners.push(T),this.htmlElements.push(u),u}createText({text:e,color:o,x:c,y:f,width:a,height:t,withBackground:d=!1,fontSize:l="auto",anchor:h="top-left",padding:n,place:p=!0}){const r=document.createElement("p");r.innerHTML=e,r.style.color=o??"var(--tmd-text, black)",d&&(r.style.background="var(--tmd-element,rgb(239, 239, 239))"),z(r,L.fontFamily);const i=()=>{typeof c=="number"&&typeof f=="number"&&E(r,c,f,h),C(r,a,t),n&&P(r,n),l==="auto"?k(r):H(r,l)};return i(),window.addEventListener("resize",i),p&&document.body.append(r),this.resizeEventListeners.push(i),this.htmlElements.push(r),r}createInput({value:e,placeholder:o,x:c,y:f,width:a,height:t,textArea:d=!1,fontSize:l="auto",anchor:h="top-left",padding:n,place:p=!0,onChange:r,onInput:i,isDisabled:m}){const b=document.createElement(d?"textarea":"input");b.classList.add("zcInput"),o&&(b.placeholder=o),e&&(b.value=e),z(b,L.fontFamily);const g=()=>{typeof c=="number"&&typeof f=="number"&&E(b,c,f,h),C(b,a,t),n&&P(b,n),l==="auto"?k(b):H(b,l)};return g(),typeof m=="function"&&m()&&b.classList.add("zcDisabled"),b.addEventListener("change",()=>{if(typeof m=="function"&&m())return b.classList.add("zcDisabled");typeof r=="function"&&r()}),b.addEventListener("input",()=>{if(typeof m=="function"&&m())return b.classList.add("zcDisabled");typeof i=="function"&&i()}),window.addEventListener("resize",g),p&&document.body.append(b),this.resizeEventListeners.push(g),this.htmlElements.push(b),b}createCheckbox({text:e,x:o,y:c,isChecked:f,width:a,anchor:t="top-left",place:d=!0,isDisabled:l,onChange:h}){const n=document.createElement("div");n.style.display="flex",n.style.alignItems="center",n.style.columnGap="1vw";const p=document.createElement("input");p.type="checkbox",p.checked=f,p.style.borderRadius="min(0.8dvh, 0.3dvw)",p.classList.add("zcCheckbox","checkbox");const r=document.createElement("p");r.textContent=e,r.style.color="var(--tmd-text, black)",z(r,L.fontFamily);const i=()=>{typeof o=="number"&&typeof c=="number"&&E(n,o,c,t),a&&(n.style.width=I(a)+"px"),H(r,5)};return i(),typeof l=="function"&&l()&&n.classList.add("zcDisabled"),n.addEventListener("change",()=>{if(typeof l=="function"&&l())return n.classList.add("zcDisabled");typeof h=="function"&&h()}),window.addEventListener("resize",i),n.append(p,r),d&&document.body.append(n),this.resizeEventListeners.push(i),this.htmlElements.push(n,r),n}createScrollView({scroll:e,x:o,y:c,width:f,height:a,anchor:t="top-left"}){const d=document.createElement("div");e==="all"&&(d.style.overflow="scroll"),e==="x"&&(d.style.overflowX="scroll"),e==="y"&&(d.style.overflowY="scroll");const l=()=>{typeof o=="number"&&typeof c=="number"&&E(d,o,c,t),C(d,f,a)};return l(),window.addEventListener("resize",l),document.body.append(d),this.resizeEventListeners.push(l),this.htmlElements.push(d),d}createInputList({x:e,y:o,width:c,height:f,title:a,value:t,anchor:d="top-left",place:l=!0,numbersOnly:h=!1,isDisabled:n,onChange:p}){const r=[],i=document.createElement("div");i.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(i,L.fontFamily);const m=document.createElement("div");m.style.cssText="display: flex; justify-content: center; column-gap: 1vw; width: 100%;";const
|
|
5
|
-
overflow-y: scroll;`;const u=document.createElement("input");u.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 T=(y,x)=>{const w=document.createElement("button");w.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 F=DrawGetImage(y);F.style.cssText="width: 90%;",w.append(F),m.append(w),w.addEventListener("click",x)},v=y=>{if(typeof n=="function"&&n())return i.classList.add("zcDisabled");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=y,g.insertBefore(x,u),x.addEventListener("click",w=>{x.style.border===""?x.style.border="2px solid red":x.style.border="",w.stopPropagation()}),r.push(y),typeof p=="function"&&p(
|
|
4
|
+
`,z(i,L.fontFamily);const m=document.createElement("div");m.style.cssText="display: flex; justify-content: center; column-gap: 1vw; width: 100%;";const b=document.createElement("b");b.textContent=a+":",b.style.cssText="width: 100%; font-size: clamp(10px, 2.4vw, 24px); color: var(--tmd-text, black);";const g=document.createElement("div");g.style.cssText=`display: flex; gap: 1vw; flex-wrap: wrap; align-content: flex-start;
|
|
5
|
+
overflow-y: scroll;`;const u=document.createElement("input");u.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 T=(y,x)=>{const w=document.createElement("button");w.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 F=DrawGetImage(y);F.style.cssText="width: 90%;",w.append(F),m.append(w),w.addEventListener("click",x)},v=y=>{if(typeof n=="function"&&n())return i.classList.add("zcDisabled");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=y,g.insertBefore(x,u),x.addEventListener("click",w=>{x.style.border===""?x.style.border="2px solid red":x.style.border="",w.stopPropagation()}),r.push(y),typeof p=="function"&&p(h?r.map(w=>parseInt(w)):r)},B=()=>{typeof e=="number"&&typeof o=="number"&&E(i,e,o,d),C(i,c,f)};return T("Icons/Cancel.png",()=>{if(typeof n=="function"&&n())return i.classList.add("zcDisabled");g.innerHTML="",r.splice(0,r.length),g.append(u),t.forEach(y=>v(String(y)))}),T("Icons/Trash.png",()=>{typeof n=="function"&&n()&&i.classList.add("zcDisabled");for(const y of[...g.children])y.getAttribute("style").includes("border: 2px solid red;")&&(r.splice(r.indexOf(y.textContent),1),y.remove())}),B(),typeof n=="function"&&n()&&i.classList.add("zcDisabled"),window.addEventListener("resize",B),u.addEventListener("keypress",y=>{if(document.activeElement===u)switch(y.key){case"Enter":if(h&&Number.isNaN(parseInt(u.value))||!h&&u.value.trim()==="")return;v(u.value),u.value="";break}}),i.addEventListener("click",y=>{y.currentTarget==i&&u.focus()}),g.append(u),i.append(m,b,g),document.body.append(i),this.resizeEventListeners.push(B),this.htmlElements.push(i),t.forEach(y=>v(String(y))),i}createImage({x:e,y:o,width:c,src:f}){const a=document.createElement("img");a.src=f;const t=()=>{typeof e=="number"&&typeof o=="number"&&E(a,e,o),C(a,c,0),a.style.height="auto"};return t(),window.addEventListener("resize",t),document.body.append(a),this.resizeEventListeners.push(t),this.htmlElements.push(a),a}createBackNextButton({x:e,y:o,width:c,height:f,items:a,currentIndex:t,isBold:d=!1,onChange:l,isDisabled:h}){const n=document.createElement("div");n.classList.add("zcBackNextButton"),z(n,L.fontFamily);const p=document.createElement("button");p.style.cssText="position: absolute; left: 1vw; font-size: 3.5vw; aspect-ratio: 1/1; height: 140%;",p.classList.add("zcButton"),p.textContent="\u{1F844}",p.addEventListener("click",()=>{if(typeof h=="function"&&h())return n.classList.add("zcDisabled");t!==0&&(t--,i.textContent=a[t][0],typeof l=="function"&&l(a[t][1]))});const r=document.createElement("button");r.style.cssText="position: absolute; right: 1vw; font-size: 3.5vw; aspect-ratio: 1/1; height: 140%;",r.classList.add("zcButton"),r.textContent="\u{1F846}",r.addEventListener("click",()=>{if(typeof h=="function"&&h())return n.classList.add("zcDisabled");t!==a.length-1&&(t++,i.textContent=a[t][0],typeof l=="function"&&l(a[t][1]))});const i=document.createElement("p");d&&(i.style.fontWeight="bold"),i.textContent=a[t][0],n.append(p,i,r);const m=()=>{typeof e=="number"&&typeof o=="number"&&E(n,e,o),C(n,c,f),k(i)};return m(),typeof h=="function"&&h()&&n.classList.add("zcDisabled"),window.addEventListener("resize",m),document.body.append(n),this.resizeEventListeners.push(m),this.htmlElements.push(n),n}createTabs({x:e,y:o,width:c,tabs:f,anchor:a="top-left",currentTabName:t}){let d=[];const l=document.createElement("div");l.classList.add("zcTabs"),z(l,L.fontFamily),f.forEach(n=>{const p=()=>{for(const m of l.children)m.removeAttribute("data-opened");for(const m of d)m instanceof Node&&document.body.removeChild(m);d=[],r.setAttribute("data-opened","true");const i=document.body.append.bind(document.body);document.body.append=(...m)=>{d.push(...m),i(...m)},n.load(),this.tabRunHandler=n.run,document.body.append=i},r=document.createElement("button");r.textContent=n.name,n.name===t&&p(),r.addEventListener("click",p),l.append(r)});const h=()=>{typeof e=="number"&&typeof o=="number"&&E(l,e,o,a),c&&(l.style.width=I(c)+"px"),k(l)};return h(),window.addEventListener("resize",h),document.body.append(l),this.resizeEventListeners.push(h),this.htmlElements.push(l),l}drawPolylineArrow({points:e,strokeColor:o=W()?.base?.text??"black",lineWidth:c=2,circleRadius:f=5,circleColor:a=W()?.base?.text??"black"}){if(e.length<2)return;const t=MainCanvas.canvas.getContext("2d");t.save(),t.strokeStyle=o,t.lineWidth=c,t.fillStyle=a,t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let d=1;d<e.length;d++)t.lineTo(e[d].x,e[d].y);t.stroke(),t.beginPath(),t.arc(e[0].x,e[0].y,f,0,Math.PI*2),t.fill(),t.beginPath(),t.arc(e[e.length-1].x,e[e.length-1].y,f,0,Math.PI*2),t.fill(),t.restore()}}const M={};function _(s,e){M[s]||(M[s]=[]),M[s].push(e)}export{Y as BaseSubscreen,k as autosetFontSize,X as getCurrentSubscreen,j as getRelativeHeight,I as getRelativeWidth,O as getRelativeX,D as getRelativeY,_ as hookSubscreen,V as loadSubscreen,z as setFontFamily,H as setFontSize,P as setPadding,E as setPosition,R as setPreviousSubscreen,C as setSize,N as setSubscreen};
|