@classic-homes/maps-core 0.2.8 → 0.2.9
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/{chunk-2NISJ7WE.js → chunk-6WMCIBJJ.js} +41 -194
- package/dist/chunk-EXGGK4H7.js +2822 -0
- package/dist/chunk-ZGUACUEF.js +156 -0
- package/dist/{data-CICLgvT6.d.cts → data-k7o-Rne0.d.cts} +1 -1
- package/dist/{data-CICLgvT6.d.ts → data-k7o-Rne0.d.ts} +1 -1
- package/dist/generator-CGfqiHvG.d.cts +139 -0
- package/dist/generator-CGfqiHvG.d.ts +139 -0
- package/dist/index.d.cts +7 -1481
- package/dist/index.d.ts +7 -1481
- package/dist/index.js +6 -2786
- package/dist/marker-BjzgxVwm.d.ts +1490 -0
- package/dist/marker-zuhH2WoS.d.cts +1490 -0
- package/dist/{spatial-D4ZJ4Ul7.d.ts → spatial-Bo8nM3fC.d.ts} +2 -2
- package/dist/{spatial-D9o4mvDO.d.cts → spatial-CU60awl8.d.cts} +2 -2
- package/dist/theme/index.d.cts +3 -138
- package/dist/theme/index.d.ts +3 -138
- package/dist/theme/index.js +2 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/index.cjs +3078 -0
- package/dist/utils/index.d.cts +50 -0
- package/dist/utils/index.d.ts +50 -0
- package/dist/utils/index.js +2 -0
- package/dist/workers/index.d.cts +2 -2
- package/dist/workers/index.d.ts +2 -2
- package/package.json +9 -1
|
@@ -1,157 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
// src/theme/generator.ts
|
|
4
|
-
var THEME_LIGHT = "classic-light";
|
|
5
|
-
var THEME_DARK = "classic-dark";
|
|
6
|
-
function generateLightColors() {
|
|
7
|
-
return {
|
|
8
|
-
background: colors.white,
|
|
9
|
-
water: colors.sky[200],
|
|
10
|
-
land: colors.sage[50],
|
|
11
|
-
park: colors.forest[100],
|
|
12
|
-
building: colors.gray[200],
|
|
13
|
-
buildingOutline: colors.gray[300],
|
|
14
|
-
roadPrimary: colors.white,
|
|
15
|
-
roadSecondary: colors.gray[100],
|
|
16
|
-
roadCasing: colors.gray[300],
|
|
17
|
-
rail: colors.gray[400],
|
|
18
|
-
boundary: colors.gray[400],
|
|
19
|
-
adminBoundary: colors.plum[300],
|
|
20
|
-
residential: colors.sage[100],
|
|
21
|
-
commercial: colors.stone[100],
|
|
22
|
-
industrial: colors.gray[200],
|
|
23
|
-
highlight: colors.teal[500],
|
|
24
|
-
// Core 1 - brand teal
|
|
25
|
-
highlightSecondary: colors.teal[300],
|
|
26
|
-
selection: colors.red[500],
|
|
27
|
-
// Brand red
|
|
28
|
-
textPrimary: semanticColors.light.foreground,
|
|
29
|
-
textSecondary: semanticColors.light.mutedForeground,
|
|
30
|
-
textHalo: colors.white,
|
|
31
|
-
poi: colors.navy[700],
|
|
32
|
-
// Core 2 - brand navy
|
|
33
|
-
labelBackground: "rgba(255, 255, 255, 0.85)"
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function generateDarkColors() {
|
|
37
|
-
return {
|
|
38
|
-
background: colors.charcoal[900],
|
|
39
|
-
water: colors.navy[800],
|
|
40
|
-
land: colors.charcoal[800],
|
|
41
|
-
park: colors.forest[900],
|
|
42
|
-
building: colors.charcoal[700],
|
|
43
|
-
buildingOutline: colors.charcoal[600],
|
|
44
|
-
roadPrimary: colors.charcoal[600],
|
|
45
|
-
roadSecondary: colors.charcoal[700],
|
|
46
|
-
roadCasing: colors.charcoal[500],
|
|
47
|
-
rail: colors.gray[600],
|
|
48
|
-
boundary: colors.gray[600],
|
|
49
|
-
adminBoundary: colors.plum[400],
|
|
50
|
-
residential: colors.charcoal[700],
|
|
51
|
-
commercial: colors.stone[800],
|
|
52
|
-
industrial: colors.charcoal[700],
|
|
53
|
-
highlight: colors.teal[400],
|
|
54
|
-
// Lighter for dark mode
|
|
55
|
-
highlightSecondary: colors.teal[500],
|
|
56
|
-
selection: colors.red[400],
|
|
57
|
-
// Lighter for dark mode
|
|
58
|
-
textPrimary: semanticColors.dark.foreground,
|
|
59
|
-
textSecondary: semanticColors.dark.mutedForeground,
|
|
60
|
-
textHalo: colors.charcoal[900],
|
|
61
|
-
poi: colors.navy[400],
|
|
62
|
-
// Lighter for dark mode
|
|
63
|
-
labelBackground: "rgba(41, 36, 36, 0.85)"
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function generateLightDataColors() {
|
|
67
|
-
return {
|
|
68
|
-
sequence: [
|
|
69
|
-
colors.teal[500],
|
|
70
|
-
// chart.1
|
|
71
|
-
colors.navy[700],
|
|
72
|
-
// chart.2
|
|
73
|
-
colors.plum[700],
|
|
74
|
-
// chart.3
|
|
75
|
-
colors.forest[500],
|
|
76
|
-
// chart.4
|
|
77
|
-
colors.sky[600]
|
|
78
|
-
// chart.5
|
|
79
|
-
],
|
|
80
|
-
positive: colors.forest[500],
|
|
81
|
-
negative: colors.red[500],
|
|
82
|
-
neutral: colors.gray[500],
|
|
83
|
-
heatmapRamp: [
|
|
84
|
-
"rgba(59, 164, 167, 0)",
|
|
85
|
-
// teal transparent
|
|
86
|
-
colors.teal[200],
|
|
87
|
-
colors.teal[400],
|
|
88
|
-
colors.teal[500],
|
|
89
|
-
colors.red[400],
|
|
90
|
-
colors.red[500],
|
|
91
|
-
colors.red[600]
|
|
92
|
-
]
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function generateDarkDataColors() {
|
|
96
|
-
return {
|
|
97
|
-
sequence: [
|
|
98
|
-
colors.teal[400],
|
|
99
|
-
// chart.1
|
|
100
|
-
colors.navy[400],
|
|
101
|
-
// chart.2
|
|
102
|
-
colors.plum[400],
|
|
103
|
-
// chart.3
|
|
104
|
-
colors.forest[400],
|
|
105
|
-
// chart.4
|
|
106
|
-
colors.sky[400]
|
|
107
|
-
// chart.5
|
|
108
|
-
],
|
|
109
|
-
positive: colors.forest[400],
|
|
110
|
-
negative: colors.red[400],
|
|
111
|
-
neutral: colors.gray[400],
|
|
112
|
-
heatmapRamp: [
|
|
113
|
-
"rgba(103, 204, 207, 0)",
|
|
114
|
-
// teal transparent
|
|
115
|
-
colors.teal[300],
|
|
116
|
-
colors.teal[400],
|
|
117
|
-
colors.teal[500],
|
|
118
|
-
colors.red[400],
|
|
119
|
-
colors.red[500],
|
|
120
|
-
colors.red[600]
|
|
121
|
-
]
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function getTypography() {
|
|
125
|
-
return {
|
|
126
|
-
fontFamily: fontFamily.sans.join(", "),
|
|
127
|
-
fontFamilySerif: fontFamily.serif.join(", "),
|
|
128
|
-
fontFamilyMono: fontFamily.mono.join(", ")
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
function generateLightTheme() {
|
|
132
|
-
return {
|
|
133
|
-
name: THEME_LIGHT,
|
|
134
|
-
colors: generateLightColors(),
|
|
135
|
-
dataColors: generateLightDataColors(),
|
|
136
|
-
typography: getTypography()
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
function generateDarkTheme() {
|
|
140
|
-
return {
|
|
141
|
-
name: THEME_DARK,
|
|
142
|
-
colors: generateDarkColors(),
|
|
143
|
-
dataColors: generateDarkDataColors(),
|
|
144
|
-
typography: getTypography()
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
var lightTheme = generateLightTheme();
|
|
148
|
-
var darkTheme = generateDarkTheme();
|
|
149
|
-
function getTheme(name) {
|
|
150
|
-
if (name === "dark" || name === THEME_DARK) {
|
|
151
|
-
return darkTheme;
|
|
152
|
-
}
|
|
153
|
-
return lightTheme;
|
|
154
|
-
}
|
|
1
|
+
import { lightTheme, THEME_DARK, darkTheme } from './chunk-ZGUACUEF.js';
|
|
155
2
|
|
|
156
3
|
// src/theme/style.ts
|
|
157
4
|
var DEFAULT_TILE_SOURCE = {
|
|
@@ -165,7 +12,7 @@ var OSM_RASTER_SOURCE = {
|
|
|
165
12
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
166
13
|
};
|
|
167
14
|
function generateBasicStyle(theme = lightTheme) {
|
|
168
|
-
const
|
|
15
|
+
const colors = theme.colors;
|
|
169
16
|
return {
|
|
170
17
|
version: 8,
|
|
171
18
|
name: `Classic Theme - ${theme.name}`,
|
|
@@ -177,7 +24,7 @@ function generateBasicStyle(theme = lightTheme) {
|
|
|
177
24
|
id: "background",
|
|
178
25
|
type: "background",
|
|
179
26
|
paint: {
|
|
180
|
-
"background-color":
|
|
27
|
+
"background-color": colors.background
|
|
181
28
|
}
|
|
182
29
|
},
|
|
183
30
|
{
|
|
@@ -197,19 +44,19 @@ function generateBasicStyle(theme = lightTheme) {
|
|
|
197
44
|
}
|
|
198
45
|
};
|
|
199
46
|
}
|
|
200
|
-
function createWaterLayer(
|
|
47
|
+
function createWaterLayer(colors) {
|
|
201
48
|
return {
|
|
202
49
|
id: "water",
|
|
203
50
|
type: "fill",
|
|
204
51
|
source: "openmaptiles",
|
|
205
52
|
"source-layer": "water",
|
|
206
53
|
paint: {
|
|
207
|
-
"fill-color":
|
|
54
|
+
"fill-color": colors.water,
|
|
208
55
|
"fill-opacity": 1
|
|
209
56
|
}
|
|
210
57
|
};
|
|
211
58
|
}
|
|
212
|
-
function createLanduseLayers(
|
|
59
|
+
function createLanduseLayers(colors) {
|
|
213
60
|
return [
|
|
214
61
|
{
|
|
215
62
|
id: "landuse-residential",
|
|
@@ -218,7 +65,7 @@ function createLanduseLayers(colors2) {
|
|
|
218
65
|
"source-layer": "landuse",
|
|
219
66
|
filter: ["==", "class", "residential"],
|
|
220
67
|
paint: {
|
|
221
|
-
"fill-color":
|
|
68
|
+
"fill-color": colors.residential,
|
|
222
69
|
"fill-opacity": 0.6
|
|
223
70
|
}
|
|
224
71
|
},
|
|
@@ -229,7 +76,7 @@ function createLanduseLayers(colors2) {
|
|
|
229
76
|
"source-layer": "landuse",
|
|
230
77
|
filter: ["==", "class", "commercial"],
|
|
231
78
|
paint: {
|
|
232
|
-
"fill-color":
|
|
79
|
+
"fill-color": colors.commercial,
|
|
233
80
|
"fill-opacity": 0.6
|
|
234
81
|
}
|
|
235
82
|
},
|
|
@@ -240,7 +87,7 @@ function createLanduseLayers(colors2) {
|
|
|
240
87
|
"source-layer": "landuse",
|
|
241
88
|
filter: ["==", "class", "industrial"],
|
|
242
89
|
paint: {
|
|
243
|
-
"fill-color":
|
|
90
|
+
"fill-color": colors.industrial,
|
|
244
91
|
"fill-opacity": 0.6
|
|
245
92
|
}
|
|
246
93
|
},
|
|
@@ -251,13 +98,13 @@ function createLanduseLayers(colors2) {
|
|
|
251
98
|
"source-layer": "landuse",
|
|
252
99
|
filter: ["in", "class", "park", "grass", "cemetery"],
|
|
253
100
|
paint: {
|
|
254
|
-
"fill-color":
|
|
101
|
+
"fill-color": colors.park,
|
|
255
102
|
"fill-opacity": 0.8
|
|
256
103
|
}
|
|
257
104
|
}
|
|
258
105
|
];
|
|
259
106
|
}
|
|
260
|
-
function createBuildingLayers(
|
|
107
|
+
function createBuildingLayers(colors) {
|
|
261
108
|
return [
|
|
262
109
|
{
|
|
263
110
|
id: "building",
|
|
@@ -266,7 +113,7 @@ function createBuildingLayers(colors2) {
|
|
|
266
113
|
"source-layer": "building",
|
|
267
114
|
minzoom: 13,
|
|
268
115
|
paint: {
|
|
269
|
-
"fill-color":
|
|
116
|
+
"fill-color": colors.building,
|
|
270
117
|
"fill-opacity": ["interpolate", ["linear"], ["zoom"], 13, 0, 15, 1]
|
|
271
118
|
}
|
|
272
119
|
},
|
|
@@ -277,14 +124,14 @@ function createBuildingLayers(colors2) {
|
|
|
277
124
|
"source-layer": "building",
|
|
278
125
|
minzoom: 13,
|
|
279
126
|
paint: {
|
|
280
|
-
"line-color":
|
|
127
|
+
"line-color": colors.buildingOutline,
|
|
281
128
|
"line-width": 1,
|
|
282
129
|
"line-opacity": ["interpolate", ["linear"], ["zoom"], 13, 0, 15, 1]
|
|
283
130
|
}
|
|
284
131
|
}
|
|
285
132
|
];
|
|
286
133
|
}
|
|
287
|
-
function createRoadLayers(
|
|
134
|
+
function createRoadLayers(colors) {
|
|
288
135
|
return [
|
|
289
136
|
// Road casings (outlines)
|
|
290
137
|
{
|
|
@@ -294,7 +141,7 @@ function createRoadLayers(colors2) {
|
|
|
294
141
|
"source-layer": "transportation",
|
|
295
142
|
filter: ["in", "class", "primary", "trunk", "motorway"],
|
|
296
143
|
paint: {
|
|
297
|
-
"line-color":
|
|
144
|
+
"line-color": colors.roadCasing,
|
|
298
145
|
"line-width": ["interpolate", ["linear"], ["zoom"], 5, 0.5, 12, 4, 18, 20]
|
|
299
146
|
},
|
|
300
147
|
layout: {
|
|
@@ -309,7 +156,7 @@ function createRoadLayers(colors2) {
|
|
|
309
156
|
"source-layer": "transportation",
|
|
310
157
|
filter: ["in", "class", "secondary", "tertiary"],
|
|
311
158
|
paint: {
|
|
312
|
-
"line-color":
|
|
159
|
+
"line-color": colors.roadCasing,
|
|
313
160
|
"line-width": ["interpolate", ["linear"], ["zoom"], 8, 0.5, 12, 2, 18, 12]
|
|
314
161
|
},
|
|
315
162
|
layout: {
|
|
@@ -325,7 +172,7 @@ function createRoadLayers(colors2) {
|
|
|
325
172
|
"source-layer": "transportation",
|
|
326
173
|
filter: ["in", "class", "primary", "trunk", "motorway"],
|
|
327
174
|
paint: {
|
|
328
|
-
"line-color":
|
|
175
|
+
"line-color": colors.roadPrimary,
|
|
329
176
|
"line-width": ["interpolate", ["linear"], ["zoom"], 5, 0.25, 12, 3, 18, 18]
|
|
330
177
|
},
|
|
331
178
|
layout: {
|
|
@@ -340,7 +187,7 @@ function createRoadLayers(colors2) {
|
|
|
340
187
|
"source-layer": "transportation",
|
|
341
188
|
filter: ["in", "class", "secondary", "tertiary"],
|
|
342
189
|
paint: {
|
|
343
|
-
"line-color":
|
|
190
|
+
"line-color": colors.roadSecondary,
|
|
344
191
|
"line-width": ["interpolate", ["linear"], ["zoom"], 8, 0.25, 12, 1.5, 18, 10]
|
|
345
192
|
},
|
|
346
193
|
layout: {
|
|
@@ -356,7 +203,7 @@ function createRoadLayers(colors2) {
|
|
|
356
203
|
filter: ["in", "class", "minor", "service", "path"],
|
|
357
204
|
minzoom: 13,
|
|
358
205
|
paint: {
|
|
359
|
-
"line-color":
|
|
206
|
+
"line-color": colors.roadSecondary,
|
|
360
207
|
"line-width": ["interpolate", ["linear"], ["zoom"], 13, 0.5, 18, 6]
|
|
361
208
|
},
|
|
362
209
|
layout: {
|
|
@@ -373,14 +220,14 @@ function createRoadLayers(colors2) {
|
|
|
373
220
|
filter: ["==", "class", "rail"],
|
|
374
221
|
minzoom: 10,
|
|
375
222
|
paint: {
|
|
376
|
-
"line-color":
|
|
223
|
+
"line-color": colors.rail,
|
|
377
224
|
"line-width": ["interpolate", ["linear"], ["zoom"], 10, 0.5, 18, 2],
|
|
378
225
|
"line-dasharray": [2, 2]
|
|
379
226
|
}
|
|
380
227
|
}
|
|
381
228
|
];
|
|
382
229
|
}
|
|
383
|
-
function createBoundaryLayers(
|
|
230
|
+
function createBoundaryLayers(colors) {
|
|
384
231
|
return [
|
|
385
232
|
{
|
|
386
233
|
id: "boundary-country",
|
|
@@ -389,7 +236,7 @@ function createBoundaryLayers(colors2) {
|
|
|
389
236
|
"source-layer": "boundary",
|
|
390
237
|
filter: ["==", "admin_level", 2],
|
|
391
238
|
paint: {
|
|
392
|
-
"line-color":
|
|
239
|
+
"line-color": colors.adminBoundary,
|
|
393
240
|
"line-width": ["interpolate", ["linear"], ["zoom"], 2, 0.5, 10, 2],
|
|
394
241
|
"line-dasharray": [3, 2]
|
|
395
242
|
}
|
|
@@ -402,14 +249,14 @@ function createBoundaryLayers(colors2) {
|
|
|
402
249
|
filter: ["==", "admin_level", 4],
|
|
403
250
|
minzoom: 4,
|
|
404
251
|
paint: {
|
|
405
|
-
"line-color":
|
|
252
|
+
"line-color": colors.boundary,
|
|
406
253
|
"line-width": ["interpolate", ["linear"], ["zoom"], 4, 0.5, 10, 1.5],
|
|
407
254
|
"line-dasharray": [2, 2]
|
|
408
255
|
}
|
|
409
256
|
}
|
|
410
257
|
];
|
|
411
258
|
}
|
|
412
|
-
function createLabelLayers(
|
|
259
|
+
function createLabelLayers(colors, typography) {
|
|
413
260
|
return [
|
|
414
261
|
{
|
|
415
262
|
id: "place-labels-city",
|
|
@@ -418,8 +265,8 @@ function createLabelLayers(colors2, typography) {
|
|
|
418
265
|
"source-layer": "place",
|
|
419
266
|
filter: ["in", "class", "city", "town"],
|
|
420
267
|
paint: {
|
|
421
|
-
"text-color":
|
|
422
|
-
"text-halo-color":
|
|
268
|
+
"text-color": colors.textPrimary,
|
|
269
|
+
"text-halo-color": colors.textHalo,
|
|
423
270
|
"text-halo-width": 1.5
|
|
424
271
|
},
|
|
425
272
|
layout: {
|
|
@@ -438,8 +285,8 @@ function createLabelLayers(colors2, typography) {
|
|
|
438
285
|
filter: ["in", "class", "suburb", "neighbourhood", "quarter"],
|
|
439
286
|
minzoom: 12,
|
|
440
287
|
paint: {
|
|
441
|
-
"text-color":
|
|
442
|
-
"text-halo-color":
|
|
288
|
+
"text-color": colors.textSecondary,
|
|
289
|
+
"text-halo-color": colors.textHalo,
|
|
443
290
|
"text-halo-width": 1
|
|
444
291
|
},
|
|
445
292
|
layout: {
|
|
@@ -457,8 +304,8 @@ function createLabelLayers(colors2, typography) {
|
|
|
457
304
|
"source-layer": "transportation_name",
|
|
458
305
|
minzoom: 13,
|
|
459
306
|
paint: {
|
|
460
|
-
"text-color":
|
|
461
|
-
"text-halo-color":
|
|
307
|
+
"text-color": colors.textPrimary,
|
|
308
|
+
"text-halo-color": colors.textHalo,
|
|
462
309
|
"text-halo-width": 1
|
|
463
310
|
},
|
|
464
311
|
layout: {
|
|
@@ -477,8 +324,8 @@ function createLabelLayers(colors2, typography) {
|
|
|
477
324
|
"source-layer": "poi",
|
|
478
325
|
minzoom: 14,
|
|
479
326
|
paint: {
|
|
480
|
-
"text-color":
|
|
481
|
-
"text-halo-color":
|
|
327
|
+
"text-color": colors.poi,
|
|
328
|
+
"text-halo-color": colors.textHalo,
|
|
482
329
|
"text-halo-width": 1
|
|
483
330
|
},
|
|
484
331
|
layout: {
|
|
@@ -493,7 +340,7 @@ function createLabelLayers(colors2, typography) {
|
|
|
493
340
|
];
|
|
494
341
|
}
|
|
495
342
|
function generateVectorStyle(theme = lightTheme, tileSource, glyphsUrl, spriteUrl) {
|
|
496
|
-
const
|
|
343
|
+
const colors = theme.colors;
|
|
497
344
|
return {
|
|
498
345
|
version: 8,
|
|
499
346
|
name: `Classic Theme Vector - ${theme.name}`,
|
|
@@ -507,15 +354,15 @@ function generateVectorStyle(theme = lightTheme, tileSource, glyphsUrl, spriteUr
|
|
|
507
354
|
id: "background",
|
|
508
355
|
type: "background",
|
|
509
356
|
paint: {
|
|
510
|
-
"background-color":
|
|
357
|
+
"background-color": colors.land
|
|
511
358
|
}
|
|
512
359
|
},
|
|
513
|
-
createWaterLayer(
|
|
514
|
-
...createLanduseLayers(
|
|
515
|
-
...createBuildingLayers(
|
|
516
|
-
...createRoadLayers(
|
|
517
|
-
...createBoundaryLayers(
|
|
518
|
-
...createLabelLayers(
|
|
360
|
+
createWaterLayer(colors),
|
|
361
|
+
...createLanduseLayers(colors),
|
|
362
|
+
...createBuildingLayers(colors),
|
|
363
|
+
...createRoadLayers(colors),
|
|
364
|
+
...createBoundaryLayers(colors),
|
|
365
|
+
...createLabelLayers(colors, theme.typography)
|
|
519
366
|
],
|
|
520
367
|
metadata: {
|
|
521
368
|
"classic-theme": theme.name
|
|
@@ -531,4 +378,4 @@ function getBasicStyle(themeName) {
|
|
|
531
378
|
return lightBasicStyle;
|
|
532
379
|
}
|
|
533
380
|
|
|
534
|
-
export {
|
|
381
|
+
export { darkBasicStyle, generateBasicStyle, generateVectorStyle, getBasicStyle, lightBasicStyle };
|