@fusion.dev/helix-docs 0.206.0 → 0.207.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.
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 +68 -14
  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 +1346 -459
  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,57 @@ 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
222
- in time, so a snapshot is whole or absent and the map draws in its place. Each
228
+ change. Its `picture` is an empty string when any tile it needs cannot be read
229
+ in time, so the picture 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 `picture` 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. When a tile cannot be
243
+ read, the credit stays and `markup` is the credit alone, so write `markup`
244
+ whether or not the picture was drawn.
245
+
246
+ A snapshot also holds the two apart: `picture`, the map alone, and `credit`,
247
+ the credit as runs of words and links, each `{ text }` or `{ href, text }`.
248
+ In a framework that renders the markup for you, such as React, put `picture`
227
249
  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.
250
+ `data-helix-map-snapshot` attribute. Write `credit` in a
251
+ `<span slot="attribution" data-helix-map-credit>`, also a direct child of the
252
+ frame:
253
+
254
+ ```jsx
255
+ <helix-map label="Downtown Austin">
256
+ <div id="map" />
257
+ <div dangerouslySetInnerHTML={{ __html: snapshot.picture }} data-helix-map-snapshot="" />
258
+ {snapshot.credit.length > 0 ? (
259
+ <span data-helix-map-credit="" slot="attribution">
260
+ {snapshot.credit.map((part, index) =>
261
+ part.href ? (
262
+ <a data-link="quiet" href={part.href} key={index} rel="noopener noreferrer" target="_blank">
263
+ {part.text}
264
+ </a>
265
+ ) : (
266
+ part.text
267
+ ),
268
+ )}
269
+ </span>
270
+ ) : null}
271
+ </helix-map>
272
+ ```
273
+
274
+ `connectMap` hides both elements, and leaves removing them to your framework.
275
+
276
+ A credit you slot yourself, with no `data-helix-map-credit`, wins. Write
277
+ `picture` alone beside it. A snapshot credit already in the frame is hidden
278
+ when `connectMap` connects.
230
279
 
231
280
  A snapshot is a flat map. A map zoomed out past about 6 is a globe in MapLibre,
232
281
  so draw snapshots of city and street views.
@@ -304,7 +353,9 @@ finished.
304
353
  | `helix-map-contours` | Contour lines, each at one height |
305
354
  | `helix-map-landcover` | What covers the ground: forest, grass, farmland, sand, rock, and ice |
306
355
 
307
- Each element takes `tone`, such as `primary` or `danger`, for its color.
356
+ Markers, routes, areas, positions, points, and buildings take `tone`, such as
357
+ `primary` or `danger`, for their color. Raster tiles keep their own colors, and
358
+ terrain, contours, and landcover take theirs from your theme.
308
359
 
309
360
  ### Markers
310
361
 
@@ -319,11 +370,14 @@ Each element takes `tone`, such as `primary` or `danger`, for its color.
319
370
  </helix-map-marker>
320
371
  ```
321
372
 
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.
373
+ A marker is a button placed at its latitude and longitude. Its point is as
374
+ large as the map's landmarks, in your primary color, with a dot in the middle
375
+ and a halo of the same color around it, so your places stand out from the
376
+ landmarks. Its `label` appears when you hover over or focus the marker. The
377
+ `icon` slot holds a letter, a number, or an icon in place of the dot, and
378
+ `shape` sets the marker's form: `ring`, `rounded`, `square`, `diamond`, or
379
+ `pin`. Pressing a marker sends `helix-activate` from the frame with the
380
+ marker's `name`, or its `label` if it has no name.
327
381
 
328
382
  To show that a place has been visited, add `passed`. The marker is drawn in a
329
383
  muted color, and screen readers hear its name followed by "passed". Use