{"_id":"@cool-ai/beach-a2ui-patterns","_rev":"4-eaf304c26fea53076b1f7c3e3ae7646e","name":"@cool-ai/beach-a2ui-patterns","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@cool-ai/beach-a2ui-patterns","version":"0.1.0","license":"Apache-2.0","_id":"@cool-ai/beach-a2ui-patterns@0.1.0","maintainers":[{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"}],"homepage":"https://cool-ai.org","bugs":{"url":"https://gitlab.com/johncandrew/beach/-/issues"},"dist":{"shasum":"6ff078c765cadcf83885cbcf885208a84a20f903","tarball":"https://registry.npmjs.org/@cool-ai/beach-a2ui-patterns/-/beach-a2ui-patterns-0.1.0.tgz","fileCount":23,"integrity":"sha512-m48chUUdHep/1RUCH6pkpyK+lXXqdr59ZfPN7QFfcFH+dDJLXIRjmXnJXmkjwRP0w+mtzNgRCsPZOLxkfsqSzQ==","signatures":[{"sig":"MEQCIArS7P1NLwe1M3XaSFQT+/3VUhzHf8rF4jcxVHfj7Uu6AiB113lC4ZudPS3taHzDARPLSQqLskfGchYpIFKnpV7lrQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31951},"type":"module","_from":"file:cool-ai-beach-a2ui-patterns-0.1.0.tgz","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --project tsconfig.json --watch","test":"vitest run","build":"tsc --project tsconfig.json","coverage":"vitest run --coverage","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"},"_resolved":"/tmp/8c4378805115de2fd36985f3bd5a4d3b/cool-ai-beach-a2ui-patterns-0.1.0.tgz","_integrity":"sha512-m48chUUdHep/1RUCH6pkpyK+lXXqdr59ZfPN7QFfcFH+dDJLXIRjmXnJXmkjwRP0w+mtzNgRCsPZOLxkfsqSzQ==","repository":{"url":"git+https://gitlab.com/johncandrew/beach.git","type":"git","directory":"packages/a2ui-patterns"},"_npmVersion":"10.9.7","description":"Curated surface-composition helpers for Beach A2UI — productCard, narrativePanel, searchResultList, and more. Returns SurfaceCommand[] against the A2UI v0.9 basic catalog.","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","typescript":"^5.5.0","@cool-ai/beach-a2ui":"^0.5.0","@cool-ai/beach-a2ui-test":"^0.1.0"},"peerDependencies":{"@cool-ai/beach-a2ui":"^0.5.0"},"_npmOperationalInternal":{"tmp":"tmp/beach-a2ui-patterns_0.1.0_1778509726629_0.14829888386507362","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@cool-ai/beach-a2ui-patterns","version":"0.1.1","license":"Apache-2.0","_id":"@cool-ai/beach-a2ui-patterns@0.1.1","maintainers":[{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"}],"homepage":"https://cool-ai.org","bugs":{"url":"https://gitlab.com/johncandrew/beach/-/issues"},"dist":{"shasum":"07c63a42762425d1716c771fd1e536cda33c27c7","tarball":"https://registry.npmjs.org/@cool-ai/beach-a2ui-patterns/-/beach-a2ui-patterns-0.1.1.tgz","fileCount":23,"integrity":"sha512-A7stpKYYP69pMJ1aKVsJtF8i/BbE2BmwxM8Q405kvJPChyulLRrB2Z8Snx0rsU2wMmYdBEvFw8xFUv8SQMD3HA==","signatures":[{"sig":"MEYCIQD9w+X0P4lBSKuxQjtE/7Im9GTPzITneY9gKxeaXFVrCAIhAI/XeDXi4UUGo1SjxBuBWlPhMotCx4tbbTFZgmRx4ZAT","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33871},"type":"module","_from":"file:cool-ai-beach-a2ui-patterns-0.1.1.tgz","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --project tsconfig.json --watch","test":"vitest run","build":"tsc --project tsconfig.json","coverage":"vitest run --coverage","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"},"_resolved":"/tmp/904b5723ba1c40c4f668bf365b12b242/cool-ai-beach-a2ui-patterns-0.1.1.tgz","_integrity":"sha512-A7stpKYYP69pMJ1aKVsJtF8i/BbE2BmwxM8Q405kvJPChyulLRrB2Z8Snx0rsU2wMmYdBEvFw8xFUv8SQMD3HA==","repository":{"url":"git+https://gitlab.com/johncandrew/beach.git","type":"git","directory":"packages/a2ui-patterns"},"_npmVersion":"10.9.7","description":"Curated surface-composition helpers for Beach A2UI — productCard, narrativePanel, searchResultList, and more. Returns SurfaceCommand[] against the A2UI v0.9 basic catalog.","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","typescript":"^5.5.0","@cool-ai/beach-a2ui":"^0.5.0","@cool-ai/beach-a2ui-test":"^0.1.0"},"peerDependencies":{"@cool-ai/beach-a2ui":"^0.5.0"},"_npmOperationalInternal":{"tmp":"tmp/beach-a2ui-patterns_0.1.1_1778778759060_0.6648623323853906","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@cool-ai/beach-a2ui-patterns","version":"0.1.2","license":"Apache-2.0","_id":"@cool-ai/beach-a2ui-patterns@0.1.2","maintainers":[{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"}],"homepage":"https://cool-ai.org","bugs":{"url":"https://gitlab.com/johncandrew/beach/-/issues"},"dist":{"shasum":"061cffaf56b0433722316183dd76f9132ed01834","tarball":"https://registry.npmjs.org/@cool-ai/beach-a2ui-patterns/-/beach-a2ui-patterns-0.1.2.tgz","fileCount":23,"integrity":"sha512-jtolqAR5RzkpCV5Y+b5rTZ1tb/PHIPGBD/Xq4FhV0gp1xIbGU9wRsV/i9F5yvz9wsXHf9OB7irw+PGV3/jHcBw==","signatures":[{"sig":"MEUCIFL3UtgJppMkEVXxOdrJ/tuXNl1H88S1aJS5ETJGtr/GAiEA232xVdWbxqNM5UuBoOXvbAwX1gsKbp4SuJGfltNE158=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37404},"type":"module","_from":"file:cool-ai-beach-a2ui-patterns-0.1.2.tgz","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --project tsconfig.json --watch","test":"vitest run","build":"tsc --project tsconfig.json","coverage":"vitest run --coverage","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"},"_resolved":"/tmp/f4d6d4c1d4ee309a30dd8bc6f93e9fc9/cool-ai-beach-a2ui-patterns-0.1.2.tgz","_integrity":"sha512-jtolqAR5RzkpCV5Y+b5rTZ1tb/PHIPGBD/Xq4FhV0gp1xIbGU9wRsV/i9F5yvz9wsXHf9OB7irw+PGV3/jHcBw==","repository":{"url":"git+https://gitlab.com/johncandrew/beach.git","type":"git","directory":"packages/a2ui-patterns"},"_npmVersion":"10.9.8","description":"Curated surface-composition helpers for Beach A2UI — productCard, narrativePanel, searchResultList, and more. Returns SurfaceCommand[] against the A2UI v0.9 basic catalog.","directories":{},"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","typescript":"^5.5.0","@cool-ai/beach-a2ui":"^0.5.2","@cool-ai/beach-a2ui-test":"^0.1.0"},"peerDependencies":{"@cool-ai/beach-a2ui":"^0.5.2"},"_npmOperationalInternal":{"tmp":"tmp/beach-a2ui-patterns_0.1.2_1778951557821_0.581673660262839","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@cool-ai/beach-a2ui-patterns","version":"0.1.3","description":"Curated surface-composition helpers for Beach A2UI — productCard, narrativePanel, searchResultList, and more. Returns SurfaceCommand[] against the A2UI v0.9 basic catalog.","license":"Apache-2.0","repository":{"type":"git","url":"git+https://gitlab.com/johncandrew/beach.git","directory":"packages/a2ui-patterns"},"homepage":"https://cool-ai.org","bugs":{"url":"https://gitlab.com/johncandrew/beach/-/issues"},"type":"module","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"publishConfig":{"access":"public"},"peerDependencies":{"@cool-ai/beach-a2ui-renderer-lit":"^0.5.5"},"devDependencies":{"typescript":"^5.5.0","vitest":"^2.0.0","@cool-ai/beach-a2ui-renderer-lit":"^0.5.5","@cool-ai/beach-a2ui-test":"^0.1.0"},"scripts":{"build":"tsc --project tsconfig.json","dev":"tsc --project tsconfig.json --watch","test":"vitest run","coverage":"vitest run --coverage","test:watch":"vitest","typecheck":"tsc --noEmit"},"_id":"@cool-ai/beach-a2ui-patterns@0.1.3","_integrity":"sha512-dPlo0IXEhncRMVPH54cXQ6+zXEj+PnNcp1N7kbQJ7dZu0kwsnmDczUc9hr7WeL98XZ8EYAcWRs7pCf0NwWiWaw==","_resolved":"/tmp/f2b2687433d22a03155f1c5e37327600/cool-ai-beach-a2ui-patterns-0.1.3.tgz","_from":"file:cool-ai-beach-a2ui-patterns-0.1.3.tgz","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-dPlo0IXEhncRMVPH54cXQ6+zXEj+PnNcp1N7kbQJ7dZu0kwsnmDczUc9hr7WeL98XZ8EYAcWRs7pCf0NwWiWaw==","shasum":"2ad07acd6d8fef2c11a234b00bbf042dac37f0f4","tarball":"https://registry.npmjs.org/@cool-ai/beach-a2ui-patterns/-/beach-a2ui-patterns-0.1.3.tgz","fileCount":23,"unpackedSize":37469,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC+Wh4UzhfWXJ8OubzcUrpUOuJ8jYZrS++CTXqeplVZsgIhAIpOknasG5twV3X67SqztvhAkrupzfX6s4Jd7hlPbUAL"}]},"_npmUser":{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"},"directories":{},"maintainers":[{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/beach-a2ui-patterns_0.1.3_1780677375595_0.19672114873737745"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-11T14:28:46.556Z","modified":"2026-06-05T16:36:15.843Z","0.1.0":"2026-05-11T14:28:46.789Z","0.1.1":"2026-05-14T17:12:39.235Z","0.1.2":"2026-05-16T17:12:37.971Z","0.1.3":"2026-06-05T16:36:15.720Z"},"bugs":{"url":"https://gitlab.com/johncandrew/beach/-/issues"},"license":"Apache-2.0","homepage":"https://cool-ai.org","repository":{"type":"git","url":"git+https://gitlab.com/johncandrew/beach.git","directory":"packages/a2ui-patterns"},"description":"Curated surface-composition helpers for Beach A2UI — productCard, narrativePanel, searchResultList, and more. Returns SurfaceCommand[] against the A2UI v0.9 basic catalog.","maintainers":[{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"}],"readme":"# @cool-ai/beach-a2ui-patterns\n\nPre-built A2UI surface patterns for Beach agents. Each pattern returns a `SurfaceCommand[]` ready to send via `context.routeEvent` — no manual `createSurface`/`updateComponents` wiring needed.\n\n> **Home:** [cool-ai.org](https://cool-ai.org) · **Documentation:** [cool-ai.org/docs](https://cool-ai.org/docs)\n\n## Install\n\n```sh\nnpm install @cool-ai/beach-a2ui-patterns @cool-ai/beach-a2ui\n```\n\n`@cool-ai/beach-a2ui` is a peer dependency.\n\n## Patterns\n\n### `productCard`\n\nA titled card with labelled line items and a bold total row, separated by a divider. Renders identically via A2UI browser renderer, `renderToHtml` (email), and `renderToText` (WhatsApp / SMS).\n\n```typescript\nimport { productCard } from '@cool-ai/beach-a2ui-patterns';\n\nconst cmds = productCard({\n  surfaceId: 'order-123',\n  title: 'Your Order',\n  items: [\n    { label: 'Flight LHR-FCO', amount: '£299' },\n    { label: 'Hotel Centro',   amount: '$1,200' },\n  ],\n  total: { label: 'Total', amount: '£1,499' },\n});\n```\n\n| Option | Type | Description |\n|---|---|---|\n| `surfaceId` | `string` | Unique surface id. |\n| `title` | `string` | Card heading. |\n| `items` | `ProductCardLine[]` | Line items shown above the divider. |\n| `total` | `ProductCardLine` | Total row shown below the divider in bold. |\n\n`ProductCardLine` has `label: string` and `amount: string`.\n\n---\n\n### `narrativePanel`\n\nA heading plus prose body. The simplest pattern: one card, one heading, one paragraph. Channel-neutral.\n\n```typescript\nimport { narrativePanel } from '@cool-ai/beach-a2ui-patterns';\n\nconst cmds = narrativePanel({\n  surfaceId: 'summary-panel',\n  heading: 'Your trip summary',\n  body: 'Your Paris flights are confirmed. Check in opens 24 hours before departure.',\n  level: 2, // optional, defaults to 2\n});\n```\n\n| Option | Type | Description |\n|---|---|---|\n| `surfaceId` | `string` | Unique surface id. |\n| `heading` | `string` | Panel heading. |\n| `body` | `string` | Prose body text. |\n| `level` | `1 \\| 2 \\| 3 \\| 4` | Heading level. Defaults to `2`. |\n\n---\n\n### `searchResultList`\n\nA ranked list of results. Each result renders as a card with a heading-styled title, optional caption-styled subtitle, and an optional star-rating Text (★/☆ characters). An empty-state Text is shown when the results array is empty.\n\n```typescript\nimport { searchResultList } from '@cool-ai/beach-a2ui-patterns';\n\nconst cmds = searchResultList({\n  surfaceId: 'hotel-results',\n  results: [\n    { id: 'hotel-1', title: 'Hotel Centro', subtitle: 'Florence, IT', score: 4.5 },\n    { id: 'hotel-2', title: 'Pensione Canova', subtitle: 'Florence, IT' },\n  ],\n  emptyText: 'No hotels found for your dates.', // optional\n});\n```\n\n| Option | Type | Description |\n|---|---|---|\n| `surfaceId` | `string` | Unique surface id. |\n| `results` | `SearchResult[]` | Ordered results. |\n| `emptyText` | `string` | Empty-state text. Defaults to `\"No results found.\"` |\n\n`SearchResult` fields:\n\n| Field | Type | Description |\n|---|---|---|\n| `id` | `string` | Stable per-result key. Used as the component-id segment for the result's card and its descendants (e.g. `${surfaceId}/result/${id}`), so ids stay stable across re-renders even if the list reorders. |\n| `title` | `string` | Primary title. |\n| `subtitle` | `string?` | Optional secondary line, rendered as a caption-variant Text. |\n| `score` | `number?` | Optional numeric score (0–5). A2UI v0.9's basic catalog has no `Rating` component, so the score is rendered as a caption-variant Text containing `★`/`☆` characters rounded to the nearest integer. |\n\n---\n\n## Testing patterns\n\nUse [`@cool-ai/beach-a2ui-test`](../a2ui-test/README.md) to assert on pattern output without reaching into raw message JSON:\n\n```typescript\nimport { surfaceOf } from '@cool-ai/beach-a2ui-test';\nimport { productCard } from '@cool-ai/beach-a2ui-patterns';\n\nconst s = surfaceOf(productCard({ ... }));\n\nexpect(s.find('Card')).toMatchObject({ title: 'Your Order' });\nexpect(s.findAll('Row')).toHaveLength(3); // 2 items + 1 total\nexpect(s.find('Divider')).toBeDefined();\n```\n\n## Constants\n\n```typescript\nimport { A2UI_BASIC_CATALOG_ID } from '@cool-ai/beach-a2ui-patterns';\n// 'https://a2ui.org/specification/v0_9/basic_catalog.json'\n```\n\nAll patterns use the A2UI v0.9 basic catalog. Pass `A2UI_BASIC_CATALOG_ID` whenever you need the catalog id string directly.\n","readmeFilename":"README.md"}