tgui-core 1.0.3 → 1.0.4
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/components/Section.tsx +1 -1
- package/debug/middleware.ts +7 -26
- package/package.json +1 -1
- package/src/backend.ts +3 -4
- package/src/renderer.ts +23 -23
package/components/Section.tsx
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { canRender, classes } from '../common/react';
|
|
8
8
|
import { forwardRef, ReactNode, RefObject, useEffect } from 'react';
|
|
9
9
|
|
|
10
|
-
import { addScrollableNode, removeScrollableNode } from '../events';
|
|
10
|
+
import { addScrollableNode, removeScrollableNode } from '../src/events';
|
|
11
11
|
import { BoxProps, computeBoxClassName, computeBoxProps } from './Box';
|
|
12
12
|
|
|
13
13
|
type Props = Partial<{
|
package/debug/middleware.ts
CHANGED
|
@@ -14,11 +14,7 @@ import {
|
|
|
14
14
|
toggleKitchenSink,
|
|
15
15
|
} from './actions';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
const relayedTypes = [
|
|
19
|
-
'backend/update',
|
|
20
|
-
'chat/message',
|
|
21
|
-
];
|
|
17
|
+
const relayedTypes = ['backend/update', 'chat/message'];
|
|
22
18
|
|
|
23
19
|
export const debugMiddleware = (store) => {
|
|
24
20
|
acquireHotKey(KEY_F11);
|
|
@@ -34,11 +30,11 @@ export const debugMiddleware = (store) => {
|
|
|
34
30
|
// NOTE: We need to call this in a timeout, because we need a clean
|
|
35
31
|
// stack in order for this to be a fatal error.
|
|
36
32
|
setTimeout(() => {
|
|
37
|
-
// prettier-ignore
|
|
38
33
|
throw new Error(
|
|
39
|
-
'OOPSIE WOOPSIE!! UwU We made a fucky wucky!! A wittle'
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
'OOPSIE WOOPSIE!! UwU We made a fucky wucky!! A wittle' +
|
|
35
|
+
' fucko boingo! The code monkeys at our headquarters are' +
|
|
36
|
+
' working VEWY HAWD to fix this!'
|
|
37
|
+
);
|
|
42
38
|
});
|
|
43
39
|
}
|
|
44
40
|
});
|
|
@@ -46,18 +42,9 @@ export const debugMiddleware = (store) => {
|
|
|
46
42
|
};
|
|
47
43
|
|
|
48
44
|
export const relayMiddleware = (store) => {
|
|
49
|
-
const devServer = require('tgui-dev-server/link/client.cjs');
|
|
50
45
|
const externalBrowser = location.search === '?external';
|
|
51
46
|
if (externalBrowser) {
|
|
52
|
-
|
|
53
|
-
const { type, payload } = msg;
|
|
54
|
-
if (type === 'relay' && payload.windowId === Byond.windowId) {
|
|
55
|
-
store.dispatch({
|
|
56
|
-
...payload.action,
|
|
57
|
-
relayed: true,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
});
|
|
47
|
+
// todo: implement
|
|
61
48
|
} else {
|
|
62
49
|
acquireHotKey(KEY_F10);
|
|
63
50
|
globalEvents.on('keydown', (key) => {
|
|
@@ -73,13 +60,7 @@ export const relayMiddleware = (store) => {
|
|
|
73
60
|
return;
|
|
74
61
|
}
|
|
75
62
|
if (relayedTypes.includes(type) && !relayed && !externalBrowser) {
|
|
76
|
-
|
|
77
|
-
type: 'relay',
|
|
78
|
-
payload: {
|
|
79
|
-
windowId: Byond.windowId,
|
|
80
|
-
action,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
63
|
+
// todo: implement
|
|
83
64
|
}
|
|
84
65
|
return next(action);
|
|
85
66
|
};
|
package/package.json
CHANGED
package/src/backend.ts
CHANGED
|
@@ -224,10 +224,9 @@ export const backendMiddleware = (store) => {
|
|
|
224
224
|
*/
|
|
225
225
|
export const sendAct = (action: string, payload: object = {}) => {
|
|
226
226
|
// Validate that payload is an object
|
|
227
|
-
|
|
228
|
-
const isObject =
|
|
229
|
-
&& payload !== null
|
|
230
|
-
&& !Array.isArray(payload);
|
|
227
|
+
|
|
228
|
+
const isObject =
|
|
229
|
+
typeof payload === 'object' && payload !== null && !Array.isArray(payload);
|
|
231
230
|
if (!isObject) {
|
|
232
231
|
return;
|
|
233
232
|
}
|
package/src/renderer.ts
CHANGED
|
@@ -25,26 +25,26 @@ enum Render {
|
|
|
25
25
|
Finish = 'render/finish',
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
28
|
+
export const createRenderer: CreateRenderer =
|
|
29
|
+
(getVNode) =>
|
|
30
|
+
(...args) => {
|
|
31
|
+
perf.mark(Render.Start);
|
|
32
|
+
// Start rendering
|
|
33
|
+
if (!reactRoot) {
|
|
34
|
+
const element = document.getElementById('react-root');
|
|
35
|
+
reactRoot = createRoot(element!);
|
|
36
|
+
}
|
|
37
|
+
if (getVNode) {
|
|
38
|
+
reactRoot.render(getVNode(...args));
|
|
39
|
+
} else {
|
|
40
|
+
reactRoot.render(args[0] as any);
|
|
41
|
+
}
|
|
42
|
+
perf.mark(Render.Finish);
|
|
43
|
+
if (suspended) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (initialRender) {
|
|
48
|
+
initialRender = false;
|
|
49
|
+
}
|
|
50
|
+
};
|