slotdeck 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +486 -2
- package/dist/deck/numbers.d.ts +14 -0
- package/dist/deck/numbers.js +48 -0
- package/dist/deck/numbers.js.map +1 -0
- package/dist/deck/spec.d.ts +73 -0
- package/dist/deck/spec.js +21 -0
- package/dist/deck/spec.js.map +1 -0
- package/dist/deck/validate.d.ts +49 -0
- package/dist/deck/validate.js +189 -0
- package/dist/deck/validate.js.map +1 -0
- package/dist/generate.d.ts +53 -0
- package/dist/generate.js +44 -0
- package/dist/generate.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/gemini.d.ts +39 -0
- package/dist/llm/gemini.js +147 -0
- package/dist/llm/gemini.js.map +1 -0
- package/dist/llm/provider.d.ts +38 -0
- package/dist/llm/provider.js +2 -0
- package/dist/llm/provider.js.map +1 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.js +31 -0
- package/dist/node.js.map +1 -0
- package/dist/plan/assets.d.ts +28 -0
- package/dist/plan/assets.js +80 -0
- package/dist/plan/assets.js.map +1 -0
- package/dist/plan/catalog.d.ts +106 -0
- package/dist/plan/catalog.js +302 -0
- package/dist/plan/catalog.js.map +1 -0
- package/dist/plan/edit.d.ts +31 -0
- package/dist/plan/edit.js +364 -0
- package/dist/plan/edit.js.map +1 -0
- package/dist/plan/plan.d.ts +106 -0
- package/dist/plan/plan.js +243 -0
- package/dist/plan/plan.js.map +1 -0
- package/dist/plan/write.d.ts +39 -0
- package/dist/plan/write.js +179 -0
- package/dist/plan/write.js.map +1 -0
- package/dist/pptx/package.d.ts +48 -0
- package/dist/pptx/package.js +202 -0
- package/dist/pptx/package.js.map +1 -0
- package/dist/pptx/presentation.d.ts +20 -0
- package/dist/pptx/presentation.js +31 -0
- package/dist/pptx/presentation.js.map +1 -0
- package/dist/pptx/xml.d.ts +23 -0
- package/dist/pptx/xml.js +67 -0
- package/dist/pptx/xml.js.map +1 -0
- package/dist/render/chart.d.ts +18 -0
- package/dist/render/chart.js +158 -0
- package/dist/render/chart.js.map +1 -0
- package/dist/render/extract.d.ts +11 -0
- package/dist/render/extract.js +65 -0
- package/dist/render/extract.js.map +1 -0
- package/dist/render/picture.d.ts +20 -0
- package/dist/render/picture.js +114 -0
- package/dist/render/picture.js.map +1 -0
- package/dist/render/render.d.ts +32 -0
- package/dist/render/render.js +247 -0
- package/dist/render/render.js.map +1 -0
- package/dist/render/repeat.d.ts +15 -0
- package/dist/render/repeat.js +118 -0
- package/dist/render/repeat.js.map +1 -0
- package/dist/render/table.d.ts +12 -0
- package/dist/render/table.js +84 -0
- package/dist/render/table.js.map +1 -0
- package/dist/render/text.d.ts +31 -0
- package/dist/render/text.js +210 -0
- package/dist/render/text.js.map +1 -0
- package/dist/store.d.ts +18 -0
- package/dist/store.js +23 -0
- package/dist/store.js.map +1 -0
- package/dist/template/change.d.ts +138 -0
- package/dist/template/change.js +406 -0
- package/dist/template/change.js.map +1 -0
- package/dist/template/check.d.ts +15 -0
- package/dist/template/check.js +97 -0
- package/dist/template/check.js.map +1 -0
- package/dist/template/draft.d.ts +47 -0
- package/dist/template/draft.js +276 -0
- package/dist/template/draft.js.map +1 -0
- package/dist/template/inspect.d.ts +53 -0
- package/dist/template/inspect.js +157 -0
- package/dist/template/inspect.js.map +1 -0
- package/dist/template/instruct.d.ts +26 -0
- package/dist/template/instruct.js +278 -0
- package/dist/template/instruct.js.map +1 -0
- package/dist/template/manifest.d.ts +226 -0
- package/dist/template/manifest.js +116 -0
- package/dist/template/manifest.js.map +1 -0
- package/dist/template/measure.d.ts +80 -0
- package/dist/template/measure.js +212 -0
- package/dist/template/measure.js.map +1 -0
- package/dist/template/sample.d.ts +17 -0
- package/dist/template/sample.js +96 -0
- package/dist/template/sample.js.map +1 -0
- package/dist/template/view.d.ts +46 -0
- package/dist/template/view.js +38 -0
- package/dist/template/view.js.map +1 -0
- package/dist/tools.d.ts +68 -0
- package/dist/tools.js +266 -0
- package/dist/tools.js.map +1 -0
- package/dist/util/image.d.ts +11 -0
- package/dist/util/image.js +58 -0
- package/dist/util/image.js.map +1 -0
- package/dist/util/png.d.ts +2 -0
- package/dist/util/png.js +50 -0
- package/dist/util/png.js.map +1 -0
- package/package.json +63 -4
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { inspectTemplate } from './inspect.js';
|
|
2
|
+
/**
|
|
3
|
+
* Checks a manifest against the pptx it describes: every pattern's slide, every slot's shape
|
|
4
|
+
* and every row item must exist and be of the right kind. Run it when a template or manifest
|
|
5
|
+
* is loaded, so a template that was changed shows up here and not in the middle of a render.
|
|
6
|
+
*/
|
|
7
|
+
export function checkManifest(template, inspected) {
|
|
8
|
+
const { manifest } = template;
|
|
9
|
+
const info = inspected ?? inspectTemplate(template.pkg);
|
|
10
|
+
const issues = [];
|
|
11
|
+
const ids = new Set();
|
|
12
|
+
for (const pattern of manifest.patterns) {
|
|
13
|
+
const report = (severity, message, slot) => {
|
|
14
|
+
const issue = { severity, pattern: pattern.id, message };
|
|
15
|
+
if (slot)
|
|
16
|
+
issue.slot = slot;
|
|
17
|
+
issues.push(issue);
|
|
18
|
+
};
|
|
19
|
+
if (ids.has(pattern.id))
|
|
20
|
+
report('error', 'another pattern has the same id');
|
|
21
|
+
ids.add(pattern.id);
|
|
22
|
+
const slide = info.slides[pattern.sourceSlide - 1];
|
|
23
|
+
if (!slide) {
|
|
24
|
+
report('error', `points at slide ${pattern.sourceSlide}, but the template has ${info.slides.length} slides`);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const shapes = new Map(slide.shapes.map((shape) => [shape.id, shape]));
|
|
28
|
+
const names = new Set();
|
|
29
|
+
const usedShapes = new Map();
|
|
30
|
+
for (const slot of pattern.slots) {
|
|
31
|
+
if (names.has(slot.name))
|
|
32
|
+
report('error', 'another slot of the pattern has the same name', slot.name);
|
|
33
|
+
names.add(slot.name);
|
|
34
|
+
const shape = shapes.get(slot.shapeId);
|
|
35
|
+
if (!shape) {
|
|
36
|
+
report('error', `points at shape #${slot.shapeId}, which is not on slide ${pattern.sourceSlide}`, slot.name);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const other = usedShapes.get(slot.shapeId);
|
|
40
|
+
if (other)
|
|
41
|
+
report('warning', `points at the same shape as "${other}"`, slot.name);
|
|
42
|
+
usedShapes.set(slot.shapeId, slot.name);
|
|
43
|
+
const grouped = shape.groupId !== undefined;
|
|
44
|
+
// A slot that only ever removes its shape may point at any kind of shape.
|
|
45
|
+
const dropped = slot.empty === 'drop';
|
|
46
|
+
if (slot.kind === 'text' && shape.kind !== 'text' && !dropped) {
|
|
47
|
+
report(shape.kind === 'shape' ? 'warning' : 'error', `is a text slot, but shape #${slot.shapeId} is ${describe(shape)}`, slot.name);
|
|
48
|
+
}
|
|
49
|
+
if (slot.kind === 'image' && shape.kind !== 'picture' && !dropped)
|
|
50
|
+
report('error', `is an image slot, but shape #${slot.shapeId} is ${describe(shape)}`, slot.name);
|
|
51
|
+
if (slot.kind === 'table' && shape.kind !== 'table')
|
|
52
|
+
report('error', `is a table slot, but shape #${slot.shapeId} is ${describe(shape)}`, slot.name);
|
|
53
|
+
if (slot.kind === 'chart' && grouped)
|
|
54
|
+
report('error', 'is a chart slot, but its shape is inside a group', slot.name);
|
|
55
|
+
if ((slot.kind === 'text' || slot.kind === 'image') && slot.box && grouped)
|
|
56
|
+
report('error', 'has a box, but its shape is inside a group', slot.name);
|
|
57
|
+
if (slot.kind === 'text' && slot.maxChars === undefined && !slot.deckField && (slot.empty ?? 'error') !== 'drop') {
|
|
58
|
+
report('warning', 'has no character budget, so nothing stops text that does not fit', slot.name);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const repeat = pattern.repeat;
|
|
62
|
+
if (repeat) {
|
|
63
|
+
const drawn = repeat.shapes.length;
|
|
64
|
+
if (drawn === 0)
|
|
65
|
+
report('error', 'has a repeat with no items');
|
|
66
|
+
for (let n = 1; n <= drawn; n++) {
|
|
67
|
+
for (const name of repeat.slots) {
|
|
68
|
+
if (!names.has(name.replace('{n}', String(n))))
|
|
69
|
+
report('error', `repeat expects a slot named "${name.replace('{n}', String(n))}"`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const parents = new Set();
|
|
73
|
+
repeat.shapes.forEach((item, index) => {
|
|
74
|
+
for (const id of item) {
|
|
75
|
+
const shape = shapes.get(id);
|
|
76
|
+
if (!shape)
|
|
77
|
+
report('error', `repeat item ${index + 1} points at shape #${id}, which is not on slide ${pattern.sourceSlide}`);
|
|
78
|
+
else
|
|
79
|
+
parents.add(shape.groupId ?? '');
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if (parents.size > 1)
|
|
83
|
+
report('error', 'repeat items must all sit directly on the slide, or all in the same group');
|
|
84
|
+
const min = repeat.min ?? drawn;
|
|
85
|
+
const max = repeat.max ?? drawn;
|
|
86
|
+
if (min < 1 || min > max)
|
|
87
|
+
report('error', `repeat range ${min} to ${max} is not valid`);
|
|
88
|
+
if (repeat.columns !== undefined && max > drawn)
|
|
89
|
+
report('warning', 'a grid cannot hold more items than it draws');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return issues;
|
|
93
|
+
}
|
|
94
|
+
function describe(shape) {
|
|
95
|
+
return shape.kind === 'picture' ? 'a picture' : shape.kind === 'table' ? 'a table' : shape.kind === 'text' ? 'a text box' : `a ${shape.kind} without text`;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/template/check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAW/C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,QAAkB,EAAE,SAAwB;IACxE,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AAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,GAAG;gBAAE,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,GAAG,eAAe,CAAC,CAAC;YACxF,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,GAAG,GAAG,KAAK;gBAAE,MAAM,CAAC,SAAS,EAAE,6CAA6C,CAAC,CAAC;QACpH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAgB;IAChC,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,eAAe,CAAC;AAC7J,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { LlmProvider } from '../llm/provider.ts';
|
|
2
|
+
import { PptxPackage } from '../pptx/package.ts';
|
|
3
|
+
import type { ManifestIssue } from './check.ts';
|
|
4
|
+
import type { SlideInfo } from './inspect.ts';
|
|
5
|
+
import type { RepeatDef, SlotDef, TemplateManifest } from './manifest.ts';
|
|
6
|
+
export interface SlidePicture {
|
|
7
|
+
mimeType: string;
|
|
8
|
+
data: Uint8Array;
|
|
9
|
+
}
|
|
10
|
+
export interface DraftOptions {
|
|
11
|
+
llm: LlmProvider;
|
|
12
|
+
/** Name for the manifest. */
|
|
13
|
+
name?: string;
|
|
14
|
+
/**
|
|
15
|
+
* A picture of a slide (1-based number), when the app can render one. Seeing the slide improves the labels.
|
|
16
|
+
* May return a promise, for a picture that is rendered or read from storage when asked for.
|
|
17
|
+
*/
|
|
18
|
+
slideImage?: (slide: number) => SlidePicture | undefined | Promise<SlidePicture | undefined>;
|
|
19
|
+
/** Analyse only these slides. Defaults to all. */
|
|
20
|
+
slides?: number[];
|
|
21
|
+
/** How many slides to send to the model at once. Defaults to 4. */
|
|
22
|
+
concurrency?: number;
|
|
23
|
+
onProgress?: (event: {
|
|
24
|
+
done: number;
|
|
25
|
+
total: number;
|
|
26
|
+
slide: number;
|
|
27
|
+
}) => void;
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
export interface DraftResult {
|
|
31
|
+
manifest: TemplateManifest;
|
|
32
|
+
/** Slides that did not become patterns, and why. */
|
|
33
|
+
skipped: Array<{
|
|
34
|
+
slide: number;
|
|
35
|
+
reason: string;
|
|
36
|
+
}>;
|
|
37
|
+
/** What {@link checkManifest} finds in the draft. */
|
|
38
|
+
issues: ManifestIssue[];
|
|
39
|
+
}
|
|
40
|
+
/** Works out a row or grid of like items from numbered slot names such as card1Heading, card2Heading. */
|
|
41
|
+
export declare function detectRepeat(slots: SlotDef[], slide: SlideInfo): RepeatDef | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Drafts a manifest for a template: one model call for the deck as a whole, then one per slide.
|
|
44
|
+
* Review the draft before use: check {@link DraftResult.issues}, render a sample deck, and
|
|
45
|
+
* correct budgets or roles where the render shows a problem.
|
|
46
|
+
*/
|
|
47
|
+
export declare function draftManifest(pptx: Uint8Array | PptxPackage, options: DraftOptions): Promise<DraftResult>;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { PptxPackage } from '../pptx/package.js';
|
|
2
|
+
import { detectDirection } from '../render/text.js';
|
|
3
|
+
import { checkManifest } from './check.js';
|
|
4
|
+
import { inspectTemplate } from './inspect.js';
|
|
5
|
+
import { ROLES, describeShape, frameFacts, normalize, shapeText, slotFromShape, slotName, textLimits } from './measure.js';
|
|
6
|
+
/** The roles the drafter offers. A chart in place of a picture is a choice for a person to make. */
|
|
7
|
+
const DRAFT_ROLES = ROLES.filter((role) => role !== 'chart');
|
|
8
|
+
const SYSTEM = [
|
|
9
|
+
'You label the shapes of a slide from a presentation template, so that software can reuse the slide as a layout.',
|
|
10
|
+
'The software will copy the slide and replace the content of the shapes you mark as content. Everything else stays as designed.',
|
|
11
|
+
"The template's text is filler. Judge each shape by its position, size, font size and the picture of the slide when you have one.",
|
|
12
|
+
].join(' ');
|
|
13
|
+
/** Works out a row or grid of like items from numbered slot names such as card1Heading, card2Heading. */
|
|
14
|
+
export function detectRepeat(slots, slide) {
|
|
15
|
+
const byId = new Map(slide.shapes.map((shape) => [shape.id, shape]));
|
|
16
|
+
const items = new Map();
|
|
17
|
+
for (const slot of slots) {
|
|
18
|
+
const match = /^([a-z][A-Za-z]*?)(\d+)([A-Z][A-Za-z0-9]*)?$/.exec(slot.name);
|
|
19
|
+
// Decorations may be numbered too (sticker1, sticker2), but they are not items of a row.
|
|
20
|
+
if (!match || (slot.kind === 'text' && slot.deckField) || slot.empty === 'drop' || slot.empty === 'keep')
|
|
21
|
+
continue;
|
|
22
|
+
const prefix = match[1];
|
|
23
|
+
const byNumber = items.get(prefix) ?? new Map();
|
|
24
|
+
byNumber.set(Number(match[2]), [...(byNumber.get(Number(match[2])) ?? []), slot]);
|
|
25
|
+
items.set(prefix, byNumber);
|
|
26
|
+
}
|
|
27
|
+
for (const [prefix, byNumber] of items) {
|
|
28
|
+
const count = byNumber.size;
|
|
29
|
+
if (count < 2 || !Array.from({ length: count }, (_, index) => byNumber.has(index + 1)).every(Boolean))
|
|
30
|
+
continue;
|
|
31
|
+
const suffixes = (n) => (byNumber.get(n) ?? []).map((slot) => slot.name.slice(prefix.length + String(n).length));
|
|
32
|
+
const first = suffixes(1);
|
|
33
|
+
if (!Array.from({ length: count }, (_, index) => suffixes(index + 1).slice().sort().join()).every((set) => set === first.slice().sort().join()))
|
|
34
|
+
continue;
|
|
35
|
+
// Each item moves as its outermost shapes: the group around a card, or the shapes themselves.
|
|
36
|
+
const chain = (id) => {
|
|
37
|
+
const parent = byId.get(id)?.groupId;
|
|
38
|
+
return parent ? [...chain(parent), id] : [id];
|
|
39
|
+
};
|
|
40
|
+
const chains = Array.from({ length: count }, (_, index) => (byNumber.get(index + 1) ?? []).map((slot) => chain(slot.shapeId)));
|
|
41
|
+
// When every item sits inside one shared group, the items are that group's children.
|
|
42
|
+
const shared = chains.flat().every((path) => path[0] === chains[0]?.[0]?.[0] && path.length > 1) ? 1 : 0;
|
|
43
|
+
const shapes = chains.map((paths) => [...new Set(paths.map((path) => path[Math.min(shared, path.length - 1)]))]);
|
|
44
|
+
if (new Set(shapes.flat()).size !== shapes.flat().length)
|
|
45
|
+
continue; // items share a shape: not separable
|
|
46
|
+
const boxOf = (ids) => {
|
|
47
|
+
const boxes = ids.map((id) => byId.get(id).box);
|
|
48
|
+
const x = Math.min(...boxes.map((box) => box.x));
|
|
49
|
+
const y = Math.min(...boxes.map((box) => box.y));
|
|
50
|
+
return { x, y, right: Math.max(...boxes.map((box) => box.x + box.w)), bottom: Math.max(...boxes.map((box) => box.y + box.h)) };
|
|
51
|
+
};
|
|
52
|
+
if (shared === 0) {
|
|
53
|
+
// A card's background is often a separate shape behind its group: it belongs to the item too.
|
|
54
|
+
const taken = new Set([...shapes.flat(), ...slots.map((slot) => slot.shapeId)]);
|
|
55
|
+
for (const candidate of slide.shapes) {
|
|
56
|
+
if (candidate.groupId || candidate.kind !== 'shape' || taken.has(candidate.id) || candidate.box.w > 0.6)
|
|
57
|
+
continue;
|
|
58
|
+
const holds = shapes.filter((ids) => {
|
|
59
|
+
const box = boxOf(ids);
|
|
60
|
+
const slack = 0.01;
|
|
61
|
+
return candidate.box.x <= box.x + slack && candidate.box.y <= box.y + slack && candidate.box.x + candidate.box.w >= box.right - slack && candidate.box.y + candidate.box.h >= box.bottom - slack;
|
|
62
|
+
});
|
|
63
|
+
if (holds.length === 1)
|
|
64
|
+
holds[0].unshift(candidate.id);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const tops = shapes.map((ids) => boxOf(ids).y);
|
|
68
|
+
const firstRow = tops.filter((top) => Math.abs(top - tops[0]) < 0.03).length;
|
|
69
|
+
// Things stacked one under another (two paragraphs, say) are numbered alike but are not a row of items.
|
|
70
|
+
if (firstRow < 2)
|
|
71
|
+
continue;
|
|
72
|
+
const repeat = { item: prefix.toLowerCase(), slots: first.map((suffix) => `${prefix}{n}${suffix}`), shapes, min: Math.min(2, count), max: count };
|
|
73
|
+
if (firstRow < count)
|
|
74
|
+
repeat.columns = firstRow;
|
|
75
|
+
return repeat;
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Drafts a manifest for a template: one model call for the deck as a whole, then one per slide.
|
|
81
|
+
* Review the draft before use: check {@link DraftResult.issues}, render a sample deck, and
|
|
82
|
+
* correct budgets or roles where the render shows a problem.
|
|
83
|
+
*/
|
|
84
|
+
export async function draftManifest(pptx, options) {
|
|
85
|
+
const pkg = pptx instanceof PptxPackage ? pptx : PptxPackage.load(pptx);
|
|
86
|
+
const info = inspectTemplate(pkg);
|
|
87
|
+
const total = info.slides.length;
|
|
88
|
+
const ask = async (prompt, schema, slide) => {
|
|
89
|
+
const image = slide !== undefined ? await options.slideImage?.(slide) : undefined;
|
|
90
|
+
const request = { system: SYSTEM, prompt, schema, ...(image ? { images: [image] } : {}), ...(options.signal ? { signal: options.signal } : {}) };
|
|
91
|
+
return options.llm.generateJson(request);
|
|
92
|
+
};
|
|
93
|
+
// --- facts shared by the whole deck -----------------------------------------------------
|
|
94
|
+
const frame = frameFacts(info);
|
|
95
|
+
const repeatedTexts = frame.repeatedTexts;
|
|
96
|
+
const letters = info.slides.flatMap((slide) => slide.shapes.map(shapeText)).map(detectDirection);
|
|
97
|
+
const direction = letters.filter((d) => d === 'rtl').length > letters.filter((d) => d === 'ltr').length ? 'rtl' : 'ltr';
|
|
98
|
+
// --- one call about the deck: its language, and names for texts that repeat ---------------
|
|
99
|
+
const samples = frame.texts.filter((text) => text.length > 3).slice(0, 12);
|
|
100
|
+
const deckAnswer = (await ask([
|
|
101
|
+
'Sample texts from a presentation template:',
|
|
102
|
+
samples.map((text) => `- ${JSON.stringify(text.slice(0, 80))}`).join('\n'),
|
|
103
|
+
repeatedTexts.length > 0
|
|
104
|
+
? `These texts appear on many slides, so each is one value for the whole deck (for example the name of a department, or a footer). Give each a short camelCase field name:\n${repeatedTexts.map((text) => `- ${JSON.stringify(text)}`).join('\n')}`
|
|
105
|
+
: '',
|
|
106
|
+
'Also give the BCP 47 tag of the language the template is written in.',
|
|
107
|
+
]
|
|
108
|
+
.filter(Boolean)
|
|
109
|
+
.join('\n\n'), {
|
|
110
|
+
type: 'object',
|
|
111
|
+
properties: {
|
|
112
|
+
language: { type: 'string', description: 'BCP 47 language tag, e.g. "he" or "en"' },
|
|
113
|
+
fields: {
|
|
114
|
+
type: 'array',
|
|
115
|
+
items: { type: 'object', properties: { text: { type: 'string' }, name: { type: 'string' } }, required: ['text', 'name'] },
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
required: ['language', 'fields'],
|
|
119
|
+
}));
|
|
120
|
+
const fieldOf = new Map();
|
|
121
|
+
repeatedTexts.forEach((text, index) => {
|
|
122
|
+
const named = (Array.isArray(deckAnswer?.fields) ? deckAnswer.fields : []).find((field) => normalize(String(field?.text ?? '')) === text);
|
|
123
|
+
let name = slotName(String(named?.name ?? ''), `field${index + 1}`);
|
|
124
|
+
while ([...fieldOf.values()].includes(name))
|
|
125
|
+
name = `${name}${index + 1}`;
|
|
126
|
+
fieldOf.set(text, name);
|
|
127
|
+
});
|
|
128
|
+
// --- one call per slide -----------------------------------------------------------------
|
|
129
|
+
const wanted = (options.slides ?? info.slides.map((slide) => slide.number)).filter((number) => number >= 1 && number <= total);
|
|
130
|
+
const patterns = new Map();
|
|
131
|
+
const skipped = [];
|
|
132
|
+
let done = 0;
|
|
133
|
+
const analyse = async (number) => {
|
|
134
|
+
const slide = info.slides[number - 1];
|
|
135
|
+
const fixedSlots = [];
|
|
136
|
+
const listed = [];
|
|
137
|
+
for (const shape of slide.shapes) {
|
|
138
|
+
if (shape.kind === 'line' || shape.kind === 'group' || shape.kind === 'other')
|
|
139
|
+
continue;
|
|
140
|
+
if (frame.isFrame(shape))
|
|
141
|
+
continue; // logo, rule, page number or other frame element
|
|
142
|
+
if (shape.kind === 'text') {
|
|
143
|
+
const field = fieldOf.get(shapeText(shape));
|
|
144
|
+
if (field) {
|
|
145
|
+
const limits = textLimits(shape, info, 'text');
|
|
146
|
+
fixedSlots.push({ name: field, kind: 'text', shapeId: shape.id, size: limits.size, maxChars: limits.maxChars, deckField: field });
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (shape.kind === 'shape')
|
|
151
|
+
continue; // a shape without text carries no content
|
|
152
|
+
listed.push(shape);
|
|
153
|
+
}
|
|
154
|
+
if (listed.length === 0) {
|
|
155
|
+
skipped.push({ slide: number, reason: 'it has no shapes that could carry content' });
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const lines = listed.map((shape) => describeShape(shape, info));
|
|
159
|
+
const prompt = [
|
|
160
|
+
`Slide ${number} of ${total}. Positions and sizes are percentages of the slide. The template reads ${direction === 'rtl' ? 'right to left, so the first of a row of items is the rightmost' : 'left to right'}.`,
|
|
161
|
+
`Shapes (the logo, header and other elements that repeat on most slides are already handled and not listed):\n${lines.join('\n')}`,
|
|
162
|
+
[
|
|
163
|
+
'Decide:',
|
|
164
|
+
'- usable: false when the slide is not a content layout: a sheet of brand assets (icons, colour swatches, graphic elements), instructions for designers, or a slide whose shapes overlap in a way that looks broken.',
|
|
165
|
+
'- id: a short kebab-case name for the layout, such as "title-photo" or "icon-cards".',
|
|
166
|
+
'- description: one sentence telling an author what the layout holds and when to use it.',
|
|
167
|
+
'- figures: true when the layout is built around numbers.',
|
|
168
|
+
'- a role for every shape:',
|
|
169
|
+
' title, subtitle: the headings of the slide',
|
|
170
|
+
' text: a paragraph, or a short label',
|
|
171
|
+
' list: a bulleted or multi-line list, one paragraph per item',
|
|
172
|
+
' number: a large figure',
|
|
173
|
+
' caption: a few words under a figure, icon or picture',
|
|
174
|
+
' photo: a photograph to replace',
|
|
175
|
+
' icon: a small pictogram to replace',
|
|
176
|
+
' graphic: a chart, diagram or screenshot to replace',
|
|
177
|
+
' table: a table',
|
|
178
|
+
' decoration: an ornament drawn for the sample content, such as a sticker on a photo, to remove when the content changes',
|
|
179
|
+
' fixed: part of the design that stays exactly as it is',
|
|
180
|
+
'- name: a camelCase name for what the shape holds. Number repeated items (cards, steps, columns) in reading order, each item with the same set of names: card1Heading, card1Text, card2Heading, card2Text.',
|
|
181
|
+
'- optional: true when the slide still works without that content, such as a subtitle or a footnote.',
|
|
182
|
+
].join('\n'),
|
|
183
|
+
].join('\n\n');
|
|
184
|
+
const schema = {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
usable: { type: 'boolean' },
|
|
188
|
+
reason: { type: 'string', description: 'Why the slide is or is not usable, in a few words' },
|
|
189
|
+
id: { type: 'string' },
|
|
190
|
+
description: { type: 'string' },
|
|
191
|
+
figures: { type: 'boolean' },
|
|
192
|
+
shapes: {
|
|
193
|
+
type: 'array',
|
|
194
|
+
items: {
|
|
195
|
+
type: 'object',
|
|
196
|
+
properties: {
|
|
197
|
+
shape: { type: 'string', enum: listed.map((shape) => shape.id) },
|
|
198
|
+
role: { type: 'string', enum: [...DRAFT_ROLES] },
|
|
199
|
+
name: { type: 'string' },
|
|
200
|
+
optional: { type: 'boolean' },
|
|
201
|
+
},
|
|
202
|
+
required: ['shape', 'role', 'name', 'optional'],
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
required: ['usable', 'reason', 'id', 'description', 'figures', 'shapes'],
|
|
207
|
+
};
|
|
208
|
+
const answer = (await ask(prompt, schema, number));
|
|
209
|
+
options.onProgress?.({ done: ++done, total: wanted.length, slide: number });
|
|
210
|
+
if (answer?.usable !== true) {
|
|
211
|
+
skipped.push({ slide: number, reason: normalize(String(answer?.reason ?? 'the model judged it is not a content layout')) });
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const byId = new Map(listed.map((shape) => [shape.id, shape]));
|
|
215
|
+
const slots = [];
|
|
216
|
+
const names = new Set(fixedSlots.map((slot) => slot.name));
|
|
217
|
+
const seen = new Set();
|
|
218
|
+
for (const entry of Array.isArray(answer.shapes) ? answer.shapes : []) {
|
|
219
|
+
const shape = byId.get(String(entry?.shape ?? ''));
|
|
220
|
+
const role = DRAFT_ROLES.find((candidate) => candidate === entry?.role);
|
|
221
|
+
if (!shape || !role || role === 'fixed' || seen.has(shape.id))
|
|
222
|
+
continue;
|
|
223
|
+
seen.add(shape.id);
|
|
224
|
+
let name = slotName(String(entry?.name ?? ''), `${role}${slots.length + 1}`);
|
|
225
|
+
while (names.has(name))
|
|
226
|
+
name = `${name}x`;
|
|
227
|
+
names.add(name);
|
|
228
|
+
const slot = slotFromShape(shape, info, role, name, entry?.optional === true, slide);
|
|
229
|
+
if (slot)
|
|
230
|
+
slots.push(slot);
|
|
231
|
+
}
|
|
232
|
+
if (slots.filter((slot) => (slot.empty ?? 'error') !== 'drop').length === 0) {
|
|
233
|
+
skipped.push({ slide: number, reason: 'no shape was labelled as content' });
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const pattern = {
|
|
237
|
+
id: String(answer.id ?? '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || `slide-${number}`,
|
|
238
|
+
sourceSlide: number,
|
|
239
|
+
description: normalize(String(answer.description ?? '')) || `Layout of slide ${number}.`,
|
|
240
|
+
slots: [...slots, ...fixedSlots],
|
|
241
|
+
};
|
|
242
|
+
if (answer.figures === true)
|
|
243
|
+
pattern.figures = true;
|
|
244
|
+
const repeat = detectRepeat(slots, slide);
|
|
245
|
+
if (repeat)
|
|
246
|
+
pattern.repeat = repeat;
|
|
247
|
+
patterns.set(number, pattern);
|
|
248
|
+
};
|
|
249
|
+
const queue = [...wanted];
|
|
250
|
+
await Promise.all(Array.from({ length: Math.max(1, Math.min(options.concurrency ?? 4, queue.length)) }, async () => {
|
|
251
|
+
for (let number = queue.shift(); number !== undefined; number = queue.shift())
|
|
252
|
+
await analyse(number);
|
|
253
|
+
}));
|
|
254
|
+
// Pattern ids must be unique: later slides with a name already taken get their slide number.
|
|
255
|
+
const ids = new Set();
|
|
256
|
+
const ordered = [...patterns.entries()].sort(([a], [b]) => a - b).map(([number, pattern]) => {
|
|
257
|
+
if (ids.has(pattern.id))
|
|
258
|
+
pattern.id = `${pattern.id}-${number}`;
|
|
259
|
+
ids.add(pattern.id);
|
|
260
|
+
return pattern;
|
|
261
|
+
});
|
|
262
|
+
const language = normalize(String(deckAnswer?.language ?? ''));
|
|
263
|
+
const manifest = {
|
|
264
|
+
version: 1,
|
|
265
|
+
name: options.name ?? 'template',
|
|
266
|
+
direction,
|
|
267
|
+
// Text boxes rarely share both edges, so mirrored alignment is opt-in per slot.
|
|
268
|
+
alignOnDirectionChange: 'keep',
|
|
269
|
+
patterns: ordered,
|
|
270
|
+
};
|
|
271
|
+
if (language)
|
|
272
|
+
manifest.language = language;
|
|
273
|
+
skipped.sort((a, b) => a.slide - b.slide);
|
|
274
|
+
return { manifest, skipped, issues: checkManifest({ pkg, manifest }) };
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=draft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft.js","sourceRoot":"","sources":["../../src/template/draft.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,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AO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;QAChE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACpB,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAqB;QACjC,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,UAAU;QAChC,SAAS;QACT,gFAAgF;QAChF,sBAAsB,EAAE,MAAM;QAC9B,QAAQ,EAAE,OAAO;KAClB,CAAC;IACF,IAAI,QAAQ;QAAE,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAC1C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { PptxPackage } from '../pptx/package.ts';
|
|
2
|
+
export type ShapeKind = 'text' | 'picture' | 'shape' | 'line' | 'group' | 'table' | 'other';
|
|
3
|
+
/** Position and size as fractions of the slide (0..1), after group transforms. */
|
|
4
|
+
export interface Box {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
w: number;
|
|
8
|
+
h: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ShapeInfo {
|
|
11
|
+
/** `p:cNvPr/@id`, unique within the slide. This is what a manifest slot points at. */
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
kind: ShapeKind;
|
|
15
|
+
box: Box;
|
|
16
|
+
/** Id of the enclosing group, when nested. */
|
|
17
|
+
groupId?: string;
|
|
18
|
+
/** Placeholder type when the shape is a layout placeholder (e.g. `sldNum`). */
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
/** Paragraph texts, for shapes that carry text. */
|
|
21
|
+
paragraphs?: string[];
|
|
22
|
+
/** Distinct font sizes in points, largest first. */
|
|
23
|
+
fontSizes?: number[];
|
|
24
|
+
image?: {
|
|
25
|
+
part: string;
|
|
26
|
+
width?: number;
|
|
27
|
+
height?: number;
|
|
28
|
+
cropped: boolean;
|
|
29
|
+
geometry: string;
|
|
30
|
+
};
|
|
31
|
+
/** Size of a table, with the header row counted. */
|
|
32
|
+
table?: {
|
|
33
|
+
columns: number;
|
|
34
|
+
rows: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface SlideInfo {
|
|
38
|
+
/** 1-based position in the presentation. */
|
|
39
|
+
number: number;
|
|
40
|
+
part: string;
|
|
41
|
+
layout: string;
|
|
42
|
+
shapes: ShapeInfo[];
|
|
43
|
+
}
|
|
44
|
+
export interface TemplateInfo {
|
|
45
|
+
/** Slide size in EMU. */
|
|
46
|
+
slideWidth: number;
|
|
47
|
+
slideHeight: number;
|
|
48
|
+
/** Size in points of text that sets no size of its own. */
|
|
49
|
+
defaultFontSize: number;
|
|
50
|
+
slides: SlideInfo[];
|
|
51
|
+
}
|
|
52
|
+
/** Lists every shape on every slide: the raw material for writing a template manifest. */
|
|
53
|
+
export declare function inspectTemplate(pkg: PptxPackage): TemplateInfo;
|