@gearbox-protocol/permissionless-ui 1.23.0 → 1.24.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/cjs/components/buttons/range-buttons/range-buttons.cjs +1 -1
- package/dist/cjs/components/graph/graph-tooltip.cjs +1 -1
- package/dist/cjs/components/graph/graph-view.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/graph/index.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/tab-control/tab-control.cjs +1 -1
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/utils/colors.cjs +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/esm/components/buttons/range-buttons/range-buttons.js +1 -1
- package/dist/esm/components/graph/graph-tooltip.js +17 -17
- package/dist/esm/components/graph/graph-view.js +21 -21
- package/dist/esm/components/graph/graph.js +317 -247
- package/dist/esm/components/graph/index.js +11 -10
- package/dist/esm/components/index.js +440 -439
- package/dist/esm/components/tab-control/tab-control.js +49 -49
- package/dist/esm/components/trading-view/trading-view.js +84 -82
- package/dist/esm/index.js +583 -581
- package/dist/esm/utils/colors.js +40 -28
- package/dist/esm/utils/index.js +78 -77
- package/dist/globals.css +1 -1
- package/dist/types/components/graph/graph.d.ts +20 -1
- package/dist/types/components/tab-control/tab-control.d.ts +1 -1
- package/dist/types/components/trading-view/trading-view.d.ts +6 -1
- package/dist/types/utils/colors.d.ts +8 -0
- package/package.json +1 -1
package/dist/esm/utils/colors.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
function
|
|
1
|
+
function g(t, r = "#000000") {
|
|
2
2
|
if (!t.includes("var("))
|
|
3
3
|
return t;
|
|
4
4
|
try {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
if (document.body.removeChild(
|
|
9
|
-
return
|
|
10
|
-
} catch (
|
|
11
|
-
console.warn(`Failed to resolve CSS color: ${t}`,
|
|
5
|
+
const n = document.createElement("div");
|
|
6
|
+
n.style.color = t, n.style.display = "none", document.body.appendChild(n);
|
|
7
|
+
const e = window.getComputedStyle(n).color;
|
|
8
|
+
if (document.body.removeChild(n), e && e !== "rgba(0, 0, 0, 0)")
|
|
9
|
+
return e;
|
|
10
|
+
} catch (n) {
|
|
11
|
+
console.warn(`Failed to resolve CSS color: ${t}`, n);
|
|
12
12
|
}
|
|
13
13
|
return r;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
15
|
+
function m(t, r = "#000000") {
|
|
16
|
+
const n = t.startsWith("--") ? t : `--${t}`;
|
|
17
17
|
try {
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
return /^[\d\s.%]+$/.test(
|
|
21
|
-
} catch (
|
|
22
|
-
console.warn(`Failed to get CSS variable: ${
|
|
18
|
+
const e = getComputedStyle(document.documentElement).getPropertyValue(n).trim();
|
|
19
|
+
if (e)
|
|
20
|
+
return /^[\d\s.%]+$/.test(e) ? `hsl(${e})` : e;
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.warn(`Failed to get CSS variable: ${n}`, e);
|
|
23
23
|
}
|
|
24
24
|
return r;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
return `rgba(${
|
|
26
|
+
function l(t, r) {
|
|
27
|
+
const n = parseInt(t.slice(1, 3), 16), e = parseInt(t.slice(3, 5), 16), o = parseInt(t.slice(5, 7), 16);
|
|
28
|
+
return `rgba(${n}, ${e}, ${o}, ${r})`;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function b(t) {
|
|
31
31
|
if (t.startsWith("rgba")) {
|
|
32
32
|
const r = t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
33
33
|
if (r) {
|
|
34
|
-
const [,
|
|
34
|
+
const [, n, e, o] = r;
|
|
35
35
|
return {
|
|
36
|
-
topColor: `rgba(${
|
|
37
|
-
bottomColor: `rgba(${
|
|
36
|
+
topColor: `rgba(${n}, ${e}, ${o}, 0.56)`,
|
|
37
|
+
bottomColor: `rgba(${n}, ${e}, ${o}, 0.04)`
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
if (t.startsWith("#") && (t.length === 7 || t.length === 4)) {
|
|
42
42
|
const r = t.length === 4 ? `#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}` : t;
|
|
43
43
|
return {
|
|
44
|
-
topColor:
|
|
45
|
-
bottomColor:
|
|
44
|
+
topColor: l(r, 0.56),
|
|
45
|
+
bottomColor: l(r, 0.04)
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
return {
|
|
@@ -50,9 +50,21 @@ function u(t) {
|
|
|
50
50
|
bottomColor: t
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
+
function f(t, r, n) {
|
|
54
|
+
r /= 100, n /= 100;
|
|
55
|
+
const e = (1 - Math.abs(2 * n - 1)) * r, o = e * (1 - Math.abs(t / 60 % 2 - 1)), c = n - e / 2;
|
|
56
|
+
let s = 0, a = 0, i = 0;
|
|
57
|
+
t < 60 ? (s = e, a = o) : t < 120 ? (s = o, a = e) : t < 180 ? (a = e, i = o) : t < 240 ? (a = o, i = e) : t < 300 ? (s = o, i = e) : (s = e, i = o);
|
|
58
|
+
const u = (d) => {
|
|
59
|
+
const $ = Math.round((d + c) * 255);
|
|
60
|
+
return Math.min(255, Math.max(0, $)).toString(16).padStart(2, "0");
|
|
61
|
+
};
|
|
62
|
+
return `#${u(s)}${u(a)}${u(i)}`;
|
|
63
|
+
}
|
|
53
64
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
b as generateColorsFromBase,
|
|
66
|
+
m as getCSSVariable,
|
|
67
|
+
l as hexToRgba,
|
|
68
|
+
f as hslToHex,
|
|
69
|
+
g as resolveCSSColor
|
|
58
70
|
};
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,96 +1,97 @@
|
|
|
1
1
|
import { generateId as t, useFormFieldIds as r } from "./a11y.js";
|
|
2
2
|
import { bnToInputView as m } from "./bn-to-input-view.js";
|
|
3
3
|
import { bnToPrettyView as n } from "./bn-to-pretty-view.js";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { generateColorsFromBase as x, getCSSVariable as T, hexToRgba as c,
|
|
6
|
-
import { copyToClipboard as
|
|
7
|
-
import { convertPercent as
|
|
8
|
-
import { formatAssetAmount as
|
|
9
|
-
import { formatMoney as
|
|
10
|
-
import { FORMAT_CONSTANTS as
|
|
11
|
-
import { slippageTemplate as
|
|
12
|
-
import { allLoaded as
|
|
13
|
-
import { decimalsToStep as
|
|
14
|
-
import { getNetworkIcon as
|
|
15
|
-
import { bnToLiquidationPriceView as
|
|
16
|
-
import { pluralize as
|
|
17
|
-
import { getAvailableRanges as
|
|
18
|
-
import { extractTextFromLabel as
|
|
19
|
-
import { searchInString as
|
|
20
|
-
import { createTokenSearchFilter as
|
|
21
|
-
import { shortSHA as
|
|
22
|
-
import { isLongString as
|
|
23
|
-
import { negativeTokenTemplate as
|
|
24
|
-
import { TTL_CONSTANTS as
|
|
25
|
-
import { openInNewWindow as
|
|
4
|
+
import { cn as l, cn as f } from "./cn.js";
|
|
5
|
+
import { generateColorsFromBase as x, getCSSVariable as T, hexToRgba as c, hslToHex as g, resolveCSSColor as S } from "./colors.js";
|
|
6
|
+
import { copyToClipboard as d } from "./copy.js";
|
|
7
|
+
import { convertPercent as N, formatBytecodeSize as b, formatBytecodeVersion as A, formatTimestamp as I, shortenHash as v, significantTrunc as L } from "./format.js";
|
|
8
|
+
import { formatAssetAmount as y } from "./format-asset-amount.js";
|
|
9
|
+
import { formatMoney as F, formatMoneyAmount as k, formatPercentAmount as w, percentTemplate as D, percentageTemplate as V } from "./format-money.js";
|
|
10
|
+
import { FORMAT_CONSTANTS as M, formatNumberWithSuffix as _, formatPrice as E, getAdaptiveDecimals as H, isBelowDisplayThreshold as W, isEffectivelyZero as Z, toSignificantDigits as z } from "./format-number.js";
|
|
11
|
+
import { slippageTemplate as R } from "./format-slippage.js";
|
|
12
|
+
import { allLoaded as q, loadingProgress as U, round5 as j } from "./loading.js";
|
|
13
|
+
import { decimalsToStep as J, findClosestPoint as K, formatWithDecimals as Q, formatWithoutDecimals as Y, splitInterval as $, validateMinMax as ee } from "./math.js";
|
|
14
|
+
import { getNetworkIcon as te } from "./network-icons.js";
|
|
15
|
+
import { bnToLiquidationPriceView as ae, isPositiveFloat as me, parseInputToBN as ie, parseSmallNumber as ne } from "./parse-input-to-bn.js";
|
|
16
|
+
import { pluralize as le, selectPluralString as fe } from "./plural.js";
|
|
17
|
+
import { getAvailableRanges as xe } from "./ranges.js";
|
|
18
|
+
import { extractTextFromLabel as ce, serializeValue as ge } from "./react.js";
|
|
19
|
+
import { searchInString as ue } from "./search.js";
|
|
20
|
+
import { createTokenSearchFilter as he, searchInToken as Ne } from "./search-in-token.js";
|
|
21
|
+
import { shortSHA as Ae } from "./short-sha.js";
|
|
22
|
+
import { isLongString as ve, shortenString as Le } from "./shorten-string.js";
|
|
23
|
+
import { negativeTokenTemplate as ye, tokenTemplate as Ce, tokenTemplateNumber as Fe, tokenTemplateString as ke } from "./templates.js";
|
|
24
|
+
import { TTL_CONSTANTS as De, getTTLZones as Ve, ttlFromTimestamp as Be, ttlLeft as Me, ttlLeftHuman as _e } from "./ttl.js";
|
|
25
|
+
import { openInNewWindow as He } from "./window.js";
|
|
26
26
|
import { Z_INDEX as Ze, Z_INDEX_VALUES as ze } from "./z-index.js";
|
|
27
27
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
M as FORMAT_CONSTANTS,
|
|
29
|
+
De as TTL_CONSTANTS,
|
|
30
30
|
Ze as Z_INDEX,
|
|
31
31
|
ze as Z_INDEX_VALUES,
|
|
32
|
-
|
|
32
|
+
q as allLoaded,
|
|
33
33
|
m as bnToInputView,
|
|
34
|
-
|
|
34
|
+
ae as bnToLiquidationPriceView,
|
|
35
35
|
n as bnToPrettyView,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
36
|
+
l as cn,
|
|
37
|
+
N as convertPercent,
|
|
38
|
+
d as copyToClipboard,
|
|
39
|
+
he as createTokenSearchFilter,
|
|
40
|
+
J as decimalsToStep,
|
|
41
|
+
f as default,
|
|
42
|
+
ce as extractTextFromLabel,
|
|
43
|
+
K as findClosestPoint,
|
|
44
|
+
y as formatAssetAmount,
|
|
45
|
+
b as formatBytecodeSize,
|
|
46
|
+
A as formatBytecodeVersion,
|
|
47
|
+
F as formatMoney,
|
|
48
|
+
k as formatMoneyAmount,
|
|
49
|
+
_ as formatNumberWithSuffix,
|
|
50
|
+
w as formatPercentAmount,
|
|
51
|
+
E as formatPrice,
|
|
52
|
+
I as formatTimestamp,
|
|
53
|
+
Q as formatWithDecimals,
|
|
54
|
+
Y as formatWithoutDecimals,
|
|
55
55
|
x as generateColorsFromBase,
|
|
56
56
|
t as generateId,
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
H as getAdaptiveDecimals,
|
|
58
|
+
xe as getAvailableRanges,
|
|
59
59
|
T as getCSSVariable,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
te as getNetworkIcon,
|
|
61
|
+
Ve as getTTLZones,
|
|
62
62
|
c as hexToRgba,
|
|
63
|
+
g as hslToHex,
|
|
63
64
|
W as isBelowDisplayThreshold,
|
|
64
65
|
Z as isEffectivelyZero,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
ve as isLongString,
|
|
67
|
+
me as isPositiveFloat,
|
|
68
|
+
U as loadingProgress,
|
|
69
|
+
ye as negativeTokenTemplate,
|
|
70
|
+
He as openInNewWindow,
|
|
71
|
+
ie as parseInputToBN,
|
|
72
|
+
ne as parseSmallNumber,
|
|
73
|
+
D as percentTemplate,
|
|
74
|
+
V as percentageTemplate,
|
|
75
|
+
le as pluralize,
|
|
76
|
+
S as resolveCSSColor,
|
|
77
|
+
j as round5,
|
|
78
|
+
ue as searchInString,
|
|
79
|
+
Ne as searchInToken,
|
|
79
80
|
fe as selectPluralString,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
ge as serializeValue,
|
|
82
|
+
Ae as shortSHA,
|
|
83
|
+
v as shortenHash,
|
|
84
|
+
Le as shortenString,
|
|
85
|
+
L as significantTrunc,
|
|
86
|
+
R as slippageTemplate,
|
|
87
|
+
$ as splitInterval,
|
|
87
88
|
z as toSignificantDigits,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
Ce as tokenTemplate,
|
|
90
|
+
Fe as tokenTemplateNumber,
|
|
91
|
+
ke as tokenTemplateString,
|
|
92
|
+
Be as ttlFromTimestamp,
|
|
93
|
+
Me as ttlLeft,
|
|
94
|
+
_e as ttlLeftHuman,
|
|
94
95
|
r as useFormFieldIds,
|
|
95
|
-
|
|
96
|
+
ee as validateMinMax
|
|
96
97
|
};
|