@kahwee/sf-map-svg 3.0.0 → 3.0.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/CHANGELOG.md +7 -0
- package/README.md +3 -3
- package/dist/src/full-data.js +2 -1
- package/dist/src/static-data.js +3 -1
- package/docs/EXAMPLES.md +5 -6
- package/docs/consumer-integration.md +1 -1
- package/docs/migration-v3.md +3 -3
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ User-visible changes are recorded here. Unreleased entries describe changes on `
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 3.0.1 — 2026-09-27
|
|
8
|
+
|
|
9
|
+
- Narrow the complete-data presets to their direct geographic modules without changing rendered SVGs or public API behavior.
|
|
10
|
+
- Correct stale contributing and example documentation links, add a local Markdown link check to `pnpm check`, and show the v3 controller API on the Pages homepage.
|
|
11
|
+
- Skip the early push-triggered Pages build while a new package version is still processing on npm; the successful release workflow deploys that version from the registry.
|
|
12
|
+
- Serve local visual snapshots with the same streaming Node HTTP approach as the Pages browser check, avoiding intermittent resets while loading large optional map data.
|
|
13
|
+
|
|
7
14
|
## 3.0.0 — 2026-09-27
|
|
8
15
|
|
|
9
16
|
Version 3 removes the deprecated compatibility APIs. Applications must migrate before upgrading. The data-free root API introduced in version 2 remains the supported API.
|
package/README.md
CHANGED
|
@@ -16,16 +16,16 @@ Node 22.12+ is required for server rendering. Browser maps need a DOM and a bund
|
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
import { renderMap } from '@kahwee/sf-map-svg';
|
|
19
|
-
import {
|
|
19
|
+
import { staticMapData } from '@kahwee/sf-map-svg/data/static';
|
|
20
20
|
|
|
21
|
-
const { svg, project, viewBox } = renderMap(
|
|
21
|
+
const { svg, project, viewBox } = renderMap(staticMapData, {
|
|
22
22
|
year: 2022,
|
|
23
23
|
landmarks: true,
|
|
24
24
|
bartStations: true,
|
|
25
25
|
});
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
`renderMap(data, options)` returns SVG markup and matching projection helpers.
|
|
28
|
+
`renderMap(data, options)` returns SVG markup and matching projection helpers. `/data/static` includes the complete static map without interactive lookup collections. Small maps can compose selected JSON exports from `/data/*` and pass them as `StaticMapData`. `getLayerPaths(data, options)` returns fitted geographic paths without SVG markup.
|
|
29
29
|
|
|
30
30
|
Static options include `theme`, `width`, `height`, `padding`, `year` (2002, 2012, 2022), `districtLines`, `districtFills`, `districtStyle`, `districtLabels`, `neighborhoodLines`, `labels`, `highways`, `keyRoads`, `roadLabels`, `landmarks`, `bartStations`, `markers`, `overlays`, `title`, `idPrefix`, and `colors`. Each optional layer is independent. User-supplied text and attributes are escaped in SVG output.
|
|
31
31
|
|
package/dist/src/full-data.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { districtMaps
|
|
1
|
+
import { districtMaps } from '../data/districts.js';
|
|
2
|
+
import { neighborhoodCollections } from '../data/lookup.js';
|
|
2
3
|
import { deepFreeze } from './immutable.js';
|
|
3
4
|
import { staticMapData } from './static-data.js';
|
|
4
5
|
/** Complete, explicit geographic preset. Import this only when all datasets are needed. */
|
package/dist/src/static-data.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { landmarks } from '../data/landmarks.js';
|
|
2
|
+
import { keyRoads } from '../data/roads.js';
|
|
3
|
+
import { bartStations } from '../data/stations.js';
|
|
2
4
|
import data from './data.js';
|
|
3
5
|
import { deepFreeze } from './immutable.js';
|
|
4
6
|
/** Complete data for static rendering, without interactive lookup collections. */
|
package/docs/EXAMPLES.md
CHANGED
|
@@ -17,9 +17,9 @@ Choose by task. All snippets use the public package API; browser examples need a
|
|
|
17
17
|
```ts
|
|
18
18
|
import { writeFile } from 'node:fs/promises';
|
|
19
19
|
import { renderMap } from '@kahwee/sf-map-svg';
|
|
20
|
-
import {
|
|
20
|
+
import { staticMapData } from '@kahwee/sf-map-svg/data/static';
|
|
21
21
|
|
|
22
|
-
const svg = renderMap(
|
|
22
|
+
const svg = renderMap(staticMapData, {
|
|
23
23
|
year: 2022,
|
|
24
24
|
landmarks: true,
|
|
25
25
|
bartStations: true,
|
|
@@ -28,14 +28,13 @@ const svg = renderMap(fullMapData.map, {
|
|
|
28
28
|
await writeFile('districts.svg', svg);
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
The
|
|
31
|
+
The static preset includes the packaged map layers without interactive lookup collections. For smaller bundles, pass selected data to the root or `/static` renderer. See the [static recipe](../README.md#static-svg).
|
|
32
32
|
|
|
33
33
|
For an election choropleth, use `renderMap(data, { year, districtStyle })` or
|
|
34
34
|
`createMap({ map: data, districts: districtMaps, neighborhoods: {} }, options)`.
|
|
35
35
|
The controller exposes `setDistrictYear`, `setDistrictStyle`, `selectDistrict`, and typed
|
|
36
36
|
district events; `getLayerPaths(data, { year })` returns fitted paths without SVG markup.
|
|
37
|
-
See the [
|
|
38
|
-
“Election choropleth” example.
|
|
37
|
+
See the [Storybook election choropleth](../stories/ElectionMap.stories.ts) for a working example.
|
|
39
38
|
|
|
40
39
|
## Lightweight interactive guide
|
|
41
40
|
|
|
@@ -46,7 +45,7 @@ const map = createGuideMap({ layers: { roadLabels: false } });
|
|
|
46
45
|
document.querySelector('#map')?.append(map);
|
|
47
46
|
```
|
|
48
47
|
|
|
49
|
-
The guide includes selected coast, SFAR neighborhoods, parks, roads, and stations. Detailed geography loads only when explicitly requested; see the [guide recipe](
|
|
48
|
+
The guide includes selected coast, SFAR neighborhoods, parks, roads, and stations. Detailed geography loads only when explicitly requested; see the [consumer guide recipe](consumer-integration.md).
|
|
50
49
|
|
|
51
50
|
## Selected geography
|
|
52
51
|
|
|
@@ -15,4 +15,4 @@ document.querySelector('#map')?.append(map.element);
|
|
|
15
15
|
map.destroy();
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
For server rendering, import `renderMap` from the root and pass `guideMapData.map` or another explicit `StaticMapData`. Import `/data/full`
|
|
18
|
+
For server rendering, import `renderMap` from the root and pass `guideMapData.map`, `staticMapData` from `/data/static`, or another explicit `StaticMapData`. Import `/data/full` when interactive lookup collections are also required. All rendering stays offline and has zero runtime dependencies. The guide's detailed geography loads only when `loadGuideDetailedData()` is called.
|
package/docs/migration-v3.md
CHANGED
|
@@ -4,14 +4,14 @@ Version 3 removes the deprecated compatibility entry points and their bundled-da
|
|
|
4
4
|
|
|
5
5
|
| Version 2 import or call | Version 3 replacement |
|
|
6
6
|
| --- | --- |
|
|
7
|
-
| `/legacy` `renderSFMap(options)` | `renderMap(
|
|
8
|
-
| `/legacy` `createSFMap(options)` | `renderMap(
|
|
7
|
+
| `/legacy` `renderSFMap(options)` | `renderMap(staticMapData, options).svg` |
|
|
8
|
+
| `/legacy` `createSFMap(options)` | `renderMap(staticMapData, options)` |
|
|
9
9
|
| `/custom-map` `createSFMapWithData(options, data)` | `renderMap(data, options)` |
|
|
10
10
|
| `/explorer` `createNeighborhoodExplorer(options)` | `createMap(fullMapData, options)`; mount `.element` |
|
|
11
11
|
| `/interactive` `createInteractiveSFMap(options)` | `createMap(fullMapData, { mode: 'basemap', ...options })`; mount `.element` |
|
|
12
12
|
| `/interactive-data` `createInteractiveSFMapWithData(data, options)` | `createMap(data, options)`; mount `.element` |
|
|
13
13
|
|
|
14
|
-
`
|
|
14
|
+
`staticMapData` comes from `@kahwee/sf-map-svg/data/static` and includes the complete static map. `fullMapData` comes from `/data/full` and adds the interactive lookup collections. For smaller bundles, construct data from individual `/data/*` modules or use `guideMapData` from `/guide/data`. There is no implicit geographic data in the root import.
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
17
|
import { createMap, renderMap } from '@kahwee/sf-map-svg';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kahwee/sf-map-svg",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Offline SVG maps of San Francisco with district boundaries, parks, landmarks, and BART stations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/src/api.js",
|
|
@@ -171,7 +171,8 @@
|
|
|
171
171
|
"demo": "pnpm build && node examples/build.mjs",
|
|
172
172
|
"format": "biome check --write .",
|
|
173
173
|
"format:check": "biome format .",
|
|
174
|
-
"check": "pnpm peers check && pnpm lint && pnpm data:check && pnpm typecheck && pnpm typecheck:stories && pnpm test && pnpm test:bundle",
|
|
174
|
+
"check": "pnpm peers check && pnpm lint && pnpm check:docs && pnpm data:check && pnpm typecheck && pnpm typecheck:stories && pnpm test && pnpm test:bundle",
|
|
175
|
+
"check:docs": "node scripts/check-docs.mjs",
|
|
175
176
|
"storybook": "pnpm build && storybook dev -p 6006 --host 127.0.0.1 --no-open",
|
|
176
177
|
"build-storybook": "pnpm build && storybook build",
|
|
177
178
|
"data:catalog": "node scripts/build-data-catalog.mjs",
|