@fleetbridge/ui 0.0.0-stage → 1.0.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/theme.d.ts ADDED
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Theming. Every colour the UI paints comes from a CSS custom property, so a
3
+ * host restyles it without touching the package:
4
+ *
5
+ * - The base palette (shadcn names): --primary, --primary-foreground,
6
+ * --accent, --background, --foreground, --muted, --border, --ring, --radius…
7
+ * - The font: --fb-font-sans.
8
+ * - Per-surface tokens (--fb-search-*, --fb-listing-*, --fb-car-*,
9
+ * --fb-filter-*, --fb-wizard-*), which default to the base palette - see
10
+ * styles/public-tokens.css for the full list.
11
+ *
12
+ * `FleetBridgeTheme` is a typed shortcut for the common ones, `colors` sets any
13
+ * element's own colour by name, and anything else goes in `vars`. Pass it to <FleetBridgeProvider theme={…}>, or print
14
+ * themeToCss(theme) in a <style> tag (best for server-rendered pages), or set
15
+ * the properties in your own stylesheet.
16
+ */
17
+ /**
18
+ * Every colour a site owner can set, one per surface token - the same keys
19
+ * and custom properties as the WordPress plugin's Theme tab
20
+ * (ThemeController::COLOR_FIELDS / ShortcodeController::COLOR_VARS), so a
21
+ * theme saved there or in another host's settings maps one-to-one.
22
+ */
23
+ declare const THEME_COLOR_VARS: {
24
+ readonly primary: "--primary";
25
+ readonly primaryForeground: "--primary-foreground";
26
+ readonly background: "--background";
27
+ readonly card: "--card";
28
+ readonly cardForeground: "--card-foreground";
29
+ readonly border: "--border";
30
+ readonly foreground: "--foreground";
31
+ readonly mutedForeground: "--muted-foreground";
32
+ readonly muted: "--muted";
33
+ readonly input: "--input";
34
+ readonly secondary: "--secondary";
35
+ readonly secondaryForeground: "--secondary-foreground";
36
+ readonly searchSurface: "--fb-search-surface";
37
+ readonly searchBorder: "--fb-search-border";
38
+ readonly searchField: "--fb-search-field";
39
+ readonly searchLabel: "--fb-search-label";
40
+ readonly searchValue: "--fb-search-value";
41
+ readonly searchButton: "--fb-search-button";
42
+ readonly searchButtonFg: "--fb-search-button-fg";
43
+ readonly searchToggle: "--fb-search-toggle";
44
+ readonly searchToggleFg: "--fb-search-toggle-fg";
45
+ readonly listingBar: "--fb-listing-bar";
46
+ readonly listingBorder: "--fb-listing-border";
47
+ readonly listingText: "--fb-listing-text";
48
+ readonly listingMuted: "--fb-listing-muted";
49
+ readonly listingModifyBg: "--fb-listing-modify";
50
+ readonly listingModifyBorder: "--fb-listing-modify-border";
51
+ readonly listingChip: "--fb-listing-chip";
52
+ readonly listingChipFg: "--fb-listing-chip-fg";
53
+ readonly listingSidebar: "--fb-listing-sidebar";
54
+ readonly carBg: "--fb-car-bg";
55
+ readonly carBorder: "--fb-car-border";
56
+ readonly carBorderHover: "--fb-car-border-hover";
57
+ readonly carTitle: "--fb-car-title";
58
+ readonly carMuted: "--fb-car-muted";
59
+ readonly carPhoto: "--fb-car-photo";
60
+ readonly carPrice: "--fb-car-price";
61
+ readonly carCta: "--fb-car-cta";
62
+ readonly carCtaFg: "--fb-car-cta-fg";
63
+ readonly carQuoteBorder: "--fb-car-quote-border";
64
+ readonly carBadge: "--fb-car-badge";
65
+ readonly carBadgeFg: "--fb-car-badge-fg";
66
+ readonly carInsured: "--fb-car-insured";
67
+ readonly carInsuredFg: "--fb-car-insured-fg";
68
+ readonly carOption: "--fb-car-option";
69
+ readonly carOptionFg: "--fb-car-option-fg";
70
+ readonly filterTitle: "--fb-filter-title";
71
+ readonly filterMuted: "--fb-filter-muted";
72
+ readonly filterPill: "--fb-filter-pill";
73
+ readonly filterPillFg: "--fb-filter-pill-fg";
74
+ readonly filterPillActive: "--fb-filter-pill-active";
75
+ readonly filterPillActiveFg: "--fb-filter-pill-active-fg";
76
+ readonly filterBar: "--fb-filter-bar";
77
+ readonly surface2: "--fb-surface-2";
78
+ readonly borderStrong: "--fb-border-strong";
79
+ readonly ring: "--ring";
80
+ readonly destructive: "--destructive";
81
+ };
82
+ type ThemeColorKey = keyof typeof THEME_COLOR_VARS;
83
+ interface FleetBridgeTheme {
84
+ /** The main brand colour: search button, selected states, CTAs. */
85
+ primary?: string;
86
+ primaryForeground?: string;
87
+ /** The highlight colour: the "Book"/"View deal" buttons and filter bars. */
88
+ accent?: string;
89
+ accentForeground?: string;
90
+ background?: string;
91
+ foreground?: string;
92
+ /** Field backgrounds and quiet surfaces. */
93
+ muted?: string;
94
+ mutedForeground?: string;
95
+ border?: string;
96
+ ring?: string;
97
+ /** Corner radius, e.g. "12px" or "0.75rem". */
98
+ radius?: string;
99
+ /** Font stack, e.g. "Inter, system-ui, sans-serif". The host page loads the font. */
100
+ fontFamily?: string;
101
+ /**
102
+ * Per-element colours (search form, results bar, car cards, filters,
103
+ * wizard…), keyed as on the WordPress Theme tab. Set ones win over the
104
+ * shortcuts above; unset ones follow them.
105
+ */
106
+ colors?: Partial<Record<ThemeColorKey, string>>;
107
+ /** Any other custom property, e.g. { '--fb-wizard-selected': '#153673' }. */
108
+ vars?: Record<string, string>;
109
+ }
110
+ declare function themeToVars(theme: FleetBridgeTheme): Record<string, string>;
111
+ /** The theme as a `:root { … }` rule, for a server-rendered <style> tag. */
112
+ declare function themeToCss(theme: FleetBridgeTheme, selector?: string): string;
113
+
114
+ /**
115
+ * The colours a site owner can change, grouped and worded for a settings
116
+ * screen: the WordPress plugin's Theme tab and any other host's (e.g. the
117
+ * Carhire Studio's Booking look → Colours) use the same list, so a theme
118
+ * means the same thing everywhere. Plain data, importing nothing but
119
+ * ../theme (which imports nothing), so a host's server can bundle it without
120
+ * the React components.
121
+ *
122
+ * Store only the colours that were changed ({colors, radius}, see
123
+ * BookingTheme) and pass them as `FleetBridgeTheme.colors` / `radius`.
124
+ */
125
+
126
+ declare const THEME_KEYS: ThemeColorKey[];
127
+ /** FleetBridge's own starting colours, for anything neither the brand nor its parent token sets. */
128
+ declare const FLEETBRIDGE_DEFAULTS: Record<ThemeColorKey, string>;
129
+ /** A part's colours follow this token until they are changed (FleetBridge's CSS fallbacks). */
130
+ declare const THEME_INHERIT: Partial<Record<ThemeColorKey, ThemeColorKey>>;
131
+ type ThemeField = {
132
+ key: ThemeColorKey;
133
+ label: string;
134
+ hint?: string;
135
+ };
136
+ type ThemeSection = {
137
+ title: string;
138
+ fields: ThemeField[];
139
+ };
140
+ type ThemeGroup = {
141
+ id: 'brand' | 'search' | 'listing' | 'filters' | 'card';
142
+ title: string; /** A Remix icon class, for hosts that use Remix icons. */
143
+ icon: string;
144
+ description: string;
145
+ sections: ThemeSection[];
146
+ };
147
+ /** The Theme tab's groups, in its order and wording. `icon` is a Remix icon class for the Studio. */
148
+ declare const THEME_GROUPS: ThemeGroup[];
149
+ /** One-click brand colours for a settings screen. */
150
+ declare const THEME_PRESETS: {
151
+ name: string;
152
+ primary: string;
153
+ primaryForeground: string;
154
+ }[];
155
+ /** Corner radius choices in px (the Theme tab allows 0–40px). */
156
+ declare const THEME_RADII: number[];
157
+ type BookingTheme = {
158
+ colors?: Partial<Record<ThemeColorKey, string>> | null;
159
+ radius?: number | null;
160
+ };
161
+ declare const isHex: (v: unknown) => v is string;
162
+ /** A stored or posted theme with anything unknown or malformed dropped. */
163
+ declare function cleanBookingTheme(raw: unknown): BookingTheme;
164
+ /**
165
+ * What each colour shows as when it has not been changed: the site's brand
166
+ * values (`base`), else the token it follows, else FleetBridge's default.
167
+ */
168
+ declare function effectiveColors(base: Partial<Record<ThemeColorKey, string>>, overrides?: Partial<Record<ThemeColorKey, string>>): Record<ThemeColorKey, string>;
169
+
170
+ export { type BookingTheme, FLEETBRIDGE_DEFAULTS, type FleetBridgeTheme, THEME_COLOR_VARS, THEME_GROUPS, THEME_INHERIT, THEME_KEYS, THEME_PRESETS, THEME_RADII, type ThemeColorKey, type ThemeField, type ThemeGroup, type ThemeSection, cleanBookingTheme, effectiveColors, isHex, themeToCss, themeToVars };
package/theme.js ADDED
@@ -0,0 +1,336 @@
1
+ // src/theme.ts
2
+ var THEME_COLOR_VARS = {
3
+ primary: "--primary",
4
+ primaryForeground: "--primary-foreground",
5
+ background: "--background",
6
+ card: "--card",
7
+ cardForeground: "--card-foreground",
8
+ border: "--border",
9
+ foreground: "--foreground",
10
+ mutedForeground: "--muted-foreground",
11
+ muted: "--muted",
12
+ input: "--input",
13
+ secondary: "--secondary",
14
+ secondaryForeground: "--secondary-foreground",
15
+ searchSurface: "--fb-search-surface",
16
+ searchBorder: "--fb-search-border",
17
+ searchField: "--fb-search-field",
18
+ searchLabel: "--fb-search-label",
19
+ searchValue: "--fb-search-value",
20
+ searchButton: "--fb-search-button",
21
+ searchButtonFg: "--fb-search-button-fg",
22
+ searchToggle: "--fb-search-toggle",
23
+ searchToggleFg: "--fb-search-toggle-fg",
24
+ listingBar: "--fb-listing-bar",
25
+ listingBorder: "--fb-listing-border",
26
+ listingText: "--fb-listing-text",
27
+ listingMuted: "--fb-listing-muted",
28
+ listingModifyBg: "--fb-listing-modify",
29
+ listingModifyBorder: "--fb-listing-modify-border",
30
+ listingChip: "--fb-listing-chip",
31
+ listingChipFg: "--fb-listing-chip-fg",
32
+ listingSidebar: "--fb-listing-sidebar",
33
+ carBg: "--fb-car-bg",
34
+ carBorder: "--fb-car-border",
35
+ carBorderHover: "--fb-car-border-hover",
36
+ carTitle: "--fb-car-title",
37
+ carMuted: "--fb-car-muted",
38
+ carPhoto: "--fb-car-photo",
39
+ carPrice: "--fb-car-price",
40
+ carCta: "--fb-car-cta",
41
+ carCtaFg: "--fb-car-cta-fg",
42
+ carQuoteBorder: "--fb-car-quote-border",
43
+ carBadge: "--fb-car-badge",
44
+ carBadgeFg: "--fb-car-badge-fg",
45
+ carInsured: "--fb-car-insured",
46
+ carInsuredFg: "--fb-car-insured-fg",
47
+ carOption: "--fb-car-option",
48
+ carOptionFg: "--fb-car-option-fg",
49
+ filterTitle: "--fb-filter-title",
50
+ filterMuted: "--fb-filter-muted",
51
+ filterPill: "--fb-filter-pill",
52
+ filterPillFg: "--fb-filter-pill-fg",
53
+ filterPillActive: "--fb-filter-pill-active",
54
+ filterPillActiveFg: "--fb-filter-pill-active-fg",
55
+ filterBar: "--fb-filter-bar",
56
+ surface2: "--fb-surface-2",
57
+ borderStrong: "--fb-border-strong",
58
+ ring: "--ring",
59
+ destructive: "--destructive"
60
+ };
61
+ function themeToVars(theme) {
62
+ const vars = {};
63
+ const set = (key, value) => {
64
+ if (value) vars[key] = value;
65
+ };
66
+ set("--primary", theme.primary);
67
+ set("--primary-foreground", theme.primaryForeground);
68
+ set("--ring", theme.ring ?? theme.primary);
69
+ set("--accent", theme.accent);
70
+ set("--accent-foreground", theme.accentForeground);
71
+ set("--background", theme.background);
72
+ set("--card", theme.background);
73
+ set("--popover", theme.background);
74
+ set("--foreground", theme.foreground);
75
+ set("--card-foreground", theme.foreground);
76
+ set("--popover-foreground", theme.foreground);
77
+ set("--muted", theme.muted);
78
+ set("--secondary", theme.muted);
79
+ set("--muted-foreground", theme.mutedForeground);
80
+ set("--border", theme.border);
81
+ set("--input", theme.border);
82
+ set("--radius", theme.radius);
83
+ set("--fb-font-sans", theme.fontFamily);
84
+ if (theme.accent) {
85
+ set("--fb-car-cta", theme.accent);
86
+ set("--fb-car-cta-fg", theme.accentForeground ?? theme.foreground);
87
+ }
88
+ for (const [key, value] of Object.entries(theme.colors ?? {})) {
89
+ const cssVar = THEME_COLOR_VARS[key];
90
+ if (cssVar) set(cssVar, value);
91
+ }
92
+ return { ...vars, ...theme.vars };
93
+ }
94
+ function themeToCss(theme, selector = ":root") {
95
+ const body = Object.entries(themeToVars(theme)).map(([key, value]) => `${key}:${value};`).join("");
96
+ return `${selector}{${body}}`;
97
+ }
98
+
99
+ // src/lib/theme.fields.ts
100
+ var THEME_KEYS = Object.keys(THEME_COLOR_VARS);
101
+ var FLEETBRIDGE_DEFAULTS = {
102
+ primary: "#171717",
103
+ primaryForeground: "#fafafa",
104
+ background: "#ffffff",
105
+ card: "#ffffff",
106
+ cardForeground: "#0a0a0a",
107
+ border: "#e5e5e5",
108
+ foreground: "#0a0a0a",
109
+ mutedForeground: "#737373",
110
+ muted: "#f5f5f5",
111
+ input: "#e5e5e5",
112
+ secondary: "#f5f5f5",
113
+ secondaryForeground: "#171717",
114
+ searchSurface: "#ffffff",
115
+ searchBorder: "#e5e5e5",
116
+ searchField: "#f5f5f5",
117
+ searchLabel: "#737373",
118
+ searchValue: "#0a0a0a",
119
+ searchButton: "#171717",
120
+ searchButtonFg: "#fafafa",
121
+ searchToggle: "#0a0a0a",
122
+ searchToggleFg: "#fafafa",
123
+ listingBar: "#ffffff",
124
+ listingBorder: "#e5e5e5",
125
+ listingText: "#0a0a0a",
126
+ listingMuted: "#737373",
127
+ listingModifyBg: "#ffffff",
128
+ listingModifyBorder: "#e5e5e5",
129
+ listingChip: "#f5f5f5",
130
+ listingChipFg: "#0a0a0a",
131
+ listingSidebar: "#ffffff",
132
+ carBg: "#ffffff",
133
+ carBorder: "#e5e5e5",
134
+ carBorderHover: "#d4d4d4",
135
+ carTitle: "#0a0a0a",
136
+ carMuted: "#737373",
137
+ carPhoto: "#f5f5f5",
138
+ carPrice: "#0a0a0a",
139
+ carCta: "#171717",
140
+ carCtaFg: "#fafafa",
141
+ carQuoteBorder: "#d4d4d4",
142
+ carBadge: "#0a0a0a",
143
+ carBadgeFg: "#fafafa",
144
+ carInsured: "#d1fae5",
145
+ carInsuredFg: "#047857",
146
+ carOption: "#171717",
147
+ carOptionFg: "#fafafa",
148
+ filterTitle: "#0a0a0a",
149
+ filterMuted: "#737373",
150
+ filterPill: "#f5f5f5",
151
+ filterPillFg: "#737373",
152
+ filterPillActive: "#171717",
153
+ filterPillActiveFg: "#fafafa",
154
+ filterBar: "#171717",
155
+ surface2: "#f5f5f5",
156
+ borderStrong: "#d4d4d4",
157
+ ring: "#a3a3a3",
158
+ destructive: "#dc2626"
159
+ };
160
+ var THEME_INHERIT = {
161
+ card: "background",
162
+ cardForeground: "foreground",
163
+ input: "border",
164
+ secondary: "muted",
165
+ secondaryForeground: "foreground",
166
+ searchSurface: "card",
167
+ searchBorder: "border",
168
+ searchField: "muted",
169
+ searchLabel: "mutedForeground",
170
+ searchValue: "foreground",
171
+ searchButton: "primary",
172
+ searchButtonFg: "primaryForeground",
173
+ searchToggle: "foreground",
174
+ searchToggleFg: "background",
175
+ listingBar: "card",
176
+ listingBorder: "border",
177
+ listingText: "foreground",
178
+ listingMuted: "mutedForeground",
179
+ listingModifyBg: "background",
180
+ listingModifyBorder: "border",
181
+ listingChip: "muted",
182
+ listingChipFg: "foreground",
183
+ listingSidebar: "card",
184
+ carBg: "card",
185
+ carBorder: "border",
186
+ carBorderHover: "borderStrong",
187
+ carTitle: "cardForeground",
188
+ carMuted: "mutedForeground",
189
+ carPhoto: "surface2",
190
+ carPrice: "foreground",
191
+ carCta: "primary",
192
+ carCtaFg: "primaryForeground",
193
+ carQuoteBorder: "borderStrong",
194
+ carBadge: "foreground",
195
+ carBadgeFg: "background",
196
+ carOption: "primary",
197
+ carOptionFg: "primaryForeground",
198
+ filterTitle: "foreground",
199
+ filterMuted: "mutedForeground",
200
+ filterPill: "surface2",
201
+ filterPillFg: "mutedForeground",
202
+ filterPillActive: "primary",
203
+ filterPillActiveFg: "primaryForeground",
204
+ filterBar: "primary",
205
+ ring: "primary"
206
+ };
207
+ var THEME_GROUPS = [
208
+ {
209
+ id: "brand",
210
+ title: "Brand",
211
+ icon: "ri-palette-line",
212
+ description: "Page canvas, focus ring and the booking steps. The other tabs override these for the search form, the results, the cards and the filters.",
213
+ sections: [
214
+ {
215
+ title: "Canvas",
216
+ fields: [
217
+ { key: "background", label: "Page background" },
218
+ { key: "foreground", label: "Body text" },
219
+ { key: "mutedForeground", label: "Caption text" },
220
+ { key: "border", label: "Hairline" },
221
+ { key: "muted", label: "Subtle fill" }
222
+ ]
223
+ },
224
+ {
225
+ title: "Actions & states",
226
+ fields: [
227
+ { key: "primary", label: "Brand colour", hint: "Booking step buttons and selected options. Search, Book now and filter pills have their own colours." },
228
+ { key: "primaryForeground", label: "Brand text" },
229
+ { key: "ring", label: "Focus ring" },
230
+ { key: "destructive", label: "Error colour" }
231
+ ]
232
+ }
233
+ ]
234
+ },
235
+ {
236
+ id: "search",
237
+ title: "Search form",
238
+ icon: "ri-layout-top-line",
239
+ description: "The search form, and the Update form in Modify search on the results.",
240
+ sections: [
241
+ { title: "Panel", fields: [{ key: "searchSurface", label: "Background" }, { key: "searchBorder", label: "Border" }] },
242
+ { title: "Fields", fields: [{ key: "searchField", label: "Field fill / toggle track" }, { key: "searchLabel", label: "Labels" }, { key: "searchValue", label: "Values" }] },
243
+ { title: "Search / Update button", fields: [{ key: "searchButton", label: "Button" }, { key: "searchButtonFg", label: "Button text" }] },
244
+ { title: "Residence toggle", fields: [{ key: "searchToggle", label: "Active fill" }, { key: "searchToggleFg", label: "Active text" }] }
245
+ ]
246
+ },
247
+ {
248
+ id: "listing",
249
+ title: "Car listing",
250
+ icon: "ri-list-check-2",
251
+ description: "The results page around the cars: the search summary, Modify search, the count and sort bar, filter chips and the filter sidebar.",
252
+ sections: [
253
+ { title: "Summary bar", fields: [{ key: "listingBar", label: "Background" }, { key: "listingBorder", label: "Border" }, { key: "listingText", label: "Text" }, { key: "listingMuted", label: "Muted text" }] },
254
+ { title: "Modify search", fields: [{ key: "listingModifyBg", label: "Button fill" }, { key: "listingModifyBorder", label: "Button border" }] },
255
+ { title: "Chips & sidebar", fields: [{ key: "listingChip", label: "Chip fill" }, { key: "listingChipFg", label: "Chip text" }, { key: "listingSidebar", label: "Filter sidebar" }] }
256
+ ]
257
+ },
258
+ {
259
+ id: "filters",
260
+ title: "Filters",
261
+ icon: "ri-equalizer-line",
262
+ description: "The filter rail: headings, idle and active pills, and the price histogram.",
263
+ sections: [
264
+ { title: "Type", fields: [{ key: "filterTitle", label: "Headings" }, { key: "filterMuted", label: "Captions" }] },
265
+ { title: "Pills", fields: [{ key: "filterPill", label: "Idle fill" }, { key: "filterPillFg", label: "Idle text" }, { key: "filterPillActive", label: "Active fill" }, { key: "filterPillActiveFg", label: "Active text" }] },
266
+ { title: "Price slider", fields: [{ key: "filterBar", label: "Histogram & range" }] }
267
+ ]
268
+ },
269
+ {
270
+ id: "card",
271
+ title: "Car card",
272
+ icon: "ri-bank-card-line",
273
+ description: "Each car on the results: surface, type, photo, group and insured badges, rate options, price, and Book / Quote.",
274
+ sections: [
275
+ { title: "Surface", fields: [{ key: "carBg", label: "Background" }, { key: "carBorder", label: "Border" }, { key: "carBorderHover", label: "Hover border" }, { key: "carPhoto", label: "Photo backdrop" }] },
276
+ { title: "Type", fields: [{ key: "carTitle", label: "Title" }, { key: "carMuted", label: "Caption / specs" }, { key: "carPrice", label: "Price" }] },
277
+ { title: "Badges", fields: [{ key: "carBadge", label: "Group badge" }, { key: "carBadgeFg", label: "Group text" }, { key: "carInsured", label: "Insured badge" }, { key: "carInsuredFg", label: "Insured text" }] },
278
+ { title: "Rate options", fields: [{ key: "carOption", label: "Active tab" }, { key: "carOptionFg", label: "Active tab text" }] },
279
+ { title: "Actions", fields: [{ key: "carCta", label: "Book now" }, { key: "carCtaFg", label: "Book now text" }, { key: "carQuoteBorder", label: "Quote border" }] }
280
+ ]
281
+ }
282
+ ];
283
+ var THEME_PRESETS = [
284
+ { name: "Navy", primary: "#153673", primaryForeground: "#ffffff" },
285
+ { name: "Charcoal", primary: "#171717", primaryForeground: "#fafafa" },
286
+ { name: "Blue", primary: "#2563eb", primaryForeground: "#ffffff" },
287
+ { name: "Emerald", primary: "#059669", primaryForeground: "#ffffff" },
288
+ { name: "Amber", primary: "#d97706", primaryForeground: "#171717" },
289
+ { name: "Rose", primary: "#e11d48", primaryForeground: "#ffffff" },
290
+ { name: "Violet", primary: "#7c3aed", primaryForeground: "#ffffff" }
291
+ ];
292
+ var THEME_RADII = [0, 4, 6, 8, 10, 12, 14, 16, 20, 24];
293
+ var isHex = (v) => typeof v === "string" && /^#[0-9a-fA-F]{6}$/.test(v);
294
+ function cleanBookingTheme(raw) {
295
+ const out = {};
296
+ if (!raw || typeof raw !== "object") return out;
297
+ const colors = {};
298
+ const rc = raw.colors;
299
+ if (rc && typeof rc === "object") {
300
+ for (const key of THEME_KEYS) {
301
+ const v = rc[key];
302
+ if (isHex(v)) colors[key] = v.toLowerCase();
303
+ }
304
+ }
305
+ if (Object.keys(colors).length) out.colors = colors;
306
+ const r = Number(raw.radius);
307
+ if (raw.radius !== null && raw.radius !== void 0 && Number.isFinite(r) && r >= 0 && r <= 40) out.radius = Math.round(r);
308
+ return out;
309
+ }
310
+ function effectiveColors(base, overrides = {}) {
311
+ const out = {};
312
+ const resolve = (key, depth = 0) => {
313
+ if (out[key]) return out[key];
314
+ const own = overrides[key] ?? base[key];
315
+ const parent = THEME_INHERIT[key];
316
+ const value = own ?? (parent && depth < 6 ? resolve(parent, depth + 1) : FLEETBRIDGE_DEFAULTS[key]);
317
+ out[key] = value;
318
+ return value;
319
+ };
320
+ for (const key of THEME_KEYS) resolve(key);
321
+ return out;
322
+ }
323
+ export {
324
+ FLEETBRIDGE_DEFAULTS,
325
+ THEME_COLOR_VARS,
326
+ THEME_GROUPS,
327
+ THEME_INHERIT,
328
+ THEME_KEYS,
329
+ THEME_PRESETS,
330
+ THEME_RADII,
331
+ cleanBookingTheme,
332
+ effectiveColors,
333
+ isHex,
334
+ themeToCss,
335
+ themeToVars
336
+ };