@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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as H, ref as f, onMounted as L, onBeforeUnmount as P, createElementBlock as n, openBlock as s, normalizeClass as i, unref as e, createCommentVNode as d, createElementVNode as p, toDisplayString as v, Fragment as B, renderList as F, normalizeStyle as j } from "vue";
|
|
2
2
|
import { tripMapStyles as r } from "../../../../mdx-schema/dist/styles/index.js";
|
|
3
|
-
import { useTripMap as
|
|
4
|
-
import { tripMapFormatTime as
|
|
5
|
-
const
|
|
3
|
+
import { useTripMap as D } from "../../composables/useTripMap.js";
|
|
4
|
+
import { tripMapFormatTime as G } from "../../../../mdx-schema/dist/tripmap.js";
|
|
5
|
+
const W = ["aria-label"], $ = ["src", "alt"], R = /* @__PURE__ */ H({
|
|
6
6
|
__name: "TripMapDefault",
|
|
7
7
|
props: {
|
|
8
8
|
slugs: {},
|
|
@@ -14,156 +14,167 @@ const D = ["aria-label"], G = ["src"], K = /* @__PURE__ */ O({
|
|
|
14
14
|
playback: { type: Boolean, default: !0 },
|
|
15
15
|
cluster: { type: Boolean, default: !0 },
|
|
16
16
|
theme: { default: "auto" },
|
|
17
|
+
detail: { default: "popup" },
|
|
17
18
|
styleUrl: {},
|
|
18
19
|
center: {},
|
|
19
20
|
zoom: {},
|
|
20
21
|
title: {}
|
|
21
22
|
},
|
|
22
|
-
setup(
|
|
23
|
-
const
|
|
24
|
-
let T = null, m = null,
|
|
25
|
-
async function
|
|
23
|
+
setup(y) {
|
|
24
|
+
const l = y, { handNodes: S, facadeThumbs: w, facadeStops: U, heightStyle: _, geoUrl: z, isConfigOnly: I, labels: A, texts: g } = D(l), N = f(null), h = f(null), x = f(null), u = f("facade"), C = f(0);
|
|
25
|
+
let T = null, m = null, k = !1;
|
|
26
|
+
async function O() {
|
|
26
27
|
try {
|
|
27
28
|
const t = await fetch(z.value, { headers: { accept: "application/json" } });
|
|
28
29
|
if (!t.ok) throw new Error(`media/geo ${t.status}`);
|
|
29
30
|
return await t.json();
|
|
30
31
|
} catch (t) {
|
|
31
|
-
if (
|
|
32
|
+
if (I.value) return { nodes: [] };
|
|
32
33
|
throw t;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
async function
|
|
36
|
-
if (!
|
|
37
|
-
|
|
36
|
+
async function E() {
|
|
37
|
+
if (!k) {
|
|
38
|
+
k = !0, u.value = "loading";
|
|
38
39
|
try {
|
|
39
|
-
const [t,
|
|
40
|
-
id:
|
|
41
|
-
lat:
|
|
42
|
-
lng:
|
|
43
|
-
capturedAt:
|
|
44
|
-
thumbnailUrl:
|
|
45
|
-
imageUrl:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
const [t, c] = await Promise.all([import("../../../../tripmap-core/dist/index.js"), O()]), a = (c.nodes ?? []).filter((o) => typeof o.latitude == "number" && typeof o.longitude == "number").map((o) => ({
|
|
41
|
+
id: o.slug,
|
|
42
|
+
lat: o.latitude,
|
|
43
|
+
lng: o.longitude,
|
|
44
|
+
capturedAt: o.capturedAt ?? void 0,
|
|
45
|
+
thumbnailUrl: o.thumbnailUrl ?? void 0,
|
|
46
|
+
imageUrl: o.url ?? void 0,
|
|
47
|
+
largeImageUrl: o.largeUrl ?? void 0,
|
|
48
|
+
altText: o.altText ?? void 0,
|
|
49
|
+
title: o.placeName ?? void 0
|
|
50
|
+
})), M = t.buildTripNodes(a, S.value);
|
|
51
|
+
if (C.value = c.skipped ?? 0, M.length === 0 || !h.value) {
|
|
52
|
+
u.value = "empty";
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
53
|
-
const
|
|
54
|
-
styleUrl:
|
|
55
|
-
darkStyleUrl:
|
|
56
|
-
theme:
|
|
57
|
-
cluster:
|
|
58
|
-
showLine:
|
|
59
|
-
showFilmstrip:
|
|
60
|
-
showPlayback:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
const b = new t.TripMap(h.value, {
|
|
56
|
+
styleUrl: l.styleUrl || c.config?.styleUrl || "",
|
|
57
|
+
darkStyleUrl: c.config?.darkStyleUrl,
|
|
58
|
+
theme: l.theme,
|
|
59
|
+
cluster: l.cluster,
|
|
60
|
+
showLine: l.line,
|
|
61
|
+
showFilmstrip: l.filmstrip,
|
|
62
|
+
showPlayback: l.playback,
|
|
63
|
+
title: l.title,
|
|
64
|
+
detail: l.detail,
|
|
65
|
+
detailHost: l.detail === "panel" ? x.value ?? void 0 : void 0,
|
|
66
|
+
extraAttribution: c.config?.attribution,
|
|
67
|
+
labels: A.value,
|
|
68
|
+
initialView: V(),
|
|
64
69
|
events: {}
|
|
65
70
|
});
|
|
66
|
-
|
|
71
|
+
b.setNodes(M), await b.init(), T = () => b.destroy(), u.value = "live";
|
|
67
72
|
} catch {
|
|
68
|
-
|
|
73
|
+
u.value = k && u.value === "loading" ? "facade" : u.value;
|
|
69
74
|
}
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
|
-
function
|
|
73
|
-
if (!
|
|
74
|
-
const [t,
|
|
75
|
-
if (!(!Number.isFinite(t) || !Number.isFinite(
|
|
76
|
-
return { center: [
|
|
77
|
+
function V() {
|
|
78
|
+
if (!l.center) return;
|
|
79
|
+
const [t, c] = l.center.split(",").map((a) => Number.parseFloat(a.trim()));
|
|
80
|
+
if (!(!Number.isFinite(t) || !Number.isFinite(c)))
|
|
81
|
+
return { center: [c, t], zoom: l.zoom };
|
|
77
82
|
}
|
|
78
|
-
return
|
|
79
|
-
const t =
|
|
83
|
+
return L(() => {
|
|
84
|
+
const t = N.value;
|
|
80
85
|
if (t) {
|
|
81
86
|
if (typeof IntersectionObserver > "u") {
|
|
82
|
-
|
|
87
|
+
E();
|
|
83
88
|
return;
|
|
84
89
|
}
|
|
85
90
|
m = new IntersectionObserver(
|
|
86
|
-
(
|
|
87
|
-
|
|
91
|
+
(c) => {
|
|
92
|
+
c.some((a) => a.isIntersecting) && (m?.disconnect(), m = null, E());
|
|
88
93
|
},
|
|
89
94
|
{ rootMargin: "300px" }
|
|
90
95
|
), m.observe(t);
|
|
91
96
|
}
|
|
92
|
-
}),
|
|
97
|
+
}), P(() => {
|
|
93
98
|
m?.disconnect(), T?.();
|
|
94
|
-
}), (t,
|
|
99
|
+
}), (t, c) => (s(), n("div", {
|
|
95
100
|
ref_key: "rootEl",
|
|
96
|
-
ref:
|
|
97
|
-
class:
|
|
101
|
+
ref: N,
|
|
102
|
+
class: i(e(r).container),
|
|
98
103
|
"data-mdx-component": "TripMap",
|
|
99
|
-
"aria-label":
|
|
104
|
+
"aria-label": y.title
|
|
100
105
|
}, [
|
|
101
|
-
|
|
106
|
+
y.title ? (s(), n("p", {
|
|
102
107
|
key: 0,
|
|
103
|
-
class:
|
|
104
|
-
},
|
|
105
|
-
e(
|
|
108
|
+
class: i(e(r).head)
|
|
109
|
+
}, v(y.title), 3)) : d("", !0),
|
|
110
|
+
e(w).length && u.value !== "live" ? (s(), n("ol", {
|
|
106
111
|
key: 1,
|
|
107
|
-
class:
|
|
112
|
+
class: i(e(r).strip)
|
|
108
113
|
}, [
|
|
109
|
-
(
|
|
110
|
-
key:
|
|
111
|
-
class:
|
|
114
|
+
(s(!0), n(B, null, F(e(w), (a) => (s(), n("li", {
|
|
115
|
+
key: a.slug,
|
|
116
|
+
class: i(e(r).stripItem)
|
|
112
117
|
}, [
|
|
113
|
-
|
|
114
|
-
src:
|
|
115
|
-
alt:
|
|
118
|
+
p("img", {
|
|
119
|
+
src: a.src,
|
|
120
|
+
alt: a.alt,
|
|
116
121
|
width: "80",
|
|
117
122
|
height: "80",
|
|
118
123
|
loading: "lazy",
|
|
119
124
|
decoding: "async",
|
|
120
|
-
class:
|
|
121
|
-
}, null, 10,
|
|
125
|
+
class: i(e(r).stripImg)
|
|
126
|
+
}, null, 10, $)
|
|
122
127
|
], 2))), 128))
|
|
123
|
-
], 2)) :
|
|
124
|
-
|
|
125
|
-
class:
|
|
126
|
-
style:
|
|
128
|
+
], 2)) : d("", !0),
|
|
129
|
+
p("div", {
|
|
130
|
+
class: i(e(r).mapWrap),
|
|
131
|
+
style: j(e(_))
|
|
127
132
|
}, [
|
|
128
|
-
|
|
133
|
+
p("div", {
|
|
129
134
|
ref_key: "mapEl",
|
|
130
|
-
ref:
|
|
135
|
+
ref: h,
|
|
131
136
|
class: "absolute inset-0"
|
|
132
137
|
}, null, 512),
|
|
133
|
-
|
|
138
|
+
u.value !== "live" ? (s(), n("div", {
|
|
134
139
|
key: 0,
|
|
135
|
-
class:
|
|
140
|
+
class: i([e(r).mapOverlay])
|
|
136
141
|
}, [
|
|
137
|
-
|
|
138
|
-
class:
|
|
142
|
+
p("div", {
|
|
143
|
+
class: i(e(r).mapBox)
|
|
139
144
|
}, [
|
|
140
|
-
|
|
141
|
-
class:
|
|
142
|
-
},
|
|
145
|
+
p("span", {
|
|
146
|
+
class: i(e(r).mapHint)
|
|
147
|
+
}, v(u.value === "empty" ? e(g).empty : e(g).hint), 3)
|
|
143
148
|
], 2)
|
|
144
|
-
], 2)) :
|
|
149
|
+
], 2)) : d("", !0)
|
|
145
150
|
], 6),
|
|
146
|
-
|
|
151
|
+
l.detail === "panel" ? (s(), n("div", {
|
|
147
152
|
key: 2,
|
|
148
|
-
|
|
153
|
+
ref_key: "detailEl",
|
|
154
|
+
ref: x,
|
|
155
|
+
class: i(e(r).detailHost)
|
|
156
|
+
}, null, 2)) : d("", !0),
|
|
157
|
+
e(U).length && u.value !== "live" ? (s(), n("ol", {
|
|
158
|
+
key: 3,
|
|
159
|
+
class: i(e(r).stopList)
|
|
149
160
|
}, [
|
|
150
|
-
(
|
|
151
|
-
key:
|
|
161
|
+
(s(!0), n(B, null, F(e(U), (a) => (s(), n("li", {
|
|
162
|
+
key: a.key
|
|
152
163
|
}, [
|
|
153
|
-
|
|
164
|
+
a.capturedAt ? (s(), n("span", {
|
|
154
165
|
key: 0,
|
|
155
|
-
class:
|
|
156
|
-
},
|
|
157
|
-
|
|
166
|
+
class: i(e(r).stopTime)
|
|
167
|
+
}, v(e(G)(a.capturedAt)), 3)) : d("", !0),
|
|
168
|
+
p("span", null, v(a.title), 1)
|
|
158
169
|
]))), 128))
|
|
159
|
-
], 2)) :
|
|
160
|
-
|
|
161
|
-
key:
|
|
162
|
-
class:
|
|
163
|
-
},
|
|
164
|
-
], 10,
|
|
170
|
+
], 2)) : d("", !0),
|
|
171
|
+
u.value !== "live" ? (s(), n("p", {
|
|
172
|
+
key: 4,
|
|
173
|
+
class: i(e(r).note)
|
|
174
|
+
}, v(e(g).unavailable), 3)) : d("", !0)
|
|
175
|
+
], 10, W));
|
|
165
176
|
}
|
|
166
177
|
});
|
|
167
178
|
export {
|
|
168
|
-
|
|
179
|
+
R as default
|
|
169
180
|
};
|
|
@@ -403,7 +403,7 @@ Read this carefully.
|
|
|
403
403
|
},
|
|
404
404
|
{
|
|
405
405
|
name: "TripMap",
|
|
406
|
-
description: "Interactive trip map built from photo GPS + capture time: thumbnail markers, chronological route line, synced photo filmstrip, fly-through playback. Without props it maps every geotagged media attached to or embedded in the article (auto mode); only media with exposed location (geoExposed) appear.
|
|
406
|
+
description: "Interactive trip map built from photo GPS + capture time: thumbnail markers, chronological route line, synced photo filmstrip, fly-through playback. Without props it maps every geotagged media attached to or embedded in the article (auto mode); only media with exposed location (geoExposed) appear. Article previews load the same live map; where its engine cannot load, a static photo strip + stop list stays in its place.",
|
|
407
407
|
icon: "🗺",
|
|
408
408
|
category: "media",
|
|
409
409
|
aliases: ["tripmap", "map", "trip", "route", "travelmap", "hike"],
|
|
@@ -424,7 +424,7 @@ Read this carefully.
|
|
|
424
424
|
name: "nodes",
|
|
425
425
|
type: "array",
|
|
426
426
|
required: !1,
|
|
427
|
-
description: 'Hand-made
|
|
427
|
+
description: 'Hand-made stops merged with the photos — a STRICT JSON array inside braces, keys quoted: nodes={[{"id": "eiffel-tower", "lat": 48.8582, "lng": 2.2945, "title": "Eiffel Tower", "capturedAt": "2025-04-20T07:30:00Z"}]}. lat/lng are JSON numbers, never strings. An id (optional) must be unique and must not equal a media slug — a clashing node is dropped. capturedAt is the local wall-clock time at the stop marked Z, the way photo capture times are stored (reached at 09:40 → "2025-04-20T09:40:00Z") — always write the Z; a real offset such as +02:00 shifts the stop against the photos by that offset. Timed nodes join the route line and the GPX track, untimed ones stay off both. Distance (km) and place labels are never derived from hand nodes. Unquoted keys or invalid JSON silently drop the whole prop.'
|
|
428
428
|
},
|
|
429
429
|
{
|
|
430
430
|
name: "height",
|
|
@@ -469,6 +469,15 @@ Read this carefully.
|
|
|
469
469
|
description: 'Map color scheme; "auto" follows the reader’s system preference.',
|
|
470
470
|
enum: ["light", "dark", "auto"]
|
|
471
471
|
},
|
|
472
|
+
{
|
|
473
|
+
name: "detail",
|
|
474
|
+
type: "string",
|
|
475
|
+
required: !1,
|
|
476
|
+
default: '"popup"',
|
|
477
|
+
description: 'Where the selected photo opens: "popup" on the map, or "panel" below the filmstrip at full width (larger photos; the map keeps its height). Both open the photo full-screen on click.',
|
|
478
|
+
enum: ["popup", "panel"],
|
|
479
|
+
addedIn: "0.4.0"
|
|
480
|
+
},
|
|
472
481
|
{
|
|
473
482
|
name: "styleUrl",
|
|
474
483
|
type: "string",
|
|
@@ -499,7 +508,7 @@ Read this carefully.
|
|
|
499
508
|
selfClosing: !0,
|
|
500
509
|
defaultProps: 'title="Trasa výletu"',
|
|
501
510
|
defaultChildren: "",
|
|
502
|
-
example: '<TripMap title="
|
|
511
|
+
example: '<TripMap title="Paris walk" nodes={[{"id": "eiffel-tower", "lat": 48.8582, "lng": 2.2945, "title": "Eiffel Tower", "capturedAt": "2025-04-20T07:30:00Z"}, {"id": "arc-de-triomphe", "lat": 48.8736, "lng": 2.295, "title": "Arc de Triomphe", "capturedAt": "2025-04-20T08:15:00Z"}]} />',
|
|
503
512
|
addedIn: "0.3.0",
|
|
504
513
|
deprecated: []
|
|
505
514
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
const t = {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* `not-prose` is load-bearing: every host puts the article inside Tailwind Typography's
|
|
4
|
+
* `.prose` (both blogs, md-editor, the article-review MCP app), whose `img { margin: 2em 0 }`
|
|
5
|
+
* / `li` / `ol` rules would otherwise leak into the facade strip — an 80 px thumb pushed
|
|
6
|
+
* 32 px down inside an overflow-hidden 80 px tile (seen in the claude.ai preview, 2026-09-06).
|
|
7
|
+
*/
|
|
8
|
+
container: "not-prose my-6 flex flex-col gap-3 rounded-xl border border-gray-200 bg-white p-3",
|
|
3
9
|
head: "text-sm font-medium text-gray-700 m-0",
|
|
4
10
|
/**
|
|
5
11
|
* Sized wrapper that hosts BOTH the engine div and the facade overlay.
|
|
@@ -8,6 +14,8 @@ const t = {
|
|
|
8
14
|
* own container would clobber the classes the engine adds to it).
|
|
9
15
|
*/
|
|
10
16
|
mapWrap: "relative w-full overflow-hidden rounded-lg",
|
|
17
|
+
/** detail="panel": engine-owned photo panel host below the map box (empty until a photo is picked). */
|
|
18
|
+
detailHost: "w-full",
|
|
11
19
|
mapOverlay: "absolute inset-0",
|
|
12
20
|
mapBox: "flex h-full w-full items-center justify-center overflow-hidden rounded-lg bg-gray-100",
|
|
13
21
|
mapHint: "text-sm text-gray-500",
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
return (
|
|
1
|
+
const b = "420px";
|
|
2
|
+
function u(o) {
|
|
3
|
+
return (o ?? "").split(",").map((t) => t.trim()).filter(Boolean);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
let
|
|
7
|
-
if (typeof
|
|
5
|
+
function f(o) {
|
|
6
|
+
let t = o;
|
|
7
|
+
if (typeof t == "string")
|
|
8
8
|
try {
|
|
9
|
-
|
|
9
|
+
t = JSON.parse(t);
|
|
10
10
|
} catch {
|
|
11
11
|
return typeof console < "u" && console.warn('[TripMap] `nodes` prop is not valid JSON — use quoted keys: [{"lat":49.3,"lng":16.3}]'), [];
|
|
12
12
|
}
|
|
13
|
-
return Array.isArray(
|
|
14
|
-
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
return
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
return
|
|
13
|
+
return Array.isArray(t) ? t.filter((n) => !!n && typeof n == "object" && typeof n.lat == "number" && typeof n.lng == "number") : [];
|
|
14
|
+
}
|
|
15
|
+
function v(o) {
|
|
16
|
+
const t = /T(\d{2}):(\d{2})/.exec(o);
|
|
17
|
+
return t ? `${t[1]}:${t[2]}` : "";
|
|
18
|
+
}
|
|
19
|
+
function x(o, t) {
|
|
20
|
+
const n = new URLSearchParams();
|
|
21
|
+
t?.language && n.set("lang", t.language);
|
|
22
|
+
const a = u(o.slugs);
|
|
23
|
+
if (a.length > 0)
|
|
24
|
+
return n.set("slugs", a.join(",")), `/api/media/geo?${n.toString()}`;
|
|
25
|
+
if (t?.filename) {
|
|
26
|
+
n.set("article", t.filename);
|
|
27
|
+
const r = u(o.exclude);
|
|
28
|
+
return r.length > 0 && n.set("exclude", r.join(",")), t.previewToken && n.set("preview", t.previewToken), `/api/media/geo?${n.toString()}`;
|
|
29
29
|
}
|
|
30
|
-
const i =
|
|
30
|
+
const i = n.toString();
|
|
31
31
|
return i ? `/api/media/geo?${i}` : "/api/media/geo";
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return (
|
|
33
|
+
function y(o) {
|
|
34
|
+
return (o ?? "").toLowerCase().startsWith("cs") ? {
|
|
35
35
|
hint: "Interaktivní mapa výletu",
|
|
36
36
|
empty: "Žádná z fotek nemá zveřejněnou polohu.",
|
|
37
37
|
unavailable: "Mapa se zobrazí na publikovaném webu."
|
|
@@ -41,15 +41,61 @@ function c(t) {
|
|
|
41
41
|
unavailable: "The map is shown on the published page."
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
return (
|
|
44
|
+
function T(o) {
|
|
45
|
+
return (o ?? "").toLowerCase().startsWith("cs") ? {
|
|
46
|
+
play: "Přehrát trasu",
|
|
47
|
+
stop: "Zastavit",
|
|
48
|
+
fullscreen: "Celá obrazovka",
|
|
49
|
+
exitFullscreen: "Ukončit celou obrazovku",
|
|
50
|
+
export: "Export trasy",
|
|
51
|
+
exportGpx: "Stáhnout GPX",
|
|
52
|
+
exportGpxHint: "hodinky, Garmin, Strava, Komoot",
|
|
53
|
+
openInMapy: "Otevřít v Mapy.com",
|
|
54
|
+
openInGoogleMaps: "Otevřít v Google Maps",
|
|
55
|
+
lightboxClose: "Zavřít",
|
|
56
|
+
lightboxPrev: "Předchozí fotka",
|
|
57
|
+
lightboxNext: "Další fotka",
|
|
58
|
+
zoomImage: "Zobrazit na celou obrazovku"
|
|
59
|
+
} : void 0;
|
|
60
|
+
}
|
|
61
|
+
const c = (o) => `/api/media/thumb/${encodeURIComponent(o)}?width=192`, g = /^(\d{4}-\d{2}-\d{2})[Tt ](\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?)$/, h = (o) => {
|
|
62
|
+
if (typeof o != "string" || !o)
|
|
63
|
+
return null;
|
|
64
|
+
const t = g.exec(o.trim()), n = Date.parse(t ? `${t[1]}T${t[2]}Z` : o);
|
|
65
|
+
return Number.isNaN(n) ? null : n;
|
|
66
|
+
};
|
|
67
|
+
function m(o) {
|
|
68
|
+
const t = [], n = [];
|
|
69
|
+
for (const a of o) {
|
|
70
|
+
const i = h(a.capturedAt);
|
|
71
|
+
i === null ? n.push(a) : t.push({ item: a, t: i });
|
|
72
|
+
}
|
|
73
|
+
return t.sort((a, i) => a.t - i.t), [...t.map((a) => a.item), ...n];
|
|
74
|
+
}
|
|
75
|
+
function M(o, t) {
|
|
76
|
+
const n = (t?.media ?? []).filter((e) => !!e.slug), a = new Map(n.map((e) => [e.slug, e])), i = u(o.slugs), r = new Set(u(o.exclude));
|
|
77
|
+
let s, p;
|
|
78
|
+
i.length > 0 ? (p = i.map((e) => {
|
|
79
|
+
const l = a.get(e);
|
|
80
|
+
return { slug: e, src: l?.thumbnailUrl || c(e), alt: l?.altText ?? "" };
|
|
81
|
+
}), s = i.map((e) => a.get(e)).filter((e) => !!e)) : (s = m(n.filter((e) => !r.has(e.slug))), p = s.map((e) => ({ slug: e.slug, src: e.thumbnailUrl || c(e.slug), alt: e.altText ?? "" })));
|
|
82
|
+
const d = m([
|
|
83
|
+
...s.filter((e) => e.placeName).map((e) => ({ key: `m:${e.slug}`, title: e.placeName, capturedAt: e.capturedAt ?? void 0 })),
|
|
84
|
+
...f(o.nodes).map((e, l) => ({
|
|
85
|
+
key: `n:${e.id || l}`,
|
|
86
|
+
title: e.title || `${e.lat}, ${e.lng}`,
|
|
87
|
+
capturedAt: e.capturedAt
|
|
88
|
+
}))
|
|
89
|
+
]);
|
|
90
|
+
return { thumbs: p, stops: d };
|
|
46
91
|
}
|
|
47
92
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
93
|
+
b as TRIPMAP_DEFAULT_HEIGHT,
|
|
94
|
+
x as buildTripMapGeoUrl,
|
|
95
|
+
f as parseTripMapHandNodes,
|
|
96
|
+
u as splitTripMapList,
|
|
97
|
+
M as tripMapFacade,
|
|
98
|
+
v as tripMapFormatTime,
|
|
99
|
+
T as tripMapPlaybackLabels,
|
|
100
|
+
y as tripMapUiTexts
|
|
55
101
|
};
|
|
@@ -1,9 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { safeNodeHref as u } from "./href.js";
|
|
2
|
+
const d = '© <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener">OpenStreetMap</a> contributors';
|
|
3
|
+
function N(r) {
|
|
4
|
+
const t = [d], e = r?.trim();
|
|
5
|
+
return e && t.push(e), t;
|
|
6
|
+
}
|
|
7
|
+
const f = /* @__PURE__ */ new Set([
|
|
8
|
+
"script",
|
|
9
|
+
"style",
|
|
10
|
+
"template",
|
|
11
|
+
"iframe",
|
|
12
|
+
"frame",
|
|
13
|
+
"frameset",
|
|
14
|
+
"object",
|
|
15
|
+
"embed",
|
|
16
|
+
"noscript",
|
|
17
|
+
"noembed",
|
|
18
|
+
"noframes",
|
|
19
|
+
"svg",
|
|
20
|
+
"math",
|
|
21
|
+
"textarea",
|
|
22
|
+
"select",
|
|
23
|
+
"button",
|
|
24
|
+
"title",
|
|
25
|
+
"xmp"
|
|
26
|
+
]), p = 1, m = 3, h = /^https?:/i;
|
|
27
|
+
function b(r) {
|
|
28
|
+
const t = u(r);
|
|
29
|
+
return t !== null && h.test(t) ? t : null;
|
|
30
|
+
}
|
|
31
|
+
function a(r, t, e) {
|
|
32
|
+
for (const n of Array.from(r.childNodes)) {
|
|
33
|
+
if (n.nodeType === m) {
|
|
34
|
+
t.appendChild(e.createTextNode(n.nodeValue ?? ""));
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (n.nodeType !== p) continue;
|
|
38
|
+
const o = n, i = o.localName.toLowerCase();
|
|
39
|
+
if (f.has(i)) continue;
|
|
40
|
+
const s = i === "a" ? b(o.getAttribute("href")) : null;
|
|
41
|
+
if (s === null) {
|
|
42
|
+
a(o, t, e);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const c = e.createElement("a");
|
|
46
|
+
c.setAttribute("href", s), c.setAttribute("target", "_blank"), c.setAttribute("rel", "noopener"), a(o, c, e), t.appendChild(c);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function T(r, t) {
|
|
50
|
+
const e = r.ownerDocument, n = e.implementation.createHTMLDocument("").createElement("template");
|
|
51
|
+
n.innerHTML = t, a(n.content, r, e);
|
|
52
|
+
}
|
|
53
|
+
function g(r, t) {
|
|
54
|
+
const e = r.ownerDocument;
|
|
55
|
+
r.textContent = "", t.forEach((n, o) => {
|
|
56
|
+
o > 0 && r.appendChild(e.createTextNode(" | ")), T(r, n);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function y(r, t) {
|
|
60
|
+
const e = [];
|
|
61
|
+
for (const n of [...r, ...t])
|
|
62
|
+
typeof n == "string" && n.trim() && !e.includes(n) && e.push(n);
|
|
63
|
+
return e.sort((n, o) => n.length - o.length), e.filter((n, o) => !e.slice(o + 1).some((i) => i.includes(n)));
|
|
64
|
+
}
|
|
65
|
+
function E(r) {
|
|
66
|
+
const t = r.getZoom(), e = /* @__PURE__ */ new Set();
|
|
67
|
+
for (const i of r.getLayersOrder()) {
|
|
68
|
+
const s = r.getLayer(i);
|
|
69
|
+
s?.source && !s.isHidden?.(t) && e.add(s.source);
|
|
70
|
+
}
|
|
71
|
+
const n = r.getTerrain?.()?.source;
|
|
72
|
+
n && e.add(n);
|
|
73
|
+
const o = [];
|
|
74
|
+
for (const i of e) {
|
|
75
|
+
const s = r.getSource(i)?.attribution;
|
|
76
|
+
typeof s == "string" && o.push(s);
|
|
77
|
+
}
|
|
78
|
+
return o;
|
|
79
|
+
}
|
|
80
|
+
const l = ["styledata", "sourcedata", "terrain"];
|
|
81
|
+
class A {
|
|
82
|
+
custom;
|
|
83
|
+
map = null;
|
|
84
|
+
container = null;
|
|
85
|
+
inner = null;
|
|
86
|
+
rendered = null;
|
|
87
|
+
constructor(t) {
|
|
88
|
+
this.custom = t;
|
|
89
|
+
}
|
|
90
|
+
getDefaultPosition() {
|
|
91
|
+
return "bottom-right";
|
|
92
|
+
}
|
|
93
|
+
onAdd(t) {
|
|
94
|
+
const e = t.getContainer().ownerDocument, n = e.createElement("div");
|
|
95
|
+
n.className = "maplibregl-ctrl maplibregl-ctrl-attrib";
|
|
96
|
+
const o = e.createElement("div");
|
|
97
|
+
o.className = "maplibregl-ctrl-attrib-inner", n.appendChild(o), this.map = t, this.container = n, this.inner = o, this.rendered = null, this.refresh();
|
|
98
|
+
for (const i of l) t.on(i, this.onMapData);
|
|
99
|
+
return n;
|
|
100
|
+
}
|
|
101
|
+
onRemove() {
|
|
102
|
+
const t = this.map;
|
|
103
|
+
if (t) for (const e of l) t.off(e, this.onMapData);
|
|
104
|
+
this.container?.remove(), this.map = null, this.container = null, this.inner = null, this.rendered = null;
|
|
105
|
+
}
|
|
106
|
+
onMapData = (t) => {
|
|
107
|
+
t && (t.type === "terrain" || t.dataType === "style" || t.dataType === "source" && (t.sourceDataType === "metadata" || t.sourceDataType === "visibility")) && this.refresh();
|
|
108
|
+
};
|
|
109
|
+
refresh() {
|
|
110
|
+
const { map: t, container: e, inner: n } = this;
|
|
111
|
+
if (!t || !e || !n) return;
|
|
112
|
+
const o = y(this.custom, E(t)), i = o.join(" | ");
|
|
113
|
+
i !== this.rendered && (this.rendered = i, g(n, o), e.classList.toggle("maplibregl-attrib-empty", o.length === 0));
|
|
114
|
+
}
|
|
5
115
|
}
|
|
6
116
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
117
|
+
d as OSM_ATTRIBUTION,
|
|
118
|
+
A as TripMapAttributionControl,
|
|
119
|
+
T as appendCredit,
|
|
120
|
+
N as buildAttributions,
|
|
121
|
+
y as mergeAttributions,
|
|
122
|
+
g as renderAttributions,
|
|
123
|
+
E as usedSourceAttributions
|
|
9
124
|
};
|