@silurus/ooxml 0.24.3 → 0.25.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/dist/pptx.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./autoResize-ggn4hzd8.cjs`),t=require(`./pptx-Ywwc_EMp.cjs`);exports.PptxPresentation=t.r,exports.PptxViewer=t.n,exports.autoResize=e.t,exports.renderSlide=t.i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./autoResize-C6N7p_Or.cjs`),t=require(`./pptx-DMP47DvZ.cjs`);exports.PptxPresentation=t.r,exports.PptxViewer=t.n,exports.autoResize=e.t,exports.renderSlide=t.i;
package/dist/pptx.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as e } from "./autoResize-U2-IRmNE.js";
2
- import { i as t, n, r } from "./pptx-nyHInjlO.js";
1
+ import { t as e } from "./autoResize-D-Yz7Izt.js";
2
+ import { i as t, n, r } from "./pptx-Dr6cMPL2.js";
3
3
  export { r as PptxPresentation, n as PptxViewer, e as autoResize, t as renderSlide };
@@ -124,6 +124,10 @@ declare interface Document_2 {
124
124
  body: BodyElement[];
125
125
  headers: HeadersFooters;
126
126
  footers: HeadersFooters;
127
+ /** Theme `<a:fontScheme><a:majorFont><a:latin@typeface>` (heading face). */
128
+ majorFont?: string;
129
+ /** Theme `<a:fontScheme><a:minorFont><a:latin@typeface>` (body face). */
130
+ minorFont?: string;
127
131
  }
128
132
  export { Document_2 as Document }
129
133
 
@@ -132,7 +136,7 @@ export declare class DocxDocument {
132
136
  private _pages;
133
137
  private _worker;
134
138
  private constructor();
135
- static load(source: string | ArrayBuffer): Promise<DocxDocument>;
139
+ static load(source: string | ArrayBuffer, opts?: LoadOptions): Promise<DocxDocument>;
136
140
  private _parse;
137
141
  destroy(): void;
138
142
  get pageCount(): number;
@@ -176,7 +180,7 @@ export declare class DocxViewer {
176
180
  private _buildTextLayer;
177
181
  }
178
182
 
179
- declare interface DocxViewerOptions extends RenderPageOptions {
183
+ export declare interface DocxViewerOptions extends RenderPageOptions, LoadOptions {
180
184
  container?: HTMLElement;
181
185
  /**
182
186
  * When true, adds a transparent text overlay div over the canvas so the
@@ -276,6 +280,32 @@ declare interface LineSpacing {
276
280
  explicit?: boolean;
277
281
  }
278
282
 
283
+ /** Options for {@link DocxDocument.load}. Re-exports the shared
284
+ * `LoadOptions` shape from `@silurus/ooxml-core`. */
285
+ export declare type LoadOptions = LoadOptions_2;
286
+
287
+ /**
288
+ * Common load-time options shared by the docx / pptx / xlsx viewer
289
+ * `load(source, opts)` methods.
290
+ *
291
+ * Each viewer narrows or extends this in its package-local `LoadOptions` if
292
+ * needed, but the names that overlap (currently `useGoogleFonts`) keep the
293
+ * same shape so application code can pass the same options object.
294
+ */
295
+ declare interface LoadOptions_2 {
296
+ /**
297
+ * Opt in to loading webfont substitutes from Google Fonts
298
+ * (`fonts.googleapis.com`). Default `false` — the canvas falls back to
299
+ * locally available fonts.
300
+ *
301
+ * When enabled, end-user IP / User-Agent is sent to Google, which may
302
+ * have privacy / GDPR implications for your application. To avoid the
303
+ * third-party request, host the substitutes yourself and reference them
304
+ * via `@font-face` in your application CSS.
305
+ */
306
+ useGoogleFonts?: boolean;
307
+ }
308
+
279
309
  declare interface NumberingInfo {
280
310
  numId: number;
281
311
  level: number;
@@ -619,12 +619,18 @@ declare interface Document_2 {
619
619
  body: BodyElement[];
620
620
  headers: HeadersFooters;
621
621
  footers: HeadersFooters;
622
+ /** Theme `<a:fontScheme><a:majorFont><a:latin@typeface>` (heading face). */
623
+ majorFont?: string;
624
+ /** Theme `<a:fontScheme><a:minorFont><a:latin@typeface>` (body face). */
625
+ minorFont?: string;
622
626
  }
623
627
 
624
628
  export declare namespace docx {
625
629
  export {
626
630
  DocxDocument,
631
+ LoadOptions_4 as LoadOptions,
627
632
  DocxViewer,
633
+ DocxViewerOptions,
628
634
  autoResize,
629
635
  AutoResizeOptions,
630
636
  Document_2 as Document,
@@ -643,7 +649,7 @@ declare class DocxDocument {
643
649
  private _pages;
644
650
  private _worker;
645
651
  private constructor();
646
- static load(source: string | ArrayBuffer): Promise<DocxDocument>;
652
+ static load(source: string | ArrayBuffer, opts?: LoadOptions_4): Promise<DocxDocument>;
647
653
  private _parse;
648
654
  destroy(): void;
649
655
  get pageCount(): number;
@@ -687,7 +693,7 @@ declare class DocxViewer {
687
693
  private _buildTextLayer;
688
694
  }
689
695
 
690
- declare interface DocxViewerOptions extends RenderPageOptions {
696
+ declare interface DocxViewerOptions extends RenderPageOptions, LoadOptions_4 {
691
697
  container?: HTMLElement;
692
698
  /**
693
699
  * When true, adds a transparent text overlay div over the canvas so the
@@ -898,36 +904,40 @@ declare interface LineSpacing {
898
904
  explicit?: boolean;
899
905
  }
900
906
 
901
- /** Options for {@link PptxPresentation.load}. */
902
- declare interface LoadOptions {
903
- /**
904
- * Opt in to loading theme-declared webfonts from Google Fonts
905
- * (`fonts.googleapis.com`). When enabled, end-user IP/User-Agent is sent to
906
- * Google, which may have privacy/GDPR implications for your application.
907
- *
908
- * Default: `false` — the canvas falls back to locally available fonts. Host
909
- * the required webfonts yourself and reference them via `@font-face` in your
910
- * application CSS to match the document's theme fonts.
911
- */
912
- useGoogleFonts?: boolean;
913
- }
907
+ /** Options for {@link PptxPresentation.load}. Re-exports the shared
908
+ * `LoadOptions` shape from `@silurus/ooxml-core`. */
909
+ declare type LoadOptions = LoadOptions_2;
914
910
 
915
- /** Options for {@link XlsxWorkbook.load}. */
911
+ /**
912
+ * Common load-time options shared by the docx / pptx / xlsx viewer
913
+ * `load(source, opts)` methods.
914
+ *
915
+ * Each viewer narrows or extends this in its package-local `LoadOptions` if
916
+ * needed, but the names that overlap (currently `useGoogleFonts`) keep the
917
+ * same shape so application code can pass the same options object.
918
+ */
916
919
  declare interface LoadOptions_2 {
917
920
  /**
918
- * Opt in to loading Office-font metric substitutes (Carlito for Calibri,
919
- * Caladea for Cambria) from Google Fonts (`fonts.googleapis.com`). Without
920
- * these the canvas falls back to system Arial / Helvetica which is
921
- * noticeably wider per character, so column layouts diverge from Excel.
921
+ * Opt in to loading webfont substitutes from Google Fonts
922
+ * (`fonts.googleapis.com`). Default `false` — the canvas falls back to
923
+ * locally available fonts.
922
924
  *
923
- * When enabled, end-user IP / User-Agent is sent to Google, which may have
924
- * privacy / GDPR implications for your application. Default `false` — host
925
- * the substitute webfonts yourself and reference them via `@font-face` in
926
- * your application CSS to avoid the third-party request.
925
+ * When enabled, end-user IP / User-Agent is sent to Google, which may
926
+ * have privacy / GDPR implications for your application. To avoid the
927
+ * third-party request, host the substitutes yourself and reference them
928
+ * via `@font-face` in your application CSS.
927
929
  */
928
930
  useGoogleFonts?: boolean;
929
931
  }
930
932
 
933
+ /** Options for {@link XlsxWorkbook.load}. Re-exports the shared
934
+ * `LoadOptions` shape from `@silurus/ooxml-core`. */
935
+ declare type LoadOptions_3 = LoadOptions_2;
936
+
937
+ /** Options for {@link DocxDocument.load}. Re-exports the shared
938
+ * `LoadOptions` shape from `@silurus/ooxml-core`. */
939
+ declare type LoadOptions_4 = LoadOptions_2;
940
+
931
941
  declare interface ManualLayout {
932
942
  xMode: string;
933
943
  yMode: string;
@@ -1236,8 +1246,10 @@ declare class PptxPresentation {
1236
1246
  /**
1237
1247
  * Opinionated single-canvas PPTX viewer.
1238
1248
  *
1239
- * Creates a <canvas> element, appends it to the provided container, and manages
1240
- * slide navigation.
1249
+ * Accepts a caller-supplied `<canvas>` element and wraps it in a positioned
1250
+ * container for the optional text-selection overlay. The wrapper is inserted
1251
+ * into the canvas's existing parent (reparent), so the canvas stays at its
1252
+ * original position in the DOM.
1241
1253
  *
1242
1254
  * For custom layouts (multi-canvas, thumbnails, scroll view) use PptxPresentation directly.
1243
1255
  */
@@ -1249,7 +1261,7 @@ declare class PptxViewer {
1249
1261
  private readonly opts;
1250
1262
  private currentSlide;
1251
1263
  private handle;
1252
- constructor(container: HTMLElement, opts?: PptxViewerOptions);
1264
+ constructor(canvas: HTMLCanvasElement, opts?: PptxViewerOptions);
1253
1265
  /** Load a PPTX from URL or ArrayBuffer and render the first slide. */
1254
1266
  load(source: string | ArrayBuffer): Promise<void>;
1255
1267
  /** Navigate to a specific slide (0-indexed). */
@@ -2135,7 +2147,7 @@ declare class XlsxWorkbook {
2135
2147
  private imageCache;
2136
2148
  private rawData;
2137
2149
  constructor();
2138
- load(source: string | ArrayBuffer, opts?: LoadOptions_2): Promise<void>;
2150
+ load(source: string | ArrayBuffer, opts?: LoadOptions_3): Promise<void>;
2139
2151
  get sheetNames(): string[];
2140
2152
  get sheetCount(): number;
2141
2153
  getWorksheet(sheetIndex: number): Promise<Worksheet>;
@@ -242,16 +242,28 @@ export declare interface LineBreak {
242
242
  type: 'break';
243
243
  }
244
244
 
245
- /** Options for {@link PptxPresentation.load}. */
246
- export declare interface LoadOptions {
245
+ /** Options for {@link PptxPresentation.load}. Re-exports the shared
246
+ * `LoadOptions` shape from `@silurus/ooxml-core`. */
247
+ export declare type LoadOptions = LoadOptions_2;
248
+
249
+ /**
250
+ * Common load-time options shared by the docx / pptx / xlsx viewer
251
+ * `load(source, opts)` methods.
252
+ *
253
+ * Each viewer narrows or extends this in its package-local `LoadOptions` if
254
+ * needed, but the names that overlap (currently `useGoogleFonts`) keep the
255
+ * same shape so application code can pass the same options object.
256
+ */
257
+ declare interface LoadOptions_2 {
247
258
  /**
248
- * Opt in to loading theme-declared webfonts from Google Fonts
249
- * (`fonts.googleapis.com`). When enabled, end-user IP/User-Agent is sent to
250
- * Google, which may have privacy/GDPR implications for your application.
259
+ * Opt in to loading webfont substitutes from Google Fonts
260
+ * (`fonts.googleapis.com`). Default `false` the canvas falls back to
261
+ * locally available fonts.
251
262
  *
252
- * Default: `false` the canvas falls back to locally available fonts. Host
253
- * the required webfonts yourself and reference them via `@font-face` in your
254
- * application CSS to match the document's theme fonts.
263
+ * When enabled, end-user IP / User-Agent is sent to Google, which may
264
+ * have privacy / GDPR implications for your application. To avoid the
265
+ * third-party request, host the substitutes yourself and reference them
266
+ * via `@font-face` in your application CSS.
255
267
  */
256
268
  useGoogleFonts?: boolean;
257
269
  }
@@ -413,8 +425,10 @@ export declare class PptxPresentation {
413
425
  /**
414
426
  * Opinionated single-canvas PPTX viewer.
415
427
  *
416
- * Creates a <canvas> element, appends it to the provided container, and manages
417
- * slide navigation.
428
+ * Accepts a caller-supplied `<canvas>` element and wraps it in a positioned
429
+ * container for the optional text-selection overlay. The wrapper is inserted
430
+ * into the canvas's existing parent (reparent), so the canvas stays at its
431
+ * original position in the DOM.
418
432
  *
419
433
  * For custom layouts (multi-canvas, thumbnails, scroll view) use PptxPresentation directly.
420
434
  */
@@ -426,7 +440,7 @@ export declare class PptxViewer {
426
440
  private readonly opts;
427
441
  private currentSlide;
428
442
  private handle;
429
- constructor(container: HTMLElement, opts?: PptxViewerOptions);
443
+ constructor(canvas: HTMLCanvasElement, opts?: PptxViewerOptions);
430
444
  /** Load a PPTX from URL or ArrayBuffer and render the first slide. */
431
445
  load(source: string | ArrayBuffer): Promise<void>;
432
446
  /** Navigate to a specific slide (0-indexed). */
@@ -410,18 +410,28 @@ declare interface LegendManualLayout {
410
410
  h: number;
411
411
  }
412
412
 
413
- /** Options for {@link XlsxWorkbook.load}. */
414
- declare interface LoadOptions {
413
+ /** Options for {@link XlsxWorkbook.load}. Re-exports the shared
414
+ * `LoadOptions` shape from `@silurus/ooxml-core`. */
415
+ declare type LoadOptions = LoadOptions_2;
416
+
417
+ /**
418
+ * Common load-time options shared by the docx / pptx / xlsx viewer
419
+ * `load(source, opts)` methods.
420
+ *
421
+ * Each viewer narrows or extends this in its package-local `LoadOptions` if
422
+ * needed, but the names that overlap (currently `useGoogleFonts`) keep the
423
+ * same shape so application code can pass the same options object.
424
+ */
425
+ declare interface LoadOptions_2 {
415
426
  /**
416
- * Opt in to loading Office-font metric substitutes (Carlito for Calibri,
417
- * Caladea for Cambria) from Google Fonts (`fonts.googleapis.com`). Without
418
- * these the canvas falls back to system Arial / Helvetica which is
419
- * noticeably wider per character, so column layouts diverge from Excel.
427
+ * Opt in to loading webfont substitutes from Google Fonts
428
+ * (`fonts.googleapis.com`). Default `false` — the canvas falls back to
429
+ * locally available fonts.
420
430
  *
421
- * When enabled, end-user IP / User-Agent is sent to Google, which may have
422
- * privacy / GDPR implications for your application. Default `false` — host
423
- * the substitute webfonts yourself and reference them via `@font-face` in
424
- * your application CSS to avoid the third-party request.
431
+ * When enabled, end-user IP / User-Agent is sent to Google, which may
432
+ * have privacy / GDPR implications for your application. To avoid the
433
+ * third-party request, host the substitutes yourself and reference them
434
+ * via `@font-face` in your application CSS.
425
435
  */
426
436
  useGoogleFonts?: boolean;
427
437
  }