basalt-ui 1.1.1 → 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 +30 -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 +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 +15 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +29 -7
- 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 +15 -11
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +4 -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 +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 +55 -5
- 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 +17 -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 +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,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-color-mix.ts — resolves CSS `color-mix(in srgb, A [p%], B [p%])` expressions down to a
|
|
3
|
+
* flat hex string.
|
|
4
|
+
*
|
|
5
|
+
* Why this exists: `SURFACE.bg` in `tokens/palette.ts` holds `color-mix()` expressions (not hex),
|
|
6
|
+
* because the page background is a deliberate mix of two zinc stops. `<meta name="theme-color">`
|
|
7
|
+
* and the web manifest's `theme_color` both require a FLAT color — `color-mix()` cannot appear
|
|
8
|
+
* there — so consumers were hand-approximating the mix and getting it wrong (argo shipped
|
|
9
|
+
* `#EDEFF2`/`#242424`, both incorrect). This resolver computes the exact flat value at build time
|
|
10
|
+
* instead, which is the core value `basaltAppPlugin` (in `./vite.ts`) adds over a hand-authored
|
|
11
|
+
* PWA/head-metadata config.
|
|
12
|
+
*
|
|
13
|
+
* Internal to the `./vite` subpath only — deliberately NOT re-exported from `vite.ts`, so it never
|
|
14
|
+
* becomes part of the published surface (see `scripts/export-surface.json`).
|
|
15
|
+
*
|
|
16
|
+
* Supports: plain hex passthrough (`#rgb` / `#rrggbb`), a small set of trivial named colors, and
|
|
17
|
+
* one or more levels of nested `color-mix(in srgb, A [p%], B [p%])` — sRGB channel lerp on the
|
|
18
|
+
* 0-255 channels, round-half-up. Anything else (other color spaces, non-trivial named colors,
|
|
19
|
+
* `rgb()`/`hsl()` functions) throws a clear error naming the unresolvable input.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Resolves a color-mix expression (or a plain hex / trivial named color) to a flat lowercase hex
|
|
23
|
+
* string. Percentage semantics per CSS `color-mix()`: `A p%` means A contributes `p%`, B
|
|
24
|
+
* contributes `(100 - p)%`; if neither side carries a percentage, the mix is 50/50.
|
|
25
|
+
*
|
|
26
|
+
* @throws {Error} when the input is not hex, a trivial named color, or a `color-mix(in srgb, ...)`
|
|
27
|
+
* expression (e.g. another color space, `rgb()`/`hsl()`, or a non-trivial named color).
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveColorMix(input: string): string;
|
|
30
|
+
//# sourceMappingURL=vite-color-mix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-color-mix.d.ts","sourceRoot":"","sources":["../src/vite-color-mix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAoEH;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAyCrD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const NAMED_COLORS = {
|
|
2
|
+
white: "#ffffff",
|
|
3
|
+
// theme-allow — CSS keyword definition, not a design color
|
|
4
|
+
black: "#000000"
|
|
5
|
+
// theme-allow — CSS keyword definition, not a design color
|
|
6
|
+
};
|
|
7
|
+
function normalizeHex(hex) {
|
|
8
|
+
const body = hex.slice(1);
|
|
9
|
+
const full = body.length === 3 ? body.split("").map((c) => c + c).join("") : body;
|
|
10
|
+
return `#${full.toLowerCase()}`;
|
|
11
|
+
}
|
|
12
|
+
function hexToRgb(hex) {
|
|
13
|
+
const normalized = normalizeHex(hex);
|
|
14
|
+
const value = Number.parseInt(normalized.slice(1), 16);
|
|
15
|
+
return [value >> 16 & 255, value >> 8 & 255, value & 255];
|
|
16
|
+
}
|
|
17
|
+
function channelToHex(channel) {
|
|
18
|
+
return channel.toString(16).padStart(2, "0");
|
|
19
|
+
}
|
|
20
|
+
function rgbToHex(channels) {
|
|
21
|
+
return `#${channelToHex(channels[0])}${channelToHex(channels[1])}${channelToHex(channels[2])}`;
|
|
22
|
+
}
|
|
23
|
+
function splitTopLevel(input) {
|
|
24
|
+
const parts = [];
|
|
25
|
+
let depth = 0;
|
|
26
|
+
let current = "";
|
|
27
|
+
for (const char of input) {
|
|
28
|
+
if (char === "(") depth++;
|
|
29
|
+
if (char === ")") depth--;
|
|
30
|
+
if (char === "," && depth === 0) {
|
|
31
|
+
parts.push(current.trim());
|
|
32
|
+
current = "";
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
current += char;
|
|
36
|
+
}
|
|
37
|
+
parts.push(current.trim());
|
|
38
|
+
return parts;
|
|
39
|
+
}
|
|
40
|
+
function splitColorAndPercent(component) {
|
|
41
|
+
const trimmed = component.trim();
|
|
42
|
+
const match = /^(.+?)\s+(\d+(?:\.\d+)?)%$/.exec(trimmed);
|
|
43
|
+
if (!match) return { color: trimmed, percent: null };
|
|
44
|
+
return { color: match[1].trim(), percent: Number(match[2]) };
|
|
45
|
+
}
|
|
46
|
+
function resolveColorMix(input) {
|
|
47
|
+
const trimmed = input.trim();
|
|
48
|
+
if (/^#[0-9a-fA-F]{3}$/.test(trimmed) || /^#[0-9a-fA-F]{6}$/.test(trimmed)) {
|
|
49
|
+
return normalizeHex(trimmed);
|
|
50
|
+
}
|
|
51
|
+
const named = NAMED_COLORS[trimmed.toLowerCase()];
|
|
52
|
+
if (named !== void 0) return named;
|
|
53
|
+
const mixMatch = /^color-mix\(\s*in\s+srgb\s*,\s*([\s\S]+)\)$/i.exec(trimmed);
|
|
54
|
+
if (!mixMatch) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`Unresolvable color-mix input: "${input}" \u2014 only hex (#rgb/#rrggbb), "white"/"black", and color-mix(in srgb, ...) are supported.`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const components = splitTopLevel(mixMatch[1]);
|
|
60
|
+
const [colorAComponent, colorBComponent] = components;
|
|
61
|
+
if (components.length !== 2 || colorAComponent === void 0 || colorBComponent === void 0) {
|
|
62
|
+
throw new Error(`Malformed color-mix() expression: "${input}"`);
|
|
63
|
+
}
|
|
64
|
+
const a = splitColorAndPercent(colorAComponent);
|
|
65
|
+
const b = splitColorAndPercent(colorBComponent);
|
|
66
|
+
let percentA;
|
|
67
|
+
if (a.percent !== null) percentA = a.percent;
|
|
68
|
+
else if (b.percent !== null) percentA = 100 - b.percent;
|
|
69
|
+
else percentA = 50;
|
|
70
|
+
const rgbA = hexToRgb(resolveColorMix(a.color));
|
|
71
|
+
const rgbB = hexToRgb(resolveColorMix(b.color));
|
|
72
|
+
const percentB = 100 - percentA;
|
|
73
|
+
const mixed = [0, 1, 2].map(
|
|
74
|
+
(i) => Math.round((rgbA[i] * percentA + rgbB[i] * percentB) / 100)
|
|
75
|
+
);
|
|
76
|
+
return rgbToHex(mixed);
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
resolveColorMix
|
|
80
|
+
};
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UserConfig } from 'vite';
|
|
1
|
+
import type { PluginOption, UserConfig } from 'vite';
|
|
2
2
|
export type BasaltViteOptions = {
|
|
3
3
|
/** Dev server port. Passed with `strictPort: true` so the app fails fast on a busy port. */
|
|
4
4
|
port: number;
|
|
@@ -27,4 +27,85 @@ export type BasaltViteOptions = {
|
|
|
27
27
|
version?: string;
|
|
28
28
|
};
|
|
29
29
|
export declare function basaltViteConfig(opts: BasaltViteOptions): UserConfig;
|
|
30
|
+
export type BasaltAppOptions = {
|
|
31
|
+
/** App display name — used verbatim as the manifest `name` and (unless overridden) OG title. */
|
|
32
|
+
name: string;
|
|
33
|
+
/** Short name for home-screen labels. Default: `name`. */
|
|
34
|
+
shortName?: string;
|
|
35
|
+
/** Site-wide description — feeds the `<meta name="description">` and OG/Twitter description. */
|
|
36
|
+
description?: string;
|
|
37
|
+
/**
|
|
38
|
+
* `'auto'` (default) resolves the flat theme-color pair from `SURFACE.bg` (basalt's own page
|
|
39
|
+
* background token, a `color-mix()` expression) via the color-mix resolver — the reason this
|
|
40
|
+
* plugin exists. Pass an explicit `{ light, dark }` pair of already-flat CSS colors to override.
|
|
41
|
+
*/
|
|
42
|
+
themeColor?: 'auto' | {
|
|
43
|
+
light: string;
|
|
44
|
+
dark: string;
|
|
45
|
+
};
|
|
46
|
+
/** Manifest `background_color` + anti-FOUC paint color. Default: the resolved dark theme color. */
|
|
47
|
+
backgroundColor?: string;
|
|
48
|
+
/** Manifest `display` mode. Default: `'standalone'`. */
|
|
49
|
+
display?: 'standalone' | 'minimal-ui' | 'fullscreen' | 'browser';
|
|
50
|
+
/**
|
|
51
|
+
* Manifest `start_url`. Defaults to Vite's resolved `base` (so a non-root deploy — e.g. GitHub
|
|
52
|
+
* Pages' `/repo/` — gets a correct value with zero config). An explicit value is used verbatim:
|
|
53
|
+
* it is NOT re-prefixed with `base`, so pass the fully base-aware path yourself if you set it.
|
|
54
|
+
*/
|
|
55
|
+
startUrl?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Manifest `scope`. Defaults to Vite's resolved `base`. An explicit value is used verbatim (not
|
|
58
|
+
* re-prefixed with `base`) — same rule as `startUrl`.
|
|
59
|
+
*/
|
|
60
|
+
scope?: string;
|
|
61
|
+
/** Manifest `id`. Default: the resolved `startUrl` (default- or explicitly-derived, per above). */
|
|
62
|
+
id?: string;
|
|
63
|
+
/** Icon links + manifest icon paths. `false` skips the head `<link>` icons entirely. */
|
|
64
|
+
icons?: false | {
|
|
65
|
+
dir?: string;
|
|
66
|
+
};
|
|
67
|
+
/** Emits `<meta name="darkreader-lock">` when `'lock'` (default). Pass `false` to omit it. */
|
|
68
|
+
darkreader?: 'lock' | false;
|
|
69
|
+
/** Site-wide SEO metadata — only the keys provided are emitted, no per-page SEO. */
|
|
70
|
+
seo?: {
|
|
71
|
+
url?: string;
|
|
72
|
+
image?: string;
|
|
73
|
+
twitterCard?: 'summary' | 'summary_large_image';
|
|
74
|
+
};
|
|
75
|
+
/** `false` skips manifest generation/serving and the `<link rel="manifest">` tag entirely. */
|
|
76
|
+
manifest?: false;
|
|
77
|
+
/**
|
|
78
|
+
* Opt-in service worker via the optional peer `vite-plugin-pwa`. `true` uses argo-tuned workbox
|
|
79
|
+
* defaults; an object is deep-merged over those defaults. Default `false` (no service worker).
|
|
80
|
+
* Degrades to a one-line console warning (no service worker, no throw) when the peer — plus its
|
|
81
|
+
* non-optional peers `workbox-build` / `workbox-window` — is not installed.
|
|
82
|
+
*/
|
|
83
|
+
serviceWorker?: boolean | Record<string, unknown>;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Generates PWA / favicon / head metadata for a consumer app from one config object — a Vite
|
|
87
|
+
* plugin (well, plugin array — see the service-worker note below) placed in the consumer's own
|
|
88
|
+
* `plugins` array (never returned by `basaltViteConfig`, which stays plugin-free by contract).
|
|
89
|
+
*
|
|
90
|
+
* The core value over hand-authoring this yourself: `themeColor: 'auto'` (the default) derives
|
|
91
|
+
* the flat `<meta name="theme-color">` / manifest `theme_color` pair from basalt's own
|
|
92
|
+
* `SURFACE.bg` design token, so the value tracks the palette instead of being a copied hex that
|
|
93
|
+
* silently rots when the palette is retuned.
|
|
94
|
+
*
|
|
95
|
+
* `SURFACE.bg` is generated by `tokens/derive.ts` and currently resolves to plain hex, which the
|
|
96
|
+
* resolver passes through untouched. It is run through `resolveColorMix` anyway because the token
|
|
97
|
+
* layer has historically expressed surfaces as `color-mix()` and may again — a meta tag and a
|
|
98
|
+
* manifest `theme_color` both need a FLAT color, so the flattening step is the contract this
|
|
99
|
+
* plugin owes its output regardless of which shape the palette hands it.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* // vite.config.ts
|
|
103
|
+
* import { basaltAppPlugin, basaltViteConfig } from 'basalt-ui/vite'
|
|
104
|
+
*
|
|
105
|
+
* export default {
|
|
106
|
+
* ...basaltViteConfig({ port: 5173 }),
|
|
107
|
+
* plugins: [react(), ...basaltAppPlugin({ name: 'Argo' })],
|
|
108
|
+
* }
|
|
109
|
+
*/
|
|
110
|
+
export declare function basaltAppPlugin(options: BasaltAppOptions): PluginOption[];
|
|
30
111
|
//# sourceMappingURL=vite.d.ts.map
|
package/dist/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAA6B,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAI/E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,4FAA4F;IAC5F,IAAI,EAAE,MAAM,CAAA;IACZ,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,UAAU,CAyEpE;AAgBD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gGAAgG;IAChG,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACrD,mGAAmG;IACnG,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,wDAAwD;IACxD,OAAO,CAAC,EAAE,YAAY,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,CAAA;IAChE;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mGAAmG;IACnG,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,wFAAwF;IACxF,KAAK,CAAC,EAAE,KAAK,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAChC,8FAA8F;IAC9F,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IAC3B,oFAAoF;IACpF,GAAG,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,SAAS,GAAG,qBAAqB,CAAA;KAAE,CAAA;IACvF,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClD,CAAA;AAuZD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,YAAY,EAAE,CAMzE"}
|
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.2.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.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
# Optional peers are listed per subpath; install only what you use.
|
|
16
16
|
|
|
17
17
|
Package: basalt-ui
|
|
18
|
-
Version: 1.
|
|
18
|
+
Version: 1.2.0
|
|
19
19
|
|
|
20
20
|
## basalt-ui
|
|
21
21
|
Import: import { ... } from 'basalt-ui'
|
|
@@ -38,13 +38,14 @@ Rule: basalt-tokens
|
|
|
38
38
|
|
|
39
39
|
## basalt-ui/theme-lab
|
|
40
40
|
Import: import { ... } from 'basalt-ui/theme-lab'
|
|
41
|
-
Description: ThemeLabControls, applyOverrides, COLOR_GROUPS for
|
|
41
|
+
Description: ThemeLabControls, applyOverrides, COLOR_GROUPS — a low-level inspector for the non-derived structural tokens; identity/color tuning lives in DeriveControls
|
|
42
42
|
Layer: mantine-coupled
|
|
43
43
|
|
|
44
44
|
## basalt-ui/vite
|
|
45
45
|
Import: import { ... } from 'basalt-ui/vite'
|
|
46
|
-
Description: basaltViteConfig(opts) — Vite preset for basalt-ui consumer apps
|
|
46
|
+
Description: basaltViteConfig(opts) — Vite preset for basalt-ui consumer apps; basaltAppPlugin(opts) — PWA head, manifest, and icon metadata derived from the token palette
|
|
47
47
|
Layer: mantine-coupled
|
|
48
|
+
OptionalPeers: vite-plugin-pwa@^1.3.0
|
|
48
49
|
|
|
49
50
|
## basalt-ui/guard
|
|
50
51
|
Import: import { ... } from 'basalt-ui/guard'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basalt-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"charts",
|
|
@@ -165,7 +165,8 @@
|
|
|
165
165
|
"tsup": "^8.5.1",
|
|
166
166
|
"typescript": "^6.0.3",
|
|
167
167
|
"use-stick-to-bottom": "^1.1.6",
|
|
168
|
-
"vite": "^8.0.16"
|
|
168
|
+
"vite": "^8.0.16",
|
|
169
|
+
"vite-plugin-pwa": "^1.3.0"
|
|
169
170
|
},
|
|
170
171
|
"peerDependencies": {
|
|
171
172
|
"@mantine/core": "^9.3.0",
|
|
@@ -190,7 +191,8 @@
|
|
|
190
191
|
"remark-gfm": "^4.0.1",
|
|
191
192
|
"shiki": "^4.3.0",
|
|
192
193
|
"use-stick-to-bottom": "^1.1.6",
|
|
193
|
-
"vite": "^7 || ^8"
|
|
194
|
+
"vite": "^7 || ^8",
|
|
195
|
+
"vite-plugin-pwa": "^1.3.0"
|
|
194
196
|
},
|
|
195
197
|
"peerDependenciesMeta": {
|
|
196
198
|
"@mantine/form": {
|
|
@@ -246,6 +248,9 @@
|
|
|
246
248
|
},
|
|
247
249
|
"vite": {
|
|
248
250
|
"optional": true
|
|
251
|
+
},
|
|
252
|
+
"vite-plugin-pwa": {
|
|
253
|
+
"optional": true
|
|
249
254
|
}
|
|
250
255
|
},
|
|
251
256
|
"basalt": {
|
|
@@ -255,15 +260,25 @@
|
|
|
255
260
|
"exempt": [
|
|
256
261
|
"src/tokens/palette.ts",
|
|
257
262
|
"src/tokens/index.ts",
|
|
263
|
+
"src/tokens/derive.ts",
|
|
264
|
+
"src/tokens/hct.ts",
|
|
258
265
|
"src/theme/index.ts",
|
|
259
266
|
"src/guard/index.ts",
|
|
260
267
|
"src/cli/index.ts"
|
|
261
268
|
],
|
|
262
|
-
"
|
|
263
|
-
"
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
269
|
+
"rawRadius": true,
|
|
270
|
+
"exemptRules": {
|
|
271
|
+
"inline-spacing": [
|
|
272
|
+
"charts"
|
|
273
|
+
],
|
|
274
|
+
"inline-display": [
|
|
275
|
+
"agent",
|
|
276
|
+
"charts"
|
|
277
|
+
],
|
|
278
|
+
"raw-html-layout": [
|
|
279
|
+
"agent",
|
|
280
|
+
"charts"
|
|
281
|
+
]
|
|
282
|
+
}
|
|
268
283
|
}
|
|
269
284
|
}
|
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}
|