@classic-homes/maps-core 0.2.7 → 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.
@@ -1,157 +1,4 @@
1
- import { fontFamily, colors, semanticColors } from '@classic-homes/theme-tokens';
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: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
166
13
  };
167
14
  function generateBasicStyle(theme = lightTheme) {
168
- const colors2 = theme.colors;
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": colors2.background
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(colors2) {
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": colors2.water,
54
+ "fill-color": colors.water,
208
55
  "fill-opacity": 1
209
56
  }
210
57
  };
211
58
  }
212
- function createLanduseLayers(colors2) {
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": colors2.residential,
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": colors2.commercial,
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": colors2.industrial,
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": colors2.park,
101
+ "fill-color": colors.park,
255
102
  "fill-opacity": 0.8
256
103
  }
257
104
  }
258
105
  ];
259
106
  }
260
- function createBuildingLayers(colors2) {
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": colors2.building,
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": colors2.buildingOutline,
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(colors2) {
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": colors2.roadCasing,
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": colors2.roadCasing,
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": colors2.roadPrimary,
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": colors2.roadSecondary,
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": colors2.roadSecondary,
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": colors2.rail,
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(colors2) {
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": colors2.adminBoundary,
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": colors2.boundary,
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(colors2, typography) {
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": colors2.textPrimary,
422
- "text-halo-color": colors2.textHalo,
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": colors2.textSecondary,
442
- "text-halo-color": colors2.textHalo,
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": colors2.textPrimary,
461
- "text-halo-color": colors2.textHalo,
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": colors2.poi,
481
- "text-halo-color": colors2.textHalo,
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 colors2 = theme.colors;
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": colors2.land
357
+ "background-color": colors.land
511
358
  }
512
359
  },
513
- createWaterLayer(colors2),
514
- ...createLanduseLayers(colors2),
515
- ...createBuildingLayers(colors2),
516
- ...createRoadLayers(colors2),
517
- ...createBoundaryLayers(colors2),
518
- ...createLabelLayers(colors2, theme.typography)
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 { THEME_DARK, THEME_LIGHT, darkBasicStyle, darkTheme, generateBasicStyle, generateDarkColors, generateDarkDataColors, generateDarkTheme, generateLightColors, generateLightDataColors, generateLightTheme, generateVectorStyle, getBasicStyle, getTheme, getTypography, lightBasicStyle, lightTheme };
381
+ export { darkBasicStyle, generateBasicStyle, generateVectorStyle, getBasicStyle, lightBasicStyle };