@story-map/remark-story-map 0.3.0 → 0.5.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/README.md +36 -239
- package/dist/client.d.ts +15 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.diagnostics-dom.test.d.ts +2 -0
- package/dist/client.diagnostics-dom.test.d.ts.map +1 -0
- package/dist/client.diagnostics-dom.test.js +103 -0
- package/dist/client.diagnostics-dom.test.js.map +1 -0
- package/dist/client.js +56 -5
- package/dist/client.js.map +1 -1
- package/dist/fixtures.d.ts +18 -0
- package/dist/fixtures.d.ts.map +1 -0
- package/dist/fixtures.js +110 -0
- package/dist/fixtures.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -12
- package/dist/index.js.map +1 -1
- package/dist/vault.d.ts +43 -2
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +95 -14
- package/dist/vault.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,261 +1,58 @@
|
|
|
1
1
|
# @story-map/remark-story-map
|
|
2
2
|
|
|
3
|
-
Build-time Remark adapter and browser client for publishing
|
|
4
|
-
|
|
3
|
+
Build-time Remark adapter and browser client for publishing maps from a Docusaurus site.
|
|
4
|
+
It handles two fenced-block dialects:
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`.story-map-host[data-story-map-config]` placeholder. No Leaflet map is created
|
|
9
|
-
during the Node/SSR build. In the browser, the client entry mounts the shared
|
|
10
|
-
`@story-map/react-story-map` renderer into every host, including after
|
|
11
|
-
Docusaurus SPA navigation.
|
|
6
|
+
- ` ```story-map ` — a story: slides, a layout, and a panel.
|
|
7
|
+
- ` ```leaflet ` — a legacy storyless map: markers from notes, no slides.
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
9
|
+
At build time each block is parsed with the matching `story-map-core` parser, optionally
|
|
10
|
+
resolved against a Vault, and replaced with a
|
|
11
|
+
`.story-map-host[data-story-map-config]` placeholder carrying an explicit
|
|
12
|
+
`data-story-map-kind` discriminator. No Leaflet map is created during the Node/SSR build.
|
|
13
|
+
In the browser, one client entry mounts the shared renderer into every host, including
|
|
14
|
+
after Docusaurus SPA navigation.
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
pnpm add @story-map/remark-story-map react@^19 react-dom@^19
|
|
16
|
+
```sh
|
|
17
|
+
npm install @story-map/remark-story-map react@^19 react-dom@^19
|
|
22
18
|
```
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
these peer requirements; verify the site's versions before integrating. Build-time
|
|
28
|
-
usage is ESM and the release workflow verifies Node 24 imports. A full Docusaurus site
|
|
29
|
-
build and browser smoke test remain host integration checks.
|
|
30
|
-
|
|
31
|
-
## Docusaurus setup
|
|
32
|
-
|
|
33
|
-
Register the transformer in the docs and/or blog options. The same plugin
|
|
34
|
-
instance can be used for both:
|
|
20
|
+
- Build entry: `@story-map/remark-story-map` (Node APIs allowed).
|
|
21
|
+
- Browser entry: `@story-map/remark-story-map/client` (no Node APIs).
|
|
22
|
+
- React and React DOM are peer dependencies; both must be React 19.
|
|
35
23
|
|
|
36
24
|
```js
|
|
37
25
|
import remarkStoryMap from '@story-map/remark-story-map';
|
|
38
26
|
|
|
39
|
-
const storyMapOptions = {
|
|
40
|
-
vaultRoot: '/absolute/path/to/vault',
|
|
41
|
-
assetBase: '/vault-assets',
|
|
42
|
-
resolveNoteHref: (vaultRelativePath) => {
|
|
43
|
-
// See "Resolving published note routes" below.
|
|
44
|
-
return undefined;
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
27
|
export default {
|
|
49
|
-
presets: [
|
|
50
|
-
[
|
|
51
|
-
'classic',
|
|
52
|
-
{
|
|
53
|
-
docs: {
|
|
54
|
-
remarkPlugins: [[remarkStoryMap, storyMapOptions]],
|
|
55
|
-
},
|
|
56
|
-
blog: {
|
|
57
|
-
remarkPlugins: [[remarkStoryMap, storyMapOptions]],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
],
|
|
28
|
+
presets: [['classic', { docs: { remarkPlugins: [[remarkStoryMap, { vaultRoot, resolveNoteHref }]] } }]],
|
|
62
29
|
plugins: ['./plugins/story-map-client'],
|
|
63
30
|
};
|
|
64
31
|
```
|
|
65
32
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## Options
|
|
70
|
-
|
|
71
|
-
| Option | Type | Purpose |
|
|
72
|
-
| --- | --- | --- |
|
|
73
|
-
| `vaultRoot` | `string` | Vault/repo root to index. Required for explicit `slide.note` WikiLinks and recursive `noteFolder` discovery. |
|
|
74
|
-
| `assetBase` | `string` | URL prefix that rewrites resolved Vault-relative media paths (for example `/vault-assets`). It only rewrites URLs; it does not copy files. |
|
|
75
|
-
| `resolveNoteHref` | `(vaultRelativePath: string) => string \| undefined` | Host callback that maps a Vault-relative note path (without `.md`) to its final published href. Used by `noteDisplay: link`. |
|
|
76
|
-
|
|
77
|
-
`vaultRelativePath` is the note's Vault-relative path without the extension,
|
|
78
|
-
using forward slashes, for example `Trips/Santiago`.
|
|
79
|
-
|
|
80
|
-
When `vaultRoot` is omitted, fenced blocks are parsed and serialized, but no
|
|
81
|
-
note or `noteFolder` resolution happens.
|
|
82
|
-
|
|
83
|
-
The normalized `map.theme` (`auto`, `light`, `dark`, `vintage`, `cyber`, `atlas`) and
|
|
84
|
-
document-owned `layout` (`card` or `full`) pass through to the shared renderer
|
|
85
|
-
unchanged. Remark adds no theme palette or layout behavior of its own. `auto` falls back
|
|
86
|
-
to `prefers-color-scheme` in the published site unless the host sets `--story-map-*`.
|
|
87
|
-
|
|
88
|
-
## Resolving published note routes
|
|
89
|
-
|
|
90
|
-
`resolveNoteHref` lets the host decide published URLs. The `kywk.github.io`
|
|
91
|
-
site already owns this decision through `scripts/content-links.js`, which
|
|
92
|
-
exports `createContentLinkIndex({ root, docsConfig, blogConfig })`. Its index
|
|
93
|
-
exposes `resolve(name)`, returning an array of entries with a `.route`
|
|
94
|
-
property. Wire the callback to that existing index instead of reimplementing
|
|
95
|
-
slug logic:
|
|
96
|
-
|
|
97
|
-
```js
|
|
98
|
-
import { createContentLinkIndex } from './scripts/content-links.js';
|
|
99
|
-
|
|
100
|
-
const contentLinkIndex = createContentLinkIndex({
|
|
101
|
-
root: vaultRoot,
|
|
102
|
-
docsConfig,
|
|
103
|
-
blogConfig,
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
const storyMapOptions = {
|
|
107
|
-
vaultRoot,
|
|
108
|
-
assetBase: '/vault-assets',
|
|
109
|
-
resolveNoteHref: (vaultRelativePath) => {
|
|
110
|
-
const matches = contentLinkIndex.resolve(vaultRelativePath);
|
|
111
|
-
return matches.length === 1 ? matches[0].route : undefined;
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Rules enforced by the package:
|
|
117
|
-
|
|
118
|
-
- `resolveNoteHref` is only consulted for `noteDisplay: link`.
|
|
119
|
-
- A returned string becomes `StorySlide.notePath`, which the renderer turns
|
|
120
|
-
into a normal browser link.
|
|
121
|
-
- `undefined` (or an ambiguous multiple-match result) leaves the slide title
|
|
122
|
-
unlinked; the build does not invent a route.
|
|
123
|
-
- No absolute local filesystem path is ever serialized into the HTML.
|
|
124
|
-
|
|
125
|
-
Do not copy `deriveSlug()` or any Docusaurus URL normalization into the
|
|
126
|
-
package or the site's StoryMap config; keep the existing
|
|
127
|
-
`scripts/content-links.js` / `remark-slug-normalizer` pipeline as the single
|
|
128
|
-
URL authority.
|
|
129
|
-
|
|
130
|
-
## Note resolution
|
|
131
|
-
|
|
132
|
-
With `vaultRoot` configured, notes are indexed recursively. The scanner skips
|
|
133
|
-
dot-directories, `node_modules`, `build`, `dist`, and `coverage`.
|
|
134
|
-
|
|
135
|
-
### Explicit slides
|
|
136
|
-
|
|
137
|
-
A slide with `note: "[[Trips/Santiago]]"` inherits note frontmatter
|
|
138
|
-
(`title`, `description`/`summary`, `location`, `cover`/`image`/`media`,
|
|
139
|
-
`mapmarker`). Explicit slide properties override note-derived values, and
|
|
140
|
-
explicit slides keep their author order exactly: they are never appended to or
|
|
141
|
-
reordered by folder discovery. A WikiLink matching multiple notes without an
|
|
142
|
-
explicit path is a build-time error; use a Vault-relative path.
|
|
143
|
-
|
|
144
|
-
### `noteFolder`
|
|
145
|
-
|
|
146
|
-
`noteFolder` names one Vault-relative folder (subfolders are included
|
|
147
|
-
recursively). Order is controlled only by:
|
|
148
|
-
|
|
149
|
-
- `order: asc | desc` (default `asc`);
|
|
150
|
-
- `dateField` (default `date-created`).
|
|
151
|
-
|
|
152
|
-
Only notes whose frontmatter contains `story-map-note: true` are discovered;
|
|
153
|
-
other Markdown files in the folder are ignored. Notes without a parseable date
|
|
154
|
-
sort last.
|
|
155
|
-
|
|
156
|
-
`includeTags` keeps only notes whose frontmatter tags contain any listed tag,
|
|
157
|
-
and `excludeTags` drops notes whose frontmatter tags contain any listed tag.
|
|
158
|
-
Both are optional, compare case-insensitively, and read the frontmatter `tags` or
|
|
159
|
-
`tag` key only (matching Obsidian).
|
|
160
|
-
|
|
161
|
-
```yaml
|
|
162
|
-
noteFolder: Trips/Santiago
|
|
163
|
-
order: desc
|
|
164
|
-
dateField: date-created
|
|
165
|
-
includeTags: [travel, chile]
|
|
166
|
-
excludeTags: [draft]
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## `noteDisplay`
|
|
170
|
-
|
|
171
|
-
Note presentation is controlled by `noteDisplay`, which accepts:
|
|
172
|
-
|
|
173
|
-
- `basic` — frontmatter-derived content only.
|
|
174
|
-
- `link` — frontmatter basics plus a host-resolved `notePath` when
|
|
175
|
-
`resolveNoteHref` returns a string. This is the default.
|
|
176
|
-
- `full` — frontmatter basics plus the frontmatter-stripped note Markdown body
|
|
177
|
-
as slide text.
|
|
178
|
-
|
|
179
|
-
`link` is platform-specific only at navigation time: Docusaurus resolves the
|
|
180
|
-
published route and the renderer emits a normal browser link.
|
|
181
|
-
|
|
182
|
-
## Media resolution
|
|
183
|
-
|
|
184
|
-
Relative media is resolved against the correct source document:
|
|
185
|
-
|
|
186
|
-
- note-derived media resolves relative to the note file;
|
|
187
|
-
- media authored explicitly on a slide resolves relative to the StoryMap source
|
|
188
|
-
Markdown document.
|
|
189
|
-
|
|
190
|
-
Absolute `http:`/`https:`/`data:`/`blob:` URLs are left unchanged. When
|
|
191
|
-
`assetBase` is set, resolved Vault-relative paths are rewritten to
|
|
192
|
-
`<assetBase>/<path>` for the browser.
|
|
193
|
-
|
|
194
|
-
`assetBase` only rewrites URLs. Copying Vault attachments into the Docusaurus
|
|
195
|
-
static directory remains part of the site's own publishing pipeline; the
|
|
196
|
-
package never copies files.
|
|
197
|
-
|
|
198
|
-
## Registering the browser client
|
|
199
|
-
|
|
200
|
-
Docusaurus client modules are registered by a small local plugin. See
|
|
201
|
-
`examples/docusaurus/story-map-client-plugin.cjs`:
|
|
202
|
-
|
|
203
|
-
```js
|
|
204
|
-
module.exports = function storyMapClientPlugin() {
|
|
205
|
-
return {
|
|
206
|
-
name: 'story-map-client',
|
|
207
|
-
getClientModules() {
|
|
208
|
-
return [require.resolve('@story-map/remark-story-map/client')];
|
|
209
|
-
},
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
Add `./plugins/story-map-client` (or the equivalent path) to the site's
|
|
215
|
-
`plugins` list. The client entry only initializes maps in the browser,
|
|
216
|
-
mounts every host on the page, skips duplicate mounts, unmounts roots whose
|
|
217
|
-
host nodes were removed during SPA navigation, and keeps Node APIs out of the
|
|
218
|
-
browser bundle.
|
|
33
|
+
Both dialects emit the same host element and share one client, so a page holding a story
|
|
34
|
+
and a map loads the renderer — and therefore Leaflet — exactly once.
|
|
219
35
|
|
|
220
|
-
|
|
36
|
+
`data-story-map-instance` is host instance identity, numbered per transformed file. It is
|
|
37
|
+
deliberately **not** derived from the authored map `id`: existing content reuses ids
|
|
38
|
+
across maps, and two blocks on one page must not collide.
|
|
221
39
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
`story-map-use-infima-colors` class to the chosen host and load that stylesheet:
|
|
40
|
+
**Published routes are the host's decision.** This package never implements Docusaurus
|
|
41
|
+
slug or permalink policy; it only calls your `resolveNoteHref` callback. Return
|
|
42
|
+
`undefined` and the link is left unlinked rather than guessed.
|
|
226
43
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
--story-map-fg: var(--ifm-font-color-base);
|
|
231
|
-
--story-map-muted: var(--ifm-color-emphasis-700);
|
|
232
|
-
--story-map-border: var(--ifm-color-emphasis-300);
|
|
233
|
-
--story-map-accent: var(--ifm-color-primary);
|
|
234
|
-
}
|
|
235
|
-
```
|
|
44
|
+
**Nothing authored is silently dropped.** A recognized-but-unimplemented `leaflet` key
|
|
45
|
+
becomes a `GeoMapDiagnostic` naming that key, and an unrecognized key is reported
|
|
46
|
+
separately.
|
|
236
47
|
|
|
237
|
-
|
|
238
|
-
not change the configured map theme or tile URL.
|
|
48
|
+
## Documentation
|
|
239
49
|
|
|
240
|
-
|
|
50
|
+
- [Docusaurus guide](../../docs/guides/docusaurus.md) — registration, options, route
|
|
51
|
+
resolution, the emitted host element, and the `auto` theme bridge.
|
|
52
|
+
- [Source syntax](../../docs/guides/syntax.md) — every key in both dialects.
|
|
53
|
+
- [Leaflet compatibility](../../docs/leaflet-compatibility.md) — the authoritative
|
|
54
|
+
per-key support record.
|
|
55
|
+
- [`examples/docusaurus/`](../../examples/docusaurus) — a client plugin, a config snippet,
|
|
56
|
+
and a theme bridge.
|
|
241
57
|
|
|
242
|
-
|
|
243
|
-
**not** a package option. It manipulates Docusaurus theme DOM, collapses the
|
|
244
|
-
docs sidebar, listens to the route lifecycle, and needs host CSS, so it stays in
|
|
245
|
-
the host site. The transform already stamps document hosts with
|
|
246
|
-
`data-story-map-document="true"`; a small host client module reads that. See
|
|
247
|
-
[`../../docs/docusaurus-full-page.md`](../../docs/docusaurus-full-page.md) and
|
|
248
|
-
`examples/docusaurus/story-map-view.js`.
|
|
249
|
-
|
|
250
|
-
## How the pipeline fits together
|
|
251
|
-
|
|
252
|
-
```text
|
|
253
|
-
story-map fenced block
|
|
254
|
-
-> remark-story-map (build-time, Node)
|
|
255
|
-
-> VaultIndex (explicit notes / noteFolder)
|
|
256
|
-
-> host resolveNoteHref(vaultRelativePath)
|
|
257
|
-
-> existing contentLinkIndex / published route
|
|
258
|
-
-> serialized StoryMapConfig in .story-map-host
|
|
259
|
-
-> browser StoryMap client
|
|
260
|
-
-> shared @story-map/react-story-map renderer (Leaflet imported client-side)
|
|
261
|
-
```
|
|
58
|
+
MIT.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { GeoMapConfig } from '@story-map/story-map-core';
|
|
1
3
|
import 'leaflet/dist/leaflet.css';
|
|
2
4
|
import '@story-map/react-story-map/styles.css';
|
|
5
|
+
/**
|
|
6
|
+
* A `leaflet` host: the map plus its compatibility diagnostics. Only the host's
|
|
7
|
+
* presentation is composed here; map rendering stays in `<GeoMap>`.
|
|
8
|
+
*
|
|
9
|
+
* Exported so a host that mounts maps outside this client - and the tests - can
|
|
10
|
+
* reuse the same composition.
|
|
11
|
+
*/
|
|
12
|
+
export declare function MapHost({ config, GeoMap, }: {
|
|
13
|
+
config: GeoMapConfig;
|
|
14
|
+
GeoMap: ComponentType<{
|
|
15
|
+
map: GeoMapConfig;
|
|
16
|
+
}>;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
3
18
|
export declare function mountStoryMaps(scope?: ParentNode): void;
|
|
4
19
|
export declare function startStoryMapClient(): () => void;
|
|
5
20
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,2BAA2B,CAAC;AACnC,OAAO,0BAA0B,CAAC;AAClC,OAAO,uCAAuC,CAAC;AAuE/C;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,EACtB,MAAM,EACN,MAAM,GACP,EAAE;IACD,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;QAAE,GAAG,EAAE,YAAY,CAAA;KAAE,CAAC,CAAC;CAC9C,+BAOA;AAuCD,wBAAgB,cAAc,CAAC,KAAK,GAAE,UAAqB,QAI1D;AAED,wBAAgB,mBAAmB,eAQlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.diagnostics-dom.test.d.ts","sourceRoot":"","sources":["../src/client.diagnostics-dom.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
3
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { MapHost } from './client.js';
|
|
5
|
+
/**
|
|
6
|
+
* A map host is a React *tree*, not a container plus some appended nodes.
|
|
7
|
+
*
|
|
8
|
+
* React takes ownership of a `createRoot` container and clears its existing
|
|
9
|
+
* children on the first commit, so a host that appended its diagnostics list
|
|
10
|
+
* around `root.render()` produced a page where the diagnostics silently
|
|
11
|
+
* vanished. A test that mocks `react-dom/client` cannot catch that, because
|
|
12
|
+
* nothing ever mounts - so this renders the real component with the real React
|
|
13
|
+
* renderer and asserts the list is part of the output.
|
|
14
|
+
*/
|
|
15
|
+
vi.mock('@story-map/react-story-map', () => ({
|
|
16
|
+
StoryMap: function MockStoryMap() {
|
|
17
|
+
return null;
|
|
18
|
+
},
|
|
19
|
+
GeoMap: function MockGeoMap() {
|
|
20
|
+
return _jsx("div", { className: "map-surface" });
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
const renderer = await import('@story-map/react-story-map');
|
|
24
|
+
const config = {
|
|
25
|
+
schema: 'geomap/v1',
|
|
26
|
+
height: '500px',
|
|
27
|
+
map: {
|
|
28
|
+
theme: 'light',
|
|
29
|
+
zoom: 6,
|
|
30
|
+
tiles: {
|
|
31
|
+
light: { url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', attribution: '© OSM' },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
markers: [],
|
|
35
|
+
};
|
|
36
|
+
function render(value) {
|
|
37
|
+
return renderToStaticMarkup(_jsx(MapHost, { config: value, GeoMap: renderer.GeoMap }));
|
|
38
|
+
}
|
|
39
|
+
describe('map host markup, rendered by real React', () => {
|
|
40
|
+
it('renders the map and keeps the diagnostics list in the same tree', () => {
|
|
41
|
+
const html = render({
|
|
42
|
+
...config,
|
|
43
|
+
diagnostics: [
|
|
44
|
+
{
|
|
45
|
+
level: 'warning',
|
|
46
|
+
code: 'leaflet-compat-metadata',
|
|
47
|
+
key: 'unit',
|
|
48
|
+
message: 'unit is accepted but has no effect yet.',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
});
|
|
52
|
+
expect(html).toContain('map-surface');
|
|
53
|
+
expect(html).toContain('story-map-host__diagnostics');
|
|
54
|
+
expect(html).toContain('unit is accepted but has no effect yet.');
|
|
55
|
+
expect(html).toContain('data-key="unit"');
|
|
56
|
+
expect(html).toContain('data-code="leaflet-compat-metadata"');
|
|
57
|
+
expect(html).toContain('data-level="warning"');
|
|
58
|
+
});
|
|
59
|
+
it('marks an error-level diagnostic apart from a warning', () => {
|
|
60
|
+
const html = render({
|
|
61
|
+
...config,
|
|
62
|
+
diagnostics: [
|
|
63
|
+
{ level: 'error', code: 'leaflet-invalid-value', key: 'lat', message: 'lat is invalid.' },
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
expect(html).toContain('data-level="error"');
|
|
67
|
+
});
|
|
68
|
+
it('renders every diagnostic, not only the first', () => {
|
|
69
|
+
const html = render({
|
|
70
|
+
...config,
|
|
71
|
+
diagnostics: [
|
|
72
|
+
{ level: 'warning', code: 'leaflet-pending-p1', key: 'markerFile', message: 'markerFile is pending.' },
|
|
73
|
+
{ level: 'warning', code: 'leaflet-pending-p2', key: 'gpx', message: 'gpx is pending.' },
|
|
74
|
+
{ level: 'warning', code: 'leaflet-pending-p3', key: 'image', message: 'image is pending.' },
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
expect(html.match(/story-map-host__diagnostics/g)).toHaveLength(1);
|
|
78
|
+
expect(html).toContain('markerFile is pending.');
|
|
79
|
+
expect(html).toContain('gpx is pending.');
|
|
80
|
+
expect(html).toContain('image is pending.');
|
|
81
|
+
});
|
|
82
|
+
it('renders a clean map with no diagnostics element', () => {
|
|
83
|
+
const html = render(config);
|
|
84
|
+
expect(html).toContain('map-surface');
|
|
85
|
+
expect(html).not.toContain('story-map-host__diagnostics');
|
|
86
|
+
});
|
|
87
|
+
it('ignores a malformed diagnostic instead of rendering it', () => {
|
|
88
|
+
const malformed = {
|
|
89
|
+
...config,
|
|
90
|
+
// A payload that reached the browser from a hand-edited or stale host.
|
|
91
|
+
diagnostics: [
|
|
92
|
+
null,
|
|
93
|
+
{ level: 'warning' },
|
|
94
|
+
{ level: 'warning', message: '' },
|
|
95
|
+
{ level: 'warning', message: 'kept' },
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
const html = render(malformed);
|
|
99
|
+
expect(html).toContain('kept');
|
|
100
|
+
expect(html.match(/<li/g)).toHaveLength(1);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=client.diagnostics-dom.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.diagnostics-dom.test.js","sourceRoot":"","sources":["../src/client.diagnostics-dom.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC;;;;;;;;;GASG;AAEH,EAAE,CAAC,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3C,QAAQ,EAAE,SAAS,YAAY;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,SAAS,UAAU;QACzB,OAAO,cAAK,SAAS,EAAC,aAAa,GAAG,CAAC;IACzC,CAAC;CACF,CAAC,CAAC,CAAC;AAEJ,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAE5D,MAAM,MAAM,GAAiB;IAC3B,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,OAAO;IACf,GAAG,EAAE;QACH,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,CAAC;QACP,KAAK,EAAE;YACL,KAAK,EAAE,EAAE,GAAG,EAAE,gDAAgD,EAAE,WAAW,EAAE,OAAO,EAAE;SACvF;KACF;IACD,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,SAAS,MAAM,CAAC,KAAmB;IACjC,OAAO,oBAAoB,CAAC,KAAC,OAAO,IAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAI,CAAC,CAAC;AACnF,CAAC;AAED,QAAQ,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACvD,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,IAAI,GAAG,MAAM,CAAC;YACl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AAC;QAC/B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -1,14 +1,64 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import 'leaflet/dist/leaflet.css';
|
|
4
4
|
import '@story-map/react-story-map/styles.css';
|
|
5
|
+
/** Which renderer a host element mounts, read from `data-story-map-kind`. */
|
|
6
|
+
const STORY_KIND = 'story';
|
|
7
|
+
const MAP_KIND = 'map';
|
|
8
|
+
const DEFAULT_KIND = STORY_KIND;
|
|
5
9
|
const roots = new Map();
|
|
6
10
|
const pending = new Set();
|
|
11
|
+
/**
|
|
12
|
+
* One renderer module and one CSS import for the whole page. The `??=` matters:
|
|
13
|
+
* a story host and a map host mounting concurrently share a single import, so the
|
|
14
|
+
* module (and the Leaflet it lazily imports inside its own effects) is evaluated
|
|
15
|
+
* once no matter how many hosts a page holds.
|
|
16
|
+
*/
|
|
7
17
|
let rendererPromise;
|
|
8
18
|
function loadRenderer() {
|
|
9
19
|
rendererPromise ??= import('@story-map/react-story-map');
|
|
10
20
|
return rendererPromise;
|
|
11
21
|
}
|
|
22
|
+
/** Read the discriminator, defaulting to `story` for a host written before it existed. */
|
|
23
|
+
function hostKind(host) {
|
|
24
|
+
return host.dataset.storyMapKind || DEFAULT_KIND;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Surface a recognized-but-unsupported key on the published page. The renderer
|
|
28
|
+
* deliberately has no error UI, so the host owns the disclosure; the list sits
|
|
29
|
+
* below the map rather than over it, so a diagnostic can never cover the map it
|
|
30
|
+
* is about.
|
|
31
|
+
*
|
|
32
|
+
* This returns React elements instead of appending DOM nodes on purpose. React
|
|
33
|
+
* takes ownership of a `createRoot` container and clears its existing children on
|
|
34
|
+
* the first commit, so anything appended to the host around `root.render()` is
|
|
35
|
+
* wiped. Rendering the list inside the same tree is what keeps it on the page.
|
|
36
|
+
*/
|
|
37
|
+
function hostDiagnostics(config) {
|
|
38
|
+
const diagnostics = config.diagnostics;
|
|
39
|
+
if (!Array.isArray(diagnostics) || diagnostics.length === 0)
|
|
40
|
+
return null;
|
|
41
|
+
const items = diagnostics
|
|
42
|
+
.filter((diagnostic) => !!diagnostic && typeof diagnostic.message === 'string' && diagnostic.message.length > 0)
|
|
43
|
+
.map((diagnostic) => (_jsx("li", { "data-level": diagnostic.level === 'error' ? 'error' : 'warning', "data-code": diagnostic.code, ...(diagnostic.key ? { 'data-key': diagnostic.key } : {}), children: diagnostic.message }, `${diagnostic.code}:${diagnostic.key ?? ''}:${diagnostic.message}`)));
|
|
44
|
+
if (items.length === 0)
|
|
45
|
+
return null;
|
|
46
|
+
return _jsx("ul", { className: "story-map-host__diagnostics", children: items });
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A `leaflet` host: the map plus its compatibility diagnostics. Only the host's
|
|
50
|
+
* presentation is composed here; map rendering stays in `<GeoMap>`.
|
|
51
|
+
*
|
|
52
|
+
* Exported so a host that mounts maps outside this client - and the tests - can
|
|
53
|
+
* reuse the same composition.
|
|
54
|
+
*/
|
|
55
|
+
export function MapHost({ config, GeoMap, }) {
|
|
56
|
+
return (_jsxs(_Fragment, { children: [_jsx(GeoMap, { map: config }), hostDiagnostics(config)] }));
|
|
57
|
+
}
|
|
58
|
+
/** A malformed block degrades in place instead of throwing into the page. */
|
|
59
|
+
function renderHostError(host, error) {
|
|
60
|
+
host.textContent = `StoryMap error: ${error.message}`;
|
|
61
|
+
}
|
|
12
62
|
async function mountHost(host) {
|
|
13
63
|
if (roots.has(host) || pending.has(host))
|
|
14
64
|
return;
|
|
@@ -17,16 +67,17 @@ async function mountHost(host) {
|
|
|
17
67
|
return;
|
|
18
68
|
pending.add(host);
|
|
19
69
|
try {
|
|
20
|
-
const
|
|
21
|
-
const { StoryMap } = await loadRenderer();
|
|
70
|
+
const config = JSON.parse(decodeURIComponent(raw));
|
|
71
|
+
const { StoryMap, GeoMap } = await loadRenderer();
|
|
22
72
|
if (roots.has(host) || !host.isConnected)
|
|
23
73
|
return;
|
|
74
|
+
const isMap = hostKind(host) === MAP_KIND;
|
|
24
75
|
const root = createRoot(host);
|
|
25
|
-
root.render(_jsx(StoryMap, { story:
|
|
76
|
+
root.render(isMap ? _jsx(MapHost, { config: config, GeoMap: GeoMap }) : _jsx(StoryMap, { story: config }));
|
|
26
77
|
roots.set(host, root);
|
|
27
78
|
}
|
|
28
79
|
catch (error) {
|
|
29
|
-
host
|
|
80
|
+
renderHostError(host, error instanceof Error ? error : new Error(String(error)));
|
|
30
81
|
}
|
|
31
82
|
finally {
|
|
32
83
|
pending.delete(host);
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AAQzD,OAAO,0BAA0B,CAAC;AAClC,OAAO,uCAAuC,CAAC;AAE/C,6EAA6E;AAC7E,MAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC;AACvB,MAAM,YAAY,GAAG,UAAU,CAAC;AAEhC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAiB,CAAC;AACvC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAW,CAAC;AAUnC;;;;;GAKG;AACH,IAAI,eAAoD,CAAC;AAEzD,SAAS,YAAY;IACnB,eAAe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,CAAC,UAAU,EAAE,CAAC;AACrC,CAAC;AAED,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;IACpC,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACtC,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,mBAAmB,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7F,CAAC;SAAM,CAAC;QACN,mBAAmB,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface LeafletFixture {
|
|
2
|
+
/** Which production page the block lives on. */
|
|
3
|
+
name: 'Chile' | 'Egypt' | 'Kuala Lumpur' | 'Xinjiang';
|
|
4
|
+
/** The source file inside the target repository. */
|
|
5
|
+
source: string;
|
|
6
|
+
/** The authored map id. Chile and Xinjiang deliberately share one. */
|
|
7
|
+
id: string;
|
|
8
|
+
height: string;
|
|
9
|
+
center: [number, number];
|
|
10
|
+
minZoom?: number;
|
|
11
|
+
maxZoom?: number;
|
|
12
|
+
zoom: number;
|
|
13
|
+
markerFolder: string;
|
|
14
|
+
/** The fence body exactly as authored. */
|
|
15
|
+
block: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const LEAFLET_FIXTURES: readonly LeafletFixture[];
|
|
18
|
+
//# sourceMappingURL=fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,CAAC;IACtD,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAoGrD,CAAC"}
|
package/dist/fixtures.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// The four live `leaflet` blocks from the current `kywk/kywk.github.io` content,
|
|
2
|
+
// copied verbatim from
|
|
3
|
+
// `docs/history/2026-09-29-leaflet-compatibility/examples/current-vault-leaflet-blocks.md`.
|
|
4
|
+
//
|
|
5
|
+
// They are the Phase 1 source-compatibility bar, so they are pinned here as test
|
|
6
|
+
// data rather than read from the doc at runtime: a test that read the doc would
|
|
7
|
+
// happily pass against an edited example. The doc is a historical record of one
|
|
8
|
+
// moment; this module is the contract.
|
|
9
|
+
export const LEAFLET_FIXTURES = [
|
|
10
|
+
{
|
|
11
|
+
name: 'Chile',
|
|
12
|
+
source: 'backpacker/2509 Chile/Index de Chile.md',
|
|
13
|
+
id: 'chile-2509',
|
|
14
|
+
height: '600px',
|
|
15
|
+
center: [-33, -70],
|
|
16
|
+
minZoom: 4,
|
|
17
|
+
maxZoom: 17,
|
|
18
|
+
zoom: 5,
|
|
19
|
+
markerFolder: 'backpacker/2509 Chile/Chile',
|
|
20
|
+
block: [
|
|
21
|
+
'id: chile-2509',
|
|
22
|
+
'height: 600px',
|
|
23
|
+
'lat: -33.0000',
|
|
24
|
+
'long: -70.0000',
|
|
25
|
+
'minZoom: 4',
|
|
26
|
+
'maxZoom: 17',
|
|
27
|
+
'defaultZoom: 5',
|
|
28
|
+
'unit: meters',
|
|
29
|
+
'scale: 1',
|
|
30
|
+
'darkMode: true',
|
|
31
|
+
'markerFolder: backpacker/2509 Chile/Chile',
|
|
32
|
+
].join('\n'),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Egypt',
|
|
36
|
+
source: 'backpacker/2401 Egypt/Index Pharaoh Egypt.md',
|
|
37
|
+
id: 'egypt-2401',
|
|
38
|
+
height: '500px',
|
|
39
|
+
center: [27.5, 29.5],
|
|
40
|
+
minZoom: 5,
|
|
41
|
+
maxZoom: 15,
|
|
42
|
+
zoom: 6,
|
|
43
|
+
markerFolder: 'backpacker/2401 Egypt/Egypt',
|
|
44
|
+
block: [
|
|
45
|
+
'id: egypt-2401',
|
|
46
|
+
'height: 500px',
|
|
47
|
+
'lat: 27.50000',
|
|
48
|
+
'long: 29.50000',
|
|
49
|
+
'minZoom: 5',
|
|
50
|
+
'maxZoom: 15',
|
|
51
|
+
'defaultZoom: 6',
|
|
52
|
+
'unit: meters',
|
|
53
|
+
'scale: 1',
|
|
54
|
+
'darkMode: true',
|
|
55
|
+
'markerFolder: backpacker/2401 Egypt/Egypt',
|
|
56
|
+
].join('\n'),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'Kuala Lumpur',
|
|
60
|
+
// Shares its source document with Egypt: one page can carry two maps.
|
|
61
|
+
source: 'backpacker/2401 Egypt/Index Pharaoh Egypt.md',
|
|
62
|
+
id: 'kl-2401',
|
|
63
|
+
height: '500px',
|
|
64
|
+
center: [3.15, 101.67],
|
|
65
|
+
minZoom: 11,
|
|
66
|
+
maxZoom: 17,
|
|
67
|
+
zoom: 13,
|
|
68
|
+
markerFolder: 'backpacker/2401 Egypt/Kuala Lumpur',
|
|
69
|
+
block: [
|
|
70
|
+
'id: kl-2401',
|
|
71
|
+
'height: 500px',
|
|
72
|
+
'lat: 3.15000',
|
|
73
|
+
'long: 101.67000',
|
|
74
|
+
'minZoom: 11',
|
|
75
|
+
'maxZoom: 17',
|
|
76
|
+
'defaultZoom: 13',
|
|
77
|
+
'unit: meters',
|
|
78
|
+
'scale: 1',
|
|
79
|
+
'darkMode: true',
|
|
80
|
+
'markerFolder: backpacker/2401 Egypt/Kuala Lumpur',
|
|
81
|
+
].join('\n'),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'Xinjiang',
|
|
85
|
+
source: 'backpacker/2601 Xinjiang/Index Xinjiang.md',
|
|
86
|
+
// The authored id is reused from the Chile block on purpose. Nothing may
|
|
87
|
+
// rename it, and nothing may treat the repeat as a collision.
|
|
88
|
+
id: 'chile-2509',
|
|
89
|
+
height: '600px',
|
|
90
|
+
center: [42, 82],
|
|
91
|
+
minZoom: 4,
|
|
92
|
+
maxZoom: 17,
|
|
93
|
+
zoom: 5,
|
|
94
|
+
markerFolder: 'backpacker/2601 Xinjiang/Xinjiang',
|
|
95
|
+
block: [
|
|
96
|
+
'id: chile-2509',
|
|
97
|
+
'height: 600px',
|
|
98
|
+
'lat: 42.0000',
|
|
99
|
+
'long: 82.0000',
|
|
100
|
+
'minZoom: 4',
|
|
101
|
+
'maxZoom: 17',
|
|
102
|
+
'defaultZoom: 5',
|
|
103
|
+
'unit: meters',
|
|
104
|
+
'scale: 1',
|
|
105
|
+
'darkMode: true',
|
|
106
|
+
'markerFolder: backpacker/2601 Xinjiang/Xinjiang',
|
|
107
|
+
].join('\n'),
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,uBAAuB;AACvB,4FAA4F;AAC5F,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,gFAAgF;AAChF,uCAAuC;AAmBvC,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD;QACE,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,yCAAyC;QACjD,EAAE,EAAE,YAAY;QAChB,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAClB,OA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pD,yEAAyE;QACzE,8DAA8D;QAC9D,EAAE,EAAE,YAAY;QAChB,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QAChB,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,CAAC;QACP,YAAY,EAAE,mCAAmC;QACjD,KAAK,EAAE;YACL,gBAAgB;YAChB,eAAe;YACf,cAAc;YACd,eAAe;YACf,YAAY;YACZ,aAAa;YACb,gBAAgB;YAChB,cAAc;YACd,UAAU;YACV,gBAAgB;YAChB,iDAAiD;SAClD,CAAC,IAAI,CAAC,IAAI,CAAC;KACb;CACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
import type { Root } from 'mdast';
|
|
2
|
+
import { type LeafletSourceDefaults } from '@story-map/story-map-core';
|
|
3
|
+
import { type LeafletHostPresentation } from './vault.js';
|
|
4
|
+
/** The storytelling dialect. Parsed by the `storymap/v1` schema. */
|
|
2
5
|
export declare const STORY_MAP_FENCE = "story-map";
|
|
6
|
+
/** The legacy map dialect. Parsed by its own parser, never by `storymap/v1`. */
|
|
7
|
+
export declare const LEAFLET_FENCE = "leaflet";
|
|
8
|
+
/**
|
|
9
|
+
* What a host element mounts. One client lifecycle reads this and picks
|
|
10
|
+
* `<StoryMap />` or `<GeoMap />`, so a page never boots two map runtimes.
|
|
11
|
+
*/
|
|
12
|
+
export declare const HOST_KINDS: {
|
|
13
|
+
readonly story: 'story';
|
|
14
|
+
readonly map: 'map';
|
|
15
|
+
};
|
|
16
|
+
export type HostKind = (typeof HOST_KINDS)[keyof typeof HOST_KINDS];
|
|
3
17
|
export interface RemarkStoryMapOptions {
|
|
4
18
|
vaultRoot?: string;
|
|
5
19
|
assetBase?: string;
|
|
6
20
|
resolveNoteHref?: (vaultRelativePath: string) => string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Site-level `leaflet` compatibility defaults, applied only to `leaflet`
|
|
23
|
+
* blocks and resolved before the built-in compatibility defaults. They are
|
|
24
|
+
* deliberately not StoryMap settings: a `storymap/v1` block never reads them,
|
|
25
|
+
* and a `leaflet` block never assumes a StoryMap setting exists.
|
|
26
|
+
*/
|
|
27
|
+
leafletDefaults?: LeafletSourceDefaults;
|
|
28
|
+
/**
|
|
29
|
+
* `leaflet`-host presentation that the dialect has no source key for: the
|
|
30
|
+
* marker type registry, the default marker type, and the tooltip default.
|
|
31
|
+
* Ignored for `story-map` blocks.
|
|
32
|
+
*/
|
|
33
|
+
leafletPresentation?: LeafletHostPresentation;
|
|
7
34
|
}
|
|
8
35
|
export default function remarkStoryMap(options?: RemarkStoryMapOptions): (tree: Root, file?: RemarkVFile) => void;
|
|
9
36
|
interface RemarkVFile {
|
|
@@ -13,4 +40,5 @@ interface RemarkVFile {
|
|
|
13
40
|
};
|
|
14
41
|
}
|
|
15
42
|
export { VaultIndex } from './vault.js';
|
|
43
|
+
export type { LeafletHostPresentation, VaultResolveOptions } from './vault.js';
|
|
16
44
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,IAAI,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,IAAI,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAML,KAAK,qBAAqB,EAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAc,KAAK,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAEtE,oEAAoE;AACpE,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,gFAAgF;AAChF,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,UAAU;aACrB,KAAK,EAAE,OAAO;aACd,GAAG,EAAE,KAAK;CACF,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEpE,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACpE;;;;;OAKG;IACH,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;CAC/C;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,OAAO,GAAE,qBAA0B,UAS1D,IAAI,SAAS,WAAW,UAyBvC;AA0CD,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE;QACL,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACvC,CAAC;CACH;AAMD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { visit } from 'unist-util-visit';
|
|
2
|
-
import { parseStoryMapSourceYaml, toStoryMapConfig } from '@story-map/story-map-core';
|
|
2
|
+
import { parseLeafletSourceYaml, parseStoryMapSourceYaml, toGeoMapConfig, toStoryMapConfig, } from '@story-map/story-map-core';
|
|
3
3
|
import { VaultIndex } from './vault.js';
|
|
4
|
+
/** The storytelling dialect. Parsed by the `storymap/v1` schema. */
|
|
4
5
|
export const STORY_MAP_FENCE = 'story-map';
|
|
6
|
+
/** The legacy map dialect. Parsed by its own parser, never by `storymap/v1`. */
|
|
7
|
+
export const LEAFLET_FENCE = 'leaflet';
|
|
8
|
+
/**
|
|
9
|
+
* What a host element mounts. One client lifecycle reads this and picks
|
|
10
|
+
* `<StoryMap />` or `<GeoMap />`, so a page never boots two map runtimes.
|
|
11
|
+
*/
|
|
12
|
+
export const HOST_KINDS = {
|
|
13
|
+
story: 'story',
|
|
14
|
+
map: 'map',
|
|
15
|
+
};
|
|
5
16
|
export default function remarkStoryMap(options = {}) {
|
|
6
17
|
const vault = options.vaultRoot
|
|
7
18
|
? new VaultIndex({
|
|
@@ -14,22 +25,51 @@ export default function remarkStoryMap(options = {}) {
|
|
|
14
25
|
const sourcePath = typeof file?.path === 'string' ? file.path : undefined;
|
|
15
26
|
const isDocument = file?.data?.frontMatter?.['story-map'] === true;
|
|
16
27
|
const documentAttribute = isDocument ? ' data-story-map-document="true"' : '';
|
|
28
|
+
// Host instance identity is per transformed file and never derived from an
|
|
29
|
+
// authored map id: two blocks may legitimately share one id (the Xinjiang
|
|
30
|
+
// fixture reuses `chile-2509`), and nothing about them may be renamed,
|
|
31
|
+
// deduplicated, or rejected because of it.
|
|
32
|
+
let instance = 0;
|
|
33
|
+
const nextInstance = () => `sm-${(instance += 1)}`;
|
|
17
34
|
visit(tree, 'code', (node, index, parent) => {
|
|
18
|
-
if (
|
|
35
|
+
if (index === undefined || !parent)
|
|
19
36
|
return;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
parent.children[index] = html;
|
|
37
|
+
if (node.lang === STORY_MAP_FENCE) {
|
|
38
|
+
const story = resolveStoryHost(node.value, vault, sourcePath);
|
|
39
|
+
parent.children[index] = hostElement(HOST_KINDS.story, story, nextInstance(), documentAttribute);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (node.lang === LEAFLET_FENCE) {
|
|
43
|
+
const map = resolveMapHost(node.value, vault, options);
|
|
44
|
+
parent.children[index] = hostElement(HOST_KINDS.map, map, nextInstance(), '');
|
|
45
|
+
}
|
|
30
46
|
});
|
|
31
47
|
};
|
|
32
48
|
}
|
|
49
|
+
function resolveStoryHost(source, vault, sourcePath) {
|
|
50
|
+
const parsed = parseStoryMapSourceYaml(source);
|
|
51
|
+
return vault ? vault.resolveSource(parsed, sourcePath) : toStoryMapConfig(parsed, parsed.slides ?? []);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The `leaflet` half of the transform. `markerFolder` resolution needs the Vault,
|
|
55
|
+
* so a block parsed without one still renders - as a map with no markers - rather
|
|
56
|
+
* than failing the whole page build.
|
|
57
|
+
*/
|
|
58
|
+
function resolveMapHost(source, vault, options) {
|
|
59
|
+
const parsed = parseLeafletSourceYaml(source, options.leafletDefaults);
|
|
60
|
+
if (!vault)
|
|
61
|
+
return toGeoMapConfig(parsed, []);
|
|
62
|
+
return vault.resolveLeafletSource(parsed, options.leafletPresentation ?? {});
|
|
63
|
+
}
|
|
64
|
+
function hostElement(kind, config, instance, documentAttribute) {
|
|
65
|
+
const encoded = encodeURIComponent(JSON.stringify(config));
|
|
66
|
+
return {
|
|
67
|
+
type: 'html',
|
|
68
|
+
value: `<div class="story-map-host" data-story-map-kind="${kind}"` +
|
|
69
|
+
`${documentAttribute} data-story-map-instance="${instance}"` +
|
|
70
|
+
` data-story-map-config="${escapeAttribute(encoded)}"></div>`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
33
73
|
function escapeAttribute(value) {
|
|
34
74
|
return value.replaceAll('&', '&').replaceAll('"', '"').replaceAll('<', '<');
|
|
35
75
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"A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AAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AACzG,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CACrB,MAAc,EACd,KAA6B,EAC7B,OAA8B;IAE9B,MAAM,MAAM,GAAG,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACvE,IAAI,CAAC,KAAK;QAAE,OAAO,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,WAAW,CAClB,IAAc,EACd,MAAqC,EACrC,QAAgB,EAChB,iBAAyB;IAEzB,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,KAAK,EACH,oDAAoD,IAAI,GAAG;YAC3D,GAAG,iBAAiB,6BAA6B,QAAQ,GAAG;YAC5D,2BAA2B,eAAe,CAAC,OAAO,CAAC,UAAU;KAChE,CAAC;AACJ,CAAC;AASD,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAC1F,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/vault.d.ts
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
import { type StoryMapConfig, type StoryMapSourceConfig } from '@story-map/story-map-core';
|
|
1
|
+
import { type GeoMapConfig, type GeoMarker, type LeafletSourceConfig, type MarkerTypeDefinition, type MarkerTooltipDisplay, type StoryMapConfig, type StoryMapSourceConfig } from '@story-map/story-map-core';
|
|
2
2
|
export interface VaultResolveOptions {
|
|
3
3
|
vaultRoot: string;
|
|
4
4
|
assetBase?: string;
|
|
5
5
|
resolveNoteHref?: (vaultRelativePath: string) => string | undefined;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Presentation inputs for a `leaflet` host that the source dialect does not carry.
|
|
9
|
+
*
|
|
10
|
+
* These are a `leaflet` host's own knobs and are never read for a `story-map`
|
|
11
|
+
* block: a native StoryMap must not inherit a Leaflet-only marker registry or
|
|
12
|
+
* tooltip rule, and a `leaflet` block must not assume a StoryMap setting exists.
|
|
13
|
+
* Every field is optional, and an absent field keeps the renderer's own default.
|
|
14
|
+
*/
|
|
15
|
+
export interface LeafletHostPresentation {
|
|
16
|
+
markerTypes?: readonly MarkerTypeDefinition[] | undefined;
|
|
17
|
+
defaultMarkerType?: string | undefined;
|
|
18
|
+
defaultTooltip?: MarkerTooltipDisplay | undefined;
|
|
19
|
+
}
|
|
7
20
|
export declare class VaultIndex {
|
|
8
21
|
private readonly options;
|
|
9
22
|
private readonly byBasename;
|
|
@@ -11,7 +24,35 @@ export declare class VaultIndex {
|
|
|
11
24
|
private readonly notes;
|
|
12
25
|
constructor(options: VaultResolveOptions);
|
|
13
26
|
resolveSource(source: StoryMapSourceConfig, sourcePath?: string): StoryMapConfig;
|
|
14
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Resolve a parsed `leaflet` block into renderer input.
|
|
29
|
+
*
|
|
30
|
+
* This is the second dialect, so it never reuses the `storymap/v1` path: the
|
|
31
|
+
* source is the `leaflet` dialect's own normalized shape and the result is a
|
|
32
|
+
* `GeoMapConfig`, not a `StoryMapConfig`. There are no slides, no ordering, and
|
|
33
|
+
* no `noteDisplay` here - a `leaflet` block has no story concept to configure.
|
|
34
|
+
*
|
|
35
|
+
* Every `markerFolder` resolves recursively through the same index and the same
|
|
36
|
+
* scan exclusions as `noteFolder`. A note becomes a marker only when it has a
|
|
37
|
+
* valid `location`; a note without one is skipped, never a build failure.
|
|
38
|
+
* `notePath` comes from the host route resolver, so an unresolvable or ambiguous
|
|
39
|
+
* note simply stays unlinked and the build never invents a route.
|
|
40
|
+
*/
|
|
41
|
+
resolveLeafletSource(source: LeafletSourceConfig, presentation?: LeafletHostPresentation): GeoMapConfig;
|
|
42
|
+
/** The marker list alone, so a host can extend it without re-resolving folders. */
|
|
43
|
+
resolveLeafletMarkers(source: LeafletSourceConfig, presentation?: LeafletHostPresentation): GeoMarker[];
|
|
44
|
+
private markersInFolder;
|
|
45
|
+
/**
|
|
46
|
+
* Re-resolves `note:` references on an already normalized config. `dateField`
|
|
47
|
+
* is not part of `StoryMapConfig`, so it defaults to the built-in
|
|
48
|
+
* `date-created`; pass the document's own value when it differs. Slides that
|
|
49
|
+
* already carry a `date` keep it, because an authored value always wins.
|
|
50
|
+
*
|
|
51
|
+
* `layoutMode` is threaded through for signature symmetry with `resolveSource`,
|
|
52
|
+
* but this path always resolves as `link`, so the `full`-display carve-out
|
|
53
|
+
* cannot apply here and the argument has no effect on the result.
|
|
54
|
+
*/
|
|
55
|
+
resolveStory(story: StoryMapConfig, sourcePath?: string, dateField?: string): StoryMapConfig;
|
|
15
56
|
private resolveExplicitSlides;
|
|
16
57
|
private resolveFolder;
|
|
17
58
|
private slideForNote;
|
package/dist/vault.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAGA,OAAO,EAeL,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EAI1B,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,mBAAmB;IAClC,SA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BAAsB;IAQ9B,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,IAAI;CA2Bb"}
|
package/dist/vault.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import matter from 'gray-matter';
|
|
4
|
-
import { effectiveNoteDisplay, isPathInFolder, locationOnlySlide, matchesTagFilter, mergeResolvedSlide, parseWikiLinkRef, slideFromNoteFrontmatter, sortNoteDates, stripFrontmatter, toStoryMapConfig, toTimestamp, } from '@story-map/story-map-core';
|
|
4
|
+
import { DEFAULT_DATE_FIELD, effectiveNoteDisplay, isPathInFolder, locationOnlySlide, markerFromNoteFrontmatter, matchesTagFilter, mergeResolvedSlide, parseWikiLinkRef, slideFromNoteFrontmatter, sortNoteDates, stripFrontmatter, toGeoMapConfig, toStoryMapConfig, toTimestamp, } from '@story-map/story-map-core';
|
|
5
5
|
const EXCLUDED_DIRECTORIES = new Set(['node_modules', 'build', 'dist', 'coverage']);
|
|
6
6
|
export class VaultIndex {
|
|
7
7
|
options;
|
|
@@ -16,19 +16,97 @@ export class VaultIndex {
|
|
|
16
16
|
const noteDisplay = effectiveNoteDisplay(source.layout.mode, source.noteDisplay);
|
|
17
17
|
const explicitSlides = source.slides ?? [];
|
|
18
18
|
const slides = explicitSlides.length > 0
|
|
19
|
-
? this.resolveExplicitSlides(explicitSlides, sourcePath, noteDisplay)
|
|
19
|
+
? this.resolveExplicitSlides(explicitSlides, sourcePath, noteDisplay, source.layout.mode, source.dateField)
|
|
20
20
|
: source.noteFolder
|
|
21
|
-
? this.resolveFolder(source.noteFolder, source.dateField, source.order, noteDisplay, source.includeTags, source.excludeTags)
|
|
21
|
+
? this.resolveFolder(source.noteFolder, source.dateField, source.order, noteDisplay, source.layout.mode, source.includeTags, source.excludeTags)
|
|
22
22
|
: [];
|
|
23
23
|
return toStoryMapConfig(source, slides);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a parsed `leaflet` block into renderer input.
|
|
27
|
+
*
|
|
28
|
+
* This is the second dialect, so it never reuses the `storymap/v1` path: the
|
|
29
|
+
* source is the `leaflet` dialect's own normalized shape and the result is a
|
|
30
|
+
* `GeoMapConfig`, not a `StoryMapConfig`. There are no slides, no ordering, and
|
|
31
|
+
* no `noteDisplay` here - a `leaflet` block has no story concept to configure.
|
|
32
|
+
*
|
|
33
|
+
* Every `markerFolder` resolves recursively through the same index and the same
|
|
34
|
+
* scan exclusions as `noteFolder`. A note becomes a marker only when it has a
|
|
35
|
+
* valid `location`; a note without one is skipped, never a build failure.
|
|
36
|
+
* `notePath` comes from the host route resolver, so an unresolvable or ambiguous
|
|
37
|
+
* note simply stays unlinked and the build never invents a route.
|
|
38
|
+
*/
|
|
39
|
+
resolveLeafletSource(source, presentation = {}) {
|
|
40
|
+
return toGeoMapConfig(source, this.resolveLeafletMarkers(source, presentation));
|
|
27
41
|
}
|
|
28
|
-
|
|
29
|
-
|
|
42
|
+
/** The marker list alone, so a host can extend it without re-resolving folders. */
|
|
43
|
+
resolveLeafletMarkers(source, presentation = {}) {
|
|
44
|
+
const markers = source.markerFolder.flatMap((folder) => this.markersInFolder(folder, presentation));
|
|
45
|
+
const used = new Set();
|
|
46
|
+
return markers.map((marker) => {
|
|
47
|
+
// Marker ids only need to be unique inside one host, and a repeated note
|
|
48
|
+
// path would otherwise collide in the renderer's marker registry.
|
|
49
|
+
const base = marker.notePath ?? marker.title ?? 'marker';
|
|
50
|
+
let id = base;
|
|
51
|
+
if (used.has(id)) {
|
|
52
|
+
let suffix = 2;
|
|
53
|
+
while (used.has(`${id}#${suffix}`))
|
|
54
|
+
suffix += 1;
|
|
55
|
+
id = `${id}#${suffix}`;
|
|
56
|
+
}
|
|
57
|
+
used.add(id);
|
|
58
|
+
return { ...marker, id };
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
markersInFolder(folder, presentation) {
|
|
62
|
+
const resolveHref = this.options.resolveNoteHref;
|
|
63
|
+
const markers = [];
|
|
64
|
+
// Directory order is filesystem-dependent, so a folder's notes are ordered by
|
|
65
|
+
// Vault-relative path to make the serialized marker list deterministic. The
|
|
66
|
+
// comparison is `localeCompare`, matching the Obsidian adapter exactly, so
|
|
67
|
+
// the two hosts emit markers in the same order for the same folder.
|
|
68
|
+
// Folder order still follows the authored `markerFolder` sequence, because
|
|
69
|
+
// the list is a flatMap over it.
|
|
70
|
+
const indexed = this.notes
|
|
71
|
+
.filter((note) => isPathInFolder(note.relativePath, folder))
|
|
72
|
+
.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
|
|
73
|
+
for (const note of indexed) {
|
|
74
|
+
// The published route is the host's decision (SPEC 11.2); an unresolved or
|
|
75
|
+
// ambiguous note stays unlinked rather than getting a guessed route.
|
|
76
|
+
const href = resolveHref?.(note.relativePath);
|
|
77
|
+
const marker = markerFromNoteFrontmatter(note.frontmatter, {
|
|
78
|
+
fallbackTitle: path.basename(note.relativePath),
|
|
79
|
+
...(href ? { notePath: href } : {}),
|
|
80
|
+
...(presentation.markerTypes ? { types: presentation.markerTypes } : {}),
|
|
81
|
+
...(presentation.defaultMarkerType ? { defaultTypeId: presentation.defaultMarkerType } : {}),
|
|
82
|
+
...(presentation.defaultTooltip ? { tooltip: presentation.defaultTooltip } : {}),
|
|
83
|
+
});
|
|
84
|
+
// A note without a valid `location` is skipped, never a build failure.
|
|
85
|
+
if (marker)
|
|
86
|
+
markers.push(marker);
|
|
87
|
+
}
|
|
88
|
+
return markers;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Re-resolves `note:` references on an already normalized config. `dateField`
|
|
92
|
+
* is not part of `StoryMapConfig`, so it defaults to the built-in
|
|
93
|
+
* `date-created`; pass the document's own value when it differs. Slides that
|
|
94
|
+
* already carry a `date` keep it, because an authored value always wins.
|
|
95
|
+
*
|
|
96
|
+
* `layoutMode` is threaded through for signature symmetry with `resolveSource`,
|
|
97
|
+
* but this path always resolves as `link`, so the `full`-display carve-out
|
|
98
|
+
* cannot apply here and the argument has no effect on the result.
|
|
99
|
+
*/
|
|
100
|
+
resolveStory(story, sourcePath, dateField = DEFAULT_DATE_FIELD) {
|
|
101
|
+
return {
|
|
102
|
+
...story,
|
|
103
|
+
slides: this.resolveExplicitSlides(story.slides, sourcePath, 'link', story.layout.mode, dateField),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
resolveExplicitSlides(slides, sourcePath, noteDisplay, layoutMode, dateField) {
|
|
107
|
+
return slides.map((slide) => this.resolveSlide(slide, sourcePath, noteDisplay, layoutMode, dateField));
|
|
30
108
|
}
|
|
31
|
-
resolveFolder(noteFolder, dateField, order, noteDisplay, includeTags, excludeTags) {
|
|
109
|
+
resolveFolder(noteFolder, dateField, order, noteDisplay, layoutMode, includeTags, excludeTags) {
|
|
32
110
|
const entries = this.notes
|
|
33
111
|
.filter((note) => isPathInFolder(note.relativePath, noteFolder))
|
|
34
112
|
.map((note) => ({
|
|
@@ -38,27 +116,30 @@ export class VaultIndex {
|
|
|
38
116
|
}))
|
|
39
117
|
.filter((entry) => entry.note.frontmatter['story-map-note'] === true)
|
|
40
118
|
.filter((entry) => matchesTagFilter(entry.note.frontmatter, includeTags, excludeTags));
|
|
41
|
-
return sortNoteDates(entries, order).map((entry) => this.slideForNote(entry.note, noteDisplay));
|
|
119
|
+
return sortNoteDates(entries, order).map((entry) => this.slideForNote(entry.note, noteDisplay, layoutMode, entry.date));
|
|
42
120
|
}
|
|
43
|
-
slideForNote(note, noteDisplay) {
|
|
121
|
+
slideForNote(note, noteDisplay, layoutMode, date) {
|
|
44
122
|
const frontmatterFields = slideFromNoteFrontmatter(note.frontmatter, path.basename(note.relativePath));
|
|
45
|
-
const slide = noteDisplay === 'full'
|
|
123
|
+
const slide = noteDisplay === 'full' && layoutMode !== 'timeline'
|
|
46
124
|
? locationOnlySlide(frontmatterFields)
|
|
47
|
-
: { ...frontmatterFields };
|
|
125
|
+
: { ...frontmatterFields, ...(date !== null ? { date } : {}) };
|
|
48
126
|
const media = slide.media
|
|
49
127
|
? this.resolveMedia(slide.media, path.posix.dirname(note.relativePath))
|
|
50
128
|
: undefined;
|
|
51
129
|
const withMedia = media ? { ...slide, media } : slide;
|
|
52
130
|
return this.applyNoteDisplay(withMedia, note, noteDisplay);
|
|
53
131
|
}
|
|
54
|
-
resolveSlide(slide, sourcePath, noteDisplay) {
|
|
132
|
+
resolveSlide(slide, sourcePath, noteDisplay, layoutMode, dateField) {
|
|
55
133
|
let resolved = {};
|
|
56
134
|
let note;
|
|
57
135
|
if (slide.note) {
|
|
58
136
|
note = this.findIndexed(parseWikiLinkRef(slide.note));
|
|
59
137
|
if (note) {
|
|
60
138
|
const frontmatterFields = slideFromNoteFrontmatter(note.frontmatter, path.basename(note.relativePath));
|
|
61
|
-
|
|
139
|
+
const date = toTimestamp(note.frontmatter[dateField]);
|
|
140
|
+
resolved = noteDisplay === 'full' && layoutMode !== 'timeline'
|
|
141
|
+
? locationOnlySlide(frontmatterFields)
|
|
142
|
+
: { ...frontmatterFields, ...(date !== null ? { date } : {}) };
|
|
62
143
|
}
|
|
63
144
|
}
|
|
64
145
|
const merged = mergeResolvedSlide(slide, resolved);
|
package/dist/vault.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vault.js","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,GAMZ,MAAM,2B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UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACvC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,CAAC;YAEtD,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAA4B,CAAC;YAC/F,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@story-map/remark-story-map",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Remark transformer and browser client for publishing StoryMap blocks.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@story-map/react-story-map": "0.
|
|
34
|
-
"@story-map/story-map-core": "0.
|
|
33
|
+
"@story-map/react-story-map": "0.5.0",
|
|
34
|
+
"@story-map/story-map-core": "0.5.0",
|
|
35
35
|
"gray-matter": "^4.0.3",
|
|
36
36
|
"unist-util-visit": "^5.1.0",
|
|
37
37
|
"leaflet": "^1.9.4"
|