@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.
- package/README.md +22 -2
- package/content/angular.mdx +37 -4
- package/content/browser-support.mdx +3 -3
- package/content/building-on-the-headless-tier.mdx +84 -21
- package/content/charting.mdx +50 -0
- package/content/coding-agents.mdx +2 -1
- package/content/color-modes.mdx +2 -2
- package/content/color.mdx +35 -5
- package/content/diagnostics.mdx +255 -0
- package/content/graphs.mdx +6 -0
- package/content/iconography.mdx +31 -13
- package/content/installation.mdx +34 -10
- package/content/intent-reference.mdx +27 -3
- package/content/introduction.mdx +3 -2
- package/content/localization.mdx +86 -4
- package/content/maps.mdx +68 -14
- package/content/metrics.mdx +252 -249
- package/content/other-frameworks.mdx +52 -12
- package/content/overriding-a-component.mdx +11 -10
- package/content/react.mdx +15 -1
- package/content/recipes.mdx +18 -2
- package/content/sandbox.mdx +75 -25
- package/content/server-rendering.mdx +2 -2
- package/content/state-and-control.mdx +7 -1
- package/content/surfaces-and-separation.mdx +2 -1
- package/content/svelte.mdx +54 -8
- package/content/theme-builder.mdx +15 -3
- package/content/theming.mdx +5 -1
- package/content/tiers.mdx +15 -14
- package/content/using-helix-with-an-agent.mdx +12 -5
- package/content/using-the-elements.mdx +24 -23
- package/content/versioning.mdx +15 -8
- package/content/visual-axes.mdx +11 -4
- package/content/vue.mdx +28 -1
- package/content/without-a-bundler.mdx +9 -7
- package/dist/index.d.ts +1 -3
- package/dist/index.js +0 -1
- package/dist/pages.generated.js +7 -1
- package/dist/reference.d.ts +70 -6
- package/dist/reference.js +13 -2
- package/dist/sources.generated.js +1346 -459
- 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
|
|
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.
|
|
222
|
-
in time, so
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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. `
|
|
229
|
-
|
|
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
|
-
|
|
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
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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
|