tgui-core 1.1.14 → 1.1.16

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.
@@ -96,7 +96,7 @@ export declare const RADIO_CHANNELS: readonly [{
96
96
  readonly color: "#1ecc43";
97
97
  }];
98
98
  export declare function getGasLabel(gasId: string, fallbackValue?: string): string;
99
- export declare function getGasColor(gasId: string): "black" | "blue" | "brown" | "grey" | "olive" | "pink" | "purple" | "teal" | "white" | "yellow" | "lightsteelblue" | "bisque" | "limegreen" | "mediumpurple" | "mediumslateblue" | "paleturquoise" | "salmon" | "greenyellow" | "darkgreen" | "aliceblue" | "maroon";
99
+ export declare function getGasColor(gasId: string): string;
100
100
  export declare const getGasFromId: (gasId: string) => Gas | undefined;
101
101
  export declare const getGasFromPath: (gasPath: string) => Gas | undefined;
102
102
  export {};
@@ -14,4 +14,4 @@
14
14
  * exhaustiveCheck(color);
15
15
  * }
16
16
  */
17
- export declare function exhaustiveCheck(input: never): void;
17
+ export declare function exhaustiveCheck(input: never): never;
@@ -1,11 +1,11 @@
1
- export declare const formatSiUnit: (value: number, minBase1000?: number, unit?: string) => string;
1
+ export declare function formatSiUnit(value: number, minBase1000?: number, unit?: string): string;
2
2
  export declare function formatPower(value: number, minBase1000?: number): string;
3
3
  export declare function formatEnergy(value: number, minBase1000?: number): string;
4
4
  export declare function formatMoney(value: number, precision?: number): string;
5
5
  export declare function formatDb(value: number): string;
6
- export declare const formatSiBaseTenUnit: (value: number, minBase1000?: number, unit?: string) => string;
6
+ export declare function formatSiBaseTenUnit(value: number, minBase1000?: number, unit?: string): string;
7
7
  /**
8
8
  * Formats decisecond count into HH:MM:SS display by default
9
9
  * "short" format does not pad and adds hms suffixes
10
10
  */
11
- export declare const formatTime: (val: number, formatType?: "short" | "default") => string;
11
+ export declare function formatTime(val: number, formatType?: 'short' | 'default'): string;
@@ -38,18 +38,19 @@ const d = [
38
38
  "F",
39
39
  "N",
40
40
  "H"
41
- ], l = d.indexOf(" "), m = (t, n = -l, s = "") => {
41
+ ], l = d.indexOf(" ");
42
+ function u(t, n = -l, s = "") {
42
43
  if (!isFinite(t))
43
44
  return t.toString();
44
45
  const o = Math.floor(Math.log10(Math.abs(t))), r = Math.max(n * 3, o), e = Math.floor(r / 3), i = d[Math.min(e + l, d.length - 1)];
45
46
  let a = (t / Math.pow(1e3, e)).toFixed(2);
46
47
  return a.endsWith(".00") ? a = a.slice(0, -3) : a.endsWith(".0") && (a = a.slice(0, -2)), `${a} ${i.trim()}${s}`.trim();
47
- };
48
+ }
48
49
  function S(t, n = 0) {
49
- return m(t, n, "W");
50
+ return u(t, n, "W");
50
51
  }
51
52
  function $(t, n = 0) {
52
- return m(t, n, "J");
53
+ return u(t, n, "J");
53
54
  }
54
55
  function b(t, n = 0) {
55
56
  if (!Number.isFinite(t))
@@ -89,26 +90,28 @@ const M = [
89
90
  "· 10³³",
90
91
  "· 10³⁶",
91
92
  "· 10³⁹"
92
- ], p = (t, n = 0, s = "") => {
93
+ ];
94
+ function p(t, n = 0, s = "") {
93
95
  if (!isFinite(t))
94
96
  return "NaN";
95
97
  const o = Math.floor(Math.log10(t)), r = Math.max(n * 3, o), e = Math.floor(r / 3), i = M[e], c = t / Math.pow(1e3, e), a = Math.max(0, 2 - r % 3);
96
98
  return `${c.toFixed(a)} ${i} ${s}`.trim();
97
- }, F = (t, n = "default") => {
99
+ }
100
+ function F(t, n = "default") {
98
101
  const s = Math.floor(t / 10), o = Math.floor(s / 3600), r = Math.floor(s % 3600 / 60), e = s % 60;
99
102
  if (n === "short") {
100
- const f = o > 0 ? `${o}h` : "", u = r > 0 ? `${r}m` : "", h = e > 0 ? `${e}s` : "";
101
- return `${f}${u}${h}`;
103
+ const f = o > 0 ? `${o}h` : "", m = r > 0 ? `${r}m` : "", h = e > 0 ? `${e}s` : "";
104
+ return `${f}${m}${h}`;
102
105
  }
103
106
  const i = String(o).padStart(2, "0"), c = String(r).padStart(2, "0"), a = String(e).padStart(2, "0");
104
107
  return `${i}:${c}:${a}`;
105
- };
108
+ }
106
109
  export {
107
110
  g as formatDb,
108
111
  $ as formatEnergy,
109
112
  b as formatMoney,
110
113
  S as formatPower,
111
114
  p as formatSiBaseTenUnit,
112
- m as formatSiUnit,
115
+ u as formatSiUnit,
113
116
  F as formatTime
114
117
  };
@@ -1,39 +1,39 @@
1
1
  /**
2
2
  * Limits a number to the range between 'min' and 'max'.
3
3
  */
4
- export declare function clamp(value: any, min: any, max: any): any;
4
+ export declare function clamp(value: number, min: number, max: number): number;
5
5
  /**
6
6
  * Limits a number between 0 and 1.
7
7
  */
8
- export declare function clamp01(value: any): any;
8
+ export declare function clamp01(value: number): number;
9
9
  /**
10
10
  * Scales a number to fit into the range between min and max.
11
11
  */
12
- export declare function scale(value: any, min: any, max: any): number;
12
+ export declare function scale(value: number, min?: number, max?: number): number;
13
13
  /**
14
14
  * Robust number rounding, similar to PHP's round() function.
15
15
  *
16
16
  * @url https://stackoverflow.com/questions/53450248/how-to-round-in-javascript-like-php-do/54721202#54721202
17
17
  */
18
- export declare function round(num: any, dec: any): number;
18
+ export declare function round(num: number, dec: number): number;
19
19
  /**
20
20
  * Returns a string representing a number in fixed point notation.
21
21
  */
22
- export declare function toFixed(value: any, fractionDigits?: number): string;
22
+ export declare function toFixed(value: number, fractionDigits?: number): string;
23
23
  /**
24
24
  * Checks whether a value is within the provided range.
25
25
  *
26
26
  * Range is an array of two numbers, for example: [0, 15].
27
27
  */
28
- export declare function inRange(value: any, range: any): any;
28
+ export declare function inRange(value: number, range: number[]): boolean;
29
29
  /**
30
30
  * Walks over the object with ranges, comparing value against every range,
31
31
  * and returns the key of the first matching range.
32
32
  *
33
33
  * Range is an array of two numbers, for example: [0, 15].
34
34
  */
35
- export declare function keyOfMatchingRange(value: any, ranges: any): string | undefined;
35
+ export declare function keyOfMatchingRange(value: number, ranges: Record<string, any>): string | undefined;
36
36
  /**
37
37
  * Get number of digits following the decimal point in a number
38
38
  */
39
- export declare function numberOfDecimalDigits(value: any): any;
39
+ export declare function numberOfDecimalDigits(value: number): number;
@@ -4,7 +4,7 @@ function e(t, n, r) {
4
4
  function c(t) {
5
5
  return t < 0 ? 0 : t > 1 ? 1 : t;
6
6
  }
7
- function f(t, n, r) {
7
+ function f(t, n = 0, r = 100) {
8
8
  return (t - n) / (r - n);
9
9
  }
10
10
  function u(t, n) {
@@ -9,7 +9,7 @@ export declare function randomInteger(lowerBound: number, upperBound: number): n
9
9
  /**
10
10
  * Returns random array element
11
11
  */
12
- export declare const randomPick: <T>(array: T[]) => T;
12
+ export declare function randomPick<T>(array: T[]): T;
13
13
  /**
14
14
  * Return 1 with probability P percent; otherwise 0
15
15
  */
@@ -1,14 +1,16 @@
1
- import { clamp as n } from "./math.js";
2
- function o(t, r) {
3
- return Math.random() * (r - t) + t;
1
+ import { clamp as r } from "./math.js";
2
+ function o(t, n) {
3
+ return Math.random() * (n - t) + t;
4
4
  }
5
- function m(t, r) {
6
- return t = Math.ceil(t), r = Math.floor(r), Math.floor(Math.random() * (r - t) + t);
5
+ function m(t, n) {
6
+ return t = Math.ceil(t), n = Math.floor(n), Math.floor(Math.random() * (n - t) + t);
7
+ }
8
+ function h(t) {
9
+ return t[Math.floor(Math.random() * t.length)];
7
10
  }
8
- const h = (t) => t[Math.floor(Math.random() * t.length)];
9
11
  function c(t) {
10
- const r = n(t, 0, 100) / 100;
11
- return Math.random() <= r;
12
+ const n = r(t, 0, 100) / 100;
13
+ return Math.random() <= n;
12
14
  }
13
15
  export {
14
16
  m as randomInteger,
@@ -11,7 +11,7 @@ export declare function normalizeChildren<T>(children: T | T[]): T[];
11
11
  * Shallowly checks if two objects are different.
12
12
  * Credit: https://github.com/developit/preact-compat
13
13
  */
14
- export declare function shallowDiffers(a: object, b: object): boolean;
14
+ export declare function shallowDiffers(a: Record<string, any>, b: Record<string, any>): boolean;
15
15
  /**
16
16
  * A common case in tgui, when you pass a value conditionally, these are
17
17
  * the types that can fall through the condition.
@@ -11,7 +11,6 @@ export { ColorBox } from './ColorBox';
11
11
  export { Dialog } from './Dialog';
12
12
  export { Dimmer } from './Dimmer';
13
13
  export { Divider } from './Divider';
14
- export { DmIcon } from './DmIcon';
15
14
  export { DraggableControl } from './DraggableControl';
16
15
  export { Dropdown } from './Dropdown';
17
16
  export { FitText } from './FitText';
@@ -4,45 +4,44 @@ import { Blink as x } from "./Blink.js";
4
4
  import { BlockQuote as i } from "./BlockQuote.js";
5
5
  import { Box as a } from "./Box.js";
6
6
  import { Button as u } from "./Button.js";
7
- import { ByondUi as c } from "./ByondUi.js";
8
- import { Chart as b } from "./Chart.js";
9
- import { Collapsible as D } from "./Collapsible.js";
10
- import { ColorBox as T } from "./ColorBox.js";
11
- import { Dialog as C } from "./Dialog.js";
7
+ import { ByondUi as d } from "./ByondUi.js";
8
+ import { Chart as c } from "./Chart.js";
9
+ import { Collapsible as T } from "./Collapsible.js";
10
+ import { ColorBox as C } from "./ColorBox.js";
11
+ import { Dialog as I } from "./Dialog.js";
12
12
  import { Dimmer as L } from "./Dimmer.js";
13
13
  import { Divider as y } from "./Divider.js";
14
- import { DmIcon as N } from "./DmIcon.js";
15
- import { DraggableControl as F } from "./DraggableControl.js";
16
- import { Dropdown as M } from "./Dropdown.js";
17
- import { FitText as h } from "./FitText.js";
18
- import { Flex as w } from "./Flex.js";
19
- import { Icon as O } from "./Icon.js";
20
- import { Image as U } from "./Image.js";
21
- import { InfinitePlane as j } from "./InfinitePlane.js";
22
- import { Input as z } from "./Input.js";
23
- import { KeyListener as H } from "./KeyListener.js";
24
- import { Knob as W } from "./Knob.js";
25
- import { LabeledControls as Y } from "./LabeledControls.js";
26
- import { LabeledList as _ } from "./LabeledList.js";
27
- import { MenuBar as oo } from "./MenuBar.js";
28
- import { Modal as eo } from "./Modal.js";
29
- import { NoticeBox as po } from "./NoticeBox.js";
30
- import { NumberInput as xo } from "./NumberInput.js";
31
- import { Popper as io } from "./Popper.js";
32
- import { ProgressBar as ao } from "./ProgressBar.js";
33
- import { RestrictedInput as uo } from "./RestrictedInput.js";
34
- import { RoundGauge as co } from "./RoundGauge.js";
35
- import { Section as Bo } from "./Section.js";
36
- import { Slider as Io } from "./Slider.js";
14
+ import { DraggableControl as N } from "./DraggableControl.js";
15
+ import { Dropdown as F } from "./Dropdown.js";
16
+ import { FitText as M } from "./FitText.js";
17
+ import { Flex as h } from "./Flex.js";
18
+ import { Icon as w } from "./Icon.js";
19
+ import { Image as O } from "./Image.js";
20
+ import { InfinitePlane as U } from "./InfinitePlane.js";
21
+ import { Input as j } from "./Input.js";
22
+ import { KeyListener as z } from "./KeyListener.js";
23
+ import { Knob as H } from "./Knob.js";
24
+ import { LabeledControls as W } from "./LabeledControls.js";
25
+ import { LabeledList as Y } from "./LabeledList.js";
26
+ import { MenuBar as _ } from "./MenuBar.js";
27
+ import { Modal as oo } from "./Modal.js";
28
+ import { NoticeBox as eo } from "./NoticeBox.js";
29
+ import { NumberInput as po } from "./NumberInput.js";
30
+ import { Popper as xo } from "./Popper.js";
31
+ import { ProgressBar as io } from "./ProgressBar.js";
32
+ import { RestrictedInput as ao } from "./RestrictedInput.js";
33
+ import { RoundGauge as uo } from "./RoundGauge.js";
34
+ import { Section as bo } from "./Section.js";
35
+ import { Slider as Bo } from "./Slider.js";
37
36
  import { Stack as go } from "./Stack.js";
38
- import { StyleableSection as ko } from "./StyleableSection.js";
39
- import { Table as So } from "./Table.js";
40
- import { Tabs as Ao } from "./Tabs.js";
41
- import { TextArea as Po } from "./TextArea.js";
42
- import { TimeDisplay as Ko } from "./TimeDisplay.js";
43
- import { Tooltip as Ro } from "./Tooltip.js";
44
- import { TrackOutsideClicks as vo } from "./TrackOutsideClicks.js";
45
- import { VirtualList as Go } from "./VirtualList.js";
37
+ import { StyleableSection as Do } from "./StyleableSection.js";
38
+ import { Table as ko } from "./Table.js";
39
+ import { Tabs as So } from "./Tabs.js";
40
+ import { TextArea as Ao } from "./TextArea.js";
41
+ import { TimeDisplay as Po } from "./TimeDisplay.js";
42
+ import { Tooltip as Ko } from "./Tooltip.js";
43
+ import { TrackOutsideClicks as Ro } from "./TrackOutsideClicks.js";
44
+ import { VirtualList as vo } from "./VirtualList.js";
46
45
  export {
47
46
  e as AnimatedNumber,
48
47
  p as Autofocus,
@@ -50,43 +49,42 @@ export {
50
49
  i as BlockQuote,
51
50
  a as Box,
52
51
  u as Button,
53
- c as ByondUi,
54
- b as Chart,
55
- D as Collapsible,
56
- T as ColorBox,
57
- C as Dialog,
52
+ d as ByondUi,
53
+ c as Chart,
54
+ T as Collapsible,
55
+ C as ColorBox,
56
+ I as Dialog,
58
57
  L as Dimmer,
59
58
  y as Divider,
60
- N as DmIcon,
61
- F as DraggableControl,
62
- M as Dropdown,
63
- h as FitText,
64
- w as Flex,
65
- O as Icon,
66
- U as Image,
67
- j as InfinitePlane,
68
- z as Input,
69
- H as KeyListener,
70
- W as Knob,
71
- Y as LabeledControls,
72
- _ as LabeledList,
73
- oo as MenuBar,
74
- eo as Modal,
75
- po as NoticeBox,
76
- xo as NumberInput,
77
- io as Popper,
78
- ao as ProgressBar,
79
- uo as RestrictedInput,
80
- co as RoundGauge,
81
- Bo as Section,
82
- Io as Slider,
59
+ N as DraggableControl,
60
+ F as Dropdown,
61
+ M as FitText,
62
+ h as Flex,
63
+ w as Icon,
64
+ O as Image,
65
+ U as InfinitePlane,
66
+ j as Input,
67
+ z as KeyListener,
68
+ H as Knob,
69
+ W as LabeledControls,
70
+ Y as LabeledList,
71
+ _ as MenuBar,
72
+ oo as Modal,
73
+ eo as NoticeBox,
74
+ po as NumberInput,
75
+ xo as Popper,
76
+ io as ProgressBar,
77
+ ao as RestrictedInput,
78
+ uo as RoundGauge,
79
+ bo as Section,
80
+ Bo as Slider,
83
81
  go as Stack,
84
- ko as StyleableSection,
85
- So as Table,
86
- Ao as Tabs,
87
- Po as TextArea,
88
- Ko as TimeDisplay,
89
- Ro as Tooltip,
90
- vo as TrackOutsideClicks,
91
- Go as VirtualList
82
+ Do as StyleableSection,
83
+ ko as Table,
84
+ So as Tabs,
85
+ Ao as TextArea,
86
+ Po as TimeDisplay,
87
+ Ko as Tooltip,
88
+ Ro as TrackOutsideClicks,
89
+ vo as VirtualList
92
90
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tgui-core",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "TGUI core component library",
5
5
  "keywords": [
6
6
  "TGUI",
@@ -1,4 +0,0 @@
1
- import { Middleware } from './redux';
2
-
3
- export declare function resolveAsset(name: string): string;
4
- export declare const assetMiddleware: Middleware;
@@ -1,25 +0,0 @@
1
- const c = [/v4shim/i], a = {};
2
- function l(t) {
3
- return a[t] || t;
4
- }
5
- const f = (t) => (d) => (n) => {
6
- const { type: i, payload: e } = n;
7
- if (i === "asset/stylesheet") {
8
- Byond.loadCss(e);
9
- return;
10
- }
11
- if (i === "asset/mappings") {
12
- for (const s of Object.keys(e)) {
13
- if (c.some((p) => p.test(s)))
14
- continue;
15
- const o = e[s], r = s.split(".").pop();
16
- a[s] = o, r === "css" && Byond.loadCss(o), r === "js" && Byond.loadJs(o);
17
- }
18
- return;
19
- }
20
- d(n);
21
- };
22
- export {
23
- f as assetMiddleware,
24
- l as resolveAsset
25
- };
@@ -1,24 +0,0 @@
1
- /**
2
- * Ghetto performance measurement tools.
3
- *
4
- * Uses NODE_ENV to remove itself from production builds.
5
- *
6
- * @file
7
- * @copyright 2020 Aleksej Komarov
8
- * @license MIT
9
- */
10
- /**
11
- * Marks a certain spot in the code for later measurements.
12
- */
13
- declare function mark(name: string, timestamp?: number): void;
14
- /**
15
- * Calculates and returns the difference between two markers as a string.
16
- *
17
- * Use logger.log() to print the measurement.
18
- */
19
- declare function measure(markerNameA: string, markerNameB: string): string | undefined;
20
- export declare const perf: {
21
- mark: typeof mark;
22
- measure: typeof measure;
23
- };
24
- export {};
@@ -1,33 +0,0 @@
1
- /**
2
- * Ghetto performance measurement tools.
3
- *
4
- * Uses NODE_ENV to remove itself from production builds.
5
- *
6
- * @file
7
- * @copyright 2020 Aleksej Komarov
8
- * @license MIT
9
- */
10
- const i = 16.666666666666668;
11
- var c;
12
- const a = !!((c = window.performance) != null && c.now), t = {}, s = {};
13
- function p(o, n) {
14
- process.env.NODE_ENV !== "production" && (a && !n && (t[o] = performance.now()), s[o] = n || Date.now());
15
- }
16
- function u(o, n) {
17
- if (process.env.NODE_ENV === "production") return;
18
- let r = t[o], e = t[n];
19
- (!r || !e) && (r = s[o], e = s[n]);
20
- const f = Math.abs(e - r);
21
- return F(f);
22
- }
23
- function F(o) {
24
- const n = o / i;
25
- return o.toFixed(o < 10 ? 1 : 0) + "ms (" + n.toFixed(2) + " frames)";
26
- }
27
- const d = {
28
- mark: p,
29
- measure: u
30
- };
31
- export {
32
- d as perf
33
- };
@@ -1,64 +0,0 @@
1
- export type Reducer<State = any, ActionType extends Action = AnyAction> = (state: State | undefined, action: ActionType) => State;
2
- export type Store<State = any, ActionType extends Action = AnyAction> = {
3
- dispatch: Dispatch<ActionType>;
4
- getState: () => State;
5
- subscribe: (listener: () => void) => void;
6
- };
7
- type MiddlewareAPI<State = any, ActionType extends Action = AnyAction> = {
8
- dispatch: Dispatch<ActionType>;
9
- getState: () => State;
10
- };
11
- export type Middleware = <State = any, ActionType extends Action = AnyAction>(storeApi: MiddlewareAPI<State, ActionType>) => (next: Dispatch<ActionType>) => Dispatch<ActionType>;
12
- export type Action<TType = any> = {
13
- type: TType;
14
- };
15
- export type AnyAction = Action & {
16
- [extraProps: string]: any;
17
- };
18
- export type Dispatch<ActionType extends Action = AnyAction> = (action: ActionType) => void;
19
- type StoreEnhancer = (createStoreFunction: Function) => Function;
20
- type PreparedAction = {
21
- meta?: any;
22
- payload?: any;
23
- };
24
- /**
25
- * Creates a Redux store.
26
- */
27
- export declare function createStore<State, ActionType extends Action = AnyAction>(reducer: Reducer<State, ActionType>, enhancer?: StoreEnhancer): Store<State, ActionType>;
28
- /**
29
- * Creates a store enhancer which applies middleware to all dispatched
30
- * actions.
31
- */
32
- export declare function applyMiddleware(...middlewares: Middleware[]): StoreEnhancer;
33
- /**
34
- * Combines reducers by running them in their own object namespaces as
35
- * defined in reducersObj paramter.
36
- *
37
- * Main difference from redux/combineReducers is that it preserves keys
38
- * in the state that are not present in the reducers object. This function
39
- * is also more flexible than the redux counterpart.
40
- */
41
- export declare function combineReducers(reducersObj: Record<string, Reducer>): Reducer;
42
- /**
43
- * A utility function to create an action creator for the given action
44
- * type string. The action creator accepts a single argument, which will
45
- * be included in the action object as a field called payload. The action
46
- * creator function will also have its toString() overriden so that it
47
- * returns the action type, allowing it to be used in reducer logic that
48
- * is looking for that action type.
49
- *
50
- * @param {string} type The action type to use for created actions.
51
- * @param {any} prepare (optional) a method that takes any number of arguments
52
- * and returns { payload } or { payload, meta }. If this is given, the
53
- * resulting action creator will pass it's arguments to this method to
54
- * calculate payload & meta.
55
- *
56
- * @public
57
- */
58
- export declare function createAction<TAction extends string>(type: TAction, prepare?: (...args: any[]) => PreparedAction): {
59
- (...args: any[]): Action<TAction> & PreparedAction;
60
- toString(): TAction;
61
- type: TAction;
62
- match(action: any): boolean;
63
- };
64
- export {};
@@ -1,72 +0,0 @@
1
- function f(n, i) {
2
- if (i)
3
- return i(f)(n);
4
- let t;
5
- const r = [], e = () => t;
6
- function c(s) {
7
- r.push(s);
8
- }
9
- function a(s) {
10
- t = n(t, s);
11
- for (let o = 0; o < r.length; o++)
12
- r[o]();
13
- }
14
- return a({ type: "@@INIT" }), {
15
- dispatch: a,
16
- subscribe: c,
17
- getState: e
18
- };
19
- }
20
- function l(...n) {
21
- return (i) => (t, ...r) => {
22
- const e = i(t, ...r);
23
- let c = () => {
24
- throw new Error(
25
- "Dispatching while constructing your middleware is not allowed."
26
- );
27
- };
28
- const a = {
29
- getState: e.getState,
30
- dispatch: (o, ...u) => c(o, ...u)
31
- };
32
- return c = n.map((o) => o(a)).reduceRight(
33
- (o, u) => u(o),
34
- e.dispatch
35
- ), {
36
- ...e,
37
- dispatch: c
38
- };
39
- };
40
- }
41
- function d(n) {
42
- const i = Object.keys(n);
43
- return (t = {}, r) => {
44
- const e = { ...t };
45
- let c = !1;
46
- for (const a of i) {
47
- const s = n[a], o = t[a], u = s(o, r);
48
- o !== u && (c = !0, e[a] = u);
49
- }
50
- return c ? e : t;
51
- };
52
- }
53
- function h(n, i) {
54
- function t(...r) {
55
- let e = { type: n };
56
- if (i) {
57
- const c = i(...r);
58
- if (!c)
59
- throw new Error("prepare function did not return an object");
60
- e = { ...e, ...c };
61
- } else
62
- e.payload = r[0];
63
- return e;
64
- }
65
- return t.toString = () => n, t.type = n, t.match = (r) => r.type === n, t;
66
- }
67
- export {
68
- l as applyMiddleware,
69
- d as combineReducers,
70
- h as createAction,
71
- f as createStore
72
- };
@@ -1,24 +0,0 @@
1
- /**
2
- * Browser-agnostic abstraction of key-value web storage.
3
- *
4
- * @file
5
- * @copyright 2020 Aleksej Komarov
6
- * @license MIT
7
- */
8
- export declare const IMPL_MEMORY = 0;
9
- export declare const IMPL_LOCAL_STORAGE = 1;
10
- export declare const IMPL_INDEXED_DB = 2;
11
- /**
12
- * Web Storage Proxy object, which selects the best backend available
13
- * depending on the environment.
14
- */
15
- declare class StorageProxy {
16
- backendPromise: Promise<any>;
17
- constructor();
18
- get(key: any): Promise<any>;
19
- set(key: any, value: any): Promise<any>;
20
- remove(key: any): Promise<any>;
21
- clear(): Promise<any>;
22
- }
23
- export declare const storage: StorageProxy;
24
- export {};
@@ -1,133 +0,0 @@
1
- var l = Object.defineProperty;
2
- var D = (r, e, t) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var s = (r, e, t) => D(r, typeof e != "symbol" ? e + "" : e, t);
4
- /**
5
- * Browser-agnostic abstraction of key-value web storage.
6
- *
7
- * @file
8
- * @copyright 2020 Aleksej Komarov
9
- * @license MIT
10
- */
11
- const h = 0, P = 1, B = 2;
12
- const w = "tgui", a = "storage-v1", m = "readonly", i = "readwrite", d = (r) => () => {
13
- try {
14
- return !!r();
15
- } catch {
16
- return !1;
17
- }
18
- }, I = d(
19
- () => window.localStorage && window.localStorage.getItem
20
- ), E = d(
21
- () => (window.indexedDB || window.msIndexedDB) && (window.IDBTransaction || window.msIDBTransaction)
22
- );
23
- class g {
24
- constructor() {
25
- s(this, "impl", 0);
26
- s(this, "store", {});
27
- this.impl = 0, this.store = {};
28
- }
29
- get(e) {
30
- return this.store[e];
31
- }
32
- set(e, t) {
33
- this.store[e] = t;
34
- }
35
- remove(e) {
36
- this.store[e] = void 0;
37
- }
38
- clear() {
39
- this.store = {};
40
- }
41
- }
42
- class u {
43
- constructor() {
44
- s(this, "impl", 1);
45
- this.impl = 1;
46
- }
47
- get(e) {
48
- const t = localStorage.getItem(e);
49
- if (typeof t == "string")
50
- return JSON.parse(t);
51
- }
52
- set(e, t) {
53
- localStorage.setItem(e, JSON.stringify(t));
54
- }
55
- remove(e) {
56
- localStorage.removeItem(e);
57
- }
58
- clear() {
59
- localStorage.clear();
60
- }
61
- }
62
- class _ {
63
- constructor() {
64
- s(this, "impl", 2);
65
- s(this, "dbPromise");
66
- this.impl = 2, this.dbPromise = new Promise((e, t) => {
67
- const o = (window.indexedDB || window.msIndexedDB).open(w, 1);
68
- o.onupgradeneeded = () => {
69
- try {
70
- o.result.createObjectStore(a);
71
- } catch {
72
- t(new Error("Failed to upgrade IDB: " + o.error));
73
- }
74
- }, o.onsuccess = () => e(o.result), o.onerror = () => {
75
- t(new Error("Failed to open IDB: " + o.error));
76
- };
77
- });
78
- }
79
- getStore(e) {
80
- return this.dbPromise.then(
81
- (t) => t.transaction(a, e).objectStore(a)
82
- );
83
- }
84
- async get(e) {
85
- const t = await this.getStore(m);
86
- return new Promise((c, o) => {
87
- const n = t.get(e);
88
- n.onsuccess = () => c(n.result), n.onerror = () => o(n.error);
89
- });
90
- }
91
- async set(e, t) {
92
- t === null && (t = void 0), (await this.getStore(i)).put(t, e);
93
- }
94
- async remove(e) {
95
- (await this.getStore(i)).delete(e);
96
- }
97
- async clear() {
98
- (await this.getStore(i)).clear();
99
- }
100
- }
101
- class S {
102
- constructor() {
103
- s(this, "backendPromise");
104
- this.backendPromise = (async () => {
105
- if (E())
106
- try {
107
- const e = new _();
108
- return await e.dbPromise, e;
109
- } catch {
110
- }
111
- return I() ? new u() : new g();
112
- })();
113
- }
114
- async get(e) {
115
- return (await this.backendPromise).get(e);
116
- }
117
- async set(e, t) {
118
- return (await this.backendPromise).set(e, t);
119
- }
120
- async remove(e) {
121
- return (await this.backendPromise).remove(e);
122
- }
123
- async clear() {
124
- return (await this.backendPromise).clear();
125
- }
126
- }
127
- const k = new S();
128
- export {
129
- B as IMPL_INDEXED_DB,
130
- P as IMPL_LOCAL_STORAGE,
131
- h as IMPL_MEMORY,
132
- k as storage
133
- };
@@ -1,28 +0,0 @@
1
- import { Component } from 'react';
2
-
3
- export declare enum BodyZone {
4
- Chest = "chest",
5
- Eyes = "eyes",
6
- Groin = "groin",
7
- Head = "head",
8
- LeftArm = "l_arm",
9
- LeftLeg = "l_leg",
10
- Mouth = "mouth",
11
- RightArm = "r_arm",
12
- RightLeg = "r_leg"
13
- }
14
- type BodyZoneSelectorProps = {
15
- onClick?: (zone: BodyZone) => void;
16
- scale?: number;
17
- selectedZone: BodyZone | null;
18
- theme?: string;
19
- };
20
- type BodyZoneSelectorState = {
21
- hoverZone: BodyZone | null;
22
- };
23
- export declare class BodyZoneSelector extends Component<BodyZoneSelectorProps, BodyZoneSelectorState> {
24
- ref: import('react').RefObject<HTMLDivElement>;
25
- state: BodyZoneSelectorState;
26
- render(): import("react/jsx-runtime").JSX.Element;
27
- }
28
- export {};
@@ -1,115 +0,0 @@
1
- var g = Object.defineProperty;
2
- var _ = (e, t, s) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var l = (e, t, s) => _(e, typeof t != "symbol" ? t + "" : t, s);
4
- import { jsxs as d, jsx as h } from "react/jsx-runtime";
5
- import { Component as v, createRef as $ } from "react";
6
- import { resolveAsset as p } from "../common/assets.js";
7
- import { Image as f } from "./Image.js";
8
- var b = /* @__PURE__ */ ((e) => (e.Chest = "chest", e.Eyes = "eyes", e.Groin = "groin", e.Head = "head", e.LeftArm = "l_arm", e.LeftLeg = "l_leg", e.Mouth = "mouth", e.RightArm = "r_arm", e.RightLeg = "r_leg", e))(b || {});
9
- const C = (e, t) => {
10
- if (t < 1)
11
- return null;
12
- if (t < 10) {
13
- if (e > 10 && e < 15)
14
- return "r_leg";
15
- if (e > 17 && e < 22)
16
- return "l_leg";
17
- } else if (t < 13) {
18
- if (e > 8 && e < 11)
19
- return "r_arm";
20
- if (e > 12 && e < 20)
21
- return "groin";
22
- if (e > 21 && e < 24)
23
- return "l_arm";
24
- } else if (t < 22) {
25
- if (e > 8 && e < 11)
26
- return "r_arm";
27
- if (e > 12 && e < 20)
28
- return "chest";
29
- if (e > 21 && e < 24)
30
- return "l_arm";
31
- } else if (t < 30 && e > 12 && e < 20)
32
- return t > 23 && t < 24 && e > 15 && e < 17 ? "mouth" : t > 25 && t < 27 && e > 14 && e < 18 ? "eyes" : "head";
33
- return null;
34
- };
35
- class A extends v {
36
- constructor() {
37
- super(...arguments);
38
- l(this, "ref", $());
39
- l(this, "state", {
40
- hoverZone: null
41
- });
42
- }
43
- render() {
44
- const { hoverZone: s } = this.state, { scale: r = 3, selectedZone: n, theme: c = "midnight" } = this.props;
45
- return /* @__PURE__ */ d(
46
- "div",
47
- {
48
- ref: this.ref,
49
- style: {
50
- width: `${32 * r}px`,
51
- height: `${32 * r}px`,
52
- position: "relative"
53
- },
54
- children: [
55
- /* @__PURE__ */ h(
56
- f,
57
- {
58
- src: p(`body_zones.base_${c}.png`),
59
- onClick: () => {
60
- const i = this.props.onClick;
61
- i && this.state.hoverZone && i(this.state.hoverZone);
62
- },
63
- onMouseMove: (i) => {
64
- var u;
65
- if (!this.props.onClick)
66
- return;
67
- const o = (u = this.ref.current) == null ? void 0 : u.getBoundingClientRect();
68
- if (!o)
69
- return;
70
- const a = i.clientX - o.left, m = 32 * r - (i.clientY - o.top);
71
- this.setState({
72
- hoverZone: C(a / r, m / r)
73
- });
74
- },
75
- style: {
76
- position: "absolute",
77
- width: `${32 * r}px`,
78
- height: `${32 * r}px`
79
- }
80
- }
81
- ),
82
- n && /* @__PURE__ */ h(
83
- f,
84
- {
85
- src: p(`body_zones.${n}.png`),
86
- style: {
87
- pointerEvents: "none",
88
- position: "absolute",
89
- width: `${32 * r}px`,
90
- height: `${32 * r}px`
91
- }
92
- }
93
- ),
94
- s && s !== n && /* @__PURE__ */ h(
95
- f,
96
- {
97
- src: p(`body_zones.${s}.png`),
98
- style: {
99
- opacity: "0.5",
100
- pointerEvents: "none",
101
- position: "absolute",
102
- width: `${32 * r}px`,
103
- height: `${32 * r}px`
104
- }
105
- }
106
- )
107
- ]
108
- }
109
- );
110
- }
111
- }
112
- export {
113
- b as BodyZone,
114
- A as BodyZoneSelector
115
- };
@@ -1,31 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { BooleanLike } from '../common/react';
3
- import { BoxProps } from './Box';
4
-
5
- declare enum Direction {
6
- NORTH = 1,
7
- SOUTH = 2,
8
- EAST = 4,
9
- WEST = 8,
10
- NORTHEAST = 5,
11
- NORTHWEST = 9,
12
- SOUTHEAST = 6,
13
- SOUTHWEST = 10
14
- }
15
- type Props = {
16
- /** Required: The path of the icon */
17
- icon: string;
18
- /** Required: The state of the icon */
19
- icon_state: string;
20
- } & Partial<{
21
- /** Facing direction. See direction enum. Default is South */
22
- direction: Direction;
23
- /** Fallback icon. */
24
- fallback: ReactNode;
25
- /** Frame number. Default is 1 */
26
- frame: number;
27
- /** Movement state. Default is false */
28
- movement: BooleanLike;
29
- }> & BoxProps;
30
- export declare function DmIcon(props: Props): string;
31
- export {};
@@ -1,29 +0,0 @@
1
- import { useState as r, useEffect as i } from "react";
2
- import { resolveAsset as u } from "../common/assets.js";
3
- let e;
4
- function p(c) {
5
- const {
6
- // className,
7
- // direction = Direction.SOUTH,
8
- // fallback,
9
- // frame = 1,
10
- // icon_state,
11
- icon: o
12
- // movement = false,
13
- // ...rest
14
- } = c, [a, s] = r(""), [f, n] = r("unloaded");
15
- return i(() => {
16
- if (e) {
17
- n(Object.keys(e).length.toString()), s(e[o]);
18
- return;
19
- }
20
- fetch(u("icon_ref_map.json")).then((t) => (n(t.statusText), t.json())).then((t) => {
21
- e = t, s(t[o]);
22
- }).catch((t) => {
23
- n(t.message);
24
- });
25
- }, []), f;
26
- }
27
- export {
28
- p as DmIcon
29
- };