@shbernal/ts-pptx 4.0.1 → 4.1.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/{autopage-odPz7zZO.js → autopage-D4kyVp11.js} +5 -5
- package/dist/{autopage-odPz7zZO.js.map → autopage-D4kyVp11.js.map} +1 -1
- package/dist/{body-insets-Dw_BeWD_.js → body-insets-kVHmjGc6.js} +2 -2
- package/dist/{body-insets-Dw_BeWD_.js.map → body-insets-kVHmjGc6.js.map} +1 -1
- package/dist/browser.d.ts +7 -7
- package/dist/browser.js +5 -5
- package/dist/{clip-Bl01BPcN.d.ts → clip-DHDlnHUq.d.ts} +2 -2
- package/dist/{clip-Bl01BPcN.d.ts.map → clip-DHDlnHUq.d.ts.map} +1 -1
- package/dist/{diagnostics-D8ot4Ei7.d.ts → diagnostics-DiMmBU8P.d.ts} +6 -6
- package/dist/{diagnostics-D8ot4Ei7.d.ts.map → diagnostics-DiMmBU8P.d.ts.map} +1 -1
- package/dist/{embedded-fonts-DarT9aoa.d.ts → embedded-fonts-CI_YGW2d.d.ts} +2 -2
- package/dist/{embedded-fonts-DarT9aoa.d.ts.map → embedded-fonts-CI_YGW2d.d.ts.map} +1 -1
- package/dist/{entry-compose-DCnvBZz2.d.ts → entry-compose-6hF9aTmT.d.ts} +19 -17
- package/dist/{entry-compose-DCnvBZz2.d.ts.map → entry-compose-6hF9aTmT.d.ts.map} +1 -1
- package/dist/{enums-BUKTUB6V.d.ts → enums-DQRpVOLh.d.ts} +3 -3
- package/dist/{enums-BUKTUB6V.d.ts.map → enums-DQRpVOLh.d.ts.map} +1 -1
- package/dist/{errors-C4oENPcu.js → errors-Da2nXCJm.js} +6 -6
- package/dist/{errors-C4oENPcu.js.map → errors-Da2nXCJm.js.map} +1 -1
- package/dist/families.d.ts +6 -6
- package/dist/families.js +2 -2
- package/dist/{fit-Cb7naFj6.js → fit-CcXbg__l.js} +10 -10
- package/dist/{fit-Cb7naFj6.js.map → fit-CcXbg__l.js.map} +1 -1
- package/dist/{font-metrics-v5fn7s7e.d.ts → font-metrics-CBGmhLo0.d.ts} +6 -6
- package/dist/{font-metrics-v5fn7s7e.d.ts.map → font-metrics-CBGmhLo0.d.ts.map} +1 -1
- package/dist/{grid-DikTjFey.js → grid-9B2w5EaY.js} +2 -2
- package/dist/{grid-DikTjFey.js.map → grid-9B2w5EaY.js.map} +1 -1
- package/dist/{html-dom-Iuog2wdK.js → html-dom-DvJmuHt2.js} +10 -10
- package/dist/html-dom-DvJmuHt2.js.map +1 -0
- package/dist/html.d.ts +3 -3
- package/dist/html.js +2 -2
- package/dist/{image-size-CvN2iCA4.js → image-size-DwDbakcl.js} +64 -5
- package/dist/image-size-DwDbakcl.js.map +1 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +3 -3
- package/dist/inspect.d.ts +4 -4
- package/dist/inspect.js +4 -4
- package/dist/inspect.js.map +1 -1
- package/dist/math.d.ts +1 -1
- package/dist/math.js +1 -1
- package/dist/measure.d.ts +3 -3
- package/dist/measure.js +2 -2
- package/dist/node.d.ts +7 -7
- package/dist/node.js +3 -3
- package/dist/{notes-Dh12JAbn.js → notes-BcT571R4.js} +19 -18
- package/dist/notes-BcT571R4.js.map +1 -0
- package/dist/options-internal-WqgMf720.js.map +1 -1
- package/dist/{package-J49Ck6S2.d.ts → package-KoEgVwII.d.ts} +6 -2
- package/dist/{package-J49Ck6S2.d.ts.map → package-KoEgVwII.d.ts.map} +1 -1
- package/dist/{pres-C6qgOFAa.d.ts → pres-BA9_lJbY.d.ts} +32 -12
- package/dist/pres-BA9_lJbY.d.ts.map +1 -0
- package/dist/{presentation-DGYlAWhl.js → presentation-Cyl74rq2.js} +70 -35
- package/dist/presentation-Cyl74rq2.js.map +1 -0
- package/dist/{presentation-types-8jLQHI4M.d.ts → presentation-types-B3VQH4Bz.d.ts} +19 -15
- package/dist/presentation-types-B3VQH4Bz.d.ts.map +1 -0
- package/dist/read.d.ts +6 -6
- package/dist/read.js +3 -3
- package/dist/script.d.ts +2 -2
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +11 -11
- package/dist/script.js.map +1 -1
- package/dist/{shapes-re0KyQk_.js → shapes-BcyFdZpp.js} +14 -10
- package/dist/shapes-BcyFdZpp.js.map +1 -0
- package/dist/{slide-Dx2ZeVZ6.d.ts → slide-BqPtyKmb.d.ts} +12 -7
- package/dist/slide-BqPtyKmb.d.ts.map +1 -0
- package/dist/{table-cell-margins-EVg0EwxT.js → table-cell-margins-PDshga8T.js} +4 -4
- package/dist/{table-cell-margins-EVg0EwxT.js.map → table-cell-margins-PDshga8T.js.map} +1 -1
- package/dist/{table-dom-BTDP3lEP.js → table-dom-CVbvUfgh.js} +3 -3
- package/dist/{table-dom-BTDP3lEP.js.map → table-dom-CVbvUfgh.js.map} +1 -1
- package/dist/{text-sN64Otf_.js → text-BvFFMMFQ.js} +38 -36
- package/dist/{text-sN64Otf_.js.map → text-BvFFMMFQ.js.map} +1 -1
- package/dist/{text-anchor-CrYXAfUu.js → text-anchor-BgLPbwbL.js} +2 -2
- package/dist/{text-anchor-CrYXAfUu.js.map → text-anchor-BgLPbwbL.js.map} +1 -1
- package/dist/{units-internal-XJlf-hOl.js → units-internal-DFcUYjh3.js} +11 -6
- package/dist/units-internal-DFcUYjh3.js.map +1 -0
- package/dist/{zip-C0leZZMj.d.ts → zip-CTll_dr0.d.ts} +2 -2
- package/dist/{zip-C0leZZMj.d.ts.map → zip-CTll_dr0.d.ts.map} +1 -1
- package/dist/{zip-CKd8ihcf.js → zip-CYZ0F6BV.js} +2 -2
- package/dist/{zip-CKd8ihcf.js.map → zip-CYZ0F6BV.js.map} +1 -1
- package/dist/zip.d.ts +2 -2
- package/dist/zip.js +2 -2
- package/dist/{zoom-DPUHh85d.js → zoom-BoNyOlPm.js} +65 -51
- package/dist/zoom-BoNyOlPm.js.map +1 -0
- package/package.json +25 -25
- package/skills/ts-pptx-upstream/SKILL.md +18 -18
- 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/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/units-internal-XJlf-hOl.js.map +0 -1
- package/dist/zoom-DPUHh85d.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { d as SHAPE_NAME, i as CHART_NAME, m as SlideObjectType, v as WRITE_OUTPUT_TYPE } from "./enums-
|
|
2
|
-
import {
|
|
3
|
-
import { L as TableToSlidesProps, M as TableProps, N as TableRow, S as AnimationProps, T as TransitionProps, a as Slide, b as SlideMasterProps, n as GroupChildProps, o as SlideLayout, r as GroupProps, s as SlideObjectInfo, t as AddSlideProps, x as SlideNumberProps, y as SlideMasterObject } from "./slide-
|
|
4
|
-
import { r as EmbeddedFontSlot } from "./embedded-fonts-
|
|
5
|
-
import { A as SlideObject, D as SectionInternalProps, E as PresentationPropsInternal, M as SlideRelChart, N as SlideRelMedia, O as SlideLayoutInternal, T as PresSlideInternal, j as SlideRel, k as SlideMasterInternal, n as FontMetricsRegistry, w as ObjectOptionsInternal } from "./font-metrics-
|
|
6
|
-
import { s as MediaError } from "./diagnostics-
|
|
7
|
-
import { c as ExtractedSlides, s as ExtractedSlide } from "./presentation-types-
|
|
8
|
-
import { r as ZipWriter } from "./zip-
|
|
1
|
+
import { d as SHAPE_NAME, i as CHART_NAME, m as SlideObjectType, v as WRITE_OUTPUT_TYPE } from "./enums-DQRpVOLh.js";
|
|
2
|
+
import { $ as ChartOpts, At as NotesProps, C as HexColor, Ht as TextProps, It as TableLayoutResult, Mt as OverflowBoxOptions, Pt as SlideComment, Q as ChartMulti, St as OptsChartData, Ut as TextPropsOptions, Vt as TextMeasurement, c as WriteFileProps, f as ThemeProps, i as PresLayout, kt as MeasureTextOptions, l as WriteOutputMap, n as PackagePart, o as SectionProps, p as BackgroundOption, qt as ImageProps, r as PartsProps, rn as ShapeProps, s as WriteBaseProps, t as CustomPropertyValue, u as WriteProps } from "./pres-BA9_lJbY.js";
|
|
3
|
+
import { L as TableToSlidesProps, M as TableProps, N as TableRow, S as AnimationProps, T as TransitionProps, a as Slide, b as SlideMasterProps, n as GroupChildProps, o as SlideLayout, r as GroupProps, s as SlideObjectInfo, t as AddSlideProps, x as SlideNumberProps, y as SlideMasterObject } from "./slide-BqPtyKmb.js";
|
|
4
|
+
import { r as EmbeddedFontSlot } from "./embedded-fonts-CI_YGW2d.js";
|
|
5
|
+
import { A as SlideObject, D as SectionInternalProps, E as PresentationPropsInternal, M as SlideRelChart, N as SlideRelMedia, O as SlideLayoutInternal, T as PresSlideInternal, j as SlideRel, k as SlideMasterInternal, n as FontMetricsRegistry, w as ObjectOptionsInternal } from "./font-metrics-CBGmhLo0.js";
|
|
6
|
+
import { s as MediaError } from "./diagnostics-DiMmBU8P.js";
|
|
7
|
+
import { c as ExtractedSlides, s as ExtractedSlide } from "./presentation-types-B3VQH4Bz.js";
|
|
8
|
+
import { r as ZipWriter } from "./zip-CTll_dr0.js";
|
|
9
9
|
//#region src/runtime/types.d.ts
|
|
10
10
|
type RuntimeAdapter = {
|
|
11
11
|
readonly writeFileOutputType: WRITE_OUTPUT_TYPE | null;
|
|
@@ -85,7 +85,7 @@ type Emu = number & {
|
|
|
85
85
|
readonly __unit: 'emu';
|
|
86
86
|
};
|
|
87
87
|
/** Default pixel density for the `"<n>px"` coordinate unit: CSS reference pixels, also the
|
|
88
|
-
* density ts
|
|
88
|
+
* density pptx-ts assumes when reading an image header's pixel dimensions. */
|
|
89
89
|
declare const DEFAULT_PX_PER_INCH = 96;
|
|
90
90
|
/**
|
|
91
91
|
* The largest DrawingML coordinate, in EMU: the `maxInclusive` of `ST_Coordinate`, the type of
|
|
@@ -96,11 +96,11 @@ declare const MAX_COORDINATE_EMU = 27273042316900;
|
|
|
96
96
|
declare const MIN_COORDINATE_EMU = -27273042329600;
|
|
97
97
|
type StandardLayoutName = 'LAYOUT_4x3' | 'LAYOUT_16x9' | 'LAYOUT_16x10' | 'LAYOUT_WIDE';
|
|
98
98
|
interface StandardLayout {
|
|
99
|
-
/** ts
|
|
99
|
+
/** pptx-ts layout key used with `pptx.layout`. */
|
|
100
100
|
readonly layout: StandardLayoutName;
|
|
101
101
|
/** PresentationML slide-size preset name, or `custom` for PowerPoint widescreen. */
|
|
102
102
|
readonly name: string;
|
|
103
|
-
/** Slide width in inches — inches is ts
|
|
103
|
+
/** Slide width in inches — inches is pptx-ts's default coordinate unit, so this is the value to use for `addText`/`addShape` math. */
|
|
104
104
|
readonly widthIn: number;
|
|
105
105
|
/** Slide height in inches. */
|
|
106
106
|
readonly heightIn: number;
|
|
@@ -591,7 +591,7 @@ declare class PresentationCore {
|
|
|
591
591
|
set layout(value: string | StandardLayout);
|
|
592
592
|
get layout(): string;
|
|
593
593
|
/**
|
|
594
|
-
* ts
|
|
594
|
+
* pptx-ts Library Version
|
|
595
595
|
*/
|
|
596
596
|
private readonly _version;
|
|
597
597
|
get version(): string;
|
|
@@ -693,7 +693,7 @@ declare class PresentationCore {
|
|
|
693
693
|
*/
|
|
694
694
|
private readonly getSections;
|
|
695
695
|
/**
|
|
696
|
-
* Enables the `Slide` class to set ts
|
|
696
|
+
* Enables the `Slide` class to set pptx-ts [Presentation] master/layout slidenumbers
|
|
697
697
|
* @param {SlideNumberProps} slideNum - slide number config
|
|
698
698
|
*/
|
|
699
699
|
private readonly setSlideNumber;
|
|
@@ -849,9 +849,11 @@ declare class PresentationCore {
|
|
|
849
849
|
/**
|
|
850
850
|
* Export the current Presentation as ZIP content with the selected type
|
|
851
851
|
* @param {WriteProps} props output properties
|
|
852
|
-
* @returns
|
|
852
|
+
* @returns file content in the selected type: a `Blob` when `outputType` is left out, else
|
|
853
|
+
* the {@link WriteOutputMap} entry for it
|
|
854
|
+
* @example const bytes = await pptx.write({ outputType: 'uint8array' }) // Uint8Array, no cast
|
|
853
855
|
*/
|
|
854
|
-
write(props?: WriteProps): Promise<
|
|
856
|
+
write<T extends WRITE_OUTPUT_TYPE = 'blob'>(props?: WriteProps<T>): Promise<WriteOutputMap[T]>;
|
|
855
857
|
/**
|
|
856
858
|
* Assemble the current Presentation into its OOXML package parts WITHOUT zipping — the raw
|
|
857
859
|
* `path → bytes` contents `write()` would compress into the `.pptx`. Use this to stream parts
|
|
@@ -922,7 +924,7 @@ declare function renderImageObject(ctx: RenderContext): string;
|
|
|
922
924
|
//#endregion
|
|
923
925
|
//#region src/families/core.d.ts
|
|
924
926
|
/**
|
|
925
|
-
* ts
|
|
927
|
+
* pptx-ts: the construct families every presentation carries
|
|
926
928
|
*
|
|
927
929
|
* The core tier. A composed presentation gets these whether it asks for them or not, so
|
|
928
930
|
* `createPresentation()` with no families still authors text, shapes, images, groups and speaker
|
|
@@ -1043,4 +1045,4 @@ interface ComposeOptions<Fs extends readonly ConstructFamily[]> {
|
|
|
1043
1045
|
type Composed<Fs extends readonly ConstructFamily[]> = ComposedPresentation<SlideMethodsOf<[...typeof CORE_CONSTRUCT_FAMILIES, ...Fs]>, PresentationMethodsOf<[...typeof CORE_CONSTRUCT_FAMILIES, ...Fs]>>;
|
|
1044
1046
|
//#endregion
|
|
1045
1047
|
export { pixelsToEmu as A, StandardLayoutName as C, emuToPoints as D, emuToPixels as E, ptToHundredths as M, inchesToEmu as O, StandardLayout as S, emuToInches as T, HUNDREDTHS_PER_POINT as _, renderImageObject as a, PERCENT_SCALE as b, ConstructFamily as c, PartContributor as d, RenderContext as f, FIXED_PCT_PER_PERCENT as g, Emu as h, ComposedSlide as i, pointsToEmu as j, percentToEmu as k, PresentationAuthorContext as l, DEFAULT_PX_PER_INCH as m, Composed as n, renderTextObject as o, ANGLE_UNITS_PER_DEGREE as p, ComposedPresentation as r, PresentationCore as s, ComposeOptions as t, SlideBuilder as u, MAX_COORDINATE_EMU as v, coordToEmu as w, STANDARD_LAYOUTS as x, MIN_COORDINATE_EMU as y };
|
|
1046
|
-
//# sourceMappingURL=entry-compose-
|
|
1048
|
+
//# sourceMappingURL=entry-compose-6hF9aTmT.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-compose-
|
|
1
|
+
{"version":3,"file":"entry-compose-6hF9aTmT.d.ts","names":[],"sources":["../src/runtime/types.ts","../src/units.ts","../src/gen/oxml/el.ts","../src/gen/slide/objects/shared.ts","../src/gen/opc/content-types.ts","../src/package/parts/shared.ts","../src/slide.ts","../src/families/shared.ts","../src/presentation.ts","../src/gen/slide/objects/text.ts","../src/gen/slide/objects/image.ts","../src/families/core.ts","../src/entry-compose.ts"],"mappings":";;;;;;;;;KAIY;WACF,qBAAqB;;;;;;;;;;;;EAY9B,YAAY,KAAK;IAAkB;QAAmB;;;;;;;;;EAStD,sBAAsB,KAAK,kBAAkB,QAAQ;EACrD,YAAY,kBAAkB,eAAe,cAAc,OAAO,eAAe;;;;;;;EAOjF,eAAe,mBAAmB,QAAQ;;;;;;;;;cClB9B;;;;;;cAOA;;;;;;;cAQA;;;;;;cAOA;;;;;iBAMG,eAAe;;;;;;;;;KAanB;WAA0B;;;;cASzB;;;;;cAMA;;cAGA;KAED;UAEK;;WAEP,QAAQ;;WAER;;WAEA;;WAEA;;WAEA;;WAEA;;iBAGM,YAAY,iBAAiB;iBAK7B,YAAY,iBAAiB;iBAK7B,YAAY,gBAAgB,cAAc;;;;;;;;;;;;;iBAkB1C,aAAa,iBAAiB,kBAAkB;;;;;;;;;;;;;;;iBAoBhD,WAAW,wBAAwB,kBAAkB;iBAoCrD,YAAY;;;;;;;;;;;;;;;;;;;;iBAwBZ,YAAY;;;;;;;;;iBAaZ,YAAY,aAAa;cAiB5B,kBAAkB,SAAS,OAAO,oBAAoB;;;;KC7LvD,WAAW;;;;;;;;;;;;;;;;;;;;;UCDN;;E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|
|
3
|
-
* ts
|
|
3
|
+
* pptx-ts Enums
|
|
4
4
|
* NOTE: `enum` wont work for objects, so use `Object.freeze`
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
@@ -295,7 +295,7 @@ declare const EXTRA_SHAPE_PRESETS: readonly ['straightConnector1', 'bentConnecto
|
|
|
295
295
|
*/
|
|
296
296
|
type CONNECTOR_PRESET_NAME = (typeof EXTRA_SHAPE_PRESETS)[number];
|
|
297
297
|
/**
|
|
298
|
-
* Every shape geometry name ts
|
|
298
|
+
* Every shape geometry name pptx-ts can serialize without corrupting the
|
|
299
299
|
* package: the OOXML preset geometries (`ST_ShapeType` — `ShapeType` values
|
|
300
300
|
* plus the unexposed connectors above) and `custGeom` (freeform paths, emitted
|
|
301
301
|
* as `<a:custGeom>` rather than `<a:prstGeom>`). Used to reject bogus presets
|
|
@@ -468,4 +468,4 @@ declare enum TableStyle {
|
|
|
468
468
|
}
|
|
469
469
|
//#endregion
|
|
470
470
|
export { isChartType as C, isChartExType as S, VALID_SHAPE_PRESETS as _, CONNECTOR_PRESET_NAME as a, asChartType as b, PLACEHOLDER_TYPE as c, SHAPE_NAME as d, SchemeColor as f, TextAnchor as g, TableStyle as h, CHART_NAME as i, PlaceholderType as l, SlideObjectType as m, AlignV as n, ChartType as o, ShapeType as p, BulletType as r, OutputType as s, AlignH as t, SCHEME_COLORS as u, WRITE_OUTPUT_TYPE as v, connectorPresetFor as x, ZIP_OUTPUT_TYPE as y };
|
|
471
|
-
//# sourceMappingURL=enums-
|
|
471
|
+
//# sourceMappingURL=enums-DQRpVOLh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums-
|
|
1
|
+
{"version":3,"file":"enums-DQRpVOLh.d.ts","names":[],"sources":["../src/enums.ts"],"mappings":";;;;;;;;;;KAUY,qBAAqB;KACrB,oBAAoB;;;;;;KAMpB,gBAAgB;;;;;KAKhB,mBAAmB;aAEnB;EACX;EACA;EACA;;aAIW;EACX;EACA;EACA;EACA;EACA;EACA;;aAEW;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;aAEW;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;aAEW;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;aAEW;EACX;EACA;EACA;EACA;;;;;;;;;aASW;EACX;EACA;EACA;;;;;;;;;;;;;KAcW,gBAAgB,cAAc;;;;;;cAOpC;;;;;;;;;KAoBM,gCAAgC;;;;;;;;;cAU/B,qBAAqB;;;;;;;;iBAYlB,YAAY,MAAM,aAAa;;;;;;;;;;iBAgB/B,YAAY,gBAAgB,QAAQ;;;;;;iBA4BpC,cAAc;aAIlB;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;iBA4Be,mBAAmB,uCAAuC,gBAAgB;aAI9E;EACX;EACA;EACA;EACA;EACA;EACA;;;;;;KAMW,sBAAsB;;;;;aAMtB;EACX;EACA;EACA;EACA;;;;;;;;;;;;aAaW;EAEX;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;;EAEA;;EAEA;;EAEA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/diagnostics.ts
|
|
2
2
|
/** Prefix stamped on every warning so consumers can attribute console noise to this library. */
|
|
3
|
-
const WARN_PREFIX = "ts
|
|
3
|
+
const WARN_PREFIX = "pptx-ts";
|
|
4
4
|
/** The default handler: one `console.warn` line per diagnostic, prefixed. */
|
|
5
5
|
const consoleHandler = (diagnostic) => {
|
|
6
6
|
console.warn(`${WARN_PREFIX}: ${diagnostic.message}`);
|
|
@@ -34,7 +34,7 @@ function setDiagnosticHandler(next) {
|
|
|
34
34
|
/**
|
|
35
35
|
* Emit a library diagnostic.
|
|
36
36
|
* @param code - the stable condition identifier ({@link DiagnosticCode})
|
|
37
|
-
* @param message - explanation, without a `ts
|
|
37
|
+
* @param message - explanation, without a `pptx-ts:` prefix (the default handler adds one)
|
|
38
38
|
* @param detail - optional structured context
|
|
39
39
|
*/
|
|
40
40
|
function warn(code, message, detail) {
|
|
@@ -90,7 +90,7 @@ function resetDiagnosticState() {
|
|
|
90
90
|
//#endregion
|
|
91
91
|
//#region src/errors.ts
|
|
92
92
|
/**
|
|
93
|
-
* Base class for every error ts
|
|
93
|
+
* Base class for every error pptx-ts throws.
|
|
94
94
|
*
|
|
95
95
|
* Catch this to catch anything from the library; narrow with `instanceof` on a subclass, or branch
|
|
96
96
|
* on {@link TsPptxError.code}, to react to something specific. It is never thrown directly — every
|
|
@@ -173,12 +173,12 @@ var MediaError = class extends TsPptxError {
|
|
|
173
173
|
* one, and an agent that hits a library defect routes around it silently unless something in front
|
|
174
174
|
* of it says the report is worth making.
|
|
175
175
|
*/
|
|
176
|
-
const REPORT_NOTICE = "This is a bug in ts
|
|
176
|
+
const REPORT_NOTICE = "This is a bug in pptx-ts, not in your deck or your code. Please report it:\nhttps://github.com/shbernal/pptx-ts/issues/new?template=agent-report.yml";
|
|
177
177
|
/**
|
|
178
178
|
* An invariant the library maintains itself did not hold.
|
|
179
179
|
*
|
|
180
180
|
* No consumer input should be able to produce one, which is the whole reason it is a separate
|
|
181
|
-
* class: seeing it means the bug is in ts
|
|
181
|
+
* class: seeing it means the bug is in pptx-ts, and the useful response is to file it rather than
|
|
182
182
|
* to keep adjusting the input.
|
|
183
183
|
*
|
|
184
184
|
* It is the one class in the taxonomy that extends its own message, appending `REPORT_NOTICE`
|
|
@@ -199,4 +199,4 @@ var InternalError = class extends TsPptxError {
|
|
|
199
199
|
//#endregion
|
|
200
200
|
export { TsPptxError as a, setDiagnosticHandler as c, PackageReadError as i, warn as l, InvalidOptionError as n, UnsupportedFeatureError as o, MediaError as r, resetDiagnosticState as s, InternalError as t, warnOnce as u };
|
|
201
201
|
|
|
202
|
-
//# sourceMappingURL=errors-
|
|
202
|
+
//# sourceMappingURL=errors-Da2nXCJm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-C4oENPcu.js","names":[],"sources":["../src/diagnostics.ts","../src/errors.ts"],"sourcesContent":["/**\n * Central sink for library diagnostics.\n *\n * Every user-facing warning is routed through {@link warn} / {@link warnOnce} rather than calling\n * `console.warn` directly, so there is one place to apply a consistent prefix and one place a\n * consumer can take over — see {@link setDiagnosticHandler}. This module has no *runtime* imports\n * so it can be used from anywhere without risking an import cycle; `codes.ts` is types only and is\n * erased at compile time, so it does not cost that property.\n *\n * **A diagnostic's `code` is API; its `message` is not.** The code is a stable identifier a\n * consumer may branch on (`if (d.code === 'chart/non-finite-value')`); the wording behind it is\n * free to improve in any release. The vocabulary lives in `codes.ts` and is shared with the thrown\n * surface (`errors.ts`), so a condition that can both warn and throw reads the same either way.\n */\n\nimport type { DiagnosticCode } from './codes.js'\n\nexport type { DiagnosticCode }\n\n/** One diagnostic emitted by the library. */\nexport interface Diagnostic {\n\t/** Stable condition identifier — see {@link DiagnosticCode}. Branch on this, not on the text. */\n\treadonly code: DiagnosticCode\n\t/** Human-readable explanation. Free to change in any release; do not parse it. */\n\treadonly message: string\n\t/**\n\t * Structured context for the condition, when a site has any to give.\n\t *\n\t * Every rejection of an `ST_` enum value populates it: `checkEnumOrWarn` (`ooxml/check-enum.ts`)\n\t * carries `received` — the value the caller passed — and `valid`, the whole legal list, plus\n\t * whatever the call site adds. That reaches a handler for a line dash type, a table cell's 3-D\n\t * preset and a table's horizontal overflow, among others. Nothing else populates it yet, so a\n\t * handler must still treat the field as optional and must not assume a particular key is there\n\t * for a given code.\n\t */\n\treadonly detail?: Readonly<Record<string, unknown>>\n}\n\n/** Receives every {@link Diagnostic} the library emits. See {@link setDiagnosticHandler}. */\nexport type DiagnosticHandler = (diagnostic: Diagnostic) => void\n\n/** Prefix stamped on every warning so consumers can attribute console noise to this library. */\nconst WARN_PREFIX = 'ts-pptx'\n\n/** The default handler: one `console.warn` line per diagnostic, prefixed. */\nconst consoleHandler: DiagnosticHandler = (diagnostic) => {\n\tconsole.warn(`${WARN_PREFIX}: ${diagnostic.message}`)\n}\n\nlet handler: DiagnosticHandler = consoleHandler\n\n/**\n * Route every library diagnostic to `handler`, or pass `null` to restore the default\n * (one prefixed `console.warn` per diagnostic).\n *\n * This is process-global rather than per-presentation, deliberately: the emitting code is a tree\n * of free functions in `gen/**` with no presentation in scope, and threading a handler through\n * every signature would be a far larger and worse change than the problem warrants. The practical\n * consequence is that a process building several decks concurrently cannot attribute a diagnostic\n * to one of them. If that matters, correlate on `code`, or build the decks one at a time with the\n * handler set around each build: a handler set around concurrent builds sees all of their\n * diagnostics.\n *\n * A throwing handler propagates out of whatever library call emitted the diagnostic, which is the\n * supported way to make a specific condition fatal:\n *\n * ```ts\n * setDiagnosticHandler((d) => {\n * if (d.code === 'coord/bare-number-is-inches') throw new Error(d.message)\n * })\n * ```\n * @param next - the receiver, or `null` to restore the console default\n */\nexport function setDiagnosticHandler(next: DiagnosticHandler | null): void {\n\thandler = next ?? consoleHandler\n}\n\n/**\n * Emit a library diagnostic.\n * @param code - the stable condition identifier ({@link DiagnosticCode})\n * @param message - explanation, without a `ts-pptx:` prefix (the default handler adds one)\n * @param detail - optional structured context\n */\nexport function warn(code: DiagnosticCode, message: string, detail?: Readonly<Record<string, unknown>>): void {\n\thandler(detail === undefined ? { code, message } : { code, message, detail })\n}\n\n// Track diagnostics already emitted so a recurring condition (e.g. the same out-of-range fontSize\n// on every cell of a table) is reported once instead of flooding the handler. Keyed on code AND\n// message, so a *different* offending value under the same code still reports.\nconst seen = new Set<string>()\n\n/**\n * Emit a library diagnostic at most once per distinct code+message.\n *\n * \"Once\" is **process-global**, the same scope {@link setDiagnosticHandler} has and for the\n * same reason: the emitting code is a tree of free functions in `gen/**` with no presentation\n * in scope. The consequence is different, though, and worth stating on its own — a process that\n * builds several decks does not get a second report of a condition an earlier deck already\n * tripped, so the second deck's diagnostics are incomplete rather than merely unattributed.\n * {@link resetDiagnosticState} is how a host that cares gets each build a clean slate.\n *\n * @param code - the stable condition identifier ({@link DiagnosticCode})\n * @param message - explanation (see {@link warn})\n * @param detail - optional structured context\n */\nexport function warnOnce(code: DiagnosticCode, message: string, detail?: Readonly<Record<string, unknown>>): void {\n\tconst key = `${code}\\0${message}`\n\tif (seen.has(key)) return\n\tseen.add(key)\n\twarn(code, message, detail)\n}\n\n/**\n * Clear the `warnOnce` dedupe set, so a condition already reported reports again. (`warnOnce` is\n * internal and carries no page of its own, so it is named rather than linked.)\n *\n * Call it between builds in a host that builds more than one deck per process and wants each\n * build's diagnostics complete. Without it, deck two is silent about anything deck one already\n * warned for, which reads as \"no problems found\" rather than as \"already mentioned\".\n *\n * It also bounds the set. Most `warnOnce` messages interpolate the offending value, so a server\n * building decks from user input accumulates one entry per distinct bad value with no way to\n * release them.\n *\n * This does not touch the handler — {@link setDiagnosticHandler} owns that, and the two are\n * reset independently on purpose: a host usually installs its handler once and wants it to\n * survive.\n */\nexport function resetDiagnosticState(): void {\n\tseen.clear()\n}\n","/**\n * The library's error taxonomy.\n *\n * Every failure ts-pptx raises is a {@link TsPptxError} carrying a stable {@link ErrorCode}, so a\n * consumer can tell *\"you passed a bad coordinate\"* from *\"this font file is corrupt\"* from\n * *\"these bytes are not a package\"* without matching on message substrings. The classes are a\n * deliberately flat, coarse bucket — five of them — and the code carries the specificity. Do not\n * add a class per throw site; add a code.\n *\n * **The class and the code are API. The message is not.** Branch on `instanceof` and on `code`;\n * the wording behind them is free to improve in any release. Every error remains an\n * `instanceof Error`, so existing `catch` blocks keep working.\n *\n * Which class to reach for:\n *\n * | class | the failure is | who fixes it |\n * |---|---|---|\n * | {@link InvalidOptionError} | the caller passed something unusable | the caller's code |\n * | {@link UnsupportedFeatureError} | a well-formed request this build/runtime/shape cannot express | the caller's expectations, or the environment |\n * | {@link PackageReadError} | the input bytes are not a readable package | the input file |\n * | {@link MediaError} | a referenced image/font/AV resource would not load or decode | the resource |\n * | {@link InternalError} | an invariant of the library itself did not hold | ts-pptx (file a bug) |\n *\n * **Which of these is worth reporting upstream.** `InternalError` always is, and says so at\n * runtime. The middle three are worth reporting when the environment disagrees with us:\n * a `PackageReadError` on a file that opens cleanly in PowerPoint, a `MediaError` on an asset every\n * other tool loads, an `UnsupportedFeatureError` for something PowerPoint can plainly express.\n * `InvalidOptionError` is worth reporting only if the deck it refused is one PowerPoint can\n * express. See `skills/ts-pptx-upstream` for how to file one.\n *\n * @see `docs/errors-and-warnings.md` for the consumer-facing contract.\n * @see `codes.ts` for the code vocabulary, which is shared with the diagnostic (warning) surface.\n */\n\nimport type {\n\tErrorCode,\n\tInternalErrorCode,\n\tInvalidOptionErrorCode,\n\tMediaErrorCode,\n\tPackageReadErrorCode,\n\tUnsupportedFeatureErrorCode,\n} from './codes.js'\n\n/** Extra context accepted by every {@link TsPptxError} constructor. */\nexport interface TsPptxErrorOptions extends ErrorOptions {\n\t/**\n\t * Structured context for the condition, when a site has any to give. Mirrors `Diagnostic.detail`\n\t * so the same condition looks the same whether it was warned or thrown.\n\t */\n\treadonly detail?: Readonly<Record<string, unknown>>\n}\n\n/**\n * Base class for every error ts-pptx throws.\n *\n * Catch this to catch anything from the library; narrow with `instanceof` on a subclass, or branch\n * on {@link TsPptxError.code}, to react to something specific. It is never thrown directly — every\n * site picks one of the five subclasses.\n */\nexport class TsPptxError extends Error {\n\t/** Stable condition identifier — see {@link ErrorCode}. Branch on this, not on the text. */\n\treadonly code: ErrorCode\n\n\t/** Structured context for the condition, when the throwing site had any to give. */\n\treadonly detail?: Readonly<Record<string, unknown>>\n\n\t/**\n\t * @param code - the stable condition identifier\n\t * @param message - explanation for a human reading a stack trace; not part of the contract\n\t * @param options - standard `cause`, plus optional structured `detail`\n\t */\n\tconstructor(code: ErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(message, options)\n\t\t// `name` drives how a stack trace and `console.log` label the error, and the default from\n\t\t// `Error` would say \"Error\" for every subclass. Derive it from the constructor so a subclass\n\t\t// never has to remember to set it.\n\t\tthis.name = new.target.name\n\t\tthis.code = code\n\t\tif (options?.detail !== undefined) this.detail = options.detail\n\t}\n}\n\n/**\n * The caller passed something the library cannot use — a non-finite coordinate, an unknown enum\n * value, a required option left out, a value outside its legal range.\n *\n * This is the error behind the project's throw-rather-than-coerce policy: emitting a degenerate\n * result (a zero-size shape, a silently dropped option) hides the mistake, so the library refuses\n * instead. Reaching one means the calling code needs to change.\n */\nexport class InvalidOptionError extends TsPptxError {\n\tdeclare readonly code: InvalidOptionErrorCode\n\tconstructor(code: InvalidOptionErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(code, message, options)\n\t}\n}\n\n/**\n * The request is well-formed but cannot be expressed here: an optional peer dependency is not\n * installed, the runtime lacks a capability, or the shape/feature has no OOXML representation the\n * library emits.\n *\n * Distinct from {@link InvalidOptionError} because the caller did nothing wrong — the answer is\n * \"not here\", not \"not like that\" — and the fix is usually to install something or pick a different\n * approach rather than to correct a value.\n */\nexport class UnsupportedFeatureError extends TsPptxError {\n\tdeclare readonly code: UnsupportedFeatureErrorCode\n\tconstructor(code: UnsupportedFeatureErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(code, message, options)\n\t}\n}\n\n/**\n * The bytes handed to the library are not a package it can read, or a part inside one is\n * structurally malformed — a missing `[Content_Types].xml`, a relationship pointing at nothing, a\n * slide part with no root element.\n *\n * Always about *input*. A problem with something the library is being asked to produce is an\n * {@link InvalidOptionError}.\n */\nexport class PackageReadError extends TsPptxError {\n\tdeclare readonly code: PackageReadErrorCode\n\tconstructor(code: PackageReadErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(code, message, options)\n\t}\n}\n\n/**\n * A referenced image, font, or audio/video resource could not be fetched, read, or decoded.\n *\n * Kept apart from {@link PackageReadError} because the failure is in a resource the deck *points\n * at*, not in the package structure — a broken URL, an unreadable path, a corrupt font file — and\n * a consumer typically retries or substitutes rather than rejecting the deck.\n */\nexport class MediaError extends TsPptxError {\n\tdeclare readonly code: MediaErrorCode\n\tconstructor(code: MediaErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(code, message, options)\n\t}\n}\n\n/**\n * Where a report of an `InternalError` should go. Appended to the message rather than left to the\n * docs, because a stack trace is the only artefact of the failure that reaches whoever (or\n * whatever) is debugging it — a pointer anywhere else is a pointer they have to already be looking\n * for. Most code that calls this library is written by an agent in a repository that is not this\n * one, and an agent that hits a library defect routes around it silently unless something in front\n * of it says the report is worth making.\n */\nconst REPORT_NOTICE =\n\t'This is a bug in ts-pptx, not in your deck or your code. Please report it:\\n' +\n\t'https://github.com/shbernal/ts-pptx/issues/new?template=agent-report.yml'\n\n/**\n * An invariant the library maintains itself did not hold.\n *\n * No consumer input should be able to produce one, which is the whole reason it is a separate\n * class: seeing it means the bug is in ts-pptx, and the useful response is to file it rather than\n * to keep adjusting the input.\n *\n * It is the one class in the taxonomy that extends its own message, appending `REPORT_NOTICE`\n * below the invariant that broke. The constructor is where that lives so a throw site added later\n * inherits it — the alternative, a notice pasted at each of the sites, is one every future site can\n * forget. Every other class leaves `message` exactly as given: a malformed package is the routine\n * outcome for a library that reads untrusted files, and a \"report this\" banner on each corrupt\n * input would train callers to ignore the one banner that always means something.\n *\n * This does not make the message API — see the class doc on {@link TsPptxError}. Branch on\n * `instanceof` or on {@link InternalError.code}, never on the text.\n */\nexport class InternalError extends TsPptxError {\n\tdeclare readonly code: InternalErrorCode\n\tconstructor(code: InternalErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(code, `${message}\\n\\n${REPORT_NOTICE}`, options)\n\t}\n}\n"],"mappings":";;AA0CA,MAAM,cAAc;;AAGpB,MAAM,kBAAqC,eAAe;CACzD,QAAQ,KAAK,GAAG,YAAY,IAAI,WAAW,SAAS;AACrD;AAEA,IAAI,UAA6B;;;;;;;;;;;;;;;;;;;;;;;AAwBjC,SAAgB,qBAAqB,MAAsC;CAC1E,UAAU,QAAQ;AACnB;;;;;;;AAQA,SAAgB,KAAK,MAAsB,SAAiB,QAAkD;CAC7G,QAAQ,WAAW,KAAA,IAAY;EAAE;EAAM;CAAQ,IAAI;EAAE;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"file":"errors-Da2nXCJm.js","names":[],"sources":["../src/diagnostics.ts","../src/errors.ts"],"sourcesContent":["/**\n * Central sink for library diagnostics.\n *\n * Every user-facing warning is routed through {@link warn} / {@link warnOnce} rather than calling\n * `console.warn` directly, so there is one place to apply a consistent prefix and one place a\n * consumer can take over — see {@link setDiagnosticHandler}. This module has no *runtime* imports\n * so it can be used from anywhere without risking an import cycle; `codes.ts` is types only and is\n * erased at compile time, so it does not cost that property.\n *\n * **A diagnostic's `code` is API; its `message` is not.** The code is a stable identifier a\n * consumer may branch on (`if (d.code === 'chart/non-finite-value')`); the wording behind it is\n * free to improve in any release. The vocabulary lives in `codes.ts` and is shared with the thrown\n * surface (`errors.ts`), so a condition that can both warn and throw reads the same either way.\n */\n\nimport type { DiagnosticCode } from './codes.js'\n\nexport type { DiagnosticCode }\n\n/** One diagnostic emitted by the library. */\nexport interface Diagnostic {\n\t/** Stable condition identifier — see {@link DiagnosticCode}. Branch on this, not on the text. */\n\treadonly code: DiagnosticCode\n\t/** Human-readable explanation. Free to change in any release; do not parse it. */\n\treadonly message: string\n\t/**\n\t * Structured context for the condition, when a site has any to give.\n\t *\n\t * Every rejection of an `ST_` enum value populates it: `checkEnumOrWarn` (`ooxml/check-enum.ts`)\n\t * carries `received` — the value the caller passed — and `valid`, the whole legal list, plus\n\t * whatever the call site adds. That reaches a handler for a line dash type, a table cell's 3-D\n\t * preset and a table's horizontal overflow, among others. Nothing else populates it yet, so a\n\t * handler must still treat the field as optional and must not assume a particular key is there\n\t * for a given code.\n\t */\n\treadonly detail?: Readonly<Record<string, unknown>>\n}\n\n/** Receives every {@link Diagnostic} the library emits. See {@link setDiagnosticHandler}. */\nexport type DiagnosticHandler = (diagnostic: Diagnostic) => void\n\n/** Prefix stamped on every warning so consumers can attribute console noise to this library. */\nconst WARN_PREFIX = 'pptx-ts'\n\n/** The default handler: one `console.warn` line per diagnostic, prefixed. */\nconst consoleHandler: DiagnosticHandler = (diagnostic) => {\n\tconsole.warn(`${WARN_PREFIX}: ${diagnostic.message}`)\n}\n\nlet handler: DiagnosticHandler = consoleHandler\n\n/**\n * Route every library diagnostic to `handler`, or pass `null` to restore the default\n * (one prefixed `console.warn` per diagnostic).\n *\n * This is process-global rather than per-presentation, deliberately: the emitting code is a tree\n * of free functions in `gen/**` with no presentation in scope, and threading a handler through\n * every signature would be a far larger and worse change than the problem warrants. The practical\n * consequence is that a process building several decks concurrently cannot attribute a diagnostic\n * to one of them. If that matters, correlate on `code`, or build the decks one at a time with the\n * handler set around each build: a handler set around concurrent builds sees all of their\n * diagnostics.\n *\n * A throwing handler propagates out of whatever library call emitted the diagnostic, which is the\n * supported way to make a specific condition fatal:\n *\n * ```ts\n * setDiagnosticHandler((d) => {\n * if (d.code === 'coord/bare-number-is-inches') throw new Error(d.message)\n * })\n * ```\n * @param next - the receiver, or `null` to restore the console default\n */\nexport function setDiagnosticHandler(next: DiagnosticHandler | null): void {\n\thandler = next ?? consoleHandler\n}\n\n/**\n * Emit a library diagnostic.\n * @param code - the stable condition identifier ({@link DiagnosticCode})\n * @param message - explanation, without a `pptx-ts:` prefix (the default handler adds one)\n * @param detail - optional structured context\n */\nexport function warn(code: DiagnosticCode, message: string, detail?: Readonly<Record<string, unknown>>): void {\n\thandler(detail === undefined ? { code, message } : { code, message, detail })\n}\n\n// Track diagnostics already emitted so a recurring condition (e.g. the same out-of-range fontSize\n// on every cell of a table) is reported once instead of flooding the handler. Keyed on code AND\n// message, so a *different* offending value under the same code still reports.\nconst seen = new Set<string>()\n\n/**\n * Emit a library diagnostic at most once per distinct code+message.\n *\n * \"Once\" is **process-global**, the same scope {@link setDiagnosticHandler} has and for the\n * same reason: the emitting code is a tree of free functions in `gen/**` with no presentation\n * in scope. The consequence is different, though, and worth stating on its own — a process that\n * builds several decks does not get a second report of a condition an earlier deck already\n * tripped, so the second deck's diagnostics are incomplete rather than merely unattributed.\n * {@link resetDiagnosticState} is how a host that cares gets each build a clean slate.\n *\n * @param code - the stable condition identifier ({@link DiagnosticCode})\n * @param message - explanation (see {@link warn})\n * @param detail - optional structured context\n */\nexport function warnOnce(code: DiagnosticCode, message: string, detail?: Readonly<Record<string, unknown>>): void {\n\tconst key = `${code}\\0${message}`\n\tif (seen.has(key)) return\n\tseen.add(key)\n\twarn(code, message, detail)\n}\n\n/**\n * Clear the `warnOnce` dedupe set, so a condition already reported reports again. (`warnOnce` is\n * internal and carries no page of its own, so it is named rather than linked.)\n *\n * Call it between builds in a host that builds more than one deck per process and wants each\n * build's diagnostics complete. Without it, deck two is silent about anything deck one already\n * warned for, which reads as \"no problems found\" rather than as \"already mentioned\".\n *\n * It also bounds the set. Most `warnOnce` messages interpolate the offending value, so a server\n * building decks from user input accumulates one entry per distinct bad value with no way to\n * release them.\n *\n * This does not touch the handler — {@link setDiagnosticHandler} owns that, and the two are\n * reset independently on purpose: a host usually installs its handler once and wants it to\n * survive.\n */\nexport function resetDiagnosticState(): void {\n\tseen.clear()\n}\n","/**\n * The library's error taxonomy.\n *\n * Every failure pptx-ts raises is a {@link TsPptxError} carrying a stable {@link ErrorCode}, so a\n * consumer can tell *\"you passed a bad coordinate\"* from *\"this font file is corrupt\"* from\n * *\"these bytes are not a package\"* without matching on message substrings. The classes are a\n * deliberately flat, coarse bucket — five of them — and the code carries the specificity. Do not\n * add a class per throw site; add a code.\n *\n * **The class and the code are API. The message is not.** Branch on `instanceof` and on `code`;\n * the wording behind them is free to improve in any release. Every error remains an\n * `instanceof Error`, so existing `catch` blocks keep working.\n *\n * Which class to reach for:\n *\n * | class | the failure is | who fixes it |\n * |---|---|---|\n * | {@link InvalidOptionError} | the caller passed something unusable | the caller's code |\n * | {@link UnsupportedFeatureError} | a well-formed request this build/runtime/shape cannot express | the caller's expectations, or the environment |\n * | {@link PackageReadError} | the input bytes are not a readable package | the input file |\n * | {@link MediaError} | a referenced image/font/AV resource would not load or decode | the resource |\n * | {@link InternalError} | an invariant of the library itself did not hold | pptx-ts (file a bug) |\n *\n * **Which of these is worth reporting upstream.** `InternalError` always is, and says so at\n * runtime. The middle three are worth reporting when the environment disagrees with us:\n * a `PackageReadError` on a file that opens cleanly in PowerPoint, a `MediaError` on an asset every\n * other tool loads, an `UnsupportedFeatureError` for something PowerPoint can plainly express.\n * `InvalidOptionError` is worth reporting only if the deck it refused is one PowerPoint can\n * express. See `skills/ts-pptx-upstream` for how to file one.\n *\n * @see `docs/errors-and-warnings.md` for the consumer-facing contract.\n * @see `codes.ts` for the code vocabulary, which is shared with the diagnostic (warning) surface.\n */\n\nimport type {\n\tErrorCode,\n\tInternalErrorCode,\n\tInvalidOptionErrorCode,\n\tMediaErrorCode,\n\tPackageReadErrorCode,\n\tUnsupportedFeatureErrorCode,\n} from './codes.js'\n\n/** Extra context accepted by every {@link TsPptxError} constructor. */\nexport interface TsPptxErrorOptions extends ErrorOptions {\n\t/**\n\t * Structured context for the condition, when a site has any to give. Mirrors `Diagnostic.detail`\n\t * so the same condition looks the same whether it was warned or thrown.\n\t */\n\treadonly detail?: Readonly<Record<string, unknown>>\n}\n\n/**\n * Base class for every error pptx-ts throws.\n *\n * Catch this to catch anything from the library; narrow with `instanceof` on a subclass, or branch\n * on {@link TsPptxError.code}, to react to something specific. It is never thrown directly — every\n * site picks one of the five subclasses.\n */\nexport class TsPptxError extends Error {\n\t/** Stable condition identifier — see {@link ErrorCode}. Branch on this, not on the text. */\n\treadonly code: ErrorCode\n\n\t/** Structured context for the condition, when the throwing site had any to give. */\n\treadonly detail?: Readonly<Record<string, unknown>>\n\n\t/**\n\t * @param code - the stable condition identifier\n\t * @param message - explanation for a human reading a stack trace; not part of the contract\n\t * @param options - standard `cause`, plus optional structured `detail`\n\t */\n\tconstructor(code: ErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(message, options)\n\t\t// `name` drives how a stack trace and `console.log` label the error, and the default from\n\t\t// `Error` would say \"Error\" for every subclass. Derive it from the constructor so a subclass\n\t\t// never has to remember to set it.\n\t\tthis.name = new.target.name\n\t\tthis.code = code\n\t\tif (options?.detail !== undefined) this.detail = options.detail\n\t}\n}\n\n/**\n * The caller passed something the library cannot use — a non-finite coordinate, an unknown enum\n * value, a required option left out, a value outside its legal range.\n *\n * This is the error behind the project's throw-rather-than-coerce policy: emitting a degenerate\n * result (a zero-size shape, a silently dropped option) hides the mistake, so the library refuses\n * instead. Reaching one means the calling code needs to change.\n */\nexport class InvalidOptionError extends TsPptxError {\n\tdeclare readonly code: InvalidOptionErrorCode\n\tconstructor(code: InvalidOptionErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(code, message, options)\n\t}\n}\n\n/**\n * The request is well-formed but cannot be expressed here: an optional peer dependency is not\n * installed, the runtime lacks a capability, or the shape/feature has no OOXML representation the\n * library emits.\n *\n * Distinct from {@link InvalidOptionError} because the caller did nothing wrong — the answer is\n * \"not here\", not \"not like that\" — and the fix is usually to install something or pick a different\n * approach rather than to correct a value.\n */\nexport class UnsupportedFeatureError extends TsPptxError {\n\tdeclare readonly code: UnsupportedFeatureErrorCode\n\tconstructor(code: UnsupportedFeatureErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(code, message, options)\n\t}\n}\n\n/**\n * The bytes handed to the library are not a package it can read, or a part inside one is\n * structurally malformed — a missing `[Content_Types].xml`, a relationship pointing at nothing, a\n * slide part with no root element.\n *\n * Always about *input*. A problem with something the library is being asked to produce is an\n * {@link InvalidOptionError}.\n */\nexport class PackageReadError extends TsPptxError {\n\tdeclare readonly code: PackageReadErrorCode\n\tconstructor(code: PackageReadErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(code, message, options)\n\t}\n}\n\n/**\n * A referenced image, font, or audio/video resource could not be fetched, read, or decoded.\n *\n * Kept apart from {@link PackageReadError} because the failure is in a resource the deck *points\n * at*, not in the package structure — a broken URL, an unreadable path, a corrupt font file — and\n * a consumer typically retries or substitutes rather than rejecting the deck.\n */\nexport class MediaError extends TsPptxError {\n\tdeclare readonly code: MediaErrorCode\n\tconstructor(code: MediaErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(code, message, options)\n\t}\n}\n\n/**\n * Where a report of an `InternalError` should go. Appended to the message rather than left to the\n * docs, because a stack trace is the only artefact of the failure that reaches whoever (or\n * whatever) is debugging it — a pointer anywhere else is a pointer they have to already be looking\n * for. Most code that calls this library is written by an agent in a repository that is not this\n * one, and an agent that hits a library defect routes around it silently unless something in front\n * of it says the report is worth making.\n */\nconst REPORT_NOTICE =\n\t'This is a bug in pptx-ts, not in your deck or your code. Please report it:\\n' +\n\t'https://github.com/shbernal/pptx-ts/issues/new?template=agent-report.yml'\n\n/**\n * An invariant the library maintains itself did not hold.\n *\n * No consumer input should be able to produce one, which is the whole reason it is a separate\n * class: seeing it means the bug is in pptx-ts, and the useful response is to file it rather than\n * to keep adjusting the input.\n *\n * It is the one class in the taxonomy that extends its own message, appending `REPORT_NOTICE`\n * below the invariant that broke. The constructor is where that lives so a throw site added later\n * inherits it — the alternative, a notice pasted at each of the sites, is one every future site can\n * forget. Every other class leaves `message` exactly as given: a malformed package is the routine\n * outcome for a library that reads untrusted files, and a \"report this\" banner on each corrupt\n * input would train callers to ignore the one banner that always means something.\n *\n * This does not make the message API — see the class doc on {@link TsPptxError}. Branch on\n * `instanceof` or on {@link InternalError.code}, never on the text.\n */\nexport class InternalError extends TsPptxError {\n\tdeclare readonly code: InternalErrorCode\n\tconstructor(code: InternalErrorCode, message: string, options?: TsPptxErrorOptions) {\n\t\tsuper(code, `${message}\\n\\n${REPORT_NOTICE}`, options)\n\t}\n}\n"],"mappings":";;AA0CA,MAAM,cAAc;;AAGpB,MAAM,kBAAqC,eAAe;CACzD,QAAQ,KAAK,GAAG,YAAY,IAAI,WAAW,SAAS;AACrD;AAEA,IAAI,UAA6B;;;;;;;;;;;;;;;;;;;;;;;AAwBjC,SAAgB,qBAAqB,MAAsC;CAC1E,UAAU,QAAQ;AACnB;;;;;;;AAQA,SAAgB,KAAK,MAAsB,SAAiB,QAAkD;CAC7G,QAAQ,WAAW,KAAA,IAA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;CACtD;AACD"}
|
package/dist/families.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as SHAPE_NAME, i as CHART_NAME } from "./enums-
|
|
2
|
-
import {
|
|
3
|
-
import { L as TableToSlidesProps, M as TableProps, N as TableRow, S as AnimationProps, c as SectionZoomProps, d as ZoomBaseProps, l as SlideZoomProps, m as Model3dProps, n as GroupChildProps, r as GroupProps, v as SlideMasterChartProps } from "./slide-
|
|
4
|
-
import { T as PresSlideInternal } from "./font-metrics-
|
|
5
|
-
import { a as renderImageObject, c as ConstructFamily, d as PartContributor, f as RenderContext, l as PresentationAuthorContext, o as renderTextObject, u as SlideBuilder } from "./entry-compose-
|
|
6
|
-
import { s as ExtractedSlide } from "./presentation-types-
|
|
1
|
+
import { d as SHAPE_NAME, i as CHART_NAME } from "./enums-DQRpVOLh.js";
|
|
2
|
+
import { $ as ChartOpts, At as NotesProps, F as ConnectorProps, Ht as TextProps, It as TableLayoutResult, Jt as MediaProps, Mt as OverflowBoxOptions, Ot as CommentProps, Q as ChartMulti, St as OptsChartData, Ut as TextPropsOptions, Vt as TextMeasurement, Xt as OleObjectProps, kt as MeasureTextOptions, qt as ImageProps, rn as ShapeProps } from "./pres-BA9_lJbY.js";
|
|
3
|
+
import { L as TableToSlidesProps, M as TableProps, N as TableRow, S as AnimationProps, c as SectionZoomProps, d as ZoomBaseProps, l as SlideZoomProps, m as Model3dProps, n as GroupChildProps, r as GroupProps, v as SlideMasterChartProps } from "./slide-BqPtyKmb.js";
|
|
4
|
+
import { T as PresSlideInternal } from "./font-metrics-CBGmhLo0.js";
|
|
5
|
+
import { a as renderImageObject, c as ConstructFamily, d as PartContributor, f as RenderContext, l as PresentationAuthorContext, o as renderTextObject, u as SlideBuilder } from "./entry-compose-6hF9aTmT.js";
|
|
6
|
+
import { s as ExtractedSlide } from "./presentation-types-B3VQH4Bz.js";
|
|
7
7
|
//#region src/gen/slide/objects/chart.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Render a `chart` slide object to its `<p:graphicFrame>` XML referencing the chart part.
|
package/dist/families.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as mediaFamily, c as commentsFamily, d as textFamily, f as shapeFamily, h as groupFamily, i as model3dFamily, l as chartFamily, m as imageFamily, n as tableFamily, o as measureFamily, p as notesFamily, r as oleFamily, s as connectorFamily, t as zoomFamily, u as animationsFamily } from "./zoom-
|
|
2
|
-
import { t as tableDomFamily } from "./table-dom-
|
|
1
|
+
import { a as mediaFamily, c as commentsFamily, d as textFamily, f as shapeFamily, h as groupFamily, i as model3dFamily, l as chartFamily, m as imageFamily, n as tableFamily, o as measureFamily, p as notesFamily, r as oleFamily, s as connectorFamily, t as zoomFamily, u as animationsFamily } from "./zoom-BoNyOlPm.js";
|
|
2
|
+
import { t as tableDomFamily } from "./table-dom-CVbvUfgh.js";
|
|
3
3
|
//#region src/families.ts
|
|
4
4
|
/**
|
|
5
5
|
* The construct families, as the `pptx-ts/families` subpath publishes them.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { l as warn, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError } from "./errors-
|
|
2
|
-
import { _ as resolveCellMarginsInches, b as resolveTableColWidthsEmu, d as marginToEmu, s as getSmartParseNumber, t as autoPageLineHeightEmu, v as resolveInsetsEmu, x as resolveTableRowHeightEmu } from "./units-internal-
|
|
3
|
-
import { D as emuToInches, I as EMU_PER_POINT } from "./table-cell-margins-
|
|
1
|
+
import { l as warn, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError } from "./errors-Da2nXCJm.js";
|
|
2
|
+
import { _ as resolveCellMarginsInches, b as resolveTableColWidthsEmu, d as marginToEmu, s as getSmartParseNumber, t as autoPageLineHeightEmu, v as resolveInsetsEmu, x as resolveTableRowHeightEmu } from "./units-internal-DFcUYjh3.js";
|
|
3
|
+
import { D as emuToInches, I as EMU_PER_POINT } from "./table-cell-margins-PDshga8T.js";
|
|
4
4
|
import { t as pickDefined } from "./options-internal-WqgMf720.js";
|
|
5
|
-
import { t as BODY_INSET_DEFAULTS_EMU } from "./body-insets-
|
|
6
|
-
import { n as tableColCount, r as walkTableGrid } from "./grid-
|
|
5
|
+
import { t as BODY_INSET_DEFAULTS_EMU } from "./body-insets-kVHmjGc6.js";
|
|
6
|
+
import { n as tableColCount, r as walkTableGrid } from "./grid-9B2w5EaY.js";
|
|
7
7
|
//#region src/measure/font-collection.ts
|
|
8
8
|
/**
|
|
9
9
|
* Font **collection** (`.ttc` / `.otc`) support for the write-side metrics.
|
|
@@ -500,7 +500,7 @@ const MIN_FONT_SCALE_PCT = 25;
|
|
|
500
500
|
* each glyph advance up — so PowerPoint wraps marginally earlier and its fitted
|
|
501
501
|
* box is marginally taller. Inflating measured width and height by these factors
|
|
502
502
|
* makes the computed `fontScale` ≤ PowerPoint's across the calibration oracle
|
|
503
|
-
* (`test/read/autofit-calibration-oracle.test.
|
|
503
|
+
* (`test/read/autofit-calibration-oracle.test.ts`: 0 violations over the Aptos
|
|
504
504
|
* cases). They err on the side of shrinking slightly too much, never overflowing.
|
|
505
505
|
*/
|
|
506
506
|
const WIDTH_SAFETY_FACTOR = 1.03;
|
|
@@ -752,7 +752,7 @@ function solveShrink(paragraphs, box, resolve) {
|
|
|
752
752
|
//#endregion
|
|
753
753
|
//#region src/measure/paragraphs.ts
|
|
754
754
|
/**
|
|
755
|
-
* ts
|
|
755
|
+
* pptx-ts: turning a slide text object into the simulator's inputs
|
|
756
756
|
*
|
|
757
757
|
* The lower half of the measured-fit pass: normalize a text object's runs into `FitParagraph`s,
|
|
758
758
|
* resolve its body insets and box, and work out how a height change is shared between `off.y` and
|
|
@@ -922,7 +922,7 @@ function anchorTopShareOfDelta(opts) {
|
|
|
922
922
|
//#endregion
|
|
923
923
|
//#region src/gen/table/cell-inherit.ts
|
|
924
924
|
/**
|
|
925
|
-
* ts
|
|
925
|
+
* pptx-ts: what a table cell inherits from its table.
|
|
926
926
|
*
|
|
927
927
|
* A cell that states nothing takes the table's value, and two paths resolve that: the emitter,
|
|
928
928
|
* building the bag it hands to the text-body writer, and the measured-fit pass, building the
|
|
@@ -970,7 +970,7 @@ const CELL_INHERITED_KEYS = [...CELL_INHERITED_TEXT_KEYS, ...CELL_INHERITED_EMIT
|
|
|
970
970
|
//#endregion
|
|
971
971
|
//#region src/measure/table-fit.ts
|
|
972
972
|
/**
|
|
973
|
-
* ts
|
|
973
|
+
* pptx-ts: measuring a table's row heights and cell fits
|
|
974
974
|
*
|
|
975
975
|
* A table is measured cell by cell against its resolved grid: each cell inherits the table's text
|
|
976
976
|
* options where it sets none, gets its own margins resolved to EMU insets, and is laid out inside
|
|
@@ -1435,4 +1435,4 @@ function restorer(target, key) {
|
|
|
1435
1435
|
//#endregion
|
|
1436
1436
|
export { getHeuristicFontMetrics as _, CELL_INHERITED_KEYS as a, isFontCollection as b, HEIGHT_SAFETY_FACTOR as c, WIDTH_SAFETY_FACTOR as d, measureHeightPt as f, FontMetricsRegistry as g, solveShrink as h, computeTableLayout as i, MIN_FONT_SCALE_PCT as l, solveResize as m, measureText as n, buildFitParagraphs as o, measureLayout as p, requireBoxHeight as r, FONT_SCALE_STEP_PCT as s, applyMeasuredFit as t, SINGLE_LINE_PITCH as u, makeRegistryResolver as v, listFontFaces as x, parseFontMetrics as y };
|
|
1437
1437
|
|
|
1438
|
-
//# sourceMappingURL=fit-
|
|
1438
|
+
//# sourceMappingURL=fit-CcXbg__l.js.map
|