wiki-plugin-rcngraph 0.1.12 → 0.1.14
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/client/rcn-graph.js +383 -2
- package/client/rcngraph.js +383 -2
- package/package.json +1 -1
- package/pages/about-rcngraph-plugin +60 -8
package/client/rcn-graph.js
CHANGED
|
@@ -11,17 +11,265 @@
|
|
|
11
11
|
let pendingItem = null
|
|
12
12
|
let pending$item = null
|
|
13
13
|
|
|
14
|
+
// ── Build playback ─────────────────────────────────────────────────────
|
|
15
|
+
// The Graph Tool's Build mode gives nodes a step number (n.build); an edge
|
|
16
|
+
// shows once both its nodes do. The saved SVG keeps the tool's <g id="node-ID">
|
|
17
|
+
// and <g id="edge-ID"> groups, so playing a build here is only hiding and
|
|
18
|
+
// showing those groups — no redraw, no Graph Tool needed.
|
|
19
|
+
const BUILD_COLOR = '#4f46e5'
|
|
20
|
+
|
|
21
|
+
function graphModel(item) {
|
|
22
|
+
let g = item.graphJSON
|
|
23
|
+
if (typeof g === 'string') { try { g = JSON.parse(g) } catch (e) { return null } }
|
|
24
|
+
return g && Array.isArray(g.nodes) && Array.isArray(g.edges) ? g : null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function buildSteps(g) {
|
|
28
|
+
const s = new Set()
|
|
29
|
+
g.nodes.forEach(n => { if (n.build > 0) s.add(n.build) })
|
|
30
|
+
return [...s].sort((a, b) => a - b)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function groupFor(svg, kind, id) {
|
|
34
|
+
return svg.querySelector('#' + CSS.escape(kind + '-' + id))
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// idx === null: not playing, everything shows. 0: nothing of the build yet.
|
|
38
|
+
function showBuildStep($item, g, idx) {
|
|
39
|
+
const svg = $item.find('svg').get(0)
|
|
40
|
+
if (!svg) return
|
|
41
|
+
const steps = buildSteps(g)
|
|
42
|
+
const thr = idx > 0 ? steps[idx - 1] : 0
|
|
43
|
+
const hideOthers = g.buildOthers === 'hide'
|
|
44
|
+
const byId = {}
|
|
45
|
+
g.nodes.forEach(n => { byId[n.id] = n })
|
|
46
|
+
const arrives = n => (n && n.build > 0 ? n.build : 0)
|
|
47
|
+
const shown = n => {
|
|
48
|
+
if (idx === null || !n) return true
|
|
49
|
+
return n.build > 0 ? n.build <= thr : !hideOthers
|
|
50
|
+
}
|
|
51
|
+
svg.querySelectorAll('.rcn-build-ring').forEach(el => el.remove())
|
|
52
|
+
g.nodes.forEach(n => {
|
|
53
|
+
const el = groupFor(svg, 'node', n.id)
|
|
54
|
+
if (!el) return
|
|
55
|
+
el.style.display = shown(n) ? '' : 'none'
|
|
56
|
+
if (idx > 0 && n.build === thr && n.w && n.h) {
|
|
57
|
+
const r = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse')
|
|
58
|
+
r.setAttribute('class', 'rcn-build-ring')
|
|
59
|
+
r.setAttribute('cx', '0'); r.setAttribute('cy', '0')
|
|
60
|
+
r.setAttribute('rx', String(n.w / 2 + 9)); r.setAttribute('ry', String(n.h / 2 + 9))
|
|
61
|
+
r.setAttribute('fill', 'none'); r.setAttribute('stroke', BUILD_COLOR)
|
|
62
|
+
r.setAttribute('stroke-width', '3'); r.setAttribute('opacity', '.9')
|
|
63
|
+
r.setAttribute('pointer-events', 'none')
|
|
64
|
+
el.appendChild(r)
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
g.edges.forEach(e => {
|
|
68
|
+
const el = groupFor(svg, 'edge', e.id)
|
|
69
|
+
if (!el) return
|
|
70
|
+
const s = byId[e.src], t = byId[e.tgt]
|
|
71
|
+
const on = shown(s) && shown(t)
|
|
72
|
+
el.style.display = on ? '' : 'none'
|
|
73
|
+
// The edge that arrived with this step: recolour its visible line, remember
|
|
74
|
+
// the original so the next step can put it back.
|
|
75
|
+
const isNew = on && idx > 0 && Math.max(arrives(s), arrives(t)) === thr
|
|
76
|
+
el.querySelectorAll('path').forEach(p => {
|
|
77
|
+
const st = p.getAttribute('stroke')
|
|
78
|
+
if (!st || st === 'transparent' || st === 'none') return
|
|
79
|
+
if (isNew) {
|
|
80
|
+
if (!p.hasAttribute('data-build-stroke')) p.setAttribute('data-build-stroke', st)
|
|
81
|
+
p.setAttribute('stroke', BUILD_COLOR)
|
|
82
|
+
} else if (p.hasAttribute('data-build-stroke')) {
|
|
83
|
+
p.setAttribute('stroke', p.getAttribute('data-build-stroke'))
|
|
84
|
+
p.removeAttribute('data-build-stroke')
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
const bar = $item.find('.build-bar')
|
|
89
|
+
bar.find('.build-count').text(idx === null ? '' : 'Step ' + idx + ' / ' + steps.length).toggle(idx !== null)
|
|
90
|
+
bar.find('.build-play').text(idx === null ? '▶ Play build' : '■ Show all')
|
|
91
|
+
bar.find('.build-prev, .build-next').toggle(idx !== null)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ── Walk playback ──────────────────────────────────────────────────────
|
|
95
|
+
// A walk, written in the Graph Tool, is a list of steps: words to say, and
|
|
96
|
+
// what each step lights. The tool saves each step's lit node and edge ids, so
|
|
97
|
+
// playing it here is setting the opacity of the saved SVG's groups and
|
|
98
|
+
// speaking the words with the browser's own voice, shown as a caption too.
|
|
99
|
+
const WALK_GHOST = 0.13, WALK_SEEN = 0.42
|
|
100
|
+
let activeWalk = null // one walk speaks at a time on the whole lineup
|
|
101
|
+
|
|
102
|
+
function walkList(g) {
|
|
103
|
+
return g && Array.isArray(g.walks) ? g.walks.filter(w => w && Array.isArray(w.steps) && w.steps.length) : []
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// null = the whole drawing. Files saved before lit existed fall back to the
|
|
107
|
+
// step's own nodes and the edges among them.
|
|
108
|
+
function stepLit(g, st) {
|
|
109
|
+
if (!st || st.all) return null
|
|
110
|
+
if (st.lit) return { nodes: new Set(st.lit.nodes.map(String)), edges: new Set(st.lit.edges.map(String)) }
|
|
111
|
+
const nodes = new Set((st.nodes || []).map(String))
|
|
112
|
+
if (st.loop) String(st.loop).split(',').forEach(id => nodes.add(id))
|
|
113
|
+
const edges = new Set(st.edges ? st.edges.map(String)
|
|
114
|
+
: g.edges.filter(e => nodes.has(String(e.src)) && nodes.has(String(e.tgt))).map(e => String(e.id)))
|
|
115
|
+
return { nodes, edges }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Zoom the saved SVG towards what a step lights, so a narrow wiki column can
|
|
119
|
+
// still read it. Never closer than 2.5×, and the faded rest stays around it.
|
|
120
|
+
// els === null: back to the whole drawing.
|
|
121
|
+
function walkZoom(svg, els) {
|
|
122
|
+
if (!svg.__fullViewBox) svg.__fullViewBox = svg.getAttribute('viewBox') || ('0 0 ' + (svg.getAttribute('width') || 1000) + ' ' + (svg.getAttribute('height') || 600))
|
|
123
|
+
const full = svg.__fullViewBox.split(/[\s,]+/).map(Number)
|
|
124
|
+
let to = full
|
|
125
|
+
if (els && els.length) {
|
|
126
|
+
const inv = svg.getScreenCTM() && svg.getScreenCTM().inverse()
|
|
127
|
+
let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity
|
|
128
|
+
els.forEach(el => {
|
|
129
|
+
const r = el.getBoundingClientRect()
|
|
130
|
+
if (!inv || !r.width) return
|
|
131
|
+
;[[r.left, r.top], [r.right, r.bottom]].forEach(([x, y]) => {
|
|
132
|
+
const pt = svg.createSVGPoint(); pt.x = x; pt.y = y
|
|
133
|
+
const q = pt.matrixTransform(inv)
|
|
134
|
+
x0 = Math.min(x0, q.x); y0 = Math.min(y0, q.y); x1 = Math.max(x1, q.x); y1 = Math.max(y1, q.y)
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
if (isFinite(x0)) {
|
|
138
|
+
const pad = 40, aspect = full[3] / full[2]
|
|
139
|
+
let w = Math.max(x1 - x0 + 2 * pad, full[2] / 2.5), h = Math.max(y1 - y0 + 2 * pad, full[3] / 2.5)
|
|
140
|
+
if (h / w > aspect) w = h / aspect; else h = w * aspect
|
|
141
|
+
w = Math.min(w, full[2]); h = Math.min(h, full[3])
|
|
142
|
+
let x = (x0 + x1) / 2 - w / 2, y = (y0 + y1) / 2 - h / 2
|
|
143
|
+
x = Math.max(full[0], Math.min(full[0] + full[2] - w, x)); y = Math.max(full[1], Math.min(full[1] + full[3] - h, y))
|
|
144
|
+
to = [x, y, w, h]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const from = (svg.getAttribute('viewBox') || svg.__fullViewBox).split(/[\s,]+/).map(Number)
|
|
148
|
+
const t0 = performance.now(), dur = 600, id = (svg.__zoomId = (svg.__zoomId || 0) + 1)
|
|
149
|
+
const tick = now => {
|
|
150
|
+
if (svg.__zoomId !== id) return
|
|
151
|
+
const k = Math.min(1, (now - t0) / dur), e = k < 0.5 ? 2 * k * k : 1 - Math.pow(-2 * k + 2, 2) / 2
|
|
152
|
+
svg.setAttribute('viewBox', from.map((v, j) => v + (to[j] - v) * e).join(' '))
|
|
153
|
+
if (k < 1) requestAnimationFrame(tick)
|
|
154
|
+
}
|
|
155
|
+
requestAnimationFrame(tick)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// i === null: no walk, everything back to normal.
|
|
159
|
+
function showWalkStep($item, g, walk, i) {
|
|
160
|
+
const svg = $item.find('svg').get(0)
|
|
161
|
+
if (!svg) return
|
|
162
|
+
svg.querySelectorAll('.rcn-walk-ring').forEach(el => el.remove())
|
|
163
|
+
$item.find('.graph-box').css('max-height', i === null ? '280px' : 'none')
|
|
164
|
+
if (i === null) {
|
|
165
|
+
g.nodes.forEach(n => { const el = groupFor(svg, 'node', n.id); if (el) el.style.opacity = '' })
|
|
166
|
+
g.edges.forEach(e => { const el = groupFor(svg, 'edge', e.id); if (el) el.style.opacity = '' })
|
|
167
|
+
walkZoom(svg, null)
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
const seen = { nodes: new Set(), edges: new Set() }
|
|
171
|
+
walk.steps.slice(0, i).forEach(st => {
|
|
172
|
+
const L = stepLit(g, st)
|
|
173
|
+
if (L) { L.nodes.forEach(id => seen.nodes.add(id)); L.edges.forEach(id => seen.edges.add(id)) }
|
|
174
|
+
})
|
|
175
|
+
const lit = stepLit(g, walk.steps[i])
|
|
176
|
+
const op = (kind, id) => !lit || lit[kind].has(id) ? '1' : seen[kind].has(id) ? String(WALK_SEEN) : String(WALK_GHOST)
|
|
177
|
+
g.nodes.forEach(n => {
|
|
178
|
+
const el = groupFor(svg, 'node', n.id)
|
|
179
|
+
if (!el) return
|
|
180
|
+
el.style.opacity = op('nodes', String(n.id))
|
|
181
|
+
// A ring on what this step brings in for the first time.
|
|
182
|
+
if (lit && lit.nodes.has(String(n.id)) && !seen.nodes.has(String(n.id)) && n.w && n.h) {
|
|
183
|
+
const r = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse')
|
|
184
|
+
r.setAttribute('class', 'rcn-walk-ring')
|
|
185
|
+
r.setAttribute('cx', '0'); r.setAttribute('cy', '0')
|
|
186
|
+
r.setAttribute('rx', String(n.w / 2 + 9)); r.setAttribute('ry', String(n.h / 2 + 9))
|
|
187
|
+
r.setAttribute('fill', 'none'); r.setAttribute('stroke', BUILD_COLOR)
|
|
188
|
+
r.setAttribute('stroke-width', '3'); r.setAttribute('opacity', '.8')
|
|
189
|
+
r.setAttribute('pointer-events', 'none')
|
|
190
|
+
el.appendChild(r)
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
g.edges.forEach(e => {
|
|
194
|
+
const el = groupFor(svg, 'edge', e.id)
|
|
195
|
+
if (el) el.style.opacity = op('edges', String(e.id))
|
|
196
|
+
})
|
|
197
|
+
walkZoom(svg, lit ? [...lit.nodes].map(id => groupFor(svg, 'node', id)).filter(Boolean) : null)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Voice and speed are the listener's: kept in this browser, the same keys the Graph Tool uses.
|
|
201
|
+
function walkPrefs() {
|
|
202
|
+
let p = {}
|
|
203
|
+
try { p = JSON.parse(localStorage.getItem('rcnWalkPrefs') || '{}') } catch (e) {}
|
|
204
|
+
let on = true
|
|
205
|
+
try { on = localStorage.getItem('rcnWalkVoice') !== 'off' } catch (e) {}
|
|
206
|
+
return { voice: p.voice || '', rate: (+p.rate >= 0.6 && +p.rate <= 1.4) ? +p.rate : 0.95, on }
|
|
207
|
+
}
|
|
208
|
+
function walkVoice(name) {
|
|
209
|
+
const vs = window.speechSynthesis ? speechSynthesis.getVoices().filter(v => /^en/i.test(v.lang)) : []
|
|
210
|
+
return vs.find(v => v.name === name) || vs.find(v => /Enhanced|Premium|Natural|Neural/i.test(v.name)) ||
|
|
211
|
+
['Samantha', 'Daniel', 'Karen', 'Moira', 'Google UK English Female', 'Google US English', 'Microsoft Aria']
|
|
212
|
+
.map(p => vs.find(v => v.name.indexOf(p) === 0)).find(Boolean) || vs[0] || null
|
|
213
|
+
}
|
|
214
|
+
// Say the words; done() runs once when they have been said. One utterance per
|
|
215
|
+
// sentence, because Chrome stops a long one after about fifteen seconds.
|
|
216
|
+
function walkSay(text, isCurrent, done) {
|
|
217
|
+
const prefs = walkPrefs(), words = (text || '').split(/\s+/).length
|
|
218
|
+
let fired = false
|
|
219
|
+
const after = () => { if (fired || !isCurrent()) return; fired = true; done() }
|
|
220
|
+
setTimeout(after, words * (prefs.on ? 650 : 420) + (prefs.on ? 6000 : 2500)) // if the voice never says it finished
|
|
221
|
+
if (!prefs.on || !window.speechSynthesis || !text) { setTimeout(after, text ? words * 400 + 2000 : 1200); return }
|
|
222
|
+
const v = walkVoice(prefs.voice)
|
|
223
|
+
const parts = text.match(/[^.!?]+[.!?]+["'”’)]*\s*|[^.!?]+$/g) || [text]
|
|
224
|
+
parts.forEach((s, k) => {
|
|
225
|
+
const u = new SpeechSynthesisUtterance(s.trim())
|
|
226
|
+
if (v) { u.voice = v; u.lang = v.lang }
|
|
227
|
+
u.rate = prefs.rate
|
|
228
|
+
if (k === parts.length - 1) u.onend = after
|
|
229
|
+
speechSynthesis.speak(u)
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function walkBar(item) {
|
|
234
|
+
const g = graphModel(item)
|
|
235
|
+
const ws = walkList(g)
|
|
236
|
+
if (!ws.length) return ''
|
|
237
|
+
const b = 'cursor:pointer;color:' + BUILD_COLOR + ';'
|
|
238
|
+
const pick = ws.length > 1
|
|
239
|
+
? `<select class="walk-pick" style="max-width:220px;font-size:12px" title="Which walk">${ws.map((w, i) => `<option value="${i}">${esc(w.name || 'Walk ' + (i + 1))} (${w.steps.length} steps)</option>`).join('')}</select>`
|
|
240
|
+
: `<span style="font-size:12px;color:#475569">${esc(ws[0].name || 'Walk')}</span>`
|
|
241
|
+
return `
|
|
242
|
+
<div class="walk-bar" tabindex="0" title="Hear and see this drawing explained one part at a time. Space plays or pauses, ← → step, Esc stops." style="padding:8px 0 0;outline:none;">
|
|
243
|
+
<div style="display:flex;gap:6px;justify-content:center;align-items:center;flex-wrap:wrap">
|
|
244
|
+
<button class="walk-start" style="${b}font-weight:600">▶ Walk</button>
|
|
245
|
+
${pick}
|
|
246
|
+
<button class="walk-prev" style="${b}display:none" title="Back a step (←)">◀</button>
|
|
247
|
+
<button class="walk-play" style="${b}display:none" title="Play or pause (Space)">❚❚</button>
|
|
248
|
+
<button class="walk-next" style="${b}display:none" title="Next step (→)">▶</button>
|
|
249
|
+
<span class="walk-count" style="display:none;font-size:12px;color:#64748b;min-width:70px;text-align:center"></span>
|
|
250
|
+
<button class="walk-voice" style="${b}display:none" title="Read the words aloud, or show them only"></button>
|
|
251
|
+
<button class="walk-close" style="${b}display:none" title="Stop the walk (Esc)">■ Stop</button>
|
|
252
|
+
</div>
|
|
253
|
+
<div class="walk-say" aria-live="polite" style="display:none;margin:8px 4px 0;padding:10px 12px;background:#fff;border:1px solid #c7d2fe;border-radius:8px;font-size:17px;line-height:1.45;color:#1e1b4b"></div>
|
|
254
|
+
<div class="walk-note" style="font-size:11px;color:#64748b;text-align:center;margin-top:3px"></div>
|
|
255
|
+
</div>`
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function esc(s) { return String(s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])) }
|
|
259
|
+
|
|
14
260
|
function renderContent($item, item) {
|
|
15
261
|
$item.empty()
|
|
16
262
|
if (item.svgString) {
|
|
17
263
|
$item.append(`
|
|
18
264
|
<div style="background:#f5f5f5;padding:8px;">
|
|
19
|
-
<div style="overflow:auto;max-height:280px;border:1px solid #ddd;background:#fff;">
|
|
265
|
+
<div class="graph-box" style="overflow:auto;max-height:280px;border:1px solid #ddd;background:#fff;">
|
|
20
266
|
${item.svgString}
|
|
21
267
|
</div>
|
|
22
268
|
<div style="padding:6px 0 0;display:flex;gap:6px;justify-content:center;">
|
|
23
269
|
<button class="edit-graph" style="cursor:pointer;">Edit in Graph Tool ↗</button>
|
|
24
270
|
</div>
|
|
271
|
+
${buildBar(item)}
|
|
272
|
+
${walkBar(item)}
|
|
25
273
|
</div>
|
|
26
274
|
`)
|
|
27
275
|
} else {
|
|
@@ -35,6 +283,20 @@
|
|
|
35
283
|
}
|
|
36
284
|
}
|
|
37
285
|
|
|
286
|
+
function buildBar(item) {
|
|
287
|
+
const g = graphModel(item)
|
|
288
|
+
const n = g ? buildSteps(g).length : 0
|
|
289
|
+
if (!n) return ''
|
|
290
|
+
const b = 'cursor:pointer;color:' + BUILD_COLOR + ';'
|
|
291
|
+
return `
|
|
292
|
+
<div class="build-bar" tabindex="0" title="This diagram has a build: it can be revealed node by node. ← → step through it." style="padding:6px 0 0;display:flex;gap:6px;justify-content:center;align-items:center;outline:none;">
|
|
293
|
+
<button class="build-prev" style="${b}display:none" title="Back one step (←)">◀</button>
|
|
294
|
+
<button class="build-play" style="${b}">▶ Play build</button>
|
|
295
|
+
<button class="build-next" style="${b}display:none" title="Next step (→)">▶</button>
|
|
296
|
+
<span class="build-count" style="display:none;font-size:12px;color:#64748b;min-width:70px;text-align:center"></span>
|
|
297
|
+
</div>`
|
|
298
|
+
}
|
|
299
|
+
|
|
38
300
|
function emit($item, item) {
|
|
39
301
|
renderContent($item, item)
|
|
40
302
|
}
|
|
@@ -76,7 +338,126 @@
|
|
|
76
338
|
const popup = window.open(GRAPH_URL, WINDOW_NAME, 'popup,height=820,width=1440')
|
|
77
339
|
if (popup) popup.focus()
|
|
78
340
|
})
|
|
79
|
-
$item.on('dblclick',
|
|
341
|
+
$item.on('dblclick', e => {
|
|
342
|
+
// Stepping a build or a walk is quick clicking — never let it open the editor.
|
|
343
|
+
if ($(e.target).closest('.build-bar, .walk-bar').length) return
|
|
344
|
+
wiki.textEditor($item, item)
|
|
345
|
+
})
|
|
346
|
+
// Build playback. Namespaced and reset, because a save re-runs bind.
|
|
347
|
+
let buildIdx = null
|
|
348
|
+
const step = d => {
|
|
349
|
+
const g = graphModel(item)
|
|
350
|
+
if (!g) return
|
|
351
|
+
const n = buildSteps(g).length
|
|
352
|
+
buildIdx = buildIdx === null ? (d < 0 ? n : 1) : Math.max(0, Math.min(n, buildIdx + d))
|
|
353
|
+
showBuildStep($item, g, buildIdx)
|
|
354
|
+
}
|
|
355
|
+
$item.off('.rcnbuild')
|
|
356
|
+
$item.on('click.rcnbuild', '.build-play', () => {
|
|
357
|
+
const g = graphModel(item)
|
|
358
|
+
if (!g) return
|
|
359
|
+
if (wk.w !== null) walkEnd()
|
|
360
|
+
buildIdx = buildIdx === null ? 1 : null
|
|
361
|
+
showBuildStep($item, g, buildIdx)
|
|
362
|
+
$item.find('.build-bar').trigger('focus')
|
|
363
|
+
})
|
|
364
|
+
$item.on('click.rcnbuild', '.build-prev', () => step(-1))
|
|
365
|
+
$item.on('click.rcnbuild', '.build-next', () => step(1))
|
|
366
|
+
$item.on('keydown.rcnbuild', '.build-bar', e => {
|
|
367
|
+
if (buildIdx === null) return
|
|
368
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowDown' || e.key === ' ') { e.preventDefault(); e.stopPropagation(); step(1) }
|
|
369
|
+
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') { e.preventDefault(); e.stopPropagation(); step(-1) }
|
|
370
|
+
else if (e.key === 'Escape') { e.preventDefault(); buildIdx = null; showBuildStep($item, graphModel(item), null) }
|
|
371
|
+
})
|
|
372
|
+
// Walk playback. w === null: no walk open. token guards every voice callback,
|
|
373
|
+
// so a step that was skipped or stopped can never move the walk on.
|
|
374
|
+
const wk = { w: null, i: 0, playing: false, token: 0, heard: null }
|
|
375
|
+
const curWalk = () => { const g = graphModel(item); return g && wk.w !== null ? walkList(g)[wk.w] : null }
|
|
376
|
+
const stopVoice = () => { wk.token++; try { if (window.speechSynthesis) speechSynthesis.cancel() } catch (e) {} }
|
|
377
|
+
const walkUI = note => {
|
|
378
|
+
const walk = curWalk(), open = !!walk
|
|
379
|
+
if (note) wk.heard = wk.i; else if (wk.playing) wk.heard = null
|
|
380
|
+
const $bar = $item.find('.walk-bar')
|
|
381
|
+
$bar.find('.walk-prev, .walk-next, .walk-play, .walk-count, .walk-voice, .walk-close').toggle(open)
|
|
382
|
+
$bar.find('.walk-start, .walk-pick').toggle(!open)
|
|
383
|
+
$bar.find('.walk-say').toggle(open)
|
|
384
|
+
$bar.find('.walk-play').text(wk.playing ? '❚❚' : '▶')
|
|
385
|
+
$bar.find('.walk-voice').text(walkPrefs().on ? '🔈 Voice on' : '🔇 Voice off')
|
|
386
|
+
$bar.find('.walk-count').text(open ? 'Step ' + (wk.i + 1) + ' of ' + walk.steps.length : '')
|
|
387
|
+
$bar.find('.walk-note').text(note || (open && !wk.playing ? 'Space plays · ← → step · Esc stops' : ''))
|
|
388
|
+
}
|
|
389
|
+
const walkShow = i => {
|
|
390
|
+
const g = graphModel(item), walk = curWalk()
|
|
391
|
+
if (!walk) return
|
|
392
|
+
wk.i = Math.max(0, Math.min(walk.steps.length - 1, i))
|
|
393
|
+
stopVoice()
|
|
394
|
+
showWalkStep($item, g, walk, wk.i)
|
|
395
|
+
const st = walk.steps[wk.i]
|
|
396
|
+
$item.find('.walk-say').text(st.say || '').css({ color: st.ask ? '#7c2d12' : '#1e1b4b', fontStyle: st.ask ? 'italic' : 'normal' })
|
|
397
|
+
walkUI()
|
|
398
|
+
if (wk.playing) walkSpeak()
|
|
399
|
+
}
|
|
400
|
+
const walkSpeak = () => {
|
|
401
|
+
const tok = ++wk.token, walk = curWalk(), st = walk && walk.steps[wk.i]
|
|
402
|
+
if (!st) return
|
|
403
|
+
walkSay(st.say, () => tok === wk.token && activeWalk === wk, () => {
|
|
404
|
+
const last = wk.i >= walk.steps.length - 1
|
|
405
|
+
if (st.ask || last) { wk.playing = false; walkUI(last && !st.ask ? 'End of the walk. ← to go back, Esc to stop.' : 'Over to you. Press Space or ▶ to go on.'); return }
|
|
406
|
+
setTimeout(() => { if (tok === wk.token && wk.playing) walkShow(wk.i + 1) }, 800)
|
|
407
|
+
})
|
|
408
|
+
}
|
|
409
|
+
const walkPause = () => { wk.playing = false; stopVoice(); walkUI() }
|
|
410
|
+
const walkToggle = () => {
|
|
411
|
+
if (wk.w === null) return
|
|
412
|
+
if (wk.playing) { walkPause(); return }
|
|
413
|
+
if (activeWalk && activeWalk !== wk && activeWalk.end) activeWalk.end()
|
|
414
|
+
activeWalk = wk
|
|
415
|
+
wk.playing = true
|
|
416
|
+
// Play after a step already heard (an ask step, say) goes on to the next.
|
|
417
|
+
if (wk.heard === wk.i && wk.i < curWalk().steps.length - 1) { walkShow(wk.i + 1); return }
|
|
418
|
+
walkUI(); walkSpeak()
|
|
419
|
+
}
|
|
420
|
+
const walkEnd = () => {
|
|
421
|
+
if (wk.w === null) return
|
|
422
|
+
wk.playing = false; stopVoice()
|
|
423
|
+
const g = graphModel(item)
|
|
424
|
+
if (g) showWalkStep($item, g, null, null)
|
|
425
|
+
wk.w = null
|
|
426
|
+
if (activeWalk === wk) activeWalk = null
|
|
427
|
+
walkUI()
|
|
428
|
+
}
|
|
429
|
+
wk.end = walkEnd
|
|
430
|
+
$item.off('.rcnwalk')
|
|
431
|
+
$item.on('click.rcnwalk', '.walk-start', () => {
|
|
432
|
+
const g = graphModel(item)
|
|
433
|
+
if (!g) return
|
|
434
|
+
if (buildIdx !== null) { buildIdx = null; showBuildStep($item, g, null) }
|
|
435
|
+
wk.w = +($item.find('.walk-pick').val() || 0)
|
|
436
|
+
wk.heard = null
|
|
437
|
+
walkShow(0)
|
|
438
|
+
walkToggle() // a click is a user gesture, so the browser will speak
|
|
439
|
+
$item.find('.walk-bar').trigger('focus')
|
|
440
|
+
})
|
|
441
|
+
$item.on('click.rcnwalk', '.walk-play', () => walkToggle())
|
|
442
|
+
$item.on('click.rcnwalk', '.walk-prev', () => walkShow(wk.i - 1))
|
|
443
|
+
$item.on('click.rcnwalk', '.walk-next', () => walkShow(wk.i + 1))
|
|
444
|
+
$item.on('click.rcnwalk', '.walk-close', () => walkEnd())
|
|
445
|
+
$item.on('click.rcnwalk', '.walk-voice', () => {
|
|
446
|
+
const on = !walkPrefs().on
|
|
447
|
+
try { localStorage.setItem('rcnWalkVoice', on ? 'on' : 'off') } catch (e) {}
|
|
448
|
+
if (!on) stopVoice()
|
|
449
|
+
if (wk.playing) walkSpeak()
|
|
450
|
+
walkUI()
|
|
451
|
+
})
|
|
452
|
+
// Clicking the drawing to look closer pauses the voice.
|
|
453
|
+
$item.on('pointerdown.rcnwalk', '.graph-box', () => { if (wk.playing) walkPause() })
|
|
454
|
+
$item.on('keydown.rcnwalk', '.walk-bar', e => {
|
|
455
|
+
if (wk.w === null || $(e.target).is('select')) return
|
|
456
|
+
if (e.key === ' ') { e.preventDefault(); e.stopPropagation(); walkToggle() }
|
|
457
|
+
else if (e.key === 'ArrowRight') { e.preventDefault(); e.stopPropagation(); walkShow(wk.i + 1) }
|
|
458
|
+
else if (e.key === 'ArrowLeft') { e.preventDefault(); e.stopPropagation(); walkShow(wk.i - 1) }
|
|
459
|
+
else if (e.key === 'Escape') { e.preventDefault(); walkEnd() }
|
|
460
|
+
})
|
|
80
461
|
// Labels in the saved SVG are wrapped as <a class="internal" data-title=…>, but
|
|
81
462
|
// two things stopped a click reaching the page: the <text> keeps the canvas's
|
|
82
463
|
// pointer-events="none", so the click fell through to the box behind it; and
|
package/client/rcngraph.js
CHANGED
|
@@ -13,17 +13,265 @@
|
|
|
13
13
|
let pendingItem = null
|
|
14
14
|
let pending$item = null
|
|
15
15
|
|
|
16
|
+
// ── Build playback ─────────────────────────────────────────────────────
|
|
17
|
+
// The Graph Tool's Build mode gives nodes a step number (n.build); an edge
|
|
18
|
+
// shows once both its nodes do. The saved SVG keeps the tool's <g id="node-ID">
|
|
19
|
+
// and <g id="edge-ID"> groups, so playing a build here is only hiding and
|
|
20
|
+
// showing those groups — no redraw, no Graph Tool needed.
|
|
21
|
+
const BUILD_COLOR = '#4f46e5'
|
|
22
|
+
|
|
23
|
+
function graphModel(item) {
|
|
24
|
+
let g = item.graphJSON
|
|
25
|
+
if (typeof g === 'string') { try { g = JSON.parse(g) } catch (e) { return null } }
|
|
26
|
+
return g && Array.isArray(g.nodes) && Array.isArray(g.edges) ? g : null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function buildSteps(g) {
|
|
30
|
+
const s = new Set()
|
|
31
|
+
g.nodes.forEach(n => { if (n.build > 0) s.add(n.build) })
|
|
32
|
+
return [...s].sort((a, b) => a - b)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function groupFor(svg, kind, id) {
|
|
36
|
+
return svg.querySelector('#' + CSS.escape(kind + '-' + id))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// idx === null: not playing, everything shows. 0: nothing of the build yet.
|
|
40
|
+
function showBuildStep($item, g, idx) {
|
|
41
|
+
const svg = $item.find('svg').get(0)
|
|
42
|
+
if (!svg) return
|
|
43
|
+
const steps = buildSteps(g)
|
|
44
|
+
const thr = idx > 0 ? steps[idx - 1] : 0
|
|
45
|
+
const hideOthers = g.buildOthers === 'hide'
|
|
46
|
+
const byId = {}
|
|
47
|
+
g.nodes.forEach(n => { byId[n.id] = n })
|
|
48
|
+
const arrives = n => (n && n.build > 0 ? n.build : 0)
|
|
49
|
+
const shown = n => {
|
|
50
|
+
if (idx === null || !n) return true
|
|
51
|
+
return n.build > 0 ? n.build <= thr : !hideOthers
|
|
52
|
+
}
|
|
53
|
+
svg.querySelectorAll('.rcn-build-ring').forEach(el => el.remove())
|
|
54
|
+
g.nodes.forEach(n => {
|
|
55
|
+
const el = groupFor(svg, 'node', n.id)
|
|
56
|
+
if (!el) return
|
|
57
|
+
el.style.display = shown(n) ? '' : 'none'
|
|
58
|
+
if (idx > 0 && n.build === thr && n.w && n.h) {
|
|
59
|
+
const r = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse')
|
|
60
|
+
r.setAttribute('class', 'rcn-build-ring')
|
|
61
|
+
r.setAttribute('cx', '0'); r.setAttribute('cy', '0')
|
|
62
|
+
r.setAttribute('rx', String(n.w / 2 + 9)); r.setAttribute('ry', String(n.h / 2 + 9))
|
|
63
|
+
r.setAttribute('fill', 'none'); r.setAttribute('stroke', BUILD_COLOR)
|
|
64
|
+
r.setAttribute('stroke-width', '3'); r.setAttribute('opacity', '.9')
|
|
65
|
+
r.setAttribute('pointer-events', 'none')
|
|
66
|
+
el.appendChild(r)
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
g.edges.forEach(e => {
|
|
70
|
+
const el = groupFor(svg, 'edge', e.id)
|
|
71
|
+
if (!el) return
|
|
72
|
+
const s = byId[e.src], t = byId[e.tgt]
|
|
73
|
+
const on = shown(s) && shown(t)
|
|
74
|
+
el.style.display = on ? '' : 'none'
|
|
75
|
+
// The edge that arrived with this step: recolour its visible line, remember
|
|
76
|
+
// the original so the next step can put it back.
|
|
77
|
+
const isNew = on && idx > 0 && Math.max(arrives(s), arrives(t)) === thr
|
|
78
|
+
el.querySelectorAll('path').forEach(p => {
|
|
79
|
+
const st = p.getAttribute('stroke')
|
|
80
|
+
if (!st || st === 'transparent' || st === 'none') return
|
|
81
|
+
if (isNew) {
|
|
82
|
+
if (!p.hasAttribute('data-build-stroke')) p.setAttribute('data-build-stroke', st)
|
|
83
|
+
p.setAttribute('stroke', BUILD_COLOR)
|
|
84
|
+
} else if (p.hasAttribute('data-build-stroke')) {
|
|
85
|
+
p.setAttribute('stroke', p.getAttribute('data-build-stroke'))
|
|
86
|
+
p.removeAttribute('data-build-stroke')
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
const bar = $item.find('.build-bar')
|
|
91
|
+
bar.find('.build-count').text(idx === null ? '' : 'Step ' + idx + ' / ' + steps.length).toggle(idx !== null)
|
|
92
|
+
bar.find('.build-play').text(idx === null ? '▶ Play build' : '■ Show all')
|
|
93
|
+
bar.find('.build-prev, .build-next').toggle(idx !== null)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ── Walk playback ──────────────────────────────────────────────────────
|
|
97
|
+
// A walk, written in the Graph Tool, is a list of steps: words to say, and
|
|
98
|
+
// what each step lights. The tool saves each step's lit node and edge ids, so
|
|
99
|
+
// playing it here is setting the opacity of the saved SVG's groups and
|
|
100
|
+
// speaking the words with the browser's own voice, shown as a caption too.
|
|
101
|
+
const WALK_GHOST = 0.13, WALK_SEEN = 0.42
|
|
102
|
+
let activeWalk = null // one walk speaks at a time on the whole lineup
|
|
103
|
+
|
|
104
|
+
function walkList(g) {
|
|
105
|
+
return g && Array.isArray(g.walks) ? g.walks.filter(w => w && Array.isArray(w.steps) && w.steps.length) : []
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// null = the whole drawing. Files saved before lit existed fall back to the
|
|
109
|
+
// step's own nodes and the edges among them.
|
|
110
|
+
function stepLit(g, st) {
|
|
111
|
+
if (!st || st.all) return null
|
|
112
|
+
if (st.lit) return { nodes: new Set(st.lit.nodes.map(String)), edges: new Set(st.lit.edges.map(String)) }
|
|
113
|
+
const nodes = new Set((st.nodes || []).map(String))
|
|
114
|
+
if (st.loop) String(st.loop).split(',').forEach(id => nodes.add(id))
|
|
115
|
+
const edges = new Set(st.edges ? st.edges.map(String)
|
|
116
|
+
: g.edges.filter(e => nodes.has(String(e.src)) && nodes.has(String(e.tgt))).map(e => String(e.id)))
|
|
117
|
+
return { nodes, edges }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Zoom the saved SVG towards what a step lights, so a narrow wiki column can
|
|
121
|
+
// still read it. Never closer than 2.5×, and the faded rest stays around it.
|
|
122
|
+
// els === null: back to the whole drawing.
|
|
123
|
+
function walkZoom(svg, els) {
|
|
124
|
+
if (!svg.__fullViewBox) svg.__fullViewBox = svg.getAttribute('viewBox') || ('0 0 ' + (svg.getAttribute('width') || 1000) + ' ' + (svg.getAttribute('height') || 600))
|
|
125
|
+
const full = svg.__fullViewBox.split(/[\s,]+/).map(Number)
|
|
126
|
+
let to = full
|
|
127
|
+
if (els && els.length) {
|
|
128
|
+
const inv = svg.getScreenCTM() && svg.getScreenCTM().inverse()
|
|
129
|
+
let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity
|
|
130
|
+
els.forEach(el => {
|
|
131
|
+
const r = el.getBoundingClientRect()
|
|
132
|
+
if (!inv || !r.width) return
|
|
133
|
+
;[[r.left, r.top], [r.right, r.bottom]].forEach(([x, y]) => {
|
|
134
|
+
const pt = svg.createSVGPoint(); pt.x = x; pt.y = y
|
|
135
|
+
const q = pt.matrixTransform(inv)
|
|
136
|
+
x0 = Math.min(x0, q.x); y0 = Math.min(y0, q.y); x1 = Math.max(x1, q.x); y1 = Math.max(y1, q.y)
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
if (isFinite(x0)) {
|
|
140
|
+
const pad = 40, aspect = full[3] / full[2]
|
|
141
|
+
let w = Math.max(x1 - x0 + 2 * pad, full[2] / 2.5), h = Math.max(y1 - y0 + 2 * pad, full[3] / 2.5)
|
|
142
|
+
if (h / w > aspect) w = h / aspect; else h = w * aspect
|
|
143
|
+
w = Math.min(w, full[2]); h = Math.min(h, full[3])
|
|
144
|
+
let x = (x0 + x1) / 2 - w / 2, y = (y0 + y1) / 2 - h / 2
|
|
145
|
+
x = Math.max(full[0], Math.min(full[0] + full[2] - w, x)); y = Math.max(full[1], Math.min(full[1] + full[3] - h, y))
|
|
146
|
+
to = [x, y, w, h]
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const from = (svg.getAttribute('viewBox') || svg.__fullViewBox).split(/[\s,]+/).map(Number)
|
|
150
|
+
const t0 = performance.now(), dur = 600, id = (svg.__zoomId = (svg.__zoomId || 0) + 1)
|
|
151
|
+
const tick = now => {
|
|
152
|
+
if (svg.__zoomId !== id) return
|
|
153
|
+
const k = Math.min(1, (now - t0) / dur), e = k < 0.5 ? 2 * k * k : 1 - Math.pow(-2 * k + 2, 2) / 2
|
|
154
|
+
svg.setAttribute('viewBox', from.map((v, j) => v + (to[j] - v) * e).join(' '))
|
|
155
|
+
if (k < 1) requestAnimationFrame(tick)
|
|
156
|
+
}
|
|
157
|
+
requestAnimationFrame(tick)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// i === null: no walk, everything back to normal.
|
|
161
|
+
function showWalkStep($item, g, walk, i) {
|
|
162
|
+
const svg = $item.find('svg').get(0)
|
|
163
|
+
if (!svg) return
|
|
164
|
+
svg.querySelectorAll('.rcn-walk-ring').forEach(el => el.remove())
|
|
165
|
+
$item.find('.graph-box').css('max-height', i === null ? '280px' : 'none')
|
|
166
|
+
if (i === null) {
|
|
167
|
+
g.nodes.forEach(n => { const el = groupFor(svg, 'node', n.id); if (el) el.style.opacity = '' })
|
|
168
|
+
g.edges.forEach(e => { const el = groupFor(svg, 'edge', e.id); if (el) el.style.opacity = '' })
|
|
169
|
+
walkZoom(svg, null)
|
|
170
|
+
return
|
|
171
|
+
}
|
|
172
|
+
const seen = { nodes: new Set(), edges: new Set() }
|
|
173
|
+
walk.steps.slice(0, i).forEach(st => {
|
|
174
|
+
const L = stepLit(g, st)
|
|
175
|
+
if (L) { L.nodes.forEach(id => seen.nodes.add(id)); L.edges.forEach(id => seen.edges.add(id)) }
|
|
176
|
+
})
|
|
177
|
+
const lit = stepLit(g, walk.steps[i])
|
|
178
|
+
const op = (kind, id) => !lit || lit[kind].has(id) ? '1' : seen[kind].has(id) ? String(WALK_SEEN) : String(WALK_GHOST)
|
|
179
|
+
g.nodes.forEach(n => {
|
|
180
|
+
const el = groupFor(svg, 'node', n.id)
|
|
181
|
+
if (!el) return
|
|
182
|
+
el.style.opacity = op('nodes', String(n.id))
|
|
183
|
+
// A ring on what this step brings in for the first time.
|
|
184
|
+
if (lit && lit.nodes.has(String(n.id)) && !seen.nodes.has(String(n.id)) && n.w && n.h) {
|
|
185
|
+
const r = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse')
|
|
186
|
+
r.setAttribute('class', 'rcn-walk-ring')
|
|
187
|
+
r.setAttribute('cx', '0'); r.setAttribute('cy', '0')
|
|
188
|
+
r.setAttribute('rx', String(n.w / 2 + 9)); r.setAttribute('ry', String(n.h / 2 + 9))
|
|
189
|
+
r.setAttribute('fill', 'none'); r.setAttribute('stroke', BUILD_COLOR)
|
|
190
|
+
r.setAttribute('stroke-width', '3'); r.setAttribute('opacity', '.8')
|
|
191
|
+
r.setAttribute('pointer-events', 'none')
|
|
192
|
+
el.appendChild(r)
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
g.edges.forEach(e => {
|
|
196
|
+
const el = groupFor(svg, 'edge', e.id)
|
|
197
|
+
if (el) el.style.opacity = op('edges', String(e.id))
|
|
198
|
+
})
|
|
199
|
+
walkZoom(svg, lit ? [...lit.nodes].map(id => groupFor(svg, 'node', id)).filter(Boolean) : null)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Voice and speed are the listener's: kept in this browser, the same keys the Graph Tool uses.
|
|
203
|
+
function walkPrefs() {
|
|
204
|
+
let p = {}
|
|
205
|
+
try { p = JSON.parse(localStorage.getItem('rcnWalkPrefs') || '{}') } catch (e) {}
|
|
206
|
+
let on = true
|
|
207
|
+
try { on = localStorage.getItem('rcnWalkVoice') !== 'off' } catch (e) {}
|
|
208
|
+
return { voice: p.voice || '', rate: (+p.rate >= 0.6 && +p.rate <= 1.4) ? +p.rate : 0.95, on }
|
|
209
|
+
}
|
|
210
|
+
function walkVoice(name) {
|
|
211
|
+
const vs = window.speechSynthesis ? speechSynthesis.getVoices().filter(v => /^en/i.test(v.lang)) : []
|
|
212
|
+
return vs.find(v => v.name === name) || vs.find(v => /Enhanced|Premium|Natural|Neural/i.test(v.name)) ||
|
|
213
|
+
['Samantha', 'Daniel', 'Karen', 'Moira', 'Google UK English Female', 'Google US English', 'Microsoft Aria']
|
|
214
|
+
.map(p => vs.find(v => v.name.indexOf(p) === 0)).find(Boolean) || vs[0] || null
|
|
215
|
+
}
|
|
216
|
+
// Say the words; done() runs once when they have been said. One utterance per
|
|
217
|
+
// sentence, because Chrome stops a long one after about fifteen seconds.
|
|
218
|
+
function walkSay(text, isCurrent, done) {
|
|
219
|
+
const prefs = walkPrefs(), words = (text || '').split(/\s+/).length
|
|
220
|
+
let fired = false
|
|
221
|
+
const after = () => { if (fired || !isCurrent()) return; fired = true; done() }
|
|
222
|
+
setTimeout(after, words * (prefs.on ? 650 : 420) + (prefs.on ? 6000 : 2500)) // if the voice never says it finished
|
|
223
|
+
if (!prefs.on || !window.speechSynthesis || !text) { setTimeout(after, text ? words * 400 + 2000 : 1200); return }
|
|
224
|
+
const v = walkVoice(prefs.voice)
|
|
225
|
+
const parts = text.match(/[^.!?]+[.!?]+["'”’)]*\s*|[^.!?]+$/g) || [text]
|
|
226
|
+
parts.forEach((s, k) => {
|
|
227
|
+
const u = new SpeechSynthesisUtterance(s.trim())
|
|
228
|
+
if (v) { u.voice = v; u.lang = v.lang }
|
|
229
|
+
u.rate = prefs.rate
|
|
230
|
+
if (k === parts.length - 1) u.onend = after
|
|
231
|
+
speechSynthesis.speak(u)
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function walkBar(item) {
|
|
236
|
+
const g = graphModel(item)
|
|
237
|
+
const ws = walkList(g)
|
|
238
|
+
if (!ws.length) return ''
|
|
239
|
+
const b = 'cursor:pointer;color:' + BUILD_COLOR + ';'
|
|
240
|
+
const pick = ws.length > 1
|
|
241
|
+
? `<select class="walk-pick" style="max-width:220px;font-size:12px" title="Which walk">${ws.map((w, i) => `<option value="${i}">${esc(w.name || 'Walk ' + (i + 1))} (${w.steps.length} steps)</option>`).join('')}</select>`
|
|
242
|
+
: `<span style="font-size:12px;color:#475569">${esc(ws[0].name || 'Walk')}</span>`
|
|
243
|
+
return `
|
|
244
|
+
<div class="walk-bar" tabindex="0" title="Hear and see this drawing explained one part at a time. Space plays or pauses, ← → step, Esc stops." style="padding:8px 0 0;outline:none;">
|
|
245
|
+
<div style="display:flex;gap:6px;justify-content:center;align-items:center;flex-wrap:wrap">
|
|
246
|
+
<button class="walk-start" style="${b}font-weight:600">▶ Walk</button>
|
|
247
|
+
${pick}
|
|
248
|
+
<button class="walk-prev" style="${b}display:none" title="Back a step (←)">◀</button>
|
|
249
|
+
<button class="walk-play" style="${b}display:none" title="Play or pause (Space)">❚❚</button>
|
|
250
|
+
<button class="walk-next" style="${b}display:none" title="Next step (→)">▶</button>
|
|
251
|
+
<span class="walk-count" style="display:none;font-size:12px;color:#64748b;min-width:70px;text-align:center"></span>
|
|
252
|
+
<button class="walk-voice" style="${b}display:none" title="Read the words aloud, or show them only"></button>
|
|
253
|
+
<button class="walk-close" style="${b}display:none" title="Stop the walk (Esc)">■ Stop</button>
|
|
254
|
+
</div>
|
|
255
|
+
<div class="walk-say" aria-live="polite" style="display:none;margin:8px 4px 0;padding:10px 12px;background:#fff;border:1px solid #c7d2fe;border-radius:8px;font-size:17px;line-height:1.45;color:#1e1b4b"></div>
|
|
256
|
+
<div class="walk-note" style="font-size:11px;color:#64748b;text-align:center;margin-top:3px"></div>
|
|
257
|
+
</div>`
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function esc(s) { return String(s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])) }
|
|
261
|
+
|
|
16
262
|
function renderContent($item, item) {
|
|
17
263
|
$item.empty()
|
|
18
264
|
if (item.svgString) {
|
|
19
265
|
$item.append(`
|
|
20
266
|
<div style="background:#f5f5f5;padding:8px;">
|
|
21
|
-
<div style="overflow:auto;max-height:280px;border:1px solid #ddd;background:#fff;">
|
|
267
|
+
<div class="graph-box" style="overflow:auto;max-height:280px;border:1px solid #ddd;background:#fff;">
|
|
22
268
|
${item.svgString}
|
|
23
269
|
</div>
|
|
24
270
|
<div style="padding:6px 0 0;display:flex;gap:6px;justify-content:center;">
|
|
25
271
|
<button class="edit-graph" style="cursor:pointer;">Edit in Graph Tool ↗</button>
|
|
26
272
|
</div>
|
|
273
|
+
${buildBar(item)}
|
|
274
|
+
${walkBar(item)}
|
|
27
275
|
</div>
|
|
28
276
|
`)
|
|
29
277
|
} else {
|
|
@@ -37,6 +285,20 @@
|
|
|
37
285
|
}
|
|
38
286
|
}
|
|
39
287
|
|
|
288
|
+
function buildBar(item) {
|
|
289
|
+
const g = graphModel(item)
|
|
290
|
+
const n = g ? buildSteps(g).length : 0
|
|
291
|
+
if (!n) return ''
|
|
292
|
+
const b = 'cursor:pointer;color:' + BUILD_COLOR + ';'
|
|
293
|
+
return `
|
|
294
|
+
<div class="build-bar" tabindex="0" title="This diagram has a build: it can be revealed node by node. ← → step through it." style="padding:6px 0 0;display:flex;gap:6px;justify-content:center;align-items:center;outline:none;">
|
|
295
|
+
<button class="build-prev" style="${b}display:none" title="Back one step (←)">◀</button>
|
|
296
|
+
<button class="build-play" style="${b}">▶ Play build</button>
|
|
297
|
+
<button class="build-next" style="${b}display:none" title="Next step (→)">▶</button>
|
|
298
|
+
<span class="build-count" style="display:none;font-size:12px;color:#64748b;min-width:70px;text-align:center"></span>
|
|
299
|
+
</div>`
|
|
300
|
+
}
|
|
301
|
+
|
|
40
302
|
function emit($item, item) {
|
|
41
303
|
renderContent($item, item)
|
|
42
304
|
}
|
|
@@ -78,7 +340,126 @@
|
|
|
78
340
|
const popup = window.open(GRAPH_URL, WINDOW_NAME, 'popup,height=820,width=1440')
|
|
79
341
|
if (popup) popup.focus()
|
|
80
342
|
})
|
|
81
|
-
$item.on('dblclick',
|
|
343
|
+
$item.on('dblclick', e => {
|
|
344
|
+
// Stepping a build or a walk is quick clicking — never let it open the editor.
|
|
345
|
+
if ($(e.target).closest('.build-bar, .walk-bar').length) return
|
|
346
|
+
wiki.textEditor($item, item)
|
|
347
|
+
})
|
|
348
|
+
// Build playback. Namespaced and reset, because a save re-runs bind.
|
|
349
|
+
let buildIdx = null
|
|
350
|
+
const step = d => {
|
|
351
|
+
const g = graphModel(item)
|
|
352
|
+
if (!g) return
|
|
353
|
+
const n = buildSteps(g).length
|
|
354
|
+
buildIdx = buildIdx === null ? (d < 0 ? n : 1) : Math.max(0, Math.min(n, buildIdx + d))
|
|
355
|
+
showBuildStep($item, g, buildIdx)
|
|
356
|
+
}
|
|
357
|
+
$item.off('.rcnbuild')
|
|
358
|
+
$item.on('click.rcnbuild', '.build-play', () => {
|
|
359
|
+
const g = graphModel(item)
|
|
360
|
+
if (!g) return
|
|
361
|
+
if (wk.w !== null) walkEnd()
|
|
362
|
+
buildIdx = buildIdx === null ? 1 : null
|
|
363
|
+
showBuildStep($item, g, buildIdx)
|
|
364
|
+
$item.find('.build-bar').trigger('focus')
|
|
365
|
+
})
|
|
366
|
+
$item.on('click.rcnbuild', '.build-prev', () => step(-1))
|
|
367
|
+
$item.on('click.rcnbuild', '.build-next', () => step(1))
|
|
368
|
+
$item.on('keydown.rcnbuild', '.build-bar', e => {
|
|
369
|
+
if (buildIdx === null) return
|
|
370
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowDown' || e.key === ' ') { e.preventDefault(); e.stopPropagation(); step(1) }
|
|
371
|
+
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') { e.preventDefault(); e.stopPropagation(); step(-1) }
|
|
372
|
+
else if (e.key === 'Escape') { e.preventDefault(); buildIdx = null; showBuildStep($item, graphModel(item), null) }
|
|
373
|
+
})
|
|
374
|
+
// Walk playback. w === null: no walk open. token guards every voice callback,
|
|
375
|
+
// so a step that was skipped or stopped can never move the walk on.
|
|
376
|
+
const wk = { w: null, i: 0, playing: false, token: 0, heard: null }
|
|
377
|
+
const curWalk = () => { const g = graphModel(item); return g && wk.w !== null ? walkList(g)[wk.w] : null }
|
|
378
|
+
const stopVoice = () => { wk.token++; try { if (window.speechSynthesis) speechSynthesis.cancel() } catch (e) {} }
|
|
379
|
+
const walkUI = note => {
|
|
380
|
+
const walk = curWalk(), open = !!walk
|
|
381
|
+
if (note) wk.heard = wk.i; else if (wk.playing) wk.heard = null
|
|
382
|
+
const $bar = $item.find('.walk-bar')
|
|
383
|
+
$bar.find('.walk-prev, .walk-next, .walk-play, .walk-count, .walk-voice, .walk-close').toggle(open)
|
|
384
|
+
$bar.find('.walk-start, .walk-pick').toggle(!open)
|
|
385
|
+
$bar.find('.walk-say').toggle(open)
|
|
386
|
+
$bar.find('.walk-play').text(wk.playing ? '❚❚' : '▶')
|
|
387
|
+
$bar.find('.walk-voice').text(walkPrefs().on ? '🔈 Voice on' : '🔇 Voice off')
|
|
388
|
+
$bar.find('.walk-count').text(open ? 'Step ' + (wk.i + 1) + ' of ' + walk.steps.length : '')
|
|
389
|
+
$bar.find('.walk-note').text(note || (open && !wk.playing ? 'Space plays · ← → step · Esc stops' : ''))
|
|
390
|
+
}
|
|
391
|
+
const walkShow = i => {
|
|
392
|
+
const g = graphModel(item), walk = curWalk()
|
|
393
|
+
if (!walk) return
|
|
394
|
+
wk.i = Math.max(0, Math.min(walk.steps.length - 1, i))
|
|
395
|
+
stopVoice()
|
|
396
|
+
showWalkStep($item, g, walk, wk.i)
|
|
397
|
+
const st = walk.steps[wk.i]
|
|
398
|
+
$item.find('.walk-say').text(st.say || '').css({ color: st.ask ? '#7c2d12' : '#1e1b4b', fontStyle: st.ask ? 'italic' : 'normal' })
|
|
399
|
+
walkUI()
|
|
400
|
+
if (wk.playing) walkSpeak()
|
|
401
|
+
}
|
|
402
|
+
const walkSpeak = () => {
|
|
403
|
+
const tok = ++wk.token, walk = curWalk(), st = walk && walk.steps[wk.i]
|
|
404
|
+
if (!st) return
|
|
405
|
+
walkSay(st.say, () => tok === wk.token && activeWalk === wk, () => {
|
|
406
|
+
const last = wk.i >= walk.steps.length - 1
|
|
407
|
+
if (st.ask || last) { wk.playing = false; walkUI(last && !st.ask ? 'End of the walk. ← to go back, Esc to stop.' : 'Over to you. Press Space or ▶ to go on.'); return }
|
|
408
|
+
setTimeout(() => { if (tok === wk.token && wk.playing) walkShow(wk.i + 1) }, 800)
|
|
409
|
+
})
|
|
410
|
+
}
|
|
411
|
+
const walkPause = () => { wk.playing = false; stopVoice(); walkUI() }
|
|
412
|
+
const walkToggle = () => {
|
|
413
|
+
if (wk.w === null) return
|
|
414
|
+
if (wk.playing) { walkPause(); return }
|
|
415
|
+
if (activeWalk && activeWalk !== wk && activeWalk.end) activeWalk.end()
|
|
416
|
+
activeWalk = wk
|
|
417
|
+
wk.playing = true
|
|
418
|
+
// Play after a step already heard (an ask step, say) goes on to the next.
|
|
419
|
+
if (wk.heard === wk.i && wk.i < curWalk().steps.length - 1) { walkShow(wk.i + 1); return }
|
|
420
|
+
walkUI(); walkSpeak()
|
|
421
|
+
}
|
|
422
|
+
const walkEnd = () => {
|
|
423
|
+
if (wk.w === null) return
|
|
424
|
+
wk.playing = false; stopVoice()
|
|
425
|
+
const g = graphModel(item)
|
|
426
|
+
if (g) showWalkStep($item, g, null, null)
|
|
427
|
+
wk.w = null
|
|
428
|
+
if (activeWalk === wk) activeWalk = null
|
|
429
|
+
walkUI()
|
|
430
|
+
}
|
|
431
|
+
wk.end = walkEnd
|
|
432
|
+
$item.off('.rcnwalk')
|
|
433
|
+
$item.on('click.rcnwalk', '.walk-start', () => {
|
|
434
|
+
const g = graphModel(item)
|
|
435
|
+
if (!g) return
|
|
436
|
+
if (buildIdx !== null) { buildIdx = null; showBuildStep($item, g, null) }
|
|
437
|
+
wk.w = +($item.find('.walk-pick').val() || 0)
|
|
438
|
+
wk.heard = null
|
|
439
|
+
walkShow(0)
|
|
440
|
+
walkToggle() // a click is a user gesture, so the browser will speak
|
|
441
|
+
$item.find('.walk-bar').trigger('focus')
|
|
442
|
+
})
|
|
443
|
+
$item.on('click.rcnwalk', '.walk-play', () => walkToggle())
|
|
444
|
+
$item.on('click.rcnwalk', '.walk-prev', () => walkShow(wk.i - 1))
|
|
445
|
+
$item.on('click.rcnwalk', '.walk-next', () => walkShow(wk.i + 1))
|
|
446
|
+
$item.on('click.rcnwalk', '.walk-close', () => walkEnd())
|
|
447
|
+
$item.on('click.rcnwalk', '.walk-voice', () => {
|
|
448
|
+
const on = !walkPrefs().on
|
|
449
|
+
try { localStorage.setItem('rcnWalkVoice', on ? 'on' : 'off') } catch (e) {}
|
|
450
|
+
if (!on) stopVoice()
|
|
451
|
+
if (wk.playing) walkSpeak()
|
|
452
|
+
walkUI()
|
|
453
|
+
})
|
|
454
|
+
// Clicking the drawing to look closer pauses the voice.
|
|
455
|
+
$item.on('pointerdown.rcnwalk', '.graph-box', () => { if (wk.playing) walkPause() })
|
|
456
|
+
$item.on('keydown.rcnwalk', '.walk-bar', e => {
|
|
457
|
+
if (wk.w === null || $(e.target).is('select')) return
|
|
458
|
+
if (e.key === ' ') { e.preventDefault(); e.stopPropagation(); walkToggle() }
|
|
459
|
+
else if (e.key === 'ArrowRight') { e.preventDefault(); e.stopPropagation(); walkShow(wk.i + 1) }
|
|
460
|
+
else if (e.key === 'ArrowLeft') { e.preventDefault(); e.stopPropagation(); walkShow(wk.i - 1) }
|
|
461
|
+
else if (e.key === 'Escape') { e.preventDefault(); walkEnd() }
|
|
462
|
+
})
|
|
82
463
|
// Labels in the saved SVG are wrapped as <a class="internal" data-title=…>, but
|
|
83
464
|
// two things stopped a click reaching the page: the <text> keeps the canvas's
|
|
84
465
|
// pointer-events="none", so the click fell through to the box behind it; and
|
package/package.json
CHANGED
|
@@ -9,17 +9,27 @@
|
|
|
9
9
|
{
|
|
10
10
|
"type": "paragraph",
|
|
11
11
|
"id": "2e7c9f04a3b8d651",
|
|
12
|
-
"text": "Create an item using the factory. Click Open Graph Tool to open the tool. Use -> Item to save the diagram as an SVG preview back into the wiki item
|
|
12
|
+
"text": "Create an item using the factory. Click Open Graph Tool to open the tool. Use -> Item to save the diagram as an SVG preview back into the wiki item — node labels in that preview are clickable internal wiki links, and the graph JSON rides along so Edit in Graph Tool reopens the real model. Use -> Wiki to send the diagram to the lineup as a ghost page. Both follow Ward Cunningham's Enrich Any SVG pattern."
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"type": "paragraph",
|
|
16
16
|
"id": "c1d2e3f4a5b60001",
|
|
17
|
-
"text": "Diagram types
|
|
17
|
+
"text": "Diagram types — CLD (Causal Loop): map feedback loops and system dynamics. EIP (Enriched Influence Pattern): influence networks with stakeholders, flows, and interventions. NRM (Neighbourhood Risk Management): incident and risk analysis on the Tripod Beta pattern. Trace: follow a path through an existing graph. Wardley: Wardley mapping on an evolution/visibility canvas. OPM (Object-Process Methodology): system structure and process using Dov Dori's ISO 19450 standard, with OPL sentences and Cypher export. SFD (Stock and Flow): stocks, valves, auxiliaries and clouds in the Stella idiom, with XMILE export. LOP (Linkage of Processes): the Deming / API organization-as-a-system map. VSM (Value Stream Mapping): Cindy Jimmerson's healthcare value stream — four flows in lanes, storm bursts, and a computed sawtooth giving lead time, value-added time and the ratio between them, with a one-click handoff that seeds an A3. Triples: nodes and edges can link to other edges, enabling RDF-style triple referencing for knowledge graph authoring."
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"type": "paragraph",
|
|
21
21
|
"id": "d2e3f4a5b6c70002",
|
|
22
|
-
"text": "Import and export: MDL/Vensim CLD, Graphviz .dot, XMILE, Cypher, Wardley JSON, and CSV. A model can also be opened straight from a URL with ?url=, including an RCN Substrate subgraph projection. Multi-trace edges, node and edge layers, canvas legend, and Print are available in all modes. A mode
|
|
22
|
+
"text": "Import and export: MDL/Vensim CLD, Graphviz .dot, XMILE, Cypher, Wardley JSON, and CSV. A model can also be opened straight from a URL with ?url=, including an RCN Substrate subgraph projection. Multi-trace edges, node and edge layers, canvas legend, and Print are available in all modes. A mode’s backdrop — EIP columns, Wardley grid, LOP bands, VSM lanes and sawtooth — is drawn inside the SVG, so it travels into the wiki item and out again; save while still in that mode, because the backdrop only draws there."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "paragraph",
|
|
26
|
+
"id": "b7d1e9c3a5f20814",
|
|
27
|
+
"text": "Builds: a diagram made in the Graph Tool’s Build mode carries an order for its nodes. The item then shows a Play build button that reveals the diagram right here on the page, step by step: ◀ and ▶ or the arrow keys move through it, each edge appears once both its nodes are on screen, and what a step just brought in is ringed in indigo. Show all puts the whole diagram back. The Graph Tool’s live build, where the room decides the order, runs in the tool itself."
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"type": "paragraph",
|
|
31
|
+
"id": "8e7e435485d56e9e",
|
|
32
|
+
"text": "Walks: a diagram can also carry walks, written in the Graph Tool (press Walk there to play, edit or record one). A walk is a list of steps, each with a sentence or two and the part of the diagram it is about. The item shows a ▶ Walk button: each step lights its part, fades the rest, zooms in so a narrow column can read it, and says the words aloud with the browser’s own voice while showing them as a caption. Space pauses, ◀ ▶ or the arrow keys step, Esc stops, and clicking the drawing pauses so you can look. A walk stops at its questions so a group can talk. Voice off shows the words only. The voice and its speed are chosen in the Graph Tool and remembered by your browser."
|
|
23
33
|
},
|
|
24
34
|
{
|
|
25
35
|
"type": "rcngraph",
|
|
@@ -29,7 +39,7 @@
|
|
|
29
39
|
{
|
|
30
40
|
"type": "paragraph",
|
|
31
41
|
"id": "4b6f8e3d9c2a1705",
|
|
32
|
-
"text": "Developed by Marc Pierson with Claude Sonnet 4.6 (Anthropic) for the ReLocalize Creativity Network. Source: [https://github.com/marpie1/wiki-plugin-rcngraph GitHub]. Published on npm as wiki-plugin-rcngraph."
|
|
42
|
+
"text": "Developed by Marc Pierson with Claude Sonnet 4.6 (Anthropic) for the ReLocalize Creativity Network. Build playback and walks added October 2026 with Claude Opus 5.5. Source: [https://github.com/marpie1/wiki-plugin-rcngraph GitHub]. Published on npm as wiki-plugin-rcngraph."
|
|
33
43
|
}
|
|
34
44
|
],
|
|
35
45
|
"journal": [
|
|
@@ -57,7 +67,7 @@
|
|
|
57
67
|
"item": {
|
|
58
68
|
"type": "paragraph",
|
|
59
69
|
"id": "2e7c9f04a3b8d651",
|
|
60
|
-
"text": "Create an item using the factory. Click Open Graph Tool to open the tool. Use -> Item to save the diagram as an SVG preview back into the wiki item
|
|
70
|
+
"text": "Create an item using the factory. Click Open Graph Tool to open the tool. Use -> Item to save the diagram as an SVG preview back into the wiki item — node labels in that preview are clickable internal wiki links, and the graph JSON rides along so Edit in Graph Tool reopens the real model. Use -> Wiki to send the diagram to the lineup as a ghost page. Both follow Ward Cunningham's Enrich Any SVG pattern."
|
|
61
71
|
},
|
|
62
72
|
"date": 1782864002000
|
|
63
73
|
},
|
|
@@ -68,7 +78,7 @@
|
|
|
68
78
|
"item": {
|
|
69
79
|
"type": "paragraph",
|
|
70
80
|
"id": "c1d2e3f4a5b60001",
|
|
71
|
-
"text": "Diagram types
|
|
81
|
+
"text": "Diagram types — CLD (Causal Loop): map feedback loops and system dynamics. EIP (Enriched Influence Pattern): influence networks with stakeholders, flows, and interventions. NRM (Neighbourhood Risk Management): incident and risk analysis on the Tripod Beta pattern. Trace: follow a path through an existing graph. Wardley: Wardley mapping on an evolution/visibility canvas. OPM (Object-Process Methodology): system structure and process using Dov Dori's ISO 19450 standard, with OPL sentences and Cypher export. SFD (Stock and Flow): stocks, valves, auxiliaries and clouds in the Stella idiom, with XMILE export. LOP (Linkage of Processes): the Deming / API organization-as-a-system map. Triples: nodes and edges can link to other edges, enabling RDF-style triple referencing for knowledge graph authoring."
|
|
72
82
|
},
|
|
73
83
|
"date": 1782864003000
|
|
74
84
|
},
|
|
@@ -111,7 +121,7 @@
|
|
|
111
121
|
"item": {
|
|
112
122
|
"type": "paragraph",
|
|
113
123
|
"id": "c1d2e3f4a5b60001",
|
|
114
|
-
"text": "Diagram types
|
|
124
|
+
"text": "Diagram types — CLD (Causal Loop): map feedback loops and system dynamics. EIP (Enriched Influence Pattern): influence networks with stakeholders, flows, and interventions. NRM (Neighbourhood Risk Management): incident and risk analysis on the Tripod Beta pattern. Trace: follow a path through an existing graph. Wardley: Wardley mapping on an evolution/visibility canvas. OPM (Object-Process Methodology): system structure and process using Dov Dori's ISO 19450 standard, with OPL sentences and Cypher export. SFD (Stock and Flow): stocks, valves, auxiliaries and clouds in the Stella idiom, with XMILE export. LOP (Linkage of Processes): the Deming / API organization-as-a-system map. VSM (Value Stream Mapping): Cindy Jimmerson's healthcare value stream — four flows in lanes, storm bursts, and a computed sawtooth giving lead time, value-added time and the ratio between them, with a one-click handoff that seeds an A3. Triples: nodes and edges can link to other edges, enabling RDF-style triple referencing for knowledge graph authoring."
|
|
115
125
|
},
|
|
116
126
|
"date": 1787712127315
|
|
117
127
|
},
|
|
@@ -121,7 +131,7 @@
|
|
|
121
131
|
"item": {
|
|
122
132
|
"type": "paragraph",
|
|
123
133
|
"id": "d2e3f4a5b6c70002",
|
|
124
|
-
"text": "Import and export: MDL/Vensim CLD, Graphviz .dot, XMILE, Cypher, Wardley JSON, and CSV. A model can also be opened straight from a URL with ?url=, including an RCN Substrate subgraph projection. Multi-trace edges, node and edge layers, canvas legend, and Print are available in all modes. A mode
|
|
134
|
+
"text": "Import and export: MDL/Vensim CLD, Graphviz .dot, XMILE, Cypher, Wardley JSON, and CSV. A model can also be opened straight from a URL with ?url=, including an RCN Substrate subgraph projection. Multi-trace edges, node and edge layers, canvas legend, and Print are available in all modes. A mode’s backdrop — EIP columns, Wardley grid, LOP bands, VSM lanes and sawtooth — is drawn inside the SVG, so it travels into the wiki item and out again; save while still in that mode, because the backdrop only draws there."
|
|
125
135
|
},
|
|
126
136
|
"date": 1787712128315
|
|
127
137
|
},
|
|
@@ -134,6 +144,48 @@
|
|
|
134
144
|
"text": "Developed by Marc Pierson with Claude Sonnet 4.6 (Anthropic) for the ReLocalize Creativity Network. Source: [https://github.com/marpie1/wiki-plugin-rcngraph GitHub]. Published on npm as wiki-plugin-rcngraph."
|
|
135
145
|
},
|
|
136
146
|
"date": 1791164815533
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"type": "add",
|
|
150
|
+
"id": "b7d1e9c3a5f20814",
|
|
151
|
+
"item": {
|
|
152
|
+
"type": "paragraph",
|
|
153
|
+
"id": "b7d1e9c3a5f20814",
|
|
154
|
+
"text": "Builds: a diagram made in the Graph Tool’s Build mode carries an order for its nodes. The item then shows a Play build button that reveals the diagram right here on the page, step by step: ◀ and ▶ or the arrow keys move through it, each edge appears once both its nodes are on screen, and what a step just brought in is ringed in indigo. Show all puts the whole diagram back. The Graph Tool’s live build, where the room decides the order, runs in the tool itself."
|
|
155
|
+
},
|
|
156
|
+
"after": "d2e3f4a5b6c70002",
|
|
157
|
+
"date": 1791313722633
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"type": "edit",
|
|
161
|
+
"id": "4b6f8e3d9c2a1705",
|
|
162
|
+
"item": {
|
|
163
|
+
"type": "paragraph",
|
|
164
|
+
"id": "4b6f8e3d9c2a1705",
|
|
165
|
+
"text": "Developed by Marc Pierson with Claude Sonnet 4.6 (Anthropic) for the ReLocalize Creativity Network. Build playback added October 2026 with Claude Opus 5.5. Source: [https://github.com/marpie1/wiki-plugin-rcngraph GitHub]. Published on npm as wiki-plugin-rcngraph."
|
|
166
|
+
},
|
|
167
|
+
"date": 1791313722634
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"type": "add",
|
|
171
|
+
"id": "8e7e435485d56e9e",
|
|
172
|
+
"item": {
|
|
173
|
+
"type": "paragraph",
|
|
174
|
+
"id": "8e7e435485d56e9e",
|
|
175
|
+
"text": "Walks: a diagram can also carry walks, written in the Graph Tool (press Walk there to play, edit or record one). A walk is a list of steps, each with a sentence or two and the part of the diagram it is about. The item shows a ▶ Walk button: each step lights its part, fades the rest, zooms in so a narrow column can read it, and says the words aloud with the browser’s own voice while showing them as a caption. Space pauses, ◀ ▶ or the arrow keys step, Esc stops, and clicking the drawing pauses so you can look. A walk stops at its questions so a group can talk. Voice off shows the words only. The voice and its speed are chosen in the Graph Tool and remembered by your browser."
|
|
176
|
+
},
|
|
177
|
+
"after": "b7d1e9c3a5f20814",
|
|
178
|
+
"date": 1792602075757
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"type": "edit",
|
|
182
|
+
"id": "4b6f8e3d9c2a1705",
|
|
183
|
+
"item": {
|
|
184
|
+
"type": "paragraph",
|
|
185
|
+
"id": "4b6f8e3d9c2a1705",
|
|
186
|
+
"text": "Developed by Marc Pierson with Claude Sonnet 4.6 (Anthropic) for the ReLocalize Creativity Network. Build playback and walks added October 2026 with Claude Opus 5.5. Source: [https://github.com/marpie1/wiki-plugin-rcngraph GitHub]. Published on npm as wiki-plugin-rcngraph."
|
|
187
|
+
},
|
|
188
|
+
"date": 1792602075758
|
|
137
189
|
}
|
|
138
190
|
]
|
|
139
191
|
}
|