pptx-ts 3.7.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -269
- package/dist/autopage-odPz7zZO.js +536 -0
- package/dist/autopage-odPz7zZO.js.map +1 -0
- package/dist/binary-string-CKVAYI3M.js +24 -0
- package/dist/binary-string-CKVAYI3M.js.map +1 -0
- package/dist/body-insets-Dw_BeWD_.js +54 -0
- package/dist/body-insets-Dw_BeWD_.js.map +1 -0
- package/dist/browser.d.ts +29 -9
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +41 -14
- package/dist/browser.js.map +1 -1
- package/dist/clip-Bl01BPcN.d.ts +67 -0
- package/dist/clip-Bl01BPcN.d.ts.map +1 -0
- package/dist/diagnostics-D8ot4Ei7.d.ts +244 -0
- package/dist/diagnostics-D8ot4Ei7.d.ts.map +1 -0
- package/dist/embedded-fonts-DarT9aoa.d.ts +20 -0
- package/dist/embedded-fonts-DarT9aoa.d.ts.map +1 -0
- package/dist/entry-compose-DCnvBZz2.d.ts +1046 -0
- package/dist/entry-compose-DCnvBZz2.d.ts.map +1 -0
- package/dist/{enums-CvRYniUA.d.ts → enums-BUKTUB6V.d.ts} +21 -13
- package/dist/{enums-CvRYniUA.d.ts.map → enums-BUKTUB6V.d.ts.map} +1 -1
- package/dist/{errors-Bvln0H-7.js → errors-C4oENPcu.js} +92 -2
- package/dist/errors-C4oENPcu.js.map +1 -0
- package/dist/families.d.ts +260 -0
- package/dist/families.d.ts.map +1 -0
- package/dist/families.js +57 -0
- package/dist/families.js.map +1 -0
- package/dist/{fit-BKs0zxMI.js → fit-Cb7naFj6.js} +249 -167
- package/dist/fit-Cb7naFj6.js.map +1 -0
- package/dist/font-metrics-v5fn7s7e.d.ts +613 -0
- package/dist/font-metrics-v5fn7s7e.d.ts.map +1 -0
- package/dist/grid-DikTjFey.js +187 -0
- package/dist/grid-DikTjFey.js.map +1 -0
- package/dist/{html-dom-B0I0QSbU.js → html-dom-Iuog2wdK.js} +121 -91
- package/dist/html-dom-Iuog2wdK.js.map +1 -0
- package/dist/html.d.ts +6 -6
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +7 -6
- package/dist/html.js.map +1 -1
- package/dist/image-size-CvN2iCA4.js +1611 -0
- package/dist/image-size-CvN2iCA4.js.map +1 -0
- package/dist/index.d.ts +24 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +40 -31
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +40 -48
- package/dist/inspect.js.map +1 -1
- package/dist/math.d.ts +7 -5
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +16 -7
- package/dist/math.js.map +1 -1
- package/dist/measure.d.ts +12 -225
- package/dist/measure.d.ts.map +1 -1
- package/dist/measure.js +3 -3
- package/dist/node.d.ts +22 -8
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +27 -7
- package/dist/node.js.map +1 -1
- package/dist/notes-Dh12JAbn.js +3264 -0
- package/dist/notes-Dh12JAbn.js.map +1 -0
- package/dist/options-internal-WqgMf720.js +43 -0
- package/dist/options-internal-WqgMf720.js.map +1 -0
- package/dist/{package-CaOLXSNi.d.ts → package-J49Ck6S2.d.ts} +27 -12
- package/dist/package-J49Ck6S2.d.ts.map +1 -0
- package/dist/playbtn-CUqQdoDf.js +22 -0
- package/dist/playbtn-CUqQdoDf.js.map +1 -0
- package/dist/{slide-ZqAdVvHV.d.ts → pres-C6qgOFAa.d.ts} +1021 -1423
- package/dist/pres-C6qgOFAa.d.ts.map +1 -0
- package/dist/{presentation-DrJtj3-C.js → presentation-DGYlAWhl.js} +3208 -2727
- package/dist/presentation-DGYlAWhl.js.map +1 -0
- package/dist/{presentation-types-CDjScsev.d.ts → presentation-types-8jLQHI4M.d.ts} +1070 -683
- package/dist/presentation-types-8jLQHI4M.d.ts.map +1 -0
- package/dist/read.d.ts +9 -9
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +4 -4
- package/dist/script.d.ts +80 -66
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +2399 -1139
- package/dist/script.js.map +1 -1
- package/dist/{shapes-BemroU-z.js → shapes-re0KyQk_.js} +2807 -1609
- package/dist/shapes-re0KyQk_.js.map +1 -0
- package/dist/slide-Dx2ZeVZ6.d.ts +1256 -0
- package/dist/slide-Dx2ZeVZ6.d.ts.map +1 -0
- package/dist/slide-size-BalTjFuv.js +88 -0
- package/dist/slide-size-BalTjFuv.js.map +1 -0
- package/dist/{units-internal-Dg95w_YD.js → table-cell-margins-EVg0EwxT.js} +235 -273
- package/dist/table-cell-margins-EVg0EwxT.js.map +1 -0
- package/dist/table-dom-BTDP3lEP.js +21 -0
- package/dist/table-dom-BTDP3lEP.js.map +1 -0
- package/dist/text-anchor-CrYXAfUu.js +176 -0
- package/dist/text-anchor-CrYXAfUu.js.map +1 -0
- package/dist/text-sN64Otf_.js +3980 -0
- package/dist/text-sN64Otf_.js.map +1 -0
- package/dist/transition-speed-kUEWDWTx.js +14 -0
- package/dist/transition-speed-kUEWDWTx.js.map +1 -0
- package/dist/units-internal-XJlf-hOl.js +649 -0
- package/dist/units-internal-XJlf-hOl.js.map +1 -0
- package/dist/zip-C0leZZMj.d.ts +67 -0
- package/dist/zip-C0leZZMj.d.ts.map +1 -0
- package/dist/zip-CKd8ihcf.js +177 -0
- package/dist/zip-CKd8ihcf.js.map +1 -0
- package/dist/zip.d.ts +3 -68
- package/dist/zip.js +3 -163
- package/dist/zoom-DPUHh85d.js +8865 -0
- package/dist/zoom-DPUHh85d.js.map +1 -0
- package/package.json +106 -19
- package/skills/ts-pptx-upstream/SKILL.md +58 -57
- package/dist/autopage-DkjYZUFD.js +0 -423
- package/dist/autopage-DkjYZUFD.js.map +0 -1
- package/dist/diagnostics-DfBdDHre.d.ts +0 -829
- package/dist/diagnostics-DfBdDHre.d.ts.map +0 -1
- package/dist/errors-Bvln0H-7.js.map +0 -1
- package/dist/errors-PflMPWBn.d.ts +0 -182
- package/dist/errors-PflMPWBn.d.ts.map +0 -1
- package/dist/fit-BKs0zxMI.js.map +0 -1
- package/dist/html-dom-B0I0QSbU.js.map +0 -1
- package/dist/namespaces-BVnNu7sg.js +0 -666
- package/dist/namespaces-BVnNu7sg.js.map +0 -1
- package/dist/notes-CJFJaG6M.js +0 -1724
- package/dist/notes-CJFJaG6M.js.map +0 -1
- package/dist/package-CaOLXSNi.d.ts.map +0 -1
- package/dist/pres-BcBR3CSM.d.ts +0 -202
- package/dist/pres-BcBR3CSM.d.ts.map +0 -1
- package/dist/presentation-DrJtj3-C.js.map +0 -1
- package/dist/presentation-types-CDjScsev.d.ts.map +0 -1
- package/dist/shapes-BemroU-z.js.map +0 -1
- package/dist/slide-ZqAdVvHV.d.ts.map +0 -1
- package/dist/text-B8SLEaZx.js +0 -11327
- package/dist/text-B8SLEaZx.js.map +0 -1
- package/dist/units-1kRzYShk.js +0 -231
- package/dist/units-1kRzYShk.js.map +0 -1
- package/dist/units-internal-Dg95w_YD.js.map +0 -1
- package/dist/zip.d.ts.map +0 -1
- package/dist/zip.js.map +0 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
//#region src/codes.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The library's condition vocabulary — one registry covering both surfaces a problem can take.
|
|
4
|
+
*
|
|
5
|
+
* A **code** names a *condition*, in `area/condition` form. The same condition keeps the same code
|
|
6
|
+
* whichever way it reaches the consumer: as a non-fatal {@link Diagnostic} (see `diagnostics.ts`)
|
|
7
|
+
* or as a thrown {@link TsPptxError} (see `errors.ts`). `coord/non-finite` means "a coordinate was
|
|
8
|
+
* `NaN`/`Infinity`" in both directions, and a consumer that special-cases it only has to learn the
|
|
9
|
+
* one string.
|
|
10
|
+
*
|
|
11
|
+
* **A code is API; the message that carries it is not.** Adding a code is back-compatible;
|
|
12
|
+
* removing or renaming one is a breaking change. Every union here is closed, so a new warning or
|
|
13
|
+
* throw site cannot be written without naming its condition in this file — that is the enforcement
|
|
14
|
+
* mechanism for keeping the vocabulary curated rather than accumulated. Reuse an existing code when
|
|
15
|
+
* the condition is genuinely the same, even if the wording differs and even if it is reported from
|
|
16
|
+
* a different entry point.
|
|
17
|
+
*
|
|
18
|
+
* The error codes are grouped by the {@link TsPptxError} subclass that carries them, not by area,
|
|
19
|
+
* because that pairing is type-enforced: `new MediaError('coord/non-finite', …)` does not compile.
|
|
20
|
+
* A condition that can genuinely arrive under two different classes needs two codes, because the
|
|
21
|
+
* class is part of what the consumer branches on.
|
|
22
|
+
*
|
|
23
|
+
* This module is types only — it emits no runtime code, so importing it can never create an import
|
|
24
|
+
* cycle and `diagnostics.ts` keeps the "safe to use from anywhere" property its header claims.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* The stable identifier for a non-fatal condition the library reports and then works around.
|
|
28
|
+
*
|
|
29
|
+
* Codes are shared across entry points where the *condition* is the same even though the message
|
|
30
|
+
* differs — an image whose natural size cannot be measured reports
|
|
31
|
+
* `image/unmeasurable-natural-size` whether it came from `addImage` or from `Picture.setImage`.
|
|
32
|
+
*/
|
|
33
|
+
type DiagnosticCode = 'object-name/empty' | 'object-name/control-characters' | 'object-name/too-long' | 'object-name/duplicate' | 'animation/target-index-out-of-range' | 'animation/target-not-found' | 'animation/target-missing' | 'animation/unknown-preset' | 'chart/invalid-axis-time-unit' | 'chart/non-finite-value' | 'chart/error-bars-missing-values' | 'chart/axis-type-conflict' | 'chart/invalid-metadata' | 'chart/invalid-metadata-key' | 'chart/invalid-metadata-value' | 'chart/option-out-of-range' | 'chart/option-not-on-axis' | 'chart/option-not-supported' | 'chart/invalid-option-value' | 'chart/invalid-subtotal-index' | 'chart/symbol-size-out-of-range' | 'chart/invalid-grid-line-size' | 'chart/invalid-grid-line-style' | 'chart/invalid-grid-line-cap' | 'chart/layout-out-of-range' | 'chart/stock-series-count' | 'chart/point-count-mismatch' | 'chart/point-index-out-of-range' | 'comment/missing-author' | 'comment/missing-text' | 'connector/bends-ignored-for-straight' | 'connector/adj-out-of-range' | 'connector/unresolved-binding' | 'group/unsupported-child' | 'group/unrecognized-child' | 'group/no-children' | 'group/partial-frame' | 'family/child-not-composed' | 'image-fill/missing-source' | 'image-fill/missing-base64-header' | 'image-fill/svg-unsupported' | 'image-fill/unresolved-media' | 'preview-image/missing-base64-header' | 'background/missing-base64-header' | 'image/crop-and-sizing-conflict' | 'image/unmeasurable-natural-size' | 'image/bilevel-threshold-out-of-range' | 'table/invalid-border' | 'table/invalid-outer-border' | 'table/invalid-horz-overflow' | 'table/invalid-cell3d' | 'table/col-width-count-mismatch' | 'table/invalid-col-width' | 'table/span-out-of-range' | 'table/cell-past-grid' | 'table/autopage-height-too-small' | 'table/autopage-rowspan-too-tall' | 'table/invalid-row-height' | 'table/invalid-margin' | 'table/invalid-header-row-count' | 'text/invalid-valign' | 'text/invalid-vertical' | 'text/invalid-warp' | 'text/invalid-columns' | 'text/invalid-column-spacing' | 'text/invalid-indent-level' | 'text/invalid-fit-percentage' | 'text/invalid-strike' | 'text/invalid-caps' | 'text/invalid-underline' | 'text/invalid-tab-alignment' | 'text/char-spacing-out-of-range' | 'text/line-spacing-out-of-range' | 'text/paragraph-margin-out-of-range' | 'text/paragraph-indent-out-of-range' | 'font/size-out-of-range' | 'bullet/size-out-of-range' | 'bullet/image-missing-base64-header' | 'bullet/image-embed-failed' | 'bullet/invalid-character-code' | 'bullet/start-at-out-of-range' | 'bullet/invalid-number-type' | 'transition/unknown-type' | 'transition/unknown-variant' | 'zoom/missing-target' | 'zoom/unresolved-target' | 'zoom/missing-section-title' | 'zoom/section-not-found' | 'zoom/section-empty' | 'zoom/no-sections-to-summarize' | 'zoom/transition-duration-out-of-range' | 'color/not-a-string' | 'color/invalid-value' | 'color/empty-string' | 'shadow/invalid-type' | 'shadow/angle-out-of-range' | 'glow/size-out-of-range' | 'shadow/blur-out-of-range' | 'shadow/offset-out-of-range' | 'shadow/transparency-out-of-range' | 'shadow/color-has-hash' | 'geometry/invalid-shape-adjust' | 'geometry/shape-adjust-overridden' | 'geometry/arc-node-point-ignored' | 'shape/degenerate-extent' | 'frame/zero-extent' | 'geometry/invalid-guide' | 'geometry/unknown-guide-operation' | 'geometry/invalid-connection-site' | 'border/unknown-key' | 'border/invalid-dash-type' | 'line/invalid-arrow-type' | 'object-lock/unsupported-on-shape' | 'media/load-failed' | 'media/svg-preview-failed' | 'model3d/preview-missing' | 'media/invalid-loop-count' | 'theme/invalid-color-override' | 'master/invalid-text-style-font-size' | 'master/invalid-text-style-length' | 'master/too-many-text-style-levels' | 'notes/hyperlink-slide-unsupported' | 'html/image-missing-source' | 'section/missing-argument' | 'section/missing-title' | 'section/duplicate-title' | 'section/invalid-order' | 'slide/section-not-found' | 'slide/master-not-found' | 'slide/removed-link-target' | 'layout/invalid-definition' | 'core/revision-not-a-whole-number' | 'diagram/drawing-cache-not-updated' | 'diagram/point-has-no-text-body' | 'inspect/group-transform-missing' | 'inspect/group-transform-degenerate' | 'measure/shrink-unmeasured' | 'measure/resize-unmeasured' | 'measure/heuristic-metrics' | 'measure/uncovered-codepoints' | 'margin/legacy-points' | 'gradient/center-out-of-range' | 'transparency/out-of-range' | 'opacity/out-of-range' | 'line/width-out-of-range' | 'coord/bare-number-is-inches' | 'layout/size-out-of-range';
|
|
34
|
+
/**
|
|
35
|
+
* Conditions carried by `InvalidOptionError`: the caller passed something the library cannot use.
|
|
36
|
+
*
|
|
37
|
+
* This is the largest group by design — the project's stated policy is to throw rather than coerce
|
|
38
|
+
* (`AGENTS.md` → "Silent coercion of invalid input is a footgun"), so most throws are here.
|
|
39
|
+
*/
|
|
40
|
+
type InvalidOptionErrorCode = 'coord/non-finite' | 'percent/non-finite' | 'coord/not-positive' | 'coord/invalid-format' | 'coord/out-of-range' | 'bullet/start-at-not-a-number' | 'presentation/first-slide-num-not-an-integer' | 'geometry/arc-angle-non-finite' | 'shadow/angle-non-finite' | 'chart/missing-type' | 'chart/option-non-finite' | 'chart/unknown-type' | 'chart/secondary-axis-unused' | 'chart/axis-count-mismatch' | 'chart/too-many-columns' | 'chart/bubble-in-combo' | 'shape/missing-type' | 'shape/unknown-preset' | 'connector/missing-endpoints' | 'connector/invalid-type' | 'connector/invalid-bends' | 'connector/adj-count-mismatch' | 'connector/adj-non-finite' | 'connector/invalid-binding-name' | 'connector/invalid-connection-site' | 'line/invalid-cap' | 'group/missing-object-names' | 'group/invalid-object-name' | 'group/duplicate-object-name' | 'group/unresolved-object-name' | 'group/ambiguous-object-name' | 'gradient/angle-non-finite' | 'gradient/too-few-stops' | 'gradient/stop-position-non-finite' | 'gradient/stop-position-out-of-range' | 'gradient/rotate-with-shape-not-boolean' | 'gradient/scaled-not-boolean' | 'pattern-fill/missing-pattern' | 'image/missing-source' | 'image/path-not-a-string' | 'image/data-not-a-string' | 'image/missing-base64-header' | 'image/crop-window-overflows' | 'image/crop-inset-out-of-range' | 'image/crop-insets-exceed-extent' | 'media/missing-source' | 'media/missing-base64-header' | 'media/cover-missing-base64-header' | 'media/online-missing-link' | 'ole/missing-source' | 'ole/invalid-image-size' | 'zoom/invalid-transition-duration' | 'transition/invalid-time' | 'transition/sound-unsupported' | 'model3d/missing-source' | 'model3d/invalid-camera' | 'model3d/invalid-fov' | 'model3d/invalid-scale' | 'layout/invalid-definition' | 'table/rows-not-an-array' | 'table/rows-not-nested' | 'table/invalid-cell-anchor' | 'table/invalid-cell-vert' | 'table/invalid-cell-overflow' | 'table/invalid-cell-margin' | 'table/invalid-cell-border' | 'table/row-index-out-of-range' | 'table/column-index-out-of-range' | 'table/merge-range-invalid' | 'hyperlink/not-an-object' | 'hyperlink/missing-target' | 'hyperlink/conflicting-targets' | 'hyperlink/invalid-slide' | 'slide/link-past-last-slide' | 'text/invalid-text' | 'clip/invalid-shape' | 'html/no-document' | 'html/table-not-found' | 'html/table-has-no-cells' | 'color/invalid-hex' | 'color/invalid-scheme-token' | 'text/invalid-underline' | 'slide/index-out-of-range' | 'slide/foreign-target' | 'slide/id-space-exhausted' | 'shape/index-out-of-range' | 'layout/ambiguous-name' | 'layout/not-found' | 'layout/foreign-handle' | 'import/slide-size-mismatch' | 'import/slide-size-unknown' | 'import/unresolved-slide-link' | 'import/destination-missing-master' | 'import/destination-missing-layout' | 'import/output-index-conflict' | 'import/output-index-out-of-range' | 'import/rescale-conflict' | 'image/undeterminable-extension' | 'image/undeterminable-type' | 'image/missing-content-type' | 'image/fit-needs-extent' | 'font/size-not-positive' | 'script/unresolved-asset-reference' | 'script/non-finite-literal' | 'package/duplicate-part-name' | 'part/not-xml' | 'relationship/duplicate-id' | 'relationship/not-found' | 'relationship/external-has-no-partname' | 'oxml/unknown-namespace-prefix' | 'oxml/invalid-qname' | 'font/missing-typeface' | 'font/invalid-style-slot' | 'font/invalid-base64' | 'font/missing-source' | 'font/collection-index-out-of-range' | 'font/collection-face-not-found' | 'layout/unknown' | 'master/missing-title' | 'math/invalid-latex' | 'math/invalid-mathml' | 'zip/unsupported-input' | 'zip/unsupported-output';
|
|
41
|
+
/**
|
|
42
|
+
* Conditions carried by `UnsupportedFeatureError`: the request is well-formed, but this build,
|
|
43
|
+
* runtime, or shape cannot express it. Distinct from `InvalidOptionError` because the caller did
|
|
44
|
+
* nothing wrong — the answer is "not here", not "not like that".
|
|
45
|
+
*/
|
|
46
|
+
type UnsupportedFeatureErrorCode = 'gradient/type-unsupported' | 'line/image-fill-unsupported' | 'group/kind-not-groupable' | 'shape/element-unsupported' | 'shape/fill-unsupported' | 'shape/line-unsupported' | 'shape/no-text-frame' | 'math/missing-optional-peer' | 'font/opentype-unavailable' | 'zip/filesystem-unavailable' | 'runtime/file-output-unavailable' | 'family/not-composed';
|
|
47
|
+
/**
|
|
48
|
+
* Conditions carried by `PackageReadError`: the bytes handed to the library are not a package it
|
|
49
|
+
* can read, or a part inside one is structurally malformed. Always about *input*, never about
|
|
50
|
+
* something the library is asked to produce.
|
|
51
|
+
*/
|
|
52
|
+
type PackageReadErrorCode = 'zip/not-a-zip-archive' | 'zip/file-read-failed' | 'package/not-an-opc-package' | 'package/content-types-invalid-root' | 'package/content-types-entry-incomplete' | 'package/part-content-type-missing' | 'package/relationships-invalid-root' | 'package/relationship-incomplete' | 'package/relationship-invalid-target-mode' | 'package/duplicate-relationship-id' | 'package/relationship-target-escapes-root' | 'package/relationship-target-missing' | 'package/office-document-relationship-invalid' | 'package/part-missing' | 'package/part-has-no-root' | 'slide/no-shape-tree' | 'shape/no-non-visual-properties' | 'table/cell-has-no-text-body' | 'diagram/parent-edge-cycle';
|
|
53
|
+
/**
|
|
54
|
+
* Conditions carried by `MediaError`: an image, font, or audio/video payload could not be fetched,
|
|
55
|
+
* read, or decoded. Kept separate from `PackageReadError` because the failure is in a *referenced
|
|
56
|
+
* resource*, not in the package structure, and the recovery is usually different (fix the URL or
|
|
57
|
+
* the file, not the deck).
|
|
58
|
+
*/
|
|
59
|
+
type MediaErrorCode = 'media/load-failed' | 'font/fetch-failed' | 'font/read-failed' | 'font/parse-failed' | 'media/fetch-failed' | 'media/read-failed' | 'media/decode-failed' | 'media/svg-preview-failed';
|
|
60
|
+
/**
|
|
61
|
+
* Conditions carried by `InternalError`: an invariant the library maintains itself did not hold.
|
|
62
|
+
* Reaching one is a bug in ts-pptx, not something a consumer can fix by changing their input —
|
|
63
|
+
* which is exactly why it is worth being able to tell apart from the four classes above.
|
|
64
|
+
*/
|
|
65
|
+
type InternalErrorCode = 'layout/default-not-registered' | 'slide/rel-index-out-of-range' | 'slide/part-already-in-deck' | 'import/part-went-missing' | 'import/slide-link-not-placed' | 'import/rescale-mode-changed' | 'chart/type-not-routed' | 'slide/object-type-not-routed' | 'ooxml/member-not-in-sequence' | 'slide/link-target-not-a-number' | 'hyperlink/not-validated' | 'animation/timing-scaffold-failed' | 'media/rel-ids-not-consecutive' | 'oxml/node-has-no-document' | 'oxml/node-has-no-parent';
|
|
66
|
+
/**
|
|
67
|
+
* Every condition the library can throw. See {@link TsPptxCode} for the whole vocabulary.
|
|
68
|
+
*
|
|
69
|
+
* **Which of these is worth reporting upstream.** An `InternalErrorCode` always is, and the error
|
|
70
|
+
* carrying it says so at runtime. A `PackageReadErrorCode` on a file that opens cleanly in
|
|
71
|
+
* PowerPoint, a `MediaErrorCode` on an asset every other tool loads, and an
|
|
72
|
+
* `UnsupportedFeatureErrorCode` for something PowerPoint can plainly express are all gaps on our
|
|
73
|
+
* side rather than bad input — the project's supported bar is "the output opens cleanly in
|
|
74
|
+
* Microsoft PowerPoint", and it reads in both directions. An `InvalidOptionErrorCode` is worth
|
|
75
|
+
* reporting only if the deck it refused is one PowerPoint can express.
|
|
76
|
+
*
|
|
77
|
+
* `npx skills add shbernal/ts-pptx` installs the skill that walks through filing one.
|
|
78
|
+
*/
|
|
79
|
+
type ErrorCode = InvalidOptionErrorCode | UnsupportedFeatureErrorCode | PackageReadErrorCode | MediaErrorCode | InternalErrorCode;
|
|
80
|
+
/** Every condition the library can report, warned or thrown. */
|
|
81
|
+
type TsPptxCode = DiagnosticCode | ErrorCode;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/errors.d.ts
|
|
84
|
+
/** Extra context accepted by every {@link TsPptxError} constructor. */
|
|
85
|
+
interface TsPptxErrorOptions extends ErrorOptions {
|
|
86
|
+
/**
|
|
87
|
+
* Structured context for the condition, when a site has any to give. Mirrors `Diagnostic.detail`
|
|
88
|
+
* so the same condition looks the same whether it was warned or thrown.
|
|
89
|
+
*/
|
|
90
|
+
readonly detail?: Readonly<Record<string, unknown>>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Base class for every error ts-pptx throws.
|
|
94
|
+
*
|
|
95
|
+
* Catch this to catch anything from the library; narrow with `instanceof` on a subclass, or branch
|
|
96
|
+
* on {@link TsPptxError.code}, to react to something specific. It is never thrown directly — every
|
|
97
|
+
* site picks one of the five subclasses.
|
|
98
|
+
*/
|
|
99
|
+
declare class TsPptxError extends Error {
|
|
100
|
+
/** Stable condition identifier — see {@link ErrorCode}. Branch on this, not on the text. */
|
|
101
|
+
readonly code: ErrorCode;
|
|
102
|
+
/** Structured context for the condition, when the throwing site had any to give. */
|
|
103
|
+
readonly detail?: Readonly<Record<string, unknown>>;
|
|
104
|
+
/**
|
|
105
|
+
* @param code - the stable condition identifier
|
|
106
|
+
* @param message - explanation for a human reading a stack trace; not part of the contract
|
|
107
|
+
* @param options - standard `cause`, plus optional structured `detail`
|
|
108
|
+
*/
|
|
109
|
+
constructor(code: ErrorCode, message: string, options?: TsPptxErrorOptions);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The caller passed something the library cannot use — a non-finite coordinate, an unknown enum
|
|
113
|
+
* value, a required option left out, a value outside its legal range.
|
|
114
|
+
*
|
|
115
|
+
* This is the error behind the project's throw-rather-than-coerce policy: emitting a degenerate
|
|
116
|
+
* result (a zero-size shape, a silently dropped option) hides the mistake, so the library refuses
|
|
117
|
+
* instead. Reaching one means the calling code needs to change.
|
|
118
|
+
*/
|
|
119
|
+
declare class InvalidOptionError extends TsPptxError {
|
|
120
|
+
readonly code: InvalidOptionErrorCode;
|
|
121
|
+
constructor(code: InvalidOptionErrorCode, message: string, options?: TsPptxErrorOptions);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The request is well-formed but cannot be expressed here: an optional peer dependency is not
|
|
125
|
+
* installed, the runtime lacks a capability, or the shape/feature has no OOXML representation the
|
|
126
|
+
* library emits.
|
|
127
|
+
*
|
|
128
|
+
* Distinct from {@link InvalidOptionError} because the caller did nothing wrong — the answer is
|
|
129
|
+
* "not here", not "not like that" — and the fix is usually to install something or pick a different
|
|
130
|
+
* approach rather than to correct a value.
|
|
131
|
+
*/
|
|
132
|
+
declare class UnsupportedFeatureError extends TsPptxError {
|
|
133
|
+
readonly code: UnsupportedFeatureErrorCode;
|
|
134
|
+
constructor(code: UnsupportedFeatureErrorCode, message: string, options?: TsPptxErrorOptions);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The bytes handed to the library are not a package it can read, or a part inside one is
|
|
138
|
+
* structurally malformed — a missing `[Content_Types].xml`, a relationship pointing at nothing, a
|
|
139
|
+
* slide part with no root element.
|
|
140
|
+
*
|
|
141
|
+
* Always about *input*. A problem with something the library is being asked to produce is an
|
|
142
|
+
* {@link InvalidOptionError}.
|
|
143
|
+
*/
|
|
144
|
+
declare class PackageReadError extends TsPptxError {
|
|
145
|
+
readonly code: PackageReadErrorCode;
|
|
146
|
+
constructor(code: PackageReadErrorCode, message: string, options?: TsPptxErrorOptions);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A referenced image, font, or audio/video resource could not be fetched, read, or decoded.
|
|
150
|
+
*
|
|
151
|
+
* Kept apart from {@link PackageReadError} because the failure is in a resource the deck *points
|
|
152
|
+
* at*, not in the package structure — a broken URL, an unreadable path, a corrupt font file — and
|
|
153
|
+
* a consumer typically retries or substitutes rather than rejecting the deck.
|
|
154
|
+
*/
|
|
155
|
+
declare class MediaError extends TsPptxError {
|
|
156
|
+
readonly code: MediaErrorCode;
|
|
157
|
+
constructor(code: MediaErrorCode, message: string, options?: TsPptxErrorOptions);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* An invariant the library maintains itself did not hold.
|
|
161
|
+
*
|
|
162
|
+
* No consumer input should be able to produce one, which is the whole reason it is a separate
|
|
163
|
+
* class: seeing it means the bug is in ts-pptx, and the useful response is to file it rather than
|
|
164
|
+
* to keep adjusting the input.
|
|
165
|
+
*
|
|
166
|
+
* It is the one class in the taxonomy that extends its own message, appending `REPORT_NOTICE`
|
|
167
|
+
* below the invariant that broke. The constructor is where that lives so a throw site added later
|
|
168
|
+
* inherits it — the alternative, a notice pasted at each of the sites, is one every future site can
|
|
169
|
+
* forget. Every other class leaves `message` exactly as given: a malformed package is the routine
|
|
170
|
+
* outcome for a library that reads untrusted files, and a "report this" banner on each corrupt
|
|
171
|
+
* input would train callers to ignore the one banner that always means something.
|
|
172
|
+
*
|
|
173
|
+
* This does not make the message API — see the class doc on {@link TsPptxError}. Branch on
|
|
174
|
+
* `instanceof` or on {@link InternalError.code}, never on the text.
|
|
175
|
+
*/
|
|
176
|
+
declare class InternalError extends TsPptxError {
|
|
177
|
+
readonly code: InternalErrorCode;
|
|
178
|
+
constructor(code: InternalErrorCode, message: string, options?: TsPptxErrorOptions);
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/diagnostics.d.ts
|
|
182
|
+
/** One diagnostic emitted by the library. */
|
|
183
|
+
interface Diagnostic {
|
|
184
|
+
/** Stable condition identifier — see {@link DiagnosticCode}. Branch on this, not on the text. */
|
|
185
|
+
readonly code: DiagnosticCode;
|
|
186
|
+
/** Human-readable explanation. Free to change in any release; do not parse it. */
|
|
187
|
+
readonly message: string;
|
|
188
|
+
/**
|
|
189
|
+
* Structured context for the condition, when a site has any to give.
|
|
190
|
+
*
|
|
191
|
+
* Every rejection of an `ST_` enum value populates it: `checkEnumOrWarn` (`ooxml/check-enum.ts`)
|
|
192
|
+
* carries `received` — the value the caller passed — and `valid`, the whole legal list, plus
|
|
193
|
+
* whatever the call site adds. That reaches a handler for a line dash type, a table cell's 3-D
|
|
194
|
+
* preset and a table's horizontal overflow, among others. Nothing else populates it yet, so a
|
|
195
|
+
* handler must still treat the field as optional and must not assume a particular key is there
|
|
196
|
+
* for a given code.
|
|
197
|
+
*/
|
|
198
|
+
readonly detail?: Readonly<Record<string, unknown>>;
|
|
199
|
+
}
|
|
200
|
+
/** Receives every {@link Diagnostic} the library emits. See {@link setDiagnosticHandler}. */
|
|
201
|
+
type DiagnosticHandler = (diagnostic: Diagnostic) => void;
|
|
202
|
+
/**
|
|
203
|
+
* Route every library diagnostic to `handler`, or pass `null` to restore the default
|
|
204
|
+
* (one prefixed `console.warn` per diagnostic).
|
|
205
|
+
*
|
|
206
|
+
* This is process-global rather than per-presentation, deliberately: the emitting code is a tree
|
|
207
|
+
* of free functions in `gen/**` with no presentation in scope, and threading a handler through
|
|
208
|
+
* every signature would be a far larger and worse change than the problem warrants. The practical
|
|
209
|
+
* consequence is that a process building several decks concurrently cannot attribute a diagnostic
|
|
210
|
+
* to one of them. If that matters, correlate on `code`, or build the decks one at a time with the
|
|
211
|
+
* handler set around each build: a handler set around concurrent builds sees all of their
|
|
212
|
+
* diagnostics.
|
|
213
|
+
*
|
|
214
|
+
* A throwing handler propagates out of whatever library call emitted the diagnostic, which is the
|
|
215
|
+
* supported way to make a specific condition fatal:
|
|
216
|
+
*
|
|
217
|
+
* ```ts
|
|
218
|
+
* setDiagnosticHandler((d) => {
|
|
219
|
+
* if (d.code === 'coord/bare-number-is-inches') throw new Error(d.message)
|
|
220
|
+
* })
|
|
221
|
+
* ```
|
|
222
|
+
* @param next - the receiver, or `null` to restore the console default
|
|
223
|
+
*/
|
|
224
|
+
declare function setDiagnosticHandler(next: DiagnosticHandler | null): void;
|
|
225
|
+
/**
|
|
226
|
+
* Clear the `warnOnce` dedupe set, so a condition already reported reports again. (`warnOnce` is
|
|
227
|
+
* internal and carries no page of its own, so it is named rather than linked.)
|
|
228
|
+
*
|
|
229
|
+
* Call it between builds in a host that builds more than one deck per process and wants each
|
|
230
|
+
* build's diagnostics complete. Without it, deck two is silent about anything deck one already
|
|
231
|
+
* warned for, which reads as "no problems found" rather than as "already mentioned".
|
|
232
|
+
*
|
|
233
|
+
* It also bounds the set. Most `warnOnce` messages interpolate the offending value, so a server
|
|
234
|
+
* building decks from user input accumulates one entry per distinct bad value with no way to
|
|
235
|
+
* release them.
|
|
236
|
+
*
|
|
237
|
+
* This does not touch the handler — {@link setDiagnosticHandler} owns that, and the two are
|
|
238
|
+
* reset independently on purpose: a host usually installs its handler once and wants it to
|
|
239
|
+
* survive.
|
|
240
|
+
*/
|
|
241
|
+
declare function resetDiagnosticState(): void;
|
|
242
|
+
//#endregion
|
|
243
|
+
export { PackageReadErrorCode as _, InternalError as a, PackageReadError as c, UnsupportedFeatureError as d, DiagnosticCode as f, MediaErrorCode as g, InvalidOptionErrorCode as h, setDiagnosticHandler as i, TsPptxError as l, InternalErrorCode as m, DiagnosticHandler as n, InvalidOptionError as o, ErrorCode as p, resetDiagnosticState as r, MediaError as s, Diagnostic as t, TsPptxErrorOptions as u, TsPptxCode as v, UnsupportedFeatureErrorCode as y };
|
|
244
|
+
//# sourceMappingURL=diagnostics-D8ot4Ei7.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics-D8ot4Ei7.d.ts","names":[],"sources":["../src/codes.ts","../src/errors.ts","../src/diagnostics.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCY;;;;;;;KA8KA;;;;;;KAwKA;;;;;;KAwBA;;;;;;;KAkCA;;;;;;KAwBA;;;;;;;;;;;;;;KAiEA,YACT,yBACA,8BACA,uBACA,iBACA;;KAGS,aAAa,iBAAiB;;;;UCrezB,2BAA2B;;;;;WAKlC,SAAS,SAAS;;;;;;;;;cAUf,oBAAoB;;WAEvB,MAAM;;WAGN,SAAS,SAAS;;;;;;EAO3B,YAAY,MAAM,WAAW,iBAAiB,UAAU;;;;;;;;;;cAmB5C,2BAA2B;WACtB,MAAM;EACvB,YAAY,MAAM,wBAAwB,iBAAiB,UAAU;;;;;;;;;;;cAczD,gCAAgC;WAC3B,MAAM;EACvB,YAAY,MAAM,6BAA6B,iBAAiB,UAAU;;;;;;;;;;cAa9D,yBAAyB;WACpB,MAAM;EACvB,YAAY,MAAM,sBAAsB,iBAAiB,UAAU;;;;;;;;;cAYvD,mBAAmB;WACd,MAAM;EACvB,YAAY,MAAM,gBAAgB,iBAAiB,UAAU;;;;;;;;;;;;;;;;;;;cAkCjD,sBAAsB;WACjB,MAAM;EACvB,YAAY,MAAM,mBAAmB,iBAAiB,UAAU;;;;;UCzJhD;;WAEP,MAAM;;WAEN;;;;;;;;;;;WAWA,SAAS,SAAS;;;KAIhB,qBAAqB,YAAY;;;;;;;;;;;;;;;;;;;;;;;iBAkC7B,qBAAqB,MAAM;;;;;;;;;;;;;;;;;iBAwD3B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { un as EMBEDDED_FONT_SLOTS } from "./pres-C6qgOFAa.js";
|
|
2
|
+
//#region src/embedded-fonts.d.ts
|
|
3
|
+
type EmbeddedFontSlot = (typeof EMBEDDED_FONT_SLOTS)[number];
|
|
4
|
+
/** One embeddable face: a slot plus the raw font bytes (absent in pure read-side merges). */
|
|
5
|
+
interface EmbeddedFontFace {
|
|
6
|
+
slot: EmbeddedFontSlot;
|
|
7
|
+
bytes?: Uint8Array;
|
|
8
|
+
}
|
|
9
|
+
/** A typeface family with 1..4 embedded faces — one `p:embeddedFont` entry. */
|
|
10
|
+
interface EmbeddedFont {
|
|
11
|
+
/** `p:font/@typeface` — MUST match the family name used in run/`fontFace` typefaces or PowerPoint won't bind it. */
|
|
12
|
+
typeface: string;
|
|
13
|
+
panose?: string;
|
|
14
|
+
pitchFamily?: number;
|
|
15
|
+
charset?: number;
|
|
16
|
+
faces: EmbeddedFontFace[];
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { EmbeddedFontFace as n, EmbeddedFontSlot as r, EmbeddedFont as t };
|
|
20
|
+
//# sourceMappingURL=embedded-fonts-DarT9aoa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedded-fonts-DarT9aoa.d.ts","names":[],"sources":["../src/embedded-fonts.ts"],"mappings":";;KAyCY,2BAA2B;;UAGtB;EAChB,MAAM;EACN,QAAQ;;;UAIQ;;EAEhB;EACA;EACA;EACA;EACA,OAAO"}
|