@mccaskie-labs/workbench-ui 0.9.0 → 0.11.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @mccaskie-labs/workbench-ui
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Form fields are sized from what they hold, and text areas grow as people type (Robert, 24 November 2026). workbench-forms: renderForm gives every one-line input a width worked out from the field when the limits register gives none: a number under 10,000 is about six characters wide, a 4-digit postcode five, a phone number sixteen, a date fourteen, an email thirty, and text with a maximum of 40 or fewer characters about that many; longer text takes the full width. The widths are new `wb-form-size-<n>` classes (n in characters: 5, 6, 8, 10, 12, 14, 16, 20, 24, 30, 40), each capped at the form's width, so a phone or a narrow layout column still fits. The register's `width` still wins. A long answer's text area grows with its text up to `--wb-form-textarea-cap` and only then scrolls; `data-wb-grow="off"` keeps one fixed. workbench-ui: `input()` sizes a control the same way from its type, maxlength, min and max (`wb-ui-size-<n>`, which any tool's own control can also carry, weighted to win over that tool's single-class rule); every text area on a page built with shell grows with its text (BASE_CSS); and FORM_SCRIPT sets the height itself in browsers without CSS `field-sizing` (Firefox), with no animation and without moving the page.
8
+
9
+ ## 0.10.0
10
+
11
+ ### Minor Changes
12
+
13
+ - The look library as data (docs/look-studio.md step 1, Robert, 24 November 2026). The seven looks are now split into small checked files in `library/`: seven palettes, seven font pairings, three site layouts (`standard`, `centred`, `showcase`, from `SITE_LAYOUT_CHOICES`) and seven looks that each name one of each plus a corner shape. Every item has a state (`testing`, `released`, `withdrawn`), a `source` and a `since`; `LIBRARY` holds them, `LOOKS` is the released looks with their parts filled in (each now also carries `status`, `palette`, `pairing` and `layout`), and `LookId` is any look's id. Every project's generated theme is byte for byte what it was (tested). New: `resolveTheme`, `resolveAdminTheme`, `lookById`, `lookFor` and `themeInput` take an optional library; `ThemeInput` gains `palette`, `pairing` and `layout` (by id, over the look's own); `resolveSiteLayout` gives a project's site layout; `libraryProblems` checks a library's rules (every palette reads in light, dark and as an admin page; no two palettes nearer than `MIN_PALETTE_DISTANCE` by `paletteDistance`; a released look names only released parts) and `itemProblems` one file's shape, refusing any field it doesn't know. A project may add its own items in `workbench/looks/*.json`: `npx workbench-ui styles` reads them beside the package's, so brand.json can name them, and `--check` names a bad, clashing or unreadable one. A released library file never changes: `library/released.json` keeps each one's fingerprint and `npm run library` refuses to run when one has changed. (brand.json can carry `palette`, `pairing` and `layout` once workbench-config's schema allows them.)
14
+
3
15
  ## 0.9.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -81,3 +81,16 @@ Pages are always dark, whatever the computer is set to. A page with its own rule
81
81
  `npx workbench-ui styles` writes the project's `public/styles/workbench.css` from every installed Workbench tool, and `npx workbench-ui styles --check` (in Checks) fails when it is stale, when `project.css` names a `wb-` class or variable no tool draws, or when the project's own pages (`src/`, `public/`) put such a class on an element. The older page conventions (`.body`, `.note`, `.warn`, bare buttons and tables) are only in `STYLE` and `CSS`, for Workbench's own pages: a project's workbench.css leaves them out, so they never reach a client's own markup.
82
82
 
83
83
  Runs on Node 24 and the Cloudflare Workers runtime. No dependencies.
84
+
85
+ ## The look library
86
+
87
+ A project's look comes from the library (`docs/look-studio.md` §4): palettes, font pairings, site layouts and looks as small checked JSON files in `library/<kind>s/<id>.json`, compiled into `src/library.generated.ts` by `npm run library`. Each has a state: `testing`, `released` (never changes again; a change is a new id, kept by `library/released.json`) or `withdrawn` (no longer offered, still works where named).
88
+
89
+ | Export | What it does |
90
+ | --- | --- |
91
+ | `LIBRARY`, `LOOKS` | Every packaged item by kind; the released looks with their palette, fonts and shape filled in |
92
+ | `resolveTheme(input, library?)`, `resolveAdminTheme`, `resolveSiteLayout` | The tokens, the admin tokens and the site layout from brand.json's `look`, `palette`, `pairing`, `layout`, `scheme`, `shape`, `colours` and `fonts` |
93
+ | `itemProblems(file)`, `libraryProblems(library)` | One file's shape (unknown fields refused); the library's rules: contrast in light, dark and admin, no near copies (`paletteDistance`, `MIN_PALETTE_DISTANCE`), looks naming released parts |
94
+ | `withProjectItems(items)` | The packaged library plus a project's own items |
95
+
96
+ A project adds its own items in `workbench/looks/*.json`, the same shape with `"since": "project"`. `npx workbench-ui styles` reads them, so brand.json can name them, and `--check` names any that is bad, clashes with a packaged id or doesn't read.
package/dist/cli.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { type Library } from "./library.ts";
2
3
  import { type InstalledStyles } from "./styles.ts";
3
4
  /** The styles of each Workbench tool the project at `dir` has installed, and the workbench-ui version. */
4
5
  export declare function installedStyles(dir: string): Promise<{
@@ -11,6 +12,17 @@ export declare const MARKUP_DIRS: readonly string[];
11
12
  export declare function markupFiles(dir: string): string[];
12
13
  /** Where a project's brand file sits, from its root (workbench-config's BRAND_FILE). */
13
14
  export declare const BRAND_FILE = "brand.json";
15
+ /** Where a project keeps its own look library items (docs/look-studio.md §4), from its root. */
16
+ export declare const PROJECT_LOOKS_DIR = "workbench/looks";
17
+ /**
18
+ * The library a project sees: the package's, plus the project's own items in
19
+ * workbench/looks/*.json (from the look studio, or written by its Claude), and
20
+ * what is wrong with those files. A bad file is left out, never guessed at.
21
+ */
22
+ export declare function projectLibrary(dir: string): {
23
+ library: Library;
24
+ problems: string[];
25
+ };
14
26
  /**
15
27
  * The theme block for the project at `dir`, from its brand.json (Clean, light,
16
28
  * when it has none), and what is wrong with it: a field of the wrong kind, or
package/dist/cli.js CHANGED
@@ -23,7 +23,8 @@ import { createRequire } from "node:module";
23
23
  import { dirname, join, relative, resolve } from "node:path";
24
24
  import { fileURLToPath, pathToFileURL } from "node:url";
25
25
  import { UI_STYLES } from "./ui-styles.js";
26
- import { renderTheme, resolveAdminTheme, resolveTheme, themeInput, themeProblems } from "./theme.js";
26
+ import { libraryProblems, renderTheme, resolveAdminTheme, resolveTheme, themeInput, themeProblems } from "./theme.js";
27
+ import { findItem, itemProblems, LIBRARY, withProjectItems } from "./library.js";
27
28
  import { DEFAULT_THEME_CSS, renderStyles, STYLE_FILES, STYLED_SCOPE, starterProjectCss, unknownMarkupNames, unknownNames } from "./styles.js";
28
29
  const USAGE = "usage: workbench-ui styles [--check] [dir]";
29
30
  const read = (path) => readFileSync(path, "utf8").replace(/\r\n/g, "\n");
@@ -92,6 +93,49 @@ export function markupFiles(dir) {
92
93
  }
93
94
  /** Where a project's brand file sits, from its root (workbench-config's BRAND_FILE). */
94
95
  export const BRAND_FILE = "brand.json";
96
+ /** Where a project keeps its own look library items (docs/look-studio.md §4), from its root. */
97
+ export const PROJECT_LOOKS_DIR = "workbench/looks";
98
+ /**
99
+ * The library a project sees: the package's, plus the project's own items in
100
+ * workbench/looks/*.json (from the look studio, or written by its Claude), and
101
+ * what is wrong with those files. A bad file is left out, never guessed at.
102
+ */
103
+ export function projectLibrary(dir) {
104
+ const at = join(dir, PROJECT_LOOKS_DIR);
105
+ if (!existsSync(at))
106
+ return { library: LIBRARY, problems: [] };
107
+ const items = [];
108
+ const problems = [];
109
+ for (const name of readdirSync(at).filter((n) => n.endsWith(".json")).sort()) {
110
+ const file = `${PROJECT_LOOKS_DIR}/${name}`;
111
+ let raw;
112
+ try {
113
+ raw = JSON.parse(read(join(at, name)));
114
+ }
115
+ catch {
116
+ problems.push(`${file} isn't valid JSON`);
117
+ continue;
118
+ }
119
+ const bad = itemProblems(raw);
120
+ if (bad.length) {
121
+ problems.push(...bad.map((b) => `${file}: ${b}`));
122
+ continue;
123
+ }
124
+ const item = raw;
125
+ if (findItem(LIBRARY, item.kind, item.id))
126
+ problems.push(`${file}: workbench-ui already has a ${item.kind} called ${item.id}: give yours its own id`);
127
+ else if (items.some((i) => i.kind === item.kind && i.id === item.id))
128
+ problems.push(`${file}: two of the project's files make a ${item.kind} called ${item.id}`);
129
+ else
130
+ items.push(item);
131
+ }
132
+ if (!items.length)
133
+ return { library: LIBRARY, problems };
134
+ const library = withProjectItems(items);
135
+ // The package's own items always keep the rules (tested), so anything left is the project's.
136
+ problems.push(...libraryProblems(library).map((p) => `${PROJECT_LOOKS_DIR}: ${p}`));
137
+ return { library, problems };
138
+ }
95
139
  /**
96
140
  * The theme block for the project at `dir`, from its brand.json (Clean, light,
97
141
  * when it has none), and what is wrong with it: a field of the wrong kind, or
@@ -100,7 +144,7 @@ export const BRAND_FILE = "brand.json";
100
144
  export function projectTheme(dir) {
101
145
  const at = join(dir, BRAND_FILE);
102
146
  if (!existsSync(at))
103
- return { css: DEFAULT_THEME_CSS, problems: [] };
147
+ return { css: DEFAULT_THEME_CSS, problems: projectLibrary(dir).problems };
104
148
  let brand;
105
149
  try {
106
150
  brand = JSON.parse(read(at));
@@ -108,11 +152,13 @@ export function projectTheme(dir) {
108
152
  catch {
109
153
  return { css: DEFAULT_THEME_CSS, problems: [`${BRAND_FILE} isn't valid JSON`] };
110
154
  }
111
- const { input, problems } = themeInput(brand);
112
- const site = resolveTheme(input);
113
- const look = `${input.look ?? "clean"}, ${input.scheme ?? "light"}${input.colours?.primary || input.fonts || input.shape ? ", with brand.json's own choices" : ""}`;
155
+ const own = projectLibrary(dir);
156
+ const { input, problems } = themeInput(brand, own.library);
157
+ problems.unshift(...own.problems);
158
+ const site = resolveTheme(input, own.library);
159
+ const look = `${input.look ?? "clean"}, ${input.scheme ?? "light"}${input.colours?.primary || input.fonts || input.shape || input.palette || input.pairing ? ", with brand.json's own choices" : ""}`;
114
160
  problems.push(...themeProblems(site).map((p) => `${BRAND_FILE}: ${p}`));
115
- return { css: renderTheme(site, resolveAdminTheme(input), `${look} (from ${BRAND_FILE})`), problems };
161
+ return { css: renderTheme(site, resolveAdminTheme(input, own.library), `${look} (from ${BRAND_FILE})`), problems };
116
162
  }
117
163
  /** What `styles` writes in `dir`, and what --check would fail on, without touching the disk. */
118
164
  export function planStyles(dir, tools, uiVersion) {
@@ -20,6 +20,10 @@
20
20
  * control itself) gets \`hidden\`, its controls are disabled so they aren't
21
21
  * sent, and its message clears. This updates as the person types.
22
22
  * - Reset clears every message, the summary and the counters.
23
+ * - Every text area on the page grows with what is typed up to its CSS
24
+ * max-height, then scrolls (Robert, 24 November 2026). Browsers with CSS
25
+ * \`field-sizing\` do this themselves; for the rest the script sets the
26
+ * height. \`data-wb-grow="off"\` on a text area keeps it fixed.
23
27
  *
24
28
  * Every element it adds carries a \`wb-form-*\` class (workbench-forms'
25
29
  * FORM_STYLES), the same names renderForm uses.
@@ -20,6 +20,10 @@
20
20
  * control itself) gets \`hidden\`, its controls are disabled so they aren't
21
21
  * sent, and its message clears. This updates as the person types.
22
22
  * - Reset clears every message, the summary and the counters.
23
+ * - Every text area on the page grows with what is typed up to its CSS
24
+ * max-height, then scrolls (Robert, 24 November 2026). Browsers with CSS
25
+ * \`field-sizing\` do this themselves; for the rest the script sets the
26
+ * height. \`data-wb-grow="off"\` on a text area keeps it fixed.
23
27
  *
24
28
  * Every element it adds carries a \`wb-form-*\` class (workbench-forms'
25
29
  * FORM_STYLES), the same names renderForm uses.
@@ -29,6 +33,32 @@
29
33
  * version on the page it does nothing: the endpoint still checks everything.
30
34
  */
31
35
  export const FORM_SCRIPT = `(() => {
36
+ // Text areas grow with what is typed, up to their max-height, and only then scroll. CSS field-sizing does it
37
+ // where the browser has it; elsewhere (Firefox) this sets the height. No animation, and the page never jumps.
38
+ if (typeof window !== "undefined" && typeof document.addEventListener === "function" && !globalThis.__wbGrow && !(globalThis.CSS && CSS.supports && CSS.supports("field-sizing", "content"))) {
39
+ globalThis.__wbGrow = true;
40
+ const grows = (el) => el && el.tagName === "TEXTAREA" && el.getAttribute("data-wb-grow") !== "off";
41
+ const grow = (el) => {
42
+ if (!grows(el) || !el.isConnected || el.offsetParent === null) return;
43
+ const cs = getComputedStyle(el);
44
+ const cap = cs.maxHeight === "none" ? 320 : parseFloat(cs.maxHeight);
45
+ const edges = cs.boxSizing === "border-box" ? parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth) : -(parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom));
46
+ const x = window.scrollX, y = window.scrollY;
47
+ el.style.height = "auto";
48
+ const want = el.scrollHeight + edges;
49
+ el.style.height = Math.min(cap, want) + "px";
50
+ el.style.overflowY = want > cap + 1 ? "auto" : "hidden";
51
+ if (window.scrollY !== y) window.scrollTo(x, y);
52
+ };
53
+ const all = () => { for (const el of document.querySelectorAll("textarea")) grow(el); };
54
+ document.addEventListener("input", (e) => grow(e.target));
55
+ // A value the page writes back (a tidied answer, a reset) fires no input event.
56
+ document.addEventListener("focusout", (e) => grow(e.target));
57
+ document.addEventListener("reset", () => setTimeout(all, 0));
58
+ let frame = 0;
59
+ window.addEventListener("resize", () => { if (!frame) frame = requestAnimationFrame(() => { frame = 0; all(); }); });
60
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", all); else all();
61
+ }
32
62
  const F = globalThis.WorkbenchForms;
33
63
  const configs = {};
34
64
  for (const s of document.querySelectorAll('script[type="application/json"][data-wb-form-config]')) {
package/dist/index.d.ts CHANGED
@@ -4,7 +4,8 @@ export { BASE_CSS, CSS, STYLE, UI_CSS } from "./style.ts";
4
4
  export { UI_STYLES } from "./ui-styles.ts";
5
5
  export { FORM_SCRIPT } from "./form-script.ts";
6
6
  export { DEFAULT_THEME_CSS, renderStyles, STYLE_FILES, STYLED_SCOPE, styleNames, styleProblems, STYLESHEETS, starterProjectCss, unknownMarkupNames, unknownNames, type InstalledStyles, type StyleClass, type StyleState, type StyleVariable, type ToolStyles, } from "./styles.ts";
7
- export { contrast, DEFAULT_LOOK, LOOKS, lookById, lookFor, mix, renderTheme, resolveAdminTheme, resolveTheme, THEME_TOKENS, themeInput, themeProblems, type Look, type LookId, type Palette, type Scheme, type Shape, type Theme, type ThemeInput, type ThemeToken, type TokenName, } from "./theme.ts";
7
+ export { contrast, DEFAULT_LOOK, LOOKS, libraryProblems, lookById, lookFor, lookOf, looksIn, MIN_PALETTE_DISTANCE, mix, paletteDistance, renderTheme, resolveAdminTheme, resolveSiteLayout, resolveTheme, THEME_TOKENS, themeInput, themeProblems, type Look, type LookId, type Palette, type Scheme, type Shape, type Theme, type ThemeInput, type ThemeToken, type TokenName, } from "./theme.ts";
8
+ export { findItem, itemProblems, LIBRARY, LIBRARY_KINDS, libraryOf, SITE_LAYOUT_CHOICES, usable, withProjectItems, type FontFallback, type ItemStatus, type LayoutItem, type Library, type LibraryItem, type LibraryKind, type LookItem, type PairingFont, type PairingItem, type PaletteItem, type SiteLayoutChoice, } from "./library.ts";
8
9
  /** Plain text made safe to put in HTML, in text or in a quoted attribute. */
9
10
  export declare const escape: (value: string) => string;
10
11
  /** The outcome colours: a pill's class and, prefixed with o-, a table row's left edge. */
@@ -106,7 +107,7 @@ export type ConfirmPartOptions = Omit<ConfirmOptions, "prefix" | "askClass">;
106
107
  * with no script. Every text option is plain text; `extra` is HTML.
107
108
  */
108
109
  export declare function confirm(opts: ConfirmPartOptions): string;
109
- /** A one-line control. `a` holds its attributes (id, name, type, value, required and so on). */
110
+ /** A one-line control. `a` holds its attributes (id, name, type, value, required and so on); its width follows from them (type, maxlength, min and max). */
110
111
  export declare function input(a: Attrs): string;
111
112
  /** A text area holding `text`, which is plain text. */
112
113
  export declare function textarea(a: Attrs, text?: string): string;
package/dist/index.js CHANGED
@@ -9,7 +9,8 @@ export { BASE_CSS, CSS, STYLE, UI_CSS } from "./style.js";
9
9
  export { UI_STYLES } from "./ui-styles.js";
10
10
  export { FORM_SCRIPT } from "./form-script.js";
11
11
  export { DEFAULT_THEME_CSS, renderStyles, STYLE_FILES, STYLED_SCOPE, styleNames, styleProblems, STYLESHEETS, starterProjectCss, unknownMarkupNames, unknownNames, } from "./styles.js";
12
- export { contrast, DEFAULT_LOOK, LOOKS, lookById, lookFor, mix, renderTheme, resolveAdminTheme, resolveTheme, THEME_TOKENS, themeInput, themeProblems, } from "./theme.js";
12
+ export { contrast, DEFAULT_LOOK, LOOKS, libraryProblems, lookById, lookFor, lookOf, looksIn, MIN_PALETTE_DISTANCE, mix, paletteDistance, renderTheme, resolveAdminTheme, resolveSiteLayout, resolveTheme, THEME_TOKENS, themeInput, themeProblems, } from "./theme.js";
13
+ export { findItem, itemProblems, LIBRARY, LIBRARY_KINDS, libraryOf, SITE_LAYOUT_CHOICES, usable, withProjectItems, } from "./library.js";
13
14
  /** Plain text made safe to put in HTML, in text or in a quoted attribute. */
14
15
  export const escape = (value) => value.replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);
15
16
  /** A coloured outcome pill. `text` is plain text. */
@@ -127,9 +128,52 @@ export function actions(inner) {
127
128
  export function confirm(opts) {
128
129
  return renderConfirm({ ...opts, prefix: "wb-ui", askClass: "wb-ui-button" });
129
130
  }
130
- /** A one-line control. `a` holds its attributes (id, name, type, value, required and so on). */
131
+ /** The widths a one-line control can take, in characters of its own font (UI_STYLES' `wb-ui-size-<n>`), each capped at the width of what holds it. */
132
+ const SIZE_STEPS = Object.freeze([5, 6, 8, 10, 12, 14, 16, 20, 24, 30, 40]);
133
+ /**
134
+ * About how many characters a control's answer takes, from its attributes
135
+ * (Robert, 24 November 2026): a number up to 9999 needs about five, a phone
136
+ * number sixteen, text with maxlength 4 four. Undefined leaves the control at
137
+ * the usual width.
138
+ */
139
+ function controlChars(a) {
140
+ const type = String(a.type ?? "text").toLowerCase();
141
+ const num = (k) => (a[k] === undefined || a[k] === null || a[k] === "" || Number.isNaN(Number(a[k])) ? undefined : Number(a[k]));
142
+ const max = num("maxlength");
143
+ switch (type) {
144
+ case "number": {
145
+ const hi = num("max");
146
+ if (hi === undefined)
147
+ return undefined;
148
+ const lo = num("min") ?? 0;
149
+ const step = String(a.step ?? "");
150
+ const places = step.includes(".") ? step.split(".")[1].length : 0;
151
+ // Digits, a minus sign, the decimals and the browser's up and down arrows.
152
+ return Math.max(String(Math.floor(Math.abs(hi))).length, String(Math.floor(Math.abs(lo))).length) + (lo < 0 ? 1 : 0) + (places ? places + 1 : 0) + 3;
153
+ }
154
+ case "tel":
155
+ return 15;
156
+ case "date":
157
+ return 13;
158
+ case "time":
159
+ return 9;
160
+ case "month":
161
+ return 14;
162
+ case "email":
163
+ return Math.min(29, max ?? 29);
164
+ case "text":
165
+ case "password":
166
+ case "search":
167
+ return max !== undefined && max <= 40 ? max : undefined;
168
+ default:
169
+ return undefined;
170
+ }
171
+ }
172
+ /** A one-line control. `a` holds its attributes (id, name, type, value, required and so on); its width follows from them (type, maxlength, min and max). */
131
173
  export function input(a) {
132
- return `<input class="wb-ui-input"${attrs(a)}>`;
174
+ const chars = controlChars(a);
175
+ const step = chars === undefined ? undefined : SIZE_STEPS.find((s) => s >= chars + 1);
176
+ return `<input class="wb-ui-input${step ? ` wb-ui-size-${step}` : ""}"${attrs(a)}>`;
133
177
  }
134
178
  /** A text area holding `text`, which is plain text. */
135
179
  export function textarea(a, text = "") {
@@ -0,0 +1,100 @@
1
+ export type Scheme = "light" | "dark";
2
+ /** How round the corners are. */
3
+ export type Shape = "square" | "soft" | "round";
4
+ export type ItemStatus = "testing" | "released" | "withdrawn";
5
+ /** The colours a palette sets for one scheme. */
6
+ export interface Palette {
7
+ background: string;
8
+ text: string;
9
+ muted: string;
10
+ accent: string;
11
+ danger: string;
12
+ success: string;
13
+ warning: string;
14
+ }
15
+ interface ItemBase {
16
+ id: string;
17
+ title: string;
18
+ status: ItemStatus;
19
+ /** Who or what made it, and when. */
20
+ source: string;
21
+ /** The workbench-ui version it arrived in, or "project" for a project's own file. */
22
+ since: string;
23
+ }
24
+ export interface PaletteItem extends ItemBase {
25
+ kind: "palette";
26
+ /** A colour group, such as "green", for finding near neighbours. */
27
+ group: string;
28
+ /** One line an owner reads. */
29
+ about: string;
30
+ light: Palette;
31
+ dark: Palette;
32
+ }
33
+ export type FontFallback = "sans" | "serif";
34
+ export interface PairingFont {
35
+ family: string;
36
+ fallback: FontFallback;
37
+ }
38
+ export interface PairingItem extends ItemBase {
39
+ kind: "pairing";
40
+ about: string;
41
+ heading: PairingFont;
42
+ body: PairingFont;
43
+ }
44
+ /** The choices a site layout makes (docs/look-studio.md §6), each list's first is the default. */
45
+ export declare const SITE_LAYOUT_CHOICES: {
46
+ readonly header: readonly ["menu-right", "centred", "menu-centre"];
47
+ readonly footer: readonly ["line", "columns", "centred"];
48
+ readonly width: readonly ["standard", "narrow", "wide"];
49
+ readonly spacing: readonly ["standard", "compact", "airy"];
50
+ readonly hero: readonly ["plain", "over-picture", "beside-picture"];
51
+ };
52
+ export type SiteLayoutChoice = keyof typeof SITE_LAYOUT_CHOICES;
53
+ export interface LayoutItem extends ItemBase {
54
+ kind: "layout";
55
+ /** One line an owner reads: what kind of site it suits. */
56
+ bestFor: string;
57
+ header: (typeof SITE_LAYOUT_CHOICES.header)[number];
58
+ footer: (typeof SITE_LAYOUT_CHOICES.footer)[number];
59
+ width: (typeof SITE_LAYOUT_CHOICES.width)[number];
60
+ spacing: (typeof SITE_LAYOUT_CHOICES.spacing)[number];
61
+ hero: (typeof SITE_LAYOUT_CHOICES.hero)[number];
62
+ }
63
+ export interface LookItem extends ItemBase {
64
+ kind: "look";
65
+ feel: string;
66
+ /** The New project gallery's starter groups this look is suggested for. */
67
+ suggestedFor: string[];
68
+ palette: string;
69
+ pairing: string;
70
+ layout: string;
71
+ shape: Shape;
72
+ }
73
+ export type LibraryItem = PaletteItem | PairingItem | LayoutItem | LookItem;
74
+ export type LibraryKind = LibraryItem["kind"];
75
+ export declare const LIBRARY_KINDS: readonly LibraryKind[];
76
+ /** A library: every item by kind. */
77
+ export interface Library {
78
+ palettes: readonly PaletteItem[];
79
+ pairings: readonly PairingItem[];
80
+ layouts: readonly LayoutItem[];
81
+ looks: readonly LookItem[];
82
+ }
83
+ /** Sorts items into a library, by kind then in the order given. */
84
+ export declare function libraryOf(items: readonly LibraryItem[]): Library;
85
+ /** The library that ships in this version of workbench-ui. */
86
+ export declare const LIBRARY: Library;
87
+ /** The package's library with a project's own items added after it. */
88
+ export declare function withProjectItems(items: readonly LibraryItem[], base?: Library): Library;
89
+ export declare function findItem<K extends LibraryKind>(lib: Library, kind: K, id: string): Extract<LibraryItem, {
90
+ kind: K;
91
+ }> | undefined;
92
+ /** Items a project or the New project form may choose: not withdrawn. Released ones first. */
93
+ export declare function usable<T extends LibraryItem>(items: readonly T[]): T[];
94
+ /**
95
+ * What is wrong with one library file's contents, in plain words (empty when
96
+ * it is a good item). Checks shape only; whether its colours read and whether
97
+ * it names real parts are `libraryProblems`'.
98
+ */
99
+ export declare function itemProblems(raw: unknown): string[];
100
+ export {};