@fusion.dev/helix-docs 0.241.3 → 0.242.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.
@@ -146,12 +146,127 @@ they settle.
146
146
  A graph layout that runs past five seconds also offers its own button, in the
147
147
  graph's frame, that stops it where the notes stand.
148
148
 
149
+ ## Rows, tags, and items that move
150
+
151
+ When you sort, add, remove, or hide the rows of a `List`, the tags of a
152
+ `Tag.Group`, the items of a `Tree`, the rows of `Notifications`, or the entries
153
+ of a `Timeline`, each one slides from where it was to where it is now. A tree's branch carries its rows with it. A `Table` or a Data
154
+ Table that sorts moves its rows the same way, each row's cells together, and a
155
+ Data Table needs `row-key` to know a row across the change. A row, a tag, or an
156
+ item you add fades in. A list you render again with all new elements appears
157
+ at once.
158
+
159
+ Each family times the move from two hooks of its own, which the styled tier
160
+ sets from the tokens:
161
+
162
+ | Hook | Default |
163
+ | --- | --- |
164
+ | `--list-move-duration`, `--tag-group-move-duration`, `--tree-move-duration`, `--table-move-duration`, `--data-table-move-duration`, `--notifications-move-duration`, `--timeline-move-duration` | `--helix-duration-normal` |
165
+ | `--list-move-easing`, `--tag-group-move-easing`, `--tree-move-easing`, `--table-move-easing`, `--data-table-move-easing`, `--notifications-move-easing`, `--timeline-move-easing` | `--helix-easing-standard` |
166
+
167
+ Set them on the element to change one list, or on a selector to change many:
168
+
169
+ ```css
170
+ helix-list {
171
+ --list-move-duration: 320ms;
172
+ --list-move-easing: var(--helix-easing-spring);
173
+ }
174
+ ```
175
+
176
+ `0ms` turns the move off. The headless tier sets none of the hooks, so its
177
+ rows do not move until you set them. With reduced motion set, nothing moves,
178
+ even where a hook holds a duration of its own.
179
+
180
+ `Toast` makes room for a message and closes the gap after one in its own
181
+ stylesheet, so its stack has no hooks of this kind.
182
+
183
+ ## The wash under the pointer
184
+
185
+ In `Navigation` and `Tabs`, the hover wash is one shape that glides from item
186
+ to item as a mouse or pen moves along the row, and fades out when the pointer
187
+ leaves. It takes the place of each item's own wash, in the same color, from
188
+ `--navigation-item-hover-background-color` or
189
+ `--tabs-tab-hover-background-color`. Arriving from outside the row, it appears
190
+ under the pointer without sliding. A touch draws no wash, and under reduced
191
+ motion the wash moves at once.
192
+
193
+ ## Figures that count
194
+
195
+ A new `value` on a `Stat` or a `Trend` counts to the new number from the one
196
+ before. A screen reader reads only the new number. The count takes
197
+ `--stat-count-duration` or `--trend-count-duration`, `--helix-duration-slow` by
198
+ default, along `--stat-count-easing` or `--trend-count-easing`,
199
+ `--helix-easing-decelerate` by default, so the figure slows as it arrives.
200
+ `0ms` changes the figure at once, as reduced motion does. A figure you put in
201
+ the slot changes at once.
202
+
203
+ The number a `Progress` or a `Meter` shows under `show-value` counts the same
204
+ way, at the pace of the fill, from `--progress-count-duration` and
205
+ `--meter-count-duration`, which the styled tier sets from the fill's own
206
+ duration. A `Badge` whose count changes swells and settles over
207
+ `--badge-bump-duration`.
208
+
209
+ ## Charts that follow their readings
210
+
211
+ When a chart's readings change, its marks move from the old readings to the
212
+ new: the bars of a `Bar Chart` and a `Sparkline`, the line and area of a
213
+ `Line Chart`, an `Area Chart` and a `Sparkline`, the slices of a
214
+ `Donut Chart`, and the points of a `Scatter Chart`. A `Heatmap` cell takes its
215
+ new color the same way. Every move uses `--helix-easing-decelerate`, which
216
+ never passes the value it is heading for, so no frame draws a reading the data
217
+ does not hold. The mark on the end of a line rides with it. Safari does not
218
+ transition a path's shape, so lines, areas, points, and the mark on a line's
219
+ end there take their new place at once.
220
+
149
221
  ## Starting styles and view transitions
150
222
 
151
223
  Overlays use `@starting-style` to animate in. It sets a starting value and needs
152
224
  no duration token of its own. The transition that runs from it uses the tokens
153
225
  above.
154
226
 
155
- The library does not use view transitions. A view transition runs between two
156
- states of the document, so a component cannot own one. If you want view
157
- transitions, start them from your own code.
227
+ Helix starts one view transition, when the page changes color mode. A view
228
+ transition draws the whole document twice and runs between the two pictures,
229
+ so a component that started one for its own sake would cancel the page's own,
230
+ or have its own canceled. The color mode belongs to the whole document, so
231
+ changing it is the one move that is the document's to make. `Theme Toggle` and
232
+ `setColorMode` from `@fusion.dev/helix-core` spread the new mode in a circle
233
+ from the button, wipe it across, or fade it, and change it at once under
234
+ reduced motion. Any other view transition is yours to start from your own
235
+ code, and the next section covers the one most sites want.
236
+
237
+ ## Moving between pages
238
+
239
+ A site can move from one page to the next as a fade or a slide. Import the
240
+ page transition sheet after `helix.css`, on every page that takes part:
241
+
242
+ ```css
243
+ @import '@fusion.dev/helix-styles/helix.css';
244
+ @import '@fusion.dev/helix-styles/page-transitions.css';
245
+ ```
246
+
247
+ A link to another page on the same origin then fades the new page over the
248
+ old one, with no script, in browsers with cross-document view transitions.
249
+ Other browsers load the new page as before. The sheet stays out of `helix.css`
250
+ because the rule that turns it on speaks for the whole document and cannot be
251
+ scoped, so it is a site's choice to make. Under reduced motion the sheet turns
252
+ nothing on.
253
+
254
+ For a slide, write `data-page-transition="slide"` on the `html` element of the
255
+ page being arrived at. The new page comes in from the inline end and the old
256
+ one leaves toward the inline start. `slide-back` travels the other way, for a
257
+ step back, and right-to-left pages mirror both. The move takes
258
+ `--helix-duration-slow`.
259
+
260
+ A router that changes the page in place, without loading a new document,
261
+ calls `changePage` from `@fusion.dev/helix-core` around the change:
262
+
263
+ ```ts
264
+ import { changePage } from '@fusion.dev/helix-core'
265
+
266
+ await changePage(() => router.show(next), { transition: 'slide' })
267
+ ```
268
+
269
+ It names the way for the length of the move, changes the page at once under
270
+ reduced motion or where the browser has no view transitions, and rejects
271
+ where the change does. To keep a header still while the rest of the page
272
+ moves, give it a `view-transition-name` of its own on every page.