@luxfi/ui 7.4.0 → 7.4.2
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/avatar.cjs +7 -6
- package/dist/avatar.js +7 -5
- package/dist/badge.cjs +30 -32
- package/dist/badge.js +30 -32
- package/dist/bank.d.cts +3 -3
- package/dist/bank.d.ts +3 -3
- package/dist/checkbox.cjs +4 -4
- package/dist/checkbox.d.cts +3 -2
- package/dist/checkbox.d.ts +3 -2
- package/dist/checkbox.js +5 -4
- package/dist/chrome.cjs +950 -0
- package/dist/chrome.d.cts +93 -0
- package/dist/chrome.d.ts +93 -0
- package/dist/chrome.js +921 -0
- package/dist/drawer.cjs +86 -20
- package/dist/drawer.js +85 -19
- package/dist/expiration-selector.cjs +3 -2
- package/dist/expiration-selector.js +3 -2
- package/dist/greeks-display.cjs +6 -6
- package/dist/greeks-display.js +6 -6
- package/dist/gui.cjs +13 -0
- package/dist/gui.d.cts +2 -0
- package/dist/gui.d.ts +2 -0
- package/dist/gui.js +2 -0
- package/dist/heading.cjs +4 -2
- package/dist/heading.js +4 -2
- package/dist/iam.cjs +206 -0
- package/dist/iam.d.cts +65 -0
- package/dist/iam.d.ts +65 -0
- package/dist/iam.js +201 -0
- package/dist/icons.cjs +13 -0
- package/dist/icons.d.cts +1 -0
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +2 -0
- package/dist/identity.cjs +420 -0
- package/dist/identity.d.cts +64 -0
- package/dist/identity.d.ts +64 -0
- package/dist/identity.js +398 -0
- package/dist/index.cjs +1597 -833
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1574 -828
- package/dist/input.cjs +3 -1
- package/dist/input.d.cts +3 -5
- package/dist/input.d.ts +3 -5
- package/dist/input.js +3 -1
- package/dist/lux.config.cjs +23 -2
- package/dist/lux.config.d.cts +28 -10
- package/dist/lux.config.d.ts +28 -10
- package/dist/lux.config.js +23 -2
- package/dist/menu.cjs +4 -4
- package/dist/menu.js +4 -4
- package/dist/next.cjs +99 -0
- package/dist/next.d.cts +29 -0
- package/dist/next.d.ts +29 -0
- package/dist/next.js +96 -0
- package/dist/option-chain.cjs +1 -1
- package/dist/option-chain.js +1 -1
- package/dist/option-position.cjs +2 -1
- package/dist/option-position.js +2 -1
- package/dist/pnl-diagram.cjs +8 -6
- package/dist/pnl-diagram.js +8 -6
- package/dist/progress.cjs +7 -6
- package/dist/progress.js +7 -5
- package/dist/provider.cjs +136 -4
- package/dist/provider.d.cts +15 -3
- package/dist/provider.d.ts +15 -3
- package/dist/provider.js +136 -5
- package/dist/radio.cjs +9 -7
- package/dist/radio.js +10 -7
- package/dist/separator.cjs +3 -1
- package/dist/separator.js +3 -1
- package/dist/slider.cjs +28 -16
- package/dist/slider.js +28 -15
- package/dist/strategy-builder.cjs +2 -1
- package/dist/strategy-builder.js +2 -1
- package/dist/switch.cjs +11 -12
- package/dist/switch.js +12 -12
- package/dist/tag.cjs +31 -33
- package/dist/tag.js +30 -32
- package/dist/textarea.cjs +3 -1
- package/dist/textarea.js +3 -1
- package/dist/tooltip.cjs +25 -27
- package/dist/tooltip.js +24 -26
- package/dist/use-narrow.cjs +46 -0
- package/dist/use-narrow.d.cts +12 -0
- package/dist/use-narrow.d.ts +12 -0
- package/dist/use-narrow.js +20 -0
- package/dist/vite.cjs +40 -0
- package/dist/vite.d.cts +29 -0
- package/dist/vite.d.ts +29 -0
- package/dist/vite.js +38 -0
- package/dist/white-label.cjs +132 -0
- package/dist/white-label.d.cts +59 -0
- package/dist/white-label.d.ts +59 -0
- package/dist/white-label.js +124 -0
- package/package.json +85 -19
- package/src/avatar.tsx +22 -16
- package/src/checkbox.tsx +15 -10
- package/src/chrome.tsx +459 -0
- package/src/drawer.tsx +83 -10
- package/src/expiration-selector.tsx +3 -2
- package/src/greeks-display.tsx +9 -6
- package/src/gui.ts +17 -0
- package/src/heading.tsx +12 -8
- package/src/iam.ts +170 -0
- package/src/icons.ts +18 -0
- package/src/identity.tsx +318 -0
- package/src/index.ts +44 -1
- package/src/input.tsx +13 -9
- package/src/lux.config.ts +16 -15
- package/src/menu.tsx +4 -4
- package/src/next.ts +142 -0
- package/src/option-chain.tsx +1 -1
- package/src/option-position.tsx +2 -1
- package/src/pnl-diagram.tsx +11 -6
- package/src/progress.tsx +15 -8
- package/src/provider.tsx +48 -7
- package/src/radio.tsx +15 -11
- package/src/separator.tsx +8 -3
- package/src/slider.tsx +35 -19
- package/src/strategy-builder.tsx +3 -2
- package/src/switch.tsx +17 -16
- package/src/textarea.tsx +8 -4
- package/src/tooltip.tsx +2 -21
- package/src/use-narrow.ts +40 -0
- package/src/vite.ts +78 -0
- package/src/white-label.ts +240 -0
- package/tokens.css +544 -319
- package/src/tokens.css +0 -438
package/dist/vite.cjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/vite.ts
|
|
4
|
+
var DEDUPE = [
|
|
5
|
+
"react",
|
|
6
|
+
"react-dom",
|
|
7
|
+
"@tanstack/react-query",
|
|
8
|
+
"@hanzo/gui",
|
|
9
|
+
"@hanzogui/core",
|
|
10
|
+
"@hanzogui/web"
|
|
11
|
+
];
|
|
12
|
+
var INCLUDE = [
|
|
13
|
+
"react-native-web",
|
|
14
|
+
"@react-native/normalize-color",
|
|
15
|
+
"@hanzo/gui",
|
|
16
|
+
"@hanzogui/core",
|
|
17
|
+
"@luxfi/ui"
|
|
18
|
+
];
|
|
19
|
+
function luxUi(options = {}) {
|
|
20
|
+
return {
|
|
21
|
+
name: "@luxfi/ui",
|
|
22
|
+
config: () => ({
|
|
23
|
+
// The engine branches on these at module scope; without them it takes the
|
|
24
|
+
// native path in a browser bundle.
|
|
25
|
+
define: {
|
|
26
|
+
"process.env.EXPO_OS": JSON.stringify("web"),
|
|
27
|
+
"process.env.IS_WEB": JSON.stringify("true")
|
|
28
|
+
},
|
|
29
|
+
resolve: {
|
|
30
|
+
alias: { "react-native": "react-native-web" },
|
|
31
|
+
dedupe: [.../* @__PURE__ */ new Set([...DEDUPE, ...options.dedupe ?? []])]
|
|
32
|
+
},
|
|
33
|
+
optimizeDeps: {
|
|
34
|
+
include: [.../* @__PURE__ */ new Set([...INCLUDE, ...options.include ?? []])]
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.luxUi = luxUi;
|
package/dist/vite.d.cts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface LuxUiViteOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Extra packages to keep to a single physical copy. React, the gui engine and
|
|
4
|
+
* TanStack Query are always deduped.
|
|
5
|
+
*/
|
|
6
|
+
readonly dedupe?: ReadonlyArray<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Extra packages to pre-bundle. The engine, react-native-web and the CJS-only
|
|
9
|
+
* colour helper are always included.
|
|
10
|
+
*/
|
|
11
|
+
readonly include?: ReadonlyArray<string>;
|
|
12
|
+
}
|
|
13
|
+
/** Minimal structural shape of a Vite plugin — avoids a hard `vite` type dep. */
|
|
14
|
+
interface LuxUiVitePlugin {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly config: () => {
|
|
17
|
+
define: Record<string, string>;
|
|
18
|
+
resolve: {
|
|
19
|
+
alias: Record<string, string>;
|
|
20
|
+
dedupe: Array<string>;
|
|
21
|
+
};
|
|
22
|
+
optimizeDeps: {
|
|
23
|
+
include: Array<string>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
declare function luxUi(options?: LuxUiViteOptions): LuxUiVitePlugin;
|
|
28
|
+
|
|
29
|
+
export { type LuxUiViteOptions, luxUi };
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface LuxUiViteOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Extra packages to keep to a single physical copy. React, the gui engine and
|
|
4
|
+
* TanStack Query are always deduped.
|
|
5
|
+
*/
|
|
6
|
+
readonly dedupe?: ReadonlyArray<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Extra packages to pre-bundle. The engine, react-native-web and the CJS-only
|
|
9
|
+
* colour helper are always included.
|
|
10
|
+
*/
|
|
11
|
+
readonly include?: ReadonlyArray<string>;
|
|
12
|
+
}
|
|
13
|
+
/** Minimal structural shape of a Vite plugin — avoids a hard `vite` type dep. */
|
|
14
|
+
interface LuxUiVitePlugin {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly config: () => {
|
|
17
|
+
define: Record<string, string>;
|
|
18
|
+
resolve: {
|
|
19
|
+
alias: Record<string, string>;
|
|
20
|
+
dedupe: Array<string>;
|
|
21
|
+
};
|
|
22
|
+
optimizeDeps: {
|
|
23
|
+
include: Array<string>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
declare function luxUi(options?: LuxUiViteOptions): LuxUiVitePlugin;
|
|
28
|
+
|
|
29
|
+
export { type LuxUiViteOptions, luxUi };
|
package/dist/vite.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/vite.ts
|
|
2
|
+
var DEDUPE = [
|
|
3
|
+
"react",
|
|
4
|
+
"react-dom",
|
|
5
|
+
"@tanstack/react-query",
|
|
6
|
+
"@hanzo/gui",
|
|
7
|
+
"@hanzogui/core",
|
|
8
|
+
"@hanzogui/web"
|
|
9
|
+
];
|
|
10
|
+
var INCLUDE = [
|
|
11
|
+
"react-native-web",
|
|
12
|
+
"@react-native/normalize-color",
|
|
13
|
+
"@hanzo/gui",
|
|
14
|
+
"@hanzogui/core",
|
|
15
|
+
"@luxfi/ui"
|
|
16
|
+
];
|
|
17
|
+
function luxUi(options = {}) {
|
|
18
|
+
return {
|
|
19
|
+
name: "@luxfi/ui",
|
|
20
|
+
config: () => ({
|
|
21
|
+
// The engine branches on these at module scope; without them it takes the
|
|
22
|
+
// native path in a browser bundle.
|
|
23
|
+
define: {
|
|
24
|
+
"process.env.EXPO_OS": JSON.stringify("web"),
|
|
25
|
+
"process.env.IS_WEB": JSON.stringify("true")
|
|
26
|
+
},
|
|
27
|
+
resolve: {
|
|
28
|
+
alias: { "react-native": "react-native-web" },
|
|
29
|
+
dedupe: [.../* @__PURE__ */ new Set([...DEDUPE, ...options.dedupe ?? []])]
|
|
30
|
+
},
|
|
31
|
+
optimizeDeps: {
|
|
32
|
+
include: [.../* @__PURE__ */ new Set([...INCLUDE, ...options.include ?? []])]
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { luxUi };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/white-label.ts
|
|
4
|
+
var LUX_BRAND = {
|
|
5
|
+
lux: "#7000FF",
|
|
6
|
+
zoo: "#6C5EFB",
|
|
7
|
+
hanzo: "#EA580C",
|
|
8
|
+
pars: "#1C3879",
|
|
9
|
+
// bootno.de is its own white label with its own IdP (id.bootno.de) — accent
|
|
10
|
+
// taken from the bootnode console's own brand default, not invented here.
|
|
11
|
+
bootnode: "#3B82F6"
|
|
12
|
+
};
|
|
13
|
+
var PARS_GOLD = "#C8A45C";
|
|
14
|
+
var ORGS = {
|
|
15
|
+
lux: {
|
|
16
|
+
org: "lux",
|
|
17
|
+
name: "Lux",
|
|
18
|
+
domain: "lux.network",
|
|
19
|
+
iamDomain: "lux.id",
|
|
20
|
+
accent: LUX_BRAND.lux,
|
|
21
|
+
accentForeground: "#FFFFFF"
|
|
22
|
+
},
|
|
23
|
+
zoo: {
|
|
24
|
+
org: "zoo",
|
|
25
|
+
name: "Zoo",
|
|
26
|
+
domain: "zoo.ngo",
|
|
27
|
+
// Zoo's IdP is `id.zoo.network`, not a `zoo.id` apex — the one row in this
|
|
28
|
+
// table where the issuer is not `<org>.id`, and the one every hand-rolled
|
|
29
|
+
// per-app branding map got wrong.
|
|
30
|
+
iamDomain: "id.zoo.network",
|
|
31
|
+
accent: LUX_BRAND.zoo,
|
|
32
|
+
accentForeground: "#FFFFFF"
|
|
33
|
+
},
|
|
34
|
+
bootnode: {
|
|
35
|
+
org: "bootnode",
|
|
36
|
+
name: "Bootnode",
|
|
37
|
+
domain: "bootno.de",
|
|
38
|
+
iamDomain: "id.bootno.de",
|
|
39
|
+
accent: LUX_BRAND.lux,
|
|
40
|
+
accentForeground: "#FFFFFF"
|
|
41
|
+
},
|
|
42
|
+
hanzo: {
|
|
43
|
+
org: "hanzo",
|
|
44
|
+
name: "Hanzo",
|
|
45
|
+
domain: "hanzo.ai",
|
|
46
|
+
iamDomain: "hanzo.id",
|
|
47
|
+
accent: LUX_BRAND.hanzo,
|
|
48
|
+
accentForeground: "#FFFFFF"
|
|
49
|
+
},
|
|
50
|
+
pars: {
|
|
51
|
+
org: "pars",
|
|
52
|
+
name: "Pars",
|
|
53
|
+
domain: "pars.id",
|
|
54
|
+
iamDomain: "pars.id",
|
|
55
|
+
accent: LUX_BRAND.pars,
|
|
56
|
+
accentForeground: PARS_GOLD
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var DOMAIN_ORG = [
|
|
60
|
+
["lux.network", "lux"],
|
|
61
|
+
["lux.cloud", "lux"],
|
|
62
|
+
["lux.id", "lux"],
|
|
63
|
+
["lux.finance", "lux"],
|
|
64
|
+
["zoo.ngo", "zoo"],
|
|
65
|
+
["zoo.network", "zoo"],
|
|
66
|
+
["zoo.cloud", "zoo"],
|
|
67
|
+
["zoo.id", "zoo"],
|
|
68
|
+
["hanzo.ai", "hanzo"],
|
|
69
|
+
["hanzo.cloud", "hanzo"],
|
|
70
|
+
["hanzo.id", "hanzo"],
|
|
71
|
+
["pars.id", "pars"],
|
|
72
|
+
["parsdao.org", "pars"],
|
|
73
|
+
["bootno.de", "bootnode", "platform"]
|
|
74
|
+
];
|
|
75
|
+
var DEFAULT_ORG = "lux";
|
|
76
|
+
function normalizeHost(host) {
|
|
77
|
+
const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
|
|
78
|
+
return noPort.replace(/\.$/, "");
|
|
79
|
+
}
|
|
80
|
+
function isUnder(host, domain) {
|
|
81
|
+
return host === domain || host.endsWith(`.${domain}`);
|
|
82
|
+
}
|
|
83
|
+
function matchDomain(host) {
|
|
84
|
+
let best;
|
|
85
|
+
for (const entry of DOMAIN_ORG) {
|
|
86
|
+
if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
|
|
87
|
+
best = entry;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return best;
|
|
91
|
+
}
|
|
92
|
+
function appSlug(host, domain, apexApp) {
|
|
93
|
+
const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
|
|
94
|
+
const leftmost = sub.split(".")[0] ?? "";
|
|
95
|
+
if (leftmost && leftmost !== "www") return leftmost;
|
|
96
|
+
if (apexApp) return apexApp;
|
|
97
|
+
const label = domain.split(".")[0] ?? "";
|
|
98
|
+
const tld = domain.split(".").slice(1).join(".");
|
|
99
|
+
return tld.split(".")[0] || label;
|
|
100
|
+
}
|
|
101
|
+
function isLocal(host) {
|
|
102
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
|
|
103
|
+
}
|
|
104
|
+
function resolveWhiteLabel(host) {
|
|
105
|
+
const h = normalizeHost(host ?? "");
|
|
106
|
+
const match = h ? matchDomain(h) : void 0;
|
|
107
|
+
const org = match ? match[1] : DEFAULT_ORG;
|
|
108
|
+
const identity = ORGS[org];
|
|
109
|
+
const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
|
|
110
|
+
return {
|
|
111
|
+
...identity,
|
|
112
|
+
host: h,
|
|
113
|
+
app,
|
|
114
|
+
theme: `dark_${org}`,
|
|
115
|
+
issuer: `https://${identity.iamDomain}`,
|
|
116
|
+
clientId: `${org}-${app}`
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function currentHost() {
|
|
120
|
+
return typeof window === "undefined" ? "" : window.location.host;
|
|
121
|
+
}
|
|
122
|
+
function orgIdentity(org) {
|
|
123
|
+
return ORGS[org];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
exports.DEFAULT_ORG = DEFAULT_ORG;
|
|
127
|
+
exports.LUX_BRAND = LUX_BRAND;
|
|
128
|
+
exports.PARS_GOLD = PARS_GOLD;
|
|
129
|
+
exports.currentHost = currentHost;
|
|
130
|
+
exports.orgIdentity = orgIdentity;
|
|
131
|
+
exports.orgs = ORGS;
|
|
132
|
+
exports.resolveWhiteLabel = resolveWhiteLabel;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
declare const LUX_BRAND: {
|
|
2
|
+
readonly lux: "#7000FF";
|
|
3
|
+
readonly zoo: "#6C5EFB";
|
|
4
|
+
readonly hanzo: "#EA580C";
|
|
5
|
+
readonly pars: "#1C3879";
|
|
6
|
+
readonly bootnode: "#3B82F6";
|
|
7
|
+
};
|
|
8
|
+
declare const PARS_GOLD = "#C8A45C";
|
|
9
|
+
type LuxBrand = keyof typeof LUX_BRAND;
|
|
10
|
+
type Org = LuxBrand;
|
|
11
|
+
interface OrgIdentity {
|
|
12
|
+
/** Org id — also the gui child-theme suffix (`dark_lux`, `dark_zoo`, …). */
|
|
13
|
+
readonly org: Org;
|
|
14
|
+
/** Display name for chrome (header, title, sign-in copy). */
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** Canonical apex domain. */
|
|
17
|
+
readonly domain: string;
|
|
18
|
+
/** IAM/OIDC host. The issuer is `https://` + this. */
|
|
19
|
+
readonly iamDomain: string;
|
|
20
|
+
/** Brand accent hex — the same value the gui child-theme row is built from. */
|
|
21
|
+
readonly accent: string;
|
|
22
|
+
/** Foreground used on top of the accent. */
|
|
23
|
+
readonly accentForeground: string;
|
|
24
|
+
}
|
|
25
|
+
declare const ORGS: Readonly<Record<Org, OrgIdentity>>;
|
|
26
|
+
declare const DEFAULT_ORG: Org;
|
|
27
|
+
interface WhiteLabel extends OrgIdentity {
|
|
28
|
+
/** Hostname the identity was resolved from, port stripped, lowercased. */
|
|
29
|
+
readonly host: string;
|
|
30
|
+
/** App slug taken from the hostname — `mpc.lux.cloud` → `mpc`. */
|
|
31
|
+
readonly app: string;
|
|
32
|
+
/** gui child-theme row to hand GuiProvider — `dark_lux`, `dark_zoo`, … */
|
|
33
|
+
readonly theme: string;
|
|
34
|
+
/** OIDC issuer — `https://lux.id`. */
|
|
35
|
+
readonly issuer: string;
|
|
36
|
+
/** IAM client id, `<org>-<app>` per the fleet naming scheme — `lux-mpc`. */
|
|
37
|
+
readonly clientId: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the full white-label identity from a Host header value.
|
|
41
|
+
*
|
|
42
|
+
* Pure and total: an unknown or missing host falls back to the Lux row rather
|
|
43
|
+
* than throwing, so a preview URL or a health probe never blanks the UI.
|
|
44
|
+
*
|
|
45
|
+
* resolveWhiteLabel('mpc.lux.cloud') // org lux, clientId lux-mpc, issuer https://lux.id
|
|
46
|
+
* resolveWhiteLabel('zoo.network') // org zoo, clientId zoo-network, issuer https://zoo.id
|
|
47
|
+
* resolveWhiteLabel('id.pars.id') // org pars, clientId pars-id, issuer https://pars.id
|
|
48
|
+
*/
|
|
49
|
+
declare function resolveWhiteLabel(host?: string | null): WhiteLabel;
|
|
50
|
+
/**
|
|
51
|
+
* The current host in a browser, or '' during SSR / prerender.
|
|
52
|
+
* Server code must pass `req.headers.host` to resolveWhiteLabel explicitly —
|
|
53
|
+
* there is no ambient request here, and guessing would bake in a brand.
|
|
54
|
+
*/
|
|
55
|
+
declare function currentHost(): string;
|
|
56
|
+
/** Identity for the org id itself, for the rare surface that is not host-routed. */
|
|
57
|
+
declare function orgIdentity(org: Org): OrgIdentity;
|
|
58
|
+
|
|
59
|
+
export { DEFAULT_ORG, LUX_BRAND, type LuxBrand, type Org, type OrgIdentity, PARS_GOLD, type WhiteLabel, currentHost, orgIdentity, ORGS as orgs, resolveWhiteLabel };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
declare const LUX_BRAND: {
|
|
2
|
+
readonly lux: "#7000FF";
|
|
3
|
+
readonly zoo: "#6C5EFB";
|
|
4
|
+
readonly hanzo: "#EA580C";
|
|
5
|
+
readonly pars: "#1C3879";
|
|
6
|
+
readonly bootnode: "#3B82F6";
|
|
7
|
+
};
|
|
8
|
+
declare const PARS_GOLD = "#C8A45C";
|
|
9
|
+
type LuxBrand = keyof typeof LUX_BRAND;
|
|
10
|
+
type Org = LuxBrand;
|
|
11
|
+
interface OrgIdentity {
|
|
12
|
+
/** Org id — also the gui child-theme suffix (`dark_lux`, `dark_zoo`, …). */
|
|
13
|
+
readonly org: Org;
|
|
14
|
+
/** Display name for chrome (header, title, sign-in copy). */
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** Canonical apex domain. */
|
|
17
|
+
readonly domain: string;
|
|
18
|
+
/** IAM/OIDC host. The issuer is `https://` + this. */
|
|
19
|
+
readonly iamDomain: string;
|
|
20
|
+
/** Brand accent hex — the same value the gui child-theme row is built from. */
|
|
21
|
+
readonly accent: string;
|
|
22
|
+
/** Foreground used on top of the accent. */
|
|
23
|
+
readonly accentForeground: string;
|
|
24
|
+
}
|
|
25
|
+
declare const ORGS: Readonly<Record<Org, OrgIdentity>>;
|
|
26
|
+
declare const DEFAULT_ORG: Org;
|
|
27
|
+
interface WhiteLabel extends OrgIdentity {
|
|
28
|
+
/** Hostname the identity was resolved from, port stripped, lowercased. */
|
|
29
|
+
readonly host: string;
|
|
30
|
+
/** App slug taken from the hostname — `mpc.lux.cloud` → `mpc`. */
|
|
31
|
+
readonly app: string;
|
|
32
|
+
/** gui child-theme row to hand GuiProvider — `dark_lux`, `dark_zoo`, … */
|
|
33
|
+
readonly theme: string;
|
|
34
|
+
/** OIDC issuer — `https://lux.id`. */
|
|
35
|
+
readonly issuer: string;
|
|
36
|
+
/** IAM client id, `<org>-<app>` per the fleet naming scheme — `lux-mpc`. */
|
|
37
|
+
readonly clientId: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the full white-label identity from a Host header value.
|
|
41
|
+
*
|
|
42
|
+
* Pure and total: an unknown or missing host falls back to the Lux row rather
|
|
43
|
+
* than throwing, so a preview URL or a health probe never blanks the UI.
|
|
44
|
+
*
|
|
45
|
+
* resolveWhiteLabel('mpc.lux.cloud') // org lux, clientId lux-mpc, issuer https://lux.id
|
|
46
|
+
* resolveWhiteLabel('zoo.network') // org zoo, clientId zoo-network, issuer https://zoo.id
|
|
47
|
+
* resolveWhiteLabel('id.pars.id') // org pars, clientId pars-id, issuer https://pars.id
|
|
48
|
+
*/
|
|
49
|
+
declare function resolveWhiteLabel(host?: string | null): WhiteLabel;
|
|
50
|
+
/**
|
|
51
|
+
* The current host in a browser, or '' during SSR / prerender.
|
|
52
|
+
* Server code must pass `req.headers.host` to resolveWhiteLabel explicitly —
|
|
53
|
+
* there is no ambient request here, and guessing would bake in a brand.
|
|
54
|
+
*/
|
|
55
|
+
declare function currentHost(): string;
|
|
56
|
+
/** Identity for the org id itself, for the rare surface that is not host-routed. */
|
|
57
|
+
declare function orgIdentity(org: Org): OrgIdentity;
|
|
58
|
+
|
|
59
|
+
export { DEFAULT_ORG, LUX_BRAND, type LuxBrand, type Org, type OrgIdentity, PARS_GOLD, type WhiteLabel, currentHost, orgIdentity, ORGS as orgs, resolveWhiteLabel };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// src/white-label.ts
|
|
2
|
+
var LUX_BRAND = {
|
|
3
|
+
lux: "#7000FF",
|
|
4
|
+
zoo: "#6C5EFB",
|
|
5
|
+
hanzo: "#EA580C",
|
|
6
|
+
pars: "#1C3879",
|
|
7
|
+
// bootno.de is its own white label with its own IdP (id.bootno.de) — accent
|
|
8
|
+
// taken from the bootnode console's own brand default, not invented here.
|
|
9
|
+
bootnode: "#3B82F6"
|
|
10
|
+
};
|
|
11
|
+
var PARS_GOLD = "#C8A45C";
|
|
12
|
+
var ORGS = {
|
|
13
|
+
lux: {
|
|
14
|
+
org: "lux",
|
|
15
|
+
name: "Lux",
|
|
16
|
+
domain: "lux.network",
|
|
17
|
+
iamDomain: "lux.id",
|
|
18
|
+
accent: LUX_BRAND.lux,
|
|
19
|
+
accentForeground: "#FFFFFF"
|
|
20
|
+
},
|
|
21
|
+
zoo: {
|
|
22
|
+
org: "zoo",
|
|
23
|
+
name: "Zoo",
|
|
24
|
+
domain: "zoo.ngo",
|
|
25
|
+
// Zoo's IdP is `id.zoo.network`, not a `zoo.id` apex — the one row in this
|
|
26
|
+
// table where the issuer is not `<org>.id`, and the one every hand-rolled
|
|
27
|
+
// per-app branding map got wrong.
|
|
28
|
+
iamDomain: "id.zoo.network",
|
|
29
|
+
accent: LUX_BRAND.zoo,
|
|
30
|
+
accentForeground: "#FFFFFF"
|
|
31
|
+
},
|
|
32
|
+
bootnode: {
|
|
33
|
+
org: "bootnode",
|
|
34
|
+
name: "Bootnode",
|
|
35
|
+
domain: "bootno.de",
|
|
36
|
+
iamDomain: "id.bootno.de",
|
|
37
|
+
accent: LUX_BRAND.lux,
|
|
38
|
+
accentForeground: "#FFFFFF"
|
|
39
|
+
},
|
|
40
|
+
hanzo: {
|
|
41
|
+
org: "hanzo",
|
|
42
|
+
name: "Hanzo",
|
|
43
|
+
domain: "hanzo.ai",
|
|
44
|
+
iamDomain: "hanzo.id",
|
|
45
|
+
accent: LUX_BRAND.hanzo,
|
|
46
|
+
accentForeground: "#FFFFFF"
|
|
47
|
+
},
|
|
48
|
+
pars: {
|
|
49
|
+
org: "pars",
|
|
50
|
+
name: "Pars",
|
|
51
|
+
domain: "pars.id",
|
|
52
|
+
iamDomain: "pars.id",
|
|
53
|
+
accent: LUX_BRAND.pars,
|
|
54
|
+
accentForeground: PARS_GOLD
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var DOMAIN_ORG = [
|
|
58
|
+
["lux.network", "lux"],
|
|
59
|
+
["lux.cloud", "lux"],
|
|
60
|
+
["lux.id", "lux"],
|
|
61
|
+
["lux.finance", "lux"],
|
|
62
|
+
["zoo.ngo", "zoo"],
|
|
63
|
+
["zoo.network", "zoo"],
|
|
64
|
+
["zoo.cloud", "zoo"],
|
|
65
|
+
["zoo.id", "zoo"],
|
|
66
|
+
["hanzo.ai", "hanzo"],
|
|
67
|
+
["hanzo.cloud", "hanzo"],
|
|
68
|
+
["hanzo.id", "hanzo"],
|
|
69
|
+
["pars.id", "pars"],
|
|
70
|
+
["parsdao.org", "pars"],
|
|
71
|
+
["bootno.de", "bootnode", "platform"]
|
|
72
|
+
];
|
|
73
|
+
var DEFAULT_ORG = "lux";
|
|
74
|
+
function normalizeHost(host) {
|
|
75
|
+
const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
|
|
76
|
+
return noPort.replace(/\.$/, "");
|
|
77
|
+
}
|
|
78
|
+
function isUnder(host, domain) {
|
|
79
|
+
return host === domain || host.endsWith(`.${domain}`);
|
|
80
|
+
}
|
|
81
|
+
function matchDomain(host) {
|
|
82
|
+
let best;
|
|
83
|
+
for (const entry of DOMAIN_ORG) {
|
|
84
|
+
if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
|
|
85
|
+
best = entry;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return best;
|
|
89
|
+
}
|
|
90
|
+
function appSlug(host, domain, apexApp) {
|
|
91
|
+
const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
|
|
92
|
+
const leftmost = sub.split(".")[0] ?? "";
|
|
93
|
+
if (leftmost && leftmost !== "www") return leftmost;
|
|
94
|
+
if (apexApp) return apexApp;
|
|
95
|
+
const label = domain.split(".")[0] ?? "";
|
|
96
|
+
const tld = domain.split(".").slice(1).join(".");
|
|
97
|
+
return tld.split(".")[0] || label;
|
|
98
|
+
}
|
|
99
|
+
function isLocal(host) {
|
|
100
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
|
|
101
|
+
}
|
|
102
|
+
function resolveWhiteLabel(host) {
|
|
103
|
+
const h = normalizeHost(host ?? "");
|
|
104
|
+
const match = h ? matchDomain(h) : void 0;
|
|
105
|
+
const org = match ? match[1] : DEFAULT_ORG;
|
|
106
|
+
const identity = ORGS[org];
|
|
107
|
+
const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
|
|
108
|
+
return {
|
|
109
|
+
...identity,
|
|
110
|
+
host: h,
|
|
111
|
+
app,
|
|
112
|
+
theme: `dark_${org}`,
|
|
113
|
+
issuer: `https://${identity.iamDomain}`,
|
|
114
|
+
clientId: `${org}-${app}`
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function currentHost() {
|
|
118
|
+
return typeof window === "undefined" ? "" : window.location.host;
|
|
119
|
+
}
|
|
120
|
+
function orgIdentity(org) {
|
|
121
|
+
return ORGS[org];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { DEFAULT_ORG, LUX_BRAND, PARS_GOLD, currentHost, orgIdentity, ORGS as orgs, resolveWhiteLabel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxfi/ui",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.2",
|
|
4
4
|
"description": "Cross-platform DeFi UI components built on @hanzo/gui (Tamagui). Native mobile + web.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,6 +35,46 @@
|
|
|
35
35
|
"import": "./dist/index.js",
|
|
36
36
|
"require": "./dist/index.cjs"
|
|
37
37
|
},
|
|
38
|
+
"./gui": {
|
|
39
|
+
"types": "./dist/gui.d.ts",
|
|
40
|
+
"import": "./dist/gui.js",
|
|
41
|
+
"require": "./dist/gui.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./white-label": {
|
|
44
|
+
"types": "./dist/white-label.d.ts",
|
|
45
|
+
"import": "./dist/white-label.js",
|
|
46
|
+
"require": "./dist/white-label.cjs"
|
|
47
|
+
},
|
|
48
|
+
"./iam": {
|
|
49
|
+
"types": "./dist/iam.d.ts",
|
|
50
|
+
"import": "./dist/iam.js",
|
|
51
|
+
"require": "./dist/iam.cjs"
|
|
52
|
+
},
|
|
53
|
+
"./identity": {
|
|
54
|
+
"types": "./dist/identity.d.ts",
|
|
55
|
+
"import": "./dist/identity.js",
|
|
56
|
+
"require": "./dist/identity.cjs"
|
|
57
|
+
},
|
|
58
|
+
"./chrome": {
|
|
59
|
+
"types": "./dist/chrome.d.ts",
|
|
60
|
+
"import": "./dist/chrome.js",
|
|
61
|
+
"require": "./dist/chrome.cjs"
|
|
62
|
+
},
|
|
63
|
+
"./use-narrow": {
|
|
64
|
+
"types": "./dist/use-narrow.d.ts",
|
|
65
|
+
"import": "./dist/use-narrow.js",
|
|
66
|
+
"require": "./dist/use-narrow.cjs"
|
|
67
|
+
},
|
|
68
|
+
"./vite": {
|
|
69
|
+
"types": "./dist/vite.d.ts",
|
|
70
|
+
"import": "./dist/vite.js",
|
|
71
|
+
"require": "./dist/vite.cjs"
|
|
72
|
+
},
|
|
73
|
+
"./next": {
|
|
74
|
+
"types": "./dist/next.d.ts",
|
|
75
|
+
"import": "./dist/next.js",
|
|
76
|
+
"require": "./dist/next.cjs"
|
|
77
|
+
},
|
|
38
78
|
"./tokens.css": "./tokens.css",
|
|
39
79
|
"./accordion": {
|
|
40
80
|
"types": "./dist/accordion.d.ts",
|
|
@@ -111,6 +151,11 @@
|
|
|
111
151
|
"import": "./dist/icon-button.js",
|
|
112
152
|
"require": "./dist/icon-button.cjs"
|
|
113
153
|
},
|
|
154
|
+
"./icons": {
|
|
155
|
+
"types": "./dist/icons.d.ts",
|
|
156
|
+
"import": "./dist/icons.js",
|
|
157
|
+
"require": "./dist/icons.cjs"
|
|
158
|
+
},
|
|
114
159
|
"./image": {
|
|
115
160
|
"types": "./dist/image.d.ts",
|
|
116
161
|
"import": "./dist/image.js",
|
|
@@ -250,7 +295,9 @@
|
|
|
250
295
|
"build": "tsup",
|
|
251
296
|
"build:check": "tsc --noEmit",
|
|
252
297
|
"clean": "rm -rf dist",
|
|
253
|
-
"dev": "tsup --watch"
|
|
298
|
+
"dev": "tsup --watch",
|
|
299
|
+
"harness": "vite --config harness/vite.config.ts",
|
|
300
|
+
"test": "playwright test"
|
|
254
301
|
},
|
|
255
302
|
"dependencies": {
|
|
256
303
|
"@radix-ui/react-accordion": "^1.2.12",
|
|
@@ -266,41 +313,60 @@
|
|
|
266
313
|
"@radix-ui/react-slider": "^1.3.6",
|
|
267
314
|
"@radix-ui/react-switch": "^1.2.6",
|
|
268
315
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
316
|
+
"@tanstack/react-query": "^5.76.0",
|
|
269
317
|
"@uidotdev/usehooks": "^2.4.1",
|
|
270
318
|
"clsx": "^2.1.1",
|
|
271
319
|
"es-toolkit": "^1.31.0",
|
|
272
|
-
"react
|
|
320
|
+
"lucide-react": "^1.27.0",
|
|
273
321
|
"sonner": "^2.0.0",
|
|
274
|
-
"tailwind-merge": "^3.0.0"
|
|
275
|
-
"@tanstack/react-query": "^5.76.0",
|
|
276
|
-
"@hanzo/gui": "^7.3.0",
|
|
277
|
-
"@hanzogui/config": "^7.3.0",
|
|
278
|
-
"@hanzogui/core": "^7.3.0",
|
|
279
|
-
"@hanzogui/web": "^7.3.0"
|
|
322
|
+
"tailwind-merge": "^3.0.0"
|
|
280
323
|
},
|
|
281
324
|
"peerDependencies": {
|
|
282
|
-
"react": ">=19",
|
|
283
|
-
"react-dom": ">=19",
|
|
284
325
|
"@hanzo/gui": "^7.3.0",
|
|
326
|
+
"@hanzogui/colors": "^7.3.0",
|
|
285
327
|
"@hanzogui/config": "^7.3.0",
|
|
328
|
+
"@hanzogui/core": "^7.3.0",
|
|
329
|
+
"@hanzogui/lucide-icons-2": "^7.3.0",
|
|
286
330
|
"@hanzogui/themes": "^7.3.0",
|
|
287
|
-
"@hanzogui/
|
|
288
|
-
"
|
|
331
|
+
"@hanzogui/web": "^7.3.0",
|
|
332
|
+
"react": ">=19",
|
|
333
|
+
"react-dom": ">=19"
|
|
289
334
|
},
|
|
290
335
|
"peerDependenciesMeta": {
|
|
291
|
-
"@hanzogui/themes": {
|
|
292
|
-
|
|
293
|
-
|
|
336
|
+
"@hanzogui/themes": {
|
|
337
|
+
"optional": true
|
|
338
|
+
},
|
|
339
|
+
"@hanzogui/colors": {
|
|
340
|
+
"optional": true
|
|
341
|
+
},
|
|
342
|
+
"@hanzogui/lucide-icons-2": {
|
|
343
|
+
"optional": true
|
|
344
|
+
},
|
|
345
|
+
"@hanzogui/core": {
|
|
346
|
+
"optional": true
|
|
347
|
+
},
|
|
348
|
+
"@hanzogui/web": {
|
|
349
|
+
"optional": true
|
|
350
|
+
}
|
|
294
351
|
},
|
|
295
352
|
"devDependencies": {
|
|
353
|
+
"@hanzo/gui": "7.3.0",
|
|
354
|
+
"@hanzogui/colors": "7.3.0",
|
|
296
355
|
"@hanzogui/config": "7.3.0",
|
|
356
|
+
"@hanzogui/core": "7.3.0",
|
|
297
357
|
"@hanzogui/themes": "7.3.0",
|
|
298
|
-
"@hanzogui/
|
|
358
|
+
"@hanzogui/web": "7.3.0",
|
|
359
|
+
"@playwright/test": "^1.58",
|
|
360
|
+
"@tailwindcss/vite": "^4",
|
|
299
361
|
"@types/react": "^19.0.0",
|
|
300
362
|
"@types/react-dom": "^19.0.0",
|
|
363
|
+
"@vitejs/plugin-react": "^6",
|
|
301
364
|
"react": "^19.0.0",
|
|
302
365
|
"react-dom": "^19.0.0",
|
|
366
|
+
"react-native-web": "^0.21.0",
|
|
367
|
+
"tailwindcss": "^4",
|
|
303
368
|
"tsup": "^8.5.0",
|
|
304
|
-
"typescript": "^5.9.3"
|
|
369
|
+
"typescript": "^5.9.3",
|
|
370
|
+
"vite": "^8"
|
|
305
371
|
}
|
|
306
|
-
}
|
|
372
|
+
}
|