@blogmcp/sdk 0.3.1 → 0.6.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/LICENSE +21 -0
- 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/useTripMap.js +21 -25
- package/dist/packages/mdx-render-vue/dist/edit/TripMapEdit.vue.js +1 -0
- package/dist/packages/mdx-render-vue/dist/render/tripmap/TripMapDefault.vue.js +105 -94
- package/dist/packages/mdx-schema/dist/metadata/index.js +12 -3
- package/dist/packages/mdx-schema/dist/styles/index.js +9 -1
- package/dist/packages/mdx-schema/dist/tripmap.js +81 -35
- package/dist/packages/tripmap-core/dist/attribution.js +121 -6
- package/dist/packages/tripmap-core/dist/css.js +149 -20
- package/dist/packages/tripmap-core/dist/detail.js +51 -0
- package/dist/packages/tripmap-core/dist/engine.js +367 -174
- package/dist/packages/tripmap-core/dist/export.js +72 -0
- 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 +60 -36
- package/dist/packages/tripmap-core/dist/lightbox.js +96 -0
- package/dist/packages/tripmap-core/dist/line.js +6 -6
- package/dist/packages/tripmap-core/dist/markers.js +60 -51
- package/dist/packages/tripmap-core/dist/nodes.js +56 -43
- package/dist/packages/tripmap-core/dist/playback.js +20 -16
- package/dist/packages/tripmap-core/dist/preload.js +44 -0
- 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 +2006 -1791
- package/dist/{node_modules → packages/tripmap-core/node_modules}/pmtiles/dist/esm/index.js +1 -1
- 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/{node_modules → packages/tripmap-core/node_modules}/maplibre-gl/dist/maplibre-gl-shared.js +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const o = "https://tripmap.invalid/", l = new URL(o).origin, u = /^[\u0000-\u0020]+|[\u0000-\u0020]+$/g, c = /[\t\n\r]/g, i = /^(?:\/|\.\.?\/|[#?])/, s = /^[a-z][a-z0-9+.-]*:/i;
|
|
2
|
+
function E(r) {
|
|
3
|
+
if (typeof r != "string") return null;
|
|
4
|
+
const t = r.replace(u, "").replace(c, "");
|
|
5
|
+
if (!t) return null;
|
|
6
|
+
const e = i.test(t);
|
|
7
|
+
if (!e && !s.test(t)) return null;
|
|
8
|
+
let n;
|
|
9
|
+
try {
|
|
10
|
+
n = new URL(t, o);
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return e ? n.origin === l ? t : null : n.protocol === "https:" || n.protocol === "http:" ? t : null;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
E as safeNodeHref
|
|
18
|
+
};
|
|
@@ -1,32 +1,54 @@
|
|
|
1
|
-
import { buildTripNodes as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { buildTripNodes as u, captureTimeMs as c, formatTimeHHMM as g, lineNodes as m, normalizeHandNode as p, tripSummary as b } from "./nodes.js";
|
|
2
|
+
import { safeNodeHref as f } from "./href.js";
|
|
3
|
+
import { approxDistanceKm as v, computeFramingBounds as w } from "./framing.js";
|
|
4
|
+
import { OSM_ATTRIBUTION as T, buildAttributions as A } from "./attribution.js";
|
|
5
|
+
const a = "0.1.9", r = {
|
|
5
6
|
light: "https://tiles.openfreemap.org/styles/liberty",
|
|
6
7
|
dark: "https://tiles.openfreemap.org/styles/dark"
|
|
7
|
-
},
|
|
8
|
-
function
|
|
8
|
+
}, n = () => import("./engine.js");
|
|
9
|
+
function s(e) {
|
|
9
10
|
return {
|
|
10
|
-
styleUrl: e.styleUrl ||
|
|
11
|
-
darkStyleUrl: e.darkStyleUrl || e.styleUrl ||
|
|
11
|
+
styleUrl: e.styleUrl || r.light,
|
|
12
|
+
darkStyleUrl: e.darkStyleUrl || e.styleUrl || r.dark,
|
|
12
13
|
theme: e.theme ?? "auto",
|
|
13
14
|
cluster: e.cluster ?? !0,
|
|
14
15
|
clusterRadius: e.clusterRadius ?? 40,
|
|
15
16
|
showLine: e.showLine ?? !0,
|
|
16
17
|
showFilmstrip: e.showFilmstrip ?? !0,
|
|
17
18
|
showPlayback: e.showPlayback ?? !0,
|
|
19
|
+
showFullscreen: e.showFullscreen ?? !0,
|
|
20
|
+
showExport: e.showExport ?? !0,
|
|
21
|
+
showGeolocate: e.showGeolocate ?? !0,
|
|
22
|
+
showTime: e.showTime ?? !0,
|
|
23
|
+
watermark: e.watermark,
|
|
24
|
+
title: e.title,
|
|
25
|
+
detail: e.detail ?? "popup",
|
|
26
|
+
detailHost: e.detailHost,
|
|
18
27
|
initialView: e.initialView,
|
|
19
28
|
extraAttribution: e.extraAttribution,
|
|
20
29
|
labels: {
|
|
21
30
|
play: e.labels?.play ?? "Play route",
|
|
22
|
-
stop: e.labels?.stop ?? "Stop"
|
|
31
|
+
stop: e.labels?.stop ?? "Stop",
|
|
32
|
+
fullscreen: e.labels?.fullscreen ?? "Fullscreen",
|
|
33
|
+
exitFullscreen: e.labels?.exitFullscreen ?? "Exit fullscreen",
|
|
34
|
+
export: e.labels?.export ?? "Export route",
|
|
35
|
+
exportGpx: e.labels?.exportGpx ?? "Download GPX",
|
|
36
|
+
exportGpxHint: e.labels?.exportGpxHint ?? "watches, Garmin, Strava, Komoot",
|
|
37
|
+
openInMapy: e.labels?.openInMapy ?? "Open in Mapy.com",
|
|
38
|
+
openInGoogleMaps: e.labels?.openInGoogleMaps ?? "Open in Google Maps",
|
|
39
|
+
lightboxClose: e.labels?.lightboxClose ?? "Close",
|
|
40
|
+
lightboxPrev: e.labels?.lightboxPrev ?? "Previous photo",
|
|
41
|
+
lightboxNext: e.labels?.lightboxNext ?? "Next photo",
|
|
42
|
+
zoomImage: e.labels?.zoomImage ?? "View full screen",
|
|
43
|
+
findMyLocation: e.labels?.findMyLocation ?? "Show my location",
|
|
44
|
+
locationNotAvailable: e.labels?.locationNotAvailable ?? "Location not available"
|
|
23
45
|
},
|
|
24
46
|
events: e.events ?? {}
|
|
25
47
|
};
|
|
26
48
|
}
|
|
27
|
-
class
|
|
28
|
-
constructor(
|
|
29
|
-
this.container =
|
|
49
|
+
class o {
|
|
50
|
+
constructor(t, i) {
|
|
51
|
+
this.container = t, this.resolved = s(i), this.loader = i.engineLoader ?? n;
|
|
30
52
|
}
|
|
31
53
|
resolved;
|
|
32
54
|
engine = null;
|
|
@@ -44,28 +66,28 @@ class h {
|
|
|
44
66
|
*/
|
|
45
67
|
init() {
|
|
46
68
|
return this.initPromise ? this.initPromise : (this.initPromise = (async () => {
|
|
47
|
-
let
|
|
69
|
+
let t;
|
|
48
70
|
try {
|
|
49
|
-
|
|
50
|
-
} catch (
|
|
51
|
-
const
|
|
52
|
-
throw this.resolved.events.onError?.(
|
|
71
|
+
t = await this.loader();
|
|
72
|
+
} catch (i) {
|
|
73
|
+
const l = i instanceof Error ? i : new Error("tripmap: engine load failed");
|
|
74
|
+
throw this.resolved.events.onError?.(l), l;
|
|
53
75
|
}
|
|
54
|
-
this.destroyed || (this.engine =
|
|
76
|
+
this.destroyed || (this.engine = t.createEngine(this.container, this.resolved), this.pendingNodes && this.engine.setNodes(this.pendingNodes), this.pendingTheme && this.engine.setTheme(this.pendingTheme), this.pendingActive && this.engine.setActiveNode(this.pendingActive.id, this.pendingActive), this.pendingNodes = null, this.pendingTheme = null, this.pendingActive = null);
|
|
55
77
|
})(), this.initPromise);
|
|
56
78
|
}
|
|
57
|
-
setNodes(
|
|
58
|
-
this.engine ? this.engine.setNodes(
|
|
79
|
+
setNodes(t) {
|
|
80
|
+
this.engine ? this.engine.setNodes(t) : this.pendingNodes = t;
|
|
59
81
|
}
|
|
60
|
-
setActiveNode(
|
|
61
|
-
this.engine ? this.engine.setActiveNode(
|
|
82
|
+
setActiveNode(t, i) {
|
|
83
|
+
this.engine ? this.engine.setActiveNode(t, i) : this.pendingActive = { id: t, ...i };
|
|
62
84
|
}
|
|
63
|
-
playSequence(
|
|
64
|
-
return this.engine ? this.engine.playSequence(
|
|
85
|
+
playSequence(t) {
|
|
86
|
+
return this.engine ? this.engine.playSequence(t) : { stop() {
|
|
65
87
|
} };
|
|
66
88
|
}
|
|
67
|
-
setTheme(
|
|
68
|
-
this.engine ? this.engine.setTheme(
|
|
89
|
+
setTheme(t) {
|
|
90
|
+
this.engine ? this.engine.setTheme(t) : this.pendingTheme = t;
|
|
69
91
|
}
|
|
70
92
|
resize() {
|
|
71
93
|
this.engine?.resize();
|
|
@@ -75,16 +97,18 @@ class h {
|
|
|
75
97
|
}
|
|
76
98
|
}
|
|
77
99
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
100
|
+
r as DEFAULT_STYLE_URLS,
|
|
101
|
+
T as OSM_ATTRIBUTION,
|
|
102
|
+
o as TripMap,
|
|
103
|
+
a as VERSION,
|
|
82
104
|
v as approxDistanceKm,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
105
|
+
A as buildAttributions,
|
|
106
|
+
u as buildTripNodes,
|
|
107
|
+
c as captureTimeMs,
|
|
108
|
+
w as computeFramingBounds,
|
|
86
109
|
g as formatTimeHHMM,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
110
|
+
m as lineNodes,
|
|
111
|
+
p as normalizeHandNode,
|
|
112
|
+
f as safeNodeHref,
|
|
113
|
+
b as tripSummary
|
|
90
114
|
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
function d(h) {
|
|
2
|
+
return h.largeImageUrl || h.imageUrl || h.thumbnailUrl;
|
|
3
|
+
}
|
|
4
|
+
class u {
|
|
5
|
+
constructor(t, e, n) {
|
|
6
|
+
this.host = t, this.labels = e, this.callbacks = n;
|
|
7
|
+
}
|
|
8
|
+
root = null;
|
|
9
|
+
img = null;
|
|
10
|
+
caption = null;
|
|
11
|
+
prevBtn = null;
|
|
12
|
+
nextBtn = null;
|
|
13
|
+
nodes = [];
|
|
14
|
+
index = 0;
|
|
15
|
+
restoreFocus = null;
|
|
16
|
+
bodyOverflow = "";
|
|
17
|
+
get isOpen() {
|
|
18
|
+
return this.root !== null;
|
|
19
|
+
}
|
|
20
|
+
get current() {
|
|
21
|
+
return this.root ? this.nodes[this.index] ?? null : null;
|
|
22
|
+
}
|
|
23
|
+
/** Open on `id`; `nodes` is filtered to the ones with an image. */
|
|
24
|
+
open(t, e) {
|
|
25
|
+
this.nodes = t.filter((i) => !!d(i));
|
|
26
|
+
const n = this.nodes.findIndex((i) => i.id === e);
|
|
27
|
+
n < 0 || (this.index = n, this.root || this.mount(), this.render());
|
|
28
|
+
}
|
|
29
|
+
next() {
|
|
30
|
+
!this.root || this.nodes.length < 2 || (this.index = (this.index + 1) % this.nodes.length, this.render());
|
|
31
|
+
}
|
|
32
|
+
prev() {
|
|
33
|
+
!this.root || this.nodes.length < 2 || (this.index = (this.index - 1 + this.nodes.length) % this.nodes.length, this.render());
|
|
34
|
+
}
|
|
35
|
+
close() {
|
|
36
|
+
if (!this.root) return;
|
|
37
|
+
const t = this.host.ownerDocument;
|
|
38
|
+
t.removeEventListener("keydown", this.onKeyDown), this.root.remove(), this.root = null, this.img = null, this.caption = null, t.body.style.overflow = this.bodyOverflow;
|
|
39
|
+
const e = this.restoreFocus;
|
|
40
|
+
this.restoreFocus = null, e && typeof e.focus == "function" && e.focus(), this.callbacks.onClose?.();
|
|
41
|
+
}
|
|
42
|
+
destroy() {
|
|
43
|
+
this.close();
|
|
44
|
+
}
|
|
45
|
+
onKeyDown = (t) => {
|
|
46
|
+
t.key === "Escape" ? (t.preventDefault(), this.close()) : t.key === "ArrowRight" ? (t.preventDefault(), this.next()) : t.key === "ArrowLeft" && (t.preventDefault(), this.prev());
|
|
47
|
+
};
|
|
48
|
+
mount() {
|
|
49
|
+
const t = this.host.ownerDocument, e = t.createElement("div");
|
|
50
|
+
e.className = "tripmap-lightbox", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.addEventListener("click", (p) => {
|
|
51
|
+
p.target === e && this.close();
|
|
52
|
+
});
|
|
53
|
+
const n = t.createElement("button");
|
|
54
|
+
n.type = "button", n.className = "tripmap-lightbox__close", n.setAttribute("aria-label", this.labels.close), n.textContent = "×", n.addEventListener("click", () => this.close());
|
|
55
|
+
const i = t.createElement("button");
|
|
56
|
+
i.type = "button", i.className = "tripmap-lightbox__nav tripmap-lightbox__nav--prev", i.setAttribute("aria-label", this.labels.prev), i.textContent = "‹", i.addEventListener("click", () => this.prev());
|
|
57
|
+
const s = t.createElement("button");
|
|
58
|
+
s.type = "button", s.className = "tripmap-lightbox__nav tripmap-lightbox__nav--next", s.setAttribute("aria-label", this.labels.next), s.textContent = "›", s.addEventListener("click", () => this.next());
|
|
59
|
+
const r = t.createElement("figure");
|
|
60
|
+
r.className = "tripmap-lightbox__figure";
|
|
61
|
+
const o = t.createElement("img");
|
|
62
|
+
o.className = "tripmap-lightbox__img", o.decoding = "async", o.draggable = !1;
|
|
63
|
+
const l = t.createElement("figcaption");
|
|
64
|
+
l.className = "tripmap-lightbox__caption", r.appendChild(o), r.appendChild(l), e.appendChild(n), e.appendChild(i), e.appendChild(r), e.appendChild(s);
|
|
65
|
+
const a = t.fullscreenElement;
|
|
66
|
+
(a && (a === this.host || a.contains(this.host)) ? a : t.body).appendChild(e), this.restoreFocus = t.activeElement instanceof HTMLElement ? t.activeElement : null, this.bodyOverflow = t.body.style.overflow, t.body.style.overflow = "hidden", t.addEventListener("keydown", this.onKeyDown), this.root = e, this.img = o, this.caption = l, this.prevBtn = i, this.nextBtn = s, n.focus();
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
const t = this.nodes[this.index];
|
|
70
|
+
if (!t || !this.img || !this.caption || !this.root) return;
|
|
71
|
+
const e = d(t);
|
|
72
|
+
this.img.src = e, this.img.alt = t.altText || t.title || "", this.caption.textContent = "";
|
|
73
|
+
const n = [];
|
|
74
|
+
t.title && n.push(t.title);
|
|
75
|
+
const i = t.capturedAt ? this.callbacks.formatTime(t.capturedAt) : "";
|
|
76
|
+
i && n.push(i);
|
|
77
|
+
const s = this.host.ownerDocument.createElement("span");
|
|
78
|
+
s.className = "tripmap-lightbox__caption-head", s.textContent = n.join(" · "), n.length && this.caption.appendChild(s);
|
|
79
|
+
const r = t.description || t.altText;
|
|
80
|
+
if (r) {
|
|
81
|
+
const l = this.host.ownerDocument.createElement("span");
|
|
82
|
+
l.className = "tripmap-lightbox__caption-text", l.textContent = r, this.caption.appendChild(l);
|
|
83
|
+
}
|
|
84
|
+
const o = this.nodes.length > 1;
|
|
85
|
+
if (this.prevBtn && (this.prevBtn.hidden = !o), this.nextBtn && (this.nextBtn.hidden = !o), this.root.dataset.tripmapNode = t.id, o && this.callbacks.preload)
|
|
86
|
+
for (const l of [1, -1]) {
|
|
87
|
+
const a = this.nodes[(this.index + l + this.nodes.length) % this.nodes.length], c = d(a);
|
|
88
|
+
c && this.callbacks.preload(c);
|
|
89
|
+
}
|
|
90
|
+
this.callbacks.onChange?.(t);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
u as Lightbox,
|
|
95
|
+
d as lightboxImageUrl
|
|
96
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { lineNodes as
|
|
2
|
-
function
|
|
3
|
-
const e = t
|
|
1
|
+
import { lineNodes as i } from "./nodes.js";
|
|
2
|
+
function l(t) {
|
|
3
|
+
const e = i(t);
|
|
4
4
|
return e.length < 2 ? null : {
|
|
5
5
|
type: "Feature",
|
|
6
6
|
geometry: {
|
|
@@ -18,7 +18,7 @@ const r = [
|
|
|
18
18
|
"#60a5fa",
|
|
19
19
|
1,
|
|
20
20
|
"#1d4ed8"
|
|
21
|
-
],
|
|
21
|
+
], a = {
|
|
22
22
|
"line-width": 3,
|
|
23
23
|
"line-opacity": 0.85,
|
|
24
24
|
"line-gradient": r
|
|
@@ -29,6 +29,6 @@ const r = [
|
|
|
29
29
|
export {
|
|
30
30
|
r as LINE_GRADIENT_EXPRESSION,
|
|
31
31
|
p as LINE_LAYER_LAYOUT,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
a as LINE_LAYER_PAINT,
|
|
33
|
+
l as buildLineFeature
|
|
34
34
|
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { safeNodeHref as m } from "./href.js";
|
|
2
|
+
class u {
|
|
2
3
|
constructor(r) {
|
|
3
4
|
this.adapter = r;
|
|
4
5
|
}
|
|
5
6
|
entries = /* @__PURE__ */ new Map();
|
|
6
7
|
/** Diff the desired set against the mounted set by key. */
|
|
7
8
|
sync(r) {
|
|
8
|
-
const
|
|
9
|
+
const n = /* @__PURE__ */ new Set();
|
|
9
10
|
for (const t of r) {
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
(
|
|
11
|
+
n.add(t.key);
|
|
12
|
+
const i = this.entries.get(t.key);
|
|
13
|
+
if (i) {
|
|
14
|
+
(i.lngLat[0] !== t.lngLat[0] || i.lngLat[1] !== t.lngLat[1]) && (this.adapter.move(i.handle, t.lngLat), i.lngLat = t.lngLat);
|
|
14
15
|
continue;
|
|
15
16
|
}
|
|
16
|
-
const s = t.createEl(),
|
|
17
|
-
this.entries.set(t.key, { el: s, handle:
|
|
17
|
+
const s = t.createEl(), a = this.adapter.mount(s, t.lngLat);
|
|
18
|
+
this.entries.set(t.key, { el: s, handle: a, lngLat: t.lngLat });
|
|
18
19
|
}
|
|
19
|
-
for (const [t,
|
|
20
|
-
|
|
20
|
+
for (const [t, i] of this.entries)
|
|
21
|
+
n.has(t) || (this.adapter.unmount(i.handle), this.entries.delete(t));
|
|
21
22
|
}
|
|
22
23
|
get(r) {
|
|
23
24
|
return this.entries.get(r)?.el;
|
|
@@ -30,61 +31,69 @@ class c {
|
|
|
30
31
|
this.entries.clear();
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
const
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
34
|
+
const o = "tripmap-marker--active";
|
|
35
|
+
function g(e, r) {
|
|
36
|
+
const n = document.createElement("button");
|
|
37
|
+
if (n.type = "button", n.className = "tripmap-marker", n.dataset.tripmapNode = e.id, n.setAttribute("aria-label", e.title || e.altText || e.id), e.thumbnailUrl) {
|
|
37
38
|
const t = document.createElement("img");
|
|
38
|
-
t.src =
|
|
39
|
+
t.src = e.thumbnailUrl, t.alt = "", t.loading = "lazy", t.decoding = "async", t.draggable = !1, t.className = "tripmap-marker__img", n.appendChild(t);
|
|
39
40
|
} else {
|
|
40
|
-
|
|
41
|
+
n.classList.add("tripmap-marker--dot");
|
|
41
42
|
const t = document.createElement("span");
|
|
42
|
-
t.className = "tripmap-marker__dot",
|
|
43
|
+
t.className = "tripmap-marker__dot", n.appendChild(t);
|
|
43
44
|
}
|
|
44
|
-
return
|
|
45
|
-
t.stopPropagation(), r(
|
|
46
|
-
}),
|
|
45
|
+
return n.addEventListener("click", (t) => {
|
|
46
|
+
t.stopPropagation(), r(e);
|
|
47
|
+
}), n;
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function h(e, r, n) {
|
|
49
50
|
const t = document.createElement("button");
|
|
50
|
-
t.type = "button", t.className = "tripmap-marker tripmap-marker--cluster", t.setAttribute("aria-label", `${
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
s.stopPropagation(),
|
|
51
|
+
t.type = "button", t.className = "tripmap-marker tripmap-marker--cluster", t.setAttribute("aria-label", `${e}`);
|
|
52
|
+
const i = document.createElement("span");
|
|
53
|
+
return i.className = "tripmap-marker__count", i.textContent = String(e), t.appendChild(i), t.addEventListener("click", (s) => {
|
|
54
|
+
s.stopPropagation(), n();
|
|
54
55
|
}), t;
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
57
|
+
function f(e, r) {
|
|
58
|
+
e?.classList.toggle(o, r);
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
function k(e, r, n = {}) {
|
|
61
|
+
const t = document.createElement("div");
|
|
62
|
+
if (t.className = "tripmap-popup", e.imageUrl || e.thumbnailUrl) {
|
|
63
|
+
const a = n.image ?? document.createElement("img");
|
|
64
|
+
n.image || (a.src = e.imageUrl || e.thumbnailUrl, a.loading = "eager", a.decoding = "async"), a.alt = e.altText || "", a.className = "tripmap-popup__img";
|
|
65
|
+
const c = m(e.href);
|
|
66
|
+
if (c) {
|
|
67
|
+
const l = document.createElement("a");
|
|
68
|
+
l.href = c, l.appendChild(a), t.appendChild(l);
|
|
69
|
+
} else if (n.onImageClick) {
|
|
70
|
+
const l = document.createElement("button");
|
|
71
|
+
l.type = "button", l.className = "tripmap-popup__zoom", n.zoomLabel && l.setAttribute("aria-label", n.zoomLabel), l.appendChild(a), l.addEventListener("click", (p) => {
|
|
72
|
+
p.stopPropagation(), n.onImageClick?.(e);
|
|
73
|
+
}), t.appendChild(l);
|
|
66
74
|
} else
|
|
67
|
-
|
|
75
|
+
t.appendChild(a);
|
|
68
76
|
}
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
const
|
|
72
|
-
|
|
77
|
+
const i = document.createElement("div");
|
|
78
|
+
if (i.className = "tripmap-popup__meta", e.title) {
|
|
79
|
+
const a = document.createElement("strong");
|
|
80
|
+
a.className = "tripmap-popup__title", a.textContent = e.title, i.appendChild(a);
|
|
73
81
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
const s = e.capturedAt ? r(e.capturedAt) : "";
|
|
83
|
+
if (s) {
|
|
84
|
+
const a = document.createElement("span");
|
|
85
|
+
a.className = "tripmap-popup__time", a.textContent = s, i.appendChild(a);
|
|
77
86
|
}
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
87
|
+
if (e.description || e.altText) {
|
|
88
|
+
const a = document.createElement("p");
|
|
89
|
+
a.className = "tripmap-popup__desc", a.textContent = e.description || e.altText || "", i.appendChild(a);
|
|
81
90
|
}
|
|
82
|
-
return
|
|
91
|
+
return i.childNodes.length > 0 && t.appendChild(i), t;
|
|
83
92
|
}
|
|
84
93
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
u as MarkerPool,
|
|
95
|
+
h as createClusterMarkerEl,
|
|
96
|
+
g as createNodeMarkerEl,
|
|
97
|
+
k as createPopupContent,
|
|
98
|
+
f as setMarkerActive
|
|
90
99
|
};
|
|
@@ -1,55 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { safeNodeHref as f } from "./href.js";
|
|
2
|
+
const p = 90, a = 180;
|
|
3
|
+
function s(t, n) {
|
|
4
|
+
return typeof t == "number" && typeof n == "number" && Number.isFinite(t) && Number.isFinite(n) && Math.abs(t) <= p && Math.abs(n) <= a;
|
|
5
|
+
}
|
|
6
|
+
const m = /^(\d{4}-\d{2}-\d{2})[Tt ](\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?)$/;
|
|
7
|
+
function o(t) {
|
|
8
|
+
if (typeof t != "string" || !t) return null;
|
|
9
|
+
const n = m.exec(t.trim()), i = Date.parse(n ? `${n[1]}T${n[2]}Z` : t);
|
|
10
|
+
return Number.isNaN(i) ? null : i;
|
|
11
|
+
}
|
|
12
|
+
function h(t, n) {
|
|
13
|
+
return !t || !s(t.lat, t.lng) ? null : {
|
|
14
|
+
id: t.id || `waypoint-${n}`,
|
|
15
|
+
lat: t.lat,
|
|
16
|
+
lng: t.lng,
|
|
17
|
+
capturedAt: o(t.capturedAt) !== null ? t.capturedAt : void 0,
|
|
18
|
+
thumbnailUrl: t.thumbnailUrl,
|
|
19
|
+
title: t.title,
|
|
20
|
+
description: t.description,
|
|
21
|
+
// Where author JSON becomes a node: an unsafe link is dropped here, so no
|
|
22
|
+
// consumer of the node (popup, SSR fallback) ever holds it.
|
|
23
|
+
href: f(t.href) ?? void 0,
|
|
19
24
|
kind: "waypoint"
|
|
20
25
|
};
|
|
21
26
|
}
|
|
22
|
-
function
|
|
23
|
-
const i = [],
|
|
24
|
-
for (const e of
|
|
25
|
-
!e || !e.id || !
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
!
|
|
27
|
+
function M(t, n = []) {
|
|
28
|
+
const i = [], r = /* @__PURE__ */ new Set();
|
|
29
|
+
for (const e of t)
|
|
30
|
+
!e || !e.id || !s(e.lat, e.lng) || r.has(e.id) || (r.add(e.id), i.push({ kind: "photo", ...e }));
|
|
31
|
+
n.forEach((e, d) => {
|
|
32
|
+
const u = h(e, d);
|
|
33
|
+
!u || r.has(u.id) || (r.add(u.id), i.push(u));
|
|
29
34
|
});
|
|
30
|
-
const
|
|
31
|
-
return
|
|
35
|
+
const c = i.filter((e) => o(e.capturedAt) !== null), l = i.filter((e) => o(e.capturedAt) === null);
|
|
36
|
+
return c.sort((e, d) => o(e.capturedAt) - o(d.capturedAt)), [...c, ...l];
|
|
32
37
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
38
|
+
function A(t) {
|
|
39
|
+
return t.filter((n) => o(n.capturedAt) !== null);
|
|
35
40
|
}
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
return
|
|
41
|
+
function g(t) {
|
|
42
|
+
const n = /T(\d{2}):(\d{2})/.exec(t);
|
|
43
|
+
return n ? `${n[1]}:${n[2]}` : "";
|
|
39
44
|
}
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
const T = /^(\d{4}-\d{2}-\d{2})(?:[Tt ]|$)/;
|
|
46
|
+
function E(t) {
|
|
47
|
+
const n = A(t), i = n[0] ?? null;
|
|
42
48
|
return {
|
|
43
|
-
count:
|
|
44
|
-
first:
|
|
45
|
-
last:
|
|
46
|
-
|
|
49
|
+
count: t.length,
|
|
50
|
+
first: i,
|
|
51
|
+
last: n[n.length - 1] ?? null,
|
|
52
|
+
// Timed means captureTimeMs read it, so capturedAt is a string here.
|
|
53
|
+
dateIso: i ? N(i.capturedAt) : null
|
|
47
54
|
};
|
|
48
55
|
}
|
|
56
|
+
function N(t) {
|
|
57
|
+
const n = T.exec(t.trim());
|
|
58
|
+
return n ? n[1] : new Date(o(t)).toISOString().slice(0, 10);
|
|
59
|
+
}
|
|
49
60
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
M as buildTripNodes,
|
|
62
|
+
o as captureTimeMs,
|
|
63
|
+
g as formatTimeHHMM,
|
|
64
|
+
A as lineNodes,
|
|
65
|
+
h as normalizeHandNode,
|
|
66
|
+
f as safeNodeHref,
|
|
67
|
+
E as tripSummary
|
|
55
68
|
};
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import { lineNodes as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
const
|
|
1
|
+
import { lineNodes as m } from "./nodes.js";
|
|
2
|
+
const w = 2e3;
|
|
3
|
+
function T(r, t, u = {}) {
|
|
4
|
+
const e = m(r), a = u.dwellMs ?? w;
|
|
5
|
+
let o = !1, l;
|
|
6
|
+
const n = {
|
|
7
7
|
stop() {
|
|
8
|
-
|
|
8
|
+
o || (o = !0, l && clearTimeout(l), f(), t.onDone?.());
|
|
9
9
|
}
|
|
10
|
-
}, f =
|
|
10
|
+
}, f = t.onUserInterrupt?.(() => n.stop()) ?? (() => {
|
|
11
11
|
});
|
|
12
|
-
async function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
async function p() {
|
|
13
|
+
t.preload?.(e[0]);
|
|
14
|
+
for (let s = 0; s < e.length; s++) {
|
|
15
|
+
const i = e[s];
|
|
16
|
+
if (o || (await t.flyTo(i), o)) return;
|
|
17
|
+
t.showNode(i);
|
|
18
|
+
const c = e[s + 1];
|
|
19
|
+
c && t.preload?.(c), await new Promise((d) => {
|
|
20
|
+
l = setTimeout(d, a);
|
|
17
21
|
});
|
|
18
22
|
}
|
|
19
|
-
|
|
23
|
+
n.stop();
|
|
20
24
|
}
|
|
21
|
-
return
|
|
25
|
+
return e.length === 0 ? n.stop() : p(), n;
|
|
22
26
|
}
|
|
23
27
|
export {
|
|
24
|
-
|
|
28
|
+
T as startPlayback
|
|
25
29
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
class o {
|
|
2
|
+
constructor(e, t = 4) {
|
|
3
|
+
this.doc = e, this.limit = t;
|
|
4
|
+
}
|
|
5
|
+
entries = /* @__PURE__ */ new Map();
|
|
6
|
+
/** Start (or reuse) a load; resolves once decoded, or on error (never rejects). */
|
|
7
|
+
preload(e) {
|
|
8
|
+
const t = this.entries.get(e);
|
|
9
|
+
if (t)
|
|
10
|
+
return this.entries.delete(e), this.entries.set(e, t), t.ready;
|
|
11
|
+
const i = this.doc.createElement("img");
|
|
12
|
+
i.decoding = "async";
|
|
13
|
+
const n = new Promise((s) => {
|
|
14
|
+
i.addEventListener(
|
|
15
|
+
"load",
|
|
16
|
+
() => {
|
|
17
|
+
const r = typeof i.decode == "function" ? i.decode() : void 0;
|
|
18
|
+
r ? r.then(s, s) : s();
|
|
19
|
+
},
|
|
20
|
+
{ once: !0 }
|
|
21
|
+
), i.addEventListener("error", () => s(), { once: !0 });
|
|
22
|
+
});
|
|
23
|
+
for (i.src = e, this.entries.set(e, { img: i, ready: n }); this.entries.size > this.limit; ) {
|
|
24
|
+
const s = this.entries.keys().next().value;
|
|
25
|
+
if (s === void 0) break;
|
|
26
|
+
this.entries.delete(s);
|
|
27
|
+
}
|
|
28
|
+
return n;
|
|
29
|
+
}
|
|
30
|
+
/** Hand out the preloaded element (it leaves the cache — it is about to be mounted). */
|
|
31
|
+
take(e) {
|
|
32
|
+
const t = this.entries.get(e);
|
|
33
|
+
return t ? (this.entries.delete(e), t.img) : null;
|
|
34
|
+
}
|
|
35
|
+
has(e) {
|
|
36
|
+
return this.entries.has(e);
|
|
37
|
+
}
|
|
38
|
+
clear() {
|
|
39
|
+
this.entries.clear();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
o as ImagePreloader
|
|
44
|
+
};
|