basalt-ui 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +37 -0
- package/README.md +47 -5
- package/agent/rules/basalt-app.md +126 -0
- package/agent/rules/basalt-content.md +3 -1
- package/agent/skills/basalt-app/SKILL.md +32 -10
- package/configs/check.yml +3 -1
- package/configs/oxlint.json +1 -1
- package/dist/agent/part-list.d.ts.map +1 -1
- package/dist/agent/part-list.js +17 -7
- package/dist/agent/stick-to-bottom.js +2 -2
- package/dist/agent-chat/thread-detail-panel.d.ts.map +1 -1
- package/dist/agent-chat/thread-detail-panel.js +37 -33
- package/dist/agent-chat/thread-message.d.ts.map +1 -1
- package/dist/agent-chat/thread-message.js +8 -5
- package/dist/agent-chat/thread-outcome-card.js +3 -3
- package/dist/agent-chat/thread-workspace.js +1 -1
- package/dist/charts/primitives/ChartLegend.js +2 -0
- package/dist/charts/primitives/ChartTooltip.js +2 -1
- package/dist/cli/index.d.ts +21 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +50 -12
- package/dist/connectivity/connectivity-indicator.d.ts.map +1 -1
- package/dist/connectivity/connectivity-indicator.js +3 -3
- package/dist/content/article-card.module.css +7 -5
- package/dist/content/article-layout.module.css +16 -12
- package/dist/content/callout.module.css +4 -4
- package/dist/content/code-block.module.css +8 -7
- package/dist/content/guide.module.css +3 -3
- package/dist/content/mermaid.module.css +2 -2
- package/dist/content/prose.module.css +59 -29
- package/dist/content/reading-progress.module.css +2 -0
- package/dist/content/toc.module.css +6 -3
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +10 -2
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +3 -16
- package/dist/dashboard/settings-section.js +2 -2
- package/dist/dashboard/settings-section.module.css +2 -2
- package/dist/dashboard/stat-card.js +2 -1
- package/dist/data/virtual-list.d.ts.map +1 -1
- package/dist/data/virtual-list.js +12 -2
- package/dist/forms/FormErrorSummary.js +2 -2
- package/dist/guard/index.d.ts +20 -4
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +250 -37
- package/dist/guard/types.d.ts +24 -3
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/provider/index.d.ts +30 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +32 -7
- package/dist/provider/lab-theme.d.ts +39 -0
- package/dist/provider/lab-theme.d.ts.map +1 -0
- package/dist/provider/lab-theme.js +52 -0
- package/dist/shell/app-header.module.css +2 -2
- package/dist/shell/app-mobile-nav.module.css +1 -1
- package/dist/shell/app-sidebar-account.d.ts.map +1 -1
- package/dist/shell/app-sidebar-account.js +4 -2
- package/dist/shell/app-sidebar.d.ts.map +1 -1
- package/dist/shell/app-sidebar.js +4 -2
- package/dist/shell/app-sidebar.module.css +36 -26
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +11 -4
- package/dist/shell/sidebar-search.module.css +16 -4
- package/dist/styles.css +1 -1
- package/dist/surfaces.d.ts +16 -12
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +12 -4
- package/dist/theme/controls.module.css +1 -1
- package/dist/theme/floating.module.css +1 -1
- package/dist/theme/index.d.ts +116 -11
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +703 -566
- package/dist/theme/nav-link.module.css +1 -1
- package/dist/theme/use-basalt-spacing.d.ts +3 -0
- package/dist/theme/use-basalt-spacing.d.ts.map +1 -0
- package/dist/theme/use-basalt-spacing.js +8 -0
- package/dist/theme-lab/derive-controls.d.ts +13 -0
- package/dist/theme-lab/derive-controls.d.ts.map +1 -0
- package/dist/theme-lab/derive-controls.js +137 -0
- package/dist/theme-lab/derive-state.d.ts +55 -0
- package/dist/theme-lab/derive-state.d.ts.map +1 -0
- package/dist/theme-lab/derive-state.js +81 -0
- package/dist/theme-lab/index.d.ts +12 -2
- package/dist/theme-lab/index.d.ts.map +1 -1
- package/dist/theme-lab/index.js +13 -62
- package/dist/theme-toggle/index.d.ts.map +1 -1
- package/dist/theme-toggle/index.js +3 -2
- package/dist/tokens/derive.d.ts +89 -0
- package/dist/tokens/derive.d.ts.map +1 -0
- package/dist/tokens/derive.js +250 -0
- package/dist/tokens/hct.d.ts +34 -0
- package/dist/tokens/hct.d.ts.map +1 -0
- package/dist/tokens/hct.js +159 -0
- package/dist/tokens/index.d.ts +71 -7
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +284 -46
- package/dist/tokens/palette.d.ts +984 -167
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +617 -119
- package/dist/vite-color-mix.d.ts +30 -0
- package/dist/vite-color-mix.d.ts.map +1 -0
- package/dist/vite-color-mix.js +80 -0
- package/dist/vite.d.ts +82 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +312 -0
- package/llms.txt +5 -4
- package/package.json +24 -9
- package/src/agent/part-list.tsx +13 -7
- package/src/agent/stick-to-bottom.tsx +2 -2
- package/src/agent-chat/thread-detail-panel.tsx +13 -10
- package/src/agent-chat/thread-message.tsx +8 -5
- package/src/agent-chat/thread-outcome-card.tsx +2 -2
- package/src/agent-chat/thread-workspace.tsx +2 -2
- package/src/charts/primitives/ChartLegend.tsx +2 -2
- package/src/charts/primitives/ChartTooltip.tsx +2 -2
- package/src/cli/check-theme.test.ts +18 -0
- package/src/cli/index.ts +112 -20
- package/src/cli/init-sync.test.ts +68 -0
- package/src/connectivity/connectivity-indicator.tsx +8 -2
- package/src/content/article-card.module.css +7 -5
- package/src/content/article-layout.module.css +16 -12
- package/src/content/callout.module.css +4 -4
- package/src/content/code-block.module.css +8 -7
- package/src/content/guide.module.css +3 -3
- package/src/content/mermaid.module.css +2 -2
- package/src/content/prose.module.css +59 -29
- package/src/content/prose.module.css.test.ts +55 -0
- package/src/content/reading-progress.module.css +2 -0
- package/src/content/toc.module.css +6 -3
- package/src/dashboard/delta-badge.tsx +10 -4
- package/src/dashboard/empty-state.tsx +3 -16
- package/src/dashboard/settings-section.module.css +2 -2
- package/src/dashboard/settings-section.tsx +2 -2
- package/src/dashboard/stat-card.tsx +2 -2
- package/src/data/virtual-list.tsx +12 -2
- package/src/forms/FormErrorSummary.tsx +1 -1
- package/src/guard/check-source.test.ts +416 -5
- package/src/guard/index.ts +367 -45
- package/src/guard/types.ts +24 -2
- package/src/index.ts +1 -0
- package/src/provider/index.test.tsx +100 -0
- package/src/provider/index.tsx +79 -7
- package/src/provider/lab-theme.test.ts +147 -0
- package/src/provider/lab-theme.ts +166 -0
- package/src/shell/app-header.module.css +2 -2
- package/src/shell/app-mobile-nav.module.css +1 -1
- package/src/shell/app-sidebar-account.tsx +9 -2
- package/src/shell/app-sidebar.module.css +36 -26
- package/src/shell/app-sidebar.tsx +12 -2
- package/src/shell/index.tsx +14 -3
- package/src/shell/sidebar-search.module.css +16 -4
- package/src/styles.css +1 -1
- package/src/surfaces.ts +25 -11
- package/src/theme/contrast.test.ts +19 -3
- package/src/theme/controls.module.css +1 -1
- package/src/theme/density-option.test.ts +96 -0
- package/src/theme/density-relations.test.ts +428 -0
- package/src/theme/derive-theme.test.ts +101 -0
- package/src/theme/floating.module.css +1 -1
- package/src/theme/fonts-option.test.ts +69 -0
- package/src/theme/index.ts +930 -563
- package/src/theme/nav-link.module.css +1 -1
- package/src/theme/radius-option.test.ts +86 -0
- package/src/theme/radius.test.ts +132 -0
- package/src/theme/spacing.test.ts +432 -0
- package/src/theme/use-basalt-spacing.test.tsx +51 -0
- package/src/theme/use-basalt-spacing.ts +38 -0
- package/src/theme-lab/derive-controls.test.ts +94 -0
- package/src/theme-lab/derive-controls.tsx +227 -0
- package/src/theme-lab/derive-state.test.ts +71 -0
- package/src/theme-lab/derive-state.ts +163 -0
- package/src/theme-lab/index.tsx +29 -68
- package/src/theme-lab/theme-lab.test.ts +4 -18
- package/src/theme-toggle/index.tsx +9 -4
- package/src/tokens/build-fonts-css.test.ts +51 -0
- package/src/tokens/build-radius-css.test.ts +25 -0
- package/src/tokens/density.test.ts +274 -0
- package/src/tokens/derive-radius.test.ts +62 -0
- package/src/tokens/derive.test.ts +30 -0
- package/src/tokens/derive.ts +481 -0
- package/src/tokens/hct.ts +231 -0
- package/src/tokens/index.ts +395 -45
- package/src/tokens/palette.test.ts +114 -0
- package/src/tokens/palette.ts +1118 -180
- package/src/vite-color-mix.test.ts +46 -0
- package/src/vite-color-mix.ts +137 -0
- package/src/vite.test.ts +192 -0
- package/src/vite.ts +502 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { contrastRatio, hctToHex, hexToHct, yToTone } from "./hct.js";
|
|
2
|
+
const DEFAULT_DERIVE_CONFIG = {
|
|
3
|
+
accent: "#0077bd",
|
|
4
|
+
neutral: "zinc",
|
|
5
|
+
lightLevel: 0,
|
|
6
|
+
darkLevel: 0,
|
|
7
|
+
vibrancy: 0,
|
|
8
|
+
accentBrightness: 0
|
|
9
|
+
};
|
|
10
|
+
const DERIVE_CONFIG_KEYS = Object.keys(DEFAULT_DERIVE_CONFIG);
|
|
11
|
+
function resolveDeriveConfig(partial) {
|
|
12
|
+
return { ...DEFAULT_DERIVE_CONFIG, ...partial };
|
|
13
|
+
}
|
|
14
|
+
function isDefaultDeriveConfig(config) {
|
|
15
|
+
return DERIVE_CONFIG_KEYS.every((key) => config[key] === DEFAULT_DERIVE_CONFIG[key]);
|
|
16
|
+
}
|
|
17
|
+
const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
|
|
18
|
+
const ACCENT_HEX_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
19
|
+
function assertValidAccentHex(accent) {
|
|
20
|
+
if (!ACCENT_HEX_RE.test(accent)) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`Invalid DeriveConfig.accent: expected a #rgb or #rrggbb hex color, got "${accent}"`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const FILL_LUMINANCE = 0.165;
|
|
27
|
+
const FILL_HOVER_TONE_DELTA = 4.8;
|
|
28
|
+
const FILL_HOVER_CHROMA_DELTA = -3.6;
|
|
29
|
+
const ACCENT_INK_DARK_TONE = 78;
|
|
30
|
+
const ACCENT_INK_DARK_CHROMA = 36;
|
|
31
|
+
const ACCENT_HOVER_DARK_TONE_DELTA = 12.8;
|
|
32
|
+
const ACCENT_HOVER_DARK_CHROMA_DELTA = 18;
|
|
33
|
+
const ON_ACCENT_DARK_TONE = 10;
|
|
34
|
+
const ON_ACCENT_DARK_CHROMA = 8;
|
|
35
|
+
const ON_ACCENT_WHITE_CONTRAST_MIN = 3;
|
|
36
|
+
const FILL_PAGE_CONTRAST_MIN = 3;
|
|
37
|
+
const FILL_CLAMP_STEP = 0.5;
|
|
38
|
+
function clampFillTone(rawTone, bandTone, hue, chroma, pageBg) {
|
|
39
|
+
if (rawTone === bandTone) return rawTone;
|
|
40
|
+
const towardCenter = rawTone > bandTone ? -FILL_CLAMP_STEP : FILL_CLAMP_STEP;
|
|
41
|
+
const clearsBothPages = (tone2) => {
|
|
42
|
+
const hex = hctToHex({ hue, chroma, tone: tone2 });
|
|
43
|
+
return contrastRatio(hex, pageBg.light) >= FILL_PAGE_CONTRAST_MIN && contrastRatio(hex, pageBg.dark) >= FILL_PAGE_CONTRAST_MIN;
|
|
44
|
+
};
|
|
45
|
+
let tone = rawTone;
|
|
46
|
+
while (!clearsBothPages(tone) && tone !== bandTone) {
|
|
47
|
+
tone = towardCenter < 0 ? Math.max(bandTone, tone + towardCenter) : Math.min(bandTone, tone + towardCenter);
|
|
48
|
+
}
|
|
49
|
+
return tone;
|
|
50
|
+
}
|
|
51
|
+
const VIBRANCY_CENTER_CHROMA_MULT = 0.72;
|
|
52
|
+
const VIBRANCY_STEP_MULT = 1.2;
|
|
53
|
+
const vibrancyChromaMult = (level) => VIBRANCY_CENTER_CHROMA_MULT * VIBRANCY_STEP_MULT ** level;
|
|
54
|
+
const ACCENT_BRIGHTNESS_TONE_STEP = 5;
|
|
55
|
+
const SURFACE_LEVEL_TONE_STEP = 2;
|
|
56
|
+
const SURFACE_BASELINE_TONE_SHIFT = 2;
|
|
57
|
+
const FILL_HUE = {
|
|
58
|
+
gray: 290.81,
|
|
59
|
+
red: 28.33,
|
|
60
|
+
pink: 5,
|
|
61
|
+
grape: 327.38,
|
|
62
|
+
violet: 327.38,
|
|
63
|
+
indigo: 303.5,
|
|
64
|
+
cyan: 255.96,
|
|
65
|
+
teal: 185.37,
|
|
66
|
+
green: 139.74,
|
|
67
|
+
lime: 116.65,
|
|
68
|
+
yellow: 80.94,
|
|
69
|
+
orange: 66.54
|
|
70
|
+
};
|
|
71
|
+
const FILL_CHROMA = {
|
|
72
|
+
gray: 4.72,
|
|
73
|
+
red: 64.31,
|
|
74
|
+
pink: 66.76,
|
|
75
|
+
grape: 65.38,
|
|
76
|
+
violet: 65.38,
|
|
77
|
+
indigo: 73.89,
|
|
78
|
+
cyan: 35.19,
|
|
79
|
+
teal: 32,
|
|
80
|
+
green: 60.84,
|
|
81
|
+
lime: 51.45,
|
|
82
|
+
yellow: 54.14,
|
|
83
|
+
orange: 55.69
|
|
84
|
+
};
|
|
85
|
+
const FILL_CHROMA_MIN = 4;
|
|
86
|
+
const FILL_CHROMA_MAX = 90;
|
|
87
|
+
const FILL_ORDER = [
|
|
88
|
+
"gray",
|
|
89
|
+
"red",
|
|
90
|
+
"pink",
|
|
91
|
+
"grape",
|
|
92
|
+
"violet",
|
|
93
|
+
"indigo",
|
|
94
|
+
"cyan",
|
|
95
|
+
"teal",
|
|
96
|
+
"green",
|
|
97
|
+
"lime",
|
|
98
|
+
"yellow",
|
|
99
|
+
"orange"
|
|
100
|
+
];
|
|
101
|
+
const NEUTRAL_PRESETS = {
|
|
102
|
+
zinc: { hue: 290.7, chroma: 2 },
|
|
103
|
+
neutral: { hue: 0, chroma: 0 },
|
|
104
|
+
stone: { hue: 70, chroma: 4 },
|
|
105
|
+
slate: { hue: 260, chroma: 5 }
|
|
106
|
+
};
|
|
107
|
+
const SURFACE_TONE = {
|
|
108
|
+
light: {
|
|
109
|
+
bg: 93.45,
|
|
110
|
+
panel: 96.21,
|
|
111
|
+
panelHover: 98.27,
|
|
112
|
+
elevated: 98.27,
|
|
113
|
+
subtle: 94.15,
|
|
114
|
+
field: 100,
|
|
115
|
+
border: 87.86,
|
|
116
|
+
hairline: 90.94
|
|
117
|
+
},
|
|
118
|
+
dark: {
|
|
119
|
+
bg: 13.82,
|
|
120
|
+
panel: 15.75,
|
|
121
|
+
panelHover: 21.42,
|
|
122
|
+
elevated: 21.42,
|
|
123
|
+
subtle: 18.69,
|
|
124
|
+
field: 13.82,
|
|
125
|
+
border: 26.89,
|
|
126
|
+
hairline: 31.29
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const INK_TONE = {
|
|
130
|
+
light: { ink: 15.16, ink2: 27.09, muted: 34.88, faint: 48.44 },
|
|
131
|
+
dark: { ink: 90.94, ink2: 88.12, muted: 84.91, faint: 66.24 }
|
|
132
|
+
};
|
|
133
|
+
const STATUS_HUE = { good: 151.975, warn: 76.64, bad: 29.905 };
|
|
134
|
+
const STATUS_STOP = {
|
|
135
|
+
good: { light: { tone: 45.75, chroma: 37.75 }, dark: { tone: 70.23, chroma: 53.23 } },
|
|
136
|
+
warn: { light: { tone: 54.64, chroma: 61.12 }, dark: { tone: 72.34, chroma: 62.55 } },
|
|
137
|
+
bad: { light: { tone: 43.86, chroma: 54.46 }, dark: { tone: 58.58, chroma: 53.79 } }
|
|
138
|
+
};
|
|
139
|
+
function deriveTokens(config) {
|
|
140
|
+
assertValidAccentHex(config.accent);
|
|
141
|
+
return deriveTokensRaw(config, {
|
|
142
|
+
chromaMult: vibrancyChromaMult(config.vibrancy),
|
|
143
|
+
accentToneShift: config.accentBrightness * ACCENT_BRIGHTNESS_TONE_STEP,
|
|
144
|
+
lightSurfaceShift: SURFACE_LEVEL_TONE_STEP * config.lightLevel + SURFACE_BASELINE_TONE_SHIFT,
|
|
145
|
+
darkSurfaceShift: SURFACE_LEVEL_TONE_STEP * config.darkLevel + SURFACE_BASELINE_TONE_SHIFT
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function deriveTokensRaw(config, params) {
|
|
149
|
+
const seed = hexToHct(config.accent);
|
|
150
|
+
const { chromaMult, accentToneShift } = params;
|
|
151
|
+
const bandTone = yToTone(FILL_LUMINANCE);
|
|
152
|
+
const fillChroma = Math.max(seed.chroma, 40) * chromaMult;
|
|
153
|
+
const neutral = NEUTRAL_PRESETS[config.neutral];
|
|
154
|
+
const surfaceShift = {
|
|
155
|
+
light: params.lightSurfaceShift,
|
|
156
|
+
dark: params.darkSurfaceShift
|
|
157
|
+
};
|
|
158
|
+
const pageBg = {
|
|
159
|
+
light: hctToHex({
|
|
160
|
+
hue: neutral.hue,
|
|
161
|
+
chroma: neutral.chroma,
|
|
162
|
+
tone: clamp(SURFACE_TONE.light.bg + surfaceShift.light, 0, 100)
|
|
163
|
+
}),
|
|
164
|
+
dark: hctToHex({
|
|
165
|
+
hue: neutral.hue,
|
|
166
|
+
chroma: neutral.chroma,
|
|
167
|
+
tone: clamp(SURFACE_TONE.dark.bg + surfaceShift.dark, 0, 100)
|
|
168
|
+
})
|
|
169
|
+
};
|
|
170
|
+
const fillTone = clampFillTone(bandTone + accentToneShift, bandTone, seed.hue, fillChroma, pageBg);
|
|
171
|
+
const accentFill = hctToHex({ hue: seed.hue, chroma: fillChroma, tone: fillTone });
|
|
172
|
+
const accentFillHover = hctToHex({
|
|
173
|
+
hue: seed.hue,
|
|
174
|
+
chroma: fillChroma + FILL_HOVER_CHROMA_DELTA * chromaMult,
|
|
175
|
+
tone: fillTone - FILL_HOVER_TONE_DELTA
|
|
176
|
+
});
|
|
177
|
+
const accentInkDark = hctToHex({
|
|
178
|
+
hue: seed.hue,
|
|
179
|
+
chroma: ACCENT_INK_DARK_CHROMA * chromaMult,
|
|
180
|
+
tone: ACCENT_INK_DARK_TONE + accentToneShift
|
|
181
|
+
});
|
|
182
|
+
const accentHoverDark = hctToHex({
|
|
183
|
+
hue: seed.hue,
|
|
184
|
+
chroma: (ACCENT_INK_DARK_CHROMA + ACCENT_HOVER_DARK_CHROMA_DELTA) * chromaMult,
|
|
185
|
+
tone: ACCENT_INK_DARK_TONE + accentToneShift - ACCENT_HOVER_DARK_TONE_DELTA
|
|
186
|
+
});
|
|
187
|
+
const onAccent = contrastRatio(accentFill, "#ffffff") >= ON_ACCENT_WHITE_CONTRAST_MIN ? "#ffffff" : hctToHex({ hue: seed.hue, chroma: ON_ACCENT_DARK_CHROMA, tone: ON_ACCENT_DARK_TONE });
|
|
188
|
+
const fill = {};
|
|
189
|
+
for (const family of FILL_ORDER) {
|
|
190
|
+
const chroma = clamp(FILL_CHROMA[family], FILL_CHROMA_MIN, FILL_CHROMA_MAX) * chromaMult;
|
|
191
|
+
const hex = hctToHex({ hue: FILL_HUE[family], chroma, tone: bandTone });
|
|
192
|
+
fill[family] = { light: hex, dark: hex };
|
|
193
|
+
}
|
|
194
|
+
const surface = {};
|
|
195
|
+
for (const key of Object.keys(SURFACE_TONE.light)) {
|
|
196
|
+
surface[key] = {
|
|
197
|
+
light: hctToHex({
|
|
198
|
+
hue: neutral.hue,
|
|
199
|
+
chroma: neutral.chroma,
|
|
200
|
+
tone: clamp(SURFACE_TONE.light[key] + surfaceShift.light, 0, 100)
|
|
201
|
+
}),
|
|
202
|
+
dark: hctToHex({
|
|
203
|
+
hue: neutral.hue,
|
|
204
|
+
chroma: neutral.chroma,
|
|
205
|
+
tone: clamp(SURFACE_TONE.dark[key] + surfaceShift.dark, 0, 100)
|
|
206
|
+
})
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
const ink = {};
|
|
210
|
+
for (const key of Object.keys(INK_TONE.light)) {
|
|
211
|
+
ink[key] = {
|
|
212
|
+
light: hctToHex({ hue: neutral.hue, chroma: neutral.chroma, tone: INK_TONE.light[key] }),
|
|
213
|
+
dark: hctToHex({ hue: neutral.hue, chroma: neutral.chroma, tone: INK_TONE.dark[key] })
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const status = {};
|
|
217
|
+
for (const key of Object.keys(STATUS_HUE)) {
|
|
218
|
+
const hue = STATUS_HUE[key];
|
|
219
|
+
status[key] = {
|
|
220
|
+
light: hctToHex({
|
|
221
|
+
hue,
|
|
222
|
+
chroma: STATUS_STOP[key].light.chroma,
|
|
223
|
+
tone: STATUS_STOP[key].light.tone
|
|
224
|
+
}),
|
|
225
|
+
dark: hctToHex({
|
|
226
|
+
hue,
|
|
227
|
+
chroma: STATUS_STOP[key].dark.chroma,
|
|
228
|
+
tone: STATUS_STOP[key].dark.tone
|
|
229
|
+
})
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
accent: { light: accentFill, dark: accentInkDark },
|
|
234
|
+
accentHover: { light: accentFillHover, dark: accentHoverDark },
|
|
235
|
+
accentFill: { light: accentFill, dark: accentFill },
|
|
236
|
+
accentFillHover: { light: accentFillHover, dark: accentFillHover },
|
|
237
|
+
onAccent: { light: onAccent, dark: onAccent },
|
|
238
|
+
fill,
|
|
239
|
+
surface,
|
|
240
|
+
ink,
|
|
241
|
+
status
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
export {
|
|
245
|
+
DEFAULT_DERIVE_CONFIG,
|
|
246
|
+
deriveTokens,
|
|
247
|
+
deriveTokensRaw,
|
|
248
|
+
isDefaultDeriveConfig,
|
|
249
|
+
resolveDeriveConfig
|
|
250
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal HCT (Hue, Chroma, Tone) color space implementation, plus a couple of small WCAG
|
|
3
|
+
* helpers. Zero-dependency — every conversion is self-contained (sRGB -> linear -> XYZ ->
|
|
4
|
+
* CIELab -> polar HCT, and back via a 16-iteration chroma-reduction gamut search).
|
|
5
|
+
*
|
|
6
|
+
* Pure math/data — no React, no `@mantine/*`, no browser APIs (the Mantine-free boundary applies
|
|
7
|
+
* to `src/tokens/**`, which this satisfies naturally). See `derive.ts` for the basalt-specific
|
|
8
|
+
* palette derivation built on top of this.
|
|
9
|
+
*/
|
|
10
|
+
export type HCT = {
|
|
11
|
+
hue: number;
|
|
12
|
+
chroma: number;
|
|
13
|
+
tone: number;
|
|
14
|
+
};
|
|
15
|
+
/** Tone (L*, 0-100) -> relative luminance Y (0-1). */
|
|
16
|
+
export declare function toneToY(tone: number): number;
|
|
17
|
+
/** Relative luminance Y (0-1) -> tone (L*, 0-100). */
|
|
18
|
+
export declare function yToTone(y: number): number;
|
|
19
|
+
/** Convert a hex color to HCT. Hue: 0-360, Chroma: 0-~120, Tone: 0-100. */
|
|
20
|
+
export declare function hexToHct(hex: string): HCT;
|
|
21
|
+
/** Convert HCT to hex, with gamut mapping (chroma reduction to find the closest in-gamut sRGB). */
|
|
22
|
+
export declare function hctToHex(hct: HCT): string;
|
|
23
|
+
/** Generate a tonal palette: hex colors at standard tones for a given hue and chroma. */
|
|
24
|
+
export declare function tonalPalette(hue: number, chroma: number): {
|
|
25
|
+
tone: number;
|
|
26
|
+
hex: string;
|
|
27
|
+
}[];
|
|
28
|
+
/** WCAG relative luminance (0-1) of a hex color — the same linear-light weighted sum as XYZ Y. */
|
|
29
|
+
export declare function relativeLuminance(hex: string): number;
|
|
30
|
+
/** WCAG contrast ratio between two hex colors (1-21, order-independent). */
|
|
31
|
+
export declare function contrastRatio(hexA: string, hexB: string): number;
|
|
32
|
+
/** CIE76 ΔE*ab between two hex colors, via their HCT (polar Lab) representations. */
|
|
33
|
+
export declare function deltaE76(hexA: string, hexB: string): number;
|
|
34
|
+
//# sourceMappingURL=hct.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hct.d.ts","sourceRoot":"","sources":["../../src/tokens/hct.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,MAAM,MAAM,GAAG,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AA8D/D,sDAAsD;AACtD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,sDAAsD;AACtD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzC;AAiCD,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAczC;AAmCD,mGAAmG;AACnG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CA0BzC;AAMD,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAEzF;AAID,kGAAkG;AAClG,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMhE;AAED,qFAAqF;AACrF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ3D"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
function srgbToLinear(c) {
|
|
2
|
+
const s = c / 255;
|
|
3
|
+
return s <= 0.04045 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
|
|
4
|
+
}
|
|
5
|
+
function linearToSrgb(c) {
|
|
6
|
+
const s = c <= 31308e-7 ? c * 12.92 : 1.055 * Math.pow(c, 1 / 2.4) - 0.055;
|
|
7
|
+
return Math.round(Math.min(255, Math.max(0, s * 255)));
|
|
8
|
+
}
|
|
9
|
+
function linearRgbToXyz(r, g, b) {
|
|
10
|
+
return [
|
|
11
|
+
0.4124564 * r + 0.3575761 * g + 0.1804375 * b,
|
|
12
|
+
0.2126729 * r + 0.7151522 * g + 0.072175 * b,
|
|
13
|
+
0.0193339 * r + 0.119192 * g + 0.9503041 * b
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
function xyzToLinearRgb(x, y, z) {
|
|
17
|
+
return [
|
|
18
|
+
3.2404542 * x - 1.5371385 * y - 0.4985314 * z,
|
|
19
|
+
-0.969266 * x + 1.8760108 * y + 0.041556 * z,
|
|
20
|
+
0.0556434 * x - 0.2040259 * y + 1.0572252 * z
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
const D65_WHITE = [0.95047, 1, 1.08883];
|
|
24
|
+
function labF(t) {
|
|
25
|
+
const delta = 6 / 29;
|
|
26
|
+
return t > delta * delta * delta ? Math.cbrt(t) : t / (3 * delta * delta) + 4 / 29;
|
|
27
|
+
}
|
|
28
|
+
function labFInv(t) {
|
|
29
|
+
const delta = 6 / 29;
|
|
30
|
+
return t > delta ? t * t * t : 3 * delta * delta * (t - 4 / 29);
|
|
31
|
+
}
|
|
32
|
+
function xyzToLab(x, y, z) {
|
|
33
|
+
const fx = labF(x / D65_WHITE[0]);
|
|
34
|
+
const fy = labF(y / D65_WHITE[1]);
|
|
35
|
+
const fz = labF(z / D65_WHITE[2]);
|
|
36
|
+
return [116 * fy - 16, 500 * (fx - fy), 200 * (fy - fz)];
|
|
37
|
+
}
|
|
38
|
+
function labToXyz(lStar, a, b) {
|
|
39
|
+
const fy = (lStar + 16) / 116;
|
|
40
|
+
const fx = a / 500 + fy;
|
|
41
|
+
const fz = fy - b / 200;
|
|
42
|
+
return [labFInv(fx) * D65_WHITE[0], labFInv(fy) * D65_WHITE[1], labFInv(fz) * D65_WHITE[2]];
|
|
43
|
+
}
|
|
44
|
+
function toneToY(tone) {
|
|
45
|
+
return labFInv((tone + 16) / 116);
|
|
46
|
+
}
|
|
47
|
+
function yToTone(y) {
|
|
48
|
+
return 116 * labF(y) - 16;
|
|
49
|
+
}
|
|
50
|
+
function expandShorthand(body) {
|
|
51
|
+
return body.split("").map((c) => c + c).join("");
|
|
52
|
+
}
|
|
53
|
+
function hexToRgb(hex) {
|
|
54
|
+
const body = hex.trim().replace(/^#/, "");
|
|
55
|
+
const normalized = body.length === 3 ? expandShorthand(body) : body;
|
|
56
|
+
return [
|
|
57
|
+
Number.parseInt(normalized.slice(0, 2), 16),
|
|
58
|
+
Number.parseInt(normalized.slice(2, 4), 16),
|
|
59
|
+
Number.parseInt(normalized.slice(4, 6), 16)
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
function hexChannel(c) {
|
|
63
|
+
return Math.max(0, Math.min(255, Math.round(c))).toString(16).padStart(2, "0");
|
|
64
|
+
}
|
|
65
|
+
function formatHex(r, g, b) {
|
|
66
|
+
return `#${hexChannel(r)}${hexChannel(g)}${hexChannel(b)}`;
|
|
67
|
+
}
|
|
68
|
+
function hexToHct(hex) {
|
|
69
|
+
const [r, g, b] = hexToRgb(hex);
|
|
70
|
+
const lr = srgbToLinear(r);
|
|
71
|
+
const lg = srgbToLinear(g);
|
|
72
|
+
const lb = srgbToLinear(b);
|
|
73
|
+
const [x, y, z] = linearRgbToXyz(lr, lg, lb);
|
|
74
|
+
const [lStar, a, bLab] = xyzToLab(x, y, z);
|
|
75
|
+
const hueRad = Math.atan2(bLab, a);
|
|
76
|
+
let hue = hueRad * 180 / Math.PI;
|
|
77
|
+
if (hue < 0) hue += 360;
|
|
78
|
+
const chroma = Math.sqrt(a * a + bLab * bLab);
|
|
79
|
+
return { hue, chroma, tone: Math.max(0, Math.min(100, lStar)) };
|
|
80
|
+
}
|
|
81
|
+
function toneToGray(tone) {
|
|
82
|
+
return linearToSrgb(toneToY(tone));
|
|
83
|
+
}
|
|
84
|
+
function hctComponentToHex(hue, chroma, tone) {
|
|
85
|
+
const hueRad = hue * Math.PI / 180;
|
|
86
|
+
const a = Math.cos(hueRad) * chroma;
|
|
87
|
+
const b = Math.sin(hueRad) * chroma;
|
|
88
|
+
const [x, y, z] = labToXyz(tone, a, b);
|
|
89
|
+
const [lr, lg, lb] = xyzToLinearRgb(x, y, z);
|
|
90
|
+
const r = linearToSrgb(lr);
|
|
91
|
+
const g = linearToSrgb(lg);
|
|
92
|
+
const bVal = linearToSrgb(lb);
|
|
93
|
+
const rLin = srgbToLinear(r);
|
|
94
|
+
const gLin = srgbToLinear(g);
|
|
95
|
+
const bLin = srgbToLinear(bVal);
|
|
96
|
+
const tolerance = 0.02;
|
|
97
|
+
if (Math.abs(rLin - lr) > tolerance || Math.abs(gLin - lg) > tolerance || Math.abs(bLin - lb) > tolerance) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
if (r < 0 || r > 255 || g < 0 || g > 255 || bVal < 0 || bVal > 255) return null;
|
|
101
|
+
return formatHex(r, g, bVal);
|
|
102
|
+
}
|
|
103
|
+
function hctToHex(hct) {
|
|
104
|
+
const { hue, chroma, tone } = hct;
|
|
105
|
+
if (tone <= 0) return "#000000";
|
|
106
|
+
if (tone >= 100) return "#ffffff";
|
|
107
|
+
if (chroma < 0.5) {
|
|
108
|
+
const gray = toneToGray(tone);
|
|
109
|
+
return formatHex(gray, gray, gray);
|
|
110
|
+
}
|
|
111
|
+
let lo = 0;
|
|
112
|
+
let hi = chroma;
|
|
113
|
+
let bestHex = "#000000";
|
|
114
|
+
for (let i = 0; i < 16; i++) {
|
|
115
|
+
const mid = (lo + hi) / 2;
|
|
116
|
+
const candidate = hctComponentToHex(hue, mid, tone);
|
|
117
|
+
if (candidate !== null) {
|
|
118
|
+
bestHex = candidate;
|
|
119
|
+
lo = mid;
|
|
120
|
+
} else {
|
|
121
|
+
hi = mid;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return bestHex;
|
|
125
|
+
}
|
|
126
|
+
const PALETTE_TONES = [0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 99, 100];
|
|
127
|
+
function tonalPalette(hue, chroma) {
|
|
128
|
+
return PALETTE_TONES.map((tone) => ({ tone, hex: hctToHex({ hue, chroma, tone }) }));
|
|
129
|
+
}
|
|
130
|
+
function relativeLuminance(hex) {
|
|
131
|
+
const [r, g, b] = hexToRgb(hex);
|
|
132
|
+
return 0.2126729 * srgbToLinear(r) + 0.7151522 * srgbToLinear(g) + 0.072175 * srgbToLinear(b);
|
|
133
|
+
}
|
|
134
|
+
function contrastRatio(hexA, hexB) {
|
|
135
|
+
const lA = relativeLuminance(hexA);
|
|
136
|
+
const lB = relativeLuminance(hexB);
|
|
137
|
+
const lighter = Math.max(lA, lB);
|
|
138
|
+
const darker = Math.min(lA, lB);
|
|
139
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
140
|
+
}
|
|
141
|
+
function deltaE76(hexA, hexB) {
|
|
142
|
+
const a = hexToHct(hexA);
|
|
143
|
+
const b = hexToHct(hexB);
|
|
144
|
+
const aRad = a.hue * Math.PI / 180;
|
|
145
|
+
const bRad = b.hue * Math.PI / 180;
|
|
146
|
+
const aLab = { l: a.tone, a: Math.cos(aRad) * a.chroma, b: Math.sin(aRad) * a.chroma };
|
|
147
|
+
const bLab = { l: b.tone, a: Math.cos(bRad) * b.chroma, b: Math.sin(bRad) * b.chroma };
|
|
148
|
+
return Math.sqrt((aLab.l - bLab.l) ** 2 + (aLab.a - bLab.a) ** 2 + (aLab.b - bLab.b) ** 2);
|
|
149
|
+
}
|
|
150
|
+
export {
|
|
151
|
+
contrastRatio,
|
|
152
|
+
deltaE76,
|
|
153
|
+
hctToHex,
|
|
154
|
+
hexToHct,
|
|
155
|
+
relativeLuminance,
|
|
156
|
+
tonalPalette,
|
|
157
|
+
toneToY,
|
|
158
|
+
yToTone
|
|
159
|
+
};
|
package/dist/tokens/index.d.ts
CHANGED
|
@@ -8,7 +8,14 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Grounded in argo `packages/charts/src/{tokens,palette,theme-vars,utils/color}.ts`.
|
|
10
10
|
*/
|
|
11
|
+
import type { PaletteData, RadiusValues, SpaceValues } from './palette.js';
|
|
11
12
|
export { BP, p } from './palette.js';
|
|
13
|
+
export { DEFAULT_DERIVE_CONFIG, deriveTokens, resolveDeriveConfig } from './derive.js';
|
|
14
|
+
export type { DeriveConfig, DerivedPalette } from './derive.js';
|
|
15
|
+
export { deriveRadius } from './palette.js';
|
|
16
|
+
export type { RadiusValues } from './palette.js';
|
|
17
|
+
export { deriveSpacing } from './palette.js';
|
|
18
|
+
export type { SpaceValues } from './palette.js';
|
|
12
19
|
/** A per-theme color pair: a hue keeps its identity but shifts shade across schemes. */
|
|
13
20
|
export type ColorPair = {
|
|
14
21
|
light: string;
|
|
@@ -28,9 +35,9 @@ export declare const VX: {
|
|
|
28
35
|
readonly lineWidth: 2.5;
|
|
29
36
|
readonly line2Width: 2;
|
|
30
37
|
readonly axisFont: 11;
|
|
31
|
-
readonly dotR:
|
|
38
|
+
readonly dotR: number;
|
|
32
39
|
readonly dashArray: "6 4";
|
|
33
|
-
readonly legendGap:
|
|
40
|
+
readonly legendGap: number;
|
|
34
41
|
readonly legendFontSize: 13.5;
|
|
35
42
|
readonly text: {
|
|
36
43
|
readonly micro: 11;
|
|
@@ -45,6 +52,7 @@ export declare const VX: {
|
|
|
45
52
|
};
|
|
46
53
|
readonly radiusCard: "var(--vx-radius-card)";
|
|
47
54
|
readonly radiusCtrl: "var(--vx-radius-ctrl)";
|
|
55
|
+
readonly radiusPill: "var(--vx-radius-pill)";
|
|
48
56
|
readonly line2Dark: "var(--vx-line2)";
|
|
49
57
|
readonly good: "var(--vx-good)";
|
|
50
58
|
readonly goodSoft: "var(--vx-goodSoft)";
|
|
@@ -98,13 +106,23 @@ export declare const VX: {
|
|
|
98
106
|
readonly neutral: "var(--vx-status-neutral)";
|
|
99
107
|
};
|
|
100
108
|
readonly margin: {
|
|
101
|
-
readonly top:
|
|
102
|
-
readonly right:
|
|
103
|
-
readonly bottom:
|
|
104
|
-
readonly left:
|
|
109
|
+
readonly top: number;
|
|
110
|
+
readonly right: number;
|
|
111
|
+
readonly bottom: number;
|
|
112
|
+
readonly left: number;
|
|
105
113
|
};
|
|
106
114
|
readonly minPxPerTick: 55;
|
|
107
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* A px number expressed as the plain rem STRING literal (16px base: `pxRem(6)` → `'0.375rem'`) —
|
|
118
|
+
* NOT Mantine's own `rem()` helper, which instead emits a `calc(...)` expression bound to
|
|
119
|
+
* `--mantine-scale` (a different value; that scaling happens at the Mantine-coupled call site
|
|
120
|
+
* instead — see `theme/index.ts`'s `Input.extend` `vars` for why `--vx-space-input-height` needs
|
|
121
|
+
* both halves). The SINGLE source for this conversion — `theme/index.ts` imports this instead of
|
|
122
|
+
* keeping its own copy, so the radius/spacing size-scale steps and this module's own rem-emitting
|
|
123
|
+
* vars (`--vx-space-input-height`) can never compute the conversion two different ways.
|
|
124
|
+
*/
|
|
125
|
+
export declare function pxRem(px: number): string;
|
|
108
126
|
/**
|
|
109
127
|
* Wrap a map of `{ name: ColorPair }` into `var(--vx-<prefix><name>)` token refs — the runtime
|
|
110
128
|
* companion to `buildPaletteCss`. Lets a consumer define its own series and read stable refs.
|
|
@@ -145,8 +163,54 @@ export type BuildPaletteOpts = {
|
|
|
145
163
|
* built in, so an empty `buildPaletteCss()` already emits every framework var. Consumer
|
|
146
164
|
* `opts.groups` / `opts.derived` append on top (e.g. argo's domain SERIES/ACTIVITY/USAGE).
|
|
147
165
|
*
|
|
166
|
+
* `data` defaults to the static, shipped palette (`buildPaletteData()` at `DEFAULT_DERIVE_CONFIG`)
|
|
167
|
+
* — pass the result of `buildPaletteData(config)` to emit CSS for a retuned derive config instead
|
|
168
|
+
* (this is how `BasaltProvider` follows `createBasaltTheme`'s `{ derive }` option; see `../theme`
|
|
169
|
+
* and `../provider`).
|
|
170
|
+
*
|
|
148
171
|
* Dark is the default (`:root`) since the framework defaults to dark; the
|
|
149
172
|
* `[data-mantine-color-scheme]` selectors track Mantine's toggle on `<html>`.
|
|
150
173
|
*/
|
|
151
|
-
export declare function buildPaletteCss(opts?: BuildPaletteOpts): string;
|
|
174
|
+
export declare function buildPaletteCss(opts?: BuildPaletteOpts, data?: PaletteData): string;
|
|
175
|
+
/**
|
|
176
|
+
* The `fonts` option's resolved shape — a full CSS font-family stack string per slot (with its own
|
|
177
|
+
* fallback chain), riding the `--basalt-font-sans/head/mono` override seam `styles.css` ships
|
|
178
|
+
* fallbacks for. Omitted keys keep the shipped fallback untouched. Lives here (not in `../theme`,
|
|
179
|
+
* which only RE-EXPORTS it) because its builder `buildFontsCss` below is a pure, Mantine-free
|
|
180
|
+
* string builder that belongs in the tokens layer — see `../theme`'s
|
|
181
|
+
* `CreateBasaltThemeOptions.fonts` for the production entry point that sets it.
|
|
182
|
+
*/
|
|
183
|
+
export type BasaltFontsConfig = {
|
|
184
|
+
sans?: string;
|
|
185
|
+
head?: string;
|
|
186
|
+
mono?: string;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Build the `:root` block of `--basalt-font-*` declarations for a resolved `basaltFonts` config —
|
|
190
|
+
* only for the keys the consumer actually set (`createBasaltTheme(overrides, { fonts })`); an
|
|
191
|
+
* omitted key keeps the shipped `styles.css` fallback chain untouched. Empty string when `fonts` is
|
|
192
|
+
* absent or every key is omitted, so callers can unconditionally concatenate the result. Importable
|
|
193
|
+
* from `basalt-ui/tokens` — `BasaltProvider`'s bridge (`../provider`) calls this directly to append
|
|
194
|
+
* declarations to its injected `<style>`; an SSR/custom-injection consumer with
|
|
195
|
+
* `injectPalette={false}` calls it themselves (see the JSDoc on that prop).
|
|
196
|
+
*/
|
|
197
|
+
export declare function buildFontsCss(fonts: BasaltFontsConfig | undefined): string;
|
|
198
|
+
/**
|
|
199
|
+
* Build the `:root` block of overriding `--vx-radius-*` declarations for a resolved
|
|
200
|
+
* `basaltRadius` value (`createBasaltTheme(overrides, { radius })`) — analog of {@link buildFontsCss}.
|
|
201
|
+
* Empty string when `radius` is absent (the default level-0 path never sets `theme.other.basaltRadius`
|
|
202
|
+
* in the first place), so callers can unconditionally concatenate the result. Importable from
|
|
203
|
+
* `basalt-ui/tokens`, same SSR/custom-injection use as `buildFontsCss` above.
|
|
204
|
+
*/
|
|
205
|
+
export declare function buildRadiusCss(radius: RadiusValues | undefined): string;
|
|
206
|
+
/**
|
|
207
|
+
* Build the `:root` block of overriding `--vx-space-*` declarations for a resolved `basaltDensity`
|
|
208
|
+
* value (`createBasaltTheme(overrides, { density })`) — analog of {@link buildRadiusCss}, reusing
|
|
209
|
+
* the SAME `spaceDecls` list `frameworkDerived` emits the shipped defaults from (so the two can
|
|
210
|
+
* never drift). Empty string when `space` is absent (the default level-0 path never sets
|
|
211
|
+
* `theme.other.basaltDensity` in the first place), so callers can unconditionally concatenate the
|
|
212
|
+
* result. Importable from `basalt-ui/tokens`, same SSR/custom-injection use as `buildRadiusCss`
|
|
213
|
+
* above.
|
|
214
|
+
*/
|
|
215
|
+
export declare function buildDensityCss(space: SpaceValues | undefined): string;
|
|
152
216
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAMvE,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,WAAW,CAAA;AAOjC,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnF,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAM5D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAO7C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,wFAAwF;AACxF,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD,8FAA8F;AAC9F,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,GAAG,MAAM,KAAG,MACoB,CAAA;AAsCrE,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsIL,CAAA;AAOV;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAExC;AAqSD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,EACpD,GAAG,EAAE,CAAC,EACN,MAAM,SAAK,GACV;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CAAE,CAI5B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,EACnD,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,CAAC,GACL;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CAAE,CAE5B;AAED,2CAA2C;AAC3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,+GAA+G;IAC/G,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAClC,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,IAAI,GAAE,gBAAqB,EAC3B,IAAI,GAAE,WAAgC,GACrC,MAAM,CAsBR;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AASD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,GAAG,MAAM,CAkB1E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,CASvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAGtE"}
|