@openpresentation/opf 0.10.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.
Files changed (38) hide show
  1. package/dist/{catalogs-HCTav5Wv.d.ts → catalogs-DoVmvDr7.d.ts} +5 -5
  2. package/dist/catalogs.d.ts +1 -1
  3. package/dist/catalogs.js +1 -1
  4. package/dist/{chunk-GQSK3T7X.js → chunk-D3GQIREP.js} +13 -4
  5. package/dist/{chunk-NPOKUFEX.js → chunk-EWJNRHXA.js} +3 -3
  6. package/dist/{chunk-TK3QHM3U.js → chunk-FHGJX5QK.js} +24 -12
  7. package/dist/{chunk-BAWLYSUN.js → chunk-PQJRDNA6.js} +109 -6
  8. package/dist/{chunk-OZULJBSG.js → chunk-RS5GZ5RW.js} +14 -0
  9. package/dist/{chunk-TWMRZ43O.js → chunk-TU7I3KSB.js} +59 -21
  10. package/dist/{chunk-GCB6LGJM.js → chunk-ZIL7MGZU.js} +5 -3
  11. package/dist/composition.d.ts +58 -6
  12. package/dist/composition.js +1 -1
  13. package/dist/docs.js +25 -7
  14. package/dist/index.d.ts +2 -2
  15. package/dist/index.js +7 -7
  16. package/dist/lint.d.ts +1 -1
  17. package/dist/lint.js +5 -5
  18. package/dist/pagination.d.ts +2 -0
  19. package/dist/pagination.js +5 -5
  20. package/dist/schemas.js +1 -1
  21. package/dist/spec/catalogs/layouts/extract/canonical.json +45 -21
  22. package/dist/spec/catalogs/layouts/index.json +10 -0
  23. package/dist/spec/catalogs/layouts/number-1x.json +1 -1
  24. package/dist/spec/catalogs/layouts/number-2x.json +2 -2
  25. package/dist/spec/catalogs/layouts/number-3x.json +3 -3
  26. package/dist/spec/catalogs/layouts/number-4x.json +4 -4
  27. package/dist/spec/catalogs/layouts/number-5x.json +5 -5
  28. package/dist/spec/catalogs/layouts/number-6x.json +6 -6
  29. package/dist/spec/catalogs/layouts/quote-1x.json +13 -0
  30. package/dist/spec/catalogs/layouts/timeline-1x.json +13 -0
  31. package/dist/spec/schemas/layout.schema.json +12 -3
  32. package/dist/spec/schemas/narrative.schema.json +1 -1
  33. package/dist/spec-files.d.ts +1 -1
  34. package/dist/spec-files.js +1 -1
  35. package/dist/types.d.ts +1 -1
  36. package/dist/validator.d.ts +1 -1
  37. package/dist/validator.js +4 -4
  38. package/package.json +1 -1
@@ -73,7 +73,7 @@ interface LayoutBox {
73
73
  height: number;
74
74
  }
75
75
  interface LayoutDiagnostic {
76
- code: "text-overflow" | "small-cell";
76
+ code: "text-overflow" | "small-cell" | "unresolved-content";
77
77
  path: string;
78
78
  message: string;
79
79
  }
@@ -184,7 +184,7 @@ interface ComposedFlow {
184
184
  itemCount: number;
185
185
  slotCount: number;
186
186
  }
187
- /** Additive penalties in grid-score-v8; lower is preferred. These are not quality percentages. */
187
+ /** Additive penalties in grid-score-v9; lower is preferred. These are not quality percentages. */
188
188
  interface CompositionPenalties {
189
189
  cellProportions: number;
190
190
  fontReduction: number;
@@ -208,12 +208,12 @@ interface CompositionDecision {
208
208
  candidates: CompositionCandidate[];
209
209
  }
210
210
  interface CompositionExplanation {
211
- algorithm: 'grid-score-v8';
211
+ algorithm: 'grid-score-v9';
212
212
  /** Provided widths do not establish shaping, glyph coverage or native fidelity. */
213
213
  textMeasurement: 'estimated' | 'provided';
214
214
  /** Optional vector coverage for headings and scalar/rich text, not every payload. */
215
215
  textOutlines: 'provided' | 'unavailable';
216
- /** Effective canvas reference pixels; not a universal raster tolerance. */
216
+ /** Effective body-text reference pixels; furniture reports its own placement padding. Not a universal raster tolerance. */
217
217
  textRasterPadding: number;
218
218
  decisions: CompositionDecision[];
219
219
  /** Payloads whose complete internal fit is not covered by this scoring model. */
@@ -228,14 +228,26 @@ interface SlideComposition {
228
228
  flows: ComposedFlow[];
229
229
  diagnostics: LayoutDiagnostic[];
230
230
  composition: Composition;
231
+ /** Repeated furniture is measured separately from body pagination leaves. */
232
+ furniture?: FurnitureLayout;
231
233
  explanation?: CompositionExplanation;
232
234
  }
233
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;
234
246
  fonts?: Partial<FontFamilies>;
235
247
  /** Host-resolved alignment for shared content; slide design can override it. */
236
248
  contentAlignment?: 'left' | 'center' | 'right';
237
249
  titleAlignment?: 'left' | 'center' | 'right';
238
- /** Unscaled reference pixels around provided vector outlines; defaults to 1. */
250
+ /** Unscaled reference pixels around provided vector outlines; defaults to 1 for body text and 2 for furniture. Explicit values apply to both. */
239
251
  textRasterPadding?: number;
240
252
  /** Host-resolved body cards. A slide's explicit design.contentBox overrides this value. */
241
253
  contentBox?: boolean;
@@ -253,6 +265,46 @@ declare class OPFCompositionError extends Error {
253
265
  readonly explanation?: CompositionExplanation;
254
266
  constructor(diagnostics: LayoutDiagnostic[], explanation?: CompositionExplanation);
255
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;
256
308
  /** Deterministic estimate, not a font shaping engine. Preserves explicit line breaks. */
257
309
  declare function measureText(text: string, fontSize: number): number;
258
310
  declare function wrapText(text: string, width: number, fontSize: number, measure?: MeasureTextWidth): string[];
@@ -621,4 +673,4 @@ declare function resolveCanvasDimensions(input: unknown): {
621
673
  height: number;
622
674
  };
623
675
 
624
- 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 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, layoutMetric, layoutQuote, layoutTable, layoutTimeline, measureText, measureTextOutline, placeTextLines, resolveCanvasDimensions, resolveFontFamilies, resolveTextStyle, tableGrid, tableRowBoundaries, textColorForFill, 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 };
@@ -1 +1 @@
1
- export { MAX_COMPOSITION_DEPTH, OPFCompositionError, chartColorForFill, colorContrast, composeSlide, fitList, fitRichText, fitText, layoutCode, layoutMetric, layoutQuote, layoutTable, layoutTimeline, measureText, measureTextOutline, placeTextLines, resolveCanvasDimensions, resolveFontFamilies, resolveTextStyle, tableGrid, tableRowBoundaries, textColorForFill, textWidthMeasurer, wrapText } from './chunk-BAWLYSUN.js';
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';