@helping-ai-workflow/md2doc 3.4.2 → 3.6.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/lib/editor/client.js +44 -5
- package/lib/editor/server.js +21 -2
- package/lib/editor/wave-codec.js +775 -1
- package/lib/editor/wave-draw.js +1470 -0
- package/lib/editor/wave-geometry.js +647 -14
- package/lib/editor/wave-panels.js +1102 -0
- package/lib/editor/wave-store.js +64 -2
- package/lib/editor/wave-ui.js +2906 -972
- package/lib/md2doc.js +641 -33
- package/package.json +2 -2
package/lib/editor/client.js
CHANGED
|
@@ -17542,7 +17542,8 @@
|
|
|
17542
17542
|
// An older cached page that predates the injection must degrade to "the
|
|
17543
17543
|
// button does nothing visible", never to a throw out of a click handler.
|
|
17544
17544
|
if (!ui || !mods || !mods['wave-store.js'] || !mods['wave-codec.js'] ||
|
|
17545
|
-
!mods['wave-geometry.js']
|
|
17545
|
+
!mods['wave-geometry.js'] || !mods['wave-draw.js'] ||
|
|
17546
|
+
!mods['wave-panels.js']) return;
|
|
17546
17547
|
if (waveEditor !== null) return;
|
|
17547
17548
|
hideWaveEditBtn();
|
|
17548
17549
|
|
|
@@ -17603,8 +17604,27 @@
|
|
|
17603
17604
|
document: document,
|
|
17604
17605
|
host: document.body,
|
|
17605
17606
|
source: body.text,
|
|
17607
|
+
// v3.6.0 Task 15: which block in this document the editor is over,
|
|
17608
|
+
// for the 匯出 filename (`exportName()` in wave-ui.js). The editor
|
|
17609
|
+
// cannot derive it — it is handed one block's TEXT and nothing about
|
|
17610
|
+
// where that text came from — and two diagrams in one document
|
|
17611
|
+
// exporting under the same filename is a silent overwrite in the
|
|
17612
|
+
// user's downloads folder.
|
|
17613
|
+
blockIndex: id,
|
|
17614
|
+
// …and the document's own name for the other half of that filename.
|
|
17615
|
+
// `baseTitle`, NOT `document.title`: this file owns the page title
|
|
17616
|
+
// while a session is open and writes the dirty marker into it
|
|
17617
|
+
// (`(documentIsDirty() ? '● ' : '') + baseTitle`, above). Handing over
|
|
17618
|
+
// the decorated title would land a user who has actually edited with
|
|
17619
|
+
// `●-doc-wave-1.svg`, and a user who has not with the clean name —
|
|
17620
|
+
// i.e. it would look right in exactly the case nobody exports in.
|
|
17621
|
+
// `baseTitle` is the title as it was before this file touched it,
|
|
17622
|
+
// which is md2doc's `path.basename(src, '.md')`.
|
|
17623
|
+
fileLabel: baseTitle,
|
|
17606
17624
|
codec: mods['wave-codec.js'],
|
|
17607
17625
|
geometry: mods['wave-geometry.js'],
|
|
17626
|
+
draw: mods['wave-draw.js'],
|
|
17627
|
+
panels: mods['wave-panels.js'],
|
|
17608
17628
|
createStore: mods['wave-store.js'].createStore,
|
|
17609
17629
|
// The store's own answer to「哪一條 lane 是哪一條」across one operation,
|
|
17610
17630
|
// handed over rather than re-derived: the editor's cell cursor and its
|
|
@@ -17760,10 +17780,29 @@
|
|
|
17760
17780
|
|
|
17761
17781
|
/** One refusal, recorded and raised. The only producer of `waveUnwrittenEdit`. */
|
|
17762
17782
|
function waveRefuseGesture(seam, reason) {
|
|
17763
|
-
// A refusal is not papered over and not rolled back.
|
|
17764
|
-
//
|
|
17765
|
-
//
|
|
17766
|
-
//
|
|
17783
|
+
// A refusal is not papered over and not rolled back. This raises it as a
|
|
17784
|
+
// banner naming the lines it could not write, and waits for the user to
|
|
17785
|
+
// acknowledge it.
|
|
17786
|
+
//
|
|
17787
|
+
// v3.6.0 Task 16 fix round 2 (N1) withdraws the reason that used to stand
|
|
17788
|
+
// here — "wave-ui has already said so on the status line, which is where
|
|
17789
|
+
// the user's eyes are, but a status line is not a decision". wave-ui does
|
|
17790
|
+
// write the reason there (`afterStoreMoved`'s
|
|
17791
|
+
// `這個改動沒辦法只改幾個位元組寫回去:…`), but that line is ONE
|
|
17792
|
+
// `role="status"` string and the next thing the same gesture says
|
|
17793
|
+
// replaces it. MEASURED on the journey fixture: the fourth Alt+↑ of the
|
|
17794
|
+
// Task 16 scenario refuses — "the value at [\"signal\"] is or contains an
|
|
17795
|
+
// object, so replacing it would re-serialise part of the document's
|
|
17796
|
+
// structure…" — and `moveSelectedLane`'s landing line
|
|
17797
|
+
// (`搬動的 lane 落在群組「bus」裡`) is written straight after it, so the
|
|
17798
|
+
// sentence the user is left looking at reads like success.
|
|
17799
|
+
//
|
|
17800
|
+
// That is a FAMILY, not one caller: `addLaneFromToolbar` and 複製 have
|
|
17801
|
+
// written over the same refusal since before Task 16, and the rail's drag
|
|
17802
|
+
// drop announces nothing at all. Re-ordering those says is behaviour, and
|
|
17803
|
+
// it is parked as a next-version follow-up rather than done here. So the
|
|
17804
|
+
// banner below is not a nicety layered on a status line that already said
|
|
17805
|
+
// it — it is the only part of the refusal that cannot be clobbered.
|
|
17767
17806
|
seam.unwritten = true;
|
|
17768
17807
|
waveUnwrittenEdit = true;
|
|
17769
17808
|
setDirty();
|
package/lib/editor/server.js
CHANGED
|
@@ -56,7 +56,7 @@ const TURNDOWN_SRC = fs.readFileSync(
|
|
|
56
56
|
require.resolve('turndown/lib/turndown.browser.umd.js'), 'utf8');
|
|
57
57
|
const PASTE_MD_SRC = fs.readFileSync(path.join(__dirname, 'paste-md.js'), 'utf8');
|
|
58
58
|
|
|
59
|
-
// v3.4.0 batch3 Task 6: the wavedrom GUI's
|
|
59
|
+
// v3.4.0 batch3 Task 6: the wavedrom GUI's modules.
|
|
60
60
|
//
|
|
61
61
|
// wave-codec.js / wave-geometry.js / wave-store.js are plain CommonJS ON
|
|
62
62
|
// PURPOSE, and rewriting them into the UMD header every other module here uses
|
|
@@ -67,11 +67,28 @@ const PASTE_MD_SRC = fs.readFileSync(path.join(__dirname, 'paste-md.js'), 'utf8'
|
|
|
67
67
|
// the browser gets them through the small CommonJS shim below instead —
|
|
68
68
|
// the module text itself is inlined byte for byte.
|
|
69
69
|
//
|
|
70
|
+
// v3.6.0 Task 1: wave-draw.js joins them, plain CommonJS too — a pure
|
|
71
|
+
// extraction out of wave-ui.js, not test-guarded like the other three, but
|
|
72
|
+
// needing the identical shim for a different reason: wave-ui.js itself is
|
|
73
|
+
// injected as a bare <script> with no `require()` of its own (see its own
|
|
74
|
+
// header comment), so it cannot resolve `require('./wave-draw.js')` in the
|
|
75
|
+
// browser any more than the page around it could. `createWaveEditor()` takes
|
|
76
|
+
// it in as `opts.draw` instead, the same way it already takes `opts.codec`
|
|
77
|
+
// and `opts.geometry`.
|
|
78
|
+
//
|
|
79
|
+
// v3.6.0 Task 2: wave-panels.js joins them for the identical reason —
|
|
80
|
+
// another pure extraction out of wave-ui.js (the toolbar, the right-hand
|
|
81
|
+
// panels and the lane rail this time), needing the same shim because
|
|
82
|
+
// wave-ui.js still cannot `require()` anything in the browser. Taken in as
|
|
83
|
+
// `opts.panels`.
|
|
84
|
+
//
|
|
70
85
|
// wave-ui.js is UMD like its neighbours and needs no shim; in the page it
|
|
71
|
-
// defines `window.md2docWaveUi` and takes the other
|
|
86
|
+
// defines `window.md2docWaveUi` and takes the other five as parameters.
|
|
72
87
|
const WAVE_CODEC_SRC = fs.readFileSync(path.join(__dirname, 'wave-codec.js'), 'utf8');
|
|
73
88
|
const WAVE_GEOMETRY_SRC = fs.readFileSync(path.join(__dirname, 'wave-geometry.js'), 'utf8');
|
|
74
89
|
const WAVE_STORE_SRC = fs.readFileSync(path.join(__dirname, 'wave-store.js'), 'utf8');
|
|
90
|
+
const WAVE_DRAW_SRC = fs.readFileSync(path.join(__dirname, 'wave-draw.js'), 'utf8');
|
|
91
|
+
const WAVE_PANELS_SRC = fs.readFileSync(path.join(__dirname, 'wave-panels.js'), 'utf8');
|
|
75
92
|
const WAVE_UI_SRC = fs.readFileSync(path.join(__dirname, 'wave-ui.js'), 'utf8');
|
|
76
93
|
|
|
77
94
|
// One CommonJS module, wrapped so a plain <script> can carry it.
|
|
@@ -585,6 +602,8 @@ async function createEditorServer({
|
|
|
585
602
|
waveModuleTag('wave-codec.js', WAVE_CODEC_SRC) +
|
|
586
603
|
waveModuleTag('wave-geometry.js', WAVE_GEOMETRY_SRC) +
|
|
587
604
|
waveModuleTag('wave-store.js', WAVE_STORE_SRC) +
|
|
605
|
+
waveModuleTag('wave-draw.js', WAVE_DRAW_SRC) +
|
|
606
|
+
waveModuleTag('wave-panels.js', WAVE_PANELS_SRC) +
|
|
588
607
|
`<script>${WAVE_UI_SRC}</script>\n` +
|
|
589
608
|
`<script>${clientJs}</script>\n`;
|
|
590
609
|
// Splice at the LAST "</body>" — the document's real closing tag.
|