dsh-ppt 0.24.2 → 0.26.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/CHANGELOG.md +16 -0
- package/README.en.md +13 -13
- package/README.md +13 -13
- package/docs/DATA.md +2 -2
- package/docs/REFERENCE.en.md +8 -8
- package/docs/REFERENCE.zh.md +8 -8
- package/docs/USAGE.en.md +11 -7
- package/docs/USAGE.md +11 -7
- package/docs/VALIDATION.md +4 -0
- package/docs/WORKBENCH.md +4 -4
- package/docs/assets/intro/workflow-en-dark.svg +1 -1
- package/docs/assets/intro/workflow-en-light.svg +1 -1
- package/docs/assets/intro/workflow-en-mobile-dark.svg +1 -1
- package/docs/assets/intro/workflow-en-mobile-light.svg +1 -1
- package/docs/assets/intro/workflow-zh-dark.svg +1 -1
- package/docs/assets/intro/workflow-zh-light.svg +1 -1
- package/docs/assets/intro/workflow-zh-mobile-dark.svg +1 -1
- package/docs/assets/intro/workflow-zh-mobile-light.svg +1 -1
- package/lib/client.js +3435 -467
- package/lib/ecosystem.d.ts +73 -0
- package/lib/ecosystem.js +1352 -0
- package/lib/execution.d.ts +6 -1
- package/lib/execution.js +69 -0
- package/lib/tools.js +77 -0
- package/lib/types.d.ts +57 -1
- package/lib/workbench-language.js +4 -0
- package/lib/workbench.d.ts +2 -0
- package/lib/workbench.js +331 -8
- package/package.json +1 -1
- package/skills/dsh-ppt/SKILL.md +3 -3
- package/skills/dsh-ppt/package.json +1 -1
- package/skills/dsh-ppt/references/advanced.md +10 -5
- package/skills/dsh-ppt/references/syntax.md +1 -0
- package/skills/dsh-ppt/scripts/build-deck.mjs +39 -8
- package/skills/dsh-ppt/scripts/deck-advanced.mjs +50 -13
- package/skills/dsh-ppt/scripts/deck-chrome.mjs +1706 -0
- package/skills/dsh-ppt/scripts/deck-core.mjs +116 -6
- package/skills/dsh-ppt/scripts/deck-delivery.mjs +636 -41
- package/skills/dsh-ppt/scripts/deck-diagrams.mjs +2842 -0
- package/skills/dsh-ppt/scripts/deck-director.mjs +49 -3
- package/skills/dsh-ppt/scripts/deck-layouts.mjs +482 -5270
- package/skills/dsh-ppt/scripts/deck-mermaid.mjs +2737 -0
- package/skills/dsh-ppt/scripts/deck-office.mjs +1541 -0
|
@@ -17,7 +17,7 @@ import { resolve as resolvePath } from 'node:path'
|
|
|
17
17
|
import { pathToFileURL } from 'node:url'
|
|
18
18
|
import { listThemes, THEME_IDS, DEFAULT_THEME } from './deck-themes.mjs'
|
|
19
19
|
import { CHROME_STYLE_IDS } from './deck-absorb.mjs'
|
|
20
|
-
import { buildDeckAsync, listTemplates, editDeck, undoDeck, checkDeckAsync, renderDeck, absorbPptx, importPptxDeck } from './deck-advanced.mjs'
|
|
20
|
+
import { buildDeckAsync, listTemplates, editDeck, undoDeck, checkDeckAsync, renderDeck, absorbPptx, importPptxDeck, importOfficeDeck } from './deck-advanced.mjs'
|
|
21
21
|
|
|
22
22
|
const HELP = `dsh-ppt —— 一句话 / 一篇文档 → HTML 放映 + PPTX 导出
|
|
23
23
|
|
|
@@ -35,15 +35,18 @@ const HELP = `dsh-ppt —— 一句话 / 一篇文档 → HTML 放映 + PPTX 导
|
|
|
35
35
|
--chrome <style> 母版骨架风格:${CHROME_STYLE_IDS.join(' / ')}
|
|
36
36
|
--absorb <deck.pptx> 只读检查并输出参考 .pptx 的净化主题、推荐内置主题/骨架与逐页分布 JSON
|
|
37
37
|
--import-pptx <path> 导入外部 .pptx 全量内容(标题/要点/表格/图表/图片/备注)并一键翻新为 dsh-ppt 工程
|
|
38
|
+
--from-office <path> 直吞 .xlsx / .csv / .tsv / .docx 数据表或 Word 报告,自动画像并生成全套文稿
|
|
38
39
|
--sync-pptx <path> 将 Office 修改后的 .pptx 内容回导同步至已有工程(自动写入 .history/ 支持撤销)
|
|
39
40
|
--target-project <dir> 配合 --sync-pptx 指定目标工程目录(或传 --edit <deck.json>)
|
|
40
41
|
--preserve-theme 配合 --import-pptx 使用,保留原 .pptx 净化后的品牌配色与 Logo
|
|
41
42
|
--no-modernize 配合 --import-pptx/--sync-pptx 关闭自动版式升维
|
|
42
43
|
--handout 同时生成 <file>.handout.md 演讲者讲义与逐字稿文件
|
|
44
|
+
--one-pager 同时生成 <file>.onepager.html 高管一页纸战报(默认不额外写盘,可在检查面板离线导出)
|
|
45
|
+
--target-minutes <n> 指定演讲目标总时长(分钟),计算逐页配速预算并标记超预算页
|
|
43
46
|
--smart-layout 显式开启多版式叙事节奏自动升维(配合 --no-smart-layout 可关闭)
|
|
44
47
|
--brand <json|@path> 品牌主辅颜色、标题/正文字体、封面反白、Logo、页脚、chromeStyle
|
|
45
48
|
--data-model <json|@path> 可选数字来源、公式与推演假设;配合 --slides
|
|
46
|
-
--edit <deck.json> 修改指定页或整套换肤,配合 --edits / --theme / --reference-pptx / --brand
|
|
49
|
+
--edit <deck.json> 修改指定页或整套换肤,配合 --edits / --theme / --reference-pptx / --brand / --target-minutes
|
|
47
50
|
--edits <json|@path> 页面修改指令数组
|
|
48
51
|
--undo <deck.json> 撤销最近一次修改
|
|
49
52
|
--check <deck.json> 查看质量报告和页码 / ID
|
|
@@ -64,10 +67,11 @@ const HELP = `dsh-ppt —— 一句话 / 一篇文档 → HTML 放映 + PPTX 导
|
|
|
64
67
|
--help 显示本帮助
|
|
65
68
|
|
|
66
69
|
输出:
|
|
67
|
-
<file>.html
|
|
68
|
-
<file>.pptx
|
|
69
|
-
<file>.json
|
|
70
|
-
<file>.handout.md
|
|
70
|
+
<file>.html 独立网页放映(无外链,支持按 P 启动双屏演讲者提词台、按 L 开启虚拟激光笔)
|
|
71
|
+
<file>.pptx 可编辑 PPTX(16:9)
|
|
72
|
+
<file>.json deck manifest
|
|
73
|
+
<file>.handout.md 演讲者讲义(传 --handout 时同步落盘,HTML 检查面板随时可下载)
|
|
74
|
+
<file>.onepager.html 高管一页纸战报(传 --one-pager 时同步落盘,HTML 检查面板随时可下载)
|
|
71
75
|
`
|
|
72
76
|
|
|
73
77
|
export function parseArgv(argv) {
|
|
@@ -100,11 +104,14 @@ export function parseArgv(argv) {
|
|
|
100
104
|
else if (key === '--reference-pptx') args.referencePptx = nextValue()
|
|
101
105
|
else if (key === '--absorb') args.absorb = nextValue()
|
|
102
106
|
else if (key === '--import-pptx') args.importPptx = nextValue()
|
|
107
|
+
else if (key === '--from-office') args.fromOffice = nextValue()
|
|
103
108
|
else if (key === '--sync-pptx') args.syncPptx = nextValue()
|
|
104
109
|
else if (key === '--target-project') args.targetProject = nextValue()
|
|
105
110
|
else if (key === '--preserve-theme') args.preserveTheme = true
|
|
106
111
|
else if (key === '--no-modernize') args.modernize = false
|
|
107
112
|
else if (key === '--handout') args.handout = true
|
|
113
|
+
else if (key === '--one-pager') args.onePager = true
|
|
114
|
+
else if (key === '--target-minutes') args.targetMinutes = Number(nextValue())
|
|
108
115
|
else if (key === '--brand') args.brand = readJson(nextValue())
|
|
109
116
|
else if (key === '--data-model') args.dataModel = readJson(nextValue())
|
|
110
117
|
else if (key === '--edit') args.edit = nextValue()
|
|
@@ -152,11 +159,31 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
152
159
|
return 0
|
|
153
160
|
}
|
|
154
161
|
if (args.listTemplates) { log(JSON.stringify({ templates: listTemplates(args.lang) }, null, 2)); return 0 }
|
|
155
|
-
if ([args.edit && !args.syncPptx ? args.edit : null, args.undo, args.check, args.render, args.absorb, args.importPptx, args.syncPptx].filter(Boolean).length > 1) {
|
|
156
|
-
throw new Error('dsh-ppt CLI:--edit / --undo / --check / --render / --absorb / --import-pptx / --sync-pptx 只能选择一项')
|
|
162
|
+
if ([args.edit && !args.syncPptx ? args.edit : null, args.undo, args.check, args.render, args.absorb, args.importPptx, args.syncPptx, args.fromOffice].filter(Boolean).length > 1) {
|
|
163
|
+
throw new Error('dsh-ppt CLI:--edit / --undo / --check / --render / --absorb / --import-pptx / --sync-pptx / --from-office 只能选择一项')
|
|
157
164
|
}
|
|
158
165
|
if (args.renderReceipt !== undefined && !args.check) throw new Error('dsh-ppt CLI:--render-receipt 需配合 --check')
|
|
159
166
|
if (!args.render && [args.format, args.width, args.timeoutMs].some(v => v !== undefined)) throw new Error('dsh-ppt CLI:--format / --width / --timeout 需配合 --render')
|
|
167
|
+
if (args.fromOffice) {
|
|
168
|
+
const imported = await importOfficeDeck({
|
|
169
|
+
filePath: args.fromOffice,
|
|
170
|
+
outDir: resolvePath(args.out || '.'),
|
|
171
|
+
outputDir: resolvePath(args.out || '.'),
|
|
172
|
+
...(args.title ? { title: args.title } : {}),
|
|
173
|
+
...(args.file ? { fileName: args.file } : {}),
|
|
174
|
+
...(args.theme ? { theme: args.theme } : {}),
|
|
175
|
+
...(args.persona ? { persona: args.persona } : {}),
|
|
176
|
+
...(args.chrome ? { chromeStyle: args.chrome } : {}),
|
|
177
|
+
...(args.lang ? { lang: args.lang } : {}),
|
|
178
|
+
...(args.motion ? { motion: args.motion } : {}),
|
|
179
|
+
...(args.targetMinutes !== undefined ? { targetMinutes: args.targetMinutes } : {}),
|
|
180
|
+
overwrite: args.overwrite === true,
|
|
181
|
+
handout: args.handout === true,
|
|
182
|
+
onePager: args.onePager === true,
|
|
183
|
+
})
|
|
184
|
+
log(JSON.stringify(imported, null, 2))
|
|
185
|
+
return 0
|
|
186
|
+
}
|
|
160
187
|
if (args.importPptx || args.syncPptx) {
|
|
161
188
|
const imported = await importPptxDeck({
|
|
162
189
|
pptxPath: args.importPptx || args.syncPptx,
|
|
@@ -206,6 +233,7 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
206
233
|
theme: args.theme,
|
|
207
234
|
referencePptx: args.referencePptx,
|
|
208
235
|
brand: effectiveBrand,
|
|
236
|
+
...(args.targetMinutes !== undefined ? { targetMinutes: args.targetMinutes } : {}),
|
|
209
237
|
expectedRevision: args.revision,
|
|
210
238
|
})
|
|
211
239
|
: await undoDeck({ deckPath: args.undo, expectedRevision: args.revision })
|
|
@@ -243,6 +271,8 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
243
271
|
brand: effectiveBrand,
|
|
244
272
|
dataModel: args.dataModel,
|
|
245
273
|
...(args.handout ? { handout: true } : {}),
|
|
274
|
+
...(args.onePager ? { onePager: true } : {}),
|
|
275
|
+
...(args.targetMinutes !== undefined ? { targetMinutes: args.targetMinutes } : {}),
|
|
246
276
|
}
|
|
247
277
|
const result = await buildDeckAsync(options)
|
|
248
278
|
log('dsh-ppt 已生成 ' + result.slideCount + ' 页演示文稿:')
|
|
@@ -250,6 +280,7 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
250
280
|
log(' PPTX 导出:' + result.pptxPath)
|
|
251
281
|
log(' Manifest :' + result.jsonPath)
|
|
252
282
|
if (result.handoutPath) log(' 讲义 Handout:' + result.handoutPath)
|
|
283
|
+
if (result.onePagerPath) log(' 高管一页纸:' + result.onePagerPath)
|
|
253
284
|
if (result.deliveryStatus === 'draft') log(' 草稿:还有待填写内容,不可作为成品交付。')
|
|
254
285
|
log(' 质量检查:' + result.quality.errorCount + ' 个错误 / ' + result.quality.warningCount + ' 个提醒;修订号 ' + result.revision)
|
|
255
286
|
return 0
|
|
@@ -10,7 +10,7 @@ import { normalizeDataModel, prepareDataSlides, validateDataSnapshot, previewDat
|
|
|
10
10
|
import { normalizeVisual, applyVisualActions } from './deck-visual.mjs'
|
|
11
11
|
import { absorbPptx, CHROME_STYLE_IDS } from './deck-absorb.mjs'
|
|
12
12
|
import { extractPptxSlides } from './deck-import.mjs'
|
|
13
|
-
import { renderHandoutMarkdown } from './deck-delivery.mjs'
|
|
13
|
+
import { renderHandoutMarkdown, computePaceBudget, renderOnePagerHtml } from './deck-delivery.mjs'
|
|
14
14
|
import { SCENARIO_TEMPLATES, findScenarioTemplate, buildScenarioSlides, listScenarioTemplates, inferThemeFromContent, promoteMarkdownSlides, auditSlideAesthetics } from './deck-director.mjs'
|
|
15
15
|
export { readRenderReceipt } from './deck-render.mjs'
|
|
16
16
|
export { dataNotes, dataReport } from './deck-data.mjs'
|
|
@@ -18,7 +18,8 @@ export { buildDeck, resolveLanguage } from './deck-core.mjs'
|
|
|
18
18
|
export { listThemes, listMasterPresets, resolveTheme } from './deck-themes.mjs'
|
|
19
19
|
export { absorbPptx } from './deck-absorb.mjs'
|
|
20
20
|
export { extractPptxSlides } from './deck-import.mjs'
|
|
21
|
-
export { renderHandoutMarkdown } from './deck-delivery.mjs'
|
|
21
|
+
export { renderHandoutMarkdown, computePaceBudget, renderOnePagerHtml } from './deck-delivery.mjs'
|
|
22
|
+
export { extractOfficeSource, importOfficeDeck } from './deck-office.mjs'
|
|
22
23
|
export { inferThemeFromContent } from './deck-director.mjs'
|
|
23
24
|
|
|
24
25
|
export function buildThemePreview(options = {}) {
|
|
@@ -198,7 +199,7 @@ function validateRawSlides(slides) {
|
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
function snapshot(manifest) {
|
|
201
|
-
return clone(Object.fromEntries(['title', 'theme', 'language', 'motion', 'slides', 'brand', 'template', 'dataModel'].filter(k => manifest[k] !== undefined).map(k => [k, manifest[k]])))
|
|
202
|
+
return clone(Object.fromEntries(['title', 'theme', 'language', 'motion', 'slides', 'brand', 'template', 'dataModel', 'targetMinutes'].filter(k => manifest[k] !== undefined).map(k => [k, manifest[k]])))
|
|
202
203
|
}
|
|
203
204
|
|
|
204
205
|
function collectAssets(manifest) {
|
|
@@ -426,15 +427,18 @@ function documentBytes(manifest) {
|
|
|
426
427
|
if (Buffer.byteLength(text) > MAX_DOCUMENT) fail('JSON 工程含历史超过 64 MiB,请缩减图片或清理历史后另存工程')
|
|
427
428
|
return text
|
|
428
429
|
}
|
|
429
|
-
function result(manifest, paths, writeHandout = false) {
|
|
430
|
+
function result(manifest, paths, writeHandout = false, writeOnePager = false) {
|
|
430
431
|
const handoutPath = paths.json.slice(0, -5) + '.handout.md'
|
|
432
|
+
const onePagerPath = paths.json.slice(0, -5) + '.onepager.html'
|
|
433
|
+
const paceBudget = computePaceBudget(manifest)
|
|
431
434
|
return { ok: true, title: manifest.title, theme: manifest.theme, language: manifest.language,
|
|
432
435
|
slideCount: manifest.slides.length, deckId: manifest.deckId, revision: manifest.revision,
|
|
433
436
|
slides: manifest.slides.map((s, i) => ({ slide: i + 1, id: s.id, title: s.title, layout: s.layout })),
|
|
434
437
|
undoAvailable: manifest.history.length, deliveryStatus: manifest.quality?.issues.some(i => i.code === 'template-unfilled') ? 'draft' : 'ready-for-review',
|
|
435
|
-
quality: manifest.quality, verification: { static: 'checked', pptxRender: 'not-verified', visual: 'not-verified' }, outputDir: dirname(paths.json),
|
|
438
|
+
quality: manifest.quality, paceBudget, verification: { static: 'checked', pptxRender: 'not-verified', visual: 'not-verified' }, outputDir: dirname(paths.json),
|
|
436
439
|
files: paths, htmlPath: paths.html, pptxPath: paths.pptx, jsonPath: paths.json,
|
|
437
|
-
...(writeHandout ? { handoutPath } : {})
|
|
440
|
+
...(writeHandout ? { handoutPath } : {}),
|
|
441
|
+
...(writeOnePager ? { onePagerPath } : {}) }
|
|
438
442
|
}
|
|
439
443
|
function pathsFor(jsonPath) {
|
|
440
444
|
const base = jsonPath.slice(0, -5)
|
|
@@ -459,9 +463,14 @@ async function generate(manifest, signal) {
|
|
|
459
463
|
abort(signal)
|
|
460
464
|
return { json, pptx, manifest, theme, language }
|
|
461
465
|
}
|
|
462
|
-
function commit(paths, data, writeHandout = false) {
|
|
466
|
+
function commit(paths, data, writeHandout = false, writeOnePager = false) {
|
|
463
467
|
const handoutPath = paths.json.slice(0, -5) + '.handout.md'
|
|
464
|
-
const
|
|
468
|
+
const onePagerPath = paths.json.slice(0, -5) + '.onepager.html'
|
|
469
|
+
const html = renderHtml(data.manifest, data.theme, data.language, {
|
|
470
|
+
...paths,
|
|
471
|
+
...(writeHandout ? { handout: handoutPath } : {}),
|
|
472
|
+
...(writeOnePager ? { onepager: onePagerPath } : {}),
|
|
473
|
+
})
|
|
465
474
|
data.manifest.artifacts = { html: hash(html), pptx: hash(data.pptx) }
|
|
466
475
|
const artifacts = [
|
|
467
476
|
{ path: paths.json, data: documentBytes(data.manifest), encoding: 'utf8' },
|
|
@@ -471,6 +480,9 @@ function commit(paths, data, writeHandout = false) {
|
|
|
471
480
|
if (writeHandout) {
|
|
472
481
|
artifacts.push({ path: handoutPath, data: renderHandoutMarkdown(data.manifest, data.language.id), encoding: 'utf8' })
|
|
473
482
|
}
|
|
483
|
+
if (writeOnePager) {
|
|
484
|
+
artifacts.push({ path: onePagerPath, data: renderOnePagerHtml(data.manifest, data.language.id), encoding: 'utf8' })
|
|
485
|
+
}
|
|
474
486
|
commitDeckArtifacts(artifacts)
|
|
475
487
|
}
|
|
476
488
|
|
|
@@ -481,6 +493,11 @@ function validateEmbeddedImgObject(img, assets) {
|
|
|
481
493
|
|
|
482
494
|
function validateSnapshot(value, assets) {
|
|
483
495
|
resolveTheme(value.theme); resolveLanguage(value.language)
|
|
496
|
+
if (value.targetMinutes !== undefined) {
|
|
497
|
+
if (typeof value.targetMinutes !== 'number' || !Number.isFinite(value.targetMinutes) || value.targetMinutes <= 0 || value.targetMinutes > 480) {
|
|
498
|
+
fail('targetMinutes 需为 0 到 480 之间的正数')
|
|
499
|
+
}
|
|
500
|
+
}
|
|
484
501
|
validateRawSlides(value.slides)
|
|
485
502
|
validateDataSnapshot(value, normalizeSlides)
|
|
486
503
|
if (value.brand != null) {
|
|
@@ -637,6 +654,13 @@ export async function buildDeckAsync(options = {}) {
|
|
|
637
654
|
}
|
|
638
655
|
const brand = normalizeBrand(brandInput, assets, cwd)
|
|
639
656
|
|
|
657
|
+
const targetMinutesRaw = options.targetMinutes !== undefined && options.targetMinutes !== null
|
|
658
|
+
? Number(options.targetMinutes)
|
|
659
|
+
: undefined
|
|
660
|
+
if (targetMinutesRaw !== undefined && (!Number.isFinite(targetMinutesRaw) || targetMinutesRaw <= 0 || targetMinutesRaw > 480)) {
|
|
661
|
+
fail('targetMinutes 需为 0 到 480 之间的正数')
|
|
662
|
+
}
|
|
663
|
+
|
|
640
664
|
const manifest = {
|
|
641
665
|
version: DECK_VERSION,
|
|
642
666
|
schemaVersion: 1,
|
|
@@ -646,6 +670,7 @@ export async function buildDeckAsync(options = {}) {
|
|
|
646
670
|
theme: normalized.theme.id,
|
|
647
671
|
language: normalized.language.id,
|
|
648
672
|
motion: normalized.motion,
|
|
673
|
+
...(targetMinutesRaw !== undefined ? { targetMinutes: targetMinutesRaw } : {}),
|
|
649
674
|
...(scenario ? { template: scenario.id } : {}),
|
|
650
675
|
...(brand ? { brand } : {}),
|
|
651
676
|
...(dataModel ? { dataModel } : {}),
|
|
@@ -659,8 +684,9 @@ export async function buildDeckAsync(options = {}) {
|
|
|
659
684
|
const file = resolveDeckFileName(normalized.outputDir, normalized.fileName, normalized.overwrite)
|
|
660
685
|
const paths = pathsFor(resolve(normalized.outputDir, file + '.json'))
|
|
661
686
|
const writeHandout = options.handout === true
|
|
662
|
-
|
|
663
|
-
|
|
687
|
+
const writeOnePager = options.onePager === true
|
|
688
|
+
withLock(paths.json, () => { abort(options.signal); commit(paths, data, writeHandout, writeOnePager) })
|
|
689
|
+
return result(manifest, paths, writeHandout, writeOnePager)
|
|
664
690
|
}
|
|
665
691
|
|
|
666
692
|
function readDocument(pathInput, cwd = '.') {
|
|
@@ -737,15 +763,16 @@ export async function editDeck(options = {}) {
|
|
|
737
763
|
options.duplicate === undefined &&
|
|
738
764
|
options.remove === undefined &&
|
|
739
765
|
options.append === undefined &&
|
|
766
|
+
options.targetMinutes === undefined &&
|
|
740
767
|
options.saveAs !== true
|
|
741
768
|
) {
|
|
742
|
-
fail('请提供 edits、theme、referencePptx、order、duplicate、remove、append 或 brand')
|
|
769
|
+
fail('请提供 edits、theme、referencePptx、order、duplicate、remove、append、targetMinutes 或 brand')
|
|
743
770
|
}
|
|
744
771
|
}
|
|
745
772
|
const used = new Set()
|
|
746
773
|
const allowed = new Set([
|
|
747
774
|
'layout', 'variant', 'chrome', 'title', 'subtitle', 'kicker', 'takeaway', 'source',
|
|
748
|
-
'text', 'formula', 'activeIndex', 'tableStyle', 'bullets', 'items', 'cards', 'metrics',
|
|
775
|
+
'text', 'formula', 'mermaid', 'activeIndex', 'tableStyle', 'bullets', 'items', 'cards', 'metrics',
|
|
749
776
|
'columns', 'steps', 'quadrants', 'rows', 'notes', 'image', 'images', 'chart', 'visual',
|
|
750
777
|
])
|
|
751
778
|
for (const edit of options.edits ?? []) {
|
|
@@ -840,6 +867,16 @@ export async function editDeck(options = {}) {
|
|
|
840
867
|
next.brand = normalizeBrand({ ...next.brand, ...absorbedBrand }, next.assets, cwd)
|
|
841
868
|
}
|
|
842
869
|
|
|
870
|
+
if (options.targetMinutes !== undefined) {
|
|
871
|
+
if (options.targetMinutes === null) {
|
|
872
|
+
delete next.targetMinutes
|
|
873
|
+
} else {
|
|
874
|
+
const tm = Number(options.targetMinutes)
|
|
875
|
+
if (!Number.isFinite(tm) || tm <= 0 || tm > 480) fail('targetMinutes 需为 0 到 480 之间的正数')
|
|
876
|
+
next.targetMinutes = tm
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
843
880
|
if (options.brand !== undefined) {
|
|
844
881
|
next.brand = normalizeBrand(options.brand === null ? null : { ...next.brand, ...options.brand,
|
|
845
882
|
...(options.brand?.logo === null ? { logo: undefined, logoAssetId: undefined } : {}) }, next.assets, cwd)
|
|
@@ -870,7 +907,7 @@ export async function undoDeck(options = {}) {
|
|
|
870
907
|
expected(state.manifest, options.expectedRevision)
|
|
871
908
|
if (!state.manifest.history.length) fail('该工程没有可撤销的修改')
|
|
872
909
|
const next = clone(state.manifest), prior = next.history.pop()
|
|
873
|
-
for (const key of ['brand', 'template', 'dataModel']) delete next[key]
|
|
910
|
+
for (const key of ['brand', 'template', 'dataModel', 'targetMinutes']) delete next[key]
|
|
874
911
|
Object.assign(next, prior)
|
|
875
912
|
return saveRevision(state, next, options.signal)
|
|
876
913
|
}
|