pptx-svelte-viewer 2.17.9 → 2.19.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/CHANGELOG.md +4 -0
- package/dist/{AiChatPanel-L5y0kiDu.js → AiChatPanel-DKeBilcx.js} +40 -40
- package/dist/{export-57mdVQIa.js → export-CZzvhGTm.js} +67407 -60108
- package/dist/i18n.js +1 -1
- package/dist/index.d.ts +599 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -27
- package/dist/pptx-svelte-viewer.css +1 -1
- package/dist/{translator-CZy5sxU0.js → translator-EP8BTIz6.js} +44 -4
- package/dist/viewer/components/chart-drag.svelte.d.ts +39 -0
- package/dist/viewer/components/chart-drag.svelte.d.ts.map +1 -0
- package/dist/viewer/components/props-editing.d.ts +15 -1
- package/dist/viewer/components/props-editing.d.ts.map +1 -1
- package/dist/viewer/components/props-elements.d.ts +8 -1
- package/dist/viewer/components/props-elements.d.ts.map +1 -1
- package/dist/viewer/components/props-stage.d.ts +5 -1
- package/dist/viewer/components/props-stage.d.ts.map +1 -1
- package/dist/viewer/components/ribbon/transitions/transition-presets.d.ts +13 -6
- package/dist/viewer/components/ribbon/transitions/transition-presets.d.ts.map +1 -1
- package/dist/viewer/components/viewer-body-commits.d.ts +12 -0
- package/dist/viewer/components/viewer-body-commits.d.ts.map +1 -1
- package/dist/viewer/editor/context-menu-dispatch.d.ts.map +1 -1
- package/dist/viewer/editor/editing-api.d.ts.map +1 -1
- package/dist/viewer/editor/editor-adjust-gesture.d.ts +21 -0
- package/dist/viewer/editor/editor-adjust-gesture.d.ts.map +1 -0
- package/dist/viewer/editor/editor-arrange-ops.d.ts.map +1 -1
- package/dist/viewer/editor/editor-controller-deps.d.ts +5 -0
- package/dist/viewer/editor/editor-controller-deps.d.ts.map +1 -1
- package/dist/viewer/editor/editor-controller-wiring.d.ts +21 -0
- package/dist/viewer/editor/editor-controller-wiring.d.ts.map +1 -1
- package/dist/viewer/editor/editor-controller.svelte.d.ts +20 -1
- package/dist/viewer/editor/editor-controller.svelte.d.ts.map +1 -1
- package/dist/viewer/editor/editor-document-lifecycle.d.ts.map +1 -1
- package/dist/viewer/editor/editor-document-state.d.ts +21 -3
- package/dist/viewer/editor/editor-document-state.d.ts.map +1 -1
- package/dist/viewer/editor/editor-handle-handlers.d.ts +42 -0
- package/dist/viewer/editor/editor-handle-handlers.d.ts.map +1 -0
- package/dist/viewer/editor/editor-keyboard.d.ts +7 -0
- package/dist/viewer/editor/editor-keyboard.d.ts.map +1 -1
- package/dist/viewer/editor/editor-master-controller.d.ts +2 -0
- package/dist/viewer/editor/editor-master-controller.d.ts.map +1 -1
- package/dist/viewer/editor/editor-presentation-metadata.svelte.d.ts +11 -0
- package/dist/viewer/editor/editor-presentation-metadata.svelte.d.ts.map +1 -1
- package/dist/viewer/editor/editor-selection-gestures.d.ts +8 -1
- package/dist/viewer/editor/editor-selection-gestures.d.ts.map +1 -1
- package/dist/viewer/editor/editor-selection-interactivity.d.ts +48 -0
- package/dist/viewer/editor/editor-selection-interactivity.d.ts.map +1 -0
- package/dist/viewer/editor/editor-slides-controller.d.ts +8 -1
- package/dist/viewer/editor/editor-slides-controller.d.ts.map +1 -1
- package/dist/viewer/editor/editor-state.svelte.d.ts +80 -2
- package/dist/viewer/editor/editor-state.svelte.d.ts.map +1 -1
- package/dist/viewer/editor/editor-transition-controller.d.ts +12 -0
- package/dist/viewer/editor/editor-transition-controller.d.ts.map +1 -1
- package/dist/viewer/editor/index.d.ts +9 -0
- package/dist/viewer/editor/index.d.ts.map +1 -1
- package/dist/viewer/editor/inline-text.d.ts.map +1 -1
- package/dist/viewer/editor/table-cell-pointer.d.ts +29 -0
- package/dist/viewer/editor/table-cell-pointer.d.ts.map +1 -0
- package/dist/viewer/editor/table-cell-selection.svelte.d.ts +51 -0
- package/dist/viewer/editor/table-cell-selection.svelte.d.ts.map +1 -0
- package/dist/viewer/index.d.ts +939 -30
- package/dist/viewer/index.js +16 -16
- package/dist/viewer/master/master-view.d.ts +8 -1
- package/dist/viewer/master/master-view.d.ts.map +1 -1
- package/dist/viewer/render/contentpart-view.d.ts +8 -21
- package/dist/viewer/render/contentpart-view.d.ts.map +1 -1
- package/dist/viewer/render/index.d.ts +2 -2
- package/dist/viewer/render/index.d.ts.map +1 -1
- package/dist/viewer/render/smartart-view.d.ts +6 -5
- package/dist/viewer/render/smartart-view.d.ts.map +1 -1
- package/dist/viewer/render/table-view.d.ts +6 -0
- package/dist/viewer/render/table-view.d.ts.map +1 -1
- package/dist/viewer/state/autosave.svelte.d.ts +9 -0
- package/dist/viewer/state/autosave.svelte.d.ts.map +1 -1
- package/dist/viewer/state/create-viewer-state-collab.svelte.d.ts.map +1 -1
- package/dist/viewer/state/create-viewer-state-editor-ui.svelte.d.ts.map +1 -1
- package/dist/viewer/state/create-viewer-state-presentation.svelte.d.ts.map +1 -1
- package/dist/viewer/state/create-viewer-state.svelte.d.ts.map +1 -1
- package/dist/viewer/state/index.d.ts +2 -0
- package/dist/viewer/state/index.d.ts.map +1 -1
- package/dist/viewer/state/inspector-deck.d.ts +10 -2
- package/dist/viewer/state/inspector-deck.d.ts.map +1 -1
- package/dist/viewer/state/presentation-loader.svelte.d.ts +12 -1
- package/dist/viewer/state/presentation-loader.svelte.d.ts.map +1 -1
- package/dist/viewer/state/table-cell-selection-context.d.ts +20 -0
- package/dist/viewer/state/table-cell-selection-context.d.ts.map +1 -0
- package/dist/viewer/state/viewer-effects.svelte.d.ts +2 -1
- package/dist/viewer/state/viewer-effects.svelte.d.ts.map +1 -1
- package/dist/viewer/state/viewport-handlers.d.ts +2 -0
- package/dist/viewer/state/viewport-handlers.d.ts.map +1 -1
- package/dist/viewer/style/element-style.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Component } from 'svelte';
|
|
2
2
|
import { LanguageModel, ChatTransport, UIMessage, ToolSet } from 'ai';
|
|
3
|
+
import { Options } from 'html2canvas-pro';
|
|
3
4
|
|
|
4
5
|
//#region src/core/types/actions.d.ts
|
|
5
6
|
/**
|
|
@@ -1144,6 +1145,22 @@ interface ShapeStyle {
|
|
|
1144
1145
|
fontRefIdx?: string;
|
|
1145
1146
|
/** Raw XML colour child of `<a:fontRef>`. */
|
|
1146
1147
|
fontRefColorXml?: XmlObject;
|
|
1148
|
+
/**
|
|
1149
|
+
* The fill `<a:fillRef>` resolved to, recorded ONLY when the shape's own
|
|
1150
|
+
* `spPr` authored no fill at all, so the reference is what paints it.
|
|
1151
|
+
*
|
|
1152
|
+
* Its absence therefore means "the fill is the shape's own", and its
|
|
1153
|
+
* presence plus an unchanged flat fill means "still purely inherited": see
|
|
1154
|
+
* `authored-shape-style.ts`, the shape-scope twin of `TextStyle`'s
|
|
1155
|
+
* `inheritedRunStyle`.
|
|
1156
|
+
*/
|
|
1157
|
+
inheritedFillStyle?: ShapeStyle;
|
|
1158
|
+
/**
|
|
1159
|
+
* The outline `<a:lnRef>` resolved to, recorded before `spPr/a:ln` was
|
|
1160
|
+
* layered on top. A property that still equals this baseline was never
|
|
1161
|
+
* authored on the shape and must not be written back as if it were.
|
|
1162
|
+
*/
|
|
1163
|
+
inheritedLineStyle?: ShapeStyle;
|
|
1147
1164
|
}
|
|
1148
1165
|
//#endregion
|
|
1149
1166
|
//#region src/core/types/text.d.ts
|
|
@@ -1184,6 +1201,60 @@ interface ShapeStyle {
|
|
|
1184
1201
|
interface TextStyle {
|
|
1185
1202
|
/** Original `a:rPr` XML retained by projections that share the shape-text model. */
|
|
1186
1203
|
runPropertiesXml?: XmlObject;
|
|
1204
|
+
/**
|
|
1205
|
+
* The properties this run's OWN `a:rPr` authored, and nothing else.
|
|
1206
|
+
*
|
|
1207
|
+
* A run style is assembled as
|
|
1208
|
+
* `{...inheritedRunStyle, ...authoredRunStyle}`, so the flat style is a
|
|
1209
|
+
* fully RESOLVED view: it cannot say whether `fontSize: 60` came from the
|
|
1210
|
+
* run, from the shape's `a:lstStyle`, from the layout placeholder, from the
|
|
1211
|
+
* master `p:txStyles` or from the theme. Omission is meaningful in OOXML
|
|
1212
|
+
* (§21.1.2.3), so a writer that re-emits the resolved view converts every
|
|
1213
|
+
* inherited value into an authored one and the deck stops being
|
|
1214
|
+
* theme-driven after one save.
|
|
1215
|
+
*
|
|
1216
|
+
* This is the run-scope twin of {@link TextSegment.paragraphProperties},
|
|
1217
|
+
* which is parsed strictly from the paragraph's own `a:pPr` for the same
|
|
1218
|
+
* reason. Present only for runs that came from a parsed deck; absent for
|
|
1219
|
+
* SDK-built text, where the flat style IS the only description and must be
|
|
1220
|
+
* written out in full.
|
|
1221
|
+
*/
|
|
1222
|
+
authoredRunStyle?: TextStyle;
|
|
1223
|
+
/**
|
|
1224
|
+
* The resolved inheritance baseline {@link authoredRunStyle} was layered
|
|
1225
|
+
* on top of (shape `a:lstStyle` -> placeholder -> layout -> master
|
|
1226
|
+
* `p:txStyles` -> theme -> `p:defaultTextStyle`).
|
|
1227
|
+
*
|
|
1228
|
+
* Kept alongside the authored half because the two answer different
|
|
1229
|
+
* questions. The authored half says "the source pinned this"; the baseline
|
|
1230
|
+
* says "this value is what inheritance already produces", which is how an
|
|
1231
|
+
* EDIT is told apart from an inherited value: an editor mutates the flat
|
|
1232
|
+
* style without knowing about either field, so a property that now differs
|
|
1233
|
+
* from the baseline was either authored or edited and must be written,
|
|
1234
|
+
* while one that still matches can be left to inherit.
|
|
1235
|
+
*
|
|
1236
|
+
* Holds a reference to the per-paragraph baseline object rather than a
|
|
1237
|
+
* copy, so carrying it costs one pointer per run.
|
|
1238
|
+
*/
|
|
1239
|
+
inheritedRunStyle?: TextStyle;
|
|
1240
|
+
/**
|
|
1241
|
+
* Snapshot of the ELEMENT-scope paragraph geometry (alignment, margins,
|
|
1242
|
+
* indent, line and paragraph spacing, tab stops, rtl, line-break flags) as
|
|
1243
|
+
* the load pipeline resolved it.
|
|
1244
|
+
*
|
|
1245
|
+
* Present only on an `element.textStyle` that came from a parsed deck, and
|
|
1246
|
+
* populated only with the geometry keys. It exists so the save path can
|
|
1247
|
+
* answer one question it otherwise cannot: has the user CHANGED the body's
|
|
1248
|
+
* alignment or indent, or is the value simply what the shape's
|
|
1249
|
+
* `a:lstStyle`, its layout placeholder and the master already produce?
|
|
1250
|
+
* Element-level text panels (`textAdvancedPatch`, `alignPatch` and friends
|
|
1251
|
+
* in `pptx-viewer-shared`) write `element.textStyle` and never touch
|
|
1252
|
+
* `segment.paragraphProperties`, so a diff against this snapshot is the
|
|
1253
|
+
* only way to tell an edit from an inheritance artefact.
|
|
1254
|
+
*
|
|
1255
|
+
* @see element-paragraph-geometry.ts
|
|
1256
|
+
*/
|
|
1257
|
+
resolvedParagraphGeometry?: TextStyle;
|
|
1187
1258
|
fontFamily?: string;
|
|
1188
1259
|
fontSize?: number;
|
|
1189
1260
|
/** When true, renderer should shrink text to fit the shape bounds. */
|
|
@@ -1639,7 +1710,28 @@ interface BulletInfo {
|
|
|
1639
1710
|
autoNumType?: string;
|
|
1640
1711
|
/** Auto-numbering start value. */
|
|
1641
1712
|
autoNumStartAt?: number;
|
|
1642
|
-
/**
|
|
1713
|
+
/**
|
|
1714
|
+
* Auto-numbering ORDINAL OFFSET: the zero-based distance of this paragraph
|
|
1715
|
+
* within its own numbered list, such that
|
|
1716
|
+
* `autoNumStartAt + paragraphIndex` is the ordinal to render. Despite the
|
|
1717
|
+
* name it is NOT the paragraph's position in the text body; the two agree
|
|
1718
|
+
* only for a list that starts at the first paragraph and is never
|
|
1719
|
+
* interrupted.
|
|
1720
|
+
*
|
|
1721
|
+
* It has to be the offset rather than the raw position because every
|
|
1722
|
+
* consumer that re-derives a marker from `BulletInfo` alone (the renderer's
|
|
1723
|
+
* `resolveParagraphBullet`, the Markdown converter's `resolveListMarker`)
|
|
1724
|
+
* computes `autoNumStartAt + paragraphIndex`. The load path resolves the
|
|
1725
|
+
* real sequence itself, restarting the count after any paragraph that
|
|
1726
|
+
* interrupts the list, and publishes the offset here so those consumers
|
|
1727
|
+
* land on the same number. With the raw position they did not, and BOTH
|
|
1728
|
+
* markers were painted ("3.1. Item"), because the paragraph builder drops
|
|
1729
|
+
* the parsed marker segment only when the two strings agree.
|
|
1730
|
+
*
|
|
1731
|
+
* Runtime-only: derived at parse time and never serialized. OOXML has no
|
|
1732
|
+
* counterpart (`a:buAutoNum` carries only `@type` and `@startAt`), so the
|
|
1733
|
+
* writer neither reads nor emits it.
|
|
1734
|
+
*/
|
|
1643
1735
|
paragraphIndex?: number;
|
|
1644
1736
|
/** Bullet font family from `a:buFont`. */
|
|
1645
1737
|
fontFamily?: string;
|
|
@@ -1827,6 +1919,15 @@ interface PptxElementBase {
|
|
|
1827
1919
|
shapeId?: string;
|
|
1828
1920
|
/** Element name from `cNvPr/@name`. Used for morph transition matching via the `!!` naming convention. */
|
|
1829
1921
|
name?: string;
|
|
1922
|
+
/**
|
|
1923
|
+
* `p:nvSpPr/p:nvPr/p:ph/@type` (lower-cased) when the shape is a placeholder:
|
|
1924
|
+
* `title`, `ctrtitle`, `body`, `subtitle`, `ftr`, `dt`, `sldnum`, ...
|
|
1925
|
+
*
|
|
1926
|
+
* Captured on load so consumers can tell a footer placeholder from a text box
|
|
1927
|
+
* without re-walking `rawXml`. Absent on non-placeholder shapes and on
|
|
1928
|
+
* SDK-created elements.
|
|
1929
|
+
*/
|
|
1930
|
+
placeholderType?: string;
|
|
1830
1931
|
x: number;
|
|
1831
1932
|
y: number;
|
|
1832
1933
|
width: number;
|
|
@@ -1887,6 +1988,19 @@ interface PptxTextProperties {
|
|
|
1887
1988
|
}>;
|
|
1888
1989
|
/** Placeholder prompt text inherited from layout/master (e.g. "Click to add title"). Shown as a greyed-out hint when the shape has no user-entered text. */
|
|
1889
1990
|
promptText?: string;
|
|
1991
|
+
/**
|
|
1992
|
+
* The string {@link text} was INHERITED from, when this is a header / footer /
|
|
1993
|
+
* date / slide-number placeholder whose own body the file leaves empty.
|
|
1994
|
+
*
|
|
1995
|
+
* PowerPoint keeps the footer string on the slide master and writes each
|
|
1996
|
+
* slide's copy of the `ftr` placeholder empty, so the empty body means
|
|
1997
|
+
* "render the master's footer here". Rendering needs the resolved string, but
|
|
1998
|
+
* SAVING it into the slide would pin that slide to today's master text and
|
|
1999
|
+
* silently detach it from the Header & Footer dialog. The save writer
|
|
2000
|
+
* therefore leaves the authored empty body alone while `text` still equals
|
|
2001
|
+
* this value, and writes a genuine per-slide override once it does not.
|
|
2002
|
+
*/
|
|
2003
|
+
inheritedPlaceholderText?: string;
|
|
1890
2004
|
/** Linked text box chain ID from `a:bodyPr > a:linkedTxbx/@id` or `a:txbx > a:linkedTxbx/@id`. Text overflows from one linked frame to the next. */
|
|
1891
2005
|
linkedTxbxId?: number;
|
|
1892
2006
|
/** Sequence number within a linked text box chain (0-based). */
|
|
@@ -2297,6 +2411,12 @@ interface PptxChartLineStyle {
|
|
|
2297
2411
|
}
|
|
2298
2412
|
/** Marker symbol types for line/scatter chart data points. */
|
|
2299
2413
|
type PptxChartMarkerSymbol = 'circle' | 'dash' | 'diamond' | 'dot' | 'none' | 'picture' | 'plus' | 'square' | 'star' | 'triangle' | 'x' | 'auto';
|
|
2414
|
+
/**
|
|
2415
|
+
* `ST_ScatterStyle` (ECMA-376 §21.2.3.40): how a scatter chart joins its points.
|
|
2416
|
+
* `line`/`lineMarker` connect them with straight segments, `smooth`/
|
|
2417
|
+
* `smoothMarker` with a bezier, `marker`/`none` not at all.
|
|
2418
|
+
*/
|
|
2419
|
+
type PptxChartScatterStyle = 'none' | 'line' | 'lineMarker' | 'marker' | 'smooth' | 'smoothMarker';
|
|
2300
2420
|
/** Shape properties extracted from c:spPr for chart formatting. */
|
|
2301
2421
|
interface PptxChartShapeProps {
|
|
2302
2422
|
fillColor?: string;
|
|
@@ -2498,6 +2618,42 @@ interface PptxChartTreemapOptions {
|
|
|
2498
2618
|
interface PptxChartSeries {
|
|
2499
2619
|
name: string;
|
|
2500
2620
|
values: number[];
|
|
2621
|
+
/**
|
|
2622
|
+
* Per-series x values from `c:ser/c:xVal` (scatter and bubble series only).
|
|
2623
|
+
*
|
|
2624
|
+
* Every `CT_ScatterSer` / `CT_BubbleSer` carries its OWN `c:xVal`, so two
|
|
2625
|
+
* series in one scatter chart routinely plot against different x ranges (the
|
|
2626
|
+
* normal case for measurement data). Reading the x values off the first
|
|
2627
|
+
* series and reusing them everywhere plotted every series against series 1's
|
|
2628
|
+
* x axis. Absent for category-axis chart kinds, where
|
|
2629
|
+
* {@link PptxChartData.categories} is the x axis.
|
|
2630
|
+
*/
|
|
2631
|
+
xValues?: number[];
|
|
2632
|
+
/**
|
|
2633
|
+
* Per-series bubble sizes from `c:ser/c:bubbleSize` (bubble series only),
|
|
2634
|
+
* aligned index-for-index with {@link values}.
|
|
2635
|
+
*
|
|
2636
|
+
* `CT_BubbleSer` carries x, y AND size, so a one-series bubble chart is fully
|
|
2637
|
+
* specified. Absent when the source omits `c:bubbleSize`.
|
|
2638
|
+
*/
|
|
2639
|
+
bubbleSizes?: number[];
|
|
2640
|
+
/**
|
|
2641
|
+
* Series-level data-label content flags from `c:ser/c:dLbls`.
|
|
2642
|
+
*
|
|
2643
|
+
* PowerPoint writes the flags a user picks in "Format Data Labels" onto the
|
|
2644
|
+
* SERIES, and leaves the chart-type-level `c:dLbls` all-zero, so reading only
|
|
2645
|
+
* the chart-level group reports "show nothing" for a chart that visibly shows
|
|
2646
|
+
* percentages. These override {@link PptxChartStyle.dataLabels}.
|
|
2647
|
+
*/
|
|
2648
|
+
dataLabelOptions?: PptxChartDataLabelOptions;
|
|
2649
|
+
/**
|
|
2650
|
+
* Whether the series line is explicitly suppressed
|
|
2651
|
+
* (`c:ser/c:spPr/a:ln/a:noFill`). Line-drawn kinds (line, scatter, radar)
|
|
2652
|
+
* use this to decide whether to draw a connecting line at all; a marker-only
|
|
2653
|
+
* scatter is authored as `scatterStyle="lineMarker"` PLUS this flag, never by
|
|
2654
|
+
* changing the scatter style.
|
|
2655
|
+
*/
|
|
2656
|
+
lineNoFill?: boolean;
|
|
2501
2657
|
/**
|
|
2502
2658
|
* Blank-value mask aligned index-for-index with {@link values}: `true` marks
|
|
2503
2659
|
* a category whose numeric cache point (`c:numCache/c:pt`) was absent or
|
|
@@ -2841,6 +2997,17 @@ interface PptxChartData {
|
|
|
2841
2997
|
* default), so only horizontal bar charts need to carry the field.
|
|
2842
2998
|
*/
|
|
2843
2999
|
barDirection?: PptxChartBarDirection;
|
|
3000
|
+
/**
|
|
3001
|
+
* Scatter presentation mode (`c:scatterChart/c:scatterStyle/@val`).
|
|
3002
|
+
*
|
|
3003
|
+
* `lineMarker` (PowerPoint's own default for every scatter it writes) and
|
|
3004
|
+
* `smoothMarker` draw a connecting line; `marker` and `none` do not. Whether
|
|
3005
|
+
* the MARKERS appear is decided separately by `c:marker/c:symbol`, and
|
|
3006
|
+
* whether the LINE appears is further gated by
|
|
3007
|
+
* {@link PptxChartSeries.lineNoFill} - PowerPoint expresses "markers only" as
|
|
3008
|
+
* `lineMarker` plus an `a:ln/a:noFill`, not as `marker`.
|
|
3009
|
+
*/
|
|
3010
|
+
scatterStyle?: PptxChartScatterStyle;
|
|
2844
3011
|
/**
|
|
2845
3012
|
* Bar/column gap between category clusters as a percentage of bar width
|
|
2846
3013
|
* (`c:gapWidth/@val`, 0 through 500). Absent uses the renderer default.
|
|
@@ -2994,6 +3161,53 @@ interface PptxChartData {
|
|
|
2994
3161
|
* // => { brightness: 20, contrast: -10, grayscale: true } satisfies PptxImageEffects
|
|
2995
3162
|
* ```
|
|
2996
3163
|
*/
|
|
3164
|
+
/**
|
|
3165
|
+
* One `a14:foregroundMark` / `a14:backgroundMark` polyline hint recorded while
|
|
3166
|
+
* the user painted over the picture in PowerPoint's "Remove Background" mode.
|
|
3167
|
+
* Coordinates are 0..1 fractions of the image.
|
|
3168
|
+
*/
|
|
3169
|
+
interface PptxBackgroundRemovalMark {
|
|
3170
|
+
x1: number;
|
|
3171
|
+
y1: number;
|
|
3172
|
+
x2: number;
|
|
3173
|
+
y2: number;
|
|
3174
|
+
}
|
|
3175
|
+
/**
|
|
3176
|
+
* PowerPoint "Remove Background" state (`a14:backgroundRemoval`).
|
|
3177
|
+
*
|
|
3178
|
+
* The four edges are the RETAINED rectangle as 0..1 fractions of the image
|
|
3179
|
+
* (OOXML stores them as per-100000 relative units), and the mark lists are the
|
|
3180
|
+
* segmentation hints the user painted.
|
|
3181
|
+
*
|
|
3182
|
+
* **This is edit-time metadata, not a render instruction.** PowerPoint bakes the
|
|
3183
|
+
* removal into the bitmap referenced by the main `a:blip/@r:embed` and keeps the
|
|
3184
|
+
* pristine original in `a14:imgLayer/@r:embed`. Verified against PowerPoint COM:
|
|
3185
|
+
* a slide exported with and without this element is byte-identical. A renderer
|
|
3186
|
+
* that clips to the retained rectangle would clip an image whose background has
|
|
3187
|
+
* already been removed.
|
|
3188
|
+
*
|
|
3189
|
+
* @example
|
|
3190
|
+
* ```ts
|
|
3191
|
+
* const removal: PptxBackgroundRemoval = { top: 0.12, bottom: 0.88, left: 0.07, right: 0.93 };
|
|
3192
|
+
* // => retains the middle of the image; the marks list stays empty
|
|
3193
|
+
* ```
|
|
3194
|
+
*/
|
|
3195
|
+
interface PptxBackgroundRemoval {
|
|
3196
|
+
/** Top edge of the retained rectangle (0..1 fraction of the image height). */
|
|
3197
|
+
top: number;
|
|
3198
|
+
/** Bottom edge of the retained rectangle (0..1 fraction of the image height). */
|
|
3199
|
+
bottom: number;
|
|
3200
|
+
/** Left edge of the retained rectangle (0..1 fraction of the image width). */
|
|
3201
|
+
left: number;
|
|
3202
|
+
/** Right edge of the retained rectangle (0..1 fraction of the image width). */
|
|
3203
|
+
right: number;
|
|
3204
|
+
/** Strokes marking regions the user forced to be foreground. */
|
|
3205
|
+
foregroundMarks?: PptxBackgroundRemovalMark[];
|
|
3206
|
+
/** Strokes marking regions the user forced to be background. */
|
|
3207
|
+
backgroundMarks?: PptxBackgroundRemovalMark[];
|
|
3208
|
+
/** Original effect XML, retained for lossless re-emission. */
|
|
3209
|
+
rawXml?: XmlObject;
|
|
3210
|
+
}
|
|
2997
3211
|
interface PptxImageEffects {
|
|
2998
3212
|
/** Brightness adjustment (-100 to 100). */
|
|
2999
3213
|
brightness?: number;
|
|
@@ -3017,8 +3231,38 @@ interface PptxImageEffects {
|
|
|
3017
3231
|
};
|
|
3018
3232
|
/** Artistic effect name (blur, pencilGrayscale, paintStrokes, etc.). */
|
|
3019
3233
|
artisticEffect?: string;
|
|
3020
|
-
/** Artistic effect radius/amount. */
|
|
3234
|
+
/** Artistic effect radius/amount, normalised to 0..100. */
|
|
3021
3235
|
artisticRadius?: number;
|
|
3236
|
+
/**
|
|
3237
|
+
* Every numeric attribute of the source `a14:artistic*` element, raw and
|
|
3238
|
+
* un-normalised (`trans`, `pencilSize`, `crackSpacing`, …). The attribute set
|
|
3239
|
+
* differs per effect, so this is the lossless companion to the single
|
|
3240
|
+
* {@link PptxImageEffects.artisticRadius} number.
|
|
3241
|
+
*/
|
|
3242
|
+
artisticParams?: Record<string, number>;
|
|
3243
|
+
/**
|
|
3244
|
+
* Name of the artistic effect ALREADY baked into the image data, which a
|
|
3245
|
+
* renderer must not apply a second time. Set from the `a14` blip extension,
|
|
3246
|
+
* which PowerPoint writes alongside a pre-rendered bitmap (see
|
|
3247
|
+
* {@link PptxBackgroundRemoval}), and normally equal to
|
|
3248
|
+
* {@link PptxImageEffects.artisticEffect}.
|
|
3249
|
+
*
|
|
3250
|
+
* It records the NAME rather than a boolean so that picking a different
|
|
3251
|
+
* effect in this library's inspector (which patches `artisticEffect` alone)
|
|
3252
|
+
* still renders: the two names then differ.
|
|
3253
|
+
*/
|
|
3254
|
+
artisticPrerenderedEffect?: string;
|
|
3255
|
+
/**
|
|
3256
|
+
* PowerPoint "Remove Background" state (`a14:backgroundRemoval`). Edit-time
|
|
3257
|
+
* metadata: the removal is already baked into the image data.
|
|
3258
|
+
*/
|
|
3259
|
+
backgroundRemoval?: PptxBackgroundRemoval;
|
|
3260
|
+
/**
|
|
3261
|
+
* `a14:imgLayer/@r:embed` — relationship id of the PRISTINE original image
|
|
3262
|
+
* the baked effects were derived from (PowerPoint stores it as an HD Photo
|
|
3263
|
+
* `.wdp` part, which browsers cannot decode).
|
|
3264
|
+
*/
|
|
3265
|
+
originalImageRelId?: string;
|
|
3022
3266
|
/** Alpha modulation fixed: non-negative percentage (100 means unchanged opacity). */
|
|
3023
3267
|
alphaModFix?: number;
|
|
3024
3268
|
/** Original alpha modulation fixed node, including foreign attributes. */
|
|
@@ -3934,6 +4178,11 @@ interface PptxTableCellStyle {
|
|
|
3934
4178
|
italic?: boolean;
|
|
3935
4179
|
underline?: boolean;
|
|
3936
4180
|
color?: string;
|
|
4181
|
+
/**
|
|
4182
|
+
* Font family from the first run's `a:rPr/a:latin@typeface` (falling back to
|
|
4183
|
+
* `a:ea` / `a:cs`). Per-run families live on {@link PptxTableCellTextRun}.
|
|
4184
|
+
*/
|
|
4185
|
+
fontFamily?: string;
|
|
3937
4186
|
/**
|
|
3938
4187
|
* Raw XML colour-choice node preserved from `a:tc/a:txBody/.../a:rPr/a:solidFill`
|
|
3939
4188
|
* for round-trip serialisation. Currently unused by the cell-level writer
|
|
@@ -4089,6 +4338,45 @@ interface PptxTableCell3D {
|
|
|
4089
4338
|
/** Light rig direction (`a:lightRig@dir`, e.g. `tl`, `t`, `tr`). */
|
|
4090
4339
|
lightRigDirection?: string;
|
|
4091
4340
|
}
|
|
4341
|
+
/**
|
|
4342
|
+
* One styled text run inside a table cell's `a:txBody`.
|
|
4343
|
+
*
|
|
4344
|
+
* `PptxTableCell.text` is a flat string and `PptxTableCell.style` describes
|
|
4345
|
+
* only the FIRST run, so a cell mixing formats ("Revenue **grew 42%** last
|
|
4346
|
+
* year") cannot be represented by those two alone. {@link PptxTableCell.runs}
|
|
4347
|
+
* carries the full sequence, with paragraph and line breaks as marker entries
|
|
4348
|
+
* so a renderer can walk it linearly.
|
|
4349
|
+
*
|
|
4350
|
+
* Structurally identical to `pptx-viewer-shared`'s `CellTextRun`, which every
|
|
4351
|
+
* binding's table renderer already consumes.
|
|
4352
|
+
*
|
|
4353
|
+
* @example
|
|
4354
|
+
* ```ts
|
|
4355
|
+
* const runs: PptxTableCellTextRun[] = [
|
|
4356
|
+
* { text: "Revenue " },
|
|
4357
|
+
* { text: "grew 42%", bold: true, color: "#C00000" },
|
|
4358
|
+
* ];
|
|
4359
|
+
* // => satisfies PptxTableCellTextRun[]
|
|
4360
|
+
* ```
|
|
4361
|
+
*/
|
|
4362
|
+
interface PptxTableCellTextRun {
|
|
4363
|
+
/** Run text. Empty for the break markers below. */
|
|
4364
|
+
text: string;
|
|
4365
|
+
/** This entry starts a new paragraph (`a:p` boundary) rather than carrying text. */
|
|
4366
|
+
isParagraphBreak?: boolean;
|
|
4367
|
+
/** This entry is a soft line break (`a:br`) rather than carrying text. */
|
|
4368
|
+
isLineBreak?: boolean;
|
|
4369
|
+
bold?: boolean;
|
|
4370
|
+
italic?: boolean;
|
|
4371
|
+
underline?: boolean;
|
|
4372
|
+
strikethrough?: boolean;
|
|
4373
|
+
/** Resolved run colour as a CSS colour string. */
|
|
4374
|
+
color?: string;
|
|
4375
|
+
/** Run font size in points (`a:rPr@sz` / 100). */
|
|
4376
|
+
fontSize?: number;
|
|
4377
|
+
/** Run font family from `a:rPr/a:latin@typeface` (or `a:ea` / `a:cs`). */
|
|
4378
|
+
fontFamily?: string;
|
|
4379
|
+
}
|
|
4092
4380
|
/**
|
|
4093
4381
|
* A single table cell with text content, optional style, and merge info.
|
|
4094
4382
|
*
|
|
@@ -4105,6 +4393,15 @@ interface PptxTableCell3D {
|
|
|
4105
4393
|
interface PptxTableCell {
|
|
4106
4394
|
text: string;
|
|
4107
4395
|
style?: PptxTableCellStyle;
|
|
4396
|
+
/**
|
|
4397
|
+
* Per-run formatting for the cell's text, when it has any beyond what
|
|
4398
|
+
* {@link style} can express. Present only for cells whose `a:txBody`
|
|
4399
|
+
* actually carries runs; renderers fall back to {@link text} when absent.
|
|
4400
|
+
*
|
|
4401
|
+
* Editing a cell's text invalidates these (the editor produces a plain
|
|
4402
|
+
* string), so an edit path must clear them alongside setting `text`.
|
|
4403
|
+
*/
|
|
4404
|
+
textRuns?: PptxTableCellTextRun[];
|
|
4108
4405
|
/** Column span (defaults to 1). */
|
|
4109
4406
|
gridSpan?: number;
|
|
4110
4407
|
/** Row span (defaults to 1). */
|
|
@@ -4877,13 +5174,42 @@ interface UnknownPptxElement extends PptxElementBase {
|
|
|
4877
5174
|
/**
|
|
4878
5175
|
* A single element on a PPTX slide.
|
|
4879
5176
|
*
|
|
4880
|
-
* This is a **discriminated union
|
|
5177
|
+
* This is a **discriminated union**: narrow on `element.type` to access
|
|
4881
5178
|
* variant-specific properties like `imageData` (image/picture), `pathData`
|
|
4882
5179
|
* (shape), or `textSegments` (text/shape).
|
|
4883
5180
|
*/
|
|
4884
5181
|
type PptxElement = TextPptxElement | ShapePptxElement | ConnectorPptxElement | ImagePptxElement | PicturePptxElement | TablePptxElement | ChartPptxElement | SmartArtPptxElement | OlePptxElement | MediaPptxElement | GroupPptxElement | InkPptxElement | ContentPartPptxElement | ZoomPptxElement | Model3DPptxElement | UnknownPptxElement;
|
|
4885
5182
|
//#endregion
|
|
4886
5183
|
//#region src/core/types/masters.d.ts
|
|
5184
|
+
/**
|
|
5185
|
+
* A placeholder slot declared on a master or layout.
|
|
5186
|
+
*
|
|
5187
|
+
* The geometry fields are in CSS pixels (EMU / {@link EMU_PER_PX}) and are only
|
|
5188
|
+
* present when the shape carried an explicit `a:xfrm`. Placeholders that
|
|
5189
|
+
* inherit their frame from the master leave them undefined, so consumers that
|
|
5190
|
+
* draw placeholder outlines (the layout gallery) must skip those entries
|
|
5191
|
+
* rather than assume a zero-sized box at the origin.
|
|
5192
|
+
*
|
|
5193
|
+
* @example
|
|
5194
|
+
* ```ts
|
|
5195
|
+
* const frame: PptxPlaceholderFrame = { type: "body", idx: "1", x: 63, y: 130 };
|
|
5196
|
+
* // => satisfies PptxPlaceholderFrame
|
|
5197
|
+
* ```
|
|
5198
|
+
*/
|
|
5199
|
+
interface PptxPlaceholderFrame {
|
|
5200
|
+
/** `p:ph/@type`, lower-cased by the parser; defaults to `body` when omitted. */
|
|
5201
|
+
type: string;
|
|
5202
|
+
/** `p:ph/@idx`, when present. */
|
|
5203
|
+
idx?: string;
|
|
5204
|
+
/** Left offset in CSS pixels, when the shape declares `a:off`. */
|
|
5205
|
+
x?: number;
|
|
5206
|
+
/** Top offset in CSS pixels, when the shape declares `a:off`. */
|
|
5207
|
+
y?: number;
|
|
5208
|
+
/** Width in CSS pixels, when the shape declares `a:ext`. */
|
|
5209
|
+
width?: number;
|
|
5210
|
+
/** Height in CSS pixels, when the shape declares `a:ext`. */
|
|
5211
|
+
height?: number;
|
|
5212
|
+
}
|
|
4887
5213
|
/**
|
|
4888
5214
|
* Parsed notes master from `ppt/notesMasters/notesMaster1.xml`.
|
|
4889
5215
|
*
|
|
@@ -4905,10 +5231,7 @@ interface PptxNotesMaster {
|
|
|
4905
5231
|
/** Background image data URL. */
|
|
4906
5232
|
backgroundImage?: string;
|
|
4907
5233
|
/** Placeholder shapes found on the notes master. */
|
|
4908
|
-
placeholders?:
|
|
4909
|
-
type: string;
|
|
4910
|
-
idx?: string;
|
|
4911
|
-
}>;
|
|
5234
|
+
placeholders?: PptxPlaceholderFrame[];
|
|
4912
5235
|
/** Editable elements on the notes master (header, footer, date, page number, slide image, notes body). */
|
|
4913
5236
|
elements?: PptxElement[];
|
|
4914
5237
|
/** Header/footer flags from `<p:hf>` on the notes master (P-H3). */
|
|
@@ -4936,10 +5259,7 @@ interface PptxHandoutMaster {
|
|
|
4936
5259
|
/** Background image data URL. */
|
|
4937
5260
|
backgroundImage?: string;
|
|
4938
5261
|
/** Placeholder shapes found on the handout master. */
|
|
4939
|
-
placeholders?:
|
|
4940
|
-
type: string;
|
|
4941
|
-
idx?: string;
|
|
4942
|
-
}>;
|
|
5262
|
+
placeholders?: PptxPlaceholderFrame[];
|
|
4943
5263
|
/** Editable elements on the handout master (header, footer, date, page number, slide placeholders). */
|
|
4944
5264
|
elements?: PptxElement[];
|
|
4945
5265
|
/** Number of slides per page for handout print layout (1, 2, 3, 4, 6, or 9). */
|
|
@@ -4977,10 +5297,7 @@ interface PptxSlideMaster {
|
|
|
4977
5297
|
/** Layout paths associated with this master. */
|
|
4978
5298
|
layoutPaths?: string[];
|
|
4979
5299
|
/** Placeholder shapes on the master. */
|
|
4980
|
-
placeholders?:
|
|
4981
|
-
type: string;
|
|
4982
|
-
idx?: string;
|
|
4983
|
-
}>;
|
|
5300
|
+
placeholders?: PptxPlaceholderFrame[];
|
|
4984
5301
|
/** Parsed element shapes on the master slide (for master view rendering). */
|
|
4985
5302
|
elements?: PptxElement[];
|
|
4986
5303
|
/** Parsed slide layout objects associated with this master. */
|
|
@@ -5052,10 +5369,7 @@ interface PptxSlideLayout {
|
|
|
5052
5369
|
/** Parsed element shapes on the layout. */
|
|
5053
5370
|
elements?: PptxElement[];
|
|
5054
5371
|
/** Placeholder shapes on the layout. */
|
|
5055
|
-
placeholders?:
|
|
5056
|
-
type: string;
|
|
5057
|
-
idx?: string;
|
|
5058
|
-
}>;
|
|
5372
|
+
placeholders?: PptxPlaceholderFrame[];
|
|
5059
5373
|
/** Matching name attribute for layout identification (`@matchingName`). */
|
|
5060
5374
|
matchingName?: string;
|
|
5061
5375
|
/** Whether the layout is marked as preserved (prevent deletion, `@preserve`). */
|
|
@@ -5069,6 +5383,42 @@ interface PptxSlideLayout {
|
|
|
5069
5383
|
/** Header/footer flags from `<p:hf>` on this layout (P-H3). */
|
|
5070
5384
|
headerFooter?: PptxHeaderFooterFlags;
|
|
5071
5385
|
}
|
|
5386
|
+
/**
|
|
5387
|
+
* Rendered content of a single layout, used to draw gallery thumbnails.
|
|
5388
|
+
*
|
|
5389
|
+
* Produced on demand rather than during load: materialising every layout's
|
|
5390
|
+
* artwork (and decoding its images) up front costs a noticeable amount of time
|
|
5391
|
+
* on decks with many masters, and most sessions never open the layout gallery
|
|
5392
|
+
* at all.
|
|
5393
|
+
*
|
|
5394
|
+
* @example
|
|
5395
|
+
* ```ts
|
|
5396
|
+
* const preview: PptxLayoutPreview = {
|
|
5397
|
+
* path: "ppt/slideLayouts/slideLayout2.xml",
|
|
5398
|
+
* width: 960,
|
|
5399
|
+
* height: 540,
|
|
5400
|
+
* elements: [],
|
|
5401
|
+
* placeholders: [{ type: "title" }],
|
|
5402
|
+
* };
|
|
5403
|
+
* // => satisfies PptxLayoutPreview
|
|
5404
|
+
* ```
|
|
5405
|
+
*/
|
|
5406
|
+
interface PptxLayoutPreview {
|
|
5407
|
+
/** ZIP path of the layout this preview belongs to. */
|
|
5408
|
+
path: string;
|
|
5409
|
+
/** Slide width in CSS pixels, so a thumbnail can compute its own scale. */
|
|
5410
|
+
width: number;
|
|
5411
|
+
/** Slide height in CSS pixels. */
|
|
5412
|
+
height: number;
|
|
5413
|
+
/** Background resolved from the layout, falling back to its master's. */
|
|
5414
|
+
backgroundColor?: string;
|
|
5415
|
+
/** Background image data URL, when the layout or master declares one. */
|
|
5416
|
+
backgroundImage?: string;
|
|
5417
|
+
/** The layout's own artwork (pictures, shapes and static text). */
|
|
5418
|
+
elements: PptxElement[];
|
|
5419
|
+
/** Placeholder slots, drawn as outlined frames in the gallery. */
|
|
5420
|
+
placeholders: PptxPlaceholderFrame[];
|
|
5421
|
+
}
|
|
5072
5422
|
/**
|
|
5073
5423
|
* A theme part available in the presentation package.
|
|
5074
5424
|
*
|
|
@@ -5557,6 +5907,54 @@ interface PptxEmbeddedFontList {
|
|
|
5557
5907
|
rawXml?: XmlObject;
|
|
5558
5908
|
}
|
|
5559
5909
|
//#endregion
|
|
5910
|
+
//#region src/core/types/comment-mentions.d.ts
|
|
5911
|
+
/**
|
|
5912
|
+
* A single `@`-mention inside a modern comment body.
|
|
5913
|
+
*
|
|
5914
|
+
* Offsets index into the comment's FLATTENED plain text: every `a:t` value
|
|
5915
|
+
* below `p188:txBody` concatenated, with paragraphs joined by `\n`. That is the
|
|
5916
|
+
* same string `PptxComment.text` carries, so an edit to `text` invalidates
|
|
5917
|
+
* every offset after the edit point and the serializer re-bases them.
|
|
5918
|
+
*
|
|
5919
|
+
* The markup Office uses for a mention is `CT_Mention` (documented for the
|
|
5920
|
+
* SpreadsheetML `2018/threadedcomments` part): `mentionpersonId`, `mentionId`,
|
|
5921
|
+
* `startIndex` and `length`. The PowerPoint `2018/8/main` schema does not
|
|
5922
|
+
* publish a mention element at all, so `rawXml` is retained and re-emitted
|
|
5923
|
+
* attribute-for-attribute: a producer that spells the attributes differently
|
|
5924
|
+
* still round-trips.
|
|
5925
|
+
*
|
|
5926
|
+
* @example
|
|
5927
|
+
* ```ts
|
|
5928
|
+
* const mention: PptxCommentMention = {
|
|
5929
|
+
* personId: "{2CB2E9D0-D392-EB21-5D46-FBA34C1295E6}",
|
|
5930
|
+
* authorName: "Bob Example",
|
|
5931
|
+
* startIndex: 3,
|
|
5932
|
+
* length: 11,
|
|
5933
|
+
* };
|
|
5934
|
+
* // => "Hi Bob Example can you check this".slice(3, 14) === "Bob Example"
|
|
5935
|
+
* ```
|
|
5936
|
+
*/
|
|
5937
|
+
interface PptxCommentMention {
|
|
5938
|
+
/** `mentionId`: GUID identifying this mention instance. */
|
|
5939
|
+
id?: string;
|
|
5940
|
+
/** `mentionpersonId`: the `p188:author` id of the mentioned person. */
|
|
5941
|
+
personId: string;
|
|
5942
|
+
/** Display name resolved from the author list at parse time, when known. */
|
|
5943
|
+
authorName?: string;
|
|
5944
|
+
/** Character offset of the mentioned span in the flattened plain text. */
|
|
5945
|
+
startIndex: number;
|
|
5946
|
+
/** Character length of the mentioned span. */
|
|
5947
|
+
length: number;
|
|
5948
|
+
/**
|
|
5949
|
+
* `uri` of the `p188:ext` this mention list was read from. Undefined means
|
|
5950
|
+
* the list is a direct child of `p188:cm`, which is where it is written for
|
|
5951
|
+
* newly authored mentions.
|
|
5952
|
+
*/
|
|
5953
|
+
containerUri?: string;
|
|
5954
|
+
/** Original `p188:mention` node, retained for unknown-attribute preservation. */
|
|
5955
|
+
rawXml?: XmlObject;
|
|
5956
|
+
}
|
|
5957
|
+
//#endregion
|
|
5560
5958
|
//#region src/core/types/metadata.d.ts
|
|
5561
5959
|
/**
|
|
5562
5960
|
* A slide comment — may be a legacy positional comment or a modern
|
|
@@ -5603,6 +6001,8 @@ interface PptxComment {
|
|
|
5603
6001
|
title?: string;
|
|
5604
6002
|
/** Modern threaded comment support (p15:threadingInfo). */
|
|
5605
6003
|
threadId?: string;
|
|
6004
|
+
/** `@`-mentions, indexed into `text` (see {@link PptxCommentMention}). */
|
|
6005
|
+
mentions?: PptxCommentMention[];
|
|
5606
6006
|
/** Replies to this comment (for modern threaded comments). */
|
|
5607
6007
|
replies?: PptxComment[];
|
|
5608
6008
|
/** ID of the element this comment is associated with (if any). */
|
|
@@ -6122,7 +6522,7 @@ interface PptxTheme {
|
|
|
6122
6522
|
* // => "morph" — one of 40+ transition effects
|
|
6123
6523
|
* ```
|
|
6124
6524
|
*/
|
|
6125
|
-
type PptxTransitionType = 'none' | 'cut' | 'fade' | 'push' | 'wipe' | 'split' | 'randomBar' | 'blinds' | 'checker' | 'circle' | 'comb' | 'cover' | 'diamond' | 'dissolve' | 'plus' | 'pull' | 'random' | 'strips' | 'uncover' | 'wedge' | 'wheel' | 'zoom' | 'newsflash' | 'morph' | 'conveyor' | 'doors' | 'ferris' | 'flash' | 'flythrough' | 'gallery' | 'glitter' | 'honeycomb' | 'pan' | 'prism' | 'reveal' | 'ripple' | 'shred' | 'switch' | 'vortex' | 'warp' | 'wheelReverse' | 'window' | 'cube' | 'flip' | 'rotate' | 'orbit' | 'fallOver' | 'drape' | 'curtains' | 'wind' | 'prestige' | 'fracture' | 'crush' | 'peelOff' | 'pageCurlDouble' | 'pageCurlSingle' | 'airplane' | 'origami';
|
|
6525
|
+
type PptxTransitionType = 'none' | 'cut' | 'fade' | 'push' | 'wipe' | 'split' | 'randomBar' | 'blinds' | 'checker' | 'circle' | 'comb' | 'cover' | 'diamond' | 'dissolve' | 'plus' | 'pull' | 'random' | 'strips' | 'uncover' | 'wedge' | 'wheel' | 'zoom' | 'newsflash' | 'morph' | 'conveyor' | 'doors' | 'ferris' | 'flash' | 'flythrough' | 'gallery' | 'glitter' | 'honeycomb' | 'pan' | 'prism' | 'reveal' | 'ripple' | 'shred' | 'switch' | 'vortex' | 'warp' | 'wheelReverse' | 'window' | 'cube' | 'flip' | 'rotate' | 'box' | 'orbit' | 'fallOver' | 'drape' | 'curtains' | 'wind' | 'prestige' | 'fracture' | 'crush' | 'peelOff' | 'pageCurlDouble' | 'pageCurlSingle' | 'airplane' | 'origami';
|
|
6126
6526
|
/** Split orientation from OOXML `@_orient`. */
|
|
6127
6527
|
type PptxSplitOrientation = 'horz' | 'vert';
|
|
6128
6528
|
/** Schema-defined `ST_TransitionSpeed` values. */
|
|
@@ -6417,6 +6817,18 @@ interface PptxSlideBackgroundPattern {
|
|
|
6417
6817
|
interface PptxSlide {
|
|
6418
6818
|
id: string;
|
|
6419
6819
|
rId: string;
|
|
6820
|
+
/**
|
|
6821
|
+
* `p:sldIdLst/p:sldId/@id` (ST_SlideId, 256..2147483647): the numeric key
|
|
6822
|
+
* that sections (`p14:sldIdLst/p14:sldId/@id`) and section/summary zooms
|
|
6823
|
+
* name slides by.
|
|
6824
|
+
*
|
|
6825
|
+
* It lives in `presentation.xml`, NOT in the slide part, so it cannot be
|
|
6826
|
+
* recovered from `rawXml`. Without it on the model, code that writes a
|
|
6827
|
+
* section's membership has nothing correct to write and falls back to the
|
|
6828
|
+
* slide NUMBER, which is 1-based and therefore never matches a real deck's
|
|
6829
|
+
* ids: the section reloads with no slides in it.
|
|
6830
|
+
*/
|
|
6831
|
+
slideId?: string;
|
|
6420
6832
|
sourceSlideId?: string;
|
|
6421
6833
|
/** Optional author-supplied slide name (set via `SlideBuilder.setName`). */
|
|
6422
6834
|
name?: string;
|
|
@@ -6619,6 +7031,26 @@ interface PptxPresentationProperties {
|
|
|
6619
7031
|
/** Kiosk auto-restart interval in milliseconds (from `p:kiosk/@restart`). Only meaningful when showType is "kiosk". */
|
|
6620
7032
|
kioskRestartTime?: number;
|
|
6621
7033
|
}
|
|
7034
|
+
/**
|
|
7035
|
+
* Slide dimensions from `p:sldSz` (CT_SlideSize, ECMA-376 §19.2.1.39).
|
|
7036
|
+
*
|
|
7037
|
+
* @example
|
|
7038
|
+
* ```ts
|
|
7039
|
+
* const size: PptxSlideSize = { widthEmu: 9144000, heightEmu: 6858000, type: 'screen4x3' };
|
|
7040
|
+
* // => satisfies PptxSlideSize
|
|
7041
|
+
* ```
|
|
7042
|
+
*/
|
|
7043
|
+
interface PptxSlideSize {
|
|
7044
|
+
/** `@cx` in EMU. Omitted or non-positive values leave the loaded width alone. */
|
|
7045
|
+
widthEmu?: number;
|
|
7046
|
+
/** `@cy` in EMU. Omitted or non-positive values leave the loaded height alone. */
|
|
7047
|
+
heightEmu?: number;
|
|
7048
|
+
/**
|
|
7049
|
+
* `@type` (ST_SlideSizeType). The schema default is `custom`, which is
|
|
7050
|
+
* why PowerPoint omits the attribute for a non-preset size.
|
|
7051
|
+
*/
|
|
7052
|
+
type?: string;
|
|
7053
|
+
}
|
|
6622
7054
|
/**
|
|
6623
7055
|
* A named custom slide show (`p:custShowLst / p:custShow`).
|
|
6624
7056
|
*
|
|
@@ -7633,6 +8065,19 @@ interface PptxHandlerSaveOptions {
|
|
|
7633
8065
|
customerData?: PptxCustomerData[];
|
|
7634
8066
|
/** Photo album metadata to save back to `p:photoAlbum`. */
|
|
7635
8067
|
photoAlbum?: PptxPhotoAlbum;
|
|
8068
|
+
/**
|
|
8069
|
+
* Slide dimensions to write back to `p:sldSz`.
|
|
8070
|
+
*
|
|
8071
|
+
* Omitting the option preserves the load-time dimensions verbatim, which
|
|
8072
|
+
* is why an edit made through a viewer's Slide Size control has to reach
|
|
8073
|
+
* the save call: nothing else in the pipeline can observe it.
|
|
8074
|
+
*
|
|
8075
|
+
* PowerPoint derives `Presentation.PageSetup.SlideSize` from `@cx`/`@cy`
|
|
8076
|
+
* alone (verified by COM: an A4-typed `p:sldSz` carrying 4:3 dimensions
|
|
8077
|
+
* still reports `ppSlideSizeCustom`), so `type` is written for fidelity
|
|
8078
|
+
* but the dimensions are what actually decide the reported preset.
|
|
8079
|
+
*/
|
|
8080
|
+
slideSize?: PptxSlideSize;
|
|
7636
8081
|
/** East Asian line-break settings to save back to `p:kinsoku`. */
|
|
7637
8082
|
kinsoku?: PptxKinsoku | null;
|
|
7638
8083
|
/** Write-protection verifier. Set to `null` to remove, `undefined` to preserve existing. */
|
|
@@ -7688,6 +8133,8 @@ interface IPptxHandlerRuntime {
|
|
|
7688
8133
|
revokeBlobUrls(): void;
|
|
7689
8134
|
getCompatibilityWarnings(): PptxCompatibilityWarning[];
|
|
7690
8135
|
getLayoutOptions(): PptxLayoutOption[];
|
|
8136
|
+
getLayoutPreview(layoutPath: string): Promise<PptxLayoutPreview | null>;
|
|
8137
|
+
getLayoutPreviews(layoutPaths?: readonly string[]): Promise<PptxLayoutPreview[]>;
|
|
7691
8138
|
createXmlBuilder(data: PptxData): PptxXmlBuilder;
|
|
7692
8139
|
Builder(data: PptxData): PptxXmlBuilder;
|
|
7693
8140
|
setTemplateBackground(path: string, backgroundColor: string | undefined): void;
|
|
@@ -7876,6 +8323,26 @@ declare class PptxHandlerCore {
|
|
|
7876
8323
|
* @returns Array of {@link PptxLayoutOption} entries.
|
|
7877
8324
|
*/
|
|
7878
8325
|
getLayoutOptions(): PptxLayoutOption[];
|
|
8326
|
+
/**
|
|
8327
|
+
* Build the artwork thumbnails backing the New Slide / Layout galleries.
|
|
8328
|
+
*
|
|
8329
|
+
* Parsing happens on first request and is memoised afterwards, so opening
|
|
8330
|
+
* the gallery costs one pass over the layout parts and reopening it costs
|
|
8331
|
+
* nothing. Callers that only need one entry should prefer
|
|
8332
|
+
* {@link getLayoutPreview}.
|
|
8333
|
+
*
|
|
8334
|
+
* @param layoutPaths - Restrict the result to these layouts; defaults to
|
|
8335
|
+
* every layout in the presentation.
|
|
8336
|
+
* @returns One {@link PptxLayoutPreview} per resolvable layout.
|
|
8337
|
+
*/
|
|
8338
|
+
getLayoutPreviews(layoutPaths?: readonly string[]): Promise<PptxLayoutPreview[]>;
|
|
8339
|
+
/**
|
|
8340
|
+
* Build the artwork thumbnail for a single layout.
|
|
8341
|
+
*
|
|
8342
|
+
* @param layoutPath - Archive path of the `p:sldLayout` part.
|
|
8343
|
+
* @returns The preview, or `null` when the presentation has no such layout.
|
|
8344
|
+
*/
|
|
8345
|
+
getLayoutPreview(layoutPath: string): Promise<PptxLayoutPreview | null>;
|
|
7879
8346
|
/**
|
|
7880
8347
|
* Create a fluent XML builder scoped to the given presentation data.
|
|
7881
8348
|
*
|
|
@@ -8202,24 +8669,38 @@ declare class PptxHandlerCore {
|
|
|
8202
8669
|
name?: string;
|
|
8203
8670
|
}>>;
|
|
8204
8671
|
/**
|
|
8205
|
-
* Export selected slides
|
|
8672
|
+
* Export selected slides to a vector or raster format, keyed by slide index.
|
|
8673
|
+
*
|
|
8674
|
+
* **This does not produce PPTX files.** The previous version of this comment
|
|
8675
|
+
* said each entry was "a standalone PPTX with only that slide", named the
|
|
8676
|
+
* option `slideIndexes` (the real field is `slideIndices`), and wrote the
|
|
8677
|
+
* bytes to `slide_N.pptx`. None of that was ever true: the runtime has
|
|
8678
|
+
* always taken a `format` of `svg` / `png` / `pdf`. Per-slide PPTX
|
|
8679
|
+
* extraction is a different operation and is not implemented here.
|
|
8206
8680
|
*
|
|
8207
|
-
*
|
|
8208
|
-
*
|
|
8681
|
+
* Only `svg` works without a host-supplied backend, and it works fully:
|
|
8682
|
+
* the headless {@link SvgExporter} renders it with no DOM. `png` and `pdf`
|
|
8683
|
+
* THROW, because this package carries no rasteriser; use a viewer binding's
|
|
8684
|
+
* browser export pipeline, or override `exportSlides` on the runtime with
|
|
8685
|
+
* your own backend.
|
|
8209
8686
|
*
|
|
8210
8687
|
* @param slides - Full slide array.
|
|
8211
|
-
* @param options - Export options (
|
|
8212
|
-
* @returns A `Map<slideIndex, Uint8Array>` of exported files.
|
|
8688
|
+
* @param options - Export options (`format`, `slideIndices`, `width`, ...).
|
|
8689
|
+
* @returns A `Map<slideIndex, Uint8Array>` of exported files. Hidden slides
|
|
8690
|
+
* are omitted unless `options.includeHidden` is set, so the map can be
|
|
8691
|
+
* smaller than `options.slideIndices`.
|
|
8692
|
+
* @throws {Error} when `options.format` is `png` or `pdf`.
|
|
8213
8693
|
*
|
|
8214
8694
|
* @example
|
|
8215
8695
|
* ```ts
|
|
8216
8696
|
* const exports = await handler.exportSlides(data.slides, {
|
|
8217
|
-
*
|
|
8697
|
+
* format: 'svg',
|
|
8698
|
+
* slideIndices: [0, 2],
|
|
8218
8699
|
* });
|
|
8219
8700
|
* for (const [idx, bytes] of exports) {
|
|
8220
|
-
* await fs.writeFile(`slide_${idx}.
|
|
8701
|
+
* await fs.writeFile(`slide_${idx}.svg`, Buffer.from(bytes));
|
|
8221
8702
|
* }
|
|
8222
|
-
* // => Map<number, Uint8Array
|
|
8703
|
+
* // => Map<number, Uint8Array>: one SVG document per exported slide
|
|
8223
8704
|
* ```
|
|
8224
8705
|
*/
|
|
8225
8706
|
exportSlides(slides: PptxSlide[], options: PptxExportOptions): Promise<Map<number, Uint8Array>>;
|
|
@@ -8651,6 +9132,80 @@ interface ViewerFontSource {
|
|
|
8651
9132
|
style?: 'normal' | 'italic';
|
|
8652
9133
|
}
|
|
8653
9134
|
//#endregion
|
|
9135
|
+
//#region src/render/presentation-file-kinds.d.ts
|
|
9136
|
+
/**
|
|
9137
|
+
* presentation-file-kinds: the one place that answers "can the viewer open
|
|
9138
|
+
* this file?" and "what should the saved copy be called?".
|
|
9139
|
+
*
|
|
9140
|
+
* ## Why this is a shared decision and not five allow-lists
|
|
9141
|
+
*
|
|
9142
|
+
* The loader reads more formats than any single UI advertises. Legacy binary
|
|
9143
|
+
* `.ppt` (PowerPoint 97-2003) is the sharp example: `PptxHandler.load()` has
|
|
9144
|
+
* detected the OLE compound-file container and converted the binary deck
|
|
9145
|
+
* through the regular pptx pipeline for some time, but the product kept saying
|
|
9146
|
+
* it was unsupported, and a picker that filters the extension out makes a
|
|
9147
|
+
* working loader unreachable in practice. Whenever the loader learns a format,
|
|
9148
|
+
* exactly one list has to change.
|
|
9149
|
+
*
|
|
9150
|
+
* ## Read many, write one
|
|
9151
|
+
*
|
|
9152
|
+
* Input is a superset of output. We READ `.pptx`, `.ppsx`, `.pptm`, `.potx`,
|
|
9153
|
+
* legacy binary `.ppt` and portable `pptx-viewer-json`; we WRITE only the
|
|
9154
|
+
* OpenXML family. That asymmetry is deliberate (PowerPoint itself does the
|
|
9155
|
+
* same: open a 97-2003 deck and Save As offers `.pptx`), and it is why
|
|
9156
|
+
* {@link savedPresentationFileName} always REPLACES the source extension
|
|
9157
|
+
* rather than keeping it. A deck opened as `report.ppt` and saved as
|
|
9158
|
+
* `report.ppt` would be a file whose bytes and whose name disagree, which is
|
|
9159
|
+
* the kind of thing PowerPoint refuses to open.
|
|
9160
|
+
*
|
|
9161
|
+
* This module deliberately imports nothing, so any layer (render, export, a
|
|
9162
|
+
* binding, a host app) can depend on it without risking an import cycle.
|
|
9163
|
+
*
|
|
9164
|
+
* @module render/presentation-file-kinds
|
|
9165
|
+
*/
|
|
9166
|
+
/**
|
|
9167
|
+
* Extensions the built-in file picker offers, in the order it offers them.
|
|
9168
|
+
*
|
|
9169
|
+
* `.ppt` is in the list because the loader genuinely handles it, not as a
|
|
9170
|
+
* courtesy: see `packages/core/src/core/ppt/` and the `ppt-import` integration
|
|
9171
|
+
* suite, which asserts a `.ppt` loads to the same model as the `.pptx` it was
|
|
9172
|
+
* exported from.
|
|
9173
|
+
*/
|
|
9174
|
+
declare const PRESENTATION_OPEN_EXTENSIONS: readonly ['.pptx', '.ppsx', '.pptm', '.potx', '.ppt', '.json'];
|
|
9175
|
+
/** Comma-separated `accept` attribute for a presentation file input. */
|
|
9176
|
+
declare const PPTX_OPEN_ACCEPT: string;
|
|
9177
|
+
/**
|
|
9178
|
+
* True when a picked / dropped file's name looks like something the loader can
|
|
9179
|
+
* open. Use this instead of a hand-rolled `endsWith` chain: a drop handler that
|
|
9180
|
+
* disagrees with the picker's `accept` list is a format that is supported by
|
|
9181
|
+
* mouse but not by drag, which is how `.ppt` stayed invisible.
|
|
9182
|
+
*
|
|
9183
|
+
* Extension-only, by design. The real answer comes from the container sniff in
|
|
9184
|
+
* `PptxHandler.load()`; this is only the cheap pre-filter a drop target needs
|
|
9185
|
+
* before it hands bytes to the loader.
|
|
9186
|
+
*/
|
|
9187
|
+
declare function isSupportedPresentationFile(name: string | null | undefined): boolean;
|
|
9188
|
+
/** True for the binary PowerPoint 97-2003 family, which we read but never write. */
|
|
9189
|
+
declare function isLegacyBinaryPresentation(name: string | null | undefined): boolean;
|
|
9190
|
+
/** The formats the save path can produce. Binary `.ppt` is deliberately absent. */
|
|
9191
|
+
type SavedPresentationFormat = 'pptx' | 'ppsx' | 'pptm';
|
|
9192
|
+
/**
|
|
9193
|
+
* The stem of a presentation file name: directories and any loadable extension
|
|
9194
|
+
* removed. `C:\decks\report.ppt` becomes `report`; a name with no recognised
|
|
9195
|
+
* extension is kept whole, so `Untitled Presentation` survives intact rather
|
|
9196
|
+
* than losing everything after its last dot.
|
|
9197
|
+
*/
|
|
9198
|
+
declare function presentationBaseName(sourceName: string | null | undefined, fallback?: string): string;
|
|
9199
|
+
/**
|
|
9200
|
+
* The name a saved copy should be offered under: the source stem plus the
|
|
9201
|
+
* extension of the format actually being written.
|
|
9202
|
+
*
|
|
9203
|
+
* This is what turns `report.ppt` into `report.pptx` on Save As. Output is
|
|
9204
|
+
* always an OpenXML package, so keeping the source extension would mislabel
|
|
9205
|
+
* the bytes.
|
|
9206
|
+
*/
|
|
9207
|
+
declare function savedPresentationFileName(sourceName: string | null | undefined, format?: SavedPresentationFormat): string;
|
|
9208
|
+
//#endregion
|
|
8654
9209
|
//#region src/render/session-restore.d.ts
|
|
8655
9210
|
/**
|
|
8656
9211
|
* session-restore: keep the deck a host app has open across a page refresh.
|
|
@@ -9165,6 +9720,20 @@ declare function exportAllSlidesToSvg(data: PptxData, options?: SvgExportAllOpti
|
|
|
9165
9720
|
/** Export the selected presentation slides as SVG Blobs. */
|
|
9166
9721
|
declare function exportAllSlidesToSvgBlobs(data: PptxData, options?: SvgExportAllOptions): Blob[];
|
|
9167
9722
|
|
|
9723
|
+
/**
|
|
9724
|
+
* A drop-in wrapper around `html2canvas-pro` that first normalises modern CSS
|
|
9725
|
+
* colour functions (oklch/oklab/lch/lab/color()) to sRGB and applies the
|
|
9726
|
+
* shared CSS-preprocessing pass (backdrop-filter, mix-blend-mode, 3D
|
|
9727
|
+
* transforms, unsupported features) to the cloned capture document. Svelte
|
|
9728
|
+
* port of the vanilla binding's `renderToCanvas` wrapper
|
|
9729
|
+
* (`packages/vanilla/src/viewer/export/render-to-canvas.ts`); the pure
|
|
9730
|
+
* colour/CSS passes live once in `pptx-viewer-shared`, only this thin
|
|
9731
|
+
* html2canvas-pro glue is per-binding. `html2canvas-pro` is imported
|
|
9732
|
+
* dynamically so it stays out of the main bundle until export is actually
|
|
9733
|
+
* used.
|
|
9734
|
+
*/
|
|
9735
|
+
declare function renderToCanvas(element: HTMLElement, options?: Partial<Options>): Promise<HTMLCanvasElement>;
|
|
9736
|
+
|
|
9168
9737
|
/** Payload for the `onload` callback. */
|
|
9169
9738
|
interface ViewerLoadDetail {
|
|
9170
9739
|
/** Number of slides in the loaded presentation. */
|
|
@@ -9456,5 +10025,5 @@ declare const PowerPointViewer: Component<PowerPointViewerProps, PowerPointViewe
|
|
|
9456
10025
|
*/
|
|
9457
10026
|
type AutosaveStatus = 'idle' | 'disabled' | 'saving' | 'saved' | 'error';
|
|
9458
10027
|
|
|
9459
|
-
export { PowerPointViewer, defaultCssVars, defaultRadius, defaultThemeColors, deleteAutosaveSnapshot, exportAllSlidesToSvg, exportAllSlidesToSvgBlobs, exportSlideAsSvg, exportSlideToSvg, exportSlideToSvgBlob, forgetSessionDeck, getAutosaveSnapshot, getSessionTabId, listAutosaveSnapshots, loadPresentationDeck, loadSessionDeck, parsePresentationSessionId, registerTranslations, rememberSessionDeck, restoreSessionDeck, themeToCssVars, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius };
|
|
9460
|
-
export type { AutosaveRecord, AutosaveStatus, CanvasSize, CollaborationConfig, CollaborationRole, CollaborationTransport, ExportGifOptions, ExportPdfOptions, ExportVideoOptions, PowerPointViewerApi, PowerPointViewerProps, PptxAiBridge, PptxAiConfig, PptxAiConnection, PptxAiContextStrategy, PptxAiToolName, PptxAiUIMessage, PptxAiWritePolicy, PrintOptions, SessionDeck, SvgExportAllOptions, SvgExportSingleSlideOptions, TranslationDictionary, Translator, ViewerLoadDetail, ViewerTheme, ViewerThemeColors };
|
|
10028
|
+
export { PPTX_OPEN_ACCEPT, PRESENTATION_OPEN_EXTENSIONS, PowerPointViewer, defaultCssVars, defaultRadius, defaultThemeColors, deleteAutosaveSnapshot, exportAllSlidesToSvg, exportAllSlidesToSvgBlobs, exportSlideAsSvg, exportSlideToSvg, exportSlideToSvgBlob, forgetSessionDeck, getAutosaveSnapshot, getSessionTabId, isLegacyBinaryPresentation, isSupportedPresentationFile, listAutosaveSnapshots, loadPresentationDeck, loadSessionDeck, parsePresentationSessionId, presentationBaseName, registerTranslations, rememberSessionDeck, renderToCanvas, restoreSessionDeck, savedPresentationFileName, themeToCssVars, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius };
|
|
10029
|
+
export type { AutosaveRecord, AutosaveStatus, CanvasSize, CollaborationConfig, CollaborationRole, CollaborationTransport, ExportGifOptions, ExportPdfOptions, ExportVideoOptions, PowerPointViewerApi, PowerPointViewerProps, PptxAiBridge, PptxAiConfig, PptxAiConnection, PptxAiContextStrategy, PptxAiToolName, PptxAiUIMessage, PptxAiWritePolicy, PrintOptions, SavedPresentationFormat, SessionDeck, SvgExportAllOptions, SvgExportSingleSlideOptions, TranslationDictionary, Translator, ViewerLoadDetail, ViewerTheme, ViewerThemeColors };
|