klods-js 1.6.0 → 1.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/dist/index.cjs CHANGED
@@ -32,35 +32,46 @@ __export(index_exports, {
32
32
  cardFooter: () => cardFooter,
33
33
  cardTitle: () => cardTitle,
34
34
  center: () => center,
35
+ checkbox: () => checkbox,
35
36
  classNames: () => classNames,
36
37
  cluster: () => cluster,
37
38
  codeBlock: () => codeBlock,
38
39
  content: () => content,
39
40
  el: () => el,
41
+ field: () => field,
40
42
  fill: () => fill,
41
43
  footer: () => footer,
44
+ form: () => form,
42
45
  grid: () => grid,
43
46
  header: () => header,
44
47
  inlineCode: () => inlineCode,
48
+ input: () => input,
45
49
  lead: () => lead,
46
50
  mergeClasses: () => mergeClasses,
47
51
  muted: () => muted,
48
52
  nav: () => nav,
49
53
  navLink: () => navLink,
50
54
  navList: () => navList,
55
+ option: () => option,
51
56
  page: () => page,
52
57
  prose: () => prose,
53
58
  push: () => push,
59
+ radio: () => radio,
60
+ radioGroup: () => radioGroup,
54
61
  raw: () => raw,
55
62
  row: () => row,
56
63
  section: () => section,
64
+ select: () => select,
57
65
  sidebar: () => sidebar,
58
66
  spread: () => spread,
59
67
  stack: () => stack,
68
+ switchInput: () => switchInput,
60
69
  table: () => table,
61
70
  tbody: () => tbody,
62
71
  td: () => td,
63
72
  text: () => text,
73
+ textCenter: () => textCenter,
74
+ textarea: () => textarea,
64
75
  th: () => th,
65
76
  thead: () => thead,
66
77
  toc: () => toc,
@@ -99,11 +110,11 @@ function escapeHtml(str) {
99
110
  function escapeAttr(str) {
100
111
  return str.replace(/&/g, "&").replace(/"/g, """);
101
112
  }
102
- function classNames(input) {
103
- if (!input) return "";
104
- if (typeof input === "string") return input.trim();
105
- if (Array.isArray(input)) return input.filter(Boolean).join(" ").trim();
106
- return Object.entries(input).filter(([, v]) => Boolean(v)).map(([k]) => k).join(" ").trim();
113
+ function classNames(input2) {
114
+ if (!input2) return "";
115
+ if (typeof input2 === "string") return input2.trim();
116
+ if (Array.isArray(input2)) return input2.filter(Boolean).join(" ").trim();
117
+ return Object.entries(input2).filter(([, v]) => Boolean(v)).map(([k]) => k).join(" ").trim();
107
118
  }
108
119
  function mergeClasses(...inputs) {
109
120
  return inputs.map((c) => classNames(c)).filter(Boolean).join(" ");
@@ -296,6 +307,7 @@ function alert(props, children) {
296
307
  var prose = builder({ tag: "div", base: "klods-prose" });
297
308
  var muted = builder({ tag: "span", base: "klods-muted" });
298
309
  var lead = builder({ tag: "p", base: "klods-lead" });
310
+ var textCenter = builder({ tag: "div", base: "klods-text-center" });
299
311
  var table = builder({
300
312
  tag: "table",
301
313
  base: "klods-table",
@@ -309,6 +321,193 @@ var tbody = (attrs, children) => el("tbody", attrs ?? {}, children);
309
321
  var tr = (attrs, children) => el("tr", attrs ?? {}, children);
310
322
  var th = (attrs, children) => el("th", attrs ?? {}, children);
311
323
  var td = (attrs, children) => el("td", attrs ?? {}, children);
324
+ function slugId(prefix, text2) {
325
+ const safe = text2 ?? "";
326
+ const slug = safe.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
327
+ if (slug) return `${prefix}-${slug}`;
328
+ let h = 5381;
329
+ for (let i = 0; i < safe.length; i++) h = (h << 5) + h + safe.charCodeAt(i) | 0;
330
+ return `${prefix}-${(h >>> 0).toString(36)}`;
331
+ }
332
+ var form = builder({ tag: "form", base: "klods-form" });
333
+ var FORM_CONTROLS = /* @__PURE__ */ new Set(["input", "select", "textarea"]);
334
+ function patchAriaAttrs(node, attrs) {
335
+ if (FORM_CONTROLS.has(node.tag)) {
336
+ return new KlodsNode(node.tag, { ...node.attrs, ...attrs }, node.children);
337
+ }
338
+ const patchedChildren = node.children.map(
339
+ (child) => child instanceof KlodsNode && FORM_CONTROLS.has(child.tag) ? new KlodsNode(child.tag, { ...child.attrs, ...attrs }, child.children) : child
340
+ );
341
+ return new KlodsNode(node.tag, node.attrs, patchedChildren);
342
+ }
343
+ function field(props, renderInput) {
344
+ const { label: labelText, id: explicitId, help, error, required, invalid, class: extraClass, ...rest } = props;
345
+ const id = explicitId ?? slugId("klods-field", labelText);
346
+ const helpId = help ? `${id}-help` : void 0;
347
+ const errorId = error ? `${id}-error` : void 0;
348
+ const isInvalid = invalid ?? !!error;
349
+ const describedBy = isInvalid ? errorId : helpId;
350
+ const inputNode = renderInput(id);
351
+ const patchedInput = patchAriaAttrs(inputNode, {
352
+ ...describedBy ? { "aria-describedby": describedBy } : {},
353
+ ...isInvalid ? { "aria-invalid": "true" } : {}
354
+ });
355
+ const fieldClass = classNames([
356
+ "klods-field",
357
+ isInvalid ? "klods-field--invalid" : "",
358
+ classNames(extraClass)
359
+ ]);
360
+ const children = [
361
+ el("label", { for: id, class: `klods-label${required ? " klods-label--required" : ""}` }, labelText),
362
+ patchedInput
363
+ ];
364
+ if (help) children.push(el("p", { id: helpId, class: "klods-help" }, help));
365
+ if (error) children.push(el("p", { id: errorId, class: "klods-error", role: "alert" }, error));
366
+ return el("div", { ...rest, class: fieldClass || void 0 }, children);
367
+ }
368
+ function input(props) {
369
+ const { type, class: extraClass, oninput: userOninput, ...rest } = props;
370
+ const cls = (extra) => classNames(["klods-input", extra, classNames(extraClass)]) || void 0;
371
+ const id = rest.id ?? slugId(
372
+ "klods-input",
373
+ rest["aria-label"] ?? rest.placeholder ?? type ?? "field"
374
+ );
375
+ if (type === "range") {
376
+ const initial = rest.value ?? "50";
377
+ return el("span", { class: cls("klods-input--range") }, [
378
+ el("input", {
379
+ type: "range",
380
+ ...rest,
381
+ id,
382
+ oninput: (e) => {
383
+ const inp = e.target;
384
+ inp.closest(".klods-input--range")?.querySelector("output")?.textContent !== void 0 && (inp.closest(".klods-input--range").querySelector("output").textContent = inp.value);
385
+ userOninput?.(e);
386
+ }
387
+ }),
388
+ el("output", { for: id }, initial)
389
+ ]);
390
+ }
391
+ if (type === "color") {
392
+ const initial = rest.value ?? "#000000";
393
+ return el("span", { class: cls("klods-input--color") }, [
394
+ el("input", {
395
+ type: "color",
396
+ ...rest,
397
+ id,
398
+ oninput: (e) => {
399
+ const inp = e.target;
400
+ inp.closest(".klods-input--color")?.querySelector("output")?.textContent !== void 0 && (inp.closest(".klods-input--color").querySelector("output").textContent = inp.value);
401
+ userOninput?.(e);
402
+ }
403
+ }),
404
+ el("output", { for: id }, initial)
405
+ ]);
406
+ }
407
+ return new KlodsNode("input", {
408
+ type,
409
+ ...rest,
410
+ id,
411
+ class: cls("")
412
+ });
413
+ }
414
+ var selectEl = builder({ tag: "select", base: "klods-select" });
415
+ function select(attrs, children) {
416
+ return el("div", { class: "klods-select-wrapper" }, selectEl(attrs, children));
417
+ }
418
+ var option = (attrs, children) => el("option", attrs ?? {}, children);
419
+ var textarea = builder({ tag: "textarea", base: "klods-textarea" });
420
+ function checkbox(props) {
421
+ const {
422
+ label: labelText,
423
+ name,
424
+ value,
425
+ checked,
426
+ disabled,
427
+ required,
428
+ form: form2,
429
+ autofocus,
430
+ class: extraClass,
431
+ ...rest
432
+ } = props;
433
+ const inputAttrs = { type: "checkbox" };
434
+ if (name !== void 0) inputAttrs.name = name;
435
+ if (value !== void 0) inputAttrs.value = value;
436
+ if (checked) inputAttrs.checked = true;
437
+ if (disabled) inputAttrs.disabled = true;
438
+ if (required) inputAttrs.required = true;
439
+ if (form2 !== void 0) inputAttrs.form = form2;
440
+ if (autofocus) inputAttrs.autofocus = true;
441
+ return el(
442
+ "label",
443
+ { ...rest, class: classNames(["klods-checkbox", classNames(extraClass)]) || void 0 },
444
+ [el("input", inputAttrs), el("span", {}, labelText)]
445
+ );
446
+ }
447
+ function radio(props) {
448
+ const {
449
+ label: labelText,
450
+ name,
451
+ value,
452
+ checked,
453
+ disabled,
454
+ required,
455
+ form: form2,
456
+ autofocus,
457
+ class: extraClass,
458
+ ...rest
459
+ } = props;
460
+ const inputAttrs = { type: "radio" };
461
+ if (name !== void 0) inputAttrs.name = name;
462
+ if (value !== void 0) inputAttrs.value = value;
463
+ if (checked) inputAttrs.checked = true;
464
+ if (disabled) inputAttrs.disabled = true;
465
+ if (required) inputAttrs.required = true;
466
+ if (form2 !== void 0) inputAttrs.form = form2;
467
+ if (autofocus) inputAttrs.autofocus = true;
468
+ return el(
469
+ "label",
470
+ { ...rest, class: classNames(["klods-radio", classNames(extraClass)]) || void 0 },
471
+ [el("input", inputAttrs), el("span", {}, labelText)]
472
+ );
473
+ }
474
+ function radioGroup(props, children) {
475
+ const { legend: legendText, class: extraClass, ...rest } = props;
476
+ const legendId = legendText ? slugId("klods-rg", legendText) : void 0;
477
+ const cls = classNames(["klods-field", classNames(extraClass)]) || void 0;
478
+ return el("div", { ...rest, class: cls, role: "group", ...legendId ? { "aria-labelledby": legendId } : {} }, [
479
+ legendText ? el("p", { id: legendId, class: "klods-label" }, legendText) : null,
480
+ ...children
481
+ ]);
482
+ }
483
+ function switchInput(props) {
484
+ const { label: labelText, name, value, checked, disabled, reverse, class: extraClass, ...rest } = props;
485
+ const inputAttrs = {
486
+ type: "checkbox",
487
+ class: "klods-switch__input",
488
+ role: "switch"
489
+ };
490
+ if (name !== void 0) inputAttrs.name = name;
491
+ if (value !== void 0) inputAttrs.value = value;
492
+ if (checked) inputAttrs.checked = true;
493
+ if (disabled) inputAttrs.disabled = true;
494
+ return el(
495
+ "label",
496
+ {
497
+ ...rest,
498
+ class: classNames([
499
+ "klods-switch",
500
+ reverse ? "klods-switch--reverse" : "",
501
+ classNames(extraClass)
502
+ ]) || void 0
503
+ },
504
+ [
505
+ el("input", inputAttrs),
506
+ el("span", { class: "klods-switch__track" }),
507
+ el("span", { class: "klods-switch__label" }, labelText)
508
+ ]
509
+ );
510
+ }
312
511
  function codeBlock(attrs, content2) {
313
512
  return el("pre", attrs ?? {}, el("code", {}, content2));
314
513
  }
@@ -384,35 +583,46 @@ var fill = builder({ tag: "div", base: "klods-fill" });
384
583
  cardFooter,
385
584
  cardTitle,
386
585
  center,
586
+ checkbox,
387
587
  classNames,
388
588
  cluster,
389
589
  codeBlock,
390
590
  content,
391
591
  el,
592
+ field,
392
593
  fill,
393
594
  footer,
595
+ form,
394
596
  grid,
395
597
  header,
396
598
  inlineCode,
599
+ input,
397
600
  lead,
398
601
  mergeClasses,
399
602
  muted,
400
603
  nav,
401
604
  navLink,
402
605
  navList,
606
+ option,
403
607
  page,
404
608
  prose,
405
609
  push,
610
+ radio,
611
+ radioGroup,
406
612
  raw,
407
613
  row,
408
614
  section,
615
+ select,
409
616
  sidebar,
410
617
  spread,
411
618
  stack,
619
+ switchInput,
412
620
  table,
413
621
  tbody,
414
622
  td,
415
623
  text,
624
+ textCenter,
625
+ textarea,
416
626
  th,
417
627
  thead,
418
628
  toc,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/core.ts","../src/components.ts","../src/layout.ts","../src/utilities.ts"],"sourcesContent":["// Public API surface for the `klods` package.\n\nexport * from \"./components.js\";\nexport * from \"./core.js\";\nexport * from \"./layout.js\";\nexport * from \"./utilities.js\";\n","// Core — a tiny VDOM-ish node with two faces:\n// - .render(target?) → HTMLElement (uses real DOM)\n// - .toString() → HTML string (works in Node / Rails / SSR)\n//\n// Both are produced from the same KlodsNode tree, so the docs site can show the\n// TS source, the rendered HTML and the live preview from one source of truth.\n\nexport type KlodsChild = string | number | bigint | boolean | null | undefined | KlodsNode | Node | KlodsChild[];\n\nexport type KlodsAttrs = {\n class?: string | string[] | Record<string, boolean | undefined> | undefined;\n id?: string | undefined;\n style?: string | Partial<CSSStyleDeclaration> | undefined;\n [key: `data-${string}`]: string | number | boolean | undefined;\n [key: `aria-${string}`]: string | number | boolean | undefined;\n // Allow any other HTML attribute or DOM event handler (onClick, onInput, …).\n [key: string]: unknown;\n};\n\nconst VOID_TAGS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\nconst RAW = Symbol(\"klods.raw\");\n\ntype RawHtml = { [RAW]: true; html: string };\n\n/** Mark a string as already-escaped HTML; pass it as a child to inject as-is. */\nexport function raw(html: string): RawHtml {\n return { [RAW]: true, html };\n}\n\nfunction isRaw(value: unknown): value is RawHtml {\n return typeof value === \"object\" && value !== null && (value as { [RAW]?: unknown })[RAW] === true;\n}\n\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&#39;\");\n}\n\nfunction escapeAttr(str: string): string {\n return str.replace(/&/g, \"&amp;\").replace(/\"/g, \"&quot;\");\n}\n\n/** Normalise a `class` value (string | array | record) into a clean string. */\nexport function classNames(input: KlodsAttrs[\"class\"]): string {\n if (!input) return \"\";\n if (typeof input === \"string\") return input.trim();\n if (Array.isArray(input)) return input.filter(Boolean).join(\" \").trim();\n return Object.entries(input)\n .filter(([, v]) => Boolean(v))\n .map(([k]) => k)\n .join(\" \")\n .trim();\n}\n\n/** Merge two class values (used internally to combine builder defaults + user-supplied). */\nexport function mergeClasses(...inputs: Array<KlodsAttrs[\"class\"]>): string {\n return inputs\n .map((c) => classNames(c))\n .filter(Boolean)\n .join(\" \");\n}\n\nfunction styleToString(style: string | Partial<CSSStyleDeclaration>): string {\n if (typeof style === \"string\") return style;\n return Object.entries(style)\n .filter(([, v]) => v !== undefined && v !== null && v !== \"\")\n .map(([k, v]) => `${k.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}:${String(v)}`)\n .join(\";\");\n}\n\nfunction flattenChildren(children: KlodsChild | KlodsChild[]): Array<Exclude<KlodsChild, KlodsChild[]>> {\n const out: Array<Exclude<KlodsChild, KlodsChild[]>> = [];\n const stack: KlodsChild[] = Array.isArray(children) ? [...children] : [children];\n while (stack.length) {\n const next = stack.shift();\n if (Array.isArray(next)) stack.unshift(...next);\n else if (next !== null && next !== undefined && next !== false && next !== true) out.push(next);\n }\n return out;\n}\n\nexport class KlodsNode {\n readonly tag: string;\n readonly attrs: KlodsAttrs;\n readonly children: KlodsChild[];\n\n constructor(tag: string, attrs: KlodsAttrs = {}, children: KlodsChild | KlodsChild[] = []) {\n this.tag = tag;\n this.attrs = attrs;\n this.children = Array.isArray(children) ? children : [children];\n }\n\n /** Render to a real DOM element. If `target` is given, append to it. */\n render(target?: Element | null): HTMLElement {\n const el = document.createElement(this.tag);\n for (const [name, value] of Object.entries(this.attrs)) {\n if (value === undefined || value === null || value === false) continue;\n if (name === \"children\") continue;\n if (name === \"class\") {\n const cls = classNames(value as KlodsAttrs[\"class\"]);\n if (cls) el.setAttribute(\"class\", cls);\n continue;\n }\n if (name === \"style\") {\n el.setAttribute(\"style\", styleToString(value as string | Partial<CSSStyleDeclaration>));\n continue;\n }\n if (name.startsWith(\"on\") && typeof value === \"function\") {\n el.addEventListener(name.slice(2).toLowerCase(), value as EventListener);\n continue;\n }\n if (value === true) {\n el.setAttribute(name, \"\");\n continue;\n }\n el.setAttribute(name, String(value));\n }\n for (const child of flattenChildren(this.children)) {\n if (child instanceof KlodsNode) el.appendChild(child.render());\n else if (typeof child === \"object\" && child !== null && \"nodeType\" in child) {\n el.appendChild(child as Node);\n } else if (isRaw(child)) {\n const tpl = document.createElement(\"template\");\n tpl.innerHTML = child.html;\n el.appendChild(tpl.content);\n } else {\n el.appendChild(document.createTextNode(String(child)));\n }\n }\n if (target) target.appendChild(el);\n return el;\n }\n\n /** Render to a string of HTML. */\n toString(): string {\n const parts: string[] = [`<${this.tag}`];\n for (const [name, value] of Object.entries(this.attrs)) {\n if (value === undefined || value === null || value === false) continue;\n if (name === \"children\") continue;\n if (name.startsWith(\"on\") && typeof value === \"function\") continue;\n if (name === \"class\") {\n const cls = classNames(value as KlodsAttrs[\"class\"]);\n if (cls) parts.push(` class=\"${escapeAttr(cls)}\"`);\n continue;\n }\n if (name === \"style\") {\n parts.push(` style=\"${escapeAttr(styleToString(value as string | Partial<CSSStyleDeclaration>))}\"`);\n continue;\n }\n if (value === true) {\n parts.push(` ${name}`);\n continue;\n }\n parts.push(` ${name}=\"${escapeAttr(String(value))}\"`);\n }\n if (VOID_TAGS.has(this.tag)) {\n parts.push(\" />\");\n return parts.join(\"\");\n }\n parts.push(\">\");\n for (const child of flattenChildren(this.children)) {\n if (child instanceof KlodsNode) parts.push(child.toString());\n else if (isRaw(child)) parts.push(child.html);\n else if (typeof child === \"object\" && child !== null && \"outerHTML\" in child) {\n parts.push((child as Element).outerHTML);\n } else {\n parts.push(escapeHtml(String(child)));\n }\n }\n parts.push(`</${this.tag}>`);\n return parts.join(\"\");\n }\n}\n\n/**\n * Generic element builder. Most consumers use the named builders (page, header, …)\n * rather than calling `el` directly, but it's exported as an escape hatch.\n */\nexport function el(tag: string, attrs: KlodsAttrs = {}, children: KlodsChild | KlodsChild[] = []): KlodsNode {\n return new KlodsNode(tag, attrs, children);\n}\n\n/**\n * Factory that produces a typed builder for a tag with a base class. Modifier\n * props are converted into `--modifier` BEM classes and stripped from the output\n * attributes; everything else passes through untouched, so consumers can attach\n * arbitrary `id`, `data-*`, `aria-*`, event handlers, `style`, etc.\n */\nexport function builder<P extends Record<string, unknown> = Record<never, never>>(options: {\n tag: string;\n base: string;\n /** Map of prop name → class (or function returning a class) when the prop is truthy. */\n modifiers?: { [K in keyof P]?: string | ((value: P[K]) => string | undefined) };\n}): (props?: (P & KlodsAttrs) | null, children?: KlodsChild | KlodsChild[]) => KlodsNode {\n const { tag, base, modifiers = {} } = options;\n const modifierMap = modifiers as Record<string, string | ((value: unknown) => string | undefined) | undefined>;\n return (props, children) => {\n const userProps = (props ?? {}) as P & KlodsAttrs;\n const modClasses: string[] = [];\n const passthrough: KlodsAttrs = {};\n for (const [key, value] of Object.entries(userProps)) {\n const m = modifierMap[key];\n if (m !== undefined) {\n if (typeof m === \"function\") {\n const c = m(value);\n if (c) modClasses.push(c);\n } else if (value) {\n modClasses.push(m);\n }\n } else {\n passthrough[key] = value;\n }\n }\n const finalClass = mergeClasses(base, ...modClasses, userProps.class);\n const resolvedChildren =\n children !== undefined ? children : ((userProps.children as KlodsChild | KlodsChild[] | undefined) ?? []);\n delete passthrough.children;\n return new KlodsNode(tag, { ...passthrough, class: finalClass || undefined }, resolvedChildren);\n };\n}\n","// First wave of components: nav, card, button, badge, alert, prose helpers.\n// All match the BEM classes shipped by klods-css.\n\nimport type { KlodsAttrs, KlodsChild } from \"./core.js\";\nimport { builder, el, KlodsNode } from \"./core.js\";\n\n// ── Nav ──────────────────────────────────────────────────────────────────\nexport const nav = builder({ tag: \"nav\", base: \"klods-nav\" });\nexport const navList = builder({ tag: \"ul\", base: \"klods-nav__list\" });\nexport const buttonGroup = builder({ tag: \"div\", base: \"klods-button-group\" });\nexport type TocProps = { sub?: boolean };\nexport const toc = builder<TocProps>({ tag: \"ul\", base: \"klods-toc\", modifiers: { sub: \"klods-toc--sub\" } });\nexport const tocItem = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"li\", attrs ?? {}, children);\nexport const tocLink = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"a\", attrs ?? {}, children);\n\nexport type NavLinkProps = {\n href?: string;\n active?: boolean;\n};\nconst navLinkBuilder = builder<NavLinkProps>({\n tag: \"a\",\n base: \"klods-nav__link\",\n modifiers: { active: \"klods-nav__link--active\" },\n});\nexport function navLink(props?: (NavLinkProps & KlodsAttrs) | null, children?: KlodsChild | KlodsChild[]): KlodsNode {\n // Wrap each link in <li> so it's idiomatic inside <ul class=\"klods-nav__list\">.\n return el(\"li\", {}, [navLinkBuilder(props ?? null, children)]);\n}\n\n// ── Card ─────────────────────────────────────────────────────────────────\nexport type CardProps = {\n elevated?: boolean;\n};\nexport const card = builder<CardProps>({\n tag: \"div\",\n base: \"klods-card\",\n modifiers: { elevated: \"klods-card--elevated\" },\n});\nexport const cardTitle = builder({ tag: \"h3\", base: \"klods-card__title\" });\nexport const cardBody = builder({ tag: \"div\", base: \"klods-card__body\" });\nexport const cardFooter = builder({ tag: \"div\", base: \"klods-card__footer\" });\n\n// ── Button ───────────────────────────────────────────────────────────────\nexport type ButtonProps = {\n variant?: \"default\" | \"primary\" | \"danger\" | \"ghost\";\n type?: \"button\" | \"submit\" | \"reset\";\n};\nconst buttonBase = builder<ButtonProps>({\n tag: \"button\",\n base: \"klods-button\",\n modifiers: {\n variant: (v) => (v && v !== \"default\" ? `klods-button--${v}` : undefined),\n },\n});\nexport function button(props?: (ButtonProps & KlodsAttrs) | null, children?: KlodsChild | KlodsChild[]): KlodsNode {\n // Default `type=\"button\"` so it never accidentally submits a form.\n const merged = { type: \"button\", ...(props ?? {}) } as ButtonProps & KlodsAttrs;\n return buttonBase(merged, children);\n}\n\n// ── Badge ────────────────────────────────────────────────────────────────\nexport type BadgeProps = {\n variant?: \"default\" | \"accent\" | \"success\" | \"danger\";\n};\nexport const badge = builder<BadgeProps>({\n tag: \"span\",\n base: \"klods-badge\",\n modifiers: {\n variant: (v) => (v && v !== \"default\" ? `klods-badge--${v}` : undefined),\n },\n});\n\n// ── Alert ────────────────────────────────────────────────────────────────\nexport type AlertProps = {\n variant?: \"default\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n};\nconst alertBase = builder<AlertProps>({\n tag: \"div\",\n base: \"klods-alert\",\n modifiers: {\n variant: (v) => (v && v !== \"default\" ? `klods-alert--${v}` : undefined),\n },\n});\nexport function alert(props?: (AlertProps & KlodsAttrs) | null, children?: KlodsChild | KlodsChild[]): KlodsNode {\n // role=alert by default for assistive tech, overridable.\n const merged = { role: \"alert\", ...(props ?? {}) } as AlertProps & KlodsAttrs;\n return alertBase(merged, children);\n}\n\n// ── Prose helpers ────────────────────────────────────────────────────────\nexport const prose = builder({ tag: \"div\", base: \"klods-prose\" });\nexport const muted = builder({ tag: \"span\", base: \"klods-muted\" });\nexport const lead = builder({ tag: \"p\", base: \"klods-lead\" });\n\n// ── Table ────────────────────────────────────────────────────────────────\nexport type TableProps = {\n striped?: boolean;\n dense?: boolean;\n};\nexport const table = builder<TableProps>({\n tag: \"table\",\n base: \"klods-table\",\n modifiers: {\n striped: \"klods-table--striped\",\n dense: \"klods-table--dense\",\n },\n});\nexport const thead = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"thead\", attrs ?? {}, children);\nexport const tbody = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"tbody\", attrs ?? {}, children);\nexport const tr = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"tr\", attrs ?? {}, children);\nexport const th = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"th\", attrs ?? {}, children);\nexport const td = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"td\", attrs ?? {}, children);\n\n// ── Code ─────────────────────────────────────────────────────────────────\nexport function codeBlock(attrs?: KlodsAttrs | null, content?: KlodsChild | KlodsChild[]): KlodsNode {\n return el(\"pre\", attrs ?? {}, el(\"code\", {}, content));\n}\nexport function inlineCode(attrs?: KlodsAttrs | null, content?: KlodsChild | KlodsChild[]): KlodsNode {\n return el(\"code\", attrs ?? {}, content);\n}\n\n// ── Box ──────────────────────────────────────────────────────────────────\nexport const box = builder({ tag: \"div\", base: \"klods-box\" });\n","// Layout builders — the four corners and the \"I-always-forget\" utilities.\n// Each builder is a thin wrapper around `builder()` from core.ts.\n\nimport type { KlodsAttrs, KlodsChild } from \"./core.js\";\nimport { builder, KlodsNode } from \"./core.js\";\n\n// ── Page ─────────────────────────────────────────────────────────────────\nexport type PageProps = {\n /** Render with a sidebar column. */\n sidebar?: boolean;\n /** Which side the sidebar appears on. Defaults to `\"leading\"` (inline-start). */\n sidebarPosition?: \"leading\" | \"trailing\";\n /** Keep the header pinned to the top of the viewport while the page scrolls. */\n stickyHeader?: boolean;\n};\n\nexport const page = builder<PageProps>({\n tag: \"div\",\n base: \"klods-page\",\n modifiers: {\n sidebar: \"klods-page--with-sidebar\",\n sidebarPosition: (v) => (v === \"trailing\" ? \"klods-page--sidebar-trailing\" : undefined),\n stickyHeader: \"klods-page--sticky-header\",\n },\n});\n\n// ── Page slots ───────────────────────────────────────────────────────────\nexport const header = builder({ tag: \"header\", base: \"klods-header\" });\nexport const sidebar = builder({ tag: \"aside\", base: \"klods-sidebar\" });\n\nexport type ContentProps = {\n /** Cap content width to --klods-content-max and centre it. */\n narrow?: boolean;\n};\nexport const content = builder<ContentProps>({\n tag: \"main\",\n base: \"klods-content\",\n modifiers: { narrow: \"klods-content--narrow\" },\n});\n\nexport const footer = builder({ tag: \"footer\", base: \"klods-footer\" });\nexport const section = builder({ tag: \"section\", base: \"klods-section\" });\n\n// ── Layout utilities ─────────────────────────────────────────────────────\ntype GapProp = { gap?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 };\n\nconst gapModifier = (prefix: string) => (v: number | undefined) =>\n v === undefined ? undefined : `${prefix}--gap-${v}`;\n\nexport const stack = builder<GapProp>({\n tag: \"div\",\n base: \"klods-stack\",\n modifiers: { gap: gapModifier(\"klods-stack\") },\n});\n\nexport const cluster = builder<GapProp>({\n tag: \"div\",\n base: \"klods-cluster\",\n modifiers: { gap: gapModifier(\"klods-cluster\") },\n});\n\ntype RowProps = GapProp & { inline?: boolean };\nexport const row = builder<RowProps>({\n tag: \"div\",\n base: \"klods-row\",\n modifiers: { gap: gapModifier(\"klods-row\"), inline: \"klods-row--inline\" },\n});\n\nexport type GridProps = GapProp & {\n cols?: 1 | 2 | 3 | 4 | 5 | 6;\n /** Auto-fit responsive columns; pair with `--klods-grid-min` if you want a custom minimum. */\n fit?: boolean;\n};\nexport const grid = builder<GridProps>({\n tag: \"div\",\n base: \"klods-grid\",\n modifiers: {\n gap: gapModifier(\"klods-grid\"),\n cols: (v) => (v === undefined ? undefined : `klods-grid--cols-${v}`),\n fit: \"klods-grid--fit\",\n },\n});\n\nexport const center = builder({ tag: \"div\", base: \"klods-center\" });\nexport const spread = builder({ tag: \"div\", base: \"klods-spread\" });\n\n// ── Convenience: empty fragment-ish wrapper for quick text + nodes ──────\nexport function text(value: string | number): KlodsNode {\n // Wrap loose text in a span so it composes anywhere a KlodsNode is expected.\n return new KlodsNode(\"span\", {}, [String(value)]);\n}\n\n// Re-export attribute / child types so consumers can extend a builder neatly.\nexport type { KlodsAttrs, KlodsChild };\n","// Utility builders — thin wrappers over the most-reached-for klods-css utility classes.\n\nimport { builder } from \"./core.js\";\n\n// ── Push ─────────────────────────────────────────────────────────────────\n// Renders a <span class=\"klods-push\">.\n// Pushes siblings to the end of a flex/grid row by consuming all remaining\n// inline space (margin-inline-start: auto).\nexport const push = builder({ tag: \"span\", base: \"klods-push\" });\n\n// ── Fill ─────────────────────────────────────────────────────────────────\n// Renders a <div class=\"klods-fill\">.\n// Grows to fill available flex/grid space (flex: 1 1 auto).\n// Useful as a wrapper when you need one slot to absorb leftover room —\n// e.g. equal-width side groups in a header to centre a middle item.\nexport const fill = builder({ tag: \"div\", base: \"klods-fill\" });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBA,IAAM,YAAY,oBAAI,IAAI;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,MAAM,uBAAO,WAAW;AA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,EACN,WAAW,EAAE,KAAK,YAAY,aAAa,EAAE;AAC/C,CAAC;AAEM,IAAM,UAAU,QAAiB;AAAA,EACtC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,WAAW,EAAE,KAAK,YAAY,eAAe,EAAE;AACjD,CAAC;AAGM,IAAM,MAAM,QAAkB;AAAA,EACnC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,WAAW,EAAE,KAAK,YAAY,WAAW,GAAG,QAAQ,oBAAoB;AAC1E,CAAC;AAOM,IAAM,OAAO,QAAmB;AAAA,EACrC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,WAAW;AAAA,IACT,KAAK,YAAY,YAAY;AAAA,IAC7B,MAAM,CAAC,MAAO,MAAM,SAAY,SAAY,oBAAoB,CAAC;AAAA,IACjE,KAAK;AAAA,EACP;AACF,CAAC;AAEM,IAAM,SAAS,QAAQ,EAAE,KAAK,OAAO,MAAM,eAAe,CAAC;AAC3D,IAAM,SAAS,QAAQ,EAAE,KAAK,OAAO,MAAM,eAAe,CAAC;AAG3D,SAAS,KAAK,OAAmC;AAEtD,SAAO,IAAI,UAAU,QAAQ,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC;AAClD;;;AClFO,IAAM,OAAO,QAAQ,EAAE,KAAK,QAAQ,MAAM,aAAa,CAAC;AAOxD,IAAM,OAAO,QAAQ,EAAE,KAAK,OAAO,MAAM,aAAa,CAAC;","names":["stack","el","content"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/core.ts","../src/components.ts","../src/layout.ts","../src/utilities.ts"],"sourcesContent":["// Public API surface for the `klods` package.\n\nexport * from \"./components.js\";\nexport * from \"./core.js\";\nexport * from \"./layout.js\";\nexport * from \"./utilities.js\";\n","// Core — a tiny VDOM-ish node with two faces:\n// - .render(target?) → HTMLElement (uses real DOM)\n// - .toString() → HTML string (works in Node / Rails / SSR)\n//\n// Both are produced from the same KlodsNode tree, so the docs site can show the\n// TS source, the rendered HTML and the live preview from one source of truth.\n\nexport type KlodsChild = string | number | bigint | boolean | null | undefined | KlodsNode | Node | KlodsChild[];\n\nexport type KlodsAttrs = {\n class?: string | string[] | Record<string, boolean | undefined> | undefined;\n id?: string | undefined;\n style?: string | Partial<CSSStyleDeclaration> | undefined;\n [key: `data-${string}`]: string | number | boolean | undefined;\n [key: `aria-${string}`]: string | number | boolean | undefined;\n // Allow any other HTML attribute or DOM event handler (onClick, onInput, …).\n [key: string]: unknown;\n};\n\nconst VOID_TAGS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\nconst RAW = Symbol(\"klods.raw\");\n\ntype RawHtml = { [RAW]: true; html: string };\n\n/** Mark a string as already-escaped HTML; pass it as a child to inject as-is. */\nexport function raw(html: string): RawHtml {\n return { [RAW]: true, html };\n}\n\nfunction isRaw(value: unknown): value is RawHtml {\n return typeof value === \"object\" && value !== null && (value as { [RAW]?: unknown })[RAW] === true;\n}\n\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&#39;\");\n}\n\nfunction escapeAttr(str: string): string {\n return str.replace(/&/g, \"&amp;\").replace(/\"/g, \"&quot;\");\n}\n\n/** Normalise a `class` value (string | array | record) into a clean string. */\nexport function classNames(input: KlodsAttrs[\"class\"]): string {\n if (!input) return \"\";\n if (typeof input === \"string\") return input.trim();\n if (Array.isArray(input)) return input.filter(Boolean).join(\" \").trim();\n return Object.entries(input)\n .filter(([, v]) => Boolean(v))\n .map(([k]) => k)\n .join(\" \")\n .trim();\n}\n\n/** Merge two class values (used internally to combine builder defaults + user-supplied). */\nexport function mergeClasses(...inputs: Array<KlodsAttrs[\"class\"]>): string {\n return inputs\n .map((c) => classNames(c))\n .filter(Boolean)\n .join(\" \");\n}\n\nfunction styleToString(style: string | Partial<CSSStyleDeclaration>): string {\n if (typeof style === \"string\") return style;\n return Object.entries(style)\n .filter(([, v]) => v !== undefined && v !== null && v !== \"\")\n .map(([k, v]) => `${k.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}:${String(v)}`)\n .join(\";\");\n}\n\nfunction flattenChildren(children: KlodsChild | KlodsChild[]): Array<Exclude<KlodsChild, KlodsChild[]>> {\n const out: Array<Exclude<KlodsChild, KlodsChild[]>> = [];\n const stack: KlodsChild[] = Array.isArray(children) ? [...children] : [children];\n while (stack.length) {\n const next = stack.shift();\n if (Array.isArray(next)) stack.unshift(...next);\n else if (next !== null && next !== undefined && next !== false && next !== true) out.push(next);\n }\n return out;\n}\n\nexport class KlodsNode {\n readonly tag: string;\n readonly attrs: KlodsAttrs;\n readonly children: KlodsChild[];\n\n constructor(tag: string, attrs: KlodsAttrs = {}, children: KlodsChild | KlodsChild[] = []) {\n this.tag = tag;\n this.attrs = attrs;\n this.children = Array.isArray(children) ? children : [children];\n }\n\n /** Render to a real DOM element. If `target` is given, append to it. */\n render(target?: Element | null): HTMLElement {\n const el = document.createElement(this.tag);\n for (const [name, value] of Object.entries(this.attrs)) {\n if (value === undefined || value === null || value === false) continue;\n if (name === \"children\") continue;\n if (name === \"class\") {\n const cls = classNames(value as KlodsAttrs[\"class\"]);\n if (cls) el.setAttribute(\"class\", cls);\n continue;\n }\n if (name === \"style\") {\n el.setAttribute(\"style\", styleToString(value as string | Partial<CSSStyleDeclaration>));\n continue;\n }\n if (name.startsWith(\"on\") && typeof value === \"function\") {\n el.addEventListener(name.slice(2).toLowerCase(), value as EventListener);\n continue;\n }\n if (value === true) {\n el.setAttribute(name, \"\");\n continue;\n }\n el.setAttribute(name, String(value));\n }\n for (const child of flattenChildren(this.children)) {\n if (child instanceof KlodsNode) el.appendChild(child.render());\n else if (typeof child === \"object\" && child !== null && \"nodeType\" in child) {\n el.appendChild(child as Node);\n } else if (isRaw(child)) {\n const tpl = document.createElement(\"template\");\n tpl.innerHTML = child.html;\n el.appendChild(tpl.content);\n } else {\n el.appendChild(document.createTextNode(String(child)));\n }\n }\n if (target) target.appendChild(el);\n return el;\n }\n\n /** Render to a string of HTML. */\n toString(): string {\n const parts: string[] = [`<${this.tag}`];\n for (const [name, value] of Object.entries(this.attrs)) {\n if (value === undefined || value === null || value === false) continue;\n if (name === \"children\") continue;\n if (name.startsWith(\"on\") && typeof value === \"function\") continue;\n if (name === \"class\") {\n const cls = classNames(value as KlodsAttrs[\"class\"]);\n if (cls) parts.push(` class=\"${escapeAttr(cls)}\"`);\n continue;\n }\n if (name === \"style\") {\n parts.push(` style=\"${escapeAttr(styleToString(value as string | Partial<CSSStyleDeclaration>))}\"`);\n continue;\n }\n if (value === true) {\n parts.push(` ${name}`);\n continue;\n }\n parts.push(` ${name}=\"${escapeAttr(String(value))}\"`);\n }\n if (VOID_TAGS.has(this.tag)) {\n parts.push(\" />\");\n return parts.join(\"\");\n }\n parts.push(\">\");\n for (const child of flattenChildren(this.children)) {\n if (child instanceof KlodsNode) parts.push(child.toString());\n else if (isRaw(child)) parts.push(child.html);\n else if (typeof child === \"object\" && child !== null && \"outerHTML\" in child) {\n parts.push((child as Element).outerHTML);\n } else {\n parts.push(escapeHtml(String(child)));\n }\n }\n parts.push(`</${this.tag}>`);\n return parts.join(\"\");\n }\n}\n\n/**\n * Generic element builder. Most consumers use the named builders (page, header, …)\n * rather than calling `el` directly, but it's exported as an escape hatch.\n */\nexport function el(tag: string, attrs: KlodsAttrs = {}, children: KlodsChild | KlodsChild[] = []): KlodsNode {\n return new KlodsNode(tag, attrs, children);\n}\n\n/**\n * Factory that produces a typed builder for a tag with a base class. Modifier\n * props are converted into `--modifier` BEM classes and stripped from the output\n * attributes; everything else passes through untouched, so consumers can attach\n * arbitrary `id`, `data-*`, `aria-*`, event handlers, `style`, etc.\n */\nexport function builder<P extends Record<string, unknown> = Record<never, never>>(options: {\n tag: string;\n base: string;\n /** Map of prop name → class (or function returning a class) when the prop is truthy. */\n modifiers?: { [K in keyof P]?: string | ((value: P[K]) => string | undefined) };\n}): (props?: (P & KlodsAttrs) | null, children?: KlodsChild | KlodsChild[]) => KlodsNode {\n const { tag, base, modifiers = {} } = options;\n const modifierMap = modifiers as Record<string, string | ((value: unknown) => string | undefined) | undefined>;\n return (props, children) => {\n const userProps = (props ?? {}) as P & KlodsAttrs;\n const modClasses: string[] = [];\n const passthrough: KlodsAttrs = {};\n for (const [key, value] of Object.entries(userProps)) {\n const m = modifierMap[key];\n if (m !== undefined) {\n if (typeof m === \"function\") {\n const c = m(value);\n if (c) modClasses.push(c);\n } else if (value) {\n modClasses.push(m);\n }\n } else {\n passthrough[key] = value;\n }\n }\n const finalClass = mergeClasses(base, ...modClasses, userProps.class);\n const resolvedChildren =\n children !== undefined ? children : ((userProps.children as KlodsChild | KlodsChild[] | undefined) ?? []);\n delete passthrough.children;\n return new KlodsNode(tag, { ...passthrough, class: finalClass || undefined }, resolvedChildren);\n };\n}\n","// First wave of components: nav, card, button, badge, alert, prose helpers.\n// All match the BEM classes shipped by klods-css.\n\nimport type { KlodsAttrs, KlodsChild } from \"./core.js\";\nimport { builder, classNames, el, KlodsNode } from \"./core.js\";\n\n// ── Nav ──────────────────────────────────────────────────────────────────\nexport const nav = builder({ tag: \"nav\", base: \"klods-nav\" });\nexport const navList = builder({ tag: \"ul\", base: \"klods-nav__list\" });\nexport const buttonGroup = builder({ tag: \"div\", base: \"klods-button-group\" });\nexport type TocProps = { sub?: boolean };\nexport const toc = builder<TocProps>({ tag: \"ul\", base: \"klods-toc\", modifiers: { sub: \"klods-toc--sub\" } });\nexport const tocItem = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"li\", attrs ?? {}, children);\nexport const tocLink = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"a\", attrs ?? {}, children);\n\nexport type NavLinkProps = {\n href?: string;\n active?: boolean;\n};\nconst navLinkBuilder = builder<NavLinkProps>({\n tag: \"a\",\n base: \"klods-nav__link\",\n modifiers: { active: \"klods-nav__link--active\" },\n});\nexport function navLink(props?: (NavLinkProps & KlodsAttrs) | null, children?: KlodsChild | KlodsChild[]): KlodsNode {\n // Wrap each link in <li> so it's idiomatic inside <ul class=\"klods-nav__list\">.\n return el(\"li\", {}, [navLinkBuilder(props ?? null, children)]);\n}\n\n// ── Card ─────────────────────────────────────────────────────────────────\nexport type CardProps = {\n elevated?: boolean;\n};\nexport const card = builder<CardProps>({\n tag: \"div\",\n base: \"klods-card\",\n modifiers: { elevated: \"klods-card--elevated\" },\n});\nexport const cardTitle = builder({ tag: \"h3\", base: \"klods-card__title\" });\nexport const cardBody = builder({ tag: \"div\", base: \"klods-card__body\" });\nexport const cardFooter = builder({ tag: \"div\", base: \"klods-card__footer\" });\n\n// ── Button ───────────────────────────────────────────────────────────────\nexport type ButtonProps = {\n variant?: \"default\" | \"primary\" | \"danger\" | \"ghost\";\n type?: \"button\" | \"submit\" | \"reset\";\n};\nconst buttonBase = builder<ButtonProps>({\n tag: \"button\",\n base: \"klods-button\",\n modifiers: {\n variant: (v) => (v && v !== \"default\" ? `klods-button--${v}` : undefined),\n },\n});\nexport function button(props?: (ButtonProps & KlodsAttrs) | null, children?: KlodsChild | KlodsChild[]): KlodsNode {\n // Default `type=\"button\"` so it never accidentally submits a form.\n const merged = { type: \"button\", ...(props ?? {}) } as ButtonProps & KlodsAttrs;\n return buttonBase(merged, children);\n}\n\n// ── Badge ────────────────────────────────────────────────────────────────\nexport type BadgeProps = {\n variant?: \"default\" | \"accent\" | \"success\" | \"danger\";\n};\nexport const badge = builder<BadgeProps>({\n tag: \"span\",\n base: \"klods-badge\",\n modifiers: {\n variant: (v) => (v && v !== \"default\" ? `klods-badge--${v}` : undefined),\n },\n});\n\n// ── Alert ────────────────────────────────────────────────────────────────\nexport type AlertProps = {\n variant?: \"default\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n};\nconst alertBase = builder<AlertProps>({\n tag: \"div\",\n base: \"klods-alert\",\n modifiers: {\n variant: (v) => (v && v !== \"default\" ? `klods-alert--${v}` : undefined),\n },\n});\nexport function alert(props?: (AlertProps & KlodsAttrs) | null, children?: KlodsChild | KlodsChild[]): KlodsNode {\n // role=alert by default for assistive tech, overridable.\n const merged = { role: \"alert\", ...(props ?? {}) } as AlertProps & KlodsAttrs;\n return alertBase(merged, children);\n}\n\n// ── Prose helpers ────────────────────────────────────────────────────────\nexport const prose = builder({ tag: \"div\", base: \"klods-prose\" });\nexport const muted = builder({ tag: \"span\", base: \"klods-muted\" });\nexport const lead = builder({ tag: \"p\", base: \"klods-lead\" });\nexport const textCenter = builder({ tag: \"div\", base: \"klods-text-center\" });\n\n// ── Table ────────────────────────────────────────────────────────────────\nexport type TableProps = {\n striped?: boolean;\n dense?: boolean;\n};\nexport const table = builder<TableProps>({\n tag: \"table\",\n base: \"klods-table\",\n modifiers: {\n striped: \"klods-table--striped\",\n dense: \"klods-table--dense\",\n },\n});\nexport const thead = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"thead\", attrs ?? {}, children);\nexport const tbody = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"tbody\", attrs ?? {}, children);\nexport const tr = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"tr\", attrs ?? {}, children);\nexport const th = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"th\", attrs ?? {}, children);\nexport const td = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"td\", attrs ?? {}, children);\n\n// ── Forms ────────────────────────────────────────────────────────────────\n\n// Converts a label string to a stable, URL-safe id segment.\n// \"Email address\" → \"email-address\", \"First name\" → \"first-name\"\n// Falls back to a djb2 hash when the label produces no alphanumeric slug\n// (e.g. empty string or all-symbol text), keeping IDs deterministic.\nfunction slugId(prefix: string, text: string): string {\n const safe = text ?? \"\";\n const slug = safe\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-|-$/g, \"\");\n if (slug) return `${prefix}-${slug}`;\n let h = 5381;\n for (let i = 0; i < safe.length; i++) h = ((h << 5) + h + safe.charCodeAt(i)) | 0;\n return `${prefix}-${(h >>> 0).toString(36)}`;\n}\n\nexport const form = builder({ tag: \"form\", base: \"klods-form\" });\n\nexport type FieldProps = {\n /** Label text shown above the control. */\n label: string;\n /** Explicit id for the control. Auto-generated when omitted. */\n id?: string;\n /** Hint text shown below the control. Hidden when the field is invalid. */\n help?: string;\n /** Validation error. When present the field is rendered in its invalid state. */\n error?: string;\n /** Appends a * marker to the label. */\n required?: boolean;\n /** Force invalid state without providing error text. */\n invalid?: boolean;\n};\n\n// Form controls that can directly carry aria-describedby / aria-invalid.\nconst FORM_CONTROLS = new Set([\"input\", \"select\", \"textarea\"]);\n\n// Injects aria attrs onto the node itself if it's a form control, or onto the\n// first form-control child if it's a wrapper (e.g. the range / color wrappers).\nfunction patchAriaAttrs(node: KlodsNode, attrs: KlodsAttrs): KlodsNode {\n if (FORM_CONTROLS.has(node.tag)) {\n return new KlodsNode(node.tag, { ...node.attrs, ...attrs }, node.children);\n }\n const patchedChildren = node.children.map((child) =>\n child instanceof KlodsNode && FORM_CONTROLS.has(child.tag)\n ? new KlodsNode(child.tag, { ...child.attrs, ...attrs }, child.children)\n : child\n );\n return new KlodsNode(node.tag, node.attrs, patchedChildren);\n}\n\n/**\n * Opinionated field wrapper. Renders a label, the control, and optional\n * help / error text. Automatically wires `for`, `id`, `aria-describedby`,\n * and `aria-invalid` so you don't have to.\n *\n * Pass a render function that receives the generated (or explicit) `id`:\n * ```ts\n * field({ label: \"Email\", required: true }, (id) =>\n * input({ id, type: \"email\" }),\n * )\n * ```\n */\nexport function field(props: FieldProps & KlodsAttrs, renderInput: (id: string) => KlodsNode): KlodsNode {\n const { label: labelText, id: explicitId, help, error, required, invalid, class: extraClass, ...rest } = props;\n const id = explicitId ?? slugId(\"klods-field\", labelText);\n const helpId = help ? `${id}-help` : undefined;\n const errorId = error ? `${id}-error` : undefined;\n const isInvalid = invalid ?? !!error;\n\n // When invalid, .klods-help is hidden by CSS — only reference the visible error.\n // When valid, .klods-error is absent — only reference help text if present.\n const describedBy = isInvalid ? errorId : helpId;\n\n // Inject aria attrs onto the control (or its first form-control child for wrappers).\n const inputNode = renderInput(id);\n const patchedInput = patchAriaAttrs(inputNode, {\n ...(describedBy ? { \"aria-describedby\": describedBy } : {}),\n ...(isInvalid ? { \"aria-invalid\": \"true\" } : {}),\n });\n\n const fieldClass = classNames([\n \"klods-field\",\n isInvalid ? \"klods-field--invalid\" : \"\",\n classNames(extraClass as KlodsAttrs[\"class\"]),\n ]);\n\n const children: KlodsNode[] = [\n el(\"label\", { for: id, class: `klods-label${required ? \" klods-label--required\" : \"\"}` }, labelText),\n patchedInput,\n ];\n if (help) children.push(el(\"p\", { id: helpId, class: \"klods-help\" }, help));\n if (error) children.push(el(\"p\", { id: errorId, class: \"klods-error\", role: \"alert\" }, error));\n\n return el(\"div\", { ...rest, class: fieldClass || undefined }, children);\n}\n\nexport type InputProps = {\n type?:\n | \"text\"\n | \"email\"\n | \"password\"\n | \"number\"\n | \"tel\"\n | \"url\"\n | \"search\"\n | \"date\"\n | \"time\"\n | \"datetime-local\"\n | \"range\"\n | \"color\"\n | \"file\"\n | \"hidden\";\n};\nexport function input(props: InputProps & KlodsAttrs): KlodsNode {\n const { type, class: extraClass, oninput: userOninput, ...rest } = props;\n const cls = (extra: string) =>\n classNames([\"klods-input\", extra, classNames(extraClass as KlodsAttrs[\"class\"])]) || undefined;\n\n const id =\n (rest.id as string | undefined) ??\n slugId(\n \"klods-input\",\n (rest[\"aria-label\"] as string | undefined) ?? (rest.placeholder as string | undefined) ?? type ?? \"field\"\n );\n\n if (type === \"range\") {\n const initial = (rest.value as string) ?? \"50\";\n return el(\"span\", { class: cls(\"klods-input--range\") }, [\n el(\"input\", {\n type: \"range\",\n ...rest,\n id,\n oninput: (e: Event) => {\n const inp = e.target as HTMLInputElement;\n inp.closest(\".klods-input--range\")?.querySelector(\"output\")?.textContent !== undefined &&\n (inp.closest(\".klods-input--range\")!.querySelector(\"output\")!.textContent = inp.value);\n (userOninput as ((e: Event) => void) | undefined)?.(e);\n },\n }),\n el(\"output\", { for: id }, initial),\n ]);\n }\n\n if (type === \"color\") {\n const initial = (rest.value as string) ?? \"#000000\";\n return el(\"span\", { class: cls(\"klods-input--color\") }, [\n el(\"input\", {\n type: \"color\",\n ...rest,\n id,\n oninput: (e: Event) => {\n const inp = e.target as HTMLInputElement;\n inp.closest(\".klods-input--color\")?.querySelector(\"output\")?.textContent !== undefined &&\n (inp.closest(\".klods-input--color\")!.querySelector(\"output\")!.textContent = inp.value);\n (userOninput as ((e: Event) => void) | undefined)?.(e);\n },\n }),\n el(\"output\", { for: id }, initial),\n ]);\n }\n\n return new KlodsNode(\"input\", {\n type,\n ...rest,\n id,\n class: cls(\"\"),\n });\n}\n\nconst selectEl = builder({ tag: \"select\", base: \"klods-select\" });\nexport function select(attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode {\n // Wrap in a positioning parent so ::after can render the chevron arrow\n // via mask-image + var(--klods-color-muted) without a baked-in color.\n return el(\"div\", { class: \"klods-select-wrapper\" }, selectEl(attrs, children));\n}\n\nexport const option = (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode =>\n el(\"option\", attrs ?? {}, children);\n\nexport const textarea = builder({ tag: \"textarea\", base: \"klods-textarea\" });\n\n// ── Checkbox ─────────────────────────────────────────────────────────────\n\nexport type CheckboxProps = {\n label: string;\n name?: string;\n value?: string;\n checked?: boolean;\n disabled?: boolean;\n};\nexport function checkbox(props: CheckboxProps & KlodsAttrs): KlodsNode {\n const {\n label: labelText,\n name,\n value,\n checked,\n disabled,\n required,\n form,\n autofocus,\n class: extraClass,\n ...rest\n } = props as CheckboxProps & KlodsAttrs & { required?: boolean; form?: string; autofocus?: boolean };\n const inputAttrs: KlodsAttrs = { type: \"checkbox\" };\n if (name !== undefined) inputAttrs.name = name;\n if (value !== undefined) inputAttrs.value = value;\n if (checked) inputAttrs.checked = true;\n if (disabled) inputAttrs.disabled = true;\n if (required) inputAttrs.required = true;\n if (form !== undefined) inputAttrs.form = form;\n if (autofocus) inputAttrs.autofocus = true;\n\n return el(\n \"label\",\n { ...rest, class: classNames([\"klods-checkbox\", classNames(extraClass as KlodsAttrs[\"class\"])]) || undefined },\n [el(\"input\", inputAttrs), el(\"span\", {}, labelText)]\n );\n}\n\n// ── Radio ─────────────────────────────────────────────────────────────────\n\nexport type RadioProps = {\n label: string;\n name?: string;\n value?: string;\n checked?: boolean;\n disabled?: boolean;\n};\nexport function radio(props: RadioProps & KlodsAttrs): KlodsNode {\n const {\n label: labelText,\n name,\n value,\n checked,\n disabled,\n required,\n form,\n autofocus,\n class: extraClass,\n ...rest\n } = props as RadioProps & KlodsAttrs & { required?: boolean; form?: string; autofocus?: boolean };\n const inputAttrs: KlodsAttrs = { type: \"radio\" };\n if (name !== undefined) inputAttrs.name = name;\n if (value !== undefined) inputAttrs.value = value;\n if (checked) inputAttrs.checked = true;\n if (disabled) inputAttrs.disabled = true;\n if (required) inputAttrs.required = true;\n if (form !== undefined) inputAttrs.form = form;\n if (autofocus) inputAttrs.autofocus = true;\n\n return el(\n \"label\",\n { ...rest, class: classNames([\"klods-radio\", classNames(extraClass as KlodsAttrs[\"class\"])]) || undefined },\n [el(\"input\", inputAttrs), el(\"span\", {}, labelText)]\n );\n}\n\n// ── Radio group ───────────────────────────────────────────────────────────\n\nexport type RadioGroupProps = {\n /** Text shown as the group heading (maps to a styled `<p>` with aria-labelledby). */\n legend?: string;\n};\nexport function radioGroup(props: RadioGroupProps & KlodsAttrs, children: KlodsNode[]): KlodsNode {\n const { legend: legendText, class: extraClass, ...rest } = props;\n const legendId = legendText ? slugId(\"klods-rg\", legendText) : undefined;\n const cls = classNames([\"klods-field\", classNames(extraClass as KlodsAttrs[\"class\"])]) || undefined;\n return el(\"div\", { ...rest, class: cls, role: \"group\", ...(legendId ? { \"aria-labelledby\": legendId } : {}) }, [\n legendText ? el(\"p\", { id: legendId, class: \"klods-label\" }, legendText) : null,\n ...children,\n ]);\n}\n\n// ── Switch ────────────────────────────────────────────────────────────────\n\nexport type SwitchProps = {\n label: string;\n name?: string;\n value?: string;\n checked?: boolean;\n disabled?: boolean;\n /** Flips the layout: label on the left, track on the right. Ideal for settings panels. */\n reverse?: boolean;\n};\nexport function switchInput(props: SwitchProps & KlodsAttrs): KlodsNode {\n const { label: labelText, name, value, checked, disabled, reverse, class: extraClass, ...rest } = props;\n const inputAttrs: KlodsAttrs = {\n type: \"checkbox\",\n class: \"klods-switch__input\",\n role: \"switch\",\n };\n if (name !== undefined) inputAttrs.name = name;\n if (value !== undefined) inputAttrs.value = value;\n if (checked) inputAttrs.checked = true;\n if (disabled) inputAttrs.disabled = true;\n\n return el(\n \"label\",\n {\n ...rest,\n class:\n classNames([\n \"klods-switch\",\n reverse ? \"klods-switch--reverse\" : \"\",\n classNames(extraClass as KlodsAttrs[\"class\"]),\n ]) || undefined,\n },\n [\n el(\"input\", inputAttrs),\n el(\"span\", { class: \"klods-switch__track\" }),\n el(\"span\", { class: \"klods-switch__label\" }, labelText),\n ]\n );\n}\n\n// ── Code ─────────────────────────────────────────────────────────────────\nexport function codeBlock(attrs?: KlodsAttrs | null, content?: KlodsChild | KlodsChild[]): KlodsNode {\n return el(\"pre\", attrs ?? {}, el(\"code\", {}, content));\n}\nexport function inlineCode(attrs?: KlodsAttrs | null, content?: KlodsChild | KlodsChild[]): KlodsNode {\n return el(\"code\", attrs ?? {}, content);\n}\n\n// ── Box ──────────────────────────────────────────────────────────────────\nexport const box = builder({ tag: \"div\", base: \"klods-box\" });\n","// Layout builders — the four corners and the \"I-always-forget\" utilities.\n// Each builder is a thin wrapper around `builder()` from core.ts.\n\nimport type { KlodsAttrs, KlodsChild } from \"./core.js\";\nimport { builder, KlodsNode } from \"./core.js\";\n\n// ── Page ─────────────────────────────────────────────────────────────────\nexport type PageProps = {\n /** Render with a sidebar column. */\n sidebar?: boolean;\n /** Which side the sidebar appears on. Defaults to `\"leading\"` (inline-start). */\n sidebarPosition?: \"leading\" | \"trailing\";\n /** Keep the header pinned to the top of the viewport while the page scrolls. */\n stickyHeader?: boolean;\n};\n\nexport const page = builder<PageProps>({\n tag: \"div\",\n base: \"klods-page\",\n modifiers: {\n sidebar: \"klods-page--with-sidebar\",\n sidebarPosition: (v) => (v === \"trailing\" ? \"klods-page--sidebar-trailing\" : undefined),\n stickyHeader: \"klods-page--sticky-header\",\n },\n});\n\n// ── Page slots ───────────────────────────────────────────────────────────\nexport const header = builder({ tag: \"header\", base: \"klods-header\" });\nexport const sidebar = builder({ tag: \"aside\", base: \"klods-sidebar\" });\n\nexport type ContentProps = {\n /** Cap content width to --klods-content-max and centre it. */\n narrow?: boolean;\n};\nexport const content = builder<ContentProps>({\n tag: \"main\",\n base: \"klods-content\",\n modifiers: { narrow: \"klods-content--narrow\" },\n});\n\nexport const footer = builder({ tag: \"footer\", base: \"klods-footer\" });\nexport const section = builder({ tag: \"section\", base: \"klods-section\" });\n\n// ── Layout utilities ─────────────────────────────────────────────────────\ntype GapProp = { gap?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 };\n\nconst gapModifier = (prefix: string) => (v: number | undefined) =>\n v === undefined ? undefined : `${prefix}--gap-${v}`;\n\nexport const stack = builder<GapProp>({\n tag: \"div\",\n base: \"klods-stack\",\n modifiers: { gap: gapModifier(\"klods-stack\") },\n});\n\nexport const cluster = builder<GapProp>({\n tag: \"div\",\n base: \"klods-cluster\",\n modifiers: { gap: gapModifier(\"klods-cluster\") },\n});\n\ntype RowProps = GapProp & { inline?: boolean };\nexport const row = builder<RowProps>({\n tag: \"div\",\n base: \"klods-row\",\n modifiers: { gap: gapModifier(\"klods-row\"), inline: \"klods-row--inline\" },\n});\n\nexport type GridProps = GapProp & {\n cols?: 1 | 2 | 3 | 4 | 5 | 6;\n /** Auto-fit responsive columns; pair with `--klods-grid-min` if you want a custom minimum. */\n fit?: boolean;\n};\nexport const grid = builder<GridProps>({\n tag: \"div\",\n base: \"klods-grid\",\n modifiers: {\n gap: gapModifier(\"klods-grid\"),\n cols: (v) => (v === undefined ? undefined : `klods-grid--cols-${v}`),\n fit: \"klods-grid--fit\",\n },\n});\n\nexport const center = builder({ tag: \"div\", base: \"klods-center\" });\nexport const spread = builder({ tag: \"div\", base: \"klods-spread\" });\n\n// ── Convenience: empty fragment-ish wrapper for quick text + nodes ──────\nexport function text(value: string | number): KlodsNode {\n // Wrap loose text in a span so it composes anywhere a KlodsNode is expected.\n return new KlodsNode(\"span\", {}, [String(value)]);\n}\n\n// Re-export attribute / child types so consumers can extend a builder neatly.\nexport type { KlodsAttrs, KlodsChild };\n","// Utility builders — thin wrappers over the most-reached-for klods-css utility classes.\n\nimport { builder } from \"./core.js\";\n\n// ── Push ─────────────────────────────────────────────────────────────────\n// Renders a <span class=\"klods-push\">.\n// Pushes siblings to the end of a flex/grid row by consuming all remaining\n// inline space (margin-inline-start: auto).\nexport const push = builder({ tag: \"span\", base: \"klods-push\" });\n\n// ── Fill ─────────────────────────────────────────────────────────────────\n// Renders a <div class=\"klods-fill\">.\n// Grows to fill available flex/grid space (flex: 1 1 auto).\n// Useful as a wrapper when you need one slot to absorb leftover room —\n// e.g. equal-width side groups in a header to centre a middle item.\nexport const fill = builder({ tag: \"div\", base: \"klods-fill\" });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AAM,OAAO,QAAQ,EAAE,KAAK,QAAQ,MAAM,aAAa,CAAC;AAOxD,IAAM,OAAO,QAAQ,EAAE,KAAK,OAAO,MAAM,aAAa,CAAC;","names":["input","stack","el","text","form","content"]}
package/dist/index.d.cts CHANGED
@@ -85,6 +85,7 @@ declare function alert(props?: (AlertProps & KlodsAttrs) | null, children?: Klod
85
85
  declare const prose: (props?: (Record<never, never> & KlodsAttrs) | null | undefined, children?: KlodsChild | KlodsChild[]) => KlodsNode;
86
86
  declare const muted: (props?: (Record<never, never> & KlodsAttrs) | null | undefined, children?: KlodsChild | KlodsChild[]) => KlodsNode;
87
87
  declare const lead: (props?: (Record<never, never> & KlodsAttrs) | null | undefined, children?: KlodsChild | KlodsChild[]) => KlodsNode;
88
+ declare const textCenter: (props?: (Record<never, never> & KlodsAttrs) | null | undefined, children?: KlodsChild | KlodsChild[]) => KlodsNode;
88
89
  type TableProps = {
89
90
  striped?: boolean;
90
91
  dense?: boolean;
@@ -95,6 +96,72 @@ declare const tbody: (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsCh
95
96
  declare const tr: (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]) => KlodsNode;
96
97
  declare const th: (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]) => KlodsNode;
97
98
  declare const td: (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]) => KlodsNode;
99
+ declare const form: (props?: (Record<never, never> & KlodsAttrs) | null | undefined, children?: KlodsChild | KlodsChild[]) => KlodsNode;
100
+ type FieldProps = {
101
+ /** Label text shown above the control. */
102
+ label: string;
103
+ /** Explicit id for the control. Auto-generated when omitted. */
104
+ id?: string;
105
+ /** Hint text shown below the control. Hidden when the field is invalid. */
106
+ help?: string;
107
+ /** Validation error. When present the field is rendered in its invalid state. */
108
+ error?: string;
109
+ /** Appends a * marker to the label. */
110
+ required?: boolean;
111
+ /** Force invalid state without providing error text. */
112
+ invalid?: boolean;
113
+ };
114
+ /**
115
+ * Opinionated field wrapper. Renders a label, the control, and optional
116
+ * help / error text. Automatically wires `for`, `id`, `aria-describedby`,
117
+ * and `aria-invalid` so you don't have to.
118
+ *
119
+ * Pass a render function that receives the generated (or explicit) `id`:
120
+ * ```ts
121
+ * field({ label: "Email", required: true }, (id) =>
122
+ * input({ id, type: "email" }),
123
+ * )
124
+ * ```
125
+ */
126
+ declare function field(props: FieldProps & KlodsAttrs, renderInput: (id: string) => KlodsNode): KlodsNode;
127
+ type InputProps = {
128
+ type?: "text" | "email" | "password" | "number" | "tel" | "url" | "search" | "date" | "time" | "datetime-local" | "range" | "color" | "file" | "hidden";
129
+ };
130
+ declare function input(props: InputProps & KlodsAttrs): KlodsNode;
131
+ declare function select(attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]): KlodsNode;
132
+ declare const option: (attrs?: KlodsAttrs | null, children?: KlodsChild | KlodsChild[]) => KlodsNode;
133
+ declare const textarea: (props?: (Record<never, never> & KlodsAttrs) | null | undefined, children?: KlodsChild | KlodsChild[]) => KlodsNode;
134
+ type CheckboxProps = {
135
+ label: string;
136
+ name?: string;
137
+ value?: string;
138
+ checked?: boolean;
139
+ disabled?: boolean;
140
+ };
141
+ declare function checkbox(props: CheckboxProps & KlodsAttrs): KlodsNode;
142
+ type RadioProps = {
143
+ label: string;
144
+ name?: string;
145
+ value?: string;
146
+ checked?: boolean;
147
+ disabled?: boolean;
148
+ };
149
+ declare function radio(props: RadioProps & KlodsAttrs): KlodsNode;
150
+ type RadioGroupProps = {
151
+ /** Text shown as the group heading (maps to a styled `<p>` with aria-labelledby). */
152
+ legend?: string;
153
+ };
154
+ declare function radioGroup(props: RadioGroupProps & KlodsAttrs, children: KlodsNode[]): KlodsNode;
155
+ type SwitchProps = {
156
+ label: string;
157
+ name?: string;
158
+ value?: string;
159
+ checked?: boolean;
160
+ disabled?: boolean;
161
+ /** Flips the layout: label on the left, track on the right. Ideal for settings panels. */
162
+ reverse?: boolean;
163
+ };
164
+ declare function switchInput(props: SwitchProps & KlodsAttrs): KlodsNode;
98
165
  declare function codeBlock(attrs?: KlodsAttrs | null, content?: KlodsChild | KlodsChild[]): KlodsNode;
99
166
  declare function inlineCode(attrs?: KlodsAttrs | null, content?: KlodsChild | KlodsChild[]): KlodsNode;
100
167
  declare const box: (props?: (Record<never, never> & KlodsAttrs) | null | undefined, children?: KlodsChild | KlodsChild[]) => KlodsNode;
@@ -142,4 +209,4 @@ declare function text(value: string | number): KlodsNode;
142
209
  declare const push: (props?: (Record<never, never> & KlodsAttrs) | null | undefined, children?: KlodsChild | KlodsChild[]) => KlodsNode;
143
210
  declare const fill: (props?: (Record<never, never> & KlodsAttrs) | null | undefined, children?: KlodsChild | KlodsChild[]) => KlodsNode;
144
211
 
145
- export { type AlertProps, type BadgeProps, type ButtonProps, type CardProps, type ContentProps, type GridProps, type KlodsAttrs, type KlodsChild, KlodsNode, type NavLinkProps, type PageProps, type TableProps, type TocProps, alert, badge, box, builder, button, buttonGroup, card, cardBody, cardFooter, cardTitle, center, classNames, cluster, codeBlock, content, el, fill, footer, grid, header, inlineCode, lead, mergeClasses, muted, nav, navLink, navList, page, prose, push, raw, row, section, sidebar, spread, stack, table, tbody, td, text, th, thead, toc, tocItem, tocLink, tr };
212
+ export { type AlertProps, type BadgeProps, type ButtonProps, type CardProps, type CheckboxProps, type ContentProps, type FieldProps, type GridProps, type InputProps, type KlodsAttrs, type KlodsChild, KlodsNode, type NavLinkProps, type PageProps, type RadioGroupProps, type RadioProps, type SwitchProps, type TableProps, type TocProps, alert, badge, box, builder, button, buttonGroup, card, cardBody, cardFooter, cardTitle, center, checkbox, classNames, cluster, codeBlock, content, el, field, fill, footer, form, grid, header, inlineCode, input, lead, mergeClasses, muted, nav, navLink, navList, option, page, prose, push, radio, radioGroup, raw, row, section, select, sidebar, spread, stack, switchInput, table, tbody, td, text, textCenter, textarea, th, thead, toc, tocItem, tocLink, tr };