@fusion.dev/helix-docs 0.23.0 → 0.24.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.
- package/content/charting.mdx +26 -5
- package/content/intent-reference.mdx +1 -1
- package/content/metrics.mdx +219 -209
- package/content/react.mdx +1 -1
- package/content/recipes.mdx +11 -0
- package/content/server-rendering.mdx +55 -2
- package/content/using-the-elements.mdx +5 -5
- package/content/visual-axes.mdx +1 -1
- package/dist/sources.generated.js +319 -224
- package/package.json +2 -2
package/content/react.mdx
CHANGED
|
@@ -132,7 +132,7 @@ Render it once in your layout. **Your pages stay server components.** An
|
|
|
132
132
|
unregistered tag is an unknown element in the HTML that upgrades when the
|
|
133
133
|
definition lands, so nothing about a server component needs to change.
|
|
134
134
|
|
|
135
|
-
##
|
|
135
|
+
## Server components get no declarative shadow DOM
|
|
136
136
|
|
|
137
137
|
A server component's output is replayed from the flight payload through DOM APIs
|
|
138
138
|
rather than parsed as HTML, and declarative shadow DOM cannot activate for
|
package/content/recipes.mdx
CHANGED
|
@@ -100,6 +100,17 @@ scroll pays continuously. Where the effect is about depth rather than texture,
|
|
|
100
100
|
Headings take the type scale, paragraphs take the measure and leading, lists and
|
|
101
101
|
links and inline code all follow. See [Typography](./typography).
|
|
102
102
|
|
|
103
|
+
If you own the markdown renderer, map two things to components, because markup
|
|
104
|
+
can't carry what they need:
|
|
105
|
+
|
|
106
|
+
- **Fenced code** to `helix-code-block`, with the fence's language as its `label`.
|
|
107
|
+
A `<pre>` has no label or copy button.
|
|
108
|
+
- **Alerts** such as `> [!WARNING]` to `helix-callout`. A `<blockquote>` has no
|
|
109
|
+
tone. `NOTE` and `IMPORTANT` become `tone="info"`, `TIP` becomes `success`,
|
|
110
|
+
`WARNING` becomes `warning`, and `CAUTION` becomes `danger`.
|
|
111
|
+
|
|
112
|
+
Prose spaces each one the same as the element it replaces.
|
|
113
|
+
|
|
103
114
|
## Region axes
|
|
104
115
|
|
|
105
116
|
These two are API rather than styling, and they are the reason the base layer is
|
|
@@ -36,8 +36,61 @@ Before those two guards, neither component could be server-rendered at all. Both
|
|
|
36
36
|
looked correct in every browser, because the client always has a root and always
|
|
37
37
|
has a tree.
|
|
38
38
|
|
|
39
|
-
**Anything that inspects the tree
|
|
40
|
-
|
|
39
|
+
**Anything that inspects the tree reads it through `this.knownChildren`**, in
|
|
40
|
+
`willUpdate` or in a getter the render calls. It is every child on a client and
|
|
41
|
+
none on a server, so the server renders "not known yet" and the client's first
|
|
42
|
+
render already has the answer. Reading after the render instead means two
|
|
43
|
+
renders on every client, which Lit's dev build warns about.
|
|
44
|
+
|
|
45
|
+
Not known is not empty. `this.childrenKnown` is false on a server, and a list
|
|
46
|
+
there doesn't render its "Nothing to show" over items it can't see.
|
|
47
|
+
|
|
48
|
+
## Declarative shadow DOM
|
|
49
|
+
|
|
50
|
+
If you render with Lit SSR, its declarative shadow DOM hydrates. Load Lit's
|
|
51
|
+
hydration support before the components:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import '@lit-labs/ssr-client/lit-element-hydrate-support.js'
|
|
55
|
+
import '@fusion.dev/helix'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Hydration assumes the markup already shows the client's first render. A value
|
|
59
|
+
that differs is never written, so the page keeps the server's, and a template
|
|
60
|
+
that differs throws. So while hydrating, a component renders exactly what the
|
|
61
|
+
server did, and anything it could only learn in a browser waits for the update
|
|
62
|
+
after:
|
|
63
|
+
|
|
64
|
+
- `this.hydrating` is true for the render that hydrates.
|
|
65
|
+
- `this.knownChildren` is empty during it, as on the server.
|
|
66
|
+
- `this.finishHydration()`, called from `firstUpdated`, asks for the update that
|
|
67
|
+
reads what was skipped.
|
|
68
|
+
|
|
69
|
+
Two things the platform does before any script can listen, and how components
|
|
70
|
+
answer them:
|
|
71
|
+
|
|
72
|
+
- **A declarative shadow root reports its slots as it is parsed.** A component
|
|
73
|
+
never learns what's slotted from `slotchange` alone. It reads its children
|
|
74
|
+
first and uses `slotchange` for later changes.
|
|
75
|
+
- **The parser fetches images.** A `load` or `error` can fire before hydration,
|
|
76
|
+
so a component asks the image what happened (`this.serverRendered`) and relays
|
|
77
|
+
the event a task later.
|
|
78
|
+
|
|
79
|
+
A component that assigns its slots by hand gets a root that can only assign by
|
|
80
|
+
name, because HTML can't declare manual assignment. On such a root
|
|
81
|
+
(`this.assignsByName`) it writes `slot` onto its children with `this.route()`,
|
|
82
|
+
and only there.
|
|
83
|
+
|
|
84
|
+
A page's own scripts should run after the definitions load. That's the order
|
|
85
|
+
hydration expects: a property set before hydration is one the server never
|
|
86
|
+
rendered with.
|
|
87
|
+
|
|
88
|
+
`bun run check:spec:dsd` renders every example with Lit SSR, hydrates it in
|
|
89
|
+
Chromium, and compares it with the same example rendered on a client.
|
|
90
|
+
|
|
91
|
+
React server components don't use any of this. Their output is replayed through
|
|
92
|
+
DOM APIs, and DSD doesn't activate for nodes a script inserts. See
|
|
93
|
+
[React](./react).
|
|
41
94
|
|
|
42
95
|
## Never initialize state in `connectedCallback`
|
|
43
96
|
|
|
@@ -110,12 +110,12 @@ import '@fusion.dev/helix' // ❌ the barrel
|
|
|
110
110
|
|
|
111
111
|
One family per module, so you are not shipping the library to use a button.
|
|
112
112
|
|
|
113
|
-
##
|
|
113
|
+
## Declarative shadow DOM is opt-in
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
The site ships no DSD, and the shadow styles arrive with the definition rather
|
|
116
|
+
than in the markup. You don't need to configure anything for that. If you render
|
|
117
|
+
with Lit SSR yourself, its declarative shadow DOM hydrates: see
|
|
118
|
+
[Server rendering](./server-rendering).
|
|
119
119
|
|
|
120
120
|
The short version of why: DSD cannot activate for script-inserted nodes, a
|
|
121
121
|
server component's output is replayed from the flight payload through DOM APIs
|
package/content/visual-axes.mdx
CHANGED
|
@@ -11,7 +11,7 @@ vocabularies. You cannot invent a value, and a component may take a subset.
|
|
|
11
11
|
|
|
12
12
|
| Axis | Values |
|
|
13
13
|
|---|---|
|
|
14
|
-
| `emphasis` | `ghost`, `outlined`, `solid`, `subtle` |
|
|
14
|
+
| `emphasis` | `ghost`, `muted`, `outlined`, `solid`, `subtle` |
|
|
15
15
|
| `material` | `frosted`, `glass`, `transparent` |
|
|
16
16
|
| `separation` | `elevated`, `filled`, `outlined`, `plain` |
|
|
17
17
|
| `tone` | The status and intent words: `primary`, `accent`, `neutral`, `danger`, and so on |
|