@m3ui-vue/m3ui-vue 1.10.2 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -4
- package/dist/API.md +195 -56
- package/dist/MButton-gWoOzFWf.js +284 -0
- package/dist/MButton-gWoOzFWf.js.map +1 -0
- package/dist/MColorPickerModal-CJYMvlgK.js +466 -0
- package/dist/MColorPickerModal-CJYMvlgK.js.map +1 -0
- package/dist/MDialog-CU8EYgCC.js +226 -0
- package/dist/MDialog-CU8EYgCC.js.map +1 -0
- package/dist/{MIcon-BSsJZhK7.js → MIcon-CkUc9kuQ.js} +10 -4
- package/dist/MIcon-CkUc9kuQ.js.map +1 -0
- package/dist/MIconButton-DTFOfsTy.js +317 -0
- package/dist/MIconButton-DTFOfsTy.js.map +1 -0
- package/dist/MListItem-Cdw2FqCT.js +1306 -0
- package/dist/MListItem-Cdw2FqCT.js.map +1 -0
- package/dist/MLoadingIndicator-BxAy2x7P.js +115 -0
- package/dist/MLoadingIndicator-BxAy2x7P.js.map +1 -0
- package/dist/{MMenuItem-US0Zbglq.js → MMenuItem-CEIKYvaX.js} +216 -214
- package/dist/MMenuItem-CEIKYvaX.js.map +1 -0
- package/dist/{MPdfViewer-DL9mRsd2.js → MPdfViewer-CEfyXGq2.js} +674 -671
- package/dist/MPdfViewer-CEfyXGq2.js.map +1 -0
- package/dist/MProgressBar-BzZMxq7M.js.map +1 -1
- package/dist/MSeekBar-B3_D-PwH.js +435 -0
- package/dist/MSeekBar-B3_D-PwH.js.map +1 -0
- package/dist/{MSegmentedButton-DMou-8sG.js → MSegmentedButton-Dg07j-4r.js} +4 -4
- package/dist/{MSegmentedButton-DMou-8sG.js.map → MSegmentedButton-Dg07j-4r.js.map} +1 -1
- package/dist/{MSignaturePad-WuvE_Cyl.js → MSignaturePad-3nddtLKI.js} +2 -2
- package/dist/{MSignaturePad-WuvE_Cyl.js.map → MSignaturePad-3nddtLKI.js.map} +1 -1
- package/dist/{MSlider-7TzhFHKS.js → MSlider-BrpLbqwt.js} +4 -4
- package/dist/{MSlider-7TzhFHKS.js.map → MSlider-BrpLbqwt.js.map} +1 -1
- package/dist/{MSpinner-CkIVBuGE.js → MSpinner-CLwzDH33.js} +2 -2
- package/dist/{MSpinner-CkIVBuGE.js.map → MSpinner-CLwzDH33.js.map} +1 -1
- package/dist/{MTextField-B6_iOczK.js → MTextField-CZRizAwA.js} +136 -134
- package/dist/MTextField-CZRizAwA.js.map +1 -0
- package/dist/{_useFieldValidation-COBJ1tWr.js → _useFieldValidation-DVcqyy9g.js} +2 -2
- package/dist/{_useFieldValidation-COBJ1tWr.js.map → _useFieldValidation-DVcqyy9g.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +3 -3
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAlert.vue.d.ts +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +3 -3
- package/dist/components/MAvatar.vue.d.ts +19 -1
- package/dist/components/MButton.vue.d.ts +2 -1
- package/dist/components/MChatBubble.vue.d.ts +2 -0
- package/dist/components/MCheckbox.vue.d.ts +2 -0
- package/dist/components/MDataTable.vue.d.ts +31 -3
- package/dist/components/MFlow.vue.d.ts +1 -1
- package/dist/components/MHotkeys.vue.d.ts +1 -0
- package/dist/components/MIcon.vue.d.ts +6 -0
- package/dist/components/MIconButton.vue.d.ts +5 -0
- package/dist/components/MKanban.vue.d.ts +1 -1
- package/dist/components/MLink.vue.d.ts +59 -0
- package/dist/components/MListItem.vue.d.ts +3 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MNotificationCenter.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +1 -1
- package/dist/components/MPagination.vue.d.ts +14 -1
- package/dist/components/MPdfSigner.vue.d.ts +2 -2
- package/dist/components/MRadio.vue.d.ts +2 -0
- package/dist/components/MRadioGroup.vue.d.ts +2 -0
- package/dist/components/MStatCard.vue.d.ts +2 -2
- package/dist/components/MSwitch.vue.d.ts +2 -0
- package/dist/components/MText.vue.d.ts +4 -2
- package/dist/components/MTextField.vue.d.ts +2 -0
- package/dist/components/_MDrawerItemList.vue.d.ts +6 -0
- package/dist/composables/_menuGroups.d.ts +10 -1
- package/dist/composables/_splitAttrs.d.ts +6 -0
- package/dist/composables/_springAnimation.d.ts +2 -2
- package/dist/composables/_useFocusTrap.d.ts +15 -0
- package/dist/composables/_usePaneResize.d.ts +1 -1
- package/dist/composables/_useSpring.d.ts +4 -4
- package/dist/composables/dynamicColor.d.ts +9 -1
- package/dist/composables/motion.d.ts +63 -0
- package/dist/composables/useConfirm.d.ts +28 -0
- package/dist/composables/useDevice.d.ts +8 -1
- package/dist/composables/useLocale.d.ts +14 -0
- package/dist/composables/useScrollReveal.d.ts +1 -1
- package/dist/composables/useTheme.d.ts +1 -0
- package/dist/composables/useToast.d.ts +7 -0
- package/dist/draw.js +556 -556
- package/dist/draw.js.map +1 -1
- package/dist/flow.js +854 -851
- package/dist/flow.js.map +1 -1
- package/dist/gantt.js +1118 -1096
- package/dist/gantt.js.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/locales/index.d.ts +1 -0
- package/dist/locales/index.js +833 -1
- package/dist/locales/index.js.map +1 -1
- package/dist/locales/pl.d.ts +2 -0
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +10327 -9796
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +860 -860
- package/dist/map.js.map +1 -1
- package/dist/{material-color-utilities-CEFytLsr.js → material-color-utilities-BZsBNIhi.js} +276 -217
- package/dist/material-color-utilities-BZsBNIhi.js.map +1 -0
- package/dist/media.js +7 -7
- package/dist/{motion-BcejVTeX.js → motion-BqYcqcim.js} +15 -5
- package/dist/motion-BqYcqcim.js.map +1 -0
- package/dist/pdf-sign.js +140 -137
- package/dist/pdf-sign.js.map +1 -1
- package/dist/pdf.js +1 -1
- package/dist/plugin.d.ts +11 -0
- package/dist/rich-text-editor.js +7 -7
- package/dist/styles/theme.css +40 -0
- package/dist/styles.css +1 -1
- package/dist/terminal.js +1 -1
- package/dist/{useLocale-YRaOT12S.js → useLocale-BjcYauXr.js} +60 -4
- package/dist/useLocale-BjcYauXr.js.map +1 -0
- package/dist/{useThemeTokens-DyAdPQB0.js → useThemeTokens-D5nr5KHf.js} +28 -27
- package/dist/useThemeTokens-D5nr5KHf.js.map +1 -0
- package/package.json +17 -2
- package/src/__tests__/MAvatarImage.test.ts +37 -0
- package/src/__tests__/MDataTableControlled.test.ts +68 -0
- package/src/__tests__/MHotkeysSequence.test.ts +53 -0
- package/src/__tests__/MIconAxes.test.ts +16 -0
- package/src/__tests__/MIconButtonWidth.test.ts +22 -0
- package/src/__tests__/MLink.test.ts +46 -0
- package/src/__tests__/MPaginationPages.test.ts +43 -0
- package/src/__tests__/MTextEmphasized.test.ts +14 -0
- package/src/__tests__/controlDescription.test.ts +34 -0
- package/src/__tests__/customColor.test.ts +27 -0
- package/src/__tests__/dynamicColor.test.ts +3 -2
- package/src/__tests__/focusTrap.test.ts +124 -0
- package/src/__tests__/formatMessage.test.ts +20 -0
- package/src/__tests__/inputAttrs.test.ts +103 -0
- package/src/__tests__/localePresets.test.ts +2 -0
- package/src/__tests__/menuGroupsRemount.test.ts +40 -0
- package/src/__tests__/menuHydration.test.ts +41 -0
- package/src/__tests__/motionPrefs.test.ts +28 -0
- package/src/__tests__/ssr.test.ts +11 -0
- package/src/__tests__/ssrToast.test.ts +20 -0
- package/src/__tests__/toastDetails.test.ts +39 -0
- package/src/__tests__/useConfirm.test.ts +47 -0
- package/src/__tests__/useTheme.test.ts +14 -0
- package/src/__tests__/warningRole.test.ts +22 -0
- package/src/components/MAlert.vue +2 -2
- package/src/components/MAnimatedNumber.vue +9 -3
- package/src/components/MAutocomplete.vue +16 -4
- package/src/components/MAvailabilityCalendar.vue +3 -3
- package/src/components/MAvatar.vue +32 -5
- package/src/components/MAvatarGroup.vue +7 -2
- package/src/components/MBottomSheet.vue +18 -2
- package/src/components/MButton.vue +18 -5
- package/src/components/MCarousel.vue +3 -3
- package/src/components/MChatBubble.vue +14 -1
- package/src/components/MCheckbox.vue +21 -4
- package/src/components/MChip.vue +4 -2
- package/src/components/MCollapse.vue +7 -1
- package/src/components/MCommandPalette.vue +6 -2
- package/src/components/MContextMenu.vue +4 -4
- package/src/components/MCreditCardInput.vue +5 -0
- package/src/components/MDashboardGrid.vue +2 -1
- package/src/components/MDataTable.vue +63 -16
- package/src/components/MDialog.vue +21 -3
- package/src/components/MDiffViewer.vue +3 -3
- package/src/components/MDrawLayers.vue +3 -3
- package/src/components/MFabMenu.vue +7 -0
- package/src/components/MFloorPlan.vue +3 -3
- package/src/components/MFloorPlanInspector.vue +3 -3
- package/src/components/MFlow.vue +9 -5
- package/src/components/MFlowControls.vue +6 -0
- package/src/components/MFormBuilder.vue +1 -1
- package/src/components/MGantt.vue +10 -10
- package/src/components/MHotkeys.vue +61 -16
- package/src/components/MIcon.vue +17 -1
- package/src/components/MIconButton.vue +29 -6
- package/src/components/MImageCropper.vue +1 -1
- package/src/components/MKanban.vue +2 -1
- package/src/components/MLightbox.vue +5 -4
- package/src/components/MLink.vue +136 -0
- package/src/components/MListDetail.vue +7 -0
- package/src/components/MListItem.vue +7 -4
- package/src/components/MLoadingIndicator.vue +2 -1
- package/src/components/MMap.vue +3 -0
- package/src/components/MMapCluster.vue +2 -2
- package/src/components/MMapControl.vue +2 -2
- package/src/components/MMapMeasure.vue +1 -1
- package/src/components/MMaskField.vue +16 -3
- package/src/components/MMenu.vue +4 -4
- package/src/components/MMenuItem.vue +2 -2
- package/src/components/MMeterGroup.vue +3 -2
- package/src/components/MMortgageCalculator.vue +3 -3
- package/src/components/MMultiAutocomplete.vue +19 -7
- package/src/components/MMultiSelect.vue +19 -7
- package/src/components/MNavigationDrawer.vue +10 -3
- package/src/components/MNavigationRail.vue +5 -1
- package/src/components/MNotificationCenter.vue +2 -1
- package/src/components/MNotificationHost.vue +3 -3
- package/src/components/MNumberField.vue +23 -6
- package/src/components/MOdontogram.vue +4 -4
- package/src/components/MOrderBook.vue +4 -0
- package/src/components/MPagination.vue +91 -12
- package/src/components/MPdfSigner.vue +3 -3
- package/src/components/MPdfViewer.vue +7 -7
- package/src/components/MPhoneInput.vue +17 -4
- package/src/components/MProductConfigurator.vue +4 -4
- package/src/components/MProgressBar.vue +5 -0
- package/src/components/MQuiz.vue +8 -5
- package/src/components/MRadio.vue +24 -5
- package/src/components/MRadioGroup.vue +3 -0
- package/src/components/MReactions.vue +2 -2
- package/src/components/MResourceTimeline.vue +3 -3
- package/src/components/MResult.vue +1 -1
- package/src/components/MScrollField.vue +1 -1
- package/src/components/MSearchField.vue +6 -5
- package/src/components/MSeatMap.vue +5 -0
- package/src/components/MSeekBar.vue +3 -2
- package/src/components/MSelect.vue +16 -4
- package/src/components/MSideSheet.vue +25 -3
- package/src/components/MSimpleCarousel.vue +2 -2
- package/src/components/MSnackbar.vue +16 -13
- package/src/components/MSparkline.vue +2 -1
- package/src/components/MSpinner.vue +8 -0
- package/src/components/MSplitter.vue +1 -1
- package/src/components/MSpotlightSearch.vue +6 -2
- package/src/components/MSpreadsheet.vue +1 -1
- package/src/components/MStatCard.vue +2 -1
- package/src/components/MSwitch.vue +21 -4
- package/src/components/MTabs.vue +2 -1
- package/src/components/MTagInput.vue +19 -6
- package/src/components/MText.vue +23 -4
- package/src/components/MTextField.vue +25 -6
- package/src/components/MTimeline.vue +5 -5
- package/src/components/MToolbar.vue +2 -2
- package/src/components/MTour.vue +3 -0
- package/src/components/MTrackingTimeline.vue +6 -0
- package/src/components/MTypewriter.vue +7 -1
- package/src/components/MWindow.vue +10 -1
- package/src/components/_MColorPanel.vue +4 -4
- package/src/components/_MComment.vue +3 -2
- package/src/components/_MFlowNodeShell.vue +1 -1
- package/src/components/_MPdfPage.vue +1 -1
- package/src/components/_MTransferPane.vue +10 -0
- package/src/composables/_effectCanvas.ts +2 -1
- package/src/composables/_menuGroups.ts +10 -1
- package/src/composables/_splitAttrs.ts +29 -0
- package/src/composables/_springAnimation.ts +3 -3
- package/src/composables/_themeTransition.ts +3 -2
- package/src/composables/_useFocusTrap.ts +142 -0
- package/src/composables/_useMenuNav.ts +3 -3
- package/src/composables/_usePaneResize.ts +2 -1
- package/src/composables/_useSheetMotion.ts +3 -4
- package/src/composables/_useSpring.ts +16 -10
- package/src/composables/cron.ts +7 -6
- package/src/composables/dynamicColor.ts +21 -2
- package/src/composables/motion.ts +27 -0
- package/src/composables/useConfirm.ts +116 -0
- package/src/composables/useDevice.ts +23 -3
- package/src/composables/useFieldBg.ts +4 -0
- package/src/composables/useLocale.ts +74 -0
- package/src/composables/useNotification.ts +3 -0
- package/src/composables/useScrollReveal.ts +3 -3
- package/src/composables/useTheme.ts +8 -2
- package/src/composables/useToast.ts +27 -4
- package/src/directives/vSparkle.ts +2 -1
- package/src/index.ts +8 -5
- package/src/locales/ar.ts +7 -0
- package/src/locales/de.ts +7 -0
- package/src/locales/es.ts +7 -0
- package/src/locales/fr.ts +7 -0
- package/src/locales/index.ts +1 -0
- package/src/locales/ja.ts +7 -0
- package/src/locales/ko.ts +7 -0
- package/src/locales/pl.ts +807 -0
- package/src/locales/pt.ts +7 -0
- package/src/locales/zh.ts +7 -0
- package/src/plugin.ts +16 -0
- package/src/styles/theme.css +40 -0
- package/dist/MButton-B9RCM06i.js +0 -171
- package/dist/MButton-B9RCM06i.js.map +0 -1
- package/dist/MColorPickerModal-ChRtcZOo.js +0 -577
- package/dist/MColorPickerModal-ChRtcZOo.js.map +0 -1
- package/dist/MDialog-dk07tify.js +0 -167
- package/dist/MDialog-dk07tify.js.map +0 -1
- package/dist/MIcon-BSsJZhK7.js.map +0 -1
- package/dist/MIconButton-CrBPZidd.js +0 -288
- package/dist/MIconButton-CrBPZidd.js.map +0 -1
- package/dist/MListItem-h9H223vx.js +0 -1239
- package/dist/MListItem-h9H223vx.js.map +0 -1
- package/dist/MLoadingIndicator-YTV1Ov5w.js +0 -114
- package/dist/MLoadingIndicator-YTV1Ov5w.js.map +0 -1
- package/dist/MMenuItem-US0Zbglq.js.map +0 -1
- package/dist/MPdfViewer-DL9mRsd2.js.map +0 -1
- package/dist/MSeekBar-JFZcoJ8y.js +0 -434
- package/dist/MSeekBar-JFZcoJ8y.js.map +0 -1
- package/dist/MTextField-B6_iOczK.js.map +0 -1
- package/dist/material-color-utilities-CEFytLsr.js.map +0 -1
- package/dist/motion-BcejVTeX.js.map +0 -1
- package/dist/useLocale-YRaOT12S.js.map +0 -1
- package/dist/useThemeTokens-DyAdPQB0.js.map +0 -1
package/dist/map.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { t as e } from "./MIcon-
|
|
1
|
+
import { t as e } from "./MIcon-CkUc9kuQ.js";
|
|
2
2
|
import { t } from "./vTooltip-xESB2YOb.js";
|
|
3
|
-
import {
|
|
4
|
-
import { d as r, f as i, l as a, t as o, u as s } from "./MIconButton-
|
|
5
|
-
import {
|
|
6
|
-
import { o as
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
9
|
-
import { t as
|
|
10
|
-
import { t as
|
|
11
|
-
import { n as
|
|
12
|
-
import { a as
|
|
13
|
-
import { t as
|
|
14
|
-
import { n as
|
|
15
|
-
import { Fragment as
|
|
3
|
+
import { t as n } from "./motion-BqYcqcim.js";
|
|
4
|
+
import { d as r, f as i, l as a, t as o, u as s } from "./MIconButton-DTFOfsTy.js";
|
|
5
|
+
import { a as c, i as l } from "./useLocale-BjcYauXr.js";
|
|
6
|
+
import { o as u } from "./_storageKeys-C4W_4xK4.js";
|
|
7
|
+
import { t as d } from "./useThemeTokens-D5nr5KHf.js";
|
|
8
|
+
import { t as f } from "./MTextField-CZRizAwA.js";
|
|
9
|
+
import { t as p } from "./MSlider-BrpLbqwt.js";
|
|
10
|
+
import { t as m } from "./MTooltip-Cn_DYm9M.js";
|
|
11
|
+
import { n as h, r as g } from "./_popupPosition-C_lxj9qU.js";
|
|
12
|
+
import { a as _, l as v, n as y, s as b, t as x } from "./MListItem-Cdw2FqCT.js";
|
|
13
|
+
import { t as S } from "./MSpinner-CLwzDH33.js";
|
|
14
|
+
import { n as C, t as w } from "./_useFieldValidation-DVcqyy9g.js";
|
|
15
|
+
import { Fragment as T, Teleport as E, Transition as D, computed as O, createBlock as k, createCommentVNode as A, createElementBlock as j, createElementVNode as M, createSlots as N, createTextVNode as P, createVNode as F, defineComponent as I, getCurrentInstance as L, inject as R, markRaw as z, mergeProps as B, nextTick as ee, normalizeClass as V, normalizeStyle as te, onBeforeUnmount as ne, onMounted as re, onUnmounted as H, openBlock as U, provide as W, reactive as ie, ref as G, renderList as K, renderSlot as q, shallowRef as ae, toDisplayString as J, toValue as oe, unref as Y, useId as se, useSlots as ce, watch as X, watchEffect as le, withCtx as Z, withDirectives as ue, withModifiers as de } from "vue";
|
|
16
16
|
// src/composables/useMap.ts
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
|
|
17
|
+
var fe;
|
|
18
|
+
function pe(e) {
|
|
19
|
+
fe = e;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
21
|
+
function me() {
|
|
22
|
+
return fe;
|
|
23
23
|
}
|
|
24
|
-
var
|
|
25
|
-
function
|
|
26
|
-
let t =
|
|
24
|
+
var he = Symbol("m3-map");
|
|
25
|
+
function ge(e) {
|
|
26
|
+
let t = R(he, null);
|
|
27
27
|
if (t || e === void 0) return t;
|
|
28
|
-
let n =
|
|
29
|
-
let t =
|
|
28
|
+
let n = O(() => {
|
|
29
|
+
let t = oe(e);
|
|
30
30
|
return t ? "context" in t ? t.context : t : void 0;
|
|
31
31
|
}), r = {
|
|
32
|
-
map:
|
|
33
|
-
maplibre:
|
|
34
|
-
styleVersion:
|
|
35
|
-
model:
|
|
32
|
+
map: O(() => n.value?.map.value),
|
|
33
|
+
maplibre: O(() => n.value?.maplibre.value),
|
|
34
|
+
styleVersion: O(() => n.value?.styleVersion.value ?? 0),
|
|
35
|
+
model: O(() => n.value?.model.value),
|
|
36
36
|
layerState: new Proxy({
|
|
37
37
|
visible: {},
|
|
38
38
|
opacity: {}
|
|
39
39
|
}, { get: (e, t) => Reflect.get(n.value?.layerState ?? e, t) }),
|
|
40
|
-
activeTool:
|
|
40
|
+
activeTool: O({
|
|
41
41
|
get: () => n.value?.activeTool.value ?? null,
|
|
42
42
|
set: (e) => {
|
|
43
43
|
n.value && (n.value.activeTool.value = e);
|
|
44
44
|
}
|
|
45
45
|
})
|
|
46
46
|
};
|
|
47
|
-
return
|
|
47
|
+
return W(he, r), r;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
let t =
|
|
49
|
+
function _e(e) {
|
|
50
|
+
let t = ge(e);
|
|
51
51
|
if (!t) throw Error("useMap() must be called in a component inside <MMap>, or be given one");
|
|
52
52
|
let n = [];
|
|
53
|
-
|
|
53
|
+
L() && ne(() => n.splice(0).forEach((e) => e()));
|
|
54
54
|
function r(e) {
|
|
55
55
|
let r = () => {
|
|
56
56
|
if (t.map.value && t.maplibre.value) return e(t.map.value, t.maplibre.value);
|
|
57
|
-
let r =
|
|
57
|
+
let r = X(t.map, (n) => {
|
|
58
58
|
n && t.maplibre.value && (r(), e(n, t.maplibre.value));
|
|
59
59
|
});
|
|
60
60
|
n.push(r);
|
|
61
|
-
}, i =
|
|
62
|
-
i && !i.isMounted ?
|
|
61
|
+
}, i = L();
|
|
62
|
+
i && !i.isMounted ? re(r) : r();
|
|
63
63
|
}
|
|
64
64
|
function i(e, t) {
|
|
65
65
|
r((r) => {
|
|
@@ -72,9 +72,9 @@ function he(e) {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
return {
|
|
75
|
-
map:
|
|
76
|
-
maplibre:
|
|
77
|
-
styleVersion:
|
|
75
|
+
map: O(() => t.map.value),
|
|
76
|
+
maplibre: O(() => t.maplibre.value),
|
|
77
|
+
styleVersion: O(() => t.styleVersion.value),
|
|
78
78
|
activeTool: t.activeTool,
|
|
79
79
|
onReady: r,
|
|
80
80
|
on: i,
|
|
@@ -82,10 +82,10 @@ function he(e) {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
// src/components/MMapControl.vue?vue&type=script&setup=true&lang.ts
|
|
85
|
-
var
|
|
85
|
+
var ve = { class: "hidden" }, ye = {
|
|
86
86
|
key: 0,
|
|
87
87
|
class: "m3-map-control-panel-in"
|
|
88
|
-
},
|
|
88
|
+
}, be = /* @__PURE__ */ I({
|
|
89
89
|
inheritAttrs: !1,
|
|
90
90
|
__name: "MMapControl",
|
|
91
91
|
props: {
|
|
@@ -105,11 +105,11 @@ var ge = { class: "hidden" }, _e = {
|
|
|
105
105
|
},
|
|
106
106
|
emits: ["update:expanded"],
|
|
107
107
|
setup(e, { emit: t }) {
|
|
108
|
-
let o = e, c = t, l =
|
|
109
|
-
|
|
108
|
+
let o = e, c = t, l = ce(), u = G(), { onReady: d } = _e(), f = G(o.expanded);
|
|
109
|
+
X(() => o.expanded, (e) => {
|
|
110
110
|
f.value = e;
|
|
111
111
|
});
|
|
112
|
-
let p =
|
|
112
|
+
let p = O(() => f.value && !!l.panel);
|
|
113
113
|
function m(e) {
|
|
114
114
|
e !== f.value && (f.value = e, c("update:expanded", e));
|
|
115
115
|
}
|
|
@@ -137,10 +137,10 @@ var ge = { class: "hidden" }, _e = {
|
|
|
137
137
|
let e = u.value;
|
|
138
138
|
if (!e || b) return;
|
|
139
139
|
let t = T();
|
|
140
|
-
y && (t.w !== y.w || t.h !== y.h) && o.animate && !s() &&
|
|
140
|
+
y && (t.w !== y.w || t.h !== y.h) && o.animate && !s() && D(e, y, t), y = t;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
if (S = t, C = r, x = i(0, 1, 0, n.
|
|
142
|
+
function D(e, t, r) {
|
|
143
|
+
if (S = t, C = r, x = i(0, 1, 0, n().defaultSpatial, .002), e.style.overflow = "hidden", b = a(e, x, (e) => ({
|
|
144
144
|
width: `${t.w + (r.w - t.w) * e}px`,
|
|
145
145
|
height: `${t.h + (r.h - t.h) * e}px`
|
|
146
146
|
})), !b) return k(e);
|
|
@@ -151,7 +151,7 @@ var ge = { class: "hidden" }, _e = {
|
|
|
151
151
|
let t = T();
|
|
152
152
|
t.w !== C.w || t.h !== C.h ? (y = C, E()) : y = t;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function A() {
|
|
155
155
|
if (!u.value || !b) return;
|
|
156
156
|
let e = r(x, b.currentTime), t = {
|
|
157
157
|
w: S.w + (C.w - S.w) * e,
|
|
@@ -159,33 +159,33 @@ var ge = { class: "hidden" }, _e = {
|
|
|
159
159
|
};
|
|
160
160
|
b.onfinish = null, b.cancel(), b = null, y = t, E();
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
X(p, A, { flush: "post" });
|
|
163
163
|
let N, P = {
|
|
164
164
|
onAdd: () => u.value,
|
|
165
165
|
onRemove: () => u.value?.remove()
|
|
166
166
|
};
|
|
167
167
|
return d((e) => {
|
|
168
168
|
N = e, u.value && e.addControl(P, o.position);
|
|
169
|
-
}),
|
|
169
|
+
}), X(() => o.position, (e) => {
|
|
170
170
|
N && u.value && (N.removeControl(P), N.addControl(P, e));
|
|
171
|
-
}),
|
|
171
|
+
}), re(() => {
|
|
172
172
|
document.addEventListener("pointerdown", _, !0), typeof ResizeObserver < "u" && u.value && (w = new ResizeObserver(E), w.observe(u.value));
|
|
173
173
|
}), ne(() => {
|
|
174
174
|
document.removeEventListener("pointerdown", _, !0), w?.disconnect(), b?.cancel(), N?.hasControl(P) && N.removeControl(P);
|
|
175
|
-
}), (t, n) => (
|
|
175
|
+
}), (t, n) => (U(), j("div", ve, [M("div", B({
|
|
176
176
|
ref_key: "el",
|
|
177
177
|
ref: u,
|
|
178
178
|
class: ["maplibregl-ctrl m3-map-control", p.value ? "m3-map-control-panel" : e.group ? "maplibregl-ctrl-group" : ""]
|
|
179
|
-
}, t.$attrs, { onKeydown: v }), [p.value ? (
|
|
179
|
+
}, t.$attrs, { onKeydown: v }), [p.value ? (U(), j("div", ye, [q(t.$slots, "panel", { close: g })])) : q(t.$slots, "default", {
|
|
180
180
|
expanded: f.value,
|
|
181
181
|
toggle: h
|
|
182
182
|
}, void 0, void 0, 1)], 16)]));
|
|
183
183
|
}
|
|
184
|
-
}),
|
|
184
|
+
}), xe = ["aria-label", "aria-expanded"], Se = ["innerHTML"], Ce = /* @__PURE__ */ I({
|
|
185
185
|
__name: "_MMapAttribution",
|
|
186
186
|
props: { position: {} },
|
|
187
187
|
setup(n) {
|
|
188
|
-
let r = n, i = c(), { on: a, onReady: o } =
|
|
188
|
+
let r = n, i = c(), { on: a, onReady: o } = _e(), s = G([]), l = G(!0), u = G(0), d;
|
|
189
189
|
function f() {
|
|
190
190
|
if (!d) return;
|
|
191
191
|
let e = d.getStyle?.();
|
|
@@ -204,34 +204,34 @@ var ge = { class: "hidden" }, _e = {
|
|
|
204
204
|
}), a("styledata", f), a("sourcedata", f), a("resize", f), a("dragstart", () => {
|
|
205
205
|
l.value = !1;
|
|
206
206
|
});
|
|
207
|
-
let p =
|
|
208
|
-
return (r, a) => p.value ? (
|
|
207
|
+
let p = O(() => s.value.join(" ")), m = O(() => r.position.endsWith("right"));
|
|
208
|
+
return (r, a) => p.value ? (U(), k(be, {
|
|
209
209
|
key: 0,
|
|
210
210
|
position: n.position,
|
|
211
211
|
group: !1,
|
|
212
|
-
class:
|
|
212
|
+
class: V(["m3-map-attrib", l.value ? "m3-map-attrib-open" : ""])
|
|
213
213
|
}, {
|
|
214
|
-
default:
|
|
215
|
-
class:
|
|
214
|
+
default: Z(() => [M("div", {
|
|
215
|
+
class: V(["m3-map-attrib-row", m.value ? "flex-row-reverse" : ""]),
|
|
216
216
|
style: te(u.value ? { maxWidth: `${u.value}px` } : void 0)
|
|
217
|
-
}, [
|
|
217
|
+
}, [ue((U(), j("button", {
|
|
218
218
|
type: "button",
|
|
219
219
|
class: "m3-map-attrib-button",
|
|
220
|
-
"aria-label":
|
|
220
|
+
"aria-label": Y(i).mapToggleAttribution,
|
|
221
221
|
"aria-expanded": l.value,
|
|
222
222
|
onClick: a[0] ||= (e) => l.value = !l.value
|
|
223
|
-
}, [
|
|
223
|
+
}, [F(e, {
|
|
224
224
|
name: "info",
|
|
225
225
|
size: 20
|
|
226
|
-
})], 8,
|
|
226
|
+
})], 8, xe)), [[Y(t), Y(i).mapToggleAttribution]]), l.value ? (U(), j("div", {
|
|
227
227
|
key: 0,
|
|
228
|
-
class:
|
|
228
|
+
class: V(["m3-map-attrib-text", m.value ? "pl-3.5" : "pr-3.5"]),
|
|
229
229
|
innerHTML: p.value
|
|
230
|
-
}, null, 10,
|
|
230
|
+
}, null, 10, Se)) : A("", !0)], 6)]),
|
|
231
231
|
_: 1
|
|
232
|
-
}, 8, ["position", "class"])) :
|
|
232
|
+
}, 8, ["position", "class"])) : A("", !0);
|
|
233
233
|
}
|
|
234
|
-
}),
|
|
234
|
+
}), Q = {
|
|
235
235
|
fill: ["fill-opacity"],
|
|
236
236
|
line: ["line-opacity"],
|
|
237
237
|
circle: ["circle-opacity", "circle-stroke-opacity"],
|
|
@@ -240,27 +240,27 @@ var ge = { class: "hidden" }, _e = {
|
|
|
240
240
|
heatmap: ["heatmap-opacity"],
|
|
241
241
|
"fill-extrusion": ["fill-extrusion-opacity"]
|
|
242
242
|
};
|
|
243
|
-
function
|
|
244
|
-
return
|
|
243
|
+
function we() {
|
|
244
|
+
return ie({
|
|
245
245
|
visible: {},
|
|
246
246
|
opacity: {}
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function Te(e, t, n) {
|
|
250
250
|
let r = {}, i = {};
|
|
251
251
|
for (let e of n?.layers ?? []) {
|
|
252
252
|
let n = t.getLayer(e.id);
|
|
253
253
|
if (!n) continue;
|
|
254
254
|
r[e.id] = t.getLayoutProperty(e.id, "visibility") !== "none";
|
|
255
|
-
let a =
|
|
255
|
+
let a = Q[n.type]?.[0], o = a ? t.getPaintProperty(e.id, a) : void 0;
|
|
256
256
|
i[e.id] = typeof o == "number" ? o : 1;
|
|
257
257
|
}
|
|
258
258
|
e.visible = r, e.opacity = i;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
let t =
|
|
260
|
+
function $(e) {
|
|
261
|
+
let t = ge(e);
|
|
262
262
|
if (!t) throw Error("useMapLayers() must be called in a component inside <MMap>, or be given one");
|
|
263
|
-
let { map: n, model: r, layerState: i } = t, a =
|
|
263
|
+
let { map: n, model: r, layerState: i } = t, a = O(() => r.value?.layers ?? []), o = O(() => new Map(a.value.map((e) => [e.id, e])));
|
|
264
264
|
function s(e) {
|
|
265
265
|
return i.visible[e] ?? !0;
|
|
266
266
|
}
|
|
@@ -277,7 +277,7 @@ function Te(e) {
|
|
|
277
277
|
}
|
|
278
278
|
function d(e, t) {
|
|
279
279
|
let r = n.value, a = r?.getLayer(e);
|
|
280
|
-
if (a) for (let n of
|
|
280
|
+
if (a) for (let n of Q[a.type] ?? []) r.setPaintProperty(e, n, t);
|
|
281
281
|
i.opacity[e] = t;
|
|
282
282
|
for (let n of o.value.get(e)?.children ?? []) d(n, t);
|
|
283
283
|
}
|
|
@@ -291,12 +291,12 @@ function Te(e) {
|
|
|
291
291
|
function m(e, t) {
|
|
292
292
|
for (let n of f(e)) c(n.id, t);
|
|
293
293
|
}
|
|
294
|
-
let h =
|
|
294
|
+
let h = O(() => a.value.filter((e) => e.base)), g = O(() => h.value.find((e) => s(e.id))?.id ?? null);
|
|
295
295
|
function _(e) {
|
|
296
296
|
for (let t of h.value) c(t.id, t.id === e);
|
|
297
297
|
}
|
|
298
298
|
return {
|
|
299
|
-
model:
|
|
299
|
+
model: O(() => r.value),
|
|
300
300
|
layers: a,
|
|
301
301
|
isVisible: s,
|
|
302
302
|
setVisible: c,
|
|
@@ -312,13 +312,13 @@ function Te(e) {
|
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
314
|
// src/composables/_mapStyle.ts
|
|
315
|
-
function
|
|
315
|
+
function Ee(e) {
|
|
316
316
|
return {
|
|
317
317
|
sources: new Set(Object.keys(e?.sources ?? {})),
|
|
318
318
|
layers: new Set((e?.layers ?? []).map((e) => e.id))
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function De(e, t, n, r = () => !0) {
|
|
322
322
|
if (!e) return t;
|
|
323
323
|
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 };
|
|
324
324
|
for (let [t, r] of Object.entries(e.sources)) !n.sources.has(t) && !(t in o) && (o[t] = r);
|
|
@@ -329,7 +329,7 @@ function Ee(e, t, n, r = () => !0) {
|
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
331
|
// src/components/MMap.vue?vue&type=script&setup=true&lang.ts
|
|
332
|
-
var
|
|
332
|
+
var Oe = 600, ke = /* @__PURE__ */ I({
|
|
333
333
|
__name: "MMap",
|
|
334
334
|
props: {
|
|
335
335
|
mapStyle: {},
|
|
@@ -379,19 +379,19 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
379
379
|
"update:pitch"
|
|
380
380
|
],
|
|
381
381
|
setup(e, { expose: t, emit: n }) {
|
|
382
|
-
let r = e, i = n, a = G(), o = G(), s =
|
|
382
|
+
let r = e, i = n, a = G(), o = G(), s = ae(), l = ae(), d = G(0), f, p = ae(), m = we(), h = {
|
|
383
383
|
map: s,
|
|
384
|
-
maplibre:
|
|
384
|
+
maplibre: l,
|
|
385
385
|
styleVersion: d,
|
|
386
386
|
model: p,
|
|
387
387
|
layerState: m,
|
|
388
388
|
activeTool: G(null)
|
|
389
389
|
};
|
|
390
|
-
|
|
390
|
+
W(he, h);
|
|
391
391
|
function g(e) {
|
|
392
|
-
p.value = r.adapter ? r.adapter(e.getStyle(), { styleUrl: typeof r.mapStyle == "string" ? r.mapStyle : void 0 }) : void 0,
|
|
392
|
+
p.value = r.adapter ? r.adapter(e.getStyle(), { styleUrl: typeof r.mapStyle == "string" ? r.mapStyle : void 0 }) : void 0, Te(m, e, p.value);
|
|
393
393
|
}
|
|
394
|
-
let _ = c(), v = () => typeof r.persist == "string" ? r.persist : r.persist ?
|
|
394
|
+
let _ = c(), v = () => typeof r.persist == "string" ? r.persist : r.persist ? u("m3-map-view") : null;
|
|
395
395
|
function y() {
|
|
396
396
|
let e = v();
|
|
397
397
|
if (!e) return {};
|
|
@@ -436,7 +436,7 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
436
436
|
}
|
|
437
437
|
}, S = /* @__PURE__ */ new Map();
|
|
438
438
|
function C(e) {
|
|
439
|
-
let t = s.value, n =
|
|
439
|
+
let t = s.value, n = l.value;
|
|
440
440
|
if (!t || !n) return;
|
|
441
441
|
let i = S.get(e);
|
|
442
442
|
i && (t.removeControl(i), S.delete(e));
|
|
@@ -445,7 +445,7 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
445
445
|
let o = x[e].create(n);
|
|
446
446
|
t.addControl(o, a === !0 ? x[e].corner : a), S.set(e, o);
|
|
447
447
|
}
|
|
448
|
-
for (let e of Object.keys(x))
|
|
448
|
+
for (let e of Object.keys(x)) X(() => r[e], () => C(e));
|
|
449
449
|
function w() {
|
|
450
450
|
return {
|
|
451
451
|
"AttributionControl.ToggleAttribution": _.mapToggleAttribution,
|
|
@@ -465,12 +465,12 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
465
465
|
"CooperativeGesturesHandler.MobileHelpText": _.mapTwoFingers
|
|
466
466
|
};
|
|
467
467
|
}
|
|
468
|
-
let T = G(null),
|
|
468
|
+
let T = G(null), E, O;
|
|
469
469
|
function N(e) {
|
|
470
470
|
let t = e.getAttribute("title");
|
|
471
471
|
t && e.closest(".maplibregl-ctrl") && (e.setAttribute("data-m3-tip", t), e.hasAttribute("aria-label") || e.setAttribute("aria-label", t), e.removeAttribute("title"));
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function P(e) {
|
|
474
474
|
let t = e.getAttribute("data-m3-tip"), n = a.value?.getBoundingClientRect();
|
|
475
475
|
if (!t || !n) return;
|
|
476
476
|
let r = e.getBoundingClientRect(), i = r.left + r.width / 2 > n.left + n.width / 2;
|
|
@@ -482,48 +482,48 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
482
482
|
};
|
|
483
483
|
}
|
|
484
484
|
function I() {
|
|
485
|
-
clearTimeout(
|
|
485
|
+
clearTimeout(E), T.value = null;
|
|
486
486
|
}
|
|
487
487
|
let L = (e) => e.target?.closest?.(".maplibregl-ctrl [data-m3-tip]") ?? null;
|
|
488
|
-
function
|
|
488
|
+
function R(e) {
|
|
489
489
|
let t = L(e);
|
|
490
|
-
t && e.pointerType !== "touch" && (clearTimeout(
|
|
490
|
+
t && e.pointerType !== "touch" && (clearTimeout(E), E = setTimeout(() => P(t), Oe));
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function B(e) {
|
|
493
493
|
let t = L(e);
|
|
494
494
|
t && !t.contains(e.relatedTarget) && I();
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function ee(e) {
|
|
497
497
|
let t = L(e);
|
|
498
|
-
t?.matches(":focus-visible") &&
|
|
498
|
+
t?.matches(":focus-visible") && P(t);
|
|
499
499
|
}
|
|
500
|
-
|
|
500
|
+
re(() => {
|
|
501
501
|
let e = a.value;
|
|
502
|
-
e && (e.querySelectorAll("[title]").forEach(N),
|
|
502
|
+
e && (e.querySelectorAll("[title]").forEach(N), O = new MutationObserver((e) => {
|
|
503
503
|
for (let t of e) t.type === "attributes" ? N(t.target) : t.addedNodes.forEach((e) => {
|
|
504
504
|
e instanceof Element && (N(e), e.querySelectorAll("[title]").forEach(N));
|
|
505
505
|
});
|
|
506
|
-
}),
|
|
506
|
+
}), O.observe(e, {
|
|
507
507
|
subtree: !0,
|
|
508
508
|
childList: !0,
|
|
509
509
|
attributes: !0,
|
|
510
510
|
attributeFilter: ["title"]
|
|
511
511
|
}));
|
|
512
512
|
}), ne(() => {
|
|
513
|
-
|
|
513
|
+
O?.disconnect(), clearTimeout(E);
|
|
514
514
|
});
|
|
515
515
|
let ie = !1;
|
|
516
|
-
|
|
516
|
+
re(async () => {
|
|
517
517
|
let e = await import("maplibre-gl"), t = "Map" in e ? e : e.default;
|
|
518
518
|
if (ie || !o.value) return;
|
|
519
|
-
let n = r.workerUrl ??
|
|
519
|
+
let n = r.workerUrl ?? me();
|
|
520
520
|
n && t.setWorkerUrl(n);
|
|
521
521
|
let a = y(), c = {
|
|
522
522
|
center: a.center ?? r.center,
|
|
523
523
|
zoom: a.zoom ?? r.zoom,
|
|
524
524
|
bearing: a.bearing ?? r.bearing,
|
|
525
525
|
pitch: a.pitch ?? r.pitch
|
|
526
|
-
},
|
|
526
|
+
}, u = z(new t.Map({
|
|
527
527
|
container: o.value,
|
|
528
528
|
style: r.mapStyle,
|
|
529
529
|
attributionControl: !1,
|
|
@@ -531,98 +531,98 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
531
531
|
...Object.fromEntries(Object.entries(c).filter(([, e]) => e !== void 0)),
|
|
532
532
|
...r.options
|
|
533
533
|
}));
|
|
534
|
-
|
|
535
|
-
f ||=
|
|
536
|
-
}),
|
|
537
|
-
let e = b(
|
|
534
|
+
l.value = t, u.on("style.load", () => {
|
|
535
|
+
f ||= Ee(u.getStyle()), g(u), d.value++;
|
|
536
|
+
}), u.on("click", (e) => i("click", e)), u.on("moveend", () => {
|
|
537
|
+
let e = b(u);
|
|
538
538
|
i("update:center", e.center), i("update:zoom", e.zoom), i("update:bearing", e.bearing), i("update:pitch", e.pitch);
|
|
539
539
|
let t = v();
|
|
540
540
|
if (t) try {
|
|
541
541
|
localStorage.setItem(t, JSON.stringify(e));
|
|
542
542
|
} catch {}
|
|
543
|
-
}),
|
|
544
|
-
s.value =
|
|
543
|
+
}), u.once("load", () => {
|
|
544
|
+
s.value = u;
|
|
545
545
|
for (let e of Object.keys(x)) C(e);
|
|
546
|
-
i("ready",
|
|
546
|
+
i("ready", u);
|
|
547
547
|
});
|
|
548
|
-
}),
|
|
548
|
+
}), H(() => {
|
|
549
549
|
ie = !0, s.value?.remove(), s.value = void 0;
|
|
550
550
|
});
|
|
551
|
-
let
|
|
552
|
-
return
|
|
551
|
+
let K = (e, t) => Math.abs(e - t) < 1e-9;
|
|
552
|
+
return X(() => r.center?.join(","), () => {
|
|
553
553
|
let e = s.value;
|
|
554
554
|
if (!e || !r.center) return;
|
|
555
555
|
let t = e.getCenter();
|
|
556
|
-
|
|
557
|
-
}),
|
|
558
|
-
s.value && e !== void 0 && !
|
|
559
|
-
}),
|
|
560
|
-
s.value && e !== void 0 && !
|
|
561
|
-
}),
|
|
562
|
-
s.value && e !== void 0 && !
|
|
563
|
-
}),
|
|
556
|
+
K(t.lng, r.center[0]) && K(t.lat, r.center[1]) || e.jumpTo({ center: r.center });
|
|
557
|
+
}), X(() => r.zoom, (e) => {
|
|
558
|
+
s.value && e !== void 0 && !K(s.value.getZoom(), e) && s.value.jumpTo({ zoom: e });
|
|
559
|
+
}), X(() => r.bearing, (e) => {
|
|
560
|
+
s.value && e !== void 0 && !K(s.value.getBearing(), e) && s.value.jumpTo({ bearing: e });
|
|
561
|
+
}), X(() => r.pitch, (e) => {
|
|
562
|
+
s.value && e !== void 0 && !K(s.value.getPitch(), e) && s.value.jumpTo({ pitch: e });
|
|
563
|
+
}), X(() => r.adapter, () => {
|
|
564
564
|
s.value && g(s.value);
|
|
565
|
-
}),
|
|
565
|
+
}), X(() => r.mapStyle, (e) => s.value?.setStyle(e, {
|
|
566
566
|
diff: !1,
|
|
567
567
|
transformStyle: (e, t) => {
|
|
568
|
-
let n = f ??
|
|
569
|
-
f =
|
|
570
|
-
let i = r.keepLayers, a = i === !1 ? t :
|
|
568
|
+
let n = f ?? Ee(void 0);
|
|
569
|
+
f = Ee(t);
|
|
570
|
+
let i = r.keepLayers, a = i === !1 ? t : De(e, t, n, typeof i == "function" ? i : void 0);
|
|
571
571
|
return r.transformStyle && (a = r.transformStyle(e, a)), a;
|
|
572
572
|
}
|
|
573
573
|
})), t({
|
|
574
574
|
map: s,
|
|
575
575
|
context: h
|
|
576
|
-
}), (t, n) => (
|
|
576
|
+
}), (t, n) => (U(), j("div", {
|
|
577
577
|
ref_key: "root",
|
|
578
578
|
ref: a,
|
|
579
579
|
class: "m3-map relative overflow-hidden",
|
|
580
|
-
onPointerover:
|
|
581
|
-
onPointerout:
|
|
580
|
+
onPointerover: R,
|
|
581
|
+
onPointerout: B,
|
|
582
582
|
onPointerdown: I,
|
|
583
|
-
onFocusin:
|
|
583
|
+
onFocusin: ee,
|
|
584
584
|
onFocusout: I
|
|
585
585
|
}, [
|
|
586
|
-
|
|
586
|
+
M("div", {
|
|
587
587
|
ref_key: "container",
|
|
588
588
|
ref: o,
|
|
589
589
|
class: "h-full w-full"
|
|
590
590
|
}, null, 512),
|
|
591
|
-
s.value && e.attribution ? (
|
|
591
|
+
s.value && e.attribution ? (U(), k(Ce, {
|
|
592
592
|
key: 0,
|
|
593
593
|
position: e.attribution === !0 ? "bottom-right" : e.attribution
|
|
594
|
-
}, null, 8, ["position"])) :
|
|
595
|
-
s.value ?
|
|
596
|
-
|
|
594
|
+
}, null, 8, ["position"])) : A("", !0),
|
|
595
|
+
s.value ? q(t.$slots, "default", {}, void 0, void 0, 1) : A("", !0),
|
|
596
|
+
F(D, {
|
|
597
597
|
"enter-active-class": "transition-opacity duration-150",
|
|
598
598
|
"enter-from-class": "opacity-0",
|
|
599
599
|
"leave-active-class": "transition-opacity duration-100",
|
|
600
600
|
"leave-to-class": "opacity-0"
|
|
601
601
|
}, {
|
|
602
|
-
default:
|
|
602
|
+
default: Z(() => [T.value ? (U(), j("div", {
|
|
603
603
|
key: 0,
|
|
604
604
|
role: "tooltip",
|
|
605
|
-
class:
|
|
605
|
+
class: V(["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", T.value.left ? "-translate-x-full" : ""]),
|
|
606
606
|
style: te({
|
|
607
607
|
left: `${T.value.x}px`,
|
|
608
608
|
top: `${T.value.y}px`
|
|
609
609
|
})
|
|
610
|
-
}, J(T.value.text), 7)) :
|
|
610
|
+
}, J(T.value.text), 7)) : A("", !0)]),
|
|
611
611
|
_: 1
|
|
612
612
|
})
|
|
613
613
|
], 544));
|
|
614
614
|
}
|
|
615
|
-
}),
|
|
615
|
+
}), Ae = 13.5, je = Ae / Math.SQRT2, Me = [0, -14], Ne = {
|
|
616
616
|
center: [0, 0],
|
|
617
617
|
top: [0, 0],
|
|
618
618
|
"top-left": [0, 0],
|
|
619
619
|
"top-right": [0, 0],
|
|
620
620
|
bottom: [0, -38.1],
|
|
621
|
-
"bottom-left": [
|
|
622
|
-
"bottom-right": [-
|
|
623
|
-
left: [
|
|
621
|
+
"bottom-left": [je, (24.6 + je) * -1],
|
|
622
|
+
"bottom-right": [-je, (24.6 + je) * -1],
|
|
623
|
+
left: [Ae, -24.6],
|
|
624
624
|
right: [-13.5, -24.6]
|
|
625
|
-
},
|
|
625
|
+
}, Pe = { class: "hidden" }, Fe = /* @__PURE__ */ I({
|
|
626
626
|
inheritAttrs: !1,
|
|
627
627
|
__name: "MMapMarker",
|
|
628
628
|
props: {
|
|
@@ -638,7 +638,7 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
638
638
|
},
|
|
639
639
|
emits: ["update:lngLat", "click"],
|
|
640
640
|
setup(e, { expose: t, emit: n }) {
|
|
641
|
-
let r = e, i = n, a =
|
|
641
|
+
let r = e, i = n, a = ce(), o = G(), s = G(), { onReady: c } = _e(), l, u = !1;
|
|
642
642
|
c((e, t) => {
|
|
643
643
|
u = !!a.default && !!o.value, l = new t.Marker({
|
|
644
644
|
...u ? { element: o.value } : { color: r.color ?? "currentColor" },
|
|
@@ -657,20 +657,20 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
657
657
|
function d(e) {
|
|
658
658
|
i("click", e);
|
|
659
659
|
}
|
|
660
|
-
return
|
|
660
|
+
return X(() => r.lngLat.join(","), () => l?.setLngLat(r.lngLat)), X(() => r.draggable, (e) => l?.setDraggable(e)), X(() => r.rotation, (e) => l?.setRotation(e)), X(() => r.offset?.join(","), () => l?.setOffset(r.offset ?? (u ? [0, 0] : Me))), ne(() => {
|
|
661
661
|
l?.getElement().removeEventListener("click", d), l?.getPopup()?.remove(), l?.remove();
|
|
662
|
-
}), t({ marker: () => l }), (e, t) => (
|
|
662
|
+
}), t({ marker: () => l }), (e, t) => (U(), j("div", Pe, [e.$slots.default ? (U(), j("div", B({
|
|
663
663
|
key: 0,
|
|
664
664
|
ref_key: "content",
|
|
665
665
|
ref: o,
|
|
666
666
|
class: "m3-map-marker"
|
|
667
|
-
}, e.$attrs), [
|
|
667
|
+
}, e.$attrs), [q(e.$slots, "default")], 16)) : A("", !0), e.$slots.popup ? (U(), j("div", {
|
|
668
668
|
key: 1,
|
|
669
669
|
ref_key: "popupContent",
|
|
670
670
|
ref: s
|
|
671
|
-
}, [
|
|
671
|
+
}, [q(e.$slots, "popup")], 512)) : A("", !0)]));
|
|
672
672
|
}
|
|
673
|
-
}),
|
|
673
|
+
}), Ie = { class: "hidden" }, Le = /* @__PURE__ */ I({
|
|
674
674
|
inheritAttrs: !1,
|
|
675
675
|
__name: "MMapPopup",
|
|
676
676
|
props: {
|
|
@@ -693,7 +693,7 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
693
693
|
},
|
|
694
694
|
emits: ["update:open"],
|
|
695
695
|
setup(e, { expose: t, emit: n }) {
|
|
696
|
-
let r = e, i = n, a = G(), { onReady: o } =
|
|
696
|
+
let r = e, i = n, a = G(), { onReady: o } = _e(), s, c, l = !1;
|
|
697
697
|
function u() {
|
|
698
698
|
s && c && !s.isOpen() && s.setLngLat(r.lngLat).addTo(c);
|
|
699
699
|
}
|
|
@@ -709,16 +709,16 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
709
709
|
}), a.value && s.setDOMContent(a.value), s.on("close", () => {
|
|
710
710
|
l || i("update:open", !1);
|
|
711
711
|
}), r.open && u();
|
|
712
|
-
}),
|
|
712
|
+
}), X(() => r.open, (e) => {
|
|
713
713
|
e ? u() : s?.isOpen() && (l = !0, s.remove(), l = !1);
|
|
714
|
-
}),
|
|
714
|
+
}), X(() => r.lngLat.join(","), () => s?.setLngLat(r.lngLat)), X(() => r.maxWidth, (e) => s?.setMaxWidth(e)), X(() => r.offset, (e) => s?.setOffset(e ?? 0)), ne(() => {
|
|
715
715
|
l = !0, s?.remove();
|
|
716
|
-
}), t({ popup: () => s }), (e, t) => (
|
|
716
|
+
}), t({ popup: () => s }), (e, t) => (U(), j("div", Ie, [M("div", B({
|
|
717
717
|
ref_key: "content",
|
|
718
718
|
ref: a
|
|
719
|
-
}, e.$attrs), [
|
|
719
|
+
}, e.$attrs), [q(e.$slots, "default")], 16)]));
|
|
720
720
|
}
|
|
721
|
-
}),
|
|
721
|
+
}), Re = /* @__PURE__ */ I({
|
|
722
722
|
inheritAttrs: !1,
|
|
723
723
|
__name: "MMapGeoJson",
|
|
724
724
|
props: {
|
|
@@ -734,13 +734,13 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
734
734
|
},
|
|
735
735
|
emits: ["click"],
|
|
736
736
|
setup(e, { expose: t, emit: n }) {
|
|
737
|
-
let r = e, i = n, a = r.id ?? `m3-geojson-${
|
|
737
|
+
let r = e, i = n, a = r.id ?? `m3-geojson-${se()}`, { onReady: o, styleVersion: s } = _e(), c = d(["primary", "surface"]), l = (...e) => [
|
|
738
738
|
"match",
|
|
739
739
|
["geometry-type"],
|
|
740
740
|
e,
|
|
741
741
|
!0,
|
|
742
742
|
!1
|
|
743
|
-
],
|
|
743
|
+
], u = O(() => {
|
|
744
744
|
let { primary: e, surface: t } = c.value;
|
|
745
745
|
return [
|
|
746
746
|
{
|
|
@@ -773,7 +773,7 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
775
|
];
|
|
776
|
-
}), f =
|
|
776
|
+
}), f = O(() => (r.layers ?? u.value).map((e, t) => ({
|
|
777
777
|
...e,
|
|
778
778
|
id: e.id ?? `${a}-${t}`,
|
|
779
779
|
source: a
|
|
@@ -803,14 +803,14 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
803
803
|
}
|
|
804
804
|
return o((e) => {
|
|
805
805
|
p = e, b();
|
|
806
|
-
}),
|
|
806
|
+
}), X(s, () => b()), X(() => r.data, (e) => (p?.getSource(a))?.setData(e)), X(() => JSON.stringify(f.value), () => y()), X(() => r.before, () => y()), ne(() => {
|
|
807
807
|
p &&= (v(), p.getSource(a) && p.removeSource(a), void 0);
|
|
808
808
|
}), t({
|
|
809
809
|
sourceId: a,
|
|
810
810
|
layerIds: () => [...m]
|
|
811
811
|
}), (e, t) => null;
|
|
812
812
|
}
|
|
813
|
-
}),
|
|
813
|
+
}), ze = ["aria-label", "onClick"], Be = /* @__PURE__ */ I({
|
|
814
814
|
inheritAttrs: !1,
|
|
815
815
|
__name: "MMapCluster",
|
|
816
816
|
props: {
|
|
@@ -833,20 +833,20 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
833
833
|
},
|
|
834
834
|
emits: ["click", "cluster-click"],
|
|
835
835
|
setup(e, { expose: t, emit: n }) {
|
|
836
|
-
let r = e, i = n, a = r.id ?? `m3-cluster-${
|
|
836
|
+
let r = e, i = n, a = r.id ?? `m3-cluster-${se()}`, o = c(), { onReady: s, styleVersion: u } = _e(), f = d([
|
|
837
837
|
"primary",
|
|
838
838
|
"secondary",
|
|
839
839
|
"tertiary",
|
|
840
840
|
"surface"
|
|
841
|
-
]),
|
|
842
|
-
let e =
|
|
841
|
+
]), p = ["!", ["has", "point_count"]], m = O(() => {
|
|
842
|
+
let e = f.value[r.color];
|
|
843
843
|
return (r.pointLayers ?? [{
|
|
844
844
|
type: "circle",
|
|
845
|
-
filter:
|
|
845
|
+
filter: p,
|
|
846
846
|
paint: {
|
|
847
847
|
"circle-color": e,
|
|
848
848
|
"circle-radius": 6,
|
|
849
|
-
"circle-stroke-color":
|
|
849
|
+
"circle-stroke-color": f.value.surface,
|
|
850
850
|
"circle-stroke-width": 2
|
|
851
851
|
}
|
|
852
852
|
}]).map((e, t) => ({
|
|
@@ -854,44 +854,44 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
854
854
|
id: e.id ?? `${a}-point-${t}`,
|
|
855
855
|
source: a
|
|
856
856
|
}));
|
|
857
|
-
}),
|
|
857
|
+
}), h = {
|
|
858
858
|
primary: "bg-primary text-on-primary after:bg-on-primary",
|
|
859
859
|
secondary: "bg-secondary text-on-secondary after:bg-on-secondary",
|
|
860
860
|
tertiary: "bg-tertiary text-on-tertiary after:bg-on-tertiary"
|
|
861
861
|
};
|
|
862
|
-
function
|
|
862
|
+
function g(e) {
|
|
863
863
|
return e < 10 ? 32 : e < 100 ? 40 : e < 1e3 ? 48 : 56;
|
|
864
864
|
}
|
|
865
|
-
let
|
|
865
|
+
let _ = O(() => {
|
|
866
866
|
let e = typeof document < "u" && document.documentElement.lang || void 0;
|
|
867
867
|
return new Intl.NumberFormat(e, {
|
|
868
868
|
notation: "compact",
|
|
869
869
|
maximumFractionDigits: 1
|
|
870
870
|
});
|
|
871
|
-
}),
|
|
872
|
-
function
|
|
871
|
+
}), v, y, b = [], x = /* @__PURE__ */ new Map(), S = ae([]), C = () => v?.getSource(a);
|
|
872
|
+
function w(e, t, n) {
|
|
873
873
|
return {
|
|
874
874
|
id: e,
|
|
875
875
|
count: t,
|
|
876
876
|
lngLat: n,
|
|
877
877
|
zoomIn: async () => {
|
|
878
|
-
let t = await
|
|
879
|
-
t !== void 0 &&
|
|
878
|
+
let t = await C()?.getClusterExpansionZoom(e);
|
|
879
|
+
t !== void 0 && v && v.easeTo({
|
|
880
880
|
center: n,
|
|
881
|
-
zoom: Math.min(t,
|
|
881
|
+
zoom: Math.min(t, v.getMaxZoom())
|
|
882
882
|
});
|
|
883
883
|
},
|
|
884
|
-
leaves: async (t = Infinity) => await
|
|
884
|
+
leaves: async (t = Infinity) => await C()?.getClusterLeaves(e, t, 0) ?? []
|
|
885
885
|
};
|
|
886
886
|
}
|
|
887
|
-
function
|
|
888
|
-
if (
|
|
887
|
+
function D() {
|
|
888
|
+
if (A = 0, !v || !y || !v.getSource(a)) return;
|
|
889
889
|
let e = /* @__PURE__ */ new Set();
|
|
890
|
-
for (let t of
|
|
890
|
+
for (let t of v.querySourceFeatures(a, { filter: ["has", "point_count"] })) {
|
|
891
891
|
let n = t.properties, r = n.cluster_id;
|
|
892
892
|
if (e.has(r)) continue;
|
|
893
893
|
e.add(r);
|
|
894
|
-
let [i, a] = t.geometry.coordinates, o =
|
|
894
|
+
let [i, a] = t.geometry.coordinates, o = x.get(r);
|
|
895
895
|
if (o && o.count === n.point_count) {
|
|
896
896
|
o.marker.setLngLat([i, a]);
|
|
897
897
|
continue;
|
|
@@ -899,43 +899,43 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
899
899
|
o?.marker.remove();
|
|
900
900
|
let s = o?.el ?? document.createElement("div");
|
|
901
901
|
s.className = "m3-map-cluster";
|
|
902
|
-
let c = new
|
|
902
|
+
let c = new y.Marker({
|
|
903
903
|
element: s,
|
|
904
904
|
anchor: "center"
|
|
905
|
-
}).setLngLat([i, a]).addTo(
|
|
906
|
-
|
|
907
|
-
...
|
|
905
|
+
}).setLngLat([i, a]).addTo(v);
|
|
906
|
+
x.set(r, {
|
|
907
|
+
...w(r, n.point_count, [i, a]),
|
|
908
908
|
el: s,
|
|
909
909
|
marker: c
|
|
910
910
|
});
|
|
911
911
|
}
|
|
912
|
-
for (let [t, n] of
|
|
913
|
-
|
|
914
|
-
}
|
|
915
|
-
let
|
|
916
|
-
function
|
|
917
|
-
|
|
918
|
-
}
|
|
919
|
-
let
|
|
920
|
-
e.sourceId === a &&
|
|
921
|
-
},
|
|
922
|
-
r.interactive &&
|
|
923
|
-
},
|
|
924
|
-
r.interactive &&
|
|
912
|
+
for (let [t, n] of x) e.has(t) || (n.marker.remove(), x.delete(t));
|
|
913
|
+
S.value = [...x.values()];
|
|
914
|
+
}
|
|
915
|
+
let A = 0;
|
|
916
|
+
function N() {
|
|
917
|
+
A ||= requestAnimationFrame(D);
|
|
918
|
+
}
|
|
919
|
+
let P = (e) => {
|
|
920
|
+
e.sourceId === a && N();
|
|
921
|
+
}, F = (e) => i("click", e), I = () => {
|
|
922
|
+
r.interactive && v && (v.getCanvas().style.cursor = "pointer");
|
|
923
|
+
}, L = () => {
|
|
924
|
+
r.interactive && v && (v.getCanvas().style.cursor = "");
|
|
925
925
|
};
|
|
926
|
-
function L() {
|
|
927
|
-
if (_) {
|
|
928
|
-
for (let e of y) _.off("click", e, P), _.off("mouseenter", e, F), _.off("mouseleave", e, I), _.getLayer(e) && _.removeLayer(e);
|
|
929
|
-
y = [];
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
926
|
function R() {
|
|
933
|
-
if (
|
|
934
|
-
L();
|
|
935
|
-
|
|
927
|
+
if (v) {
|
|
928
|
+
for (let e of b) v.off("click", e, F), v.off("mouseenter", e, I), v.off("mouseleave", e, L), v.getLayer(e) && v.removeLayer(e);
|
|
929
|
+
b = [];
|
|
936
930
|
}
|
|
937
931
|
}
|
|
938
932
|
function z() {
|
|
933
|
+
if (v) {
|
|
934
|
+
R();
|
|
935
|
+
for (let e of m.value) v.addLayer(e, r.before && v.getLayer(r.before) ? r.before : void 0), v.on("click", e.id, F), v.on("mouseenter", e.id, I), v.on("mouseleave", e.id, L), b.push(e.id);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
function B() {
|
|
939
939
|
return {
|
|
940
940
|
type: "geojson",
|
|
941
941
|
data: r.data,
|
|
@@ -946,21 +946,21 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
946
946
|
};
|
|
947
947
|
}
|
|
948
948
|
function ee() {
|
|
949
|
-
|
|
949
|
+
v && (v.getSource(a) || (v.addSource(a, B()), b = []), b.length && v.getLayer(b[0]) || z(), N());
|
|
950
950
|
}
|
|
951
|
-
function
|
|
952
|
-
|
|
951
|
+
function re() {
|
|
952
|
+
v && (R(), v.getSource(a) && v.removeSource(a), ee());
|
|
953
953
|
}
|
|
954
954
|
s((e, t) => {
|
|
955
|
-
|
|
956
|
-
}),
|
|
957
|
-
|
|
958
|
-
}),
|
|
955
|
+
v = e, y = t, ee(), v.on("sourcedata", P), v.on("move", N), v.on("moveend", N);
|
|
956
|
+
}), X(u, () => ee()), X(() => r.data, (e) => {
|
|
957
|
+
C()?.setData(e), N();
|
|
958
|
+
}), X(() => [
|
|
959
959
|
r.radius,
|
|
960
960
|
r.maxZoom,
|
|
961
961
|
JSON.stringify(r.sourceOptions)
|
|
962
|
-
].join("|"),
|
|
963
|
-
function
|
|
962
|
+
].join("|"), re), X(() => JSON.stringify(m.value), () => z()), X(() => r.before, () => z());
|
|
963
|
+
function H(e) {
|
|
964
964
|
let t = {
|
|
965
965
|
id: e.id,
|
|
966
966
|
count: e.count,
|
|
@@ -970,77 +970,77 @@ var De = 600, Oe = /* @__PURE__ */ F({
|
|
|
970
970
|
};
|
|
971
971
|
i("cluster-click", t), r.zoomOnClick && e.zoomIn();
|
|
972
972
|
}
|
|
973
|
-
let
|
|
973
|
+
let W = (e) => l(o.mapClusterZoom, { count: String(e) }, o.lang);
|
|
974
974
|
return ne(() => {
|
|
975
|
-
|
|
976
|
-
for (let e of
|
|
977
|
-
|
|
975
|
+
A && cancelAnimationFrame(A);
|
|
976
|
+
for (let e of x.values()) e.marker.remove();
|
|
977
|
+
x.clear(), S.value = [], v &&= (v.off("sourcedata", P), v.off("move", N), v.off("moveend", N), R(), v.getSource(a) && v.removeSource(a), void 0);
|
|
978
978
|
}), t({
|
|
979
979
|
sourceId: a,
|
|
980
|
-
layerIds: () => [...
|
|
981
|
-
clusters: () =>
|
|
980
|
+
layerIds: () => [...b],
|
|
981
|
+
clusters: () => S.value.map(({ id: e, count: t, lngLat: n, zoomIn: r, leaves: i }) => ({
|
|
982
982
|
id: e,
|
|
983
983
|
count: t,
|
|
984
984
|
lngLat: n,
|
|
985
985
|
zoomIn: r,
|
|
986
986
|
leaves: i
|
|
987
987
|
}))
|
|
988
|
-
}), (t, n) => (
|
|
988
|
+
}), (t, n) => (U(!0), j(T, null, K(S.value, (n) => (U(), k(E, {
|
|
989
989
|
key: n.id,
|
|
990
990
|
to: n.el
|
|
991
|
-
}, [
|
|
991
|
+
}, [q(t.$slots, "cluster", {
|
|
992
992
|
id: n.id,
|
|
993
993
|
count: n.count,
|
|
994
|
-
label:
|
|
994
|
+
label: _.value.format(n.count),
|
|
995
995
|
lngLat: n.lngLat,
|
|
996
996
|
zoomIn: n.zoomIn,
|
|
997
997
|
leaves: n.leaves
|
|
998
|
-
}, () => [
|
|
998
|
+
}, () => [M("button", {
|
|
999
999
|
type: "button",
|
|
1000
|
-
class:
|
|
1000
|
+
class: V(["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", h[e.color]]),
|
|
1001
1001
|
style: te({
|
|
1002
|
-
width: `${
|
|
1003
|
-
height: `${
|
|
1002
|
+
width: `${g(n.count)}px`,
|
|
1003
|
+
height: `${g(n.count)}px`
|
|
1004
1004
|
}),
|
|
1005
|
-
"aria-label":
|
|
1006
|
-
onClick:
|
|
1007
|
-
}, J(
|
|
1005
|
+
"aria-label": W(n.count),
|
|
1006
|
+
onClick: de((e) => H(n), ["stop"])
|
|
1007
|
+
}, J(_.value.format(n.count)), 15, ze)])], 8, ["to"]))), 128));
|
|
1008
1008
|
}
|
|
1009
|
-
}),
|
|
1010
|
-
function
|
|
1011
|
-
let n = (t[1] - e[1]) *
|
|
1012
|
-
return 2 *
|
|
1009
|
+
}), Ve = 6371008.8, He = Math.PI / 180;
|
|
1010
|
+
function Ue(e, t) {
|
|
1011
|
+
let n = (t[1] - e[1]) * He, r = (t[0] - e[0]) * He, i = Math.sin(n / 2) ** 2 + Math.cos(e[1] * He) * Math.cos(t[1] * He) * Math.sin(r / 2) ** 2;
|
|
1012
|
+
return 2 * Ve * Math.asin(Math.min(1, Math.sqrt(i)));
|
|
1013
1013
|
}
|
|
1014
|
-
function
|
|
1014
|
+
function We(e) {
|
|
1015
1015
|
let t = 0;
|
|
1016
|
-
for (let n = 1; n < e.length; n++) t +=
|
|
1016
|
+
for (let n = 1; n < e.length; n++) t += Ue(e[n - 1], e[n]);
|
|
1017
1017
|
return t;
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1019
|
+
function Ge(e, t) {
|
|
1020
1020
|
let [n, r, i, a] = [
|
|
1021
|
-
e[0] *
|
|
1022
|
-
e[1] *
|
|
1023
|
-
t[0] *
|
|
1024
|
-
t[1] *
|
|
1021
|
+
e[0] * He,
|
|
1022
|
+
e[1] * He,
|
|
1023
|
+
t[0] * He,
|
|
1024
|
+
t[1] * He
|
|
1025
1025
|
], 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));
|
|
1026
|
-
return [(n + Math.atan2(s, Math.cos(r) + o)) /
|
|
1026
|
+
return [(n + Math.atan2(s, Math.cos(r) + o)) / He, c / He];
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1029
|
-
let t =
|
|
1028
|
+
function Ke(e) {
|
|
1029
|
+
let t = qe(e), n = t.length - 1;
|
|
1030
1030
|
if (n <= 2) return 0;
|
|
1031
1031
|
let r = 0;
|
|
1032
1032
|
for (let e = 0; e < n; e++) {
|
|
1033
1033
|
let i = t[e], a = t[e + 1 === n ? 0 : e + 1], o = t[e + 2 >= n ? (e + 2) % n : e + 2];
|
|
1034
|
-
r += (o[0] - i[0]) *
|
|
1034
|
+
r += (o[0] - i[0]) * He * Math.sin(a[1] * He);
|
|
1035
1035
|
}
|
|
1036
|
-
return Math.abs(r *
|
|
1036
|
+
return Math.abs(r * Ve * Ve / 2);
|
|
1037
1037
|
}
|
|
1038
|
-
function
|
|
1038
|
+
function qe(e) {
|
|
1039
1039
|
let t = e[0], n = e[e.length - 1];
|
|
1040
1040
|
return t && n && (t[0] !== n[0] || t[1] !== n[1]) ? [...e, t] : e;
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1043
|
-
let t =
|
|
1042
|
+
function Je(e) {
|
|
1043
|
+
let t = qe(e), n = 0, r = 0, i = 0;
|
|
1044
1044
|
for (let e = 0; e < t.length - 1; e++) {
|
|
1045
1045
|
let [a, o] = t[e], [s, c] = t[e + 1], l = a * c - s * o;
|
|
1046
1046
|
n += l, r += (a + s) * l, i += (o + c) * l;
|
|
@@ -1052,17 +1052,17 @@ function qe(e) {
|
|
|
1052
1052
|
return [r / (3 * n), i / (3 * n)];
|
|
1053
1053
|
}
|
|
1054
1054
|
// src/composables/_routeGeometry.ts
|
|
1055
|
-
var
|
|
1056
|
-
function
|
|
1055
|
+
var Ye = Math.PI / 180;
|
|
1056
|
+
function Xe(e) {
|
|
1057
1057
|
let t = [0];
|
|
1058
|
-
for (let n = 1; n < e.length; n++) t.push(t[n - 1] +
|
|
1058
|
+
for (let n = 1; n < e.length; n++) t.push(t[n - 1] + Ue(e[n - 1], e[n]));
|
|
1059
1059
|
return t;
|
|
1060
1060
|
}
|
|
1061
|
-
function Xe(e, t) {
|
|
1062
|
-
let n = e[1] * Je, r = t[1] * Je, i = (t[0] - e[0]) * Je, a = Math.sin(i) * Math.cos(r), o = Math.cos(n) * Math.sin(r) - Math.sin(n) * Math.cos(r) * Math.cos(i);
|
|
1063
|
-
return (Math.atan2(a, o) / Je + 360) % 360;
|
|
1064
|
-
}
|
|
1065
1061
|
function Ze(e, t) {
|
|
1062
|
+
let n = e[1] * Ye, r = t[1] * Ye, i = (t[0] - e[0]) * Ye, a = Math.sin(i) * Math.cos(r), o = Math.cos(n) * Math.sin(r) - Math.sin(n) * Math.cos(r) * Math.cos(i);
|
|
1063
|
+
return (Math.atan2(a, o) / Ye + 360) % 360;
|
|
1064
|
+
}
|
|
1065
|
+
function Qe(e, t) {
|
|
1066
1066
|
let n = 0, r = e.length - 1;
|
|
1067
1067
|
for (; r - n > 1;) {
|
|
1068
1068
|
let i = n + r >> 1;
|
|
@@ -1070,7 +1070,7 @@ function Ze(e, t) {
|
|
|
1070
1070
|
}
|
|
1071
1071
|
return n;
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function $e(e, t, n) {
|
|
1074
1074
|
if (e.length === 0) return {
|
|
1075
1075
|
lngLat: [0, 0],
|
|
1076
1076
|
bearing: 0
|
|
@@ -1079,35 +1079,35 @@ function Qe(e, t, n) {
|
|
|
1079
1079
|
lngLat: e[0],
|
|
1080
1080
|
bearing: 0
|
|
1081
1081
|
};
|
|
1082
|
-
let r = t[t.length - 1], i = Math.min(Math.max(n, 0), r), a = Math.min(
|
|
1082
|
+
let r = t[t.length - 1], i = Math.min(Math.max(n, 0), r), a = Math.min(Qe(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;
|
|
1083
1083
|
return {
|
|
1084
1084
|
lngLat: [o[0] + (s[0] - o[0]) * l, o[1] + (s[1] - o[1]) * l],
|
|
1085
|
-
bearing:
|
|
1085
|
+
bearing: et(e, t, a)
|
|
1086
1086
|
};
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1089
|
-
for (let r = n; r < e.length - 1; r++) if (t[r + 1] > t[r]) return
|
|
1090
|
-
for (let r = n - 1; r >= 0; r--) if (t[r + 1] > t[r]) return
|
|
1088
|
+
function et(e, t, n) {
|
|
1089
|
+
for (let r = n; r < e.length - 1; r++) if (t[r + 1] > t[r]) return Ze(e[r], e[r + 1]);
|
|
1090
|
+
for (let r = n - 1; r >= 0; r--) if (t[r + 1] > t[r]) return Ze(e[r], e[r + 1]);
|
|
1091
1091
|
return 0;
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function tt(e, t, n, r) {
|
|
1094
1094
|
if (e.length < 2) return [...e];
|
|
1095
|
-
let i = t[t.length - 1], a = Math.min(Math.max(n, 0), i), o = Math.min(Math.max(r, a), i), s = [
|
|
1095
|
+
let i = t[t.length - 1], a = Math.min(Math.max(n, 0), i), o = Math.min(Math.max(r, a), i), s = [$e(e, t, a).lngLat];
|
|
1096
1096
|
for (let n = 0; n < e.length; n++) t[n] > a && t[n] < o && s.push(e[n]);
|
|
1097
|
-
return s.push(
|
|
1097
|
+
return s.push($e(e, t, o).lngLat), s;
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function nt(e, t, n) {
|
|
1100
1100
|
if (e.length < 2) return 0;
|
|
1101
|
-
let r = Math.cos(n[1] *
|
|
1101
|
+
let r = Math.cos(n[1] * Ye), i = Infinity, a = 0;
|
|
1102
1102
|
for (let o = 0; o < e.length - 1; o++) {
|
|
1103
1103
|
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;
|
|
1104
1104
|
x < i && (i = x, a = t[o] + (t[o + 1] - t[o]) * v);
|
|
1105
1105
|
}
|
|
1106
1106
|
return a;
|
|
1107
1107
|
}
|
|
1108
|
-
function
|
|
1108
|
+
function rt(e, t, n, r, i = 25) {
|
|
1109
1109
|
if (e.length < 2) return 0;
|
|
1110
|
-
let a = Math.cos(n[1] *
|
|
1110
|
+
let a = Math.cos(n[1] * Ye), o = t[t.length - 1];
|
|
1111
1111
|
if (r >= o) return o;
|
|
1112
1112
|
let s = Infinity, c = r;
|
|
1113
1113
|
for (let o = 0; o < e.length - 1; o++) {
|
|
@@ -1117,13 +1117,13 @@ function nt(e, t, n, r, i = 25) {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
return Math.max(c, r);
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function it(e) {
|
|
1121
1121
|
let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
|
|
1122
1122
|
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);
|
|
1123
1123
|
return [[t, n], [r, i]];
|
|
1124
1124
|
}
|
|
1125
1125
|
// src/components/MMapRoute.vue?vue&type=script&setup=true&lang.ts
|
|
1126
|
-
var
|
|
1126
|
+
var at = { class: "hidden" }, ot = ["aria-label"], st = ["aria-label"], ct = { style: { transform: "rotate(0.01deg)" } }, lt = /* @__PURE__ */ I({
|
|
1127
1127
|
inheritAttrs: !1,
|
|
1128
1128
|
__name: "MMapRoute",
|
|
1129
1129
|
props: {
|
|
@@ -1168,29 +1168,29 @@ var it = { class: "hidden" }, at = ["aria-label"], ot = ["aria-label"], st = { s
|
|
|
1168
1168
|
"error"
|
|
1169
1169
|
],
|
|
1170
1170
|
setup(n, { expose: r, emit: i }) {
|
|
1171
|
-
let a = n, o = i, l =
|
|
1171
|
+
let a = n, o = i, l = ce(), u = c(), f = a.id ?? `m3-route-${se()}`, { onReady: p, styleVersion: m } = _e(), h = d([
|
|
1172
1172
|
"primary",
|
|
1173
1173
|
"outline",
|
|
1174
1174
|
"surface"
|
|
1175
|
-
]), g =
|
|
1175
|
+
]), g = ae(null), _ = O(() => a.path && a.path.length > 1 ? a.path : g.value && g.value.length > 1 ? g.value : a.stops.map((e) => e.lngLat)), v = O(() => JSON.stringify(_.value)), y = O(() => Xe(_.value)), b = O(() => y.value[y.value.length - 1] ?? 0), x = O(() => {
|
|
1176
1176
|
let e = 0;
|
|
1177
|
-
return a.stops.map((t) => e =
|
|
1177
|
+
return a.stops.map((t) => e = rt(_.value, y.value, t.lngLat, e, 0));
|
|
1178
1178
|
}), S = null;
|
|
1179
1179
|
function C() {
|
|
1180
1180
|
if (a.vehicle) {
|
|
1181
|
-
let e = a.snap === "nearest" || S == null ?
|
|
1181
|
+
let e = a.snap === "nearest" || S == null ? nt(_.value, y.value, a.vehicle) : rt(_.value, y.value, a.vehicle, S);
|
|
1182
1182
|
return S = e, e;
|
|
1183
1183
|
}
|
|
1184
1184
|
return S = null, a.progress != null && Number.isFinite(a.progress) ? Math.min(Math.max(a.progress, 0), 1) * b.value : null;
|
|
1185
1185
|
}
|
|
1186
|
-
let
|
|
1187
|
-
|
|
1186
|
+
let w = G(C());
|
|
1187
|
+
X([
|
|
1188
1188
|
() => a.vehicle?.join(","),
|
|
1189
1189
|
() => a.progress,
|
|
1190
1190
|
() => a.snap
|
|
1191
|
-
], () =>
|
|
1191
|
+
], () => w.value = C());
|
|
1192
1192
|
let E;
|
|
1193
|
-
async function
|
|
1193
|
+
async function D() {
|
|
1194
1194
|
if (E?.abort(), !a.provider || a.path && a.path.length > 1 || a.stops.length < 2) {
|
|
1195
1195
|
g.value = null;
|
|
1196
1196
|
return;
|
|
@@ -1204,12 +1204,12 @@ var it = { class: "hidden" }, at = ["aria-label"], ot = ["aria-label"], st = { s
|
|
|
1204
1204
|
e.signal.aborted || (g.value = null, o("error", t));
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
|
-
|
|
1207
|
+
re(D), X([
|
|
1208
1208
|
() => JSON.stringify(a.stops.map((e) => e.lngLat)),
|
|
1209
1209
|
() => a.provider,
|
|
1210
1210
|
() => !!(a.path && a.path.length > 1)
|
|
1211
|
-
], () =>
|
|
1212
|
-
let
|
|
1211
|
+
], () => D());
|
|
1212
|
+
let A = 0, I = G(0), L = G(0), R = 0, z = 0, B = (e) => a.stops[e]?.done ?? (w.value != null && I.value >= x.value[e] - 1), ee = O(() => a.color ?? h.value.primary), H, W, ie = G(), oe = [
|
|
1213
1213
|
`${f}-rest`,
|
|
1214
1214
|
`${f}-casing`,
|
|
1215
1215
|
`${f}-done`
|
|
@@ -1225,17 +1225,17 @@ var it = { class: "hidden" }, at = ["aria-label"], ot = ["aria-label"], st = { s
|
|
|
1225
1225
|
});
|
|
1226
1226
|
return {
|
|
1227
1227
|
type: "FeatureCollection",
|
|
1228
|
-
features: [t(_.value, "rest"), t(
|
|
1228
|
+
features: [t(_.value, "rest"), t(tt(_.value, y.value, 0, e), "done")]
|
|
1229
1229
|
};
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function de() {
|
|
1232
1232
|
let e = a.width, t = {
|
|
1233
1233
|
"line-cap": "round",
|
|
1234
1234
|
"line-join": "round"
|
|
1235
1235
|
};
|
|
1236
1236
|
return [
|
|
1237
1237
|
{
|
|
1238
|
-
id:
|
|
1238
|
+
id: oe[0],
|
|
1239
1239
|
type: "line",
|
|
1240
1240
|
source: f,
|
|
1241
1241
|
filter: [
|
|
@@ -1250,11 +1250,11 @@ var it = { class: "hidden" }, at = ["aria-label"], ot = ["aria-label"], st = { s
|
|
|
1250
1250
|
paint: {
|
|
1251
1251
|
"line-color": h.value.outline,
|
|
1252
1252
|
"line-width": e * .8,
|
|
1253
|
-
"line-dasharray":
|
|
1253
|
+
"line-dasharray": xe(Math.max(Q, 0))
|
|
1254
1254
|
}
|
|
1255
1255
|
},
|
|
1256
1256
|
{
|
|
1257
|
-
id:
|
|
1257
|
+
id: oe[1],
|
|
1258
1258
|
type: "line",
|
|
1259
1259
|
source: f,
|
|
1260
1260
|
filter: [
|
|
@@ -1269,7 +1269,7 @@ var it = { class: "hidden" }, at = ["aria-label"], ot = ["aria-label"], st = { s
|
|
|
1269
1269
|
}
|
|
1270
1270
|
},
|
|
1271
1271
|
{
|
|
1272
|
-
id:
|
|
1272
|
+
id: oe[2],
|
|
1273
1273
|
type: "line",
|
|
1274
1274
|
source: f,
|
|
1275
1275
|
filter: [
|
|
@@ -1279,72 +1279,72 @@ var it = { class: "hidden" }, at = ["aria-label"], ot = ["aria-label"], st = { s
|
|
|
1279
1279
|
],
|
|
1280
1280
|
layout: t,
|
|
1281
1281
|
paint: {
|
|
1282
|
-
"line-color":
|
|
1282
|
+
"line-color": ee.value,
|
|
1283
1283
|
"line-width": e
|
|
1284
1284
|
}
|
|
1285
1285
|
}
|
|
1286
1286
|
];
|
|
1287
1287
|
}
|
|
1288
|
-
function
|
|
1289
|
-
if (
|
|
1290
|
-
|
|
1288
|
+
function fe() {
|
|
1289
|
+
if (H) {
|
|
1290
|
+
H.getSource(f) || H.addSource(f, {
|
|
1291
1291
|
type: "geojson",
|
|
1292
|
-
data: le(
|
|
1292
|
+
data: le(A),
|
|
1293
1293
|
tolerance: 0
|
|
1294
1294
|
});
|
|
1295
|
-
for (let e of
|
|
1295
|
+
for (let e of de()) H.getLayer(e.id) && H.removeLayer(e.id), H.addLayer(e, a.before && H.getLayer(a.before) ? a.before : void 0);
|
|
1296
1296
|
}
|
|
1297
1297
|
}
|
|
1298
|
-
let
|
|
1299
|
-
function
|
|
1300
|
-
if (n || !
|
|
1301
|
-
let r =
|
|
1298
|
+
let pe = -1, me = null;
|
|
1299
|
+
function he(e, t, n) {
|
|
1300
|
+
if (n || !H || pe < 0 || !me) return e !== pe || pe < 0;
|
|
1301
|
+
let r = H.project(t), i = H.project(me);
|
|
1302
1302
|
return Math.hypot(r.x - i.x, r.y - i.y) >= 2;
|
|
1303
1303
|
}
|
|
1304
1304
|
function ge(e, t = !0) {
|
|
1305
|
-
|
|
1306
|
-
let { lngLat: n } =
|
|
1307
|
-
if (
|
|
1308
|
-
let t =
|
|
1309
|
-
t && (t.setData(le(e)),
|
|
1305
|
+
A = e;
|
|
1306
|
+
let { lngLat: n } = $e(_.value, y.value, e), r = Oe(e);
|
|
1307
|
+
if (he(e, n, t)) {
|
|
1308
|
+
let t = H?.getSource(f);
|
|
1309
|
+
t && (t.setData(le(e)), pe = e, me = n);
|
|
1310
1310
|
}
|
|
1311
|
-
W?.setLngLat(n), ke.value && W?.setRotation(r), R = r, l.vehicle && (L.value = r), r > 200 && r < 340 ?
|
|
1311
|
+
W?.setLngLat(n), ke.value && W?.setRotation(r), R = r, l.vehicle && (L.value = r), r > 200 && r < 340 ? ye.value = !0 : r > 20 && r < 160 && (ye.value = !1), a.follow && H?.jumpTo({ center: n }), ve(e) !== ve(I.value) && (I.value = e);
|
|
1312
1312
|
}
|
|
1313
|
-
let
|
|
1314
|
-
function
|
|
1313
|
+
let ve = (e) => x.value.filter((t) => e >= t - 1).length, ye = G(!1), be = 1.6;
|
|
1314
|
+
function xe(e) {
|
|
1315
1315
|
let t = 2.6, n = e / 16 * t;
|
|
1316
|
-
return n <=
|
|
1316
|
+
return n <= be ? [
|
|
1317
1317
|
0,
|
|
1318
1318
|
n,
|
|
1319
1319
|
1,
|
|
1320
|
-
|
|
1320
|
+
be - n
|
|
1321
1321
|
] : [
|
|
1322
|
-
n -
|
|
1323
|
-
|
|
1322
|
+
n - be,
|
|
1323
|
+
be,
|
|
1324
1324
|
t - n,
|
|
1325
1325
|
0
|
|
1326
1326
|
];
|
|
1327
1327
|
}
|
|
1328
|
-
let
|
|
1328
|
+
let Se = 0, Ce = 0, Q = -1;
|
|
1329
1329
|
function we(e) {
|
|
1330
|
-
let t = 2.6 * a.width * .8, n = Math.floor((e -
|
|
1331
|
-
n !==
|
|
1330
|
+
let t = 2.6 * a.width * .8, n = Math.floor((e - Ce) / 1e3 * 16 / t * 16) % 16;
|
|
1331
|
+
n !== Q && H?.getLayer(oe[0]) && (Q = n, H.setPaintProperty(oe[0], "line-dasharray", xe(n))), Se = requestAnimationFrame(we);
|
|
1332
1332
|
}
|
|
1333
1333
|
let Te = !0, $;
|
|
1334
1334
|
function Ee() {
|
|
1335
|
-
!$ &&
|
|
1335
|
+
!$ && H && typeof IntersectionObserver < "u" && ($ = new IntersectionObserver(([e]) => {
|
|
1336
1336
|
let t = !!e?.isIntersecting;
|
|
1337
1337
|
t !== Te && (Te = t, De());
|
|
1338
|
-
}), $.observe(
|
|
1338
|
+
}), $.observe(H.getContainer()));
|
|
1339
1339
|
}
|
|
1340
1340
|
function De() {
|
|
1341
|
-
cancelAnimationFrame(
|
|
1341
|
+
cancelAnimationFrame(Se), Q = -1, Ee(), (Te || !a.flow) && (a.flow && H && !s() ? (Ce = performance.now(), Se = requestAnimationFrame(we)) : H?.getLayer(oe[0]) && H.setPaintProperty(oe[0], "line-dasharray", xe(0)));
|
|
1342
1342
|
}
|
|
1343
1343
|
function Oe(e) {
|
|
1344
|
-
let t =
|
|
1345
|
-
return t[0] === n[0] && t[1] === n[1] ?
|
|
1344
|
+
let t = $e(_.value, y.value, Math.max(e - 10, 0)).lngLat, n = $e(_.value, y.value, Math.min(e + 25, b.value)).lngLat;
|
|
1345
|
+
return t[0] === n[0] && t[1] === n[1] ? $e(_.value, y.value, e).bearing : Ze(t, n);
|
|
1346
1346
|
}
|
|
1347
|
-
let ke =
|
|
1347
|
+
let ke = O(() => a.rotateVehicle ?? (a.vehicleIcon === "navigation" && !l.vehicle)), Ae = 0, je = 0;
|
|
1348
1348
|
function Me() {
|
|
1349
1349
|
if (s()) return 0;
|
|
1350
1350
|
if (a.duration !== "auto") return a.duration;
|
|
@@ -1353,7 +1353,7 @@ var it = { class: "hidden" }, at = ["aria-label"], ot = ["aria-label"], st = { s
|
|
|
1353
1353
|
}
|
|
1354
1354
|
function Ne(e) {
|
|
1355
1355
|
cancelAnimationFrame(z);
|
|
1356
|
-
let t =
|
|
1356
|
+
let t = A, n = Me();
|
|
1357
1357
|
if (n <= 0 || t === e) {
|
|
1358
1358
|
ge(e), I.value = e, Ie();
|
|
1359
1359
|
return;
|
|
@@ -1364,108 +1364,108 @@ var it = { class: "hidden" }, at = ["aria-label"], ot = ["aria-label"], st = { s
|
|
|
1364
1364
|
};
|
|
1365
1365
|
z = requestAnimationFrame(i);
|
|
1366
1366
|
}
|
|
1367
|
-
let
|
|
1367
|
+
let Pe = !1;
|
|
1368
1368
|
function Ie() {
|
|
1369
|
-
let e = b.value > 0 &&
|
|
1370
|
-
e && !
|
|
1369
|
+
let e = b.value > 0 && A >= b.value - 1;
|
|
1370
|
+
e && !Pe && o("arrive"), Pe = e;
|
|
1371
1371
|
}
|
|
1372
1372
|
function Le() {
|
|
1373
|
-
!
|
|
1373
|
+
!H || _.value.length < 2 || H.fitBounds(it(_.value), {
|
|
1374
1374
|
padding: a.padding,
|
|
1375
1375
|
duration: s() ? 0 : 600
|
|
1376
1376
|
});
|
|
1377
1377
|
}
|
|
1378
|
-
let Re =
|
|
1378
|
+
let Re = O(() => a.showVehicle && w.value != null);
|
|
1379
1379
|
p((e, t) => {
|
|
1380
|
-
|
|
1381
|
-
element:
|
|
1380
|
+
H = e, A = w.value ?? 0, I.value = A, fe(), ie.value && (W = new t.Marker({
|
|
1381
|
+
element: ie.value,
|
|
1382
1382
|
rotationAlignment: ke.value ? "map" : "viewport",
|
|
1383
1383
|
subpixelPositioning: !0
|
|
1384
|
-
}), Re.value && W.setLngLat(
|
|
1385
|
-
}),
|
|
1384
|
+
}), Re.value && W.setLngLat($e(_.value, y.value, A).lngLat).addTo(e)), ge(A), Pe = b.value > 0 && A >= b.value - 1, a.fit && Le(), De();
|
|
1385
|
+
}), X(() => a.flow, De), X(m, () => fe()), X(ke, (e) => {
|
|
1386
1386
|
W?.setRotationAlignment(e ? "map" : "viewport"), W?.setRotation(e ? R : 0);
|
|
1387
|
-
}),
|
|
1388
|
-
e == null ? Ae = je = 0 :
|
|
1389
|
-
}),
|
|
1390
|
-
|
|
1391
|
-
}),
|
|
1392
|
-
S = null,
|
|
1393
|
-
}),
|
|
1394
|
-
|
|
1387
|
+
}), X(w, (e) => {
|
|
1388
|
+
e == null ? Ae = je = 0 : H && Ne(e);
|
|
1389
|
+
}), X(Re, (e) => {
|
|
1390
|
+
H && W && (e ? W.setLngLat($e(_.value, y.value, A).lngLat).addTo(H) : W.remove());
|
|
1391
|
+
}), X(v, () => {
|
|
1392
|
+
S = null, pe = -1, w.value = C(), H && (A = Math.min(w.value ?? 0, b.value), I.value = A, ge(A), a.fit && Le());
|
|
1393
|
+
}), X(() => [
|
|
1394
|
+
ee.value,
|
|
1395
1395
|
h.value.outline,
|
|
1396
1396
|
h.value.surface,
|
|
1397
1397
|
a.width,
|
|
1398
1398
|
a.before
|
|
1399
|
-
], () =>
|
|
1400
|
-
if (E?.abort(), cancelAnimationFrame(
|
|
1401
|
-
for (let e of
|
|
1402
|
-
|
|
1399
|
+
], () => fe()), ne(() => {
|
|
1400
|
+
if (E?.abort(), cancelAnimationFrame(Se), $?.disconnect(), cancelAnimationFrame(z), W?.remove(), H) {
|
|
1401
|
+
for (let e of oe) H.getLayer(e) && H.removeLayer(e);
|
|
1402
|
+
H.getSource(f) && H.removeSource(f);
|
|
1403
1403
|
}
|
|
1404
|
-
|
|
1404
|
+
H = void 0;
|
|
1405
1405
|
});
|
|
1406
|
-
let ze = (e, t) => e.icon ?? (t === a.stops.length - 1 ? "flag" : t === 0 ? "trip_origin" : void 0), Be = (e, t) => e.label ?? `${
|
|
1406
|
+
let ze = (e, t) => e.icon ?? (t === a.stops.length - 1 ? "flag" : t === 0 ? "trip_origin" : void 0), Be = (e, t) => e.label ?? `${u.mapRouteStop} ${t + 1}`;
|
|
1407
1407
|
return r({
|
|
1408
1408
|
fit: Le,
|
|
1409
1409
|
length: b,
|
|
1410
1410
|
travelled: I,
|
|
1411
1411
|
sourceId: f
|
|
1412
|
-
}), (r, i) => (
|
|
1412
|
+
}), (r, i) => (U(), j("div", at, [(U(!0), j(T, null, K(n.stops, (i, a) => (U(), k(Fe, {
|
|
1413
1413
|
key: a,
|
|
1414
1414
|
"lng-lat": i.lngLat,
|
|
1415
1415
|
onClick: (e) => o("stop-click", i, a)
|
|
1416
|
-
},
|
|
1417
|
-
default:
|
|
1416
|
+
}, N({
|
|
1417
|
+
default: Z(() => [q(r.$slots, "stop", {
|
|
1418
1418
|
stop: i,
|
|
1419
1419
|
index: a,
|
|
1420
|
-
done:
|
|
1421
|
-
}, () => [
|
|
1420
|
+
done: B(a)
|
|
1421
|
+
}, () => [ue((U(), j("span", {
|
|
1422
1422
|
role: "img",
|
|
1423
1423
|
"aria-label": Be(i, a),
|
|
1424
|
-
class:
|
|
1425
|
-
style: te(n.color ?
|
|
1424
|
+
class: V(["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", B(a) ? "border-transparent bg-primary text-on-primary" : "border-primary bg-surface text-primary"]),
|
|
1425
|
+
style: te(n.color ? B(a) ? { background: n.color } : {
|
|
1426
1426
|
borderColor: n.color,
|
|
1427
1427
|
color: n.color
|
|
1428
1428
|
} : void 0)
|
|
1429
|
-
}, [ze(i, a) ? (
|
|
1429
|
+
}, [ze(i, a) ? (U(), k(e, {
|
|
1430
1430
|
key: 0,
|
|
1431
1431
|
name: ze(i, a),
|
|
1432
1432
|
size: 16
|
|
1433
|
-
}, null, 8, ["name"])) : (
|
|
1433
|
+
}, null, 8, ["name"])) : (U(), j(T, { key: 1 }, [P(J(a), 1)], 64))], 14, ot)), [[Y(t), Be(i, a)]])])]),
|
|
1434
1434
|
_: 2
|
|
1435
1435
|
}, [r.$slots["stop-popup"] ? {
|
|
1436
1436
|
name: "popup",
|
|
1437
|
-
fn:
|
|
1437
|
+
fn: Z(() => [q(r.$slots, "stop-popup", {
|
|
1438
1438
|
stop: i,
|
|
1439
1439
|
index: a,
|
|
1440
|
-
done:
|
|
1440
|
+
done: B(a)
|
|
1441
1441
|
})]),
|
|
1442
1442
|
key: "0"
|
|
1443
|
-
} : void 0]), 1032, ["lng-lat", "onClick"]))), 128)),
|
|
1443
|
+
} : void 0]), 1032, ["lng-lat", "onClick"]))), 128)), M("div", {
|
|
1444
1444
|
ref_key: "vehicleEl",
|
|
1445
|
-
ref:
|
|
1445
|
+
ref: ie,
|
|
1446
1446
|
class: "m3-map-route-vehicle",
|
|
1447
|
-
"aria-label":
|
|
1447
|
+
"aria-label": Y(u).mapRouteVehicle,
|
|
1448
1448
|
role: "img"
|
|
1449
|
-
}, [
|
|
1449
|
+
}, [M("div", ct, [q(r.$slots, "vehicle", {
|
|
1450
1450
|
bearing: L.value,
|
|
1451
|
-
west:
|
|
1452
|
-
}, () => [
|
|
1451
|
+
west: ye.value
|
|
1452
|
+
}, () => [M("span", {
|
|
1453
1453
|
class: "flex h-10 w-10 items-center justify-center rounded-full border-2 border-surface bg-primary text-on-primary shadow-elevation-2",
|
|
1454
1454
|
style: te(n.color ? { background: n.color } : void 0)
|
|
1455
|
-
}, [
|
|
1455
|
+
}, [F(e, {
|
|
1456
1456
|
name: n.vehicleIcon,
|
|
1457
1457
|
size: 22,
|
|
1458
1458
|
filled: n.vehicleIcon === "navigation",
|
|
1459
|
-
style: te(!ke.value &&
|
|
1459
|
+
style: te(!ke.value && ye.value ? { transform: "scaleX(-1)" } : void 0)
|
|
1460
1460
|
}, null, 8, [
|
|
1461
1461
|
"name",
|
|
1462
1462
|
"filled",
|
|
1463
1463
|
"style"
|
|
1464
|
-
])], 4)])])], 8,
|
|
1464
|
+
])], 4)])])], 8, st)]));
|
|
1465
1465
|
}
|
|
1466
1466
|
});
|
|
1467
1467
|
// src/composables/mapRouting.ts
|
|
1468
|
-
function
|
|
1468
|
+
function ut(e = {}) {
|
|
1469
1469
|
let t = (e.url ?? "https://router.project-osrm.org").replace(/\/$/, ""), n = e.profile ?? "driving";
|
|
1470
1470
|
return async (r, { signal: i }) => {
|
|
1471
1471
|
if (r.length < 2) return {
|
|
@@ -1489,19 +1489,19 @@ function lt(e = {}) {
|
|
|
1489
1489
|
};
|
|
1490
1490
|
}
|
|
1491
1491
|
// src/components/_MMapLayerItem.vue?vue&type=script&setup=true&lang.ts
|
|
1492
|
-
var
|
|
1492
|
+
var dt = { class: "flex min-w-0 flex-1 flex-col" }, ft = ["aria-label", "aria-pressed"], pt = { class: "flex min-w-0 flex-1 flex-col" }, mt = {
|
|
1493
1493
|
key: 0,
|
|
1494
1494
|
class: "truncate text-label-small text-on-surface-variant"
|
|
1495
|
-
},
|
|
1495
|
+
}, ht = {
|
|
1496
1496
|
key: 0,
|
|
1497
1497
|
class: "rounded-full bg-primary/8 px-2 py-0.5 text-label-small tabular-nums text-primary"
|
|
1498
|
-
},
|
|
1498
|
+
}, gt = { class: "min-h-0 overflow-hidden" }, _t = { class: "flex flex-col gap-3 px-3 pb-3" }, vt = {
|
|
1499
1499
|
key: 0,
|
|
1500
1500
|
class: "text-body-small text-on-surface-variant"
|
|
1501
|
-
},
|
|
1501
|
+
}, yt = { class: "flex items-center gap-2 rounded-2xl bg-surface-container-highest/60 px-3 py-1" }, bt = ["src"], xt = {
|
|
1502
1502
|
key: 2,
|
|
1503
1503
|
class: "flex flex-wrap items-center gap-2"
|
|
1504
|
-
},
|
|
1504
|
+
}, St = ["href"], Ct = /* @__PURE__ */ I({
|
|
1505
1505
|
__name: "_MMapLayerItem",
|
|
1506
1506
|
props: {
|
|
1507
1507
|
layer: {},
|
|
@@ -1509,80 +1509,80 @@ var ut = { class: "flex min-w-0 flex-1 flex-col" }, dt = ["aria-label", "aria-pr
|
|
|
1509
1509
|
},
|
|
1510
1510
|
emits: ["toggle-expanded"],
|
|
1511
1511
|
setup(t, { emit: n }) {
|
|
1512
|
-
let r = n, i = c(), { isVisible: a, toggle: o, opacityOf: s, setOpacity: l } =
|
|
1513
|
-
return (n, c) => (
|
|
1512
|
+
let r = n, i = c(), { isVisible: a, toggle: o, opacityOf: s, setOpacity: l } = $();
|
|
1513
|
+
return (n, c) => (U(), j("div", { class: V(["flex overflow-hidden rounded-2xl bg-surface-container", Y(a)(t.layer.id) ? "" : "opacity-75"]) }, [M("div", { class: V(["w-1 shrink-0 transition-colors duration-200", Y(a)(t.layer.id) ? "bg-primary" : "bg-outline-variant"]) }, null, 2), M("div", dt, [M("div", {
|
|
1514
1514
|
class: "flex cursor-pointer items-center gap-2 px-3 py-2",
|
|
1515
1515
|
onClick: c[1] ||= (e) => r("toggle-expanded")
|
|
1516
1516
|
}, [
|
|
1517
|
-
|
|
1517
|
+
M("button", {
|
|
1518
1518
|
type: "button",
|
|
1519
|
-
class:
|
|
1520
|
-
"aria-label":
|
|
1521
|
-
"aria-pressed":
|
|
1522
|
-
onClick: c[0] ||=
|
|
1523
|
-
}, [
|
|
1524
|
-
name:
|
|
1519
|
+
class: V(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", Y(a)(t.layer.id) ? "bg-primary/12 text-primary" : "bg-on-surface/5 text-on-surface-variant"]),
|
|
1520
|
+
"aria-label": Y(a)(t.layer.id) ? Y(i).mapHideLayer : Y(i).mapShowLayer,
|
|
1521
|
+
"aria-pressed": Y(a)(t.layer.id),
|
|
1522
|
+
onClick: c[0] ||= de((e) => Y(o)(t.layer.id), ["stop"])
|
|
1523
|
+
}, [F(e, {
|
|
1524
|
+
name: Y(a)(t.layer.id) ? "visibility" : "visibility_off",
|
|
1525
1525
|
size: 18
|
|
1526
|
-
}, null, 8, ["name"])], 10,
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1526
|
+
}, null, 8, ["name"])], 10, ft),
|
|
1527
|
+
M("div", pt, [M("span", { class: V(["truncate text-body-medium", Y(a)(t.layer.id) ? "text-on-surface" : "text-on-surface-variant"]) }, J(t.layer.title), 3), t.layer.description && !t.expanded ? (U(), j("span", mt, J(t.layer.description), 1)) : A("", !0)]),
|
|
1528
|
+
Y(a)(t.layer.id) && Y(s)(t.layer.id) < 1 ? (U(), j("span", ht, J(Math.round(Y(s)(t.layer.id) * 100)) + "% ", 1)) : A("", !0),
|
|
1529
|
+
F(e, {
|
|
1530
1530
|
name: "expand_more",
|
|
1531
1531
|
size: 18,
|
|
1532
|
-
class:
|
|
1532
|
+
class: V(["shrink-0 text-on-surface-variant transition-transform duration-300", t.expanded ? "rotate-180" : ""])
|
|
1533
1533
|
}, null, 8, ["class"])
|
|
1534
|
-
]),
|
|
1534
|
+
]), M("div", {
|
|
1535
1535
|
class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
1536
1536
|
style: te({ gridTemplateRows: t.expanded ? "1fr" : "0fr" })
|
|
1537
|
-
}, [
|
|
1538
|
-
t.layer.description ? (
|
|
1539
|
-
|
|
1537
|
+
}, [M("div", gt, [M("div", _t, [
|
|
1538
|
+
t.layer.description ? (U(), j("p", vt, J(t.layer.description), 1)) : A("", !0),
|
|
1539
|
+
M("div", yt, [F(e, {
|
|
1540
1540
|
name: "opacity",
|
|
1541
1541
|
size: 16,
|
|
1542
1542
|
class: "shrink-0 text-on-surface-variant"
|
|
1543
|
-
}),
|
|
1544
|
-
"model-value":
|
|
1543
|
+
}), F(p, {
|
|
1544
|
+
"model-value": Y(s)(t.layer.id),
|
|
1545
1545
|
min: 0,
|
|
1546
1546
|
max: 1,
|
|
1547
1547
|
step: .01,
|
|
1548
|
-
label:
|
|
1548
|
+
label: Y(i).mapOpacity,
|
|
1549
1549
|
class: "flex-1",
|
|
1550
|
-
"onUpdate:modelValue": c[2] ||= (e) =>
|
|
1550
|
+
"onUpdate:modelValue": c[2] ||= (e) => Y(l)(t.layer.id, Number(e))
|
|
1551
1551
|
}, null, 8, ["model-value", "label"])]),
|
|
1552
|
-
t.layer.legend ? (
|
|
1552
|
+
t.layer.legend ? (U(), j("img", {
|
|
1553
1553
|
key: 1,
|
|
1554
1554
|
src: t.layer.legend,
|
|
1555
1555
|
alt: "",
|
|
1556
1556
|
class: "max-w-full self-start",
|
|
1557
1557
|
loading: "lazy"
|
|
1558
|
-
}, null, 8,
|
|
1559
|
-
t.layer.download || n.$slots.actions ? (
|
|
1558
|
+
}, null, 8, bt)) : A("", !0),
|
|
1559
|
+
t.layer.download || n.$slots.actions ? (U(), j("div", xt, [t.layer.download ? (U(), j("a", {
|
|
1560
1560
|
key: 0,
|
|
1561
1561
|
href: t.layer.download,
|
|
1562
1562
|
target: "_blank",
|
|
1563
1563
|
rel: "noopener",
|
|
1564
1564
|
download: "",
|
|
1565
1565
|
class: "inline-flex items-center gap-1 rounded-full px-3 py-1.5 text-label-large text-primary hover:bg-primary/8"
|
|
1566
|
-
}, [
|
|
1566
|
+
}, [F(e, {
|
|
1567
1567
|
name: "download",
|
|
1568
1568
|
size: 18
|
|
1569
|
-
}),
|
|
1569
|
+
}), P(" " + J(Y(i).mapDownload), 1)], 8, St)) : A("", !0), q(n.$slots, "actions", {
|
|
1570
1570
|
layer: t.layer,
|
|
1571
|
-
visible:
|
|
1572
|
-
})])) :
|
|
1571
|
+
visible: Y(a)(t.layer.id)
|
|
1572
|
+
})])) : A("", !0)
|
|
1573
1573
|
])])], 4)])], 2));
|
|
1574
1574
|
}
|
|
1575
|
-
}),
|
|
1575
|
+
}), wt = { class: "flex flex-col gap-3" }, Tt = ["onClick"], Et = [
|
|
1576
1576
|
"aria-label",
|
|
1577
1577
|
"aria-pressed",
|
|
1578
1578
|
"onClick"
|
|
1579
|
-
],
|
|
1579
|
+
], Dt = { class: "flex-1 select-none truncate text-label-large text-on-surface" }, Ot = { class: "rounded-full bg-surface-container-highest px-2 py-0.5 text-label-small tabular-nums text-on-surface-variant" }, kt = {
|
|
1580
1580
|
key: 1,
|
|
1581
1581
|
class: "flex flex-col gap-1.5"
|
|
1582
|
-
},
|
|
1582
|
+
}, At = {
|
|
1583
1583
|
key: 2,
|
|
1584
1584
|
class: "flex flex-col items-center gap-3 py-8"
|
|
1585
|
-
},
|
|
1585
|
+
}, jt = { class: "grid size-14 place-items-center rounded-full bg-surface-container-highest" }, Mt = { class: "text-body-medium text-on-surface-variant" }, Nt = /* @__PURE__ */ I({
|
|
1586
1586
|
__name: "MMapLayers",
|
|
1587
1587
|
props: {
|
|
1588
1588
|
search: {
|
|
@@ -1596,11 +1596,11 @@ var ut = { class: "flex min-w-0 flex-1 flex-col" }, dt = ["aria-label", "aria-pr
|
|
|
1596
1596
|
map: {}
|
|
1597
1597
|
},
|
|
1598
1598
|
setup(t) {
|
|
1599
|
-
let n = t, r = c(), { model: i, layersOf: a, isVisible: o, groupState: s, setGroupVisible: l } =
|
|
1599
|
+
let n = t, r = c(), { model: i, layersOf: a, isVisible: o, groupState: s, setGroupVisible: l } = $(() => n.map), u = G(""), d = (e) => !u.value || e.title.toLowerCase().includes(u.value.toLowerCase()), p = O(() => (i.value?.groups ?? []).map((e) => ({
|
|
1600
1600
|
...e,
|
|
1601
1601
|
all: a(e.name),
|
|
1602
|
-
layers: a(e.name).filter(
|
|
1603
|
-
})).filter((e) => e.layers.length)), m =
|
|
1602
|
+
layers: a(e.name).filter(d)
|
|
1603
|
+
})).filter((e) => e.layers.length)), m = O(() => a(null).filter(d)), h = G(/* @__PURE__ */ new Set()), g = (e) => h.value.has(e) === n.collapsed;
|
|
1604
1604
|
function _(e) {
|
|
1605
1605
|
let t = new Set(h.value);
|
|
1606
1606
|
t.delete(e) || t.add(e), h.value = t;
|
|
@@ -1611,83 +1611,83 @@ var ut = { class: "flex min-w-0 flex-1 flex-col" }, dt = ["aria-label", "aria-pr
|
|
|
1611
1611
|
t.delete(e) || t.add(e), v.value = t;
|
|
1612
1612
|
}
|
|
1613
1613
|
let b = (e) => e.filter((e) => o(e.id)).length;
|
|
1614
|
-
return (n, i) => (
|
|
1615
|
-
t.search ? (
|
|
1614
|
+
return (n, i) => (U(), j("div", wt, [
|
|
1615
|
+
t.search ? (U(), k(f, {
|
|
1616
1616
|
key: 0,
|
|
1617
1617
|
modelValue: u.value,
|
|
1618
1618
|
"onUpdate:modelValue": i[0] ||= (e) => u.value = e,
|
|
1619
|
-
label:
|
|
1619
|
+
label: Y(r).mapSearchLayers,
|
|
1620
1620
|
"leading-icon": "search",
|
|
1621
1621
|
variant: "outlined",
|
|
1622
1622
|
clearable: ""
|
|
1623
|
-
}, null, 8, ["modelValue", "label"])) :
|
|
1624
|
-
(
|
|
1623
|
+
}, null, 8, ["modelValue", "label"])) : A("", !0),
|
|
1624
|
+
(U(!0), j(T, null, K(p.value, (t) => (U(), j("section", {
|
|
1625
1625
|
key: t.name,
|
|
1626
1626
|
class: "flex flex-col"
|
|
1627
|
-
}, [
|
|
1627
|
+
}, [M("div", {
|
|
1628
1628
|
class: "m3-map-layers-row flex cursor-pointer items-center gap-2 rounded-xl px-2 py-1.5",
|
|
1629
1629
|
onClick: (e) => _(t.name)
|
|
1630
1630
|
}, [
|
|
1631
|
-
|
|
1631
|
+
M("button", {
|
|
1632
1632
|
type: "button",
|
|
1633
|
-
class:
|
|
1634
|
-
"aria-label":
|
|
1635
|
-
"aria-pressed":
|
|
1636
|
-
onClick:
|
|
1637
|
-
}, [
|
|
1638
|
-
name:
|
|
1633
|
+
class: V(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", Y(s)(t.name) === "visible" ? "bg-primary-container text-on-primary-container" : Y(s)(t.name) === "partial" ? "bg-secondary-container text-on-secondary-container" : "bg-on-surface/8 text-on-surface-variant"]),
|
|
1634
|
+
"aria-label": Y(s)(t.name) === "hidden" ? Y(r).mapShowLayer : Y(r).mapHideLayer,
|
|
1635
|
+
"aria-pressed": Y(s)(t.name) !== "hidden",
|
|
1636
|
+
onClick: de((e) => Y(l)(t.name, Y(s)(t.name) !== "visible"), ["stop"])
|
|
1637
|
+
}, [F(e, {
|
|
1638
|
+
name: Y(s)(t.name) === "hidden" ? "visibility_off" : "visibility",
|
|
1639
1639
|
size: 18
|
|
1640
|
-
}, null, 8, ["name"])], 10,
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1640
|
+
}, null, 8, ["name"])], 10, Et),
|
|
1641
|
+
M("span", Dt, J(t.title), 1),
|
|
1642
|
+
M("span", Ot, J(b(t.all)) + "/" + J(t.all.length), 1),
|
|
1643
|
+
F(e, {
|
|
1644
1644
|
name: "expand_more",
|
|
1645
1645
|
size: 18,
|
|
1646
|
-
class:
|
|
1646
|
+
class: V(["text-on-surface-variant transition-transform duration-300", g(t.name) ? "rotate-180" : ""])
|
|
1647
1647
|
}, null, 8, ["class"])
|
|
1648
|
-
], 8,
|
|
1648
|
+
], 8, Tt), M("div", {
|
|
1649
1649
|
class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
1650
1650
|
style: te({ gridTemplateRows: g(t.name) ? "1fr" : "0fr" })
|
|
1651
|
-
}, [
|
|
1651
|
+
}, [M("div", { class: V(["flex min-h-0 flex-col gap-1.5 overflow-hidden", g(t.name) ? "pt-1.5" : ""]) }, [(U(!0), j(T, null, K(t.layers, (e) => (U(), k(Ct, {
|
|
1652
1652
|
key: e.id,
|
|
1653
1653
|
layer: e,
|
|
1654
1654
|
expanded: v.value.has(e.id),
|
|
1655
1655
|
onToggleExpanded: (t) => y(e.id)
|
|
1656
|
-
},
|
|
1656
|
+
}, N({ _: 2 }, [n.$slots.actions ? {
|
|
1657
1657
|
name: "actions",
|
|
1658
|
-
fn:
|
|
1658
|
+
fn: Z((e) => [q(n.$slots, "actions", B({ ref_for: !0 }, e))]),
|
|
1659
1659
|
key: "0"
|
|
1660
1660
|
} : void 0]), 1032, [
|
|
1661
1661
|
"layer",
|
|
1662
1662
|
"expanded",
|
|
1663
1663
|
"onToggleExpanded"
|
|
1664
1664
|
]))), 128))], 2)], 4)]))), 128)),
|
|
1665
|
-
m.value.length ? (
|
|
1665
|
+
m.value.length ? (U(), j("div", kt, [(U(!0), j(T, null, K(m.value, (e) => (U(), k(Ct, {
|
|
1666
1666
|
key: e.id,
|
|
1667
1667
|
layer: e,
|
|
1668
1668
|
expanded: v.value.has(e.id),
|
|
1669
1669
|
onToggleExpanded: (t) => y(e.id)
|
|
1670
|
-
},
|
|
1670
|
+
}, N({ _: 2 }, [n.$slots.actions ? {
|
|
1671
1671
|
name: "actions",
|
|
1672
|
-
fn:
|
|
1672
|
+
fn: Z((e) => [q(n.$slots, "actions", B({ ref_for: !0 }, e))]),
|
|
1673
1673
|
key: "0"
|
|
1674
1674
|
} : void 0]), 1032, [
|
|
1675
1675
|
"layer",
|
|
1676
1676
|
"expanded",
|
|
1677
1677
|
"onToggleExpanded"
|
|
1678
|
-
]))), 128))])) :
|
|
1679
|
-
!p.value.length && !m.value.length ? (
|
|
1678
|
+
]))), 128))])) : A("", !0),
|
|
1679
|
+
!p.value.length && !m.value.length ? (U(), j("div", At, [M("div", jt, [F(e, {
|
|
1680
1680
|
name: "layers_clear",
|
|
1681
1681
|
size: 28,
|
|
1682
1682
|
class: "text-on-surface-variant"
|
|
1683
|
-
})]),
|
|
1683
|
+
})]), M("p", Mt, J(Y(r).mapNoLayers), 1)])) : A("", !0)
|
|
1684
1684
|
]));
|
|
1685
1685
|
}
|
|
1686
|
-
}),
|
|
1686
|
+
}), Pt = [
|
|
1687
1687
|
"aria-label",
|
|
1688
1688
|
"aria-checked",
|
|
1689
1689
|
"onClick"
|
|
1690
|
-
],
|
|
1690
|
+
], Ft = ["src"], It = ["aria-label", "aria-checked"], Lt = /* @__PURE__ */ I({
|
|
1691
1691
|
__name: "MMapBaseLayers",
|
|
1692
1692
|
props: {
|
|
1693
1693
|
imageBase: { default: "" },
|
|
@@ -1702,101 +1702,101 @@ var ut = { class: "flex min-w-0 flex-1 flex-col" }, dt = ["aria-label", "aria-pr
|
|
|
1702
1702
|
map: {}
|
|
1703
1703
|
},
|
|
1704
1704
|
setup(t) {
|
|
1705
|
-
let n = t, r = c(), { baseLayers: i, baseLayer: a, setBaseLayer: o } =
|
|
1706
|
-
return (n, c) => (
|
|
1707
|
-
class:
|
|
1705
|
+
let n = t, r = c(), { baseLayers: i, baseLayer: a, setBaseLayer: o } = $(() => n.map), s = (e, t) => /^(https?:|data:|\/\/)/.test(e) ? e : `${t}${e}`;
|
|
1706
|
+
return (n, c) => (U(), j("div", {
|
|
1707
|
+
class: V(["flex gap-2", t.vertical ? "flex-col" : "flex-row flex-wrap"]),
|
|
1708
1708
|
role: "radiogroup"
|
|
1709
|
-
}, [(
|
|
1709
|
+
}, [(U(!0), j(T, null, K(Y(i), (n) => (U(), k(m, {
|
|
1710
1710
|
key: n.id,
|
|
1711
1711
|
text: n.title,
|
|
1712
1712
|
placement: t.vertical ? "right" : "top"
|
|
1713
1713
|
}, {
|
|
1714
|
-
default:
|
|
1714
|
+
default: Z(() => [M("button", {
|
|
1715
1715
|
type: "button",
|
|
1716
1716
|
role: "radio",
|
|
1717
|
-
class:
|
|
1717
|
+
class: V(["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", Y(a) === n.id ? "m3-map-base--active border-primary" : "border-transparent"]),
|
|
1718
1718
|
"aria-label": n.title,
|
|
1719
|
-
"aria-checked":
|
|
1720
|
-
onClick: (e) =>
|
|
1721
|
-
}, [n.base?.image ? (
|
|
1719
|
+
"aria-checked": Y(a) === n.id,
|
|
1720
|
+
onClick: (e) => Y(o)(n.id)
|
|
1721
|
+
}, [n.base?.image ? (U(), j("img", {
|
|
1722
1722
|
key: 0,
|
|
1723
1723
|
src: s(n.base.image, t.imageBase),
|
|
1724
1724
|
alt: "",
|
|
1725
1725
|
class: "size-full object-cover"
|
|
1726
|
-
}, null, 8,
|
|
1726
|
+
}, null, 8, Ft)) : (U(), k(e, {
|
|
1727
1727
|
key: 1,
|
|
1728
1728
|
name: "map",
|
|
1729
1729
|
size: 22,
|
|
1730
1730
|
class: "text-on-surface-variant"
|
|
1731
|
-
}))], 10,
|
|
1731
|
+
}))], 10, Pt)]),
|
|
1732
1732
|
_: 2
|
|
1733
|
-
}, 1032, ["text", "placement"]))), 128)), t.none ? (
|
|
1733
|
+
}, 1032, ["text", "placement"]))), 128)), t.none ? (U(), k(m, {
|
|
1734
1734
|
key: 0,
|
|
1735
|
-
text:
|
|
1735
|
+
text: Y(r).mapNoBaseLayer,
|
|
1736
1736
|
placement: t.vertical ? "right" : "top"
|
|
1737
1737
|
}, {
|
|
1738
|
-
default:
|
|
1738
|
+
default: Z(() => [M("button", {
|
|
1739
1739
|
type: "button",
|
|
1740
1740
|
role: "radio",
|
|
1741
|
-
class:
|
|
1742
|
-
"aria-label":
|
|
1743
|
-
"aria-checked":
|
|
1744
|
-
onClick: c[0] ||= (e) =>
|
|
1745
|
-
}, [
|
|
1741
|
+
class: V(["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", Y(a) === null ? "m3-map-base--active border-primary" : "border-transparent"]),
|
|
1742
|
+
"aria-label": Y(r).mapNoBaseLayer,
|
|
1743
|
+
"aria-checked": Y(a) === null,
|
|
1744
|
+
onClick: c[0] ||= (e) => Y(o)(null)
|
|
1745
|
+
}, [F(e, {
|
|
1746
1746
|
name: "layers_clear",
|
|
1747
1747
|
size: 22,
|
|
1748
1748
|
class: "text-on-surface-variant"
|
|
1749
|
-
})], 10,
|
|
1749
|
+
})], 10, It)]),
|
|
1750
1750
|
_: 1
|
|
1751
|
-
}, 8, ["text", "placement"])) :
|
|
1751
|
+
}, 8, ["text", "placement"])) : A("", !0)], 2));
|
|
1752
1752
|
}
|
|
1753
|
-
}),
|
|
1753
|
+
}), Rt = { class: "flex flex-col gap-2" }, zt = { class: "flex items-center gap-2 bg-primary-container/40 px-4 py-2" }, Bt = { class: "text-label-large text-on-primary-container" }, Vt = { class: "flex flex-col px-4 py-1" }, Ht = { class: "text-label-small text-on-surface-variant" }, Ut = { class: "text-body-medium text-on-surface" }, Wt = {
|
|
1754
1754
|
key: 0,
|
|
1755
1755
|
class: "break-words"
|
|
1756
|
-
},
|
|
1756
|
+
}, Gt = {
|
|
1757
1757
|
key: 1,
|
|
1758
1758
|
class: "text-body-small italic text-on-surface-variant"
|
|
1759
|
-
},
|
|
1759
|
+
}, Kt = /* @__PURE__ */ I({
|
|
1760
1760
|
__name: "MMapFeatureInfo",
|
|
1761
1761
|
props: { results: {} },
|
|
1762
1762
|
setup(t) {
|
|
1763
1763
|
let n = c();
|
|
1764
|
-
return (r, i) => (
|
|
1764
|
+
return (r, i) => (U(), j("div", Rt, [(U(!0), j(T, null, K(t.results, (t, i) => (U(), j("div", {
|
|
1765
1765
|
key: i,
|
|
1766
1766
|
class: "overflow-hidden rounded-2xl bg-surface-container"
|
|
1767
|
-
}, [
|
|
1767
|
+
}, [M("div", zt, [F(e, {
|
|
1768
1768
|
name: "layers",
|
|
1769
1769
|
size: 16,
|
|
1770
1770
|
class: "text-on-primary-container"
|
|
1771
|
-
}),
|
|
1771
|
+
}), M("span", Bt, J(t.layer.title), 1)]), M("dl", Vt, [(U(!0), j(T, null, K(t.fields, (e) => (U(), j("div", {
|
|
1772
1772
|
key: e.key,
|
|
1773
1773
|
class: "flex flex-col gap-0.5 border-b border-outline-variant py-1.5 last:border-b-0"
|
|
1774
|
-
}, [
|
|
1774
|
+
}, [M("dt", Ht, J(e.label), 1), M("dd", Ut, [q(r.$slots, "value", {
|
|
1775
1775
|
field: e,
|
|
1776
1776
|
result: t
|
|
1777
|
-
}, () => [e.value ? (
|
|
1777
|
+
}, () => [e.value ? (U(), j("span", Wt, J(e.value), 1)) : (U(), j("span", Gt, J(Y(n).mapNoValue), 1))])])]))), 128))])]))), 128))]));
|
|
1778
1778
|
}
|
|
1779
|
-
}),
|
|
1779
|
+
}), qt = (e) => e.metadata, Jt = /* @__PURE__ */ new Set([
|
|
1780
1780
|
"fill",
|
|
1781
1781
|
"line",
|
|
1782
1782
|
"circle",
|
|
1783
1783
|
"symbol",
|
|
1784
1784
|
"fill-extrusion",
|
|
1785
1785
|
"heatmap"
|
|
1786
|
-
]),
|
|
1787
|
-
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(
|
|
1786
|
+
]), Yt = (e) => {
|
|
1787
|
+
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(qt(e)) ? r(qt(e)) : []));
|
|
1788
1788
|
return {
|
|
1789
1789
|
title: e.name,
|
|
1790
1790
|
groups: [],
|
|
1791
1791
|
layers: t.map((e) => {
|
|
1792
|
-
let t =
|
|
1792
|
+
let t = qt(e), a = n(t);
|
|
1793
1793
|
return {
|
|
1794
1794
|
id: e.id,
|
|
1795
1795
|
title: t?.title ?? e.id,
|
|
1796
1796
|
listed: !a && !i.has(e.id) && t?.listed !== !1,
|
|
1797
1797
|
base: a ? { image: t.base.image ?? t.image } : void 0,
|
|
1798
1798
|
children: r(t),
|
|
1799
|
-
identify:
|
|
1799
|
+
identify: Jt.has(e.type) && !a && !i.has(e.id) ? {
|
|
1800
1800
|
format: {},
|
|
1801
1801
|
exclude: []
|
|
1802
1802
|
} : !1,
|
|
@@ -1805,9 +1805,9 @@ var ut = { class: "flex min-w-0 flex-1 flex-col" }, dt = ["aria-label", "aria-pr
|
|
|
1805
1805
|
})
|
|
1806
1806
|
};
|
|
1807
1807
|
};
|
|
1808
|
-
function
|
|
1808
|
+
function Xt(e = {}) {
|
|
1809
1809
|
let t = e.legend ?? ((e, t) => {
|
|
1810
|
-
let n =
|
|
1810
|
+
let n = qt(e)?.legend;
|
|
1811
1811
|
if (n?.show === !1) return;
|
|
1812
1812
|
if (n?.wmslegend) return n.wmslegend;
|
|
1813
1813
|
if (!t?.includes("/services/styles/")) return;
|
|
@@ -1823,7 +1823,7 @@ function Yt(e = {}) {
|
|
|
1823
1823
|
title: e.alias ?? e.name
|
|
1824
1824
|
})),
|
|
1825
1825
|
layers: e.layers.filter((e) => e.type !== "background").map((e) => {
|
|
1826
|
-
let r =
|
|
1826
|
+
let r = qt(e) ?? {}, i = { ...r.fields }, a = i.exclude ?? [];
|
|
1827
1827
|
delete i.exclude;
|
|
1828
1828
|
let o = {};
|
|
1829
1829
|
for (let [e, t] of Object.entries(i)) o[e] = {
|
|
@@ -1860,10 +1860,10 @@ function Yt(e = {}) {
|
|
|
1860
1860
|
};
|
|
1861
1861
|
};
|
|
1862
1862
|
}
|
|
1863
|
-
function
|
|
1863
|
+
function Zt(e, t) {
|
|
1864
1864
|
return t?.label ?? e.charAt(0).toUpperCase() + e.slice(1);
|
|
1865
1865
|
}
|
|
1866
|
-
function
|
|
1866
|
+
function Qt(e, t) {
|
|
1867
1867
|
if (e == null || String(e).trim() === "") return "";
|
|
1868
1868
|
let n = String(e), r = typeof e == "number" ? e : Number(e);
|
|
1869
1869
|
if (t?.mask && !Number.isNaN(r)) {
|
|
@@ -1876,23 +1876,23 @@ function Zt(e, t) {
|
|
|
1876
1876
|
}
|
|
1877
1877
|
return t?.prefix && (n = `${t.prefix} ${n}`), t?.suffix && (n = `${n} ${t.suffix}`), n;
|
|
1878
1878
|
}
|
|
1879
|
-
var
|
|
1879
|
+
var $t = /* @__PURE__ */ new Set([
|
|
1880
1880
|
"coordinates",
|
|
1881
1881
|
"mapCoordinates",
|
|
1882
1882
|
"layerId",
|
|
1883
1883
|
"__layerMetadata"
|
|
1884
1884
|
]);
|
|
1885
|
-
function
|
|
1885
|
+
function en(e, t, n) {
|
|
1886
1886
|
let r = new Map((n?.layers ?? []).filter((t) => t.identify && e.getLayer(t.id)).map((e) => [e.id, e]));
|
|
1887
1887
|
if (!r.size) return [];
|
|
1888
1888
|
let i = [];
|
|
1889
1889
|
for (let n of e.queryRenderedFeatures(t, { layers: [...r.keys()] })) {
|
|
1890
1890
|
let e = r.get(n.layer.id);
|
|
1891
1891
|
if (!e || !e.identify) continue;
|
|
1892
|
-
let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) =>
|
|
1892
|
+
let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !$t.has(e) && !a.includes(e) && !t[e]?.hidden).map(([e, n]) => ({
|
|
1893
1893
|
key: e,
|
|
1894
|
-
label:
|
|
1895
|
-
value:
|
|
1894
|
+
label: Zt(e, t[e]),
|
|
1895
|
+
value: Qt(n, t[e])
|
|
1896
1896
|
}));
|
|
1897
1897
|
o.length && i.push({
|
|
1898
1898
|
layer: e,
|
|
@@ -1903,7 +1903,7 @@ function $t(e, t, n) {
|
|
|
1903
1903
|
return i;
|
|
1904
1904
|
}
|
|
1905
1905
|
// src/components/MMapIdentify.vue?vue&type=script&setup=true&lang.ts
|
|
1906
|
-
var
|
|
1906
|
+
var tn = { class: "hidden" }, nn = /* @__PURE__ */ I({
|
|
1907
1907
|
inheritAttrs: !1,
|
|
1908
1908
|
__name: "MMapIdentify",
|
|
1909
1909
|
props: {
|
|
@@ -1922,16 +1922,16 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
1922
1922
|
},
|
|
1923
1923
|
emits: ["identify"],
|
|
1924
1924
|
setup(e, { expose: t, emit: n }) {
|
|
1925
|
-
let r = e, i = n, { on: a, onReady: o, activeTool: s } =
|
|
1925
|
+
let r = e, i = n, { on: a, onReady: o, activeTool: s } = _e(), { model: c } = $(), l = ae([]), u = G([0, 0]), d = G(!1);
|
|
1926
1926
|
a("click", (e) => {
|
|
1927
1927
|
if (!r.enabled || s.value) return;
|
|
1928
1928
|
let t = e.target;
|
|
1929
|
-
l.value =
|
|
1929
|
+
l.value = en(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);
|
|
1930
1930
|
});
|
|
1931
1931
|
function f() {
|
|
1932
1932
|
d.value = !1;
|
|
1933
1933
|
}
|
|
1934
|
-
|
|
1934
|
+
X(() => r.enabled, (e) => {
|
|
1935
1935
|
e || f();
|
|
1936
1936
|
});
|
|
1937
1937
|
let p, m = [], h = () => {
|
|
@@ -1948,34 +1948,34 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
1948
1948
|
}
|
|
1949
1949
|
return o((e) => {
|
|
1950
1950
|
p = e, _();
|
|
1951
|
-
}),
|
|
1951
|
+
}), X(c, _), ne(() => {
|
|
1952
1952
|
m.forEach((e) => {
|
|
1953
1953
|
p?.off("mouseenter", e, h), p?.off("mouseleave", e, g);
|
|
1954
1954
|
});
|
|
1955
|
-
}), t({ close: f }), (t, n) => (
|
|
1955
|
+
}), t({ close: f }), (t, n) => (U(), j("div", tn, [e.marker && d.value ? (U(), k(Fe, {
|
|
1956
1956
|
key: 0,
|
|
1957
1957
|
"lng-lat": u.value
|
|
1958
|
-
}, null, 8, ["lng-lat"])) :
|
|
1958
|
+
}, null, 8, ["lng-lat"])) : A("", !0), e.popup && l.value.length ? (U(), k(Le, {
|
|
1959
1959
|
key: 1,
|
|
1960
1960
|
open: d.value,
|
|
1961
1961
|
"onUpdate:open": n[0] ||= (e) => d.value = e,
|
|
1962
1962
|
"lng-lat": u.value,
|
|
1963
1963
|
"max-width": "360px",
|
|
1964
|
-
offset: e.marker ?
|
|
1964
|
+
offset: e.marker ? Y(Ne) : void 0
|
|
1965
1965
|
}, {
|
|
1966
|
-
default:
|
|
1966
|
+
default: Z(() => [M("div", B({ class: "max-h-80 overflow-y-auto" }, t.$attrs), [q(t.$slots, "default", {
|
|
1967
1967
|
results: l.value,
|
|
1968
1968
|
lngLat: u.value,
|
|
1969
1969
|
close: f
|
|
1970
|
-
}, () => [
|
|
1970
|
+
}, () => [F(Kt, { results: l.value }, null, 8, ["results"])])], 16)]),
|
|
1971
1971
|
_: 3
|
|
1972
1972
|
}, 8, [
|
|
1973
1973
|
"open",
|
|
1974
1974
|
"lng-lat",
|
|
1975
1975
|
"offset"
|
|
1976
|
-
])) :
|
|
1976
|
+
])) : A("", !0)]));
|
|
1977
1977
|
}
|
|
1978
|
-
}),
|
|
1978
|
+
}), rn = { class: "hidden" }, an = ["aria-label", "aria-pressed"], on = { class: "-mx-4 -mt-3 mb-1 bg-primary-container px-3 py-1.5 text-label-medium text-on-primary-container" }, sn = { class: "flex flex-col" }, cn = { class: "text-label-small text-on-surface-variant" }, ln = { class: "text-body-small text-on-surface" }, un = /* @__PURE__ */ I({
|
|
1979
1979
|
__name: "MMapHover",
|
|
1980
1980
|
props: {
|
|
1981
1981
|
modelValue: {
|
|
@@ -1989,7 +1989,7 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
1989
1989
|
},
|
|
1990
1990
|
emits: ["update:modelValue"],
|
|
1991
1991
|
setup(n, { emit: r }) {
|
|
1992
|
-
let i = n, a = r, o = c(), { onReady: s } =
|
|
1992
|
+
let i = n, a = r, o = c(), { onReady: s } = _e(), { model: l } = $(), u = O(() => (l.value?.layers ?? []).filter((e) => e.hover && e.hover.fields.length)), d = ae(null), f = G([0, 0]), p = G(!1), m, h = [];
|
|
1993
1993
|
function g(e) {
|
|
1994
1994
|
let t = e.features?.[0], n = u.value.find((e) => e.id === t?.layer.id);
|
|
1995
1995
|
if (!t || !n || !n.hover) return;
|
|
@@ -1998,8 +1998,8 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
1998
1998
|
layer: n,
|
|
1999
1999
|
fields: n.hover.fields.map((e) => ({
|
|
2000
2000
|
key: e.key,
|
|
2001
|
-
label:
|
|
2002
|
-
value:
|
|
2001
|
+
label: Zt(e.key, e),
|
|
2002
|
+
value: Qt(r[e.key], e)
|
|
2003
2003
|
})).filter((e) => e.value)
|
|
2004
2004
|
}, f.value = [e.lngLat.lng, e.lngLat.lat], p.value = !0;
|
|
2005
2005
|
}
|
|
@@ -2016,26 +2016,26 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2016
2016
|
}
|
|
2017
2017
|
s((e) => {
|
|
2018
2018
|
m = e, v();
|
|
2019
|
-
}),
|
|
2019
|
+
}), X([() => i.modelValue, u], v), ne(() => {
|
|
2020
2020
|
for (let e of h) m?.off("mousemove", e, g), m?.off("mouseleave", e, _);
|
|
2021
2021
|
});
|
|
2022
|
-
let y =
|
|
2023
|
-
return (r, i) => (
|
|
2022
|
+
let y = O(() => i.control === !0 ? "top-right" : i.control || "top-right");
|
|
2023
|
+
return (r, i) => (U(), j("div", rn, [n.control && u.value.length ? (U(), k(be, {
|
|
2024
2024
|
key: 0,
|
|
2025
2025
|
position: y.value
|
|
2026
2026
|
}, {
|
|
2027
|
-
default:
|
|
2027
|
+
default: Z(() => [ue((U(), j("button", {
|
|
2028
2028
|
type: "button",
|
|
2029
2029
|
class: "grid place-items-center",
|
|
2030
|
-
"aria-label":
|
|
2030
|
+
"aria-label": Y(o).mapHoverInfo,
|
|
2031
2031
|
"aria-pressed": n.modelValue,
|
|
2032
2032
|
onClick: i[0] ||= (e) => a("update:modelValue", !n.modelValue)
|
|
2033
|
-
}, [
|
|
2033
|
+
}, [F(e, {
|
|
2034
2034
|
name: "ads_click",
|
|
2035
2035
|
size: 20
|
|
2036
|
-
})], 8,
|
|
2036
|
+
})], 8, an)), [[Y(t), Y(o).mapHoverInfo]])]),
|
|
2037
2037
|
_: 1
|
|
2038
|
-
}, 8, ["position"])) :
|
|
2038
|
+
}, 8, ["position"])) : A("", !0), d.value ? (U(), k(Le, {
|
|
2039
2039
|
key: 1,
|
|
2040
2040
|
open: p.value,
|
|
2041
2041
|
"onUpdate:open": i[1] ||= (e) => p.value = e,
|
|
@@ -2046,14 +2046,14 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2046
2046
|
"max-width": "280px",
|
|
2047
2047
|
class: "m3-map-hover"
|
|
2048
2048
|
}, {
|
|
2049
|
-
default:
|
|
2049
|
+
default: Z(() => [M("p", on, J(d.value.layer.title), 1), M("dl", sn, [(U(!0), j(T, null, K(d.value.fields, (e) => (U(), j("div", {
|
|
2050
2050
|
key: e.key,
|
|
2051
2051
|
class: "border-b border-outline-variant py-1 last:border-b-0"
|
|
2052
|
-
}, [
|
|
2052
|
+
}, [M("dt", cn, J(e.label), 1), M("dd", ln, J(e.value), 1)]))), 128))])]),
|
|
2053
2053
|
_: 1
|
|
2054
|
-
}, 8, ["open", "lng-lat"])) :
|
|
2054
|
+
}, 8, ["open", "lng-lat"])) : A("", !0)]));
|
|
2055
2055
|
}
|
|
2056
|
-
}),
|
|
2056
|
+
}), dn = { class: "hidden" }, fn = ["title", "aria-pressed"], pn = ["title", "aria-pressed"], mn = ["title", "disabled"], hn = ["aria-label", "onClick"], gn = /* @__PURE__ */ I({
|
|
2057
2057
|
__name: "MMapMeasure",
|
|
2058
2058
|
props: {
|
|
2059
2059
|
modelValue: { default: null },
|
|
@@ -2064,14 +2064,14 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2064
2064
|
},
|
|
2065
2065
|
emits: ["update:modelValue", "change"],
|
|
2066
2066
|
setup(n, { expose: r, emit: i }) {
|
|
2067
|
-
let a = n, o = i, s = c(), { onReady: l, styleVersion:
|
|
2067
|
+
let a = n, o = i, s = c(), { onReady: l, styleVersion: u, activeTool: f } = _e(), p = d(["primary", "surface"]), m = `m3-measure-${se()}`, h = {
|
|
2068
2068
|
done: `${m}-done`,
|
|
2069
2069
|
draft: `${m}-draft`,
|
|
2070
2070
|
handles: `${m}-handles`
|
|
2071
|
-
}, _ = `${
|
|
2071
|
+
}, _ = `${h.handles}-vertex`, v = `${h.handles}-midpoint`, y = [], b = [], x = null, S = !1, C = null, w = 0, E, D = G(null), N = G(0), I = ae([]), L = () => typeof document < "u" && document.documentElement.lang || void 0, R = (e, t) => new Intl.NumberFormat(L(), {
|
|
2072
2072
|
minimumFractionDigits: t,
|
|
2073
2073
|
maximumFractionDigits: t
|
|
2074
|
-
}).format(e), z = (e) => e === 0 ? "" : e < 1e3 ? `${R(Math.round(e), 0)} m` : `${R(e / 1e3, 2)} km`,
|
|
2074
|
+
}).format(e), z = (e) => e === 0 ? "" : e < 1e3 ? `${R(Math.round(e), 0)} m` : `${R(e / 1e3, 2)} km`, B = (e) => e >= 1e6 ? `${R(e / 1e6, 2)} km²` : e >= 1e4 ? `${R(e / 1e4, 2)} ha` : `${R(Math.round(e), 0)} m²`, ee = (e, t = {}) => ({
|
|
2075
2075
|
type: "Feature",
|
|
2076
2076
|
geometry: {
|
|
2077
2077
|
type: "Point",
|
|
@@ -2079,8 +2079,8 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2079
2079
|
},
|
|
2080
2080
|
properties: t
|
|
2081
2081
|
});
|
|
2082
|
-
function
|
|
2083
|
-
let i = e.map((e) =>
|
|
2082
|
+
function te(e, t, n, r) {
|
|
2083
|
+
let i = e.map((e) => ee(e)), a = [];
|
|
2084
2084
|
if (e.length < 2) return {
|
|
2085
2085
|
features: i,
|
|
2086
2086
|
labels: a
|
|
@@ -2095,10 +2095,10 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2095
2095
|
});
|
|
2096
2096
|
let o = (e) => {
|
|
2097
2097
|
for (let t = 0; t < e.length - 1; t++) {
|
|
2098
|
-
let r = z(
|
|
2098
|
+
let r = z(Ue(e[t], e[t + 1]));
|
|
2099
2099
|
r && a.push({
|
|
2100
2100
|
key: `${n}-s${t}`,
|
|
2101
|
-
at:
|
|
2101
|
+
at: Ge(e[t], e[t + 1]),
|
|
2102
2102
|
text: r,
|
|
2103
2103
|
kind: "segment"
|
|
2104
2104
|
});
|
|
@@ -2107,12 +2107,12 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2107
2107
|
if (t === "distance") o(e), a.push({
|
|
2108
2108
|
key: `${n}-t`,
|
|
2109
2109
|
at: e[e.length - 1],
|
|
2110
|
-
text: `${s.mapTotal}: ${z(
|
|
2110
|
+
text: `${s.mapTotal}: ${z(We(e))}`,
|
|
2111
2111
|
kind: "total",
|
|
2112
2112
|
m: r
|
|
2113
2113
|
});
|
|
2114
2114
|
else if (e.length >= 3) {
|
|
2115
|
-
let t =
|
|
2115
|
+
let t = qe(e);
|
|
2116
2116
|
i.push({
|
|
2117
2117
|
type: "Feature",
|
|
2118
2118
|
geometry: {
|
|
@@ -2122,15 +2122,15 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2122
2122
|
properties: {}
|
|
2123
2123
|
}), o(t), a.push({
|
|
2124
2124
|
key: `${n}-a`,
|
|
2125
|
-
at:
|
|
2126
|
-
text:
|
|
2125
|
+
at: Je(t),
|
|
2126
|
+
text: B(Ke(t)),
|
|
2127
2127
|
kind: "area",
|
|
2128
2128
|
m: r
|
|
2129
2129
|
});
|
|
2130
2130
|
} else a.push({
|
|
2131
2131
|
key: `${n}-t`,
|
|
2132
2132
|
at: e[e.length - 1],
|
|
2133
|
-
text: z(
|
|
2133
|
+
text: z(We(e)),
|
|
2134
2134
|
kind: "total",
|
|
2135
2135
|
m: r
|
|
2136
2136
|
});
|
|
@@ -2142,38 +2142,38 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2142
2142
|
let re = (e) => ({
|
|
2143
2143
|
type: "FeatureCollection",
|
|
2144
2144
|
features: e
|
|
2145
|
-
}),
|
|
2145
|
+
}), H = (e, t) => (E?.getSource(e))?.setData(re(t));
|
|
2146
2146
|
function W() {
|
|
2147
2147
|
if (!E) return;
|
|
2148
|
-
let e = y.map((e, t) =>
|
|
2148
|
+
let e = y.map((e, t) => te(e.points, e.mode, `m${t}`, t)), t = D.value && b.length ? te(x ? [...b, x] : b, D.value, "draft") : {
|
|
2149
2149
|
features: [],
|
|
2150
2150
|
labels: []
|
|
2151
2151
|
};
|
|
2152
|
-
|
|
2152
|
+
H(h.done, e.flatMap((e) => e.features)), H(h.draft, t.features);
|
|
2153
2153
|
let n = [];
|
|
2154
|
-
|
|
2155
|
-
(e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(
|
|
2154
|
+
D.value || y.forEach((e, t) => {
|
|
2155
|
+
(e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(ee(e, {
|
|
2156
2156
|
handle: "vertex",
|
|
2157
2157
|
m: t,
|
|
2158
2158
|
v: r
|
|
2159
2159
|
})));
|
|
2160
|
-
for (let r = 0; r < e.points.length - 1; r++) n.push(
|
|
2160
|
+
for (let r = 0; r < e.points.length - 1; r++) n.push(ee(Ge(e.points[r], e.points[r + 1]), {
|
|
2161
2161
|
handle: "midpoint",
|
|
2162
2162
|
m: t,
|
|
2163
2163
|
after: r
|
|
2164
2164
|
}));
|
|
2165
|
-
}),
|
|
2165
|
+
}), H(h.handles, n), I.value = [...e.flatMap((e) => e.labels), ...t.labels];
|
|
2166
2166
|
}
|
|
2167
|
-
function
|
|
2168
|
-
|
|
2167
|
+
function ie() {
|
|
2168
|
+
N.value = y.length, o("change", y.map((e) => ({
|
|
2169
2169
|
mode: e.mode,
|
|
2170
2170
|
points: e.points.map((e) => [...e]),
|
|
2171
2171
|
closed: e.closed,
|
|
2172
|
-
length:
|
|
2173
|
-
...e.mode === "area" || e.closed ? { area:
|
|
2172
|
+
length: We(e.points),
|
|
2173
|
+
...e.mode === "area" || e.closed ? { area: Ke(e.points) } : {}
|
|
2174
2174
|
})));
|
|
2175
2175
|
}
|
|
2176
|
-
let
|
|
2176
|
+
let q = (e) => [
|
|
2177
2177
|
"==",
|
|
2178
2178
|
["geometry-type"],
|
|
2179
2179
|
e
|
|
@@ -2189,20 +2189,20 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2189
2189
|
}
|
|
2190
2190
|
};
|
|
2191
2191
|
}
|
|
2192
|
-
function
|
|
2192
|
+
function ce() {
|
|
2193
2193
|
if (!E) return;
|
|
2194
|
-
for (let e of Object.values(
|
|
2194
|
+
for (let e of Object.values(h)) E.getSource(e) || E.addSource(e, {
|
|
2195
2195
|
type: "geojson",
|
|
2196
2196
|
data: re([])
|
|
2197
2197
|
});
|
|
2198
2198
|
let e = oe(), t = (e) => {
|
|
2199
2199
|
E.getLayer(e.id) || E.addLayer(e);
|
|
2200
2200
|
};
|
|
2201
|
-
for (let [n, r] of [[
|
|
2201
|
+
for (let [n, r] of [[h.done, !1], [h.draft, !0]]) t({
|
|
2202
2202
|
id: `${n}-fill`,
|
|
2203
2203
|
type: "fill",
|
|
2204
2204
|
source: n,
|
|
2205
|
-
filter:
|
|
2205
|
+
filter: q("Polygon"),
|
|
2206
2206
|
paint: {
|
|
2207
2207
|
...e.fill,
|
|
2208
2208
|
"fill-opacity": r ? .15 : .2
|
|
@@ -2225,7 +2225,7 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2225
2225
|
id: `${n}-points`,
|
|
2226
2226
|
type: "circle",
|
|
2227
2227
|
source: n,
|
|
2228
|
-
filter:
|
|
2228
|
+
filter: q("Point"),
|
|
2229
2229
|
paint: {
|
|
2230
2230
|
...e.vertices,
|
|
2231
2231
|
"circle-radius": 5,
|
|
@@ -2235,7 +2235,7 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2235
2235
|
t({
|
|
2236
2236
|
id: v,
|
|
2237
2237
|
type: "circle",
|
|
2238
|
-
source:
|
|
2238
|
+
source: h.handles,
|
|
2239
2239
|
filter: [
|
|
2240
2240
|
"==",
|
|
2241
2241
|
["get", "handle"],
|
|
@@ -2250,7 +2250,7 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2250
2250
|
}), t({
|
|
2251
2251
|
id: _,
|
|
2252
2252
|
type: "circle",
|
|
2253
|
-
source:
|
|
2253
|
+
source: h.handles,
|
|
2254
2254
|
filter: [
|
|
2255
2255
|
"==",
|
|
2256
2256
|
["get", "handle"],
|
|
@@ -2263,86 +2263,86 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2263
2263
|
}
|
|
2264
2264
|
});
|
|
2265
2265
|
}
|
|
2266
|
-
|
|
2266
|
+
X(p, () => {
|
|
2267
2267
|
if (!E) return;
|
|
2268
2268
|
let e = oe(), t = (e, t) => {
|
|
2269
2269
|
if (E.getLayer(e)) for (let [n, r] of Object.entries(t)) E.setPaintProperty(e, n, r);
|
|
2270
2270
|
};
|
|
2271
|
-
for (let n of [
|
|
2271
|
+
for (let n of [h.done, h.draft]) t(`${n}-fill`, e.fill), t(`${n}-line`, e.line), t(`${n}-points`, e.vertices);
|
|
2272
2272
|
t(v, e.vertices), t(_, e.vertices);
|
|
2273
2273
|
});
|
|
2274
|
-
let
|
|
2275
|
-
function
|
|
2274
|
+
let le = (e) => [e.lngLat.lng, e.lngLat.lat];
|
|
2275
|
+
function fe(e) {
|
|
2276
2276
|
if (b.length >= 2) {
|
|
2277
2277
|
let t = E.project(b[0]);
|
|
2278
2278
|
if (Math.hypot(t.x - e.point.x, t.y - e.point.y) < 20) {
|
|
2279
|
-
S = !0,
|
|
2279
|
+
S = !0, Q();
|
|
2280
2280
|
return;
|
|
2281
2281
|
}
|
|
2282
2282
|
}
|
|
2283
|
-
b.push(
|
|
2283
|
+
b.push(le(e)), W();
|
|
2284
2284
|
}
|
|
2285
|
-
function
|
|
2286
|
-
x =
|
|
2287
|
-
|
|
2285
|
+
function pe(e) {
|
|
2286
|
+
x = le(e), w ||= requestAnimationFrame(() => {
|
|
2287
|
+
w = 0, W();
|
|
2288
2288
|
});
|
|
2289
2289
|
}
|
|
2290
|
-
function
|
|
2290
|
+
function me(e) {
|
|
2291
2291
|
if (e.preventDefault(), b.length < 2) return;
|
|
2292
2292
|
let t = E.project(b[b.length - 1]), n = E.project(b[b.length - 2]);
|
|
2293
|
-
Math.hypot(t.x - n.x, t.y - n.y) < 10 && b.pop(),
|
|
2293
|
+
Math.hypot(t.x - n.x, t.y - n.y) < 10 && b.pop(), Q();
|
|
2294
2294
|
}
|
|
2295
|
-
function
|
|
2296
|
-
e.key === "Enter" &&
|
|
2295
|
+
function he(e) {
|
|
2296
|
+
e.key === "Enter" && Q();
|
|
2297
2297
|
}
|
|
2298
|
-
|
|
2299
|
-
let ge = () => typeof navigator < "u" ? navigator.keyboard : void 0,
|
|
2298
|
+
g(() => !!D.value, () => Q(!0));
|
|
2299
|
+
let ge = () => typeof navigator < "u" ? navigator.keyboard : void 0, ve = !1;
|
|
2300
2300
|
function ye() {
|
|
2301
|
-
|
|
2302
|
-
|
|
2301
|
+
D.value && document.fullscreenElement && ge()?.lock && ge().lock(["Escape"]).then(() => {
|
|
2302
|
+
ve = !0;
|
|
2303
2303
|
}, () => {});
|
|
2304
2304
|
}
|
|
2305
|
-
function be() {
|
|
2306
|
-
M.value || (_e && ge()?.unlock?.(), _e = !1);
|
|
2307
|
-
}
|
|
2308
2305
|
function xe() {
|
|
2306
|
+
D.value || (ve && ge()?.unlock?.(), ve = !1);
|
|
2307
|
+
}
|
|
2308
|
+
function Se() {
|
|
2309
2309
|
let e, t = () => {
|
|
2310
|
-
document.removeEventListener("keyup", n, !0), clearTimeout(e), setTimeout(
|
|
2310
|
+
document.removeEventListener("keyup", n, !0), clearTimeout(e), setTimeout(xe);
|
|
2311
2311
|
}, n = (e) => {
|
|
2312
2312
|
e.key === "Escape" && t();
|
|
2313
2313
|
};
|
|
2314
2314
|
document.addEventListener("keyup", n, !0), e = setTimeout(t, 1500);
|
|
2315
2315
|
}
|
|
2316
|
-
function
|
|
2316
|
+
function Ce(e) {
|
|
2317
2317
|
if (E) {
|
|
2318
|
-
if (
|
|
2319
|
-
|
|
2318
|
+
if (D.value === e) return Q();
|
|
2319
|
+
D.value && Q(), D.value = e, f.value = "measure", b = [], x = null, E.getCanvas().style.cursor = "crosshair", E.doubleClickZoom.disable(), E.on("click", fe), E.on("mousemove", pe), E.on("dblclick", me), document.addEventListener("keydown", he), document.addEventListener("fullscreenchange", ye), ye(), W(), a.modelValue !== e && o("update:modelValue", e);
|
|
2320
2320
|
}
|
|
2321
2321
|
}
|
|
2322
|
-
function
|
|
2323
|
-
if (!E || !
|
|
2324
|
-
cancelAnimationFrame(
|
|
2325
|
-
let t = b.length >= 3 && (S ||
|
|
2322
|
+
function Q(e = !1) {
|
|
2323
|
+
if (!E || !D.value) return;
|
|
2324
|
+
cancelAnimationFrame(w), w = 0;
|
|
2325
|
+
let t = b.length >= 3 && (S || D.value === "area");
|
|
2326
2326
|
b.length >= 2 && y.push({
|
|
2327
|
-
mode:
|
|
2327
|
+
mode: D.value,
|
|
2328
2328
|
points: t ? [...b, [...b[0]]] : b,
|
|
2329
2329
|
closed: t
|
|
2330
|
-
}), b = [], x = null, S = !1,
|
|
2330
|
+
}), b = [], x = null, S = !1, D.value = null, f.value === "measure" && (f.value = null), E.getCanvas().style.cursor = "", E.doubleClickZoom.enable(), E.off("click", fe), E.off("mousemove", pe), E.off("dblclick", me), document.removeEventListener("keydown", he), document.removeEventListener("fullscreenchange", ye), e && ve ? Se() : xe(), W(), ie(), a.modelValue !== null && o("update:modelValue", null);
|
|
2331
2331
|
}
|
|
2332
2332
|
function we(e) {
|
|
2333
|
-
y[e] && (y.splice(e, 1), W(),
|
|
2333
|
+
y[e] && (y.splice(e, 1), W(), ie());
|
|
2334
2334
|
}
|
|
2335
2335
|
function Te() {
|
|
2336
|
-
|
|
2336
|
+
D.value && Q(), y.length = 0, W(), ie();
|
|
2337
2337
|
}
|
|
2338
2338
|
function $(e) {
|
|
2339
2339
|
let t = e.features?.[0];
|
|
2340
|
-
if (!t ||
|
|
2340
|
+
if (!t || D.value || !E) return;
|
|
2341
2341
|
e.preventDefault();
|
|
2342
2342
|
let n = t.properties.m, r = y[n];
|
|
2343
2343
|
if (!r) return;
|
|
2344
2344
|
let i = t.properties.v;
|
|
2345
|
-
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0,
|
|
2345
|
+
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0, le(e))), C = {
|
|
2346
2346
|
m: n,
|
|
2347
2347
|
v: i
|
|
2348
2348
|
}, f.value = "measure", E.getCanvas().style.cursor = "grabbing";
|
|
@@ -2353,107 +2353,107 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2353
2353
|
if (!C) return;
|
|
2354
2354
|
let t = y[C.m];
|
|
2355
2355
|
if (!t) return;
|
|
2356
|
-
let n =
|
|
2356
|
+
let n = le(e);
|
|
2357
2357
|
t.points[C.v] = n, t.closed && C.v === 0 && (t.points[t.points.length - 1] = n), W();
|
|
2358
2358
|
}
|
|
2359
2359
|
function De() {
|
|
2360
|
-
E && (C = null, E.off("mousemove", Ee), E.off("touchmove", Ee), E.dragPan.enable(), E.getCanvas().style.cursor = "",
|
|
2361
|
-
f.value === "measure" && !
|
|
2360
|
+
E && (C = null, E.off("mousemove", Ee), E.off("touchmove", Ee), E.dragPan.enable(), E.getCanvas().style.cursor = "", ie(), setTimeout(() => {
|
|
2361
|
+
f.value === "measure" && !D.value && (f.value = null);
|
|
2362
2362
|
}));
|
|
2363
2363
|
}
|
|
2364
2364
|
let Oe = () => {
|
|
2365
|
-
E && !C && !
|
|
2365
|
+
E && !C && !D.value && (E.getCanvas().style.cursor = "grab");
|
|
2366
2366
|
}, ke = () => {
|
|
2367
|
-
E && !C && !
|
|
2367
|
+
E && !C && !D.value && (E.getCanvas().style.cursor = "");
|
|
2368
2368
|
};
|
|
2369
2369
|
l((e) => {
|
|
2370
|
-
E = e,
|
|
2370
|
+
E = e, ce();
|
|
2371
2371
|
for (let t of [_, v]) e.on("mousedown", t, $), e.on("touchstart", t, $), e.on("mouseenter", t, Oe), e.on("mouseleave", t, ke);
|
|
2372
|
-
a.modelValue &&
|
|
2373
|
-
}),
|
|
2374
|
-
|
|
2375
|
-
}),
|
|
2376
|
-
e && e !==
|
|
2372
|
+
a.modelValue && Ce(a.modelValue);
|
|
2373
|
+
}), X(u, () => {
|
|
2374
|
+
ce(), W();
|
|
2375
|
+
}), X(() => a.modelValue, (e) => {
|
|
2376
|
+
e && e !== D.value ? Ce(e) : !e && D.value && Q();
|
|
2377
2377
|
}), ne(() => {
|
|
2378
2378
|
if (!E) return;
|
|
2379
|
-
|
|
2379
|
+
D.value && Q();
|
|
2380
2380
|
for (let e of [_, v]) E.off("mousedown", e, $), E.off("touchstart", e, $), E.off("mouseenter", e, Oe), E.off("mouseleave", e, ke);
|
|
2381
2381
|
let e = [
|
|
2382
2382
|
_,
|
|
2383
2383
|
v,
|
|
2384
|
-
...[
|
|
2384
|
+
...[h.done, h.draft].flatMap((e) => [
|
|
2385
2385
|
`${e}-points`,
|
|
2386
2386
|
`${e}-line`,
|
|
2387
2387
|
`${e}-fill`
|
|
2388
2388
|
])
|
|
2389
2389
|
];
|
|
2390
2390
|
for (let t of e) E.getLayer(t) && E.removeLayer(t);
|
|
2391
|
-
for (let e of Object.values(
|
|
2391
|
+
for (let e of Object.values(h)) E.getSource(e) && E.removeSource(e);
|
|
2392
2392
|
});
|
|
2393
|
-
let Ae =
|
|
2393
|
+
let Ae = O(() => a.control === !0 ? "top-right" : a.control || "top-right");
|
|
2394
2394
|
return r({
|
|
2395
|
-
start:
|
|
2396
|
-
finish:
|
|
2395
|
+
start: Ce,
|
|
2396
|
+
finish: Q,
|
|
2397
2397
|
clear: Te,
|
|
2398
2398
|
remove: we
|
|
2399
|
-
}), (r, i) => (
|
|
2399
|
+
}), (r, i) => (U(), j("div", dn, [n.control ? (U(), k(be, {
|
|
2400
2400
|
key: 0,
|
|
2401
2401
|
position: Ae.value
|
|
2402
2402
|
}, {
|
|
2403
|
-
default:
|
|
2404
|
-
|
|
2403
|
+
default: Z(() => [
|
|
2404
|
+
M("button", {
|
|
2405
2405
|
type: "button",
|
|
2406
2406
|
class: "grid place-items-center",
|
|
2407
|
-
title:
|
|
2408
|
-
"aria-pressed":
|
|
2409
|
-
onClick: i[0] ||= (e) =>
|
|
2410
|
-
}, [
|
|
2407
|
+
title: Y(s).mapMeasureDistance,
|
|
2408
|
+
"aria-pressed": D.value === "distance",
|
|
2409
|
+
onClick: i[0] ||= (e) => Ce("distance")
|
|
2410
|
+
}, [F(e, {
|
|
2411
2411
|
name: "straighten",
|
|
2412
2412
|
size: 20
|
|
2413
|
-
})], 8,
|
|
2414
|
-
|
|
2413
|
+
})], 8, fn),
|
|
2414
|
+
M("button", {
|
|
2415
2415
|
type: "button",
|
|
2416
2416
|
class: "grid place-items-center",
|
|
2417
|
-
title:
|
|
2418
|
-
"aria-pressed":
|
|
2419
|
-
onClick: i[1] ||= (e) =>
|
|
2420
|
-
}, [
|
|
2417
|
+
title: Y(s).mapMeasureArea,
|
|
2418
|
+
"aria-pressed": D.value === "area",
|
|
2419
|
+
onClick: i[1] ||= (e) => Ce("area")
|
|
2420
|
+
}, [F(e, {
|
|
2421
2421
|
name: "square_foot",
|
|
2422
2422
|
size: 20
|
|
2423
|
-
})], 8,
|
|
2424
|
-
|
|
2423
|
+
})], 8, pn),
|
|
2424
|
+
M("button", {
|
|
2425
2425
|
type: "button",
|
|
2426
2426
|
class: "grid place-items-center",
|
|
2427
|
-
title:
|
|
2428
|
-
disabled: !
|
|
2427
|
+
title: Y(s).mapClearMeasurements,
|
|
2428
|
+
disabled: !N.value && !D.value,
|
|
2429
2429
|
onClick: Te
|
|
2430
|
-
}, [
|
|
2430
|
+
}, [F(e, {
|
|
2431
2431
|
name: "delete",
|
|
2432
2432
|
size: 20
|
|
2433
|
-
})], 8,
|
|
2433
|
+
})], 8, mn)
|
|
2434
2434
|
]),
|
|
2435
2435
|
_: 1
|
|
2436
|
-
}, 8, ["position"])) :
|
|
2436
|
+
}, 8, ["position"])) : A("", !0), (U(!0), j(T, null, K(I.value, (n) => (U(), k(Fe, {
|
|
2437
2437
|
key: n.key,
|
|
2438
2438
|
"lng-lat": n.at,
|
|
2439
2439
|
anchor: n.kind === "area" ? "center" : "top",
|
|
2440
2440
|
offset: n.kind === "area" ? [0, 0] : [0, 8],
|
|
2441
2441
|
class: "pointer-events-none"
|
|
2442
2442
|
}, {
|
|
2443
|
-
default:
|
|
2443
|
+
default: Z(() => [M("span", { class: V(["flex items-center gap-1 whitespace-nowrap rounded-full py-0.5 shadow-elevation-1", [n.kind === "segment" ? "bg-surface-container-highest text-label-small text-on-surface" : "bg-primary text-label-medium text-on-primary", n.m === void 0 ? "px-2" : "pr-0.5 pl-2"]]) }, [P(J(n.text) + " ", 1), n.m === void 0 ? A("", !0) : ue((U(), j("button", {
|
|
2444
2444
|
key: 0,
|
|
2445
2445
|
type: "button",
|
|
2446
|
-
class: "pointer-events-auto grid size-5 cursor-pointer place-items-center rounded-full hover:bg-on-primary/
|
|
2447
|
-
"aria-label":
|
|
2448
|
-
onClick:
|
|
2449
|
-
onPointerdown: i[2] ||=
|
|
2450
|
-
onMousedown: i[3] ||=
|
|
2451
|
-
onTouchstart: i[4] ||=
|
|
2452
|
-
onDblclick: i[5] ||=
|
|
2453
|
-
}, [
|
|
2446
|
+
class: "pointer-events-auto grid size-5 cursor-pointer place-items-center rounded-full hover:bg-on-primary/8 focus-visible:outline-2 focus-visible:outline-on-primary",
|
|
2447
|
+
"aria-label": Y(s).mapDeleteMeasurement,
|
|
2448
|
+
onClick: de((e) => we(n.m), ["stop"]),
|
|
2449
|
+
onPointerdown: i[2] ||= de(() => {}, ["stop"]),
|
|
2450
|
+
onMousedown: i[3] ||= de(() => {}, ["stop"]),
|
|
2451
|
+
onTouchstart: i[4] ||= de(() => {}, ["stop"]),
|
|
2452
|
+
onDblclick: i[5] ||= de(() => {}, ["stop"])
|
|
2453
|
+
}, [F(e, {
|
|
2454
2454
|
name: "close",
|
|
2455
2455
|
size: 14
|
|
2456
|
-
})], 40,
|
|
2456
|
+
})], 40, hn)), [[Y(t), Y(s).mapDeleteMeasurement]])], 2)]),
|
|
2457
2457
|
_: 2
|
|
2458
2458
|
}, 1032, [
|
|
2459
2459
|
"lng-lat",
|
|
@@ -2461,11 +2461,11 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2461
2461
|
"offset"
|
|
2462
2462
|
]))), 128))]));
|
|
2463
2463
|
}
|
|
2464
|
-
}),
|
|
2464
|
+
}), _n = { class: "hidden" }, vn = [
|
|
2465
2465
|
"aria-label",
|
|
2466
2466
|
"aria-pressed",
|
|
2467
2467
|
"onClick"
|
|
2468
|
-
],
|
|
2468
|
+
], yn = ["aria-label", "disabled"], bn = "draw", xn = 6, Sn = /* @__PURE__ */ I({
|
|
2469
2469
|
__name: "MMapDraw",
|
|
2470
2470
|
props: {
|
|
2471
2471
|
modelValue: {},
|
|
@@ -2491,24 +2491,24 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2491
2491
|
"select"
|
|
2492
2492
|
],
|
|
2493
2493
|
setup(n, { expose: r, emit: i }) {
|
|
2494
|
-
let a = n, o = i, s = c(), { onReady: l, styleVersion:
|
|
2494
|
+
let a = n, o = i, s = c(), { onReady: l, styleVersion: u, activeTool: f } = _e(), p = d([
|
|
2495
2495
|
"primary",
|
|
2496
2496
|
"secondary",
|
|
2497
2497
|
"tertiary",
|
|
2498
2498
|
"surface"
|
|
2499
|
-
]), m = `m3-draw-${
|
|
2499
|
+
]), m = `m3-draw-${se()}`, h = {
|
|
2500
2500
|
shapes: `${m}-shapes`,
|
|
2501
2501
|
draft: `${m}-draft`,
|
|
2502
2502
|
handles: `${m}-handles`
|
|
2503
2503
|
}, _ = [
|
|
2504
|
-
`${
|
|
2505
|
-
`${
|
|
2506
|
-
`${
|
|
2507
|
-
], v = `${
|
|
2504
|
+
`${h.shapes}-fill`,
|
|
2505
|
+
`${h.shapes}-line`,
|
|
2506
|
+
`${h.shapes}-point`
|
|
2507
|
+
], v = `${h.handles}-vertex`, y = `${h.handles}-midpoint`, b = [], x = "", S = 1, C = [], w = null, E = null, D = 0, M, N = G(null), P = G(null), I = (e) => JSON.parse(JSON.stringify(e)), L = (e) => e === null ? void 0 : b.find((t) => t.id === e);
|
|
2508
2508
|
function R(e) {
|
|
2509
2509
|
b = I(e?.features ?? []);
|
|
2510
|
-
for (let e of b) (e.id === void 0 || e.id === null) && (e.id =
|
|
2511
|
-
|
|
2510
|
+
for (let e of b) (e.id === void 0 || e.id === null) && (e.id = Q());
|
|
2511
|
+
P.value !== null && !L(P.value) && (P.value = null);
|
|
2512
2512
|
}
|
|
2513
2513
|
function z() {
|
|
2514
2514
|
let e = {
|
|
@@ -2517,11 +2517,11 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2517
2517
|
};
|
|
2518
2518
|
x = JSON.stringify(e.features), o("update:modelValue", e);
|
|
2519
2519
|
}
|
|
2520
|
-
function
|
|
2520
|
+
function B(e) {
|
|
2521
2521
|
let t = e.geometry;
|
|
2522
2522
|
return t.type === "Point" ? [t.coordinates] : t.type === "LineString" ? t.coordinates : t.type === "Polygon" ? (t.coordinates[0] ?? []).slice(0, -1) : null;
|
|
2523
2523
|
}
|
|
2524
|
-
function
|
|
2524
|
+
function ee(e, t) {
|
|
2525
2525
|
let n = e.geometry;
|
|
2526
2526
|
if (n.type === "Point") n.coordinates = t[0];
|
|
2527
2527
|
else if (n.type === "LineString") n.coordinates = t;
|
|
@@ -2530,7 +2530,7 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2530
2530
|
e[0] = [...t, [...t[0]]];
|
|
2531
2531
|
}
|
|
2532
2532
|
}
|
|
2533
|
-
let
|
|
2533
|
+
let V = (e) => e.geometry.type === "Polygon" ? 3 : e.geometry.type === "LineString" ? 2 : 1, te = (e, t = {}) => ({
|
|
2534
2534
|
type: "Feature",
|
|
2535
2535
|
geometry: {
|
|
2536
2536
|
type: "Point",
|
|
@@ -2540,22 +2540,22 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2540
2540
|
}), re = (e) => ({
|
|
2541
2541
|
type: "FeatureCollection",
|
|
2542
2542
|
features: e
|
|
2543
|
-
}),
|
|
2543
|
+
}), H = (e, t) => (M?.getSource(e))?.setData(re(t));
|
|
2544
2544
|
function W() {
|
|
2545
2545
|
if (!M) return;
|
|
2546
|
-
|
|
2546
|
+
H(h.shapes, b.map((e) => ({
|
|
2547
2547
|
type: "Feature",
|
|
2548
2548
|
geometry: e.geometry,
|
|
2549
2549
|
properties: {
|
|
2550
2550
|
...e.properties,
|
|
2551
2551
|
__draw_id: String(e.id),
|
|
2552
|
-
__draw_selected: e.id ===
|
|
2552
|
+
__draw_selected: e.id === P.value
|
|
2553
2553
|
}
|
|
2554
2554
|
})));
|
|
2555
2555
|
let e = [];
|
|
2556
2556
|
if (N.value && N.value !== "point" && C.length) {
|
|
2557
|
-
let t =
|
|
2558
|
-
C.forEach((t) => e.push(
|
|
2557
|
+
let t = w ? [...C, w] : C;
|
|
2558
|
+
C.forEach((t) => e.push(te(t))), t.length >= 2 && e.push({
|
|
2559
2559
|
type: "Feature",
|
|
2560
2560
|
geometry: {
|
|
2561
2561
|
type: "LineString",
|
|
@@ -2571,23 +2571,23 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2571
2571
|
properties: {}
|
|
2572
2572
|
});
|
|
2573
2573
|
}
|
|
2574
|
-
|
|
2575
|
-
let t = [], n = L(
|
|
2576
|
-
if (n && r && (r.forEach((e, n) => t.push(
|
|
2574
|
+
H(h.draft, e);
|
|
2575
|
+
let t = [], n = L(P.value), r = n && !N.value && a.editable ? B(n) : null;
|
|
2576
|
+
if (n && r && (r.forEach((e, n) => t.push(te(e, {
|
|
2577
2577
|
handle: "vertex",
|
|
2578
2578
|
v: n
|
|
2579
2579
|
}))), n.geometry.type !== "Point")) {
|
|
2580
2580
|
let e = n.geometry.type === "Polygon" ? [...r, r[0]] : r;
|
|
2581
|
-
for (let n = 0; n < e.length - 1; n++) t.push(
|
|
2581
|
+
for (let n = 0; n < e.length - 1; n++) t.push(te(Ge(e[n], e[n + 1]), {
|
|
2582
2582
|
handle: "midpoint",
|
|
2583
2583
|
after: n
|
|
2584
2584
|
}));
|
|
2585
2585
|
}
|
|
2586
|
-
|
|
2586
|
+
H(h.handles, t);
|
|
2587
2587
|
}
|
|
2588
|
-
function
|
|
2589
|
-
|
|
2590
|
-
|
|
2588
|
+
function ie() {
|
|
2589
|
+
D ||= requestAnimationFrame(() => {
|
|
2590
|
+
D = 0, W();
|
|
2591
2591
|
});
|
|
2592
2592
|
}
|
|
2593
2593
|
let q = (...e) => [
|
|
@@ -2596,19 +2596,19 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2596
2596
|
e,
|
|
2597
2597
|
!0,
|
|
2598
2598
|
!1
|
|
2599
|
-
],
|
|
2599
|
+
], ae = [
|
|
2600
2600
|
"==",
|
|
2601
2601
|
["get", "__draw_selected"],
|
|
2602
2602
|
!0
|
|
2603
2603
|
];
|
|
2604
|
-
function
|
|
2604
|
+
function J() {
|
|
2605
2605
|
let e = p.value[a.color], t = p.value.surface;
|
|
2606
2606
|
return {
|
|
2607
2607
|
fill: {
|
|
2608
2608
|
"fill-color": e,
|
|
2609
2609
|
"fill-opacity": [
|
|
2610
2610
|
"case",
|
|
2611
|
-
|
|
2611
|
+
ae,
|
|
2612
2612
|
.3,
|
|
2613
2613
|
.18
|
|
2614
2614
|
]
|
|
@@ -2617,7 +2617,7 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2617
2617
|
"line-color": e,
|
|
2618
2618
|
"line-width": [
|
|
2619
2619
|
"case",
|
|
2620
|
-
|
|
2620
|
+
ae,
|
|
2621
2621
|
4,
|
|
2622
2622
|
2.5
|
|
2623
2623
|
]
|
|
@@ -2626,7 +2626,7 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2626
2626
|
"circle-color": e,
|
|
2627
2627
|
"circle-radius": [
|
|
2628
2628
|
"case",
|
|
2629
|
-
|
|
2629
|
+
ae,
|
|
2630
2630
|
8,
|
|
2631
2631
|
6
|
|
2632
2632
|
],
|
|
@@ -2646,41 +2646,41 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2646
2646
|
}
|
|
2647
2647
|
function oe() {
|
|
2648
2648
|
if (!M) return;
|
|
2649
|
-
for (let e of Object.values(
|
|
2649
|
+
for (let e of Object.values(h)) M.getSource(e) || M.addSource(e, {
|
|
2650
2650
|
type: "geojson",
|
|
2651
2651
|
data: re([])
|
|
2652
2652
|
});
|
|
2653
|
-
let e =
|
|
2653
|
+
let e = J(), t = (e) => {
|
|
2654
2654
|
M.getLayer(e.id) || M.addLayer(e);
|
|
2655
2655
|
};
|
|
2656
2656
|
t({
|
|
2657
2657
|
id: _[0],
|
|
2658
2658
|
type: "fill",
|
|
2659
|
-
source:
|
|
2659
|
+
source: h.shapes,
|
|
2660
2660
|
filter: q("Polygon", "MultiPolygon"),
|
|
2661
2661
|
paint: e.fill
|
|
2662
2662
|
}), t({
|
|
2663
2663
|
id: _[1],
|
|
2664
2664
|
type: "line",
|
|
2665
|
-
source:
|
|
2665
|
+
source: h.shapes,
|
|
2666
2666
|
filter: q("LineString", "MultiLineString", "Polygon", "MultiPolygon"),
|
|
2667
2667
|
paint: e.line
|
|
2668
2668
|
}), t({
|
|
2669
2669
|
id: _[2],
|
|
2670
2670
|
type: "circle",
|
|
2671
|
-
source:
|
|
2671
|
+
source: h.shapes,
|
|
2672
2672
|
filter: q("Point", "MultiPoint"),
|
|
2673
2673
|
paint: e.point
|
|
2674
2674
|
}), t({
|
|
2675
|
-
id: `${
|
|
2675
|
+
id: `${h.draft}-fill`,
|
|
2676
2676
|
type: "fill",
|
|
2677
|
-
source:
|
|
2677
|
+
source: h.draft,
|
|
2678
2678
|
filter: q("Polygon"),
|
|
2679
2679
|
paint: e.draftFill
|
|
2680
2680
|
}), t({
|
|
2681
|
-
id: `${
|
|
2681
|
+
id: `${h.draft}-line`,
|
|
2682
2682
|
type: "line",
|
|
2683
|
-
source:
|
|
2683
|
+
source: h.draft,
|
|
2684
2684
|
filter: q("LineString"),
|
|
2685
2685
|
paint: {
|
|
2686
2686
|
...e.draftLine,
|
|
@@ -2688,9 +2688,9 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2688
2688
|
"line-dasharray": [2, 2]
|
|
2689
2689
|
}
|
|
2690
2690
|
}), t({
|
|
2691
|
-
id: `${
|
|
2691
|
+
id: `${h.draft}-point`,
|
|
2692
2692
|
type: "circle",
|
|
2693
|
-
source:
|
|
2693
|
+
source: h.draft,
|
|
2694
2694
|
filter: q("Point"),
|
|
2695
2695
|
paint: {
|
|
2696
2696
|
...e.handle,
|
|
@@ -2700,7 +2700,7 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2700
2700
|
}), t({
|
|
2701
2701
|
id: y,
|
|
2702
2702
|
type: "circle",
|
|
2703
|
-
source:
|
|
2703
|
+
source: h.handles,
|
|
2704
2704
|
filter: [
|
|
2705
2705
|
"==",
|
|
2706
2706
|
["get", "handle"],
|
|
@@ -2715,7 +2715,7 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2715
2715
|
}), t({
|
|
2716
2716
|
id: v,
|
|
2717
2717
|
type: "circle",
|
|
2718
|
-
source:
|
|
2718
|
+
source: h.handles,
|
|
2719
2719
|
filter: [
|
|
2720
2720
|
"==",
|
|
2721
2721
|
["get", "handle"],
|
|
@@ -2728,76 +2728,76 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2728
2728
|
}
|
|
2729
2729
|
});
|
|
2730
2730
|
}
|
|
2731
|
-
|
|
2731
|
+
X([p, () => a.color], () => {
|
|
2732
2732
|
if (!M) return;
|
|
2733
|
-
let e =
|
|
2733
|
+
let e = J(), t = (e, t) => {
|
|
2734
2734
|
if (M.getLayer(e)) for (let [n, r] of Object.entries(t)) M.setPaintProperty(e, n, r);
|
|
2735
2735
|
};
|
|
2736
|
-
t(_[0], e.fill), t(_[1], e.line), t(_[2], e.point), t(`${
|
|
2736
|
+
t(_[0], e.fill), t(_[1], e.line), t(_[2], e.point), t(`${h.draft}-fill`, e.draftFill), t(`${h.draft}-line`, e.draftLine), t(`${h.draft}-point`, e.handle), t(y, e.handle), t(v, e.handle);
|
|
2737
2737
|
});
|
|
2738
|
-
function
|
|
2739
|
-
if (e !== null && !L(e) && (e = null),
|
|
2740
|
-
|
|
2738
|
+
function ce(e) {
|
|
2739
|
+
if (e !== null && !L(e) && (e = null), P.value === e) return;
|
|
2740
|
+
P.value = e, W();
|
|
2741
2741
|
let t = L(e);
|
|
2742
2742
|
o("select", t ? I(t) : null);
|
|
2743
2743
|
}
|
|
2744
|
-
function le(e =
|
|
2744
|
+
function le(e = P.value) {
|
|
2745
2745
|
let t = b.findIndex((t) => t.id === e);
|
|
2746
|
-
t < 0 || (b.splice(t, 1),
|
|
2746
|
+
t < 0 || (b.splice(t, 1), P.value === e && (P.value = null, o("select", null)), W(), z());
|
|
2747
2747
|
}
|
|
2748
|
-
function
|
|
2749
|
-
N.value && $(), b.length && (b = [],
|
|
2748
|
+
function de() {
|
|
2749
|
+
N.value && $(), b.length && (b = [], P.value !== null && (P.value = null, o("select", null)), W(), z());
|
|
2750
2750
|
}
|
|
2751
|
-
let
|
|
2752
|
-
function
|
|
2753
|
-
if (N.value || !M || !a.editable || f.value && f.value !==
|
|
2754
|
-
let { x: t, y: n } = e.point, r = [[t -
|
|
2755
|
-
if (i === void 0) return
|
|
2751
|
+
let fe = (e) => [e.lngLat.lng, e.lngLat.lat];
|
|
2752
|
+
function pe(e) {
|
|
2753
|
+
if (N.value || !M || !a.editable || f.value && f.value !== bn) return;
|
|
2754
|
+
let { x: t, y: n } = e.point, r = [[t - xn, n - xn], [t + xn, n + xn]], i = M.queryRenderedFeatures(r, { layers: _.filter((e) => M.getLayer(e)) })[0]?.properties?.__draw_id;
|
|
2755
|
+
if (i === void 0) return ce(null);
|
|
2756
2756
|
let o = b.find((e) => String(e.id) === i);
|
|
2757
|
-
|
|
2757
|
+
ce(o ? o.id : null);
|
|
2758
2758
|
}
|
|
2759
|
-
function
|
|
2760
|
-
N.value || !a.editable || f.value || (f.value =
|
|
2761
|
-
f.value ===
|
|
2759
|
+
function me() {
|
|
2760
|
+
N.value || !a.editable || f.value || (f.value = bn, setTimeout(() => {
|
|
2761
|
+
f.value === bn && !N.value && !E && (f.value = null);
|
|
2762
2762
|
}, 0));
|
|
2763
2763
|
}
|
|
2764
|
-
let
|
|
2764
|
+
let he = () => {
|
|
2765
2765
|
M && !N.value && !E && a.editable && (M.getCanvas().style.cursor = "pointer");
|
|
2766
2766
|
}, ge = () => {
|
|
2767
2767
|
M && !N.value && !E && (M.getCanvas().style.cursor = "");
|
|
2768
2768
|
};
|
|
2769
|
-
function
|
|
2769
|
+
function ve(e) {
|
|
2770
2770
|
if (N.value && M) {
|
|
2771
2771
|
if (N.value === "point") we({
|
|
2772
2772
|
type: "Point",
|
|
2773
|
-
coordinates:
|
|
2773
|
+
coordinates: fe(e)
|
|
2774
2774
|
}), $();
|
|
2775
2775
|
else {
|
|
2776
2776
|
if (N.value === "polygon" && C.length >= 3) {
|
|
2777
2777
|
let t = M.project(C[0]);
|
|
2778
2778
|
if (Math.hypot(t.x - e.point.x, t.y - e.point.y) < 20) return $();
|
|
2779
2779
|
}
|
|
2780
|
-
C.push(
|
|
2780
|
+
C.push(fe(e)), W();
|
|
2781
2781
|
}
|
|
2782
2782
|
}
|
|
2783
2783
|
}
|
|
2784
2784
|
function ye(e) {
|
|
2785
|
-
|
|
2785
|
+
w = fe(e), ie();
|
|
2786
2786
|
}
|
|
2787
|
-
function
|
|
2787
|
+
function xe(e) {
|
|
2788
2788
|
if (e.preventDefault(), !M || C.length < 2) return;
|
|
2789
2789
|
let t = M.project(C[C.length - 1]), n = M.project(C[C.length - 2]);
|
|
2790
2790
|
Math.hypot(t.x - n.x, t.y - n.y) < 10 && C.pop(), $();
|
|
2791
2791
|
}
|
|
2792
|
-
function
|
|
2792
|
+
function Se() {
|
|
2793
2793
|
let e = document.activeElement;
|
|
2794
2794
|
return !e || e === document.body ? !0 : M?.getContainer().contains(e) ? !(e instanceof HTMLElement && (e.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName))) : !1;
|
|
2795
2795
|
}
|
|
2796
|
-
function
|
|
2797
|
-
|
|
2796
|
+
function Ce(e) {
|
|
2797
|
+
Se() && (N.value ? e.key === "Enter" ? (e.preventDefault(), $()) : e.key === "Backspace" && C.length && (e.preventDefault(), C.pop(), W()) : (e.key === "Delete" || e.key === "Backspace") && P.value !== null && a.editable && (e.preventDefault(), le()));
|
|
2798
2798
|
}
|
|
2799
|
-
|
|
2800
|
-
function
|
|
2799
|
+
g(() => !!N.value || P.value !== null, () => N.value ? $() : ce(null));
|
|
2800
|
+
function Q() {
|
|
2801
2801
|
let e = `shape-${S++}`;
|
|
2802
2802
|
for (; b.some((t) => t.id === e);) e = `shape-${S++}`;
|
|
2803
2803
|
return e;
|
|
@@ -2805,23 +2805,23 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2805
2805
|
function we(e) {
|
|
2806
2806
|
let t = {
|
|
2807
2807
|
type: "Feature",
|
|
2808
|
-
id:
|
|
2808
|
+
id: Q(),
|
|
2809
2809
|
geometry: e,
|
|
2810
2810
|
properties: {}
|
|
2811
2811
|
};
|
|
2812
|
-
b.push(t),
|
|
2812
|
+
b.push(t), P.value = a.editable ? t.id : null, z(), a.editable && o("select", I(t));
|
|
2813
2813
|
}
|
|
2814
2814
|
function Te(e) {
|
|
2815
2815
|
if (M) {
|
|
2816
2816
|
if (N.value === e) return $();
|
|
2817
|
-
N.value && $(),
|
|
2817
|
+
N.value && $(), P.value !== null && ce(null), N.value = e, f.value = bn, C = [], w = null, M.getCanvas().style.cursor = "crosshair", M.doubleClickZoom.disable(), M.on("click", ve), M.on("mousemove", ye), M.on("dblclick", xe), W(), a.mode !== e && o("update:mode", e);
|
|
2818
2818
|
}
|
|
2819
2819
|
}
|
|
2820
2820
|
function $() {
|
|
2821
2821
|
if (!M || !N.value) return;
|
|
2822
|
-
cancelAnimationFrame(
|
|
2822
|
+
cancelAnimationFrame(D), D = 0;
|
|
2823
2823
|
let e = N.value, t = C;
|
|
2824
|
-
C = [],
|
|
2824
|
+
C = [], w = null, N.value = null, f.value === bn && (f.value = null), M.getCanvas().style.cursor = "", M.doubleClickZoom.enable(), M.off("click", ve), M.off("mousemove", ye), M.off("dblclick", xe), e === "line" && t.length >= 2 ? we({
|
|
2825
2825
|
type: "LineString",
|
|
2826
2826
|
coordinates: t
|
|
2827
2827
|
}) : e === "polygon" && t.length >= 3 && we({
|
|
@@ -2830,37 +2830,37 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2830
2830
|
}), W(), a.mode !== null && o("update:mode", null);
|
|
2831
2831
|
}
|
|
2832
2832
|
function Ee(e) {
|
|
2833
|
-
let t = e.features?.[0], n = L(
|
|
2833
|
+
let t = e.features?.[0], n = L(P.value);
|
|
2834
2834
|
if (!t || !n || N.value || !M || !a.editable) return;
|
|
2835
|
-
let r =
|
|
2835
|
+
let r = B(n);
|
|
2836
2836
|
if (!r) return;
|
|
2837
2837
|
e.preventDefault();
|
|
2838
2838
|
let i = t.properties.v;
|
|
2839
|
-
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.splice(i, 0,
|
|
2839
|
+
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.splice(i, 0, fe(e)), ee(n, r)), E = {
|
|
2840
2840
|
id: n.id,
|
|
2841
2841
|
v: i,
|
|
2842
2842
|
moved: t.properties.handle === "midpoint"
|
|
2843
|
-
}, f.value =
|
|
2843
|
+
}, f.value = bn, M.getCanvas().style.cursor = "grabbing";
|
|
2844
2844
|
let o = e.type === "touchstart";
|
|
2845
2845
|
o && M.dragPan.disable(), M.on(o ? "touchmove" : "mousemove", De), M.once(o ? "touchend" : "mouseup", Oe), W();
|
|
2846
2846
|
}
|
|
2847
2847
|
function De(e) {
|
|
2848
|
-
let t = E && L(E.id), n = t &&
|
|
2849
|
-
E && t && n && (n[E.v] =
|
|
2848
|
+
let t = E && L(E.id), n = t && B(t);
|
|
2849
|
+
E && t && n && (n[E.v] = fe(e), ee(t, n), E.moved = !0, ie());
|
|
2850
2850
|
}
|
|
2851
2851
|
function Oe() {
|
|
2852
2852
|
if (!M) return;
|
|
2853
2853
|
let e = E?.moved;
|
|
2854
2854
|
E = null, M.off("mousemove", De), M.off("touchmove", De), M.dragPan.enable(), M.getCanvas().style.cursor = "", W(), e && z(), setTimeout(() => {
|
|
2855
|
-
f.value ===
|
|
2855
|
+
f.value === bn && !N.value && (f.value = null);
|
|
2856
2856
|
});
|
|
2857
2857
|
}
|
|
2858
2858
|
function ke(e) {
|
|
2859
|
-
let t = e.features?.[0], n = L(
|
|
2859
|
+
let t = e.features?.[0], n = L(P.value);
|
|
2860
2860
|
if (!t || !n || N.value || !a.editable) return;
|
|
2861
2861
|
e.preventDefault();
|
|
2862
|
-
let r =
|
|
2863
|
-
!r || r.length <=
|
|
2862
|
+
let r = B(n);
|
|
2863
|
+
!r || r.length <= V(n) || (r.splice(t.properties.v, 1), ee(n, r), W(), z());
|
|
2864
2864
|
}
|
|
2865
2865
|
let Ae = () => {
|
|
2866
2866
|
M && !E && !N.value && (M.getCanvas().style.cursor = "grab");
|
|
@@ -2868,41 +2868,41 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2868
2868
|
M && !E && !N.value && (M.getCanvas().style.cursor = "");
|
|
2869
2869
|
};
|
|
2870
2870
|
R(a.modelValue), x = JSON.stringify(b), l((e) => {
|
|
2871
|
-
M = e, oe(), W(), e.on("click",
|
|
2872
|
-
for (let t of _) e.on("mousedown", t,
|
|
2871
|
+
M = e, oe(), W(), e.on("click", pe);
|
|
2872
|
+
for (let t of _) e.on("mousedown", t, me), e.on("touchstart", t, me), e.on("mouseenter", t, he), e.on("mouseleave", t, ge);
|
|
2873
2873
|
for (let t of [v, y]) e.on("mousedown", t, Ee), e.on("touchstart", t, Ee), e.on("mouseenter", t, Ae), e.on("mouseleave", t, je);
|
|
2874
|
-
e.on("dblclick", v, ke), document.addEventListener("keydown",
|
|
2875
|
-
}),
|
|
2874
|
+
e.on("dblclick", v, ke), document.addEventListener("keydown", Ce), a.mode && Te(a.mode);
|
|
2875
|
+
}), X(u, () => {
|
|
2876
2876
|
oe(), W();
|
|
2877
|
-
}),
|
|
2877
|
+
}), X(() => a.modelValue, (e) => {
|
|
2878
2878
|
JSON.stringify(e?.features ?? []) !== x && (R(e), x = JSON.stringify(b), W());
|
|
2879
|
-
}, { deep: !0 }),
|
|
2879
|
+
}, { deep: !0 }), X(() => a.mode, (e) => {
|
|
2880
2880
|
e && e !== N.value ? Te(e) : !e && N.value && $();
|
|
2881
|
-
}),
|
|
2882
|
-
!e &&
|
|
2881
|
+
}), X(() => a.editable, (e) => {
|
|
2882
|
+
!e && P.value !== null && ce(null);
|
|
2883
2883
|
}), ne(() => {
|
|
2884
|
-
if (document.removeEventListener("keydown",
|
|
2885
|
-
N.value && $(), cancelAnimationFrame(
|
|
2886
|
-
for (let e of _) M.off("mousedown", e,
|
|
2884
|
+
if (document.removeEventListener("keydown", Ce), !M) return;
|
|
2885
|
+
N.value && $(), cancelAnimationFrame(D), M.off("click", pe);
|
|
2886
|
+
for (let e of _) M.off("mousedown", e, me), M.off("touchstart", e, me), M.off("mouseenter", e, he), M.off("mouseleave", e, ge);
|
|
2887
2887
|
for (let e of [v, y]) M.off("mousedown", e, Ee), M.off("touchstart", e, Ee), M.off("mouseenter", e, Ae), M.off("mouseleave", e, je);
|
|
2888
2888
|
M.off("dblclick", v, ke);
|
|
2889
2889
|
let e = [
|
|
2890
2890
|
v,
|
|
2891
2891
|
y,
|
|
2892
|
-
`${
|
|
2893
|
-
`${
|
|
2894
|
-
`${
|
|
2892
|
+
`${h.draft}-point`,
|
|
2893
|
+
`${h.draft}-line`,
|
|
2894
|
+
`${h.draft}-fill`,
|
|
2895
2895
|
...[..._].reverse()
|
|
2896
2896
|
];
|
|
2897
2897
|
for (let t of e) M.getLayer(t) && M.removeLayer(t);
|
|
2898
|
-
for (let e of Object.values(
|
|
2898
|
+
for (let e of Object.values(h)) M.getSource(e) && M.removeSource(e);
|
|
2899
2899
|
M = void 0;
|
|
2900
2900
|
});
|
|
2901
|
-
let Me =
|
|
2901
|
+
let Me = O(() => a.control === !0 ? "top-right" : a.control || "top-right"), Ne = {
|
|
2902
2902
|
point: "location_on",
|
|
2903
2903
|
line: "polyline",
|
|
2904
2904
|
polygon: "pentagon"
|
|
2905
|
-
}, Pe =
|
|
2905
|
+
}, Pe = O(() => ({
|
|
2906
2906
|
point: s.mapDrawPoint,
|
|
2907
2907
|
line: s.mapDrawLine,
|
|
2908
2908
|
polygon: s.mapDrawPolygon
|
|
@@ -2910,46 +2910,46 @@ var en = { class: "hidden" }, tn = /* @__PURE__ */ F({
|
|
|
2910
2910
|
return r({
|
|
2911
2911
|
start: Te,
|
|
2912
2912
|
finish: $,
|
|
2913
|
-
select:
|
|
2913
|
+
select: ce,
|
|
2914
2914
|
remove: le,
|
|
2915
|
-
clear:
|
|
2916
|
-
}), (r, i) => (
|
|
2915
|
+
clear: de
|
|
2916
|
+
}), (r, i) => (U(), j("div", _n, [n.control ? (U(), k(be, {
|
|
2917
2917
|
key: 0,
|
|
2918
2918
|
position: Me.value
|
|
2919
2919
|
}, {
|
|
2920
|
-
default:
|
|
2920
|
+
default: Z(() => [(U(!0), j(T, null, K(n.modes, (n) => ue((U(), j("button", {
|
|
2921
2921
|
key: n,
|
|
2922
2922
|
type: "button",
|
|
2923
2923
|
class: "grid place-items-center",
|
|
2924
2924
|
"aria-label": Pe.value[n],
|
|
2925
2925
|
"aria-pressed": N.value === n,
|
|
2926
2926
|
onClick: (e) => Te(n)
|
|
2927
|
-
}, [
|
|
2927
|
+
}, [F(e, {
|
|
2928
2928
|
name: Ne[n],
|
|
2929
2929
|
size: 20
|
|
2930
|
-
}, null, 8, ["name"])], 8,
|
|
2930
|
+
}, null, 8, ["name"])], 8, vn)), [[Y(t), Pe.value[n]]])), 128)), n.editable ? ue((U(), j("button", {
|
|
2931
2931
|
key: 0,
|
|
2932
2932
|
type: "button",
|
|
2933
2933
|
class: "grid place-items-center",
|
|
2934
|
-
"aria-label":
|
|
2935
|
-
disabled:
|
|
2934
|
+
"aria-label": Y(s).mapDeleteFeature,
|
|
2935
|
+
disabled: P.value === null,
|
|
2936
2936
|
onClick: i[0] ||= (e) => le()
|
|
2937
|
-
}, [
|
|
2937
|
+
}, [F(e, {
|
|
2938
2938
|
name: "delete",
|
|
2939
2939
|
size: 20
|
|
2940
|
-
})], 8,
|
|
2940
|
+
})], 8, yn)), [[Y(t), Y(s).mapDeleteFeature]]) : A("", !0)]),
|
|
2941
2941
|
_: 1
|
|
2942
|
-
}, 8, ["position"])) :
|
|
2942
|
+
}, 8, ["position"])) : A("", !0)]));
|
|
2943
2943
|
}
|
|
2944
|
-
}),
|
|
2945
|
-
function
|
|
2946
|
-
let t =
|
|
2944
|
+
}), Cn = /* @__PURE__ */ new WeakMap();
|
|
2945
|
+
function wn(e) {
|
|
2946
|
+
let t = ge(e);
|
|
2947
2947
|
if (!t) throw Error("useMapFilter() must be called in a component inside <MMap>, or be given one");
|
|
2948
2948
|
function n(e, n) {
|
|
2949
2949
|
let r = t.map.value;
|
|
2950
2950
|
if (!r?.getLayer(e)) return;
|
|
2951
|
-
let i =
|
|
2952
|
-
i ||
|
|
2951
|
+
let i = Cn.get(r);
|
|
2952
|
+
i || Cn.set(r, i = /* @__PURE__ */ new Map()), i.has(e) || i.set(e, r.getFilter(e) ?? void 0);
|
|
2953
2953
|
let a = i.get(e);
|
|
2954
2954
|
r.setFilter(e, n ? a ? [
|
|
2955
2955
|
"all",
|
|
@@ -2973,7 +2973,7 @@ function Cn(e) {
|
|
|
2973
2973
|
};
|
|
2974
2974
|
}
|
|
2975
2975
|
// src/components/MMapFilter.vue?vue&type=script&setup=true&lang.ts
|
|
2976
|
-
var
|
|
2976
|
+
var Tn = { class: "flex flex-wrap gap-2" }, En = /* @__PURE__ */ I({
|
|
2977
2977
|
__name: "MMapFilter",
|
|
2978
2978
|
props: {
|
|
2979
2979
|
layer: {},
|
|
@@ -2985,7 +2985,7 @@ var wn = { class: "flex flex-wrap gap-2" }, Tn = /* @__PURE__ */ F({
|
|
|
2985
2985
|
},
|
|
2986
2986
|
emits: ["update:modelValue"],
|
|
2987
2987
|
setup(e, { emit: t }) {
|
|
2988
|
-
let n = e, r = t, { onReady: i, styleVersion: a } =
|
|
2988
|
+
let n = e, r = t, { onReady: i, styleVersion: a } = _e(() => n.map), { setFilter: o, valuesOf: s } = wn(() => n.map), c = G([]), l = O(() => n.values ?? c.value), u = G([]), d = O(() => n.modelValue ?? u.value);
|
|
2989
2989
|
function f() {
|
|
2990
2990
|
let e = d.value;
|
|
2991
2991
|
o(n.layer, e.length ? [
|
|
@@ -3006,22 +3006,22 @@ var wn = { class: "flex flex-wrap gap-2" }, Tn = /* @__PURE__ */ F({
|
|
|
3006
3006
|
}
|
|
3007
3007
|
return i((e) => {
|
|
3008
3008
|
m(e), f();
|
|
3009
|
-
}),
|
|
3009
|
+
}), X(d, f, { deep: !0 }), X(a, () => f()), X(() => [n.layer, n.property], ([e], [t]) => {
|
|
3010
3010
|
e !== t && o(t, null), f();
|
|
3011
|
-
}), ne(() => o(n.layer, null)), (t, n) => (
|
|
3011
|
+
}), ne(() => o(n.layer, null)), (t, n) => (U(), j("div", Tn, [(U(!0), j(T, null, K(l.value, (t) => (U(), k(_, {
|
|
3012
3012
|
key: t,
|
|
3013
3013
|
type: "filter",
|
|
3014
3014
|
clickable: "",
|
|
3015
3015
|
selected: d.value.includes(t),
|
|
3016
3016
|
onClick: (e) => p(t)
|
|
3017
3017
|
}, {
|
|
3018
|
-
default:
|
|
3018
|
+
default: Z(() => [P(J(e.labels?.[String(t)] ?? t), 1)]),
|
|
3019
3019
|
_: 2
|
|
3020
3020
|
}, 1032, ["selected", "onClick"]))), 128))]));
|
|
3021
3021
|
}
|
|
3022
3022
|
});
|
|
3023
3023
|
// src/composables/mapSearch.ts
|
|
3024
|
-
function
|
|
3024
|
+
function Dn(e = {}) {
|
|
3025
3025
|
return async (t, n) => {
|
|
3026
3026
|
let r = new URLSearchParams({
|
|
3027
3027
|
format: "jsonv2",
|
|
@@ -3047,7 +3047,7 @@ function En(e = {}) {
|
|
|
3047
3047
|
});
|
|
3048
3048
|
};
|
|
3049
3049
|
}
|
|
3050
|
-
var
|
|
3050
|
+
var On = {
|
|
3051
3051
|
city: "location_city",
|
|
3052
3052
|
town: "location_city",
|
|
3053
3053
|
village: "holiday_village",
|
|
@@ -3074,17 +3074,17 @@ var Dn = {
|
|
|
3074
3074
|
administrative: "map",
|
|
3075
3075
|
country: "public",
|
|
3076
3076
|
state: "map"
|
|
3077
|
-
},
|
|
3077
|
+
}, kn = (e) => e && On[e] || "location_on", An = { class: "hidden" }, jn = [
|
|
3078
3078
|
"value",
|
|
3079
3079
|
"placeholder",
|
|
3080
3080
|
"aria-label"
|
|
3081
|
-
],
|
|
3081
|
+
], Mn = {
|
|
3082
3082
|
key: 0,
|
|
3083
3083
|
class: "border-t border-outline-variant"
|
|
3084
|
-
},
|
|
3084
|
+
}, Nn = {
|
|
3085
3085
|
key: 1,
|
|
3086
3086
|
class: "flex flex-col items-center gap-2 py-6"
|
|
3087
|
-
},
|
|
3087
|
+
}, Pn = { class: "text-body-small text-on-surface-variant" }, Fn = /* @__PURE__ */ I({
|
|
3088
3088
|
__name: "MMapSearch",
|
|
3089
3089
|
props: {
|
|
3090
3090
|
provider: {},
|
|
@@ -3102,8 +3102,8 @@ var Dn = {
|
|
|
3102
3102
|
},
|
|
3103
3103
|
emits: ["select"],
|
|
3104
3104
|
setup(t, { emit: n }) {
|
|
3105
|
-
let r = t, i = n, a = c(), { map: s } =
|
|
3106
|
-
async function
|
|
3105
|
+
let r = t, i = n, a = c(), { map: s } = _e(), l = O(() => r.provider ?? Dn()), u = G(""), d = ae([]), f = G(!1), p = G(!1), m = G(!1), h = ae(null), g, _;
|
|
3106
|
+
async function v() {
|
|
3107
3107
|
let e = u.value.trim();
|
|
3108
3108
|
if (!e) return;
|
|
3109
3109
|
g?.abort(), g = new AbortController();
|
|
@@ -3120,9 +3120,9 @@ var Dn = {
|
|
|
3120
3120
|
}
|
|
3121
3121
|
function C(e) {
|
|
3122
3122
|
if (u.value = e, !e) return E();
|
|
3123
|
-
r.instant && (clearTimeout(_), _ = setTimeout(
|
|
3123
|
+
r.instant && (clearTimeout(_), _ = setTimeout(v, 350));
|
|
3124
3124
|
}
|
|
3125
|
-
function
|
|
3125
|
+
function w(e) {
|
|
3126
3126
|
h.value = e, m.value = !1;
|
|
3127
3127
|
let t = s.value;
|
|
3128
3128
|
e.bbox && e.bbox[0] !== e.bbox[2] ? t?.fitBounds([[e.bbox[0], e.bbox[1]], [e.bbox[2], e.bbox[3]]], {
|
|
@@ -3138,95 +3138,95 @@ var Dn = {
|
|
|
3138
3138
|
}
|
|
3139
3139
|
return ne(() => {
|
|
3140
3140
|
g?.abort(), clearTimeout(_);
|
|
3141
|
-
}), (n, r) => (
|
|
3141
|
+
}), (n, r) => (U(), j("div", An, [F(be, {
|
|
3142
3142
|
position: t.position,
|
|
3143
3143
|
group: !1
|
|
3144
3144
|
}, {
|
|
3145
|
-
default:
|
|
3145
|
+
default: Z(() => [F(b, {
|
|
3146
3146
|
variant: "elevated",
|
|
3147
3147
|
class: "w-80 max-w-[calc(100vw-5rem)] overflow-hidden"
|
|
3148
3148
|
}, {
|
|
3149
|
-
default:
|
|
3149
|
+
default: Z(() => [M("form", {
|
|
3150
3150
|
class: "flex items-center gap-2 py-1 pr-1 pl-3",
|
|
3151
3151
|
role: "search",
|
|
3152
|
-
onSubmit:
|
|
3152
|
+
onSubmit: de(v, ["prevent"])
|
|
3153
3153
|
}, [
|
|
3154
|
-
|
|
3154
|
+
F(e, {
|
|
3155
3155
|
name: "search",
|
|
3156
3156
|
size: 20,
|
|
3157
3157
|
class: "shrink-0 text-on-surface-variant"
|
|
3158
3158
|
}),
|
|
3159
|
-
|
|
3159
|
+
M("input", {
|
|
3160
3160
|
value: u.value,
|
|
3161
3161
|
type: "search",
|
|
3162
3162
|
enterkeyhint: "search",
|
|
3163
|
-
placeholder: t.placeholder ??
|
|
3164
|
-
"aria-label": t.placeholder ??
|
|
3163
|
+
placeholder: t.placeholder ?? Y(a).mapSearchPlaces,
|
|
3164
|
+
"aria-label": t.placeholder ?? Y(a).mapSearchPlaces,
|
|
3165
3165
|
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",
|
|
3166
3166
|
onInput: r[0] ||= (e) => C(e.target.value),
|
|
3167
3167
|
onFocus: r[1] ||= (e) => m.value = p.value && !h.value
|
|
3168
|
-
}, null, 40,
|
|
3169
|
-
f.value ? (
|
|
3168
|
+
}, null, 40, jn),
|
|
3169
|
+
f.value ? (U(), k(S, {
|
|
3170
3170
|
key: 0,
|
|
3171
3171
|
size: 20,
|
|
3172
3172
|
class: "mr-2 shrink-0"
|
|
3173
|
-
})) : u.value ? (
|
|
3173
|
+
})) : u.value ? (U(), k(o, {
|
|
3174
3174
|
key: 1,
|
|
3175
3175
|
icon: "close",
|
|
3176
|
-
label:
|
|
3176
|
+
label: Y(a).clearSearch,
|
|
3177
3177
|
size: "sm",
|
|
3178
3178
|
onClick: E
|
|
3179
|
-
}, null, 8, ["label"])) :
|
|
3180
|
-
], 32), m.value && p.value && !f.value ? (
|
|
3179
|
+
}, null, 8, ["label"])) : A("", !0)
|
|
3180
|
+
], 32), m.value && p.value && !f.value ? (U(), j("div", Mn, [d.value.length ? (U(), k(y, {
|
|
3181
3181
|
key: 0,
|
|
3182
3182
|
class: "max-h-72 overflow-y-auto"
|
|
3183
3183
|
}, {
|
|
3184
|
-
default:
|
|
3184
|
+
default: Z(() => [(U(!0), j(T, null, K(d.value, (e, t) => (U(), k(x, {
|
|
3185
3185
|
key: t,
|
|
3186
3186
|
title: e.label,
|
|
3187
|
-
icon:
|
|
3187
|
+
icon: Y(kn)(e.type),
|
|
3188
3188
|
leading: "icon",
|
|
3189
3189
|
clickable: "",
|
|
3190
|
-
onClick: (t) =>
|
|
3190
|
+
onClick: (t) => w(e)
|
|
3191
3191
|
}, null, 8, [
|
|
3192
3192
|
"title",
|
|
3193
3193
|
"icon",
|
|
3194
3194
|
"onClick"
|
|
3195
3195
|
]))), 128))]),
|
|
3196
3196
|
_: 1
|
|
3197
|
-
})) : (
|
|
3197
|
+
})) : (U(), j("div", Nn, [F(e, {
|
|
3198
3198
|
name: "search_off",
|
|
3199
3199
|
size: 28,
|
|
3200
3200
|
class: "text-on-surface-variant"
|
|
3201
|
-
}),
|
|
3201
|
+
}), M("span", Pn, J(Y(a).noResults), 1)]))])) : A("", !0)]),
|
|
3202
3202
|
_: 1
|
|
3203
3203
|
})]),
|
|
3204
3204
|
_: 1
|
|
3205
|
-
}, 8, ["position"]), t.marker && h.value ? (
|
|
3205
|
+
}, 8, ["position"]), t.marker && h.value ? (U(), k(Fe, {
|
|
3206
3206
|
key: 0,
|
|
3207
3207
|
"lng-lat": h.value.lngLat
|
|
3208
|
-
}, null, 8, ["lng-lat"])) :
|
|
3208
|
+
}, null, 8, ["lng-lat"])) : A("", !0)]));
|
|
3209
3209
|
}
|
|
3210
|
-
}),
|
|
3210
|
+
}), In = ["aria-label"], Ln = {
|
|
3211
3211
|
key: 0,
|
|
3212
3212
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant",
|
|
3213
3213
|
role: "status"
|
|
3214
|
-
},
|
|
3214
|
+
}, Rn = {
|
|
3215
3215
|
key: 1,
|
|
3216
3216
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant"
|
|
3217
|
-
},
|
|
3217
|
+
}, zn = {
|
|
3218
3218
|
key: 2,
|
|
3219
3219
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant",
|
|
3220
3220
|
role: "status"
|
|
3221
|
-
},
|
|
3221
|
+
}, Bn = [
|
|
3222
3222
|
"id",
|
|
3223
3223
|
"aria-selected",
|
|
3224
3224
|
"onMousedown",
|
|
3225
3225
|
"onMousemove"
|
|
3226
|
-
],
|
|
3226
|
+
], Vn = { class: "flex min-w-0 flex-col" }, Hn = { class: "truncate text-body-large" }, Un = {
|
|
3227
3227
|
key: 0,
|
|
3228
3228
|
class: "truncate text-body-small text-on-surface-variant"
|
|
3229
|
-
},
|
|
3229
|
+
}, Wn = /* @__PURE__ */ I({
|
|
3230
3230
|
inheritAttrs: !1,
|
|
3231
3231
|
__name: "MAddressField",
|
|
3232
3232
|
props: {
|
|
@@ -3257,7 +3257,7 @@ var Dn = {
|
|
|
3257
3257
|
"blur"
|
|
3258
3258
|
],
|
|
3259
3259
|
setup(t, { expose: n, emit: r }) {
|
|
3260
|
-
let i = t, a = r, s = c(), l =
|
|
3260
|
+
let i = t, a = r, s = c(), l = se(), u = `${l}-list`, d = (e) => `${l}-opt-${e}`, p = O(() => i.provider ?? Dn()), m = G(i.modelValue?.label ?? ""), _ = ae([]), y = G(!1), b = G(!1), x = G(!1), D = G(!1), N = G(-1), I, L, R = G(), z = C({
|
|
3261
3261
|
value: () => i.modelValue,
|
|
3262
3262
|
rules: () => i.rules,
|
|
3263
3263
|
required: () => i.required,
|
|
@@ -3268,128 +3268,128 @@ var Dn = {
|
|
|
3268
3268
|
validateDebounce: () => i.validateDebounce,
|
|
3269
3269
|
disabled: () => i.disabled,
|
|
3270
3270
|
focus: () => R.value?.focus(),
|
|
3271
|
-
el: () =>
|
|
3271
|
+
el: () => ie.value,
|
|
3272
3272
|
setValue: (e) => a("update:modelValue", e ?? null)
|
|
3273
|
-
}), re =
|
|
3274
|
-
|
|
3275
|
-
let
|
|
3276
|
-
|
|
3277
|
-
e && e.label !==
|
|
3273
|
+
}), re = z.disabled, H = O(() => z.message.value || z.hasError.value);
|
|
3274
|
+
W(w, null);
|
|
3275
|
+
let ie = G(), q = G(), oe = O(() => ie.value?.firstElementChild?.firstElementChild ?? null), ce = G({}), ue = O(() => m.value.trim().length >= i.minLength), fe = O(() => !i.instant && x.value && ue.value && !b.value && !y.value && !i.modelValue);
|
|
3276
|
+
X(() => i.modelValue, (e) => {
|
|
3277
|
+
e && e.label !== m.value ? m.value = e.label : !e && !x.value && (m.value = "");
|
|
3278
3278
|
});
|
|
3279
|
-
async function
|
|
3280
|
-
let e =
|
|
3279
|
+
async function pe() {
|
|
3280
|
+
let e = m.value.trim();
|
|
3281
3281
|
if (e.length < i.minLength) return;
|
|
3282
3282
|
I?.abort(), clearTimeout(L), I = new AbortController();
|
|
3283
3283
|
let t = I;
|
|
3284
|
-
y.value = !0,
|
|
3284
|
+
y.value = !0, D.value = !0;
|
|
3285
3285
|
try {
|
|
3286
|
-
|
|
3286
|
+
_.value = await p.value(e, t.signal), N.value = _.value.length ? 0 : -1;
|
|
3287
3287
|
} catch {
|
|
3288
3288
|
if (t.signal.aborted) return;
|
|
3289
|
-
|
|
3289
|
+
_.value = [];
|
|
3290
3290
|
} finally {
|
|
3291
3291
|
I === t && (y.value = !1, b.value = !0);
|
|
3292
3292
|
}
|
|
3293
3293
|
}
|
|
3294
|
-
function pe(e) {
|
|
3295
|
-
g.value = String(e), b.value = !1, v.value = [], F.value = -1, i.modelValue && a("update:modelValue", null), I?.abort(), y.value = !1, clearTimeout(L), ue.value ? (M.value = !i.instant, i.instant && (L = setTimeout(fe, i.debounce))) : M.value = !1;
|
|
3296
|
-
}
|
|
3297
3294
|
function me(e) {
|
|
3298
|
-
|
|
3295
|
+
m.value = String(e), b.value = !1, _.value = [], N.value = -1, i.modelValue && a("update:modelValue", null), I?.abort(), y.value = !1, clearTimeout(L), ue.value ? (D.value = !i.instant, i.instant && (L = setTimeout(pe, i.debounce))) : D.value = !1;
|
|
3299
3296
|
}
|
|
3300
|
-
function he() {
|
|
3301
|
-
|
|
3297
|
+
function he(e) {
|
|
3298
|
+
m.value = e.label, D.value = !1, _.value = [], b.value = !1, a("update:modelValue", e), a("select", e);
|
|
3302
3299
|
}
|
|
3303
|
-
function ge(
|
|
3300
|
+
function ge() {
|
|
3301
|
+
I?.abort(), clearTimeout(L), m.value = "", _.value = [], b.value = !1, y.value = !1, D.value = !1, i.modelValue && a("update:modelValue", null), R.value?.focus();
|
|
3302
|
+
}
|
|
3303
|
+
function _e(e) {
|
|
3304
3304
|
if (e.key === "Enter") {
|
|
3305
3305
|
e.preventDefault();
|
|
3306
|
-
let t =
|
|
3307
|
-
|
|
3306
|
+
let t = _.value[N.value];
|
|
3307
|
+
D.value && t && b.value ? he(t) : pe();
|
|
3308
3308
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
3309
|
-
if (!
|
|
3309
|
+
if (!D.value || !_.value.length) return;
|
|
3310
3310
|
e.preventDefault();
|
|
3311
|
-
let t =
|
|
3312
|
-
|
|
3311
|
+
let t = _.value.length;
|
|
3312
|
+
N.value = (N.value + (e.key === "ArrowDown" ? 1 : -1) + t) % t, ee(() => q.value?.querySelector(`#${CSS.escape(d(N.value))}`)?.scrollIntoView({ block: "nearest" }));
|
|
3313
3313
|
}
|
|
3314
3314
|
}
|
|
3315
|
-
function
|
|
3316
|
-
|
|
3315
|
+
function ve() {
|
|
3316
|
+
x.value = !0, (b.value && _.value.length && !i.modelValue || fe.value) && (D.value = !0);
|
|
3317
3317
|
}
|
|
3318
|
-
function
|
|
3318
|
+
function ye(e) {
|
|
3319
3319
|
let t = e.relatedTarget;
|
|
3320
|
-
t && (
|
|
3320
|
+
t && (ie.value?.contains(t) || q.value?.contains(t)) || (x.value = !1, D.value = !1, z.onBlur(), a("blur"));
|
|
3321
3321
|
}
|
|
3322
|
-
|
|
3323
|
-
let
|
|
3324
|
-
function
|
|
3325
|
-
let e = oe.value?.getBoundingClientRect(), t =
|
|
3322
|
+
g(() => D.value, () => D.value = !1);
|
|
3323
|
+
let be = O(() => D.value && (y.value || b.value || fe.value));
|
|
3324
|
+
function xe() {
|
|
3325
|
+
let e = oe.value?.getBoundingClientRect(), t = q.value;
|
|
3326
3326
|
if (!e || !t) return;
|
|
3327
|
-
let n = t.offsetHeight, r =
|
|
3327
|
+
let n = t.offsetHeight, r = h([e.bottom + 4, e.top - 4 - n], n, window.innerHeight, 8);
|
|
3328
3328
|
ce.value = {
|
|
3329
3329
|
top: `${r}px`,
|
|
3330
3330
|
left: `${e.left}px`,
|
|
3331
3331
|
width: `${e.width}px`
|
|
3332
3332
|
};
|
|
3333
3333
|
}
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3334
|
+
X([
|
|
3335
|
+
be,
|
|
3336
|
+
_,
|
|
3337
3337
|
y
|
|
3338
|
-
], () => ee(
|
|
3339
|
-
open: () =>
|
|
3338
|
+
], () => ee(xe)), v({
|
|
3339
|
+
open: () => be.value,
|
|
3340
3340
|
anchor: oe,
|
|
3341
|
-
popup:
|
|
3342
|
-
place:
|
|
3343
|
-
close: () =>
|
|
3344
|
-
}),
|
|
3341
|
+
popup: q,
|
|
3342
|
+
place: xe,
|
|
3343
|
+
close: () => D.value = !1
|
|
3344
|
+
}), le(() => {
|
|
3345
3345
|
let e = R.value?.inputEl;
|
|
3346
|
-
e && (e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-expanded", String(
|
|
3346
|
+
e && (e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-expanded", String(be.value && _.value.length > 0)), e.setAttribute("aria-controls", u), e.setAttribute("enterkeyhint", "search"), be.value && N.value >= 0 && _.value.length ? e.setAttribute("aria-activedescendant", d(N.value)) : e.removeAttribute("aria-activedescendant"));
|
|
3347
3347
|
}), ne(() => {
|
|
3348
3348
|
I?.abort(), clearTimeout(L);
|
|
3349
3349
|
});
|
|
3350
|
-
function
|
|
3350
|
+
function Se(e) {
|
|
3351
3351
|
let t = e.indexOf(", ");
|
|
3352
3352
|
return t < 0 ? [e, ""] : [e.slice(0, t), e.slice(t + 2)];
|
|
3353
3353
|
}
|
|
3354
3354
|
return n({
|
|
3355
|
-
search:
|
|
3356
|
-
clear:
|
|
3355
|
+
search: pe,
|
|
3356
|
+
clear: ge,
|
|
3357
3357
|
focus: () => R.value?.focus(),
|
|
3358
|
-
validate:
|
|
3359
|
-
resetValidation:
|
|
3360
|
-
}), (n, r) => (
|
|
3358
|
+
validate: z.validate,
|
|
3359
|
+
resetValidation: z.resetValidation
|
|
3360
|
+
}), (n, r) => (U(), j(T, null, [M("div", B({
|
|
3361
3361
|
ref_key: "wrapEl",
|
|
3362
|
-
ref:
|
|
3362
|
+
ref: ie
|
|
3363
3363
|
}, n.$attrs, {
|
|
3364
|
-
onFocusin:
|
|
3365
|
-
onFocusout:
|
|
3366
|
-
onKeydown:
|
|
3367
|
-
}), [
|
|
3364
|
+
onFocusin: ve,
|
|
3365
|
+
onFocusout: ye,
|
|
3366
|
+
onKeydown: _e
|
|
3367
|
+
}), [F(f, {
|
|
3368
3368
|
ref_key: "field",
|
|
3369
3369
|
ref: R,
|
|
3370
|
-
"model-value":
|
|
3371
|
-
label: t.label ??
|
|
3370
|
+
"model-value": m.value,
|
|
3371
|
+
label: t.label ?? Y(s).mapAddress,
|
|
3372
3372
|
variant: t.variant,
|
|
3373
3373
|
"leading-icon": t.leadingIcon,
|
|
3374
3374
|
hint: t.hint,
|
|
3375
|
-
error:
|
|
3375
|
+
error: H.value,
|
|
3376
3376
|
required: t.required,
|
|
3377
|
-
disabled:
|
|
3377
|
+
disabled: Y(re),
|
|
3378
3378
|
autocomplete: "street-address",
|
|
3379
|
-
"onUpdate:modelValue":
|
|
3379
|
+
"onUpdate:modelValue": me
|
|
3380
3380
|
}, {
|
|
3381
|
-
trailing:
|
|
3381
|
+
trailing: Z(() => [y.value ? (U(), k(S, {
|
|
3382
3382
|
key: 0,
|
|
3383
3383
|
size: 20,
|
|
3384
3384
|
class: "m-2"
|
|
3385
|
-
})) :
|
|
3385
|
+
})) : m.value ? (U(), k(o, {
|
|
3386
3386
|
key: 1,
|
|
3387
3387
|
icon: "close",
|
|
3388
|
-
label:
|
|
3388
|
+
label: Y(s).clearSearch,
|
|
3389
3389
|
size: "sm",
|
|
3390
|
-
disabled:
|
|
3391
|
-
onClick:
|
|
3392
|
-
}, null, 8, ["label", "disabled"])) :
|
|
3390
|
+
disabled: Y(re),
|
|
3391
|
+
onClick: ge
|
|
3392
|
+
}, null, 8, ["label", "disabled"])) : A("", !0)]),
|
|
3393
3393
|
_: 1
|
|
3394
3394
|
}, 8, [
|
|
3395
3395
|
"model-value",
|
|
@@ -3400,36 +3400,36 @@ var Dn = {
|
|
|
3400
3400
|
"error",
|
|
3401
3401
|
"required",
|
|
3402
3402
|
"disabled"
|
|
3403
|
-
])], 16), (
|
|
3403
|
+
])], 16), (U(), k(E, { to: "body" }, [be.value ? (U(), j("div", {
|
|
3404
3404
|
key: 0,
|
|
3405
3405
|
id: u,
|
|
3406
3406
|
ref_key: "listEl",
|
|
3407
|
-
ref:
|
|
3407
|
+
ref: q,
|
|
3408
3408
|
role: "listbox",
|
|
3409
|
-
"aria-label": t.label ??
|
|
3409
|
+
"aria-label": t.label ?? Y(s).mapAddress,
|
|
3410
3410
|
class: "fixed z-500 max-h-72 overflow-auto rounded-xs bg-surface-container py-1 shadow-elevation-2",
|
|
3411
3411
|
style: te(ce.value)
|
|
3412
|
-
}, [y.value ? (
|
|
3412
|
+
}, [y.value ? (U(), j("div", Ln, [F(S, { size: 20 }), P(J(Y(s).mapSearching), 1)])) : fe.value ? (U(), j("div", Rn, [F(e, {
|
|
3413
3413
|
name: "keyboard_return",
|
|
3414
3414
|
size: 20
|
|
3415
|
-
}),
|
|
3416
|
-
id:
|
|
3415
|
+
}), P(J(Y(s).mapPressEnterToSearch), 1)])) : _.value.length ? (U(!0), j(T, { key: 3 }, K(_.value, (t, n) => (U(), j("div", {
|
|
3416
|
+
id: d(n),
|
|
3417
3417
|
key: n,
|
|
3418
3418
|
role: "option",
|
|
3419
|
-
"aria-selected": n ===
|
|
3420
|
-
class:
|
|
3421
|
-
onMousedown:
|
|
3422
|
-
onMousemove: (e) =>
|
|
3423
|
-
}, [
|
|
3424
|
-
name:
|
|
3419
|
+
"aria-selected": n === N.value,
|
|
3420
|
+
class: V(["flex cursor-pointer items-center gap-3 px-4 py-2 text-on-surface hover:bg-on-surface/8", n === N.value ? "bg-on-surface/12" : ""]),
|
|
3421
|
+
onMousedown: de((e) => he(t), ["prevent"]),
|
|
3422
|
+
onMousemove: (e) => N.value = n
|
|
3423
|
+
}, [F(e, {
|
|
3424
|
+
name: Y(kn)(t.type),
|
|
3425
3425
|
size: 20,
|
|
3426
3426
|
class: "shrink-0 text-on-surface-variant"
|
|
3427
|
-
}, null, 8, ["name"]),
|
|
3427
|
+
}, null, 8, ["name"]), M("span", Vn, [M("span", Hn, J(Se(t.label)[0]), 1), Se(t.label)[1] ? (U(), j("span", Un, J(Se(t.label)[1]), 1)) : A("", !0)])], 42, Bn))), 128)) : (U(), j("div", zn, [F(e, {
|
|
3428
3428
|
name: "search_off",
|
|
3429
3429
|
size: 20
|
|
3430
|
-
}),
|
|
3430
|
+
}), P(J(Y(s).mapNoPlaces), 1)]))], 12, In)) : A("", !0)]))], 64));
|
|
3431
3431
|
}
|
|
3432
3432
|
});
|
|
3433
|
-
export {
|
|
3433
|
+
export { Wn as MAddressField, ke as MMap, Lt as MMapBaseLayers, Be as MMapCluster, be as MMapControl, Sn as MMapDraw, Kt as MMapFeatureInfo, En as MMapFilter, Re as MMapGeoJson, un as MMapHover, nn as MMapIdentify, Nt as MMapLayers, Fe as MMapMarker, gn as MMapMeasure, Le as MMapPopup, lt as MMapRoute, Fn as MMapSearch, Zt as fieldLabel, Qt as formatFieldValue, Yt as genericAdapter, en as identifyFeatures, Dn as nominatimProvider, Xt as orvianAdapter, ut as osrmRouteProvider, pe as setMapWorker, _e as useMap, wn as useMapFilter, $ as useMapLayers };
|
|
3434
3434
|
|
|
3435
3435
|
//# sourceMappingURL=map.js.map
|