@openpresentation/opf 0.11.4 → 0.12.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 (74) hide show
  1. package/README.md +16 -0
  2. package/dist/audit.d.ts +156 -0
  3. package/dist/audit.js +7 -0
  4. package/dist/{catalogs-CUClB3nl.d.ts → catalogs-BnI7JKcn.d.ts} +3 -3
  5. package/dist/catalogs.d.ts +2 -2
  6. package/dist/catalogs.js +2 -1
  7. package/dist/{chunk-KJKASEPE.js → chunk-4LAM3N6S.js} +753 -42
  8. package/dist/chunk-6LZK2IZB.js +1690 -0
  9. package/dist/{chunk-NSVVQ52O.js → chunk-AUM5MXBR.js} +8 -6
  10. package/dist/{chunk-AEUSVEUY.js → chunk-E34DJ5LL.js} +50 -14
  11. package/dist/chunk-FYLJVF7X.js +18448 -0
  12. package/dist/{chunk-HJL64ETN.js → chunk-GJKJL4YY.js} +14 -0
  13. package/dist/{chunk-3H2U7FDR.js → chunk-HOBSL7AJ.js} +1867 -247
  14. package/dist/chunk-JKVKYVWL.js +1332 -0
  15. package/dist/{chunk-3OJN7QAW.js → chunk-MWPMJE6P.js} +18 -4
  16. package/dist/chunk-RUC7L5DJ.js +261 -0
  17. package/dist/chunk-S5W34SIJ.js +1 -0
  18. package/dist/chunk-V2537ENL.js +198 -0
  19. package/dist/{chunk-RXNFDGPC.js → chunk-WXSPETQ6.js} +311 -40
  20. package/dist/{composition-Dl-d9FRj.d.ts → composition-DWbCiMwF.d.ts} +559 -10
  21. package/dist/composition.d.ts +1 -1
  22. package/dist/composition.js +2 -1
  23. package/dist/convert.d.ts +261 -0
  24. package/dist/convert.js +1107 -0
  25. package/dist/diff.d.ts +145 -0
  26. package/dist/diff.js +604 -0
  27. package/dist/docs.js +72 -18
  28. package/dist/examples.d.ts +1 -1
  29. package/dist/examples.js +112 -112
  30. package/dist/font-policy.d.ts +15 -0
  31. package/dist/font-policy.js +1 -1
  32. package/dist/format.d.ts +20 -0
  33. package/dist/format.js +83 -0
  34. package/dist/index.d.ts +173 -24
  35. package/dist/index.js +926 -262
  36. package/dist/lint.d.ts +4 -4
  37. package/dist/lint.js +6 -5
  38. package/dist/markdown.d.ts +74 -0
  39. package/dist/markdown.js +1941 -0
  40. package/dist/pagination.d.ts +1 -1
  41. package/dist/pagination.js +6 -5
  42. package/dist/patch.d.ts +99 -0
  43. package/dist/patch.js +6 -0
  44. package/dist/{presentation-j5PVrqfV.d.ts → presentation-DcF-MZcz.d.ts} +452 -17
  45. package/dist/repo-readme.js +1 -1
  46. package/dist/{schemas-X_NniU4A.d.ts → schemas-BSjlG8-R.d.ts} +28 -0
  47. package/dist/schemas.d.ts +1 -1
  48. package/dist/schemas.js +1 -1
  49. package/dist/spec/catalogs/audiences/customers.json +5 -1
  50. package/dist/spec/catalogs/audiences/executives.json +5 -1
  51. package/dist/spec/catalogs/audiences/index.json +20 -8
  52. package/dist/spec/catalogs/audiences/investors.json +5 -1
  53. package/dist/spec/catalogs/audiences/marketing-team.json +5 -1
  54. package/dist/spec/catalogs/audiences/regulators.json +5 -1
  55. package/dist/spec/catalogs/audiences/sales-team.json +5 -1
  56. package/dist/spec/catalogs/manifest.json +2 -2
  57. package/dist/spec/reference/engine-defaults.json +1 -1
  58. package/dist/spec/reference/font-policy.json +311 -40
  59. package/dist/spec/reference/font-policy.schema.json +40 -0
  60. package/dist/spec/reference/symbol-font-encodings.json +18354 -0
  61. package/dist/spec/reference/symbol-font-encodings.schema.json +156 -0
  62. package/dist/spec/schemas/audience.schema.json +7 -7
  63. package/dist/spec/schemas/narrative.schema.json +1 -1
  64. package/dist/spec/schemas/opf.schema.json +597 -28
  65. package/dist/spec-files.d.ts +1 -1
  66. package/dist/spec-files.js +1 -1
  67. package/dist/symbol-font-encodings.d.ts +128 -0
  68. package/dist/symbol-font-encodings.js +1 -0
  69. package/dist/types.d.ts +4 -4
  70. package/dist/validator-DfG9yxba.d.ts +172 -0
  71. package/dist/validator.d.ts +4 -36
  72. package/dist/validator.js +5 -4
  73. package/package.json +32 -3
  74. package/dist/chunk-FDCWQHWO.js +0 -1366
@@ -52,6 +52,21 @@ interface FontReplacement {
52
52
  * draws this replacement. `measured` is taken with them off, and a metric claim holds only with them
53
53
  * off (Georgia -> Gelasio: Gelasio ligates fi/fl where Georgia does not). */
54
54
  disabledFeatures?: string[];
55
+ /** Preview-only font-size multiplier (RR-38). A renderer scales the replacement's font size by this factor when it
56
+ * measures and draws it, so its advances approximate the real font's (Arabic Typesetting is 0.64 of Noto Naskh Arabic's
57
+ * width at the same size). It applies only when the face drawn is `family`, and never reaches a PPTX or the geometry core
58
+ * composes. Absent means 1. */
59
+ sizeAdjust?: number;
60
+ /** Preview-only baseline offset (RR-38): em of the font size from the top of a line box to the baseline in PowerPoint (100 percent
61
+ * line spacing, zero insets) when every run of the line is drawn in the real font. A renderer that places baselines one em below
62
+ * the line top moves the replacement's runs up by `1 - lineAscent` em. Requires `sizeAdjust`. */
63
+ lineAscent?: number;
64
+ /** `lineAscent` for a line that also holds runs in other fonts; `lineAscent` when absent. */
65
+ lineAscentMixed?: number;
66
+ /** How `lineAscent` was measured. Present with `lineAscent`. */
67
+ lineAscentBasis?: string;
68
+ /** How `sizeAdjust` was measured (corpus, reference font version, advance and ink ratios). Present with `sizeAdjust`. */
69
+ sizeAdjustBasis?: string;
55
70
  /** Null when the reference font was not available to the measuring host. */
56
71
  measured: FontReplacementMeasurement | null;
57
72
  /** Upstream statement of compatibility, when one exists. */
@@ -1 +1 @@
1
- export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-RXNFDGPC.js';
1
+ export { FONT_POLICY, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './chunk-WXSPETQ6.js';
@@ -0,0 +1,20 @@
1
+ declare class FormatError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ interface FormatOptions {
5
+ /** Spaces per indentation level. Default 2. */
6
+ indent?: number;
7
+ /** Line endings: "lf" (default, canonical) or "crlf" (for Windows checkouts with autocrlf). */
8
+ eol?: "lf" | "crlf";
9
+ }
10
+ /** A copy of `document` with canonical key order at every depth. Values and array order are unchanged. */
11
+ declare function sortPresentationKeys<T>(document: T): T;
12
+ /**
13
+ * Canonical text for an OPF document. `input` is either JSON source text or
14
+ * a parsed document. Throws `FormatError` for text that is not JSON.
15
+ */
16
+ declare function formatPresentation(input: unknown, options?: FormatOptions): string;
17
+ /** True when `source` is already exactly the canonical text. */
18
+ declare function isFormatted(source: string, options?: FormatOptions): boolean;
19
+
20
+ export { FormatError, type FormatOptions, formatPresentation, isFormatted, sortPresentationKeys };
package/dist/format.js ADDED
@@ -0,0 +1,83 @@
1
+ import { presentation } from './chunk-4LAM3N6S.js';
2
+
3
+ // src/format.ts
4
+ var FormatError = class extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.name = "FormatError";
8
+ }
9
+ };
10
+ var root = presentation;
11
+ var flattenCache = /* @__PURE__ */ new WeakMap();
12
+ function collect(schema, seen) {
13
+ if (!schema || typeof schema !== "object" || seen.has(schema)) return [];
14
+ seen.add(schema);
15
+ const node = schema;
16
+ const out = [node];
17
+ if (typeof node.$ref === "string" && node.$ref.startsWith("#/$defs/")) out.push(...collect(root.$defs?.[node.$ref.slice("#/$defs/".length)], seen));
18
+ for (const list of [node.oneOf, node.anyOf, node.allOf]) for (const branch of list ?? []) out.push(...collect(branch, seen));
19
+ out.push(...collect(node.then, seen), ...collect(node.else, seen));
20
+ return out;
21
+ }
22
+ function flatten(schema) {
23
+ if (!schema || typeof schema !== "object") return [];
24
+ const cached = flattenCache.get(schema);
25
+ if (cached) return cached;
26
+ const nodes = collect(schema, /* @__PURE__ */ new Set());
27
+ flattenCache.set(schema, nodes);
28
+ return nodes;
29
+ }
30
+ var own = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
31
+ function arrange(value, schemas) {
32
+ if (Array.isArray(value)) {
33
+ const itemSchemas = schemas.flatMap((node) => node.items && typeof node.items === "object" ? flatten(node.items) : []);
34
+ return value.map((item) => arrange(item, itemSchemas));
35
+ }
36
+ if (!value || typeof value !== "object") return value;
37
+ const record = value;
38
+ const declared = [];
39
+ const seen = /* @__PURE__ */ new Set();
40
+ for (const node of schemas) for (const key of Object.keys(node.properties ?? {})) if (!seen.has(key)) {
41
+ seen.add(key);
42
+ declared.push(key);
43
+ }
44
+ const present = Object.keys(record);
45
+ const ordered = [...declared.filter((key) => own(record, key)), ...present.filter((key) => !seen.has(key))];
46
+ const out = {};
47
+ for (const key of ordered) {
48
+ let children = schemas.flatMap((node) => node.properties && own(node.properties, key) ? flatten(node.properties[key]) : []);
49
+ if (!children.length && !seen.has(key)) children = schemas.flatMap((node) => node.additionalProperties && typeof node.additionalProperties === "object" ? flatten(node.additionalProperties) : []);
50
+ Object.defineProperty(out, key, { value: arrange(record[key], children), enumerable: true, configurable: true, writable: true });
51
+ }
52
+ return out;
53
+ }
54
+ function sortPresentationKeys(document) {
55
+ return arrange(document, flatten(root));
56
+ }
57
+ function formatPresentation(input, options = {}) {
58
+ let document = input;
59
+ if (typeof input === "string") {
60
+ try {
61
+ document = JSON.parse(input.replace(/^/u, ""));
62
+ } catch (error) {
63
+ throw new FormatError(`Invalid JSON: ${error.message}`);
64
+ }
65
+ }
66
+ const indent = options.indent ?? 2;
67
+ if (!Number.isInteger(indent) || indent < 0 || indent > 8) throw new FormatError("indent must be an integer from 0 to 8.");
68
+ if (options.eol !== void 0 && options.eol !== "lf" && options.eol !== "crlf") throw new FormatError("eol must be lf or crlf.");
69
+ const text = JSON.stringify(sortPresentationKeys(document), null, indent);
70
+ if (text === void 0) throw new FormatError("Nothing to format.");
71
+ return options.eol === "crlf" ? `${text.replaceAll("\n", "\r\n")}\r
72
+ ` : `${text}
73
+ `;
74
+ }
75
+ function isFormatted(source, options = {}) {
76
+ try {
77
+ return formatPresentation(source, options) === source;
78
+ } catch {
79
+ return false;
80
+ }
81
+ }
82
+
83
+ export { FormatError, formatPresentation, isFormatted, sortPresentationKeys };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,18 @@
1
- export { S as SchemaEntry, a as SchemaName, b as audience, c as chartType, d as colorScheme, f as fontScheme, l as language, e as layout, n as narrative, p as presentation, g as purpose, s as schemaEntries, h as schemaNames, i as schemas, j as socialPlatform, t as theme, k as tone } from './schemas-X_NniU4A.js';
2
- import { C as CatalogKind } from './catalogs-CUClB3nl.js';
3
- export { A as Audience, a as CatalogEntry, b as CatalogIndex, c as CatalogIndexRecord, d as CatalogRecord, e as ChartType, f as ColorScheme, F as FontScheme, L as Language, g as Layout, N as Narrative, P as Purpose, S as SocialPlatform, T as Theme, h as Tone, i as audiences, j as catalogEntries, k as catalogIndexes, l as catalogKinds, m as catalogSchemaNames, n as catalogs, o as chartTypes, p as colorSchemes, q as fontSchemes, r as languages, s as layouts, t as narratives, u as purposes, v as socialPlatforms, w as themes, x as tones } from './catalogs-CUClB3nl.js';
4
- export { OPFValidationError, ValidationIssue, ValidationResult, assertValid, assertValidCatalogRecord, assertValidPresentation, validate, validateCatalogRecord, validatePresentation } from './validator.js';
1
+ export { S as SchemaEntry, a as SchemaName, b as audience, c as chartType, d as colorScheme, f as fontScheme, l as language, e as layout, n as narrative, p as presentation, g as purpose, s as schemaEntries, h as schemaNames, i as schemas, j as socialPlatform, t as theme, k as tone } from './schemas-BSjlG8-R.js';
2
+ import { C as CatalogKind } from './catalogs-BnI7JKcn.js';
3
+ export { A as Audience, a as CatalogEntry, b as CatalogIndex, c as CatalogIndexRecord, d as CatalogRecord, e as ChartType, f as ColorScheme, F as FontScheme, L as Language, g as Layout, N as Narrative, P as Purpose, S as SocialPlatform, T as Theme, h as Tone, i as audiences, j as catalogEntries, k as catalogIndexes, l as catalogKinds, m as catalogSchemaNames, n as catalogs, o as chartTypes, p as colorSchemes, q as fontSchemes, r as languages, s as layouts, t as narratives, u as purposes, v as socialPlatforms, w as themes, x as tones } from './catalogs-BnI7JKcn.js';
4
+ export { D as DEFAULT_VARIABLE_DATE_FORMAT, O as OPFValidationError, a as OPFVariableError, R as ResolveVariablesOptions, b as ResolveVariablesResult, c as VARIABLE_KINDS, d as ValidateOptions, V as ValidationIssue, e as ValidationResult, f as VariableDeclaration, g as VariableDiagnostic, h as VariableDiagnosticCode, i as VariableDiagnosticSeverity, j as VariableInfo, k as VariableKind, l as VariableUse, m as VariableUseForm, n as VariableValues, o as assertValid, p as assertValidCatalogRecord, q as assertValidPresentation, r as coerceVariableValue, s as formatVariableNumber, t as hasContentVariables, u as isTemplate, v as listVariables, w as resolveVariables, x as validate, y as validateCatalogRecord, z as validatePresentation, A as variableDeclarations } from './validator-DfG9yxba.js';
5
5
  export { SpecFileEntry, SpecFileKind, SpecFilePath, specFileEntries, specFileKinds, specFilePaths } from './spec-files.js';
6
6
  export { LayoutPreviewIndex, LayoutPreviewRecord, getLayoutPreview, hasLayoutPreview, layoutPreviewIndex, layoutPreviewSlugs, layoutPreviews } from './previews.js';
7
- export { P as Presentation } from './presentation-j5PVrqfV.js';
7
+ export { P as Presentation } from './presentation-DcF-MZcz.js';
8
8
  export { LintContract, LintDiagnostic, LintLocation, LintOptions, LintReport, LintSeverity, LintSuggestion, lintPresentation, lintSource } from './lint.js';
9
- export { a as CodeContent, b as CodeLayout, c as CodeLayoutDiagnostic, d as CodeLayoutOptions, e as CodeLineSegment, f as CodeLineSource, g as CodeTextFit, h as CodeTextPart, C as ComposeSlideOptions, i as ComposedFlow, j as ComposedGroup, k as ComposedItem, l as ComposedLogo, m as ComposedSlideImage, n as Composition, o as CompositionCandidate, p as CompositionDecision, q as CompositionExplanation, r as CompositionPenalties, s as CompositionTrack, D as DEFAULT_FONT_SCHEME, t as DEFAULT_FURNITURE_DATE_FORMAT, u as DEFAULT_SLIDE_NUMBER_FORMAT, v as FontFamilies, F as FontSchemeDiagnostic, w as FurnitureField, x as FurnitureImagePart, y as FurnitureLayout, z as FurniturePart, A as FurniturePartBase, B as FurnitureSocialLink, E as FurnitureTextExtras, G as FurnitureTextPart, H as LayoutBox, L as LayoutDiagnostic, I as ListBulletImage, J as ListEntryLayout, K as ListFit, M as ListFitOptions, N as ListText, O as ListValue, P as LogoSlot, Q as MAX_COMPOSITION_DEPTH, R as MeasureTextWidth, S as MetricContent, U as MetricLayout, V as MetricLayoutDiagnostic, W as MetricLayoutOptions, X as MetricTextPart, Y as MetricTextSource, Z as OPFCompositionError, _ as PICTURE_BULLET_SCALE, $ as QuoteContent, a0 as QuoteLayout, a1 as QuoteLayoutDiagnostic, a2 as QuoteLayoutOptions, a3 as QuoteTextPart, a4 as QuoteTextSource, a5 as ResolveColorRefOptions, a6 as ResolveColorRefRoles, a7 as ResolveLogoOptions, a8 as ResolvedFontScheme, a9 as ResolvedLogo, aa as RichTextFit, ab as RichTextFragment, ac as RichTextLine, ad as RichTextOptions, ae as RichTextRun, af as SlideComposition, ag as SlideImageShape, ah as SocialPlatformRecord, ai as SocialProfile, aj as TextFit, ak as TextLineInk, T as TextMeasurement, al as TextPlacement, am as TextPlacementLine, an as TextStyle, ao as TimelineContent, ap as TimelineEvent, aq as TimelineLayout, ar as TimelineLayoutDiagnostic, as as TimelineLayoutOptions, at as TimelineTextPart, au as chartColorForFill, av as colorContrast, aw as composeSlide, ax as fitList, ay as fitRichText, az as fitText, aA as formatFurnitureDate, aB as formatSlideNumber, aC as layoutCode, aD as layoutFurniture, aE as layoutMetric, aF as layoutQuote, aG as layoutTimeline, aH as measureText, aI as measureTextOutline, aJ as normalizeHexColor, aK as placeTextLines, aL as resolveCanvasDimensions, aM as resolveColorRef, aN as resolveFontFamilies, aO as resolveFontSchemeReference, aP as resolveLogo, aQ as resolveSocialProfile, aR as resolveTextStyle, aS as textColorForFill, aT as textWidthMeasurer, aU as wrapText } from './composition-Dl-d9FRj.js';
9
+ export { AuditCategory, AuditDiagnostic, AuditFix, AuditOptions, AuditPatchOperation, AuditReport, AuditRuleInfo, AuditSeverity, AuditThresholds, DEFAULT_AUDIT_THRESHOLDS, DEFAULT_CHART_PALETTE, auditPresentation, auditRules, auditSource, findAuditRule } from './audit.js';
10
+ import { M as MetricLayout } from './composition-DWbCiMwF.js';
11
+ export { A as AnnotatedRun, a as AnnotationFitter, b as AnnotationLayoutOptions, c as CAPTIONABLE_FIELDS, d as CAPTION_FONT_RATIO, e as CAPTION_MAX_RATIO, f as CHART_SERIES_MIN_DIFFERENCE, g as CHART_SERIES_MIN_LIGHTNESS_STEP, h as CITATION_MARKER_RAISE, i as CITATION_MARKER_SCALE, j as Caption, k as CaptionAlignment, l as CaptionObject, m as CaptionPosition, n as CaptionSettings, o as ChartLabelContent, p as ChartLabelPosition, q as ChartLegendPosition, r as ChartOptionDiagnostic, s as ChartOptionKind, t as ChartOptionSupport, u as ChartOptionTarget, v as CitationMarker, w as CitationNote, x as CodeContent, y as CodeLayout, z as CodeLayoutDiagnostic, B as CodeLayoutOptions, D as CodeLineSegment, E as CodeLineSource, G as CodeTextFit, H as CodeTextPart, C as ComposeSlideOptions, I as ComposedCaption, J as ComposedFlow, K as ComposedFootnoteEntry, N as ComposedFootnotes, O as ComposedGroup, P as ComposedItem, Q as ComposedLogo, R as ComposedSlideImage, S as Composition, U as CompositionCandidate, V as CompositionDecision, W as CompositionExplanation, X as CompositionPenalties, Y as CompositionTrack, Z as DEFAULT_CHART_LABEL_SEPARATOR, _ as DEFAULT_FONT_SCHEME, $ as DEFAULT_FURNITURE_DATE_FORMAT, a0 as DEFAULT_SLIDE_NUMBER_FORMAT, a1 as DeckCitations, a2 as FONT_SIZE_GRID_PER_PX, a3 as FOOTNOTE_MAX_RATIO, a4 as FontFamilies, F as FontSchemeDiagnostic, a5 as FootnoteLayoutOptions, a6 as FurnitureField, a7 as FurnitureImagePart, a8 as FurnitureLayout, a9 as FurniturePart, aa as FurniturePartBase, ab as FurnitureSocialLink, ac as FurnitureTextExtras, ad as FurnitureTextPart, ae as LayoutBox, L as LayoutDiagnostic, af as ListBulletImage, ag as ListEntryLayout, ah as ListFit, ai as ListFitOptions, aj as ListNumber, ak as ListText, al as ListValue, am as LogoSlot, an as MAX_COMPOSITION_DEPTH, ao as MAX_NUMBERING_LEVELS, ap as MAX_NUMBERING_VALUE, aq as MAX_ROMAN_VALUE, ar as MeasureTextWidth, as as MetricContent, at as MetricLayoutDiagnostic, au as MetricLayoutOptions, av as MetricTextPart, aw as MetricTextSource, ax as NUMBERING_STYLES, ay as NUMBERING_SUFFIXES, az as Numbering, aA as NumberingInput, aB as NumberingStyleName, aC as NumberingSuffix, aD as OPFCompositionError, aE as PICTURE_BULLET_SCALE, aF as PhysicalAlignment, aG as QuoteContent, aH as QuoteLayout, aI as QuoteLayoutDiagnostic, aJ as QuoteLayoutOptions, aK as QuoteTextPart, aL as QuoteTextSource, aM as Reference, aN as ReferencesSlideOptions, aO as ResolveColorRefOptions, aP as ResolveColorRefRoles, aQ as ResolveLogoOptions, aR as ResolvedChartDataLabels, aS as ResolvedChartOptions, aT as ResolvedFontScheme, aU as ResolvedLogo, aV as ResolvedNumbering, aW as RichText, aX as RichTextFit, aY as RichTextFragment, aZ as RichTextLine, a_ as RichTextOptions, a$ as RichTextRun, b0 as SlideCitations, b1 as SlideComposition, b2 as SlideImageShape, b3 as SocialPlatformRecord, b4 as SocialProfile, b5 as TextDirection, b6 as TextFit, b7 as TextLineInk, T as TextMeasurement, b8 as TextPlacement, b9 as TextPlacementLine, ba as TextStyle, bb as TimelineContent, bc as TimelineEvent, bd as TimelineLayout, be as TimelineLayoutDiagnostic, bf as TimelineLayoutOptions, bg as TimelineTextPart, bh as annotationText, bi as captionSettings, bj as chartColorForFill, bk as chartLabelText, bl as chartOptionSupport, bm as chartOptionTarget, bn as chartPaletteForFill, bo as citationMarkerText, bp as collectCitations, bq as colorContrast, br as composeSlide, bs as fitList, bt as fitRichText, bu as fitText, bv as formatChartLabelNumber, bw as formatChartLabelPercent, bx as formatFurnitureDate, by as formatListNumber, bz as formatSlideNumber, bA as layoutCaption, bB as layoutCode, bC as layoutFootnotes, bD as layoutFurniture, bE as layoutMetric, bF as layoutQuote, bG as layoutTimeline, bH as listNumbers, bI as measureText, bJ as measureTextOutline, bK as normalizeHexColor, bL as numberingAtLevel, bM as numberingStyleDraws, bN as paragraphDirection, bO as paragraphDirectionAt, bP as physicalAlignment, bQ as placeTextLines, bR as referencesSlide, bS as resolveCanvasDimensions, bT as resolveChartOptions, bU as resolveColorRef, bV as resolveFontFamilies, bW as resolveFontSchemeReference, bX as resolveLogo, bY as resolveNumbering, bZ as resolveSocialProfile, b_ as resolveTextStyle, b$ as sliceNumberedItems, c0 as slideCitations, c1 as snapFontSizeDown, c2 as snapFontSizeUp, c3 as textColorForFill, c4 as textWidthMeasurer, c5 as walkCitationRuns, c6 as wrapText } from './composition-DWbCiMwF.js';
10
12
  export { OPFPaginationError, PaginatedPage, PaginationMapping, PaginationOptions, PaginationResult, PresentationPaginationOptions, PresentationPaginationResult, paginatePresentation, paginateSlide } from './pagination.js';
11
13
  export { DataCell, DataContentOptions, DataImportOptions, OPFDataImportError, TabularData, createDataContent, parseTabularData } from './data.js';
12
14
  export { FONT_POLICY, FontAvailability, FontAvailabilityCode, FontAvailabilityDiagnostic, FontLicenseClass, FontPolicyDecision, FontPolicyEntry, FontPolicyTable, FontReplacement, FontReplacementCompatibility, FontReplacementMeasurement, applyFontPolicyDecisions, fontAvailabilityDiagnostics, fontPolicyFor } from './font-policy.js';
15
+ export { SYMBOL_FONT_ENCODINGS, SYMBOL_FONT_FAMILIES, SymbolFontCode, SymbolFontEncoding, SymbolFontEncodingTable, SymbolFontFamily, SymbolTextCharacter, isSymbolEncodedFamily, mapSymbolText, symbolCodeForUnicode, symbolCodeOf, symbolFontEncodingFor, symbolUnicodeFor } from './symbol-font-encodings.js';
13
16
 
14
17
  /**
15
18
  * Local catalog vendoring: resolve every catalog reference a presentation
@@ -154,23 +157,7 @@ interface ResolvedScriptFonts extends ScriptFontSlots {
154
157
  complexScript: ScriptFontSource;
155
158
  };
156
159
  }
157
- /** Paragraph base direction. */
158
- type TextDirection = "ltr" | "rtl";
159
- /**
160
- * The base direction of one paragraph in a deck, shared by the renderer and
161
- * the PPTX exporter so preview and export agree. In a right-to-left deck a
162
- * paragraph is right-to-left when its first strong character is
163
- * right-to-left, or when it has no strong character (digits, punctuation or
164
- * empty text); a paragraph whose first strong character is left-to-right
165
- * (for example an English quote or code) stays left-to-right. In a
166
- * left-to-right deck every paragraph is left-to-right.
167
- *
168
- * Strong characters follow UAX #9 rule P2: text inside directional isolates
169
- * (LRI, RLI or FSI up to the matching PDI) is skipped. Letters count as
170
- * strong; RTL letters are those of right-to-left scripts. The result does not
171
- * depend on locale data, only on the JavaScript engine's Unicode tables.
172
- */
173
- declare function paragraphDirection(text: string, deckDirection: TextDirection | string | undefined): TextDirection;
160
+
174
161
  /** The OOXML script slot for an ISO 15924 script code. Unknown scripts use the latin slot. */
175
162
  declare function scriptFontRole(script: string): ScriptRole;
176
163
  /**
@@ -186,5 +173,167 @@ declare function scriptFontRole(script: string): ScriptRole;
186
173
  * language's script uses the slot; otherwise the latin family.
187
174
  */
188
175
  declare function resolveScriptFonts(input: unknown, options?: ResolveScriptFontsOptions): ResolvedScriptFonts;
176
+ /**
177
+ * The deck base direction composition lays a slide out in: the direction of the presentation language's script
178
+ * (`rtl` for Arabic, Hebrew and the other right-to-left scripts), `ltr` when the document names no language or
179
+ * the language does not resolve. Layout, preview and export all read this one value (RR-05).
180
+ */
181
+ declare function resolveSlideDirection(presentation: unknown, slideIndex?: number): "ltr" | "rtl";
182
+
183
+ /**
184
+ * Deterministic syntax highlighting shared by the SVG preview and the PPTX export (RR-07).
185
+ *
186
+ * `tokenizeCode(source, language)` returns coloured token ranges over the exact source
187
+ * string; everything between tokens is plain. `codeSyntaxPalette` derives one colour per
188
+ * token kind from the deck theme and keeps each at WCAG contrast >= 4.5:1 against the code
189
+ * panel. The scanner is a small hand-written one (no dependency, no network, no locale or
190
+ * clock input): it recognises comments, strings, numbers, keywords, definition names, calls,
191
+ * capitalised types and the structure of JSON, YAML, TOML, HTML/XML and CSS. It never edits
192
+ * the text: callers colour ranges of `code.source` and the concatenated runs equal the source.
193
+ * An unknown or missing language yields no tokens (plain text).
194
+ */
195
+ type CodeTokenKind = 'comment' | 'keyword' | 'string' | 'number' | 'function' | 'type' | 'property';
196
+ interface CodeToken {
197
+ start: number;
198
+ end: number;
199
+ kind: CodeTokenKind;
200
+ }
201
+ /** A slice of one source line: `kind` is absent for plain text. */
202
+ interface CodeRun {
203
+ start: number;
204
+ end: number;
205
+ kind?: CodeTokenKind;
206
+ }
207
+ type CodeSyntaxPalette = Record<CodeTokenKind | 'plain', string>;
208
+ /** Source longer than this is left plain: highlighting must stay bounded. */
209
+ declare const CODE_HIGHLIGHT_MAX_LENGTH = 200000;
210
+ /** Contrast the palette keeps against the code panel. */
211
+ declare const CODE_SYNTAX_MIN_CONTRAST = 4.5;
212
+ /** The code panel colour the preview and the PPTX export both draw. */
213
+ declare const CODE_PANEL_BACKGROUND = "#111827";
214
+ declare const CODE_PANEL_FOREGROUND = "#E5E7EB";
215
+ /** Language ids with a scanner (the keys the aliases resolve to). */
216
+ declare const CODE_HIGHLIGHT_LANGUAGES: readonly string[];
217
+ /** The scanner id for a `code.language` value, or undefined when the language is not highlighted. */
218
+ declare function resolveCodeLanguage(language: unknown): string | undefined;
219
+ /**
220
+ * Token ranges of `source` for a `code.language` value, sorted and non-overlapping. Empty for
221
+ * an unknown language, a missing language, or source longer than CODE_HIGHLIGHT_MAX_LENGTH.
222
+ */
223
+ declare function tokenizeCode(source: string, language?: unknown): CodeToken[];
224
+ /**
225
+ * The runs of one source line `[start, end)`: consecutive slices that cover the line exactly.
226
+ * A token that crosses the line boundary is clipped, so each native text line can be coloured
227
+ * on its own while concatenating the runs returns the line text unchanged. With `source`, a tab
228
+ * character is always its own plain run, as in the preview where a tab is a measured segment: a
229
+ * token (a multi-line string, say) never colours a tab stop.
230
+ */
231
+ declare function codeLineRuns(tokens: readonly CodeToken[], start: number, end: number, source?: string): CodeRun[];
232
+ interface CodeSyntaxPaletteOptions {
233
+ background?: string;
234
+ foreground?: string;
235
+ minimumContrast?: number;
236
+ }
237
+ interface CodeSyntaxPaletteTheme {
238
+ primary?: string;
239
+ secondary?: string;
240
+ accent?: string;
241
+ mutedText?: string;
242
+ }
243
+ /**
244
+ * One colour per token kind from the deck theme: keyword = primary, string = accent,
245
+ * number = secondary, comment = a fixed slate; function, type and property take fixed hues
246
+ * (blue, cyan, pink) rotated away from any theme colour they would collide with. Every
247
+ * colour is lightened until it keeps `minimumContrast` (4.5:1) against the code panel, so a
248
+ * dark theme colour is raised rather than dropped. Deterministic for a given theme.
249
+ */
250
+ declare function codeSyntaxPalette(theme?: CodeSyntaxPaletteTheme, options?: CodeSyntaxPaletteOptions): CodeSyntaxPalette;
251
+ /**
252
+ * The palette for a resolved colour scheme record (`primary`, `secondary`, `accent`, or the
253
+ * `accent1` to `accent3` slots they default to). The preview and the PPTX export both call this
254
+ * with the scheme they resolved, so they cannot disagree on the inputs.
255
+ */
256
+ declare function codeSyntaxPaletteForScheme(scheme: unknown, options?: CodeSyntaxPaletteOptions): CodeSyntaxPalette;
257
+
258
+ /**
259
+ * Metric trend mark (RR-07): the arrow and colour that show `metric.trend` in the SVG preview
260
+ * and the PPTX export. Core's metric layout places the trend word (up, down, flat) as ordinary
261
+ * text; this derives, from that accepted line geometry, one arrow beside it so both engines draw
262
+ * the same shape in the same place and colour. The word stays the text alternative: the arrow
263
+ * adds a visual cue and an `ariaLabel`, never rewritten source text.
264
+ */
265
+
266
+ type MetricTrend = 'up' | 'down' | 'flat';
267
+ /** The DrawingML preset geometry that draws each trend (`a:prstGeom prst`). */
268
+ declare const METRIC_TREND_SHAPES: Readonly<Record<MetricTrend, 'upArrow' | 'downArrow' | 'rightArrow'>>;
269
+ declare const METRIC_TREND_MIN_CONTRAST = 4.5;
270
+ interface MetricTrendColorOptions {
271
+ /** The slide background the metric text sits on. */
272
+ background: string;
273
+ /** Neutral colour for a flat trend (the deck's muted text). */
274
+ neutral?: string;
275
+ }
276
+ /** The colour of a trend, kept at >= 4.5:1 against the slide background. */
277
+ declare function metricTrendColor(trend: MetricTrend, options: MetricTrendColorOptions): string;
278
+ interface MetricTrendMark {
279
+ trend: MetricTrend;
280
+ /** DrawingML preset name for native export. */
281
+ shape: 'upArrow' | 'downArrow' | 'rightArrow';
282
+ /** Arrow bounding box in layout pixels (96 per inch). */
283
+ box: {
284
+ x: number;
285
+ y: number;
286
+ width: number;
287
+ height: number;
288
+ };
289
+ /** The arrow outline as polygon points in layout pixels: the preset geometry at default adjustments. */
290
+ points: [number, number][];
291
+ color: string;
292
+ /** Text alternative for the arrow. */
293
+ ariaLabel: string;
294
+ /** Path of the trend field the mark belongs to. */
295
+ path: string;
296
+ }
297
+ /** Outline of the DrawingML upArrow, downArrow or rightArrow preset (adj1 = adj2 = 50000) in `box`. */
298
+ declare function metricTrendPoints(shape: MetricTrendMark['shape'], box: MetricTrendMark['box']): [number, number][];
299
+ /**
300
+ * The arrow for a laid-out metric, or undefined when the metric has no (visible) trend or the
301
+ * arrow has no room. It is square, as tall as the trend word's capitals, on the baseline, and
302
+ * sits after the word for left-aligned metrics and before it for centred or right-aligned ones,
303
+ * so it grows away from the alignment edge. It never leaves the trend field's box.
304
+ */
305
+ declare function metricTrendMark(layout: MetricLayout, options: MetricTrendColorOptions): MetricTrendMark | undefined;
306
+
307
+ /**
308
+ * DrawingML preset pattern fills (ECMA-376 20.1.10.51 ST_PresetPatternVal) as 8x8 bitmaps,
309
+ * shared by the SVG preview (RR-07) and the PPTX export, which writes the same names as native
310
+ * `a:pattFill prst="..."`.
311
+ *
312
+ * ECMA-376 names the 54 presets but does not define their pixels. These tiles are MEASURED from
313
+ * desktop PowerPoint (Office 365, Windows, 2026-10-01): each preset was exported as a full-slide
314
+ * pattern background (black on white) to a 1280 x 720 PNG and opf-render's
315
+ * `scripts/derive-pattern-bitmaps.mjs` voted every pixel into its (x mod 8, y mod 8) cell; every
316
+ * tile was uniform across all repeats (confidence 1.00) at one image pixel per pattern pixel, so a
317
+ * pattern pixel is one 1/96 inch unit. The tile is anchored at the slide's top-left corner (the
318
+ * phase of the line, grid and diagonal presets matched at no shift). Measured pixel data is
319
+ * committed as data; no third-party table was used. A tile is one row per line, '#' = foreground,
320
+ * '.' = background, top to bottom, left to right.
321
+ */
322
+ /** ST_PresetPatternVal, in specification order. */
323
+ declare const PATTERN_PRESETS: readonly string[];
324
+ /** Engine ids that are not DrawingML names, with the preset they draw and export as. */
325
+ declare const PATTERN_PRESET_ALIASES: Readonly<Record<string, string>>;
326
+ /** The pattern size PowerPoint tiles: 8 x 8 units, one unit per 1/96 inch. */
327
+ declare const PATTERN_TILE_SIZE = 8;
328
+ /** The DrawingML preset a pattern id draws as: a preset name, an alias (diagStripe), or undefined. */
329
+ declare function resolvePatternPreset(preset: unknown): string | undefined;
330
+ /** Eight row bytes, top to bottom, most significant bit = leftmost pixel; undefined for an unknown id. */
331
+ declare function patternBitmap(preset: unknown): readonly number[] | undefined;
332
+ /** Horizontal runs of set pixels (`x`, `y`, `width` in tile units), in reading order. */
333
+ declare function patternRuns(preset: unknown): {
334
+ x: number;
335
+ y: number;
336
+ width: number;
337
+ }[] | undefined;
189
338
 
190
- export { type BundleReport, type BundleResult, CatalogKind, type ResolveScriptFontsOptions, type ResolvedScriptFonts, type ScriptFontApp, type ScriptFontSlots, type ScriptFontSource, type ScriptFontSupplement, type ScriptRole, type TextDirection, bundlePresentation, paragraphDirection, resolveScriptFonts, scriptFontRole };
339
+ export { type BundleReport, type BundleResult, CODE_HIGHLIGHT_LANGUAGES, CODE_HIGHLIGHT_MAX_LENGTH, CODE_PANEL_BACKGROUND, CODE_PANEL_FOREGROUND, CODE_SYNTAX_MIN_CONTRAST, CatalogKind, type CodeRun, type CodeSyntaxPalette, type CodeSyntaxPaletteOptions, type CodeSyntaxPaletteTheme, type CodeToken, type CodeTokenKind, METRIC_TREND_MIN_CONTRAST, METRIC_TREND_SHAPES, MetricLayout, type MetricTrend, type MetricTrendColorOptions, type MetricTrendMark, PATTERN_PRESETS, PATTERN_PRESET_ALIASES, PATTERN_TILE_SIZE, type ResolveScriptFontsOptions, type ResolvedScriptFonts, type ScriptFontApp, type ScriptFontSlots, type ScriptFontSource, type ScriptFontSupplement, type ScriptRole, bundlePresentation, codeLineRuns, codeSyntaxPalette, codeSyntaxPaletteForScheme, metricTrendColor, metricTrendMark, metricTrendPoints, patternBitmap, patternRuns, resolveCodeLanguage, resolvePatternPreset, resolveScriptFonts, resolveSlideDirection, scriptFontRole, tokenizeCode };