@swr-data-lab/components 1.13.7 → 1.13.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.
@@ -0,0 +1,22 @@
1
+ .maplibregl-ctrl.maplibregl-ctrl-attrib {
2
+ font-size: var(--fs-small-3);
3
+ letter-spacing: 0.005em;
4
+ word-spacing: 0.005em;
5
+ font-family: var(--swr-sans);
6
+ }
7
+ .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {
8
+ display: block;
9
+ }
10
+ .maplibregl-ctrl-attrib-button {
11
+ display: none;
12
+ }
13
+
14
+ .maplibregl-ctrl-attrib a {
15
+ color: inherit;
16
+ text-decoration: none;
17
+ text-underline-offset: 0.2em;
18
+ }
19
+ .maplibregl-ctrl-attrib a:hover {
20
+ color: inherit;
21
+ text-decoration: underline;
22
+ }
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">import maplibre, {} from 'maplibre-gl';
2
2
  import MapControl from '../MapControl/MapControl.svelte';
3
+ import './AttributionControl.css';
3
4
  const { position = 'bottom-right', customAttribution } = $props();
4
5
  </script>
5
6
 
@@ -10,25 +11,3 @@ const { position = 'bottom-right', customAttribution } = $props();
10
11
  compact: false
11
12
  })}
12
13
  />
13
-
14
- <style>:global(.maplibregl-ctrl.maplibregl-ctrl-attrib) {
15
- font-size: var(--fs-small-3);
16
- letter-spacing: 0.005em;
17
- word-spacing: 0.005em;
18
- font-family: var(--swr-sans);
19
- }
20
- :global(.maplibregl-ctrl-attrib.maplibregl-compact-show) :global(.maplibregl-ctrl-attrib-inner) {
21
- display: block;
22
- }
23
- :global(.maplibregl-ctrl-attrib-button) {
24
- display: none;
25
- }
26
- :global(.maplibregl-ctrl-attrib) :global(a) {
27
- color: inherit;
28
- text-decoration: none;
29
- text-underline-offset: 0.2em;
30
- }
31
- :global(.maplibregl-ctrl-attrib) :global(a:hover) {
32
- color: inherit;
33
- text-decoration: underline;
34
- }</style>
@@ -1,4 +1,5 @@
1
1
  import { type ControlPosition } from 'maplibre-gl';
2
+ import './AttributionControl.css';
2
3
  interface AttributionControlProps {
3
4
  position?: ControlPosition;
4
5
  customAttribution?: string;
@@ -0,0 +1,144 @@
1
+ .maplibregl-ctrl-geocoder {
2
+ background-color: #fff;
3
+ position: relative;
4
+ width: 100%;
5
+ z-index: 1;
6
+ font-family: var(--swr-sans);
7
+ font-size: var(--fs-small-1);
8
+ border-radius: var(--br-small);
9
+ border: 1px solid rgba(0, 0, 0, 0.75);
10
+ box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.075);
11
+ }
12
+
13
+ .maplibre-gl-geocoder--error {
14
+ font-size: var(--fs-small-2);
15
+ color: var(--gray-dark-2);
16
+ padding: 0.4em 0.65em;
17
+ }
18
+
19
+ .maplibregl-ctrl-geocoder--input {
20
+ width: calc(100% - 3.7em);
21
+ height: 100%;
22
+ font-family: inherit;
23
+ font-size: inherit;
24
+ background-color: transparent;
25
+ color: var(--gray-dark-5);
26
+ border: 0;
27
+ height: 1.85em;
28
+ padding: 0 1.85em;
29
+ padding-top: 0.1em;
30
+ text-overflow: ellipsis;
31
+ white-space: nowrap;
32
+ overflow: hidden;
33
+ }
34
+
35
+ .maplibregl-ctrl-geocoder--input::placeholder {
36
+ opacity: 1;
37
+ color: var(--gray-dark-2);
38
+ }
39
+ .maplibregl-ctrl-geocoder--input:focus {
40
+ color: var(--gray-dark-5);
41
+ outline: 0;
42
+ }
43
+
44
+ .maplibregl-ctrl-geocoder .maplibregl-ctrl-geocoder--pin-right > * {
45
+ display: none;
46
+ position: absolute;
47
+ z-index: 2;
48
+ right: 0.5em;
49
+ top: 50%;
50
+ transform: translateY(-50%);
51
+ border: 0;
52
+ }
53
+
54
+ /* Suggestions */
55
+ .maplibregl-ctrl-geocoder .suggestions {
56
+ background: white;
57
+ border: 1px solid rgba(0, 0, 0, 0.75);
58
+ box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
59
+ border-radius: var(--br-small);
60
+ left: 0;
61
+ list-style: none;
62
+ position: absolute;
63
+ width: 100%;
64
+ top: calc(100% + 0.5em);
65
+ z-index: 1000;
66
+ overflow: hidden;
67
+ }
68
+
69
+ .maplibregl-ctrl-bottom-left .suggestions,
70
+ .maplibregl-ctrl-bottom-right .suggestions {
71
+ top: auto;
72
+ bottom: 100%;
73
+ }
74
+
75
+ .maplibregl-ctrl-geocoder .suggestions > li > a {
76
+ cursor: default;
77
+ display: block;
78
+ padding: 0.5em 0.75em;
79
+ color: var(--gray-dark-5);
80
+ padding-bottom: 0.5em;
81
+ border-bottom: 1px solid var(--gray-light-3);
82
+ }
83
+ .maplibregl-ctrl-geocoder .suggestions > li:last-child > a {
84
+ border-bottom: 0;
85
+ }
86
+
87
+ .maplibregl-ctrl-geocoder .suggestions > .active > a,
88
+ .maplibregl-ctrl-geocoder .suggestions > li > a:hover {
89
+ background: var(--gray-light-5);
90
+ text-decoration: none;
91
+ cursor: pointer;
92
+ }
93
+ .maplibregl-ctrl-geocoder .suggestions > .active .maplibregl-ctrl-geocoder--result-title,
94
+ .maplibregl-ctrl-geocoder .suggestions > li > a:hover .maplibregl-ctrl-geocoder--result-title {
95
+ text-decoration: underline;
96
+ }
97
+
98
+ .maplibregl-ctrl-geocoder--suggestion {
99
+ display: flex;
100
+ flex-direction: row;
101
+ align-items: center;
102
+ }
103
+
104
+ .maplibregl-ctrl-geocoder--suggestion-info {
105
+ display: flex;
106
+ flex-direction: column;
107
+ }
108
+
109
+ .maplibregl-ctrl-geocoder--suggestion-title,
110
+ .maplibregl-ctrl-geocoder--suggestion-address,
111
+ .maplibregl-ctrl-geocoder--result-address {
112
+ text-overflow: ellipsis;
113
+ overflow: hidden;
114
+ white-space: nowrap;
115
+ }
116
+
117
+ .maplibregl-ctrl-geocoder--result-icon {
118
+ display: none;
119
+ }
120
+ .maplibregl-ctrl-geocoder--result-title {
121
+ font-weight: 600;
122
+ letter-spacing: 0;
123
+ }
124
+ .maplibregl-ctrl-geocoder--result-address {
125
+ font-size: var(--fs-small-2);
126
+ color: var(--gray-dark-2);
127
+ line-height: 1.3;
128
+ }
129
+
130
+ .maplibregl-ctrl-geocoder--icon {
131
+ display: inline-block;
132
+ position: absolute;
133
+ top: 50%;
134
+ transform: translateY(-50%);
135
+ height: 1em;
136
+ }
137
+
138
+ .maplibregl-ctrl-geocoder--icon-close {
139
+ right: 0;
140
+ }
141
+ .maplibregl-ctrl-geocoder--icon-search {
142
+ left: 0.5em;
143
+ height: 1.5em;
144
+ }
@@ -3,6 +3,7 @@ import MaplibreGeocoder, {} from '@maplibre/maplibre-gl-geocoder';
3
3
  import { MaptilerGeocoderAPI } from './GeocoderAPIs';
4
4
  import MapControl from '../MapControl/MapControl.svelte';
5
5
  import {} from '../types';
6
+ import './GeocoderControl.css';
6
7
  const { key, service = 'maptiler', countries = 'de', languages = 'en', placeholder, limit = 3 } = $props();
7
8
  const countriesArr = Array.isArray(countries) ? countries : [countries];
8
9
  const languagesArr = Array.isArray(languages) ? languages : [languages];
@@ -21,133 +22,3 @@ const geocoder = new MaplibreGeocoder(geocoderAPI, {
21
22
  </script>
22
23
 
23
24
  <MapControl control={geocoder} position="top-left" />
24
-
25
- <style>:global(.maplibregl-ctrl-geocoder) {
26
- background-color: #fff;
27
- position: relative;
28
- width: 100%;
29
- z-index: 1;
30
- font-family: var(--swr-sans);
31
- font-size: var(--fs-small-1);
32
- border-radius: var(--br-small);
33
- border: 1px solid rgba(0, 0, 0, 0.75);
34
- box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.075);
35
- }
36
- :global(.maplibre-gl-geocoder--error) {
37
- font-size: var(--fs-small-2);
38
- color: var(--gray-dark-2);
39
- padding: 0.4em 0.65em;
40
- }
41
- :global(.maplibregl-ctrl-geocoder--input) {
42
- width: calc(100% - 3.7em);
43
- height: 100%;
44
- font-family: inherit;
45
- font-size: inherit;
46
- background-color: transparent;
47
- color: var(--gray-dark-5);
48
- border: 0;
49
- height: 1.85em;
50
- padding: 0 1.85em;
51
- padding-top: 0.1em;
52
- text-overflow: ellipsis;
53
- white-space: nowrap;
54
- overflow: hidden;
55
- }
56
- :global(.maplibregl-ctrl-geocoder--input::placeholder) {
57
- opacity: 1;
58
- color: var(--gray-dark-2);
59
- }
60
- :global(.maplibregl-ctrl-geocoder--input:focus) {
61
- color: var(--gray-dark-5);
62
- outline: 0;
63
- }
64
- :global(.maplibregl-ctrl-geocoder) :global(.maplibregl-ctrl-geocoder--pin-right) > :global(*) {
65
- display: none;
66
- position: absolute;
67
- z-index: 2;
68
- right: 0.5em;
69
- top: 50%;
70
- transform: translateY(-50%);
71
- border: 0;
72
- }
73
- :global(.maplibregl-ctrl-geocoder) :global(.suggestions) {
74
- background: white;
75
- border: 1px solid rgba(0, 0, 0, 0.75);
76
- box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
77
- border-radius: var(--br-small);
78
- left: 0;
79
- list-style: none;
80
- position: absolute;
81
- width: 100%;
82
- top: calc(100% + 0.5em);
83
- z-index: 1000;
84
- overflow: hidden;
85
- }
86
- :global(.maplibregl-ctrl-bottom-left) :global(.suggestions),
87
- :global(.maplibregl-ctrl-bottom-right) :global(.suggestions) {
88
- top: auto;
89
- bottom: 100%;
90
- }
91
- :global(.maplibregl-ctrl-geocoder) :global(.suggestions) > :global(li) > :global(a) {
92
- cursor: default;
93
- display: block;
94
- padding: 0.5em 0.75em;
95
- color: var(--gray-dark-5);
96
- padding-bottom: 0.5em;
97
- border-bottom: 1px solid var(--gray-light-3);
98
- }
99
- :global(.maplibregl-ctrl-geocoder) :global(.suggestions) > :global(li:last-child) > :global(a) {
100
- border-bottom: 0;
101
- }
102
- :global(.maplibregl-ctrl-geocoder) :global(.suggestions) > :global(.active) > :global(a),
103
- :global(.maplibregl-ctrl-geocoder) :global(.suggestions) > :global(li) > :global(a:hover) {
104
- background: var(--gray-light-5);
105
- text-decoration: none;
106
- cursor: pointer;
107
- }
108
- :global(.maplibregl-ctrl-geocoder) :global(.suggestions) > :global(.active) :global(.maplibregl-ctrl-geocoder--result-title),
109
- :global(.maplibregl-ctrl-geocoder) :global(.suggestions) > :global(li) > :global(a:hover) :global(.maplibregl-ctrl-geocoder--result-title) {
110
- text-decoration: underline;
111
- }
112
- :global(.maplibregl-ctrl-geocoder--suggestion) {
113
- display: flex;
114
- flex-direction: row;
115
- align-items: center;
116
- }
117
- :global(.maplibregl-ctrl-geocoder--suggestion-info) {
118
- display: flex;
119
- flex-direction: column;
120
- }
121
- :global(.maplibregl-ctrl-geocoder--suggestion-title),
122
- :global(.maplibregl-ctrl-geocoder--suggestion-address),
123
- :global(.maplibregl-ctrl-geocoder--result-address) {
124
- text-overflow: ellipsis;
125
- overflow: hidden;
126
- white-space: nowrap;
127
- }
128
- :global(.maplibregl-ctrl-geocoder--result-icon) {
129
- display: none;
130
- }
131
- :global(.maplibregl-ctrl-geocoder--result-title) {
132
- font-weight: 600;
133
- letter-spacing: 0;
134
- }
135
- :global(.maplibregl-ctrl-geocoder--result-address) {
136
- font-size: var(--fs-small-2);
137
- color: var(--gray-dark-2);
138
- line-height: 1.3;
139
- }
140
- :global(.maplibregl-ctrl-geocoder--icon) {
141
- display: inline-block;
142
- position: absolute;
143
- top: 50%;
144
- transform: translateY(-50%);
145
- height: 1em;
146
- }
147
- :global(.maplibregl-ctrl-geocoder--icon-close) {
148
- right: 0;
149
- }
150
- :global(.maplibregl-ctrl-geocoder--icon-search) {
151
- left: 0.5em;
152
- height: 1.5em;
153
- }</style>
@@ -1,4 +1,5 @@
1
1
  import { type GeocodingCountry, type GeocodingLanguage, type GeocodingService } from '../types';
2
+ import './GeocoderControl.css';
2
3
  interface GeocoderControlProps {
3
4
  service: GeocodingService;
4
5
  /**
@@ -0,0 +1,153 @@
1
+ .maplibregl-map {
2
+ overflow: hidden;
3
+ position: relative;
4
+ }
5
+
6
+ .maplibregl-canvas {
7
+ left: 0;
8
+ position: absolute;
9
+ top: 0;
10
+ }
11
+
12
+ .maplibregl-map:fullscreen {
13
+ height: 100%;
14
+ width: 100%;
15
+ }
16
+
17
+ .maplibregl-canvas-container.maplibregl-interactive {
18
+ cursor: grab;
19
+ user-select: none;
20
+ }
21
+
22
+ .maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer {
23
+ cursor: pointer;
24
+ }
25
+
26
+ .maplibregl-canvas-container.maplibregl-interactive:active {
27
+ cursor: grabbing;
28
+ }
29
+
30
+ .maplibregl-canvas-container.maplibregl-touch-zoom-rotate,
31
+ .maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas {
32
+ touch-action: pan-x pan-y;
33
+ }
34
+
35
+ .maplibregl-canvas-container.maplibregl-touch-drag-pan,
36
+ .maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas {
37
+ touch-action: pinch-zoom;
38
+ }
39
+
40
+ .maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,
41
+ .maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan
42
+ .maplibregl-canvas {
43
+ touch-action: none;
44
+ }
45
+ .maplibregl-ctrl-bottom-left,
46
+ .maplibregl-ctrl-bottom-right,
47
+ .maplibregl-ctrl-top-left,
48
+ .maplibregl-ctrl-top-right {
49
+ position: absolute;
50
+ z-index: 2;
51
+ display: flex;
52
+ flex-flow: column;
53
+ gap: 0.75em;
54
+ align-items: flex-start;
55
+ }
56
+
57
+ .maplibregl-ctrl-top-left {
58
+ left: 0.5em;
59
+ top: 0.5em;
60
+ }
61
+
62
+ .maplibregl-ctrl-top-right {
63
+ right: 0;
64
+ top: 0;
65
+ }
66
+
67
+ .maplibregl-ctrl-bottom-left {
68
+ bottom: 0.5em;
69
+ left: 0.5em;
70
+ }
71
+
72
+ .maplibregl-ctrl-bottom-right {
73
+ bottom: 0.5em;
74
+ right: 0.5em;
75
+ }
76
+
77
+ .maplibregl-ctrl {
78
+ pointer-events: auto;
79
+ transform: translate(0);
80
+ }
81
+
82
+ .maplibregl-ctrl-group {
83
+ background: white;
84
+ border: 1px solid rgba(0, 0, 0, 0.75);
85
+ box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.075);
86
+ border-radius: var(--br-small);
87
+ overflow: hidden;
88
+ }
89
+
90
+ .maplibregl-ctrl-group button {
91
+ background-color: transparent;
92
+ border: 0;
93
+ box-sizing: border-box;
94
+ cursor: pointer;
95
+ display: block;
96
+ height: 29px;
97
+ outline: none;
98
+ padding: 0;
99
+ width: 29px;
100
+ }
101
+
102
+ .maplibregl-ctrl-group button + button {
103
+ border-top: 1px solid rgba(0, 0, 0, 0.35);
104
+ }
105
+
106
+ .maplibregl-ctrl button .maplibregl-ctrl-icon {
107
+ background-position: 50%;
108
+ background-repeat: no-repeat;
109
+ display: block;
110
+ height: 100%;
111
+ width: 100%;
112
+ }
113
+
114
+ .maplibregl-ctrl button:disabled {
115
+ cursor: not-allowed;
116
+ }
117
+
118
+ .maplibregl-ctrl button:disabled .maplibregl-ctrl-icon {
119
+ opacity: 0.5;
120
+ }
121
+
122
+ .maplibregl-ctrl button:not(:disabled):hover {
123
+ background-color: var(--gray-light-5);
124
+ }
125
+
126
+ .maplibregl-ctrl-group button:focus:focus-visible {
127
+ box-shadow: 0 0 2px 2px #0096ff;
128
+ }
129
+
130
+ .maplibregl-ctrl-group button:focus:not(:focus-visible) {
131
+ box-shadow: none;
132
+ }
133
+
134
+ .maplibregl-ctrl-group button:focus:first-child {
135
+ border-radius: 4px 4px 0 0;
136
+ }
137
+
138
+ .maplibregl-ctrl-group button:focus:last-child {
139
+ border-radius: 0 0 4px 4px;
140
+ }
141
+
142
+ .maplibregl-ctrl-group button:focus:only-child {
143
+ border-radius: inherit;
144
+ }
145
+ .maplibregl-marker {
146
+ left: 0;
147
+ top: 0;
148
+ position: absolute;
149
+ will-change: transform;
150
+ }
151
+ .maplibregl-marker path {
152
+ fill: var(--violet-dark-5);
153
+ }
@@ -3,6 +3,7 @@ import { onMount, onDestroy, getContext, hasContext } from 'svelte';
3
3
  import { createMapContext } from '../context.svelte.js';
4
4
  import {} from '../types';
5
5
  import FallbackStyle from './FallbackStyle';
6
+ import './Map.css';
6
7
  let { children, options, style = FallbackStyle, minZoom = 0, maxZoom = 14.99, zoom = $bindable(), center = $bindable(), pitch = $bindable(0), bearing = $bindable(0), loading = $bindable(true), projection = { type: 'mercator' }, allowRotation = false, allowZoom = true, showDebug = false, initialLocation = { lat: 51.3, lng: 10.2, zoom: 5 } } = $props();
7
8
  let container;
8
9
  const mapContext = createMapContext();
@@ -72,146 +73,20 @@ $effect(() => {
72
73
  {/if}
73
74
  </div>
74
75
 
75
- <style>.container {
76
- width: 100%;
77
- height: 100%;
78
- }
79
-
80
- .debug {
81
- position: absolute;
82
- top: 0;
83
- right: 0;
84
- background: rgba(0, 0, 0, 0.9);
85
- color: white;
86
- z-index: 1000;
87
- padding: 2px;
88
- font-family: monospace;
89
- }
76
+ <style>
77
+ .container {
78
+ width: 100%;
79
+ height: 100%;
80
+ }
90
81
 
91
- :global(.maplibregl-map) {
92
- overflow: hidden;
93
- position: relative;
94
- }
95
- :global(.maplibregl-canvas) {
96
- left: 0;
97
- position: absolute;
98
- top: 0;
99
- }
100
- :global(.maplibregl-map:fullscreen) {
101
- height: 100%;
102
- width: 100%;
103
- }
104
- :global(.maplibregl-canvas-container.maplibregl-interactive) {
105
- cursor: grab;
106
- user-select: none;
107
- }
108
- :global(.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer) {
109
- cursor: pointer;
110
- }
111
- :global(.maplibregl-canvas-container.maplibregl-interactive:active) {
112
- cursor: grabbing;
113
- }
114
- :global(.maplibregl-canvas-container.maplibregl-touch-zoom-rotate),
115
- :global(.maplibregl-canvas-container.maplibregl-touch-zoom-rotate) :global(.maplibregl-canvas) {
116
- touch-action: pan-x pan-y;
117
- }
118
- :global(.maplibregl-canvas-container.maplibregl-touch-drag-pan),
119
- :global(.maplibregl-canvas-container.maplibregl-touch-drag-pan) :global(.maplibregl-canvas) {
120
- touch-action: pinch-zoom;
121
- }
122
- :global(.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan),
123
- :global(.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan) :global(.maplibregl-canvas) {
124
- touch-action: none;
125
- }
126
- :global(.maplibregl-ctrl-bottom-left),
127
- :global(.maplibregl-ctrl-bottom-right),
128
- :global(.maplibregl-ctrl-top-left),
129
- :global(.maplibregl-ctrl-top-right) {
130
- position: absolute;
131
- z-index: 2;
132
- display: flex;
133
- flex-flow: column;
134
- gap: 0.75em;
135
- align-items: flex-start;
136
- }
137
- :global(.maplibregl-ctrl-top-left) {
138
- left: 0.5em;
139
- top: 0.5em;
140
- }
141
- :global(.maplibregl-ctrl-top-right) {
142
- right: 0;
143
- top: 0;
144
- }
145
- :global(.maplibregl-ctrl-bottom-left) {
146
- bottom: 0.5em;
147
- left: 0.5em;
148
- }
149
- :global(.maplibregl-ctrl-bottom-right) {
150
- bottom: 0.5em;
151
- right: 0.5em;
152
- }
153
- :global(.maplibregl-ctrl) {
154
- pointer-events: auto;
155
- transform: translate(0);
156
- }
157
- :global(.maplibregl-ctrl-group) {
158
- background: white;
159
- border: 1px solid rgba(0, 0, 0, 0.75);
160
- box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.075);
161
- border-radius: var(--br-small);
162
- overflow: hidden;
163
- }
164
- :global(.maplibregl-ctrl-group) :global(button) {
165
- background-color: transparent;
166
- border: 0;
167
- box-sizing: border-box;
168
- cursor: pointer;
169
- display: block;
170
- height: 29px;
171
- outline: none;
172
- padding: 0;
173
- width: 29px;
174
- }
175
- :global(.maplibregl-ctrl-group) :global(button) + :global(button) {
176
- border-top: 1px solid rgba(0, 0, 0, 0.35);
177
- }
178
- :global(.maplibregl-ctrl) :global(button) :global(.maplibregl-ctrl-icon) {
179
- background-position: 50%;
180
- background-repeat: no-repeat;
181
- display: block;
182
- height: 100%;
183
- width: 100%;
184
- }
185
- :global(.maplibregl-ctrl) :global(button:disabled) {
186
- cursor: not-allowed;
187
- }
188
- :global(.maplibregl-ctrl) :global(button:disabled) :global(.maplibregl-ctrl-icon) {
189
- opacity: 0.5;
190
- }
191
- :global(.maplibregl-ctrl) :global(button:not(:disabled):hover) {
192
- background-color: var(--gray-light-5);
193
- }
194
- :global(.maplibregl-ctrl-group) :global(button:focus:focus-visible) {
195
- box-shadow: 0 0 2px 2px #0096ff;
196
- }
197
- :global(.maplibregl-ctrl-group) :global(button:focus:not(:focus-visible)) {
198
- box-shadow: none;
199
- }
200
- :global(.maplibregl-ctrl-group) :global(button:focus:first-child) {
201
- border-radius: 4px 4px 0 0;
202
- }
203
- :global(.maplibregl-ctrl-group) :global(button:focus:last-child) {
204
- border-radius: 0 0 4px 4px;
205
- }
206
- :global(.maplibregl-ctrl-group) :global(button:focus:only-child) {
207
- border-radius: inherit;
208
- }
209
- :global(.maplibregl-marker) {
210
- left: 0;
211
- top: 0;
212
- position: absolute;
213
- will-change: transform;
214
- }
215
- :global(.maplibregl-marker) :global(path) {
216
- fill: var(--violet-dark-5);
217
- }</style>
82
+ .debug {
83
+ position: absolute;
84
+ top: 0;
85
+ right: 0;
86
+ background: rgba(0, 0, 0, 0.9);
87
+ color: white;
88
+ z-index: 1000;
89
+ padding: 2px;
90
+ font-family: monospace;
91
+ }
92
+ </style>
@@ -1,6 +1,7 @@
1
1
  import maplibre, { type ProjectionSpecification, type StyleSpecification } from 'maplibre-gl';
2
2
  import { type Snippet } from 'svelte';
3
3
  import { type Location } from '../types';
4
+ import './Map.css';
4
5
  interface MapProps {
5
6
  style?: StyleSpecification | string;
6
7
  initialLocation?: Location;
@@ -0,0 +1,11 @@
1
+ button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
2
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E");
3
+ }
4
+
5
+ button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon {
6
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E");
7
+ }
8
+
9
+ button.maplibregl-ctrl-compass .maplibregl-ctrl-icon {
10
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath d='m10.5 16 4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E");
11
+ }
@@ -1,16 +1,7 @@
1
1
  <script lang="ts">import maplibre, {} from 'maplibre-gl';
2
2
  import MapControl from '../MapControl/MapControl.svelte';
3
+ import './NavigationControl.css';
3
4
  const { showCompass = false, visualizePitch = false, position = 'bottom-left' } = $props();
4
5
  </script>
5
6
 
6
7
  <MapControl control={new maplibre.NavigationControl({ showCompass, visualizePitch })} {position} />
7
-
8
- <style>:global(button.maplibregl-ctrl-zoom-out) :global(.maplibregl-ctrl-icon) {
9
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E");
10
- }
11
- :global(button.maplibregl-ctrl-zoom-in) :global(.maplibregl-ctrl-icon) {
12
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E");
13
- }
14
- :global(button.maplibregl-ctrl-compass) :global(.maplibregl-ctrl-icon) {
15
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath d='m10.5 16 4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E");
16
- }</style>
@@ -1,4 +1,5 @@
1
1
  import { type ControlPosition } from 'maplibre-gl';
2
+ import './NavigationControl.css';
2
3
  interface NavigationControlProps {
3
4
  showCompass?: boolean;
4
5
  /**
@@ -0,0 +1,7 @@
1
+ .maplibregl-ctrl-scale {
2
+ color: inherit;
3
+ border-bottom: 1px solid currentColor;
4
+ font-weight: 400;
5
+ font-size: var(--fs-small-3);
6
+ font-family: var(--swr-text);
7
+ }
@@ -1,14 +1,7 @@
1
1
  <script lang="ts">import maplibre, {} from 'maplibre-gl';
2
2
  import MapControl from '../MapControl/MapControl.svelte';
3
+ import './ScaleControl.css';
3
4
  let { maxWidth = 100, unit = 'metric', position = 'bottom-left' } = $props();
4
5
  </script>
5
6
 
6
7
  <MapControl control={new maplibre.ScaleControl({ maxWidth, unit })} {position} />
7
-
8
- <style>:global(.maplibregl-ctrl-scale) {
9
- color: inherit;
10
- border-bottom: 1px solid currentColor;
11
- font-weight: 400;
12
- font-size: var(--fs-small-3);
13
- font-family: var(--swr-text);
14
- }</style>
@@ -1,4 +1,5 @@
1
1
  import { type ControlPosition, type Unit } from 'maplibre-gl';
2
+ import './ScaleControl.css';
2
3
  interface ScaleControlProps {
3
4
  maxWidth?: number | undefined;
4
5
  position?: ControlPosition;
@@ -0,0 +1,96 @@
1
+ .maplibregl-popup {
2
+ top: 0;
3
+ left: 0;
4
+ display: flex;
5
+ position: absolute;
6
+ will-change: transform;
7
+ }
8
+ .maplibregl-popup-anchor-top,
9
+ .maplibregl-popup-anchor-top-left,
10
+ .maplibregl-popup-anchor-top-right {
11
+ flex-direction: column;
12
+ }
13
+ .maplibregl-popup-anchor-bottom,
14
+ .maplibregl-popup-anchor-bottom-left,
15
+ .maplibregl-popup-anchor-bottom-right {
16
+ flex-direction: column-reverse;
17
+ }
18
+
19
+ .maplibregl-popup-anchor-left {
20
+ flex-direction: row;
21
+ }
22
+
23
+ .maplibregl-popup-anchor-right {
24
+ flex-direction: row-reverse;
25
+ }
26
+
27
+ .maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
28
+ transform: translateY(50%) rotate(45deg);
29
+ align-self: center;
30
+ }
31
+
32
+ .maplibregl-popup-anchor-top .maplibregl-popup-tip {
33
+ transform: translateY(-50%) rotate(-135deg);
34
+ align-self: center;
35
+ }
36
+
37
+ .maplibregl-popup-anchor-left .maplibregl-popup-tip {
38
+ transform: translateX(-50%) rotate(135deg);
39
+ align-self: center;
40
+ }
41
+
42
+ .maplibregl-popup-anchor-top-left .maplibregl-popup-tip {
43
+ transform: translateY(1em) translateX(-50%) rotate(135deg);
44
+ }
45
+
46
+ .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip {
47
+ transform: translateY(-1em) translateX(-50%) rotate(135deg);
48
+ }
49
+
50
+ .maplibregl-popup-anchor-right .maplibregl-popup-tip {
51
+ transform: translateX(50%) rotate(-45deg);
52
+ align-self: center;
53
+ }
54
+
55
+ .maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
56
+ transform: translateX(-1em) translateY(-50%) rotate(-135deg);
57
+ align-self: flex-end;
58
+ }
59
+
60
+ .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
61
+ transform: translateX(-1em) translateY(50%) rotate(45deg);
62
+ align-self: flex-end;
63
+ }
64
+
65
+ .maplibregl-popup-close-button {
66
+ position: absolute;
67
+ top: 0.5em;
68
+ right: 0.5em;
69
+ cursor: pointer;
70
+ border-radius: 2px;
71
+ display: flex;
72
+ justify-content: center;
73
+ align-items: center;
74
+ padding-bottom: 0.15em;
75
+ font-size: 1.25rem;
76
+ width: 1.1em;
77
+ height: 1.1em;
78
+ z-index: 100;
79
+ background: white;
80
+ border: 1px solid var(--gray-dark-5);
81
+ }
82
+
83
+ .maplibregl-popup-close-button:hover,
84
+ .maplibregl-popup-close-button:focus {
85
+ background: var(--gray-light-5);
86
+ }
87
+
88
+ .maplibregl-popup-tip {
89
+ width: 0.65rem;
90
+ height: 0.65rem;
91
+ background: white;
92
+ position: absolute;
93
+ border-right: 1px solid rgba(0, 0, 0, 0.75);
94
+ border-bottom: 1px solid rgba(0, 0, 0, 0.75);
95
+ z-index: 10;
96
+ }
@@ -2,6 +2,7 @@
2
2
  import maplibre, {} from 'maplibre-gl';
3
3
  import { getMapContext } from '../context.svelte.js';
4
4
  import { resetPopupEventListener } from '../utils';
5
+ import './Tooltip.css';
5
6
  let { position, children, offset = 20, maxWidth = 360, showCloseButton = false, closeOnClick = true, mouseEvents = false, onClose, onOpen } = $props();
6
7
  const { map } = $derived(getMapContext());
7
8
  let tooltip = new maplibre.Popup({
@@ -41,88 +42,4 @@ onDestroy(() => tooltip.remove());
41
42
 
42
43
  .mouseEvents {
43
44
  pointer-events: all;
44
- }
45
-
46
- :global(.maplibregl-popup) {
47
- top: 0;
48
- left: 0;
49
- display: flex;
50
- position: absolute;
51
- will-change: transform;
52
- }
53
- :global(.maplibregl-popup-anchor-top),
54
- :global(.maplibregl-popup-anchor-top-left),
55
- :global(.maplibregl-popup-anchor-top-right) {
56
- flex-direction: column;
57
- }
58
- :global(.maplibregl-popup-anchor-bottom),
59
- :global(.maplibregl-popup-anchor-bottom-left),
60
- :global(.maplibregl-popup-anchor-bottom-right) {
61
- flex-direction: column-reverse;
62
- }
63
- :global(.maplibregl-popup-anchor-left) {
64
- flex-direction: row;
65
- }
66
- :global(.maplibregl-popup-anchor-right) {
67
- flex-direction: row-reverse;
68
- }
69
- :global(.maplibregl-popup-anchor-bottom) :global(.maplibregl-popup-tip) {
70
- transform: translateY(50%) rotate(45deg);
71
- align-self: center;
72
- }
73
- :global(.maplibregl-popup-anchor-top) :global(.maplibregl-popup-tip) {
74
- transform: translateY(-50%) rotate(-135deg);
75
- align-self: center;
76
- }
77
- :global(.maplibregl-popup-anchor-left) :global(.maplibregl-popup-tip) {
78
- transform: translateX(-50%) rotate(135deg);
79
- align-self: center;
80
- }
81
- :global(.maplibregl-popup-anchor-top-left) :global(.maplibregl-popup-tip) {
82
- transform: translateY(1em) translateX(-50%) rotate(135deg);
83
- }
84
- :global(.maplibregl-popup-anchor-bottom-left) :global(.maplibregl-popup-tip) {
85
- transform: translateY(-1em) translateX(-50%) rotate(135deg);
86
- }
87
- :global(.maplibregl-popup-anchor-right) :global(.maplibregl-popup-tip) {
88
- transform: translateX(50%) rotate(-45deg);
89
- align-self: center;
90
- }
91
- :global(.maplibregl-popup-anchor-top-right) :global(.maplibregl-popup-tip) {
92
- transform: translateX(-1em) translateY(-50%) rotate(-135deg);
93
- align-self: flex-end;
94
- }
95
- :global(.maplibregl-popup-anchor-bottom-right) :global(.maplibregl-popup-tip) {
96
- transform: translateX(-1em) translateY(50%) rotate(45deg);
97
- align-self: flex-end;
98
- }
99
- :global(.maplibregl-popup-close-button) {
100
- position: absolute;
101
- top: 0.5em;
102
- right: 0.5em;
103
- cursor: pointer;
104
- border-radius: 2px;
105
- display: flex;
106
- justify-content: center;
107
- align-items: center;
108
- padding-bottom: 0.15em;
109
- font-size: 1.25rem;
110
- width: 1.1em;
111
- height: 1.1em;
112
- z-index: 100;
113
- background: white;
114
- border: 1px solid var(--gray-dark-5);
115
- }
116
- :global(.maplibregl-popup-close-button:hover),
117
- :global(.maplibregl-popup-close-button:focus) {
118
- background: var(--gray-light-5);
119
- }
120
- :global(.maplibregl-popup-tip) {
121
- width: 0.65rem;
122
- height: 0.65rem;
123
- background: white;
124
- position: absolute;
125
- border-right: 1px solid rgba(0, 0, 0, 0.75);
126
- border-bottom: 1px solid rgba(0, 0, 0, 0.75);
127
- z-index: 10;
128
45
  }</style>
@@ -1,5 +1,6 @@
1
1
  import { type Snippet } from 'svelte';
2
2
  import { type Listener, type LngLatLike } from 'maplibre-gl';
3
+ import './Tooltip.css';
3
4
  interface TooltipProps {
4
5
  position: LngLatLike | undefined;
5
6
  children?: Snippet;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swr-data-lab/components",
3
3
  "description": "SWR Data Lab component library",
4
- "version": "1.13.7",
4
+ "version": "1.13.9",
5
5
  "author": "SWR Data Lab",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",