tgui-core 2.0.5 → 2.1.0

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 (121) hide show
  1. package/dist/common/collections.d.ts +1 -1
  2. package/dist/common/collections.js +1 -10
  3. package/dist/common/color.js +1 -70
  4. package/dist/common/constants.js +1 -329
  5. package/dist/common/events.js +1 -147
  6. package/dist/common/exhaustive.js +1 -6
  7. package/dist/common/format.js +1 -117
  8. package/dist/common/fp.js +1 -9
  9. package/dist/common/hotkeys.d.ts +1 -1
  10. package/dist/common/hotkeys.js +1 -112
  11. package/dist/common/http.js +1 -10
  12. package/dist/common/keycodes.js +1 -88
  13. package/dist/common/keys.js +1 -32
  14. package/dist/common/math.js +1 -45
  15. package/dist/common/random.js +1 -21
  16. package/dist/common/react.js +1 -30
  17. package/dist/common/string.js +1 -88
  18. package/dist/common/timer.js +1 -28
  19. package/dist/common/type-utils.js +1 -25
  20. package/dist/common/ui.d.ts +2 -2
  21. package/dist/common/ui.js +1 -141
  22. package/dist/common/uuid.js +1 -10
  23. package/dist/common/vector.js +1 -48
  24. package/dist/components/AnimatedNumber.d.ts +1 -1
  25. package/dist/components/AnimatedNumber.js +1 -73
  26. package/dist/components/Autofocus.d.ts +1 -1
  27. package/dist/components/Autofocus.js +1 -17
  28. package/dist/components/Blink.d.ts +1 -1
  29. package/dist/components/Blink.js +1 -56
  30. package/dist/components/BlockQuote.d.ts +1 -1
  31. package/dist/components/BlockQuote.js +1 -10
  32. package/dist/components/Box.d.ts +5 -5
  33. package/dist/components/Box.js +1 -19
  34. package/dist/components/Button.d.ts +4 -4
  35. package/dist/components/Button.js +1 -258
  36. package/dist/components/ByondUi.d.ts +1 -1
  37. package/dist/components/ByondUi.js +1 -61
  38. package/dist/components/Chart.d.ts +1 -1
  39. package/dist/components/Chart.js +1 -80
  40. package/dist/components/Collapsible.d.ts +2 -2
  41. package/dist/components/Collapsible.js +1 -36
  42. package/dist/components/ColorBox.d.ts +2 -2
  43. package/dist/components/ColorBox.js +1 -17
  44. package/dist/components/Dialog.d.ts +1 -1
  45. package/dist/components/Dialog.js +1 -42
  46. package/dist/components/Dimmer.d.ts +1 -1
  47. package/dist/components/Dimmer.js +1 -10
  48. package/dist/components/Divider.js +1 -18
  49. package/dist/components/DmIcon.d.ts +3 -3
  50. package/dist/components/DmIcon.js +1 -23
  51. package/dist/components/DraggableControl.d.ts +2 -2
  52. package/dist/components/DraggableControl.js +1 -111
  53. package/dist/components/Dropdown.d.ts +2 -2
  54. package/dist/components/Dropdown.js +1 -165
  55. package/dist/components/FitText.d.ts +2 -2
  56. package/dist/components/FitText.js +1 -63
  57. package/dist/components/Flex.d.ts +1 -1
  58. package/dist/components/Flex.js +1 -70
  59. package/dist/components/Floating.d.ts +3 -3
  60. package/dist/components/Floating.js +1 -2235
  61. package/dist/components/Icon.d.ts +2 -2
  62. package/dist/components/Icon.js +1 -45
  63. package/dist/components/Image.d.ts +1 -1
  64. package/dist/components/Image.js +1 -38
  65. package/dist/components/ImageButton.d.ts +10 -5
  66. package/dist/components/ImageButton.js +1 -154
  67. package/dist/components/InfinitePlane.d.ts +2 -2
  68. package/dist/components/InfinitePlane.js +1 -133
  69. package/dist/components/Input.d.ts +2 -2
  70. package/dist/components/Input.js +1 -96
  71. package/dist/components/KeyListener.d.ts +1 -1
  72. package/dist/components/KeyListener.js +1 -15
  73. package/dist/components/Knob.d.ts +2 -2
  74. package/dist/components/Knob.js +1 -133
  75. package/dist/components/LabeledControls.d.ts +1 -1
  76. package/dist/components/LabeledControls.js +1 -39
  77. package/dist/components/LabeledList.d.ts +2 -2
  78. package/dist/components/LabeledList.js +1 -89
  79. package/dist/components/MenuBar.d.ts +32 -0
  80. package/dist/components/MenuBar.js +1 -133
  81. package/dist/components/Modal.d.ts +2 -2
  82. package/dist/components/Modal.js +1 -22
  83. package/dist/components/NoticeBox.d.ts +1 -1
  84. package/dist/components/NoticeBox.js +1 -23
  85. package/dist/components/NumberInput.d.ts +9 -19
  86. package/dist/components/NumberInput.js +1 -213
  87. package/dist/components/Popper.d.ts +8 -9
  88. package/dist/components/Popper.js +1 -1082
  89. package/dist/components/ProgressBar.d.ts +2 -2
  90. package/dist/components/ProgressBar.js +1 -33
  91. package/dist/components/RestrictedInput.d.ts +29 -0
  92. package/dist/components/RestrictedInput.js +1 -161
  93. package/dist/components/RoundGauge.d.ts +2 -2
  94. package/dist/components/RoundGauge.js +1 -114
  95. package/dist/components/Section.d.ts +30 -44
  96. package/dist/components/Section.js +1 -66
  97. package/dist/components/Slider.d.ts +2 -2
  98. package/dist/components/Slider.js +1 -113
  99. package/dist/components/Stack.d.ts +2 -2
  100. package/dist/components/Stack.js +1 -58
  101. package/dist/components/StyleableSection.d.ts +1 -1
  102. package/dist/components/StyleableSection.js +1 -16
  103. package/dist/components/Table.d.ts +1 -1
  104. package/dist/components/Table.js +1 -57
  105. package/dist/components/Tabs.d.ts +2 -2
  106. package/dist/components/Tabs.js +1 -65
  107. package/dist/components/TextArea.d.ts +14 -28
  108. package/dist/components/TextArea.js +1 -139
  109. package/dist/components/TimeDisplay.js +1 -25
  110. package/dist/components/Tooltip.d.ts +2 -2
  111. package/dist/components/Tooltip.js +1 -18
  112. package/dist/components/TrackOutsideClicks.d.ts +2 -2
  113. package/dist/components/TrackOutsideClicks.js +1 -24
  114. package/dist/components/VirtualList.d.ts +1 -1
  115. package/dist/components/VirtualList.js +1 -34
  116. package/dist/components/index.js +1 -96
  117. package/license.txt +1 -1
  118. package/package.json +11 -17
  119. package/styles/components/Button.scss +1 -1
  120. package/styles/components/TextArea.scss +7 -0
  121. package/dist/components/FakeTerminal.js +0 -38
@@ -13,5 +13,5 @@ export declare function zip<T extends unknown[][]>(...arr: T): Zip<T>;
13
13
  * @param b second string to compare
14
14
  * @returns -1 for a < b, 1 for a > b and 0 otherwise
15
15
  */
16
- export declare function stringCompare(a: string, b: string): 0 | 1 | -1;
16
+ export declare function stringCompare(a: string, b: string): 1 | -1 | 0;
17
17
  export {};
@@ -1,10 +1 @@
1
- function p(...n) {
2
- return Array(Math.max(...n.map((t) => t.length))).fill(void 0).map((t, r) => n.map((i) => i[r]));
3
- }
4
- function a(n, t) {
5
- return n < t ? -1 : n > t ? 1 : 0;
6
- }
7
- export {
8
- a as stringCompare,
9
- p as zip
10
- };
1
+ function r(...n){return Array(Math.max(...n.map(r=>r.length))).fill(void 0).map((r,t)=>n.map(r=>r[t]))}function n(r,n){return r<n?-1:+(r>n)}export{n as stringCompare,r as zip};
@@ -1,70 +1 @@
1
- var g = Object.defineProperty;
2
- var u = (e, t, r) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var i = (e, t, r) => u(e, typeof t != "symbol" ? t + "" : t, r);
4
- class n {
5
- constructor(t = 0, r = 0, s = 0, a = 1) {
6
- i(this, "r");
7
- i(this, "g");
8
- i(this, "b");
9
- i(this, "a");
10
- this.r = t, this.g = r, this.b = s, this.a = a;
11
- }
12
- toString() {
13
- let t = this.a;
14
- return typeof t == "string" && (t = Number.parseFloat(this.a)), Number.isNaN(t) && (t = 1), `rgba(${this.r | 0}, ${this.g | 0}, ${this.b | 0}, ${t})`;
15
- }
16
- /** Darkens a color by a given percent. Returns a color, which can have toString called to get it's rgba() css value. */
17
- darken(t) {
18
- const r = t / 100;
19
- return new n(
20
- this.r - this.r * r,
21
- this.g - this.g * r,
22
- this.b - this.b * r,
23
- this.a
24
- );
25
- }
26
- /** Brightens a color by a given percent. Returns a color, which can have toString called to get it's rgba() css value. */
27
- lighten(t) {
28
- return this.darken(-t);
29
- }
30
- /**
31
- * Creates a color from the CSS hex color notation.
32
- */
33
- static fromHex(t) {
34
- return new n(
35
- Number.parseInt(t.slice(1, 3), 16),
36
- Number.parseInt(t.slice(3, 5), 16),
37
- Number.parseInt(t.slice(5, 7), 16)
38
- );
39
- }
40
- /**
41
- * Linear interpolation of two colors.
42
- */
43
- static lerp(t, r, s) {
44
- return new n(
45
- (r.r - t.r) * s + t.r,
46
- (r.g - t.g) * s + t.g,
47
- (r.b - t.b) * s + t.b,
48
- (r.a - t.a) * s + t.a
49
- );
50
- }
51
- /**
52
- * Loops up the color in the provided list of colors
53
- * with linear interpolation.
54
- */
55
- static lookup(t, r) {
56
- const s = r.length;
57
- if (s < 2)
58
- throw new Error("Needs at least two colors!");
59
- const a = t * (s - 1);
60
- if (t < 1e-4)
61
- return r[0];
62
- if (t >= 1 - 1e-4)
63
- return r[s - 1];
64
- const b = a % 1, h = a | 0;
65
- return n.lerp(r[h], r[h + 1], b);
66
- }
67
- }
68
- export {
69
- n as Color
70
- };
1
+ class t{r;g;b;a;constructor(t=0,r=0,e=0,s=1){this.r=t,this.g=r,this.b=e,this.a=s}toString(){let t=this.a;return"string"==typeof t&&(t=Number.parseFloat(this.a)),Number.isNaN(t)&&(t=1),`rgba(${0|this.r}, ${0|this.g}, ${0|this.b}, ${t})`}darken(r){let e=r/100;return new t(this.r-this.r*e,this.g-this.g*e,this.b-this.b*e,this.a)}lighten(t){return this.darken(-t)}static fromHex(r){return new t(Number.parseInt(r.slice(1,3),16),Number.parseInt(r.slice(3,5),16),Number.parseInt(r.slice(5,7),16))}static lerp(r,e,s){return new t((e.r-r.r)*s+r.r,(e.g-r.g)*s+r.g,(e.b-r.b)*s+r.b,(e.a-r.a)*s+r.a)}static lookup(r,e){let s=e.length;if(s<2)throw Error("Needs at least two colors!");let i=r*(s-1);if(r<1e-4)return e[0];if(r>=.9999)return e[s-1];let a=0|i;return t.lerp(e[a],e[a+1],i%1)}}export{t as Color};
@@ -1,329 +1 @@
1
- const t = 2, n = 1, i = 0, m = -1, c = {
2
- // Department colors
3
- department: {
4
- captain: "#c06616",
5
- security: "#e74c3c",
6
- medbay: "#3498db",
7
- science: "#9b59b6",
8
- engineering: "#f1c40f",
9
- cargo: "#f39c12",
10
- service: "#7cc46a",
11
- centcom: "#00c100",
12
- other: "#c38312"
13
- },
14
- // Damage type colors
15
- damageType: {
16
- oxy: "#3498db",
17
- toxin: "#2ecc71",
18
- burn: "#e67e22",
19
- brute: "#e74c3c"
20
- },
21
- // reagent / chemistry related colours
22
- reagent: {
23
- acidicbuffer: "#fbc314",
24
- basicbuffer: "#3853a4"
25
- }
26
- }, u = [
27
- "average",
28
- "bad",
29
- "black",
30
- "blue",
31
- "brown",
32
- "good",
33
- "green",
34
- "grey",
35
- "label",
36
- "olive",
37
- "orange",
38
- "pink",
39
- "purple",
40
- "red",
41
- "teal",
42
- "transparent",
43
- "violet",
44
- "white",
45
- "yellow"
46
- ], d = [
47
- {
48
- name: "Syndicate",
49
- freq: 1213,
50
- color: "#8f4a4b"
51
- },
52
- {
53
- name: "Red Team",
54
- freq: 1215,
55
- color: "#ff4444"
56
- },
57
- {
58
- name: "Blue Team",
59
- freq: 1217,
60
- color: "#3434fd"
61
- },
62
- {
63
- name: "Green Team",
64
- freq: 1219,
65
- color: "#34fd34"
66
- },
67
- {
68
- name: "Yellow Team",
69
- freq: 1221,
70
- color: "#fdfd34"
71
- },
72
- {
73
- name: "CentCom",
74
- freq: 1337,
75
- color: "#2681a5"
76
- },
77
- {
78
- name: "Supply",
79
- freq: 1347,
80
- color: "#b88646"
81
- },
82
- {
83
- name: "Service",
84
- freq: 1349,
85
- color: "#6ca729"
86
- },
87
- {
88
- name: "Science",
89
- freq: 1351,
90
- color: "#c68cfa"
91
- },
92
- {
93
- name: "Command",
94
- freq: 1353,
95
- color: "#fcdf03"
96
- },
97
- {
98
- name: "Medical",
99
- freq: 1355,
100
- color: "#57b8f0"
101
- },
102
- {
103
- name: "Engineering",
104
- freq: 1357,
105
- color: "#f37746"
106
- },
107
- {
108
- name: "Security",
109
- freq: 1359,
110
- color: "#dd3535"
111
- },
112
- {
113
- name: "AI Private",
114
- freq: 1447,
115
- color: "#d65d95"
116
- },
117
- {
118
- name: "Common",
119
- freq: 1459,
120
- color: "#1ecc43"
121
- }
122
- ], e = [
123
- {
124
- id: "o2",
125
- path: "/datum/gas/oxygen",
126
- name: "Oxygen",
127
- label: "O₂",
128
- color: "blue"
129
- },
130
- {
131
- id: "n2",
132
- path: "/datum/gas/nitrogen",
133
- name: "Nitrogen",
134
- label: "N₂",
135
- color: "yellow"
136
- },
137
- {
138
- id: "co2",
139
- path: "/datum/gas/carbon_dioxide",
140
- name: "Carbon Dioxide",
141
- label: "CO₂",
142
- color: "grey"
143
- },
144
- {
145
- id: "plasma",
146
- path: "/datum/gas/plasma",
147
- name: "Plasma",
148
- label: "Plasma",
149
- color: "pink"
150
- },
151
- {
152
- id: "water_vapor",
153
- path: "/datum/gas/water_vapor",
154
- name: "Water Vapor",
155
- label: "H₂O",
156
- color: "lightsteelblue"
157
- },
158
- {
159
- id: "hypernoblium",
160
- path: "/datum/gas/hypernoblium",
161
- name: "Hyper-noblium",
162
- label: "Hyper-nob",
163
- color: "teal"
164
- },
165
- {
166
- id: "n2o",
167
- path: "/datum/gas/nitrous_oxide",
168
- name: "Nitrous Oxide",
169
- label: "N₂O",
170
- color: "bisque"
171
- },
172
- {
173
- id: "no2",
174
- path: "/datum/gas/nitrium",
175
- name: "Nitrium",
176
- label: "Nitrium",
177
- color: "brown"
178
- },
179
- {
180
- id: "tritium",
181
- path: "/datum/gas/tritium",
182
- name: "Tritium",
183
- label: "Tritium",
184
- color: "limegreen"
185
- },
186
- {
187
- id: "bz",
188
- path: "/datum/gas/bz",
189
- name: "BZ",
190
- label: "BZ",
191
- color: "mediumpurple"
192
- },
193
- {
194
- id: "pluoxium",
195
- path: "/datum/gas/pluoxium",
196
- name: "Pluoxium",
197
- label: "Pluoxium",
198
- color: "mediumslateblue"
199
- },
200
- {
201
- id: "miasma",
202
- path: "/datum/gas/miasma",
203
- name: "Miasma",
204
- label: "Miasma",
205
- color: "olive"
206
- },
207
- {
208
- id: "freon",
209
- path: "/datum/gas/freon",
210
- name: "Freon",
211
- label: "Freon",
212
- color: "paleturquoise"
213
- },
214
- {
215
- id: "hydrogen",
216
- path: "/datum/gas/hydrogen",
217
- name: "Hydrogen",
218
- label: "H₂",
219
- color: "white"
220
- },
221
- {
222
- id: "healium",
223
- path: "/datum/gas/healium",
224
- name: "Healium",
225
- label: "Healium",
226
- color: "salmon"
227
- },
228
- {
229
- id: "proto_nitrate",
230
- path: "/datum/gas/proto_nitrate",
231
- name: "Proto Nitrate",
232
- label: "Proto-Nitrate",
233
- color: "greenyellow"
234
- },
235
- {
236
- id: "zauker",
237
- path: "/datum/gas/zauker",
238
- name: "Zauker",
239
- label: "Zauker",
240
- color: "darkgreen"
241
- },
242
- {
243
- id: "halon",
244
- path: "/datum/gas/halon",
245
- name: "Halon",
246
- label: "Halon",
247
- color: "purple"
248
- },
249
- {
250
- id: "helium",
251
- path: "/datum/gas/helium",
252
- name: "Helium",
253
- label: "He",
254
- color: "aliceblue"
255
- },
256
- {
257
- id: "antinoblium",
258
- path: "/datum/gas/antinoblium",
259
- name: "Antinoblium",
260
- label: "Anti-Noblium",
261
- color: "maroon"
262
- },
263
- {
264
- id: "nitrium",
265
- path: "/datum/gas/nitrium",
266
- name: "Nitrium",
267
- label: "Nitrium",
268
- color: "brown"
269
- }
270
- ];
271
- function b(a, o) {
272
- if (!a) return o || "None";
273
- const r = a.toLowerCase();
274
- for (let l = 0; l < e.length; l++)
275
- if (e[l].id === r)
276
- return e[l].label;
277
- return o || "None";
278
- }
279
- function s(a) {
280
- if (!a) return "black";
281
- const o = a.toLowerCase();
282
- for (let r = 0; r < e.length; r++)
283
- if (e[r].id === o)
284
- return e[r].color;
285
- return "black";
286
- }
287
- const g = (a) => {
288
- if (!a) return;
289
- const o = a.toLowerCase();
290
- for (let r = 0; r < e.length; r++)
291
- if (e[r].id === o)
292
- return e[r];
293
- }, p = (a) => {
294
- if (a) {
295
- for (let o = 0; o < e.length; o++)
296
- if (e[o].path === a)
297
- return e[o];
298
- }
299
- }, f = {
300
- states: ["", "good", "average", "bad", "black", "white"],
301
- spectrum: [
302
- "red",
303
- "orange",
304
- "yellow",
305
- "olive",
306
- "green",
307
- "teal",
308
- "blue",
309
- "violet",
310
- "purple",
311
- "pink",
312
- "brown",
313
- "grey"
314
- ]
315
- };
316
- export {
317
- c as COLORS,
318
- f as COMPONENT_COLORS,
319
- u as CSS_COLORS,
320
- d as RADIO_CHANNELS,
321
- m as UI_CLOSE,
322
- i as UI_DISABLED,
323
- t as UI_INTERACTIVE,
324
- n as UI_UPDATE,
325
- s as getGasColor,
326
- g as getGasFromId,
327
- p as getGasFromPath,
328
- b as getGasLabel
329
- };
1
+ let e=2,a=1,o=0,r=-1,l={department:{captain:"#c06616",security:"#e74c3c",medbay:"#3498db",science:"#9b59b6",engineering:"#f1c40f",cargo:"#f39c12",service:"#7cc46a",centcom:"#00c100",other:"#c38312"},damageType:{oxy:"#3498db",toxin:"#2ecc71",burn:"#e67e22",brute:"#e74c3c"},reagent:{acidicbuffer:"#fbc314",basicbuffer:"#3853a4"}},t=["average","bad","black","blue","brown","good","green","grey","label","olive","orange","pink","purple","red","teal","transparent","violet","white","yellow"],i=[{name:"Syndicate",freq:1213,color:"#8f4a4b"},{name:"Red Team",freq:1215,color:"#ff4444"},{name:"Blue Team",freq:1217,color:"#3434fd"},{name:"Green Team",freq:1219,color:"#34fd34"},{name:"Yellow Team",freq:1221,color:"#fdfd34"},{name:"CentCom",freq:1337,color:"#2681a5"},{name:"Supply",freq:1347,color:"#b88646"},{name:"Service",freq:1349,color:"#6ca729"},{name:"Science",freq:1351,color:"#c68cfa"},{name:"Command",freq:1353,color:"#fcdf03"},{name:"Medical",freq:1355,color:"#57b8f0"},{name:"Engineering",freq:1357,color:"#f37746"},{name:"Security",freq:1359,color:"#dd3535"},{name:"AI Private",freq:1447,color:"#d65d95"},{name:"Common",freq:1459,color:"#1ecc43"}],n=[{id:"o2",path:"/datum/gas/oxygen",name:"Oxygen",label:"O₂",color:"blue"},{id:"n2",path:"/datum/gas/nitrogen",name:"Nitrogen",label:"N₂",color:"yellow"},{id:"co2",path:"/datum/gas/carbon_dioxide",name:"Carbon Dioxide",label:"CO₂",color:"grey"},{id:"plasma",path:"/datum/gas/plasma",name:"Plasma",label:"Plasma",color:"pink"},{id:"water_vapor",path:"/datum/gas/water_vapor",name:"Water Vapor",label:"H₂O",color:"lightsteelblue"},{id:"hypernoblium",path:"/datum/gas/hypernoblium",name:"Hyper-noblium",label:"Hyper-nob",color:"teal"},{id:"n2o",path:"/datum/gas/nitrous_oxide",name:"Nitrous Oxide",label:"N₂O",color:"bisque"},{id:"no2",path:"/datum/gas/nitrium",name:"Nitrium",label:"Nitrium",color:"brown"},{id:"tritium",path:"/datum/gas/tritium",name:"Tritium",label:"Tritium",color:"limegreen"},{id:"bz",path:"/datum/gas/bz",name:"BZ",label:"BZ",color:"mediumpurple"},{id:"pluoxium",path:"/datum/gas/pluoxium",name:"Pluoxium",label:"Pluoxium",color:"mediumslateblue"},{id:"miasma",path:"/datum/gas/miasma",name:"Miasma",label:"Miasma",color:"olive"},{id:"freon",path:"/datum/gas/freon",name:"Freon",label:"Freon",color:"paleturquoise"},{id:"hydrogen",path:"/datum/gas/hydrogen",name:"Hydrogen",label:"H₂",color:"white"},{id:"healium",path:"/datum/gas/healium",name:"Healium",label:"Healium",color:"salmon"},{id:"proto_nitrate",path:"/datum/gas/proto_nitrate",name:"Proto Nitrate",label:"Proto-Nitrate",color:"greenyellow"},{id:"zauker",path:"/datum/gas/zauker",name:"Zauker",label:"Zauker",color:"darkgreen"},{id:"halon",path:"/datum/gas/halon",name:"Halon",label:"Halon",color:"purple"},{id:"helium",path:"/datum/gas/helium",name:"Helium",label:"He",color:"aliceblue"},{id:"antinoblium",path:"/datum/gas/antinoblium",name:"Antinoblium",label:"Anti-Noblium",color:"maroon"},{id:"nitrium",path:"/datum/gas/nitrium",name:"Nitrium",label:"Nitrium",color:"brown"}];function m(e,a){if(!e)return a||"None";let o=e.toLowerCase();for(let e=0;e<n.length;e++)if(n[e].id===o)return n[e].label;return a||"None"}function u(e){if(!e)return"black";let a=e.toLowerCase();for(let e=0;e<n.length;e++)if(n[e].id===a)return n[e].color;return"black"}let c=e=>{if(!e)return;let a=e.toLowerCase();for(let e=0;e<n.length;e++)if(n[e].id===a)return n[e]},d=e=>{if(e){for(let a=0;a<n.length;a++)if(n[a].path===e)return n[a]}},b={states:["","good","average","bad","black","white"],spectrum:["red","orange","yellow","olive","green","teal","blue","violet","purple","pink","brown","grey"]};export{l as COLORS,b as COMPONENT_COLORS,t as CSS_COLORS,i as RADIO_CHANNELS,r as UI_CLOSE,o as UI_DISABLED,e as UI_INTERACTIVE,a as UI_UPDATE,u as getGasColor,c as getGasFromId,d as getGasFromPath,m as getGasLabel};
@@ -1,147 +1 @@
1
- var _ = Object.defineProperty;
2
- var v = (t, e, s) => e in t ? _(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var i = (t, e, s) => v(t, typeof e != "symbol" ? e + "" : e, s);
4
- import { KEY_CTRL as F, KEY_SHIFT as L, KEY_ALT as b, KEY_F1 as K, KEY_F12 as S } from "./keycodes.js";
5
- class C {
6
- constructor() {
7
- i(this, "listeners");
8
- this.listeners = {};
9
- }
10
- on(e, s) {
11
- this.listeners[e] = this.listeners[e] || [], this.listeners[e].push(s);
12
- }
13
- off(e, s) {
14
- const n = this.listeners[e];
15
- if (!n)
16
- throw new Error(`There is no listeners for "${e}"`);
17
- this.listeners[e] = n.filter((l) => l !== s);
18
- }
19
- emit(e, ...s) {
20
- const n = this.listeners[e];
21
- if (n)
22
- for (let l = 0, k = n.length; l < k; l += 1) {
23
- const g = n[l];
24
- g(...s);
25
- }
26
- }
27
- clear() {
28
- this.listeners = {};
29
- }
30
- }
31
- const o = new C();
32
- let m = !1;
33
- const W = (t = {}) => {
34
- m = !!t.ignoreWindowFocus;
35
- };
36
- let d, f = !0;
37
- function u(t, e) {
38
- if (m) {
39
- f = !0;
40
- return;
41
- }
42
- if (d && (clearTimeout(d), d = null), e) {
43
- d = setTimeout(() => u(t));
44
- return;
45
- }
46
- f !== t && (f = t, o.emit(t ? "window-focus" : "window-blur"), o.emit("window-focus-change", t));
47
- }
48
- let r = null;
49
- function E(t) {
50
- const e = String(t.tagName).toLowerCase();
51
- return e === "input" || e === "textarea";
52
- }
53
- function T(t) {
54
- a(), r = t, r.addEventListener("blur", a);
55
- }
56
- function a() {
57
- r && (r.removeEventListener("blur", a), r = null);
58
- }
59
- let w = null, c = null;
60
- const h = [];
61
- function $(t) {
62
- h.push(t);
63
- }
64
- function A(t) {
65
- const e = h.indexOf(t);
66
- e >= 0 && h.splice(e, 1);
67
- }
68
- function N(t) {
69
- if (r || !f)
70
- return;
71
- const e = document.body;
72
- for (; t && t !== e; ) {
73
- if (h.includes(t)) {
74
- if (t.contains(w))
75
- return;
76
- w = t, t.focus();
77
- return;
78
- }
79
- t = t.parentElement;
80
- }
81
- }
82
- window.addEventListener("mousemove", (t) => {
83
- const e = t.target;
84
- e !== c && (c = e, N(e));
85
- });
86
- window.addEventListener("focusin", (t) => {
87
- c = null, w = t.target, u(!0), E(t.target) && T(t.target);
88
- });
89
- window.addEventListener("focusout", () => {
90
- c = null, u(!1, !0);
91
- });
92
- window.addEventListener("blur", () => {
93
- c = null, u(!1, !0);
94
- });
95
- window.addEventListener("beforeunload", () => {
96
- u(!1);
97
- });
98
- const y = {};
99
- class p {
100
- constructor(e, s, n) {
101
- i(this, "event");
102
- i(this, "type");
103
- i(this, "code");
104
- i(this, "ctrl");
105
- i(this, "shift");
106
- i(this, "alt");
107
- i(this, "repeat");
108
- i(this, "_str");
109
- this.event = e, this.type = s, this.code = e.keyCode, this.ctrl = e.ctrlKey, this.shift = e.shiftKey, this.alt = e.altKey, this.repeat = !!n;
110
- }
111
- hasModifierKeys() {
112
- return this.ctrl || this.alt || this.shift;
113
- }
114
- isModifierKey() {
115
- return this.code === F || this.code === L || this.code === b;
116
- }
117
- isDown() {
118
- return this.type === "keydown";
119
- }
120
- isUp() {
121
- return this.type === "keyup";
122
- }
123
- toString() {
124
- return this._str ? this._str : (this._str = "", this.ctrl && (this._str += "Ctrl+"), this.alt && (this._str += "Alt+"), this.shift && (this._str += "Shift+"), this.code >= 48 && this.code <= 90 ? this._str += String.fromCharCode(this.code) : this.code >= K && this.code <= S ? this._str += `F${this.code - 111}` : this._str += `[${this.code}]`, this._str);
125
- }
126
- }
127
- document.addEventListener("keydown", (t) => {
128
- if (E(t.target))
129
- return;
130
- const e = t.keyCode, s = new p(t, "keydown", y[e]);
131
- o.emit("keydown", s), o.emit("key", s), y[e] = !0;
132
- });
133
- document.addEventListener("keyup", (t) => {
134
- if (E(t.target))
135
- return;
136
- const e = t.keyCode, s = new p(t, "keyup");
137
- o.emit("keyup", s), o.emit("key", s), y[e] = !1;
138
- });
139
- export {
140
- C as EventEmitter,
141
- p as KeyEvent,
142
- $ as addScrollableNode,
143
- E as canStealFocus,
144
- o as globalEvents,
145
- A as removeScrollableNode,
146
- W as setupGlobalEvents
147
- };
1
+ let t;import*as e from"./keycodes.js";class i{listeners;constructor(){this.listeners={}}on(t,e){this.listeners[t]=this.listeners[t]||[],this.listeners[t].push(e)}off(t,e){let i=this.listeners[t];if(!i)throw Error(`There is no listeners for "${t}"`);this.listeners[t]=i.filter(t=>t!==e)}emit(t,...e){let i=this.listeners[t];if(i)for(let t=0,s=i.length;t<s;t+=1)(0,i[t])(...e)}clear(){this.listeners={}}}let s=new i,r=!1,n=(t={})=>{r=!!t.ignoreWindowFocus},o=!0;function l(e,i){if(r){o=!0;return}if(t&&(clearTimeout(t),t=null),i){t=setTimeout(()=>l(e));return}o!==e&&(o=e,s.emit(e?"window-focus":"window-blur"),s.emit("window-focus-change",e))}let d=null;function u(t){let e=String(t.tagName).toLowerCase();return"input"===e||"textarea"===e}function h(){d&&(d.removeEventListener("blur",h),d=null)}let c=null,a=null,f=[];function w(t){f.push(t)}function y(t){let e=f.indexOf(t);e>=0&&f.splice(e,1)}window.addEventListener("mousemove",t=>{let e=t.target;e!==a&&(a=e,function(t){if(d||!o)return;let e=document.body;for(;t&&t!==e;){if(f.includes(t)){if(t.contains(c))return;c=t,t.focus();return}t=t.parentElement}}(e))}),window.addEventListener("focusin",t=>{var e;a=null,c=t.target,l(!0),u(t.target)&&(e=t.target,h(),(d=e).addEventListener("blur",h))}),window.addEventListener("focusout",()=>{a=null,l(!1,!0)}),window.addEventListener("blur",()=>{a=null,l(!1,!0)}),window.addEventListener("beforeunload",()=>{l(!1)});let m={};class E{event;type;code;ctrl;shift;alt;repeat;_str;constructor(t,e,i){this.event=t,this.type=e,this.code=t.keyCode,this.ctrl=t.ctrlKey,this.shift=t.shiftKey,this.alt=t.altKey,this.repeat=!!i}hasModifierKeys(){return this.ctrl||this.alt||this.shift}isModifierKey(){return this.code===e.KEY_CTRL||this.code===e.KEY_SHIFT||this.code===e.KEY_ALT}isDown(){return"keydown"===this.type}isUp(){return"keyup"===this.type}toString(){return this._str||(this._str="",this.ctrl&&(this._str+="Ctrl+"),this.alt&&(this._str+="Alt+"),this.shift&&(this._str+="Shift+"),this.code>=48&&this.code<=90?this._str+=String.fromCharCode(this.code):this.code>=e.KEY_F1&&this.code<=e.KEY_F12?this._str+=`F${this.code-111}`:this._str+=`[${this.code}]`),this._str}}document.addEventListener("keydown",t=>{if(u(t.target))return;let e=t.keyCode,i=new E(t,"keydown",m[e]);s.emit("keydown",i),s.emit("key",i),m[e]=!0}),document.addEventListener("keyup",t=>{if(u(t.target))return;let e=t.keyCode,i=new E(t,"keyup");s.emit("keyup",i),s.emit("key",i),m[e]=!1});export{i as EventEmitter,E as KeyEvent,w as addScrollableNode,u as canStealFocus,s as globalEvents,y as removeScrollableNode,n as setupGlobalEvents};
@@ -1,6 +1 @@
1
- function n(e) {
2
- throw new Error(`Unhandled case: ${e}`);
3
- }
4
- export {
5
- n as exhaustiveCheck
6
- };
1
+ function e(e){throw Error(`Unhandled case: ${e}`)}export{e as exhaustiveCheck};