@fusion.dev/helix-docs 0.106.0 → 0.107.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.
package/content/maps.mdx CHANGED
@@ -128,6 +128,42 @@ changes its theme another way, such as by replacing a stylesheet, call
128
128
  a frame or two after the page loads. If the colors never become available, it
129
129
  reports which one is missing.
130
130
 
131
+ ## Draw the map before it loads
132
+
133
+ `mapSnapshot(view)` draws the map on your server as an SVG, from the same tiles
134
+ and in the same colors as `mapLibreStyle`. Put it in the frame after the element
135
+ MapLibre draws in, and the page shows a map from its first paint. `connectMap`
136
+ fades it out once MapLibre has drawn its tiles.
137
+
138
+ ```js
139
+ import { mapSnapshot } from '@fusion.dev/helix-map/snapshot'
140
+
141
+ const view = {
142
+ center: { lat: 30.27, lng: -97.74 },
143
+ height: 700,
144
+ pitch: 45,
145
+ width: 1200,
146
+ zoom: 14,
147
+ }
148
+ const snapshot = await mapSnapshot(view)
149
+ // Inside helix-map, after <div id="map"></div>, write the snapshot's markup.
150
+ ```
151
+
152
+ Give MapLibre the same `center`, `zoom`, `pitch`, and `bearing`, and the snapshot
153
+ lines up with the map that replaces it. `width` and `height` are the box it is
154
+ drawn for, and a smaller box shows its middle. A snapshot draws the land, water,
155
+ parks, buildings, and roads, and leaves the labels to MapLibre. Its colors are
156
+ your theme's tokens, so it is light or dark with the page and follows a theme
157
+ change. It resolves to an empty string when the tiles cannot be read.
158
+
159
+ In a framework that renders the markup for you, such as React, put the snapshot
160
+ in an element that is a direct child of the frame and has the
161
+ `data-helix-map-snapshot` attribute. `connectMap` hides that element, and leaves
162
+ removing it to your framework.
163
+
164
+ A snapshot is a flat map. A map zoomed out past about 6 is a globe in MapLibre,
165
+ so draw snapshots of city and street views.
166
+
131
167
  ## What you can add to a map
132
168
 
133
169
  | Element | What it adds |
@@ -2403,6 +2403,42 @@ changes its theme another way, such as by replacing a stylesheet, call
2403
2403
  a frame or two after the page loads. If the colors never become available, it
2404
2404
  reports which one is missing.
2405
2405
 
2406
+ ## Draw the map before it loads
2407
+
2408
+ \`mapSnapshot(view)\` draws the map on your server as an SVG, from the same tiles
2409
+ and in the same colors as \`mapLibreStyle\`. Put it in the frame after the element
2410
+ MapLibre draws in, and the page shows a map from its first paint. \`connectMap\`
2411
+ fades it out once MapLibre has drawn its tiles.
2412
+
2413
+ \`\`\`js
2414
+ import { mapSnapshot } from '@fusion.dev/helix-map/snapshot'
2415
+
2416
+ const view = {
2417
+ center: { lat: 30.27, lng: -97.74 },
2418
+ height: 700,
2419
+ pitch: 45,
2420
+ width: 1200,
2421
+ zoom: 14,
2422
+ }
2423
+ const snapshot = await mapSnapshot(view)
2424
+ // Inside helix-map, after <div id="map"></div>, write the snapshot's markup.
2425
+ \`\`\`
2426
+
2427
+ Give MapLibre the same \`center\`, \`zoom\`, \`pitch\`, and \`bearing\`, and the snapshot
2428
+ lines up with the map that replaces it. \`width\` and \`height\` are the box it is
2429
+ drawn for, and a smaller box shows its middle. A snapshot draws the land, water,
2430
+ parks, buildings, and roads, and leaves the labels to MapLibre. Its colors are
2431
+ your theme's tokens, so it is light or dark with the page and follows a theme
2432
+ change. It resolves to an empty string when the tiles cannot be read.
2433
+
2434
+ In a framework that renders the markup for you, such as React, put the snapshot
2435
+ in an element that is a direct child of the frame and has the
2436
+ \`data-helix-map-snapshot\` attribute. \`connectMap\` hides that element, and leaves
2437
+ removing it to your framework.
2438
+
2439
+ A snapshot is a flat map. A map zoomed out past about 6 is a globe in MapLibre,
2440
+ so draw snapshots of city and street views.
2441
+
2406
2442
  ## What you can add to a map
2407
2443
 
2408
2444
  | Element | What it adds |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-docs",
3
3
  "description": "Versioned documentation content and registry for Helix.",
4
- "version": "0.106.0",
4
+ "version": "0.107.0",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "bugs": "https://github.com/project-fusion/fusion/issues",
38
38
  "devDependencies": {
39
- "@fusion.dev/helix-cem": "0.106.0",
40
- "@fusion.dev/helix-testing": "0.106.0",
39
+ "@fusion.dev/helix-cem": "0.107.0",
40
+ "@fusion.dev/helix-testing": "0.107.0",
41
41
  "@fusion.dev/scripts": "0.0.0-dev",
42
42
  "lit": "^3.2.1",
43
43
  "playwright": "^1.62.1"