@treasure-ai/treasure-deck 2026.10.7 → 2026.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +10 -9
  2. package/dist/chrome.d.ts +10 -1
  3. package/dist/chrome.js +88 -13
  4. package/dist/chrome.js.map +1 -1
  5. package/dist/dev.js +5 -11
  6. package/dist/dev.js.map +1 -1
  7. package/dist/diagrams.js +2 -2
  8. package/dist/diagrams.js.map +1 -1
  9. package/dist/media.d.ts +1 -1
  10. package/dist/media.js +1 -1
  11. package/dist/update.d.ts +7 -0
  12. package/dist/update.js +17 -5
  13. package/dist/update.js.map +1 -1
  14. package/dist/vendor.d.ts +13 -0
  15. package/dist/vendor.js +46 -0
  16. package/dist/vendor.js.map +1 -0
  17. package/docs/commands.md +3 -3
  18. package/docs/editor.md +3 -3
  19. package/docs/syntax.md +2 -2
  20. package/docs/themes.md +1 -1
  21. package/package.json +5 -6
  22. package/runtime/edit-core.cjs +236 -1
  23. package/runtime/embed.js +66 -151
  24. package/runtime/runtime.js +4 -1
  25. package/vendor/lucide/LICENSE +43 -0
  26. package/vendor/lucide/align-center.svg +17 -0
  27. package/vendor/lucide/align-left.svg +17 -0
  28. package/vendor/lucide/align-right.svg +17 -0
  29. package/vendor/lucide/arrow-down.svg +16 -0
  30. package/vendor/lucide/arrow-up.svg +16 -0
  31. package/vendor/lucide/bold.svg +15 -0
  32. package/vendor/lucide/chevron-down.svg +15 -0
  33. package/vendor/lucide/clipboard-paste.svg +19 -0
  34. package/vendor/lucide/code.svg +16 -0
  35. package/vendor/lucide/copy-plus.svg +18 -0
  36. package/vendor/lucide/copy.svg +16 -0
  37. package/vendor/lucide/external-link.svg +17 -0
  38. package/vendor/lucide/eye-off.svg +18 -0
  39. package/vendor/lucide/eye.svg +16 -0
  40. package/vendor/lucide/file-code.svg +18 -0
  41. package/vendor/lucide/heading-1.svg +18 -0
  42. package/vendor/lucide/heading-2.svg +18 -0
  43. package/vendor/lucide/heading-3.svg +19 -0
  44. package/vendor/lucide/highlighter.svg +16 -0
  45. package/vendor/lucide/italic.svg +17 -0
  46. package/vendor/lucide/layers.svg +17 -0
  47. package/vendor/lucide/link.svg +16 -0
  48. package/vendor/lucide/list-ordered.svg +20 -0
  49. package/vendor/lucide/list.svg +20 -0
  50. package/vendor/lucide/pilcrow.svg +17 -0
  51. package/vendor/lucide/pin-off.svg +18 -0
  52. package/vendor/lucide/play.svg +15 -0
  53. package/vendor/lucide/plus.svg +16 -0
  54. package/vendor/lucide/presentation.svg +17 -0
  55. package/vendor/lucide/quote.svg +16 -0
  56. package/vendor/lucide/redo-2.svg +16 -0
  57. package/vendor/lucide/repeat.svg +18 -0
  58. package/vendor/lucide/scissors.svg +19 -0
  59. package/vendor/lucide/settings.svg +16 -0
  60. package/vendor/lucide/sliders-horizontal.svg +23 -0
  61. package/vendor/lucide/square-round-corner.svg +16 -0
  62. package/vendor/lucide/square.svg +15 -0
  63. package/vendor/lucide/strikethrough.svg +17 -0
  64. package/vendor/lucide/trash-2.svg +19 -0
  65. package/vendor/lucide/undo-2.svg +16 -0
  66. package/vendor/mermaid/LICENSE +21 -0
  67. package/vendor/mermaid/mermaid.min.js +4330 -0
  68. package/docs/adrs/2026-10-03-chrome-over-devtools.md +0 -29
  69. package/docs/adrs/2026-10-03-fixed-canvas.md +0 -25
  70. package/docs/adrs/2026-10-03-four-layouts-plus-attributes.md +0 -25
  71. package/docs/adrs/2026-10-03-hybrid-pdf-over-devtools.md +0 -25
  72. package/docs/adrs/2026-10-03-keyword-lines-and-one-attribute-syntax.md +0 -36
  73. package/docs/adrs/2026-10-03-one-behavior-instead-of-settings.md +0 -30
  74. package/docs/adrs/2026-10-03-overflow-is-reported-not-hidden.md +0 -27
  75. package/docs/adrs/2026-10-03-single-file-html.md +0 -26
  76. package/docs/adrs/2026-10-03-strict-build-forgiving-preview.md +0 -31
  77. package/docs/adrs/2026-10-04-edit-in-place-by-alignment.md +0 -28
  78. package/docs/adrs/2026-10-04-editor-in-the-deck-page.md +0 -31
  79. package/docs/adrs/2026-10-04-edits-are-line-range-patches.md +0 -35
  80. package/docs/adrs/2026-10-04-per-slide-hot-swap.md +0 -33
  81. package/docs/adrs/2026-10-04-theme-colors-derive-in-css.md +0 -32
  82. package/docs/adrs/2026-10-05-host-owns-undo.md +0 -26
  83. package/docs/adrs/2026-10-07-anonymous-access-metrics.md +0 -38
  84. package/docs/adrs/2026-10-14-dev-links-media-by-url.md +0 -25
  85. package/docs/adrs/2026-10-14-media-dir-for-the-publish-limit.md +0 -28
  86. package/docs/adrs/2026-10-14-videos-are-inlined-images.md +0 -28
  87. package/docs/adrs/2026-10-15-public-npm-under-labs-terms.md +0 -37
  88. package/docs/adrs/2026-10-16-updates-install-after-exit.md +0 -31
  89. package/docs/adrs/README.md +0 -35
package/runtime/embed.js CHANGED
@@ -11,6 +11,7 @@
11
11
  * go to POST /__patch. */
12
12
  (function () {
13
13
  'use strict';
14
+ var core = window.deckEditCore;
14
15
  var CHANNEL = 'treasure-deck';
15
16
  var host = window.parent !== window ? window.parent : null;
16
17
  function post(type, data) {
@@ -383,16 +384,17 @@
383
384
  });
384
385
  }
385
386
 
386
- var nextId = 1, pending = {};
387
+ // Keyed by a Map, not an object, so an id from the host can't reach Object.prototype.
388
+ var nextId = 1, pending = new Map();
387
389
  function send(p) {
388
390
  return new Promise(function (resolve) {
389
391
  if (host) {
390
392
  var id = nextId++;
391
- pending[id] = resolve;
393
+ pending.set(id, resolve);
392
394
  var msg = { id: id, file: p.file, start: p.start, end: p.end, expected: p.expected, text: p.text };
393
395
  if (p.group) msg.group = p.group;
394
396
  post('patch', msg);
395
- setTimeout(function () { if (pending[id]) { delete pending[id]; resolve({ ok: false, reason: 'the host did not answer' }); } }, 5000);
397
+ setTimeout(function () { if (pending.delete(id)) { resolve({ ok: false, reason: 'the host did not answer' }); } }, 5000);
396
398
  } else {
397
399
  fetch('/__patch', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(p) })
398
400
  .then(function (r) { return r.json(); })
@@ -609,32 +611,8 @@
609
611
  // Put the source back as the edit found it (Escape, or an edit undone).
610
612
  function liveRevert(ls) { liveSave(ls, ls.original, true); }
611
613
 
612
- var LINE = /^(\s*(?:>\s*)*(?:(?:[-*+]|\d+[.)])\s+)?(?:#{1,6}\s+)?)(.*?)((?:\s*\{[^{}]*\})?\s*)$/;
613
- // Cell spans of a table row: between unescaped pipes outside code spans, without the outer pipes, and without a
614
- // trailing {…} (a column's or cell's options), which stays in the row around the text like a block's braces.
615
- function rowCells(line) {
616
- var cuts = [-1], code = false;
617
- for (var i = 0; i < line.length; i++) {
618
- var c = line[i];
619
- if (c === '\\') i++;
620
- else if (c === '`') code = !code;
621
- else if (c === '|' && !code) cuts.push(i);
622
- }
623
- cuts.push(line.length);
624
- var cells = [];
625
- for (var k = 0; k + 1 < cuts.length; k++) cells.push({ start: cuts[k] + 1, end: cuts[k + 1] });
626
- var blank = function (cell) { return !line.slice(cell.start, cell.end).trim(); };
627
- if (cells.length && blank(cells[0]) && /^\s*\|/.test(line)) cells.shift();
628
- if (cells.length && blank(cells[cells.length - 1]) && /\|\s*$/.test(line)) cells.pop();
629
- return cells.map(function (cell) {
630
- var text = line.slice(cell.start, cell.end);
631
- var lead = text.length - text.replace(/^\s+/, '').length;
632
- var trimmed = text.trim(), braces = /\s*\{([^{}]*)\}$/.exec(trimmed);
633
- // Not an escaped \{…\} or an empty {}, which are the cell's text.
634
- if (braces && braces[1].trim() && trimmed[trimmed.lastIndexOf('{') - 1] !== '\\') trimmed = trimmed.slice(0, braces.index);
635
- return { start: cell.start + lead, end: cell.start + lead + trimmed.length };
636
- });
637
- }
614
+ // A source line split as prefix, text, and trailing {…}, and a table row's cells: see edit-core.
615
+ var LINE = core.LINE, rowCells = core.rowCells;
638
616
  // How to edit a block in place: the source line split around the text, or null for the popover. `given`: the line
639
617
  // as it will be once a save on its way lands (a Markdown shortcut), instead of the line as the sources have it.
640
618
  function inlineTarget(el, given) {
@@ -684,40 +662,8 @@
684
662
  if (lines.length > 1) { t.multi = true; t.heads = pp.heads; }
685
663
  return t;
686
664
  }
687
- // Continuation lines of a block start with its quote markers and indentation.
688
- var CONT = /^\s*(?:>\s?)*/;
689
- // What a new line of a block starts with: its first line's prefix, with a list marker as spaces and no heading marker.
690
- function contOf(before) {
691
- return before.replace(/#{1,6}\s+$/, '').replace(/(?:[-*+]|\d+[.)])\s+$/, function (m) { return new Array(m.length + 1).join(' '); });
692
- }
693
- // A block's source lines as its first line's prefix (`- `, `> `), each line's prefix (`heads`, the first line's
694
- // included), each line's text (`rows`), and what ends the last line (a {…} for the block, spaces).
695
- function blockParts(lines) {
696
- if (lines.length === 1) {
697
- var one = lineParts(lines[0]);
698
- return one && { before: one.before, heads: [one.before], rows: [one.content], after: one.after };
699
- }
700
- var m = LINE.exec(lines[0]);
701
- if (!m) return null;
702
- var heads = [m[1]], rows = [lines[0].slice(m[1].length)];
703
- for (var k = 1; k < lines.length; k++) {
704
- var h = CONT.exec(lines[k])[0];
705
- heads.push(h);
706
- rows.push(lines[k].slice(h.length));
707
- }
708
- var last = rows.length - 1, end = (core.hasBlockAttrs(lines[last]) ? /\s*\{[^{}]*\}\s*$/ : /\s*$/).exec(rows[last]);
709
- var after = end ? end[0] : '';
710
- rows[last] = rows[last].slice(0, rows[last].length - after.length);
711
- return { before: m[1], heads: heads, rows: rows, after: after };
712
- }
713
- // The source lines for a block's text as typed (its lines joined by \n): each line with the prefix it had, a new one
714
- // with the last line's (or, for a block of one line, its continuation of the first line's).
715
- function joinLines(t, text) {
716
- var heads = t.heads || [t.before], cont = heads.length > 1 ? heads[heads.length - 1] : contOf(t.before);
717
- return text.split('\n').map(function (row, i) {
718
- return (i === 0 ? t.before : heads[i] !== undefined ? heads[i] : cont) + row;
719
- }).join('\n') + t.after;
720
- }
665
+ // A block's lines as prefixes and text, and back: see edit-core.
666
+ var blockParts = core.blockParts, joinLines = core.joinLines;
721
667
  // A list item's own text: the item, or the first paragraph in it (a loose list's, or the line the editor gives the
722
668
  // text of an item with a list under it). Null for other blocks.
723
669
  function itemOf(el) {
@@ -1078,7 +1024,6 @@
1078
1024
  // The slide toolbar (edit mode): a new slide, layout, column widths, move, hide, and delete for the current slide.
1079
1025
  // Each action is one patch from edit-core. Moves, copies, and deletions reorder slides, so after one the preview
1080
1026
  // waits for its rebuild (`is-stale`), and comes back on the slide the action left current.
1081
- var core = window.deckEditCore;
1082
1027
  var RATIOS = { 2: ['1:1', '3:2', '2:3', '2:1', '1:2'], 3: ['1:1:1', '2:1:1', '1:2:1', '1:1:2'], 4: ['1:1:1:1'] };
1083
1028
  var bar = document.createElement('div');
1084
1029
  bar.className = 'deck-slide-bar';
@@ -1486,7 +1431,7 @@
1486
1431
  ['h2', icon('heading-2', 'H2'), 'Heading 2'], ['h3', icon('heading-3', 'H3'), 'Heading 3'],
1487
1432
  ['ul', icon('list', '• List'), 'Bulleted list'], ['ol', icon('list-ordered', '1. List'), 'Numbered list'],
1488
1433
  ['quote', icon('quote', '❝'), 'Quote']];
1489
- var LIST_ITEM = /^\s*(?:>\s?)*(?:[-*+]|\d+[.)])\s+/;
1434
+ var LIST_ITEM = core.LIST_ITEM;
1490
1435
  var textRow = null;
1491
1436
 
1492
1437
  function styleTarget(block) {
@@ -3303,11 +3248,8 @@
3303
3248
  // `# ` in a heading (another level). A paragraph of `---` (or a slide header, `--- columns`) starts a new slide on
3304
3249
  // Enter, with the blocks after it, and Enter on a paragraph of just `-` (or `1.`) starts a list. Elsewhere, what is
3305
3250
  // typed is escaped and stays text.
3306
- var SHORTCUT = /^(#{1,6}|[-*+]|\d+[.)]|>)[ \u00a0]/;
3251
+ // (The markers and the lines they make: core.shortcut, core.shortcutLine.)
3307
3252
  var BREAK = /^---(?:\s+\S.*)?$/;
3308
- function shortcutKind(marker) {
3309
- return marker[0] === '#' ? 'h' + marker.length : marker === '>' ? 'quote' : /\d/.test(marker) ? 'ol' : 'ul';
3310
- }
3311
3253
  // The new element for a block of `kind`, holding el's children, and the element that takes the typing.
3312
3254
  function kindElement(el, kind) {
3313
3255
  var tag = /^h/.test(kind) ? kind.toUpperCase() : kind === 'quote' ? 'P' : 'LI';
@@ -3356,16 +3298,14 @@
3356
3298
  if (rest === false) return false;
3357
3299
  return breakSlide(ed, '---', rest.content.trim() ? t.before + rest.content + t.after : '');
3358
3300
  }
3359
- var m = SHORTCUT.exec(editedText(el));
3301
+ var text = editedText(el), m = core.shortcut(text);
3360
3302
  // Only a marker just typed, with the caret right after it.
3361
- if (!m || t.text.slice(0, m[0].length) === m[0] || caretOffset(el) !== m[0].length) return false;
3362
- var kind = shortcutKind(m[1]);
3363
- dropLeading(el, m[0].length);
3303
+ if (!m || t.text.slice(0, m.length) === text.slice(0, m.length) || caretOffset(el) !== m.length) return false;
3304
+ var kind = m.kind;
3305
+ dropLeading(el, m.length);
3364
3306
  var pd = pendingEdit(ed);
3365
3307
  if (pd === false) return false;
3366
- var line = core.setBlockKind(t.before + pd.content + t.after, kind);
3367
- // A numbered item keeps the number typed (`3. `, `1) `).
3368
- if (kind === 'ol') line = line.replace(/^(\s*)\d+[.)] /, function (x, ind) { return ind + m[1] + ' '; });
3308
+ var line = core.shortcutLine(t.before + pd.content + t.after, m.marker);
3369
3309
  var live = ed.live;
3370
3310
  finishInline('drop');
3371
3311
  var next = kindElement(el, kind);
@@ -3379,11 +3319,11 @@
3379
3319
  // A new block: the shortcut sets its prefix (it is saved with it) and its element.
3380
3320
  function shortcutAdd(ad) {
3381
3321
  if (ad.prefix || ad.tag !== 'P') return;
3382
- var m = SHORTCUT.exec(editedText(ad.el));
3383
- if (!m || caretOffset(ad.el) !== m[0].length) return;
3384
- var kind = shortcutKind(m[1]);
3385
- dropLeading(ad.el, m[0].length);
3386
- ad.prefix = /^h/.test(kind) ? m[1] + ' ' : kind === 'quote' ? '> ' : m[1] + ' ';
3322
+ var m = core.shortcut(editedText(ad.el));
3323
+ if (!m || caretOffset(ad.el) !== m.length) return;
3324
+ var kind = m.kind;
3325
+ dropLeading(ad.el, m.length);
3326
+ ad.prefix = m.prefix;
3387
3327
  bindAdd(ad, false);
3388
3328
  var next = kindElement(ad.el, kind);
3389
3329
  if (kind === 'ul' || kind === 'ol') { ad.tag = 'LI'; next.setAttribute('data-placeholder', 'List item'); }
@@ -3407,7 +3347,7 @@
3407
3347
  // starts there, with an empty first item, as the marker and a space would have started it. False when it isn't one.
3408
3348
  function enterList(ed) {
3409
3349
  var el = ed.el, text = editedText(el).replace(/\u00a0/g, ' ');
3410
- if (!/^([-*+]|\d+[.)])$/.test(text) || caretOffset(el) !== text.length) return false;
3350
+ if (!core.onlyMarker(text) || caretOffset(el) !== text.length) return false;
3411
3351
  var space = document.createTextNode(' ');
3412
3352
  el.appendChild(space);
3413
3353
  placeCaret(el, text.length + 1);
@@ -3452,12 +3392,10 @@
3452
3392
  head.setAttribute('data-src', file + ':' + live.start + '-' + live.start);
3453
3393
  return { file: file, start: live.start, end: end, expected: live.saved, text: header + (nx !== undefined && nx.trim() ? '\n' : '') };
3454
3394
  }
3455
- var src = parseSrc(ref.getAttribute('data-src')), at = src.end + 1, after = lines[src.end];
3456
- var line = at + (sep ? 1 : 0);
3457
- return {
3458
- file: file, start: at, end: at - 1, expected: '', text: (sep ? '\n' : '') + header + (after !== undefined && after.trim() ? '\n' : ''),
3459
- onSaved: function () { head.setAttribute('data-src', file + ':' + line + '-' + line); },
3460
- };
3395
+ var p = core.insertBlock(lines, parseSrc(ref.getAttribute('data-src')), header, { sep: sep }), line = p.start + (sep ? 1 : 0);
3396
+ p.file = file;
3397
+ p.onSaved = function () { head.setAttribute('data-src', file + ':' + line + '-' + line); };
3398
+ return p;
3461
3399
  }, null, true);
3462
3400
  startAdd(rule, head, '', true, 'P', file);
3463
3401
  adding.slideHead = head;
@@ -3486,14 +3424,7 @@
3486
3424
  placeCaret(el, 0);
3487
3425
  return true;
3488
3426
  }
3489
- // A one-line block's source line as its prefix (`- `, `## `), text, and trailing `{…}`, as richTarget splits it.
3490
- function lineParts(line) {
3491
- var m = LINE.exec(line);
3492
- if (!m) return null;
3493
- var content = m[2], after = m[3];
3494
- if (after.trim() && !core.hasBlockAttrs(line)) { content = line.slice(m[1].length).replace(/\s+$/, ''); after = line.slice(m[1].length + content.length); }
3495
- return { before: m[1], content: content, after: after };
3496
- }
3427
+ var lineParts = core.lineParts, nextItem = core.nextItem;
3497
3428
  // Edit `el` in place from `line` (what its source will be once a save on its way lands), on `live`, caret at `at`.
3498
3429
  function resumeAt(el, line, live, at) {
3499
3430
  el.normalize();
@@ -3520,12 +3451,10 @@
3520
3451
  !!a.closest('.doc-notes') !== !!b.closest('.doc-notes') || deck.classList.contains('is-stale')) return false;
3521
3452
  var lines = sourceLines(A.src.file);
3522
3453
  for (var k = A.src.end; k < B.src.start - 1; k++) if ((lines[k] || '').trim()) return false;
3523
- var pa = blockParts(A.lines), pb = blockParts(B.lines);
3524
3454
  // (A heading is one line.)
3525
- if (!pa || !pb || (/^H/.test(a.tagName) && B.lines.length > 1)) return false;
3526
- var rows = pa.rows.concat(pb.rows.slice(1)), at = pa.rows.join('\n').length;
3527
- rows[pa.rows.length - 1] += pb.rows[0];
3528
- var merged = joinLines({ before: pa.before, heads: pa.heads.concat(pb.heads.slice(1)), after: pa.after }, rows.join('\n'));
3455
+ var m = !(/^H/.test(a.tagName) && B.lines.length > 1) && core.mergeLines(A.lines, B.lines);
3456
+ if (!m) return false;
3457
+ var merged = m.text, at = m.at;
3529
3458
  var file = A.src.file, gap = B.src.start - A.src.end, bLen = B.src.end - B.src.start, la = A.live, lb = B.live;
3530
3459
  finishInline('drop');
3531
3460
  while (b.firstChild) a.appendChild(b.firstChild);
@@ -3602,11 +3531,7 @@
3602
3531
  var cut = pd.start(at), left = pd.content.slice(0, cut).replace(/\s+$/, ''), right = pd.content.slice(cut).replace(/^\s+/, '');
3603
3532
  if (!core.alignRendered(left, text.slice(0, at).replace(/\s+$/, '')) || !core.alignRendered(right, text.slice(at).replace(/^\s+/, ''))) return false;
3604
3533
  var li = itemOf(el), item = li && LIST_ITEM.exec(t.before);
3605
- // What would read as a block marker at the start of the new paragraph stays text.
3606
- if (!item && /^(?:#{1,6}(?:\s|$)|[-*+]\s|\d+[.)]\s|>|---(?:\s|$)|===\s)/.test(right)) right = right.replace(/^(\d+)(?=[.)])/, '$1\\').replace(/^(?=[^\d])/, '\\');
3607
- // Each half keeps the prefixes of its lines: the new one starts as the next item, or a paragraph at the same depth.
3608
- var line1 = t.multi ? joinLines(t, left) : t.before + left + t.after;
3609
- var line2 = joinLines({ before: item ? nextItem(item[0]) : contOf(t.before), heads: null, after: '' }, right), gap = item ? 1 : 2;
3534
+ var halves = core.splitLines(t, left, right, item ? item[0] : null), line1 = halves.line1, line2 = halves.line2, gap = halves.gap;
3610
3535
  var n1 = line1.split('\n').length, n2 = line2.split('\n').length;
3611
3536
  var live = ed.live, nlive = liveSession(live.file, 0, line2);
3612
3537
  // The text after the caret moves into the new block.
@@ -3835,10 +3760,9 @@
3835
3760
  // Nothing saved yet: only its prefix changes, worked out as if it were in the source after the item before it.
3836
3761
  var src = parseSrc(ad.ref.getAttribute('data-src')), lines = src && sourceLines(src.file);
3837
3762
  if (!lines || !itemOf(ad.ref)) return;
3838
- lines = lines.slice(0, src.end).concat([ad.prefix + 'x'], lines.slice(src.end));
3839
- var q = core.indentItem(lines, src.end + 1, dir), here = caretOffset(el);
3840
- if (!q || !moveLi(li, dir)) return;
3841
- ad.prefix = q.text.split('\n')[0].slice(0, -1);
3763
+ var prefix = core.indentPrefix(lines, src.end, ad.prefix, dir), here = caretOffset(el);
3764
+ if (prefix === null || !moveLi(li, dir)) return;
3765
+ ad.prefix = prefix;
3842
3766
  placeCaret(ed.el, Math.max(0, here));
3843
3767
  return;
3844
3768
  }
@@ -4144,8 +4068,9 @@
4144
4068
  b.remove();
4145
4069
  submit(function () {
4146
4070
  var src = parseSrc(b.getAttribute('data-src')), lines = src && sourceLines(src.file);
4147
- if (!lines || (lines[src.start - 1] || '').trim()) return null;
4148
- return { file: src.file, start: src.start, end: src.start, expected: lines[src.start - 1], text: null };
4071
+ var p = lines && core.dropBlank(lines, src.start);
4072
+ if (p) p.file = src.file;
4073
+ return p;
4149
4074
  }, null, true);
4150
4075
  }
4151
4076
  // Enter on an empty new paragraph: a blank line in the source, shown as one, and a new paragraph below it.
@@ -4167,13 +4092,10 @@
4167
4092
  submit(function () {
4168
4093
  var src = parseSrc(ref.getAttribute('data-src')), lines = src && sourceLines(src.file);
4169
4094
  if (!lines) return null;
4170
- // After a block, its separator and one more (two, where it had none); on a blank line, one more before it.
4171
- var at = before ? src.start : src.end + 1, here = lines[at - 1];
4172
- var text = before || (here !== undefined && !here.trim()) ? '' : '\n';
4173
- return {
4174
- file: src.file, start: at, end: at - 1, expected: '', text: text,
4175
- onSaved: function () { if (!onBlank) blank.setAttribute('data-src', src.file + ':' + (at + 1) + '-' + (at + 1)); },
4176
- };
4095
+ var p = core.insertBlank(lines, src, before), at = p.start + 1;
4096
+ p.file = src.file;
4097
+ p.onSaved = function () { if (!onBlank) blank.setAttribute('data-src', src.file + ':' + at + '-' + at); };
4098
+ return p;
4177
4099
  }, null, true);
4178
4100
  startAdd(blank, blank, '', false, 'P', file);
4179
4101
  return true;
@@ -4187,30 +4109,27 @@
4187
4109
  var ref = blockOf(el), src = parseSrc(ref.getAttribute('data-src'));
4188
4110
  if (!src) return;
4189
4111
  var line = (linesOf({ file: src.file, start: src.start, end: src.start }) || [''])[0];
4190
- var li = itemOf(ref), item = li && LIST_ITEM.exec(line);
4112
+ var li = itemOf(ref);
4191
4113
  // The text of an item with a list under it: the new item goes first in that list (as in Notion).
4192
4114
  var sub = li && li !== ref && li.querySelector(':scope > ul > li, :scope > ol > li'), subLine = sub && linesOf(parseSrc(sub.getAttribute('data-src')) || src);
4193
- var subItem = subLine && LIST_ITEM.exec(subLine[0]);
4194
- if (item && subItem) {
4115
+ var next = core.afterBlock(li ? line : '', subLine ? subLine[0] : null);
4116
+ if (next.sub) {
4195
4117
  var mark = document.createTextNode('');
4196
4118
  sub.parentNode.insertBefore(mark, sub);
4197
- startAdd(mark, ref, subItem[0], false, 'LI', src.file);
4119
+ startAdd(mark, ref, next.prefix, false, 'LI', src.file);
4198
4120
  mark.remove();
4199
4121
  return;
4200
4122
  }
4201
- if (item) ref = li;
4123
+ if (next.item) ref = li;
4202
4124
  // A paragraph goes after the list, table, or quote holding the block.
4203
- var anchor = item ? ref : ref.closest('.deck-doc ul[data-src], .deck-doc ol[data-src], .deck-doc table, .deck-doc blockquote[data-src]') || ref;
4204
- var refEl = item || anchor.hasAttribute('data-src') ? anchor : lastWithSrc(anchor);
4205
- startAdd(anchor, refEl, item ? nextItem(item[0]) : '', !item, item ? 'LI' : 'P', src.file);
4125
+ var anchor = next.item ? ref : ref.closest('.deck-doc ul[data-src], .deck-doc ol[data-src], .deck-doc table, .deck-doc blockquote[data-src]') || ref;
4126
+ var refEl = next.item || anchor.hasAttribute('data-src') ? anchor : lastWithSrc(anchor);
4127
+ startAdd(anchor, refEl, next.prefix, next.sep, next.item ? 'LI' : 'P', src.file);
4206
4128
  }
4207
4129
  function lastWithSrc(el) {
4208
4130
  var all = el.querySelectorAll('[data-src]');
4209
4131
  return all[all.length - 1] || el;
4210
4132
  }
4211
- function nextItem(prefix) {
4212
- return prefix.replace(/(\d+)([.)])/, function (m, n, d) { return (Number(n) + 1) + d; });
4213
- }
4214
4133
  function addToSlide(i) {
4215
4134
  var s = slides[i];
4216
4135
  if (!s) return;
@@ -4236,7 +4155,7 @@
4236
4155
  showTextRow(el);
4237
4156
  ad.onInput = function (e) {
4238
4157
  if (e.isComposing) return;
4239
- if (ad.tag === 'LI' && /^(?:===|---)/.test(editedText(ad.el))) leaveList(ad);
4158
+ if (ad.tag === 'LI' && core.leavesList(editedText(ad.el))) leaveList(ad);
4240
4159
  if (/^---/.test(editedText(ad.el)) && caretOffset(ad.el) === 3 && canBreak(ad)) {
4241
4160
  dropLeading(ad.el, 3);
4242
4161
  breakSlide(ad, '---', '');
@@ -4299,28 +4218,22 @@
4299
4218
  function addSave(ad) {
4300
4219
  clearTimeout(ad.timer);
4301
4220
  ad.timer = 0;
4302
- var text = editedText(ad.el);
4303
4221
  // A slide break with nothing typed under it yet is saved alone: `---` makes a slide.
4304
- // Saved as typed, Markdown and all (a line of `=== col` starts a column).
4305
- var typed = text.trim() ? ad.prefix + text : '';
4222
+ var body = core.addedText(ad.prefix, editedText(ad.el), ad.brk);
4223
+ if (body === null) return;
4306
4224
  if (!ad.live) {
4307
- if (!typed && !ad.brk) return;
4308
- var body = typed ? (ad.brk || '') + typed : ad.brk.replace(/\n+$/, '');
4309
4225
  var live = ad.live = liveSession(ad.file, 0, body);
4310
4226
  submit(function () {
4311
4227
  var src = parseSrc(ad.ref.getAttribute('data-src')), lines = sourceLines(src ? src.file : '');
4312
4228
  if (!src || !lines) return null;
4313
- // After its ref's lines, or (typed on a blank line) in that line's place, with the blank line moving below.
4314
- var at = ad.before ? src.start : src.end + 1, next = lines[at - 1];
4315
- live.start = at + (ad.sep ? 1 : 0);
4316
- // A paragraph needs a blank line before what comes next; list items run on.
4317
- var trail = ad.tag !== 'LI' && next !== undefined && next.trim() ? '\n' : '';
4318
- return {
4319
- file: src.file, start: at, end: at - 1, expected: '', text: (ad.sep ? '\n' : '') + body + trail, group: live.group,
4320
- onSaved: function () { ad.el.setAttribute('data-src', src.file + ':' + live.start + '-' + (live.start + body.split('\n').length - 1)); },
4321
- };
4229
+ var p = core.insertBlock(lines, src, body, { before: ad.before, sep: ad.sep, item: ad.tag === 'LI' });
4230
+ live.start = p.start + (ad.sep ? 1 : 0);
4231
+ p.file = src.file;
4232
+ p.group = live.group;
4233
+ p.onSaved = function () { ad.el.setAttribute('data-src', src.file + ':' + live.start + '-' + (live.start + body.split('\n').length - 1)); };
4234
+ return p;
4322
4235
  }, null, true);
4323
- } else if (typed || ad.brk) liveSave(ad.live, typed ? (ad.brk || '') + typed : ad.brk.replace(/\n+$/, ''), true);
4236
+ } else liveSave(ad.live, body, true);
4324
4237
  }
4325
4238
  // Enter in a new block with text starts another after it (it has lines once its own insert is saved).
4326
4239
  function addNext() {
@@ -4354,8 +4267,10 @@
4354
4267
  // Take a block's lines out (with the blank line put before it, for a new paragraph).
4355
4268
  function dropLines(ls, blankBefore) {
4356
4269
  submit(function () {
4357
- var n = ls.saved.split('\n').length, start = ls.start - (blankBefore ? 1 : 0);
4358
- return { file: ls.file, start: start, end: ls.start + n - 1, expected: (blankBefore ? '\n' : '') + ls.saved, text: null, group: ls.group };
4270
+ var p = core.dropLines(ls.start, ls.saved, blankBefore);
4271
+ p.file = ls.file;
4272
+ p.group = ls.group;
4273
+ return p;
4359
4274
  }, null, true);
4360
4275
  }
4361
4276
  // Backspace in an empty block: its lines go, and the caret moves to the end of the block before it.
@@ -4911,9 +4826,9 @@
4911
4826
  setEdit(Boolean(msg.edit));
4912
4827
  } else if (msg.type === 'present-result') {
4913
4828
  presentAnswered(msg);
4914
- } else if (msg.type === 'patch-result' && pending[msg.id]) {
4915
- var done = pending[msg.id];
4916
- delete pending[msg.id];
4829
+ } else if (msg.type === 'patch-result' && pending.has(msg.id)) {
4830
+ var done = pending.get(msg.id);
4831
+ pending.delete(msg.id);
4917
4832
  done(msg);
4918
4833
  }
4919
4834
  });
@@ -422,9 +422,12 @@
422
422
  var font = cs.getPropertyValue('--deck-font-body') || 'sans-serif';
423
423
  mermaid.initialize({
424
424
  startOnLoad: false, theme: 'base', securityLevel: 'strict', fontFamily: font,
425
+ // Mermaid 12 defaults to a new layout and look, and wraps labels narrower; keep the dagre layout and classic shapes
426
+ // the styling below targets (and wrappingWidth below keeps short labels on one line).
427
+ layout: 'dagre', look: 'classic',
425
428
  // SVG text labels: HTML labels would inherit slide typography and break Mermaid's text measurement.
426
429
  htmlLabels: false,
427
- flowchart: { htmlLabels: false, curve: 'basis', nodeSpacing: 36, rankSpacing: 44, padding: 18 },
430
+ flowchart: { htmlLabels: false, curve: 'basis', nodeSpacing: 36, rankSpacing: 44, padding: 18, wrappingWidth: 400 },
428
431
  // Mermaid writes font-weight="normal" on the inner tspan, so bold must target the tspan itself.
429
432
  themeCSS: '.node tspan, .node text, .actor tspan, text.actor { font-weight: 700; }' +
430
433
  '.node rect, .node polygon, .node circle, .node ellipse { stroke-width: 1.6px; }' +
@@ -0,0 +1,43 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026 Lucide Icons and Contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+
17
+ ---
18
+
19
+ The following Lucide icons are derived from the Feather project:
20
+
21
+ airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
22
+
23
+ The MIT License (MIT) (for the icons listed above)
24
+
25
+ Copyright (c) 2013-present Cole Bemis
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining a copy
28
+ of this software and associated documentation files (the "Software"), to deal
29
+ in the Software without restriction, including without limitation the rights
30
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31
+ copies of the Software, and to permit persons to whom the Software is
32
+ furnished to do so, subject to the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be included in all
35
+ copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43
+ SOFTWARE.
@@ -0,0 +1,17 @@
1
+ <!-- @license lucide-static v1.52.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-align-center"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M21 5H3" />
15
+ <path d="M17 12H7" />
16
+ <path d="M19 19H5" />
17
+ </svg>
@@ -0,0 +1,17 @@
1
+ <!-- @license lucide-static v1.52.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-align-left"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M21 5H3" />
15
+ <path d="M15 12H3" />
16
+ <path d="M17 19H3" />
17
+ </svg>
@@ -0,0 +1,17 @@
1
+ <!-- @license lucide-static v1.52.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-align-right"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M21 5H3" />
15
+ <path d="M21 12H9" />
16
+ <path d="M21 19H7" />
17
+ </svg>
@@ -0,0 +1,16 @@
1
+ <!-- @license lucide-static v1.52.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-arrow-down"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M12 5v14" />
15
+ <path d="m19 12-7 7-7-7" />
16
+ </svg>
@@ -0,0 +1,16 @@
1
+ <!-- @license lucide-static v1.52.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-arrow-up"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="m5 12 7-7 7 7" />
15
+ <path d="M12 19V5" />
16
+ </svg>
@@ -0,0 +1,15 @@
1
+ <!-- @license lucide-static v1.52.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-bold"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8" />
15
+ </svg>
@@ -0,0 +1,15 @@
1
+ <!-- @license lucide-static v1.52.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-chevron-down"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="m6 9 6 6 6-6" />
15
+ </svg>
@@ -0,0 +1,19 @@
1
+ <!-- @license lucide-static v1.52.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-clipboard-paste"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M11 14h10" />
15
+ <path d="M16 4h2a2 2 0 0 1 2 2v1.344" />
16
+ <path d="m17 18 4-4-4-4" />
17
+ <path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113" />
18
+ <rect x="8" y="2" width="8" height="4" rx="1" />
19
+ </svg>
@@ -0,0 +1,16 @@
1
+ <!-- @license lucide-static v1.52.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-code"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="m16 18 6-6-6-6" />
15
+ <path d="m8 6-6 6 6 6" />
16
+ </svg>
@@ -0,0 +1,18 @@
1
+ <!-- @license lucide-static v1.52.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-copy-plus"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <line x1="15" x2="15" y1="12" y2="18" />
15
+ <line x1="12" x2="18" y1="15" y2="15" />
16
+ <rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
17
+ <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
18
+ </svg>