@classic-homes/maps-core 0.1.5 → 0.2.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/package.json +7 -1
- package/src/styles/bundled.css +820 -0
- package/src/styles/css.d.ts +66 -0
- package/src/styles/index.css +41 -0
- package/src/styles/maplibre-fixes.css +145 -0
- package/src/styles/utilities.css +703 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript declarations for CSS module imports
|
|
3
|
+
*
|
|
4
|
+
* This allows importing CSS files without TypeScript errors:
|
|
5
|
+
*
|
|
6
|
+
* import '@classic-homes/maps-core/styles';
|
|
7
|
+
* import '@classic-homes/maps-core/styles/bundled.css';
|
|
8
|
+
*
|
|
9
|
+
* Note: These declarations are automatically picked up by TypeScript
|
|
10
|
+
* when using the package.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
declare module '*.css' {
|
|
14
|
+
const content: string;
|
|
15
|
+
export default content;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare module '@classic-homes/maps-core/styles' {
|
|
19
|
+
const content: string;
|
|
20
|
+
export default content;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare module '@classic-homes/maps-core/styles/index.css' {
|
|
24
|
+
const content: string;
|
|
25
|
+
export default content;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare module '@classic-homes/maps-core/styles/bundled.css' {
|
|
29
|
+
const content: string;
|
|
30
|
+
export default content;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare module '@classic-homes/maps-core/styles/utilities.css' {
|
|
34
|
+
const content: string;
|
|
35
|
+
export default content;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare module '@classic-homes/maps-core/styles/maplibre-fixes.css' {
|
|
39
|
+
const content: string;
|
|
40
|
+
export default content;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare module '@classic-homes/maps-core/styles/controls.css' {
|
|
44
|
+
const content: string;
|
|
45
|
+
export default content;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare module '@classic-homes/maps-core/styles/popup.css' {
|
|
49
|
+
const content: string;
|
|
50
|
+
export default content;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare module '@classic-homes/maps-core/styles/marker.css' {
|
|
54
|
+
const content: string;
|
|
55
|
+
export default content;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare module '@classic-homes/maps-core/styles/basemap-switcher.css' {
|
|
59
|
+
const content: string;
|
|
60
|
+
export default content;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare module '@classic-homes/maps-core/styles/layer-manager.css' {
|
|
64
|
+
const content: string;
|
|
65
|
+
export default content;
|
|
66
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classic Theme Maps - Combined Styles
|
|
3
|
+
*
|
|
4
|
+
* This file imports all CSS needed for @classic-homes/maps-react and
|
|
5
|
+
* @classic-homes/maps-svelte components to work without Tailwind CSS.
|
|
6
|
+
*
|
|
7
|
+
* Usage for non-Tailwind (e.g., MUI) projects:
|
|
8
|
+
*
|
|
9
|
+
* // 1. Design tokens (defines CSS variables)
|
|
10
|
+
* import '@classic-homes/theme-tokens/css';
|
|
11
|
+
*
|
|
12
|
+
* // 2. MapLibre base styles (required)
|
|
13
|
+
* import 'maplibre-gl/dist/maplibre-gl.css';
|
|
14
|
+
*
|
|
15
|
+
* // 3. All maps styles (this file)
|
|
16
|
+
* import '@classic-homes/maps-core/styles';
|
|
17
|
+
*
|
|
18
|
+
* For Tailwind projects, you typically only need the component-specific
|
|
19
|
+
* CSS files (controls.css, popup.css, etc.) as Tailwind provides utilities.
|
|
20
|
+
*
|
|
21
|
+
* Layer ordering ensures:
|
|
22
|
+
* 1. MapLibre fixes apply first (layout/container fixes)
|
|
23
|
+
* 2. Utilities provide Tailwind replacements
|
|
24
|
+
* 3. Component styles layer on top
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/* Define layer order */
|
|
28
|
+
@layer classic-theme.maps-fixes, classic-theme.maps-utilities, classic-theme.maps-controls;
|
|
29
|
+
|
|
30
|
+
/* MapLibre container and canvas fixes */
|
|
31
|
+
@import './maplibre-fixes.css';
|
|
32
|
+
|
|
33
|
+
/* Tailwind utility class replacements */
|
|
34
|
+
@import './utilities.css';
|
|
35
|
+
|
|
36
|
+
/* Component-specific styles */
|
|
37
|
+
@import './controls.css';
|
|
38
|
+
@import './popup.css';
|
|
39
|
+
@import './marker.css';
|
|
40
|
+
@import './basemap-switcher.css';
|
|
41
|
+
@import './layer-manager.css';
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MapLibre GL Container & Canvas Fixes
|
|
3
|
+
*
|
|
4
|
+
* This file provides CSS fixes for common MapLibre GL integration issues,
|
|
5
|
+
* particularly with non-Tailwind CSS frameworks like MUI.
|
|
6
|
+
*
|
|
7
|
+
* These styles ensure:
|
|
8
|
+
* - Map containers properly inherit height from parent elements
|
|
9
|
+
* - MapLibre canvas fills its container correctly
|
|
10
|
+
* - No layout shift during map loading
|
|
11
|
+
* - Touch devices work correctly
|
|
12
|
+
*
|
|
13
|
+
* IMPORTANT: This file does NOT include MapLibre's base styles.
|
|
14
|
+
* You must still import maplibre-gl/dist/maplibre-gl.css separately.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
@layer classic-theme.maps-fixes {
|
|
18
|
+
/* ==========================================================================
|
|
19
|
+
Root Container Height Inheritance
|
|
20
|
+
|
|
21
|
+
Many CSS frameworks and app shells don't set height: 100% on their root
|
|
22
|
+
elements. This causes map containers to collapse to 0 height.
|
|
23
|
+
========================================================================== */
|
|
24
|
+
|
|
25
|
+
html,
|
|
26
|
+
body {
|
|
27
|
+
height: 100%;
|
|
28
|
+
margin: 0;
|
|
29
|
+
padding: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Common app root selectors */
|
|
33
|
+
#root,
|
|
34
|
+
#app,
|
|
35
|
+
#__next,
|
|
36
|
+
[data-reactroot] {
|
|
37
|
+
height: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ==========================================================================
|
|
41
|
+
MapLibre Canvas Container
|
|
42
|
+
|
|
43
|
+
Ensures the map canvas properly fills its container and responds to
|
|
44
|
+
resize events.
|
|
45
|
+
========================================================================== */
|
|
46
|
+
|
|
47
|
+
.maplibregl-map {
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
flex: 1 1 auto;
|
|
51
|
+
min-height: 0;
|
|
52
|
+
min-width: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.maplibregl-canvas-container,
|
|
56
|
+
.maplibregl-canvas {
|
|
57
|
+
width: 100%;
|
|
58
|
+
height: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.maplibregl-canvas {
|
|
62
|
+
display: block;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ==========================================================================
|
|
66
|
+
Layout Containment
|
|
67
|
+
|
|
68
|
+
Prevents layout shift when map content changes (layers loading, popups
|
|
69
|
+
appearing, etc.)
|
|
70
|
+
========================================================================== */
|
|
71
|
+
|
|
72
|
+
[data-testid='map-container'] {
|
|
73
|
+
contain: layout style;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* ==========================================================================
|
|
77
|
+
Touch Device Optimizations
|
|
78
|
+
|
|
79
|
+
Configures touch-action for proper gesture handling on mobile devices.
|
|
80
|
+
- Map container allows pan gestures
|
|
81
|
+
- Canvas itself handles all touch events internally
|
|
82
|
+
========================================================================== */
|
|
83
|
+
|
|
84
|
+
.maplibregl-map {
|
|
85
|
+
touch-action: pan-x pan-y;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.maplibregl-canvas {
|
|
89
|
+
touch-action: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* ==========================================================================
|
|
93
|
+
Flexbox Container Support
|
|
94
|
+
|
|
95
|
+
When maps are placed in flex containers, these rules ensure proper sizing.
|
|
96
|
+
========================================================================== */
|
|
97
|
+
|
|
98
|
+
.maplibregl-map {
|
|
99
|
+
flex-shrink: 0;
|
|
100
|
+
flex-grow: 1;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* ==========================================================================
|
|
104
|
+
Grid Container Support
|
|
105
|
+
|
|
106
|
+
When maps are placed in CSS Grid containers, these rules prevent overflow.
|
|
107
|
+
========================================================================== */
|
|
108
|
+
|
|
109
|
+
.maplibregl-map {
|
|
110
|
+
min-width: 0;
|
|
111
|
+
min-height: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* ==========================================================================
|
|
115
|
+
Print Styles
|
|
116
|
+
|
|
117
|
+
Basic print support for maps.
|
|
118
|
+
========================================================================== */
|
|
119
|
+
|
|
120
|
+
@media print {
|
|
121
|
+
.maplibregl-map {
|
|
122
|
+
/* Ensure map prints at reasonable size */
|
|
123
|
+
break-inside: avoid;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.maplibregl-ctrl-group,
|
|
127
|
+
.maplibregl-ctrl-attrib {
|
|
128
|
+
/* Hide controls when printing */
|
|
129
|
+
display: none !important;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* ==========================================================================
|
|
134
|
+
Reduced Motion Support
|
|
135
|
+
|
|
136
|
+
Respects user preference for reduced motion.
|
|
137
|
+
========================================================================== */
|
|
138
|
+
|
|
139
|
+
@media (prefers-reduced-motion: reduce) {
|
|
140
|
+
.maplibregl-map * {
|
|
141
|
+
transition-duration: 0.01ms !important;
|
|
142
|
+
animation-duration: 0.01ms !important;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|