zois-core 1.1.7 → 1.1.9
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/LICENSE +21 -21
- package/README.md +1 -1
- package/dist/index.js +1 -1
- package/dist/modsApi.js +1 -1
- package/dist/popups.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/modsApi.d.ts +1 -1
- package/dist/types/popups.d.ts +4 -12
- package/dist/types/ui.d.ts +8 -6
- package/dist/types/wardrobe.d.ts +13 -0
- package/dist/ui-modules/dynamicClassModule.js +1 -1
- package/dist/ui-modules/styleModule.js +1 -1
- package/dist/ui.js +5 -5
- package/dist/wardrobe.js +1 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Zoi
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Zoi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
## The core for the my mods, which contains a shared code reused in all my mods
|
|
1
|
+
## The core for the my mods, which contains a shared code reused in all my mods
|
|
2
2
|

|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import l from"./styles.css";import{findModByName as u,registerMod as g}from"./modsApi";import{initVirtualDOM as d,useToastsStore as f,useDialogStore as m}from"./popups";import{version as A}from"../package.json";let c;function C(e){if(!window.ZOISCORE){const t=document.createElement("style");t.innerHTML=l,document.head.append(t),window.ZOISCORE=Object.freeze({loaded:!0,useToastsStore:f,useDialogStore:m}),d()}c={...e},g()}function p(e){return new Promise(t=>setTimeout(t,e))}async function h(e,t=()=>!1){for(;!e();){if(t())return!1;await p(10)}return!0}function y(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function w(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 T(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 N(e){if(e)return ChatRoomCharacter.find(t=>t.MemberNumber==e||t.Name.toLowerCase()===e||t.Nickname?.toLowerCase()===e)}function O(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}function k(e){const t=document.createElement("style");t.innerHTML=e,document.head.append(t)}function P(e){h(()=>typeof window.Player?.MemberNumber=="number").then(()=>setTimeout(e,y(3e3,6e3)))}function a(e){return typeof e!="object"||e===null?e:Array.isArray(e)?e.map(a).sort():Object.keys(e).sort().reduce((t,r)=>(t[r]=a(e[r]),t),{})}export{c as MOD_DATA,D as colorsEqual,O as getNickname,N as getPlayer,y as getRandomNumber,T as getSizeInKbytes,S as getThemedColorsModule,k as injectStyles,w as isVersionNewer,a as normalizeObject,C as registerCore,p as sleep,A as version,h as waitFor,P as waitForStart};
|
package/dist/modsApi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s from"bondage-club-mod-sdk";import{MOD_DATA as i}from"./index";import{getCurrentSubscreen as a}from"./ui";var d=(n=>(n[n.OBSERVE=0]="OBSERVE",n[n.ADD_BEHAVIOR=1]="ADD_BEHAVIOR",n[n.MODIFY_BEHAVIOR=5]="MODIFY_BEHAVIOR",n[n.OVERRIDE_BEHAVIOR=10]="OVERRIDE_BEHAVIOR",n[n.TOP=100]="TOP",n))(d||{});let o;function T(){o=s.registerMod({name:i.name,fullName:i.fullName,version:i.version,repository:i.repository}),c("GameKeyDown",1,(e,t)=>{const r=a();return CommonKey.IsPressed(e[0],"Escape")&&r?(r.exit(),!1):t(e)})}function c(e,t,r){if(!o)throw new Error("zois-core is not registered");return o.hookFunction(e,t,r)}function h(e,t){if(!o)throw new Error("zois-core is not registered");o.patchFunction(e,t)}function I(e,t,r){if(!o)throw new Error("zois-core is not registered");return o.callOriginal(e,t)}function x(){return s.getModsInfo()}function E(e){return!!s.getModsInfo().find(t=>t.name===e)}export{d as HookPriority,I as callOriginal,E as findModByName,x as getLoadedMods,c as hookFunction,o as modSdk,h as patchFunction,T as registerMod};
|
package/dist/popups.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getRelativeX as D,getRelativeY as x}from"./ui";import{MOD_DATA as d}from"./index";import{useState as p,useEffect as u,useRef as E}from"react";import k from"react-dom/client";import{create as S}from"zustand";import{CircleAlert as I,CircleCheck as O,CircleX as P,Info as z}from"lucide-react";import{Fragment as f,jsx as i,jsxs as l}from"react/jsx-runtime";const R=({children:s})=>{const[e,o]=p({}),r=window.ZOISCORE.useToastsStore(t=>t.clearToasts);return u(()=>{const t=()=>{o({fontFamily:CommonGetFontName(),bottom:x(5)+"px",left:D(5)+"px"})};return window.addEventListener("resize",t),t(),()=>{window.removeEventListener("resize",t)}},[]),i("div",{className:"zcToastsContainer",style:e,onClick:()=>{document.querySelectorAll(".zcToast").forEach(t=>{t.classList.add("exiting")}),setTimeout(r,300)},children:s})},M=({type:s,theme:e})=>{switch(s){case"info":return i(z,{style:{flexShrink:0,width:"1.65em",height:"1.65em",fill:e?e.iconFillColor:"#addbff",stroke:e?e.iconStrokeColor:"#385073"}});case"success":return i(O,{style:{flexShrink:0,width:"1.65em",height:"1.65em",fill:e?e.iconFillColor:"#c3ffc3",stroke:e?e.iconStrokeColor:"#028f74"}});case"warning":return i(I,{style:{flexShrink:0,width:"1.65em",height:"1.65em",fill:e?e.iconFillColor:"#ffdfaf",stroke:e?e.iconStrokeColor:"#9c7633"}});case"error":return i(P,{style:{flexShrink:0,width:"1.65em",height:"1.65em",fill:e?e.iconFillColor:"#ffb2b2",stroke:e?e.iconStrokeColor:"#7f2828"}});case"spinner":return i("div",{style:{flexShrink:0,width:"1.65em",height:"1.65em",boxSizing:"border-box",border:"2px solid",borderRadius:"100%",borderColor:`transparent ${e?e.iconFillColor:"rgb(154 154 255)"}`,animation:"zcSpin 0.65s linear infinite"}})}},F=({title:s,message:e,type:o,duration:r,theme:t})=>{const[n,a]=p({}),[c,m]=p(!1),h=t?t.backgroundColor:o==="success"?"#3ece7e":o==="warning"?"#debf72":o==="error"?"rgb(212, 46, 107)":"rgb(80, 80, 223)",C=t?t.titleColor:o==="info"||o==="spinner"?"rgb(47, 46, 104)":o==="success"?"#244428":o==="error"?"rgb(113, 2, 2)":"#5e4328",T=t?t.messageColor:o==="info"||o==="spinner"?"#b8b8ff":o==="success"?"#c7f9c7":o==="error"?"rgb(255, 152, 152)":"#ffeec5";return u(()=>{const g=()=>{const w=MainCanvas.canvas.clientWidth,b=MainCanvas.canvas.clientHeight,v=Math.min(w,b)/100;a({position:"relative",width:"100%",fontSize:3*v+"px",padding:1.5*v+"px",background:h})};window.addEventListener("resize",g),g();const y=setTimeout(()=>m(!0),r);return()=>{clearTimeout(y),window.removeEventListener("resize",g)}},[]),l("div",{className:`zcToast ${c&&"exiting"}`,"data-zc-toast-type":o,style:n,children:[l("div",{style:{display:"flex",alignItems:"center",gap:"1vw",position:"relative",zIndex:5},children:[i(M,{type:o,theme:t}),l("div",{children:[s&&e&&l(f,{children:[i("p",{style:{color:C,fontWeight:"bold"},children:s}),i("p",{style:{color:T,fontSize:"70%",fontWeight:"bold",overflowWrap:"anywhere",marginTop:"0.25em"},children:e})]}),(!s&&e||s&&!e)&&i("p",{style:{position:"relative",zIndex:5,color:T,fontWeight:"bold",overflowWrap:"anywhere"},children:s||e})]})]}),o!=="spinner"&&i("div",{className:"zcToast-ProgressBar",style:{animation:`zcToast-progress ${r}ms linear 0s 1 alternate none`,position:"absolute",top:0,left:0,height:"100%",borderRadius:"4px",background:t?t.progressBarColor:o==="info"?"rgb(103, 103, 234)":o==="success"?"#34bc71":o==="warning"?"#d0af5e":"rgb(183, 40, 92)"}})]})};function W({dialog:s}){const e=window.ZOISCORE.useDialogStore(a=>a.clearDialog),[o,r]=p(""),t=E(null),n=a=>{a.key==="Enter"&&(e(),s.promise.resolve(s.type==="prompt"?o:!0))};return u(()=>(document.body.style.pointerEvents="none",s.type==="prompt"&&t.current instanceof HTMLInputElement&&t.current.focus(),document.addEventListener("keypress",n),()=>{document.body.style.pointerEvents="",document.removeEventListener("keypress",n)}),[]),l(f,{children:[l("dialog",{className:"zcDialog","data-zc-dialog-type":s.type,style:{fontFamily:CommonGetFontName()},children:[i("p",{children:s.message}),s.type==="prompt"&&i("input",{ref:t,type:"text",style:{color:"white",marginTop:"1px",width:"90%",background:"rgb(82, 89, 104)",border:"none",borderRadius:"4px",padding:"0.45em"},onChange:a=>r(a.currentTarget.value)}),l("div",{style:{display:"flex",justifyContent:"end",columnGap:"0.75em",width:"100%",padding:"1em"},children:[i("button",{onClick:()=>{e(),s.promise.resolve(!1)},children:"Cancel"}),i("button",{onClick:()=>{e(),s.promise.resolve(s.type==="prompt"?o:!0)},children:"Ok"})]})]}),i("div",{style:{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",zIndex:"20",opacity:"0.5",background:"black"}})]})}class L{generateToastId(){return crypto.randomUUID()}process({title:e,message:o,duration:r,type:t,id:n,theme:a}){const{addToast:c,removeToast:m}=window.ZOISCORE.useToastsStore.getState();c({id:n,title:e,message:o,duration:r,type:t,theme:a}),setTimeout(()=>m(n),r+300)}info({title:e,message:o,duration:r}){const t=this.generateToastId(),n=d.singleToastsTheme;this.process({title:e,message:o,duration:r,type:"info",id:t,theme:n})}success({title:e,message:o,duration:r}){const t=this.generateToastId(),n=d.singleToastsTheme;this.process({title:e,message:o,duration:r,type:"success",id:t,theme:n})}warn({title:e,message:o,duration:r}){const t=this.generateToastId(),n=d.singleToastsTheme;this.process({title:e,message:o,duration:r,type:"warning",id:t,theme:n})}error({title:e,message:o,duration:r}){const t=this.generateToastId(),n=d.singleToastsTheme;this.process({title:e,message:o,duration:r,type:"error",id:t,theme:n})}spinner({title:e,message:o}){const r=this.generateToastId(),t=d.singleToastsTheme;return this.process({title:e,message:o,duration:1e6,type:"spinner",id:r,theme:t}),r}removeSpinner(e){const{removeToast:o}=window.ZOISCORE.useToastsStore.getState();o(e)}}class N{prompt({message:e}){const{setDialog:o}=window.ZOISCORE.useDialogStore.getState();return new Promise((r,t)=>{o({type:"prompt",message:e,promise:{resolve:r,reject:t}})})}confirm({message:e}){const{setDialog:o}=window.ZOISCORE.useDialogStore.getState();return new Promise((r,t)=>{o({type:"confirm",message:e,promise:{resolve:r,reject:t}})})}}function Z(){const s=window.ZOISCORE.useToastsStore(o=>o.toasts),e=window.ZOISCORE.useDialogStore(o=>o.dialog);return l(f,{children:[i(R,{children:s.map(({title:o,message:r,type:t,duration:n,id:a,theme:c})=>i(F,{id:a,title:o,message:r,type:t,duration:n,theme:c},a))}),e&&i(W,{dialog:e})]})}class A extends HTMLElement{disconnectedCallback(){ServerShowBeep("VirtualDOM was removed, chaos is coming...",5e3,{})}}const ee=S(s=>({toasts:[],addToast:e=>s(o=>({toasts:[...o.toasts,e]})),removeToast:e=>s(o=>({toasts:o.toasts.filter(r=>r.id!==e)})),clearToasts:()=>s({toasts:[]})})),oe=S(s=>({dialog:null,setDialog:e=>s({dialog:e}),clearDialog:()=>s({dialog:null})}));function te(){customElements.define("zc-virtual-dom",A);const s=document.createElement("zc-virtual-dom");document.body.append(s),k.createRoot(document.getElementsByTagName("zc-virtual-dom")[0]).render(i(Z,{}))}const se=new L,re=new N;export{re as dialogsManager,te as initVirtualDOM,se as toastsManager,oe as useDialogStore,ee 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;
|
|
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;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;z-index:10}.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, #f6f6f6);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:30}@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;border-radius:4px}.zcToast.exiting{animation:zcSlideOutToLeft .3s ease-out forwards}.zcToast p{color:#fff}.zcDialog{display:flex;flex-direction:column;align-items:center;background:#39404d;margin:auto;position:absolute;inset:0;border:none;border-radius:4px;min-width:200px;max-width:450px;width:90%;z-index:25;pointer-events:all!important;box-shadow:0 0 6px 1px #0000006e}.zcDialog>p{padding:.75em 0;user-select:none;width:90%;color:#fff}.zcDialog>input:focus{outline:2px solid rgb(0,238,255)}.zcDialog>div>button{cursor:pointer;padding:6px 14px;border:none;border-radius:4px;font-weight:700}.zcDialog>div>button:first-child{background:#495263;color:#fff}.zcDialog>div>button:first-child:hover{background:#565e6c}.zcDialog>div>button:last-child{background:#0ef}.zcDialog>div>button:last-child:hover{background:#04cbd9}@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}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -53,3 +53,4 @@ export declare function getNickname(target: Character): string;
|
|
|
53
53
|
export declare function getThemedColorsModule(): ThemedColorsModule | null;
|
|
54
54
|
export declare function injectStyles(stylesToInject: string): void;
|
|
55
55
|
export declare function waitForStart(callback: () => void): void;
|
|
56
|
+
export declare function normalizeObject(obj: unknown): any;
|
package/dist/types/modsApi.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare enum HookPriority {
|
|
|
8
8
|
}
|
|
9
9
|
export declare let modSdk: ModSDKModAPI;
|
|
10
10
|
export declare function registerMod(): void;
|
|
11
|
-
export declare function hookFunction(functionName:
|
|
11
|
+
export declare function hookFunction<TFunctionName extends string>(functionName: TFunctionName, priority: HookPriority, hook: PatchHook<GetDotedPathType<typeof globalThis, TFunctionName>>): () => void;
|
|
12
12
|
export declare function patchFunction(functionName: string, patches: Record<string, string | null>): void;
|
|
13
13
|
export declare function callOriginal<TFunctionName extends string>(target: TFunctionName, args: [...Parameters<GetDotedPathType<typeof globalThis, TFunctionName>>], context?: any): ReturnType<GetDotedPathType<typeof globalThis, TFunctionName>>;
|
|
14
14
|
export declare function getLoadedMods(): ModSDKModInfo[];
|
package/dist/types/popups.d.ts
CHANGED
|
@@ -8,17 +8,8 @@ interface ToastProps {
|
|
|
8
8
|
theme?: ModData["singleToastsTheme"];
|
|
9
9
|
}
|
|
10
10
|
interface DialogProps {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
title?: string;
|
|
14
|
-
body: string;
|
|
15
|
-
buttons: {
|
|
16
|
-
direction: "row" | "column";
|
|
17
|
-
list: {
|
|
18
|
-
text: string;
|
|
19
|
-
value?: unknown;
|
|
20
|
-
}[];
|
|
21
|
-
};
|
|
11
|
+
type: "prompt" | "confirm";
|
|
12
|
+
message: string;
|
|
22
13
|
promise: {
|
|
23
14
|
resolve: (data: any) => void;
|
|
24
15
|
reject: (data: any) => void;
|
|
@@ -35,7 +26,8 @@ declare class ToastsManager {
|
|
|
35
26
|
removeSpinner(id: string): void;
|
|
36
27
|
}
|
|
37
28
|
declare class DialogsManager {
|
|
38
|
-
|
|
29
|
+
prompt({ message }: Omit<DialogProps, "type" | "promise">): Promise<string | false>;
|
|
30
|
+
confirm({ message }: Omit<DialogProps, "type" | "promise">): Promise<boolean>;
|
|
39
31
|
}
|
|
40
32
|
export interface ToastsStore {
|
|
41
33
|
toasts: ToastProps[];
|
package/dist/types/ui.d.ts
CHANGED
|
@@ -130,11 +130,13 @@ interface DrawPolylineArrowArgs {
|
|
|
130
130
|
circleColor?: string;
|
|
131
131
|
}
|
|
132
132
|
export interface DynamicClassStyles {
|
|
133
|
-
base?:
|
|
134
|
-
hover?:
|
|
135
|
-
active?:
|
|
136
|
-
focus?:
|
|
137
|
-
disabled?:
|
|
133
|
+
base?: Partial<CSSStyleDeclaration>;
|
|
134
|
+
hover?: Partial<CSSStyleDeclaration>;
|
|
135
|
+
active?: Partial<CSSStyleDeclaration>;
|
|
136
|
+
focus?: Partial<CSSStyleDeclaration>;
|
|
137
|
+
disabled?: Partial<CSSStyleDeclaration>;
|
|
138
|
+
before?: Partial<CSSStyleDeclaration>;
|
|
139
|
+
after?: Partial<CSSStyleDeclaration>;
|
|
138
140
|
}
|
|
139
141
|
export declare function dataUrlSvgWithColor(dataUrl: string, newColor: string): string;
|
|
140
142
|
export declare function getRelativeHeight(height: number): number;
|
|
@@ -180,7 +182,7 @@ export declare abstract class BaseSubscreen {
|
|
|
180
182
|
drawPolylineArrow({ points, strokeColor, lineWidth, circleRadius, circleColor }: DrawPolylineArrowArgs): void;
|
|
181
183
|
createCard({ x, y, name, value, icon, anchor, place, modules }: CreateCardArgs): HTMLDivElement;
|
|
182
184
|
createSelect({ x, y, width, options, currentOption, anchor, place, modules, onChange, isDisabled }: CreateSelectArgs): HTMLDivElement;
|
|
183
|
-
createContainer({ x, y, anchor, place, modules }: CreateContainerArgs): HTMLDivElement;
|
|
185
|
+
createContainer({ x, y, width, height, anchor, place, modules }: CreateContainerArgs): HTMLDivElement;
|
|
184
186
|
}
|
|
185
187
|
export declare function hookSubscreen(subscreenName: string, hook: (subscreen: BaseSubscreen) => void): void;
|
|
186
188
|
export {};
|
package/dist/types/wardrobe.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
declare class AppearanceComparer {
|
|
2
|
+
private seedsCache;
|
|
3
|
+
getSeed(arr: Item[]): number;
|
|
4
|
+
generateSeed(str: string): number;
|
|
5
|
+
compare(arr1: Item[], arr2: Item[]): boolean;
|
|
6
|
+
getDifference(arr1: Item[], arr2: Item[]): {
|
|
7
|
+
added: string[];
|
|
8
|
+
modified: string[];
|
|
9
|
+
removed: string[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const appearanceComparer: AppearanceComparer;
|
|
1
13
|
export declare function smartGetAsset(item: Item | Asset): Asset;
|
|
2
14
|
export declare function smartGetAssetGroup(item: Item | Asset | AssetGroup): AssetGroup;
|
|
3
15
|
export declare function smartGetItemName(item: Item): string;
|
|
@@ -11,3 +23,4 @@ export declare function importAppearance(C: Character, bundleToAttach: Item[], i
|
|
|
11
23
|
export declare function validationCanAccessCheck(C: Character, group: AssetGroupName, asset: Asset): boolean;
|
|
12
24
|
export declare function serverAppearanceBundleToAppearance(assetFamily: IAssetFamily, serverAppearanceBundle: AppearanceBundle): Item[];
|
|
13
25
|
export declare function addRequiredAppearanceItems(appearanceBundle: Item[]): void;
|
|
26
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{addDynamicClass as s}from"../ui";import{BaseModule as a}from"../modules";class
|
|
1
|
+
import{addDynamicClass as s}from"../ui";import{BaseModule as a}from"../modules";class y extends a{constructor(t){super();this.style=t}layoutEffect(t,e){s(e,this.style)}}export{y as DynamicClassModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BaseModule as a}from"../modules";class
|
|
1
|
+
import{BaseModule as a}from"../modules";class u extends a{constructor(o){super();this.style=o}applyStyle(o,t){for(const e of Object.keys(t))!isNaN(e)||typeof t[e]=="function"||(o.style[e]=t[e])}layoutEffect(o,t){this.applyStyle(t,this.style)}}export{u as StyleModule};
|
package/dist/ui.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{Check as
|
|
1
|
+
import{Check as N,ChevronDown as I,CircleX as F,createElement as T,Trash2 as W}from"lucide";import{getThemedColorsModule as z,MOD_DATA as C}from"./index";import{StyleModule as H}from"./ui-modules";function q(g,e){return g.replace(/fill="[^"]*"/g,`fill="${e}"`).replace(/stroke="[^"]*"/g,`stroke="${e}"`)}function D(g){return g*(MainCanvas.canvas.clientHeight/1e3)}function P(g){return g*(MainCanvas.canvas.clientWidth/2e3)}function V(g,e="top"){const o=MainCanvas.canvas.clientHeight/1e3;return e==="top"?MainCanvas.canvas.offsetTop+g*o:window.innerHeight-(MainCanvas.canvas.offsetTop+MainCanvas.canvas.clientHeight)+g*o}function R(g,e="left"){const o=MainCanvas.canvas.clientWidth/2e3;return e==="left"?MainCanvas.canvas.offsetLeft+g*o:window.innerWidth-(MainCanvas.canvas.offsetLeft+MainCanvas.canvas.clientWidth)+g*o}function O(g,e,o,l="top-left"){const i=l==="top-left"||l==="top-right"?"top":"bottom",n=l==="top-left"||l==="bottom-left"?"left":"right",t=V(o,i),f=R(e,n);Object.assign(g.style,{position:"fixed",[n]:f+"px",[i]:t+"px"})}function J(g,e,o){Object.assign(g.style,{width:P(e)+"px",height:D(o)+"px"})}function j(g,e){const o=MainCanvas.canvas.clientWidth,l=MainCanvas.canvas.clientHeight,i=Math.min(o,l)/100,n=e*i;Object.assign(g.style,{fontSize:n+"px"})}function L(g,e){g.style.fontFamily=e??"sans-serif"}function G(g,e){const o=MainCanvas.canvas.clientWidth,l=MainCanvas.canvas.clientHeight,i=Math.min(o,l)/100,n=e*i;Object.assign(g.style,{padding:n+"px"})}function X(g){const e=MainCanvas.canvas.clientWidth<=MainCanvas.canvas.clientHeight*2?MainCanvas.canvas.clientWidth/50:MainCanvas.canvas.clientHeight/25;Object.assign(g.style,{fontSize:e+"px"})}const B=[];function _(g){const e=o=>o?JSON.stringify(Object.keys(o).sort().reduce((l,i)=>(l[i]=o[i],l),{})):"null";return`base:${e(g.base)}|hover:${e(g.hover)}|active:${e(g.active)}|before:${e(g.before)}|after:${e(g.after)}`}function Q(g,e){const o=_(e),l=B.find(p=>p.key===o);if(l)return g.classList.add(l.className);let i;do i="dynamic-"+Math.random().toString(36).substring(2,10);while(B.find(p=>p.className===i));B.push({key:o,className:i});const n=(p,m)=>{let d=`${p} {`;for(const[r,c]of Object.entries(m))d+=`${r.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}: ${c};`;return d+="}",d};let t="";e.base&&(t+=n(`.${i}`,e.base)),e.hover&&(t+=n(`.${i}:hover`,e.hover)),e.active&&(t+=n(`.${i}:active`,e.active)),e.focus&&(t+=n(`.${i}:focus`,e.focus)),e.disabled&&(t+=n(`.${i}:disabled`,e.disabled)),e.before&&(t+=n(`.${i}:before`,e.before)),e.after&&(t+=n(`.${i}:after`,e.after));let f=document.getElementById(`${C.key??""}-dynamic-classes`);f?f.textContent+=t:(f=document.createElement("style"),f.id=`${C.key??""}-dynamic-classes`,f.textContent=t,document.head.appendChild(f)),g.classList.add(i)}function U(){$(w)}function $(g){w=k,k=g,k&&k.load(),w&&w.unload()}function ee(){return k}let k,w=null;class te{htmlElements=[];resizeEventListeners=[];tabHandlers={};addElement(e,{x:o,y:l,width:i,height:n,padding:t,fontSize:f="auto",anchor:p,place:m,modules:d={},modulesMap:r}){L(e,C.fontFamily);const c={anchor:p,x:o,y:l,width:i,height:n,padding:t,fontSize:f,place:m,element:e};Object.keys(d)?.forEach(s=>{d[s].forEach(b=>{const u=b.overrideProperties(c,r[s]);p=u.anchor,o=u.x,l=u.y,i=u.width,n=u.height,t=u.padding,f=u.fontSize,m=u.place,e=u.element})});const a=()=>{typeof o=="number"&&typeof l=="number"&&O(e,o,l,p),f==="auto"?X(e):j(e,f),t&&G(e,t),i&&(e.style.width=P(i)+"px"),n&&(e.style.height=D(n)+"px")};a(),window.addEventListener("resize",a),Object.keys(d)?.forEach(s=>{d[s].forEach(b=>{b.layoutEffect(c,r[s])})}),m&&document.body.append(e),this.resizeEventListeners.push(a),this.htmlElements.push(e),Object.keys(d)?.forEach(s=>{d[s].forEach(b=>{b.effect(c,r[s])})})}get currentSubscreen(){return k}get previousSubscreen(){return w}get name(){return""}run(){this.tabHandlers.run?.()}load(){this.createButton({x:1815,y:75,width:90,height:90,icon:"Icons/Exit.png",modules:{base:[new H({zIndex:"10"})]}}).addEventListener("click",()=>this.exit()),this.name&&(this.createText({text:this.name,x:100,y:60,fontSize:8}).style.cssText+="max-width: 85%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.1em;"),M[this.constructor.name]&&M[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(){U()}setSubscreen(e){$(e)}createButton({text:e,x:o,y:l,width:i,height:n,fontSize:t="auto",anchor:f="top-left",padding:p,style:m="default",place:d=!0,icon:r,iconAbsolutePosition:c=!0,tooltip:a,onClick:s,isDisabled:b,modules:u}){let h,v;const y=document.createElement("button");if(y.classList.add("zcButton"),y.setAttribute("data-zc-style",m),y.style.display="flex",y.style.alignItems="center",y.style.justifyContent="center",y.style.columnGap="1.25vw",L(y,C.fontFamily),r&&(typeof r=="string"?(h=document.createElement("img"),h.src=r):h=r,h.style.height="80%",h.style.width="auto",e&&c&&(h.style.position="absolute",h.style.left="1vw"),e&&!c&&(y.style.justifyContent=""),y.append(h)),e&&(v=document.createElement("span"),v.textContent=e,y.append(v)),a){const S=document.createElement("span");S.classList.add("tooltip"),S.setAttribute("position",a.position),S.textContent=a.text,y.append(S)}return typeof b=="function"&&b()&&y.classList.add("zcDisabled"),y.addEventListener("click",()=>{if(typeof b=="function"&&b())return y.classList.add("zcDisabled");typeof s=="function"&&s()}),this.addElement(y,{x:o,y:l,width:i,height:n,anchor:f,place:d,fontSize:t,padding:p,modules:u,modulesMap:{base:y,text:v,icon:h}}),y}createText({text:e,color:o,x:l,y:i,width:n,height:t,withBackground:f=!1,withBorder:p=!1,fontSize:m="auto",anchor:d="top-left",padding:r,place:c=!0,modules:a}){const s=document.createElement("p");return s.innerHTML=e,s.style.color=o??"var(--tmd-text, black)",f&&(s.style.background="var(--tmd-element,rgb(239, 239, 239))"),p&&(s.style.border="2px solid var(--tmd-accent, rgb(236, 236, 236))"),L(s,C.fontFamily),this.addElement(s,{x:l,y:i,width:n,height:t,anchor:d,place:c,fontSize:m,padding:r,modules:a,modulesMap:{base:s}}),s}createInput({value:e,placeholder:o,x:l,y:i,width:n,height:t,textArea:f=!1,fontSize:p="auto",anchor:m="top-left",padding:d,place:r=!0,onChange:c,onInput:a,isDisabled:s,modules:b}){const u=document.createElement(f?"textarea":"input");return u.classList.add("zcInput"),o&&(u.placeholder=o),e&&(u.value=e),L(u,C.fontFamily),typeof s=="function"&&s()&&u.classList.add("zcDisabled"),u.addEventListener("change",()=>{if(typeof s=="function"&&s())return u.classList.add("zcDisabled");typeof c=="function"&&c()}),u.addEventListener("input",()=>{if(typeof s=="function"&&s())return u.classList.add("zcDisabled");typeof a=="function"&&a()}),this.addElement(u,{x:l,y:i,width:n,height:t,anchor:m,place:r,fontSize:p,padding:d,modules:b,modulesMap:{base:u}}),u}createCheckbox({text:e,x:o,y:l,isChecked:i,width:n,modules:t,anchor:f="top-left",place:p=!0,isDisabled:m,onChange:d}){const r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.columnGap="1vw";const c=document.createElement("input");c.type="checkbox",c.checked=i,c.style.borderRadius="min(0.8dvh, 0.3dvw)",c.style.aspectRatio="1/1",c.classList.add("zcCheckbox","checkbox");const a=document.createElement("p");return a.textContent=e,a.style.color="var(--tmd-text, black)",L(a,C.fontFamily),typeof m=="function"&&m()&&r.classList.add("zcDisabled"),r.addEventListener("change",()=>{if(typeof m=="function"&&m())return r.classList.add("zcDisabled");typeof d=="function"&&d()}),r.append(c,a),this.addElement(r,{x:o,y:l,width:n,anchor:f,place:p,modules:t,modulesMap:{base:r,checkbox:c,label:a}}),r}createScrollView({scroll:e,x:o,y:l,width:i,height:n,anchor:t="top-left",modules:f,place:p=!0}){const m=document.createElement("div");return e==="all"&&(m.style.overflow="scroll"),e==="x"&&(m.style.overflowX="scroll"),e==="y"&&(m.style.overflowY="scroll"),this.addElement(m,{x:o,y:l,width:i,height:n,anchor:t,place:p,modules:f,modulesMap:{base:m}}),m}createInputList({x:e,y:o,width:l,height:i,title:n,value:t,modules:f,anchor:p="top-left",place:m=!0,numbersOnly:d=!1,isDisabled:r,onChange:c}){const a=[],s=document.createElement("div");s.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
|
-
`,
|
|
5
|
-
overflow-y: scroll;`;const v=document.createElement("input");v.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 y=(x,E)=>{const
|
|
4
|
+
`,L(s,C.fontFamily);const b=document.createElement("div");b.style.cssText="display: flex; justify-content: center; column-gap: 1vw; width: 100%;";const u=document.createElement("b");u.textContent=n+":",u.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 v=document.createElement("input");v.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 y=(x,E)=>{const A=this.createButton({icon:x,place:!1,onClick:E,style:"default",modules:{icon:[new H({width:"70%",height:"70%"})]}});A.style.width="2em",A.style.aspectRatio="1/1",b.append(A)},S=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,h.insertBefore(E,v),E.addEventListener("click",A=>{E.style.border===""?E.style.border="2px solid red":E.style.border="",A.stopPropagation()}),a.push(x)};return y(T(F),()=>{if(typeof r=="function"&&r())return s.classList.add("zcDisabled");h.innerHTML="",a.splice(0,a.length),h.append(v),t.forEach(x=>S(String(x))),typeof c=="function"&&c(d?a.map(x=>parseInt(x)):a)}),y(T(W),()=>{if(typeof r=="function"&&r())return s.classList.add("zcDisabled");for(const x of[...h.children])x.getAttribute("style").includes("border: 2px solid red;")&&(a.splice(a.indexOf(x.textContent),1),x.remove());typeof c=="function"&&c(d?a.map(x=>parseInt(x)):a)}),typeof r=="function"&&r()&&s.classList.add("zcDisabled"),v.addEventListener("keypress",x=>{if(document.activeElement===v)switch(x.key){case"Enter":if(d&&Number.isNaN(parseInt(v.value))||v.value.trim()==="")return;if(typeof r=="function"&&r())return s.classList.add("zcDisabled");S(v.value),v.value="",typeof c=="function"&&c(d?a.map(E=>parseInt(E)):a);break}}),s.addEventListener("click",x=>{x.currentTarget==s&&v.focus()}),h.append(v),s.append(b,u,h),this.addElement(s,{x:e,y:o,width:l,height:i,anchor:p,place:m,modules:f,modulesMap:{base:s,input:v}}),t.forEach(x=>S(String(x))),s}createImage({x:e,y:o,width:l,src:i,place:n=!0,anchor:t="top-left",modules:f}){const p=document.createElement("img");return p.style.height="auto",p.src=i,this.addElement(p,{x:e,y:o,width:l,height:0,anchor:t,place:n,modules:f,modulesMap:{base:p}}),p}createSvg({x:e,y:o,size:l,dataurl:i,place:n=!0,anchor:t="top-left",fill:f="var(--tmd-accent, black)",stroke:p="var(--tmd-accent-hover, black)",strokeWidth:m="2px",modules:d}){function r(s){const b=s.replace("data:image/svg+xml,",""),u=decodeURIComponent(b),h=document.createElement("div");return h.innerHTML=u,h.firstElementChild}function c(s,{fill:b,stroke:u}){return s.querySelectorAll("*").forEach(v=>{v.getAttribute("fill")!=="none"&&v.setAttribute("fill",b),v.getAttribute("stroke")!=="none"&&v.setAttribute("stroke",u)}),s.getAttribute("fill")!=="none"&&s.setAttribute("fill",b),s.getAttribute("stroke")!=="none"&&s.setAttribute("stroke",u),s}const a=r(i);return c(a,{fill:f,stroke:p}),a.setAttribute("stroke-width",m),this.addElement(a,{x:e,y:o,width:l,height:l,anchor:t,place:n,modules:d,modulesMap:{base:a}}),a}createBackNextButton({x:e,y:o,width:l,height:i,items:n,currentIndex:t,modules:f,isBold:p=!1,anchor:m="top-left",place:d=!0,onChange:r,isDisabled:c}){const a=document.createElement("div");a.classList.add("zcBackNextButton"),L(a,C.fontFamily);const s=()=>{t===0||typeof c=="function"&&c(n[t-1][1])?b.classList.add("zcBackNextButton-btnDisabled"):b.classList.remove("zcBackNextButton-btnDisabled"),t===n.length-1||typeof c=="function"&&c(n[t+1][1])?u.classList.add("zcBackNextButton-btnDisabled"):u.classList.remove("zcBackNextButton-btnDisabled")},b=document.createElement("button");b.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
|
-
`,
|
|
8
|
+
`,b.classList.add("zcButton"),b.addEventListener("click",()=>{if(t===0||typeof c=="function"&&c(n[t-1][1]))return b.classList.add("zcDisabled");t--,h.textContent=n[t][0],typeof r=="function"&&r(n[t][1]),s()});const u=document.createElement("button");u.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
|
-
`,u.classList.add("zcButton"),u.addEventListener("click",()=>{if(t===
|
|
11
|
+
`,u.classList.add("zcButton"),u.addEventListener("click",()=>{if(t===n.length-1||typeof c=="function"&&c(n[t+1][1]))return u.classList.add("zcDisabled");t++,h.textContent=n[t][0],typeof r=="function"&&r(n[t][1]),s()}),s();const h=document.createElement("p");return p&&(h.style.fontWeight="bold"),h.textContent=n[t][0],a.append(b,h,u),this.addElement(a,{x:e,y:o,width:l,height:i,anchor:m,place:d,modules:f,modulesMap:{base:a,backButton:b,nextButton:u,text:h}}),a}createTabs({x:e,y:o,width:l,tabs:i,anchor:n="top-left",place:t=!0,currentTabName:f,modules:p}){let m=[];const d=document.createElement("div");return d.classList.add("zcTabs"),L(d,C.fontFamily),i.forEach(r=>{const c=()=>{for(const b of d.children)b.removeAttribute("data-opened");for(const b of m)b instanceof Node&&document.body.removeChild(b);m=[],a.setAttribute("data-opened","true");const s=document.body.append.bind(document.body);document.body.append=(...b)=>{m.push(...b),s(...b)},this.tabHandlers.unload?.(),this.tabHandlers.exit?.(),r.load(),this.tabHandlers={run:r.run,load:r.load,unload:r.unload,exit:r.exit},document.body.append=s},a=document.createElement("button");a.textContent=r.name,r.name===f&&c(),a.addEventListener("click",c),d.append(a)}),this.addElement(d,{x:e,y:o,width:l,anchor:n,place:t,modules:p,modulesMap:{base:d}}),d}drawPolylineArrow({points:e,strokeColor:o=z()?.base?.text??"black",lineWidth:l=2,circleRadius:i=5,circleColor:n=z()?.base?.text??"black"}){if(e.length<2)return;const t=MainCanvas.canvas.getContext("2d");t.save(),t.strokeStyle=o,t.lineWidth=l,t.fillStyle=n,t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let f=1;f<e.length;f++)t.lineTo(e[f].x,e[f].y);t.stroke(),t.beginPath(),t.arc(e[0].x,e[0].y,i,0,Math.PI*2),t.fill(),t.beginPath(),t.arc(e[e.length-1].x,e[e.length-1].y,i,0,Math.PI*2),t.fill(),t.restore()}createCard({x:e,y:o,name:l,value:i,icon:n,anchor:t="top-left",place:f=!0,modules:p}){const m=document.createElement("div");m.classList.add("zcCard");const d=document.createElement("p");d.classList.add("zcCard_name"),d.textContent=l;const r=document.createElement("p");return r.classList.add("zcCard_value"),r.textContent=`${i}`,n&&(n.style.cssText+="position: absolute; top: 0.4em; right: 0.4em; width: 1.2em; height: 1.2em;",m.append(n)),m.append(d,r),this.addElement(m,{x:e,y:o,anchor:t,place:f,modules:p,modulesMap:{name:d,value:r,base:m,icon:null}}),m}createSelect({x:e,y:o,width:l,options:i,currentOption:n,anchor:t="top-left",place:f=!0,modules:p,onChange:m,isDisabled:d}){let r=!1,c;const a=document.createElement("div");a.classList.add("zcSelect"),a.setAttribute("opened",!1),a.addEventListener("click",()=>{if(d&&d())return a.classList.add("zcDisabled");r?(r=!1,c.remove()):(r=!0,c=document.createElement("div"),c.setAttribute("data-zc-position",typeof o=="number"&&o>500-a.offsetHeight/2?"top":"bottom"),i.forEach(h=>{const v=document.createElement("div");v.style.cssText="display: flex; align-items: center; column-gap: 0.5em;",h.icon&&(h.icon.style.cssText="color: #bcbcbc;",v.append(h.icon)),v.append(h.text),h.name===n&&v.append(u),v.addEventListener("click",()=>{n=h.name,s.textContent=h.text,c.remove(),m&&m(h.name)}),c.append(v)}),a.append(c))});const s=document.createElement("p");s.textContent=i.find(h=>h.name===n).text;const b=T(I),u=T(N);return u.style.cssText="position: absolute; right: 0.25em;",a.append(s,b),d&&d()&&a.classList.add("zcDisabled"),this.addElement(a,{x:e,y:o,width:l,anchor:t,place:f,modules:p,modulesMap:{base:a}}),a}createContainer({x:e,y:o,width:l,height:i,anchor:n="top-left",place:t=!0,modules:f}){const p=document.createElement("div");return this.addElement(p,{x:e,y:o,width:l,height:i,anchor:n,place:t,modules:f,modulesMap:{base:p}}),p}}const M={};function ne(g,e){M[g]||(M[g]=[]),M[g].push(e)}export{te as BaseSubscreen,Q as addDynamicClass,X as autosetFontSize,q as dataUrlSvgWithColor,ee as getCurrentSubscreen,D as getRelativeHeight,P as getRelativeWidth,R as getRelativeX,V as getRelativeY,ne as hookSubscreen,L as setFontFamily,j as setFontSize,G as setPadding,O as setPosition,U as setPreviousSubscreen,J as setSize,$ as setSubscreen};
|
package/dist/wardrobe.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{normalizeObject as l}from"./index";class m{seedsCache=new Map;getSeed(e){const r=l(ServerAppearanceBundle(e)),o=JSON.stringify(r);return this.seedsCache.has(o)||this.seedsCache.set(o,this.generateSeed(o)),this.seedsCache.get(o)}generateSeed(e){let r=0;for(let o=0;o<e.length;o++){const a=e.charCodeAt(o);r=(r<<5)-r+a,r=r&r}return r}compare(e,r){return this.getSeed(e)===this.getSeed(r)}getDifference(e,r){const o={added:[],modified:[],removed:[]};if(this.compare(e,r))return o;const a=ServerBuildAppearanceDiff("Female3DCG",e,ServerAppearanceBundle(r));for(const[i,s]of Object.entries(a)){if(s[0]===null&&s[1]!==null){o.added.push(s[1].Asset.Description);continue}if(s[0]!==null&&s[1]===null){o.removed.push(s[0].Asset.Description);continue}if(s[0].Asset.Name!==s[1].Asset.Name){o.removed.push(s[0].Asset.Description),o.added.push(s[1].Asset.Description);continue}this.compare([s[0]],[s[1]])||o.modified.push(s[0].Asset.Description)}return o}}const I=new m;function G(t){const e=Asset.includes(t)?t:t.Asset;if(!Asset.includes(e))throw new Error("Failed to convert item to asset");return e}function p(t){const e=AssetGroup.includes(t)?t:Asset.includes(t)?t.Group:t.Asset.Group;if(!AssetGroup.includes(e))throw new Error("Failed to convert item to group");return e}function y(t){return t?.Craft?.Name?t.Craft.Name:t?.Asset?.Description}function N(t){return AssetGroup.some(e=>e.Name===t)}function g(t,e=!1){const r=p(t);return r.Category==="Appearance"&&r.AllowNone&&r.Clothing&&(e||!r.BodyCosplay)}function f(t){const e=p(t);return e.Category==="Appearance"&&e.AllowNone&&e.Clothing&&e.BodyCosplay}function u(t){const e=p(t);return e.Category==="Appearance"&&!e.Clothing}function A(t,e=["ItemNeck","ItemNeckAccessories","ItemNeckRestraints"]){const r=p(t);return r.Category!=="Item"||r.BodyCosplay?!1:!e.includes(r.Name)}function h(t,e,r=["Cosplay","Binds","Collar","Locks"],o=t,a=!1){e=e.filter(s=>!!s&&!u(s)),r.includes("Cosplay")||(e=e.filter(s=>!f(s))),r.includes("Binds")||(e=e.filter(s=>!A(s))),r.includes("Collar")||(e=e.filter(s=>s.Asset.Group.Name!=="ItemNeck")),r.includes("Locks")||(e=e.map(s=>(s.Property?.LockedBy&&delete s.Property.LockedBy,s)));const i=[];if(a)t.Appearance=t.Appearance.filter(s=>u(s));else{const s=ValidationCreateDiffParams(o,Player.MemberNumber);t.Appearance=t.Appearance.filter(n=>u(n)||!ValidationCanRemoveItem(n,s,!!e.find(c=>c?.Asset?.Group?.Name===n?.Asset?.Group?.Name))||n.Property?.LockedBy&&!DialogCanUnlock(o,n)||n.Asset.Name==="SlaveCollar"&&o.IsPlayer()?(i.push(n.Asset.Group.Name),!0):!1)}for(const s of e){if(!a&&(!d(o,s.Asset.Group.Name,s.Asset)||i.includes(s.Asset.Group.Name)))continue;CharacterAppearanceSetItem(t,s.Asset.Group.Name,s.Asset,s.Color);const n=InventoryGet(t,s.Asset.Group.Name);s.Craft&&CraftingValidate(s.Craft,s.Asset)!==CraftingStatusType.CRITICAL_ERROR&&(n.Craft=s.Craft),s.Property&&(ValidationSanitizeProperties(t,s),n.Property=s.Property)}CharacterRefresh(t),t.IsNpc()||ChatRoomCharacterUpdate(t)}function d(t,e,r){return!ValidationIsItemBlockedOrLimited(t,Player.MemberNumber,e,r.Name)&&ServerChatRoomGetAllowItem(Player,t)}function v(t,e){return e.map(r=>ServerBundledItemToAppearanceItem(t,r))}function B(t){AssetGroup.forEach(e=>{if(e.Category!=="Appearance"||e.AllowNone||t.find(o=>o.Asset.Group.Name===e.Name))return;const r=AssetGet("Female3DCG",e.Name,e.Asset[0]?.Name);r&&t.push({Asset:r,Color:e.DefaultColor})})}export{B as addRequiredAppearanceItems,I as appearanceComparer,h as importAppearance,N as isAssetGroupName,A as isBind,u as isBody,g as isCloth,f as isCosplay,v as serverAppearanceBundleToAppearance,G as smartGetAsset,p as smartGetAssetGroup,y as smartGetItemName,d as validationCanAccessCheck};
|