@metronforge/concept-map 0.0.0-stage → 0.1.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 (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +109 -2
  3. package/css/concept-map.css +903 -0
  4. package/dist/dom/animator.d.ts +25 -0
  5. package/dist/dom/animator.d.ts.map +1 -0
  6. package/dist/dom/animator.js +124 -0
  7. package/dist/dom/animator.js.map +1 -0
  8. package/dist/dom/geometry.d.ts +15 -0
  9. package/dist/dom/geometry.d.ts.map +1 -0
  10. package/dist/dom/geometry.js +52 -0
  11. package/dist/dom/geometry.js.map +1 -0
  12. package/dist/dom/panelDom.d.ts +15 -0
  13. package/dist/dom/panelDom.d.ts.map +1 -0
  14. package/dist/dom/panelDom.js +61 -0
  15. package/dist/dom/panelDom.js.map +1 -0
  16. package/dist/dom/player.d.ts +40 -0
  17. package/dist/dom/player.d.ts.map +1 -0
  18. package/dist/dom/player.js +273 -0
  19. package/dist/dom/player.js.map +1 -0
  20. package/dist/dom/svgDom.d.ts +19 -0
  21. package/dist/dom/svgDom.d.ts.map +1 -0
  22. package/dist/dom/svgDom.js +70 -0
  23. package/dist/dom/svgDom.js.map +1 -0
  24. package/dist/index.d.ts +18 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +12 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/model/flow.d.ts +43 -0
  29. package/dist/model/flow.d.ts.map +1 -0
  30. package/dist/model/flow.js +87 -0
  31. package/dist/model/flow.js.map +1 -0
  32. package/dist/model/frame.d.ts +61 -0
  33. package/dist/model/frame.d.ts.map +1 -0
  34. package/dist/model/frame.js +124 -0
  35. package/dist/model/frame.js.map +1 -0
  36. package/dist/model/labels.d.ts +18 -0
  37. package/dist/model/labels.d.ts.map +1 -0
  38. package/dist/model/labels.js +25 -0
  39. package/dist/model/labels.js.map +1 -0
  40. package/dist/model/path.d.ts +4 -0
  41. package/dist/model/path.d.ts.map +1 -0
  42. package/dist/model/path.js +51 -0
  43. package/dist/model/path.js.map +1 -0
  44. package/dist/model/state.d.ts +30 -0
  45. package/dist/model/state.d.ts.map +1 -0
  46. package/dist/model/state.js +30 -0
  47. package/dist/model/state.js.map +1 -0
  48. package/dist/render/concepts.d.ts +4 -0
  49. package/dist/render/concepts.d.ts.map +1 -0
  50. package/dist/render/concepts.js +16 -0
  51. package/dist/render/concepts.js.map +1 -0
  52. package/dist/render/inline.d.ts +6 -0
  53. package/dist/render/inline.d.ts.map +1 -0
  54. package/dist/render/inline.js +70 -0
  55. package/dist/render/inline.js.map +1 -0
  56. package/dist/render/panel.d.ts +27 -0
  57. package/dist/render/panel.d.ts.map +1 -0
  58. package/dist/render/panel.js +57 -0
  59. package/dist/render/panel.js.map +1 -0
  60. package/dist/render/svg.d.ts +8 -0
  61. package/dist/render/svg.d.ts.map +1 -0
  62. package/dist/render/svg.js +43 -0
  63. package/dist/render/svg.js.map +1 -0
  64. package/dist/schema.d.ts +352 -0
  65. package/dist/schema.d.ts.map +1 -0
  66. package/dist/schema.js +138 -0
  67. package/dist/schema.js.map +1 -0
  68. package/package.json +74 -4
  69. package/resolved-map.schema.json +769 -0
  70. package/src/dom/animator.ts +129 -0
  71. package/src/dom/geometry.ts +81 -0
  72. package/src/dom/panelDom.ts +72 -0
  73. package/src/dom/player.ts +318 -0
  74. package/src/dom/svgDom.ts +79 -0
  75. package/src/index.ts +18 -0
  76. package/src/model/flow.ts +122 -0
  77. package/src/model/frame.ts +180 -0
  78. package/src/model/labels.ts +37 -0
  79. package/src/model/path.ts +56 -0
  80. package/src/model/state.ts +51 -0
  81. package/src/render/concepts.ts +21 -0
  82. package/src/render/inline.ts +71 -0
  83. package/src/render/panel.ts +69 -0
  84. package/src/render/svg.ts +52 -0
  85. package/src/schema.ts +162 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Sat Naing
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,110 @@
1
- # Temporary Holding Version
1
+ # @metronforge/concept-map
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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.
6
+
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.
12
+
13
+ ## Use
14
+
15
+ ```sh
16
+ npm install @metronforge/concept-map@0.1.0 zod@^4
17
+ ```
18
+
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
+ ```
35
+
36
+ ```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();
47
+ ```
48
+
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.
52
+
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.
58
+
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.
64
+
65
+ ## Development and provenance
66
+
67
+ ```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
73
+ ```
74
+
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.
78
+
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:
83
+
84
+ ```sh
85
+ cd illustrated-playwright
86
+ node scripts/export-concept-maps.mjs /path/to/concept-map/test/fixtures/book-maps.json
87
+ ```
88
+
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.