@office-kit/pptx-preview 0.12.0 → 0.14.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 +25 -0
- package/dist/index-DUFPGYOf.d.ts +236 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +23 -3
- package/dist/node.js.map +1 -1
- package/dist/{src-C2HIGS1C.js → src-Bwmf324Z.js} +2233 -1610
- package/dist/src-Bwmf324Z.js.map +1 -0
- package/package.json +3 -3
- package/dist/index-B6ISDjnu.d.ts +0 -93
- package/dist/src-C2HIGS1C.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@office-kit/pptx-preview",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Experimental preview renderer for @office-kit/pptx: render a slide to SVG (browser + Node) or rasterize it to a PNG/RGBA image in Node, with no browser binary.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ooxml",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"fontkit": "^2.0.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@office-kit/pptx": "0.
|
|
47
|
+
"@office-kit/pptx": "0.23.0",
|
|
48
48
|
"@types/fontkit": "^2.0.9",
|
|
49
49
|
"tsdown": "^0.22.2",
|
|
50
50
|
"typescript": "^6.0.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@office-kit/pptx": "^0.
|
|
53
|
+
"@office-kit/pptx": "^0.23.0"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">=22.18.0"
|
package/dist/index-B6ISDjnu.d.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { PresentationData, SlideData, getParagraphBullet, getParagraphBulletStyle, getParagraphIndent, getShapeBodyPrEffective, getShapeTextAutoFitParams, getShapeTextDirection } from "@office-kit/pptx";
|
|
2
|
-
|
|
3
|
-
//#region src/text-layout.d.ts
|
|
4
|
-
/** What a measurer needs to size one run. Pixels at 96 DPI; the caller has
|
|
5
|
-
* already applied EMU→px, pt→px and the autofit fontScale. `family` is the
|
|
6
|
-
* resolved internal family name (see `substituteFamily`), not a CSS list. */
|
|
7
|
-
interface FontSpec {
|
|
8
|
-
readonly family: string;
|
|
9
|
-
readonly sizePx: number;
|
|
10
|
-
readonly bold: boolean;
|
|
11
|
-
readonly italic: boolean;
|
|
12
|
-
readonly letterSpacingPx: number;
|
|
13
|
-
}
|
|
14
|
-
/** Advance width of `text` in px, plus optional vertical metrics. A real
|
|
15
|
-
* measurer returns ascent/descent/lineGap so line height matches the font;
|
|
16
|
-
* the heuristic returns width only and the engine falls back to a ratio. */
|
|
17
|
-
interface MeasureResult {
|
|
18
|
-
readonly widthPx: number;
|
|
19
|
-
readonly ascentPx?: number;
|
|
20
|
-
readonly descentPx?: number;
|
|
21
|
-
readonly lineGapPx?: number;
|
|
22
|
-
/** True when the width is an estimate rather than a glyph measurement —
|
|
23
|
-
* the heuristic measurer always, the fontkit measurer when the resolved
|
|
24
|
-
* font lacks a glyph and per-character ratios filled the gap. The audit
|
|
25
|
-
* API surfaces this so borderline verdicts can be treated as advisory. */
|
|
26
|
-
readonly approximate?: boolean;
|
|
27
|
-
}
|
|
28
|
-
type TextMeasurer = (text: string, spec: FontSpec) => MeasureResult;
|
|
29
|
-
type TextLayoutMode = 'foreignObject' | 'svg';
|
|
30
|
-
interface RenderSlideOptions {
|
|
31
|
-
/** Measurer used by the pure-SVG text path. Required when `textLayout` is
|
|
32
|
-
* 'svg'; ignored otherwise. */
|
|
33
|
-
readonly measureText?: TextMeasurer;
|
|
34
|
-
/** Which text path to use. Defaults to 'foreignObject' (the browser path)
|
|
35
|
-
* so existing callers are unaffected; the harness opts into 'svg'. */
|
|
36
|
-
readonly textLayout?: TextLayoutMode;
|
|
37
|
-
}
|
|
38
|
-
declare const SANS = "Carlito";
|
|
39
|
-
declare const SERIF = "Caladea";
|
|
40
|
-
declare const ARIAL = "Liberation Sans";
|
|
41
|
-
declare const TIMES = "Liberation Serif";
|
|
42
|
-
declare const MONO = "Liberation Mono";
|
|
43
|
-
declare const substituteFamily: (family: string | null | undefined) => string;
|
|
44
|
-
declare const defaultMeasurer: TextMeasurer;
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/render-slide.d.ts
|
|
47
|
-
declare const renderSlideSvg: (pres: PresentationData, slide: SlideData, opts?: RenderSlideOptions) => string;
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/audit.d.ts
|
|
50
|
-
interface IssueBase {
|
|
51
|
-
/** 0-based deck position of the slide the shape sits on. */
|
|
52
|
-
readonly slideIndex: number;
|
|
53
|
-
readonly shapeName: string | null;
|
|
54
|
-
/** True when any run was measured by estimate rather than real glyph
|
|
55
|
-
* metrics (heuristic measurer, or a font without the needed glyphs).
|
|
56
|
-
* Treat borderline overflows as advisory when set. */
|
|
57
|
-
readonly approximate: boolean;
|
|
58
|
-
}
|
|
59
|
-
type TextAuditIssue = (IssueBase & {
|
|
60
|
-
readonly kind: 'overflow-x' | 'overflow-y'; /** How far the text ink escapes the box, in px at 96 DPI. */
|
|
61
|
-
readonly overflowPx: number;
|
|
62
|
-
}) | (IssueBase & {
|
|
63
|
-
readonly kind: 'soft-wrap';
|
|
64
|
-
readonly paragraphIndex: number;
|
|
65
|
-
/** Lines beyond the paragraph's authored line count (1 + explicit
|
|
66
|
-
* breaks) — i.e. how many times the text wrapped on its own. */
|
|
67
|
-
readonly extraLines: number;
|
|
68
|
-
});
|
|
69
|
-
interface AuditTextLayoutOptions {
|
|
70
|
-
/** Measurer for run widths / vertical metrics. Defaults to the heuristic
|
|
71
|
-
* measurer (browser-safe, approximate); pass the fontkit measurer from
|
|
72
|
-
* `@office-kit/pptx-preview/node` for real glyph metrics. */
|
|
73
|
-
readonly measureText?: TextMeasurer;
|
|
74
|
-
/** Overflow at or below this many px (96 DPI) is ignored. Default 1 —
|
|
75
|
-
* measurement and PowerPoint disagree by sub-pixel amounts routinely. */
|
|
76
|
-
readonly tolerancePx?: number;
|
|
77
|
-
/** Also report paragraphs that wrap onto more lines than their explicit
|
|
78
|
-
* breaks author (段落ち). Off by default: wrapping is normal for body
|
|
79
|
-
* text, so this is opt-in for single-line-intent content like titles. */
|
|
80
|
-
readonly reportSoftWraps?: boolean;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Measures every text body in the deck and reports text that escapes its box
|
|
84
|
-
* (`overflow-x` / `overflow-y`) and, opt-in, paragraphs that soft-wrap
|
|
85
|
-
* (`soft-wrap`, 段落ち).
|
|
86
|
-
*
|
|
87
|
-
* Table cell text is not audited (v1 covers shape text bodies, including
|
|
88
|
-
* placeholders and shapes inside groups).
|
|
89
|
-
*/
|
|
90
|
-
declare const auditTextLayout: (pres: PresentationData, options?: AuditTextLayoutOptions) => ReadonlyArray<TextAuditIssue>;
|
|
91
|
-
//#endregion
|
|
92
|
-
export { ARIAL as a, MeasureResult as c, SERIF as d, TIMES as f, substituteFamily as g, defaultMeasurer as h, renderSlideSvg as i, RenderSlideOptions as l, TextMeasurer as m, TextAuditIssue as n, FontSpec as o, TextLayoutMode as p, auditTextLayout as r, MONO as s, AuditTextLayoutOptions as t, SANS as u };
|
|
93
|
-
//# sourceMappingURL=index-B6ISDjnu.d.ts.map
|