@silurus/ooxml 0.48.1 → 0.50.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/README.md +26 -3
- package/dist/{docx-ge6W7nx6.js → docx-BmrIhf6p.js} +260 -226
- package/dist/docx.mjs +1 -1
- package/dist/index.mjs +3 -3
- package/dist/{mathjax-BnoS-ncC.js → math.mjs} +22 -1420
- package/dist/mathjax-DWYWI9GF.js +21 -0
- package/dist/mathml-B58AKtQj.js +1388 -0
- package/dist/{pptx-CUkjUjWS.js → pptx-DefKBJxp.js} +248 -243
- package/dist/pptx.mjs +1 -1
- package/dist/types/docx.d.ts +41 -3
- package/dist/types/index.d.ts +54 -3
- package/dist/types/math.d.ts +38 -0
- package/dist/types/pptx.d.ts +43 -0
- package/dist/{xlsx-kp1hbHn5.js → xlsx-BO-a3nOm.js} +5 -3
- package/dist/xlsx.mjs +1 -1
- package/package.json +5 -1
package/dist/pptx.mjs
CHANGED
package/dist/types/docx.d.ts
CHANGED
|
@@ -396,9 +396,17 @@ declare interface LineSpacing {
|
|
|
396
396
|
explicit?: boolean;
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
/** Options for {@link DocxDocument.load}.
|
|
400
|
-
* `@silurus/ooxml-core` (`useGoogleFonts`, `maxZipEntryBytes`)
|
|
401
|
-
|
|
399
|
+
/** Options for {@link DocxDocument.load}. Extends the shared load-options type
|
|
400
|
+
* from `@silurus/ooxml-core` (`useGoogleFonts`, `maxZipEntryBytes`) with the
|
|
401
|
+
* opt-in math engine. */
|
|
402
|
+
export declare interface LoadOptions extends LoadOptions_2 {
|
|
403
|
+
/**
|
|
404
|
+
* Opt-in OMML equation engine. Import it from the separate `@silurus/ooxml/math`
|
|
405
|
+
* entry and pass it in: `import { math } from '@silurus/ooxml/math'`. When
|
|
406
|
+
* omitted, equations are skipped and the ~3 MB engine never enters the bundle.
|
|
407
|
+
*/
|
|
408
|
+
math?: MathRenderer;
|
|
409
|
+
}
|
|
402
410
|
|
|
403
411
|
/**
|
|
404
412
|
* Common load-time options shared by the docx / pptx / xlsx
|
|
@@ -518,6 +526,27 @@ declare interface MathRadical {
|
|
|
518
526
|
radicand: MathNode[];
|
|
519
527
|
}
|
|
520
528
|
|
|
529
|
+
/**
|
|
530
|
+
* The math engine contract a viewer needs to render equations. Satisfied by the
|
|
531
|
+
* `math` named export of the separate `@silurus/ooxml/math` entry point, which
|
|
532
|
+
* the consumer opts into:
|
|
533
|
+
*
|
|
534
|
+
* ```ts
|
|
535
|
+
* import { DocxViewer } from '@silurus/ooxml/docx';
|
|
536
|
+
* import { math } from '@silurus/ooxml/math';
|
|
537
|
+
* new DocxViewer(canvas, { math });
|
|
538
|
+
* ```
|
|
539
|
+
*
|
|
540
|
+
* Omit it and the equation engine (MathJax + STIX Two Math, ~3 MB) is never
|
|
541
|
+
* imported, so a bundler drops it entirely.
|
|
542
|
+
*/
|
|
543
|
+
declare interface MathRenderer {
|
|
544
|
+
/** Preload the engine. Called once before converting equations. */
|
|
545
|
+
loadMathJax(): Promise<void>;
|
|
546
|
+
/** MathML string → standalone SVG + baseline-relative em extents. */
|
|
547
|
+
mathMLToSvg(mathml: string): Promise<MathSvg>;
|
|
548
|
+
}
|
|
549
|
+
|
|
521
550
|
declare interface MathRun {
|
|
522
551
|
kind: 'run';
|
|
523
552
|
text: string;
|
|
@@ -533,6 +562,15 @@ declare interface MathScript {
|
|
|
533
562
|
|
|
534
563
|
declare type MathStyle = 'roman' | 'italic' | 'bold' | 'boldItalic';
|
|
535
564
|
|
|
565
|
+
declare interface MathSvg {
|
|
566
|
+
/** standalone `<svg>…</svg>` markup. */
|
|
567
|
+
svg: string;
|
|
568
|
+
/** extents in em (the SVG viewBox uses 1em = 1000 units). */
|
|
569
|
+
widthEm: number;
|
|
570
|
+
ascentEm: number;
|
|
571
|
+
descentEm: number;
|
|
572
|
+
}
|
|
573
|
+
|
|
536
574
|
declare interface NumberingInfo {
|
|
537
575
|
numId: number;
|
|
538
576
|
level: number;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1188,9 +1188,17 @@ declare interface LoadOptions_2 {
|
|
|
1188
1188
|
* `@silurus/ooxml-core` (`useGoogleFonts`, `maxZipEntryBytes`). */
|
|
1189
1189
|
declare type LoadOptions_3 = LoadOptions_2;
|
|
1190
1190
|
|
|
1191
|
-
/** Options for {@link DocxDocument.load}.
|
|
1192
|
-
* `@silurus/ooxml-core` (`useGoogleFonts`, `maxZipEntryBytes`)
|
|
1193
|
-
|
|
1191
|
+
/** Options for {@link DocxDocument.load}. Extends the shared load-options type
|
|
1192
|
+
* from `@silurus/ooxml-core` (`useGoogleFonts`, `maxZipEntryBytes`) with the
|
|
1193
|
+
* opt-in math engine. */
|
|
1194
|
+
declare interface LoadOptions_4 extends LoadOptions_2 {
|
|
1195
|
+
/**
|
|
1196
|
+
* Opt-in OMML equation engine. Import it from the separate `@silurus/ooxml/math`
|
|
1197
|
+
* entry and pass it in: `import { math } from '@silurus/ooxml/math'`. When
|
|
1198
|
+
* omitted, equations are skipped and the ~3 MB engine never enters the bundle.
|
|
1199
|
+
*/
|
|
1200
|
+
math?: MathRenderer;
|
|
1201
|
+
}
|
|
1194
1202
|
|
|
1195
1203
|
declare interface ManualLayout {
|
|
1196
1204
|
xMode: string;
|
|
@@ -1290,6 +1298,27 @@ declare interface MathRadical {
|
|
|
1290
1298
|
radicand: MathNode[];
|
|
1291
1299
|
}
|
|
1292
1300
|
|
|
1301
|
+
/**
|
|
1302
|
+
* The math engine contract a viewer needs to render equations. Satisfied by the
|
|
1303
|
+
* `math` named export of the separate `@silurus/ooxml/math` entry point, which
|
|
1304
|
+
* the consumer opts into:
|
|
1305
|
+
*
|
|
1306
|
+
* ```ts
|
|
1307
|
+
* import { DocxViewer } from '@silurus/ooxml/docx';
|
|
1308
|
+
* import { math } from '@silurus/ooxml/math';
|
|
1309
|
+
* new DocxViewer(canvas, { math });
|
|
1310
|
+
* ```
|
|
1311
|
+
*
|
|
1312
|
+
* Omit it and the equation engine (MathJax + STIX Two Math, ~3 MB) is never
|
|
1313
|
+
* imported, so a bundler drops it entirely.
|
|
1314
|
+
*/
|
|
1315
|
+
declare interface MathRenderer {
|
|
1316
|
+
/** Preload the engine. Called once before converting equations. */
|
|
1317
|
+
loadMathJax(): Promise<void>;
|
|
1318
|
+
/** MathML string → standalone SVG + baseline-relative em extents. */
|
|
1319
|
+
mathMLToSvg(mathml: string): Promise<MathSvg>;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1293
1322
|
declare interface MathRun {
|
|
1294
1323
|
kind: 'run';
|
|
1295
1324
|
text: string;
|
|
@@ -1305,6 +1334,15 @@ declare interface MathScript {
|
|
|
1305
1334
|
|
|
1306
1335
|
declare type MathStyle = 'roman' | 'italic' | 'bold' | 'boldItalic';
|
|
1307
1336
|
|
|
1337
|
+
declare interface MathSvg {
|
|
1338
|
+
/** standalone `<svg>…</svg>` markup. */
|
|
1339
|
+
svg: string;
|
|
1340
|
+
/** extents in em (the SVG viewBox uses 1em = 1000 units). */
|
|
1341
|
+
widthEm: number;
|
|
1342
|
+
ascentEm: number;
|
|
1343
|
+
descentEm: number;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1308
1346
|
declare interface MediaElement {
|
|
1309
1347
|
type: 'media';
|
|
1310
1348
|
x: number;
|
|
@@ -1796,6 +1834,13 @@ declare interface RenderOptions {
|
|
|
1796
1834
|
* the static renderer drawing a duplicate play badge.
|
|
1797
1835
|
*/
|
|
1798
1836
|
skipMediaControls?: boolean;
|
|
1837
|
+
/**
|
|
1838
|
+
* Opt-in OMML equation engine. Import it from the separate `@silurus/ooxml/math`
|
|
1839
|
+
* entry and pass it in: `import { math } from '@silurus/ooxml/math'`. When
|
|
1840
|
+
* omitted, equations are skipped and the ~3 MB engine tree-shakes out of the
|
|
1841
|
+
* bundle entirely (it is referenced nowhere unless you import it).
|
|
1842
|
+
*/
|
|
1843
|
+
math?: MathRenderer;
|
|
1799
1844
|
}
|
|
1800
1845
|
|
|
1801
1846
|
declare interface RenderPageOptions {
|
|
@@ -1839,6 +1884,12 @@ declare interface RenderSlideOptions {
|
|
|
1839
1884
|
* its own play/pause chrome without duplication.
|
|
1840
1885
|
*/
|
|
1841
1886
|
skipMediaControls?: boolean;
|
|
1887
|
+
/**
|
|
1888
|
+
* Opt-in OMML equation engine. Import it from the separate `@silurus/ooxml/math`
|
|
1889
|
+
* entry and pass it in: `import { math } from '@silurus/ooxml/math'`. When
|
|
1890
|
+
* omitted, equations are skipped and the ~3 MB engine never enters the bundle.
|
|
1891
|
+
*/
|
|
1892
|
+
math?: MathRenderer;
|
|
1842
1893
|
}
|
|
1843
1894
|
|
|
1844
1895
|
declare interface RenderViewportOptions {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OMML equation engine (MathJax + STIX Two Math). Pass it to a viewer's
|
|
3
|
+
* `math` option to enable equation rendering. Self-contained: no network, no
|
|
4
|
+
* cross-origin requests.
|
|
5
|
+
*/
|
|
6
|
+
export declare const math: MathRenderer;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The math engine contract a viewer needs to render equations. Satisfied by the
|
|
10
|
+
* `math` named export of the separate `@silurus/ooxml/math` entry point, which
|
|
11
|
+
* the consumer opts into:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { DocxViewer } from '@silurus/ooxml/docx';
|
|
15
|
+
* import { math } from '@silurus/ooxml/math';
|
|
16
|
+
* new DocxViewer(canvas, { math });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Omit it and the equation engine (MathJax + STIX Two Math, ~3 MB) is never
|
|
20
|
+
* imported, so a bundler drops it entirely.
|
|
21
|
+
*/
|
|
22
|
+
export declare interface MathRenderer {
|
|
23
|
+
/** Preload the engine. Called once before converting equations. */
|
|
24
|
+
loadMathJax(): Promise<void>;
|
|
25
|
+
/** MathML string → standalone SVG + baseline-relative em extents. */
|
|
26
|
+
mathMLToSvg(mathml: string): Promise<MathSvg>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export declare interface MathSvg {
|
|
30
|
+
/** standalone `<svg>…</svg>` markup. */
|
|
31
|
+
svg: string;
|
|
32
|
+
/** extents in em (the SVG viewBox uses 1em = 1000 units). */
|
|
33
|
+
widthEm: number;
|
|
34
|
+
ascentEm: number;
|
|
35
|
+
descentEm: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { }
|
package/dist/types/pptx.d.ts
CHANGED
|
@@ -466,6 +466,27 @@ declare interface MathRadical {
|
|
|
466
466
|
radicand: MathNode[];
|
|
467
467
|
}
|
|
468
468
|
|
|
469
|
+
/**
|
|
470
|
+
* The math engine contract a viewer needs to render equations. Satisfied by the
|
|
471
|
+
* `math` named export of the separate `@silurus/ooxml/math` entry point, which
|
|
472
|
+
* the consumer opts into:
|
|
473
|
+
*
|
|
474
|
+
* ```ts
|
|
475
|
+
* import { DocxViewer } from '@silurus/ooxml/docx';
|
|
476
|
+
* import { math } from '@silurus/ooxml/math';
|
|
477
|
+
* new DocxViewer(canvas, { math });
|
|
478
|
+
* ```
|
|
479
|
+
*
|
|
480
|
+
* Omit it and the equation engine (MathJax + STIX Two Math, ~3 MB) is never
|
|
481
|
+
* imported, so a bundler drops it entirely.
|
|
482
|
+
*/
|
|
483
|
+
declare interface MathRenderer {
|
|
484
|
+
/** Preload the engine. Called once before converting equations. */
|
|
485
|
+
loadMathJax(): Promise<void>;
|
|
486
|
+
/** MathML string → standalone SVG + baseline-relative em extents. */
|
|
487
|
+
mathMLToSvg(mathml: string): Promise<MathSvg>;
|
|
488
|
+
}
|
|
489
|
+
|
|
469
490
|
declare interface MathRun {
|
|
470
491
|
kind: 'run';
|
|
471
492
|
text: string;
|
|
@@ -481,6 +502,15 @@ declare interface MathScript {
|
|
|
481
502
|
|
|
482
503
|
declare type MathStyle = 'roman' | 'italic' | 'bold' | 'boldItalic';
|
|
483
504
|
|
|
505
|
+
declare interface MathSvg {
|
|
506
|
+
/** standalone `<svg>…</svg>` markup. */
|
|
507
|
+
svg: string;
|
|
508
|
+
/** extents in em (the SVG viewBox uses 1em = 1000 units). */
|
|
509
|
+
widthEm: number;
|
|
510
|
+
ascentEm: number;
|
|
511
|
+
descentEm: number;
|
|
512
|
+
}
|
|
513
|
+
|
|
484
514
|
declare interface MediaElement {
|
|
485
515
|
type: 'media';
|
|
486
516
|
x: number;
|
|
@@ -831,6 +861,13 @@ export declare interface RenderOptions {
|
|
|
831
861
|
* the static renderer drawing a duplicate play badge.
|
|
832
862
|
*/
|
|
833
863
|
skipMediaControls?: boolean;
|
|
864
|
+
/**
|
|
865
|
+
* Opt-in OMML equation engine. Import it from the separate `@silurus/ooxml/math`
|
|
866
|
+
* entry and pass it in: `import { math } from '@silurus/ooxml/math'`. When
|
|
867
|
+
* omitted, equations are skipped and the ~3 MB engine tree-shakes out of the
|
|
868
|
+
* bundle entirely (it is referenced nowhere unless you import it).
|
|
869
|
+
*/
|
|
870
|
+
math?: MathRenderer;
|
|
834
871
|
}
|
|
835
872
|
|
|
836
873
|
/**
|
|
@@ -853,6 +890,12 @@ export declare interface RenderSlideOptions {
|
|
|
853
890
|
* its own play/pause chrome without duplication.
|
|
854
891
|
*/
|
|
855
892
|
skipMediaControls?: boolean;
|
|
893
|
+
/**
|
|
894
|
+
* Opt-in OMML equation engine. Import it from the separate `@silurus/ooxml/math`
|
|
895
|
+
* entry and pass it in: `import { math } from '@silurus/ooxml/math'`. When
|
|
896
|
+
* omitted, equations are skipped and the ~3 MB engine never enters the bundle.
|
|
897
|
+
*/
|
|
898
|
+
math?: MathRenderer;
|
|
856
899
|
}
|
|
857
900
|
|
|
858
901
|
declare interface Shadow {
|
|
@@ -3172,10 +3172,12 @@ var cn = class {
|
|
|
3172
3172
|
updateTabActive(e) {
|
|
3173
3173
|
this.tabs.forEach((t, n) => {
|
|
3174
3174
|
t.style.cssText = this.tabStyle(n === e, this.tabColors[n]);
|
|
3175
|
-
}), this.tabs[e]?.scrollIntoView({
|
|
3176
|
-
block: "nearest",
|
|
3177
|
-
inline: "nearest"
|
|
3178
3175
|
});
|
|
3176
|
+
let t = this.tabs[e];
|
|
3177
|
+
if (t) {
|
|
3178
|
+
let e = this.tabStrip, n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
3179
|
+
n.left < r.left ? e.scrollLeft -= r.left - n.left : n.right > r.right && (e.scrollLeft += n.right - r.right);
|
|
3180
|
+
}
|
|
3179
3181
|
}
|
|
3180
3182
|
tabStyle(e, t) {
|
|
3181
3183
|
let n = nn - 2, r = nn - 5, i = t ? `box-shadow:inset 0 -${e ? 2 : 3}px 0 0 ${t};` : "";
|
package/dist/xlsx.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silurus/ooxml",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"description": "Browser-based OOXML viewer (docx/xlsx/pptx) — Rust/WASM parser + Canvas renderer",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Yuki Yokotani <silurus.dev@gmail.com>",
|
|
@@ -49,6 +49,10 @@
|
|
|
49
49
|
"./pptx": {
|
|
50
50
|
"import": "./dist/pptx.mjs",
|
|
51
51
|
"types": "./dist/types/pptx.d.ts"
|
|
52
|
+
},
|
|
53
|
+
"./math": {
|
|
54
|
+
"import": "./dist/math.mjs",
|
|
55
|
+
"types": "./dist/types/math.d.ts"
|
|
52
56
|
}
|
|
53
57
|
},
|
|
54
58
|
"devDependencies": {
|