@treasure-ai/treasure-deck 2026.10.17 → 2026.10.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/build.d.ts +2 -0
- package/dist/build.js +5 -0
- package/dist/build.js.map +1 -1
- package/dist/cli.js +74 -9
- package/dist/cli.js.map +1 -1
- package/dist/deckindex.d.ts +107 -0
- package/dist/deckindex.js +479 -0
- package/dist/deckindex.js.map +1 -0
- package/dist/dev.d.ts +13 -1
- package/dist/dev.js +145 -6
- package/dist/dev.js.map +1 -1
- package/dist/host.d.ts +10 -0
- package/dist/host.js +43 -25
- package/dist/host.js.map +1 -1
- package/dist/parse.d.ts +5 -0
- package/dist/parse.js.map +1 -1
- package/dist/vendor.js +1 -1
- package/dist/vendor.js.map +1 -1
- package/docs/commands.md +35 -1
- package/docs/editor.md +2 -1
- package/docs/syntax.md +4 -0
- package/package.json +1 -1
- package/runtime/embed.js +73 -2
- package/skills/treasure-deck/SKILL.md +2 -0
- package/vendor/lucide/file-down.svg +18 -0
- package/vendor/lucide/layout-grid.svg +18 -0
- package/vendor/lucide/x.svg +16 -0
package/dist/vendor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vendor.js","sourceRoot":"","sources":["../src/vendor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC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C,CAAC;AAC3F,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,WAAW;IACzB,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,OAAO,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACvC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,qGAAqG;QACrG,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;;YAClH,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
|
package/docs/commands.md
CHANGED
|
@@ -73,7 +73,41 @@ Every row also carries:
|
|
|
73
73
|
|
|
74
74
|
The SDK adds the page URL, referrer, screen size, and user agent. The presenter window sends nothing, so a talk counts once. `deck dev`, `deck editor`, `deck pdf`, and `deck check` never add the SDK, and a deck that can't reach the CDN works as before. These are usage data under the [Treasure AI Labs Terms of Use](https://www.treasure.ai/terms/labs-terms-of-use).
|
|
75
75
|
|
|
76
|
-
`deck pdf` prints the deck with headless Chrome: it waits until fonts and diagrams have rendered, then prints one 1280×720 page per slide. Each slide's background layer (gradients, glass, grain, ornaments) is captured as a 2× image, and text, tables, code, images, and diagrams print as vectors on top, so the PDF looks like the HTML in every viewer (including macOS Preview) while text stays sharp and selectable. `--vector` skips the capture. Printing from the browser (share panel → Print, or ⌘P) keeps backgrounds too, but large translucent gradients may band in some PDF viewers; `deck pdf` is the faithful path.
|
|
76
|
+
`deck pdf` prints the deck with headless Chrome: it waits until fonts and diagrams have rendered, then prints one 1280×720 page per slide. Each slide's background layer (gradients, glass, grain, ornaments) is captured as a 2× image, and text, tables, code, images, and diagrams print as vectors on top, so the PDF looks like the HTML in every viewer (including macOS Preview) while text stays sharp and selectable. `--vector` skips the capture. Printing from the browser (share panel → Print, or ⌘P) keeps backgrounds too, but large translucent gradients may band in some PDF viewers; `deck pdf` is the faithful path; the editor's Preview ▾ → **Export PDF** runs it for you.
|
|
77
|
+
|
|
78
|
+
## An index of decks: `deck index`
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
deck index # ./deck (or the current folder): updates deck/index.json, writes deck/index.html
|
|
82
|
+
deck index talks -o site.html # the decks under talks/, the page written to site.html
|
|
83
|
+
deck index index.json # only build the page from a manifest
|
|
84
|
+
deck index --star deck/q3-review --archive deck/2025-kickoff
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`deck index` keeps a gallery of talks: one page with a card per deck (a thumbnail, the title, date, author, and slide count), newest first, with a search box and a filter button per tag. Cards open the deck in a new tab. The page is one self-contained file, like a deck, so it can be opened from disk or published to Apps Script. It needs Chrome to capture the thumbnails.
|
|
88
|
+
|
|
89
|
+
The list lives in `index.json` beside the decks, by default in `deck/` when that folder exists (where Treasure Work keeps a workspace's decks), else in the current folder. Each run finds the `deck: true` files under the folder and brings the file up to date:
|
|
90
|
+
|
|
91
|
+
- **From the deck:** its `source` (the `.md`, relative to the folder), title, `date:` (else the file's date), author, slide count, and a thumbnail of its first slide, written to `thumbnails/` as a 480 px JPEG. A thumbnail is captured again only when the deck's page changed.
|
|
92
|
+
- **The link:** the deck's `url:` frontmatter, else the entry's `url` as the file has it, else the deck's built page beside it (`talk.html`, from `deck build`). Treasure Work writes a deck's `url` here when it publishes it, so the index links the published page.
|
|
93
|
+
- **Kept as they are:** fields set by hand or by another tool (a `description`, `tags`, a `scope`), and entries without a `source`, such as a talk published somewhere else. An entry whose deck is gone is dropped, with its thumbnail.
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"title": "Talks",
|
|
98
|
+
"decks": [
|
|
99
|
+
{ "source": "q3-review/q3-review.md", "title": "Q3 review", "url": "https://script.google.com/…/exec",
|
|
100
|
+
"thumbnail": "thumbnails/q3-review-q3-review.jpg", "updated": "2026-10-15", "slides": 18, "tags": ["planning"] },
|
|
101
|
+
{ "title": "A talk given elsewhere", "url": "https://example.com/slides" }
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Starred and archived decks.** `--star <deck>` sets `"starred": true` on its entry, which lists the deck under **★ Starred**, a section of its own at the top, above **All decks**. `--archive <deck>` sets `"archived": true`, which keeps the deck in the index but moves it under an **Archived (n)** button at the end of the page, out of the count. A deck is starred or archived, never both; `--unstar` and `--unarchive` undo them. Each flag takes a deck's `.md` or folder and can repeat, and the marks can also be set in `index.json` by hand.
|
|
107
|
+
|
|
108
|
+
The editor's **All decks** button shows the index of the deck being edited, and opens its other decks ([Editor](editor.md#toolbar)).
|
|
109
|
+
|
|
110
|
+
A deck's frontmatter can set `thumbnail: 3` to show its third slide, and `description:` and `tags:` for its card. Links must be `http(s)` URLs or relative paths; relative ones are relative to the manifest's folder, and `-o` into another folder adjusts them. The page title is the manifest's `title` (default "Decks"). Given a `.json` file instead of a folder, `deck index` only builds the page from it, inlining thumbnails given as paths relative to it: Treasure Work does this to publish an index that lists only the decks its audience may see.
|
|
77
111
|
|
|
78
112
|
## Importing a shared deck: `deck import`
|
|
79
113
|
|
package/docs/editor.md
CHANGED
|
@@ -57,7 +57,8 @@ Below the slide. Drag its top edge to resize it.
|
|
|
57
57
|
- **New slide** (at its left) adds a slide after the current one.
|
|
58
58
|
- For the current slide: move up and down, hide, delete (a second click confirms), and its **layout**, picked from pictures of each layout and column widths. A layout with more columns than the slide has adds empty ones to type in (in a slide with rows, to its first row); columns are never taken away. **Add a row below** adds a full-width row, or one of two or three empty columns.
|
|
59
59
|
- The slide's style: **Dark slide** (or Light slide in a dark deck), **Fit to slide** (content and columns slides), and **No number** (section slides).
|
|
60
|
-
- **Preview** opens the deck as presented (`/present`) on the current slide in your system default browser. Its ▾ menu offers **Open in the browser** and **
|
|
60
|
+
- **Preview** opens the deck as presented (`/present`) on the current slide in your system default browser. Its ▾ menu offers **Open in the browser**, **Copy link**, and **Export PDF**, which saves the deck as `<deck>.pdf` next to its Markdown, the same file `deck pdf` makes, and opens it. It needs Chrome, as `deck pdf` does, and a deck that doesn't build isn't exported. An editor framed in a host page, which keeps the edits itself, doesn't offer it.
|
|
61
|
+
- **All decks** shows when the deck belongs to a deck index (an `index.json` in its folder or a folder above it, kept by [`deck index`](commands.md#an-index-of-decks-deck-index)). It opens the index over the editor, as the file has it: run `deck index` to add new decks or refresh thumbnails. The deck you're editing is marked **Editing**; clicking it goes back to the editor. Click another deck to edit it: in Treasure Work it opens in the editor; elsewhere `deck editor` starts an editor on it and opens that in a new browser tab (clicking it again goes back to the same editor, and those editors stop when this one does). **Close** or Esc goes back to the editor. Only a `.md` inside the index's folder is ever opened, never a card's link.
|
|
61
62
|
- **Publish** (in Treasure Work) publishes the deck as a web page on Apps Script. Treasure Work builds it, asks who can open it the first time (only you, your organization, or anyone with the link), and deploys it with your Google account. After that the button reads **Update page**: it updates the same page, so a link you shared keeps working. Its ▾ menu opens the page or copies its link. A published page is a snapshot, so update it after you edit. Outside Treasure Work there is no Publish button.
|
|
62
63
|
- **Undo** and **Redo**, and the switch between the two views below.
|
|
63
64
|
- A second row shows the controls for what is selected: the text row while typing, or an image's or diagram's controls.
|
package/docs/syntax.md
CHANGED
|
@@ -19,6 +19,10 @@ footer: "Treasure AI · DB Study Group"
|
|
|
19
19
|
section_slides: true # show section divider slides (hidden by default)
|
|
20
20
|
toc: sidebar # show the table of contents column from the start (`t` toggles it)
|
|
21
21
|
parts: [01-intro.md, 02-arch.md] # continue the deck in more files
|
|
22
|
+
description: "A query language that reads top to bottom" # for its card in `deck index`
|
|
23
|
+
tags: [wvlet, sql] # filter buttons in `deck index`
|
|
24
|
+
thumbnail: 2 # the slide `deck index` shows (default: the first)
|
|
25
|
+
url: https://…/exec # where `deck index` links the deck (default: its built page)
|
|
22
26
|
---
|
|
23
27
|
```
|
|
24
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treasure-ai/treasure-deck",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.18",
|
|
4
4
|
"description": "Markdown presentations without <div> markup: four layouts, themes, and a single-file HTML output that publishes to Apps Script",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://www.npmjs.com/package/@treasure-ai/treasure-deck",
|
package/runtime/embed.js
CHANGED
|
@@ -159,6 +159,10 @@
|
|
|
159
159
|
'.deck-slide-bar .dsb-present{display:inline-flex}.deck-slide-bar .dsb-present button:first-child{border-radius:5px 0 0 5px}' +
|
|
160
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
161
|
'.pb-menu .pb-note{max-width:320px;padding:6px 10px;font-size:12px;color:var(--ed-muted)}' +
|
|
162
|
+
'.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
|
+
'.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
|
+
'.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
|
+
'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}' +
|
|
162
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}' +
|
|
163
167
|
'.deck-slide-bar .dsb-view button:last-child{border-radius:0 5px 5px 0;margin-left:-1px}' +
|
|
164
168
|
'.deck-src-popover{position:fixed;z-index:1000;display:flex;flex-direction:column;gap:6px;padding:8px;border-radius:8px;' +
|
|
@@ -1050,6 +1054,8 @@
|
|
|
1050
1054
|
// waits for its rebuild (`is-stale`), and comes back on the slide the action left current.
|
|
1051
1055
|
// Publish is offered when the editor's host process publishes for it (Treasure Work, src/host.ts).
|
|
1052
1056
|
var canPublish = Boolean(window.__DECK_HOST__ && window.__DECK_HOST__.publish);
|
|
1057
|
+
// All decks is offered when the deck belongs to a deck index (an index.json in its folder or above, `deck index`).
|
|
1058
|
+
var canIndex = Boolean(window.__DECK_INDEX__);
|
|
1053
1059
|
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'] };
|
|
1054
1060
|
var bar = document.createElement('div');
|
|
1055
1061
|
bar.className = 'deck-slide-bar';
|
|
@@ -1065,6 +1071,7 @@
|
|
|
1065
1071
|
'<span class="dsb-gap"></span>' +
|
|
1066
1072
|
'<span class="dsb-present"><button data-act="present" title="Preview the deck in your default browser, from this slide">' + icon('presentation', '') + '<span class="dsb-words">Preview</span></button>' +
|
|
1067
1073
|
'<button data-act="present-menu" title="Preview options" aria-haspopup="menu">' + icon('chevron-down', '▾') + '</button></span>' +
|
|
1074
|
+
(canIndex ? '<button data-act="decks" title="All decks in this deck\u2019s index">' + icon('layout-grid', '') + '<span class="dsb-words">All decks</span></button>' : '') +
|
|
1068
1075
|
(canPublish ? '<span class="dsb-present"><button data-act="publish" title="Publish the deck as a web page with Treasure Work">' + icon('globe', '') +
|
|
1069
1076
|
'<span class="dsb-words">Publish</span></button><button data-act="publish-menu" title="The published page" aria-haspopup="menu">' +
|
|
1070
1077
|
icon('chevron-down', '▾') + '</button></span>' : '') +
|
|
@@ -1288,6 +1295,7 @@
|
|
|
1288
1295
|
else if (act === 'present') preview(i);
|
|
1289
1296
|
else if (act === 'present-menu') togglePreviewMenu(b);
|
|
1290
1297
|
else if (act === 'publish') publish();
|
|
1298
|
+
else if (act === 'decks') openIndex();
|
|
1291
1299
|
else if (act === 'publish-menu') togglePublishMenu(b);
|
|
1292
1300
|
else if (act === 'add') {
|
|
1293
1301
|
// A slide with a title to type over: an empty one at the end of the file wouldn't be a slide.
|
|
@@ -1319,6 +1327,36 @@
|
|
|
1319
1327
|
}
|
|
1320
1328
|
});
|
|
1321
1329
|
|
|
1330
|
+
// All decks: the deck index (GET /__index, the nearest index.json as it is) in a panel over the editor. A card for a
|
|
1331
|
+
// deck in the folder asks the server to open it (in Treasure Work, in the editor; else its page in the browser); the
|
|
1332
|
+
// current deck's card, the close button, and Esc close the panel. It loads again on each opening, for a fresh list.
|
|
1333
|
+
var indexPanel = null;
|
|
1334
|
+
function openIndex() {
|
|
1335
|
+
if (!indexPanel) {
|
|
1336
|
+
indexPanel = document.createElement('div');
|
|
1337
|
+
indexPanel.className = 'deck-index-panel';
|
|
1338
|
+
indexPanel.setAttribute('role', 'dialog');
|
|
1339
|
+
indexPanel.setAttribute('aria-label', 'All decks');
|
|
1340
|
+
indexPanel.innerHTML = '<div class="dip-head"><span>All decks \u00b7 from index.json (run deck index to refresh it)</span>' +
|
|
1341
|
+
'<button type="button" data-dip="close" title="Back to the editor (Esc)">' + icon('x', '') + 'Close</button></div><iframe title="All decks"></iframe>';
|
|
1342
|
+
indexPanel.querySelector('[data-dip="close"]').addEventListener('click', closeIndex);
|
|
1343
|
+
document.body.appendChild(indexPanel);
|
|
1344
|
+
}
|
|
1345
|
+
indexPanel.querySelector('iframe').src = '/__index';
|
|
1346
|
+
indexPanel.hidden = false;
|
|
1347
|
+
indexPanel.querySelector('iframe').focus();
|
|
1348
|
+
}
|
|
1349
|
+
function closeIndex() {
|
|
1350
|
+
if (!indexPanel || indexPanel.hidden) return;
|
|
1351
|
+
indexPanel.hidden = true;
|
|
1352
|
+
indexPanel.querySelector('iframe').src = 'about:blank';
|
|
1353
|
+
}
|
|
1354
|
+
// The index page calls this from its frame (same origin) for Esc and for the current deck's card.
|
|
1355
|
+
window.__deckIndexClose = closeIndex;
|
|
1356
|
+
window.addEventListener('keydown', function (e) {
|
|
1357
|
+
if (e.key === 'Escape' && indexPanel && !indexPanel.hidden) { closeIndex(); e.stopPropagation(); e.preventDefault(); }
|
|
1358
|
+
}, true);
|
|
1359
|
+
|
|
1322
1360
|
// Preview opens /present on this server, on slide i, through the system's browser opener. The ▾ menu also copies its link.
|
|
1323
1361
|
function presentUrl(i) { return location.origin + '/present#/' + (presented(i) + 1); }
|
|
1324
1362
|
// Slide i's place in the deck as presented, without the hidden slides (a hidden one's is the next shown one's).
|
|
@@ -1351,7 +1389,9 @@
|
|
|
1351
1389
|
previewMenu.setAttribute('role', 'menu');
|
|
1352
1390
|
previewMenu.hidden = true;
|
|
1353
1391
|
previewMenu.innerHTML = '<button data-pv="browser">' + icon('external-link', '') + 'Open in the browser</button>' +
|
|
1354
|
-
'<button data-pv="copy">' + icon('copy', '') + 'Copy link</button>'
|
|
1392
|
+
'<button data-pv="copy">' + icon('copy', '') + 'Copy link</button>' +
|
|
1393
|
+
// 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>');
|
|
1355
1395
|
document.body.appendChild(previewMenu);
|
|
1356
1396
|
function togglePreviewMenu(b) {
|
|
1357
1397
|
previewMenu.hidden = !previewMenu.hidden;
|
|
@@ -1364,7 +1404,9 @@
|
|
|
1364
1404
|
var b = e.target.closest && e.target.closest('button[data-pv]');
|
|
1365
1405
|
if (!b) return;
|
|
1366
1406
|
previewMenu.hidden = true;
|
|
1367
|
-
|
|
1407
|
+
var pv = b.getAttribute('data-pv');
|
|
1408
|
+
if (pv === 'browser') preview(current);
|
|
1409
|
+
else if (pv === 'pdf') exportPdf();
|
|
1368
1410
|
else copyLink(current);
|
|
1369
1411
|
});
|
|
1370
1412
|
document.addEventListener('mousedown', function (e) {
|
|
@@ -1372,6 +1414,35 @@
|
|
|
1372
1414
|
}, true);
|
|
1373
1415
|
window.addEventListener('keydown', function (e) { if (e.key === 'Escape' && !previewMenu.hidden) { previewMenu.hidden = true; e.stopPropagation(); } }, true);
|
|
1374
1416
|
|
|
1417
|
+
// Export PDF: POST /__pdf prints the deck as saved, as `deck pdf` does, to <deck>.pdf next to it and opens it.
|
|
1418
|
+
// What is being typed is saved first, as for Publish. It takes a few seconds; a second click meanwhile is ignored.
|
|
1419
|
+
var exportingPdf = false;
|
|
1420
|
+
function exportPdf() {
|
|
1421
|
+
if (exportingPdf) return;
|
|
1422
|
+
endEdits();
|
|
1423
|
+
if (md.timer) mdSave();
|
|
1424
|
+
exportingPdf = true;
|
|
1425
|
+
var item = previewMenu.querySelector('[data-pv="pdf"]');
|
|
1426
|
+
item.disabled = true;
|
|
1427
|
+
item.querySelector('.pv-words').textContent = 'Exporting PDF\u2026';
|
|
1428
|
+
toast('Exporting PDF\u2026', 0);
|
|
1429
|
+
var done = function (message, ms) {
|
|
1430
|
+
exportingPdf = false;
|
|
1431
|
+
item.disabled = false;
|
|
1432
|
+
item.querySelector('.pv-words').textContent = 'Export PDF';
|
|
1433
|
+
if (message) toast(message, ms);
|
|
1434
|
+
};
|
|
1435
|
+
queue.then(function () {
|
|
1436
|
+
if (notSaved) return { ok: false, reason: 'cancelled' };
|
|
1437
|
+
return fetch('/__pdf', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}' }).then(function (r) { return r.json(); });
|
|
1438
|
+
}).then(function (r) {
|
|
1439
|
+
// A refused save reloads the page (and says so): the file doesn't have what was typed, so it isn't exported.
|
|
1440
|
+
if (r && r.reason === 'cancelled') return done();
|
|
1441
|
+
if (r && r.ok) done('Saved ' + r.file, 3000);
|
|
1442
|
+
else done('Couldn\u2019t export the PDF: ' + ((r && r.reason) || 'unknown error'), 6000);
|
|
1443
|
+
}, function (e) { done('Couldn\u2019t export the PDF: ' + e, 6000); });
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1375
1446
|
// Publish (with a host process): POST /__publish waits while Treasure Work builds the deck, asks for the audience
|
|
1376
1447
|
// the first time, and deploys it to Apps Script, then answers with the page's URL. Republishing updates the same
|
|
1377
1448
|
// page. Treasure Work shows the result, so the ▾ menu stays closed; it opens the page or copies its link.
|
|
@@ -325,6 +325,8 @@ A built page carries the deck's source, so whoever can open it can get the deck
|
|
|
325
325
|
|
|
326
326
|
To start from a deck someone shared, run `deck import <page.html | url> [dir]` and edit the folder it writes. For an Apps Script deck that isn't public, it needs the user's Google sign-in (`gcloud auth login --enable-gdrive-access`); otherwise have the user download the `.zip` from the deck's share panel.
|
|
327
327
|
|
|
328
|
+
To list several published decks on one page, run `deck index` from the workspace root: it keeps `deck/index.json` (one entry per deck under `deck/`, with a thumbnail in `deck/thumbnails/`) and writes `deck/index.html`. After publishing a deck, set its entry's `url` in `deck/index.json` to the published URL (or add `url:` to its frontmatter), then run `deck index` again. When the user asks to feature or retire a deck, run `deck index --star <deck>` or `--archive <deck>` (`--unstar`, `--unarchive` undo them). Publish `deck/index.html` like a deck, with its own `artifact_id` for updates. An index shows every deck's title and first slide, so give it an audience no wider than the narrowest deck it lists, or remove the entries that audience shouldn't see.
|
|
329
|
+
|
|
328
330
|
Don't publish the deck `.md` as a `note`: it would appear as a plain document, not slides. Don't use `mechanism: "drive"` for a deck either, since Drive doesn't serve the HTML as a page. A published page is a snapshot, so rebuild and republish after each edit.
|
|
329
331
|
|
|
330
332
|
## When the user wants a different look
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- @license lucide-static v1.52.0 - ISC -->
|
|
2
|
+
<svg
|
|
3
|
+
class="lucide lucide-file-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 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" />
|
|
15
|
+
<path d="M14 2v5a1 1 0 0 0 1 1h5" />
|
|
16
|
+
<path d="M12 18v-6" />
|
|
17
|
+
<path d="m9 15 3 3 3-3" />
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- @license lucide-static v1.52.0 - ISC -->
|
|
2
|
+
<svg
|
|
3
|
+
class="lucide lucide-layout-grid"
|
|
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
|
+
<rect width="7" height="7" x="3" y="3" rx="1" />
|
|
15
|
+
<rect width="7" height="7" x="14" y="3" rx="1" />
|
|
16
|
+
<rect width="7" height="7" x="14" y="14" rx="1" />
|
|
17
|
+
<rect width="7" height="7" x="3" y="14" rx="1" />
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- @license lucide-static v1.52.0 - ISC -->
|
|
2
|
+
<svg
|
|
3
|
+
class="lucide lucide-x"
|
|
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="M18 6 6 18" />
|
|
15
|
+
<path d="m6 6 12 12" />
|
|
16
|
+
</svg>
|