@fusion.dev/helix-docs 0.206.0 → 0.207.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.
Files changed (42) hide show
  1. package/README.md +22 -2
  2. package/content/angular.mdx +37 -4
  3. package/content/browser-support.mdx +3 -3
  4. package/content/building-on-the-headless-tier.mdx +84 -21
  5. package/content/charting.mdx +50 -0
  6. package/content/coding-agents.mdx +2 -1
  7. package/content/color-modes.mdx +2 -2
  8. package/content/color.mdx +35 -5
  9. package/content/diagnostics.mdx +255 -0
  10. package/content/graphs.mdx +6 -0
  11. package/content/iconography.mdx +31 -13
  12. package/content/installation.mdx +34 -10
  13. package/content/intent-reference.mdx +27 -3
  14. package/content/introduction.mdx +3 -2
  15. package/content/localization.mdx +86 -4
  16. package/content/maps.mdx +65 -13
  17. package/content/metrics.mdx +252 -249
  18. package/content/other-frameworks.mdx +52 -12
  19. package/content/overriding-a-component.mdx +11 -10
  20. package/content/react.mdx +15 -1
  21. package/content/recipes.mdx +18 -2
  22. package/content/sandbox.mdx +75 -25
  23. package/content/server-rendering.mdx +2 -2
  24. package/content/state-and-control.mdx +7 -1
  25. package/content/surfaces-and-separation.mdx +2 -1
  26. package/content/svelte.mdx +54 -8
  27. package/content/theme-builder.mdx +15 -3
  28. package/content/theming.mdx +5 -1
  29. package/content/tiers.mdx +15 -14
  30. package/content/using-helix-with-an-agent.mdx +12 -5
  31. package/content/using-the-elements.mdx +24 -23
  32. package/content/versioning.mdx +15 -8
  33. package/content/visual-axes.mdx +11 -4
  34. package/content/vue.mdx +28 -1
  35. package/content/without-a-bundler.mdx +9 -7
  36. package/dist/index.d.ts +1 -3
  37. package/dist/index.js +0 -1
  38. package/dist/pages.generated.js +7 -1
  39. package/dist/reference.d.ts +70 -6
  40. package/dist/reference.js +13 -2
  41. package/dist/sources.generated.js +1343 -458
  42. package/package.json +13 -12
package/content/maps.mdx CHANGED
@@ -124,6 +124,11 @@ theme. Map labels meet a contrast target of 4.5 against the land. Pass
124
124
  `contrast` to change it, `language` to choose which name each place is labeled
125
125
  with, and `tiles` and `glyphs` to use your own tile server.
126
126
 
127
+ The tiles come from OpenFreeMap unless you pass `tiles`, and so do the glyphs
128
+ unless you pass `glyphs` or `font`. OpenFreeMap needs no key. Your reader's
129
+ browser requests the map's tiles and glyphs from OpenFreeMap's servers, and
130
+ `mapSnapshot` requests its tiles from them on your server.
131
+
127
132
  Pass `font` to draw the labels in your theme's typeface. MapLibre draws the
128
133
  letters in the page from the font your page has loaded, so there are no glyph
129
134
  files to fetch. `mapFontFrom(frame)` reads the typeface from your theme, and
@@ -131,6 +136,8 @@ files to fetch. `mapFontFrom(frame)` reads the typeface from your theme, and
131
136
  create the map, because MapLibre keeps each letter as first drawn:
132
137
 
133
138
  ```js
139
+ import { fontReady, mapFontFrom } from '@fusion.dev/helix-map'
140
+
134
141
  const font = mapFontFrom(frame)
135
142
  await fontReady(font)
136
143
  const map = new maplibregl.Map({ container: 'map', style: mapLibreStyle(colors, { font }) })
@@ -210,7 +217,7 @@ const view = {
210
217
  zoom: 14,
211
218
  }
212
219
  const snapshot = await mapSnapshot(view)
213
- // Inside helix-map, after <div id="map"></div>, write the snapshot's markup.
220
+ // Inside helix-map, after <div id="map"></div>, write snapshot.markup.
214
221
  ```
215
222
 
216
223
  Give MapLibre the same `center`, `zoom`, `pitch`, and `bearing`, and the snapshot
@@ -218,15 +225,55 @@ lines up with the map that replaces it. `width` and `height` are the box it is
218
225
  drawn for, and a smaller box shows its middle. A snapshot draws the land, water,
219
226
  parks, buildings, and roads, and leaves the labels to MapLibre. Its colors are
220
227
  your theme's tokens, so it is light or dark with the page and follows a theme
221
- change. It resolves to an empty string when any tile it needs cannot be read
228
+ change. Its `markup` is an empty string when any tile it needs cannot be read
222
229
  in time, so a snapshot is whole or absent and the map draws in its place. Each
223
230
  request is given `timeout` milliseconds, 3000 by default. Cache only a snapshot
224
- that is not empty.
225
-
226
- In a framework that renders the markup for you, such as React, put the snapshot
231
+ whose `markup` is not empty.
232
+
233
+ A snapshot reads OpenFreeMap's tiles from your server by default. Pass the
234
+ `tiles` you give `mapLibreStyle` as `mapSnapshot(view, { tiles })` to read
235
+ your own.
236
+
237
+ **The snapshot carries the map credit.** Most tile licenses require the credit
238
+ wherever the map is shown, including before MapLibre loads and on a page that
239
+ never loads it. `markup` is the picture followed by the credit your tiles
240
+ name, in a `<span slot="attribution">` marked `data-helix-map-credit`, so the
241
+ frame shows the credit from the first paint. `connectMap` hides that credit
242
+ once it writes MapLibre's, which names the same tiles.
243
+
244
+ A snapshot also holds the two apart: `picture`, the map alone, and `credit`,
245
+ the credit as runs of words and links, each `{ text }` or `{ href, text }`.
246
+ In a framework that renders the markup for you, such as React, put `picture`
227
247
  in an element that is a direct child of the frame and has the
228
- `data-helix-map-snapshot` attribute. `connectMap` hides that element, and leaves
229
- removing it to your framework.
248
+ `data-helix-map-snapshot` attribute. Write `credit` in a
249
+ `<span slot="attribution" data-helix-map-credit>`, also a direct child of the
250
+ frame:
251
+
252
+ ```jsx
253
+ <helix-map label="Downtown Austin">
254
+ <div id="map" />
255
+ <div dangerouslySetInnerHTML={{ __html: snapshot.picture }} data-helix-map-snapshot="" />
256
+ {snapshot.credit.length > 0 ? (
257
+ <span data-helix-map-credit="" slot="attribution">
258
+ {snapshot.credit.map((part, index) =>
259
+ part.href ? (
260
+ <a data-link="quiet" href={part.href} key={index} rel="noopener noreferrer" target="_blank">
261
+ {part.text}
262
+ </a>
263
+ ) : (
264
+ part.text
265
+ ),
266
+ )}
267
+ </span>
268
+ ) : null}
269
+ </helix-map>
270
+ ```
271
+
272
+ `connectMap` hides both elements, and leaves removing them to your framework.
273
+
274
+ A credit you slot yourself, with no `data-helix-map-credit`, wins. Write
275
+ `picture` alone beside it. A snapshot credit already in the frame is hidden
276
+ when `connectMap` connects.
230
277
 
231
278
  A snapshot is a flat map. A map zoomed out past about 6 is a globe in MapLibre,
232
279
  so draw snapshots of city and street views.
@@ -304,7 +351,9 @@ finished.
304
351
  | `helix-map-contours` | Contour lines, each at one height |
305
352
  | `helix-map-landcover` | What covers the ground: forest, grass, farmland, sand, rock, and ice |
306
353
 
307
- Each element takes `tone`, such as `primary` or `danger`, for its color.
354
+ Markers, routes, areas, positions, points, and buildings take `tone`, such as
355
+ `primary` or `danger`, for their color. Raster tiles keep their own colors, and
356
+ terrain, contours, and landcover take theirs from your theme.
308
357
 
309
358
  ### Markers
310
359
 
@@ -319,11 +368,14 @@ Each element takes `tone`, such as `primary` or `danger`, for its color.
319
368
  </helix-map-marker>
320
369
  ```
321
370
 
322
- A marker is a button placed at its latitude and longitude. Its `label` appears
323
- when you hover over or focus the marker. The `icon` slot holds a letter, a
324
- number, or an icon, and `shape` sets the marker's form: `ring`, `rounded`,
325
- `square`, `diamond`, or `pin`. Pressing a marker sends `helix-activate` from the
326
- frame with the marker's `name`, or its `label` if it has no name.
371
+ A marker is a button placed at its latitude and longitude. Its point is as
372
+ large as the map's landmarks, in your primary color, with a dot in the middle
373
+ and a halo of the same color around it, so your places stand out from the
374
+ landmarks. Its `label` appears when you hover over or focus the marker. The
375
+ `icon` slot holds a letter, a number, or an icon in place of the dot, and
376
+ `shape` sets the marker's form: `ring`, `rounded`, `square`, `diamond`, or
377
+ `pin`. Pressing a marker sends `helix-activate` from the frame with the
378
+ marker's `name`, or its `label` if it has no name.
327
379
 
328
380
  To show that a place has been visited, add `passed`. The marker is drawn in a
329
381
  muted color, and screen readers hear its name followed by "passed". Use