@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,70 +1,72 @@
|
|
|
1
|
-
import { lineNodes as m } from "./nodes.js";
|
|
2
|
-
function
|
|
3
|
-
return
|
|
1
|
+
import { lineNodes as g, captureTimeMs as m } from "./nodes.js";
|
|
2
|
+
function c(o) {
|
|
3
|
+
return g(o);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const t =
|
|
7
|
-
if (
|
|
8
|
-
if (t.length <=
|
|
5
|
+
function u(o, n) {
|
|
6
|
+
const t = o.slice(1, -1);
|
|
7
|
+
if (n <= 0 || t.length === 0) return [];
|
|
8
|
+
if (t.length <= n) return t;
|
|
9
9
|
const r = [];
|
|
10
|
-
for (let
|
|
11
|
-
const
|
|
12
|
-
r[r.length - 1] !==
|
|
10
|
+
for (let i = 0; i < n; i++) {
|
|
11
|
+
const a = Math.round((i + 1) * (t.length - 1) / (n + 1)), e = t[Math.min(a, t.length - 1)];
|
|
12
|
+
r[r.length - 1] !== e && r.push(e);
|
|
13
13
|
}
|
|
14
14
|
return r;
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
function
|
|
18
|
-
const t =
|
|
16
|
+
const l = (o) => o.toFixed(5).replace(/\.?0+$/, "");
|
|
17
|
+
function h(o, n = {}) {
|
|
18
|
+
const t = c(o);
|
|
19
19
|
if (t.length < 2) return null;
|
|
20
|
-
const r = (
|
|
21
|
-
`mapset=${
|
|
20
|
+
const r = (e) => `${l(e.lng)},${l(e.lat)}`, i = [
|
|
21
|
+
`mapset=${n.mapset ?? "outdoor"}`,
|
|
22
22
|
`start=${r(t[0])}`,
|
|
23
23
|
`end=${r(t[t.length - 1])}`,
|
|
24
|
-
`routeType=${
|
|
25
|
-
],
|
|
26
|
-
return
|
|
24
|
+
`routeType=${n.routeType ?? "foot_hiking"}`
|
|
25
|
+
], a = u(t, Math.min(n.maxWaypoints ?? 15, 15));
|
|
26
|
+
return a.length > 0 && i.push(`waypoints=${a.map(r).join(";")}`), n.navigate && i.push("navigate=true"), `https://mapy.com/fnc/v1/route?${i.join("&")}`;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const t =
|
|
28
|
+
function f(o, n = {}) {
|
|
29
|
+
const t = c(o);
|
|
30
30
|
if (t.length < 2) return null;
|
|
31
|
-
const r = (
|
|
31
|
+
const r = (e) => `${l(e.lat)},${l(e.lng)}`, i = [
|
|
32
32
|
"api=1",
|
|
33
33
|
`origin=${r(t[0])}`,
|
|
34
34
|
`destination=${r(t[t.length - 1])}`,
|
|
35
|
-
`travelmode=${
|
|
36
|
-
],
|
|
37
|
-
return
|
|
35
|
+
`travelmode=${n.travelmode ?? "walking"}`
|
|
36
|
+
], a = u(t, Math.min(n.maxWaypoints ?? 9, 9));
|
|
37
|
+
return a.length > 0 && i.push(`waypoints=${a.map(r).join("%7C")}`), `https://www.google.com/maps/dir/?${i.join("&")}`;
|
|
38
38
|
}
|
|
39
|
-
const s = (
|
|
40
|
-
function
|
|
41
|
-
const
|
|
39
|
+
const s = (o) => o.replace(/[<>&'"]/g, (n) => ({ "<": "<", ">": ">", "&": "&", "'": "'", '"': """ })[n]);
|
|
40
|
+
function p(o) {
|
|
41
|
+
const n = m(o);
|
|
42
|
+
return n === null ? "" : `<time>${new Date(n).toISOString()}</time>`;
|
|
43
|
+
}
|
|
44
|
+
function d(o, n = {}) {
|
|
45
|
+
const t = c(o);
|
|
42
46
|
if (t.length < 2) return null;
|
|
43
|
-
const r = s(
|
|
47
|
+
const r = s(n.name || "Trip"), a = [
|
|
44
48
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
45
|
-
`<gpx version="1.1" creator="${s(
|
|
46
|
-
` <metadata><name>${r}</name>${
|
|
49
|
+
`<gpx version="1.1" creator="${s(n.creator || "blogmcp TripMap")}" xmlns="http://www.topografix.com/GPX/1/1">`,
|
|
50
|
+
` <metadata><name>${r}</name>${p(t[0].capturedAt)}</metadata>`
|
|
47
51
|
];
|
|
48
|
-
for (const
|
|
49
|
-
|
|
50
|
-
` <wpt lat="${
|
|
51
|
-
);
|
|
52
|
-
o.push(` <trk><name>${r}</name><trkseg>`);
|
|
53
|
-
for (const n of t)
|
|
54
|
-
o.push(
|
|
55
|
-
` <trkpt lat="${p(n.lat)}" lon="${p(n.lng)}">` + (n.capturedAt ? `<time>${l(n.capturedAt)}</time>` : "") + "</trkpt>"
|
|
52
|
+
for (const e of o)
|
|
53
|
+
e.title && a.push(
|
|
54
|
+
` <wpt lat="${l(e.lat)}" lon="${l(e.lng)}">` + p(e.capturedAt) + `<name>${s(e.title)}</name>` + (e.description ? `<desc>${s(e.description)}</desc>` : "") + "</wpt>"
|
|
56
55
|
);
|
|
57
|
-
|
|
56
|
+
a.push(` <trk><name>${r}</name><trkseg>`);
|
|
57
|
+
for (const e of t)
|
|
58
|
+
a.push(` <trkpt lat="${l(e.lat)}" lon="${l(e.lng)}">${p(e.capturedAt)}</trkpt>`);
|
|
59
|
+
return a.push(" </trkseg></trk>", "</gpx>", ""), a.join(`
|
|
58
60
|
`);
|
|
59
61
|
}
|
|
60
|
-
function
|
|
61
|
-
return `${(
|
|
62
|
+
function w(o, n = "trasa") {
|
|
63
|
+
return `${(o ?? "").normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || n}.gpx`;
|
|
62
64
|
}
|
|
63
65
|
export {
|
|
64
66
|
d as buildGpx,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
f as googleMapsRouteUrl,
|
|
68
|
+
w as gpxFileName,
|
|
69
|
+
h as mapyRouteUrl,
|
|
70
|
+
c as routePoints,
|
|
71
|
+
u as sampleWaypoints
|
|
70
72
|
};
|
|
@@ -1,35 +1,48 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
3
|
-
constructor(s,
|
|
4
|
-
this.callbacks =
|
|
1
|
+
const l = "tripmap-filmstrip__item--active";
|
|
2
|
+
class r {
|
|
3
|
+
constructor(s, e) {
|
|
4
|
+
this.callbacks = e, this.root = document.createElement("div"), this.root.className = "tripmap-filmstrip", this.root.setAttribute("role", "listbox"), s.appendChild(this.root);
|
|
5
5
|
}
|
|
6
6
|
root;
|
|
7
7
|
items = /* @__PURE__ */ new Map();
|
|
8
|
+
/**
|
|
9
|
+
* The active node id, remembered ACROSS rebuilds. `setNodes` runs again when
|
|
10
|
+
* the map style finishes loading (engine `applyData`), and a host that
|
|
11
|
+
* activates a node before that — the storefront's Split map dialog opens ON
|
|
12
|
+
* the clicked photo — would otherwise get a fresh strip with nothing selected
|
|
13
|
+
* and the scroll back at the start.
|
|
14
|
+
*/
|
|
15
|
+
activeId = null;
|
|
8
16
|
setNodes(s) {
|
|
9
17
|
this.root.textContent = "", this.items.clear();
|
|
10
|
-
for (const
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
18
|
+
for (const e of s) {
|
|
19
|
+
const i = document.createElement("button");
|
|
20
|
+
if (i.type = "button", i.className = "tripmap-filmstrip__item", i.dataset.tripmapNode = e.id, i.setAttribute("role", "option"), i.setAttribute("aria-selected", "false"), i.setAttribute("aria-label", e.title || e.altText || e.id), e.thumbnailUrl) {
|
|
13
21
|
const t = document.createElement("img");
|
|
14
|
-
t.src =
|
|
22
|
+
t.src = e.thumbnailUrl, t.alt = "", t.loading = "lazy", t.decoding = "async", t.draggable = !1, t.className = "tripmap-filmstrip__img", i.appendChild(t);
|
|
15
23
|
} else {
|
|
16
|
-
|
|
24
|
+
i.classList.add("tripmap-filmstrip__item--waypoint");
|
|
17
25
|
const t = document.createElement("span");
|
|
18
|
-
t.className = "tripmap-filmstrip__label", t.textContent =
|
|
26
|
+
t.className = "tripmap-filmstrip__label", t.textContent = e.title || "·", i.appendChild(t);
|
|
19
27
|
}
|
|
20
|
-
|
|
28
|
+
const a = e.capturedAt ? this.callbacks.formatTime(e.capturedAt) : "";
|
|
29
|
+
if (a) {
|
|
21
30
|
const t = document.createElement("span");
|
|
22
|
-
t.className = "tripmap-filmstrip__time", t.textContent =
|
|
31
|
+
t.className = "tripmap-filmstrip__time", t.textContent = a, i.appendChild(t);
|
|
23
32
|
}
|
|
24
|
-
|
|
33
|
+
i.addEventListener("click", () => this.callbacks.onSelect(e)), this.items.set(e.id, i), this.root.appendChild(i);
|
|
25
34
|
}
|
|
35
|
+
this.activeId && this.items.has(this.activeId) && this.apply(this.activeId, "instant");
|
|
26
36
|
}
|
|
27
37
|
setActive(s) {
|
|
28
|
-
|
|
38
|
+
this.activeId = s, this.apply(s, "smooth");
|
|
39
|
+
}
|
|
40
|
+
apply(s, e) {
|
|
41
|
+
for (const [i, a] of this.items) {
|
|
29
42
|
const t = i === s;
|
|
30
|
-
if (
|
|
43
|
+
if (a.classList.toggle(l, t), a.setAttribute("aria-selected", t ? "true" : "false"), t && typeof a.scrollIntoView == "function")
|
|
31
44
|
try {
|
|
32
|
-
|
|
45
|
+
a.scrollIntoView({ block: "nearest", inline: "nearest", behavior: e });
|
|
33
46
|
} catch {
|
|
34
47
|
}
|
|
35
48
|
}
|
|
@@ -42,5 +55,5 @@ class l {
|
|
|
42
55
|
}
|
|
43
56
|
}
|
|
44
57
|
export {
|
|
45
|
-
|
|
58
|
+
r as Filmstrip
|
|
46
59
|
};
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
function
|
|
2
|
-
const t = [...
|
|
3
|
-
return t.length % 2 ? t[
|
|
1
|
+
function s(n) {
|
|
2
|
+
const t = [...n].sort((i, r) => i - r), e = Math.floor(t.length / 2);
|
|
3
|
+
return t.length % 2 ? t[e] : (t[e - 1] + t[e]) / 2;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return Math.sqrt(
|
|
5
|
+
function m(n, t) {
|
|
6
|
+
const i = (n.lat - t.lat) * 111.32, r = (n.lng - t.lng) * 111.32 * Math.cos((n.lat + t.lat) / 2 * (Math.PI / 180));
|
|
7
|
+
return Math.sqrt(i * i + r * r);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
let t = 1 / 0,
|
|
11
|
-
for (const
|
|
12
|
-
|
|
9
|
+
function f(n) {
|
|
10
|
+
let t = 1 / 0, e = 1 / 0, i = -1 / 0, r = -1 / 0;
|
|
11
|
+
for (const o of n)
|
|
12
|
+
o.lng < t && (t = o.lng), o.lng > i && (i = o.lng), o.lat < e && (e = o.lat), o.lat > r && (r = o.lat);
|
|
13
13
|
return [
|
|
14
|
-
[t,
|
|
15
|
-
[
|
|
14
|
+
[t, e],
|
|
15
|
+
[i, r]
|
|
16
16
|
];
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function u(n) {
|
|
19
|
+
return m({ lat: n[0][1], lng: n[0][0] }, { lat: n[1][1], lng: n[1][0] });
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const t =
|
|
21
|
+
function p(n) {
|
|
22
|
+
const t = n.filter((l) => Number.isFinite(l.lat) && Number.isFinite(l.lng));
|
|
23
23
|
if (t.length === 0) return null;
|
|
24
24
|
if (t.length === 1) {
|
|
25
|
-
const
|
|
25
|
+
const l = t[0];
|
|
26
26
|
return [
|
|
27
|
-
[
|
|
28
|
-
[
|
|
27
|
+
[l.lng, l.lat],
|
|
28
|
+
[l.lng, l.lat]
|
|
29
29
|
];
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
if (t.length < 5) return
|
|
33
|
-
const
|
|
34
|
-
lat:
|
|
35
|
-
lng:
|
|
36
|
-
},
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
return
|
|
31
|
+
const e = f(t);
|
|
32
|
+
if (t.length < 5) return e;
|
|
33
|
+
const i = {
|
|
34
|
+
lat: s(t.map((l) => l.lat)),
|
|
35
|
+
lng: s(t.map((l) => l.lng))
|
|
36
|
+
}, r = t.map((l) => m(l, i)), o = Math.max(5, 3 * s(r)), a = t.filter((l, d) => r[d] <= o);
|
|
37
|
+
if (a.length === t.length || a.length < 2) return e;
|
|
38
|
+
const c = f(a), g = u(e), h = u(c);
|
|
39
|
+
return g > 0 && h / g < 0.5 ? c : e;
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
m as approxDistanceKm,
|
|
43
|
+
p as computeFramingBounds
|
|
44
44
|
};
|