@deepfuture/dui-map 1.1.0
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/README.md +214 -0
- package/cluster-layer/index.d.ts +2 -0
- package/cluster-layer/index.js +2 -0
- package/cluster-layer/map-cluster-layer.d.ts +53 -0
- package/cluster-layer/map-cluster-layer.js +337 -0
- package/controls/index.d.ts +2 -0
- package/controls/index.js +2 -0
- package/controls/map-controls.d.ts +37 -0
- package/controls/map-controls.js +344 -0
- package/heatmap/index.d.ts +2 -0
- package/heatmap/index.js +2 -0
- package/heatmap/map-heatmap.d.ts +39 -0
- package/heatmap/map-heatmap.js +330 -0
- package/index.d.ts +10 -0
- package/index.js +9 -0
- package/map/index.d.ts +5 -0
- package/map/index.js +3 -0
- package/map/map-context.d.ts +8 -0
- package/map/map-context.js +2 -0
- package/map/map.d.ts +120 -0
- package/map/map.js +628 -0
- package/marker/index.d.ts +9 -0
- package/marker/index.js +7 -0
- package/marker/map-marker-content.d.ts +20 -0
- package/marker/map-marker-content.js +135 -0
- package/marker/map-marker-label.d.ts +21 -0
- package/marker/map-marker-label.js +126 -0
- package/marker/map-marker-popup.d.ts +25 -0
- package/marker/map-marker-popup.js +158 -0
- package/marker/map-marker-tooltip.d.ts +22 -0
- package/marker/map-marker-tooltip.js +159 -0
- package/marker/map-marker.d.ts +48 -0
- package/marker/map-marker.js +220 -0
- package/marker/marker-context.d.ts +8 -0
- package/marker/marker-context.js +2 -0
- package/package.json +70 -0
- package/popup/index.d.ts +2 -0
- package/popup/index.js +2 -0
- package/popup/map-popup.d.ts +29 -0
- package/popup/map-popup.js +184 -0
- package/region/index.d.ts +2 -0
- package/region/index.js +2 -0
- package/region/map-region.d.ts +41 -0
- package/region/map-region.js +276 -0
- package/route/index.d.ts +2 -0
- package/route/index.js +2 -0
- package/route/map-route.d.ts +33 -0
- package/route/map-route.js +245 -0
- package/theme/map-theme.d.ts +16 -0
- package/theme/map-theme.js +233 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { css, LitElement, html } from "lit";
|
|
36
|
+
import { property } from "lit/decorators.js";
|
|
37
|
+
import { consume } from "@lit/context";
|
|
38
|
+
import { base } from "@deepfuture/dui-primitives/core/base";
|
|
39
|
+
import { customEvent } from "@deepfuture/dui-primitives/core/event";
|
|
40
|
+
import { mapContext } from "../map/map-context.js";
|
|
41
|
+
/** Fired when the route line is clicked. */
|
|
42
|
+
export const routeClickEvent = customEvent("dui-route-click", { bubbles: true, composed: true });
|
|
43
|
+
const styles = css `
|
|
44
|
+
:host {
|
|
45
|
+
display: contents;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
/**
|
|
49
|
+
* `<dui-map-route>` — GeoJSON LineString route layer on the map.
|
|
50
|
+
*
|
|
51
|
+
* @fires dui-route-click - Fired when the route line is clicked.
|
|
52
|
+
*/
|
|
53
|
+
let DuiMapRoute = (() => {
|
|
54
|
+
let _classSuper = LitElement;
|
|
55
|
+
let _routeId_decorators;
|
|
56
|
+
let _routeId_initializers = [];
|
|
57
|
+
let _routeId_extraInitializers = [];
|
|
58
|
+
let _coordinates_decorators;
|
|
59
|
+
let _coordinates_initializers = [];
|
|
60
|
+
let _coordinates_extraInitializers = [];
|
|
61
|
+
let _color_decorators;
|
|
62
|
+
let _color_initializers = [];
|
|
63
|
+
let _color_extraInitializers = [];
|
|
64
|
+
let _width_decorators;
|
|
65
|
+
let _width_initializers = [];
|
|
66
|
+
let _width_extraInitializers = [];
|
|
67
|
+
let _opacity_decorators;
|
|
68
|
+
let _opacity_initializers = [];
|
|
69
|
+
let _opacity_extraInitializers = [];
|
|
70
|
+
let _dashArray_decorators;
|
|
71
|
+
let _dashArray_initializers = [];
|
|
72
|
+
let _dashArray_extraInitializers = [];
|
|
73
|
+
let _interactive_decorators;
|
|
74
|
+
let _interactive_initializers = [];
|
|
75
|
+
let _interactive_extraInitializers = [];
|
|
76
|
+
let __mapCtx_decorators;
|
|
77
|
+
let __mapCtx_initializers = [];
|
|
78
|
+
let __mapCtx_extraInitializers = [];
|
|
79
|
+
return class DuiMapRoute extends _classSuper {
|
|
80
|
+
static {
|
|
81
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
82
|
+
_routeId_decorators = [property({ attribute: "route-id" })];
|
|
83
|
+
_coordinates_decorators = [property({ type: Array })];
|
|
84
|
+
_color_decorators = [property()];
|
|
85
|
+
_width_decorators = [property({ type: Number })];
|
|
86
|
+
_opacity_decorators = [property({ type: Number })];
|
|
87
|
+
_dashArray_decorators = [property({ type: Array, attribute: "dash-array" })];
|
|
88
|
+
_interactive_decorators = [property({ type: Boolean })];
|
|
89
|
+
__mapCtx_decorators = [consume({ context: mapContext, subscribe: true })];
|
|
90
|
+
__esDecorate(this, null, _routeId_decorators, { kind: "accessor", name: "routeId", static: false, private: false, access: { has: obj => "routeId" in obj, get: obj => obj.routeId, set: (obj, value) => { obj.routeId = value; } }, metadata: _metadata }, _routeId_initializers, _routeId_extraInitializers);
|
|
91
|
+
__esDecorate(this, null, _coordinates_decorators, { kind: "accessor", name: "coordinates", static: false, private: false, access: { has: obj => "coordinates" in obj, get: obj => obj.coordinates, set: (obj, value) => { obj.coordinates = value; } }, metadata: _metadata }, _coordinates_initializers, _coordinates_extraInitializers);
|
|
92
|
+
__esDecorate(this, null, _color_decorators, { kind: "accessor", name: "color", static: false, private: false, access: { has: obj => "color" in obj, get: obj => obj.color, set: (obj, value) => { obj.color = value; } }, metadata: _metadata }, _color_initializers, _color_extraInitializers);
|
|
93
|
+
__esDecorate(this, null, _width_decorators, { kind: "accessor", name: "width", static: false, private: false, access: { has: obj => "width" in obj, get: obj => obj.width, set: (obj, value) => { obj.width = value; } }, metadata: _metadata }, _width_initializers, _width_extraInitializers);
|
|
94
|
+
__esDecorate(this, null, _opacity_decorators, { kind: "accessor", name: "opacity", static: false, private: false, access: { has: obj => "opacity" in obj, get: obj => obj.opacity, set: (obj, value) => { obj.opacity = value; } }, metadata: _metadata }, _opacity_initializers, _opacity_extraInitializers);
|
|
95
|
+
__esDecorate(this, null, _dashArray_decorators, { kind: "accessor", name: "dashArray", static: false, private: false, access: { has: obj => "dashArray" in obj, get: obj => obj.dashArray, set: (obj, value) => { obj.dashArray = value; } }, metadata: _metadata }, _dashArray_initializers, _dashArray_extraInitializers);
|
|
96
|
+
__esDecorate(this, null, _interactive_decorators, { kind: "accessor", name: "interactive", static: false, private: false, access: { has: obj => "interactive" in obj, get: obj => obj.interactive, set: (obj, value) => { obj.interactive = value; } }, metadata: _metadata }, _interactive_initializers, _interactive_extraInitializers);
|
|
97
|
+
__esDecorate(this, null, __mapCtx_decorators, { kind: "accessor", name: "_mapCtx", static: false, private: false, access: { has: obj => "_mapCtx" in obj, get: obj => obj._mapCtx, set: (obj, value) => { obj._mapCtx = value; } }, metadata: _metadata }, __mapCtx_initializers, __mapCtx_extraInitializers);
|
|
98
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
99
|
+
}
|
|
100
|
+
static tagName = "dui-map-route";
|
|
101
|
+
static styles = [base, styles];
|
|
102
|
+
#routeId_accessor_storage = __runInitializers(this, _routeId_initializers, `route-${Math.random().toString(36).slice(2, 9)}`);
|
|
103
|
+
/** Unique identifier for the route. Auto-generated if not set. */
|
|
104
|
+
get routeId() { return this.#routeId_accessor_storage; }
|
|
105
|
+
set routeId(value) { this.#routeId_accessor_storage = value; }
|
|
106
|
+
#coordinates_accessor_storage = (__runInitializers(this, _routeId_extraInitializers), __runInitializers(this, _coordinates_initializers, []));
|
|
107
|
+
/** Array of `[longitude, latitude]` coordinate pairs defining the route. */
|
|
108
|
+
get coordinates() { return this.#coordinates_accessor_storage; }
|
|
109
|
+
set coordinates(value) { this.#coordinates_accessor_storage = value; }
|
|
110
|
+
#color_accessor_storage = (__runInitializers(this, _coordinates_extraInitializers), __runInitializers(this, _color_initializers, "#4285F4"));
|
|
111
|
+
/** Line color as CSS color value. */
|
|
112
|
+
get color() { return this.#color_accessor_storage; }
|
|
113
|
+
set color(value) { this.#color_accessor_storage = value; }
|
|
114
|
+
#width_accessor_storage = (__runInitializers(this, _color_extraInitializers), __runInitializers(this, _width_initializers, 3));
|
|
115
|
+
/** Line width in pixels. */
|
|
116
|
+
get width() { return this.#width_accessor_storage; }
|
|
117
|
+
set width(value) { this.#width_accessor_storage = value; }
|
|
118
|
+
#opacity_accessor_storage = (__runInitializers(this, _width_extraInitializers), __runInitializers(this, _opacity_initializers, 0.8));
|
|
119
|
+
/** Line opacity from 0 to 1. */
|
|
120
|
+
get opacity() { return this.#opacity_accessor_storage; }
|
|
121
|
+
set opacity(value) { this.#opacity_accessor_storage = value; }
|
|
122
|
+
#dashArray_accessor_storage = (__runInitializers(this, _opacity_extraInitializers), __runInitializers(this, _dashArray_initializers, undefined));
|
|
123
|
+
/** Dash pattern `[dash, gap]` for dashed lines. */
|
|
124
|
+
get dashArray() { return this.#dashArray_accessor_storage; }
|
|
125
|
+
set dashArray(value) { this.#dashArray_accessor_storage = value; }
|
|
126
|
+
#interactive_accessor_storage = (__runInitializers(this, _dashArray_extraInitializers), __runInitializers(this, _interactive_initializers, true));
|
|
127
|
+
/** Whether the route is interactive (pointer cursor on hover). */
|
|
128
|
+
get interactive() { return this.#interactive_accessor_storage; }
|
|
129
|
+
set interactive(value) { this.#interactive_accessor_storage = value; }
|
|
130
|
+
#_mapCtx_accessor_storage = (__runInitializers(this, _interactive_extraInitializers), __runInitializers(this, __mapCtx_initializers, void 0));
|
|
131
|
+
get _mapCtx() { return this.#_mapCtx_accessor_storage; }
|
|
132
|
+
set _mapCtx(value) { this.#_mapCtx_accessor_storage = value; }
|
|
133
|
+
#sourceId = (__runInitializers(this, __mapCtx_extraInitializers), "");
|
|
134
|
+
#layerId = "";
|
|
135
|
+
#layerAdded = false;
|
|
136
|
+
connectedCallback() {
|
|
137
|
+
super.connectedCallback();
|
|
138
|
+
this.#sourceId = `route-source-${this.routeId}`;
|
|
139
|
+
this.#layerId = `route-layer-${this.routeId}`;
|
|
140
|
+
}
|
|
141
|
+
disconnectedCallback() {
|
|
142
|
+
super.disconnectedCallback();
|
|
143
|
+
this.#removeLayers();
|
|
144
|
+
}
|
|
145
|
+
updated(changed) {
|
|
146
|
+
const map = this._mapCtx?.map;
|
|
147
|
+
const isLoaded = this._mapCtx?.isLoaded;
|
|
148
|
+
if (!map || !isLoaded)
|
|
149
|
+
return;
|
|
150
|
+
// Add source and layer on first load
|
|
151
|
+
if (!this.#layerAdded) {
|
|
152
|
+
this.#addLayers(map);
|
|
153
|
+
}
|
|
154
|
+
// Update coordinates
|
|
155
|
+
if (changed.has("coordinates") && this.coordinates.length >= 2) {
|
|
156
|
+
const source = map.getSource(this.#sourceId);
|
|
157
|
+
if (source) {
|
|
158
|
+
source.setData({
|
|
159
|
+
type: "Feature",
|
|
160
|
+
properties: {},
|
|
161
|
+
geometry: { type: "LineString", coordinates: this.coordinates },
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Update paint properties
|
|
166
|
+
if (changed.has("color") || changed.has("width") || changed.has("opacity") || changed.has("dashArray")) {
|
|
167
|
+
if (map.getLayer(this.#layerId)) {
|
|
168
|
+
map.setPaintProperty(this.#layerId, "line-color", this.color);
|
|
169
|
+
map.setPaintProperty(this.#layerId, "line-width", this.width);
|
|
170
|
+
map.setPaintProperty(this.#layerId, "line-opacity", this.opacity);
|
|
171
|
+
if (this.dashArray) {
|
|
172
|
+
map.setPaintProperty(this.#layerId, "line-dasharray", this.dashArray);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
#addLayers(map) {
|
|
178
|
+
if (map.getSource(this.#sourceId))
|
|
179
|
+
return;
|
|
180
|
+
map.addSource(this.#sourceId, {
|
|
181
|
+
type: "geojson",
|
|
182
|
+
data: {
|
|
183
|
+
type: "Feature",
|
|
184
|
+
properties: {},
|
|
185
|
+
geometry: { type: "LineString", coordinates: [] },
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
map.addLayer({
|
|
189
|
+
id: this.#layerId,
|
|
190
|
+
type: "line",
|
|
191
|
+
source: this.#sourceId,
|
|
192
|
+
layout: { "line-join": "round", "line-cap": "round" },
|
|
193
|
+
paint: {
|
|
194
|
+
"line-color": this.color,
|
|
195
|
+
"line-width": this.width,
|
|
196
|
+
"line-opacity": this.opacity,
|
|
197
|
+
...(this.dashArray ? { "line-dasharray": this.dashArray } : {}),
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
if (this.interactive) {
|
|
201
|
+
map.on("click", this.#layerId, () => {
|
|
202
|
+
this.dispatchEvent(routeClickEvent());
|
|
203
|
+
});
|
|
204
|
+
map.on("mouseenter", this.#layerId, () => {
|
|
205
|
+
map.getCanvas().style.cursor = "pointer";
|
|
206
|
+
});
|
|
207
|
+
map.on("mouseleave", this.#layerId, () => {
|
|
208
|
+
map.getCanvas().style.cursor = "";
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
this.#layerAdded = true;
|
|
212
|
+
// Set initial coordinates if available
|
|
213
|
+
if (this.coordinates.length >= 2) {
|
|
214
|
+
const source = map.getSource(this.#sourceId);
|
|
215
|
+
if (source) {
|
|
216
|
+
source.setData({
|
|
217
|
+
type: "Feature",
|
|
218
|
+
properties: {},
|
|
219
|
+
geometry: { type: "LineString", coordinates: this.coordinates },
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
#removeLayers() {
|
|
225
|
+
const map = this._mapCtx?.map;
|
|
226
|
+
if (!map)
|
|
227
|
+
return;
|
|
228
|
+
try {
|
|
229
|
+
if (map.getLayer(this.#layerId))
|
|
230
|
+
map.removeLayer(this.#layerId);
|
|
231
|
+
if (map.getSource(this.#sourceId))
|
|
232
|
+
map.removeSource(this.#sourceId);
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// Map may already be destroyed
|
|
236
|
+
}
|
|
237
|
+
this.#layerAdded = false;
|
|
238
|
+
}
|
|
239
|
+
render() {
|
|
240
|
+
return html ``;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
})();
|
|
244
|
+
export { DuiMapRoute };
|
|
245
|
+
customElements.define(DuiMapRoute.tagName, DuiMapRoute);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default theme styles for DUI map components.
|
|
3
|
+
*
|
|
4
|
+
* Uses DUI design tokens for consistency with the rest of the component library.
|
|
5
|
+
* These styles provide aesthetic treatment — the structural CSS lives in each component.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: MapLibre renders popups, tooltips, markers, and attribution
|
|
8
|
+
* inside the `dui-map` shadow root. All chrome for those elements must be
|
|
9
|
+
* in the `dui-map` theme entry, not in the sub-component entries.
|
|
10
|
+
*/
|
|
11
|
+
import { type CSSResult } from "lit";
|
|
12
|
+
declare const mapThemeStyles: CSSResult;
|
|
13
|
+
declare const mapControlsThemeStyles: CSSResult;
|
|
14
|
+
export { mapThemeStyles, mapControlsThemeStyles };
|
|
15
|
+
/** @deprecated Tag name → themed CSS map. Use direct imports instead. */
|
|
16
|
+
export declare const mapStyles: Map<string, CSSResult>;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default theme styles for DUI map components.
|
|
3
|
+
*
|
|
4
|
+
* Uses DUI design tokens for consistency with the rest of the component library.
|
|
5
|
+
* These styles provide aesthetic treatment — the structural CSS lives in each component.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: MapLibre renders popups, tooltips, markers, and attribution
|
|
8
|
+
* inside the `dui-map` shadow root. All chrome for those elements must be
|
|
9
|
+
* in the `dui-map` theme entry, not in the sub-component entries.
|
|
10
|
+
*/
|
|
11
|
+
import { css } from "lit";
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// dui-map — main theme (includes all MapLibre-rendered DOM)
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
const mapThemeStyles = css `
|
|
16
|
+
/* --- Loader overlay --------------------------------------------------- */
|
|
17
|
+
[part="loader"] {
|
|
18
|
+
background: oklch(from var(--background) l c h / 0.5);
|
|
19
|
+
backdrop-filter: blur(2px);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.loader-dot {
|
|
23
|
+
background: oklch(from var(--foreground) l c h / 0.6);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* --- Attribution ------------------------------------------------------- */
|
|
27
|
+
.maplibregl-ctrl-attrib {
|
|
28
|
+
font-family: var(--font-sans);
|
|
29
|
+
font-size: var(--text-2xs);
|
|
30
|
+
color: oklch(from var(--foreground) l c h / 0.5);
|
|
31
|
+
background: oklch(from var(--background) l c h / 0.65);
|
|
32
|
+
backdrop-filter: blur(4px);
|
|
33
|
+
border-radius: var(--radius-sm) 0 0 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.maplibregl-ctrl-attrib a {
|
|
37
|
+
color: oklch(from var(--foreground) l c h / 0.6);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.maplibregl-ctrl-attrib a:hover {
|
|
41
|
+
color: var(--foreground);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.maplibregl-ctrl-attrib-button {
|
|
45
|
+
background-color: oklch(from var(--background) l c h / 0.65);
|
|
46
|
+
backdrop-filter: blur(4px);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* --- Default marker dot ----------------------------------------------- */
|
|
50
|
+
.dui-default-marker {
|
|
51
|
+
width: 16px;
|
|
52
|
+
height: 16px;
|
|
53
|
+
border-radius: 50%;
|
|
54
|
+
border: 2px solid white;
|
|
55
|
+
background: var(--accent, #3b82f6);
|
|
56
|
+
box-shadow: var(--shadow-sm);
|
|
57
|
+
transition: transform var(--duration-faster) var(--ease-out-3),
|
|
58
|
+
box-shadow var(--duration-faster) var(--ease-out-3);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dui-default-marker:hover {
|
|
62
|
+
transform: scale(1.15);
|
|
63
|
+
box-shadow: var(--shadow-md);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* --- Marker label ------------------------------------------------------ */
|
|
67
|
+
.dui-marker-label {
|
|
68
|
+
font-family: var(--font-sans);
|
|
69
|
+
font-size: var(--text-2xs);
|
|
70
|
+
font-weight: var(--font-weight-medium);
|
|
71
|
+
color: var(--text-1);
|
|
72
|
+
text-shadow:
|
|
73
|
+
0 0 3px var(--background),
|
|
74
|
+
0 0 3px var(--background),
|
|
75
|
+
0 0 3px var(--background);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* --- Popup chrome (shared reset) -------------------------------------- */
|
|
79
|
+
.maplibregl-popup.dui-popup .maplibregl-popup-content,
|
|
80
|
+
.maplibregl-popup.dui-tooltip .maplibregl-popup-content {
|
|
81
|
+
/* Reset MapLibre defaults */
|
|
82
|
+
padding: 0;
|
|
83
|
+
background: none;
|
|
84
|
+
border-radius: 0;
|
|
85
|
+
box-shadow: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* --- Popup (click-to-open, popover-like) ------------------------------ */
|
|
89
|
+
.maplibregl-popup.dui-popup .maplibregl-popup-content > div {
|
|
90
|
+
font-family: var(--font-sans);
|
|
91
|
+
font-size: var(--text-sm);
|
|
92
|
+
line-height: var(--line-height-normal);
|
|
93
|
+
color: var(--text-1);
|
|
94
|
+
background: var(--surface-3);
|
|
95
|
+
border: var(--border-width-thin) solid var(--border);
|
|
96
|
+
border-radius: var(--radius-md);
|
|
97
|
+
padding: var(--space-2) var(--space-3);
|
|
98
|
+
box-shadow: var(--shadow-md);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.maplibregl-popup.dui-popup .maplibregl-popup-tip {
|
|
102
|
+
border-top-color: var(--surface-3);
|
|
103
|
+
border-bottom-color: var(--surface-3);
|
|
104
|
+
border-left-color: var(--surface-3);
|
|
105
|
+
border-right-color: var(--surface-3);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Only the anchor direction's tip is visible; the rest are transparent.
|
|
109
|
+
MapLibre sets the visible side via its anchor classes. Override just
|
|
110
|
+
the transparent reset to use the surface color. The solid side inherits. */
|
|
111
|
+
.maplibregl-popup.dui-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip {
|
|
112
|
+
border-bottom-color: var(--surface-3);
|
|
113
|
+
}
|
|
114
|
+
.maplibregl-popup.dui-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
|
|
115
|
+
border-top-color: var(--surface-3);
|
|
116
|
+
}
|
|
117
|
+
.maplibregl-popup.dui-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip {
|
|
118
|
+
border-right-color: var(--surface-3);
|
|
119
|
+
}
|
|
120
|
+
.maplibregl-popup.dui-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip {
|
|
121
|
+
border-left-color: var(--surface-3);
|
|
122
|
+
}
|
|
123
|
+
.maplibregl-popup.dui-popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip {
|
|
124
|
+
border-bottom-color: var(--surface-3);
|
|
125
|
+
}
|
|
126
|
+
.maplibregl-popup.dui-popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
|
|
127
|
+
border-bottom-color: var(--surface-3);
|
|
128
|
+
}
|
|
129
|
+
.maplibregl-popup.dui-popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip {
|
|
130
|
+
border-top-color: var(--surface-3);
|
|
131
|
+
}
|
|
132
|
+
.maplibregl-popup.dui-popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
|
|
133
|
+
border-top-color: var(--surface-3);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* --- Tooltip (hover, inverted) ---------------------------------------- */
|
|
137
|
+
.maplibregl-popup.dui-tooltip .maplibregl-popup-content > div {
|
|
138
|
+
font-family: var(--font-sans);
|
|
139
|
+
font-size: var(--text-xs);
|
|
140
|
+
line-height: var(--line-height-snug);
|
|
141
|
+
color: var(--background);
|
|
142
|
+
background: color-mix(
|
|
143
|
+
in oklch,
|
|
144
|
+
var(--foreground) 90%,
|
|
145
|
+
oklch(0 0 0 / 0)
|
|
146
|
+
);
|
|
147
|
+
backdrop-filter: blur(4px);
|
|
148
|
+
border-radius: var(--radius-sm);
|
|
149
|
+
padding: var(--space-0_5) var(--space-1_5);
|
|
150
|
+
box-shadow: var(--shadow-sm);
|
|
151
|
+
max-width: var(--space-80);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.maplibregl-popup.dui-tooltip .maplibregl-popup-tip {
|
|
155
|
+
display: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* --- Popup close button ------------------------------------------------ */
|
|
159
|
+
.maplibregl-popup-close-button {
|
|
160
|
+
font-family: var(--font-sans);
|
|
161
|
+
color: var(--text-1);
|
|
162
|
+
opacity: 0.5;
|
|
163
|
+
transition: opacity var(--duration-faster) var(--ease-out-3);
|
|
164
|
+
padding: var(--space-0_5) var(--space-1);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.maplibregl-popup-close-button:hover {
|
|
168
|
+
background: oklch(from var(--foreground) l c h / 0.06);
|
|
169
|
+
opacity: 1;
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
// dui-map-controls — themed control buttons
|
|
174
|
+
// ---------------------------------------------------------------------------
|
|
175
|
+
const mapControlsThemeStyles = css `
|
|
176
|
+
[part="group"] {
|
|
177
|
+
border: var(--border-width-thin) solid var(--border);
|
|
178
|
+
background: var(--background);
|
|
179
|
+
border-radius: var(--radius-md);
|
|
180
|
+
box-shadow: var(--shadow-sm);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
[part="group"] > [part="control-button"]:not(:last-child) {
|
|
184
|
+
border-bottom: var(--border-width-thin) solid var(--border);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
[part="control-button"] {
|
|
188
|
+
color: var(--text-1);
|
|
189
|
+
transition: background var(--duration-faster) var(--ease-out-3);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
[part="control-button"]:hover:not(:disabled) {
|
|
193
|
+
background: oklch(from var(--foreground) l c h / 0.06);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
[part="control-button"]:active:not(:disabled) {
|
|
197
|
+
background: oklch(from var(--foreground) l c h / 0.1);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@keyframes spin {
|
|
201
|
+
from { transform: rotate(0deg); }
|
|
202
|
+
to { transform: rotate(360deg); }
|
|
203
|
+
}
|
|
204
|
+
`;
|
|
205
|
+
// ---------------------------------------------------------------------------
|
|
206
|
+
// Sub-component entries (empty — all chrome lives in the dui-map entry above)
|
|
207
|
+
// ---------------------------------------------------------------------------
|
|
208
|
+
const mapMarkerThemeStyles = css ``;
|
|
209
|
+
const mapMarkerContentThemeStyles = css ``;
|
|
210
|
+
const mapMarkerPopupThemeStyles = css ``;
|
|
211
|
+
const mapMarkerTooltipThemeStyles = css ``;
|
|
212
|
+
const mapMarkerLabelThemeStyles = css ``;
|
|
213
|
+
const mapPopupThemeStyles = css ``;
|
|
214
|
+
const mapRouteThemeStyles = css ``;
|
|
215
|
+
const mapRegionThemeStyles = css ``;
|
|
216
|
+
const mapClusterLayerThemeStyles = css ``;
|
|
217
|
+
const mapHeatmapThemeStyles = css ``;
|
|
218
|
+
export { mapThemeStyles, mapControlsThemeStyles };
|
|
219
|
+
/** @deprecated Tag name → themed CSS map. Use direct imports instead. */
|
|
220
|
+
export const mapStyles = new Map([
|
|
221
|
+
["dui-map", mapThemeStyles],
|
|
222
|
+
["dui-map-controls", mapControlsThemeStyles],
|
|
223
|
+
["dui-map-marker", mapMarkerThemeStyles],
|
|
224
|
+
["dui-map-marker-content", mapMarkerContentThemeStyles],
|
|
225
|
+
["dui-map-marker-popup", mapMarkerPopupThemeStyles],
|
|
226
|
+
["dui-map-marker-tooltip", mapMarkerTooltipThemeStyles],
|
|
227
|
+
["dui-map-marker-label", mapMarkerLabelThemeStyles],
|
|
228
|
+
["dui-map-popup", mapPopupThemeStyles],
|
|
229
|
+
["dui-map-route", mapRouteThemeStyles],
|
|
230
|
+
["dui-map-region", mapRegionThemeStyles],
|
|
231
|
+
["dui-map-cluster-layer", mapClusterLayerThemeStyles],
|
|
232
|
+
["dui-map-heatmap", mapHeatmapThemeStyles],
|
|
233
|
+
]);
|