@treasure-ai/treasure-deck 2026.11.0 → 2026.11.2

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/runtime/embed.js CHANGED
@@ -33,10 +33,10 @@
33
33
  // blue panel. Slide outlines use the deck's own accent.
34
34
  ':root{--ed-bg:#2b2e36;--ed-bg-2:#363a43;--ed-input:#20242c;--ed-line:#3a3e47;--ed-line-2:#4a4f59;--ed-fg:#dce0e5;' +
35
35
  '--ed-fg-2:#c0c6cd;--ed-muted:#8b95a1;--ed-accent:#7878ff;--ed-accent-text:#aab0ff;--ed-on-accent:#16181d;--ed-danger:#c2415a;' +
36
- '--ed-shadow:rgba(0,0,0,.5);--ed-backdrop:#20242c;--ed-stub-line:rgba(170,176,255,.35);--ed-stub-bg:rgba(120,120,255,.06);--ed-thumb:rgba(170,176,255,.5)}' +
36
+ '--ed-shadow:rgba(0,0,0,.5);--ed-backdrop:#20242c;--ed-stub-line:rgba(170,176,255,.35);--ed-stub-bg:rgba(120,120,255,.06);--ed-thumb:rgba(170,176,255,.5);--ed-hover:rgba(255,255,255,.07);--ed-press:rgba(255,255,255,.12);--ed-on:rgba(120,120,255,.24);--ed-tray:#30333c;--ed-raised:#454a55}' +
37
37
  '@media (prefers-color-scheme:light){:root{--ed-bg:#fff;--ed-bg-2:#f3f4fb;--ed-input:#f8f9fd;--ed-line:#e3e4f2;--ed-line-2:#cfd2ea;' +
38
38
  '--ed-fg:#1c1d33;--ed-fg-2:#3a3c5a;--ed-muted:#61637e;--ed-accent:#3240a4;--ed-accent-text:#3240a4;--ed-on-accent:#fff;' +
39
- '--ed-danger:#c2415a;--ed-shadow:rgba(30,36,110,.18);--ed-backdrop:#eceef8;--ed-stub-line:rgba(50,64,164,.35);--ed-stub-bg:rgba(50,64,164,.04);--ed-thumb:rgba(50,64,164,.4)}}' +
39
+ '--ed-danger:#c2415a;--ed-shadow:rgba(30,36,110,.18);--ed-backdrop:#eceef8;--ed-stub-line:rgba(50,64,164,.35);--ed-stub-bg:rgba(50,64,164,.04);--ed-thumb:rgba(50,64,164,.4);--ed-hover:rgba(28,29,51,.06);--ed-press:rgba(28,29,51,.11);--ed-on:#e1e5fb;--ed-tray:#f1f3fb;--ed-raised:#fff}}' +
40
40
  // Top to bottom: the thumbnail strip, a strip for the preview badge, the current slide (fit to the box between
41
41
  // them), and the editor. Out of edit mode, the slide alone.
42
42
  ':root{--thumbs-h:92px;--badge-h:30px;--editor-h:45vh}html,body{background:var(--ed-backdrop)}' +
@@ -104,6 +104,9 @@
104
104
 
105
105
  '.deck-doc [data-doc-classes]::after{content:attr(data-doc-classes);display:inline-block;margin-left:8px;padding:0 6px;border-radius:999px;vertical-align:middle;' +
106
106
  'border:1px solid var(--ed-line-2);color:var(--ed-accent-text);font:500 11px/16px ui-sans-serif,system-ui,sans-serif;-webkit-text-fill-color:var(--ed-accent-text)}' +
107
+ // A list's, table's, or quote's classes go under it, at its left edge (a table's as its caption).
108
+ '.deck-doc :is(ul,ol,blockquote)[data-doc-classes]::after{display:table;margin:2px 0 0 -1.5em}.deck-doc blockquote[data-doc-classes]::after{margin-left:0}' +
109
+ '.deck-doc table[data-doc-classes]::after{display:table-caption;caption-side:bottom;justify-self:start;width:max-content;margin:4px 0 0}' +
107
110
  '.deck-doc [data-src]:not(.slide-body){cursor:text}.deck-doc .doc-empty{color:var(--ed-muted);font-style:italic}' +
108
111
  // Text is typed where it is, like in a text editor: no box around the block being edited.
109
112
  '.deck-doc .deck-editing,.deck-doc [contenteditable]{outline:none;caret-color:var(--ed-accent)}' +
@@ -155,16 +158,17 @@
155
158
  '.ly-menu .ly-card:hover:not(:disabled){background:var(--ed-bg-2)}.ly-menu .ly-card.is-on{border-color:var(--ed-accent);color:var(--ed-accent-text)}' +
156
159
  '.ly-menu .ly-card:disabled{opacity:.35;cursor:default}.ly-menu .ly-card svg{width:58px;height:33px}' +
157
160
  '.ly-menu .ly-toggles{display:flex;gap:6px}.ly-menu .ly-toggles button{padding:3px 9px;border:1px solid var(--ed-line-2);border-radius:5px;background:var(--ed-bg-2);color:var(--ed-fg);font:inherit;cursor:pointer}' +
158
- '.ly-menu .ly-toggles button.is-on{background:var(--ed-accent);border-color:var(--ed-accent);color:var(--ed-on-accent)}' +
159
- '.deck-slide-bar .dsb-present{display:inline-flex}.deck-slide-bar .dsb-present button:first-child{border-radius:5px 0 0 5px}' +
160
- '.deck-slide-bar .dsb-present button:last-child{border-radius:0 5px 5px 0;margin-left:-1px;padding:3px 3px}.pv-menu{position:fixed;z-index:1001}' +
161
+ '.ly-menu .ly-toggles button.is-on{background:var(--ed-on);border-color:transparent;color:var(--ed-accent-text)}' +
162
+ '.deck-slide-bar .dsb-present{display:inline-flex}.deck-slide-bar .dsb-present button:first-child{border-radius:6px 0 0 6px}' +
163
+ '.deck-slide-bar .dsb-present button:last-child{border-radius:0 6px 6px 0;margin-left:-1px;width:22px;padding:0;justify-content:center}.pv-menu{position:fixed;z-index:1001}' +
161
164
  '.pb-menu .pb-note{max-width:320px;padding:6px 10px;font-size:12px;color:var(--ed-muted)}' +
162
165
  '.deck-index-panel{position:fixed;inset:0;z-index:1100;display:flex;flex-direction:column;background:var(--ed-bg)}.deck-index-panel[hidden]{display:none}' +
163
166
  '.deck-index-panel .dip-head{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--ed-line);font:12px/1.3 ui-sans-serif,system-ui,sans-serif;color:var(--ed-muted)}' +
164
167
  '.deck-index-panel .dip-head span{flex:1}.deck-index-panel .dip-head button{display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border:1px solid var(--ed-line-2);' +
165
168
  'border-radius:5px;background:var(--ed-bg-2);color:var(--ed-fg);font:inherit;cursor:pointer}.deck-index-panel iframe{flex:1;width:100%;border:0}' +
166
- '.deck-slide-bar .dsb-view{display:inline-flex}.deck-slide-bar .dsb-view button{border-radius:0}.deck-slide-bar .dsb-view button:first-child{border-radius:5px 0 0 5px}' +
167
- '.deck-slide-bar .dsb-view button:last-child{border-radius:0 5px 5px 0;margin-left:-1px}' +
169
+ // Formatted | Markdown: a segmented control, the view shown raised.
170
+ '.deck-slide-bar .dsb-view{display:inline-flex;gap:2px;padding:2px;border-radius:8px;background:var(--ed-tray)}.deck-slide-bar .dsb-view button{height:24px;border-radius:6px}' +
171
+ '.deck-slide-bar .dsb-view button.is-on{background:var(--ed-raised);color:var(--ed-fg);box-shadow:0 1px 2px var(--ed-shadow)}' +
168
172
  '.deck-src-popover{position:fixed;z-index:1000;display:flex;flex-direction:column;gap:6px;padding:8px;border-radius:8px;' +
169
173
  'background:var(--ed-bg);border:1px solid var(--ed-line);box-shadow:0 8px 28px var(--ed-shadow);font:12px/1.4 ui-sans-serif,system-ui,sans-serif;color:var(--ed-muted)}' +
170
174
  '.deck-src-popover textarea{font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--ed-fg);background:var(--ed-input);' +
@@ -182,20 +186,35 @@
182
186
  '.deck-slide-bar .dsb-group{display:inline-flex;align-items:center;gap:6px}' +
183
187
  '.deck-slide-bar .dsb-hint{white-space:normal;line-height:1.3}' +
184
188
  '@container (max-width:760px){.deck-slide-bar .dsb-words,.deck-slide-bar .ly-label{display:none}.deck-slide-bar button:has(> .dsb-words){padding:3px 5px}}' +
185
- '.deck-slide-bar .dsb-context{border-top:1px solid var(--ed-line)}.dsb-context .dsb-hint,.dsb-context .dsb-label{color:var(--ed-muted)}' +
186
- '.deck-slide-bar button.is-on{background:var(--ed-accent);border-color:var(--ed-accent);color:var(--ed-on-accent)}' +
187
- '.deck-slide-bar .dsb-sep{width:1px;height:18px;margin:0 3px;background:var(--ed-line-2);flex:none}' +
189
+ // The second row (what is selected) sits in a tray, as a slide editor's formatting bar does.
190
+ '.deck-slide-bar .dsb-context{margin:0 -4px 6px;padding:0 6px;border-radius:10px;background:var(--ed-tray)}' +
191
+ '.dsb-context .dsb-hint,.dsb-context .dsb-label{color:var(--ed-muted)}.dsb-context .dsb-label{font-size:11px;font-weight:600;letter-spacing:.03em;margin-right:2px}' +
192
+ '.deck-slide-bar button.is-on{background:var(--ed-on);border-color:transparent;color:var(--ed-accent-text)}' +
193
+ '.deck-slide-bar .dsb-sep{width:1px;height:20px;margin:0 4px;background:var(--ed-line-2);flex:none}' +
188
194
  '.deck-slide-bar .dsb-size{color:var(--ed-accent-text);font-variant-numeric:tabular-nums;margin-left:4px}' +
189
195
  '.deck-slide-bar button{display:inline-flex;align-items:center;gap:4px}.deck-slide-bar button[hidden],.deck-slide-bar .dsb-size[hidden]{display:none}' +
190
196
  '.deck-slide-bar button svg{width:16px;height:16px;flex:none}' +
191
- '.deck-slide-bar :is(.dsb-row, .dsb-group) > button:has(> svg:only-child){padding:3px 5px}' +
197
+ '.deck-slide-bar :is(.dsb-row, .dsb-group) > button:has(> svg:only-child){width:28px;padding:0;justify-content:center}' +
192
198
  '.deck-slide-bar button:disabled{opacity:.35;cursor:default}' +
193
199
  '.deck-slide-bar .dsb-style-label{max-width:180px;overflow:hidden;text-overflow:ellipsis}' +
194
- '.deck-slide-bar button.is-set{border-color:var(--ed-accent);color:var(--ed-accent-text)}' +
195
- '.dsb-menu{position:fixed;z-index:1001;display:flex;flex-wrap:wrap;gap:4px;max-width:300px;padding:6px;border-radius:7px;' +
196
- 'background:var(--ed-bg);border:1px solid var(--ed-line);box-shadow:0 6px 18px var(--ed-shadow)}.dsb-menu[hidden]{display:none}' +
200
+ '.deck-slide-bar button.is-set{border-color:color-mix(in srgb,var(--ed-accent) 55%,transparent);background:var(--ed-on);color:var(--ed-accent-text)}' +
201
+ // The Style menu: a list, each class with what it does, and a check on those set.
202
+ '.dsb-menu{position:fixed;z-index:1001;display:flex;flex-direction:column;min-width:220px;padding:4px;border-radius:8px;' +
203
+ 'background:var(--ed-bg);border:1px solid var(--ed-line-2);box-shadow:0 8px 24px var(--ed-shadow)}.dsb-menu[hidden]{display:none}' +
204
+ '.deck-slide-bar .dsb-menu button{justify-content:flex-start;gap:8px;height:auto;padding:5px 8px;color:var(--ed-fg)}' +
205
+ '.deck-slide-bar .dsb-menu button::before{content:"";flex:none;width:14px;color:var(--ed-accent-text);font-weight:700}' +
206
+ '.deck-slide-bar .dsb-menu button.is-on{background:transparent;color:var(--ed-fg)}.deck-slide-bar .dsb-menu button.is-on::before{content:"\\2713"}' +
207
+ '.deck-slide-bar .dsb-menu button.is-on:hover{background:var(--ed-hover)}' +
208
+ '.dsb-menu .dm-name{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.dsb-menu .dm-what{margin-left:auto;padding-left:16px;color:var(--ed-muted);font-weight:400}' +
197
209
  '.deck-slide-bar[hidden]{display:none}.deck-slide-bar .dsb-num{font-weight:600;white-space:nowrap;margin-right:2px}.deck-slide-bar .dsb-gap{flex:1}' +
198
- '.deck-slide-bar select,.deck-slide-bar button{font:inherit;color:var(--ed-fg);background:var(--ed-bg-2);border:1px solid var(--ed-line-2);border-radius:5px;padding:2px 7px;cursor:pointer;white-space:nowrap}' +
210
+ // Buttons as in a slide editor's toolbar: borderless, a tint on hover and press, the ones that are on tinted with the
211
+ // accent; a menu's button and a split button keep a hairline, so they read as one control.
212
+ '.deck-slide-bar select,.deck-slide-bar button{font:inherit;font-weight:500;color:var(--ed-fg-2);background:transparent;border:1px solid transparent;border-radius:6px;' +
213
+ 'height:28px;box-sizing:border-box;padding:0 8px;cursor:pointer;white-space:nowrap;transition:background-color .12s,color .12s,border-color .12s}' +
214
+ '.deck-slide-bar button:hover:not(:disabled):not(.is-on):not(.is-confirm){background:var(--ed-hover);color:var(--ed-fg)}' +
215
+ '.deck-slide-bar button:active:not(:disabled):not(.is-confirm){background:var(--ed-press)}' +
216
+ '.deck-slide-bar button:focus-visible{outline:2px solid var(--ed-accent);outline-offset:1px}' +
217
+ '.deck-slide-bar :is(.dsb-layout,[data-style-menu],.dsb-present > button){border-color:var(--ed-line-2)}' +
199
218
  '.deck-slide-bar button:disabled,.deck-slide-bar select:disabled{opacity:.4;cursor:default}' +
200
219
  '.deck-slide-bar button.is-confirm{background:var(--ed-danger);border-color:var(--ed-danger);color:#fff}' +
201
220
  // Hidden slides (shown here, not presented): dimmed in the strip, with Unhide in edit mode, and marked on the slide.
@@ -211,6 +230,7 @@
211
230
  'background:var(--ed-bg-2);border:1px solid var(--ed-line-2);border-radius:4px;padding:0 5px;cursor:pointer}' +
212
231
  '.deck-doc .doc-slide.is-hidden > .doc-sep span::after{content:" \\00b7 hidden"}.deck-slide-bar .dsb-hidden{color:var(--ed-muted);font-weight:500}' +
213
232
  '.deck.is-stale .slide{opacity:.6;transition:opacity .2s}' +
233
+ '.deck .deck-table-picked{outline:2px solid var(--deck-accent,var(--ed-accent));outline-offset:3px}.deck-table-handle{cursor:ew-resize}.deck-table-handle[hidden]{display:none}' +
214
234
  '.deck .deck-img-picked{outline:3px solid var(--deck-accent,var(--ed-accent));outline-offset:3px}.deck-stage .deck-img-picked:is(img,video){cursor:move;touch-action:none}' +
215
235
  '.deck-img-handle{position:fixed;z-index:1001;width:14px;height:14px;border-radius:3px;background:var(--ed-accent);border:2px solid var(--ed-bg);cursor:nwse-resize;touch-action:none}' +
216
236
  '.deck-img-guide{position:fixed;z-index:1000;border-left:2px dashed var(--ed-accent);pointer-events:none;font:11px/1 ui-sans-serif,system-ui,sans-serif;' +
@@ -1391,7 +1411,8 @@
1391
1411
  previewMenu.innerHTML = '<button data-pv="browser">' + icon('external-link', '') + 'Open in the browser</button>' +
1392
1412
  '<button data-pv="copy">' + icon('copy', '') + 'Copy link</button>' +
1393
1413
  // A host page keeps the edits in its own buffer, so the file on disk (what /__pdf prints) may not have them yet.
1394
- (host ? '' : '<button data-pv="pdf">' + icon('file-down', '') + '<span class="pv-words">Export PDF</span></button>');
1414
+ (host ? '' : '<button data-pv="pdf">' + icon('file-down', '') + '<span class="pv-words">Export PDF</span></button>' +
1415
+ '<button data-pv="slides">' + icon('presentation', '') + '<span class="pv-words">Export to Google Slides</span></button>');
1395
1416
  document.body.appendChild(previewMenu);
1396
1417
  function togglePreviewMenu(b) {
1397
1418
  previewMenu.hidden = !previewMenu.hidden;
@@ -1407,6 +1428,7 @@
1407
1428
  var pv = b.getAttribute('data-pv');
1408
1429
  if (pv === 'browser') preview(current);
1409
1430
  else if (pv === 'pdf') exportPdf();
1431
+ else if (pv === 'slides') exportSlides();
1410
1432
  else copyLink(current);
1411
1433
  });
1412
1434
  document.addEventListener('mousedown', function (e) {
@@ -1443,6 +1465,41 @@
1443
1465
  }, function (e) { done('Couldn\u2019t export the PDF: ' + e, 6000); });
1444
1466
  }
1445
1467
 
1468
+ // Export to Google Slides: POST /__slides exports the deck as saved, as `deck slides` does, and opens the
1469
+ // presentation. The first export makes a new one, whose URL goes in the frontmatter (`slides:`, as an edit that can
1470
+ // be undone), so the next export updates it in place. It takes a minute or so; a second click meanwhile is ignored.
1471
+ var exportingSlides = false;
1472
+ function exportSlides() {
1473
+ if (exportingSlides) return;
1474
+ endEdits();
1475
+ if (md.timer) mdSave();
1476
+ exportingSlides = true;
1477
+ var item = previewMenu.querySelector('[data-pv="slides"]');
1478
+ item.disabled = true;
1479
+ item.querySelector('.pv-words').textContent = 'Exporting to Google Slides\u2026';
1480
+ toast('Exporting to Google Slides\u2026 (about a minute)', 0);
1481
+ var done = function (message, ms) {
1482
+ exportingSlides = false;
1483
+ item.disabled = false;
1484
+ item.querySelector('.pv-words').textContent = 'Export to Google Slides';
1485
+ if (message) toast(message, ms);
1486
+ };
1487
+ queue.then(function () {
1488
+ if (notSaved) return { ok: false, reason: 'cancelled' };
1489
+ return fetch('/__slides', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}' }).then(function (r) { return r.json(); });
1490
+ }).then(function (r) {
1491
+ if (r && r.reason === 'cancelled') return done();
1492
+ if (!r || !r.ok) return done('Couldn\u2019t export to Google Slides: ' + ((r && r.reason) || 'unknown error'), 10000);
1493
+ if (!r.created) return done('Updated the Google Slides presentation', 4000);
1494
+ // Quietly, so the toast says what was exported rather than "Saved".
1495
+ submit(function () {
1496
+ var f = mainFile(), lines = sourceLines(f), p = lines && core.setMeta(lines, 'slides', r.url);
1497
+ if (p) p.file = f;
1498
+ return p;
1499
+ }, function () { done('Exported to a new presentation; its link is now in the frontmatter (slides:)', 5000); }, true);
1500
+ }, function (e) { done('Couldn\u2019t export to Google Slides: ' + e, 10000); });
1501
+ }
1502
+
1446
1503
  // Publish (with a host process): POST /__publish waits while Treasure Work builds the deck, asks for the audience
1447
1504
  // the first time, and deploys it to Apps Script, then answers with the page's URL. Republishing updates the same
1448
1505
  // page. Treasure Work shows the result, so the ▾ menu stays closed; it opens the page or copies its link.
@@ -1542,7 +1599,7 @@
1542
1599
  // to preset widths (25-100% of the column, with a guide) and otherwise writes canvas pixels rounded to 10; an
1543
1600
  // image sized by h= alone resizes by h=, snapping to 50px steps. Dragging the image itself pins it where it is
1544
1601
  // dropped (at=), and In flow takes it back out.
1545
- var STYLE_CLASSES = ['lead', 'center', 'muted', 'small', 'subtitle', 'meta', 'callout', 'note', 'warn'];
1602
+ var STYLE_CLASSES = ['lead', 'center', 'right', 'muted', 'small', 'subtitle', 'meta', 'callout', 'note', 'warn'];
1546
1603
  var ctx = bar.querySelector('.dsb-context');
1547
1604
  function showContext(node) {
1548
1605
  ctx.innerHTML = '';
@@ -1588,20 +1645,56 @@
1588
1645
  var LIST_ITEM = core.LIST_ITEM;
1589
1646
  var textRow = null;
1590
1647
 
1648
+ // What the Style menu styles for the block being edited, and with which classes. A heading or paragraph takes its
1649
+ // classes in its last line's trailing {…}; a list item, table cell, or a paragraph in a quote styles the whole
1650
+ // (outermost) list, table, or quote, on the {…} line after it. `reason` says why the menu is off, when it is.
1651
+ // What each class does, shown beside it in the Style menu.
1652
+ var CLASS_WHAT = { lead: 'Larger, the key point', center: 'Centered', right: 'Right-aligned', muted: 'Quieter color', small: 'Smaller, for sources',
1653
+ subtitle: 'Under a title', meta: 'Date or byline', callout: 'Boxed aside', note: 'Side-ruled note', warn: 'Warning box', steps: 'Numbered chevrons' };
1654
+ var STYLE_KINDS = {
1655
+ text: { label: 'Style', classes: STYLE_CLASSES },
1656
+ UL: { label: 'List style', classes: ['lead', 'small', 'muted', 'callout', 'note', 'warn'] },
1657
+ OL: { label: 'List style', classes: ['lead', 'small', 'muted', 'callout', 'note', 'warn', 'steps'] },
1658
+ BLOCKQUOTE: { label: 'Quote style', classes: ['lead', 'small', 'muted', 'center', 'right'] },
1659
+ TABLE: { label: 'Table style', classes: ['lead', 'small', 'muted'] },
1660
+ };
1591
1661
  function styleTarget(block) {
1592
- if (!core || !/^(H[1-6]|P)$/.test(block.tagName) || block.closest('li, td, th, blockquote')) return null;
1593
- var src = parseSrc(block.getAttribute('data-src'));
1594
- if (!src || src.start !== src.end) return null;
1595
- var line = (linesOf(src) || [])[0];
1596
- if (line === undefined) return null;
1597
- var written = core.lineClasses(line).filter(function (c) { return STYLE_CLASSES.indexOf(c) >= 0; }).sort().join(' ');
1598
- var shown = STYLE_CLASSES.filter(function (c) { return block.classList.contains(c); }).sort().join(' ');
1599
- return { src: src, trusted: written === shown };
1662
+ if (!core) return null;
1663
+ var whole = null;
1664
+ for (var n = block.parentNode; n && n.nodeType === 1 && !n.classList.contains('doc-slide'); n = n.parentNode) {
1665
+ if (STYLE_KINDS[n.tagName]) whole = n;
1666
+ }
1667
+ var el = whole || block, kind = STYLE_KINDS[whole ? whole.tagName : 'text'];
1668
+ var t = { el: el, whole: !!whole, label: kind.label, classes: kind.classes, src: null, reason: '', apart: !!whole && whole.tagName !== 'BLOCKQUOTE' };
1669
+ if (!whole && !/^(H[1-6]|P)$/.test(block.tagName)) { t.reason = 'This block takes no classes'; return t; }
1670
+ var src = parseSrc(el.getAttribute('data-src')), lines = src && sourceLines(src.file);
1671
+ if (!src || !lines || src.end > lines.length) {
1672
+ t.reason = adding ? 'Type the block first, then pick its style' : 'Updating the preview: try again in a moment';
1673
+ return t;
1674
+ }
1675
+ var written = (whole ? core.afterClasses(lines, src.start, src.end, t.apart) : core.lineClasses(lines[src.end - 1]))
1676
+ .filter(function (c) { return kind.classes.indexOf(c) >= 0; }).sort().join(' ');
1677
+ var shown = kind.classes.filter(function (c) { return el.classList.contains(c); }).sort().join(' ');
1678
+ if (written !== shown) { t.reason = 'Its {…} belongs to an inline element: edit its Markdown to change classes'; return t; }
1679
+ t.src = src;
1680
+ return t;
1681
+ }
1682
+ // The lines of the edit in progress, if any, to keep a class's patch from racing its save.
1683
+ function editedSrc() {
1684
+ return editing ? editing.target.src : fmt ? fmt.target.src : popover ? popover.src : null;
1685
+ }
1686
+ // Before a patch to a list's, table's, or quote's {…} line: the edit in an item or cell carries on, unless its lines
1687
+ // take in the braces (the parser counts braces right under the block as its last item's or the table's), when it is
1688
+ // saved first.
1689
+ function endEditOverBraces(block) {
1690
+ var mine = editedSrc(), now = block && sourceLines(block.file);
1691
+ if (mine && now && mine.file === block.file && mine.end >= block.end && core.isBracesLine(now[mine.end - 1])) endEdits();
1600
1692
  }
1601
1693
  function hideTextRow() {
1602
1694
  if (!textRow) return;
1603
1695
  clearContext(textRow.box);
1604
1696
  textRow.menu.remove();
1697
+ if (textRow.off) textRow.off();
1605
1698
  textRow = null;
1606
1699
  }
1607
1700
  // The marks the text row shows as on: those the selection is in, read from the Markdown in the popover, and on the
@@ -1642,6 +1735,153 @@
1642
1735
  function button(attrs, label, title, on) {
1643
1736
  return '<button ' + attrs + (title ? ' title="' + title + '"' : '') + (on ? ' class="is-on"' : '') + '>' + label + '</button>';
1644
1737
  }
1738
+ // Left, Center, and Right buttons, as `attr`="left" and so on.
1739
+ var ALIGNS = [['left', 'align-left', 'Left'], ['center', 'align-center', 'Center'], ['right', 'align-right', 'Right']];
1740
+ function alignButtons(attr, what) {
1741
+ return ALIGNS.map(function (a) { return button(attr + '="' + a[0] + '"', icon(a[1], a[2]), a[2] + ': ' + what); }).join('');
1742
+ }
1743
+ // A table's width, while text in it is edited: presets in the text row, and a handle on the right edge of the
1744
+ // slide's table that drags it wider or narrower, snapping to the image presets (25-100% of the column, with a
1745
+ // guide) and otherwise writing canvas px rounded to 10. Written as w= on the table's {…} line; Auto takes it out.
1746
+ // Returns what takes the handle away again.
1747
+ var TABLE_WIDTHS = [['', 'Auto'], ['50%', '50%'], ['75%', '75%'], ['100%', '100%']];
1748
+ function tableSize(box, st) {
1749
+ var src0 = parseSrc(st.el.getAttribute('data-src')), lines = sourceLines(src0.file);
1750
+ var w = core.attrValue(core.afterAttrs(lines, src0.start, src0.end, true), 'w');
1751
+ box.insertAdjacentHTML('beforeend', '<span class="dsb-sep"></span>' + alignButtons('data-talign', 'the table in its column') +
1752
+ '<span class="dsb-sep"></span><span class="dsb-label">Width</span>' + TABLE_WIDTHS.map(function (x) {
1753
+ return button('data-tw="' + x[0] + '"', x[1], x[0] ? 'The table ' + x[1] + ' of its column (w=' + x[0] + ')' : 'The table as wide as its content needs, or its column for a table with % columns (no w=)');
1754
+ }).join('') + '<span class="dsb-size" title="Width as written"></span>');
1755
+ var sizeEl = box.querySelector('.dsb-size');
1756
+ var show = function (v) {
1757
+ sizeEl.textContent = v && !TABLE_WIDTHS.some(function (x) { return x[0] === v; }) ? 'w=' + v : '';
1758
+ box.querySelectorAll('[data-tw]').forEach(function (b) { b.classList.toggle('is-on', b.getAttribute('data-tw') === (v || '')); });
1759
+ };
1760
+ show(typeof w === 'string' ? w : '');
1761
+ // Its place in the column: {center} or {right} on its {…} line, as on an image; Left takes them out.
1762
+ var showPlace = function () {
1763
+ var now = st.el.classList.contains('table-right') ? 'right' : st.el.classList.contains('table-center') ? 'center' : 'left';
1764
+ box.querySelectorAll('[data-talign]').forEach(function (b) { b.classList.toggle('is-on', b.getAttribute('data-talign') === now); });
1765
+ };
1766
+ showPlace();
1767
+ var save = function (v) {
1768
+ endEditOverBraces(parseSrc(st.el.getAttribute('data-src')));
1769
+ submit(function () {
1770
+ var src = parseSrc(st.el.getAttribute('data-src')), ls = src && sourceLines(src.file);
1771
+ var p = ls && core.setAfterAttrs(ls, src.start, src.end, { w: v || null }, null, true);
1772
+ if (p) p.file = src.file;
1773
+ return p;
1774
+ });
1775
+ };
1776
+ // The table on the slide (found again after the slide is rebuilt, from the text still being edited in it).
1777
+ var onSlide = function () {
1778
+ if (!st.el.isConnected) {
1779
+ var cur = editing ? editing.el : fmt ? fmt.el : popover ? popover.el : document.activeElement, again = cur && cur.isConnected && cur.closest('table');
1780
+ if (again) st.el = again;
1781
+ }
1782
+ var i = sectionOf(st.el);
1783
+ if (i < 0 || !slides[i] || !st.el.isConnected) return null;
1784
+ // (While text is edited the editor keeps its copy of the slide, whose table may end a line short of the rebuilt
1785
+ // one's, now with its {…} line: then by where it starts.)
1786
+ var mine = parseSrc(st.el.getAttribute('data-src'));
1787
+ return twin(st.el, docSection(i), slides[i].el) || Array.prototype.find.call(slides[i].el.querySelectorAll('table[data-src]'), function (x) {
1788
+ var o = parseSrc(x.getAttribute('data-src'));
1789
+ return mine && o && o.file === mine.file && o.start === mine.start;
1790
+ }) || null;
1791
+ };
1792
+ box.addEventListener('click', function (e) {
1793
+ var pb = e.target.closest && e.target.closest('button[data-talign]');
1794
+ if (pb) {
1795
+ var a = pb.getAttribute('data-talign'), flags = { center: a === 'center', right: a === 'right' };
1796
+ [st.el, onSlide()].forEach(function (x) { if (x) { x.classList.toggle('table-center', flags.center); x.classList.toggle('table-right', flags.right); } });
1797
+ showPlace();
1798
+ place();
1799
+ endEditOverBraces(parseSrc(st.el.getAttribute('data-src')));
1800
+ submit(function () {
1801
+ var src = parseSrc(st.el.getAttribute('data-src')), ls = src && sourceLines(src.file);
1802
+ var p = ls && core.setAfterAttrs(ls, src.start, src.end, flags, null, true);
1803
+ if (p) p.file = src.file;
1804
+ return p;
1805
+ });
1806
+ return;
1807
+ }
1808
+ var b = e.target.closest && e.target.closest('button[data-tw]');
1809
+ if (!b) return;
1810
+ var v = b.getAttribute('data-tw'), t = onSlide();
1811
+ // (Without w=, a table with a % column spans its column, as the build has it.)
1812
+ if (t) { t.style.width = v || (Array.prototype.some.call(t.querySelectorAll('th'), function (th) { return /%$/.test(th.style.width); }) ? '100%' : ''); place(); }
1813
+ show(v);
1814
+ save(v);
1815
+ });
1816
+ var handle = document.createElement('div'), guide = document.createElement('div');
1817
+ handle.className = 'deck-img-handle deck-table-handle';
1818
+ handle.title = 'Drag to resize the table';
1819
+ guide.className = 'deck-img-guide';
1820
+ guide.hidden = true;
1821
+ document.body.appendChild(handle);
1822
+ document.body.appendChild(guide);
1823
+ var shown = null;
1824
+ var place = function () {
1825
+ var t = onSlide();
1826
+ if (shown && shown !== t) shown.classList.remove('deck-table-picked');
1827
+ shown = t;
1828
+ handle.hidden = !t || !deck.classList.contains('is-edit');
1829
+ if (handle.hidden) return;
1830
+ t.classList.add('deck-table-picked');
1831
+ var r = t.getBoundingClientRect();
1832
+ handle.style.left = (r.right - 7) + 'px';
1833
+ handle.style.top = (r.top + r.height / 2 - 7) + 'px';
1834
+ };
1835
+ place();
1836
+ // (After a rebuild, once the editor below has its copy of the slide again.)
1837
+ var later = function () { setTimeout(place, 0); };
1838
+ window.addEventListener('resize', place);
1839
+ document.addEventListener('deck:slides-updated', later);
1840
+ handle.addEventListener('pointerdown', function (e) {
1841
+ var t = onSlide();
1842
+ if (!t) return;
1843
+ // (Not taking the focus from the text being edited.)
1844
+ e.preventDefault();
1845
+ try { handle.setPointerCapture(e.pointerId); } catch (err) { /* drag without capture */ }
1846
+ var k = t.offsetWidth / t.getBoundingClientRect().width, column = t.parentElement, cs = getComputedStyle(column);
1847
+ // A % width is a share of the column's content box.
1848
+ var padL = parseFloat(cs.paddingLeft) || 0, colW = column.clientWidth - padL - (parseFloat(cs.paddingRight) || 0);
1849
+ var w0 = t.offsetWidth, x0 = e.clientX, value = null;
1850
+ var move = function (ev) {
1851
+ var px = w0 + (ev.clientX - x0) * k, pct = px / colW * 100;
1852
+ var preset = PRESETS.find(function (x) { return Math.abs(pct - x) <= 2.5; }) || null;
1853
+ value = preset ? preset + '%' : String(Math.max(60, Math.round(px / 10) * 10));
1854
+ t.style.width = preset ? value : value + 'px';
1855
+ show(value);
1856
+ guide.hidden = !preset;
1857
+ if (preset) {
1858
+ var cr = column.getBoundingClientRect();
1859
+ guide.innerHTML = '<span>' + value + '</span>';
1860
+ guide.style.left = (cr.left + (padL + colW * preset / 100) / k) + 'px';
1861
+ guide.style.top = cr.top + 'px';
1862
+ guide.style.height = cr.height + 'px';
1863
+ }
1864
+ place();
1865
+ };
1866
+ var end = function () {
1867
+ handle.removeEventListener('pointermove', move);
1868
+ handle.removeEventListener('pointerup', up);
1869
+ handle.removeEventListener('pointercancel', end);
1870
+ guide.hidden = true;
1871
+ };
1872
+ var up = function () { end(); if (value !== null) save(value); };
1873
+ handle.addEventListener('pointermove', move);
1874
+ handle.addEventListener('pointerup', up);
1875
+ handle.addEventListener('pointercancel', end);
1876
+ });
1877
+ return function () {
1878
+ window.removeEventListener('resize', place);
1879
+ document.removeEventListener('deck:slides-updated', later);
1880
+ if (shown) shown.classList.remove('deck-table-picked');
1881
+ handle.remove();
1882
+ guide.remove();
1883
+ };
1884
+ }
1645
1885
  function showTextRow(block) {
1646
1886
  hideTextRow();
1647
1887
  if (!core) return;
@@ -1666,19 +1906,23 @@
1666
1906
  var menu = document.createElement('div');
1667
1907
  menu.className = 'dsb-menu';
1668
1908
  menu.hidden = true;
1909
+ if (st && !st.reason && (!st.whole || st.el.tagName === 'BLOCKQUOTE')) box.innerHTML += '<span class="dsb-sep"></span>' + alignButtons('data-align', st.whole ? 'the quote' : 'the text');
1669
1910
  if (st) {
1670
- box.innerHTML += '<span class="dsb-sep"></span>' + button('data-style-menu' + (st.trusted ? '' : ' disabled'),
1911
+ box.innerHTML += '<span class="dsb-sep"></span>' + button('data-style-menu' + (st.reason ? ' disabled' : ''),
1671
1912
  '<span class="dsb-style-label"></span>' + icon('chevron-down', '▾'),
1672
- st.trusted ? 'Classes for this block' : 'Its {…} belongs to an inline element: edit its Markdown to change classes');
1673
- menu.innerHTML = STYLE_CLASSES.map(function (c) { return button('data-cls="' + c + '"', c, '', block.classList.contains(c)); }).join('');
1913
+ st.reason || (st.whole ? 'Classes for the whole ' + st.label.split(' ')[0].toLowerCase() : 'Classes for this block'));
1914
+ menu.innerHTML = st.classes.map(function (c) {
1915
+ return button('data-cls="' + c + '"', '<span class="dm-name">' + c + '</span><span class="dm-what">' + (CLASS_WHAT[c] || '') + '</span>', '', st.el.classList.contains(c));
1916
+ }).join('');
1674
1917
  }
1918
+ var off = st && !st.reason && st.el.tagName === 'TABLE' ? tableSize(box, st) : null;
1675
1919
  bar.appendChild(menu);
1676
- // The button shows the block's classes, so what is set is visible without opening the menu.
1920
+ // The button names what it styles and shows the classes set, so what is set is visible without opening the menu.
1677
1921
  var showClasses = function () {
1678
1922
  var label = box.querySelector('.dsb-style-label');
1679
1923
  if (!label) return;
1680
- var on = STYLE_CLASSES.filter(function (c) { return block.classList.contains(c); });
1681
- label.textContent = on.length ? on.join(', ') : 'Style';
1924
+ var on = st.classes.filter(function (c) { return st.el.classList.contains(c); });
1925
+ label.textContent = on.length ? st.label + ': ' + on.join(', ') : st.label;
1682
1926
  label.parentNode.classList.toggle('is-set', on.length > 0);
1683
1927
  };
1684
1928
  showClasses();
@@ -1697,36 +1941,76 @@
1697
1941
  menu.style.top = (r.bottom + 6) + 'px';
1698
1942
  }
1699
1943
  });
1700
- menu.addEventListener('click', function (e) {
1701
- var b = e.target.closest && e.target.closest('button[data-cls]');
1702
- if (!b) return;
1703
- var cls = b.getAttribute('data-cls'), on = !b.classList.contains('is-on'), src = st.src;
1704
- // The class goes with what is being edited, so the edit (and the selection) carries on; it is saved when the
1705
- // edit ends. The menu stays open for another class.
1706
- if (editing) {
1707
- var t = editing.target, full = core.setLineClass([t.before + t.text + t.after], 1, cls, on);
1708
- if (full) { t.after = full.text.slice(t.before.length + t.text.length); liveInline(editing); }
1944
+ // Sets classes on what the menu styles (`changes`: class → on or off), as one change.
1945
+ // The block's lines as they are when the patch is built: typing since the row opened may have moved them.
1946
+ var srcNow = function () { return parseSrc(st.el.getAttribute('data-src')); };
1947
+ var setClasses = function (changes) {
1948
+ var names = Object.keys(changes);
1949
+ // A block's line (or its lines, joined) with the classes changed, or null when that changes nothing.
1950
+ var onLine = function (line) {
1951
+ var next = line;
1952
+ names.forEach(function (c) { var p = core.setLineClass([next], 1, c, changes[c]); if (p) next = p.text; });
1953
+ return next === line ? null : next;
1954
+ };
1955
+ if (st.whole) {
1956
+ // The list's, table's, or quote's {…} line is after its lines, so the edit in an item or cell carries on.
1957
+ endEditOverBraces(srcNow());
1958
+ submit(function () {
1959
+ var src = srcNow(), lines = src && sourceLines(src.file);
1960
+ var p = lines && core.setAfterAttrs(lines, src.start, src.end, null, changes, st.apart);
1961
+ if (p) p.file = src.file;
1962
+ return p;
1963
+ });
1964
+ } else if (editing) {
1965
+ // The class goes with what is being edited, so the edit (and the selection) carries on; it is saved when the
1966
+ // edit ends. The menu stays open for another class.
1967
+ var t = editing.target, full = onLine(t.before + t.text + t.after);
1968
+ if (full !== null) { t.after = full.slice(t.before.length + t.text.length); liveInline(editing); }
1709
1969
  } else if (fmt) {
1710
- var pending = core.setLineClass([fmt.line], 1, cls, on);
1711
- if (pending) { fmt.line = pending.text; liveFormat(fmt); }
1970
+ var pending = onLine(fmt.line);
1971
+ if (pending !== null) { fmt.line = pending; liveFormat(fmt); }
1712
1972
  } else if (popover && popover.ta.value.indexOf('\n') < 0) {
1713
- var typed = core.setLineClass([popover.ta.value], 1, cls, on);
1714
- if (typed) { popover.ta.value = typed.text; livePopover(popover); }
1973
+ var typed = onLine(popover.ta.value);
1974
+ if (typed !== null) { popover.ta.value = typed; livePopover(popover); }
1715
1975
  } else {
1716
- // (A popover that now spans several lines: save it first, then the class on the line it left.)
1976
+ // (A popover of several lines: save it first, then the classes on the block's last line.)
1717
1977
  closePopover(true);
1718
1978
  submit(function () {
1719
- var lines = sourceLines(src.file);
1720
- var p = lines && core.setLineClass(lines, src.start, cls, on);
1979
+ var src = srcNow(), lines = src && sourceLines(src.file), next = lines && onLine(lines[src.end - 1]);
1980
+ var p = next ? core.replaceLine(lines, src.end, next) : null;
1721
1981
  if (p) p.file = src.file;
1722
1982
  return p;
1723
1983
  });
1724
1984
  }
1725
- block.classList.toggle(cls, on);
1726
- b.classList.toggle('is-on', on);
1985
+ names.forEach(function (c) {
1986
+ st.el.classList.toggle(c, changes[c]);
1987
+ var mb = menu.querySelector('[data-cls="' + c + '"]');
1988
+ if (mb) mb.classList.toggle('is-on', changes[c]);
1989
+ });
1727
1990
  showClasses();
1991
+ showAlign();
1992
+ };
1993
+ menu.addEventListener('click', function (e) {
1994
+ var b = e.target.closest && e.target.closest('button[data-cls]');
1995
+ if (!b) return;
1996
+ var changes = {};
1997
+ changes[b.getAttribute('data-cls')] = !b.classList.contains('is-on');
1998
+ setClasses(changes);
1999
+ });
2000
+ // Alignment, for a heading or paragraph, or a quote: Left takes .center and .right off, Center and Right set one.
2001
+ // (A table's place in its column is with its width, in tableSize; a list has none.)
2002
+ var showAlign = function () {
2003
+ var now = st.el.classList.contains('right') ? 'right' : st.el.classList.contains('center') ? 'center' : 'left';
2004
+ box.querySelectorAll('[data-align]').forEach(function (b) { b.classList.toggle('is-on', b.getAttribute('data-align') === now); });
2005
+ };
2006
+ showAlign();
2007
+ box.addEventListener('click', function (e) {
2008
+ var b = e.target.closest && e.target.closest('button[data-align]');
2009
+ if (!b || b.disabled) return;
2010
+ var a = b.getAttribute('data-align');
2011
+ setClasses({ center: a === 'center', right: a === 'right' });
1728
2012
  });
1729
- textRow = { box: box, menu: menu };
2013
+ textRow = { box: box, menu: menu, off: off };
1730
2014
  updateTextRow();
1731
2015
  showContext(box);
1732
2016
  }
@@ -2414,10 +2698,10 @@
2414
2698
  new MutationObserver(syncThumbAttrs).observe(deck, { attributes: true });
2415
2699
  function bare(el) {
2416
2700
  el.removeAttribute('id');
2417
- [el].concat(Array.prototype.slice.call(el.querySelectorAll('[data-src], [data-src-old], .deck-doc-focus, .deck-img-picked'))).forEach(function (x) {
2701
+ [el].concat(Array.prototype.slice.call(el.querySelectorAll('[data-src], [data-src-old], .deck-doc-focus, .deck-img-picked, .deck-table-picked'))).forEach(function (x) {
2418
2702
  x.removeAttribute('data-src');
2419
2703
  x.removeAttribute('data-src-old');
2420
- x.classList.remove('deck-doc-focus', 'deck-img-picked');
2704
+ x.classList.remove('deck-doc-focus', 'deck-img-picked', 'deck-table-picked');
2421
2705
  });
2422
2706
  return el;
2423
2707
  }
@@ -2868,7 +3152,7 @@
2868
3152
  // Classes show as chips, columns as dividers, notes after each slide's content, and a numbered rule before each
2869
3153
  // slide. Scrolling it picks the slide being read, as in the Markdown view. It is drawn again on each rebuild, but not
2870
3154
  // during an edit.
2871
- var STYLE_CHIPS = ['lead', 'center', 'muted', 'small', 'subtitle', 'meta', 'callout', 'note', 'warn', 'hl', 'badge', 'del'];
3155
+ var STYLE_CHIPS = ['lead', 'center', 'right', 'muted', 'small', 'subtitle', 'meta', 'callout', 'note', 'warn', 'steps', 'hl', 'badge', 'del'];
2872
3156
  var docSlide = -1, docSettle = 0;
2873
3157
  // A slide's `=== col`, `=== row`, and `=== notes` lines (not those inside fenced code), in order.
2874
3158
  var SEPARATOR = /^===\s+([A-Za-z]\w*)(?:\s+\d+(?::\d+)+)?\s*(?:\{.*\})?\s*$/;
@@ -3011,7 +3295,7 @@
3011
3295
  Array.prototype.forEach.call(c.querySelectorAll('.deck-doc-focus'), function (x) { x.classList.remove('deck-doc-focus'); });
3012
3296
  Array.prototype.forEach.call(c.querySelectorAll('[data-src]'), function (x) {
3013
3297
  var on = STYLE_CHIPS.filter(function (k) { return x.classList.contains(k); });
3014
- if (on.length && !/^(SPAN|UL|OL|TABLE)$/.test(x.tagName)) x.setAttribute('data-doc-classes', on.join(' '));
3298
+ if (on.length && x.tagName !== 'SPAN') x.setAttribute('data-doc-classes', on.join(' '));
3015
3299
  });
3016
3300
  // A list item with a list under it: its own text becomes a paragraph with its own lines (as in a loose list), so
3017
3301
  // the caret can go into it like into any item, without the items under it.
@@ -4472,6 +4756,20 @@
4472
4756
  // current slide in each theme (GET /__theme-preview). A setting the page is built with (theme, mode, accent)
4473
4757
  // reloads it, and the panel opens again after; "Edit as Markdown" opens the frontmatter itself.
4474
4758
  var SETTINGS_KEY = 'deck-embed-settings', themeList = null;
4759
+ // Text size (text_size:, a percentage of the theme's sizes; 100% is no key): the presets, and A-/A+ steps of 5% within
4760
+ // the range the build accepts.
4761
+ var TEXT_SIZES = [80, 90, 100, 110, 120], TEXT_MIN = 50, TEXT_MAX = 200;
4762
+ // The size as the file has it (the same forms parseTextSize in src/parse.ts accepts); 100 when unset or unreadable.
4763
+ function textSizeNow(meta) {
4764
+ var m = /^\s*(\d+(?:\.\d+)?)\s*%?\s*$/.exec((meta || metaNow()).text_size || '');
4765
+ return m ? Number(m[1]) : 100;
4766
+ }
4767
+ function setTextSize(n) {
4768
+ var raw = metaNow().text_size;
4769
+ n = Math.max(TEXT_MIN, Math.min(TEXT_MAX, Math.round(n)));
4770
+ // An unreadable value (a build error) shows as 100%, so picking 100% still takes it out.
4771
+ if (n !== textSizeNow() || (n === 100 && raw)) setting('text_size', n === 100 ? null : n + '%');
4772
+ }
4475
4773
  var settingsEl = document.createElement('div');
4476
4774
  settingsEl.className = 'deck-settings';
4477
4775
  settingsEl.hidden = true;
@@ -4483,6 +4781,10 @@
4483
4781
  '<button class="ds-btn" data-mode="light">Light</button><button class="ds-btn" data-mode="dark">Dark</button></span></div>' +
4484
4782
  '<div class="ds-row"><label>Accent</label><input type="color" data-accent-pick title="Pick a color"><input type="text" data-meta="accent" placeholder="The theme\u2019s accent" spellcheck="false">' +
4485
4783
  '<button class="ds-btn" data-ds="accent-reset" title="Use the theme\u2019s accent">Reset</button></div>' +
4784
+ '<div class="ds-row"><label>Text size</label><span class="ds-seg">' + TEXT_SIZES.map(function (n) {
4785
+ return '<button class="ds-btn" data-text-size="' + n + '"' + (n === 100 ? ' title="The theme\u2019s sizes"' : '') + '>' + n + '%</button>';
4786
+ }).join('') + '</span><span class="ds-seg"><button class="ds-btn" data-ds="text-down" title="Smaller text (5%)" aria-label="Smaller text">A\u2212</button>' +
4787
+ '<button class="ds-btn" data-ds="text-up" title="Larger text (5%)" aria-label="Larger text">A+</button></span><span class="ds-muted" data-text-now></span></div>' +
4486
4788
  '<h3>Details</h3>' + [['title', 'Title', 'The first slide\u2019s title'], ['author', 'Author', ''], ['date', 'Date', ''], ['footer', 'Footer', 'Shown at the bottom of each slide']]
4487
4789
  .map(function (f) { return '<div class="ds-row"><label>' + f[1] + '</label><input type="' + (f[0] === 'date' ? 'date' : 'text') + '" data-meta="' + f[0] + '" placeholder="' + f[2] + '"></div>'; }).join('') +
4488
4790
  '<h3>Slides</h3><label class="ds-check"><input type="checkbox" data-flag="section_slides"> Show section divider slides</label>' +
@@ -4555,6 +4857,11 @@
4555
4857
  });
4556
4858
  var accent = meta.accent || '';
4557
4859
  settingsEl.querySelector('[data-accent-pick]').value = /^#[0-9a-f]{6}$/i.test(accent) ? accent : /^#[0-9a-f]{3}$/i.test(accent) ? accent.replace(/[0-9a-f]/gi, '$&$&') : '#888888';
4860
+ var size = textSizeNow(meta);
4861
+ Array.prototype.forEach.call(settingsEl.querySelectorAll('[data-text-size]'), function (b) { b.classList.toggle('is-on', Number(b.getAttribute('data-text-size')) === size); });
4862
+ settingsEl.querySelector('[data-text-now]').textContent = TEXT_SIZES.indexOf(size) < 0 ? size + '%' : '';
4863
+ settingsEl.querySelector('[data-ds="text-down"]').disabled = size <= TEXT_MIN;
4864
+ settingsEl.querySelector('[data-ds="text-up"]').disabled = size >= TEXT_MAX;
4558
4865
  settingsEl.querySelector('[data-flag="section_slides"]').checked = meta.section_slides === 'true';
4559
4866
  settingsEl.querySelector('[data-flag="toc"]').checked = meta.toc === 'sidebar';
4560
4867
  }
@@ -4574,6 +4881,8 @@
4574
4881
  if (act === 'close') closeSettings();
4575
4882
  else if (act === 'md') { var main = mainFile(); closeSettings(); setView('md', { file: main, start: 1 }); mdGoto(main, 1); }
4576
4883
  else if (act === 'accent-reset') setting('accent', null);
4884
+ else if (act === 'text-down' || act === 'text-up') { var at = textSizeNow(meta); setTextSize(act === 'text-up' ? Math.floor(at / 5) * 5 + 5 : Math.ceil(at / 5) * 5 - 5); }
4885
+ else if (b.hasAttribute('data-text-size')) setTextSize(Number(b.getAttribute('data-text-size')));
4577
4886
  else if (b.hasAttribute('data-theme')) { if ((meta.theme || 'default') !== b.getAttribute('data-theme')) setting('theme', core.yamlScalar(b.getAttribute('data-theme'))); }
4578
4887
  else if (b.hasAttribute('data-mode')) { var m = b.getAttribute('data-mode'); if ((meta.mode || '') !== m) setting('mode', m || null); }
4579
4888
  });