decklight 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PLATFORM.md +707 -0
- package/README.md +226 -150
- package/SPEC.md +803 -888
- package/cli/agent-review.mjs +246 -0
- package/cli/agents.mjs +35 -9
- package/cli/associate.mjs +12 -12
- package/cli/audit.mjs +42 -10
- package/cli/banner.mjs +41 -17
- package/cli/bundle-audio.mjs +190 -0
- package/cli/bundle-module.mjs +95 -0
- package/cli/bundle.mjs +439 -35
- package/cli/cast.mjs +48 -12
- package/cli/check-fixes.mjs +186 -0
- package/cli/check.mjs +988 -0
- package/cli/clone-deck.mjs +179 -0
- package/cli/commands.mjs +345 -0
- package/cli/comments.mjs +64 -18
- package/cli/commit-flow.mjs +51 -22
- package/cli/commit-message.mjs +51 -74
- package/cli/commit-split.mjs +601 -0
- package/cli/deck-refs.mjs +64 -0
- package/cli/deck-routes.mjs +67 -0
- package/cli/deckfile.mjs +3 -5
- package/cli/decklight.mjs +68 -289
- package/cli/design-system-deps.mjs +209 -0
- package/cli/design-system-edit.mjs +194 -0
- package/cli/design-system-refs.mjs +666 -0
- package/cli/design-system.mjs +497 -0
- package/cli/doctor.mjs +115 -0
- package/cli/edit-git.mjs +353 -0
- package/cli/edit-handover.mjs +551 -0
- package/cli/edit-look.mjs +631 -0
- package/cli/edit-slides.mjs +683 -0
- package/cli/edit.mjs +2585 -855
- package/cli/enhance.mjs +485 -0
- package/cli/extension.mjs +10 -10
- package/cli/font-refs.mjs +273 -0
- package/cli/font.mjs +246 -0
- package/cli/git-tree.mjs +1 -1
- package/cli/git.mjs +78 -11
- package/cli/import.mjs +56 -10
- package/cli/init.mjs +407 -236
- package/cli/library.mjs +127 -0
- package/cli/loader.mjs +3 -1
- package/cli/marketplace-autocheck.mjs +200 -0
- package/cli/marketplace.mjs +460 -29
- package/cli/narrate.mjs +251 -0
- package/cli/open-browser.mjs +63 -0
- package/cli/open.mjs +961 -0
- package/cli/pdf.mjs +64 -17
- package/cli/pkg.mjs +44 -2
- package/cli/plugin.mjs +43 -41
- package/cli/port-conflict.mjs +53 -23
- package/cli/pptx-export.mjs +63 -27
- package/cli/publish.mjs +8 -4
- package/cli/qr.mjs +1 -1
- package/cli/record.mjs +85 -23
- package/cli/remote.mjs +43 -17
- package/cli/restore.mjs +11 -4
- package/cli/review-ref.mjs +125 -0
- package/cli/review-remote.mjs +92 -48
- package/cli/review-routes.mjs +254 -0
- package/cli/review-store.mjs +47 -7
- package/cli/review-submit.mjs +47 -57
- package/cli/runtime-link.mjs +560 -0
- package/cli/serve.mjs +236 -45
- package/cli/setup.mjs +112 -0
- package/cli/sign.mjs +1 -1
- package/cli/skill-content.mjs +229 -35
- package/cli/skills.mjs +353 -26
- package/cli/start.mjs +110 -0
- package/cli/supervise.mjs +6 -6
- package/cli/theme-refs.mjs +527 -0
- package/cli/theme.mjs +181 -137
- package/cli/trust.mjs +83 -0
- package/cli/units.mjs +112 -47
- package/cli/update-check.mjs +1 -5
- package/cli/upgrade.mjs +194 -28
- package/cli/upstream.mjs +4 -3
- package/cli/util.mjs +4 -4
- package/cli/wizard.mjs +6 -6
- package/dist/build-info.json +1 -1
- package/dist/decklight.css +1533 -59
- package/dist/decklight.js +258 -115
- package/dist/decklight.js.map +4 -4
- package/docs/GLOSSARY.md +141 -0
- package/docs/architecture.svg +17 -17
- package/package.json +4 -2
- package/themes/README.md +9 -8
- package/themes/reveal-solarized.css +10 -0
- package/tools/args.mjs +20 -0
- package/tools/atomic-write.mjs +48 -0
- package/tools/brand-palette.mjs +717 -0
- package/tools/bridge.mjs +1 -1
- package/tools/build-groups.mjs +42 -0
- package/tools/color.mjs +48 -0
- package/tools/deck-html.mjs +396 -11
- package/tools/design-system-format.mjs +778 -0
- package/tools/design-system-migrations.mjs +207 -0
- package/tools/elevenlabs-tts.mjs +110 -17
- package/tools/exec.mjs +11 -3
- package/tools/extension-check.mjs +31 -7
- package/tools/font-format.mjs +190 -0
- package/tools/font-stacks.mjs +24 -0
- package/tools/gemini-tts.mjs +3 -0
- package/tools/lipsync-config.mjs +103 -0
- package/tools/lipsync-engines.mjs +205 -2
- package/tools/lipsync-server.mjs +264 -41
- package/tools/lipsync.mjs +37 -18
- package/tools/local-voice.mjs +32 -42
- package/tools/narration-manifest.mjs +270 -0
- package/tools/narration-synth.mjs +416 -0
- package/tools/pptx.mjs +776 -19
- package/tools/publish-targets.mjs +1 -1
- package/tools/publish-voices.mjs +3 -3
- package/tools/recording-impact.mjs +7 -3
- package/tools/render-theme.mjs +33 -0
- package/tools/review-anchor.mjs +28 -12
- package/tools/semver.mjs +40 -0
- package/tools/sentences.mjs +180 -0
- package/tools/shot.mjs +14 -7
- package/tools/site-clip.mjs +114 -0
- package/tools/site-voices.mjs +232 -0
- package/tools/template-theme.mjs +1 -1
- package/tools/test-impact.mjs +17 -10
- package/tools/theme-check.mjs +30 -3
- package/tools/tts-cache.mjs +4 -3
- package/tools/tts-engines.mjs +38 -20
- package/tools/tts-setup.mjs +7 -7
- package/tools/video-options.mjs +34 -0
- package/tools/video.mjs +530 -54
- package/tools/voiceover-server.mjs +185 -104
- package/tools/voiceover.mjs +119 -261
- package/tools/zip.mjs +1 -1
- package/cli/dev.mjs +0 -623
- package/cli/present.mjs +0 -853
- package/cli/review.mjs +0 -361
- package/tools/publish-site-voices.mjs +0 -75
package/cli/git.mjs
CHANGED
|
@@ -7,12 +7,24 @@
|
|
|
7
7
|
// between them (init learned `auto-detect`, edit never did). One home now.
|
|
8
8
|
|
|
9
9
|
import { execFileSync } from 'node:child_process';
|
|
10
|
-
import { existsSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
11
11
|
import { resolve, basename } from 'node:path';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* How much a git command may print before Node gives up on it.
|
|
15
|
+
*
|
|
16
|
+
* `execFileSync` caps stdout at 1 MB unless told otherwise, and a bundled deck
|
|
17
|
+
* is routinely bigger than that — the runtime, the themes and the talk in one
|
|
18
|
+
* file. Past the cap the call does not truncate, it THROWS `ENOBUFS`, which
|
|
19
|
+
* read as "no such revision" two layers up and painted the history preview
|
|
20
|
+
* black for every large deck (#508). 128 MB is the number `decorateHistory`
|
|
21
|
+
* already picked for the same reason; this is that decision, named once.
|
|
22
|
+
*/
|
|
23
|
+
export const GIT_MAX_BUFFER = 128 * 1024 * 1024;
|
|
24
|
+
|
|
13
25
|
/** Run git in `cwd`, return trimmed stdout; throws on failure (stderr on e.stderr). */
|
|
14
26
|
export const git = (args, cwd, exec = execFileSync) =>
|
|
15
|
-
exec('git', args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
27
|
+
exec('git', args, { cwd, encoding: 'utf8', maxBuffer: GIT_MAX_BUFFER, stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
16
28
|
|
|
17
29
|
/** Is `dir` inside a git work tree? (exec injectable for tests) */
|
|
18
30
|
export function inGitRepo(dir, exec = execFileSync) {
|
|
@@ -53,12 +65,41 @@ voiceover/
|
|
|
53
65
|
*/
|
|
54
66
|
export function createRepo(dir) {
|
|
55
67
|
git(['init'], dir);
|
|
68
|
+
ensureReviewAttribute(dir);
|
|
56
69
|
const ignorePath = resolve(dir, '.gitignore');
|
|
57
70
|
if (existsSync(ignorePath)) return false;
|
|
58
71
|
writeFileSync(ignorePath, STARTER_GITIGNORE);
|
|
59
72
|
return true;
|
|
60
73
|
}
|
|
61
74
|
|
|
75
|
+
/** The line that makes two sidecars merge by concatenation (REVIEW). */
|
|
76
|
+
export const REVIEW_ATTRIBUTE = '*.review.jsonl merge=union';
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Make sure the repository around `dir` declares the union merge for review
|
|
80
|
+
* sidecars. The append-only store is a merge strategy only while git knows
|
|
81
|
+
* to concatenate: without this line a reviewer's first `git pull --rebase`
|
|
82
|
+
* after the author commits a resolve meets a plain add/add conflict on the
|
|
83
|
+
* sidecar and, resolved the usual way, loses their comment. Written the
|
|
84
|
+
* first time decklight touches a sidecar in a repository, and seeded by
|
|
85
|
+
* createRepo, so no one has to know the line exists. Appends to an existing
|
|
86
|
+
* `.gitattributes`, never rewrites one. Returns the file's path when it
|
|
87
|
+
* wrote (for the caller to commit beside the record), null when the line was
|
|
88
|
+
* there already, there is no repository, or the file could not be written.
|
|
89
|
+
*/
|
|
90
|
+
export function ensureReviewAttribute(dir) {
|
|
91
|
+
let top;
|
|
92
|
+
try { top = git(['rev-parse', '--show-toplevel'], dir); } catch { return null; }
|
|
93
|
+
const file = resolve(top, '.gitattributes');
|
|
94
|
+
let text = '';
|
|
95
|
+
try { text = existsSync(file) ? readFileSync(file, 'utf8') : ''; } catch { return null; }
|
|
96
|
+
if (/^[ \t]*\*\.review\.jsonl[ \t]+(?:\S+[ \t]+)*merge=union\b/m.test(text)) return null;
|
|
97
|
+
try {
|
|
98
|
+
writeFileSync(file, (text && !text.endsWith('\n') ? `${text}\n` : text) + `${REVIEW_ATTRIBUTE}\n`);
|
|
99
|
+
} catch { return null; }
|
|
100
|
+
return file;
|
|
101
|
+
}
|
|
102
|
+
|
|
62
103
|
/** Commit the deck if it changed. Returns true when a commit was made. */
|
|
63
104
|
// ── when to commit (#71) ───────────────────────────────────────────────────
|
|
64
105
|
// A timer is the wrong boundary for agent-authored edits: the commits land on
|
|
@@ -120,6 +161,19 @@ export function commitSubject(raw, fallback) {
|
|
|
120
161
|
return /^-/.test(capped) ? `agent: ${capped}` : capped;
|
|
121
162
|
}
|
|
122
163
|
|
|
164
|
+
/**
|
|
165
|
+
* The untracked files under `dir` git does not ignore, relative to it, a
|
|
166
|
+
* wholly new directory said once as `name/` — what an agent run may leave
|
|
167
|
+
* beside the deck. Null when git cannot answer.
|
|
168
|
+
*/
|
|
169
|
+
export function untrackedFiles(dir) {
|
|
170
|
+
try {
|
|
171
|
+
const out = execFileSync('git', ['ls-files', '--others', '--exclude-standard', '--directory', '-z', '--', '.'],
|
|
172
|
+
{ cwd: dir, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
|
|
173
|
+
return out.split('\0').filter(Boolean).sort();
|
|
174
|
+
} catch { return null; }
|
|
175
|
+
}
|
|
176
|
+
|
|
123
177
|
/**
|
|
124
178
|
* The sha of the commit `gitAutocommit` last made, or null.
|
|
125
179
|
*
|
|
@@ -131,19 +185,27 @@ export function commitSubject(raw, fallback) {
|
|
|
131
185
|
*/
|
|
132
186
|
export let lastCommitSha = null;
|
|
133
187
|
|
|
134
|
-
|
|
188
|
+
/**
|
|
189
|
+
* Commit the deck, and with it whatever `also` names that exists and changed —
|
|
190
|
+
* the review sidecar beside it (REVIEW: in write mode the sidecar rides the
|
|
191
|
+
* deck's own commits, so a resolve the author pressed R for reaches the
|
|
192
|
+
* reviewer by the same push the deck does). Nothing else: a repository holding
|
|
193
|
+
* somebody's whole project is not decklight's to sweep.
|
|
194
|
+
*/
|
|
195
|
+
export function gitAutocommit(deckPath, cwd, message = `decklight: autosave ${basename(deckPath)}`, { also = [] } = {}) {
|
|
135
196
|
lastCommitSha = null;
|
|
197
|
+
const paths = [deckPath, ...also.filter((p) => p && existsSync(p))];
|
|
136
198
|
try {
|
|
137
|
-
if (!git(['status', '--porcelain', '--',
|
|
138
|
-
git(['add', '--',
|
|
199
|
+
if (!git(['status', '--porcelain', '--', ...paths], cwd)) return false;
|
|
200
|
+
git(['add', '--', ...paths], cwd);
|
|
139
201
|
try {
|
|
140
|
-
git(['commit', '-m', message, '--',
|
|
202
|
+
git(['commit', '-m', message, '--', ...paths], cwd);
|
|
141
203
|
} catch (e) {
|
|
142
204
|
// a fresh machine has no git identity — commit anyway rather than
|
|
143
205
|
// silently dropping the safety net, without touching global config
|
|
144
206
|
if (!isIdentityError(e)) throw e;
|
|
145
207
|
git(['-c', 'user.name=decklight', '-c', 'user.email=decklight@localhost',
|
|
146
|
-
'commit', '-m', message, '--',
|
|
208
|
+
'commit', '-m', message, '--', ...paths], cwd);
|
|
147
209
|
}
|
|
148
210
|
try { lastCommitSha = git(['rev-parse', 'HEAD'], cwd); } catch { lastCommitSha = null; }
|
|
149
211
|
return true;
|
|
@@ -178,18 +240,23 @@ export function gitAutocommit(deckPath, cwd, message = `decklight: autosave ${ba
|
|
|
178
240
|
// therefore as fresh as your last fetch, and saying so is better than fetching
|
|
179
241
|
// behind someone's back.
|
|
180
242
|
//
|
|
181
|
-
// ONE named exception: the review check at `decklight
|
|
243
|
+
// ONE named exception: the review check at `decklight <deck>` startup
|
|
182
244
|
// (cli/review-remote.mjs), which exists precisely because "somebody reviewed
|
|
183
245
|
// your deck" is only useful unasked. It is once, detached, off by three
|
|
184
246
|
// switches that each say why, and nowhere near a SIGINT handler — the shape
|
|
185
247
|
// update-check.mjs established. SPEC REVIEW states the contract; anything
|
|
186
248
|
// else that wants to fetch unasked argues there, not here.
|
|
249
|
+
//
|
|
250
|
+
// A PUSH IS ONLY EVER ASKED FOR. The two that run from a request handler run
|
|
251
|
+
// on a click that says so: the reviewer's Submit (cli/review-submit.mjs) and
|
|
252
|
+
// the commit window's Push (cli/commit-split.mjs `pushBranch`). Neither runs
|
|
253
|
+
// on a timer, on startup, or on the way out, and both use noPromptEnv.
|
|
187
254
|
|
|
188
255
|
/**
|
|
189
256
|
* `owner/repo` from a GitHub remote URL, or null for anything else.
|
|
190
257
|
*
|
|
191
258
|
* THE one parser — `pagesUrl` (cli/publish.mjs) derives the Pages site from it
|
|
192
|
-
* and `
|
|
259
|
+
* and `comments submit` hands it to `gh --repo`. It lived in both files as the
|
|
193
260
|
* same regex for a while, which is exactly how one copy grows a spelling the
|
|
194
261
|
* other refuses.
|
|
195
262
|
*/
|
|
@@ -370,7 +437,7 @@ export function remoteState(cwd, { run = git, exec = execFileSync } = {}) {
|
|
|
370
437
|
// ── the words ──────────────────────────────────────────────────────────────
|
|
371
438
|
//
|
|
372
439
|
// Four places tell you about unpushed work — a toast while authoring, a line
|
|
373
|
-
// when
|
|
440
|
+
// when write mode exits, the history overlay's footer, and `decklight
|
|
374
441
|
// history` — and they must not disagree. So none of them writes a sentence:
|
|
375
442
|
// they all call one of the three functions below. A wording change is then a
|
|
376
443
|
// diff in one file with a test beside it, rather than four strings that were
|
|
@@ -399,7 +466,7 @@ export function pushHint(s) {
|
|
|
399
466
|
}
|
|
400
467
|
|
|
401
468
|
/**
|
|
402
|
-
* The line
|
|
469
|
+
* The line write mode prints on its way out, or null for a clean exit.
|
|
403
470
|
*
|
|
404
471
|
* This one DOES speak up when there is no remote, unlike `pushHint` — the end
|
|
405
472
|
* of a session is the moment when "this only exists here" is worth knowing, and
|
package/cli/import.mjs
CHANGED
|
@@ -26,6 +26,7 @@ import { tmpdir } from 'node:os';
|
|
|
26
26
|
import { basename, join, resolve } from 'node:path';
|
|
27
27
|
import { argReader, isMain } from '../tools/args.mjs';
|
|
28
28
|
import { THEMES_DIR, themeCss as shippedThemeCss, runtimeCss, runtimeJs } from './pkg.mjs';
|
|
29
|
+
import { configBlockHtml } from './runtime-link.mjs';
|
|
29
30
|
import { unzip } from '../tools/zip.mjs';
|
|
30
31
|
import { decodeEntities } from '../tools/ooxml.mjs';
|
|
31
32
|
import { parseRels, resolvePart, slideOrder, parseSlide, notesText, slideSection, mimeOf } from '../tools/pptx.mjs';
|
|
@@ -42,6 +43,15 @@ const USAGE = `usage: decklight import <deck.pptx | deck.key | google-slides-url
|
|
|
42
43
|
--build all|none|auto
|
|
43
44
|
which lists step in [auto]
|
|
44
45
|
auto follows PowerPoint's own per-paragraph build list
|
|
46
|
+
--shapes auto|strict|text
|
|
47
|
+
when drawn shapes cross as one SVG diagram [auto]
|
|
48
|
+
auto: any two placed shapes where one was drawn — a
|
|
49
|
+
chevron, an ellipse, a loose line — not just typed
|
|
50
|
+
strict: only boxes with an arrow snapped between them
|
|
51
|
+
text: never; every shape's words cross as text
|
|
52
|
+
--inline write a self-contained deck (runtime and theme embedded)
|
|
53
|
+
instead of slides plus a configuration block, which
|
|
54
|
+
decklight plays it with the installed runtime, in either mode
|
|
45
55
|
--force overwrite an existing output file
|
|
46
56
|
-v, --verbose print every slide's line, not just the ones with drops
|
|
47
57
|
|
|
@@ -54,8 +64,8 @@ const USAGE = `usage: decklight import <deck.pptx | deck.key | google-slides-url
|
|
|
54
64
|
A Google Slides URL is fetched as .pptx — the deck must be link-shared.
|
|
55
65
|
|
|
56
66
|
A format decklight cannot read itself runs through an installed import
|
|
57
|
-
adapter instead, if one is installed for that extension: decklight
|
|
58
|
-
add <name>, then this command again. -v/--build/drop reporting are the
|
|
67
|
+
adapter instead, if one is installed for that extension: decklight library
|
|
68
|
+
add importer <name>, then this command again. -v/--build/drop reporting are the
|
|
59
69
|
built-in PowerPoint path's own; a third-party adapter has no equivalent yet.`;
|
|
60
70
|
|
|
61
71
|
/**
|
|
@@ -167,7 +177,7 @@ async function fetchSlides(url, { fetchImpl = fetch } = {}) {
|
|
|
167
177
|
* The whole conversion, from archive bytes to sections and a report.
|
|
168
178
|
* Pure apart from the parsing, so the mapping is testable without a CLI.
|
|
169
179
|
*/
|
|
170
|
-
export function convert(zip, { build = 'auto' } = {}) {
|
|
180
|
+
export function convert(zip, { build = 'auto', shapes = 'auto' } = {}) {
|
|
171
181
|
const part = (name) => zip.get(name)?.toString('utf8');
|
|
172
182
|
const order = slideOrder(part('ppt/presentation.xml'), part('ppt/_rels/presentation.xml.rels'));
|
|
173
183
|
if (!order.length) throw new Error('no slides found — is this really a PowerPoint file?');
|
|
@@ -180,6 +190,7 @@ export function convert(zip, { build = 'auto' } = {}) {
|
|
|
180
190
|
if (!xml) continue;
|
|
181
191
|
const rels = parseRels(part(`${slidePath.replace(/([^/]+)$/, '_rels/$1')}.rels`));
|
|
182
192
|
const slide = parseSlide(xml, {
|
|
193
|
+
shapes,
|
|
183
194
|
rels,
|
|
184
195
|
mediaOf: (target) => {
|
|
185
196
|
const p = resolvePart(slidePath, target);
|
|
@@ -187,6 +198,8 @@ export function convert(zip, { build = 'auto' } = {}) {
|
|
|
187
198
|
return bytes ? { bytes, mime: mimeOf(p) } : null;
|
|
188
199
|
},
|
|
189
200
|
chartOf: (target) => zip.get(resolvePart(slidePath, target))?.toString() ?? null,
|
|
201
|
+
// the same seam, for the two parts a SmartArt graphic is made of
|
|
202
|
+
diagramOf: (target) => zip.get(resolvePart(slidePath, target))?.toString() ?? null,
|
|
190
203
|
});
|
|
191
204
|
n += 1;
|
|
192
205
|
|
|
@@ -204,8 +217,36 @@ export function convert(zip, { build = 'auto' } = {}) {
|
|
|
204
217
|
return { sections, report };
|
|
205
218
|
}
|
|
206
219
|
|
|
207
|
-
/**
|
|
208
|
-
|
|
220
|
+
/**
|
|
221
|
+
* The deck, in the `init` output shape: slides plus a configuration block, no
|
|
222
|
+
* runtime in the file (#520) — the servers reference the installed one on the
|
|
223
|
+
* way out, `bundle` embeds it at hand-over — or, with `inline`, self-contained.
|
|
224
|
+
* A theme derived from the template's own palette (`--theme template`) is not
|
|
225
|
+
* shipped, so it is always embedded, whatever the runtime does.
|
|
226
|
+
*/
|
|
227
|
+
export function deckHtml(sections, { title, theme, themeCss = null, inline = false }) {
|
|
228
|
+
const safeTitle = title.replace(/[<&]/g, (c) => (c === '<' ? '<' : '&'));
|
|
229
|
+
if (!inline) {
|
|
230
|
+
const themeTag = themeCss
|
|
231
|
+
? `\n <style data-theme="${theme}">\n${themeCss.replace(/<\/(script|style)/gi, '<\\/$1')}\n </style>`
|
|
232
|
+
: '';
|
|
233
|
+
return `<!doctype html>
|
|
234
|
+
<html lang="en">
|
|
235
|
+
<head>
|
|
236
|
+
<meta charset="utf-8">
|
|
237
|
+
<title>${safeTitle}</title>
|
|
238
|
+
${configBlockHtml({ theme })}${themeTag}
|
|
239
|
+
</head>
|
|
240
|
+
<body>
|
|
241
|
+
<div class="decklight">
|
|
242
|
+
|
|
243
|
+
${sections.join('\n\n')}
|
|
244
|
+
|
|
245
|
+
</div>
|
|
246
|
+
</body>
|
|
247
|
+
</html>
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
209
250
|
const css = runtimeCss();
|
|
210
251
|
// `themeCss` is a theme that is not shipped — the one derived from the
|
|
211
252
|
// template's own palette and fonts (tools/template-theme.mjs)
|
|
@@ -263,7 +304,7 @@ export async function adapterOffer(source, { home } = {}) {
|
|
|
263
304
|
if (!offered) return out;
|
|
264
305
|
|
|
265
306
|
out.push(` no adapter for ${ext} — ${offered.qualified} reads it:`,
|
|
266
|
-
` decklight
|
|
307
|
+
` decklight library add importer ${offered.qualified}`);
|
|
267
308
|
return out;
|
|
268
309
|
}
|
|
269
310
|
|
|
@@ -273,7 +314,7 @@ export async function importMain(args = []) {
|
|
|
273
314
|
return args.length ? 0 : 1;
|
|
274
315
|
}
|
|
275
316
|
const { opt } = argReader(args);
|
|
276
|
-
const VALUE = new Set(['-o', '--theme', '--build']);
|
|
317
|
+
const VALUE = new Set(['-o', '--theme', '--build', '--shapes']);
|
|
277
318
|
const source = args.find((a, i) => !a.startsWith('-') && !VALUE.has(args[i - 1]));
|
|
278
319
|
if (!source) { console.error(`decklight import: needs a file or a Google Slides URL\n\n${USAGE}`); return 1; }
|
|
279
320
|
|
|
@@ -292,6 +333,11 @@ export async function importMain(args = []) {
|
|
|
292
333
|
console.error(`decklight import: --build must be auto, all or none (got "${build}")`);
|
|
293
334
|
return 1;
|
|
294
335
|
}
|
|
336
|
+
const shapes = opt('--shapes', 'auto');
|
|
337
|
+
if (!['auto', 'strict', 'text'].includes(shapes)) {
|
|
338
|
+
console.error(`decklight import: --shapes must be auto, strict or text (got "${shapes}")`);
|
|
339
|
+
return 1;
|
|
340
|
+
}
|
|
295
341
|
|
|
296
342
|
const out = outPath(source, opt('-o'));
|
|
297
343
|
if (existsSync(out) && !args.includes('--force')) {
|
|
@@ -355,7 +401,7 @@ export async function importMain(args = []) {
|
|
|
355
401
|
const { html: sectionsHtml } = await runImporter(offered.name, readFileSync(source));
|
|
356
402
|
|
|
357
403
|
const title = basename(out).replace(/\.html$/, '').replace(/-/g, ' ').replace(/^./, (c) => c.toUpperCase());
|
|
358
|
-
writeFileSync(out, deckHtml([sectionsHtml], { title, theme }));
|
|
404
|
+
writeFileSync(out, deckHtml([sectionsHtml], { title, theme, inline: args.includes('--inline') }));
|
|
359
405
|
const slideCount = (sectionsHtml.match(/<section[\s>]/gi) ?? []).length;
|
|
360
406
|
const kb = Math.round(readFileSync(out).length / 1024);
|
|
361
407
|
console.error(`${out} · ${slideCount} slide(s) · theme ${theme} · ${kb} KB · imported via ${offered.name}`);
|
|
@@ -370,7 +416,7 @@ export async function importMain(args = []) {
|
|
|
370
416
|
let result;
|
|
371
417
|
try {
|
|
372
418
|
const zip = unzip(bytes);
|
|
373
|
-
result = convert(zip, { build });
|
|
419
|
+
result = convert(zip, { build, shapes });
|
|
374
420
|
// The template's palette and fonts — most of what "our template" means —
|
|
375
421
|
// are in ppt/theme/theme1.xml. Derived only when asked, because the
|
|
376
422
|
// default (a shipped theme) is what every existing import produced.
|
|
@@ -416,7 +462,7 @@ export async function importMain(args = []) {
|
|
|
416
462
|
}
|
|
417
463
|
|
|
418
464
|
const title = basename(out).replace(/\.html$/, '').replace(/-/g, ' ').replace(/^./, (c) => c.toUpperCase());
|
|
419
|
-
writeFileSync(out, deckHtml(result.sections, { title, theme, themeCss }));
|
|
465
|
+
writeFileSync(out, deckHtml(result.sections, { title, theme, themeCss, inline: args.includes('--inline') }));
|
|
420
466
|
const kb = Math.round(readFileSync(out).length / 1024);
|
|
421
467
|
const hiddenCount = result.report.filter((r) => r.hidden).length;
|
|
422
468
|
console.error(`${out} · ${result.sections.length} slides${hiddenCount ? ` (${hiddenCount} hidden)` : ''} · theme ${theme} · ${kb} KB`
|