@blogmcp/mdx-schema 0.2.2 → 0.4.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/dist/composables/useMdxParsing.d.ts +155 -0
- package/dist/composables/useMdxParsing.js +617 -30
- package/dist/composables/useMdxParsing.js.map +1 -1
- package/dist/metadata/index.js +102 -0
- package/dist/metadata/index.js.map +1 -1
- package/dist/metadata/validate.d.ts +19 -0
- package/dist/metadata/validate.js +40 -15
- package/dist/metadata/validate.js.map +1 -1
- package/dist/styles/index.d.ts +20 -0
- package/dist/styles/index.js +25 -0
- package/dist/styles/index.js.map +1 -1
- package/dist/tripmap.d.ts +71 -0
- package/dist/tripmap.js +103 -0
- package/dist/tripmap.js.map +1 -0
- package/dist/types/index.d.ts +53 -0
- package/dist/types/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -1
- package/src/composables/useMdxParsing.ts +629 -30
- package/src/metadata/index.ts +106 -0
- package/src/metadata/validate.ts +45 -15
- package/src/styles/index.ts +26 -0
- package/src/tripmap.ts +148 -0
- package/src/types/index.ts +56 -0
- package/src/version.ts +1 -1
package/src/metadata/index.ts
CHANGED
|
@@ -419,6 +419,112 @@ export const componentMetadata: ComponentMetadata[] = [
|
|
|
419
419
|
addedIn: '0.1.0',
|
|
420
420
|
deprecated: [],
|
|
421
421
|
},
|
|
422
|
+
{
|
|
423
|
+
name: 'TripMap',
|
|
424
|
+
description:
|
|
425
|
+
'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. In article previews it renders as a static photo strip + stop list — the live map loads on the published page.',
|
|
426
|
+
icon: '🗺',
|
|
427
|
+
category: 'media',
|
|
428
|
+
aliases: ['tripmap', 'map', 'trip', 'route', 'travelmap', 'hike'],
|
|
429
|
+
props: [
|
|
430
|
+
{
|
|
431
|
+
name: 'slugs',
|
|
432
|
+
type: 'string',
|
|
433
|
+
required: false,
|
|
434
|
+
description:
|
|
435
|
+
'Comma-separated media slugs to map (e.g. "img-a,img-b"). Omit for AUTO mode: all geotagged media of the article, sorted by capture time.',
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
name: 'exclude',
|
|
439
|
+
type: 'string',
|
|
440
|
+
required: false,
|
|
441
|
+
description: 'AUTO mode only: comma-separated media slugs to leave off the map.',
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
name: 'nodes',
|
|
445
|
+
type: 'array',
|
|
446
|
+
required: false,
|
|
447
|
+
description:
|
|
448
|
+
'Hand-made nodes merged chronologically with the photos. STRICT JSON with quoted keys: [{"lat": 49.35, "lng": 16.31, "title": "Níhov, nádraží", "capturedAt": "2025-04-20T08:52:00"}]. Entries without capturedAt render as markers but stay off the route line. Unquoted keys silently break the prop.',
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
name: 'height',
|
|
452
|
+
type: 'string',
|
|
453
|
+
required: false,
|
|
454
|
+
default: '"420px"',
|
|
455
|
+
description: 'CSS height of the map box.',
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: 'line',
|
|
459
|
+
type: 'boolean',
|
|
460
|
+
required: false,
|
|
461
|
+
default: 'true',
|
|
462
|
+
description: 'Draw the chronological route line between time-neighbouring nodes.',
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: 'filmstrip',
|
|
466
|
+
type: 'boolean',
|
|
467
|
+
required: false,
|
|
468
|
+
default: 'true',
|
|
469
|
+
description: 'Show the synced photo strip below the map.',
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
name: 'playback',
|
|
473
|
+
type: 'boolean',
|
|
474
|
+
required: false,
|
|
475
|
+
default: 'true',
|
|
476
|
+
description: 'Show the play button that flies the camera along the route.',
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: 'cluster',
|
|
480
|
+
type: 'boolean',
|
|
481
|
+
required: false,
|
|
482
|
+
default: 'true',
|
|
483
|
+
description: 'Cluster nearby markers at low zoom.',
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
name: 'theme',
|
|
487
|
+
type: 'string',
|
|
488
|
+
required: false,
|
|
489
|
+
default: '"auto"',
|
|
490
|
+
description: 'Map color scheme; "auto" follows the reader’s system preference.',
|
|
491
|
+
enum: ['light', 'dark', 'auto'],
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
name: 'styleUrl',
|
|
495
|
+
type: 'string',
|
|
496
|
+
required: false,
|
|
497
|
+
description: 'MapLibre style JSON URL override for this block (wins over tenant config).',
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
name: 'center',
|
|
501
|
+
type: 'string',
|
|
502
|
+
required: false,
|
|
503
|
+
description: 'Initial center as "lat,lng" — overrides smart framing; pair with zoom.',
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: 'zoom',
|
|
507
|
+
type: 'number',
|
|
508
|
+
required: false,
|
|
509
|
+
description: 'Initial zoom level — overrides smart framing; pair with center.',
|
|
510
|
+
numericRange: [1, 19],
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
name: 'title',
|
|
514
|
+
type: 'string',
|
|
515
|
+
required: false,
|
|
516
|
+
description: 'Accessible label for the map region.',
|
|
517
|
+
},
|
|
518
|
+
],
|
|
519
|
+
hasChildren: false,
|
|
520
|
+
selfClosing: true,
|
|
521
|
+
defaultProps: 'title="Trasa výletu"',
|
|
522
|
+
defaultChildren: '',
|
|
523
|
+
example:
|
|
524
|
+
'<TripMap title="Trasa údolím Libochovky" nodes={[{"lat": 49.3641, "lng": 16.3143, "title": "Níhov, nádraží", "capturedAt": "2025-04-20T08:52:00"}]} />',
|
|
525
|
+
addedIn: '0.3.0',
|
|
526
|
+
deprecated: [],
|
|
527
|
+
},
|
|
422
528
|
]
|
|
423
529
|
|
|
424
530
|
const metadataMap = new Map(componentMetadata.map(m => [m.name, m]))
|
package/src/metadata/validate.ts
CHANGED
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { ComponentMetadata } from '../types/index.js'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
scanMdxNodes,
|
|
11
|
+
stripFrontmatter,
|
|
12
|
+
computeBodyOffset,
|
|
13
|
+
lineAtOffset,
|
|
14
|
+
HAS_MDX_RE,
|
|
15
|
+
} from '../composables/useMdxParsing.js'
|
|
10
16
|
import { getComponentMetadata, getComponentNames } from './index.js'
|
|
11
17
|
|
|
12
18
|
export { HAS_MDX_RE }
|
|
@@ -115,26 +121,56 @@ export function validateComponent(
|
|
|
115
121
|
|
|
116
122
|
/**
|
|
117
123
|
* Validate all MDX components in markdown content.
|
|
124
|
+
*
|
|
125
|
+
* The reported `line` is a FILE coordinate (frontmatter included), derived from the OFFENDING
|
|
126
|
+
* instance's own scan offset. It replaces a `content.indexOf('<' + name)` lookup that had two
|
|
127
|
+
* independent defects, both measured on the shipped docs corpus:
|
|
128
|
+
*
|
|
129
|
+
* 1. It reported the FIRST occurrence of that component name for EVERY instance — 29 of 69
|
|
130
|
+
* extracted components got a wrong line (42%), worst delta +308 lines. `features/media-audio.md`
|
|
131
|
+
* reported "line 13" for seven different AudioPlayer instances, and `features/editor-mcp.md`
|
|
132
|
+
* blamed line 194 for an error that belongs to the `<Gallery .../>` on line 251.
|
|
133
|
+
* 2. It searched the ORIGINAL content while extraction ran on the frontmatter-STRIPPED copy, so a
|
|
134
|
+
* component name merely MENTIONED in frontmatter hijacked every reported line.
|
|
135
|
+
*
|
|
136
|
+
* `computeBodyOffset` (not `content.length - stripped.length`) is the correct base — the delta is
|
|
137
|
+
* wrong because `stripFrontmatter` trims BOTH ends. This line is what
|
|
138
|
+
* `ArticleComponentValidationError` interpolates, so it is the message an author must act on: a
|
|
139
|
+
* wrong one turns a true error into a half-hour hunt for a false positive.
|
|
140
|
+
*
|
|
141
|
+
* `line` is now always >= 1; the old `return 0` "not found" sentinel is gone — its consumers all
|
|
142
|
+
* interpolate the value into human-readable messages and none test for 0.
|
|
118
143
|
*/
|
|
119
144
|
export function validateMarkdownComponents(
|
|
120
145
|
content: string,
|
|
121
146
|
options?: ValidateOptions,
|
|
122
147
|
): ContentValidationResult {
|
|
123
148
|
const stripped = stripFrontmatter(content)
|
|
124
|
-
const
|
|
149
|
+
const bodyOffset = computeBodyOffset(content)
|
|
150
|
+
const nodes = scanMdxNodes(stripped)
|
|
125
151
|
const results: ComponentValidationResult[] = []
|
|
126
152
|
|
|
127
|
-
|
|
128
|
-
|
|
153
|
+
// ⚠ ONE monotonic cursor, not `lineAtOffset` per node. `scanMdxNodes` emits nodes in ascending
|
|
154
|
+
// `start`, so the newlines before node N are a prefix of those before node N+1 — counting from 0
|
|
155
|
+
// for every node makes this O(components × offset). Measured on legitimate content: 500 → 8000
|
|
156
|
+
// components (16×) took 20ms → 4397ms (220×), i.e. seconds of blocking CPU on the authenticated
|
|
157
|
+
// save path, while the scan itself stayed at 12ms. That was also strictly WORSE than the
|
|
158
|
+
// `indexOf`-based lookup this replaced, which would have made the correctness fix a performance
|
|
159
|
+
// regression.
|
|
160
|
+
let cursor = 0
|
|
161
|
+
let cursorLine = 1
|
|
129
162
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const line = findLineNumber(content, componentTag)
|
|
163
|
+
for (const node of nodes) {
|
|
164
|
+
if (node.type !== 'component') continue
|
|
133
165
|
|
|
134
|
-
const
|
|
166
|
+
const target = Math.min(bodyOffset + node.start, content.length)
|
|
167
|
+
for (; cursor < target; cursor++) if (content[cursor] === '\n') cursorLine++
|
|
168
|
+
const line = cursorLine
|
|
169
|
+
|
|
170
|
+
const validation = validateComponent(node.name, node.props, node.children, options)
|
|
135
171
|
if (!validation.valid || validation.warnings.length > 0) {
|
|
136
172
|
results.push({
|
|
137
|
-
name:
|
|
173
|
+
name: node.name,
|
|
138
174
|
line,
|
|
139
175
|
errors: validation.errors,
|
|
140
176
|
warnings: validation.warnings,
|
|
@@ -145,9 +181,3 @@ export function validateMarkdownComponents(
|
|
|
145
181
|
const valid = results.every(r => r.errors.length === 0)
|
|
146
182
|
return { valid, components: results }
|
|
147
183
|
}
|
|
148
|
-
|
|
149
|
-
function findLineNumber(content: string, search: string): number {
|
|
150
|
-
const index = content.indexOf(search)
|
|
151
|
-
if (index === -1) return 0
|
|
152
|
-
return content.substring(0, index).split('\n').length
|
|
153
|
-
}
|
package/src/styles/index.ts
CHANGED
|
@@ -14,6 +14,32 @@
|
|
|
14
14
|
|
|
15
15
|
import type { GalleryProps } from '../types/index.js'
|
|
16
16
|
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// TripMap — shared facade classes. The SSR facade (thumb strip + stop list +
|
|
19
|
+
// map placeholder) must render byte-identical in the Vue and React renderers;
|
|
20
|
+
// the live map's own chrome is styled by @blogmcp/tripmap-core at runtime.
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
export const tripMapStyles = {
|
|
23
|
+
container: 'my-6 flex flex-col gap-3 rounded-xl border border-gray-200 bg-white p-3',
|
|
24
|
+
head: 'text-sm font-medium text-gray-700 m-0',
|
|
25
|
+
/**
|
|
26
|
+
* Sized wrapper that hosts BOTH the engine div and the facade overlay.
|
|
27
|
+
* The engine host must be a plain absolutely-positioned child that the
|
|
28
|
+
* framework never re-patches (a reactive class binding on the engine's
|
|
29
|
+
* own container would clobber the classes the engine adds to it).
|
|
30
|
+
*/
|
|
31
|
+
mapWrap: 'relative w-full overflow-hidden rounded-lg',
|
|
32
|
+
mapOverlay: 'absolute inset-0',
|
|
33
|
+
mapBox: 'flex h-full w-full items-center justify-center overflow-hidden rounded-lg bg-gray-100',
|
|
34
|
+
mapHint: 'text-sm text-gray-500',
|
|
35
|
+
strip: 'flex gap-2 overflow-x-auto pb-1 m-0 p-0 list-none',
|
|
36
|
+
stripItem: 'h-20 w-20 flex-none overflow-hidden rounded-lg bg-gray-100',
|
|
37
|
+
stripImg: 'block h-full w-full object-cover',
|
|
38
|
+
stopList: 'flex flex-col gap-0.5 text-sm text-gray-700 m-0 p-0 list-none',
|
|
39
|
+
stopTime: 'mr-2 tabular-nums text-gray-500',
|
|
40
|
+
note: 'text-xs text-gray-400 m-0',
|
|
41
|
+
} as const
|
|
42
|
+
|
|
17
43
|
// ---------------------------------------------------------------------------
|
|
18
44
|
// Button — from mdx-render-vue/src/render/button/Button.vue
|
|
19
45
|
// ---------------------------------------------------------------------------
|
package/src/tripmap.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TripMap shared helpers — pure TS, zero framework deps (like
|
|
3
|
+
* `galleryTileLayout` in ./styles). Both renderer packages AND the
|
|
4
|
+
* drhoubicka storefront import these so prop parsing, the /api/media/geo
|
|
5
|
+
* URL contract, time formatting, and UI texts cannot drift between
|
|
6
|
+
* frameworks.
|
|
7
|
+
*
|
|
8
|
+
* NOTE: nothing here may import '@blogmcp/tripmap-core' — the renderers
|
|
9
|
+
* reach the map engine only via a dynamic import (single-file-bundle
|
|
10
|
+
* constraint, see the renderers' TripMap components).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { TripMapHandNode, TripMapProps } from './types/index.js'
|
|
14
|
+
|
|
15
|
+
export const TRIPMAP_DEFAULT_HEIGHT = '420px'
|
|
16
|
+
|
|
17
|
+
/** Comma-separated prop list → trimmed, non-empty entries. */
|
|
18
|
+
export function splitTripMapList(value: string | undefined): string[] {
|
|
19
|
+
return (value ?? '')
|
|
20
|
+
.split(',')
|
|
21
|
+
.map((s) => s.trim())
|
|
22
|
+
.filter(Boolean)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* `nodes` should arrive as an array (strict-JSON prop). A malformed prop
|
|
27
|
+
* reaches the renderer as a raw string — try one lenient parse, else drop
|
|
28
|
+
* with a console hint so authors can find the mistake.
|
|
29
|
+
*/
|
|
30
|
+
export function parseTripMapHandNodes(raw: TripMapProps['nodes']): TripMapHandNode[] {
|
|
31
|
+
let value: unknown = raw
|
|
32
|
+
if (typeof value === 'string') {
|
|
33
|
+
try {
|
|
34
|
+
value = JSON.parse(value)
|
|
35
|
+
} catch {
|
|
36
|
+
if (typeof console !== 'undefined') {
|
|
37
|
+
console.warn(
|
|
38
|
+
'[TripMap] `nodes` prop is not valid JSON — use quoted keys: [{"lat":49.3,"lng":16.3}]',
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
return []
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (!Array.isArray(value)) return []
|
|
45
|
+
return value.filter(
|
|
46
|
+
(n): n is TripMapHandNode =>
|
|
47
|
+
!!n &&
|
|
48
|
+
typeof n === 'object' &&
|
|
49
|
+
typeof (n as TripMapHandNode).lat === 'number' &&
|
|
50
|
+
typeof (n as TripMapHandNode).lng === 'number',
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* HH:MM as written in the ISO string — string slice, no Date math. EXIF
|
|
56
|
+
* capture times are timezone-ambiguous; interpreting them through the
|
|
57
|
+
* viewer's timezone would shift a trip's times by the viewer-vs-server
|
|
58
|
+
* offset. The wall clock as stored is the neutral rendering.
|
|
59
|
+
*/
|
|
60
|
+
export function tripMapFormatTime(iso: string): string {
|
|
61
|
+
const m = /T(\d{2}):(\d{2})/.exec(iso)
|
|
62
|
+
return m ? `${m[1]}:${m[2]}` : ''
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Build the GET /api/media/geo URL for a TripMap block. Explicit `slugs`
|
|
67
|
+
* win; otherwise auto mode selects by article identity; with neither the
|
|
68
|
+
* URL is a config-only request (the endpoint answers with the tenant basemap
|
|
69
|
+
* `config` and no nodes) so a hand-made-nodes map still gets its style.
|
|
70
|
+
*/
|
|
71
|
+
export function buildTripMapGeoUrl(
|
|
72
|
+
props: Pick<TripMapProps, 'slugs' | 'exclude'>,
|
|
73
|
+
article?: { filename?: string; language?: string } | null,
|
|
74
|
+
): string {
|
|
75
|
+
const params = new URLSearchParams()
|
|
76
|
+
if (article?.language) params.set('lang', article.language)
|
|
77
|
+
const slugs = splitTripMapList(props.slugs)
|
|
78
|
+
if (slugs.length > 0) {
|
|
79
|
+
params.set('slugs', slugs.join(','))
|
|
80
|
+
return `/api/media/geo?${params.toString()}`
|
|
81
|
+
}
|
|
82
|
+
if (article?.filename) {
|
|
83
|
+
params.set('article', article.filename)
|
|
84
|
+
const exclude = splitTripMapList(props.exclude)
|
|
85
|
+
if (exclude.length > 0) params.set('exclude', exclude.join(','))
|
|
86
|
+
return `/api/media/geo?${params.toString()}`
|
|
87
|
+
}
|
|
88
|
+
// Nothing to select (hand-made nodes only, or a host that provides no
|
|
89
|
+
// article context): still call the endpoint — its `config` block is the
|
|
90
|
+
// only place the tenant basemap (style URL chain) is resolved; the node
|
|
91
|
+
// list comes back empty.
|
|
92
|
+
const qs = params.toString()
|
|
93
|
+
return qs ? `/api/media/geo?${qs}` : '/api/media/geo'
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** One node of the GET /api/media/geo response. */
|
|
97
|
+
export interface TripMapGeoNode {
|
|
98
|
+
slug: string
|
|
99
|
+
latitude: number
|
|
100
|
+
longitude: number
|
|
101
|
+
capturedAt?: string | null
|
|
102
|
+
thumbnailUrl?: string | null
|
|
103
|
+
url?: string | null
|
|
104
|
+
altText?: string | null
|
|
105
|
+
placeName?: string | null
|
|
106
|
+
width?: number | null
|
|
107
|
+
height?: number | null
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface TripMapGeoResponse {
|
|
111
|
+
config?: {
|
|
112
|
+
styleUrl?: string
|
|
113
|
+
darkStyleUrl?: string
|
|
114
|
+
attribution?: string
|
|
115
|
+
}
|
|
116
|
+
nodes: TripMapGeoNode[]
|
|
117
|
+
/** Count of requested media without exposed geo. */
|
|
118
|
+
skipped?: number
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface TripMapUiTexts {
|
|
122
|
+
hint: string
|
|
123
|
+
empty: string
|
|
124
|
+
unavailable: string
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function tripMapUiTexts(language: string | undefined): TripMapUiTexts {
|
|
128
|
+
const czech = (language ?? '').toLowerCase().startsWith('cs')
|
|
129
|
+
return czech
|
|
130
|
+
? {
|
|
131
|
+
hint: 'Interaktivní mapa výletu',
|
|
132
|
+
empty: 'Žádná z fotek nemá zveřejněnou polohu.',
|
|
133
|
+
unavailable: 'Mapa se zobrazí na publikovaném webu.',
|
|
134
|
+
}
|
|
135
|
+
: {
|
|
136
|
+
hint: 'Interactive trip map',
|
|
137
|
+
empty: 'No photos with public location data.',
|
|
138
|
+
unavailable: 'The map is shown on the published page.',
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function tripMapPlaybackLabels(
|
|
143
|
+
language: string | undefined,
|
|
144
|
+
): { play: string; stop: string } | undefined {
|
|
145
|
+
return (language ?? '').toLowerCase().startsWith('cs')
|
|
146
|
+
? { play: 'Přehrát trasu', stop: 'Zastavit' }
|
|
147
|
+
: undefined
|
|
148
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -92,6 +92,62 @@ export interface AudioPlayerProps {
|
|
|
92
92
|
showTranscription?: boolean
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* TripMap component types
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Hand-made map node authored in the `nodes` prop. STRICT JSON in MDX:
|
|
101
|
+
* `nodes={[{"lat":49.35,"lng":16.31,"title":"Níhov"}]}` — unquoted keys
|
|
102
|
+
* silently degrade to a raw string in the prop parser.
|
|
103
|
+
*/
|
|
104
|
+
export interface TripMapHandNode {
|
|
105
|
+
lat: number
|
|
106
|
+
lng: number
|
|
107
|
+
/** Stable identity; generated (`waypoint-<n>`) when omitted */
|
|
108
|
+
id?: string
|
|
109
|
+
/** Short label shown on the marker popup + filmstrip */
|
|
110
|
+
title?: string
|
|
111
|
+
description?: string
|
|
112
|
+
/** ISO timestamp — places the node into the chronological route line */
|
|
113
|
+
capturedAt?: string
|
|
114
|
+
thumbnailUrl?: string
|
|
115
|
+
/** Optional link target for the popup */
|
|
116
|
+
href?: string
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface TripMapProps {
|
|
120
|
+
/**
|
|
121
|
+
* Comma-separated media slugs to map. Omit for AUTO mode: every geotagged
|
|
122
|
+
* media attached to or embedded in the article, sorted by capture time.
|
|
123
|
+
*/
|
|
124
|
+
slugs?: string
|
|
125
|
+
/** AUTO mode only: comma-separated media slugs to leave off the map */
|
|
126
|
+
exclude?: string
|
|
127
|
+
/** Hand-made nodes (strict JSON), merged chronologically with photo nodes */
|
|
128
|
+
nodes?: TripMapHandNode[]
|
|
129
|
+
/** CSS height of the map box (e.g. "420px") */
|
|
130
|
+
height?: string
|
|
131
|
+
/** Chronological polyline between time-neighbouring nodes */
|
|
132
|
+
line?: boolean
|
|
133
|
+
/** Synced photo strip below the map */
|
|
134
|
+
filmstrip?: boolean
|
|
135
|
+
/** Play button: sequential fly-through along the route */
|
|
136
|
+
playback?: boolean
|
|
137
|
+
/** Marker clustering */
|
|
138
|
+
cluster?: boolean
|
|
139
|
+
/** Color scheme; "auto" follows the reader's system preference */
|
|
140
|
+
theme?: 'light' | 'dark' | 'auto'
|
|
141
|
+
/** MapLibre style JSON URL override (wins over tenant config) */
|
|
142
|
+
styleUrl?: string
|
|
143
|
+
/** Initial center "lat,lng" — overrides smart framing (pair with zoom) */
|
|
144
|
+
center?: string
|
|
145
|
+
/** Initial zoom (1-19) — overrides smart framing (pair with center) */
|
|
146
|
+
zoom?: number
|
|
147
|
+
/** Accessible label for the map region */
|
|
148
|
+
title?: string
|
|
149
|
+
}
|
|
150
|
+
|
|
95
151
|
/**
|
|
96
152
|
* Common component variant type
|
|
97
153
|
*/
|