pptx-svelte-viewer 2.18.0 → 2.20.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 +450 -0
- package/dist/{AiChatPanel-D6dfMwnT.js → AiChatPanel-DPXM1HsP.js} +190 -206
- package/dist/{export-DbSAFc8m.js → export-Cp97qZ_g.js} +29893 -26847
- package/dist/i18n.js +1 -1
- package/dist/index.d.ts +488 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -28
- package/dist/pptx-svelte-viewer.css +1 -1
- package/dist/{translator-CZ12ZvlE.js → translator-Cs5ewuZ4.js} +32 -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/presentation-toolbar.svelte.d.ts +6 -0
- package/dist/viewer/components/presentation-toolbar.svelte.d.ts.map +1 -1
- package/dist/viewer/components/props-editing.d.ts +2 -2
- 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/viewer-body-commits.d.ts +6 -0
- package/dist/viewer/components/viewer-body-commits.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.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.map +1 -1
- package/dist/viewer/editor/editor-controller.svelte.d.ts +13 -2
- 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 +6 -2
- package/dist/viewer/editor/editor-document-state.d.ts.map +1 -1
- package/dist/viewer/editor/editor-handle-handlers.d.ts +2 -2
- package/dist/viewer/editor/editor-handle-handlers.d.ts.map +1 -1
- 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-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-interactivity.d.ts +7 -2
- package/dist/viewer/editor/editor-selection-interactivity.d.ts.map +1 -1
- package/dist/viewer/editor/editor-state.svelte.d.ts +29 -1
- package/dist/viewer/editor/editor-state.svelte.d.ts.map +1 -1
- package/dist/viewer/editor/table-cell-pointer.d.ts +5 -0
- package/dist/viewer/editor/table-cell-pointer.d.ts.map +1 -1
- package/dist/viewer/index.d.ts +779 -35
- package/dist/viewer/index.js +14 -14
- 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/table-view.d.ts.map +1 -1
- package/dist/viewer/state/autosave-recovery.svelte.d.ts +48 -0
- package/dist/viewer/state/autosave-recovery.svelte.d.ts.map +1 -0
- package/dist/viewer/state/autosave.svelte.d.ts +26 -2
- package/dist/viewer/state/autosave.svelte.d.ts.map +1 -1
- package/dist/viewer/state/create-viewer-state-collab.svelte.d.ts +23 -0
- 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-types.d.ts +21 -4
- package/dist/viewer/state/create-viewer-state-types.d.ts.map +1 -1
- package/dist/viewer/state/create-viewer-state.svelte.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/viewer-effects.svelte.d.ts +2 -1
- package/dist/viewer/state/viewer-effects.svelte.d.ts.map +1 -1
- package/dist/viewer/state/viewer-options.svelte.d.ts +5 -3
- package/dist/viewer/state/viewer-options.svelte.d.ts.map +1 -1
- package/dist/viewer/state/viewer-parity-ui.svelte.d.ts +11 -0
- package/dist/viewer/state/viewer-parity-ui.svelte.d.ts.map +1 -1
- package/dist/viewer/state/viewer-state-options.d.ts.map +1 -1
- package/dist/viewer/state/viewport-handlers.d.ts +6 -0
- package/dist/viewer/state/viewport-handlers.d.ts.map +1 -1
- package/dist/viewer/types.d.ts +32 -8
- package/dist/viewer/types.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
|
/**
|
|
@@ -182,11 +183,18 @@ interface XmlObject {
|
|
|
182
183
|
[child: string]: XmlObject | XmlObject[] | string | undefined;
|
|
183
184
|
}
|
|
184
185
|
/**
|
|
185
|
-
*
|
|
186
|
+
* Lock attributes from an element's non-visual properties node.
|
|
186
187
|
*
|
|
187
188
|
* When a flag is `true` the corresponding user interaction is disabled
|
|
188
189
|
* in the editor (e.g. `noRotation` prevents free rotation of the shape).
|
|
189
190
|
*
|
|
191
|
+
* One bag covers every family, but the families are NOT interchangeable in
|
|
192
|
+
* the file: `a:spLocks` (`CT_ShapeLocking`), `a:picLocks`, `a:cxnSpLocks`,
|
|
193
|
+
* `a:grpSpLocks` (`CT_GroupLocking`) and `a:graphicFrameLocks`
|
|
194
|
+
* (`CT_GraphicalObjectFrameLocking`) each declare their own attribute subset.
|
|
195
|
+
* `runtime/shape-lock-containers` holds that table and is what decides which
|
|
196
|
+
* of these fields may be written for a given element.
|
|
197
|
+
*
|
|
190
198
|
* @example
|
|
191
199
|
* ```ts
|
|
192
200
|
* const locks: PptxShapeLocks = { noMove: true, noResize: true };
|
|
@@ -205,6 +213,14 @@ interface PptxShapeLocks {
|
|
|
205
213
|
noAdjustHandles?: boolean;
|
|
206
214
|
noChangeArrowheads?: boolean;
|
|
207
215
|
noChangeShapeType?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* `a:graphicFrameLocks/@noDrilldown`: forbids selecting the individual
|
|
218
|
+
* parts inside a graphic frame (a chart series, a SmartArt node). Declared
|
|
219
|
+
* ONLY by `CT_GraphicalObjectFrameLocking`, so it is written for tables,
|
|
220
|
+
* charts, SmartArt, OLE objects and graphic-frame media, and never onto
|
|
221
|
+
* `a:spLocks` / `a:picLocks` / `a:cxnSpLocks` / `a:grpSpLocks`.
|
|
222
|
+
*/
|
|
223
|
+
noDrilldown?: boolean;
|
|
208
224
|
/**
|
|
209
225
|
* Text-box flag from `p:cNvSpPr/@txBox`. Not a lock in the strict sense,
|
|
210
226
|
* but it lives on the same non-visual-properties node as `a:spLocks`, so
|
|
@@ -1144,6 +1160,22 @@ interface ShapeStyle {
|
|
|
1144
1160
|
fontRefIdx?: string;
|
|
1145
1161
|
/** Raw XML colour child of `<a:fontRef>`. */
|
|
1146
1162
|
fontRefColorXml?: XmlObject;
|
|
1163
|
+
/**
|
|
1164
|
+
* The fill `<a:fillRef>` resolved to, recorded ONLY when the shape's own
|
|
1165
|
+
* `spPr` authored no fill at all, so the reference is what paints it.
|
|
1166
|
+
*
|
|
1167
|
+
* Its absence therefore means "the fill is the shape's own", and its
|
|
1168
|
+
* presence plus an unchanged flat fill means "still purely inherited": see
|
|
1169
|
+
* `authored-shape-style.ts`, the shape-scope twin of `TextStyle`'s
|
|
1170
|
+
* `inheritedRunStyle`.
|
|
1171
|
+
*/
|
|
1172
|
+
inheritedFillStyle?: ShapeStyle;
|
|
1173
|
+
/**
|
|
1174
|
+
* The outline `<a:lnRef>` resolved to, recorded before `spPr/a:ln` was
|
|
1175
|
+
* layered on top. A property that still equals this baseline was never
|
|
1176
|
+
* authored on the shape and must not be written back as if it were.
|
|
1177
|
+
*/
|
|
1178
|
+
inheritedLineStyle?: ShapeStyle;
|
|
1147
1179
|
}
|
|
1148
1180
|
//#endregion
|
|
1149
1181
|
//#region src/core/types/text.d.ts
|
|
@@ -1184,6 +1216,60 @@ interface ShapeStyle {
|
|
|
1184
1216
|
interface TextStyle {
|
|
1185
1217
|
/** Original `a:rPr` XML retained by projections that share the shape-text model. */
|
|
1186
1218
|
runPropertiesXml?: XmlObject;
|
|
1219
|
+
/**
|
|
1220
|
+
* The properties this run's OWN `a:rPr` authored, and nothing else.
|
|
1221
|
+
*
|
|
1222
|
+
* A run style is assembled as
|
|
1223
|
+
* `{...inheritedRunStyle, ...authoredRunStyle}`, so the flat style is a
|
|
1224
|
+
* fully RESOLVED view: it cannot say whether `fontSize: 60` came from the
|
|
1225
|
+
* run, from the shape's `a:lstStyle`, from the layout placeholder, from the
|
|
1226
|
+
* master `p:txStyles` or from the theme. Omission is meaningful in OOXML
|
|
1227
|
+
* (§21.1.2.3), so a writer that re-emits the resolved view converts every
|
|
1228
|
+
* inherited value into an authored one and the deck stops being
|
|
1229
|
+
* theme-driven after one save.
|
|
1230
|
+
*
|
|
1231
|
+
* This is the run-scope twin of {@link TextSegment.paragraphProperties},
|
|
1232
|
+
* which is parsed strictly from the paragraph's own `a:pPr` for the same
|
|
1233
|
+
* reason. Present only for runs that came from a parsed deck; absent for
|
|
1234
|
+
* SDK-built text, where the flat style IS the only description and must be
|
|
1235
|
+
* written out in full.
|
|
1236
|
+
*/
|
|
1237
|
+
authoredRunStyle?: TextStyle;
|
|
1238
|
+
/**
|
|
1239
|
+
* The resolved inheritance baseline {@link authoredRunStyle} was layered
|
|
1240
|
+
* on top of (shape `a:lstStyle` -> placeholder -> layout -> master
|
|
1241
|
+
* `p:txStyles` -> theme -> `p:defaultTextStyle`).
|
|
1242
|
+
*
|
|
1243
|
+
* Kept alongside the authored half because the two answer different
|
|
1244
|
+
* questions. The authored half says "the source pinned this"; the baseline
|
|
1245
|
+
* says "this value is what inheritance already produces", which is how an
|
|
1246
|
+
* EDIT is told apart from an inherited value: an editor mutates the flat
|
|
1247
|
+
* style without knowing about either field, so a property that now differs
|
|
1248
|
+
* from the baseline was either authored or edited and must be written,
|
|
1249
|
+
* while one that still matches can be left to inherit.
|
|
1250
|
+
*
|
|
1251
|
+
* Holds a reference to the per-paragraph baseline object rather than a
|
|
1252
|
+
* copy, so carrying it costs one pointer per run.
|
|
1253
|
+
*/
|
|
1254
|
+
inheritedRunStyle?: TextStyle;
|
|
1255
|
+
/**
|
|
1256
|
+
* Snapshot of the ELEMENT-scope paragraph geometry (alignment, margins,
|
|
1257
|
+
* indent, line and paragraph spacing, tab stops, rtl, line-break flags) as
|
|
1258
|
+
* the load pipeline resolved it.
|
|
1259
|
+
*
|
|
1260
|
+
* Present only on an `element.textStyle` that came from a parsed deck, and
|
|
1261
|
+
* populated only with the geometry keys. It exists so the save path can
|
|
1262
|
+
* answer one question it otherwise cannot: has the user CHANGED the body's
|
|
1263
|
+
* alignment or indent, or is the value simply what the shape's
|
|
1264
|
+
* `a:lstStyle`, its layout placeholder and the master already produce?
|
|
1265
|
+
* Element-level text panels (`textAdvancedPatch`, `alignPatch` and friends
|
|
1266
|
+
* in `pptx-viewer-shared`) write `element.textStyle` and never touch
|
|
1267
|
+
* `segment.paragraphProperties`, so a diff against this snapshot is the
|
|
1268
|
+
* only way to tell an edit from an inheritance artefact.
|
|
1269
|
+
*
|
|
1270
|
+
* @see element-paragraph-geometry.ts
|
|
1271
|
+
*/
|
|
1272
|
+
resolvedParagraphGeometry?: TextStyle;
|
|
1187
1273
|
fontFamily?: string;
|
|
1188
1274
|
fontSize?: number;
|
|
1189
1275
|
/** When true, renderer should shrink text to fit the shape bounds. */
|
|
@@ -1848,6 +1934,15 @@ interface PptxElementBase {
|
|
|
1848
1934
|
shapeId?: string;
|
|
1849
1935
|
/** Element name from `cNvPr/@name`. Used for morph transition matching via the `!!` naming convention. */
|
|
1850
1936
|
name?: string;
|
|
1937
|
+
/**
|
|
1938
|
+
* `p:nvSpPr/p:nvPr/p:ph/@type` (lower-cased) when the shape is a placeholder:
|
|
1939
|
+
* `title`, `ctrtitle`, `body`, `subtitle`, `ftr`, `dt`, `sldnum`, ...
|
|
1940
|
+
*
|
|
1941
|
+
* Captured on load so consumers can tell a footer placeholder from a text box
|
|
1942
|
+
* without re-walking `rawXml`. Absent on non-placeholder shapes and on
|
|
1943
|
+
* SDK-created elements.
|
|
1944
|
+
*/
|
|
1945
|
+
placeholderType?: string;
|
|
1851
1946
|
x: number;
|
|
1852
1947
|
y: number;
|
|
1853
1948
|
width: number;
|
|
@@ -1908,6 +2003,19 @@ interface PptxTextProperties {
|
|
|
1908
2003
|
}>;
|
|
1909
2004
|
/** 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. */
|
|
1910
2005
|
promptText?: string;
|
|
2006
|
+
/**
|
|
2007
|
+
* The string {@link text} was INHERITED from, when this is a header / footer /
|
|
2008
|
+
* date / slide-number placeholder whose own body the file leaves empty.
|
|
2009
|
+
*
|
|
2010
|
+
* PowerPoint keeps the footer string on the slide master and writes each
|
|
2011
|
+
* slide's copy of the `ftr` placeholder empty, so the empty body means
|
|
2012
|
+
* "render the master's footer here". Rendering needs the resolved string, but
|
|
2013
|
+
* SAVING it into the slide would pin that slide to today's master text and
|
|
2014
|
+
* silently detach it from the Header & Footer dialog. The save writer
|
|
2015
|
+
* therefore leaves the authored empty body alone while `text` still equals
|
|
2016
|
+
* this value, and writes a genuine per-slide override once it does not.
|
|
2017
|
+
*/
|
|
2018
|
+
inheritedPlaceholderText?: string;
|
|
1911
2019
|
/** 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. */
|
|
1912
2020
|
linkedTxbxId?: number;
|
|
1913
2021
|
/** Sequence number within a linked text box chain (0-based). */
|
|
@@ -2318,6 +2426,12 @@ interface PptxChartLineStyle {
|
|
|
2318
2426
|
}
|
|
2319
2427
|
/** Marker symbol types for line/scatter chart data points. */
|
|
2320
2428
|
type PptxChartMarkerSymbol = 'circle' | 'dash' | 'diamond' | 'dot' | 'none' | 'picture' | 'plus' | 'square' | 'star' | 'triangle' | 'x' | 'auto';
|
|
2429
|
+
/**
|
|
2430
|
+
* `ST_ScatterStyle` (ECMA-376 §21.2.3.40): how a scatter chart joins its points.
|
|
2431
|
+
* `line`/`lineMarker` connect them with straight segments, `smooth`/
|
|
2432
|
+
* `smoothMarker` with a bezier, `marker`/`none` not at all.
|
|
2433
|
+
*/
|
|
2434
|
+
type PptxChartScatterStyle = 'none' | 'line' | 'lineMarker' | 'marker' | 'smooth' | 'smoothMarker';
|
|
2321
2435
|
/** Shape properties extracted from c:spPr for chart formatting. */
|
|
2322
2436
|
interface PptxChartShapeProps {
|
|
2323
2437
|
fillColor?: string;
|
|
@@ -2519,6 +2633,42 @@ interface PptxChartTreemapOptions {
|
|
|
2519
2633
|
interface PptxChartSeries {
|
|
2520
2634
|
name: string;
|
|
2521
2635
|
values: number[];
|
|
2636
|
+
/**
|
|
2637
|
+
* Per-series x values from `c:ser/c:xVal` (scatter and bubble series only).
|
|
2638
|
+
*
|
|
2639
|
+
* Every `CT_ScatterSer` / `CT_BubbleSer` carries its OWN `c:xVal`, so two
|
|
2640
|
+
* series in one scatter chart routinely plot against different x ranges (the
|
|
2641
|
+
* normal case for measurement data). Reading the x values off the first
|
|
2642
|
+
* series and reusing them everywhere plotted every series against series 1's
|
|
2643
|
+
* x axis. Absent for category-axis chart kinds, where
|
|
2644
|
+
* {@link PptxChartData.categories} is the x axis.
|
|
2645
|
+
*/
|
|
2646
|
+
xValues?: number[];
|
|
2647
|
+
/**
|
|
2648
|
+
* Per-series bubble sizes from `c:ser/c:bubbleSize` (bubble series only),
|
|
2649
|
+
* aligned index-for-index with {@link values}.
|
|
2650
|
+
*
|
|
2651
|
+
* `CT_BubbleSer` carries x, y AND size, so a one-series bubble chart is fully
|
|
2652
|
+
* specified. Absent when the source omits `c:bubbleSize`.
|
|
2653
|
+
*/
|
|
2654
|
+
bubbleSizes?: number[];
|
|
2655
|
+
/**
|
|
2656
|
+
* Series-level data-label content flags from `c:ser/c:dLbls`.
|
|
2657
|
+
*
|
|
2658
|
+
* PowerPoint writes the flags a user picks in "Format Data Labels" onto the
|
|
2659
|
+
* SERIES, and leaves the chart-type-level `c:dLbls` all-zero, so reading only
|
|
2660
|
+
* the chart-level group reports "show nothing" for a chart that visibly shows
|
|
2661
|
+
* percentages. These override {@link PptxChartStyle.dataLabels}.
|
|
2662
|
+
*/
|
|
2663
|
+
dataLabelOptions?: PptxChartDataLabelOptions;
|
|
2664
|
+
/**
|
|
2665
|
+
* Whether the series line is explicitly suppressed
|
|
2666
|
+
* (`c:ser/c:spPr/a:ln/a:noFill`). Line-drawn kinds (line, scatter, radar)
|
|
2667
|
+
* use this to decide whether to draw a connecting line at all; a marker-only
|
|
2668
|
+
* scatter is authored as `scatterStyle="lineMarker"` PLUS this flag, never by
|
|
2669
|
+
* changing the scatter style.
|
|
2670
|
+
*/
|
|
2671
|
+
lineNoFill?: boolean;
|
|
2522
2672
|
/**
|
|
2523
2673
|
* Blank-value mask aligned index-for-index with {@link values}: `true` marks
|
|
2524
2674
|
* a category whose numeric cache point (`c:numCache/c:pt`) was absent or
|
|
@@ -2862,6 +3012,17 @@ interface PptxChartData {
|
|
|
2862
3012
|
* default), so only horizontal bar charts need to carry the field.
|
|
2863
3013
|
*/
|
|
2864
3014
|
barDirection?: PptxChartBarDirection;
|
|
3015
|
+
/**
|
|
3016
|
+
* Scatter presentation mode (`c:scatterChart/c:scatterStyle/@val`).
|
|
3017
|
+
*
|
|
3018
|
+
* `lineMarker` (PowerPoint's own default for every scatter it writes) and
|
|
3019
|
+
* `smoothMarker` draw a connecting line; `marker` and `none` do not. Whether
|
|
3020
|
+
* the MARKERS appear is decided separately by `c:marker/c:symbol`, and
|
|
3021
|
+
* whether the LINE appears is further gated by
|
|
3022
|
+
* {@link PptxChartSeries.lineNoFill} - PowerPoint expresses "markers only" as
|
|
3023
|
+
* `lineMarker` plus an `a:ln/a:noFill`, not as `marker`.
|
|
3024
|
+
*/
|
|
3025
|
+
scatterStyle?: PptxChartScatterStyle;
|
|
2865
3026
|
/**
|
|
2866
3027
|
* Bar/column gap between category clusters as a percentage of bar width
|
|
2867
3028
|
* (`c:gapWidth/@val`, 0 through 500). Absent uses the renderer default.
|
|
@@ -3015,6 +3176,53 @@ interface PptxChartData {
|
|
|
3015
3176
|
* // => { brightness: 20, contrast: -10, grayscale: true } satisfies PptxImageEffects
|
|
3016
3177
|
* ```
|
|
3017
3178
|
*/
|
|
3179
|
+
/**
|
|
3180
|
+
* One `a14:foregroundMark` / `a14:backgroundMark` polyline hint recorded while
|
|
3181
|
+
* the user painted over the picture in PowerPoint's "Remove Background" mode.
|
|
3182
|
+
* Coordinates are 0..1 fractions of the image.
|
|
3183
|
+
*/
|
|
3184
|
+
interface PptxBackgroundRemovalMark {
|
|
3185
|
+
x1: number;
|
|
3186
|
+
y1: number;
|
|
3187
|
+
x2: number;
|
|
3188
|
+
y2: number;
|
|
3189
|
+
}
|
|
3190
|
+
/**
|
|
3191
|
+
* PowerPoint "Remove Background" state (`a14:backgroundRemoval`).
|
|
3192
|
+
*
|
|
3193
|
+
* The four edges are the RETAINED rectangle as 0..1 fractions of the image
|
|
3194
|
+
* (OOXML stores them as per-100000 relative units), and the mark lists are the
|
|
3195
|
+
* segmentation hints the user painted.
|
|
3196
|
+
*
|
|
3197
|
+
* **This is edit-time metadata, not a render instruction.** PowerPoint bakes the
|
|
3198
|
+
* removal into the bitmap referenced by the main `a:blip/@r:embed` and keeps the
|
|
3199
|
+
* pristine original in `a14:imgLayer/@r:embed`. Verified against PowerPoint COM:
|
|
3200
|
+
* a slide exported with and without this element is byte-identical. A renderer
|
|
3201
|
+
* that clips to the retained rectangle would clip an image whose background has
|
|
3202
|
+
* already been removed.
|
|
3203
|
+
*
|
|
3204
|
+
* @example
|
|
3205
|
+
* ```ts
|
|
3206
|
+
* const removal: PptxBackgroundRemoval = { top: 0.12, bottom: 0.88, left: 0.07, right: 0.93 };
|
|
3207
|
+
* // => retains the middle of the image; the marks list stays empty
|
|
3208
|
+
* ```
|
|
3209
|
+
*/
|
|
3210
|
+
interface PptxBackgroundRemoval {
|
|
3211
|
+
/** Top edge of the retained rectangle (0..1 fraction of the image height). */
|
|
3212
|
+
top: number;
|
|
3213
|
+
/** Bottom edge of the retained rectangle (0..1 fraction of the image height). */
|
|
3214
|
+
bottom: number;
|
|
3215
|
+
/** Left edge of the retained rectangle (0..1 fraction of the image width). */
|
|
3216
|
+
left: number;
|
|
3217
|
+
/** Right edge of the retained rectangle (0..1 fraction of the image width). */
|
|
3218
|
+
right: number;
|
|
3219
|
+
/** Strokes marking regions the user forced to be foreground. */
|
|
3220
|
+
foregroundMarks?: PptxBackgroundRemovalMark[];
|
|
3221
|
+
/** Strokes marking regions the user forced to be background. */
|
|
3222
|
+
backgroundMarks?: PptxBackgroundRemovalMark[];
|
|
3223
|
+
/** Original effect XML, retained for lossless re-emission. */
|
|
3224
|
+
rawXml?: XmlObject;
|
|
3225
|
+
}
|
|
3018
3226
|
interface PptxImageEffects {
|
|
3019
3227
|
/** Brightness adjustment (-100 to 100). */
|
|
3020
3228
|
brightness?: number;
|
|
@@ -3038,8 +3246,38 @@ interface PptxImageEffects {
|
|
|
3038
3246
|
};
|
|
3039
3247
|
/** Artistic effect name (blur, pencilGrayscale, paintStrokes, etc.). */
|
|
3040
3248
|
artisticEffect?: string;
|
|
3041
|
-
/** Artistic effect radius/amount. */
|
|
3249
|
+
/** Artistic effect radius/amount, normalised to 0..100. */
|
|
3042
3250
|
artisticRadius?: number;
|
|
3251
|
+
/**
|
|
3252
|
+
* Every numeric attribute of the source `a14:artistic*` element, raw and
|
|
3253
|
+
* un-normalised (`trans`, `pencilSize`, `crackSpacing`, …). The attribute set
|
|
3254
|
+
* differs per effect, so this is the lossless companion to the single
|
|
3255
|
+
* {@link PptxImageEffects.artisticRadius} number.
|
|
3256
|
+
*/
|
|
3257
|
+
artisticParams?: Record<string, number>;
|
|
3258
|
+
/**
|
|
3259
|
+
* Name of the artistic effect ALREADY baked into the image data, which a
|
|
3260
|
+
* renderer must not apply a second time. Set from the `a14` blip extension,
|
|
3261
|
+
* which PowerPoint writes alongside a pre-rendered bitmap (see
|
|
3262
|
+
* {@link PptxBackgroundRemoval}), and normally equal to
|
|
3263
|
+
* {@link PptxImageEffects.artisticEffect}.
|
|
3264
|
+
*
|
|
3265
|
+
* It records the NAME rather than a boolean so that picking a different
|
|
3266
|
+
* effect in this library's inspector (which patches `artisticEffect` alone)
|
|
3267
|
+
* still renders: the two names then differ.
|
|
3268
|
+
*/
|
|
3269
|
+
artisticPrerenderedEffect?: string;
|
|
3270
|
+
/**
|
|
3271
|
+
* PowerPoint "Remove Background" state (`a14:backgroundRemoval`). Edit-time
|
|
3272
|
+
* metadata: the removal is already baked into the image data.
|
|
3273
|
+
*/
|
|
3274
|
+
backgroundRemoval?: PptxBackgroundRemoval;
|
|
3275
|
+
/**
|
|
3276
|
+
* `a14:imgLayer/@r:embed` — relationship id of the PRISTINE original image
|
|
3277
|
+
* the baked effects were derived from (PowerPoint stores it as an HD Photo
|
|
3278
|
+
* `.wdp` part, which browsers cannot decode).
|
|
3279
|
+
*/
|
|
3280
|
+
originalImageRelId?: string;
|
|
3043
3281
|
/** Alpha modulation fixed: non-negative percentage (100 means unchanged opacity). */
|
|
3044
3282
|
alphaModFix?: number;
|
|
3045
3283
|
/** Original alpha modulation fixed node, including foreign attributes. */
|
|
@@ -4951,7 +5189,7 @@ interface UnknownPptxElement extends PptxElementBase {
|
|
|
4951
5189
|
/**
|
|
4952
5190
|
* A single element on a PPTX slide.
|
|
4953
5191
|
*
|
|
4954
|
-
* This is a **discriminated union
|
|
5192
|
+
* This is a **discriminated union**: narrow on `element.type` to access
|
|
4955
5193
|
* variant-specific properties like `imageData` (image/picture), `pathData`
|
|
4956
5194
|
* (shape), or `textSegments` (text/shape).
|
|
4957
5195
|
*/
|
|
@@ -5684,6 +5922,54 @@ interface PptxEmbeddedFontList {
|
|
|
5684
5922
|
rawXml?: XmlObject;
|
|
5685
5923
|
}
|
|
5686
5924
|
//#endregion
|
|
5925
|
+
//#region src/core/types/comment-mentions.d.ts
|
|
5926
|
+
/**
|
|
5927
|
+
* A single `@`-mention inside a modern comment body.
|
|
5928
|
+
*
|
|
5929
|
+
* Offsets index into the comment's FLATTENED plain text: every `a:t` value
|
|
5930
|
+
* below `p188:txBody` concatenated, with paragraphs joined by `\n`. That is the
|
|
5931
|
+
* same string `PptxComment.text` carries, so an edit to `text` invalidates
|
|
5932
|
+
* every offset after the edit point and the serializer re-bases them.
|
|
5933
|
+
*
|
|
5934
|
+
* The markup Office uses for a mention is `CT_Mention` (documented for the
|
|
5935
|
+
* SpreadsheetML `2018/threadedcomments` part): `mentionpersonId`, `mentionId`,
|
|
5936
|
+
* `startIndex` and `length`. The PowerPoint `2018/8/main` schema does not
|
|
5937
|
+
* publish a mention element at all, so `rawXml` is retained and re-emitted
|
|
5938
|
+
* attribute-for-attribute: a producer that spells the attributes differently
|
|
5939
|
+
* still round-trips.
|
|
5940
|
+
*
|
|
5941
|
+
* @example
|
|
5942
|
+
* ```ts
|
|
5943
|
+
* const mention: PptxCommentMention = {
|
|
5944
|
+
* personId: "{2CB2E9D0-D392-EB21-5D46-FBA34C1295E6}",
|
|
5945
|
+
* authorName: "Bob Example",
|
|
5946
|
+
* startIndex: 3,
|
|
5947
|
+
* length: 11,
|
|
5948
|
+
* };
|
|
5949
|
+
* // => "Hi Bob Example can you check this".slice(3, 14) === "Bob Example"
|
|
5950
|
+
* ```
|
|
5951
|
+
*/
|
|
5952
|
+
interface PptxCommentMention {
|
|
5953
|
+
/** `mentionId`: GUID identifying this mention instance. */
|
|
5954
|
+
id?: string;
|
|
5955
|
+
/** `mentionpersonId`: the `p188:author` id of the mentioned person. */
|
|
5956
|
+
personId: string;
|
|
5957
|
+
/** Display name resolved from the author list at parse time, when known. */
|
|
5958
|
+
authorName?: string;
|
|
5959
|
+
/** Character offset of the mentioned span in the flattened plain text. */
|
|
5960
|
+
startIndex: number;
|
|
5961
|
+
/** Character length of the mentioned span. */
|
|
5962
|
+
length: number;
|
|
5963
|
+
/**
|
|
5964
|
+
* `uri` of the `p188:ext` this mention list was read from. Undefined means
|
|
5965
|
+
* the list is a direct child of `p188:cm`, which is where it is written for
|
|
5966
|
+
* newly authored mentions.
|
|
5967
|
+
*/
|
|
5968
|
+
containerUri?: string;
|
|
5969
|
+
/** Original `p188:mention` node, retained for unknown-attribute preservation. */
|
|
5970
|
+
rawXml?: XmlObject;
|
|
5971
|
+
}
|
|
5972
|
+
//#endregion
|
|
5687
5973
|
//#region src/core/types/metadata.d.ts
|
|
5688
5974
|
/**
|
|
5689
5975
|
* A slide comment — may be a legacy positional comment or a modern
|
|
@@ -5730,6 +6016,8 @@ interface PptxComment {
|
|
|
5730
6016
|
title?: string;
|
|
5731
6017
|
/** Modern threaded comment support (p15:threadingInfo). */
|
|
5732
6018
|
threadId?: string;
|
|
6019
|
+
/** `@`-mentions, indexed into `text` (see {@link PptxCommentMention}). */
|
|
6020
|
+
mentions?: PptxCommentMention[];
|
|
5733
6021
|
/** Replies to this comment (for modern threaded comments). */
|
|
5734
6022
|
replies?: PptxComment[];
|
|
5735
6023
|
/** ID of the element this comment is associated with (if any). */
|
|
@@ -6249,7 +6537,7 @@ interface PptxTheme {
|
|
|
6249
6537
|
* // => "morph" — one of 40+ transition effects
|
|
6250
6538
|
* ```
|
|
6251
6539
|
*/
|
|
6252
|
-
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';
|
|
6540
|
+
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';
|
|
6253
6541
|
/** Split orientation from OOXML `@_orient`. */
|
|
6254
6542
|
type PptxSplitOrientation = 'horz' | 'vert';
|
|
6255
6543
|
/** Schema-defined `ST_TransitionSpeed` values. */
|
|
@@ -6544,6 +6832,18 @@ interface PptxSlideBackgroundPattern {
|
|
|
6544
6832
|
interface PptxSlide {
|
|
6545
6833
|
id: string;
|
|
6546
6834
|
rId: string;
|
|
6835
|
+
/**
|
|
6836
|
+
* `p:sldIdLst/p:sldId/@id` (ST_SlideId, 256..2147483647): the numeric key
|
|
6837
|
+
* that sections (`p14:sldIdLst/p14:sldId/@id`) and section/summary zooms
|
|
6838
|
+
* name slides by.
|
|
6839
|
+
*
|
|
6840
|
+
* It lives in `presentation.xml`, NOT in the slide part, so it cannot be
|
|
6841
|
+
* recovered from `rawXml`. Without it on the model, code that writes a
|
|
6842
|
+
* section's membership has nothing correct to write and falls back to the
|
|
6843
|
+
* slide NUMBER, which is 1-based and therefore never matches a real deck's
|
|
6844
|
+
* ids: the section reloads with no slides in it.
|
|
6845
|
+
*/
|
|
6846
|
+
slideId?: string;
|
|
6547
6847
|
sourceSlideId?: string;
|
|
6548
6848
|
/** Optional author-supplied slide name (set via `SlideBuilder.setName`). */
|
|
6549
6849
|
name?: string;
|
|
@@ -6746,6 +7046,26 @@ interface PptxPresentationProperties {
|
|
|
6746
7046
|
/** Kiosk auto-restart interval in milliseconds (from `p:kiosk/@restart`). Only meaningful when showType is "kiosk". */
|
|
6747
7047
|
kioskRestartTime?: number;
|
|
6748
7048
|
}
|
|
7049
|
+
/**
|
|
7050
|
+
* Slide dimensions from `p:sldSz` (CT_SlideSize, ECMA-376 §19.2.1.39).
|
|
7051
|
+
*
|
|
7052
|
+
* @example
|
|
7053
|
+
* ```ts
|
|
7054
|
+
* const size: PptxSlideSize = { widthEmu: 9144000, heightEmu: 6858000, type: 'screen4x3' };
|
|
7055
|
+
* // => satisfies PptxSlideSize
|
|
7056
|
+
* ```
|
|
7057
|
+
*/
|
|
7058
|
+
interface PptxSlideSize {
|
|
7059
|
+
/** `@cx` in EMU. Omitted or non-positive values leave the loaded width alone. */
|
|
7060
|
+
widthEmu?: number;
|
|
7061
|
+
/** `@cy` in EMU. Omitted or non-positive values leave the loaded height alone. */
|
|
7062
|
+
heightEmu?: number;
|
|
7063
|
+
/**
|
|
7064
|
+
* `@type` (ST_SlideSizeType). The schema default is `custom`, which is
|
|
7065
|
+
* why PowerPoint omits the attribute for a non-preset size.
|
|
7066
|
+
*/
|
|
7067
|
+
type?: string;
|
|
7068
|
+
}
|
|
6749
7069
|
/**
|
|
6750
7070
|
* A named custom slide show (`p:custShowLst / p:custShow`).
|
|
6751
7071
|
*
|
|
@@ -7760,6 +8080,19 @@ interface PptxHandlerSaveOptions {
|
|
|
7760
8080
|
customerData?: PptxCustomerData[];
|
|
7761
8081
|
/** Photo album metadata to save back to `p:photoAlbum`. */
|
|
7762
8082
|
photoAlbum?: PptxPhotoAlbum;
|
|
8083
|
+
/**
|
|
8084
|
+
* Slide dimensions to write back to `p:sldSz`.
|
|
8085
|
+
*
|
|
8086
|
+
* Omitting the option preserves the load-time dimensions verbatim, which
|
|
8087
|
+
* is why an edit made through a viewer's Slide Size control has to reach
|
|
8088
|
+
* the save call: nothing else in the pipeline can observe it.
|
|
8089
|
+
*
|
|
8090
|
+
* PowerPoint derives `Presentation.PageSetup.SlideSize` from `@cx`/`@cy`
|
|
8091
|
+
* alone (verified by COM: an A4-typed `p:sldSz` carrying 4:3 dimensions
|
|
8092
|
+
* still reports `ppSlideSizeCustom`), so `type` is written for fidelity
|
|
8093
|
+
* but the dimensions are what actually decide the reported preset.
|
|
8094
|
+
*/
|
|
8095
|
+
slideSize?: PptxSlideSize;
|
|
7763
8096
|
/** East Asian line-break settings to save back to `p:kinsoku`. */
|
|
7764
8097
|
kinsoku?: PptxKinsoku | null;
|
|
7765
8098
|
/** Write-protection verifier. Set to `null` to remove, `undefined` to preserve existing. */
|
|
@@ -8351,24 +8684,38 @@ declare class PptxHandlerCore {
|
|
|
8351
8684
|
name?: string;
|
|
8352
8685
|
}>>;
|
|
8353
8686
|
/**
|
|
8354
|
-
* Export selected slides
|
|
8687
|
+
* Export selected slides to a vector or raster format, keyed by slide index.
|
|
8688
|
+
*
|
|
8689
|
+
* **This does not produce PPTX files.** The previous version of this comment
|
|
8690
|
+
* said each entry was "a standalone PPTX with only that slide", named the
|
|
8691
|
+
* option `slideIndexes` (the real field is `slideIndices`), and wrote the
|
|
8692
|
+
* bytes to `slide_N.pptx`. None of that was ever true: the runtime has
|
|
8693
|
+
* always taken a `format` of `svg` / `png` / `pdf`. Per-slide PPTX
|
|
8694
|
+
* extraction is a different operation and is not implemented here.
|
|
8355
8695
|
*
|
|
8356
|
-
*
|
|
8357
|
-
*
|
|
8696
|
+
* Only `svg` works without a host-supplied backend, and it works fully:
|
|
8697
|
+
* the headless {@link SvgExporter} renders it with no DOM. `png` and `pdf`
|
|
8698
|
+
* THROW, because this package carries no rasteriser; use a viewer binding's
|
|
8699
|
+
* browser export pipeline, or override `exportSlides` on the runtime with
|
|
8700
|
+
* your own backend.
|
|
8358
8701
|
*
|
|
8359
8702
|
* @param slides - Full slide array.
|
|
8360
|
-
* @param options - Export options (
|
|
8361
|
-
* @returns A `Map<slideIndex, Uint8Array>` of exported files.
|
|
8703
|
+
* @param options - Export options (`format`, `slideIndices`, `width`, ...).
|
|
8704
|
+
* @returns A `Map<slideIndex, Uint8Array>` of exported files. Hidden slides
|
|
8705
|
+
* are omitted unless `options.includeHidden` is set, so the map can be
|
|
8706
|
+
* smaller than `options.slideIndices`.
|
|
8707
|
+
* @throws {Error} when `options.format` is `png` or `pdf`.
|
|
8362
8708
|
*
|
|
8363
8709
|
* @example
|
|
8364
8710
|
* ```ts
|
|
8365
8711
|
* const exports = await handler.exportSlides(data.slides, {
|
|
8366
|
-
*
|
|
8712
|
+
* format: 'svg',
|
|
8713
|
+
* slideIndices: [0, 2],
|
|
8367
8714
|
* });
|
|
8368
8715
|
* for (const [idx, bytes] of exports) {
|
|
8369
|
-
* await fs.writeFile(`slide_${idx}.
|
|
8716
|
+
* await fs.writeFile(`slide_${idx}.svg`, Buffer.from(bytes));
|
|
8370
8717
|
* }
|
|
8371
|
-
* // => Map<number, Uint8Array
|
|
8718
|
+
* // => Map<number, Uint8Array>: one SVG document per exported slide
|
|
8372
8719
|
* ```
|
|
8373
8720
|
*/
|
|
8374
8721
|
exportSlides(slides: PptxSlide[], options: PptxExportOptions): Promise<Map<number, Uint8Array>>;
|
|
@@ -8800,6 +9147,80 @@ interface ViewerFontSource {
|
|
|
8800
9147
|
style?: 'normal' | 'italic';
|
|
8801
9148
|
}
|
|
8802
9149
|
//#endregion
|
|
9150
|
+
//#region src/render/presentation-file-kinds.d.ts
|
|
9151
|
+
/**
|
|
9152
|
+
* presentation-file-kinds: the one place that answers "can the viewer open
|
|
9153
|
+
* this file?" and "what should the saved copy be called?".
|
|
9154
|
+
*
|
|
9155
|
+
* ## Why this is a shared decision and not five allow-lists
|
|
9156
|
+
*
|
|
9157
|
+
* The loader reads more formats than any single UI advertises. Legacy binary
|
|
9158
|
+
* `.ppt` (PowerPoint 97-2003) is the sharp example: `PptxHandler.load()` has
|
|
9159
|
+
* detected the OLE compound-file container and converted the binary deck
|
|
9160
|
+
* through the regular pptx pipeline for some time, but the product kept saying
|
|
9161
|
+
* it was unsupported, and a picker that filters the extension out makes a
|
|
9162
|
+
* working loader unreachable in practice. Whenever the loader learns a format,
|
|
9163
|
+
* exactly one list has to change.
|
|
9164
|
+
*
|
|
9165
|
+
* ## Read many, write one
|
|
9166
|
+
*
|
|
9167
|
+
* Input is a superset of output. We READ `.pptx`, `.ppsx`, `.pptm`, `.potx`,
|
|
9168
|
+
* legacy binary `.ppt` and portable `pptx-viewer-json`; we WRITE only the
|
|
9169
|
+
* OpenXML family. That asymmetry is deliberate (PowerPoint itself does the
|
|
9170
|
+
* same: open a 97-2003 deck and Save As offers `.pptx`), and it is why
|
|
9171
|
+
* {@link savedPresentationFileName} always REPLACES the source extension
|
|
9172
|
+
* rather than keeping it. A deck opened as `report.ppt` and saved as
|
|
9173
|
+
* `report.ppt` would be a file whose bytes and whose name disagree, which is
|
|
9174
|
+
* the kind of thing PowerPoint refuses to open.
|
|
9175
|
+
*
|
|
9176
|
+
* This module deliberately imports nothing, so any layer (render, export, a
|
|
9177
|
+
* binding, a host app) can depend on it without risking an import cycle.
|
|
9178
|
+
*
|
|
9179
|
+
* @module render/presentation-file-kinds
|
|
9180
|
+
*/
|
|
9181
|
+
/**
|
|
9182
|
+
* Extensions the built-in file picker offers, in the order it offers them.
|
|
9183
|
+
*
|
|
9184
|
+
* `.ppt` is in the list because the loader genuinely handles it, not as a
|
|
9185
|
+
* courtesy: see `packages/core/src/core/ppt/` and the `ppt-import` integration
|
|
9186
|
+
* suite, which asserts a `.ppt` loads to the same model as the `.pptx` it was
|
|
9187
|
+
* exported from.
|
|
9188
|
+
*/
|
|
9189
|
+
declare const PRESENTATION_OPEN_EXTENSIONS: readonly ['.pptx', '.ppsx', '.pptm', '.potx', '.ppt', '.json'];
|
|
9190
|
+
/** Comma-separated `accept` attribute for a presentation file input. */
|
|
9191
|
+
declare const PPTX_OPEN_ACCEPT: string;
|
|
9192
|
+
/**
|
|
9193
|
+
* True when a picked / dropped file's name looks like something the loader can
|
|
9194
|
+
* open. Use this instead of a hand-rolled `endsWith` chain: a drop handler that
|
|
9195
|
+
* disagrees with the picker's `accept` list is a format that is supported by
|
|
9196
|
+
* mouse but not by drag, which is how `.ppt` stayed invisible.
|
|
9197
|
+
*
|
|
9198
|
+
* Extension-only, by design. The real answer comes from the container sniff in
|
|
9199
|
+
* `PptxHandler.load()`; this is only the cheap pre-filter a drop target needs
|
|
9200
|
+
* before it hands bytes to the loader.
|
|
9201
|
+
*/
|
|
9202
|
+
declare function isSupportedPresentationFile(name: string | null | undefined): boolean;
|
|
9203
|
+
/** True for the binary PowerPoint 97-2003 family, which we read but never write. */
|
|
9204
|
+
declare function isLegacyBinaryPresentation(name: string | null | undefined): boolean;
|
|
9205
|
+
/** The formats the save path can produce. Binary `.ppt` is deliberately absent. */
|
|
9206
|
+
type SavedPresentationFormat = 'pptx' | 'ppsx' | 'pptm';
|
|
9207
|
+
/**
|
|
9208
|
+
* The stem of a presentation file name: directories and any loadable extension
|
|
9209
|
+
* removed. `C:\decks\report.ppt` becomes `report`; a name with no recognised
|
|
9210
|
+
* extension is kept whole, so `Untitled Presentation` survives intact rather
|
|
9211
|
+
* than losing everything after its last dot.
|
|
9212
|
+
*/
|
|
9213
|
+
declare function presentationBaseName(sourceName: string | null | undefined, fallback?: string): string;
|
|
9214
|
+
/**
|
|
9215
|
+
* The name a saved copy should be offered under: the source stem plus the
|
|
9216
|
+
* extension of the format actually being written.
|
|
9217
|
+
*
|
|
9218
|
+
* This is what turns `report.ppt` into `report.pptx` on Save As. Output is
|
|
9219
|
+
* always an OpenXML package, so keeping the source extension would mislabel
|
|
9220
|
+
* the bytes.
|
|
9221
|
+
*/
|
|
9222
|
+
declare function savedPresentationFileName(sourceName: string | null | undefined, format?: SavedPresentationFormat): string;
|
|
9223
|
+
//#endregion
|
|
8803
9224
|
//#region src/render/session-restore.d.ts
|
|
8804
9225
|
/**
|
|
8805
9226
|
* session-restore: keep the deck a host app has open across a page refresh.
|
|
@@ -9314,6 +9735,20 @@ declare function exportAllSlidesToSvg(data: PptxData, options?: SvgExportAllOpti
|
|
|
9314
9735
|
/** Export the selected presentation slides as SVG Blobs. */
|
|
9315
9736
|
declare function exportAllSlidesToSvgBlobs(data: PptxData, options?: SvgExportAllOptions): Blob[];
|
|
9316
9737
|
|
|
9738
|
+
/**
|
|
9739
|
+
* A drop-in wrapper around `html2canvas-pro` that first normalises modern CSS
|
|
9740
|
+
* colour functions (oklch/oklab/lch/lab/color()) to sRGB and applies the
|
|
9741
|
+
* shared CSS-preprocessing pass (backdrop-filter, mix-blend-mode, 3D
|
|
9742
|
+
* transforms, unsupported features) to the cloned capture document. Svelte
|
|
9743
|
+
* port of the vanilla binding's `renderToCanvas` wrapper
|
|
9744
|
+
* (`packages/vanilla/src/viewer/export/render-to-canvas.ts`); the pure
|
|
9745
|
+
* colour/CSS passes live once in `pptx-viewer-shared`, only this thin
|
|
9746
|
+
* html2canvas-pro glue is per-binding. `html2canvas-pro` is imported
|
|
9747
|
+
* dynamically so it stays out of the main bundle until export is actually
|
|
9748
|
+
* used.
|
|
9749
|
+
*/
|
|
9750
|
+
declare function renderToCanvas(element: HTMLElement, options?: Partial<Options>): Promise<HTMLCanvasElement>;
|
|
9751
|
+
|
|
9317
9752
|
/** Payload for the `onload` callback. */
|
|
9318
9753
|
interface ViewerLoadDetail {
|
|
9319
9754
|
/** Number of slides in the loaded presentation. */
|
|
@@ -9449,13 +9884,28 @@ interface PowerPointViewerProps {
|
|
|
9449
9884
|
/** Host override for the File > Open action. */
|
|
9450
9885
|
onopenfile?: () => void;
|
|
9451
9886
|
/**
|
|
9452
|
-
*
|
|
9453
|
-
* the
|
|
9454
|
-
*
|
|
9455
|
-
*
|
|
9456
|
-
*
|
|
9457
|
-
*
|
|
9458
|
-
*
|
|
9887
|
+
* POLICY CEILING for crash-recovery autosave. Not a switch the host flips on
|
|
9888
|
+
* the user's behalf: it states what this application permits, and the
|
|
9889
|
+
* title-bar AutoSave toggle (and File > Options > Save > AutoSave) is the
|
|
9890
|
+
* user's preference inside it.
|
|
9891
|
+
*
|
|
9892
|
+
* - `false` turns autosave off AND renders the toggle off and inert; a user
|
|
9893
|
+
* cannot switch on what the application forbade.
|
|
9894
|
+
* - `true`, or omitted, PERMITS autosave and lets the toggle decide.
|
|
9895
|
+
*
|
|
9896
|
+
* While active, each edit serializes the current slides to `.pptx` bytes,
|
|
9897
|
+
* writes them to the shared IndexedDB recovery store (keyed by
|
|
9898
|
+
* {@link filePath}) and fires `onautosave`. A snapshot lands no later than
|
|
9899
|
+
* one interval after the first unsaved edit, and no more often than once per
|
|
9900
|
+
* interval. Requires `filePath`; without one the indicator reads "disabled".
|
|
9901
|
+
*
|
|
9902
|
+
* On the next load of the same `filePath` the viewer OFFERS the snapshot back
|
|
9903
|
+
* in a "Recover unsaved changes?" dialog (Restore loads it in place, Discard
|
|
9904
|
+
* deletes it), unless this prop is `false`. The store is also reachable
|
|
9905
|
+
* directly through the re-exported `getAutosaveSnapshot` /
|
|
9906
|
+
* `listAutosaveSnapshots` helpers.
|
|
9907
|
+
*
|
|
9908
|
+
* @default true
|
|
9459
9909
|
*/
|
|
9460
9910
|
autosave?: boolean;
|
|
9461
9911
|
/** Fired when the desktop title bar toggles AutoSave for this viewer instance. */
|
|
@@ -9465,7 +9915,16 @@ interface PowerPointViewerProps {
|
|
|
9465
9915
|
* Autosave is inert until this is set.
|
|
9466
9916
|
*/
|
|
9467
9917
|
filePath?: string;
|
|
9468
|
-
/**
|
|
9918
|
+
/**
|
|
9919
|
+
* Autosave cadence in milliseconds: the debounce window, and the ceiling on
|
|
9920
|
+
* how long an unbroken stream of edits may defer a snapshot.
|
|
9921
|
+
*
|
|
9922
|
+
* Optional, and a policy like {@link autosave}: pass it and it wins. Leave it
|
|
9923
|
+
* out and the cadence is the user's own File > Options > Save > "Save
|
|
9924
|
+
* AutoRecover information every N minutes", which defaults to two minutes.
|
|
9925
|
+
*
|
|
9926
|
+
* @default 120000 (Options > Save, "every 2 minutes")
|
|
9927
|
+
*/
|
|
9469
9928
|
autosaveIntervalMs?: number;
|
|
9470
9929
|
/** Fired with the serialized `.pptx` bytes after each successful autosave. */
|
|
9471
9930
|
onautosave?: (bytes: Uint8Array) => void;
|
|
@@ -9590,6 +10049,13 @@ declare const PowerPointViewer: Component<PowerPointViewerProps, PowerPointViewe
|
|
|
9590
10049
|
* - Vue's debounce-on-edit trigger: an edit marks the document dirty and
|
|
9591
10050
|
* (re)arms a debounce timer instead of polling on a fixed interval.
|
|
9592
10051
|
*
|
|
10052
|
+
* The debounce is CAPPED by the shared `nextAutosaveDelayMs`, so it keeps the
|
|
10053
|
+
* same promise React's and Angular's polling engines do: a snapshot lands no
|
|
10054
|
+
* later than one interval after the FIRST unsaved edit, and no more often than
|
|
10055
|
+
* once per interval. Without that cap a user who keeps typing keeps re-arming
|
|
10056
|
+
* the timer, and at the two-minute AutoRecover cadence that is a whole session
|
|
10057
|
+
* of work that never reaches the recovery store.
|
|
10058
|
+
*
|
|
9593
10059
|
* The controller registers its own edit-watching `$effect` in the constructor,
|
|
9594
10060
|
* so the SFC only has to construct it once during setup and read its reactive
|
|
9595
10061
|
* `status` / `isDirty` for the toolbar indicator.
|
|
@@ -9605,5 +10071,5 @@ declare const PowerPointViewer: Component<PowerPointViewerProps, PowerPointViewe
|
|
|
9605
10071
|
*/
|
|
9606
10072
|
type AutosaveStatus = 'idle' | 'disabled' | 'saving' | 'saved' | 'error';
|
|
9607
10073
|
|
|
9608
|
-
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 };
|
|
9609
|
-
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 };
|
|
10074
|
+
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 };
|
|
10075
|
+
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 };
|