@ramme-io/ui 5.1.0 → 5.2.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/components/layout/UserNav.d.ts +4 -0
- package/dist/components/layout/UserNav.js +28 -27
- package/dist/components/ui/Badge.d.ts +4 -4
- package/dist/components/ui/Badge.js +8 -5
- package/dist/contexts/ThemeContext.d.ts +1 -1
- package/dist/contexts/ThemeContext.js +45 -37
- package/dist/index.css +1 -1
- package/dist/markets-theme.test.d.ts +1 -0
- package/dist/wizardManifest.js +14 -6
- package/package.json +2 -2
- package/src/wizardManifest.ts +14 -6
- package/tailwind.preset.js +12 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IconName } from '../ui/Icon';
|
|
3
|
+
import { type ThemeMode } from '../../contexts/ThemeContext';
|
|
3
4
|
/**
|
|
4
5
|
* @wizard
|
|
5
6
|
* @name UserNav
|
|
@@ -12,6 +13,7 @@ import { IconName } from '../ui/Icon';
|
|
|
12
13
|
* @param {function} onSettings - Called when the user chooses settings.
|
|
13
14
|
* @param {function} onProfile - Called when the user chooses profile.
|
|
14
15
|
* @param {boolean} showThemeToggle - Adds a theme switcher inside the menu.
|
|
16
|
+
* @param {ThemeMode[]} themeOptions - The themes the switcher offers, in order. Defaults to light, dark and system; an app with its own theme names it here (the terminal: markets, light, dark, system), or a viewer who taps another can never get back to it.
|
|
15
17
|
* @param {ReactNode} trigger - Replaces the default avatar trigger.
|
|
16
18
|
* @param {string} align - Menu alignment against the trigger: 'start', 'center', or 'end'.
|
|
17
19
|
* @param {string} side - Which side the menu opens on: 'top', 'bottom', 'left', or 'right'.
|
|
@@ -32,6 +34,8 @@ export interface UserNavProps {
|
|
|
32
34
|
onSettings?: () => void;
|
|
33
35
|
onProfile?: () => void;
|
|
34
36
|
showThemeToggle?: boolean;
|
|
37
|
+
/** The themes the switcher offers, in order. Defaults to light, dark, system. */
|
|
38
|
+
themeOptions?: ThemeMode[];
|
|
35
39
|
children?: React.ReactNode;
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Avatar as
|
|
4
|
-
import { Icon as
|
|
2
|
+
import { useState as O, useRef as I, useEffect as L } from "react";
|
|
3
|
+
import { Avatar as z } from "../ui/Avatar.js";
|
|
4
|
+
import { Icon as U } from "../ui/Icon.js";
|
|
5
5
|
import { cn as o } from "../../utils/cn.js";
|
|
6
6
|
import { useTheme as j } from "../../contexts/ThemeContext.js";
|
|
7
|
-
const
|
|
8
|
-
const { theme:
|
|
9
|
-
return /* @__PURE__ */ e("div", { className: "flex bg-muted/50 rounded-md p-0.5 gap-0.5", children:
|
|
7
|
+
const A = ["light", "dark", "system"], M = ({ options: t }) => {
|
|
8
|
+
const { theme: l, setTheme: a } = j();
|
|
9
|
+
return /* @__PURE__ */ e("div", { className: "flex bg-muted/50 rounded-md p-0.5 gap-0.5", children: t.map((r) => /* @__PURE__ */ e(
|
|
10
10
|
"button",
|
|
11
11
|
{
|
|
12
|
-
onClick: () =>
|
|
12
|
+
onClick: () => a(r),
|
|
13
13
|
className: o(
|
|
14
14
|
"flex-1 text-[10px] py-1 rounded-sm capitalize font-medium transition-colors",
|
|
15
|
-
|
|
15
|
+
l === r ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground hover:bg-muted/80"
|
|
16
16
|
),
|
|
17
17
|
children: r
|
|
18
18
|
},
|
|
@@ -23,7 +23,7 @@ const R = () => {
|
|
|
23
23
|
label: l,
|
|
24
24
|
onClick: a,
|
|
25
25
|
variant: r = "default",
|
|
26
|
-
className:
|
|
26
|
+
className: i
|
|
27
27
|
}) => /* @__PURE__ */ n(
|
|
28
28
|
"button",
|
|
29
29
|
{
|
|
@@ -31,30 +31,31 @@ const R = () => {
|
|
|
31
31
|
className: o(
|
|
32
32
|
"relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
33
33
|
r === "destructive" ? "text-destructive hover:bg-destructive/10" : "text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
34
|
-
|
|
34
|
+
i
|
|
35
35
|
),
|
|
36
36
|
children: [
|
|
37
|
-
/* @__PURE__ */ e(
|
|
37
|
+
/* @__PURE__ */ e(U, { name: t, className: "mr-2 h-4 w-4" }),
|
|
38
38
|
/* @__PURE__ */ e("span", { children: l })
|
|
39
39
|
]
|
|
40
40
|
}
|
|
41
|
-
),
|
|
41
|
+
), H = ({
|
|
42
42
|
user: t,
|
|
43
43
|
trigger: l,
|
|
44
44
|
align: a = "end",
|
|
45
45
|
side: r = "bottom",
|
|
46
|
-
className:
|
|
46
|
+
className: i,
|
|
47
47
|
onLogout: h,
|
|
48
48
|
onSettings: c,
|
|
49
49
|
onProfile: u,
|
|
50
50
|
showThemeToggle: k = !0,
|
|
51
|
+
themeOptions: y = A,
|
|
51
52
|
children: g
|
|
52
53
|
}) => {
|
|
53
54
|
var N;
|
|
54
|
-
const [d, s] =
|
|
55
|
-
|
|
56
|
-
const w = (
|
|
57
|
-
f.current && !f.current.contains(
|
|
55
|
+
const [d, s] = O(!1), f = I(null);
|
|
56
|
+
L(() => {
|
|
57
|
+
const w = (E) => {
|
|
58
|
+
f.current && !f.current.contains(E.target) && s(!1);
|
|
58
59
|
};
|
|
59
60
|
return d && document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
|
|
60
61
|
}, [d]);
|
|
@@ -79,15 +80,15 @@ const R = () => {
|
|
|
79
80
|
start: "left-auto right-full top-0 mr-2",
|
|
80
81
|
center: "left-auto right-full top-1/2 -translate-y-1/2 mr-2"
|
|
81
82
|
}
|
|
82
|
-
},
|
|
83
|
-
return /* @__PURE__ */ n("div", { className: o("relative",
|
|
83
|
+
}, C = ((N = x[r]) == null ? void 0 : N[a]) || x.bottom.end, m = !!(u || c), p = !!k, v = !!g, T = !!h;
|
|
84
|
+
return /* @__PURE__ */ n("div", { className: o("relative", i), ref: f, children: [
|
|
84
85
|
/* @__PURE__ */ e(
|
|
85
86
|
"button",
|
|
86
87
|
{
|
|
87
88
|
onClick: () => s(!d),
|
|
88
89
|
className: "flex min-h-11 min-w-11 w-full items-center focus:outline-none",
|
|
89
90
|
children: l || /* @__PURE__ */ e(
|
|
90
|
-
|
|
91
|
+
z,
|
|
91
92
|
{
|
|
92
93
|
name: t.name,
|
|
93
94
|
src: t.avatarUrl,
|
|
@@ -106,14 +107,14 @@ const R = () => {
|
|
|
106
107
|
"backdrop-blur-md",
|
|
107
108
|
// Ensures content behind doesn't make text unreadable
|
|
108
109
|
"animate-in fade-in zoom-in-95 duration-100 p-1",
|
|
109
|
-
|
|
110
|
+
C
|
|
110
111
|
),
|
|
111
112
|
children: [
|
|
112
113
|
/* @__PURE__ */ n("div", { className: "flex flex-col space-y-1 p-2 border-b border-border/50 bg-muted/30", children: [
|
|
113
114
|
/* @__PURE__ */ e("p", { className: "text-sm font-medium leading-none text-foreground", children: t.name }),
|
|
114
115
|
/* @__PURE__ */ e("p", { className: "text-xs leading-none text-muted-foreground truncate", children: t.email })
|
|
115
116
|
] }),
|
|
116
|
-
|
|
117
|
+
m && /* @__PURE__ */ n("div", { className: "p-1 space-y-0.5", children: [
|
|
117
118
|
u && /* @__PURE__ */ e(b, { icon: "user", label: "Profile", onClick: () => {
|
|
118
119
|
u(), s(!1);
|
|
119
120
|
} }),
|
|
@@ -121,12 +122,12 @@ const R = () => {
|
|
|
121
122
|
c(), s(!1);
|
|
122
123
|
} })
|
|
123
124
|
] }),
|
|
124
|
-
p && /* @__PURE__ */ n("div", { className: o("p-2",
|
|
125
|
+
p && /* @__PURE__ */ n("div", { className: o("p-2", m && "border-t border-border/50"), children: [
|
|
125
126
|
/* @__PURE__ */ e("p", { className: "text-[10px] font-bold uppercase tracking-widest text-muted-foreground mb-1", children: "Theme" }),
|
|
126
|
-
/* @__PURE__ */ e(
|
|
127
|
+
/* @__PURE__ */ e(M, { options: y })
|
|
127
128
|
] }),
|
|
128
|
-
v && /* @__PURE__ */ e("div", { className: o("p-1 space-y-0.5", (
|
|
129
|
-
|
|
129
|
+
v && /* @__PURE__ */ e("div", { className: o("p-1 space-y-0.5", (m || p) && "border-t border-border/50"), children: g }),
|
|
130
|
+
T && /* @__PURE__ */ e("div", { className: o("p-1", (m || p || v) && "border-t border-border/50"), children: /* @__PURE__ */ e(
|
|
130
131
|
b,
|
|
131
132
|
{
|
|
132
133
|
icon: "log-out",
|
|
@@ -144,5 +145,5 @@ const R = () => {
|
|
|
144
145
|
};
|
|
145
146
|
export {
|
|
146
147
|
b as ButtonItem,
|
|
147
|
-
|
|
148
|
+
H as UserNav
|
|
148
149
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "primary" | "secondary" | "danger" | "success" | "warning" | "outline" | null | undefined;
|
|
4
|
+
variant?: "primary" | "secondary" | "danger" | "success" | "warning" | "outline" | "gain" | "loss" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* @wizard
|
|
10
10
|
* @name Badge
|
|
11
|
-
* @description A small component to display a status, count, or label.
|
|
12
|
-
* @tags ui, label, indicator
|
|
11
|
+
* @description A small component to display a status, count, or label. The `gain` and `loss` variants are price chips, as on a watchlist: a move up or down, in the theme's direction colours rather than success or danger, because a fall is not an error.
|
|
12
|
+
* @tags ui, label, indicator, price, gain, loss
|
|
13
13
|
* @props
|
|
14
14
|
* - name: variant
|
|
15
|
-
* type: "'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'outline'"
|
|
15
|
+
* type: "'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'outline' | 'gain' | 'loss'"
|
|
16
16
|
* description: The visual style of the badge.
|
|
17
17
|
* - name: children
|
|
18
18
|
* type: React.ReactNode
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
3
|
import { cva as s } from "class-variance-authority";
|
|
4
4
|
import { cn as d } from "../../utils/cn.js";
|
|
5
5
|
const i = s(
|
|
@@ -14,15 +14,18 @@ const i = s(
|
|
|
14
14
|
// ✅ Fixed: Use semantic success token
|
|
15
15
|
warning: "border-transparent bg-warning text-warning-foreground shadow hover:bg-warning/80",
|
|
16
16
|
// ✅ Added: Missing variant
|
|
17
|
-
outline: "text-foreground"
|
|
17
|
+
outline: "text-foreground",
|
|
18
|
+
// A price's direction, not a status: a fall is not an error.
|
|
19
|
+
gain: "border-transparent bg-gain text-gain-foreground tabular-nums shadow hover:bg-gain/80",
|
|
20
|
+
loss: "border-transparent bg-loss text-loss-foreground tabular-nums shadow hover:bg-loss/80"
|
|
18
21
|
}
|
|
19
22
|
},
|
|
20
23
|
defaultVariants: {
|
|
21
24
|
variant: "primary"
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
|
-
), g =
|
|
25
|
-
({ className: r, variant: e, ...o }, n) => /* @__PURE__ */
|
|
27
|
+
), g = t(
|
|
28
|
+
({ className: r, variant: e, ...o }, n) => /* @__PURE__ */ a(
|
|
26
29
|
"div",
|
|
27
30
|
{
|
|
28
31
|
ref: n,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export type ThemeMode = 'light' | 'dark' | 'system' | 'corporate' | 'midnight' | 'blueprint';
|
|
2
|
+
export type ThemeMode = 'light' | 'dark' | 'system' | 'corporate' | 'midnight' | 'blueprint' | 'markets';
|
|
3
3
|
export declare const availableThemes: ThemeMode[];
|
|
4
4
|
export interface ThemeColors {
|
|
5
5
|
primary: string;
|
|
@@ -1,42 +1,50 @@
|
|
|
1
1
|
import { jsx as W } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as h, useEffect as M, useCallback as S, useMemo as X, createContext as Z, useContext as ee } from "react";
|
|
3
3
|
const E = [
|
|
4
4
|
"light",
|
|
5
5
|
"dark",
|
|
6
6
|
"system",
|
|
7
7
|
"corporate",
|
|
8
8
|
"midnight",
|
|
9
|
-
"blueprint"
|
|
10
|
-
|
|
9
|
+
"blueprint",
|
|
10
|
+
"markets"
|
|
11
|
+
], p = 'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace', K = {
|
|
11
12
|
light: {
|
|
12
13
|
sans: '"Inter", system-ui, sans-serif',
|
|
13
14
|
serif: "Georgia, serif",
|
|
14
|
-
mono: `"Menlo", ${
|
|
15
|
+
mono: `"Menlo", ${p}`
|
|
15
16
|
},
|
|
16
17
|
dark: {
|
|
17
18
|
sans: '"Inter", system-ui, sans-serif',
|
|
18
19
|
serif: "Georgia, serif",
|
|
19
|
-
mono: `"Menlo", ${
|
|
20
|
+
mono: `"Menlo", ${p}`
|
|
20
21
|
},
|
|
21
22
|
system: {
|
|
22
23
|
sans: '"Inter", system-ui, sans-serif',
|
|
23
24
|
serif: "Georgia, serif",
|
|
24
|
-
mono: `"Menlo", ${
|
|
25
|
+
mono: `"Menlo", ${p}`
|
|
25
26
|
},
|
|
26
27
|
corporate: {
|
|
27
28
|
sans: '"Lato", sans-serif',
|
|
28
29
|
serif: '"Merriweather", serif',
|
|
29
|
-
mono: `"Menlo", ${
|
|
30
|
+
mono: `"Menlo", ${p}`
|
|
30
31
|
},
|
|
31
32
|
midnight: {
|
|
32
33
|
sans: '"Roboto Mono", monospace',
|
|
33
34
|
serif: "Georgia, serif",
|
|
34
|
-
mono: `"Roboto Mono", ${
|
|
35
|
+
mono: `"Roboto Mono", ${p}`
|
|
35
36
|
},
|
|
36
37
|
blueprint: {
|
|
37
38
|
sans: '"Courier New", monospace',
|
|
38
39
|
serif: "Georgia, serif",
|
|
39
|
-
mono: `"Courier New", ${
|
|
40
|
+
mono: `"Courier New", ${p}`
|
|
41
|
+
},
|
|
42
|
+
// Inter, as the quote screens it is modelled on use a plain grotesque; the
|
|
43
|
+
// figures line up because index.css sets tabular-nums under .markets.
|
|
44
|
+
markets: {
|
|
45
|
+
sans: '"Inter", system-ui, sans-serif',
|
|
46
|
+
serif: "Georgia, serif",
|
|
47
|
+
mono: `"Menlo", ${p}`
|
|
40
48
|
}
|
|
41
49
|
}, oe = 550, re = 100, V = {
|
|
42
50
|
name: "TAY Dreamboat",
|
|
@@ -54,7 +62,7 @@ const E = [
|
|
|
54
62
|
// /fonts/Tay.woff2, which does not exist anywhere in the repo — a 404 in
|
|
55
63
|
// the fallback slot of the hero font.
|
|
56
64
|
serif: '"TAY Dreamboat", "TAY Dreamboat Fallback", serif',
|
|
57
|
-
mono: `"Menlo", ${
|
|
65
|
+
mono: `"Menlo", ${p}`
|
|
58
66
|
},
|
|
59
67
|
lightColors: {
|
|
60
68
|
background: "253 251 247",
|
|
@@ -97,20 +105,20 @@ const E = [
|
|
|
97
105
|
}, J = Z(void 0), q = {
|
|
98
106
|
[V.name]: V
|
|
99
107
|
}, se = ({
|
|
100
|
-
children:
|
|
108
|
+
children: T,
|
|
101
109
|
defaultTheme: l,
|
|
102
110
|
defaultCustomTheme: i,
|
|
103
111
|
appId: L,
|
|
104
112
|
instanceConfig: c
|
|
105
113
|
}) => {
|
|
106
114
|
var O, z, G;
|
|
107
|
-
const v = (O = c == null ? void 0 : c.fonts) == null ? void 0 : O.sans, F = (z = c == null ? void 0 : c.fonts) == null ? void 0 : z.serif, R = (G = c == null ? void 0 : c.fonts) == null ? void 0 : G.mono, t = L ? `ramme:theme:${L}` : "ramme:theme:global", [f,
|
|
115
|
+
const v = (O = c == null ? void 0 : c.fonts) == null ? void 0 : O.sans, F = (z = c == null ? void 0 : c.fonts) == null ? void 0 : z.serif, R = (G = c == null ? void 0 : c.fonts) == null ? void 0 : G.mono, t = L ? `ramme:theme:${L}` : "ramme:theme:global", [f, $] = h(() => {
|
|
108
116
|
if (typeof window < "u") {
|
|
109
117
|
const o = localStorage.getItem(`${t}:mode`);
|
|
110
118
|
return i && !o ? l || "system" : o && E.includes(o) ? o : l || "system";
|
|
111
119
|
}
|
|
112
120
|
return l || "system";
|
|
113
|
-
}), [x, _] =
|
|
121
|
+
}), [x, _] = h("light"), [u, k] = h("0.5rem"), [w, I] = h("1rem"), [a, b] = h(() => {
|
|
114
122
|
if (typeof window < "u") {
|
|
115
123
|
const o = localStorage.getItem(`${t}:custom`);
|
|
116
124
|
if (o)
|
|
@@ -132,20 +140,20 @@ const E = [
|
|
|
132
140
|
_(g.matches ? "dark" : "light");
|
|
133
141
|
};
|
|
134
142
|
o.addEventListener("change", e);
|
|
135
|
-
const d = localStorage.getItem(`${t}:borderRadius`),
|
|
136
|
-
return d &&
|
|
143
|
+
const d = localStorage.getItem(`${t}:borderRadius`), A = localStorage.getItem(`${t}:fontSize`);
|
|
144
|
+
return d && k(d), A && I(A), () => o.removeEventListener("change", e);
|
|
137
145
|
}
|
|
138
146
|
}, [i, t]);
|
|
139
|
-
const B =
|
|
140
|
-
localStorage.removeItem(`${t}:mode`), localStorage.removeItem(`${t}:custom`), localStorage.removeItem(`${t}:borderRadius`), localStorage.removeItem(`${t}:fontSize`),
|
|
141
|
-
}, [l, i, t]), N =
|
|
142
|
-
|
|
143
|
-
}, [t]), Y =
|
|
147
|
+
const B = S(() => {
|
|
148
|
+
localStorage.removeItem(`${t}:mode`), localStorage.removeItem(`${t}:custom`), localStorage.removeItem(`${t}:borderRadius`), localStorage.removeItem(`${t}:fontSize`), k("0.5rem"), I("1rem"), i ? ($("system"), b(i)) : l ? ($(l), b(null)) : ($("system"), b(null));
|
|
149
|
+
}, [l, i, t]), N = S((o) => {
|
|
150
|
+
$(o), localStorage.setItem(`${t}:mode`, o), ["light", "dark", "system"].includes(o) || (b(null), localStorage.removeItem(`${t}:custom`));
|
|
151
|
+
}, [t]), Y = S((o) => {
|
|
144
152
|
b(o), o ? localStorage.setItem(`${t}:custom`, JSON.stringify(o)) : localStorage.removeItem(`${t}:custom`);
|
|
145
|
-
}, [t]), D =
|
|
146
|
-
|
|
147
|
-
}, [t]), P =
|
|
148
|
-
|
|
153
|
+
}, [t]), D = S((o) => {
|
|
154
|
+
k(o), localStorage.setItem(`${t}:borderRadius`, o);
|
|
155
|
+
}, [t]), P = S((o) => {
|
|
156
|
+
I(o), localStorage.setItem(`${t}:fontSize`, o);
|
|
149
157
|
}, [t]);
|
|
150
158
|
M(() => {
|
|
151
159
|
const o = document.documentElement;
|
|
@@ -159,7 +167,7 @@ const E = [
|
|
|
159
167
|
}, []), M(() => {
|
|
160
168
|
const o = document.documentElement;
|
|
161
169
|
E.forEach((s) => o.classList.remove(s)), o.classList.remove("custom-theme");
|
|
162
|
-
const e = (s, n) => o.style.setProperty(s, n), d = (s) => o.style.removeProperty(s),
|
|
170
|
+
const e = (s, n) => o.style.setProperty(s, n), d = (s) => o.style.removeProperty(s), A = [
|
|
163
171
|
"system-ui",
|
|
164
172
|
"Inter",
|
|
165
173
|
"Georgia",
|
|
@@ -178,15 +186,15 @@ const E = [
|
|
|
178
186
|
"TAYKula"
|
|
179
187
|
], g = (s) => {
|
|
180
188
|
const n = s.split(",")[0].replace(/['"]*/g, "").trim();
|
|
181
|
-
if (
|
|
189
|
+
if (A.some((m) => n.toLowerCase() === m.toLowerCase())) return;
|
|
182
190
|
const r = n.replace(/\s+/g, "+").toLowerCase();
|
|
183
191
|
if (Array.from(
|
|
184
192
|
document.querySelectorAll('link[rel="stylesheet"]')
|
|
185
|
-
).some((
|
|
193
|
+
).some((m) => new RegExp(`family=${r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?=[:&]|$)`).test(m.href.toLowerCase()))) return;
|
|
186
194
|
const C = `google-font-${n.replace(/\s+/g, "-")}`;
|
|
187
195
|
if (!document.getElementById(C)) {
|
|
188
|
-
const
|
|
189
|
-
|
|
196
|
+
const m = document.createElement("link");
|
|
197
|
+
m.id = C, m.rel = "stylesheet", m.href = `https://fonts.googleapis.com/css2?family=${n.replace(/\s+/g, "+")}:wght@400;500;600;700&display=swap`, document.head.appendChild(m);
|
|
190
198
|
}
|
|
191
199
|
}, j = [
|
|
192
200
|
"--app-primary-color",
|
|
@@ -219,10 +227,10 @@ const E = [
|
|
|
219
227
|
"--app-border-radius-sm",
|
|
220
228
|
"--app-border-radius-md",
|
|
221
229
|
"--app-border-radius-lg"
|
|
222
|
-
],
|
|
230
|
+
], y = f === "system" ? x : f;
|
|
223
231
|
if (a) {
|
|
224
232
|
o.classList.add("custom-theme");
|
|
225
|
-
const s =
|
|
233
|
+
const s = y === "dark" || y === "midnight" || y === "markets";
|
|
226
234
|
s && o.classList.add("dark");
|
|
227
235
|
const n = a.colors, r = s ? a.darkColors || n : a.lightColors || n;
|
|
228
236
|
if (!r) {
|
|
@@ -231,8 +239,8 @@ const E = [
|
|
|
231
239
|
}
|
|
232
240
|
e("--app-primary-color", r.primary), e("--app-primary-foreground-color", r.primaryForeground), e("--app-secondary-color", r.secondary), e("--app-secondary-foreground-color", r.secondaryForeground), e("--app-accent-color", r.accent), e("--app-accent-foreground-color", r.accentForeground), e("--app-danger-color", r.danger), e("--app-danger-foreground-color", r.dangerForeground), r.success ? e("--app-success-color", r.success) : d("--app-success-color"), r.warning ? e("--app-warning-color", r.warning) : d("--app-warning-color"), e("--app-bg-color", r.background), e("--app-card-bg-color", r.card), e("--app-text-color", r.text), e("--app-border-color", r.border), e("--app-muted-bg", r.muted), e("--app-muted-text", r.mutedForeground), e("--app-input-bg-color", r.input), e("--app-input-border-color", r.inputBorder), e("--app-input-focus-ring-color", r.ring), e("--app-table-header-bg", r.muted), e("--app-table-header-text", r.text), e("--app-table-row-hover-bg", r.muted), e("--app-table-grid-line-color", r.border), a.fonts && (g(a.fonts.sans), a.fonts.serif && g(a.fonts.serif), e("--app-font-serif", a.fonts.serif), e("--app-font-sans", a.fonts.sans), e("--app-font-mono", a.fonts.mono)), document.body.style.backgroundColor = `rgb(${r.background})`, document.body.style.color = `rgb(${r.text})`, e("--app-border-radius-md", a.borderRadius), e("--app-border-radius-sm", `calc(${a.borderRadius} - 0.25rem)`), e("--app-border-radius-lg", `calc(${a.borderRadius} + 0.25rem)`);
|
|
233
241
|
} else {
|
|
234
|
-
o.classList.add(
|
|
235
|
-
const s = K[
|
|
242
|
+
o.classList.add(y), j.forEach(d);
|
|
243
|
+
const s = K[y] || K.light, n = v || s.sans, r = F || s.serif, H = R || s.mono;
|
|
236
244
|
v || g(n), F || g(r), e("--app-font-sans", n), e("--app-font-serif", r), e("--app-font-mono", H), document.body.style.backgroundColor = "", document.body.style.color = "", e("--app-border-radius-md", u), e("--app-border-radius-sm", `calc(${u} - 0.25rem)`), e("--app-border-radius-lg", `calc(${u} + 0.25rem)`);
|
|
237
245
|
}
|
|
238
246
|
if (e("--app-font-size-base", w), !o.hasAttribute("data-theme-ready")) return;
|
|
@@ -258,12 +266,12 @@ const E = [
|
|
|
258
266
|
}),
|
|
259
267
|
[f, N, B, u, D, w, P, a, Y]
|
|
260
268
|
);
|
|
261
|
-
return /* @__PURE__ */ W(J.Provider, { value: U, children:
|
|
269
|
+
return /* @__PURE__ */ W(J.Provider, { value: U, children: T });
|
|
262
270
|
}, ne = () => {
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
271
|
+
const T = ee(J);
|
|
272
|
+
if (T === void 0)
|
|
265
273
|
throw new Error("useTheme must be used within a ThemeProvider");
|
|
266
|
-
return
|
|
274
|
+
return T;
|
|
267
275
|
};
|
|
268
276
|
export {
|
|
269
277
|
V as TAY_DREAMBOAT_THEME,
|