tgui-core 4.0.1 → 4.0.3

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.
@@ -16,6 +16,12 @@ type Props = Partial<{
16
16
  * You can find a full reference of these parameters
17
17
  * in [BYOND controls and parameters guide](https://secure.byond.com/docs/ref/skinparams.html). */
18
18
  params: SampleByondParams & Record<string, any>;
19
+ /**
20
+ * If this ByondUi element should tell DreamMaker that it has been created or not.
21
+ *
22
+ * Defaults to on.
23
+ */
24
+ phonehome: boolean;
19
25
  }> & BoxProps;
20
26
  /**
21
27
  * ## ByondUi
@@ -1 +1 @@
1
- import*as e from"react/jsx-runtime";import*as t from"react";import*as n from"../common/timer.js";import*as o from"../common/ui.js";let r=[];function i(i){let{params:s,...u}=i,l=(0,t.useRef)(null),d=(0,t.useRef)(function(e){let t=r.length;r.push(null);let n=e||`byondui_${t}`;return{render:e=>{r[t]=n,Byond.winset(n,e)},unmount:()=>{r[t]=null,Byond.winset(n,{parent:""})}}}(s?.id));function m(){let e=l.current;if(!e)return;let t=function(e){let t=window.devicePixelRatio??1,n=e.getBoundingClientRect();return{pos:[n.left*t,n.top*t],size:[(n.right-n.left)*t,(n.bottom-n.top)*t]}}(e);d.current.render({parent:Byond.windowId,...s,pos:`${t.pos[0]},${t.pos[1]}`,size:`${t.size[0]}x${t.size[1]}`})}let f=(0,n.debounce)(()=>{m()},100);return(0,t.useEffect)(()=>(window.addEventListener("resize",f),m(),()=>{window.removeEventListener("resize",f),d.current.unmount()}),[]),(0,e.jsx)("div",{ref:l,...(0,o.computeBoxProps)(u),children:(0,e.jsx)("div",{style:{minHeight:"22px"}})})}window.addEventListener("beforeunload",()=>{for(let e=0;e<r.length;e++){let t=r[e];"string"==typeof t&&(r[e]=null,Byond.winset(t,{parent:""}))}});export{i as ByondUi};
1
+ import*as e from"react/jsx-runtime";import*as n from"react";import*as t from"../common/timer.js";import*as o from"../common/ui.js";let r=[];function i(i){let{params:s,phonehome:d,...u}=i,l=(0,n.useRef)(null),m=(0,n.useRef)(function(e,n=!0){let t=r.length;r.push(null);let o=e||`byondui_${t}`;return{render:e=>{n&&Byond.sendMessage("renderByondUi",{renderByondUi:o}),r[t]=o,Byond.winset(o,e)},unmount:()=>{n&&Byond.sendMessage("unmountByondUi",{renderByondUi:o}),r[t]=null,Byond.winset(o,{parent:""})}}}(s?.id,d));function f(){let e=l.current;if(!e)return;let n=function(e){let n=window.devicePixelRatio??1,t=e.getBoundingClientRect();return{pos:[t.left*n,t.top*n],size:[(t.right-t.left)*n,(t.bottom-t.top)*n]}}(e);m.current.render({parent:Byond.windowId,...s,pos:`${n.pos[0]},${n.pos[1]}`,size:`${n.size[0]}x${n.size[1]}`})}let p=(0,t.debounce)(()=>{f()},100);return(0,n.useEffect)(()=>(window.addEventListener("resize",p),f(),()=>{window.removeEventListener("resize",p),m.current.unmount()}),[]),(0,e.jsx)("div",{ref:l,...(0,o.computeBoxProps)(u),children:(0,e.jsx)("div",{style:{minHeight:"22px"}})})}window.addEventListener("beforeunload",()=>{for(let e=0;e<r.length;e++){let n=r[e];"string"==typeof n&&(r[e]=null,Byond.winset(n,{parent:""}))}});export{i as ByondUi};
@@ -1 +1 @@
1
- import*as e from"react/jsx-runtime";import*as t from"react";import*as o from"../common/ui.js";import*as n from"./Button.js";import*as i from"./ProgressBar.js";import*as s from"./Stack.js";function r(n){let{backgroundImage:i,children:s,imageWidth:r,zoomPadding:u=0,initialLeft:c=0,initialTop:l=0,onBackgroundMoved:d,onZoomChange:m,...p}=n,[f,x]=(0,t.useState)(0),[h,j]=(0,t.useState)(0),[g,v]=(0,t.useState)(0),[k,S]=(0,t.useState)(!1),[w,b]=(0,t.useState)(0),[M,$]=(0,t.useState)(1);function B(e){x(e.clientX-g),j(e.clientY-w),S(!0)}function y(e){if(!k)return;let t=e.clientX-f,o=e.clientY-h;d?.(t+c,o+l),v(t),b(o)}function I(){S(!1)}function P(e){if("increase"===e&&M>=1.5||"decrease"===e&&M<=.5)return;let t=Math.round((M+("increase"===e?.1:-.1))*10)/10;$(t),m?.(t)}(0,t.useEffect)(()=>(window.addEventListener("mouseup",I),()=>{window.removeEventListener("mouseup",I)}),[]);let Y=c+g,C=l+w;return(0,e.jsxs)("div",{...(0,o.computeBoxProps)({...p,style:{...p.style,height:"100%",overflow:"hidden",position:"relative",width:"100%"}}),children:[(0,e.jsx)("div",{onMouseDown:B,onMouseMove:y,onWheel:function(e){0!==e.deltaY&&(e.preventDefault(),P(e.deltaY>0?"increase":"decrease"))},style:{backgroundImage:`url("${i}")`,backgroundPosition:`${Y}px ${C}px`,backgroundRepeat:"repeat",backgroundSize:`${M*r}px`,height:"100%",inset:0,position:"absolute",width:"100%"}}),(0,e.jsx)("div",{onMouseDown:B,onMouseMove:y,style:{height:"100%",inset:0,position:"absolute",transform:`translate(${Y}px, ${C}px) scale(${M})`,transformOrigin:"top left",width:"100%"},children:s}),(0,e.jsx)(a,{padding:u,onZoomClick:P,zoom:M})]})}function a(t){let{zoom:o,padding:r,onZoomClick:a}=t;return(0,e.jsx)("div",{style:{left:5,position:"absolute",right:5+r,top:5},children:(0,e.jsxs)(s.Stack,{children:[(0,e.jsx)(s.Stack.Item,{children:(0,e.jsx)(n.Button,{disabled:o<=.5,icon:"minus",onClick:()=>a("decrease")})}),(0,e.jsx)(s.Stack.Item,{grow:!0,children:(0,e.jsxs)(i.ProgressBar,{maxValue:1.5,minValue:.5,value:o,children:[o,"x"]})}),(0,e.jsx)(s.Stack.Item,{children:(0,e.jsx)(n.Button,{disabled:o>=1.5,icon:"plus",onClick:()=>a("increase")})})]})})}export{r as InfinitePlane};
1
+ import*as e from"react/jsx-runtime";import*as t from"react";import*as o from"../common/ui.js";import*as n from"./Button.js";import*as i from"./ProgressBar.js";import*as s from"./Stack.js";function r(n){let{backgroundImage:i,children:s,imageWidth:r,zoomPadding:u=0,initialLeft:c=0,initialTop:l=0,onBackgroundMoved:d,onZoomChange:m,...p}=n,[f,x]=(0,t.useState)(0),[h,j]=(0,t.useState)(0),[g,v]=(0,t.useState)(0),[k,S]=(0,t.useState)(!1),[w,b]=(0,t.useState)(0),[M,$]=(0,t.useState)(1);function B(e){x(e.clientX-g),j(e.clientY-w),S(!0)}function y(e){if(!k)return;let t=e.clientX-f,o=e.clientY-h;d?.(t+c,o+l),v(t),b(o)}function I(){S(!1)}function P(e){if("increase"===e&&M>=1.5||"decrease"===e&&M<=.5)return;let t=Math.round((M+("increase"===e?.1:-.1))*10)/10;$(t),m?.(t)}(0,t.useEffect)(()=>(window.addEventListener("mouseup",I),()=>{window.removeEventListener("mouseup",I)}),[]);let Y=c+g,C=l+w;return(0,e.jsxs)("div",{...(0,o.computeBoxProps)({...p,style:{...p.style,height:"100%",overflow:"hidden",position:"relative",width:"100%"}}),children:[(0,e.jsx)("div",{onMouseDown:B,onMouseMove:y,onWheel:function(e){0!==e.deltaY&&(e.preventDefault(),P(e.deltaY<0?"increase":"decrease"))},style:{backgroundImage:`url("${i}")`,backgroundPosition:`${Y}px ${C}px`,backgroundRepeat:"repeat",backgroundSize:`${M*r}px`,height:"100%",inset:0,position:"absolute",width:"100%"}}),(0,e.jsx)("div",{onMouseDown:B,onMouseMove:y,style:{height:"100%",inset:0,position:"absolute",transform:`translate(${Y}px, ${C}px) scale(${M})`,transformOrigin:"top left",width:"100%"},children:s}),(0,e.jsx)(a,{padding:u,onZoomClick:P,zoom:M})]})}function a(t){let{zoom:o,padding:r,onZoomClick:a}=t;return(0,e.jsx)("div",{style:{left:5,position:"absolute",right:5+r,top:5},children:(0,e.jsxs)(s.Stack,{children:[(0,e.jsx)(s.Stack.Item,{children:(0,e.jsx)(n.Button,{disabled:o<=.5,icon:"minus",onClick:()=>a("decrease")})}),(0,e.jsx)(s.Stack.Item,{grow:!0,children:(0,e.jsxs)(i.ProgressBar,{maxValue:1.5,minValue:.5,value:o,children:[o,"x"]})}),(0,e.jsx)(s.Stack.Item,{children:(0,e.jsx)(n.Button,{disabled:o>=1.5,icon:"plus",onClick:()=>a("increase")})})]})})}export{r as InfinitePlane};
@@ -1 +1 @@
1
- import*as s from"react/jsx-runtime";import*as a from"../common/react.js";import*as e from"../common/ui.js";import*as c from"./Icon.js";function o(c){let{className:o,vertical:r,fill:l,fluid:t,children:i,...n}=c;return(0,s.jsx)("div",{className:(0,a.classes)(["Tabs",r?"Tabs--vertical":"Tabs--horizontal",l&&"Tabs--fill",t&&"Tabs--fluid",o,(0,e.computeBoxClassName)(n)]),...(0,e.computeBoxProps)(n),children:i})}(o||(o={})).Tab=function(o){let{className:r,selected:l,color:t,icon:i,iconSpin:n,leftSlot:m,rightSlot:b,children:T,onClick:d,...x}=o;return(0,s.jsxs)("div",{className:(0,a.classes)(["Tab","Tabs__Tab",`Tab--color--${t}`,l&&"Tab--selected",r,(0,e.computeBoxClassName)(x)]),onClick:function(s){d&&(d(s),s.target.blur())},...(0,e.computeBoxProps)(x),children:[(0,a.canRender)(m)&&(0,s.jsx)("div",{className:"Tab__left",children:m})||!!i&&(0,s.jsx)("div",{className:"Tab__left",children:(0,s.jsx)(c.Icon,{name:i,spin:n})}),(0,s.jsx)("div",{className:"Tab__text",children:T}),(0,a.canRender)(b)&&(0,s.jsx)("div",{className:"Tab__right",children:b})]})};export{o as Tabs};
1
+ import*as s from"react/jsx-runtime";import*as a from"../common/react.js";import*as e from"../common/ui.js";import*as c from"./Icon.js";function o(c){let{className:o,vertical:r,fill:i,fluid:l,children:n,...t}=c;return(0,s.jsx)("div",{className:(0,a.classes)(["Tabs",r?"Tabs--vertical":"Tabs--horizontal",i&&"Tabs--fill",l&&"Tabs--fluid",o,(0,e.computeBoxClassName)(t)]),...(0,e.computeBoxProps)(t),children:n})}(o||(o={})).Tab=function(o){let{className:r,selected:i,color:l,icon:n,iconSpin:t,leftSlot:m,rightSlot:b,children:T,onClick:d,...x}=o;return(0,s.jsxs)("div",{className:(0,a.classes)(["Tab","Tabs__Tab",`Tab--color--${l}`,i&&"Tab--selected",r,(0,e.computeBoxClassName)(x)]),onClick:function(s){d&&d(s)},...(0,e.computeBoxProps)(x),children:[(0,a.canRender)(m)&&(0,s.jsx)("div",{className:"Tab__left",children:m})||!!n&&(0,s.jsx)("div",{className:"Tab__left",children:(0,s.jsx)(c.Icon,{name:n,spin:t})}),(0,s.jsx)("div",{className:"Tab__text",children:T}),(0,a.canRender)(b)&&(0,s.jsx)("div",{className:"Tab__right",children:b})]})};export{o as Tabs};
@@ -1 +1 @@
1
- import*as t from"react/jsx-runtime";import*as o from"./Floating.js";function e(e){let{content:n,children:r,position:i}=e;return(0,t.jsx)(o.Floating,{content:n,contentClasses:"Tooltip",hoverOpen:!0,placement:i,children:r})}export{e as Tooltip};
1
+ import*as t from"react/jsx-runtime";import*as o from"./Floating.js";function n(n){let{content:e,children:r,position:i}=n;return(0,t.jsx)(o.Floating,{content:e,contentAutoWidth:!1,contentClasses:"Tooltip",hoverOpen:!0,placement:i,children:r})}export{n as Tooltip};
package/package.json CHANGED
@@ -73,5 +73,5 @@
73
73
  "test": "bun test"
74
74
  },
75
75
  "type": "module",
76
- "version": "4.0.1"
76
+ "version": "4.0.3"
77
77
  }