pptx-kit-preview 0.3.2 → 0.5.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.
@@ -0,0 +1,45 @@
1
+ import { PresentationData, SlideData } from "pptx-kit";
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
+ }
23
+ type TextMeasurer = (text: string, spec: FontSpec) => MeasureResult;
24
+ type TextLayoutMode = 'foreignObject' | 'svg';
25
+ interface RenderSlideOptions {
26
+ /** Measurer used by the pure-SVG text path. Required when `textLayout` is
27
+ * 'svg'; ignored otherwise. */
28
+ readonly measureText?: TextMeasurer;
29
+ /** Which text path to use. Defaults to 'foreignObject' (the browser path)
30
+ * so existing callers are unaffected; the harness opts into 'svg'. */
31
+ readonly textLayout?: TextLayoutMode;
32
+ }
33
+ declare const SANS = "Carlito";
34
+ declare const SERIF = "Caladea";
35
+ declare const ARIAL = "Liberation Sans";
36
+ declare const TIMES = "Liberation Serif";
37
+ declare const MONO = "Liberation Mono";
38
+ declare const substituteFamily: (family: string | null | undefined) => string;
39
+ declare const defaultMeasurer: TextMeasurer;
40
+ //#endregion
41
+ //#region src/render-slide.d.ts
42
+ declare const renderSlideSvg: (pres: PresentationData, slide: SlideData, opts?: RenderSlideOptions) => string;
43
+ //#endregion
44
+ export { MeasureResult as a, SERIF as c, TextMeasurer as d, defaultMeasurer as f, MONO as i, TIMES as l, ARIAL as n, RenderSlideOptions as o, substituteFamily as p, FontSpec as r, SANS as s, renderSlideSvg as t, TextLayoutMode as u };
45
+ //# sourceMappingURL=index-5nb1RZV7.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,42 +1,2 @@
1
- import { PresentationData, SlideData } from 'pptx-kit';
2
-
3
- /** What a measurer needs to size one run. Pixels at 96 DPI; the caller has
4
- * already applied EMU→px, pt→px and the autofit fontScale. `family` is the
5
- * resolved internal family name (see `substituteFamily`), not a CSS list. */
6
- interface FontSpec {
7
- readonly family: string;
8
- readonly sizePx: number;
9
- readonly bold: boolean;
10
- readonly italic: boolean;
11
- readonly letterSpacingPx: number;
12
- }
13
- /** Advance width of `text` in px, plus optional vertical metrics. A real
14
- * measurer returns ascent/descent/lineGap so line height matches the font;
15
- * the heuristic returns width only and the engine falls back to a ratio. */
16
- interface MeasureResult {
17
- readonly widthPx: number;
18
- readonly ascentPx?: number;
19
- readonly descentPx?: number;
20
- readonly lineGapPx?: number;
21
- }
22
- type TextMeasurer = (text: string, spec: FontSpec) => MeasureResult;
23
- type TextLayoutMode = 'foreignObject' | 'svg';
24
- interface RenderSlideOptions {
25
- /** Measurer used by the pure-SVG text path. Required when `textLayout` is
26
- * 'svg'; ignored otherwise. */
27
- readonly measureText?: TextMeasurer;
28
- /** Which text path to use. Defaults to 'foreignObject' (the browser path)
29
- * so existing callers are unaffected; the harness opts into 'svg'. */
30
- readonly textLayout?: TextLayoutMode;
31
- }
32
- declare const SANS = "Carlito";
33
- declare const SERIF = "Caladea";
34
- declare const ARIAL = "Liberation Sans";
35
- declare const TIMES = "Liberation Serif";
36
- declare const MONO = "Liberation Mono";
37
- declare const substituteFamily: (family: string | null | undefined) => string;
38
- declare const defaultMeasurer: TextMeasurer;
39
-
40
- declare const renderSlideSvg: (pres: PresentationData, slide: SlideData, opts?: RenderSlideOptions) => string;
41
-
42
- export { ARIAL, type FontSpec, MONO, type MeasureResult, type RenderSlideOptions, SANS, SERIF, TIMES, type TextLayoutMode, type TextMeasurer, defaultMeasurer, renderSlideSvg as renderSlideToSvg, substituteFamily };
1
+ import { a as MeasureResult, c as SERIF, d as TextMeasurer, f as defaultMeasurer, i as MONO, l as TIMES, n as ARIAL, o as RenderSlideOptions, p as substituteFamily, r as FontSpec, s as SANS, t as renderSlideSvg, u as TextLayoutMode } from "./index-5nb1RZV7.js";
2
+ export { ARIAL, type FontSpec, MONO, type MeasureResult, type RenderSlideOptions, SANS, SERIF, TIMES, type TextLayoutMode, type TextMeasurer, defaultMeasurer, renderSlideSvg as renderSlideToSvg, substituteFamily };