wiki-plugin-rcntimeline 0.2.2 → 0.3.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.
package/README.md CHANGED
@@ -47,3 +47,7 @@ Version 0.2: draws intervals, fuzz, links and an axis; bars open their pages; Op
47
47
  Part of the [RCN toolset](https://github.com/marpie1/rcn), MIT.
48
48
 
49
49
  Marc Pierson and Claude Opus 5.5 · September 2026
50
+
51
+ **Walks** (0.3.0). A timeline made in the full tool can carry `walks`: readings that play one step at a time. **▶ Walk** under the timeline redraws each step's years, fades the other bars, and reads the words aloud with a caption; Space, ← →, Esc. Open in RCN Timeline and Save to wiki carry the walks both ways.
52
+
53
+ **Recorded voices** (0.3.1). A step may carry `voices`, people's own recordings of its words, made with ● Record in the timeline's walk editor: `{"<name>": {audio, say}}`. The walk plays a step's recording when it has one and the computer voice otherwise; a chooser in the walk bar picks whose, or the computer voice only (kept in `rcnWalkPrefs.speaker`).
@@ -181,11 +181,14 @@
181
181
  return s.slice(0, lo).trimEnd() + '…'
182
182
  }
183
183
 
184
- function draw ($item, item, m) {
184
+ // range: {lo, hi} in years, to draw just that stretch (a walk step); else the whole timeline.
185
+ function draw ($item, item, m, range) {
185
186
  const W = Math.max(280, ($item.width() || 420) - 18)
186
187
  const H = AXIS_H + m.lanes * ROW_H + PAD
187
188
  let lo = Math.min(...m.intervals.map(v => v.s - v.sf)), hi = Math.max(...m.intervals.map(v => v.e + v.ef))
188
189
  const pad = Math.max((hi - lo) * 0.03, 0.25); lo -= pad; hi += pad
190
+ if (range) { lo = range.lo; hi = range.hi }
191
+ const offStage = v => range && (v.e + v.ef < lo || v.s - v.sf > hi)
189
192
  const x = t => PAD + (t - lo) / (hi - lo) * (W - 2 * PAD)
190
193
  const yMid = lane => AXIS_H + lane * ROW_H + ROW_H / 2
191
194
  const byId = {}; m.intervals.forEach(v => { byId[v.id] = v })
@@ -209,7 +212,7 @@
209
212
  (v.sf || v.ef) ? 'uncertain by ' + [v.sf ? v.sf + ' yr before' : '', v.ef ? v.ef + ' yr after' : ''].filter(Boolean).join(', ') : '',
210
213
  v.who ? 'Source: ' + v.who : '', v.conf != null ? 'Confidence ' + Math.round(v.conf * 100) + '%' : '',
211
214
  v.note || '', v.page ? '— click to open ' + v.page : ''].filter(Boolean).join('\n')
212
- parts.push(`<g class="rcnt-bar" data-page="${esc(v.page || '')}" style="cursor:${v.page ? 'pointer' : 'default'}"><title>${esc(tip)}</title>`
215
+ parts.push(`<g class="rcnt-bar" data-iv="${esc(v.id)}" data-page="${esc(v.page || '')}" style="cursor:${v.page ? 'pointer' : 'default'}"><title>${esc(tip)}</title>`
213
216
  + (v.sf ? `<rect x="${x(v.s - v.sf)}" y="${y}" width="${xs - x(v.s - v.sf)}" height="${BAR_H}" fill="url(#${gid}L)"/>` : '')
214
217
  + (v.ef ? `<rect x="${xe}" y="${y}" width="${x(v.e + v.ef) - xe}" height="${BAR_H}" fill="url(#${gid}R)"/>` : '')
215
218
  + `<rect x="${xs}" y="${y}" width="${xe - xs}" height="${BAR_H}" rx="3" fill="${esc(v.color)}" fill-opacity=".85"/></g>`)
@@ -223,7 +226,7 @@
223
226
  const x1 = rel === 'during' ? x((a.s + a.e) / 2) : x(a.e), y1 = yMid(a.lane)
224
227
  const x2 = rel === 'during' ? x((a.s + a.e) / 2) : x(b.s), y2 = yMid(b.lane)
225
228
  const dy = Math.max(12, Math.abs(y2 - y1) / 2)
226
- parts.push(`<path d="M${x1},${y1} C${x1},${y1 + (y2 > y1 ? dy : -dy)} ${x2},${y2 - (y2 > y1 ? dy : -dy)} ${x2},${y2}" fill="none" stroke="${LINK_COLOR}" stroke-width="1.2" stroke-opacity=".7"${Array.isArray(l.rel) ? ' stroke-dasharray="3 3"' : ''}><title>${esc(a.label + ' ' + relWords(l.rel) + ' ' + b.label + (l.who ? '\nSource: ' + l.who : '') + (l.note ? '\n' + l.note : ''))}</title></path>`)
229
+ parts.push(`<path data-from="${esc(l.from)}" data-to="${esc(l.to)}" d="M${x1},${y1} C${x1},${y1 + (y2 > y1 ? dy : -dy)} ${x2},${y2 - (y2 > y1 ? dy : -dy)} ${x2},${y2}" fill="none" stroke="${LINK_COLOR}" stroke-width="1.2" stroke-opacity=".7"${Array.isArray(l.rel) ? ' stroke-dasharray="3 3"' : ''}><title>${esc(a.label + ' ' + relWords(l.rel) + ' ' + b.label + (l.who ? '\nSource: ' + l.who : '') + (l.note ? '\n' + l.note : ''))}</title></path>`)
227
230
  })
228
231
 
229
232
  // labels last, on a white halo. At the bar's start when it fits there,
@@ -236,6 +239,7 @@
236
239
  // a later one begins — a firm's label gives way to the co-op it became.
237
240
  const limit = {}
238
241
  m.intervals.slice().sort((a, b) => a.lane - b.lane || b.s - a.s).forEach(v => {
242
+ if (offStage(v)) return // zoomed in on a walk step: no label for a bar out of view
239
243
  let lx = Math.max(x(v.s) + 4, 4)
240
244
  const next = m.intervals.filter(o => o !== v && o.lane === v.lane && o.s > v.s).reduce((a, o) => Math.min(a, o.s), Infinity)
241
245
  const stop = Math.min(next < Infinity ? x(next) : W, limit[v.lane] != null ? limit[v.lane] : W)
@@ -250,12 +254,249 @@
250
254
  }
251
255
  const t = fitText(v.label, room)
252
256
  if (t) limit[v.lane] = Math.min(limit[v.lane] != null ? limit[v.lane] : W, lx - 6)
253
- if (t) parts.push(`<text x="${lx}" y="${yMid(v.lane) + 4}" font-size="11" font-weight="600" fill="#1e293b" paint-order="stroke" stroke="#fff" stroke-width="3" stroke-linejoin="round" pointer-events="none">${esc(t)}</text>`)
257
+ if (t) parts.push(`<text data-iv="${esc(v.id)}" x="${lx}" y="${yMid(v.lane) + 4}" font-size="11" font-weight="600" fill="#1e293b" paint-order="stroke" stroke="#fff" stroke-width="3" stroke-linejoin="round" pointer-events="none">${esc(t)}</text>`)
254
258
  })
255
259
 
256
260
  return `<svg xmlns="${NS}" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}" style="display:block;font-family:system-ui,-apple-system,sans-serif"><defs>${defs.join('')}</defs>${parts.join('')}</svg>`
257
261
  }
258
262
 
263
+ // ── Walk playback ──────────────────────────────────────────────────────
264
+ // A walk, written in the RCN Timeline tool, is a list of steps: words to say
265
+ // and the bars each step is about (item.timeline.walks = [{name, steps:[{say,
266
+ // intervals:[ids], all?, ask?}]}]). Playing it here redraws the timeline over
267
+ // just the years a step is about, fades the other bars (ones already visited
268
+ // stay half lit), and speaks the words with the browser's own voice, shown as
269
+ // a caption too. Same controls, keys and voice settings as the drawing plugin.
270
+ const WALK_GHOST = 0.13, WALK_SEEN = 0.42
271
+
272
+ function walkList (item) {
273
+ const ws = item.timeline && item.timeline.walks
274
+ return Array.isArray(ws) ? ws.filter(w => w && Array.isArray(w.steps) && w.steps.length) : []
275
+ }
276
+ const stepLit = st => (!st || st.all) ? null : new Set((st.intervals || []).map(String))
277
+
278
+ // The years a step is about, with room either side; null = the whole timeline.
279
+ function stepRange (m, st) {
280
+ const lit = stepLit(st)
281
+ const ivs = lit ? m.intervals.filter(v => lit.has(String(v.id))) : []
282
+ if (!ivs.length) return null
283
+ let lo = Math.min(...ivs.map(v => v.s - v.sf)), hi = Math.max(...ivs.map(v => v.e + v.ef))
284
+ const span = Math.max(hi - lo, 3), mid = (lo + hi) / 2
285
+ return { lo: mid - span * 0.62, hi: mid + span * 0.62 }
286
+ }
287
+
288
+ function walkFade ($item, m, walk, i) {
289
+ const lit = stepLit(walk.steps[i])
290
+ if (!lit) return
291
+ const seen = new Set()
292
+ walk.steps.slice(0, i).forEach(st => { const L = stepLit(st); if (L) L.forEach(id => seen.add(id)) })
293
+ const op = id => lit.has(id) ? 1 : seen.has(id) ? WALK_SEEN : WALK_GHOST
294
+ $item.find('.rcnt-canvas [data-iv]').each(function () { this.style.opacity = op(this.getAttribute('data-iv')) })
295
+ $item.find('.rcnt-canvas [data-from]').each(function () {
296
+ this.style.opacity = Math.min(op(this.getAttribute('data-from')), op(this.getAttribute('data-to')))
297
+ })
298
+ }
299
+
300
+ // Voice and speed are the listener's: kept in this browser, the same keys the Graph Tool uses.
301
+ function walkPrefs () {
302
+ let p = {}
303
+ try { p = JSON.parse(localStorage.getItem('rcnWalkPrefs') || '{}') } catch (e) {}
304
+ let on = true
305
+ try { on = localStorage.getItem('rcnWalkVoice') !== 'off' } catch (e) {}
306
+ return { voice: p.voice || '', rate: (+p.rate >= 0.6 && +p.rate <= 1.4) ? +p.rate : 0.95, on }
307
+ }
308
+ function walkVoice (name) {
309
+ const vs = window.speechSynthesis ? speechSynthesis.getVoices().filter(v => /^en/i.test(v.lang)) : []
310
+ return vs.find(v => v.name === name) || vs.find(v => /Enhanced|Premium|Natural|Neural/i.test(v.name)) ||
311
+ ['Samantha', 'Daniel', 'Karen', 'Moira', 'Google UK English Female', 'Google US English', 'Microsoft Aria']
312
+ .map(p => vs.find(v => v.name.indexOf(p) === 0)).find(Boolean) || vs[0] || null
313
+ }
314
+ const stopVoice = () => { recHush(); try { if (window.speechSynthesis) speechSynthesis.cancel() } catch (e) {} }
315
+ // Say the words; done() runs once when they have been said. One utterance per
316
+ // sentence, because Chrome stops a long one after about fifteen seconds.
317
+ function walkSay (text, isCurrent, done) {
318
+ const prefs = walkPrefs(), words = (text || '').split(/\s+/).length
319
+ let fired = false
320
+ const after = () => { if (fired || !isCurrent()) return; fired = true; done() }
321
+ setTimeout(after, words * (prefs.on ? 650 : 420) + (prefs.on ? 6000 : 2500)) // if the voice never says it finished
322
+ stopVoice()
323
+ if (!prefs.on || !window.speechSynthesis || !text) { setTimeout(after, text ? words * 400 + 2000 : 1200); return }
324
+ const v = walkVoice(prefs.voice)
325
+ const parts = text.match(/[^.!?]+[.!?]+["'”’)]*\s*|[^.!?]+$/g) || [text]
326
+ parts.forEach((s, k) => {
327
+ const u = new SpeechSynthesisUtterance(s.trim())
328
+ if (v) { u.voice = v; u.lang = v.lang }
329
+ u.rate = prefs.rate
330
+ if (k === parts.length - 1) u.onend = after
331
+ speechSynthesis.speak(u)
332
+ })
333
+ }
334
+
335
+ // People's own recordings of a step, made in the Graph Tool, Map or Timeline walk
336
+ // editor: step.voices = {name: {audio, say}}. A step plays its recording when it has
337
+ // one, else the computer voice. The listener picks whose, kept in this browser with
338
+ // the other walk settings (rcnWalkPrefs.speaker: '' any, '-' computer only, or a name).
339
+ let recAudio = null
340
+ const recOk = src => typeof src === 'string' && /^(data:audio\/|https?:\/\/|\/)/.test(src)
341
+ const recNames = st => st && st.voices ? Object.keys(st.voices).filter(n => st.voices[n] && recOk(st.voices[n].audio)) : []
342
+ const recSpeakers = walk => [...new Set(((walk && walk.steps) || []).flatMap(recNames))].sort()
343
+ function recSpeaker () {
344
+ try { return JSON.parse(localStorage.getItem('rcnWalkPrefs') || '{}').speaker || '' } catch (e) { return '' }
345
+ }
346
+ function recSetSpeaker (v) {
347
+ let p = {}
348
+ try { p = JSON.parse(localStorage.getItem('rcnWalkPrefs') || '{}') } catch (e) {}
349
+ p.speaker = v
350
+ try { localStorage.setItem('rcnWalkPrefs', JSON.stringify(p)) } catch (e) {}
351
+ }
352
+ function recSpeakerOptions (walk) {
353
+ const ns = recSpeakers(walk), cur = recSpeaker()
354
+ if (!ns.length) return ''
355
+ const opt = (v, label) => `<option value="${esc(v)}"${cur === v ? ' selected' : ''}>${esc(label)}</option>`
356
+ return opt('', 'Recorded voices') + ns.map(n => opt(n, 'Recorded: ' + n)).join('') + opt('-', 'Computer voice only')
357
+ }
358
+ function recHush () {
359
+ const a = recAudio
360
+ recAudio = null
361
+ if (a) { a.onended = a.onerror = null; try { a.pause() } catch (e) {} }
362
+ }
363
+ // Say a step: a person's recording when it has one, else the computer voice.
364
+ function walkSayStep (st, isCurrent, done) {
365
+ const ns = recNames(st), want = recSpeaker()
366
+ if (!walkPrefs().on || want === '-' || !ns.length) { walkSay(st.say, isCurrent, done); return }
367
+ try { if (window.speechSynthesis) speechSynthesis.cancel() } catch (e) {}
368
+ recHush()
369
+ const a = new Audio(st.voices[ns.includes(want) ? want : ns[0]].audio)
370
+ recAudio = a
371
+ let out = false
372
+ const fin = ok => {
373
+ if (out || recAudio !== a) return
374
+ out = true; recAudio = null
375
+ if (!isCurrent()) return
376
+ if (ok) done(); else walkSay(st.say, isCurrent, done)
377
+ }
378
+ a.onended = () => fin(true)
379
+ a.onerror = () => fin(false)
380
+ const p = a.play()
381
+ if (p && p.catch) p.catch(() => fin(false))
382
+ }
383
+
384
+ function walkBar (item) {
385
+ const ws = walkList(item)
386
+ if (!ws.length) return ''
387
+ const b = 'cursor:pointer;font-size:12px;padding:2px 8px;'
388
+ const pick = ws.length > 1
389
+ ? `<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>`
390
+ : `<span style="font-size:12px;color:#475569">${esc(ws[0].name || 'Walk')}</span>`
391
+ return `<div class="walk-bar" tabindex="0" title="Hear and see this timeline explained one part at a time. Space plays or pauses, ← → step, Esc stops." style="padding:8px 0 0;outline:none;">
392
+ <div style="display:flex;gap:6px;align-items:center;justify-content:center;flex-wrap:wrap">
393
+ <button class="walk-start" style="${b}font-weight:600">▶ Walk</button>
394
+ ${pick}
395
+ <button class="walk-prev" style="${b}display:none" title="Back a step (←)">◀</button>
396
+ <button class="walk-play" style="${b}display:none" title="Play or pause (Space)">❚❚</button>
397
+ <button class="walk-next" style="${b}display:none" title="Next step (→)">▶</button>
398
+ <span class="walk-count" style="display:none;font-size:12px;color:#64748b;min-width:70px;text-align:center"></span>
399
+ <button class="walk-voice" style="${b}display:none" title="Read the words aloud, or show them only"></button>
400
+ <select class="walk-speaker" style="font-size:12px;max-width:170px;display:none" title="Whose voice reads the walk (kept in this browser)"></select>
401
+ <button class="walk-close" style="${b}display:none" title="Stop the walk (Esc)">■ Stop</button>
402
+ </div>
403
+ <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>
404
+ <div class="walk-note" style="font-size:11px;color:#64748b;text-align:center;margin-top:3px"></div>
405
+ </div>`
406
+ }
407
+
408
+ // Playback for one item. w === null: no walk open. token guards every voice
409
+ // callback, so a step that was skipped or stopped can never move the walk on.
410
+ // One walk speaks at a time on the whole lineup, the drawing plugin's included.
411
+ function bindWalk ($item, item) {
412
+ const el = $item.get(0)
413
+ const wk = el.rcntWalk = el.rcntWalk || { w: null, i: 0, playing: false, token: 0, heard: null }
414
+ const cur = () => wk.w !== null ? walkList(item)[wk.w] : null
415
+ const ui = note => {
416
+ const walk = cur(), open = !!walk
417
+ const $bar = $item.find('.walk-bar')
418
+ $bar.find('.walk-prev, .walk-next, .walk-play, .walk-count, .walk-voice, .walk-close').toggle(open)
419
+ $bar.find('.walk-start, .walk-pick').toggle(!open)
420
+ $bar.find('.walk-say').toggle(open)
421
+ $bar.find('.walk-play').text(wk.playing ? '❚❚' : '▶')
422
+ $bar.find('.walk-voice').text(walkPrefs().on ? '🔈 Voice on' : '🔇 Voice off')
423
+ const so = open ? recSpeakerOptions(walk) : '', $sp = $bar.find('.walk-speaker')
424
+ if ($sp.data('opts') !== so) $sp.html(so).data('opts', so)
425
+ $sp.toggle(!!so)
426
+ $bar.find('.walk-count').text(open ? 'Step ' + (wk.i + 1) + ' of ' + walk.steps.length : '')
427
+ $bar.find('.walk-note').text(note || (open && !wk.playing ? 'Space plays · ← → step · Esc stops' : ''))
428
+ }
429
+ const speak = () => {
430
+ const tok = ++wk.token, walk = cur(), st = walk && walk.steps[wk.i]
431
+ if (!st) return
432
+ wk.heard = wk.i
433
+ walkSayStep(st, () => tok === wk.token && window.rcnActiveWalk === wk, () => {
434
+ const last = wk.i >= walk.steps.length - 1
435
+ if (st.ask || last) { wk.playing = false; ui(last && !st.ask ? 'End of the walk. ← to go back, Esc to stop.' : 'Over to you. Press Space or ▶ to go on.'); return }
436
+ setTimeout(() => { if (tok === wk.token && wk.playing) show(wk.i + 1) }, 800)
437
+ })
438
+ }
439
+ const show = i => {
440
+ const walk = cur()
441
+ if (!walk) return
442
+ wk.i = Math.max(0, Math.min(walk.steps.length - 1, i))
443
+ wk.token++; stopVoice()
444
+ if (el.rcntPaint) el.rcntPaint()
445
+ const st = walk.steps[wk.i]
446
+ $item.find('.walk-say').text(st.say || '').css({ color: st.ask ? '#7c2d12' : '#1e1b4b', fontStyle: st.ask ? 'italic' : 'normal' })
447
+ ui()
448
+ if (wk.playing) speak()
449
+ }
450
+ const pause = () => { wk.playing = false; wk.token++; stopVoice(); ui() }
451
+ const toggle = () => {
452
+ if (!cur()) return
453
+ if (wk.playing) { pause(); return }
454
+ const other = window.rcnActiveWalk
455
+ if (other && other !== wk && other.end) other.end()
456
+ window.rcnActiveWalk = wk
457
+ wk.playing = true
458
+ // Space after a step has been heard moves on; otherwise it says the step.
459
+ if (wk.heard === wk.i && wk.i < cur().steps.length - 1) { show(wk.i + 1); return }
460
+ ui(); speak()
461
+ }
462
+ const end = () => {
463
+ wk.playing = false; wk.token++; wk.w = null; wk.heard = null
464
+ if (window.rcnActiveWalk === wk) { stopVoice(); window.rcnActiveWalk = null }
465
+ if (el.rcntPaint) el.rcntPaint()
466
+ ui()
467
+ }
468
+ wk.end = end
469
+ $item.off('.rcntwalk')
470
+ $item.on('click.rcntwalk', '.walk-start', () => {
471
+ wk.w = +($item.find('.walk-pick').val() || 0)
472
+ wk.heard = null
473
+ show(0)
474
+ toggle() // a click is a user gesture, so the browser will speak
475
+ $item.find('.walk-bar').trigger('focus')
476
+ })
477
+ $item.on('click.rcntwalk', '.walk-play', () => toggle())
478
+ $item.on('click.rcntwalk', '.walk-prev', () => show(wk.i - 1))
479
+ $item.on('click.rcntwalk', '.walk-next', () => show(wk.i + 1))
480
+ $item.on('click.rcntwalk', '.walk-close', () => end())
481
+ $item.on('change.rcntwalk', '.walk-speaker', e => { recSetSpeaker(e.target.value); if (wk.playing) speak() })
482
+ $item.on('click.rcntwalk', '.walk-voice', () => {
483
+ const on = !walkPrefs().on
484
+ try { localStorage.setItem('rcnWalkVoice', on ? 'on' : 'off') } catch (e) {}
485
+ if (!on) stopVoice()
486
+ if (wk.playing) speak()
487
+ ui()
488
+ })
489
+ $item.on('keydown.rcntwalk', '.walk-bar', e => {
490
+ if (wk.w === null || $(e.target).is('select')) return
491
+ if (e.key === ' ') { e.preventDefault(); e.stopPropagation(); toggle() }
492
+ else if (e.key === 'ArrowRight') { e.preventDefault(); e.stopPropagation(); show(wk.i + 1) }
493
+ else if (e.key === 'ArrowLeft') { e.preventDefault(); e.stopPropagation(); show(wk.i - 1) }
494
+ else if (e.key === 'Escape') { e.preventDefault(); end() }
495
+ })
496
+ // A save redraws the item; a walk left open would point at a stale step.
497
+ if (wk.w !== null) end()
498
+ }
499
+
259
500
  function emit ($item, item) {
260
501
  $item.empty()
261
502
  // Offer this item's timeline (its own, plus anything frozen into it) to any
@@ -286,10 +527,19 @@
286
527
  : 'Collected from ' + collect($item).length + ' timeline(s) to the left.'}</p>` : ''
287
528
  $item.append(`<div style="background:#f5f5f5;padding:8px;">
288
529
  <div class="rcnt-canvas" style="background:#fff;border:1px solid #ddd;overflow-x:auto"></div>
530
+ ${walkBar(item)}
289
531
  <p class="caption" style="margin:4px 0 0;">${cap}</p>${note}
290
532
  <div style="padding:6px 0 0;text-align:center;">${controls}<button class="rcnt-open" style="cursor:pointer;">Open in RCN Timeline ↗</button></div></div>`)
291
- // Width is known only once the item is in the page.
292
- const paint = () => $item.find('.rcnt-canvas').html(draw($item, item, m))
533
+ // Width is known only once the item is in the page. A walk step draws just
534
+ // the years it is about and fades what it is not about.
535
+ const el = $item.get(0)
536
+ el.rcntModel = m
537
+ const paint = el.rcntPaint = () => {
538
+ const wk = el.rcntWalk, walk = wk && wk.w !== null ? walkList(item)[wk.w] : null
539
+ const st = walk && walk.steps[wk.i]
540
+ $item.find('.rcnt-canvas').html(draw($item, item, m, st ? stepRange(m, st) : null))
541
+ if (st) walkFade($item, m, walk, wk.i)
542
+ }
293
543
  paint()
294
544
  setTimeout(paint, 0)
295
545
  }
@@ -304,7 +554,7 @@
304
554
  intervals: raw.intervals.map(v => Object.assign({}, v, v.start == null ? { start: fmt(toYear(v.s)), end: fmt(toYear(v.e)) } : {})),
305
555
  links: raw.links
306
556
  }
307
- const doc = Object.assign({ name: caption(item) || 'Timeline' }, tl)
557
+ const doc = Object.assign({ name: caption(item) || 'Timeline' }, tl, walkList(item).length ? { walks: item.timeline.walks } : {})
308
558
  const hash = '#tl=' + b64(JSON.stringify(doc))
309
559
  // Open the window now, while the click still counts, and point it at the
310
560
  // tool once we know which copy to use; otherwise popup blockers stop it.
@@ -339,7 +589,7 @@
339
589
  if (event.data.action !== 'saveTimeline' || !event.data.timeline) return
340
590
  const { item, $item } = pending
341
591
  const tl = event.data.timeline
342
- item.timeline = { intervals: tl.intervals || [], links: tl.links || [] }
592
+ item.timeline = Object.assign({ intervals: tl.intervals || [], links: tl.links || [] }, Array.isArray(tl.walks) && tl.walks.length ? { walks: tl.walks } : {})
343
593
  delete item.frozen // what was frozen is now in the item's own timeline
344
594
  item.text = words(item, item.timeline)
345
595
  save($item, item)
@@ -377,7 +627,9 @@
377
627
 
378
628
  function bind ($item, item) {
379
629
  aboutMark($item, 'rcntimeline')
380
- $item.dblclick(e => { if (!$(e.target).closest('button').length) wiki.textEditor($item, item) })
630
+ // Stepping a walk is quick clicking — never let it open the editor.
631
+ $item.dblclick(e => { if (!$(e.target).closest('button, .walk-bar').length) wiki.textEditor($item, item) })
632
+ bindWalk($item, item)
381
633
  $item.on('click', '.rcnt-open', e => { e.stopPropagation(); openTool($item, item) })
382
634
  $item.on('click', '.rcnt-refresh', e => { e.stopPropagation(); emit($item, item) })
383
635
  $item.on('click', '.rcnt-freeze', e => {
@@ -404,7 +656,7 @@
404
656
  }
405
657
  }
406
658
  if (typeof module !== 'undefined') {
407
- module.exports = { model, rawOf, merge, normalize, lineupOn, toYear, fmt, ticks, relWords, caption, toolUrl }
659
+ module.exports = { model, rawOf, merge, normalize, lineupOn, toYear, fmt, ticks, relWords, caption, toolUrl, walkList, stepRange }
408
660
  }
409
661
 
410
662
  })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-plugin-rcntimeline",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "description": "Federated Wiki plugin: a small RCN timeline on a page — intervals with fuzzy edges, the links between them, a date axis; each bar opens its page",
5
5
  "keywords": ["wiki", "federated wiki", "plugin", "rcn", "timeline"],
6
6
  "author": "RCN Network <rcn@relocalizecreativity.net>",
@@ -18,18 +18,23 @@
18
18
  },
19
19
  {
20
20
  "type": "paragraph",
21
- "text": "Editing the item. Double-click to open the text editor. The first line of the text is the caption; the rest lists the intervals and links in words, so wiki search finds them. The intervals themselves live in the item\u2019s timeline field, in the tool\u2019s own export format. A new item from the Factory has no timeline field yet: type lines such as Pilot = Jan 2020 .. Jun 2021 and each becomes a bar.",
21
+ "text": "Editing the item. Double-click to open the text editor. The first line of the text is the caption; the rest lists the intervals and links in words, so wiki search finds them. The intervals themselves live in the item’s timeline field, in the tool’s own export format. A new item from the Factory has no timeline field yet: type lines such as Pilot = Jan 2020 .. Jun 2021 and each becomes a bar.",
22
22
  "id": "84d2ec6a4ab43717"
23
23
  },
24
24
  {
25
25
  "type": "paragraph",
26
- "text": "Below: the Northwest Agriculture Business Center, from the Co-ops of Whatcom County pages. Its help to the meat co-op sits inside the co-op\u2019s organising years, and the food hub it ran became a farmer-owned co-op.",
26
+ "id": "1caf7fe1c5cc610a",
27
+ "text": "Walks. A timeline can carry walks, made in the full RCN Timeline tool: readings that explain it one stretch at a time. Press ▶ Walk under the timeline. Each step redraws the years it is about, fades the other bars, and says its words aloud with a caption. Space plays or pauses, the arrow keys step, Esc stops, and a walk stops at its questions so a group can talk. Voice on or off and the choice of voice are kept in the browser, shared with the drawing plugin's walks. Walks added October 2026 with Claude Opus 5.5."
28
+ },
29
+ {
30
+ "type": "paragraph",
31
+ "text": "Below: the Northwest Agriculture Business Center, from the Co-ops of Whatcom County pages. Its help to the meat co-op sits inside the co-op’s organising years, and the food hub it ran became a farmer-owned co-op.",
27
32
  "id": "8bd7dff26d7d8c1e"
28
33
  },
29
34
  {
30
35
  "type": "rcntimeline",
31
36
  "id": "11dd477f3b62535a",
32
- "text": "Northwest Agriculture Business Center over time. Click a shared bar for the other co-op\u2019s page.\nNABC co-op development help (USDA grant): Jul 1 2015 \u2013 Jul 1 2016\nPuget Sound Food Hub, run by NABC: Jul 1 2010 \u2013 Jul 1 2016\nNW Agriculture Business Center: Jul 1 2006 \u2013 Sep 28 2026\nNABC co-op development help (USDA grant) during NW Agriculture Business Center\nPuget Sound Food Hub, run by NABC during NW Agriculture Business Center",
37
+ "text": "Northwest Agriculture Business Center over time. Click a shared bar for the other co-op’s page.\nNABC co-op development help (USDA grant): Jul 1 2015 – Jul 1 2016\nPuget Sound Food Hub, run by NABC: Jul 1 2010 – Jul 1 2016\nNW Agriculture Business Center: Jul 1 2006 – Sep 28 2026\nNABC co-op development help (USDA grant) during NW Agriculture Business Center\nPuget Sound Food Hub, run by NABC during NW Agriculture Business Center",
33
38
  "timeline": {
34
39
  "intervals": [
35
40
  {
@@ -112,7 +117,7 @@
112
117
  {
113
118
  "type": "markdown",
114
119
  "id": "a5673a5be44d674a",
115
- "text": "*Marc Pierson and Claude Opus 5.5 \u00b7 September 2026*",
120
+ "text": "*Marc Pierson and Claude Opus 5.5 · September 2026*",
116
121
  "attribution": true
117
122
  }
118
123
  ],
@@ -152,7 +157,7 @@
152
157
  "id": "84d2ec6a4ab43717",
153
158
  "item": {
154
159
  "type": "paragraph",
155
- "text": "Editing the item. Double-click to open the text editor. The first line of the text is the caption; the rest lists the intervals and links in words, so wiki search finds them. The intervals themselves live in the item\u2019s timeline field, in the tool\u2019s own export format. A new item from the Factory has no timeline field yet: type lines such as Pilot = Jan 2020 .. Jun 2021 and each becomes a bar.",
160
+ "text": "Editing the item. Double-click to open the text editor. The first line of the text is the caption; the rest lists the intervals and links in words, so wiki search finds them. The intervals themselves live in the item’s timeline field, in the tool’s own export format. A new item from the Factory has no timeline field yet: type lines such as Pilot = Jan 2020 .. Jun 2021 and each becomes a bar.",
156
161
  "id": "84d2ec6a4ab43717"
157
162
  },
158
163
  "date": 1790644321806,
@@ -163,7 +168,7 @@
163
168
  "id": "8bd7dff26d7d8c1e",
164
169
  "item": {
165
170
  "type": "paragraph",
166
- "text": "Below: the Northwest Agriculture Business Center, from the Co-ops of Whatcom County pages. Its help to the meat co-op sits inside the co-op\u2019s organising years, and the food hub it ran became a farmer-owned co-op.",
171
+ "text": "Below: the Northwest Agriculture Business Center, from the Co-ops of Whatcom County pages. Its help to the meat co-op sits inside the co-op’s organising years, and the food hub it ran became a farmer-owned co-op.",
167
172
  "id": "8bd7dff26d7d8c1e"
168
173
  },
169
174
  "date": 1790644321807,
@@ -175,7 +180,7 @@
175
180
  "item": {
176
181
  "type": "rcntimeline",
177
182
  "id": "11dd477f3b62535a",
178
- "text": "Northwest Agriculture Business Center over time. Click a shared bar for the other co-op\u2019s page.\nNABC co-op development help (USDA grant): Jul 1 2015 \u2013 Jul 1 2016\nPuget Sound Food Hub, run by NABC: Jul 1 2010 \u2013 Jul 1 2016\nNW Agriculture Business Center: Jul 1 2006 \u2013 Sep 28 2026\nNABC co-op development help (USDA grant) during NW Agriculture Business Center\nPuget Sound Food Hub, run by NABC during NW Agriculture Business Center",
183
+ "text": "Northwest Agriculture Business Center over time. Click a shared bar for the other co-op’s page.\nNABC co-op development help (USDA grant): Jul 1 2015 – Jul 1 2016\nPuget Sound Food Hub, run by NABC: Jul 1 2010 – Jul 1 2016\nNW Agriculture Business Center: Jul 1 2006 – Sep 28 2026\nNABC co-op development help (USDA grant) during NW Agriculture Business Center\nPuget Sound Food Hub, run by NABC during NW Agriculture Business Center",
179
184
  "timeline": {
180
185
  "intervals": [
181
186
  {
@@ -270,7 +275,7 @@
270
275
  "item": {
271
276
  "type": "markdown",
272
277
  "id": "a5673a5be44d674a",
273
- "text": "*Marc Pierson and Claude Opus 5.5 \u00b7 September 2026*",
278
+ "text": "*Marc Pierson and Claude Opus 5.5 · September 2026*",
274
279
  "attribution": true
275
280
  },
276
281
  "date": 1790644321962,
@@ -286,6 +291,17 @@
286
291
  },
287
292
  "after": "f0a9a8322aafc9ab",
288
293
  "date": 1791164815533
294
+ },
295
+ {
296
+ "type": "add",
297
+ "id": "1caf7fe1c5cc610a",
298
+ "item": {
299
+ "type": "paragraph",
300
+ "id": "1caf7fe1c5cc610a",
301
+ "text": "Walks. A timeline can carry walks, made in the full RCN Timeline tool: readings that explain it one stretch at a time. Press ▶ Walk under the timeline. Each step redraws the years it is about, fades the other bars, and says its words aloud with a caption. Space plays or pauses, the arrow keys step, Esc stops, and a walk stops at its questions so a group can talk. Voice on or off and the choice of voice are kept in the browser, shared with the drawing plugin's walks. Walks added October 2026 with Claude Opus 5.5."
302
+ },
303
+ "after": "84d2ec6a4ab43717",
304
+ "date": 1792629734413
289
305
  }
290
306
  ]
291
307
  }