@classic-homes/maps-core 0.7.2 → 0.7.4

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.
@@ -0,0 +1,44 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { createRequire } from 'node:module';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { describe, expect, it } from 'vitest';
5
+
6
+ /**
7
+ * bundled.css carries its own copy of the light tokens and utility fallbacks
8
+ * for consumers without theme-tokens. Both must match the generated tokens,
9
+ * or zero-config maps fall back to an older palette (red focus rings,
10
+ * 4.29:1 muted text).
11
+ */
12
+ const require = createRequire(import.meta.url);
13
+ const tokensCss = readFileSync(require.resolve('@classic-homes/theme-tokens/css'), 'utf8');
14
+ const light = tokensCss.slice(tokensCss.indexOf(':root {'), tokensCss.indexOf('.dark {'));
15
+ const tokens = Object.fromEntries(
16
+ [...light.matchAll(/^\s+(--[\w-]+):\s*([^;]+);/gm)].map((m) => [m[1], m[2].trim()])
17
+ );
18
+
19
+ const read = (name: string) =>
20
+ readFileSync(fileURLToPath(new URL(`./${name}`, import.meta.url)), 'utf8');
21
+
22
+ describe('maps-core zero-config tokens', () => {
23
+ it('bundled.css light :root matches theme-tokens', () => {
24
+ const css = read('bundled.css');
25
+ const root = css.slice(css.indexOf(':root {'), css.indexOf('.dark {'));
26
+ const vars = [...root.matchAll(/^\s+(--[\w-]+):\s*([^;]+);/gm)];
27
+ expect(vars.length).toBeGreaterThan(20);
28
+ for (const [, name, value] of vars) {
29
+ expect({ name, value: value.trim() }).toEqual({ name, value: tokens[name] });
30
+ }
31
+ });
32
+
33
+ it.each(['bundled.css', 'utilities.css'])('%s fallbacks match theme-tokens', (file) => {
34
+ const fallbacks = [...read(file).matchAll(/var\((--[\w-]+),\s*([\d.]+ [\d.]+% [\d.]+%)\)/g)];
35
+ expect(fallbacks.length).toBeGreaterThan(10);
36
+ for (const [, name, value] of fallbacks) {
37
+ expect({ name, value }).toEqual({ name, value: tokens[name] });
38
+ }
39
+ });
40
+
41
+ it.each(['bundled.css', 'utilities.css'])('%s has no red-tint utilities', (file) => {
42
+ expect(read(file)).not.toMatch(/\.(?:bg|border|text)-destructive\\\/\d+/);
43
+ });
44
+ });
@@ -2,8 +2,8 @@
2
2
  * MapLibre GL Control Overrides
3
3
  *
4
4
  * Applies the Classic Theme "CAD/drafter aesthetic" to MapLibre's built-in controls.
5
- * Uses hard black borders (light mode) or gray-400 borders (dark mode) to match
6
- * Dialog and DropdownMenu component styling.
5
+ * Uses the theme border token (Black, the CAD rule) to match Dialog and
6
+ * DropdownMenu component styling.
7
7
  *
8
8
  * Note: Uses !important to override Tailwind's high-specificity CSS reset.
9
9
  */
@@ -14,7 +14,7 @@
14
14
 
15
15
  .maplibregl-ctrl-group {
16
16
  background: hsl(var(--card)) !important;
17
- border: 1px solid black !important;
17
+ border: 1px solid hsl(var(--border)) !important;
18
18
  border-radius: 0.375rem !important; /* rounded-md */
19
19
  box-shadow:
20
20
  0 4px 6px -1px rgb(0 0 0 / 0.1),
@@ -41,19 +41,21 @@
41
41
  background-color: hsl(var(--muted)) !important;
42
42
  }
43
43
 
44
+ /* Inset ring (Heritage Teal on the card, 12.68:1): an outer ring is clipped by
45
+ the group's overflow and covered by the next button's background */
44
46
  .maplibregl-ctrl-group button:focus {
45
47
  outline: none !important;
46
- box-shadow: 0 0 0 2px hsl(var(--ring)) !important;
48
+ box-shadow: inset 0 0 0 2px hsl(var(--ring)) !important;
47
49
  }
48
50
 
49
51
  .maplibregl-ctrl-group button:focus-visible {
50
52
  outline: none !important;
51
- box-shadow: 0 0 0 2px hsl(var(--ring)) !important;
53
+ box-shadow: inset 0 0 0 2px hsl(var(--ring)) !important;
52
54
  }
53
55
 
54
56
  /* Dividers between buttons */
55
57
  .maplibregl-ctrl-group button + button {
56
- border-top: 1px solid black !important;
58
+ border-top: 1px solid hsl(var(--border)) !important;
57
59
  }
58
60
 
59
61
  .dark .maplibregl-ctrl-group button + button {
@@ -87,7 +89,7 @@
87
89
 
88
90
  .maplibregl-ctrl-scale {
89
91
  background: hsl(var(--card)) !important;
90
- border: 1px solid black !important;
92
+ border: 1px solid hsl(var(--border)) !important;
91
93
  border-radius: 0.25rem !important; /* rounded */
92
94
  padding: 0 4px !important;
93
95
  font-family:
@@ -145,8 +147,9 @@
145
147
  Attribution Control
146
148
  ========================================================================== */
147
149
 
150
+ /* Solid card: at 80% over satellite or dark tiles the muted text fell to 3.6:1 */
148
151
  .maplibregl-ctrl-attrib {
149
- background: hsl(var(--card) / 0.8) !important;
152
+ background: hsl(var(--card)) !important;
150
153
  padding: 2px 5px !important;
151
154
  font-size: 0.625rem !important; /* smaller text */
152
155
  border-radius: 0.25rem !important;
@@ -164,8 +167,8 @@
164
167
 
165
168
  /* Compact attribution button */
166
169
  .maplibregl-ctrl-attrib-button {
167
- background-color: hsl(var(--card) / 0.8) !important;
168
- border: 1px solid black !important;
170
+ background-color: hsl(var(--card)) !important;
171
+ border: 1px solid hsl(var(--border)) !important;
169
172
  border-radius: 0.25rem !important;
170
173
  }
171
174
 
@@ -175,7 +178,7 @@
175
178
 
176
179
  .maplibregl-ctrl-attrib-button:focus {
177
180
  outline: none !important;
178
- box-shadow: 0 0 0 2px hsl(var(--ring)) !important;
181
+ box-shadow: inset 0 0 0 2px hsl(var(--ring)) !important;
179
182
  }
180
183
 
181
184
  /* ==========================================================================
@@ -55,7 +55,7 @@
55
55
  }
56
56
 
57
57
  .classic-layer-item:hover {
58
- background-color: hsl(var(--muted) / 0.5);
58
+ background-color: hsl(var(--muted));
59
59
  }
60
60
 
61
61
  .classic-layer-item[data-dragging='true'] {
@@ -90,11 +90,18 @@
90
90
  width: 100%;
91
91
  height: 4px;
92
92
  border-radius: 2px;
93
- background: hsl(var(--muted));
93
+ /* Fern track (3.81:1 on the panel) so the 0-100% extent is visible */
94
+ background: hsl(var(--outline, 70 9% 48%));
94
95
  outline: none;
95
96
  cursor: pointer;
96
97
  }
97
98
 
99
+ .classic-layer-opacity-slider:focus-visible {
100
+ box-shadow:
101
+ 0 0 0 2px hsl(var(--background)),
102
+ 0 0 0 4px hsl(var(--ring));
103
+ }
104
+
98
105
  .classic-layer-opacity-slider::-webkit-slider-thumb {
99
106
  -webkit-appearance: none;
100
107
  appearance: none;
@@ -124,15 +131,15 @@
124
131
  transform: scale(1.2);
125
132
  }
126
133
 
127
- /* Drag handle */
134
+ /* Drag handle: an affordance, so full strength (the icon's Muted Foreground is
135
+ 5.74:1; at 0.4 it was 1.78:1) */
128
136
  .classic-layer-drag-handle {
129
137
  cursor: grab;
130
- opacity: 0.4;
131
- transition: opacity 150ms ease;
138
+ color: hsl(var(--muted-foreground));
132
139
  }
133
140
 
134
141
  .classic-layer-drag-handle:hover {
135
- opacity: 1;
142
+ color: hsl(var(--foreground));
136
143
  }
137
144
 
138
145
  .classic-layer-drag-handle:active {
@@ -170,14 +177,12 @@
170
177
  color: hsl(var(--foreground));
171
178
  font-size: 0.875rem;
172
179
  outline: none;
173
- transition:
174
- border-color 150ms ease,
175
- box-shadow 150ms ease;
176
180
  }
177
181
 
178
- .classic-layer-search:focus {
179
- border-color: hsl(var(--primary));
180
- box-shadow: 0 0 0 2px hsl(var(--primary) / 0.2);
182
+ /* Full-strength Heritage Teal ring (12.68:1); a 20% halo was 1.46:1 */
183
+ .classic-layer-search:focus-visible {
184
+ border-color: hsl(var(--ring));
185
+ box-shadow: 0 0 0 2px hsl(var(--ring));
181
186
  }
182
187
 
183
188
  .classic-layer-search::placeholder {
@@ -189,7 +194,7 @@
189
194
  display: flex;
190
195
  gap: 0.25rem;
191
196
  padding: 0.25rem;
192
- background-color: hsl(var(--muted) / 0.5);
197
+ background-color: hsl(var(--muted));
193
198
  border-radius: 0.375rem;
194
199
  }
195
200
 
@@ -208,10 +213,18 @@
208
213
  color: hsl(var(--foreground));
209
214
  }
210
215
 
216
+ /* v2.5 selected: Linen, bold Grey 01 text (6.18:1) and a Heritage Teal bottom
217
+ edge, so it differs from the Paper strip by more than a fill */
211
218
  .classic-layer-tab[data-active='true'] {
212
- background-color: hsl(var(--background));
213
- color: hsl(var(--foreground));
214
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
219
+ background-color: hsl(var(--accent));
220
+ color: hsl(var(--accent-foreground));
221
+ font-weight: 600;
222
+ box-shadow: inset 0 -3px 0 hsl(var(--primary));
223
+ }
224
+
225
+ .classic-layer-tab:focus-visible {
226
+ outline: 2px solid hsl(var(--ring));
227
+ outline-offset: 1px;
215
228
  }
216
229
 
217
230
  /* Error state */
@@ -2,7 +2,7 @@
2
2
  * MapLibre GL Popup Overrides
3
3
  *
4
4
  * Applies the Classic Theme "CAD/drafter aesthetic" to MapLibre's popup component.
5
- * Uses hard black borders (light mode) or gray-400 borders (dark mode) to match
5
+ * Uses the theme border token (Black, the CAD rule) to match
6
6
  * Dialog and DropdownMenu component styling.
7
7
  *
8
8
  * Note: Uses !important to override Tailwind's high-specificity CSS reset.
@@ -15,7 +15,7 @@
15
15
  .maplibregl-popup-content {
16
16
  background: hsl(var(--popover)) !important;
17
17
  color: hsl(var(--popover-foreground)) !important;
18
- border: 1px solid black !important;
18
+ border: 1px solid hsl(var(--border)) !important;
19
19
  border-radius: 0.5rem !important; /* rounded-lg to match Dialog */
20
20
  box-shadow:
21
21
  0 10px 15px -3px rgb(0 0 0 / 0.1),
@@ -69,9 +69,10 @@
69
69
  cursor: pointer !important;
70
70
  }
71
71
 
72
+ /* v2.5 hover is Paper; Linen means selected */
72
73
  .maplibregl-popup-close-button:hover {
73
74
  color: hsl(var(--foreground)) !important;
74
- background-color: hsl(var(--accent)) !important;
75
+ background-color: hsl(var(--muted)) !important;
75
76
  }
76
77
 
77
78
  .maplibregl-popup-close-button:focus {
@@ -111,7 +112,7 @@
111
112
  /* --- Bottom Anchored (popup above point, arrow points down) --- */
112
113
 
113
114
  .maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
114
- border-top-color: black !important;
115
+ border-top-color: hsl(var(--border)) !important;
115
116
  }
116
117
 
117
118
  .dark .maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
@@ -132,7 +133,7 @@
132
133
  /* --- Top Anchored (popup below point, arrow points up) --- */
133
134
 
134
135
  .maplibregl-popup-anchor-top .maplibregl-popup-tip {
135
- border-bottom-color: black !important;
136
+ border-bottom-color: hsl(var(--border)) !important;
136
137
  }
137
138
 
138
139
  .dark .maplibregl-popup-anchor-top .maplibregl-popup-tip {
@@ -152,7 +153,7 @@
152
153
  /* --- Left Anchored (popup to right of point, arrow points left) --- */
153
154
 
154
155
  .maplibregl-popup-anchor-left .maplibregl-popup-tip {
155
- border-right-color: black !important;
156
+ border-right-color: hsl(var(--border)) !important;
156
157
  }
157
158
 
158
159
  .dark .maplibregl-popup-anchor-left .maplibregl-popup-tip {
@@ -172,7 +173,7 @@
172
173
  /* --- Right Anchored (popup to left of point, arrow points right) --- */
173
174
 
174
175
  .maplibregl-popup-anchor-right .maplibregl-popup-tip {
175
- border-left-color: black !important;
176
+ border-left-color: hsl(var(--border)) !important;
176
177
  }
177
178
 
178
179
  .dark .maplibregl-popup-anchor-right .maplibregl-popup-tip {
@@ -192,7 +193,7 @@
192
193
  /* --- Top-Left Anchored (popup below-right of point, arrow points up-left) --- */
193
194
 
194
195
  .maplibregl-popup-anchor-top-left .maplibregl-popup-tip {
195
- border-bottom-color: black !important;
196
+ border-bottom-color: hsl(var(--border)) !important;
196
197
  }
197
198
 
198
199
  .dark .maplibregl-popup-anchor-top-left .maplibregl-popup-tip {
@@ -212,7 +213,7 @@
212
213
  /* --- Top-Right Anchored (popup below-left of point, arrow points up-right) --- */
213
214
 
214
215
  .maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
215
- border-bottom-color: black !important;
216
+ border-bottom-color: hsl(var(--border)) !important;
216
217
  }
217
218
 
218
219
  .dark .maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
@@ -232,7 +233,7 @@
232
233
  /* --- Bottom-Left Anchored (popup above-right of point, arrow points down-left) --- */
233
234
 
234
235
  .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip {
235
- border-top-color: black !important;
236
+ border-top-color: hsl(var(--border)) !important;
236
237
  }
237
238
 
238
239
  .dark .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip {
@@ -252,7 +253,7 @@
252
253
  /* --- Bottom-Right Anchored (popup above-left of point, arrow points down-right) --- */
253
254
 
254
255
  .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
255
- border-top-color: black !important;
256
+ border-top-color: hsl(var(--border)) !important;
256
257
  }
257
258
 
258
259
  .dark .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
@@ -300,11 +300,8 @@
300
300
  .border-input {
301
301
  border-color: hsl(var(--input, 0 0% 0%));
302
302
  }
303
- .border-black {
304
- border-color: black;
305
- }
306
- .border-destructive\/50 {
307
- border-color: hsl(var(--destructive, 0 75% 51%) / 0.5);
303
+ .border-foreground {
304
+ border-color: hsl(var(--foreground, 60 1% 31%));
308
305
  }
309
306
 
310
307
  /* ==========================================================================
@@ -341,7 +338,7 @@
341
338
  background-color: hsl(var(--background, 0 0% 100%));
342
339
  }
343
340
  .bg-foreground {
344
- background-color: hsl(var(--foreground, 0 0% 31%));
341
+ background-color: hsl(var(--foreground, 60 1% 31%));
345
342
  }
346
343
  .bg-card {
347
344
  background-color: hsl(var(--card, 0 0% 100%));
@@ -350,39 +347,30 @@
350
347
  background-color: hsl(var(--popover, 0 0% 100%));
351
348
  }
352
349
  .bg-muted {
353
- background-color: hsl(var(--muted, 72 11% 91%));
354
- }
355
- .bg-muted\/30 {
356
- background-color: hsl(var(--muted, 72 11% 91%) / 0.3);
357
- }
358
- .bg-muted\/50 {
359
- background-color: hsl(var(--muted, 72 11% 91%) / 0.5);
350
+ background-color: hsl(var(--muted, 60 13% 94%));
360
351
  }
361
352
  .bg-accent {
362
- background-color: hsl(var(--accent, 182 48% 44%));
363
- }
364
- .bg-destructive\/5 {
365
- background-color: hsl(var(--destructive, 0 75% 51%) / 0.05);
353
+ background-color: hsl(var(--accent, 66 15% 87%));
366
354
  }
367
355
  .bg-muted-foreground\/20 {
368
- background-color: hsl(var(--muted-foreground, 0 0% 48%) / 0.2);
356
+ background-color: hsl(var(--muted-foreground, 0 0% 40%) / 0.2);
369
357
  }
370
358
 
371
359
  /* Status background colors */
372
360
  .bg-primary {
373
- background-color: hsl(var(--primary, 357 72% 39%));
361
+ background-color: hsl(var(--primary, 188 37% 17%));
374
362
  }
375
363
  .bg-secondary {
376
- background-color: hsl(var(--secondary, 71 10% 40%));
364
+ background-color: hsl(var(--secondary, 0 0% 100%));
377
365
  }
378
366
  .bg-success {
379
- background-color: hsl(var(--success, 160 84% 39%));
367
+ background-color: hsl(var(--success, 188 37% 17%));
380
368
  }
381
369
  .bg-warning {
382
- background-color: hsl(var(--warning, 38 92% 50%));
370
+ background-color: hsl(var(--warning, 358 69% 40%));
383
371
  }
384
372
  .bg-info {
385
- background-color: hsl(var(--info, 217 91% 60%));
373
+ background-color: hsl(var(--info, 188 37% 17%));
386
374
  }
387
375
 
388
376
  /* ==========================================================================
@@ -390,25 +378,22 @@
390
378
  ========================================================================== */
391
379
 
392
380
  .text-foreground {
393
- color: hsl(var(--foreground, 0 0% 31%));
381
+ color: hsl(var(--foreground, 60 1% 31%));
394
382
  }
395
383
  .text-card-foreground {
396
- color: hsl(var(--card-foreground, 0 0% 31%));
384
+ color: hsl(var(--card-foreground, 60 1% 31%));
397
385
  }
398
386
  .text-popover-foreground {
399
- color: hsl(var(--popover-foreground, 0 0% 31%));
387
+ color: hsl(var(--popover-foreground, 60 1% 31%));
400
388
  }
401
389
  .text-muted-foreground {
402
- color: hsl(var(--muted-foreground, 0 0% 48%));
403
- }
404
- .text-muted-foreground\/60 {
405
- color: hsl(var(--muted-foreground, 0 0% 48%) / 0.6);
390
+ color: hsl(var(--muted-foreground, 0 0% 40%));
406
391
  }
407
392
  .text-destructive {
408
- color: hsl(var(--destructive, 0 75% 51%));
393
+ color: hsl(var(--destructive, 358 69% 40%));
409
394
  }
410
395
  .text-accent-foreground {
411
- color: hsl(var(--accent-foreground, 0 0% 100%));
396
+ color: hsl(var(--accent-foreground, 60 1% 31%));
412
397
  }
413
398
  .text-border {
414
399
  color: hsl(var(--border, 0 0% 0%));
@@ -419,7 +404,7 @@
419
404
  color: hsl(var(--primary-foreground, 0 0% 100%));
420
405
  }
421
406
  .text-secondary-foreground {
422
- color: hsl(var(--secondary-foreground, 0 0% 100%));
407
+ color: hsl(var(--secondary-foreground, 188 37% 17%));
423
408
  }
424
409
  .text-success-foreground {
425
410
  color: hsl(var(--success-foreground, 0 0% 100%));
@@ -464,6 +449,9 @@
464
449
  .font-semibold {
465
450
  font-weight: 600;
466
451
  }
452
+ .line-through {
453
+ text-decoration-line: line-through;
454
+ }
467
455
  .font-mono {
468
456
  font-family:
469
457
  ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
@@ -514,18 +502,18 @@
514
502
  ========================================================================== */
515
503
 
516
504
  .ring-2 {
517
- box-shadow: 0 0 0 2px var(--tw-ring-color, hsl(var(--ring, 357 72% 39%)));
505
+ box-shadow: 0 0 0 2px var(--tw-ring-color, hsl(var(--ring, 188 37% 17%)));
518
506
  }
519
507
  .ring-primary {
520
- --tw-ring-color: hsl(var(--primary, 357 72% 39%));
508
+ --tw-ring-color: hsl(var(--primary, 188 37% 17%));
521
509
  }
522
510
  .ring-ring {
523
- --tw-ring-color: hsl(var(--ring, 357 72% 39%));
511
+ --tw-ring-color: hsl(var(--ring, 188 37% 17%));
524
512
  }
525
513
  .ring-offset-2 {
526
514
  box-shadow:
527
515
  0 0 0 2px hsl(var(--background, 0 0% 100%)),
528
- 0 0 0 calc(2px + 2px) var(--tw-ring-color, hsl(var(--ring, 357 72% 39%)));
516
+ 0 0 0 calc(2px + 2px) var(--tw-ring-color, hsl(var(--ring, 188 37% 17%)));
529
517
  }
530
518
 
531
519
  /* ==========================================================================
@@ -683,16 +671,16 @@
683
671
  ========================================================================== */
684
672
 
685
673
  .hover\:bg-muted:hover {
686
- background-color: hsl(var(--muted, 72 11% 91%));
674
+ background-color: hsl(var(--muted, 60 13% 94%));
687
675
  }
688
676
  .hover\:bg-accent:hover {
689
- background-color: hsl(var(--accent, 182 48% 44%));
677
+ background-color: hsl(var(--accent, 66 15% 87%));
690
678
  }
691
679
  .hover\:text-foreground:hover {
692
- color: hsl(var(--foreground, 0 0% 31%));
680
+ color: hsl(var(--foreground, 60 1% 31%));
693
681
  }
694
682
  .hover\:text-accent-foreground:hover {
695
- color: hsl(var(--accent-foreground, 0 0% 100%));
683
+ color: hsl(var(--accent-foreground, 60 1% 31%));
696
684
  }
697
685
 
698
686
  /* ==========================================================================
@@ -704,22 +692,14 @@
704
692
  outline-offset: 2px;
705
693
  }
706
694
  .focus-visible\:ring-2:focus-visible {
707
- box-shadow: 0 0 0 2px var(--tw-ring-color, hsl(var(--ring, 357 72% 39%)));
695
+ box-shadow: 0 0 0 2px var(--tw-ring-color, hsl(var(--ring, 188 37% 17%)));
708
696
  }
709
697
  .focus-visible\:ring-ring:focus-visible {
710
- --tw-ring-color: hsl(var(--ring, 357 72% 39%));
698
+ --tw-ring-color: hsl(var(--ring, 188 37% 17%));
711
699
  }
712
700
  .focus-visible\:ring-offset-2:focus-visible {
713
701
  box-shadow:
714
702
  0 0 0 2px hsl(var(--background, 0 0% 100%)),
715
- 0 0 0 calc(2px + 2px) var(--tw-ring-color, hsl(var(--ring, 357 72% 39%)));
716
- }
717
-
718
- /* ==========================================================================
719
- Dark Mode
720
- ========================================================================== */
721
-
722
- .dark .dark\:border-gray-400 {
723
- border-color: rgb(156 163 175);
703
+ 0 0 0 calc(2px + 2px) var(--tw-ring-color, hsl(var(--ring, 188 37% 17%)));
724
704
  }
725
705
  }