ooxml-core 1.19.1 → 1.20.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/README.md +12 -1
- package/dist/{PptxHandler-2V4PQL6O.mjs → PptxHandler-FYD7IYXT.mjs} +2 -2
- package/dist/PptxHandler-SITN3K3F.mjs +4 -0
- package/dist/{PptxHandler-6TNIQ7S5.cjs → PptxHandler-TEKISCJO.cjs} +3 -3
- package/dist/{PresentationBuilder-HQ6C7L4V.mjs → PresentationBuilder-EYI6Z2JP.mjs} +2 -2
- package/dist/{PresentationBuilder-G7MPEGXJ.mjs → PresentationBuilder-IMB4DVRN.mjs} +2 -2
- package/dist/{PresentationBuilder-RM52LCVN.cjs → PresentationBuilder-NCKASKXU.cjs} +5 -5
- package/dist/automation/index.cjs +424 -90
- package/dist/automation/index.mjs +423 -91
- package/dist/automation/xlsx-read.d.ts +56 -0
- package/dist/automation/xlsx-read.d.ts.map +1 -0
- package/dist/automation/xlsx.d.ts +105 -4
- package/dist/automation/xlsx.d.ts.map +1 -1
- package/dist/{chunk-M6GDBVQ7.mjs → chunk-GQYQQ3GA.mjs} +1 -1
- package/dist/{chunk-SLNQNVQM.mjs → chunk-LEV2SVMK.mjs} +1 -1
- package/dist/{chunk-JUABSM7C.mjs → chunk-LVM3IZJ2.mjs} +1 -1
- package/dist/{chunk-TJPUAUWL.mjs → chunk-MN27HKHM.mjs} +8 -194
- package/dist/{chunk-4FTUAD2B.mjs → chunk-MNXKRXFB.mjs} +715 -200
- package/dist/{chunk-R5FIHHGB.cjs → chunk-NXKATFM5.cjs} +1598 -1204
- package/dist/{chunk-ZJ2OKIJN.mjs → chunk-WXY5EDGT.mjs} +592 -198
- package/dist/docx/embedded.cjs +4 -1
- package/dist/docx/embedded.mjs +4 -1
- package/dist/docx/index.cjs +4 -1
- package/dist/docx/index.mjs +4 -1
- package/dist/docx/load/index.cjs +4 -1
- package/dist/docx/load/index.mjs +4 -1
- package/dist/docx/write-table.d.ts.map +1 -1
- package/dist/index.cjs +25 -0
- package/dist/index.mjs +25 -0
- package/dist/pptx/automation/index.cjs +887 -453
- package/dist/pptx/automation/index.d.ts +2 -2
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-Bqm-jFG-.d.ts → index-CgFX0T7b.d.ts} +7573 -7508
- package/dist/pptx/chunks/index-CgFX0T7b.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-B9x557hr.d.ts → index-qwVYoFn6.d.ts} +2 -2
- package/dist/pptx/chunks/{index-B9x557hr.d.ts.map → index-qwVYoFn6.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +654 -221
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +991 -619
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/visio/index.cjs +61 -7
- package/dist/visio/index.mjs +61 -7
- package/dist/visio/ui/contract.d.ts +2 -1
- package/dist/visio/ui/contract.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +62 -7
- package/dist/visio/ui/index.mjs +62 -7
- package/dist/xlsx/edit/dimensions.d.ts.map +1 -1
- package/dist/xlsx/edit/history-rows.d.ts +7 -0
- package/dist/xlsx/edit/history-rows.d.ts.map +1 -0
- package/dist/xlsx/edit/history.d.ts +11 -1
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/outline.d.ts.map +1 -1
- package/dist/xlsx/edit/row-autofit.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +235 -54
- package/dist/xlsx/index.mjs +235 -54
- package/dist/xlsx/layout/merge-sweep.d.ts +36 -0
- package/dist/xlsx/layout/merge-sweep.d.ts.map +1 -0
- package/dist/xlsx/layout/metrics.d.ts +5 -0
- package/dist/xlsx/layout/metrics.d.ts.map +1 -1
- package/dist/xlsx/layout/row-autofit.d.ts +6 -0
- package/dist/xlsx/layout/row-autofit.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +61 -7
- package/dist/xlsx/load/index.mjs +61 -7
- package/dist/xlsx/numfmt/format.d.ts +8 -0
- package/dist/xlsx/numfmt/format.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-data-source.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +281 -55
- package/dist/xlsx/ui/index.d.ts +1 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +281 -56
- package/dist/xlsx/ui/selection-format.d.ts +13 -0
- package/dist/xlsx/ui/selection-format.d.ts.map +1 -0
- package/dist/xml/index.cjs +25 -0
- package/dist/xml/index.mjs +25 -0
- package/dist/xml/lite.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/PptxHandler-HSPKEP5E.mjs +0 -4
- package/dist/pptx/chunks/index-Bqm-jFG-.d.ts.map +0 -1
- /package/dist/{chunk-NYTR4UZ5.cjs → chunk-3IENHIFD.cjs} +0 -0
- /package/dist/{chunk-XTSHZGSM.mjs → chunk-CC5UNZOO.mjs} +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type CellRange } from '../xlsx/address.js';
|
|
2
|
+
import type { Cell, CellValue, Workbook, Worksheet } from '../xlsx/model.js';
|
|
3
|
+
/** The most tables per sheet, and defined names, that an inspection lists. */
|
|
4
|
+
export declare const INSPECT_LIST_LIMIT = 500;
|
|
5
|
+
/** Each sheet's used range (the cells it stores: values, formulas or formatting), state and tables. */
|
|
6
|
+
export declare function sheetSummaries(workbook: Workbook): {
|
|
7
|
+
index: number;
|
|
8
|
+
name: string;
|
|
9
|
+
state: import("../xlsx/index.js").SheetState;
|
|
10
|
+
usedRange: string | null;
|
|
11
|
+
rows: number;
|
|
12
|
+
columns: number;
|
|
13
|
+
tables: {
|
|
14
|
+
name: string;
|
|
15
|
+
range: string;
|
|
16
|
+
headerRow: boolean;
|
|
17
|
+
totalsRow: boolean;
|
|
18
|
+
}[];
|
|
19
|
+
tablesOmitted?: number;
|
|
20
|
+
}[];
|
|
21
|
+
/** The defined names Excel's Name Manager lists (hidden ones are left out), with their scope. */
|
|
22
|
+
export declare function definedNameList(workbook: Workbook): {
|
|
23
|
+
definedNames: {
|
|
24
|
+
name: string;
|
|
25
|
+
refersTo: string;
|
|
26
|
+
sheetIndex?: number;
|
|
27
|
+
}[];
|
|
28
|
+
definedNamesOmitted: number;
|
|
29
|
+
} | {
|
|
30
|
+
definedNamesOmitted?: never;
|
|
31
|
+
definedNames: {
|
|
32
|
+
name: string;
|
|
33
|
+
refersTo: string;
|
|
34
|
+
sheetIndex?: number;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
37
|
+
export interface CellView {
|
|
38
|
+
value: CellValue;
|
|
39
|
+
formula?: string;
|
|
40
|
+
/** The text as the grid displays it, with the cell's number format applied. */
|
|
41
|
+
text: string;
|
|
42
|
+
/** The number format code, absent for General. */
|
|
43
|
+
numberFormat?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The value of a cell shown as a date or time, in ISO 8601 without a time zone; absent for
|
|
46
|
+
* numbers and durations (`[h]:mm`).
|
|
47
|
+
*/
|
|
48
|
+
iso?: string;
|
|
49
|
+
}
|
|
50
|
+
/** A cell's value and formula with its displayed text, number format and ISO date. */
|
|
51
|
+
export declare function cellView(workbook: Workbook, cell: Cell | undefined): CellView;
|
|
52
|
+
/** The cells of `range`, row by row, each with its address and {@link cellView}. */
|
|
53
|
+
export declare function rangeCells(workbook: Workbook, sheet: Worksheet, range: CellRange): ({
|
|
54
|
+
address: string;
|
|
55
|
+
} & CellView)[];
|
|
56
|
+
//# sourceMappingURL=xlsx-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xlsx-read.d.ts","sourceRoot":"","sources":["../../automation/xlsx-read.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAG7E,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK1E,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,uGAAuG;AACvG,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ;;;;;;;;;;;;;;IAoBhD;AAED,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ;;;;;;;;;;;;;;EASjD;AAyBD,MAAM,WAAW,QAAQ;IACxB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,sFAAsF;AACtF,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,SAAS,GAAG,QAAQ,CAa7E;AAKD,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS;aAGvD,MAAM;gBAQ/B"}
|
|
@@ -1,18 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sheets (index, name, state, used range with its row and column counts, tables), the
|
|
3
|
+
* active sheet, the defined names, the document properties and the loader warnings. Tables per
|
|
4
|
+
* sheet and names are capped at 500 each; `tablesOmitted` and `definedNamesOmitted` count the rest.
|
|
5
|
+
*/
|
|
1
6
|
export declare function inspectXlsx(bytes: Uint8Array): Promise<{
|
|
7
|
+
definedNames: {
|
|
8
|
+
name: string;
|
|
9
|
+
refersTo: string;
|
|
10
|
+
sheetIndex?: number;
|
|
11
|
+
}[];
|
|
12
|
+
definedNamesOmitted: number;
|
|
2
13
|
sheets: {
|
|
3
14
|
index: number;
|
|
4
15
|
name: string;
|
|
16
|
+
state: import("../xlsx/index.js").SheetState;
|
|
17
|
+
usedRange: string | null;
|
|
18
|
+
rows: number;
|
|
19
|
+
columns: number;
|
|
20
|
+
tables: {
|
|
21
|
+
name: string;
|
|
22
|
+
range: string;
|
|
23
|
+
headerRow: boolean;
|
|
24
|
+
totalsRow: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
tablesOmitted?: number;
|
|
5
27
|
}[];
|
|
28
|
+
activeSheet: number;
|
|
29
|
+
properties: import("../xlsx/index.js").WorkbookProperties;
|
|
30
|
+
warnings: string[];
|
|
31
|
+
} | {
|
|
32
|
+
definedNamesOmitted?: never;
|
|
33
|
+
definedNames: {
|
|
34
|
+
name: string;
|
|
35
|
+
refersTo: string;
|
|
36
|
+
sheetIndex?: number;
|
|
37
|
+
}[];
|
|
38
|
+
sheets: {
|
|
39
|
+
index: number;
|
|
40
|
+
name: string;
|
|
41
|
+
state: import("../xlsx/index.js").SheetState;
|
|
42
|
+
usedRange: string | null;
|
|
43
|
+
rows: number;
|
|
44
|
+
columns: number;
|
|
45
|
+
tables: {
|
|
46
|
+
name: string;
|
|
47
|
+
range: string;
|
|
48
|
+
headerRow: boolean;
|
|
49
|
+
totalsRow: boolean;
|
|
50
|
+
}[];
|
|
51
|
+
tablesOmitted?: number;
|
|
52
|
+
}[];
|
|
53
|
+
activeSheet: number;
|
|
6
54
|
properties: import("../xlsx/index.js").WorkbookProperties;
|
|
7
55
|
warnings: string[];
|
|
8
56
|
}>;
|
|
9
57
|
export declare function createXlsx(names: readonly string[]): Promise<Uint8Array>;
|
|
58
|
+
/**
|
|
59
|
+
* The cells of an A1 range (at most 10,000), row by row: value, formula, the text as displayed,
|
|
60
|
+
* the number format (absent for General) and, for dates and times, the value in ISO 8601.
|
|
61
|
+
*/
|
|
10
62
|
export declare function readXlsxRange(bytes: Uint8Array, sheetIndex: number, reference: string): Promise<{
|
|
11
|
-
cells: {
|
|
63
|
+
cells: ({
|
|
12
64
|
address: string;
|
|
13
|
-
|
|
14
|
-
formula: string | undefined;
|
|
15
|
-
}[];
|
|
65
|
+
} & import("./xlsx-read.js").CellView)[];
|
|
16
66
|
warnings: string[];
|
|
17
67
|
}>;
|
|
18
68
|
export declare function setXlsxCells(bytes: Uint8Array, sheetIndex: number, cells: readonly {
|
|
@@ -43,4 +93,55 @@ export declare function readXlsxFilledCells(bytes: Uint8Array, { maxCells }?: {
|
|
|
43
93
|
truncated: boolean;
|
|
44
94
|
warnings: string[];
|
|
45
95
|
}>;
|
|
96
|
+
export interface XlsxFindOptions {
|
|
97
|
+
/** The sheet to search; every sheet when absent. */
|
|
98
|
+
sheetIndex?: number;
|
|
99
|
+
/** An A1 range to search within (needs `sheetIndex`). */
|
|
100
|
+
range?: string;
|
|
101
|
+
/** `formulas` (Excel's default) searches what was typed; `values` the text as displayed. */
|
|
102
|
+
lookIn?: 'formulas' | 'values';
|
|
103
|
+
matchCase?: boolean;
|
|
104
|
+
/** The whole cell content must match. */
|
|
105
|
+
wholeCell?: boolean;
|
|
106
|
+
/** Excel wildcards: `*` any run, `?` one character, `~` escapes. On by default. */
|
|
107
|
+
wildcards?: boolean;
|
|
108
|
+
/** At most this many matches (1 to 1000, default 100); `total` counts them all. */
|
|
109
|
+
maxResults?: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The cells matching `text` the way Excel's Find does, sheet by sheet in row order, each with
|
|
113
|
+
* its sheet, address and the same view as a range read. Bounded by `maxResults`.
|
|
114
|
+
*/
|
|
115
|
+
export declare function findXlsxCells(bytes: Uint8Array, text: string, options?: XlsxFindOptions): Promise<{
|
|
116
|
+
matches: {
|
|
117
|
+
value: import("../xlsx/index.js").CellValue;
|
|
118
|
+
formula?: string;
|
|
119
|
+
text: string;
|
|
120
|
+
numberFormat?: string;
|
|
121
|
+
iso?: string;
|
|
122
|
+
sheetIndex: number;
|
|
123
|
+
sheet: string;
|
|
124
|
+
address: string;
|
|
125
|
+
}[];
|
|
126
|
+
total: number;
|
|
127
|
+
truncated: boolean;
|
|
128
|
+
warnings: string[];
|
|
129
|
+
}>;
|
|
130
|
+
/**
|
|
131
|
+
* A table found by name (ignoring case, as Excel does) on any sheet: its sheet, range, header and
|
|
132
|
+
* totals rows, column names and cells as a range read returns them (at most 10,000 cells).
|
|
133
|
+
*/
|
|
134
|
+
export declare function readXlsxTable(bytes: Uint8Array, name: string): Promise<{
|
|
135
|
+
sheetIndex: number;
|
|
136
|
+
sheet: string;
|
|
137
|
+
name: string;
|
|
138
|
+
range: string;
|
|
139
|
+
headerRow: boolean;
|
|
140
|
+
totalsRow: boolean;
|
|
141
|
+
columns: string[];
|
|
142
|
+
cells: ({
|
|
143
|
+
address: string;
|
|
144
|
+
} & import("./xlsx-read.js").CellView)[];
|
|
145
|
+
warnings: string[];
|
|
146
|
+
}>;
|
|
46
147
|
//# sourceMappingURL=xlsx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xlsx.d.ts","sourceRoot":"","sources":["../../automation/xlsx.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xlsx.d.ts","sourceRoot":"","sources":["../../automation/xlsx.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASlD;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAW9E;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;GAQ3F;AAED,wBAAsB,YAAY,CACjC,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,SAAS;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE;;;GAgBpD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,QAAe,EAAE;;CAAK;;;;;qBAI3D,MAAM;mBAAS,OAAO;sBAAY,MAAM;;;;;;;GAoBjE;AAED,MAAM,WAAW,eAAe;IAC/B,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4FAA4F;IAC5F,MAAM,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yCAAyC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mFAAmF;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAClC,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAoB;;;;;;;;;;;;;;GAuC7B;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM;;;;;;;;;;;;GAmBlE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasTextProperties, isImageLikeElement, blobUrlToDataUrl, getSubstituteFontFamily, stripXmlOrderSuffix } from './chunk-
|
|
1
|
+
import { hasTextProperties, isImageLikeElement, blobUrlToDataUrl, getSubstituteFontFamily, stripXmlOrderSuffix } from './chunk-LEV2SVMK.mjs';
|
|
2
2
|
|
|
3
3
|
// pptx/converter/media-context.ts
|
|
4
4
|
var MIME_TO_EXT = {
|
|
@@ -21818,7 +21818,7 @@ function findTextBearingElementById(elements3, elementId) {
|
|
|
21818
21818
|
}
|
|
21819
21819
|
async function loadNestedDeck(pptxBytes) {
|
|
21820
21820
|
try {
|
|
21821
|
-
const { PptxHandler } = await import('./PptxHandler-
|
|
21821
|
+
const { PptxHandler } = await import('./PptxHandler-FYD7IYXT.mjs');
|
|
21822
21822
|
const handler = new PptxHandler();
|
|
21823
21823
|
const data = await handler.load(pptxBytes.buffer.slice(0));
|
|
21824
21824
|
return { handler, slides: data.slides };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findText, replaceText, replaceTextInSlide, mergePresentation } from './chunk-
|
|
2
|
-
import { PresentationBuilder, PptxHandler, SlideBuilder, validateSeriesIndex, removeEmptyDataPoint, ensureDataPoint, ensureChartData, assertChartGradientSupported, toChartGradientFill, isLineDrawnChartType, chartFormatTargetKey, applyChartGroupOptionsInput, STANDARD_LAYOUTS, createTextElement, createShapeElement, createImageElement, createTableElement, createChartElement, createConnectorElement, createMediaElement, createGroupElement, relationshipsPartFor, parseRelationships, resolvePartPath, clonePartGraph, buildRelationshipsXml, buildBlankPresentationArchive, nextRelationshipId, relativePartTarget, PptxXmlBuilder } from './chunk-
|
|
3
|
-
import {
|
|
1
|
+
import { findText, replaceText, replaceTextInSlide, mergePresentation } from './chunk-LVM3IZJ2.mjs';
|
|
2
|
+
import { PresentationBuilder, PptxHandler, SlideBuilder, validateSeriesIndex, removeEmptyDataPoint, ensureDataPoint, ensureChartData, assertChartGradientSupported, toChartGradientFill, isLineDrawnChartType, chartFormatTargetKey, applyChartGroupOptionsInput, countExistingLayouts, addLayoutToSlideMaster, addLayoutContentType, createLayout, STANDARD_LAYOUTS, generateLayoutXml, layoutRelsXml, createTextElement, createShapeElement, createImageElement, createTableElement, createChartElement, createConnectorElement, createMediaElement, createGroupElement, relationshipsPartFor, parseRelationships, resolvePartPath, clonePartGraph, buildRelationshipsXml, buildBlankPresentationArchive, nextRelationshipId, relativePartTarget, PptxXmlBuilder } from './chunk-MNXKRXFB.mjs';
|
|
3
|
+
import { EMU_PER_PIXEL, EMU_PER_INCH, parseXml, first, elements, buildXml, bytesToBase64, base64ToBytes, hasTextProperties, escAttr } from './chunk-LEV2SVMK.mjs';
|
|
4
4
|
import { openPptxZip } from './chunk-M4XLF4R7.mjs';
|
|
5
5
|
import { cloneSlide, cloneElement } from './chunk-54S5A5PZ.mjs';
|
|
6
6
|
|
|
@@ -1293,7 +1293,9 @@ var Presentation = class _Presentation {
|
|
|
1293
1293
|
data,
|
|
1294
1294
|
createSlide: (layoutName) => {
|
|
1295
1295
|
const slideNum = data.slides.length + 1;
|
|
1296
|
-
|
|
1296
|
+
const layouts = handler.getLayoutOptions();
|
|
1297
|
+
const layout = layouts.find((item) => item.name === layoutName) ?? layouts.find((item) => item.name === "Blank") ?? layouts[0];
|
|
1298
|
+
return new SlideBuilder(slideNum, layout?.path, layout?.name ?? layoutName, handler);
|
|
1297
1299
|
}
|
|
1298
1300
|
});
|
|
1299
1301
|
}
|
|
@@ -2397,194 +2399,6 @@ function addChartUserShapeGroupChild(element, groupPath, child) {
|
|
|
2397
2399
|
});
|
|
2398
2400
|
}
|
|
2399
2401
|
|
|
2400
|
-
// pptx/core/builders/sdk/layout-operations.ts
|
|
2401
|
-
var EMU_PER_PIXEL2 = 9525;
|
|
2402
|
-
function pxToEmu(px) {
|
|
2403
|
-
return Math.round(px * EMU_PER_PIXEL2);
|
|
2404
|
-
}
|
|
2405
|
-
function placeholderSpXml(ph, shapeId) {
|
|
2406
|
-
const name = ph.name ?? `${ph.type.charAt(0).toUpperCase() + ph.type.slice(1)} Placeholder ${shapeId - 1}`;
|
|
2407
|
-
const x = pxToEmu(ph.x);
|
|
2408
|
-
const y = pxToEmu(ph.y);
|
|
2409
|
-
const cx = pxToEmu(ph.width);
|
|
2410
|
-
const cy = pxToEmu(ph.height);
|
|
2411
|
-
const idxAttr = ph.idx !== void 0 ? ` idx="${Math.max(0, Math.round(ph.idx))}"` : "";
|
|
2412
|
-
return ` <p:sp>
|
|
2413
|
-
<p:nvSpPr>
|
|
2414
|
-
<p:cNvPr id="${shapeId}" name="${escAttr(name)}"/>
|
|
2415
|
-
<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
|
|
2416
|
-
<p:nvPr><p:ph type="${escAttr(ph.type)}"${idxAttr}/></p:nvPr>
|
|
2417
|
-
</p:nvSpPr>
|
|
2418
|
-
<p:spPr>
|
|
2419
|
-
<a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>
|
|
2420
|
-
</p:spPr>
|
|
2421
|
-
<p:txBody>
|
|
2422
|
-
<a:bodyPr/>
|
|
2423
|
-
<a:lstStyle/>
|
|
2424
|
-
<a:p><a:endParaRPr lang="en-US"/></a:p>
|
|
2425
|
-
</p:txBody>
|
|
2426
|
-
</p:sp>`;
|
|
2427
|
-
}
|
|
2428
|
-
function normalizeSrgbHex(color) {
|
|
2429
|
-
if (!color) {
|
|
2430
|
-
return void 0;
|
|
2431
|
-
}
|
|
2432
|
-
const raw = color.trim().replace(/^#/, "").toUpperCase();
|
|
2433
|
-
if (/^[0-9A-F]{6}$/.test(raw)) {
|
|
2434
|
-
return raw;
|
|
2435
|
-
}
|
|
2436
|
-
if (/^[0-9A-F]{3}$/.test(raw)) {
|
|
2437
|
-
return raw.replace(/./g, (ch) => ch + ch);
|
|
2438
|
-
}
|
|
2439
|
-
return void 0;
|
|
2440
|
-
}
|
|
2441
|
-
function generateLayoutXml(definition) {
|
|
2442
|
-
const layoutType = definition.type ?? "obj";
|
|
2443
|
-
const placeholders = definition.placeholders ?? [];
|
|
2444
|
-
const phShapes = placeholders.map((ph, i) => placeholderSpXml(ph, i + 2)).join("\n");
|
|
2445
|
-
let bgXml = "";
|
|
2446
|
-
const hex = normalizeSrgbHex(definition.backgroundColor);
|
|
2447
|
-
if (hex) {
|
|
2448
|
-
bgXml = ` <p:bg><p:bgPr><a:solidFill><a:srgbClr val="${hex}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>
|
|
2449
|
-
`;
|
|
2450
|
-
}
|
|
2451
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2452
|
-
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
2453
|
-
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
2454
|
-
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
2455
|
-
type="${escAttr(layoutType)}" preserve="1">
|
|
2456
|
-
<p:cSld name="${escAttr(definition.name)}">
|
|
2457
|
-
${bgXml} <p:spTree>
|
|
2458
|
-
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
2459
|
-
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
2460
|
-
${phShapes}
|
|
2461
|
-
</p:spTree>
|
|
2462
|
-
</p:cSld>
|
|
2463
|
-
<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
2464
|
-
</p:sldLayout>`;
|
|
2465
|
-
}
|
|
2466
|
-
function layoutRelsXml(masterIndex = 1) {
|
|
2467
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2468
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
2469
|
-
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster${masterIndex}.xml"/>
|
|
2470
|
-
</Relationships>`;
|
|
2471
|
-
}
|
|
2472
|
-
function countExistingLayouts(zip) {
|
|
2473
|
-
let count = 0;
|
|
2474
|
-
zip.forEach((relativePath) => {
|
|
2475
|
-
if (/^ppt\/slideLayouts\/slideLayout\d+\.xml$/.test(relativePath)) {
|
|
2476
|
-
count++;
|
|
2477
|
-
}
|
|
2478
|
-
});
|
|
2479
|
-
return count;
|
|
2480
|
-
}
|
|
2481
|
-
async function addLayoutToSlideMaster(zip, layoutIndex, masterIndex = 1) {
|
|
2482
|
-
const masterRelsPath = `ppt/slideMasters/_rels/slideMaster${masterIndex}.xml.rels`;
|
|
2483
|
-
const masterRelsContent = await zip.file(masterRelsPath)?.async("string");
|
|
2484
|
-
if (!masterRelsContent) {
|
|
2485
|
-
throw new Error(`Slide master rels not found at ${masterRelsPath}`);
|
|
2486
|
-
}
|
|
2487
|
-
const rIdMatches = [...masterRelsContent.matchAll(/rId(\d+)/g)];
|
|
2488
|
-
const maxRId = rIdMatches.reduce((max, m) => Math.max(max, parseInt(m[1], 10)), 0);
|
|
2489
|
-
const newRId = `rId${maxRId + 1}`;
|
|
2490
|
-
const newRel = ` <Relationship Id="${newRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout${layoutIndex}.xml"/>`;
|
|
2491
|
-
const updatedRels = masterRelsContent.replace("</Relationships>", `${newRel}
|
|
2492
|
-
</Relationships>`);
|
|
2493
|
-
zip.file(masterRelsPath, updatedRels);
|
|
2494
|
-
const masterPath = `ppt/slideMasters/slideMaster${masterIndex}.xml`;
|
|
2495
|
-
const masterContent = await zip.file(masterPath)?.async("string");
|
|
2496
|
-
if (!masterContent) {
|
|
2497
|
-
throw new Error(`Slide master not found at ${masterPath}`);
|
|
2498
|
-
}
|
|
2499
|
-
const idMatches = [...masterContent.matchAll(/sldLayoutId\s+id="(\d+)"/g)];
|
|
2500
|
-
const maxLayoutId = idMatches.reduce((max, m) => Math.max(max, parseInt(m[1], 10)), 2147483648);
|
|
2501
|
-
const newLayoutId = maxLayoutId + 1;
|
|
2502
|
-
const newLayoutIdEntry = ` <p:sldLayoutId id="${newLayoutId}" r:id="${newRId}"/>`;
|
|
2503
|
-
const updatedMaster = masterContent.replace(
|
|
2504
|
-
"</p:sldLayoutIdLst>",
|
|
2505
|
-
`${newLayoutIdEntry}
|
|
2506
|
-
</p:sldLayoutIdLst>`
|
|
2507
|
-
);
|
|
2508
|
-
zip.file(masterPath, updatedMaster);
|
|
2509
|
-
}
|
|
2510
|
-
async function addLayoutContentType(zip, layoutIndex) {
|
|
2511
|
-
const ctPath = "[Content_Types].xml";
|
|
2512
|
-
const ctContent = await zip.file(ctPath)?.async("string");
|
|
2513
|
-
if (!ctContent) {
|
|
2514
|
-
throw new Error("Content types file not found");
|
|
2515
|
-
}
|
|
2516
|
-
const override = ` <Override PartName="/ppt/slideLayouts/slideLayout${layoutIndex}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>`;
|
|
2517
|
-
const updatedCt = ctContent.replace("</Types>", `${override}
|
|
2518
|
-
</Types>`);
|
|
2519
|
-
zip.file(ctPath, updatedCt);
|
|
2520
|
-
}
|
|
2521
|
-
async function createLayout(handler, data, definition, masterIndex = 1) {
|
|
2522
|
-
const bytes = await handler.save(data.slides);
|
|
2523
|
-
const zip = await openPptxZip(bytes);
|
|
2524
|
-
const existingCount = countExistingLayouts(zip);
|
|
2525
|
-
const newIndex = existingCount + 1;
|
|
2526
|
-
const layoutPath = `ppt/slideLayouts/slideLayout${newIndex}.xml`;
|
|
2527
|
-
zip.file(layoutPath, generateLayoutXml(definition));
|
|
2528
|
-
zip.file(`ppt/slideLayouts/_rels/slideLayout${newIndex}.xml.rels`, layoutRelsXml(masterIndex));
|
|
2529
|
-
await addLayoutToSlideMaster(zip, newIndex, masterIndex);
|
|
2530
|
-
await addLayoutContentType(zip, newIndex);
|
|
2531
|
-
const updatedBuffer = await zip.generateAsync({ type: "arraybuffer" });
|
|
2532
|
-
const newHandler = new PptxHandler();
|
|
2533
|
-
const newData = await newHandler.load(updatedBuffer);
|
|
2534
|
-
return {
|
|
2535
|
-
layoutPath,
|
|
2536
|
-
layoutName: definition.name,
|
|
2537
|
-
handler: newHandler,
|
|
2538
|
-
data: newData
|
|
2539
|
-
};
|
|
2540
|
-
}
|
|
2541
|
-
async function createLayouts(handler, data, definitions, masterIndex = 1) {
|
|
2542
|
-
if (definitions.length === 0) {
|
|
2543
|
-
return { layoutPaths: [], handler, data };
|
|
2544
|
-
}
|
|
2545
|
-
const bytes = await handler.save(data.slides);
|
|
2546
|
-
const zip = await openPptxZip(bytes);
|
|
2547
|
-
const existingCount = countExistingLayouts(zip);
|
|
2548
|
-
const layoutPaths = [];
|
|
2549
|
-
for (let i = 0; i < definitions.length; i++) {
|
|
2550
|
-
const def = definitions[i];
|
|
2551
|
-
const newIndex = existingCount + i + 1;
|
|
2552
|
-
const layoutPath = `ppt/slideLayouts/slideLayout${newIndex}.xml`;
|
|
2553
|
-
zip.file(layoutPath, generateLayoutXml(def));
|
|
2554
|
-
zip.file(`ppt/slideLayouts/_rels/slideLayout${newIndex}.xml.rels`, layoutRelsXml(masterIndex));
|
|
2555
|
-
await addLayoutToSlideMaster(zip, newIndex, masterIndex);
|
|
2556
|
-
await addLayoutContentType(zip, newIndex);
|
|
2557
|
-
layoutPaths.push(layoutPath);
|
|
2558
|
-
}
|
|
2559
|
-
const updatedBuffer = await zip.generateAsync({ type: "arraybuffer" });
|
|
2560
|
-
const newHandler = new PptxHandler();
|
|
2561
|
-
const newData = await newHandler.load(updatedBuffer);
|
|
2562
|
-
return { layoutPaths, handler: newHandler, data: newData };
|
|
2563
|
-
}
|
|
2564
|
-
function findLayoutByName(data, name) {
|
|
2565
|
-
const lowerName = name.toLowerCase();
|
|
2566
|
-
const fromOptions = data.layoutOptions?.find((l) => l.name.toLowerCase() === lowerName);
|
|
2567
|
-
if (fromOptions) {
|
|
2568
|
-
return fromOptions;
|
|
2569
|
-
}
|
|
2570
|
-
if (data.slideMasters) {
|
|
2571
|
-
for (const master of data.slideMasters) {
|
|
2572
|
-
const layout = master.layouts?.find((l) => l.name?.toLowerCase() === lowerName);
|
|
2573
|
-
if (layout) {
|
|
2574
|
-
return { path: layout.path, name: layout.name ?? name };
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
}
|
|
2578
|
-
return void 0;
|
|
2579
|
-
}
|
|
2580
|
-
function findLayoutByType(data, type) {
|
|
2581
|
-
const fromOptions = data.layoutOptions?.find((l) => l.type === type);
|
|
2582
|
-
if (fromOptions) {
|
|
2583
|
-
return fromOptions;
|
|
2584
|
-
}
|
|
2585
|
-
return void 0;
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
2402
|
// pptx/core/builders/sdk/master-layout-crud-lookup.ts
|
|
2589
2403
|
var NOT_FOUND = { ok: false, reason: "notFound" };
|
|
2590
2404
|
function findMaster(data, masterId) {
|
|
@@ -14957,7 +14771,7 @@ async function setPresentationRunText(bytes, slideIndex, elementId, runIndex, te
|
|
|
14957
14771
|
async function createPresentationFromOutline(slides, options = {}) {
|
|
14958
14772
|
if (!(slides instanceof Array) || !slides.length || slides.length > 200)
|
|
14959
14773
|
throw new Error("A presentation outline has 1 to 200 slides");
|
|
14960
|
-
const { PresentationBuilder: PresentationBuilder2 } = await import('./PresentationBuilder-
|
|
14774
|
+
const { PresentationBuilder: PresentationBuilder2 } = await import('./PresentationBuilder-EYI6Z2JP.mjs');
|
|
14961
14775
|
const { handler, data, createSlide } = await PresentationBuilder2.create({
|
|
14962
14776
|
...options.title ? { title: options.title } : {}
|
|
14963
14777
|
});
|
|
@@ -14993,4 +14807,4 @@ async function createPresentationFromOutline(slides, options = {}) {
|
|
|
14993
14807
|
return handler.save(data.slides);
|
|
14994
14808
|
}
|
|
14995
14809
|
|
|
14996
|
-
export { ChartBuilder, ConnectorBuilder, GroupBuilder, ImageBuilder, MediaBuilder, OPENXML_COVERAGE, OPENXML_SCHEMA_CONSTRUCT_IDS, OPENXML_STRICT_SCHEMA_CONSTRUCT_IDS, OPENXML_TRANSITIONAL_SCHEMA_CONSTRUCT_IDS, Presentation, SLIDE_PACKAGE_CLIPBOARD_MIME, ShapeBuilder, SlideSizes, THEME_PRESETS, TRANSITION_PATTERN_OPTIONS, TRANSITION_THRUBLK_TYPES, TRANSITION_VALID_DIRECTIONS, TableBuilder, TextBuilder, ThemePresets, addChartUserShape, addChartUserShapeGroupChild, addSection, applyTemplate, chartFormatTargetSupports, chartSupportsSecondaryAxis, cm, cmToEmu, collectLayoutNames, collectMasterNames,
|
|
14810
|
+
export { ChartBuilder, ConnectorBuilder, GroupBuilder, ImageBuilder, MediaBuilder, OPENXML_COVERAGE, OPENXML_SCHEMA_CONSTRUCT_IDS, OPENXML_STRICT_SCHEMA_CONSTRUCT_IDS, OPENXML_TRANSITIONAL_SCHEMA_CONSTRUCT_IDS, Presentation, SLIDE_PACKAGE_CLIPBOARD_MIME, ShapeBuilder, SlideSizes, THEME_PRESETS, TRANSITION_PATTERN_OPTIONS, TRANSITION_THRUBLK_TYPES, TRANSITION_VALID_DIRECTIONS, TableBuilder, TextBuilder, ThemePresets, addChartUserShape, addChartUserShapeGroupChild, addSection, applyTemplate, chartFormatTargetSupports, chartSupportsSecondaryAxis, cm, cmToEmu, collectLayoutNames, collectMasterNames, createPresentationFromOutline, createSlideClipboardPackage, deleteLayout, deleteSlideMaster, deserializeSlidePackageClipboard, diffPresentations, diffSlides, duplicateElement, duplicateLayout, duplicateSlide, duplicateSlideMaster, emuToPixels, findOpenXmlCoverage, findPlaceholders, getChartUserShapeAtPath, getSectionForSlide, getThemePreset, importSlidePackage, inches, inchesToEmu, insertLayout, insertSlideMaster, inspectPresentationText, interpolateShapeGeometry, isChartSeriesOnSecondaryAxis, listChartUserShapes, listUnassessedOpenXmlCoverage, mailMerge, mm, moveSlidesToSection, parseSvgPath, pixelsToEmu, pt, readChartElementFormat, removeChartUserShape, removeChartUserShapeAtPath, removeSection, renameLayout, renameSlideMaster, reorderSections, replaceShapeGeometry, replaceWithCustomGeometry, resetChartElementFormat, resetCloneIdCounter, resetSectionIdCounter, serializeSlidePackageClipboard, serializeSvgPath, setChartColorMapOverride, setChartDataPointGradient, setChartDataPointStyle, setChartHelperLine, setChartSeriesGradient, setElementLocked, setPresentationRunText, summarizeOpenXmlCoverage, summarizeOpenXmlCoverageByVocabulary, uniqueDisplayName, uniquePrefixedName, updateChartUserShape, updateChartUserShapeAtPath, withChartAxisOptions, withChartDataLabelOptions, withChartElementFormat, withChartLegendOptions, withChartSeriesOnSecondaryAxis, withChartSeriesOptions };
|