basalt-ui 1.1.1 → 1.3.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 +46 -0
- package/README.md +64 -8
- package/agent/rules/basalt-app.md +126 -0
- package/agent/rules/basalt-content.md +3 -1
- package/agent/rules/basalt-tokens.md +14 -5
- package/agent/skills/basalt-app/SKILL.md +28 -7
- 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 +29 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +80 -9
- 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 +266 -38
- 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 +22 -11
- package/dist/surfaces.d.ts +21 -11
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +10 -3
- 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 +143 -7
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +322 -48
- 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/tokens.css +248 -0
- 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 +14 -4
- package/package.json +41 -10
- 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 +129 -6
- package/src/cli/tokens-css.test.ts +90 -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 +483 -15
- package/src/guard/index.ts +426 -47
- 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 +22 -11
- package/src/surfaces.ts +24 -10
- 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 +534 -48
- 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
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import { searchForWorkspaceRoot } from "vite";
|
|
3
|
+
import { SURFACE } from "./tokens/palette.js";
|
|
4
|
+
import { resolveColorMix } from "./vite-color-mix.js";
|
|
3
5
|
function basaltViteConfig(opts) {
|
|
4
6
|
const { port, host, allowedHosts, apiTarget, version = "0.0.0" } = opts;
|
|
5
7
|
const basaltSrc = opts.basaltSrc ?? process.env["BASALT_LOCAL"];
|
|
@@ -63,6 +65,316 @@ function basaltViteConfig(opts) {
|
|
|
63
65
|
}
|
|
64
66
|
return config;
|
|
65
67
|
}
|
|
68
|
+
const ICON_FILES = {
|
|
69
|
+
favicon: "favicon.ico",
|
|
70
|
+
svg: "favicon.svg",
|
|
71
|
+
png96: "favicon-96x96.png",
|
|
72
|
+
appleTouch: "apple-touch-icon.png",
|
|
73
|
+
manifest192: "web-app-manifest-192x192.png",
|
|
74
|
+
manifest512: "web-app-manifest-512x512.png"
|
|
75
|
+
};
|
|
76
|
+
const DEFAULT_SERVICE_WORKER_OPTIONS = {
|
|
77
|
+
registerType: "autoUpdate",
|
|
78
|
+
injectRegister: "auto",
|
|
79
|
+
// We emit our own manifest (theme-color-resolved, site.webmanifest) — never let VitePWA emit one.
|
|
80
|
+
manifest: false,
|
|
81
|
+
workbox: {
|
|
82
|
+
globPatterns: ["**/*.{js,css,html,svg,png,ico,woff2}"],
|
|
83
|
+
navigateFallback: "/index.html",
|
|
84
|
+
navigateFallbackDenylist: [/^\/api/],
|
|
85
|
+
cleanupOutdatedCaches: true,
|
|
86
|
+
clientsClaim: true,
|
|
87
|
+
maximumFileSizeToCacheInBytes: 3 * 1024 * 1024
|
|
88
|
+
},
|
|
89
|
+
devOptions: { enabled: false }
|
|
90
|
+
};
|
|
91
|
+
function isPlainObject(value) {
|
|
92
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
93
|
+
}
|
|
94
|
+
function deepMerge(base, overrides) {
|
|
95
|
+
const result = { ...base };
|
|
96
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
97
|
+
const baseValue = result[key];
|
|
98
|
+
result[key] = isPlainObject(baseValue) && isPlainObject(value) ? deepMerge(baseValue, value) : value;
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
function resolveThemeColors(themeColor) {
|
|
103
|
+
if (themeColor === void 0 || themeColor === "auto") {
|
|
104
|
+
return { light: resolveColorMix(SURFACE.bg.light), dark: resolveColorMix(SURFACE.bg.dark) };
|
|
105
|
+
}
|
|
106
|
+
return themeColor;
|
|
107
|
+
}
|
|
108
|
+
function withIconPath(dir, file) {
|
|
109
|
+
if (!dir) return `/${file}`;
|
|
110
|
+
const trimmed = dir.replace(/^\/+|\/+$/g, "");
|
|
111
|
+
return trimmed ? `/${trimmed}/${file}` : `/${file}`;
|
|
112
|
+
}
|
|
113
|
+
function withBase(base, path) {
|
|
114
|
+
return base + path.slice(1);
|
|
115
|
+
}
|
|
116
|
+
function hasViewportMeta(html) {
|
|
117
|
+
return /<meta\s+[^>]*name=["']viewport["']/i.test(html);
|
|
118
|
+
}
|
|
119
|
+
const VIEWPORT_TAG = {
|
|
120
|
+
tag: "meta",
|
|
121
|
+
attrs: { name: "viewport", content: "width=device-width, initial-scale=1.0, viewport-fit=cover" }
|
|
122
|
+
};
|
|
123
|
+
function buildSeoTags(input) {
|
|
124
|
+
const { name, description, seo } = input;
|
|
125
|
+
const tags = [];
|
|
126
|
+
if (description) {
|
|
127
|
+
tags.push({ tag: "meta", attrs: { name: "description", content: description } });
|
|
128
|
+
}
|
|
129
|
+
if (description || seo?.url || seo?.image) {
|
|
130
|
+
if (seo?.url) {
|
|
131
|
+
tags.push(
|
|
132
|
+
{ tag: "link", attrs: { rel: "canonical", href: seo.url } },
|
|
133
|
+
{ tag: "meta", attrs: { property: "og:url", content: seo.url } }
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
tags.push(
|
|
137
|
+
{ tag: "meta", attrs: { property: "og:type", content: "website" } },
|
|
138
|
+
{ tag: "meta", attrs: { property: "og:title", content: name } }
|
|
139
|
+
);
|
|
140
|
+
if (description) {
|
|
141
|
+
tags.push({ tag: "meta", attrs: { property: "og:description", content: description } });
|
|
142
|
+
}
|
|
143
|
+
if (seo?.image) {
|
|
144
|
+
tags.push({ tag: "meta", attrs: { property: "og:image", content: seo.image } });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (seo?.twitterCard) {
|
|
148
|
+
tags.push(
|
|
149
|
+
{ tag: "meta", attrs: { name: "twitter:card", content: seo.twitterCard } },
|
|
150
|
+
{ tag: "meta", attrs: { name: "twitter:title", content: name } }
|
|
151
|
+
);
|
|
152
|
+
if (description) {
|
|
153
|
+
tags.push({ tag: "meta", attrs: { name: "twitter:description", content: description } });
|
|
154
|
+
}
|
|
155
|
+
if (seo?.image) {
|
|
156
|
+
tags.push({ tag: "meta", attrs: { name: "twitter:image", content: seo.image } });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return tags;
|
|
160
|
+
}
|
|
161
|
+
function buildStaticTags(input) {
|
|
162
|
+
const {
|
|
163
|
+
options,
|
|
164
|
+
shortName,
|
|
165
|
+
themeColor,
|
|
166
|
+
backgroundColor,
|
|
167
|
+
iconsEnabled,
|
|
168
|
+
iconsDir,
|
|
169
|
+
darkreader,
|
|
170
|
+
manifestEnabled,
|
|
171
|
+
base,
|
|
172
|
+
manifestHref
|
|
173
|
+
} = input;
|
|
174
|
+
const tags = [];
|
|
175
|
+
tags.push(
|
|
176
|
+
{
|
|
177
|
+
tag: "meta",
|
|
178
|
+
attrs: {
|
|
179
|
+
name: "theme-color",
|
|
180
|
+
media: "(prefers-color-scheme: light)",
|
|
181
|
+
content: themeColor.light
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
tag: "meta",
|
|
186
|
+
attrs: {
|
|
187
|
+
name: "theme-color",
|
|
188
|
+
media: "(prefers-color-scheme: dark)",
|
|
189
|
+
content: themeColor.dark
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
tags.push({
|
|
194
|
+
tag: "style",
|
|
195
|
+
children: `html{background-color:${backgroundColor};color-scheme:dark}`
|
|
196
|
+
});
|
|
197
|
+
if (iconsEnabled) {
|
|
198
|
+
tags.push(
|
|
199
|
+
{
|
|
200
|
+
tag: "link",
|
|
201
|
+
attrs: {
|
|
202
|
+
rel: "shortcut icon",
|
|
203
|
+
href: withBase(base, withIconPath(iconsDir, ICON_FILES.favicon))
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
tag: "link",
|
|
208
|
+
attrs: {
|
|
209
|
+
rel: "icon",
|
|
210
|
+
type: "image/svg+xml",
|
|
211
|
+
href: withBase(base, withIconPath(iconsDir, ICON_FILES.svg))
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
tag: "link",
|
|
216
|
+
attrs: {
|
|
217
|
+
rel: "icon",
|
|
218
|
+
sizes: "96x96",
|
|
219
|
+
href: withBase(base, withIconPath(iconsDir, ICON_FILES.png96))
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
tag: "link",
|
|
224
|
+
attrs: {
|
|
225
|
+
rel: "apple-touch-icon",
|
|
226
|
+
sizes: "180x180",
|
|
227
|
+
href: withBase(base, withIconPath(iconsDir, ICON_FILES.appleTouch))
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
tags.push(
|
|
233
|
+
{ tag: "meta", attrs: { name: "apple-mobile-web-app-title", content: shortName } },
|
|
234
|
+
{ tag: "meta", attrs: { name: "apple-mobile-web-app-capable", content: "yes" } },
|
|
235
|
+
{ tag: "meta", attrs: { name: "mobile-web-app-capable", content: "yes" } },
|
|
236
|
+
{ tag: "meta", attrs: { name: "apple-mobile-web-app-status-bar-style", content: "default" } }
|
|
237
|
+
);
|
|
238
|
+
if (darkreader === "lock") {
|
|
239
|
+
tags.push({ tag: "meta", attrs: { name: "darkreader-lock" } });
|
|
240
|
+
}
|
|
241
|
+
if (manifestEnabled) {
|
|
242
|
+
tags.push({ tag: "link", attrs: { rel: "manifest", href: manifestHref } });
|
|
243
|
+
}
|
|
244
|
+
tags.push(
|
|
245
|
+
...buildSeoTags({ name: options.name, description: options.description, seo: options.seo })
|
|
246
|
+
);
|
|
247
|
+
return tags;
|
|
248
|
+
}
|
|
249
|
+
function buildManifestJson(input) {
|
|
250
|
+
const {
|
|
251
|
+
options,
|
|
252
|
+
shortName,
|
|
253
|
+
startUrl,
|
|
254
|
+
scope,
|
|
255
|
+
id,
|
|
256
|
+
display,
|
|
257
|
+
themeColor,
|
|
258
|
+
backgroundColor,
|
|
259
|
+
iconsDir,
|
|
260
|
+
base
|
|
261
|
+
} = input;
|
|
262
|
+
const manifest = {
|
|
263
|
+
id,
|
|
264
|
+
name: options.name,
|
|
265
|
+
short_name: shortName,
|
|
266
|
+
...options.description ? { description: options.description } : {},
|
|
267
|
+
start_url: startUrl,
|
|
268
|
+
scope,
|
|
269
|
+
display,
|
|
270
|
+
theme_color: themeColor.dark,
|
|
271
|
+
background_color: backgroundColor,
|
|
272
|
+
icons: [
|
|
273
|
+
{
|
|
274
|
+
src: withBase(base, withIconPath(iconsDir, ICON_FILES.manifest192)),
|
|
275
|
+
sizes: "192x192",
|
|
276
|
+
type: "image/png"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
src: withBase(base, withIconPath(iconsDir, ICON_FILES.manifest512)),
|
|
280
|
+
sizes: "512x512",
|
|
281
|
+
type: "image/png",
|
|
282
|
+
purpose: "any maskable"
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
};
|
|
286
|
+
return JSON.stringify(manifest, null, 2);
|
|
287
|
+
}
|
|
288
|
+
function createMainPlugin(options) {
|
|
289
|
+
const shortName = options.shortName ?? options.name;
|
|
290
|
+
const display = options.display ?? "standalone";
|
|
291
|
+
const darkreader = options.darkreader ?? "lock";
|
|
292
|
+
const iconsEnabled = options.icons !== false;
|
|
293
|
+
const iconsDir = options.icons === false ? void 0 : options.icons?.dir;
|
|
294
|
+
const manifestEnabled = options.manifest !== false;
|
|
295
|
+
const themeColor = resolveThemeColors(options.themeColor);
|
|
296
|
+
const backgroundColor = options.backgroundColor ?? themeColor.dark;
|
|
297
|
+
let manifestJson = "";
|
|
298
|
+
let manifestHref = "/site.webmanifest";
|
|
299
|
+
let staticTags = [];
|
|
300
|
+
return {
|
|
301
|
+
name: "basalt:app",
|
|
302
|
+
configResolved(config) {
|
|
303
|
+
const base = config.base;
|
|
304
|
+
const startUrl = options.startUrl ?? base;
|
|
305
|
+
const scope = options.scope ?? base;
|
|
306
|
+
const id = options.id ?? startUrl;
|
|
307
|
+
manifestHref = withBase(base, "/site.webmanifest");
|
|
308
|
+
manifestJson = buildManifestJson({
|
|
309
|
+
options,
|
|
310
|
+
shortName,
|
|
311
|
+
startUrl,
|
|
312
|
+
scope,
|
|
313
|
+
id,
|
|
314
|
+
display,
|
|
315
|
+
themeColor,
|
|
316
|
+
backgroundColor,
|
|
317
|
+
iconsDir,
|
|
318
|
+
base
|
|
319
|
+
});
|
|
320
|
+
staticTags = buildStaticTags({
|
|
321
|
+
options,
|
|
322
|
+
shortName,
|
|
323
|
+
themeColor,
|
|
324
|
+
backgroundColor,
|
|
325
|
+
iconsEnabled,
|
|
326
|
+
iconsDir,
|
|
327
|
+
darkreader,
|
|
328
|
+
manifestEnabled,
|
|
329
|
+
base,
|
|
330
|
+
manifestHref
|
|
331
|
+
});
|
|
332
|
+
},
|
|
333
|
+
transformIndexHtml(html) {
|
|
334
|
+
const tags = hasViewportMeta(html) ? staticTags : [VIEWPORT_TAG, ...staticTags];
|
|
335
|
+
return { html, tags };
|
|
336
|
+
},
|
|
337
|
+
generateBundle() {
|
|
338
|
+
if (!manifestEnabled) return;
|
|
339
|
+
this.emitFile({ type: "asset", fileName: "site.webmanifest", source: manifestJson });
|
|
340
|
+
},
|
|
341
|
+
configureServer(server) {
|
|
342
|
+
if (!manifestEnabled) return;
|
|
343
|
+
server.middlewares.use((req, res, next) => {
|
|
344
|
+
if (req.url === manifestHref || req.url === "/site.webmanifest") {
|
|
345
|
+
res.setHeader("Content-Type", "application/manifest+json");
|
|
346
|
+
res.end(manifestJson);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
next();
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
function createServiceWorkerPlugin(serviceWorker) {
|
|
355
|
+
return (async () => {
|
|
356
|
+
let mod;
|
|
357
|
+
try {
|
|
358
|
+
mod = await import("vite-plugin-pwa");
|
|
359
|
+
} catch {
|
|
360
|
+
console.warn(
|
|
361
|
+
'[basalt-ui] serviceWorker was requested but the optional peer "vite-plugin-pwa" (plus its own peers workbox-build, workbox-window) is not installed \u2014 skipping the service worker. Install with: bun add -D vite-plugin-pwa workbox-build workbox-window'
|
|
362
|
+
);
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
const overrides = typeof serviceWorker === "object" ? serviceWorker : {};
|
|
366
|
+
const pwaOptions = deepMerge(DEFAULT_SERVICE_WORKER_OPTIONS, overrides);
|
|
367
|
+
return mod.VitePWA(pwaOptions);
|
|
368
|
+
})();
|
|
369
|
+
}
|
|
370
|
+
function basaltAppPlugin(options) {
|
|
371
|
+
const plugins = [createMainPlugin(options)];
|
|
372
|
+
if (options.serviceWorker) {
|
|
373
|
+
plugins.push(createServiceWorkerPlugin(options.serviceWorker));
|
|
374
|
+
}
|
|
375
|
+
return plugins;
|
|
376
|
+
}
|
|
66
377
|
export {
|
|
378
|
+
basaltAppPlugin,
|
|
67
379
|
basaltViteConfig
|
|
68
380
|
};
|
package/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# basalt-ui v1.
|
|
1
|
+
# basalt-ui v1.3.0
|
|
2
2
|
# Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets
|
|
3
3
|
#
|
|
4
4
|
# basalt-ui is an opinionated framework for Mantine-based React apps.
|
|
@@ -13,9 +13,13 @@
|
|
|
13
13
|
# Subpaths: use the exact import specifier below — do not guess.
|
|
14
14
|
# Charts and tokens are Mantine-free; the root (.) is Mantine-coupled.
|
|
15
15
|
# Optional peers are listed per subpath; install only what you use.
|
|
16
|
+
# Every peer is optional: ./tokens, ./charts, ./state and ./guard resolve with
|
|
17
|
+
# no React and no Mantine installed. A consumer with no React at all can take the
|
|
18
|
+
# token system alone — `bunx basalt-ui tokens:css --out tokens.css`, or the prebuilt
|
|
19
|
+
# ./tokens.css subpath. Guide: docs/FRAMEWORK-FREE.md in the repo.
|
|
16
20
|
|
|
17
21
|
Package: basalt-ui
|
|
18
|
-
Version: 1.
|
|
22
|
+
Version: 1.3.0
|
|
19
23
|
|
|
20
24
|
## basalt-ui
|
|
21
25
|
Import: import { ... } from 'basalt-ui'
|
|
@@ -38,13 +42,14 @@ Rule: basalt-tokens
|
|
|
38
42
|
|
|
39
43
|
## basalt-ui/theme-lab
|
|
40
44
|
Import: import { ... } from 'basalt-ui/theme-lab'
|
|
41
|
-
Description: ThemeLabControls, applyOverrides, COLOR_GROUPS for
|
|
45
|
+
Description: ThemeLabControls, applyOverrides, COLOR_GROUPS — a low-level inspector for the non-derived structural tokens; identity/color tuning lives in DeriveControls
|
|
42
46
|
Layer: mantine-coupled
|
|
43
47
|
|
|
44
48
|
## basalt-ui/vite
|
|
45
49
|
Import: import { ... } from 'basalt-ui/vite'
|
|
46
|
-
Description: basaltViteConfig(opts) — Vite preset for basalt-ui consumer apps
|
|
50
|
+
Description: basaltViteConfig(opts) — Vite preset for basalt-ui consumer apps; basaltAppPlugin(opts) — PWA head, manifest, and icon metadata derived from the token palette
|
|
47
51
|
Layer: mantine-coupled
|
|
52
|
+
OptionalPeers: vite-plugin-pwa@^1.3.0
|
|
48
53
|
|
|
49
54
|
## basalt-ui/guard
|
|
50
55
|
Import: import { ... } from 'basalt-ui/guard'
|
|
@@ -138,6 +143,11 @@ Asset: basalt-ui/styles.css
|
|
|
138
143
|
Description: Mandatory CSS import (after the Mantine styles.layer.css bundles) — @layer basalt base styles, iOS input safety net, font stack
|
|
139
144
|
Layer: non-js-asset
|
|
140
145
|
|
|
146
|
+
## basalt-ui/tokens.css
|
|
147
|
+
Asset: basalt-ui/tokens.css
|
|
148
|
+
Description: Prebuilt --vx-* token stylesheet — the default buildPaletteCss() output as a plain file, for a consumer with no bundler, no React and no Mantine; retune the selector or trim the spacing set with `basalt-ui tokens:css`
|
|
149
|
+
Layer: non-js-asset
|
|
150
|
+
|
|
141
151
|
## basalt-ui/configs/*
|
|
142
152
|
Asset: basalt-ui/configs/*
|
|
143
153
|
Description: Raw toolchain presets for consumer extends: oxlint.json, oxfmt.json, tsconfig.*.json, lefthook.yml, check.yml
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basalt-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"charts",
|
|
@@ -117,6 +117,7 @@
|
|
|
117
117
|
"import": "./dist/connectivity/index.js"
|
|
118
118
|
},
|
|
119
119
|
"./styles.css": "./dist/styles.css",
|
|
120
|
+
"./tokens.css": "./dist/tokens.css",
|
|
120
121
|
"./configs/*": "./configs/*",
|
|
121
122
|
"./llms.txt": "./llms.txt"
|
|
122
123
|
},
|
|
@@ -125,7 +126,7 @@
|
|
|
125
126
|
"provenance": true
|
|
126
127
|
},
|
|
127
128
|
"scripts": {
|
|
128
|
-
"build": "tsup && tsc --emitDeclarationOnly --declarationMap && bun scripts/copy-assets.mjs && bun scripts/fix-esm-extensions.mjs",
|
|
129
|
+
"build": "tsup && tsc --emitDeclarationOnly --declarationMap && bun scripts/copy-assets.mjs && bun scripts/gen-tokens-css.mjs && bun scripts/fix-esm-extensions.mjs",
|
|
129
130
|
"typecheck": "tsc --noEmit",
|
|
130
131
|
"pack-test": "bash scripts/pack-test.sh",
|
|
131
132
|
"prepack": "bun run build",
|
|
@@ -165,7 +166,8 @@
|
|
|
165
166
|
"tsup": "^8.5.1",
|
|
166
167
|
"typescript": "^6.0.3",
|
|
167
168
|
"use-stick-to-bottom": "^1.1.6",
|
|
168
|
-
"vite": "^8.0.16"
|
|
169
|
+
"vite": "^8.0.16",
|
|
170
|
+
"vite-plugin-pwa": "^1.3.0"
|
|
169
171
|
},
|
|
170
172
|
"peerDependencies": {
|
|
171
173
|
"@mantine/core": "^9.3.0",
|
|
@@ -190,12 +192,19 @@
|
|
|
190
192
|
"remark-gfm": "^4.0.1",
|
|
191
193
|
"shiki": "^4.3.0",
|
|
192
194
|
"use-stick-to-bottom": "^1.1.6",
|
|
193
|
-
"vite": "^7 || ^8"
|
|
195
|
+
"vite": "^7 || ^8",
|
|
196
|
+
"vite-plugin-pwa": "^1.3.0"
|
|
194
197
|
},
|
|
195
198
|
"peerDependenciesMeta": {
|
|
199
|
+
"@mantine/core": {
|
|
200
|
+
"optional": true
|
|
201
|
+
},
|
|
196
202
|
"@mantine/form": {
|
|
197
203
|
"optional": true
|
|
198
204
|
},
|
|
205
|
+
"@mantine/hooks": {
|
|
206
|
+
"optional": true
|
|
207
|
+
},
|
|
199
208
|
"@shikijs/langs": {
|
|
200
209
|
"optional": true
|
|
201
210
|
},
|
|
@@ -214,6 +223,9 @@
|
|
|
214
223
|
"@mantine/spotlight": {
|
|
215
224
|
"optional": true
|
|
216
225
|
},
|
|
226
|
+
"@tanstack/react-query": {
|
|
227
|
+
"optional": true
|
|
228
|
+
},
|
|
217
229
|
"@tanstack/react-query-devtools": {
|
|
218
230
|
"optional": true
|
|
219
231
|
},
|
|
@@ -232,6 +244,12 @@
|
|
|
232
244
|
"beautiful-mermaid": {
|
|
233
245
|
"optional": true
|
|
234
246
|
},
|
|
247
|
+
"react": {
|
|
248
|
+
"optional": true
|
|
249
|
+
},
|
|
250
|
+
"react-dom": {
|
|
251
|
+
"optional": true
|
|
252
|
+
},
|
|
235
253
|
"react-markdown": {
|
|
236
254
|
"optional": true
|
|
237
255
|
},
|
|
@@ -246,6 +264,9 @@
|
|
|
246
264
|
},
|
|
247
265
|
"vite": {
|
|
248
266
|
"optional": true
|
|
267
|
+
},
|
|
268
|
+
"vite-plugin-pwa": {
|
|
269
|
+
"optional": true
|
|
249
270
|
}
|
|
250
271
|
},
|
|
251
272
|
"basalt": {
|
|
@@ -255,15 +276,25 @@
|
|
|
255
276
|
"exempt": [
|
|
256
277
|
"src/tokens/palette.ts",
|
|
257
278
|
"src/tokens/index.ts",
|
|
279
|
+
"src/tokens/derive.ts",
|
|
280
|
+
"src/tokens/hct.ts",
|
|
258
281
|
"src/theme/index.ts",
|
|
259
282
|
"src/guard/index.ts",
|
|
260
283
|
"src/cli/index.ts"
|
|
261
284
|
],
|
|
262
|
-
"
|
|
263
|
-
"
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
285
|
+
"rawRadius": true,
|
|
286
|
+
"exemptRules": {
|
|
287
|
+
"inline-spacing": [
|
|
288
|
+
"charts"
|
|
289
|
+
],
|
|
290
|
+
"inline-display": [
|
|
291
|
+
"agent",
|
|
292
|
+
"charts"
|
|
293
|
+
],
|
|
294
|
+
"raw-html-layout": [
|
|
295
|
+
"agent",
|
|
296
|
+
"charts"
|
|
297
|
+
]
|
|
298
|
+
}
|
|
268
299
|
}
|
|
269
300
|
}
|
package/src/agent/part-list.tsx
CHANGED
|
@@ -98,14 +98,17 @@ const MICRO_LABEL_STYLE = {
|
|
|
98
98
|
|
|
99
99
|
/** Faint left divider rail (docs/DESIGN-SPEC.md §5) — reasoning/tool-call parts read as transcript
|
|
100
100
|
* asides, not surfaces. */
|
|
101
|
-
const RAIL_STYLE = {
|
|
101
|
+
const RAIL_STYLE = {
|
|
102
|
+
borderLeft: `2px solid ${VX.divider}`,
|
|
103
|
+
paddingLeft: 'var(--vx-space-agent-rail-inset-x)',
|
|
104
|
+
} as const
|
|
102
105
|
|
|
103
106
|
const CODE_BLOCK_STYLE = {
|
|
104
|
-
marginTop:
|
|
107
|
+
marginTop: 'var(--vx-space-agent-part-gap-top)',
|
|
105
108
|
fontFamily: 'var(--basalt-font-mono)',
|
|
106
109
|
backgroundColor: alpha(VX.ink, 0.06),
|
|
107
|
-
borderRadius:
|
|
108
|
-
padding:
|
|
110
|
+
borderRadius: 'var(--vx-radius-card)',
|
|
111
|
+
padding: 'var(--vx-space-agent-code-inset)',
|
|
109
112
|
overflowX: 'auto',
|
|
110
113
|
} as const
|
|
111
114
|
|
|
@@ -129,7 +132,10 @@ function DefaultReasoning({ part }: { part: ReasoningPart; index: number }): JSX
|
|
|
129
132
|
>
|
|
130
133
|
Reasoning
|
|
131
134
|
</summary>
|
|
132
|
-
<div
|
|
135
|
+
<div
|
|
136
|
+
className="basalt-agent-reasoning-body"
|
|
137
|
+
style={{ color: VX.muted, marginTop: 'var(--vx-space-agent-part-gap-top)' }}
|
|
138
|
+
>
|
|
133
139
|
{part.text}
|
|
134
140
|
</div>
|
|
135
141
|
</details>
|
|
@@ -176,8 +182,8 @@ function DefaultError({ part }: { part: ErrorPart; index: number }): JSX.Element
|
|
|
176
182
|
style={{
|
|
177
183
|
backgroundColor: alpha(VX.status.bad, 0.13),
|
|
178
184
|
color: VX.status.bad,
|
|
179
|
-
borderRadius:
|
|
180
|
-
padding: '
|
|
185
|
+
borderRadius: 'var(--vx-radius-card)',
|
|
186
|
+
padding: 'var(--vx-space-agent-error-inset-y) var(--vx-space-agent-error-inset-x)',
|
|
181
187
|
}}
|
|
182
188
|
>
|
|
183
189
|
{part.message}
|
|
@@ -76,8 +76,8 @@ const LazyStickToBottom = lazy(() =>
|
|
|
76
76
|
justifyContent: 'center',
|
|
77
77
|
width: 30,
|
|
78
78
|
height: 30,
|
|
79
|
-
margin: '
|
|
80
|
-
borderRadius:
|
|
79
|
+
margin: 'var(--vx-space-agent-scroll-button-gap-top) auto 0',
|
|
80
|
+
borderRadius: 'var(--vx-radius-pill)',
|
|
81
81
|
border: 'none',
|
|
82
82
|
cursor: 'pointer',
|
|
83
83
|
backgroundColor: 'var(--vx-surface-panel)',
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* onClose={() => select(null)}
|
|
21
21
|
* />
|
|
22
22
|
*/
|
|
23
|
-
import { ActionIcon, Alert, Box, Button, Divider, Stack, Text } from '@mantine/core'
|
|
23
|
+
import { ActionIcon, Alert, Box, Button, Divider, Flex, Stack, Text } from '@mantine/core'
|
|
24
24
|
import { useReducedMotion } from '@mantine/hooks'
|
|
25
25
|
import { motion } from 'motion/react'
|
|
26
26
|
import type { JSX } from 'react'
|
|
@@ -113,11 +113,8 @@ export function ThreadDetailPanel({
|
|
|
113
113
|
const streaming = runStatus === 'streaming'
|
|
114
114
|
|
|
115
115
|
const panel = (
|
|
116
|
-
<
|
|
117
|
-
<
|
|
118
|
-
p="sm"
|
|
119
|
-
style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
|
|
120
|
-
>
|
|
116
|
+
<Flex direction="column" h="100%">
|
|
117
|
+
<Flex p="sm" align="center" justify="space-between">
|
|
121
118
|
<Text
|
|
122
119
|
fw={550}
|
|
123
120
|
lineClamp={1}
|
|
@@ -132,11 +129,17 @@ export function ThreadDetailPanel({
|
|
|
132
129
|
<ActionIcon variant="subtle" color="gray" onClick={onClose} aria-label="Close thread">
|
|
133
130
|
<CloseGlyph />
|
|
134
131
|
</ActionIcon>
|
|
135
|
-
</
|
|
132
|
+
</Flex>
|
|
136
133
|
<Divider color="var(--vx-divider)" />
|
|
137
134
|
<Box style={{ flex: 1, minHeight: 0 }}>
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
<BasaltStickToBottom
|
|
136
|
+
style={{
|
|
137
|
+
height: '100%',
|
|
138
|
+
// theme-allow — BasaltStickToBottom owns this scroll node (see stick-to-bottom.tsx).
|
|
139
|
+
overflowY: 'auto',
|
|
140
|
+
padding: 'var(--vx-space-agent-transcript-inset)',
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
140
143
|
<ThreadTranscript
|
|
141
144
|
messages={thread.messages}
|
|
142
145
|
{...(liveParts !== undefined ? { liveParts } : {})}
|
|
@@ -172,7 +175,7 @@ export function ThreadDetailPanel({
|
|
|
172
175
|
)}
|
|
173
176
|
</Stack>
|
|
174
177
|
</Box>
|
|
175
|
-
</
|
|
178
|
+
</Flex>
|
|
176
179
|
)
|
|
177
180
|
|
|
178
181
|
if (reduceMotion) return panel
|
|
@@ -72,14 +72,17 @@ function TextRenderer({ part }: { part: TextPart; index: number }): JSX.Element
|
|
|
72
72
|
|
|
73
73
|
// Tool-call/reasoning parts (docs/DESIGN-SPEC.md §5): a mono micro-label header with a faint left
|
|
74
74
|
// divider rail — quieter than the card idiom, since these are transcript asides, not surfaces.
|
|
75
|
-
const RAIL_STYLE = {
|
|
75
|
+
const RAIL_STYLE = {
|
|
76
|
+
borderLeft: `2px solid ${VX.divider}`,
|
|
77
|
+
paddingLeft: 'var(--vx-space-agent-rail-inset-x)',
|
|
78
|
+
} as const
|
|
76
79
|
const CODE_BLOCK_STYLE = {
|
|
77
80
|
margin: 0,
|
|
78
|
-
marginTop:
|
|
81
|
+
marginTop: 'var(--vx-space-agent-part-gap-top)',
|
|
79
82
|
fontFamily: 'var(--basalt-font-mono)',
|
|
80
83
|
backgroundColor: alpha(VX.ink, 0.06),
|
|
81
|
-
borderRadius:
|
|
82
|
-
padding:
|
|
84
|
+
borderRadius: 'var(--vx-radius-card)',
|
|
85
|
+
padding: 'var(--vx-space-agent-code-inset)',
|
|
83
86
|
whiteSpace: 'pre-wrap',
|
|
84
87
|
overflowWrap: 'anywhere',
|
|
85
88
|
} as const
|
|
@@ -192,7 +195,7 @@ function MessageBlock({
|
|
|
192
195
|
return (
|
|
193
196
|
<Box
|
|
194
197
|
style={{
|
|
195
|
-
padding: '
|
|
198
|
+
padding: 'var(--vx-space-agent-message-inset-y) var(--vx-space-agent-message-inset-x)',
|
|
196
199
|
backgroundColor: author === 'user' ? VX.surface.subtle : VX.surface.panel,
|
|
197
200
|
borderRadius: VX.radiusCard,
|
|
198
201
|
boxShadow: VX.shadowCard,
|
|
@@ -107,12 +107,12 @@ function OutcomeBody({ thread }: { thread: AgentThread }): JSX.Element {
|
|
|
107
107
|
{badge !== undefined && (
|
|
108
108
|
<Badge
|
|
109
109
|
size="xs"
|
|
110
|
-
radius={6}
|
|
111
110
|
styles={{
|
|
112
111
|
root: {
|
|
113
112
|
backgroundColor: alpha(badge.statusToken, 0.13),
|
|
114
|
-
padding: '
|
|
113
|
+
padding: 'var(--vx-space-badge-inset-y) var(--vx-space-badge-inset-x)',
|
|
115
114
|
height: 'auto',
|
|
115
|
+
borderRadius: 'var(--vx-radius-ctrl)',
|
|
116
116
|
},
|
|
117
117
|
label: {
|
|
118
118
|
fontFamily: 'var(--basalt-font-mono)',
|
|
@@ -128,7 +128,7 @@ export function ThreadWorkspace({
|
|
|
128
128
|
// A plain pane, NOT a card — the feed's own rows carry the card idiom (docs/DESIGN-SPEC.md §5),
|
|
129
129
|
// so this pane stays flush with the page and the feed/detail split reads via the divider token.
|
|
130
130
|
const feed = (
|
|
131
|
-
<
|
|
131
|
+
<Flex direction="column" h="100%" style={{ overflow: 'hidden' }}>
|
|
132
132
|
<Box style={{ flex: 1, minHeight: 0 }}>
|
|
133
133
|
{store.threads.length === 0 ? (
|
|
134
134
|
(emptyState ?? <FeedEmptyState />)
|
|
@@ -143,7 +143,7 @@ export function ThreadWorkspace({
|
|
|
143
143
|
{...(newThreadPlaceholder !== undefined ? { placeholder: newThreadPlaceholder } : {})}
|
|
144
144
|
/>
|
|
145
145
|
</Box>
|
|
146
|
-
</
|
|
146
|
+
</Flex>
|
|
147
147
|
)
|
|
148
148
|
|
|
149
149
|
const detail = (
|
|
@@ -147,7 +147,7 @@ function LegendSwatch({ item, idPrefix }: { item: LegendEntry; idPrefix: string
|
|
|
147
147
|
style={{
|
|
148
148
|
width: 11,
|
|
149
149
|
height: 11,
|
|
150
|
-
borderRadius: 3,
|
|
150
|
+
borderRadius: 3, // theme-allow: sub-scale legend-swatch corner, below the 4px radius floor
|
|
151
151
|
backgroundColor: item.color,
|
|
152
152
|
opacity: item.fillOpacity ?? 0.7,
|
|
153
153
|
flexShrink: 0,
|
|
@@ -192,7 +192,7 @@ function LegendChildSwatch({ item }: { item: LegendEntry }) {
|
|
|
192
192
|
style={{
|
|
193
193
|
width: 10,
|
|
194
194
|
height: 10,
|
|
195
|
-
borderRadius: 2,
|
|
195
|
+
borderRadius: 2, // theme-allow: sub-scale legend-swatch corner, below the 4px radius floor
|
|
196
196
|
backgroundColor: item.color,
|
|
197
197
|
opacity: item.fillOpacity ?? 0.7,
|
|
198
198
|
flexShrink: 0,
|