@fusion.dev/helix-docs 0.144.0 → 0.146.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.
- package/content/accessibility.mdx +11 -4
- package/content/building-on-the-headless-tier.mdx +4 -2
- package/content/localization.mdx +3 -3
- package/content/metrics.mdx +224 -224
- package/content/overlays.mdx +19 -6
- package/content/recipes.mdx +24 -0
- package/content/sandbox.mdx +29 -13
- package/content/state-and-control.mdx +7 -5
- package/dist/sources.generated.js +321 -257
- package/package.json +9 -9
package/content/overlays.mdx
CHANGED
|
@@ -78,14 +78,16 @@ press `Escape` again.
|
|
|
78
78
|
|
|
79
79
|
A modal overlay keeps `Tab` inside itself while it is open, and it returns focus
|
|
80
80
|
to the element that opened it. `Dialog` does this, and so does `Drawer` unless
|
|
81
|
-
you set `modal="false"`.
|
|
81
|
+
you set `modal="false"`. Set `dismissible` on either to draw a close control in
|
|
82
|
+
the corner by the title. The page behind a modal `Dialog` or `Drawer` does not
|
|
82
83
|
scroll while it is open.
|
|
83
84
|
|
|
84
85
|
Opening a `Popover` moves focus to the first control in its panel, or to the
|
|
85
86
|
panel where it holds none, and closing it from inside gives focus back to the
|
|
86
|
-
trigger. It does not trap focus
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
trigger, however it closes, setting `open` included. It does not trap focus
|
|
88
|
+
unless you set `modal`, which keeps `Tab` in the panel until it closes and hides
|
|
89
|
+
the rest of the page from screen readers meanwhile. When focus moves out of its
|
|
90
|
+
trigger and its panel, the popover closes.
|
|
89
91
|
|
|
90
92
|
Press F8 to move focus to the `Toast` stack, and press it again to go back.
|
|
91
93
|
Set `hotkey` on the stack to use another key. The stack's name says which key
|
|
@@ -98,6 +100,8 @@ The fields with a panel behave the same way:
|
|
|
98
100
|
leaves the field, and `Escape` returns focus to the field.
|
|
99
101
|
- Opening one of those panels from its trigger, or with `ArrowDown`, moves
|
|
100
102
|
focus into the panel.
|
|
103
|
+
- Inside one of those panels, `Tab` moves between the panel's controls and
|
|
104
|
+
does not leave the panel.
|
|
101
105
|
|
|
102
106
|
**A tooltip never takes focus.** A tooltip only describes a control, so it
|
|
103
107
|
cannot contain a button. For something with a button in it, use a `Popover`.
|
|
@@ -107,6 +111,9 @@ names it with `for`. A Helix trigger is described as soon as it has rendered.
|
|
|
107
111
|
A plain element in your markup is described the first time a reader points at
|
|
108
112
|
it or focuses it, so the link is never written into markup your server sent.
|
|
109
113
|
Write `aria-describedby` yourself to have the link in the server's markup.
|
|
114
|
+
The pointer can move onto a tooltip's bubble and the bubble stays, so a reader
|
|
115
|
+
can read it under a magnifier. Set `hoverable="false"` to hide it once the
|
|
116
|
+
pointer reaches it.
|
|
110
117
|
|
|
111
118
|
## Keep an overlay open
|
|
112
119
|
|
|
@@ -141,9 +148,15 @@ finished. Select on them to draw an entrance or an exit of your own.
|
|
|
141
148
|
A touch or a pen swipes a `Drawer` toward the edge it came from, and a `Toast`
|
|
142
149
|
message toward the end of the line. A swipe past halfway, or a quick one, closes
|
|
143
150
|
it through the same cancelable request as its close control. A `Drawer` with
|
|
144
|
-
`snap-points` comes to rest at the nearest point, such as half open
|
|
151
|
+
`snap-points` comes to rest at the nearest point, such as half open, and
|
|
152
|
+
`:state(snapped)` holds while it rests short of the whole panel. Moving focus
|
|
153
|
+
with `Tab` to a control past the edge of the window opens it the rest of the
|
|
154
|
+
way, and `snapTo()` moves it from script. In a
|
|
145
155
|
`Lightbox`, a swipe across the viewer shows the next or the previous item. A
|
|
146
|
-
mouse never swipes, because dragging with a mouse selects text.
|
|
156
|
+
mouse never swipes, because dragging with a mouse selects text. A `Lightbox`
|
|
157
|
+
with `max-zoom` also zooms: pinch the item, or double click or double tap it,
|
|
158
|
+
and drag it about once zoomed. It swipes only while the item is at its own
|
|
159
|
+
size.
|
|
147
160
|
|
|
148
161
|
## Choose an overlay
|
|
149
162
|
|
package/content/recipes.mdx
CHANGED
|
@@ -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
|
package/content/sandbox.mdx
CHANGED
|
@@ -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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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="/
|
|
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
|
|
@@ -106,11 +106,13 @@ current value. The pair comes from the platform. A native input reflects its
|
|
|
106
106
|
`value` *content attribute* to `defaultValue`, and it keeps a dirty flag. Once a
|
|
107
107
|
user has typed, the flag stops the attribute from changing the value.
|
|
108
108
|
|
|
109
|
-
**A form reset
|
|
110
|
-
`<input value="Ada">`
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
`
|
|
109
|
+
**A form reset returns to a `value` or `checked` you wrote in markup**, as it
|
|
110
|
+
does on a native control: `<input value="Ada">` and `<helix-input value="Ada">`
|
|
111
|
+
both reset to `Ada`. Where `default-value` or `default-checked` is written, the
|
|
112
|
+
reset returns to that instead. The attribute is read at the reset, and a
|
|
113
|
+
framework that sets `value` as a property writes no attribute, so write the
|
|
114
|
+
starting value of a form control as `default-value`, or `default-checked` for a
|
|
115
|
+
checkbox or a switch, when a reset has to return to it.
|
|
114
116
|
|
|
115
117
|
## State is published as a custom state
|
|
116
118
|
|