@m3ui-vue/m3ui-vue 1.1.4 → 1.2.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/dist/API.md +511 -34
- package/dist/MMenuItem-DI351kIf.js +929 -0
- package/dist/MMenuItem-DI351kIf.js.map +1 -0
- package/dist/{MSlider-JflHJ70q.js → MSlider-BnEy5ieZ.js} +295 -320
- package/dist/MSlider-BnEy5ieZ.js.map +1 -0
- package/dist/MTextField-BBmkaIbO.js +633 -0
- package/dist/MTextField-BBmkaIbO.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +83 -49
- package/dist/chart.js.map +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MButton.vue.d.ts +7 -1
- package/dist/components/MButtonGroup.vue.d.ts +40 -31
- package/dist/components/MCarousel.vue.d.ts +2 -0
- package/dist/components/MChart.vue.d.ts +6 -0
- package/dist/components/MCircleProgressBar.vue.d.ts +5 -3
- package/dist/components/MContextMenu.vue.d.ts +2 -2
- package/dist/components/MCopyButton.vue.d.ts +1 -1
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MFabMenu.vue.d.ts +1 -1
- package/dist/components/MIconButton.vue.d.ts +13 -1
- package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
- package/dist/components/MMap.vue.d.ts +20 -2
- package/dist/components/MMapBaseLayers.vue.d.ts +3 -0
- package/dist/components/MMapFilter.vue.d.ts +3 -0
- package/dist/components/MMapLayers.vue.d.ts +3 -0
- package/dist/components/MMenu.vue.d.ts +2 -2
- package/dist/components/MMenuItem.vue.d.ts +7 -3
- package/dist/components/MNavigationDrawer.vue.d.ts +13 -2
- package/dist/components/MOverlay.vue.d.ts +12 -1
- package/dist/components/MProgressBar.vue.d.ts +5 -3
- package/dist/components/MPullToRefresh.vue.d.ts +7 -2
- package/dist/components/MRichTextEditor.vue.d.ts +7 -1
- package/dist/components/MSearchField.vue.d.ts +58 -0
- package/dist/components/MSegmentedButton.vue.d.ts +31 -23
- package/dist/components/MSimpleCarousel.vue.d.ts +2 -0
- package/dist/components/MSkeleton.vue.d.ts +6 -3
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTextField.vue.d.ts +5 -1
- package/dist/components/MTimeline.vue.d.ts +85 -22
- package/dist/components/MTooltip.vue.d.ts +1 -1
- package/dist/components/_MDrawerItemList.vue.d.ts +2 -0
- package/dist/composables/_mapStyle.d.ts +13 -0
- package/dist/composables/_themeTransition.d.ts +2 -0
- package/dist/composables/_tooltipTrigger.d.ts +22 -0
- package/dist/composables/_useMenuNav.d.ts +28 -0
- package/dist/composables/useAutoGrow.d.ts +21 -0
- package/dist/composables/useColorPalette.d.ts +1 -1
- package/dist/composables/useLocale.d.ts +3 -0
- package/dist/composables/useMap.d.ts +19 -3
- package/dist/composables/useMapFilter.d.ts +4 -1
- package/dist/composables/useMapLayers.d.ts +5 -2
- package/dist/composables/useScrollReveal.d.ts +44 -0
- package/dist/composables/useThemeTokens.d.ts +21 -0
- package/dist/composables/viewportHints.d.ts +27 -0
- package/dist/directives/vClickOutside.d.ts +25 -0
- package/dist/directives/vFocusRing.d.ts +22 -0
- package/dist/directives/vLongPress.d.ts +27 -0
- package/dist/directives/vReveal.d.ts +10 -0
- package/dist/directives/vScrollElevation.d.ts +31 -0
- package/dist/directives/vSkeleton.d.ts +19 -0
- package/dist/directives/vStateLayer.d.ts +20 -0
- package/dist/directives/vSwipe.d.ts +45 -0
- package/dist/directives/vTooltip.d.ts +23 -0
- package/dist/index.d.ts +28 -1
- package/dist/locales/index.js +21 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7131 -6216
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +1 -1
- package/dist/map.js +821 -791
- package/dist/map.js.map +1 -1
- package/dist/motion-DZiXG09o.js +150 -0
- package/dist/motion-DZiXG09o.js.map +1 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/rich-text-editor.js +13 -9
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles/theme.css +63 -0
- package/dist/styles.css +1 -1
- package/dist/{useLocale-CXibICQA.js → useLocale-JYxDDeXC.js} +4 -2
- package/dist/useLocale-JYxDDeXC.js.map +1 -0
- package/dist/useThemeTokens-Bv-Uv8eX.js +135 -0
- package/dist/useThemeTokens-Bv-Uv8eX.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MButton.test.ts +22 -0
- package/src/__tests__/MCarousel.test.ts +9 -0
- package/src/__tests__/MChart.test.ts +77 -5
- package/src/__tests__/MIconButton.test.ts +33 -0
- package/src/__tests__/MMap.test.ts +53 -1
- package/src/__tests__/MMapLayers.test.ts +46 -2
- package/src/__tests__/MMenu.test.ts +104 -1
- package/src/__tests__/MMenuItem.test.ts +18 -0
- package/src/__tests__/MNavigationDrawer.test.ts +80 -0
- package/src/__tests__/MOverlay.test.ts +49 -0
- package/src/__tests__/MProgressBar.test.ts +41 -0
- package/src/__tests__/MPullToRefresh.test.ts +33 -0
- package/src/__tests__/MRichTextEditor.test.ts +22 -0
- package/src/__tests__/MSearchField.test.ts +71 -0
- package/src/__tests__/MSkeleton.test.ts +38 -0
- package/src/__tests__/MTimeline.test.ts +238 -0
- package/src/__tests__/_fakeMaplibre.ts +3 -1
- package/src/__tests__/attrsFallthrough.test.ts +3 -0
- package/src/__tests__/escapeStack.test.ts +93 -0
- package/src/__tests__/ssr.test.ts +21 -2
- package/src/__tests__/useAutoGrow.test.ts +103 -0
- package/src/__tests__/useScrollReveal.test.ts +102 -0
- package/src/__tests__/useThemeTokens.test.ts +114 -0
- package/src/__tests__/vClickOutside.test.ts +82 -0
- package/src/__tests__/vFocusRing.test.ts +36 -0
- package/src/__tests__/vLongPress.test.ts +81 -0
- package/src/__tests__/vScrollElevation.test.ts +89 -0
- package/src/__tests__/vSkeleton.test.ts +48 -0
- package/src/__tests__/vStateLayer.test.ts +53 -0
- package/src/__tests__/vSwipe.test.ts +93 -0
- package/src/__tests__/vTooltip.test.ts +95 -0
- package/src/__tests__/viewportHints.test.ts +41 -0
- package/src/components/MAutocomplete.vue +5 -0
- package/src/components/MBottomSheet.vue +4 -1
- package/src/components/MButton.vue +15 -1
- package/src/components/MButtonGroup.vue +22 -17
- package/src/components/MCarousel.vue +7 -1
- package/src/components/MChart.vue +74 -34
- package/src/components/MCircleProgressBar.vue +14 -9
- package/src/components/MCommandPalette.vue +3 -2
- package/src/components/MContextMenu.vue +19 -60
- package/src/components/MDragDropList.vue +2 -0
- package/src/components/MIconButton.vue +40 -1
- package/src/components/MKanban.vue +2 -0
- package/src/components/MLightbox.vue +7 -2
- package/src/components/MMap.vue +38 -5
- package/src/components/MMapBaseLayers.vue +7 -3
- package/src/components/MMapFilter.vue +7 -4
- package/src/components/MMapGeoJson.vue +1 -1
- package/src/components/MMapLayers.vue +6 -2
- package/src/components/MMapMeasure.vue +5 -2
- package/src/components/MMenu.vue +18 -59
- package/src/components/MMenuItem.vue +11 -2
- package/src/components/MMultiAutocomplete.vue +5 -0
- package/src/components/MNavigationDrawer.vue +96 -11
- package/src/components/MNavigationRail.vue +4 -15
- package/src/components/MOverlay.vue +32 -13
- package/src/components/MProgressBar.vue +25 -27
- package/src/components/MPullToRefresh.vue +20 -1
- package/src/components/MRichTextEditor.vue +19 -5
- package/src/components/MSearchBar.vue +5 -0
- package/src/components/MSearchField.vue +142 -0
- package/src/components/MSegmentedButton.vue +19 -17
- package/src/components/MSelect.vue +10 -1
- package/src/components/MSideSheet.vue +5 -2
- package/src/components/MSimpleCarousel.vue +10 -1
- package/src/components/MSkeleton.vue +30 -8
- package/src/components/MSpotlightSearch.vue +3 -2
- package/src/components/MTextField.vue +15 -2
- package/src/components/MTimeline.vue +370 -81
- package/src/components/MTooltip.vue +20 -152
- package/src/components/_MDrawerItemList.vue +25 -6
- package/src/composables/_mapStyle.ts +45 -0
- package/src/composables/_themeTransition.ts +2 -0
- package/src/composables/_tooltipTrigger.ts +184 -0
- package/src/composables/_useMenuNav.ts +209 -0
- package/src/composables/useAutoGrow.ts +78 -0
- package/src/composables/useLocale.ts +5 -0
- package/src/composables/useMap.ts +43 -5
- package/src/composables/useMapFilter.ts +6 -5
- package/src/composables/useMapLayers.ts +7 -6
- package/src/composables/useScrollReveal.ts +151 -0
- package/src/composables/useThemeTokens.ts +116 -0
- package/src/composables/viewportHints.ts +80 -0
- package/src/directives/vClickOutside.ts +90 -0
- package/src/directives/vFocusRing.ts +60 -0
- package/src/directives/vLongPress.ts +134 -0
- package/src/directives/vReveal.ts +57 -0
- package/src/directives/vScrollElevation.ts +116 -0
- package/src/directives/vSkeleton.ts +87 -0
- package/src/directives/vStateLayer.ts +83 -0
- package/src/directives/vSwipe.ts +197 -0
- package/src/directives/vTooltip.ts +128 -0
- package/src/index.ts +28 -1
- package/src/locales/de.ts +2 -0
- package/src/locales/es.ts +2 -0
- package/src/locales/fr.ts +2 -0
- package/src/locales/ja.ts +2 -0
- package/src/locales/ko.ts +2 -0
- package/src/locales/pt.ts +2 -0
- package/src/locales/zh.ts +2 -0
- package/src/map.ts +1 -1
- package/src/plugin.ts +34 -0
- package/src/styles/theme.css +63 -0
- package/dist/MMenuItem-BfjqwcYP.js +0 -830
- package/dist/MMenuItem-BfjqwcYP.js.map +0 -1
- package/dist/MSlider-JflHJ70q.js.map +0 -1
- package/dist/MTextField-NaIB6RbM.js +0 -673
- package/dist/MTextField-NaIB6RbM.js.map +0 -1
- package/dist/composables/_useThemeTokens.d.ts +0 -7
- package/dist/useLocale-CXibICQA.js.map +0 -1
- package/src/composables/_useThemeTokens.ts +0 -42
package/dist/map.js
CHANGED
|
@@ -1,51 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { t as e } from "./useThemeTokens-Bv-Uv8eX.js";
|
|
2
|
+
import { i as t } from "./useLocale-JYxDDeXC.js";
|
|
3
|
+
import { _ as n, g as r, h as i, n as a, p as o, r as s, t as c, v as l } from "./MTextField-BBmkaIbO.js";
|
|
4
|
+
import { i as u } from "./motion-DZiXG09o.js";
|
|
5
|
+
import { t as d } from "./MIcon-Bxh9j135.js";
|
|
6
|
+
import { c as f, i as p, n as m, o as h, t as g } from "./MSlider-BnEy5ieZ.js";
|
|
7
|
+
import { Fragment as _, Transition as v, computed as y, createBlock as b, createCommentVNode as x, createElementBlock as S, createElementVNode as C, createSlots as w, createTextVNode as T, createVNode as E, defineComponent as D, getCurrentInstance as O, inject as k, markRaw as A, mergeProps as j, normalizeClass as M, normalizeStyle as N, onBeforeUnmount as P, onMounted as F, onUnmounted as I, openBlock as L, provide as R, reactive as ee, ref as z, renderList as B, renderSlot as V, shallowRef as H, toDisplayString as U, toValue as W, unref as G, useId as te, useSlots as ne, watch as K, withCtx as q, withModifiers as J } from "vue";
|
|
6
8
|
//#region src/composables/useMap.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
if (
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
var re = Symbol("m3-map");
|
|
10
|
+
function ie(e) {
|
|
11
|
+
let t = k(re, null);
|
|
12
|
+
if (t || e === void 0) return t;
|
|
13
|
+
let n = y(() => {
|
|
14
|
+
let t = W(e);
|
|
15
|
+
return t ? "context" in t ? t.context : t : void 0;
|
|
16
|
+
}), r = {
|
|
17
|
+
map: y(() => n.value?.map.value),
|
|
18
|
+
maplibre: y(() => n.value?.maplibre.value),
|
|
19
|
+
styleVersion: y(() => n.value?.styleVersion.value ?? 0),
|
|
20
|
+
model: y(() => n.value?.model.value),
|
|
21
|
+
layerState: new Proxy({
|
|
22
|
+
visible: {},
|
|
23
|
+
opacity: {}
|
|
24
|
+
}, { get: (e, t) => Reflect.get(n.value?.layerState ?? e, t) }),
|
|
25
|
+
activeTool: y({
|
|
26
|
+
get: () => n.value?.activeTool.value ?? null,
|
|
27
|
+
set: (e) => {
|
|
28
|
+
n.value && (n.value.activeTool.value = e);
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
};
|
|
32
|
+
return R(re, r), r;
|
|
33
|
+
}
|
|
34
|
+
function Y(e) {
|
|
35
|
+
let t = ie(e);
|
|
36
|
+
if (!t) throw Error("useMap() must be called in a component inside <MMap>, or be given one");
|
|
37
|
+
let n = [];
|
|
38
|
+
O() && P(() => n.splice(0).forEach((e) => e()));
|
|
39
|
+
function r(e) {
|
|
14
40
|
let r = () => {
|
|
15
|
-
if (
|
|
16
|
-
let r =
|
|
17
|
-
|
|
41
|
+
if (t.map.value && t.maplibre.value) return e(t.map.value, t.maplibre.value);
|
|
42
|
+
let r = K(t.map, (n) => {
|
|
43
|
+
n && t.maplibre.value && (r(), e(n, t.maplibre.value));
|
|
18
44
|
});
|
|
19
|
-
|
|
20
|
-
}, i =
|
|
21
|
-
i && !i.isMounted ?
|
|
45
|
+
n.push(r);
|
|
46
|
+
}, i = O();
|
|
47
|
+
i && !i.isMounted ? F(r) : r();
|
|
22
48
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
49
|
+
function i(e, t) {
|
|
50
|
+
r((r) => {
|
|
51
|
+
r.on(e, t), n.push(() => r.off(e, t));
|
|
26
52
|
});
|
|
27
53
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
54
|
+
function a(e, t, i) {
|
|
55
|
+
r((r) => {
|
|
56
|
+
r.on(e, t, i), n.push(() => r.off(e, t, i));
|
|
31
57
|
});
|
|
32
58
|
}
|
|
33
59
|
return {
|
|
34
|
-
map:
|
|
35
|
-
maplibre:
|
|
36
|
-
styleVersion:
|
|
37
|
-
activeTool:
|
|
38
|
-
onReady:
|
|
39
|
-
on:
|
|
40
|
-
onLayer:
|
|
60
|
+
map: y(() => t.map.value),
|
|
61
|
+
maplibre: y(() => t.maplibre.value),
|
|
62
|
+
styleVersion: y(() => t.styleVersion.value),
|
|
63
|
+
activeTool: t.activeTool,
|
|
64
|
+
onReady: r,
|
|
65
|
+
on: i,
|
|
66
|
+
onLayer: a
|
|
41
67
|
};
|
|
42
68
|
}
|
|
43
69
|
//#endregion
|
|
44
70
|
//#region src/components/MMapControl.vue?vue&type=script&setup=true&lang.ts
|
|
45
|
-
var
|
|
71
|
+
var ae = { class: "hidden" }, X = {
|
|
46
72
|
key: 0,
|
|
47
73
|
class: "m3-map-control-panel-in"
|
|
48
|
-
},
|
|
74
|
+
}, oe = /* @__PURE__ */ D({
|
|
49
75
|
inheritAttrs: !1,
|
|
50
76
|
__name: "MMapControl",
|
|
51
77
|
props: {
|
|
@@ -64,23 +90,23 @@ var re = { class: "hidden" }, ie = {
|
|
|
64
90
|
}
|
|
65
91
|
},
|
|
66
92
|
emits: ["update:expanded"],
|
|
67
|
-
setup(e, { emit:
|
|
68
|
-
let
|
|
69
|
-
|
|
93
|
+
setup(e, { emit: t }) {
|
|
94
|
+
let a = e, o = t, s = ne(), c = z(), { onReady: d } = Y(), f = z(a.expanded);
|
|
95
|
+
K(() => a.expanded, (e) => {
|
|
70
96
|
f.value = e;
|
|
71
97
|
});
|
|
72
|
-
let p =
|
|
98
|
+
let p = y(() => f.value && !!s.panel);
|
|
73
99
|
function m(e) {
|
|
74
|
-
e !== f.value && (f.value = e,
|
|
100
|
+
e !== f.value && (f.value = e, o("update:expanded", e));
|
|
75
101
|
}
|
|
76
102
|
let h = () => m(!f.value), g = () => m(!1);
|
|
77
103
|
function _(e) {
|
|
78
104
|
p.value && !c.value?.contains(e.target) && g();
|
|
79
105
|
}
|
|
80
|
-
function
|
|
106
|
+
function v(e) {
|
|
81
107
|
e.key === "Escape" && p.value && (g(), e.stopPropagation());
|
|
82
108
|
}
|
|
83
|
-
let b = null,
|
|
109
|
+
let b = null, x = null, w = [], T = {
|
|
84
110
|
w: 0,
|
|
85
111
|
h: 0
|
|
86
112
|
}, E = {
|
|
@@ -95,108 +121,108 @@ var re = { class: "hidden" }, ie = {
|
|
|
95
121
|
}
|
|
96
122
|
function k() {
|
|
97
123
|
let e = c.value;
|
|
98
|
-
if (!e ||
|
|
99
|
-
let
|
|
100
|
-
b && (
|
|
124
|
+
if (!e || x) return;
|
|
125
|
+
let t = O();
|
|
126
|
+
b && (t.w !== b.w || t.h !== b.h) && a.animate && !r() && A(e, b, t), b = t;
|
|
101
127
|
}
|
|
102
|
-
function
|
|
103
|
-
if (T = t, E = n, w =
|
|
128
|
+
function A(e, t, n) {
|
|
129
|
+
if (T = t, E = n, w = l(0, 1, 0, u.standard.defaultSpatial, .002), e.style.overflow = "hidden", x = i(e, w, (e) => ({
|
|
104
130
|
width: `${t.w + (n.w - t.w) * e}px`,
|
|
105
131
|
height: `${t.h + (n.h - t.h) * e}px`
|
|
106
|
-
})), !
|
|
107
|
-
|
|
132
|
+
})), !x) return M(e);
|
|
133
|
+
x.onfinish = () => M(e);
|
|
108
134
|
}
|
|
109
135
|
function M(e) {
|
|
110
|
-
|
|
136
|
+
x?.cancel(), x = null, e.style.overflow = "";
|
|
111
137
|
let t = O();
|
|
112
138
|
t.w !== E.w || t.h !== E.h ? (b = E, k()) : b = t;
|
|
113
139
|
}
|
|
114
|
-
function
|
|
115
|
-
if (!c.value || !
|
|
116
|
-
let e = n(w,
|
|
140
|
+
function N() {
|
|
141
|
+
if (!c.value || !x) return;
|
|
142
|
+
let e = n(w, x.currentTime), t = {
|
|
117
143
|
w: T.w + (E.w - T.w) * e,
|
|
118
144
|
h: T.h + (E.h - T.h) * e
|
|
119
145
|
};
|
|
120
|
-
|
|
146
|
+
x.onfinish = null, x.cancel(), x = null, b = t, k();
|
|
121
147
|
}
|
|
122
|
-
|
|
123
|
-
let I,
|
|
148
|
+
K(p, N, { flush: "post" });
|
|
149
|
+
let I, R = {
|
|
124
150
|
onAdd: () => c.value,
|
|
125
151
|
onRemove: () => c.value?.remove()
|
|
126
152
|
};
|
|
127
|
-
return
|
|
128
|
-
I = e, c.value && e.addControl(
|
|
129
|
-
}),
|
|
130
|
-
I && c.value && (I.removeControl(
|
|
131
|
-
}),
|
|
153
|
+
return d((e) => {
|
|
154
|
+
I = e, c.value && e.addControl(R, a.position);
|
|
155
|
+
}), K(() => a.position, (e) => {
|
|
156
|
+
I && c.value && (I.removeControl(R), I.addControl(R, e));
|
|
157
|
+
}), F(() => {
|
|
132
158
|
document.addEventListener("pointerdown", _, !0), !(typeof ResizeObserver > "u" || !c.value) && (D = new ResizeObserver(k), D.observe(c.value));
|
|
133
|
-
}),
|
|
134
|
-
document.removeEventListener("pointerdown", _, !0), D?.disconnect(),
|
|
135
|
-
}), (t, n) => (
|
|
159
|
+
}), P(() => {
|
|
160
|
+
document.removeEventListener("pointerdown", _, !0), D?.disconnect(), x?.cancel(), I?.hasControl(R) && I.removeControl(R);
|
|
161
|
+
}), (t, n) => (L(), S("div", ae, [C("div", j({
|
|
136
162
|
ref_key: "el",
|
|
137
163
|
ref: c,
|
|
138
164
|
class: ["maplibregl-ctrl m3-map-control", p.value ? "m3-map-control-panel" : e.group ? "maplibregl-ctrl-group" : ""]
|
|
139
|
-
}, t.$attrs, { onKeydown:
|
|
165
|
+
}, t.$attrs, { onKeydown: v }), [p.value ? (L(), S("div", X, [V(t.$slots, "panel", { close: g })])) : V(t.$slots, "default", {
|
|
140
166
|
expanded: f.value,
|
|
141
167
|
toggle: h
|
|
142
168
|
}, void 0, void 0, 1)], 16)]));
|
|
143
169
|
}
|
|
144
|
-
}),
|
|
170
|
+
}), Z = [
|
|
145
171
|
"title",
|
|
146
172
|
"aria-label",
|
|
147
173
|
"aria-expanded"
|
|
148
|
-
],
|
|
174
|
+
], se = ["innerHTML"], ce = /* @__PURE__ */ D({
|
|
149
175
|
__name: "_MMapAttribution",
|
|
150
176
|
props: { position: {} },
|
|
151
177
|
setup(e) {
|
|
152
|
-
let
|
|
153
|
-
function
|
|
154
|
-
if (!
|
|
155
|
-
let e =
|
|
178
|
+
let n = e, r = t(), { on: i, onReady: a } = Y(), o = z([]), s = z(!0), c = z(0), l;
|
|
179
|
+
function u() {
|
|
180
|
+
if (!l) return;
|
|
181
|
+
let e = l.getStyle?.();
|
|
156
182
|
if (!e?.sources) return;
|
|
157
183
|
let t = new Set(e.layers?.map((e) => e.source).filter(Boolean)), n = [];
|
|
158
184
|
for (let [r, i] of Object.entries(e.sources)) {
|
|
159
185
|
if (t.size && !t.has(r)) continue;
|
|
160
|
-
let e =
|
|
186
|
+
let e = l.getSource(r)?.attribution ?? i.attribution;
|
|
161
187
|
e && !n.includes(e) && n.push(e);
|
|
162
188
|
}
|
|
163
189
|
let r = n.filter((e) => !n.some((t) => t !== e && t.includes(e)));
|
|
164
|
-
r.join("\n") !==
|
|
190
|
+
r.join("\n") !== o.value.join("\n") && (o.value = r), c.value = Math.max(0, l.getContainer().clientWidth - 20);
|
|
165
191
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}),
|
|
169
|
-
|
|
192
|
+
a((e) => {
|
|
193
|
+
l = e, u();
|
|
194
|
+
}), i("styledata", u), i("sourcedata", u), i("resize", u), i("dragstart", () => {
|
|
195
|
+
s.value = !1;
|
|
170
196
|
});
|
|
171
|
-
let
|
|
172
|
-
return (t,
|
|
197
|
+
let f = y(() => o.value.join(" ")), p = y(() => n.position.endsWith("right"));
|
|
198
|
+
return (t, n) => f.value ? (L(), b(oe, {
|
|
173
199
|
key: 0,
|
|
174
200
|
position: e.position,
|
|
175
201
|
group: !1,
|
|
176
|
-
class:
|
|
202
|
+
class: M(["m3-map-attrib", s.value ? "m3-map-attrib-open" : ""])
|
|
177
203
|
}, {
|
|
178
|
-
default:
|
|
179
|
-
class:
|
|
180
|
-
style:
|
|
181
|
-
}, [
|
|
204
|
+
default: q(() => [C("div", {
|
|
205
|
+
class: M(["m3-map-attrib-row", p.value ? "flex-row-reverse" : ""]),
|
|
206
|
+
style: N(c.value ? { maxWidth: `${c.value}px` } : void 0)
|
|
207
|
+
}, [C("button", {
|
|
182
208
|
type: "button",
|
|
183
209
|
class: "m3-map-attrib-button",
|
|
184
|
-
title:
|
|
185
|
-
"aria-label":
|
|
186
|
-
"aria-expanded":
|
|
187
|
-
onClick:
|
|
188
|
-
}, [
|
|
210
|
+
title: G(r).mapToggleAttribution,
|
|
211
|
+
"aria-label": G(r).mapToggleAttribution,
|
|
212
|
+
"aria-expanded": s.value,
|
|
213
|
+
onClick: n[0] ||= (e) => s.value = !s.value
|
|
214
|
+
}, [E(d, {
|
|
189
215
|
name: "info",
|
|
190
216
|
size: 20
|
|
191
|
-
})], 8,
|
|
217
|
+
})], 8, Z), s.value ? (L(), S("div", {
|
|
192
218
|
key: 0,
|
|
193
|
-
class:
|
|
194
|
-
innerHTML:
|
|
195
|
-
}, null, 10,
|
|
219
|
+
class: M(["m3-map-attrib-text", p.value ? "pl-3.5" : "pr-3.5"]),
|
|
220
|
+
innerHTML: f.value
|
|
221
|
+
}, null, 10, se)) : x("", !0)], 6)]),
|
|
196
222
|
_: 1
|
|
197
|
-
}, 8, ["position", "class"])) :
|
|
223
|
+
}, 8, ["position", "class"])) : x("", !0);
|
|
198
224
|
}
|
|
199
|
-
}),
|
|
225
|
+
}), le = {
|
|
200
226
|
fill: ["fill-opacity"],
|
|
201
227
|
line: ["line-opacity"],
|
|
202
228
|
circle: ["circle-opacity", "circle-stroke-opacity"],
|
|
@@ -205,83 +231,106 @@ var re = { class: "hidden" }, ie = {
|
|
|
205
231
|
heatmap: ["heatmap-opacity"],
|
|
206
232
|
"fill-extrusion": ["fill-extrusion-opacity"]
|
|
207
233
|
};
|
|
208
|
-
function
|
|
209
|
-
return
|
|
234
|
+
function ue() {
|
|
235
|
+
return ee({
|
|
210
236
|
visible: {},
|
|
211
237
|
opacity: {}
|
|
212
238
|
});
|
|
213
239
|
}
|
|
214
|
-
function
|
|
240
|
+
function de(e, t, n) {
|
|
215
241
|
let r = {}, i = {};
|
|
216
242
|
for (let e of n?.layers ?? []) {
|
|
217
243
|
let n = t.getLayer(e.id);
|
|
218
244
|
if (!n) continue;
|
|
219
245
|
r[e.id] = t.getLayoutProperty(e.id, "visibility") !== "none";
|
|
220
|
-
let a =
|
|
246
|
+
let a = le[n.type]?.[0], o = a ? t.getPaintProperty(e.id, a) : void 0;
|
|
221
247
|
i[e.id] = typeof o == "number" ? o : 1;
|
|
222
248
|
}
|
|
223
249
|
e.visible = r, e.opacity = i;
|
|
224
250
|
}
|
|
225
|
-
function
|
|
226
|
-
let
|
|
227
|
-
if (!
|
|
228
|
-
let { map:
|
|
229
|
-
function
|
|
230
|
-
return
|
|
231
|
-
}
|
|
232
|
-
function s(e, n) {
|
|
233
|
-
let i = t.value;
|
|
234
|
-
i?.getLayer(e) && i.setLayoutProperty(e, "visibility", n ? "visible" : "none"), r.visible[e] = n;
|
|
235
|
-
for (let t of a.value.get(e)?.children ?? []) s(t, n);
|
|
251
|
+
function fe(e) {
|
|
252
|
+
let t = ie(e);
|
|
253
|
+
if (!t) throw Error("useMapLayers() must be called in a component inside <MMap>, or be given one");
|
|
254
|
+
let { map: n, model: r, layerState: i } = t, a = y(() => r.value?.layers ?? []), o = y(() => new Map(a.value.map((e) => [e.id, e])));
|
|
255
|
+
function s(e) {
|
|
256
|
+
return i.visible[e] ?? !0;
|
|
236
257
|
}
|
|
237
|
-
function c(e) {
|
|
238
|
-
|
|
258
|
+
function c(e, t) {
|
|
259
|
+
let r = n.value;
|
|
260
|
+
r?.getLayer(e) && r.setLayoutProperty(e, "visibility", t ? "visible" : "none"), i.visible[e] = t;
|
|
261
|
+
for (let n of o.value.get(e)?.children ?? []) c(n, t);
|
|
239
262
|
}
|
|
240
263
|
function l(e) {
|
|
241
|
-
|
|
264
|
+
c(e, !s(e));
|
|
242
265
|
}
|
|
243
|
-
function u(e
|
|
244
|
-
|
|
245
|
-
if (o) for (let t of se[o.type] ?? []) i.setPaintProperty(e, t, n);
|
|
246
|
-
r.opacity[e] = n;
|
|
247
|
-
for (let t of a.value.get(e)?.children ?? []) u(t, n);
|
|
266
|
+
function u(e) {
|
|
267
|
+
return i.opacity[e] ?? 1;
|
|
248
268
|
}
|
|
249
|
-
function d(e) {
|
|
250
|
-
|
|
269
|
+
function d(e, t) {
|
|
270
|
+
let r = n.value, a = r?.getLayer(e);
|
|
271
|
+
if (a) for (let n of le[a.type] ?? []) r.setPaintProperty(e, n, t);
|
|
272
|
+
i.opacity[e] = t;
|
|
273
|
+
for (let n of o.value.get(e)?.children ?? []) d(n, t);
|
|
251
274
|
}
|
|
252
275
|
function f(e) {
|
|
253
|
-
|
|
276
|
+
return a.value.filter((t) => t.listed && (e === null ? !t.group || !r.value?.groups.some((e) => e.name === t.group) : t.group === e));
|
|
277
|
+
}
|
|
278
|
+
function p(e) {
|
|
279
|
+
let t = f(e).map((e) => s(e.id));
|
|
254
280
|
return t.length && t.every(Boolean) ? "visible" : t.some(Boolean) ? "partial" : "hidden";
|
|
255
281
|
}
|
|
256
|
-
function
|
|
257
|
-
for (let n of
|
|
282
|
+
function m(e, t) {
|
|
283
|
+
for (let n of f(e)) c(n.id, t);
|
|
258
284
|
}
|
|
259
|
-
let
|
|
260
|
-
function
|
|
261
|
-
for (let t of
|
|
285
|
+
let h = y(() => a.value.filter((e) => e.base)), g = y(() => h.value.find((e) => s(e.id))?.id ?? null);
|
|
286
|
+
function _(e) {
|
|
287
|
+
for (let t of h.value) c(t.id, t.id === e);
|
|
262
288
|
}
|
|
263
289
|
return {
|
|
264
|
-
model:
|
|
265
|
-
layers:
|
|
266
|
-
isVisible:
|
|
267
|
-
setVisible:
|
|
268
|
-
toggle:
|
|
269
|
-
opacityOf:
|
|
270
|
-
setOpacity:
|
|
271
|
-
layersOf:
|
|
272
|
-
groupState:
|
|
273
|
-
setGroupVisible:
|
|
274
|
-
baseLayers:
|
|
275
|
-
baseLayer:
|
|
276
|
-
setBaseLayer:
|
|
290
|
+
model: y(() => r.value),
|
|
291
|
+
layers: a,
|
|
292
|
+
isVisible: s,
|
|
293
|
+
setVisible: c,
|
|
294
|
+
toggle: l,
|
|
295
|
+
opacityOf: u,
|
|
296
|
+
setOpacity: d,
|
|
297
|
+
layersOf: f,
|
|
298
|
+
groupState: p,
|
|
299
|
+
setGroupVisible: m,
|
|
300
|
+
baseLayers: h,
|
|
301
|
+
baseLayer: g,
|
|
302
|
+
setBaseLayer: _
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/composables/_mapStyle.ts
|
|
307
|
+
function pe(e) {
|
|
308
|
+
return {
|
|
309
|
+
sources: new Set(Object.keys(e?.sources ?? {})),
|
|
310
|
+
layers: new Set((e?.layers ?? []).map((e) => e.id))
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function me(e, t, n, r = () => !0) {
|
|
314
|
+
if (!e) return t;
|
|
315
|
+
let i = new Set(t.layers.map((e) => e.id)), a = e.layers.filter((e) => !n.layers.has(e.id) && !i.has(e.id) && r(e)), o = { ...t.sources };
|
|
316
|
+
for (let [t, r] of Object.entries(e.sources)) !n.sources.has(t) && !(t in o) && (o[t] = r);
|
|
317
|
+
return {
|
|
318
|
+
...t,
|
|
319
|
+
sources: o,
|
|
320
|
+
layers: [...t.layers, ...a]
|
|
277
321
|
};
|
|
278
322
|
}
|
|
279
323
|
//#endregion
|
|
280
324
|
//#region src/components/MMap.vue?vue&type=script&setup=true&lang.ts
|
|
281
|
-
var
|
|
325
|
+
var he = 600, ge = /* @__PURE__ */ D({
|
|
282
326
|
__name: "MMap",
|
|
283
327
|
props: {
|
|
284
328
|
mapStyle: {},
|
|
329
|
+
keepLayers: {
|
|
330
|
+
type: [Boolean, Function],
|
|
331
|
+
default: !0
|
|
332
|
+
},
|
|
333
|
+
transformStyle: {},
|
|
285
334
|
center: {},
|
|
286
335
|
zoom: {},
|
|
287
336
|
bearing: {},
|
|
@@ -321,22 +370,22 @@ var ue = 600, de = /* @__PURE__ */ E({
|
|
|
321
370
|
"update:bearing",
|
|
322
371
|
"update:pitch"
|
|
323
372
|
],
|
|
324
|
-
setup(e, { expose:
|
|
325
|
-
let
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
function
|
|
335
|
-
|
|
373
|
+
setup(e, { expose: n, emit: r }) {
|
|
374
|
+
let i = e, a = r, o = z(), s = z(), c = H(), l = H(), u = z(0), d, f = H(), p = ue(), m = {
|
|
375
|
+
map: c,
|
|
376
|
+
maplibre: l,
|
|
377
|
+
styleVersion: u,
|
|
378
|
+
model: f,
|
|
379
|
+
layerState: p,
|
|
380
|
+
activeTool: z(null)
|
|
381
|
+
};
|
|
382
|
+
R(re, m);
|
|
383
|
+
function h(e) {
|
|
384
|
+
f.value = i.adapter ? i.adapter(e.getStyle(), { styleUrl: typeof i.mapStyle == "string" ? i.mapStyle : void 0 }) : void 0, de(p, e, f.value);
|
|
336
385
|
}
|
|
337
|
-
let
|
|
338
|
-
function
|
|
339
|
-
let e =
|
|
386
|
+
let g = t(), _ = () => typeof i.persist == "string" ? i.persist : i.persist ? "m3-map-view" : null;
|
|
387
|
+
function y() {
|
|
388
|
+
let e = _();
|
|
340
389
|
if (!e) return {};
|
|
341
390
|
try {
|
|
342
391
|
let t = JSON.parse(localStorage.getItem(e) ?? "null");
|
|
@@ -345,7 +394,7 @@ var ue = 600, de = /* @__PURE__ */ E({
|
|
|
345
394
|
return {};
|
|
346
395
|
}
|
|
347
396
|
}
|
|
348
|
-
function
|
|
397
|
+
function w(e) {
|
|
349
398
|
let t = e.getCenter();
|
|
350
399
|
return {
|
|
351
400
|
center: [t.lng, t.lat],
|
|
@@ -354,7 +403,7 @@ var ue = 600, de = /* @__PURE__ */ E({
|
|
|
354
403
|
pitch: e.getPitch()
|
|
355
404
|
};
|
|
356
405
|
}
|
|
357
|
-
let
|
|
406
|
+
let T = {
|
|
358
407
|
navigation: {
|
|
359
408
|
corner: "top-right",
|
|
360
409
|
create: (e) => new e.NavigationControl()
|
|
@@ -368,7 +417,7 @@ var ue = 600, de = /* @__PURE__ */ E({
|
|
|
368
417
|
},
|
|
369
418
|
fullscreen: {
|
|
370
419
|
corner: "top-right",
|
|
371
|
-
create: (e) => new e.FullscreenControl({ container:
|
|
420
|
+
create: (e) => new e.FullscreenControl({ container: o.value })
|
|
372
421
|
},
|
|
373
422
|
scale: {
|
|
374
423
|
corner: "bottom-left",
|
|
@@ -377,182 +426,193 @@ var ue = 600, de = /* @__PURE__ */ E({
|
|
|
377
426
|
unit: "metric"
|
|
378
427
|
})
|
|
379
428
|
}
|
|
380
|
-
},
|
|
381
|
-
function
|
|
382
|
-
let t =
|
|
429
|
+
}, D = /* @__PURE__ */ new Map();
|
|
430
|
+
function O(e) {
|
|
431
|
+
let t = c.value, n = l.value;
|
|
383
432
|
if (!t || !n) return;
|
|
384
|
-
let
|
|
385
|
-
|
|
386
|
-
let a =
|
|
433
|
+
let r = D.get(e);
|
|
434
|
+
r && (t.removeControl(r), D.delete(e));
|
|
435
|
+
let a = i[e];
|
|
387
436
|
if (!a) return;
|
|
388
|
-
let o =
|
|
389
|
-
t.addControl(o, a === !0 ?
|
|
437
|
+
let o = T[e].create(n);
|
|
438
|
+
t.addControl(o, a === !0 ? T[e].corner : a), D.set(e, o);
|
|
390
439
|
}
|
|
391
|
-
for (let e of Object.keys(
|
|
392
|
-
function
|
|
440
|
+
for (let e of Object.keys(T)) K(() => i[e], () => O(e));
|
|
441
|
+
function k() {
|
|
393
442
|
return {
|
|
394
|
-
"AttributionControl.ToggleAttribution":
|
|
395
|
-
"AttributionControl.MapFeedback":
|
|
396
|
-
"FullscreenControl.Enter":
|
|
397
|
-
"FullscreenControl.Exit":
|
|
398
|
-
"GeolocateControl.FindMyLocation":
|
|
399
|
-
"GeolocateControl.LocationNotAvailable":
|
|
400
|
-
"Map.Title":
|
|
401
|
-
"Marker.Title":
|
|
402
|
-
"NavigationControl.ResetBearing":
|
|
403
|
-
"NavigationControl.ZoomIn":
|
|
404
|
-
"NavigationControl.ZoomOut":
|
|
405
|
-
"Popup.Close":
|
|
406
|
-
"CooperativeGesturesHandler.WindowsHelpText":
|
|
407
|
-
"CooperativeGesturesHandler.MacHelpText":
|
|
408
|
-
"CooperativeGesturesHandler.MobileHelpText":
|
|
443
|
+
"AttributionControl.ToggleAttribution": g.mapToggleAttribution,
|
|
444
|
+
"AttributionControl.MapFeedback": g.mapFeedback,
|
|
445
|
+
"FullscreenControl.Enter": g.mapEnterFullscreen,
|
|
446
|
+
"FullscreenControl.Exit": g.mapExitFullscreen,
|
|
447
|
+
"GeolocateControl.FindMyLocation": g.mapFindMyLocation,
|
|
448
|
+
"GeolocateControl.LocationNotAvailable": g.mapLocationNotAvailable,
|
|
449
|
+
"Map.Title": g.mapTitle,
|
|
450
|
+
"Marker.Title": g.mapMarker,
|
|
451
|
+
"NavigationControl.ResetBearing": g.mapResetBearing,
|
|
452
|
+
"NavigationControl.ZoomIn": g.mapZoomIn,
|
|
453
|
+
"NavigationControl.ZoomOut": g.mapZoomOut,
|
|
454
|
+
"Popup.Close": g.close,
|
|
455
|
+
"CooperativeGesturesHandler.WindowsHelpText": g.mapCtrlScroll,
|
|
456
|
+
"CooperativeGesturesHandler.MacHelpText": g.mapCmdScroll,
|
|
457
|
+
"CooperativeGesturesHandler.MobileHelpText": g.mapTwoFingers
|
|
409
458
|
};
|
|
410
459
|
}
|
|
411
|
-
let
|
|
412
|
-
function
|
|
460
|
+
let j = z(null), ee, B;
|
|
461
|
+
function W(e) {
|
|
413
462
|
let t = e.getAttribute("title");
|
|
414
463
|
t && e.closest(".maplibregl-ctrl") && (e.setAttribute("data-m3-tip", t), e.hasAttribute("aria-label") || e.setAttribute("aria-label", t), e.removeAttribute("title"));
|
|
415
464
|
}
|
|
416
|
-
function
|
|
417
|
-
let t = e.getAttribute("data-m3-tip"), n =
|
|
465
|
+
function G(e) {
|
|
466
|
+
let t = e.getAttribute("data-m3-tip"), n = o.value?.getBoundingClientRect();
|
|
418
467
|
if (!t || !n) return;
|
|
419
468
|
let r = e.getBoundingClientRect(), i = r.left + r.width / 2 > n.left + n.width / 2;
|
|
420
|
-
|
|
469
|
+
j.value = {
|
|
421
470
|
text: t,
|
|
422
471
|
left: i,
|
|
423
472
|
x: (i ? r.left - 8 : r.right + 8) - n.left,
|
|
424
473
|
y: r.top + r.height / 2 - n.top
|
|
425
474
|
};
|
|
426
475
|
}
|
|
427
|
-
function
|
|
428
|
-
clearTimeout(
|
|
476
|
+
function te() {
|
|
477
|
+
clearTimeout(ee), j.value = null;
|
|
429
478
|
}
|
|
430
|
-
let
|
|
479
|
+
let ne = (e) => e.target?.closest?.(".maplibregl-ctrl [data-m3-tip]") ?? null;
|
|
431
480
|
function J(e) {
|
|
432
|
-
let t =
|
|
433
|
-
t && e.pointerType !== "touch" && (clearTimeout(
|
|
434
|
-
}
|
|
435
|
-
function re(e) {
|
|
436
|
-
let t = K(e);
|
|
437
|
-
t && !t.contains(e.relatedTarget) && ne();
|
|
481
|
+
let t = ne(e);
|
|
482
|
+
t && e.pointerType !== "touch" && (clearTimeout(ee), ee = setTimeout(() => G(t), he));
|
|
438
483
|
}
|
|
439
484
|
function ie(e) {
|
|
440
|
-
let t =
|
|
441
|
-
t
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
let
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
485
|
+
let t = ne(e);
|
|
486
|
+
t && !t.contains(e.relatedTarget) && te();
|
|
487
|
+
}
|
|
488
|
+
function Y(e) {
|
|
489
|
+
let t = ne(e);
|
|
490
|
+
t?.matches(":focus-visible") && G(t);
|
|
491
|
+
}
|
|
492
|
+
F(() => {
|
|
493
|
+
let e = o.value;
|
|
494
|
+
e && (e.querySelectorAll("[title]").forEach(W), B = new MutationObserver((e) => {
|
|
495
|
+
for (let t of e) t.type === "attributes" ? W(t.target) : t.addedNodes.forEach((e) => {
|
|
496
|
+
e instanceof Element && (W(e), e.querySelectorAll("[title]").forEach(W));
|
|
448
497
|
});
|
|
449
|
-
}),
|
|
498
|
+
}), B.observe(e, {
|
|
450
499
|
subtree: !0,
|
|
451
500
|
childList: !0,
|
|
452
501
|
attributes: !0,
|
|
453
502
|
attributeFilter: ["title"]
|
|
454
503
|
}));
|
|
455
|
-
}),
|
|
456
|
-
|
|
504
|
+
}), P(() => {
|
|
505
|
+
B?.disconnect(), clearTimeout(ee);
|
|
457
506
|
});
|
|
458
507
|
let ae = !1;
|
|
459
|
-
|
|
508
|
+
F(async () => {
|
|
460
509
|
let e = await import("maplibre-gl"), t = "Map" in e ? e : e.default;
|
|
461
|
-
if (ae || !
|
|
462
|
-
let n =
|
|
463
|
-
center: n.center ??
|
|
464
|
-
zoom: n.zoom ??
|
|
465
|
-
bearing: n.bearing ??
|
|
466
|
-
pitch: n.pitch ??
|
|
467
|
-
},
|
|
468
|
-
container:
|
|
469
|
-
style:
|
|
510
|
+
if (ae || !s.value) return;
|
|
511
|
+
let n = y(), r = {
|
|
512
|
+
center: n.center ?? i.center,
|
|
513
|
+
zoom: n.zoom ?? i.zoom,
|
|
514
|
+
bearing: n.bearing ?? i.bearing,
|
|
515
|
+
pitch: n.pitch ?? i.pitch
|
|
516
|
+
}, o = A(new t.Map({
|
|
517
|
+
container: s.value,
|
|
518
|
+
style: i.mapStyle,
|
|
470
519
|
attributionControl: !1,
|
|
471
|
-
locale:
|
|
472
|
-
...Object.fromEntries(Object.entries(
|
|
473
|
-
...
|
|
520
|
+
locale: k(),
|
|
521
|
+
...Object.fromEntries(Object.entries(r).filter(([, e]) => e !== void 0)),
|
|
522
|
+
...i.options
|
|
474
523
|
}));
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}),
|
|
478
|
-
let e =
|
|
479
|
-
|
|
480
|
-
let t =
|
|
524
|
+
l.value = t, o.on("style.load", () => {
|
|
525
|
+
d ||= pe(o.getStyle()), h(o), u.value++;
|
|
526
|
+
}), o.on("click", (e) => a("click", e)), o.on("moveend", () => {
|
|
527
|
+
let e = w(o);
|
|
528
|
+
a("update:center", e.center), a("update:zoom", e.zoom), a("update:bearing", e.bearing), a("update:pitch", e.pitch);
|
|
529
|
+
let t = _();
|
|
481
530
|
if (t) try {
|
|
482
531
|
localStorage.setItem(t, JSON.stringify(e));
|
|
483
532
|
} catch {}
|
|
484
|
-
}),
|
|
485
|
-
|
|
486
|
-
for (let e of Object.keys(
|
|
487
|
-
|
|
533
|
+
}), o.once("load", () => {
|
|
534
|
+
c.value = o;
|
|
535
|
+
for (let e of Object.keys(T)) O(e);
|
|
536
|
+
a("ready", o);
|
|
488
537
|
});
|
|
489
|
-
}),
|
|
490
|
-
ae = !0,
|
|
538
|
+
}), I(() => {
|
|
539
|
+
ae = !0, c.value?.remove(), c.value = void 0;
|
|
491
540
|
});
|
|
492
|
-
let
|
|
493
|
-
return
|
|
494
|
-
let e =
|
|
495
|
-
if (!e || !
|
|
541
|
+
let X = (e, t) => Math.abs(e - t) < 1e-9;
|
|
542
|
+
return K(() => i.center?.join(","), () => {
|
|
543
|
+
let e = c.value;
|
|
544
|
+
if (!e || !i.center) return;
|
|
496
545
|
let t = e.getCenter();
|
|
497
|
-
(!
|
|
498
|
-
}),
|
|
499
|
-
|
|
500
|
-
}),
|
|
501
|
-
|
|
502
|
-
}),
|
|
503
|
-
|
|
504
|
-
}),
|
|
505
|
-
|
|
506
|
-
}),
|
|
546
|
+
(!X(t.lng, i.center[0]) || !X(t.lat, i.center[1])) && e.jumpTo({ center: i.center });
|
|
547
|
+
}), K(() => i.zoom, (e) => {
|
|
548
|
+
c.value && e !== void 0 && !X(c.value.getZoom(), e) && c.value.jumpTo({ zoom: e });
|
|
549
|
+
}), K(() => i.bearing, (e) => {
|
|
550
|
+
c.value && e !== void 0 && !X(c.value.getBearing(), e) && c.value.jumpTo({ bearing: e });
|
|
551
|
+
}), K(() => i.pitch, (e) => {
|
|
552
|
+
c.value && e !== void 0 && !X(c.value.getPitch(), e) && c.value.jumpTo({ pitch: e });
|
|
553
|
+
}), K(() => i.adapter, () => {
|
|
554
|
+
c.value && h(c.value);
|
|
555
|
+
}), K(() => i.mapStyle, (e) => c.value?.setStyle(e, {
|
|
556
|
+
diff: !1,
|
|
557
|
+
transformStyle: (e, t) => {
|
|
558
|
+
let n = d ?? pe(void 0);
|
|
559
|
+
d = pe(t);
|
|
560
|
+
let r = i.keepLayers, a = r === !1 ? t : me(e, t, n, typeof r == "function" ? r : void 0);
|
|
561
|
+
return i.transformStyle && (a = i.transformStyle(e, a)), a;
|
|
562
|
+
}
|
|
563
|
+
})), n({
|
|
564
|
+
map: c,
|
|
565
|
+
context: m
|
|
566
|
+
}), (t, n) => (L(), S("div", {
|
|
507
567
|
ref_key: "root",
|
|
508
|
-
ref:
|
|
568
|
+
ref: o,
|
|
509
569
|
class: "m3-map relative overflow-hidden",
|
|
510
570
|
onPointerover: J,
|
|
511
|
-
onPointerout:
|
|
512
|
-
onPointerdown:
|
|
513
|
-
onFocusin:
|
|
514
|
-
onFocusout:
|
|
571
|
+
onPointerout: ie,
|
|
572
|
+
onPointerdown: te,
|
|
573
|
+
onFocusin: Y,
|
|
574
|
+
onFocusout: te
|
|
515
575
|
}, [
|
|
516
|
-
|
|
576
|
+
C("div", {
|
|
517
577
|
ref_key: "container",
|
|
518
|
-
ref:
|
|
578
|
+
ref: s,
|
|
519
579
|
class: "h-full w-full"
|
|
520
580
|
}, null, 512),
|
|
521
|
-
|
|
581
|
+
c.value && e.attribution ? (L(), b(ce, {
|
|
522
582
|
key: 0,
|
|
523
583
|
position: e.attribution === !0 ? "bottom-right" : e.attribution
|
|
524
|
-
}, null, 8, ["position"])) :
|
|
525
|
-
|
|
526
|
-
|
|
584
|
+
}, null, 8, ["position"])) : x("", !0),
|
|
585
|
+
c.value ? V(t.$slots, "default", {}, void 0, void 0, 1) : x("", !0),
|
|
586
|
+
E(v, {
|
|
527
587
|
"enter-active-class": "transition-opacity duration-150",
|
|
528
588
|
"enter-from-class": "opacity-0",
|
|
529
589
|
"leave-active-class": "transition-opacity duration-100",
|
|
530
590
|
"leave-to-class": "opacity-0"
|
|
531
591
|
}, {
|
|
532
|
-
default:
|
|
592
|
+
default: q(() => [j.value ? (L(), S("div", {
|
|
533
593
|
key: 0,
|
|
534
594
|
role: "tooltip",
|
|
535
|
-
class:
|
|
536
|
-
style:
|
|
537
|
-
left: `${
|
|
538
|
-
top: `${
|
|
595
|
+
class: M(["pointer-events-none absolute z-10 min-h-6 max-w-[200px] -translate-y-1/2 rounded bg-inverse-surface px-2 py-1 text-body-small whitespace-nowrap text-inverse-on-surface", j.value.left ? "-translate-x-full" : ""]),
|
|
596
|
+
style: N({
|
|
597
|
+
left: `${j.value.x}px`,
|
|
598
|
+
top: `${j.value.y}px`
|
|
539
599
|
})
|
|
540
|
-
},
|
|
600
|
+
}, U(j.value.text), 7)) : x("", !0)]),
|
|
541
601
|
_: 1
|
|
542
602
|
})
|
|
543
603
|
], 544));
|
|
544
604
|
}
|
|
545
|
-
}),
|
|
605
|
+
}), _e = 13.5, ve = _e / Math.SQRT2, ye = [0, -14], be = {
|
|
546
606
|
center: [0, 0],
|
|
547
607
|
top: [0, 0],
|
|
548
608
|
"top-left": [0, 0],
|
|
549
609
|
"top-right": [0, 0],
|
|
550
610
|
bottom: [0, -38.1],
|
|
551
|
-
"bottom-left": [
|
|
552
|
-
"bottom-right": [-
|
|
553
|
-
left: [
|
|
611
|
+
"bottom-left": [ve, (24.6 + ve) * -1],
|
|
612
|
+
"bottom-right": [-ve, (24.6 + ve) * -1],
|
|
613
|
+
left: [_e, -24.6],
|
|
554
614
|
right: [-13.5, -24.6]
|
|
555
|
-
},
|
|
615
|
+
}, xe = { class: "hidden" }, Se = /* @__PURE__ */ D({
|
|
556
616
|
inheritAttrs: !1,
|
|
557
617
|
__name: "MMapMarker",
|
|
558
618
|
props: {
|
|
@@ -568,7 +628,7 @@ var ue = 600, de = /* @__PURE__ */ E({
|
|
|
568
628
|
},
|
|
569
629
|
emits: ["update:lngLat", "click"],
|
|
570
630
|
setup(e, { expose: t, emit: n }) {
|
|
571
|
-
let r = e, i = n, a = ne(), o =
|
|
631
|
+
let r = e, i = n, a = ne(), o = z(), s = z(), { onReady: c } = Y(), l, u = !1;
|
|
572
632
|
c((e, t) => {
|
|
573
633
|
u = !!a.default && !!o.value, l = new t.Marker({
|
|
574
634
|
...u ? { element: o.value } : { color: r.color ?? "currentColor" },
|
|
@@ -587,20 +647,20 @@ var ue = 600, de = /* @__PURE__ */ E({
|
|
|
587
647
|
function d(e) {
|
|
588
648
|
i("click", e);
|
|
589
649
|
}
|
|
590
|
-
return
|
|
650
|
+
return K(() => r.lngLat.join(","), () => l?.setLngLat(r.lngLat)), K(() => r.draggable, (e) => l?.setDraggable(e)), K(() => r.rotation, (e) => l?.setRotation(e)), K(() => r.offset?.join(","), () => l?.setOffset(r.offset ?? (u ? [0, 0] : ye))), P(() => {
|
|
591
651
|
l?.getElement().removeEventListener("click", d), l?.getPopup()?.remove(), l?.remove();
|
|
592
|
-
}), t({ marker: () => l }), (e, t) => (
|
|
652
|
+
}), t({ marker: () => l }), (e, t) => (L(), S("div", xe, [e.$slots.default ? (L(), S("div", j({
|
|
593
653
|
key: 0,
|
|
594
654
|
ref_key: "content",
|
|
595
655
|
ref: o,
|
|
596
656
|
class: "m3-map-marker"
|
|
597
|
-
}, e.$attrs), [
|
|
657
|
+
}, e.$attrs), [V(e.$slots, "default")], 16)) : x("", !0), e.$slots.popup ? (L(), S("div", {
|
|
598
658
|
key: 1,
|
|
599
659
|
ref_key: "popupContent",
|
|
600
660
|
ref: s
|
|
601
|
-
}, [
|
|
661
|
+
}, [V(e.$slots, "popup")], 512)) : x("", !0)]));
|
|
602
662
|
}
|
|
603
|
-
}),
|
|
663
|
+
}), Q = { class: "hidden" }, Ce = /* @__PURE__ */ D({
|
|
604
664
|
inheritAttrs: !1,
|
|
605
665
|
__name: "MMapPopup",
|
|
606
666
|
props: {
|
|
@@ -623,7 +683,7 @@ var ue = 600, de = /* @__PURE__ */ E({
|
|
|
623
683
|
},
|
|
624
684
|
emits: ["update:open"],
|
|
625
685
|
setup(e, { expose: t, emit: n }) {
|
|
626
|
-
let r = e, i = n, a =
|
|
686
|
+
let r = e, i = n, a = z(), { onReady: o } = Y(), s, c, l = !1;
|
|
627
687
|
function u() {
|
|
628
688
|
s && c && !s.isOpen() && s.setLngLat(r.lngLat).addTo(c);
|
|
629
689
|
}
|
|
@@ -639,50 +699,16 @@ var ue = 600, de = /* @__PURE__ */ E({
|
|
|
639
699
|
}), a.value && s.setDOMContent(a.value), s.on("close", () => {
|
|
640
700
|
l || i("update:open", !1);
|
|
641
701
|
}), r.open && u();
|
|
642
|
-
}),
|
|
702
|
+
}), K(() => r.open, (e) => {
|
|
643
703
|
e ? u() : s?.isOpen() && (l = !0, s.remove(), l = !1);
|
|
644
|
-
}),
|
|
704
|
+
}), K(() => r.lngLat.join(","), () => s?.setLngLat(r.lngLat)), K(() => r.maxWidth, (e) => s?.setMaxWidth(e)), K(() => r.offset, (e) => s?.setOffset(e ?? 0)), P(() => {
|
|
645
705
|
l = !0, s?.remove();
|
|
646
|
-
}), t({ popup: () => s }), (e, t) => (
|
|
706
|
+
}), t({ popup: () => s }), (e, t) => (L(), S("div", Q, [C("div", j({
|
|
647
707
|
ref_key: "content",
|
|
648
708
|
ref: a
|
|
649
|
-
}, e.$attrs), [
|
|
709
|
+
}, e.$attrs), [V(e.$slots, "default")], 16)]));
|
|
650
710
|
}
|
|
651
|
-
})
|
|
652
|
-
//#endregion
|
|
653
|
-
//#region src/composables/_useThemeTokens.ts
|
|
654
|
-
function be(e) {
|
|
655
|
-
let t = () => {
|
|
656
|
-
let t = getComputedStyle(document.documentElement);
|
|
657
|
-
return Object.fromEntries(e.map((e) => [e, t.getPropertyValue(`--color-${e}`).trim()]));
|
|
658
|
-
}, n = R(typeof document > "u" ? Object.fromEntries(e.map((e) => [e, ""])) : t()), i, a;
|
|
659
|
-
return P(() => {
|
|
660
|
-
let o = () => {
|
|
661
|
-
let r = t();
|
|
662
|
-
e.some((e) => r[e] !== n.value[e]) && (n.value = r);
|
|
663
|
-
}, s = (e) => (e instanceof Element ? e : e?.parentElement)?.id === r;
|
|
664
|
-
i = new MutationObserver((e) => {
|
|
665
|
-
e.some((e) => e.target === document.documentElement || s(e.target) || Array.from(e.addedNodes).some(s)) && (o(), clearTimeout(a), a = setTimeout(o, 300));
|
|
666
|
-
}), i.observe(document.documentElement, {
|
|
667
|
-
attributes: !0,
|
|
668
|
-
attributeFilter: [
|
|
669
|
-
"class",
|
|
670
|
-
"style",
|
|
671
|
-
"data-palette",
|
|
672
|
-
"data-contrast"
|
|
673
|
-
]
|
|
674
|
-
}), i.observe(document.head, {
|
|
675
|
-
childList: !0,
|
|
676
|
-
characterData: !0,
|
|
677
|
-
subtree: !0
|
|
678
|
-
});
|
|
679
|
-
}), N(() => {
|
|
680
|
-
i?.disconnect(), clearTimeout(a);
|
|
681
|
-
}), n;
|
|
682
|
-
}
|
|
683
|
-
//#endregion
|
|
684
|
-
//#region src/components/MMapGeoJson.vue
|
|
685
|
-
var xe = /* @__PURE__ */ E({
|
|
711
|
+
}), we = /* @__PURE__ */ D({
|
|
686
712
|
inheritAttrs: !1,
|
|
687
713
|
__name: "MMapGeoJson",
|
|
688
714
|
props: {
|
|
@@ -697,38 +723,38 @@ var xe = /* @__PURE__ */ E({
|
|
|
697
723
|
sourceOptions: {}
|
|
698
724
|
},
|
|
699
725
|
emits: ["click"],
|
|
700
|
-
setup(
|
|
701
|
-
let
|
|
726
|
+
setup(t, { expose: n, emit: r }) {
|
|
727
|
+
let i = t, a = r, o = i.id ?? `m3-geojson-${te()}`, { onReady: s, styleVersion: c } = Y(), l = e(["primary", "surface"]), u = (...e) => [
|
|
702
728
|
"match",
|
|
703
729
|
["geometry-type"],
|
|
704
730
|
e,
|
|
705
731
|
!0,
|
|
706
732
|
!1
|
|
707
|
-
],
|
|
708
|
-
let { primary: e, surface: t } =
|
|
733
|
+
], d = y(() => {
|
|
734
|
+
let { primary: e, surface: t } = l.value;
|
|
709
735
|
return [
|
|
710
736
|
{
|
|
711
|
-
id: `${
|
|
737
|
+
id: `${o}-fill`,
|
|
712
738
|
type: "fill",
|
|
713
|
-
filter:
|
|
739
|
+
filter: u("Polygon", "MultiPolygon"),
|
|
714
740
|
paint: {
|
|
715
741
|
"fill-color": e,
|
|
716
742
|
"fill-opacity": .24
|
|
717
743
|
}
|
|
718
744
|
},
|
|
719
745
|
{
|
|
720
|
-
id: `${
|
|
746
|
+
id: `${o}-line`,
|
|
721
747
|
type: "line",
|
|
722
|
-
filter:
|
|
748
|
+
filter: u("Polygon", "MultiPolygon", "LineString", "MultiLineString"),
|
|
723
749
|
paint: {
|
|
724
750
|
"line-color": e,
|
|
725
751
|
"line-width": 2
|
|
726
752
|
}
|
|
727
753
|
},
|
|
728
754
|
{
|
|
729
|
-
id: `${
|
|
755
|
+
id: `${o}-circle`,
|
|
730
756
|
type: "circle",
|
|
731
|
-
filter:
|
|
757
|
+
filter: u("Point", "MultiPoint"),
|
|
732
758
|
paint: {
|
|
733
759
|
"circle-color": e,
|
|
734
760
|
"circle-radius": 6,
|
|
@@ -737,137 +763,137 @@ var xe = /* @__PURE__ */ E({
|
|
|
737
763
|
}
|
|
738
764
|
}
|
|
739
765
|
];
|
|
740
|
-
}),
|
|
766
|
+
}), f = y(() => (i.layers ?? d.value).map((e, t) => ({
|
|
741
767
|
...e,
|
|
742
|
-
id: e.id ?? `${
|
|
743
|
-
source:
|
|
744
|
-
}))),
|
|
745
|
-
|
|
746
|
-
},
|
|
747
|
-
|
|
768
|
+
id: e.id ?? `${o}-${t}`,
|
|
769
|
+
source: o
|
|
770
|
+
}))), p, m = [], h = (e) => a("click", e), g = () => {
|
|
771
|
+
i.interactive && p && (p.getCanvas().style.cursor = "pointer");
|
|
772
|
+
}, _ = () => {
|
|
773
|
+
i.interactive && p && (p.getCanvas().style.cursor = "");
|
|
748
774
|
};
|
|
749
|
-
function
|
|
750
|
-
if (
|
|
751
|
-
for (let e of
|
|
752
|
-
|
|
775
|
+
function v() {
|
|
776
|
+
if (p) {
|
|
777
|
+
for (let e of m) p.off("click", e, h), p.off("mouseenter", e, g), p.off("mouseleave", e, _), p.getLayer(e) && p.removeLayer(e);
|
|
778
|
+
m = [];
|
|
753
779
|
}
|
|
754
780
|
}
|
|
755
|
-
function
|
|
756
|
-
if (
|
|
757
|
-
|
|
758
|
-
for (let e of
|
|
781
|
+
function b() {
|
|
782
|
+
if (p) {
|
|
783
|
+
v();
|
|
784
|
+
for (let e of f.value) p.addLayer(e, i.before && p.getLayer(i.before) ? i.before : void 0), p.on("click", e.id, h), p.on("mouseenter", e.id, g), p.on("mouseleave", e.id, _), m.push(e.id);
|
|
759
785
|
}
|
|
760
786
|
}
|
|
761
|
-
function
|
|
762
|
-
|
|
787
|
+
function x() {
|
|
788
|
+
p && (p.getSource(o) || (p.addSource(o, {
|
|
763
789
|
type: "geojson",
|
|
764
|
-
data:
|
|
765
|
-
...
|
|
766
|
-
}),
|
|
767
|
-
}
|
|
768
|
-
return
|
|
769
|
-
|
|
770
|
-
}),
|
|
771
|
-
|
|
772
|
-
}),
|
|
773
|
-
sourceId:
|
|
774
|
-
layerIds: () => [...
|
|
790
|
+
data: i.data,
|
|
791
|
+
...i.sourceOptions
|
|
792
|
+
}), m = []), (!m.length || !p.getLayer(m[0])) && b());
|
|
793
|
+
}
|
|
794
|
+
return s((e) => {
|
|
795
|
+
p = e, x();
|
|
796
|
+
}), K(c, () => x()), K(() => i.data, (e) => (p?.getSource(o))?.setData(e)), K(() => JSON.stringify(f.value), () => b()), K(() => i.before, () => b()), P(() => {
|
|
797
|
+
p &&= (v(), p.getSource(o) && p.removeSource(o), void 0);
|
|
798
|
+
}), n({
|
|
799
|
+
sourceId: o,
|
|
800
|
+
layerIds: () => [...m]
|
|
775
801
|
}), (e, t) => null;
|
|
776
802
|
}
|
|
777
|
-
}),
|
|
803
|
+
}), Te = { class: "flex min-w-0 flex-1 flex-col" }, Ee = ["aria-label", "aria-pressed"], De = { class: "flex min-w-0 flex-1 flex-col" }, Oe = {
|
|
778
804
|
key: 0,
|
|
779
805
|
class: "truncate text-label-small text-on-surface-variant"
|
|
780
|
-
},
|
|
806
|
+
}, ke = {
|
|
781
807
|
key: 0,
|
|
782
808
|
class: "rounded-full bg-primary/8 px-2 py-0.5 text-label-small tabular-nums text-primary"
|
|
783
|
-
},
|
|
809
|
+
}, Ae = { class: "min-h-0 overflow-hidden" }, je = { class: "flex flex-col gap-3 px-3 pb-3" }, Me = {
|
|
784
810
|
key: 0,
|
|
785
811
|
class: "text-body-small text-on-surface-variant"
|
|
786
|
-
},
|
|
812
|
+
}, Ne = { class: "flex items-center gap-2 rounded-2xl bg-surface-container-highest/60 px-3 py-1" }, Pe = ["src"], Fe = {
|
|
787
813
|
key: 2,
|
|
788
814
|
class: "flex flex-wrap items-center gap-2"
|
|
789
|
-
},
|
|
815
|
+
}, Ie = ["href"], Le = /* @__PURE__ */ D({
|
|
790
816
|
__name: "_MMapLayerItem",
|
|
791
817
|
props: {
|
|
792
818
|
layer: {},
|
|
793
819
|
expanded: { type: Boolean }
|
|
794
820
|
},
|
|
795
821
|
emits: ["toggle-expanded"],
|
|
796
|
-
setup(e, { emit:
|
|
797
|
-
let
|
|
798
|
-
return (t,
|
|
822
|
+
setup(e, { emit: n }) {
|
|
823
|
+
let r = n, i = t(), { isVisible: a, toggle: o, opacityOf: s, setOpacity: c } = fe();
|
|
824
|
+
return (t, n) => (L(), S("div", { class: M(["flex overflow-hidden rounded-2xl bg-surface-container", G(a)(e.layer.id) ? "" : "opacity-75"]) }, [C("div", { class: M(["w-1 shrink-0 transition-colors duration-200", G(a)(e.layer.id) ? "bg-primary" : "bg-outline-variant"]) }, null, 2), C("div", Te, [C("div", {
|
|
799
825
|
class: "flex cursor-pointer items-center gap-2 px-3 py-2",
|
|
800
|
-
onClick:
|
|
826
|
+
onClick: n[1] ||= (e) => r("toggle-expanded")
|
|
801
827
|
}, [
|
|
802
|
-
|
|
828
|
+
C("button", {
|
|
803
829
|
type: "button",
|
|
804
|
-
class:
|
|
805
|
-
"aria-label":
|
|
806
|
-
"aria-pressed":
|
|
807
|
-
onClick:
|
|
808
|
-
}, [
|
|
809
|
-
name:
|
|
830
|
+
class: M(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", G(a)(e.layer.id) ? "bg-primary/12 text-primary" : "bg-on-surface/5 text-on-surface-variant"]),
|
|
831
|
+
"aria-label": G(a)(e.layer.id) ? G(i).mapHideLayer : G(i).mapShowLayer,
|
|
832
|
+
"aria-pressed": G(a)(e.layer.id),
|
|
833
|
+
onClick: n[0] ||= J((t) => G(o)(e.layer.id), ["stop"])
|
|
834
|
+
}, [E(d, {
|
|
835
|
+
name: G(a)(e.layer.id) ? "visibility" : "visibility_off",
|
|
810
836
|
size: 18
|
|
811
|
-
}, null, 8, ["name"])], 10,
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
837
|
+
}, null, 8, ["name"])], 10, Ee),
|
|
838
|
+
C("div", De, [C("span", { class: M(["truncate text-body-medium", G(a)(e.layer.id) ? "text-on-surface" : "text-on-surface-variant"]) }, U(e.layer.title), 3), e.layer.description && !e.expanded ? (L(), S("span", Oe, U(e.layer.description), 1)) : x("", !0)]),
|
|
839
|
+
G(a)(e.layer.id) && G(s)(e.layer.id) < 1 ? (L(), S("span", ke, U(Math.round(G(s)(e.layer.id) * 100)) + "% ", 1)) : x("", !0),
|
|
840
|
+
E(d, {
|
|
815
841
|
name: "expand_more",
|
|
816
842
|
size: 18,
|
|
817
|
-
class:
|
|
843
|
+
class: M(["shrink-0 text-on-surface-variant transition-transform duration-300", e.expanded ? "rotate-180" : ""])
|
|
818
844
|
}, null, 8, ["class"])
|
|
819
|
-
]),
|
|
845
|
+
]), C("div", {
|
|
820
846
|
class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
821
|
-
style:
|
|
822
|
-
}, [
|
|
823
|
-
e.layer.description ? (
|
|
824
|
-
|
|
847
|
+
style: N({ gridTemplateRows: e.expanded ? "1fr" : "0fr" })
|
|
848
|
+
}, [C("div", Ae, [C("div", je, [
|
|
849
|
+
e.layer.description ? (L(), S("p", Me, U(e.layer.description), 1)) : x("", !0),
|
|
850
|
+
C("div", Ne, [E(d, {
|
|
825
851
|
name: "opacity",
|
|
826
852
|
size: 16,
|
|
827
853
|
class: "shrink-0 text-on-surface-variant"
|
|
828
|
-
}),
|
|
829
|
-
"model-value":
|
|
854
|
+
}), E(g, {
|
|
855
|
+
"model-value": G(s)(e.layer.id),
|
|
830
856
|
min: 0,
|
|
831
857
|
max: 1,
|
|
832
858
|
step: .01,
|
|
833
|
-
label:
|
|
859
|
+
label: G(i).mapOpacity,
|
|
834
860
|
class: "flex-1",
|
|
835
|
-
"onUpdate:modelValue":
|
|
861
|
+
"onUpdate:modelValue": n[2] ||= (t) => G(c)(e.layer.id, Number(t))
|
|
836
862
|
}, null, 8, ["model-value", "label"])]),
|
|
837
|
-
e.layer.legend ? (
|
|
863
|
+
e.layer.legend ? (L(), S("img", {
|
|
838
864
|
key: 1,
|
|
839
865
|
src: e.layer.legend,
|
|
840
866
|
alt: "",
|
|
841
867
|
class: "max-w-full self-start",
|
|
842
868
|
loading: "lazy"
|
|
843
|
-
}, null, 8,
|
|
844
|
-
e.layer.download || t.$slots.actions ? (
|
|
869
|
+
}, null, 8, Pe)) : x("", !0),
|
|
870
|
+
e.layer.download || t.$slots.actions ? (L(), S("div", Fe, [e.layer.download ? (L(), S("a", {
|
|
845
871
|
key: 0,
|
|
846
872
|
href: e.layer.download,
|
|
847
873
|
target: "_blank",
|
|
848
874
|
rel: "noopener",
|
|
849
875
|
download: "",
|
|
850
876
|
class: "inline-flex items-center gap-1 rounded-full px-3 py-1.5 text-label-large text-primary hover:bg-primary/8"
|
|
851
|
-
}, [
|
|
877
|
+
}, [E(d, {
|
|
852
878
|
name: "download",
|
|
853
879
|
size: 18
|
|
854
|
-
}),
|
|
880
|
+
}), T(" " + U(G(i).mapDownload), 1)], 8, Ie)) : x("", !0), V(t.$slots, "actions", {
|
|
855
881
|
layer: e.layer,
|
|
856
|
-
visible:
|
|
857
|
-
})])) :
|
|
882
|
+
visible: G(a)(e.layer.id)
|
|
883
|
+
})])) : x("", !0)
|
|
858
884
|
])])], 4)])], 2));
|
|
859
885
|
}
|
|
860
|
-
}),
|
|
886
|
+
}), Re = { class: "flex flex-col gap-3" }, ze = ["onClick"], Be = [
|
|
861
887
|
"aria-label",
|
|
862
888
|
"aria-pressed",
|
|
863
889
|
"onClick"
|
|
864
|
-
],
|
|
890
|
+
], Ve = { class: "flex-1 select-none truncate text-label-large text-on-surface" }, He = { class: "rounded-full bg-surface-container-highest px-2 py-0.5 text-label-small tabular-nums text-on-surface-variant" }, Ue = {
|
|
865
891
|
key: 1,
|
|
866
892
|
class: "flex flex-col gap-1.5"
|
|
867
|
-
},
|
|
893
|
+
}, We = {
|
|
868
894
|
key: 2,
|
|
869
895
|
class: "flex flex-col items-center gap-3 py-8"
|
|
870
|
-
},
|
|
896
|
+
}, Ge = { class: "grid size-14 place-items-center rounded-full bg-surface-container-highest" }, Ke = { class: "text-body-medium text-on-surface-variant" }, qe = /* @__PURE__ */ D({
|
|
871
897
|
__name: "MMapLayers",
|
|
872
898
|
props: {
|
|
873
899
|
search: {
|
|
@@ -877,106 +903,107 @@ var xe = /* @__PURE__ */ E({
|
|
|
877
903
|
collapsed: {
|
|
878
904
|
type: Boolean,
|
|
879
905
|
default: !1
|
|
880
|
-
}
|
|
906
|
+
},
|
|
907
|
+
map: {}
|
|
881
908
|
},
|
|
882
909
|
setup(e) {
|
|
883
|
-
let
|
|
910
|
+
let n = e, r = t(), { model: i, layersOf: a, isVisible: o, groupState: s, setGroupVisible: l } = fe(() => n.map), u = z(""), f = (e) => !u.value || e.title.toLowerCase().includes(u.value.toLowerCase()), p = y(() => (i.value?.groups ?? []).map((e) => ({
|
|
884
911
|
...e,
|
|
885
|
-
all:
|
|
886
|
-
layers:
|
|
887
|
-
})).filter((e) => e.layers.length)),
|
|
888
|
-
function
|
|
889
|
-
let t = new Set(
|
|
890
|
-
t.delete(e) || t.add(e),
|
|
891
|
-
}
|
|
892
|
-
let
|
|
912
|
+
all: a(e.name),
|
|
913
|
+
layers: a(e.name).filter(f)
|
|
914
|
+
})).filter((e) => e.layers.length)), m = y(() => a(null).filter(f)), h = z(/* @__PURE__ */ new Set()), g = (e) => h.value.has(e) === n.collapsed;
|
|
915
|
+
function v(e) {
|
|
916
|
+
let t = new Set(h.value);
|
|
917
|
+
t.delete(e) || t.add(e), h.value = t;
|
|
918
|
+
}
|
|
919
|
+
let T = z(/* @__PURE__ */ new Set());
|
|
893
920
|
function D(e) {
|
|
894
|
-
let t = new Set(
|
|
895
|
-
t.delete(e) || t.add(e),
|
|
921
|
+
let t = new Set(T.value);
|
|
922
|
+
t.delete(e) || t.add(e), T.value = t;
|
|
896
923
|
}
|
|
897
|
-
let O = (e) => e.filter((e) =>
|
|
898
|
-
return (t,
|
|
899
|
-
e.search ? (
|
|
924
|
+
let O = (e) => e.filter((e) => o(e.id)).length;
|
|
925
|
+
return (t, n) => (L(), S("div", Re, [
|
|
926
|
+
e.search ? (L(), b(c, {
|
|
900
927
|
key: 0,
|
|
901
|
-
modelValue:
|
|
902
|
-
"onUpdate:modelValue":
|
|
903
|
-
label:
|
|
928
|
+
modelValue: u.value,
|
|
929
|
+
"onUpdate:modelValue": n[0] ||= (e) => u.value = e,
|
|
930
|
+
label: G(r).mapSearchLayers,
|
|
904
931
|
"leading-icon": "search",
|
|
905
932
|
variant: "outlined",
|
|
906
933
|
clearable: ""
|
|
907
|
-
}, null, 8, ["modelValue", "label"])) :
|
|
908
|
-
(
|
|
934
|
+
}, null, 8, ["modelValue", "label"])) : x("", !0),
|
|
935
|
+
(L(!0), S(_, null, B(p.value, (e) => (L(), S("section", {
|
|
909
936
|
key: e.name,
|
|
910
937
|
class: "flex flex-col"
|
|
911
|
-
}, [
|
|
938
|
+
}, [C("div", {
|
|
912
939
|
class: "m3-map-layers-row flex cursor-pointer items-center gap-2 rounded-xl px-2 py-1.5",
|
|
913
|
-
onClick: (t) =>
|
|
940
|
+
onClick: (t) => v(e.name)
|
|
914
941
|
}, [
|
|
915
|
-
|
|
942
|
+
C("button", {
|
|
916
943
|
type: "button",
|
|
917
|
-
class:
|
|
918
|
-
"aria-label":
|
|
919
|
-
"aria-pressed":
|
|
920
|
-
onClick:
|
|
921
|
-
}, [
|
|
922
|
-
name:
|
|
944
|
+
class: M(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", G(s)(e.name) === "visible" ? "bg-primary-container text-on-primary-container" : G(s)(e.name) === "partial" ? "bg-secondary-container text-on-secondary-container" : "bg-on-surface/8 text-on-surface-variant"]),
|
|
945
|
+
"aria-label": G(s)(e.name) === "hidden" ? G(r).mapShowLayer : G(r).mapHideLayer,
|
|
946
|
+
"aria-pressed": G(s)(e.name) !== "hidden",
|
|
947
|
+
onClick: J((t) => G(l)(e.name, G(s)(e.name) !== "visible"), ["stop"])
|
|
948
|
+
}, [E(d, {
|
|
949
|
+
name: G(s)(e.name) === "hidden" ? "visibility_off" : "visibility",
|
|
923
950
|
size: 18
|
|
924
|
-
}, null, 8, ["name"])], 10,
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
951
|
+
}, null, 8, ["name"])], 10, Be),
|
|
952
|
+
C("span", Ve, U(e.title), 1),
|
|
953
|
+
C("span", He, U(O(e.all)) + "/" + U(e.all.length), 1),
|
|
954
|
+
E(d, {
|
|
928
955
|
name: "expand_more",
|
|
929
956
|
size: 18,
|
|
930
|
-
class:
|
|
957
|
+
class: M(["text-on-surface-variant transition-transform duration-300", g(e.name) ? "rotate-180" : ""])
|
|
931
958
|
}, null, 8, ["class"])
|
|
932
|
-
], 8,
|
|
959
|
+
], 8, ze), C("div", {
|
|
933
960
|
class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
934
|
-
style:
|
|
935
|
-
}, [
|
|
961
|
+
style: N({ gridTemplateRows: g(e.name) ? "1fr" : "0fr" })
|
|
962
|
+
}, [C("div", { class: M(["flex min-h-0 flex-col gap-1.5 overflow-hidden", g(e.name) ? "pt-1.5" : ""]) }, [(L(!0), S(_, null, B(e.layers, (e) => (L(), b(Le, {
|
|
936
963
|
key: e.id,
|
|
937
964
|
layer: e,
|
|
938
|
-
expanded:
|
|
965
|
+
expanded: T.value.has(e.id),
|
|
939
966
|
onToggleExpanded: (t) => D(e.id)
|
|
940
|
-
},
|
|
967
|
+
}, w({ _: 2 }, [t.$slots.actions ? {
|
|
941
968
|
name: "actions",
|
|
942
|
-
fn:
|
|
969
|
+
fn: q((e) => [V(t.$slots, "actions", j({ ref_for: !0 }, e))]),
|
|
943
970
|
key: "0"
|
|
944
971
|
} : void 0]), 1032, [
|
|
945
972
|
"layer",
|
|
946
973
|
"expanded",
|
|
947
974
|
"onToggleExpanded"
|
|
948
975
|
]))), 128))], 2)], 4)]))), 128)),
|
|
949
|
-
|
|
976
|
+
m.value.length ? (L(), S("div", Ue, [(L(!0), S(_, null, B(m.value, (e) => (L(), b(Le, {
|
|
950
977
|
key: e.id,
|
|
951
978
|
layer: e,
|
|
952
|
-
expanded:
|
|
979
|
+
expanded: T.value.has(e.id),
|
|
953
980
|
onToggleExpanded: (t) => D(e.id)
|
|
954
|
-
},
|
|
981
|
+
}, w({ _: 2 }, [t.$slots.actions ? {
|
|
955
982
|
name: "actions",
|
|
956
|
-
fn:
|
|
983
|
+
fn: q((e) => [V(t.$slots, "actions", j({ ref_for: !0 }, e))]),
|
|
957
984
|
key: "0"
|
|
958
985
|
} : void 0]), 1032, [
|
|
959
986
|
"layer",
|
|
960
987
|
"expanded",
|
|
961
988
|
"onToggleExpanded"
|
|
962
|
-
]))), 128))])) :
|
|
963
|
-
!
|
|
989
|
+
]))), 128))])) : x("", !0),
|
|
990
|
+
!p.value.length && !m.value.length ? (L(), S("div", We, [C("div", Ge, [E(d, {
|
|
964
991
|
name: "layers_clear",
|
|
965
992
|
size: 28,
|
|
966
993
|
class: "text-on-surface-variant"
|
|
967
|
-
})]),
|
|
994
|
+
})]), C("p", Ke, U(G(r).mapNoLayers), 1)])) : x("", !0)
|
|
968
995
|
]));
|
|
969
996
|
}
|
|
970
|
-
}),
|
|
997
|
+
}), Je = [
|
|
971
998
|
"title",
|
|
972
999
|
"aria-label",
|
|
973
1000
|
"aria-checked",
|
|
974
1001
|
"onClick"
|
|
975
|
-
],
|
|
1002
|
+
], Ye = ["src"], Xe = [
|
|
976
1003
|
"title",
|
|
977
1004
|
"aria-label",
|
|
978
1005
|
"aria-checked"
|
|
979
|
-
],
|
|
1006
|
+
], Ze = /* @__PURE__ */ D({
|
|
980
1007
|
__name: "MMapBaseLayers",
|
|
981
1008
|
props: {
|
|
982
1009
|
imageBase: { default: "" },
|
|
@@ -987,98 +1014,99 @@ var xe = /* @__PURE__ */ E({
|
|
|
987
1014
|
vertical: {
|
|
988
1015
|
type: Boolean,
|
|
989
1016
|
default: !1
|
|
990
|
-
}
|
|
1017
|
+
},
|
|
1018
|
+
map: {}
|
|
991
1019
|
},
|
|
992
1020
|
setup(e) {
|
|
993
|
-
let
|
|
994
|
-
return (
|
|
995
|
-
class:
|
|
1021
|
+
let n = e, r = t(), { baseLayers: i, baseLayer: a, setBaseLayer: o } = fe(() => n.map), s = (e, t) => /^(https?:|data:|\/\/)/.test(e) ? e : `${t}${e}`;
|
|
1022
|
+
return (t, n) => (L(), S("div", {
|
|
1023
|
+
class: M(["flex gap-2", e.vertical ? "flex-col" : "flex-row flex-wrap"]),
|
|
996
1024
|
role: "radiogroup"
|
|
997
|
-
}, [(
|
|
1025
|
+
}, [(L(!0), S(_, null, B(G(i), (t) => (L(), S("button", {
|
|
998
1026
|
key: t.id,
|
|
999
1027
|
type: "button",
|
|
1000
1028
|
role: "radio",
|
|
1001
|
-
class:
|
|
1029
|
+
class: M(["m3-map-base grid size-12 shrink-0 cursor-pointer place-items-center overflow-hidden rounded-full border-2 bg-surface-variant transition-[border-color,transform] duration-150 hover:scale-110", G(a) === t.id ? "m3-map-base--active border-primary" : "border-transparent"]),
|
|
1002
1030
|
title: t.title,
|
|
1003
1031
|
"aria-label": t.title,
|
|
1004
|
-
"aria-checked":
|
|
1005
|
-
onClick: (e) =>
|
|
1006
|
-
}, [t.base?.image ? (
|
|
1032
|
+
"aria-checked": G(a) === t.id,
|
|
1033
|
+
onClick: (e) => G(o)(t.id)
|
|
1034
|
+
}, [t.base?.image ? (L(), S("img", {
|
|
1007
1035
|
key: 0,
|
|
1008
|
-
src:
|
|
1036
|
+
src: s(t.base.image, e.imageBase),
|
|
1009
1037
|
alt: "",
|
|
1010
1038
|
class: "size-full object-cover"
|
|
1011
|
-
}, null, 8,
|
|
1039
|
+
}, null, 8, Ye)) : (L(), b(d, {
|
|
1012
1040
|
key: 1,
|
|
1013
1041
|
name: "map",
|
|
1014
1042
|
size: 22,
|
|
1015
1043
|
class: "text-on-surface-variant"
|
|
1016
|
-
}))], 10,
|
|
1044
|
+
}))], 10, Je))), 128)), e.none ? (L(), S("button", {
|
|
1017
1045
|
key: 0,
|
|
1018
1046
|
type: "button",
|
|
1019
1047
|
role: "radio",
|
|
1020
|
-
class:
|
|
1021
|
-
title:
|
|
1022
|
-
"aria-label":
|
|
1023
|
-
"aria-checked":
|
|
1024
|
-
onClick:
|
|
1025
|
-
}, [
|
|
1048
|
+
class: M(["m3-map-base grid size-12 shrink-0 cursor-pointer place-items-center rounded-full border-2 bg-surface-variant transition-[border-color,transform] duration-150 hover:scale-110", G(a) === null ? "m3-map-base--active border-primary" : "border-transparent"]),
|
|
1049
|
+
title: G(r).mapNoBaseLayer,
|
|
1050
|
+
"aria-label": G(r).mapNoBaseLayer,
|
|
1051
|
+
"aria-checked": G(a) === null,
|
|
1052
|
+
onClick: n[0] ||= (e) => G(o)(null)
|
|
1053
|
+
}, [E(d, {
|
|
1026
1054
|
name: "layers_clear",
|
|
1027
1055
|
size: 22,
|
|
1028
1056
|
class: "text-on-surface-variant"
|
|
1029
|
-
})], 10,
|
|
1057
|
+
})], 10, Xe)) : x("", !0)], 2));
|
|
1030
1058
|
}
|
|
1031
|
-
}),
|
|
1059
|
+
}), Qe = { class: "flex flex-col gap-2" }, $e = { class: "flex items-center gap-2 bg-primary-container/40 px-4 py-2" }, et = { class: "text-label-large text-on-primary-container" }, tt = { class: "flex flex-col px-4 py-1" }, nt = { class: "text-label-small text-on-surface-variant" }, rt = { class: "text-body-medium text-on-surface" }, it = {
|
|
1032
1060
|
key: 0,
|
|
1033
1061
|
class: "break-words"
|
|
1034
|
-
},
|
|
1062
|
+
}, at = {
|
|
1035
1063
|
key: 1,
|
|
1036
1064
|
class: "text-body-small italic text-on-surface-variant"
|
|
1037
|
-
},
|
|
1065
|
+
}, ot = /* @__PURE__ */ D({
|
|
1038
1066
|
__name: "MMapFeatureInfo",
|
|
1039
1067
|
props: { results: {} },
|
|
1040
1068
|
setup(e) {
|
|
1041
|
-
let
|
|
1042
|
-
return (
|
|
1069
|
+
let n = t();
|
|
1070
|
+
return (t, r) => (L(), S("div", Qe, [(L(!0), S(_, null, B(e.results, (e, r) => (L(), S("div", {
|
|
1043
1071
|
key: r,
|
|
1044
1072
|
class: "overflow-hidden rounded-2xl bg-surface-container"
|
|
1045
|
-
}, [
|
|
1073
|
+
}, [C("div", $e, [E(d, {
|
|
1046
1074
|
name: "layers",
|
|
1047
1075
|
size: 16,
|
|
1048
1076
|
class: "text-on-primary-container"
|
|
1049
|
-
}),
|
|
1077
|
+
}), C("span", et, U(e.layer.title), 1)]), C("dl", tt, [(L(!0), S(_, null, B(e.fields, (r) => (L(), S("div", {
|
|
1050
1078
|
key: r.key,
|
|
1051
1079
|
class: "flex flex-col gap-0.5 border-b border-outline-variant py-1.5 last:border-b-0"
|
|
1052
|
-
}, [
|
|
1080
|
+
}, [C("dt", nt, U(r.label), 1), C("dd", rt, [V(t.$slots, "value", {
|
|
1053
1081
|
field: r,
|
|
1054
1082
|
result: e
|
|
1055
|
-
}, () => [r.value ? (
|
|
1083
|
+
}, () => [r.value ? (L(), S("span", it, U(r.value), 1)) : (L(), S("span", at, U(G(n).mapNoValue), 1))])])]))), 128))])]))), 128))]));
|
|
1056
1084
|
}
|
|
1057
|
-
}),
|
|
1085
|
+
}), st = (e) => e.metadata, ct = /* @__PURE__ */ new Set([
|
|
1058
1086
|
"fill",
|
|
1059
1087
|
"line",
|
|
1060
1088
|
"circle",
|
|
1061
1089
|
"symbol",
|
|
1062
1090
|
"fill-extrusion",
|
|
1063
1091
|
"heatmap"
|
|
1064
|
-
]),
|
|
1092
|
+
]), lt = (e) => ({
|
|
1065
1093
|
title: e.name,
|
|
1066
1094
|
groups: [],
|
|
1067
1095
|
layers: e.layers.filter((e) => e.type !== "background").map((e) => ({
|
|
1068
1096
|
id: e.id,
|
|
1069
|
-
title:
|
|
1097
|
+
title: st(e)?.title ?? e.id,
|
|
1070
1098
|
listed: !0,
|
|
1071
1099
|
children: [],
|
|
1072
|
-
identify:
|
|
1100
|
+
identify: ct.has(e.type) ? {
|
|
1073
1101
|
format: {},
|
|
1074
1102
|
exclude: []
|
|
1075
1103
|
} : !1,
|
|
1076
1104
|
hover: !1
|
|
1077
1105
|
}))
|
|
1078
1106
|
});
|
|
1079
|
-
function
|
|
1107
|
+
function ut(e = {}) {
|
|
1080
1108
|
let t = e.legend ?? ((e, t) => {
|
|
1081
|
-
let n =
|
|
1109
|
+
let n = st(e)?.legend;
|
|
1082
1110
|
if (n?.show === !1) return;
|
|
1083
1111
|
if (n?.wmslegend) return n.wmslegend;
|
|
1084
1112
|
if (!t?.includes("/services/styles/")) return;
|
|
@@ -1094,7 +1122,7 @@ function ot(e = {}) {
|
|
|
1094
1122
|
title: e.alias ?? e.name
|
|
1095
1123
|
})),
|
|
1096
1124
|
layers: e.layers.filter((e) => e.type !== "background").map((e) => {
|
|
1097
|
-
let r =
|
|
1125
|
+
let r = st(e) ?? {}, i = { ...r.fields }, a = i.exclude ?? [];
|
|
1098
1126
|
delete i.exclude;
|
|
1099
1127
|
let o = {};
|
|
1100
1128
|
for (let [e, t] of Object.entries(i)) o[e] = {
|
|
@@ -1131,10 +1159,10 @@ function ot(e = {}) {
|
|
|
1131
1159
|
};
|
|
1132
1160
|
};
|
|
1133
1161
|
}
|
|
1134
|
-
function
|
|
1162
|
+
function dt(e, t) {
|
|
1135
1163
|
return t?.label ?? e.charAt(0).toUpperCase() + e.slice(1);
|
|
1136
1164
|
}
|
|
1137
|
-
function
|
|
1165
|
+
function ft(e, t) {
|
|
1138
1166
|
if (e == null || String(e).trim() === "") return "";
|
|
1139
1167
|
let n = String(e), r = typeof e == "number" ? e : Number(e);
|
|
1140
1168
|
if (t?.mask && !Number.isNaN(r)) {
|
|
@@ -1147,23 +1175,23 @@ function ct(e, t) {
|
|
|
1147
1175
|
}
|
|
1148
1176
|
return t?.prefix && (n = `${t.prefix} ${n}`), t?.suffix && (n = `${n} ${t.suffix}`), n;
|
|
1149
1177
|
}
|
|
1150
|
-
var
|
|
1178
|
+
var pt = /* @__PURE__ */ new Set([
|
|
1151
1179
|
"coordinates",
|
|
1152
1180
|
"mapCoordinates",
|
|
1153
1181
|
"layerId",
|
|
1154
1182
|
"__layerMetadata"
|
|
1155
1183
|
]);
|
|
1156
|
-
function
|
|
1184
|
+
function mt(e, t, n) {
|
|
1157
1185
|
let r = new Map((n?.layers ?? []).filter((t) => t.identify && e.getLayer(t.id)).map((e) => [e.id, e]));
|
|
1158
1186
|
if (!r.size) return [];
|
|
1159
1187
|
let i = [];
|
|
1160
1188
|
for (let n of e.queryRenderedFeatures(t, { layers: [...r.keys()] })) {
|
|
1161
1189
|
let e = r.get(n.layer.id);
|
|
1162
1190
|
if (!e || !e.identify) continue;
|
|
1163
|
-
let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !
|
|
1191
|
+
let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !pt.has(e) && !a.includes(e) && !t[e]?.hidden).map(([e, n]) => ({
|
|
1164
1192
|
key: e,
|
|
1165
|
-
label:
|
|
1166
|
-
value:
|
|
1193
|
+
label: dt(e, t[e]),
|
|
1194
|
+
value: ft(n, t[e])
|
|
1167
1195
|
}));
|
|
1168
1196
|
o.length && i.push({
|
|
1169
1197
|
layer: e,
|
|
@@ -1175,7 +1203,7 @@ function ut(e, t, n) {
|
|
|
1175
1203
|
}
|
|
1176
1204
|
//#endregion
|
|
1177
1205
|
//#region src/components/MMapIdentify.vue?vue&type=script&setup=true&lang.ts
|
|
1178
|
-
var
|
|
1206
|
+
var ht = { class: "hidden" }, gt = /* @__PURE__ */ D({
|
|
1179
1207
|
inheritAttrs: !1,
|
|
1180
1208
|
__name: "MMapIdentify",
|
|
1181
1209
|
props: {
|
|
@@ -1194,16 +1222,16 @@ var dt = { class: "hidden" }, ft = /* @__PURE__ */ E({
|
|
|
1194
1222
|
},
|
|
1195
1223
|
emits: ["identify"],
|
|
1196
1224
|
setup(e, { expose: t, emit: n }) {
|
|
1197
|
-
let r = e, i = n, { on: a, onReady: o, activeTool: s } =
|
|
1225
|
+
let r = e, i = n, { on: a, onReady: o, activeTool: s } = Y(), { model: c } = fe(), l = H([]), u = z([0, 0]), d = z(!1);
|
|
1198
1226
|
a("click", (e) => {
|
|
1199
1227
|
if (!r.enabled || s.value) return;
|
|
1200
1228
|
let t = e.target;
|
|
1201
|
-
l.value =
|
|
1229
|
+
l.value = mt(t, e.point, c.value), u.value = [e.lngLat.lng, e.lngLat.lat], d.value = l.value.length > 0, i("identify", l.value, u.value);
|
|
1202
1230
|
});
|
|
1203
1231
|
function f() {
|
|
1204
1232
|
d.value = !1;
|
|
1205
1233
|
}
|
|
1206
|
-
|
|
1234
|
+
K(() => r.enabled, (e) => {
|
|
1207
1235
|
e || f();
|
|
1208
1236
|
});
|
|
1209
1237
|
let p, m = [], h = () => {
|
|
@@ -1220,38 +1248,38 @@ var dt = { class: "hidden" }, ft = /* @__PURE__ */ E({
|
|
|
1220
1248
|
}
|
|
1221
1249
|
return o((e) => {
|
|
1222
1250
|
p = e, _();
|
|
1223
|
-
}),
|
|
1251
|
+
}), K(c, _), P(() => {
|
|
1224
1252
|
m.forEach((e) => {
|
|
1225
1253
|
p?.off("mouseenter", e, h), p?.off("mouseleave", e, g);
|
|
1226
1254
|
});
|
|
1227
|
-
}), t({ close: f }), (t, n) => (
|
|
1255
|
+
}), t({ close: f }), (t, n) => (L(), S("div", ht, [e.marker && d.value ? (L(), b(Se, {
|
|
1228
1256
|
key: 0,
|
|
1229
1257
|
"lng-lat": u.value
|
|
1230
|
-
}, null, 8, ["lng-lat"])) :
|
|
1258
|
+
}, null, 8, ["lng-lat"])) : x("", !0), e.popup && l.value.length ? (L(), b(Ce, {
|
|
1231
1259
|
key: 1,
|
|
1232
1260
|
open: d.value,
|
|
1233
1261
|
"onUpdate:open": n[0] ||= (e) => d.value = e,
|
|
1234
1262
|
"lng-lat": u.value,
|
|
1235
1263
|
"max-width": "360px",
|
|
1236
|
-
offset: e.marker ?
|
|
1264
|
+
offset: e.marker ? G(be) : void 0
|
|
1237
1265
|
}, {
|
|
1238
|
-
default:
|
|
1266
|
+
default: q(() => [C("div", j({ class: "max-h-80 overflow-y-auto" }, t.$attrs), [V(t.$slots, "default", {
|
|
1239
1267
|
results: l.value,
|
|
1240
1268
|
lngLat: u.value,
|
|
1241
1269
|
close: f
|
|
1242
|
-
}, () => [
|
|
1270
|
+
}, () => [E(ot, { results: l.value }, null, 8, ["results"])])], 16)]),
|
|
1243
1271
|
_: 3
|
|
1244
1272
|
}, 8, [
|
|
1245
1273
|
"open",
|
|
1246
1274
|
"lng-lat",
|
|
1247
1275
|
"offset"
|
|
1248
|
-
])) :
|
|
1276
|
+
])) : x("", !0)]));
|
|
1249
1277
|
}
|
|
1250
|
-
}),
|
|
1278
|
+
}), _t = { class: "hidden" }, vt = [
|
|
1251
1279
|
"title",
|
|
1252
1280
|
"aria-label",
|
|
1253
1281
|
"aria-pressed"
|
|
1254
|
-
],
|
|
1282
|
+
], yt = { class: "-mx-4 -mt-3 mb-1 bg-primary-container px-3 py-1.5 text-label-medium text-on-primary-container" }, bt = { class: "flex flex-col" }, xt = { class: "text-label-small text-on-surface-variant" }, St = { class: "text-body-small text-on-surface" }, Ct = /* @__PURE__ */ D({
|
|
1255
1283
|
__name: "MMapHover",
|
|
1256
1284
|
props: {
|
|
1257
1285
|
modelValue: {
|
|
@@ -1264,83 +1292,83 @@ var dt = { class: "hidden" }, ft = /* @__PURE__ */ E({
|
|
|
1264
1292
|
}
|
|
1265
1293
|
},
|
|
1266
1294
|
emits: ["update:modelValue"],
|
|
1267
|
-
setup(e, { emit:
|
|
1268
|
-
let
|
|
1269
|
-
function
|
|
1270
|
-
let t = e.features?.[0], n =
|
|
1295
|
+
setup(e, { emit: n }) {
|
|
1296
|
+
let r = e, i = n, a = t(), { onReady: o } = Y(), { model: s } = fe(), c = y(() => (s.value?.layers ?? []).filter((e) => e.hover && e.hover.fields.length)), l = H(null), u = z([0, 0]), f = z(!1), p, m = [];
|
|
1297
|
+
function h(e) {
|
|
1298
|
+
let t = e.features?.[0], n = c.value.find((e) => e.id === t?.layer.id);
|
|
1271
1299
|
if (!t || !n || !n.hover) return;
|
|
1272
1300
|
let r = t.properties ?? {};
|
|
1273
|
-
|
|
1301
|
+
l.value = {
|
|
1274
1302
|
layer: n,
|
|
1275
1303
|
fields: n.hover.fields.map((e) => ({
|
|
1276
1304
|
key: e.key,
|
|
1277
|
-
label:
|
|
1278
|
-
value:
|
|
1305
|
+
label: dt(e.key, e),
|
|
1306
|
+
value: ft(r[e.key], e)
|
|
1279
1307
|
})).filter((e) => e.value)
|
|
1280
|
-
},
|
|
1308
|
+
}, u.value = [e.lngLat.lng, e.lngLat.lat], f.value = !0;
|
|
1281
1309
|
}
|
|
1282
|
-
function
|
|
1283
|
-
|
|
1310
|
+
function g() {
|
|
1311
|
+
f.value = !1;
|
|
1284
1312
|
}
|
|
1285
|
-
function
|
|
1286
|
-
if (
|
|
1287
|
-
for (let e of
|
|
1288
|
-
|
|
1289
|
-
for (let e of
|
|
1290
|
-
|
|
1313
|
+
function v() {
|
|
1314
|
+
if (p) {
|
|
1315
|
+
for (let e of m) p.off("mousemove", e, h), p.off("mouseleave", e, g);
|
|
1316
|
+
m = r.modelValue ? c.value.map((e) => e.id) : [];
|
|
1317
|
+
for (let e of m) p.on("mousemove", e, h), p.on("mouseleave", e, g);
|
|
1318
|
+
r.modelValue || (f.value = !1);
|
|
1291
1319
|
}
|
|
1292
1320
|
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
}),
|
|
1296
|
-
for (let e of
|
|
1321
|
+
o((e) => {
|
|
1322
|
+
p = e, v();
|
|
1323
|
+
}), K([() => r.modelValue, c], v), P(() => {
|
|
1324
|
+
for (let e of m) p?.off("mousemove", e, h), p?.off("mouseleave", e, g);
|
|
1297
1325
|
});
|
|
1298
|
-
let w =
|
|
1299
|
-
return (t, n) => (
|
|
1326
|
+
let w = y(() => r.control === !0 ? "top-right" : r.control || "top-right");
|
|
1327
|
+
return (t, n) => (L(), S("div", _t, [e.control && c.value.length ? (L(), b(oe, {
|
|
1300
1328
|
key: 0,
|
|
1301
1329
|
position: w.value
|
|
1302
1330
|
}, {
|
|
1303
|
-
default:
|
|
1331
|
+
default: q(() => [C("button", {
|
|
1304
1332
|
type: "button",
|
|
1305
1333
|
class: "grid place-items-center",
|
|
1306
|
-
title:
|
|
1307
|
-
"aria-label":
|
|
1334
|
+
title: G(a).mapHoverInfo,
|
|
1335
|
+
"aria-label": G(a).mapHoverInfo,
|
|
1308
1336
|
"aria-pressed": e.modelValue,
|
|
1309
|
-
onClick: n[0] ||= (t) =>
|
|
1310
|
-
}, [
|
|
1337
|
+
onClick: n[0] ||= (t) => i("update:modelValue", !e.modelValue)
|
|
1338
|
+
}, [E(d, {
|
|
1311
1339
|
name: "ads_click",
|
|
1312
1340
|
size: 20
|
|
1313
|
-
})], 8,
|
|
1341
|
+
})], 8, vt)]),
|
|
1314
1342
|
_: 1
|
|
1315
|
-
}, 8, ["position"])) :
|
|
1343
|
+
}, 8, ["position"])) : x("", !0), l.value ? (L(), b(Ce, {
|
|
1316
1344
|
key: 1,
|
|
1317
|
-
open:
|
|
1318
|
-
"onUpdate:open": n[1] ||= (e) =>
|
|
1319
|
-
"lng-lat":
|
|
1345
|
+
open: f.value,
|
|
1346
|
+
"onUpdate:open": n[1] ||= (e) => f.value = e,
|
|
1347
|
+
"lng-lat": u.value,
|
|
1320
1348
|
"close-button": !1,
|
|
1321
1349
|
"close-on-click": !1,
|
|
1322
1350
|
offset: 12,
|
|
1323
1351
|
"max-width": "280px",
|
|
1324
1352
|
class: "m3-map-hover"
|
|
1325
1353
|
}, {
|
|
1326
|
-
default:
|
|
1354
|
+
default: q(() => [C("p", yt, U(l.value.layer.title), 1), C("dl", bt, [(L(!0), S(_, null, B(l.value.fields, (e) => (L(), S("div", {
|
|
1327
1355
|
key: e.key,
|
|
1328
1356
|
class: "border-b border-outline-variant py-1 last:border-b-0"
|
|
1329
|
-
}, [
|
|
1357
|
+
}, [C("dt", xt, U(e.label), 1), C("dd", St, U(e.value), 1)]))), 128))])]),
|
|
1330
1358
|
_: 1
|
|
1331
|
-
}, 8, ["open", "lng-lat"])) :
|
|
1359
|
+
}, 8, ["open", "lng-lat"])) : x("", !0)]));
|
|
1332
1360
|
}
|
|
1333
|
-
}),
|
|
1334
|
-
function
|
|
1361
|
+
}), wt = 6371008.8, $ = Math.PI / 180;
|
|
1362
|
+
function Tt(e, t) {
|
|
1335
1363
|
let n = (t[1] - e[1]) * $, r = (t[0] - e[0]) * $, i = Math.sin(n / 2) ** 2 + Math.cos(e[1] * $) * Math.cos(t[1] * $) * Math.sin(r / 2) ** 2;
|
|
1336
|
-
return 2 *
|
|
1364
|
+
return 2 * wt * Math.asin(Math.min(1, Math.sqrt(i)));
|
|
1337
1365
|
}
|
|
1338
|
-
function
|
|
1366
|
+
function Et(e) {
|
|
1339
1367
|
let t = 0;
|
|
1340
|
-
for (let n = 1; n < e.length; n++) t +=
|
|
1368
|
+
for (let n = 1; n < e.length; n++) t += Tt(e[n - 1], e[n]);
|
|
1341
1369
|
return t;
|
|
1342
1370
|
}
|
|
1343
|
-
function
|
|
1371
|
+
function Dt(e, t) {
|
|
1344
1372
|
let [n, r, i, a] = [
|
|
1345
1373
|
e[0] * $,
|
|
1346
1374
|
e[1] * $,
|
|
@@ -1349,22 +1377,22 @@ function Ct(e, t) {
|
|
|
1349
1377
|
], o = Math.cos(a) * Math.cos(i - n), s = Math.cos(a) * Math.sin(i - n), c = Math.atan2(Math.sin(r) + Math.sin(a), Math.sqrt((Math.cos(r) + o) ** 2 + s ** 2));
|
|
1350
1378
|
return [(n + Math.atan2(s, Math.cos(r) + o)) / $, c / $];
|
|
1351
1379
|
}
|
|
1352
|
-
function
|
|
1353
|
-
let t =
|
|
1380
|
+
function Ot(e) {
|
|
1381
|
+
let t = kt(e), n = t.length - 1;
|
|
1354
1382
|
if (n <= 2) return 0;
|
|
1355
1383
|
let r = 0;
|
|
1356
1384
|
for (let e = 0; e < n; e++) {
|
|
1357
1385
|
let i = t[e], a = t[e + 1 === n ? 0 : e + 1], o = t[e + 2 >= n ? (e + 2) % n : e + 2];
|
|
1358
1386
|
r += (o[0] - i[0]) * $ * Math.sin(a[1] * $);
|
|
1359
1387
|
}
|
|
1360
|
-
return Math.abs(r *
|
|
1388
|
+
return Math.abs(r * wt * wt / 2);
|
|
1361
1389
|
}
|
|
1362
|
-
function
|
|
1390
|
+
function kt(e) {
|
|
1363
1391
|
let t = e[0], n = e[e.length - 1];
|
|
1364
1392
|
return t && n && (t[0] !== n[0] || t[1] !== n[1]) ? [...e, t] : e;
|
|
1365
1393
|
}
|
|
1366
|
-
function
|
|
1367
|
-
let t =
|
|
1394
|
+
function At(e) {
|
|
1395
|
+
let t = kt(e), n = 0, r = 0, i = 0;
|
|
1368
1396
|
for (let e = 0; e < t.length - 1; e++) {
|
|
1369
1397
|
let [a, o] = t[e], [s, c] = t[e + 1], l = a * c - s * o;
|
|
1370
1398
|
n += l, r += (a + s) * l, i += (o + c) * l;
|
|
@@ -1377,11 +1405,11 @@ function Et(e) {
|
|
|
1377
1405
|
}
|
|
1378
1406
|
//#endregion
|
|
1379
1407
|
//#region src/components/MMapMeasure.vue?vue&type=script&setup=true&lang.ts
|
|
1380
|
-
var
|
|
1408
|
+
var jt = { class: "hidden" }, Mt = ["title", "aria-pressed"], Nt = ["title", "aria-pressed"], Pt = ["title", "disabled"], Ft = [
|
|
1381
1409
|
"aria-label",
|
|
1382
1410
|
"title",
|
|
1383
1411
|
"onClick"
|
|
1384
|
-
],
|
|
1412
|
+
], It = /* @__PURE__ */ D({
|
|
1385
1413
|
__name: "MMapMeasure",
|
|
1386
1414
|
props: {
|
|
1387
1415
|
modelValue: { default: null },
|
|
@@ -1391,15 +1419,15 @@ var Dt = { class: "hidden" }, Ot = ["title", "aria-pressed"], kt = ["title", "ar
|
|
|
1391
1419
|
}
|
|
1392
1420
|
},
|
|
1393
1421
|
emits: ["update:modelValue", "change"],
|
|
1394
|
-
setup(
|
|
1395
|
-
let
|
|
1396
|
-
done: `${
|
|
1397
|
-
draft: `${
|
|
1398
|
-
handles: `${
|
|
1399
|
-
},
|
|
1422
|
+
setup(n, { expose: r, emit: i }) {
|
|
1423
|
+
let o = n, s = i, c = t(), { onReady: l, styleVersion: u, activeTool: f } = Y(), p = e(["primary", "surface"]), m = `m3-measure-${te()}`, h = {
|
|
1424
|
+
done: `${m}-done`,
|
|
1425
|
+
draft: `${m}-draft`,
|
|
1426
|
+
handles: `${m}-handles`
|
|
1427
|
+
}, g = `${h.handles}-vertex`, v = `${h.handles}-midpoint`, w = [], D = [], O = null, k = !1, A = null, j = 0, N, F = z(null), I = z(0), R = H([]), ee = () => typeof document < "u" && document.documentElement.lang || void 0, V = (e, t) => new Intl.NumberFormat(ee(), {
|
|
1400
1428
|
minimumFractionDigits: t,
|
|
1401
1429
|
maximumFractionDigits: t
|
|
1402
|
-
}).format(e),
|
|
1430
|
+
}).format(e), W = (e) => e === 0 ? "" : e < 1e3 ? `${V(Math.round(e), 0)} m` : `${V(e / 1e3, 2)} km`, ne = (e) => e >= 1e6 ? `${V(e / 1e6, 2)} km²` : e >= 1e4 ? `${V(e / 1e4, 2)} ha` : `${V(Math.round(e), 0)} m²`, re = (e, t = {}) => ({
|
|
1403
1431
|
type: "Feature",
|
|
1404
1432
|
geometry: {
|
|
1405
1433
|
type: "Point",
|
|
@@ -1407,11 +1435,11 @@ var Dt = { class: "hidden" }, Ot = ["title", "aria-pressed"], kt = ["title", "ar
|
|
|
1407
1435
|
},
|
|
1408
1436
|
properties: t
|
|
1409
1437
|
});
|
|
1410
|
-
function
|
|
1411
|
-
let i = e.map((e) =>
|
|
1438
|
+
function ie(e, t, n, r) {
|
|
1439
|
+
let i = e.map((e) => re(e)), a = [];
|
|
1412
1440
|
if (e.length < 2) return {
|
|
1413
1441
|
features: i,
|
|
1414
|
-
labels:
|
|
1442
|
+
labels: a
|
|
1415
1443
|
};
|
|
1416
1444
|
i.push({
|
|
1417
1445
|
type: "Feature",
|
|
@@ -1421,26 +1449,26 @@ var Dt = { class: "hidden" }, Ot = ["title", "aria-pressed"], kt = ["title", "ar
|
|
|
1421
1449
|
},
|
|
1422
1450
|
properties: {}
|
|
1423
1451
|
});
|
|
1424
|
-
let
|
|
1452
|
+
let o = (e) => {
|
|
1425
1453
|
for (let t = 0; t < e.length - 1; t++) {
|
|
1426
|
-
let r =
|
|
1427
|
-
r &&
|
|
1454
|
+
let r = W(Tt(e[t], e[t + 1]));
|
|
1455
|
+
r && a.push({
|
|
1428
1456
|
key: `${n}-s${t}`,
|
|
1429
|
-
at:
|
|
1457
|
+
at: Dt(e[t], e[t + 1]),
|
|
1430
1458
|
text: r,
|
|
1431
1459
|
kind: "segment"
|
|
1432
1460
|
});
|
|
1433
1461
|
}
|
|
1434
1462
|
};
|
|
1435
|
-
if (t === "distance")
|
|
1463
|
+
if (t === "distance") o(e), a.push({
|
|
1436
1464
|
key: `${n}-t`,
|
|
1437
1465
|
at: e[e.length - 1],
|
|
1438
|
-
text: `${
|
|
1466
|
+
text: `${c.mapTotal}: ${W(Et(e))}`,
|
|
1439
1467
|
kind: "total",
|
|
1440
1468
|
m: r
|
|
1441
1469
|
});
|
|
1442
1470
|
else if (e.length >= 3) {
|
|
1443
|
-
let t =
|
|
1471
|
+
let t = kt(e);
|
|
1444
1472
|
i.push({
|
|
1445
1473
|
type: "Feature",
|
|
1446
1474
|
geometry: {
|
|
@@ -1448,66 +1476,66 @@ var Dt = { class: "hidden" }, Ot = ["title", "aria-pressed"], kt = ["title", "ar
|
|
|
1448
1476
|
coordinates: [t]
|
|
1449
1477
|
},
|
|
1450
1478
|
properties: {}
|
|
1451
|
-
}),
|
|
1479
|
+
}), o(t), a.push({
|
|
1452
1480
|
key: `${n}-a`,
|
|
1453
|
-
at:
|
|
1454
|
-
text: ne(
|
|
1481
|
+
at: At(t),
|
|
1482
|
+
text: ne(Ot(t)),
|
|
1455
1483
|
kind: "area",
|
|
1456
1484
|
m: r
|
|
1457
1485
|
});
|
|
1458
|
-
} else
|
|
1486
|
+
} else a.push({
|
|
1459
1487
|
key: `${n}-t`,
|
|
1460
1488
|
at: e[e.length - 1],
|
|
1461
|
-
text:
|
|
1489
|
+
text: W(Et(e)),
|
|
1462
1490
|
kind: "total",
|
|
1463
1491
|
m: r
|
|
1464
1492
|
});
|
|
1465
1493
|
return {
|
|
1466
1494
|
features: i,
|
|
1467
|
-
labels:
|
|
1495
|
+
labels: a
|
|
1468
1496
|
};
|
|
1469
1497
|
}
|
|
1470
|
-
let
|
|
1498
|
+
let ae = (e) => ({
|
|
1471
1499
|
type: "FeatureCollection",
|
|
1472
1500
|
features: e
|
|
1473
|
-
}),
|
|
1474
|
-
function
|
|
1475
|
-
if (!
|
|
1476
|
-
let e =
|
|
1501
|
+
}), X = (e, t) => (N?.getSource(e))?.setData(ae(t));
|
|
1502
|
+
function Z() {
|
|
1503
|
+
if (!N) return;
|
|
1504
|
+
let e = w.map((e, t) => ie(e.points, e.mode, `m${t}`, t)), t = F.value && D.length ? ie(O ? [...D, O] : D, F.value, "draft") : {
|
|
1477
1505
|
features: [],
|
|
1478
1506
|
labels: []
|
|
1479
1507
|
};
|
|
1480
|
-
|
|
1508
|
+
X(h.done, e.flatMap((e) => e.features)), X(h.draft, t.features);
|
|
1481
1509
|
let n = [];
|
|
1482
|
-
|
|
1483
|
-
(e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(
|
|
1510
|
+
F.value || w.forEach((e, t) => {
|
|
1511
|
+
(e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(re(e, {
|
|
1484
1512
|
handle: "vertex",
|
|
1485
1513
|
m: t,
|
|
1486
1514
|
v: r
|
|
1487
1515
|
})));
|
|
1488
|
-
for (let r = 0; r < e.points.length - 1; r++) n.push(
|
|
1516
|
+
for (let r = 0; r < e.points.length - 1; r++) n.push(re(Dt(e.points[r], e.points[r + 1]), {
|
|
1489
1517
|
handle: "midpoint",
|
|
1490
1518
|
m: t,
|
|
1491
1519
|
after: r
|
|
1492
1520
|
}));
|
|
1493
|
-
}),
|
|
1521
|
+
}), X(h.handles, n), R.value = [...e.flatMap((e) => e.labels), ...t.labels];
|
|
1494
1522
|
}
|
|
1495
|
-
function
|
|
1496
|
-
|
|
1523
|
+
function se() {
|
|
1524
|
+
I.value = w.length, s("change", w.map((e) => ({
|
|
1497
1525
|
mode: e.mode,
|
|
1498
1526
|
points: e.points.map((e) => [...e]),
|
|
1499
1527
|
closed: e.closed,
|
|
1500
|
-
length:
|
|
1501
|
-
...e.mode === "area" || e.closed ? { area:
|
|
1528
|
+
length: Et(e.points),
|
|
1529
|
+
...e.mode === "area" || e.closed ? { area: Ot(e.points) } : {}
|
|
1502
1530
|
})));
|
|
1503
1531
|
}
|
|
1504
|
-
let
|
|
1532
|
+
let ce = (e) => [
|
|
1505
1533
|
"==",
|
|
1506
1534
|
["geometry-type"],
|
|
1507
1535
|
e
|
|
1508
1536
|
];
|
|
1509
|
-
function
|
|
1510
|
-
let { primary: e, surface: t } =
|
|
1537
|
+
function le() {
|
|
1538
|
+
let { primary: e, surface: t } = p.value;
|
|
1511
1539
|
return {
|
|
1512
1540
|
fill: { "fill-color": e },
|
|
1513
1541
|
line: { "line-color": e },
|
|
@@ -1517,20 +1545,20 @@ var Dt = { class: "hidden" }, Ot = ["title", "aria-pressed"], kt = ["title", "ar
|
|
|
1517
1545
|
}
|
|
1518
1546
|
};
|
|
1519
1547
|
}
|
|
1520
|
-
function
|
|
1521
|
-
if (!
|
|
1522
|
-
for (let e of Object.values(
|
|
1548
|
+
function ue() {
|
|
1549
|
+
if (!N) return;
|
|
1550
|
+
for (let e of Object.values(h)) N.getSource(e) || N.addSource(e, {
|
|
1523
1551
|
type: "geojson",
|
|
1524
|
-
data:
|
|
1552
|
+
data: ae([])
|
|
1525
1553
|
});
|
|
1526
|
-
let e =
|
|
1527
|
-
|
|
1554
|
+
let e = le(), t = (e) => {
|
|
1555
|
+
N.getLayer(e.id) || N.addLayer(e);
|
|
1528
1556
|
};
|
|
1529
|
-
for (let [n, r] of [[
|
|
1557
|
+
for (let [n, r] of [[h.done, !1], [h.draft, !0]]) t({
|
|
1530
1558
|
id: `${n}-fill`,
|
|
1531
1559
|
type: "fill",
|
|
1532
1560
|
source: n,
|
|
1533
|
-
filter:
|
|
1561
|
+
filter: ce("Polygon"),
|
|
1534
1562
|
paint: {
|
|
1535
1563
|
...e.fill,
|
|
1536
1564
|
"fill-opacity": r ? .15 : .2
|
|
@@ -1553,7 +1581,7 @@ var Dt = { class: "hidden" }, Ot = ["title", "aria-pressed"], kt = ["title", "ar
|
|
|
1553
1581
|
id: `${n}-points`,
|
|
1554
1582
|
type: "circle",
|
|
1555
1583
|
source: n,
|
|
1556
|
-
filter:
|
|
1584
|
+
filter: ce("Point"),
|
|
1557
1585
|
paint: {
|
|
1558
1586
|
...e.vertices,
|
|
1559
1587
|
"circle-radius": 5,
|
|
@@ -1561,9 +1589,9 @@ var Dt = { class: "hidden" }, Ot = ["title", "aria-pressed"], kt = ["title", "ar
|
|
|
1561
1589
|
}
|
|
1562
1590
|
});
|
|
1563
1591
|
t({
|
|
1564
|
-
id:
|
|
1592
|
+
id: v,
|
|
1565
1593
|
type: "circle",
|
|
1566
|
-
source:
|
|
1594
|
+
source: h.handles,
|
|
1567
1595
|
filter: [
|
|
1568
1596
|
"==",
|
|
1569
1597
|
["get", "handle"],
|
|
@@ -1576,9 +1604,9 @@ var Dt = { class: "hidden" }, Ot = ["title", "aria-pressed"], kt = ["title", "ar
|
|
|
1576
1604
|
"circle-opacity": .7
|
|
1577
1605
|
}
|
|
1578
1606
|
}), t({
|
|
1579
|
-
id:
|
|
1607
|
+
id: g,
|
|
1580
1608
|
type: "circle",
|
|
1581
|
-
source:
|
|
1609
|
+
source: h.handles,
|
|
1582
1610
|
filter: [
|
|
1583
1611
|
"==",
|
|
1584
1612
|
["get", "handle"],
|
|
@@ -1591,197 +1619,198 @@ var Dt = { class: "hidden" }, Ot = ["title", "aria-pressed"], kt = ["title", "ar
|
|
|
1591
1619
|
}
|
|
1592
1620
|
});
|
|
1593
1621
|
}
|
|
1594
|
-
|
|
1595
|
-
if (!
|
|
1596
|
-
let e =
|
|
1597
|
-
if (
|
|
1622
|
+
K(p, () => {
|
|
1623
|
+
if (!N) return;
|
|
1624
|
+
let e = le(), t = (e, t) => {
|
|
1625
|
+
if (N.getLayer(e)) for (let [n, r] of Object.entries(t)) N.setPaintProperty(e, n, r);
|
|
1598
1626
|
};
|
|
1599
|
-
for (let n of [
|
|
1600
|
-
t(
|
|
1627
|
+
for (let n of [h.done, h.draft]) t(`${n}-fill`, e.fill), t(`${n}-line`, e.line), t(`${n}-points`, e.vertices);
|
|
1628
|
+
t(v, e.vertices), t(g, e.vertices);
|
|
1601
1629
|
});
|
|
1602
|
-
let
|
|
1603
|
-
function
|
|
1604
|
-
if (
|
|
1605
|
-
let t =
|
|
1630
|
+
let de = (e) => [e.lngLat.lng, e.lngLat.lat];
|
|
1631
|
+
function fe(e) {
|
|
1632
|
+
if (D.length >= 2) {
|
|
1633
|
+
let t = N.project(D[0]);
|
|
1606
1634
|
if (Math.hypot(t.x - e.point.x, t.y - e.point.y) < 20) {
|
|
1607
|
-
|
|
1635
|
+
k = !0, Q();
|
|
1608
1636
|
return;
|
|
1609
1637
|
}
|
|
1610
1638
|
}
|
|
1611
|
-
|
|
1639
|
+
D.push(de(e)), Z();
|
|
1612
1640
|
}
|
|
1613
|
-
function
|
|
1614
|
-
|
|
1615
|
-
|
|
1641
|
+
function pe(e) {
|
|
1642
|
+
O = de(e), !j && (j = requestAnimationFrame(() => {
|
|
1643
|
+
j = 0, Z();
|
|
1616
1644
|
}));
|
|
1617
1645
|
}
|
|
1618
|
-
function
|
|
1619
|
-
if (e.preventDefault(),
|
|
1620
|
-
let t =
|
|
1621
|
-
Math.hypot(t.x - n.x, t.y - n.y) < 10 &&
|
|
1622
|
-
}
|
|
1623
|
-
function pe(e) {
|
|
1624
|
-
(e.key === "Escape" || e.key === "Enter") && Q(e.key === "Escape");
|
|
1646
|
+
function me(e) {
|
|
1647
|
+
if (e.preventDefault(), D.length < 2) return;
|
|
1648
|
+
let t = N.project(D[D.length - 1]), n = N.project(D[D.length - 2]);
|
|
1649
|
+
Math.hypot(t.x - n.x, t.y - n.y) < 10 && D.pop(), Q();
|
|
1625
1650
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
M.value && document.fullscreenElement && me()?.lock && me().lock(["Escape"]).then(() => {
|
|
1629
|
-
he = !0;
|
|
1630
|
-
}, () => {});
|
|
1651
|
+
function he(e) {
|
|
1652
|
+
e.key === "Enter" && Q();
|
|
1631
1653
|
}
|
|
1654
|
+
a(() => !!F.value, () => Q(!0));
|
|
1655
|
+
let ge = () => typeof navigator < "u" ? navigator.keyboard : void 0, _e = !1;
|
|
1632
1656
|
function ve() {
|
|
1633
|
-
|
|
1657
|
+
F.value && document.fullscreenElement && ge()?.lock && ge().lock(["Escape"]).then(() => {
|
|
1658
|
+
_e = !0;
|
|
1659
|
+
}, () => {});
|
|
1634
1660
|
}
|
|
1635
1661
|
function ye() {
|
|
1662
|
+
F.value || (_e && ge()?.unlock?.(), _e = !1);
|
|
1663
|
+
}
|
|
1664
|
+
function be() {
|
|
1636
1665
|
let e, t = () => {
|
|
1637
|
-
document.removeEventListener("keyup", n, !0), clearTimeout(e), setTimeout(
|
|
1666
|
+
document.removeEventListener("keyup", n, !0), clearTimeout(e), setTimeout(ye);
|
|
1638
1667
|
}, n = (e) => {
|
|
1639
1668
|
e.key === "Escape" && t();
|
|
1640
1669
|
};
|
|
1641
1670
|
document.addEventListener("keyup", n, !0), e = setTimeout(t, 1500);
|
|
1642
1671
|
}
|
|
1643
1672
|
function xe(e) {
|
|
1644
|
-
if (
|
|
1645
|
-
if (
|
|
1646
|
-
|
|
1673
|
+
if (N) {
|
|
1674
|
+
if (F.value === e) return Q();
|
|
1675
|
+
F.value && Q(), F.value = e, f.value = "measure", D = [], O = null, N.getCanvas().style.cursor = "crosshair", N.doubleClickZoom.disable(), N.on("click", fe), N.on("mousemove", pe), N.on("dblclick", me), document.addEventListener("keydown", he), document.addEventListener("fullscreenchange", ve), ve(), Z(), o.modelValue !== e && s("update:modelValue", e);
|
|
1647
1676
|
}
|
|
1648
1677
|
}
|
|
1649
1678
|
function Q(e = !1) {
|
|
1650
|
-
if (!
|
|
1651
|
-
cancelAnimationFrame(
|
|
1652
|
-
let t =
|
|
1653
|
-
|
|
1654
|
-
mode:
|
|
1655
|
-
points: t ? [...
|
|
1679
|
+
if (!N || !F.value) return;
|
|
1680
|
+
cancelAnimationFrame(j), j = 0;
|
|
1681
|
+
let t = D.length >= 3 && (k || F.value === "area");
|
|
1682
|
+
D.length >= 2 && w.push({
|
|
1683
|
+
mode: F.value,
|
|
1684
|
+
points: t ? [...D, [...D[0]]] : D,
|
|
1656
1685
|
closed: t
|
|
1657
|
-
}),
|
|
1686
|
+
}), D = [], O = null, k = !1, F.value = null, f.value === "measure" && (f.value = null), N.getCanvas().style.cursor = "", N.doubleClickZoom.enable(), N.off("click", fe), N.off("mousemove", pe), N.off("dblclick", me), document.removeEventListener("keydown", he), document.removeEventListener("fullscreenchange", ve), e && _e ? be() : ye(), Z(), se(), o.modelValue !== null && s("update:modelValue", null);
|
|
1658
1687
|
}
|
|
1659
|
-
function
|
|
1660
|
-
|
|
1688
|
+
function Ce(e) {
|
|
1689
|
+
w[e] && (w.splice(e, 1), Z(), se());
|
|
1661
1690
|
}
|
|
1662
|
-
function
|
|
1663
|
-
|
|
1691
|
+
function we() {
|
|
1692
|
+
F.value && Q(), w.length = 0, Z(), se();
|
|
1664
1693
|
}
|
|
1665
|
-
function
|
|
1694
|
+
function Te(e) {
|
|
1666
1695
|
let t = e.features?.[0];
|
|
1667
|
-
if (!t ||
|
|
1696
|
+
if (!t || F.value || !N) return;
|
|
1668
1697
|
e.preventDefault();
|
|
1669
|
-
let n = t.properties.m, r =
|
|
1698
|
+
let n = t.properties.m, r = w[n];
|
|
1670
1699
|
if (!r) return;
|
|
1671
1700
|
let i = t.properties.v;
|
|
1672
|
-
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0,
|
|
1701
|
+
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0, de(e))), A = {
|
|
1673
1702
|
m: n,
|
|
1674
1703
|
v: i
|
|
1675
|
-
},
|
|
1704
|
+
}, f.value = "measure", N.getCanvas().style.cursor = "grabbing";
|
|
1676
1705
|
let a = e.type === "touchstart";
|
|
1677
|
-
a &&
|
|
1706
|
+
a && N.dragPan.disable(), N.on(a ? "touchmove" : "mousemove", Ee), N.once(a ? "touchend" : "mouseup", De), Z();
|
|
1678
1707
|
}
|
|
1679
|
-
function
|
|
1680
|
-
if (!
|
|
1681
|
-
let t =
|
|
1708
|
+
function Ee(e) {
|
|
1709
|
+
if (!A) return;
|
|
1710
|
+
let t = w[A.m];
|
|
1682
1711
|
if (!t) return;
|
|
1683
|
-
let n =
|
|
1684
|
-
t.points[
|
|
1712
|
+
let n = de(e);
|
|
1713
|
+
t.points[A.v] = n, t.closed && A.v === 0 && (t.points[t.points.length - 1] = n), Z();
|
|
1685
1714
|
}
|
|
1686
|
-
function
|
|
1687
|
-
|
|
1688
|
-
|
|
1715
|
+
function De() {
|
|
1716
|
+
N && (A = null, N.off("mousemove", Ee), N.off("touchmove", Ee), N.dragPan.enable(), N.getCanvas().style.cursor = "", se(), setTimeout(() => {
|
|
1717
|
+
f.value === "measure" && !F.value && (f.value = null);
|
|
1689
1718
|
}));
|
|
1690
1719
|
}
|
|
1691
|
-
let
|
|
1692
|
-
|
|
1693
|
-
},
|
|
1694
|
-
|
|
1720
|
+
let Oe = () => {
|
|
1721
|
+
N && !A && !F.value && (N.getCanvas().style.cursor = "grab");
|
|
1722
|
+
}, ke = () => {
|
|
1723
|
+
N && !A && !F.value && (N.getCanvas().style.cursor = "");
|
|
1695
1724
|
};
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
for (let t of [
|
|
1699
|
-
|
|
1700
|
-
}),
|
|
1701
|
-
|
|
1702
|
-
}),
|
|
1703
|
-
e && e !==
|
|
1704
|
-
}),
|
|
1705
|
-
if (!
|
|
1706
|
-
|
|
1707
|
-
for (let e of [
|
|
1725
|
+
l((e) => {
|
|
1726
|
+
N = e, ue();
|
|
1727
|
+
for (let t of [g, v]) e.on("mousedown", t, Te), e.on("touchstart", t, Te), e.on("mouseenter", t, Oe), e.on("mouseleave", t, ke);
|
|
1728
|
+
o.modelValue && xe(o.modelValue);
|
|
1729
|
+
}), K(u, () => {
|
|
1730
|
+
ue(), Z();
|
|
1731
|
+
}), K(() => o.modelValue, (e) => {
|
|
1732
|
+
e && e !== F.value ? xe(e) : !e && F.value && Q();
|
|
1733
|
+
}), P(() => {
|
|
1734
|
+
if (!N) return;
|
|
1735
|
+
F.value && Q();
|
|
1736
|
+
for (let e of [g, v]) N.off("mousedown", e, Te), N.off("touchstart", e, Te), N.off("mouseenter", e, Oe), N.off("mouseleave", e, ke);
|
|
1708
1737
|
let e = [
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
...[
|
|
1738
|
+
g,
|
|
1739
|
+
v,
|
|
1740
|
+
...[h.done, h.draft].flatMap((e) => [
|
|
1712
1741
|
`${e}-points`,
|
|
1713
1742
|
`${e}-line`,
|
|
1714
1743
|
`${e}-fill`
|
|
1715
1744
|
])
|
|
1716
1745
|
];
|
|
1717
|
-
for (let t of e)
|
|
1718
|
-
for (let e of Object.values(
|
|
1746
|
+
for (let t of e) N.getLayer(t) && N.removeLayer(t);
|
|
1747
|
+
for (let e of Object.values(h)) N.getSource(e) && N.removeSource(e);
|
|
1719
1748
|
});
|
|
1720
|
-
let
|
|
1721
|
-
return
|
|
1749
|
+
let Ae = y(() => o.control === !0 ? "top-right" : o.control || "top-right");
|
|
1750
|
+
return r({
|
|
1722
1751
|
start: xe,
|
|
1723
1752
|
finish: Q,
|
|
1724
|
-
clear:
|
|
1725
|
-
remove:
|
|
1726
|
-
}), (
|
|
1753
|
+
clear: we,
|
|
1754
|
+
remove: Ce
|
|
1755
|
+
}), (e, t) => (L(), S("div", jt, [n.control ? (L(), b(oe, {
|
|
1727
1756
|
key: 0,
|
|
1728
|
-
position:
|
|
1757
|
+
position: Ae.value
|
|
1729
1758
|
}, {
|
|
1730
|
-
default:
|
|
1731
|
-
|
|
1759
|
+
default: q(() => [
|
|
1760
|
+
C("button", {
|
|
1732
1761
|
type: "button",
|
|
1733
1762
|
class: "grid place-items-center",
|
|
1734
|
-
title:
|
|
1735
|
-
"aria-pressed":
|
|
1736
|
-
onClick:
|
|
1737
|
-
}, [
|
|
1763
|
+
title: G(c).mapMeasureDistance,
|
|
1764
|
+
"aria-pressed": F.value === "distance",
|
|
1765
|
+
onClick: t[0] ||= (e) => xe("distance")
|
|
1766
|
+
}, [E(d, {
|
|
1738
1767
|
name: "straighten",
|
|
1739
1768
|
size: 20
|
|
1740
|
-
})], 8,
|
|
1741
|
-
|
|
1769
|
+
})], 8, Mt),
|
|
1770
|
+
C("button", {
|
|
1742
1771
|
type: "button",
|
|
1743
1772
|
class: "grid place-items-center",
|
|
1744
|
-
title:
|
|
1745
|
-
"aria-pressed":
|
|
1746
|
-
onClick:
|
|
1747
|
-
}, [
|
|
1773
|
+
title: G(c).mapMeasureArea,
|
|
1774
|
+
"aria-pressed": F.value === "area",
|
|
1775
|
+
onClick: t[1] ||= (e) => xe("area")
|
|
1776
|
+
}, [E(d, {
|
|
1748
1777
|
name: "pentagon",
|
|
1749
1778
|
size: 20
|
|
1750
|
-
})], 8,
|
|
1751
|
-
|
|
1779
|
+
})], 8, Nt),
|
|
1780
|
+
C("button", {
|
|
1752
1781
|
type: "button",
|
|
1753
1782
|
class: "grid place-items-center",
|
|
1754
|
-
title:
|
|
1755
|
-
disabled: !
|
|
1756
|
-
onClick:
|
|
1757
|
-
}, [
|
|
1783
|
+
title: G(c).mapClearMeasurements,
|
|
1784
|
+
disabled: !I.value && !F.value,
|
|
1785
|
+
onClick: we
|
|
1786
|
+
}, [E(d, {
|
|
1758
1787
|
name: "delete",
|
|
1759
1788
|
size: 20
|
|
1760
|
-
})], 8,
|
|
1789
|
+
})], 8, Pt)
|
|
1761
1790
|
]),
|
|
1762
1791
|
_: 1
|
|
1763
|
-
}, 8, ["position"])) :
|
|
1792
|
+
}, 8, ["position"])) : x("", !0), (L(!0), S(_, null, B(R.value, (e) => (L(), b(Se, {
|
|
1764
1793
|
key: e.key,
|
|
1765
1794
|
"lng-lat": e.at,
|
|
1766
1795
|
anchor: e.kind === "area" ? "center" : "top",
|
|
1767
1796
|
offset: e.kind === "area" ? [0, 0] : [0, 8],
|
|
1768
1797
|
class: "pointer-events-none"
|
|
1769
1798
|
}, {
|
|
1770
|
-
default:
|
|
1799
|
+
default: q(() => [C("span", { class: M(["flex items-center gap-1 whitespace-nowrap rounded-full py-0.5 shadow-elevation-1", [e.kind === "segment" ? "bg-surface-container-highest text-label-small text-on-surface" : "bg-primary text-label-medium text-on-primary", e.m === void 0 ? "px-2" : "pr-0.5 pl-2"]]) }, [T(U(e.text) + " ", 1), e.m === void 0 ? x("", !0) : (L(), S("button", {
|
|
1771
1800
|
key: 0,
|
|
1772
1801
|
type: "button",
|
|
1773
1802
|
class: "pointer-events-auto grid size-5 cursor-pointer place-items-center rounded-full hover:bg-on-primary/12 focus-visible:outline-2 focus-visible:outline-on-primary",
|
|
1774
|
-
"aria-label":
|
|
1775
|
-
title:
|
|
1776
|
-
onClick:
|
|
1777
|
-
onPointerdown:
|
|
1778
|
-
onMousedown:
|
|
1779
|
-
onTouchstart:
|
|
1780
|
-
onDblclick:
|
|
1781
|
-
}, [
|
|
1803
|
+
"aria-label": G(c).mapDeleteMeasurement,
|
|
1804
|
+
title: G(c).mapDeleteMeasurement,
|
|
1805
|
+
onClick: J((t) => Ce(e.m), ["stop"]),
|
|
1806
|
+
onPointerdown: t[2] ||= J(() => {}, ["stop"]),
|
|
1807
|
+
onMousedown: t[3] ||= J(() => {}, ["stop"]),
|
|
1808
|
+
onTouchstart: t[4] ||= J(() => {}, ["stop"]),
|
|
1809
|
+
onDblclick: t[5] ||= J(() => {}, ["stop"])
|
|
1810
|
+
}, [E(d, {
|
|
1782
1811
|
name: "close",
|
|
1783
1812
|
size: 14
|
|
1784
|
-
})], 40,
|
|
1813
|
+
})], 40, Ft))], 2)]),
|
|
1785
1814
|
_: 2
|
|
1786
1815
|
}, 1032, [
|
|
1787
1816
|
"lng-lat",
|
|
@@ -1789,24 +1818,24 @@ var Dt = { class: "hidden" }, Ot = ["title", "aria-pressed"], kt = ["title", "ar
|
|
|
1789
1818
|
"offset"
|
|
1790
1819
|
]))), 128))]));
|
|
1791
1820
|
}
|
|
1792
|
-
}),
|
|
1793
|
-
function
|
|
1794
|
-
let
|
|
1795
|
-
if (!
|
|
1796
|
-
function
|
|
1797
|
-
let r =
|
|
1798
|
-
if (!r?.getLayer(
|
|
1799
|
-
let i =
|
|
1800
|
-
i ||
|
|
1801
|
-
let a = i.get(
|
|
1802
|
-
r.setFilter(
|
|
1821
|
+
}), Lt = /* @__PURE__ */ new WeakMap();
|
|
1822
|
+
function Rt(e) {
|
|
1823
|
+
let t = ie(e);
|
|
1824
|
+
if (!t) throw Error("useMapFilter() must be called in a component inside <MMap>, or be given one");
|
|
1825
|
+
function n(e, n) {
|
|
1826
|
+
let r = t.map.value;
|
|
1827
|
+
if (!r?.getLayer(e)) return;
|
|
1828
|
+
let i = Lt.get(r);
|
|
1829
|
+
i || Lt.set(r, i = /* @__PURE__ */ new Map()), i.has(e) || i.set(e, r.getFilter(e) ?? void 0);
|
|
1830
|
+
let a = i.get(e);
|
|
1831
|
+
r.setFilter(e, n ? a ? [
|
|
1803
1832
|
"all",
|
|
1804
1833
|
a,
|
|
1805
1834
|
n
|
|
1806
1835
|
] : n : a ?? null);
|
|
1807
1836
|
}
|
|
1808
|
-
function
|
|
1809
|
-
let r =
|
|
1837
|
+
function r(e, n) {
|
|
1838
|
+
let r = t.map.value, i = r?.getLayer(e);
|
|
1810
1839
|
if (!r || !i?.source) return [];
|
|
1811
1840
|
let a = r.querySourceFeatures(i.source, i.sourceLayer ? { sourceLayer: i.sourceLayer } : void 0), o = /* @__PURE__ */ new Set();
|
|
1812
1841
|
for (let e of a) {
|
|
@@ -1816,61 +1845,62 @@ function Pt() {
|
|
|
1816
1845
|
return [...o].sort((e, t) => typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t)));
|
|
1817
1846
|
}
|
|
1818
1847
|
return {
|
|
1819
|
-
setFilter:
|
|
1820
|
-
valuesOf:
|
|
1848
|
+
setFilter: n,
|
|
1849
|
+
valuesOf: r
|
|
1821
1850
|
};
|
|
1822
1851
|
}
|
|
1823
1852
|
//#endregion
|
|
1824
1853
|
//#region src/components/MMapFilter.vue?vue&type=script&setup=true&lang.ts
|
|
1825
|
-
var
|
|
1854
|
+
var zt = { class: "flex flex-wrap gap-2" }, Bt = /* @__PURE__ */ D({
|
|
1826
1855
|
__name: "MMapFilter",
|
|
1827
1856
|
props: {
|
|
1828
1857
|
layer: {},
|
|
1829
1858
|
property: {},
|
|
1830
1859
|
values: {},
|
|
1831
1860
|
labels: {},
|
|
1832
|
-
modelValue: {}
|
|
1861
|
+
modelValue: {},
|
|
1862
|
+
map: {}
|
|
1833
1863
|
},
|
|
1834
1864
|
emits: ["update:modelValue"],
|
|
1835
1865
|
setup(e, { emit: t }) {
|
|
1836
|
-
let n = e, r = t, { onReady: i, styleVersion: a } =
|
|
1837
|
-
function
|
|
1838
|
-
let e =
|
|
1839
|
-
|
|
1866
|
+
let n = e, r = t, { onReady: i, styleVersion: a } = Y(() => n.map), { setFilter: o, valuesOf: s } = Rt(() => n.map), c = z([]), l = y(() => n.values ?? c.value), u = z([]), d = y(() => n.modelValue ?? u.value);
|
|
1867
|
+
function f() {
|
|
1868
|
+
let e = d.value;
|
|
1869
|
+
o(n.layer, e.length ? [
|
|
1840
1870
|
"in",
|
|
1841
1871
|
["get", n.property],
|
|
1842
1872
|
["literal", e]
|
|
1843
1873
|
] : null);
|
|
1844
1874
|
}
|
|
1845
|
-
function
|
|
1846
|
-
let t =
|
|
1847
|
-
|
|
1875
|
+
function p(e) {
|
|
1876
|
+
let t = d.value.includes(e) ? d.value.filter((t) => t !== e) : [...d.value, e];
|
|
1877
|
+
u.value = t, r("update:modelValue", t);
|
|
1848
1878
|
}
|
|
1849
|
-
function
|
|
1879
|
+
function m(e) {
|
|
1850
1880
|
let t = () => {
|
|
1851
|
-
n.values || (
|
|
1881
|
+
n.values || (c.value = s(n.layer, n.property));
|
|
1852
1882
|
};
|
|
1853
1883
|
t(), e.once("idle", t);
|
|
1854
1884
|
}
|
|
1855
1885
|
return i((e) => {
|
|
1856
|
-
|
|
1857
|
-
}),
|
|
1858
|
-
e !== t &&
|
|
1859
|
-
}),
|
|
1886
|
+
m(e), f();
|
|
1887
|
+
}), K(d, f, { deep: !0 }), K(a, () => f()), K(() => [n.layer, n.property], ([e], [t]) => {
|
|
1888
|
+
e !== t && o(t, null), f();
|
|
1889
|
+
}), P(() => o(n.layer, null)), (t, n) => (L(), S("div", zt, [(L(!0), S(_, null, B(l.value, (t) => (L(), b(h, {
|
|
1860
1890
|
key: t,
|
|
1861
1891
|
type: "filter",
|
|
1862
1892
|
clickable: "",
|
|
1863
|
-
selected:
|
|
1864
|
-
onClick: (e) =>
|
|
1893
|
+
selected: d.value.includes(t),
|
|
1894
|
+
onClick: (e) => p(t)
|
|
1865
1895
|
}, {
|
|
1866
|
-
default:
|
|
1896
|
+
default: q(() => [T(U(e.labels?.[String(t)] ?? t), 1)]),
|
|
1867
1897
|
_: 2
|
|
1868
1898
|
}, 1032, ["selected", "onClick"]))), 128))]));
|
|
1869
1899
|
}
|
|
1870
1900
|
});
|
|
1871
1901
|
//#endregion
|
|
1872
1902
|
//#region src/composables/mapSearch.ts
|
|
1873
|
-
function
|
|
1903
|
+
function Vt(e = {}) {
|
|
1874
1904
|
return async (t, n) => {
|
|
1875
1905
|
let r = new URLSearchParams({
|
|
1876
1906
|
format: "jsonv2",
|
|
@@ -1898,17 +1928,17 @@ function Lt(e = {}) {
|
|
|
1898
1928
|
}
|
|
1899
1929
|
//#endregion
|
|
1900
1930
|
//#region src/components/MMapSearch.vue?vue&type=script&setup=true&lang.ts
|
|
1901
|
-
var
|
|
1931
|
+
var Ht = { class: "hidden" }, Ut = [
|
|
1902
1932
|
"value",
|
|
1903
1933
|
"placeholder",
|
|
1904
1934
|
"aria-label"
|
|
1905
|
-
],
|
|
1935
|
+
], Wt = {
|
|
1906
1936
|
key: 0,
|
|
1907
1937
|
class: "border-t border-outline-variant"
|
|
1908
|
-
},
|
|
1938
|
+
}, Gt = {
|
|
1909
1939
|
key: 1,
|
|
1910
1940
|
class: "flex flex-col items-center gap-2 py-6"
|
|
1911
|
-
},
|
|
1941
|
+
}, Kt = { class: "text-body-small text-on-surface-variant" }, qt = /* @__PURE__ */ D({
|
|
1912
1942
|
__name: "MMapSearch",
|
|
1913
1943
|
props: {
|
|
1914
1944
|
provider: {},
|
|
@@ -1925,29 +1955,29 @@ var Rt = { class: "hidden" }, zt = [
|
|
|
1925
1955
|
}
|
|
1926
1956
|
},
|
|
1927
1957
|
emits: ["select"],
|
|
1928
|
-
setup(
|
|
1929
|
-
let r =
|
|
1958
|
+
setup(e, { emit: n }) {
|
|
1959
|
+
let r = e, i = n, a = t(), { map: c } = Y(), l = y(() => r.provider ?? Vt()), u = z(""), h = H([]), g = z(!1), v = z(!1), w = z(!1), T = H(null), D, O;
|
|
1930
1960
|
async function k() {
|
|
1931
|
-
let e =
|
|
1961
|
+
let e = u.value.trim();
|
|
1932
1962
|
if (!e) return;
|
|
1933
1963
|
D?.abort(), D = new AbortController();
|
|
1934
1964
|
let t = D;
|
|
1935
|
-
|
|
1965
|
+
g.value = !0, w.value = !0;
|
|
1936
1966
|
try {
|
|
1937
|
-
|
|
1967
|
+
h.value = await l.value(e, t.signal);
|
|
1938
1968
|
} catch {
|
|
1939
1969
|
if (t.signal.aborted) return;
|
|
1940
|
-
|
|
1970
|
+
h.value = [];
|
|
1941
1971
|
} finally {
|
|
1942
|
-
D === t && (
|
|
1972
|
+
D === t && (g.value = !1, v.value = !0);
|
|
1943
1973
|
}
|
|
1944
1974
|
}
|
|
1945
1975
|
function A(e) {
|
|
1946
|
-
if (
|
|
1976
|
+
if (u.value = e, !e) return M();
|
|
1947
1977
|
r.instant && (clearTimeout(O), O = setTimeout(k, 350));
|
|
1948
1978
|
}
|
|
1949
1979
|
function j(e) {
|
|
1950
|
-
|
|
1980
|
+
T.value = e, w.value = !1;
|
|
1951
1981
|
let t = c.value;
|
|
1952
1982
|
e.bbox && e.bbox[0] !== e.bbox[2] ? t?.fitBounds([[e.bbox[0], e.bbox[1]], [e.bbox[2], e.bbox[3]]], {
|
|
1953
1983
|
padding: 48,
|
|
@@ -1955,15 +1985,15 @@ var Rt = { class: "hidden" }, zt = [
|
|
|
1955
1985
|
}) : t?.flyTo({
|
|
1956
1986
|
center: e.lngLat,
|
|
1957
1987
|
zoom: r.zoom
|
|
1958
|
-
}),
|
|
1988
|
+
}), i("select", e);
|
|
1959
1989
|
}
|
|
1960
1990
|
function M() {
|
|
1961
|
-
D?.abort(), clearTimeout(O),
|
|
1991
|
+
D?.abort(), clearTimeout(O), u.value = "", h.value = [], v.value = !1, g.value = !1, w.value = !1, T.value = null;
|
|
1962
1992
|
}
|
|
1963
|
-
|
|
1993
|
+
P(() => {
|
|
1964
1994
|
D?.abort(), clearTimeout(O);
|
|
1965
1995
|
});
|
|
1966
|
-
let
|
|
1996
|
+
let N = {
|
|
1967
1997
|
city: "location_city",
|
|
1968
1998
|
town: "location_city",
|
|
1969
1999
|
village: "holiday_village",
|
|
@@ -1990,54 +2020,54 @@ var Rt = { class: "hidden" }, zt = [
|
|
|
1990
2020
|
administrative: "map",
|
|
1991
2021
|
country: "public",
|
|
1992
2022
|
state: "map"
|
|
1993
|
-
},
|
|
1994
|
-
return (
|
|
1995
|
-
position:
|
|
2023
|
+
}, F = (e) => e && N[e] || "location_on";
|
|
2024
|
+
return (t, n) => (L(), S("div", Ht, [E(oe, {
|
|
2025
|
+
position: e.position,
|
|
1996
2026
|
group: !1
|
|
1997
2027
|
}, {
|
|
1998
|
-
default:
|
|
2028
|
+
default: q(() => [E(f, {
|
|
1999
2029
|
variant: "elevated",
|
|
2000
2030
|
class: "w-80 max-w-[calc(100vw-5rem)] overflow-hidden"
|
|
2001
2031
|
}, {
|
|
2002
|
-
default:
|
|
2032
|
+
default: q(() => [C("form", {
|
|
2003
2033
|
class: "flex items-center gap-2 py-1 pr-1 pl-3",
|
|
2004
2034
|
role: "search",
|
|
2005
|
-
onSubmit:
|
|
2035
|
+
onSubmit: J(k, ["prevent"])
|
|
2006
2036
|
}, [
|
|
2007
|
-
|
|
2037
|
+
E(d, {
|
|
2008
2038
|
name: "search",
|
|
2009
2039
|
size: 20,
|
|
2010
2040
|
class: "shrink-0 text-on-surface-variant"
|
|
2011
2041
|
}),
|
|
2012
|
-
|
|
2013
|
-
value:
|
|
2042
|
+
C("input", {
|
|
2043
|
+
value: u.value,
|
|
2014
2044
|
type: "search",
|
|
2015
2045
|
enterkeyhint: "search",
|
|
2016
|
-
placeholder:
|
|
2017
|
-
"aria-label":
|
|
2046
|
+
placeholder: e.placeholder ?? G(a).mapSearchPlaces,
|
|
2047
|
+
"aria-label": e.placeholder ?? G(a).mapSearchPlaces,
|
|
2018
2048
|
class: "min-w-0 flex-1 bg-transparent py-2 text-body-medium text-on-surface outline-none placeholder:text-on-surface-variant [&::-webkit-search-cancel-button]:hidden",
|
|
2019
|
-
onInput:
|
|
2020
|
-
onFocus:
|
|
2021
|
-
}, null, 40,
|
|
2022
|
-
|
|
2049
|
+
onInput: n[0] ||= (e) => A(e.target.value),
|
|
2050
|
+
onFocus: n[1] ||= (e) => w.value = v.value && !T.value
|
|
2051
|
+
}, null, 40, Ut),
|
|
2052
|
+
g.value ? (L(), b(o, {
|
|
2023
2053
|
key: 0,
|
|
2024
2054
|
size: 20,
|
|
2025
2055
|
class: "mr-2 shrink-0"
|
|
2026
|
-
})) :
|
|
2056
|
+
})) : u.value ? (L(), b(s, {
|
|
2027
2057
|
key: 1,
|
|
2028
2058
|
icon: "close",
|
|
2029
|
-
label:
|
|
2059
|
+
label: G(a).clearSearch,
|
|
2030
2060
|
size: "sm",
|
|
2031
2061
|
onClick: M
|
|
2032
|
-
}, null, 8, ["label"])) :
|
|
2033
|
-
], 32), w.value &&
|
|
2062
|
+
}, null, 8, ["label"])) : x("", !0)
|
|
2063
|
+
], 32), w.value && v.value && !g.value ? (L(), S("div", Wt, [h.value.length ? (L(), b(p, {
|
|
2034
2064
|
key: 0,
|
|
2035
2065
|
class: "max-h-72 overflow-y-auto"
|
|
2036
2066
|
}, {
|
|
2037
|
-
default:
|
|
2067
|
+
default: q(() => [(L(!0), S(_, null, B(h.value, (e, t) => (L(), b(m, {
|
|
2038
2068
|
key: t,
|
|
2039
2069
|
title: e.label,
|
|
2040
|
-
icon:
|
|
2070
|
+
icon: F(e.type),
|
|
2041
2071
|
leading: "icon",
|
|
2042
2072
|
clickable: "",
|
|
2043
2073
|
onClick: (t) => j(e)
|
|
@@ -2047,21 +2077,21 @@ var Rt = { class: "hidden" }, zt = [
|
|
|
2047
2077
|
"onClick"
|
|
2048
2078
|
]))), 128))]),
|
|
2049
2079
|
_: 1
|
|
2050
|
-
})) : (
|
|
2080
|
+
})) : (L(), S("div", Gt, [E(d, {
|
|
2051
2081
|
name: "search_off",
|
|
2052
2082
|
size: 28,
|
|
2053
2083
|
class: "text-on-surface-variant"
|
|
2054
|
-
}),
|
|
2084
|
+
}), C("span", Kt, U(G(a).noResults), 1)]))])) : x("", !0)]),
|
|
2055
2085
|
_: 1
|
|
2056
2086
|
})]),
|
|
2057
2087
|
_: 1
|
|
2058
|
-
}, 8, ["position"]),
|
|
2088
|
+
}, 8, ["position"]), e.marker && T.value ? (L(), b(Se, {
|
|
2059
2089
|
key: 0,
|
|
2060
|
-
"lng-lat":
|
|
2061
|
-
}, null, 8, ["lng-lat"])) :
|
|
2090
|
+
"lng-lat": T.value.lngLat
|
|
2091
|
+
}, null, 8, ["lng-lat"])) : x("", !0)]));
|
|
2062
2092
|
}
|
|
2063
2093
|
});
|
|
2064
2094
|
//#endregion
|
|
2065
|
-
export {
|
|
2095
|
+
export { ge as MMap, Ze as MMapBaseLayers, oe as MMapControl, ot as MMapFeatureInfo, Bt as MMapFilter, we as MMapGeoJson, Ct as MMapHover, gt as MMapIdentify, qe as MMapLayers, Se as MMapMarker, It as MMapMeasure, Ce as MMapPopup, qt as MMapSearch, dt as fieldLabel, ft as formatFieldValue, lt as genericAdapter, mt as identifyFeatures, Vt as nominatimProvider, ut as orvianAdapter, Y as useMap, Rt as useMapFilter, fe as useMapLayers };
|
|
2066
2096
|
|
|
2067
2097
|
//# sourceMappingURL=map.js.map
|