@fusion.dev/helix-docs 0.193.0 → 0.194.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.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Five mistakes that look like Helix bugs, and the files an agent should read.
2
+ description: The rules an agent follows to write Helix code, and the five mistakes that look like Helix bugs.
3
3
  parent: coding-agents
4
4
  section: Getting started
5
5
  title: Using Helix with an agent
@@ -8,41 +8,52 @@ title: Using Helix with an agent
8
8
 
9
9
  # Using Helix with an agent
10
10
 
11
- This guide is in two places, and both say the same thing:
11
+ This guide is what an agent reads before writing Helix code. It is also the
12
+ `helix` skill: `skills/helix/SKILL.md` in `@fusion.dev/helix`, which matches the
13
+ version installed, and the skill in Helix's plugin for coding agents. [Coding
14
+ agents](./coding-agents) says how to install the plugin or link the skill.
12
15
 
13
- - this page, which [llms.txt](https://fusion.dev/llms.txt) indexes
14
- - `skills/helix/SKILL.md` inside `@fusion.dev/helix`, which matches the version
15
- you installed and works offline
16
+ ## Use a Helix family wherever one exists
16
17
 
17
- [Link your tool to this guide](#link-your-tool-to-this-guide) says how to point
18
- each tool at one of them. [The MCP server](./coding-agents) works with any
19
- vendor and runs code, and Claude, Cursor, Windsurf, and Zed all support it.
18
+ Write a Helix element for everything Helix has a family for, and a native
19
+ element only for page structure. Before you write a native element, ask whether
20
+ a family stands in for it:
20
21
 
21
- ## Read the family before writing its tags
22
+ - `helix api find <tag>`, or the MCP tool `helix_find`, answers a native tag
23
+ with its family: `button` finds Button, and `h1` finds Text.
24
+ - Each family's file lists the native elements it replaces under `replaces`.
22
25
 
23
- ```
24
- https://fusion.dev/helix/components/<family>.md
25
- https://fusion.dev/helix/components/<family>.json
26
- ```
26
+ These native elements have families:
27
27
 
28
- Each family's file lists:
28
+ - controls: `button`, `input` of every visible type, `select`, and `textarea`
29
+ - overlays and disclosure: `dialog` and `details`
30
+ - text: `h1` to `h6` and `p`, which `helix-text` writes with `as="h1"` and the
31
+ rest
32
+ - content: `img`, `picture`, `hr`, `ul`, `ol`, `table`, `code`, `pre`, `kbd`,
33
+ `blockquote`, `q`, `video`, `progress`, and `meter`
29
34
 
30
- - the import lines for the family
31
- - every tag
32
- - every property, with its literal union
33
- - every event, with its class and its React prop
34
- - every slot, part, and custom property
35
- - the examples, each with the import lines it needs
35
+ Page structure stays native: `main`, `section`, `article`, `header`, `footer`,
36
+ `nav`, `form`, `label`, `div`, `span`, and `a`. So does markup a CMS writes
37
+ inside `data-prose`.
36
38
 
37
- **If a tag is not in a family's file, it does not exist.** A property value
38
- outside a declared union is invalid. Property types are literal unions for this
39
- reason. `'ghost' | 'outlined' | 'solid' | 'subtle'` shows you the values, and a
40
- named type such as `ButtonEmphasis` sends you somewhere else to find them.
39
+ `helix scan` and the MCP tool `helix_check` report each native element a page
40
+ writes where an installed family stands in for it, as `native-element`.
41
+
42
+ ## Look up a family before writing its tags
43
+
44
+ Each family's API is in the packages you installed, and on this site:
45
+
46
+ - `helix api family <family>`, or the MCP tool `helix_family`
47
+ - `node_modules/@fusion.dev/helix/api.json`
48
+ - `https://fusion.dev/helix/components/<family>.md` and `.json`
41
49
 
42
- The manifest at `https://fusion.dev/helix/custom-elements.json` holds every
43
- family in one file, which is several megabytes. Read the families you use.
44
- Start from `https://fusion.dev/llms.txt`. In one request, it names every
45
- document and the machine-readable sources.
50
+ Each lists the import lines, every tag, every property with its literal union,
51
+ every event with its React prop, every slot, part, and custom property, and the
52
+ examples with the imports each one needs.
53
+
54
+ **If a tag is not in a family's file, it does not exist.** A property value
55
+ outside a declared union is invalid. Find a family by name, alias, or purpose
56
+ with `helix api find`, or the MCP tool `helix_find`.
46
57
 
47
58
  ## Five mistakes that look like Helix bugs
48
59
 
@@ -147,12 +158,9 @@ Each missing layer has its own symptom:
147
158
  - Unstyled headings mean `base.css` is missing.
148
159
  - No color anywhere means `primitives.css` or `tokens.css` is missing.
149
160
 
150
- To tell the last two apart, look at the stylesheet. The screen looks the same.
151
- Without `tokens.css`, nothing declares `--helix-color-*`. Without
152
- `primitives.css`, all 185 semantic tokens are declared and every color resolves
153
- to `rgba(0, 0, 0, 0)`, because `tokens.css` refers to a primitive 297 times and
154
- to nothing else. A missing `primitives.css` looks like a working install, and
155
- `helix.css` exists to prevent it.
161
+ To tell the last two apart, look at the stylesheet. Without `tokens.css`,
162
+ nothing declares `--helix-color-*`. Without `primitives.css`, every token is
163
+ declared and every color resolves to transparent.
156
164
 
157
165
  ## Choosing a component family
158
166
 
@@ -192,73 +200,25 @@ You can style a component in three ways. Try them in this order:
192
200
  belong to `@fusion.dev/helix-styles`. The underscore marks them as internal.
193
201
  Read the semantic tokens that refer to them.
194
202
 
195
- ## Styling HTML without custom elements
196
-
197
- `@fusion.dev/helix-styles` is plain CSS with no JavaScript. It includes recipes
198
- for markup that Helix does not render:
199
-
200
- ```html
201
- <button
202
- data-button="solid"
203
- data-button-tone="primary"
204
- >Save</button>
205
- <article data-prose><h2>From a CMS</h2></article>
206
- <div data-density="sm">…</div>
207
- ```
208
-
209
- A recipe sets appearance only. It has none of these:
210
-
211
- - state
212
- - form participation
213
- - focus trapping
214
- - keyboard handling
215
-
216
- If you are adding a script to a recipe, use the component.
217
-
218
- ## Link your tool to this guide
219
-
220
- **Point your tool at the guide, and do not copy it.** A copy starts to go stale
221
- as soon as you paste it, and the guide changes with the library.
222
-
223
- The skill in the package matches the Helix you installed. In Claude Code, link
224
- it into your project's skills folder:
203
+ ## Markup Helix does not render
225
204
 
226
- ```sh
227
- mkdir -p .claude/skills
228
- ln -s ../../node_modules/@fusion.dev/helix/skills/helix .claude/skills/helix
229
- ```
230
-
231
- Other tools read a file in your repository. Add a line to it that names the
232
- skill, or this page:
233
-
234
- ```md
235
- Helix: read node_modules/@fusion.dev/helix/skills/helix/SKILL.md before
236
- writing components, and node_modules/@fusion.dev/helix/api.json for the API.
237
- ```
238
-
239
- | Tool | Where it goes |
240
- |---|---|
241
- | Claude Code | `.claude/skills/helix`, or a line in `AGENTS.md` or `CLAUDE.md` |
242
- | Cursor | `.cursor/rules/` |
243
- | GitHub Copilot | `.github/copilot-instructions.md` |
244
- | Anything else | Whatever it reads. The line is the same |
205
+ HTML that a CMS or a Markdown library writes, inside an element with
206
+ `data-prose`, takes Helix's typography from `@fusion.dev/helix-styles` and needs
207
+ no Helix elements. Everywhere else, write the Helix element.
245
208
 
246
- We do not write those files for you, and we chose this on purpose. You would
247
- have to maintain a file we generated in your repository against our changes. A
248
- tool that rewrote it on install would be a dependency you did not ask for, in a
249
- directory you own. You add the link or the line, and you can delete it.
209
+ ## Check the code you wrote
250
210
 
251
- ## Install the Helix MCP server
211
+ Run these after you write Helix code, and fix every finding at `error` and
212
+ `warn` before you finish. Each prints JSON with `--json`.
252
213
 
253
- ```sh
254
- helix mcp init --client claude
255
- ```
214
+ | Command | MCP tool | What it finds |
215
+ |---|---|---|
216
+ | `helix scan` | `helix_check` | Unknown tags, attributes, values, slots, parts, hooks, events, and tokens, a native element a Helix family replaces, a missing import, and the rest, each with its file and line |
217
+ | `helix diagnostics --once <url>` | `helix_check_page` | The same on the running page, and what the library logged as it ran |
218
+ | `helix theme audit` | `helix_audit_theme` | Every foreground and background pair in your theme that misses its contrast target |
256
219
 
257
- `helix mcp` answers from the Helix packages your project installs: families,
258
- examples, import lines, tokens, and the theme a brand color produces. `--client`
259
- takes `claude`, `cursor`, or `vscode`, and writes the server into the file that
260
- client reads. [Coding agents](./coding-agents) lists the tools. It runs on your
261
- machine, talks to a client you chose, and makes no network requests.
220
+ `helix scan --file <path>` reports one file's findings and still reads the whole
221
+ project, so an import in another file counts.
262
222
 
263
223
  ## What this guide does not cover
264
224
 
@@ -38,7 +38,7 @@ export const docPages = [
38
38
  title: 'Charting',
39
39
  },
40
40
  {
41
- description: 'The files an AI agent can read to write Helix code, and where to find each one.',
41
+ description: 'Install Helix for a coding agent, and the files an agent can read to write Helix code.',
42
42
  order: 4,
43
43
  section: 'Getting started',
44
44
  slug: 'coding-agents',
@@ -264,7 +264,7 @@ export const docPages = [
264
264
  title: 'Typography',
265
265
  },
266
266
  {
267
- description: 'Five mistakes that look like Helix bugs, and the files an agent should read.',
267
+ description: 'The rules an agent follows to write Helix code, and the five mistakes that look like Helix bugs.',
268
268
  parent: 'coding-agents',
269
269
  section: 'Getting started',
270
270
  slug: 'using-helix-with-an-agent',