@ramme-io/ui 5.4.0 → 5.5.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/bin/ramme-ui.mjs +18 -6
- package/dist/components/ai/cardState.d.ts +7 -10
- package/dist/index.js +65 -63
- package/dist/lib/theme/ThemeGenerator.contrast.test.d.ts +1 -0
- package/dist/lib/theme/ThemeGenerator.logic.js +68 -67
- package/dist/lib/theme/themeUtils.d.ts +13 -3
- package/dist/lib/theme/themeUtils.js +74 -63
- package/package.json +2 -2
package/bin/ramme-ui.mjs
CHANGED
|
@@ -215,6 +215,17 @@ const RULES = [
|
|
|
215
215
|
re: /\b(?:h|min-h|max-h)-\[?\d*\.?\d*vh\b/g,
|
|
216
216
|
say: '`vh` is wrong on any mobile browser with a retracting toolbar. Use `dvh` — and only AppShell sets viewport geometry.',
|
|
217
217
|
},
|
|
218
|
+
{
|
|
219
|
+
// Each element maps to a component that exists: checked with `ramme-ui find`
|
|
220
|
+
// when the rule was added. framework/ui itself is exempt, since its
|
|
221
|
+
// primitives are built from these elements; JSX only, since a raw tag in a
|
|
222
|
+
// .ts file is an HTML string for a board or an email, not a React tree.
|
|
223
|
+
id: 'raw-element',
|
|
224
|
+
re: /<(?:button|table|dialog|select|textarea)\b/g,
|
|
225
|
+
files: /\.(tsx|jsx)$/,
|
|
226
|
+
skip: /(^|\/)framework\/ui\/src\//,
|
|
227
|
+
say: '@ramme-io/ui already has this: <button> → Button, <table> → Table or DataTable, <dialog> → Modal, <select> → Select, <textarea> → Textarea (`ramme-ui find <name>`).',
|
|
228
|
+
},
|
|
218
229
|
{
|
|
219
230
|
id: 'hardcoded-hex',
|
|
220
231
|
re: /(?:className|class)="[^"]*#[0-9a-fA-F]{3,8}\b[^"]*"|style=\{\{[^}]*#[0-9a-fA-F]{3,8}/g,
|
|
@@ -226,11 +237,12 @@ const RULES = [
|
|
|
226
237
|
const isExempt = (p) => /(^|\/)__tests__(\/|$)|\.(test|spec|stories)\.[jt]sx?$/.test(p);
|
|
227
238
|
const isUiFile = (p) => /\.(tsx|jsx|ts|css)$/.test(p);
|
|
228
239
|
|
|
229
|
-
/** Every rule hit in a file's text, one per rule per line. */
|
|
230
|
-
const scan = (text) => {
|
|
240
|
+
/** Every rule hit in a file's text, one per rule per line. `path` decides which rules apply. */
|
|
241
|
+
const scan = (text, path = '') => {
|
|
242
|
+
const rules = RULES.filter((r) => (!r.files || r.files.test(path)) && !(r.skip && r.skip.test(path)));
|
|
231
243
|
const hits = [];
|
|
232
244
|
text.split('\n').forEach((line, i) => {
|
|
233
|
-
for (const rule of
|
|
245
|
+
for (const rule of rules) {
|
|
234
246
|
rule.re.lastIndex = 0;
|
|
235
247
|
const m = line.match(rule.re);
|
|
236
248
|
if (m) hits.push({ line: i + 1, rule, found: [...new Set(m)].join(', ') });
|
|
@@ -263,7 +275,7 @@ const cmdCheck = (paths) => {
|
|
|
263
275
|
// Guards quote the classes they ban, in comments and in assertions. The
|
|
264
276
|
// repo's own ratchet skips __tests__ for this reason; so does this.
|
|
265
277
|
if (isExempt(p)) continue;
|
|
266
|
-
const hits = scan(readFileSync(p, 'utf8'));
|
|
278
|
+
const hits = scan(readFileSync(p, 'utf8'), resolve(p));
|
|
267
279
|
if (hits.length) {
|
|
268
280
|
console.log(`\n${p}`);
|
|
269
281
|
for (const h of hits) {
|
|
@@ -326,9 +338,9 @@ const cmdHook = async () => {
|
|
|
326
338
|
if (!isUiFile(file) || isExempt(file) || !existsSync(file)) process.exit(0);
|
|
327
339
|
|
|
328
340
|
const before = new Map();
|
|
329
|
-
for (const h of scan(atHead(file))) before.set(keyOf(h), (before.get(keyOf(h)) || 0) + 1);
|
|
341
|
+
for (const h of scan(atHead(file), file)) before.set(keyOf(h), (before.get(keyOf(h)) || 0) + 1);
|
|
330
342
|
|
|
331
|
-
const now = scan(readFileSync(file, 'utf8'));
|
|
343
|
+
const now = scan(readFileSync(file, 'utf8'), file);
|
|
332
344
|
const counts = new Map();
|
|
333
345
|
for (const h of now) counts.set(keyOf(h), (counts.get(keyOf(h)) || 0) + 1);
|
|
334
346
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ViewState } from '@ramme-io/shared';
|
|
1
2
|
/**
|
|
2
3
|
* What a data-driven AI card is showing: still loading, failed, or ready.
|
|
3
4
|
*
|
|
@@ -6,14 +7,10 @@
|
|
|
6
7
|
*
|
|
7
8
|
* `sample` marks data from the demo lake, so a card can say so. A demo number
|
|
8
9
|
* that looks like a real quote is worse than no number.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated Use `ViewState<T>` from `@ramme-io/shared`, which adds `empty`.
|
|
12
|
+
* This is the same type without `empty`, kept so existing cards do not break.
|
|
9
13
|
*/
|
|
10
|
-
export type CardState<T> = {
|
|
11
|
-
status: '
|
|
12
|
-
}
|
|
13
|
-
status: 'error';
|
|
14
|
-
message: string;
|
|
15
|
-
} | {
|
|
16
|
-
status: 'ready';
|
|
17
|
-
data: T;
|
|
18
|
-
sample?: boolean;
|
|
19
|
-
};
|
|
14
|
+
export type CardState<T> = Exclude<ViewState<T>, {
|
|
15
|
+
status: 'empty';
|
|
16
|
+
}>;
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
import { wizardManifest as t } from "./wizardManifest.js";
|
|
3
|
-
import { AUTO_REGISTRY as
|
|
3
|
+
import { AUTO_REGISTRY as a } from "./component-registry.js";
|
|
4
4
|
import { mockChartData as f, mockTableData as x } from "./data/mockData.js";
|
|
5
5
|
import { Loader as n } from "./blocks/ai/Loader.js";
|
|
6
6
|
import { Actions as T, Suggestion as s } from "./blocks/ai/Actions.js";
|
|
7
7
|
import { PromptInput as h } from "./blocks/ai/PromptInput.js";
|
|
8
|
-
import { Message as
|
|
9
|
-
import { Conversation as
|
|
8
|
+
import { Message as c } from "./blocks/ai/Message.js";
|
|
9
|
+
import { Conversation as u } from "./blocks/ai/Conversation.js";
|
|
10
10
|
import { ChatFAB as b } from "./blocks/ai/ChatFAB.js";
|
|
11
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
|
|
13
|
+
import { TAY_DREAMBOAT_THEME as E, 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
15
|
import { LoginPage as _ } from "./components/auth/LoginPage.js";
|
|
16
16
|
import { SignupPage as O } from "./components/auth/SignupPage.js";
|
|
@@ -25,17 +25,17 @@ import { LineChart as Z } from "./components/data-display/LineChart.js";
|
|
|
25
25
|
import { PieChart as rr } from "./components/data-display/PieChart.js";
|
|
26
26
|
import { ScatterChart as er } from "./components/data-display/ScatterChart.js";
|
|
27
27
|
import { CodeBlock as mr } from "./components/data-display/CodeBlock.js";
|
|
28
|
-
import { StatCard as
|
|
28
|
+
import { StatCard as pr } from "./components/data-display/StatCard.js";
|
|
29
29
|
import { KpiGrid as xr } from "./components/data-display/KpiGrid.js";
|
|
30
30
|
import { StatusBadge as nr } from "./components/data-display/StatusBadge.js";
|
|
31
31
|
import { DocumentScanView as Tr } from "./components/data-display/DocumentScanView.js";
|
|
32
32
|
import { Alert as dr } from "./components/feedback/Alert.js";
|
|
33
33
|
import { EmptyState as Sr } from "./components/feedback/EmptyState.js";
|
|
34
|
-
import { Skeleton as
|
|
35
|
-
import { Plan as
|
|
34
|
+
import { Skeleton as gr } from "./components/feedback/Skeleton.js";
|
|
35
|
+
import { Plan as Cr } from "./components/feedback/Plan.js";
|
|
36
36
|
import { TippyTooltip as Dr } from "./components/feedback/TippyTooltip.js";
|
|
37
37
|
import { Toast as Pr } from "./components/feedback/Toast.js";
|
|
38
|
-
import { ToastProvider as
|
|
38
|
+
import { ToastProvider as Rr, useToast as Er } from "./components/feedback/ToastProvider.js";
|
|
39
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";
|
|
@@ -51,13 +51,13 @@ import { SegmentedControl as Jr } from "./components/forms/SegmentedControl.js";
|
|
|
51
51
|
import { Select as $r } from "./components/forms/Select.js";
|
|
52
52
|
import { FontSelect as oo } from "./components/forms/FontSelect.js";
|
|
53
53
|
import { Textarea as to } from "./components/forms/Textarea.js";
|
|
54
|
-
import { ToggleSwitch as
|
|
54
|
+
import { ToggleSwitch as ao, ToggleSwitch as po } from "./components/forms/ToggleSwitch.js";
|
|
55
55
|
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
|
-
import { useBodyScrollLock as
|
|
59
|
-
import { DISMISS_THRESHOLD as
|
|
60
|
-
import { useDialogFocus as
|
|
58
|
+
import { useBodyScrollLock as go } from "./lib/hooks/useBodyScrollLock.js";
|
|
59
|
+
import { DISMISS_THRESHOLD as Co, DRAG_SLOP as bo, FLICK_VELOCITY as Do, settleTo as Io, useSheetGesture as Po } from "./lib/hooks/useSheetGesture.js";
|
|
60
|
+
import { useDialogFocus as Ro } from "./lib/hooks/useDialogFocus.js";
|
|
61
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";
|
|
@@ -74,14 +74,14 @@ import { DetailDrawer as Zo } from "./components/layout/DetailDrawer.js";
|
|
|
74
74
|
import { RammeInspectorTrigger as re } from "./components/layout/RammeInspectorTrigger.js";
|
|
75
75
|
import { AboutRamme as ee } from "./components/layout/AboutRamme.js";
|
|
76
76
|
import { Header as me } from "./components/layout/Header.js";
|
|
77
|
-
import { Toolbar as
|
|
77
|
+
import { Toolbar as pe } from "./components/layout/Toolbar.js";
|
|
78
78
|
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
|
-
import { Card as he, CardContent as Se, CardDescription as
|
|
81
|
+
import { Card as he, CardContent as Se, CardDescription as ce, CardFooter as ge, CardHeader as ue, CardLabel as Ce, CardTitle as be } from "./components/layout/Card.js";
|
|
82
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
|
|
84
|
+
import { DefinitionDescription as Ee, 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
86
|
import { Sidebar as we } from "./components/layout/Sidebar.js";
|
|
87
87
|
import { ActionBar as ke } from "./components/layout/ActionBar.js";
|
|
@@ -93,16 +93,16 @@ import { CollectionLayout as je } from "./components/layout/CollectionLayout.js"
|
|
|
93
93
|
import { DenseMetricRibbon as qe } from "./components/layout/DenseMetricRibbon.js";
|
|
94
94
|
import { BreadcrumbItem as Ze, Breadcrumbs as $e } from "./components/navigation/Breadcrumbs.js";
|
|
95
95
|
import { Menu as ot, MenuDivider as et, MenuItem as tt } from "./components/navigation/Menu.js";
|
|
96
|
-
import { MobileNav as
|
|
96
|
+
import { MobileNav as at } from "./components/navigation/MobileNav.js";
|
|
97
97
|
import { Pagination as ft } from "./components/navigation/Pagination.js";
|
|
98
98
|
import { Stepper as it } from "./components/navigation/Stepper.js";
|
|
99
99
|
import { TabPanel as lt, Tabs as Tt } from "./components/navigation/Tabs.js";
|
|
100
100
|
import { Avatar as dt } from "./components/ui/Avatar.js";
|
|
101
|
-
import { Badge as St, badgeVariants as
|
|
102
|
-
import { Button as
|
|
101
|
+
import { Badge as St, badgeVariants as ct } from "./components/ui/Badge.js";
|
|
102
|
+
import { Button as ut, buttonVariants as Ct } from "./components/ui/Button.js";
|
|
103
103
|
import { Icon as Dt } from "./components/ui/Icon.js";
|
|
104
104
|
import { BrandLogo as Pt } from "./components/ui/BrandLogo.js";
|
|
105
|
-
import { cn as
|
|
105
|
+
import { cn as Rt } from "./utils/cn.js";
|
|
106
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";
|
|
@@ -111,18 +111,18 @@ import { PaletteSwatch as Ot, ThemeLivePreview as kt } from "./components/theme/
|
|
|
111
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 { DERIVED_THEME_VARS as $t, THEME_TOKEN_VARS as rm, applyThemeToDom as om,
|
|
115
|
-
import { generateThemeFromPrompt as
|
|
116
|
-
import { TelemetryGraph as
|
|
117
|
-
import { ShowroomContainer as
|
|
118
|
-
import { ShowroomSidebar as
|
|
114
|
+
import { DERIVED_THEME_VARS as $t, THEME_TOKEN_VARS as rm, applyThemeToDom as om, contrastRatio as em, generateRandomTheme as tm, getContrastColor as mm, hexToRgbTriplet as am, isCustomTheme as pm, loadGoogleFont as fm, randomRgb as xm, relativeLuminance as im, tokensToVars as nm } from "./lib/theme/themeUtils.js";
|
|
115
|
+
import { generateThemeFromPrompt as Tm } from "./lib/theme/themeAgent.js";
|
|
116
|
+
import { TelemetryGraph as dm } from "./components/ai/TelemetryGraph/TelemetryGraph.js";
|
|
117
|
+
import { ShowroomContainer as Sm } from "./components/showroom/ShowroomContainer.js";
|
|
118
|
+
import { ShowroomSidebar as gm } from "./components/showroom/ShowroomSidebar.js";
|
|
119
119
|
import { ShowroomCanvas as Cm } from "./components/showroom/ShowroomCanvas.js";
|
|
120
|
-
import { SkuBadge as
|
|
121
|
-
import { resolvePreview as
|
|
120
|
+
import { SkuBadge as Dm } from "./components/showroom/SkuBadge.js";
|
|
121
|
+
import { resolvePreview as Pm } from "./components/showroom/ShowroomRenderer.js";
|
|
122
122
|
export {
|
|
123
123
|
Ut as AESTHETIC_PROFILES,
|
|
124
124
|
I as AIChatThread,
|
|
125
|
-
|
|
125
|
+
a as AUTO_REGISTRY,
|
|
126
126
|
ee as AboutRamme,
|
|
127
127
|
Te as Accordion,
|
|
128
128
|
se as AccordionItem,
|
|
@@ -140,15 +140,15 @@ export {
|
|
|
140
140
|
Pt as BrandLogo,
|
|
141
141
|
Ze as BreadcrumbItem,
|
|
142
142
|
$e as Breadcrumbs,
|
|
143
|
-
|
|
143
|
+
ut as Button,
|
|
144
144
|
vr as ButtonGroup,
|
|
145
145
|
ze as ButtonItem,
|
|
146
146
|
he as Card,
|
|
147
147
|
Se as CardContent,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
ce as CardDescription,
|
|
149
|
+
ge as CardFooter,
|
|
150
|
+
ue as CardHeader,
|
|
151
|
+
Ce as CardLabel,
|
|
152
152
|
be as CardTitle,
|
|
153
153
|
q as ChartWithTable,
|
|
154
154
|
b as ChatFAB,
|
|
@@ -158,14 +158,14 @@ export {
|
|
|
158
158
|
je as CollectionLayout,
|
|
159
159
|
wr as ComboBox,
|
|
160
160
|
Qo as ConnectorOverlay,
|
|
161
|
-
|
|
161
|
+
u as Conversation,
|
|
162
162
|
$t as DERIVED_THEME_VARS,
|
|
163
|
-
|
|
163
|
+
Co as DISMISS_THRESHOLD,
|
|
164
164
|
bo as DRAG_SLOP,
|
|
165
165
|
No as DataCard,
|
|
166
166
|
H as DataTable,
|
|
167
167
|
kr as DatePicker,
|
|
168
|
-
|
|
168
|
+
Ee as DefinitionDescription,
|
|
169
169
|
Le as DefinitionList,
|
|
170
170
|
Be as DefinitionTerm,
|
|
171
171
|
qe as DenseMetricRibbon,
|
|
@@ -199,8 +199,8 @@ export {
|
|
|
199
199
|
ot as Menu,
|
|
200
200
|
et as MenuDivider,
|
|
201
201
|
tt as MenuItem,
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
c as Message,
|
|
203
|
+
at as MobileNav,
|
|
204
204
|
ye as Modal,
|
|
205
205
|
zr as MultiSelect,
|
|
206
206
|
Ve as PageContainer,
|
|
@@ -208,7 +208,7 @@ export {
|
|
|
208
208
|
ft as Pagination,
|
|
209
209
|
Ot as PaletteSwatch,
|
|
210
210
|
rr as PieChart,
|
|
211
|
-
|
|
211
|
+
Cr as Plan,
|
|
212
212
|
h as PromptInput,
|
|
213
213
|
Wr as Radio,
|
|
214
214
|
re as RammeInspectorTrigger,
|
|
@@ -220,26 +220,26 @@ export {
|
|
|
220
220
|
qo as SettingsContainer,
|
|
221
221
|
Ae as Sheet,
|
|
222
222
|
Cm as ShowroomCanvas,
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
Sm as ShowroomContainer,
|
|
224
|
+
gm as ShowroomSidebar,
|
|
225
225
|
we as Sidebar,
|
|
226
226
|
O as SignupPage,
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
gr as Skeleton,
|
|
228
|
+
Dm as SkuBadge,
|
|
229
229
|
Fo as Sparkline,
|
|
230
|
-
|
|
230
|
+
pr as StatCard,
|
|
231
231
|
Yo as StateMatrix,
|
|
232
232
|
nr as StatusBadge,
|
|
233
233
|
ne as Statusbar,
|
|
234
234
|
it as Stepper,
|
|
235
235
|
s as Suggestion,
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
ao as Switch,
|
|
237
|
+
E as TAY_DREAMBOAT_THEME,
|
|
238
238
|
rm as THEME_TOKEN_VARS,
|
|
239
239
|
lt as TabPanel,
|
|
240
240
|
N as Table,
|
|
241
241
|
Tt as Tabs,
|
|
242
|
-
|
|
242
|
+
dm as TelemetryGraph,
|
|
243
243
|
Go as TelemetryLog,
|
|
244
244
|
to as Textarea,
|
|
245
245
|
Kt as ThemeLab,
|
|
@@ -249,45 +249,47 @@ export {
|
|
|
249
249
|
Mt as ThemeSynthesizer,
|
|
250
250
|
Dr as TippyTooltip,
|
|
251
251
|
Pr as Toast,
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
Rr as ToastProvider,
|
|
253
|
+
po as ToggleSwitch,
|
|
254
|
+
pe as Toolbar,
|
|
255
255
|
Qe as UserNav,
|
|
256
256
|
Ho as WaterPumpControl,
|
|
257
257
|
om as applyThemeToDom,
|
|
258
258
|
B as availableThemes,
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
ct as badgeVariants,
|
|
260
|
+
Ct as buttonVariants,
|
|
261
|
+
Rt as cn,
|
|
262
|
+
em as contrastRatio,
|
|
262
263
|
Lt as formatValue,
|
|
263
264
|
Yt as generateFromProfile,
|
|
264
265
|
zt as generateFromPrompt,
|
|
265
266
|
Qt as generateRandom,
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
tm as generateRandomTheme,
|
|
268
|
+
Tm as generateThemeFromPrompt,
|
|
269
|
+
mm as getContrastColor,
|
|
270
|
+
am as hexToRgbTriplet,
|
|
270
271
|
Wt as hslToCssString,
|
|
271
272
|
jt as hslToRgb,
|
|
272
273
|
Xt as hslToRgbString,
|
|
273
274
|
pm as isCustomTheme,
|
|
274
275
|
qt as lightToDark,
|
|
275
|
-
|
|
276
|
+
fm as loadGoogleFont,
|
|
276
277
|
f as mockChartData,
|
|
277
278
|
x as mockTableData,
|
|
278
279
|
Jt as paletteToRgbVars,
|
|
279
|
-
|
|
280
|
-
|
|
280
|
+
xm as randomRgb,
|
|
281
|
+
im as relativeLuminance,
|
|
282
|
+
Pm as resolvePreview,
|
|
281
283
|
Io as settleTo,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
+
nm as tokensToVars,
|
|
285
|
+
go as useBodyScrollLock,
|
|
284
286
|
no as useChartTheme,
|
|
285
287
|
xo as useDataFetch,
|
|
286
|
-
|
|
288
|
+
Ro as useDialogFocus,
|
|
287
289
|
ho as useIsMobile,
|
|
288
290
|
So as useMediaQuery,
|
|
289
291
|
Po as useSheetGesture,
|
|
290
292
|
M as useTheme,
|
|
291
|
-
|
|
293
|
+
Er as useToast,
|
|
292
294
|
t as wizardManifest
|
|
293
295
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { getContrastColor as S } from "./themeUtils.js";
|
|
2
|
+
function C(e, n, s) {
|
|
2
3
|
n /= 100, s /= 100;
|
|
3
|
-
const a = (t) => (t + e / 30) % 12,
|
|
4
|
+
const a = (t) => (t + e / 30) % 12, c = n * Math.min(s, 1 - s), i = (t) => s - c * Math.max(-1, Math.min(a(t) - 3, Math.min(9 - a(t), 1)));
|
|
4
5
|
return [
|
|
5
|
-
Math.round(
|
|
6
|
-
Math.round(
|
|
7
|
-
Math.round(
|
|
6
|
+
Math.round(i(0) * 255),
|
|
7
|
+
Math.round(i(8) * 255),
|
|
8
|
+
Math.round(i(4) * 255)
|
|
8
9
|
];
|
|
9
10
|
}
|
|
10
11
|
function d(e) {
|
|
11
|
-
const [n, s, a] =
|
|
12
|
+
const [n, s, a] = C(e.h, e.s, e.l);
|
|
12
13
|
return `${n} ${s} ${a}`;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function _(e) {
|
|
15
16
|
return `hsl(${e.h}, ${e.s}%, ${e.l}%)`;
|
|
16
17
|
}
|
|
17
18
|
function o(e, n, s) {
|
|
@@ -20,7 +21,7 @@ function o(e, n, s) {
|
|
|
20
21
|
function r(e, n) {
|
|
21
22
|
return Math.floor(Math.random() * (n - e + 1)) + e;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function M(e) {
|
|
24
25
|
return {
|
|
25
26
|
background: { h: e.background.h, s: o(e.background.s + 5, 0, 30), l: o(r(6, 14), 0, 100) },
|
|
26
27
|
foreground: { h: e.foreground.h, s: o(e.foreground.s, 0, 15), l: o(r(88, 96), 0, 100) },
|
|
@@ -33,7 +34,7 @@ function S(e) {
|
|
|
33
34
|
input: { h: e.background.h, s: o(e.background.s + 2, 0, 20), l: o(r(12, 20), 0, 100) }
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
const
|
|
37
|
+
const z = {
|
|
37
38
|
id: "cyberpunk",
|
|
38
39
|
name: "Cyberpunk",
|
|
39
40
|
description: "Neon-soaked digital dystopia with electric accents.",
|
|
@@ -54,7 +55,7 @@ const C = {
|
|
|
54
55
|
input: { h: 260, s: 10, l: 97 }
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
|
-
},
|
|
58
|
+
}, x = {
|
|
58
59
|
id: "nordic",
|
|
59
60
|
name: "Nordic",
|
|
60
61
|
description: "Cool, airy Scandinavian minimalism with subtle blues.",
|
|
@@ -75,7 +76,7 @@ const C = {
|
|
|
75
76
|
input: { h: e, s: 8, l: 98 }
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
|
-
},
|
|
79
|
+
}, T = {
|
|
79
80
|
id: "earthy",
|
|
80
81
|
name: "Earthy",
|
|
81
82
|
description: "Warm terracotta, forest greens, and natural tones.",
|
|
@@ -96,7 +97,7 @@ const C = {
|
|
|
96
97
|
input: { h: e, s: 10, l: 97 }
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
|
-
},
|
|
100
|
+
}, L = {
|
|
100
101
|
id: "corporate",
|
|
101
102
|
name: "Corporate High-Tech",
|
|
102
103
|
description: "Sleek, professional blues and crisp neutrals.",
|
|
@@ -117,7 +118,7 @@ const C = {
|
|
|
117
118
|
input: { h: 220, s: 6, l: 98 }
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
|
-
},
|
|
121
|
+
}, v = {
|
|
121
122
|
id: "minimalist",
|
|
122
123
|
name: "Minimalist",
|
|
123
124
|
description: "Monochrome elegance with a single accent pop.",
|
|
@@ -138,7 +139,7 @@ const C = {
|
|
|
138
139
|
input: { h: 0, s: 0, l: 99 }
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
|
-
},
|
|
142
|
+
}, I = {
|
|
142
143
|
id: "sunset",
|
|
143
144
|
name: "Sunset",
|
|
144
145
|
description: "Warm gradients from golden amber to dusky rose.",
|
|
@@ -159,7 +160,7 @@ const C = {
|
|
|
159
160
|
input: { h: e, s: 12, l: 98 }
|
|
160
161
|
};
|
|
161
162
|
}
|
|
162
|
-
},
|
|
163
|
+
}, j = {
|
|
163
164
|
id: "ocean",
|
|
164
165
|
name: "Ocean Depth",
|
|
165
166
|
description: "Deep teals, coral highlights, and aquatic mystery.",
|
|
@@ -181,14 +182,14 @@ const C = {
|
|
|
181
182
|
};
|
|
182
183
|
}
|
|
183
184
|
}, y = [
|
|
184
|
-
C,
|
|
185
185
|
z,
|
|
186
186
|
x,
|
|
187
187
|
T,
|
|
188
188
|
L,
|
|
189
189
|
v,
|
|
190
|
-
I
|
|
191
|
-
|
|
190
|
+
I,
|
|
191
|
+
j
|
|
192
|
+
], O = {
|
|
192
193
|
red: { h: 0, s: 80 },
|
|
193
194
|
crimson: { h: 348, s: 85 },
|
|
194
195
|
scarlet: { h: 10, s: 85 },
|
|
@@ -258,7 +259,7 @@ const C = {
|
|
|
258
259
|
neon: { h: 130, s: 95 },
|
|
259
260
|
electric: { h: 195, s: 95 },
|
|
260
261
|
fluorescent: { h: 100, s: 90 }
|
|
261
|
-
},
|
|
262
|
+
}, D = {
|
|
262
263
|
// Temperature
|
|
263
264
|
warm: { temperature: 0.8 },
|
|
264
265
|
hot: { temperature: 1 },
|
|
@@ -325,7 +326,7 @@ const C = {
|
|
|
325
326
|
quiet: { energy: -0.6 },
|
|
326
327
|
still: { energy: -0.7 },
|
|
327
328
|
minimal: { energy: -0.4 }
|
|
328
|
-
},
|
|
329
|
+
}, H = [
|
|
329
330
|
{ condition: (e) => e.energy > 0.5 && e.saturation > 0.3, fonts: { heading: "Orbitron", body: "Rajdhani" } },
|
|
330
331
|
{ condition: (e) => e.formality > 0.5, fonts: { heading: "Plus Jakarta Sans", body: "Inter" } },
|
|
331
332
|
{ condition: (e) => e.formality > 0.3 && e.temperature > 0, fonts: { heading: "Playfair Display", body: "Source Sans 3" } },
|
|
@@ -336,52 +337,52 @@ const C = {
|
|
|
336
337
|
{ condition: (e) => e.energy > 0.3, fonts: { heading: "Archivo Black", body: "DM Sans" } },
|
|
337
338
|
{ condition: (e) => e.brightness > 0.3, fonts: { heading: "Sora", body: "Nunito" } },
|
|
338
339
|
{ condition: (e) => e.brightness < -0.3, fonts: { heading: "Space Grotesk", body: "JetBrains Mono" } }
|
|
339
|
-
],
|
|
340
|
-
function
|
|
340
|
+
], N = { heading: "DM Sans", body: "Inter" };
|
|
341
|
+
function P(e) {
|
|
341
342
|
const n = e.toLowerCase(), s = { temperature: 0, brightness: 0, saturation: 0, formality: 0, energy: 0 };
|
|
342
343
|
let a = 0;
|
|
343
|
-
for (const [
|
|
344
|
-
if (n.includes(
|
|
345
|
-
for (const [t, h] of Object.entries(
|
|
344
|
+
for (const [c, i] of Object.entries(D))
|
|
345
|
+
if (n.includes(c)) {
|
|
346
|
+
for (const [t, h] of Object.entries(i))
|
|
346
347
|
s[t] += h;
|
|
347
348
|
a++;
|
|
348
349
|
}
|
|
349
350
|
if (a > 1)
|
|
350
|
-
for (const
|
|
351
|
-
s[
|
|
351
|
+
for (const c of Object.keys(s))
|
|
352
|
+
s[c] = o(s[c] / Math.sqrt(a), -1, 1);
|
|
352
353
|
return s;
|
|
353
354
|
}
|
|
354
355
|
function F(e) {
|
|
355
356
|
const n = e.toLowerCase(), s = [], a = /* @__PURE__ */ new Set();
|
|
356
|
-
for (const [
|
|
357
|
-
n.includes(
|
|
357
|
+
for (const [c, i] of Object.entries(O))
|
|
358
|
+
n.includes(c) && !a.has(i.h) && (s.push(i), a.add(i.h));
|
|
358
359
|
return s;
|
|
359
360
|
}
|
|
360
|
-
function
|
|
361
|
-
for (const n of
|
|
361
|
+
function $(e) {
|
|
362
|
+
for (const n of H)
|
|
362
363
|
if (n.condition(e)) return n.fonts;
|
|
363
|
-
return
|
|
364
|
+
return N;
|
|
364
365
|
}
|
|
365
|
-
function
|
|
366
|
+
function q(e, n) {
|
|
366
367
|
let s, a;
|
|
367
368
|
e.length > 0 ? (s = e[0].h, a = e[0].s) : (s = n.temperature > 0 ? r(0, 40) + Math.round(n.temperature * 20) : r(180, 260) + Math.round(n.temperature * 20), a = 65 + Math.round(n.saturation * 20));
|
|
368
|
-
let
|
|
369
|
+
let c, i;
|
|
369
370
|
if (e.length > 1)
|
|
370
|
-
|
|
371
|
+
c = e[1].h, i = e[1].s;
|
|
371
372
|
else {
|
|
372
|
-
const
|
|
373
|
-
|
|
373
|
+
const w = n.formality > 0 ? r(25, 45) : r(100, 140);
|
|
374
|
+
c = (s + w) % 360, i = o(a - 10 + r(-5, 5), 30, 90);
|
|
374
375
|
}
|
|
375
376
|
let t, h;
|
|
376
377
|
e.length > 2 ? (t = e[2].h, h = e[2].s) : (t = (s + 150 + r(-20, 20)) % 360, h = o(a + 10 + r(-5, 5), 40, 95));
|
|
377
378
|
const g = Math.round(n.saturation * 15);
|
|
378
|
-
a = o(a + g, 25, 100),
|
|
379
|
+
a = o(a + g, 25, 100), i = o(i + g, 20, 95), h = o(h + g, 25, 100);
|
|
379
380
|
const m = 52 + Math.round(n.brightness * 8), p = 50 + Math.round(n.brightness * 6), k = 54 + Math.round(n.brightness * 6), l = s, u = o(5 + Math.round(Math.abs(n.saturation) * 10), 0, 25), b = n.brightness > 0 ? r(97, 99) : r(94, 97);
|
|
380
381
|
return {
|
|
381
382
|
background: { h: l, s: u, l: b },
|
|
382
383
|
foreground: { h: l, s: o(u + 10, 0, 25), l: r(8, 15) },
|
|
383
384
|
primary: { h: s, s: a, l: o(m + r(-3, 3), 35, 65) },
|
|
384
|
-
secondary: { h:
|
|
385
|
+
secondary: { h: c, s: i, l: o(p + r(-3, 3), 35, 65) },
|
|
385
386
|
accent: { h: t, s: h, l: o(k + r(-3, 3), 40, 68) },
|
|
386
387
|
muted: { h: l, s: o(u + 3, 0, 15), l: r(91, 94) },
|
|
387
388
|
border: { h: l, s: o(u + 2, 0, 18), l: r(84, 88) },
|
|
@@ -389,37 +390,37 @@ function $(e, n) {
|
|
|
389
390
|
input: { h: l, s: o(u - 3, 0, 10), l: r(97, 99) }
|
|
390
391
|
};
|
|
391
392
|
}
|
|
392
|
-
function
|
|
393
|
+
function E(e) {
|
|
393
394
|
let n = 0;
|
|
394
395
|
for (let s = 0; s < e.length; s++)
|
|
395
396
|
n = e.charCodeAt(s) + ((n << 5) - n);
|
|
396
397
|
return (n % 360 + 360) % 360;
|
|
397
398
|
}
|
|
398
|
-
function
|
|
399
|
-
const n =
|
|
399
|
+
function W(e) {
|
|
400
|
+
const n = P(e), s = F(e);
|
|
400
401
|
if (s.length === 0) {
|
|
401
|
-
const f =
|
|
402
|
+
const f = E(e);
|
|
402
403
|
s.push({ h: f, s: 65 + r(-10, 10) });
|
|
403
404
|
}
|
|
404
|
-
const a =
|
|
405
|
+
const a = q(s, n), c = M(a), i = $(n), t = e.toLowerCase();
|
|
405
406
|
let h = "0.5rem";
|
|
406
407
|
t.includes("sharp") || t.includes("square") || t.includes("block") || t.includes("strict") ? h = "0rem" : t.includes("round") || t.includes("soft") || t.includes("friendly") || t.includes("bubble") ? h = "1rem" : (t.includes("pill") || t.includes("capsule")) && (h = "2rem");
|
|
407
408
|
let g = "1rem";
|
|
408
409
|
t.includes("large text") || t.includes("big text") || t.includes("accessible") || t.includes("grand") ? g = "1.125rem" : (t.includes("small text") || t.includes("compact") || t.includes("dense")) && (g = "0.875rem");
|
|
409
|
-
const m = F(e), p = m.length > 0 ? Object.entries(
|
|
410
|
+
const m = F(e), p = m.length > 0 ? Object.entries(O).filter(([, f]) => m.some((R) => R.h === f.h)).map(([f]) => f.charAt(0).toUpperCase() + f.slice(1)).slice(0, 3).join(" + ") : null, k = n.temperature > 0.3 ? "Warm" : n.temperature < -0.3 ? "Cool" : "", l = n.saturation > 0.3 ? "Vibrant" : n.saturation < -0.3 ? "Soft" : "", u = [k, l].filter(Boolean).join(" "), b = p || e.slice(0, 30);
|
|
410
411
|
return {
|
|
411
412
|
name: (u ? `${u} ${b}` : b) || "Custom Theme",
|
|
412
413
|
description: `Custom palette generated from: "${e}"`,
|
|
413
414
|
profileId: "custom",
|
|
414
|
-
fonts:
|
|
415
|
+
fonts: i,
|
|
415
416
|
borderRadius: h,
|
|
416
417
|
baseFontSize: g,
|
|
417
418
|
light: a,
|
|
418
|
-
dark:
|
|
419
|
+
dark: c
|
|
419
420
|
};
|
|
420
421
|
}
|
|
421
|
-
function
|
|
422
|
-
const n = y.find((
|
|
422
|
+
function B(e) {
|
|
423
|
+
const n = y.find((c) => c.id === e) || y[0], s = n.generate(), a = M(s);
|
|
423
424
|
return {
|
|
424
425
|
name: n.name,
|
|
425
426
|
description: n.description,
|
|
@@ -431,8 +432,8 @@ function _(e) {
|
|
|
431
432
|
dark: a
|
|
432
433
|
};
|
|
433
434
|
}
|
|
434
|
-
function
|
|
435
|
-
const e = y[r(0, y.length - 1)], n = e.generate(), s =
|
|
435
|
+
function G() {
|
|
436
|
+
const e = y[r(0, y.length - 1)], n = e.generate(), s = M(n);
|
|
436
437
|
return {
|
|
437
438
|
name: e.name,
|
|
438
439
|
description: e.description,
|
|
@@ -444,15 +445,15 @@ function W() {
|
|
|
444
445
|
dark: s
|
|
445
446
|
};
|
|
446
447
|
}
|
|
447
|
-
function
|
|
448
|
-
const n = e.primary
|
|
448
|
+
function J(e) {
|
|
449
|
+
const n = d(e.primary), s = d(e.secondary), a = d(e.accent);
|
|
449
450
|
return {
|
|
450
|
-
"--app-primary-color":
|
|
451
|
-
"--app-primary-foreground-color": n,
|
|
452
|
-
"--app-secondary-color":
|
|
453
|
-
"--app-secondary-foreground-color": s,
|
|
454
|
-
"--app-accent-color":
|
|
455
|
-
"--app-accent-foreground-color": a,
|
|
451
|
+
"--app-primary-color": n,
|
|
452
|
+
"--app-primary-foreground-color": S(n),
|
|
453
|
+
"--app-secondary-color": s,
|
|
454
|
+
"--app-secondary-foreground-color": S(s),
|
|
455
|
+
"--app-accent-color": a,
|
|
456
|
+
"--app-accent-foreground-color": S(a),
|
|
456
457
|
// Core Intent Primitives
|
|
457
458
|
"--app-bg-color": d(e.background),
|
|
458
459
|
"--app-card-bg-color": d(e.card),
|
|
@@ -461,17 +462,17 @@ function B(e) {
|
|
|
461
462
|
"--app-muted-bg": d(e.muted),
|
|
462
463
|
"--app-muted-text": d({ ...e.foreground, l: e.foreground.l > 50 ? e.foreground.l - 25 : e.foreground.l + 25 }),
|
|
463
464
|
"--app-surface-hover": d({ ...e.background, l: e.background.l > 50 ? e.background.l - 5 : e.background.l + 5 }),
|
|
464
|
-
"--app-chart-1":
|
|
465
|
+
"--app-chart-1": n
|
|
465
466
|
};
|
|
466
467
|
}
|
|
467
468
|
export {
|
|
468
469
|
y as AESTHETIC_PROFILES,
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
470
|
+
B as generateFromProfile,
|
|
471
|
+
W as generateFromPrompt,
|
|
472
|
+
G as generateRandom,
|
|
473
|
+
_ as hslToCssString,
|
|
474
|
+
C as hslToRgb,
|
|
474
475
|
d as hslToRgbString,
|
|
475
|
-
|
|
476
|
-
|
|
476
|
+
M as lightToDark,
|
|
477
|
+
J as paletteToRgbVars
|
|
477
478
|
};
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { DEFAULT_THEME_TOKENS } from '@ramme-io/shared';
|
|
2
|
+
/** WCAG 2.1 relative luminance of a space-separated RGB triplet. */
|
|
3
|
+
export declare const relativeLuminance: (rgb: string) => number;
|
|
4
|
+
/** WCAG 2.1 contrast ratio between two RGB triplets, 1 to 21. */
|
|
5
|
+
export declare const contrastRatio: (a: string, b: string) => number;
|
|
2
6
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
7
|
+
* The label colour for text on `bgRgb`: white or deep navy, whichever reads
|
|
8
|
+
* better, and pure black when neither reaches 4.5:1.
|
|
9
|
+
*
|
|
10
|
+
* It used to compare a luminance with no gamma correction against 0.45, and
|
|
11
|
+
* the Theme Lab's generator picked by an HSL lightness of 55. Both put white
|
|
12
|
+
* on mid-tone fills: generated themes shipped button labels at 1.25:1.
|
|
13
|
+
* Navy and white both fall short on a fill near 0.2 luminance (at best
|
|
14
|
+
* 4.22:1), which black clears (at least 4.58:1).
|
|
5
15
|
*/
|
|
6
|
-
export declare const getContrastColor: (bgRgb: string) =>
|
|
16
|
+
export declare const getContrastColor: (bgRgb: string) => string;
|
|
7
17
|
export declare const applyThemeToDom: (vars: Record<string, string>, target?: HTMLElement) => void;
|
|
8
18
|
/**
|
|
9
19
|
* Every variable `applyThemeToDom` can write that its caller did not name:
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import { DEFAULT_THEME_TOKENS as g } from "@ramme-io/shared";
|
|
2
|
-
const m = (
|
|
3
|
-
if (!
|
|
4
|
-
const a =
|
|
5
|
-
if (a.length !== 3) return
|
|
6
|
-
const
|
|
7
|
-
return `${
|
|
8
|
-
}, h = (
|
|
9
|
-
const
|
|
10
|
-
return
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
2
|
+
const m = (r, p) => {
|
|
3
|
+
if (!r) return "128 128 128";
|
|
4
|
+
const a = r.split(" ").map(Number);
|
|
5
|
+
if (a.length !== 3) return r;
|
|
6
|
+
const o = (t) => Math.max(0, Math.min(255, t));
|
|
7
|
+
return `${o(a[0] + p)} ${o(a[1] + p)} ${o(a[2] + p)}`;
|
|
8
|
+
}, h = (r) => {
|
|
9
|
+
const p = r / 255;
|
|
10
|
+
return p <= 0.03928 ? p / 12.92 : ((p + 0.055) / 1.055) ** 2.4;
|
|
11
|
+
}, f = (r) => {
|
|
12
|
+
const [p, a, o] = r.split(" ").map(Number);
|
|
13
|
+
return 0.2126 * h(p) + 0.7152 * h(a) + 0.0722 * h(o);
|
|
14
|
+
}, u = (r, p) => {
|
|
15
|
+
const [a, o] = [f(r), f(p)].sort((t, l) => l - t);
|
|
16
|
+
return (a + 0.05) / (o + 0.05);
|
|
17
|
+
}, b = ["255 255 255", "15 23 42"], y = (r) => {
|
|
18
|
+
const p = b.reduce((a, o) => u(o, r) > u(a, r) ? o : a);
|
|
19
|
+
return u(p, r) >= 4.5 ? p : "0 0 0";
|
|
20
|
+
}, M = (r, p) => {
|
|
21
|
+
if (!r || typeof r != "object") return;
|
|
22
|
+
const a = p || document.documentElement, o = { ...r }, t = o["--app-primary-color"];
|
|
23
|
+
t && (o["--app-primary-foreground-color"] = y(t));
|
|
24
|
+
const l = o["--app-bg-color"];
|
|
25
|
+
l && (o["--app-text-color"] = y(l)), Object.entries({
|
|
17
26
|
"--primary": "--app-primary-color",
|
|
18
27
|
"--bg": "--app-bg-color",
|
|
19
28
|
"--text": "--app-text-color",
|
|
@@ -22,23 +31,23 @@ const m = (o, p) => {
|
|
|
22
31
|
"--secondary": "--app-secondary-color",
|
|
23
32
|
"--accent": "--app-accent-color"
|
|
24
33
|
}).forEach(([s, n]) => {
|
|
25
|
-
|
|
34
|
+
r[s] && !r[n] && (o[n] = r[s]);
|
|
26
35
|
});
|
|
27
|
-
const e =
|
|
28
|
-
e && (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
const e = o["--app-chart-1"] || o["--app-primary-color"];
|
|
37
|
+
e && (o["--app-chart-1"] || (o["--app-chart-1"] = e), o["--app-chart-2"] || (o["--app-chart-2"] = m(e, 30)), o["--app-chart-3"] || (o["--app-chart-3"] = m(e, -30)), o["--app-chart-4"] || (o["--app-chart-4"] = m(e, 60)), o["--app-chart-5"] || (o["--app-chart-5"] = m(e, -60)), o["--app-chart-palette"] = [
|
|
38
|
+
o["--app-chart-1"],
|
|
39
|
+
o["--app-chart-2"],
|
|
40
|
+
o["--app-chart-3"],
|
|
41
|
+
o["--app-chart-4"],
|
|
42
|
+
o["--app-chart-5"]
|
|
34
43
|
].join(", "));
|
|
35
44
|
const d = (s, n) => {
|
|
36
|
-
!
|
|
45
|
+
!o[s] && o[n] && (o[s] = o[n]);
|
|
37
46
|
};
|
|
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(
|
|
47
|
+
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(o).forEach(([s, n]) => {
|
|
39
48
|
s.startsWith("--app-") && typeof n == "string" && n !== "" && a.style.setProperty(s, n);
|
|
40
49
|
});
|
|
41
|
-
},
|
|
50
|
+
}, T = [
|
|
42
51
|
"--app-primary-foreground-color",
|
|
43
52
|
"--app-text-color",
|
|
44
53
|
"--app-bg-color",
|
|
@@ -55,66 +64,68 @@ const m = (o, p) => {
|
|
|
55
64
|
"--app-chart-4",
|
|
56
65
|
"--app-chart-5",
|
|
57
66
|
"--app-chart-palette"
|
|
58
|
-
],
|
|
59
|
-
const a = document.head,
|
|
67
|
+
], x = (r, p) => {
|
|
68
|
+
const a = document.head, o = "dynamic-google-fonts", t = document.getElementById(o);
|
|
60
69
|
t && a.removeChild(t);
|
|
61
|
-
const
|
|
62
|
-
|
|
70
|
+
const l = `${r.replace(/ /g, "+")}:wght@400;700&family=${p.replace(/ /g, "+")}:wght@400;500;700`, i = document.createElement("link");
|
|
71
|
+
i.id = o, i.rel = "stylesheet", i.crossOrigin = "anonymous", i.href = `https://fonts.googleapis.com/css2?family=${l}&display=swap`, a.insertBefore(i, a.firstChild);
|
|
63
72
|
const e = document.documentElement;
|
|
64
|
-
e.style.setProperty("--app-font-sans", `"${p}", sans-serif`), e.style.setProperty("--app-font-serif", `"${
|
|
65
|
-
},
|
|
66
|
-
const p =
|
|
67
|
-
return `${a} ${
|
|
68
|
-
},
|
|
73
|
+
e.style.setProperty("--app-font-sans", `"${p}", sans-serif`), e.style.setProperty("--app-font-serif", `"${r}", serif`), console.log(`[FontEngine] Applied: ${r} (H) / ${p} (B)`);
|
|
74
|
+
}, R = (r) => {
|
|
75
|
+
const p = r.replace("#", ""), a = parseInt(p.substring(0, 2), 16), o = parseInt(p.substring(2, 4), 16), t = parseInt(p.substring(4, 6), 16);
|
|
76
|
+
return `${a} ${o} ${t}`;
|
|
77
|
+
}, E = {
|
|
69
78
|
none: "0",
|
|
70
79
|
sm: "0.25rem",
|
|
71
80
|
md: "0.375rem",
|
|
72
81
|
lg: "0.5rem",
|
|
73
82
|
full: "9999px"
|
|
74
|
-
},
|
|
83
|
+
}, I = [
|
|
75
84
|
"--app-primary-color",
|
|
76
85
|
"--app-secondary-color",
|
|
77
86
|
"--app-success-color",
|
|
78
87
|
"--app-warning-color",
|
|
79
88
|
"--app-danger-color",
|
|
80
89
|
"--app-border-radius-md"
|
|
81
|
-
],
|
|
82
|
-
"--app-primary-color":
|
|
83
|
-
"--app-secondary-color":
|
|
84
|
-
"--app-success-color":
|
|
85
|
-
"--app-warning-color":
|
|
90
|
+
], _ = (r) => r ? Object.keys(g).some((p) => r[p] !== void 0 && r[p] !== g[p]) : !1, A = (r) => ({
|
|
91
|
+
"--app-primary-color": r.primary ?? "13 110 253",
|
|
92
|
+
"--app-secondary-color": r.neutral ?? "24 24 27",
|
|
93
|
+
"--app-success-color": r.success ?? "34 197 94",
|
|
94
|
+
"--app-warning-color": r.warning ?? "234 179 8",
|
|
86
95
|
// NOT `--app-destructive-color`, which this wrote until now: that variable
|
|
87
96
|
// is defined nowhere in index.css and read by nothing, so the Destructive
|
|
88
97
|
// swatch in ThemeLab changed a value no stylesheet consumed. The token the
|
|
89
98
|
// preset actually maps `destructive` on to is `--app-danger-color`.
|
|
90
|
-
"--app-danger-color":
|
|
91
|
-
"--app-border-radius-md":
|
|
92
|
-
}), c = (
|
|
93
|
-
const a = Math.floor(Math.random() * (p -
|
|
94
|
-
return `${a} ${
|
|
95
|
-
},
|
|
96
|
-
const
|
|
99
|
+
"--app-danger-color": r.destructive ?? "239 68 68",
|
|
100
|
+
"--app-border-radius-md": E[r.radius ?? "md"] ?? "0.375rem"
|
|
101
|
+
}), c = (r = 0, p = 255) => {
|
|
102
|
+
const a = Math.floor(Math.random() * (p - r) + r), o = Math.floor(Math.random() * (p - r) + r), t = Math.floor(Math.random() * (p - r) + r);
|
|
103
|
+
return `${a} ${o} ${t}`;
|
|
104
|
+
}, w = () => {
|
|
105
|
+
const r = Math.random() > 0.5, p = r ? c(10, 40) : c(240, 255), a = r ? c(220, 255) : c(20, 60), o = c(50, 200);
|
|
97
106
|
return {
|
|
98
|
-
"--app-primary-color":
|
|
99
|
-
"--app-primary-foreground-color":
|
|
107
|
+
"--app-primary-color": o,
|
|
108
|
+
"--app-primary-foreground-color": r ? "0 0 0" : "255 255 255",
|
|
100
109
|
"--app-bg-color": p,
|
|
101
110
|
"--app-text-color": a,
|
|
102
|
-
"--app-card-bg-color":
|
|
103
|
-
"--app-border-color":
|
|
104
|
-
"--app-muted-bg":
|
|
111
|
+
"--app-card-bg-color": r ? c(30, 60) : "255 255 255",
|
|
112
|
+
"--app-border-color": r ? c(60, 90) : c(200, 220),
|
|
113
|
+
"--app-muted-bg": r ? c(40, 70) : c(230, 245),
|
|
105
114
|
"--app-border-radius-md": `${(Math.random() * 1).toFixed(2)}rem`,
|
|
106
|
-
"--app-chart-1":
|
|
115
|
+
"--app-chart-1": o
|
|
107
116
|
};
|
|
108
117
|
};
|
|
109
118
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
T as DERIVED_THEME_VARS,
|
|
120
|
+
I as THEME_TOKEN_VARS,
|
|
121
|
+
M as applyThemeToDom,
|
|
122
|
+
u as contrastRatio,
|
|
123
|
+
w as generateRandomTheme,
|
|
124
|
+
y as getContrastColor,
|
|
125
|
+
R as hexToRgbTriplet,
|
|
126
|
+
_ as isCustomTheme,
|
|
127
|
+
x as loadGoogleFont,
|
|
118
128
|
c as randomRgb,
|
|
119
|
-
|
|
129
|
+
f as relativeLuminance,
|
|
130
|
+
A as tokensToVars
|
|
120
131
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramme-io/ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.2",
|
|
4
4
|
"description": "The structural component library for the Ramme Framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"tailwind-merge": "^3.3.1",
|
|
59
59
|
"tippy.js": "^6.3.7",
|
|
60
60
|
"zod": "^3.23.8",
|
|
61
|
-
"@ramme-io/shared": "4.
|
|
61
|
+
"@ramme-io/shared": "4.8.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@storybook/addon-links": "^10.5.9",
|