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
package/dist/guard/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
const HEX = /#[0-9a-fA-F]{3,8}\b/g;
|
|
2
2
|
const FUNC = /\b(?:rgba?|hsla?)\(/g;
|
|
3
3
|
const LOCALSTORAGE_THEME = /localStorage\s*\.\s*getItem\s*\(\s*['"]theme['"]\s*\)/g;
|
|
4
|
-
const
|
|
4
|
+
const RAW_FONT_FAMILY_VAR_ESCAPE = /var\(\s*--(?:basalt-font-|mantine-font-family-)/.source;
|
|
5
|
+
const RAW_FONT_FAMILY_KEYWORD = /(?:inherit|initial|unset|revert)\b/.source;
|
|
6
|
+
const RAW_FONT_FAMILY = new RegExp(
|
|
7
|
+
`\\bfontFamily\\s*[:=]\\s*\\{?(?!['"\`]?\\s*${RAW_FONT_FAMILY_VAR_ESCAPE})(?!['"\`]?\\s*${RAW_FONT_FAMILY_KEYWORD})['"\`][^'"\`]+['"\`]|\\bfont-family\\s*:\\s*(?!['"\`]?\\s*${RAW_FONT_FAMILY_VAR_ESCAPE})(?!['"\`]?\\s*${RAW_FONT_FAMILY_KEYWORD})(?:['"\`][^'"\`]+['"\`]|[A-Za-z][\\w-]*)`,
|
|
8
|
+
"g"
|
|
9
|
+
);
|
|
10
|
+
const SURFACE_BORDER = /\bborder(?:Top|Bottom|Left|Right)?\s*:\s*(?!['"`]?[^'"`]*(?:var\(|\$\{))(?!['"`]?(?:none|transparent|inherit|unset|revert)\b)['"`][^'"`]+['"`]/g;
|
|
5
11
|
const SURFACE_RADIUS = /\bborderRadius\s*:\s*(?:[0-9]+|['"`](?!\s*var\()[^'"`]*[0-9])/g;
|
|
6
|
-
const SURFACE_SHADOW = /\bboxShadow\s*:\s*(?!['"`]?[^'"`]*var\()['"`][^'"`]+['"`]/g;
|
|
12
|
+
const SURFACE_SHADOW = /\bboxShadow\s*:\s*(?!['"`]?[^'"`]*(?:var\(|\$\{))['"`][^'"`]+['"`]/g;
|
|
7
13
|
const CARD_SURFACE_TAG = /<(?:Card|Paper)(?![\w.])(?:=>|[^>])*?>/g;
|
|
8
14
|
const WITH_BORDER_PROP = /\bwithBorder\b(?!\s*=\s*\{\s*false\s*\})/;
|
|
9
15
|
const OFF_SYSTEM_SURFACE_VAR = /var\(--mantine-color-(gray|dark)-\d/g;
|
|
@@ -42,15 +48,171 @@ const DEFAULT_GUARD_CONFIG = {
|
|
|
42
48
|
chartMissingAriaLabel: true,
|
|
43
49
|
rawFormControl: true,
|
|
44
50
|
sub16InputFont: true,
|
|
45
|
-
allowComment: "theme-allow"
|
|
51
|
+
allowComment: "theme-allow",
|
|
52
|
+
exemptRules: {}
|
|
46
53
|
};
|
|
47
54
|
function isChartFile(relPath) {
|
|
48
55
|
return relPath.includes("/charts/") && !AXIS_WRAPPER_FILE.test(relPath);
|
|
49
56
|
}
|
|
57
|
+
function isRuleExempt(kind, relPath, exemptRules) {
|
|
58
|
+
const patterns = exemptRules?.[kind];
|
|
59
|
+
if (patterns === void 0 || patterns.length === 0) return false;
|
|
60
|
+
const segments = relPath.split("/");
|
|
61
|
+
return patterns.some((pattern) => segments.includes(pattern.replace(/\/$/, "")));
|
|
62
|
+
}
|
|
50
63
|
function isSkippedLine(line, cfg) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
return line.includes(cfg.allowComment);
|
|
65
|
+
}
|
|
66
|
+
function guardSyntaxFor(relPath) {
|
|
67
|
+
return relPath.endsWith(".css") ? "css" : "ts";
|
|
68
|
+
}
|
|
69
|
+
const REGEX_PRECEDING_PUNCT = /* @__PURE__ */ new Set([
|
|
70
|
+
"=",
|
|
71
|
+
"(",
|
|
72
|
+
",",
|
|
73
|
+
"[",
|
|
74
|
+
":",
|
|
75
|
+
"!",
|
|
76
|
+
"&",
|
|
77
|
+
"|",
|
|
78
|
+
"?",
|
|
79
|
+
"{",
|
|
80
|
+
"}",
|
|
81
|
+
";",
|
|
82
|
+
"+",
|
|
83
|
+
"-",
|
|
84
|
+
"*",
|
|
85
|
+
"%",
|
|
86
|
+
"~",
|
|
87
|
+
"^",
|
|
88
|
+
"<"
|
|
89
|
+
]);
|
|
90
|
+
const REGEX_PRECEDING_KEYWORDS = /* @__PURE__ */ new Set([
|
|
91
|
+
"return",
|
|
92
|
+
"typeof",
|
|
93
|
+
"case",
|
|
94
|
+
"in",
|
|
95
|
+
"of",
|
|
96
|
+
"delete",
|
|
97
|
+
"void",
|
|
98
|
+
"throw",
|
|
99
|
+
"do",
|
|
100
|
+
"else"
|
|
101
|
+
]);
|
|
102
|
+
const WORD_CHAR = /[A-Za-z0-9_$]/;
|
|
103
|
+
function stripComments(text, syntax) {
|
|
104
|
+
const out = Array.from({ length: text.length });
|
|
105
|
+
let inLineComment = false;
|
|
106
|
+
let inBlockComment = false;
|
|
107
|
+
let stringQuote = null;
|
|
108
|
+
let currentWord = "";
|
|
109
|
+
let lastUnitType = "none";
|
|
110
|
+
let lastWord = "";
|
|
111
|
+
let lastPunct = "";
|
|
112
|
+
let i = 0;
|
|
113
|
+
function flushWord() {
|
|
114
|
+
if (currentWord === "") return;
|
|
115
|
+
lastUnitType = "word";
|
|
116
|
+
lastWord = currentWord;
|
|
117
|
+
currentWord = "";
|
|
118
|
+
}
|
|
119
|
+
function canPrecedeRegex() {
|
|
120
|
+
if (lastUnitType === "none") return true;
|
|
121
|
+
if (lastUnitType === "word") return REGEX_PRECEDING_KEYWORDS.has(lastWord);
|
|
122
|
+
return REGEX_PRECEDING_PUNCT.has(lastPunct);
|
|
123
|
+
}
|
|
124
|
+
while (i < text.length) {
|
|
125
|
+
const ch = text[i] ?? "";
|
|
126
|
+
if (inLineComment) {
|
|
127
|
+
out[i] = ch === "\n" ? "\n" : " ";
|
|
128
|
+
if (ch === "\n") inLineComment = false;
|
|
129
|
+
i++;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (inBlockComment) {
|
|
133
|
+
if (ch === "*" && text[i + 1] === "/") {
|
|
134
|
+
out[i] = " ";
|
|
135
|
+
out[i + 1] = " ";
|
|
136
|
+
i += 2;
|
|
137
|
+
inBlockComment = false;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
out[i] = ch === "\n" ? "\n" : " ";
|
|
141
|
+
i++;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (stringQuote !== null) {
|
|
145
|
+
out[i] = ch;
|
|
146
|
+
if (ch === "\\" && i + 1 < text.length) {
|
|
147
|
+
out[i + 1] = text[i + 1] ?? "";
|
|
148
|
+
i += 2;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (ch === stringQuote) stringQuote = null;
|
|
152
|
+
i++;
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (WORD_CHAR.test(ch)) {
|
|
156
|
+
currentWord += ch;
|
|
157
|
+
out[i] = ch;
|
|
158
|
+
i++;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
flushWord();
|
|
162
|
+
if (ch === "'" || ch === '"' || ch === "`") {
|
|
163
|
+
stringQuote = ch;
|
|
164
|
+
out[i] = ch;
|
|
165
|
+
lastUnitType = "punct";
|
|
166
|
+
lastPunct = ch;
|
|
167
|
+
i++;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (ch === "/" && text[i + 1] === "*") {
|
|
171
|
+
inBlockComment = true;
|
|
172
|
+
out[i] = " ";
|
|
173
|
+
i++;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (syntax === "ts" && ch === "/" && text[i + 1] === "/") {
|
|
177
|
+
inLineComment = true;
|
|
178
|
+
out[i] = " ";
|
|
179
|
+
i++;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (syntax === "ts" && ch === "/" && canPrecedeRegex()) {
|
|
183
|
+
out[i] = ch;
|
|
184
|
+
let j = i + 1;
|
|
185
|
+
let inClass = false;
|
|
186
|
+
while (j < text.length) {
|
|
187
|
+
const rc = text[j] ?? "";
|
|
188
|
+
if (rc === "\n") break;
|
|
189
|
+
out[j] = rc;
|
|
190
|
+
if (rc === "\\" && j + 1 < text.length) {
|
|
191
|
+
out[j + 1] = text[j + 1] ?? "";
|
|
192
|
+
j += 2;
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (rc === "[") inClass = true;
|
|
196
|
+
else if (rc === "]") inClass = false;
|
|
197
|
+
else if (rc === "/" && !inClass) {
|
|
198
|
+
j++;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
j++;
|
|
202
|
+
}
|
|
203
|
+
i = j;
|
|
204
|
+
lastUnitType = "punct";
|
|
205
|
+
lastPunct = "/";
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
out[i] = ch;
|
|
209
|
+
if (!/\s/.test(ch)) {
|
|
210
|
+
lastUnitType = "punct";
|
|
211
|
+
lastPunct = ch;
|
|
212
|
+
}
|
|
213
|
+
i++;
|
|
214
|
+
}
|
|
215
|
+
return out.join("");
|
|
54
216
|
}
|
|
55
217
|
const GUARD_RULES = {
|
|
56
218
|
"raw-hex": {
|
|
@@ -66,14 +228,25 @@ const GUARD_RULES = {
|
|
|
66
228
|
"localstorage-theme": {
|
|
67
229
|
kind: "localstorage-theme",
|
|
68
230
|
pattern: LOCALSTORAGE_THEME,
|
|
231
|
+
// JS-call-shaped (`localStorage.getItem('theme')`) — never appears in CSS text.
|
|
232
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
69
233
|
message: "Theme must resolve via the Mantine color scheme + --vx-* vars."
|
|
70
234
|
},
|
|
235
|
+
"raw-font-family": {
|
|
236
|
+
kind: "raw-font-family",
|
|
237
|
+
pattern: RAW_FONT_FAMILY,
|
|
238
|
+
message: "Route the font stack through createBasaltTheme(overrides, { fonts }) / the shipped --basalt-font-sans|head|mono vars instead of a hardcoded fontFamily literal."
|
|
239
|
+
},
|
|
71
240
|
"off-identity-accent": {
|
|
72
241
|
kind: "off-identity-accent",
|
|
73
242
|
pattern: (cfg) => new RegExp(
|
|
74
243
|
`\\b(?:color|c|bg|backgroundColor)\\s*=\\s*\\{?\\s*['"](${cfg.forbiddenAccents.join("|")})['"]`,
|
|
75
244
|
"g"
|
|
76
245
|
),
|
|
246
|
+
// JSX-prop-shaped (`color={"teal"}`) — CSS declares `color: teal;` with a bare keyword and
|
|
247
|
+
// `:`, which the pattern's `=` anchor can never match; gated off explicitly so a future regex
|
|
248
|
+
// tweak can't silently start false-positiving on consumer CSS.
|
|
249
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
77
250
|
message: "For an off-identity accent use blue/gray or a status hue (red/green/orange/yellow)."
|
|
78
251
|
},
|
|
79
252
|
"raw-spacing": {
|
|
@@ -82,12 +255,17 @@ const GUARD_RULES = {
|
|
|
82
255
|
`\\b(?:p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap)=\\{(?:${cfg.spacingSteps.join("|")})\\}`,
|
|
83
256
|
"g"
|
|
84
257
|
),
|
|
258
|
+
// JSX-prop-shaped (`p={16}`) — CSS has no `=`/`{}` prop syntax; gated off explicitly (see
|
|
259
|
+
// off-identity-accent above for why "never matches today" still gets an explicit gate).
|
|
260
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
85
261
|
message: "Use the Mantine spacing prop/token (p/m/gap with xs..xl)."
|
|
86
262
|
},
|
|
87
263
|
"raw-radius": {
|
|
88
264
|
kind: "raw-radius",
|
|
89
265
|
pattern: RADIUS_PROP_RE,
|
|
90
266
|
enabled: (cfg) => cfg.rawRadius,
|
|
267
|
+
// JSX-prop-shaped (`radius={6}`) — CSS declares `border-radius: 6px;`, never `radius=`.
|
|
268
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
91
269
|
message: 'Use the radius token (radius="md") instead of a numeric literal.'
|
|
92
270
|
},
|
|
93
271
|
"raw-surface": {
|
|
@@ -102,6 +280,8 @@ const GUARD_RULES = {
|
|
|
102
280
|
pattern: CARD_SURFACE_TAG,
|
|
103
281
|
// handled inline (full-text tag-scoped scan); entry keeps registry complete
|
|
104
282
|
enabled: (cfg) => cfg.cardWithBorder,
|
|
283
|
+
// JSX-tag-shaped (`<Card withBorder>`) — never appears in CSS text.
|
|
284
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
105
285
|
message: "withBorder on a Card/Paper double-draws the edge \u2014 card depth is --vx-shadow-card, which already bakes a 1px ring into the shadow. Drop the prop (docs/DESIGN-SPEC.md doctrine inversion #1)."
|
|
106
286
|
},
|
|
107
287
|
"off-system-surface-var": {
|
|
@@ -115,6 +295,8 @@ const GUARD_RULES = {
|
|
|
115
295
|
pattern: RAW_HTML_TAG,
|
|
116
296
|
// handled inline (3-condition conjunction); entry keeps registry complete
|
|
117
297
|
enabled: (cfg) => cfg.rawHtmlLayout,
|
|
298
|
+
// JSX-tag-shaped (`<div style={{...}}>`) — never appears in CSS text.
|
|
299
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
118
300
|
message: "Raw HTML element with inline layout/surface styling \u2014 use a Mantine layout primitive (Box/Flex/Grid/Stack/Group)."
|
|
119
301
|
},
|
|
120
302
|
"inline-spacing": {
|
|
@@ -127,13 +309,18 @@ const GUARD_RULES = {
|
|
|
127
309
|
kind: "inline-display",
|
|
128
310
|
pattern: INLINE_DISPLAY,
|
|
129
311
|
enabled: (cfg) => cfg.inlineDisplay,
|
|
312
|
+
// JSX-object-shaped (`display: 'flex'`, quoted value) — CSS never quotes a keyword value
|
|
313
|
+
// (`display: flex;` is bare), so the pattern's quote anchor can never match real CSS.
|
|
314
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
130
315
|
message: "Use <Flex>/<Grid>/<Group> instead of an inline display:flex/grid."
|
|
131
316
|
},
|
|
132
317
|
"raw-visx-axis": {
|
|
133
318
|
kind: "raw-visx-axis",
|
|
134
319
|
pattern: RAW_VISX_AXIS,
|
|
135
320
|
enabled: (cfg) => cfg.rawVisxAxis,
|
|
136
|
-
|
|
321
|
+
// Compose the existing chart-file scope with the CSS gate — a chart-file CSS module (none
|
|
322
|
+
// exist today, but the boundary should hold regardless) still can't carry a JSX axis tag.
|
|
323
|
+
appliesTo: (relPath) => isChartFile(relPath) && !relPath.endsWith(".css"),
|
|
137
324
|
message: "Raw <AxisLeft>/<AxisBottom>/<AxisRight> in a chart file \u2014 use AxisLeftNumeric / AxisBottomDate / AxisRightNumeric."
|
|
138
325
|
},
|
|
139
326
|
"raw-motion-value": {
|
|
@@ -141,6 +328,9 @@ const GUARD_RULES = {
|
|
|
141
328
|
pattern: MOTION_TRANSITION_NUMERIC,
|
|
142
329
|
// handled inline (2-regex kind); entry keeps registry complete
|
|
143
330
|
enabled: (cfg) => cfg.rawMotionValue,
|
|
331
|
+
// JSX-prop-shaped (`transition={{ duration: … }}`) — CSS's `transition:` property has no `=`
|
|
332
|
+
// or `{{`.
|
|
333
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
144
334
|
message: "Route animation timing through MOTION_DURATION / MOTION_SPRING / MOTION_EASE_STANDARD (basalt-ui motion tokens) instead of a hardcoded duration/spring/ease."
|
|
145
335
|
},
|
|
146
336
|
"unframed-chart": {
|
|
@@ -148,6 +338,8 @@ const GUARD_RULES = {
|
|
|
148
338
|
pattern: RAW_CHART_LEGEND_ARRAY,
|
|
149
339
|
// handled inline (full-text tag-scoped scan); entry keeps registry complete
|
|
150
340
|
enabled: (cfg) => cfg.unframedChart,
|
|
341
|
+
// JSX-tag-shaped (`<ChartLegend items={[…]}>`) — never appears in CSS text.
|
|
342
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
151
343
|
message: "Hand-rolled ChartLegend built from an inline array literal \u2014 pass a derived legend (deriveLegend(series)), or compose ChartFrame, which derives it for you."
|
|
152
344
|
},
|
|
153
345
|
"chart-missing-aria-label": {
|
|
@@ -155,12 +347,17 @@ const GUARD_RULES = {
|
|
|
155
347
|
pattern: CHART_ENTRY_POINT_TAG,
|
|
156
348
|
// handled inline (full-text tag-scoped scan); entry keeps registry complete
|
|
157
349
|
enabled: (cfg) => cfg.chartMissingAriaLabel,
|
|
350
|
+
// JSX-tag-shaped (`<MultiLine …>`) — never appears in CSS text.
|
|
351
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
158
352
|
message: 'Chart has no accessible text alternative \u2014 pass ariaLabel="\u2026" so screen readers get more than an unlabeled graphic.'
|
|
159
353
|
},
|
|
160
354
|
"raw-form-control": {
|
|
161
355
|
kind: "raw-form-control",
|
|
162
356
|
pattern: RAW_FORM_CONTROL,
|
|
163
357
|
enabled: (cfg) => cfg.rawFormControl,
|
|
358
|
+
// JSX-tag-shaped (`<input …>`) — a CSS element selector (`input, select {…}`) has no leading
|
|
359
|
+
// `<`, so the pattern's anchor can never match real CSS.
|
|
360
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
164
361
|
message: 'Raw <input>/<select>/<textarea> bypasses the ENTIRE theme, not just the font-size floor \u2014 no field surface, no shadow-card depth, no focus ring, no --input-* vars. Use TextInput / NumberInput / Select / Textarea from @mantine/core, or variant="unstyled" for a genuinely borderless/bespoke look.'
|
|
165
362
|
},
|
|
166
363
|
"sub-16-input-font": {
|
|
@@ -168,9 +365,16 @@ const GUARD_RULES = {
|
|
|
168
365
|
pattern: SUB_16_FONT_SIZE,
|
|
169
366
|
// handled inline (full-text tag-scoped scan); entry keeps registry complete
|
|
170
367
|
enabled: (cfg) => cfg.sub16InputFont,
|
|
368
|
+
// Only ever fires nested inside a raw-form-control JSX tag or a `styles={{ input: {…} }}`
|
|
369
|
+
// object literal — both JSX-shaped, neither appears in CSS text.
|
|
370
|
+
appliesTo: (relPath) => !relPath.endsWith(".css"),
|
|
171
371
|
message: "fontSize below 16 on a form control is dead code \u2014 the styles.css iOS floor is `!important` and always wins. Either drop the override, or be honest about 16px in the design."
|
|
172
372
|
}
|
|
173
373
|
};
|
|
374
|
+
function ruleApplies(kind, relPath) {
|
|
375
|
+
const appliesTo = GUARD_RULES[kind].appliesTo;
|
|
376
|
+
return appliesTo === void 0 || appliesTo(relPath);
|
|
377
|
+
}
|
|
174
378
|
function checkSource(text, relPath, cfg) {
|
|
175
379
|
const findings = [];
|
|
176
380
|
const forbiddenAccentRe = GUARD_RULES["off-identity-accent"].pattern(cfg);
|
|
@@ -180,27 +384,36 @@ function checkSource(text, relPath, cfg) {
|
|
|
180
384
|
GUARD_RULES["raw-radius"].pattern.flags
|
|
181
385
|
);
|
|
182
386
|
const lines = text.split("\n");
|
|
387
|
+
const codeText = stripComments(text, guardSyntaxFor(relPath));
|
|
388
|
+
const codeLines = codeText.split("\n");
|
|
183
389
|
for (let i = 0; i < lines.length; i++) {
|
|
184
|
-
const line =
|
|
185
|
-
if (
|
|
186
|
-
const trimmed = line.trimStart();
|
|
187
|
-
if (trimmed.startsWith("//") || trimmed.startsWith("*") || trimmed.startsWith("/*")) continue;
|
|
390
|
+
const line = codeLines[i] ?? "";
|
|
391
|
+
if ((lines[i] ?? "").includes(cfg.allowComment)) continue;
|
|
188
392
|
for (const m of line.matchAll(GUARD_RULES["raw-hex"].pattern)) {
|
|
189
393
|
findings.push({ relPath, line: i + 1, token: m[0], kind: "raw-hex" });
|
|
190
394
|
}
|
|
191
395
|
for (const m of line.matchAll(GUARD_RULES["raw-color-fn"].pattern)) {
|
|
192
396
|
findings.push({ relPath, line: i + 1, token: m[0], kind: "raw-color-fn" });
|
|
193
397
|
}
|
|
194
|
-
|
|
195
|
-
|
|
398
|
+
if (ruleApplies("localstorage-theme", relPath)) {
|
|
399
|
+
for (const m of line.matchAll(GUARD_RULES["localstorage-theme"].pattern)) {
|
|
400
|
+
findings.push({ relPath, line: i + 1, token: m[0], kind: "localstorage-theme" });
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
for (const m of line.matchAll(GUARD_RULES["raw-font-family"].pattern)) {
|
|
404
|
+
findings.push({ relPath, line: i + 1, token: m[0], kind: "raw-font-family" });
|
|
196
405
|
}
|
|
197
|
-
|
|
198
|
-
|
|
406
|
+
if (ruleApplies("off-identity-accent", relPath)) {
|
|
407
|
+
for (const m of line.matchAll(forbiddenAccentRe)) {
|
|
408
|
+
findings.push({ relPath, line: i + 1, token: m[1] ?? "", kind: "off-identity-accent" });
|
|
409
|
+
}
|
|
199
410
|
}
|
|
200
|
-
|
|
201
|
-
|
|
411
|
+
if (ruleApplies("raw-spacing", relPath)) {
|
|
412
|
+
for (const m of line.matchAll(spacingPropRe)) {
|
|
413
|
+
findings.push({ relPath, line: i + 1, token: m[0], kind: "raw-spacing" });
|
|
414
|
+
}
|
|
202
415
|
}
|
|
203
|
-
if (GUARD_RULES["raw-radius"].enabled(cfg)) {
|
|
416
|
+
if (GUARD_RULES["raw-radius"].enabled(cfg) && ruleApplies("raw-radius", relPath)) {
|
|
204
417
|
for (const m of line.matchAll(radiusPropRe)) {
|
|
205
418
|
findings.push({ relPath, line: i + 1, token: m[0], kind: "raw-radius" });
|
|
206
419
|
}
|
|
@@ -221,7 +434,7 @@ function checkSource(text, relPath, cfg) {
|
|
|
221
434
|
findings.push({ relPath, line: i + 1, token: m[0], kind: "off-system-surface-var" });
|
|
222
435
|
}
|
|
223
436
|
}
|
|
224
|
-
if (GUARD_RULES["raw-html-layout"].enabled(cfg) && RAW_HTML_TAG.test(line) && INLINE_STYLE.test(line) && LAYOUT_SURFACE_PROP.test(line)) {
|
|
437
|
+
if (GUARD_RULES["raw-html-layout"].enabled(cfg) && ruleApplies("raw-html-layout", relPath) && RAW_HTML_TAG.test(line) && INLINE_STYLE.test(line) && LAYOUT_SURFACE_PROP.test(line)) {
|
|
225
438
|
findings.push({ relPath, line: i + 1, token: "<raw-html style>", kind: "raw-html-layout" });
|
|
226
439
|
}
|
|
227
440
|
if (GUARD_RULES["inline-spacing"].enabled(cfg)) {
|
|
@@ -229,7 +442,7 @@ function checkSource(text, relPath, cfg) {
|
|
|
229
442
|
findings.push({ relPath, line: i + 1, token: m[0], kind: "inline-spacing" });
|
|
230
443
|
}
|
|
231
444
|
}
|
|
232
|
-
if (GUARD_RULES["inline-display"].enabled(cfg)) {
|
|
445
|
+
if (GUARD_RULES["inline-display"].enabled(cfg) && ruleApplies("inline-display", relPath)) {
|
|
233
446
|
for (const m of line.matchAll(GUARD_RULES["inline-display"].pattern)) {
|
|
234
447
|
findings.push({ relPath, line: i + 1, token: m[0], kind: "inline-display" });
|
|
235
448
|
}
|
|
@@ -239,7 +452,7 @@ function checkSource(text, relPath, cfg) {
|
|
|
239
452
|
findings.push({ relPath, line: i + 1, token: m[0], kind: "raw-visx-axis" });
|
|
240
453
|
}
|
|
241
454
|
}
|
|
242
|
-
if (GUARD_RULES["raw-motion-value"].enabled(cfg)) {
|
|
455
|
+
if (GUARD_RULES["raw-motion-value"].enabled(cfg) && ruleApplies("raw-motion-value", relPath)) {
|
|
243
456
|
for (const m of line.matchAll(MOTION_TRANSITION_NUMERIC)) {
|
|
244
457
|
findings.push({ relPath, line: i + 1, token: m[0], kind: "raw-motion-value" });
|
|
245
458
|
}
|
|
@@ -247,24 +460,24 @@ function checkSource(text, relPath, cfg) {
|
|
|
247
460
|
findings.push({ relPath, line: i + 1, token: m[0], kind: "raw-motion-value" });
|
|
248
461
|
}
|
|
249
462
|
}
|
|
250
|
-
if (GUARD_RULES["raw-form-control"].enabled(cfg)) {
|
|
463
|
+
if (GUARD_RULES["raw-form-control"].enabled(cfg) && ruleApplies("raw-form-control", relPath)) {
|
|
251
464
|
for (const m of line.matchAll(GUARD_RULES["raw-form-control"].pattern)) {
|
|
252
465
|
findings.push({ relPath, line: i + 1, token: m[0], kind: "raw-form-control" });
|
|
253
466
|
}
|
|
254
467
|
}
|
|
255
468
|
}
|
|
256
|
-
if (GUARD_RULES["unframed-chart"].enabled(cfg)) {
|
|
257
|
-
for (const m of
|
|
258
|
-
const lineNo =
|
|
469
|
+
if (GUARD_RULES["unframed-chart"].enabled(cfg) && ruleApplies("unframed-chart", relPath)) {
|
|
470
|
+
for (const m of codeText.matchAll(RAW_CHART_LEGEND_ARRAY)) {
|
|
471
|
+
const lineNo = codeText.slice(0, (m.index ?? 0) + m[0].length).split("\n").length;
|
|
259
472
|
if (isSkippedLine(lines[lineNo - 1] ?? "", cfg)) continue;
|
|
260
473
|
findings.push({ relPath, line: lineNo, token: "items={[", kind: "unframed-chart" });
|
|
261
474
|
}
|
|
262
475
|
}
|
|
263
|
-
if (GUARD_RULES["chart-missing-aria-label"].enabled(cfg)) {
|
|
264
|
-
for (const m of
|
|
476
|
+
if (GUARD_RULES["chart-missing-aria-label"].enabled(cfg) && ruleApplies("chart-missing-aria-label", relPath)) {
|
|
477
|
+
for (const m of codeText.matchAll(CHART_ENTRY_POINT_TAG)) {
|
|
265
478
|
const tagText = m[0];
|
|
266
479
|
if (HAS_ARIA_LABEL_PROP.test(tagText)) continue;
|
|
267
|
-
const lineNo =
|
|
480
|
+
const lineNo = codeText.slice(0, (m.index ?? 0) + tagText.length).split("\n").length;
|
|
268
481
|
if (isSkippedLine(lines[lineNo - 1] ?? "", cfg)) continue;
|
|
269
482
|
findings.push({
|
|
270
483
|
relPath,
|
|
@@ -274,39 +487,39 @@ function checkSource(text, relPath, cfg) {
|
|
|
274
487
|
});
|
|
275
488
|
}
|
|
276
489
|
}
|
|
277
|
-
if (GUARD_RULES["card-with-border"].enabled(cfg)) {
|
|
278
|
-
for (const m of
|
|
490
|
+
if (GUARD_RULES["card-with-border"].enabled(cfg) && ruleApplies("card-with-border", relPath)) {
|
|
491
|
+
for (const m of codeText.matchAll(CARD_SURFACE_TAG)) {
|
|
279
492
|
const withBorder = WITH_BORDER_PROP.exec(m[0]);
|
|
280
493
|
if (withBorder === null) continue;
|
|
281
|
-
const lineNo =
|
|
494
|
+
const lineNo = codeText.slice(0, (m.index ?? 0) + withBorder.index).split("\n").length;
|
|
282
495
|
if (isSkippedLine(lines[lineNo - 1] ?? "", cfg)) continue;
|
|
283
496
|
findings.push({ relPath, line: lineNo, token: "withBorder", kind: "card-with-border" });
|
|
284
497
|
}
|
|
285
498
|
}
|
|
286
|
-
if (GUARD_RULES["sub-16-input-font"].enabled(cfg)) {
|
|
287
|
-
for (const m of
|
|
499
|
+
if (GUARD_RULES["sub-16-input-font"].enabled(cfg) && ruleApplies("sub-16-input-font", relPath)) {
|
|
500
|
+
for (const m of codeText.matchAll(RAW_FORM_CONTROL_TAG)) {
|
|
288
501
|
const tagText = m[0];
|
|
289
502
|
if (!INLINE_STYLE.test(tagText)) continue;
|
|
290
503
|
const fontSizeMatch = [...tagText.matchAll(SUB_16_FONT_SIZE)][0];
|
|
291
504
|
if (fontSizeMatch === void 0) continue;
|
|
292
505
|
const value = Number.parseFloat(fontSizeMatch[1] ?? "");
|
|
293
506
|
if (!Number.isFinite(value) || value >= 16) continue;
|
|
294
|
-
const lineNo =
|
|
507
|
+
const lineNo = codeText.slice(0, (m.index ?? 0) + tagText.length).split("\n").length;
|
|
295
508
|
if (isSkippedLine(lines[lineNo - 1] ?? "", cfg)) continue;
|
|
296
509
|
findings.push({ relPath, line: lineNo, token: fontSizeMatch[0], kind: "sub-16-input-font" });
|
|
297
510
|
}
|
|
298
|
-
for (const m of
|
|
511
|
+
for (const m of codeText.matchAll(STYLES_INPUT_PART)) {
|
|
299
512
|
const inputBody = m[1] ?? "";
|
|
300
513
|
const fontSizeMatch = [...inputBody.matchAll(SUB_16_FONT_SIZE)][0];
|
|
301
514
|
if (fontSizeMatch === void 0) continue;
|
|
302
515
|
const value = Number.parseFloat(fontSizeMatch[1] ?? "");
|
|
303
516
|
if (!Number.isFinite(value) || value >= 16) continue;
|
|
304
|
-
const lineNo =
|
|
517
|
+
const lineNo = codeText.slice(0, (m.index ?? 0) + m[0].length).split("\n").length;
|
|
305
518
|
if (isSkippedLine(lines[lineNo - 1] ?? "", cfg)) continue;
|
|
306
519
|
findings.push({ relPath, line: lineNo, token: fontSizeMatch[0], kind: "sub-16-input-font" });
|
|
307
520
|
}
|
|
308
521
|
}
|
|
309
|
-
return findings;
|
|
522
|
+
return findings.filter((f) => !isRuleExempt(f.kind, f.relPath, cfg.exemptRules));
|
|
310
523
|
}
|
|
311
524
|
export {
|
|
312
525
|
DEFAULT_GUARD_CONFIG,
|
package/dist/guard/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Guard types — Mantine-free, dependency-free (zero imports beyond TS types).
|
|
3
3
|
*
|
|
4
|
-
* GuardKind is the closed set of
|
|
4
|
+
* GuardKind is the closed set of 19 violation kinds the theme guard can emit.
|
|
5
5
|
* Finding is the structured result per violation, replacing the old `Violation` shape.
|
|
6
6
|
* GuardConfig is the per-run configuration that drives checkSource.
|
|
7
7
|
*/
|
|
8
|
-
/** The
|
|
9
|
-
export type GuardKind = 'raw-hex' | 'raw-color-fn' | 'localstorage-theme' | 'off-identity-accent' | 'raw-spacing' | 'raw-radius' | 'raw-surface' | 'card-with-border' | 'off-system-surface-var' | 'raw-html-layout' | 'inline-spacing' | 'inline-display' | 'raw-visx-axis' | 'raw-motion-value' | 'unframed-chart' | 'chart-missing-aria-label' | 'raw-form-control' | 'sub-16-input-font';
|
|
8
|
+
/** The 19 theme-guard violation kinds. */
|
|
9
|
+
export type GuardKind = 'raw-hex' | 'raw-color-fn' | 'localstorage-theme' | 'off-identity-accent' | 'raw-spacing' | 'raw-radius' | 'raw-surface' | 'card-with-border' | 'off-system-surface-var' | 'raw-html-layout' | 'inline-spacing' | 'inline-display' | 'raw-visx-axis' | 'raw-motion-value' | 'unframed-chart' | 'chart-missing-aria-label' | 'raw-form-control' | 'sub-16-input-font' | 'raw-font-family';
|
|
10
10
|
/**
|
|
11
11
|
* A structured finding — the chosen testable surface (§C.4). Replaces the old `Violation` type.
|
|
12
12
|
* `relPath` + `line` + `token` + `kind` uniquely identify the violation.
|
|
@@ -93,5 +93,26 @@ export type GuardConfig = {
|
|
|
93
93
|
* Default 'theme-allow'. Pure-comment lines (// * /\*) are always skipped.
|
|
94
94
|
*/
|
|
95
95
|
readonly allowComment: string;
|
|
96
|
+
/**
|
|
97
|
+
* Per-rule, per-path exemptions — complements whole-file `exempt` (BasaltConfig, which skips
|
|
98
|
+
* ALL rules for a file) and code-level `appliesTo` (hardcoded per-kind path scoping, e.g.
|
|
99
|
+
* raw-visx-axis → chart files only). This is the config-driven counterpart: a consumer can say
|
|
100
|
+
* "kind K does not apply under path P" without exempting the whole file or forking the rule.
|
|
101
|
+
*
|
|
102
|
+
* Each value is a list of path-segment patterns matched against a finding's `relPath`. A pattern
|
|
103
|
+
* matches when `relPath.split('/')` includes it as a WHOLE segment — `'agent'` matches
|
|
104
|
+
* `src/agent/part-list.tsx` but not `src/agenting.ts`. A trailing `/` is stripped before
|
|
105
|
+
* matching, so `'agent'` and `'agent/'` behave identically. Applied as a post-filter over the
|
|
106
|
+
* final findings, so it uniformly covers every kind — both the GUARD_RULES registry loop and the
|
|
107
|
+
* inline-handled kinds (raw-surface, raw-html-layout, sub-16-input-font, …).
|
|
108
|
+
*
|
|
109
|
+
* Required (like every other GuardConfig field, defaulted via DEFAULT_GUARD_CONFIG to `{}`) —
|
|
110
|
+
* `exactOptionalPropertyTypes` rejects the `?? DEFAULT_GUARD_CONFIG.x` pattern used to build a
|
|
111
|
+
* GuardConfig from BasaltConfig (where the field IS optional) if this were optional too.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* { exemptRules: { 'inline-display': ['agent'] } } // inline-display never fires under src/agent/**
|
|
115
|
+
*/
|
|
116
|
+
readonly exemptRules: Partial<Record<GuardKind, string[]>>;
|
|
96
117
|
};
|
|
97
118
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/guard/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,cAAc,GACd,oBAAoB,GACpB,qBAAqB,GACrB,aAAa,GACb,YAAY,GACZ,aAAa,GACb,kBAAkB,GAClB,wBAAwB,GACxB,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,0BAA0B,GAC1B,kBAAkB,GAClB,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/guard/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,cAAc,GACd,oBAAoB,GACpB,qBAAqB,GACrB,aAAa,GACb,YAAY,GACZ,aAAa,GACb,kBAAkB,GAClB,wBAAwB,GACxB,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,0BAA0B,GAC1B,kBAAkB,GAClB,mBAAmB,GACnB,iBAAiB,CAAA;AAErB;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CACzB,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,wGAAwG;IACxG,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,uEAAuE;IACvE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5C,iGAAiG;IACjG,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;IAChC,2GAA2G;IAC3G,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAA;IACrC,sGAAsG;IACtG,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;IAC/B,8EAA8E;IAC9E,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;IAC/B,4FAA4F;IAC5F,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;IAC/B,yFAAyF;IACzF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAC7B,kGAAkG;IAClG,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAA;IACvC;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;IAChC;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;IAChC;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;CAC3D,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { BasaltProvider, type BasaltProviderProps, BasaltErrorBoundary, type BasaltErrorContext, } from './provider/index.js';
|
|
9
9
|
export { createBasaltTheme, baseTheme, cssVariablesResolver } from './theme/index.js';
|
|
10
|
+
export type { BasaltFontsConfig, CreateBasaltThemeOptions } from './theme/index.js';
|
|
10
11
|
export { ThemeToggle, type ThemeToggleProps } from './theme-toggle/index.js';
|
|
11
12
|
export { MOTION_DURATION, MOTION_SPRING, MOTION_EASE_STANDARD } from './motion/index.js';
|
|
12
13
|
export { BasaltShell, NavCountBadge, AppSidebar, SidebarSearch, type SidebarSearchConfig, SidebarAccount, MobileNav, AppBreadcrumbs, type BreadcrumbLinkRenderer, PageHeaderProvider, PageActions, PageActionsOutlet, type SidebarSection, type SidebarItem, type BasaltShellProps, type BrandConfig, type SettingsMenuItem, type AppSidebarProps, type MobileNavItem, type MobileNavSection, type NavLinkRenderer, type MobileNavLinkRenderer, type AccountBadgeTone, type BasaltIdentity, type BasaltRole, type BasaltPlan, type AccountMenuItem, type BasaltAccountState, type BasaltAccountActions, type BasaltAccountProps, } from './shell/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EACL,WAAW,EACX,aAAa,EACb,UAAU,EACV,aAAa,EACb,KAAK,mBAAmB,EACxB,cAAc,EACd,SAAS,EACT,cAAc,EACd,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,gBAAgB,E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AY,EACZ,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,SAAS,EACT,cAAc,GACf,MAAM,SAAS,CAAA"}
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -29,7 +29,22 @@ export type BasaltProviderProps = {
|
|
|
29
29
|
theme?: MantineProviderProps['theme'];
|
|
30
30
|
/**
|
|
31
31
|
* Inject the `--vx-*` palette stylesheet once via an inline `<style>`. Default `true`. Set
|
|
32
|
-
* `false` to skip it (SSR / head injection — emit `buildPaletteCss(paletteOptions)` yourself
|
|
32
|
+
* `false` to skip it (SSR / head injection — emit `buildPaletteCss(paletteOptions)` yourself, all
|
|
33
|
+
* three builders importable from `basalt-ui/tokens`).
|
|
34
|
+
* A `{ fonts }` config passed to `createBasaltTheme` rides this SAME injection (its
|
|
35
|
+
* `--basalt-font-*` declarations are appended to the same `<style>`), so `injectPalette={false}`
|
|
36
|
+
* opts fonts out too — emit `buildFontsCss(theme.other.basaltFonts)` yourself alongside the
|
|
37
|
+
* palette CSS in that case.
|
|
38
|
+
* A `{ radius }` config rides the SAME injection too (its `--vx-radius-*` override declarations
|
|
39
|
+
* are appended alongside), so `injectPalette={false}` opts radius out just the same — an SSR
|
|
40
|
+
* consumer disabling injection must also emit `buildRadiusCss(theme.other.basaltRadius)`
|
|
41
|
+
* themselves, or `var(--vx-radius-*)` consumers render at their defaults instead of the retuned
|
|
42
|
+
* level.
|
|
43
|
+
* A `{ density }` config rides the SAME injection too (its `--vx-space-*` override declarations
|
|
44
|
+
* are appended alongside), so `injectPalette={false}` opts density out just the same — an SSR
|
|
45
|
+
* consumer disabling injection must also emit `buildDensityCss(theme.other.basaltDensity)`
|
|
46
|
+
* themselves, or `var(--vx-space-*)` consumers render at their defaults instead of the retuned
|
|
47
|
+
* level.
|
|
33
48
|
*/
|
|
34
49
|
injectPalette?: boolean;
|
|
35
50
|
/**
|
|
@@ -88,6 +103,20 @@ export declare class BasaltErrorBoundary extends Component<BoundaryProps, Bounda
|
|
|
88
103
|
componentDidCatch(error: unknown, info: ErrorInfo): void;
|
|
89
104
|
render(): ReactNode;
|
|
90
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Compose the four independently-built override CSS blocks into ONE injected `<style>` body, in
|
|
108
|
+
* cascade-winning order. Every builder (`buildPaletteCss`/`buildFontsCss`/`buildRadiusCss`/
|
|
109
|
+
* `buildDensityCss`) emits its declarations under a bare `:root { ... }` block — EQUAL selector
|
|
110
|
+
* specificity across all four — so nothing but DOCUMENT ORDER decides which value a browser paints
|
|
111
|
+
* when two blocks declare the same custom property. `density` must come LAST (its `--vx-space-*`
|
|
112
|
+
* overrides must out-cascade the base palette's own defaults), `radius` after `fonts`, `fonts` after
|
|
113
|
+
* `base` — reorder this array and the density/radius/fonts knobs silently stop working, with every
|
|
114
|
+
* OTHER existing test still green (each builder is tested for its OWN output in isolation, not for
|
|
115
|
+
* where it lands in the concatenated string). Exported as a pure function (not inlined in
|
|
116
|
+
* `BasaltBridge`'s `useMemo`) purely so `provider/index.test.ts` can assert the ORDER holds without
|
|
117
|
+
* rendering a React tree.
|
|
118
|
+
*/
|
|
119
|
+
export declare function composeInjectedCss(base: string, fontsCss: string, radiusCss: string, densityCss: string): string;
|
|
91
120
|
export declare function BasaltProvider({ children, theme, injectPalette, paletteOptions, defaultColorScheme, onError, nonce, sseUrl, healthUrl, healthIntervalMs, ...rest }: BasaltProviderProps): import("react").JSX.Element;
|
|
92
121
|
export {};
|
|
93
122
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,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