@openpresentation/opf 0.11.4 → 0.12.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 +16 -0
- package/dist/audit.d.ts +156 -0
- package/dist/audit.js +7 -0
- package/dist/{catalogs-CUClB3nl.d.ts → catalogs-u6TEeMcz.d.ts} +1 -1
- package/dist/catalogs.d.ts +2 -2
- package/dist/catalogs.js +2 -1
- package/dist/{chunk-NSVVQ52O.js → chunk-32DIB5BN.js} +8 -6
- package/dist/chunk-4FWCY4ZV.js +198 -0
- package/dist/{chunk-3H2U7FDR.js → chunk-6TSDIPSH.js} +1861 -247
- package/dist/chunk-FYLJVF7X.js +18448 -0
- package/dist/{chunk-HJL64ETN.js → chunk-GJKJL4YY.js} +14 -0
- package/dist/chunk-JENJZR3F.js +1690 -0
- package/dist/{chunk-3OJN7QAW.js → chunk-JVTN3HPP.js} +18 -4
- package/dist/{chunk-KJKASEPE.js → chunk-RVN5C2FX.js} +737 -26
- package/dist/chunk-S5W34SIJ.js +1 -0
- package/dist/chunk-S667QI3M.js +261 -0
- package/dist/chunk-UQKJWHSS.js +1332 -0
- package/dist/{chunk-RXNFDGPC.js → chunk-WXSPETQ6.js} +311 -40
- package/dist/{composition-Dl-d9FRj.d.ts → composition-DWbCiMwF.d.ts} +559 -10
- package/dist/composition.d.ts +1 -1
- package/dist/composition.js +2 -1
- package/dist/convert.d.ts +261 -0
- package/dist/convert.js +1107 -0
- package/dist/diff.d.ts +145 -0
- package/dist/diff.js +604 -0
- package/dist/docs.js +68 -14
- package/dist/examples.d.ts +1 -1
- package/dist/font-policy.d.ts +15 -0
- package/dist/font-policy.js +1 -1
- package/dist/format.d.ts +20 -0
- package/dist/format.js +83 -0
- package/dist/index.d.ts +173 -24
- package/dist/index.js +926 -262
- package/dist/lint.d.ts +4 -4
- package/dist/lint.js +6 -5
- package/dist/markdown.d.ts +74 -0
- package/dist/markdown.js +1941 -0
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +6 -5
- package/dist/patch.d.ts +99 -0
- package/dist/patch.js +6 -0
- package/dist/{presentation-j5PVrqfV.d.ts → presentation-DRx4hpNZ.d.ts} +451 -16
- package/dist/repo-readme.js +1 -1
- package/dist/{schemas-X_NniU4A.d.ts → schemas-BSjlG8-R.d.ts} +28 -0
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +1 -1
- package/dist/spec/reference/font-policy.json +311 -40
- package/dist/spec/reference/font-policy.schema.json +40 -0
- package/dist/spec/reference/symbol-font-encodings.json +18354 -0
- package/dist/spec/reference/symbol-font-encodings.schema.json +156 -0
- package/dist/spec/schemas/opf.schema.json +591 -22
- package/dist/spec-files.d.ts +1 -1
- package/dist/spec-files.js +1 -1
- package/dist/symbol-font-encodings.d.ts +128 -0
- package/dist/symbol-font-encodings.js +1 -0
- package/dist/types.d.ts +4 -4
- package/dist/validator-bu396ffT.d.ts +172 -0
- package/dist/validator.d.ts +4 -36
- package/dist/validator.js +5 -4
- package/package.json +31 -2
- package/dist/chunk-FDCWQHWO.js +0 -1366
- /package/dist/{chunk-AEUSVEUY.js → chunk-3ZGSWEHK.js} +0 -0
|
@@ -41,6 +41,149 @@ declare function tableGrid(value: unknown, path?: string): TableGrid;
|
|
|
41
41
|
/** Row boundaries that preserve every vertical merge, used by pagination. */
|
|
42
42
|
declare function tableRowBoundaries(value: unknown): number[];
|
|
43
43
|
|
|
44
|
+
/** A positioned thing whose reading position is wanted. */
|
|
45
|
+
interface ReadingBox {
|
|
46
|
+
box: {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Visual reading order: rows from top to bottom, and within a row from the start to the end of the line.
|
|
55
|
+
*
|
|
56
|
+
* Items whose vertical centre falls inside an existing row's vertical extent join that row (so a full-height
|
|
57
|
+
* item shares one row with everything beside it and the row reads left to right). Rows are ordered by their
|
|
58
|
+
* top edge. Ties keep the input order, so the result is deterministic.
|
|
59
|
+
*
|
|
60
|
+
* The boxes are read as given: pass them in logical (unmirrored) coordinates and the order is the reading
|
|
61
|
+
* order of both a left-to-right and a right-to-left deck, because mirroring a deck moves where an item is
|
|
62
|
+
* drawn and where a line starts together. For boxes that are already mirrored, pass `direction: 'rtl'` to
|
|
63
|
+
* order each row from right to left. composeSlide uses this for promoted regions and `opf audit` uses it to
|
|
64
|
+
* check the composed order, so the two cannot drift apart.
|
|
65
|
+
*/
|
|
66
|
+
declare function visualReadingOrder<T extends ReadingBox>(items: readonly T[], direction?: 'ltr' | 'rtl'): T[];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Text direction primitives shared by composition, the renderer and the PPTX exporter (RR-05).
|
|
70
|
+
* Pure: no fonts, DOM or catalogs. Deck direction comes from the presentation language's script
|
|
71
|
+
* (script-fonts.ts); a paragraph's own direction comes from its first strong character.
|
|
72
|
+
*/
|
|
73
|
+
/** Paragraph base direction. */
|
|
74
|
+
type TextDirection = "ltr" | "rtl";
|
|
75
|
+
/**
|
|
76
|
+
* The base direction of one paragraph in a deck, shared by the renderer and
|
|
77
|
+
* the PPTX exporter so preview and export agree. In a right-to-left deck a
|
|
78
|
+
* paragraph is right-to-left when its first strong character is
|
|
79
|
+
* right-to-left, or when it has no strong character (digits, punctuation or
|
|
80
|
+
* empty text); a paragraph whose first strong character is left-to-right
|
|
81
|
+
* (for example an English quote or code) stays left-to-right. In a
|
|
82
|
+
* left-to-right deck every paragraph is left-to-right.
|
|
83
|
+
*
|
|
84
|
+
* Strong characters follow UAX #9 rule P2: text inside directional isolates
|
|
85
|
+
* (LRI, RLI or FSI up to the matching PDI) is skipped. Letters count as
|
|
86
|
+
* strong; RTL letters are those of right-to-left scripts. The result does not
|
|
87
|
+
* depend on locale data, only on the JavaScript engine's Unicode tables.
|
|
88
|
+
*/
|
|
89
|
+
declare function paragraphDirection(text: string, deckDirection: TextDirection | string | undefined): TextDirection;
|
|
90
|
+
/** Horizontal alignment as drawn: the physical left, centre or right of the text box. */
|
|
91
|
+
type PhysicalAlignment = "left" | "center" | "right";
|
|
92
|
+
/**
|
|
93
|
+
* Authored alignment is logical for right-to-left text (RR-05): `left` means the start edge and
|
|
94
|
+
* `right` the end edge, so in a right-to-left paragraph `left` is drawn at the right edge and
|
|
95
|
+
* `right` at the left edge. `center` is unchanged, and so is every left-to-right paragraph.
|
|
96
|
+
*/
|
|
97
|
+
declare function physicalAlignment(alignment: PhysicalAlignment | undefined, direction: TextDirection | undefined): PhysicalAlignment;
|
|
98
|
+
/**
|
|
99
|
+
* The base direction at a UTF-16 offset of `text`, where paragraphs are the segments between hard
|
|
100
|
+
* line breaks (CR, LF or CRLF). Every wrapped line of a paragraph shares its direction, so a
|
|
101
|
+
* line made only of Latin words or digits never changes the paragraph it belongs to.
|
|
102
|
+
*/
|
|
103
|
+
declare function paragraphDirectionAt(text: string, deckDirection: TextDirection | string | undefined): (offset: number) => TextDirection;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Numbered lists: the `numbering` field of `items` and `bullets` payloads.
|
|
107
|
+
*
|
|
108
|
+
* Pure helpers shared by composition (marker text and hanging indent), the validator, pagination and the
|
|
109
|
+
* exporters, so the preview and the native PowerPoint export number every entry identically. Nothing here
|
|
110
|
+
* measures text or reads a document beyond the items it is given.
|
|
111
|
+
*/
|
|
112
|
+
/** The five number styles OPF supports; each maps to a native PowerPoint auto-number scheme. */
|
|
113
|
+
declare const NUMBERING_STYLES: readonly ["arabic", "roman-upper", "roman-lower", "alpha-upper", "alpha-lower"];
|
|
114
|
+
type NumberingStyleName = typeof NUMBERING_STYLES[number];
|
|
115
|
+
/** `period` draws `1.`, `paren` draws `1)` and `paren-both` draws `(1)`. */
|
|
116
|
+
declare const NUMBERING_SUFFIXES: readonly ["period", "paren", "paren-both"];
|
|
117
|
+
type NumberingSuffix = typeof NUMBERING_SUFFIXES[number];
|
|
118
|
+
/** Object form of one level's numbering. Every field is optional. */
|
|
119
|
+
interface Numbering {
|
|
120
|
+
/** Default `arabic`. */
|
|
121
|
+
style?: NumberingStyleName;
|
|
122
|
+
/** First number of the level, an integer from 1 to 32767 (the native `startAt` range). Default 1. */
|
|
123
|
+
start?: number;
|
|
124
|
+
/** Default `period`. */
|
|
125
|
+
suffix?: NumberingSuffix;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* The `numbering` field: one style name, one {@link Numbering} object (both apply to every level) or an array with
|
|
129
|
+
* one entry per list level (index = level; the last entry repeats for deeper levels).
|
|
130
|
+
*/
|
|
131
|
+
type NumberingInput = NumberingStyleName | Numbering | readonly (NumberingStyleName | Numbering)[];
|
|
132
|
+
/** One level's numbering with every default applied. */
|
|
133
|
+
interface ResolvedNumbering {
|
|
134
|
+
style: NumberingStyleName;
|
|
135
|
+
start: number;
|
|
136
|
+
suffix: NumberingSuffix;
|
|
137
|
+
}
|
|
138
|
+
/** Largest value a native auto-number can start at (`a:buAutoNum@startAt`, ST_TextStartAt). */
|
|
139
|
+
declare const MAX_NUMBERING_VALUE = 32767;
|
|
140
|
+
/** Largest value drawn as a Roman numeral; larger values are drawn in arabic. */
|
|
141
|
+
declare const MAX_ROMAN_VALUE = 3999;
|
|
142
|
+
/** Deepest list level a native paragraph can carry (`a:pPr@lvl` is 0 to 8). */
|
|
143
|
+
declare const MAX_NUMBERING_LEVELS = 9;
|
|
144
|
+
/**
|
|
145
|
+
* Resolve a `numbering` value to one entry per authored level (a single entry when it applies to every level).
|
|
146
|
+
* Use {@link numberingAtLevel} to read the entry for a level. Throws on a value the schema rejects.
|
|
147
|
+
*/
|
|
148
|
+
declare function resolveNumbering(input: NumberingInput): ResolvedNumbering[];
|
|
149
|
+
/** The numbering of one list level: the entry at that index, else the last entry. */
|
|
150
|
+
declare function numberingAtLevel(levels: readonly ResolvedNumbering[], level: number): ResolvedNumbering;
|
|
151
|
+
/** Whether `style` can draw `value` as that style (Roman numerals stop at 3999). */
|
|
152
|
+
declare function numberingStyleDraws(style: NumberingStyleName, value: number): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Format a list number as the preview draws it and PowerPoint's matching `a:buAutoNum` scheme draws it:
|
|
155
|
+
* `formatListNumber(4, 'roman-lower')` is `iv.`, `(3, 'alpha-upper', 'paren')` is `C)` and `(27, 'alpha-lower')` is `aa.`.
|
|
156
|
+
* Roman values above 3999 fall back to arabic (see {@link listNumbers} for the reported adaptation).
|
|
157
|
+
*/
|
|
158
|
+
declare function formatListNumber(value: number, style?: NumberingStyleName, suffix?: NumberingSuffix): string;
|
|
159
|
+
/** The number of one list entry. */
|
|
160
|
+
interface ListNumber {
|
|
161
|
+
/** Position of the entry in the list. */
|
|
162
|
+
index: number;
|
|
163
|
+
level: number;
|
|
164
|
+
/** The counted number (1 or more). */
|
|
165
|
+
value: number;
|
|
166
|
+
/** The style actually drawn: `arabic` when the authored style cannot draw `value`. */
|
|
167
|
+
style: NumberingStyleName;
|
|
168
|
+
suffix: NumberingSuffix;
|
|
169
|
+
/** The drawn marker, for example `iv.`. */
|
|
170
|
+
text: string;
|
|
171
|
+
/** Why the drawn style differs from the authored one: Roman numerals stop at 3999. */
|
|
172
|
+
adapted?: 'roman-range';
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The numbers of a list, counted as PowerPoint counts them: consecutive entries of one level count up from that
|
|
176
|
+
* level's `start`; an entry of a shallower level restarts every deeper level; deeper entries between two entries of
|
|
177
|
+
* one level do not interrupt it. An object item's own `start` (an integer from 1 to 32767) restarts the count at that
|
|
178
|
+
* entry. Items are read for their `level` and `start` only.
|
|
179
|
+
*/
|
|
180
|
+
declare function listNumbers(items: readonly unknown[], numbering: NumberingInput): ListNumber[];
|
|
181
|
+
/**
|
|
182
|
+
* The slice `items[from, to)` of a numbered list as the items of a continuation, with `start` set on every entry whose
|
|
183
|
+
* number would otherwise change, so a paginated list keeps the numbers of the whole list.
|
|
184
|
+
*/
|
|
185
|
+
declare function sliceNumberedItems<T>(items: readonly T[], numbering: NumberingInput, from: number, to?: number): T[];
|
|
186
|
+
|
|
44
187
|
/**
|
|
45
188
|
* Deterministic header/footer field formatting. Nothing here consults a clock,
|
|
46
189
|
* the host locale or the host time zone: dates are calendar dates supplied by the
|
|
@@ -99,6 +242,326 @@ declare function textColorForFill(fill: string, preferred: string): string;
|
|
|
99
242
|
* Explicit mark overrides belong to the caller; unresolved alpha is preserved.
|
|
100
243
|
*/
|
|
101
244
|
declare function chartColorForFill(fill: string, preferred: string): string;
|
|
245
|
+
/** Smallest CIE L* step kept between neighbouring series (a printed or greyscale chart tells them apart by lightness alone). */
|
|
246
|
+
declare const CHART_SERIES_MIN_LIGHTNESS_STEP = 11;
|
|
247
|
+
/** Smallest CIE76 colour difference kept between any two series that were at least that far apart before the surface adjustment. */
|
|
248
|
+
declare const CHART_SERIES_MIN_DIFFERENCE = 12;
|
|
249
|
+
/** Series colours for a chart drawn on `fill`: the palette in order, each colour adjusted for contrast
|
|
250
|
+
* (`chartColorForFill`) without letting the adjustment merge series.
|
|
251
|
+
*
|
|
252
|
+
* Lifting or darkening a colour for a dark or mid-tone surface moves every failing colour towards the same
|
|
253
|
+
* few lightness values, so two blues that differ on white can end up identical on a dark card. Colours that
|
|
254
|
+
* already have >= 3:1 contrast against `fill` are kept exactly. A colour the contrast adjustment would move is
|
|
255
|
+
* placed again on the lightness axis, keeping its hue and as much of its chroma as sRGB allows, subject to
|
|
256
|
+
* >= 3:1 contrast against `fill` and these separations from the other series (each capped at the separation
|
|
257
|
+
* that pair had in `palette`, so a pair the palette itself made close is not asked to be far apart):
|
|
258
|
+
*
|
|
259
|
+
* - a colour difference (CIE76) of at least {@link CHART_SERIES_MIN_DIFFERENCE} from every other series;
|
|
260
|
+
* - a lightness step of at least {@link CHART_SERIES_MIN_LIGHTNESS_STEP} (CIE L*) from the neighbouring
|
|
261
|
+
* series, which is what keeps neighbours apart on a greyscale print;
|
|
262
|
+
* - the same lightness step from the remaining series, as a weaker aim.
|
|
263
|
+
*
|
|
264
|
+
* Series are placed in order against the kept colours and the colours placed before them. The placement
|
|
265
|
+
* with the lowest cost wins: its distance (in L*) from the contrast-adjusted colour plus a penalty for
|
|
266
|
+
* every point it falls short of those separations, so a colour that is already clear of the others is
|
|
267
|
+
* simply the adjusted colour, a near miss is not worth a large change, and a collision is resolved at the
|
|
268
|
+
* nearest lightness that clears it. The result is deterministic and in series order. An unresolved or
|
|
269
|
+
* translucent fill or colour is passed through, like `chartColorForFill`.
|
|
270
|
+
*
|
|
271
|
+
* It depends only on the surface and the palette, so every chart on a surface gets the same series colours,
|
|
272
|
+
* and preview and export (which both call this function) draw the same ones.
|
|
273
|
+
*/
|
|
274
|
+
declare function chartPaletteForFill(fill: string, palette: readonly string[]): string[];
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Footnotes, citations and captions (RR-34).
|
|
278
|
+
*
|
|
279
|
+
* - A TextRun may `cite` one or more ids of the deck's top-level `references`, or carry an inline
|
|
280
|
+
* `footnote`. Markers are numbered per deck in reading order of first use (slides, then regions,
|
|
281
|
+
* blocks and runs); the same reference id keeps its number, every footnote takes a new one. A run's
|
|
282
|
+
* marker is a superscript fragment drawn directly after the run (`1`, or `1,2` for several ids);
|
|
283
|
+
* `richTextLayouter` emits it from `RichTextOptions.citationMarker`, so it wraps with its word and
|
|
284
|
+
* never shifts run indexes or source offsets.
|
|
285
|
+
* - A slide that carries markers gets a footnote area directly above the footer band: `layoutFootnotes`
|
|
286
|
+
* lists `<n> <text>` for the slide's markers in number order, and `composeSlide` shrinks the content
|
|
287
|
+
* area by exactly its height. Slides without markers are unchanged.
|
|
288
|
+
* - `caption` on an image, chart, table or video payload reserves a caption band inside the block's
|
|
289
|
+
* region (`layoutCaption`): the media keeps the rest. Captions use the body family at the caption size
|
|
290
|
+
* (0.6 of the body size, clamped to the readable floor) in the muted text colour.
|
|
291
|
+
*
|
|
292
|
+
* Geometry is shared: renderers and exporters only draw what these functions return.
|
|
293
|
+
*/
|
|
294
|
+
type CaptionPosition = 'below' | 'above';
|
|
295
|
+
type CaptionAlignment = 'left' | 'center' | 'right';
|
|
296
|
+
type RichText = string | readonly (string | RichTextRun)[];
|
|
297
|
+
interface CaptionObject {
|
|
298
|
+
text: RichText;
|
|
299
|
+
position?: CaptionPosition;
|
|
300
|
+
align?: CaptionAlignment;
|
|
301
|
+
}
|
|
302
|
+
type Caption = RichText | CaptionObject;
|
|
303
|
+
interface Reference {
|
|
304
|
+
id: string;
|
|
305
|
+
text: RichText;
|
|
306
|
+
url?: string;
|
|
307
|
+
}
|
|
308
|
+
interface CaptionSettings {
|
|
309
|
+
text: RichText;
|
|
310
|
+
position: CaptionPosition;
|
|
311
|
+
align: CaptionAlignment;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* A marker is exported as a superscript run at the marked run's own size with DrawingML `baseline="30000"`, the way a user ticks
|
|
315
|
+
* Superscript. PowerPoint then draws the glyph at 2/3 of that nominal size and raises it by baseline x nominal size. Measured in
|
|
316
|
+
* PowerPoint 365 on Windows on 2026-10-01 with probe-superscript.pptx (Roboto and Aptos, 10 to 44 pt, digit ink height of a
|
|
317
|
+
* superscript run against a plain run of the same size): ratio 0.655 to 0.69, mean 0.667, independent of face and size; raise
|
|
318
|
+
* 0.30 of the nominal size at every size (baseline 30000). An explicit smaller sz on top is reduced again (0.7 x sz drew at about
|
|
319
|
+
* 0.47 of the run), which is why the exporter does not write one. The preview composes the same glyph size and raise.
|
|
320
|
+
*
|
|
321
|
+
* The drawn marker glyph is this fraction of the nominal size (the marked run's size), snapped to the 0.01 pt grid.
|
|
322
|
+
*/
|
|
323
|
+
declare const CITATION_MARKER_SCALE: number;
|
|
324
|
+
/** The raise as a fraction of the NOMINAL size (the marked run's size): DrawingML `baseline="30000"`. */
|
|
325
|
+
declare const CITATION_MARKER_RAISE = 0.3;
|
|
326
|
+
/** Caption text size as a fraction of the body size, before the readable floor. */
|
|
327
|
+
declare const CAPTION_FONT_RATIO = 0.6;
|
|
328
|
+
/** A caption band takes at most this fraction of its block region. */
|
|
329
|
+
declare const CAPTION_MAX_RATIO = 0.35;
|
|
330
|
+
/** A footnote area takes at most this fraction of the span between heading top and footer band. */
|
|
331
|
+
declare const FOOTNOTE_MAX_RATIO = 0.35;
|
|
332
|
+
/** Payload fields whose blocks may carry a caption. */
|
|
333
|
+
declare const CAPTIONABLE_FIELDS: readonly string[];
|
|
334
|
+
/** Flatten a string or TextRun[] to its plain text. */
|
|
335
|
+
declare function annotationText(value: unknown): string;
|
|
336
|
+
/** Normalize a Caption value to its text, position and alignment. */
|
|
337
|
+
declare function captionSettings(value: unknown): CaptionSettings | undefined;
|
|
338
|
+
/** A run that cites or carries a footnote, with its dotted OPF path (`slides.0.blocks.1.text.2`). */
|
|
339
|
+
interface AnnotatedRun {
|
|
340
|
+
path: string;
|
|
341
|
+
run: RichTextRun;
|
|
342
|
+
cite: string[];
|
|
343
|
+
footnote?: RichText;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Visit every rich-text run of a slide that can carry a citation (text, bullets and list item runs),
|
|
347
|
+
* in reading order: promoted regions (sorted keys), then blocks (recursively), then the root payload.
|
|
348
|
+
* `basePath` is the slide's dotted path (`slides.3`).
|
|
349
|
+
*/
|
|
350
|
+
declare function walkCitationRuns(slide: unknown, basePath: string, visit: (entry: AnnotatedRun) => void): void;
|
|
351
|
+
/** One numbered note: a cited reference (by id) or an inline footnote. */
|
|
352
|
+
interface CitationNote {
|
|
353
|
+
number: number;
|
|
354
|
+
kind: 'reference' | 'footnote';
|
|
355
|
+
/** Reference id for `kind: 'reference'`. */
|
|
356
|
+
id?: string;
|
|
357
|
+
/** Note text: the reference text (its id when the references list does not resolve it) or the footnote. */
|
|
358
|
+
text: RichText;
|
|
359
|
+
/** `references.N` for a reference, the marked run's path for a footnote. */
|
|
360
|
+
sourcePath: string;
|
|
361
|
+
url?: string;
|
|
362
|
+
/** False when a cited id has no references entry. */
|
|
363
|
+
resolved: boolean;
|
|
364
|
+
}
|
|
365
|
+
/** A marked run on a slide and the numbers its marker shows. */
|
|
366
|
+
interface CitationMarker {
|
|
367
|
+
path: string;
|
|
368
|
+
numbers: number[];
|
|
369
|
+
text: string;
|
|
370
|
+
}
|
|
371
|
+
interface SlideCitations {
|
|
372
|
+
/** Marker text by run path, in reading order. */
|
|
373
|
+
markers: Map<string, string>;
|
|
374
|
+
/** Every marked run on the slide, in reading order. */
|
|
375
|
+
marked: CitationMarker[];
|
|
376
|
+
/** The notes the slide's markers use, in number order (each number once). */
|
|
377
|
+
notes: CitationNote[];
|
|
378
|
+
}
|
|
379
|
+
interface DeckCitations {
|
|
380
|
+
/** Every note of the deck in number order. */
|
|
381
|
+
notes: CitationNote[];
|
|
382
|
+
/** Cited references in number order (inline footnotes excluded). */
|
|
383
|
+
references: CitationNote[];
|
|
384
|
+
/** Per slide index. Slides without markers are absent. */
|
|
385
|
+
slides: Map<number, SlideCitations>;
|
|
386
|
+
/** Reference ids no run cites, in references order. */
|
|
387
|
+
unused: string[];
|
|
388
|
+
}
|
|
389
|
+
/** Marker text for a set of numbers: `1`, or `1,2` for several ids. */
|
|
390
|
+
declare const citationMarkerText: (numbers: readonly number[]) => string;
|
|
391
|
+
/**
|
|
392
|
+
* Number every marker of a deck in reading order. Slides are read from `presentation.slides`; a
|
|
393
|
+
* hidden slide still takes part so numbers do not change when it is shown.
|
|
394
|
+
*/
|
|
395
|
+
declare function collectCitations(presentation: unknown): DeckCitations;
|
|
396
|
+
/**
|
|
397
|
+
* Citations of one slide with the deck's numbering: the markers of `presentation.slides[0..slideIndex-1]`
|
|
398
|
+
* are counted first, then the runs of `slide` itself (which may be a paginated page or a copy of the
|
|
399
|
+
* document's slide). Without a presentation the slide's own markers start at 1 and reference texts
|
|
400
|
+
* cannot be resolved (`resolved: false`).
|
|
401
|
+
*/
|
|
402
|
+
declare function slideCitations(slide: unknown, slideIndex: number, presentation?: unknown): SlideCitations | undefined;
|
|
403
|
+
/** Fits a string or TextRun[] into a box at a requested size (composeSlide supplies its placed fitter). */
|
|
404
|
+
type AnnotationFitter = (value: RichText, box: LayoutBox, requestedSize: number, minFontSize: number, path: string, alignment: CaptionAlignment) => TextFit | RichTextFit;
|
|
405
|
+
interface AnnotationLayoutOptions {
|
|
406
|
+
scale: number;
|
|
407
|
+
minFontSize: number;
|
|
408
|
+
fit: AnnotationFitter;
|
|
409
|
+
textStyle: (path: string) => TextStyle;
|
|
410
|
+
}
|
|
411
|
+
/** A composed caption band inside a block region. */
|
|
412
|
+
interface ComposedCaption {
|
|
413
|
+
/** Dotted path of the caption field (`slides.0.blocks.1.caption`). */
|
|
414
|
+
path: string;
|
|
415
|
+
value: Caption;
|
|
416
|
+
text: RichText;
|
|
417
|
+
position: CaptionPosition;
|
|
418
|
+
alignment: CaptionAlignment;
|
|
419
|
+
/** The caption band. */
|
|
420
|
+
box: LayoutBox;
|
|
421
|
+
/** The media box after the band is reserved; `ComposedItem.box` equals it. */
|
|
422
|
+
mediaBox: LayoutBox;
|
|
423
|
+
fit: TextFit | RichTextFit;
|
|
424
|
+
textStyle: TextStyle;
|
|
425
|
+
fontSize: number;
|
|
426
|
+
overflow: boolean;
|
|
427
|
+
diagnostics: LayoutDiagnostic[];
|
|
428
|
+
}
|
|
429
|
+
/** Reserve a caption band in `box` (the payload box) and return the band and the media box. */
|
|
430
|
+
declare function layoutCaption(value: unknown, box: LayoutBox, path: string, options: AnnotationLayoutOptions): ComposedCaption | undefined;
|
|
431
|
+
/** One listed note in a slide's footnote area. */
|
|
432
|
+
interface ComposedFootnoteEntry {
|
|
433
|
+
number: number;
|
|
434
|
+
kind: 'reference' | 'footnote';
|
|
435
|
+
id?: string;
|
|
436
|
+
/** `references.N` or the marked run's path. */
|
|
437
|
+
sourcePath: string;
|
|
438
|
+
/** The listed value: `<n> <text>` as a string, or runs starting with the number. */
|
|
439
|
+
value: RichText;
|
|
440
|
+
text: RichText;
|
|
441
|
+
box: LayoutBox;
|
|
442
|
+
fit: TextFit | RichTextFit;
|
|
443
|
+
textStyle: TextStyle;
|
|
444
|
+
url?: string;
|
|
445
|
+
overflow: boolean;
|
|
446
|
+
}
|
|
447
|
+
/** The footnote area of a slide: a rule, then the slide's notes in number order. */
|
|
448
|
+
interface ComposedFootnotes {
|
|
449
|
+
algorithm: 'footnote-area-v1';
|
|
450
|
+
/** Dotted slide path (`slides.3`). */
|
|
451
|
+
path: string;
|
|
452
|
+
box: LayoutBox;
|
|
453
|
+
/** Thin rule along the top of the area. */
|
|
454
|
+
rule: {
|
|
455
|
+
x: number;
|
|
456
|
+
y: number;
|
|
457
|
+
width: number;
|
|
458
|
+
thickness: number;
|
|
459
|
+
};
|
|
460
|
+
entries: ComposedFootnoteEntry[];
|
|
461
|
+
/** Marked runs of the slide with their marker text. */
|
|
462
|
+
markers: CitationMarker[];
|
|
463
|
+
fontSize: number;
|
|
464
|
+
overflow: boolean;
|
|
465
|
+
diagnostics: LayoutDiagnostic[];
|
|
466
|
+
}
|
|
467
|
+
interface FootnoteLayoutOptions extends AnnotationLayoutOptions {
|
|
468
|
+
/** Left edge and width of the content area. */
|
|
469
|
+
x: number;
|
|
470
|
+
width: number;
|
|
471
|
+
/** The area's bottom edge (the top of the footer band gap). */
|
|
472
|
+
bottom: number;
|
|
473
|
+
/** Largest height the area may take. */
|
|
474
|
+
maxHeight: number;
|
|
475
|
+
/** Slide path for the area (`slides.3`). */
|
|
476
|
+
path: string;
|
|
477
|
+
}
|
|
478
|
+
/** List a slide's notes in a footnote area whose bottom sits at `options.bottom`. */
|
|
479
|
+
declare function layoutFootnotes(citations: SlideCitations, options: FootnoteLayoutOptions): ComposedFootnotes;
|
|
480
|
+
interface ReferencesSlideOptions {
|
|
481
|
+
title?: string;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* An ordinary list slide of the deck's cited references in marker order (`n. text`, linked to the
|
|
485
|
+
* reference url when there is one). Inline footnotes are not listed. A deck that cites nothing gets
|
|
486
|
+
* a slide with the title only.
|
|
487
|
+
*/
|
|
488
|
+
declare function referencesSlide(presentation: unknown, options?: ReferencesSlideOptions): Record<string, unknown>;
|
|
489
|
+
|
|
490
|
+
/** The chart constructs the engines draw. Every catalog chart type id resolves to one (see `chartOptionTarget`). */
|
|
491
|
+
type ChartOptionKind = 'bar' | 'line' | 'area' | 'pie' | 'doughnut' | 'scatter' | 'radar' | 'treemap' | 'histogram' | 'pareto' | 'box' | 'waterfall' | 'funnel' | 'map';
|
|
492
|
+
interface ChartOptionTarget {
|
|
493
|
+
kind: ChartOptionKind;
|
|
494
|
+
/** Stacked and 100% stacked columns, bars, lines and areas: their data labels have no outside-end position. */
|
|
495
|
+
stacked?: boolean;
|
|
496
|
+
}
|
|
497
|
+
type ChartLegendPosition = 'none' | 'top' | 'bottom' | 'left' | 'right';
|
|
498
|
+
type ChartLabelContent = 'category' | 'value' | 'percent';
|
|
499
|
+
type ChartLabelPosition = 'center' | 'inside-end' | 'inside-base' | 'outside-end' | 'above' | 'below' | 'left' | 'right';
|
|
500
|
+
interface ChartOptionDiagnostic {
|
|
501
|
+
code: 'chart-option-adapted';
|
|
502
|
+
/** The option that was adapted: `axisTitles.category`, `axisTitles.value`, `legend`, `dataLabels`, `dataLabels.content`, `dataLabels.position` or `dataLabels.separator`. */
|
|
503
|
+
option: string;
|
|
504
|
+
reason: 'unsupported-type' | 'unsupported-content' | 'unsupported-position';
|
|
505
|
+
message: string;
|
|
506
|
+
}
|
|
507
|
+
interface ResolvedChartDataLabels {
|
|
508
|
+
/** Canonical order: category, value, percent. Never empty. */
|
|
509
|
+
content: ChartLabelContent[];
|
|
510
|
+
/** The concrete position, or null for a construct whose labels have no position choice (area, doughnut, radar, treemap). */
|
|
511
|
+
position: ChartLabelPosition | null;
|
|
512
|
+
separator: string;
|
|
513
|
+
}
|
|
514
|
+
interface ResolvedChartOptions {
|
|
515
|
+
/** True when the chart carries at least one option (after adaptation); false means every engine keeps today's output. */
|
|
516
|
+
active: boolean;
|
|
517
|
+
axisTitles: {
|
|
518
|
+
category?: string;
|
|
519
|
+
value?: string;
|
|
520
|
+
};
|
|
521
|
+
/** Undefined = no legend option: each engine keeps its default (a right legend on multi-series, pie and doughnut charts). */
|
|
522
|
+
legend?: ChartLegendPosition;
|
|
523
|
+
dataLabels?: ResolvedChartDataLabels;
|
|
524
|
+
/** True when `dataLabels: false` switches off the labels a construct draws by default (funnel values, treemap category names). */
|
|
525
|
+
dataLabelsOff?: boolean;
|
|
526
|
+
diagnostics: ChartOptionDiagnostic[];
|
|
527
|
+
}
|
|
528
|
+
interface ChartOptionSupport {
|
|
529
|
+
axisTitles: {
|
|
530
|
+
category: boolean;
|
|
531
|
+
value: boolean;
|
|
532
|
+
};
|
|
533
|
+
legend: boolean;
|
|
534
|
+
dataLabels: {
|
|
535
|
+
supported: boolean;
|
|
536
|
+
content: readonly ChartLabelContent[];
|
|
537
|
+
/** Empty when labels have no position choice. */
|
|
538
|
+
positions: readonly ChartLabelPosition[];
|
|
539
|
+
/** The position `auto` resolves to; null with no positions. */
|
|
540
|
+
defaultPosition: ChartLabelPosition | null;
|
|
541
|
+
/** True for the constructs that label their marks by default (funnel, treemap): `dataLabels: false` removes those labels. */
|
|
542
|
+
defaultOn: boolean;
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
/** What a chart construct can show. The table the docs, the validator, the preview and the exporter all follow. */
|
|
546
|
+
declare function chartOptionSupport(target: ChartOptionTarget): ChartOptionSupport;
|
|
547
|
+
/** The option target for a catalog chart type id (deprecated ids resolve to their replacement); undefined for an id outside the catalog. */
|
|
548
|
+
declare function chartOptionTarget(typeId: unknown): ChartOptionTarget | undefined;
|
|
549
|
+
declare const DEFAULT_CHART_LABEL_SEPARATOR = ", ";
|
|
550
|
+
/**
|
|
551
|
+
* Normalise a chart's `axisTitles`, `legend` and `dataLabels` against what its type can show. `target` is undefined for a chart type
|
|
552
|
+
* outside the catalog: nothing is adapted then (the engines fall back to their legacy output for such charts anyway).
|
|
553
|
+
*/
|
|
554
|
+
declare function resolveChartOptions(chart: unknown, target?: ChartOptionTarget): ResolvedChartOptions;
|
|
555
|
+
/** A General-format number as a label: at most twelve significant digits, no exponent unless the value needs one. */
|
|
556
|
+
declare function formatChartLabelNumber(value: number): string;
|
|
557
|
+
/** A share as PowerPoint's `0%` label. */
|
|
558
|
+
declare function formatChartLabelPercent(share: number): string;
|
|
559
|
+
/** The label text: the selected parts in the fixed order category, value, percent, joined by the separator. */
|
|
560
|
+
declare function chartLabelText(parts: {
|
|
561
|
+
category?: string;
|
|
562
|
+
value?: string;
|
|
563
|
+
percent?: string;
|
|
564
|
+
}, content: readonly ChartLabelContent[], separator?: string): string;
|
|
102
565
|
|
|
103
566
|
/** Portable layout geometry. No fonts, DOM, renderer, or network dependencies. */
|
|
104
567
|
interface Composition {
|
|
@@ -118,7 +581,7 @@ interface LayoutBox {
|
|
|
118
581
|
height: number;
|
|
119
582
|
}
|
|
120
583
|
interface LayoutDiagnostic {
|
|
121
|
-
code: "text-overflow" | "small-cell" | "unresolved-content" | "unsupported-image-treatment";
|
|
584
|
+
code: "text-overflow" | "small-cell" | "unresolved-content" | "unsupported-image-treatment" | "numbering-adapted";
|
|
122
585
|
path: string;
|
|
123
586
|
message: string;
|
|
124
587
|
}
|
|
@@ -201,6 +664,8 @@ interface TextPlacementLine {
|
|
|
201
664
|
height: number;
|
|
202
665
|
width: number;
|
|
203
666
|
outline: LayoutBox | null;
|
|
667
|
+
/** Physical alignment this line was placed with. Present only in a right-to-left deck, where `left` and `right` are logical start and end. */
|
|
668
|
+
alignment?: PhysicalAlignment;
|
|
204
669
|
}
|
|
205
670
|
interface TextPlacement {
|
|
206
671
|
alignment: 'left' | 'center' | 'right';
|
|
@@ -216,10 +681,15 @@ interface TextFit {
|
|
|
216
681
|
lineHeight: number;
|
|
217
682
|
overflow: boolean;
|
|
218
683
|
placement?: TextPlacement;
|
|
684
|
+
/**
|
|
685
|
+
* Base direction of the paragraph each line belongs to, in line order. Present only when the fit was
|
|
686
|
+
* made for a right-to-left deck; every wrapped line shares its paragraph's direction (RR-05).
|
|
687
|
+
*/
|
|
688
|
+
directions?: TextDirection[];
|
|
219
689
|
}
|
|
220
690
|
/** Place complete measured lines, preserving alignment where it leaves room for ink.
|
|
221
691
|
* Move following baselines together when outlines need more vertical separation. */
|
|
222
|
-
declare function placeTextLines(lines: readonly TextLineInk[], box: LayoutBox, alignment?: TextPlacement['alignment'], rasterPadding?: number): TextPlacement;
|
|
692
|
+
declare function placeTextLines(lines: readonly TextLineInk[], box: LayoutBox, alignment?: TextPlacement['alignment'], rasterPadding?: number, directions?: readonly TextDirection[]): TextPlacement;
|
|
223
693
|
interface ComposedItem {
|
|
224
694
|
path: string;
|
|
225
695
|
field: string;
|
|
@@ -244,6 +714,11 @@ interface ComposedItem {
|
|
|
244
714
|
* and the deck's icon logo resolves. Every entry marker in `text.listEntries` carries the same value.
|
|
245
715
|
*/
|
|
246
716
|
bulletImage?: ListBulletImage;
|
|
717
|
+
/**
|
|
718
|
+
* Caption band of an image, chart, table or video payload that carries `caption` (RR-34). `box` is
|
|
719
|
+
* the media box after the band is reserved; `caption.box` is the band inside the same region.
|
|
720
|
+
*/
|
|
721
|
+
caption?: ComposedCaption;
|
|
247
722
|
/** Effective container settings, including inherited readability constraints. */
|
|
248
723
|
composition: Composition;
|
|
249
724
|
/**
|
|
@@ -330,7 +805,7 @@ interface ComposedLogo {
|
|
|
330
805
|
path: string;
|
|
331
806
|
source: unknown;
|
|
332
807
|
variant: string;
|
|
333
|
-
anchor: 'left';
|
|
808
|
+
anchor: 'left' | 'right';
|
|
334
809
|
}
|
|
335
810
|
/** Picture bullet source for list markers: the deck's icon logo and the OPF path it was read from. */
|
|
336
811
|
interface ListBulletImage {
|
|
@@ -409,11 +884,19 @@ interface SlideComposition {
|
|
|
409
884
|
slideImage?: ComposedSlideImage;
|
|
410
885
|
/** Deck logo on a cover or section slide; absent on content slides and when no logo resolves. */
|
|
411
886
|
logo?: ComposedLogo;
|
|
887
|
+
/**
|
|
888
|
+
* Footnote area of a slide whose runs cite references or carry footnotes (RR-34): directly above the
|
|
889
|
+
* footer band, the content area is shrunk by exactly its height. Absent on slides without markers.
|
|
890
|
+
*/
|
|
891
|
+
footnotes?: ComposedFootnotes;
|
|
892
|
+
/** `rtl` when the slide was composed for a right-to-left deck (mirrored arrangement); absent for left-to-right decks. */
|
|
893
|
+
direction?: 'rtl';
|
|
412
894
|
explanation?: CompositionExplanation;
|
|
413
895
|
}
|
|
414
896
|
interface ComposeSlideOptions {
|
|
415
|
-
/** Context for inherited furniture, generated organization names, social profiles, logos and
|
|
897
|
+
/** Context for inherited furniture, generated organization names, social profiles, logos, layout hints, references and marker numbering. */
|
|
416
898
|
presentation?: {
|
|
899
|
+
language?: unknown;
|
|
417
900
|
design?: {
|
|
418
901
|
header?: unknown;
|
|
419
902
|
footer?: unknown;
|
|
@@ -427,6 +910,7 @@ interface ComposeSlideOptions {
|
|
|
427
910
|
organization?: unknown;
|
|
428
911
|
slides?: unknown;
|
|
429
912
|
catalogs?: unknown;
|
|
913
|
+
references?: unknown;
|
|
430
914
|
};
|
|
431
915
|
/**
|
|
432
916
|
* Whether the slide background is dark, by the host's own luminance test. Selects the light logo
|
|
@@ -450,6 +934,13 @@ interface ComposeSlideOptions {
|
|
|
450
934
|
*/
|
|
451
935
|
date?: string;
|
|
452
936
|
fonts?: Partial<FontFamilies>;
|
|
937
|
+
/**
|
|
938
|
+
* Deck base direction (RR-05). Defaults to the direction of the presentation language's script. In a right-to-left deck
|
|
939
|
+
* composition mirrors the arrangement (the first column or `left` region is drawn at the right, slide images, logos and
|
|
940
|
+
* header/footer zones swap sides, tables run right to left), lists put their markers at the right, and every text fit
|
|
941
|
+
* reports each paragraph's direction. Alignment stays logical: `left` is the start edge.
|
|
942
|
+
*/
|
|
943
|
+
direction?: TextDirection;
|
|
453
944
|
/** Host-resolved alignment for shared content; slide design can override it. */
|
|
454
945
|
contentAlignment?: 'left' | 'center' | 'right';
|
|
455
946
|
titleAlignment?: 'left' | 'center' | 'right';
|
|
@@ -585,7 +1076,18 @@ declare function layoutFurniture(input: unknown, options?: ComposeSlideOptions):
|
|
|
585
1076
|
/** Deterministic estimate, not a font shaping engine. Preserves explicit line breaks. */
|
|
586
1077
|
declare function measureText(text: string, fontSize: number): number;
|
|
587
1078
|
declare function wrapText(text: string, width: number, fontSize: number, measure?: MeasureTextWidth): string[];
|
|
588
|
-
declare function fitText(text: string, box: LayoutBox, requestedSize?: number, minFontSize?: number, measure?: MeasureTextWidth): SourceTextFit;
|
|
1079
|
+
declare function fitText(text: string, box: LayoutBox, requestedSize?: number, minFontSize?: number, measure?: MeasureTextWidth, direction?: TextDirection): SourceTextFit;
|
|
1080
|
+
/**
|
|
1081
|
+
* PowerPoint stores a run size (`sz`) in hundredths of a point, and composition pixels are CSS pixels (96 per
|
|
1082
|
+
* inch, so a point is 4/3 px). Every composed font size is therefore a whole multiple of 0.01 pt, which is
|
|
1083
|
+
* 1/75 px: the preview then measures, breaks and draws exactly the size the export writes (RR-16).
|
|
1084
|
+
* The tolerance absorbs binary rounding noise (a size already on the grid must not drop a step).
|
|
1085
|
+
*/
|
|
1086
|
+
declare const FONT_SIZE_GRID_PER_PX = 75;
|
|
1087
|
+
/** Largest grid size not above `px`. Rounding down keeps a size that fit before snapping fitting. */
|
|
1088
|
+
declare function snapFontSizeDown(px: number): number;
|
|
1089
|
+
/** Smallest grid size not below `px`. Used for readability floors, so a floor is never undercut. */
|
|
1090
|
+
declare function snapFontSizeUp(px: number): number;
|
|
589
1091
|
interface QuoteContent {
|
|
590
1092
|
text: string;
|
|
591
1093
|
attribution?: string;
|
|
@@ -633,6 +1135,8 @@ interface QuoteLayoutOptions {
|
|
|
633
1135
|
overflow?: Composition['overflow'];
|
|
634
1136
|
path?: string;
|
|
635
1137
|
textMeasurement?: TextMeasurement;
|
|
1138
|
+
/** Deck direction; in a right-to-left deck every part fit reports its paragraphs' directions (RR-05). */
|
|
1139
|
+
direction?: TextDirection;
|
|
636
1140
|
}
|
|
637
1141
|
/**
|
|
638
1142
|
* Allocate and measure quote body/footer space for composition, rendering and export. Callers must
|
|
@@ -697,7 +1201,8 @@ interface MetricLayoutOptions extends QuoteLayoutOptions {
|
|
|
697
1201
|
/**
|
|
698
1202
|
* Measure every metric field before accepting geometry. Short single-line values and units can
|
|
699
1203
|
* share a baseline; longer values or units stack. No locale formatting, trend icons or rewritten
|
|
700
|
-
* source text are invented
|
|
1204
|
+
* source text are invented here: the trend stays its word, and metricTrendMark derives the arrow
|
|
1205
|
+
* beside it from these accepted parts. Consumers must reuse these accepted parts and source ranges.
|
|
701
1206
|
*/
|
|
702
1207
|
declare function layoutMetric(value: string | number | MetricContent, box: LayoutBox, options?: MetricLayoutOptions): MetricLayout;
|
|
703
1208
|
interface TimelineEvent {
|
|
@@ -721,6 +1226,7 @@ interface TimelineTextPart {
|
|
|
721
1226
|
end: number;
|
|
722
1227
|
}[];
|
|
723
1228
|
box: LayoutBox;
|
|
1229
|
+
/** Logical alignment: `left` is the start edge, which a right-to-left line draws at the right (see `fit.directions`). */
|
|
724
1230
|
alignment: 'left' | 'center';
|
|
725
1231
|
requestedFontSize: number;
|
|
726
1232
|
minFontSize: number;
|
|
@@ -838,10 +1344,18 @@ interface RichTextRun {
|
|
|
838
1344
|
link?: string;
|
|
839
1345
|
superscript?: boolean;
|
|
840
1346
|
subscript?: boolean;
|
|
1347
|
+
/** RR-34: reference ids this run cites (a marker follows the run; the deck's `references` list resolves them). */
|
|
1348
|
+
cite?: string | string[];
|
|
1349
|
+
/** RR-34: an inline footnote for this run (a marker follows the run; the note is listed in the slide's footnote area). */
|
|
1350
|
+
footnote?: string | (string | RichTextRun)[];
|
|
841
1351
|
}
|
|
842
1352
|
interface RichTextFragment {
|
|
843
|
-
/**
|
|
844
|
-
|
|
1353
|
+
/**
|
|
1354
|
+
* Tabs are source-preserving layout controls with a fixed advance, not glyph text. A marker is the
|
|
1355
|
+
* superscript citation/footnote number drawn after a run that cites or carries a footnote (RR-34): it
|
|
1356
|
+
* has no source range (`start === end === run.text.length`), so run indexes and offsets never shift.
|
|
1357
|
+
*/
|
|
1358
|
+
kind?: 'tab' | 'marker';
|
|
845
1359
|
text: string;
|
|
846
1360
|
runIndex: number;
|
|
847
1361
|
start: number;
|
|
@@ -850,6 +1364,8 @@ interface RichTextFragment {
|
|
|
850
1364
|
width: number;
|
|
851
1365
|
fontSize: number;
|
|
852
1366
|
baselineShift: number;
|
|
1367
|
+
/** A marker only: the size the exporter writes (the marked run's size); `fontSize` is the glyph PowerPoint draws for it (2/3). */
|
|
1368
|
+
nominalSize?: number;
|
|
853
1369
|
style: TextStyle;
|
|
854
1370
|
run: RichTextRun;
|
|
855
1371
|
}
|
|
@@ -869,6 +1385,13 @@ interface RichTextOptions {
|
|
|
869
1385
|
textMeasurement?: TextMeasurement;
|
|
870
1386
|
/** Use one measured line advance for every line, as native table cells do. */
|
|
871
1387
|
uniformLineHeight?: boolean;
|
|
1388
|
+
/** Deck direction. In a right-to-left deck every line reports its paragraph's direction in `directions`. */
|
|
1389
|
+
direction?: TextDirection;
|
|
1390
|
+
/**
|
|
1391
|
+
* Marker text (`1`, `1,2`) for a run by its dotted path (`${style.path}.${runIndex}`), or undefined.
|
|
1392
|
+
* composeSlide supplies the deck numbering from `slideCitations`; a marker fragment is emitted after the run.
|
|
1393
|
+
*/
|
|
1394
|
+
citationMarker?: (runPath: string) => string | undefined;
|
|
872
1395
|
}
|
|
873
1396
|
/** Fit mixed styles without flattening font metrics. Run fontSize is in points. */
|
|
874
1397
|
declare function fitRichText(input: readonly (string | RichTextRun)[], box: LayoutBox, requestedSize?: number, minFontSize?: number, options?: RichTextOptions): RichTextFit;
|
|
@@ -877,6 +1400,7 @@ type ListValue = ListText | {
|
|
|
877
1400
|
text: ListText;
|
|
878
1401
|
description?: ListText;
|
|
879
1402
|
level?: number;
|
|
1403
|
+
start?: number;
|
|
880
1404
|
};
|
|
881
1405
|
interface ListEntryLayout {
|
|
882
1406
|
index: number;
|
|
@@ -889,6 +1413,13 @@ interface ListEntryLayout {
|
|
|
889
1413
|
description?: RichTextFit;
|
|
890
1414
|
textBox: LayoutBox;
|
|
891
1415
|
descriptionBox?: LayoutBox;
|
|
1416
|
+
/**
|
|
1417
|
+
* `x` is the marker's left edge, or its right edge when `anchor` is `end` (a right-to-left entry, whose marker sits at the right and
|
|
1418
|
+
* whose text box is the column to its left).
|
|
1419
|
+
* The entry marker: the bullet glyph, or for a numbered list (`numbering`) the formatted number such as `iv.`.
|
|
1420
|
+
* A numbered marker also carries `number` and its measured `width`; its `style` is the list style with the weight and
|
|
1421
|
+
* slant of the entry's first run, as PowerPoint draws an auto-number in the first run's character formatting.
|
|
1422
|
+
*/
|
|
892
1423
|
marker: {
|
|
893
1424
|
text: string;
|
|
894
1425
|
x: number;
|
|
@@ -896,12 +1427,18 @@ interface ListEntryLayout {
|
|
|
896
1427
|
fontSize: number;
|
|
897
1428
|
style: TextStyle;
|
|
898
1429
|
indent: number;
|
|
1430
|
+
number?: ListNumber;
|
|
1431
|
+
width?: number;
|
|
1432
|
+
anchor?: 'end';
|
|
899
1433
|
};
|
|
1434
|
+
/** Paragraph direction of this entry. Present only when the list was fitted for a right-to-left deck. */
|
|
1435
|
+
direction?: TextDirection;
|
|
900
1436
|
/** Picture bullet replacing the marker glyph; drawn in `bulletBox`. Marker geometry is unchanged. */
|
|
901
1437
|
bulletImage?: ListBulletImage;
|
|
902
1438
|
/**
|
|
903
1439
|
* Where the picture bullet draws: a square of side `marker.fontSize * PICTURE_BULLET_SCALE` whose
|
|
904
|
-
* bottom sits on the marker baseline (`marker.y`) and whose left edge is `marker.x
|
|
1440
|
+
* bottom sits on the marker baseline (`marker.y`) and whose left edge is `marker.x` (right edge when `marker.anchor` is `end`).
|
|
1441
|
+
* Present with `bulletImage`.
|
|
905
1442
|
*/
|
|
906
1443
|
bulletBox?: LayoutBox;
|
|
907
1444
|
}
|
|
@@ -918,6 +1455,11 @@ interface ListFit extends TextFit {
|
|
|
918
1455
|
height: number;
|
|
919
1456
|
}
|
|
920
1457
|
interface ListFitOptions extends RichTextOptions {
|
|
1458
|
+
/**
|
|
1459
|
+
* Number the entries instead of bulleting them (the payload's `numbering` field). The hanging indent becomes the larger of
|
|
1460
|
+
* 1.1 em and the widest marker plus 0.3 em, so wide markers never touch their text; unnumbered lists are unchanged.
|
|
1461
|
+
*/
|
|
1462
|
+
numbering?: NumberingInput;
|
|
921
1463
|
/** Picture bullet for every entry (effective `design.listBullet: "image"` with a resolved icon logo). */
|
|
922
1464
|
bulletImage?: ListBulletImage;
|
|
923
1465
|
}
|
|
@@ -929,6 +1471,11 @@ interface TableLayoutOptions {
|
|
|
929
1471
|
fontFamily?: string;
|
|
930
1472
|
textMeasurement?: TextMeasurement;
|
|
931
1473
|
path?: string;
|
|
1474
|
+
/**
|
|
1475
|
+
* Deck direction. A right-to-left deck lays the columns out right to left: the first column is the rightmost
|
|
1476
|
+
* and each cell's text reports its paragraph direction (RR-05).
|
|
1477
|
+
*/
|
|
1478
|
+
direction?: TextDirection;
|
|
932
1479
|
}
|
|
933
1480
|
interface TableCellLayout {
|
|
934
1481
|
value: unknown;
|
|
@@ -946,6 +1493,8 @@ interface TableCellLayout {
|
|
|
946
1493
|
textBox: LayoutBox;
|
|
947
1494
|
textStyle: TextStyle;
|
|
948
1495
|
fit: TextFit | RichTextFit;
|
|
1496
|
+
/** Paragraph direction of the cell text; present only in a right-to-left deck. */
|
|
1497
|
+
direction?: TextDirection;
|
|
949
1498
|
}
|
|
950
1499
|
interface TableRowLayout {
|
|
951
1500
|
box: LayoutBox;
|
|
@@ -971,4 +1520,4 @@ declare function resolveCanvasDimensions(input: unknown): {
|
|
|
971
1520
|
height: number;
|
|
972
1521
|
};
|
|
973
1522
|
|
|
974
|
-
export {
|
|
1523
|
+
export { DEFAULT_FURNITURE_DATE_FORMAT as $, type AnnotatedRun as A, type CodeLayoutOptions as B, type ComposeSlideOptions as C, type CodeLineSegment as D, type CodeLineSource as E, type FontSchemeDiagnostic as F, type CodeTextFit as G, type CodeTextPart as H, type ComposedCaption as I, type ComposedFlow as J, type ComposedFootnoteEntry as K, type LayoutDiagnostic as L, type MetricLayout as M, type ComposedFootnotes as N, type ComposedGroup as O, type ComposedItem as P, type ComposedLogo as Q, type ComposedSlideImage as R, type Composition as S, type TextMeasurement as T, type CompositionCandidate as U, type CompositionDecision as V, type CompositionExplanation as W, type CompositionPenalties as X, type CompositionTrack as Y, DEFAULT_CHART_LABEL_SEPARATOR as Z, DEFAULT_FONT_SCHEME as _, type AnnotationFitter as a, type RichTextRun as a$, DEFAULT_SLIDE_NUMBER_FORMAT as a0, type DeckCitations as a1, FONT_SIZE_GRID_PER_PX as a2, FOOTNOTE_MAX_RATIO as a3, type FontFamilies as a4, type FootnoteLayoutOptions as a5, type FurnitureField as a6, type FurnitureImagePart as a7, type FurnitureLayout as a8, type FurniturePart as a9, type NumberingInput as aA, type NumberingStyleName as aB, type NumberingSuffix as aC, OPFCompositionError as aD, PICTURE_BULLET_SCALE as aE, type PhysicalAlignment as aF, type QuoteContent as aG, type QuoteLayout as aH, type QuoteLayoutDiagnostic as aI, type QuoteLayoutOptions as aJ, type QuoteTextPart as aK, type QuoteTextSource as aL, type Reference as aM, type ReferencesSlideOptions as aN, type ResolveColorRefOptions as aO, type ResolveColorRefRoles as aP, type ResolveLogoOptions as aQ, type ResolvedChartDataLabels as aR, type ResolvedChartOptions as aS, type ResolvedFontScheme as aT, type ResolvedLogo as aU, type ResolvedNumbering as aV, type RichText as aW, type RichTextFit as aX, type RichTextFragment as aY, type RichTextLine as aZ, type RichTextOptions as a_, type FurniturePartBase as aa, type FurnitureSocialLink as ab, type FurnitureTextExtras as ac, type FurnitureTextPart as ad, type LayoutBox as ae, type ListBulletImage as af, type ListEntryLayout as ag, type ListFit as ah, type ListFitOptions as ai, type ListNumber as aj, type ListText as ak, type ListValue as al, type LogoSlot as am, MAX_COMPOSITION_DEPTH as an, MAX_NUMBERING_LEVELS as ao, MAX_NUMBERING_VALUE as ap, MAX_ROMAN_VALUE as aq, type MeasureTextWidth as ar, type MetricContent as as, type MetricLayoutDiagnostic as at, type MetricLayoutOptions as au, type MetricTextPart as av, type MetricTextSource as aw, NUMBERING_STYLES as ax, NUMBERING_SUFFIXES as ay, type Numbering as az, type AnnotationLayoutOptions as b, sliceNumberedItems as b$, type SlideCitations as b0, type SlideComposition as b1, type SlideImageShape as b2, type SocialPlatformRecord as b3, type SocialProfile as b4, type TextDirection as b5, type TextFit as b6, type TextLineInk as b7, type TextPlacement as b8, type TextPlacementLine as b9, layoutCaption as bA, layoutCode as bB, layoutFootnotes as bC, layoutFurniture as bD, layoutMetric as bE, layoutQuote as bF, layoutTimeline as bG, listNumbers as bH, measureText as bI, measureTextOutline as bJ, normalizeHexColor as bK, numberingAtLevel as bL, numberingStyleDraws as bM, paragraphDirection as bN, paragraphDirectionAt as bO, physicalAlignment as bP, placeTextLines as bQ, referencesSlide as bR, resolveCanvasDimensions as bS, resolveChartOptions as bT, resolveColorRef as bU, resolveFontFamilies as bV, resolveFontSchemeReference as bW, resolveLogo as bX, resolveNumbering as bY, resolveSocialProfile as bZ, resolveTextStyle as b_, type TextStyle as ba, type TimelineContent as bb, type TimelineEvent as bc, type TimelineLayout as bd, type TimelineLayoutDiagnostic as be, type TimelineLayoutOptions as bf, type TimelineTextPart as bg, annotationText as bh, captionSettings as bi, chartColorForFill as bj, chartLabelText as bk, chartOptionSupport as bl, chartOptionTarget as bm, chartPaletteForFill as bn, citationMarkerText as bo, collectCitations as bp, colorContrast as bq, composeSlide as br, fitList as bs, fitRichText as bt, fitText as bu, formatChartLabelNumber as bv, formatChartLabelPercent as bw, formatFurnitureDate as bx, formatListNumber as by, formatSlideNumber as bz, CAPTIONABLE_FIELDS as c, slideCitations as c0, snapFontSizeDown as c1, snapFontSizeUp as c2, textColorForFill as c3, textWidthMeasurer as c4, walkCitationRuns as c5, wrapText as c6, type FontFaceSelection as c7, type ReadingBox as c8, type SourceTextFit as c9, type TableBorder as ca, type TableCellLayout as cb, type TableCellStyle as cc, type TableGrid as cd, type TableGridCell as ce, type TableGridIssue as cf, type TableLayout as cg, type TableLayoutOptions as ch, type TableRowLayout as ci, type TextLineSegment as cj, type TextLineSource as ck, layoutTable as cl, slideImageShape as cm, tableGrid as cn, tableRowBoundaries as co, visualReadingOrder as cp, CAPTION_FONT_RATIO as d, CAPTION_MAX_RATIO as e, CHART_SERIES_MIN_DIFFERENCE as f, CHART_SERIES_MIN_LIGHTNESS_STEP as g, CITATION_MARKER_RAISE as h, CITATION_MARKER_SCALE as i, type Caption as j, type CaptionAlignment as k, type CaptionObject as l, type CaptionPosition as m, type CaptionSettings as n, type ChartLabelContent as o, type ChartLabelPosition as p, type ChartLegendPosition as q, type ChartOptionDiagnostic as r, type ChartOptionKind as s, type ChartOptionSupport as t, type ChartOptionTarget as u, type CitationMarker as v, type CitationNote as w, type CodeContent as x, type CodeLayout as y, type CodeLayoutDiagnostic as z };
|