@fusion.dev/helix-docs 0.144.0 → 0.145.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.
@@ -98,6 +98,8 @@ The fields with a panel behave the same way:
98
98
  leaves the field, and `Escape` returns focus to the field.
99
99
  - Opening one of those panels from its trigger, or with `ArrowDown`, moves
100
100
  focus into the panel.
101
+ - Inside one of those panels, `Tab` moves between the panel's controls and
102
+ does not leave the panel.
101
103
 
102
104
  **A tooltip never takes focus.** A tooltip only describes a control, so it
103
105
  cannot contain a button. For something with a button in it, use a `Popover`.
@@ -62,6 +62,30 @@ loading state, no pressed state, and no `type="submit"` handling.
62
62
  navigation, where an underline on every row would distract. If a link opens a
63
63
  new tab or window, say so in the link text, so it does not surprise your users.
64
64
 
65
+ ## Navigation items
66
+
67
+ ```html
68
+ <helix-navigation label="Sections">
69
+ <a
70
+ aria-current="page"
71
+ href="/guide"
72
+ >Guide</a>
73
+ <a href="/api">API</a>
74
+ </helix-navigation>
75
+ <button data-navigation-item>Menu</button>
76
+ ```
77
+
78
+ A link inside `helix-navigation` is styled by the page's stylesheet, because the
79
+ page's styles reach a slotted link before the component's do.
80
+ `data-navigation-item` gives the same look to an element outside a navigation
81
+ bar. Two custom properties set the text color:
82
+
83
+ - `--navigation-item-color` colors every destination except the current one.
84
+ - `--navigation-item-current-color` colors the destination marked
85
+ `aria-current="page"`.
86
+
87
+ Set them on `helix-navigation` or on any element that contains it.
88
+
65
89
  ## Surfaces and layout
66
90
 
67
91
  ```html
@@ -72,6 +72,15 @@ In a source pane, Tab inserts two spaces. Shift+Tab moves focus back, and
72
72
  Escape then Tab moves it forward. The field's description says this to a
73
73
  screen reader.
74
74
 
75
+ Each request has a notification once it is applied: `helix-edit` after
76
+ `helix-before-edit`, `helix-split` after `helix-before-split`, and
77
+ `helix-panel-resize` after `helix-before-panel-resize`. Listen for these to
78
+ store the arrangement or the source.
79
+
80
+ Set `controls` on `helix-sandbox-terminal` for a clear button and a level
81
+ filter above the log. Without them, `clear()` empties the log, and `level`
82
+ hides the quieter lines.
83
+
75
84
  ## The frame document
76
85
 
77
86
  `helix-sandbox-preview` loads `src` into a sandboxed frame. You provide that
@@ -94,9 +103,13 @@ its own frame, and only from an opaque origin, so the frame keeps the sandbox
94
103
  it was given. The types are exported from `@fusion.dev/helix/sandbox` as
95
104
  `PreviewMessage` and its members.
96
105
 
97
- A minimal frame follows. `/helix.css` is the stylesheet from
98
- `@fusion.dev/helix-styles`, and `/elements.js` is a classic script that
99
- registers your elements, for the reason under "How the preview is isolated".
106
+ `servePreview` from `@fusion.dev/helix/sandbox` is that protocol, written for
107
+ you. Call it once in the frame document, after your elements are defined. It
108
+ writes each render into `#preview-root`, runs the example's scripts, relays
109
+ its console, reports its height and its presses, and adds the rules for the
110
+ four layouts. A frame follows. `/helix.css` is the stylesheet from
111
+ `@fusion.dev/helix-styles`, and `/frame.js` is a classic script you bundle,
112
+ for the reason under "How the preview is isolated":
100
113
 
101
114
  ```html
102
115
  <!doctype html>
@@ -104,21 +117,24 @@ registers your elements, for the reason under "How the preview is isolated".
104
117
  href="/helix.css"
105
118
  rel="stylesheet"
106
119
  >
120
+ <div id="preview-root"></div>
107
121
  <script
108
122
  defer
109
- src="/elements.js"
123
+ src="/frame.js"
110
124
  ></script>
111
- <style id="example-styles"></style>
112
- <script defer>
113
- addEventListener('message', ({ data }) => {
114
- if (data?.type !== 'helix-preview-render') return
115
- document.getElementById('example-styles').textContent = data.styles
116
- document.body.innerHTML = data.source
117
- })
118
- parent.postMessage({ type: 'helix-preview-ready' }, '*')
119
- </script>
120
125
  ```
121
126
 
127
+ ```ts
128
+ // frame.ts, bundled to /frame.js as a classic script
129
+ import '@fusion.dev/helix' // registers every family, because an example can use any of them
130
+ import { servePreview } from '@fusion.dev/helix/sandbox'
131
+
132
+ servePreview()
133
+ ```
134
+
135
+ Pass `onReplace` to take down what an example mounted before the next one
136
+ replaces it, and `onRender` to act after each render, such as mounting a map.
137
+
122
138
  ## Console output from the example
123
139
 
124
140
  Logs from the example appear in the console panel. Logs from the page around it