ember-marquetry 0.0.0-stage → 2.0.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 (77) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE.md +21 -0
  3. package/NOTICE +13 -0
  4. package/README.md +65 -2
  5. package/bin/ember-marquetry.mjs +9 -0
  6. package/lib/build-registry.mjs +144 -0
  7. package/lib/cli.mjs +402 -0
  8. package/package.json +40 -3
  9. package/registry/files/catalog/chat.ts +93 -0
  10. package/registry/files/catalog/display.ts +192 -0
  11. package/registry/files/catalog/inputs.ts +223 -0
  12. package/registry/files/catalog/layout.ts +176 -0
  13. package/registry/files/catalog/menus.ts +104 -0
  14. package/registry/files/catalog/overlays.ts +183 -0
  15. package/registry/files/components/chat/chat.gts +115 -0
  16. package/registry/files/components/confirm.gts +36 -0
  17. package/registry/files/components/content.gts +61 -0
  18. package/registry/files/components/display/alert.gts +17 -0
  19. package/registry/files/components/display/aspect-ratio.gts +10 -0
  20. package/registry/files/components/display/avatar.gts +13 -0
  21. package/registry/files/components/display/badge.gts +14 -0
  22. package/registry/files/components/display/breadcrumb.gts +25 -0
  23. package/registry/files/components/display/card.gts +24 -0
  24. package/registry/files/components/display/empty.gts +20 -0
  25. package/registry/files/components/display/item.gts +19 -0
  26. package/registry/files/components/display/kbd.gts +10 -0
  27. package/registry/files/components/display/pagination.gts +86 -0
  28. package/registry/files/components/display/progress.gts +14 -0
  29. package/registry/files/components/display/rating.gts +22 -0
  30. package/registry/files/components/display/scroll-area.gts +20 -0
  31. package/registry/files/components/display/separator.gts +13 -0
  32. package/registry/files/components/display/skeleton.gts +22 -0
  33. package/registry/files/components/display/spinner.gts +8 -0
  34. package/registry/files/components/display/table.gts +36 -0
  35. package/registry/files/components/grid-areas.gts +71 -0
  36. package/registry/files/components/inputs/button-group.gts +15 -0
  37. package/registry/files/components/inputs/button.gts +35 -0
  38. package/registry/files/components/inputs/calendar.gts +75 -0
  39. package/registry/files/components/inputs/checkbox.gts +33 -0
  40. package/registry/files/components/inputs/combobox.gts +66 -0
  41. package/registry/files/components/inputs/control-field.gts +79 -0
  42. package/registry/files/components/inputs/input-otp.gts +50 -0
  43. package/registry/files/components/inputs/input.gts +35 -0
  44. package/registry/files/components/inputs/native-select.gts +41 -0
  45. package/registry/files/components/inputs/radio-group.gts +47 -0
  46. package/registry/files/components/inputs/select.gts +46 -0
  47. package/registry/files/components/inputs/slider.gts +38 -0
  48. package/registry/files/components/inputs/switch.gts +34 -0
  49. package/registry/files/components/inputs/textarea.gts +35 -0
  50. package/registry/files/components/inputs/toggle-group.gts +78 -0
  51. package/registry/files/components/inputs/toggle.gts +26 -0
  52. package/registry/files/components/menus/command.gts +59 -0
  53. package/registry/files/components/menus/menu-groups.gts +49 -0
  54. package/registry/files/components/menus/menus.gts +52 -0
  55. package/registry/files/components/menus/navigation-menu.gts +42 -0
  56. package/registry/files/components/overlays/accordion.gts +63 -0
  57. package/registry/files/components/overlays/alert-dialog.gts +65 -0
  58. package/registry/files/components/overlays/collapsible.gts +22 -0
  59. package/registry/files/components/overlays/dialog.gts +30 -0
  60. package/registry/files/components/overlays/popups.gts +69 -0
  61. package/registry/files/components/overlays/sheet.gts +56 -0
  62. package/registry/files/components/overlays/tabs.gts +66 -0
  63. package/registry/files/components/pages.gts +197 -0
  64. package/registry/files/components/split.gts +49 -0
  65. package/registry/files/components/stack.gts +51 -0
  66. package/registry/files/components/trigger.gts +29 -0
  67. package/registry/files/context.gts +99 -0
  68. package/registry/files/helpers.ts +43 -0
  69. package/registry/files/icons.ts +173 -0
  70. package/registry/files/messages.ts +64 -0
  71. package/registry/files/options.ts +48 -0
  72. package/registry/files/responsive.ts +51 -0
  73. package/registry/files/tracks.ts +80 -0
  74. package/registry/files/types.ts +10 -0
  75. package/registry/files/url.ts +73 -0
  76. package/registry/files/vars.ts +15 -0
  77. package/registry/manifest.json +1026 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ # ember-marquetry
2
+
3
+ ## 2.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 8c811bd: Publish through OIDC trusted publishing only, with the Ember Workbench release kit. Each version from this release on has npm provenance.
8
+
9
+ ## 1.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - 8f2790b: The first release of Marquetry: generative UI for Ember.
14
+
15
+ - `core`: the spec format, the JSONL patch stream, expressions, actions, the catalog, agent events, chat threads and stream replay.
16
+ - `ember`: the `<Render>` component and the `Generation` state machine.
17
+ - `joinery`: a catalog of 69 Joinery components, with layout templates and the chart, data table and code block add-ons. The `/a2ui` subpath is the A2UI v0.9.1 basic catalog on Joinery components, for the specs of `a2ui`.
18
+ - `chat`: a chat thread on Joinery components, with streamed markdown, agent surfaces, tool calls, approvals and MCP Apps.
19
+ - `formwright`: forms with validation from a JSON Schema, field rules and named validators.
20
+ - `inspector`: a dev panel for `<Render>` that shows the spec, the patches with their line numbers, the state and the problems.
21
+ - `ai-sdk`, `ag-ui`, `a2ui` and `sse`: adapters and chat transports for the AI SDK, AG-UI 1.0, A2UI v0.9.1 and plain JSONL or SSE endpoints.
22
+ - `markdown`: a streamed markdown parser that makes no HTML.
23
+ - `mcp-apps`: a host for MCP Apps in a sandbox frame on a second origin.
24
+ - `eslint-plugin`, `skills`, `test-support` and the `ember-marquetry` CLI: tools for catalog authors and app developers.
25
+
26
+ Safety defaults in 1.0:
27
+
28
+ - `joinery`: a URL that the browser loads with no click (the `src` of `Image` and `Avatar`, the `image` of `Attachment`, and the `url` of the A2UI `Image`, `Video` and `AudioPlayer`) must be relative, unless `urls.mediaHosts` lists its host. `isSafeMediaUrl` is the check. `urls.hosts` applies only to links.
29
+ - `markdown` and `chat`: an image must pass `isSafeImageUrl` (`<Chat @isSafeImageUrl>`, `<Markdown @isSafeImageUrl>`). The default, `isRelativeUrl`, accepts only a relative URL. A block of more than 20,000 characters is plain text.
30
+ - `chat`: `<McpApp>` and `McpAppsConfig` have `approveDomain`. Without it, the app gets no domain that it declares in its CSP. An app cannot call a tool that needs the approval of the user (`@needsApproval`).
31
+ - `mcp-apps`: the proxy puts the CSP meta at offset 0 of the app HTML, and gives its own page a `frame-src` with only the approved frame domains.
32
+ - `ai-sdk` and `ag-ui`: a problem in one item is a `data` event named `stream-error`, and a value that the reader does not convert is a `data` event named `unconverted`. `error` is only for a failed run.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Joe Gaudet
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,13 @@
1
+ Marquetry
2
+ Copyright (c) 2026 Joe Gaudet. MIT licensed; see LICENSE.md.
3
+
4
+ Marquetry is an original design. Two projects gave it ideas and formats, and Marquetry copies
5
+ no code from them:
6
+
7
+ - json-render (Vercel, Apache 2.0): the idea of a catalog that limits a model, a flat element
8
+ map, and a spec that streams as JSON Lines of RFC 6902 patches.
9
+ - A2UI (Google, Apache 2.0): the v0.9 message format that @ember-marquetry/a2ui reads.
10
+
11
+ @ember-marquetry/ag-ui reads the event format of the AG-UI protocol, and
12
+ @ember-marquetry/ai-sdk reads the UI message stream format of the Vercel AI SDK. Marquetry
13
+ depends on neither package.
package/README.md CHANGED
@@ -1,3 +1,66 @@
1
- # Temporary Holding Version
1
+ # ember-marquetry
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Copies the Joinery components of [Marquetry](https://joegaudet.com/ember-marquetry/) into your
4
+ Ember app, and updates them, as the `add` command of shadcn does.
5
+
6
+ ```bash
7
+ npx ember-marquetry add input
8
+ ```
9
+
10
+ That writes the source of the Input component into `app/marquetry/`, with the files that it
11
+ imports (its catalog group, the helpers) and the components that it uses (`control-field`).
12
+ It also installs the npm packages that the copies import. The copies are yours to change.
13
+
14
+ The copies are TypeScript (`.gts`): your app needs TypeScript and
15
+ `@babel/plugin-transform-typescript`.
16
+
17
+ ## Use a copy
18
+
19
+ A copy is a registry component and its catalog definition. Put your copy in the registry in
20
+ place of the component of the package:
21
+
22
+ ```ts
23
+ import { mergeRegistries } from '@ember-marquetry/ember'
24
+ import { catalog, registry } from '@ember-marquetry/joinery'
25
+ import { Input } from './marquetry/components/inputs/input'
26
+
27
+ export const myRegistry = mergeRegistries(registry, { Input })
28
+ ```
29
+
30
+ When you change the schema in the copied catalog group, build your catalog from it too, so the
31
+ model and the renderer agree.
32
+
33
+ ## Commands
34
+
35
+ ```bash
36
+ ember-marquetry add [components...] [options]
37
+ ember-marquetry list
38
+ ```
39
+
40
+ | Option | Short | What it does |
41
+ | --------------- | ----- | ------------------------------------------------------------------------------- |
42
+ | `--yes` | `-y` | Do not ask. Files that you changed stay as they are |
43
+ | `--overwrite` | `-o` | Write over the files that exist |
44
+ | `--cwd <cwd>` | `-c` | The folder of your app (default: the current folder) |
45
+ | `--all` | `-a` | Add each component |
46
+ | `--path <path>` | `-p` | Where the copies go (default: the path in `marquetry.json`, or `app/marquetry`) |
47
+ | `--silent` | `-s` | Show no output |
48
+ | `--dry-run` | | Show what would change, and write nothing |
49
+ | `--diff [path]` | | Show the diffs: the first five changed files, or the one named |
50
+ | `--view [path]` | | Show the files of this version: the first five, or the one named |
51
+
52
+ The first `add` writes `marquetry.json`: the path of the copies, and a hash of each file that it
53
+ wrote. Later runs read it. Commit it with the copies.
54
+
55
+ ## Update
56
+
57
+ Run `add` again with the version that you want. A copy that you did not change updates. A copy
58
+ that you changed is never overwritten without a question:
59
+
60
+ ```bash
61
+ npx ember-marquetry@latest add input --dry-run # which files would change
62
+ npx ember-marquetry@latest add input --diff input.gts # what changed in one file
63
+ npx ember-marquetry@latest add input --overwrite # take the new version
64
+ ```
65
+
66
+ This CLI is a port of the `ember-joinery` CLI.
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { run } from '../lib/cli.mjs'
3
+
4
+ try {
5
+ process.exitCode = await run(process.argv.slice(2))
6
+ } catch (error) {
7
+ process.stderr.write(`${error.message}\n`)
8
+ process.exitCode = 1
9
+ }
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+ // Builds the registry that the CLI copies from: each registry component of
3
+ // @ember-marquetry/joinery (src/components/**/*.gts), the files that it imports, and
4
+ // manifest.json, which says what each component needs. The `build` and `prepack` scripts of
5
+ // the package run it, so the package holds the source of its own version. The registry is
6
+ // build output, and git ignores it.
7
+ //
8
+ // node lib/build-registry.mjs from packages/cli: reads ../joinery, writes ./registry
9
+ //
10
+ // manifest.json:
11
+ //
12
+ // {
13
+ // "version": "1.2.0",
14
+ // "dependencies": { "@ember-joinery/ember": "^1.0.1", "zod": "^4.1.0" },
15
+ // "items": {
16
+ // "input": {
17
+ // "files": ["components/inputs/input.gts", "catalog/inputs.ts", "helpers.ts"],
18
+ // "registryDependencies": ["control-field"], // components that it imports
19
+ // "dependencies": ["@ember-joinery/ember"] // npm packages that its files import
20
+ // }
21
+ // }
22
+ // }
23
+ //
24
+ // Paths are relative to src/, and a copy keeps that layout, so relative imports stay valid.
25
+ import { cpSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs'
26
+ import { dirname, join, posix, resolve } from 'node:path'
27
+ import { fileURLToPath } from 'node:url'
28
+
29
+ /** The package that an import specifier names: `@scope/name/sub` → `@scope/name`. */
30
+ const packageName = spec =>
31
+ spec
32
+ .split('/')
33
+ .slice(0, spec.startsWith('@') ? 2 : 1)
34
+ .join('/')
35
+
36
+ /** The specifiers of the static imports and re-exports of a module, in either kind of quotes. */
37
+ export const imports = source =>
38
+ [
39
+ // Without comments, whose quotes (`it's`) would end a match early. No specifier holds `//`.
40
+ ...source
41
+ .replace(/\/\*[\s\S]*?\*\//g, '')
42
+ .replace(/\/\/[^\n]*/g, '')
43
+ .matchAll(
44
+ /^\s*(?:import|export)\b[^'"]*?\bfrom\s+(['"])([^'"]+)\1|^\s*import\s+(['"])([^'"]+)\3/gm,
45
+ ),
46
+ ].map(match => match[2] ?? match[4])
47
+
48
+ /** The packages that come with an Ember app, or that only tests use. A copy does not install them. */
49
+ const PROVIDED = new Set([
50
+ 'ember-source',
51
+ '@glimmer/component',
52
+ '@glimmer/tracking',
53
+ '@ember/test-helpers',
54
+ '@ember-marquetry/test-support',
55
+ '@embroider/addon-shim',
56
+ 'decorator-transforms',
57
+ ])
58
+
59
+ /** The `.gts` files under `components/`, as paths relative to `src`. */
60
+ function componentFiles(src, dir = 'components') {
61
+ return readdirSync(join(src, dir), { withFileTypes: true }).flatMap(entry =>
62
+ entry.isDirectory()
63
+ ? componentFiles(src, posix.join(dir, entry.name))
64
+ : entry.name.endsWith('.gts')
65
+ ? [posix.join(dir, entry.name)]
66
+ : [],
67
+ )
68
+ }
69
+
70
+ /** The item name of a component file: its file name with no extension. */
71
+ export const itemName = file => posix.basename(file, '.gts')
72
+
73
+ export function buildRegistry({ joineryDir, outDir, version }) {
74
+ const src = join(joineryDir, 'src')
75
+ const pkg = JSON.parse(readFileSync(join(joineryDir, 'package.json'), 'utf8'))
76
+ version ??= pkg.version
77
+
78
+ // The npm packages that a copy can import: the dependencies and the peer dependencies of
79
+ // @ember-marquetry/joinery, with the packages of Marquetry at this version.
80
+ const dependencies = {}
81
+ for (const [name, range] of Object.entries({ ...pkg.peerDependencies, ...pkg.dependencies })) {
82
+ if (PROVIDED.has(name)) continue
83
+ dependencies[name] = name.startsWith('@ember-marquetry/') ? `^${version}` : range
84
+ }
85
+
86
+ const files = componentFiles(src).sort()
87
+ const byName = new Map()
88
+ for (const file of files) {
89
+ const name = itemName(file)
90
+ if (byName.has(name))
91
+ throw new Error(`Two components have the name "${name}": ${byName.get(name)} and ${file}`)
92
+ byName.set(name, file)
93
+ }
94
+
95
+ const items = {}
96
+ for (const [name, entry] of [...byName].sort(([a], [b]) => a.localeCompare(b))) {
97
+ const own = []
98
+ const components = new Set()
99
+ const packages = new Set()
100
+ const visit = file => {
101
+ if (own.includes(file)) return
102
+ own.push(file)
103
+ for (const spec of imports(readFileSync(join(src, file), 'utf8'))) {
104
+ if (spec.startsWith('.')) {
105
+ const target = posix.join(posix.dirname(file), spec)
106
+ const component = byName.get(itemName(target)) === target ? itemName(target) : undefined
107
+ if (component && component !== name) components.add(component)
108
+ else if (!component) visit(target)
109
+ } else if (dependencies[packageName(spec)]) {
110
+ packages.add(packageName(spec))
111
+ }
112
+ }
113
+ }
114
+ visit(entry)
115
+ items[name] = {
116
+ files: own,
117
+ registryDependencies: [...components].sort(),
118
+ dependencies: [...packages].sort(),
119
+ }
120
+ }
121
+
122
+ const used = new Set(Object.values(items).flatMap(item => item.dependencies))
123
+ const manifest = {
124
+ version,
125
+ dependencies: Object.fromEntries(
126
+ Object.entries(dependencies).filter(([name]) => used.has(name)),
127
+ ),
128
+ items,
129
+ }
130
+
131
+ rmSync(outDir, { recursive: true, force: true })
132
+ for (const file of new Set(Object.values(items).flatMap(item => item.files))) {
133
+ mkdirSync(dirname(join(outDir, 'files', file)), { recursive: true })
134
+ cpSync(join(src, file), join(outDir, 'files', file))
135
+ }
136
+ writeFileSync(join(outDir, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`)
137
+ return manifest
138
+ }
139
+
140
+ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
141
+ const pkg = resolve(dirname(fileURLToPath(import.meta.url)), '..')
142
+ const { version } = JSON.parse(readFileSync(join(pkg, 'package.json'), 'utf8'))
143
+ buildRegistry({ joineryDir: join(pkg, '../joinery'), outDir: join(pkg, 'registry'), version })
144
+ }