tgui-core 1.0.2 → 1.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.
Files changed (158) hide show
  1. package/{src/components → components}/AnimatedNumber.tsx +185 -185
  2. package/{src/components → components}/BlockQuote.tsx +15 -15
  3. package/{src/components → components}/BodyZoneSelector.tsx +149 -149
  4. package/{src/components → components}/Box.tsx +255 -255
  5. package/{src/components → components}/Button.tsx +415 -415
  6. package/{src/components → components}/ByondUi.jsx +121 -121
  7. package/{src/components → components}/Chart.tsx +160 -160
  8. package/{src/components → components}/ColorBox.tsx +30 -30
  9. package/{src/components → components}/Dimmer.tsx +19 -19
  10. package/{src/components → components}/Divider.tsx +26 -26
  11. package/{src/components → components}/DmIcon.tsx +72 -72
  12. package/{src/components → components}/DraggableControl.jsx +282 -282
  13. package/{src/components → components}/Dropdown.tsx +246 -246
  14. package/{src/components → components}/Flex.tsx +105 -105
  15. package/{src/components → components}/Icon.tsx +91 -91
  16. package/{src/components → components}/Input.tsx +181 -181
  17. package/{src/components → components}/KeyListener.tsx +40 -40
  18. package/{src/components → components}/Knob.tsx +185 -185
  19. package/{src/components → components}/LabeledList.tsx +130 -130
  20. package/{src/components → components}/MenuBar.tsx +233 -238
  21. package/{src/components → components}/Modal.tsx +25 -25
  22. package/{src/components → components}/NoticeBox.tsx +48 -48
  23. package/{src/components → components}/NumberInput.tsx +328 -328
  24. package/{src/components → components}/ProgressBar.tsx +79 -79
  25. package/{src/components → components}/RestrictedInput.jsx +301 -301
  26. package/{src/components → components}/RoundGauge.tsx +189 -189
  27. package/{src/components → components}/Section.tsx +125 -125
  28. package/{src/components → components}/Slider.tsx +173 -173
  29. package/{src/components → components}/Stack.tsx +101 -101
  30. package/{src/components → components}/Table.tsx +90 -90
  31. package/{src/components → components}/Tabs.tsx +90 -90
  32. package/{src/components → components}/TextArea.tsx +198 -198
  33. package/{src/components → components}/TimeDisplay.jsx +64 -64
  34. package/components/index.ts +51 -0
  35. package/{src/debug/KitchenSink.jsx → debug/KitchenSink.tsx} +56 -56
  36. package/{src/debug/actions.js → debug/actions.ts} +11 -11
  37. package/{src/debug/hooks.js → debug/hooks.ts} +10 -10
  38. package/{src/debug/middleware.js → debug/middleware.ts} +86 -86
  39. package/{src/debug/reducer.js → debug/reducer.ts} +27 -22
  40. package/{src/debug/selectors.js → debug/selectors.ts} +7 -7
  41. package/{src/layouts → layouts}/Layout.tsx +75 -75
  42. package/{src/layouts → layouts}/NtosWindow.tsx +162 -162
  43. package/{src/layouts → layouts}/Pane.tsx +56 -56
  44. package/{src/layouts → layouts}/Window.tsx +227 -227
  45. package/layouts/index.ts +10 -0
  46. package/package.json +3 -2
  47. package/src/assets.ts +43 -43
  48. package/src/backend.ts +369 -369
  49. package/src/drag.ts +280 -280
  50. package/src/events.ts +237 -237
  51. package/src/hotkeys.ts +212 -212
  52. package/src/renderer.ts +50 -50
  53. package/stories/Blink.stories.tsx +20 -0
  54. package/stories/BlockQuote.stories.tsx +23 -0
  55. package/stories/Box.stories.tsx +27 -0
  56. package/stories/Button.stories.tsx +68 -0
  57. package/stories/ByondUi.stories.tsx +45 -0
  58. package/stories/Collapsible.stories.tsx +23 -0
  59. package/stories/Flex.stories.tsx +68 -0
  60. package/stories/Input.stories.tsx +124 -0
  61. package/stories/LabeledList.stories.tsx +73 -0
  62. package/stories/Popper.stories.tsx +58 -0
  63. package/stories/ProgressBar.stories.tsx +58 -0
  64. package/stories/Stack.stories.tsx +55 -0
  65. package/stories/Storage.stories.tsx +46 -0
  66. package/stories/Themes.stories.tsx +30 -0
  67. package/stories/Tooltip.stories.tsx +48 -0
  68. package/stories/common.tsx +19 -0
  69. package/tsconfig.json +0 -21
  70. package/src/components/Grid.tsx +0 -44
  71. /package/{src/common → common}/collections.ts +0 -0
  72. /package/{src/common → common}/color.ts +0 -0
  73. /package/{src/common → common}/events.ts +0 -0
  74. /package/{src/common → common}/exhaustive.ts +0 -0
  75. /package/{src/common → common}/fp.ts +0 -0
  76. /package/{src/common → common}/keycodes.ts +0 -0
  77. /package/{src/common → common}/keys.ts +0 -0
  78. /package/{src/common → common}/math.ts +0 -0
  79. /package/{src/common → common}/perf.ts +0 -0
  80. /package/{src/common → common}/random.ts +0 -0
  81. /package/{src/common → common}/react.ts +0 -0
  82. /package/{src/common → common}/redux.ts +0 -0
  83. /package/{src/common → common}/storage.js +0 -0
  84. /package/{src/common → common}/string.ts +0 -0
  85. /package/{src/common → common}/timer.ts +0 -0
  86. /package/{src/common → common}/type-utils.ts +0 -0
  87. /package/{src/common → common}/types.ts +0 -0
  88. /package/{src/common → common}/uuid.ts +0 -0
  89. /package/{src/common → common}/vector.ts +0 -0
  90. /package/{src/components → components}/Autofocus.tsx +0 -0
  91. /package/{src/components → components}/Blink.jsx +0 -0
  92. /package/{src/components → components}/Collapsible.tsx +0 -0
  93. /package/{src/components → components}/Dialog.tsx +0 -0
  94. /package/{src/components → components}/FakeTerminal.jsx +0 -0
  95. /package/{src/components → components}/FitText.tsx +0 -0
  96. /package/{src/components → components}/Image.tsx +0 -0
  97. /package/{src/components → components}/InfinitePlane.jsx +0 -0
  98. /package/{src/components → components}/LabeledControls.tsx +0 -0
  99. /package/{src/components → components}/Popper.tsx +0 -0
  100. /package/{src/components → components}/StyleableSection.tsx +0 -0
  101. /package/{src/components → components}/Tooltip.tsx +0 -0
  102. /package/{src/components → components}/TrackOutsideClicks.tsx +0 -0
  103. /package/{src/components → components}/VirtualList.tsx +0 -0
  104. /package/{src/debug → debug}/index.ts +0 -0
  105. /package/{src/styles → styles}/base.scss +0 -0
  106. /package/{src/styles → styles}/colors.scss +0 -0
  107. /package/{src/styles → styles}/components/BlockQuote.scss +0 -0
  108. /package/{src/styles → styles}/components/Button.scss +0 -0
  109. /package/{src/styles → styles}/components/ColorBox.scss +0 -0
  110. /package/{src/styles → styles}/components/Dialog.scss +0 -0
  111. /package/{src/styles → styles}/components/Dimmer.scss +0 -0
  112. /package/{src/styles → styles}/components/Divider.scss +0 -0
  113. /package/{src/styles → styles}/components/Dropdown.scss +0 -0
  114. /package/{src/styles → styles}/components/Flex.scss +0 -0
  115. /package/{src/styles → styles}/components/Icon.scss +0 -0
  116. /package/{src/styles → styles}/components/Input.scss +0 -0
  117. /package/{src/styles → styles}/components/Knob.scss +0 -0
  118. /package/{src/styles → styles}/components/LabeledList.scss +0 -0
  119. /package/{src/styles → styles}/components/MenuBar.scss +0 -0
  120. /package/{src/styles → styles}/components/Modal.scss +0 -0
  121. /package/{src/styles → styles}/components/NoticeBox.scss +0 -0
  122. /package/{src/styles → styles}/components/NumberInput.scss +0 -0
  123. /package/{src/styles → styles}/components/ProgressBar.scss +0 -0
  124. /package/{src/styles → styles}/components/RoundGauge.scss +0 -0
  125. /package/{src/styles → styles}/components/Section.scss +0 -0
  126. /package/{src/styles → styles}/components/Slider.scss +0 -0
  127. /package/{src/styles → styles}/components/Stack.scss +0 -0
  128. /package/{src/styles → styles}/components/Table.scss +0 -0
  129. /package/{src/styles → styles}/components/Tabs.scss +0 -0
  130. /package/{src/styles → styles}/components/TextArea.scss +0 -0
  131. /package/{src/styles → styles}/components/Tooltip.scss +0 -0
  132. /package/{src/styles → styles}/functions.scss +0 -0
  133. /package/{src/styles → styles}/layouts/Layout.scss +0 -0
  134. /package/{src/styles → styles}/layouts/NtosHeader.scss +0 -0
  135. /package/{src/styles → styles}/layouts/NtosWindow.scss +0 -0
  136. /package/{src/styles → styles}/layouts/TitleBar.scss +0 -0
  137. /package/{src/styles → styles}/layouts/Window.scss +0 -0
  138. /package/{src/styles → styles}/main.scss +0 -0
  139. /package/{src/styles → styles}/reset.scss +0 -0
  140. /package/{src/styles → styles}/themes/abductor.scss +0 -0
  141. /package/{src/styles → styles}/themes/admin.scss +0 -0
  142. /package/{src/styles → styles}/themes/cardtable.scss +0 -0
  143. /package/{src/styles → styles}/themes/hackerman.scss +0 -0
  144. /package/{src/styles → styles}/themes/malfunction.scss +0 -0
  145. /package/{src/styles → styles}/themes/neutral.scss +0 -0
  146. /package/{src/styles → styles}/themes/ntOS95.scss +0 -0
  147. /package/{src/styles → styles}/themes/ntos.scss +0 -0
  148. /package/{src/styles → styles}/themes/ntos_cat.scss +0 -0
  149. /package/{src/styles → styles}/themes/ntos_darkmode.scss +0 -0
  150. /package/{src/styles → styles}/themes/ntos_lightmode.scss +0 -0
  151. /package/{src/styles → styles}/themes/ntos_spooky.scss +0 -0
  152. /package/{src/styles → styles}/themes/ntos_synth.scss +0 -0
  153. /package/{src/styles → styles}/themes/ntos_terminal.scss +0 -0
  154. /package/{src/styles → styles}/themes/paper.scss +0 -0
  155. /package/{src/styles → styles}/themes/retro.scss +0 -0
  156. /package/{src/styles → styles}/themes/spookyconsole.scss +0 -0
  157. /package/{src/styles → styles}/themes/syndicate.scss +0 -0
  158. /package/{src/styles → styles}/themes/wizard.scss +0 -0
@@ -1,227 +1,227 @@
1
- /**
2
- * @file
3
- * @copyright 2020 Aleksej Komarov
4
- * @license MIT
5
- */
6
-
7
- import { classes } from '../common/react';
8
- import { decodeHtmlEntities, toTitleCase } from '../common/string';
9
- import { PropsWithChildren, ReactNode, useEffect } from 'react';
10
-
11
- import { backendSuspendStart, globalStore, useBackend } from '../backend';
12
- import { Icon } from '../components/Icon';
13
- import { BoxProps } from '../components/Box';
14
- import { UI_DISABLED, UI_INTERACTIVE, UI_UPDATE } from '../constants';
15
- import { useDebug } from '../debug';
16
- import { toggleKitchenSink } from '../debug/actions';
17
- import {
18
- dragStartHandler,
19
- recallWindowGeometry,
20
- resizeStartHandler,
21
- setWindowKey,
22
- } from '../drag';
23
- import { Layout } from './Layout';
24
-
25
- const DEFAULT_SIZE: [number, number] = [400, 600];
26
-
27
- type Props = Partial<{
28
- buttons: ReactNode;
29
- canClose: boolean;
30
- height: number;
31
- theme: string;
32
- title: string;
33
- width: number;
34
- }> &
35
- PropsWithChildren;
36
-
37
- export const Window = (props: Props) => {
38
- const {
39
- canClose = true,
40
- theme,
41
- title,
42
- children,
43
- buttons,
44
- width,
45
- height,
46
- } = props;
47
-
48
- const { config, suspended } = useBackend();
49
- const { debugLayout = false } = useDebug();
50
-
51
- useEffect(() => {
52
- const updateGeometry = () => {
53
- const options = {
54
- ...config.window,
55
- size: DEFAULT_SIZE,
56
- };
57
-
58
- if (width && height) {
59
- options.size = [width, height];
60
- }
61
- if (config.window?.key) {
62
- setWindowKey(config.window.key);
63
- }
64
- recallWindowGeometry(options);
65
- };
66
-
67
- Byond.winset(Byond.windowId, {
68
- 'can-close': Boolean(canClose),
69
- });
70
-
71
- updateGeometry();
72
-
73
- return () => {};
74
- }, [width, height]);
75
-
76
- const dispatch = globalStore.dispatch;
77
- const fancy = config.window?.fancy;
78
-
79
- // Determine when to show dimmer
80
- const showDimmer =
81
- config.user &&
82
- (config.user.observer
83
- ? config.status < UI_DISABLED
84
- : config.status < UI_INTERACTIVE);
85
-
86
- return suspended ? null : (
87
- <Layout className="Window" theme={theme}>
88
- <TitleBar
89
- className="Window__titleBar"
90
- title={title || decodeHtmlEntities(config.title)}
91
- status={config.status}
92
- fancy={fancy}
93
- onDragStart={dragStartHandler}
94
- onClose={() => {
95
- dispatch(backendSuspendStart());
96
- }}
97
- canClose={canClose}
98
- >
99
- {buttons}
100
- </TitleBar>
101
- <div className={classes(['Window__rest', debugLayout && 'debug-layout'])}>
102
- {!suspended && children}
103
- {showDimmer && <div className="Window__dimmer" />}
104
- </div>
105
- {fancy && (
106
- <>
107
- <div
108
- className="Window__resizeHandle__e"
109
- onMouseDown={resizeStartHandler(1, 0) as any}
110
- />
111
- <div
112
- className="Window__resizeHandle__s"
113
- onMouseDown={resizeStartHandler(0, 1) as any}
114
- />
115
- <div
116
- className="Window__resizeHandle__se"
117
- onMouseDown={resizeStartHandler(1, 1) as any}
118
- />
119
- </>
120
- )}
121
- </Layout>
122
- );
123
- };
124
-
125
- type ContentProps = Partial<{
126
- className: string;
127
- fitted: boolean;
128
- scrollable: boolean;
129
- vertical: boolean;
130
- }> &
131
- BoxProps &
132
- PropsWithChildren;
133
-
134
- const WindowContent = (props: ContentProps) => {
135
- const { className, fitted, children, ...rest } = props;
136
-
137
- return (
138
- <Layout.Content
139
- className={classes(['Window__content', className])}
140
- {...rest}
141
- >
142
- {(fitted && children) || (
143
- <div className="Window__contentPadding">{children}</div>
144
- )}
145
- </Layout.Content>
146
- );
147
- };
148
-
149
- Window.Content = WindowContent;
150
-
151
- const statusToColor = (status) => {
152
- switch (status) {
153
- case UI_INTERACTIVE:
154
- return 'good';
155
- case UI_UPDATE:
156
- return 'average';
157
- case UI_DISABLED:
158
- default:
159
- return 'bad';
160
- }
161
- };
162
-
163
- type TitleBarProps = Partial<{
164
- canClose: boolean;
165
- className: string;
166
- fancy: boolean;
167
- onClose: (e) => void;
168
- onDragStart: (e) => void;
169
- status: number;
170
- title: string;
171
- }> &
172
- PropsWithChildren;
173
-
174
- const TitleBar = (props: TitleBarProps) => {
175
- const {
176
- className,
177
- title,
178
- status,
179
- canClose,
180
- fancy,
181
- onDragStart,
182
- onClose,
183
- children,
184
- } = props;
185
- const dispatch = globalStore.dispatch;
186
-
187
- const finalTitle =
188
- (typeof title === 'string' &&
189
- title === title.toLowerCase() &&
190
- toTitleCase(title)) ||
191
- title;
192
-
193
- return (
194
- <div className={classes(['TitleBar', className])}>
195
- {(status === undefined && (
196
- <Icon className="TitleBar__statusIcon" name="tools" opacity={0.5} />
197
- )) || (
198
- <Icon
199
- className="TitleBar__statusIcon"
200
- color={statusToColor(status)}
201
- name="eye"
202
- />
203
- )}
204
- <div
205
- className="TitleBar__dragZone"
206
- onMouseDown={(e) => fancy && onDragStart && onDragStart(e)}
207
- />
208
- <div className="TitleBar__title">
209
- {finalTitle}
210
- {!!children && <div className="TitleBar__buttons">{children}</div>}
211
- </div>
212
- {process.env.NODE_ENV !== 'production' && (
213
- <div
214
- className="TitleBar__devBuildIndicator"
215
- onClick={() => dispatch(toggleKitchenSink())}
216
- >
217
- <Icon name="bug" />
218
- </div>
219
- )}
220
- {Boolean(fancy && canClose) && (
221
- <div className="TitleBar__close TitleBar__clickable" onClick={onClose}>
222
- ×
223
- </div>
224
- )}
225
- </div>
226
- );
227
- };
1
+ /**
2
+ * @file
3
+ * @copyright 2020 Aleksej Komarov
4
+ * @license MIT
5
+ */
6
+
7
+ import { classes } from '../common/react';
8
+ import { decodeHtmlEntities, toTitleCase } from '../common/string';
9
+ import { PropsWithChildren, ReactNode, useEffect } from 'react';
10
+
11
+ import { backendSuspendStart, globalStore, useBackend } from '../src/backend';
12
+ import { Icon } from '../components/Icon';
13
+ import { BoxProps } from '../components/Box';
14
+ import { UI_DISABLED, UI_INTERACTIVE, UI_UPDATE } from '../src/constants';
15
+ import { useDebug } from '..//debug';
16
+ import { toggleKitchenSink } from '../debug/actions';
17
+ import {
18
+ dragStartHandler,
19
+ recallWindowGeometry,
20
+ resizeStartHandler,
21
+ setWindowKey,
22
+ } from '../src/drag';
23
+ import { Layout } from './Layout';
24
+
25
+ const DEFAULT_SIZE: [number, number] = [400, 600];
26
+
27
+ type Props = Partial<{
28
+ buttons: ReactNode;
29
+ canClose: boolean;
30
+ height: number;
31
+ theme: string;
32
+ title: string;
33
+ width: number;
34
+ }> &
35
+ PropsWithChildren;
36
+
37
+ export const Window = (props: Props) => {
38
+ const {
39
+ canClose = true,
40
+ theme,
41
+ title,
42
+ children,
43
+ buttons,
44
+ width,
45
+ height,
46
+ } = props;
47
+
48
+ const { config, suspended } = useBackend();
49
+ const { debugLayout = false } = useDebug();
50
+
51
+ useEffect(() => {
52
+ const updateGeometry = () => {
53
+ const options = {
54
+ ...config.window,
55
+ size: DEFAULT_SIZE,
56
+ };
57
+
58
+ if (width && height) {
59
+ options.size = [width, height];
60
+ }
61
+ if (config.window?.key) {
62
+ setWindowKey(config.window.key);
63
+ }
64
+ recallWindowGeometry(options);
65
+ };
66
+
67
+ Byond.winset(Byond.windowId, {
68
+ 'can-close': Boolean(canClose),
69
+ });
70
+
71
+ updateGeometry();
72
+
73
+ return () => {};
74
+ }, [width, height]);
75
+
76
+ const dispatch = globalStore.dispatch;
77
+ const fancy = config.window?.fancy;
78
+
79
+ // Determine when to show dimmer
80
+ const showDimmer =
81
+ config.user &&
82
+ (config.user.observer
83
+ ? config.status < UI_DISABLED
84
+ : config.status < UI_INTERACTIVE);
85
+
86
+ return suspended ? null : (
87
+ <Layout className="Window" theme={theme}>
88
+ <TitleBar
89
+ className="Window__titleBar"
90
+ title={title || decodeHtmlEntities(config.title)}
91
+ status={config.status}
92
+ fancy={fancy}
93
+ onDragStart={dragStartHandler}
94
+ onClose={() => {
95
+ dispatch(backendSuspendStart());
96
+ }}
97
+ canClose={canClose}
98
+ >
99
+ {buttons}
100
+ </TitleBar>
101
+ <div className={classes(['Window__rest', debugLayout && 'debug-layout'])}>
102
+ {!suspended && children}
103
+ {showDimmer && <div className="Window__dimmer" />}
104
+ </div>
105
+ {fancy && (
106
+ <>
107
+ <div
108
+ className="Window__resizeHandle__e"
109
+ onMouseDown={resizeStartHandler(1, 0) as any}
110
+ />
111
+ <div
112
+ className="Window__resizeHandle__s"
113
+ onMouseDown={resizeStartHandler(0, 1) as any}
114
+ />
115
+ <div
116
+ className="Window__resizeHandle__se"
117
+ onMouseDown={resizeStartHandler(1, 1) as any}
118
+ />
119
+ </>
120
+ )}
121
+ </Layout>
122
+ );
123
+ };
124
+
125
+ type ContentProps = Partial<{
126
+ className: string;
127
+ fitted: boolean;
128
+ scrollable: boolean;
129
+ vertical: boolean;
130
+ }> &
131
+ BoxProps &
132
+ PropsWithChildren;
133
+
134
+ const WindowContent = (props: ContentProps) => {
135
+ const { className, fitted, children, ...rest } = props;
136
+
137
+ return (
138
+ <Layout.Content
139
+ className={classes(['Window__content', className])}
140
+ {...rest}
141
+ >
142
+ {(fitted && children) || (
143
+ <div className="Window__contentPadding">{children}</div>
144
+ )}
145
+ </Layout.Content>
146
+ );
147
+ };
148
+
149
+ Window.Content = WindowContent;
150
+
151
+ const statusToColor = (status) => {
152
+ switch (status) {
153
+ case UI_INTERACTIVE:
154
+ return 'good';
155
+ case UI_UPDATE:
156
+ return 'average';
157
+ case UI_DISABLED:
158
+ default:
159
+ return 'bad';
160
+ }
161
+ };
162
+
163
+ type TitleBarProps = Partial<{
164
+ canClose: boolean;
165
+ className: string;
166
+ fancy: boolean;
167
+ onClose: (e) => void;
168
+ onDragStart: (e) => void;
169
+ status: number;
170
+ title: string;
171
+ }> &
172
+ PropsWithChildren;
173
+
174
+ const TitleBar = (props: TitleBarProps) => {
175
+ const {
176
+ className,
177
+ title,
178
+ status,
179
+ canClose,
180
+ fancy,
181
+ onDragStart,
182
+ onClose,
183
+ children,
184
+ } = props;
185
+ const dispatch = globalStore.dispatch;
186
+
187
+ const finalTitle =
188
+ (typeof title === 'string' &&
189
+ title === title.toLowerCase() &&
190
+ toTitleCase(title)) ||
191
+ title;
192
+
193
+ return (
194
+ <div className={classes(['TitleBar', className])}>
195
+ {(status === undefined && (
196
+ <Icon className="TitleBar__statusIcon" name="tools" opacity={0.5} />
197
+ )) || (
198
+ <Icon
199
+ className="TitleBar__statusIcon"
200
+ color={statusToColor(status)}
201
+ name="eye"
202
+ />
203
+ )}
204
+ <div
205
+ className="TitleBar__dragZone"
206
+ onMouseDown={(e) => fancy && onDragStart && onDragStart(e)}
207
+ />
208
+ <div className="TitleBar__title">
209
+ {finalTitle}
210
+ {!!children && <div className="TitleBar__buttons">{children}</div>}
211
+ </div>
212
+ {process.env.NODE_ENV !== 'production' && (
213
+ <div
214
+ className="TitleBar__devBuildIndicator"
215
+ onClick={() => dispatch(toggleKitchenSink())}
216
+ >
217
+ <Icon name="bug" />
218
+ </div>
219
+ )}
220
+ {Boolean(fancy && canClose) && (
221
+ <div className="TitleBar__close TitleBar__clickable" onClick={onClose}>
222
+ ×
223
+ </div>
224
+ )}
225
+ </div>
226
+ );
227
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @file
3
+ * @copyright 2020 Aleksej Komarov
4
+ * @license MIT
5
+ */
6
+
7
+ export { Layout } from './Layout';
8
+ export { NtosWindow } from './NtosWindow';
9
+ export { Pane } from './Pane';
10
+ export { Window } from './Window';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tgui-core",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "TGUI core component library",
5
5
  "keywords": [
6
6
  "TGUI",
@@ -18,6 +18,7 @@
18
18
  "devDependencies": {
19
19
  "@types/node": "^20.12.12",
20
20
  "@types/react": "^18.3.3",
21
- "@types/react-dom": "^18.3.0"
21
+ "@types/react-dom": "^18.3.0",
22
+ "@types/webpack-env": "^1.18.5"
22
23
  }
23
24
  }
package/src/assets.ts CHANGED
@@ -1,43 +1,43 @@
1
- /**
2
- * @file
3
- * @copyright 2020 Aleksej Komarov
4
- * @license MIT
5
- */
6
-
7
- import { Action, AnyAction, Dispatch, Middleware } from './common/redux';
8
-
9
- const EXCLUDED_PATTERNS = [/v4shim/i];
10
- const loadedMappings: Record<string, string> = {};
11
-
12
- export const resolveAsset = (name: string): string =>
13
- loadedMappings[name] || name;
14
-
15
- export const assetMiddleware: Middleware =
16
- (storeApi) =>
17
- <ActionType extends Action = AnyAction>(next: Dispatch<ActionType>) =>
18
- (action: ActionType) => {
19
- const { type, payload } = action as AnyAction;
20
- if (type === 'asset/stylesheet') {
21
- Byond.loadCss(payload);
22
- return;
23
- }
24
- if (type === 'asset/mappings') {
25
- for (const name of Object.keys(payload)) {
26
- // Skip anything that matches excluded patterns
27
- if (EXCLUDED_PATTERNS.some((regex) => regex.test(name))) {
28
- continue;
29
- }
30
- const url = payload[name];
31
- const ext = name.split('.').pop();
32
- loadedMappings[name] = url;
33
- if (ext === 'css') {
34
- Byond.loadCss(url);
35
- }
36
- if (ext === 'js') {
37
- Byond.loadJs(url);
38
- }
39
- }
40
- return;
41
- }
42
- next(action);
43
- };
1
+ /**
2
+ * @file
3
+ * @copyright 2020 Aleksej Komarov
4
+ * @license MIT
5
+ */
6
+
7
+ import { Action, AnyAction, Dispatch, Middleware } from '../common/redux';
8
+
9
+ const EXCLUDED_PATTERNS = [/v4shim/i];
10
+ const loadedMappings: Record<string, string> = {};
11
+
12
+ export const resolveAsset = (name: string): string =>
13
+ loadedMappings[name] || name;
14
+
15
+ export const assetMiddleware: Middleware =
16
+ (storeApi) =>
17
+ <ActionType extends Action = AnyAction>(next: Dispatch<ActionType>) =>
18
+ (action: ActionType) => {
19
+ const { type, payload } = action as AnyAction;
20
+ if (type === 'asset/stylesheet') {
21
+ Byond.loadCss(payload);
22
+ return;
23
+ }
24
+ if (type === 'asset/mappings') {
25
+ for (const name of Object.keys(payload)) {
26
+ // Skip anything that matches excluded patterns
27
+ if (EXCLUDED_PATTERNS.some((regex) => regex.test(name))) {
28
+ continue;
29
+ }
30
+ const url = payload[name];
31
+ const ext = name.split('.').pop();
32
+ loadedMappings[name] = url;
33
+ if (ext === 'css') {
34
+ Byond.loadCss(url);
35
+ }
36
+ if (ext === 'js') {
37
+ Byond.loadJs(url);
38
+ }
39
+ }
40
+ return;
41
+ }
42
+ next(action);
43
+ };