@m3ui-vue/m3ui-vue 1.6.1 → 1.7.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 +649 -28
- package/dist/{MButton-OQ4wIERQ.js → MButton-CN3wYwIG.js} +2 -2
- package/dist/{MButton-OQ4wIERQ.js.map → MButton-CN3wYwIG.js.map} +1 -1
- package/dist/MColorPickerModal-BKM1CHxr.js +577 -0
- package/dist/MColorPickerModal-BKM1CHxr.js.map +1 -0
- package/dist/{MDialog-DYMnaBlt.js → MDialog-1LAk9WAO.js} +2 -2
- package/dist/{MDialog-DYMnaBlt.js.map → MDialog-1LAk9WAO.js.map} +1 -1
- package/dist/{MListItem-D2cNUyzP.js → MListItem-BU5KDRCB.js} +376 -270
- package/dist/MListItem-BU5KDRCB.js.map +1 -0
- package/dist/{MLoadingIndicator-DWUj0BAB.js → MLoadingIndicator-RykOo5tf.js} +2 -2
- package/dist/{MLoadingIndicator-DWUj0BAB.js.map → MLoadingIndicator-RykOo5tf.js.map} +1 -1
- package/dist/{MSeekBar-C4cn9RIF.js → MSeekBar-B_Y3MpVz.js} +2 -2
- package/dist/{MSeekBar-C4cn9RIF.js.map → MSeekBar-B_Y3MpVz.js.map} +1 -1
- package/dist/MSegmentedButton-CiOOY1-N.js +105 -0
- package/dist/MSegmentedButton-CiOOY1-N.js.map +1 -0
- package/dist/MSlider-BCeVIxcq.js +739 -0
- package/dist/MSlider-BCeVIxcq.js.map +1 -0
- package/dist/{MSpinner-DZkXZJpc.js → MSpinner-Cs03qoqE.js} +2 -2
- package/dist/{MSpinner-DZkXZJpc.js.map → MSpinner-Cs03qoqE.js.map} +1 -1
- package/dist/{MTextField-CNH-byir.js → MTextField-NaFbMkjv.js} +162 -115
- package/dist/MTextField-NaFbMkjv.js.map +1 -0
- package/dist/MTooltip-CK39Zon4.js +183 -0
- package/dist/MTooltip-CK39Zon4.js.map +1 -0
- package/dist/_useFieldValidation-Bz34IAQY.js +191 -0
- package/dist/_useFieldValidation-Bz34IAQY.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/code-editor.js +184 -103
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAddressField.vue.d.ts +18 -3
- package/dist/components/MAppBarWithSearch.vue.d.ts +1 -1
- package/dist/components/MAudioRecorder.vue.d.ts +2 -2
- package/dist/components/MAutocomplete.vue.d.ts +22 -3
- package/dist/components/MCheckbox.vue.d.ts +23 -1
- package/dist/components/MCodeEditor.vue.d.ts +23 -1
- package/dist/components/MColorPicker.vue.d.ts +24 -3
- package/dist/components/MConfirmDialog.vue.d.ts +2 -2
- package/dist/components/MCountrySelect.vue.d.ts +13 -2
- package/dist/components/MCreditCardInput.vue.d.ts +33 -0
- package/dist/components/MCronField.vue.d.ts +23 -1
- package/dist/components/MDataTable.vue.d.ts +1 -1
- package/dist/components/MDatePicker.vue.d.ts +24 -3
- package/dist/components/MDateRangePicker.vue.d.ts +24 -3
- package/dist/components/MFileUpload.vue.d.ts +23 -2
- package/dist/components/MForm.vue.d.ts +61 -0
- package/dist/components/MJsonEditor.vue.d.ts +23 -1
- package/dist/components/MMapRoute.vue.d.ts +168 -0
- package/dist/components/MMaskField.vue.d.ts +20 -2
- package/dist/components/MMentionField.vue.d.ts +13 -2
- package/dist/components/MMultiAutocomplete.vue.d.ts +22 -3
- package/dist/components/MMultiSelect.vue.d.ts +22 -3
- package/dist/components/MNavigationRail.vue.d.ts +1 -1
- package/dist/components/MNotificationCenter.vue.d.ts +2 -2
- package/dist/components/MNumberField.vue.d.ts +20 -2
- package/dist/components/MPhoneInput.vue.d.ts +19 -4
- package/dist/components/MPinInput.vue.d.ts +24 -3
- package/dist/components/MPosKeypad.vue.d.ts +2 -2
- package/dist/components/MRadioGroup.vue.d.ts +23 -1
- package/dist/components/MRating.vue.d.ts +23 -1
- package/dist/components/MRichTextEditor.vue.d.ts +23 -1
- package/dist/components/MSearchBar.vue.d.ts +1 -1
- package/dist/components/MSegmentedButton.vue.d.ts +23 -2
- package/dist/components/MSelect.vue.d.ts +22 -3
- package/dist/components/MSignaturePad.vue.d.ts +19 -0
- package/dist/components/MSlider.vue.d.ts +23 -1
- package/dist/components/MSwitch.vue.d.ts +23 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +20 -2
- package/dist/components/MText.vue.d.ts +1 -1
- package/dist/components/MTextField.vue.d.ts +26 -3
- package/dist/components/MTimePicker.vue.d.ts +24 -3
- package/dist/components/MTimezoneSelect.vue.d.ts +13 -2
- package/dist/components/MTour.vue.d.ts +2 -2
- package/dist/components/MTrackingTimeline.vue.d.ts +75 -0
- package/dist/components/MWindow.vue.d.ts +2 -2
- package/dist/composables/_routeGeometry.d.ts +26 -0
- package/dist/composables/_useFieldValidation.d.ts +91 -0
- package/dist/composables/mapRouting.d.ts +35 -0
- package/dist/composables/useLocale.d.ts +23 -0
- package/dist/composables/validation.d.ts +82 -0
- package/dist/draw.js +27 -26
- package/dist/draw.js.map +1 -1
- package/dist/flow.js +1 -1
- package/dist/gantt.js +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/locales/index.js +154 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7350 -6183
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +4 -0
- package/dist/map.js +1319 -867
- package/dist/map.js.map +1 -1
- package/dist/media.js +4 -4
- package/dist/pdf.js +4 -4
- package/dist/rich-text-editor.js +189 -146
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-DaVSTdm0.js → useLocale-Dh1xZZ8i.js} +22 -1
- package/dist/useLocale-Dh1xZZ8i.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MForm.test.ts +325 -0
- package/src/__tests__/MMapRoute.test.ts +384 -0
- package/src/__tests__/MPhoneInput.test.ts +5 -2
- package/src/__tests__/MRichTextEditor.test.ts +2 -1
- package/src/__tests__/MTrackingTimeline.test.ts +66 -0
- package/src/__tests__/_fakeMaplibre.ts +4 -1
- package/src/__tests__/_osrmRoutes.ts +10 -0
- package/src/__tests__/attrsFallthrough.test.ts +11 -0
- package/src/__tests__/fieldsValidation.test.ts +229 -0
- package/src/__tests__/ssr.test.ts +1 -0
- package/src/__tests__/validation.test.ts +77 -0
- package/src/components/MAddressField.vue +45 -8
- package/src/components/MAudioRecorder.vue +9 -9
- package/src/components/MAutocomplete.vue +69 -23
- package/src/components/MCheckbox.vue +80 -17
- package/src/components/MCodeEditor.vue +59 -2
- package/src/components/MColorPicker.vue +65 -16
- package/src/components/MCountrySelect.vue +17 -3
- package/src/components/MCreditCardInput.vue +76 -7
- package/src/components/MCronField.vue +60 -10
- package/src/components/MDatePicker.vue +65 -16
- package/src/components/MDateRangePicker.vue +66 -16
- package/src/components/MFileUpload.vue +71 -8
- package/src/components/MForm.vue +208 -0
- package/src/components/MJsonEditor.vue +57 -3
- package/src/components/MMapBaseLayers.vue +29 -28
- package/src/components/MMapMeasure.vue +1 -1
- package/src/components/MMapRoute.vue +470 -0
- package/src/components/MMaskField.vue +55 -13
- package/src/components/MMentionField.vue +17 -2
- package/src/components/MMultiAutocomplete.vue +70 -23
- package/src/components/MMultiSelect.vue +70 -23
- package/src/components/MNumberField.vue +58 -16
- package/src/components/MPhoneInput.vue +60 -18
- package/src/components/MPinInput.vue +58 -10
- package/src/components/MRadioGroup.vue +65 -4
- package/src/components/MRating.vue +62 -6
- package/src/components/MRichTextEditor.vue +64 -4
- package/src/components/MSegmentedButton.vue +59 -2
- package/src/components/MSelect.vue +72 -26
- package/src/components/MSignaturePad.vue +71 -6
- package/src/components/MSlider.vue +61 -10
- package/src/components/MSwitch.vue +63 -8
- package/src/components/MTagInput.vue +67 -25
- package/src/components/MTextField.vue +68 -14
- package/src/components/MTimePicker.vue +65 -16
- package/src/components/MTimezoneSelect.vue +17 -3
- package/src/components/MTrackingTimeline.vue +257 -0
- package/src/composables/_routeGeometry.ts +140 -0
- package/src/composables/_useFieldValidation.ts +287 -0
- package/src/composables/mapRouting.ts +55 -0
- package/src/composables/useLocale.ts +46 -0
- package/src/composables/validation.ts +178 -0
- package/src/index.ts +5 -0
- package/src/locales/de.ts +21 -0
- package/src/locales/es.ts +28 -7
- package/src/locales/fr.ts +21 -0
- package/src/locales/ja.ts +21 -0
- package/src/locales/ko.ts +21 -0
- package/src/locales/pt.ts +21 -0
- package/src/locales/zh.ts +21 -0
- package/src/map.ts +4 -0
- package/dist/MListItem-D2cNUyzP.js.map +0 -1
- package/dist/MSegmentedButton-BEB4gXLA.js +0 -64
- package/dist/MSegmentedButton-BEB4gXLA.js.map +0 -1
- package/dist/MSlider-BIkA6DiE.js +0 -690
- package/dist/MSlider-BIkA6DiE.js.map +0 -1
- package/dist/MTextField-CNH-byir.js.map +0 -1
- package/dist/MTooltip-Dd5g2zhh.js +0 -754
- package/dist/MTooltip-Dd5g2zhh.js.map +0 -1
- package/dist/useLocale-DaVSTdm0.js.map +0 -1
package/dist/map.js
CHANGED
|
@@ -1,61 +1,63 @@
|
|
|
1
1
|
import { t as e } from "./MIcon-DpajuUTJ.js";
|
|
2
2
|
import { i as t } from "./motion-BcejVTeX.js";
|
|
3
3
|
import { d as n, f as r, l as i, t as a, u as o } from "./MIconButton-BBggVwBV.js";
|
|
4
|
-
import { i as s } from "./useLocale-
|
|
4
|
+
import { i as s } from "./useLocale-Dh1xZZ8i.js";
|
|
5
5
|
import { o as c } from "./_storageKeys-C4W_4xK4.js";
|
|
6
6
|
import { t as l } from "./useThemeTokens-DyAdPQB0.js";
|
|
7
|
-
import { t as u } from "./MTextField-
|
|
8
|
-
import { t as d } from "./MSlider-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { t as y } from "./
|
|
12
|
-
import {
|
|
7
|
+
import { t as u } from "./MTextField-NaFbMkjv.js";
|
|
8
|
+
import { t as d } from "./MSlider-BCeVIxcq.js";
|
|
9
|
+
import { t as f } from "./MTooltip-CK39Zon4.js";
|
|
10
|
+
import { n as p, r as m } from "./_popupPosition-nL8SVKPK.js";
|
|
11
|
+
import { a as h, l as g, r as _, s as v, t as y } from "./MListItem-BU5KDRCB.js";
|
|
12
|
+
import { t as b } from "./MSpinner-Cs03qoqE.js";
|
|
13
|
+
import { n as x, t as S } from "./_useFieldValidation-Bz34IAQY.js";
|
|
14
|
+
import { Fragment as C, Teleport as w, Transition as T, computed as E, createBlock as D, createCommentVNode as O, createElementBlock as k, createElementVNode as A, createSlots as j, createTextVNode as M, createVNode as N, defineComponent as P, getCurrentInstance as F, inject as I, markRaw as L, mergeProps as R, nextTick as ee, normalizeClass as z, normalizeStyle as te, onBeforeUnmount as ne, onMounted as B, onUnmounted as V, openBlock as H, provide as U, reactive as W, ref as G, renderList as re, renderSlot as K, shallowRef as q, toDisplayString as J, toValue as Y, unref as X, useId as ie, useSlots as ae, watch as Z, watchEffect as oe, withCtx as Q, withModifiers as se } from "vue";
|
|
13
15
|
// src/composables/useMap.ts
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
|
|
16
|
+
var ce;
|
|
17
|
+
function le(e) {
|
|
18
|
+
ce = e;
|
|
17
19
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
20
|
+
function ue() {
|
|
21
|
+
return ce;
|
|
20
22
|
}
|
|
21
|
-
var
|
|
22
|
-
function
|
|
23
|
-
let t =
|
|
23
|
+
var de = Symbol("m3-map");
|
|
24
|
+
function fe(e) {
|
|
25
|
+
let t = I(de, null);
|
|
24
26
|
if (t || e === void 0) return t;
|
|
25
|
-
let n =
|
|
26
|
-
let t =
|
|
27
|
+
let n = E(() => {
|
|
28
|
+
let t = Y(e);
|
|
27
29
|
return t ? "context" in t ? t.context : t : void 0;
|
|
28
30
|
}), r = {
|
|
29
|
-
map:
|
|
30
|
-
maplibre:
|
|
31
|
-
styleVersion:
|
|
32
|
-
model:
|
|
31
|
+
map: E(() => n.value?.map.value),
|
|
32
|
+
maplibre: E(() => n.value?.maplibre.value),
|
|
33
|
+
styleVersion: E(() => n.value?.styleVersion.value ?? 0),
|
|
34
|
+
model: E(() => n.value?.model.value),
|
|
33
35
|
layerState: new Proxy({
|
|
34
36
|
visible: {},
|
|
35
37
|
opacity: {}
|
|
36
38
|
}, { get: (e, t) => Reflect.get(n.value?.layerState ?? e, t) }),
|
|
37
|
-
activeTool:
|
|
39
|
+
activeTool: E({
|
|
38
40
|
get: () => n.value?.activeTool.value ?? null,
|
|
39
41
|
set: (e) => {
|
|
40
42
|
n.value && (n.value.activeTool.value = e);
|
|
41
43
|
}
|
|
42
44
|
})
|
|
43
45
|
};
|
|
44
|
-
return
|
|
46
|
+
return U(de, r), r;
|
|
45
47
|
}
|
|
46
|
-
function
|
|
47
|
-
let t =
|
|
48
|
+
function pe(e) {
|
|
49
|
+
let t = fe(e);
|
|
48
50
|
if (!t) throw Error("useMap() must be called in a component inside <MMap>, or be given one");
|
|
49
51
|
let n = [];
|
|
50
|
-
|
|
52
|
+
F() && ne(() => n.splice(0).forEach((e) => e()));
|
|
51
53
|
function r(e) {
|
|
52
54
|
let r = () => {
|
|
53
55
|
if (t.map.value && t.maplibre.value) return e(t.map.value, t.maplibre.value);
|
|
54
|
-
let r =
|
|
56
|
+
let r = Z(t.map, (n) => {
|
|
55
57
|
n && t.maplibre.value && (r(), e(n, t.maplibre.value));
|
|
56
58
|
});
|
|
57
59
|
n.push(r);
|
|
58
|
-
}, i =
|
|
60
|
+
}, i = F();
|
|
59
61
|
i && !i.isMounted ? B(r) : r();
|
|
60
62
|
}
|
|
61
63
|
function i(e, t) {
|
|
@@ -69,9 +71,9 @@ function Z(e) {
|
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
return {
|
|
72
|
-
map:
|
|
73
|
-
maplibre:
|
|
74
|
-
styleVersion:
|
|
74
|
+
map: E(() => t.map.value),
|
|
75
|
+
maplibre: E(() => t.maplibre.value),
|
|
76
|
+
styleVersion: E(() => t.styleVersion.value),
|
|
75
77
|
activeTool: t.activeTool,
|
|
76
78
|
onReady: r,
|
|
77
79
|
on: i,
|
|
@@ -79,10 +81,10 @@ function Z(e) {
|
|
|
79
81
|
};
|
|
80
82
|
}
|
|
81
83
|
// src/components/MMapControl.vue?vue&type=script&setup=true&lang.ts
|
|
82
|
-
var
|
|
84
|
+
var me = { class: "hidden" }, he = {
|
|
83
85
|
key: 0,
|
|
84
86
|
class: "m3-map-control-panel-in"
|
|
85
|
-
},
|
|
87
|
+
}, ge = /* @__PURE__ */ P({
|
|
86
88
|
inheritAttrs: !1,
|
|
87
89
|
__name: "MMapControl",
|
|
88
90
|
props: {
|
|
@@ -102,11 +104,11 @@ var fe = { class: "hidden" }, pe = {
|
|
|
102
104
|
},
|
|
103
105
|
emits: ["update:expanded"],
|
|
104
106
|
setup(e, { emit: a }) {
|
|
105
|
-
let s = e, c = a, l =
|
|
106
|
-
|
|
107
|
+
let s = e, c = a, l = ae(), u = G(), { onReady: d } = pe(), f = G(s.expanded);
|
|
108
|
+
Z(() => s.expanded, (e) => {
|
|
107
109
|
f.value = e;
|
|
108
110
|
});
|
|
109
|
-
let p =
|
|
111
|
+
let p = E(() => f.value && !!l.panel);
|
|
110
112
|
function m(e) {
|
|
111
113
|
e !== f.value && (f.value = e, c("update:expanded", e));
|
|
112
114
|
}
|
|
@@ -120,24 +122,24 @@ var fe = { class: "hidden" }, pe = {
|
|
|
120
122
|
let y = null, b = null, x = [], S = {
|
|
121
123
|
w: 0,
|
|
122
124
|
h: 0
|
|
123
|
-
},
|
|
125
|
+
}, C = {
|
|
124
126
|
w: 0,
|
|
125
127
|
h: 0
|
|
126
|
-
},
|
|
127
|
-
function
|
|
128
|
+
}, w = null;
|
|
129
|
+
function T() {
|
|
128
130
|
return {
|
|
129
131
|
w: u.value.offsetWidth,
|
|
130
132
|
h: u.value.offsetHeight
|
|
131
133
|
};
|
|
132
134
|
}
|
|
133
|
-
function
|
|
135
|
+
function D() {
|
|
134
136
|
let e = u.value;
|
|
135
137
|
if (!e || b) return;
|
|
136
|
-
let t =
|
|
137
|
-
y && (t.w !== y.w || t.h !== y.h) && s.animate && !o() &&
|
|
138
|
+
let t = T();
|
|
139
|
+
y && (t.w !== y.w || t.h !== y.h) && s.animate && !o() && O(e, y, t), y = t;
|
|
138
140
|
}
|
|
139
|
-
function
|
|
140
|
-
if (S = n,
|
|
141
|
+
function O(e, n, a) {
|
|
142
|
+
if (S = n, C = a, x = r(0, 1, 0, t.standard.defaultSpatial, .002), e.style.overflow = "hidden", b = i(e, x, (e) => ({
|
|
141
143
|
width: `${n.w + (a.w - n.w) * e}px`,
|
|
142
144
|
height: `${n.h + (a.h - n.h) * e}px`
|
|
143
145
|
})), !b) return j(e);
|
|
@@ -145,48 +147,48 @@ var fe = { class: "hidden" }, pe = {
|
|
|
145
147
|
}
|
|
146
148
|
function j(e) {
|
|
147
149
|
b?.cancel(), b = null, e.style.overflow = "";
|
|
148
|
-
let t =
|
|
149
|
-
t.w !==
|
|
150
|
+
let t = T();
|
|
151
|
+
t.w !== C.w || t.h !== C.h ? (y = C, D()) : y = t;
|
|
150
152
|
}
|
|
151
153
|
function M() {
|
|
152
154
|
if (!u.value || !b) return;
|
|
153
155
|
let e = n(x, b.currentTime), t = {
|
|
154
|
-
w: S.w + (
|
|
155
|
-
h: S.h + (
|
|
156
|
+
w: S.w + (C.w - S.w) * e,
|
|
157
|
+
h: S.h + (C.h - S.h) * e
|
|
156
158
|
};
|
|
157
|
-
b.onfinish = null, b.cancel(), b = null, y = t,
|
|
159
|
+
b.onfinish = null, b.cancel(), b = null, y = t, D();
|
|
158
160
|
}
|
|
159
|
-
|
|
161
|
+
Z(p, M, { flush: "post" });
|
|
160
162
|
let N, P = {
|
|
161
163
|
onAdd: () => u.value,
|
|
162
164
|
onRemove: () => u.value?.remove()
|
|
163
165
|
};
|
|
164
166
|
return d((e) => {
|
|
165
167
|
N = e, u.value && e.addControl(P, s.position);
|
|
166
|
-
}),
|
|
168
|
+
}), Z(() => s.position, (e) => {
|
|
167
169
|
N && u.value && (N.removeControl(P), N.addControl(P, e));
|
|
168
170
|
}), B(() => {
|
|
169
|
-
document.addEventListener("pointerdown", _, !0), typeof ResizeObserver < "u" && u.value && (
|
|
170
|
-
}),
|
|
171
|
-
document.removeEventListener("pointerdown", _, !0),
|
|
172
|
-
}), (t, n) => (
|
|
171
|
+
document.addEventListener("pointerdown", _, !0), typeof ResizeObserver < "u" && u.value && (w = new ResizeObserver(D), w.observe(u.value));
|
|
172
|
+
}), ne(() => {
|
|
173
|
+
document.removeEventListener("pointerdown", _, !0), w?.disconnect(), b?.cancel(), N?.hasControl(P) && N.removeControl(P);
|
|
174
|
+
}), (t, n) => (H(), k("div", me, [A("div", R({
|
|
173
175
|
ref_key: "el",
|
|
174
176
|
ref: u,
|
|
175
177
|
class: ["maplibregl-ctrl m3-map-control", p.value ? "m3-map-control-panel" : e.group ? "maplibregl-ctrl-group" : ""]
|
|
176
|
-
}, t.$attrs, { onKeydown: v }), [p.value ? (
|
|
178
|
+
}, t.$attrs, { onKeydown: v }), [p.value ? (H(), k("div", he, [K(t.$slots, "panel", { close: g })])) : K(t.$slots, "default", {
|
|
177
179
|
expanded: f.value,
|
|
178
180
|
toggle: h
|
|
179
181
|
}, void 0, void 0, 1)], 16)]));
|
|
180
182
|
}
|
|
181
|
-
}),
|
|
183
|
+
}), _e = [
|
|
182
184
|
"title",
|
|
183
185
|
"aria-label",
|
|
184
186
|
"aria-expanded"
|
|
185
|
-
],
|
|
187
|
+
], ve = ["innerHTML"], ye = /* @__PURE__ */ P({
|
|
186
188
|
__name: "_MMapAttribution",
|
|
187
189
|
props: { position: {} },
|
|
188
190
|
setup(t) {
|
|
189
|
-
let n = t, r = s(), { on: i, onReady: a } =
|
|
191
|
+
let n = t, r = s(), { on: i, onReady: a } = pe(), o = G([]), c = G(!0), l = G(0), u;
|
|
190
192
|
function d() {
|
|
191
193
|
if (!u) return;
|
|
192
194
|
let e = u.getStyle?.();
|
|
@@ -205,35 +207,35 @@ var fe = { class: "hidden" }, pe = {
|
|
|
205
207
|
}), i("styledata", d), i("sourcedata", d), i("resize", d), i("dragstart", () => {
|
|
206
208
|
c.value = !1;
|
|
207
209
|
});
|
|
208
|
-
let f =
|
|
209
|
-
return (n, i) => f.value ? (
|
|
210
|
+
let f = E(() => o.value.join(" ")), p = E(() => n.position.endsWith("right"));
|
|
211
|
+
return (n, i) => f.value ? (H(), D(ge, {
|
|
210
212
|
key: 0,
|
|
211
213
|
position: t.position,
|
|
212
214
|
group: !1,
|
|
213
|
-
class:
|
|
215
|
+
class: z(["m3-map-attrib", c.value ? "m3-map-attrib-open" : ""])
|
|
214
216
|
}, {
|
|
215
|
-
default:
|
|
216
|
-
class:
|
|
217
|
-
style:
|
|
218
|
-
}, [
|
|
217
|
+
default: Q(() => [A("div", {
|
|
218
|
+
class: z(["m3-map-attrib-row", p.value ? "flex-row-reverse" : ""]),
|
|
219
|
+
style: te(l.value ? { maxWidth: `${l.value}px` } : void 0)
|
|
220
|
+
}, [A("button", {
|
|
219
221
|
type: "button",
|
|
220
222
|
class: "m3-map-attrib-button",
|
|
221
|
-
title:
|
|
222
|
-
"aria-label":
|
|
223
|
+
title: X(r).mapToggleAttribution,
|
|
224
|
+
"aria-label": X(r).mapToggleAttribution,
|
|
223
225
|
"aria-expanded": c.value,
|
|
224
226
|
onClick: i[0] ||= (e) => c.value = !c.value
|
|
225
|
-
}, [
|
|
227
|
+
}, [N(e, {
|
|
226
228
|
name: "info",
|
|
227
229
|
size: 20
|
|
228
|
-
})], 8,
|
|
230
|
+
})], 8, _e), c.value ? (H(), k("div", {
|
|
229
231
|
key: 0,
|
|
230
|
-
class:
|
|
232
|
+
class: z(["m3-map-attrib-text", p.value ? "pl-3.5" : "pr-3.5"]),
|
|
231
233
|
innerHTML: f.value
|
|
232
|
-
}, null, 10,
|
|
234
|
+
}, null, 10, ve)) : O("", !0)], 6)]),
|
|
233
235
|
_: 1
|
|
234
|
-
}, 8, ["position", "class"])) :
|
|
236
|
+
}, 8, ["position", "class"])) : O("", !0);
|
|
235
237
|
}
|
|
236
|
-
}),
|
|
238
|
+
}), be = {
|
|
237
239
|
fill: ["fill-opacity"],
|
|
238
240
|
line: ["line-opacity"],
|
|
239
241
|
circle: ["circle-opacity", "circle-stroke-opacity"],
|
|
@@ -242,27 +244,27 @@ var fe = { class: "hidden" }, pe = {
|
|
|
242
244
|
heatmap: ["heatmap-opacity"],
|
|
243
245
|
"fill-extrusion": ["fill-extrusion-opacity"]
|
|
244
246
|
};
|
|
245
|
-
function
|
|
246
|
-
return
|
|
247
|
+
function xe() {
|
|
248
|
+
return W({
|
|
247
249
|
visible: {},
|
|
248
250
|
opacity: {}
|
|
249
251
|
});
|
|
250
252
|
}
|
|
251
|
-
function
|
|
253
|
+
function Se(e, t, n) {
|
|
252
254
|
let r = {}, i = {};
|
|
253
255
|
for (let e of n?.layers ?? []) {
|
|
254
256
|
let n = t.getLayer(e.id);
|
|
255
257
|
if (!n) continue;
|
|
256
258
|
r[e.id] = t.getLayoutProperty(e.id, "visibility") !== "none";
|
|
257
|
-
let a =
|
|
259
|
+
let a = be[n.type]?.[0], o = a ? t.getPaintProperty(e.id, a) : void 0;
|
|
258
260
|
i[e.id] = typeof o == "number" ? o : 1;
|
|
259
261
|
}
|
|
260
262
|
e.visible = r, e.opacity = i;
|
|
261
263
|
}
|
|
262
|
-
function
|
|
263
|
-
let t =
|
|
264
|
+
function Ce(e) {
|
|
265
|
+
let t = fe(e);
|
|
264
266
|
if (!t) throw Error("useMapLayers() must be called in a component inside <MMap>, or be given one");
|
|
265
|
-
let { map: n, model: r, layerState: i } = t, a =
|
|
267
|
+
let { map: n, model: r, layerState: i } = t, a = E(() => r.value?.layers ?? []), o = E(() => new Map(a.value.map((e) => [e.id, e])));
|
|
266
268
|
function s(e) {
|
|
267
269
|
return i.visible[e] ?? !0;
|
|
268
270
|
}
|
|
@@ -279,7 +281,7 @@ function xe(e) {
|
|
|
279
281
|
}
|
|
280
282
|
function d(e, t) {
|
|
281
283
|
let r = n.value, a = r?.getLayer(e);
|
|
282
|
-
if (a) for (let n of
|
|
284
|
+
if (a) for (let n of be[a.type] ?? []) r.setPaintProperty(e, n, t);
|
|
283
285
|
i.opacity[e] = t;
|
|
284
286
|
for (let n of o.value.get(e)?.children ?? []) d(n, t);
|
|
285
287
|
}
|
|
@@ -293,12 +295,12 @@ function xe(e) {
|
|
|
293
295
|
function m(e, t) {
|
|
294
296
|
for (let n of f(e)) c(n.id, t);
|
|
295
297
|
}
|
|
296
|
-
let h =
|
|
298
|
+
let h = E(() => a.value.filter((e) => e.base)), g = E(() => h.value.find((e) => s(e.id))?.id ?? null);
|
|
297
299
|
function _(e) {
|
|
298
300
|
for (let t of h.value) c(t.id, t.id === e);
|
|
299
301
|
}
|
|
300
302
|
return {
|
|
301
|
-
model:
|
|
303
|
+
model: E(() => r.value),
|
|
302
304
|
layers: a,
|
|
303
305
|
isVisible: s,
|
|
304
306
|
setVisible: c,
|
|
@@ -314,13 +316,13 @@ function xe(e) {
|
|
|
314
316
|
};
|
|
315
317
|
}
|
|
316
318
|
// src/composables/_mapStyle.ts
|
|
317
|
-
function
|
|
319
|
+
function $(e) {
|
|
318
320
|
return {
|
|
319
321
|
sources: new Set(Object.keys(e?.sources ?? {})),
|
|
320
322
|
layers: new Set((e?.layers ?? []).map((e) => e.id))
|
|
321
323
|
};
|
|
322
324
|
}
|
|
323
|
-
function
|
|
325
|
+
function we(e, t, n, r = () => !0) {
|
|
324
326
|
if (!e) return t;
|
|
325
327
|
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 };
|
|
326
328
|
for (let [t, r] of Object.entries(e.sources)) !n.sources.has(t) && !(t in o) && (o[t] = r);
|
|
@@ -331,7 +333,7 @@ function Se(e, t, n, r = () => !0) {
|
|
|
331
333
|
};
|
|
332
334
|
}
|
|
333
335
|
// src/components/MMap.vue?vue&type=script&setup=true&lang.ts
|
|
334
|
-
var
|
|
336
|
+
var Te = 600, Ee = /* @__PURE__ */ P({
|
|
335
337
|
__name: "MMap",
|
|
336
338
|
props: {
|
|
337
339
|
mapStyle: {},
|
|
@@ -381,17 +383,17 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
381
383
|
"update:pitch"
|
|
382
384
|
],
|
|
383
385
|
setup(e, { expose: t, emit: n }) {
|
|
384
|
-
let r = e, i = n, a =
|
|
386
|
+
let r = e, i = n, a = G(), o = G(), l = q(), u = q(), d = G(0), f, p = q(), m = xe(), h = {
|
|
385
387
|
map: l,
|
|
386
388
|
maplibre: u,
|
|
387
389
|
styleVersion: d,
|
|
388
390
|
model: p,
|
|
389
391
|
layerState: m,
|
|
390
|
-
activeTool:
|
|
392
|
+
activeTool: G(null)
|
|
391
393
|
};
|
|
392
|
-
|
|
394
|
+
U(de, h);
|
|
393
395
|
function g(e) {
|
|
394
|
-
p.value = r.adapter ? r.adapter(e.getStyle(), { styleUrl: typeof r.mapStyle == "string" ? r.mapStyle : void 0 }) : void 0,
|
|
396
|
+
p.value = r.adapter ? r.adapter(e.getStyle(), { styleUrl: typeof r.mapStyle == "string" ? r.mapStyle : void 0 }) : void 0, Se(m, e, p.value);
|
|
395
397
|
}
|
|
396
398
|
let _ = s(), v = () => typeof r.persist == "string" ? r.persist : r.persist ? c("m3-map-view") : null;
|
|
397
399
|
function y() {
|
|
@@ -436,19 +438,19 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
436
438
|
unit: "metric"
|
|
437
439
|
})
|
|
438
440
|
}
|
|
439
|
-
},
|
|
440
|
-
function
|
|
441
|
+
}, S = /* @__PURE__ */ new Map();
|
|
442
|
+
function C(e) {
|
|
441
443
|
let t = l.value, n = u.value;
|
|
442
444
|
if (!t || !n) return;
|
|
443
|
-
let i =
|
|
444
|
-
i && (t.removeControl(i),
|
|
445
|
+
let i = S.get(e);
|
|
446
|
+
i && (t.removeControl(i), S.delete(e));
|
|
445
447
|
let a = r[e];
|
|
446
448
|
if (!a) return;
|
|
447
449
|
let o = x[e].create(n);
|
|
448
|
-
t.addControl(o, a === !0 ? x[e].corner : a),
|
|
450
|
+
t.addControl(o, a === !0 ? x[e].corner : a), S.set(e, o);
|
|
449
451
|
}
|
|
450
|
-
for (let e of Object.keys(x))
|
|
451
|
-
function
|
|
452
|
+
for (let e of Object.keys(x)) Z(() => r[e], () => C(e));
|
|
453
|
+
function w() {
|
|
452
454
|
return {
|
|
453
455
|
"AttributionControl.ToggleAttribution": _.mapToggleAttribution,
|
|
454
456
|
"AttributionControl.MapFeedback": _.mapFeedback,
|
|
@@ -467,74 +469,74 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
467
469
|
"CooperativeGesturesHandler.MobileHelpText": _.mapTwoFingers
|
|
468
470
|
};
|
|
469
471
|
}
|
|
470
|
-
let
|
|
471
|
-
function
|
|
472
|
+
let E = G(null), j, M;
|
|
473
|
+
function P(e) {
|
|
472
474
|
let t = e.getAttribute("title");
|
|
473
475
|
t && e.closest(".maplibregl-ctrl") && (e.setAttribute("data-m3-tip", t), e.hasAttribute("aria-label") || e.setAttribute("aria-label", t), e.removeAttribute("title"));
|
|
474
476
|
}
|
|
475
|
-
function
|
|
477
|
+
function F(e) {
|
|
476
478
|
let t = e.getAttribute("data-m3-tip"), n = a.value?.getBoundingClientRect();
|
|
477
479
|
if (!t || !n) return;
|
|
478
480
|
let r = e.getBoundingClientRect(), i = r.left + r.width / 2 > n.left + n.width / 2;
|
|
479
|
-
|
|
481
|
+
E.value = {
|
|
480
482
|
text: t,
|
|
481
483
|
left: i,
|
|
482
484
|
x: (i ? r.left - 8 : r.right + 8) - n.left,
|
|
483
485
|
y: r.top + r.height / 2 - n.top
|
|
484
486
|
};
|
|
485
487
|
}
|
|
486
|
-
function
|
|
487
|
-
clearTimeout(
|
|
488
|
+
function I() {
|
|
489
|
+
clearTimeout(j), E.value = null;
|
|
488
490
|
}
|
|
489
|
-
let
|
|
490
|
-
function
|
|
491
|
-
let t =
|
|
492
|
-
t && e.pointerType !== "touch" && (clearTimeout(
|
|
491
|
+
let R = (e) => e.target?.closest?.(".maplibregl-ctrl [data-m3-tip]") ?? null;
|
|
492
|
+
function ee(e) {
|
|
493
|
+
let t = R(e);
|
|
494
|
+
t && e.pointerType !== "touch" && (clearTimeout(j), j = setTimeout(() => F(t), Te));
|
|
493
495
|
}
|
|
494
|
-
function
|
|
495
|
-
let t =
|
|
496
|
-
t && !t.contains(e.relatedTarget) &&
|
|
496
|
+
function W(e) {
|
|
497
|
+
let t = R(e);
|
|
498
|
+
t && !t.contains(e.relatedTarget) && I();
|
|
497
499
|
}
|
|
498
|
-
function
|
|
499
|
-
let t =
|
|
500
|
-
t?.matches(":focus-visible") &&
|
|
500
|
+
function re(e) {
|
|
501
|
+
let t = R(e);
|
|
502
|
+
t?.matches(":focus-visible") && F(t);
|
|
501
503
|
}
|
|
502
504
|
B(() => {
|
|
503
505
|
let e = a.value;
|
|
504
|
-
e && (e.querySelectorAll("[title]").forEach(
|
|
505
|
-
for (let t of e) t.type === "attributes" ?
|
|
506
|
-
e instanceof Element && (
|
|
506
|
+
e && (e.querySelectorAll("[title]").forEach(P), M = new MutationObserver((e) => {
|
|
507
|
+
for (let t of e) t.type === "attributes" ? P(t.target) : t.addedNodes.forEach((e) => {
|
|
508
|
+
e instanceof Element && (P(e), e.querySelectorAll("[title]").forEach(P));
|
|
507
509
|
});
|
|
508
|
-
}),
|
|
510
|
+
}), M.observe(e, {
|
|
509
511
|
subtree: !0,
|
|
510
512
|
childList: !0,
|
|
511
513
|
attributes: !0,
|
|
512
514
|
attributeFilter: ["title"]
|
|
513
515
|
}));
|
|
514
|
-
}),
|
|
515
|
-
|
|
516
|
+
}), ne(() => {
|
|
517
|
+
M?.disconnect(), clearTimeout(j);
|
|
516
518
|
});
|
|
517
|
-
let
|
|
519
|
+
let Y = !1;
|
|
518
520
|
B(async () => {
|
|
519
521
|
let e = await import("maplibre-gl"), t = "Map" in e ? e : e.default;
|
|
520
|
-
if (
|
|
521
|
-
let n = r.workerUrl ??
|
|
522
|
+
if (Y || !o.value) return;
|
|
523
|
+
let n = r.workerUrl ?? ue();
|
|
522
524
|
n && t.setWorkerUrl(n);
|
|
523
525
|
let a = y(), s = {
|
|
524
526
|
center: a.center ?? r.center,
|
|
525
527
|
zoom: a.zoom ?? r.zoom,
|
|
526
528
|
bearing: a.bearing ?? r.bearing,
|
|
527
529
|
pitch: a.pitch ?? r.pitch
|
|
528
|
-
}, c =
|
|
530
|
+
}, c = L(new t.Map({
|
|
529
531
|
container: o.value,
|
|
530
532
|
style: r.mapStyle,
|
|
531
533
|
attributionControl: !1,
|
|
532
|
-
locale:
|
|
534
|
+
locale: w(),
|
|
533
535
|
...Object.fromEntries(Object.entries(s).filter(([, e]) => e !== void 0)),
|
|
534
536
|
...r.options
|
|
535
537
|
}));
|
|
536
538
|
u.value = t, c.on("style.load", () => {
|
|
537
|
-
f ||=
|
|
539
|
+
f ||= $(c.getStyle()), g(c), d.value++;
|
|
538
540
|
}), c.on("click", (e) => i("click", e)), c.on("moveend", () => {
|
|
539
541
|
let e = b(c);
|
|
540
542
|
i("update:center", e.center), i("update:zoom", e.zoom), i("update:bearing", e.bearing), i("update:pitch", e.pitch);
|
|
@@ -544,87 +546,87 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
544
546
|
} catch {}
|
|
545
547
|
}), c.once("load", () => {
|
|
546
548
|
l.value = c;
|
|
547
|
-
for (let e of Object.keys(x))
|
|
549
|
+
for (let e of Object.keys(x)) C(e);
|
|
548
550
|
i("ready", c);
|
|
549
551
|
});
|
|
550
|
-
}),
|
|
551
|
-
|
|
552
|
+
}), V(() => {
|
|
553
|
+
Y = !0, l.value?.remove(), l.value = void 0;
|
|
552
554
|
});
|
|
553
|
-
let
|
|
554
|
-
return
|
|
555
|
+
let X = (e, t) => Math.abs(e - t) < 1e-9;
|
|
556
|
+
return Z(() => r.center?.join(","), () => {
|
|
555
557
|
let e = l.value;
|
|
556
558
|
if (!e || !r.center) return;
|
|
557
559
|
let t = e.getCenter();
|
|
558
|
-
|
|
559
|
-
}),
|
|
560
|
-
l.value && e !== void 0 && !
|
|
561
|
-
}),
|
|
562
|
-
l.value && e !== void 0 && !
|
|
563
|
-
}),
|
|
564
|
-
l.value && e !== void 0 && !
|
|
565
|
-
}),
|
|
560
|
+
X(t.lng, r.center[0]) && X(t.lat, r.center[1]) || e.jumpTo({ center: r.center });
|
|
561
|
+
}), Z(() => r.zoom, (e) => {
|
|
562
|
+
l.value && e !== void 0 && !X(l.value.getZoom(), e) && l.value.jumpTo({ zoom: e });
|
|
563
|
+
}), Z(() => r.bearing, (e) => {
|
|
564
|
+
l.value && e !== void 0 && !X(l.value.getBearing(), e) && l.value.jumpTo({ bearing: e });
|
|
565
|
+
}), Z(() => r.pitch, (e) => {
|
|
566
|
+
l.value && e !== void 0 && !X(l.value.getPitch(), e) && l.value.jumpTo({ pitch: e });
|
|
567
|
+
}), Z(() => r.adapter, () => {
|
|
566
568
|
l.value && g(l.value);
|
|
567
|
-
}),
|
|
569
|
+
}), Z(() => r.mapStyle, (e) => l.value?.setStyle(e, {
|
|
568
570
|
diff: !1,
|
|
569
571
|
transformStyle: (e, t) => {
|
|
570
|
-
let n = f ??
|
|
571
|
-
f =
|
|
572
|
-
let i = r.keepLayers, a = i === !1 ? t :
|
|
572
|
+
let n = f ?? $(void 0);
|
|
573
|
+
f = $(t);
|
|
574
|
+
let i = r.keepLayers, a = i === !1 ? t : we(e, t, n, typeof i == "function" ? i : void 0);
|
|
573
575
|
return r.transformStyle && (a = r.transformStyle(e, a)), a;
|
|
574
576
|
}
|
|
575
577
|
})), t({
|
|
576
578
|
map: l,
|
|
577
579
|
context: h
|
|
578
|
-
}), (t, n) => (
|
|
580
|
+
}), (t, n) => (H(), k("div", {
|
|
579
581
|
ref_key: "root",
|
|
580
582
|
ref: a,
|
|
581
583
|
class: "m3-map relative overflow-hidden",
|
|
582
|
-
onPointerover:
|
|
583
|
-
onPointerout:
|
|
584
|
-
onPointerdown:
|
|
585
|
-
onFocusin:
|
|
586
|
-
onFocusout:
|
|
584
|
+
onPointerover: ee,
|
|
585
|
+
onPointerout: W,
|
|
586
|
+
onPointerdown: I,
|
|
587
|
+
onFocusin: re,
|
|
588
|
+
onFocusout: I
|
|
587
589
|
}, [
|
|
588
|
-
|
|
590
|
+
A("div", {
|
|
589
591
|
ref_key: "container",
|
|
590
592
|
ref: o,
|
|
591
593
|
class: "h-full w-full"
|
|
592
594
|
}, null, 512),
|
|
593
|
-
l.value && e.attribution ? (
|
|
595
|
+
l.value && e.attribution ? (H(), D(ye, {
|
|
594
596
|
key: 0,
|
|
595
597
|
position: e.attribution === !0 ? "bottom-right" : e.attribution
|
|
596
|
-
}, null, 8, ["position"])) :
|
|
597
|
-
l.value ?
|
|
598
|
-
|
|
598
|
+
}, null, 8, ["position"])) : O("", !0),
|
|
599
|
+
l.value ? K(t.$slots, "default", {}, void 0, void 0, 1) : O("", !0),
|
|
600
|
+
N(T, {
|
|
599
601
|
"enter-active-class": "transition-opacity duration-150",
|
|
600
602
|
"enter-from-class": "opacity-0",
|
|
601
603
|
"leave-active-class": "transition-opacity duration-100",
|
|
602
604
|
"leave-to-class": "opacity-0"
|
|
603
605
|
}, {
|
|
604
|
-
default:
|
|
606
|
+
default: Q(() => [E.value ? (H(), k("div", {
|
|
605
607
|
key: 0,
|
|
606
608
|
role: "tooltip",
|
|
607
|
-
class:
|
|
608
|
-
style:
|
|
609
|
-
left: `${
|
|
610
|
-
top: `${
|
|
609
|
+
class: z(["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", E.value.left ? "-translate-x-full" : ""]),
|
|
610
|
+
style: te({
|
|
611
|
+
left: `${E.value.x}px`,
|
|
612
|
+
top: `${E.value.y}px`
|
|
611
613
|
})
|
|
612
|
-
},
|
|
614
|
+
}, J(E.value.text), 7)) : O("", !0)]),
|
|
613
615
|
_: 1
|
|
614
616
|
})
|
|
615
617
|
], 544));
|
|
616
618
|
}
|
|
617
|
-
}),
|
|
619
|
+
}), De = 13.5, Oe = De / Math.SQRT2, ke = [0, -14], Ae = {
|
|
618
620
|
center: [0, 0],
|
|
619
621
|
top: [0, 0],
|
|
620
622
|
"top-left": [0, 0],
|
|
621
623
|
"top-right": [0, 0],
|
|
622
624
|
bottom: [0, -38.1],
|
|
623
|
-
"bottom-left": [
|
|
624
|
-
"bottom-right": [-
|
|
625
|
-
left: [
|
|
625
|
+
"bottom-left": [Oe, (24.6 + Oe) * -1],
|
|
626
|
+
"bottom-right": [-Oe, (24.6 + Oe) * -1],
|
|
627
|
+
left: [De, -24.6],
|
|
626
628
|
right: [-13.5, -24.6]
|
|
627
|
-
},
|
|
629
|
+
}, je = { class: "hidden" }, Me = /* @__PURE__ */ P({
|
|
628
630
|
inheritAttrs: !1,
|
|
629
631
|
__name: "MMapMarker",
|
|
630
632
|
props: {
|
|
@@ -640,7 +642,7 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
640
642
|
},
|
|
641
643
|
emits: ["update:lngLat", "click"],
|
|
642
644
|
setup(e, { expose: t, emit: n }) {
|
|
643
|
-
let r = e, i = n, a =
|
|
645
|
+
let r = e, i = n, a = ae(), o = G(), s = G(), { onReady: c } = pe(), l, u = !1;
|
|
644
646
|
c((e, t) => {
|
|
645
647
|
u = !!a.default && !!o.value, l = new t.Marker({
|
|
646
648
|
...u ? { element: o.value } : { color: r.color ?? "currentColor" },
|
|
@@ -659,20 +661,20 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
659
661
|
function d(e) {
|
|
660
662
|
i("click", e);
|
|
661
663
|
}
|
|
662
|
-
return
|
|
664
|
+
return Z(() => r.lngLat.join(","), () => l?.setLngLat(r.lngLat)), Z(() => r.draggable, (e) => l?.setDraggable(e)), Z(() => r.rotation, (e) => l?.setRotation(e)), Z(() => r.offset?.join(","), () => l?.setOffset(r.offset ?? (u ? [0, 0] : ke))), ne(() => {
|
|
663
665
|
l?.getElement().removeEventListener("click", d), l?.getPopup()?.remove(), l?.remove();
|
|
664
|
-
}), t({ marker: () => l }), (e, t) => (
|
|
666
|
+
}), t({ marker: () => l }), (e, t) => (H(), k("div", je, [e.$slots.default ? (H(), k("div", R({
|
|
665
667
|
key: 0,
|
|
666
668
|
ref_key: "content",
|
|
667
669
|
ref: o,
|
|
668
670
|
class: "m3-map-marker"
|
|
669
|
-
}, e.$attrs), [
|
|
671
|
+
}, e.$attrs), [K(e.$slots, "default")], 16)) : O("", !0), e.$slots.popup ? (H(), k("div", {
|
|
670
672
|
key: 1,
|
|
671
673
|
ref_key: "popupContent",
|
|
672
674
|
ref: s
|
|
673
|
-
}, [
|
|
675
|
+
}, [K(e.$slots, "popup")], 512)) : O("", !0)]));
|
|
674
676
|
}
|
|
675
|
-
}),
|
|
677
|
+
}), Ne = { class: "hidden" }, Pe = /* @__PURE__ */ P({
|
|
676
678
|
inheritAttrs: !1,
|
|
677
679
|
__name: "MMapPopup",
|
|
678
680
|
props: {
|
|
@@ -695,7 +697,7 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
695
697
|
},
|
|
696
698
|
emits: ["update:open"],
|
|
697
699
|
setup(e, { expose: t, emit: n }) {
|
|
698
|
-
let r = e, i = n, a =
|
|
700
|
+
let r = e, i = n, a = G(), { onReady: o } = pe(), s, c, l = !1;
|
|
699
701
|
function u() {
|
|
700
702
|
s && c && !s.isOpen() && s.setLngLat(r.lngLat).addTo(c);
|
|
701
703
|
}
|
|
@@ -711,16 +713,16 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
711
713
|
}), a.value && s.setDOMContent(a.value), s.on("close", () => {
|
|
712
714
|
l || i("update:open", !1);
|
|
713
715
|
}), r.open && u();
|
|
714
|
-
}),
|
|
716
|
+
}), Z(() => r.open, (e) => {
|
|
715
717
|
e ? u() : s?.isOpen() && (l = !0, s.remove(), l = !1);
|
|
716
|
-
}),
|
|
718
|
+
}), Z(() => r.lngLat.join(","), () => s?.setLngLat(r.lngLat)), Z(() => r.maxWidth, (e) => s?.setMaxWidth(e)), Z(() => r.offset, (e) => s?.setOffset(e ?? 0)), ne(() => {
|
|
717
719
|
l = !0, s?.remove();
|
|
718
|
-
}), t({ popup: () => s }), (e, t) => (
|
|
720
|
+
}), t({ popup: () => s }), (e, t) => (H(), k("div", Ne, [A("div", R({
|
|
719
721
|
ref_key: "content",
|
|
720
722
|
ref: a
|
|
721
|
-
}, e.$attrs), [
|
|
723
|
+
}, e.$attrs), [K(e.$slots, "default")], 16)]));
|
|
722
724
|
}
|
|
723
|
-
}),
|
|
725
|
+
}), Fe = /* @__PURE__ */ P({
|
|
724
726
|
inheritAttrs: !1,
|
|
725
727
|
__name: "MMapGeoJson",
|
|
726
728
|
props: {
|
|
@@ -736,13 +738,13 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
736
738
|
},
|
|
737
739
|
emits: ["click"],
|
|
738
740
|
setup(e, { expose: t, emit: n }) {
|
|
739
|
-
let r = e, i = n, a = r.id ?? `m3-geojson-${ie()}`, { onReady: o, styleVersion: s } =
|
|
741
|
+
let r = e, i = n, a = r.id ?? `m3-geojson-${ie()}`, { onReady: o, styleVersion: s } = pe(), c = l(["primary", "surface"]), u = (...e) => [
|
|
740
742
|
"match",
|
|
741
743
|
["geometry-type"],
|
|
742
744
|
e,
|
|
743
745
|
!0,
|
|
744
746
|
!1
|
|
745
|
-
], d =
|
|
747
|
+
], d = E(() => {
|
|
746
748
|
let { primary: e, surface: t } = c.value;
|
|
747
749
|
return [
|
|
748
750
|
{
|
|
@@ -775,7 +777,7 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
775
777
|
}
|
|
776
778
|
}
|
|
777
779
|
];
|
|
778
|
-
}), f =
|
|
780
|
+
}), f = E(() => (r.layers ?? d.value).map((e, t) => ({
|
|
779
781
|
...e,
|
|
780
782
|
id: e.id ?? `${a}-${t}`,
|
|
781
783
|
source: a
|
|
@@ -805,14 +807,14 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
805
807
|
}
|
|
806
808
|
return o((e) => {
|
|
807
809
|
p = e, b();
|
|
808
|
-
}),
|
|
810
|
+
}), Z(s, () => b()), Z(() => r.data, (e) => (p?.getSource(a))?.setData(e)), Z(() => JSON.stringify(f.value), () => y()), Z(() => r.before, () => y()), ne(() => {
|
|
809
811
|
p &&= (v(), p.getSource(a) && p.removeSource(a), void 0);
|
|
810
812
|
}), t({
|
|
811
813
|
sourceId: a,
|
|
812
814
|
layerIds: () => [...m]
|
|
813
815
|
}), (e, t) => null;
|
|
814
816
|
}
|
|
815
|
-
}),
|
|
817
|
+
}), Ie = ["aria-label", "onClick"], Le = /* @__PURE__ */ P({
|
|
816
818
|
inheritAttrs: !1,
|
|
817
819
|
__name: "MMapCluster",
|
|
818
820
|
props: {
|
|
@@ -835,12 +837,12 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
835
837
|
},
|
|
836
838
|
emits: ["click", "cluster-click"],
|
|
837
839
|
setup(e, { expose: t, emit: n }) {
|
|
838
|
-
let r = e, i = n, a = r.id ?? `m3-cluster-${ie()}`, o = s(), { onReady: c, styleVersion: u } =
|
|
840
|
+
let r = e, i = n, a = r.id ?? `m3-cluster-${ie()}`, o = s(), { onReady: c, styleVersion: u } = pe(), d = l([
|
|
839
841
|
"primary",
|
|
840
842
|
"secondary",
|
|
841
843
|
"tertiary",
|
|
842
844
|
"surface"
|
|
843
|
-
]), f = ["!", ["has", "point_count"]], p =
|
|
845
|
+
]), f = ["!", ["has", "point_count"]], p = E(() => {
|
|
844
846
|
let e = d.value[r.color];
|
|
845
847
|
return (r.pointLayers ?? [{
|
|
846
848
|
type: "circle",
|
|
@@ -864,36 +866,36 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
864
866
|
function h(e) {
|
|
865
867
|
return e < 10 ? 32 : e < 100 ? 40 : e < 1e3 ? 48 : 56;
|
|
866
868
|
}
|
|
867
|
-
let g =
|
|
869
|
+
let g = E(() => {
|
|
868
870
|
let e = typeof document < "u" && document.documentElement.lang || void 0;
|
|
869
871
|
return new Intl.NumberFormat(e, {
|
|
870
872
|
notation: "compact",
|
|
871
873
|
maximumFractionDigits: 1
|
|
872
874
|
});
|
|
873
|
-
}), _, v, y = [],
|
|
874
|
-
function
|
|
875
|
+
}), _, v, y = [], b = /* @__PURE__ */ new Map(), x = q([]), S = () => _?.getSource(a);
|
|
876
|
+
function T(e, t, n) {
|
|
875
877
|
return {
|
|
876
878
|
id: e,
|
|
877
879
|
count: t,
|
|
878
880
|
lngLat: n,
|
|
879
881
|
zoomIn: async () => {
|
|
880
|
-
let t = await
|
|
882
|
+
let t = await S()?.getClusterExpansionZoom(e);
|
|
881
883
|
t !== void 0 && _ && _.easeTo({
|
|
882
884
|
center: n,
|
|
883
885
|
zoom: Math.min(t, _.getMaxZoom())
|
|
884
886
|
});
|
|
885
887
|
},
|
|
886
|
-
leaves: async (t = Infinity) => await
|
|
888
|
+
leaves: async (t = Infinity) => await S()?.getClusterLeaves(e, t, 0) ?? []
|
|
887
889
|
};
|
|
888
890
|
}
|
|
889
|
-
function
|
|
891
|
+
function O() {
|
|
890
892
|
if (j = 0, !_ || !v || !_.getSource(a)) return;
|
|
891
893
|
let e = /* @__PURE__ */ new Set();
|
|
892
894
|
for (let t of _.querySourceFeatures(a, { filter: ["has", "point_count"] })) {
|
|
893
895
|
let n = t.properties, r = n.cluster_id;
|
|
894
896
|
if (e.has(r)) continue;
|
|
895
897
|
e.add(r);
|
|
896
|
-
let [i, a] = t.geometry.coordinates, o =
|
|
898
|
+
let [i, a] = t.geometry.coordinates, o = b.get(r);
|
|
897
899
|
if (o && o.count === n.point_count) {
|
|
898
900
|
o.marker.setLngLat([i, a]);
|
|
899
901
|
continue;
|
|
@@ -905,18 +907,18 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
905
907
|
element: s,
|
|
906
908
|
anchor: "center"
|
|
907
909
|
}).setLngLat([i, a]).addTo(_);
|
|
908
|
-
|
|
909
|
-
...
|
|
910
|
+
b.set(r, {
|
|
911
|
+
...T(r, n.point_count, [i, a]),
|
|
910
912
|
el: s,
|
|
911
913
|
marker: c
|
|
912
914
|
});
|
|
913
915
|
}
|
|
914
|
-
for (let [t, n] of
|
|
915
|
-
|
|
916
|
+
for (let [t, n] of b) e.has(t) || (n.marker.remove(), b.delete(t));
|
|
917
|
+
x.value = [...b.values()];
|
|
916
918
|
}
|
|
917
919
|
let j = 0;
|
|
918
920
|
function M() {
|
|
919
|
-
j ||= requestAnimationFrame(
|
|
921
|
+
j ||= requestAnimationFrame(O);
|
|
920
922
|
}
|
|
921
923
|
let N = (e) => {
|
|
922
924
|
e.sourceId === a && M();
|
|
@@ -925,19 +927,19 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
925
927
|
}, I = () => {
|
|
926
928
|
r.interactive && _ && (_.getCanvas().style.cursor = "");
|
|
927
929
|
};
|
|
928
|
-
function
|
|
930
|
+
function L() {
|
|
929
931
|
if (_) {
|
|
930
932
|
for (let e of y) _.off("click", e, P), _.off("mouseenter", e, F), _.off("mouseleave", e, I), _.getLayer(e) && _.removeLayer(e);
|
|
931
933
|
y = [];
|
|
932
934
|
}
|
|
933
935
|
}
|
|
934
|
-
function
|
|
936
|
+
function R() {
|
|
935
937
|
if (_) {
|
|
936
|
-
|
|
938
|
+
L();
|
|
937
939
|
for (let e of p.value) _.addLayer(e, r.before && _.getLayer(r.before) ? r.before : void 0), _.on("click", e.id, P), _.on("mouseenter", e.id, F), _.on("mouseleave", e.id, I), y.push(e.id);
|
|
938
940
|
}
|
|
939
941
|
}
|
|
940
|
-
function
|
|
942
|
+
function ee() {
|
|
941
943
|
return {
|
|
942
944
|
type: "geojson",
|
|
943
945
|
data: r.data,
|
|
@@ -947,22 +949,22 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
947
949
|
clusterMaxZoom: r.maxZoom
|
|
948
950
|
};
|
|
949
951
|
}
|
|
950
|
-
function
|
|
951
|
-
_ && (_.getSource(a) || (_.addSource(a,
|
|
952
|
+
function B() {
|
|
953
|
+
_ && (_.getSource(a) || (_.addSource(a, ee()), y = []), y.length && _.getLayer(y[0]) || R(), M());
|
|
952
954
|
}
|
|
953
|
-
function
|
|
954
|
-
_ && (
|
|
955
|
+
function V() {
|
|
956
|
+
_ && (L(), _.getSource(a) && _.removeSource(a), B());
|
|
955
957
|
}
|
|
956
958
|
c((e, t) => {
|
|
957
|
-
_ = e, v = t,
|
|
958
|
-
}),
|
|
959
|
-
|
|
960
|
-
}),
|
|
959
|
+
_ = e, v = t, B(), _.on("sourcedata", N), _.on("move", M), _.on("moveend", M);
|
|
960
|
+
}), Z(u, () => B()), Z(() => r.data, (e) => {
|
|
961
|
+
S()?.setData(e), M();
|
|
962
|
+
}), Z(() => [
|
|
961
963
|
r.radius,
|
|
962
964
|
r.maxZoom,
|
|
963
965
|
JSON.stringify(r.sourceOptions)
|
|
964
|
-
].join("|"),
|
|
965
|
-
function
|
|
966
|
+
].join("|"), V), Z(() => JSON.stringify(p.value), () => R()), Z(() => r.before, () => R());
|
|
967
|
+
function U(e) {
|
|
966
968
|
let t = {
|
|
967
969
|
id: e.id,
|
|
968
970
|
count: e.count,
|
|
@@ -972,55 +974,523 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
972
974
|
};
|
|
973
975
|
i("cluster-click", t), r.zoomOnClick && e.zoomIn();
|
|
974
976
|
}
|
|
975
|
-
let
|
|
976
|
-
return
|
|
977
|
+
let W = (e) => o.mapClusterZoom.replace("{count}", String(e));
|
|
978
|
+
return ne(() => {
|
|
977
979
|
j && cancelAnimationFrame(j);
|
|
978
|
-
for (let e of
|
|
979
|
-
|
|
980
|
+
for (let e of b.values()) e.marker.remove();
|
|
981
|
+
b.clear(), x.value = [], _ &&= (_.off("sourcedata", N), _.off("move", M), _.off("moveend", M), L(), _.getSource(a) && _.removeSource(a), void 0);
|
|
980
982
|
}), t({
|
|
981
983
|
sourceId: a,
|
|
982
984
|
layerIds: () => [...y],
|
|
983
|
-
clusters: () =>
|
|
985
|
+
clusters: () => x.value.map(({ id: e, count: t, lngLat: n, zoomIn: r, leaves: i }) => ({
|
|
984
986
|
id: e,
|
|
985
987
|
count: t,
|
|
986
988
|
lngLat: n,
|
|
987
989
|
zoomIn: r,
|
|
988
990
|
leaves: i
|
|
989
991
|
}))
|
|
990
|
-
}), (t, n) => (
|
|
992
|
+
}), (t, n) => (H(!0), k(C, null, re(x.value, (n) => (H(), D(w, {
|
|
991
993
|
key: n.id,
|
|
992
994
|
to: n.el
|
|
993
|
-
}, [
|
|
995
|
+
}, [K(t.$slots, "cluster", {
|
|
994
996
|
id: n.id,
|
|
995
997
|
count: n.count,
|
|
996
998
|
label: g.value.format(n.count),
|
|
997
999
|
lngLat: n.lngLat,
|
|
998
1000
|
zoomIn: n.zoomIn,
|
|
999
1001
|
leaves: n.leaves
|
|
1000
|
-
}, () => [
|
|
1002
|
+
}, () => [A("button", {
|
|
1001
1003
|
type: "button",
|
|
1002
|
-
class:
|
|
1003
|
-
style:
|
|
1004
|
+
class: z(["m3-map-cluster__bubble relative grid cursor-pointer place-items-center rounded-full border-2 border-surface text-label-large font-medium shadow-elevation-1 outline-none transition-[transform,box-shadow] duration-150 after:pointer-events-none after:absolute after:inset-0 after:rounded-full after:opacity-0 after:transition-opacity hover:shadow-elevation-2 hover:after:opacity-8 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-secondary active:after:opacity-10", m[e.color]]),
|
|
1005
|
+
style: te({
|
|
1004
1006
|
width: `${h(n.count)}px`,
|
|
1005
1007
|
height: `${h(n.count)}px`
|
|
1006
1008
|
}),
|
|
1007
|
-
"aria-label":
|
|
1008
|
-
onClick:
|
|
1009
|
-
},
|
|
1009
|
+
"aria-label": W(n.count),
|
|
1010
|
+
onClick: se((e) => U(n), ["stop"])
|
|
1011
|
+
}, J(g.value.format(n.count)), 15, Ie)])], 8, ["to"]))), 128));
|
|
1012
|
+
}
|
|
1013
|
+
}), Re = 6371008.8, ze = Math.PI / 180;
|
|
1014
|
+
function Be(e, t) {
|
|
1015
|
+
let n = (t[1] - e[1]) * ze, r = (t[0] - e[0]) * ze, i = Math.sin(n / 2) ** 2 + Math.cos(e[1] * ze) * Math.cos(t[1] * ze) * Math.sin(r / 2) ** 2;
|
|
1016
|
+
return 2 * Re * Math.asin(Math.min(1, Math.sqrt(i)));
|
|
1017
|
+
}
|
|
1018
|
+
function Ve(e) {
|
|
1019
|
+
let t = 0;
|
|
1020
|
+
for (let n = 1; n < e.length; n++) t += Be(e[n - 1], e[n]);
|
|
1021
|
+
return t;
|
|
1022
|
+
}
|
|
1023
|
+
function He(e, t) {
|
|
1024
|
+
let [n, r, i, a] = [
|
|
1025
|
+
e[0] * ze,
|
|
1026
|
+
e[1] * ze,
|
|
1027
|
+
t[0] * ze,
|
|
1028
|
+
t[1] * ze
|
|
1029
|
+
], 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));
|
|
1030
|
+
return [(n + Math.atan2(s, Math.cos(r) + o)) / ze, c / ze];
|
|
1031
|
+
}
|
|
1032
|
+
function Ue(e) {
|
|
1033
|
+
let t = We(e), n = t.length - 1;
|
|
1034
|
+
if (n <= 2) return 0;
|
|
1035
|
+
let r = 0;
|
|
1036
|
+
for (let e = 0; e < n; e++) {
|
|
1037
|
+
let i = t[e], a = t[e + 1 === n ? 0 : e + 1], o = t[e + 2 >= n ? (e + 2) % n : e + 2];
|
|
1038
|
+
r += (o[0] - i[0]) * ze * Math.sin(a[1] * ze);
|
|
1039
|
+
}
|
|
1040
|
+
return Math.abs(r * Re * Re / 2);
|
|
1041
|
+
}
|
|
1042
|
+
function We(e) {
|
|
1043
|
+
let t = e[0], n = e[e.length - 1];
|
|
1044
|
+
return t && n && (t[0] !== n[0] || t[1] !== n[1]) ? [...e, t] : e;
|
|
1045
|
+
}
|
|
1046
|
+
function Ge(e) {
|
|
1047
|
+
let t = We(e), n = 0, r = 0, i = 0;
|
|
1048
|
+
for (let e = 0; e < t.length - 1; e++) {
|
|
1049
|
+
let [a, o] = t[e], [s, c] = t[e + 1], l = a * c - s * o;
|
|
1050
|
+
n += l, r += (a + s) * l, i += (o + c) * l;
|
|
1051
|
+
}
|
|
1052
|
+
if (Math.abs(n) < 1e-12) {
|
|
1053
|
+
let e = t.slice(0, -1);
|
|
1054
|
+
return [e.reduce((e, t) => e + t[0], 0) / e.length, e.reduce((e, t) => e + t[1], 0) / e.length];
|
|
1055
|
+
}
|
|
1056
|
+
return [r / (3 * n), i / (3 * n)];
|
|
1057
|
+
}
|
|
1058
|
+
// src/composables/_routeGeometry.ts
|
|
1059
|
+
var Ke = Math.PI / 180;
|
|
1060
|
+
function qe(e) {
|
|
1061
|
+
let t = [0];
|
|
1062
|
+
for (let n = 1; n < e.length; n++) t.push(t[n - 1] + Be(e[n - 1], e[n]));
|
|
1063
|
+
return t;
|
|
1064
|
+
}
|
|
1065
|
+
function Je(e, t) {
|
|
1066
|
+
let n = e[1] * Ke, r = t[1] * Ke, i = (t[0] - e[0]) * Ke, a = Math.sin(i) * Math.cos(r), o = Math.cos(n) * Math.sin(r) - Math.sin(n) * Math.cos(r) * Math.cos(i);
|
|
1067
|
+
return (Math.atan2(a, o) / Ke + 360) % 360;
|
|
1068
|
+
}
|
|
1069
|
+
function Ye(e, t) {
|
|
1070
|
+
let n = 0, r = e.length - 1;
|
|
1071
|
+
for (; r - n > 1;) {
|
|
1072
|
+
let i = n + r >> 1;
|
|
1073
|
+
e[i] <= t ? n = i : r = i;
|
|
1010
1074
|
}
|
|
1011
|
-
|
|
1075
|
+
return n;
|
|
1076
|
+
}
|
|
1077
|
+
function Xe(e, t, n) {
|
|
1078
|
+
if (e.length === 0) return {
|
|
1079
|
+
lngLat: [0, 0],
|
|
1080
|
+
bearing: 0
|
|
1081
|
+
};
|
|
1082
|
+
if (e.length === 1) return {
|
|
1083
|
+
lngLat: e[0],
|
|
1084
|
+
bearing: 0
|
|
1085
|
+
};
|
|
1086
|
+
let r = t[t.length - 1], i = Math.min(Math.max(n, 0), r), a = Math.min(Ye(t, i), e.length - 2), o = e[a], s = e[a + 1], c = t[a + 1] - t[a], l = c > 0 ? (i - t[a]) / c : 0;
|
|
1087
|
+
return {
|
|
1088
|
+
lngLat: [o[0] + (s[0] - o[0]) * l, o[1] + (s[1] - o[1]) * l],
|
|
1089
|
+
bearing: Ze(e, t, a)
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
function Ze(e, t, n) {
|
|
1093
|
+
for (let r = n; r < e.length - 1; r++) if (t[r + 1] > t[r]) return Je(e[r], e[r + 1]);
|
|
1094
|
+
for (let r = n - 1; r >= 0; r--) if (t[r + 1] > t[r]) return Je(e[r], e[r + 1]);
|
|
1095
|
+
return 0;
|
|
1096
|
+
}
|
|
1097
|
+
function Qe(e, t, n, r) {
|
|
1098
|
+
if (e.length < 2) return [...e];
|
|
1099
|
+
let i = t[t.length - 1], a = Math.min(Math.max(n, 0), i), o = Math.min(Math.max(r, a), i), s = [Xe(e, t, a).lngLat];
|
|
1100
|
+
for (let n = 0; n < e.length; n++) t[n] > a && t[n] < o && s.push(e[n]);
|
|
1101
|
+
return s.push(Xe(e, t, o).lngLat), s;
|
|
1102
|
+
}
|
|
1103
|
+
function $e(e, t, n) {
|
|
1104
|
+
if (e.length < 2) return 0;
|
|
1105
|
+
let r = Math.cos(n[1] * Ke), i = Infinity, a = 0;
|
|
1106
|
+
for (let o = 0; o < e.length - 1; o++) {
|
|
1107
|
+
let s = e[o], c = e[o + 1], l = s[0] * r, u = s[1], d = c[0] * r, f = c[1], p = n[0] * r, m = n[1], h = d - l, g = f - u, _ = h * h + g * g, v = _ > 0 ? Math.min(1, Math.max(0, ((p - l) * h + (m - u) * g) / _)) : 0, y = l + h * v - p, b = u + g * v - m, x = y * y + b * b;
|
|
1108
|
+
x < i && (i = x, a = t[o] + (t[o + 1] - t[o]) * v);
|
|
1109
|
+
}
|
|
1110
|
+
return a;
|
|
1111
|
+
}
|
|
1112
|
+
function et(e, t, n, r, i = 25) {
|
|
1113
|
+
if (e.length < 2) return 0;
|
|
1114
|
+
let a = Math.cos(n[1] * Ke), o = t[t.length - 1];
|
|
1115
|
+
if (r >= o) return o;
|
|
1116
|
+
let s = Infinity, c = r;
|
|
1117
|
+
for (let o = 0; o < e.length - 1; o++) {
|
|
1118
|
+
if (t[o + 1] < r - i) continue;
|
|
1119
|
+
let l = e[o], u = e[o + 1], d = l[0] * a, f = l[1], p = u[0] * a, m = u[1], h = n[0] * a, g = n[1], _ = p - d, v = m - f, y = _ * _ + v * v, b = y > 0 ? Math.min(1, Math.max(0, ((h - d) * _ + (g - f) * v) / y)) : 0, x = Math.hypot(d + _ * b - h, f + v * b - g) * 111320, S = t[o] + (t[o + 1] - t[o]) * b, C = x + .05 * Math.max(0, S - r);
|
|
1120
|
+
C < s && (s = C, c = S);
|
|
1121
|
+
}
|
|
1122
|
+
return Math.max(c, r);
|
|
1123
|
+
}
|
|
1124
|
+
function tt(e) {
|
|
1125
|
+
let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
|
|
1126
|
+
for (let [a, o] of e) t = Math.min(t, a), r = Math.max(r, a), n = Math.min(n, o), i = Math.max(i, o);
|
|
1127
|
+
return [[t, n], [r, i]];
|
|
1128
|
+
}
|
|
1129
|
+
// src/components/MMapRoute.vue?vue&type=script&setup=true&lang.ts
|
|
1130
|
+
var nt = { class: "hidden" }, rt = ["aria-label", "title"], it = ["aria-label"], at = /* @__PURE__ */ P({
|
|
1131
|
+
inheritAttrs: !1,
|
|
1132
|
+
__name: "MMapRoute",
|
|
1133
|
+
props: {
|
|
1134
|
+
stops: {},
|
|
1135
|
+
path: {},
|
|
1136
|
+
progress: {},
|
|
1137
|
+
vehicle: {},
|
|
1138
|
+
vehicleIcon: { default: "navigation" },
|
|
1139
|
+
rotateVehicle: {
|
|
1140
|
+
type: Boolean,
|
|
1141
|
+
default: void 0
|
|
1142
|
+
},
|
|
1143
|
+
showVehicle: {
|
|
1144
|
+
type: Boolean,
|
|
1145
|
+
default: !0
|
|
1146
|
+
},
|
|
1147
|
+
duration: { default: 1e3 },
|
|
1148
|
+
fit: {
|
|
1149
|
+
type: Boolean,
|
|
1150
|
+
default: !0
|
|
1151
|
+
},
|
|
1152
|
+
follow: {
|
|
1153
|
+
type: Boolean,
|
|
1154
|
+
default: !1
|
|
1155
|
+
},
|
|
1156
|
+
padding: { default: 64 },
|
|
1157
|
+
color: {},
|
|
1158
|
+
flow: {
|
|
1159
|
+
type: Boolean,
|
|
1160
|
+
default: !0
|
|
1161
|
+
},
|
|
1162
|
+
width: { default: 5 },
|
|
1163
|
+
before: {},
|
|
1164
|
+
id: {},
|
|
1165
|
+
provider: {},
|
|
1166
|
+
snap: { default: "forward" }
|
|
1167
|
+
},
|
|
1168
|
+
emits: [
|
|
1169
|
+
"stop-click",
|
|
1170
|
+
"arrive",
|
|
1171
|
+
"route",
|
|
1172
|
+
"error"
|
|
1173
|
+
],
|
|
1174
|
+
setup(t, { expose: n, emit: r }) {
|
|
1175
|
+
let i = t, a = r, c = ae(), u = s(), d = i.id ?? `m3-route-${ie()}`, { onReady: f, styleVersion: p } = pe(), m = l([
|
|
1176
|
+
"primary",
|
|
1177
|
+
"outline",
|
|
1178
|
+
"surface"
|
|
1179
|
+
]), h = q(null), g = E(() => i.path && i.path.length > 1 ? i.path : h.value && h.value.length > 1 ? h.value : i.stops.map((e) => e.lngLat)), _ = E(() => JSON.stringify(g.value)), v = E(() => qe(g.value)), y = E(() => v.value[v.value.length - 1] ?? 0), b = E(() => {
|
|
1180
|
+
let e = 0;
|
|
1181
|
+
return i.stops.map((t) => e = et(g.value, v.value, t.lngLat, e, 0));
|
|
1182
|
+
}), x = null;
|
|
1183
|
+
function S() {
|
|
1184
|
+
if (i.vehicle) {
|
|
1185
|
+
let e = i.snap === "nearest" || x == null ? $e(g.value, v.value, i.vehicle) : et(g.value, v.value, i.vehicle, x);
|
|
1186
|
+
return x = e, e;
|
|
1187
|
+
}
|
|
1188
|
+
return x = null, i.progress != null && Number.isFinite(i.progress) ? Math.min(Math.max(i.progress, 0), 1) * y.value : null;
|
|
1189
|
+
}
|
|
1190
|
+
let w = G(S());
|
|
1191
|
+
Z([
|
|
1192
|
+
() => i.vehicle?.join(","),
|
|
1193
|
+
() => i.progress,
|
|
1194
|
+
() => i.snap
|
|
1195
|
+
], () => w.value = S());
|
|
1196
|
+
let T;
|
|
1197
|
+
async function O() {
|
|
1198
|
+
if (T?.abort(), !i.provider || i.path && i.path.length > 1 || i.stops.length < 2) {
|
|
1199
|
+
h.value = null;
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
let e = T = new AbortController();
|
|
1203
|
+
try {
|
|
1204
|
+
let t = await i.provider(i.stops.map((e) => e.lngLat), { signal: e.signal });
|
|
1205
|
+
if (e.signal.aborted) return;
|
|
1206
|
+
h.value = t.path, a("route", t);
|
|
1207
|
+
} catch (t) {
|
|
1208
|
+
e.signal.aborted || (h.value = null, a("error", t));
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
B(O), Z([
|
|
1212
|
+
() => JSON.stringify(i.stops.map((e) => e.lngLat)),
|
|
1213
|
+
() => i.provider,
|
|
1214
|
+
() => !!(i.path && i.path.length > 1)
|
|
1215
|
+
], () => O());
|
|
1216
|
+
let P = 0, F = G(0), I = G(0), L = 0, R = (e) => i.stops[e]?.done ?? (w.value != null && F.value >= b.value[e] - 1), ee = E(() => i.color ?? m.value.primary), V, U, W = G(), Y = [
|
|
1217
|
+
`${d}-rest`,
|
|
1218
|
+
`${d}-casing`,
|
|
1219
|
+
`${d}-done`
|
|
1220
|
+
];
|
|
1221
|
+
function oe(e) {
|
|
1222
|
+
let t = (e, t) => ({
|
|
1223
|
+
type: "Feature",
|
|
1224
|
+
properties: { part: t },
|
|
1225
|
+
geometry: {
|
|
1226
|
+
type: "LineString",
|
|
1227
|
+
coordinates: e
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
return {
|
|
1231
|
+
type: "FeatureCollection",
|
|
1232
|
+
features: [t(g.value, "rest"), t(Qe(g.value, v.value, 0, e), "done")]
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
function se() {
|
|
1236
|
+
let e = i.width, t = {
|
|
1237
|
+
"line-cap": "round",
|
|
1238
|
+
"line-join": "round"
|
|
1239
|
+
};
|
|
1240
|
+
return [
|
|
1241
|
+
{
|
|
1242
|
+
id: Y[0],
|
|
1243
|
+
type: "line",
|
|
1244
|
+
source: d,
|
|
1245
|
+
filter: [
|
|
1246
|
+
"==",
|
|
1247
|
+
["get", "part"],
|
|
1248
|
+
"rest"
|
|
1249
|
+
],
|
|
1250
|
+
layout: {
|
|
1251
|
+
"line-cap": "butt",
|
|
1252
|
+
"line-join": "round"
|
|
1253
|
+
},
|
|
1254
|
+
paint: {
|
|
1255
|
+
"line-color": m.value.outline,
|
|
1256
|
+
"line-width": e * .8,
|
|
1257
|
+
"line-dasharray": me(Math.max(_e, 0))
|
|
1258
|
+
}
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
id: Y[1],
|
|
1262
|
+
type: "line",
|
|
1263
|
+
source: d,
|
|
1264
|
+
filter: [
|
|
1265
|
+
"==",
|
|
1266
|
+
["get", "part"],
|
|
1267
|
+
"done"
|
|
1268
|
+
],
|
|
1269
|
+
layout: t,
|
|
1270
|
+
paint: {
|
|
1271
|
+
"line-color": m.value.surface,
|
|
1272
|
+
"line-width": e + 4
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
id: Y[2],
|
|
1277
|
+
type: "line",
|
|
1278
|
+
source: d,
|
|
1279
|
+
filter: [
|
|
1280
|
+
"==",
|
|
1281
|
+
["get", "part"],
|
|
1282
|
+
"done"
|
|
1283
|
+
],
|
|
1284
|
+
layout: t,
|
|
1285
|
+
paint: {
|
|
1286
|
+
"line-color": ee.value,
|
|
1287
|
+
"line-width": e
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
];
|
|
1291
|
+
}
|
|
1292
|
+
function ce() {
|
|
1293
|
+
if (V) {
|
|
1294
|
+
V.getSource(d) || V.addSource(d, {
|
|
1295
|
+
type: "geojson",
|
|
1296
|
+
data: oe(P),
|
|
1297
|
+
tolerance: 0
|
|
1298
|
+
});
|
|
1299
|
+
for (let e of se()) V.getLayer(e.id) && V.removeLayer(e.id), V.addLayer(e, i.before && V.getLayer(i.before) ? i.before : void 0);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
function le(e) {
|
|
1303
|
+
P = e;
|
|
1304
|
+
let { lngLat: t } = Xe(g.value, v.value, e), n = Ce(e);
|
|
1305
|
+
(V?.getSource(d))?.setData(oe(e)), U?.setLngLat(t), $.value && U?.setRotation(n), I.value = n, n > 200 && n < 340 ? de.value = !0 : n > 20 && n < 160 && (de.value = !1), i.follow && V?.jumpTo({ center: t }), ue(e) !== ue(F.value) && (F.value = e);
|
|
1306
|
+
}
|
|
1307
|
+
let ue = (e) => b.value.filter((t) => e >= t - 1).length, de = G(!1), fe = 1.6;
|
|
1308
|
+
function me(e) {
|
|
1309
|
+
let t = 2.6, n = e / 16 * t;
|
|
1310
|
+
return n <= fe ? [
|
|
1311
|
+
0,
|
|
1312
|
+
n,
|
|
1313
|
+
1,
|
|
1314
|
+
fe - n
|
|
1315
|
+
] : [
|
|
1316
|
+
n - fe,
|
|
1317
|
+
fe,
|
|
1318
|
+
t - n,
|
|
1319
|
+
0
|
|
1320
|
+
];
|
|
1321
|
+
}
|
|
1322
|
+
let he = 0, ge = 0, _e = -1;
|
|
1323
|
+
function ve(e) {
|
|
1324
|
+
let t = 2.6 * i.width * .8, n = Math.floor((e - ge) / 1e3 * 16 / t * 16) % 16;
|
|
1325
|
+
n !== _e && V?.getLayer(Y[0]) && (_e = n, V.setPaintProperty(Y[0], "line-dasharray", me(n))), he = requestAnimationFrame(ve);
|
|
1326
|
+
}
|
|
1327
|
+
let ye = !0, be;
|
|
1328
|
+
function xe() {
|
|
1329
|
+
!be && V && typeof IntersectionObserver < "u" && (be = new IntersectionObserver(([e]) => {
|
|
1330
|
+
let t = !!e?.isIntersecting;
|
|
1331
|
+
t !== ye && (ye = t, Se());
|
|
1332
|
+
}), be.observe(V.getContainer()));
|
|
1333
|
+
}
|
|
1334
|
+
function Se() {
|
|
1335
|
+
cancelAnimationFrame(he), _e = -1, xe(), (ye || !i.flow) && (i.flow && V && !o() ? (ge = performance.now(), he = requestAnimationFrame(ve)) : V?.getLayer(Y[0]) && V.setPaintProperty(Y[0], "line-dasharray", me(0)));
|
|
1336
|
+
}
|
|
1337
|
+
function Ce(e) {
|
|
1338
|
+
let t = Xe(g.value, v.value, Math.max(e - 10, 0)).lngLat, n = Xe(g.value, v.value, Math.min(e + 25, y.value)).lngLat;
|
|
1339
|
+
return t[0] === n[0] && t[1] === n[1] ? Xe(g.value, v.value, e).bearing : Je(t, n);
|
|
1340
|
+
}
|
|
1341
|
+
let $ = E(() => i.rotateVehicle ?? (i.vehicleIcon === "navigation" && !c.vehicle));
|
|
1342
|
+
function we(e) {
|
|
1343
|
+
cancelAnimationFrame(L);
|
|
1344
|
+
let t = P, n = o() ? 0 : i.duration;
|
|
1345
|
+
if (n <= 0 || t === e) {
|
|
1346
|
+
le(e), F.value = e, Ee();
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
let r = performance.now(), a = (i) => {
|
|
1350
|
+
let o = Math.min(1, (i - r) / n);
|
|
1351
|
+
le(t + (e - t) * o), o < 1 ? L = requestAnimationFrame(a) : (F.value = e, Ee());
|
|
1352
|
+
};
|
|
1353
|
+
L = requestAnimationFrame(a);
|
|
1354
|
+
}
|
|
1355
|
+
let Te = !1;
|
|
1356
|
+
function Ee() {
|
|
1357
|
+
let e = y.value > 0 && P >= y.value - 1;
|
|
1358
|
+
e && !Te && a("arrive"), Te = e;
|
|
1359
|
+
}
|
|
1360
|
+
function De() {
|
|
1361
|
+
!V || g.value.length < 2 || V.fitBounds(tt(g.value), {
|
|
1362
|
+
padding: i.padding,
|
|
1363
|
+
duration: o() ? 0 : 600
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
let Oe = E(() => i.showVehicle && w.value != null);
|
|
1367
|
+
f((e, t) => {
|
|
1368
|
+
V = e, P = w.value ?? 0, F.value = P, ce(), W.value && (U = new t.Marker({
|
|
1369
|
+
element: W.value,
|
|
1370
|
+
rotationAlignment: $.value ? "map" : "viewport",
|
|
1371
|
+
subpixelPositioning: !0
|
|
1372
|
+
}), Oe.value && U.setLngLat(Xe(g.value, v.value, P).lngLat).addTo(e)), le(P), Te = y.value > 0 && P >= y.value - 1, i.fit && De(), Se();
|
|
1373
|
+
}), Z(() => i.flow, Se), Z(p, () => ce()), Z($, (e) => {
|
|
1374
|
+
U?.setRotationAlignment(e ? "map" : "viewport"), U?.setRotation(e ? I.value : 0);
|
|
1375
|
+
}), Z(w, (e) => {
|
|
1376
|
+
e != null && V && we(e);
|
|
1377
|
+
}), Z(Oe, (e) => {
|
|
1378
|
+
V && U && (e ? U.setLngLat(Xe(g.value, v.value, P).lngLat).addTo(V) : U.remove());
|
|
1379
|
+
}), Z(_, () => {
|
|
1380
|
+
x = null, w.value = S(), V && (P = Math.min(w.value ?? 0, y.value), F.value = P, le(P), i.fit && De());
|
|
1381
|
+
}), Z(() => [
|
|
1382
|
+
ee.value,
|
|
1383
|
+
m.value.outline,
|
|
1384
|
+
m.value.surface,
|
|
1385
|
+
i.width,
|
|
1386
|
+
i.before
|
|
1387
|
+
], () => ce()), ne(() => {
|
|
1388
|
+
if (T?.abort(), cancelAnimationFrame(he), be?.disconnect(), cancelAnimationFrame(L), U?.remove(), V) {
|
|
1389
|
+
for (let e of Y) V.getLayer(e) && V.removeLayer(e);
|
|
1390
|
+
V.getSource(d) && V.removeSource(d);
|
|
1391
|
+
}
|
|
1392
|
+
V = void 0;
|
|
1393
|
+
});
|
|
1394
|
+
let ke = (e, t) => e.icon ?? (t === i.stops.length - 1 ? "flag" : t === 0 ? "trip_origin" : void 0), Ae = (e, t) => e.label ?? `${u.mapRouteStop} ${t + 1}`;
|
|
1395
|
+
return n({
|
|
1396
|
+
fit: De,
|
|
1397
|
+
length: y,
|
|
1398
|
+
travelled: F,
|
|
1399
|
+
sourceId: d
|
|
1400
|
+
}), (n, r) => (H(), k("div", nt, [(H(!0), k(C, null, re(t.stops, (r, i) => (H(), D(Me, {
|
|
1401
|
+
key: i,
|
|
1402
|
+
"lng-lat": r.lngLat,
|
|
1403
|
+
onClick: (e) => a("stop-click", r, i)
|
|
1404
|
+
}, j({
|
|
1405
|
+
default: Q(() => [K(n.$slots, "stop", {
|
|
1406
|
+
stop: r,
|
|
1407
|
+
index: i,
|
|
1408
|
+
done: R(i)
|
|
1409
|
+
}, () => [A("span", {
|
|
1410
|
+
role: "img",
|
|
1411
|
+
"aria-label": Ae(r, i),
|
|
1412
|
+
title: Ae(r, i),
|
|
1413
|
+
class: z(["m3-map-route-stop flex h-7 w-7 items-center justify-center rounded-full border-2 text-label-medium font-medium shadow-elevation-1 transition-colors duration-300", R(i) ? "border-transparent bg-primary text-on-primary" : "border-primary bg-surface text-primary"]),
|
|
1414
|
+
style: te(t.color ? R(i) ? { background: t.color } : {
|
|
1415
|
+
borderColor: t.color,
|
|
1416
|
+
color: t.color
|
|
1417
|
+
} : void 0)
|
|
1418
|
+
}, [ke(r, i) ? (H(), D(e, {
|
|
1419
|
+
key: 0,
|
|
1420
|
+
name: ke(r, i),
|
|
1421
|
+
size: 16
|
|
1422
|
+
}, null, 8, ["name"])) : (H(), k(C, { key: 1 }, [M(J(i), 1)], 64))], 14, rt)])]),
|
|
1423
|
+
_: 2
|
|
1424
|
+
}, [n.$slots["stop-popup"] ? {
|
|
1425
|
+
name: "popup",
|
|
1426
|
+
fn: Q(() => [K(n.$slots, "stop-popup", {
|
|
1427
|
+
stop: r,
|
|
1428
|
+
index: i,
|
|
1429
|
+
done: R(i)
|
|
1430
|
+
})]),
|
|
1431
|
+
key: "0"
|
|
1432
|
+
} : void 0]), 1032, ["lng-lat", "onClick"]))), 128)), A("div", {
|
|
1433
|
+
ref_key: "vehicleEl",
|
|
1434
|
+
ref: W,
|
|
1435
|
+
class: "m3-map-route-vehicle",
|
|
1436
|
+
"aria-label": X(u).mapRouteVehicle,
|
|
1437
|
+
role: "img"
|
|
1438
|
+
}, [K(n.$slots, "vehicle", {
|
|
1439
|
+
bearing: I.value,
|
|
1440
|
+
west: de.value
|
|
1441
|
+
}, () => [A("span", {
|
|
1442
|
+
class: "flex h-10 w-10 items-center justify-center rounded-full border-2 border-surface bg-primary text-on-primary shadow-elevation-2",
|
|
1443
|
+
style: te(t.color ? { background: t.color } : void 0)
|
|
1444
|
+
}, [N(e, {
|
|
1445
|
+
name: t.vehicleIcon,
|
|
1446
|
+
size: 22,
|
|
1447
|
+
filled: t.vehicleIcon === "navigation",
|
|
1448
|
+
style: te(!$.value && de.value ? { transform: "scaleX(-1)" } : void 0)
|
|
1449
|
+
}, null, 8, [
|
|
1450
|
+
"name",
|
|
1451
|
+
"filled",
|
|
1452
|
+
"style"
|
|
1453
|
+
])], 4)])], 8, it)]));
|
|
1454
|
+
}
|
|
1455
|
+
});
|
|
1456
|
+
// src/composables/mapRouting.ts
|
|
1457
|
+
function ot(e = {}) {
|
|
1458
|
+
let t = (e.url ?? "https://router.project-osrm.org").replace(/\/$/, ""), n = e.profile ?? "driving";
|
|
1459
|
+
return async (r, { signal: i }) => {
|
|
1460
|
+
if (r.length < 2) return {
|
|
1461
|
+
path: [...r],
|
|
1462
|
+
distance: 0,
|
|
1463
|
+
duration: 0
|
|
1464
|
+
};
|
|
1465
|
+
let a = r.map(([e, t]) => `${e},${t}`).join(";"), o = new URLSearchParams({
|
|
1466
|
+
overview: "full",
|
|
1467
|
+
geometries: "geojson",
|
|
1468
|
+
...e.params
|
|
1469
|
+
}), s = await fetch(`${t}/route/v1/${n}/${a}?${o}`, { signal: i });
|
|
1470
|
+
if (!s.ok) throw Error(`OSRM ${s.status}`);
|
|
1471
|
+
let c = await s.json(), l = c.routes?.[0];
|
|
1472
|
+
if (c.code !== "Ok" || !l) throw Error(`OSRM: ${c.message ?? c.code}`);
|
|
1473
|
+
return {
|
|
1474
|
+
path: l.geometry.coordinates,
|
|
1475
|
+
distance: l.distance,
|
|
1476
|
+
duration: l.duration
|
|
1477
|
+
};
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
// src/components/_MMapLayerItem.vue?vue&type=script&setup=true&lang.ts
|
|
1481
|
+
var st = { class: "flex min-w-0 flex-1 flex-col" }, ct = ["aria-label", "aria-pressed"], lt = { class: "flex min-w-0 flex-1 flex-col" }, ut = {
|
|
1012
1482
|
key: 0,
|
|
1013
1483
|
class: "truncate text-label-small text-on-surface-variant"
|
|
1014
|
-
},
|
|
1484
|
+
}, dt = {
|
|
1015
1485
|
key: 0,
|
|
1016
1486
|
class: "rounded-full bg-primary/8 px-2 py-0.5 text-label-small tabular-nums text-primary"
|
|
1017
|
-
},
|
|
1487
|
+
}, ft = { class: "min-h-0 overflow-hidden" }, pt = { class: "flex flex-col gap-3 px-3 pb-3" }, mt = {
|
|
1018
1488
|
key: 0,
|
|
1019
1489
|
class: "text-body-small text-on-surface-variant"
|
|
1020
|
-
},
|
|
1490
|
+
}, ht = { class: "flex items-center gap-2 rounded-2xl bg-surface-container-highest/60 px-3 py-1" }, gt = ["src"], _t = {
|
|
1021
1491
|
key: 2,
|
|
1022
1492
|
class: "flex flex-wrap items-center gap-2"
|
|
1023
|
-
},
|
|
1493
|
+
}, vt = ["href"], yt = /* @__PURE__ */ P({
|
|
1024
1494
|
__name: "_MMapLayerItem",
|
|
1025
1495
|
props: {
|
|
1026
1496
|
layer: {},
|
|
@@ -1028,80 +1498,80 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
1028
1498
|
},
|
|
1029
1499
|
emits: ["toggle-expanded"],
|
|
1030
1500
|
setup(t, { emit: n }) {
|
|
1031
|
-
let r = n, i = s(), { isVisible: a, toggle: o, opacityOf: c, setOpacity: l } =
|
|
1032
|
-
return (n, s) => (
|
|
1501
|
+
let r = n, i = s(), { isVisible: a, toggle: o, opacityOf: c, setOpacity: l } = Ce();
|
|
1502
|
+
return (n, s) => (H(), k("div", { class: z(["flex overflow-hidden rounded-2xl bg-surface-container", X(a)(t.layer.id) ? "" : "opacity-75"]) }, [A("div", { class: z(["w-1 shrink-0 transition-colors duration-200", X(a)(t.layer.id) ? "bg-primary" : "bg-outline-variant"]) }, null, 2), A("div", st, [A("div", {
|
|
1033
1503
|
class: "flex cursor-pointer items-center gap-2 px-3 py-2",
|
|
1034
1504
|
onClick: s[1] ||= (e) => r("toggle-expanded")
|
|
1035
1505
|
}, [
|
|
1036
|
-
|
|
1506
|
+
A("button", {
|
|
1037
1507
|
type: "button",
|
|
1038
|
-
class:
|
|
1039
|
-
"aria-label":
|
|
1040
|
-
"aria-pressed":
|
|
1041
|
-
onClick: s[0] ||=
|
|
1042
|
-
}, [
|
|
1043
|
-
name:
|
|
1508
|
+
class: z(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", X(a)(t.layer.id) ? "bg-primary/12 text-primary" : "bg-on-surface/5 text-on-surface-variant"]),
|
|
1509
|
+
"aria-label": X(a)(t.layer.id) ? X(i).mapHideLayer : X(i).mapShowLayer,
|
|
1510
|
+
"aria-pressed": X(a)(t.layer.id),
|
|
1511
|
+
onClick: s[0] ||= se((e) => X(o)(t.layer.id), ["stop"])
|
|
1512
|
+
}, [N(e, {
|
|
1513
|
+
name: X(a)(t.layer.id) ? "visibility" : "visibility_off",
|
|
1044
1514
|
size: 18
|
|
1045
|
-
}, null, 8, ["name"])], 10,
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1515
|
+
}, null, 8, ["name"])], 10, ct),
|
|
1516
|
+
A("div", lt, [A("span", { class: z(["truncate text-body-medium", X(a)(t.layer.id) ? "text-on-surface" : "text-on-surface-variant"]) }, J(t.layer.title), 3), t.layer.description && !t.expanded ? (H(), k("span", ut, J(t.layer.description), 1)) : O("", !0)]),
|
|
1517
|
+
X(a)(t.layer.id) && X(c)(t.layer.id) < 1 ? (H(), k("span", dt, J(Math.round(X(c)(t.layer.id) * 100)) + "% ", 1)) : O("", !0),
|
|
1518
|
+
N(e, {
|
|
1049
1519
|
name: "expand_more",
|
|
1050
1520
|
size: 18,
|
|
1051
|
-
class:
|
|
1521
|
+
class: z(["shrink-0 text-on-surface-variant transition-transform duration-300", t.expanded ? "rotate-180" : ""])
|
|
1052
1522
|
}, null, 8, ["class"])
|
|
1053
|
-
]),
|
|
1523
|
+
]), A("div", {
|
|
1054
1524
|
class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
1055
|
-
style:
|
|
1056
|
-
}, [
|
|
1057
|
-
t.layer.description ? (
|
|
1058
|
-
|
|
1525
|
+
style: te({ gridTemplateRows: t.expanded ? "1fr" : "0fr" })
|
|
1526
|
+
}, [A("div", ft, [A("div", pt, [
|
|
1527
|
+
t.layer.description ? (H(), k("p", mt, J(t.layer.description), 1)) : O("", !0),
|
|
1528
|
+
A("div", ht, [N(e, {
|
|
1059
1529
|
name: "opacity",
|
|
1060
1530
|
size: 16,
|
|
1061
1531
|
class: "shrink-0 text-on-surface-variant"
|
|
1062
|
-
}),
|
|
1063
|
-
"model-value":
|
|
1532
|
+
}), N(d, {
|
|
1533
|
+
"model-value": X(c)(t.layer.id),
|
|
1064
1534
|
min: 0,
|
|
1065
1535
|
max: 1,
|
|
1066
1536
|
step: .01,
|
|
1067
|
-
label:
|
|
1537
|
+
label: X(i).mapOpacity,
|
|
1068
1538
|
class: "flex-1",
|
|
1069
|
-
"onUpdate:modelValue": s[2] ||= (e) =>
|
|
1539
|
+
"onUpdate:modelValue": s[2] ||= (e) => X(l)(t.layer.id, Number(e))
|
|
1070
1540
|
}, null, 8, ["model-value", "label"])]),
|
|
1071
|
-
t.layer.legend ? (
|
|
1541
|
+
t.layer.legend ? (H(), k("img", {
|
|
1072
1542
|
key: 1,
|
|
1073
1543
|
src: t.layer.legend,
|
|
1074
1544
|
alt: "",
|
|
1075
1545
|
class: "max-w-full self-start",
|
|
1076
1546
|
loading: "lazy"
|
|
1077
|
-
}, null, 8,
|
|
1078
|
-
t.layer.download || n.$slots.actions ? (
|
|
1547
|
+
}, null, 8, gt)) : O("", !0),
|
|
1548
|
+
t.layer.download || n.$slots.actions ? (H(), k("div", _t, [t.layer.download ? (H(), k("a", {
|
|
1079
1549
|
key: 0,
|
|
1080
1550
|
href: t.layer.download,
|
|
1081
1551
|
target: "_blank",
|
|
1082
1552
|
rel: "noopener",
|
|
1083
1553
|
download: "",
|
|
1084
1554
|
class: "inline-flex items-center gap-1 rounded-full px-3 py-1.5 text-label-large text-primary hover:bg-primary/8"
|
|
1085
|
-
}, [
|
|
1555
|
+
}, [N(e, {
|
|
1086
1556
|
name: "download",
|
|
1087
1557
|
size: 18
|
|
1088
|
-
}),
|
|
1558
|
+
}), M(" " + J(X(i).mapDownload), 1)], 8, vt)) : O("", !0), K(n.$slots, "actions", {
|
|
1089
1559
|
layer: t.layer,
|
|
1090
|
-
visible:
|
|
1091
|
-
})])) :
|
|
1560
|
+
visible: X(a)(t.layer.id)
|
|
1561
|
+
})])) : O("", !0)
|
|
1092
1562
|
])])], 4)])], 2));
|
|
1093
1563
|
}
|
|
1094
|
-
}),
|
|
1564
|
+
}), bt = { class: "flex flex-col gap-3" }, xt = ["onClick"], St = [
|
|
1095
1565
|
"aria-label",
|
|
1096
1566
|
"aria-pressed",
|
|
1097
1567
|
"onClick"
|
|
1098
|
-
],
|
|
1568
|
+
], Ct = { class: "flex-1 select-none truncate text-label-large text-on-surface" }, wt = { class: "rounded-full bg-surface-container-highest px-2 py-0.5 text-label-small tabular-nums text-on-surface-variant" }, Tt = {
|
|
1099
1569
|
key: 1,
|
|
1100
1570
|
class: "flex flex-col gap-1.5"
|
|
1101
|
-
},
|
|
1571
|
+
}, Et = {
|
|
1102
1572
|
key: 2,
|
|
1103
1573
|
class: "flex flex-col items-center gap-3 py-8"
|
|
1104
|
-
},
|
|
1574
|
+
}, Dt = { class: "grid size-14 place-items-center rounded-full bg-surface-container-highest" }, Ot = { class: "text-body-medium text-on-surface-variant" }, kt = /* @__PURE__ */ P({
|
|
1105
1575
|
__name: "MMapLayers",
|
|
1106
1576
|
props: {
|
|
1107
1577
|
search: {
|
|
@@ -1115,103 +1585,98 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
1115
1585
|
map: {}
|
|
1116
1586
|
},
|
|
1117
1587
|
setup(t) {
|
|
1118
|
-
let n = t, r = s(), { model: i, layersOf: a, isVisible: o, groupState: c, setGroupVisible: l } =
|
|
1588
|
+
let n = t, r = s(), { model: i, layersOf: a, isVisible: o, groupState: c, setGroupVisible: l } = Ce(() => n.map), d = G(""), f = (e) => !d.value || e.title.toLowerCase().includes(d.value.toLowerCase()), p = E(() => (i.value?.groups ?? []).map((e) => ({
|
|
1119
1589
|
...e,
|
|
1120
1590
|
all: a(e.name),
|
|
1121
1591
|
layers: a(e.name).filter(f)
|
|
1122
|
-
})).filter((e) => e.layers.length)), m =
|
|
1592
|
+
})).filter((e) => e.layers.length)), m = E(() => a(null).filter(f)), h = G(/* @__PURE__ */ new Set()), g = (e) => h.value.has(e) === n.collapsed;
|
|
1123
1593
|
function _(e) {
|
|
1124
1594
|
let t = new Set(h.value);
|
|
1125
1595
|
t.delete(e) || t.add(e), h.value = t;
|
|
1126
1596
|
}
|
|
1127
|
-
let v =
|
|
1597
|
+
let v = G(/* @__PURE__ */ new Set());
|
|
1128
1598
|
function y(e) {
|
|
1129
1599
|
let t = new Set(v.value);
|
|
1130
1600
|
t.delete(e) || t.add(e), v.value = t;
|
|
1131
1601
|
}
|
|
1132
|
-
let
|
|
1133
|
-
return (n, i) => (
|
|
1134
|
-
t.search ? (
|
|
1602
|
+
let b = (e) => e.filter((e) => o(e.id)).length;
|
|
1603
|
+
return (n, i) => (H(), k("div", bt, [
|
|
1604
|
+
t.search ? (H(), D(u, {
|
|
1135
1605
|
key: 0,
|
|
1136
1606
|
modelValue: d.value,
|
|
1137
1607
|
"onUpdate:modelValue": i[0] ||= (e) => d.value = e,
|
|
1138
|
-
label:
|
|
1608
|
+
label: X(r).mapSearchLayers,
|
|
1139
1609
|
"leading-icon": "search",
|
|
1140
1610
|
variant: "outlined",
|
|
1141
1611
|
clearable: ""
|
|
1142
|
-
}, null, 8, ["modelValue", "label"])) :
|
|
1143
|
-
(
|
|
1612
|
+
}, null, 8, ["modelValue", "label"])) : O("", !0),
|
|
1613
|
+
(H(!0), k(C, null, re(p.value, (t) => (H(), k("section", {
|
|
1144
1614
|
key: t.name,
|
|
1145
1615
|
class: "flex flex-col"
|
|
1146
|
-
}, [
|
|
1616
|
+
}, [A("div", {
|
|
1147
1617
|
class: "m3-map-layers-row flex cursor-pointer items-center gap-2 rounded-xl px-2 py-1.5",
|
|
1148
1618
|
onClick: (e) => _(t.name)
|
|
1149
1619
|
}, [
|
|
1150
|
-
|
|
1620
|
+
A("button", {
|
|
1151
1621
|
type: "button",
|
|
1152
|
-
class:
|
|
1153
|
-
"aria-label":
|
|
1154
|
-
"aria-pressed":
|
|
1155
|
-
onClick:
|
|
1156
|
-
}, [
|
|
1157
|
-
name:
|
|
1622
|
+
class: z(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", X(c)(t.name) === "visible" ? "bg-primary-container text-on-primary-container" : X(c)(t.name) === "partial" ? "bg-secondary-container text-on-secondary-container" : "bg-on-surface/8 text-on-surface-variant"]),
|
|
1623
|
+
"aria-label": X(c)(t.name) === "hidden" ? X(r).mapShowLayer : X(r).mapHideLayer,
|
|
1624
|
+
"aria-pressed": X(c)(t.name) !== "hidden",
|
|
1625
|
+
onClick: se((e) => X(l)(t.name, X(c)(t.name) !== "visible"), ["stop"])
|
|
1626
|
+
}, [N(e, {
|
|
1627
|
+
name: X(c)(t.name) === "hidden" ? "visibility_off" : "visibility",
|
|
1158
1628
|
size: 18
|
|
1159
|
-
}, null, 8, ["name"])], 10,
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1629
|
+
}, null, 8, ["name"])], 10, St),
|
|
1630
|
+
A("span", Ct, J(t.title), 1),
|
|
1631
|
+
A("span", wt, J(b(t.all)) + "/" + J(t.all.length), 1),
|
|
1632
|
+
N(e, {
|
|
1163
1633
|
name: "expand_more",
|
|
1164
1634
|
size: 18,
|
|
1165
|
-
class:
|
|
1635
|
+
class: z(["text-on-surface-variant transition-transform duration-300", g(t.name) ? "rotate-180" : ""])
|
|
1166
1636
|
}, null, 8, ["class"])
|
|
1167
|
-
], 8,
|
|
1637
|
+
], 8, xt), A("div", {
|
|
1168
1638
|
class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
1169
|
-
style:
|
|
1170
|
-
}, [
|
|
1639
|
+
style: te({ gridTemplateRows: g(t.name) ? "1fr" : "0fr" })
|
|
1640
|
+
}, [A("div", { class: z(["flex min-h-0 flex-col gap-1.5 overflow-hidden", g(t.name) ? "pt-1.5" : ""]) }, [(H(!0), k(C, null, re(t.layers, (e) => (H(), D(yt, {
|
|
1171
1641
|
key: e.id,
|
|
1172
1642
|
layer: e,
|
|
1173
1643
|
expanded: v.value.has(e.id),
|
|
1174
1644
|
onToggleExpanded: (t) => y(e.id)
|
|
1175
|
-
},
|
|
1645
|
+
}, j({ _: 2 }, [n.$slots.actions ? {
|
|
1176
1646
|
name: "actions",
|
|
1177
|
-
fn:
|
|
1647
|
+
fn: Q((e) => [K(n.$slots, "actions", R({ ref_for: !0 }, e))]),
|
|
1178
1648
|
key: "0"
|
|
1179
1649
|
} : void 0]), 1032, [
|
|
1180
1650
|
"layer",
|
|
1181
1651
|
"expanded",
|
|
1182
1652
|
"onToggleExpanded"
|
|
1183
1653
|
]))), 128))], 2)], 4)]))), 128)),
|
|
1184
|
-
m.value.length ? (
|
|
1654
|
+
m.value.length ? (H(), k("div", Tt, [(H(!0), k(C, null, re(m.value, (e) => (H(), D(yt, {
|
|
1185
1655
|
key: e.id,
|
|
1186
1656
|
layer: e,
|
|
1187
1657
|
expanded: v.value.has(e.id),
|
|
1188
1658
|
onToggleExpanded: (t) => y(e.id)
|
|
1189
|
-
},
|
|
1659
|
+
}, j({ _: 2 }, [n.$slots.actions ? {
|
|
1190
1660
|
name: "actions",
|
|
1191
|
-
fn:
|
|
1661
|
+
fn: Q((e) => [K(n.$slots, "actions", R({ ref_for: !0 }, e))]),
|
|
1192
1662
|
key: "0"
|
|
1193
1663
|
} : void 0]), 1032, [
|
|
1194
1664
|
"layer",
|
|
1195
1665
|
"expanded",
|
|
1196
1666
|
"onToggleExpanded"
|
|
1197
|
-
]))), 128))])) :
|
|
1198
|
-
!p.value.length && !m.value.length ? (
|
|
1667
|
+
]))), 128))])) : O("", !0),
|
|
1668
|
+
!p.value.length && !m.value.length ? (H(), k("div", Et, [A("div", Dt, [N(e, {
|
|
1199
1669
|
name: "layers_clear",
|
|
1200
1670
|
size: 28,
|
|
1201
1671
|
class: "text-on-surface-variant"
|
|
1202
|
-
})]),
|
|
1672
|
+
})]), A("p", Ot, J(X(r).mapNoLayers), 1)])) : O("", !0)
|
|
1203
1673
|
]));
|
|
1204
1674
|
}
|
|
1205
|
-
}),
|
|
1206
|
-
"title",
|
|
1675
|
+
}), At = [
|
|
1207
1676
|
"aria-label",
|
|
1208
1677
|
"aria-checked",
|
|
1209
1678
|
"onClick"
|
|
1210
|
-
],
|
|
1211
|
-
"title",
|
|
1212
|
-
"aria-label",
|
|
1213
|
-
"aria-checked"
|
|
1214
|
-
], st = /* @__PURE__ */ j({
|
|
1679
|
+
], jt = ["src"], Mt = ["aria-label", "aria-checked"], Nt = /* @__PURE__ */ P({
|
|
1215
1680
|
__name: "MMapBaseLayers",
|
|
1216
1681
|
props: {
|
|
1217
1682
|
imageBase: { default: "" },
|
|
@@ -1226,91 +1691,101 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
1226
1691
|
map: {}
|
|
1227
1692
|
},
|
|
1228
1693
|
setup(t) {
|
|
1229
|
-
let n = t, r = s(), { baseLayers: i, baseLayer: a, setBaseLayer: o } =
|
|
1230
|
-
return (n, s) => (
|
|
1231
|
-
class:
|
|
1694
|
+
let n = t, r = s(), { baseLayers: i, baseLayer: a, setBaseLayer: o } = Ce(() => n.map), c = (e, t) => /^(https?:|data:|\/\/)/.test(e) ? e : `${t}${e}`;
|
|
1695
|
+
return (n, s) => (H(), k("div", {
|
|
1696
|
+
class: z(["flex gap-2", t.vertical ? "flex-col" : "flex-row flex-wrap"]),
|
|
1232
1697
|
role: "radiogroup"
|
|
1233
|
-
}, [(
|
|
1698
|
+
}, [(H(!0), k(C, null, re(X(i), (n) => (H(), D(f, {
|
|
1234
1699
|
key: n.id,
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1700
|
+
text: n.title,
|
|
1701
|
+
placement: t.vertical ? "right" : "top"
|
|
1702
|
+
}, {
|
|
1703
|
+
default: Q(() => [A("button", {
|
|
1704
|
+
type: "button",
|
|
1705
|
+
role: "radio",
|
|
1706
|
+
class: z(["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", X(a) === n.id ? "m3-map-base--active border-primary" : "border-transparent"]),
|
|
1707
|
+
"aria-label": n.title,
|
|
1708
|
+
"aria-checked": X(a) === n.id,
|
|
1709
|
+
onClick: (e) => X(o)(n.id)
|
|
1710
|
+
}, [n.base?.image ? (H(), k("img", {
|
|
1711
|
+
key: 0,
|
|
1712
|
+
src: c(n.base.image, t.imageBase),
|
|
1713
|
+
alt: "",
|
|
1714
|
+
class: "size-full object-cover"
|
|
1715
|
+
}, null, 8, jt)) : (H(), D(e, {
|
|
1716
|
+
key: 1,
|
|
1717
|
+
name: "map",
|
|
1718
|
+
size: 22,
|
|
1719
|
+
class: "text-on-surface-variant"
|
|
1720
|
+
}))], 10, At)]),
|
|
1721
|
+
_: 2
|
|
1722
|
+
}, 1032, ["text", "placement"]))), 128)), t.none ? (H(), D(f, {
|
|
1253
1723
|
key: 0,
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1724
|
+
text: X(r).mapNoBaseLayer,
|
|
1725
|
+
placement: t.vertical ? "right" : "top"
|
|
1726
|
+
}, {
|
|
1727
|
+
default: Q(() => [A("button", {
|
|
1728
|
+
type: "button",
|
|
1729
|
+
role: "radio",
|
|
1730
|
+
class: z(["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", X(a) === null ? "m3-map-base--active border-primary" : "border-transparent"]),
|
|
1731
|
+
"aria-label": X(r).mapNoBaseLayer,
|
|
1732
|
+
"aria-checked": X(a) === null,
|
|
1733
|
+
onClick: s[0] ||= (e) => X(o)(null)
|
|
1734
|
+
}, [N(e, {
|
|
1735
|
+
name: "layers_clear",
|
|
1736
|
+
size: 22,
|
|
1737
|
+
class: "text-on-surface-variant"
|
|
1738
|
+
})], 10, Mt)]),
|
|
1739
|
+
_: 1
|
|
1740
|
+
}, 8, ["text", "placement"])) : O("", !0)], 2));
|
|
1266
1741
|
}
|
|
1267
|
-
}),
|
|
1742
|
+
}), Pt = { class: "flex flex-col gap-2" }, Ft = { class: "flex items-center gap-2 bg-primary-container/40 px-4 py-2" }, It = { class: "text-label-large text-on-primary-container" }, Lt = { class: "flex flex-col px-4 py-1" }, Rt = { class: "text-label-small text-on-surface-variant" }, zt = { class: "text-body-medium text-on-surface" }, Bt = {
|
|
1268
1743
|
key: 0,
|
|
1269
1744
|
class: "break-words"
|
|
1270
|
-
},
|
|
1745
|
+
}, Vt = {
|
|
1271
1746
|
key: 1,
|
|
1272
1747
|
class: "text-body-small italic text-on-surface-variant"
|
|
1273
|
-
},
|
|
1748
|
+
}, Ht = /* @__PURE__ */ P({
|
|
1274
1749
|
__name: "MMapFeatureInfo",
|
|
1275
1750
|
props: { results: {} },
|
|
1276
1751
|
setup(t) {
|
|
1277
1752
|
let n = s();
|
|
1278
|
-
return (r, i) => (
|
|
1753
|
+
return (r, i) => (H(), k("div", Pt, [(H(!0), k(C, null, re(t.results, (t, i) => (H(), k("div", {
|
|
1279
1754
|
key: i,
|
|
1280
1755
|
class: "overflow-hidden rounded-2xl bg-surface-container"
|
|
1281
|
-
}, [
|
|
1756
|
+
}, [A("div", Ft, [N(e, {
|
|
1282
1757
|
name: "layers",
|
|
1283
1758
|
size: 16,
|
|
1284
1759
|
class: "text-on-primary-container"
|
|
1285
|
-
}),
|
|
1760
|
+
}), A("span", It, J(t.layer.title), 1)]), A("dl", Lt, [(H(!0), k(C, null, re(t.fields, (e) => (H(), k("div", {
|
|
1286
1761
|
key: e.key,
|
|
1287
1762
|
class: "flex flex-col gap-0.5 border-b border-outline-variant py-1.5 last:border-b-0"
|
|
1288
|
-
}, [
|
|
1763
|
+
}, [A("dt", Rt, J(e.label), 1), A("dd", zt, [K(r.$slots, "value", {
|
|
1289
1764
|
field: e,
|
|
1290
1765
|
result: t
|
|
1291
|
-
}, () => [e.value ? (
|
|
1766
|
+
}, () => [e.value ? (H(), k("span", Bt, J(e.value), 1)) : (H(), k("span", Vt, J(X(n).mapNoValue), 1))])])]))), 128))])]))), 128))]));
|
|
1292
1767
|
}
|
|
1293
|
-
}),
|
|
1768
|
+
}), Ut = (e) => e.metadata, Wt = /* @__PURE__ */ new Set([
|
|
1294
1769
|
"fill",
|
|
1295
1770
|
"line",
|
|
1296
1771
|
"circle",
|
|
1297
1772
|
"symbol",
|
|
1298
1773
|
"fill-extrusion",
|
|
1299
1774
|
"heatmap"
|
|
1300
|
-
]),
|
|
1301
|
-
let t = e.layers.filter((e) => e.type !== "background"), n = (e) => e?.base === !0 || typeof e?.base == "object" && e.base !== null ? e : void 0, r = (e) => Array.isArray(e?.children) ? e.children : [], i = new Set(t.flatMap((e) => n(
|
|
1775
|
+
]), Gt = (e) => {
|
|
1776
|
+
let t = e.layers.filter((e) => e.type !== "background"), n = (e) => e?.base === !0 || typeof e?.base == "object" && e.base !== null ? e : void 0, r = (e) => Array.isArray(e?.children) ? e.children : [], i = new Set(t.flatMap((e) => n(Ut(e)) ? r(Ut(e)) : []));
|
|
1302
1777
|
return {
|
|
1303
1778
|
title: e.name,
|
|
1304
1779
|
groups: [],
|
|
1305
1780
|
layers: t.map((e) => {
|
|
1306
|
-
let t =
|
|
1781
|
+
let t = Ut(e), a = n(t);
|
|
1307
1782
|
return {
|
|
1308
1783
|
id: e.id,
|
|
1309
1784
|
title: t?.title ?? e.id,
|
|
1310
1785
|
listed: !a && !i.has(e.id) && t?.listed !== !1,
|
|
1311
1786
|
base: a ? { image: t.base.image ?? t.image } : void 0,
|
|
1312
1787
|
children: r(t),
|
|
1313
|
-
identify:
|
|
1788
|
+
identify: Wt.has(e.type) && !a && !i.has(e.id) ? {
|
|
1314
1789
|
format: {},
|
|
1315
1790
|
exclude: []
|
|
1316
1791
|
} : !1,
|
|
@@ -1319,9 +1794,9 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
1319
1794
|
})
|
|
1320
1795
|
};
|
|
1321
1796
|
};
|
|
1322
|
-
function
|
|
1797
|
+
function Kt(e = {}) {
|
|
1323
1798
|
let t = e.legend ?? ((e, t) => {
|
|
1324
|
-
let n =
|
|
1799
|
+
let n = Ut(e)?.legend;
|
|
1325
1800
|
if (n?.show === !1) return;
|
|
1326
1801
|
if (n?.wmslegend) return n.wmslegend;
|
|
1327
1802
|
if (!t?.includes("/services/styles/")) return;
|
|
@@ -1337,7 +1812,7 @@ function bt(e = {}) {
|
|
|
1337
1812
|
title: e.alias ?? e.name
|
|
1338
1813
|
})),
|
|
1339
1814
|
layers: e.layers.filter((e) => e.type !== "background").map((e) => {
|
|
1340
|
-
let r =
|
|
1815
|
+
let r = Ut(e) ?? {}, i = { ...r.fields }, a = i.exclude ?? [];
|
|
1341
1816
|
delete i.exclude;
|
|
1342
1817
|
let o = {};
|
|
1343
1818
|
for (let [e, t] of Object.entries(i)) o[e] = {
|
|
@@ -1374,10 +1849,10 @@ function bt(e = {}) {
|
|
|
1374
1849
|
};
|
|
1375
1850
|
};
|
|
1376
1851
|
}
|
|
1377
|
-
function
|
|
1852
|
+
function qt(e, t) {
|
|
1378
1853
|
return t?.label ?? e.charAt(0).toUpperCase() + e.slice(1);
|
|
1379
1854
|
}
|
|
1380
|
-
function
|
|
1855
|
+
function Jt(e, t) {
|
|
1381
1856
|
if (e == null || String(e).trim() === "") return "";
|
|
1382
1857
|
let n = String(e), r = typeof e == "number" ? e : Number(e);
|
|
1383
1858
|
if (t?.mask && !Number.isNaN(r)) {
|
|
@@ -1390,23 +1865,23 @@ function St(e, t) {
|
|
|
1390
1865
|
}
|
|
1391
1866
|
return t?.prefix && (n = `${t.prefix} ${n}`), t?.suffix && (n = `${n} ${t.suffix}`), n;
|
|
1392
1867
|
}
|
|
1393
|
-
var
|
|
1868
|
+
var Yt = /* @__PURE__ */ new Set([
|
|
1394
1869
|
"coordinates",
|
|
1395
1870
|
"mapCoordinates",
|
|
1396
1871
|
"layerId",
|
|
1397
1872
|
"__layerMetadata"
|
|
1398
1873
|
]);
|
|
1399
|
-
function
|
|
1874
|
+
function Xt(e, t, n) {
|
|
1400
1875
|
let r = new Map((n?.layers ?? []).filter((t) => t.identify && e.getLayer(t.id)).map((e) => [e.id, e]));
|
|
1401
1876
|
if (!r.size) return [];
|
|
1402
1877
|
let i = [];
|
|
1403
1878
|
for (let n of e.queryRenderedFeatures(t, { layers: [...r.keys()] })) {
|
|
1404
1879
|
let e = r.get(n.layer.id);
|
|
1405
1880
|
if (!e || !e.identify) continue;
|
|
1406
|
-
let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !
|
|
1881
|
+
let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !Yt.has(e) && !a.includes(e) && !t[e]?.hidden).map(([e, n]) => ({
|
|
1407
1882
|
key: e,
|
|
1408
|
-
label:
|
|
1409
|
-
value:
|
|
1883
|
+
label: qt(e, t[e]),
|
|
1884
|
+
value: Jt(n, t[e])
|
|
1410
1885
|
}));
|
|
1411
1886
|
o.length && i.push({
|
|
1412
1887
|
layer: e,
|
|
@@ -1417,7 +1892,7 @@ function wt(e, t, n) {
|
|
|
1417
1892
|
return i;
|
|
1418
1893
|
}
|
|
1419
1894
|
// src/components/MMapIdentify.vue?vue&type=script&setup=true&lang.ts
|
|
1420
|
-
var
|
|
1895
|
+
var Zt = { class: "hidden" }, Qt = /* @__PURE__ */ P({
|
|
1421
1896
|
inheritAttrs: !1,
|
|
1422
1897
|
__name: "MMapIdentify",
|
|
1423
1898
|
props: {
|
|
@@ -1436,16 +1911,16 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1436
1911
|
},
|
|
1437
1912
|
emits: ["identify"],
|
|
1438
1913
|
setup(e, { expose: t, emit: n }) {
|
|
1439
|
-
let r = e, i = n, { on: a, onReady: o, activeTool: s } =
|
|
1914
|
+
let r = e, i = n, { on: a, onReady: o, activeTool: s } = pe(), { model: c } = Ce(), l = q([]), u = G([0, 0]), d = G(!1);
|
|
1440
1915
|
a("click", (e) => {
|
|
1441
1916
|
if (!r.enabled || s.value) return;
|
|
1442
1917
|
let t = e.target;
|
|
1443
|
-
l.value =
|
|
1918
|
+
l.value = Xt(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);
|
|
1444
1919
|
});
|
|
1445
1920
|
function f() {
|
|
1446
1921
|
d.value = !1;
|
|
1447
1922
|
}
|
|
1448
|
-
|
|
1923
|
+
Z(() => r.enabled, (e) => {
|
|
1449
1924
|
e || f();
|
|
1450
1925
|
});
|
|
1451
1926
|
let p, m = [], h = () => {
|
|
@@ -1462,38 +1937,38 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1462
1937
|
}
|
|
1463
1938
|
return o((e) => {
|
|
1464
1939
|
p = e, _();
|
|
1465
|
-
}),
|
|
1940
|
+
}), Z(c, _), ne(() => {
|
|
1466
1941
|
m.forEach((e) => {
|
|
1467
1942
|
p?.off("mouseenter", e, h), p?.off("mouseleave", e, g);
|
|
1468
1943
|
});
|
|
1469
|
-
}), t({ close: f }), (t, n) => (
|
|
1944
|
+
}), t({ close: f }), (t, n) => (H(), k("div", Zt, [e.marker && d.value ? (H(), D(Me, {
|
|
1470
1945
|
key: 0,
|
|
1471
1946
|
"lng-lat": u.value
|
|
1472
|
-
}, null, 8, ["lng-lat"])) :
|
|
1947
|
+
}, null, 8, ["lng-lat"])) : O("", !0), e.popup && l.value.length ? (H(), D(Pe, {
|
|
1473
1948
|
key: 1,
|
|
1474
1949
|
open: d.value,
|
|
1475
1950
|
"onUpdate:open": n[0] ||= (e) => d.value = e,
|
|
1476
1951
|
"lng-lat": u.value,
|
|
1477
1952
|
"max-width": "360px",
|
|
1478
|
-
offset: e.marker ?
|
|
1953
|
+
offset: e.marker ? X(Ae) : void 0
|
|
1479
1954
|
}, {
|
|
1480
|
-
default:
|
|
1955
|
+
default: Q(() => [A("div", R({ class: "max-h-80 overflow-y-auto" }, t.$attrs), [K(t.$slots, "default", {
|
|
1481
1956
|
results: l.value,
|
|
1482
1957
|
lngLat: u.value,
|
|
1483
1958
|
close: f
|
|
1484
|
-
}, () => [
|
|
1959
|
+
}, () => [N(Ht, { results: l.value }, null, 8, ["results"])])], 16)]),
|
|
1485
1960
|
_: 3
|
|
1486
1961
|
}, 8, [
|
|
1487
1962
|
"open",
|
|
1488
1963
|
"lng-lat",
|
|
1489
1964
|
"offset"
|
|
1490
|
-
])) :
|
|
1965
|
+
])) : O("", !0)]));
|
|
1491
1966
|
}
|
|
1492
|
-
}),
|
|
1967
|
+
}), $t = { class: "hidden" }, en = [
|
|
1493
1968
|
"title",
|
|
1494
1969
|
"aria-label",
|
|
1495
1970
|
"aria-pressed"
|
|
1496
|
-
],
|
|
1971
|
+
], tn = { class: "-mx-4 -mt-3 mb-1 bg-primary-container px-3 py-1.5 text-label-medium text-on-primary-container" }, nn = { class: "flex flex-col" }, rn = { class: "text-label-small text-on-surface-variant" }, an = { class: "text-body-small text-on-surface" }, on = /* @__PURE__ */ P({
|
|
1497
1972
|
__name: "MMapHover",
|
|
1498
1973
|
props: {
|
|
1499
1974
|
modelValue: {
|
|
@@ -1507,7 +1982,7 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1507
1982
|
},
|
|
1508
1983
|
emits: ["update:modelValue"],
|
|
1509
1984
|
setup(t, { emit: n }) {
|
|
1510
|
-
let r = t, i = n, a = s(), { onReady: o } =
|
|
1985
|
+
let r = t, i = n, a = s(), { onReady: o } = pe(), { model: c } = Ce(), l = E(() => (c.value?.layers ?? []).filter((e) => e.hover && e.hover.fields.length)), u = q(null), d = G([0, 0]), f = G(!1), p, m = [];
|
|
1511
1986
|
function h(e) {
|
|
1512
1987
|
let t = e.features?.[0], n = l.value.find((e) => e.id === t?.layer.id);
|
|
1513
1988
|
if (!t || !n || !n.hover) return;
|
|
@@ -1516,8 +1991,8 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1516
1991
|
layer: n,
|
|
1517
1992
|
fields: n.hover.fields.map((e) => ({
|
|
1518
1993
|
key: e.key,
|
|
1519
|
-
label:
|
|
1520
|
-
value:
|
|
1994
|
+
label: qt(e.key, e),
|
|
1995
|
+
value: Jt(r[e.key], e)
|
|
1521
1996
|
})).filter((e) => e.value)
|
|
1522
1997
|
}, d.value = [e.lngLat.lng, e.lngLat.lat], f.value = !0;
|
|
1523
1998
|
}
|
|
@@ -1534,27 +2009,27 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1534
2009
|
}
|
|
1535
2010
|
o((e) => {
|
|
1536
2011
|
p = e, _();
|
|
1537
|
-
}),
|
|
2012
|
+
}), Z([() => r.modelValue, l], _), ne(() => {
|
|
1538
2013
|
for (let e of m) p?.off("mousemove", e, h), p?.off("mouseleave", e, g);
|
|
1539
2014
|
});
|
|
1540
|
-
let v =
|
|
1541
|
-
return (n, r) => (
|
|
2015
|
+
let v = E(() => r.control === !0 ? "top-right" : r.control || "top-right");
|
|
2016
|
+
return (n, r) => (H(), k("div", $t, [t.control && l.value.length ? (H(), D(ge, {
|
|
1542
2017
|
key: 0,
|
|
1543
2018
|
position: v.value
|
|
1544
2019
|
}, {
|
|
1545
|
-
default:
|
|
2020
|
+
default: Q(() => [A("button", {
|
|
1546
2021
|
type: "button",
|
|
1547
2022
|
class: "grid place-items-center",
|
|
1548
|
-
title:
|
|
1549
|
-
"aria-label":
|
|
2023
|
+
title: X(a).mapHoverInfo,
|
|
2024
|
+
"aria-label": X(a).mapHoverInfo,
|
|
1550
2025
|
"aria-pressed": t.modelValue,
|
|
1551
2026
|
onClick: r[0] ||= (e) => i("update:modelValue", !t.modelValue)
|
|
1552
|
-
}, [
|
|
2027
|
+
}, [N(e, {
|
|
1553
2028
|
name: "ads_click",
|
|
1554
2029
|
size: 20
|
|
1555
|
-
})], 8,
|
|
2030
|
+
})], 8, en)]),
|
|
1556
2031
|
_: 1
|
|
1557
|
-
}, 8, ["position"])) :
|
|
2032
|
+
}, 8, ["position"])) : O("", !0), u.value ? (H(), D(Pe, {
|
|
1558
2033
|
key: 1,
|
|
1559
2034
|
open: f.value,
|
|
1560
2035
|
"onUpdate:open": r[1] ||= (e) => f.value = e,
|
|
@@ -1565,64 +2040,18 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1565
2040
|
"max-width": "280px",
|
|
1566
2041
|
class: "m3-map-hover"
|
|
1567
2042
|
}, {
|
|
1568
|
-
default:
|
|
2043
|
+
default: Q(() => [A("p", tn, J(u.value.layer.title), 1), A("dl", nn, [(H(!0), k(C, null, re(u.value.fields, (e) => (H(), k("div", {
|
|
1569
2044
|
key: e.key,
|
|
1570
2045
|
class: "border-b border-outline-variant py-1 last:border-b-0"
|
|
1571
|
-
}, [
|
|
2046
|
+
}, [A("dt", rn, J(e.label), 1), A("dd", an, J(e.value), 1)]))), 128))])]),
|
|
1572
2047
|
_: 1
|
|
1573
|
-
}, 8, ["open", "lng-lat"])) :
|
|
1574
|
-
}
|
|
1575
|
-
}), Pt = 6371008.8, Ft = Math.PI / 180;
|
|
1576
|
-
function It(e, t) {
|
|
1577
|
-
let n = (t[1] - e[1]) * Ft, r = (t[0] - e[0]) * Ft, i = Math.sin(n / 2) ** 2 + Math.cos(e[1] * Ft) * Math.cos(t[1] * Ft) * Math.sin(r / 2) ** 2;
|
|
1578
|
-
return 2 * Pt * Math.asin(Math.min(1, Math.sqrt(i)));
|
|
1579
|
-
}
|
|
1580
|
-
function Lt(e) {
|
|
1581
|
-
let t = 0;
|
|
1582
|
-
for (let n = 1; n < e.length; n++) t += It(e[n - 1], e[n]);
|
|
1583
|
-
return t;
|
|
1584
|
-
}
|
|
1585
|
-
function Rt(e, t) {
|
|
1586
|
-
let [n, r, i, a] = [
|
|
1587
|
-
e[0] * Ft,
|
|
1588
|
-
e[1] * Ft,
|
|
1589
|
-
t[0] * Ft,
|
|
1590
|
-
t[1] * Ft
|
|
1591
|
-
], 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));
|
|
1592
|
-
return [(n + Math.atan2(s, Math.cos(r) + o)) / Ft, c / Ft];
|
|
1593
|
-
}
|
|
1594
|
-
function zt(e) {
|
|
1595
|
-
let t = Bt(e), n = t.length - 1;
|
|
1596
|
-
if (n <= 2) return 0;
|
|
1597
|
-
let r = 0;
|
|
1598
|
-
for (let e = 0; e < n; e++) {
|
|
1599
|
-
let i = t[e], a = t[e + 1 === n ? 0 : e + 1], o = t[e + 2 >= n ? (e + 2) % n : e + 2];
|
|
1600
|
-
r += (o[0] - i[0]) * Ft * Math.sin(a[1] * Ft);
|
|
1601
|
-
}
|
|
1602
|
-
return Math.abs(r * Pt * Pt / 2);
|
|
1603
|
-
}
|
|
1604
|
-
function Bt(e) {
|
|
1605
|
-
let t = e[0], n = e[e.length - 1];
|
|
1606
|
-
return t && n && (t[0] !== n[0] || t[1] !== n[1]) ? [...e, t] : e;
|
|
1607
|
-
}
|
|
1608
|
-
function Vt(e) {
|
|
1609
|
-
let t = Bt(e), n = 0, r = 0, i = 0;
|
|
1610
|
-
for (let e = 0; e < t.length - 1; e++) {
|
|
1611
|
-
let [a, o] = t[e], [s, c] = t[e + 1], l = a * c - s * o;
|
|
1612
|
-
n += l, r += (a + s) * l, i += (o + c) * l;
|
|
2048
|
+
}, 8, ["open", "lng-lat"])) : O("", !0)]));
|
|
1613
2049
|
}
|
|
1614
|
-
|
|
1615
|
-
let e = t.slice(0, -1);
|
|
1616
|
-
return [e.reduce((e, t) => e + t[0], 0) / e.length, e.reduce((e, t) => e + t[1], 0) / e.length];
|
|
1617
|
-
}
|
|
1618
|
-
return [r / (3 * n), i / (3 * n)];
|
|
1619
|
-
}
|
|
1620
|
-
// src/components/MMapMeasure.vue?vue&type=script&setup=true&lang.ts
|
|
1621
|
-
var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "aria-pressed"], Gt = ["title", "disabled"], Kt = [
|
|
2050
|
+
}), sn = { class: "hidden" }, cn = ["title", "aria-pressed"], ln = ["title", "aria-pressed"], un = ["title", "disabled"], dn = [
|
|
1622
2051
|
"aria-label",
|
|
1623
2052
|
"title",
|
|
1624
2053
|
"onClick"
|
|
1625
|
-
],
|
|
2054
|
+
], fn = /* @__PURE__ */ P({
|
|
1626
2055
|
__name: "MMapMeasure",
|
|
1627
2056
|
props: {
|
|
1628
2057
|
modelValue: { default: null },
|
|
@@ -1633,14 +2062,14 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1633
2062
|
},
|
|
1634
2063
|
emits: ["update:modelValue", "change"],
|
|
1635
2064
|
setup(t, { expose: n, emit: r }) {
|
|
1636
|
-
let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } =
|
|
1637
|
-
done: `${
|
|
1638
|
-
draft: `${
|
|
1639
|
-
handles: `${
|
|
1640
|
-
}, g = `${h.handles}-vertex`, _ = `${h.handles}-midpoint`, v = [], y = [],
|
|
2065
|
+
let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } = pe(), f = l(["primary", "surface"]), p = `m3-measure-${ie()}`, h = {
|
|
2066
|
+
done: `${p}-done`,
|
|
2067
|
+
draft: `${p}-draft`,
|
|
2068
|
+
handles: `${p}-handles`
|
|
2069
|
+
}, g = `${h.handles}-vertex`, _ = `${h.handles}-midpoint`, v = [], y = [], b = null, x = !1, S = null, w = 0, T, j = G(null), P = G(0), F = q([]), I = () => typeof document < "u" && document.documentElement.lang || void 0, L = (e, t) => new Intl.NumberFormat(I(), {
|
|
1641
2070
|
minimumFractionDigits: t,
|
|
1642
2071
|
maximumFractionDigits: t
|
|
1643
|
-
}).format(e),
|
|
2072
|
+
}).format(e), R = (e) => e === 0 ? "" : e < 1e3 ? `${L(Math.round(e), 0)} m` : `${L(e / 1e3, 2)} km`, ee = (e) => e >= 1e6 ? `${L(e / 1e6, 2)} km²` : e >= 1e4 ? `${L(e / 1e4, 2)} ha` : `${L(Math.round(e), 0)} m²`, te = (e, t = {}) => ({
|
|
1644
2073
|
type: "Feature",
|
|
1645
2074
|
geometry: {
|
|
1646
2075
|
type: "Point",
|
|
@@ -1648,7 +2077,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1648
2077
|
},
|
|
1649
2078
|
properties: t
|
|
1650
2079
|
});
|
|
1651
|
-
function
|
|
2080
|
+
function B(e, t, n, r) {
|
|
1652
2081
|
let i = e.map((e) => te(e)), a = [];
|
|
1653
2082
|
if (e.length < 2) return {
|
|
1654
2083
|
features: i,
|
|
@@ -1664,10 +2093,10 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1664
2093
|
});
|
|
1665
2094
|
let s = (e) => {
|
|
1666
2095
|
for (let t = 0; t < e.length - 1; t++) {
|
|
1667
|
-
let r =
|
|
2096
|
+
let r = R(Be(e[t], e[t + 1]));
|
|
1668
2097
|
r && a.push({
|
|
1669
2098
|
key: `${n}-s${t}`,
|
|
1670
|
-
at:
|
|
2099
|
+
at: He(e[t], e[t + 1]),
|
|
1671
2100
|
text: r,
|
|
1672
2101
|
kind: "segment"
|
|
1673
2102
|
});
|
|
@@ -1676,12 +2105,12 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1676
2105
|
if (t === "distance") s(e), a.push({
|
|
1677
2106
|
key: `${n}-t`,
|
|
1678
2107
|
at: e[e.length - 1],
|
|
1679
|
-
text: `${o.mapTotal}: ${
|
|
2108
|
+
text: `${o.mapTotal}: ${R(Ve(e))}`,
|
|
1680
2109
|
kind: "total",
|
|
1681
2110
|
m: r
|
|
1682
2111
|
});
|
|
1683
2112
|
else if (e.length >= 3) {
|
|
1684
|
-
let t =
|
|
2113
|
+
let t = We(e);
|
|
1685
2114
|
i.push({
|
|
1686
2115
|
type: "Feature",
|
|
1687
2116
|
geometry: {
|
|
@@ -1691,15 +2120,15 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1691
2120
|
properties: {}
|
|
1692
2121
|
}), s(t), a.push({
|
|
1693
2122
|
key: `${n}-a`,
|
|
1694
|
-
at:
|
|
1695
|
-
text: ee(
|
|
2123
|
+
at: Ge(t),
|
|
2124
|
+
text: ee(Ue(t)),
|
|
1696
2125
|
kind: "area",
|
|
1697
2126
|
m: r
|
|
1698
2127
|
});
|
|
1699
2128
|
} else a.push({
|
|
1700
2129
|
key: `${n}-t`,
|
|
1701
2130
|
at: e[e.length - 1],
|
|
1702
|
-
text:
|
|
2131
|
+
text: R(Ve(e)),
|
|
1703
2132
|
kind: "total",
|
|
1704
2133
|
m: r
|
|
1705
2134
|
});
|
|
@@ -1708,46 +2137,46 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1708
2137
|
labels: a
|
|
1709
2138
|
};
|
|
1710
2139
|
}
|
|
1711
|
-
let
|
|
2140
|
+
let V = (e) => ({
|
|
1712
2141
|
type: "FeatureCollection",
|
|
1713
2142
|
features: e
|
|
1714
|
-
}),
|
|
1715
|
-
function
|
|
1716
|
-
if (!
|
|
1717
|
-
let e = v.map((e, t) =>
|
|
2143
|
+
}), U = (e, t) => (T?.getSource(e))?.setData(V(t));
|
|
2144
|
+
function W() {
|
|
2145
|
+
if (!T) return;
|
|
2146
|
+
let e = v.map((e, t) => B(e.points, e.mode, `m${t}`, t)), t = j.value && y.length ? B(b ? [...y, b] : y, j.value, "draft") : {
|
|
1718
2147
|
features: [],
|
|
1719
2148
|
labels: []
|
|
1720
2149
|
};
|
|
1721
|
-
|
|
2150
|
+
U(h.done, e.flatMap((e) => e.features)), U(h.draft, t.features);
|
|
1722
2151
|
let n = [];
|
|
1723
|
-
|
|
2152
|
+
j.value || v.forEach((e, t) => {
|
|
1724
2153
|
(e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(te(e, {
|
|
1725
2154
|
handle: "vertex",
|
|
1726
2155
|
m: t,
|
|
1727
2156
|
v: r
|
|
1728
2157
|
})));
|
|
1729
|
-
for (let r = 0; r < e.points.length - 1; r++) n.push(te(
|
|
2158
|
+
for (let r = 0; r < e.points.length - 1; r++) n.push(te(He(e.points[r], e.points[r + 1]), {
|
|
1730
2159
|
handle: "midpoint",
|
|
1731
2160
|
m: t,
|
|
1732
2161
|
after: r
|
|
1733
2162
|
}));
|
|
1734
|
-
}),
|
|
2163
|
+
}), U(h.handles, n), F.value = [...e.flatMap((e) => e.labels), ...t.labels];
|
|
1735
2164
|
}
|
|
1736
|
-
function
|
|
2165
|
+
function K() {
|
|
1737
2166
|
P.value = v.length, a("change", v.map((e) => ({
|
|
1738
2167
|
mode: e.mode,
|
|
1739
2168
|
points: e.points.map((e) => [...e]),
|
|
1740
2169
|
closed: e.closed,
|
|
1741
|
-
length:
|
|
1742
|
-
...e.mode === "area" || e.closed ? { area:
|
|
2170
|
+
length: Ve(e.points),
|
|
2171
|
+
...e.mode === "area" || e.closed ? { area: Ue(e.points) } : {}
|
|
1743
2172
|
})));
|
|
1744
2173
|
}
|
|
1745
|
-
let
|
|
2174
|
+
let Y = (e) => [
|
|
1746
2175
|
"==",
|
|
1747
2176
|
["geometry-type"],
|
|
1748
2177
|
e
|
|
1749
2178
|
];
|
|
1750
|
-
function
|
|
2179
|
+
function ae() {
|
|
1751
2180
|
let { primary: e, surface: t } = f.value;
|
|
1752
2181
|
return {
|
|
1753
2182
|
fill: { "fill-color": e },
|
|
@@ -1758,20 +2187,20 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1758
2187
|
}
|
|
1759
2188
|
};
|
|
1760
2189
|
}
|
|
1761
|
-
function
|
|
1762
|
-
if (!
|
|
1763
|
-
for (let e of Object.values(h))
|
|
2190
|
+
function oe() {
|
|
2191
|
+
if (!T) return;
|
|
2192
|
+
for (let e of Object.values(h)) T.getSource(e) || T.addSource(e, {
|
|
1764
2193
|
type: "geojson",
|
|
1765
|
-
data:
|
|
2194
|
+
data: V([])
|
|
1766
2195
|
});
|
|
1767
|
-
let e =
|
|
1768
|
-
|
|
2196
|
+
let e = ae(), t = (e) => {
|
|
2197
|
+
T.getLayer(e.id) || T.addLayer(e);
|
|
1769
2198
|
};
|
|
1770
2199
|
for (let [n, r] of [[h.done, !1], [h.draft, !0]]) t({
|
|
1771
2200
|
id: `${n}-fill`,
|
|
1772
2201
|
type: "fill",
|
|
1773
2202
|
source: n,
|
|
1774
|
-
filter:
|
|
2203
|
+
filter: Y("Polygon"),
|
|
1775
2204
|
paint: {
|
|
1776
2205
|
...e.fill,
|
|
1777
2206
|
"fill-opacity": r ? .15 : .2
|
|
@@ -1794,7 +2223,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1794
2223
|
id: `${n}-points`,
|
|
1795
2224
|
type: "circle",
|
|
1796
2225
|
source: n,
|
|
1797
|
-
filter:
|
|
2226
|
+
filter: Y("Point"),
|
|
1798
2227
|
paint: {
|
|
1799
2228
|
...e.vertices,
|
|
1800
2229
|
"circle-radius": 5,
|
|
@@ -1832,121 +2261,121 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1832
2261
|
}
|
|
1833
2262
|
});
|
|
1834
2263
|
}
|
|
1835
|
-
|
|
1836
|
-
if (!
|
|
1837
|
-
let e =
|
|
1838
|
-
if (
|
|
2264
|
+
Z(f, () => {
|
|
2265
|
+
if (!T) return;
|
|
2266
|
+
let e = ae(), t = (e, t) => {
|
|
2267
|
+
if (T.getLayer(e)) for (let [n, r] of Object.entries(t)) T.setPaintProperty(e, n, r);
|
|
1839
2268
|
};
|
|
1840
2269
|
for (let n of [h.done, h.draft]) t(`${n}-fill`, e.fill), t(`${n}-line`, e.line), t(`${n}-points`, e.vertices);
|
|
1841
2270
|
t(_, e.vertices), t(g, e.vertices);
|
|
1842
2271
|
});
|
|
1843
|
-
let
|
|
1844
|
-
function
|
|
2272
|
+
let ce = (e) => [e.lngLat.lng, e.lngLat.lat];
|
|
2273
|
+
function le(e) {
|
|
1845
2274
|
if (y.length >= 2) {
|
|
1846
|
-
let t =
|
|
2275
|
+
let t = T.project(y[0]);
|
|
1847
2276
|
if (Math.hypot(t.x - e.point.x, t.y - e.point.y) < 20) {
|
|
1848
|
-
|
|
2277
|
+
x = !0, xe();
|
|
1849
2278
|
return;
|
|
1850
2279
|
}
|
|
1851
2280
|
}
|
|
1852
|
-
y.push(
|
|
2281
|
+
y.push(ce(e)), W();
|
|
1853
2282
|
}
|
|
1854
|
-
function
|
|
1855
|
-
|
|
1856
|
-
|
|
2283
|
+
function ue(e) {
|
|
2284
|
+
b = ce(e), w ||= requestAnimationFrame(() => {
|
|
2285
|
+
w = 0, W();
|
|
1857
2286
|
});
|
|
1858
2287
|
}
|
|
1859
|
-
function
|
|
2288
|
+
function de(e) {
|
|
1860
2289
|
if (e.preventDefault(), y.length < 2) return;
|
|
1861
|
-
let t =
|
|
1862
|
-
Math.hypot(t.x - n.x, t.y - n.y) < 10 && y.pop(),
|
|
2290
|
+
let t = T.project(y[y.length - 1]), n = T.project(y[y.length - 2]);
|
|
2291
|
+
Math.hypot(t.x - n.x, t.y - n.y) < 10 && y.pop(), xe();
|
|
1863
2292
|
}
|
|
1864
|
-
function
|
|
1865
|
-
e.key === "Enter" &&
|
|
2293
|
+
function fe(e) {
|
|
2294
|
+
e.key === "Enter" && xe();
|
|
1866
2295
|
}
|
|
1867
|
-
|
|
1868
|
-
let
|
|
1869
|
-
function
|
|
1870
|
-
|
|
1871
|
-
|
|
2296
|
+
m(() => !!j.value, () => xe(!0));
|
|
2297
|
+
let me = () => typeof navigator < "u" ? navigator.keyboard : void 0, he = !1;
|
|
2298
|
+
function _e() {
|
|
2299
|
+
j.value && document.fullscreenElement && me()?.lock && me().lock(["Escape"]).then(() => {
|
|
2300
|
+
he = !0;
|
|
1872
2301
|
}, () => {});
|
|
1873
2302
|
}
|
|
1874
|
-
function
|
|
1875
|
-
|
|
2303
|
+
function ve() {
|
|
2304
|
+
j.value || (he && me()?.unlock?.(), he = !1);
|
|
1876
2305
|
}
|
|
1877
|
-
function
|
|
2306
|
+
function ye() {
|
|
1878
2307
|
let e, t = () => {
|
|
1879
|
-
document.removeEventListener("keyup", n, !0), clearTimeout(e), setTimeout(
|
|
2308
|
+
document.removeEventListener("keyup", n, !0), clearTimeout(e), setTimeout(ve);
|
|
1880
2309
|
}, n = (e) => {
|
|
1881
2310
|
e.key === "Escape" && t();
|
|
1882
2311
|
};
|
|
1883
2312
|
document.addEventListener("keyup", n, !0), e = setTimeout(t, 1500);
|
|
1884
2313
|
}
|
|
1885
|
-
function
|
|
1886
|
-
if (
|
|
1887
|
-
if (
|
|
1888
|
-
|
|
2314
|
+
function be(e) {
|
|
2315
|
+
if (T) {
|
|
2316
|
+
if (j.value === e) return xe();
|
|
2317
|
+
j.value && xe(), j.value = e, d.value = "measure", y = [], b = null, T.getCanvas().style.cursor = "crosshair", T.doubleClickZoom.disable(), T.on("click", le), T.on("mousemove", ue), T.on("dblclick", de), document.addEventListener("keydown", fe), document.addEventListener("fullscreenchange", _e), _e(), W(), i.modelValue !== e && a("update:modelValue", e);
|
|
1889
2318
|
}
|
|
1890
2319
|
}
|
|
1891
|
-
function
|
|
1892
|
-
if (!
|
|
1893
|
-
cancelAnimationFrame(
|
|
1894
|
-
let t = y.length >= 3 && (
|
|
2320
|
+
function xe(e = !1) {
|
|
2321
|
+
if (!T || !j.value) return;
|
|
2322
|
+
cancelAnimationFrame(w), w = 0;
|
|
2323
|
+
let t = y.length >= 3 && (x || j.value === "area");
|
|
1895
2324
|
y.length >= 2 && v.push({
|
|
1896
|
-
mode:
|
|
2325
|
+
mode: j.value,
|
|
1897
2326
|
points: t ? [...y, [...y[0]]] : y,
|
|
1898
2327
|
closed: t
|
|
1899
|
-
}), y = [],
|
|
2328
|
+
}), y = [], b = null, x = !1, j.value = null, d.value === "measure" && (d.value = null), T.getCanvas().style.cursor = "", T.doubleClickZoom.enable(), T.off("click", le), T.off("mousemove", ue), T.off("dblclick", de), document.removeEventListener("keydown", fe), document.removeEventListener("fullscreenchange", _e), e && he ? ye() : ve(), W(), K(), i.modelValue !== null && a("update:modelValue", null);
|
|
1900
2329
|
}
|
|
1901
2330
|
function Se(e) {
|
|
1902
|
-
v[e] && (v.splice(e, 1),
|
|
2331
|
+
v[e] && (v.splice(e, 1), W(), K());
|
|
1903
2332
|
}
|
|
1904
2333
|
function Ce() {
|
|
1905
|
-
|
|
2334
|
+
j.value && xe(), v.length = 0, W(), K();
|
|
1906
2335
|
}
|
|
1907
2336
|
function $(e) {
|
|
1908
2337
|
let t = e.features?.[0];
|
|
1909
|
-
if (!t ||
|
|
2338
|
+
if (!t || j.value || !T) return;
|
|
1910
2339
|
e.preventDefault();
|
|
1911
2340
|
let n = t.properties.m, r = v[n];
|
|
1912
2341
|
if (!r) return;
|
|
1913
2342
|
let i = t.properties.v;
|
|
1914
|
-
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0,
|
|
2343
|
+
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0, ce(e))), S = {
|
|
1915
2344
|
m: n,
|
|
1916
2345
|
v: i
|
|
1917
|
-
}, d.value = "measure",
|
|
2346
|
+
}, d.value = "measure", T.getCanvas().style.cursor = "grabbing";
|
|
1918
2347
|
let a = e.type === "touchstart";
|
|
1919
|
-
a &&
|
|
2348
|
+
a && T.dragPan.disable(), T.on(a ? "touchmove" : "mousemove", we), T.once(a ? "touchend" : "mouseup", Te), W();
|
|
1920
2349
|
}
|
|
1921
2350
|
function we(e) {
|
|
1922
|
-
if (!
|
|
1923
|
-
let t = v[
|
|
2351
|
+
if (!S) return;
|
|
2352
|
+
let t = v[S.m];
|
|
1924
2353
|
if (!t) return;
|
|
1925
|
-
let n =
|
|
1926
|
-
t.points[
|
|
2354
|
+
let n = ce(e);
|
|
2355
|
+
t.points[S.v] = n, t.closed && S.v === 0 && (t.points[t.points.length - 1] = n), W();
|
|
1927
2356
|
}
|
|
1928
2357
|
function Te() {
|
|
1929
|
-
|
|
1930
|
-
d.value === "measure" && !
|
|
2358
|
+
T && (S = null, T.off("mousemove", we), T.off("touchmove", we), T.dragPan.enable(), T.getCanvas().style.cursor = "", K(), setTimeout(() => {
|
|
2359
|
+
d.value === "measure" && !j.value && (d.value = null);
|
|
1931
2360
|
}));
|
|
1932
2361
|
}
|
|
1933
2362
|
let Ee = () => {
|
|
1934
|
-
|
|
2363
|
+
T && !S && !j.value && (T.getCanvas().style.cursor = "grab");
|
|
1935
2364
|
}, De = () => {
|
|
1936
|
-
|
|
2365
|
+
T && !S && !j.value && (T.getCanvas().style.cursor = "");
|
|
1937
2366
|
};
|
|
1938
2367
|
c((e) => {
|
|
1939
|
-
|
|
2368
|
+
T = e, oe();
|
|
1940
2369
|
for (let t of [g, _]) e.on("mousedown", t, $), e.on("touchstart", t, $), e.on("mouseenter", t, Ee), e.on("mouseleave", t, De);
|
|
1941
|
-
i.modelValue &&
|
|
1942
|
-
}),
|
|
1943
|
-
|
|
1944
|
-
}),
|
|
1945
|
-
e && e !==
|
|
1946
|
-
}),
|
|
1947
|
-
if (!
|
|
1948
|
-
|
|
1949
|
-
for (let e of [g, _])
|
|
2370
|
+
i.modelValue && be(i.modelValue);
|
|
2371
|
+
}), Z(u, () => {
|
|
2372
|
+
oe(), W();
|
|
2373
|
+
}), Z(() => i.modelValue, (e) => {
|
|
2374
|
+
e && e !== j.value ? be(e) : !e && j.value && xe();
|
|
2375
|
+
}), ne(() => {
|
|
2376
|
+
if (!T) return;
|
|
2377
|
+
j.value && xe();
|
|
2378
|
+
for (let e of [g, _]) T.off("mousedown", e, $), T.off("touchstart", e, $), T.off("mouseenter", e, Ee), T.off("mouseleave", e, De);
|
|
1950
2379
|
let e = [
|
|
1951
2380
|
g,
|
|
1952
2381
|
_,
|
|
@@ -1956,74 +2385,74 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1956
2385
|
`${e}-fill`
|
|
1957
2386
|
])
|
|
1958
2387
|
];
|
|
1959
|
-
for (let t of e)
|
|
1960
|
-
for (let e of Object.values(h))
|
|
2388
|
+
for (let t of e) T.getLayer(t) && T.removeLayer(t);
|
|
2389
|
+
for (let e of Object.values(h)) T.getSource(e) && T.removeSource(e);
|
|
1961
2390
|
});
|
|
1962
|
-
let Oe =
|
|
2391
|
+
let Oe = E(() => i.control === !0 ? "top-right" : i.control || "top-right");
|
|
1963
2392
|
return n({
|
|
1964
|
-
start:
|
|
1965
|
-
finish:
|
|
2393
|
+
start: be,
|
|
2394
|
+
finish: xe,
|
|
1966
2395
|
clear: Ce,
|
|
1967
2396
|
remove: Se
|
|
1968
|
-
}), (n, r) => (
|
|
2397
|
+
}), (n, r) => (H(), k("div", sn, [t.control ? (H(), D(ge, {
|
|
1969
2398
|
key: 0,
|
|
1970
2399
|
position: Oe.value
|
|
1971
2400
|
}, {
|
|
1972
|
-
default:
|
|
1973
|
-
|
|
2401
|
+
default: Q(() => [
|
|
2402
|
+
A("button", {
|
|
1974
2403
|
type: "button",
|
|
1975
2404
|
class: "grid place-items-center",
|
|
1976
|
-
title:
|
|
1977
|
-
"aria-pressed":
|
|
1978
|
-
onClick: r[0] ||= (e) =>
|
|
1979
|
-
}, [
|
|
2405
|
+
title: X(o).mapMeasureDistance,
|
|
2406
|
+
"aria-pressed": j.value === "distance",
|
|
2407
|
+
onClick: r[0] ||= (e) => be("distance")
|
|
2408
|
+
}, [N(e, {
|
|
1980
2409
|
name: "straighten",
|
|
1981
2410
|
size: 20
|
|
1982
|
-
})], 8,
|
|
1983
|
-
|
|
2411
|
+
})], 8, cn),
|
|
2412
|
+
A("button", {
|
|
1984
2413
|
type: "button",
|
|
1985
2414
|
class: "grid place-items-center",
|
|
1986
|
-
title:
|
|
1987
|
-
"aria-pressed":
|
|
1988
|
-
onClick: r[1] ||= (e) =>
|
|
1989
|
-
}, [
|
|
1990
|
-
name: "
|
|
2415
|
+
title: X(o).mapMeasureArea,
|
|
2416
|
+
"aria-pressed": j.value === "area",
|
|
2417
|
+
onClick: r[1] ||= (e) => be("area")
|
|
2418
|
+
}, [N(e, {
|
|
2419
|
+
name: "square_foot",
|
|
1991
2420
|
size: 20
|
|
1992
|
-
})], 8,
|
|
1993
|
-
|
|
2421
|
+
})], 8, ln),
|
|
2422
|
+
A("button", {
|
|
1994
2423
|
type: "button",
|
|
1995
2424
|
class: "grid place-items-center",
|
|
1996
|
-
title:
|
|
1997
|
-
disabled: !P.value && !
|
|
2425
|
+
title: X(o).mapClearMeasurements,
|
|
2426
|
+
disabled: !P.value && !j.value,
|
|
1998
2427
|
onClick: Ce
|
|
1999
|
-
}, [
|
|
2428
|
+
}, [N(e, {
|
|
2000
2429
|
name: "delete",
|
|
2001
2430
|
size: 20
|
|
2002
|
-
})], 8,
|
|
2431
|
+
})], 8, un)
|
|
2003
2432
|
]),
|
|
2004
2433
|
_: 1
|
|
2005
|
-
}, 8, ["position"])) :
|
|
2434
|
+
}, 8, ["position"])) : O("", !0), (H(!0), k(C, null, re(F.value, (t) => (H(), D(Me, {
|
|
2006
2435
|
key: t.key,
|
|
2007
2436
|
"lng-lat": t.at,
|
|
2008
2437
|
anchor: t.kind === "area" ? "center" : "top",
|
|
2009
2438
|
offset: t.kind === "area" ? [0, 0] : [0, 8],
|
|
2010
2439
|
class: "pointer-events-none"
|
|
2011
2440
|
}, {
|
|
2012
|
-
default:
|
|
2441
|
+
default: Q(() => [A("span", { class: z(["flex items-center gap-1 whitespace-nowrap rounded-full py-0.5 shadow-elevation-1", [t.kind === "segment" ? "bg-surface-container-highest text-label-small text-on-surface" : "bg-primary text-label-medium text-on-primary", t.m === void 0 ? "px-2" : "pr-0.5 pl-2"]]) }, [M(J(t.text) + " ", 1), t.m === void 0 ? O("", !0) : (H(), k("button", {
|
|
2013
2442
|
key: 0,
|
|
2014
2443
|
type: "button",
|
|
2015
2444
|
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",
|
|
2016
|
-
"aria-label":
|
|
2017
|
-
title:
|
|
2018
|
-
onClick:
|
|
2019
|
-
onPointerdown: r[2] ||=
|
|
2020
|
-
onMousedown: r[3] ||=
|
|
2021
|
-
onTouchstart: r[4] ||=
|
|
2022
|
-
onDblclick: r[5] ||=
|
|
2023
|
-
}, [
|
|
2445
|
+
"aria-label": X(o).mapDeleteMeasurement,
|
|
2446
|
+
title: X(o).mapDeleteMeasurement,
|
|
2447
|
+
onClick: se((e) => Se(t.m), ["stop"]),
|
|
2448
|
+
onPointerdown: r[2] ||= se(() => {}, ["stop"]),
|
|
2449
|
+
onMousedown: r[3] ||= se(() => {}, ["stop"]),
|
|
2450
|
+
onTouchstart: r[4] ||= se(() => {}, ["stop"]),
|
|
2451
|
+
onDblclick: r[5] ||= se(() => {}, ["stop"])
|
|
2452
|
+
}, [N(e, {
|
|
2024
2453
|
name: "close",
|
|
2025
2454
|
size: 14
|
|
2026
|
-
})], 40,
|
|
2455
|
+
})], 40, dn))], 2)]),
|
|
2027
2456
|
_: 2
|
|
2028
2457
|
}, 1032, [
|
|
2029
2458
|
"lng-lat",
|
|
@@ -2031,16 +2460,16 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2031
2460
|
"offset"
|
|
2032
2461
|
]))), 128))]));
|
|
2033
2462
|
}
|
|
2034
|
-
}),
|
|
2463
|
+
}), pn = { class: "hidden" }, mn = [
|
|
2035
2464
|
"title",
|
|
2036
2465
|
"aria-label",
|
|
2037
2466
|
"aria-pressed",
|
|
2038
2467
|
"onClick"
|
|
2039
|
-
],
|
|
2468
|
+
], hn = [
|
|
2040
2469
|
"title",
|
|
2041
2470
|
"aria-label",
|
|
2042
2471
|
"disabled"
|
|
2043
|
-
],
|
|
2472
|
+
], gn = "draw", _n = 6, vn = /* @__PURE__ */ P({
|
|
2044
2473
|
__name: "MMapDraw",
|
|
2045
2474
|
props: {
|
|
2046
2475
|
modelValue: {},
|
|
@@ -2066,23 +2495,23 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2066
2495
|
"select"
|
|
2067
2496
|
],
|
|
2068
2497
|
setup(t, { expose: n, emit: r }) {
|
|
2069
|
-
let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } =
|
|
2498
|
+
let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } = pe(), f = l([
|
|
2070
2499
|
"primary",
|
|
2071
2500
|
"secondary",
|
|
2072
2501
|
"tertiary",
|
|
2073
2502
|
"surface"
|
|
2074
|
-
]),
|
|
2075
|
-
shapes: `${
|
|
2076
|
-
draft: `${
|
|
2077
|
-
handles: `${
|
|
2503
|
+
]), p = `m3-draw-${ie()}`, h = {
|
|
2504
|
+
shapes: `${p}-shapes`,
|
|
2505
|
+
draft: `${p}-draft`,
|
|
2506
|
+
handles: `${p}-handles`
|
|
2078
2507
|
}, g = [
|
|
2079
2508
|
`${h.shapes}-fill`,
|
|
2080
2509
|
`${h.shapes}-line`,
|
|
2081
2510
|
`${h.shapes}-point`
|
|
2082
|
-
], _ = `${h.handles}-vertex`, v = `${h.handles}-midpoint`, y = [],
|
|
2511
|
+
], _ = `${h.handles}-vertex`, v = `${h.handles}-midpoint`, y = [], b = "", x = 1, S = [], w = null, T = null, A = 0, j, M = G(null), P = G(null), F = (e) => JSON.parse(JSON.stringify(e)), I = (e) => e === null ? void 0 : y.find((t) => t.id === e);
|
|
2083
2512
|
function L(e) {
|
|
2084
2513
|
y = F(e?.features ?? []);
|
|
2085
|
-
for (let e of y) (e.id === void 0 || e.id === null) && (e.id =
|
|
2514
|
+
for (let e of y) (e.id === void 0 || e.id === null) && (e.id = xe());
|
|
2086
2515
|
P.value !== null && !I(P.value) && (P.value = null);
|
|
2087
2516
|
}
|
|
2088
2517
|
function R() {
|
|
@@ -2090,13 +2519,13 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2090
2519
|
type: "FeatureCollection",
|
|
2091
2520
|
features: F(y)
|
|
2092
2521
|
};
|
|
2093
|
-
|
|
2522
|
+
b = JSON.stringify(e.features), a("update:modelValue", e);
|
|
2094
2523
|
}
|
|
2095
|
-
function
|
|
2524
|
+
function ee(e) {
|
|
2096
2525
|
let t = e.geometry;
|
|
2097
2526
|
return t.type === "Point" ? [t.coordinates] : t.type === "LineString" ? t.coordinates : t.type === "Polygon" ? (t.coordinates[0] ?? []).slice(0, -1) : null;
|
|
2098
2527
|
}
|
|
2099
|
-
function
|
|
2528
|
+
function z(e, t) {
|
|
2100
2529
|
let n = e.geometry;
|
|
2101
2530
|
if (n.type === "Point") n.coordinates = t[0];
|
|
2102
2531
|
else if (n.type === "LineString") n.coordinates = t;
|
|
@@ -2105,20 +2534,20 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2105
2534
|
e[0] = [...t, [...t[0]]];
|
|
2106
2535
|
}
|
|
2107
2536
|
}
|
|
2108
|
-
let te = (e) => e.geometry.type === "Polygon" ? 3 : e.geometry.type === "LineString" ? 2 : 1,
|
|
2537
|
+
let te = (e) => e.geometry.type === "Polygon" ? 3 : e.geometry.type === "LineString" ? 2 : 1, B = (e, t = {}) => ({
|
|
2109
2538
|
type: "Feature",
|
|
2110
2539
|
geometry: {
|
|
2111
2540
|
type: "Point",
|
|
2112
2541
|
coordinates: e
|
|
2113
2542
|
},
|
|
2114
2543
|
properties: t
|
|
2115
|
-
}),
|
|
2544
|
+
}), V = (e) => ({
|
|
2116
2545
|
type: "FeatureCollection",
|
|
2117
2546
|
features: e
|
|
2118
|
-
}),
|
|
2119
|
-
function
|
|
2120
|
-
if (!
|
|
2121
|
-
|
|
2547
|
+
}), U = (e, t) => (j?.getSource(e))?.setData(V(t));
|
|
2548
|
+
function W() {
|
|
2549
|
+
if (!j) return;
|
|
2550
|
+
U(h.shapes, y.map((e) => ({
|
|
2122
2551
|
type: "Feature",
|
|
2123
2552
|
geometry: e.geometry,
|
|
2124
2553
|
properties: {
|
|
@@ -2128,16 +2557,16 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2128
2557
|
}
|
|
2129
2558
|
})));
|
|
2130
2559
|
let e = [];
|
|
2131
|
-
if (
|
|
2132
|
-
let t =
|
|
2133
|
-
|
|
2560
|
+
if (M.value && M.value !== "point" && S.length) {
|
|
2561
|
+
let t = w ? [...S, w] : S;
|
|
2562
|
+
S.forEach((t) => e.push(B(t))), t.length >= 2 && e.push({
|
|
2134
2563
|
type: "Feature",
|
|
2135
2564
|
geometry: {
|
|
2136
2565
|
type: "LineString",
|
|
2137
|
-
coordinates:
|
|
2566
|
+
coordinates: M.value === "polygon" && t.length >= 3 ? [...t, t[0]] : t
|
|
2138
2567
|
},
|
|
2139
2568
|
properties: {}
|
|
2140
|
-
}),
|
|
2569
|
+
}), M.value === "polygon" && t.length >= 3 && e.push({
|
|
2141
2570
|
type: "Feature",
|
|
2142
2571
|
geometry: {
|
|
2143
2572
|
type: "Polygon",
|
|
@@ -2146,44 +2575,44 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2146
2575
|
properties: {}
|
|
2147
2576
|
});
|
|
2148
2577
|
}
|
|
2149
|
-
|
|
2150
|
-
let t = [], n = I(P.value), r = n && !
|
|
2151
|
-
if (n && r && (r.forEach((e, n) => t.push(
|
|
2578
|
+
U(h.draft, e);
|
|
2579
|
+
let t = [], n = I(P.value), r = n && !M.value && i.editable ? ee(n) : null;
|
|
2580
|
+
if (n && r && (r.forEach((e, n) => t.push(B(e, {
|
|
2152
2581
|
handle: "vertex",
|
|
2153
2582
|
v: n
|
|
2154
2583
|
}))), n.geometry.type !== "Point")) {
|
|
2155
2584
|
let e = n.geometry.type === "Polygon" ? [...r, r[0]] : r;
|
|
2156
|
-
for (let n = 0; n < e.length - 1; n++) t.push(
|
|
2585
|
+
for (let n = 0; n < e.length - 1; n++) t.push(B(He(e[n], e[n + 1]), {
|
|
2157
2586
|
handle: "midpoint",
|
|
2158
2587
|
after: n
|
|
2159
2588
|
}));
|
|
2160
2589
|
}
|
|
2161
|
-
|
|
2590
|
+
U(h.handles, t);
|
|
2162
2591
|
}
|
|
2163
|
-
function
|
|
2164
|
-
|
|
2165
|
-
|
|
2592
|
+
function K() {
|
|
2593
|
+
A ||= requestAnimationFrame(() => {
|
|
2594
|
+
A = 0, W();
|
|
2166
2595
|
});
|
|
2167
2596
|
}
|
|
2168
|
-
let
|
|
2597
|
+
let q = (...e) => [
|
|
2169
2598
|
"match",
|
|
2170
2599
|
["geometry-type"],
|
|
2171
2600
|
e,
|
|
2172
2601
|
!0,
|
|
2173
2602
|
!1
|
|
2174
|
-
],
|
|
2603
|
+
], J = [
|
|
2175
2604
|
"==",
|
|
2176
2605
|
["get", "__draw_selected"],
|
|
2177
2606
|
!0
|
|
2178
2607
|
];
|
|
2179
|
-
function
|
|
2608
|
+
function Y() {
|
|
2180
2609
|
let e = f.value[i.color], t = f.value.surface;
|
|
2181
2610
|
return {
|
|
2182
2611
|
fill: {
|
|
2183
2612
|
"fill-color": e,
|
|
2184
2613
|
"fill-opacity": [
|
|
2185
2614
|
"case",
|
|
2186
|
-
|
|
2615
|
+
J,
|
|
2187
2616
|
.3,
|
|
2188
2617
|
.18
|
|
2189
2618
|
]
|
|
@@ -2192,7 +2621,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2192
2621
|
"line-color": e,
|
|
2193
2622
|
"line-width": [
|
|
2194
2623
|
"case",
|
|
2195
|
-
|
|
2624
|
+
J,
|
|
2196
2625
|
4,
|
|
2197
2626
|
2.5
|
|
2198
2627
|
]
|
|
@@ -2201,7 +2630,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2201
2630
|
"circle-color": e,
|
|
2202
2631
|
"circle-radius": [
|
|
2203
2632
|
"case",
|
|
2204
|
-
|
|
2633
|
+
J,
|
|
2205
2634
|
8,
|
|
2206
2635
|
6
|
|
2207
2636
|
],
|
|
@@ -2219,44 +2648,44 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2219
2648
|
}
|
|
2220
2649
|
};
|
|
2221
2650
|
}
|
|
2222
|
-
function
|
|
2223
|
-
if (!
|
|
2224
|
-
for (let e of Object.values(h))
|
|
2651
|
+
function ae() {
|
|
2652
|
+
if (!j) return;
|
|
2653
|
+
for (let e of Object.values(h)) j.getSource(e) || j.addSource(e, {
|
|
2225
2654
|
type: "geojson",
|
|
2226
|
-
data:
|
|
2655
|
+
data: V([])
|
|
2227
2656
|
});
|
|
2228
|
-
let e =
|
|
2229
|
-
|
|
2657
|
+
let e = Y(), t = (e) => {
|
|
2658
|
+
j.getLayer(e.id) || j.addLayer(e);
|
|
2230
2659
|
};
|
|
2231
2660
|
t({
|
|
2232
2661
|
id: g[0],
|
|
2233
2662
|
type: "fill",
|
|
2234
2663
|
source: h.shapes,
|
|
2235
|
-
filter:
|
|
2664
|
+
filter: q("Polygon", "MultiPolygon"),
|
|
2236
2665
|
paint: e.fill
|
|
2237
2666
|
}), t({
|
|
2238
2667
|
id: g[1],
|
|
2239
2668
|
type: "line",
|
|
2240
2669
|
source: h.shapes,
|
|
2241
|
-
filter:
|
|
2670
|
+
filter: q("LineString", "MultiLineString", "Polygon", "MultiPolygon"),
|
|
2242
2671
|
paint: e.line
|
|
2243
2672
|
}), t({
|
|
2244
2673
|
id: g[2],
|
|
2245
2674
|
type: "circle",
|
|
2246
2675
|
source: h.shapes,
|
|
2247
|
-
filter:
|
|
2676
|
+
filter: q("Point", "MultiPoint"),
|
|
2248
2677
|
paint: e.point
|
|
2249
2678
|
}), t({
|
|
2250
2679
|
id: `${h.draft}-fill`,
|
|
2251
2680
|
type: "fill",
|
|
2252
2681
|
source: h.draft,
|
|
2253
|
-
filter:
|
|
2682
|
+
filter: q("Polygon"),
|
|
2254
2683
|
paint: e.draftFill
|
|
2255
2684
|
}), t({
|
|
2256
2685
|
id: `${h.draft}-line`,
|
|
2257
2686
|
type: "line",
|
|
2258
2687
|
source: h.draft,
|
|
2259
|
-
filter:
|
|
2688
|
+
filter: q("LineString"),
|
|
2260
2689
|
paint: {
|
|
2261
2690
|
...e.draftLine,
|
|
2262
2691
|
"line-width": 2.5,
|
|
@@ -2266,7 +2695,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2266
2695
|
id: `${h.draft}-point`,
|
|
2267
2696
|
type: "circle",
|
|
2268
2697
|
source: h.draft,
|
|
2269
|
-
filter:
|
|
2698
|
+
filter: q("Point"),
|
|
2270
2699
|
paint: {
|
|
2271
2700
|
...e.handle,
|
|
2272
2701
|
"circle-radius": 5,
|
|
@@ -2303,164 +2732,164 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2303
2732
|
}
|
|
2304
2733
|
});
|
|
2305
2734
|
}
|
|
2306
|
-
|
|
2307
|
-
if (!
|
|
2308
|
-
let e =
|
|
2309
|
-
if (
|
|
2735
|
+
Z([f, () => i.color], () => {
|
|
2736
|
+
if (!j) return;
|
|
2737
|
+
let e = Y(), t = (e, t) => {
|
|
2738
|
+
if (j.getLayer(e)) for (let [n, r] of Object.entries(t)) j.setPaintProperty(e, n, r);
|
|
2310
2739
|
};
|
|
2311
2740
|
t(g[0], e.fill), t(g[1], e.line), t(g[2], e.point), t(`${h.draft}-fill`, e.draftFill), t(`${h.draft}-line`, e.draftLine), t(`${h.draft}-point`, e.handle), t(v, e.handle), t(_, e.handle);
|
|
2312
2741
|
});
|
|
2313
|
-
function
|
|
2742
|
+
function oe(e) {
|
|
2314
2743
|
if (e !== null && !I(e) && (e = null), P.value === e) return;
|
|
2315
|
-
P.value = e,
|
|
2744
|
+
P.value = e, W();
|
|
2316
2745
|
let t = I(e);
|
|
2317
2746
|
a("select", t ? F(t) : null);
|
|
2318
2747
|
}
|
|
2319
|
-
function
|
|
2748
|
+
function se(e = P.value) {
|
|
2320
2749
|
let t = y.findIndex((t) => t.id === e);
|
|
2321
|
-
t < 0 || (y.splice(t, 1), P.value === e && (P.value = null, a("select", null)),
|
|
2750
|
+
t < 0 || (y.splice(t, 1), P.value === e && (P.value = null, a("select", null)), W(), R());
|
|
2322
2751
|
}
|
|
2323
|
-
function
|
|
2324
|
-
|
|
2752
|
+
function ce() {
|
|
2753
|
+
M.value && $(), y.length && (y = [], P.value !== null && (P.value = null, a("select", null)), W(), R());
|
|
2325
2754
|
}
|
|
2326
|
-
let
|
|
2327
|
-
function
|
|
2328
|
-
if (
|
|
2329
|
-
let { x: t, y: n } = e.point, r = [[t -
|
|
2330
|
-
if (a === void 0) return
|
|
2755
|
+
let le = (e) => [e.lngLat.lng, e.lngLat.lat];
|
|
2756
|
+
function ue(e) {
|
|
2757
|
+
if (M.value || !j || !i.editable || d.value && d.value !== gn) return;
|
|
2758
|
+
let { x: t, y: n } = e.point, r = [[t - _n, n - _n], [t + _n, n + _n]], a = j.queryRenderedFeatures(r, { layers: g.filter((e) => j.getLayer(e)) })[0]?.properties?.__draw_id;
|
|
2759
|
+
if (a === void 0) return oe(null);
|
|
2331
2760
|
let o = y.find((e) => String(e.id) === a);
|
|
2332
|
-
|
|
2761
|
+
oe(o ? o.id : null);
|
|
2333
2762
|
}
|
|
2334
|
-
function
|
|
2335
|
-
|
|
2336
|
-
d.value ===
|
|
2763
|
+
function de() {
|
|
2764
|
+
M.value || !i.editable || d.value || (d.value = gn, setTimeout(() => {
|
|
2765
|
+
d.value === gn && !M.value && !T && (d.value = null);
|
|
2337
2766
|
}, 0));
|
|
2338
2767
|
}
|
|
2339
|
-
let
|
|
2340
|
-
|
|
2341
|
-
},
|
|
2342
|
-
|
|
2768
|
+
let fe = () => {
|
|
2769
|
+
j && !M.value && !T && i.editable && (j.getCanvas().style.cursor = "pointer");
|
|
2770
|
+
}, me = () => {
|
|
2771
|
+
j && !M.value && !T && (j.getCanvas().style.cursor = "");
|
|
2343
2772
|
};
|
|
2344
|
-
function
|
|
2345
|
-
if (
|
|
2346
|
-
if (
|
|
2773
|
+
function he(e) {
|
|
2774
|
+
if (M.value && j) {
|
|
2775
|
+
if (M.value === "point") Se({
|
|
2347
2776
|
type: "Point",
|
|
2348
|
-
coordinates:
|
|
2777
|
+
coordinates: le(e)
|
|
2349
2778
|
}), $();
|
|
2350
2779
|
else {
|
|
2351
|
-
if (
|
|
2352
|
-
let t =
|
|
2780
|
+
if (M.value === "polygon" && S.length >= 3) {
|
|
2781
|
+
let t = j.project(S[0]);
|
|
2353
2782
|
if (Math.hypot(t.x - e.point.x, t.y - e.point.y) < 20) return $();
|
|
2354
2783
|
}
|
|
2355
|
-
|
|
2784
|
+
S.push(le(e)), W();
|
|
2356
2785
|
}
|
|
2357
2786
|
}
|
|
2358
2787
|
}
|
|
2359
|
-
function
|
|
2360
|
-
|
|
2788
|
+
function _e(e) {
|
|
2789
|
+
w = le(e), K();
|
|
2361
2790
|
}
|
|
2362
|
-
function
|
|
2363
|
-
if (e.preventDefault(), !
|
|
2364
|
-
let t =
|
|
2365
|
-
Math.hypot(t.x - n.x, t.y - n.y) < 10 &&
|
|
2791
|
+
function ve(e) {
|
|
2792
|
+
if (e.preventDefault(), !j || S.length < 2) return;
|
|
2793
|
+
let t = j.project(S[S.length - 1]), n = j.project(S[S.length - 2]);
|
|
2794
|
+
Math.hypot(t.x - n.x, t.y - n.y) < 10 && S.pop(), $();
|
|
2366
2795
|
}
|
|
2367
|
-
function
|
|
2796
|
+
function ye() {
|
|
2368
2797
|
let e = document.activeElement;
|
|
2369
|
-
return !e || e === document.body ? !0 :
|
|
2798
|
+
return !e || e === document.body ? !0 : j?.getContainer().contains(e) ? !(e instanceof HTMLElement && (e.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName))) : !1;
|
|
2370
2799
|
}
|
|
2371
|
-
function
|
|
2372
|
-
|
|
2800
|
+
function be(e) {
|
|
2801
|
+
ye() && (M.value ? e.key === "Enter" ? (e.preventDefault(), $()) : e.key === "Backspace" && S.length && (e.preventDefault(), S.pop(), W()) : (e.key === "Delete" || e.key === "Backspace") && P.value !== null && i.editable && (e.preventDefault(), se()));
|
|
2373
2802
|
}
|
|
2374
|
-
|
|
2375
|
-
function
|
|
2376
|
-
let e = `shape-${
|
|
2377
|
-
for (; y.some((t) => t.id === e);) e = `shape-${
|
|
2803
|
+
m(() => !!M.value || P.value !== null, () => M.value ? $() : oe(null));
|
|
2804
|
+
function xe() {
|
|
2805
|
+
let e = `shape-${x++}`;
|
|
2806
|
+
for (; y.some((t) => t.id === e);) e = `shape-${x++}`;
|
|
2378
2807
|
return e;
|
|
2379
2808
|
}
|
|
2380
2809
|
function Se(e) {
|
|
2381
2810
|
let t = {
|
|
2382
2811
|
type: "Feature",
|
|
2383
|
-
id:
|
|
2812
|
+
id: xe(),
|
|
2384
2813
|
geometry: e,
|
|
2385
2814
|
properties: {}
|
|
2386
2815
|
};
|
|
2387
2816
|
y.push(t), P.value = i.editable ? t.id : null, R(), i.editable && a("select", F(t));
|
|
2388
2817
|
}
|
|
2389
2818
|
function Ce(e) {
|
|
2390
|
-
if (
|
|
2391
|
-
if (
|
|
2392
|
-
|
|
2819
|
+
if (j) {
|
|
2820
|
+
if (M.value === e) return $();
|
|
2821
|
+
M.value && $(), P.value !== null && oe(null), M.value = e, d.value = gn, S = [], w = null, j.getCanvas().style.cursor = "crosshair", j.doubleClickZoom.disable(), j.on("click", he), j.on("mousemove", _e), j.on("dblclick", ve), W(), i.mode !== e && a("update:mode", e);
|
|
2393
2822
|
}
|
|
2394
2823
|
}
|
|
2395
2824
|
function $() {
|
|
2396
|
-
if (!
|
|
2397
|
-
cancelAnimationFrame(
|
|
2398
|
-
let e =
|
|
2399
|
-
|
|
2825
|
+
if (!j || !M.value) return;
|
|
2826
|
+
cancelAnimationFrame(A), A = 0;
|
|
2827
|
+
let e = M.value, t = S;
|
|
2828
|
+
S = [], w = null, M.value = null, d.value === gn && (d.value = null), j.getCanvas().style.cursor = "", j.doubleClickZoom.enable(), j.off("click", he), j.off("mousemove", _e), j.off("dblclick", ve), e === "line" && t.length >= 2 ? Se({
|
|
2400
2829
|
type: "LineString",
|
|
2401
2830
|
coordinates: t
|
|
2402
2831
|
}) : e === "polygon" && t.length >= 3 && Se({
|
|
2403
2832
|
type: "Polygon",
|
|
2404
2833
|
coordinates: [[...t, [...t[0]]]]
|
|
2405
|
-
}),
|
|
2834
|
+
}), W(), i.mode !== null && a("update:mode", null);
|
|
2406
2835
|
}
|
|
2407
2836
|
function we(e) {
|
|
2408
2837
|
let t = e.features?.[0], n = I(P.value);
|
|
2409
|
-
if (!t || !n ||
|
|
2410
|
-
let r =
|
|
2838
|
+
if (!t || !n || M.value || !j || !i.editable) return;
|
|
2839
|
+
let r = ee(n);
|
|
2411
2840
|
if (!r) return;
|
|
2412
2841
|
e.preventDefault();
|
|
2413
2842
|
let a = t.properties.v;
|
|
2414
|
-
t.properties.handle === "midpoint" && (a = t.properties.after + 1, r.splice(a, 0,
|
|
2843
|
+
t.properties.handle === "midpoint" && (a = t.properties.after + 1, r.splice(a, 0, le(e)), z(n, r)), T = {
|
|
2415
2844
|
id: n.id,
|
|
2416
2845
|
v: a,
|
|
2417
2846
|
moved: t.properties.handle === "midpoint"
|
|
2418
|
-
}, d.value =
|
|
2847
|
+
}, d.value = gn, j.getCanvas().style.cursor = "grabbing";
|
|
2419
2848
|
let o = e.type === "touchstart";
|
|
2420
|
-
o &&
|
|
2849
|
+
o && j.dragPan.disable(), j.on(o ? "touchmove" : "mousemove", Te), j.once(o ? "touchend" : "mouseup", Ee), W();
|
|
2421
2850
|
}
|
|
2422
2851
|
function Te(e) {
|
|
2423
|
-
let t =
|
|
2424
|
-
|
|
2852
|
+
let t = T && I(T.id), n = t && ee(t);
|
|
2853
|
+
T && t && n && (n[T.v] = le(e), z(t, n), T.moved = !0, K());
|
|
2425
2854
|
}
|
|
2426
2855
|
function Ee() {
|
|
2427
|
-
if (!
|
|
2428
|
-
let e =
|
|
2429
|
-
|
|
2430
|
-
d.value ===
|
|
2856
|
+
if (!j) return;
|
|
2857
|
+
let e = T?.moved;
|
|
2858
|
+
T = null, j.off("mousemove", Te), j.off("touchmove", Te), j.dragPan.enable(), j.getCanvas().style.cursor = "", W(), e && R(), setTimeout(() => {
|
|
2859
|
+
d.value === gn && !M.value && (d.value = null);
|
|
2431
2860
|
});
|
|
2432
2861
|
}
|
|
2433
2862
|
function De(e) {
|
|
2434
2863
|
let t = e.features?.[0], n = I(P.value);
|
|
2435
|
-
if (!t || !n ||
|
|
2864
|
+
if (!t || !n || M.value || !i.editable) return;
|
|
2436
2865
|
e.preventDefault();
|
|
2437
|
-
let r =
|
|
2438
|
-
!r || r.length <= te(n) || (r.splice(t.properties.v, 1),
|
|
2866
|
+
let r = ee(n);
|
|
2867
|
+
!r || r.length <= te(n) || (r.splice(t.properties.v, 1), z(n, r), W(), R());
|
|
2439
2868
|
}
|
|
2440
2869
|
let Oe = () => {
|
|
2441
|
-
|
|
2870
|
+
j && !T && !M.value && (j.getCanvas().style.cursor = "grab");
|
|
2442
2871
|
}, ke = () => {
|
|
2443
|
-
|
|
2872
|
+
j && !T && !M.value && (j.getCanvas().style.cursor = "");
|
|
2444
2873
|
};
|
|
2445
|
-
L(i.modelValue),
|
|
2446
|
-
|
|
2447
|
-
for (let t of g) e.on("mousedown", t,
|
|
2874
|
+
L(i.modelValue), b = JSON.stringify(y), c((e) => {
|
|
2875
|
+
j = e, ae(), W(), e.on("click", ue);
|
|
2876
|
+
for (let t of g) e.on("mousedown", t, de), e.on("touchstart", t, de), e.on("mouseenter", t, fe), e.on("mouseleave", t, me);
|
|
2448
2877
|
for (let t of [_, v]) e.on("mousedown", t, we), e.on("touchstart", t, we), e.on("mouseenter", t, Oe), e.on("mouseleave", t, ke);
|
|
2449
|
-
e.on("dblclick", _, De), document.addEventListener("keydown",
|
|
2450
|
-
}),
|
|
2451
|
-
|
|
2452
|
-
}),
|
|
2453
|
-
JSON.stringify(e?.features ?? []) !==
|
|
2454
|
-
}, { deep: !0 }),
|
|
2455
|
-
e && e !==
|
|
2456
|
-
}),
|
|
2457
|
-
!e && P.value !== null &&
|
|
2458
|
-
}),
|
|
2459
|
-
if (document.removeEventListener("keydown",
|
|
2460
|
-
|
|
2461
|
-
for (let e of g)
|
|
2462
|
-
for (let e of [_, v])
|
|
2463
|
-
|
|
2878
|
+
e.on("dblclick", _, De), document.addEventListener("keydown", be), i.mode && Ce(i.mode);
|
|
2879
|
+
}), Z(u, () => {
|
|
2880
|
+
ae(), W();
|
|
2881
|
+
}), Z(() => i.modelValue, (e) => {
|
|
2882
|
+
JSON.stringify(e?.features ?? []) !== b && (L(e), b = JSON.stringify(y), W());
|
|
2883
|
+
}, { deep: !0 }), Z(() => i.mode, (e) => {
|
|
2884
|
+
e && e !== M.value ? Ce(e) : !e && M.value && $();
|
|
2885
|
+
}), Z(() => i.editable, (e) => {
|
|
2886
|
+
!e && P.value !== null && oe(null);
|
|
2887
|
+
}), ne(() => {
|
|
2888
|
+
if (document.removeEventListener("keydown", be), !j) return;
|
|
2889
|
+
M.value && $(), cancelAnimationFrame(A), j.off("click", ue);
|
|
2890
|
+
for (let e of g) j.off("mousedown", e, de), j.off("touchstart", e, de), j.off("mouseenter", e, fe), j.off("mouseleave", e, me);
|
|
2891
|
+
for (let e of [_, v]) j.off("mousedown", e, we), j.off("touchstart", e, we), j.off("mouseenter", e, Oe), j.off("mouseleave", e, ke);
|
|
2892
|
+
j.off("dblclick", _, De);
|
|
2464
2893
|
let e = [
|
|
2465
2894
|
_,
|
|
2466
2895
|
v,
|
|
@@ -2469,15 +2898,15 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2469
2898
|
`${h.draft}-fill`,
|
|
2470
2899
|
...[...g].reverse()
|
|
2471
2900
|
];
|
|
2472
|
-
for (let t of e)
|
|
2473
|
-
for (let e of Object.values(h))
|
|
2474
|
-
|
|
2901
|
+
for (let t of e) j.getLayer(t) && j.removeLayer(t);
|
|
2902
|
+
for (let e of Object.values(h)) j.getSource(e) && j.removeSource(e);
|
|
2903
|
+
j = void 0;
|
|
2475
2904
|
});
|
|
2476
|
-
let Ae =
|
|
2905
|
+
let Ae = E(() => i.control === !0 ? "top-right" : i.control || "top-right"), je = {
|
|
2477
2906
|
point: "location_on",
|
|
2478
2907
|
line: "polyline",
|
|
2479
2908
|
polygon: "pentagon"
|
|
2480
|
-
}, Me =
|
|
2909
|
+
}, Me = E(() => ({
|
|
2481
2910
|
point: o.mapDrawPoint,
|
|
2482
2911
|
line: o.mapDrawLine,
|
|
2483
2912
|
polygon: o.mapDrawPolygon
|
|
@@ -2485,48 +2914,48 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2485
2914
|
return n({
|
|
2486
2915
|
start: Ce,
|
|
2487
2916
|
finish: $,
|
|
2488
|
-
select:
|
|
2489
|
-
remove:
|
|
2490
|
-
clear:
|
|
2491
|
-
}), (n, r) => (
|
|
2917
|
+
select: oe,
|
|
2918
|
+
remove: se,
|
|
2919
|
+
clear: ce
|
|
2920
|
+
}), (n, r) => (H(), k("div", pn, [t.control ? (H(), D(ge, {
|
|
2492
2921
|
key: 0,
|
|
2493
2922
|
position: Ae.value
|
|
2494
2923
|
}, {
|
|
2495
|
-
default:
|
|
2924
|
+
default: Q(() => [(H(!0), k(C, null, re(t.modes, (t) => (H(), k("button", {
|
|
2496
2925
|
key: t,
|
|
2497
2926
|
type: "button",
|
|
2498
2927
|
class: "grid place-items-center",
|
|
2499
2928
|
title: Me.value[t],
|
|
2500
2929
|
"aria-label": Me.value[t],
|
|
2501
|
-
"aria-pressed":
|
|
2930
|
+
"aria-pressed": M.value === t,
|
|
2502
2931
|
onClick: (e) => Ce(t)
|
|
2503
|
-
}, [
|
|
2932
|
+
}, [N(e, {
|
|
2504
2933
|
name: je[t],
|
|
2505
2934
|
size: 20
|
|
2506
|
-
}, null, 8, ["name"])], 8,
|
|
2935
|
+
}, null, 8, ["name"])], 8, mn))), 128)), t.editable ? (H(), k("button", {
|
|
2507
2936
|
key: 0,
|
|
2508
2937
|
type: "button",
|
|
2509
2938
|
class: "grid place-items-center",
|
|
2510
|
-
title:
|
|
2511
|
-
"aria-label":
|
|
2939
|
+
title: X(o).mapDeleteFeature,
|
|
2940
|
+
"aria-label": X(o).mapDeleteFeature,
|
|
2512
2941
|
disabled: P.value === null,
|
|
2513
|
-
onClick: r[0] ||= (e) =>
|
|
2514
|
-
}, [
|
|
2942
|
+
onClick: r[0] ||= (e) => se()
|
|
2943
|
+
}, [N(e, {
|
|
2515
2944
|
name: "delete",
|
|
2516
2945
|
size: 20
|
|
2517
|
-
})], 8,
|
|
2946
|
+
})], 8, hn)) : O("", !0)]),
|
|
2518
2947
|
_: 1
|
|
2519
|
-
}, 8, ["position"])) :
|
|
2948
|
+
}, 8, ["position"])) : O("", !0)]));
|
|
2520
2949
|
}
|
|
2521
|
-
}),
|
|
2522
|
-
function
|
|
2523
|
-
let t =
|
|
2950
|
+
}), yn = /* @__PURE__ */ new WeakMap();
|
|
2951
|
+
function bn(e) {
|
|
2952
|
+
let t = fe(e);
|
|
2524
2953
|
if (!t) throw Error("useMapFilter() must be called in a component inside <MMap>, or be given one");
|
|
2525
2954
|
function n(e, n) {
|
|
2526
2955
|
let r = t.map.value;
|
|
2527
2956
|
if (!r?.getLayer(e)) return;
|
|
2528
|
-
let i =
|
|
2529
|
-
i ||
|
|
2957
|
+
let i = yn.get(r);
|
|
2958
|
+
i || yn.set(r, i = /* @__PURE__ */ new Map()), i.has(e) || i.set(e, r.getFilter(e) ?? void 0);
|
|
2530
2959
|
let a = i.get(e);
|
|
2531
2960
|
r.setFilter(e, n ? a ? [
|
|
2532
2961
|
"all",
|
|
@@ -2550,7 +2979,7 @@ function tn(e) {
|
|
|
2550
2979
|
};
|
|
2551
2980
|
}
|
|
2552
2981
|
// src/components/MMapFilter.vue?vue&type=script&setup=true&lang.ts
|
|
2553
|
-
var
|
|
2982
|
+
var xn = { class: "flex flex-wrap gap-2" }, Sn = /* @__PURE__ */ P({
|
|
2554
2983
|
__name: "MMapFilter",
|
|
2555
2984
|
props: {
|
|
2556
2985
|
layer: {},
|
|
@@ -2562,7 +2991,7 @@ var nn = { class: "flex flex-wrap gap-2" }, rn = /* @__PURE__ */ j({
|
|
|
2562
2991
|
},
|
|
2563
2992
|
emits: ["update:modelValue"],
|
|
2564
2993
|
setup(e, { emit: t }) {
|
|
2565
|
-
let n = e, r = t, { onReady: i, styleVersion: a } =
|
|
2994
|
+
let n = e, r = t, { onReady: i, styleVersion: a } = pe(() => n.map), { setFilter: o, valuesOf: s } = bn(() => n.map), c = G([]), l = E(() => n.values ?? c.value), u = G([]), d = E(() => n.modelValue ?? u.value);
|
|
2566
2995
|
function f() {
|
|
2567
2996
|
let e = d.value;
|
|
2568
2997
|
o(n.layer, e.length ? [
|
|
@@ -2575,30 +3004,30 @@ var nn = { class: "flex flex-wrap gap-2" }, rn = /* @__PURE__ */ j({
|
|
|
2575
3004
|
let t = d.value.includes(e) ? d.value.filter((t) => t !== e) : [...d.value, e];
|
|
2576
3005
|
u.value = t, r("update:modelValue", t);
|
|
2577
3006
|
}
|
|
2578
|
-
function
|
|
3007
|
+
function m(e) {
|
|
2579
3008
|
let t = () => {
|
|
2580
3009
|
n.values || (c.value = s(n.layer, n.property));
|
|
2581
3010
|
};
|
|
2582
3011
|
t(), e.once("idle", t);
|
|
2583
3012
|
}
|
|
2584
3013
|
return i((e) => {
|
|
2585
|
-
|
|
2586
|
-
}),
|
|
3014
|
+
m(e), f();
|
|
3015
|
+
}), Z(d, f, { deep: !0 }), Z(a, () => f()), Z(() => [n.layer, n.property], ([e], [t]) => {
|
|
2587
3016
|
e !== t && o(t, null), f();
|
|
2588
|
-
}),
|
|
3017
|
+
}), ne(() => o(n.layer, null)), (t, n) => (H(), k("div", xn, [(H(!0), k(C, null, re(l.value, (t) => (H(), D(h, {
|
|
2589
3018
|
key: t,
|
|
2590
3019
|
type: "filter",
|
|
2591
3020
|
clickable: "",
|
|
2592
3021
|
selected: d.value.includes(t),
|
|
2593
3022
|
onClick: (e) => p(t)
|
|
2594
3023
|
}, {
|
|
2595
|
-
default:
|
|
3024
|
+
default: Q(() => [M(J(e.labels?.[String(t)] ?? t), 1)]),
|
|
2596
3025
|
_: 2
|
|
2597
3026
|
}, 1032, ["selected", "onClick"]))), 128))]));
|
|
2598
3027
|
}
|
|
2599
3028
|
});
|
|
2600
3029
|
// src/composables/mapSearch.ts
|
|
2601
|
-
function
|
|
3030
|
+
function Cn(e = {}) {
|
|
2602
3031
|
return async (t, n) => {
|
|
2603
3032
|
let r = new URLSearchParams({
|
|
2604
3033
|
format: "jsonv2",
|
|
@@ -2624,7 +3053,7 @@ function an(e = {}) {
|
|
|
2624
3053
|
});
|
|
2625
3054
|
};
|
|
2626
3055
|
}
|
|
2627
|
-
var
|
|
3056
|
+
var wn = {
|
|
2628
3057
|
city: "location_city",
|
|
2629
3058
|
town: "location_city",
|
|
2630
3059
|
village: "holiday_village",
|
|
@@ -2651,17 +3080,17 @@ var on = {
|
|
|
2651
3080
|
administrative: "map",
|
|
2652
3081
|
country: "public",
|
|
2653
3082
|
state: "map"
|
|
2654
|
-
},
|
|
3083
|
+
}, Tn = (e) => e && wn[e] || "location_on", En = { class: "hidden" }, Dn = [
|
|
2655
3084
|
"value",
|
|
2656
3085
|
"placeholder",
|
|
2657
3086
|
"aria-label"
|
|
2658
|
-
],
|
|
3087
|
+
], On = {
|
|
2659
3088
|
key: 0,
|
|
2660
3089
|
class: "border-t border-outline-variant"
|
|
2661
|
-
},
|
|
3090
|
+
}, kn = {
|
|
2662
3091
|
key: 1,
|
|
2663
3092
|
class: "flex flex-col items-center gap-2 py-6"
|
|
2664
|
-
},
|
|
3093
|
+
}, An = { class: "text-body-small text-on-surface-variant" }, jn = /* @__PURE__ */ P({
|
|
2665
3094
|
__name: "MMapSearch",
|
|
2666
3095
|
props: {
|
|
2667
3096
|
provider: {},
|
|
@@ -2679,12 +3108,12 @@ var on = {
|
|
|
2679
3108
|
},
|
|
2680
3109
|
emits: ["select"],
|
|
2681
3110
|
setup(t, { emit: n }) {
|
|
2682
|
-
let r = t, i = n, o = s(), { map: c } =
|
|
2683
|
-
async function
|
|
3111
|
+
let r = t, i = n, o = s(), { map: c } = pe(), l = E(() => r.provider ?? Cn()), u = G(""), d = q([]), f = G(!1), p = G(!1), m = G(!1), h = q(null), g, x;
|
|
3112
|
+
async function S() {
|
|
2684
3113
|
let e = u.value.trim();
|
|
2685
3114
|
if (!e) return;
|
|
2686
|
-
|
|
2687
|
-
let t =
|
|
3115
|
+
g?.abort(), g = new AbortController();
|
|
3116
|
+
let t = g;
|
|
2688
3117
|
f.value = !0, m.value = !0;
|
|
2689
3118
|
try {
|
|
2690
3119
|
d.value = await l.value(e, t.signal);
|
|
@@ -2692,14 +3121,14 @@ var on = {
|
|
|
2692
3121
|
if (t.signal.aborted) return;
|
|
2693
3122
|
d.value = [];
|
|
2694
3123
|
} finally {
|
|
2695
|
-
|
|
3124
|
+
g === t && (f.value = !1, p.value = !0);
|
|
2696
3125
|
}
|
|
2697
3126
|
}
|
|
2698
|
-
function
|
|
2699
|
-
if (u.value = e, !e) return
|
|
2700
|
-
r.instant && (clearTimeout(
|
|
3127
|
+
function w(e) {
|
|
3128
|
+
if (u.value = e, !e) return j();
|
|
3129
|
+
r.instant && (clearTimeout(x), x = setTimeout(S, 350));
|
|
2701
3130
|
}
|
|
2702
|
-
function
|
|
3131
|
+
function T(e) {
|
|
2703
3132
|
h.value = e, m.value = !1;
|
|
2704
3133
|
let t = c.value;
|
|
2705
3134
|
e.bbox && e.bbox[0] !== e.bbox[2] ? t?.fitBounds([[e.bbox[0], e.bbox[1]], [e.bbox[2], e.bbox[3]]], {
|
|
@@ -2710,100 +3139,100 @@ var on = {
|
|
|
2710
3139
|
zoom: r.zoom
|
|
2711
3140
|
}), i("select", e);
|
|
2712
3141
|
}
|
|
2713
|
-
function
|
|
2714
|
-
|
|
3142
|
+
function j() {
|
|
3143
|
+
g?.abort(), clearTimeout(x), u.value = "", d.value = [], p.value = !1, f.value = !1, m.value = !1, h.value = null;
|
|
2715
3144
|
}
|
|
2716
|
-
return
|
|
2717
|
-
|
|
2718
|
-
}), (n, r) => (
|
|
3145
|
+
return ne(() => {
|
|
3146
|
+
g?.abort(), clearTimeout(x);
|
|
3147
|
+
}), (n, r) => (H(), k("div", En, [N(ge, {
|
|
2719
3148
|
position: t.position,
|
|
2720
3149
|
group: !1
|
|
2721
3150
|
}, {
|
|
2722
|
-
default:
|
|
3151
|
+
default: Q(() => [N(v, {
|
|
2723
3152
|
variant: "elevated",
|
|
2724
3153
|
class: "w-80 max-w-[calc(100vw-5rem)] overflow-hidden"
|
|
2725
3154
|
}, {
|
|
2726
|
-
default:
|
|
3155
|
+
default: Q(() => [A("form", {
|
|
2727
3156
|
class: "flex items-center gap-2 py-1 pr-1 pl-3",
|
|
2728
3157
|
role: "search",
|
|
2729
|
-
onSubmit:
|
|
3158
|
+
onSubmit: se(S, ["prevent"])
|
|
2730
3159
|
}, [
|
|
2731
|
-
|
|
3160
|
+
N(e, {
|
|
2732
3161
|
name: "search",
|
|
2733
3162
|
size: 20,
|
|
2734
3163
|
class: "shrink-0 text-on-surface-variant"
|
|
2735
3164
|
}),
|
|
2736
|
-
|
|
3165
|
+
A("input", {
|
|
2737
3166
|
value: u.value,
|
|
2738
3167
|
type: "search",
|
|
2739
3168
|
enterkeyhint: "search",
|
|
2740
|
-
placeholder: t.placeholder ??
|
|
2741
|
-
"aria-label": t.placeholder ??
|
|
3169
|
+
placeholder: t.placeholder ?? X(o).mapSearchPlaces,
|
|
3170
|
+
"aria-label": t.placeholder ?? X(o).mapSearchPlaces,
|
|
2742
3171
|
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",
|
|
2743
|
-
onInput: r[0] ||= (e) =>
|
|
3172
|
+
onInput: r[0] ||= (e) => w(e.target.value),
|
|
2744
3173
|
onFocus: r[1] ||= (e) => m.value = p.value && !h.value
|
|
2745
|
-
}, null, 40,
|
|
2746
|
-
f.value ? (
|
|
3174
|
+
}, null, 40, Dn),
|
|
3175
|
+
f.value ? (H(), D(b, {
|
|
2747
3176
|
key: 0,
|
|
2748
3177
|
size: 20,
|
|
2749
3178
|
class: "mr-2 shrink-0"
|
|
2750
|
-
})) : u.value ? (
|
|
3179
|
+
})) : u.value ? (H(), D(a, {
|
|
2751
3180
|
key: 1,
|
|
2752
3181
|
icon: "close",
|
|
2753
|
-
label:
|
|
3182
|
+
label: X(o).clearSearch,
|
|
2754
3183
|
size: "sm",
|
|
2755
|
-
onClick:
|
|
2756
|
-
}, null, 8, ["label"])) :
|
|
2757
|
-
], 32), m.value && p.value && !f.value ? (
|
|
3184
|
+
onClick: j
|
|
3185
|
+
}, null, 8, ["label"])) : O("", !0)
|
|
3186
|
+
], 32), m.value && p.value && !f.value ? (H(), k("div", On, [d.value.length ? (H(), D(_, {
|
|
2758
3187
|
key: 0,
|
|
2759
3188
|
class: "max-h-72 overflow-y-auto"
|
|
2760
3189
|
}, {
|
|
2761
|
-
default:
|
|
3190
|
+
default: Q(() => [(H(!0), k(C, null, re(d.value, (e, t) => (H(), D(y, {
|
|
2762
3191
|
key: t,
|
|
2763
3192
|
title: e.label,
|
|
2764
|
-
icon:
|
|
3193
|
+
icon: X(Tn)(e.type),
|
|
2765
3194
|
leading: "icon",
|
|
2766
3195
|
clickable: "",
|
|
2767
|
-
onClick: (t) =>
|
|
3196
|
+
onClick: (t) => T(e)
|
|
2768
3197
|
}, null, 8, [
|
|
2769
3198
|
"title",
|
|
2770
3199
|
"icon",
|
|
2771
3200
|
"onClick"
|
|
2772
3201
|
]))), 128))]),
|
|
2773
3202
|
_: 1
|
|
2774
|
-
})) : (
|
|
3203
|
+
})) : (H(), k("div", kn, [N(e, {
|
|
2775
3204
|
name: "search_off",
|
|
2776
3205
|
size: 28,
|
|
2777
3206
|
class: "text-on-surface-variant"
|
|
2778
|
-
}),
|
|
3207
|
+
}), A("span", An, J(X(o).noResults), 1)]))])) : O("", !0)]),
|
|
2779
3208
|
_: 1
|
|
2780
3209
|
})]),
|
|
2781
3210
|
_: 1
|
|
2782
|
-
}, 8, ["position"]), t.marker && h.value ? (
|
|
3211
|
+
}, 8, ["position"]), t.marker && h.value ? (H(), D(Me, {
|
|
2783
3212
|
key: 0,
|
|
2784
3213
|
"lng-lat": h.value.lngLat
|
|
2785
|
-
}, null, 8, ["lng-lat"])) :
|
|
3214
|
+
}, null, 8, ["lng-lat"])) : O("", !0)]));
|
|
2786
3215
|
}
|
|
2787
|
-
}),
|
|
3216
|
+
}), Mn = ["aria-label"], Nn = {
|
|
2788
3217
|
key: 0,
|
|
2789
3218
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant",
|
|
2790
3219
|
role: "status"
|
|
2791
|
-
},
|
|
3220
|
+
}, Pn = {
|
|
2792
3221
|
key: 1,
|
|
2793
3222
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant"
|
|
2794
|
-
},
|
|
3223
|
+
}, Fn = {
|
|
2795
3224
|
key: 2,
|
|
2796
3225
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant",
|
|
2797
3226
|
role: "status"
|
|
2798
|
-
},
|
|
3227
|
+
}, In = [
|
|
2799
3228
|
"id",
|
|
2800
3229
|
"aria-selected",
|
|
2801
3230
|
"onMousedown",
|
|
2802
3231
|
"onMousemove"
|
|
2803
|
-
],
|
|
3232
|
+
], Ln = { class: "flex min-w-0 flex-col" }, Rn = { class: "truncate text-body-large" }, zn = {
|
|
2804
3233
|
key: 0,
|
|
2805
3234
|
class: "truncate text-body-small text-on-surface-variant"
|
|
2806
|
-
},
|
|
3235
|
+
}, Bn = /* @__PURE__ */ P({
|
|
2807
3236
|
inheritAttrs: !1,
|
|
2808
3237
|
__name: "MAddressField",
|
|
2809
3238
|
props: {
|
|
@@ -2819,130 +3248,154 @@ var on = {
|
|
|
2819
3248
|
debounce: { default: 400 },
|
|
2820
3249
|
minLength: { default: 3 },
|
|
2821
3250
|
hint: {},
|
|
2822
|
-
error: { type: Boolean },
|
|
3251
|
+
error: { type: [Boolean, String] },
|
|
2823
3252
|
errorLabel: {},
|
|
3253
|
+
rules: {},
|
|
3254
|
+
validateOn: {},
|
|
3255
|
+
validateDebounce: {},
|
|
3256
|
+
name: {},
|
|
2824
3257
|
required: { type: Boolean },
|
|
2825
3258
|
disabled: { type: Boolean }
|
|
2826
3259
|
},
|
|
2827
|
-
emits: [
|
|
3260
|
+
emits: [
|
|
3261
|
+
"update:modelValue",
|
|
3262
|
+
"select",
|
|
3263
|
+
"blur"
|
|
3264
|
+
],
|
|
2828
3265
|
setup(t, { expose: n, emit: r }) {
|
|
2829
|
-
let i = t, o = r, c = s(), l = ie(), d = `${l}-list`,
|
|
2830
|
-
|
|
3266
|
+
let i = t, o = r, c = s(), l = ie(), d = `${l}-list`, f = (e) => `${l}-opt-${e}`, h = E(() => i.provider ?? Cn()), _ = G(i.modelValue?.label ?? ""), v = q([]), y = G(!1), T = G(!1), j = G(!1), P = G(!1), F = G(-1), I, L, B = G(), V = x({
|
|
3267
|
+
value: () => i.modelValue,
|
|
3268
|
+
rules: () => i.rules,
|
|
3269
|
+
required: () => i.required,
|
|
3270
|
+
error: () => i.error,
|
|
3271
|
+
errorLabel: () => i.errorLabel,
|
|
3272
|
+
name: () => i.name,
|
|
3273
|
+
validateOn: () => i.validateOn,
|
|
3274
|
+
validateDebounce: () => i.validateDebounce,
|
|
3275
|
+
disabled: () => i.disabled,
|
|
3276
|
+
focus: () => B.value?.focus(),
|
|
3277
|
+
el: () => Y.value,
|
|
3278
|
+
setValue: (e) => o("update:modelValue", e ?? null)
|
|
3279
|
+
}), W = V.disabled, K = E(() => V.message.value || V.hasError.value);
|
|
3280
|
+
U(S, null);
|
|
3281
|
+
let Y = G(), ae = G(), ce = E(() => Y.value?.firstElementChild?.firstElementChild ?? null), le = G({}), ue = E(() => _.value.trim().length >= i.minLength), de = E(() => !i.instant && j.value && ue.value && !T.value && !y.value && !i.modelValue);
|
|
3282
|
+
Z(() => i.modelValue, (e) => {
|
|
2831
3283
|
e && e.label !== _.value ? _.value = e.label : !e && !j.value && (_.value = "");
|
|
2832
3284
|
});
|
|
2833
|
-
async function
|
|
3285
|
+
async function fe() {
|
|
2834
3286
|
let e = _.value.trim();
|
|
2835
3287
|
if (e.length < i.minLength) return;
|
|
2836
|
-
|
|
2837
|
-
let t =
|
|
2838
|
-
|
|
3288
|
+
I?.abort(), clearTimeout(L), I = new AbortController();
|
|
3289
|
+
let t = I;
|
|
3290
|
+
y.value = !0, P.value = !0;
|
|
2839
3291
|
try {
|
|
2840
|
-
v.value = await
|
|
3292
|
+
v.value = await h.value(e, t.signal), F.value = v.value.length ? 0 : -1;
|
|
2841
3293
|
} catch {
|
|
2842
3294
|
if (t.signal.aborted) return;
|
|
2843
3295
|
v.value = [];
|
|
2844
3296
|
} finally {
|
|
2845
|
-
|
|
3297
|
+
I === t && (y.value = !1, T.value = !0);
|
|
2846
3298
|
}
|
|
2847
3299
|
}
|
|
2848
|
-
function
|
|
2849
|
-
_.value = String(e),
|
|
3300
|
+
function pe(e) {
|
|
3301
|
+
_.value = String(e), T.value = !1, v.value = [], F.value = -1, i.modelValue && o("update:modelValue", null), I?.abort(), y.value = !1, clearTimeout(L), ue.value ? (P.value = !i.instant, i.instant && (L = setTimeout(fe, i.debounce))) : P.value = !1;
|
|
2850
3302
|
}
|
|
2851
|
-
function
|
|
2852
|
-
_.value = e.label,
|
|
3303
|
+
function me(e) {
|
|
3304
|
+
_.value = e.label, P.value = !1, v.value = [], T.value = !1, o("update:modelValue", e), o("select", e);
|
|
2853
3305
|
}
|
|
2854
|
-
function
|
|
2855
|
-
|
|
3306
|
+
function he() {
|
|
3307
|
+
I?.abort(), clearTimeout(L), _.value = "", v.value = [], T.value = !1, y.value = !1, P.value = !1, i.modelValue && o("update:modelValue", null), B.value?.focus();
|
|
2856
3308
|
}
|
|
2857
|
-
function
|
|
3309
|
+
function ge(e) {
|
|
2858
3310
|
if (e.key === "Enter") {
|
|
2859
3311
|
e.preventDefault();
|
|
2860
|
-
let t = v.value[
|
|
2861
|
-
|
|
3312
|
+
let t = v.value[F.value];
|
|
3313
|
+
P.value && t && T.value ? me(t) : fe();
|
|
2862
3314
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
2863
|
-
if (!
|
|
3315
|
+
if (!P.value || !v.value.length) return;
|
|
2864
3316
|
e.preventDefault();
|
|
2865
3317
|
let t = v.value.length;
|
|
2866
|
-
|
|
3318
|
+
F.value = (F.value + (e.key === "ArrowDown" ? 1 : -1) + t) % t, ee(() => ae.value?.querySelector(`#${CSS.escape(f(F.value))}`)?.scrollIntoView({ block: "nearest" }));
|
|
2867
3319
|
}
|
|
2868
3320
|
}
|
|
2869
|
-
function
|
|
2870
|
-
j.value = !0, (
|
|
3321
|
+
function _e() {
|
|
3322
|
+
j.value = !0, (T.value && v.value.length && !i.modelValue || de.value) && (P.value = !0);
|
|
2871
3323
|
}
|
|
2872
|
-
function
|
|
3324
|
+
function ve(e) {
|
|
2873
3325
|
let t = e.relatedTarget;
|
|
2874
|
-
t && (
|
|
3326
|
+
t && (Y.value?.contains(t) || ae.value?.contains(t)) || (j.value = !1, P.value = !1, V.onBlur(), o("blur"));
|
|
2875
3327
|
}
|
|
2876
|
-
|
|
2877
|
-
let
|
|
2878
|
-
function
|
|
2879
|
-
let e =
|
|
3328
|
+
m(() => P.value, () => P.value = !1);
|
|
3329
|
+
let ye = E(() => P.value && (y.value || T.value || de.value));
|
|
3330
|
+
function be() {
|
|
3331
|
+
let e = ce.value?.getBoundingClientRect(), t = ae.value;
|
|
2880
3332
|
if (!e || !t) return;
|
|
2881
|
-
let n = t.offsetHeight, r =
|
|
2882
|
-
|
|
3333
|
+
let n = t.offsetHeight, r = p([e.bottom + 4, e.top - 4 - n], n, window.innerHeight, 8);
|
|
3334
|
+
le.value = {
|
|
2883
3335
|
top: `${r}px`,
|
|
2884
3336
|
left: `${e.left}px`,
|
|
2885
3337
|
width: `${e.width}px`
|
|
2886
3338
|
};
|
|
2887
3339
|
}
|
|
2888
|
-
|
|
2889
|
-
|
|
3340
|
+
Z([
|
|
3341
|
+
ye,
|
|
2890
3342
|
v,
|
|
2891
|
-
|
|
2892
|
-
], () =>
|
|
2893
|
-
open: () =>
|
|
2894
|
-
anchor:
|
|
2895
|
-
popup:
|
|
2896
|
-
place:
|
|
2897
|
-
close: () =>
|
|
2898
|
-
}),
|
|
2899
|
-
let e =
|
|
2900
|
-
e && (e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-expanded", String(
|
|
2901
|
-
}),
|
|
2902
|
-
|
|
3343
|
+
y
|
|
3344
|
+
], () => ee(be)), g({
|
|
3345
|
+
open: () => ye.value,
|
|
3346
|
+
anchor: ce,
|
|
3347
|
+
popup: ae,
|
|
3348
|
+
place: be,
|
|
3349
|
+
close: () => P.value = !1
|
|
3350
|
+
}), oe(() => {
|
|
3351
|
+
let e = B.value?.inputEl;
|
|
3352
|
+
e && (e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-expanded", String(ye.value && v.value.length > 0)), e.setAttribute("aria-controls", d), e.setAttribute("enterkeyhint", "search"), ye.value && F.value >= 0 && v.value.length ? e.setAttribute("aria-activedescendant", f(F.value)) : e.removeAttribute("aria-activedescendant"));
|
|
3353
|
+
}), ne(() => {
|
|
3354
|
+
I?.abort(), clearTimeout(L);
|
|
2903
3355
|
});
|
|
2904
|
-
function
|
|
3356
|
+
function xe(e) {
|
|
2905
3357
|
let t = e.indexOf(", ");
|
|
2906
3358
|
return t < 0 ? [e, ""] : [e.slice(0, t), e.slice(t + 2)];
|
|
2907
3359
|
}
|
|
2908
3360
|
return n({
|
|
2909
|
-
search:
|
|
2910
|
-
clear:
|
|
2911
|
-
focus: () =>
|
|
2912
|
-
|
|
3361
|
+
search: fe,
|
|
3362
|
+
clear: he,
|
|
3363
|
+
focus: () => B.value?.focus(),
|
|
3364
|
+
validate: V.validate,
|
|
3365
|
+
resetValidation: V.resetValidation
|
|
3366
|
+
}), (n, r) => (H(), k(C, null, [A("div", R({
|
|
2913
3367
|
ref_key: "wrapEl",
|
|
2914
|
-
ref:
|
|
3368
|
+
ref: Y
|
|
2915
3369
|
}, n.$attrs, {
|
|
2916
|
-
onFocusin:
|
|
2917
|
-
onFocusout:
|
|
2918
|
-
onKeydown:
|
|
2919
|
-
}), [
|
|
3370
|
+
onFocusin: _e,
|
|
3371
|
+
onFocusout: ve,
|
|
3372
|
+
onKeydown: ge
|
|
3373
|
+
}), [N(u, {
|
|
2920
3374
|
ref_key: "field",
|
|
2921
|
-
ref:
|
|
3375
|
+
ref: B,
|
|
2922
3376
|
"model-value": _.value,
|
|
2923
|
-
label: t.label ??
|
|
3377
|
+
label: t.label ?? X(c).mapAddress,
|
|
2924
3378
|
variant: t.variant,
|
|
2925
3379
|
"leading-icon": t.leadingIcon,
|
|
2926
3380
|
hint: t.hint,
|
|
2927
|
-
error:
|
|
2928
|
-
"error-label": t.errorLabel,
|
|
3381
|
+
error: K.value,
|
|
2929
3382
|
required: t.required,
|
|
2930
|
-
disabled:
|
|
3383
|
+
disabled: X(W),
|
|
2931
3384
|
autocomplete: "street-address",
|
|
2932
|
-
"onUpdate:modelValue":
|
|
3385
|
+
"onUpdate:modelValue": pe
|
|
2933
3386
|
}, {
|
|
2934
|
-
trailing:
|
|
3387
|
+
trailing: Q(() => [y.value ? (H(), D(b, {
|
|
2935
3388
|
key: 0,
|
|
2936
3389
|
size: 20,
|
|
2937
3390
|
class: "m-2"
|
|
2938
|
-
})) : _.value ? (
|
|
3391
|
+
})) : _.value ? (H(), D(a, {
|
|
2939
3392
|
key: 1,
|
|
2940
3393
|
icon: "close",
|
|
2941
|
-
label:
|
|
3394
|
+
label: X(c).clearSearch,
|
|
2942
3395
|
size: "sm",
|
|
2943
|
-
disabled:
|
|
2944
|
-
onClick:
|
|
2945
|
-
}, null, 8, ["label", "disabled"])) :
|
|
3396
|
+
disabled: X(W),
|
|
3397
|
+
onClick: he
|
|
3398
|
+
}, null, 8, ["label", "disabled"])) : O("", !0)]),
|
|
2946
3399
|
_: 1
|
|
2947
3400
|
}, 8, [
|
|
2948
3401
|
"model-value",
|
|
@@ -2951,39 +3404,38 @@ var on = {
|
|
|
2951
3404
|
"leading-icon",
|
|
2952
3405
|
"hint",
|
|
2953
3406
|
"error",
|
|
2954
|
-
"error-label",
|
|
2955
3407
|
"required",
|
|
2956
3408
|
"disabled"
|
|
2957
|
-
])], 16), (
|
|
3409
|
+
])], 16), (H(), D(w, { to: "body" }, [ye.value ? (H(), k("div", {
|
|
2958
3410
|
key: 0,
|
|
2959
3411
|
id: d,
|
|
2960
3412
|
ref_key: "listEl",
|
|
2961
|
-
ref:
|
|
3413
|
+
ref: ae,
|
|
2962
3414
|
role: "listbox",
|
|
2963
|
-
"aria-label": t.label ??
|
|
3415
|
+
"aria-label": t.label ?? X(c).mapAddress,
|
|
2964
3416
|
class: "fixed z-500 max-h-72 overflow-auto rounded-xs bg-surface-container py-1 shadow-elevation-2",
|
|
2965
|
-
style:
|
|
2966
|
-
}, [
|
|
3417
|
+
style: te(le.value)
|
|
3418
|
+
}, [y.value ? (H(), k("div", Nn, [N(b, { size: 20 }), M(J(X(c).mapSearching), 1)])) : de.value ? (H(), k("div", Pn, [N(e, {
|
|
2967
3419
|
name: "keyboard_return",
|
|
2968
3420
|
size: 20
|
|
2969
|
-
}),
|
|
2970
|
-
id:
|
|
3421
|
+
}), M(J(X(c).mapPressEnterToSearch), 1)])) : v.value.length ? (H(!0), k(C, { key: 3 }, re(v.value, (t, n) => (H(), k("div", {
|
|
3422
|
+
id: f(n),
|
|
2971
3423
|
key: n,
|
|
2972
3424
|
role: "option",
|
|
2973
|
-
"aria-selected": n ===
|
|
2974
|
-
class:
|
|
2975
|
-
onMousedown:
|
|
2976
|
-
onMousemove: (e) =>
|
|
2977
|
-
}, [
|
|
2978
|
-
name:
|
|
3425
|
+
"aria-selected": n === F.value,
|
|
3426
|
+
class: z(["flex cursor-pointer items-center gap-3 px-4 py-2 text-on-surface hover:bg-on-surface/8", n === F.value ? "bg-on-surface/12" : ""]),
|
|
3427
|
+
onMousedown: se((e) => me(t), ["prevent"]),
|
|
3428
|
+
onMousemove: (e) => F.value = n
|
|
3429
|
+
}, [N(e, {
|
|
3430
|
+
name: X(Tn)(t.type),
|
|
2979
3431
|
size: 20,
|
|
2980
3432
|
class: "shrink-0 text-on-surface-variant"
|
|
2981
|
-
}, null, 8, ["name"]),
|
|
3433
|
+
}, null, 8, ["name"]), A("span", Ln, [A("span", Rn, J(xe(t.label)[0]), 1), xe(t.label)[1] ? (H(), k("span", zn, J(xe(t.label)[1]), 1)) : O("", !0)])], 42, In))), 128)) : (H(), k("div", Fn, [N(e, {
|
|
2982
3434
|
name: "search_off",
|
|
2983
3435
|
size: 20
|
|
2984
|
-
}),
|
|
3436
|
+
}), M(J(X(c).mapNoPlaces), 1)]))], 12, Mn)) : O("", !0)]))], 64));
|
|
2985
3437
|
}
|
|
2986
3438
|
});
|
|
2987
|
-
export {
|
|
3439
|
+
export { Bn as MAddressField, Ee as MMap, Nt as MMapBaseLayers, Le as MMapCluster, ge as MMapControl, vn as MMapDraw, Ht as MMapFeatureInfo, Sn as MMapFilter, Fe as MMapGeoJson, on as MMapHover, Qt as MMapIdentify, kt as MMapLayers, Me as MMapMarker, fn as MMapMeasure, Pe as MMapPopup, at as MMapRoute, jn as MMapSearch, qt as fieldLabel, Jt as formatFieldValue, Gt as genericAdapter, Xt as identifyFeatures, Cn as nominatimProvider, Kt as orvianAdapter, ot as osrmRouteProvider, le as setMapWorker, pe as useMap, bn as useMapFilter, Ce as useMapLayers };
|
|
2988
3440
|
|
|
2989
3441
|
//# sourceMappingURL=map.js.map
|