teamshare-bridge 0.28.15 → 0.28.17
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/dist/bridge/daemon-inbox.js +44 -28
- package/dist/bridge/daemon-inbox.js.map +1 -1
- package/dist/bridge/wake-handler.js +24 -0
- package/dist/bridge/wake-handler.js.map +1 -1
- package/dist/bridge/wake-outbox.d.ts +8 -0
- package/dist/bridge/wake-outbox.js +18 -0
- package/dist/bridge/wake-outbox.js.map +1 -1
- package/dist/cli/commands/run.js +30 -0
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/stop.d.ts +1 -0
- package/dist/cli/commands/stop.js +280 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/index.js +9 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/lib/api-tasks.d.ts +5 -0
- package/dist/lib/api-tasks.js +7 -0
- package/dist/lib/api-tasks.js.map +1 -1
- package/dist/lib/api-types.d.ts +31 -0
- package/dist/lib/brief.js +52 -0
- package/dist/lib/brief.js.map +1 -1
- package/dist/lib/chat/doc-reply.js +7 -4
- package/dist/lib/chat/doc-reply.js.map +1 -1
- package/dist/lib/human-style.d.ts +1 -1
- package/dist/lib/human-style.js +1 -1
- package/dist/lib/human-style.js.map +1 -1
- package/dist/lib/tools/pptx-deck.d.ts +60 -1
- package/dist/lib/tools/pptx-deck.js +466 -1
- package/dist/lib/tools/pptx-deck.js.map +1 -1
- package/package.json +1 -1
|
@@ -44,6 +44,13 @@ exports.KNOWN_LAYOUTS = [
|
|
|
44
44
|
'table',
|
|
45
45
|
'closing',
|
|
46
46
|
'sources',
|
|
47
|
+
// Premium layouts (2026-11): native charts, hero images, KPI tiles and a
|
|
48
|
+
// simple auto-laid-out diagram. All render with PPTX shapes so they stay
|
|
49
|
+
// editable in PowerPoint afterwards.
|
|
50
|
+
'image',
|
|
51
|
+
'chart',
|
|
52
|
+
'kpi',
|
|
53
|
+
'diagram',
|
|
47
54
|
];
|
|
48
55
|
/** Built-in corporate-equivalent defaults (used only when the mirror file is unreadable). */
|
|
49
56
|
exports.FALLBACK_TOKENS = {
|
|
@@ -242,7 +249,8 @@ function planDeck(spec, opts) {
|
|
|
242
249
|
columns = Math.min(Math.max(slide.columns.length, 1), 2);
|
|
243
250
|
else if (layout === 'cards' && Array.isArray(slide.cards))
|
|
244
251
|
columns = Math.min(Math.max(slide.cards.length, 1), 4);
|
|
245
|
-
else if (layout === 'stats'
|
|
252
|
+
else if ((layout === 'stats' || layout === 'kpi') &&
|
|
253
|
+
Array.isArray(slide.stats))
|
|
246
254
|
columns = Math.min(Math.max(slide.stats.length, 1), 4);
|
|
247
255
|
const statementBump = layout === 'statement' ||
|
|
248
256
|
layout === 'quote' ||
|
|
@@ -304,6 +312,388 @@ function shapeFor(tokens, pptx) {
|
|
|
304
312
|
return pptx.ShapeType.rect;
|
|
305
313
|
return pptx.ShapeType.roundRect;
|
|
306
314
|
}
|
|
315
|
+
// ─── Premium primitives (2026-11) ───────────────────────────────────────────
|
|
316
|
+
/** Slide dimensions in inches, used for aspect-correct image sizing. */
|
|
317
|
+
const SLIDE_SIZE_IN = {
|
|
318
|
+
'16:9': { w: 13.333, h: 7.5 },
|
|
319
|
+
'4:3': { w: 10, h: 7.5 },
|
|
320
|
+
};
|
|
321
|
+
function inches(value, total) {
|
|
322
|
+
return Math.max(0.1, (value / 100) * total);
|
|
323
|
+
}
|
|
324
|
+
function asPercent(value, fallback) {
|
|
325
|
+
const n = typeof value === 'number' ? value : Number(value);
|
|
326
|
+
return Number.isFinite(n) ? n : fallback;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Map an agent-friendly shape name to a real PowerPoint preset.
|
|
330
|
+
*
|
|
331
|
+
* Deliberately a PRESET list: PowerPoint freeform paths are not part of
|
|
332
|
+
* pptxgenjs, so "freeform" means one of these presets. An unknown name falls
|
|
333
|
+
* back to a rounded rectangle instead of dropping the shape.
|
|
334
|
+
*/
|
|
335
|
+
function presetShapeName(pptx, raw) {
|
|
336
|
+
const key = typeof raw === 'string' ? raw.trim().toLowerCase() : '';
|
|
337
|
+
if (!key)
|
|
338
|
+
return null;
|
|
339
|
+
const map = {
|
|
340
|
+
rect: pptx.ShapeType.rect,
|
|
341
|
+
square: pptx.ShapeType.rect,
|
|
342
|
+
roundrect: pptx.ShapeType.roundRect,
|
|
343
|
+
rounded: pptx.ShapeType.roundRect,
|
|
344
|
+
ellipse: pptx.ShapeType.ellipse,
|
|
345
|
+
circle: pptx.ShapeType.ellipse,
|
|
346
|
+
triangle: pptx.ShapeType.triangle,
|
|
347
|
+
diamond: pptx.ShapeType.diamond,
|
|
348
|
+
hexagon: pptx.ShapeType.hexagon,
|
|
349
|
+
pentagon: pptx.ShapeType.pentagon,
|
|
350
|
+
parallelogram: pptx.ShapeType.parallelogram,
|
|
351
|
+
trapezoid: pptx.ShapeType.trapezoid,
|
|
352
|
+
chevron: pptx.ShapeType.chevron,
|
|
353
|
+
line: pptx.ShapeType.line,
|
|
354
|
+
arrow: pptx.ShapeType.rightArrow,
|
|
355
|
+
rightarrow: pptx.ShapeType.rightArrow,
|
|
356
|
+
leftarrow: pptx.ShapeType.leftArrow,
|
|
357
|
+
uparrow: pptx.ShapeType.upArrow,
|
|
358
|
+
downarrow: pptx.ShapeType.downArrow,
|
|
359
|
+
star: pptx.ShapeType.star5,
|
|
360
|
+
cloud: pptx.ShapeType.cloud,
|
|
361
|
+
callout: pptx.ShapeType.wedgeRoundRectCallout,
|
|
362
|
+
process: pptx.ShapeType.flowChartProcess,
|
|
363
|
+
};
|
|
364
|
+
return map[key] ?? null;
|
|
365
|
+
}
|
|
366
|
+
/** Image source pptxgenjs understands (remote URL or inline base64). */
|
|
367
|
+
function imageSource(image) {
|
|
368
|
+
if (typeof image.data === 'string' && image.data.trim()) {
|
|
369
|
+
const raw = image.data.trim();
|
|
370
|
+
if (raw.startsWith('data:')) {
|
|
371
|
+
// pptxgenjs wants `image/png;base64,<payload>` without the data: prefix.
|
|
372
|
+
return { data: raw.replace(/^data:/i, '') };
|
|
373
|
+
}
|
|
374
|
+
const mime = image.mime?.trim() || 'image/png';
|
|
375
|
+
return { data: `${mime};base64,${raw}` };
|
|
376
|
+
}
|
|
377
|
+
if (typeof image.url === 'string' && /^https?:\/\//i.test(image.url.trim())) {
|
|
378
|
+
return { path: image.url.trim() };
|
|
379
|
+
}
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
function coerceImages(value) {
|
|
383
|
+
if (!Array.isArray(value))
|
|
384
|
+
return [];
|
|
385
|
+
return value
|
|
386
|
+
.filter((item) => !!item && typeof item === 'object')
|
|
387
|
+
.map((item) => ({
|
|
388
|
+
url: typeof item.url === 'string' ? item.url : undefined,
|
|
389
|
+
data: typeof item.data === 'string' ? item.data : undefined,
|
|
390
|
+
mime: typeof item.mime === 'string' ? item.mime : undefined,
|
|
391
|
+
caption: typeof item.caption === 'string' ? item.caption : undefined,
|
|
392
|
+
x: typeof item.x === 'number' ? item.x : undefined,
|
|
393
|
+
y: typeof item.y === 'number' ? item.y : undefined,
|
|
394
|
+
w: typeof item.w === 'number' ? item.w : undefined,
|
|
395
|
+
h: typeof item.h === 'number' ? item.h : undefined,
|
|
396
|
+
sizing: item.sizing === 'cover' ? 'cover' : 'contain',
|
|
397
|
+
rounded: item.rounded === true,
|
|
398
|
+
}));
|
|
399
|
+
}
|
|
400
|
+
function coerceChart(value) {
|
|
401
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
402
|
+
return null;
|
|
403
|
+
return value;
|
|
404
|
+
}
|
|
405
|
+
function coerceShapes(value) {
|
|
406
|
+
if (!Array.isArray(value))
|
|
407
|
+
return [];
|
|
408
|
+
return value
|
|
409
|
+
.filter((item) => !!item && typeof item === 'object')
|
|
410
|
+
.map((item) => ({
|
|
411
|
+
type: typeof item.type === 'string' ? item.type : undefined,
|
|
412
|
+
x: typeof item.x === 'number' ? item.x : undefined,
|
|
413
|
+
y: typeof item.y === 'number' ? item.y : undefined,
|
|
414
|
+
w: typeof item.w === 'number' ? item.w : undefined,
|
|
415
|
+
h: typeof item.h === 'number' ? item.h : undefined,
|
|
416
|
+
fill: typeof item.fill === 'string' ? item.fill : undefined,
|
|
417
|
+
transparency: typeof item.transparency === 'number' ? item.transparency : undefined,
|
|
418
|
+
radius: typeof item.radius === 'number' ? item.radius : undefined,
|
|
419
|
+
}));
|
|
420
|
+
}
|
|
421
|
+
function coerceDiagramNodes(value) {
|
|
422
|
+
if (!Array.isArray(value))
|
|
423
|
+
return [];
|
|
424
|
+
return value
|
|
425
|
+
.map((item) => typeof item === 'string'
|
|
426
|
+
? { label: stripMd(item) }
|
|
427
|
+
: item && typeof item === 'object'
|
|
428
|
+
? {
|
|
429
|
+
id: typeof item.id === 'string'
|
|
430
|
+
? item.id
|
|
431
|
+
: undefined,
|
|
432
|
+
label: typeof item.label === 'string'
|
|
433
|
+
? stripMd(item.label)
|
|
434
|
+
: undefined,
|
|
435
|
+
}
|
|
436
|
+
: {})
|
|
437
|
+
.filter((n) => !!n.label)
|
|
438
|
+
.slice(0, 8);
|
|
439
|
+
}
|
|
440
|
+
/** Decorative preset shapes drawn UNDER the slide content. */
|
|
441
|
+
function renderShapes(slide, pptx, tokens, shapes) {
|
|
442
|
+
shapes.slice(0, 8).forEach((shape) => {
|
|
443
|
+
const name = presetShapeName(pptx, shape.type) ?? shapeFor(tokens, pptx);
|
|
444
|
+
slide.addShape(name, {
|
|
445
|
+
x: `${asPercent(shape.x, 8)}%`,
|
|
446
|
+
y: `${asPercent(shape.y, 8)}%`,
|
|
447
|
+
w: `${asPercent(shape.w, 20)}%`,
|
|
448
|
+
h: `${asPercent(shape.h, 10)}%`,
|
|
449
|
+
fill: {
|
|
450
|
+
color: (shape.fill ?? tokens.surface).replace(/^#/, '').toUpperCase(),
|
|
451
|
+
transparency: typeof shape.transparency === 'number' ? shape.transparency : 0,
|
|
452
|
+
},
|
|
453
|
+
line: { color: tokens.background, transparency: 100 },
|
|
454
|
+
...(shape.radius &&
|
|
455
|
+
name === pptx.ShapeType.roundRect
|
|
456
|
+
? { rectRadius: shape.radius }
|
|
457
|
+
: {}),
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
/** One placed image + optional caption. Returns false when there is no source. */
|
|
462
|
+
function renderImageEntry(slide, tokens, image, box, size, plan) {
|
|
463
|
+
const source = imageSource(image);
|
|
464
|
+
if (!source)
|
|
465
|
+
return false;
|
|
466
|
+
const geom = {
|
|
467
|
+
x: inches(box.x, size.w),
|
|
468
|
+
y: inches(box.y, size.h),
|
|
469
|
+
w: inches(box.w, size.w),
|
|
470
|
+
h: inches(box.h, size.h),
|
|
471
|
+
};
|
|
472
|
+
slide.addImage({
|
|
473
|
+
...source,
|
|
474
|
+
...geom,
|
|
475
|
+
sizing: { type: image.sizing ?? 'contain', w: geom.w, h: geom.h },
|
|
476
|
+
...(image.rounded ? { rounding: true } : {}),
|
|
477
|
+
});
|
|
478
|
+
if (image.caption) {
|
|
479
|
+
slide.addText(image.caption, {
|
|
480
|
+
x: `${box.x}%`,
|
|
481
|
+
y: `${Math.min(box.y + box.h + 1, 93)}%`,
|
|
482
|
+
w: `${box.w}%`,
|
|
483
|
+
h: '5%',
|
|
484
|
+
fontSize: Math.max(plan.bodySize - 4, 9),
|
|
485
|
+
fontFace: tokens.bodyFont,
|
|
486
|
+
color: tokens.textColor,
|
|
487
|
+
transparency: 35,
|
|
488
|
+
align: 'center',
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
function chartKind(pptx, raw) {
|
|
494
|
+
const key = typeof raw === 'string' ? raw.trim().toLowerCase() : 'bar';
|
|
495
|
+
const map = {
|
|
496
|
+
bar: pptx.ChartType.bar,
|
|
497
|
+
bar3d: pptx.ChartType.bar3d,
|
|
498
|
+
line: pptx.ChartType.line,
|
|
499
|
+
pie: pptx.ChartType.pie,
|
|
500
|
+
doughnut: pptx.ChartType.doughnut,
|
|
501
|
+
area: pptx.ChartType.area,
|
|
502
|
+
scatter: pptx.ChartType.scatter,
|
|
503
|
+
radar: pptx.ChartType.radar,
|
|
504
|
+
};
|
|
505
|
+
return map[key] ?? pptx.ChartType.bar;
|
|
506
|
+
}
|
|
507
|
+
/** Native, data-editable PowerPoint chart. Returns false on unusable data. */
|
|
508
|
+
function renderChart(slide, pptx, tokens, chart, plan) {
|
|
509
|
+
const categories = Array.isArray(chart.categories)
|
|
510
|
+
? chart.categories.map((c) => stripMd(String(c ?? '')))
|
|
511
|
+
: [];
|
|
512
|
+
const rawSeries = Array.isArray(chart.series) ? chart.series : [];
|
|
513
|
+
const series = rawSeries
|
|
514
|
+
.filter((s) => !!s && typeof s === 'object')
|
|
515
|
+
.map((s, index) => {
|
|
516
|
+
const values = Array.isArray(s.values) ? s.values : [];
|
|
517
|
+
return {
|
|
518
|
+
name: typeof s.name === 'string' && s.name.trim()
|
|
519
|
+
? stripMd(s.name)
|
|
520
|
+
: `Series ${index + 1}`,
|
|
521
|
+
values: values.map((v) => {
|
|
522
|
+
const n = typeof v === 'number' ? v : Number(v);
|
|
523
|
+
return Number.isFinite(n) ? n : 0;
|
|
524
|
+
}),
|
|
525
|
+
};
|
|
526
|
+
})
|
|
527
|
+
.filter((s) => s.values.length > 0);
|
|
528
|
+
if (!series.length || !categories.length)
|
|
529
|
+
return false;
|
|
530
|
+
const labels = categories.length
|
|
531
|
+
? categories
|
|
532
|
+
: series[0].values.map((_, i) => String(i + 1));
|
|
533
|
+
const data = series.map((s) => ({
|
|
534
|
+
name: s.name,
|
|
535
|
+
labels,
|
|
536
|
+
values: s.values,
|
|
537
|
+
}));
|
|
538
|
+
slide.addChart(chartKind(pptx, chart.type), data, {
|
|
539
|
+
x: '8%',
|
|
540
|
+
y: '26%',
|
|
541
|
+
w: '84%',
|
|
542
|
+
h: '64%',
|
|
543
|
+
chartColors: [
|
|
544
|
+
tokens.accent,
|
|
545
|
+
tokens.textColor,
|
|
546
|
+
'F59E0B',
|
|
547
|
+
'10B981',
|
|
548
|
+
'EF4444',
|
|
549
|
+
'8B5CF6',
|
|
550
|
+
'06B6D4',
|
|
551
|
+
],
|
|
552
|
+
showLegend: chart.legend !== false,
|
|
553
|
+
legendPos: 'b',
|
|
554
|
+
legendColor: tokens.textColor,
|
|
555
|
+
legendFontFace: tokens.bodyFont,
|
|
556
|
+
legendFontSize: Math.max(plan.bodySize - 4, 9),
|
|
557
|
+
showValue: chart.dataLabels === true,
|
|
558
|
+
dataLabelColor: tokens.textColor,
|
|
559
|
+
dataLabelFontFace: tokens.bodyFont,
|
|
560
|
+
dataLabelFontSize: Math.max(plan.bodySize - 5, 8),
|
|
561
|
+
catAxisLabelColor: tokens.textColor,
|
|
562
|
+
catAxisLabelFontFace: tokens.bodyFont,
|
|
563
|
+
catAxisLabelFontSize: Math.max(plan.bodySize - 4, 9),
|
|
564
|
+
valAxisLabelColor: tokens.textColor,
|
|
565
|
+
valAxisLabelFontFace: tokens.bodyFont,
|
|
566
|
+
valAxisLabelFontSize: Math.max(plan.bodySize - 4, 9),
|
|
567
|
+
...(chart.yLabel ? { valAxisTitle: chart.yLabel } : {}),
|
|
568
|
+
valGridLine: { color: 'E2E8F0', style: 'dash' },
|
|
569
|
+
});
|
|
570
|
+
return true;
|
|
571
|
+
}
|
|
572
|
+
/** KPI tiles: larger than the stats layout, no borders, accent values. */
|
|
573
|
+
function renderKpi(slide, pptx, tokens, stats, plan) {
|
|
574
|
+
const count = Math.min(Math.max(stats.length, 1), 4);
|
|
575
|
+
const gap = 4;
|
|
576
|
+
const left = 8;
|
|
577
|
+
const width = (84 - gap * (count - 1)) / count;
|
|
578
|
+
const shape = shapeFor(tokens, pptx);
|
|
579
|
+
stats.slice(0, 4).forEach((stat, i) => {
|
|
580
|
+
const x = left + i * (width + gap);
|
|
581
|
+
slide.addShape(shape, {
|
|
582
|
+
x: `${x}%`,
|
|
583
|
+
y: '28%',
|
|
584
|
+
w: `${width}%`,
|
|
585
|
+
h: '58%',
|
|
586
|
+
fill: { color: tokens.surface },
|
|
587
|
+
line: { color: tokens.accent, transparency: 70, width: 1 },
|
|
588
|
+
...(shape === pptx.ShapeType.roundRect
|
|
589
|
+
? { rectRadius: 0.1 }
|
|
590
|
+
: {}),
|
|
591
|
+
});
|
|
592
|
+
slide.addText(stripMd(String(stat.value ?? '')), {
|
|
593
|
+
x: `${x}%`,
|
|
594
|
+
y: '36%',
|
|
595
|
+
w: `${width}%`,
|
|
596
|
+
h: '24%',
|
|
597
|
+
fontSize: plan.titleSize + 10,
|
|
598
|
+
fontFace: tokens.headingFont,
|
|
599
|
+
color: tokens.accent,
|
|
600
|
+
bold: true,
|
|
601
|
+
align: 'center',
|
|
602
|
+
});
|
|
603
|
+
slide.addText(stripMd(String(stat.label ?? '')), {
|
|
604
|
+
x: `${x + 2}%`,
|
|
605
|
+
y: '62%',
|
|
606
|
+
w: `${width - 4}%`,
|
|
607
|
+
h: '18%',
|
|
608
|
+
fontSize: plan.bodySize,
|
|
609
|
+
fontFace: tokens.bodyFont,
|
|
610
|
+
color: tokens.textColor,
|
|
611
|
+
align: 'center',
|
|
612
|
+
valign: 'top',
|
|
613
|
+
});
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Simple staged diagram: boxes in reading order with arrows between them.
|
|
618
|
+
*
|
|
619
|
+
* Deliberately not a general graph layout (that is the board engine's job);
|
|
620
|
+
* a slide diagram is a chain the audience reads left-to-right or top-to-bottom.
|
|
621
|
+
* Every element is a native PPTX shape, so it stays editable in PowerPoint.
|
|
622
|
+
*/
|
|
623
|
+
function renderDiagram(slide, pptx, tokens, diagram, plan) {
|
|
624
|
+
const nodes = coerceDiagramNodes(diagram.nodes);
|
|
625
|
+
if (nodes.length === 0)
|
|
626
|
+
return false;
|
|
627
|
+
const vertical = diagram.direction === 'TB';
|
|
628
|
+
const columns = vertical ? 1 : Math.min(nodes.length, 4);
|
|
629
|
+
const rows = Math.ceil(nodes.length / columns);
|
|
630
|
+
const area = { x: 8, y: vertical ? 24 : 30, w: 84, h: vertical ? 64 : 54 };
|
|
631
|
+
const gap = 4;
|
|
632
|
+
const boxW = (area.w - gap * (columns - 1)) / columns;
|
|
633
|
+
const boxH = (area.h - gap * (rows - 1)) / rows;
|
|
634
|
+
const shape = shapeFor(tokens, pptx);
|
|
635
|
+
const boxes = [];
|
|
636
|
+
nodes.forEach((node, index) => {
|
|
637
|
+
const row = Math.floor(index / columns);
|
|
638
|
+
const col = index % columns;
|
|
639
|
+
const x = area.x + col * (boxW + gap);
|
|
640
|
+
const y = area.y + row * (boxH + gap);
|
|
641
|
+
boxes.push({ x, y });
|
|
642
|
+
slide.addShape(shape, {
|
|
643
|
+
x: `${x}%`,
|
|
644
|
+
y: `${y}%`,
|
|
645
|
+
w: `${boxW}%`,
|
|
646
|
+
h: `${boxH}%`,
|
|
647
|
+
fill: { color: tokens.surface },
|
|
648
|
+
line: { color: tokens.accent, width: 1.25 },
|
|
649
|
+
...(shape === pptx.ShapeType.roundRect
|
|
650
|
+
? { rectRadius: 0.08 }
|
|
651
|
+
: {}),
|
|
652
|
+
});
|
|
653
|
+
slide.addText(node.label ?? '', {
|
|
654
|
+
x: `${x + 1.5}%`,
|
|
655
|
+
y: `${y}%`,
|
|
656
|
+
w: `${boxW - 3}%`,
|
|
657
|
+
h: `${boxH}%`,
|
|
658
|
+
fontSize: plan.bodySize,
|
|
659
|
+
fontFace: tokens.headingFont,
|
|
660
|
+
color: tokens.textColor,
|
|
661
|
+
bold: true,
|
|
662
|
+
align: 'center',
|
|
663
|
+
valign: 'middle',
|
|
664
|
+
});
|
|
665
|
+
});
|
|
666
|
+
nodes.forEach((_, index) => {
|
|
667
|
+
const box = boxes[index];
|
|
668
|
+
if (!box)
|
|
669
|
+
return;
|
|
670
|
+
const isLastInRow = (index + 1) % columns === 0;
|
|
671
|
+
if (vertical || isLastInRow) {
|
|
672
|
+
// Down arrow into the next row (when there is one).
|
|
673
|
+
if (index + 1 < nodes.length) {
|
|
674
|
+
slide.addShape(pptx.ShapeType.downArrow, {
|
|
675
|
+
x: `${box.x + boxW / 2 - 1}%`,
|
|
676
|
+
y: `${box.y + boxH + 0.4}%`,
|
|
677
|
+
w: '2%',
|
|
678
|
+
h: `${Math.max(gap - 0.8, 1.2)}%`,
|
|
679
|
+
fill: { color: tokens.accent },
|
|
680
|
+
line: { color: tokens.accent },
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
// Right arrow into the next box in this row.
|
|
686
|
+
slide.addShape(pptx.ShapeType.rightArrow, {
|
|
687
|
+
x: `${box.x + boxW + 0.4}%`,
|
|
688
|
+
y: `${box.y + boxH / 2 - 1}%`,
|
|
689
|
+
w: `${Math.max(gap - 0.8, 1.2)}%`,
|
|
690
|
+
h: '2%',
|
|
691
|
+
fill: { color: tokens.accent },
|
|
692
|
+
line: { color: tokens.accent },
|
|
693
|
+
});
|
|
694
|
+
});
|
|
695
|
+
return true;
|
|
696
|
+
}
|
|
307
697
|
function addTitleBlock(slide, pptx, tokens, title, slideNo, plan) {
|
|
308
698
|
const accent = tokens.accent;
|
|
309
699
|
const heading = tokens.headingFont;
|
|
@@ -927,6 +1317,10 @@ class PptxDeckTool {
|
|
|
927
1317
|
? slide.notes.trim()
|
|
928
1318
|
: undefined;
|
|
929
1319
|
const slideNo = idx + 1;
|
|
1320
|
+
// Decorative preset shapes sit UNDER the content (2026-11).
|
|
1321
|
+
const decorations = coerceShapes(slide.shapes);
|
|
1322
|
+
if (decorations.length)
|
|
1323
|
+
renderShapes(s, pptx, tokens, decorations);
|
|
930
1324
|
switch (p.layout) {
|
|
931
1325
|
case 'title':
|
|
932
1326
|
renderCover(s, pptx, tokens, title || docTitle, subtitle ?? this.firstBullets(slide), notes);
|
|
@@ -1135,6 +1529,65 @@ class PptxDeckTool {
|
|
|
1135
1529
|
addFooter(s, pptx, tokens, slideNo);
|
|
1136
1530
|
break;
|
|
1137
1531
|
}
|
|
1532
|
+
case 'image': {
|
|
1533
|
+
addTitleBlock(s, pptx, tokens, title || `Slide ${slideNo}`, slideNo, p);
|
|
1534
|
+
const images = coerceImages(slide.images);
|
|
1535
|
+
const hero = images[0];
|
|
1536
|
+
const rendered = hero
|
|
1537
|
+
? renderImageEntry(s, tokens, hero, { x: 8, y: 27, w: 84, h: subtitle ? 48 : 60 }, SLIDE_SIZE_IN[aspect], p)
|
|
1538
|
+
: false;
|
|
1539
|
+
if (!rendered) {
|
|
1540
|
+
fallbacks.push(`slide ${slideNo}: image layout had no usable image, rendered bullets instead`);
|
|
1541
|
+
addBullets(s, tokens, p.bullets, p);
|
|
1542
|
+
}
|
|
1543
|
+
else if (subtitle) {
|
|
1544
|
+
s.addText(subtitle, {
|
|
1545
|
+
x: '8%',
|
|
1546
|
+
y: '77%',
|
|
1547
|
+
w: '84%',
|
|
1548
|
+
h: '10%',
|
|
1549
|
+
fontSize: p.bodySize,
|
|
1550
|
+
fontFace: tokens.bodyFont,
|
|
1551
|
+
color: tokens.textColor,
|
|
1552
|
+
transparency: 25,
|
|
1553
|
+
align: 'center',
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
addFooter(s, pptx, tokens, slideNo);
|
|
1557
|
+
break;
|
|
1558
|
+
}
|
|
1559
|
+
case 'chart': {
|
|
1560
|
+
addTitleBlock(s, pptx, tokens, title || `Slide ${slideNo}`, slideNo, p);
|
|
1561
|
+
const chart = coerceChart(slide.chart);
|
|
1562
|
+
if (!chart || !renderChart(s, pptx, tokens, chart, p)) {
|
|
1563
|
+
fallbacks.push(`slide ${slideNo}: chart slide had no usable data, rendered bullets instead`);
|
|
1564
|
+
addBullets(s, tokens, p.bullets, p);
|
|
1565
|
+
}
|
|
1566
|
+
addFooter(s, pptx, tokens, slideNo);
|
|
1567
|
+
break;
|
|
1568
|
+
}
|
|
1569
|
+
case 'kpi': {
|
|
1570
|
+
addTitleBlock(s, pptx, tokens, title || `Slide ${slideNo}`, slideNo, p);
|
|
1571
|
+
const kpis = this.coerceStats(slide.stats);
|
|
1572
|
+
if (kpis.length > 0)
|
|
1573
|
+
renderKpi(s, pptx, tokens, kpis, p);
|
|
1574
|
+
else
|
|
1575
|
+
addBullets(s, tokens, p.bullets, p);
|
|
1576
|
+
addFooter(s, pptx, tokens, slideNo);
|
|
1577
|
+
break;
|
|
1578
|
+
}
|
|
1579
|
+
case 'diagram': {
|
|
1580
|
+
addTitleBlock(s, pptx, tokens, title || `Slide ${slideNo}`, slideNo, p);
|
|
1581
|
+
const diagram = slide.diagram && typeof slide.diagram === 'object'
|
|
1582
|
+
? slide.diagram
|
|
1583
|
+
: null;
|
|
1584
|
+
if (!diagram || !renderDiagram(s, pptx, tokens, diagram, p)) {
|
|
1585
|
+
fallbacks.push(`slide ${slideNo}: diagram had no nodes, rendered bullets instead`);
|
|
1586
|
+
addBullets(s, tokens, p.bullets, p);
|
|
1587
|
+
}
|
|
1588
|
+
addFooter(s, pptx, tokens, slideNo);
|
|
1589
|
+
break;
|
|
1590
|
+
}
|
|
1138
1591
|
case 'sources':
|
|
1139
1592
|
addTitleBlock(s, pptx, tokens, title || 'Sources', slideNo, p);
|
|
1140
1593
|
addBullets(s, tokens, p.bullets, p, {
|
|
@@ -1149,6 +1602,18 @@ class PptxDeckTool {
|
|
|
1149
1602
|
addFooter(s, pptx, tokens, slideNo);
|
|
1150
1603
|
break;
|
|
1151
1604
|
}
|
|
1605
|
+
// Positioned images on any layout (percent geometry required).
|
|
1606
|
+
if (p.layout !== 'image') {
|
|
1607
|
+
for (const img of coerceImages(slide.images)) {
|
|
1608
|
+
if (typeof img.x !== 'number' ||
|
|
1609
|
+
typeof img.y !== 'number' ||
|
|
1610
|
+
typeof img.w !== 'number' ||
|
|
1611
|
+
typeof img.h !== 'number') {
|
|
1612
|
+
continue;
|
|
1613
|
+
}
|
|
1614
|
+
renderImageEntry(s, tokens, img, { x: img.x, y: img.y, w: img.w, h: img.h }, SLIDE_SIZE_IN[aspect], p);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1152
1617
|
if (notes)
|
|
1153
1618
|
s.addNotes(notes);
|
|
1154
1619
|
});
|