konpeki 0.2.0 → 0.3.1

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/AGENTS.md +1 -1
  2. package/CONTRIBUTING.md +36 -0
  3. package/README.md +81 -28
  4. package/SECURITY.md +22 -0
  5. package/SETUP.md +128 -51
  6. package/composition/README.md +16 -3
  7. package/composition/compile.ts +1 -1
  8. package/composition/schema.json +9 -0
  9. package/composition/schema.ts +3 -1
  10. package/composition/types.ts +3 -1
  11. package/design/themes/README.md +25 -7
  12. package/design/themes/index.ts +15 -4
  13. package/docs/development.md +79 -11
  14. package/docs/workflow.md +11 -4
  15. package/index.html +17 -1
  16. package/package.json +10 -2
  17. package/plugin.json +22 -0
  18. package/public/og.png +0 -0
  19. package/runtime/konpeki.mjs +41 -13
  20. package/skills/konpeki/SKILL.md +186 -0
  21. package/skills/konpeki/assets/blank.json +23 -0
  22. package/skills/konpeki/scripts/ensure-runtime.mjs +69 -0
  23. package/skills/konpeki/scripts/prepare-document.mjs +40 -0
  24. package/slides/README.md +35 -132
  25. package/slides/drawing-references.md +32 -0
  26. package/slides/github-cover/PROMPT.md +21 -0
  27. package/slides/github-cover/README.md +21 -0
  28. package/slides/github-cover/author.ts +67 -0
  29. package/slides/github-cover/composition.json +595 -0
  30. package/slides/introducing-konpeki/PROMPT.md +25 -14
  31. package/slides/introducing-konpeki/README.md +32 -42
  32. package/slides/introducing-konpeki/SOURCE.md +13 -14
  33. package/slides/introducing-konpeki/author.ts +44 -42
  34. package/slides/introducing-konpeki/composition.json +135 -135
  35. package/src/app/App.tsx +149 -56
  36. package/src/components/Canvas.tsx +9 -3
  37. package/src/components/InspectorPanel.tsx +104 -67
  38. package/src/components/RevisionNotes.tsx +6 -7
  39. package/src/components/RightPanel.tsx +42 -10
  40. package/src/components/VectorOverflowWarning.tsx +35 -8
  41. package/src/components/WorkspaceChrome.tsx +125 -10
  42. package/src/components/ui.tsx +95 -1
  43. package/src/lib/storage.ts +38 -10
  44. package/src/lib/use-file-session.ts +60 -38
  45. package/src/main.tsx +3 -0
  46. package/src/styles/base.css +7 -0
  47. package/src/styles/chrome.css +188 -25
  48. package/src/styles/feedback.css +101 -49
  49. package/src/styles/left-panel.css +27 -6
  50. package/src/styles/right-panel.css +114 -30
  51. package/src/styles/shell.css +96 -33
  52. package/.agents/skills/authoring-visuals/SKILL.md +0 -93
package/AGENTS.md CHANGED
@@ -7,7 +7,7 @@ presents that same document.
7
7
  ## Choose the relevant guide
8
8
 
9
9
  - First-time setup: [SETUP.md](SETUP.md).
10
- - Creating or revising visuals: [authoring-visuals](.agents/skills/authoring-visuals/SKILL.md)
10
+ - Opening the editor, creating or revising visuals: [Konpeki skill](skills/konpeki/SKILL.md)
11
11
  and [AUTHORING.md](AUTHORING.md), which owns design and factual-fidelity rules.
12
12
  - Changing the application: [development guidance](docs/development.md) and
13
13
  the [composition contract](composition/README.md).
@@ -0,0 +1,36 @@
1
+ # Contributing to Konpeki
2
+
3
+ Thanks for helping improve Konpeki. Bug reports, focused fixes and additions that
4
+ strengthen the shared human-agent canvas are welcome.
5
+
6
+ ## Before opening a change
7
+
8
+ - Search existing issues before filing a new one.
9
+ - Use an issue to discuss large features or changes to the composition contract
10
+ before investing in an implementation.
11
+ - Do not include private compositions, credentials or proprietary source material
12
+ in issues, fixtures or screenshots.
13
+ - Report security concerns through the process in [SECURITY.md](SECURITY.md), not
14
+ through a public issue.
15
+
16
+ ## Development
17
+
18
+ Follow [docs/development.md](docs/development.md) to install the pinned Node.js and
19
+ pnpm toolchain. Keep changes scoped and preserve existing composition compatibility
20
+ unless a contract change has been agreed in advance.
21
+
22
+ Before opening a pull request, run:
23
+
24
+ ```sh
25
+ mise exec -- pnpm check
26
+ mise exec -- pnpm test
27
+ mise exec -- pnpm build
28
+ mise exec -- pnpm check:package
29
+ ```
30
+
31
+ UI changes also require visual inspection using the relevant browser checks in
32
+ [docs/development.md](docs/development.md#verification). Include the affected
33
+ states and verification performed in the pull request description.
34
+
35
+ By submitting a contribution, you agree that it is licensed under the repository's
36
+ [Apache-2.0 license](LICENSE).
package/README.md CHANGED
@@ -1,42 +1,94 @@
1
- ![Konpeki — A shared canvas for you and your agents](slides/github-cover/cover.png)
1
+ ![Konpeki — Create clear visuals with your coding agent](slides/github-cover/cover.png)
2
2
 
3
- **An editable canvas for agent-made visuals. Create a single explanation or a
4
- whole presentation, then revise it together.**
3
+ **Create clear visuals with your coding agent.** Konpeki is an opinionated design
4
+ framework for covers, social graphics, visual explanations and presentations.
5
5
 
6
6
  Give your coding agent notes, source material and a brief. Konpeki provides the
7
- shared canvas, design guidance, typography and semantic components for social
8
- graphics, article headers, visual explanations and presentations.
7
+ canvas, design guidance, typography and semantic components for the intended
8
+ format and dimensions.
9
9
 
10
10
  People and agents edit the same composition. Export a page as PNG, download its
11
11
  editable JSON, or use **Present** for a chrome-free presentation.
12
12
 
13
- ## Start in your coding agent
13
+ ## Use with your agent
14
14
 
15
15
  Requires **Node.js 24+**, npm, a coding agent that can edit files and run commands,
16
16
  and a browser.
17
17
 
18
- Give your coding agent the public setup URL and your brief. The guide covers
19
- installation; no repository clone or manual package installation is needed first:
18
+ Install once, choosing your agent when prompted:
20
19
 
21
- ```text
22
- Read https://raw.githubusercontent.com/vcfgdev/konpeki/main/SETUP.md
23
- and set up Konpeki in this workspace.
24
- Turn these notes into a three-slide explanation for engineers. Make the request
25
- flow and failure handling easy to follow. Preserve facts and caveats. Save editable composition
26
- JSON, open the preview, then render, inspect and fix the result.
27
-
28
- [Paste notes or provide source files.]
20
+ ```sh
21
+ npx skills add vcfgdev/konpeki -g
29
22
  ```
30
23
 
31
- Ask for revisions in the same conversation. Add “Stop after the outline for
32
- approval” when you want a checkpoint. Supply a visual direction or leave it open;
33
- [authoring modes](AUTHORING.md#authoring-mode) provide defaults without requiring
34
- you to choose fonts, colors or layouts first.
35
-
36
- The package includes the authoring skill, design guidance and examples—no GitHub
37
- clone is required. Keep your documents outside `node_modules`.
38
-
39
- ## Try an editable example
24
+ Start a new conversation or reload your agent's skills. **Send this to your agent:**
25
+
26
+ > Use Konpeki to create a one-page explainer of how a browser, API and database work together.
27
+
28
+ Replace the example with your own brief and materials. Your agent prepares the
29
+ runtime, creates editable JSON in your workspace, opens the canvas and checks the
30
+ result. No clone or separate `init` step. First use may require installation and
31
+ browser permissions; remote workspaces need authenticated preview forwarding.
32
+
33
+ Keep revisions in the same conversation. Canvas notes use **Build it** and its
34
+ copyable handoff unless an agent listener is active; the button cannot wake an
35
+ idle agent. See [setup details and optional commands](SETUP.md) for other install
36
+ methods, or give that guide's [raw URL](https://raw.githubusercontent.com/vcfgdev/konpeki/main/SETUP.md)
37
+ to your agent with your brief.
38
+
39
+ ## Try the editor in your browser
40
+
41
+ [Open the editable Konpeki example](https://vcfgdev.github.io/konpeki/?example=introducing-konpeki).
42
+
43
+ The browser-only playground lets you edit an example or start blank, keep a local
44
+ working copy, import/download editable JSON, export PNG and present. It requires
45
+ no account or AI service. Browser-local data is not cloud backup; download JSON
46
+ to keep or move your work. Continue with your coding agent using that file.
47
+
48
+ The [GitHub Pages playground](docs/development.md#github-pages) does not connect
49
+ to an agent or expose **Build it**. The agent-led workflow above is the route
50
+ from a prompt to a finished visual.
51
+
52
+ ## Showcase
53
+
54
+ Illustrative examples with editable text and vector artwork. Click a preview to
55
+ view it full-size, or download its JSON and choose **Demo Mode → Import** in the
56
+ [playground](https://vcfgdev.github.io/konpeki/).
57
+
58
+ <table>
59
+ <tr>
60
+ <td width="50%" align="center" valign="top">
61
+ <a href="slides/gallery/architecture.png"><img src="slides/gallery/architecture.png" width="420" alt="Harbor Market order-platform architecture"></a><br>
62
+ <strong>Explain a system</strong><br>
63
+ Order handling, events and fulfillment<br>
64
+ <a href="slides/gallery/architecture.json">Editable JSON</a>
65
+ </td>
66
+ <td width="50%" align="center" valign="top">
67
+ <a href="slides/gallery/sankey.png"><img src="slides/gallery/sankey.png" width="420" alt="Proportional Sankey showing a fictional 1,000-user trial cohort"></a><br>
68
+ <strong>Communicate data</strong><br>
69
+ Trial users, activation and outcomes<br>
70
+ <a href="slides/gallery/sankey.json">Editable JSON</a>
71
+ </td>
72
+ </tr>
73
+ <tr>
74
+ <td width="50%" align="center" valign="top">
75
+ <a href="slides/gallery/release.png"><img src="slides/gallery/release.png" width="420" alt="Clearpath 0.4 portrait release announcement in orange"></a><br>
76
+ <strong>Announce a release</strong><br>
77
+ A portrait social graphic for Clearpath<br>
78
+ <a href="slides/gallery/release.json">Editable JSON</a>
79
+ </td>
80
+ <td width="50%" align="center" valign="top">
81
+ <a href="slides/gallery/explainer.png"><img src="slides/gallery/explainer.png" width="420" alt="Folio one-page explainer showing accepted and rejected document saves"></a><br>
82
+ <strong>Teach a concept</strong><br>
83
+ One-page guide to preventing stale saves<br>
84
+ <a href="slides/gallery/explainer.json">Editable JSON</a>
85
+ </td>
86
+ </tr>
87
+ </table>
88
+
89
+ [Browse the gallery](slides/README.md) for briefs, sources and more examples.
90
+
91
+ ## Manual npm start
40
92
 
41
93
  For a manual start, install [Konpeki from npm](https://www.npmjs.com/package/konpeki)
42
94
  in your workspace (run `npm init -y` first in a new, empty directory):
@@ -53,13 +105,14 @@ authenticated preview mechanism rather than sharing a local address.
53
105
 
54
106
  ## Examples and guides
55
107
 
56
- - [Example gallery](slides/README.md): 18 fictional examples and an editable
57
- Konpeki introduction. Retained React/SVG examples are drawing references;
58
- new editable documents use composition JSON.
108
+ - [Native example gallery](slides/README.md): editable diagrams, data graphics,
109
+ a social announcement and a one-page explainer, plus the product introduction
110
+ and repository cover. Older React/SVG drawing references remain separate.
59
111
  - [Agent-led setup](SETUP.md) and [authoring guidance](AUTHORING.md).
60
112
  - [Canvas workflow](docs/workflow.md): page sizes, export and agent handoff.
61
113
  - [Development](docs/development.md): architecture, demo hosting, packaging and checks.
62
114
  - [Composition contract](composition/README.md) and [design resources](design/README.md).
115
+ - [Contributing](CONTRIBUTING.md) and [security policy](SECURITY.md).
63
116
 
64
117
  Konpeki requires no account or hosted AI service. Your coding agent's pricing
65
118
  and data handling still apply. Supply facts and approved assets; examples and
package/SECURITY.md ADDED
@@ -0,0 +1,22 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ Konpeki is early-stage software. Security fixes are made against the latest npm
6
+ release and the `main` branch; older releases are not maintained separately.
7
+
8
+ ## Reporting a vulnerability
9
+
10
+ Do not disclose a suspected vulnerability in a public issue. Use GitHub's
11
+ **Security → Report a vulnerability** flow to send the maintainers a private
12
+ report. Include the affected version, reproduction steps, impact and any suggested
13
+ mitigation. Please avoid accessing data that is not yours while investigating.
14
+
15
+ The maintainers will acknowledge the report, assess its impact and coordinate a
16
+ fix and disclosure. If private vulnerability reporting is unavailable, open an
17
+ issue containing no sensitive details and ask the maintainers for a private
18
+ reporting channel.
19
+
20
+ Konpeki's file-backed preview uses a session URL as a local authorization secret.
21
+ Do not publish that URL or its token, and expose remote previews only through an
22
+ authenticated tunnel or workspace portal.
package/SETUP.md CHANGED
@@ -1,79 +1,149 @@
1
1
  # Set up Konpeki for your coding agent
2
2
 
3
- Give your agent this document and your brief in the same conversation:
3
+ Requires **Node.js 24+**, npm, a coding agent with file and command access, and a browser.
4
+
5
+ Install once, choosing your agent when prompted:
6
+
7
+ ```sh
8
+ npx skills add vcfgdev/konpeki -g
9
+ ```
10
+
11
+ Start a new conversation or reload your agent's skills. **Send this to your agent:**
12
+
13
+ > Use Konpeki to create a one-page explainer of how a browser, API and database work together.
14
+
15
+ Or use your own brief and materials. The agent prepares the runtime, creates the
16
+ document, opens the canvas and checks the result; no separate `init` step is
17
+ needed. Allow any required installation/browser permissions. Remote workspaces
18
+ need authenticated preview forwarding. Keep revisions in the same conversation.
19
+
20
+ ## Other installers
21
+
22
+ For an unattended install, select a single agent (Amp example):
23
+
24
+ ```sh
25
+ npx skills add vcfgdev/konpeki -g -a amp -y
26
+ ```
27
+
28
+ This avoids auto-selecting unrelated agent targets when no terminal prompt is available.
29
+
30
+ You can also use your agent's native skill installer:
4
31
 
5
32
  ```text
6
- Read Konpeki's SETUP.md and set it up in this workspace.
7
- Use it to explain [source] to [audience], with the takeaway [idea].
8
- Create [one visual / a short presentation]. Open the editable preview,
9
- then render, inspect and fix the result.
33
+ Install the konpeki skill from vcfgdev/konpeki, at skills/konpeki.
34
+ ```
35
+
36
+ Install the complete [`skills/konpeki`](skills/konpeki/) directory, including
37
+ `scripts/` and `assets/`. Follow the host's documented skill location; if it does
38
+ not discover skills, read the installed `SKILL.md` directly. Do not overwrite
39
+ existing agent guidance.
40
+
41
+ If you previously installed `authoring-visuals`, replace that installed skill
42
+ with `konpeki` rather than keeping both copies. The runtime package is unchanged.
43
+
44
+ ## Optional commands
45
+
46
+ | Mode | Codex CLI / IDE | Claude Code standalone skill |
47
+ | --- | --- | --- |
48
+ | Open the editor without generating | `$konpeki init [composition.json]` | `/konpeki init [composition.json]` |
49
+ | Create or revise from your materials | `$konpeki generate [brief]` | `/konpeki generate [brief]` |
50
+
51
+ `generate` automatically prepares the runtime when needed. It uses materials
52
+ already supplied in chat, referenced files and the current canvas; it does not
53
+ require `init` first or a repeated brief. Natural-language “Use Konpeki to…”
54
+ creation requests also select generate. Follow-up feedback continues the same
55
+ document without another command. Other GUIs may use skill selection, and plugin
56
+ installations may namespace the skill. These modes are not terminal subcommands.
57
+
58
+ For `init`, choose the supplied path or the document already active in the
59
+ conversation; otherwise use `slides/untitled/composition.json`. After resolving
60
+ the runtime below, run:
61
+
62
+ ```sh
63
+ node "<installed-skill>/scripts/prepare-document.mjs" "<cli>" "<composition.json>"
64
+ node "<cli>" preview "<composition.json>"
10
65
  ```
11
66
 
12
- Konpeki is a shared visual canvas, not an AI service. The coding agent creates
13
- and revises composition files; the browser lets the person edit, review, present
14
- and export them. Keep the initial brief and revision conversation in the coding
15
- agent. An in-app browser is convenient but not required.
67
+ The helper validates existing files without rewriting them. For a missing file,
68
+ it validates and writes the bundled blank document without overwriting a file
69
+ created concurrently. Invalid data is preserved, not replaced with a sample.
70
+ Reuse an already running preview for the same file. Open and verify its exact
71
+ session URL as described below, then stop: init does not generate or start a
72
+ review listener. The starter works with the pinned published runtime; it does
73
+ not import TypeScript from `node_modules` or require an unreleased `init` CLI.
16
74
 
17
- ## 1. Prepare the environment
75
+ ### Optional Codex plugin packaging
18
76
 
19
- - Check for Node.js 24+ (`node --version`), npm (`npm --version`), and a browser
20
- the agent can use for visual inspection. Report missing prerequisites rather
21
- than claiming setup succeeded. Follow the host's rules for installing tools.
22
- - Reuse an existing workspace when requested, or create a new directory. Do not
23
- overwrite the user's files or replace their agent guidance.
24
- - Install the pinned release locally so the agent can find its resources and
25
- reuse the same CLI version. Do not edit files inside `node_modules`.
77
+ The root `plugin.json` packages that same skill, without MCP servers, hooks or
78
+ credentials. `.agents/plugins/marketplace.json` exposes it as a repo marketplace.
79
+ On a compatible Codex client, add the repository marketplace with:
26
80
 
27
81
  ```sh
28
- npm install --save-dev konpeki@0.1.1
82
+ codex plugin marketplace add vcfgdev/konpeki
29
83
  ```
30
84
 
31
- In a new empty directory, run `npm init -y` first. Run subsequent commands from
32
- the workspace where Konpeki was installed. Its resources are under
33
- `node_modules/konpeki/`: `AGENTS.md`, `AUTHORING.md`, `composition/`, `design/`,
34
- and `.agents/skills/authoring-visuals/SKILL.md`. If the package/version cannot be
35
- resolved, report the installation issue rather than substituting another package.
36
- Copying the skill alone does not install the runtime.
85
+ Then install Konpeki from that source in the desktop plugin directory and test it
86
+ in a new conversation. Install either the standalone skill or the plugin, not
87
+ both. This is repository distribution, not a listing in OpenAI's public directory.
88
+ It becomes available from the remote repository after these files are published.
89
+ Native Codex GUI installation needs a separate client smoke test; package checks
90
+ alone do not establish host compatibility.
37
91
 
38
- For repository development instead, clone `https://github.com/vcfgdev/konpeki.git`
39
- with the required access and follow the [mise setup](docs/development.md).
40
- Use `mise exec -- pnpm konpeki` in place of `npm exec --no -- konpeki` below.
41
- Mise is for contributors to this repository; npm package users do not need it.
92
+ ## Agent setup reference
93
+
94
+ The installed skill handles these steps; the person does not need to run them manually.
95
+
96
+ ### Prepare the runtime
97
+
98
+ Check Node.js 24+, npm, command/file access and the host's browser capabilities.
99
+ Follow host approval and toolchain rules if prerequisites are missing.
100
+
101
+ From the user's document workspace, run:
102
+
103
+ ```sh
104
+ node "<installed-skill>/scripts/ensure-runtime.mjs"
105
+ ```
42
106
 
43
- ## 2. Read the authoring instructions
107
+ The script reuses a compatible workspace installation, surrounding Konpeki
108
+ checkout, or cached runtime. If none exists, obtain any required host approval
109
+ and rerun with `--install`. It installs the pinned `konpeki@0.3.1` release in a
110
+ user cache, without adding project dependencies or changing project guidance.
111
+ Missing/incompatible runtimes are never reported ready. The script prints JSON
112
+ with `root`, `cli` and `version`; installation diagnostics go to stderr.
44
113
 
45
- Read [AGENTS.md](AGENTS.md), then use the
46
- [authoring-visuals skill](.agents/skills/authoring-visuals/SKILL.md). If the agent
47
- does not discover project skills, read that file directly. It links to the design
48
- policy and composition contract; no special slash command is required.
114
+ Use the returned absolute `root` for resources and `cli` for commands. Do not rely
115
+ on repo-relative paths from a copied skill. Keep documents outside the runtime.
116
+ For manual project-local npm installation, see [Manual npm start](README.md#manual-npm-start).
117
+ Repository contributors instead use the [mise setup](docs/development.md); users
118
+ of the published package do not need mise.
49
119
 
50
- Use the brief already supplied. Ask only for missing information that prevents
51
- a faithful result. Do not ask the person to re-enter their intent in the canvas.
52
- Create a new document without overwriting an example or existing work. By default,
53
- save it as `slides/<name>/composition.json` with its brief and source notes beside
54
- it. If the user specifies another destination, pass that file's absolute path to
55
- the CLI.
120
+ ### Generate, validate and open the visual
56
121
 
57
- ## 3. Validate and open the result
122
+ Follow the installed skill and the runtime's `AUTHORING.md`, composition contract
123
+ and design resources. Use the brief already supplied; ask only for information
124
+ needed for faithful work. Do not ask the person to repeat their prompt in the
125
+ canvas. Continue the current document when revising or following init. Save new
126
+ work to an unused `slides/<name>/composition.json`, with brief/source notes,
127
+ unless the person chooses another destination. Preserve existing documents.
58
128
 
59
- For an installation check, validate the bundled introduction:
129
+ For an installation check, validate the bundled example:
60
130
 
61
131
  ```sh
62
- npm exec --no -- konpeki validate node_modules/konpeki/slides/introducing-konpeki/composition.json
132
+ node "<cli>" validate "<root>/slides/introducing-konpeki/composition.json"
63
133
  ```
64
134
 
65
135
  After authoring the user's document:
66
136
 
67
137
  ```sh
68
- npm exec --no -- konpeki validate slides/<name>/composition.json
69
- npm exec --no -- konpeki preview slides/<name>/composition.json
138
+ node "<cli>" validate "slides/<name>/composition.json"
139
+ node "<cli>" preview "slides/<name>/composition.json"
70
140
  ```
71
141
 
72
- Keep the preview process running using the host's supported service mechanism.
73
- Open the exact printed session URL; do not drop its query string or expose its
74
- token in public logs. For remote workspaces, use the host's authenticated preview
75
- or port-forwarding mechanism, preserving the session query. Do not present a
76
- remote machine's loopback address as a user-accessible link.
142
+ Reuse an existing preview for that file when available. Keep the process running
143
+ using the host's supported service mechanism. Open the exact printed session URL
144
+ in the in-app browser when supported, otherwise the regular browser. Preserve its
145
+ query string and never publish its capability token. In remote workspaces, use
146
+ authenticated preview/port forwarding, not a remote loopback address.
77
147
 
78
148
  Verify that the browser loads the intended document, then render, inspect and
79
149
  repair the result as directed by the skill. The file-backed canvas saves browser
@@ -82,5 +152,12 @@ validation succeeds and the intended composition opens—not merely when a serve
82
152
  process starts. If browser inspection is unavailable, report that limitation.
83
153
 
84
154
  Return the document path, usable preview link and verification outcome. Continue
85
- revisions in agent chat. The optional **Build it** / `wait` handoff is described in
86
- [Canvas workflow](docs/workflow.md); the button cannot wake an agent by itself.
155
+ revisions in agent chat. For submitted canvas reviews, generate checks `request`,
156
+ claims a `submitted` request with `wait`, applies the notes against the latest
157
+ document, and acknowledges it with `finish` only after validation and inspection.
158
+ Coordinate ownership before resuming an already `working` request.
159
+
160
+ An ongoing listener runs only when explicitly requested and supported by the host.
161
+ Otherwise, use **Copy prompt** after **Build it**, or resume generate in agent chat.
162
+ The [canvas workflow](docs/workflow.md) describes this handoff; the button cannot
163
+ wake an idle agent, and an open preview is not a live agent connection.
@@ -54,9 +54,22 @@ copy is needed.
54
54
  `theme:background`, `theme:surface`, `theme:divider`, `theme:accent`,
55
55
  `theme:on-accent`, and `theme:wash`. `font-family` accepts `theme:heading-font`
56
56
  and `theme:body-font`. These resolve from the deck theme in every canvas view.
57
- Use on-accent for text over an accent fill. Heading fonts are IBM Plex Serif for
58
- Editorial, Noto Sans for Precision, and IBM Plex Sans otherwise; body fonts are
59
- Noto Sans for Precision and IBM Plex Sans otherwise.
57
+ Use on-accent for text over an accent fill. `theme.typography` independently selects
58
+ `plex-sans` (IBM Plex Sans throughout), `noto-sans` (Noto Sans throughout),
59
+ `plex-serif` (IBM Plex Serif headings / IBM Plex Sans body), or `hanken-grotesk`
60
+ (Hanken Grotesk throughout). `theme.id` still selects the color palette and
61
+ `theme.mode` selects Paper or Night. For example:
62
+
63
+ ```json
64
+ { "id": "green", "mode": "paper", "typography": "noto-sans" }
65
+ ```
66
+
67
+ Omitting typography preserves the legacy pairing: Precision uses Noto Sans;
68
+ Editorial uses Plex Serif headings and Plex Sans body; other palettes use Plex
69
+ Sans. When revising colors, retain the current typography explicitly so changing
70
+ the palette does not change fonts. The editor does this automatically. Older
71
+ runtimes that do not support `theme.typography` reject documents containing it;
72
+ use a compatible runtime rather than removing the field and changing appearance.
60
73
 
61
74
  Literal values are fixed overrides. SVG conversion preserves literals; it never
62
75
  guesses roles from colors. Legacy raw SVG stays inert, fixed artwork. In the
@@ -213,7 +213,7 @@ Legacy Text-block purpose, treatment, layout and logical-order fields are guidan
213
213
  Text-block role controls typography and semantic placement: title, subtitle, body, caption or footnote. Use title for the main takeaway and footnote for sources, scope and caveats.
214
214
  Ordinary Text blocks store visible copy in content (plain text with newlines) and typography in textStyle (size in slide pixels, weight 400/500/600, lineHeight, ink/muted/accent color and heading/body font). Intent is separate agent guidance, never displayed copy. Revise content for manual and agent-authored text alike; do not replace ordinary text with customVisual. Custom vectors remain for genuinely custom artwork.
215
215
  When a Text block records a logical order other than none, express that relationship in its text and shape arrangement: parallel, progressive, cyclical, general-to-specific or hierarchical.
216
- Resolve authoring mode to ${document.authoringMode ?? "default"} and theme to ${document.theme?.id ?? "plex"} / ${document.theme?.mode ?? "paper"}. Theme and authoring mode are independent.
216
+ Resolve authoring mode to ${document.authoringMode ?? "default"} and theme to ${document.theme?.id ?? "plex"} / ${document.theme?.mode ?? "paper"}. Theme and authoring mode are independent.${document.theme?.typography ? ` Use typography ${document.theme.typography} independently of the color palette. plex-sans uses IBM Plex Sans throughout; noto-sans uses Noto Sans throughout; plex-serif uses IBM Plex Serif headings with IBM Plex Sans body; hanken-grotesk uses Hanken Grotesk throughout. Preserve this choice when changing colors.` : ""}
217
217
  For editable vector interiors, bind fill/stroke/color to theme:ink, theme:muted, theme:background, theme:surface, theme:divider, theme:accent, theme:on-accent or theme:wash. Bind font-family to theme:heading-font or theme:body-font. Literal values remain fixed overrides; never infer theme roles from imported colors. Check text bounds after font changes; do not silently shrink or rearrange content.
218
218
  Preserve the supplied slide order and slide names. Do not hide overflow, shrink required content, merge slides, or silently add slides. Report an overfull brief and ask for a scope decision. When rendering is requested, inspect and repair every slide at presentation and review sizes. Deliver the updated composition JSON, any requested editable render source, verified output and limitations.
219
219
 
@@ -2968,6 +2968,15 @@
2968
2968
  "night"
2969
2969
  ],
2970
2970
  "type": "string"
2971
+ },
2972
+ "typography": {
2973
+ "enum": [
2974
+ "plex-sans",
2975
+ "noto-sans",
2976
+ "plex-serif",
2977
+ "hanken-grotesk"
2978
+ ],
2979
+ "type": "string"
2971
2980
  }
2972
2981
  },
2973
2982
  "required": [
@@ -4,6 +4,7 @@ import {
4
4
  compositionSchema,
5
5
  themeIds,
6
6
  themeModes,
7
+ typographyIds,
7
8
  vectorElementKinds,
8
9
  } from "./types.ts";
9
10
  import { chartTemplates, diagramTypes } from "./visualizations.ts";
@@ -319,7 +320,8 @@ export const schema = {
319
320
  theme: object({
320
321
  id: enumeration(themeIds),
321
322
  mode: enumeration(themeModes),
322
- }),
323
+ typography: enumeration(typographyIds),
324
+ }, ["id", "mode"]),
323
325
  slides: array(
324
326
  object(
325
327
  {
@@ -25,6 +25,8 @@ export const themeIds = [
25
25
  export type ThemeId = (typeof themeIds)[number];
26
26
  export const themeModes = ["paper", "night"] as const;
27
27
  export type ThemeMode = (typeof themeModes)[number];
28
+ export const typographyIds = ["plex-sans", "noto-sans", "plex-serif", "hanken-grotesk"] as const;
29
+ export type TypographyId = (typeof typographyIds)[number];
28
30
  export type Rect = { x: number; y: number; width: number; height: number };
29
31
  export type Alignment = "start" | "center" | "end";
30
32
  export type TitleStyle = "plain" | "prominent";
@@ -262,6 +264,6 @@ export type CompositionDocument = {
262
264
  schema: typeof compositionSchema;
263
265
  title: string;
264
266
  authoringMode?: AuthoringMode;
265
- theme?: { id: ThemeId; mode: ThemeMode };
267
+ theme?: { id: ThemeId; mode: ThemeMode; typography?: TypographyId };
266
268
  slides: CompositionSlide[];
267
269
  };
@@ -1,21 +1,39 @@
1
1
  # Themes
2
2
 
3
- Themes combine font roles and a referenced color palette, not a slide layout.
3
+ Document appearance has independent **Typography**, **Color palette**, and
4
+ **Background** controls. These do not choose a layout or change font sizes.
4
5
 
5
6
  Use [authoring guidance](../../AUTHORING.md#taste-and-creative-freedom) for theme
6
7
  selection, font defaults and deck-wide consistency.
7
8
 
8
9
  ```ts
9
10
  import { getTheme } from './design/themes/index.ts';
10
- const theme = getTheme('Plex', 'paper');
11
+ const theme = getTheme('Green', 'paper', 'noto-sans');
11
12
  // theme.body, theme.headline, theme.typography, theme.palette
12
13
  ```
13
14
 
14
- Eight light/dark themes: Plex, Precision, Editorial, Blue–cyan, Orange–coral,
15
- Yellow, Green and Graphite. Precision uses Noto Sans; Editorial uses Plex Serif
16
- headlines with Plex Sans body; the others use Plex Sans. Font loading remains
17
- the author's responsibility; load the required Fontsource Latin weights before
18
- measuring or rendering text.
15
+ Eight palettes retain their existing names: Plex, Precision, Editorial,
16
+ Blue–cyan, Orange–coral, Yellow, Green and Graphite. Each supports Paper and Night.
17
+ Choose any palette with any of these typography presets:
18
+
19
+ | Typography ID | Headings | Body |
20
+ | --- | --- | --- |
21
+ | `plex-sans` | IBM Plex Sans | IBM Plex Sans |
22
+ | `noto-sans` | Noto Sans | Noto Sans |
23
+ | `plex-serif` | IBM Plex Serif | IBM Plex Sans |
24
+ | `hanken-grotesk` | Hanken Grotesk | Hanken Grotesk |
25
+
26
+ Composition JSON stores the optional choice in `theme.typography`, independently
27
+ of `theme.id` (palette) and `theme.mode` (background). Omitted typography preserves
28
+ legacy appearance: Precision uses Noto Sans, Editorial uses Plex Serif headings
29
+ with Plex Sans body, and all other palettes use Plex Sans. Changing the palette
30
+ in the editor records the current typography so colors no longer change fonts.
31
+ Two-argument `getTheme` callers retain those legacy pairings too.
32
+
33
+ Font loading remains the author's responsibility; load the required Fontsource
34
+ Latin weights before measuring or rendering text. Theme-linked native text and
35
+ vectors follow the selection; literal font/color overrides remain fixed.
36
+ Different fonts can change wrapping or overflow, so inspect the result.
19
37
 
20
38
  Mineral and Botanical are light-only palette candidates in
21
39
  [palettes/candidates.ts](../palettes/candidates.ts).
@@ -1,13 +1,24 @@
1
1
  import { typography } from '../../lib/taste.ts';
2
2
  import { paletteNames, resolvePalette, type PaletteName, type PaletteMode } from '../palettes/index.ts';
3
+ import type { TypographyId } from '../../composition/types.ts';
3
4
 
4
5
  export const themeNames = paletteNames;
5
6
  export type ThemeName = PaletteName;
6
7
  export type ThemeMode = PaletteMode;
8
+ export const typographyLabels: Record<TypographyId, string> = {
9
+ 'plex-sans': 'IBM Plex Sans',
10
+ 'noto-sans': 'Noto Sans',
11
+ 'plex-serif': 'Plex Serif + Plex Sans',
12
+ 'hanken-grotesk': 'Hanken Grotesk',
13
+ };
7
14
 
8
15
  // Themes combine typography with a palette; they do not choose a composition.
9
- export function getTheme(name: ThemeName, mode: ThemeMode) {
10
- const body = name === 'Precision' ? '"Noto Sans", sans-serif' : typography.family;
11
- const headline = name === 'Editorial' ? '"IBM Plex Serif", serif' : body;
12
- return { name, body, headline, typography: { ...typography, family: body }, palette: resolvePalette(name, mode) };
16
+ // Omitted typography retains the original pairing for older documents/callers.
17
+ export function getTheme(name: ThemeName, mode: ThemeMode,
18
+ typographyId: TypographyId = name === 'Precision' ? 'noto-sans' : name === 'Editorial' ? 'plex-serif' : 'plex-sans',
19
+ ) {
20
+ const body = typographyId === 'noto-sans' ? '"Noto Sans", sans-serif'
21
+ : typographyId === 'hanken-grotesk' ? '"Hanken Grotesk", sans-serif' : typography.family;
22
+ const headline = typographyId === 'plex-serif' ? '"IBM Plex Serif", serif' : body;
23
+ return { name, typographyId, body, headline, typography: { ...typography, family: body }, palette: resolvePalette(name, mode) };
13
24
  }