tgui-core 4.0.1 → 4.0.2

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};
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.2"
77
77
  }