create-ai-memory 0.14.3 → 0.15.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/web/viewer.html CHANGED
@@ -18,6 +18,7 @@
18
18
  --ink-2: #55514b;
19
19
  --ink-3: #8a857d;
20
20
  --accent: #b45309;
21
+ --warn: #b3261e;
21
22
  --edge: #cfcac2;
22
23
  --shadow: 0 1px 2px rgba(28,27,25,.05), 0 8px 24px rgba(28,27,25,.06);
23
24
  --radius: 8px;
@@ -34,6 +35,7 @@
34
35
  --ink-2: #a8a49d;
35
36
  --ink-3: #736f68;
36
37
  --accent: #f59e0b;
38
+ --warn: #f0806c;
37
39
  --edge: #3a3743;
38
40
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
39
41
  }
@@ -410,6 +412,21 @@ function draw() {
410
412
  ctx.fillStyle = colorFor(n.type);
411
413
  ctx.fill();
412
414
 
415
+ // A dashed warn-coloured ring marks a note that carries a dangling link --
416
+ // a [[link]] pointing at no note. The dead edge is not drawn (there is no
417
+ // target to draw it to), but the source is flagged, so graph pruning is
418
+ // visible here as well as in the note panel, without inventing phantoms.
419
+ if (n.dangling) {
420
+ ctx.save();
421
+ ctx.strokeStyle = css('--warn');
422
+ ctx.lineWidth = 1.6 / view.k;
423
+ ctx.setLineDash([3 / view.k, 2.5 / view.k]);
424
+ ctx.beginPath();
425
+ ctx.arc(n.x, n.y, n.r + 3 / view.k, 0, Math.PI * 2);
426
+ ctx.stroke();
427
+ ctx.restore();
428
+ }
429
+
413
430
  if (n === selected || n === hovered) {
414
431
  ctx.strokeStyle = css('--accent');
415
432
  ctx.lineWidth = 2.5 / view.k;
@@ -562,6 +579,7 @@ async function open(n) {
562
579
  if (n.description) fields.push(['Description', esc(n.description)]);
563
580
  if (n.resource) fields.push(['Resource', '<a href="' + esc(n.resource) + '" target="_blank" rel="noopener">' + esc(n.resource) + '</a>']);
564
581
  if (n.tags.length) fields.push(['Tags', n.tags.map((t) => '<span class="tag">' + esc(t) + '</span>').join('')]);
582
+ if (n.dangling) fields.push(['Dangling links', '<span style="color:var(--warn)">' + n.dangling + ' dead ' + (n.dangling === 1 ? 'link' : 'links') + ' — shown dotted below</span>']);
565
583
  if (fields.length) {
566
584
  html += '<dl class="fields">' + fields.map(([k, v]) => '<dt>' + k + '</dt><dd>' + v + '</dd>').join('') + '</dl>';
567
585
  }
@@ -600,10 +618,15 @@ const esc = (s) => String(s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&
600
618
  the vault actually contains -- headings, lists, tables, fences, wikilinks --
601
619
  rather than the whole spec. */
602
620
  function md(src) {
621
+ // Fences are lifted out and replaced by a sentinel, then restored at the
622
+ // end. The sentinel is U+E000, a private-use character that cannot occur in
623
+ // real note content. It used to be a NUL byte, which worked in JavaScript
624
+ // but made this file binary to file(1) and grep -- grep silently matched
625
+ // nothing in it, in a project whose whole pitch is plain files you can grep.
603
626
  const fences = [];
604
627
  src = src.replace(/```[\s\S]*?```/g, (m) => {
605
628
  fences.push('<pre><code>' + esc(m.replace(/^```[^\n]*\n?/, '').replace(/```$/, '')) + '</code></pre>');
606
- return 'FENCE' + (fences.length - 1) + '';
629
+ return 'FENCE' + (fences.length - 1) + '';
607
630
  });
608
631
 
609
632
  const inline = (s) => esc(s)
@@ -657,7 +680,7 @@ function md(src) {
657
680
  para.push(line.trim());
658
681
  }
659
682
  flushAll();
660
- return out.join('\n').replace(/FENCE(\d+)/g, (_, i) => fences[i]);
683
+ return out.join('\n').replace(/FENCE(\d+)/g, (_, i) => fences[i]);
661
684
  }
662
685
 
663
686
  load().catch(() => { $('#hint').textContent = 'Could not reach the vault server.'; });