@shbernal/ts-pptx 0.0.1
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 +22 -0
- package/README.md +238 -0
- package/dist/autopage-tmfjRzL4.js +420 -0
- package/dist/autopage-tmfjRzL4.js.map +1 -0
- package/dist/browser.d.ts +23 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +103 -0
- package/dist/browser.js.map +1 -0
- package/dist/diagnostics-DYQC7xLV.js +0 -0
- package/dist/diagnostics-DYQC7xLV.js.map +1 -0
- package/dist/diagnostics-DzY9Tyfm.d.ts +693 -0
- package/dist/diagnostics-DzY9Tyfm.d.ts.map +1 -0
- package/dist/embedded-fonts-MaynAHa9.js +94 -0
- package/dist/embedded-fonts-MaynAHa9.js.map +1 -0
- package/dist/enums-D3aF4QGb.d.ts +452 -0
- package/dist/enums-D3aF4QGb.d.ts.map +1 -0
- package/dist/errors-DGE9zh3U.js +93 -0
- package/dist/errors-DGE9zh3U.js.map +1 -0
- package/dist/errors-DRLpOpgQ.d.ts +160 -0
- package/dist/errors-DRLpOpgQ.d.ts.map +1 -0
- package/dist/fit-CbxyHN69.js +0 -0
- package/dist/fit-CbxyHN69.js.map +1 -0
- package/dist/html-dom-wVa3TiG7.js +666 -0
- package/dist/html-dom-wVa3TiG7.js.map +1 -0
- package/dist/html.d.ts +26 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.js +60 -0
- package/dist/html.js.map +1 -0
- package/dist/image-size-C5Z1sKof.js +252 -0
- package/dist/image-size-C5Z1sKof.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect.d.ts +173 -0
- package/dist/inspect.d.ts.map +1 -0
- package/dist/inspect.js +285 -0
- package/dist/inspect.js.map +1 -0
- package/dist/math.d.ts +37 -0
- package/dist/math.d.ts.map +1 -0
- package/dist/math.js +106 -0
- package/dist/math.js.map +1 -0
- package/dist/measure.d.ts +223 -0
- package/dist/measure.d.ts.map +1 -0
- package/dist/measure.js +3 -0
- package/dist/node.d.ts +12 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +60 -0
- package/dist/node.js.map +1 -0
- package/dist/package-CaOLXSNi.d.ts +193 -0
- package/dist/package-CaOLXSNi.d.ts.map +1 -0
- package/dist/pres-5x1bjCzk.d.ts +202 -0
- package/dist/pres-5x1bjCzk.d.ts.map +1 -0
- package/dist/presentation-B0JWdTN1.js +4286 -0
- package/dist/presentation-B0JWdTN1.js.map +1 -0
- package/dist/presentation-RGOiun5P.d.ts +3249 -0
- package/dist/presentation-RGOiun5P.d.ts.map +1 -0
- package/dist/presentation-types-BVw0EknS.d.ts +538 -0
- package/dist/presentation-types-BVw0EknS.d.ts.map +1 -0
- package/dist/read.d.ts +73 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +4 -0
- package/dist/script.d.ts +553 -0
- package/dist/script.d.ts.map +1 -0
- package/dist/script.js +0 -0
- package/dist/script.js.map +1 -0
- package/dist/shapes-BZU8UTW2.js +5365 -0
- package/dist/shapes-BZU8UTW2.js.map +1 -0
- package/dist/slide-B6mDaM-P.d.ts +3396 -0
- package/dist/slide-B6mDaM-P.d.ts.map +1 -0
- package/dist/text-WRUbOy2r.js +11238 -0
- package/dist/text-WRUbOy2r.js.map +1 -0
- package/dist/units-B-JUKwCS.js +144 -0
- package/dist/units-B-JUKwCS.js.map +1 -0
- package/dist/units-internal-7JcMfYti.js +723 -0
- package/dist/units-internal-7JcMfYti.js.map +1 -0
- package/dist/zip.d.ts +68 -0
- package/dist/zip.d.ts.map +1 -0
- package/dist/zip.js +163 -0
- package/dist/zip.js.map +1 -0
- package/package.json +214 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { Document, Element } from "@xmldom/xmldom";
|
|
2
|
+
//#region src/read/opc/content-types.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Overlay over `[Content_Types].xml`, used to resolve part content types at
|
|
5
|
+
* load and to register new ones when parts are added. While clean, the original
|
|
6
|
+
* bytes pass through verbatim on save (byte-identical); once a mutation marks it
|
|
7
|
+
* dirty, `OpcPackage.save()` writes `serialize()` instead.
|
|
8
|
+
*/
|
|
9
|
+
declare class ContentTypes {
|
|
10
|
+
#private;
|
|
11
|
+
static parse(xml: string): ContentTypes;
|
|
12
|
+
/** Exact `Override` match first, else `Default` by lowercased extension. */
|
|
13
|
+
contentTypeFor(partName: string): string | undefined;
|
|
14
|
+
/** True once a registration changed the overlay; `serialize()` is then authoritative. */
|
|
15
|
+
get isDirty(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Ensure `partName` resolves to `contentType`, adding the minimum needed.
|
|
18
|
+
* A no-op when an existing `Default`/`Override` already resolves it to the
|
|
19
|
+
* same type; otherwise an `Override` is added (always valid, never conflicts
|
|
20
|
+
* with a differing `Default`).
|
|
21
|
+
*/
|
|
22
|
+
ensureRegistered(partName: string, contentType: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Drop the `Override` for `partName` if present (e.g. when a part is removed).
|
|
25
|
+
* `Default` rules by extension are left untouched — they may still serve other
|
|
26
|
+
* parts. Marks the overlay dirty when something was removed.
|
|
27
|
+
*/
|
|
28
|
+
removeOverride(partName: string): void;
|
|
29
|
+
/** Register a `Default` content type for a (lowercased) extension if absent. */
|
|
30
|
+
ensureDefault(extension: string, contentType: string): void;
|
|
31
|
+
serialize(): string;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/read/opc/part.d.ts
|
|
35
|
+
/**
|
|
36
|
+
* One OPC part. Holds the original bytes from the zip for its whole life;
|
|
37
|
+
* parses to a DOM only on demand; serializes back to the original bytes
|
|
38
|
+
* unless something mutated the DOM and called `markDirty()`.
|
|
39
|
+
*
|
|
40
|
+
* Untouched parts therefore round-trip byte-identically.
|
|
41
|
+
*/
|
|
42
|
+
declare class Part {
|
|
43
|
+
#private;
|
|
44
|
+
readonly partName: string;
|
|
45
|
+
readonly contentType: string;
|
|
46
|
+
constructor(partName: string, contentType: string, bytes: Uint8Array);
|
|
47
|
+
/** Whether this part's body is XML (by content type). */
|
|
48
|
+
get isXmlPart(): boolean;
|
|
49
|
+
/** True once the body has been materialized as a DOM. */
|
|
50
|
+
get isParsed(): boolean;
|
|
51
|
+
/** The original bytes from the package. Do not mutate. */
|
|
52
|
+
get bytes(): Uint8Array;
|
|
53
|
+
/**
|
|
54
|
+
* Lazily parsed DOM for XML parts. Parsing alone does not mark the part
|
|
55
|
+
* dirty; call `markDirty()` after mutating the tree.
|
|
56
|
+
*/
|
|
57
|
+
get dom(): Document;
|
|
58
|
+
/** Call after mutating the DOM so `serialize()` reserializes this part. */
|
|
59
|
+
markDirty(): void;
|
|
60
|
+
get isDirty(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Bytes to write on save: the original bytes when clean (byte-identical),
|
|
63
|
+
* the serialized DOM when dirty (semantically equivalent, schema-valid).
|
|
64
|
+
*/
|
|
65
|
+
serialize(): Uint8Array;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/read/opc/relationships.d.ts
|
|
69
|
+
interface Relationship {
|
|
70
|
+
id: string;
|
|
71
|
+
type: string;
|
|
72
|
+
target: string;
|
|
73
|
+
targetMode?: 'Internal' | 'External';
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Overlay over one `.rels` part, keyed by relationship id. While clean, the
|
|
77
|
+
* `.rels` bytes pass through verbatim on save (byte-identical); once `add()`
|
|
78
|
+
* (or another mutation) marks it dirty, `OpcPackage.save()` writes
|
|
79
|
+
* `serialize()` into the owning `.rels` part instead.
|
|
80
|
+
*/
|
|
81
|
+
declare class Relationships {
|
|
82
|
+
#private;
|
|
83
|
+
/** Partname of the part owning these relationships ('/' for package-level). */
|
|
84
|
+
readonly sourcePartName: string;
|
|
85
|
+
private constructor();
|
|
86
|
+
/**
|
|
87
|
+
* @param xml body of the `.rels` part
|
|
88
|
+
* @param sourcePartName partname of the owning part ('/' for `/_rels/.rels`)
|
|
89
|
+
*/
|
|
90
|
+
static parse(xml: string, sourcePartName: string): Relationships;
|
|
91
|
+
/** Empty relationship set (for parts that have no `.rels`). */
|
|
92
|
+
static empty(sourcePartName: string): Relationships;
|
|
93
|
+
get size(): number;
|
|
94
|
+
/** True once a relationship was added/changed; `serialize()` is then authoritative. */
|
|
95
|
+
get isDirty(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Add a relationship and return it. Allocates an id `rId<n>` with `n` one
|
|
98
|
+
* past the highest existing numeric id. `target` is relative to the source
|
|
99
|
+
* part's directory for internal targets (e.g. `../media/image1.png`), or an
|
|
100
|
+
* absolute URI for external ones. Marks this set dirty.
|
|
101
|
+
*/
|
|
102
|
+
add(type: string, target: string, targetMode?: 'Internal' | 'External'): Relationship;
|
|
103
|
+
/**
|
|
104
|
+
* Add a relationship under a caller-chosen id and return it. Used when
|
|
105
|
+
* rebuilding a copied part's relationships across a package boundary: keeping
|
|
106
|
+
* each source id lets the copied part body's `r:id`/`r:embed` references stay
|
|
107
|
+
* valid without rewriting the body. Throws if the id is already present.
|
|
108
|
+
* Marks this set dirty.
|
|
109
|
+
*/
|
|
110
|
+
addWithId(id: string, type: string, target: string, targetMode?: 'Internal' | 'External'): Relationship;
|
|
111
|
+
/**
|
|
112
|
+
* Remove the relationship with `id` and return whether one was present. Used
|
|
113
|
+
* when a referenced part is deleted (e.g. removing a slide drops the
|
|
114
|
+
* presentation→slide relationship). Marks this set dirty when it removes one.
|
|
115
|
+
*/
|
|
116
|
+
remove(id: string): boolean;
|
|
117
|
+
get(id: string): Relationship | undefined;
|
|
118
|
+
byType(type: string): Relationship[];
|
|
119
|
+
[Symbol.iterator](): IterableIterator<Relationship>;
|
|
120
|
+
/** Resolve an internal relationship's target to an absolute partname. */
|
|
121
|
+
resolveTarget(id: string): string;
|
|
122
|
+
serialize(): string;
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/read/opc/package.d.ts
|
|
126
|
+
/**
|
|
127
|
+
* Input to {@link OpcPackage.load}. A `string` is a **filesystem path** (Node)
|
|
128
|
+
* read from disk; pass `Uint8Array`/`ArrayBuffer`/`Blob`/`number[]` for an
|
|
129
|
+
* in-memory archive. (A string is a path, not JSZip's latin1 binary content.)
|
|
130
|
+
*/
|
|
131
|
+
type OpcInput = string | number[] | Uint8Array | ArrayBuffer | Blob;
|
|
132
|
+
/**
|
|
133
|
+
* An OPC package loaded from `.pptx` bytes.
|
|
134
|
+
*
|
|
135
|
+
* Fidelity contract: parts that are never mutated (`Part.markDirty()`) are
|
|
136
|
+
* written back byte-identically by `save()`. Whole-zip byte-identity is not
|
|
137
|
+
* promised — zip metadata and compression may differ — but part bodies, the
|
|
138
|
+
* part-name set, and part order are preserved.
|
|
139
|
+
*/
|
|
140
|
+
declare class OpcPackage {
|
|
141
|
+
#private;
|
|
142
|
+
/** Content-type resolution + registration overlay. */
|
|
143
|
+
readonly contentTypes: ContentTypes;
|
|
144
|
+
private constructor();
|
|
145
|
+
/** All parts, keyed by partname, in zip/add order. */
|
|
146
|
+
get parts(): ReadonlyMap<string, Part>;
|
|
147
|
+
static load(input: OpcInput): Promise<OpcPackage>;
|
|
148
|
+
part(partName: string): Part | undefined;
|
|
149
|
+
partsByContentType(contentType: string): Part[];
|
|
150
|
+
/**
|
|
151
|
+
* Relationships owned by a part ('/' for the package-level
|
|
152
|
+
* `/_rels/.rels`). Parts without a `.rels` part get an empty set.
|
|
153
|
+
*/
|
|
154
|
+
relationshipsFor(sourcePartName?: string): Relationships;
|
|
155
|
+
/**
|
|
156
|
+
* Add a new part and register its content type (`ensureRegistered`), so the
|
|
157
|
+
* package stays consistent. Throws if the partname is already taken.
|
|
158
|
+
*/
|
|
159
|
+
addPart(partName: string, contentType: string, bytes: Uint8Array): Part;
|
|
160
|
+
/**
|
|
161
|
+
* Remove a part and return whether it existed. Drops its `Override` content-type
|
|
162
|
+
* registration and any cached relationship set it owned, so a later `save()`
|
|
163
|
+
* neither re-emits it nor flushes a stale `.rels` for it. Low-level: it does not
|
|
164
|
+
* touch references *to* this part (dangling rels are the caller's concern) nor
|
|
165
|
+
* cascade to parts this one referenced — see {@link Presentation.removeSlide}
|
|
166
|
+
* for the slide-aware variant that unwires the presentation and prunes orphans.
|
|
167
|
+
*/
|
|
168
|
+
removePart(partName: string): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Reserve an unused media partname `/ppt/media/<base><n>.<ext>` (n one past
|
|
171
|
+
* the highest existing index for that base). Does not create the part.
|
|
172
|
+
*/
|
|
173
|
+
reserveMediaPartName(extension: string, base?: string): string;
|
|
174
|
+
/**
|
|
175
|
+
* Reserve an unused partname in the same directory and naming family as
|
|
176
|
+
* `templatePartName`, with a fresh index one past the highest existing one.
|
|
177
|
+
* The template's filename is split into a base (its stem minus any trailing
|
|
178
|
+
* digits) and an extension, e.g. `/ppt/slideLayouts/slideLayout1.xml` →
|
|
179
|
+
* `/ppt/slideLayouts/slideLayout<n>.xml`, `/ppt/media/image1.png` →
|
|
180
|
+
* `/ppt/media/image<n>.png`. Used when copying a part in from another package.
|
|
181
|
+
* Does not create the part.
|
|
182
|
+
*/
|
|
183
|
+
reservePartNameLike(templatePartName: string): string;
|
|
184
|
+
/**
|
|
185
|
+
* Re-emit the package. Clean parts are written from their original bytes;
|
|
186
|
+
* dirty parts from their DOM. Dirty relationship sets and content types are
|
|
187
|
+
* flushed first. Part order is preserved from load; added parts append.
|
|
188
|
+
*/
|
|
189
|
+
save(): Promise<Uint8Array>;
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
export { Part as a, Relationships as i, OpcPackage as n, Element as o, Relationship as r, ContentTypes as s, OpcInput as t };
|
|
193
|
+
//# sourceMappingURL=package-CaOLXSNi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-CaOLXSNi.d.ts","names":[],"sources":["../src/read/opc/content-types.ts","../src/read/opc/part.ts","../src/read/opc/relationships.ts","../src/read/opc/package.ts"],"mappings":";;;;;;;;cAUa;;SAKL,MAAM,cAAc;;EAgC3B,eAAe;;MAKX;;;;;;;EAUJ,iBAAiB,kBAAkB;;;;;;EAWnC,eAAe;;EAKf,cAAc,mBAAmB;EAOjC;;;;;;;;;;;cCtEY;;WACH;WACA;EAKG,YAAA,kBAAkB,qBAAqB,OAAO;;MAOtD;;MAOA;;MAKA,SAAS;;;;;MAQT,OAAO;;EAWX;MASI;;;;;EAQJ,aAAa;;;;UCzEG;EAChB;EACA;EACA;EACA;;;;;;;;cASY;;;WAEH;UAIF;;;;;SAQA,MAAM,aAAa,yBAAyB;;SAuC5C,MAAM,yBAAyB;MAIlC;;MAKA;;;;;;;EAUJ,IAAI,cAAc,gBAAgB,uCAAuC;;;;;;;;EAqBzE,UAAU,YAAY,cAAc,gBAAgB,uCAAuC;;;;;;EAkB3F,OAAO;EAMP,IAAI,aAAa;EAIjB,OAAO,eAAe;GAIrB,OAAO,aAAa,iBAAiB;;EAKtC,cAAc;EAgBd;;;;;;;;;KCvJW,+BAA+B,aAAa,cAAc;;;;;;;;;cAgBzD;;;WAIH,cAAc;UAIhB;;MAOH,SAAS,oBAAoB;SAIpB,KAAK,OAAO,WAAW,QAAQ;EA4B5C,KAAK,mBAAmB;EAIxB,mBAAmB,sBAAsB;;;;;EAQzC,iBAAiB,0BAAuB;;;;;EAexC,QAAQ,kBAAkB,qBAAqB,OAAO,aAAa;;;;;;;;;EAoBnE,WAAW;;;;;EAYX,qBAAqB,mBAAmB;;;;;;;;;;EAoBxC,oBAAoB;;;;;;EAuBd,QAAQ,QAAQ"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { y as WRITE_OUTPUT_TYPE } from "./enums-D3aF4QGb.js";
|
|
2
|
+
import { Z as HexColor, a as Slide } from "./slide-B6mDaM-P.js";
|
|
3
|
+
//#region src/types/theme.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Theme color scheme overrides. Each slot maps to one `<a:clrScheme>` entry in `theme1.xml`;
|
|
6
|
+
* any slot left unset keeps the default Office value. Provide 6-digit hex (no `#`).
|
|
7
|
+
*
|
|
8
|
+
* Slot names use the OOXML scheme names. The PowerPoint UI labels them as:
|
|
9
|
+
* `dk1`=Text/Dark 1, `lt1`=Background/Light 1, `dk2`=Text/Dark 2, `lt2`=Background/Light 2,
|
|
10
|
+
* `accent1`-`accent6`=Accent 1-6, `hlink`=Hyperlink, `folHlink`=Followed Hyperlink.
|
|
11
|
+
* @example { accent1: 'C00000', dk2: '1F3864', hlink: '0070C0' }
|
|
12
|
+
*/
|
|
13
|
+
interface ThemeColorScheme {
|
|
14
|
+
/** Text/Dark 1 (default Office: black via `windowText`) */
|
|
15
|
+
dk1?: HexColor;
|
|
16
|
+
/** Background/Light 1 (default Office: white via `window`) */
|
|
17
|
+
lt1?: HexColor;
|
|
18
|
+
/** Text/Dark 2 (default Office: `44546A`) */
|
|
19
|
+
dk2?: HexColor;
|
|
20
|
+
/** Background/Light 2 (default Office: `E7E6E6`) */
|
|
21
|
+
lt2?: HexColor;
|
|
22
|
+
/** Accent 1 (default Office: `4472C4`) */
|
|
23
|
+
accent1?: HexColor;
|
|
24
|
+
/** Accent 2 (default Office: `ED7D31`) */
|
|
25
|
+
accent2?: HexColor;
|
|
26
|
+
/** Accent 3 (default Office: `A5A5A5`) */
|
|
27
|
+
accent3?: HexColor;
|
|
28
|
+
/** Accent 4 (default Office: `FFC000`) */
|
|
29
|
+
accent4?: HexColor;
|
|
30
|
+
/** Accent 5 (default Office: `5B9BD5`) */
|
|
31
|
+
accent5?: HexColor;
|
|
32
|
+
/** Accent 6 (default Office: `70AD47`) */
|
|
33
|
+
accent6?: HexColor;
|
|
34
|
+
/** Hyperlink (default Office: `0563C1`) */
|
|
35
|
+
hlink?: HexColor;
|
|
36
|
+
/** Followed Hyperlink (default Office: `954F72`) */
|
|
37
|
+
folHlink?: HexColor;
|
|
38
|
+
}
|
|
39
|
+
interface ThemeProps {
|
|
40
|
+
/**
|
|
41
|
+
* Headings font face name
|
|
42
|
+
* @example 'Arial Narrow'
|
|
43
|
+
* @default 'Calibri Light'
|
|
44
|
+
*/
|
|
45
|
+
headFontFace?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Body font face name
|
|
48
|
+
* @example 'Arial'
|
|
49
|
+
* @default 'Calibri'
|
|
50
|
+
*/
|
|
51
|
+
bodyFontFace?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Headings East Asian font face — theme `<a:ea>` slot of the major font.
|
|
54
|
+
* Used for CJK (Chinese/Japanese/Korean) runs that fall back to the theme font.
|
|
55
|
+
* - leave unset to keep PowerPoint's empty default (auto-resolved per script)
|
|
56
|
+
* @example 'Yu Gothic'
|
|
57
|
+
*/
|
|
58
|
+
headFontFaceEA?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Body East Asian font face — theme `<a:ea>` slot of the minor font.
|
|
61
|
+
* Used for CJK (Chinese/Japanese/Korean) runs that fall back to the theme font.
|
|
62
|
+
* - leave unset to keep PowerPoint's empty default (auto-resolved per script)
|
|
63
|
+
* @example 'Yu Gothic'
|
|
64
|
+
*/
|
|
65
|
+
bodyFontFaceEA?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Headings complex-script font face — theme `<a:cs>` slot of the major font.
|
|
68
|
+
* Used for complex scripts such as Arabic, Hebrew, Thai, and Devanagari.
|
|
69
|
+
* - leave unset to keep PowerPoint's empty default (auto-resolved per script)
|
|
70
|
+
* @example 'Arial'
|
|
71
|
+
*/
|
|
72
|
+
headFontFaceCS?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Body complex-script font face — theme `<a:cs>` slot of the minor font.
|
|
75
|
+
* Used for complex scripts such as Arabic, Hebrew, Thai, and Devanagari.
|
|
76
|
+
* - leave unset to keep PowerPoint's empty default (auto-resolved per script)
|
|
77
|
+
* @example 'Arial'
|
|
78
|
+
*/
|
|
79
|
+
bodyFontFaceCS?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Theme color scheme overrides written to `ppt/theme/theme1.xml`.
|
|
82
|
+
* - any unset slot keeps its default Office value
|
|
83
|
+
* - references such as `SchemeColor.accent1` resolve against these values
|
|
84
|
+
* @example { accent1: 'C00000', accent2: '00B050', hlink: '0070C0' }
|
|
85
|
+
*/
|
|
86
|
+
colorScheme?: ThemeColorScheme;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/types/pres.d.ts
|
|
90
|
+
interface WriteBaseProps {
|
|
91
|
+
/**
|
|
92
|
+
* Whether to DEFLATE-compress the package (PowerPoint itself always compresses;
|
|
93
|
+
* set `false` only if export time matters more than file size)
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
compression?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* How to handle a media asset (image/audio/video) that fails to load during export.
|
|
99
|
+
* - `'throw'` (default): reject the export with an error naming the failing asset. A deck
|
|
100
|
+
* that silently embeds a broken-image placeholder is a degenerate result, so failing
|
|
101
|
+
* loudly is the safe default.
|
|
102
|
+
* - `'placeholder'`: substitute a broken-image placeholder, emit a `media/load-failed`
|
|
103
|
+
* diagnostic (see `setDiagnosticHandler`), and
|
|
104
|
+
* continue. Useful for best-effort/batch jobs where one missing asset should not abort
|
|
105
|
+
* the whole deck.
|
|
106
|
+
* @default 'throw'
|
|
107
|
+
*/
|
|
108
|
+
onMediaError?: 'throw' | 'placeholder';
|
|
109
|
+
}
|
|
110
|
+
interface WriteProps extends WriteBaseProps {
|
|
111
|
+
/**
|
|
112
|
+
* Output type
|
|
113
|
+
* - values: 'arraybuffer' | 'base64' | 'binarystring' | 'blob' | 'nodebuffer' | 'uint8array' | 'STREAM'
|
|
114
|
+
* @default 'blob'
|
|
115
|
+
*/
|
|
116
|
+
outputType?: WRITE_OUTPUT_TYPE;
|
|
117
|
+
}
|
|
118
|
+
interface WriteFileProps extends WriteBaseProps {
|
|
119
|
+
/**
|
|
120
|
+
* Export file name
|
|
121
|
+
* @default 'Presentation.pptx'
|
|
122
|
+
*/
|
|
123
|
+
fileName?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* One emitted OOXML package part: its full slash-path and already-encoded bytes. Returned by
|
|
127
|
+
* {@link TsPptx.toParts} for callers that want the raw parts of the `.pptx` OPC package without
|
|
128
|
+
* zipping (custom containers, streaming, part-level inspection). The bytes are byte-identical to
|
|
129
|
+
* what `write()` would compress for the same part;
|
|
130
|
+
* XML parts are UTF-8 (decode with `new TextDecoder().decode(part.data)`), media/font parts are
|
|
131
|
+
* their raw binary.
|
|
132
|
+
*/
|
|
133
|
+
interface PackagePart {
|
|
134
|
+
/** Full OOXML package part path, e.g. `ppt/slides/slide1.xml`. */
|
|
135
|
+
readonly path: string;
|
|
136
|
+
/** The part's already-encoded bytes: a fresh view per call, safe to keep or transfer. */
|
|
137
|
+
readonly data: Uint8Array;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Options for {@link TsPptx.toParts}. A deliberately narrow subset of {@link WriteProps}:
|
|
141
|
+
* `compression` and `outputType` are zip concerns and do not apply when parts are returned
|
|
142
|
+
* unzipped, so only media-error handling is exposed.
|
|
143
|
+
*/
|
|
144
|
+
interface PartsProps {
|
|
145
|
+
/**
|
|
146
|
+
* How to handle a media asset (image/audio/video) that fails to load. Same semantics as
|
|
147
|
+
* {@link WriteBaseProps.onMediaError}.
|
|
148
|
+
* @default 'throw'
|
|
149
|
+
*/
|
|
150
|
+
onMediaError?: 'throw' | 'placeholder';
|
|
151
|
+
}
|
|
152
|
+
interface SectionProps {
|
|
153
|
+
/**
|
|
154
|
+
* Section title
|
|
155
|
+
*/
|
|
156
|
+
title: string;
|
|
157
|
+
/**
|
|
158
|
+
* Section order - uses to add section at any index
|
|
159
|
+
* - values: 1-n
|
|
160
|
+
*/
|
|
161
|
+
order?: number;
|
|
162
|
+
}
|
|
163
|
+
interface PresLayout {
|
|
164
|
+
_sizeW?: number;
|
|
165
|
+
_sizeH?: number;
|
|
166
|
+
/**
|
|
167
|
+
* Layout Name
|
|
168
|
+
* @example 'LAYOUT_WIDE'
|
|
169
|
+
*/
|
|
170
|
+
name: string;
|
|
171
|
+
width: number;
|
|
172
|
+
height: number;
|
|
173
|
+
}
|
|
174
|
+
type CustomPropertyValue = string | number | boolean | Date;
|
|
175
|
+
interface PresentationProps {
|
|
176
|
+
author: string;
|
|
177
|
+
company: string;
|
|
178
|
+
layout: string;
|
|
179
|
+
masterSlide: Slide;
|
|
180
|
+
/**
|
|
181
|
+
* Presentation's layout
|
|
182
|
+
* read-only
|
|
183
|
+
*/
|
|
184
|
+
presLayout: PresLayout;
|
|
185
|
+
revision: string;
|
|
186
|
+
/**
|
|
187
|
+
* Slide number to assign to the first slide (affects the slide-number field displayed in placeholders).
|
|
188
|
+
* @default 1
|
|
189
|
+
*/
|
|
190
|
+
firstSlideNum: number;
|
|
191
|
+
/**
|
|
192
|
+
* Whether to enable right-to-left mode
|
|
193
|
+
* @default false
|
|
194
|
+
*/
|
|
195
|
+
rtlMode: boolean;
|
|
196
|
+
subject: string;
|
|
197
|
+
theme: ThemeProps;
|
|
198
|
+
title: string;
|
|
199
|
+
}
|
|
200
|
+
//#endregion
|
|
201
|
+
export { PresentationProps as a, WriteFileProps as c, ThemeProps as d, PresLayout as i, WriteProps as l, PackagePart as n, SectionProps as o, PartsProps as r, WriteBaseProps as s, CustomPropertyValue as t, ThemeColorScheme as u };
|
|
202
|
+
//# sourceMappingURL=pres-5x1bjCzk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pres-5x1bjCzk.d.ts","names":[],"sources":["../src/types/theme.ts","../src/types/pres.ts"],"mappings":";;;;;;;;;;;;UAgBiB;;EAEhB,MAAM;;EAEN,MAAM;;EAEN,MAAM;;EAEN,MAAM;;EAEN,UAAU;;EAEV,UAAU;;EAEV,UAAU;;EAEV,UAAU;;EAEV,UAAU;;EAEV,UAAU;;EAEV,QAAQ;;EAER,WAAW;;UAEK;;;;;;EAMhB;;;;;;EAMA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;EAOA,cAAc;;;;UC/EE;;;;;;EAMhB;;;;;;;;;;;;EAYA;;UAEgB,mBAAmB;;;;;;EAMnC,aAAa;;UAEG,uBAAuB;;;;;EAKvC;;;;;;;;;;UAUgB;;WAEP;;WAEA,MAAM;;;;;;;UAOC;;;;;;EAMhB;;UAEgB;;;;EAIhB;;;;;EAKA;;UAEgB;EAChB;EACA;;;;;EAMA;EACA;EACA;;KAEW,kDAAkD;UAE7C;EAChB;EACA;EACA;EACA,aAAa;;;;;EAKb,YAAY;EACZ;;;;;EAKA;;;;;EAKA;EACA;EACA,OAAO;EACP"}
|