@fusion.dev/helix-map 0.111.2 → 0.113.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/dist/maplibre/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { MapLibreStyle, MapStyleOptions } from '../style/index.js';
|
|
2
|
-
export { mapLibreStyle } from '../style/index.js';
|
|
1
|
+
export type { MapLandmark, MapLibreStyle, MapStyleOptions } from '../style/index.js';
|
|
2
|
+
export { MAP_LANDMARKS, mapLibreStyle } from '../style/index.js';
|
|
3
3
|
export type { FollowedTheme, MapLibreMap } from './maplibre-driver.js';
|
|
4
4
|
export { followTheme, mapLibreDriver } from './maplibre-driver.js';
|
package/dist/maplibre/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { mapLibreStyle } from '../style/index.js';
|
|
1
|
+
export { MAP_LANDMARKS, mapLibreStyle } from '../style/index.js';
|
|
2
2
|
export { followTheme, mapLibreDriver } from './maplibre-driver.js';
|
package/dist/style/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { MapColors } from './map-colors.js';
|
|
2
2
|
export { colorsNow, colorsReady, fontReady, mapColorsFrom, mapFontFrom, PATIENCE, settledColor, } from './map-colors.js';
|
|
3
|
-
export type { MapImage, MapLibreStyle, MapStyleOptions } from './map-style.js';
|
|
4
|
-
export { mapLibreStyle } from './map-style.js';
|
|
3
|
+
export type { MapImage, MapLandmark, MapLibreStyle, MapStyleOptions } from './map-style.js';
|
|
4
|
+
export { MAP_LANDMARKS, mapLibreStyle } from './map-style.js';
|
package/dist/style/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { colorsNow, colorsReady, fontReady, mapColorsFrom, mapFontFrom, PATIENCE, settledColor, } from './map-colors.js';
|
|
2
|
-
export { mapLibreStyle } from './map-style.js';
|
|
2
|
+
export { MAP_LANDMARKS, mapLibreStyle } from './map-style.js';
|
|
@@ -23,6 +23,18 @@ export interface MapStyleOptions {
|
|
|
23
23
|
* every zoom, which MapLibre 4 also needs, since it has no globe.
|
|
24
24
|
*/
|
|
25
25
|
globe?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Which landmarks the map draws, each kind an icon in a hue of its own.
|
|
28
|
+
* `true`, the default, draws every kind in `MAP_LANDMARKS`; `false` draws
|
|
29
|
+
* none, for a map whose own markers are the places a reader is looking for;
|
|
30
|
+
* a list draws those kinds and no others, such as `['nature', 'transit']`.
|
|
31
|
+
*
|
|
32
|
+
* **An option of the style, so it holds through a theme change.**
|
|
33
|
+
* `followTheme` builds the style again from the same options when the mode
|
|
34
|
+
* changes, where a page hiding the layers itself had them back on every
|
|
35
|
+
* rebuild and had to learn their ids from this file to do it.
|
|
36
|
+
*/
|
|
37
|
+
landmarks?: boolean | readonly MapLandmark[] | undefined;
|
|
26
38
|
/**
|
|
27
39
|
* The language labels are written in, where the tiles carry it, falling back
|
|
28
40
|
* to the Latin name and then the local one. `en` by default.
|
|
@@ -78,6 +90,13 @@ export type MapImage = {
|
|
|
78
90
|
ink: string;
|
|
79
91
|
kind: 'sign';
|
|
80
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* The kinds of landmark the style draws, each an icon in a hue of its own, for
|
|
95
|
+
* `MapStyleOptions.landmarks`.
|
|
96
|
+
*/
|
|
97
|
+
export declare const MAP_LANDMARKS: readonly ['culture', 'food', 'health', 'learning', 'lodging', 'nature', 'shopping', 'sport', 'transit'];
|
|
98
|
+
/** One kind of landmark, such as `nature` for parks and gardens. */
|
|
99
|
+
export type MapLandmark = (typeof MAP_LANDMARKS)[number];
|
|
81
100
|
/**
|
|
82
101
|
* A MapLibre style in the page's theme.
|
|
83
102
|
*
|
package/dist/style/map-style.js
CHANGED
|
@@ -4,6 +4,17 @@ const OPENFREEMAP = {
|
|
|
4
4
|
glyphs: 'https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf',
|
|
5
5
|
tiles: 'https://tiles.openfreemap.org/planet',
|
|
6
6
|
};
|
|
7
|
+
export const MAP_LANDMARKS = [
|
|
8
|
+
'culture',
|
|
9
|
+
'food',
|
|
10
|
+
'health',
|
|
11
|
+
'learning',
|
|
12
|
+
'lodging',
|
|
13
|
+
'nature',
|
|
14
|
+
'shopping',
|
|
15
|
+
'sport',
|
|
16
|
+
'transit',
|
|
17
|
+
];
|
|
7
18
|
const LANDMARKS = [
|
|
8
19
|
{
|
|
9
20
|
classes: ['park', 'garden', 'playground', 'campsite', 'golf', 'zoo'],
|
|
@@ -151,7 +162,10 @@ export const mapLibreStyle = (colors, options = {}) => {
|
|
|
151
162
|
const images = {};
|
|
152
163
|
const landmarkImage = ['match', ['get', 'class']];
|
|
153
164
|
const landmarkColor = ['match', ['get', 'class']];
|
|
154
|
-
|
|
165
|
+
const kept = LANDMARKS.filter(({ group }) => options.landmarks === undefined || options.landmarks === true
|
|
166
|
+
? true
|
|
167
|
+
: options.landmarks !== false && options.landmarks.includes(group));
|
|
168
|
+
for (const { classes, group, hue, icon } of kept) {
|
|
155
169
|
const color = cssColor(hued(hue));
|
|
156
170
|
const image = {
|
|
157
171
|
color,
|
|
@@ -166,7 +180,7 @@ export const mapLibreStyle = (colors, options = {}) => {
|
|
|
166
180
|
}
|
|
167
181
|
landmarkImage.push('');
|
|
168
182
|
landmarkColor.push(legible(land, 0.6));
|
|
169
|
-
const classesOf = (everyday) =>
|
|
183
|
+
const classesOf = (everyday) => kept.filter((one) => (one.everyday === true) === everyday).flatMap(({ classes }) => classes);
|
|
170
184
|
const signFont = face ? `"${face}", sans-serif` : 'sans-serif';
|
|
171
185
|
const signs = `helix-sign-${stamp(signFont)}-`;
|
|
172
186
|
images[`${signs}interstate`] = {
|
|
@@ -375,7 +389,9 @@ export const mapLibreStyle = (colors, options = {}) => {
|
|
|
375
389
|
'source-layer': 'transportation_name',
|
|
376
390
|
type: 'symbol',
|
|
377
391
|
},
|
|
378
|
-
...[false, true]
|
|
392
|
+
...[false, true]
|
|
393
|
+
.filter((everyday) => classesOf(everyday).length > 0)
|
|
394
|
+
.map((everyday) => ({
|
|
379
395
|
filter: ['match', ['get', 'class'], classesOf(everyday), true, false],
|
|
380
396
|
id: everyday ? 'label-landmark-everyday' : 'label-landmark',
|
|
381
397
|
layout: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusion.dev/helix-map",
|
|
3
3
|
"description": "Connects the Helix Map frame to a map renderer: MapLibre, Leaflet, or a driver of your own.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.113.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
},
|
|
44
44
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@fusion.dev/helix-core": "0.
|
|
47
|
-
"@fusion.dev/helix-icons": "0.
|
|
46
|
+
"@fusion.dev/helix-core": "0.113.0",
|
|
47
|
+
"@fusion.dev/helix-icons": "0.113.0",
|
|
48
48
|
"@mapbox/vector-tile": "^3.0.0",
|
|
49
49
|
"pbf": "^5.1.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@fusion.dev/helix-headless": "0.
|
|
53
|
-
"@fusion.dev/helix-testing": "0.
|
|
52
|
+
"@fusion.dev/helix-headless": "0.113.0",
|
|
53
|
+
"@fusion.dev/helix-testing": "0.113.0",
|
|
54
54
|
"@maplibre/maplibre-gl-style-spec": "^26.4.4",
|
|
55
55
|
"@types/bun": "^1.3.0",
|
|
56
56
|
"@types/leaflet": "^1.9.20",
|