tgui-core 2.0.6 → 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.
- package/dist/common/collections.d.ts +1 -1
- package/dist/common/collections.js +1 -10
- package/dist/common/color.js +1 -70
- package/dist/common/constants.js +1 -329
- package/dist/common/events.js +1 -147
- package/dist/common/exhaustive.js +1 -6
- package/dist/common/format.js +1 -117
- package/dist/common/fp.js +1 -9
- package/dist/common/hotkeys.d.ts +1 -1
- package/dist/common/hotkeys.js +1 -112
- package/dist/common/http.js +1 -10
- package/dist/common/keycodes.js +1 -88
- package/dist/common/keys.js +1 -32
- package/dist/common/math.js +1 -45
- package/dist/common/random.js +1 -21
- package/dist/common/react.js +1 -30
- package/dist/common/string.js +1 -88
- package/dist/common/timer.js +1 -28
- package/dist/common/type-utils.js +1 -25
- package/dist/common/ui.d.ts +2 -2
- package/dist/common/ui.js +1 -141
- package/dist/common/uuid.js +1 -10
- package/dist/common/vector.js +1 -48
- package/dist/components/AnimatedNumber.d.ts +1 -1
- package/dist/components/AnimatedNumber.js +1 -73
- package/dist/components/Autofocus.d.ts +1 -1
- package/dist/components/Autofocus.js +1 -17
- package/dist/components/Blink.d.ts +1 -1
- package/dist/components/Blink.js +1 -56
- package/dist/components/BlockQuote.d.ts +1 -1
- package/dist/components/BlockQuote.js +1 -10
- package/dist/components/Box.d.ts +5 -5
- package/dist/components/Box.js +1 -19
- package/dist/components/Button.d.ts +4 -4
- package/dist/components/Button.js +1 -258
- package/dist/components/ByondUi.d.ts +1 -1
- package/dist/components/ByondUi.js +1 -61
- package/dist/components/Chart.d.ts +1 -1
- package/dist/components/Chart.js +1 -80
- package/dist/components/Collapsible.d.ts +2 -2
- package/dist/components/Collapsible.js +1 -36
- package/dist/components/ColorBox.d.ts +2 -2
- package/dist/components/ColorBox.js +1 -17
- package/dist/components/Dialog.d.ts +1 -1
- package/dist/components/Dialog.js +1 -42
- package/dist/components/Dimmer.d.ts +1 -1
- package/dist/components/Dimmer.js +1 -10
- package/dist/components/Divider.js +1 -18
- package/dist/components/DmIcon.d.ts +3 -3
- package/dist/components/DmIcon.js +1 -23
- package/dist/components/DraggableControl.d.ts +2 -2
- package/dist/components/DraggableControl.js +1 -111
- package/dist/components/Dropdown.d.ts +2 -2
- package/dist/components/Dropdown.js +1 -165
- package/dist/components/FitText.d.ts +2 -2
- package/dist/components/FitText.js +1 -63
- package/dist/components/Flex.d.ts +1 -1
- package/dist/components/Flex.js +1 -70
- package/dist/components/Floating.d.ts +3 -3
- package/dist/components/Floating.js +1 -2235
- package/dist/components/Icon.d.ts +2 -2
- package/dist/components/Icon.js +1 -45
- package/dist/components/Image.d.ts +1 -1
- package/dist/components/Image.js +1 -38
- package/dist/components/ImageButton.d.ts +10 -5
- package/dist/components/ImageButton.js +1 -154
- package/dist/components/InfinitePlane.d.ts +2 -2
- package/dist/components/InfinitePlane.js +1 -133
- package/dist/components/Input.d.ts +2 -2
- package/dist/components/Input.js +1 -96
- package/dist/components/KeyListener.d.ts +1 -1
- package/dist/components/KeyListener.js +1 -15
- package/dist/components/Knob.d.ts +2 -2
- package/dist/components/Knob.js +1 -133
- package/dist/components/LabeledControls.d.ts +1 -1
- package/dist/components/LabeledControls.js +1 -39
- package/dist/components/LabeledList.d.ts +2 -2
- package/dist/components/LabeledList.js +1 -89
- package/dist/components/MenuBar.d.ts +32 -0
- package/dist/components/MenuBar.js +1 -133
- package/dist/components/Modal.d.ts +2 -2
- package/dist/components/Modal.js +1 -22
- package/dist/components/NoticeBox.d.ts +1 -1
- package/dist/components/NoticeBox.js +1 -23
- package/dist/components/NumberInput.d.ts +9 -19
- package/dist/components/NumberInput.js +1 -213
- package/dist/components/Popper.d.ts +8 -9
- package/dist/components/Popper.js +1 -1082
- package/dist/components/ProgressBar.d.ts +2 -2
- package/dist/components/ProgressBar.js +1 -33
- package/dist/components/RestrictedInput.d.ts +29 -0
- package/dist/components/RestrictedInput.js +1 -161
- package/dist/components/RoundGauge.d.ts +2 -2
- package/dist/components/RoundGauge.js +1 -114
- package/dist/components/Section.d.ts +2 -2
- package/dist/components/Section.js +1 -65
- package/dist/components/Slider.d.ts +2 -2
- package/dist/components/Slider.js +1 -113
- package/dist/components/Stack.d.ts +2 -2
- package/dist/components/Stack.js +1 -58
- package/dist/components/StyleableSection.d.ts +1 -1
- package/dist/components/StyleableSection.js +1 -16
- package/dist/components/Table.d.ts +1 -1
- package/dist/components/Table.js +1 -57
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +1 -65
- package/dist/components/TextArea.d.ts +2 -2
- package/dist/components/TextArea.js +1 -126
- package/dist/components/TimeDisplay.js +1 -25
- package/dist/components/Tooltip.d.ts +2 -2
- package/dist/components/Tooltip.js +1 -18
- package/dist/components/TrackOutsideClicks.d.ts +2 -2
- package/dist/components/TrackOutsideClicks.js +1 -24
- package/dist/components/VirtualList.d.ts +1 -1
- package/dist/components/VirtualList.js +1 -34
- package/dist/components/index.js +1 -96
- package/license.txt +1 -1
- package/package.json +11 -17
- package/styles/components/Button.scss +1 -1
- package/dist/components/FakeTerminal.js +0 -38
package/dist/common/ui.js
CHANGED
|
@@ -1,141 +1 @@
|
|
|
1
|
-
import { CSS_COLORS
|
|
2
|
-
import { classes as y } from "./react.js";
|
|
3
|
-
const f = (o) => {
|
|
4
|
-
if (typeof o == "string")
|
|
5
|
-
return o.endsWith("px") ? `${Number.parseFloat(o) / 12}rem` : o;
|
|
6
|
-
if (typeof o == "number")
|
|
7
|
-
return `${o}rem`;
|
|
8
|
-
}, e = (o) => {
|
|
9
|
-
if (typeof o == "string")
|
|
10
|
-
return f(o);
|
|
11
|
-
if (typeof o == "number")
|
|
12
|
-
return f(o * 0.5);
|
|
13
|
-
};
|
|
14
|
-
function w(o) {
|
|
15
|
-
return !h(o);
|
|
16
|
-
}
|
|
17
|
-
function h(o) {
|
|
18
|
-
return typeof o == "string" && b.includes(o);
|
|
19
|
-
}
|
|
20
|
-
const c = (o) => (t, n) => {
|
|
21
|
-
(typeof n == "number" || typeof n == "string") && (t[o] = n);
|
|
22
|
-
}, i = (o, t) => (n, r) => {
|
|
23
|
-
(typeof r == "number" || typeof r == "string") && (n[o] = t(r));
|
|
24
|
-
}, l = (o, t) => (n, r) => {
|
|
25
|
-
r && (n[o] = t);
|
|
26
|
-
}, g = (o, t, n) => (r, p) => {
|
|
27
|
-
if (typeof p == "number" || typeof p == "string")
|
|
28
|
-
for (let m = 0; m < n.length; m++)
|
|
29
|
-
r[o + n[m]] = t(p);
|
|
30
|
-
}, a = (o) => (t, n) => {
|
|
31
|
-
w(n) && (t[o] = n);
|
|
32
|
-
}, d = {
|
|
33
|
-
align: c("textAlign"),
|
|
34
|
-
bottom: i("bottom", f),
|
|
35
|
-
fontFamily: c("fontFamily"),
|
|
36
|
-
fontSize: i("fontSize", f),
|
|
37
|
-
fontWeight: c("fontWeight"),
|
|
38
|
-
height: i("height", f),
|
|
39
|
-
left: i("left", f),
|
|
40
|
-
maxHeight: i("maxHeight", f),
|
|
41
|
-
maxWidth: i("maxWidth", f),
|
|
42
|
-
minHeight: i("minHeight", f),
|
|
43
|
-
minWidth: i("minWidth", f),
|
|
44
|
-
opacity: c("opacity"),
|
|
45
|
-
overflow: c("overflow"),
|
|
46
|
-
overflowX: c("overflowX"),
|
|
47
|
-
overflowY: c("overflowY"),
|
|
48
|
-
position: c("position"),
|
|
49
|
-
right: i("right", f),
|
|
50
|
-
textAlign: c("textAlign"),
|
|
51
|
-
top: i("top", f),
|
|
52
|
-
verticalAlign: c("verticalAlign"),
|
|
53
|
-
width: i("width", f),
|
|
54
|
-
lineHeight: (o, t) => {
|
|
55
|
-
typeof t == "number" ? o.lineHeight = t : typeof t == "string" && (o.lineHeight = f(t));
|
|
56
|
-
},
|
|
57
|
-
// Margin
|
|
58
|
-
m: g("margin", e, [
|
|
59
|
-
"Top",
|
|
60
|
-
"Bottom",
|
|
61
|
-
"Left",
|
|
62
|
-
"Right"
|
|
63
|
-
]),
|
|
64
|
-
mb: i("marginBottom", e),
|
|
65
|
-
ml: i("marginLeft", e),
|
|
66
|
-
mr: i("marginRight", e),
|
|
67
|
-
mt: i("marginTop", e),
|
|
68
|
-
mx: g("margin", e, ["Left", "Right"]),
|
|
69
|
-
my: g("margin", e, ["Top", "Bottom"]),
|
|
70
|
-
// Gap
|
|
71
|
-
g: i("gap", e),
|
|
72
|
-
gr: i("rowGap", e),
|
|
73
|
-
gc: i("columnGap", e),
|
|
74
|
-
// Padding
|
|
75
|
-
p: g("padding", e, [
|
|
76
|
-
"Top",
|
|
77
|
-
"Bottom",
|
|
78
|
-
"Left",
|
|
79
|
-
"Right"
|
|
80
|
-
]),
|
|
81
|
-
pb: i("paddingBottom", e),
|
|
82
|
-
pl: i("paddingLeft", e),
|
|
83
|
-
pr: i("paddingRight", e),
|
|
84
|
-
pt: i("paddingTop", e),
|
|
85
|
-
px: g("padding", e, ["Left", "Right"]),
|
|
86
|
-
py: g("padding", e, ["Top", "Bottom"]),
|
|
87
|
-
// Color props
|
|
88
|
-
color: a("color"),
|
|
89
|
-
textColor: a("color"),
|
|
90
|
-
backgroundColor: a("backgroundColor")
|
|
91
|
-
}, u = {
|
|
92
|
-
bold: l("fontWeight", "bold"),
|
|
93
|
-
fillPositionedParent: (o, t) => {
|
|
94
|
-
t && (o.position = "absolute", o.top = 0, o.bottom = 0, o.left = 0, o.right = 0);
|
|
95
|
-
},
|
|
96
|
-
inline: l("display", "inline-block"),
|
|
97
|
-
italic: l("fontStyle", "italic"),
|
|
98
|
-
nowrap: l("whiteSpace", "nowrap"),
|
|
99
|
-
preserveWhitespace: l("whiteSpace", "pre-wrap")
|
|
100
|
-
};
|
|
101
|
-
function T(o) {
|
|
102
|
-
const t = {}, n = {};
|
|
103
|
-
for (const r in o) {
|
|
104
|
-
if (r === "style")
|
|
105
|
-
continue;
|
|
106
|
-
const p = o[r], m = d[r] || u[r];
|
|
107
|
-
m ? m(n, p) : t[r] = p;
|
|
108
|
-
}
|
|
109
|
-
return t.style = { ...n, ...o.style }, t;
|
|
110
|
-
}
|
|
111
|
-
function S(o) {
|
|
112
|
-
const t = o.textColor || o.color, { backgroundColor: n } = o;
|
|
113
|
-
return y([
|
|
114
|
-
h(t) && `color-${t}`,
|
|
115
|
-
h(n) && `color-bg-${n}`
|
|
116
|
-
]);
|
|
117
|
-
}
|
|
118
|
-
function P(o) {
|
|
119
|
-
const t = {};
|
|
120
|
-
if (!o) return t;
|
|
121
|
-
const n = o.split(" ");
|
|
122
|
-
for (const r of n) {
|
|
123
|
-
const [p, m] = r.split("-");
|
|
124
|
-
if (p)
|
|
125
|
-
if (p in d) {
|
|
126
|
-
if (m === "") continue;
|
|
127
|
-
const s = Number(m);
|
|
128
|
-
!Number.isNaN(s) && Number.isFinite(s) ? t[p] = s : t[p] = m;
|
|
129
|
-
} else p in u ? t[p] = !0 : console.warn(`Unknown prop ${p}`);
|
|
130
|
-
}
|
|
131
|
-
return t;
|
|
132
|
-
}
|
|
133
|
-
export {
|
|
134
|
-
u as booleanStyleMap,
|
|
135
|
-
S as computeBoxClassName,
|
|
136
|
-
T as computeBoxProps,
|
|
137
|
-
P as computeTwClass,
|
|
138
|
-
e as halfUnit,
|
|
139
|
-
d as stringStyleMap,
|
|
140
|
-
f as unit
|
|
141
|
-
};
|
|
1
|
+
import*as t from"./constants.js";import*as o from"./react.js";let i=t=>"string"==typeof t?t.endsWith("px")?`${Number.parseFloat(t)/12}rem`:t:"number"==typeof t?`${t}rem`:void 0,e=t=>"string"==typeof t?i(t):"number"==typeof t?i(.5*t):void 0;function n(o){return"string"==typeof o&&t.CSS_COLORS.includes(o)}let r=t=>(o,i)=>{("number"==typeof i||"string"==typeof i)&&(o[t]=i)},l=(t,o)=>(i,e)=>{("number"==typeof e||"string"==typeof e)&&(i[t]=o(e))},p=(t,o)=>(i,e)=>{e&&(i[t]=o)},a=(t,o,i)=>(e,n)=>{if("number"==typeof n||"string"==typeof n)for(let r=0;r<i.length;r++)e[t+i[r]]=o(n)},g=t=>(o,i)=>{n(i)||(o[t]=i)},f={align:r("textAlign"),bottom:l("bottom",i),fontFamily:r("fontFamily"),fontSize:l("fontSize",i),fontWeight:r("fontWeight"),height:l("height",i),left:l("left",i),maxHeight:l("maxHeight",i),maxWidth:l("maxWidth",i),minHeight:l("minHeight",i),minWidth:l("minWidth",i),opacity:r("opacity"),overflow:r("overflow"),overflowX:r("overflowX"),overflowY:r("overflowY"),position:r("position"),right:l("right",i),textAlign:r("textAlign"),top:l("top",i),verticalAlign:r("verticalAlign"),width:l("width",i),lineHeight:(t,o)=>{"number"==typeof o?t.lineHeight=o:"string"==typeof o&&(t.lineHeight=i(o))},m:a("margin",e,["Top","Bottom","Left","Right"]),mb:l("marginBottom",e),ml:l("marginLeft",e),mr:l("marginRight",e),mt:l("marginTop",e),mx:a("margin",e,["Left","Right"]),my:a("margin",e,["Top","Bottom"]),g:l("gap",e),gr:l("rowGap",e),gc:l("columnGap",e),p:a("padding",e,["Top","Bottom","Left","Right"]),pb:l("paddingBottom",e),pl:l("paddingLeft",e),pr:l("paddingRight",e),pt:l("paddingTop",e),px:a("padding",e,["Left","Right"]),py:a("padding",e,["Top","Bottom"]),color:g("color"),textColor:g("color"),backgroundColor:g("backgroundColor")},m={bold:p("fontWeight","bold"),fillPositionedParent:(t,o)=>{o&&(t.position="absolute",t.top=0,t.bottom=0,t.left=0,t.right=0)},inline:p("display","inline-block"),italic:p("fontStyle","italic"),nowrap:p("whiteSpace","nowrap"),preserveWhitespace:p("whiteSpace","pre-wrap")};function s(t){let o={},i={};for(let e in t){if("style"===e)continue;let n=t[e],r=f[e]||m[e];r?r(i,n):o[e]=n}return o.style={...i,...t.style},o}function h(t){let i=t.textColor||t.color,{backgroundColor:e}=t;return(0,o.classes)([n(i)&&`color-${i}`,n(e)&&`color-bg-${e}`])}function c(t){let o={};if(!t)return o;for(let i of t.split(" ")){let[t,e]=i.split("-");if(t)if(t in f){if(""===e)continue;let i=Number(e);!Number.isNaN(i)&&Number.isFinite(i)?o[t]=i:o[t]=e}else t in m?o[t]=!0:console.warn(`Unknown prop ${t}`)}return o}export{m as booleanStyleMap,h as computeBoxClassName,s as computeBoxProps,c as computeTwClass,e as halfUnit,f as stringStyleMap,i as unit};
|
package/dist/common/uuid.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
function
|
|
2
|
-
let x = (/* @__PURE__ */ new Date()).getTime();
|
|
3
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
|
|
4
|
-
const t = (x + Math.random() * 16) % 16 | 0;
|
|
5
|
-
return x = Math.floor(x / 16), (e === "x" ? t : t & 3 | 8).toString(16);
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
r as createUuid
|
|
10
|
-
};
|
|
1
|
+
function x(){let x=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=(x+16*Math.random())%16|0;return x=Math.floor(x/16),("x"===e?t:3&t|8).toString(16)})}export{x as createUuid};
|
package/dist/common/vector.js
CHANGED
|
@@ -1,48 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function u(n, e) {
|
|
3
|
-
return n + e;
|
|
4
|
-
}
|
|
5
|
-
function c(n, e) {
|
|
6
|
-
return n - e;
|
|
7
|
-
}
|
|
8
|
-
function i(n, e) {
|
|
9
|
-
return n * e;
|
|
10
|
-
}
|
|
11
|
-
function o(n, e) {
|
|
12
|
-
return n / e;
|
|
13
|
-
}
|
|
14
|
-
function m(...n) {
|
|
15
|
-
return r(...n).map((e) => e.reduce(u));
|
|
16
|
-
}
|
|
17
|
-
function p(...n) {
|
|
18
|
-
return r(...n).map((e) => e.reduce(c));
|
|
19
|
-
}
|
|
20
|
-
function f(...n) {
|
|
21
|
-
return r(...n).map((e) => e.reduce(i));
|
|
22
|
-
}
|
|
23
|
-
function v(...n) {
|
|
24
|
-
return r(...n).map((e) => e.reduce(o));
|
|
25
|
-
}
|
|
26
|
-
function l(n, e) {
|
|
27
|
-
return n.map((t) => t * e);
|
|
28
|
-
}
|
|
29
|
-
function s(n) {
|
|
30
|
-
return n.map((e) => -e);
|
|
31
|
-
}
|
|
32
|
-
function a(n) {
|
|
33
|
-
return Math.sqrt(f(n, n).reduce(u));
|
|
34
|
-
}
|
|
35
|
-
function h(n) {
|
|
36
|
-
const e = a(n);
|
|
37
|
-
return n.map((t) => t / e);
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
m as vecAdd,
|
|
41
|
-
v as vecDivide,
|
|
42
|
-
s as vecInverse,
|
|
43
|
-
a as vecLength,
|
|
44
|
-
f as vecMultiply,
|
|
45
|
-
h as vecNormalize,
|
|
46
|
-
l as vecScale,
|
|
47
|
-
p as vecSubtract
|
|
48
|
-
};
|
|
1
|
+
import*as e from"./collections.js";function n(e,n){return e+n}function r(e,n){return e-n}function t(e,n){return e*n}function u(e,n){return e/n}function c(...r){return(0,e.zip)(...r).map(e=>e.reduce(n))}function i(...n){return(0,e.zip)(...n).map(e=>e.reduce(r))}function o(...n){return(0,e.zip)(...n).map(e=>e.reduce(t))}function p(...n){return(0,e.zip)(...n).map(e=>e.reduce(u))}function f(e,n){return e.map(e=>e*n)}function a(e){return e.map(e=>-e)}function m(e){return Math.sqrt(o(e,e).reduce(n))}function v(e){let n=m(e);return e.map(e=>e/n)}export{c as vecAdd,p as vecDivide,a as vecInverse,m as vecLength,o as vecMultiply,v as vecNormalize,f as vecScale,i as vecSubtract};
|
|
@@ -26,7 +26,7 @@ export declare class AnimatedNumber extends Component<Props> {
|
|
|
26
26
|
/**
|
|
27
27
|
* The inner `<span/>` being updated sixty times per second.
|
|
28
28
|
*/
|
|
29
|
-
ref: import(
|
|
29
|
+
ref: import("react").RefObject<HTMLSpanElement | null>;
|
|
30
30
|
/**
|
|
31
31
|
* The interval being used to update the inner span.
|
|
32
32
|
*/
|
|
@@ -1,73 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var p = (r, i, t) => i in r ? f(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
|
|
3
|
-
var s = (r, i, t) => p(r, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
-
import { jsx as v } from "react/jsx-runtime";
|
|
5
|
-
import { Component as m, createRef as g } from "react";
|
|
6
|
-
import { isSafeNumber as o, toFixed as d, clamp as T } from "../common/math.js";
|
|
7
|
-
const V = 1e3 / 60, u = 0.8333, l = 1e-3;
|
|
8
|
-
class b extends m {
|
|
9
|
-
constructor(t) {
|
|
10
|
-
super(t);
|
|
11
|
-
/**
|
|
12
|
-
* The inner `<span/>` being updated sixty times per second.
|
|
13
|
-
*/
|
|
14
|
-
s(this, "ref", g());
|
|
15
|
-
/**
|
|
16
|
-
* The interval being used to update the inner span.
|
|
17
|
-
*/
|
|
18
|
-
s(this, "interval");
|
|
19
|
-
/**
|
|
20
|
-
* The current value. This values approaches the target value.
|
|
21
|
-
*/
|
|
22
|
-
s(this, "currentValue", 0);
|
|
23
|
-
const { initial: e, value: n } = t;
|
|
24
|
-
e !== void 0 && o(e) ? this.currentValue = e : o(n) && (this.currentValue = n);
|
|
25
|
-
}
|
|
26
|
-
componentDidMount() {
|
|
27
|
-
this.currentValue !== this.props.value && this.startTicking();
|
|
28
|
-
}
|
|
29
|
-
componentWillUnmount() {
|
|
30
|
-
this.stopTicking();
|
|
31
|
-
}
|
|
32
|
-
shouldComponentUpdate(t) {
|
|
33
|
-
return t.value !== this.props.value && this.startTicking(), !1;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Starts animating the inner span. If the inner span is already animating,
|
|
37
|
-
* this is a no-op.
|
|
38
|
-
*/
|
|
39
|
-
startTicking() {
|
|
40
|
-
this.interval === void 0 && (this.interval = setInterval(() => this.tick(), V));
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Stops animating the inner span.
|
|
44
|
-
*/
|
|
45
|
-
stopTicking() {
|
|
46
|
-
this.interval !== void 0 && (clearInterval(this.interval), this.interval = void 0);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Steps forward one frame.
|
|
50
|
-
*/
|
|
51
|
-
tick() {
|
|
52
|
-
const { currentValue: t } = this, { value: e } = this.props;
|
|
53
|
-
o(e) ? this.currentValue = t * u + e * (1 - u) : this.stopTicking(), Math.abs(e - this.currentValue) < Math.max(l, l * e) && (this.currentValue = e, this.stopTicking()), this.ref.current && (this.ref.current.textContent = this.getText());
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Gets the inner text of the span.
|
|
57
|
-
*/
|
|
58
|
-
getText() {
|
|
59
|
-
const { props: t, currentValue: e } = this, { format: n, value: a } = t;
|
|
60
|
-
if (!o(a))
|
|
61
|
-
return String(a);
|
|
62
|
-
if (n)
|
|
63
|
-
return n(this.currentValue);
|
|
64
|
-
const c = String(a).split(".")[1], h = c ? c.length : 0;
|
|
65
|
-
return d(e, T(h, 0, 8));
|
|
66
|
-
}
|
|
67
|
-
render() {
|
|
68
|
-
return /* @__PURE__ */ v("span", { ref: this.ref, children: this.getText() });
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
export {
|
|
72
|
-
b as AnimatedNumber
|
|
73
|
-
};
|
|
1
|
+
import*as t from"react/jsx-runtime";import*as e from"react";import*as r from"../common/math.js";let i=1e3/60;class s extends e.Component{ref=(0,e.createRef)();interval;currentValue=0;constructor(t){super(t);let{initial:e,value:i}=t;void 0!==e&&(0,r.isSafeNumber)(e)?this.currentValue=e:(0,r.isSafeNumber)(i)&&(this.currentValue=i)}componentDidMount(){this.currentValue!==this.props.value&&this.startTicking()}componentWillUnmount(){this.stopTicking()}shouldComponentUpdate(t){return t.value!==this.props.value&&this.startTicking(),!1}startTicking(){void 0===this.interval&&(this.interval=setInterval(()=>this.tick(),i))}stopTicking(){void 0!==this.interval&&(clearInterval(this.interval),this.interval=void 0)}tick(){let{currentValue:t}=this,{value:e}=this.props;(0,r.isSafeNumber)(e)?this.currentValue=.8333*t+.16669999999999996*e:this.stopTicking(),Math.abs(e-this.currentValue)<Math.max(.001,.001*e)&&(this.currentValue=e,this.stopTicking()),this.ref.current&&(this.ref.current.textContent=this.getText())}getText(){let{props:t,currentValue:e}=this,{format:i,value:s}=t;if(!(0,r.isSafeNumber)(s))return String(s);if(i)return i(this.currentValue);let n=String(s).split(".")[1],a=n?n.length:0;return(0,r.toFixed)(e,(0,r.clamp)(a,0,8))}render(){return(0,t.jsx)("span",{ref:this.ref,children:this.getText()})}}export{s as AnimatedNumber};
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useRef as c, useEffect as f } from "react";
|
|
3
|
-
function m(r) {
|
|
4
|
-
const { children: o } = r, t = c(null);
|
|
5
|
-
return f(() => {
|
|
6
|
-
const u = setTimeout(() => {
|
|
7
|
-
var e;
|
|
8
|
-
(e = t.current) == null || e.focus();
|
|
9
|
-
}, 1);
|
|
10
|
-
return () => {
|
|
11
|
-
clearTimeout(u);
|
|
12
|
-
};
|
|
13
|
-
}, []), /* @__PURE__ */ n("div", { ref: t, tabIndex: -1, children: o });
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
m as Autofocus
|
|
17
|
-
};
|
|
1
|
+
import*as e from"react/jsx-runtime";import*as t from"react";function r(r){let{children:u}=r,o=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let e=setTimeout(()=>{o.current?.focus()},1);return()=>{clearTimeout(e)}},[]),(0,e.jsx)("div",{ref:o,tabIndex:-1,children:u})}export{r as Autofocus};
|
package/dist/components/Blink.js
CHANGED
|
@@ -1,56 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var a = (i, e, t) => e in i ? n(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
-
var s = (i, e, t) => a(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { jsx as l } from "react/jsx-runtime";
|
|
5
|
-
import { Component as o } from "react";
|
|
6
|
-
const h = 1e3, m = 1e3;
|
|
7
|
-
class v extends o {
|
|
8
|
-
constructor(t) {
|
|
9
|
-
super(t);
|
|
10
|
-
s(this, "interval");
|
|
11
|
-
s(this, "timer");
|
|
12
|
-
this.state = {
|
|
13
|
-
hidden: !1
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
createTimer() {
|
|
17
|
-
const {
|
|
18
|
-
interval: t = h,
|
|
19
|
-
time: r = m
|
|
20
|
-
} = this.props;
|
|
21
|
-
clearInterval(this.interval), clearTimeout(this.timer), this.setState({
|
|
22
|
-
hidden: !1
|
|
23
|
-
}), this.interval = setInterval(() => {
|
|
24
|
-
this.setState({
|
|
25
|
-
hidden: !0
|
|
26
|
-
}), this.timer = setTimeout(() => {
|
|
27
|
-
this.setState({
|
|
28
|
-
hidden: !1
|
|
29
|
-
});
|
|
30
|
-
}, r);
|
|
31
|
-
}, t + r);
|
|
32
|
-
}
|
|
33
|
-
componentDidMount() {
|
|
34
|
-
this.createTimer();
|
|
35
|
-
}
|
|
36
|
-
componentDidUpdate(t) {
|
|
37
|
-
(t.interval !== this.props.interval || t.time !== this.props.time) && this.createTimer();
|
|
38
|
-
}
|
|
39
|
-
componentWillUnmount() {
|
|
40
|
-
clearInterval(this.interval), clearTimeout(this.timer);
|
|
41
|
-
}
|
|
42
|
-
render() {
|
|
43
|
-
return /* @__PURE__ */ l(
|
|
44
|
-
"span",
|
|
45
|
-
{
|
|
46
|
-
style: {
|
|
47
|
-
visibility: this.state.hidden ? "hidden" : "visible"
|
|
48
|
-
},
|
|
49
|
-
children: this.props.children
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
export {
|
|
55
|
-
v as Blink
|
|
56
|
-
};
|
|
1
|
+
import*as t from"react/jsx-runtime";import*as e from"react";class i extends e.Component{interval;timer;constructor(t){super(t),this.state={hidden:!1}}createTimer(){let{interval:t=1e3,time:e=1e3}=this.props;clearInterval(this.interval),clearTimeout(this.timer),this.setState({hidden:!1}),this.interval=setInterval(()=>{this.setState({hidden:!0}),this.timer=setTimeout(()=>{this.setState({hidden:!1})},e)},t+e)}componentDidMount(){this.createTimer()}componentDidUpdate(t){(t.interval!==this.props.interval||t.time!==this.props.time)&&this.createTimer()}componentWillUnmount(){clearInterval(this.interval),clearTimeout(this.timer)}render(){return(0,t.jsx)("span",{style:{visibility:this.state.hidden?"hidden":"visible"},children:this.props.children})}}export{i as Blink};
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { classes as e } from "../common/react.js";
|
|
3
|
-
import { Box as m } from "./Box.js";
|
|
4
|
-
function f(o) {
|
|
5
|
-
const { className: r, ...s } = o;
|
|
6
|
-
return /* @__PURE__ */ t(m, { className: e(["BlockQuote", r]), ...s });
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
f as BlockQuote
|
|
10
|
-
};
|
|
1
|
+
import*as o from"react/jsx-runtime";import*as r from"../common/react.js";import*as s from"./Box.js";function t(t){let{className:e,...m}=t;return(0,o.jsx)(s.Box,{className:(0,r.classes)(["BlockQuote",e]),...m})}export{t as BlockQuote};
|
package/dist/components/Box.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CSSProperties, KeyboardEventHandler, MouseEventHandler, ReactNode, UIEventHandler } from 'react';
|
|
2
|
-
import { BooleanLike } from '../common/react';
|
|
3
|
-
import { BooleanStyleMap, StringStyleMap } from '../common/ui';
|
|
1
|
+
import { type CSSProperties, type KeyboardEventHandler, type MouseEventHandler, type ReactNode, type UIEventHandler } from 'react';
|
|
2
|
+
import type { BooleanLike } from '../common/react';
|
|
3
|
+
import { type BooleanStyleMap, type StringStyleMap } from '../common/ui';
|
|
4
4
|
type EventHandlers = {
|
|
5
5
|
onClick: MouseEventHandler<HTMLDivElement>;
|
|
6
6
|
onContextMenu: MouseEventHandler<HTMLDivElement>;
|
|
@@ -97,7 +97,7 @@ type DangerDoNotUse = {
|
|
|
97
97
|
*
|
|
98
98
|
* Default font size (`1rem`) is equal to `12px`.
|
|
99
99
|
*/
|
|
100
|
-
export declare function Box(props: BoxProps & DangerDoNotUse): import(
|
|
100
|
+
export declare function Box(props: BoxProps & DangerDoNotUse): import("react").ReactElement<{
|
|
101
101
|
className: string;
|
|
102
|
-
}, string | import(
|
|
102
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
103
103
|
export {};
|
package/dist/components/Box.js
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { computeBoxClassName as s, computeBoxProps as l, computeTwClass as u } from "../common/ui.js";
|
|
3
|
-
function x(t) {
|
|
4
|
-
const { as: m = "div", className: e, children: c, tw: r, ...o } = t, a = e ? `${e} ${s(o)}` : s(o), p = l({
|
|
5
|
-
...o,
|
|
6
|
-
...u(r)
|
|
7
|
-
});
|
|
8
|
-
return n(
|
|
9
|
-
m,
|
|
10
|
-
{
|
|
11
|
-
...p,
|
|
12
|
-
className: a
|
|
13
|
-
},
|
|
14
|
-
c
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
x as Box
|
|
19
|
-
};
|
|
1
|
+
import*as o from"react";import*as e from"../common/ui.js";function m(m){let{as:t="div",className:s,children:a,tw:r,...c}=m,p=s?`${s} ${(0,e.computeBoxClassName)(c)}`:(0,e.computeBoxClassName)(c),u=(0,e.computeBoxProps)({...c,...(0,e.computeTwClass)(r)});return(0,o.createElement)(t,{...u,className:p},a)}export{m as Box};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Placement } from '@floating-ui/react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { BooleanLike } from '../common/react';
|
|
4
|
-
import { BoxProps } from './Box';
|
|
1
|
+
import type { Placement } from '@floating-ui/react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type BooleanLike } from '../common/react';
|
|
4
|
+
import { type BoxProps } from './Box';
|
|
5
5
|
/**
|
|
6
6
|
* Getting ellipses to work requires that you use:
|
|
7
7
|
* 1. A string rather than a node
|