@luxfi/ui 7.4.0 → 7.4.3
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 +33 -35
- package/dist/badge.js +33 -35
- 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 +960 -0
- package/dist/chrome.d.cts +93 -0
- package/dist/chrome.d.ts +93 -0
- package/dist/chrome.js +931 -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 +216 -0
- package/dist/iam.d.cts +65 -0
- package/dist/iam.d.ts +65 -0
- package/dist/iam.js +211 -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 +430 -0
- package/dist/identity.d.cts +64 -0
- package/dist/identity.d.ts +64 -0
- package/dist/identity.js +408 -0
- package/dist/index.cjs +1610 -836
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1587 -831
- 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 +132 -0
- package/dist/next.d.cts +32 -0
- package/dist/next.d.ts +32 -0
- package/dist/next.js +129 -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 +146 -4
- package/dist/provider.d.cts +15 -3
- package/dist/provider.d.ts +15 -3
- package/dist/provider.js +146 -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 +34 -36
- package/dist/tag.js +33 -35
- package/dist/textarea.cjs +3 -1
- package/dist/textarea.js +3 -1
- package/dist/tooltip.cjs +28 -30
- package/dist/tooltip.js +27 -29
- 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 +109 -0
- package/dist/vite.d.cts +29 -0
- package/dist/vite.d.ts +29 -0
- package/dist/vite.js +107 -0
- package/dist/white-label.cjs +142 -0
- package/dist/white-label.d.cts +59 -0
- package/dist/white-label.d.ts +59 -0
- package/dist/white-label.js +134 -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/engine.ts +130 -0
- 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 +89 -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 +15 -24
- package/src/use-narrow.ts +40 -0
- package/src/vite.ts +80 -0
- package/src/white-label.ts +254 -0
- package/tokens.css +613 -319
- package/src/tokens.css +0 -438
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
function _interopNamespace(e) {
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
25
|
+
|
|
26
|
+
var NARROW_PX = 640;
|
|
27
|
+
var TOUCH_PX = 1024;
|
|
28
|
+
function useBelow(px) {
|
|
29
|
+
const [below, setBelow] = React__namespace.useState(false);
|
|
30
|
+
React__namespace.useEffect(() => {
|
|
31
|
+
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
32
|
+
const apply = () => setBelow(mql.matches);
|
|
33
|
+
apply();
|
|
34
|
+
mql.addEventListener("change", apply);
|
|
35
|
+
return () => mql.removeEventListener("change", apply);
|
|
36
|
+
}, [px]);
|
|
37
|
+
return below;
|
|
38
|
+
}
|
|
39
|
+
var useIsNarrow = () => useBelow(NARROW_PX);
|
|
40
|
+
var useIsTouch = () => useBelow(TOUCH_PX);
|
|
41
|
+
|
|
42
|
+
exports.NARROW_PX = NARROW_PX;
|
|
43
|
+
exports.TOUCH_PX = TOUCH_PX;
|
|
44
|
+
exports.useBelow = useBelow;
|
|
45
|
+
exports.useIsNarrow = useIsNarrow;
|
|
46
|
+
exports.useIsTouch = useIsTouch;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Below this the UI is a phone: menus become sheets, drawers drag. */
|
|
2
|
+
declare const NARROW_PX = 640;
|
|
3
|
+
/** Below this the pointer is a finger: hover-only affordances are suppressed. */
|
|
4
|
+
declare const TOUCH_PX = 1024;
|
|
5
|
+
/** True while the viewport is narrower than `px`. */
|
|
6
|
+
declare function useBelow(px: number): boolean;
|
|
7
|
+
/** Phone-sized: present menus as sheets. */
|
|
8
|
+
declare const useIsNarrow: () => boolean;
|
|
9
|
+
/** Touch-sized: no hover, so hover-only affordances must not be the only path. */
|
|
10
|
+
declare const useIsTouch: () => boolean;
|
|
11
|
+
|
|
12
|
+
export { NARROW_PX, TOUCH_PX, useBelow, useIsNarrow, useIsTouch };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Below this the UI is a phone: menus become sheets, drawers drag. */
|
|
2
|
+
declare const NARROW_PX = 640;
|
|
3
|
+
/** Below this the pointer is a finger: hover-only affordances are suppressed. */
|
|
4
|
+
declare const TOUCH_PX = 1024;
|
|
5
|
+
/** True while the viewport is narrower than `px`. */
|
|
6
|
+
declare function useBelow(px: number): boolean;
|
|
7
|
+
/** Phone-sized: present menus as sheets. */
|
|
8
|
+
declare const useIsNarrow: () => boolean;
|
|
9
|
+
/** Touch-sized: no hover, so hover-only affordances must not be the only path. */
|
|
10
|
+
declare const useIsTouch: () => boolean;
|
|
11
|
+
|
|
12
|
+
export { NARROW_PX, TOUCH_PX, useBelow, useIsNarrow, useIsTouch };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
var NARROW_PX = 640;
|
|
5
|
+
var TOUCH_PX = 1024;
|
|
6
|
+
function useBelow(px) {
|
|
7
|
+
const [below, setBelow] = React.useState(false);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
10
|
+
const apply = () => setBelow(mql.matches);
|
|
11
|
+
apply();
|
|
12
|
+
mql.addEventListener("change", apply);
|
|
13
|
+
return () => mql.removeEventListener("change", apply);
|
|
14
|
+
}, [px]);
|
|
15
|
+
return below;
|
|
16
|
+
}
|
|
17
|
+
var useIsNarrow = () => useBelow(NARROW_PX);
|
|
18
|
+
var useIsTouch = () => useBelow(TOUCH_PX);
|
|
19
|
+
|
|
20
|
+
export { NARROW_PX, TOUCH_PX, useBelow, useIsNarrow, useIsTouch };
|
package/dist/vite.cjs
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/engine.ts
|
|
4
|
+
var GUI_PACKAGES = [
|
|
5
|
+
"@hanzo/gui",
|
|
6
|
+
"@hanzogui/accordion",
|
|
7
|
+
"@hanzogui/adapt",
|
|
8
|
+
"@hanzogui/alert-dialog",
|
|
9
|
+
"@hanzogui/animate",
|
|
10
|
+
"@hanzogui/animate-presence",
|
|
11
|
+
"@hanzogui/avatar",
|
|
12
|
+
"@hanzogui/button",
|
|
13
|
+
"@hanzogui/card",
|
|
14
|
+
"@hanzogui/checkbox",
|
|
15
|
+
"@hanzogui/collapsible",
|
|
16
|
+
"@hanzogui/component-helpers",
|
|
17
|
+
"@hanzogui/compose-refs",
|
|
18
|
+
"@hanzogui/config",
|
|
19
|
+
"@hanzogui/context-menu",
|
|
20
|
+
"@hanzogui/core",
|
|
21
|
+
"@hanzogui/create-context",
|
|
22
|
+
"@hanzogui/create-menu",
|
|
23
|
+
"@hanzogui/dialog",
|
|
24
|
+
"@hanzogui/dismissable",
|
|
25
|
+
"@hanzogui/element",
|
|
26
|
+
"@hanzogui/elements",
|
|
27
|
+
"@hanzogui/floating",
|
|
28
|
+
"@hanzogui/focus-scope",
|
|
29
|
+
"@hanzogui/font-size",
|
|
30
|
+
"@hanzogui/form",
|
|
31
|
+
"@hanzogui/get-token",
|
|
32
|
+
"@hanzogui/group",
|
|
33
|
+
"@hanzogui/helpers",
|
|
34
|
+
"@hanzogui/image",
|
|
35
|
+
"@hanzogui/input",
|
|
36
|
+
"@hanzogui/label",
|
|
37
|
+
"@hanzogui/list-item",
|
|
38
|
+
"@hanzogui/menu",
|
|
39
|
+
"@hanzogui/popover",
|
|
40
|
+
"@hanzogui/popper",
|
|
41
|
+
"@hanzogui/portal",
|
|
42
|
+
"@hanzogui/progress",
|
|
43
|
+
"@hanzogui/radio-group",
|
|
44
|
+
"@hanzogui/react-native-media-driver",
|
|
45
|
+
"@hanzogui/remove-scroll",
|
|
46
|
+
"@hanzogui/scroll-view",
|
|
47
|
+
"@hanzogui/select",
|
|
48
|
+
"@hanzogui/separator",
|
|
49
|
+
"@hanzogui/shapes",
|
|
50
|
+
"@hanzogui/sheet",
|
|
51
|
+
"@hanzogui/slider",
|
|
52
|
+
"@hanzogui/spacer",
|
|
53
|
+
"@hanzogui/spinner",
|
|
54
|
+
"@hanzogui/stacks",
|
|
55
|
+
"@hanzogui/switch",
|
|
56
|
+
"@hanzogui/tabs",
|
|
57
|
+
"@hanzogui/text",
|
|
58
|
+
"@hanzogui/theme",
|
|
59
|
+
"@hanzogui/toast",
|
|
60
|
+
"@hanzogui/toggle-group",
|
|
61
|
+
"@hanzogui/tooltip",
|
|
62
|
+
"@hanzogui/use-controllable-state",
|
|
63
|
+
"@hanzogui/use-debounce",
|
|
64
|
+
"@hanzogui/use-force-update",
|
|
65
|
+
"@hanzogui/use-presence",
|
|
66
|
+
"@hanzogui/use-window-dimensions",
|
|
67
|
+
"@hanzogui/visually-hidden",
|
|
68
|
+
"@hanzogui/web",
|
|
69
|
+
"@hanzogui/z-index-stack",
|
|
70
|
+
"@luxfi/ui"
|
|
71
|
+
];
|
|
72
|
+
var GUI_DEFINES = {
|
|
73
|
+
"process.env.EXPO_OS": JSON.stringify("web"),
|
|
74
|
+
"process.env.IS_WEB": JSON.stringify("true")
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/vite.ts
|
|
78
|
+
var DEDUPE = [
|
|
79
|
+
"react",
|
|
80
|
+
"react-dom",
|
|
81
|
+
"@tanstack/react-query",
|
|
82
|
+
...GUI_PACKAGES
|
|
83
|
+
];
|
|
84
|
+
var INCLUDE = [
|
|
85
|
+
"react-native-web",
|
|
86
|
+
"@react-native/normalize-color",
|
|
87
|
+
"@hanzo/gui",
|
|
88
|
+
"@hanzogui/core",
|
|
89
|
+
"@luxfi/ui"
|
|
90
|
+
];
|
|
91
|
+
function luxUi(options = {}) {
|
|
92
|
+
return {
|
|
93
|
+
name: "@luxfi/ui",
|
|
94
|
+
config: () => ({
|
|
95
|
+
// The engine branches on these at module scope; without them it takes the
|
|
96
|
+
// native path in a browser bundle. (./engine)
|
|
97
|
+
define: { ...GUI_DEFINES },
|
|
98
|
+
resolve: {
|
|
99
|
+
alias: { "react-native": "react-native-web" },
|
|
100
|
+
dedupe: [.../* @__PURE__ */ new Set([...DEDUPE, ...options.dedupe ?? []])]
|
|
101
|
+
},
|
|
102
|
+
optimizeDeps: {
|
|
103
|
+
include: [.../* @__PURE__ */ new Set([...INCLUDE, ...options.include ?? []])]
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
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,107 @@
|
|
|
1
|
+
// src/engine.ts
|
|
2
|
+
var GUI_PACKAGES = [
|
|
3
|
+
"@hanzo/gui",
|
|
4
|
+
"@hanzogui/accordion",
|
|
5
|
+
"@hanzogui/adapt",
|
|
6
|
+
"@hanzogui/alert-dialog",
|
|
7
|
+
"@hanzogui/animate",
|
|
8
|
+
"@hanzogui/animate-presence",
|
|
9
|
+
"@hanzogui/avatar",
|
|
10
|
+
"@hanzogui/button",
|
|
11
|
+
"@hanzogui/card",
|
|
12
|
+
"@hanzogui/checkbox",
|
|
13
|
+
"@hanzogui/collapsible",
|
|
14
|
+
"@hanzogui/component-helpers",
|
|
15
|
+
"@hanzogui/compose-refs",
|
|
16
|
+
"@hanzogui/config",
|
|
17
|
+
"@hanzogui/context-menu",
|
|
18
|
+
"@hanzogui/core",
|
|
19
|
+
"@hanzogui/create-context",
|
|
20
|
+
"@hanzogui/create-menu",
|
|
21
|
+
"@hanzogui/dialog",
|
|
22
|
+
"@hanzogui/dismissable",
|
|
23
|
+
"@hanzogui/element",
|
|
24
|
+
"@hanzogui/elements",
|
|
25
|
+
"@hanzogui/floating",
|
|
26
|
+
"@hanzogui/focus-scope",
|
|
27
|
+
"@hanzogui/font-size",
|
|
28
|
+
"@hanzogui/form",
|
|
29
|
+
"@hanzogui/get-token",
|
|
30
|
+
"@hanzogui/group",
|
|
31
|
+
"@hanzogui/helpers",
|
|
32
|
+
"@hanzogui/image",
|
|
33
|
+
"@hanzogui/input",
|
|
34
|
+
"@hanzogui/label",
|
|
35
|
+
"@hanzogui/list-item",
|
|
36
|
+
"@hanzogui/menu",
|
|
37
|
+
"@hanzogui/popover",
|
|
38
|
+
"@hanzogui/popper",
|
|
39
|
+
"@hanzogui/portal",
|
|
40
|
+
"@hanzogui/progress",
|
|
41
|
+
"@hanzogui/radio-group",
|
|
42
|
+
"@hanzogui/react-native-media-driver",
|
|
43
|
+
"@hanzogui/remove-scroll",
|
|
44
|
+
"@hanzogui/scroll-view",
|
|
45
|
+
"@hanzogui/select",
|
|
46
|
+
"@hanzogui/separator",
|
|
47
|
+
"@hanzogui/shapes",
|
|
48
|
+
"@hanzogui/sheet",
|
|
49
|
+
"@hanzogui/slider",
|
|
50
|
+
"@hanzogui/spacer",
|
|
51
|
+
"@hanzogui/spinner",
|
|
52
|
+
"@hanzogui/stacks",
|
|
53
|
+
"@hanzogui/switch",
|
|
54
|
+
"@hanzogui/tabs",
|
|
55
|
+
"@hanzogui/text",
|
|
56
|
+
"@hanzogui/theme",
|
|
57
|
+
"@hanzogui/toast",
|
|
58
|
+
"@hanzogui/toggle-group",
|
|
59
|
+
"@hanzogui/tooltip",
|
|
60
|
+
"@hanzogui/use-controllable-state",
|
|
61
|
+
"@hanzogui/use-debounce",
|
|
62
|
+
"@hanzogui/use-force-update",
|
|
63
|
+
"@hanzogui/use-presence",
|
|
64
|
+
"@hanzogui/use-window-dimensions",
|
|
65
|
+
"@hanzogui/visually-hidden",
|
|
66
|
+
"@hanzogui/web",
|
|
67
|
+
"@hanzogui/z-index-stack",
|
|
68
|
+
"@luxfi/ui"
|
|
69
|
+
];
|
|
70
|
+
var GUI_DEFINES = {
|
|
71
|
+
"process.env.EXPO_OS": JSON.stringify("web"),
|
|
72
|
+
"process.env.IS_WEB": JSON.stringify("true")
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// src/vite.ts
|
|
76
|
+
var DEDUPE = [
|
|
77
|
+
"react",
|
|
78
|
+
"react-dom",
|
|
79
|
+
"@tanstack/react-query",
|
|
80
|
+
...GUI_PACKAGES
|
|
81
|
+
];
|
|
82
|
+
var INCLUDE = [
|
|
83
|
+
"react-native-web",
|
|
84
|
+
"@react-native/normalize-color",
|
|
85
|
+
"@hanzo/gui",
|
|
86
|
+
"@hanzogui/core",
|
|
87
|
+
"@luxfi/ui"
|
|
88
|
+
];
|
|
89
|
+
function luxUi(options = {}) {
|
|
90
|
+
return {
|
|
91
|
+
name: "@luxfi/ui",
|
|
92
|
+
config: () => ({
|
|
93
|
+
// The engine branches on these at module scope; without them it takes the
|
|
94
|
+
// native path in a browser bundle. (./engine)
|
|
95
|
+
define: { ...GUI_DEFINES },
|
|
96
|
+
resolve: {
|
|
97
|
+
alias: { "react-native": "react-native-web" },
|
|
98
|
+
dedupe: [.../* @__PURE__ */ new Set([...DEDUPE, ...options.dedupe ?? []])]
|
|
99
|
+
},
|
|
100
|
+
optimizeDeps: {
|
|
101
|
+
include: [.../* @__PURE__ */ new Set([...INCLUDE, ...options.include ?? []])]
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { luxUi };
|
|
@@ -0,0 +1,142 @@
|
|
|
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 issuer is `zoolabs.id` — the one row where it is not `<org>.id`,
|
|
28
|
+
// and the one every hand-rolled branding map gets wrong. `id.zoo.network`
|
|
29
|
+
// ANSWERS, which is why it keeps being copied around, but it is an alias:
|
|
30
|
+
// its own discovery document advertises
|
|
31
|
+
// issuer https://zoolabs.id
|
|
32
|
+
// authorization_endpoint https://zoolabs.id/v1/iam/oauth/authorize
|
|
33
|
+
// jwks_uri https://zoolabs.id/v1/iam/.well-known/jwks
|
|
34
|
+
// so a client configured on the alias validates `iss` against a string the
|
|
35
|
+
// IdP never emits and rejects every token it is given — the exact shape of
|
|
36
|
+
// the lux.id outage. `zoo.id` is not an IdP at all (no discovery document).
|
|
37
|
+
iamDomain: "zoolabs.id",
|
|
38
|
+
accent: LUX_BRAND.zoo,
|
|
39
|
+
accentForeground: "#FFFFFF"
|
|
40
|
+
},
|
|
41
|
+
bootnode: {
|
|
42
|
+
org: "bootnode",
|
|
43
|
+
name: "Bootnode",
|
|
44
|
+
domain: "bootno.de",
|
|
45
|
+
iamDomain: "id.bootno.de",
|
|
46
|
+
accent: LUX_BRAND.lux,
|
|
47
|
+
accentForeground: "#FFFFFF"
|
|
48
|
+
},
|
|
49
|
+
hanzo: {
|
|
50
|
+
org: "hanzo",
|
|
51
|
+
name: "Hanzo",
|
|
52
|
+
domain: "hanzo.ai",
|
|
53
|
+
iamDomain: "hanzo.id",
|
|
54
|
+
accent: LUX_BRAND.hanzo,
|
|
55
|
+
accentForeground: "#FFFFFF"
|
|
56
|
+
},
|
|
57
|
+
pars: {
|
|
58
|
+
org: "pars",
|
|
59
|
+
name: "Pars",
|
|
60
|
+
domain: "pars.id",
|
|
61
|
+
iamDomain: "pars.id",
|
|
62
|
+
accent: LUX_BRAND.pars,
|
|
63
|
+
accentForeground: PARS_GOLD
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var DOMAIN_ORG = [
|
|
67
|
+
["lux.network", "lux"],
|
|
68
|
+
["lux.cloud", "lux"],
|
|
69
|
+
["lux.id", "lux"],
|
|
70
|
+
["lux.finance", "lux"],
|
|
71
|
+
["lux.market", "lux"],
|
|
72
|
+
["lux.exchange", "lux"],
|
|
73
|
+
["zoo.ngo", "zoo"],
|
|
74
|
+
["zoo.network", "zoo"],
|
|
75
|
+
["zoo.cloud", "zoo"],
|
|
76
|
+
["zoolabs.id", "zoo"],
|
|
77
|
+
["hanzo.ai", "hanzo"],
|
|
78
|
+
["hanzo.cloud", "hanzo"],
|
|
79
|
+
["hanzo.id", "hanzo"],
|
|
80
|
+
["pars.id", "pars", "app"],
|
|
81
|
+
["pars.network", "pars", "app"],
|
|
82
|
+
["parsdao.org", "pars", "app"],
|
|
83
|
+
["bootno.de", "bootnode", "platform"]
|
|
84
|
+
];
|
|
85
|
+
var DEFAULT_ORG = "lux";
|
|
86
|
+
function normalizeHost(host) {
|
|
87
|
+
const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
|
|
88
|
+
return noPort.replace(/\.$/, "");
|
|
89
|
+
}
|
|
90
|
+
function isUnder(host, domain) {
|
|
91
|
+
return host === domain || host.endsWith(`.${domain}`);
|
|
92
|
+
}
|
|
93
|
+
function matchDomain(host) {
|
|
94
|
+
let best;
|
|
95
|
+
for (const entry of DOMAIN_ORG) {
|
|
96
|
+
if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
|
|
97
|
+
best = entry;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return best;
|
|
101
|
+
}
|
|
102
|
+
function appSlug(host, domain, pinned) {
|
|
103
|
+
if (pinned) return pinned;
|
|
104
|
+
const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
|
|
105
|
+
const leftmost = sub.split(".")[0] ?? "";
|
|
106
|
+
if (leftmost && leftmost !== "www") return leftmost;
|
|
107
|
+
const label = domain.split(".")[0] ?? "";
|
|
108
|
+
const tld = domain.split(".").slice(1).join(".");
|
|
109
|
+
return tld.split(".")[0] || label;
|
|
110
|
+
}
|
|
111
|
+
function isLocal(host) {
|
|
112
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
|
|
113
|
+
}
|
|
114
|
+
function resolveWhiteLabel(host) {
|
|
115
|
+
const h = normalizeHost(host ?? "");
|
|
116
|
+
const match = h ? matchDomain(h) : void 0;
|
|
117
|
+
const org = match ? match[1] : DEFAULT_ORG;
|
|
118
|
+
const identity = ORGS[org];
|
|
119
|
+
const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
|
|
120
|
+
return {
|
|
121
|
+
...identity,
|
|
122
|
+
host: h,
|
|
123
|
+
app,
|
|
124
|
+
theme: `dark_${org}`,
|
|
125
|
+
issuer: `https://${identity.iamDomain}`,
|
|
126
|
+
clientId: `${org}-${app}`
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function currentHost() {
|
|
130
|
+
return typeof window === "undefined" ? "" : window.location.host;
|
|
131
|
+
}
|
|
132
|
+
function orgIdentity(org) {
|
|
133
|
+
return ORGS[org];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
exports.DEFAULT_ORG = DEFAULT_ORG;
|
|
137
|
+
exports.LUX_BRAND = LUX_BRAND;
|
|
138
|
+
exports.PARS_GOLD = PARS_GOLD;
|
|
139
|
+
exports.currentHost = currentHost;
|
|
140
|
+
exports.orgIdentity = orgIdentity;
|
|
141
|
+
exports.orgs = ORGS;
|
|
142
|
+
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.network') // org lux, clientId lux-mpc, issuer https://lux.id
|
|
46
|
+
* resolveWhiteLabel('zoo.cloud') // org zoo, clientId zoo-cloud, issuer https://zoolabs.id
|
|
47
|
+
* resolveWhiteLabel('cloud.pars.network') // org pars, clientId pars-app, 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.network') // org lux, clientId lux-mpc, issuer https://lux.id
|
|
46
|
+
* resolveWhiteLabel('zoo.cloud') // org zoo, clientId zoo-cloud, issuer https://zoolabs.id
|
|
47
|
+
* resolveWhiteLabel('cloud.pars.network') // org pars, clientId pars-app, 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 };
|