@nocoo/basalt 2.0.3 → 2.1.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/README.md +134 -15
- package/ai/COMPATIBILITY.md +180 -0
- package/ai/INTEGRATION.md +1760 -0
- package/ai/RECIPES.md +161 -0
- package/ai/USAGE.md +99 -0
- package/ai/registry.json +38099 -0
- package/ai/sources.json +10 -0
- package/dist/assets/brand-mark.d.ts +1 -0
- package/dist/assets/brand-mark.js +7 -0
- package/dist/assets/brand-mark.js.map +1 -0
- package/dist/charts/area.d.ts +58 -5
- package/dist/charts/area.js +20 -12
- package/dist/charts/area.js.map +1 -1
- package/dist/charts/bar.d.ts +54 -5
- package/dist/charts/bar.js +16 -10
- package/dist/charts/bar.js.map +1 -1
- package/dist/charts/bullet.d.ts +18 -1
- package/dist/charts/bullet.js +6 -3
- package/dist/charts/bullet.js.map +1 -1
- package/dist/charts/charts.d.ts +58 -5
- package/dist/charts/charts.js +13 -2
- package/dist/charts/charts.js.map +1 -1
- package/dist/charts/config.d.ts +7 -0
- package/dist/charts/config.js +5 -1
- package/dist/charts/config.js.map +1 -1
- package/dist/charts/custom-chart.d.ts +58 -5
- package/dist/charts/custom-chart.js +13 -2
- package/dist/charts/custom-chart.js.map +1 -1
- package/dist/charts/donut.d.ts +18 -1
- package/dist/charts/donut.js +6 -3
- package/dist/charts/donut.js.map +1 -1
- package/dist/charts/frame.d.ts +40 -3
- package/dist/charts/frame.js +55 -28
- package/dist/charts/frame.js.map +1 -1
- package/dist/charts/funnel.d.ts +18 -1
- package/dist/charts/funnel.js +5 -1
- package/dist/charts/funnel.js.map +1 -1
- package/dist/charts/gauge.d.ts +18 -1
- package/dist/charts/gauge.js +38 -20
- package/dist/charts/gauge.js.map +1 -1
- package/dist/charts/grouped-bar.d.ts +54 -5
- package/dist/charts/grouped-bar.js +16 -10
- package/dist/charts/grouped-bar.js.map +1 -1
- package/dist/charts/heatmap-calendar.d.ts +61 -0
- package/dist/charts/heatmap-calendar.js +287 -96
- package/dist/charts/heatmap-calendar.js.map +1 -1
- package/dist/charts/heatmap-matrix.d.ts +99 -0
- package/dist/charts/heatmap-matrix.js +249 -0
- package/dist/charts/heatmap-matrix.js.map +1 -0
- package/dist/charts/line.d.ts +66 -5
- package/dist/charts/line.js +37 -30
- package/dist/charts/line.js.map +1 -1
- package/dist/charts/palette.d.ts +1 -0
- package/dist/charts/palette.js +7 -1
- package/dist/charts/palette.js.map +1 -1
- package/dist/charts/radar.d.ts +18 -1
- package/dist/charts/radar.js +26 -19
- package/dist/charts/radar.js.map +1 -1
- package/dist/charts/sankey.d.ts +18 -1
- package/dist/charts/sankey.js +4 -1
- package/dist/charts/sankey.js.map +1 -1
- package/dist/charts/series.d.ts +5 -7
- package/dist/charts/series.js.map +1 -1
- package/dist/charts/slot-bar.d.ts +38 -6
- package/dist/charts/slot-bar.js +5 -2
- package/dist/charts/slot-bar.js.map +1 -1
- package/dist/charts/sparkline.d.ts +35 -5
- package/dist/charts/sparkline.js +22 -18
- package/dist/charts/sparkline.js.map +1 -1
- package/dist/charts/stacked-bar.d.ts +58 -5
- package/dist/charts/stacked-bar.js +19 -12
- package/dist/charts/stacked-bar.js.map +1 -1
- package/dist/charts/stat-card.d.ts +51 -1
- package/dist/charts/stat-card.js +66 -39
- package/dist/charts/stat-card.js.map +1 -1
- package/dist/charts/timeline.d.ts +3 -0
- package/dist/charts/timeline.js +4 -3
- package/dist/charts/timeline.js.map +1 -1
- package/dist/charts/timeseries.d.ts +58 -5
- package/dist/charts/timeseries.js +13 -2
- package/dist/charts/timeseries.js.map +1 -1
- package/dist/charts/tooltip.d.ts +57 -0
- package/dist/charts/tooltip.js +119 -2
- package/dist/charts/tooltip.js.map +1 -1
- package/dist/components/accordion.d.ts +117 -2
- package/dist/components/accordion.js +20 -13
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +131 -13
- package/dist/components/alert-dialog.js +12 -9
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/app-header.js +18 -17
- package/dist/components/app-header.js.map +1 -1
- package/dist/components/app-shell.js +15 -14
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/autocomplete.d.ts +4 -0
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.d.ts +76 -3
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +15 -1
- package/dist/components/badge.js +17 -16
- package/dist/components/badge.js.map +1 -1
- package/dist/components/banner.d.ts +88 -2
- package/dist/components/banner.js +41 -40
- package/dist/components/banner.js.map +1 -1
- package/dist/components/basalt-mark.js +14 -8
- package/dist/components/basalt-mark.js.map +1 -1
- package/dist/components/battery-meter.d.ts +10 -0
- package/dist/components/battery-meter.js +56 -0
- package/dist/components/battery-meter.js.map +1 -0
- package/dist/components/breadcrumbs.d.ts +27 -7
- package/dist/components/breadcrumbs.js +21 -20
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button.d.ts +48 -2
- package/dist/components/button.js +87 -36
- package/dist/components/button.js.map +1 -1
- package/dist/components/chat-bubble.d.ts +7 -0
- package/dist/components/chat-bubble.js +14 -13
- package/dist/components/chat-bubble.js.map +1 -1
- package/dist/components/chat-composer.d.ts +7 -3
- package/dist/components/chat-composer.js.map +1 -1
- package/dist/components/chat-header.d.ts +6 -1
- package/dist/components/chat-header.js +17 -16
- package/dist/components/chat-header.js.map +1 -1
- package/dist/components/chat-inbox.d.ts +7 -2
- package/dist/components/chat-inbox.js.map +1 -1
- package/dist/components/checkbox.js +84 -53
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/clipboard-text.d.ts +13 -2
- package/dist/components/clipboard-text.js +4 -4
- package/dist/components/clipboard-text.js.map +1 -1
- package/dist/components/collapsible.d.ts +58 -15
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/command-palette.d.ts +151 -61
- package/dist/components/command-palette.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +1 -1
- package/dist/components/confirm-dialog.js +6 -4
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/context-menu.d.ts +210 -2
- package/dist/components/context-menu.js +7 -4
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/data-table.d.ts +40 -2
- package/dist/components/data-table.js +168 -120
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +53 -2
- package/dist/components/date-picker.js +387 -219
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/delete-resource.d.ts +7 -1
- package/dist/components/delete-resource.js +22 -18
- package/dist/components/delete-resource.js.map +1 -1
- package/dist/components/description-list.js +16 -15
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog.d.ts +141 -12
- package/dist/components/dialog.js +42 -38
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.d.ts +1 -1
- package/dist/components/dock.js +39 -58
- package/dist/components/dock.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +229 -15
- package/dist/components/dropdown-menu.js +9 -6
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/editable-nav-item.d.ts +33 -0
- package/dist/components/editable-nav-item.js +90 -0
- package/dist/components/editable-nav-item.js.map +1 -0
- package/dist/components/empty.d.ts +22 -2
- package/dist/components/empty.js +22 -13
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.js +31 -30
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +37 -0
- package/dist/components/file-dropzone.js +103 -0
- package/dist/components/file-dropzone.js.map +1 -0
- package/dist/components/filter-bar.d.ts +34 -0
- package/dist/components/filter-bar.js +52 -0
- package/dist/components/filter-bar.js.map +1 -0
- package/dist/components/flow.js +19 -18
- package/dist/components/flow.js.map +1 -1
- package/dist/components/grid.d.ts +3 -1
- package/dist/components/grid.js.map +1 -1
- package/dist/components/hover-card.d.ts +111 -1
- package/dist/components/hover-card.js +9 -6
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/icon-picker.d.ts +34 -0
- package/dist/components/icon-picker.js +77 -0
- package/dist/components/icon-picker.js.map +1 -0
- package/dist/components/inline-editable.d.ts +46 -0
- package/dist/components/inline-editable.js +124 -0
- package/dist/components/inline-editable.js.map +1 -0
- package/dist/components/input-area.js +3 -3
- package/dist/components/input-group.js +7 -7
- package/dist/components/input.js +3 -3
- package/dist/components/label.js +18 -17
- package/dist/components/label.js.map +1 -1
- package/dist/components/layer-card.d.ts +10 -2
- package/dist/components/layer-card.js +71 -68
- package/dist/components/layer-card.js.map +1 -1
- package/dist/components/loader.d.ts +10 -2
- package/dist/components/loader.js.map +1 -1
- package/dist/components/menu-bar.d.ts +174 -6
- package/dist/components/menu-bar.js +33 -29
- package/dist/components/menu-bar.js.map +1 -1
- package/dist/components/meter.d.ts +27 -2
- package/dist/components/meter.js.map +1 -1
- package/dist/components/multi-select.d.ts +64 -0
- package/dist/components/multi-select.js +218 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +88 -5
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/overlay.js +6 -5
- package/dist/components/overlay.js.map +1 -1
- package/dist/components/page-header.js +23 -21
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.js +7 -7
- package/dist/components/popover.d.ts +136 -16
- package/dist/components/popover.js +32 -28
- package/dist/components/popover.js.map +1 -1
- package/dist/components/radio.js +38 -37
- package/dist/components/radio.js.map +1 -1
- package/dist/components/resource-list.d.ts +26 -1
- package/dist/components/resource-list.js +28 -15
- package/dist/components/resource-list.js.map +1 -1
- package/dist/components/responsive-master-detail.d.ts +27 -0
- package/dist/components/responsive-master-detail.js +85 -0
- package/dist/components/responsive-master-detail.js.map +1 -0
- package/dist/components/section-rule.js +23 -22
- package/dist/components/section-rule.js.map +1 -1
- package/dist/components/select.d.ts +27 -3
- package/dist/components/select.js +11 -11
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.d.ts +115 -11
- package/dist/components/sheet.js +37 -30
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.d.ts +109 -17
- package/dist/components/sidebar.js +109 -108
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton-line.d.ts +22 -2
- package/dist/components/skeleton-line.js.map +1 -1
- package/dist/components/slider.d.ts +61 -1
- package/dist/components/slider.js +31 -15
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stat-strip.js +16 -15
- package/dist/components/stat-strip.js.map +1 -1
- package/dist/components/switch.js +78 -47
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table-of-contents.js +18 -17
- package/dist/components/table-of-contents.js.map +1 -1
- package/dist/components/table-pager.js +20 -19
- package/dist/components/table-pager.js.map +1 -1
- package/dist/components/table.d.ts +9 -3
- package/dist/components/table.js +19 -18
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js +29 -22
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag-badge.d.ts +58 -0
- package/dist/components/tag-badge.js +72 -0
- package/dist/components/tag-badge.js.map +1 -0
- package/dist/components/tag-color-picker.d.ts +20 -0
- package/dist/components/tag-color-picker.js +42 -0
- package/dist/components/tag-color-picker.js.map +1 -0
- package/dist/components/text.js +17 -16
- package/dist/components/text.js.map +1 -1
- package/dist/components/toast.d.ts +173 -3
- package/dist/components/toast.js +1 -1
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.d.ts +88 -2
- package/dist/components/toggle-group.js +32 -31
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle.d.ts +35 -2
- package/dist/components/toggle.js +12 -11
- package/dist/components/toggle.js.map +1 -1
- package/dist/components/tooltip.d.ts +144 -6
- package/dist/components/tooltip.js +9 -6
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/typeahead-field.js +193 -132
- package/dist/components/typeahead-field.js.map +1 -1
- package/dist/components/upload-queue.d.ts +51 -0
- package/dist/components/upload-queue.js +116 -0
- package/dist/components/upload-queue.js.map +1 -0
- package/dist/providers/accent.d.ts +46 -2
- package/dist/providers/accent.js +358 -172
- package/dist/providers/accent.js.map +1 -1
- package/dist/providers/link.d.ts +14 -4
- package/dist/providers/link.js.map +1 -1
- package/dist/providers/theme.d.ts +38 -2
- package/dist/providers/theme.js +160 -27
- package/dist/providers/theme.js.map +1 -1
- package/dist/styles/base.css +83 -0
- package/dist/styles/standalone.css +711 -120
- package/dist/styles/tailwind.css +21 -7
- package/dist/styles/tokens.css +145 -91
- package/dist/utils/control-surface.d.ts +2 -1
- package/dist/utils/control-surface.js +4 -4
- package/dist/utils/control-surface.js.map +1 -1
- package/dist/utils/selection-indicator.js +2 -2
- package/dist/utils/selection-indicator.js.map +1 -1
- package/package.json +8 -4
|
@@ -6,6 +6,7 @@ export type AccentSwatch = {
|
|
|
6
6
|
light: string;
|
|
7
7
|
dark: string;
|
|
8
8
|
};
|
|
9
|
+
/** Twelve candy accents inspired by the translucent iMac and iPhone 5C finishes. */
|
|
9
10
|
export declare const ACCENT_SWATCHES: readonly AccentSwatch[];
|
|
10
11
|
export declare const DEFAULT_ACCENT_ID = "primary";
|
|
11
12
|
type AccentContextValue = {
|
|
@@ -16,8 +17,51 @@ type AccentContextValue = {
|
|
|
16
17
|
export declare function accentSwatchById(id: string | null | undefined): AccentSwatch;
|
|
17
18
|
export declare function accentForeground(hsl: string): "0 0% 10%" | "0 0% 100%";
|
|
18
19
|
export declare function applyAccent(id: string, dark?: boolean): void;
|
|
19
|
-
export
|
|
20
|
+
export interface AccentProviderProps {
|
|
21
|
+
/** Color overrides for the twelve preset IDs, using HSL channels (for example `204 88% 62%`).
|
|
22
|
+
* Invalid pairs and unknown IDs are ignored. Persistence belongs to the application.
|
|
23
|
+
* Chart colors remain fixed. */
|
|
24
|
+
paletteOverrides?: Readonly<Record<string, {
|
|
25
|
+
light: string;
|
|
26
|
+
dark: string;
|
|
27
|
+
}>>;
|
|
28
|
+
/**
|
|
29
|
+
* Application components wrapped by the accent context.
|
|
30
|
+
*/
|
|
20
31
|
children: ReactNode;
|
|
21
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Storage key used for accent persistence.
|
|
34
|
+
* @default "basalt-accent"
|
|
35
|
+
*/
|
|
36
|
+
storageKey?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Initial accent identifier used when no stored preference exists or during SSR.
|
|
39
|
+
* @default "primary"
|
|
40
|
+
*/
|
|
41
|
+
defaultAccent?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to persist accent changes to localStorage.
|
|
44
|
+
* If false, localStorage is never read or written.
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
persist?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Controlled accent identifier. When provided, the provider acts as a controlled component
|
|
50
|
+
* and internal state is driven by this prop.
|
|
51
|
+
*/
|
|
52
|
+
accent?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Callback fired when accent change is requested.
|
|
55
|
+
* In controlled mode, callers are responsible for updating `accent`.
|
|
56
|
+
*/
|
|
57
|
+
onAccentChange?: (accent: string) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to apply accent CSS variables and data-accent attribute to document.documentElement.
|
|
60
|
+
* Set to false when a host theme system manages CSS variables directly.
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
applyToDocument?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare function AccentProvider({ children, paletteOverrides, storageKey, defaultAccent, persist, accent: controlledAccent, onAccentChange, applyToDocument, }: AccentProviderProps): import("react").JSX.Element;
|
|
22
66
|
export declare function useAccent(): AccentContextValue;
|
|
23
67
|
export {};
|
package/dist/providers/accent.js
CHANGED
|
@@ -1,232 +1,418 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createContext as e, useCallback as t, useContext as n, useEffect as r, useMemo as i,
|
|
3
|
-
import { jsx as
|
|
2
|
+
import { createContext as e, useCallback as t, useContext as n, useEffect as r, useMemo as i, useState as a, useSyncExternalStore as o } from "react";
|
|
3
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
4
4
|
//#region src/providers/accent.tsx
|
|
5
|
-
var
|
|
5
|
+
var c = [
|
|
6
6
|
{
|
|
7
7
|
id: "primary",
|
|
8
|
-
label: "
|
|
9
|
-
token: "--basalt-
|
|
10
|
-
light: "
|
|
11
|
-
dark: "
|
|
8
|
+
label: "Blue",
|
|
9
|
+
token: "--basalt-accent-1",
|
|
10
|
+
light: "204 88% 62%",
|
|
11
|
+
dark: "204 90% 70%"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
id: "sky",
|
|
15
|
-
label: "
|
|
16
|
-
token: "--basalt-
|
|
17
|
-
light: "
|
|
18
|
-
dark: "
|
|
15
|
+
label: "Ice",
|
|
16
|
+
token: "--basalt-accent-2",
|
|
17
|
+
light: "191 79% 70%",
|
|
18
|
+
dark: "191 79% 74%"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
id: "teal",
|
|
22
|
-
label: "
|
|
23
|
-
token: "--basalt-
|
|
24
|
-
light: "
|
|
25
|
-
dark: "
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: "jade",
|
|
29
|
-
label: "Jade",
|
|
30
|
-
token: "--basalt-chart-4",
|
|
31
|
-
light: "166 72% 44%",
|
|
32
|
-
dark: "166 72% 50%"
|
|
22
|
+
label: "Bondi",
|
|
23
|
+
token: "--basalt-accent-3",
|
|
24
|
+
light: "182 62% 47%",
|
|
25
|
+
dark: "182 62% 63%"
|
|
33
26
|
},
|
|
34
27
|
{
|
|
35
28
|
id: "green",
|
|
36
29
|
label: "Green",
|
|
37
|
-
token: "--basalt-
|
|
38
|
-
light: "
|
|
39
|
-
dark: "
|
|
30
|
+
token: "--basalt-accent-4",
|
|
31
|
+
light: "113 58% 62%",
|
|
32
|
+
dark: "113 58% 70%"
|
|
40
33
|
},
|
|
41
34
|
{
|
|
42
35
|
id: "lime",
|
|
43
36
|
label: "Lime",
|
|
44
|
-
token: "--basalt-
|
|
45
|
-
light: "
|
|
46
|
-
dark: "
|
|
37
|
+
token: "--basalt-accent-5",
|
|
38
|
+
light: "79 70% 64%",
|
|
39
|
+
dark: "79 70% 70%"
|
|
47
40
|
},
|
|
48
41
|
{
|
|
49
42
|
id: "amber",
|
|
50
|
-
label: "
|
|
51
|
-
token: "--basalt-
|
|
52
|
-
light: "
|
|
53
|
-
dark: "
|
|
43
|
+
label: "Yellow",
|
|
44
|
+
token: "--basalt-accent-6",
|
|
45
|
+
light: "49 100% 69%",
|
|
46
|
+
dark: "49 100% 73%"
|
|
54
47
|
},
|
|
55
48
|
{
|
|
56
49
|
id: "orange",
|
|
57
|
-
label: "
|
|
58
|
-
token: "--basalt-
|
|
59
|
-
light: "
|
|
60
|
-
dark: "
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
id: "vermilion",
|
|
64
|
-
label: "Vermilion",
|
|
65
|
-
token: "--basalt-chart-9",
|
|
66
|
-
light: "15 85% 52%",
|
|
67
|
-
dark: "15 85% 57%"
|
|
50
|
+
label: "Tangerine",
|
|
51
|
+
token: "--basalt-accent-7",
|
|
52
|
+
light: "27 95% 65%",
|
|
53
|
+
dark: "27 95% 72%"
|
|
68
54
|
},
|
|
69
55
|
{
|
|
70
56
|
id: "red",
|
|
71
|
-
label: "
|
|
72
|
-
token: "--basalt-
|
|
73
|
-
light: "
|
|
74
|
-
dark: "
|
|
57
|
+
label: "Strawberry",
|
|
58
|
+
token: "--basalt-accent-8",
|
|
59
|
+
light: "5 85% 66%",
|
|
60
|
+
dark: "5 85% 73%"
|
|
75
61
|
},
|
|
76
62
|
{
|
|
77
63
|
id: "rose",
|
|
78
|
-
label: "
|
|
79
|
-
token: "--basalt-
|
|
80
|
-
light: "
|
|
81
|
-
dark: "
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
id: "magenta",
|
|
85
|
-
label: "Magenta",
|
|
86
|
-
token: "--basalt-chart-12",
|
|
87
|
-
light: "320 70% 55%",
|
|
88
|
-
dark: "320 70% 60%"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
id: "orchid",
|
|
92
|
-
label: "Orchid",
|
|
93
|
-
token: "--basalt-chart-13",
|
|
94
|
-
light: "290 65% 55%",
|
|
95
|
-
dark: "290 65% 60%"
|
|
64
|
+
label: "Pink",
|
|
65
|
+
token: "--basalt-accent-9",
|
|
66
|
+
light: "345 88% 72%",
|
|
67
|
+
dark: "345 88% 77%"
|
|
96
68
|
},
|
|
97
69
|
{
|
|
98
70
|
id: "purple",
|
|
99
|
-
label: "
|
|
100
|
-
token: "--basalt-
|
|
101
|
-
light: "
|
|
102
|
-
dark: "
|
|
71
|
+
label: "Grape",
|
|
72
|
+
token: "--basalt-accent-10",
|
|
73
|
+
light: "280 53% 71%",
|
|
74
|
+
dark: "280 53% 77%"
|
|
103
75
|
},
|
|
104
76
|
{
|
|
105
77
|
id: "indigo",
|
|
106
|
-
label: "
|
|
107
|
-
token: "--basalt-
|
|
108
|
-
light: "
|
|
109
|
-
dark: "
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
id: "cobalt",
|
|
113
|
-
label: "Cobalt",
|
|
114
|
-
token: "--basalt-chart-16",
|
|
115
|
-
light: "230 70% 56%",
|
|
116
|
-
dark: "230 70% 61%"
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
id: "steel",
|
|
120
|
-
label: "Steel",
|
|
121
|
-
token: "--basalt-chart-17",
|
|
122
|
-
light: "210 55% 50%",
|
|
123
|
-
dark: "210 55% 56%"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
id: "cadet",
|
|
127
|
-
label: "Cadet",
|
|
128
|
-
token: "--basalt-chart-18",
|
|
129
|
-
light: "195 45% 55%",
|
|
130
|
-
dark: "195 45% 60%"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
id: "seafoam",
|
|
134
|
-
label: "Seafoam",
|
|
135
|
-
token: "--basalt-chart-19",
|
|
136
|
-
light: "160 50% 50%",
|
|
137
|
-
dark: "160 50% 55%"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
id: "olive",
|
|
141
|
-
label: "Olive",
|
|
142
|
-
token: "--basalt-chart-20",
|
|
143
|
-
light: "100 50% 48%",
|
|
144
|
-
dark: "100 50% 53%"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
id: "gold",
|
|
148
|
-
label: "Gold",
|
|
149
|
-
token: "--basalt-chart-21",
|
|
150
|
-
light: "60 65% 45%",
|
|
151
|
-
dark: "60 65% 50%"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
id: "tangerine",
|
|
155
|
-
label: "Tangerine",
|
|
156
|
-
token: "--basalt-chart-22",
|
|
157
|
-
light: "22 80% 50%",
|
|
158
|
-
dark: "22 80% 55%"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
id: "crimson",
|
|
162
|
-
label: "Crimson",
|
|
163
|
-
token: "--basalt-chart-23",
|
|
164
|
-
light: "350 65% 50%",
|
|
165
|
-
dark: "350 65% 55%"
|
|
78
|
+
label: "Blueberry",
|
|
79
|
+
token: "--basalt-accent-11",
|
|
80
|
+
light: "237 66% 69%",
|
|
81
|
+
dark: "237 66% 77%"
|
|
166
82
|
},
|
|
167
83
|
{
|
|
168
84
|
id: "gray",
|
|
169
|
-
label: "
|
|
170
|
-
token: "--basalt-
|
|
171
|
-
light: "
|
|
172
|
-
dark: "
|
|
85
|
+
label: "Pearl",
|
|
86
|
+
token: "--basalt-accent-12",
|
|
87
|
+
light: "210 20% 87%",
|
|
88
|
+
dark: "210 20% 88%"
|
|
173
89
|
}
|
|
174
|
-
],
|
|
175
|
-
|
|
176
|
-
|
|
90
|
+
], l = /* @__PURE__ */ new Map([
|
|
91
|
+
["jade", "teal"],
|
|
92
|
+
["vermilion", "red"],
|
|
93
|
+
["magenta", "rose"],
|
|
94
|
+
["orchid", "purple"],
|
|
95
|
+
["cobalt", "indigo"],
|
|
96
|
+
["steel", "primary"],
|
|
97
|
+
["cadet", "sky"],
|
|
98
|
+
["seafoam", "teal"],
|
|
99
|
+
["olive", "lime"],
|
|
100
|
+
["gold", "amber"],
|
|
101
|
+
["tangerine", "orange"],
|
|
102
|
+
["crimson", "red"]
|
|
103
|
+
]), u = "primary", d = "basalt-accent", f = e(null);
|
|
104
|
+
function p(e) {
|
|
105
|
+
let t = l.get(e ?? "") ?? e;
|
|
106
|
+
return c.find((e) => e.id === t) ?? c[0];
|
|
177
107
|
}
|
|
178
|
-
function
|
|
108
|
+
function m(e) {
|
|
179
109
|
return e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
180
110
|
}
|
|
181
|
-
function
|
|
182
|
-
let [t, n, r] = e.trim().split(/\s+/)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
111
|
+
function h(e) {
|
|
112
|
+
let [t, n, r] = e.trim().split(/\s+/);
|
|
113
|
+
return [
|
|
114
|
+
Number(t),
|
|
115
|
+
Number(n.replace("%", "")) / 100,
|
|
116
|
+
Number(r.replace("%", "")) / 100
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
function g(e, t, n) {
|
|
120
|
+
let r = (t) => (t + e / 30) % 12, i = t * Math.min(n, 1 - n), a = (e) => n - i * Math.max(-1, Math.min(r(e) - 3, Math.min(9 - r(e), 1)));
|
|
121
|
+
return [
|
|
122
|
+
255 * a(0),
|
|
123
|
+
255 * a(8),
|
|
124
|
+
255 * a(4)
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
function _(e) {
|
|
128
|
+
return .2126 * m(e[0] / 255) + .7152 * m(e[1] / 255) + .0722 * m(e[2] / 255);
|
|
129
|
+
}
|
|
130
|
+
function v(e, t) {
|
|
131
|
+
let n = _(e), r = _(t);
|
|
132
|
+
return (Math.max(n, r) + .05) / (Math.min(n, r) + .05);
|
|
133
|
+
}
|
|
134
|
+
var y = [
|
|
135
|
+
26,
|
|
136
|
+
26,
|
|
137
|
+
26
|
|
138
|
+
], b = [
|
|
139
|
+
255,
|
|
140
|
+
255,
|
|
141
|
+
255
|
|
142
|
+
], x = [
|
|
143
|
+
[
|
|
144
|
+
238,
|
|
145
|
+
239,
|
|
146
|
+
242
|
|
147
|
+
],
|
|
148
|
+
[
|
|
149
|
+
246,
|
|
150
|
+
247,
|
|
151
|
+
248
|
|
152
|
+
],
|
|
153
|
+
[
|
|
154
|
+
252,
|
|
155
|
+
252,
|
|
156
|
+
253
|
|
157
|
+
],
|
|
158
|
+
[
|
|
159
|
+
255,
|
|
160
|
+
255,
|
|
161
|
+
255
|
|
162
|
+
]
|
|
163
|
+
], S = [
|
|
164
|
+
[
|
|
165
|
+
23,
|
|
166
|
+
23,
|
|
167
|
+
23
|
|
168
|
+
],
|
|
169
|
+
[
|
|
170
|
+
27,
|
|
171
|
+
27,
|
|
172
|
+
27
|
|
173
|
+
],
|
|
174
|
+
[
|
|
175
|
+
31,
|
|
176
|
+
31,
|
|
177
|
+
31
|
|
178
|
+
],
|
|
179
|
+
[
|
|
180
|
+
36,
|
|
181
|
+
36,
|
|
182
|
+
36
|
|
183
|
+
]
|
|
184
|
+
];
|
|
185
|
+
function C(e, t) {
|
|
186
|
+
return [
|
|
187
|
+
e[0] * e[3] + t[0] * (1 - e[3]),
|
|
188
|
+
e[1] * e[3] + t[1] * (1 - e[3]),
|
|
189
|
+
e[2] * e[3] + t[2] * (1 - e[3])
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
function w(e, t) {
|
|
193
|
+
let [n, r, i] = h(t ? e.dark : e.light), a = t ? S : x;
|
|
194
|
+
if (t) for (let e = Math.max(Math.round(i * 100), 45); e <= 85; e++) {
|
|
195
|
+
let t = g(n, r, e / 100);
|
|
196
|
+
if (Math.min(...a.map((e) => v(t, e))) < 4.55 || v(t, y) < 4.55) continue;
|
|
197
|
+
let i = !0;
|
|
198
|
+
for (let e of a) if (v(C([...t, .9], e), y) < 4.55) {
|
|
199
|
+
i = !1;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
if (i) return `${n} ${Math.round(r * 100)}% ${e}%`;
|
|
203
|
+
}
|
|
204
|
+
else for (let e = Math.min(Math.round(i * 100), 60); e >= 15; e--) {
|
|
205
|
+
let t = g(n, r, e / 100);
|
|
206
|
+
if (Math.min(...a.map((e) => v(t, e))) < 4.55 || v(t, b) < 4.55) continue;
|
|
207
|
+
let i = !0;
|
|
208
|
+
for (let e of a) if (v(C([...t, .9], e), b) < 4.55) {
|
|
209
|
+
i = !1;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
if (i) return `${n} ${Math.round(r * 100)}% ${e}%`;
|
|
213
|
+
}
|
|
214
|
+
return t ? e.dark : e.light;
|
|
215
|
+
}
|
|
216
|
+
function T(e) {
|
|
217
|
+
let [t, n, r] = h(e), i = g(t, n, r), a = v(i, b);
|
|
218
|
+
return v(i, y) >= a ? "0 0% 10%" : "0 0% 100%";
|
|
187
219
|
}
|
|
188
|
-
function
|
|
189
|
-
|
|
190
|
-
i.style.setProperty("--basalt-primary", r), i.style.setProperty("--basalt-primary-foreground", p(r)), i.style.setProperty("--basalt-ring", r), i.dataset.accent = n.id;
|
|
220
|
+
function E(e, t = !1) {
|
|
221
|
+
typeof document > "u" || D(p(e), t);
|
|
191
222
|
}
|
|
192
|
-
function
|
|
193
|
-
|
|
223
|
+
function D(e, t) {
|
|
224
|
+
let n = w(e, t), r = document.documentElement;
|
|
225
|
+
r.style.setProperty("--basalt-primary", n), r.style.setProperty("--basalt-primary-foreground", T(n)), r.style.setProperty("--basalt-ring", n), r.dataset.accent = e.id;
|
|
194
226
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
227
|
+
function O(e) {
|
|
228
|
+
return typeof e == "string" && (c.some((t) => t.id === e) || l.has(e));
|
|
197
229
|
}
|
|
198
|
-
function
|
|
199
|
-
|
|
230
|
+
function k(e) {
|
|
231
|
+
try {
|
|
232
|
+
return typeof window > "u" || !window.localStorage ? { status: "error" } : {
|
|
233
|
+
status: "success",
|
|
234
|
+
value: window.localStorage.getItem(e)
|
|
235
|
+
};
|
|
236
|
+
} catch {
|
|
237
|
+
return { status: "error" };
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function A(e, t) {
|
|
241
|
+
try {
|
|
242
|
+
return typeof window > "u" || !window.localStorage ? !1 : (window.localStorage.setItem(e, t), !0);
|
|
243
|
+
} catch {
|
|
244
|
+
return !1;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function j(e) {
|
|
248
|
+
if (!e) return !0;
|
|
249
|
+
try {
|
|
250
|
+
if (typeof window < "u" && window.localStorage) return e === window.localStorage;
|
|
251
|
+
} catch {
|
|
252
|
+
return !1;
|
|
253
|
+
}
|
|
254
|
+
return !1;
|
|
255
|
+
}
|
|
256
|
+
var M = "basalt:accent-change";
|
|
257
|
+
function N(e, t, n) {
|
|
258
|
+
let r = e, i = p(t).id, a = n, o = i, s = !1, c = !1;
|
|
259
|
+
if (a) {
|
|
260
|
+
let e = k(r);
|
|
261
|
+
e.status === "success" && O(e.value) && (o = p(e.value).id, s = !0);
|
|
262
|
+
}
|
|
263
|
+
let l = /* @__PURE__ */ new Set(), u = () => {
|
|
264
|
+
for (let e of l) e();
|
|
265
|
+
}, d = (e) => {
|
|
266
|
+
if (!a) return;
|
|
267
|
+
let t = e;
|
|
268
|
+
if (!t.detail || t.detail.key !== r) return;
|
|
269
|
+
let { value: n, writeSucceeded: i } = t.detail;
|
|
270
|
+
c = !i, o = n, s = !0, u();
|
|
271
|
+
}, f = (e) => {
|
|
272
|
+
if (!a) return;
|
|
273
|
+
let t = e;
|
|
274
|
+
if ("key" in t && t.key !== void 0) {
|
|
275
|
+
if (!j(t.storageArea) || t.key !== null && t.key !== r) return;
|
|
276
|
+
c = !1;
|
|
277
|
+
let e = t.newValue;
|
|
278
|
+
if (e == null || !O(e)) {
|
|
279
|
+
o = i, s = !1, u();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
o = p(e).id, s = !0, u();
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (c) return;
|
|
286
|
+
let n = k(r);
|
|
287
|
+
n.status !== "error" && (O(n.value) ? (o = p(n.value).id, s = !0, u()) : (o = i, s = !1, u()));
|
|
288
|
+
}, m = null, h = () => {
|
|
289
|
+
typeof window > "u" || l.size === 1 && !m && (window.addEventListener("storage", f), window.addEventListener(M, d), m = () => {
|
|
290
|
+
window.removeEventListener("storage", f), window.removeEventListener(M, d), m = null;
|
|
291
|
+
});
|
|
292
|
+
}, g = () => {
|
|
293
|
+
l.size === 0 && m && m();
|
|
294
|
+
};
|
|
295
|
+
return {
|
|
296
|
+
getSnapshot: () => o,
|
|
297
|
+
subscribe: (e) => (l.add(e), h(), () => {
|
|
298
|
+
l.delete(e), g();
|
|
299
|
+
}),
|
|
300
|
+
setAccent: (e) => {
|
|
301
|
+
let t = p(e).id;
|
|
302
|
+
o = t, s = !0;
|
|
303
|
+
let n = !0;
|
|
304
|
+
if (a) {
|
|
305
|
+
let e = A(r, t);
|
|
306
|
+
if (c = !e, n = e, typeof window < "u") try {
|
|
307
|
+
window.dispatchEvent(new CustomEvent(M, { detail: {
|
|
308
|
+
key: r,
|
|
309
|
+
value: t,
|
|
310
|
+
writeSucceeded: n
|
|
311
|
+
} }));
|
|
312
|
+
} catch {}
|
|
313
|
+
}
|
|
314
|
+
u();
|
|
315
|
+
},
|
|
316
|
+
updateConfig: (e) => {
|
|
317
|
+
let t = r !== e.storageKey, n = a !== e.persist, l = p(e.defaultAccent).id, d = i !== l, f = a;
|
|
318
|
+
if (r = e.storageKey, i = l, a = e.persist, t) {
|
|
319
|
+
if (a) {
|
|
320
|
+
let e = k(r);
|
|
321
|
+
e.status === "success" && (c = !1, O(e.value) ? (o = p(e.value).id, s = !0) : (o = i, s = !1)), u();
|
|
322
|
+
}
|
|
323
|
+
} else if (n) {
|
|
324
|
+
if (!f && a) {
|
|
325
|
+
let e = k(r);
|
|
326
|
+
e.status === "success" && (c = !1, O(e.value) && (o = p(e.value).id, s = !0, u()));
|
|
327
|
+
}
|
|
328
|
+
} else if (d && !s) {
|
|
329
|
+
if (a) {
|
|
330
|
+
let e = k(r);
|
|
331
|
+
e.status === "success" && !O(e.value) && (o = i, u());
|
|
332
|
+
} else o = i, u();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
};
|
|
200
336
|
}
|
|
201
|
-
function
|
|
202
|
-
|
|
337
|
+
function P(e) {
|
|
338
|
+
if (typeof e != "string" || !/^\d+(?:\.\d+)?\s+\d+(?:\.\d+)?%\s+\d+(?:\.\d+)?%$/.test(e)) return !1;
|
|
339
|
+
let [t, n, r] = h(e);
|
|
340
|
+
return t <= 360 && n <= 1 && r <= 1;
|
|
341
|
+
}
|
|
342
|
+
function F() {
|
|
343
|
+
return typeof document > "u" ? !1 : document.documentElement.classList.contains("dark");
|
|
344
|
+
}
|
|
345
|
+
function I({ children: e, paletteOverrides: n, storageKey: l = d, defaultAccent: m = u, persist: h = !0, accent: g, onAccentChange: _, applyToDocument: v = !0 }) {
|
|
346
|
+
let y = g !== void 0, b = i(() => c.map((e) => {
|
|
347
|
+
let t = n?.[e.id];
|
|
348
|
+
return t && P(t.light) && P(t.dark) ? {
|
|
349
|
+
...e,
|
|
350
|
+
light: t.light,
|
|
351
|
+
dark: t.dark
|
|
352
|
+
} : e;
|
|
353
|
+
}), [n]), [x] = a(() => N(l, m, h));
|
|
354
|
+
r(() => {
|
|
355
|
+
x.updateConfig({
|
|
356
|
+
storageKey: l,
|
|
357
|
+
defaultAccent: m,
|
|
358
|
+
persist: h
|
|
359
|
+
});
|
|
360
|
+
}, [
|
|
361
|
+
x,
|
|
362
|
+
l,
|
|
363
|
+
m,
|
|
364
|
+
h
|
|
365
|
+
]);
|
|
366
|
+
let S = t(() => p(m).id, [m]), C = o(x.subscribe, x.getSnapshot, S), w = y ? p(g).id : C;
|
|
203
367
|
r(() => {
|
|
204
|
-
|
|
205
|
-
let e =
|
|
206
|
-
|
|
368
|
+
if (!v || typeof document > "u") return;
|
|
369
|
+
let e = () => {
|
|
370
|
+
let e = F();
|
|
371
|
+
for (let t of b) document.documentElement.style.setProperty(t.token, e ? t.dark : t.light);
|
|
372
|
+
D(b.find((e) => e.id === w) ?? b[0], e);
|
|
373
|
+
};
|
|
374
|
+
e();
|
|
375
|
+
let t = new MutationObserver(e);
|
|
376
|
+
return t.observe(document.documentElement, {
|
|
207
377
|
attributes: !0,
|
|
208
378
|
attributeFilter: ["class"]
|
|
209
|
-
}), () =>
|
|
210
|
-
}, [
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
379
|
+
}), () => t.disconnect();
|
|
380
|
+
}, [
|
|
381
|
+
w,
|
|
382
|
+
v,
|
|
383
|
+
b
|
|
384
|
+
]);
|
|
385
|
+
let T = t((e) => {
|
|
386
|
+
let t = p(e).id;
|
|
387
|
+
if (y) {
|
|
388
|
+
_?.(t);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
x.setAccent(t), _?.(t);
|
|
392
|
+
}, [
|
|
393
|
+
y,
|
|
394
|
+
_,
|
|
395
|
+
x
|
|
396
|
+
]), E = i(() => ({
|
|
397
|
+
accent: w,
|
|
398
|
+
setAccent: T,
|
|
399
|
+
swatches: b
|
|
400
|
+
}), [
|
|
401
|
+
w,
|
|
402
|
+
T,
|
|
403
|
+
b
|
|
404
|
+
]);
|
|
405
|
+
return /* @__PURE__ */ s(f.Provider, {
|
|
406
|
+
value: E,
|
|
221
407
|
children: e
|
|
222
408
|
});
|
|
223
409
|
}
|
|
224
|
-
function
|
|
225
|
-
let e = n(
|
|
410
|
+
function L() {
|
|
411
|
+
let e = n(f);
|
|
226
412
|
if (!e) throw Error("useAccent must be used within AccentProvider");
|
|
227
413
|
return e;
|
|
228
414
|
}
|
|
229
415
|
//#endregion
|
|
230
|
-
export {
|
|
416
|
+
export { c as ACCENT_SWATCHES, I as AccentProvider, u as DEFAULT_ACCENT_ID, T as accentForeground, p as accentSwatchById, E as applyAccent, L as useAccent };
|
|
231
417
|
|
|
232
418
|
//# sourceMappingURL=accent.js.map
|