@openpresentation/opf 0.9.0 → 0.10.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 +7 -1
- package/dist/{catalogs-BnnkUX9O.d.ts → catalogs-DoVmvDr7.d.ts} +6 -6
- package/dist/catalogs.d.ts +2 -2
- package/dist/catalogs.js +1 -1
- package/dist/{chunk-GQSK3T7X.js → chunk-D3GQIREP.js} +13 -4
- package/dist/chunk-EWJNRHXA.js +595 -0
- package/dist/{chunk-3GPZMY2W.js → chunk-FHGJX5QK.js} +24 -12
- package/dist/{chunk-JA5W5TVA.js → chunk-PQJRDNA6.js} +624 -73
- package/dist/{chunk-OZULJBSG.js → chunk-RS5GZ5RW.js} +14 -0
- package/dist/{chunk-TWMRZ43O.js → chunk-TU7I3KSB.js} +59 -21
- package/dist/{chunk-ZGV6I23P.js → chunk-ZIL7MGZU.js} +50 -5
- package/dist/composition.d.ts +257 -10
- package/dist/composition.js +1 -1
- package/dist/docs.js +58 -10
- package/dist/examples.js +2284 -1417
- package/dist/index.d.ts +4 -3
- package/dist/index.js +7 -6
- package/dist/lint.d.ts +70 -0
- package/dist/lint.js +5 -0
- package/dist/pagination.d.ts +4 -0
- package/dist/pagination.js +5 -5
- package/dist/{schemas--QRVBhU1.d.ts → schemas-BYe5y8-i.d.ts} +1 -1
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +1 -1
- package/dist/spec/catalogs/layouts/extract/canonical.json +45 -21
- package/dist/spec/catalogs/layouts/index.json +10 -0
- package/dist/spec/catalogs/layouts/number-1x.json +1 -1
- package/dist/spec/catalogs/layouts/number-2x.json +2 -2
- package/dist/spec/catalogs/layouts/number-3x.json +3 -3
- package/dist/spec/catalogs/layouts/number-4x.json +4 -4
- package/dist/spec/catalogs/layouts/number-5x.json +5 -5
- package/dist/spec/catalogs/layouts/number-6x.json +6 -6
- package/dist/spec/catalogs/layouts/quote-1x.json +13 -0
- package/dist/spec/catalogs/layouts/timeline-1x.json +13 -0
- package/dist/spec/schemas/layout.schema.json +12 -3
- package/dist/spec/schemas/narrative.schema.json +1 -1
- package/dist/spec-files.d.ts +1 -1
- package/dist/spec-files.js +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/validator.d.ts +2 -2
- package/dist/validator.js +4 -4
- package/package.json +11 -6
package/dist/composition.d.ts
CHANGED
|
@@ -41,6 +41,20 @@ 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
|
+
declare function colorContrast(foreground: string, background: string): number | undefined;
|
|
45
|
+
/** Keep an inherited text color at >=4.5:1; otherwise select black or white.
|
|
46
|
+
* Callers must preserve explicit text-color overrides before using this fallback.
|
|
47
|
+
* An unresolved/translucent fill preserves the preferred color, without a contrast claim.
|
|
48
|
+
*/
|
|
49
|
+
declare function textColorForFill(fill: string, preferred: string): string;
|
|
50
|
+
/** Keep an inherited chart mark at >=3:1 against its opaque panel. Otherwise
|
|
51
|
+
* mix toward black or white in bounded 1/255 steps, choosing the first passing
|
|
52
|
+
* step (higher contrast breaks a tie). This retains a recognizable palette;
|
|
53
|
+
* it does not establish distinction between adjacent series or colorblind safety.
|
|
54
|
+
* Explicit mark overrides belong to the caller; unresolved alpha is preserved.
|
|
55
|
+
*/
|
|
56
|
+
declare function chartColorForFill(fill: string, preferred: string): string;
|
|
57
|
+
|
|
44
58
|
/** Portable layout geometry. No fonts, DOM, renderer, or network dependencies. */
|
|
45
59
|
interface Composition {
|
|
46
60
|
mode?: "auto" | "grid" | "row" | "column";
|
|
@@ -59,15 +73,22 @@ interface LayoutBox {
|
|
|
59
73
|
height: number;
|
|
60
74
|
}
|
|
61
75
|
interface LayoutDiagnostic {
|
|
62
|
-
code: "text-overflow" | "small-cell";
|
|
76
|
+
code: "text-overflow" | "small-cell" | "unresolved-content";
|
|
63
77
|
path: string;
|
|
64
78
|
message: string;
|
|
65
79
|
}
|
|
80
|
+
/** Physical legacy-family selection supplied by a font provider, independently of its numeric weight. */
|
|
81
|
+
interface FontFaceSelection {
|
|
82
|
+
family: string;
|
|
83
|
+
bold: boolean;
|
|
84
|
+
italic: boolean;
|
|
85
|
+
}
|
|
66
86
|
interface TextStyle {
|
|
67
87
|
fontFamily: string;
|
|
68
88
|
fontWeight: number;
|
|
69
89
|
italic?: boolean;
|
|
70
90
|
path?: string;
|
|
91
|
+
fontFace?: FontFaceSelection;
|
|
71
92
|
}
|
|
72
93
|
interface FontFamilies {
|
|
73
94
|
heading: string;
|
|
@@ -78,16 +99,48 @@ declare function resolveFontFamilies(input: unknown): FontFamilies;
|
|
|
78
99
|
interface TextMeasurement {
|
|
79
100
|
measure: (text: string, fontSize: number, style: TextStyle) => number;
|
|
80
101
|
resolveStyle?: (style: TextStyle) => TextStyle;
|
|
102
|
+
/** Shaped vector ink relative to the left baseline origin (positive y down).
|
|
103
|
+
* Null means no outline. These are not hinted/antialiased raster bounds. */
|
|
104
|
+
outlineBounds?: (text: string, fontSize: number, style: TextStyle) => LayoutBox | null;
|
|
81
105
|
}
|
|
82
106
|
type MeasureTextWidth = (text: string, fontSize: number) => number;
|
|
83
107
|
declare function resolveTextStyle(style: TextStyle, measurement?: TextMeasurement): TextStyle;
|
|
84
108
|
declare function textWidthMeasurer(style: TextStyle, measurement?: TextMeasurement): MeasureTextWidth;
|
|
109
|
+
/** Validate an optional host outline measurement without inventing raster coverage. */
|
|
110
|
+
declare function measureTextOutline(text: string, fontSize: number, style: TextStyle, measurement?: TextMeasurement): LayoutBox | null | undefined;
|
|
111
|
+
interface TextLineInk {
|
|
112
|
+
width: number;
|
|
113
|
+
y: number;
|
|
114
|
+
baseline: number;
|
|
115
|
+
height: number;
|
|
116
|
+
outline: LayoutBox | null;
|
|
117
|
+
}
|
|
118
|
+
interface TextPlacementLine {
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
baseline: number;
|
|
122
|
+
height: number;
|
|
123
|
+
width: number;
|
|
124
|
+
outline: LayoutBox | null;
|
|
125
|
+
}
|
|
126
|
+
interface TextPlacement {
|
|
127
|
+
alignment: 'left' | 'center' | 'right';
|
|
128
|
+
/** Reference-pixel clearance around vector outlines; not a universal raster guarantee. */
|
|
129
|
+
rasterPadding: number;
|
|
130
|
+
lines: TextPlacementLine[];
|
|
131
|
+
height: number;
|
|
132
|
+
overflow: boolean;
|
|
133
|
+
}
|
|
85
134
|
interface TextFit {
|
|
86
135
|
lines: string[];
|
|
87
136
|
fontSize: number;
|
|
88
137
|
lineHeight: number;
|
|
89
138
|
overflow: boolean;
|
|
139
|
+
placement?: TextPlacement;
|
|
90
140
|
}
|
|
141
|
+
/** Place complete measured lines, preserving alignment where it leaves room for ink.
|
|
142
|
+
* Move following baselines together when outlines need more vertical separation. */
|
|
143
|
+
declare function placeTextLines(lines: readonly TextLineInk[], box: LayoutBox, alignment?: TextPlacement['alignment'], rasterPadding?: number): TextPlacement;
|
|
91
144
|
interface ComposedItem {
|
|
92
145
|
path: string;
|
|
93
146
|
field: string;
|
|
@@ -95,12 +148,18 @@ interface ComposedItem {
|
|
|
95
148
|
value: unknown;
|
|
96
149
|
payload: Record<string, unknown>;
|
|
97
150
|
box: LayoutBox;
|
|
151
|
+
/** Optional visible card allocation; box and all accepted internals occupy its padded interior. */
|
|
152
|
+
frameBox?: LayoutBox;
|
|
98
153
|
text?: TextFit | RichTextFit | ListFit | CodeTextFit;
|
|
99
154
|
textStyle?: TextStyle;
|
|
100
155
|
/** Complete accepted quote internals; consumers must reuse these fits and styles. */
|
|
101
156
|
quoteLayout?: QuoteLayout;
|
|
102
157
|
/** Complete accepted code internals, including source lines and literal tab positions. */
|
|
103
158
|
codeLayout?: CodeLayout;
|
|
159
|
+
/** Complete shared metric geometry, including its unit, label and metadata. */
|
|
160
|
+
metricLayout?: MetricLayout;
|
|
161
|
+
/** Complete timeline fields, markers and connector accepted by composition. */
|
|
162
|
+
timelineLayout?: TimelineLayout;
|
|
104
163
|
/** Effective container settings, including inherited readability constraints. */
|
|
105
164
|
composition: Composition;
|
|
106
165
|
}
|
|
@@ -125,7 +184,7 @@ interface ComposedFlow {
|
|
|
125
184
|
itemCount: number;
|
|
126
185
|
slotCount: number;
|
|
127
186
|
}
|
|
128
|
-
/** Additive penalties in grid-score-
|
|
187
|
+
/** Additive penalties in grid-score-v9; lower is preferred. These are not quality percentages. */
|
|
129
188
|
interface CompositionPenalties {
|
|
130
189
|
cellProportions: number;
|
|
131
190
|
fontReduction: number;
|
|
@@ -149,9 +208,13 @@ interface CompositionDecision {
|
|
|
149
208
|
candidates: CompositionCandidate[];
|
|
150
209
|
}
|
|
151
210
|
interface CompositionExplanation {
|
|
152
|
-
algorithm: 'grid-score-
|
|
211
|
+
algorithm: 'grid-score-v9';
|
|
153
212
|
/** Provided widths do not establish shaping, glyph coverage or native fidelity. */
|
|
154
213
|
textMeasurement: 'estimated' | 'provided';
|
|
214
|
+
/** Optional vector coverage for headings and scalar/rich text, not every payload. */
|
|
215
|
+
textOutlines: 'provided' | 'unavailable';
|
|
216
|
+
/** Effective body-text reference pixels; furniture reports its own placement padding. Not a universal raster tolerance. */
|
|
217
|
+
textRasterPadding: number;
|
|
155
218
|
decisions: CompositionDecision[];
|
|
156
219
|
/** Payloads whose complete internal fit is not covered by this scoring model. */
|
|
157
220
|
unmeasuredPayloads: string[];
|
|
@@ -165,10 +228,29 @@ interface SlideComposition {
|
|
|
165
228
|
flows: ComposedFlow[];
|
|
166
229
|
diagnostics: LayoutDiagnostic[];
|
|
167
230
|
composition: Composition;
|
|
231
|
+
/** Repeated furniture is measured separately from body pagination leaves. */
|
|
232
|
+
furniture?: FurnitureLayout;
|
|
168
233
|
explanation?: CompositionExplanation;
|
|
169
234
|
}
|
|
170
235
|
interface ComposeSlideOptions {
|
|
236
|
+
/** Context for inherited furniture and generated organization names. */
|
|
237
|
+
presentation?: {
|
|
238
|
+
design?: {
|
|
239
|
+
header?: unknown;
|
|
240
|
+
footer?: unknown;
|
|
241
|
+
};
|
|
242
|
+
organization?: unknown;
|
|
243
|
+
};
|
|
244
|
+
/** One-based displayed number; source paths still use slideIndex. */
|
|
245
|
+
slideNumber?: number;
|
|
171
246
|
fonts?: Partial<FontFamilies>;
|
|
247
|
+
/** Host-resolved alignment for shared content; slide design can override it. */
|
|
248
|
+
contentAlignment?: 'left' | 'center' | 'right';
|
|
249
|
+
titleAlignment?: 'left' | 'center' | 'right';
|
|
250
|
+
/** Unscaled reference pixels around provided vector outlines; defaults to 1 for body text and 2 for furniture. Explicit values apply to both. */
|
|
251
|
+
textRasterPadding?: number;
|
|
252
|
+
/** Host-resolved body cards. A slide's explicit design.contentBox overrides this value. */
|
|
253
|
+
contentBox?: boolean;
|
|
172
254
|
textMeasurement?: TextMeasurement;
|
|
173
255
|
width?: number;
|
|
174
256
|
height?: number;
|
|
@@ -183,10 +265,50 @@ declare class OPFCompositionError extends Error {
|
|
|
183
265
|
readonly explanation?: CompositionExplanation;
|
|
184
266
|
constructor(diagnostics: LayoutDiagnostic[], explanation?: CompositionExplanation);
|
|
185
267
|
}
|
|
268
|
+
interface FurniturePartBase {
|
|
269
|
+
kind: 'header' | 'footer';
|
|
270
|
+
zone: 'left' | 'center' | 'right';
|
|
271
|
+
field: 'text' | 'image' | 'organization' | 'section' | 'slideNumber' | 'date';
|
|
272
|
+
/** Literal field or controlling flag, with the actual inherited/local path. */
|
|
273
|
+
path: string;
|
|
274
|
+
/** String/asset source, when different from a generated field's flag. */
|
|
275
|
+
sourcePath?: string;
|
|
276
|
+
generated: boolean;
|
|
277
|
+
box: LayoutBox;
|
|
278
|
+
alignment: 'left' | 'center' | 'right';
|
|
279
|
+
}
|
|
280
|
+
interface FurnitureTextPart extends FurniturePartBase {
|
|
281
|
+
type: 'text';
|
|
282
|
+
text: string;
|
|
283
|
+
style: TextStyle;
|
|
284
|
+
requestedFontSize: number;
|
|
285
|
+
minFontSize: number;
|
|
286
|
+
fit: SourceTextFit;
|
|
287
|
+
}
|
|
288
|
+
interface FurnitureImagePart extends FurniturePartBase {
|
|
289
|
+
type: 'image';
|
|
290
|
+
image: unknown;
|
|
291
|
+
}
|
|
292
|
+
type FurniturePart = FurnitureTextPart | FurnitureImagePart;
|
|
293
|
+
interface FurnitureLayout {
|
|
294
|
+
algorithm: 'furniture-flow-v2';
|
|
295
|
+
/** Includes explicitly empty definitions, which override inherited furniture. */
|
|
296
|
+
configured: boolean;
|
|
297
|
+
textMeasurement: 'estimated' | 'provided';
|
|
298
|
+
textOutlines: 'provided' | 'unavailable';
|
|
299
|
+
parts: FurniturePart[];
|
|
300
|
+
/** Outer occupied edges; composeSlide adds its normal content gap. */
|
|
301
|
+
headerBottom: number;
|
|
302
|
+
footerTop: number;
|
|
303
|
+
diagnostics: LayoutDiagnostic[];
|
|
304
|
+
overflow: boolean;
|
|
305
|
+
}
|
|
306
|
+
/** Resolve and measure repeated fields without mutating metadata or consulting a clock. */
|
|
307
|
+
declare function layoutFurniture(input: unknown, options?: ComposeSlideOptions): FurnitureLayout;
|
|
186
308
|
/** Deterministic estimate, not a font shaping engine. Preserves explicit line breaks. */
|
|
187
309
|
declare function measureText(text: string, fontSize: number): number;
|
|
188
310
|
declare function wrapText(text: string, width: number, fontSize: number, measure?: MeasureTextWidth): string[];
|
|
189
|
-
declare function fitText(text: string, box: LayoutBox, requestedSize?: number, minFontSize?: number, measure?: MeasureTextWidth):
|
|
311
|
+
declare function fitText(text: string, box: LayoutBox, requestedSize?: number, minFontSize?: number, measure?: MeasureTextWidth): SourceTextFit;
|
|
190
312
|
interface QuoteContent {
|
|
191
313
|
text: string;
|
|
192
314
|
attribution?: string;
|
|
@@ -240,12 +362,132 @@ interface QuoteLayoutOptions {
|
|
|
240
362
|
* check overflow before accepting the parts. Line boxes are not shaped glyph or native raster bounds.
|
|
241
363
|
*/
|
|
242
364
|
declare function layoutQuote(value: string | QuoteContent, box: LayoutBox, options?: QuoteLayoutOptions): QuoteLayout;
|
|
365
|
+
interface MetricContent {
|
|
366
|
+
value: string | number;
|
|
367
|
+
label?: string;
|
|
368
|
+
description?: string;
|
|
369
|
+
unit?: string;
|
|
370
|
+
delta?: string | number;
|
|
371
|
+
trend?: 'up' | 'down' | 'flat';
|
|
372
|
+
}
|
|
373
|
+
/** Ranges address String(sourceValue), not the numeric token spelling in serialized JSON. */
|
|
374
|
+
interface MetricTextSource {
|
|
375
|
+
path: string;
|
|
376
|
+
value: string | number;
|
|
377
|
+
start: number;
|
|
378
|
+
end: number;
|
|
379
|
+
}
|
|
380
|
+
interface MetricTextPart {
|
|
381
|
+
role: keyof MetricContent;
|
|
382
|
+
path: string;
|
|
383
|
+
text: string;
|
|
384
|
+
sources: MetricTextSource[];
|
|
385
|
+
/** Empty optional fields retain their source mapping but occupy no visible space. */
|
|
386
|
+
visible: boolean;
|
|
387
|
+
/** Accepted absolute origin/baseline for each fit.sourceLines entry, including blank lines. */
|
|
388
|
+
linePositions: {
|
|
389
|
+
x: number;
|
|
390
|
+
baseline: number;
|
|
391
|
+
}[];
|
|
392
|
+
box: LayoutBox;
|
|
393
|
+
requestedFontSize: number;
|
|
394
|
+
minFontSize: number;
|
|
395
|
+
requestedStyle: TextStyle;
|
|
396
|
+
style: TextStyle;
|
|
397
|
+
/** Source-preserving line/segment representation shared with code, with proportional fonts. */
|
|
398
|
+
fit?: CodeTextFit;
|
|
399
|
+
}
|
|
400
|
+
interface MetricLayoutDiagnostic extends LayoutDiagnostic {
|
|
401
|
+
reason: 'invalid-part-box' | 'part-outside-cell' | 'text-fit' | 'part-overlap';
|
|
402
|
+
parts: MetricTextPart['role'][];
|
|
403
|
+
}
|
|
404
|
+
interface MetricLayout {
|
|
405
|
+
algorithm: 'metric-flow-v1';
|
|
406
|
+
alignment: 'left' | 'center' | 'right';
|
|
407
|
+
textMeasurement: 'estimated' | 'provided';
|
|
408
|
+
arrangement: 'inline-unit' | 'stacked';
|
|
409
|
+
/** At most 48 arrangements; value fitting is bounded by 77 reference-size trials per arrangement. */
|
|
410
|
+
attempts: number;
|
|
411
|
+
parts: MetricTextPart[];
|
|
412
|
+
diagnostics: MetricLayoutDiagnostic[];
|
|
413
|
+
overflow: boolean;
|
|
414
|
+
}
|
|
415
|
+
interface MetricLayoutOptions extends QuoteLayoutOptions {
|
|
416
|
+
align?: 'left' | 'center' | 'right';
|
|
417
|
+
/** Unscaled clearance around available vector outlines; defaults to one reference pixel. */
|
|
418
|
+
textRasterPadding?: number;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Measure every metric field before accepting geometry. Short single-line values and units can
|
|
422
|
+
* share a baseline; longer values or units stack. No locale formatting, trend icons or rewritten
|
|
423
|
+
* source text are invented. Consumers must reuse these accepted parts and source ranges.
|
|
424
|
+
*/
|
|
425
|
+
declare function layoutMetric(value: string | number | MetricContent, box: LayoutBox, options?: MetricLayoutOptions): MetricLayout;
|
|
426
|
+
interface TimelineEvent {
|
|
427
|
+
when?: string;
|
|
428
|
+
what: string;
|
|
429
|
+
description?: string;
|
|
430
|
+
}
|
|
431
|
+
interface TimelineContent {
|
|
432
|
+
name?: string;
|
|
433
|
+
description?: string;
|
|
434
|
+
events: TimelineEvent[];
|
|
435
|
+
}
|
|
436
|
+
interface TimelineTextPart {
|
|
437
|
+
role: 'name' | 'description' | 'when' | 'what' | 'event-description';
|
|
438
|
+
eventIndex?: number;
|
|
439
|
+
path: string;
|
|
440
|
+
text: string;
|
|
441
|
+
sources: {
|
|
442
|
+
path: string;
|
|
443
|
+
start: number;
|
|
444
|
+
end: number;
|
|
445
|
+
}[];
|
|
446
|
+
box: LayoutBox;
|
|
447
|
+
alignment: 'left' | 'center';
|
|
448
|
+
requestedFontSize: number;
|
|
449
|
+
minFontSize: number;
|
|
450
|
+
requestedStyle: TextStyle;
|
|
451
|
+
style: TextStyle;
|
|
452
|
+
fit?: SourceTextFit;
|
|
453
|
+
}
|
|
454
|
+
interface TimelineLayoutDiagnostic extends LayoutDiagnostic {
|
|
455
|
+
reason: 'text-fit' | 'part-outside-cell' | 'event-space';
|
|
456
|
+
}
|
|
457
|
+
interface TimelineLayout {
|
|
458
|
+
algorithm: 'timeline-flow-v1';
|
|
459
|
+
arrangement: 'alternating' | 'vertical';
|
|
460
|
+
attempts: number;
|
|
461
|
+
textMeasurement: 'provided' | 'estimated';
|
|
462
|
+
textOutlines: 'provided' | 'unavailable';
|
|
463
|
+
parts: TimelineTextPart[];
|
|
464
|
+
markers: {
|
|
465
|
+
path: string;
|
|
466
|
+
eventIndex: number;
|
|
467
|
+
x: number;
|
|
468
|
+
y: number;
|
|
469
|
+
radius: number;
|
|
470
|
+
}[];
|
|
471
|
+
connector: {
|
|
472
|
+
x1: number;
|
|
473
|
+
y1: number;
|
|
474
|
+
x2: number;
|
|
475
|
+
y2: number;
|
|
476
|
+
};
|
|
477
|
+
diagnostics: TimelineLayoutDiagnostic[];
|
|
478
|
+
overflow: boolean;
|
|
479
|
+
}
|
|
480
|
+
interface TimelineLayoutOptions extends QuoteLayoutOptions {
|
|
481
|
+
textRasterPadding?: number;
|
|
482
|
+
}
|
|
483
|
+
/** Preserve event order and field boundaries while trying at most 50 readable arrangements. */
|
|
484
|
+
declare function layoutTimeline(value: readonly TimelineEvent[] | TimelineContent, box: LayoutBox, options?: TimelineLayoutOptions): TimelineLayout;
|
|
243
485
|
interface CodeContent {
|
|
244
486
|
source: string;
|
|
245
487
|
language?: string;
|
|
246
488
|
filename?: string;
|
|
247
489
|
}
|
|
248
|
-
interface
|
|
490
|
+
interface TextLineSegment {
|
|
249
491
|
kind: 'text' | 'tab';
|
|
250
492
|
start: number;
|
|
251
493
|
end: number;
|
|
@@ -254,21 +496,26 @@ interface CodeLineSegment {
|
|
|
254
496
|
width: number;
|
|
255
497
|
}
|
|
256
498
|
/** Exact half-open UTF-16 offsets into the part text, including consumed hard line breaks. */
|
|
257
|
-
interface
|
|
499
|
+
interface TextLineSource {
|
|
258
500
|
start: number;
|
|
259
501
|
end: number;
|
|
260
502
|
nextStart: number;
|
|
261
503
|
boundary: 'soft' | 'hard' | 'end';
|
|
262
504
|
width: number;
|
|
263
505
|
/** Explicit tab placement is required in SVG; CSS tab-size alone does not implement it. */
|
|
264
|
-
segments:
|
|
506
|
+
segments: TextLineSegment[];
|
|
265
507
|
}
|
|
266
|
-
interface
|
|
267
|
-
sourceLines:
|
|
508
|
+
interface SourceTextFit extends TextFit {
|
|
509
|
+
sourceLines: TextLineSource[];
|
|
268
510
|
/** Tabs advance to the next multiple of four measured spaces from each displayed line's origin. */
|
|
269
511
|
tabSize: 4;
|
|
270
512
|
tabWidth: number;
|
|
271
513
|
}
|
|
514
|
+
/** Compatibility names for the shared source-preserving line contract. */
|
|
515
|
+
type CodeLineSegment = TextLineSegment;
|
|
516
|
+
type CodeLineSource = TextLineSource;
|
|
517
|
+
interface CodeTextFit extends SourceTextFit {
|
|
518
|
+
}
|
|
272
519
|
interface CodeTextPart {
|
|
273
520
|
role: 'filename' | 'language' | 'body';
|
|
274
521
|
path: string;
|
|
@@ -426,4 +673,4 @@ declare function resolveCanvasDimensions(input: unknown): {
|
|
|
426
673
|
height: number;
|
|
427
674
|
};
|
|
428
675
|
|
|
429
|
-
export { type CodeContent, type CodeLayout, type CodeLayoutDiagnostic, type CodeLayoutOptions, type CodeLineSegment, type CodeLineSource, type CodeTextFit, type CodeTextPart, type ComposeSlideOptions, type ComposedFlow, type ComposedGroup, type ComposedItem, type Composition, type CompositionCandidate, type CompositionDecision, type CompositionExplanation, type CompositionPenalties, type CompositionTrack, type FontFamilies, type LayoutBox, type LayoutDiagnostic, type ListEntryLayout, type ListFit, type ListText, type ListValue, MAX_COMPOSITION_DEPTH, type MeasureTextWidth, OPFCompositionError, type QuoteContent, type QuoteLayout, type QuoteLayoutDiagnostic, type QuoteLayoutOptions, type QuoteTextPart, type QuoteTextSource, type RichTextFit, type RichTextFragment, type RichTextLine, type RichTextOptions, type RichTextRun, type SlideComposition, type TableBorder, type TableCellLayout, type TableCellStyle, type TableGrid, type TableGridCell, type TableGridIssue, type TableLayout, type TableLayoutOptions, type TableRowLayout, type TextFit, type TextMeasurement, type TextStyle, composeSlide, fitList, fitRichText, fitText, layoutCode, layoutQuote, layoutTable, measureText, resolveCanvasDimensions, resolveFontFamilies, resolveTextStyle, tableGrid, tableRowBoundaries, textWidthMeasurer, wrapText };
|
|
676
|
+
export { type CodeContent, type CodeLayout, type CodeLayoutDiagnostic, type CodeLayoutOptions, type CodeLineSegment, type CodeLineSource, type CodeTextFit, type CodeTextPart, type ComposeSlideOptions, type ComposedFlow, type ComposedGroup, type ComposedItem, type Composition, type CompositionCandidate, type CompositionDecision, type CompositionExplanation, type CompositionPenalties, type CompositionTrack, type FontFaceSelection, type FontFamilies, type FurnitureImagePart, type FurnitureLayout, type FurniturePart, type FurniturePartBase, type FurnitureTextPart, type LayoutBox, type LayoutDiagnostic, type ListEntryLayout, type ListFit, type ListText, type ListValue, MAX_COMPOSITION_DEPTH, type MeasureTextWidth, type MetricContent, type MetricLayout, type MetricLayoutDiagnostic, type MetricLayoutOptions, type MetricTextPart, type MetricTextSource, OPFCompositionError, type QuoteContent, type QuoteLayout, type QuoteLayoutDiagnostic, type QuoteLayoutOptions, type QuoteTextPart, type QuoteTextSource, type RichTextFit, type RichTextFragment, type RichTextLine, type RichTextOptions, type RichTextRun, type SlideComposition, type SourceTextFit, type TableBorder, type TableCellLayout, type TableCellStyle, type TableGrid, type TableGridCell, type TableGridIssue, type TableLayout, type TableLayoutOptions, type TableRowLayout, type TextFit, type TextLineInk, type TextLineSegment, type TextLineSource, type TextMeasurement, type TextPlacement, type TextPlacementLine, type TextStyle, type TimelineContent, type TimelineEvent, type TimelineLayout, type TimelineLayoutDiagnostic, type TimelineLayoutOptions, type TimelineTextPart, chartColorForFill, colorContrast, composeSlide, fitList, fitRichText, fitText, layoutCode, layoutFurniture, layoutMetric, layoutQuote, layoutTable, layoutTimeline, measureText, measureTextOutline, placeTextLines, resolveCanvasDimensions, resolveFontFamilies, resolveTextStyle, tableGrid, tableRowBoundaries, textColorForFill, textWidthMeasurer, wrapText };
|
package/dist/composition.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { MAX_COMPOSITION_DEPTH, OPFCompositionError, composeSlide, fitList, fitRichText, fitText, layoutCode, layoutQuote, layoutTable, measureText, resolveCanvasDimensions, resolveFontFamilies, resolveTextStyle, tableGrid, tableRowBoundaries, textWidthMeasurer, wrapText } from './chunk-
|
|
1
|
+
export { MAX_COMPOSITION_DEPTH, OPFCompositionError, chartColorForFill, colorContrast, composeSlide, fitList, fitRichText, fitText, layoutCode, layoutFurniture, layoutMetric, layoutQuote, layoutTable, layoutTimeline, measureText, measureTextOutline, placeTextLines, resolveCanvasDimensions, resolveFontFamilies, resolveTextStyle, tableGrid, tableRowBoundaries, textColorForFill, textWidthMeasurer, wrapText } from './chunk-PQJRDNA6.js';
|