@ramme-io/ui 5.3.1 → 5.4.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/index.js CHANGED
@@ -8,14 +8,14 @@ import { PromptInput as h } from "./blocks/ai/PromptInput.js";
8
8
  import { Message as g } from "./blocks/ai/Message.js";
9
9
  import { Conversation as c } from "./blocks/ai/Conversation.js";
10
10
  import { ChatFAB as b } from "./blocks/ai/ChatFAB.js";
11
- import { AIChatThread as P } from "./components/ai/AIChatThread/AIChatThread.js";
11
+ import { AIChatThread as I } from "./components/ai/AIChatThread/AIChatThread.js";
12
12
  import { KeyInjectionOverlay as A } from "./components/ai/KeyInjectionOverlay.js";
13
- import { TAY_DREAMBOAT_THEME as B, ThemeProvider as R, availableThemes as E, useTheme as M } from "./contexts/ThemeContext.js";
13
+ import { TAY_DREAMBOAT_THEME as R, ThemeProvider as L, availableThemes as B, useTheme as M } from "./contexts/ThemeContext.js";
14
14
  import { AuthLayout as F } from "./components/auth/AuthLayout.js";
15
- import { LoginPage as w } from "./components/auth/LoginPage.js";
16
- import { SignupPage as _ } from "./components/auth/SignupPage.js";
15
+ import { LoginPage as _ } from "./components/auth/LoginPage.js";
16
+ import { SignupPage as O } from "./components/auth/SignupPage.js";
17
17
  import { DataTable as H } from "./components/data-display/DataTable.js";
18
- import { ActivityFeed as V } from "./components/data-display/ActivityFeed.js";
18
+ import { ActivityFeed as G } from "./components/data-display/ActivityFeed.js";
19
19
  import { Table as N } from "./components/data-display/Table.js";
20
20
  import { Gallery as Y } from "./components/data-display/Gallery.js";
21
21
  import { AreaChart as Q } from "./components/data-display/AreaChart.js";
@@ -34,14 +34,14 @@ import { EmptyState as Sr } from "./components/feedback/EmptyState.js";
34
34
  import { Skeleton as Cr } from "./components/feedback/Skeleton.js";
35
35
  import { Plan as ur } from "./components/feedback/Plan.js";
36
36
  import { TippyTooltip as Dr } from "./components/feedback/TippyTooltip.js";
37
- import { Toast as Ir } from "./components/feedback/Toast.js";
38
- import { ToastProvider as Lr, useToast as Br } from "./components/feedback/ToastProvider.js";
39
- import { Label as Er } from "./components/forms/Label.js";
37
+ import { Toast as Pr } from "./components/feedback/Toast.js";
38
+ import { ToastProvider as Er, useToast as Rr } from "./components/feedback/ToastProvider.js";
39
+ import { Label as Br } from "./components/forms/Label.js";
40
40
  import { ButtonGroup as vr } from "./components/forms/ButtonGroup.js";
41
41
  import { Checkbox as yr } from "./components/forms/Checkbox.js";
42
- import { ComboBox as Or } from "./components/forms/ComboBox.js";
42
+ import { ComboBox as wr } from "./components/forms/ComboBox.js";
43
43
  import { DatePicker as kr } from "./components/forms/DatePicker.js";
44
- import { FileUpload as Gr } from "./components/forms/FileUpload.js";
44
+ import { FileUpload as Vr } from "./components/forms/FileUpload.js";
45
45
  import { FormTemplate as Kr } from "./components/forms/FormTemplate.js";
46
46
  import { Input as Ur } from "./components/forms/Input.js";
47
47
  import { MultiSelect as zr } from "./components/forms/MultiSelect.js";
@@ -56,15 +56,15 @@ import { useDataFetch as xo } from "./lib/hooks/useDataFetch.js";
56
56
  import { useChartTheme as no } from "./lib/hooks/useChartTheme.js";
57
57
  import { MOBILE_BREAKPOINT_PX as To, MOBILE_BREAKPOINT_QUERY as so, useIsMobile as ho, useMediaQuery as So } from "./lib/hooks/useMediaQuery.js";
58
58
  import { useBodyScrollLock as Co } from "./lib/hooks/useBodyScrollLock.js";
59
- import { DISMISS_THRESHOLD as uo, DRAG_SLOP as bo, FLICK_VELOCITY as Do, settleTo as Po, useSheetGesture as Io } from "./lib/hooks/useSheetGesture.js";
60
- import { useDialogFocus as Lo } from "./lib/hooks/useDialogFocus.js";
61
- import { CircularDial as Ro } from "./components/hardware/CircularDial.js";
59
+ import { DISMISS_THRESHOLD as uo, DRAG_SLOP as bo, FLICK_VELOCITY as Do, settleTo as Io, useSheetGesture as Po } from "./lib/hooks/useSheetGesture.js";
60
+ import { useDialogFocus as Eo } from "./lib/hooks/useDialogFocus.js";
61
+ import { CircularDial as Lo } from "./components/hardware/CircularDial.js";
62
62
  import { HardwareCommandButton as Mo } from "./components/hardware/HardwareCommandButton.js";
63
63
  import { Sparkline as Fo } from "./components/hardware/Sparkline.js";
64
- import { EdgeInsightTerminal as wo } from "./components/hardware/EdgeInsightTerminal.js";
65
- import { DeviceCard as _o } from "./blocks/iot/DeviceCard.js";
64
+ import { EdgeInsightTerminal as _o } from "./components/hardware/EdgeInsightTerminal.js";
65
+ import { DeviceCard as Oo } from "./blocks/iot/DeviceCard.js";
66
66
  import { WaterPumpControl as Ho } from "./blocks/iot/WaterPumpControl.js";
67
- import { TelemetryLog as Vo } from "./blocks/iot/TelemetryLog.js";
67
+ import { TelemetryLog as Go } from "./blocks/iot/TelemetryLog.js";
68
68
  import { DataCard as No } from "./components/molecular/DataCard.js";
69
69
  import { StateMatrix as Yo } from "./components/molecular/StateMatrix.js";
70
70
  import { ConnectorOverlay as Qo } from "./components/molecular/ConnectorOverlay.js";
@@ -79,13 +79,13 @@ import { FilterPanel as xe } from "./components/layout/FilterPanel.js";
79
79
  import { Statusbar as ne } from "./components/layout/Statusbar.js";
80
80
  import { Accordion as Te, AccordionItem as se } from "./components/layout/Accordion.js";
81
81
  import { Card as he, CardContent as Se, CardDescription as ge, CardFooter as Ce, CardHeader as ce, CardLabel as ue, CardTitle as be } from "./components/layout/Card.js";
82
- import { Drawer as Pe } from "./components/layout/Drawer.js";
82
+ import { Drawer as Ie } from "./components/layout/Drawer.js";
83
83
  import { Sheet as Ae } from "./components/layout/Sheet.js";
84
- import { DefinitionDescription as Be, DefinitionList as Re, DefinitionTerm as Ee, List as Me, ListItem as ve } from "./components/layout/List.js";
84
+ import { DefinitionDescription as Re, DefinitionList as Le, DefinitionTerm as Be, List as Me, ListItem as ve } from "./components/layout/List.js";
85
85
  import { Modal as ye } from "./components/layout/Modal.js";
86
- import { Sidebar as Oe } from "./components/layout/Sidebar.js";
86
+ import { Sidebar as we } from "./components/layout/Sidebar.js";
87
87
  import { ActionBar as ke } from "./components/layout/ActionBar.js";
88
- import { PageContainer as Ge } from "./components/layout/PageContainer.js";
88
+ import { PageContainer as Ve } from "./components/layout/PageContainer.js";
89
89
  import { PageHeader as Ke } from "./components/layout/PageHeader.js";
90
90
  import { SectionHeader as Ue } from "./components/layout/SectionHeader.js";
91
91
  import { ButtonItem as ze, UserNav as Qe } from "./components/layout/UserNav.js";
@@ -101,34 +101,34 @@ import { Avatar as dt } from "./components/ui/Avatar.js";
101
101
  import { Badge as St, badgeVariants as gt } from "./components/ui/Badge.js";
102
102
  import { Button as ct, buttonVariants as ut } from "./components/ui/Button.js";
103
103
  import { Icon as Dt } from "./components/ui/Icon.js";
104
- import { BrandLogo as It } from "./components/ui/BrandLogo.js";
105
- import { cn as Lt } from "./utils/cn.js";
106
- import { formatValue as Rt } from "./lib/formatters.js";
104
+ import { BrandLogo as Pt } from "./components/ui/BrandLogo.js";
105
+ import { cn as Et } from "./utils/cn.js";
106
+ import { formatValue as Lt } from "./lib/formatters.js";
107
107
  import { ThemeSynthesizer as Mt } from "./components/theme/ThemeSynthesizer.js";
108
108
  import { AestheticProfileGrid as Ft } from "./components/theme/AestheticProfileGrid.js";
109
- import { FineTuningControls as wt } from "./components/theme/FineTuningControls.js";
110
- import { PaletteSwatch as _t, ThemeLivePreview as kt } from "./components/theme/ThemeLivePreview.js";
111
- import { ThemeSettings as Gt } from "./components/theme/ThemeSettings.js";
109
+ import { FineTuningControls as _t } from "./components/theme/FineTuningControls.js";
110
+ import { PaletteSwatch as Ot, ThemeLivePreview as kt } from "./components/theme/ThemeLivePreview.js";
111
+ import { ThemeSettings as Vt } from "./components/theme/ThemeSettings.js";
112
112
  import { ThemeLab as Kt } from "./components/theme/ThemeLab.js";
113
113
  import { AESTHETIC_PROFILES as Ut, generateFromProfile as Yt, generateFromPrompt as zt, generateRandom as Qt, hslToCssString as Wt, hslToRgb as jt, hslToRgbString as Xt, lightToDark as qt, paletteToRgbVars as Jt } from "./lib/theme/ThemeGenerator.logic.js";
114
- import { THEME_TOKEN_VARS as $t, applyThemeToDom as rm, generateRandomTheme as om, getContrastColor as em, hexToRgbTriplet as tm, isCustomTheme as mm, loadGoogleFont as pm, randomRgb as am, tokensToVars as fm } from "./lib/theme/themeUtils.js";
115
- import { generateThemeFromPrompt as im } from "./lib/theme/themeAgent.js";
116
- import { TelemetryGraph as lm } from "./components/ai/TelemetryGraph/TelemetryGraph.js";
117
- import { ShowroomContainer as sm } from "./components/showroom/ShowroomContainer.js";
118
- import { ShowroomSidebar as hm } from "./components/showroom/ShowroomSidebar.js";
119
- import { ShowroomCanvas as gm } from "./components/showroom/ShowroomCanvas.js";
120
- import { SkuBadge as cm } from "./components/showroom/SkuBadge.js";
121
- import { resolvePreview as bm } from "./components/showroom/ShowroomRenderer.js";
114
+ import { DERIVED_THEME_VARS as $t, THEME_TOKEN_VARS as rm, applyThemeToDom as om, generateRandomTheme as em, getContrastColor as tm, hexToRgbTriplet as mm, isCustomTheme as pm, loadGoogleFont as am, randomRgb as fm, tokensToVars as xm } from "./lib/theme/themeUtils.js";
115
+ import { generateThemeFromPrompt as nm } from "./lib/theme/themeAgent.js";
116
+ import { TelemetryGraph as Tm } from "./components/ai/TelemetryGraph/TelemetryGraph.js";
117
+ import { ShowroomContainer as dm } from "./components/showroom/ShowroomContainer.js";
118
+ import { ShowroomSidebar as Sm } from "./components/showroom/ShowroomSidebar.js";
119
+ import { ShowroomCanvas as Cm } from "./components/showroom/ShowroomCanvas.js";
120
+ import { SkuBadge as um } from "./components/showroom/SkuBadge.js";
121
+ import { resolvePreview as Dm } from "./components/showroom/ShowroomRenderer.js";
122
122
  export {
123
123
  Ut as AESTHETIC_PROFILES,
124
- P as AIChatThread,
124
+ I as AIChatThread,
125
125
  p as AUTO_REGISTRY,
126
126
  ee as AboutRamme,
127
127
  Te as Accordion,
128
128
  se as AccordionItem,
129
129
  ke as ActionBar,
130
130
  T as Actions,
131
- V as ActivityFeed,
131
+ G as ActivityFeed,
132
132
  Ft as AestheticProfileGrid,
133
133
  dr as Alert,
134
134
  jo as AppShell,
@@ -137,7 +137,7 @@ export {
137
137
  dt as Avatar,
138
138
  St as Badge,
139
139
  j as BarChart,
140
- It as BrandLogo,
140
+ Pt as BrandLogo,
141
141
  Ze as BreadcrumbItem,
142
142
  $e as Breadcrumbs,
143
143
  ct as Button,
@@ -153,31 +153,32 @@ export {
153
153
  q as ChartWithTable,
154
154
  b as ChatFAB,
155
155
  yr as Checkbox,
156
- Ro as CircularDial,
156
+ Lo as CircularDial,
157
157
  mr as CodeBlock,
158
158
  je as CollectionLayout,
159
- Or as ComboBox,
159
+ wr as ComboBox,
160
160
  Qo as ConnectorOverlay,
161
161
  c as Conversation,
162
+ $t as DERIVED_THEME_VARS,
162
163
  uo as DISMISS_THRESHOLD,
163
164
  bo as DRAG_SLOP,
164
165
  No as DataCard,
165
166
  H as DataTable,
166
167
  kr as DatePicker,
167
- Be as DefinitionDescription,
168
- Re as DefinitionList,
169
- Ee as DefinitionTerm,
168
+ Re as DefinitionDescription,
169
+ Le as DefinitionList,
170
+ Be as DefinitionTerm,
170
171
  qe as DenseMetricRibbon,
171
172
  Zo as DetailDrawer,
172
- _o as DeviceCard,
173
+ Oo as DeviceCard,
173
174
  Tr as DocumentScanView,
174
- Pe as Drawer,
175
- wo as EdgeInsightTerminal,
175
+ Ie as Drawer,
176
+ _o as EdgeInsightTerminal,
176
177
  Sr as EmptyState,
177
178
  Do as FLICK_VELOCITY,
178
- Gr as FileUpload,
179
+ Vr as FileUpload,
179
180
  xe as FilterPanel,
180
- wt as FineTuningControls,
181
+ _t as FineTuningControls,
181
182
  oo as FontSelect,
182
183
  Kr as FormTemplate,
183
184
  Y as Gallery,
@@ -187,12 +188,12 @@ export {
187
188
  Ur as Input,
188
189
  A as KeyInjectionOverlay,
189
190
  xr as KpiGrid,
190
- Er as Label,
191
+ Br as Label,
191
192
  Z as LineChart,
192
193
  Me as List,
193
194
  ve as ListItem,
194
195
  n as Loader,
195
- w as LoginPage,
196
+ _ as LoginPage,
196
197
  To as MOBILE_BREAKPOINT_PX,
197
198
  so as MOBILE_BREAKPOINT_QUERY,
198
199
  ot as Menu,
@@ -202,10 +203,10 @@ export {
202
203
  pt as MobileNav,
203
204
  ye as Modal,
204
205
  zr as MultiSelect,
205
- Ge as PageContainer,
206
+ Ve as PageContainer,
206
207
  Ke as PageHeader,
207
208
  ft as Pagination,
208
- _t as PaletteSwatch,
209
+ Ot as PaletteSwatch,
209
210
  rr as PieChart,
210
211
  ur as Plan,
211
212
  h as PromptInput,
@@ -218,13 +219,13 @@ export {
218
219
  $r as Select,
219
220
  qo as SettingsContainer,
220
221
  Ae as Sheet,
221
- gm as ShowroomCanvas,
222
- sm as ShowroomContainer,
223
- hm as ShowroomSidebar,
224
- Oe as Sidebar,
225
- _ as SignupPage,
222
+ Cm as ShowroomCanvas,
223
+ dm as ShowroomContainer,
224
+ Sm as ShowroomSidebar,
225
+ we as Sidebar,
226
+ O as SignupPage,
226
227
  Cr as Skeleton,
227
- cm as SkuBadge,
228
+ um as SkuBadge,
228
229
  Fo as Sparkline,
229
230
  ar as StatCard,
230
231
  Yo as StateMatrix,
@@ -233,60 +234,60 @@ export {
233
234
  it as Stepper,
234
235
  s as Suggestion,
235
236
  po as Switch,
236
- B as TAY_DREAMBOAT_THEME,
237
- $t as THEME_TOKEN_VARS,
237
+ R as TAY_DREAMBOAT_THEME,
238
+ rm as THEME_TOKEN_VARS,
238
239
  lt as TabPanel,
239
240
  N as Table,
240
241
  Tt as Tabs,
241
- lm as TelemetryGraph,
242
- Vo as TelemetryLog,
242
+ Tm as TelemetryGraph,
243
+ Go as TelemetryLog,
243
244
  to as Textarea,
244
245
  Kt as ThemeLab,
245
246
  kt as ThemeLivePreview,
246
- R as ThemeProvider,
247
- Gt as ThemeSettings,
247
+ L as ThemeProvider,
248
+ Vt as ThemeSettings,
248
249
  Mt as ThemeSynthesizer,
249
250
  Dr as TippyTooltip,
250
- Ir as Toast,
251
- Lr as ToastProvider,
251
+ Pr as Toast,
252
+ Er as ToastProvider,
252
253
  ao as ToggleSwitch,
253
254
  ae as Toolbar,
254
255
  Qe as UserNav,
255
256
  Ho as WaterPumpControl,
256
- rm as applyThemeToDom,
257
- E as availableThemes,
257
+ om as applyThemeToDom,
258
+ B as availableThemes,
258
259
  gt as badgeVariants,
259
260
  ut as buttonVariants,
260
- Lt as cn,
261
- Rt as formatValue,
261
+ Et as cn,
262
+ Lt as formatValue,
262
263
  Yt as generateFromProfile,
263
264
  zt as generateFromPrompt,
264
265
  Qt as generateRandom,
265
- om as generateRandomTheme,
266
- im as generateThemeFromPrompt,
267
- em as getContrastColor,
268
- tm as hexToRgbTriplet,
266
+ em as generateRandomTheme,
267
+ nm as generateThemeFromPrompt,
268
+ tm as getContrastColor,
269
+ mm as hexToRgbTriplet,
269
270
  Wt as hslToCssString,
270
271
  jt as hslToRgb,
271
272
  Xt as hslToRgbString,
272
- mm as isCustomTheme,
273
+ pm as isCustomTheme,
273
274
  qt as lightToDark,
274
- pm as loadGoogleFont,
275
+ am as loadGoogleFont,
275
276
  f as mockChartData,
276
277
  x as mockTableData,
277
278
  Jt as paletteToRgbVars,
278
- am as randomRgb,
279
- bm as resolvePreview,
280
- Po as settleTo,
281
- fm as tokensToVars,
279
+ fm as randomRgb,
280
+ Dm as resolvePreview,
281
+ Io as settleTo,
282
+ xm as tokensToVars,
282
283
  Co as useBodyScrollLock,
283
284
  no as useChartTheme,
284
285
  xo as useDataFetch,
285
- Lo as useDialogFocus,
286
+ Eo as useDialogFocus,
286
287
  ho as useIsMobile,
287
288
  So as useMediaQuery,
288
- Io as useSheetGesture,
289
+ Po as useSheetGesture,
289
290
  M as useTheme,
290
- Br as useToast,
291
+ Rr as useToast,
291
292
  t as wizardManifest
292
293
  };
@@ -8,9 +8,30 @@ interface ChartTheme {
8
8
  */
9
9
  accentColor: string;
10
10
  gridColor: string;
11
+ /** The page background: a plot filled with it sits a shade apart from the card around it, in every theme. */
12
+ backgroundColor: string;
11
13
  tooltipBg: string;
12
14
  cursorColor: string;
13
15
  palette: string[];
16
+ /**
17
+ * The theme's status colours, for zones drawn behind a series (a leverage
18
+ * chart's net-cash to heavy-debt bands). The same tokens as bg-success,
19
+ * bg-warning and bg-destructive, so a chart agrees with the table beside it.
20
+ */
21
+ status: {
22
+ success: string;
23
+ warning: string;
24
+ danger: string;
25
+ };
26
+ /**
27
+ * A figure's direction: up or in the black, down or in the red. The same
28
+ * tokens as text-gain-strong and text-loss-strong, and apart from status on
29
+ * purpose: a loss is not an error (AGENTS.md, Semantic styling).
30
+ */
31
+ direction: {
32
+ gain: string;
33
+ loss: string;
34
+ };
14
35
  }
15
36
  export declare const useChartTheme: () => ChartTheme;
16
37
  export {};
@@ -1,38 +1,55 @@
1
- import { useState as b, useEffect as i } from "react";
2
- import { useTheme as u } from "../../contexts/ThemeContext.js";
1
+ import { useState as l, useEffect as i, useRef as u, useLayoutEffect as b } from "react";
2
+ import { useTheme as m } from "../../contexts/ThemeContext.js";
3
3
  const g = [
4
4
  "rgb(13, 110, 253)",
5
5
  "rgb(23, 162, 184)",
6
6
  "rgb(102, 16, 242)",
7
7
  "rgb(255, 193, 7)",
8
8
  "rgb(220, 53, 69)"
9
- ], e = (o) => {
10
- const t = o.trim().split(/\s+/);
11
- return t.length === 3 ? `rgb(${t[0]}, ${t[1]}, ${t[2]})` : `rgb(${o.trim()})`;
12
- }, d = () => {
13
- const { theme: o, customTheme: t } = u(), [s, l] = b({
9
+ ], t = (r) => {
10
+ const e = r.trim().split(/\s+/);
11
+ return e.length === 3 ? `rgb(${e[0]}, ${e[1]}, ${e[2]})` : `rgb(${r.trim()})`;
12
+ }, n = () => {
13
+ const r = (o) => getComputedStyle(document.documentElement).getPropertyValue(o).trim(), e = r("--app-chart-palette"), c = e ? e.split(",").map(t).filter((o) => /^rgb\(\d+,\s*\d+,\s*\d+\)$/.test(o)) : [], a = c.length >= 2 ? c : g;
14
+ return {
15
+ textColor: t(r("--app-text-color")),
16
+ accentColor: t(r("--app-chart-accent")),
17
+ gridColor: t(r("--app-chart-grid-color")),
18
+ backgroundColor: t(r("--app-bg-color") || "248 249 250"),
19
+ tooltipBg: t(r("--app-card-bg-color")),
20
+ cursorColor: `rgba(${r("--app-bg-color").trim().replace(/\s+/g, ", ")}, 0.5)`,
21
+ palette: a,
22
+ status: {
23
+ success: t(r("--app-success-color") || "21 128 61"),
24
+ warning: t(r("--app-warning-color") || "180 83 9"),
25
+ danger: t(r("--app-danger-color") || "220 53 69")
26
+ },
27
+ direction: {
28
+ gain: t(r("--app-gain-color") || "21 128 61"),
29
+ loss: t(r("--app-loss-color") || "194 65 12")
30
+ }
31
+ };
32
+ }, C = () => {
33
+ const { theme: r, customTheme: e, isPrinting: c } = m(), [a, o] = l({
14
34
  textColor: "rgb(33, 37, 41)",
15
35
  accentColor: "rgb(245, 158, 11)",
16
36
  gridColor: "rgb(233, 236, 239)",
37
+ backgroundColor: "rgb(248, 249, 250)",
17
38
  tooltipBg: "rgb(255, 255, 255)",
18
39
  cursorColor: "rgba(0, 0, 0, 0.1)",
19
- palette: g
40
+ palette: g,
41
+ status: { success: "rgb(21, 128, 61)", warning: "rgb(180, 83, 9)", danger: "rgb(220, 53, 69)" },
42
+ direction: { gain: "rgb(21, 128, 61)", loss: "rgb(194, 65, 12)" }
20
43
  });
21
- return i(() => {
22
- const r = (c) => getComputedStyle(document.documentElement).getPropertyValue(c).trim(), p = setTimeout(() => {
23
- const c = r("--app-chart-palette"), a = c ? c.split(",").map(e).filter((n) => /^rgb\(\d+,\s*\d+,\s*\d+\)$/.test(n)) : [], m = a.length >= 2 ? a : g;
24
- l({
25
- textColor: e(r("--app-text-color")),
26
- accentColor: e(r("--app-chart-accent")),
27
- gridColor: e(r("--app-chart-grid-color")),
28
- tooltipBg: e(r("--app-card-bg-color")),
29
- cursorColor: `rgba(${r("--app-bg-color").trim().replace(/\s+/g, ", ")}, 0.5)`,
30
- palette: m
31
- });
32
- }, 10);
44
+ i(() => {
45
+ const p = setTimeout(() => o(n()), 10);
33
46
  return () => clearTimeout(p);
34
- }, [o, t]), s;
47
+ }, [r, e]);
48
+ const s = u(!1);
49
+ return b(() => {
50
+ !c && !s.current || (s.current = !0, o(n()));
51
+ }, [c]), a;
35
52
  };
36
53
  export {
37
- d as useChartTheme
54
+ C as useChartTheme
38
55
  };
@@ -3,8 +3,14 @@ import { DEFAULT_THEME_TOKENS } from '@ramme-io/shared';
3
3
  * Advanced Contrast Guard
4
4
  * Adjusts for perceived darkness (like scanline overlays)
5
5
  */
6
- export declare const getContrastColor: (bgRgb: string) => "255 255 255" | "15 23 42";
6
+ export declare const getContrastColor: (bgRgb: string) => "15 23 42" | "255 255 255";
7
7
  export declare const applyThemeToDom: (vars: Record<string, string>, target?: HTMLElement) => void;
8
+ /**
9
+ * Every variable `applyThemeToDom` can write that its caller did not name:
10
+ * the readable foregrounds, the chart series, the shorthand repairs and the
11
+ * form-control fallbacks. Whatever purges a theme purges these too.
12
+ */
13
+ export declare const DERIVED_THEME_VARS: readonly ["--app-primary-foreground-color", "--app-text-color", "--app-bg-color", "--app-card-bg-color", "--app-border-color", "--app-primary-color", "--app-secondary-color", "--app-accent-color", "--app-input-bg-color", "--app-input-border-color", "--app-chart-1", "--app-chart-2", "--app-chart-3", "--app-chart-4", "--app-chart-5", "--app-chart-palette"];
8
14
  /**
9
15
  * Dynamically loads Google Fonts and updates CSS variables
10
16
  */
@@ -1,18 +1,19 @@
1
- import { DEFAULT_THEME_TOKENS as d } from "@ramme-io/shared";
1
+ import { DEFAULT_THEME_TOKENS as g } from "@ramme-io/shared";
2
2
  const m = (o, p) => {
3
+ if (!o) return "128 128 128";
3
4
  const a = o.split(" ").map(Number);
4
5
  if (a.length !== 3) return o;
5
6
  const r = (t) => Math.max(0, Math.min(255, t));
6
7
  return `${r(a[0] + p)} ${r(a[1] + p)} ${r(a[2] + p)}`;
7
- }, g = (o) => {
8
+ }, h = (o) => {
8
9
  const [p, a, r] = o.split(" ").map(Number);
9
10
  return (0.2126 * p + 0.7152 * a + 0.0722 * r) / 255 > 0.45 ? "15 23 42" : "255 255 255";
10
- }, f = (o, p) => {
11
+ }, b = (o, p) => {
11
12
  if (!o || typeof o != "object") return;
12
13
  const a = p || document.documentElement, r = { ...o }, t = r["--app-primary-color"];
13
- t && (r["--app-primary-foreground-color"] = g(t));
14
- const l = r["--app-bg-color"];
15
- l && (r["--app-text-color"] = g(l)), Object.entries({
14
+ t && (r["--app-primary-foreground-color"] = h(t));
15
+ const i = r["--app-bg-color"];
16
+ i && (r["--app-text-color"] = h(i)), Object.entries({
16
17
  "--primary": "--app-primary-color",
17
18
  "--bg": "--app-bg-color",
18
19
  "--text": "--app-text-color",
@@ -20,27 +21,48 @@ const m = (o, p) => {
20
21
  "--border": "--app-border-color",
21
22
  "--secondary": "--app-secondary-color",
22
23
  "--accent": "--app-accent-color"
23
- }).forEach(([s, i]) => {
24
- o[s] && !o[i] && (r[i] = o[s]);
24
+ }).forEach(([s, n]) => {
25
+ o[s] && !o[n] && (r[n] = o[s]);
25
26
  });
26
- const e = r["--app-chart-1"] || r["--app-primary-color"] || "13 110 253";
27
- r["--app-chart-1"] || (r["--app-chart-1"] = e), r["--app-chart-2"] || (r["--app-chart-2"] = m(e, 30)), r["--app-chart-3"] || (r["--app-chart-3"] = m(e, -30)), r["--app-chart-4"] || (r["--app-chart-4"] = m(e, 60)), r["--app-chart-5"] || (r["--app-chart-5"] = m(e, -60)), r["--app-chart-palette"] = [
27
+ const e = r["--app-chart-1"] || r["--app-primary-color"];
28
+ e && (r["--app-chart-1"] || (r["--app-chart-1"] = e), r["--app-chart-2"] || (r["--app-chart-2"] = m(e, 30)), r["--app-chart-3"] || (r["--app-chart-3"] = m(e, -30)), r["--app-chart-4"] || (r["--app-chart-4"] = m(e, 60)), r["--app-chart-5"] || (r["--app-chart-5"] = m(e, -60)), r["--app-chart-palette"] = [
28
29
  r["--app-chart-1"],
29
30
  r["--app-chart-2"],
30
31
  r["--app-chart-3"],
31
32
  r["--app-chart-4"],
32
33
  r["--app-chart-5"]
33
- ].join(", "), r["--app-secondary-color"] || (r["--app-secondary-color"] = "100 116 139"), r["--app-accent-color"] || (r["--app-accent-color"] = r["--app-primary-color"]), r["--app-input-bg-color"] || (r["--app-input-bg-color"] = r["--app-card-bg-color"]), r["--app-input-border-color"] || (r["--app-input-border-color"] = r["--app-border-color"]), r["--app-border-radius-md"] || (r["--app-border-radius-md"] = "0.375rem"), Object.entries(r).forEach(([s, i]) => {
34
- s.startsWith("--app-") && a.style.setProperty(s, String(i));
34
+ ].join(", "));
35
+ const d = (s, n) => {
36
+ !r[s] && r[n] && (r[s] = r[n]);
37
+ };
38
+ d("--app-accent-color", "--app-primary-color"), d("--app-input-bg-color", "--app-card-bg-color"), d("--app-input-border-color", "--app-border-color"), Object.entries(r).forEach(([s, n]) => {
39
+ s.startsWith("--app-") && typeof n == "string" && n !== "" && a.style.setProperty(s, n);
35
40
  });
36
- }, b = (o, p) => {
41
+ }, y = [
42
+ "--app-primary-foreground-color",
43
+ "--app-text-color",
44
+ "--app-bg-color",
45
+ "--app-card-bg-color",
46
+ "--app-border-color",
47
+ "--app-primary-color",
48
+ "--app-secondary-color",
49
+ "--app-accent-color",
50
+ "--app-input-bg-color",
51
+ "--app-input-border-color",
52
+ "--app-chart-1",
53
+ "--app-chart-2",
54
+ "--app-chart-3",
55
+ "--app-chart-4",
56
+ "--app-chart-5",
57
+ "--app-chart-palette"
58
+ ], E = (o, p) => {
37
59
  const a = document.head, r = "dynamic-google-fonts", t = document.getElementById(r);
38
60
  t && a.removeChild(t);
39
- const l = `${o.replace(/ /g, "+")}:wght@400;700&family=${p.replace(/ /g, "+")}:wght@400;500;700`, n = document.createElement("link");
40
- n.id = r, n.rel = "stylesheet", n.crossOrigin = "anonymous", n.href = `https://fonts.googleapis.com/css2?family=${l}&display=swap`, a.insertBefore(n, a.firstChild);
61
+ const i = `${o.replace(/ /g, "+")}:wght@400;700&family=${p.replace(/ /g, "+")}:wght@400;500;700`, l = document.createElement("link");
62
+ l.id = r, l.rel = "stylesheet", l.crossOrigin = "anonymous", l.href = `https://fonts.googleapis.com/css2?family=${i}&display=swap`, a.insertBefore(l, a.firstChild);
41
63
  const e = document.documentElement;
42
64
  e.style.setProperty("--app-font-sans", `"${p}", sans-serif`), e.style.setProperty("--app-font-serif", `"${o}", serif`), console.log(`[FontEngine] Applied: ${o} (H) / ${p} (B)`);
43
- }, y = (o) => {
65
+ }, $ = (o) => {
44
66
  const p = o.replace("#", ""), a = parseInt(p.substring(0, 2), 16), r = parseInt(p.substring(2, 4), 16), t = parseInt(p.substring(4, 6), 16);
45
67
  return `${a} ${r} ${t}`;
46
68
  }, u = {
@@ -49,14 +71,14 @@ const m = (o, p) => {
49
71
  md: "0.375rem",
50
72
  lg: "0.5rem",
51
73
  full: "9999px"
52
- }, $ = [
74
+ }, M = [
53
75
  "--app-primary-color",
54
76
  "--app-secondary-color",
55
77
  "--app-success-color",
56
78
  "--app-warning-color",
57
79
  "--app-danger-color",
58
80
  "--app-border-radius-md"
59
- ], E = (o) => o ? Object.keys(d).some((p) => o[p] !== void 0 && o[p] !== d[p]) : !1, M = (o) => ({
81
+ ], T = (o) => o ? Object.keys(g).some((p) => o[p] !== void 0 && o[p] !== g[p]) : !1, x = (o) => ({
60
82
  "--app-primary-color": o.primary ?? "13 110 253",
61
83
  "--app-secondary-color": o.neutral ?? "24 24 27",
62
84
  "--app-success-color": o.success ?? "34 197 94",
@@ -70,7 +92,7 @@ const m = (o, p) => {
70
92
  }), c = (o = 0, p = 255) => {
71
93
  const a = Math.floor(Math.random() * (p - o) + o), r = Math.floor(Math.random() * (p - o) + o), t = Math.floor(Math.random() * (p - o) + o);
72
94
  return `${a} ${r} ${t}`;
73
- }, T = () => {
95
+ }, R = () => {
74
96
  const o = Math.random() > 0.5, p = o ? c(10, 40) : c(240, 255), a = o ? c(220, 255) : c(20, 60), r = c(50, 200);
75
97
  return {
76
98
  "--app-primary-color": r,
@@ -85,13 +107,14 @@ const m = (o, p) => {
85
107
  };
86
108
  };
87
109
  export {
88
- $ as THEME_TOKEN_VARS,
89
- f as applyThemeToDom,
90
- T as generateRandomTheme,
91
- g as getContrastColor,
92
- y as hexToRgbTriplet,
93
- E as isCustomTheme,
94
- b as loadGoogleFont,
110
+ y as DERIVED_THEME_VARS,
111
+ M as THEME_TOKEN_VARS,
112
+ b as applyThemeToDom,
113
+ R as generateRandomTheme,
114
+ h as getContrastColor,
115
+ $ as hexToRgbTriplet,
116
+ T as isCustomTheme,
117
+ E as loadGoogleFont,
95
118
  c as randomRgb,
96
- M as tokensToVars
119
+ x as tokensToVars
97
120
  };
@@ -0,0 +1 @@
1
+ export {};