@shbernal/ts-pptx 4.0.1 → 4.2.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 +147 -114
- package/dist/anim-presets-Qbgh8uut.js +55 -0
- package/dist/anim-presets-Qbgh8uut.js.map +1 -0
- package/dist/{autopage-odPz7zZO.js → autopage-DqZ37VpL.js} +11 -12
- package/dist/autopage-DqZ37VpL.js.map +1 -0
- package/dist/{binary-string-CKVAYI3M.js → binary-string-Ba8VM3b9.js} +3 -4
- package/dist/binary-string-Ba8VM3b9.js.map +1 -0
- package/dist/{body-insets-Dw_BeWD_.js → body-insets-BDHymJvz.js} +7 -9
- package/dist/body-insets-BDHymJvz.js.map +1 -0
- package/dist/browser.d.ts +24 -16
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +19 -19
- package/dist/browser.js.map +1 -1
- package/dist/{image-size-CvN2iCA4.js → chart-metadata-CwiTTcJq.js} +634 -537
- package/dist/chart-metadata-CwiTTcJq.js.map +1 -0
- package/dist/{clip-Bl01BPcN.d.ts → clip-ISfCMtWA.d.ts} +6 -10
- package/dist/clip-ISfCMtWA.d.ts.map +1 -0
- package/dist/{notes-Dh12JAbn.js → comments-CKIZYRbZ.js} +530 -401
- package/dist/comments-CKIZYRbZ.js.map +1 -0
- package/dist/{diagnostics-D8ot4Ei7.d.ts → diagnostics-MoA4MBq5.d.ts} +55 -53
- package/dist/diagnostics-MoA4MBq5.d.ts.map +1 -0
- package/dist/{embedded-fonts-DarT9aoa.d.ts → embedded-fonts-U7HIIhPO.d.ts} +4 -6
- package/dist/embedded-fonts-U7HIIhPO.d.ts.map +1 -0
- package/dist/{entry-compose-DCnvBZz2.d.ts → entry-compose-CiakSt-f.d.ts} +62 -81
- package/dist/entry-compose-CiakSt-f.d.ts.map +1 -0
- package/dist/{errors-C4oENPcu.js → entry-errors-JMthgJ2g.js} +45 -29
- package/dist/entry-errors-JMthgJ2g.js.map +1 -0
- package/dist/{table-cell-margins-EVg0EwxT.js → enums-BP9wsb9Q.js} +44 -47
- package/dist/enums-BP9wsb9Q.js.map +1 -0
- package/dist/{enums-BUKTUB6V.d.ts → enums-PcXr3o3J.d.ts} +13 -14
- package/dist/{enums-BUKTUB6V.d.ts.map → enums-PcXr3o3J.d.ts.map} +1 -1
- package/dist/families.d.ts +24 -26
- package/dist/families.d.ts.map +1 -1
- package/dist/families.js +3 -4
- package/dist/{fit-Cb7naFj6.js → fit-Bpmzep6O.js} +64 -56
- package/dist/fit-Bpmzep6O.js.map +1 -0
- package/dist/{font-metrics-v5fn7s7e.d.ts → font-metrics-DTppw4t3.d.ts} +62 -38
- package/dist/font-metrics-DTppw4t3.d.ts.map +1 -0
- package/dist/{grid-DikTjFey.js → grid-DUIMxjfl.js} +23 -26
- package/dist/grid-DUIMxjfl.js.map +1 -0
- package/dist/{html-dom-Iuog2wdK.js → html-dom-LZCgntnJ.js} +46 -47
- package/dist/html-dom-LZCgntnJ.js.map +1 -0
- package/dist/html.d.ts +53 -9
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +12 -13
- package/dist/html.js.map +1 -1
- package/dist/index.d.ts +21 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +16 -18
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +18 -19
- package/dist/inspect.js.map +1 -1
- package/dist/{text-anchor-CrYXAfUu.js → lock-attrs-CSQnFDHP.js} +62 -12
- package/dist/lock-attrs-CSQnFDHP.js.map +1 -0
- package/dist/math.d.ts +2 -4
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +12 -13
- package/dist/math.js.map +1 -1
- package/dist/measure.d.ts +23 -12
- package/dist/measure.d.ts.map +1 -1
- package/dist/measure.js +3 -3
- package/dist/node.d.ts +21 -13
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +12 -12
- package/dist/node.js.map +1 -1
- package/dist/{options-internal-WqgMf720.js → options-internal-BWgmLPdx.js} +4 -5
- package/dist/options-internal-BWgmLPdx.js.map +1 -0
- package/dist/{package-J49Ck6S2.d.ts → package-CANBWuSm.d.ts} +9 -13
- package/dist/package-CANBWuSm.d.ts.map +1 -0
- package/dist/{playbtn-CUqQdoDf.js → playbtn-BQZFJir9.js} +4 -5
- package/dist/playbtn-BQZFJir9.js.map +1 -0
- package/dist/{pres-C6qgOFAa.d.ts → pres-BkEkUAEM.d.ts} +410 -237
- package/dist/pres-BkEkUAEM.d.ts.map +1 -0
- package/dist/{presentation-DGYlAWhl.js → presentation-4Ggq0_Xa.js} +470 -315
- package/dist/presentation-4Ggq0_Xa.js.map +1 -0
- package/dist/{presentation-types-8jLQHI4M.d.ts → presentation-types-BgnZR-0a.d.ts} +1119 -468
- package/dist/presentation-types-BgnZR-0a.d.ts.map +1 -0
- package/dist/read.d.ts +18 -13
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +4 -4
- package/dist/script.d.ts +116 -65
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +2700 -780
- package/dist/script.js.map +1 -1
- package/dist/{shapes-re0KyQk_.js → shapes-CAPOjU0Q.js} +1564 -491
- package/dist/shapes-CAPOjU0Q.js.map +1 -0
- package/dist/{slide-Dx2ZeVZ6.d.ts → slide-BmT4kMoO.d.ts} +102 -89
- package/dist/slide-BmT4kMoO.d.ts.map +1 -0
- package/dist/{slide-size-BalTjFuv.js → slide-size-SkScz1ig.js} +2 -3
- package/dist/{slide-size-BalTjFuv.js.map → slide-size-SkScz1ig.js.map} +1 -1
- package/dist/{table-dom-BTDP3lEP.js → table-dom-BYga4FYY.js} +4 -5
- package/dist/{table-dom-BTDP3lEP.js.map → table-dom-BYga4FYY.js.map} +1 -1
- package/dist/{text-sN64Otf_.js → text-CU08xJGs.js} +393 -344
- package/dist/text-CU08xJGs.js.map +1 -0
- package/dist/{transition-speed-kUEWDWTx.js → transition-speed-CNJ0fSpQ.js} +2 -3
- package/dist/{transition-speed-kUEWDWTx.js.map → transition-speed-CNJ0fSpQ.js.map} +1 -1
- package/dist/{units-internal-XJlf-hOl.js → units-internal-BR3a4cIi.js} +34 -32
- package/dist/units-internal-BR3a4cIi.js.map +1 -0
- package/dist/{zip-CKd8ihcf.js → zip-7JTh61LX.js} +8 -10
- package/dist/zip-7JTh61LX.js.map +1 -0
- package/dist/{zip-C0leZZMj.d.ts → zip-uUjs9Cqx.d.ts} +4 -6
- package/dist/zip-uUjs9Cqx.d.ts.map +1 -0
- package/dist/zip.d.ts +3 -3
- package/dist/zip.js +3 -3
- package/dist/{zoom-DPUHh85d.js → zoom-CSSeOwM8.js} +1204 -620
- package/dist/zoom-CSSeOwM8.js.map +1 -0
- package/package.json +27 -28
- package/skills/{ts-pptx-upstream → pptx-ts-upstream}/SKILL.md +37 -84
- package/dist/autopage-odPz7zZO.js.map +0 -1
- package/dist/binary-string-CKVAYI3M.js.map +0 -1
- package/dist/body-insets-Dw_BeWD_.js.map +0 -1
- package/dist/clip-Bl01BPcN.d.ts.map +0 -1
- package/dist/diagnostics-D8ot4Ei7.d.ts.map +0 -1
- package/dist/embedded-fonts-DarT9aoa.d.ts.map +0 -1
- package/dist/entry-compose-DCnvBZz2.d.ts.map +0 -1
- package/dist/errors-C4oENPcu.js.map +0 -1
- package/dist/fit-Cb7naFj6.js.map +0 -1
- package/dist/font-metrics-v5fn7s7e.d.ts.map +0 -1
- package/dist/grid-DikTjFey.js.map +0 -1
- package/dist/html-dom-Iuog2wdK.js.map +0 -1
- package/dist/image-size-CvN2iCA4.js.map +0 -1
- package/dist/notes-Dh12JAbn.js.map +0 -1
- package/dist/options-internal-WqgMf720.js.map +0 -1
- package/dist/package-J49Ck6S2.d.ts.map +0 -1
- package/dist/playbtn-CUqQdoDf.js.map +0 -1
- package/dist/pres-C6qgOFAa.d.ts.map +0 -1
- package/dist/presentation-DGYlAWhl.js.map +0 -1
- package/dist/presentation-types-8jLQHI4M.d.ts.map +0 -1
- package/dist/shapes-re0KyQk_.js.map +0 -1
- package/dist/slide-Dx2ZeVZ6.d.ts.map +0 -1
- package/dist/table-cell-margins-EVg0EwxT.js.map +0 -1
- package/dist/text-anchor-CrYXAfUu.js.map +0 -1
- package/dist/text-sN64Otf_.js.map +0 -1
- package/dist/units-internal-XJlf-hOl.js.map +0 -1
- package/dist/zip-C0leZZMj.d.ts.map +0 -1
- package/dist/zip-CKd8ihcf.js.map +0 -1
- package/dist/zoom-DPUHh85d.js.map +0 -1
package/dist/html.d.ts
CHANGED
|
@@ -1,10 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Reproduce an existing HTML `<table>` as a PowerPoint table, as a free
|
|
3
|
+
* function that works anywhere there is a DOM.
|
|
4
|
+
*
|
|
5
|
+
* The same conversion is available as `PptxTs.prototype.tableToSlides(id, options)` on the
|
|
6
|
+
* browser build. Reach for *that* when you are in a browser and have a table id; reach for
|
|
7
|
+
* *this* when either of those is not true:
|
|
8
|
+
*
|
|
9
|
+
* - **You are not in a browser.** Node has no global `document`, so the method's entry point
|
|
10
|
+
* does not exist. Pass the element itself (from any DOM implementation) and no global is
|
|
11
|
+
* consulted at all; pass an id together with `options.document` and the id resolves against
|
|
12
|
+
* that document.
|
|
13
|
+
* - **You already have the element.** Passing it skips the id lookup, and skips the class of
|
|
14
|
+
* bug where an id that is not a valid CSS identifier resolves to nothing.
|
|
15
|
+
* - **Your presentation is not a `PptxTs`.** The `pptx` parameter is structural
|
|
16
|
+
* ({@link TableToSlidesHost}: `addSlide` + `presLayout`), so anything shaped like a
|
|
17
|
+
* presentation works, including the Node build.
|
|
18
|
+
*
|
|
19
|
+
* **Column widths need a layout engine.** In a browser the columns are sized from each cell's
|
|
20
|
+
* rendered `offsetWidth`, which reproduces the table's real proportions. Nothing outside a
|
|
21
|
+
* browser lays a table out, so `offsetWidth` is `0` there and the conversion falls back: it uses
|
|
22
|
+
* the computed CSS `width`s when the stylesheet states them for every column in one unit, and
|
|
23
|
+
* an equal split when it does not. A fallback and not a graceful loss of precision: `offsetWidth`
|
|
24
|
+
* is the border box and computed `width` the content box, so padding alone can put the two bases
|
|
25
|
+
* in different proportions and the same table can come out with different column widths on either
|
|
26
|
+
* side of a layout engine. To pin widths regardless, put `data-pptx-width` (exact
|
|
27
|
+
* inches) or `data-pptx-min-width` (a floor) on the cells of the table's first row. Those win
|
|
28
|
+
* outright on every path. On a cell that spans, the value is the *cell's* width and divides
|
|
29
|
+
* across the columns it covers, the same way a measured or CSS width does.
|
|
30
|
+
*
|
|
31
|
+
* Everything else (cell text with `<br>` preserved as a line break, colspan/rowspan,
|
|
32
|
+
* computed colors, weight, alignment, padding, borders, and auto-paging across as many slides
|
|
33
|
+
* as the rows need) works the same wherever it runs.
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { PptxTs } from 'pptx-ts'
|
|
37
|
+
* import { tableToSlides } from 'pptx-ts/html'
|
|
38
|
+
* import { Window } from 'happy-dom'
|
|
39
|
+
*
|
|
40
|
+
* const win = new Window()
|
|
41
|
+
* win.document.body.innerHTML = '<table id="report">…</table>'
|
|
42
|
+
*
|
|
43
|
+
* const pptx = new PptxTs()
|
|
44
|
+
* tableToSlides(pptx, win.document.getElementById('report'), { autoPage: true })
|
|
45
|
+
* await pptx.writeFile({ fileName: 'report.pptx' })
|
|
46
|
+
* ```
|
|
47
|
+
* @module
|
|
48
|
+
*/
|
|
49
|
+
import { F as TableToSlidesDocument, I as TableToSlidesElement, L as TableToSlidesProps, a as Slide, t as AddSlideProps } from "./slide-BmT4kMoO.js";
|
|
50
|
+
import { i as PresLayout } from "./pres-BkEkUAEM.js";
|
|
51
|
+
import { S as UnsupportedFeatureErrorCode, _ as InternalErrorCode, a as TsPptxCode, b as PackageReadErrorCode, c as InternalError, d as PackageReadError, f as PptxTsError, g as ErrorCode, h as DiagnosticCode, i as setDiagnosticHandler, l as InvalidOptionError, m as UnsupportedFeatureError, n as DiagnosticHandler, o as TsPptxError, p as PptxTsErrorOptions, r as resetDiagnosticState, s as TsPptxErrorOptions, t as Diagnostic, u as MediaError, v as InvalidOptionErrorCode, x as PptxTsCode, y as MediaErrorCode } from "./diagnostics-MoA4MBq5.js";
|
|
5
52
|
/**
|
|
6
53
|
* What `tableToSlides` needs a presentation to be: somewhere to put slides, and a layout to
|
|
7
|
-
* size them against. Structural on purpose
|
|
54
|
+
* size them against. Structural on purpose: stating the two members rather than naming the
|
|
8
55
|
* class is what lets the free function on `pptx-ts/html` take any presentation instance
|
|
9
56
|
* (Node, browser, or standalone) without the entry importing one.
|
|
10
57
|
*/
|
|
@@ -12,8 +59,6 @@ type TableToSlidesHost = {
|
|
|
12
59
|
addSlide: (options?: AddSlideProps) => Slide;
|
|
13
60
|
presLayout: PresLayout;
|
|
14
61
|
};
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/html.d.ts
|
|
17
62
|
/**
|
|
18
63
|
* Reproduce an HTML `<table>` as a PowerPoint table, adding as many slides as its rows need.
|
|
19
64
|
* @param {TableToSlidesHost} pptx - the presentation to add slides to
|
|
@@ -21,6 +66,5 @@ type TableToSlidesHost = {
|
|
|
21
66
|
* @param {TableToSlidesProps} options - generation options
|
|
22
67
|
*/
|
|
23
68
|
export declare function tableToSlides(pptx: TableToSlidesHost, table: TableToSlidesElement | string, options?: TableToSlidesProps): void;
|
|
24
|
-
|
|
25
|
-
export { type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type ErrorCode, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, MediaError, type MediaErrorCode, PackageReadError, type PackageReadErrorCode, type TableToSlidesDocument, type TableToSlidesElement, type TableToSlidesHost, type TableToSlidesProps, type TsPptxCode, TsPptxError, type TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, resetDiagnosticState, setDiagnosticHandler };
|
|
69
|
+
export { type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type ErrorCode, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, MediaError, type MediaErrorCode, PackageReadError, type PackageReadErrorCode, type PptxTsCode, PptxTsError, type PptxTsErrorOptions, type TableToSlidesDocument, type TableToSlidesElement, type TableToSlidesHost, type TableToSlidesProps, TsPptxCode, TsPptxError, TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, resetDiagnosticState, setDiagnosticHandler };
|
|
26
70
|
//# sourceMappingURL=html.d.ts.map
|
package/dist/html.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","names":[],"sources":["../src/gen/table/html-dom.ts","../src/html.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"html.d.ts","names":[],"sources":["../src/gen/table/html-dom.ts","../src/html.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqEY;EACX,WAAW,UAAU,kBAAkB;EACvC,YAAY;;;;;;;;wBCbG,cACf,MAAM,mBACN,OAAO,+BACP,UAAS"}
|
package/dist/html.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
|
|
1
|
+
import { t as genTableToSlides } from "./html-dom-LZCgntnJ.js";
|
|
2
|
+
import { a as PackageReadError, c as resetDiagnosticState, i as MediaError, l as setDiagnosticHandler, n as InternalError, o as PptxTsError, r as InvalidOptionError, s as UnsupportedFeatureError, t as TsPptxError } from "./entry-errors-JMthgJ2g.js";
|
|
3
|
+
// src/html.ts
|
|
4
4
|
/**
|
|
5
5
|
* Reproduce an existing HTML `<table>` as a PowerPoint table, as a free
|
|
6
6
|
* function that works anywhere there is a DOM.
|
|
7
7
|
*
|
|
8
|
-
* The same conversion is available as `
|
|
8
|
+
* The same conversion is available as `PptxTs.prototype.tableToSlides(id, options)` on the
|
|
9
9
|
* browser build. Reach for *that* when you are in a browser and have a table id; reach for
|
|
10
10
|
* *this* when either of those is not true:
|
|
11
11
|
*
|
|
@@ -15,7 +15,7 @@ import { t as genTableToSlides } from "./html-dom-Iuog2wdK.js";
|
|
|
15
15
|
* that document.
|
|
16
16
|
* - **You already have the element.** Passing it skips the id lookup, and skips the class of
|
|
17
17
|
* bug where an id that is not a valid CSS identifier resolves to nothing.
|
|
18
|
-
* - **Your presentation is not a `
|
|
18
|
+
* - **Your presentation is not a `PptxTs`.** The `pptx` parameter is structural
|
|
19
19
|
* ({@link TableToSlidesHost}: `addSlide` + `presLayout`), so anything shaped like a
|
|
20
20
|
* presentation works, including the Node build.
|
|
21
21
|
*
|
|
@@ -23,27 +23,27 @@ import { t as genTableToSlides } from "./html-dom-Iuog2wdK.js";
|
|
|
23
23
|
* rendered `offsetWidth`, which reproduces the table's real proportions. Nothing outside a
|
|
24
24
|
* browser lays a table out, so `offsetWidth` is `0` there and the conversion falls back: it uses
|
|
25
25
|
* the computed CSS `width`s when the stylesheet states them for every column in one unit, and
|
|
26
|
-
* an equal split when it does not. A fallback and not a graceful loss of precision
|
|
26
|
+
* an equal split when it does not. A fallback and not a graceful loss of precision: `offsetWidth`
|
|
27
27
|
* is the border box and computed `width` the content box, so padding alone can put the two bases
|
|
28
28
|
* in different proportions and the same table can come out with different column widths on either
|
|
29
29
|
* side of a layout engine. To pin widths regardless, put `data-pptx-width` (exact
|
|
30
|
-
* inches) or `data-pptx-min-width` (a floor) on the cells of the table's first row
|
|
30
|
+
* inches) or `data-pptx-min-width` (a floor) on the cells of the table's first row. Those win
|
|
31
31
|
* outright on every path. On a cell that spans, the value is the *cell's* width and divides
|
|
32
32
|
* across the columns it covers, the same way a measured or CSS width does.
|
|
33
33
|
*
|
|
34
|
-
* Everything else
|
|
34
|
+
* Everything else (cell text with `<br>` preserved as a line break, colspan/rowspan,
|
|
35
35
|
* computed colors, weight, alignment, padding, borders, and auto-paging across as many slides
|
|
36
|
-
* as the rows need
|
|
36
|
+
* as the rows need) works the same wherever it runs.
|
|
37
37
|
* @example
|
|
38
38
|
* ```ts
|
|
39
|
-
* import {
|
|
39
|
+
* import { PptxTs } from 'pptx-ts'
|
|
40
40
|
* import { tableToSlides } from 'pptx-ts/html'
|
|
41
41
|
* import { Window } from 'happy-dom'
|
|
42
42
|
*
|
|
43
43
|
* const win = new Window()
|
|
44
44
|
* win.document.body.innerHTML = '<table id="report">…</table>'
|
|
45
45
|
*
|
|
46
|
-
* const pptx = new
|
|
46
|
+
* const pptx = new PptxTs()
|
|
47
47
|
* tableToSlides(pptx, win.document.getElementById('report'), { autoPage: true })
|
|
48
48
|
* await pptx.writeFile({ fileName: 'report.pptx' })
|
|
49
49
|
* ```
|
|
@@ -58,7 +58,6 @@ import { t as genTableToSlides } from "./html-dom-Iuog2wdK.js";
|
|
|
58
58
|
function tableToSlides(pptx, table, options = {}) {
|
|
59
59
|
genTableToSlides(pptx, table, options);
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
export { InternalError, InvalidOptionError, MediaError, PackageReadError, TsPptxError, UnsupportedFeatureError, resetDiagnosticState, setDiagnosticHandler, tableToSlides };
|
|
61
|
+
export { InternalError, InvalidOptionError, MediaError, PackageReadError, PptxTsError, TsPptxError, UnsupportedFeatureError, resetDiagnosticState, setDiagnosticHandler, tableToSlides };
|
|
63
62
|
|
|
64
63
|
//# sourceMappingURL=html.js.map
|
package/dist/html.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.js","names":[],"sources":["../src/html.ts"],"sourcesContent":["/**\n * Reproduce an existing HTML `<table>` as a PowerPoint table, as a free\n * function that works anywhere there is a DOM.\n *\n * The same conversion is available as `
|
|
1
|
+
{"version":3,"file":"html.js","names":[],"sources":["../src/html.ts"],"sourcesContent":["/**\n * Reproduce an existing HTML `<table>` as a PowerPoint table, as a free\n * function that works anywhere there is a DOM.\n *\n * The same conversion is available as `PptxTs.prototype.tableToSlides(id, options)` on the\n * browser build. Reach for *that* when you are in a browser and have a table id; reach for\n * *this* when either of those is not true:\n *\n * - **You are not in a browser.** Node has no global `document`, so the method's entry point\n * does not exist. Pass the element itself (from any DOM implementation) and no global is\n * consulted at all; pass an id together with `options.document` and the id resolves against\n * that document.\n * - **You already have the element.** Passing it skips the id lookup, and skips the class of\n * bug where an id that is not a valid CSS identifier resolves to nothing.\n * - **Your presentation is not a `PptxTs`.** The `pptx` parameter is structural\n * ({@link TableToSlidesHost}: `addSlide` + `presLayout`), so anything shaped like a\n * presentation works, including the Node build.\n *\n * **Column widths need a layout engine.** In a browser the columns are sized from each cell's\n * rendered `offsetWidth`, which reproduces the table's real proportions. Nothing outside a\n * browser lays a table out, so `offsetWidth` is `0` there and the conversion falls back: it uses\n * the computed CSS `width`s when the stylesheet states them for every column in one unit, and\n * an equal split when it does not. A fallback and not a graceful loss of precision: `offsetWidth`\n * is the border box and computed `width` the content box, so padding alone can put the two bases\n * in different proportions and the same table can come out with different column widths on either\n * side of a layout engine. To pin widths regardless, put `data-pptx-width` (exact\n * inches) or `data-pptx-min-width` (a floor) on the cells of the table's first row. Those win\n * outright on every path. On a cell that spans, the value is the *cell's* width and divides\n * across the columns it covers, the same way a measured or CSS width does.\n *\n * Everything else (cell text with `<br>` preserved as a line break, colspan/rowspan,\n * computed colors, weight, alignment, padding, borders, and auto-paging across as many slides\n * as the rows need) works the same wherever it runs.\n * @example\n * ```ts\n * import { PptxTs } from 'pptx-ts'\n * import { tableToSlides } from 'pptx-ts/html'\n * import { Window } from 'happy-dom'\n *\n * const win = new Window()\n * win.document.body.innerHTML = '<table id=\"report\">…</table>'\n *\n * const pptx = new PptxTs()\n * tableToSlides(pptx, win.document.getElementById('report'), { autoPage: true })\n * await pptx.writeFile({ fileName: 'report.pptx' })\n * ```\n * @module\n */\n\nimport { genTableToSlides, type TableToSlidesHost } from './gen/table/html-dom.js'\nimport type { TableToSlidesElement, TableToSlidesProps } from './types/index.js'\n\n/**\n * Reproduce an HTML `<table>` as a PowerPoint table, adding as many slides as its rows need.\n * @param {TableToSlidesHost} pptx - the presentation to add slides to\n * @param {TableToSlidesElement | string} table - the `<table>` element, or its id (see `options.document`)\n * @param {TableToSlidesProps} options - generation options\n */\nexport function tableToSlides(\n\tpptx: TableToSlidesHost,\n\ttable: TableToSlidesElement | string,\n\toptions: TableToSlidesProps = {}\n): void {\n\tgenTableToSlides(pptx, table, options)\n}\n\nexport type { TableToSlidesHost }\nexport type { TableToSlidesDocument, TableToSlidesElement, TableToSlidesProps } from './types/index.js'\n\n// Error taxonomy: see `entry-errors.ts`. Re-exported from every entry so `instanceof`\n// works whichever subpath a consumer imports.\nexport * from './entry-errors.js'\n\n// Diagnostics: see `entry-diagnostics.ts`. Re-exported from every entry so a consumer of any\n// subpath can install a handler for the warnings that subpath emits.\nexport * from './entry-diagnostics.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,SAAgB,cACf,MACA,OACA,UAA8B,CAAC,GACxB;CACP,iBAAiB,MAAM,OAAO,OAAO;AACtC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The runtime-agnostic authoring entry, which the bare `pptx-ts` specifier resolves to when
|
|
3
|
+
* neither the `node` nor the `browser` export condition applies.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { C as isChartType, S as isChartExType, _ as VALID_SHAPE_PRESETS, a as CONNECTOR_PRESET_NAME, b as asChartType, c as PLACEHOLDER_TYPE, d as SHAPE_NAME, f as SchemeColor, g as TextAnchor, h as TableStyle, i as CHART_NAME, l as PlaceholderType, m as SlideObjectType, n as AlignV, o as ChartType, p as ShapeType, r as BulletType, s as OutputType, t as AlignH, u as SCHEME_COLORS, v as WRITE_OUTPUT_TYPE, x as connectorPresetFor, y as ZIP_OUTPUT_TYPE } from "./enums-PcXr3o3J.js";
|
|
8
|
+
import { $ as ChartExBinning, $t as ImageBaseProps, A as PositionProps, At as ObjectLockProps, B as HyperlinkActionJump, Bt as ResolvedCommentAuthor, C as HexColor, Ct as ChartPropsLegend, D as PatternFillProps, Dt as OptsChartData, E as Margin, En as RadarStyleAlias, Et as LineCap, F as ActionHyperlinkProps, Ft as CommentProps, G as ShapeLineProps, Gt as TextBulletProps, H as HyperlinkProps, Ht as TableCellLayout, I as BorderProps, It as MeasureTextOptions, J as UrlHyperlinkProps, Jt as TextMeasurement, K as SlideHyperlinkProps, Kt as TextFitShrinkProps, L as ConnectorProps, Lt as NotesProps, M as TextVertType, Mn as TimeUnit, Mt as PlaceholderBinding, N as ThemeColor, Nt as PlaceholderOption, O as PatternPreset, Ot as OptsChartGridLine, P as VAlign, Pt as PlaceholderProps, Q as ChartErrorBarOptions, Qt as textRuns, R as ConnectorType, Rt as NotesTextOptions, S as HAlign, Sn as LineDataSymbol, St as ChartPropsFillLine, T as LinearGradientFillProps, Tn as RadarStyle, Tt as ChartSeriesOpts, U as ShadowProps, Ut as TableLayoutResult, V as HyperlinkBaseProps, Vt as SlideComment, W as ShapeFillProps, Wt as TextBaseProps, X as ChartAxisTickMark, Xt as TextPropsOptions, Y as ChartAreaProps, Yt as TextProps, Z as ChartDataPointStyle, Zt as textRun, _ as DataOrPathProps, _n as DisplayBlanksAs, _t as ChartPropsChartStock, a as PresentationProps, an as ShapeAdjustHandlePolar, at as ChartPropsAxisCat, b as GradientFillProps, bn as LightRigDirection, bt as ChartPropsDataLabel, c as WriteFileProps, cn as ShapeConnectionSite, ct as ChartPropsBase, d as ThemeColorScheme, dn as Bar3DShape, dt as ChartPropsChartDoughnut, en as ImageProps, et as ChartExGeography, f as ThemeProps, fn as BarDirection, ft as ChartPropsChartHistogram, g as Coord, gn as DataLabelPosition, gt as ChartPropsChartRegionMap, h as Color, ht as ChartPropsChartRadar, i as PresLayout, in as ShapeAdjustHandle, it as ChartOpts, j as RadialGradientFillProps, jt as ObjectNameProps, k as PlaceholderPositionProps, kt as CommonObjectDescriptor, l as WriteOutputMap, ln as ShapeGuide, lt as ChartPropsChartBar, m as BackgroundProps, mn as BevelPresetType, mt as ChartPropsChartPie, n as PackagePart, nn as MediaType, nt as ChartLineDash, o as SectionProps, on as ShapeAdjustHandleXY, ot as ChartPropsAxisSer, p as BackgroundOption, pn as BarGrouping, pt as ChartPropsChartLine, q as StrokeProps, qt as TextGlowProps, r as PartsProps, rn as OleObjectProps, rt as ChartMulti, s as WriteBaseProps, sn as ShapeAdjustValue, st as ChartPropsAxisVal, t as CustomPropertyValue, tn as MediaProps, tt as ChartExStatistics, u as WriteProps, un as ShapeProps, ut as ChartPropsChartBoxWhisker, v as DataOrPathRequiredProps, vt as ChartPropsChartSurface, w as ImageFillProps, wn as PresetMaterialType, wt as ChartPropsTitle, x as GradientStopProps, xn as LightRigType, xt as ChartPropsDataTable, y as GeometryPoint, yn as LegendPosition, yt as ChartPropsChartWaterfall, z as FillOption, zt as OverflowBoxOptions } from "./pres-BkEkUAEM.js";
|
|
9
|
+
import { A as TableCellDiagonals, C as AnimationTrigger, D as TransitionType, E as TransitionSoundProps, F as TableToSlidesDocument, I as TableToSlidesElement, L as TableToSlidesProps, M as TableProps, N as TableRow, O as TableCell, P as TableRowSlide, S as AnimationProps, T as TransitionProps, _ as MasterTextStyleProps, a as Slide, b as SlideMasterProps, c as SectionZoomProps, d as ZoomBaseProps, f as Model3dCameraProps, g as MasterTextStyleLevel, h as MasterBulletProps, i as ObjectOptions, j as TableCellProps, k as TableCell3DProps, l as SlideZoomProps, m as Model3dProps, n as GroupChildProps, o as SlideLayout, p as Model3dPoint, r as GroupProps, s as SlideObjectInfo, t as AddSlideProps, u as SummaryZoomProps, v as SlideMasterChartProps, w as PresetEffect, x as SlideNumberProps, y as SlideMasterObject } from "./slide-BmT4kMoO.js";
|
|
10
|
+
import { S as UnsupportedFeatureErrorCode, _ as InternalErrorCode, a as TsPptxCode, b as PackageReadErrorCode, c as InternalError, d as PackageReadError, f as PptxTsError, g as ErrorCode, h as DiagnosticCode, i as setDiagnosticHandler, l as InvalidOptionError, m as UnsupportedFeatureError, n as DiagnosticHandler, o as TsPptxError, p as PptxTsErrorOptions, r as resetDiagnosticState, s as TsPptxErrorOptions, t as Diagnostic, u as MediaError, v as InvalidOptionErrorCode, x as PptxTsCode, y as MediaErrorCode } from "./diagnostics-MoA4MBq5.js";
|
|
11
|
+
import { A as pixelsToEmu, C as StandardLayoutName, D as emuToPoints, E as emuToPixels, M as ptToHundredths, O as inchesToEmu, S as StandardLayout, T as emuToInches, _ as HUNDREDTHS_PER_POINT, b as PERCENT_SCALE, c as ConstructFamily, g as FIXED_PCT_PER_PERCENT, h as Emu, i as ComposedSlide, j as pointsToEmu, k as percentToEmu, m as DEFAULT_PX_PER_INCH, n as Composed, p as ANGLE_UNITS_PER_DEGREE, r as ComposedPresentation, s as PresentationCore, t as ComposeOptions, v as MAX_COORDINATE_EMU, w as coordToEmu, x as STANDARD_LAYOUTS, y as MIN_COORDINATE_EMU } from "./entry-compose-CiakSt-f.js";
|
|
12
|
+
import { a as EMU_PER_INCH, i as clipPath, n as FlatSide, o as EMU_PER_POINT, r as HalfDiscPreset, s as POINTS_PER_INCH, t as ClipShape } from "./clip-ISfCMtWA.js";
|
|
8
13
|
/**
|
|
9
14
|
* The runtime-agnostic entry: what a consumer gets from the bare `pptx-ts` specifier
|
|
10
|
-
* when neither the `node` nor the `browser` export condition resolves
|
|
15
|
+
* when neither the `node` nor the `browser` export condition resolves: Deno, Bun, edge workers.
|
|
11
16
|
* Node and browser consumers reach `pptx-ts/node` and `pptx-ts/browser` through those conditions
|
|
12
17
|
* without naming them, and get the same class backed by an adapter that can reach their host.
|
|
13
18
|
*
|
|
14
19
|
* Authoring is identical on all three. The difference is only where the finished deck can go:
|
|
15
20
|
* `write`, `stream` and `toParts` hand the bytes back here as everywhere, while `writeFile`
|
|
16
21
|
* throws `runtime/file-output-unavailable` because there is no filesystem and no DOM to write
|
|
17
|
-
* to. Live-DOM `tableToSlides` is likewise absent
|
|
22
|
+
* to. Live-DOM `tableToSlides` is likewise absent. It is defined on the browser entry, and the
|
|
18
23
|
* DOM-agnostic form is the free `tableToSlides` on `pptx-ts/html`.
|
|
19
24
|
*/
|
|
20
|
-
export declare class
|
|
25
|
+
export declare class PptxTs extends PresentationCore {
|
|
21
26
|
constructor();
|
|
22
27
|
}
|
|
23
28
|
/**
|
|
24
29
|
* Compose a presentation from the construct families it needs, on the runtime-agnostic adapter.
|
|
25
30
|
*
|
|
26
|
-
* The counterpart to {@link
|
|
31
|
+
* The counterpart to {@link PptxTs}, which is composed with every family there is. This one costs
|
|
27
32
|
* what it carries: the core tier (text, shapes, images, groups, speaker notes) plus whatever
|
|
28
33
|
* `use` names, and nothing else reaches the bundle.
|
|
29
34
|
* @param {ComposeOptions} opts - the families to compose in, from `pptx-ts/families`
|
|
@@ -33,6 +38,9 @@ export declare class TsPptx extends PresentationCore {
|
|
|
33
38
|
* const pres = createPresentation({ use: [charts] })
|
|
34
39
|
*/
|
|
35
40
|
export declare function createPresentation<const Fs extends readonly ConstructFamily[] = []>(opts?: ComposeOptions<Fs>): Composed<Fs>;
|
|
36
|
-
|
|
37
|
-
export
|
|
41
|
+
/** @deprecated Renamed to {@link PptxTs}. This alias is removed in v5. */
|
|
42
|
+
export declare const TsPptx: typeof PptxTs;
|
|
43
|
+
/** @deprecated Renamed to {@link PptxTs}. This alias is removed in v5. */
|
|
44
|
+
export type TsPptx = PptxTs;
|
|
45
|
+
export { ANGLE_UNITS_PER_DEGREE, ActionHyperlinkProps, AddSlideProps, AlignH, AlignV, AnimationProps, AnimationTrigger, BackgroundOption, BackgroundProps, type Bar3DShape, type BarDirection, type BarGrouping, type BevelPresetType, BorderProps, BulletType, CHART_NAME, CONNECTOR_PRESET_NAME, ChartAreaProps, ChartAxisTickMark, ChartDataPointStyle, ChartErrorBarOptions, ChartExBinning, ChartExGeography, ChartExStatistics, ChartLineDash, ChartMulti, ChartOpts, ChartPropsAxisCat, ChartPropsAxisSer, ChartPropsAxisVal, ChartPropsBase, ChartPropsChartBar, ChartPropsChartBoxWhisker, ChartPropsChartDoughnut, ChartPropsChartHistogram, ChartPropsChartLine, ChartPropsChartPie, ChartPropsChartRadar, ChartPropsChartRegionMap, ChartPropsChartStock, ChartPropsChartSurface, ChartPropsChartWaterfall, ChartPropsDataLabel, ChartPropsDataTable, ChartPropsFillLine, ChartPropsLegend, ChartPropsTitle, ChartSeriesOpts, ChartType, ClipShape, Color, CommentProps, CommonObjectDescriptor, type ComposeOptions, type Composed, type ComposedPresentation, type ComposedSlide, ConnectorProps, ConnectorType, type ConstructFamily, Coord, CustomPropertyValue, DEFAULT_PX_PER_INCH, type DataLabelPosition, DataOrPathProps, DataOrPathRequiredProps, type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type DisplayBlanksAs, EMU_PER_INCH, EMU_PER_POINT, Emu, type ErrorCode, FIXED_PCT_PER_PERCENT, FillOption, FlatSide, GeometryPoint, GradientFillProps, GradientStopProps, GroupChildProps, GroupProps, HAlign, HUNDREDTHS_PER_POINT, HalfDiscPreset, HexColor, HyperlinkActionJump, HyperlinkBaseProps, HyperlinkProps, ImageBaseProps, ImageFillProps, ImageProps, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, type LegendPosition, type LightRigDirection, type LightRigType, LineCap, type LineDataSymbol, LinearGradientFillProps, MAX_COORDINATE_EMU, MIN_COORDINATE_EMU, Margin, MasterBulletProps, MasterTextStyleLevel, MasterTextStyleProps, MeasureTextOptions, MediaError, type MediaErrorCode, MediaProps, MediaType, Model3dCameraProps, Model3dPoint, Model3dProps, NotesProps, NotesTextOptions, ObjectLockProps, ObjectNameProps, ObjectOptions, OleObjectProps, OptsChartData, OptsChartGridLine, OutputType, OverflowBoxOptions, PERCENT_SCALE, PLACEHOLDER_TYPE, POINTS_PER_INCH, PackagePart, PackageReadError, type PackageReadErrorCode, PartsProps, PatternFillProps, PatternPreset, PlaceholderBinding, PlaceholderOption, PlaceholderPositionProps, PlaceholderProps, PlaceholderType, PositionProps, PptxTs as default, type PptxTsCode, PptxTsError, type PptxTsErrorOptions, PresLayout, PresentationProps, PresetEffect, type PresetMaterialType, type RadarStyle, type RadarStyleAlias, RadialGradientFillProps, ResolvedCommentAuthor, SCHEME_COLORS, SHAPE_NAME, STANDARD_LAYOUTS, SchemeColor, SectionProps, SectionZoomProps, ShadowProps, ShapeAdjustHandle, ShapeAdjustHandlePolar, ShapeAdjustHandleXY, ShapeAdjustValue, ShapeConnectionSite, ShapeFillProps, ShapeGuide, ShapeLineProps, ShapeProps, ShapeType, Slide, SlideComment, SlideHyperlinkProps, SlideLayout, SlideMasterChartProps, SlideMasterObject, SlideMasterProps, SlideNumberProps, SlideObjectInfo, SlideObjectType, SlideZoomProps, StandardLayout, StandardLayoutName, StrokeProps, SummaryZoomProps, TableCell, TableCell3DProps, TableCellDiagonals, TableCellLayout, TableCellProps, TableLayoutResult, TableProps, TableRow, TableRowSlide, TableStyle, TableToSlidesDocument, TableToSlidesElement, TableToSlidesProps, TextAnchor, TextBaseProps, TextBulletProps, TextFitShrinkProps, TextGlowProps, TextMeasurement, TextProps, TextPropsOptions, TextVertType, ThemeColor, ThemeColorScheme, ThemeProps, type TimeUnit, TransitionProps, TransitionSoundProps, TransitionType, TsPptxCode, TsPptxError, TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, UrlHyperlinkProps, VALID_SHAPE_PRESETS, VAlign, WRITE_OUTPUT_TYPE, WriteBaseProps, WriteFileProps, WriteOutputMap, WriteProps, ZIP_OUTPUT_TYPE, ZoomBaseProps, asChartType, clipPath, connectorPresetFor, coordToEmu, emuToInches, emuToPixels, emuToPoints, inchesToEmu, isChartExType, isChartType, percentToEmu, pixelsToEmu, pointsToEmu, ptToHundredths, resetDiagnosticState, setDiagnosticHandler, textRun, textRuns };
|
|
38
46
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;qBAwBa,eAAe;EAC3B;;;;;;;;;;;;;;wBAiBe,yBAAyB,oBAAoB,wBAC5D,OAAO,eAAe,MACpB,SAAS;;qBAOC,eAAM;;YAEP,SAAS"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { A as inchesToEmu, C as MIN_COORDINATE_EMU, D as emuToInches, E as coordToEmu, F as EMU_PER_INCH, I as EMU_PER_POINT, L as POINTS_PER_INCH, M as pixelsToEmu, N as pointsToEmu, O as emuToPixels, P as ptToHundredths, S as MAX_COORDINATE_EMU, T as STANDARD_LAYOUTS,
|
|
3
|
-
import { a as
|
|
4
|
-
|
|
1
|
+
import { a as fetchMediaBase64, c as ALL_CONSTRUCT_FAMILIES, i as fetchFontBytes, l as composePresentation, n as textRuns, r as clipPath, s as placeholderSvgPreview, t as textRun, u as PresentationCore } from "./text-CU08xJGs.js";
|
|
2
|
+
import { A as inchesToEmu, C as MIN_COORDINATE_EMU, D as emuToInches, E as coordToEmu, F as EMU_PER_INCH, I as EMU_PER_POINT, L as POINTS_PER_INCH, M as pixelsToEmu, N as pointsToEmu, O as emuToPixels, P as ptToHundredths, S as MAX_COORDINATE_EMU, T as STANDARD_LAYOUTS, a as OutputType, b as FIXED_PCT_PER_PERCENT, c as ShapeType, d as TextAnchor, f as VALID_SHAPE_PRESETS, g as isChartType, h as isChartExType, i as ChartType, j as percentToEmu, k as emuToPoints, l as SlideObjectType, m as connectorPresetFor, n as AlignV, o as PlaceholderType, p as asChartType, r as BulletType, s as SchemeColor, t as AlignH, u as TableStyle, v as ANGLE_UNITS_PER_DEGREE, w as PERCENT_SCALE, x as HUNDREDTHS_PER_POINT, y as DEFAULT_PX_PER_INCH } from "./enums-BP9wsb9Q.js";
|
|
3
|
+
import { a as PackageReadError, c as resetDiagnosticState, i as MediaError, l as setDiagnosticHandler, n as InternalError, o as PptxTsError, r as InvalidOptionError, s as UnsupportedFeatureError, t as TsPptxError } from "./entry-errors-JMthgJ2g.js";
|
|
4
|
+
// src/runtime/neutral.ts
|
|
5
5
|
/**
|
|
6
|
-
* The adapter for a runtime that is neither Node nor a browser
|
|
6
|
+
* The adapter for a runtime that is neither Node nor a browser: Deno, Bun, an edge worker,
|
|
7
7
|
* anything that imports the bare `pptx-ts` specifier without resolving the `node` or
|
|
8
8
|
* `browser` export condition.
|
|
9
9
|
*
|
|
10
10
|
* It implements everything that is genuinely host-neutral and refuses only what is not.
|
|
11
11
|
* `fetch`, `btoa` and `TextEncoder` exist in all of these runtimes, so remote media and fonts
|
|
12
|
-
* load here exactly as they do in a browser
|
|
12
|
+
* load here exactly as they do in a browser, which is why every method but `writeFile` is now
|
|
13
13
|
* the shared implementation in {@link ./fetch-media} rather than a copy of it. What is missing
|
|
14
14
|
* is a *destination*: there is no `node:fs` to write to and no `document` to hand a download to,
|
|
15
15
|
* so {@link RuntimeAdapter.writeFile} throws a named error rather than guessing. Everything that
|
|
16
|
-
* returns bytes to the caller
|
|
16
|
+
* returns bytes to the caller (`write`, `stream`, `toParts`) works normally, which is the
|
|
17
17
|
* shape that suits a worker anyway.
|
|
18
18
|
*
|
|
19
19
|
* Media loading is fetch-only here: a bare filesystem path has no meaning without a filesystem,
|
|
@@ -31,8 +31,7 @@ function createNeutralRuntime() {
|
|
|
31
31
|
async function writeFile(fileName) {
|
|
32
32
|
throw new UnsupportedFeatureError("runtime/file-output-unavailable", `Cannot write "${fileName}": this runtime has neither a filesystem nor a DOM. Import "pptx-ts/node" to write to disk or "pptx-ts/browser" to trigger a download; anywhere else, use write() and persist the bytes yourself.`);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
//#region src/index.ts
|
|
34
|
+
// src/index.ts
|
|
36
35
|
/**
|
|
37
36
|
* The runtime-agnostic authoring entry, which the bare `pptx-ts` specifier resolves to when
|
|
38
37
|
* neither the `node` nor the `browser` export condition applies.
|
|
@@ -41,17 +40,17 @@ async function writeFile(fileName) {
|
|
|
41
40
|
*/
|
|
42
41
|
/**
|
|
43
42
|
* The runtime-agnostic entry: what a consumer gets from the bare `pptx-ts` specifier
|
|
44
|
-
* when neither the `node` nor the `browser` export condition resolves
|
|
43
|
+
* when neither the `node` nor the `browser` export condition resolves: Deno, Bun, edge workers.
|
|
45
44
|
* Node and browser consumers reach `pptx-ts/node` and `pptx-ts/browser` through those conditions
|
|
46
45
|
* without naming them, and get the same class backed by an adapter that can reach their host.
|
|
47
46
|
*
|
|
48
47
|
* Authoring is identical on all three. The difference is only where the finished deck can go:
|
|
49
48
|
* `write`, `stream` and `toParts` hand the bytes back here as everywhere, while `writeFile`
|
|
50
49
|
* throws `runtime/file-output-unavailable` because there is no filesystem and no DOM to write
|
|
51
|
-
* to. Live-DOM `tableToSlides` is likewise absent
|
|
50
|
+
* to. Live-DOM `tableToSlides` is likewise absent. It is defined on the browser entry, and the
|
|
52
51
|
* DOM-agnostic form is the free `tableToSlides` on `pptx-ts/html`.
|
|
53
52
|
*/
|
|
54
|
-
var
|
|
53
|
+
var PptxTs = class extends PresentationCore {
|
|
55
54
|
constructor() {
|
|
56
55
|
super(createNeutralRuntime(), ALL_CONSTRUCT_FAMILIES);
|
|
57
56
|
}
|
|
@@ -59,7 +58,7 @@ var TsPptx = class extends PresentationCore {
|
|
|
59
58
|
/**
|
|
60
59
|
* Compose a presentation from the construct families it needs, on the runtime-agnostic adapter.
|
|
61
60
|
*
|
|
62
|
-
* The counterpart to {@link
|
|
61
|
+
* The counterpart to {@link PptxTs}, which is composed with every family there is. This one costs
|
|
63
62
|
* what it carries: the core tier (text, shapes, images, groups, speaker notes) plus whatever
|
|
64
63
|
* `use` names, and nothing else reaches the bundle.
|
|
65
64
|
* @param {ComposeOptions} opts - the families to compose in, from `pptx-ts/families`
|
|
@@ -71,7 +70,8 @@ var TsPptx = class extends PresentationCore {
|
|
|
71
70
|
function createPresentation(opts) {
|
|
72
71
|
return composePresentation(createNeutralRuntime(), opts);
|
|
73
72
|
}
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
/** @deprecated Renamed to {@link PptxTs}. This alias is removed in v5. */
|
|
74
|
+
const TsPptx = PptxTs;
|
|
75
|
+
export { ANGLE_UNITS_PER_DEGREE, AlignH, AlignV, BulletType, ChartType, DEFAULT_PX_PER_INCH, EMU_PER_INCH, EMU_PER_POINT, FIXED_PCT_PER_PERCENT, HUNDREDTHS_PER_POINT, InternalError, InvalidOptionError, MAX_COORDINATE_EMU, MIN_COORDINATE_EMU, MediaError, OutputType, PERCENT_SCALE, POINTS_PER_INCH, PackageReadError, PlaceholderType, PptxTs, PptxTs as default, PptxTsError, STANDARD_LAYOUTS, SchemeColor, ShapeType, SlideObjectType, TableStyle, TextAnchor, TsPptx, TsPptxError, UnsupportedFeatureError, VALID_SHAPE_PRESETS, asChartType, clipPath, connectorPresetFor, coordToEmu, createPresentation, emuToInches, emuToPixels, emuToPoints, inchesToEmu, isChartExType, isChartType, percentToEmu, pixelsToEmu, pointsToEmu, ptToHundredths, resetDiagnosticState, setDiagnosticHandler, textRun, textRuns };
|
|
76
76
|
|
|
77
77
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/runtime/neutral.ts","../src/index.ts"],"sourcesContent":["import { UnsupportedFeatureError } from '../errors.js'\nimport type { RuntimeAdapter } from './types.js'\nimport { fetchFontBytes, fetchMediaBase64, placeholderSvgPreview } from './fetch-media.js'\n\n/**\n * The adapter for a runtime that is neither Node nor a browser
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/runtime/neutral.ts","../src/index.ts"],"sourcesContent":["import { UnsupportedFeatureError } from '../errors.js'\nimport type { RuntimeAdapter } from './types.js'\nimport { fetchFontBytes, fetchMediaBase64, placeholderSvgPreview } from './fetch-media.js'\n\n/**\n * The adapter for a runtime that is neither Node nor a browser: Deno, Bun, an edge worker,\n * anything that imports the bare `pptx-ts` specifier without resolving the `node` or\n * `browser` export condition.\n *\n * It implements everything that is genuinely host-neutral and refuses only what is not.\n * `fetch`, `btoa` and `TextEncoder` exist in all of these runtimes, so remote media and fonts\n * load here exactly as they do in a browser, which is why every method but `writeFile` is now\n * the shared implementation in {@link ./fetch-media} rather than a copy of it. What is missing\n * is a *destination*: there is no `node:fs` to write to and no `document` to hand a download to,\n * so {@link RuntimeAdapter.writeFile} throws a named error rather than guessing. Everything that\n * returns bytes to the caller (`write`, `stream`, `toParts`) works normally, which is the\n * shape that suits a worker anyway.\n *\n * Media loading is fetch-only here: a bare filesystem path has no meaning without a filesystem,\n * and `fetch` rejecting it is reported by the caller as a load failure naming the path.\n */\nexport function createNeutralRuntime(): RuntimeAdapter {\n\treturn {\n\t\twriteFileOutputType: null,\n\t\tloadMedia: (rel) => fetchMediaBase64(rel.path),\n\t\tcreateSvgPngPreview: placeholderSvgPreview,\n\t\twriteFile,\n\t\tloadFontData: fetchFontBytes,\n\t}\n}\n\nasync function writeFile(fileName: string): Promise<string> {\n\tthrow new UnsupportedFeatureError(\n\t\t'runtime/file-output-unavailable',\n\t\t`Cannot write \"${fileName}\": this runtime has neither a filesystem nor a DOM. ` +\n\t\t\t'Import \"pptx-ts/node\" to write to disk or \"pptx-ts/browser\" to trigger a ' +\n\t\t\t'download; anywhere else, use write() and persist the bytes yourself.'\n\t)\n}\n","/**\n * The runtime-agnostic authoring entry, which the bare `pptx-ts` specifier resolves to when\n * neither the `node` nor the `browser` export condition applies.\n *\n * @module\n */\nimport PresentationCore from './presentation.js'\nimport { composePresentation, type ComposeOptions, type Composed } from './entry-compose.js'\nimport type { ConstructFamily } from './families/shared.js'\nimport { ALL_CONSTRUCT_FAMILIES } from './entry-families.js'\nimport { createNeutralRuntime } from './runtime/neutral.js'\n\n/**\n * The runtime-agnostic entry: what a consumer gets from the bare `pptx-ts` specifier\n * when neither the `node` nor the `browser` export condition resolves: Deno, Bun, edge workers.\n * Node and browser consumers reach `pptx-ts/node` and `pptx-ts/browser` through those conditions\n * without naming them, and get the same class backed by an adapter that can reach their host.\n *\n * Authoring is identical on all three. The difference is only where the finished deck can go:\n * `write`, `stream` and `toParts` hand the bytes back here as everywhere, while `writeFile`\n * throws `runtime/file-output-unavailable` because there is no filesystem and no DOM to write\n * to. Live-DOM `tableToSlides` is likewise absent. It is defined on the browser entry, and the\n * DOM-agnostic form is the free `tableToSlides` on `pptx-ts/html`.\n */\nexport class PptxTs extends PresentationCore {\n\tconstructor() {\n\t\tsuper(createNeutralRuntime(), ALL_CONSTRUCT_FAMILIES)\n\t}\n}\n\n/**\n * Compose a presentation from the construct families it needs, on the runtime-agnostic adapter.\n *\n * The counterpart to {@link PptxTs}, which is composed with every family there is. This one costs\n * what it carries: the core tier (text, shapes, images, groups, speaker notes) plus whatever\n * `use` names, and nothing else reaches the bundle.\n * @param {ComposeOptions} opts - the families to compose in, from `pptx-ts/families`\n * @example\n * import { createPresentation } from 'pptx-ts'\n * import { charts } from 'pptx-ts/families'\n * const pres = createPresentation({ use: [charts] })\n */\nexport function createPresentation<const Fs extends readonly ConstructFamily[] = []>(\n\topts?: ComposeOptions<Fs>\n): Composed<Fs> {\n\treturn composePresentation(createNeutralRuntime(), opts)\n}\n\nexport { PptxTs as default }\n\n/** @deprecated Renamed to {@link PptxTs}. This alias is removed in v5. */\nexport const TsPptx = PptxTs\n/** @deprecated Renamed to {@link PptxTs}. This alias is removed in v5. */\nexport type TsPptx = PptxTs\n\nexport * from './entry-surface.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,uBAAuC;CACtD,OAAO;EACN,qBAAqB;EACrB,YAAY,QAAQ,iBAAiB,IAAI,IAAI;EAC7C,qBAAqB;EACrB;EACA,cAAc;CACf;AACD;AAEA,eAAe,UAAU,UAAmC;CAC3D,MAAM,IAAI,wBACT,mCACA,iBAAiB,SAAS,kMAG3B;AACD;;;;;;;;;;;;;;;;;;;;ACdA,IAAa,SAAb,cAA4B,iBAAiB;CAC5C,cAAc;EACb,MAAM,qBAAqB,GAAG,sBAAsB;CACrD;AACD;;;;;;;;;;;;;AAcA,SAAgB,mBACf,MACe;CACf,OAAO,oBAAoB,qBAAqB,GAAG,IAAI;AACxD;;AAKA,MAAa,SAAS"}
|
package/dist/inspect.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
//#region src/inspect.d.ts
|
|
1
|
+
import { n as OpcPackage } from "./package-CANBWuSm.js";
|
|
2
|
+
import { S as UnsupportedFeatureErrorCode, _ as InternalErrorCode, a as TsPptxCode, b as PackageReadErrorCode, c as InternalError, d as PackageReadError, f as PptxTsError, g as ErrorCode, h as DiagnosticCode, i as setDiagnosticHandler, l as InvalidOptionError, m as UnsupportedFeatureError, n as DiagnosticHandler, o as TsPptxError, p as PptxTsErrorOptions, r as resetDiagnosticState, s as TsPptxErrorOptions, t as Diagnostic, u as MediaError, v as InvalidOptionErrorCode, x as PptxTsCode, y as MediaErrorCode } from "./diagnostics-MoA4MBq5.js";
|
|
4
3
|
/**
|
|
5
4
|
* Input to the inspect surface. A `string` is a **filesystem path** (Node) read
|
|
6
5
|
* from disk; pass `Uint8Array`/`ArrayBuffer`/`Blob`/`number[]` for an in-memory
|
|
7
|
-
* archive. (A string is a path, not JSZip's latin1 binary content
|
|
6
|
+
* archive. (A string is a path, not JSZip's latin1 binary content; see
|
|
8
7
|
* `ZipInput`.)
|
|
9
8
|
*/
|
|
10
9
|
export type PptxInspectInputValue = string | number[] | Uint8Array | ArrayBuffer | Blob;
|
|
@@ -38,7 +37,7 @@ export interface PptxTextRun {
|
|
|
38
37
|
}
|
|
39
38
|
/**
|
|
40
39
|
* One paragraph (`a:p`): its runs in document order. Preserves the paragraph/line
|
|
41
|
-
* boundaries that the flat {@link PptxSlideElement.textRuns} list discards
|
|
40
|
+
* boundaries that the flat {@link PptxSlideElement.textRuns} list discards, needed
|
|
42
41
|
* to measure a `wrap="none"` frame line-by-line (each paragraph is one unwrapped line).
|
|
43
42
|
*/
|
|
44
43
|
export interface PptxParagraph {
|
|
@@ -46,7 +45,7 @@ export interface PptxParagraph {
|
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
48
47
|
* What an element is. `'group'` is a `p:grpSp` container: it has its own identity,
|
|
49
|
-
* box, and fill, but no text of its own
|
|
48
|
+
* box, and fill, but no text of its own. Its content is the elements that name it
|
|
50
49
|
* in {@link PptxSlideElement.parentZIndex}. `'graphicFrame'` is a `p:graphicFrame`
|
|
51
50
|
* hosting a table, a chart or a SmartArt graphic; {@link PptxSlideElement.graphicKind}
|
|
52
51
|
* says which, and it keeps that kind even when it carries text (a `'text'` element is
|
|
@@ -57,17 +56,17 @@ export type PptxSlideElementKind = 'text' | 'image' | 'shape' | 'group' | 'graph
|
|
|
57
56
|
* What a `'graphicFrame'` element hosts, read from its `a:graphicData/@uri`:
|
|
58
57
|
* a table (`a:tbl`), a classic chart (`c:chart`), a 2016-family chart
|
|
59
58
|
* (`cx:chartSpace`: waterfall/funnel/treemap/…), or a SmartArt diagram. `'other'`
|
|
60
|
-
* is a frame whose URI matches none of those
|
|
61
|
-
* model
|
|
59
|
+
* is a frame whose URI matches none of those (an OLE object, an ink part, a 3D
|
|
60
|
+
* model), reported as a box so it is not silently missing from the slide.
|
|
62
61
|
*/
|
|
63
62
|
export type PptxGraphicKind = 'table' | 'chart' | 'chartEx' | 'diagram' | 'other';
|
|
64
63
|
/**
|
|
65
64
|
* Vertical-autofit mode of a text frame, read from the `a:bodyPr` child element:
|
|
66
65
|
* - `'none'`: no autofit (`a:noAutofit`, or no autofit child at all). The box has a
|
|
67
|
-
* fixed height the text must fit inside
|
|
68
|
-
* - `'normAutofit'`: shrink text to fit (`a:normAutofit`, ts
|
|
66
|
+
* fixed height the text must fit inside: a genuine overflow candidate.
|
|
67
|
+
* - `'normAutofit'`: shrink text to fit (`a:normAutofit`, pptx-ts `fit: 'shrink'`).
|
|
69
68
|
* Text is downscaled rather than overflowing.
|
|
70
|
-
* - `'spAutoFit'`: resize shape to fit text (`a:spAutoFit`, ts
|
|
69
|
+
* - `'spAutoFit'`: resize shape to fit text (`a:spAutoFit`, pptx-ts `fit: 'resize'`).
|
|
71
70
|
* The authored height is an output, not a constraint, so the box cannot overflow.
|
|
72
71
|
*/
|
|
73
72
|
export type PptxAutofitMode = 'none' | 'normAutofit' | 'spAutoFit';
|
|
@@ -102,7 +101,7 @@ export interface PptxSlideElement {
|
|
|
102
101
|
zIndex: number;
|
|
103
102
|
/**
|
|
104
103
|
* Position and size in **slide-absolute** inches, composing every enclosing
|
|
105
|
-
* group transform
|
|
104
|
+
* group transform, so it is directly comparable across elements whether or not they are
|
|
106
105
|
* grouped. For a rotated element this is the unrotated placement box (the box
|
|
107
106
|
* PowerPoint writes after Ungroup); see {@link rotation}.
|
|
108
107
|
*/
|
|
@@ -125,7 +124,7 @@ export interface PptxSlideElement {
|
|
|
125
124
|
* this is the text the structure puts on the slide (table cells in row order,
|
|
126
125
|
* SmartArt node text), which is what {@link PptxSlideInspection.text} and
|
|
127
126
|
* `wordCount` then count; a chart contributes nothing, matching `Slide.text` on
|
|
128
|
-
* the read model. That text has no {@link textRuns} or {@link paragraphs} here
|
|
127
|
+
* the read model. That text has no {@link textRuns} or {@link paragraphs} here;
|
|
129
128
|
* per-run formatting inside a structure is what this surface does not flatten.
|
|
130
129
|
*/
|
|
131
130
|
text: string;
|
|
@@ -169,7 +168,7 @@ export type PptxBoxAnchor = 'left' | 'center' | 'right' | 'top' | 'middle' | 'bo
|
|
|
169
168
|
*/
|
|
170
169
|
export declare const DEFAULT_INSPECT_SLIDE_SIZE: PptxSlideSize;
|
|
171
170
|
/**
|
|
172
|
-
* Load a `.pptx` as an {@link OpcPackage}
|
|
171
|
+
* Load a `.pptx` as an {@link OpcPackage}, the same package model `pptx-ts/read`
|
|
173
172
|
* uses, so a caller that starts here can hand the result straight to
|
|
174
173
|
* `Presentation.fromPackage()` without re-reading the bytes.
|
|
175
174
|
*
|
|
@@ -182,7 +181,7 @@ export declare function listPptxParts(pptxPackage: OpcPackage): string[];
|
|
|
182
181
|
/** Read a package part as UTF-8 text, or `null` when the part is absent. */
|
|
183
182
|
export declare function readPptxTextPart(pptxPackage: OpcPackage, path: string): Promise<string | null>;
|
|
184
183
|
/**
|
|
185
|
-
* Read a package part as raw bytes
|
|
184
|
+
* Read a package part as raw bytes: the binary sibling of {@link readPptxTextPart}
|
|
186
185
|
* for embedded media (SVG/PNG/EMF blobs, fonts, …) that must not be UTF-8 decoded.
|
|
187
186
|
* Returns `null` when the part is absent. The `Uint8Array` is browser-isomorphic;
|
|
188
187
|
* Node consumers can wrap it with `Buffer.from(...)` if they need Buffer methods.
|
|
@@ -194,13 +193,12 @@ export declare function readPptxBinaryPart(pptxPackage: OpcPackage, path: string
|
|
|
194
193
|
export declare function inspectPptx(input: PptxInspectInput): Promise<PptxInspection>;
|
|
195
194
|
export declare function readPresentationSize(pptxPackage: OpcPackage, fallback?: PptxSlideSize): Promise<PptxSlideSize>;
|
|
196
195
|
/**
|
|
197
|
-
* Every slide in the deck, in **presentation order** (`p:sldIdLst`)
|
|
196
|
+
* Every slide in the deck, in **presentation order** (`p:sldIdLst`): the order
|
|
198
197
|
* PowerPoint shows them in, which is not the order their parts are named once a
|
|
199
198
|
* deck has been reordered.
|
|
200
199
|
*/
|
|
201
200
|
export declare function extractSlides(pptxPackage: OpcPackage, size?: PptxSlideSize): Promise<PptxSlideInspection[]>;
|
|
202
201
|
export declare function overlapArea(a: PptxBox, b: PptxBox): number;
|
|
203
202
|
export declare function boxAnchor(box: PptxBox, anchor: PptxBoxAnchor, axis: PptxBoxAxis): number;
|
|
204
|
-
|
|
205
|
-
export { type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type ErrorCode, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, MediaError, type MediaErrorCode, PackageReadError, type PackageReadErrorCode, type TsPptxCode, TsPptxError, type TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, resetDiagnosticState, setDiagnosticHandler };
|
|
203
|
+
export { type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type ErrorCode, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, MediaError, type MediaErrorCode, PackageReadError, type PackageReadErrorCode, type PptxTsCode, PptxTsError, type PptxTsErrorOptions, TsPptxCode, TsPptxError, TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, resetDiagnosticState, setDiagnosticHandler };
|
|
206
204
|
//# sourceMappingURL=inspect.d.ts.map
|
package/dist/inspect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","names":[],"sources":["../src/inspect.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","names":[],"sources":["../src/inspect.ts"],"mappings":";;;;;;;;YA0CY,4CAA4C,aAAa,cAAc;YAEvE,mBAAmB,wBAAwB,QAAQ;iBAE9C;EAChB;EACA;;iBAGgB;EAChB;EACA;EACA;EACA;;iBAGgB;EAChB;EACA;EACA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;iBAQgB;EAChB,MAAM;;;;;;;;;;YAWK;;;;;;;;YASA;;;;;;;;;;YAWA;;;;;;iBAOK;EAChB;EACA;EACA;EACA;;iBAGgB;;EAEhB;EACA;EACA,MAAM;;;;;EAKN,aAAa;;;;;;;;EAQb;;;;;;;EAOA,KAAK;;;;;EAKL;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;EASA;EACA;EACA,SAAS;;;;;;EAMT;EACA,YAAY;EACZ,UAAU;;EAEV,YAAY;EACZ;EACA;EACA;EACA;EACA;;iBAGgB;EAChB;EACA;EACA;EACA,MAAM;EACN,UAAU;EACV;EACA;;iBAGgB;EAChB,WAAW;EACX,QAAQ;;YAGG;YACA;;;;;;qBAOC,4BAA4B;;;;;;;;;wBAsBnB,gBAAgB,OAAO,mBAAmB,QAAQ;;wBAKxD,cAAc,aAAa;;wBAKrB,iBAAiB,aAAa,YAAY,eAAe;;;;;;;;;;wBAczD,mBAAmB,aAAa,YAAY,eAAe,QAAQ;wBAmBnE,YAAY,OAAO,mBAAmB,QAAQ;wBAO9C,qBACrB,aAAa,YACb,WAAU,gBACR,QAAQ;;;;;;wBAWW,cAAc,aAAa,YAAY,OAAO,gBAAgB,QAAQ;wBA2C5E,YAAY,GAAG,SAAS,GAAG;wBAM3B,UAAU,KAAK,SAAS,QAAQ,eAAe,MAAM"}
|