pptx-ts 3.7.0 → 4.0.1
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 +116 -269
- package/dist/autopage-odPz7zZO.js +536 -0
- package/dist/autopage-odPz7zZO.js.map +1 -0
- package/dist/binary-string-CKVAYI3M.js +24 -0
- package/dist/binary-string-CKVAYI3M.js.map +1 -0
- package/dist/body-insets-Dw_BeWD_.js +54 -0
- package/dist/body-insets-Dw_BeWD_.js.map +1 -0
- package/dist/browser.d.ts +29 -9
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +41 -14
- package/dist/browser.js.map +1 -1
- package/dist/clip-Bl01BPcN.d.ts +67 -0
- package/dist/clip-Bl01BPcN.d.ts.map +1 -0
- package/dist/diagnostics-D8ot4Ei7.d.ts +244 -0
- package/dist/diagnostics-D8ot4Ei7.d.ts.map +1 -0
- package/dist/embedded-fonts-DarT9aoa.d.ts +20 -0
- package/dist/embedded-fonts-DarT9aoa.d.ts.map +1 -0
- package/dist/entry-compose-DCnvBZz2.d.ts +1046 -0
- package/dist/entry-compose-DCnvBZz2.d.ts.map +1 -0
- package/dist/{enums-CvRYniUA.d.ts → enums-BUKTUB6V.d.ts} +21 -13
- package/dist/{enums-CvRYniUA.d.ts.map → enums-BUKTUB6V.d.ts.map} +1 -1
- package/dist/{errors-Bvln0H-7.js → errors-C4oENPcu.js} +92 -2
- package/dist/errors-C4oENPcu.js.map +1 -0
- package/dist/families.d.ts +260 -0
- package/dist/families.d.ts.map +1 -0
- package/dist/families.js +57 -0
- package/dist/families.js.map +1 -0
- package/dist/{fit-BKs0zxMI.js → fit-Cb7naFj6.js} +249 -167
- package/dist/fit-Cb7naFj6.js.map +1 -0
- package/dist/font-metrics-v5fn7s7e.d.ts +613 -0
- package/dist/font-metrics-v5fn7s7e.d.ts.map +1 -0
- package/dist/grid-DikTjFey.js +187 -0
- package/dist/grid-DikTjFey.js.map +1 -0
- package/dist/{html-dom-B0I0QSbU.js → html-dom-Iuog2wdK.js} +121 -91
- package/dist/html-dom-Iuog2wdK.js.map +1 -0
- package/dist/html.d.ts +6 -6
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +7 -6
- package/dist/html.js.map +1 -1
- package/dist/image-size-CvN2iCA4.js +1611 -0
- package/dist/image-size-CvN2iCA4.js.map +1 -0
- package/dist/index.d.ts +24 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +40 -31
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +40 -48
- package/dist/inspect.js.map +1 -1
- package/dist/math.d.ts +7 -5
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +16 -7
- package/dist/math.js.map +1 -1
- package/dist/measure.d.ts +12 -225
- package/dist/measure.d.ts.map +1 -1
- package/dist/measure.js +3 -3
- package/dist/node.d.ts +22 -8
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +27 -7
- package/dist/node.js.map +1 -1
- package/dist/notes-Dh12JAbn.js +3264 -0
- package/dist/notes-Dh12JAbn.js.map +1 -0
- package/dist/options-internal-WqgMf720.js +43 -0
- package/dist/options-internal-WqgMf720.js.map +1 -0
- package/dist/{package-CaOLXSNi.d.ts → package-J49Ck6S2.d.ts} +27 -12
- package/dist/package-J49Ck6S2.d.ts.map +1 -0
- package/dist/playbtn-CUqQdoDf.js +22 -0
- package/dist/playbtn-CUqQdoDf.js.map +1 -0
- package/dist/{slide-ZqAdVvHV.d.ts → pres-C6qgOFAa.d.ts} +1021 -1423
- package/dist/pres-C6qgOFAa.d.ts.map +1 -0
- package/dist/{presentation-DrJtj3-C.js → presentation-DGYlAWhl.js} +3208 -2727
- package/dist/presentation-DGYlAWhl.js.map +1 -0
- package/dist/{presentation-types-CDjScsev.d.ts → presentation-types-8jLQHI4M.d.ts} +1070 -683
- package/dist/presentation-types-8jLQHI4M.d.ts.map +1 -0
- package/dist/read.d.ts +9 -9
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +4 -4
- package/dist/script.d.ts +80 -66
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +2399 -1139
- package/dist/script.js.map +1 -1
- package/dist/{shapes-BemroU-z.js → shapes-re0KyQk_.js} +2807 -1609
- package/dist/shapes-re0KyQk_.js.map +1 -0
- package/dist/slide-Dx2ZeVZ6.d.ts +1256 -0
- package/dist/slide-Dx2ZeVZ6.d.ts.map +1 -0
- package/dist/slide-size-BalTjFuv.js +88 -0
- package/dist/slide-size-BalTjFuv.js.map +1 -0
- package/dist/{units-internal-Dg95w_YD.js → table-cell-margins-EVg0EwxT.js} +235 -273
- package/dist/table-cell-margins-EVg0EwxT.js.map +1 -0
- package/dist/table-dom-BTDP3lEP.js +21 -0
- package/dist/table-dom-BTDP3lEP.js.map +1 -0
- package/dist/text-anchor-CrYXAfUu.js +176 -0
- package/dist/text-anchor-CrYXAfUu.js.map +1 -0
- package/dist/text-sN64Otf_.js +3980 -0
- package/dist/text-sN64Otf_.js.map +1 -0
- package/dist/transition-speed-kUEWDWTx.js +14 -0
- package/dist/transition-speed-kUEWDWTx.js.map +1 -0
- package/dist/units-internal-XJlf-hOl.js +649 -0
- package/dist/units-internal-XJlf-hOl.js.map +1 -0
- package/dist/zip-C0leZZMj.d.ts +67 -0
- package/dist/zip-C0leZZMj.d.ts.map +1 -0
- package/dist/zip-CKd8ihcf.js +177 -0
- package/dist/zip-CKd8ihcf.js.map +1 -0
- package/dist/zip.d.ts +3 -68
- package/dist/zip.js +3 -163
- package/dist/zoom-DPUHh85d.js +8865 -0
- package/dist/zoom-DPUHh85d.js.map +1 -0
- package/package.json +106 -19
- package/skills/ts-pptx-upstream/SKILL.md +58 -57
- package/dist/autopage-DkjYZUFD.js +0 -423
- package/dist/autopage-DkjYZUFD.js.map +0 -1
- package/dist/diagnostics-DfBdDHre.d.ts +0 -829
- package/dist/diagnostics-DfBdDHre.d.ts.map +0 -1
- package/dist/errors-Bvln0H-7.js.map +0 -1
- package/dist/errors-PflMPWBn.d.ts +0 -182
- package/dist/errors-PflMPWBn.d.ts.map +0 -1
- package/dist/fit-BKs0zxMI.js.map +0 -1
- package/dist/html-dom-B0I0QSbU.js.map +0 -1
- package/dist/namespaces-BVnNu7sg.js +0 -666
- package/dist/namespaces-BVnNu7sg.js.map +0 -1
- package/dist/notes-CJFJaG6M.js +0 -1724
- package/dist/notes-CJFJaG6M.js.map +0 -1
- package/dist/package-CaOLXSNi.d.ts.map +0 -1
- package/dist/pres-BcBR3CSM.d.ts +0 -202
- package/dist/pres-BcBR3CSM.d.ts.map +0 -1
- package/dist/presentation-DrJtj3-C.js.map +0 -1
- package/dist/presentation-types-CDjScsev.d.ts.map +0 -1
- package/dist/shapes-BemroU-z.js.map +0 -1
- package/dist/slide-ZqAdVvHV.d.ts.map +0 -1
- package/dist/text-B8SLEaZx.js +0 -11327
- package/dist/text-B8SLEaZx.js.map +0 -1
- package/dist/units-1kRzYShk.js +0 -231
- package/dist/units-1kRzYShk.js.map +0 -1
- package/dist/units-internal-Dg95w_YD.js.map +0 -1
- package/dist/zip.d.ts.map +0 -1
- package/dist/zip.js.map +0 -1
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
import { c as PLACEHOLDER_TYPE, d as SHAPE_NAME, g as TextAnchor, i as CHART_NAME, m as SlideObjectType, o as ChartType, t as AlignH } from "./enums-BUKTUB6V.js";
|
|
2
|
+
import { A as TextVertType, Ht as TextPropsOptions, Jt as MediaType, K as ChartErrorBarOptions, Nt as SlideComment, Q as ChartOpts, R as HyperlinkProps, T as Margin, Vt as TextProps, Z as ChartMulti, a as PresentationProps, f as BackgroundOption, i as PresLayout, o as SectionProps, qt as MediaProps, xn as TextShapeType, xt as OptsChartData } from "./pres-C6qgOFAa.js";
|
|
3
|
+
import { O as TableCell, S as AnimationProps, _ as MasterTextStyleProps, a as Slide, i as ObjectOptions, o as SlideLayout, x as SlideNumberProps } from "./slide-Dx2ZeVZ6.js";
|
|
4
|
+
import { t as EmbeddedFont } from "./embedded-fonts-DarT9aoa.js";
|
|
5
|
+
//#region src/types/internal.d.ts
|
|
6
|
+
/** The keys of `T` that are declared optional. */
|
|
7
|
+
type OptionalKeysOf<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? K : never; }[keyof T];
|
|
8
|
+
/**
|
|
9
|
+
* `T`, but every *optional* property may also be spelled as a present `undefined`.
|
|
10
|
+
*
|
|
11
|
+
* Under `exactOptionalPropertyTypes` a `foo?: T` says the key is either absent or holds a `T`.
|
|
12
|
+
* That distinction is real for a bag that is **stored, spread or enumerated** — `{ ...defaults,
|
|
13
|
+
* ...options }` inherits from an absent key and is overridden by a present `undefined` — and
|
|
14
|
+
* those bags keep the strict declaration, with `delete` as their one spelling of absent (the
|
|
15
|
+
* write-side twin of `compact()` in `script/from-read/values.ts`).
|
|
16
|
+
*
|
|
17
|
+
* It is noise for a bag that is only ever **read**: typically a function parameter its call sites
|
|
18
|
+
* assemble inline out of values that may be unset (`{ color: opts.titleColor, … }`), where the
|
|
19
|
+
* reader cannot tell the two states apart in the first place. Those parameters take this instead
|
|
20
|
+
* of forcing every call site to build the object key by key.
|
|
21
|
+
*
|
|
22
|
+
* Required properties are left alone, so this never quietly makes a mandatory field optional.
|
|
23
|
+
*/
|
|
24
|
+
type MaybeUndefined<T> = Omit<T, OptionalKeysOf<T>> & { [K in OptionalKeysOf<T>]?: T[K] | undefined; };
|
|
25
|
+
/**
|
|
26
|
+
* Text options carrying the two members the emitters write onto them.
|
|
27
|
+
*
|
|
28
|
+
* `_bodyProp` is the normalized `a:bodyPr` the definer builds out of the caller's `align`,
|
|
29
|
+
* `valign`, `margin`, `columns`, `textDirection` and `textWarp` — a *derived* shape, not an
|
|
30
|
+
* input, which is what made its presence on the public interface a de-facto API nobody
|
|
31
|
+
* intended. `_lineIdx` is the paragraph index the run emitter stamps while walking an array
|
|
32
|
+
* of runs.
|
|
33
|
+
*/
|
|
34
|
+
interface TextPropsOptionsInternal extends TextPropsOptions {
|
|
35
|
+
_bodyProp?: {
|
|
36
|
+
align?: AlignH;
|
|
37
|
+
/**
|
|
38
|
+
* The resolved `a:bodyPr/@anchor` token. The enum's *values* rather than the enum, so
|
|
39
|
+
* that both spellings of the same three tokens are accepted: the definer writes
|
|
40
|
+
* `TextAnchor.ctr` for its own default, while `resolveTextAnchor` answers with the
|
|
41
|
+
* schema token from the shared `valign` table, which cannot name the enum (it lives in
|
|
42
|
+
* `ooxml/`, which holds no runtime imports).
|
|
43
|
+
*/
|
|
44
|
+
anchor?: `${TextAnchor}`;
|
|
45
|
+
lIns?: number;
|
|
46
|
+
rIns?: number;
|
|
47
|
+
tIns?: number;
|
|
48
|
+
bIns?: number;
|
|
49
|
+
numCol?: number;
|
|
50
|
+
spcCol?: number;
|
|
51
|
+
vert?: TextVertType;
|
|
52
|
+
wrap?: boolean;
|
|
53
|
+
prstTxWarp?: TextShapeType;
|
|
54
|
+
};
|
|
55
|
+
_lineIdx?: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A slide object's options carrying the six members the definers and emitters write onto them.
|
|
59
|
+
*
|
|
60
|
+
* All six are *derived* rather than authored: a placeholder's resolved index and type, the
|
|
61
|
+
* adjust guides and connection-site bindings a connector resolves at serialize time, and the
|
|
62
|
+
* flags recording which image dimension has to be backfilled from the natural pixel size once
|
|
63
|
+
* the bytes have loaded. They were on the public {@link ObjectOptions}, where the two `Cxn`
|
|
64
|
+
* ones in particular read as a supported way to bind a connector -- the supported way is
|
|
65
|
+
* `startShape`/`startShapeIdx`.
|
|
66
|
+
*/
|
|
67
|
+
interface ObjectOptionsInternal extends ObjectOptions, TextPropsOptionsInternal {
|
|
68
|
+
_placeholderIdx?: number;
|
|
69
|
+
_placeholderType?: PLACEHOLDER_TYPE;
|
|
70
|
+
/** Connector adjust-guide values (OOXML 1000ths-of-a-percent), one per bend; emitted as `<a:gd name="adjN">` */
|
|
71
|
+
_connectorAdj?: number[];
|
|
72
|
+
/** Connector start-point binding: target shape `objectName` (raw, as the caller spelled it) + connection-site index; resolved to `<a:stCxn>` at serialize time */
|
|
73
|
+
_startCxn?: {
|
|
74
|
+
name: string;
|
|
75
|
+
idx: number;
|
|
76
|
+
};
|
|
77
|
+
/** Connector end-point binding: target shape `objectName` (raw, as the caller spelled it) + connection-site index; resolved to `<a:endCxn>` at serialize time */
|
|
78
|
+
_endCxn?: {
|
|
79
|
+
name: string;
|
|
80
|
+
idx: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Image: which dimensions were omitted by the user and should be derived from the image's
|
|
84
|
+
* natural pixel size at serialize time. Path-based images can't be measured synchronously in
|
|
85
|
+
* `addImage()` (bytes are loaded async during export), so the missing extent is backfilled
|
|
86
|
+
* once `_relsMedia[].data` is populated. `{ w, h }` true means "derive this side from the
|
|
87
|
+
* natural ratio". Base64 `data` images are measured eagerly in `addImage()` and never set this.
|
|
88
|
+
*/
|
|
89
|
+
_szAuto?: {
|
|
90
|
+
w: boolean;
|
|
91
|
+
h: boolean;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* One error bar as `addChartDefinition` vetted it: the three enumerations checked, `value` finite,
|
|
96
|
+
* and the width, stated as `width` or the deprecated `size`, converted to EMU and clamped into
|
|
97
|
+
* `ST_LineWidth`. The emitter writes what it reads.
|
|
98
|
+
*/
|
|
99
|
+
interface ChartErrorBarInternal extends Omit<ChartErrorBarOptions, 'width' | 'size'> {
|
|
100
|
+
widthEmu?: number;
|
|
101
|
+
}
|
|
102
|
+
interface OptsChartDataInternal extends OptsChartData {
|
|
103
|
+
labels?: string[][];
|
|
104
|
+
/** Always an array here, whichever of the two shapes the caller passed. */
|
|
105
|
+
errorBars?: ChartErrorBarInternal[];
|
|
106
|
+
/** Series index; always assigned by addChartDefinition() before this internal shape is built. */
|
|
107
|
+
_dataIndex: number;
|
|
108
|
+
}
|
|
109
|
+
interface ChartOptsInternal extends ChartOpts {
|
|
110
|
+
_type?: ChartType | ChartMultiInternal[];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A combo subchart's option overrides after `addChartDefinition` vetted them — the one bag in the
|
|
114
|
+
* generator where a key may be *present* and hold `undefined`.
|
|
115
|
+
*
|
|
116
|
+
* Everywhere else "unset" has exactly one spelling, an absent key: `compact()` enforces it on the
|
|
117
|
+
* read side (`script/from-read/values.ts`) and the `delete` idiom does on the write side
|
|
118
|
+
* (`gen/define/chart.ts`). This bag needs the third state because it is merged *over* the
|
|
119
|
+
* chart-level options at emit time (`{ ...rel.opts, ...type.options }` in `gen/chart/chart-xml.ts`),
|
|
120
|
+
* where a present `undefined` suppresses the chart-level value and an absent key inherits it.
|
|
121
|
+
* Suppressing is the intent: the subchart supplied an override the schema rejects, and the
|
|
122
|
+
* chart-level value is one it never asked for — inheriting it would be a different chart than
|
|
123
|
+
* either party described. For a combo chart the chart-level pass cannot vet these itself, since
|
|
124
|
+
* `_type` is an array there and every type-keyed correction matches no branch.
|
|
125
|
+
*/
|
|
126
|
+
type ChartOptsOverrides = MaybeUndefined<ChartOptsInternal>;
|
|
127
|
+
/**
|
|
128
|
+
* One subchart of a combo chart, as `addChartDefinition` rebuilt it: series normalized onto
|
|
129
|
+
* {@link OptsChartDataInternal} and options narrowed to the vetted {@link ChartOptsOverrides}.
|
|
130
|
+
* `ChartOptsInternal._type` holds these, never the caller's own {@link ChartMulti} objects.
|
|
131
|
+
*/
|
|
132
|
+
interface ChartMultiInternal extends Omit<ChartMulti, 'data' | 'options'> {
|
|
133
|
+
data: OptsChartDataInternal[];
|
|
134
|
+
options: ChartOptsOverrides;
|
|
135
|
+
}
|
|
136
|
+
interface SlideRelChart extends OptsChartData {
|
|
137
|
+
type: CHART_NAME | ChartMultiInternal[];
|
|
138
|
+
opts: ChartOptsInternal;
|
|
139
|
+
data: OptsChartDataInternal[];
|
|
140
|
+
rId: number;
|
|
141
|
+
Target: string;
|
|
142
|
+
globalId: number;
|
|
143
|
+
fileName: string;
|
|
144
|
+
/**
|
|
145
|
+
* True when `type` is a chartEx (cx:) chart (e.g. waterfall): the part is emitted as
|
|
146
|
+
* `chartEx{globalId}.xml` in the chart-extension namespace, gets the `chartex+xml` content
|
|
147
|
+
* type and the MS `.../2014/relationships/chartEx` rel type, and is referenced from the slide
|
|
148
|
+
* via `<mc:AlternateContent>`. Set at define time from {@link isChartExType}.
|
|
149
|
+
*/
|
|
150
|
+
isChartEx?: boolean;
|
|
151
|
+
}
|
|
152
|
+
interface SlideRel {
|
|
153
|
+
type: SlideObjectType;
|
|
154
|
+
/**
|
|
155
|
+
* Relationship target, stored **unescaped**. Every emitter escapes it on the way out
|
|
156
|
+
* (`gen/slide/object.ts`, `gen/slide/notes.ts`, and `read/opc/relationships.ts` for the
|
|
157
|
+
* append path). Escaping at definition time instead would double-escape on append,
|
|
158
|
+
* where the serializer escapes again — so `&` in a hyperlink or online-video URL must
|
|
159
|
+
* arrive here verbatim.
|
|
160
|
+
*/
|
|
161
|
+
Target: string;
|
|
162
|
+
fileName?: string;
|
|
163
|
+
data: any[] | string;
|
|
164
|
+
opts?: ChartOpts;
|
|
165
|
+
path?: string;
|
|
166
|
+
extn?: string;
|
|
167
|
+
globalId?: number;
|
|
168
|
+
rId: number;
|
|
169
|
+
}
|
|
170
|
+
interface SlideRelMedia {
|
|
171
|
+
type: string;
|
|
172
|
+
opts?: MediaProps;
|
|
173
|
+
path?: string;
|
|
174
|
+
extn?: string;
|
|
175
|
+
data?: string | ArrayBuffer;
|
|
176
|
+
/**
|
|
177
|
+
* An `addMedia` poster frame the caller supplied no `cover` for, so it takes the library's
|
|
178
|
+
* default play-button artwork. `addMediaDefinition` pushes the rel with this flag and no
|
|
179
|
+
* `data`; `encodeSlideMediaRels` fills the bytes in during the async media pass, behind the
|
|
180
|
+
* dynamic import that keeps the artwork out of every consumer's entry chunk. Every rel
|
|
181
|
+
* carrying it has its `data` resolved before any part is emitted.
|
|
182
|
+
*/
|
|
183
|
+
isDefaultCover?: boolean;
|
|
184
|
+
/** used to indicate that a media file has already been read/enocded (PERF) */
|
|
185
|
+
isDuplicate?: boolean;
|
|
186
|
+
isSvgPng?: boolean;
|
|
187
|
+
svgSize?: {
|
|
188
|
+
w: number;
|
|
189
|
+
h: number;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Embedded OLE object part (`addOleObject`): the `.rels` `Type` URI to emit — `.../package` for
|
|
193
|
+
* an embedded OPC package (xlsx/docx/pptx, themselves zips) or `.../oleObject` for a generic OLE
|
|
194
|
+
* server blob (ECMA-376 Part 1 §15.2.10). Present only on OLE payload rels, where it takes
|
|
195
|
+
* precedence over the image/audio/video branch in `slideObjectRelationsToXml` and `type` carries
|
|
196
|
+
* the part's content type verbatim for `[Content_Types].xml`. The object's preview picture is a
|
|
197
|
+
* separate, perfectly ordinary image rel.
|
|
198
|
+
*/
|
|
199
|
+
oleRelType?: string;
|
|
200
|
+
/**
|
|
201
|
+
* Embedded 3D model part (`addModel3d`): the `.rels` `Type` URI to emit — the Microsoft
|
|
202
|
+
* `…/office/2017/06/relationships/model3d` type, which no `includes('image'|'audio'|'video')`
|
|
203
|
+
* sniff would ever reach. Present only on the `.glb` payload rel, where it takes precedence
|
|
204
|
+
* over the image/audio/video branch in `slideObjectRelationsToXml` and `type` carries the
|
|
205
|
+
* part's content type verbatim for `[Content_Types].xml`. The model's preview picture is a
|
|
206
|
+
* separate, perfectly ordinary image rel. Same escape hatch as {@link oleRelType}.
|
|
207
|
+
*/
|
|
208
|
+
model3dRelType?: string;
|
|
209
|
+
rId: number;
|
|
210
|
+
/** Unescaped — see {@link SlideRel.Target}. Doubles as the zip entry name for embedded media. */
|
|
211
|
+
Target: string;
|
|
212
|
+
}
|
|
213
|
+
interface SlideObject {
|
|
214
|
+
_type: SlideObjectType;
|
|
215
|
+
options?: ObjectOptionsInternal;
|
|
216
|
+
text?: TextProps[];
|
|
217
|
+
arrTabRows?: TableCell[][];
|
|
218
|
+
chartRid?: number;
|
|
219
|
+
image?: string;
|
|
220
|
+
imageRid?: number;
|
|
221
|
+
hyperlink?: HyperlinkProps;
|
|
222
|
+
media?: string;
|
|
223
|
+
mtype?: MediaType;
|
|
224
|
+
mediaRid?: number;
|
|
225
|
+
loop?: boolean;
|
|
226
|
+
loopCount?: number;
|
|
227
|
+
shape?: SHAPE_NAME;
|
|
228
|
+
_groupObjects?: SlideObject[];
|
|
229
|
+
zoom?: ZoomInternal;
|
|
230
|
+
ole?: OleInternal;
|
|
231
|
+
model3d?: Model3dInternal;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Resolved 3D-model payload carried on a {@link SlideObject} until `gen/slide/objects/model3d.ts`
|
|
235
|
+
* emits it. Camera values are already in `am3d`'s wire units so the emitter does no arithmetic:
|
|
236
|
+
* positions in 1/36,000,000ths of a metre, `fov` in 60000ths of a degree, and
|
|
237
|
+
* `meterPerModelUnitN` over a fixed denominator of 1,000,000.
|
|
238
|
+
*/
|
|
239
|
+
interface Model3dInternal {
|
|
240
|
+
/** rId of the embedded `.glb` part rel (see {@link SlideRelMedia.model3dRelType}). */
|
|
241
|
+
modelRid: number;
|
|
242
|
+
/** rId of the preview picture's image rel — shared by `am3d:blip` and the `mc:Fallback` `p:pic`. */
|
|
243
|
+
previewRid: number;
|
|
244
|
+
/** `am3d:camera/am3d:pos` (`@x`/`@y`/`@z`). */
|
|
245
|
+
pos: {
|
|
246
|
+
x: number;
|
|
247
|
+
y: number;
|
|
248
|
+
z: number;
|
|
249
|
+
};
|
|
250
|
+
/** `am3d:camera/am3d:lookAt` (`@x`/`@y`/`@z`). */
|
|
251
|
+
lookAt: {
|
|
252
|
+
x: number;
|
|
253
|
+
y: number;
|
|
254
|
+
z: number;
|
|
255
|
+
};
|
|
256
|
+
/** `am3d:camera/am3d:up` (`@dx`/`@dy`/`@dz`). */
|
|
257
|
+
up: {
|
|
258
|
+
dx: number;
|
|
259
|
+
dy: number;
|
|
260
|
+
dz: number;
|
|
261
|
+
};
|
|
262
|
+
/** `am3d:perspective@fov`, in 60000ths of a degree. */
|
|
263
|
+
fov: number;
|
|
264
|
+
/** `am3d:meterPerModelUnit@n`; `@d` is always 1,000,000. */
|
|
265
|
+
meterPerModelUnitN: number;
|
|
266
|
+
}
|
|
267
|
+
/** Resolved OLE payload carried on a {@link SlideObject} until `gen/slide/objects/ole.ts` emits it. */
|
|
268
|
+
interface OleInternal {
|
|
269
|
+
/** rId of the embedded object part rel (see {@link SlideRelMedia.oleRelType}). */
|
|
270
|
+
objectRid: number;
|
|
271
|
+
/** rId of the preview picture's image rel (`p:pic > a:blip@r:embed`). */
|
|
272
|
+
previewRid: number;
|
|
273
|
+
/** `p:oleObj@progId` — the OLE server PowerPoint launches on double-click. */
|
|
274
|
+
progId: string;
|
|
275
|
+
/** `p:oleObj@name` — the object's kind as PowerPoint labels it (`Worksheet`, `Document`, …). */
|
|
276
|
+
name: string;
|
|
277
|
+
/** `p:oleObj@showAsIcon`; omitted when false, matching PowerPoint. */
|
|
278
|
+
showAsIcon: boolean;
|
|
279
|
+
/** `p:oleObj@imgW`/`@imgH` (EMU). Undefined means "use the frame's own extent". */
|
|
280
|
+
imgW?: number;
|
|
281
|
+
imgH?: number;
|
|
282
|
+
}
|
|
283
|
+
/** One tile inside a zoom object (a Slide/Section Zoom has one; a Summary Zoom has N). */
|
|
284
|
+
interface ZoomTileInternal {
|
|
285
|
+
/** Slide Zoom: target slide id (= `PresSlideInternal._slideId`, emitted as `sldZmObj@sldId`). */
|
|
286
|
+
sldId?: number;
|
|
287
|
+
/** Section/Summary Zoom: target section GUID (`{...}`, emitted as `sectionZmObj@sectionId`). */
|
|
288
|
+
sectionId?: string;
|
|
289
|
+
/** rId of the preview/cover image blip (`zmPr>blipFill>a:blip@r:embed`). Shared across tiles when identical. */
|
|
290
|
+
previewRid: number;
|
|
291
|
+
/** rId of the `.../slide` rel used by the `mc:Fallback` picture's `hlinkClick` (target/section-start slide). */
|
|
292
|
+
fallbackSlideRid: number;
|
|
293
|
+
/** Per-tile `zmPr@id` GUID (`{...}`). */
|
|
294
|
+
zmPrId: string;
|
|
295
|
+
/** Summary Zoom only: this tile's grid cell within the graphic-frame coordinate space (EMU). */
|
|
296
|
+
grid?: {
|
|
297
|
+
x: number;
|
|
298
|
+
y: number;
|
|
299
|
+
cx: number;
|
|
300
|
+
cy: number;
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
/** Resolved zoom payload carried on a {@link SlideObject} until `gen/slide/objects/zoom.ts` emits it. */
|
|
304
|
+
interface ZoomInternal {
|
|
305
|
+
variant: 'slide' | 'section' | 'summary';
|
|
306
|
+
tiles: ZoomTileInternal[];
|
|
307
|
+
/** `zmPr@returnToParent`; emitted as `"0"`/`"1"` for Slide Zoom, omitted for Section/Summary. */
|
|
308
|
+
returnToParent: boolean;
|
|
309
|
+
/** `zmPr@transitionDur` (ms). */
|
|
310
|
+
transitionDur: number;
|
|
311
|
+
}
|
|
312
|
+
interface SlideBaseProps {
|
|
313
|
+
_bkgdImgRid?: number;
|
|
314
|
+
_margin?: Margin;
|
|
315
|
+
_name?: string;
|
|
316
|
+
_presLayout: PresLayout;
|
|
317
|
+
_rels: SlideRel[];
|
|
318
|
+
_relsChart: SlideRelChart[];
|
|
319
|
+
_relsMedia: SlideRelMedia[];
|
|
320
|
+
_comments?: SlideComment[];
|
|
321
|
+
_txStyles?: MasterTextStyleProps;
|
|
322
|
+
_slideNum: number;
|
|
323
|
+
_slideNumberProps?: SlideNumberProps | null;
|
|
324
|
+
_slideObjects: SlideObject[];
|
|
325
|
+
/**
|
|
326
|
+
* Per-kind counters backing default Selection Pane names (`Shape 1`, `Image 1`, `Group 1`, …),
|
|
327
|
+
* keyed by `SlideObjectType`. Monotonic for the life of the slide: an object consumes its index
|
|
328
|
+
* when it is added, whether it stays top-level or is moved into a group's `_groupObjects`.
|
|
329
|
+
* Lazily created by `nextObjectNameIdx` (`gen/define/object-name.ts`).
|
|
330
|
+
*/
|
|
331
|
+
_objectNameCounts?: Partial<Record<SlideObjectType, number>>;
|
|
332
|
+
/**
|
|
333
|
+
* `| undefined` for the same reason {@link Slide.background} carries it: `SlideBuilder`
|
|
334
|
+
* implements this as an accessor pair, so it is always *present* on a real slide or layout and
|
|
335
|
+
* answers `undefined` when none is set. The `_`-prefixed members above are plain fields and
|
|
336
|
+
* keep the strict form.
|
|
337
|
+
*/
|
|
338
|
+
background?: BackgroundOption | undefined;
|
|
339
|
+
}
|
|
340
|
+
interface SlideLayoutInternal extends SlideBaseProps, SlideLayout {
|
|
341
|
+
_slide?: {
|
|
342
|
+
_bkgdImgRid?: number;
|
|
343
|
+
back: string;
|
|
344
|
+
color: string;
|
|
345
|
+
hidden?: boolean;
|
|
346
|
+
} | null;
|
|
347
|
+
}
|
|
348
|
+
interface PresSlideInternal extends SlideBaseProps, Slide {
|
|
349
|
+
_rId: number;
|
|
350
|
+
_slideLayout: SlideLayoutInternal | null;
|
|
351
|
+
_slideId: number;
|
|
352
|
+
/** Preset build animations on this slide, in play order (see {@link Slide.addAnimation}). */
|
|
353
|
+
_animations: AnimationProps[];
|
|
354
|
+
}
|
|
355
|
+
interface SectionInternalProps extends SectionProps {
|
|
356
|
+
_type?: 'user' | 'default';
|
|
357
|
+
_slides: PresSlideInternal[];
|
|
358
|
+
/** Stable section GUID (`{XXXXXXXX-...}`), assigned at section creation so Section/Summary Zoom can address it. */
|
|
359
|
+
_id: string;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* The deck's slide master as the writer holds it: the relationships, objects and deck-wide settings
|
|
363
|
+
* `slideMaster1.xml` is written from. It is not a {@link Slide}. Nothing is authored onto it, so it
|
|
364
|
+
* has none of a slide's methods, and it has no slide number: `_slideNum` is `null`, which is how
|
|
365
|
+
* media registration tells it from a slide or a layout.
|
|
366
|
+
*/
|
|
367
|
+
interface SlideMasterInternal extends Omit<SlideBaseProps, '_slideNum'> {
|
|
368
|
+
_slideNum: null;
|
|
369
|
+
}
|
|
370
|
+
interface PresentationPropsInternal extends PresentationProps {
|
|
371
|
+
masterSlide: SlideMasterInternal;
|
|
372
|
+
sections: SectionInternalProps[];
|
|
373
|
+
slideLayouts: SlideLayoutInternal[];
|
|
374
|
+
slides: PresSlideInternal[];
|
|
375
|
+
/** Author-side embedded fonts (see {@link TsPptx.embedFont}); empty when none. */
|
|
376
|
+
embeddedFonts: EmbeddedFont[];
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/measure/text-fit.d.ts
|
|
380
|
+
/**
|
|
381
|
+
* PowerPoint single-spacing line pitch as a multiple of font size.
|
|
382
|
+
*
|
|
383
|
+
* Calibrated from `autofit-calibration.json` (Deck 1, `autofit-line-metrics`):
|
|
384
|
+
* the per-line `cy` delta is a **font-independent** 1.2117× at 12/18/32 pt across
|
|
385
|
+
* {Aptos, Aptos SemiBold, Calibri, Tahoma, Arial}, and PowerPoint vs LibreOffice
|
|
386
|
+
* agree to ≤ 0.041 pt. See "Findings behind the constants" in
|
|
387
|
+
* `docs/contributing/design/text-fit.md`.
|
|
388
|
+
*/
|
|
389
|
+
declare const SINGLE_LINE_PITCH = 1.2117;
|
|
390
|
+
/** PowerPoint's `fontScale` search grid: discrete 2.5% steps (`docs/contributing/design/text-fit.md`). */
|
|
391
|
+
declare const FONT_SCALE_STEP_PCT = 2.5;
|
|
392
|
+
/** Floor for the shrink search (see `docs/contributing/design/text-fit.md` → Wrap simulator and solvers). */
|
|
393
|
+
declare const MIN_FONT_SCALE_PCT = 25;
|
|
394
|
+
/**
|
|
395
|
+
* Conservative safety factors applied by the shrink solver (not by the pure
|
|
396
|
+
* `measureHeightPt`). Raw `hmtx` advances summed without shaping still pack a line
|
|
397
|
+
* a little tighter than PowerPoint, which lays text out at a device DPI and rounds
|
|
398
|
+
* each glyph advance up — so PowerPoint wraps marginally earlier and its fitted
|
|
399
|
+
* box is marginally taller. Inflating measured width and height by these factors
|
|
400
|
+
* makes the computed `fontScale` ≤ PowerPoint's across the calibration oracle
|
|
401
|
+
* (`test/read/autofit-calibration-oracle.test.js`: 0 violations over the Aptos
|
|
402
|
+
* cases). They err on the side of shrinking slightly too much, never overflowing.
|
|
403
|
+
*/
|
|
404
|
+
declare const WIDTH_SAFETY_FACTOR = 1.03;
|
|
405
|
+
declare const HEIGHT_SAFETY_FACTOR = 1.04;
|
|
406
|
+
/** One text run with the inputs measurement needs. */
|
|
407
|
+
interface FitRun {
|
|
408
|
+
text: string;
|
|
409
|
+
sizePt: number;
|
|
410
|
+
bold?: boolean;
|
|
411
|
+
italic?: boolean;
|
|
412
|
+
fontFace?: string | undefined;
|
|
413
|
+
/** Character spacing in points (PowerPoint `spc`/1200). */
|
|
414
|
+
charSpacingPt?: number | undefined;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* One paragraph: its runs plus vertical-rhythm options.
|
|
418
|
+
*
|
|
419
|
+
* The three `| undefined` members here are deliberate, and the exception to the rule the
|
|
420
|
+
* generator's option bags follow (`options-internal.ts`): these are measurement records, built in
|
|
421
|
+
* one place by `paragraphs.ts` and read in one place by the solver below, with `??` and
|
|
422
|
+
* truthiness. Nothing spreads or enumerates them, so a key holding `undefined` cannot mean
|
|
423
|
+
* anything different from an absent one — and the builder does produce every key on every run.
|
|
424
|
+
* Saying so is more honest than making the builder omit keys nothing distinguishes.
|
|
425
|
+
*/
|
|
426
|
+
interface FitParagraph {
|
|
427
|
+
runs: FitRun[];
|
|
428
|
+
/** Line spacing as a percent of single (100 = single). Ignored if `lineSpacingPts` set. */
|
|
429
|
+
lineSpacingPct?: number;
|
|
430
|
+
/** Exact line spacing in points (overrides `lineSpacingPct`). */
|
|
431
|
+
lineSpacingPts?: number | undefined;
|
|
432
|
+
spaceBeforePts?: number;
|
|
433
|
+
spaceAfterPts?: number;
|
|
434
|
+
}
|
|
435
|
+
/** Inner box (shape minus insets) the text must fit, in points. */
|
|
436
|
+
interface FitBox {
|
|
437
|
+
innerWidthPt: number;
|
|
438
|
+
innerHeightPt: number;
|
|
439
|
+
/**
|
|
440
|
+
* `false` when the frame does not wrap (`wrap:false` / `wrap="none"`): text lays
|
|
441
|
+
* out as one line per paragraph (no width-wrapping), and the shrink solver must
|
|
442
|
+
* additionally keep the widest line within `innerWidthPt`. A too-wide line
|
|
443
|
+
* overflows HORIZONTALLY — `normAutofit`'s vertical shrink never catches it, so
|
|
444
|
+
* without this check a non-wrapping line is never shrunk and spills out of the box
|
|
445
|
+
* in PowerPoint. Defaults to wrapping (`true`), so table cells and `measureText`
|
|
446
|
+
* are unaffected.
|
|
447
|
+
*/
|
|
448
|
+
wrap?: boolean;
|
|
449
|
+
}
|
|
450
|
+
/** Resolve the metrics for a run, or `undefined` if the face is not registered. */
|
|
451
|
+
type MetricsResolver = (run: FitRun) => FontMetrics | undefined;
|
|
452
|
+
interface ShrinkResult {
|
|
453
|
+
fontScalePct: number;
|
|
454
|
+
lnSpcReductionPct: number;
|
|
455
|
+
}
|
|
456
|
+
type ShrinkOutcome = {
|
|
457
|
+
kind: 'fits';
|
|
458
|
+
} | {
|
|
459
|
+
kind: 'unmeasurable';
|
|
460
|
+
} | {
|
|
461
|
+
kind: 'shrink';
|
|
462
|
+
result: ShrinkResult;
|
|
463
|
+
};
|
|
464
|
+
/** Laid-out result of {@link measureLayout}: total height (points) + wrapped line count. */
|
|
465
|
+
interface LayoutResult {
|
|
466
|
+
heightPt: number;
|
|
467
|
+
lineCount: number;
|
|
468
|
+
/**
|
|
469
|
+
* Width (points) of the widest laid-out line across all paragraphs. Useful for
|
|
470
|
+
* tightening a box to the actual text extent or measuring a natural (single-line)
|
|
471
|
+
* width. Carries the same `widthSafety` inflation as the wrap decision, so a box
|
|
472
|
+
* set to this width will not re-wrap. Conservative (slightly wide).
|
|
473
|
+
*/
|
|
474
|
+
widestLineWidthPt: number;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Lay out `paragraphs` at a given scale/reduction and return the total height
|
|
478
|
+
* (points) and wrapped line count, or `null` if any paragraph is unmeasurable.
|
|
479
|
+
* Errs tall (conservative): includes space-before/after and the calibrated line
|
|
480
|
+
* pitch. The single source of truth for both {@link measureHeightPt} (the solvers)
|
|
481
|
+
* and the public layout-time measure API.
|
|
482
|
+
*/
|
|
483
|
+
declare function measureLayout(paragraphs: FitParagraph[], innerWidthPt: number, resolve: MetricsResolver, fontScalePct: number, lnSpcReductionPct: number, widthSafety?: number): LayoutResult | null;
|
|
484
|
+
/**
|
|
485
|
+
* Total laid-out height (points) at a given scale/reduction, or `null` if any
|
|
486
|
+
* paragraph is unmeasurable. Thin wrapper over {@link measureLayout}.
|
|
487
|
+
*/
|
|
488
|
+
declare function measureHeightPt(paragraphs: FitParagraph[], innerWidthPt: number, resolve: MetricsResolver, fontScalePct: number, lnSpcReductionPct: number, widthSafety?: number): number | null;
|
|
489
|
+
/** What the resize solver concluded: it could not measure, or the inner height the text needs. */
|
|
490
|
+
type ResizeOutcome = {
|
|
491
|
+
kind: 'unmeasurable';
|
|
492
|
+
} | {
|
|
493
|
+
kind: 'resize';
|
|
494
|
+
neededInnerHeightPt: number;
|
|
495
|
+
};
|
|
496
|
+
/**
|
|
497
|
+
* Inner height (points) the text needs at full size — the value to bake into the
|
|
498
|
+
* shape's `a:ext/@cy` for `fit: 'resize'` (`spAutoFit`). Unlike shrink, resize has
|
|
499
|
+
* **no safety net**: an under-estimate overflows (there is no text scaling
|
|
500
|
+
* fallback), so this errs **tall** — width is inflated (earlier wrap ⇒ more lines)
|
|
501
|
+
* and the laid-out height by the calibrated height factor, so the computed `cy` is
|
|
502
|
+
* ≥ PowerPoint's and ≥ the LibreOffice-rendered height across the resize oracle.
|
|
503
|
+
*/
|
|
504
|
+
declare function solveResize(paragraphs: FitParagraph[], box: FitBox, resolve: MetricsResolver): ResizeOutcome;
|
|
505
|
+
/**
|
|
506
|
+
* Largest `fontScale` (on PowerPoint's 2.5% grid) at which the text fits the box.
|
|
507
|
+
* Width and height both re-measured per scale. Conservative: because the model
|
|
508
|
+
* over-estimates, the returned scale is ≤ PowerPoint's and the text never overflows.
|
|
509
|
+
*
|
|
510
|
+
* `lnSpcReduction` is left at 0 — dropping `fontScale` alone is provably
|
|
511
|
+
* conservative (PowerPoint trades line-spacing reduction to keep the font *larger*,
|
|
512
|
+
* so a reduction-free fit is always ≤ PowerPoint's scale). The reduction ramp
|
|
513
|
+
* PowerPoint applies is recorded in `docs/contributing/design/text-fit.md`.
|
|
514
|
+
*/
|
|
515
|
+
declare function solveShrink(paragraphs: FitParagraph[], box: FitBox, resolve: MetricsResolver): ShrinkOutcome;
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/measure/font-metrics.d.ts
|
|
518
|
+
/** Per-(face,bold,italic) advance-width source backed by a parsed font file. */
|
|
519
|
+
interface FontMetrics {
|
|
520
|
+
/** Font design units per em (advances are in these units). */
|
|
521
|
+
readonly unitsPerEm: number;
|
|
522
|
+
/**
|
|
523
|
+
* Advance width of `text` at `sizePt`, in points. Sums raw glyph advances
|
|
524
|
+
* (no kerning) and adds `charSpacingPt` after every character, matching how
|
|
525
|
+
* PowerPoint widens runs with character spacing.
|
|
526
|
+
*/
|
|
527
|
+
advanceWidthPt: (text: string, sizePt: number, charSpacingPt?: number) => number;
|
|
528
|
+
/**
|
|
529
|
+
* True if this face's cmap maps code point `cp` to a real glyph (not the
|
|
530
|
+
* `.notdef` fallback). Use it to flag source code points the face cannot
|
|
531
|
+
* render. Authoritative only for file-backed metrics; the unregistered-font
|
|
532
|
+
* heuristic has no cmap and reports every code point as covered.
|
|
533
|
+
*/
|
|
534
|
+
hasCodepoint: (cp: number) => boolean;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Shared, font-independent `FontMetrics` used when a named face has no registered
|
|
538
|
+
* metrics but the deck has opted into measured fit (some other face is registered).
|
|
539
|
+
* Approximate but conservative — see `heuristicCharRatio`. A deck with no
|
|
540
|
+
* registered metrics at all does not engage measured fit, so this never fires there.
|
|
541
|
+
*/
|
|
542
|
+
declare function getHeuristicFontMetrics(): FontMetrics;
|
|
543
|
+
/** Options for {@link parseFontMetrics}. */
|
|
544
|
+
interface ParseFontMetricsOptions {
|
|
545
|
+
/**
|
|
546
|
+
* Which font to read out of a file that holds several: a 0-based index, or a name
|
|
547
|
+
* matched case-insensitively against the family, full, and PostScript names
|
|
548
|
+
* (`listFontFaces` lists them). Omitted selects the first.
|
|
549
|
+
*
|
|
550
|
+
* Collections (`.ttc`/`.otc`) are why this exists: `msgothic.ttc` is three fonts and
|
|
551
|
+
* `cambria.ttc` is two. The selector means the same thing for a plain TTF/OTF, which
|
|
552
|
+
* is a one-entry list, so a wrong index or an unmatched name is an error there rather
|
|
553
|
+
* than being ignored.
|
|
554
|
+
*/
|
|
555
|
+
readonly font?: number | string;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Parse a font file into a `FontMetrics`. Lazily imports opentype.js.
|
|
559
|
+
*
|
|
560
|
+
* Reads plain TTF/OTF and **font collections** (`.ttc`/`.otc`); for a collection, pass
|
|
561
|
+
* `font` to say which member, since a collection has no single answer. The underlying
|
|
562
|
+
* parser does not read the `ttcf` wrapper, so the selected member is unwrapped into a
|
|
563
|
+
* standalone sfnt first (see `measure/font-collection.ts`).
|
|
564
|
+
* @param {Uint8Array} data - the font file's bytes
|
|
565
|
+
* @param {ParseFontMetricsOptions} [opts] - which font, for a file holding several
|
|
566
|
+
* @returns {Promise<FontMetrics>} advance widths and cmap coverage for that font
|
|
567
|
+
* @example await parseFontMetrics(bytes) // a plain .ttf
|
|
568
|
+
* @example await parseFontMetrics(ttcBytes, { font: 'MS PGothic' })
|
|
569
|
+
*/
|
|
570
|
+
declare function parseFontMetrics(data: Uint8Array, opts?: ParseFontMetricsOptions): Promise<FontMetrics>;
|
|
571
|
+
/**
|
|
572
|
+
* Registry of `FontMetrics` keyed by `(face, bold, italic)`. Variant advances
|
|
573
|
+
* differ, so bold/italic are stored separately; lookup falls back to the regular
|
|
574
|
+
* variant (then any registered variant of the face) so a deck that only registers
|
|
575
|
+
* the regular weight still measures bold runs approximately rather than not at all.
|
|
576
|
+
*/
|
|
577
|
+
declare class FontMetricsRegistry {
|
|
578
|
+
private readonly map;
|
|
579
|
+
private key;
|
|
580
|
+
set(face: string, metrics: FontMetrics, opts?: {
|
|
581
|
+
bold?: boolean;
|
|
582
|
+
italic?: boolean;
|
|
583
|
+
}): void;
|
|
584
|
+
/** True if any variant of `face` has registered metrics. */
|
|
585
|
+
hasFace(face: string): boolean;
|
|
586
|
+
/**
|
|
587
|
+
* Coverage of code point `cp` for `face`, read from the registered font's cmap:
|
|
588
|
+
* `true`/`false` when a variant of `face` is registered (see {@link get} for the
|
|
589
|
+
* exact→regular→any-variant fallback), or `undefined` when the face has **no**
|
|
590
|
+
* registered metrics — "unknown", deliberately distinct from a `false`
|
|
591
|
+
* "registered but not covered". A coverage audit must not treat an unregistered
|
|
592
|
+
* face as fully covered, so callers get `undefined` here rather than the per-face
|
|
593
|
+
* {@link FontMetrics.hasCodepoint} boolean (which, for the heuristic fallback,
|
|
594
|
+
* always reports covered). Register the face via {@link parseFontMetrics} +
|
|
595
|
+
* {@link set} first.
|
|
596
|
+
*/
|
|
597
|
+
hasCodepoint(face: string | undefined | null, cp: number, opts?: {
|
|
598
|
+
bold?: boolean;
|
|
599
|
+
italic?: boolean;
|
|
600
|
+
}): boolean | undefined;
|
|
601
|
+
/** Resolve metrics for a run, falling back from exact variant → regular → any variant. */
|
|
602
|
+
get(face: string | undefined | null, bold?: boolean, italic?: boolean): FontMetrics | undefined;
|
|
603
|
+
get size(): number;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* A {@link MetricsResolver} backed by a registry: exact metrics for a registered face, otherwise
|
|
607
|
+
* the shared heuristic fallback (with `onHeuristic` told which face it stood in for). A run with
|
|
608
|
+
* no `fontFace` at all resolves to `undefined`, which the callers treat as unmeasurable.
|
|
609
|
+
*/
|
|
610
|
+
declare function makeRegistryResolver(registry: FontMetricsRegistry, onHeuristic?: (face: string) => void): MetricsResolver;
|
|
611
|
+
//#endregion
|
|
612
|
+
export { SlideObject as A, solveShrink as C, SectionInternalProps as D, PresentationPropsInternal as E, SlideRelChart as M, SlideRelMedia as N, SlideLayoutInternal as O, solveResize as S, PresSlideInternal as T, ShrinkOutcome as _, makeRegistryResolver as a, measureHeightPt as b, FitBox as c, HEIGHT_SAFETY_FACTOR as d, LayoutResult as f, SINGLE_LINE_PITCH as g, ResizeOutcome as h, getHeuristicFontMetrics as i, SlideRel as j, SlideMasterInternal as k, FitParagraph as l, MetricsResolver as m, FontMetricsRegistry as n, parseFontMetrics as o, MIN_FONT_SCALE_PCT as p, ParseFontMetricsOptions as r, FONT_SCALE_STEP_PCT as s, FontMetrics as t, FitRun as u, ShrinkResult as v, ObjectOptionsInternal as w, measureLayout as x, WIDTH_SAFETY_FACTOR as y };
|
|
613
|
+
//# sourceMappingURL=font-metrics-v5fn7s7e.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-metrics-v5fn7s7e.d.ts","names":[],"sources":["../src/types/internal.ts","../src/measure/text-fit.ts","../src/measure/font-metrics.ts"],"mappings":"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"}
|