@mccaskie-labs/workbench-ui 0.7.0 → 0.8.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/CHANGELOG.md +6 -0
- package/dist/index.js +1 -1
- package/dist/style.d.ts +1 -1
- package/dist/style.js +34 -2
- package/dist/styles.js +36 -0
- package/dist/ui-styles.js +25 -25
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mccaskie-labs/workbench-ui
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Every tool follows the project's look (docs/theming.md step 2, Robert, 24 November 2026). Each tool's colour, font and corner variables now default to the shared theme tokens with a Clean, light fallback (`--wb-booking-accent: var(--wb-accent, #2563eb)`), and tool colours with no token of their own (a recessed panel, a status mark, a tinted pill) are worked out from the tokens with `color-mix()`. So a page drawn with these tools takes the look in the project's workbench.css: light (Clean) by default, or whatever brand.json and project.css say. Breaking for a project page that relied on the old dark defaults: give brand.json the look you want, or set the tokens in project.css. Variable and class names are unchanged, so existing project.css overrides still win. workbench-ui: `styleProblems` refuses a tool's text, muted, surface, line, background, accent, focus, danger, success, warning, font or radius variable whose default doesn't read its token (email, PDF and image follow in step 3); the `wb-ui` class no longer forces dark, and Workbench's own pages (`STYLE`, `UI_CSS`) keep their dark values; `shell` with `stylesheets` (a project page) no longer says dark in its meta tag.
|
|
8
|
+
|
|
3
9
|
## 0.7.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -241,7 +241,7 @@ export function topBar(opts) {
|
|
|
241
241
|
}
|
|
242
242
|
/** A whole page: the shared look, the top bar, the heading, then `body`. */
|
|
243
243
|
export function shell(opts) {
|
|
244
|
-
return `<!doctype html><html lang="en-AU" class="wb-ui${opts.admin ? " wb-ui-admin" : ""}"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"
|
|
244
|
+
return `<!doctype html><html lang="en-AU" class="wb-ui${opts.admin ? " wb-ui-admin" : ""}"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${opts.stylesheets ? (opts.admin ? '<meta name="color-scheme" content="light">' : "") : '<meta name="color-scheme" content="dark">'}
|
|
245
245
|
<title>${escape(opts.title)} · ${escape(opts.site)}</title>${opts.stylesheets ? opts.stylesheets.map((href) => `<link rel="stylesheet" href="${escape(href)}">`).join("") : STYLE}${opts.head ?? ""}
|
|
246
246
|
${opts.top}
|
|
247
247
|
<main class="wb-ui-main"><h1 class="wb-ui-title">${escape(opts.title)}</h1>${opts.body}</main>${opts.tail ?? ""}</html>`;
|
package/dist/style.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const CSS: string;
|
|
|
8
8
|
* weight and never touches a page of the project's own.
|
|
9
9
|
*/
|
|
10
10
|
export declare const BASE_CSS: string;
|
|
11
|
-
/** UI_STYLES as plain rules: the variables on :root, then each class and its states. */
|
|
11
|
+
/** UI_STYLES as plain rules for Workbench's own pages: always dark, the variables on :root, then each class and its states. */
|
|
12
12
|
export declare const UI_CSS: string;
|
|
13
13
|
/** The whole look as a <style> tag: the page conventions, then the helpers' classes, which win. */
|
|
14
14
|
export declare const STYLE: string;
|
package/dist/style.js
CHANGED
|
@@ -125,9 +125,41 @@ export const BASE_CSS = `:where(.wb-ui),:where(.wb-ui) *,:where(.wb-ui) ::before
|
|
|
125
125
|
@keyframes wb-ui-spin{to{transform:rotate(360deg)}}
|
|
126
126
|
@media (prefers-reduced-motion:reduce){:where(.wb-ui) *{animation:none!important;transition:none!important}}
|
|
127
127
|
`;
|
|
128
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Workbench's own pages (Control, the Gateway, the setup site, wb-probe) are
|
|
130
|
+
* always dark, whatever a project's look: these are the values UI_STYLES'
|
|
131
|
+
* variables take there, in place of the shared theme tokens a project's
|
|
132
|
+
* workbench.css works out from its brand.json.
|
|
133
|
+
*/
|
|
134
|
+
const WORKBENCH_DARK = {
|
|
135
|
+
"--wb-ui-background": "#121214",
|
|
136
|
+
"--wb-ui-surface": "#1b1b1f",
|
|
137
|
+
"--wb-ui-raised": "#25252b",
|
|
138
|
+
"--wb-ui-text": "#e8e8ec",
|
|
139
|
+
"--wb-ui-muted": "#9a9aa6",
|
|
140
|
+
"--wb-ui-line": "#33333b",
|
|
141
|
+
"--wb-ui-bar": "rgba(18,18,20,.92)",
|
|
142
|
+
"--wb-ui-accent": "#4c8dff",
|
|
143
|
+
"--wb-ui-accent-hover": "#6aa1ff",
|
|
144
|
+
"--wb-ui-accent-text": "#0b0b0d",
|
|
145
|
+
"--wb-ui-ok": "#5cc87a",
|
|
146
|
+
"--wb-ui-bad": "#ff6b66",
|
|
147
|
+
"--wb-ui-warn": "#f0a43a",
|
|
148
|
+
"--wb-ui-focus": "rgba(76,141,255,.4)",
|
|
149
|
+
"--wb-ui-pass": "#5cc87a",
|
|
150
|
+
"--wb-ui-fail": "#ff6b66",
|
|
151
|
+
"--wb-ui-skip": "#f0a43a",
|
|
152
|
+
"--wb-ui-run": "#4c8dff",
|
|
153
|
+
"--wb-ui-pass-bg": "rgba(92,200,122,.1)",
|
|
154
|
+
"--wb-ui-fail-bg": "rgba(255,107,102,.12)",
|
|
155
|
+
"--wb-ui-skip-bg": "rgba(240,164,58,.1)",
|
|
156
|
+
"--wb-ui-run-bg": "rgba(76,141,255,.12)",
|
|
157
|
+
"--wb-ui-font": "system-ui,-apple-system,\"Segoe UI\",sans-serif",
|
|
158
|
+
"--wb-ui-mono": "ui-monospace,\"Cascadia Code\",Consolas,monospace"
|
|
159
|
+
};
|
|
160
|
+
/** UI_STYLES as plain rules for Workbench's own pages: always dark, the variables on :root, then each class and its states. */
|
|
129
161
|
export const UI_CSS = [
|
|
130
|
-
`:root{
|
|
162
|
+
`:root{color-scheme:dark;${UI_STYLES.variables.map((x) => `${x.name}:${WORKBENCH_DARK[x.name] ?? x.value}`).join(";")}}`,
|
|
131
163
|
...UI_STYLES.classes.flatMap((c) => [`.${c.name}{${c.css}}`, ...(c.states ?? []).map((st) => `.${c.name}${st.selector}{${st.css}}`)]),
|
|
132
164
|
].join("\n");
|
|
133
165
|
/** The whole look as a <style> tag: the page conventions, then the helpers' classes, which win. */
|
package/dist/styles.js
CHANGED
|
@@ -19,6 +19,36 @@ export const STYLESHEETS = ["/styles/workbench.css", "/styles/project.css"];
|
|
|
19
19
|
*/
|
|
20
20
|
export const STYLED_SCOPE = "@mccaskie-labs/workbench-";
|
|
21
21
|
const NAME = /^[a-z][a-z0-9-]*$/;
|
|
22
|
+
/**
|
|
23
|
+
* A tool variable's last part and the shared theme token its default must read
|
|
24
|
+
* (docs/theming.md, step 2): the colours, fonts and corners every look sets.
|
|
25
|
+
*/
|
|
26
|
+
const TOKEN_FOR = {
|
|
27
|
+
text: "--wb-text",
|
|
28
|
+
muted: "--wb-muted",
|
|
29
|
+
surface: "--wb-surface",
|
|
30
|
+
line: "--wb-line",
|
|
31
|
+
background: "--wb-background",
|
|
32
|
+
accent: "--wb-accent",
|
|
33
|
+
"accent-hover": "--wb-accent-hover",
|
|
34
|
+
"on-accent": "--wb-on-accent",
|
|
35
|
+
"accent-text": "--wb-on-accent",
|
|
36
|
+
focus: "--wb-focus",
|
|
37
|
+
danger: "--wb-danger",
|
|
38
|
+
error: "--wb-danger",
|
|
39
|
+
bad: "--wb-danger",
|
|
40
|
+
"error-bg": "--wb-danger-bg",
|
|
41
|
+
good: "--wb-success",
|
|
42
|
+
ok: "--wb-success",
|
|
43
|
+
warn: "--wb-warning",
|
|
44
|
+
font: "--wb-font",
|
|
45
|
+
"heading-font": "--wb-font-heading",
|
|
46
|
+
"body-font": "--wb-font",
|
|
47
|
+
mono: "--wb-font-mono",
|
|
48
|
+
radius: "--wb-radius",
|
|
49
|
+
};
|
|
50
|
+
/** Tools whose output isn't a page (email is inlined, a PDF and an image are drawn apart) and so read brand.json directly for now (docs/theming.md, step 3). */
|
|
51
|
+
const TOKENS_LATER = new Set(["email", "pdf", "image"]);
|
|
22
52
|
/** What is wrong with a tool's styles: a name off its prefix, a class with no default rule, a variable used but not listed. */
|
|
23
53
|
export function styleProblems(s) {
|
|
24
54
|
const out = [];
|
|
@@ -35,6 +65,12 @@ export function styleProblems(s) {
|
|
|
35
65
|
out.push(`${s.tool}: variable ${v.name} is listed twice`);
|
|
36
66
|
if (!v.value.trim() || !v.about.trim())
|
|
37
67
|
out.push(`${s.tool}: variable ${v.name} needs a value and what it is for`);
|
|
68
|
+
const last = v.name.slice(2 + s.prefix.length);
|
|
69
|
+
const token = TOKEN_FOR[last];
|
|
70
|
+
// A radius may read the small one (controls); a font may be "inherit" (the page's).
|
|
71
|
+
const reads = token === "--wb-radius" ? /var\(--wb-radius(-small)?\b/ : token ? new RegExp(`var\\(${token}\\b`) : null;
|
|
72
|
+
if (reads && !TOKENS_LATER.has(s.tool) && !reads.test(v.value) && !(token?.startsWith("--wb-font") && v.value === "inherit"))
|
|
73
|
+
out.push(`${s.tool}: variable ${v.name} must default to the theme token ${token} (var(${token}, <fallback>))`);
|
|
38
74
|
vars.add(v.name);
|
|
39
75
|
}
|
|
40
76
|
const classes = new Set();
|
package/dist/ui-styles.js
CHANGED
|
@@ -26,38 +26,38 @@ export const UI_STYLES = {
|
|
|
26
26
|
title: "Workbench pages",
|
|
27
27
|
prefix: "wb-ui-",
|
|
28
28
|
variables: [
|
|
29
|
-
{ name: "--wb-ui-background", value: "#
|
|
30
|
-
{ name: "--wb-ui-surface", value: "#
|
|
31
|
-
{ name: "--wb-ui-raised", value: "#
|
|
32
|
-
{ name: "--wb-ui-text", value: "#
|
|
33
|
-
{ name: "--wb-ui-muted", value: "#
|
|
34
|
-
{ name: "--wb-ui-line", value: "#
|
|
35
|
-
{ name: "--wb-ui-bar", value: "
|
|
36
|
-
{ name: "--wb-ui-accent", value: "#
|
|
37
|
-
{ name: "--wb-ui-accent-hover", value: "#
|
|
38
|
-
{ name: "--wb-ui-accent-text", value: "#
|
|
39
|
-
{ name: "--wb-ui-ok", value: "#
|
|
40
|
-
{ name: "--wb-ui-bad", value: "#
|
|
41
|
-
{ name: "--wb-ui-warn", value: "#
|
|
42
|
-
{ name: "--wb-ui-focus", value: "rgba(
|
|
43
|
-
{ name: "--wb-ui-pass", value: "#
|
|
29
|
+
{ name: "--wb-ui-background", value: "var(--wb-background, #ffffff)", about: "Behind the page" },
|
|
30
|
+
{ name: "--wb-ui-surface", value: "var(--wb-surface, #f7f8f8)", about: "Cards, inputs and code blocks" },
|
|
31
|
+
{ name: "--wb-ui-raised", value: "color-mix(in srgb, var(--wb-surface, #f7f8f8), var(--wb-text, #1f2937) 7%)", about: "Table heads, chips and a row under the pointer" },
|
|
32
|
+
{ name: "--wb-ui-text", value: "var(--wb-text, #1f2937)", about: "Body text" },
|
|
33
|
+
{ name: "--wb-ui-muted", value: "var(--wb-muted, #5b6472)", about: "Quieter text: a card's sentence, labels, small print" },
|
|
34
|
+
{ name: "--wb-ui-line", value: "var(--wb-line, #d7d8db)", about: "Borders and rules" },
|
|
35
|
+
{ name: "--wb-ui-bar", value: "color-mix(in srgb, var(--wb-background, #ffffff), transparent 8%)", about: "The top bar, over the page as it scrolls" },
|
|
36
|
+
{ name: "--wb-ui-accent", value: "var(--wb-accent, #2563eb)", about: "Links, buttons and the current page" },
|
|
37
|
+
{ name: "--wb-ui-accent-hover", value: "var(--wb-accent-hover, #1f54c8)", about: "A link or button under the pointer" },
|
|
38
|
+
{ name: "--wb-ui-accent-text", value: "var(--wb-on-accent, #ffffff)", about: "Text on a filled button" },
|
|
39
|
+
{ name: "--wb-ui-ok", value: "var(--wb-success, #15803d)", about: "Words that say something worked" },
|
|
40
|
+
{ name: "--wb-ui-bad", value: "var(--wb-danger, #b42318)", about: "Words that say something failed, and the production tag" },
|
|
41
|
+
{ name: "--wb-ui-warn", value: "var(--wb-warning, #a15c07)", about: "Warnings, and the tag of any environment but production" },
|
|
42
|
+
{ name: "--wb-ui-focus", value: "var(--wb-focus, rgba(37,99,235,0.4))", about: "The ring around whatever has the keyboard" },
|
|
43
|
+
{ name: "--wb-ui-pass", value: "var(--wb-success, #15803d)", about: "A pill or chip that passed" },
|
|
44
44
|
{ name: "--wb-ui-refused", value: "#b48cff", about: "A pill or chip for a call that was refused" },
|
|
45
|
-
{ name: "--wb-ui-fail", value: "#
|
|
46
|
-
{ name: "--wb-ui-skip", value: "#
|
|
47
|
-
{ name: "--wb-ui-run", value: "#
|
|
48
|
-
{ name: "--wb-ui-pass-bg", value: "
|
|
45
|
+
{ name: "--wb-ui-fail", value: "var(--wb-danger, #b42318)", about: "A pill or chip that failed, and a field with a problem" },
|
|
46
|
+
{ name: "--wb-ui-skip", value: "var(--wb-warning, #a15c07)", about: "A pill or chip that was skipped or waits" },
|
|
47
|
+
{ name: "--wb-ui-run", value: "var(--wb-accent, #2563eb)", about: "A pill or chip still running" },
|
|
48
|
+
{ name: "--wb-ui-pass-bg", value: "color-mix(in srgb, var(--wb-success, #15803d) 10%, transparent)", about: "Behind a passed pill" },
|
|
49
49
|
{ name: "--wb-ui-refused-bg", value: "rgba(180,140,255,.1)", about: "Behind a refused pill" },
|
|
50
|
-
{ name: "--wb-ui-fail-bg", value: "
|
|
51
|
-
{ name: "--wb-ui-skip-bg", value: "
|
|
52
|
-
{ name: "--wb-ui-run-bg", value: "
|
|
50
|
+
{ name: "--wb-ui-fail-bg", value: "color-mix(in srgb, var(--wb-danger, #b42318) 12%, transparent)", about: "Behind a failed pill, and a failed table row" },
|
|
51
|
+
{ name: "--wb-ui-skip-bg", value: "color-mix(in srgb, var(--wb-warning, #a15c07) 10%, transparent)", about: "Behind a skipped pill" },
|
|
52
|
+
{ name: "--wb-ui-run-bg", value: "color-mix(in srgb, var(--wb-accent, #2563eb) 12%, transparent)", about: "Behind a running pill" },
|
|
53
53
|
{ name: "--wb-ui-edge", value: "transparent", about: "The coloured edge on a table row's first cell (set per row by o-pass, o-fail and the rest)" },
|
|
54
|
-
{ name: "--wb-ui-font", value:
|
|
55
|
-
{ name: "--wb-ui-mono", value:
|
|
54
|
+
{ name: "--wb-ui-font", value: "var(--wb-font, system-ui, sans-serif)", about: "The page's font" },
|
|
55
|
+
{ name: "--wb-ui-mono", value: "var(--wb-font-mono, ui-monospace, monospace)", about: "Code's font" },
|
|
56
56
|
{ name: "--wb-ui-width", value: "max(64rem,80vw)", about: "Widest the page's column grows" },
|
|
57
57
|
{ name: "--wb-ui-input-width", value: "24rem", about: "Widest a one-line control grows" },
|
|
58
58
|
],
|
|
59
59
|
classes: [
|
|
60
|
-
{ name: "wb-ui", element: "html", about: "The whole page
|
|
60
|
+
{ name: "wb-ui", element: "html", about: "The whole page, in the project's look (Workbench's own pages are always dark)", css: `background:${v("background")};color:${v("text")};font:15px/1.55 ${v("font")}` },
|
|
61
61
|
{ name: "wb-ui-admin", element: "html", about: "A project's own admin page (with wb-ui): its accent and fonts on light neutrals, from the theme tokens", css: "color-scheme:light" },
|
|
62
62
|
{ name: "wb-ui-main", element: "main", about: "The page's column under the top bar", css: `display:block;max-width:${v("width")};margin:0 auto;padding:1.75rem 1rem 3rem` },
|
|
63
63
|
{ name: "wb-ui-title", element: "h1", about: "The page's heading", css: "font-size:1.6rem;line-height:1.2;margin:0 0 .6rem" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mccaskie-labs/workbench-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Workbench pages: one dark look, a top bar with the environment tag, cards, outcome pills, and one format for times, money and durations.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|