@web-ppt/edit-core 0.6.0 → 0.8.0-beta.2

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +8 -0
  3. package/dist/agent/base64.d.ts +2 -0
  4. package/dist/agent/errors.d.ts +9 -0
  5. package/dist/agent/generated-schema.d.ts +6038 -0
  6. package/dist/agent/generated-validator.d.ts +6 -0
  7. package/dist/agent/index.d.ts +6 -0
  8. package/dist/agent/query.d.ts +3 -0
  9. package/dist/agent/session.d.ts +33 -0
  10. package/dist/agent/targets.d.ts +5 -0
  11. package/dist/agent/tools.d.ts +2 -0
  12. package/dist/agent/types.d.ts +126 -0
  13. package/dist/agent/validation.d.ts +2 -0
  14. package/dist/agent.js +46364 -0
  15. package/dist/commands/types.d.ts +23 -23
  16. package/dist/fill/api.d.ts +29 -0
  17. package/dist/fill/chart-seed-chart.d.ts +7 -0
  18. package/dist/fill/chart-seed-workbook.d.ts +12 -0
  19. package/dist/fill/chart-seed-xml.d.ts +12 -0
  20. package/dist/fill/chart-seed.d.ts +17 -0
  21. package/dist/fill/content.d.ts +16 -0
  22. package/dist/fill/errors.d.ts +10 -0
  23. package/dist/fill/generated-schema.d.ts +291 -0
  24. package/dist/fill/generated-validator.d.ts +6 -0
  25. package/dist/fill/index.d.ts +10 -0
  26. package/dist/fill/layouts.d.ts +24 -0
  27. package/dist/fill/package.d.ts +2 -0
  28. package/dist/fill/repair.d.ts +32 -0
  29. package/dist/fill/text-validation.d.ts +3 -0
  30. package/dist/fill/types.d.ts +60 -0
  31. package/dist/fill/validation.d.ts +10 -0
  32. package/dist/fill.js +12 -0
  33. package/dist/generate.js +53 -53
  34. package/dist/index-2ti1e4_F.js +411 -0
  35. package/dist/index-BbsPmmoy.js +4046 -0
  36. package/dist/save/notes-master.d.ts +12 -0
  37. package/dist/save.js +650 -484
  38. package/dist/{slide-parts-D0o_DDhi.js → slide-parts-zyOP9lia.js} +5 -5
  39. package/dist/types.d.ts +4 -4
  40. package/package.json +13 -3
  41. package/schemas/agent-tools.schema.json +7999 -0
  42. package/schemas/template-fill.schema.json +371 -0
@@ -1,5 +1,5 @@
1
1
  import type { CellBorders, Effects, Fill, Stroke, TableCell } from '@web-ppt/core';
2
- import type { DesignTarget, EditIdentity, ElementId, ElementImageReplacement, ElementInsertionResource, ElementRecord, ImageCrop, LinkOverride, LinkTarget, ParagraphPropertyInput, ProjectionInvalidation, RunPropertyOverrides, SlideId, TextFragment, TextOverride, SlideRecord, TableCellAddress, TextBodyPropertyOverrides } from '../types';
2
+ import type { DesignTarget, EditIdentity, ElementId, ElementImageReplacement, ElementInsertionResource, ElementRecord, ImageCrop, LinkOverride, LinkTarget, ParagraphPropertyInput, ProjectionInvalidation, RunPropertyOverrides, SlideId, TextFragment, TextOverride, SlideRecord, TableCellAddress, TextBodyPropertyOverrides, TableRowId, TableColumnId, TableCellRef, TableRowInsertion, TableColumnInsertion, TableMergeRegion, TableCellOverrides, TableCellRowRef, TableCellColumnRef, SectionId } from '../types';
3
3
  import type { ElementClipboardPayload } from './clipboard-types';
4
4
  import type { ElementHierarchyPatch, GroupCommand, UngroupCommand } from './group-types';
5
5
  import type { ConvertToCustomGeometryCommand, ElementGeometryPatch, ElementPresetGeometryPatch, SetAdjCommand, SetGeometryCommand, SetPresetCommand } from './geometry-types';
@@ -282,53 +282,53 @@ export interface InsertRowCommand {
282
282
  readonly id: ElementId;
283
283
  /** 省略仍兼容尾部追加;null 也表示尾部。 */
284
284
  readonly at?: {
285
- readonly before: import('../types').TableRowId | null;
285
+ readonly before: TableRowId | null;
286
286
  };
287
287
  }
288
288
  export interface InsertColumnCommand {
289
289
  readonly type: 'InsertColumn';
290
290
  readonly id: ElementId;
291
291
  readonly at?: {
292
- readonly before: import('../types').TableColumnId | null;
292
+ readonly before: TableColumnId | null;
293
293
  };
294
294
  }
295
295
  export interface RemoveRowCommand {
296
296
  readonly type: 'RemoveRow';
297
297
  readonly id: ElementId;
298
- readonly row: import('../types').TableRowId;
298
+ readonly row: TableRowId;
299
299
  }
300
300
  export interface RemoveColumnCommand {
301
301
  readonly type: 'RemoveColumn';
302
302
  readonly id: ElementId;
303
- readonly column: import('../types').TableColumnId;
303
+ readonly column: TableColumnId;
304
304
  }
305
305
  export interface SetRowHeightCommand {
306
306
  readonly type: 'SetRowHeight';
307
307
  readonly id: ElementId;
308
- readonly row: import('../types').TableRowId;
308
+ readonly row: TableRowId;
309
309
  readonly height: number;
310
310
  }
311
311
  export interface SetColumnWidthCommand {
312
312
  readonly type: 'SetColumnWidth';
313
313
  readonly id: ElementId;
314
- readonly column: import('../types').TableColumnId;
314
+ readonly column: TableColumnId;
315
315
  readonly width: number;
316
316
  }
317
317
  export interface MergeCellsCommand {
318
318
  readonly type: 'MergeCells';
319
319
  readonly id: ElementId;
320
- readonly from: import('../types').TableCellRef;
321
- readonly to: import('../types').TableCellRef;
320
+ readonly from: TableCellRef;
321
+ readonly to: TableCellRef;
322
322
  }
323
323
  export interface SplitCellCommand {
324
324
  readonly type: 'SplitCell';
325
325
  readonly id: ElementId;
326
- readonly cell: import('../types').TableCellRef;
326
+ readonly cell: TableCellRef;
327
327
  }
328
328
  export interface SetCellPropsCommand {
329
329
  readonly type: 'SetCellProps';
330
330
  readonly id: ElementId;
331
- readonly cell: import('../types').TableCellRef;
331
+ readonly cell: TableCellRef;
332
332
  readonly props: {
333
333
  readonly fill?: Exclude<Fill, {
334
334
  type: 'image';
@@ -343,15 +343,15 @@ export type Command = SetXfrmCommand | SetFlipCommand | RemoveElementCommand | S
343
343
  type PageOnlyCommand = AddSlideCommand | MoveSlideCommand | RemoveSlideCommand | DuplicateSlideCommand | AddSectionCommand | RenameSectionCommand | MoveSectionCommand | RemoveSectionCommand | SetSlideSizeCommand | SetBackgroundCropCommand | SetBackgroundImageCommand | SetHiddenCommand | SetAnimationsCommand | SetLayoutCommand | SetNotesCommand | SetThemeCommand | AddShapeCommand | AddImageCommand | AddTableCommand | PasteElementsCommand | ReplaceTextCommand;
344
344
  /** 版式命令沿用元素命令语言;只有画布属性命令显式携带 DesignTarget。 */
345
345
  export type DesignCommand = Exclude<Command, PageOnlyCommand | SetBackgroundCommand | SetTransitionCommand> | Extract<SetBackgroundCommand, {
346
- readonly target: import('../types').DesignTarget;
346
+ readonly target: DesignTarget;
347
347
  }> | Extract<SetTransitionCommand, {
348
- readonly target: import('../types').DesignTarget;
348
+ readonly target: DesignTarget;
349
349
  }> | Extract<AddShapeCommand, {
350
- readonly target: import('../types').DesignTarget;
350
+ readonly target: DesignTarget;
351
351
  }> | Extract<AddImageCommand, {
352
- readonly target: import('../types').DesignTarget;
352
+ readonly target: DesignTarget;
353
353
  }> | Extract<AddTableCommand, {
354
- readonly target: import('../types').DesignTarget;
354
+ readonly target: DesignTarget;
355
355
  }>;
356
356
  type SetXfrmPatch = {
357
357
  [F in XfrmField]: {
@@ -452,12 +452,12 @@ export type ElementTextPatch = {
452
452
  readonly origin: string;
453
453
  } | {
454
454
  readonly op: 'set';
455
- readonly path: readonly ['elements', ElementId, 'ovr', 'tableCells', import('../types').TableCellRowRef, import('../types').TableCellColumnRef, 'text'];
455
+ readonly path: readonly ['elements', ElementId, 'ovr', 'tableCells', TableCellRowRef, TableCellColumnRef, 'text'];
456
456
  readonly value: TextOverride;
457
457
  readonly origin: string;
458
458
  } | {
459
459
  readonly op: 'del';
460
- readonly path: readonly ['elements', ElementId, 'ovr', 'tableCells', import('../types').TableCellRowRef, import('../types').TableCellColumnRef, 'text'];
460
+ readonly path: readonly ['elements', ElementId, 'ovr', 'tableCells', TableCellRowRef, TableCellColumnRef, 'text'];
461
461
  readonly origin: string;
462
462
  };
463
463
  export type ElementOrderPatch = {
@@ -513,7 +513,7 @@ export interface SlideTreeSnapshot {
513
513
  /** 复制发生时已证明的原操作;恢复与重做只运输这份不可变证据。 */
514
514
  readonly extensionCopies?: string;
515
515
  /** 页面结构 Patch 同步维护稳定节成员;省略表示该页不属于任何节。 */
516
- readonly sectionId?: import('../types').SectionId;
516
+ readonly sectionId?: SectionId;
517
517
  }
518
518
  export type SlideTreePatch = {
519
519
  readonly op: 'remove' | 'insert';
@@ -532,13 +532,13 @@ export type SlideOrderPatch = {
532
532
  export type TableRowPatch = {
533
533
  readonly op: 'insert' | 'remove';
534
534
  readonly path: readonly ['elements', ElementId, 'ovr', 'tableRows', string];
535
- readonly value: import('../types').TableRowInsertion;
535
+ readonly value: TableRowInsertion;
536
536
  readonly origin: string;
537
537
  };
538
538
  export type TableColumnPatch = {
539
539
  readonly op: 'insert' | 'remove';
540
540
  readonly path: readonly ['elements', ElementId, 'ovr', 'tableColumns', string];
541
- readonly value: import('../types').TableColumnInsertion;
541
+ readonly value: TableColumnInsertion;
542
542
  readonly origin: string;
543
543
  };
544
544
  export type TableGridEntryPatch = {
@@ -556,7 +556,7 @@ export type TableGridEntryPatch = {
556
556
  export type TableMergePatch = {
557
557
  readonly op: 'set';
558
558
  readonly path: readonly ['elements', ElementId, 'ovr', 'tableMerges'];
559
- readonly value: readonly import('../types').TableMergeRegion[];
559
+ readonly value: readonly TableMergeRegion[];
560
560
  readonly origin: string;
561
561
  } | {
562
562
  readonly op: 'del';
@@ -573,7 +573,7 @@ export type TableCellPropsPatch = {
573
573
  string,
574
574
  'fill' | 'borders' | 'margins' | 'vAlign' | 'vert'
575
575
  ];
576
- readonly value?: import('../types').TableCellOverrides[keyof Omit<import('../types').TableCellOverrides, 'text'>];
576
+ readonly value?: TableCellOverrides[keyof Omit<TableCellOverrides, 'text'>];
577
577
  readonly origin: string;
578
578
  };
579
579
  export type ExtensionPatch = {
@@ -0,0 +1,29 @@
1
+ import type { TextMeasure } from '@web-ppt/core';
2
+ import type { PresentationDescription } from '../describe/types';
3
+ import type { LayoutLintOptions, LayoutLintReport } from '../lint/types';
4
+ export interface TemplateFillOptions {
5
+ readonly idPrefix?: string;
6
+ readonly signal?: AbortSignal;
7
+ readonly lint: LayoutLintOptions & {
8
+ readonly measureText: TextMeasure;
9
+ };
10
+ /** 默认在生成副本中修复可确定处理的设计和布局问题,不修改输入模板。 */
11
+ readonly repair?: boolean;
12
+ /** false 允许返回带完整诊断的产物;默认遇到任何布局问题都拒绝。 */
13
+ readonly requireClean?: boolean;
14
+ }
15
+ export interface TemplateFillBinding {
16
+ readonly slideNumber: number;
17
+ readonly slideId: string;
18
+ readonly layoutId: string;
19
+ readonly titleId: string;
20
+ readonly bodyIds: readonly string[];
21
+ readonly objectId: string | null;
22
+ }
23
+ export interface TemplateFillResult {
24
+ readonly bytes: Uint8Array;
25
+ readonly description: PresentationDescription;
26
+ readonly lint: LayoutLintReport;
27
+ readonly bindings: readonly TemplateFillBinding[];
28
+ readonly repairs: readonly import('./repair').TemplateRepair[];
29
+ }
@@ -0,0 +1,7 @@
1
+ import type { TemplateFillChart } from './types';
2
+ import type { SeedSeriesReferences } from './chart-seed-workbook';
3
+ export interface SeedChartStyle {
4
+ readonly textColor?: string;
5
+ readonly fontFamily?: string;
6
+ }
7
+ export declare function seedChartXml(chart: TemplateFillChart, references: readonly SeedSeriesReferences[], categoriesFormula: string, style: SeedChartStyle): Uint8Array;
@@ -0,0 +1,12 @@
1
+ import type { TemplateFillChart } from './types';
2
+ export interface SeedSeriesReferences {
3
+ readonly name: string;
4
+ readonly values: string;
5
+ readonly x?: string;
6
+ readonly sizes?: string;
7
+ }
8
+ export declare function seedChartWorkbook(chart: TemplateFillChart): {
9
+ readonly bytes: Uint8Array;
10
+ readonly categories: string;
11
+ readonly series: readonly SeedSeriesReferences[];
12
+ };
@@ -0,0 +1,12 @@
1
+ import type { XmlDocument, XmlElement, XmlNode } from '@web-ppt/edit-core/xml';
2
+ export declare const SEED_NS: {
3
+ readonly chart: "http://schemas.openxmlformats.org/drawingml/2006/chart";
4
+ readonly drawing: "http://schemas.openxmlformats.org/drawingml/2006/main";
5
+ readonly presentation: "http://schemas.openxmlformats.org/presentationml/2006/main";
6
+ readonly office: "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
7
+ readonly relationships: "http://schemas.openxmlformats.org/package/2006/relationships";
8
+ readonly types: "http://schemas.openxmlformats.org/package/2006/content-types";
9
+ readonly spreadsheet: "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
10
+ };
11
+ export declare function seedElement(name: string, attributes?: Readonly<Record<string, string | number>>, children?: readonly (XmlNode | string)[]): XmlElement;
12
+ export declare function seedDocument(name: string, namespaces: Readonly<Record<string, string>>, children: readonly XmlElement[]): XmlDocument;
@@ -0,0 +1,17 @@
1
+ import type { TemplateFillChart } from './types';
2
+ import type { SeedChartStyle } from './chart-seed-chart';
3
+ export interface TemplateChartPlacement extends SeedChartStyle {
4
+ readonly slidePart: string;
5
+ readonly rect: {
6
+ readonly x: number;
7
+ readonly y: number;
8
+ readonly w: number;
9
+ readonly h: number;
10
+ };
11
+ readonly chart: TemplateFillChart;
12
+ readonly rot?: number;
13
+ readonly flipH?: boolean;
14
+ readonly flipV?: boolean;
15
+ }
16
+ /** 这是纯生成阶段;已有页面和包资源只经保留型 XML 与 OPC 写入,不修改调用方字节。 */
17
+ export declare function seedTemplateCharts(bytes: Uint8Array, placements: readonly TemplateChartPlacement[]): Uint8Array;
@@ -0,0 +1,16 @@
1
+ import type { Editor, EditDoc, ElementId } from '@web-ppt/edit-core';
2
+ import type { FillSlidePlan, FillSlot } from './layouts';
3
+ import type { PreparedFillImage } from './validation';
4
+ import type { TemplateFillSlide } from './types';
5
+ export interface FilledPage {
6
+ readonly slideId: string;
7
+ readonly slidePart: string;
8
+ readonly plan: FillSlidePlan;
9
+ readonly type: TemplateFillSlide['type'];
10
+ }
11
+ export declare function pageSlot(doc: EditDoc, slideId: string, slot: FillSlot): ElementId;
12
+ export declare function materializeOutline(editor: Editor, slides: readonly TemplateFillSlide[], plans: readonly FillSlidePlan[], images: ReadonlyMap<number, PreparedFillImage>, signal?: AbortSignal): readonly FilledPage[];
13
+ export declare function chartSlotStyle(doc: EditDoc, slot: FillSlot): {
14
+ textColor?: string;
15
+ fontFamily?: string;
16
+ };
@@ -0,0 +1,10 @@
1
+ import type { LayoutLintReport } from '../lint/types';
2
+ export declare class TemplateFillError extends Error {
3
+ readonly reason: string;
4
+ readonly slideNumber: number | null;
5
+ readonly field: string | null;
6
+ readonly elementId: string | null;
7
+ readonly lint?: LayoutLintReport | undefined;
8
+ constructor(reason: string, message: string, slideNumber?: number | null, field?: string | null, elementId?: string | null, lint?: LayoutLintReport | undefined);
9
+ }
10
+ export declare function requireActive(signal?: AbortSignal): void;
@@ -0,0 +1,291 @@
1
+ export declare const templateFillSchema: {
2
+ readonly $schema: "http://json-schema.org/draft-07/schema#";
3
+ readonly $ref: "#/definitions/TemplateFillOutline";
4
+ readonly definitions: {
5
+ readonly TemplateFillOutline: {
6
+ readonly type: "object";
7
+ readonly properties: {
8
+ readonly version: {
9
+ readonly type: "number";
10
+ readonly const: 1;
11
+ };
12
+ readonly slides: {
13
+ readonly type: "array";
14
+ readonly items: {
15
+ readonly $ref: "#/definitions/TemplateFillSlide";
16
+ };
17
+ readonly minItems: 1;
18
+ };
19
+ };
20
+ readonly required: readonly ["version", "slides"];
21
+ readonly additionalProperties: false;
22
+ };
23
+ readonly TemplateFillSlide: {
24
+ readonly anyOf: readonly [{
25
+ readonly $ref: "#/definitions/TemplateFillTitleSlide";
26
+ }, {
27
+ readonly $ref: "#/definitions/TemplateFillSectionSlide";
28
+ }, {
29
+ readonly $ref: "#/definitions/TemplateFillContentSlide";
30
+ }, {
31
+ readonly $ref: "#/definitions/TemplateFillTwoColumnSlide";
32
+ }, {
33
+ readonly $ref: "#/definitions/TemplateFillImageSlide";
34
+ }, {
35
+ readonly $ref: "#/definitions/TemplateFillChartSlide";
36
+ }];
37
+ };
38
+ readonly TemplateFillTitleSlide: {
39
+ readonly type: "object";
40
+ readonly properties: {
41
+ readonly title: {
42
+ readonly type: "string";
43
+ };
44
+ readonly notes: {
45
+ readonly type: "string";
46
+ };
47
+ readonly layoutId: {
48
+ readonly type: "string";
49
+ };
50
+ readonly type: {
51
+ readonly type: "string";
52
+ readonly const: "title";
53
+ };
54
+ readonly subtitle: {
55
+ readonly type: "string";
56
+ };
57
+ };
58
+ readonly required: readonly ["title", "type"];
59
+ readonly additionalProperties: false;
60
+ };
61
+ readonly TemplateFillSectionSlide: {
62
+ readonly type: "object";
63
+ readonly properties: {
64
+ readonly title: {
65
+ readonly type: "string";
66
+ };
67
+ readonly notes: {
68
+ readonly type: "string";
69
+ };
70
+ readonly layoutId: {
71
+ readonly type: "string";
72
+ };
73
+ readonly type: {
74
+ readonly type: "string";
75
+ readonly const: "section";
76
+ };
77
+ readonly body: {
78
+ readonly type: "array";
79
+ readonly items: {
80
+ readonly $ref: "#/definitions/TemplateFillParagraph";
81
+ };
82
+ };
83
+ };
84
+ readonly required: readonly ["title", "type"];
85
+ readonly additionalProperties: false;
86
+ };
87
+ readonly TemplateFillParagraph: {
88
+ readonly type: "object";
89
+ readonly properties: {
90
+ readonly text: {
91
+ readonly type: "string";
92
+ };
93
+ readonly level: {
94
+ readonly type: "number";
95
+ readonly enum: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8];
96
+ };
97
+ readonly bullet: {
98
+ readonly type: "boolean";
99
+ };
100
+ };
101
+ readonly required: readonly ["text"];
102
+ readonly additionalProperties: false;
103
+ };
104
+ readonly TemplateFillContentSlide: {
105
+ readonly type: "object";
106
+ readonly properties: {
107
+ readonly title: {
108
+ readonly type: "string";
109
+ };
110
+ readonly notes: {
111
+ readonly type: "string";
112
+ };
113
+ readonly layoutId: {
114
+ readonly type: "string";
115
+ };
116
+ readonly type: {
117
+ readonly type: "string";
118
+ readonly const: "content";
119
+ };
120
+ readonly body: {
121
+ readonly type: "array";
122
+ readonly items: {
123
+ readonly $ref: "#/definitions/TemplateFillParagraph";
124
+ };
125
+ readonly minItems: 1;
126
+ };
127
+ };
128
+ readonly required: readonly ["body", "title", "type"];
129
+ readonly additionalProperties: false;
130
+ };
131
+ readonly TemplateFillTwoColumnSlide: {
132
+ readonly type: "object";
133
+ readonly properties: {
134
+ readonly title: {
135
+ readonly type: "string";
136
+ };
137
+ readonly notes: {
138
+ readonly type: "string";
139
+ };
140
+ readonly layoutId: {
141
+ readonly type: "string";
142
+ };
143
+ readonly type: {
144
+ readonly type: "string";
145
+ readonly const: "two-column";
146
+ };
147
+ readonly columns: {
148
+ readonly type: "array";
149
+ readonly items: {
150
+ readonly type: "array";
151
+ readonly items: {
152
+ readonly $ref: "#/definitions/TemplateFillParagraph";
153
+ };
154
+ };
155
+ readonly minItems: 2;
156
+ readonly maxItems: 2;
157
+ };
158
+ };
159
+ readonly required: readonly ["columns", "title", "type"];
160
+ readonly additionalProperties: false;
161
+ };
162
+ readonly TemplateFillImageSlide: {
163
+ readonly type: "object";
164
+ readonly properties: {
165
+ readonly title: {
166
+ readonly type: "string";
167
+ };
168
+ readonly notes: {
169
+ readonly type: "string";
170
+ };
171
+ readonly layoutId: {
172
+ readonly type: "string";
173
+ };
174
+ readonly type: {
175
+ readonly type: "string";
176
+ readonly const: "image";
177
+ };
178
+ readonly image: {
179
+ readonly $ref: "#/definitions/TemplateFillImage";
180
+ };
181
+ readonly body: {
182
+ readonly type: "array";
183
+ readonly items: {
184
+ readonly $ref: "#/definitions/TemplateFillParagraph";
185
+ };
186
+ };
187
+ };
188
+ readonly required: readonly ["image", "title", "type"];
189
+ readonly additionalProperties: false;
190
+ };
191
+ readonly TemplateFillImage: {
192
+ readonly type: "object";
193
+ readonly properties: {
194
+ readonly bytes: {
195
+ readonly type: "string";
196
+ };
197
+ readonly mime: {
198
+ readonly type: "string";
199
+ readonly enum: readonly ["image/png", "image/jpeg", "image/gif", "image/webp"];
200
+ };
201
+ readonly altText: {
202
+ readonly type: "string";
203
+ };
204
+ readonly fit: {
205
+ readonly type: "string";
206
+ readonly enum: readonly ["contain", "cover"];
207
+ };
208
+ };
209
+ readonly required: readonly ["bytes", "mime"];
210
+ readonly additionalProperties: false;
211
+ };
212
+ readonly TemplateFillChartSlide: {
213
+ readonly type: "object";
214
+ readonly properties: {
215
+ readonly title: {
216
+ readonly type: "string";
217
+ };
218
+ readonly notes: {
219
+ readonly type: "string";
220
+ };
221
+ readonly layoutId: {
222
+ readonly type: "string";
223
+ };
224
+ readonly type: {
225
+ readonly type: "string";
226
+ readonly const: "chart";
227
+ };
228
+ readonly chart: {
229
+ readonly $ref: "#/definitions/TemplateFillChart";
230
+ };
231
+ };
232
+ readonly required: readonly ["chart", "title", "type"];
233
+ readonly additionalProperties: false;
234
+ };
235
+ readonly TemplateFillChart: {
236
+ readonly type: "object";
237
+ readonly properties: {
238
+ readonly type: {
239
+ readonly type: "string";
240
+ readonly enum: readonly ["bar", "line", "pie", "doughnut", "area", "scatter", "radar", "bubble"];
241
+ };
242
+ readonly categories: {
243
+ readonly type: "array";
244
+ readonly items: {
245
+ readonly type: "string";
246
+ };
247
+ };
248
+ readonly series: {
249
+ readonly type: "array";
250
+ readonly items: {
251
+ readonly $ref: "#/definitions/TemplateFillChartSeries";
252
+ };
253
+ };
254
+ readonly title: {
255
+ readonly type: "string";
256
+ };
257
+ };
258
+ readonly required: readonly ["type", "categories", "series"];
259
+ readonly additionalProperties: false;
260
+ };
261
+ readonly TemplateFillChartSeries: {
262
+ readonly type: "object";
263
+ readonly properties: {
264
+ readonly name: {
265
+ readonly type: "string";
266
+ };
267
+ readonly values: {
268
+ readonly type: "array";
269
+ readonly items: {
270
+ readonly type: readonly ["number", "null"];
271
+ };
272
+ };
273
+ readonly x: {
274
+ readonly type: "array";
275
+ readonly items: {
276
+ readonly type: readonly ["number", "null"];
277
+ };
278
+ };
279
+ readonly sizes: {
280
+ readonly type: "array";
281
+ readonly items: {
282
+ readonly type: readonly ["number", "null"];
283
+ };
284
+ };
285
+ };
286
+ readonly required: readonly ["name", "values"];
287
+ readonly additionalProperties: false;
288
+ };
289
+ };
290
+ readonly $id: "https://web-ppt.dev/schemas/template-fill.schema.json";
291
+ };
@@ -0,0 +1,6 @@
1
+ export declare const validate: typeof validate10;
2
+ export default validate10;
3
+ declare function validate10(data: any, { instancePath, parentData, parentDataProperty, rootData }?: {
4
+ instancePath?: string | undefined;
5
+ rootData?: any;
6
+ }): boolean;
@@ -0,0 +1,10 @@
1
+ import type { BuiltinTemplateId } from '../templates/types';
2
+ import type { TemplateFillOptions, TemplateFillResult } from './api';
3
+ import type { TemplateFillOutline } from './types';
4
+ export { TemplateFillError } from './errors';
5
+ export { templateFillSchema } from './generated-schema';
6
+ export type * from './types';
7
+ export type { TemplateFillBinding, TemplateFillOptions, TemplateFillResult } from './api';
8
+ export type { TemplateRepair as TemplateFillRepair } from './repair';
9
+ /** 返回的身份来自最终文件;生成期间的临时 ID 不向调用者冒充跨保存身份。 */
10
+ export declare function fillTemplate(source: Uint8Array | BuiltinTemplateId, input: TemplateFillOutline, options: TemplateFillOptions): Promise<TemplateFillResult>;
@@ -0,0 +1,24 @@
1
+ import type { EditDoc } from '@web-ppt/edit-core';
2
+ import type { TemplateFillSlide } from './types';
3
+ export interface FillSlot {
4
+ readonly id: string;
5
+ readonly type: string;
6
+ readonly index: string | null;
7
+ readonly rot: number;
8
+ readonly flipH: boolean;
9
+ readonly flipV: boolean;
10
+ readonly rect: {
11
+ readonly x: number;
12
+ readonly y: number;
13
+ readonly w: number;
14
+ readonly h: number;
15
+ };
16
+ }
17
+ export interface FillSlidePlan {
18
+ readonly layoutId: string;
19
+ readonly title: FillSlot;
20
+ readonly subtitle?: FillSlot;
21
+ readonly bodies: readonly FillSlot[];
22
+ readonly object?: FillSlot;
23
+ }
24
+ export declare function planTemplateSlides(doc: EditDoc, slides: readonly TemplateFillSlide[]): readonly FillSlidePlan[];
@@ -0,0 +1,2 @@
1
+ /** 核心解析器先验证输入规模与格式;这里只转换普通模板的精确类型,不推断宏类型。 */
2
+ export declare function prepareTemplatePackage(bytes: Uint8Array): Uint8Array;
@@ -0,0 +1,32 @@
1
+ import type { EditDoc, Editor } from '@web-ppt/edit-core';
2
+ import type { LayoutCheck, LayoutLintOptions, LayoutLintReport } from '@web-ppt/edit-core/lint';
3
+ export interface TemplateRepair {
4
+ readonly elementId: string | null;
5
+ readonly slideNumber: number | null;
6
+ readonly source: {
7
+ readonly part: string;
8
+ readonly spid: number;
9
+ } | null;
10
+ readonly reason: LayoutCheck;
11
+ readonly action: string;
12
+ readonly before: Readonly<Record<string, unknown>>;
13
+ readonly after: Readonly<Record<string, unknown>>;
14
+ }
15
+ export interface TemplateRepairResult {
16
+ readonly changed: boolean;
17
+ readonly initialReport: LayoutLintReport | null;
18
+ readonly report: LayoutLintReport | null;
19
+ readonly repairs: readonly TemplateRepair[];
20
+ readonly unavailable: readonly {
21
+ readonly elementId: string;
22
+ readonly reason: LayoutCheck;
23
+ readonly detail: string;
24
+ }[];
25
+ }
26
+ interface RepairOptions {
27
+ readonly signal?: AbortSignal;
28
+ readonly phase?: 'design' | 'all';
29
+ }
30
+ /** 修复实际编辑模型;最终报告始终由同一套完整检查重新计算。 */
31
+ export declare function repairTemplate(doc: EditDoc, editor: Editor, lint: LayoutLintOptions, options?: RepairOptions): Promise<TemplateRepairResult>;
32
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { TemplateFillOutline } from './types';
2
+ /** 在写入 OOXML 前规范化行尾;不能依赖宽容的自有解析器替独立读取器把关。 */
3
+ export declare function normalizedOutline(outline: TemplateFillOutline): TemplateFillOutline;