js.documents 7.13.0 → 7.15.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.
Files changed (41) hide show
  1. package/dist/codecs/registry.cjs +1 -1
  2. package/dist/codecs/registry.js +1 -1
  3. package/dist/convert/composition.cjs +1 -1
  4. package/dist/convert/composition.js +1 -1
  5. package/dist/edit/doc/editor.cjs +159 -0
  6. package/dist/edit/doc/editor.d.cts +59 -0
  7. package/dist/edit/doc/editor.d.ts +59 -0
  8. package/dist/edit/doc/editor.js +155 -0
  9. package/dist/edit/doc/paragraph.cjs +130 -0
  10. package/dist/edit/doc/paragraph.d.cts +2 -0
  11. package/dist/edit/doc/paragraph.d.ts +2 -0
  12. package/dist/edit/doc/paragraph.js +128 -0
  13. package/dist/edit/doc/run.cjs +98 -0
  14. package/dist/edit/doc/run.d.cts +2 -0
  15. package/dist/edit/doc/run.d.ts +2 -0
  16. package/dist/edit/doc/run.js +96 -0
  17. package/dist/edit/doc/table.cjs +110 -0
  18. package/dist/edit/doc/table.d.cts +41 -0
  19. package/dist/edit/doc/table.d.ts +41 -0
  20. package/dist/edit/doc/table.js +106 -0
  21. package/dist/edit/ppt/editor.cjs +51 -0
  22. package/dist/edit/ppt/editor.d.cts +22 -0
  23. package/dist/edit/ppt/editor.d.ts +22 -0
  24. package/dist/edit/ppt/editor.js +48 -0
  25. package/dist/edit/ppt/slide.cjs +104 -0
  26. package/dist/edit/ppt/slide.d.cts +39 -0
  27. package/dist/edit/ppt/slide.d.ts +39 -0
  28. package/dist/edit/ppt/slide.js +101 -0
  29. package/dist/edit/xls/editor.cjs +2 -1
  30. package/dist/edit/xls/editor.d.cts +2 -1
  31. package/dist/edit/xls/editor.d.ts +2 -1
  32. package/dist/edit/xls/editor.js +2 -1
  33. package/dist/index.cjs +22 -2
  34. package/dist/index.d.cts +15 -9
  35. package/dist/index.d.ts +14 -8
  36. package/dist/index.js +9 -3
  37. package/dist/paragraph-Byw2Y7xu.d.ts +43 -0
  38. package/dist/paragraph-DM9n9I4T.d.cts +43 -0
  39. package/dist/run-iYz2M-a_.d.cts +39 -0
  40. package/dist/run-iYz2M-a_.d.ts +39 -0
  41. package/package.json +1 -1
@@ -0,0 +1,128 @@
1
+ import { DocRun, buildRun } from "./run.js";
2
+ //#region src/edit/doc/paragraph.ts
3
+ var DocParagraph = class {
4
+ container;
5
+ node;
6
+ removed = false;
7
+ constructor(container, node) {
8
+ this.container = container;
9
+ this.node = node;
10
+ }
11
+ live() {
12
+ if (this.removed) throw new Error("this DocParagraph has been removed from its container and can no longer be used");
13
+ return this.node;
14
+ }
15
+ get text() {
16
+ return this.live().runs.map((run) => run.text).join("");
17
+ }
18
+ set text(value) {
19
+ const node = this.live();
20
+ node.runs = [buildRun({ text: value })];
21
+ }
22
+ runs() {
23
+ return this.live().runs.map((run) => new DocRun(this.live().runs, run));
24
+ }
25
+ appendRun(init) {
26
+ const node = this.live();
27
+ const run = buildRun(init);
28
+ node.runs.push(run);
29
+ return new DocRun(node.runs, run);
30
+ }
31
+ insertRunAt(index, init) {
32
+ const node = this.live();
33
+ const run = buildRun(init);
34
+ node.runs.splice(index, 0, run);
35
+ return new DocRun(node.runs, run);
36
+ }
37
+ get styleId() {
38
+ return this.live().styleId;
39
+ }
40
+ set styleId(value) {
41
+ const node = this.live();
42
+ if (value === void 0) delete node.styleId;
43
+ else node.styleId = value;
44
+ }
45
+ get headingLevel() {
46
+ return this.live().headingLevel;
47
+ }
48
+ set headingLevel(level) {
49
+ const node = this.live();
50
+ if (level === void 0) delete node.headingLevel;
51
+ else node.headingLevel = level;
52
+ }
53
+ get alignment() {
54
+ return this.live().alignment;
55
+ }
56
+ set alignment(value) {
57
+ const node = this.live();
58
+ if (value === void 0) delete node.alignment;
59
+ else node.alignment = value;
60
+ }
61
+ get indentLeftPt() {
62
+ return this.live().indentLeftPt;
63
+ }
64
+ set indentLeftPt(value) {
65
+ const node = this.live();
66
+ if (value === void 0) delete node.indentLeftPt;
67
+ else node.indentLeftPt = value;
68
+ }
69
+ get indentRightPt() {
70
+ return this.live().indentRightPt;
71
+ }
72
+ set indentRightPt(value) {
73
+ const node = this.live();
74
+ if (value === void 0) delete node.indentRightPt;
75
+ else node.indentRightPt = value;
76
+ }
77
+ get indentFirstLinePt() {
78
+ return this.live().indentFirstLinePt;
79
+ }
80
+ set indentFirstLinePt(value) {
81
+ const node = this.live();
82
+ if (value === void 0) delete node.indentFirstLinePt;
83
+ else node.indentFirstLinePt = value;
84
+ }
85
+ get spacingBeforePt() {
86
+ return this.live().spacingBeforePt;
87
+ }
88
+ set spacingBeforePt(value) {
89
+ const node = this.live();
90
+ if (value === void 0) delete node.spacingBeforePt;
91
+ else node.spacingBeforePt = value;
92
+ }
93
+ get spacingAfterPt() {
94
+ return this.live().spacingAfterPt;
95
+ }
96
+ set spacingAfterPt(value) {
97
+ const node = this.live();
98
+ if (value === void 0) delete node.spacingAfterPt;
99
+ else node.spacingAfterPt = value;
100
+ }
101
+ get list() {
102
+ return this.live().list;
103
+ }
104
+ set list(value) {
105
+ const node = this.live();
106
+ if (value === void 0) delete node.list;
107
+ else node.list = value;
108
+ }
109
+ remove() {
110
+ const node = this.live();
111
+ const index = this.container.indexOf(node);
112
+ if (index !== -1) this.container.splice(index, 1);
113
+ this.removed = true;
114
+ }
115
+ };
116
+ function buildParagraph(init = {}) {
117
+ const node = {
118
+ kind: "paragraph",
119
+ runs: [buildRun({ text: init.text ?? "" })]
120
+ };
121
+ const paragraph = new DocParagraph([], node);
122
+ if (init.styleId !== void 0) paragraph.styleId = init.styleId;
123
+ if (init.headingLevel !== void 0) paragraph.headingLevel = init.headingLevel;
124
+ if (init.alignment !== void 0) paragraph.alignment = init.alignment;
125
+ return node;
126
+ }
127
+ //#endregion
128
+ export { DocParagraph, buildParagraph };
@@ -0,0 +1,98 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/edit/doc/run.ts
3
+ var DocRun = class {
4
+ container;
5
+ node;
6
+ removed = false;
7
+ constructor(container, node) {
8
+ this.container = container;
9
+ this.node = node;
10
+ }
11
+ live() {
12
+ if (this.removed) throw new Error("this DocRun has been removed from its paragraph and can no longer be used");
13
+ return this.node;
14
+ }
15
+ get text() {
16
+ return this.live().text;
17
+ }
18
+ set text(value) {
19
+ this.live().text = value;
20
+ }
21
+ get bold() {
22
+ return this.live().bold ?? false;
23
+ }
24
+ set bold(value) {
25
+ const node = this.live();
26
+ if (value) node.bold = true;
27
+ else delete node.bold;
28
+ }
29
+ get italic() {
30
+ return this.live().italic ?? false;
31
+ }
32
+ set italic(value) {
33
+ const node = this.live();
34
+ if (value) node.italic = true;
35
+ else delete node.italic;
36
+ }
37
+ get underline() {
38
+ return this.live().underline ?? false;
39
+ }
40
+ set underline(value) {
41
+ const node = this.live();
42
+ if (value) node.underline = true;
43
+ else delete node.underline;
44
+ }
45
+ get strike() {
46
+ return this.live().strike ?? false;
47
+ }
48
+ set strike(value) {
49
+ const node = this.live();
50
+ if (value) node.strike = true;
51
+ else delete node.strike;
52
+ }
53
+ get sizePt() {
54
+ return this.live().sizePt;
55
+ }
56
+ set sizePt(value) {
57
+ const node = this.live();
58
+ if (value === void 0) delete node.sizePt;
59
+ else node.sizePt = value;
60
+ }
61
+ get color() {
62
+ return this.live().color;
63
+ }
64
+ set color(value) {
65
+ const node = this.live();
66
+ if (value === void 0) delete node.color;
67
+ else node.color = value;
68
+ }
69
+ get fontFamily() {
70
+ return this.live().fontFamily;
71
+ }
72
+ set fontFamily(value) {
73
+ const node = this.live();
74
+ if (value === void 0) delete node.fontFamily;
75
+ else node.fontFamily = value;
76
+ }
77
+ remove() {
78
+ const node = this.live();
79
+ const index = this.container.indexOf(node);
80
+ if (index !== -1) this.container.splice(index, 1);
81
+ this.removed = true;
82
+ }
83
+ };
84
+ function buildRun(init = {}) {
85
+ const node = { text: init.text ?? "" };
86
+ const run = new DocRun([], node);
87
+ if (init.bold !== void 0) run.bold = init.bold;
88
+ if (init.italic !== void 0) run.italic = init.italic;
89
+ if (init.underline !== void 0) run.underline = init.underline;
90
+ if (init.strike !== void 0) run.strike = init.strike;
91
+ if (init.sizePt !== void 0) run.sizePt = init.sizePt;
92
+ if (init.color !== void 0) run.color = init.color;
93
+ if (init.fontFamily !== void 0) run.fontFamily = init.fontFamily;
94
+ return node;
95
+ }
96
+ //#endregion
97
+ exports.DocRun = DocRun;
98
+ exports.buildRun = buildRun;
@@ -0,0 +1,2 @@
1
+ import { n as RunInit, r as buildRun, t as DocRun } from "../../run-iYz2M-a_.cjs";
2
+ export { DocRun, RunInit, buildRun };
@@ -0,0 +1,2 @@
1
+ import { n as RunInit, r as buildRun, t as DocRun } from "../../run-iYz2M-a_.js";
2
+ export { DocRun, RunInit, buildRun };
@@ -0,0 +1,96 @@
1
+ //#region src/edit/doc/run.ts
2
+ var DocRun = class {
3
+ container;
4
+ node;
5
+ removed = false;
6
+ constructor(container, node) {
7
+ this.container = container;
8
+ this.node = node;
9
+ }
10
+ live() {
11
+ if (this.removed) throw new Error("this DocRun has been removed from its paragraph and can no longer be used");
12
+ return this.node;
13
+ }
14
+ get text() {
15
+ return this.live().text;
16
+ }
17
+ set text(value) {
18
+ this.live().text = value;
19
+ }
20
+ get bold() {
21
+ return this.live().bold ?? false;
22
+ }
23
+ set bold(value) {
24
+ const node = this.live();
25
+ if (value) node.bold = true;
26
+ else delete node.bold;
27
+ }
28
+ get italic() {
29
+ return this.live().italic ?? false;
30
+ }
31
+ set italic(value) {
32
+ const node = this.live();
33
+ if (value) node.italic = true;
34
+ else delete node.italic;
35
+ }
36
+ get underline() {
37
+ return this.live().underline ?? false;
38
+ }
39
+ set underline(value) {
40
+ const node = this.live();
41
+ if (value) node.underline = true;
42
+ else delete node.underline;
43
+ }
44
+ get strike() {
45
+ return this.live().strike ?? false;
46
+ }
47
+ set strike(value) {
48
+ const node = this.live();
49
+ if (value) node.strike = true;
50
+ else delete node.strike;
51
+ }
52
+ get sizePt() {
53
+ return this.live().sizePt;
54
+ }
55
+ set sizePt(value) {
56
+ const node = this.live();
57
+ if (value === void 0) delete node.sizePt;
58
+ else node.sizePt = value;
59
+ }
60
+ get color() {
61
+ return this.live().color;
62
+ }
63
+ set color(value) {
64
+ const node = this.live();
65
+ if (value === void 0) delete node.color;
66
+ else node.color = value;
67
+ }
68
+ get fontFamily() {
69
+ return this.live().fontFamily;
70
+ }
71
+ set fontFamily(value) {
72
+ const node = this.live();
73
+ if (value === void 0) delete node.fontFamily;
74
+ else node.fontFamily = value;
75
+ }
76
+ remove() {
77
+ const node = this.live();
78
+ const index = this.container.indexOf(node);
79
+ if (index !== -1) this.container.splice(index, 1);
80
+ this.removed = true;
81
+ }
82
+ };
83
+ function buildRun(init = {}) {
84
+ const node = { text: init.text ?? "" };
85
+ const run = new DocRun([], node);
86
+ if (init.bold !== void 0) run.bold = init.bold;
87
+ if (init.italic !== void 0) run.italic = init.italic;
88
+ if (init.underline !== void 0) run.underline = init.underline;
89
+ if (init.strike !== void 0) run.strike = init.strike;
90
+ if (init.sizePt !== void 0) run.sizePt = init.sizePt;
91
+ if (init.color !== void 0) run.color = init.color;
92
+ if (init.fontFamily !== void 0) run.fontFamily = init.fontFamily;
93
+ return node;
94
+ }
95
+ //#endregion
96
+ export { DocRun, buildRun };
@@ -0,0 +1,110 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_edit_doc_paragraph = require("./paragraph.cjs");
3
+ //#region src/edit/doc/table.ts
4
+ const DEFAULT_TABLE_WIDTH_PT = 468;
5
+ var DocTableCell = class {
6
+ container;
7
+ node;
8
+ removed = false;
9
+ constructor(container, node) {
10
+ this.container = container;
11
+ this.node = node;
12
+ }
13
+ live() {
14
+ if (this.removed) throw new Error("this DocTableCell has been removed from its row and can no longer be used");
15
+ return this.node;
16
+ }
17
+ remove() {
18
+ const index = this.container.indexOf(this.node);
19
+ if (index !== -1) this.container.splice(index, 1);
20
+ this.removed = true;
21
+ }
22
+ paragraphs() {
23
+ return this.live().blocks.filter((block) => block.kind === "paragraph").map((block) => new require_edit_doc_paragraph.DocParagraph(this.live().blocks, block));
24
+ }
25
+ appendParagraph(init) {
26
+ const paragraph = require_edit_doc_paragraph.buildParagraph(init);
27
+ this.live().blocks.push(paragraph);
28
+ return new require_edit_doc_paragraph.DocParagraph(this.live().blocks, paragraph);
29
+ }
30
+ get text() {
31
+ return this.paragraphs().map((p) => p.text).join("\n");
32
+ }
33
+ set text(value) {
34
+ this.live().blocks = [require_edit_doc_paragraph.buildParagraph({ text: value })];
35
+ }
36
+ get colSpan() {
37
+ return this.live().colSpan;
38
+ }
39
+ set colSpan(value) {
40
+ if (value === void 0) delete this.live().colSpan;
41
+ else this.live().colSpan = value;
42
+ }
43
+ get rowSpan() {
44
+ return this.live().rowSpan;
45
+ }
46
+ set rowSpan(value) {
47
+ if (value === void 0) delete this.live().rowSpan;
48
+ else this.live().rowSpan = value;
49
+ }
50
+ };
51
+ var DocTableRow = class {
52
+ node;
53
+ constructor(node) {
54
+ this.node = node;
55
+ }
56
+ cells() {
57
+ return this.node.cells.map((cell) => new DocTableCell(this.node.cells, cell));
58
+ }
59
+ };
60
+ function buildCell() {
61
+ return { blocks: [require_edit_doc_paragraph.buildParagraph()] };
62
+ }
63
+ function buildRow(columnCount) {
64
+ const cells = [];
65
+ for (let i = 0; i < columnCount; i++) cells.push(buildCell());
66
+ return { cells };
67
+ }
68
+ var DocTable = class {
69
+ container;
70
+ node;
71
+ removed = false;
72
+ constructor(container, node) {
73
+ this.container = container;
74
+ this.node = node;
75
+ }
76
+ live() {
77
+ if (this.removed) throw new Error("this DocTable has been removed from its section and can no longer be used");
78
+ return this.node;
79
+ }
80
+ rows() {
81
+ return this.live().rows.map((row) => new DocTableRow(row));
82
+ }
83
+ appendRow() {
84
+ const node = this.live();
85
+ const row = buildRow(node.columnWidthsPt.length);
86
+ node.rows.push(row);
87
+ return new DocTableRow(row);
88
+ }
89
+ remove() {
90
+ const node = this.live();
91
+ const index = this.container.indexOf(node);
92
+ if (index !== -1) this.container.splice(index, 1);
93
+ this.removed = true;
94
+ }
95
+ };
96
+ function buildTable(init) {
97
+ const columnWidthsPt = Array.from({ length: init.columns }, () => DEFAULT_TABLE_WIDTH_PT / init.columns);
98
+ const rows = [];
99
+ for (let r = 0; r < init.rows; r++) rows.push(buildRow(init.columns));
100
+ return {
101
+ kind: "table",
102
+ rows,
103
+ columnWidthsPt
104
+ };
105
+ }
106
+ //#endregion
107
+ exports.DocTable = DocTable;
108
+ exports.DocTableCell = DocTableCell;
109
+ exports.DocTableRow = DocTableRow;
110
+ exports.buildTable = buildTable;
@@ -0,0 +1,41 @@
1
+ import { n as ParagraphInit, t as DocParagraph } from "../../paragraph-DM9n9I4T.cjs";
2
+ import { ContentBlock, ContentTable, ContentTableCell, ContentTableRow } from "document-schema.js";
3
+ //#region src/edit/doc/table.d.ts
4
+ interface TableInit {
5
+ readonly rows: number;
6
+ readonly columns: number;
7
+ }
8
+ declare class DocTableCell {
9
+ private readonly container;
10
+ private readonly node;
11
+ private removed;
12
+ constructor(container: ContentTableCell[], node: ContentTableCell);
13
+ private live;
14
+ remove(): void;
15
+ paragraphs(): DocParagraph[];
16
+ appendParagraph(init?: ParagraphInit): DocParagraph;
17
+ get text(): string;
18
+ set text(value: string);
19
+ get colSpan(): number | undefined;
20
+ set colSpan(value: number | undefined);
21
+ get rowSpan(): number | undefined;
22
+ set rowSpan(value: number | undefined);
23
+ }
24
+ declare class DocTableRow {
25
+ private readonly node;
26
+ constructor(node: ContentTableRow);
27
+ cells(): DocTableCell[];
28
+ }
29
+ declare class DocTable {
30
+ private readonly container;
31
+ private readonly node;
32
+ private removed;
33
+ constructor(container: ContentBlock[], node: ContentTable);
34
+ private live;
35
+ rows(): DocTableRow[];
36
+ appendRow(): DocTableRow;
37
+ remove(): void;
38
+ }
39
+ declare function buildTable(init: TableInit): ContentTable;
40
+ //#endregion
41
+ export { DocTable, DocTableCell, DocTableRow, TableInit, buildTable };
@@ -0,0 +1,41 @@
1
+ import { n as ParagraphInit, t as DocParagraph } from "../../paragraph-Byw2Y7xu.js";
2
+ import { ContentBlock, ContentTable, ContentTableCell, ContentTableRow } from "document-schema.js";
3
+ //#region src/edit/doc/table.d.ts
4
+ interface TableInit {
5
+ readonly rows: number;
6
+ readonly columns: number;
7
+ }
8
+ declare class DocTableCell {
9
+ private readonly container;
10
+ private readonly node;
11
+ private removed;
12
+ constructor(container: ContentTableCell[], node: ContentTableCell);
13
+ private live;
14
+ remove(): void;
15
+ paragraphs(): DocParagraph[];
16
+ appendParagraph(init?: ParagraphInit): DocParagraph;
17
+ get text(): string;
18
+ set text(value: string);
19
+ get colSpan(): number | undefined;
20
+ set colSpan(value: number | undefined);
21
+ get rowSpan(): number | undefined;
22
+ set rowSpan(value: number | undefined);
23
+ }
24
+ declare class DocTableRow {
25
+ private readonly node;
26
+ constructor(node: ContentTableRow);
27
+ cells(): DocTableCell[];
28
+ }
29
+ declare class DocTable {
30
+ private readonly container;
31
+ private readonly node;
32
+ private removed;
33
+ constructor(container: ContentBlock[], node: ContentTable);
34
+ private live;
35
+ rows(): DocTableRow[];
36
+ appendRow(): DocTableRow;
37
+ remove(): void;
38
+ }
39
+ declare function buildTable(init: TableInit): ContentTable;
40
+ //#endregion
41
+ export { DocTable, DocTableCell, DocTableRow, TableInit, buildTable };
@@ -0,0 +1,106 @@
1
+ import { DocParagraph, buildParagraph } from "./paragraph.js";
2
+ //#region src/edit/doc/table.ts
3
+ const DEFAULT_TABLE_WIDTH_PT = 468;
4
+ var DocTableCell = class {
5
+ container;
6
+ node;
7
+ removed = false;
8
+ constructor(container, node) {
9
+ this.container = container;
10
+ this.node = node;
11
+ }
12
+ live() {
13
+ if (this.removed) throw new Error("this DocTableCell has been removed from its row and can no longer be used");
14
+ return this.node;
15
+ }
16
+ remove() {
17
+ const index = this.container.indexOf(this.node);
18
+ if (index !== -1) this.container.splice(index, 1);
19
+ this.removed = true;
20
+ }
21
+ paragraphs() {
22
+ return this.live().blocks.filter((block) => block.kind === "paragraph").map((block) => new DocParagraph(this.live().blocks, block));
23
+ }
24
+ appendParagraph(init) {
25
+ const paragraph = buildParagraph(init);
26
+ this.live().blocks.push(paragraph);
27
+ return new DocParagraph(this.live().blocks, paragraph);
28
+ }
29
+ get text() {
30
+ return this.paragraphs().map((p) => p.text).join("\n");
31
+ }
32
+ set text(value) {
33
+ this.live().blocks = [buildParagraph({ text: value })];
34
+ }
35
+ get colSpan() {
36
+ return this.live().colSpan;
37
+ }
38
+ set colSpan(value) {
39
+ if (value === void 0) delete this.live().colSpan;
40
+ else this.live().colSpan = value;
41
+ }
42
+ get rowSpan() {
43
+ return this.live().rowSpan;
44
+ }
45
+ set rowSpan(value) {
46
+ if (value === void 0) delete this.live().rowSpan;
47
+ else this.live().rowSpan = value;
48
+ }
49
+ };
50
+ var DocTableRow = class {
51
+ node;
52
+ constructor(node) {
53
+ this.node = node;
54
+ }
55
+ cells() {
56
+ return this.node.cells.map((cell) => new DocTableCell(this.node.cells, cell));
57
+ }
58
+ };
59
+ function buildCell() {
60
+ return { blocks: [buildParagraph()] };
61
+ }
62
+ function buildRow(columnCount) {
63
+ const cells = [];
64
+ for (let i = 0; i < columnCount; i++) cells.push(buildCell());
65
+ return { cells };
66
+ }
67
+ var DocTable = class {
68
+ container;
69
+ node;
70
+ removed = false;
71
+ constructor(container, node) {
72
+ this.container = container;
73
+ this.node = node;
74
+ }
75
+ live() {
76
+ if (this.removed) throw new Error("this DocTable has been removed from its section and can no longer be used");
77
+ return this.node;
78
+ }
79
+ rows() {
80
+ return this.live().rows.map((row) => new DocTableRow(row));
81
+ }
82
+ appendRow() {
83
+ const node = this.live();
84
+ const row = buildRow(node.columnWidthsPt.length);
85
+ node.rows.push(row);
86
+ return new DocTableRow(row);
87
+ }
88
+ remove() {
89
+ const node = this.live();
90
+ const index = this.container.indexOf(node);
91
+ if (index !== -1) this.container.splice(index, 1);
92
+ this.removed = true;
93
+ }
94
+ };
95
+ function buildTable(init) {
96
+ const columnWidthsPt = Array.from({ length: init.columns }, () => DEFAULT_TABLE_WIDTH_PT / init.columns);
97
+ const rows = [];
98
+ for (let r = 0; r < init.rows; r++) rows.push(buildRow(init.columns));
99
+ return {
100
+ kind: "table",
101
+ rows,
102
+ columnWidthsPt
103
+ };
104
+ }
105
+ //#endregion
106
+ export { DocTable, DocTableCell, DocTableRow, buildTable };
@@ -0,0 +1,51 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_metadata_core_patch = require("../../metadata/core-patch.cjs");
3
+ const require_model_metadata = require("../../model/metadata.cjs");
4
+ const require_ports_clock = require("../../ports/clock.cjs");
5
+ const require_ppt_read = require("../../ppt/read.cjs");
6
+ const require_ppt_write = require("../../ppt/write.cjs");
7
+ const require_edit_ppt_slide = require("./slide.cjs");
8
+ let document_schema_js = require("document-schema.js");
9
+ //#region src/edit/ppt/editor.ts
10
+ var PptEditor = class {
11
+ document;
12
+ constructor(document) {
13
+ if (document.kind !== "presentation") throw new Error(`PptEditor requires a presentation ContentDocument, got "${document.kind}"`);
14
+ this.document = document;
15
+ }
16
+ get metadata() {
17
+ return this.document.metadata;
18
+ }
19
+ set metadata(value) {
20
+ this.document.metadata = require_metadata_core_patch.mergeMetadata(this.document.metadata, value);
21
+ }
22
+ slides() {
23
+ return this.document.slides.map((slide) => new require_edit_ppt_slide.PptSlide(this.document.slides, slide));
24
+ }
25
+ addSlide(size = document_schema_js.SLIDE_SIZE_WIDESCREEN) {
26
+ const node = require_edit_ppt_slide.buildSlide(size);
27
+ this.document.slides.push(node);
28
+ return new require_edit_ppt_slide.PptSlide(this.document.slides, node);
29
+ }
30
+ removeSlideAt(index) {
31
+ this.document.slides.splice(index, 1);
32
+ }
33
+ toBytes() {
34
+ return require_ppt_write.writePptContent(this.document);
35
+ }
36
+ };
37
+ function openPpt(bytes) {
38
+ return new PptEditor(require_ppt_read.readPptContent(bytes));
39
+ }
40
+ function createPpt(options = {}) {
41
+ const clock = options.clock ?? require_ports_clock.systemClock;
42
+ return new PptEditor({
43
+ kind: "presentation",
44
+ metadata: require_model_metadata.resolveMetadataTimestamps({}, clock),
45
+ slides: []
46
+ });
47
+ }
48
+ //#endregion
49
+ exports.PptEditor = PptEditor;
50
+ exports.createPpt = createPpt;
51
+ exports.openPpt = openPpt;
@@ -0,0 +1,22 @@
1
+ import { t as ClockPort } from "../../clock-C7SUuYN0.cjs";
2
+ import { MetadataOverrides } from "../../metadata/core-patch.cjs";
3
+ import { PptSlide } from "./slide.cjs";
4
+ import { ContentDocument, LayoutMetadata, PageSize } from "document-schema.js";
5
+ //#region src/edit/ppt/editor.d.ts
6
+ interface CreatePptOptions {
7
+ readonly clock?: ClockPort;
8
+ }
9
+ declare class PptEditor {
10
+ private readonly document;
11
+ constructor(document: ContentDocument);
12
+ get metadata(): LayoutMetadata;
13
+ set metadata(value: MetadataOverrides);
14
+ slides(): PptSlide[];
15
+ addSlide(size?: PageSize): PptSlide;
16
+ removeSlideAt(index: number): void;
17
+ toBytes(): Uint8Array<ArrayBuffer>;
18
+ }
19
+ declare function openPpt(bytes: Uint8Array<ArrayBuffer>): PptEditor;
20
+ declare function createPpt(options?: CreatePptOptions): PptEditor;
21
+ //#endregion
22
+ export { CreatePptOptions, PptEditor, createPpt, openPpt };