camox 0.53.1 → 0.56.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 (52) hide show
  1. package/dist/features/canvas/CamoxCanvas.js +14 -11
  2. package/dist/features/canvas/CanvasLoadingScreen.js +1 -1
  3. package/dist/features/canvas/sidebar/CanvasViewHeader.js +1 -1
  4. package/dist/features/canvas/sidebar/{CanvasSidebar.js → ContentSidebar.js} +5 -5
  5. package/dist/features/canvas/sidebar/{CanvasSidebarFrame.js → ContentSidebarFrame.js} +4 -4
  6. package/dist/features/canvas/sidebar/{CanvasSidebarSkeleton.js → ContentSidebarSkeleton.js} +7 -7
  7. package/dist/features/og/documentFonts.js +49 -0
  8. package/dist/features/og/imageResponse.d.ts +14 -5
  9. package/dist/features/og/imageResponse.js +20 -21
  10. package/dist/features/og/pageImage.js +7 -4
  11. package/dist/features/preview/CamoxPreview.js +2 -2
  12. package/dist/features/preview/components/BlockActionsPopover.js +1 -1
  13. package/dist/features/preview/components/IconFieldEditor.js +1 -1
  14. package/dist/features/preview/components/LinkFieldEditor.js +1 -1
  15. package/dist/features/preview/components/PagePicker.js +1 -1
  16. package/dist/features/preview/components/PreviewToolbar.js +1 -1
  17. package/dist/features/preview/components/SelectionEditor.js +136 -110
  18. package/dist/features/preview/components/SidebarStack.js +110 -83
  19. package/dist/features/preview/components/StudioEditingFallback.js +3 -3
  20. package/dist/features/routes/pageRuntime.d.ts +1 -1
  21. package/dist/features/runtime/RuntimeChrome.js +4 -4
  22. package/dist/features/runtime/runtime.d.ts +5 -0
  23. package/dist/features/runtime/runtime.js +15 -4
  24. package/dist/features/studio/components/AgentSidebar.js +56 -0
  25. package/dist/features/studio/components/ChatWidget.js +237 -0
  26. package/dist/features/studio/components/DraftsControl.js +17 -17
  27. package/dist/features/studio/components/ReviewDraftSheet.js +38 -38
  28. package/dist/features/studio/components/Squareling.js +116 -0
  29. package/dist/features/studio/components/ThreadMessages.js +190 -165
  30. package/dist/features/studio/components/WorkersWidget.js +52 -0
  31. package/dist/features/studio/studioStore.js +5 -5
  32. package/dist/features/vite/bundlerLogs.js +1 -0
  33. package/dist/features/vite/runtimeDev.js +11 -0
  34. package/dist/features/vite/vite.js +3 -1
  35. package/dist/lib/queries.js +1 -1
  36. package/dist/package.js +1 -1
  37. package/dist/studio.css +1 -1
  38. package/package.json +5 -5
  39. package/skills/camox/SKILL.md +3 -10
  40. package/skills/camox/references/artifacts.md +2 -2
  41. package/skills/camox/references/block-definitions.md +1 -1
  42. package/skills/camox/references/layout-definitions.md +12 -17
  43. package/skills/camox/references/routed-layouts.md +2 -2
  44. package/skills/camox-cli/SKILL.md +15 -0
  45. package/skills/{camox → camox-cli}/references/cli-common.md +1 -1
  46. package/skills/{camox → camox-cli}/references/cli-content.md +2 -2
  47. package/skills/{camox → camox-cli}/references/cli-publishing.md +4 -4
  48. package/skills/camox-expand/SKILL.md +1 -1
  49. package/skills/camoxify/SKILL.md +1 -1
  50. package/dist/features/og/defaultFonts.js +0 -31
  51. package/dist/features/og/geist-variable-ttf-base64.js +0 -21
  52. package/dist/features/studio/components/ChatSidebar.js +0 -364
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camox",
3
- "version": "0.53.1",
3
+ "version": "0.56.0",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "camox": "./bin/camox.mjs"
@@ -112,7 +112,6 @@
112
112
  "@shikijs/langs": "^4.5.0",
113
113
  "@shikijs/themes": "^4.5.0",
114
114
  "@sinclair/typebox": "^0.34.52",
115
- "@takumi-rs/image-response": "^2.16.3",
116
115
  "@tanstack/react-form": "^1.33.5",
117
116
  "@tanstack/react-hotkeys": "^0.16.0",
118
117
  "@tanstack/react-query-devtools": "^5.104.3",
@@ -133,11 +132,12 @@
133
132
  "react-dom": "^19.3.1",
134
133
  "react-og-preview": "^0.2.0",
135
134
  "shiki": "^4.5.0",
135
+ "takumi-js": "^2.18.1",
136
136
  "unhead": "^3.4.3",
137
137
  "zod": "^4.6.7",
138
- "@camox/api-contract": "0.53.1",
139
- "@camox/cli": "0.53.1",
140
- "@camox/ui": "0.53.1"
138
+ "@camox/api-contract": "0.56.0",
139
+ "@camox/cli": "0.56.0",
140
+ "@camox/ui": "0.56.0"
141
141
  },
142
142
  "devDependencies": {
143
143
  "@earendil-works/pi-ai": "1.3.0",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: camox
3
- description: Use when working in a Camox codebase with Block Definitions, Layout Definitions, Pages, Block content, the Camox CLI, or publishing. Applies to code-defined site structure and agent-driven content changes.
3
+ description: Use when writing or changing a Camox website's code: Block Definitions, Layout Definitions, singleton pages and derived routes, localized code, field styling, artifacts, or DOM integrations.
4
4
  ---
5
5
 
6
6
  # Camox
@@ -43,15 +43,8 @@ For specialized changes to an existing block, read the specialist reference dire
43
43
 
44
44
  Use the platform. Build tabs, dialogs, carousels, menus and disclosures from native HTML and CSS (`<details name>`, `<dialog>` with `command`/`commandfor`, `popover`, scroll snap), and reach for JS only where modern HTML can't do the behaviour. Compose the project's own Components in `src/components/ui/` when it has them (Camox's Template ships accordion, tabs, dialog, carousel and mobile menu). Target Baseline Newly available, with a fallback that keeps the content reachable in browsers lacking the feature, and keep every tab, dialog and slide in the page's markup, opened or not, and reachable with the keyboard. Editors edit hidden content by turning the Canvas off, opening it, and turning the Canvas back on.
45
45
 
46
- ## Content and CLI
46
+ ## Content
47
47
 
48
- For any CLI operation, first read [CLI common guidance](references/cli-common.md), then only the relevant command reference:
49
-
50
- - Pages, metadata, layout assignments, Blocks, content, or ordering:
51
- [CLI Content](references/cli-content.md).
52
- - Where the CLI writes, publishing or discarding the development draft, or its status:
53
- [CLI Publishing](references/cli-publishing.md).
54
-
55
- Code definitions do not place blocks on existing Pages or assign their layouts; `blocks.initial` only seeds the initial homepage. When the request includes placement or assignment on existing Pages, follow with the relevant CLI workflow. Singleton pages and derived routes are declared in code, not created through the pages CLI.
48
+ Code definitions do not place blocks on existing Pages or assign their layouts; `blocks.initial` only seeds the initial homepage. When the request includes placement or assignment on existing Pages, make it as a content change once Camox has discovered the new definition. Singleton pages and derived routes are declared in code, never created as Pages.
56
49
 
57
50
  A request can cross boundaries. Load an additional reference only once that need is established.
@@ -44,7 +44,7 @@ Spread the props onto your own `<iframe>`: they carry `srcDoc`, `sandbox="allow-
44
44
 
45
45
  ## Write a source
46
46
 
47
- Write the source to a local file and push it with `blocks edit --id <ID> --field-file <NAME>=<PATH>` (or `blocks create`), then check it with `camox preview`; see [Set string fields from files](cli-content.md#set-string-fields-from-files). `blocks describe` lists artifact fields with `fieldType: "Artifact"` and their `size`. Artifacts that share Artifact Data also list the sibling names in `data`, and the exact shape of `camox.data` as JSON Schema in `dataSchema`: write the source against it.
47
+ The source is content, not code: set it as the artifact field's value, like any string field, then check the rendered page and iterate. The block type's description lists artifact fields with `fieldType: "Artifact"` and their `size`. Artifacts that share Artifact Data also list the sibling names in `data`, and the exact shape of `camox.data` as JSON Schema in `dataSchema`: write the source against it.
48
48
 
49
49
  - **Under 256 KB.** Larger writes are rejected. Load libraries from a CDN instead of inlining them.
50
50
  - **Import from esm.sh with exact pinned versions**, so the artifact never changes under the website:
@@ -67,7 +67,7 @@ Never implement your own `postMessage` protocol with the page. The website and t
67
67
 
68
68
  ### `camox.data`
69
69
 
70
- The artifact's Artifact Data: an object with one entry per name in the field's `data`, matching the `dataSchema` that `blocks describe` shows. It's `{}` for artifacts that share no data. It's available from the first render, so the first paint can already show the right labels and values.
70
+ The artifact's Artifact Data: an object with one entry per name in the field's `data`, matching the `dataSchema` that the block type's description shows. It's `{}` for artifacts that share no data. It's available from the first render, so the first paint can already show the right labels and values.
71
71
 
72
72
  Values are normalized:
73
73
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  A block definition specifies a reusable section's schema and rendering, not an instance's content.
4
4
 
5
- When asked to add a section, also place an instance after dev-server discovery using the [CLI workflow](../SKILL.md#content-and-cli). For shared chrome, use [Layout Definitions](layout-definitions.md) instead. Defining a type alone does not place it on a Page.
5
+ When asked to add a section, also place an instance as a [content change](../SKILL.md#content) once Camox has discovered the definition. For shared chrome, use [Layout Definitions](layout-definitions.md) instead. Defining a type alone does not place it on a Page.
6
6
 
7
7
  ## Quick Start
8
8
 
@@ -4,7 +4,7 @@ A curated layout (`kind: "curated"`, the default) is a reusable shell for editor
4
4
 
5
5
  All editable content lives in blocks; layouts have no editable `content` schema or `.Field` helpers.
6
6
 
7
- Defining a layout does not assign it to existing Pages. When assignment is requested, wait for dev-server discovery, then follow the [CLI workflow](../SKILL.md#content-and-cli).
7
+ Defining a layout does not assign it to existing Pages. When assignment is requested, make it as a [content change](../SKILL.md#content) once Camox has discovered the layout.
8
8
 
9
9
  ## Quick Start
10
10
 
@@ -85,25 +85,20 @@ Singleton and derived layouts also receive `data` and `params`, and record pages
85
85
 
86
86
  ## OG Image — `toImage` (optional)
87
87
 
88
- Returns JSX rendered as a 1200×630 image. Use **inline styles, not Tailwind**, and `display: "flex"` for layout: this runs in an image-generation engine, not a browser.
88
+ Returns JSX rendered as a 1200×630 image. Style it with the Theme's utilities, like a block: the image renders with the site's compiled `src/styles.css` and the Google Fonts that `src/document.ts` loads. It runs in an image engine, not a browser, so:
89
+
90
+ - Size the root with `h-full w-full`, and lay out with flexbox or grid.
91
+ - Put the color scheme class (`dark`, `brand`, …) and `font-body` on the root: the document's `<html>` classes and base styles don't apply.
92
+ - Only class, id and descendant selectors match, so `hover:` and other state variants do nothing. Breakpoints see a 1200px-wide viewport.
89
93
 
90
94
  ```tsx
91
95
  toImage: ({ page, project }) => (
92
- <div
93
- style={{
94
- display: "flex",
95
- flexDirection: "column",
96
- width: "100%",
97
- height: "100%",
98
- padding: 60,
99
- backgroundColor: "#09090b",
100
- color: "#fafafa",
101
- fontFamily: "sans-serif",
102
- }}
103
- >
104
- {project.name && <div style={{ fontSize: 24 }}>{project.name}</div>}
105
- <div style={{ fontSize: 64 }}>{page.title}</div>
106
- {page.description && <div style={{ fontSize: 28 }}>{page.description}</div>}
96
+ <div className="dark bg-canvas text-ink font-body flex h-full w-full flex-col justify-center px-20 py-16">
97
+ {project.name && <div className="text-brand mb-6 text-2xl uppercase">{project.name}</div>}
98
+ <div className="font-heading line-clamp-2 text-6xl font-semibold">{page.title}</div>
99
+ {page.description && (
100
+ <div className="text-ink-muted mt-6 line-clamp-2 text-3xl">{page.description}</div>
101
+ )}
107
102
  </div>
108
103
  ),
109
104
  ```
@@ -54,10 +54,10 @@ function PokedexPage() {
54
54
  - Before/after blocks must be `layoutOnly: true`. Put editable headings, introductions, and other bespoke content in these blocks; keep structural application UI in the component. See [Block Definitions](block-definitions.md).
55
55
  - For a navbar or footer whose content must stay identical across different layouts, also set `synced: true` in its `createBlock` options. `layoutOnly: true` alone only restricts placement. See [Synced blocks](block-definitions.md#synced-blocks-synced-optional) for sharing behavior.
56
56
  - No `children` slot or `blocks.initial`: editors do not compose or create these pages.
57
- - No curated page record is created. Do not use the pages CLI to create, duplicate, move, or assign a singleton.
57
+ - No curated page record is created. Never create, duplicate, move, or assign a singleton as a Page.
58
58
  - Studio lists singletons as directly navigable pages with block editing, without deletion or URL/layout controls. They also appear in link destination pickers (including inline text links), “Go to page” actions, and the runtime sitemap. Derived pages appear in the sitemap only when their layout declares `routes` (see [Route discovery](#route-discovery)).
59
59
  - Singleton links are saved as fixed internal URLs, not synthetic database page IDs: link fields use `{ type: "external", href: "/pokedex", text: "Pokédex", newTab: false }` (the existing URL representation), while inline text uses `[Pokédex](/pokedex)`. Renaming a code-owned URL requires updating links or adding a redirect. Curated-page links retain their page-ID references.
60
- - Curated-only mutation surfaces, such as page-parent selectors and the pages record API/CLI, remain separate from the navigable destination list.
60
+ - Curated-only mutation surfaces, such as page-parent selectors and the Pages record API, remain separate from the navigable destination list.
61
61
  - The route renders the current editable blocks.
62
62
  - Code deployment controls route existence. Removing the definition and syncing releases its reserved URL. Existing curated URL collisions or layouts still assigned to curated pages must be resolved explicitly before sync can succeed.
63
63
  - Curated pages cannot claim singleton URLs or use singleton/derived layouts. Literal singleton routes take precedence over parameterized derived routes.
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: camox-cli
3
+ description: Use when running the Camox CLI to read or change a Camox project's Pages, Blocks, content, layout assignments or metadata, to preview a change, or to publish or delete the development draft.
4
+ ---
5
+
6
+ # Camox CLI
7
+
8
+ For any CLI operation, first read [CLI common guidance](references/cli-common.md), then only the relevant command reference:
9
+
10
+ - Pages, metadata, layout assignments, Blocks, content, or ordering:
11
+ [CLI Content](references/cli-content.md).
12
+ - Where the CLI writes, publishing or deleting the development draft, or its status:
13
+ [CLI Publishing](references/cli-publishing.md).
14
+
15
+ The CLI changes content, never code. To create or change Block or Layout Definitions first, follow the [`camox` skill](../camox/SKILL.md), then wait for the dev server to discover the new definition before placing or assigning it.
@@ -1,6 +1,6 @@
1
1
  # Camox CLI common guidance
2
2
 
3
- Use the Camox CLI for CRUD operations on Pages, Blocks, Layout assignments, and metadata. Use the code references instead when changing Block Definitions or Layout Definitions in `src/blocks/` or `src/layouts/`.
3
+ Use the Camox CLI for CRUD operations on Pages, Blocks, Layout assignments, and metadata. Follow the [`camox` skill](../../camox/SKILL.md) instead when changing Block Definitions or Layout Definitions in `src/blocks/` or `src/layouts/`.
4
4
 
5
5
  If a change should be visible without a code deployment, it is usually a CLI content operation. Some requests require both code and CLI work: define the new type first, wait for the dev server to discover it, then create or assign its content through the CLI.
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Read [cli-common.md](cli-common.md) first for `{{CAMOX_CMD}}`, help verification, and the dev-first workflow.
4
4
 
5
- Use these commands for Pages, metadata, Layout assignments, Blocks and their Content, and review. To change Block schemas or rendering, read [Block Definitions](block-definitions.md); to create or change Layout Definitions, follow the code-definition routing in [the Camox skill](../SKILL.md).
5
+ Use these commands for Pages, metadata, Layout assignments, Blocks and their Content, and review. To create or change Block or Layout Definitions, follow the [`camox` skill](../../camox/SKILL.md).
6
6
 
7
7
  ## Pages
8
8
 
@@ -111,7 +111,7 @@ Content patches merge ordinary fields, so send only fields that should change:
111
111
 
112
112
  ### Set string fields from files
113
113
 
114
- Use `--field-file <NAME>=<PATH>` on `blocks create` and `blocks edit` to set a top-level string field to a file's raw contents, without escaping it into JSON. It suits long Markdown and [Artifact](artifacts.md) sources. Repeat the flag to set several fields. It merges with `--content`; when both set the same field, the file wins. On `blocks create`, pass `--content`, `--field-file`, or both.
114
+ Use `--field-file <NAME>=<PATH>` on `blocks create` and `blocks edit` to set a top-level string field to a file's raw contents, without escaping it into JSON. It suits long Markdown and [Artifact](../../camox/references/artifacts.md) sources. Repeat the flag to set several fields. It merges with `--content`; when both set the same field, the file wins. On `blocks create`, pass `--content`, `--field-file`, or both.
115
115
 
116
116
  ```sh
117
117
  {{CAMOX_CMD}} blocks edit --id <BLOCK_UUID> --content '{"title": "Orbit"}' --field-file source=./orbit.html
@@ -2,15 +2,15 @@
2
2
 
3
3
  Read [cli-common.md](cli-common.md) first for `{{CAMOX_CMD}}`, help verification, and the dev-first workflow.
4
4
 
5
- Every command works in the current developer's development draft. Its changes reach Live, the public site, only when the draft is published. Agents in parallel worktrees share their developer's development draft, so publishing or discarding it covers all of their changes.
5
+ Every command works in the current developer's development draft. Its changes reach Live, the public site, only when the draft is published. Agents in parallel worktrees share their developer's development draft, so publishing or deleting it covers all of their changes.
6
6
 
7
- Don't publish or discard unless the user asks you to.
7
+ Don't publish or delete unless the user asks you to.
8
8
 
9
9
  ```sh
10
10
  {{CAMOX_CMD}} status # whether the development draft exists, and how many changes it holds
11
11
  {{CAMOX_CMD}} publish # what publishing would do, with a token
12
12
  {{CAMOX_CMD}} publish --confirm TOKEN # publish the whole draft to Live
13
- {{CAMOX_CMD}} discard --yes # empty the development draft; Live is untouched
13
+ {{CAMOX_CMD}} delete --yes # empty the development draft; Live is untouched
14
14
  ```
15
15
 
16
16
  `publish` lists, in order:
@@ -23,4 +23,4 @@ Don't publish or discard unless the user asks you to.
23
23
 
24
24
  Show the user the list, especially conflicts and lost changes, and get their confirmation before passing the token to `publish --confirm`. If Live changed since the list was printed, nothing is published: the command prints the new list with a new token and fails with `CONFLICTS_CHANGED`. Review the new list with the user before confirming again.
25
25
 
26
- After publishing, the development draft stays open and empty. `discard` empties it without publishing and can't be undone; it requires `--yes` when not run in a terminal.
26
+ After publishing, the development draft stays open and empty. `delete` empties it without publishing and can't be undone; it requires `--yes` when not run in a terminal.
@@ -55,7 +55,7 @@ Make only these kinds of change:
55
55
  - **New Settings on existing Block Definitions**, with defaults that leave current rendering unchanged. Existing content schemas stay exactly as they are. Before editing the block, capture it at desktop and mobile on a Page that places it, on the running dev server; step 6 compares against this capture.
56
56
  - **Description edits.** A new block's `description` says when to choose it over its siblings. Edit the siblings' descriptions so each one names what sets it apart, and the Agent can choose between them.
57
57
 
58
- New blocks live only in code, plus one review Page in the development draft: create it with the CLI (see [Managing Pages and Blocks](../camox/references/cli-content.md)) and place each new block on it with its default content. Leave every other Page, layouts, and publishing alone. This rules out new Layout-only Blocks: a Page can't hold them, and they only sync once a layout uses them. An existing Layout-only Block that gains a Setting is captured and checked on a Page whose layout uses it.
58
+ New blocks live only in code, plus one review Page in the development draft: create it with the CLI (see [Managing Pages and Blocks](../camox-cli/references/cli-content.md)) and place each new block on it with its default content. Leave every other Page, layouts, and publishing alone. This rules out new Layout-only Blocks: a Page can't hold them, and they only sync once a layout uses them. An existing Layout-only Block that gains a Setting is captured and checked on a Page whose layout uses it.
59
59
 
60
60
  ## 6. Verify
61
61
 
@@ -79,7 +79,7 @@ Use inline formatting and `textStyle`, including highlights, instead of fields s
79
79
 
80
80
  ## Populate and verify
81
81
 
82
- Follow the [Camox CLI workflow](../camox/SKILL.md#content-and-cli) to assign layouts, place blocks, and populate content, including shared navigation/footer content. Don't publish unless asked.
82
+ Follow the [Camox CLI workflow](../camox-cli/SKILL.md) to assign layouts, place blocks, and populate content, including shared navigation/footer content. Don't publish unless asked.
83
83
 
84
84
  Compare the rendered site with the reference at desktop and mobile sizes. Verify that fields remain editable and that longer text and different repeater counts still work. Fix the reusable implementation, not just the one captured arrangement.
85
85
 
@@ -1,31 +0,0 @@
1
- import { GEIST_VARIABLE_TTF_BASE64 } from "./geist-variable-ttf-base64.js";
2
-
3
- //#region src/features/og/defaultFonts.ts
4
- /**
5
- * Decoded default fonts for the OG image wrapper.
6
- *
7
- * Takumi's wasm renderer ships with no embedded fonts — rendering without
8
- * `fonts` produces zero text runs and OG images come out as featureless
9
- * rectangles. We always inject Geist Variable so text has something to render
10
- * with; the user can still pass their own `fonts:` through the ImageResponse
11
- * constructor and override this default.
12
- *
13
- * Decoded once at module load. Takumi keys registered fonts by their bytes, so
14
- * passing the same `data` on every render registers Geist only once per
15
- * isolate.
16
- */
17
- function decodeBase64(b64) {
18
- const binary = atob(b64);
19
- const bytes = new Uint8Array(binary.length);
20
- for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
21
- return bytes;
22
- }
23
- const DEFAULT_FONTS = [{
24
- name: "Geist",
25
- data: decodeBase64(GEIST_VARIABLE_TTF_BASE64),
26
- weight: 400,
27
- style: "normal"
28
- }];
29
-
30
- //#endregion
31
- export { DEFAULT_FONTS };