@f-ewald/components 1.23.0 → 1.24.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.
Files changed (97) hide show
  1. package/README.md +7 -1
  2. package/custom-elements.json +1966 -643
  3. package/dist/address-autocomplete.d.ts.map +1 -1
  4. package/dist/address-autocomplete.js +7 -3
  5. package/dist/address-autocomplete.js.map +1 -1
  6. package/dist/audio-player.d.ts +53 -0
  7. package/dist/audio-player.d.ts.map +1 -0
  8. package/dist/audio-player.js +267 -0
  9. package/dist/audio-player.js.map +1 -0
  10. package/dist/autocomplete-input.d.ts.map +1 -1
  11. package/dist/autocomplete-input.js +7 -3
  12. package/dist/autocomplete-input.js.map +1 -1
  13. package/dist/button-group.d.ts +12 -1
  14. package/dist/button-group.d.ts.map +1 -1
  15. package/dist/button-group.js +35 -3
  16. package/dist/button-group.js.map +1 -1
  17. package/dist/comment-composer.d.ts +54 -0
  18. package/dist/comment-composer.d.ts.map +1 -0
  19. package/dist/comment-composer.js +244 -0
  20. package/dist/comment-composer.js.map +1 -0
  21. package/dist/confirm-dialog.d.ts +4 -1
  22. package/dist/confirm-dialog.d.ts.map +1 -1
  23. package/dist/confirm-dialog.js +47 -9
  24. package/dist/confirm-dialog.js.map +1 -1
  25. package/dist/dropdown-button.d.ts +4 -1
  26. package/dist/dropdown-button.d.ts.map +1 -1
  27. package/dist/dropdown-button.js +29 -3
  28. package/dist/dropdown-button.js.map +1 -1
  29. package/dist/icons.d.ts +65 -0
  30. package/dist/icons.d.ts.map +1 -1
  31. package/dist/icons.js +65 -0
  32. package/dist/icons.js.map +1 -1
  33. package/dist/index.d.ts +4 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +4 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/mcp-server.js +39 -0
  38. package/dist/mcp-server.js.map +1 -1
  39. package/dist/page-header.d.ts +8 -3
  40. package/dist/page-header.d.ts.map +1 -1
  41. package/dist/page-header.js +33 -12
  42. package/dist/page-header.js.map +1 -1
  43. package/dist/pagination-nav.d.ts +7 -0
  44. package/dist/pagination-nav.d.ts.map +1 -1
  45. package/dist/pagination-nav.js +19 -4
  46. package/dist/pagination-nav.js.map +1 -1
  47. package/dist/radio-cards.d.ts +6 -0
  48. package/dist/radio-cards.d.ts.map +1 -1
  49. package/dist/radio-cards.js +13 -3
  50. package/dist/radio-cards.js.map +1 -1
  51. package/dist/radio-pills.d.ts +6 -0
  52. package/dist/radio-pills.d.ts.map +1 -1
  53. package/dist/radio-pills.js +13 -3
  54. package/dist/radio-pills.js.map +1 -1
  55. package/dist/range-slider.d.ts.map +1 -1
  56. package/dist/range-slider.js +11 -7
  57. package/dist/range-slider.js.map +1 -1
  58. package/dist/reveal-button.d.ts +5 -1
  59. package/dist/reveal-button.d.ts.map +1 -1
  60. package/dist/reveal-button.js +26 -4
  61. package/dist/reveal-button.js.map +1 -1
  62. package/dist/tokens.css +17 -0
  63. package/dist/tokens.d.ts.map +1 -1
  64. package/dist/tokens.js +56 -0
  65. package/dist/tokens.js.map +1 -1
  66. package/dist/ui-button.d.ts +16 -0
  67. package/dist/ui-button.d.ts.map +1 -1
  68. package/dist/ui-button.js +48 -7
  69. package/dist/ui-button.js.map +1 -1
  70. package/dist/utils/duration.d.ts +8 -0
  71. package/dist/utils/duration.d.ts.map +1 -1
  72. package/dist/utils/duration.js +18 -0
  73. package/dist/utils/duration.js.map +1 -1
  74. package/dist/utils/transport-controls.d.ts +11 -0
  75. package/dist/utils/transport-controls.d.ts.map +1 -0
  76. package/dist/utils/transport-controls.js +113 -0
  77. package/dist/utils/transport-controls.js.map +1 -0
  78. package/dist/video-player.d.ts +60 -0
  79. package/dist/video-player.d.ts.map +1 -0
  80. package/dist/video-player.js +324 -0
  81. package/dist/video-player.js.map +1 -0
  82. package/docs/audio-player.md +60 -0
  83. package/docs/button-group.md +18 -1
  84. package/docs/comment-composer.md +68 -0
  85. package/docs/confirm-dialog.md +19 -1
  86. package/docs/dropdown-button.md +10 -1
  87. package/docs/icons.md +75 -0
  88. package/docs/page-header.md +11 -4
  89. package/docs/pagination-nav.md +14 -0
  90. package/docs/radio-cards.md +9 -0
  91. package/docs/radio-pills.md +9 -0
  92. package/docs/range-slider.md +3 -0
  93. package/docs/reveal-button.md +11 -1
  94. package/docs/ui-button.md +32 -0
  95. package/docs/video-player.md +59 -0
  96. package/llms.txt +224 -23
  97. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,2EAA2E;AAC3E,sEAAsE;AACtE,kEAAkE;AAClE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAejD,gFAAgF;AAChF,KAAK,UAAU,kBAAkB;IAC/B,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;IAC5E,OAAQ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,CAAC;IACD,MAAM,UAAU,GAAG,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjF,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,IAAI,qBAAqB,UAAU,EAAE,EAAE,CAAC;QAC5F,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * Stdio MCP server exposing the `@f-ewald/components` catalog to AI coding\n * assistants (Claude Code, etc.) working in a consuming project.\n *\n * Tools, backed by the same `custom-elements.json` and `docs/*.md` this\n * package already generates and ships via `npm run docs`, plus the authored\n * `docs/layouts/*.md` recipes:\n * - `list_components`: every tag name + one-line description.\n * - `get_component_docs`: the full generated Markdown doc for one tag.\n * - `list_layouts`: every dashboard page template + one-line summary.\n * - `get_layout`: the full recipe for one page template.\n *\n * No new data source — this is just a different transport over docs that\n * already exist. See `docs/mcp-evaluation.md` for the design rationale.\n */\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { fileURLToPath } from \"node:url\";\nimport path from \"node:path\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n// This file compiles to dist/mcp-server.js; custom-elements.json and docs/\n// ship alongside dist/ at the package root, whether run from the repo\n// checkout or from an installed node_modules/@f-ewald/components.\nconst packageRoot = path.join(__dirname, \"..\");\nconst docsDir = path.join(packageRoot, \"docs\");\nconst layoutsDir = path.join(docsDir, \"layouts\");\n\n/** One row of the `list_components` result. */\ninterface ComponentSummary {\n tag: string;\n summary: string;\n}\n\n/** One row of the `list_layouts` result. */\ninterface LayoutSummary {\n name: string;\n title: string;\n summary: string;\n}\n\n/** Reads the package's own version out of package.json, for server metadata. */\nasync function readPackageVersion(): Promise<string> {\n const text = await readFile(path.join(packageRoot, \"package.json\"), \"utf8\");\n return (JSON.parse(text) as { version: string }).version;\n}\n\n/** Extracts {tag, one-line summary} for every custom element, sorted by tag. */\nasync function listComponents(): Promise<ComponentSummary[]> {\n const text = await readFile(path.join(packageRoot, \"custom-elements.json\"), \"utf8\");\n const manifest = JSON.parse(text) as {\n modules: { declarations?: { customElement?: boolean; tagName: string; description?: string }[] }[];\n };\n const components: ComponentSummary[] = [];\n for (const mod of manifest.modules) {\n for (const decl of mod.declarations ?? []) {\n if (!decl.customElement) continue;\n const summary = (decl.description ?? \"\").split(\"\\n\\n\")[0]!.replace(/\\n/g, \" \").trim();\n components.push({ tag: decl.tagName, summary });\n }\n }\n components.sort((a, b) => a.tag.localeCompare(b.tag));\n return components;\n}\n\n/**\n * Extracts {name, title, one-line summary} for every `docs/layouts/*.md`\n * recipe, sorted by name. `name` is the filename without `.md`; `summary` is\n * the recipe's first prose paragraph.\n */\nasync function listLayouts(): Promise<LayoutSummary[]> {\n let files: string[];\n try {\n files = await readdir(layoutsDir);\n } catch {\n return [];\n }\n const layouts: LayoutSummary[] = [];\n for (const file of files) {\n if (!file.endsWith(\".md\")) continue;\n const name = file.slice(0, -3);\n const lines = (await readFile(path.join(layoutsDir, file), \"utf8\")).split(\"\\n\");\n const title = lines.find((line) => line.startsWith(\"# \"))?.slice(2).trim() ?? name;\n let seenTitle = false;\n let summary = \"\";\n for (const line of lines) {\n const text = line.trim();\n if (!seenTitle) {\n if (text.startsWith(\"# \")) seenTitle = true;\n continue;\n }\n if (text === \"\" || text.startsWith(\"#\")) continue;\n summary = text;\n break;\n }\n layouts.push({ name, title, summary });\n }\n layouts.sort((a, b) => a.name.localeCompare(b.name));\n return layouts;\n}\n\nconst server = new McpServer({\n name: \"f-ewald-components\",\n version: await readPackageVersion(),\n});\n\nserver.registerTool(\n \"list_components\",\n {\n title: \"List components\",\n description:\n \"Lists every web component tag in @f-ewald/components with a one-line \" +\n \"description. Call get_component_docs(tag) for the full usage example, \" +\n \"attributes/properties, events, slots, and CSS custom properties of a \" +\n \"specific tag.\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listComponents(), null, 2) }],\n }),\n);\n\nserver.registerTool(\n \"get_component_docs\",\n {\n title: \"Get component docs\",\n description:\n \"Returns the full generated Markdown documentation (install snippet, \" +\n \"usage example, attributes/properties, events, slots, CSS custom \" +\n \"properties) for one @f-ewald/components tag. Use list_components \" +\n \"first to find valid tags.\",\n inputSchema: { tag: z.string().describe('Component tag name, e.g. \"ui-button\".') },\n },\n async ({ tag }) => {\n try {\n const text = await readFile(path.join(docsDir, `${tag}.md`), \"utf8\");\n return { content: [{ type: \"text\", text }] };\n } catch {\n const validTags = (await listComponents()).map((c) => c.tag).join(\", \");\n return {\n content: [{ type: \"text\", text: `No docs found for tag \"${tag}\". Valid tags: ${validTags}` }],\n isError: true,\n };\n }\n },\n);\n\nserver.registerTool(\n \"list_layouts\",\n {\n title: \"List layouts\",\n description:\n \"Lists the dashboard page templates (layout recipes) in \" +\n \"@f-ewald/components — list-only, list+detail, detail-only, and form — \" +\n \"with a one-line summary each. Call get_layout(name) for the full recipe \" +\n \"(which components fill which app-shell slots, example markup, and notes). \" +\n \"Use this to learn the preferred internal-dashboard layout before \" +\n \"composing app-shell, app-sidebar, action-bar, pagination-nav, \" +\n \"form-actions, and page-header.\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listLayouts(), null, 2) }],\n }),\n);\n\nserver.registerTool(\n \"get_layout\",\n {\n title: \"Get layout recipe\",\n description:\n \"Returns the full Markdown recipe for one dashboard page template: which \" +\n \"components go in which app-shell slots, copy-paste markup, and layout \" +\n \"notes. Use list_layouts first to find valid names.\",\n inputSchema: { name: z.string().describe('Layout name, e.g. \"list-detail\".') },\n },\n async ({ name }) => {\n if (/^[a-z0-9-]+$/.test(name)) {\n try {\n const text = await readFile(path.join(layoutsDir, `${name}.md`), \"utf8\");\n return { content: [{ type: \"text\", text }] };\n } catch {\n // Fall through to the not-found response with valid names.\n }\n }\n const validNames = (await listLayouts()).map((layout) => layout.name).join(\", \");\n return {\n content: [{ type: \"text\", text: `No layout named \"${name}\". Valid layouts: ${validNames}` }],\n isError: true,\n };\n },\n);\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n"]}
1
+ {"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,2EAA2E;AAC3E,sEAAsE;AACtE,kEAAkE;AAClE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAsBjD,gFAAgF;AAChF,KAAK,UAAU,kBAAkB;IAC/B,MAAM,IAAI,GAAG,MAAM,QA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CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjF,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,IAAI,qBAAqB,UAAU,EAAE,EAAE,CAAC;QAC5F,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,YAAY,CACjB,YAAY,EACZ;IACE,KAAK,EAAE,YAAY;IACnB,WAAW,EACT,qEAAqE;QACrE,mEAAmE;QACnE,kEAAkE;QAClE,4DAA4D;QAC5D,uEAAuE;QACvE,sDAAsD;CACzD,EACD,KAAK,IAAI,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;CAC9E,CAAC,CACH,CAAC;AAEF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * Stdio MCP server exposing the `@f-ewald/components` catalog to AI coding\n * assistants (Claude Code, etc.) working in a consuming project.\n *\n * Tools, backed by the same `custom-elements.json` and `docs/*.md` this\n * package already generates and ships via `npm run docs`, plus the authored\n * `docs/layouts/*.md` recipes:\n * - `list_components`: every tag name + one-line description.\n * - `get_component_docs`: the full generated Markdown doc for one tag.\n * - `list_layouts`: every dashboard page template + one-line summary.\n * - `get_layout`: the full recipe for one page template.\n * - `list_icons`: every icon, its default size, and its intended use case.\n *\n * No new data source — this is just a different transport over docs that\n * already exist. See `docs/mcp-evaluation.md` for the design rationale.\n */\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { fileURLToPath } from \"node:url\";\nimport path from \"node:path\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n// This file compiles to dist/mcp-server.js; custom-elements.json and docs/\n// ship alongside dist/ at the package root, whether run from the repo\n// checkout or from an installed node_modules/@f-ewald/components.\nconst packageRoot = path.join(__dirname, \"..\");\nconst docsDir = path.join(packageRoot, \"docs\");\nconst layoutsDir = path.join(docsDir, \"layouts\");\n\n/** One row of the `list_components` result. */\ninterface ComponentSummary {\n tag: string;\n summary: string;\n}\n\n/** One row of the `list_layouts` result. */\ninterface LayoutSummary {\n name: string;\n title: string;\n summary: string;\n}\n\n/** One row of the `list_icons` result. */\ninterface IconSummary {\n name: string;\n defaultSize: number;\n usage: string;\n}\n\n/** Reads the package's own version out of package.json, for server metadata. */\nasync function readPackageVersion(): Promise<string> {\n const text = await readFile(path.join(packageRoot, \"package.json\"), \"utf8\");\n return (JSON.parse(text) as { version: string }).version;\n}\n\n/** Extracts {tag, one-line summary} for every custom element, sorted by tag. */\nasync function listComponents(): Promise<ComponentSummary[]> {\n const text = await readFile(path.join(packageRoot, \"custom-elements.json\"), \"utf8\");\n const manifest = JSON.parse(text) as {\n modules: { declarations?: { customElement?: boolean; tagName: string; description?: string }[] }[];\n };\n const components: ComponentSummary[] = [];\n for (const mod of manifest.modules) {\n for (const decl of mod.declarations ?? []) {\n if (!decl.customElement) continue;\n const summary = (decl.description ?? \"\").split(\"\\n\\n\")[0]!.replace(/\\n/g, \" \").trim();\n components.push({ tag: decl.tagName, summary });\n }\n }\n components.sort((a, b) => a.tag.localeCompare(b.tag));\n return components;\n}\n\n/**\n * Extracts {name, defaultSize, usage} for every `icon*` export in\n * `src/icons.ts`, sorted by name. `usage` is the \"use for ...\" guideline\n * `scripts/generate-icons.mjs` writes as a JSDoc comment above each export,\n * which `npm run analyze` lifts into this same `custom-elements.json` — the\n * same source `listComponents` reads, just a different module/kind filter.\n */\nasync function listIcons(): Promise<IconSummary[]> {\n const text = await readFile(path.join(packageRoot, \"custom-elements.json\"), \"utf8\");\n const manifest = JSON.parse(text) as {\n modules: {\n path: string;\n declarations?: {\n kind?: string;\n name: string;\n description?: string;\n parameters?: { default?: string }[];\n }[];\n }[];\n };\n const icons: IconSummary[] = [];\n for (const mod of manifest.modules) {\n if (mod.path !== \"src/icons.ts\") continue;\n for (const decl of mod.declarations ?? []) {\n if (decl.kind !== \"function\" || !decl.name.startsWith(\"icon\")) continue;\n icons.push({\n name: decl.name,\n defaultSize: Number(decl.parameters?.[0]?.default ?? 18),\n usage: decl.description ?? \"\",\n });\n }\n }\n icons.sort((a, b) => a.name.localeCompare(b.name));\n return icons;\n}\n\n/**\n * Extracts {name, title, one-line summary} for every `docs/layouts/*.md`\n * recipe, sorted by name. `name` is the filename without `.md`; `summary` is\n * the recipe's first prose paragraph.\n */\nasync function listLayouts(): Promise<LayoutSummary[]> {\n let files: string[];\n try {\n files = await readdir(layoutsDir);\n } catch {\n return [];\n }\n const layouts: LayoutSummary[] = [];\n for (const file of files) {\n if (!file.endsWith(\".md\")) continue;\n const name = file.slice(0, -3);\n const lines = (await readFile(path.join(layoutsDir, file), \"utf8\")).split(\"\\n\");\n const title = lines.find((line) => line.startsWith(\"# \"))?.slice(2).trim() ?? name;\n let seenTitle = false;\n let summary = \"\";\n for (const line of lines) {\n const text = line.trim();\n if (!seenTitle) {\n if (text.startsWith(\"# \")) seenTitle = true;\n continue;\n }\n if (text === \"\" || text.startsWith(\"#\")) continue;\n summary = text;\n break;\n }\n layouts.push({ name, title, summary });\n }\n layouts.sort((a, b) => a.name.localeCompare(b.name));\n return layouts;\n}\n\nconst server = new McpServer({\n name: \"f-ewald-components\",\n version: await readPackageVersion(),\n});\n\nserver.registerTool(\n \"list_components\",\n {\n title: \"List components\",\n description:\n \"Lists every web component tag in @f-ewald/components with a one-line \" +\n \"description. Call get_component_docs(tag) for the full usage example, \" +\n \"attributes/properties, events, slots, and CSS custom properties of a \" +\n \"specific tag.\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listComponents(), null, 2) }],\n }),\n);\n\nserver.registerTool(\n \"get_component_docs\",\n {\n title: \"Get component docs\",\n description:\n \"Returns the full generated Markdown documentation (install snippet, \" +\n \"usage example, attributes/properties, events, slots, CSS custom \" +\n \"properties) for one @f-ewald/components tag. Use list_components \" +\n \"first to find valid tags.\",\n inputSchema: { tag: z.string().describe('Component tag name, e.g. \"ui-button\".') },\n },\n async ({ tag }) => {\n try {\n const text = await readFile(path.join(docsDir, `${tag}.md`), \"utf8\");\n return { content: [{ type: \"text\", text }] };\n } catch {\n const validTags = (await listComponents()).map((c) => c.tag).join(\", \");\n return {\n content: [{ type: \"text\", text: `No docs found for tag \"${tag}\". Valid tags: ${validTags}` }],\n isError: true,\n };\n }\n },\n);\n\nserver.registerTool(\n \"list_layouts\",\n {\n title: \"List layouts\",\n description:\n \"Lists the dashboard page templates (layout recipes) in \" +\n \"@f-ewald/components — list-only, list+detail, detail-only, and form — \" +\n \"with a one-line summary each. Call get_layout(name) for the full recipe \" +\n \"(which components fill which app-shell slots, example markup, and notes). \" +\n \"Use this to learn the preferred internal-dashboard layout before \" +\n \"composing app-shell, app-sidebar, action-bar, pagination-nav, \" +\n \"form-actions, and page-header.\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listLayouts(), null, 2) }],\n }),\n);\n\nserver.registerTool(\n \"get_layout\",\n {\n title: \"Get layout recipe\",\n description:\n \"Returns the full Markdown recipe for one dashboard page template: which \" +\n \"components go in which app-shell slots, copy-paste markup, and layout \" +\n \"notes. Use list_layouts first to find valid names.\",\n inputSchema: { name: z.string().describe('Layout name, e.g. \"list-detail\".') },\n },\n async ({ name }) => {\n if (/^[a-z0-9-]+$/.test(name)) {\n try {\n const text = await readFile(path.join(layoutsDir, `${name}.md`), \"utf8\");\n return { content: [{ type: \"text\", text }] };\n } catch {\n // Fall through to the not-found response with valid names.\n }\n }\n const validNames = (await listLayouts()).map((layout) => layout.name).join(\", \");\n return {\n content: [{ type: \"text\", text: `No layout named \"${name}\". Valid layouts: ${validNames}` }],\n isError: true,\n };\n },\n);\n\nserver.registerTool(\n \"list_icons\",\n {\n title: \"List icons\",\n description:\n \"Lists every icon in @f-ewald/components/icons.js (e.g. iconPencil) \" +\n \"with its default size in pixels and its intended use case, so an \" +\n \"agent picks the one consistent icon for a given situation (e.g. \" +\n \"delete vs. edit vs. close) instead of guessing. Import as \" +\n '`import { iconPencil } from \"@f-ewald/components/icons.js\"` and call ' +\n \"with an optional size override, e.g. iconPencil(16).\",\n },\n async () => ({\n content: [{ type: \"text\", text: JSON.stringify(await listIcons(), null, 2) }],\n }),\n);\n\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n"]}
@@ -1,9 +1,12 @@
1
1
  import { LitElement } from "lit";
2
2
  /**
3
3
  * Page title block for the top of a dashboard view: an optional breadcrumb
4
- * trail, the page heading, and a right-aligned cluster of page-level actions.
5
- * It only lays these out — the breadcrumb links and action buttons are entirely
6
- * the consumer's, so it stays framework- and router-agnostic.
4
+ * trail, the page heading with a right-aligned cluster of page-level actions
5
+ * beside it, and an optional description of what the page is for underneath.
6
+ * The actions sit in the title row rather than beside the whole block, so a
7
+ * longer or wrapping description never moves them. It only lays these out —
8
+ * the breadcrumb links and action buttons are entirely the consumer's, so it
9
+ * stays framework- and router-agnostic.
7
10
  *
8
11
  * @element page-header
9
12
  * @slot breadcrumb - Optional breadcrumb trail rendered above the heading.
@@ -12,6 +15,8 @@ import { LitElement } from "lit";
12
15
  export declare class PageHeader extends LitElement {
13
16
  /** The page heading text. */
14
17
  heading: string;
18
+ /** Optional supporting line under the heading, explaining what the page does. */
19
+ description: string;
15
20
  /** Whether the breadcrumb slot currently has assigned content. */
16
21
  private _hasBreadcrumb;
17
22
  static styles: import("lit").CSSResult[];
@@ -1 +1 @@
1
- {"version":3,"file":"page-header.d.ts","sourceRoot":"","sources":["../src/page-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAIrD;;;;;;;;;GASG;AACH,qBACa,UAAW,SAAQ,UAAU;IACxC,6BAA6B;IACjB,OAAO,SAAM;IAEzB,kEAAkE;IACzD,OAAO,CAAC,cAAc,CAAS;IAExC,OAAgB,MAAM,4BAgDpB;IAEF,yFAAyF;IACzF,OAAO,CAAC,uBAAuB;IAKtB,MAAM,yCAYd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"page-header.d.ts","sourceRoot":"","sources":["../src/page-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAIrD;;;;;;;;;;;;GAYG;AACH,qBACa,UAAW,SAAQ,UAAU;IACxC,6BAA6B;IACjB,OAAO,SAAM;IAEzB,iFAAiF;IACrE,WAAW,SAAM;IAE7B,kEAAkE;IACzD,OAAO,CAAC,cAAc,CAAS;IAExC,OAAgB,MAAM,4BA4DpB;IAEF,yFAAyF;IACzF,OAAO,CAAC,uBAAuB;IAKtB,MAAM,yCAad;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -9,9 +9,12 @@ import { customElement, property, state } from "lit/decorators.js";
9
9
  import { tokens } from "./tokens.js";
10
10
  /**
11
11
  * Page title block for the top of a dashboard view: an optional breadcrumb
12
- * trail, the page heading, and a right-aligned cluster of page-level actions.
13
- * It only lays these out — the breadcrumb links and action buttons are entirely
14
- * the consumer's, so it stays framework- and router-agnostic.
12
+ * trail, the page heading with a right-aligned cluster of page-level actions
13
+ * beside it, and an optional description of what the page is for underneath.
14
+ * The actions sit in the title row rather than beside the whole block, so a
15
+ * longer or wrapping description never moves them. It only lays these out —
16
+ * the breadcrumb links and action buttons are entirely the consumer's, so it
17
+ * stays framework- and router-agnostic.
15
18
  *
16
19
  * @element page-header
17
20
  * @slot breadcrumb - Optional breadcrumb trail rendered above the heading.
@@ -22,6 +25,8 @@ let PageHeader = class PageHeader extends LitElement {
22
25
  super(...arguments);
23
26
  /** The page heading text. */
24
27
  this.heading = "";
28
+ /** Optional supporting line under the heading, explaining what the page does. */
29
+ this.description = "";
25
30
  /** Whether the breadcrumb slot currently has assigned content. */
26
31
  this._hasBreadcrumb = false;
27
32
  }
@@ -42,15 +47,18 @@ let PageHeader = class PageHeader extends LitElement {
42
47
  );
43
48
  }
44
49
  .header {
50
+ display: block;
51
+ }
52
+ /* The actions sit in the title row, not beside the whole block: they act
53
+ on what the title names, so their position must not move when the
54
+ description wraps to another line or is absent entirely. */
55
+ .title-row {
45
56
  display: flex;
46
57
  flex-wrap: wrap;
47
- align-items: flex-end;
58
+ align-items: center;
48
59
  justify-content: space-between;
49
60
  gap: 0.5rem;
50
61
  }
51
- .lead {
52
- min-width: 0;
53
- }
54
62
  .breadcrumb {
55
63
  margin-bottom: 0.25rem;
56
64
  font-size: var(--ui-font-size-sm, 0.75rem);
@@ -61,11 +69,20 @@ let PageHeader = class PageHeader extends LitElement {
61
69
  }
62
70
  .title {
63
71
  margin: 0;
72
+ min-width: 0;
64
73
  font-size: var(--ui-font-size-lg, 1rem);
65
74
  font-weight: var(--ui-font-weight-semibold, 600);
66
75
  line-height: var(--ui-line-height-tight, 1.25);
67
76
  color: var(--ui-text, #0f172a);
68
77
  }
78
+ .description {
79
+ margin: 0.25rem 0 0;
80
+ max-width: 48rem;
81
+ font-size: var(--ui-font-size, 0.875rem);
82
+ font-weight: var(--ui-font-weight-regular, 400);
83
+ line-height: var(--ui-line-height-normal, 1.5);
84
+ color: var(--ui-text-muted, #64748b);
85
+ }
69
86
  .actions {
70
87
  display: flex;
71
88
  align-items: center;
@@ -82,13 +99,14 @@ let PageHeader = class PageHeader extends LitElement {
82
99
  render() {
83
100
  return html `
84
101
  <div class="header">
85
- <div class="lead">
86
- <div class="breadcrumb ${this._hasBreadcrumb ? "" : "empty"}">
87
- <slot name="breadcrumb" @slotchange=${this._onBreadcrumbSlotChange}></slot>
88
- </div>
102
+ <div class="breadcrumb ${this._hasBreadcrumb ? "" : "empty"}">
103
+ <slot name="breadcrumb" @slotchange=${this._onBreadcrumbSlotChange}></slot>
104
+ </div>
105
+ <div class="title-row">
89
106
  ${this.heading ? html `<h2 class="title">${this.heading}</h2>` : nothing}
107
+ <div class="actions"><slot name="actions"></slot></div>
90
108
  </div>
91
- <div class="actions"><slot name="actions"></slot></div>
109
+ ${this.description ? html `<p class="description">${this.description}</p>` : nothing}
92
110
  </div>
93
111
  `;
94
112
  }
@@ -96,6 +114,9 @@ let PageHeader = class PageHeader extends LitElement {
96
114
  __decorate([
97
115
  property()
98
116
  ], PageHeader.prototype, "heading", void 0);
117
+ __decorate([
118
+ property()
119
+ ], PageHeader.prototype, "description", void 0);
99
120
  __decorate([
100
121
  state()
101
122
  ], PageHeader.prototype, "_hasBreadcrumb", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"page-header.js","sourceRoot":"","sources":["../src/page-header.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;GASG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACL,6BAA6B;QACjB,YAAO,GAAG,EAAE,CAAC;QAEzB,kEAAkE;QACjD,mBAAc,GAAG,KAAK,CAAC;IAuE1C,CAAC;aArEiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6CF;KACF,AAhDqB,CAgDpB;IAEF,yFAAyF;IACjF,uBAAuB,CAAC,KAAY;QAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,MAAyB,CAAC;QAC7C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACzE,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;;mCAGoB,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO;kDACnB,IAAI,CAAC,uBAAuB;;YAElE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA,qBAAqB,IAAI,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO;;;;KAI5E,CAAC;IACJ,CAAC;CACF,CAAA;AA1Ea;IAAX,QAAQ,EAAE;2CAAc;AAGR;IAAhB,KAAK,EAAE;kDAAgC;AAL7B,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA4EtB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * Page title block for the top of a dashboard view: an optional breadcrumb\n * trail, the page heading, and a right-aligned cluster of page-level actions.\n * It only lays these out — the breadcrumb links and action buttons are entirely\n * the consumer's, so it stays framework- and router-agnostic.\n *\n * @element page-header\n * @slot breadcrumb - Optional breadcrumb trail rendered above the heading.\n * @slot actions - Optional right-aligned page actions (e.g. a primary button).\n */\n@customElement(\"page-header\")\nexport class PageHeader extends LitElement {\n /** The page heading text. */\n @property() heading = \"\";\n\n /** Whether the breadcrumb slot currently has assigned content. */\n @state() private _hasBreadcrumb = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .header {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-end;\n justify-content: space-between;\n gap: 0.5rem;\n }\n .lead {\n min-width: 0;\n }\n .breadcrumb {\n margin-bottom: 0.25rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-text-muted, #64748b);\n }\n .breadcrumb.empty {\n display: none;\n }\n .title {\n margin: 0;\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .actions {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n flex: 0 0 auto;\n }\n `,\n ];\n\n /** Tracks whether the breadcrumb slot has content so its row can collapse when empty. */\n private _onBreadcrumbSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this._hasBreadcrumb = slot.assignedNodes({ flatten: true }).length > 0;\n }\n\n override render() {\n return html`\n <div class=\"header\">\n <div class=\"lead\">\n <div class=\"breadcrumb ${this._hasBreadcrumb ? \"\" : \"empty\"}\">\n <slot name=\"breadcrumb\" @slotchange=${this._onBreadcrumbSlotChange}></slot>\n </div>\n ${this.heading ? html`<h2 class=\"title\">${this.heading}</h2>` : nothing}\n </div>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"page-header\": PageHeader;\n }\n}\n"]}
1
+ {"version":3,"file":"page-header.js","sourceRoot":"","sources":["../src/page-header.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;GAYG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACL,6BAA6B;QACjB,YAAO,GAAG,EAAE,CAAC;QAEzB,iFAAiF;QACrE,gBAAW,GAAG,EAAE,CAAC;QAE7B,kEAAkE;QACjD,mBAAc,GAAG,KAAK,CAAC;IAoF1C,CAAC;aAlFiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyDF;KACF,AA5DqB,CA4DpB;IAEF,yFAAyF;IACjF,uBAAuB,CAAC,KAAY;QAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,MAAyB,CAAC;QAC7C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACzE,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;iCAEkB,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO;gDACnB,IAAI,CAAC,uBAAuB;;;YAGhE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA,qBAAqB,IAAI,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO;;;UAGvE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,0BAA0B,IAAI,CAAC,WAAW,MAAM,CAAC,CAAC,CAAC,OAAO;;KAEtF,CAAC;IACJ,CAAC;CACF,CAAA;AA1Fa;IAAX,QAAQ,EAAE;2CAAc;AAGb;IAAX,QAAQ,EAAE;+CAAkB;AAGZ;IAAhB,KAAK,EAAE;kDAAgC;AAR7B,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA4FtB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * Page title block for the top of a dashboard view: an optional breadcrumb\n * trail, the page heading with a right-aligned cluster of page-level actions\n * beside it, and an optional description of what the page is for underneath.\n * The actions sit in the title row rather than beside the whole block, so a\n * longer or wrapping description never moves them. It only lays these out —\n * the breadcrumb links and action buttons are entirely the consumer's, so it\n * stays framework- and router-agnostic.\n *\n * @element page-header\n * @slot breadcrumb - Optional breadcrumb trail rendered above the heading.\n * @slot actions - Optional right-aligned page actions (e.g. a primary button).\n */\n@customElement(\"page-header\")\nexport class PageHeader extends LitElement {\n /** The page heading text. */\n @property() heading = \"\";\n\n /** Optional supporting line under the heading, explaining what the page does. */\n @property() description = \"\";\n\n /** Whether the breadcrumb slot currently has assigned content. */\n @state() private _hasBreadcrumb = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .header {\n display: block;\n }\n /* The actions sit in the title row, not beside the whole block: they act\n on what the title names, so their position must not move when the\n description wraps to another line or is absent entirely. */\n .title-row {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n }\n .breadcrumb {\n margin-bottom: 0.25rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-text-muted, #64748b);\n }\n .breadcrumb.empty {\n display: none;\n }\n .title {\n margin: 0;\n min-width: 0;\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .description {\n margin: 0.25rem 0 0;\n max-width: 48rem;\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text-muted, #64748b);\n }\n .actions {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n flex: 0 0 auto;\n }\n `,\n ];\n\n /** Tracks whether the breadcrumb slot has content so its row can collapse when empty. */\n private _onBreadcrumbSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this._hasBreadcrumb = slot.assignedNodes({ flatten: true }).length > 0;\n }\n\n override render() {\n return html`\n <div class=\"header\">\n <div class=\"breadcrumb ${this._hasBreadcrumb ? \"\" : \"empty\"}\">\n <slot name=\"breadcrumb\" @slotchange=${this._onBreadcrumbSlotChange}></slot>\n </div>\n <div class=\"title-row\">\n ${this.heading ? html`<h2 class=\"title\">${this.heading}</h2>` : nothing}\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n ${this.description ? html`<p class=\"description\">${this.description}</p>` : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"page-header\": PageHeader;\n }\n}\n"]}
@@ -13,6 +13,13 @@ export interface PageChangeDetail {
13
13
  * Previous is disabled on the first page and next on the last; neither fires an
14
14
  * event when there is nowhere to go.
15
15
  *
16
+ * The prev/next buttons are treated as `ui-button`'s `secondary` variant:
17
+ * they read the same shared `--ui-button-secondary-*`/`--ui-button-highlight`
18
+ * tokens (and `--ui-button-secondary-surface-muted` for hover, since — like
19
+ * `button-group`'s unchecked segments — they already paint
20
+ * `--ui-surface-muted` on hover by default), so a gradient theme applies
21
+ * consistently here too.
22
+ *
16
23
  * @element pagination-nav
17
24
  * @fires page-change - The user picked a new page (`detail: { page }`).
18
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"pagination-nav.d.ts","sourceRoot":"","sources":["../src/pagination-nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,+FAA+F;AAC/F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;GAYG;AACH,qBACa,aAAc,SAAQ,UAAU;IAC3C,gCAAgC;IACuB,WAAW,SAAK;IACvE,6CAA6C;IACS,UAAU,SAAK;IAErE,OAAgB,MAAM,4BAiEpB;IAEF,uFAAuF;IACvF,OAAO,CAAC,GAAG;IAaF,MAAM,yCAsBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
1
+ {"version":3,"file":"pagination-nav.d.ts","sourceRoot":"","sources":["../src/pagination-nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,+FAA+F;AAC/F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,aAAc,SAAQ,UAAU;IAC3C,gCAAgC;IACuB,WAAW,SAAK;IACvE,6CAA6C;IACS,UAAU,SAAK;IAErE,OAAgB,MAAM,4BAyEpB;IAEF,uFAAuF;IACvF,OAAO,CAAC,GAAG;IAaF,MAAM,yCAsBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
@@ -18,6 +18,13 @@ import { tokens } from "./tokens.js";
18
18
  * Previous is disabled on the first page and next on the last; neither fires an
19
19
  * event when there is nowhere to go.
20
20
  *
21
+ * The prev/next buttons are treated as `ui-button`'s `secondary` variant:
22
+ * they read the same shared `--ui-button-secondary-*`/`--ui-button-highlight`
23
+ * tokens (and `--ui-button-secondary-surface-muted` for hover, since — like
24
+ * `button-group`'s unchecked segments — they already paint
25
+ * `--ui-surface-muted` on hover by default), so a gradient theme applies
26
+ * consistently here too.
27
+ *
21
28
  * @element pagination-nav
22
29
  * @fires page-change - The user picked a new page (`detail: { page }`).
23
30
  */
@@ -55,15 +62,20 @@ let PaginationNav = class PaginationNav extends LitElement {
55
62
  width: 2rem;
56
63
  height: 2rem;
57
64
  padding: 0;
58
- background: none;
59
- border: 1px solid var(--ui-border, #e2e8f0);
65
+ background: var(--ui-button-secondary-background, none);
66
+ border: 1px solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));
60
67
  border-radius: var(--ui-radius-sm, 0.25rem);
61
68
  color: var(--ui-text, #0f172a);
62
69
  cursor: pointer;
70
+ box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);
63
71
  }
64
72
  button:hover:not(:disabled) {
65
- background: var(--ui-surface-muted, #f8fafc);
66
- border-color: var(--ui-text-muted, #64748b);
73
+ background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));
74
+ border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));
75
+ }
76
+ button:active:not(:disabled) {
77
+ background: var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none));
78
+ box-shadow: none;
67
79
  }
68
80
  button:disabled {
69
81
  opacity: 0.5;
@@ -73,6 +85,9 @@ let PaginationNav = class PaginationNav extends LitElement {
73
85
  outline: none;
74
86
  box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));
75
87
  }
88
+ button:focus-visible:not(:active) {
89
+ box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);
90
+ }
76
91
  .status {
77
92
  font-size: var(--ui-font-size-sm, 0.75rem);
78
93
  font-weight: var(--ui-font-weight-medium, 500);
@@ -1 +1 @@
1
- {"version":3,"file":"pagination-nav.js","sourceRoot":"","sources":["../src/pagination-nav.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC;;;;;;;;;;;;GAYG;AAEI,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CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC;;UAElC,eAAe,CAAC,EAAE,CAAC;;qDAEwB,OAAO,OAAO,KAAK;;;;oBAIpD,OAAO,IAAI,KAAK;iBACnB,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC;;UAElC,gBAAgB,CAAC,EAAE,CAAC;;KAEzB,CAAC;IACJ,CAAC;CACF,CAAA;AA5GwD;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;kDAAiB;AAEjB;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;iDAAgB;AAJ1D,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CA8GzB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconChevronLeft, iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** Fired when the user requests a different page. `detail.page` is the 1-based target page. */\nexport interface PageChangeDetail {\n page: number;\n}\n\n/**\n * Minimal, controlled pager for list/table views: a previous/next control pair\n * around a \"Page N of M\" status. It owns no data — the consumer sets\n * `current-page` / `total-pages` and moves the page in response to the\n * `page-change` event (typically alongside its own data fetch), exactly like\n * `data-table` leaves the row data to the caller.\n *\n * Previous is disabled on the first page and next on the last; neither fires an\n * event when there is nowhere to go.\n *\n * @element pagination-nav\n * @fires page-change - The user picked a new page (`detail: { page }`).\n */\n@customElement(\"pagination-nav\")\nexport class PaginationNav extends LitElement {\n /** The 1-based current page. */\n @property({ type: Number, attribute: \"current-page\" }) currentPage = 1;\n /** The total number of pages (minimum 1). */\n @property({ type: Number, attribute: \"total-pages\" }) totalPages = 1;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: none;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n color: var(--ui-text, #0f172a);\n cursor: pointer;\n }\n button:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n border-color: var(--ui-text-muted, #64748b);\n }\n button:disabled {\n opacity: 0.5;\n cursor: default;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .status {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n min-width: 6rem;\n text-align: center;\n }\n @media (forced-colors: active) {\n button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button:disabled {\n color: GrayText;\n border-color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Clamps `page` to the valid range and fires `page-change` when it actually moves. */\n private _go(page: number): void {\n const total = Math.max(1, Math.floor(this.totalPages));\n const target = Math.min(total, Math.max(1, Math.floor(page)));\n if (target === this.currentPage) return;\n this.dispatchEvent(\n new CustomEvent<PageChangeDetail>(\"page-change\", {\n detail: { page: target },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n override render() {\n const total = Math.max(1, Math.floor(this.totalPages));\n const current = Math.min(total, Math.max(1, Math.floor(this.currentPage)));\n return html`\n <button\n type=\"button\"\n aria-label=\"Previous page\"\n ?disabled=${current <= 1}\n @click=${() => this._go(current - 1)}\n >\n ${iconChevronLeft(18)}\n </button>\n <span class=\"status\" aria-live=\"polite\">Page ${current} of ${total}</span>\n <button\n type=\"button\"\n aria-label=\"Next page\"\n ?disabled=${current >= total}\n @click=${() => this._go(current + 1)}\n >\n ${iconChevronRight(18)}\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pagination-nav\": PaginationNav;\n }\n}\n"]}
1
+ {"version":3,"file":"pagination-nav.js","sourceRoot":"","sources":["../src/pagination-nav.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACL,gCAAgC;QACuB,gBAAW,GAAG,CAAC,CAAC;QACvE,6CAA6C;QACS,eAAU,GAAG,CAAC,CAAC;IAkHvE,CAAC;aAhHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsEF;KACF,AAzEqB,CAyEpB;IAEF,uFAAuF;IAC/E,GAAG,CAAC,IAAY;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9D,IAAI,MAAM,KAAK,IAAI,CAAC,WAAW;YAAE,OAAO;QACxC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAmB,aAAa,EAAE;YAC/C,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;IACJ,CAAC;IAEQ,MAAM;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAA;;;;oBAIK,OAAO,IAAI,CAAC;iBACf,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC;;UAElC,eAAe,CAAC,EAAE,CAAC;;qDAEwB,OAAO,OAAO,KAAK;;;;oBAIpD,OAAO,IAAI,KAAK;iBACnB,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC;;UAElC,gBAAgB,CAAC,EAAE,CAAC;;KAEzB,CAAC;IACJ,CAAC;CACF,CAAA;AApHwD;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;kDAAiB;AAEjB;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;iDAAgB;AAJ1D,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAsHzB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconChevronLeft, iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** Fired when the user requests a different page. `detail.page` is the 1-based target page. */\nexport interface PageChangeDetail {\n page: number;\n}\n\n/**\n * Minimal, controlled pager for list/table views: a previous/next control pair\n * around a \"Page N of M\" status. It owns no data — the consumer sets\n * `current-page` / `total-pages` and moves the page in response to the\n * `page-change` event (typically alongside its own data fetch), exactly like\n * `data-table` leaves the row data to the caller.\n *\n * Previous is disabled on the first page and next on the last; neither fires an\n * event when there is nowhere to go.\n *\n * The prev/next buttons are treated as `ui-button`'s `secondary` variant:\n * they read the same shared `--ui-button-secondary-*`/`--ui-button-highlight`\n * tokens (and `--ui-button-secondary-surface-muted` for hover, since — like\n * `button-group`'s unchecked segments — they already paint\n * `--ui-surface-muted` on hover by default), so a gradient theme applies\n * consistently here too.\n *\n * @element pagination-nav\n * @fires page-change - The user picked a new page (`detail: { page }`).\n */\n@customElement(\"pagination-nav\")\nexport class PaginationNav extends LitElement {\n /** The 1-based current page. */\n @property({ type: Number, attribute: \"current-page\" }) currentPage = 1;\n /** The total number of pages (minimum 1). */\n @property({ type: Number, attribute: \"total-pages\" }) totalPages = 1;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: var(--ui-button-secondary-background, none);\n border: 1px solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n border-radius: var(--ui-radius-sm, 0.25rem);\n color: var(--ui-text, #0f172a);\n cursor: pointer;\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n button:hover:not(:disabled) {\n background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n button:active:not(:disabled) {\n background: var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none));\n box-shadow: none;\n }\n button:disabled {\n opacity: 0.5;\n cursor: default;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n button:focus-visible:not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .status {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n min-width: 6rem;\n text-align: center;\n }\n @media (forced-colors: active) {\n button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button:disabled {\n color: GrayText;\n border-color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Clamps `page` to the valid range and fires `page-change` when it actually moves. */\n private _go(page: number): void {\n const total = Math.max(1, Math.floor(this.totalPages));\n const target = Math.min(total, Math.max(1, Math.floor(page)));\n if (target === this.currentPage) return;\n this.dispatchEvent(\n new CustomEvent<PageChangeDetail>(\"page-change\", {\n detail: { page: target },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n override render() {\n const total = Math.max(1, Math.floor(this.totalPages));\n const current = Math.min(total, Math.max(1, Math.floor(this.currentPage)));\n return html`\n <button\n type=\"button\"\n aria-label=\"Previous page\"\n ?disabled=${current <= 1}\n @click=${() => this._go(current - 1)}\n >\n ${iconChevronLeft(18)}\n </button>\n <span class=\"status\" aria-live=\"polite\">Page ${current} of ${total}</span>\n <button\n type=\"button\"\n aria-label=\"Next page\"\n ?disabled=${current >= total}\n @click=${() => this._go(current + 1)}\n >\n ${iconChevronRight(18)}\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pagination-nav\": PaginationNav;\n }\n}\n"]}
@@ -11,6 +11,12 @@ export interface RadioCardOption {
11
11
  * a basemap style), use `radio-pills` instead. Wraps native radio inputs for
12
12
  * keyboard/a11y and fires `change` rather than relying on form submission.
13
13
  *
14
+ * The selected card's border/radio dot read `--ui-button-accent` (a solid
15
+ * stand-in, since `border-color`/`accent-color` can't render a gradient),
16
+ * and its background reads the shared `--ui-button-secondary-surface-muted`
17
+ * plus `--ui-button-highlight`, so a gradient theme tints it consistently
18
+ * with `button-group`/`pagination-nav`'s equivalents.
19
+ *
14
20
  * @element radio-cards
15
21
  * @fires change - A card was selected; detail: { value }.
16
22
  */
@@ -1 +1 @@
1
- {"version":3,"file":"radio-cards.d.ts","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAKrD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;;;;;;;GASG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BAkFpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAI9C,OAAO,CAAC,SAAS;IAMR,MAAM,yCAwBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"radio-cards.d.ts","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAKrD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;;;;;;;;;;;;;GAeG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BAsFpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAI9C,OAAO,CAAC,SAAS;IAMR,MAAM,yCAwBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -16,6 +16,12 @@ let instanceCount = 0;
16
16
  * a basemap style), use `radio-pills` instead. Wraps native radio inputs for
17
17
  * keyboard/a11y and fires `change` rather than relying on form submission.
18
18
  *
19
+ * The selected card's border/radio dot read `--ui-button-accent` (a solid
20
+ * stand-in, since `border-color`/`accent-color` can't render a gradient),
21
+ * and its background reads the shared `--ui-button-secondary-surface-muted`
22
+ * plus `--ui-button-highlight`, so a gradient theme tints it consistently
23
+ * with `button-group`/`pagination-nav`'s equivalents.
24
+ *
19
25
  * @element radio-cards
20
26
  * @fires change - A card was selected; detail: { value }.
21
27
  */
@@ -63,14 +69,15 @@ let RadioCards = class RadioCards extends LitElement {
63
69
  font-size: var(--ui-font-size-sm, 0.75rem);
64
70
  }
65
71
  .card:has(input:checked) {
66
- border-color: var(--ui-primary, #4f46e5);
67
- background: var(--ui-surface-muted, #f8fafc);
72
+ border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));
73
+ background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));
74
+ box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);
68
75
  }
69
76
  .card input {
70
77
  width: 1rem;
71
78
  height: 1rem;
72
79
  margin-top: 0.25rem;
73
- accent-color: var(--ui-primary, #4f46e5);
80
+ accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));
74
81
  cursor: pointer;
75
82
  }
76
83
  .card-label {
@@ -86,6 +93,9 @@ let RadioCards = class RadioCards extends LitElement {
86
93
  outline: none;
87
94
  box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));
88
95
  }
96
+ .card:has(input:checked):has(input:focus-visible) {
97
+ box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);
98
+ }
89
99
  .card:has(input:disabled) {
90
100
  cursor: not-allowed;
91
101
  opacity: 0.6;
@@ -1 +1 @@
1
- {"version":3,"file":"radio-cards.js","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;GASG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAqFL,wCAAwC;QACR,YAAO,GAAsB,EAAE,CAAC;QAChE,gCAAgC;QACpB,UAAK,GAAG,EAAE,CAAC;QACvB,gDAAgD;QACnB,aAAQ,GAAG,KAAK,CAAC;QAErC,UAAK,GAAG,eAAe,EAAE,aAAa,EAAE,CAAC;IAiCpD,CAAC;aA5HiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+EF;KACF,AAlFqB,CAkFpB;IASO,KAAK,CAAoC;IAE1C,SAAS,CAAC,KAAa;QAC7B,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtG,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;UAEL,MAAM,CACN,IAAI,CAAC,OAAO,EACZ,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,EAClB,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAA;;;;uBAIA,IAAI,CAAC,KAAK;2BACN,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK;4BACvB,IAAI,CAAC,QAAQ;0BACf,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;;;2CAGd,GAAG,CAAC,KAAK;kBAClC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,kCAAkC,GAAG,CAAC,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO;;;WAGjG,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAvCiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAAiC;AAEpD;IAAX,QAAQ,EAAE;yCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AA1FnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA6HtB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioCardOption {\n value: string;\n label: string;\n description?: string;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of full-width cards, each with a label and optional\n * description — for a handful of meaningfully different choices where the\n * description matters. For many short, same-shaped options (a color swatch,\n * a basemap style), use `radio-pills` instead. Wraps native radio inputs for\n * keyboard/a11y and fires `change` rather than relying on form submission.\n *\n * @element radio-cards\n * @fires change - A card was selected; detail: { value }.\n */\n@customElement(\"radio-cards\")\nexport class RadioCards extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n gap: 0.5rem;\n flex-wrap: wrap;\n }\n .card {\n flex: 1 1 11.25rem;\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .card:has(input:checked) {\n border-color: var(--ui-primary, #4f46e5);\n background: var(--ui-surface-muted, #f8fafc);\n }\n .card input {\n width: 1rem;\n height: 1rem;\n margin-top: 0.25rem;\n accent-color: var(--ui-primary, #4f46e5);\n cursor: pointer;\n }\n .card-label {\n font-weight: var(--ui-font-weight-semibold, 600);\n color: var(--ui-text, #0f172a);\n }\n .card-description {\n display: block;\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-regular, 400);\n }\n .card:has(input:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .card:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .card:has(input:disabled) input {\n cursor: not-allowed;\n }\n @media (forced-colors: active) {\n .card:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .card:has(input:checked) {\n border-color: Highlight;\n }\n .card:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n .card:has(input:disabled) .card-label,\n .card:has(input:disabled) .card-description {\n color: GrayText;\n }\n }\n `,\n ];\n\n /** Options to render, one card each. */\n @property({ attribute: false }) options: RadioCardOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n\n readonly #name = `radio-cards-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <div class=\"options\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"card\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>\n <span class=\"card-label\">${opt.label}</span>\n ${opt.description ? html`<span class=\"card-description\">${opt.description}</span>` : nothing}\n </span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-cards\": RadioCards;\n }\n}\n"]}
1
+ {"version":3,"file":"radio-cards.js","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAyFL,wCAAwC;QACR,YAAO,GAAsB,EAAE,CAAC;QAChE,gCAAgC;QACpB,UAAK,GAAG,EAAE,CAAC;QACvB,gDA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CAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AA9FnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAiItB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioCardOption {\n value: string;\n label: string;\n description?: string;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of full-width cards, each with a label and optional\n * description — for a handful of meaningfully different choices where the\n * description matters. For many short, same-shaped options (a color swatch,\n * a basemap style), use `radio-pills` instead. Wraps native radio inputs for\n * keyboard/a11y and fires `change` rather than relying on form submission.\n *\n * The selected card's border/radio dot read `--ui-button-accent` (a solid\n * stand-in, since `border-color`/`accent-color` can't render a gradient),\n * and its background reads the shared `--ui-button-secondary-surface-muted`\n * plus `--ui-button-highlight`, so a gradient theme tints it consistently\n * with `button-group`/`pagination-nav`'s equivalents.\n *\n * @element radio-cards\n * @fires change - A card was selected; detail: { value }.\n */\n@customElement(\"radio-cards\")\nexport class RadioCards extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n gap: 0.5rem;\n flex-wrap: wrap;\n }\n .card {\n flex: 1 1 11.25rem;\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .card:has(input:checked) {\n border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .card input {\n width: 1rem;\n height: 1rem;\n margin-top: 0.25rem;\n accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n cursor: pointer;\n }\n .card-label {\n font-weight: var(--ui-font-weight-semibold, 600);\n color: var(--ui-text, #0f172a);\n }\n .card-description {\n display: block;\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-regular, 400);\n }\n .card:has(input:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .card:has(input:checked):has(input:focus-visible) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .card:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .card:has(input:disabled) input {\n cursor: not-allowed;\n }\n @media (forced-colors: active) {\n .card:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .card:has(input:checked) {\n border-color: Highlight;\n }\n .card:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n .card:has(input:disabled) .card-label,\n .card:has(input:disabled) .card-description {\n color: GrayText;\n }\n }\n `,\n ];\n\n /** Options to render, one card each. */\n @property({ attribute: false }) options: RadioCardOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n\n readonly #name = `radio-cards-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <div class=\"options\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"card\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>\n <span class=\"card-label\">${opt.label}</span>\n ${opt.description ? html`<span class=\"card-description\">${opt.description}</span>` : nothing}\n </span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-cards\": RadioCards;\n }\n}\n"]}
@@ -10,6 +10,12 @@ export interface RadioPillOption {
10
10
  * native radio inputs for keyboard/a11y and fires `change` rather than
11
11
  * relying on form submission.
12
12
  *
13
+ * The selected pill's border/radio dot read `--ui-button-accent` (a solid
14
+ * stand-in, since `border-color`/`accent-color` can't render a gradient),
15
+ * and its background reads the shared `--ui-button-secondary-surface-muted`
16
+ * plus `--ui-button-highlight`, so a gradient theme tints it consistently
17
+ * with `button-group`/`pagination-nav`'s equivalents.
18
+ *
13
19
  * @element radio-pills
14
20
  * @fires change - A pill was selected; detail: { value }.
15
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"radio-pills.d.ts","sourceRoot":"","sources":["../src/radio-pills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;;;;;;;;GASG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BAwEpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAI9C,OAAO,CAAC,SAAS;IAMR,MAAM,yCAqBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"radio-pills.d.ts","sourceRoot":"","sources":["../src/radio-pills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;;;;;;;;;;;;;;GAeG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BA4EpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAI9C,OAAO,CAAC,SAAS;IAMR,MAAM,yCAqBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -16,6 +16,12 @@ let instanceCount = 0;
16
16
  * native radio inputs for keyboard/a11y and fires `change` rather than
17
17
  * relying on form submission.
18
18
  *
19
+ * The selected pill's border/radio dot read `--ui-button-accent` (a solid
20
+ * stand-in, since `border-color`/`accent-color` can't render a gradient),
21
+ * and its background reads the shared `--ui-button-secondary-surface-muted`
22
+ * plus `--ui-button-highlight`, so a gradient theme tints it consistently
23
+ * with `button-group`/`pagination-nav`'s equivalents.
24
+ *
19
25
  * @element radio-pills
20
26
  * @fires change - A pill was selected; detail: { value }.
21
27
  */
@@ -66,13 +72,14 @@ let RadioPills = class RadioPills extends LitElement {
66
72
  color: var(--ui-text, #0f172a);
67
73
  }
68
74
  .pill:has(input:checked) {
69
- border-color: var(--ui-primary, #4f46e5);
70
- background: var(--ui-surface-muted, #f8fafc);
75
+ border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));
76
+ background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));
77
+ box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);
71
78
  }
72
79
  .pill input {
73
80
  width: 1rem;
74
81
  height: 1rem;
75
- accent-color: var(--ui-primary, #4f46e5);
82
+ accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));
76
83
  cursor: pointer;
77
84
  margin: 0;
78
85
  }
@@ -80,6 +87,9 @@ let RadioPills = class RadioPills extends LitElement {
80
87
  outline: none;
81
88
  box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));
82
89
  }
90
+ .pill:has(input:checked):has(input:focus-visible) {
91
+ box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);
92
+ }
83
93
  .pill:has(input:disabled) {
84
94
  cursor: not-allowed;
85
95
  opacity: 0.6;
@@ -1 +1 @@
1
- {"version":3,"file":"radio-pills.js","sourceRoot":"","sources":["../src/radio-pills.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;GASG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QA2EL,wCAAwC;QACR,YAAO,GAAsB,EAAE,CAAC;QAChE,gCAAgC;QACpB,UAAK,GAAG,EAAE,CAAC;QACvB,gDAAgD;QACnB,aAAQ,GAAG,KAAK,CAAC;QAErC,UAAK,GAAG,eAAe,EAAE,aAAa,EAAE,CAAC;IA8BpD,CAAC;aA/GiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqEF;KACF,AAxEqB,CAwEpB;IASO,KAAK,CAAoC;IAE1C,SAAS,CAAC,KAAa;QAC7B,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtG,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;UAEL,MAAM,CACN,IAAI,CAAC,OAAO,EACZ,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,EAClB,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAA;;;;uBAIA,IAAI,CAAC,KAAK;2BACN,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK;4BACvB,IAAI,CAAC,QAAQ;0BACf,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;;sBAEnC,GAAG,CAAC,KAAK;;WAEpB,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AApCiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAAiC;AAEpD;IAAX,QAAQ,EAAE;yCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AAhFnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAgHtB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioPillOption {\n value: string;\n label: string;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of compact pill-shaped options — for many short,\n * same-shaped choices (a basemap style, a unit toggle). For a handful of\n * choices where a description matters, use `radio-cards` instead. Wraps\n * native radio inputs for keyboard/a11y and fires `change` rather than\n * relying on form submission.\n *\n * @element radio-pills\n * @fires change - A pill was selected; detail: { value }.\n */\n@customElement(\"radio-pills\")\nexport class RadioPills extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n }\n .pill {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: 2rem;\n box-sizing: border-box;\n padding: 0.25rem 0.5rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: 999px;\n cursor: pointer;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .pill:has(input:checked) {\n border-color: var(--ui-primary, #4f46e5);\n background: var(--ui-surface-muted, #f8fafc);\n }\n .pill input {\n width: 1rem;\n height: 1rem;\n accent-color: var(--ui-primary, #4f46e5);\n cursor: pointer;\n margin: 0;\n }\n .pill:has(input:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .pill:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .pill:has(input:disabled) input {\n cursor: not-allowed;\n }\n @media (forced-colors: active) {\n .pill:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .pill:has(input:checked) {\n border-color: Highlight;\n }\n .pill:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Options to render, one pill each. */\n @property({ attribute: false }) options: RadioPillOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n\n readonly #name = `radio-pills-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <div class=\"options\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"pill\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>${opt.label}</span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-pills\": RadioPills;\n }\n}\n"]}
1
+ {"version":3,"file":"radio-pills.js","sourceRoot":"","sources":["../src/radio-pills.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QA+EL,wCAAwC;QACR,YAAO,GAAsB,EAAE,CAAC;QAChE,gCAAgC;QACpB,UAAK,GAAG,EAAE,CAAC;QACvB,gDAAgD;QACnB,aAAQ,GAAG,KAAK,CAAC;QAErC,UAAK,GAAG,eAAe,EAAE,aAAa,EAAE,CAAC;IA8BpD,CAAC;aAnHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyEF;KACF,AA5EqB,CA4EpB;IASO,KAAK,CAAoC;IAE1C,SAAS,CAAC,KAAa;QAC7B,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtG,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;UAEL,MAAM,CACN,IAAI,CAAC,OAAO,EACZ,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,EAClB,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAA;;;;uBAIA,IAAI,CAAC,KAAK;2BACN,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK;4BACvB,IAAI,CAAC,QAAQ;0BACf,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;;sBAEnC,GAAG,CAAC,KAAK;;WAEpB,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AApCiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAAiC;AAEpD;IAAX,QAAQ,EAAE;yCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AApFnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAoHtB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioPillOption {\n value: string;\n label: string;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of compact pill-shaped options — for many short,\n * same-shaped choices (a basemap style, a unit toggle). For a handful of\n * choices where a description matters, use `radio-cards` instead. Wraps\n * native radio inputs for keyboard/a11y and fires `change` rather than\n * relying on form submission.\n *\n * The selected pill's border/radio dot read `--ui-button-accent` (a solid\n * stand-in, since `border-color`/`accent-color` can't render a gradient),\n * and its background reads the shared `--ui-button-secondary-surface-muted`\n * plus `--ui-button-highlight`, so a gradient theme tints it consistently\n * with `button-group`/`pagination-nav`'s equivalents.\n *\n * @element radio-pills\n * @fires change - A pill was selected; detail: { value }.\n */\n@customElement(\"radio-pills\")\nexport class RadioPills extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n }\n .pill {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: 2rem;\n box-sizing: border-box;\n padding: 0.25rem 0.5rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: 999px;\n cursor: pointer;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .pill:has(input:checked) {\n border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .pill input {\n width: 1rem;\n height: 1rem;\n accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n cursor: pointer;\n margin: 0;\n }\n .pill:has(input:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .pill:has(input:checked):has(input:focus-visible) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .pill:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .pill:has(input:disabled) input {\n cursor: not-allowed;\n }\n @media (forced-colors: active) {\n .pill:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .pill:has(input:checked) {\n border-color: Highlight;\n }\n .pill:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Options to render, one pill each. */\n @property({ attribute: false }) options: RadioPillOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n\n readonly #name = `radio-pills-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <div class=\"options\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"pill\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>${opt.label}</span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-pills\": RadioPills;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"range-slider.d.ts","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIjE;;;;;;;;;;;;;;GAcG;AACH,qBACa,WAAY,SAAQ,UAAU;;IACzC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAgB,MAAM,4BAuGpB;IAEF,qBAAqB;IACO,GAAG,SAAK;IACpC,qBAAqB;IACO,GAAG,SAAO;IACtC,sBAAsB;IACM,IAAI,SAAK;IACrC,qBAAqB;IACO,KAAK,SAAK;IACtC,2EAA2E;IAC9C,QAAQ,UAAS;IAC9C,uBAAuB;IACX,IAAI,SAAM;IAEb,OAAO,CAAC,aAAa,CAAS;IAevC,UAAm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UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
@@ -65,10 +65,14 @@ let RangeSlider = class RangeSlider extends LitElement {
65
65
  input[type="range"]::-webkit-slider-runnable-track {
66
66
  height: 0.375rem;
67
67
  border-radius: 9999px;
68
+ /* A hard-stop background gradient used as a two-tone fill trick —
69
+ its color-stops can't themselves hold a gradient value, so this
70
+ reads --ui-button-accent (a solid stand-in), not
71
+ --ui-button-background directly. */
68
72
  background: linear-gradient(
69
73
  to right,
70
- var(--ui-primary, #4f46e5) 0%,
71
- var(--ui-primary, #4f46e5) var(--range-percent, 0%),
74
+ var(--ui-button-accent, var(--ui-primary, #4f46e5)) 0%,
75
+ var(--ui-button-accent, var(--ui-primary, #4f46e5)) var(--range-percent, 0%),
72
76
  var(--ui-surface-muted, #f8fafc) var(--range-percent, 0%),
73
77
  var(--ui-surface-muted, #f8fafc) 100%
74
78
  );
@@ -81,7 +85,7 @@ let RangeSlider = class RangeSlider extends LitElement {
81
85
  input[type="range"]::-moz-range-progress {
82
86
  height: 0.375rem;
83
87
  border-radius: 9999px;
84
- background: var(--ui-primary, #4f46e5);
88
+ background: var(--ui-button-accent, var(--ui-primary, #4f46e5));
85
89
  }
86
90
  /* Thumb */
87
91
  input[type="range"]::-webkit-slider-thumb {
@@ -94,17 +98,17 @@ let RangeSlider = class RangeSlider extends LitElement {
94
98
  A transform offset (not margin) so it isn't a spacing-grid value. */
95
99
  transform: translateY(-0.3125rem);
96
100
  border-radius: 50%;
97
- background: var(--ui-primary, #4f46e5);
101
+ background: var(--ui-button-background, var(--ui-primary, #4f46e5));
98
102
  border: 2px solid var(--ui-surface, #ffffff);
99
- box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
103
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);
100
104
  }
101
105
  input[type="range"]::-moz-range-thumb {
102
106
  width: 1rem;
103
107
  height: 1rem;
104
108
  border-radius: 50%;
105
- background: var(--ui-primary, #4f46e5);
109
+ background: var(--ui-button-background, var(--ui-primary, #4f46e5));
106
110
  border: 2px solid var(--ui-surface, #ffffff);
107
- box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
111
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);
108
112
  }
109
113
  input[type="range"]:disabled::-webkit-slider-thumb {
110
114
  background: var(--ui-text-muted, #64748b);