@openpresentation/opf 0.2.2 → 0.4.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/LICENSE +1 -1
- package/README.md +74 -3
- package/dist/catalogs-x1oFFQnd.d.ts +1198 -0
- package/dist/catalogs.d.ts +2 -32413
- package/dist/catalogs.js +1 -18505
- package/dist/chunk-75N5I6M4.js +229 -0
- package/dist/chunk-EMTMQRX4.js +1007 -0
- package/dist/chunk-GCXOU5MZ.js +6515 -0
- package/dist/chunk-HJNJHB5H.js +454 -0
- package/dist/chunk-OZULJBSG.js +3368 -0
- package/dist/chunk-PIQXLBBJ.js +445 -0
- package/dist/chunk-SOSOBKQ2.js +145 -0
- package/dist/chunk-TWMRZ43O.js +18576 -0
- package/dist/composition.d.ts +190 -0
- package/dist/composition.js +1 -0
- package/dist/data.d.ts +32 -0
- package/dist/data.js +1 -0
- package/dist/docs.d.ts +17 -0
- package/dist/docs.js +120 -0
- package/dist/examples.d.ts +43 -0
- package/dist/examples.js +44828 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +8 -29015
- package/dist/pagination.d.ts +52 -0
- package/dist/pagination.js +5 -0
- package/dist/{validator-MwlR2F56.d.ts → presentation-BjP4yTQ1.d.ts} +87 -40
- package/dist/previews.js +1 -447
- package/dist/repo-readme.d.ts +4 -0
- package/dist/repo-readme.js +7 -0
- package/dist/schemas-C1DxapX2.d.ts +206 -0
- package/dist/schemas.d.ts +1 -12373
- package/dist/schemas.js +1 -6275
- package/dist/spec/README.md +57 -0
- package/dist/spec/catalogs/audiences/engineering-team.json +1 -1
- package/dist/spec/catalogs/audiences/index.json +1 -1
- package/dist/spec/catalogs/chart-types/index.json +1 -1
- package/dist/spec/catalogs/color-schemes/index.json +1 -1
- package/dist/spec/catalogs/font-schemes/index.json +1 -1
- package/dist/spec/catalogs/languages/index.json +1 -1
- package/dist/spec/catalogs/layouts/chart-1x.json +4 -1
- package/dist/spec/catalogs/layouts/chart-2x.json +5 -1
- package/dist/spec/catalogs/layouts/chart-3x.json +5 -1
- package/dist/spec/catalogs/layouts/code-1x.json +4 -1
- package/dist/spec/catalogs/layouts/extract/canonical.json +94 -21
- package/dist/spec/catalogs/layouts/image-1x.json +4 -1
- package/dist/spec/catalogs/layouts/image-2x.json +5 -1
- package/dist/spec/catalogs/layouts/image-3x.json +5 -1
- package/dist/spec/catalogs/layouts/index.json +1 -1
- package/dist/spec/catalogs/layouts/list-2x.json +4 -1
- package/dist/spec/catalogs/layouts/list-3x.json +4 -1
- package/dist/spec/catalogs/layouts/list-4x.json +5 -1
- package/dist/spec/catalogs/layouts/list-5x.json +5 -1
- package/dist/spec/catalogs/layouts/list-6x.json +5 -1
- package/dist/spec/catalogs/layouts/media-1x.json +4 -1
- package/dist/spec/catalogs/layouts/number-2x.json +4 -1
- package/dist/spec/catalogs/layouts/number-3x.json +4 -1
- package/dist/spec/catalogs/layouts/number-4x.json +5 -1
- package/dist/spec/catalogs/layouts/number-5x.json +5 -1
- package/dist/spec/catalogs/layouts/number-6x.json +5 -1
- package/dist/spec/catalogs/layouts/table-1x.json +4 -1
- package/dist/spec/catalogs/layouts/text-2x.json +4 -1
- package/dist/spec/catalogs/layouts/text-3x.json +4 -1
- package/dist/spec/catalogs/narratives/index.json +2 -2
- package/dist/spec/catalogs/purposes/index.json +1 -1
- package/dist/spec/catalogs/social-platforms/index.json +1 -1
- package/dist/spec/catalogs/themes/index.json +1 -1
- package/dist/spec/catalogs/tones/casual.json +1 -1
- package/dist/spec/catalogs/tones/conversational.json +1 -1
- package/dist/spec/catalogs/tones/index.json +1 -1
- package/dist/spec/catalogs/tones/technical.json +1 -1
- package/dist/spec/openapi.yaml +66 -26
- package/dist/spec/previews/layouts/index.json +71 -71
- package/dist/spec/schemas/catalog-index.schema.json +53 -0
- package/dist/spec/schemas/layout-preview-index.schema.json +54 -0
- package/dist/spec/schemas/layout.schema.json +63 -0
- package/dist/spec/schemas/opf.schema.json +182 -3
- package/dist/spec-files.d.ts +14 -2386
- package/dist/spec-files.js +1 -3349
- package/dist/types.d.ts +4 -1102
- package/dist/types.js +0 -2
- package/dist/validator.d.ts +33 -3
- package/dist/validator.js +4 -6712
- package/package.json +29 -4
- package/dist/catalogs.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/previews.js.map +0 -1
- package/dist/schemas.js.map +0 -1
- package/dist/spec-files.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/validator.js.map +0 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/** Portable layout geometry. No fonts, DOM, renderer, or network dependencies. */
|
|
2
|
+
interface Composition {
|
|
3
|
+
mode?: "auto" | "grid" | "row" | "column";
|
|
4
|
+
columns?: number;
|
|
5
|
+
gap?: number;
|
|
6
|
+
padding?: number;
|
|
7
|
+
weights?: number[];
|
|
8
|
+
minFontSize?: number;
|
|
9
|
+
overflow?: "warn" | "error";
|
|
10
|
+
}
|
|
11
|
+
declare const MAX_COMPOSITION_DEPTH = 32;
|
|
12
|
+
interface LayoutBox {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}
|
|
18
|
+
interface LayoutDiagnostic {
|
|
19
|
+
code: "text-overflow" | "small-cell";
|
|
20
|
+
path: string;
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
23
|
+
interface TextStyle {
|
|
24
|
+
fontFamily: string;
|
|
25
|
+
fontWeight: number;
|
|
26
|
+
italic?: boolean;
|
|
27
|
+
path?: string;
|
|
28
|
+
}
|
|
29
|
+
interface FontFamilies {
|
|
30
|
+
heading: string;
|
|
31
|
+
body: string;
|
|
32
|
+
code: string;
|
|
33
|
+
}
|
|
34
|
+
declare function resolveFontFamilies(input: unknown): FontFamilies;
|
|
35
|
+
interface TextMeasurement {
|
|
36
|
+
measure: (text: string, fontSize: number, style: TextStyle) => number;
|
|
37
|
+
resolveStyle?: (style: TextStyle) => TextStyle;
|
|
38
|
+
}
|
|
39
|
+
type MeasureTextWidth = (text: string, fontSize: number) => number;
|
|
40
|
+
declare function resolveTextStyle(style: TextStyle, measurement?: TextMeasurement): TextStyle;
|
|
41
|
+
declare function textWidthMeasurer(style: TextStyle, measurement?: TextMeasurement): MeasureTextWidth;
|
|
42
|
+
interface TextFit {
|
|
43
|
+
lines: string[];
|
|
44
|
+
fontSize: number;
|
|
45
|
+
lineHeight: number;
|
|
46
|
+
overflow: boolean;
|
|
47
|
+
}
|
|
48
|
+
interface ComposedItem {
|
|
49
|
+
path: string;
|
|
50
|
+
field: string;
|
|
51
|
+
type: string;
|
|
52
|
+
value: unknown;
|
|
53
|
+
payload: Record<string, unknown>;
|
|
54
|
+
box: LayoutBox;
|
|
55
|
+
text?: TextFit | RichTextFit | ListFit;
|
|
56
|
+
textStyle?: TextStyle;
|
|
57
|
+
/** Effective container settings, including inherited readability constraints. */
|
|
58
|
+
composition: Composition;
|
|
59
|
+
}
|
|
60
|
+
interface ComposedGroup {
|
|
61
|
+
path: string;
|
|
62
|
+
box: LayoutBox;
|
|
63
|
+
contentBox: LayoutBox;
|
|
64
|
+
composition: Composition;
|
|
65
|
+
}
|
|
66
|
+
interface CompositionTrack {
|
|
67
|
+
offset: number;
|
|
68
|
+
size: number;
|
|
69
|
+
}
|
|
70
|
+
/** Resolved flow geometry, including empty reserved slots. Promoted regions are not flows. */
|
|
71
|
+
interface ComposedFlow {
|
|
72
|
+
path: string;
|
|
73
|
+
box: LayoutBox;
|
|
74
|
+
composition: Composition;
|
|
75
|
+
columns: CompositionTrack[];
|
|
76
|
+
rows: CompositionTrack[];
|
|
77
|
+
gap: number;
|
|
78
|
+
itemCount: number;
|
|
79
|
+
slotCount: number;
|
|
80
|
+
}
|
|
81
|
+
interface SlideComposition {
|
|
82
|
+
width: number;
|
|
83
|
+
height: number;
|
|
84
|
+
contentBox: LayoutBox;
|
|
85
|
+
items: ComposedItem[];
|
|
86
|
+
groups: ComposedGroup[];
|
|
87
|
+
flows: ComposedFlow[];
|
|
88
|
+
diagnostics: LayoutDiagnostic[];
|
|
89
|
+
composition: Composition;
|
|
90
|
+
}
|
|
91
|
+
interface ComposeSlideOptions {
|
|
92
|
+
fonts?: Partial<FontFamilies>;
|
|
93
|
+
textMeasurement?: TextMeasurement;
|
|
94
|
+
width?: number;
|
|
95
|
+
height?: number;
|
|
96
|
+
slideIndex?: number;
|
|
97
|
+
layout?: Record<string, unknown>;
|
|
98
|
+
}
|
|
99
|
+
declare class OPFCompositionError extends Error {
|
|
100
|
+
readonly diagnostics: LayoutDiagnostic[];
|
|
101
|
+
readonly code = "layout-overflow";
|
|
102
|
+
constructor(diagnostics: LayoutDiagnostic[]);
|
|
103
|
+
}
|
|
104
|
+
/** Deterministic estimate, not a font shaping engine. Preserves explicit line breaks. */
|
|
105
|
+
declare function measureText(text: string, fontSize: number): number;
|
|
106
|
+
declare function wrapText(text: string, width: number, fontSize: number, measure?: MeasureTextWidth): string[];
|
|
107
|
+
declare function fitText(text: string, box: LayoutBox, requestedSize?: number, minFontSize?: number, measure?: MeasureTextWidth): TextFit;
|
|
108
|
+
interface RichTextRun {
|
|
109
|
+
text: string;
|
|
110
|
+
bold?: boolean;
|
|
111
|
+
italic?: boolean;
|
|
112
|
+
underline?: boolean;
|
|
113
|
+
strikethrough?: boolean;
|
|
114
|
+
color?: string;
|
|
115
|
+
fontSize?: number;
|
|
116
|
+
fontFamily?: string;
|
|
117
|
+
link?: string;
|
|
118
|
+
superscript?: boolean;
|
|
119
|
+
subscript?: boolean;
|
|
120
|
+
}
|
|
121
|
+
interface RichTextFragment {
|
|
122
|
+
text: string;
|
|
123
|
+
runIndex: number;
|
|
124
|
+
start: number;
|
|
125
|
+
end: number;
|
|
126
|
+
x: number;
|
|
127
|
+
width: number;
|
|
128
|
+
fontSize: number;
|
|
129
|
+
baselineShift: number;
|
|
130
|
+
style: TextStyle;
|
|
131
|
+
run: RichTextRun;
|
|
132
|
+
}
|
|
133
|
+
interface RichTextLine {
|
|
134
|
+
fragments: RichTextFragment[];
|
|
135
|
+
width: number;
|
|
136
|
+
y: number;
|
|
137
|
+
baseline: number;
|
|
138
|
+
height: number;
|
|
139
|
+
}
|
|
140
|
+
interface RichTextFit extends TextFit {
|
|
141
|
+
richLines: RichTextLine[];
|
|
142
|
+
height: number;
|
|
143
|
+
}
|
|
144
|
+
interface RichTextOptions {
|
|
145
|
+
style: TextStyle;
|
|
146
|
+
textMeasurement?: TextMeasurement;
|
|
147
|
+
}
|
|
148
|
+
/** Fit mixed styles without flattening font metrics. Run fontSize is in points. */
|
|
149
|
+
declare function fitRichText(input: readonly (string | RichTextRun)[], box: LayoutBox, requestedSize?: number, minFontSize?: number, options?: RichTextOptions): RichTextFit;
|
|
150
|
+
type ListText = string | readonly (string | RichTextRun)[];
|
|
151
|
+
type ListValue = ListText | {
|
|
152
|
+
text: ListText;
|
|
153
|
+
description?: ListText;
|
|
154
|
+
level?: number;
|
|
155
|
+
};
|
|
156
|
+
interface ListEntryLayout {
|
|
157
|
+
index: number;
|
|
158
|
+
level: number;
|
|
159
|
+
textPath?: string;
|
|
160
|
+
descriptionPath?: string;
|
|
161
|
+
value: ListText;
|
|
162
|
+
descriptionValue?: ListText;
|
|
163
|
+
text: RichTextFit;
|
|
164
|
+
description?: RichTextFit;
|
|
165
|
+
textBox: LayoutBox;
|
|
166
|
+
descriptionBox?: LayoutBox;
|
|
167
|
+
marker: {
|
|
168
|
+
text: string;
|
|
169
|
+
x: number;
|
|
170
|
+
y: number;
|
|
171
|
+
fontSize: number;
|
|
172
|
+
style: TextStyle;
|
|
173
|
+
indent: number;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
interface ListFit extends TextFit {
|
|
177
|
+
listEntries: ListEntryLayout[];
|
|
178
|
+
height: number;
|
|
179
|
+
}
|
|
180
|
+
/** Shared hanging indents, mixed-run fitting and description spacing for list payloads. */
|
|
181
|
+
declare function fitList(input: readonly ListValue[], box: LayoutBox, requestedSize?: number, minFontSize?: number, options?: RichTextOptions): ListFit;
|
|
182
|
+
/** Compose a validated Slide. Layout resolution remains the caller's responsibility. */
|
|
183
|
+
declare function composeSlide(input: unknown, options?: ComposeSlideOptions): SlideComposition;
|
|
184
|
+
/** Canonical physical slide size, converted to reference pixels at 96 pixels/inch. */
|
|
185
|
+
declare function resolveCanvasDimensions(input: unknown): {
|
|
186
|
+
width: number;
|
|
187
|
+
height: number;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export { type ComposeSlideOptions, type ComposedFlow, type ComposedGroup, type ComposedItem, type Composition, type CompositionTrack, type FontFamilies, type LayoutBox, type LayoutDiagnostic, type ListEntryLayout, type ListFit, type ListText, type ListValue, MAX_COMPOSITION_DEPTH, type MeasureTextWidth, OPFCompositionError, type RichTextFit, type RichTextFragment, type RichTextLine, type RichTextOptions, type RichTextRun, type SlideComposition, type TextFit, type TextMeasurement, type TextStyle, composeSlide, fitList, fitRichText, fitText, measureText, resolveCanvasDimensions, resolveFontFamilies, resolveTextStyle, textWidthMeasurer, wrapText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MAX_COMPOSITION_DEPTH, OPFCompositionError, composeSlide, fitList, fitRichText, fitText, measureText, resolveCanvasDimensions, resolveFontFamilies, resolveTextStyle, textWidthMeasurer, wrapText } from './chunk-HJNJHB5H.js';
|
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Local CSV/TSV/JSON ingestion. No file access or network requests. */
|
|
2
|
+
type DataCell = string | number | boolean | null;
|
|
3
|
+
interface TabularData {
|
|
4
|
+
columns: string[];
|
|
5
|
+
rows: DataCell[][];
|
|
6
|
+
}
|
|
7
|
+
interface DataImportOptions {
|
|
8
|
+
format?: 'csv' | 'tsv' | 'json';
|
|
9
|
+
delimiter?: string;
|
|
10
|
+
header?: boolean;
|
|
11
|
+
columns?: string[];
|
|
12
|
+
}
|
|
13
|
+
interface DataContentOptions extends DataImportOptions {
|
|
14
|
+
as: 'table' | 'chart';
|
|
15
|
+
chartType?: string;
|
|
16
|
+
category?: string;
|
|
17
|
+
series?: string[];
|
|
18
|
+
}
|
|
19
|
+
declare class OPFDataImportError extends Error {
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
22
|
+
declare function parseTabularData(input: unknown, options?: DataImportOptions): TabularData;
|
|
23
|
+
declare function createDataContent(input: unknown, options: DataContentOptions): {
|
|
24
|
+
table: TabularData;
|
|
25
|
+
} | {
|
|
26
|
+
chart: {
|
|
27
|
+
type: string;
|
|
28
|
+
data: TabularData;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { type DataCell, type DataContentOptions, type DataImportOptions, OPFDataImportError, type TabularData, createDataContent, parseTabularData };
|
package/dist/data.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OPFDataImportError, createDataContent, parseTabularData } from './chunk-SOSOBKQ2.js';
|
package/dist/docs.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface DocRecord {
|
|
2
|
+
/** Filename slug, without the `.md` suffix. */
|
|
3
|
+
readonly slug: string;
|
|
4
|
+
/** Path relative to the repo root, with forward slashes. */
|
|
5
|
+
readonly file: string;
|
|
6
|
+
/** First-level heading from the markdown, falling back to a slug-derived title. */
|
|
7
|
+
readonly title: string;
|
|
8
|
+
/** Raw markdown content. */
|
|
9
|
+
readonly markdown: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Every documentation page shipped with this release, sorted by slug. */
|
|
13
|
+
declare const docs: readonly DocRecord[];
|
|
14
|
+
/** Look up a documentation page by slug (the filename without `.md`). */
|
|
15
|
+
declare function getDoc(slug: string): DocRecord | undefined;
|
|
16
|
+
|
|
17
|
+
export { type DocRecord, docs, getDoc };
|