zois-core 1.1.6 → 1.1.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/index.js +1 -1
- package/dist/modsApi.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/ui.d.ts +7 -5
- 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/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/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))}.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:
|
|
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;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}.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}
|
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/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;
|
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(b,e){return b.replace(/fill="[^"]*"/g,`fill="${e}"`).replace(/stroke="[^"]*"/g,`stroke="${e}"`)}function D(b){return b*(MainCanvas.canvas.clientHeight/1e3)}function P(b){return b*(MainCanvas.canvas.clientWidth/2e3)}function V(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 O(b,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),m=R(e,n);Object.assign(b.style,{position:"fixed",[n]:m+"px",[i]:t+"px"})}function J(b,e,o){Object.assign(b.style,{width:P(e)+"px",height:D(o)+"px"})}function j(b,e){const o=MainCanvas.canvas.clientWidth,l=MainCanvas.canvas.clientHeight,i=Math.min(o,l)/100,n=e*i;Object.assign(b.style,{fontSize:n+"px"})}function L(b,e){b.style.fontFamily=e??"sans-serif"}function G(b,e){const o=MainCanvas.canvas.clientWidth,l=MainCanvas.canvas.clientHeight,i=Math.min(o,l)/100,n=e*i;Object.assign(b.style,{padding:n+"px"})}function X(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"})}const B=[];function _(b){const e=o=>o?JSON.stringify(Object.keys(o).sort().reduce((l,i)=>(l[i]=o[i],l),{})):"null";return`base:${e(b.base)}|hover:${e(b.hover)}|active:${e(b.active)}|before:${e(b.before)}|after:${e(b.after)}`}function Q(b,e){const o=_(e),l=B.find(h=>h.key===o);if(l)return b.classList.add(l.className);let i;do i="dynamic-"+Math.random().toString(36).substring(2,10);while(B.find(h=>h.className===i));B.push({key:o,className:i});const n=(h,f)=>{let d=`${h} {`;for(const[r,c]of Object.entries(f))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 m=document.getElementById(`${C.key??""}-dynamic-classes`);m?m.textContent+=t:(m=document.createElement("style"),m.id=`${C.key??""}-dynamic-classes`,m.textContent=t,document.head.appendChild(m)),b.classList.add(i)}function U(){$(w)}function $(b){w=k,k=b,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:m="auto",anchor:h,place:f,modules:d={},modulesMap:r}){L(e,C.fontFamily);const c={anchor:h,x:o,y:l,width:i,height:n,padding:t,fontSize:m,place:f,element:e};Object.keys(d)?.forEach(s=>{d[s].forEach(p=>{const u=p.overrideProperties(c,r[s]);h=u.anchor,o=u.x,l=u.y,i=u.width,n=u.height,t=u.padding,m=u.fontSize,f=u.place,e=u.element})});const a=()=>{typeof o=="number"&&typeof l=="number"&&O(e,o,l,h),m==="auto"?X(e):j(e,m),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(p=>{p.layoutEffect(c,r[s])})}),f&&document.body.append(e),this.resizeEventListeners.push(a),this.htmlElements.push(e),Object.keys(d)?.forEach(s=>{d[s].forEach(p=>{p.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:m="top-left",padding:h,style:f="default",place:d=!0,icon:r,iconAbsolutePosition:c=!0,tooltip:a,onClick:s,isDisabled:p,modules:u}){let g,v;const y=document.createElement("button");if(y.classList.add("zcButton"),y.setAttribute("data-zc-style",f),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"?(g=document.createElement("img"),g.src=r):g=r,g.style.height="80%",g.style.width="auto",e&&c&&(g.style.position="absolute",g.style.left="1vw"),e&&!c&&(y.style.justifyContent=""),y.append(g)),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 p=="function"&&p()&&y.classList.add("zcDisabled"),y.addEventListener("click",()=>{if(typeof p=="function"&&p())return y.classList.add("zcDisabled");typeof s=="function"&&s()}),this.addElement(y,{x:o,y:l,width:i,height:n,anchor:m,place:d,fontSize:t,padding:h,modules:u,modulesMap:{base:y,text:v,icon:g}}),y}createText({text:e,color:o,x:l,y:i,width:n,height:t,withBackground:m=!1,withBorder:h=!1,fontSize:f="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)",m&&(s.style.background="var(--tmd-element,rgb(239, 239, 239))"),h&&(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:f,padding:r,modules:a,modulesMap:{base:s}}),s}createInput({value:e,placeholder:o,x:l,y:i,width:n,height:t,textArea:m=!1,fontSize:h="auto",anchor:f="top-left",padding:d,place:r=!0,onChange:c,onInput:a,isDisabled:s,modules:p}){const u=document.createElement(m?"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:f,place:r,fontSize:h,padding:d,modules:p,modulesMap:{base:u}}),u}createCheckbox({text:e,x:o,y:l,isChecked:i,width:n,modules:t,anchor:m="top-left",place:h=!0,isDisabled:f,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 f=="function"&&f()&&r.classList.add("zcDisabled"),r.addEventListener("change",()=>{if(typeof f=="function"&&f())return r.classList.add("zcDisabled");typeof d=="function"&&d()}),r.append(c,a),this.addElement(r,{x:o,y:l,width:n,anchor:m,place:h,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:m,place:h=!0}){const f=document.createElement("div");return e==="all"&&(f.style.overflow="scroll"),e==="x"&&(f.style.overflowX="scroll"),e==="y"&&(f.style.overflowY="scroll"),this.addElement(f,{x:o,y:l,width:i,height:n,anchor:t,place:h,modules:m,modulesMap:{base:f}}),f}createInputList({x:e,y:o,width:l,height:i,title:n,value:t,modules:m,anchor:h="top-left",place:f=!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 p=document.createElement("div");p.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 g=document.createElement("div");g.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",p.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,g.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");g.innerHTML="",a.splice(0,a.length),g.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[...g.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()}),g.append(v),s.append(p,u,g),this.addElement(s,{x:e,y:o,width:l,height:i,anchor:h,place:f,modules:m,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:m}){const h=document.createElement("img");return h.style.height="auto",h.src=i,this.addElement(h,{x:e,y:o,width:l,height:0,anchor:t,place:n,modules:m,modulesMap:{base:h}}),h}createSvg({x:e,y:o,size:l,dataurl:i,place:n=!0,anchor:t="top-left",fill:m="var(--tmd-accent, black)",stroke:h="var(--tmd-accent-hover, black)",strokeWidth:f="2px",modules:d}){function r(s){const p=s.replace("data:image/svg+xml,",""),u=decodeURIComponent(p),g=document.createElement("div");return g.innerHTML=u,g.firstElementChild}function c(s,{fill:p,stroke:u}){return s.querySelectorAll("*").forEach(v=>{v.getAttribute("fill")!=="none"&&v.setAttribute("fill",p),v.getAttribute("stroke")!=="none"&&v.setAttribute("stroke",u)}),s.getAttribute("fill")!=="none"&&s.setAttribute("fill",p),s.getAttribute("stroke")!=="none"&&s.setAttribute("stroke",u),s}const a=r(i);return c(a,{fill:m,stroke:h}),a.setAttribute("stroke-width",f),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:m,isBold:h=!1,anchor:f="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])?p.classList.add("zcBackNextButton-btnDisabled"):p.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")},p=document.createElement("button");p.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
|
-
`,p.classList.add("zcButton"),p.addEventListener("click",()=>{if(t===0||typeof c=="function"&&c(
|
|
8
|
+
`,p.classList.add("zcButton"),p.addEventListener("click",()=>{if(t===0||typeof c=="function"&&c(n[t-1][1]))return p.classList.add("zcDisabled");t--,g.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++,g.textContent=n[t][0],typeof r=="function"&&r(n[t][1]),s()}),s();const g=document.createElement("p");return h&&(g.style.fontWeight="bold"),g.textContent=n[t][0],a.append(p,g,u),this.addElement(a,{x:e,y:o,width:l,height:i,anchor:f,place:d,modules:m,modulesMap:{base:a,backButton:p,nextButton:u,text:g}}),a}createTabs({x:e,y:o,width:l,tabs:i,anchor:n="top-left",place:t=!0,currentTabName:m,modules:h}){let f=[];const d=document.createElement("div");return d.classList.add("zcTabs"),L(d,C.fontFamily),i.forEach(r=>{const c=()=>{for(const p of d.children)p.removeAttribute("data-opened");for(const p of f)p instanceof Node&&document.body.removeChild(p);f=[],a.setAttribute("data-opened","true");const s=document.body.append.bind(document.body);document.body.append=(...p)=>{f.push(...p),s(...p)},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===m&&c(),a.addEventListener("click",c),d.append(a)}),this.addElement(d,{x:e,y:o,width:l,anchor:n,place:t,modules:h,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 m=1;m<e.length;m++)t.lineTo(e[m].x,e[m].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:m=!0,modules:h}){const f=document.createElement("div");f.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;",f.append(n)),f.append(d,r),this.addElement(f,{x:e,y:o,anchor:t,place:m,modules:h,modulesMap:{name:d,value:r,base:f,icon:null}}),f}createSelect({x:e,y:o,width:l,options:i,currentOption:n,anchor:t="top-left",place:m=!0,modules:h,onChange:f,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(g=>{const v=document.createElement("div");v.style.cssText="display: flex; align-items: center; column-gap: 0.5em;",g.icon&&(g.icon.style.cssText="color: #bcbcbc;",v.append(g.icon)),v.append(g.text),g.name===n&&v.append(u),v.addEventListener("click",()=>{n=g.name,s.textContent=g.text,c.remove(),f&&f(g.name)}),c.append(v)}),a.append(c))});const s=document.createElement("p");s.textContent=i.find(g=>g.name===n).text;const p=T(I),u=T(N);return u.style.cssText="position: absolute; right: 0.25em;",a.append(s,p),d&&d()&&a.classList.add("zcDisabled"),this.addElement(a,{x:e,y:o,width:l,anchor:t,place:m,modules:h,modulesMap:{base:a}}),a}createContainer({x:e,y:o,anchor:l="top-left",place:i=!0,modules:n}){const t=document.createElement("div");return this.addElement(t,{x:e,y:o,anchor:l,place:i,modules:n,modulesMap:{base:t}}),t}}const M={};function ne(b,e){M[b]||(M[b]=[]),M[b].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};
|