@treasure-ai/treasure-deck 2026.10.6 → 2026.10.8

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 (94) hide show
  1. package/README.md +13 -12
  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/cli.js +17 -16
  6. package/dist/cli.js.map +1 -1
  7. package/dist/dev.js +5 -11
  8. package/dist/dev.js.map +1 -1
  9. package/dist/diagrams.js +2 -2
  10. package/dist/diagrams.js.map +1 -1
  11. package/dist/media.d.ts +1 -1
  12. package/dist/media.js +1 -1
  13. package/dist/scaffold.d.ts +2 -0
  14. package/dist/scaffold.js +10 -1
  15. package/dist/scaffold.js.map +1 -1
  16. package/dist/update.d.ts +7 -0
  17. package/dist/update.js +17 -5
  18. package/dist/update.js.map +1 -1
  19. package/dist/vendor.d.ts +13 -0
  20. package/dist/vendor.js +46 -0
  21. package/dist/vendor.js.map +1 -0
  22. package/docs/commands.md +4 -4
  23. package/docs/editor.md +3 -3
  24. package/docs/syntax.md +2 -2
  25. package/docs/themes.md +1 -1
  26. package/package.json +5 -6
  27. package/runtime/edit-core.cjs +236 -1
  28. package/runtime/embed.js +66 -151
  29. package/skills/treasure-deck/SKILL.md +28 -9
  30. package/vendor/lucide/LICENSE +43 -0
  31. package/vendor/lucide/align-center.svg +17 -0
  32. package/vendor/lucide/align-left.svg +17 -0
  33. package/vendor/lucide/align-right.svg +17 -0
  34. package/vendor/lucide/arrow-down.svg +16 -0
  35. package/vendor/lucide/arrow-up.svg +16 -0
  36. package/vendor/lucide/bold.svg +15 -0
  37. package/vendor/lucide/chevron-down.svg +15 -0
  38. package/vendor/lucide/clipboard-paste.svg +19 -0
  39. package/vendor/lucide/code.svg +16 -0
  40. package/vendor/lucide/copy-plus.svg +18 -0
  41. package/vendor/lucide/copy.svg +16 -0
  42. package/vendor/lucide/external-link.svg +17 -0
  43. package/vendor/lucide/eye-off.svg +18 -0
  44. package/vendor/lucide/eye.svg +16 -0
  45. package/vendor/lucide/file-code.svg +18 -0
  46. package/vendor/lucide/heading-1.svg +18 -0
  47. package/vendor/lucide/heading-2.svg +18 -0
  48. package/vendor/lucide/heading-3.svg +19 -0
  49. package/vendor/lucide/highlighter.svg +16 -0
  50. package/vendor/lucide/italic.svg +17 -0
  51. package/vendor/lucide/layers.svg +17 -0
  52. package/vendor/lucide/link.svg +16 -0
  53. package/vendor/lucide/list-ordered.svg +20 -0
  54. package/vendor/lucide/list.svg +20 -0
  55. package/vendor/lucide/pilcrow.svg +17 -0
  56. package/vendor/lucide/pin-off.svg +18 -0
  57. package/vendor/lucide/play.svg +15 -0
  58. package/vendor/lucide/plus.svg +16 -0
  59. package/vendor/lucide/presentation.svg +17 -0
  60. package/vendor/lucide/quote.svg +16 -0
  61. package/vendor/lucide/redo-2.svg +16 -0
  62. package/vendor/lucide/repeat.svg +18 -0
  63. package/vendor/lucide/scissors.svg +19 -0
  64. package/vendor/lucide/settings.svg +16 -0
  65. package/vendor/lucide/sliders-horizontal.svg +23 -0
  66. package/vendor/lucide/square-round-corner.svg +16 -0
  67. package/vendor/lucide/square.svg +15 -0
  68. package/vendor/lucide/strikethrough.svg +17 -0
  69. package/vendor/lucide/trash-2.svg +19 -0
  70. package/vendor/lucide/undo-2.svg +16 -0
  71. package/vendor/mermaid/LICENSE +21 -0
  72. package/vendor/mermaid/mermaid.min.js +3636 -0
  73. package/docs/adrs/2026-10-03-chrome-over-devtools.md +0 -29
  74. package/docs/adrs/2026-10-03-fixed-canvas.md +0 -25
  75. package/docs/adrs/2026-10-03-four-layouts-plus-attributes.md +0 -25
  76. package/docs/adrs/2026-10-03-hybrid-pdf-over-devtools.md +0 -25
  77. package/docs/adrs/2026-10-03-keyword-lines-and-one-attribute-syntax.md +0 -36
  78. package/docs/adrs/2026-10-03-one-behavior-instead-of-settings.md +0 -30
  79. package/docs/adrs/2026-10-03-overflow-is-reported-not-hidden.md +0 -27
  80. package/docs/adrs/2026-10-03-single-file-html.md +0 -26
  81. package/docs/adrs/2026-10-03-strict-build-forgiving-preview.md +0 -31
  82. package/docs/adrs/2026-10-04-edit-in-place-by-alignment.md +0 -28
  83. package/docs/adrs/2026-10-04-editor-in-the-deck-page.md +0 -31
  84. package/docs/adrs/2026-10-04-edits-are-line-range-patches.md +0 -35
  85. package/docs/adrs/2026-10-04-per-slide-hot-swap.md +0 -33
  86. package/docs/adrs/2026-10-04-theme-colors-derive-in-css.md +0 -32
  87. package/docs/adrs/2026-10-05-host-owns-undo.md +0 -26
  88. package/docs/adrs/2026-10-07-anonymous-access-metrics.md +0 -38
  89. package/docs/adrs/2026-10-14-dev-links-media-by-url.md +0 -25
  90. package/docs/adrs/2026-10-14-media-dir-for-the-publish-limit.md +0 -28
  91. package/docs/adrs/2026-10-14-videos-are-inlined-images.md +0 -28
  92. package/docs/adrs/2026-10-15-public-npm-under-labs-terms.md +0 -37
  93. package/docs/adrs/2026-10-16-updates-install-after-exit.md +0 -31
  94. package/docs/adrs/README.md +0 -35
@@ -759,6 +759,220 @@
759
759
  return patch(lines, n, end, out.join('\n'));
760
760
  }
761
761
 
762
+ // ---- A block's text in its source lines, as the editor types into it ----
763
+
764
+ /** A source line: its prefix (quote markers, a list marker, a heading's #s), its text, and a trailing {…} with spaces. */
765
+ var LINE = /^(\s*(?:>\s*)*(?:(?:[-*+]|\d+[.)])\s+)?(?:#{1,6}\s+)?)(.*?)((?:\s*\{[^{}]*\})?\s*)$/;
766
+ /** What continuation lines of a block start with: its quote markers and indentation. */
767
+ var CONT = /^\s*(?:>\s?)*/;
768
+
769
+ /**
770
+ * Cell spans of a table row: between unescaped pipes outside code spans, without the outer pipes, and without a
771
+ * trailing {…} (a column's or cell's options), which stays in the row around the text like a block's braces.
772
+ */
773
+ function rowCells(line) {
774
+ var cuts = [-1], code = false;
775
+ for (var i = 0; i < line.length; i++) {
776
+ var c = line[i];
777
+ if (c === '\\') i++;
778
+ else if (c === '`') code = !code;
779
+ else if (c === '|' && !code) cuts.push(i);
780
+ }
781
+ cuts.push(line.length);
782
+ var cells = [];
783
+ for (var k = 0; k + 1 < cuts.length; k++) cells.push({ start: cuts[k] + 1, end: cuts[k + 1] });
784
+ var blank = function (cell) { return !line.slice(cell.start, cell.end).trim(); };
785
+ if (cells.length && blank(cells[0]) && /^\s*\|/.test(line)) cells.shift();
786
+ if (cells.length && blank(cells[cells.length - 1]) && /\|\s*$/.test(line)) cells.pop();
787
+ return cells.map(function (cell) {
788
+ var text = line.slice(cell.start, cell.end);
789
+ var lead = text.length - text.replace(/^\s+/, '').length;
790
+ var trimmed = text.trim(), braces = /\s*\{([^{}]*)\}$/.exec(trimmed);
791
+ // Not an escaped \{…\} or an empty {}, which are the cell's text.
792
+ if (braces && braces[1].trim() && trimmed[trimmed.lastIndexOf('{') - 1] !== '\\') trimmed = trimmed.slice(0, braces.index);
793
+ return { start: cell.start + lead, end: cell.start + lead + trimmed.length };
794
+ });
795
+ }
796
+
797
+ /** A one-line block's source line as its prefix (`- `, `## `), text, and trailing `{…}`. */
798
+ function lineParts(line) {
799
+ var m = LINE.exec(line);
800
+ if (!m) return null;
801
+ var content = m[2], after = m[3];
802
+ if (after.trim() && !hasBlockAttrs(line)) { content = line.slice(m[1].length).replace(/\s+$/, ''); after = line.slice(m[1].length + content.length); }
803
+ return { before: m[1], content: content, after: after };
804
+ }
805
+
806
+ /** What a new line of a block starts with: its first line's prefix, with a list marker as spaces and no heading marker. */
807
+ function contOf(before) {
808
+ return before.replace(/#{1,6}\s+$/, '').replace(/(?:[-*+]|\d+[.)])\s+$/, function (m) { return new Array(m.length + 1).join(' '); });
809
+ }
810
+
811
+ /**
812
+ * A block's source lines as its first line's prefix (`- `, `> `), each line's prefix (`heads`, the first line's
813
+ * included), each line's text (`rows`), and what ends the last line (a {…} for the block, spaces).
814
+ */
815
+ function blockParts(lines) {
816
+ if (lines.length === 1) {
817
+ var one = lineParts(lines[0]);
818
+ return one && { before: one.before, heads: [one.before], rows: [one.content], after: one.after };
819
+ }
820
+ var m = LINE.exec(lines[0]);
821
+ if (!m) return null;
822
+ var heads = [m[1]], rows = [lines[0].slice(m[1].length)];
823
+ for (var k = 1; k < lines.length; k++) {
824
+ var h = CONT.exec(lines[k])[0];
825
+ heads.push(h);
826
+ rows.push(lines[k].slice(h.length));
827
+ }
828
+ var last = rows.length - 1, end = (hasBlockAttrs(lines[last]) ? /\s*\{[^{}]*\}\s*$/ : /\s*$/).exec(rows[last]);
829
+ var after = end ? end[0] : '';
830
+ rows[last] = rows[last].slice(0, rows[last].length - after.length);
831
+ return { before: m[1], heads: heads, rows: rows, after: after };
832
+ }
833
+
834
+ /**
835
+ * The source lines for a block's text as typed (its lines joined by \n), from `t` = {before, heads, after}: each line
836
+ * with the prefix it had, a new one with the last line's (or, for a block of one line, its continuation of the first's).
837
+ */
838
+ function joinLines(t, text) {
839
+ var heads = t.heads || [t.before], cont = heads.length > 1 ? heads[heads.length - 1] : contOf(t.before);
840
+ return text.split('\n').map(function (row, i) {
841
+ return (i === 0 ? t.before : heads[i] !== undefined ? heads[i] : cont) + row;
842
+ }).join('\n') + t.after;
843
+ }
844
+
845
+ /** The list marker after `prefix`'s: the next number for a numbered item, the same bullet otherwise. */
846
+ function nextItem(prefix) {
847
+ return prefix.replace(/(\d+)([.)])/, function (m, n, d) { return (Number(n) + 1) + d; });
848
+ }
849
+
850
+ /**
851
+ * Backspace at the start of block b (or Delete at the end of a): b's text joins the end of a's, keeping a's prefix
852
+ * and {…}; b's prefix and {…} go, and its other lines stay as they are. The joined lines and the caret (`at`, in a's
853
+ * text joined by \n), or null for lines that aren't blocks of text.
854
+ */
855
+ function mergeLines(aLines, bLines) {
856
+ var pa = blockParts(aLines), pb = blockParts(bLines);
857
+ if (!pa || !pb) return null;
858
+ var rows = pa.rows.concat(pb.rows.slice(1)), at = pa.rows.join('\n').length;
859
+ rows[pa.rows.length - 1] += pb.rows[0];
860
+ return { text: joinLines({ before: pa.before, heads: pa.heads.concat(pb.heads.slice(1)), after: pa.after }, rows.join('\n')), at: at };
861
+ }
862
+
863
+ /**
864
+ * Enter inside a block's text splits it: `left` stays in the block `t` ({before, heads, after, multi}), and `right`
865
+ * starts the next list item (`item`: the block's list marker prefix) or a paragraph at the same depth. What would
866
+ * read as a block marker at the start of a new paragraph is escaped. The two blocks' lines, and the line breaks
867
+ * between them (`gap`: 1 between items, 2 around a paragraph).
868
+ */
869
+ function splitLines(t, left, right, item) {
870
+ if (!item && /^(?:#{1,6}(?:\s|$)|[-*+]\s|\d+[.)]\s|>|---(?:\s|$)|===\s)/.test(right)) right = right.replace(/^(\d+)(?=[.)])/, '$1\\').replace(/^(?=[^\d])/, '\\');
871
+ var line1 = t.multi ? joinLines(t, left) : t.before + left + t.after;
872
+ var line2 = joinLines({ before: item ? nextItem(item) : contOf(t.before), heads: null, after: '' }, right);
873
+ return { line1: line1, line2: line2, gap: item ? 1 : 2 };
874
+ }
875
+
876
+ // A new block typed after another (Enter at the end of a block), before any of it is saved: its prefix, the patch
877
+ // that inserts it, and those that take it or a blank line out again.
878
+ var LIST_ITEM = /^\s*(?:>\s?)*(?:[-*+]|\d+[.)])\s+/;
879
+
880
+ /**
881
+ * The block typed after one whose first line is `line` (an item's, or '' for any other block): the next item of its
882
+ * list, or (`subLine`: the first line of the list under the item) that list's first; else a paragraph with a blank
883
+ * line before it. Its prefix, `sep` (the blank line), whether it is an `item`, and whether it goes in the `sub` list.
884
+ */
885
+ function afterBlock(line, subLine) {
886
+ var item = LIST_ITEM.exec(line), sub = item && subLine != null && LIST_ITEM.exec(subLine);
887
+ if (sub) return { prefix: sub[0], sep: false, item: true, sub: true };
888
+ return item ? { prefix: nextItem(item[0]), sep: false, item: true, sub: false } : { prefix: '', sep: true, item: false, sub: false };
889
+ }
890
+
891
+ /**
892
+ * What a new block saves: its prefix and text, after the slide break typed before it (`brk`), or the break alone;
893
+ * null while there is nothing to save. Saved as typed, Markdown and all (a line of `=== col` starts a column).
894
+ */
895
+ function addedText(prefix, text, brk) {
896
+ var typed = text.trim() ? prefix + text : '';
897
+ if (!typed && !brk) return null;
898
+ return typed ? (brk || '') + typed : brk.replace(/\n+$/, '');
899
+ }
900
+
901
+ /**
902
+ * Insert `body` after the lines of the block at `ref` ({start, end}), or (`before`: typed on a blank line) in that
903
+ * line's place, with the blank line moving below. `sep`: a blank line first. A paragraph needs a blank line before
904
+ * what comes next; list items (`item`) run on. Its first line lands at start + 1 with `sep`, else at start.
905
+ */
906
+ function insertBlock(lines, ref, body, opts) {
907
+ var at = opts.before ? ref.start : ref.end + 1, next = lines[at - 1];
908
+ var trail = !opts.item && next !== undefined && next.trim() ? '\n' : '';
909
+ return { start: at, end: at - 1, expected: '', text: (opts.sep ? '\n' : '') + body + trail };
910
+ }
911
+
912
+ /**
913
+ * Enter on an empty new paragraph: a blank line in the source. After a block, its separator and one more (two,
914
+ * where it had none); on a blank line (`before`), one more before it. The new blank line is start + 1.
915
+ */
916
+ function insertBlank(lines, ref, before) {
917
+ var at = before ? ref.start : ref.end + 1, here = lines[at - 1];
918
+ var text = before || (here !== undefined && !here.trim()) ? '' : '\n';
919
+ return { start: at, end: at - 1, expected: '', text: text };
920
+ }
921
+
922
+ /** Take blank line n out; null when it has text. */
923
+ function dropBlank(lines, n) {
924
+ if ((lines[n - 1] || '').trim()) return null;
925
+ return { start: n, end: n, expected: lines[n - 1], text: null };
926
+ }
927
+
928
+ /** Take out the lines of a block saved as `saved` from line `start`, with the blank line before it (`blankBefore`). */
929
+ function dropLines(start, saved, blankBefore) {
930
+ var n = saved.split('\n').length, from = start - (blankBefore ? 1 : 0);
931
+ return { start: from, end: start + n - 1, expected: (blankBefore ? '\n' : '') + saved, text: null };
932
+ }
933
+
934
+ // Markdown typed at the start of a block makes it a heading, a list, or a quote; the marker goes, and the text after
935
+ // it is in the new block.
936
+ var SHORTCUT = /^(#{1,6}|[-*+]|\d+[.)]|>)[ \u00a0]/;
937
+ function shortcutKind(marker) {
938
+ return marker[0] === '#' ? 'h' + marker.length : marker === '>' ? 'quote' : /\d/.test(marker) ? 'ol' : 'ul';
939
+ }
940
+
941
+ /**
942
+ * The block marker typed at the start of `text` (`# `, `- `, `3. `, `> `): the marker, its kind, its length with
943
+ * the space, and the prefix a new block saves with it. Null when there is none.
944
+ */
945
+ function shortcut(text) {
946
+ var m = SHORTCUT.exec(text);
947
+ return m && { marker: m[1], kind: shortcutKind(m[1]), length: m[0].length, prefix: m[1] + ' ' };
948
+ }
949
+
950
+ /** The line of a block edited in place, after `marker` was typed at its start. A numbered item keeps the number typed (`3. `, `1) `). */
951
+ function shortcutLine(line, marker) {
952
+ var kind = shortcutKind(marker), out = setBlockKind(line, kind);
953
+ if (kind === 'ol') out = out.replace(/^(\s*)\d+[.)] /, function (x, ind) { return ind + marker + ' '; });
954
+ return out;
955
+ }
956
+
957
+ /** A paragraph that is only a list marker (`-`, `*`, `+`, `1.`, `1)`): Enter starts a list there. */
958
+ function onlyMarker(text) {
959
+ return /^([-*+]|\d+[.)])$/.test(text);
960
+ }
961
+
962
+ /** `===` or `---` at the start of a new list item: a divider or a slide break, not an item; the line leaves the list. */
963
+ function leavesList(text) {
964
+ return /^(?:===|---)/.test(text);
965
+ }
966
+
967
+ /**
968
+ * Tab (dir 1) or Shift+Tab (dir -1) on a new item with nothing saved yet: its prefix, worked out as if it were in the
969
+ * source after line `after` (the item before it). Null when it can't move.
970
+ */
971
+ function indentPrefix(lines, after, prefix, dir) {
972
+ var q = indentItem(lines.slice(0, after).concat([prefix + 'x'], lines.slice(after)), after + 1, dir);
973
+ return q && q.text.split('\n')[0].slice(0, -1);
974
+ }
975
+
762
976
  /** Whether a line ends in braces of its own (block attributes), not an inline element's. */
763
977
  function hasBlockAttrs(line) {
764
978
  return !!blockAttrs(line);
@@ -779,7 +993,7 @@
779
993
  '©': ['(c)', '(C)'], '®': ['(r)', '(R)'], '™': ['(tm)', '(TM)'], '±': ['+-'] };
780
994
  // What may stand between rendered characters: emphasis and code markers, link and span brackets with their target
781
995
  // or attributes, autolink brackets.
782
- var MARKUP = /^(?:\*+|_+|`+|~~|\[|\]\([^)\s]*(?:\s+(?:"[^"]*"|'[^']*'))?\)|\]\{[^{}]*\}|\]|\{[^{}]*\}|<|>)+$/;
996
+ var MARKUP = /^(?:\*|_|`|~~|\[|\]\([^)\s]*(?:\s+(?:"[^"]*"|'[^']*'))?\)|\]|\{[^{}]*\}|<|>)+$/;
783
997
  var ESCAPABLE = /[!-\/:-@\[-`{-~]/;
784
998
 
785
999
  /**
@@ -861,6 +1075,27 @@
861
1075
  alignRendered: alignRendered,
862
1076
  spliceRendered: spliceRendered,
863
1077
  hasBlockAttrs: hasBlockAttrs,
1078
+ LINE: LINE,
1079
+ rowCells: rowCells,
1080
+ lineParts: lineParts,
1081
+ contOf: contOf,
1082
+ blockParts: blockParts,
1083
+ joinLines: joinLines,
1084
+ nextItem: nextItem,
1085
+ mergeLines: mergeLines,
1086
+ splitLines: splitLines,
1087
+ LIST_ITEM: LIST_ITEM,
1088
+ afterBlock: afterBlock,
1089
+ addedText: addedText,
1090
+ insertBlock: insertBlock,
1091
+ insertBlank: insertBlank,
1092
+ dropBlank: dropBlank,
1093
+ dropLines: dropLines,
1094
+ shortcut: shortcut,
1095
+ shortcutLine: shortcutLine,
1096
+ onlyMarker: onlyMarker,
1097
+ leavesList: leavesList,
1098
+ indentPrefix: indentPrefix,
864
1099
  keepBlockAttrs: keepBlockAttrs,
865
1100
  spliceTyped: spliceTyped,
866
1101
  toggleWrap: toggleWrap,