@metronforge/concept-map 0.1.1 → 0.2.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.
Files changed (199) hide show
  1. package/README.md +142 -91
  2. package/css/concept-map.css +31 -21
  3. package/dist/dom/badgeDom.d.ts +3 -0
  4. package/dist/dom/badgeDom.d.ts.map +1 -0
  5. package/dist/dom/badgeDom.js +23 -0
  6. package/dist/dom/badgeDom.js.map +1 -0
  7. package/dist/dom/geometry.d.ts.map +1 -1
  8. package/dist/dom/geometry.js +12 -2
  9. package/dist/dom/geometry.js.map +1 -1
  10. package/dist/dom/index.d.ts +6 -0
  11. package/dist/dom/index.d.ts.map +1 -0
  12. package/dist/dom/index.js +3 -0
  13. package/dist/dom/index.js.map +1 -0
  14. package/dist/dom/measureLabel.d.ts +4 -0
  15. package/dist/dom/measureLabel.d.ts.map +1 -0
  16. package/dist/dom/measureLabel.js +29 -0
  17. package/dist/dom/measureLabel.js.map +1 -0
  18. package/dist/dom/mount.d.ts +7 -0
  19. package/dist/dom/mount.d.ts.map +1 -0
  20. package/dist/dom/mount.js +37 -0
  21. package/dist/dom/mount.js.map +1 -0
  22. package/dist/dom/player.d.ts.map +1 -1
  23. package/dist/dom/player.js +3 -3
  24. package/dist/dom/player.js.map +1 -1
  25. package/dist/element/element.d.ts +26 -0
  26. package/dist/element/element.d.ts.map +1 -0
  27. package/dist/element/element.js +115 -0
  28. package/dist/element/element.js.map +1 -0
  29. package/dist/element/input.d.ts +7 -0
  30. package/dist/element/input.d.ts.map +1 -0
  31. package/dist/element/input.js +40 -0
  32. package/dist/element/input.js.map +1 -0
  33. package/dist/element/layout.d.ts +4 -0
  34. package/dist/element/layout.d.ts.map +1 -0
  35. package/dist/element/layout.js +14 -0
  36. package/dist/element/layout.js.map +1 -0
  37. package/dist/element.d.ts +9 -0
  38. package/dist/element.d.ts.map +1 -0
  39. package/dist/element.js +5 -0
  40. package/dist/element.js.map +1 -0
  41. package/dist/index.d.ts +4 -5
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +2 -2
  44. package/dist/index.js.map +1 -1
  45. package/dist/layout/badges.d.ts +4 -0
  46. package/dist/layout/badges.d.ts.map +1 -0
  47. package/dist/layout/badges.js +45 -0
  48. package/dist/layout/badges.js.map +1 -0
  49. package/dist/layout/check.d.ts +5 -0
  50. package/dist/layout/check.d.ts.map +1 -0
  51. package/dist/layout/check.js +61 -0
  52. package/dist/layout/check.js.map +1 -0
  53. package/dist/layout/dagre.d.ts +4 -0
  54. package/dist/layout/dagre.d.ts.map +1 -0
  55. package/dist/layout/dagre.js +62 -0
  56. package/dist/layout/dagre.js.map +1 -0
  57. package/dist/layout/elk.d.ts +4 -0
  58. package/dist/layout/elk.d.ts.map +1 -0
  59. package/dist/layout/elk.js +98 -0
  60. package/dist/layout/elk.js.map +1 -0
  61. package/dist/layout/font-metrics.d.ts +3 -0
  62. package/dist/layout/font-metrics.d.ts.map +1 -0
  63. package/dist/layout/font-metrics.js +128 -0
  64. package/dist/layout/font-metrics.js.map +1 -0
  65. package/dist/layout/geometry.d.ts +7 -0
  66. package/dist/layout/geometry.d.ts.map +1 -0
  67. package/dist/layout/geometry.js +56 -0
  68. package/dist/layout/geometry.js.map +1 -0
  69. package/dist/layout/graph.d.ts +6 -0
  70. package/dist/layout/graph.d.ts.map +1 -0
  71. package/dist/layout/graph.js +57 -0
  72. package/dist/layout/graph.js.map +1 -0
  73. package/dist/layout/index.d.ts +8 -0
  74. package/dist/layout/index.d.ts.map +1 -0
  75. package/dist/layout/index.js +21 -0
  76. package/dist/layout/index.js.map +1 -0
  77. package/dist/layout/lanes.d.ts +8 -0
  78. package/dist/layout/lanes.d.ts.map +1 -0
  79. package/dist/layout/lanes.js +78 -0
  80. package/dist/layout/lanes.js.map +1 -0
  81. package/dist/layout/measure.d.ts +4 -0
  82. package/dist/layout/measure.d.ts.map +1 -0
  83. package/dist/layout/measure.js +24 -0
  84. package/dist/layout/measure.js.map +1 -0
  85. package/dist/layout/resolve.d.ts +4 -0
  86. package/dist/layout/resolve.d.ts.map +1 -0
  87. package/dist/layout/resolve.js +114 -0
  88. package/dist/layout/resolve.js.map +1 -0
  89. package/dist/layout/self-route.d.ts +6 -0
  90. package/dist/layout/self-route.d.ts.map +1 -0
  91. package/dist/layout/self-route.js +110 -0
  92. package/dist/layout/self-route.js.map +1 -0
  93. package/dist/layout/types.d.ts +53 -0
  94. package/dist/layout/types.d.ts.map +1 -0
  95. package/dist/layout/types.js +2 -0
  96. package/dist/layout/types.js.map +1 -0
  97. package/dist/model/badge-placement.d.ts +10 -0
  98. package/dist/model/badge-placement.d.ts.map +1 -0
  99. package/dist/model/badge-placement.js +27 -0
  100. package/dist/model/badge-placement.js.map +1 -0
  101. package/dist/model/frame.d.ts +1 -1
  102. package/dist/model/frame.js +1 -1
  103. package/dist/model/input.d.ts +20 -0
  104. package/dist/model/input.d.ts.map +1 -0
  105. package/dist/model/input.js +15 -0
  106. package/dist/model/input.js.map +1 -0
  107. package/dist/model/labels.d.ts +1 -0
  108. package/dist/model/labels.d.ts.map +1 -1
  109. package/dist/model/labels.js +2 -0
  110. package/dist/model/labels.js.map +1 -1
  111. package/dist/render/concepts.d.ts.map +1 -1
  112. package/dist/render/concepts.js +6 -5
  113. package/dist/render/concepts.js.map +1 -1
  114. package/dist/render/data.d.ts +3 -0
  115. package/dist/render/data.d.ts.map +1 -0
  116. package/dist/render/data.js +7 -0
  117. package/dist/render/data.js.map +1 -0
  118. package/dist/render/figure.d.ts +10 -0
  119. package/dist/render/figure.d.ts.map +1 -0
  120. package/dist/render/figure.js +22 -0
  121. package/dist/render/figure.js.map +1 -0
  122. package/dist/render/hydration.d.ts +3 -0
  123. package/dist/render/hydration.d.ts.map +1 -0
  124. package/dist/render/hydration.js +13 -0
  125. package/dist/render/hydration.js.map +1 -0
  126. package/dist/render/panel.d.ts.map +1 -1
  127. package/dist/render/panel.js +7 -6
  128. package/dist/render/panel.js.map +1 -1
  129. package/dist/render/svg.d.ts.map +1 -1
  130. package/dist/render/svg.js +5 -4
  131. package/dist/render/svg.js.map +1 -1
  132. package/dist/schema/content.d.ts +90 -0
  133. package/dist/schema/content.d.ts.map +1 -0
  134. package/dist/schema/content.js +60 -0
  135. package/dist/schema/content.js.map +1 -0
  136. package/dist/schema/layout.d.ts +10 -0
  137. package/dist/schema/layout.d.ts.map +1 -0
  138. package/dist/schema/layout.js +8 -0
  139. package/dist/schema/layout.js.map +1 -0
  140. package/dist/schema/level.d.ts +3 -0
  141. package/dist/schema/level.d.ts.map +1 -0
  142. package/dist/schema/level.js +7 -0
  143. package/dist/schema/level.js.map +1 -0
  144. package/dist/schema/primitives.d.ts +61 -0
  145. package/dist/schema/primitives.d.ts.map +1 -0
  146. package/dist/schema/primitives.js +46 -0
  147. package/dist/schema/primitives.js.map +1 -0
  148. package/dist/schema/references.d.ts +6 -0
  149. package/dist/schema/references.d.ts.map +1 -0
  150. package/dist/schema/references.js +81 -0
  151. package/dist/schema/references.js.map +1 -0
  152. package/dist/schema.d.ts +357 -192
  153. package/dist/schema.d.ts.map +1 -1
  154. package/dist/schema.js +51 -119
  155. package/dist/schema.js.map +1 -1
  156. package/package.json +53 -9
  157. package/resolved-map.schema.json +184 -212
  158. package/source-map.schema.json +606 -0
  159. package/src/dom/badgeDom.ts +32 -0
  160. package/src/dom/geometry.ts +24 -2
  161. package/src/dom/index.ts +5 -0
  162. package/src/dom/measureLabel.ts +28 -0
  163. package/src/dom/mount.ts +46 -0
  164. package/src/dom/player.ts +3 -3
  165. package/src/element/element.ts +128 -0
  166. package/src/element/input.ts +60 -0
  167. package/src/element/layout.ts +18 -0
  168. package/src/element.ts +11 -0
  169. package/src/index.ts +10 -5
  170. package/src/layout/FONT-LICENSE.txt +78 -0
  171. package/src/layout/badges.ts +71 -0
  172. package/src/layout/check.ts +81 -0
  173. package/src/layout/dagre.ts +81 -0
  174. package/src/layout/elk.ts +113 -0
  175. package/src/layout/font-metrics.ts +127 -0
  176. package/src/layout/geometry.ts +72 -0
  177. package/src/layout/graph.ts +88 -0
  178. package/src/layout/index.ts +29 -0
  179. package/src/layout/lanes.ts +114 -0
  180. package/src/layout/measure.ts +25 -0
  181. package/src/layout/resolve.ts +155 -0
  182. package/src/layout/self-route.ts +168 -0
  183. package/src/layout/types.ts +50 -0
  184. package/src/model/badge-placement.ts +43 -0
  185. package/src/model/frame.ts +2 -2
  186. package/src/model/input.ts +26 -0
  187. package/src/model/labels.ts +3 -0
  188. package/src/render/concepts.ts +7 -5
  189. package/src/render/data.ts +10 -0
  190. package/src/render/figure.ts +35 -0
  191. package/src/render/hydration.ts +11 -0
  192. package/src/render/panel.ts +7 -6
  193. package/src/render/svg.ts +5 -4
  194. package/src/schema/content.ts +91 -0
  195. package/src/schema/layout.ts +10 -0
  196. package/src/schema/level.ts +6 -0
  197. package/src/schema/primitives.ts +55 -0
  198. package/src/schema/references.ts +106 -0
  199. package/src/schema.ts +73 -134
package/README.md CHANGED
@@ -1,110 +1,161 @@
1
- # @metronforge/concept-map
2
-
3
- A server-rendered SVG concept map with a browser player, step/whole modes,
4
- keyboard controls and reduced-motion playback. MIT, ESM only, Node >=22.14;
5
- Zod ^4 is a peer. Version 0.1.0 preserves the book's format 2 and behavior.
1
+ # Coffee shop: a map you can play
2
+
3
+ ![The coffee shop map in Whole map mode: a dot travels from the guest to the cashier, the barista and back](https://raw.githubusercontent.com/metronforge/concept-map/main/docs/media/coffee-whole-map.gif)
4
+
5
+ Follow guest → cashier → barista, then switch from **Normal** to **Out of milk**.
6
+ [Open the coffee shop](https://metronforge.github.io/concept-map/examples/coffee/)
7
+ or copy its [HTML and JSON](examples/coffee/).
8
+
9
+ Save this source map as `map.json`. There are no coordinates:
10
+
11
+ <!-- prettier-ignore -->
12
+ ```json
13
+ {
14
+ "format": 3, "id": "coffee", "title": "Coffee shop", "direction": "right",
15
+ "layers": {"process": {"label": "Process"}},
16
+ "nodes": {
17
+ "guest": {"label": "Guest", "layer": "process"},
18
+ "cashier": {"label": "Cashier", "layer": "process"},
19
+ "barista": {"label": "Barista", "layer": "process"}
20
+ },
21
+ "edges": {
22
+ "order": {"from": "guest", "to": "cashier", "label": "Order"},
23
+ "ticket": {"from": "cashier", "to": "barista", "label": "Make coffee"},
24
+ "ready": {"from": "barista", "to": "guest", "label": "Coffee ready"},
25
+ "empty": {"from": "barista", "to": "cashier", "label": "Out of milk"},
26
+ "offer": {"from": "cashier", "to": "guest", "label": "Offer americano"}
27
+ },
28
+ "scenarios": [
29
+ {
30
+ "id": "normal", "label": "Normal",
31
+ "steps": [
32
+ {"id": "order", "title": "Place an order", "text": "The guest orders a coffee.", "show": ["guest", "cashier"], "current": ["cashier"], "edges": ["order"]},
33
+ {"id": "brew", "title": "Make coffee", "text": "The cashier sends the order to the barista.", "show": ["barista"], "current": ["barista"], "edges": ["ticket"]},
34
+ {"id": "serve", "title": "Serve coffee", "text": "The guest receives the coffee.", "show": [], "current": ["guest"], "edges": ["ready"]}
35
+ ],
36
+ "flow": [{"node": "guest", "step": "order", "log": []}, {"node": "cashier", "step": "order", "log": ["Order received."], "edge": "order"}, {"node": "barista", "step": "brew", "log": ["Making coffee."], "edge": "ticket"}, {"node": "guest", "step": "serve", "log": ["Coffee served."], "edge": "ready"}]
37
+ },
38
+ {
39
+ "id": "out-of-milk", "label": "Out of milk",
40
+ "steps": [
41
+ {"id": "order", "title": "Order a cappuccino", "text": "The barista receives an order for a cappuccino.", "show": ["guest", "cashier", "barista"], "current": ["barista"], "edges": ["order", "ticket"]},
42
+ {"id": "empty", "title": "Check the milk", "text": "The barista tells the cashier there is no milk.", "show": [], "current": ["barista"], "edges": ["empty"]},
43
+ {"id": "offer", "title": "Offer an alternative", "text": "The cashier offers an americano.", "show": [], "current": ["guest"], "edges": ["offer"]}
44
+ ],
45
+ "flow": [{"node": "guest", "step": "order", "log": []}, {"node": "cashier", "step": "order", "log": [], "edge": "order"}, {"node": "barista", "step": "order", "log": [], "edge": "ticket"}, {"node": "cashier", "step": "empty", "log": ["No milk left."], "edge": "empty"}, {"node": "guest", "step": "offer", "log": ["Offer an americano."], "edge": "offer"}]
46
+ }
47
+ ]
48
+ }
49
+ ```
6
50
 
7
- **Stage A limitation:** inputs must come from a trusted adapter. The resolved
8
- schema validates structure, not cross-references or HTML safety. Rich-text
9
- leaves contain already-rendered HTML. Do not pass untrusted JSON or HTML directly
10
- to the renderers. The closed Playwright layer list is not stable before 1.0.
11
- See [DEBT](docs/DEBT.md), including reproduced invariant counterexamples.
51
+ Load the stylesheet, one module script and one element on an HTML page:
12
52
 
13
- ## Use
53
+ <!-- x-release-please-start-version -->
14
54
 
15
- ```sh
16
- npm install @metronforge/concept-map@0.1.0 zod@^4
55
+ ```html
56
+ <link
57
+ rel="stylesheet"
58
+ href="https://esm.sh/@metronforge/concept-map@0.2.1/css"
59
+ />
60
+ <script
61
+ type="module"
62
+ src="https://esm.sh/@metronforge/concept-map@0.2.1/element"
63
+ ></script>
64
+ <concept-map src="./map.json" layout="dagre"></concept-map>
17
65
  ```
18
66
 
19
- ```js
20
- // Server: resolvedMap comes from your trusted, reference-validating adapter.
21
- import {
22
- ResolvedMapSchema,
23
- renderSvg,
24
- renderPanelParts,
25
- derive,
26
- initialState,
27
- } from "@metronforge/concept-map";
28
- const map = ResolvedMapSchema.parse(resolvedMap);
29
- const frame = derive(map, initialState);
30
- const svg = renderSvg(map, { frame, markerId: "example-arrow" });
31
- const panel = renderPanelParts(map, frame);
32
- // Insert svg and panel.head/panel.more into the DOM contract's figure shell.
33
- // Embed JSON with JSON.stringify(map).replaceAll('<', '\\u003c').
34
- ```
67
+ <!-- x-release-please-end -->
68
+
69
+ Serve the files over HTTP, for example with `python3 -m http.server 8000`.
70
+ The [complete page](examples/coffee/index.html) adds a title, navigation and host styling.
71
+ The element fetches the JSON, loads dagre when needed and provides scenarios,
72
+ steps, an animated whole-map flow, keyboard controls and reduced-motion support.
73
+ Ready maps with geometry do not download a layout engine.
74
+
75
+ ## Three ways to use the package
76
+
77
+ 1. **Plain HTML:** use `<concept-map>` as above. It also accepts inline JSON or
78
+ a `map` property and can hydrate server-rendered figures. Select `layout="elk"`
79
+ for ELK, or supply an `element.layout` function.
80
+ 2. **Browser code:** `mount(element, resolvedMap)` from `@metronforge/concept-map/dom`
81
+ renders an empty host or hydrates matching markup and returns a player.
82
+ Call `player.destroy()` when removing the host.
83
+ 3. **Server rendering:** `renderFigure(resolvedMap)` from `@metronforge/concept-map`
84
+ returns complete figure markup. Mount it in the browser to add interaction.
85
+
86
+ The last two accept resolved maps. For source maps, call `layout(source, engine)`
87
+ from `@metronforge/concept-map/layout` first. See [integration](docs/INTEGRATION.md)
88
+ and [automatic layout](docs/LAYOUT.md).
89
+
90
+ ## Lay out on the server
91
+
92
+ Install the optional engine with `npm install @dagrejs/dagre`. Read the source
93
+ map, resolve its geometry, then render the complete figure:
35
94
 
36
95
  ```js
37
- // Browser: the server has rendered the figure shell and embedded map JSON.
38
- import { MapPlayer } from "@metronforge/concept-map";
39
- import "@metronforge/concept-map/css";
40
- const root = document.querySelector('[data-figure="map"]');
41
- const player = new MapPlayer(
42
- root,
43
- JSON.parse(root.querySelector("[data-map-data]").textContent),
44
- );
45
- // When removing the view:
46
- // player.destroy();
96
+ import { readFile } from "node:fs/promises";
97
+ import { layout } from "@metronforge/concept-map/layout";
98
+ import { dagreEngine } from "@metronforge/concept-map/layout/dagre";
99
+ import { renderFigure } from "@metronforge/concept-map";
100
+
101
+ const map = JSON.parse(await readFile("map.json", "utf8"));
102
+ const resolvedMap = await layout(map, dagreEngine);
103
+ const html = renderFigure(resolvedMap);
47
104
  ```
48
105
 
49
- The complete executable shell is in `scripts/build-demo.mjs` and the client
50
- entry in `demo/MapFigure.js`. Run `npm run build && npm run demo:build`, then
51
- `npx vite preview --outDir demo-dist`. The demo is a host, not a second player.
106
+ `dagreEngine` is an object, not a function: pass it directly to `layout`, without
107
+ calling it. Include `html` in the server response and load the package stylesheet.
108
+ Use `mount` in the browser to add interaction.
109
+
110
+ ## More examples
52
111
 
53
- Read [DOM.md](docs/DOM.md) for elements, classes, ARIA and lifecycle;
54
- [CSS.md](docs/CSS.md) for every `--cmap-*` property. For example, set
55
- `.map-ui { --cmap-bg: white; --cmap-fg: #202124; --cmap-accent: #285bb5; }`.
56
- Keep the accessible status element and the book's existing text form when
57
- integrating. No new text-form feature is introduced by this extraction.
112
+ - [Door: a finite state machine](https://metronforge.github.io/concept-map/examples/door/) —
113
+ states, guarded transition labels and a self-transition. [Authoring notes](examples/door/README.md).
114
+ - [Euclid's algorithm](https://metronforge.github.io/concept-map/examples/gcd/) —
115
+ a recorded loop with repeat badges and values in the log. [Authoring notes](examples/gcd/README.md).
116
+ - [Layout comparison](https://metronforge.github.io/concept-map/) —
117
+ manual geometry, dagre and ELK side by side.
58
118
 
59
- There is one mixed entry `.` in 0.1.0 (D6). The target core / `./dom` split
60
- belongs to 0.2.0. `./css` and `./resolved-map.schema.json` are also exported.
61
- All four contracts (data, TypeScript, DOM, CSS) are versioned together;
62
- anything not explicitly declared stable here may change in a pre-1.0 minor.
63
- No contract is declared 1.0-stable yet. Format number and npm version differ.
119
+ Each example is a standalone HTML page plus a source JSON file. Its README records
120
+ what the author had to work around; these notes inform the next release.
64
121
 
65
- ## Development and provenance
122
+ ## Install and style
66
123
 
67
124
  ```sh
68
- npm ci
69
- npm run verify
70
- npx playwright install --with-deps chromium firefox webkit
71
- npm run test:browser
72
- npm run test:mutation # report only on stage A; weekly/manual CI
125
+ npm install @metronforge/concept-map zod
73
126
  ```
74
127
 
75
- CI runs Node 24 and all three browsers. `npm ci` installs the pre-push hook;
76
- it runs verify plus Chromium locally. A sandbox can supply
77
- `PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium`. No hook bypass is needed.
128
+ ESM only, Node ≥ 22.14. `zod` 4 is a peer dependency. MIT.
129
+ Install `@dagrejs/dagre` or `elkjs` when a bundled application uses that engine.
130
+ Load `@metronforge/concept-map/css` separately; host colours and fonts use the
131
+ custom properties in [docs/CSS.md](docs/CSS.md).
78
132
 
79
- History was extracted with git-filter-repo from metronforge-site-dev at
80
- 81af868, selecting only the moved player, CSS and tests. Existing source
81
- algorithms were preserved; relative imports acquired Node ESM `.js` suffixes.
82
- The 23 book fixtures are a one-time export. To reproduce in the book:
133
+ ## Format 3
83
134
 
84
- ```sh
85
- cd illustrated-playwright
86
- node scripts/export-concept-maps.mjs /path/to/concept-map/test/fixtures/book-maps.json
87
- ```
135
+ Maps declare their own layers and use plain text with inline code, emphasis and
136
+ strong marks. HTML is escaped. `SourceMapSchema` validates maps without geometry;
137
+ `ResolvedMapSchema` validates geometry for playback. `layout()` checks semantic
138
+ references before running an engine. See the [format guide](docs/FORMAT.md).
139
+
140
+ ## Stability
141
+
142
+ Before 1.0 any minor version may change the API. The data format has its own
143
+ number (`format: 3`); format 2 is no longer accepted. The planned
144
+ changes are in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) and
145
+ [docs/DEBT.md](docs/DEBT.md).
146
+
147
+ ## Exports
148
+
149
+ | Entry | Contents |
150
+ | --------------------------------------------------- | ------------------------------------------------ |
151
+ | `@metronforge/concept-map` | schemas, model and server renderers |
152
+ | `@metronforge/concept-map/dom` | `mount`, `MapPlayer`, concepts and browser ports |
153
+ | `@metronforge/concept-map/element` | registers `<concept-map>` |
154
+ | `@metronforge/concept-map/css` | the player stylesheet |
155
+ | `@metronforge/concept-map/source-map.schema.json` | JSON Schema of the source map |
156
+ | `@metronforge/concept-map/resolved-map.schema.json` | JSON Schema of the resolved map |
157
+
158
+ ## Links
88
159
 
89
- `render-golden.json` freezes 1,050 pre-extraction outputs (SHA-256 of SVG,
90
- panel, concepts and deeper output for each scenario/step/mode). It is not
91
- regenerated automatically from this library. Package fixtures are regression
92
- data; the book YAML and authoring adapter remain in the book.
93
-
94
- ## Release (author steps)
95
-
96
- 1. Merge reviewed `init` and create the public npm organisation `metronforge`.
97
- 2. First publication is from the author's machine: check out the reviewed
98
- 0.1.0 commit, run `npm ci && npm run build`, then `npm publish --access public`
99
- with npm login and 2FA. Codex does not perform this bootstrap publication.
100
- 3. Configure npm Trusted Publishing for repository `metronforge/concept-map`
101
- and workflow `release.yml`; allow direct publishing. Publish 0.1.1 soon
102
- afterward (within two days for the first trusted-publisher use).
103
- 4. Remove any bootstrap npm token. Subsequent releases use GitHub Actions
104
- OIDC, no stored npm token. The author publishes a GitHub Release named
105
- `v<package version>`; all CI checks must pass before npm publish.
106
- 5. After 0.1.0 is on npm, the book installs exactly 0.1.0, replacing the local
107
- tarball used for pre-publication verification. Do not merge a file: dependency.
108
-
109
- No tag or GitHub Release is created by the extraction task. Stages B/C wait for
110
- stage A's merge and the decisions specified in the accepted architecture.
160
+ [Changelog](CHANGELOG.md) · [Contributing](CONTRIBUTING.md) ·
161
+ [Releasing](RELEASING.md) · [Roadmap](docs/ROADMAP.md)
@@ -1,33 +1,19 @@
1
1
  :where(.map-ui) {
2
2
  --cmap-accent: #285bb5;
3
3
  --cmap-accent-low: #e8eef8;
4
- --cmap-app: #526a8a;
4
+ --cmap-layer: #526a8a;
5
+ --cmap-frame: #526a8a;
6
+ --cmap-success: #526a8a;
7
+ --cmap-fail: #526a8a;
5
8
  --cmap-bg: #ffffff;
6
9
  --cmap-border: #b4b8be;
7
- --cmap-browser: #526a8a;
8
- --cmap-client: #526a8a;
9
- --cmap-fail: #526a8a;
10
10
  --cmap-fg: #202124;
11
11
  --cmap-font-mono: monospace;
12
12
  --cmap-font-sans: system-ui, sans-serif;
13
13
  --cmap-muted: #f2f3f5;
14
14
  --cmap-muted-fg: #666666;
15
15
  --cmap-node: #ffffff;
16
- --cmap-page: #526a8a;
17
- --cmap-protocol: #526a8a;
18
- --cmap-runner: #526a8a;
19
- --cmap-server: #526a8a;
20
- --cmap-test: #526a8a;
21
16
  --cmap-text-accent: #285bb5;
22
- --runner: var(--cmap-runner);
23
- --client: var(--cmap-client);
24
- --server: var(--cmap-server);
25
- --page: var(--cmap-page);
26
- --browser: var(--cmap-browser);
27
- --app: var(--cmap-app);
28
- --protocol: var(--cmap-protocol);
29
- --fail: var(--cmap-fail);
30
- --test: var(--cmap-test);
31
17
  --muted-fg: var(--cmap-muted-fg);
32
18
  min-width: 0;
33
19
  }
@@ -89,7 +75,8 @@
89
75
  }
90
76
  .map-ui .map svg {
91
77
  display: block;
92
- width: 100%;
78
+ max-width: 100%;
79
+ margin-inline: auto;
93
80
  height: auto;
94
81
  }
95
82
  .map-ui .lane rect {
@@ -113,7 +100,7 @@
113
100
  }
114
101
  .map-ui .frame rect {
115
102
  fill: none;
116
- stroke: color-mix(in srgb, var(--cmap-runner) 40%, var(--cmap-bg));
103
+ stroke: color-mix(in srgb, var(--cmap-frame) 40%, var(--cmap-bg));
117
104
  stroke-dasharray: 4 3;
118
105
  }
119
106
  .map-ui .frame text {
@@ -222,6 +209,7 @@
222
209
  }
223
210
  .map-ui .panel.head {
224
211
  grid-area: head;
212
+ align-self: stretch;
225
213
  border-bottom: 0;
226
214
  border-radius: 8px 8px 0 0;
227
215
  padding-bottom: 6px;
@@ -233,6 +221,11 @@
233
221
  padding-top: 6px;
234
222
  align-self: start;
235
223
  }
224
+ .map-ui .panel.head:has(+ .panel.more:empty) {
225
+ border-bottom: 1px solid var(--cmap-border);
226
+ border-radius: 8px;
227
+ padding-bottom: 16px;
228
+ }
236
229
  .map-ui .panel.more:empty {
237
230
  display: none;
238
231
  }
@@ -555,6 +548,10 @@
555
548
  fill: var(--cmap-fg);
556
549
  }
557
550
  .map-ui .etext {
551
+ paint-order: stroke;
552
+ stroke: var(--cmap-bg);
553
+ stroke-width: 4px;
554
+ stroke-linejoin: round;
558
555
  font: 500 9.5px var(--cmap-font-mono);
559
556
  fill: var(--cmap-muted-fg);
560
557
  }
@@ -712,7 +709,7 @@
712
709
  color: var(--cmap-fail);
713
710
  }
714
711
  .map-ui .code .good {
715
- color: var(--cmap-server);
712
+ color: var(--cmap-success);
716
713
  }
717
714
  .map-ui .prose {
718
715
  margin-top: 40px;
@@ -901,3 +898,16 @@
901
898
  white-space: nowrap;
902
899
  border: 0;
903
900
  }
901
+
902
+ /* The figure announces changes without adding a second visible panel. */
903
+ .map-ui .map-status {
904
+ position: absolute;
905
+ width: 1px;
906
+ height: 1px;
907
+ overflow: hidden;
908
+ clip-path: inset(50%);
909
+ white-space: nowrap;
910
+ }
911
+ .map-ui[data-map-id] {
912
+ position: relative;
913
+ }
@@ -0,0 +1,3 @@
1
+ /** Refit from original SVG coordinates, after text fitting and font readiness. */
2
+ export declare function fitBadges(svg: SVGSVGElement): void;
3
+ //# sourceMappingURL=badgeDom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badgeDom.d.ts","sourceRoot":"","sources":["../../src/dom/badgeDom.ts"],"names":[],"mappings":"AACA,kFAAkF;AAClF,wBAAgB,SAAS,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CA6BlD"}
@@ -0,0 +1,23 @@
1
+ import { placeBadge } from "../model/badge-placement.js";
2
+ /** Refit from original SVG coordinates, after text fitting and font readiness. */
3
+ export function fitBadges(svg) {
4
+ const matrix = svg.getScreenCTM()?.inverse();
5
+ if (!matrix)
6
+ return;
7
+ const measure = (selector) => [...svg.querySelectorAll(selector)].map((el) => {
8
+ const rect = el.getBoundingClientRect();
9
+ const a = new DOMPoint(rect.left, rect.top).matrixTransform(matrix);
10
+ const b = new DOMPoint(rect.right, rect.bottom).matrixTransform(matrix);
11
+ return { x: a.x, y: a.y, width: b.x - a.x, height: b.y - a.y };
12
+ });
13
+ const boxes = measure(".etext:not(.ghost)");
14
+ const nodes = measure(".node:not(.ghost) rect");
15
+ const bounds = svg.viewBox.baseVal;
16
+ for (const badge of svg.querySelectorAll(".badge")) {
17
+ const circle = badge.querySelector("circle");
18
+ const x = circle.cx.baseVal.value, y = circle.cy.baseVal.value;
19
+ const point = placeBadge([x, y], circle.r.baseVal.value, boxes, bounds, nodes);
20
+ badge.setAttribute("transform", `translate(${point[0] - x} ${point[1] - y})`);
21
+ }
22
+ }
23
+ //# sourceMappingURL=badgeD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AAG,EAAE,QAAQ,QAsD5E"}
1
+ {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/dom/geometry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAOhD,MAAM,WAAW,QAAQ;IACvB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,EAAE,kBAAkB,GAAG;QAC/B,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AACD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,aAAa,GAAG,QAAQ,CAYrD;AAQD,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,QA+B5E"}
@@ -1,4 +1,5 @@
1
- import { labelMinimum, fitNodeLabels, fitEdgeLabel } from "../model/labels.js";
1
+ import { fitBadges } from "./badgeDom.js";
2
+ import { labelMinimum, naturalMapWidth, fitNodeLabels, fitEdgeLabel, } from "../model/labels.js";
2
3
  export function geometry(svg) {
3
4
  const path = (edge) => svg.querySelector(`g.edge[data-edge="${edge}"] path`);
4
5
  return {
@@ -10,10 +11,15 @@ export function geometry(svg) {
10
11
  textBox: (el) => el.getBBox(),
11
12
  };
12
13
  }
14
+ function sizeMap(root, svg, viewBoxWidth) {
15
+ const fontSize = parseFloat(root.ownerDocument.defaultView.getComputedStyle(root).fontSize);
16
+ svg.setAttribute("width", String(naturalMapWidth(viewBoxWidth, fontSize)));
17
+ return svg.getBoundingClientRect().width;
18
+ }
13
19
  /** Measurements are browser-owned; all fitting decisions are pure model math. */
14
20
  export function sizeLabels(root, map, geo) {
15
21
  const svg = root.querySelector(".map svg");
16
- const width = svg.getBoundingClientRect().width;
22
+ const width = sizeMap(root, svg, map.viewBox[0]);
17
23
  if (width)
18
24
  root.style.setProperty("--map-label-min", `${labelMinimum(map.viewBox[0], width)}px`);
19
25
  svg.querySelectorAll(".node .tag").forEach((tag) => {
@@ -32,6 +38,10 @@ export function sizeLabels(root, map, geo) {
32
38
  label.setAttribute("y", String(fitted.main));
33
39
  tag.setAttribute("y", String(fitted.tag));
34
40
  });
41
+ fitEdgeLabels(root, map, svg);
42
+ fitBadges(svg);
43
+ }
44
+ function fitEdgeLabels(root, map, svg) {
35
45
  svg.querySelectorAll(".etext").forEach((label) => {
36
46
  const edge = map.edges[label.dataset.edge];
37
47
  if (!edge.label)
@@ -1 +1 @@
1
- {"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/dom/geometry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAW/E,MAAM,UAAU,QAAQ,CAAC,GAAkB;IACzC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAC5B,GAAG,CAAC,aAAa,CAAiB,qBAAqB,IAAI,SAAS,CAAE,CAAC;IACzE,OAAO;QACL,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE;QACjD,OAAO,CAAC,IAAI,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAClB,EAAE,GAAG,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC;YAClD,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE;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O,CAAC,CAAC,CAAC,EACd,KAAK,CAAC,qBAAqB,EAAE,EAC7B,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAC7C,CAAC;QACF,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,KAAK,CAAC,eAAe,CACnB,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACpB,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,eAAe,CAC7C,4BAA4B,EAC5B,OAAO,CACR,CAAC;YACF,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { MapPlayer, connectConcepts } from "./player.js";
2
+ export { mount } from "./mount.js";
3
+ export type { MountOptions } from "./mount.js";
4
+ export type { Animator, Playback, FlowHooks } from "./animator.js";
5
+ export type { Geometry } from "./geometry.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dom/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACnE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { MapPlayer, connectConcepts } from "./player.js";
2
+ export { mount } from "./mount.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dom/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { LabelMeasurer } from "../layout/types.js";
2
+ /** Call after host.ownerDocument.fonts.ready; uses the host's --cmap font inputs. */
3
+ export declare function createDomMeasurer(host: HTMLElement): LabelMeasurer;
4
+ //# sourceMappingURL=measureLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measureLabel.d.ts","sourceRoot":"","sources":["../../src/dom/measureLabel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,aAAa,CAyBlE"}
@@ -0,0 +1,29 @@
1
+ /** Call after host.ownerDocument.fonts.ready; uses the host's --cmap font inputs. */
2
+ export function createDomMeasurer(host) {
3
+ return (text, style) => {
4
+ const span = host.ownerDocument.createElement("span");
5
+ Object.assign(span.style, {
6
+ position: "absolute",
7
+ visibility: "hidden",
8
+ pointerEvents: "none",
9
+ whiteSpace: "pre",
10
+ fontWeight: "500",
11
+ lineHeight: "1.2",
12
+ fontSize: `${style.fontSize}px`,
13
+ letterSpacing: `${style.letterSpacing ?? 0}px`,
14
+ fontFamily: style.mono
15
+ ? "var(--cmap-font-mono, monospace)"
16
+ : "var(--cmap-font-sans, system-ui)",
17
+ });
18
+ span.textContent = text || " ";
19
+ host.append(span);
20
+ try {
21
+ const rect = span.getBoundingClientRect();
22
+ return { width: text ? rect.width : 0, height: rect.height };
23
+ }
24
+ finally {
25
+ span.remove();
26
+ }
27
+ };
28
+ }
29
+ //# sourceMappingURL=measureLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measureLabel.js","sourceRoot":"","sources":["../../src/dom/measureLabel.ts"],"names":[],"mappings":"AACA,qFAAqF;AACrF,MAAM,UAAU,iBAAiB,CAAC,IAAiB;IACjD,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACrB,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE;YACxB,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,QAAQ;YACpB,aAAa,EAAE,MAAM;YACrB,UAAU,EAAE,KAAK;YACjB,UAAU,EAAE,KAAK;YACjB,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,GAAG,KAAK,CAAC,QAAQ,IAAI;YAC/B,aAAa,EAAE,GAAG,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI;YAC9C,UAAU,EAAE,KAAK,CAAC,IAAI;gBACpB,CAAC,CAAC,kCAAkC;gBACpC,CAAC,CAAC,kCAAkC;SACvC,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,GAAG,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC1C,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QAC/D,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ResolvedMap } from "../schema.js";
2
+ import { type FigureOptions } from "../render/figure.js";
3
+ import { MapPlayer } from "./player.js";
4
+ export type MountOptions = FigureOptions & ConstructorParameters<typeof MapPlayer>[2];
5
+ /** Populate a host or hydrate its existing figure. Repeated mounts replace bindings. */
6
+ export declare function mount(element: HTMLElement, map: ResolvedMap, options?: MountOptions): MapPlayer;
7
+ //# sourceMappingURL=mount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/dom/mount.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG,aAAa,GACtC,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAG7C,wFAAwF;AACxF,wBAAgB,KAAK,CACnB,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,WAAW,EAChB,OAAO,GAAE,YAAiB,GACzB,SAAS,CA+BX"}
@@ -0,0 +1,37 @@
1
+ import { canHydrate } from "../render/hydration.js";
2
+ import { renderFigure } from "../render/figure.js";
3
+ import { MapPlayer, connectConcepts } from "./player.js";
4
+ const mounted = new WeakMap();
5
+ /** Populate a host or hydrate its existing figure. Repeated mounts replace bindings. */
6
+ export function mount(element, map, options = {}) {
7
+ const existing = element.matches('figure[data-figure="map"]')
8
+ ? element
9
+ : element.querySelector(':scope > figure[data-figure="map"]');
10
+ mounted.get(element)?.destroy();
11
+ if (existing)
12
+ mounted.get(existing)?.destroy();
13
+ const markup = renderFigure(map, options);
14
+ let root = existing;
15
+ const data = root?.querySelector(":scope > script[data-map-data]");
16
+ if (!root || !canHydrate(data ? (data.textContent ?? "") : undefined, map)) {
17
+ if (existing === element) {
18
+ const template = element.ownerDocument.createElement("template");
19
+ template.innerHTML = markup;
20
+ const figure = template.content.firstElementChild;
21
+ for (const attr of [...figure.attributes])
22
+ element.setAttribute(attr.name, attr.value);
23
+ element.innerHTML = figure.innerHTML;
24
+ root = element;
25
+ }
26
+ else {
27
+ element.innerHTML = markup;
28
+ root = element.firstElementChild;
29
+ }
30
+ }
31
+ const player = new MapPlayer(root, map, options);
32
+ connectConcepts(player, root.querySelector("[data-map-concepts]") ?? root);
33
+ mounted.set(element, player);
34
+ mounted.set(root, player);
35
+ return player;
36
+ }
37
+ //# sourceMappingURL=mount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount.js","sourceRoot":"","sources":["../../src/dom/mount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAIzD,MAAM,OAAO,GAAG,IAAI,OAAO,EAA0B,CAAC;AAEtD,wFAAwF;AACxF,MAAM,UAAU,KAAK,CACnB,OAAoB,EACpB,GAAgB,EAChB,UAAwB,EAAE;IAE1B,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,2BAA2B,CAAC;QAC3D,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,OAAO,CAAC,aAAa,CAAc,oCAAoC,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IAChC,IAAI,QAAQ;QAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IAC/C,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1C,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,MAAM,IAAI,GAAG,IAAI,EAAE,aAAa,CAAC,gCAAgC,CAAC,CAAC;IACnE,IAAI,CAAC,IAAI,IAAI,CAAC,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GAAG,EAAE,WAAW,EACzB,OAAO,GAAE;QACP,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;KACzB;IA2CR,IAAI,KAAK,IAAI,WAAW,CAEvB;IACD,QAAQ,CAAC,MAAM,EAAE,MAAM;IAmBvB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO;IAGtC,MAAM;IAKN,OAAO;IASP,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,QAAQ,CAAC,KAAK,CA+BpB;IACF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAWlB;IACF,OAAO,CAAC,MAAM;IAyBd,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,SAAS;CAoElB;AACD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,WAAW,GACrB,MAAM,IAAI,CA0CZ"}
@@ -24,8 +24,8 @@ export class MapPlayer {
24
24
  constructor(root, map, options = {}) {
25
25
  this.root = root;
26
26
  this.map = map;
27
- if (map.format !== 2)
28
- throw new Error(`Unsupported concept map format ${map.format}; expected 2`);
27
+ if (map.format !== 3)
28
+ throw new Error(`Unsupported concept map format ${map.format}; expected 3`);
29
29
  const view = root.ownerDocument.defaultView;
30
30
  this.svg = new SvgDom(root.querySelector(".map svg"));
31
31
  this.panel = new PanelDom(root, options.strings);
@@ -55,7 +55,6 @@ export class MapPlayer {
55
55
  this.resize = new ResizeObserver(fit);
56
56
  this.resize.observe(this.svg.svg);
57
57
  this.render();
58
- fit();
59
58
  void root.ownerDocument.fonts.ready.then(fit);
60
59
  }
61
60
  get state() {
@@ -150,6 +149,7 @@ export class MapPlayer {
150
149
  const frame = derive(this.map, this.current);
151
150
  this.svg.applyFrame(frame);
152
151
  this.panel.applyFrame(this.map, frame);
152
+ sizeLabels(this.root, this.map, this.geo);
153
153
  this.root
154
154
  .querySelectorAll("[data-scenario]")
155
155
  .forEach((b) => b.setAttribute("aria-pressed", String(b.dataset.scenario === this.map.scenarios[this.current.scenario].id)));