@silurus/ooxml 0.74.3 → 0.74.5

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.
@@ -29,7 +29,7 @@ interface MathRenderer {
29
29
  mathMLToSvg(mathml: string): Promise<MathSvg>;
30
30
  }
31
31
  //#endregion
32
- //#region dist/.types-work/find-match-BE0QHHzK.d.ts
32
+ //#region dist/.types-work/find-highlight-B8ft6Y0g.d.ts
33
33
  //#region packages/core/src/types/math.d.ts
34
34
  type MathStyle = 'roman' | 'italic' | 'bold' | 'boldItalic';
35
35
  interface MathRun {
@@ -1329,7 +1329,22 @@ interface FindMatch<Loc = unknown> {
1329
1329
  location: Loc;
1330
1330
  }
1331
1331
  //#endregion
1332
- //#region dist/.types-work/common-5TjSrjhP.d.ts
1332
+ //#region packages/core/src/search/find-highlight.d.ts
1333
+ /**
1334
+ * CSS colours used by in-document search overlays.
1335
+ *
1336
+ * The values are applied as the overlay backgrounds verbatim. Use an alpha
1337
+ * colour (`rgba(...)`, 8-digit hex, or `color-mix(...)`) when the rendered text
1338
+ * should remain visible through the highlight.
1339
+ */
1340
+ interface FindHighlightColors {
1341
+ /** Background for every match except the active one. */
1342
+ match?: string;
1343
+ /** Background for the match selected by findNext/findPrev. */
1344
+ active?: string;
1345
+ }
1346
+ //#endregion
1347
+ //#region dist/.types-work/common-Bva7_XCn.d.ts
1333
1348
  //#region packages/core/src/types/common.d.ts
1334
1349
  type PathCmd = {
1335
1350
  cmd: 'moveTo';
@@ -1801,7 +1816,7 @@ interface RenderOptions {
1801
1816
  skipMediaControls?: boolean;
1802
1817
  }
1803
1818
  //#endregion
1804
- //#region dist/.types-work/pptx-CJgt70hV.d.ts
1819
+ //#region dist/.types-work/pptx-lmtZXJAj.d.ts
1805
1820
  //#region packages/pptx/src/types.d.ts
1806
1821
  /**
1807
1822
  * Picture bullet — ECMA-376 §21.1.2.4.2 `<a:buBlip><a:blip r:embed>`. The
@@ -2478,6 +2493,11 @@ interface RenderSlideOptions {
2478
2493
  skipMediaControls?: boolean;
2479
2494
  /** Translucent overlay drawn over the finished slide (hidden-slide dimming). */
2480
2495
  dim?: DimOptions;
2496
+ /**
2497
+ * Called for asynchronous embedded-media fetch, decode, and playback
2498
+ * failures created by {@link PptxPresentation.presentSlide}.
2499
+ */
2500
+ onError?: (error: Error) => void;
2481
2501
  }
2482
2502
  /**
2483
2503
  * Headless PPTX rendering engine.
@@ -2673,7 +2693,7 @@ type HiddenSlideMode = 'show' | 'skip' | 'dim';
2673
2693
  interface PptxViewerOptions extends RenderOptions, LoadOptions {
2674
2694
  /** Called when a slide finishes rendering */
2675
2695
  onSlideChange?: (index: number, total: number) => void;
2676
- /** Called on parse or render errors */
2696
+ /** Called on parse, render, or embedded-media playback errors. */
2677
2697
  onError?: (err: Error) => void;
2678
2698
  /** IX9 zoom contract ({@link ZoomableViewer}) — the clamp range for
2679
2699
  * {@link PptxViewer.setScale} / `zoomIn` / `zoomOut` / `fitWidth` / `fitPage`,
@@ -2699,6 +2719,8 @@ interface PptxViewerOptions extends RenderOptions, LoadOptions {
2699
2719
  * browser's native text selection works on slide content.
2700
2720
  */
2701
2721
  enableTextSelection?: boolean;
2722
+ /** CSS backgrounds for ordinary and active in-document search matches. */
2723
+ findHighlightColors?: FindHighlightColors;
2702
2724
  /**
2703
2725
  * How hidden slides (`<p:sld show="0">`, §19.3.1.38) are presented:
2704
2726
  * - `'show'` (default): drawn like any other slide.
@@ -3031,6 +3053,22 @@ interface PptxScrollViewerOptions extends Omit<RenderSlideOptions, 'onTextRun'>,
3031
3053
  * shipped back beside the slide bitmap, so the overlay is populated identically
3032
3054
  * to main mode (no more empty overlay / one-time warning). */
3033
3055
  enableTextSelection?: boolean;
3056
+ /** CSS backgrounds for ordinary and active in-document search matches. */
3057
+ findHighlightColors?: FindHighlightColors;
3058
+ /**
3059
+ * Enable interactive audio/video playback. When true, mounted slides render
3060
+ * through {@link PptxPresentation.presentSlide} only while they are inside the
3061
+ * real viewport plus {@link mediaOverscan}. Other mounted slides retain static
3062
+ * canvases and selectable text without allocating media blobs or RAF loops.
3063
+ * Default false.
3064
+ */
3065
+ enableMediaPlayback?: boolean;
3066
+ /**
3067
+ * Slides beyond the real viewport that may keep interactive media handles.
3068
+ * Independent from {@link overscan}, so an integration may mount every text
3069
+ * overlay for browser-native Find while media resources stay bounded. Default 1.
3070
+ */
3071
+ mediaOverscan?: number;
3034
3072
  /** Minimum zoom scale — a DIMENSIONLESS multiplier over the 96-dpi natural
3035
3073
  * slide size (10% = 0.1), matching `DocxScrollViewer`. Default 0.1. */
3036
3074
  zoomMin?: number;
@@ -3038,6 +3076,13 @@ interface PptxScrollViewerOptions extends Omit<RenderSlideOptions, 'onTextRun'>,
3038
3076
  zoomMax?: number;
3039
3077
  /** Enable `Ctrl`/`Cmd`+wheel zoom. Default true. */
3040
3078
  enableZoom?: boolean;
3079
+ /**
3080
+ * Re-fit the presentation to the container width when the container is
3081
+ * resized. Default true. Set false to preserve the current absolute scale,
3082
+ * including an explicit pre-load `setScale(1)`, independently of the viewport
3083
+ * width. Explicit `fitWidth()` and `fitPage()` calls remain available.
3084
+ */
3085
+ refitOnResize?: boolean;
3041
3086
  /**
3042
3087
  * CSS `background` shorthand for the scroll surface (the "desk") visible
3043
3088
  * behind and between slides — the gray a presentation viewer paints around the
@@ -3076,15 +3121,17 @@ interface PptxScrollViewerOptions extends Omit<RenderSlideOptions, 'onTextRun'>,
3076
3121
  /** IX9 — fires whenever the zoom factor actually changes (`1` = 100% = a slide
3077
3122
  * at its natural EMU→px size): from {@link PptxScrollViewer.setScale},
3078
3123
  * `zoomIn`/`zoomOut`, `fitWidth`/`fitPage`, a Ctrl/⌘+wheel gesture, or a
3079
- * container-resize re-fit. Named `onScaleChange` to match the single-canvas
3080
- * viewers so all five share one notification shape. */
3124
+ * container-resize re-fit (when `refitOnResize` is enabled). Named
3125
+ * `onScaleChange` to match the single-canvas viewers so all five share one
3126
+ * notification shape. */
3081
3127
  onScaleChange?: (scale: number) => void;
3082
3128
  /** Error callback. When set, `load()` invokes it and resolves (otherwise the
3083
3129
  * error is rethrown — shared viewer error contract). It ALSO fires for async
3084
3130
  * per-slot render failures (both main `renderSlide` and worker
3085
- * `renderSlideToBitmap` rejections); a failed slide is left blank rather than
3086
- * crashing the loop. Without an `onError`, render failures are logged via
3087
- * `console.error` so they are never fully silent. */
3131
+ * `renderSlideToBitmap` rejections) and embedded-media fetch/decode/playback
3132
+ * failures. A failed slide is left blank rather than crashing the loop.
3133
+ * Without an `onError`, failures are logged via `console.error` so they are
3134
+ * never fully silent. */
3088
3135
  onError?: (err: Error) => void;
3089
3136
  /**
3090
3137
  * IX1 (design decision — NOT user-confirmed, integrator may veto). Fires on a
@@ -3229,6 +3276,9 @@ declare class PptxScrollViewer implements ZoomableViewer {
3229
3276
  * `_settleSlot`) so a recycled/re-mounted slot and a settle-swapped spare all
3230
3277
  * carry it. */
3231
3278
  private readonly _pageShadow;
3279
+ private readonly _find;
3280
+ private _findActive;
3281
+ private _findMeasureCtx;
3232
3282
  constructor(container: HTMLElement, opts?: PptxScrollViewerOptions);
3233
3283
  /**
3234
3284
  * Load a PPTX from URL or ArrayBuffer and render the first window.
@@ -3274,6 +3324,8 @@ declare class PptxScrollViewer implements ZoomableViewer {
3274
3324
  private _recomputeHeights;
3275
3325
  private _gap;
3276
3326
  private _overscan;
3327
+ /** Media lifecycle window, deliberately independent from text/canvas overscan. */
3328
+ private _mediaOverscan;
3277
3329
  /** Desk padding fed to `computeVisibleRange`: `paddingTop`/`paddingBottom`,
3278
3330
  * each defaulting to `gap` (uniform rhythm). Resolved here (not stored) to
3279
3331
  * mirror `_gap()`/`_overscan()`, and consumed at EVERY `computeVisibleRange`
@@ -3292,6 +3344,8 @@ declare class PptxScrollViewer implements ZoomableViewer {
3292
3344
  * `[0, n-1]`; a `y` below the first slide (inside the leading pad) yields 0. */
3293
3345
  private _slideIndexAtOffset;
3294
3346
  private _range;
3347
+ private _mediaRange;
3348
+ private _rangeContains;
3295
3349
  private _syncSpacer;
3296
3350
  /** Horizontal scroll extent: the (uniform deck-wide) slide width plus both
3297
3351
  * gutters. A spacer NARROWER than the container never creates a scrollbar
@@ -3339,6 +3393,20 @@ declare class PptxScrollViewer implements ZoomableViewer {
3339
3393
  * can pass for an old-epoch resolution). We gate them on the captured epoch.
3340
3394
  */
3341
3395
  private _renderSlot;
3396
+ /**
3397
+ * Render one mounted slot through the stateful media presentation API.
3398
+ *
3399
+ * This path intentionally bypasses bitmaprenderer even for worker-backed
3400
+ * presentations: presentSlide() renders the base off-thread and composites
3401
+ * interactive video on a main-thread 2D canvas. The slot generation closes the
3402
+ * same-index recycle/reload hole that a viewer-wide render epoch cannot detect.
3403
+ */
3404
+ private _renderInteractiveSlot;
3405
+ /**
3406
+ * Reconcile stateful media handles against the small media lifecycle range,
3407
+ * independently from the (potentially whole-deck) mounted text range.
3408
+ */
3409
+ private _syncMediaPlayback;
3342
3410
  /** Route an async render failure to `onError`, or `console.error` when none is
3343
3411
  * set (so failures are never fully silent), and never after teardown. */
3344
3412
  private _reportRenderError;
@@ -3481,6 +3549,12 @@ declare class PptxScrollViewer implements ZoomableViewer {
3481
3549
  * stretched preview until the instant of the swap — blank-free.
3482
3550
  */
3483
3551
  private _settleSlot;
3552
+ /**
3553
+ * Settle an interactive slide onto a spare 2D canvas, then atomically swap it
3554
+ * in and destroy the handle tied to the retired canvas. Pending handles from a
3555
+ * superseded zoom/recycle are destroyed as soon as they resolve.
3556
+ */
3557
+ private _settleInteractiveSlot;
3484
3558
  /**
3485
3559
  * Scroll so slide `index`'s top edge sits at the viewport top. Clamps `index` to
3486
3560
  * `[0, slideCount-1]` (the pager convention) and the resulting scrollTop to
@@ -3503,6 +3577,21 @@ declare class PptxScrollViewer implements ZoomableViewer {
3503
3577
  scrollToSlide(index: number, opts?: {
3504
3578
  behavior?: 'auto' | 'smooth';
3505
3579
  }): void;
3580
+ /** Search the complete presentation, including slides outside the
3581
+ * virtualized mounted window. Matching is case-insensitive by default. */
3582
+ findText(query: string, opts?: FindMatchesOptions): Promise<FindMatch<PptxMatchLocation>[]>;
3583
+ /** Activate and reveal the next match, wrapping at the end. */
3584
+ findNext(): Promise<FindMatch<PptxMatchLocation> | null>;
3585
+ /** Activate and reveal the previous match, wrapping at the beginning. */
3586
+ findPrev(): Promise<FindMatch<PptxMatchLocation> | null>;
3587
+ /** Clear the current query and every mounted highlight. */
3588
+ clearFind(): void;
3589
+ private _activateMatch;
3590
+ private _collectSlideRuns;
3591
+ private _redrawHighlights;
3592
+ private _refreshFindRuns;
3593
+ private _redrawSlotHighlights;
3594
+ private _measureForFind;
3506
3595
  /**
3507
3596
  * IX1 hyperlink click dispatch (mirrors {@link PptxViewer._onHyperlinkClick}).
3508
3597
  * When the integrator supplies `opts.onHyperlinkClick` it OWNS the click (no
@@ -3608,10 +3697,8 @@ interface PptxHighlightMatch {
3608
3697
  slices: MatchRunSlice[];
3609
3698
  active: boolean;
3610
3699
  }
3611
- interface PptxHighlightColors {
3612
- match?: string;
3613
- active?: string;
3614
- }
3700
+ /** Format-specific compatibility alias for the shared colour contract. */
3701
+ type PptxHighlightColors = FindHighlightColors;
3615
3702
  /**
3616
3703
  * Populate a highlight overlay layer with a box per matched run-slice, grouped
3617
3704
  * by shape frame (with the shape's rotation) so each box lands on the drawn
@@ -3632,4 +3719,4 @@ interface PptxHighlightColors {
3632
3719
  */
3633
3720
  declare function buildPptxHighlightLayer(layer: HTMLDivElement, runs: PptxTextRunInfo[], matches: PptxHighlightMatch[], cssWidth: number, cssHeight: number, measureForFont: (font: string) => (s: string) => number, colors?: PptxHighlightColors): void;
3634
3721
  //#endregion
3635
- export { type AutoResizeOptions, type Bevel3d, type BlipBullet, type Bullet, type Camera3d, type ChartElement, type ChartModel, type ChartSeries, type DimOptions, type Fill, type FillRect, type FindMatch, type FindMatchesOptions, type Glow, type GradientFill, type GradientStop, type HiddenSlideMode, type HyperlinkTarget, type ImageFill, type LightRig, type LineBreak, type LoadOptions, type MediaElement, type NoFill, OoxmlError, type OoxmlErrorCode, type Paragraph, type PathCmd, type PictureElement, type PptxComment, type PptxHighlightColors, type PptxHighlightMatch, type PptxMatchLocation, PptxPresentation, PptxScrollViewer, type PptxScrollViewerOptions, type PptxTextRunInfo, PptxViewer, type PptxViewerOptions, type Presentation, type PresentationHandle, type Reflection, type RenderOptions, type RenderSlideOptions, type RenderSlideToBitmapOptions, type Rot3d, type Scene3d, type Shadow, type ShapeElement, type Slide, type SlideElement, type SoftEdge, type SolidFill, type Sp3d, type SpaceLine, type Stroke, type TabStop, type TableCell, type TableElement, type TableRow, type TextBody, type TextRect, type TextRun, type TextRunCallback, type TextRunData, type TileInfo, autoResize, buildPptxHighlightLayer, buildPptxTextLayer, openExternalHyperlink, renderSlide };
3722
+ export { type AutoResizeOptions, type Bevel3d, type BlipBullet, type Bullet, type Camera3d, type ChartElement, type ChartModel, type ChartSeries, type DimOptions, type Fill, type FillRect, type FindHighlightColors, type FindMatch, type FindMatchesOptions, type Glow, type GradientFill, type GradientStop, type HiddenSlideMode, type HyperlinkTarget, type ImageFill, type LightRig, type LineBreak, type LoadOptions, type MediaElement, type NoFill, OoxmlError, type OoxmlErrorCode, type Paragraph, type PathCmd, type PictureElement, type PptxComment, type PptxHighlightColors, type PptxHighlightMatch, type PptxMatchLocation, PptxPresentation, PptxScrollViewer, type PptxScrollViewerOptions, type PptxTextRunInfo, PptxViewer, type PptxViewerOptions, type Presentation, type PresentationHandle, type Reflection, type RenderOptions, type RenderSlideOptions, type RenderSlideToBitmapOptions, type Rot3d, type Scene3d, type Shadow, type ShapeElement, type Slide, type SlideElement, type SoftEdge, type SolidFill, type Sp3d, type SpaceLine, type Stroke, type TabStop, type TableCell, type TableElement, type TableRow, type TextBody, type TextRect, type TextRun, type TextRunCallback, type TextRunData, type TileInfo, autoResize, buildPptxHighlightLayer, buildPptxTextLayer, openExternalHyperlink, renderSlide };
@@ -29,7 +29,7 @@ interface MathRenderer {
29
29
  mathMLToSvg(mathml: string): Promise<MathSvg>;
30
30
  }
31
31
  //#endregion
32
- //#region dist/.types-work/find-match-BE0QHHzK.d.ts
32
+ //#region dist/.types-work/find-highlight-B8ft6Y0g.d.ts
33
33
  //#region packages/core/src/types/math.d.ts
34
34
  type MathStyle = 'roman' | 'italic' | 'bold' | 'boldItalic';
35
35
  interface MathRun {
@@ -1297,7 +1297,22 @@ interface FindMatch<Loc = unknown> {
1297
1297
  location: Loc;
1298
1298
  }
1299
1299
  //#endregion
1300
- //#region dist/.types-work/common-5TjSrjhP.d.ts
1300
+ //#region packages/core/src/search/find-highlight.d.ts
1301
+ /**
1302
+ * CSS colours used by in-document search overlays.
1303
+ *
1304
+ * The values are applied as the overlay backgrounds verbatim. Use an alpha
1305
+ * colour (`rgba(...)`, 8-digit hex, or `color-mix(...)`) when the rendered text
1306
+ * should remain visible through the highlight.
1307
+ */
1308
+ interface FindHighlightColors {
1309
+ /** Background for every match except the active one. */
1310
+ match?: string;
1311
+ /** Background for the match selected by findNext/findPrev. */
1312
+ active?: string;
1313
+ }
1314
+ //#endregion
1315
+ //#region dist/.types-work/common-Bva7_XCn.d.ts
1301
1316
  type SpaceLine = {
1302
1317
  type: 'pct';
1303
1318
  val: number;
@@ -1306,7 +1321,7 @@ type SpaceLine = {
1306
1321
  val: number;
1307
1322
  };
1308
1323
  //#endregion
1309
- //#region dist/.types-work/xlsx-1vWbvQcb.d.ts
1324
+ //#region dist/.types-work/xlsx-DAB_laks.d.ts
1310
1325
  //#region packages/xlsx/src/types.d.ts
1311
1326
  interface Workbook {
1312
1327
  sheets: SheetMeta[];
@@ -2694,6 +2709,8 @@ interface XlsxViewerOptions extends LoadOptions$1 {
2694
2709
  * via {@link XlsxViewer.setSelectionColor}.
2695
2710
  */
2696
2711
  selectionColor?: string;
2712
+ /** CSS backgrounds for ordinary and active in-document search matches. */
2713
+ findHighlightColors?: FindHighlightColors;
2697
2714
  /**
2698
2715
  * `'main'` (default): parse in a worker, render on the main thread. `'worker'`:
2699
2716
  * parse AND render entirely inside the worker and paint the returned
@@ -3336,4 +3353,4 @@ declare class XlsxViewer implements ZoomableViewer {
3336
3353
  */
3337
3354
  declare function resolveSharedStrings(ws: Worksheet, sharedStrings: SharedString[]): Worksheet;
3338
3355
  //#endregion
3339
- export { type AutoResizeOptions, type Border, type BorderEdge, type Cell, type CellAddress, type CellFill, type CellFont, type CellRange, type CellValue, type CellXf, type CfIcon, type CfRule, type CfStop, type CfValue, type ChartAnchor, type ChartDataLabelOverride, type ChartDataPointOverride, type ChartErrBars, type ChartManualLayout, type ChartModel, type ChartSeries, type ChartSeriesDataLabels, type ConditionalFormat, type DataLabelOverride, type DataPointOverride, type DataValidation, type DefinedName, type Duotone, type Dxf, type ErrBars, type FindMatch, type FindMatchesOptions, type GradientFillSpec, type HiddenSheetMode, type Hyperlink, type HyperlinkTarget, type ImageAnchor, type LegendManualLayout, type LoadOptions, type ManualLayout, type MergeCell, type NumFmt, OoxmlError, type OoxmlErrorCode, type OutlinePr, type ParsedWorkbook, type PathCmd, type PathInfo, type PhoneticAlignment, type PhoneticProperties, type PhoneticRun, type PhoneticType, type PivotCacheSource, type PivotDataField, type PivotDiagnostic, type PivotLocation, type PivotMetadataStatus, type PivotPageField, type PivotPartialReason, type PivotTableMetadata, type RenderViewportOptions, type ResolvedList, type Row, type Run, type RunFont, type SelectionMode, type SeriesDataLabels, type ShapeAnchor, type ShapeGeom, type ShapeInfo, type ShapeParagraph, type ShapeText, type ShapeTextRun, type SharedString, type SheetMeta, type SheetVisibility, type SlicerAnchor, type SlicerElementStyle, type SlicerItem, type SlicerStyle, type Sparkline, type SparklineGroup, type Styles, type TableColumnInfo, type TableInfo, type ViewportRange, type WireRenderViewportOptions, type WireSizeOverrides, type Workbook, type Worksheet, type XlsxChartSeries, type XlsxComment, type XlsxMatchLocation, type XlsxTextRunInfo, XlsxViewer, type XlsxViewerOptions, XlsxWorkbook, autoResize, openExternalHyperlink, resolveSharedStrings };
3356
+ export { type AutoResizeOptions, type Border, type BorderEdge, type Cell, type CellAddress, type CellFill, type CellFont, type CellRange, type CellValue, type CellXf, type CfIcon, type CfRule, type CfStop, type CfValue, type ChartAnchor, type ChartDataLabelOverride, type ChartDataPointOverride, type ChartErrBars, type ChartManualLayout, type ChartModel, type ChartSeries, type ChartSeriesDataLabels, type ConditionalFormat, type DataLabelOverride, type DataPointOverride, type DataValidation, type DefinedName, type Duotone, type Dxf, type ErrBars, type FindHighlightColors, type FindMatch, type FindMatchesOptions, type GradientFillSpec, type HiddenSheetMode, type Hyperlink, type HyperlinkTarget, type ImageAnchor, type LegendManualLayout, type LoadOptions, type ManualLayout, type MergeCell, type NumFmt, OoxmlError, type OoxmlErrorCode, type OutlinePr, type ParsedWorkbook, type PathCmd, type PathInfo, type PhoneticAlignment, type PhoneticProperties, type PhoneticRun, type PhoneticType, type PivotCacheSource, type PivotDataField, type PivotDiagnostic, type PivotLocation, type PivotMetadataStatus, type PivotPageField, type PivotPartialReason, type PivotTableMetadata, type RenderViewportOptions, type ResolvedList, type Row, type Run, type RunFont, type SelectionMode, type SeriesDataLabels, type ShapeAnchor, type ShapeGeom, type ShapeInfo, type ShapeParagraph, type ShapeText, type ShapeTextRun, type SharedString, type SheetMeta, type SheetVisibility, type SlicerAnchor, type SlicerElementStyle, type SlicerItem, type SlicerStyle, type Sparkline, type SparklineGroup, type Styles, type TableColumnInfo, type TableInfo, type ViewportRange, type WireRenderViewportOptions, type WireSizeOverrides, type Workbook, type Worksheet, type XlsxChartSeries, type XlsxComment, type XlsxMatchLocation, type XlsxTextRunInfo, XlsxViewer, type XlsxViewerOptions, XlsxWorkbook, autoResize, openExternalHyperlink, resolveSharedStrings };