zois-core 1.0.13 → 1.0.14

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.
@@ -10,3 +10,4 @@ export type IncludeType = "Cosplay" | "Binds" | "Collar" | "Locks";
10
10
  export declare function importAppearance(C: Character, bundleToAttach: Item[], include?: IncludeType[], characterValidate?: Character, ignoreAccessValidation?: boolean): void;
11
11
  export declare function validationCanAccessCheck(C: Character, group: AssetGroupName, asset: Asset): boolean;
12
12
  export declare function serverAppearanceBundleToAppearance(assetFamily: IAssetFamily, serverAppearanceBundle: AppearanceBundle): Item[];
13
+ export declare function addRequiredAppearanceItems(appearanceBundle: Item[]): void;
package/dist/ui.js CHANGED
@@ -1,11 +1,11 @@
1
- import{getThemedColorsModule as N,MOD_DATA as w}from"./index";function D(b){return b*(MainCanvas.canvas.clientHeight/1e3)}function F(b){return b*(MainCanvas.canvas.clientWidth/2e3)}function j(b,e="top"){const o=MainCanvas.canvas.clientHeight/1e3;return e==="top"?MainCanvas.canvas.offsetTop+b*o:window.innerHeight-(MainCanvas.canvas.offsetTop+MainCanvas.canvas.clientHeight)+b*o}function R(b,e="left"){const o=MainCanvas.canvas.clientWidth/2e3;return e==="left"?MainCanvas.canvas.offsetLeft+b*o:window.innerWidth-(MainCanvas.canvas.offsetLeft+MainCanvas.canvas.clientWidth)+b*o}function E(b,e,o,u="top-left"){const m=u==="top-left"||u==="top-right"?"top":"bottom",a=u==="top-left"||u==="bottom-left"?"left":"right",n=j(o,m),r=R(e,a);Object.assign(b.style,{position:"fixed",[a]:r+"px",[m]:n+"px"})}function L(b,e,o){Object.assign(b.style,{width:F(e)+"px",height:D(o)+"px"})}function H(b,e){const o=MainCanvas.canvas.clientWidth,u=MainCanvas.canvas.clientHeight,m=Math.min(o,u)/100,a=e*m;Object.assign(b.style,{fontSize:a+"px"})}function z(b,e){b.style.fontFamily=e??"sans-serif"}function P(b,e){const o=MainCanvas.canvas.clientWidth,u=MainCanvas.canvas.clientHeight,m=Math.min(o,u)/100,a=e*m;Object.assign(b.style,{padding:a+"px"})}function A(b){const e=MainCanvas.canvas.clientWidth<=MainCanvas.canvas.clientHeight*2?MainCanvas.canvas.clientWidth/50:MainCanvas.canvas.clientHeight/25;Object.assign(b.style,{fontSize:e+"px"})}function O(){W(M)}function W(b){M=T,T=b,T&&T.load(),M&&M.unload()}function G(){return T}let T,M=null;class X{htmlElements=[];resizeEventListeners=[];tabHandlers={};get currentSubscreen(){return T}get previousSubscreen(){return M}get name(){return""}run(){this.tabHandlers.run?.()}load(){this.createButton({x:1815,y:75,width:90,height:90,icon:"Icons/Exit.png"}).addEventListener("click",()=>this.exit()),this.name&&(this.createText({text:this.name,x:100,y:60,fontSize:10}).style.cssText+="max-width: 85%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"),B[this.name]&&B[this.name].forEach(e=>e(this))}unload(){this.tabHandlers.unload?.(),this.htmlElements.forEach(e=>{e.remove()}),this.resizeEventListeners.forEach(e=>{removeEventListener("resize",e)})}click(){}exit(){this.tabHandlers.exit?.(),this.setSubscreen(this.previousSubscreen)}update(){}setPreviousSubscreen(){O()}setSubscreen(e){W(e)}createButton({text:e,x:o,y:u,width:m,height:a,fontSize:n="auto",anchor:r="top-left",padding:l,style:y="default",place:s=!0,icon:f,iconAbsolutePosition:t=!0,iconWidth:c,tooltip:p,onClick:d,isDisabled:h}){const i=document.createElement("button");if(i.classList.add("zcButton"),i.setAttribute("data-zc-style",y),i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.columnGap="1.25vw",z(i,w.fontFamily),f){const v=document.createElement("img");v.src=f,c?v.style.width=c:v.style.height="80%",e&&t&&(v.style.position="absolute",v.style.left="1vw"),e&&!t&&(i.style.justifyContent=""),i.append(v)}if(e){const v=document.createElement("span");v.textContent=e,f&&!t&&c&&(v.style.width="100%",v.style.marginRight=c),i.append(v)}if(p){const v=document.createElement("span");v.classList.add("tooltip"),v.setAttribute("position",p.position),v.textContent=p.text,i.append(v)}const C=()=>{typeof o=="number"&&typeof u=="number"&&E(i,o,u,r),L(i,m,a),l&&P(i,l),n==="auto"?A(i):H(i,n)};return C(),typeof h=="function"&&h()&&i.classList.add("zcDisabled"),i.addEventListener("click",()=>{if(typeof h=="function"&&h())return i.classList.add("zcDisabled");typeof d=="function"&&d()}),window.addEventListener("resize",C),s&&document.body.append(i),this.resizeEventListeners.push(C),this.htmlElements.push(i),i}createText({text:e,color:o,x:u,y:m,width:a,height:n,withBackground:r=!1,fontSize:l="auto",anchor:y="top-left",padding:s,place:f=!0}){const t=document.createElement("p");t.innerHTML=e,t.style.color=o??"var(--tmd-text, black)",r&&(t.style.background="var(--tmd-element,rgb(239, 239, 239))"),z(t,w.fontFamily);const c=()=>{typeof u=="number"&&typeof m=="number"&&E(t,u,m,y),L(t,a,n),s&&P(t,s),l==="auto"?A(t):H(t,l)};return c(),window.addEventListener("resize",c),f&&document.body.append(t),this.resizeEventListeners.push(c),this.htmlElements.push(t),t}createInput({value:e,placeholder:o,x:u,y:m,width:a,height:n,textArea:r=!1,fontSize:l="auto",anchor:y="top-left",padding:s,place:f=!0,onChange:t,onInput:c,isDisabled:p}){const d=document.createElement(r?"textarea":"input");d.classList.add("zcInput"),o&&(d.placeholder=o),e&&(d.value=e),z(d,w.fontFamily);const h=()=>{typeof u=="number"&&typeof m=="number"&&E(d,u,m,y),L(d,a,n),s&&P(d,s),l==="auto"?A(d):H(d,l)};return h(),typeof p=="function"&&p()&&d.classList.add("zcDisabled"),d.addEventListener("change",()=>{if(typeof p=="function"&&p())return d.classList.add("zcDisabled");typeof t=="function"&&t()}),d.addEventListener("input",()=>{if(typeof p=="function"&&p())return d.classList.add("zcDisabled");typeof c=="function"&&c()}),window.addEventListener("resize",h),f&&document.body.append(d),this.resizeEventListeners.push(h),this.htmlElements.push(d),d}createCheckbox({text:e,x:o,y:u,isChecked:m,width:a,anchor:n="top-left",place:r=!0,isDisabled:l,onChange:y}){const s=document.createElement("div");s.style.display="flex",s.style.alignItems="center",s.style.columnGap="1vw";const f=document.createElement("input");f.type="checkbox",f.checked=m,f.style.borderRadius="min(0.8dvh, 0.3dvw)",f.classList.add("zcCheckbox","checkbox");const t=document.createElement("p");t.textContent=e,t.style.color="var(--tmd-text, black)",z(t,w.fontFamily);const c=()=>{typeof o=="number"&&typeof u=="number"&&E(s,o,u,n),a&&(s.style.width=F(a)+"px"),H(t,5)};return c(),typeof l=="function"&&l()&&s.classList.add("zcDisabled"),s.addEventListener("change",()=>{if(typeof l=="function"&&l())return s.classList.add("zcDisabled");typeof y=="function"&&y()}),window.addEventListener("resize",c),s.append(f,t),r&&document.body.append(s),this.resizeEventListeners.push(c),this.htmlElements.push(s,t),s}createScrollView({scroll:e,x:o,y:u,width:m,height:a,anchor:n="top-left"}){const r=document.createElement("div");e==="all"&&(r.style.overflow="scroll"),e==="x"&&(r.style.overflowX="scroll"),e==="y"&&(r.style.overflowY="scroll");const l=()=>{typeof o=="number"&&typeof u=="number"&&E(r,o,u,n),L(r,m,a)};return l(),window.addEventListener("resize",l),document.body.append(r),this.resizeEventListeners.push(l),this.htmlElements.push(r),r}createInputList({x:e,y:o,width:u,height:m,title:a,value:n,anchor:r="top-left",place:l=!0,numbersOnly:y=!1,isDisabled:s,onChange:f}){const t=[],c=document.createElement("div");c.style.cssText=`
1
+ import{getThemedColorsModule as N,MOD_DATA as w}from"./index";function D(b){return b*(MainCanvas.canvas.clientHeight/1e3)}function F(b){return b*(MainCanvas.canvas.clientWidth/2e3)}function j(b,e="top"){const o=MainCanvas.canvas.clientHeight/1e3;return e==="top"?MainCanvas.canvas.offsetTop+b*o:window.innerHeight-(MainCanvas.canvas.offsetTop+MainCanvas.canvas.clientHeight)+b*o}function R(b,e="left"){const o=MainCanvas.canvas.clientWidth/2e3;return e==="left"?MainCanvas.canvas.offsetLeft+b*o:window.innerWidth-(MainCanvas.canvas.offsetLeft+MainCanvas.canvas.clientWidth)+b*o}function E(b,e,o,u="top-left"){const m=u==="top-left"||u==="top-right"?"top":"bottom",a=u==="top-left"||u==="bottom-left"?"left":"right",n=j(o,m),r=R(e,a);Object.assign(b.style,{position:"fixed",[a]:r+"px",[m]:n+"px"})}function L(b,e,o){Object.assign(b.style,{width:F(e)+"px",height:D(o)+"px"})}function H(b,e){const o=MainCanvas.canvas.clientWidth,u=MainCanvas.canvas.clientHeight,m=Math.min(o,u)/100,a=e*m;Object.assign(b.style,{fontSize:a+"px"})}function z(b,e){b.style.fontFamily=e??"sans-serif"}function P(b,e){const o=MainCanvas.canvas.clientWidth,u=MainCanvas.canvas.clientHeight,m=Math.min(o,u)/100,a=e*m;Object.assign(b.style,{padding:a+"px"})}function A(b){const e=MainCanvas.canvas.clientWidth<=MainCanvas.canvas.clientHeight*2?MainCanvas.canvas.clientWidth/50:MainCanvas.canvas.clientHeight/25;Object.assign(b.style,{fontSize:e+"px"})}function O(){W(M)}function W(b){M=T,T=b,T&&T.load(),M&&M.unload()}function G(){return T}let T,M=null;class X{htmlElements=[];resizeEventListeners=[];tabHandlers={};get currentSubscreen(){return T}get previousSubscreen(){return M}get name(){return""}run(){this.tabHandlers.run?.()}load(){this.createButton({x:1815,y:75,width:90,height:90,icon:"Icons/Exit.png"}).addEventListener("click",()=>this.exit()),this.name&&(this.createText({text:this.name,x:100,y:60,fontSize:10}).style.cssText+="max-width: 85%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.1em;"),B[this.constructor.name]&&B[this.name].forEach(e=>e(this))}unload(){this.tabHandlers.unload?.(),this.htmlElements.forEach(e=>{e.remove()}),this.resizeEventListeners.forEach(e=>{removeEventListener("resize",e)})}click(){}exit(){this.tabHandlers.exit?.(),this.setSubscreen(this.previousSubscreen)}update(){}setPreviousSubscreen(){O()}setSubscreen(e){W(e)}createButton({text:e,x:o,y:u,width:m,height:a,fontSize:n="auto",anchor:r="top-left",padding:l,style:y="default",place:s=!0,icon:d,iconAbsolutePosition:t=!0,iconWidth:c,tooltip:f,onClick:p,isDisabled:h}){const i=document.createElement("button");if(i.classList.add("zcButton"),i.setAttribute("data-zc-style",y),i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.columnGap="1.25vw",z(i,w.fontFamily),d){const v=document.createElement("img");v.src=d,c?v.style.width=c:v.style.height="80%",e&&t&&(v.style.position="absolute",v.style.left="1vw"),e&&!t&&(i.style.justifyContent=""),i.append(v)}if(e){const v=document.createElement("span");v.textContent=e,d&&!t&&c&&(v.style.width="100%",v.style.marginRight=c),i.append(v)}if(f){const v=document.createElement("span");v.classList.add("tooltip"),v.setAttribute("position",f.position),v.textContent=f.text,i.append(v)}const C=()=>{typeof o=="number"&&typeof u=="number"&&E(i,o,u,r),L(i,m,a),l&&P(i,l),n==="auto"?A(i):H(i,n)};return C(),typeof h=="function"&&h()&&i.classList.add("zcDisabled"),i.addEventListener("click",()=>{if(typeof h=="function"&&h())return i.classList.add("zcDisabled");typeof p=="function"&&p()}),window.addEventListener("resize",C),s&&document.body.append(i),this.resizeEventListeners.push(C),this.htmlElements.push(i),i}createText({text:e,color:o,x:u,y:m,width:a,height:n,withBackground:r=!1,fontSize:l="auto",anchor:y="top-left",padding:s,place:d=!0}){const t=document.createElement("p");t.innerHTML=e,t.style.color=o??"var(--tmd-text, black)",r&&(t.style.background="var(--tmd-element,rgb(239, 239, 239))"),z(t,w.fontFamily);const c=()=>{typeof u=="number"&&typeof m=="number"&&E(t,u,m,y),L(t,a,n),s&&P(t,s),l==="auto"?A(t):H(t,l)};return c(),window.addEventListener("resize",c),d&&document.body.append(t),this.resizeEventListeners.push(c),this.htmlElements.push(t),t}createInput({value:e,placeholder:o,x:u,y:m,width:a,height:n,textArea:r=!1,fontSize:l="auto",anchor:y="top-left",padding:s,place:d=!0,onChange:t,onInput:c,isDisabled:f}){const p=document.createElement(r?"textarea":"input");p.classList.add("zcInput"),o&&(p.placeholder=o),e&&(p.value=e),z(p,w.fontFamily);const h=()=>{typeof u=="number"&&typeof m=="number"&&E(p,u,m,y),L(p,a,n),s&&P(p,s),l==="auto"?A(p):H(p,l)};return h(),typeof f=="function"&&f()&&p.classList.add("zcDisabled"),p.addEventListener("change",()=>{if(typeof f=="function"&&f())return p.classList.add("zcDisabled");typeof t=="function"&&t()}),p.addEventListener("input",()=>{if(typeof f=="function"&&f())return p.classList.add("zcDisabled");typeof c=="function"&&c()}),window.addEventListener("resize",h),d&&document.body.append(p),this.resizeEventListeners.push(h),this.htmlElements.push(p),p}createCheckbox({text:e,x:o,y:u,isChecked:m,width:a,anchor:n="top-left",place:r=!0,isDisabled:l,onChange:y}){const s=document.createElement("div");s.style.display="flex",s.style.alignItems="center",s.style.columnGap="1vw";const d=document.createElement("input");d.type="checkbox",d.checked=m,d.style.borderRadius="min(0.8dvh, 0.3dvw)",d.style.aspectRatio="1/1",d.classList.add("zcCheckbox","checkbox");const t=document.createElement("p");t.textContent=e,t.style.color="var(--tmd-text, black)",z(t,w.fontFamily);const c=()=>{typeof o=="number"&&typeof u=="number"&&E(s,o,u,n),a&&(s.style.width=F(a)+"px"),H(t,5)};return c(),typeof l=="function"&&l()&&s.classList.add("zcDisabled"),s.addEventListener("change",()=>{if(typeof l=="function"&&l())return s.classList.add("zcDisabled");typeof y=="function"&&y()}),window.addEventListener("resize",c),s.append(d,t),r&&document.body.append(s),this.resizeEventListeners.push(c),this.htmlElements.push(s,t),s}createScrollView({scroll:e,x:o,y:u,width:m,height:a,anchor:n="top-left"}){const r=document.createElement("div");e==="all"&&(r.style.overflow="scroll"),e==="x"&&(r.style.overflowX="scroll"),e==="y"&&(r.style.overflowY="scroll");const l=()=>{typeof o=="number"&&typeof u=="number"&&E(r,o,u,n),L(r,m,a)};return l(),window.addEventListener("resize",l),document.body.append(r),this.resizeEventListeners.push(l),this.htmlElements.push(r),r}createInputList({x:e,y:o,width:u,height:m,title:a,value:n,anchor:r="top-left",place:l=!0,numbersOnly:y=!1,isDisabled:s,onChange:d}){const t=[],c=document.createElement("div");c.style.cssText=`
2
2
  display: flex; flex-direction: column; gap: 1vw; border: 2px solid var(--tmd-accent, black);
3
3
  border-radius: 4px; padding: 0.75vw; background: var(--tmd-element, none);
4
- `,z(c,w.fontFamily);const p=document.createElement("div");p.style.cssText="display: flex; justify-content: center; column-gap: 1vw; width: 100%;";const d=document.createElement("b");d.textContent=a+":",d.style.cssText="width: 100%; font-size: clamp(10px, 2.4vw, 24px); color: var(--tmd-text, black);";const h=document.createElement("div");h.style.cssText=`display: flex; gap: 1vw; flex-wrap: wrap; align-content: flex-start;
5
- overflow-y: scroll;`;const i=document.createElement("input");i.style.cssText="border: none; outline: none; background: none; height: fit-content; flex-grow: 1; padding: 0.8vw; width: 6vw; font-size: clamp(8px, 2vw, 20px);";const C=(g,x)=>{const k=document.createElement("button");k.style.cssText="cursor: pointer; display: grid; place-items: center; background: var(--tmd-element-hover, #e0e0e0); width: 10%; max-width: 40px; aspect-ratio: 1/1; border-radius: 8px; border: none;";const I=DrawGetImage(g);I.style.cssText="width: 90%;",k.append(I),p.append(k),k.addEventListener("click",x)},v=g=>{const x=document.createElement("div");x.style.cssText="cursor: pointer; background: var(--tmd-element-hover, rgb(206, 206, 206)); color: var(--tmd-text, black); height: fit-content; padding: 0.8vw; border-radius: 0.8vw; font-size: clamp(8px, 2vw, 20px);",x.textContent=g,h.insertBefore(x,i),x.addEventListener("click",k=>{x.style.border===""?x.style.border="2px solid red":x.style.border="",k.stopPropagation()}),t.push(g)},S=()=>{typeof e=="number"&&typeof o=="number"&&E(c,e,o,r),L(c,u,m)};return C("Icons/Cancel.png",()=>{if(typeof s=="function"&&s())return c.classList.add("zcDisabled");h.innerHTML="",t.splice(0,t.length),h.append(i),n.forEach(g=>v(String(g))),typeof f=="function"&&f(y?t.map(g=>parseInt(g)):t)}),C("Icons/Trash.png",()=>{if(typeof s=="function"&&s())return c.classList.add("zcDisabled");for(const g of[...h.children])g.getAttribute("style").includes("border: 2px solid red;")&&(t.splice(t.indexOf(g.textContent),1),g.remove());typeof f=="function"&&f(y?t.map(g=>parseInt(g)):t)}),S(),typeof s=="function"&&s()&&c.classList.add("zcDisabled"),window.addEventListener("resize",S),i.addEventListener("keypress",g=>{if(document.activeElement===i)switch(g.key){case"Enter":if(y&&Number.isNaN(parseInt(i.value))||i.value.trim()==="")return;if(typeof s=="function"&&s())return c.classList.add("zcDisabled");v(i.value),i.value="",typeof f=="function"&&f(y?t.map(x=>parseInt(x)):t);break}}),c.addEventListener("click",g=>{g.currentTarget==c&&i.focus()}),h.append(i),c.append(p,d,h),l&&document.body.append(c),this.resizeEventListeners.push(S),this.htmlElements.push(c),n.forEach(g=>v(String(g))),c}createImage({x:e,y:o,width:u,src:m,place:a=!0,anchor:n="top-left"}){const r=document.createElement("img");r.src=m;const l=()=>{typeof e=="number"&&typeof o=="number"&&E(r,e,o,n),L(r,u,0),r.style.height="auto"};return l(),window.addEventListener("resize",l),a&&document.body.append(r),this.resizeEventListeners.push(l),this.htmlElements.push(r),r}createBackNextButton({x:e,y:o,width:u,height:m,items:a,currentIndex:n,isBold:r=!1,anchor:l="top-left",place:y=!0,onChange:s,isDisabled:f}){const t=document.createElement("div");t.classList.add("zcBackNextButton"),z(t,w.fontFamily);const c=()=>{n===0||typeof f=="function"&&f(a[n-1][1])?p.classList.add("zcBackNextButton-btnDisabled"):p.classList.remove("zcBackNextButton-btnDisabled"),n===a.length-1||typeof f=="function"&&f(a[n+1][1])?d.classList.add("zcBackNextButton-btnDisabled"):d.classList.remove("zcBackNextButton-btnDisabled")},p=document.createElement("button");p.style.cssText=`
4
+ `,z(c,w.fontFamily);const f=document.createElement("div");f.style.cssText="display: flex; justify-content: center; column-gap: 1vw; width: 100%;";const p=document.createElement("b");p.textContent=a+":",p.style.cssText="width: 100%; font-size: clamp(10px, 2.4vw, 24px); color: var(--tmd-text, black);";const h=document.createElement("div");h.style.cssText=`display: flex; gap: 1vw; flex-wrap: wrap; align-content: flex-start;
5
+ overflow-y: scroll;`;const i=document.createElement("input");i.style.cssText="border: none; outline: none; background: none; height: fit-content; flex-grow: 1; padding: 0.8vw; width: 6vw; font-size: clamp(8px, 2vw, 20px);";const C=(g,x)=>{const k=document.createElement("button");k.style.cssText="cursor: pointer; display: grid; place-items: center; background: var(--tmd-element-hover, #e0e0e0); width: 10%; max-width: 40px; aspect-ratio: 1/1; border-radius: 8px; border: none;";const I=DrawGetImage(g);I.style.cssText="width: 90%;",k.append(I),f.append(k),k.addEventListener("click",x)},v=g=>{const x=document.createElement("div");x.style.cssText="cursor: pointer; background: var(--tmd-element-hover, rgb(206, 206, 206)); color: var(--tmd-text, black); height: fit-content; padding: 0.8vw; border-radius: 0.8vw; font-size: clamp(8px, 2vw, 20px);",x.textContent=g,h.insertBefore(x,i),x.addEventListener("click",k=>{x.style.border===""?x.style.border="2px solid red":x.style.border="",k.stopPropagation()}),t.push(g)},S=()=>{typeof e=="number"&&typeof o=="number"&&E(c,e,o,r),L(c,u,m)};return C("Icons/Cancel.png",()=>{if(typeof s=="function"&&s())return c.classList.add("zcDisabled");h.innerHTML="",t.splice(0,t.length),h.append(i),n.forEach(g=>v(String(g))),typeof d=="function"&&d(y?t.map(g=>parseInt(g)):t)}),C("Icons/Trash.png",()=>{if(typeof s=="function"&&s())return c.classList.add("zcDisabled");for(const g of[...h.children])g.getAttribute("style").includes("border: 2px solid red;")&&(t.splice(t.indexOf(g.textContent),1),g.remove());typeof d=="function"&&d(y?t.map(g=>parseInt(g)):t)}),S(),typeof s=="function"&&s()&&c.classList.add("zcDisabled"),window.addEventListener("resize",S),i.addEventListener("keypress",g=>{if(document.activeElement===i)switch(g.key){case"Enter":if(y&&Number.isNaN(parseInt(i.value))||i.value.trim()==="")return;if(typeof s=="function"&&s())return c.classList.add("zcDisabled");v(i.value),i.value="",typeof d=="function"&&d(y?t.map(x=>parseInt(x)):t);break}}),c.addEventListener("click",g=>{g.currentTarget==c&&i.focus()}),h.append(i),c.append(f,p,h),l&&document.body.append(c),this.resizeEventListeners.push(S),this.htmlElements.push(c),n.forEach(g=>v(String(g))),c}createImage({x:e,y:o,width:u,src:m,place:a=!0,anchor:n="top-left"}){const r=document.createElement("img");r.src=m;const l=()=>{typeof e=="number"&&typeof o=="number"&&E(r,e,o,n),L(r,u,0),r.style.height="auto"};return l(),window.addEventListener("resize",l),a&&document.body.append(r),this.resizeEventListeners.push(l),this.htmlElements.push(r),r}createBackNextButton({x:e,y:o,width:u,height:m,items:a,currentIndex:n,isBold:r=!1,anchor:l="top-left",place:y=!0,onChange:s,isDisabled:d}){const t=document.createElement("div");t.classList.add("zcBackNextButton"),z(t,w.fontFamily);const c=()=>{n===0||typeof d=="function"&&d(a[n-1][1])?f.classList.add("zcBackNextButton-btnDisabled"):f.classList.remove("zcBackNextButton-btnDisabled"),n===a.length-1||typeof d=="function"&&d(a[n+1][1])?p.classList.add("zcBackNextButton-btnDisabled"):p.classList.remove("zcBackNextButton-btnDisabled")},f=document.createElement("button");f.style.cssText=`
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(n===0||typeof f=="function"&&f(a[n-1][1]))return p.classList.add("zcDisabled");n--,h.textContent=a[n][0],typeof s=="function"&&s(a[n][1]),c()});const d=document.createElement("button");d.style.cssText=`
8
+ `,f.classList.add("zcButton"),f.addEventListener("click",()=>{if(n===0||typeof d=="function"&&d(a[n-1][1]))return f.classList.add("zcDisabled");n--,h.textContent=a[n][0],typeof s=="function"&&s(a[n][1]),c()});const p=document.createElement("button");p.style.cssText=`
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
- `,d.classList.add("zcButton"),d.addEventListener("click",()=>{if(n===a.length-1||typeof f=="function"&&f(a[n+1][1]))return d.classList.add("zcDisabled");n++,h.textContent=a[n][0],typeof s=="function"&&s(a[n][1]),c()}),c();const h=document.createElement("p");r&&(h.style.fontWeight="bold"),h.textContent=a[n][0],t.append(p,h,d);const i=()=>{typeof e=="number"&&typeof o=="number"&&E(t,e,o,l),L(t,u,m),A(h)};return i(),window.addEventListener("resize",i),y&&document.body.append(t),this.resizeEventListeners.push(i),this.htmlElements.push(t),t}createTabs({x:e,y:o,width:u,tabs:m,anchor:a="top-left",currentTabName:n}){let r=[];const l=document.createElement("div");l.classList.add("zcTabs"),z(l,w.fontFamily),m.forEach(s=>{const f=()=>{for(const p of l.children)p.removeAttribute("data-opened");for(const p of r)p instanceof Node&&document.body.removeChild(p);r=[],t.setAttribute("data-opened","true");const c=document.body.append.bind(document.body);document.body.append=(...p)=>{r.push(...p),c(...p)},this.tabHandlers.unload?.(),this.tabHandlers.exit?.(),s.load(),this.tabHandlers={run:s.run,load:s.load,unload:s.unload,exit:s.exit},document.body.append=c},t=document.createElement("button");t.textContent=s.name,s.name===n&&f(),t.addEventListener("click",f),l.append(t)});const y=()=>{typeof e=="number"&&typeof o=="number"&&E(l,e,o,a),u&&(l.style.width=F(u)+"px"),A(l)};return y(),window.addEventListener("resize",y),document.body.append(l),this.resizeEventListeners.push(y),this.htmlElements.push(l),l}drawPolylineArrow({points:e,strokeColor:o=N()?.base?.text??"black",lineWidth:u=2,circleRadius:m=5,circleColor:a=N()?.base?.text??"black"}){if(e.length<2)return;const n=MainCanvas.canvas.getContext("2d");n.save(),n.strokeStyle=o,n.lineWidth=u,n.fillStyle=a,n.beginPath(),n.moveTo(e[0].x,e[0].y);for(let r=1;r<e.length;r++)n.lineTo(e[r].x,e[r].y);n.stroke(),n.beginPath(),n.arc(e[0].x,e[0].y,m,0,Math.PI*2),n.fill(),n.beginPath(),n.arc(e[e.length-1].x,e[e.length-1].y,m,0,Math.PI*2),n.fill(),n.restore()}}const B={};function Y(b,e){B[b]||(B[b]=[]),B[b].push(e)}export{X as BaseSubscreen,A as autosetFontSize,G as getCurrentSubscreen,D as getRelativeHeight,F as getRelativeWidth,R as getRelativeX,j as getRelativeY,Y as hookSubscreen,z as setFontFamily,H as setFontSize,P as setPadding,E as setPosition,O as setPreviousSubscreen,L as setSize,W as setSubscreen};
11
+ `,p.classList.add("zcButton"),p.addEventListener("click",()=>{if(n===a.length-1||typeof d=="function"&&d(a[n+1][1]))return p.classList.add("zcDisabled");n++,h.textContent=a[n][0],typeof s=="function"&&s(a[n][1]),c()}),c();const h=document.createElement("p");r&&(h.style.fontWeight="bold"),h.textContent=a[n][0],t.append(f,h,p);const i=()=>{typeof e=="number"&&typeof o=="number"&&E(t,e,o,l),L(t,u,m),A(h)};return i(),window.addEventListener("resize",i),y&&document.body.append(t),this.resizeEventListeners.push(i),this.htmlElements.push(t),t}createTabs({x:e,y:o,width:u,tabs:m,anchor:a="top-left",currentTabName:n}){let r=[];const l=document.createElement("div");l.classList.add("zcTabs"),z(l,w.fontFamily),m.forEach(s=>{const d=()=>{for(const f of l.children)f.removeAttribute("data-opened");for(const f of r)f instanceof Node&&document.body.removeChild(f);r=[],t.setAttribute("data-opened","true");const c=document.body.append.bind(document.body);document.body.append=(...f)=>{r.push(...f),c(...f)},this.tabHandlers.unload?.(),this.tabHandlers.exit?.(),s.load(),this.tabHandlers={run:s.run,load:s.load,unload:s.unload,exit:s.exit},document.body.append=c},t=document.createElement("button");t.textContent=s.name,s.name===n&&d(),t.addEventListener("click",d),l.append(t)});const y=()=>{typeof e=="number"&&typeof o=="number"&&E(l,e,o,a),u&&(l.style.width=F(u)+"px"),A(l)};return y(),window.addEventListener("resize",y),document.body.append(l),this.resizeEventListeners.push(y),this.htmlElements.push(l),l}drawPolylineArrow({points:e,strokeColor:o=N()?.base?.text??"black",lineWidth:u=2,circleRadius:m=5,circleColor:a=N()?.base?.text??"black"}){if(e.length<2)return;const n=MainCanvas.canvas.getContext("2d");n.save(),n.strokeStyle=o,n.lineWidth=u,n.fillStyle=a,n.beginPath(),n.moveTo(e[0].x,e[0].y);for(let r=1;r<e.length;r++)n.lineTo(e[r].x,e[r].y);n.stroke(),n.beginPath(),n.arc(e[0].x,e[0].y,m,0,Math.PI*2),n.fill(),n.beginPath(),n.arc(e[e.length-1].x,e[e.length-1].y,m,0,Math.PI*2),n.fill(),n.restore()}}const B={};function Y(b,e){B[b]||(B[b]=[]),B[b].push(e)}export{X as BaseSubscreen,A as autosetFontSize,G as getCurrentSubscreen,D as getRelativeHeight,F as getRelativeWidth,R as getRelativeX,j as getRelativeY,Y as hookSubscreen,z as setFontFamily,H as setFontSize,P as setPadding,E as setPosition,O as setPreviousSubscreen,L as setSize,W as setSubscreen};
package/dist/wardrobe.js CHANGED
@@ -1 +1 @@
1
- function f(e){const s=Asset.includes(e)?e:e.Asset;if(!Asset.includes(s))throw new Error("Failed to convert item to asset");return s}function n(e){const s=AssetGroup.includes(e)?e:Asset.includes(e)?e.Group:e.Asset.Group;if(!AssetGroup.includes(s))throw new Error("Failed to convert item to group");return s}function y(e){return e?.Craft?.Name?e.Craft.Name:e?.Asset?.Description}function G(e){return AssetGroup.some(s=>s.Name===e)}function C(e,s=!1){const t=n(e);return t.Category==="Appearance"&&t.AllowNone&&t.Clothing&&(s||!t.BodyCosplay)}function m(e){const s=n(e);return s.Category==="Appearance"&&s.AllowNone&&s.Clothing&&s.BodyCosplay}function i(e){const s=n(e);return s.Category==="Appearance"&&!s.Clothing}function A(e,s=["ItemNeck","ItemNeckAccessories","ItemNeckRestraints"]){const t=n(e);return t.Category!=="Item"||t.BodyCosplay?!1:!s.includes(t.Name)}function I(e,s,t=["Cosplay","Binds","Collar","Locks"],a=e,u=!1){s=s.filter(r=>!!r&&!i(r)),t.includes("Cosplay")||(s=s.filter(r=>!m(r))),t.includes("Binds")||(s=s.filter(r=>!A(r))),t.includes("Collar")||(s=s.filter(r=>r.Asset.Group.Name!=="ItemNeck")),t.includes("Locks")||(s=s.map(r=>(r.Property?.LockedBy&&delete r.Property.LockedBy,r)));const p=[];if(u)e.Appearance=e.Appearance.filter(r=>i(r));else{const r=ValidationCreateDiffParams(a,Player.MemberNumber);e.Appearance=e.Appearance.filter(o=>i(o)||!ValidationCanRemoveItem(o,r,!!s.find(l=>l?.Asset?.Group?.Name===o?.Asset?.Group?.Name))||o.Property?.LockedBy&&!DialogCanUnlock(a,o)||o.Asset.Name==="SlaveCollar"&&a.IsPlayer()?(p.push(o.Asset.Group.Name),!0):!1)}for(const r of s){if(!u&&(!c(a,r.Asset.Group.Name,r.Asset)||p.includes(r.Asset.Group.Name)))continue;CharacterAppearanceSetItem(e,r.Asset.Group.Name,r.Asset,r.Color);const o=InventoryGet(e,r.Asset.Group.Name);r.Craft&&CraftingValidate(r.Craft,r.Asset)!==CraftingStatusType.CRITICAL_ERROR&&(o.Craft=r.Craft),r.Property&&(ValidationSanitizeProperties(e,r),o.Property=r.Property)}CharacterRefresh(e),e.IsNpc()||ChatRoomCharacterUpdate(e)}function c(e,s,t){return!ValidationIsItemBlockedOrLimited(e,Player.MemberNumber,s,t.Name)&&ServerChatRoomGetAllowItem(Player,e)}function N(e,s){return s.map(t=>ServerBundledItemToAppearanceItem(e,t))}export{I as importAppearance,G as isAssetGroupName,A as isBind,i as isBody,C as isCloth,m as isCosplay,N as serverAppearanceBundleToAppearance,f as smartGetAsset,n as smartGetAssetGroup,y as smartGetItemName,c as validationCanAccessCheck};
1
+ function c(e){const s=Asset.includes(e)?e:e.Asset;if(!Asset.includes(s))throw new Error("Failed to convert item to asset");return s}function n(e){const s=AssetGroup.includes(e)?e:Asset.includes(e)?e.Group:e.Asset.Group;if(!AssetGroup.includes(s))throw new Error("Failed to convert item to group");return s}function G(e){return e?.Craft?.Name?e.Craft.Name:e?.Asset?.Description}function C(e){return AssetGroup.some(s=>s.Name===e)}function y(e,s=!1){const r=n(e);return r.Category==="Appearance"&&r.AllowNone&&r.Clothing&&(s||!r.BodyCosplay)}function m(e){const s=n(e);return s.Category==="Appearance"&&s.AllowNone&&s.Clothing&&s.BodyCosplay}function i(e){const s=n(e);return s.Category==="Appearance"&&!s.Clothing}function A(e,s=["ItemNeck","ItemNeckAccessories","ItemNeckRestraints"]){const r=n(e);return r.Category!=="Item"||r.BodyCosplay?!1:!s.includes(r.Name)}function I(e,s,r=["Cosplay","Binds","Collar","Locks"],a=e,u=!1){s=s.filter(t=>!!t&&!i(t)),r.includes("Cosplay")||(s=s.filter(t=>!m(t))),r.includes("Binds")||(s=s.filter(t=>!A(t))),r.includes("Collar")||(s=s.filter(t=>t.Asset.Group.Name!=="ItemNeck")),r.includes("Locks")||(s=s.map(t=>(t.Property?.LockedBy&&delete t.Property.LockedBy,t)));const p=[];if(u)e.Appearance=e.Appearance.filter(t=>i(t));else{const t=ValidationCreateDiffParams(a,Player.MemberNumber);e.Appearance=e.Appearance.filter(o=>i(o)||!ValidationCanRemoveItem(o,t,!!s.find(l=>l?.Asset?.Group?.Name===o?.Asset?.Group?.Name))||o.Property?.LockedBy&&!DialogCanUnlock(a,o)||o.Asset.Name==="SlaveCollar"&&a.IsPlayer()?(p.push(o.Asset.Group.Name),!0):!1)}for(const t of s){if(!u&&(!f(a,t.Asset.Group.Name,t.Asset)||p.includes(t.Asset.Group.Name)))continue;CharacterAppearanceSetItem(e,t.Asset.Group.Name,t.Asset,t.Color);const o=InventoryGet(e,t.Asset.Group.Name);t.Craft&&CraftingValidate(t.Craft,t.Asset)!==CraftingStatusType.CRITICAL_ERROR&&(o.Craft=t.Craft),t.Property&&(ValidationSanitizeProperties(e,t),o.Property=t.Property)}CharacterRefresh(e),e.IsNpc()||ChatRoomCharacterUpdate(e)}function f(e,s,r){return!ValidationIsItemBlockedOrLimited(e,Player.MemberNumber,s,r.Name)&&ServerChatRoomGetAllowItem(Player,e)}function N(e,s){return s.map(r=>ServerBundledItemToAppearanceItem(e,r))}function d(e){AssetGroup.forEach(s=>{if(s.Category!=="Appearance"||s.AllowNone||e.find(a=>a.Asset.Group.Name===s.Name))return;const r=AssetGet("Female3DCG",s.Name,s.Asset[0]?.Name);r&&e.push({Asset:r,Color:s.DefaultColor})})}export{d as addRequiredAppearanceItems,I as importAppearance,C as isAssetGroupName,A as isBind,i as isBody,y as isCloth,m as isCosplay,N as serverAppearanceBundleToAppearance,c as smartGetAsset,n as smartGetAssetGroup,G as smartGetItemName,f as validationCanAccessCheck};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zois-core",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "The core for the my mods, which contains a shared code reused in all my mods",
5
5
  "author": "Zoi",
6
6
  "license": "MIT",