@blogmcp/sdk 0.3.2 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/client-types.d.ts +7 -1
- package/dist/core/client.d.ts +25 -1
- package/dist/core/client.js +38 -34
- package/dist/core/consultation-adapter.d.ts +90 -0
- package/dist/core/consultation-adapter.js +200 -0
- package/dist/core/consultations.d.ts +108 -0
- package/dist/core/consultations.js +95 -0
- package/dist/core/errors.d.ts +52 -0
- package/dist/core/errors.js +73 -0
- package/dist/core/index.d.ts +7 -1
- package/dist/core/index.js +80 -64
- package/dist/core/queries.d.ts +16 -1
- package/dist/core/queries.js +198 -61
- package/dist/core/review/format.d.ts +30 -0
- package/dist/core/review/format.js +78 -0
- package/dist/core/review/index.d.ts +6 -0
- package/dist/core/review/index.js +9 -0
- package/dist/core/review/types.d.ts +176 -0
- package/dist/core/review/types.js +9 -0
- package/dist/core/server-only.d.ts +12 -0
- package/dist/core/server-only.js +11 -0
- package/dist/core/types.d.ts +295 -0
- package/dist/packages/mdx-render-vue/dist/composables/useGallery.js +12 -11
- package/dist/packages/mdx-render-vue/dist/composables/useTripMap.js +16 -16
- package/dist/packages/mdx-render-vue/dist/edit/TripMapEdit.vue.js +1 -1
- package/dist/packages/mdx-render-vue/dist/registry.js +21 -22
- package/dist/packages/mdx-render-vue/dist/render/alert/Alert.vue2.js +1 -1
- package/dist/packages/mdx-render-vue/dist/render/badge/Badge.vue2.js +1 -1
- package/dist/packages/mdx-render-vue/dist/render/button/Button.vue2.js +1 -1
- package/dist/packages/mdx-render-vue/dist/render/callout/CalloutDefault.vue.js +1 -1
- package/dist/packages/mdx-render-vue/dist/render/callout/CalloutMinimal.vue.js +1 -1
- package/dist/packages/mdx-render-vue/dist/render/tripmap/TripMapDefault.vue.js +2 -2
- package/dist/packages/tripmap-core/dist/attribution.js +121 -6
- package/dist/packages/tripmap-core/dist/css.js +68 -16
- package/dist/packages/tripmap-core/dist/detail.js +10 -9
- package/dist/packages/tripmap-core/dist/engine.js +285 -247
- package/dist/packages/tripmap-core/dist/export.js +48 -46
- package/dist/packages/tripmap-core/dist/filmstrip.js +30 -17
- package/dist/packages/tripmap-core/dist/framing.js +30 -30
- package/dist/packages/tripmap-core/dist/generated/maplibre-worker.bundle.js +1 -1
- package/dist/packages/tripmap-core/dist/heading.js +8 -0
- package/dist/packages/tripmap-core/dist/href.js +18 -0
- package/dist/packages/tripmap-core/dist/index.js +32 -24
- package/dist/packages/tripmap-core/dist/lightbox.js +31 -29
- package/dist/packages/tripmap-core/dist/line.js +6 -6
- package/dist/packages/tripmap-core/dist/markers.js +47 -43
- package/dist/packages/tripmap-core/dist/nodes.js +56 -43
- package/dist/packages/tripmap-core/dist/playback.js +17 -17
- package/dist/packages/tripmap-core/dist/preload.js +14 -14
- package/dist/packages/tripmap-core/dist/theme.js +21 -21
- package/dist/{node_modules → packages/tripmap-core/node_modules}/maplibre-gl/dist/maplibre-gl.js +1890 -1720
- package/dist/{node_modules → packages/tripmap-core/node_modules}/pmtiles/dist/esm/index.js +1 -1
- package/dist/react/KbMdxContent.js +7 -8
- package/dist/vue/components/KbMdxContent.vue2.js +6 -7
- package/package.json +8 -3
- package/src/core/client-types.ts +13 -2
- package/src/core/client.ts +40 -5
- package/src/core/consultation-adapter.ts +408 -0
- package/src/core/consultations.ts +224 -0
- package/src/core/errors.ts +145 -0
- package/src/core/index.ts +68 -0
- package/src/core/queries.ts +167 -3
- package/src/core/review/format.ts +138 -0
- package/src/core/review/index.ts +22 -0
- package/src/core/review/types.ts +168 -0
- package/src/core/server-only.ts +20 -0
- package/src/core/types.ts +337 -0
- package/dist/_virtual/constants.js +0 -4
- package/dist/_virtual/index.js +0 -2
- package/dist/_virtual/index2.js +0 -4
- package/dist/_virtual/index3.js +0 -2
- package/dist/_virtual/re.js +0 -4
- package/dist/node_modules/@braintree/sanitize-url/dist/constants.js +0 -8
- package/dist/node_modules/@braintree/sanitize-url/dist/index.js +0 -60
- package/dist/node_modules/dompurify/dist/purify.es.js +0 -662
- package/dist/node_modules/semver/classes/comparator.js +0 -56
- package/dist/node_modules/semver/classes/range.js +0 -148
- package/dist/node_modules/semver/classes/semver.js +0 -169
- package/dist/node_modules/semver/functions/clean.js +0 -14
- package/dist/node_modules/semver/functions/cmp.js +0 -39
- package/dist/node_modules/semver/functions/coerce.js +0 -33
- package/dist/node_modules/semver/functions/compare-build.js +0 -14
- package/dist/node_modules/semver/functions/compare-loose.js +0 -11
- package/dist/node_modules/semver/functions/compare.js +0 -11
- package/dist/node_modules/semver/functions/diff.js +0 -24
- package/dist/node_modules/semver/functions/eq.js +0 -11
- package/dist/node_modules/semver/functions/gt.js +0 -11
- package/dist/node_modules/semver/functions/gte.js +0 -11
- package/dist/node_modules/semver/functions/inc.js +0 -21
- package/dist/node_modules/semver/functions/lt.js +0 -11
- package/dist/node_modules/semver/functions/lte.js +0 -11
- package/dist/node_modules/semver/functions/major.js +0 -11
- package/dist/node_modules/semver/functions/minor.js +0 -11
- package/dist/node_modules/semver/functions/neq.js +0 -11
- package/dist/node_modules/semver/functions/parse.js +0 -21
- package/dist/node_modules/semver/functions/patch.js +0 -11
- package/dist/node_modules/semver/functions/prerelease.js +0 -14
- package/dist/node_modules/semver/functions/rcompare.js +0 -11
- package/dist/node_modules/semver/functions/rsort.js +0 -11
- package/dist/node_modules/semver/functions/satisfies.js +0 -18
- package/dist/node_modules/semver/functions/sort.js +0 -11
- package/dist/node_modules/semver/functions/valid.js +0 -14
- package/dist/node_modules/semver/index.js +0 -97
- package/dist/node_modules/semver/internal/constants.js +0 -28
- package/dist/node_modules/semver/internal/debug.js +0 -8
- package/dist/node_modules/semver/internal/identifiers.js +0 -18
- package/dist/node_modules/semver/internal/lrucache.js +0 -32
- package/dist/node_modules/semver/internal/parse-options.js +0 -10
- package/dist/node_modules/semver/internal/re.js +0 -32
- package/dist/node_modules/semver/ranges/gtr.js +0 -11
- package/dist/node_modules/semver/ranges/intersects.js +0 -11
- package/dist/node_modules/semver/ranges/ltr.js +0 -11
- package/dist/node_modules/semver/ranges/max-satisfying.js +0 -22
- package/dist/node_modules/semver/ranges/min-satisfying.js +0 -22
- package/dist/node_modules/semver/ranges/min-version.js +0 -42
- package/dist/node_modules/semver/ranges/outside.js +0 -44
- package/dist/node_modules/semver/ranges/simplify.js +0 -24
- package/dist/node_modules/semver/ranges/subset.js +0 -94
- package/dist/node_modules/semver/ranges/to-comparators.js +0 -11
- package/dist/node_modules/semver/ranges/valid.js +0 -17
- package/dist/packages/mdx-schema/dist/composables/useMdxParsing.js +0 -389
- package/dist/packages/mdx-schema/dist/metadata/index.js +0 -526
- package/dist/packages/mdx-schema/dist/prepareProps.js +0 -46
- package/dist/packages/mdx-schema/dist/styles/index.js +0 -141
- package/dist/packages/mdx-schema/dist/tripmap.js +0 -88
- package/dist/packages/mdx-schema/dist/types/index.js +0 -26
- package/dist/packages/sanitize/dist/html.js +0 -89
- /package/dist/{node_modules → packages/tripmap-core/node_modules}/maplibre-gl/dist/maplibre-gl-shared.js +0 -0
|
@@ -1,368 +1,406 @@
|
|
|
1
|
-
import { Map as
|
|
2
|
-
import { Protocol as
|
|
3
|
-
import { ImagePreloader as
|
|
4
|
-
import { mapyRouteUrl as
|
|
5
|
-
import { Lightbox as
|
|
6
|
-
import { DetailPanel as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function Ke() {
|
|
21
|
-
if (oe) return;
|
|
22
|
-
const l = new Le();
|
|
23
|
-
Ye("pmtiles", l.tile), oe = !0;
|
|
24
|
-
}
|
|
1
|
+
import { Map as be, NavigationControl as we, FullscreenControl as ve, GeolocateControl as xe, Popup as Ce, setWorkerUrl as Ee, Marker as Le } from "../node_modules/maplibre-gl/dist/maplibre-gl.js";
|
|
2
|
+
import { Protocol as ke } from "../node_modules/pmtiles/dist/esm/index.js";
|
|
3
|
+
import { ImagePreloader as Me } from "./preload.js";
|
|
4
|
+
import { mapyRouteUrl as Ne, googleMapsRouteUrl as _e, buildGpx as Se, gpxFileName as Ae } from "./export.js";
|
|
5
|
+
import { Lightbox as De } from "./lightbox.js";
|
|
6
|
+
import { DetailPanel as Re } from "./detail.js";
|
|
7
|
+
import { headingRotation as Pe } from "./heading.js";
|
|
8
|
+
import Te from "./generated/maplibre-worker.bundle.js";
|
|
9
|
+
import { TripMapAttributionControl as Fe, buildAttributions as Ue } from "./attribution.js";
|
|
10
|
+
import { injectTripMapCss as Ie } from "./css.js";
|
|
11
|
+
import { Filmstrip as ze } from "./filmstrip.js";
|
|
12
|
+
import { computeFramingBounds as Be } from "./framing.js";
|
|
13
|
+
import { buildLineFeature as Oe, LINE_LAYER_PAINT as He, LINE_LAYER_LAYOUT as Ge } from "./line.js";
|
|
14
|
+
import { createPopupContent as qe, setMarkerActive as W, MarkerPool as $e, createClusterMarkerEl as je, createNodeMarkerEl as We } from "./markers.js";
|
|
15
|
+
import { formatTimeHHMM as Ze, lineNodes as Ve } from "./nodes.js";
|
|
16
|
+
import { startPlayback as Ye } from "./playback.js";
|
|
17
|
+
import { watchSystemTheme as Je, resolveTheme as Z, carryTripMapLayers as Ke } from "./theme.js";
|
|
18
|
+
import { Mn as Qe } from "../node_modules/maplibre-gl/dist/maplibre-gl-shared.js";
|
|
19
|
+
const w = "tripmap-nodes", V = "tripmap-line", Xe = "tripmap-line-layer", et = "tripmap-nodes-anchor", tt = 17;
|
|
25
20
|
let ae = !1;
|
|
26
|
-
function
|
|
27
|
-
if (
|
|
28
|
-
|
|
21
|
+
function rt() {
|
|
22
|
+
if (ae) return;
|
|
23
|
+
const i = new ke();
|
|
24
|
+
Qe("pmtiles", i.tile), ae = !0;
|
|
25
|
+
}
|
|
26
|
+
let le = !1;
|
|
27
|
+
function nt() {
|
|
28
|
+
if (!le) {
|
|
29
|
+
le = !0;
|
|
29
30
|
try {
|
|
30
|
-
const
|
|
31
|
-
|
|
31
|
+
const i = new Blob([Te], { type: "text/javascript" });
|
|
32
|
+
Ee(URL.createObjectURL(i));
|
|
32
33
|
} catch {
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function ie(i) {
|
|
37
38
|
return {
|
|
38
39
|
type: "FeatureCollection",
|
|
39
|
-
features:
|
|
40
|
+
features: i.map((r) => ({
|
|
40
41
|
type: "Feature",
|
|
41
|
-
geometry: { type: "Point", coordinates: [
|
|
42
|
-
properties: { id:
|
|
42
|
+
geometry: { type: "Point", coordinates: [r.lng, r.lat] },
|
|
43
|
+
properties: { id: r.id }
|
|
43
44
|
}))
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
const f =
|
|
49
|
-
f.className = "tripmap__map",
|
|
50
|
-
let d = [], _ = /* @__PURE__ */ new Map(),
|
|
51
|
-
const
|
|
47
|
+
function Ct(i, r) {
|
|
48
|
+
nt(), rt(), Ie(i.ownerDocument), i.classList.add("tripmap");
|
|
49
|
+
const f = i.ownerDocument.createElement("div");
|
|
50
|
+
f.className = "tripmap__map", i.appendChild(f);
|
|
51
|
+
let d = [], _ = /* @__PURE__ */ new Map(), S = null, p = !1, A = !1, Y = !1, x = null, P = null, B = !1;
|
|
52
|
+
const J = (e) => Z(e) === "dark" ? r.darkStyleUrl : r.styleUrl, l = new be({
|
|
52
53
|
container: f,
|
|
53
|
-
style:
|
|
54
|
-
center:
|
|
55
|
-
zoom:
|
|
54
|
+
style: J(r.theme),
|
|
55
|
+
center: r.initialView?.center ?? [0, 0],
|
|
56
|
+
zoom: r.initialView?.zoom ?? 1,
|
|
56
57
|
attributionControl: !1,
|
|
57
58
|
locale: {
|
|
58
|
-
"FullscreenControl.Enter":
|
|
59
|
-
"FullscreenControl.Exit":
|
|
59
|
+
"FullscreenControl.Enter": r.labels.fullscreen,
|
|
60
|
+
"FullscreenControl.Exit": r.labels.exitFullscreen,
|
|
61
|
+
"GeolocateControl.FindMyLocation": r.labels.findMyLocation,
|
|
62
|
+
"GeolocateControl.LocationNotAvailable": r.labels.locationNotAvailable
|
|
60
63
|
}
|
|
61
64
|
});
|
|
62
|
-
r.addControl(
|
|
63
|
-
new
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
if (l.addControl(new Fe(Ue(r.extraAttribution)), "bottom-right"), l.addControl(new we({ showCompass: !1 }), "top-right"), r.showFullscreen && l.addControl(new ve({ container: i }), "top-right"), r.showGeolocate) {
|
|
66
|
+
const e = new xe({
|
|
67
|
+
trackUserLocation: !0,
|
|
68
|
+
showUserLocation: !0,
|
|
69
|
+
showAccuracyCircle: !0,
|
|
70
|
+
positionOptions: { enableHighAccuracy: !0, timeout: 8e3 },
|
|
71
|
+
// Cap the zoom: a 5 m fix would otherwise slam the camera to z20 and
|
|
72
|
+
// lose the route the reader is trying to follow.
|
|
73
|
+
fitBoundsOptions: { maxZoom: 16 }
|
|
74
|
+
});
|
|
75
|
+
l.addControl(e, "top-right");
|
|
76
|
+
let o = null;
|
|
77
|
+
const t = () => {
|
|
78
|
+
const n = f.querySelector(".maplibregl-user-location-dot");
|
|
79
|
+
if (!n) return;
|
|
80
|
+
let a = n.querySelector(".tripmap-heading");
|
|
81
|
+
a || (a = i.ownerDocument.createElement("div"), a.className = "tripmap-heading", a.setAttribute("aria-hidden", "true"), n.appendChild(a));
|
|
82
|
+
const s = Pe(o, l.getBearing());
|
|
83
|
+
if (s == null) {
|
|
84
|
+
n.classList.remove("tripmap-user--heading");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
n.style.setProperty("--tripmap-heading", `${s}deg`), n.classList.add("tripmap-user--heading");
|
|
88
|
+
};
|
|
89
|
+
e.on("geolocate", (n) => {
|
|
90
|
+
const a = n?.coords?.heading;
|
|
91
|
+
o = typeof a == "number" && Number.isFinite(a) ? a : null, t();
|
|
92
|
+
}), e.on("trackuserlocationend", () => {
|
|
93
|
+
o = null;
|
|
94
|
+
}), l.on("rotate", t);
|
|
95
|
+
}
|
|
96
|
+
const T = r.watermark ? (() => {
|
|
97
|
+
const e = i.ownerDocument.createElement("img");
|
|
98
|
+
return e.className = "tripmap__watermark", e.alt = r.watermark.alt ?? "", e.decoding = "async", r.watermark.height && (e.style.height = `${r.watermark.height}px`), f.appendChild(e), e;
|
|
99
|
+
})() : null;
|
|
100
|
+
function O() {
|
|
101
|
+
const e = r.watermark;
|
|
102
|
+
if (!T || !e) return;
|
|
103
|
+
const t = i.dataset.tripmapTheme === "dark" && e.darkSrc || e.src;
|
|
104
|
+
T.getAttribute("src") !== t && T.setAttribute("src", t), T.hidden = i.ownerDocument.fullscreenElement !== i;
|
|
105
|
+
}
|
|
106
|
+
const H = i.ownerDocument, K = () => {
|
|
107
|
+
p || (l.resize(), G(), N(), O());
|
|
70
108
|
};
|
|
71
|
-
|
|
72
|
-
function
|
|
73
|
-
const e = f.clientHeight || 0,
|
|
74
|
-
|
|
109
|
+
H.addEventListener("fullscreenchange", K);
|
|
110
|
+
function G() {
|
|
111
|
+
const e = f.clientHeight || 0, o = e > 0 ? Math.max(96, Math.min(180, Math.round(e * 0.4))) : 180;
|
|
112
|
+
i.style.setProperty("--tripmap-popup-img-max", `${o}px`), e > 0 && i.style.setProperty("--tripmap-map-h", `${e}px`);
|
|
75
113
|
}
|
|
76
|
-
|
|
77
|
-
const
|
|
114
|
+
G(), l.on("resize", G);
|
|
115
|
+
const D = new Me(H);
|
|
78
116
|
typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
|
|
79
|
-
|
|
80
|
-
}),
|
|
81
|
-
|
|
117
|
+
p || l.resize();
|
|
118
|
+
}), l.on("error", (e) => {
|
|
119
|
+
r.events.onError?.(e?.error instanceof Error ? e.error : new Error("tripmap: map error"));
|
|
82
120
|
});
|
|
83
|
-
const
|
|
84
|
-
mount: (e,
|
|
85
|
-
move: (e,
|
|
86
|
-
e.setLngLat(
|
|
121
|
+
const F = new $e({
|
|
122
|
+
mount: (e, o) => new Le({ element: e }).setLngLat(o).addTo(l),
|
|
123
|
+
move: (e, o) => {
|
|
124
|
+
e.setLngLat(o);
|
|
87
125
|
},
|
|
88
126
|
unmount: (e) => e.remove()
|
|
89
|
-
});
|
|
90
|
-
let
|
|
91
|
-
|
|
92
|
-
formatTime:
|
|
127
|
+
}), U = r.showTime !== !1 ? Ze : () => "";
|
|
128
|
+
let C = null;
|
|
129
|
+
r.showFilmstrip && (C = new ze(i, {
|
|
130
|
+
formatTime: U,
|
|
93
131
|
onSelect: (e) => {
|
|
94
|
-
|
|
132
|
+
M(e.id, { fly: !0 }), z(e);
|
|
95
133
|
}
|
|
96
134
|
}));
|
|
97
|
-
let
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
{ close:
|
|
135
|
+
let q = null, I = null;
|
|
136
|
+
const Q = new De(
|
|
137
|
+
i,
|
|
138
|
+
{ close: r.labels.lightboxClose, prev: r.labels.lightboxPrev, next: r.labels.lightboxNext },
|
|
101
139
|
{
|
|
102
|
-
formatTime:
|
|
140
|
+
formatTime: U,
|
|
103
141
|
preload: (e) => {
|
|
104
|
-
|
|
142
|
+
D.preload(e);
|
|
105
143
|
},
|
|
106
144
|
onChange: (e) => {
|
|
107
|
-
|
|
145
|
+
I = e, e.id !== S && M(e.id, { fly: !1 });
|
|
108
146
|
},
|
|
109
147
|
onClose: () => {
|
|
110
|
-
const e =
|
|
111
|
-
|
|
148
|
+
const e = I;
|
|
149
|
+
I = null, e && e.id !== q && !p && z(e), q = null;
|
|
112
150
|
}
|
|
113
151
|
}
|
|
114
152
|
);
|
|
115
|
-
function
|
|
116
|
-
|
|
153
|
+
function X(e) {
|
|
154
|
+
q = e.id, I = e, Q.open(d, e.id);
|
|
117
155
|
}
|
|
118
|
-
let
|
|
119
|
-
const se = !
|
|
120
|
-
|
|
156
|
+
let ee = !1;
|
|
157
|
+
const se = !r.detailHost, E = r.detail === "panel" ? new Re(
|
|
158
|
+
r.detailHost ?? i,
|
|
121
159
|
{
|
|
122
|
-
formatTime:
|
|
123
|
-
onImageClick:
|
|
124
|
-
takePreloaded: (e) =>
|
|
160
|
+
formatTime: U,
|
|
161
|
+
onImageClick: X,
|
|
162
|
+
takePreloaded: (e) => D.take(e)
|
|
125
163
|
},
|
|
126
|
-
{ zoomImage:
|
|
164
|
+
{ zoomImage: r.labels.zoomImage }
|
|
127
165
|
) : null;
|
|
128
|
-
function
|
|
129
|
-
|
|
166
|
+
function z(e) {
|
|
167
|
+
E ? E.show(e) : de(e);
|
|
130
168
|
}
|
|
131
|
-
function
|
|
132
|
-
if (!
|
|
133
|
-
const e =
|
|
169
|
+
function ce() {
|
|
170
|
+
if (!E || !se || ee) return;
|
|
171
|
+
const e = i.getBoundingClientRect().height;
|
|
134
172
|
if (e <= 0) return;
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
|
|
173
|
+
ee = !0;
|
|
174
|
+
const o = C ? C.element.getBoundingClientRect().height : 0;
|
|
175
|
+
i.classList.add("tripmap--panel"), i.style.height = "auto", f.style.flex = "0 0 auto", f.style.height = `${Math.max(180, Math.round(e - o - (o > 0 ? 8 : 0)))}px`, l.resize();
|
|
138
176
|
}
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
const g =
|
|
142
|
-
g.type = "button", g.className = "tripmap__ctrl tripmap__play", g.textContent =
|
|
143
|
-
|
|
144
|
-
}),
|
|
145
|
-
const v =
|
|
177
|
+
const L = i.ownerDocument.createElement("div");
|
|
178
|
+
L.className = "tripmap__controls";
|
|
179
|
+
const g = i.ownerDocument.createElement("button");
|
|
180
|
+
g.type = "button", g.className = "tripmap__ctrl tripmap__play", g.textContent = r.labels.play, g.addEventListener("click", () => {
|
|
181
|
+
x ? x.stop() : oe();
|
|
182
|
+
}), L.appendChild(g);
|
|
183
|
+
const v = i.ownerDocument.createElement("div");
|
|
146
184
|
v.className = "tripmap__export";
|
|
147
|
-
const y =
|
|
148
|
-
y.type = "button", y.className = "tripmap__ctrl tripmap__export-btn", y.textContent =
|
|
149
|
-
const h =
|
|
150
|
-
h.className = "tripmap__menu", h.setAttribute("role", "menu"), h.hidden = !0, v.appendChild(y), v.appendChild(h),
|
|
151
|
-
const
|
|
152
|
-
v.contains(e.target) ||
|
|
153
|
-
},
|
|
154
|
-
e.key === "Escape" &&
|
|
185
|
+
const y = i.ownerDocument.createElement("button");
|
|
186
|
+
y.type = "button", y.className = "tripmap__ctrl tripmap__export-btn", y.textContent = r.labels.export, y.setAttribute("aria-haspopup", "menu"), y.setAttribute("aria-expanded", "false");
|
|
187
|
+
const h = i.ownerDocument.createElement("div");
|
|
188
|
+
h.className = "tripmap__menu", h.setAttribute("role", "menu"), h.hidden = !0, v.appendChild(y), v.appendChild(h), L.appendChild(v);
|
|
189
|
+
const te = (e) => {
|
|
190
|
+
v.contains(e.target) || k();
|
|
191
|
+
}, re = (e) => {
|
|
192
|
+
e.key === "Escape" && k();
|
|
155
193
|
};
|
|
156
|
-
function
|
|
157
|
-
h.hidden || (h.hidden = !0, y.setAttribute("aria-expanded", "false"),
|
|
194
|
+
function k() {
|
|
195
|
+
h.hidden || (h.hidden = !0, y.setAttribute("aria-expanded", "false"), i.ownerDocument.removeEventListener("pointerdown", te, !0), i.ownerDocument.removeEventListener("keydown", re));
|
|
158
196
|
}
|
|
159
|
-
function
|
|
160
|
-
const e =
|
|
197
|
+
function ue() {
|
|
198
|
+
const e = i.ownerDocument;
|
|
161
199
|
h.textContent = "";
|
|
162
|
-
const
|
|
200
|
+
const o = (s, c, u) => {
|
|
163
201
|
const m = e.createElement(s);
|
|
164
|
-
if (m.className = "tripmap__menu-item", m.setAttribute("role", "menuitem"), m.appendChild(e.createTextNode(c)),
|
|
202
|
+
if (m.className = "tripmap__menu-item", m.setAttribute("role", "menuitem"), m.appendChild(e.createTextNode(c)), u) {
|
|
165
203
|
const b = e.createElement("small");
|
|
166
|
-
b.textContent =
|
|
204
|
+
b.textContent = u, m.appendChild(b);
|
|
167
205
|
}
|
|
168
206
|
return h.appendChild(m), m;
|
|
169
|
-
}, t =
|
|
207
|
+
}, t = o("button", r.labels.exportGpx, r.labels.exportGpxHint);
|
|
170
208
|
t.type = "button", t.addEventListener("click", () => {
|
|
171
|
-
|
|
209
|
+
k(), me();
|
|
172
210
|
});
|
|
173
|
-
const
|
|
174
|
-
[
|
|
175
|
-
[
|
|
211
|
+
const n = e.defaultView?.matchMedia?.("(pointer: coarse)").matches ?? !1, a = [
|
|
212
|
+
[r.labels.openInMapy, Ne(d)],
|
|
213
|
+
[r.labels.openInGoogleMaps, _e(d, { maxWaypoints: n ? 3 : 9 })]
|
|
176
214
|
];
|
|
177
|
-
for (const [s, c] of
|
|
215
|
+
for (const [s, c] of a) {
|
|
178
216
|
if (!c) continue;
|
|
179
|
-
const
|
|
180
|
-
|
|
217
|
+
const u = o("a", s);
|
|
218
|
+
u.href = c, u.target = "_blank", u.rel = "noopener", u.addEventListener("click", () => k());
|
|
181
219
|
}
|
|
182
|
-
h.hidden = !1, y.setAttribute("aria-expanded", "true"), e.addEventListener("pointerdown",
|
|
220
|
+
h.hidden = !1, y.setAttribute("aria-expanded", "true"), e.addEventListener("pointerdown", te, !0), e.addEventListener("keydown", re);
|
|
183
221
|
}
|
|
184
222
|
y.addEventListener("click", () => {
|
|
185
|
-
h.hidden ?
|
|
223
|
+
h.hidden ? ue() : k();
|
|
186
224
|
});
|
|
187
|
-
async function
|
|
188
|
-
const e =
|
|
225
|
+
async function me() {
|
|
226
|
+
const e = Se(d, { name: r.title });
|
|
189
227
|
if (!e) return;
|
|
190
|
-
const
|
|
228
|
+
const o = i.ownerDocument, t = o.defaultView, n = Ae(r.title), a = "application/gpx+xml";
|
|
191
229
|
if (t && typeof t.File == "function" && t.navigator?.canShare) {
|
|
192
|
-
const m = new t.File([e],
|
|
230
|
+
const m = new t.File([e], n, { type: a });
|
|
193
231
|
if (t.navigator.canShare({ files: [m] }))
|
|
194
232
|
try {
|
|
195
|
-
await t.navigator.share({ files: [m], title:
|
|
233
|
+
await t.navigator.share({ files: [m], title: r.title });
|
|
196
234
|
return;
|
|
197
235
|
} catch (b) {
|
|
198
236
|
if (b?.name === "AbortError") return;
|
|
199
237
|
}
|
|
200
238
|
}
|
|
201
|
-
const s = new Blob([e], { type:
|
|
202
|
-
|
|
239
|
+
const s = new Blob([e], { type: a }), c = URL.createObjectURL(s), u = o.createElement("a");
|
|
240
|
+
u.href = c, u.download = n, u.rel = "noopener", u.style.display = "none", o.body.appendChild(u), u.click(), u.remove(), setTimeout(() => URL.revokeObjectURL(c), 1e4);
|
|
203
241
|
}
|
|
204
|
-
f.appendChild(
|
|
205
|
-
function
|
|
206
|
-
|
|
207
|
-
const
|
|
242
|
+
f.appendChild(L), L.style.display = "none";
|
|
243
|
+
function de(e) {
|
|
244
|
+
P?.remove();
|
|
245
|
+
const o = e.imageUrl || e.thumbnailUrl, t = o ? D.take(o) : null, n = qe(e, U, {
|
|
208
246
|
image: t ?? void 0,
|
|
209
|
-
onImageClick:
|
|
210
|
-
zoomLabel:
|
|
211
|
-
}),
|
|
212
|
-
|
|
247
|
+
onImageClick: X,
|
|
248
|
+
zoomLabel: r.labels.zoomImage
|
|
249
|
+
}), a = new Ce({ offset: 26, maxWidth: "280px", className: "tripmap-popup-anchor" }).setLngLat([e.lng, e.lat]).setDOMContent(n).addTo(l);
|
|
250
|
+
P = a;
|
|
213
251
|
const s = () => {
|
|
214
|
-
!
|
|
252
|
+
!p && P === a && pe(a);
|
|
215
253
|
};
|
|
216
254
|
requestAnimationFrame(s);
|
|
217
|
-
const c =
|
|
255
|
+
const c = n.querySelector("img");
|
|
218
256
|
c && !c.complete && c.addEventListener("load", s, { once: !0 });
|
|
219
257
|
}
|
|
220
|
-
function
|
|
221
|
-
const
|
|
222
|
-
if (!
|
|
223
|
-
const t =
|
|
224
|
-
if (t.width === 0 ||
|
|
225
|
-
const
|
|
258
|
+
function pe(e) {
|
|
259
|
+
const o = e.getElement();
|
|
260
|
+
if (!o) return;
|
|
261
|
+
const t = o.getBoundingClientRect(), n = f.getBoundingClientRect();
|
|
262
|
+
if (t.width === 0 || n.width === 0) return;
|
|
263
|
+
const a = 8;
|
|
226
264
|
let s = 0, c = 0;
|
|
227
|
-
t.width >
|
|
265
|
+
t.width > n.width - 2 * a ? s = t.left - (n.left + a) : t.right > n.right - a ? s = t.right - (n.right - a) : t.left < n.left + a && (s = t.left - (n.left + a)), t.height > n.height - 2 * a ? c = t.top - (n.top + a) : t.bottom > n.bottom - a ? c = t.bottom - (n.bottom - a) : t.top < n.top + a && (c = t.top - (n.top + a)), !(Math.abs(s) < 1 && Math.abs(c) < 1) && l.panBy([s, c], { duration: 300, essential: !0 });
|
|
228
266
|
}
|
|
229
|
-
function
|
|
230
|
-
if (!
|
|
231
|
-
if (
|
|
267
|
+
function M(e, o = {}) {
|
|
268
|
+
if (!p) {
|
|
269
|
+
if (S && W(F.get(`n:${S}`), !1), S = e, e && W(F.get(`n:${e}`), !0), C?.setActive(e), e && o.fly) {
|
|
232
270
|
const t = _.get(e);
|
|
233
|
-
t &&
|
|
271
|
+
t && l.flyTo({
|
|
234
272
|
center: [t.lng, t.lat],
|
|
235
|
-
zoom: Math.max(
|
|
273
|
+
zoom: Math.max(l.getZoom(), 15),
|
|
236
274
|
essential: !0
|
|
237
275
|
});
|
|
238
276
|
}
|
|
239
|
-
|
|
277
|
+
r.events.onActiveNodeChange?.(e);
|
|
240
278
|
}
|
|
241
279
|
}
|
|
242
|
-
function
|
|
243
|
-
|
|
244
|
-
|
|
280
|
+
function N() {
|
|
281
|
+
B || p || (B = !0, requestAnimationFrame(() => {
|
|
282
|
+
B = !1, fe();
|
|
245
283
|
}));
|
|
246
284
|
}
|
|
247
|
-
function
|
|
248
|
-
if (
|
|
249
|
-
const e =
|
|
250
|
-
for (const
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
253
|
-
const s =
|
|
285
|
+
function fe() {
|
|
286
|
+
if (p || !A || !l.getSource(w)) return;
|
|
287
|
+
const e = l.querySourceFeatures(w), o = [], t = /* @__PURE__ */ new Set();
|
|
288
|
+
for (const n of e) {
|
|
289
|
+
const a = n.geometry;
|
|
290
|
+
if (a.type !== "Point") continue;
|
|
291
|
+
const s = a.coordinates, c = n.properties;
|
|
254
292
|
if (c.cluster) {
|
|
255
|
-
const
|
|
293
|
+
const u = c.cluster_id, m = `c:${u}`;
|
|
256
294
|
if (t.has(m)) continue;
|
|
257
295
|
t.add(m);
|
|
258
296
|
const b = c.point_count ?? 0;
|
|
259
|
-
|
|
297
|
+
o.push({
|
|
260
298
|
key: m,
|
|
261
299
|
lngLat: s,
|
|
262
300
|
createEl: () => {
|
|
263
|
-
const
|
|
264
|
-
return
|
|
301
|
+
const R = je(b, void 0, () => ge(u, s));
|
|
302
|
+
return he(R, u), R;
|
|
265
303
|
}
|
|
266
304
|
});
|
|
267
305
|
} else {
|
|
268
|
-
const
|
|
306
|
+
const u = c.id, m = `n:${u}`;
|
|
269
307
|
if (t.has(m)) continue;
|
|
270
308
|
t.add(m);
|
|
271
|
-
const b = _.get(
|
|
309
|
+
const b = _.get(u);
|
|
272
310
|
if (!b) continue;
|
|
273
|
-
|
|
311
|
+
o.push({
|
|
274
312
|
key: m,
|
|
275
313
|
lngLat: s,
|
|
276
314
|
createEl: () => {
|
|
277
|
-
const
|
|
278
|
-
|
|
315
|
+
const R = We(b, (j) => {
|
|
316
|
+
M(j.id, { fly: !1 }), z(j), r.events.onNodeClick?.(j);
|
|
279
317
|
});
|
|
280
|
-
return
|
|
318
|
+
return u === S && W(R, !0), R;
|
|
281
319
|
}
|
|
282
320
|
});
|
|
283
321
|
}
|
|
284
322
|
}
|
|
285
|
-
|
|
323
|
+
F.sync(o);
|
|
286
324
|
}
|
|
287
|
-
async function
|
|
325
|
+
async function he(e, o) {
|
|
288
326
|
try {
|
|
289
|
-
const t =
|
|
327
|
+
const t = l.getSource(w);
|
|
290
328
|
if (!t) return;
|
|
291
|
-
const
|
|
292
|
-
if (!
|
|
293
|
-
const
|
|
294
|
-
|
|
329
|
+
const a = (await t.getClusterLeaves(o, 1, 0))?.[0]?.properties?.id, s = a ? _.get(a)?.thumbnailUrl : void 0;
|
|
330
|
+
if (!s || !e.isConnected) return;
|
|
331
|
+
const c = e.ownerDocument.createElement("img");
|
|
332
|
+
c.src = s, c.alt = "", c.loading = "lazy", c.decoding = "async", c.draggable = !1, c.className = "tripmap-marker__img", e.prepend(c);
|
|
295
333
|
} catch {
|
|
296
334
|
}
|
|
297
335
|
}
|
|
298
|
-
function
|
|
299
|
-
const t =
|
|
300
|
-
t && (t.getClusterExpansionZoom(e).then((
|
|
301
|
-
|
|
336
|
+
function ge(e, o) {
|
|
337
|
+
const t = l.getSource(w);
|
|
338
|
+
t && (t.getClusterExpansionZoom(e).then((n) => {
|
|
339
|
+
p || l.easeTo({ center: o, zoom: Math.min(n + 0.5, 19) });
|
|
302
340
|
}).catch(() => {
|
|
303
|
-
}), t.getClusterLeaves(e, 1, 0).then((
|
|
304
|
-
const
|
|
305
|
-
|
|
341
|
+
}), t.getClusterLeaves(e, 1, 0).then((n) => {
|
|
342
|
+
const a = n?.[0]?.properties?.id, s = a ? _.get(a) : void 0;
|
|
343
|
+
p || !s || (M(s.id, { fly: !1 }), E && E.show(s));
|
|
306
344
|
}).catch(() => {
|
|
307
345
|
}));
|
|
308
346
|
}
|
|
309
|
-
function
|
|
310
|
-
if (
|
|
311
|
-
const e =
|
|
312
|
-
e ? e.setData(
|
|
347
|
+
function $() {
|
|
348
|
+
if (p || !A) return;
|
|
349
|
+
const e = l.getSource(w);
|
|
350
|
+
e ? e.setData(ie(d)) : (l.addSource(w, {
|
|
313
351
|
type: "geojson",
|
|
314
|
-
data:
|
|
315
|
-
cluster:
|
|
316
|
-
clusterRadius:
|
|
317
|
-
clusterMaxZoom:
|
|
318
|
-
}),
|
|
319
|
-
id:
|
|
352
|
+
data: ie(d),
|
|
353
|
+
cluster: r.cluster,
|
|
354
|
+
clusterRadius: r.clusterRadius,
|
|
355
|
+
clusterMaxZoom: tt
|
|
356
|
+
}), l.addLayer({
|
|
357
|
+
id: et,
|
|
320
358
|
type: "circle",
|
|
321
359
|
source: w,
|
|
322
360
|
paint: { "circle-radius": 0, "circle-opacity": 0 }
|
|
323
361
|
}));
|
|
324
|
-
const
|
|
325
|
-
t ? t.setData(
|
|
326
|
-
id:
|
|
362
|
+
const o = r.showLine ? Oe(d) : null, t = l.getSource(V), n = o ?? { type: "FeatureCollection", features: [] };
|
|
363
|
+
t ? t.setData(n) : o && (l.addSource(V, { type: "geojson", data: n, lineMetrics: !0 }), l.addLayer({
|
|
364
|
+
id: Xe,
|
|
327
365
|
type: "line",
|
|
328
|
-
source:
|
|
329
|
-
layout:
|
|
330
|
-
paint:
|
|
366
|
+
source: V,
|
|
367
|
+
layout: Ge,
|
|
368
|
+
paint: He
|
|
331
369
|
}));
|
|
332
|
-
const
|
|
333
|
-
if (g.hidden = !(
|
|
334
|
-
const c =
|
|
335
|
-
c && (
|
|
370
|
+
const a = Ve(d).length, s = a >= 2;
|
|
371
|
+
if (g.hidden = !(r.showPlayback && s), v.hidden = !(r.showExport && s), L.style.display = g.hidden && v.hidden ? "none" : "", i.dataset.tripmapNodes = String(d.length), i.dataset.tripmapRoute = String(a), i.dataset.tripmapLine = String(!!o), i.dataset.tripmapTheme = Z(r.theme), O(), C?.setNodes(d), d.length > 0 && ce(), !Y && d.length > 0 && !r.initialView?.center) {
|
|
372
|
+
const c = Be(d);
|
|
373
|
+
c && (l.fitBounds(c, { padding: 56, maxZoom: 15, duration: 0 }), Y = !0);
|
|
336
374
|
}
|
|
337
|
-
|
|
375
|
+
N();
|
|
338
376
|
}
|
|
339
|
-
|
|
340
|
-
A = !0,
|
|
341
|
-
}),
|
|
342
|
-
e.sourceId === w && e.isSourceLoaded &&
|
|
377
|
+
l.on("load", () => {
|
|
378
|
+
A = !0, $(), r.events.onReady?.();
|
|
379
|
+
}), l.on("moveend", N), l.on("zoomend", N), l.on("idle", N), l.on("sourcedata", (e) => {
|
|
380
|
+
e.sourceId === w && e.isSourceLoaded && N();
|
|
343
381
|
});
|
|
344
|
-
const
|
|
345
|
-
|
|
382
|
+
const ye = r.theme === "auto" ? Je(() => {
|
|
383
|
+
p || ne("auto");
|
|
346
384
|
}) : () => {
|
|
347
385
|
};
|
|
348
|
-
function
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
transformStyle: (t,
|
|
353
|
-
}),
|
|
354
|
-
A = !0,
|
|
386
|
+
function ne(e) {
|
|
387
|
+
if (p) return;
|
|
388
|
+
const o = J(e);
|
|
389
|
+
i.dataset.tripmapTheme = Z(e), O(), A = !1, l.setStyle(o, {
|
|
390
|
+
transformStyle: (t, n) => Ke(t, n)
|
|
391
|
+
}), l.once("styledata", () => {
|
|
392
|
+
A = !0, $();
|
|
355
393
|
});
|
|
356
394
|
}
|
|
357
|
-
function
|
|
358
|
-
|
|
359
|
-
const
|
|
395
|
+
function oe(e = {}) {
|
|
396
|
+
x?.stop(), g.textContent = r.labels.stop;
|
|
397
|
+
const o = Ye(
|
|
360
398
|
d,
|
|
361
399
|
{
|
|
362
|
-
flyTo: (t) => new Promise((
|
|
363
|
-
|
|
400
|
+
flyTo: (t) => new Promise((n) => {
|
|
401
|
+
l.once("moveend", () => n()), l.flyTo({
|
|
364
402
|
center: [t.lng, t.lat],
|
|
365
|
-
zoom: Math.max(
|
|
403
|
+
zoom: Math.max(l.getZoom(), 14),
|
|
366
404
|
speed: 0.9,
|
|
367
405
|
essential: !0,
|
|
368
406
|
// Land the node in the upper third so its popup (which opens
|
|
@@ -371,40 +409,40 @@ function gt(l, n) {
|
|
|
371
409
|
});
|
|
372
410
|
}),
|
|
373
411
|
showNode: (t) => {
|
|
374
|
-
|
|
412
|
+
M(t.id, { fly: !1 }), z(t);
|
|
375
413
|
},
|
|
376
414
|
preload: (t) => {
|
|
377
|
-
const
|
|
378
|
-
return
|
|
415
|
+
const n = t.imageUrl || t.thumbnailUrl;
|
|
416
|
+
return n ? D.preload(n) : void 0;
|
|
379
417
|
},
|
|
380
418
|
onDone: () => {
|
|
381
|
-
|
|
419
|
+
x = null, g.textContent = r.labels.play;
|
|
382
420
|
},
|
|
383
421
|
onUserInterrupt: (t) => {
|
|
384
|
-
const
|
|
385
|
-
return
|
|
422
|
+
const n = l.getCanvasContainer(), a = ["pointerdown", "wheel"];
|
|
423
|
+
return a.forEach((s) => n.addEventListener(s, t, { passive: !0 })), () => a.forEach((s) => n.removeEventListener(s, t));
|
|
386
424
|
}
|
|
387
425
|
},
|
|
388
426
|
e
|
|
389
427
|
);
|
|
390
|
-
return
|
|
428
|
+
return x = o, o;
|
|
391
429
|
}
|
|
392
430
|
return {
|
|
393
|
-
_map:
|
|
431
|
+
_map: l,
|
|
394
432
|
setNodes(e) {
|
|
395
|
-
d = e, _ = new Map(e.map((
|
|
433
|
+
d = e, _ = new Map(e.map((o) => [o.id, o])), $();
|
|
396
434
|
},
|
|
397
|
-
setActiveNode:
|
|
398
|
-
playSequence:
|
|
399
|
-
setTheme:
|
|
435
|
+
setActiveNode: M,
|
|
436
|
+
playSequence: oe,
|
|
437
|
+
setTheme: ne,
|
|
400
438
|
resize() {
|
|
401
|
-
|
|
439
|
+
p || l.resize();
|
|
402
440
|
},
|
|
403
441
|
destroy() {
|
|
404
|
-
|
|
442
|
+
p || (p = !0, x?.stop(), ye(), H.removeEventListener("fullscreenchange", K), k(), Q.destroy(), E?.destroy(), D.clear(), P?.remove(), F.clear(), C?.destroy(), l.remove(), f.remove(), i.classList.remove("tripmap"));
|
|
405
443
|
}
|
|
406
444
|
};
|
|
407
445
|
}
|
|
408
446
|
export {
|
|
409
|
-
|
|
447
|
+
Ct as createEngine
|
|
410
448
|
};
|