@broadpaper/core 0.1.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/LICENSE +143 -0
- package/THIRD-PARTY-NOTICES.md +255 -0
- package/dist/index.d.ts +2878 -0
- package/dist/index.js +4343 -0
- package/dist/index.js.map +1 -0
- package/package.json +30 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2878 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Draft, Patch } from 'immer';
|
|
3
|
+
|
|
4
|
+
type TextAlign = "left" | "center" | "right" | "justify";
|
|
5
|
+
type VerticalAlign = "top" | "middle" | "bottom";
|
|
6
|
+
type BorderStyle = "solid" | "dashed" | "dotted" | "none";
|
|
7
|
+
interface Spacing {
|
|
8
|
+
top?: number;
|
|
9
|
+
right?: number;
|
|
10
|
+
bottom?: number;
|
|
11
|
+
left?: number;
|
|
12
|
+
}
|
|
13
|
+
interface BorderSpec {
|
|
14
|
+
width?: number;
|
|
15
|
+
style?: BorderStyle;
|
|
16
|
+
color?: ColorValue;
|
|
17
|
+
radius?: number;
|
|
18
|
+
/** Which sides to draw. Defaults to all. */
|
|
19
|
+
sides?: Array<"top" | "right" | "bottom" | "left">;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Per-instance style overrides. Every field is optional; unspecified values
|
|
23
|
+
* cascade from the document styles and then the theme.
|
|
24
|
+
*/
|
|
25
|
+
interface BlockStyle {
|
|
26
|
+
/** Named document text style this block inherits from (e.g. "h1", "body"). */
|
|
27
|
+
textStyle?: string;
|
|
28
|
+
fontFamily?: FontValue;
|
|
29
|
+
fontSize?: number;
|
|
30
|
+
fontWeight?: number | "normal" | "bold";
|
|
31
|
+
fontStyle?: "normal" | "italic";
|
|
32
|
+
lineHeight?: number;
|
|
33
|
+
letterSpacing?: number;
|
|
34
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize";
|
|
35
|
+
textAlign?: TextAlign;
|
|
36
|
+
verticalAlign?: VerticalAlign;
|
|
37
|
+
color?: ColorValue;
|
|
38
|
+
background?: ColorValue;
|
|
39
|
+
padding?: Spacing;
|
|
40
|
+
margin?: Spacing;
|
|
41
|
+
border?: BorderSpec;
|
|
42
|
+
/** Width as px number or percentage string ("50%"). */
|
|
43
|
+
width?: number | string;
|
|
44
|
+
height?: number;
|
|
45
|
+
/** Horizontal placement of a fixed-width block inside its column. */
|
|
46
|
+
align?: "left" | "center" | "right";
|
|
47
|
+
opacity?: number;
|
|
48
|
+
}
|
|
49
|
+
/** Fully resolved style: every token replaced, every text value present. */
|
|
50
|
+
interface ResolvedStyle {
|
|
51
|
+
fontFamily: string;
|
|
52
|
+
fontSize: number;
|
|
53
|
+
fontWeight: number | "normal" | "bold";
|
|
54
|
+
fontStyle: "normal" | "italic";
|
|
55
|
+
lineHeight: number;
|
|
56
|
+
letterSpacing: number;
|
|
57
|
+
textTransform: "none" | "uppercase" | "lowercase" | "capitalize";
|
|
58
|
+
textAlign: TextAlign;
|
|
59
|
+
verticalAlign: VerticalAlign;
|
|
60
|
+
color: string;
|
|
61
|
+
background?: string;
|
|
62
|
+
padding: Required<Spacing>;
|
|
63
|
+
margin: Required<Spacing>;
|
|
64
|
+
border?: {
|
|
65
|
+
width: number;
|
|
66
|
+
style: BorderStyle;
|
|
67
|
+
color: string;
|
|
68
|
+
radius: number;
|
|
69
|
+
sides: Array<"top" | "right" | "bottom" | "left">;
|
|
70
|
+
};
|
|
71
|
+
width?: number | string;
|
|
72
|
+
height?: number;
|
|
73
|
+
align?: "left" | "center" | "right";
|
|
74
|
+
opacity?: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* BroadPaper document format — schemaVersion 1.
|
|
79
|
+
*
|
|
80
|
+
* These types describe the saved JSON template. They are a public API:
|
|
81
|
+
* every change must be additive or go through a migration in `schema/migrate.ts`.
|
|
82
|
+
*
|
|
83
|
+
* Units: page geometry (size, margins, region heights) is stored in millimetres
|
|
84
|
+
* because that is how people think about paper. All other lengths (font sizes,
|
|
85
|
+
* padding, borders) are CSS pixels at 96 dpi.
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
declare const CURRENT_SCHEMA_VERSION: 1;
|
|
89
|
+
type SchemaVersion = typeof CURRENT_SCHEMA_VERSION;
|
|
90
|
+
/** A colour literal (`#RRGGBB`, `rgba(...)`) or a theme token reference (`$colors.primary`). */
|
|
91
|
+
type ColorValue = string;
|
|
92
|
+
/** A font family literal (`"Inter"`) or a theme token reference (`$typography.headingFont`). */
|
|
93
|
+
type FontValue = string;
|
|
94
|
+
/** A theme token reference. Always starts with `$`. */
|
|
95
|
+
type TokenRef = `$${string}`;
|
|
96
|
+
type PageSizeName = "A4" | "A3" | "A5" | "Letter" | "Legal" | "Tabloid";
|
|
97
|
+
interface CustomPageSize {
|
|
98
|
+
/** Width in millimetres. */
|
|
99
|
+
width: number;
|
|
100
|
+
/** Height in millimetres. */
|
|
101
|
+
height: number;
|
|
102
|
+
}
|
|
103
|
+
type PageSize = PageSizeName | CustomPageSize;
|
|
104
|
+
type PageOrientation = "portrait" | "landscape";
|
|
105
|
+
interface PageMargins {
|
|
106
|
+
top: number;
|
|
107
|
+
right: number;
|
|
108
|
+
bottom: number;
|
|
109
|
+
left: number;
|
|
110
|
+
}
|
|
111
|
+
interface PageRegionSettings {
|
|
112
|
+
/** Region height in millimetres (0 disables the region). */
|
|
113
|
+
height: number;
|
|
114
|
+
/** Use `header.firstPage` / `footer.firstPage` content on page 1. */
|
|
115
|
+
differentFirstPage: boolean;
|
|
116
|
+
}
|
|
117
|
+
interface PageSettings {
|
|
118
|
+
size: PageSize;
|
|
119
|
+
orientation: PageOrientation;
|
|
120
|
+
margins: PageMargins;
|
|
121
|
+
header: PageRegionSettings;
|
|
122
|
+
footer: PageRegionSettings;
|
|
123
|
+
background?: ColorValue;
|
|
124
|
+
/** Number of pages to show as the design canvas when the document is empty. */
|
|
125
|
+
minPages?: number;
|
|
126
|
+
}
|
|
127
|
+
type TextStyleId = "h1" | "h2" | "h3" | "h4" | "body" | "lead" | "caption" | "small" | (string & {});
|
|
128
|
+
interface TextStyle {
|
|
129
|
+
fontFamily?: FontValue;
|
|
130
|
+
fontSize?: number;
|
|
131
|
+
fontWeight?: number | "normal" | "bold";
|
|
132
|
+
fontStyle?: "normal" | "italic";
|
|
133
|
+
lineHeight?: number;
|
|
134
|
+
letterSpacing?: number;
|
|
135
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize";
|
|
136
|
+
color?: ColorValue;
|
|
137
|
+
marginTop?: number;
|
|
138
|
+
marginBottom?: number;
|
|
139
|
+
/** Headings default to keep-with-next. */
|
|
140
|
+
keepWithNext?: boolean;
|
|
141
|
+
}
|
|
142
|
+
interface TableStyle {
|
|
143
|
+
fontSize?: number;
|
|
144
|
+
headerBackground?: ColorValue;
|
|
145
|
+
headerColor?: ColorValue;
|
|
146
|
+
headerFontWeight?: number | "normal" | "bold";
|
|
147
|
+
borderColor?: ColorValue;
|
|
148
|
+
borderWidth?: number;
|
|
149
|
+
/** "all" draws a grid, "horizontal" draws row rules, "none" draws no lines. */
|
|
150
|
+
borders?: "all" | "horizontal" | "outer" | "none";
|
|
151
|
+
zebraBackground?: ColorValue;
|
|
152
|
+
cellPaddingX?: number;
|
|
153
|
+
cellPaddingY?: number;
|
|
154
|
+
}
|
|
155
|
+
interface CardStyle {
|
|
156
|
+
background?: ColorValue;
|
|
157
|
+
borderColor?: ColorValue;
|
|
158
|
+
borderWidth?: number;
|
|
159
|
+
borderRadius?: number;
|
|
160
|
+
padding?: number;
|
|
161
|
+
shadow?: boolean;
|
|
162
|
+
}
|
|
163
|
+
interface DocumentStyles {
|
|
164
|
+
text: Record<TextStyleId, TextStyle>;
|
|
165
|
+
table: TableStyle;
|
|
166
|
+
card: CardStyle;
|
|
167
|
+
link: {
|
|
168
|
+
color?: ColorValue;
|
|
169
|
+
underline?: boolean;
|
|
170
|
+
};
|
|
171
|
+
spacing: {
|
|
172
|
+
/** Vertical gap between blocks in px. */
|
|
173
|
+
blockGap: number;
|
|
174
|
+
/** Default section vertical padding in px. */
|
|
175
|
+
sectionPadding: number;
|
|
176
|
+
/** Gap between columns in px. */
|
|
177
|
+
columnGap: number;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/** Structured visibility rule, built by the UI without writing code. */
|
|
181
|
+
interface ConditionRule {
|
|
182
|
+
/** Left operand: an expression, usually a data path such as `client.isRetired`. */
|
|
183
|
+
left: string;
|
|
184
|
+
operator: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "contains" | "startsWith" | "endsWith" | "in" | "isEmpty" | "isNotEmpty" | "isTrue" | "isFalse";
|
|
185
|
+
/** Right operand as a literal (string, number, boolean) or an expression string wrapped in `{{ }}`. */
|
|
186
|
+
right?: string | number | boolean | null;
|
|
187
|
+
}
|
|
188
|
+
interface ConditionGroup {
|
|
189
|
+
op: "and" | "or";
|
|
190
|
+
rules: Array<ConditionRule | ConditionGroup>;
|
|
191
|
+
}
|
|
192
|
+
/** A raw expression string or a structured group. Both compile to the expression language. */
|
|
193
|
+
type Condition = string | ConditionGroup;
|
|
194
|
+
type BreakMode = "auto" | "page";
|
|
195
|
+
interface FlowOptions {
|
|
196
|
+
breakBefore?: BreakMode;
|
|
197
|
+
breakAfter?: BreakMode;
|
|
198
|
+
/** Never split this node across pages unless it is taller than a page. */
|
|
199
|
+
keepTogether?: boolean;
|
|
200
|
+
/** Keep this node on the same page as the start of the next sibling. */
|
|
201
|
+
keepWithNext?: boolean;
|
|
202
|
+
/** Minimum lines/rows to leave at the bottom of a page (orphans). */
|
|
203
|
+
minOrphans?: number;
|
|
204
|
+
/** Minimum lines/rows to carry to the next page (widows). */
|
|
205
|
+
minWidows?: number;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* A node in the document tree. Structural node types are `section`, `row` and
|
|
209
|
+
* `column`; everything else is a block type resolved through the block registry.
|
|
210
|
+
*/
|
|
211
|
+
interface Node {
|
|
212
|
+
id: string;
|
|
213
|
+
type: string;
|
|
214
|
+
props: Record<string, unknown>;
|
|
215
|
+
style?: BlockStyle;
|
|
216
|
+
children?: Node[];
|
|
217
|
+
visibleWhen?: Condition;
|
|
218
|
+
flow?: FlowOptions;
|
|
219
|
+
/** Human label shown in the layer tree. */
|
|
220
|
+
name?: string;
|
|
221
|
+
/** A locked node cannot be moved or deleted in the editor. */
|
|
222
|
+
locked?: boolean;
|
|
223
|
+
}
|
|
224
|
+
interface RegionContent {
|
|
225
|
+
default: Node[];
|
|
226
|
+
firstPage?: Node[];
|
|
227
|
+
}
|
|
228
|
+
interface LibraryItem {
|
|
229
|
+
id: string;
|
|
230
|
+
name: string;
|
|
231
|
+
description?: string;
|
|
232
|
+
category?: string;
|
|
233
|
+
/** A section (or block) subtree to insert. IDs are re-generated on insert. */
|
|
234
|
+
node: Node;
|
|
235
|
+
thumbnail?: string;
|
|
236
|
+
}
|
|
237
|
+
interface TemplateSettings {
|
|
238
|
+
/** BCP-47 locale used for number/date formatting defaults. */
|
|
239
|
+
locale?: string;
|
|
240
|
+
/** ISO 4217 currency used when `currency` pipe has no explicit code. */
|
|
241
|
+
currency?: string;
|
|
242
|
+
/** IANA time zone used for date formatting. */
|
|
243
|
+
timeZone?: string;
|
|
244
|
+
/** Data source ids this template was designed against. */
|
|
245
|
+
dataSources?: string[];
|
|
246
|
+
}
|
|
247
|
+
interface TemplateMeta {
|
|
248
|
+
createdAt?: string;
|
|
249
|
+
updatedAt?: string;
|
|
250
|
+
author?: string;
|
|
251
|
+
description?: string;
|
|
252
|
+
tags?: string[];
|
|
253
|
+
/** Free-form host metadata. Never interpreted by BroadPaper. */
|
|
254
|
+
custom?: Record<string, unknown>;
|
|
255
|
+
}
|
|
256
|
+
interface ReportTemplate {
|
|
257
|
+
schemaVersion: SchemaVersion;
|
|
258
|
+
id: string;
|
|
259
|
+
name: string;
|
|
260
|
+
meta?: TemplateMeta;
|
|
261
|
+
page: PageSettings;
|
|
262
|
+
styles: DocumentStyles;
|
|
263
|
+
header: RegionContent;
|
|
264
|
+
footer: RegionContent;
|
|
265
|
+
/** Top-level content: a list of `section` nodes. */
|
|
266
|
+
body: Node[];
|
|
267
|
+
library?: LibraryItem[];
|
|
268
|
+
settings?: TemplateSettings;
|
|
269
|
+
}
|
|
270
|
+
/** A template of any historical schema version. Use `migrateTemplate` before use. */
|
|
271
|
+
interface AnyVersionTemplate {
|
|
272
|
+
schemaVersion: number;
|
|
273
|
+
[key: string]: unknown;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Data source schemas supplied by the host application.
|
|
278
|
+
* BroadPaper knows nothing about the host's domain; everything it shows in the
|
|
279
|
+
* data panel, validates, and formats is derived from these descriptions.
|
|
280
|
+
*/
|
|
281
|
+
type FieldType = "string" | "number" | "currency" | "percent" | "date" | "datetime" | "boolean" | "image" | "url" | "richtext" | "object" | "array";
|
|
282
|
+
interface FieldSchema {
|
|
283
|
+
type: FieldType;
|
|
284
|
+
label?: string;
|
|
285
|
+
description?: string;
|
|
286
|
+
/** Default display format for the field (e.g. "dd MMM yyyy" for dates, "0.0%" for percent). */
|
|
287
|
+
format?: string;
|
|
288
|
+
/** ISO 4217 code for `currency` fields. */
|
|
289
|
+
currency?: string;
|
|
290
|
+
/** Child fields for `object`. */
|
|
291
|
+
fields?: Record<string, FieldSchema>;
|
|
292
|
+
/** Item schema for `array`. */
|
|
293
|
+
itemSchema?: FieldSchema;
|
|
294
|
+
/** Allowed values for enumerated strings. */
|
|
295
|
+
enum?: Array<string | number>;
|
|
296
|
+
/** Example value shown in design mode when no sample data is provided. */
|
|
297
|
+
example?: unknown;
|
|
298
|
+
/** Marks a field the host guarantees to supply. Bindings to optional fields get a default hint. */
|
|
299
|
+
required?: boolean;
|
|
300
|
+
}
|
|
301
|
+
interface DataSource {
|
|
302
|
+
id: string;
|
|
303
|
+
label: string;
|
|
304
|
+
description?: string;
|
|
305
|
+
/** Lucide icon name or inline SVG for the data panel. */
|
|
306
|
+
icon?: string;
|
|
307
|
+
schema: Record<string, FieldSchema>;
|
|
308
|
+
}
|
|
309
|
+
/** Runtime data keyed by data source id. */
|
|
310
|
+
type ReportData = Record<string, unknown>;
|
|
311
|
+
/** Values available under `page.*` while rendering a page. */
|
|
312
|
+
interface PageContext {
|
|
313
|
+
number: number;
|
|
314
|
+
total: number;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Brand theme supplied by the host. A template references theme values via
|
|
319
|
+
* tokens (`$colors.primary`) so one template renders under any brand.
|
|
320
|
+
*/
|
|
321
|
+
interface ThemeFontFace {
|
|
322
|
+
family: string;
|
|
323
|
+
/** URL(s) to the font file(s). `data:` URLs are supported for fully offline rendering. */
|
|
324
|
+
src: string | string[];
|
|
325
|
+
weight?: number | string;
|
|
326
|
+
style?: "normal" | "italic";
|
|
327
|
+
display?: "auto" | "block" | "swap";
|
|
328
|
+
}
|
|
329
|
+
interface ThemeTypography {
|
|
330
|
+
headingFont: string;
|
|
331
|
+
bodyFont: string;
|
|
332
|
+
monoFont?: string;
|
|
333
|
+
/** Base body font size in px. */
|
|
334
|
+
baseFontSize?: number;
|
|
335
|
+
/** Multiplier used for default heading sizes. */
|
|
336
|
+
headingScale?: number;
|
|
337
|
+
headingWeight?: number | "normal" | "bold";
|
|
338
|
+
bodyWeight?: number | "normal" | "bold";
|
|
339
|
+
lineHeight?: number;
|
|
340
|
+
headingLetterSpacing?: number;
|
|
341
|
+
}
|
|
342
|
+
interface ThemeColors {
|
|
343
|
+
primary: string;
|
|
344
|
+
secondary: string;
|
|
345
|
+
accent: string;
|
|
346
|
+
text: string;
|
|
347
|
+
mutedText: string;
|
|
348
|
+
surface: string;
|
|
349
|
+
background: string;
|
|
350
|
+
border: string;
|
|
351
|
+
success?: string;
|
|
352
|
+
warning?: string;
|
|
353
|
+
danger?: string;
|
|
354
|
+
/** Ordered palette for chart series. */
|
|
355
|
+
chart?: string[];
|
|
356
|
+
/** Additional named colours a host wants available as `$colors.<name>`. */
|
|
357
|
+
[name: string]: string | string[] | undefined;
|
|
358
|
+
}
|
|
359
|
+
interface ThemeTableDefaults {
|
|
360
|
+
headerBackground?: string;
|
|
361
|
+
headerColor?: string;
|
|
362
|
+
zebraBackground?: string;
|
|
363
|
+
borderColor?: string;
|
|
364
|
+
}
|
|
365
|
+
interface Theme {
|
|
366
|
+
id: string;
|
|
367
|
+
name: string;
|
|
368
|
+
/** Primary logo URL (SVG/PNG). Exposed as `$logo` and `theme.logo`. */
|
|
369
|
+
logo?: string;
|
|
370
|
+
/** Logo variant for dark backgrounds. */
|
|
371
|
+
logoDark?: string;
|
|
372
|
+
logoAlt?: string;
|
|
373
|
+
typography: ThemeTypography;
|
|
374
|
+
colors: ThemeColors;
|
|
375
|
+
fonts?: ThemeFontFace[];
|
|
376
|
+
/** Default border radius in px for cards, buttons and images. */
|
|
377
|
+
radius?: number;
|
|
378
|
+
table?: ThemeTableDefaults;
|
|
379
|
+
/**
|
|
380
|
+
* Free-form values exposed to expressions as `theme.meta.*`
|
|
381
|
+
* (e.g. company name, address, regulatory footer).
|
|
382
|
+
*/
|
|
383
|
+
meta?: Record<string, unknown>;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Constrained rich-text model. This is what is stored in the template — never HTML.
|
|
388
|
+
* It is intentionally small: paragraphs and lists containing inline runs with a
|
|
389
|
+
* fixed set of marks, plus inline data tokens.
|
|
390
|
+
*/
|
|
391
|
+
interface TextMarks {
|
|
392
|
+
bold?: boolean;
|
|
393
|
+
italic?: boolean;
|
|
394
|
+
underline?: boolean;
|
|
395
|
+
strike?: boolean;
|
|
396
|
+
code?: boolean;
|
|
397
|
+
/** Colour literal or theme token. */
|
|
398
|
+
color?: string;
|
|
399
|
+
/** A hyperlink. Only `http(s):` and `mailto:` are rendered. May contain `{{ }}` tokens. */
|
|
400
|
+
link?: string;
|
|
401
|
+
}
|
|
402
|
+
interface TextRun {
|
|
403
|
+
type: "text";
|
|
404
|
+
text: string;
|
|
405
|
+
marks?: TextMarks;
|
|
406
|
+
}
|
|
407
|
+
interface TokenRun {
|
|
408
|
+
type: "token";
|
|
409
|
+
/** Expression, e.g. `client.firstName | upper`. */
|
|
410
|
+
expr: string;
|
|
411
|
+
marks?: TextMarks;
|
|
412
|
+
/** Filled by the resolver: evaluated display value. */
|
|
413
|
+
value?: string;
|
|
414
|
+
/** Filled by the resolver: human label for design-mode chips. */
|
|
415
|
+
label?: string;
|
|
416
|
+
/** Filled by the resolver: expression depends on `page.*` and is evaluated per page. */
|
|
417
|
+
deferred?: boolean;
|
|
418
|
+
}
|
|
419
|
+
interface BreakRun {
|
|
420
|
+
type: "break";
|
|
421
|
+
}
|
|
422
|
+
type InlineNode = TextRun | TokenRun | BreakRun;
|
|
423
|
+
interface Paragraph {
|
|
424
|
+
type: "paragraph";
|
|
425
|
+
content: InlineNode[];
|
|
426
|
+
align?: "left" | "center" | "right" | "justify";
|
|
427
|
+
}
|
|
428
|
+
interface ListItem {
|
|
429
|
+
type: "listItem";
|
|
430
|
+
content: Paragraph[];
|
|
431
|
+
}
|
|
432
|
+
interface List {
|
|
433
|
+
type: "bulletList" | "orderedList";
|
|
434
|
+
content: ListItem[];
|
|
435
|
+
}
|
|
436
|
+
type BlockNode = Paragraph | List;
|
|
437
|
+
interface RichTextDoc {
|
|
438
|
+
type: "doc";
|
|
439
|
+
content: BlockNode[];
|
|
440
|
+
}
|
|
441
|
+
declare function createParagraph(text?: string, marks?: TextMarks): Paragraph;
|
|
442
|
+
declare function createRichText(text?: string): RichTextDoc;
|
|
443
|
+
/** Builds a rich text document from a template string containing `{{ expr }}` tokens. */
|
|
444
|
+
declare function richTextFromTemplate(template: string): RichTextDoc;
|
|
445
|
+
declare function inlineFromTemplate(text: string): InlineNode[];
|
|
446
|
+
/** Plain-text projection used for search, validation messages and layer labels. */
|
|
447
|
+
declare function richTextToPlain(doc: RichTextDoc | undefined, tokenText?: (expr: string) => string): string;
|
|
448
|
+
declare function inlineToPlain(content: InlineNode[], tokenText: (expr: string) => string): string;
|
|
449
|
+
/** Every token expression used in a rich text document, in order. */
|
|
450
|
+
declare function richTextTokens(doc: RichTextDoc | undefined): string[];
|
|
451
|
+
/** Extracts `{{ expr }}` expressions from a plain template string. */
|
|
452
|
+
declare function extractTemplateTokens(text: string | undefined): string[];
|
|
453
|
+
declare function isRichTextDoc(value: unknown): value is RichTextDoc;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Abstract syntax tree for the BroadPaper expression language.
|
|
457
|
+
*
|
|
458
|
+
* The language is intentionally small and has no way to execute host code:
|
|
459
|
+
* paths client.firstName holdings[0].name item.value
|
|
460
|
+
* literals "text" 'text' 12.5 true false null
|
|
461
|
+
* operators == != < <= > >= + - * / % and or not in ?:
|
|
462
|
+
* pipes value | currency:"GBP" | default:"—"
|
|
463
|
+
* functions sum(holdings.value) count(items) coalesce(a, b)
|
|
464
|
+
*/
|
|
465
|
+
type Expr = {
|
|
466
|
+
kind: "literal";
|
|
467
|
+
value: string | number | boolean | null;
|
|
468
|
+
} | {
|
|
469
|
+
kind: "path";
|
|
470
|
+
segments: PathSegment[];
|
|
471
|
+
} | {
|
|
472
|
+
kind: "unary";
|
|
473
|
+
op: "not" | "-";
|
|
474
|
+
arg: Expr;
|
|
475
|
+
} | {
|
|
476
|
+
kind: "binary";
|
|
477
|
+
op: BinaryOp;
|
|
478
|
+
left: Expr;
|
|
479
|
+
right: Expr;
|
|
480
|
+
} | {
|
|
481
|
+
kind: "conditional";
|
|
482
|
+
test: Expr;
|
|
483
|
+
then: Expr;
|
|
484
|
+
else: Expr;
|
|
485
|
+
} | {
|
|
486
|
+
kind: "call";
|
|
487
|
+
name: string;
|
|
488
|
+
args: Expr[];
|
|
489
|
+
} | {
|
|
490
|
+
kind: "pipe";
|
|
491
|
+
input: Expr;
|
|
492
|
+
name: string;
|
|
493
|
+
args: Expr[];
|
|
494
|
+
} | {
|
|
495
|
+
kind: "array";
|
|
496
|
+
items: Expr[];
|
|
497
|
+
};
|
|
498
|
+
type PathSegment = {
|
|
499
|
+
kind: "prop";
|
|
500
|
+
name: string;
|
|
501
|
+
} | {
|
|
502
|
+
kind: "index";
|
|
503
|
+
index: number;
|
|
504
|
+
};
|
|
505
|
+
type BinaryOp = "==" | "!=" | "<" | "<=" | ">" | ">=" | "+" | "-" | "*" | "/" | "%" | "and" | "or" | "in";
|
|
506
|
+
declare function pathToString(segments: PathSegment[]): string;
|
|
507
|
+
/** Serialises an AST back to canonical source text. */
|
|
508
|
+
declare function exprToString(e: Expr): string;
|
|
509
|
+
/** Collects every path referenced by an expression (for validation and dependency tracking). */
|
|
510
|
+
declare function collectPaths(e: Expr, out?: PathSegment[][]): PathSegment[][];
|
|
511
|
+
|
|
512
|
+
declare class ExpressionError extends Error {
|
|
513
|
+
readonly position: number;
|
|
514
|
+
readonly source: string;
|
|
515
|
+
constructor(message: string, position: number, source: string);
|
|
516
|
+
}
|
|
517
|
+
type Token = {
|
|
518
|
+
type: "num";
|
|
519
|
+
value: number;
|
|
520
|
+
pos: number;
|
|
521
|
+
} | {
|
|
522
|
+
type: "str";
|
|
523
|
+
value: string;
|
|
524
|
+
pos: number;
|
|
525
|
+
} | {
|
|
526
|
+
type: "ident";
|
|
527
|
+
value: string;
|
|
528
|
+
pos: number;
|
|
529
|
+
} | {
|
|
530
|
+
type: "op";
|
|
531
|
+
value: string;
|
|
532
|
+
pos: number;
|
|
533
|
+
} | {
|
|
534
|
+
type: "eof";
|
|
535
|
+
pos: number;
|
|
536
|
+
};
|
|
537
|
+
declare function tokenize(src: string): Token[];
|
|
538
|
+
/** Parses an expression. Results are cached; the AST must be treated as immutable. */
|
|
539
|
+
declare function parseExpression(src: string): Expr;
|
|
540
|
+
/** Returns the parse error for an expression, or null if it parses. */
|
|
541
|
+
declare function checkExpressionSyntax(src: string): ExpressionError | null;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Formatting pipes. Every pipe is a pure function of (value, args, context).
|
|
545
|
+
* They never throw for bad input: unformattable values pass through as text so
|
|
546
|
+
* a report never fails to render because one field was unexpectedly empty.
|
|
547
|
+
*/
|
|
548
|
+
interface FormatContext {
|
|
549
|
+
locale: string;
|
|
550
|
+
currency: string;
|
|
551
|
+
timeZone?: string;
|
|
552
|
+
/** Fixed "now" for deterministic output (tests, reproducible PDFs). */
|
|
553
|
+
now?: Date;
|
|
554
|
+
}
|
|
555
|
+
type PipeFn = (value: unknown, args: unknown[], ctx: FormatContext) => unknown;
|
|
556
|
+
interface PipeDefinition {
|
|
557
|
+
name: string;
|
|
558
|
+
description: string;
|
|
559
|
+
/** Output type used by the static type checker. "same" keeps the input type. */
|
|
560
|
+
returns: "string" | "number" | "boolean" | "same" | "array";
|
|
561
|
+
/** Argument descriptions shown in the editor. */
|
|
562
|
+
args?: Array<{
|
|
563
|
+
name: string;
|
|
564
|
+
type: "string" | "number" | "boolean" | "any";
|
|
565
|
+
optional?: boolean;
|
|
566
|
+
description?: string;
|
|
567
|
+
}>;
|
|
568
|
+
/** Input types this pipe is meant for (documentation and editor suggestions only). */
|
|
569
|
+
accepts?: string[];
|
|
570
|
+
fn: PipeFn;
|
|
571
|
+
}
|
|
572
|
+
declare function toNumber(value: unknown): number | null;
|
|
573
|
+
declare function toDate(value: unknown): Date | null;
|
|
574
|
+
declare function isEmptyValue(value: unknown): boolean;
|
|
575
|
+
declare function toDisplayString(value: unknown): string;
|
|
576
|
+
/**
|
|
577
|
+
* Date pattern tokens (a pragmatic subset of Unicode/date-fns tokens):
|
|
578
|
+
* yyyy yy MMMM MMM MM M dd d EEEE EEE HH H hh h mm ss a
|
|
579
|
+
*/
|
|
580
|
+
declare function formatDatePattern(date: Date, pattern: string, ctx: FormatContext): string;
|
|
581
|
+
declare function formatDate(value: unknown, pattern: string | undefined, ctx: FormatContext, withTime?: boolean): string;
|
|
582
|
+
declare function formatCurrency(value: unknown, currency: string | undefined, decimals: number | undefined, ctx: FormatContext): string;
|
|
583
|
+
declare function formatNumber(value: unknown, decimals: number | undefined, ctx: FormatContext): string;
|
|
584
|
+
declare function formatPercent(value: unknown, decimals: number | undefined, ctx: FormatContext, alreadyScaled?: boolean): string;
|
|
585
|
+
declare const PIPES: Record<string, PipeDefinition>;
|
|
586
|
+
declare function getField(obj: unknown, path: string): unknown;
|
|
587
|
+
declare function compareValues(a: unknown, b: unknown): number;
|
|
588
|
+
declare function looseEquals(a: unknown, b: unknown): boolean;
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* A lexical scope chain. Lookups walk from the innermost scope outwards, so a
|
|
592
|
+
* repeater's `item` shadows a data source called `item` (and we warn about that
|
|
593
|
+
* in validation).
|
|
594
|
+
*/
|
|
595
|
+
declare class Scope {
|
|
596
|
+
private readonly vars;
|
|
597
|
+
private readonly parent?;
|
|
598
|
+
constructor(vars: Record<string, unknown>, parent?: Scope | undefined);
|
|
599
|
+
lookup(name: string): {
|
|
600
|
+
found: boolean;
|
|
601
|
+
value: unknown;
|
|
602
|
+
};
|
|
603
|
+
child(vars: Record<string, unknown>): Scope;
|
|
604
|
+
/** Names visible in this scope (innermost first, deduplicated). */
|
|
605
|
+
names(): string[];
|
|
606
|
+
}
|
|
607
|
+
interface EvalContext {
|
|
608
|
+
scope: Scope;
|
|
609
|
+
format: FormatContext;
|
|
610
|
+
/** Optional sink for non-fatal problems encountered during evaluation. */
|
|
611
|
+
onWarning?: (message: string, expr?: string) => void;
|
|
612
|
+
}
|
|
613
|
+
declare const FUNCTION_NAMES: string[];
|
|
614
|
+
declare function truthy(v: unknown): boolean;
|
|
615
|
+
/**
|
|
616
|
+
* Safe property access: only own enumerable data properties, never prototype
|
|
617
|
+
* members, never functions, never symbols.
|
|
618
|
+
*/
|
|
619
|
+
declare function readProperty(obj: unknown, name: string): unknown;
|
|
620
|
+
declare function resolvePath(segments: PathSegment[], scope: Scope): {
|
|
621
|
+
found: boolean;
|
|
622
|
+
value: unknown;
|
|
623
|
+
};
|
|
624
|
+
declare function evaluateAst(e: Expr, ctx: EvalContext): unknown;
|
|
625
|
+
/** Evaluates an expression string in a scope. Never throws for runtime data problems. */
|
|
626
|
+
declare function evaluate(src: string, ctx: EvalContext): unknown;
|
|
627
|
+
/** Evaluates to a boolean using report truthiness rules. */
|
|
628
|
+
declare function evaluateCondition(src: string, ctx: EvalContext): boolean;
|
|
629
|
+
/** Evaluates to display text. */
|
|
630
|
+
declare function evaluateText(src: string, ctx: EvalContext): string;
|
|
631
|
+
interface TemplateSegment {
|
|
632
|
+
kind: "text" | "token";
|
|
633
|
+
text: string;
|
|
634
|
+
/** Present for tokens: the expression source. */
|
|
635
|
+
expr?: string;
|
|
636
|
+
}
|
|
637
|
+
/** Splits `Hello {{ client.firstName }}` into text/token segments. */
|
|
638
|
+
declare function splitTemplate(template: string): TemplateSegment[];
|
|
639
|
+
/** Interpolates `{{ expr }}` tokens in a string. */
|
|
640
|
+
declare function interpolate(template: string, ctx: EvalContext): string;
|
|
641
|
+
|
|
642
|
+
type ValueType = FieldType | "any" | "null" | "unknown";
|
|
643
|
+
interface TypeIssue {
|
|
644
|
+
code: "unknown-root" | "unknown-field" | "unknown-pipe" | "unknown-function" | "syntax" | "type-mismatch" | "not-a-list" | "not-an-object";
|
|
645
|
+
message: string;
|
|
646
|
+
/** Character offset when known. */
|
|
647
|
+
position?: number;
|
|
648
|
+
}
|
|
649
|
+
interface TypeResult {
|
|
650
|
+
type: ValueType;
|
|
651
|
+
schema?: FieldSchema;
|
|
652
|
+
issues: TypeIssue[];
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* A static scope describing what names are visible and their schemas.
|
|
656
|
+
* Mirrors the runtime `Scope` chain.
|
|
657
|
+
*/
|
|
658
|
+
declare class SchemaScope {
|
|
659
|
+
private readonly vars;
|
|
660
|
+
private readonly parent?;
|
|
661
|
+
constructor(vars: Record<string, FieldSchema>, parent?: SchemaScope | undefined);
|
|
662
|
+
lookup(name: string): FieldSchema | undefined;
|
|
663
|
+
child(vars: Record<string, FieldSchema>): SchemaScope;
|
|
664
|
+
entries(): Array<{
|
|
665
|
+
name: string;
|
|
666
|
+
schema: FieldSchema;
|
|
667
|
+
depth: number;
|
|
668
|
+
}>;
|
|
669
|
+
}
|
|
670
|
+
declare const GLOBAL_SCHEMAS: Record<string, FieldSchema>;
|
|
671
|
+
declare function dataSourceSchemas(sources: DataSource[]): Record<string, FieldSchema>;
|
|
672
|
+
declare function createSchemaScope(sources: DataSource[], extraGlobals?: Record<string, FieldSchema>): SchemaScope;
|
|
673
|
+
/** Resolves a path through a schema scope, returning the field schema when known. */
|
|
674
|
+
declare function resolvePathSchema(segments: PathSegment[], scope: SchemaScope): {
|
|
675
|
+
schema?: FieldSchema;
|
|
676
|
+
issue?: TypeIssue;
|
|
677
|
+
};
|
|
678
|
+
/** Statically type-checks an expression against a schema scope. */
|
|
679
|
+
declare function typeCheckAst(e: Expr, scope: SchemaScope): TypeResult;
|
|
680
|
+
/** Parses and type-checks an expression string. Syntax errors are returned as issues. */
|
|
681
|
+
declare function typeCheck(src: string, scope: SchemaScope): TypeResult;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Compiles a structured condition (built by the UI) to expression source.
|
|
685
|
+
* Raw string conditions are returned unchanged.
|
|
686
|
+
*/
|
|
687
|
+
declare function compileCondition(condition: Condition | undefined): string | null;
|
|
688
|
+
declare const CONDITION_OPERATORS: Array<{
|
|
689
|
+
value: ConditionRule["operator"];
|
|
690
|
+
label: string;
|
|
691
|
+
needsValue: boolean;
|
|
692
|
+
types?: string[];
|
|
693
|
+
}>;
|
|
694
|
+
|
|
695
|
+
/** The built-in fallback theme. Any missing host theme value falls back to this. */
|
|
696
|
+
declare const DEFAULT_THEME: Theme;
|
|
697
|
+
/** Document styles used by `createTemplate()`. Everything references theme tokens. */
|
|
698
|
+
declare function defaultDocumentStyles(): DocumentStyles;
|
|
699
|
+
|
|
700
|
+
declare function isTokenRef(value: unknown): value is `$${string}`;
|
|
701
|
+
/**
|
|
702
|
+
* Resolves a theme token such as `$colors.primary`, `$typography.headingFont`,
|
|
703
|
+
* `$table.headerBackground` or `$logo`. Returns `undefined` when the token does
|
|
704
|
+
* not exist in either the theme or the default theme.
|
|
705
|
+
*/
|
|
706
|
+
declare function resolveToken(token: string, theme: Theme): string | undefined;
|
|
707
|
+
/** Returns a concrete value: token references resolved, literals passed through. */
|
|
708
|
+
declare function resolveValue(value: string | undefined, theme: Theme, fallback: string): string;
|
|
709
|
+
interface ThemeTokenInfo {
|
|
710
|
+
token: `$${string}`;
|
|
711
|
+
label: string;
|
|
712
|
+
value: string;
|
|
713
|
+
group: "colors" | "typography" | "table" | "brand";
|
|
714
|
+
}
|
|
715
|
+
/** Every token a theme exposes, for pickers in the editor. */
|
|
716
|
+
declare function listThemeTokens(theme: Theme): ThemeTokenInfo[];
|
|
717
|
+
declare function humanize(key: string): string;
|
|
718
|
+
/** Merges a partial host theme over the default theme so every value is present. */
|
|
719
|
+
declare function mergeTheme(theme: Partial<Theme> | undefined): Theme;
|
|
720
|
+
/** Reports which theme values the host left undefined (validation warning source). */
|
|
721
|
+
declare function missingThemeValues(theme: Partial<Theme>): string[];
|
|
722
|
+
/** Simple relative-luminance check used to pick readable text on coloured surfaces. */
|
|
723
|
+
declare function isDarkColor(hex: string): boolean;
|
|
724
|
+
declare function textStyleLabel(id: string): string;
|
|
725
|
+
|
|
726
|
+
interface StyleCascadeInput {
|
|
727
|
+
theme: Theme;
|
|
728
|
+
styles: DocumentStyles;
|
|
729
|
+
/** Document text style to inherit from. Defaults to "body". */
|
|
730
|
+
textStyle?: string;
|
|
731
|
+
/** Block definition defaults (lowest priority above document styles). */
|
|
732
|
+
defaults?: BlockStyle;
|
|
733
|
+
/** Instance overrides (highest priority). */
|
|
734
|
+
overrides?: BlockStyle;
|
|
735
|
+
/** When false, instance overrides are ignored (host permission). */
|
|
736
|
+
allowOverrides?: boolean;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Resolves the style cascade for one block:
|
|
740
|
+
* theme defaults → document text style → block definition defaults → instance overrides.
|
|
741
|
+
* Output contains only concrete values; renderers never see tokens.
|
|
742
|
+
*/
|
|
743
|
+
declare function resolveStyle(input: StyleCascadeInput): ResolvedStyle;
|
|
744
|
+
/** Converts a resolved style to inline CSS declarations (used by every renderer). */
|
|
745
|
+
declare function styleToCss(s: ResolvedStyle, opts?: {
|
|
746
|
+
text?: boolean;
|
|
747
|
+
box?: boolean;
|
|
748
|
+
}): Record<string, string>;
|
|
749
|
+
declare function cssText(css: Record<string, string | number | undefined>): string;
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* A tiny virtual node model. Block renderers return VNodes so the same render
|
|
753
|
+
* code produces DOM in the editor, DOM in the preview, DOM in the PDF service,
|
|
754
|
+
* and HTML strings in tests — without any framework.
|
|
755
|
+
*/
|
|
756
|
+
type VChild = VNode | string | number | null | undefined | false | VChild[];
|
|
757
|
+
interface VNode {
|
|
758
|
+
tag: string;
|
|
759
|
+
props: VProps;
|
|
760
|
+
children: Array<VNode | string>;
|
|
761
|
+
/** "svg" for SVG namespace elements. Inferred from the tag when omitted. */
|
|
762
|
+
ns?: "svg";
|
|
763
|
+
}
|
|
764
|
+
interface VProps {
|
|
765
|
+
class?: string | Array<string | false | null | undefined>;
|
|
766
|
+
style?: string | Record<string, string | number | undefined>;
|
|
767
|
+
/** Data attributes are passed as `data-*` keys. */
|
|
768
|
+
[attr: string]: string | number | boolean | undefined | null | Array<string | false | null | undefined> | Record<string, string | number | undefined>;
|
|
769
|
+
}
|
|
770
|
+
declare function h(tag: string, props?: VProps | null, ...children: VChild[]): VNode;
|
|
771
|
+
declare function isVNode(v: unknown): v is VNode;
|
|
772
|
+
declare function classNames(value: VProps["class"]): string;
|
|
773
|
+
declare function styleString(value: VProps["style"]): string;
|
|
774
|
+
declare function escapeHtml(s: string): string;
|
|
775
|
+
/** Serialises a VNode tree to an HTML string. Attribute values are always escaped. */
|
|
776
|
+
declare function toHtml(node: VNode | string | Array<VNode | string>): string;
|
|
777
|
+
/** Depth-first walk. Return false from the visitor to stop descending. */
|
|
778
|
+
declare function walkVNodes(node: VNode, visit: (n: VNode) => boolean | void): void;
|
|
779
|
+
|
|
780
|
+
type ResolvedRole = "section" | "row" | "column" | "block";
|
|
781
|
+
interface ResolvedFlow {
|
|
782
|
+
breakBefore: "auto" | "page";
|
|
783
|
+
breakAfter: "auto" | "page";
|
|
784
|
+
keepTogether: boolean;
|
|
785
|
+
keepWithNext: boolean;
|
|
786
|
+
split: SplitMode;
|
|
787
|
+
minOrphans: number;
|
|
788
|
+
minWidows: number;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* A node after resolution: every expression evaluated, every repeater expanded,
|
|
792
|
+
* every conditional decided, every style concrete. This is what the measurer,
|
|
793
|
+
* paginator and renderers consume. It is plain data and fully serialisable
|
|
794
|
+
* (which is how the PDF service receives it).
|
|
795
|
+
*/
|
|
796
|
+
interface ResolvedNode {
|
|
797
|
+
/** Unique instance key. Repeater iterations get `${nodeId}@${index}` suffixes. */
|
|
798
|
+
key: string;
|
|
799
|
+
/** Template node id this instance came from. */
|
|
800
|
+
nodeId: string;
|
|
801
|
+
type: string;
|
|
802
|
+
role: ResolvedRole;
|
|
803
|
+
/** Evaluated props (binding props replaced by their values). */
|
|
804
|
+
props: Record<string, unknown>;
|
|
805
|
+
/** Original template props (for design-mode chips and inline editing). */
|
|
806
|
+
raw: Record<string, unknown>;
|
|
807
|
+
style: ResolvedStyle;
|
|
808
|
+
flow: ResolvedFlow;
|
|
809
|
+
children: ResolvedNode[];
|
|
810
|
+
bindings: Record<string, BindingInfo>;
|
|
811
|
+
/** Interpolated `template` props as segments (design mode renders tokens as chips). */
|
|
812
|
+
textSegments: Record<string, ResolvedSegment[]>;
|
|
813
|
+
/** Resolved rich text props. */
|
|
814
|
+
richText: Record<string, RichTextDoc>;
|
|
815
|
+
/** For rows: column spans in twelfths. */
|
|
816
|
+
layout?: {
|
|
817
|
+
columns: number[];
|
|
818
|
+
};
|
|
819
|
+
/** For columns: span in twelfths. */
|
|
820
|
+
span?: number;
|
|
821
|
+
/** Repeater metadata for iterations. */
|
|
822
|
+
iteration?: {
|
|
823
|
+
index: number;
|
|
824
|
+
count: number;
|
|
825
|
+
alias: string;
|
|
826
|
+
};
|
|
827
|
+
/** Human label for the layer tree / breadcrumbs. */
|
|
828
|
+
label?: string;
|
|
829
|
+
/** True in design mode for placeholder content (e.g. an empty repeater). */
|
|
830
|
+
placeholder?: boolean;
|
|
831
|
+
/** Node is locked in the editor. */
|
|
832
|
+
locked?: boolean;
|
|
833
|
+
/** True if any prop references `page.*` (rendered per page). */
|
|
834
|
+
pageDependent?: boolean;
|
|
835
|
+
}
|
|
836
|
+
interface ResolvedSegment extends TemplateSegment {
|
|
837
|
+
/** Evaluated value for tokens (undefined when page-dependent). */
|
|
838
|
+
value?: string;
|
|
839
|
+
/** Human label for the chip. */
|
|
840
|
+
label?: string;
|
|
841
|
+
/** Deferred: evaluated at render time with the page context. */
|
|
842
|
+
deferred?: boolean;
|
|
843
|
+
}
|
|
844
|
+
interface ResolvedRegion {
|
|
845
|
+
/** Sections for regular pages. */
|
|
846
|
+
default: ResolvedNode[];
|
|
847
|
+
/** Sections for the first page (only when differentFirstPage). */
|
|
848
|
+
firstPage?: ResolvedNode[];
|
|
849
|
+
}
|
|
850
|
+
interface ResolvedDocument {
|
|
851
|
+
body: ResolvedNode[];
|
|
852
|
+
header: ResolvedRegion;
|
|
853
|
+
footer: ResolvedRegion;
|
|
854
|
+
/** Warnings collected during resolution (unknown fields, bad expressions...). */
|
|
855
|
+
warnings: Array<{
|
|
856
|
+
message: string;
|
|
857
|
+
nodeId?: string;
|
|
858
|
+
expr?: string;
|
|
859
|
+
}>;
|
|
860
|
+
mode: "design" | "preview";
|
|
861
|
+
}
|
|
862
|
+
declare const DEFAULT_PAGE_CONTEXT: PageContext;
|
|
863
|
+
|
|
864
|
+
type IssueSeverity = "error" | "warning" | "info";
|
|
865
|
+
type IssueCode = "schema-invalid" | "unknown-block" | "license-required" | "unknown-binding" | "invalid-expression" | "type-mismatch" | "invalid-condition" | "missing-collection" | "missing-required" | "missing-theme-token" | "missing-theme-value" | "unsupported-font" | "invalid-url" | "invalid-image" | "empty-content" | "empty-value" | "region-overflow" | "layout-invalid" | "scope-shadowing" | "custom";
|
|
866
|
+
/**
|
|
867
|
+
* Which question an issue answers.
|
|
868
|
+
*
|
|
869
|
+
* `template` issues are defects in the design itself: they are true for every
|
|
870
|
+
* client the report is ever run for, and the designer has to fix them.
|
|
871
|
+
* `output` issues are true only of the data in front of you — a field this
|
|
872
|
+
* particular client has not filled in. Both matter, but conflating them makes
|
|
873
|
+
* the first kind unfindable and the second kind look like the designer's fault.
|
|
874
|
+
*/
|
|
875
|
+
type IssueSource = "template" | "output";
|
|
876
|
+
interface Issue {
|
|
877
|
+
severity: IssueSeverity;
|
|
878
|
+
code: IssueCode;
|
|
879
|
+
message: string;
|
|
880
|
+
/** Defaults to "template". */
|
|
881
|
+
source?: IssueSource;
|
|
882
|
+
/** Node id the issue belongs to, when applicable. */
|
|
883
|
+
nodeId?: string;
|
|
884
|
+
/** Prop path on that node. */
|
|
885
|
+
prop?: string;
|
|
886
|
+
/** Region: body, header, footer, library. */
|
|
887
|
+
region?: "body" | "header" | "footer" | "library" | "document";
|
|
888
|
+
/** Optional machine-readable detail. */
|
|
889
|
+
detail?: Record<string, unknown>;
|
|
890
|
+
}
|
|
891
|
+
declare function issue(severity: IssueSeverity, code: IssueCode, message: string, extra?: Partial<Issue>): Issue;
|
|
892
|
+
|
|
893
|
+
type BlockCategory = "content" | "layout" | "data" | "visualisation" | "custom" | "structure";
|
|
894
|
+
type LicenseTier = "community" | "pro" | "enterprise";
|
|
895
|
+
type SplitMode = "none" | "lines" | "rows" | "children";
|
|
896
|
+
type RenderMode = "design" | "preview";
|
|
897
|
+
interface InspectorFieldBase {
|
|
898
|
+
/** Property name on `props` this field edits. Supports dot paths (`series.color`). */
|
|
899
|
+
prop: string;
|
|
900
|
+
label: string;
|
|
901
|
+
/**
|
|
902
|
+
* Help text under the control. A function when the useful wording depends on
|
|
903
|
+
* the block's other settings — a table's row alias is named by the designer,
|
|
904
|
+
* so "use it like `row.name`" is wrong for every table that renamed it.
|
|
905
|
+
*/
|
|
906
|
+
description?: string | ((props: Record<string, unknown>) => string);
|
|
907
|
+
/** Show only when the predicate passes. */
|
|
908
|
+
when?: (props: Record<string, unknown>) => boolean;
|
|
909
|
+
/** Take a full row in a two-column inspector grid. */
|
|
910
|
+
fullWidth?: boolean;
|
|
911
|
+
}
|
|
912
|
+
type SelectOption = {
|
|
913
|
+
value: string | number | boolean;
|
|
914
|
+
label: string;
|
|
915
|
+
icon?: string;
|
|
916
|
+
description?: string;
|
|
917
|
+
};
|
|
918
|
+
type InspectorField = (InspectorFieldBase & {
|
|
919
|
+
kind: "text";
|
|
920
|
+
placeholder?: string;
|
|
921
|
+
allowTokens?: boolean;
|
|
922
|
+
}) | (InspectorFieldBase & {
|
|
923
|
+
kind: "textarea";
|
|
924
|
+
placeholder?: string;
|
|
925
|
+
rows?: number;
|
|
926
|
+
allowTokens?: boolean;
|
|
927
|
+
}) | (InspectorFieldBase & {
|
|
928
|
+
kind: "richtext";
|
|
929
|
+
}) | (InspectorFieldBase & {
|
|
930
|
+
kind: "number";
|
|
931
|
+
min?: number;
|
|
932
|
+
max?: number;
|
|
933
|
+
step?: number;
|
|
934
|
+
unit?: string;
|
|
935
|
+
}) | (InspectorFieldBase & {
|
|
936
|
+
kind: "toggle";
|
|
937
|
+
}) | (InspectorFieldBase & {
|
|
938
|
+
kind: "select";
|
|
939
|
+
options?: SelectOption[];
|
|
940
|
+
optionsFrom?: (props: Record<string, unknown>) => SelectOption[];
|
|
941
|
+
}) | (InspectorFieldBase & {
|
|
942
|
+
kind: "segmented";
|
|
943
|
+
options: SelectOption[];
|
|
944
|
+
}) | (InspectorFieldBase & {
|
|
945
|
+
kind: "color";
|
|
946
|
+
allowTransparent?: boolean;
|
|
947
|
+
}) | (InspectorFieldBase & {
|
|
948
|
+
kind: "font";
|
|
949
|
+
}) | (InspectorFieldBase & {
|
|
950
|
+
kind: "textStyle";
|
|
951
|
+
}) | (InspectorFieldBase & {
|
|
952
|
+
kind: "binding";
|
|
953
|
+
valueType?: FieldType | FieldType[];
|
|
954
|
+
placeholder?: string;
|
|
955
|
+
}) | (InspectorFieldBase & {
|
|
956
|
+
kind: "collection";
|
|
957
|
+
placeholder?: string;
|
|
958
|
+
}) | (InspectorFieldBase & {
|
|
959
|
+
kind: "expression";
|
|
960
|
+
placeholder?: string;
|
|
961
|
+
}) | (InspectorFieldBase & {
|
|
962
|
+
kind: "image";
|
|
963
|
+
allowBinding?: boolean;
|
|
964
|
+
}) | (InspectorFieldBase & {
|
|
965
|
+
kind: "condition";
|
|
966
|
+
}) | (InspectorFieldBase & {
|
|
967
|
+
kind: "columns";
|
|
968
|
+
}) | (InspectorFieldBase & {
|
|
969
|
+
kind: "series";
|
|
970
|
+
}) | (InspectorFieldBase & {
|
|
971
|
+
kind: "keyValues";
|
|
972
|
+
}) | (InspectorFieldBase & {
|
|
973
|
+
kind: "list";
|
|
974
|
+
itemLabel?: string;
|
|
975
|
+
fields: InspectorField[];
|
|
976
|
+
/**
|
|
977
|
+
* One line describing a collapsed item. Without it the list falls back to
|
|
978
|
+
* whatever field looks like a name, which for a table's conditional
|
|
979
|
+
* formatting rules meant showing the column id — "c5" — to a person who
|
|
980
|
+
* has never seen a column id and has no way to look one up.
|
|
981
|
+
*/
|
|
982
|
+
itemSummary?: (item: Record<string, unknown>, index: number, props: Record<string, unknown>) => string;
|
|
983
|
+
}) | (InspectorFieldBase & {
|
|
984
|
+
kind: "custom";
|
|
985
|
+
component: InspectorComponent;
|
|
986
|
+
});
|
|
987
|
+
/**
|
|
988
|
+
* Framework-neutral mount adapter for custom inspector UIs. `@broadpaper/react`
|
|
989
|
+
* and `@broadpaper/angular` provide helpers that produce one from a component.
|
|
990
|
+
*/
|
|
991
|
+
interface InspectorComponent {
|
|
992
|
+
mount(element: HTMLElement, api: InspectorApi): void;
|
|
993
|
+
update?(api: InspectorApi): void;
|
|
994
|
+
unmount?(element: HTMLElement): void;
|
|
995
|
+
}
|
|
996
|
+
interface InspectorApi {
|
|
997
|
+
value: unknown;
|
|
998
|
+
props: Record<string, unknown>;
|
|
999
|
+
node: Node;
|
|
1000
|
+
setValue(value: unknown): void;
|
|
1001
|
+
setProps(patch: Record<string, unknown>): void;
|
|
1002
|
+
dataSources: DataSource[];
|
|
1003
|
+
schemaScope: SchemaScope;
|
|
1004
|
+
theme: Theme;
|
|
1005
|
+
}
|
|
1006
|
+
interface InspectorSection {
|
|
1007
|
+
title: string;
|
|
1008
|
+
fields: InspectorField[];
|
|
1009
|
+
collapsed?: boolean;
|
|
1010
|
+
when?: (props: Record<string, unknown>) => boolean;
|
|
1011
|
+
}
|
|
1012
|
+
/** Which built-in style groups the inspector shows for a block. */
|
|
1013
|
+
type StyleGroup = "textStyle" | "typography" | "alignment" | "spacing" | "border" | "background" | "size" | "flow";
|
|
1014
|
+
type BindingKind =
|
|
1015
|
+
/** A single expression yielding a value. */
|
|
1016
|
+
"value"
|
|
1017
|
+
/** An expression yielding an array. */
|
|
1018
|
+
| "collection"
|
|
1019
|
+
/** A plain string that may contain `{{ }}` tokens. */
|
|
1020
|
+
| "template"
|
|
1021
|
+
/** A rich text document containing inline tokens. */
|
|
1022
|
+
| "richtext"
|
|
1023
|
+
/** A structured or string condition. */
|
|
1024
|
+
| "condition"
|
|
1025
|
+
/** A list of objects that contain nested bindings (see `items`). Not evaluated itself. */
|
|
1026
|
+
| "list";
|
|
1027
|
+
interface BindingSpec {
|
|
1028
|
+
prop: string;
|
|
1029
|
+
kind: BindingKind;
|
|
1030
|
+
valueType?: FieldType | FieldType[];
|
|
1031
|
+
/** Nested bindings inside list props (e.g. table columns). */
|
|
1032
|
+
items?: BindingSpec[];
|
|
1033
|
+
/** For collections: props on this block that are evaluated per item (e.g. table column values). */
|
|
1034
|
+
scoped?: BindingSpec[];
|
|
1035
|
+
/** Prop holding the alias name introduced into scope for per-item bindings. */
|
|
1036
|
+
alias?: string;
|
|
1037
|
+
/**
|
|
1038
|
+
* The expression is evaluated per item of the block's collection by the block's
|
|
1039
|
+
* own `resolve` hook (e.g. table column values). The resolver leaves it alone;
|
|
1040
|
+
* validation checks it in the item scope.
|
|
1041
|
+
*/
|
|
1042
|
+
perItem?: boolean;
|
|
1043
|
+
}
|
|
1044
|
+
interface BindingInfo {
|
|
1045
|
+
prop: string;
|
|
1046
|
+
kind: BindingKind;
|
|
1047
|
+
expr: string;
|
|
1048
|
+
/** Human label such as "Client › First name". */
|
|
1049
|
+
label: string;
|
|
1050
|
+
type?: FieldType | "unknown";
|
|
1051
|
+
}
|
|
1052
|
+
interface ContainerSpec {
|
|
1053
|
+
/** What children this node accepts: block types, or a wildcard group. */
|
|
1054
|
+
accepts: Array<string | "@blocks" | "@rows" | "@columns" | "@sections">;
|
|
1055
|
+
min?: number;
|
|
1056
|
+
max?: number;
|
|
1057
|
+
/** Repeat children once per item of the collection in `collectionProp`. */
|
|
1058
|
+
repeat?: {
|
|
1059
|
+
collectionProp: string;
|
|
1060
|
+
aliasProp?: string;
|
|
1061
|
+
keepItemTogetherProp?: string;
|
|
1062
|
+
emptyMessageProp?: string;
|
|
1063
|
+
limitProp?: string;
|
|
1064
|
+
};
|
|
1065
|
+
/** Show children only when the condition in `conditionProp` holds. */
|
|
1066
|
+
conditional?: {
|
|
1067
|
+
conditionProp: string;
|
|
1068
|
+
elseChildrenProp?: string;
|
|
1069
|
+
};
|
|
1070
|
+
/** Direction children are laid out in. Default "column". */
|
|
1071
|
+
direction?: "column" | "row";
|
|
1072
|
+
}
|
|
1073
|
+
interface ResolveHookContext<P> {
|
|
1074
|
+
props: P;
|
|
1075
|
+
node: Node;
|
|
1076
|
+
scope: Scope;
|
|
1077
|
+
mode: RenderMode;
|
|
1078
|
+
theme: Theme;
|
|
1079
|
+
format: FormatContext;
|
|
1080
|
+
evaluate(expr: string): unknown;
|
|
1081
|
+
evaluateIn(expr: string, vars: Record<string, unknown>): unknown;
|
|
1082
|
+
warn(message: string): void;
|
|
1083
|
+
}
|
|
1084
|
+
interface RenderContext<P = Record<string, unknown>> {
|
|
1085
|
+
node: ResolvedNode;
|
|
1086
|
+
props: P;
|
|
1087
|
+
style: ResolvedStyle;
|
|
1088
|
+
/** Inline CSS for the block root: text + box (padding, border, background). Margin/width are applied by the wrapper. */
|
|
1089
|
+
css: Record<string, string>;
|
|
1090
|
+
theme: Theme;
|
|
1091
|
+
styles: DocumentStyles;
|
|
1092
|
+
mode: RenderMode;
|
|
1093
|
+
h: typeof h;
|
|
1094
|
+
/** Rendered child nodes (containers only). */
|
|
1095
|
+
children: VNode[];
|
|
1096
|
+
page: PageContext;
|
|
1097
|
+
/** Available width in px. */
|
|
1098
|
+
width: number;
|
|
1099
|
+
format: FormatContext;
|
|
1100
|
+
registry: BlockRegistryLike;
|
|
1101
|
+
/** Renders an interpolated string prop; tokens become chips in design mode. */
|
|
1102
|
+
text(prop: string, fallback?: string): VChild[];
|
|
1103
|
+
/** Renders a rich text prop. */
|
|
1104
|
+
richText(prop: string): VChild[];
|
|
1105
|
+
/** Renders a plain string value that may contain tokens (already resolved in preview). */
|
|
1106
|
+
textValue(value: string | undefined): VChild[];
|
|
1107
|
+
/** Metadata about a bound prop (for badges/chips). */
|
|
1108
|
+
binding(prop: string): BindingInfo | undefined;
|
|
1109
|
+
/** Standard attributes for a sub-element the editor should be able to target. */
|
|
1110
|
+
partAttrs(part: string, extra?: VProps): VProps;
|
|
1111
|
+
/** Placeholder shown in design mode for empty content. */
|
|
1112
|
+
placeholder(text: string, extra?: VProps): VNode;
|
|
1113
|
+
}
|
|
1114
|
+
interface ValidateContext<P> {
|
|
1115
|
+
props: P;
|
|
1116
|
+
node: Node;
|
|
1117
|
+
schemaScope: SchemaScope;
|
|
1118
|
+
dataSources: DataSource[];
|
|
1119
|
+
theme: Theme;
|
|
1120
|
+
/** Type-checks an expression and returns its issues (already prefixed with the node). */
|
|
1121
|
+
checkExpression(expr: string, prop: string): Issue[];
|
|
1122
|
+
}
|
|
1123
|
+
interface BlockRegistryLike {
|
|
1124
|
+
get(type: string): BlockDefinition | undefined;
|
|
1125
|
+
has(type: string): boolean;
|
|
1126
|
+
}
|
|
1127
|
+
interface BlockDefinition<P extends Record<string, unknown> = Record<string, unknown>> {
|
|
1128
|
+
/** Unique type id. Custom blocks should be namespaced: "acme.risk-profile". */
|
|
1129
|
+
type: string;
|
|
1130
|
+
name: string;
|
|
1131
|
+
description?: string;
|
|
1132
|
+
category: BlockCategory;
|
|
1133
|
+
/** Lucide icon name (e.g. "heading") or an inline `<svg>` string. */
|
|
1134
|
+
icon?: string;
|
|
1135
|
+
keywords?: string[];
|
|
1136
|
+
/**
|
|
1137
|
+
* The tier **the host** sells this block in, badged in the palette and
|
|
1138
|
+
* reported by validation when the host has not enabled it.
|
|
1139
|
+
*
|
|
1140
|
+
* It exists so an embedder can put their own blocks behind their own plans.
|
|
1141
|
+
* BroadPaper's built-in blocks never set it, and must not: the two BroadPaper
|
|
1142
|
+
* licences unlock identical software, and nothing in this SDK reads an
|
|
1143
|
+
* entitlement to decide what to allow. Chart, Table and Repeater carried
|
|
1144
|
+
* `"pro"` for a while, which said the opposite of what we sell.
|
|
1145
|
+
*/
|
|
1146
|
+
license?: LicenseTier;
|
|
1147
|
+
/** Do not show in the block palette (structural nodes, deprecated types). */
|
|
1148
|
+
hidden?: boolean;
|
|
1149
|
+
/** Version of the props shape. Bump and implement `migrate` when it changes. */
|
|
1150
|
+
version?: number;
|
|
1151
|
+
defaultProps: P | (() => P);
|
|
1152
|
+
defaultStyle?: BlockStyle;
|
|
1153
|
+
defaultFlow?: FlowOptions;
|
|
1154
|
+
/** Document text style to inherit from ("body", "h1", ...). */
|
|
1155
|
+
defaultTextStyle?: string;
|
|
1156
|
+
inspector?: InspectorSection[];
|
|
1157
|
+
styleGroups?: StyleGroup[];
|
|
1158
|
+
/** Declares props holding expressions. Derived from `inspector` when omitted. */
|
|
1159
|
+
bindings?: BindingSpec[];
|
|
1160
|
+
container?: ContainerSpec;
|
|
1161
|
+
/** How the paginator may split this node. Containers default to "children", leaves to "none". */
|
|
1162
|
+
split?: SplitMode;
|
|
1163
|
+
/**
|
|
1164
|
+
* What the measurer should inspect: "text" reads line boxes, "table" reads rows.
|
|
1165
|
+
* Derived from `split` when omitted.
|
|
1166
|
+
*/
|
|
1167
|
+
measure?: "text" | "table" | "none";
|
|
1168
|
+
/** Adjust resolved props after binding resolution (compute derived data, sort, etc.). */
|
|
1169
|
+
resolve?(ctx: ResolveHookContext<P>): P | void;
|
|
1170
|
+
render(ctx: RenderContext<P>): VNode | null;
|
|
1171
|
+
validate?(ctx: ValidateContext<P>): Issue[];
|
|
1172
|
+
migrate?(props: Record<string, unknown>, fromVersion: number): P;
|
|
1173
|
+
canvas?: {
|
|
1174
|
+
/** Enables inline editing of a prop directly on the canvas. */
|
|
1175
|
+
inlineEdit?: {
|
|
1176
|
+
prop: string;
|
|
1177
|
+
kind: "richtext" | "text";
|
|
1178
|
+
};
|
|
1179
|
+
/** Layer-tree label. */
|
|
1180
|
+
label?: (props: P) => string;
|
|
1181
|
+
/** Minimum height in px for the empty design-mode placeholder. */
|
|
1182
|
+
minHeight?: number;
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
/** Identity helper that gives full type inference for custom blocks. */
|
|
1186
|
+
declare function defineBlock<P extends Record<string, unknown>>(def: BlockDefinition<P>): BlockDefinition<P>;
|
|
1187
|
+
declare function resolveDefaultProps<P extends Record<string, unknown>>(def: BlockDefinition<P>): P;
|
|
1188
|
+
|
|
1189
|
+
interface RegistryOptions {
|
|
1190
|
+
/** Licence tiers that are enabled. Blocks above the enabled tier are still rendered but flagged. */
|
|
1191
|
+
enabledTiers?: LicenseTier[];
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* The block registry. Built-in blocks and host custom blocks are registered the
|
|
1195
|
+
* same way; there is no privileged path.
|
|
1196
|
+
*/
|
|
1197
|
+
declare class BlockRegistry {
|
|
1198
|
+
private readonly defs;
|
|
1199
|
+
private readonly listeners;
|
|
1200
|
+
private readonly enabledTiers;
|
|
1201
|
+
constructor(defs?: Array<BlockDefinition<any>>, opts?: RegistryOptions);
|
|
1202
|
+
register<P extends Record<string, unknown>>(def: BlockDefinition<P>): this;
|
|
1203
|
+
/** Replaces an existing definition (used for hot-swapping custom blocks in dev). */
|
|
1204
|
+
replace<P extends Record<string, unknown>>(def: BlockDefinition<P>): this;
|
|
1205
|
+
unregister(type: string): this;
|
|
1206
|
+
get(type: string): BlockDefinition | undefined;
|
|
1207
|
+
has(type: string): boolean;
|
|
1208
|
+
require(type: string): BlockDefinition;
|
|
1209
|
+
list(): BlockDefinition[];
|
|
1210
|
+
/** Blocks shown in the palette, grouped by category, honouring `hidden`. */
|
|
1211
|
+
palette(): BlockDefinition[];
|
|
1212
|
+
isTierEnabled(tier: LicenseTier | undefined): boolean;
|
|
1213
|
+
/** The highest tier required by a set of block types. */
|
|
1214
|
+
requiredTier(types: Iterable<string>): LicenseTier;
|
|
1215
|
+
/** Effective binding specs for a block: explicit `bindings`, else derived from the inspector. */
|
|
1216
|
+
bindingsOf(type: string): BindingSpec[];
|
|
1217
|
+
/** Whether `childType` may be placed inside `parentType`. */
|
|
1218
|
+
accepts(parentType: string, childType: string): boolean;
|
|
1219
|
+
subscribe(fn: () => void): () => void;
|
|
1220
|
+
private emit;
|
|
1221
|
+
}
|
|
1222
|
+
declare function bindingSpecsFor(def: BlockDefinition<any>): BindingSpec[];
|
|
1223
|
+
|
|
1224
|
+
declare const blockStyleSchema: z.ZodObject<{
|
|
1225
|
+
textStyle: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1226
|
+
fontFamily: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1227
|
+
fontSize: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1228
|
+
fontWeight: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodEnum<["normal", "bold"]>]>>>;
|
|
1229
|
+
fontStyle: z.ZodOptional<z.ZodOptional<z.ZodEnum<["normal", "italic"]>>>;
|
|
1230
|
+
lineHeight: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1231
|
+
letterSpacing: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1232
|
+
textTransform: z.ZodOptional<z.ZodOptional<z.ZodEnum<["none", "uppercase", "lowercase", "capitalize"]>>>;
|
|
1233
|
+
textAlign: z.ZodOptional<z.ZodOptional<z.ZodEnum<["left", "center", "right", "justify"]>>>;
|
|
1234
|
+
verticalAlign: z.ZodOptional<z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>>;
|
|
1235
|
+
color: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1236
|
+
background: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1237
|
+
padding: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
1238
|
+
top: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1239
|
+
right: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1240
|
+
bottom: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1241
|
+
left: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1242
|
+
}, "strip", z.ZodTypeAny, {
|
|
1243
|
+
left?: number | undefined;
|
|
1244
|
+
right?: number | undefined;
|
|
1245
|
+
top?: number | undefined;
|
|
1246
|
+
bottom?: number | undefined;
|
|
1247
|
+
}, {
|
|
1248
|
+
left?: number | undefined;
|
|
1249
|
+
right?: number | undefined;
|
|
1250
|
+
top?: number | undefined;
|
|
1251
|
+
bottom?: number | undefined;
|
|
1252
|
+
}>>>;
|
|
1253
|
+
margin: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
1254
|
+
top: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1255
|
+
right: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1256
|
+
bottom: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1257
|
+
left: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1258
|
+
}, "strip", z.ZodTypeAny, {
|
|
1259
|
+
left?: number | undefined;
|
|
1260
|
+
right?: number | undefined;
|
|
1261
|
+
top?: number | undefined;
|
|
1262
|
+
bottom?: number | undefined;
|
|
1263
|
+
}, {
|
|
1264
|
+
left?: number | undefined;
|
|
1265
|
+
right?: number | undefined;
|
|
1266
|
+
top?: number | undefined;
|
|
1267
|
+
bottom?: number | undefined;
|
|
1268
|
+
}>>>;
|
|
1269
|
+
border: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
1270
|
+
width: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1271
|
+
style: z.ZodOptional<z.ZodOptional<z.ZodEnum<["solid", "dashed", "dotted", "none"]>>>;
|
|
1272
|
+
color: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1273
|
+
radius: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1274
|
+
sides: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodEnum<["top", "right", "bottom", "left"]>, "many">>>;
|
|
1275
|
+
}, "strip", z.ZodTypeAny, {
|
|
1276
|
+
radius?: number | undefined;
|
|
1277
|
+
color?: string | undefined;
|
|
1278
|
+
style?: "solid" | "dashed" | "dotted" | "none" | undefined;
|
|
1279
|
+
width?: number | undefined;
|
|
1280
|
+
sides?: ("left" | "right" | "top" | "bottom")[] | undefined;
|
|
1281
|
+
}, {
|
|
1282
|
+
radius?: number | undefined;
|
|
1283
|
+
color?: string | undefined;
|
|
1284
|
+
style?: "solid" | "dashed" | "dotted" | "none" | undefined;
|
|
1285
|
+
width?: number | undefined;
|
|
1286
|
+
sides?: ("left" | "right" | "top" | "bottom")[] | undefined;
|
|
1287
|
+
}>>>;
|
|
1288
|
+
width: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>>;
|
|
1289
|
+
height: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1290
|
+
align: z.ZodOptional<z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>>;
|
|
1291
|
+
opacity: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1292
|
+
}, "strip", z.ZodTypeAny, {
|
|
1293
|
+
background?: string | undefined;
|
|
1294
|
+
border?: {
|
|
1295
|
+
radius?: number | undefined;
|
|
1296
|
+
color?: string | undefined;
|
|
1297
|
+
style?: "solid" | "dashed" | "dotted" | "none" | undefined;
|
|
1298
|
+
width?: number | undefined;
|
|
1299
|
+
sides?: ("left" | "right" | "top" | "bottom")[] | undefined;
|
|
1300
|
+
} | undefined;
|
|
1301
|
+
align?: "left" | "center" | "right" | undefined;
|
|
1302
|
+
lineHeight?: number | undefined;
|
|
1303
|
+
color?: string | undefined;
|
|
1304
|
+
padding?: {
|
|
1305
|
+
left?: number | undefined;
|
|
1306
|
+
right?: number | undefined;
|
|
1307
|
+
top?: number | undefined;
|
|
1308
|
+
bottom?: number | undefined;
|
|
1309
|
+
} | undefined;
|
|
1310
|
+
margin?: {
|
|
1311
|
+
left?: number | undefined;
|
|
1312
|
+
right?: number | undefined;
|
|
1313
|
+
top?: number | undefined;
|
|
1314
|
+
bottom?: number | undefined;
|
|
1315
|
+
} | undefined;
|
|
1316
|
+
width?: string | number | undefined;
|
|
1317
|
+
height?: number | undefined;
|
|
1318
|
+
opacity?: number | undefined;
|
|
1319
|
+
textStyle?: string | undefined;
|
|
1320
|
+
fontFamily?: string | undefined;
|
|
1321
|
+
fontSize?: number | undefined;
|
|
1322
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
1323
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
1324
|
+
letterSpacing?: number | undefined;
|
|
1325
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
1326
|
+
textAlign?: "left" | "center" | "right" | "justify" | undefined;
|
|
1327
|
+
verticalAlign?: "top" | "middle" | "bottom" | undefined;
|
|
1328
|
+
}, {
|
|
1329
|
+
background?: string | undefined;
|
|
1330
|
+
border?: {
|
|
1331
|
+
radius?: number | undefined;
|
|
1332
|
+
color?: string | undefined;
|
|
1333
|
+
style?: "solid" | "dashed" | "dotted" | "none" | undefined;
|
|
1334
|
+
width?: number | undefined;
|
|
1335
|
+
sides?: ("left" | "right" | "top" | "bottom")[] | undefined;
|
|
1336
|
+
} | undefined;
|
|
1337
|
+
align?: "left" | "center" | "right" | undefined;
|
|
1338
|
+
lineHeight?: number | undefined;
|
|
1339
|
+
color?: string | undefined;
|
|
1340
|
+
padding?: {
|
|
1341
|
+
left?: number | undefined;
|
|
1342
|
+
right?: number | undefined;
|
|
1343
|
+
top?: number | undefined;
|
|
1344
|
+
bottom?: number | undefined;
|
|
1345
|
+
} | undefined;
|
|
1346
|
+
margin?: {
|
|
1347
|
+
left?: number | undefined;
|
|
1348
|
+
right?: number | undefined;
|
|
1349
|
+
top?: number | undefined;
|
|
1350
|
+
bottom?: number | undefined;
|
|
1351
|
+
} | undefined;
|
|
1352
|
+
width?: string | number | undefined;
|
|
1353
|
+
height?: number | undefined;
|
|
1354
|
+
opacity?: number | undefined;
|
|
1355
|
+
textStyle?: string | undefined;
|
|
1356
|
+
fontFamily?: string | undefined;
|
|
1357
|
+
fontSize?: number | undefined;
|
|
1358
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
1359
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
1360
|
+
letterSpacing?: number | undefined;
|
|
1361
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
1362
|
+
textAlign?: "left" | "center" | "right" | "justify" | undefined;
|
|
1363
|
+
verticalAlign?: "top" | "middle" | "bottom" | undefined;
|
|
1364
|
+
}>;
|
|
1365
|
+
declare const nodeSchema: z.ZodType<Node>;
|
|
1366
|
+
declare const pageSettingsSchema: z.ZodObject<{
|
|
1367
|
+
size: z.ZodUnion<[z.ZodEnum<["A4", "A3", "A5", "Letter", "Legal", "Tabloid"]>, z.ZodObject<{
|
|
1368
|
+
width: z.ZodNumber;
|
|
1369
|
+
height: z.ZodNumber;
|
|
1370
|
+
}, "strip", z.ZodTypeAny, {
|
|
1371
|
+
width: number;
|
|
1372
|
+
height: number;
|
|
1373
|
+
}, {
|
|
1374
|
+
width: number;
|
|
1375
|
+
height: number;
|
|
1376
|
+
}>]>;
|
|
1377
|
+
orientation: z.ZodEnum<["portrait", "landscape"]>;
|
|
1378
|
+
margins: z.ZodObject<{
|
|
1379
|
+
top: z.ZodNumber;
|
|
1380
|
+
right: z.ZodNumber;
|
|
1381
|
+
bottom: z.ZodNumber;
|
|
1382
|
+
left: z.ZodNumber;
|
|
1383
|
+
}, "strip", z.ZodTypeAny, {
|
|
1384
|
+
left: number;
|
|
1385
|
+
right: number;
|
|
1386
|
+
top: number;
|
|
1387
|
+
bottom: number;
|
|
1388
|
+
}, {
|
|
1389
|
+
left: number;
|
|
1390
|
+
right: number;
|
|
1391
|
+
top: number;
|
|
1392
|
+
bottom: number;
|
|
1393
|
+
}>;
|
|
1394
|
+
header: z.ZodObject<{
|
|
1395
|
+
height: z.ZodNumber;
|
|
1396
|
+
differentFirstPage: z.ZodBoolean;
|
|
1397
|
+
}, "strip", z.ZodTypeAny, {
|
|
1398
|
+
height: number;
|
|
1399
|
+
differentFirstPage: boolean;
|
|
1400
|
+
}, {
|
|
1401
|
+
height: number;
|
|
1402
|
+
differentFirstPage: boolean;
|
|
1403
|
+
}>;
|
|
1404
|
+
footer: z.ZodObject<{
|
|
1405
|
+
height: z.ZodNumber;
|
|
1406
|
+
differentFirstPage: z.ZodBoolean;
|
|
1407
|
+
}, "strip", z.ZodTypeAny, {
|
|
1408
|
+
height: number;
|
|
1409
|
+
differentFirstPage: boolean;
|
|
1410
|
+
}, {
|
|
1411
|
+
height: number;
|
|
1412
|
+
differentFirstPage: boolean;
|
|
1413
|
+
}>;
|
|
1414
|
+
background: z.ZodOptional<z.ZodString>;
|
|
1415
|
+
minPages: z.ZodOptional<z.ZodNumber>;
|
|
1416
|
+
}, "strip", z.ZodTypeAny, {
|
|
1417
|
+
header: {
|
|
1418
|
+
height: number;
|
|
1419
|
+
differentFirstPage: boolean;
|
|
1420
|
+
};
|
|
1421
|
+
footer: {
|
|
1422
|
+
height: number;
|
|
1423
|
+
differentFirstPage: boolean;
|
|
1424
|
+
};
|
|
1425
|
+
size: "A4" | "A3" | "A5" | "Letter" | "Legal" | "Tabloid" | {
|
|
1426
|
+
width: number;
|
|
1427
|
+
height: number;
|
|
1428
|
+
};
|
|
1429
|
+
orientation: "portrait" | "landscape";
|
|
1430
|
+
margins: {
|
|
1431
|
+
left: number;
|
|
1432
|
+
right: number;
|
|
1433
|
+
top: number;
|
|
1434
|
+
bottom: number;
|
|
1435
|
+
};
|
|
1436
|
+
background?: string | undefined;
|
|
1437
|
+
minPages?: number | undefined;
|
|
1438
|
+
}, {
|
|
1439
|
+
header: {
|
|
1440
|
+
height: number;
|
|
1441
|
+
differentFirstPage: boolean;
|
|
1442
|
+
};
|
|
1443
|
+
footer: {
|
|
1444
|
+
height: number;
|
|
1445
|
+
differentFirstPage: boolean;
|
|
1446
|
+
};
|
|
1447
|
+
size: "A4" | "A3" | "A5" | "Letter" | "Legal" | "Tabloid" | {
|
|
1448
|
+
width: number;
|
|
1449
|
+
height: number;
|
|
1450
|
+
};
|
|
1451
|
+
orientation: "portrait" | "landscape";
|
|
1452
|
+
margins: {
|
|
1453
|
+
left: number;
|
|
1454
|
+
right: number;
|
|
1455
|
+
top: number;
|
|
1456
|
+
bottom: number;
|
|
1457
|
+
};
|
|
1458
|
+
background?: string | undefined;
|
|
1459
|
+
minPages?: number | undefined;
|
|
1460
|
+
}>;
|
|
1461
|
+
declare const documentStylesSchema: z.ZodObject<{
|
|
1462
|
+
text: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1463
|
+
fontFamily: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1464
|
+
fontSize: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1465
|
+
fontWeight: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodEnum<["normal", "bold"]>]>>>;
|
|
1466
|
+
fontStyle: z.ZodOptional<z.ZodOptional<z.ZodEnum<["normal", "italic"]>>>;
|
|
1467
|
+
lineHeight: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1468
|
+
letterSpacing: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1469
|
+
textTransform: z.ZodOptional<z.ZodOptional<z.ZodEnum<["none", "uppercase", "lowercase", "capitalize"]>>>;
|
|
1470
|
+
color: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1471
|
+
marginTop: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1472
|
+
marginBottom: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1473
|
+
keepWithNext: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
1474
|
+
}, "strip", z.ZodTypeAny, {
|
|
1475
|
+
lineHeight?: number | undefined;
|
|
1476
|
+
color?: string | undefined;
|
|
1477
|
+
fontFamily?: string | undefined;
|
|
1478
|
+
fontSize?: number | undefined;
|
|
1479
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
1480
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
1481
|
+
letterSpacing?: number | undefined;
|
|
1482
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
1483
|
+
keepWithNext?: boolean | undefined;
|
|
1484
|
+
marginTop?: number | undefined;
|
|
1485
|
+
marginBottom?: number | undefined;
|
|
1486
|
+
}, {
|
|
1487
|
+
lineHeight?: number | undefined;
|
|
1488
|
+
color?: string | undefined;
|
|
1489
|
+
fontFamily?: string | undefined;
|
|
1490
|
+
fontSize?: number | undefined;
|
|
1491
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
1492
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
1493
|
+
letterSpacing?: number | undefined;
|
|
1494
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
1495
|
+
keepWithNext?: boolean | undefined;
|
|
1496
|
+
marginTop?: number | undefined;
|
|
1497
|
+
marginBottom?: number | undefined;
|
|
1498
|
+
}>>;
|
|
1499
|
+
table: z.ZodObject<{
|
|
1500
|
+
fontSize: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1501
|
+
headerBackground: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1502
|
+
headerColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1503
|
+
headerFontWeight: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodEnum<["normal", "bold"]>]>>>;
|
|
1504
|
+
borderColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1505
|
+
borderWidth: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1506
|
+
borders: z.ZodOptional<z.ZodOptional<z.ZodEnum<["all", "horizontal", "outer", "none"]>>>;
|
|
1507
|
+
zebraBackground: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1508
|
+
cellPaddingX: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1509
|
+
cellPaddingY: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1510
|
+
}, "strip", z.ZodTypeAny, {
|
|
1511
|
+
headerBackground?: string | undefined;
|
|
1512
|
+
headerColor?: string | undefined;
|
|
1513
|
+
zebraBackground?: string | undefined;
|
|
1514
|
+
borderColor?: string | undefined;
|
|
1515
|
+
fontSize?: number | undefined;
|
|
1516
|
+
headerFontWeight?: number | "normal" | "bold" | undefined;
|
|
1517
|
+
borderWidth?: number | undefined;
|
|
1518
|
+
borders?: "none" | "all" | "horizontal" | "outer" | undefined;
|
|
1519
|
+
cellPaddingX?: number | undefined;
|
|
1520
|
+
cellPaddingY?: number | undefined;
|
|
1521
|
+
}, {
|
|
1522
|
+
headerBackground?: string | undefined;
|
|
1523
|
+
headerColor?: string | undefined;
|
|
1524
|
+
zebraBackground?: string | undefined;
|
|
1525
|
+
borderColor?: string | undefined;
|
|
1526
|
+
fontSize?: number | undefined;
|
|
1527
|
+
headerFontWeight?: number | "normal" | "bold" | undefined;
|
|
1528
|
+
borderWidth?: number | undefined;
|
|
1529
|
+
borders?: "none" | "all" | "horizontal" | "outer" | undefined;
|
|
1530
|
+
cellPaddingX?: number | undefined;
|
|
1531
|
+
cellPaddingY?: number | undefined;
|
|
1532
|
+
}>;
|
|
1533
|
+
card: z.ZodObject<{
|
|
1534
|
+
background: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1535
|
+
borderColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1536
|
+
borderWidth: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1537
|
+
borderRadius: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1538
|
+
padding: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1539
|
+
shadow: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
1540
|
+
}, "strip", z.ZodTypeAny, {
|
|
1541
|
+
background?: string | undefined;
|
|
1542
|
+
borderColor?: string | undefined;
|
|
1543
|
+
padding?: number | undefined;
|
|
1544
|
+
borderWidth?: number | undefined;
|
|
1545
|
+
borderRadius?: number | undefined;
|
|
1546
|
+
shadow?: boolean | undefined;
|
|
1547
|
+
}, {
|
|
1548
|
+
background?: string | undefined;
|
|
1549
|
+
borderColor?: string | undefined;
|
|
1550
|
+
padding?: number | undefined;
|
|
1551
|
+
borderWidth?: number | undefined;
|
|
1552
|
+
borderRadius?: number | undefined;
|
|
1553
|
+
shadow?: boolean | undefined;
|
|
1554
|
+
}>;
|
|
1555
|
+
link: z.ZodObject<{
|
|
1556
|
+
color: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1557
|
+
underline: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
1558
|
+
}, "strip", z.ZodTypeAny, {
|
|
1559
|
+
color?: string | undefined;
|
|
1560
|
+
underline?: boolean | undefined;
|
|
1561
|
+
}, {
|
|
1562
|
+
color?: string | undefined;
|
|
1563
|
+
underline?: boolean | undefined;
|
|
1564
|
+
}>;
|
|
1565
|
+
spacing: z.ZodObject<{
|
|
1566
|
+
blockGap: z.ZodNumber;
|
|
1567
|
+
sectionPadding: z.ZodNumber;
|
|
1568
|
+
columnGap: z.ZodNumber;
|
|
1569
|
+
}, "strip", z.ZodTypeAny, {
|
|
1570
|
+
blockGap: number;
|
|
1571
|
+
sectionPadding: number;
|
|
1572
|
+
columnGap: number;
|
|
1573
|
+
}, {
|
|
1574
|
+
blockGap: number;
|
|
1575
|
+
sectionPadding: number;
|
|
1576
|
+
columnGap: number;
|
|
1577
|
+
}>;
|
|
1578
|
+
}, "strip", z.ZodTypeAny, {
|
|
1579
|
+
text: Record<string, {
|
|
1580
|
+
lineHeight?: number | undefined;
|
|
1581
|
+
color?: string | undefined;
|
|
1582
|
+
fontFamily?: string | undefined;
|
|
1583
|
+
fontSize?: number | undefined;
|
|
1584
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
1585
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
1586
|
+
letterSpacing?: number | undefined;
|
|
1587
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
1588
|
+
keepWithNext?: boolean | undefined;
|
|
1589
|
+
marginTop?: number | undefined;
|
|
1590
|
+
marginBottom?: number | undefined;
|
|
1591
|
+
}>;
|
|
1592
|
+
link: {
|
|
1593
|
+
color?: string | undefined;
|
|
1594
|
+
underline?: boolean | undefined;
|
|
1595
|
+
};
|
|
1596
|
+
table: {
|
|
1597
|
+
headerBackground?: string | undefined;
|
|
1598
|
+
headerColor?: string | undefined;
|
|
1599
|
+
zebraBackground?: string | undefined;
|
|
1600
|
+
borderColor?: string | undefined;
|
|
1601
|
+
fontSize?: number | undefined;
|
|
1602
|
+
headerFontWeight?: number | "normal" | "bold" | undefined;
|
|
1603
|
+
borderWidth?: number | undefined;
|
|
1604
|
+
borders?: "none" | "all" | "horizontal" | "outer" | undefined;
|
|
1605
|
+
cellPaddingX?: number | undefined;
|
|
1606
|
+
cellPaddingY?: number | undefined;
|
|
1607
|
+
};
|
|
1608
|
+
spacing: {
|
|
1609
|
+
blockGap: number;
|
|
1610
|
+
sectionPadding: number;
|
|
1611
|
+
columnGap: number;
|
|
1612
|
+
};
|
|
1613
|
+
card: {
|
|
1614
|
+
background?: string | undefined;
|
|
1615
|
+
borderColor?: string | undefined;
|
|
1616
|
+
padding?: number | undefined;
|
|
1617
|
+
borderWidth?: number | undefined;
|
|
1618
|
+
borderRadius?: number | undefined;
|
|
1619
|
+
shadow?: boolean | undefined;
|
|
1620
|
+
};
|
|
1621
|
+
}, {
|
|
1622
|
+
text: Record<string, {
|
|
1623
|
+
lineHeight?: number | undefined;
|
|
1624
|
+
color?: string | undefined;
|
|
1625
|
+
fontFamily?: string | undefined;
|
|
1626
|
+
fontSize?: number | undefined;
|
|
1627
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
1628
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
1629
|
+
letterSpacing?: number | undefined;
|
|
1630
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
1631
|
+
keepWithNext?: boolean | undefined;
|
|
1632
|
+
marginTop?: number | undefined;
|
|
1633
|
+
marginBottom?: number | undefined;
|
|
1634
|
+
}>;
|
|
1635
|
+
link: {
|
|
1636
|
+
color?: string | undefined;
|
|
1637
|
+
underline?: boolean | undefined;
|
|
1638
|
+
};
|
|
1639
|
+
table: {
|
|
1640
|
+
headerBackground?: string | undefined;
|
|
1641
|
+
headerColor?: string | undefined;
|
|
1642
|
+
zebraBackground?: string | undefined;
|
|
1643
|
+
borderColor?: string | undefined;
|
|
1644
|
+
fontSize?: number | undefined;
|
|
1645
|
+
headerFontWeight?: number | "normal" | "bold" | undefined;
|
|
1646
|
+
borderWidth?: number | undefined;
|
|
1647
|
+
borders?: "none" | "all" | "horizontal" | "outer" | undefined;
|
|
1648
|
+
cellPaddingX?: number | undefined;
|
|
1649
|
+
cellPaddingY?: number | undefined;
|
|
1650
|
+
};
|
|
1651
|
+
spacing: {
|
|
1652
|
+
blockGap: number;
|
|
1653
|
+
sectionPadding: number;
|
|
1654
|
+
columnGap: number;
|
|
1655
|
+
};
|
|
1656
|
+
card: {
|
|
1657
|
+
background?: string | undefined;
|
|
1658
|
+
borderColor?: string | undefined;
|
|
1659
|
+
padding?: number | undefined;
|
|
1660
|
+
borderWidth?: number | undefined;
|
|
1661
|
+
borderRadius?: number | undefined;
|
|
1662
|
+
shadow?: boolean | undefined;
|
|
1663
|
+
};
|
|
1664
|
+
}>;
|
|
1665
|
+
declare const templateSchema: z.ZodObject<{
|
|
1666
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
1667
|
+
id: z.ZodString;
|
|
1668
|
+
name: z.ZodString;
|
|
1669
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
1670
|
+
createdAt: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1671
|
+
updatedAt: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1672
|
+
author: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1673
|
+
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1674
|
+
tags: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
1675
|
+
custom: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1676
|
+
}, "strip", z.ZodTypeAny, {
|
|
1677
|
+
custom?: Record<string, unknown> | undefined;
|
|
1678
|
+
createdAt?: string | undefined;
|
|
1679
|
+
updatedAt?: string | undefined;
|
|
1680
|
+
author?: string | undefined;
|
|
1681
|
+
description?: string | undefined;
|
|
1682
|
+
tags?: string[] | undefined;
|
|
1683
|
+
}, {
|
|
1684
|
+
custom?: Record<string, unknown> | undefined;
|
|
1685
|
+
createdAt?: string | undefined;
|
|
1686
|
+
updatedAt?: string | undefined;
|
|
1687
|
+
author?: string | undefined;
|
|
1688
|
+
description?: string | undefined;
|
|
1689
|
+
tags?: string[] | undefined;
|
|
1690
|
+
}>>;
|
|
1691
|
+
page: z.ZodObject<{
|
|
1692
|
+
size: z.ZodUnion<[z.ZodEnum<["A4", "A3", "A5", "Letter", "Legal", "Tabloid"]>, z.ZodObject<{
|
|
1693
|
+
width: z.ZodNumber;
|
|
1694
|
+
height: z.ZodNumber;
|
|
1695
|
+
}, "strip", z.ZodTypeAny, {
|
|
1696
|
+
width: number;
|
|
1697
|
+
height: number;
|
|
1698
|
+
}, {
|
|
1699
|
+
width: number;
|
|
1700
|
+
height: number;
|
|
1701
|
+
}>]>;
|
|
1702
|
+
orientation: z.ZodEnum<["portrait", "landscape"]>;
|
|
1703
|
+
margins: z.ZodObject<{
|
|
1704
|
+
top: z.ZodNumber;
|
|
1705
|
+
right: z.ZodNumber;
|
|
1706
|
+
bottom: z.ZodNumber;
|
|
1707
|
+
left: z.ZodNumber;
|
|
1708
|
+
}, "strip", z.ZodTypeAny, {
|
|
1709
|
+
left: number;
|
|
1710
|
+
right: number;
|
|
1711
|
+
top: number;
|
|
1712
|
+
bottom: number;
|
|
1713
|
+
}, {
|
|
1714
|
+
left: number;
|
|
1715
|
+
right: number;
|
|
1716
|
+
top: number;
|
|
1717
|
+
bottom: number;
|
|
1718
|
+
}>;
|
|
1719
|
+
header: z.ZodObject<{
|
|
1720
|
+
height: z.ZodNumber;
|
|
1721
|
+
differentFirstPage: z.ZodBoolean;
|
|
1722
|
+
}, "strip", z.ZodTypeAny, {
|
|
1723
|
+
height: number;
|
|
1724
|
+
differentFirstPage: boolean;
|
|
1725
|
+
}, {
|
|
1726
|
+
height: number;
|
|
1727
|
+
differentFirstPage: boolean;
|
|
1728
|
+
}>;
|
|
1729
|
+
footer: z.ZodObject<{
|
|
1730
|
+
height: z.ZodNumber;
|
|
1731
|
+
differentFirstPage: z.ZodBoolean;
|
|
1732
|
+
}, "strip", z.ZodTypeAny, {
|
|
1733
|
+
height: number;
|
|
1734
|
+
differentFirstPage: boolean;
|
|
1735
|
+
}, {
|
|
1736
|
+
height: number;
|
|
1737
|
+
differentFirstPage: boolean;
|
|
1738
|
+
}>;
|
|
1739
|
+
background: z.ZodOptional<z.ZodString>;
|
|
1740
|
+
minPages: z.ZodOptional<z.ZodNumber>;
|
|
1741
|
+
}, "strip", z.ZodTypeAny, {
|
|
1742
|
+
header: {
|
|
1743
|
+
height: number;
|
|
1744
|
+
differentFirstPage: boolean;
|
|
1745
|
+
};
|
|
1746
|
+
footer: {
|
|
1747
|
+
height: number;
|
|
1748
|
+
differentFirstPage: boolean;
|
|
1749
|
+
};
|
|
1750
|
+
size: "A4" | "A3" | "A5" | "Letter" | "Legal" | "Tabloid" | {
|
|
1751
|
+
width: number;
|
|
1752
|
+
height: number;
|
|
1753
|
+
};
|
|
1754
|
+
orientation: "portrait" | "landscape";
|
|
1755
|
+
margins: {
|
|
1756
|
+
left: number;
|
|
1757
|
+
right: number;
|
|
1758
|
+
top: number;
|
|
1759
|
+
bottom: number;
|
|
1760
|
+
};
|
|
1761
|
+
background?: string | undefined;
|
|
1762
|
+
minPages?: number | undefined;
|
|
1763
|
+
}, {
|
|
1764
|
+
header: {
|
|
1765
|
+
height: number;
|
|
1766
|
+
differentFirstPage: boolean;
|
|
1767
|
+
};
|
|
1768
|
+
footer: {
|
|
1769
|
+
height: number;
|
|
1770
|
+
differentFirstPage: boolean;
|
|
1771
|
+
};
|
|
1772
|
+
size: "A4" | "A3" | "A5" | "Letter" | "Legal" | "Tabloid" | {
|
|
1773
|
+
width: number;
|
|
1774
|
+
height: number;
|
|
1775
|
+
};
|
|
1776
|
+
orientation: "portrait" | "landscape";
|
|
1777
|
+
margins: {
|
|
1778
|
+
left: number;
|
|
1779
|
+
right: number;
|
|
1780
|
+
top: number;
|
|
1781
|
+
bottom: number;
|
|
1782
|
+
};
|
|
1783
|
+
background?: string | undefined;
|
|
1784
|
+
minPages?: number | undefined;
|
|
1785
|
+
}>;
|
|
1786
|
+
styles: z.ZodObject<{
|
|
1787
|
+
text: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1788
|
+
fontFamily: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1789
|
+
fontSize: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1790
|
+
fontWeight: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodEnum<["normal", "bold"]>]>>>;
|
|
1791
|
+
fontStyle: z.ZodOptional<z.ZodOptional<z.ZodEnum<["normal", "italic"]>>>;
|
|
1792
|
+
lineHeight: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1793
|
+
letterSpacing: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1794
|
+
textTransform: z.ZodOptional<z.ZodOptional<z.ZodEnum<["none", "uppercase", "lowercase", "capitalize"]>>>;
|
|
1795
|
+
color: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1796
|
+
marginTop: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1797
|
+
marginBottom: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1798
|
+
keepWithNext: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
1799
|
+
}, "strip", z.ZodTypeAny, {
|
|
1800
|
+
lineHeight?: number | undefined;
|
|
1801
|
+
color?: string | undefined;
|
|
1802
|
+
fontFamily?: string | undefined;
|
|
1803
|
+
fontSize?: number | undefined;
|
|
1804
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
1805
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
1806
|
+
letterSpacing?: number | undefined;
|
|
1807
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
1808
|
+
keepWithNext?: boolean | undefined;
|
|
1809
|
+
marginTop?: number | undefined;
|
|
1810
|
+
marginBottom?: number | undefined;
|
|
1811
|
+
}, {
|
|
1812
|
+
lineHeight?: number | undefined;
|
|
1813
|
+
color?: string | undefined;
|
|
1814
|
+
fontFamily?: string | undefined;
|
|
1815
|
+
fontSize?: number | undefined;
|
|
1816
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
1817
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
1818
|
+
letterSpacing?: number | undefined;
|
|
1819
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
1820
|
+
keepWithNext?: boolean | undefined;
|
|
1821
|
+
marginTop?: number | undefined;
|
|
1822
|
+
marginBottom?: number | undefined;
|
|
1823
|
+
}>>;
|
|
1824
|
+
table: z.ZodObject<{
|
|
1825
|
+
fontSize: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1826
|
+
headerBackground: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1827
|
+
headerColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1828
|
+
headerFontWeight: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodEnum<["normal", "bold"]>]>>>;
|
|
1829
|
+
borderColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1830
|
+
borderWidth: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1831
|
+
borders: z.ZodOptional<z.ZodOptional<z.ZodEnum<["all", "horizontal", "outer", "none"]>>>;
|
|
1832
|
+
zebraBackground: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1833
|
+
cellPaddingX: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1834
|
+
cellPaddingY: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1835
|
+
}, "strip", z.ZodTypeAny, {
|
|
1836
|
+
headerBackground?: string | undefined;
|
|
1837
|
+
headerColor?: string | undefined;
|
|
1838
|
+
zebraBackground?: string | undefined;
|
|
1839
|
+
borderColor?: string | undefined;
|
|
1840
|
+
fontSize?: number | undefined;
|
|
1841
|
+
headerFontWeight?: number | "normal" | "bold" | undefined;
|
|
1842
|
+
borderWidth?: number | undefined;
|
|
1843
|
+
borders?: "none" | "all" | "horizontal" | "outer" | undefined;
|
|
1844
|
+
cellPaddingX?: number | undefined;
|
|
1845
|
+
cellPaddingY?: number | undefined;
|
|
1846
|
+
}, {
|
|
1847
|
+
headerBackground?: string | undefined;
|
|
1848
|
+
headerColor?: string | undefined;
|
|
1849
|
+
zebraBackground?: string | undefined;
|
|
1850
|
+
borderColor?: string | undefined;
|
|
1851
|
+
fontSize?: number | undefined;
|
|
1852
|
+
headerFontWeight?: number | "normal" | "bold" | undefined;
|
|
1853
|
+
borderWidth?: number | undefined;
|
|
1854
|
+
borders?: "none" | "all" | "horizontal" | "outer" | undefined;
|
|
1855
|
+
cellPaddingX?: number | undefined;
|
|
1856
|
+
cellPaddingY?: number | undefined;
|
|
1857
|
+
}>;
|
|
1858
|
+
card: z.ZodObject<{
|
|
1859
|
+
background: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1860
|
+
borderColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1861
|
+
borderWidth: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1862
|
+
borderRadius: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1863
|
+
padding: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1864
|
+
shadow: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
1865
|
+
}, "strip", z.ZodTypeAny, {
|
|
1866
|
+
background?: string | undefined;
|
|
1867
|
+
borderColor?: string | undefined;
|
|
1868
|
+
padding?: number | undefined;
|
|
1869
|
+
borderWidth?: number | undefined;
|
|
1870
|
+
borderRadius?: number | undefined;
|
|
1871
|
+
shadow?: boolean | undefined;
|
|
1872
|
+
}, {
|
|
1873
|
+
background?: string | undefined;
|
|
1874
|
+
borderColor?: string | undefined;
|
|
1875
|
+
padding?: number | undefined;
|
|
1876
|
+
borderWidth?: number | undefined;
|
|
1877
|
+
borderRadius?: number | undefined;
|
|
1878
|
+
shadow?: boolean | undefined;
|
|
1879
|
+
}>;
|
|
1880
|
+
link: z.ZodObject<{
|
|
1881
|
+
color: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1882
|
+
underline: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
1883
|
+
}, "strip", z.ZodTypeAny, {
|
|
1884
|
+
color?: string | undefined;
|
|
1885
|
+
underline?: boolean | undefined;
|
|
1886
|
+
}, {
|
|
1887
|
+
color?: string | undefined;
|
|
1888
|
+
underline?: boolean | undefined;
|
|
1889
|
+
}>;
|
|
1890
|
+
spacing: z.ZodObject<{
|
|
1891
|
+
blockGap: z.ZodNumber;
|
|
1892
|
+
sectionPadding: z.ZodNumber;
|
|
1893
|
+
columnGap: z.ZodNumber;
|
|
1894
|
+
}, "strip", z.ZodTypeAny, {
|
|
1895
|
+
blockGap: number;
|
|
1896
|
+
sectionPadding: number;
|
|
1897
|
+
columnGap: number;
|
|
1898
|
+
}, {
|
|
1899
|
+
blockGap: number;
|
|
1900
|
+
sectionPadding: number;
|
|
1901
|
+
columnGap: number;
|
|
1902
|
+
}>;
|
|
1903
|
+
}, "strip", z.ZodTypeAny, {
|
|
1904
|
+
text: Record<string, {
|
|
1905
|
+
lineHeight?: number | undefined;
|
|
1906
|
+
color?: string | undefined;
|
|
1907
|
+
fontFamily?: string | undefined;
|
|
1908
|
+
fontSize?: number | undefined;
|
|
1909
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
1910
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
1911
|
+
letterSpacing?: number | undefined;
|
|
1912
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
1913
|
+
keepWithNext?: boolean | undefined;
|
|
1914
|
+
marginTop?: number | undefined;
|
|
1915
|
+
marginBottom?: number | undefined;
|
|
1916
|
+
}>;
|
|
1917
|
+
link: {
|
|
1918
|
+
color?: string | undefined;
|
|
1919
|
+
underline?: boolean | undefined;
|
|
1920
|
+
};
|
|
1921
|
+
table: {
|
|
1922
|
+
headerBackground?: string | undefined;
|
|
1923
|
+
headerColor?: string | undefined;
|
|
1924
|
+
zebraBackground?: string | undefined;
|
|
1925
|
+
borderColor?: string | undefined;
|
|
1926
|
+
fontSize?: number | undefined;
|
|
1927
|
+
headerFontWeight?: number | "normal" | "bold" | undefined;
|
|
1928
|
+
borderWidth?: number | undefined;
|
|
1929
|
+
borders?: "none" | "all" | "horizontal" | "outer" | undefined;
|
|
1930
|
+
cellPaddingX?: number | undefined;
|
|
1931
|
+
cellPaddingY?: number | undefined;
|
|
1932
|
+
};
|
|
1933
|
+
spacing: {
|
|
1934
|
+
blockGap: number;
|
|
1935
|
+
sectionPadding: number;
|
|
1936
|
+
columnGap: number;
|
|
1937
|
+
};
|
|
1938
|
+
card: {
|
|
1939
|
+
background?: string | undefined;
|
|
1940
|
+
borderColor?: string | undefined;
|
|
1941
|
+
padding?: number | undefined;
|
|
1942
|
+
borderWidth?: number | undefined;
|
|
1943
|
+
borderRadius?: number | undefined;
|
|
1944
|
+
shadow?: boolean | undefined;
|
|
1945
|
+
};
|
|
1946
|
+
}, {
|
|
1947
|
+
text: Record<string, {
|
|
1948
|
+
lineHeight?: number | undefined;
|
|
1949
|
+
color?: string | undefined;
|
|
1950
|
+
fontFamily?: string | undefined;
|
|
1951
|
+
fontSize?: number | undefined;
|
|
1952
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
1953
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
1954
|
+
letterSpacing?: number | undefined;
|
|
1955
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
1956
|
+
keepWithNext?: boolean | undefined;
|
|
1957
|
+
marginTop?: number | undefined;
|
|
1958
|
+
marginBottom?: number | undefined;
|
|
1959
|
+
}>;
|
|
1960
|
+
link: {
|
|
1961
|
+
color?: string | undefined;
|
|
1962
|
+
underline?: boolean | undefined;
|
|
1963
|
+
};
|
|
1964
|
+
table: {
|
|
1965
|
+
headerBackground?: string | undefined;
|
|
1966
|
+
headerColor?: string | undefined;
|
|
1967
|
+
zebraBackground?: string | undefined;
|
|
1968
|
+
borderColor?: string | undefined;
|
|
1969
|
+
fontSize?: number | undefined;
|
|
1970
|
+
headerFontWeight?: number | "normal" | "bold" | undefined;
|
|
1971
|
+
borderWidth?: number | undefined;
|
|
1972
|
+
borders?: "none" | "all" | "horizontal" | "outer" | undefined;
|
|
1973
|
+
cellPaddingX?: number | undefined;
|
|
1974
|
+
cellPaddingY?: number | undefined;
|
|
1975
|
+
};
|
|
1976
|
+
spacing: {
|
|
1977
|
+
blockGap: number;
|
|
1978
|
+
sectionPadding: number;
|
|
1979
|
+
columnGap: number;
|
|
1980
|
+
};
|
|
1981
|
+
card: {
|
|
1982
|
+
background?: string | undefined;
|
|
1983
|
+
borderColor?: string | undefined;
|
|
1984
|
+
padding?: number | undefined;
|
|
1985
|
+
borderWidth?: number | undefined;
|
|
1986
|
+
borderRadius?: number | undefined;
|
|
1987
|
+
shadow?: boolean | undefined;
|
|
1988
|
+
};
|
|
1989
|
+
}>;
|
|
1990
|
+
header: z.ZodObject<{
|
|
1991
|
+
default: z.ZodArray<z.ZodType<Node, z.ZodTypeDef, Node>, "many">;
|
|
1992
|
+
firstPage: z.ZodOptional<z.ZodArray<z.ZodType<Node, z.ZodTypeDef, Node>, "many">>;
|
|
1993
|
+
}, "strip", z.ZodTypeAny, {
|
|
1994
|
+
default: Node[];
|
|
1995
|
+
firstPage?: Node[] | undefined;
|
|
1996
|
+
}, {
|
|
1997
|
+
default: Node[];
|
|
1998
|
+
firstPage?: Node[] | undefined;
|
|
1999
|
+
}>;
|
|
2000
|
+
footer: z.ZodObject<{
|
|
2001
|
+
default: z.ZodArray<z.ZodType<Node, z.ZodTypeDef, Node>, "many">;
|
|
2002
|
+
firstPage: z.ZodOptional<z.ZodArray<z.ZodType<Node, z.ZodTypeDef, Node>, "many">>;
|
|
2003
|
+
}, "strip", z.ZodTypeAny, {
|
|
2004
|
+
default: Node[];
|
|
2005
|
+
firstPage?: Node[] | undefined;
|
|
2006
|
+
}, {
|
|
2007
|
+
default: Node[];
|
|
2008
|
+
firstPage?: Node[] | undefined;
|
|
2009
|
+
}>;
|
|
2010
|
+
body: z.ZodArray<z.ZodType<Node, z.ZodTypeDef, Node>, "many">;
|
|
2011
|
+
library: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2012
|
+
id: z.ZodString;
|
|
2013
|
+
name: z.ZodString;
|
|
2014
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2015
|
+
category: z.ZodOptional<z.ZodString>;
|
|
2016
|
+
node: z.ZodType<Node, z.ZodTypeDef, Node>;
|
|
2017
|
+
thumbnail: z.ZodOptional<z.ZodString>;
|
|
2018
|
+
}, "strip", z.ZodTypeAny, {
|
|
2019
|
+
name: string;
|
|
2020
|
+
id: string;
|
|
2021
|
+
node: Node;
|
|
2022
|
+
description?: string | undefined;
|
|
2023
|
+
category?: string | undefined;
|
|
2024
|
+
thumbnail?: string | undefined;
|
|
2025
|
+
}, {
|
|
2026
|
+
name: string;
|
|
2027
|
+
id: string;
|
|
2028
|
+
node: Node;
|
|
2029
|
+
description?: string | undefined;
|
|
2030
|
+
category?: string | undefined;
|
|
2031
|
+
thumbnail?: string | undefined;
|
|
2032
|
+
}>, "many">>;
|
|
2033
|
+
settings: z.ZodOptional<z.ZodObject<{
|
|
2034
|
+
locale: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
2035
|
+
currency: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
2036
|
+
timeZone: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
2037
|
+
dataSources: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
2038
|
+
}, "strip", z.ZodTypeAny, {
|
|
2039
|
+
currency?: string | undefined;
|
|
2040
|
+
locale?: string | undefined;
|
|
2041
|
+
timeZone?: string | undefined;
|
|
2042
|
+
dataSources?: string[] | undefined;
|
|
2043
|
+
}, {
|
|
2044
|
+
currency?: string | undefined;
|
|
2045
|
+
locale?: string | undefined;
|
|
2046
|
+
timeZone?: string | undefined;
|
|
2047
|
+
dataSources?: string[] | undefined;
|
|
2048
|
+
}>>;
|
|
2049
|
+
}, "strip", z.ZodTypeAny, {
|
|
2050
|
+
body: Node[];
|
|
2051
|
+
page: {
|
|
2052
|
+
header: {
|
|
2053
|
+
height: number;
|
|
2054
|
+
differentFirstPage: boolean;
|
|
2055
|
+
};
|
|
2056
|
+
footer: {
|
|
2057
|
+
height: number;
|
|
2058
|
+
differentFirstPage: boolean;
|
|
2059
|
+
};
|
|
2060
|
+
size: "A4" | "A3" | "A5" | "Letter" | "Legal" | "Tabloid" | {
|
|
2061
|
+
width: number;
|
|
2062
|
+
height: number;
|
|
2063
|
+
};
|
|
2064
|
+
orientation: "portrait" | "landscape";
|
|
2065
|
+
margins: {
|
|
2066
|
+
left: number;
|
|
2067
|
+
right: number;
|
|
2068
|
+
top: number;
|
|
2069
|
+
bottom: number;
|
|
2070
|
+
};
|
|
2071
|
+
background?: string | undefined;
|
|
2072
|
+
minPages?: number | undefined;
|
|
2073
|
+
};
|
|
2074
|
+
schemaVersion: 1;
|
|
2075
|
+
name: string;
|
|
2076
|
+
id: string;
|
|
2077
|
+
styles: {
|
|
2078
|
+
text: Record<string, {
|
|
2079
|
+
lineHeight?: number | undefined;
|
|
2080
|
+
color?: string | undefined;
|
|
2081
|
+
fontFamily?: string | undefined;
|
|
2082
|
+
fontSize?: number | undefined;
|
|
2083
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
2084
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
2085
|
+
letterSpacing?: number | undefined;
|
|
2086
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
2087
|
+
keepWithNext?: boolean | undefined;
|
|
2088
|
+
marginTop?: number | undefined;
|
|
2089
|
+
marginBottom?: number | undefined;
|
|
2090
|
+
}>;
|
|
2091
|
+
link: {
|
|
2092
|
+
color?: string | undefined;
|
|
2093
|
+
underline?: boolean | undefined;
|
|
2094
|
+
};
|
|
2095
|
+
table: {
|
|
2096
|
+
headerBackground?: string | undefined;
|
|
2097
|
+
headerColor?: string | undefined;
|
|
2098
|
+
zebraBackground?: string | undefined;
|
|
2099
|
+
borderColor?: string | undefined;
|
|
2100
|
+
fontSize?: number | undefined;
|
|
2101
|
+
headerFontWeight?: number | "normal" | "bold" | undefined;
|
|
2102
|
+
borderWidth?: number | undefined;
|
|
2103
|
+
borders?: "none" | "all" | "horizontal" | "outer" | undefined;
|
|
2104
|
+
cellPaddingX?: number | undefined;
|
|
2105
|
+
cellPaddingY?: number | undefined;
|
|
2106
|
+
};
|
|
2107
|
+
spacing: {
|
|
2108
|
+
blockGap: number;
|
|
2109
|
+
sectionPadding: number;
|
|
2110
|
+
columnGap: number;
|
|
2111
|
+
};
|
|
2112
|
+
card: {
|
|
2113
|
+
background?: string | undefined;
|
|
2114
|
+
borderColor?: string | undefined;
|
|
2115
|
+
padding?: number | undefined;
|
|
2116
|
+
borderWidth?: number | undefined;
|
|
2117
|
+
borderRadius?: number | undefined;
|
|
2118
|
+
shadow?: boolean | undefined;
|
|
2119
|
+
};
|
|
2120
|
+
};
|
|
2121
|
+
header: {
|
|
2122
|
+
default: Node[];
|
|
2123
|
+
firstPage?: Node[] | undefined;
|
|
2124
|
+
};
|
|
2125
|
+
footer: {
|
|
2126
|
+
default: Node[];
|
|
2127
|
+
firstPage?: Node[] | undefined;
|
|
2128
|
+
};
|
|
2129
|
+
meta?: {
|
|
2130
|
+
custom?: Record<string, unknown> | undefined;
|
|
2131
|
+
createdAt?: string | undefined;
|
|
2132
|
+
updatedAt?: string | undefined;
|
|
2133
|
+
author?: string | undefined;
|
|
2134
|
+
description?: string | undefined;
|
|
2135
|
+
tags?: string[] | undefined;
|
|
2136
|
+
} | undefined;
|
|
2137
|
+
library?: {
|
|
2138
|
+
name: string;
|
|
2139
|
+
id: string;
|
|
2140
|
+
node: Node;
|
|
2141
|
+
description?: string | undefined;
|
|
2142
|
+
category?: string | undefined;
|
|
2143
|
+
thumbnail?: string | undefined;
|
|
2144
|
+
}[] | undefined;
|
|
2145
|
+
settings?: {
|
|
2146
|
+
currency?: string | undefined;
|
|
2147
|
+
locale?: string | undefined;
|
|
2148
|
+
timeZone?: string | undefined;
|
|
2149
|
+
dataSources?: string[] | undefined;
|
|
2150
|
+
} | undefined;
|
|
2151
|
+
}, {
|
|
2152
|
+
body: Node[];
|
|
2153
|
+
page: {
|
|
2154
|
+
header: {
|
|
2155
|
+
height: number;
|
|
2156
|
+
differentFirstPage: boolean;
|
|
2157
|
+
};
|
|
2158
|
+
footer: {
|
|
2159
|
+
height: number;
|
|
2160
|
+
differentFirstPage: boolean;
|
|
2161
|
+
};
|
|
2162
|
+
size: "A4" | "A3" | "A5" | "Letter" | "Legal" | "Tabloid" | {
|
|
2163
|
+
width: number;
|
|
2164
|
+
height: number;
|
|
2165
|
+
};
|
|
2166
|
+
orientation: "portrait" | "landscape";
|
|
2167
|
+
margins: {
|
|
2168
|
+
left: number;
|
|
2169
|
+
right: number;
|
|
2170
|
+
top: number;
|
|
2171
|
+
bottom: number;
|
|
2172
|
+
};
|
|
2173
|
+
background?: string | undefined;
|
|
2174
|
+
minPages?: number | undefined;
|
|
2175
|
+
};
|
|
2176
|
+
schemaVersion: 1;
|
|
2177
|
+
name: string;
|
|
2178
|
+
id: string;
|
|
2179
|
+
styles: {
|
|
2180
|
+
text: Record<string, {
|
|
2181
|
+
lineHeight?: number | undefined;
|
|
2182
|
+
color?: string | undefined;
|
|
2183
|
+
fontFamily?: string | undefined;
|
|
2184
|
+
fontSize?: number | undefined;
|
|
2185
|
+
fontWeight?: number | "normal" | "bold" | undefined;
|
|
2186
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
2187
|
+
letterSpacing?: number | undefined;
|
|
2188
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
2189
|
+
keepWithNext?: boolean | undefined;
|
|
2190
|
+
marginTop?: number | undefined;
|
|
2191
|
+
marginBottom?: number | undefined;
|
|
2192
|
+
}>;
|
|
2193
|
+
link: {
|
|
2194
|
+
color?: string | undefined;
|
|
2195
|
+
underline?: boolean | undefined;
|
|
2196
|
+
};
|
|
2197
|
+
table: {
|
|
2198
|
+
headerBackground?: string | undefined;
|
|
2199
|
+
headerColor?: string | undefined;
|
|
2200
|
+
zebraBackground?: string | undefined;
|
|
2201
|
+
borderColor?: string | undefined;
|
|
2202
|
+
fontSize?: number | undefined;
|
|
2203
|
+
headerFontWeight?: number | "normal" | "bold" | undefined;
|
|
2204
|
+
borderWidth?: number | undefined;
|
|
2205
|
+
borders?: "none" | "all" | "horizontal" | "outer" | undefined;
|
|
2206
|
+
cellPaddingX?: number | undefined;
|
|
2207
|
+
cellPaddingY?: number | undefined;
|
|
2208
|
+
};
|
|
2209
|
+
spacing: {
|
|
2210
|
+
blockGap: number;
|
|
2211
|
+
sectionPadding: number;
|
|
2212
|
+
columnGap: number;
|
|
2213
|
+
};
|
|
2214
|
+
card: {
|
|
2215
|
+
background?: string | undefined;
|
|
2216
|
+
borderColor?: string | undefined;
|
|
2217
|
+
padding?: number | undefined;
|
|
2218
|
+
borderWidth?: number | undefined;
|
|
2219
|
+
borderRadius?: number | undefined;
|
|
2220
|
+
shadow?: boolean | undefined;
|
|
2221
|
+
};
|
|
2222
|
+
};
|
|
2223
|
+
header: {
|
|
2224
|
+
default: Node[];
|
|
2225
|
+
firstPage?: Node[] | undefined;
|
|
2226
|
+
};
|
|
2227
|
+
footer: {
|
|
2228
|
+
default: Node[];
|
|
2229
|
+
firstPage?: Node[] | undefined;
|
|
2230
|
+
};
|
|
2231
|
+
meta?: {
|
|
2232
|
+
custom?: Record<string, unknown> | undefined;
|
|
2233
|
+
createdAt?: string | undefined;
|
|
2234
|
+
updatedAt?: string | undefined;
|
|
2235
|
+
author?: string | undefined;
|
|
2236
|
+
description?: string | undefined;
|
|
2237
|
+
tags?: string[] | undefined;
|
|
2238
|
+
} | undefined;
|
|
2239
|
+
library?: {
|
|
2240
|
+
name: string;
|
|
2241
|
+
id: string;
|
|
2242
|
+
node: Node;
|
|
2243
|
+
description?: string | undefined;
|
|
2244
|
+
category?: string | undefined;
|
|
2245
|
+
thumbnail?: string | undefined;
|
|
2246
|
+
}[] | undefined;
|
|
2247
|
+
settings?: {
|
|
2248
|
+
currency?: string | undefined;
|
|
2249
|
+
locale?: string | undefined;
|
|
2250
|
+
timeZone?: string | undefined;
|
|
2251
|
+
dataSources?: string[] | undefined;
|
|
2252
|
+
} | undefined;
|
|
2253
|
+
}>;
|
|
2254
|
+
interface ParseResult {
|
|
2255
|
+
ok: boolean;
|
|
2256
|
+
template?: ReportTemplate;
|
|
2257
|
+
errors: Array<{
|
|
2258
|
+
path: string;
|
|
2259
|
+
message: string;
|
|
2260
|
+
}>;
|
|
2261
|
+
}
|
|
2262
|
+
/** Validates the JSON shape of a template (after migration). */
|
|
2263
|
+
declare function parseTemplate(json: unknown): ParseResult;
|
|
2264
|
+
|
|
2265
|
+
/** Generates a short, URL-safe unique id. */
|
|
2266
|
+
declare function createId(prefix?: string): string;
|
|
2267
|
+
/** Tests: makes ids predictable. Pass null to restore random ids. */
|
|
2268
|
+
declare function setDeterministicIds(seed: string | null): void;
|
|
2269
|
+
|
|
2270
|
+
interface Migration {
|
|
2271
|
+
from: number;
|
|
2272
|
+
to: number;
|
|
2273
|
+
description: string;
|
|
2274
|
+
migrate(template: AnyVersionTemplate): AnyVersionTemplate;
|
|
2275
|
+
}
|
|
2276
|
+
/**
|
|
2277
|
+
* Ordered list of migrations. Each is a pure function from version N to N+1.
|
|
2278
|
+
* Never edit a shipped migration; add a new one.
|
|
2279
|
+
*/
|
|
2280
|
+
declare const MIGRATIONS: Migration[];
|
|
2281
|
+
interface MigrationResult {
|
|
2282
|
+
template: ReportTemplate;
|
|
2283
|
+
/** Migrations that were applied, in order. */
|
|
2284
|
+
applied: Migration[];
|
|
2285
|
+
fromVersion: number;
|
|
2286
|
+
}
|
|
2287
|
+
declare class MigrationError extends Error {
|
|
2288
|
+
constructor(message: string);
|
|
2289
|
+
}
|
|
2290
|
+
/**
|
|
2291
|
+
* Brings a template of any supported version up to the current schema.
|
|
2292
|
+
* Throws `MigrationError` for future versions or missing migration steps.
|
|
2293
|
+
*/
|
|
2294
|
+
declare function migrateTemplate(input: AnyVersionTemplate | ReportTemplate): MigrationResult;
|
|
2295
|
+
declare function needsMigration(input: {
|
|
2296
|
+
schemaVersion?: number;
|
|
2297
|
+
}): boolean;
|
|
2298
|
+
|
|
2299
|
+
declare function defaultPageSettings(overrides?: Partial<PageSettings>): PageSettings;
|
|
2300
|
+
interface CreateTemplateOptions {
|
|
2301
|
+
id?: string;
|
|
2302
|
+
name?: string;
|
|
2303
|
+
page?: Partial<PageSettings>;
|
|
2304
|
+
locale?: string;
|
|
2305
|
+
currency?: string;
|
|
2306
|
+
/** Start with an empty first section. Default true. */
|
|
2307
|
+
withEmptySection?: boolean;
|
|
2308
|
+
}
|
|
2309
|
+
/** Creates a new, valid, empty template. */
|
|
2310
|
+
declare function createTemplate(opts?: CreateTemplateOptions): ReportTemplate;
|
|
2311
|
+
interface CreateNodeOptions {
|
|
2312
|
+
id?: string;
|
|
2313
|
+
props?: Record<string, unknown>;
|
|
2314
|
+
style?: BlockStyle;
|
|
2315
|
+
children?: Node[];
|
|
2316
|
+
flow?: FlowOptions;
|
|
2317
|
+
visibleWhen?: string | ConditionGroup;
|
|
2318
|
+
name?: string;
|
|
2319
|
+
}
|
|
2320
|
+
/** Creates a node of a registered block type with its default props. */
|
|
2321
|
+
declare function createNode(registry: BlockRegistry, type: string, opts?: CreateNodeOptions): Node;
|
|
2322
|
+
declare function createSection(opts?: CreateNodeOptions): Node;
|
|
2323
|
+
declare function createColumn(span: number, children?: Node[], id?: string): Node;
|
|
2324
|
+
/** Creates a row with the given twelfths layout, e.g. [6, 6] or [4, 8]. */
|
|
2325
|
+
declare function createRow(layout: number[], columns?: Node[][], opts?: CreateNodeOptions): Node;
|
|
2326
|
+
declare const ROW_LAYOUTS: Array<{
|
|
2327
|
+
id: string;
|
|
2328
|
+
label: string;
|
|
2329
|
+
layout: number[];
|
|
2330
|
+
}>;
|
|
2331
|
+
/** Deep-clones a subtree assigning fresh ids (for duplicate/paste/library insert). */
|
|
2332
|
+
declare function cloneWithNewIds(node: Node): Node;
|
|
2333
|
+
|
|
2334
|
+
/**
|
|
2335
|
+
* Synthesises plausible sample data from a schema. Used in design mode when the
|
|
2336
|
+
* host provides no sample data so tables, charts and KPIs still show something.
|
|
2337
|
+
*/
|
|
2338
|
+
declare function synthesizeSampleData(sources: DataSource[], opts?: {
|
|
2339
|
+
arrayLength?: number;
|
|
2340
|
+
now?: Date;
|
|
2341
|
+
}): ReportData;
|
|
2342
|
+
declare function synthesizeValue(schema: FieldSchema, opts?: {
|
|
2343
|
+
arrayLength?: number;
|
|
2344
|
+
now?: Date;
|
|
2345
|
+
}, depth?: number, index?: number): unknown;
|
|
2346
|
+
/** Human label for a data path, e.g. "Client › First name". */
|
|
2347
|
+
declare function labelForPath(segments: PathSegment[], scope: SchemaScope): string;
|
|
2348
|
+
declare function humanizeKey(key: string): string;
|
|
2349
|
+
|
|
2350
|
+
interface ResolveOptions {
|
|
2351
|
+
template: ReportTemplate;
|
|
2352
|
+
registry: BlockRegistry;
|
|
2353
|
+
theme?: Partial<Theme>;
|
|
2354
|
+
dataSources?: DataSource[];
|
|
2355
|
+
/** Runtime data (preview / PDF). */
|
|
2356
|
+
data?: ReportData;
|
|
2357
|
+
/** Sample data used in design mode when `data` is absent. */
|
|
2358
|
+
sampleData?: ReportData;
|
|
2359
|
+
mode?: RenderMode;
|
|
2360
|
+
/** Fixed clock for deterministic output. */
|
|
2361
|
+
now?: Date;
|
|
2362
|
+
locale?: string;
|
|
2363
|
+
currency?: string;
|
|
2364
|
+
timeZone?: string;
|
|
2365
|
+
/** Iterations shown per repeater in design mode. */
|
|
2366
|
+
designIterations?: number;
|
|
2367
|
+
/** Hard cap on repeater iterations (safety). */
|
|
2368
|
+
maxIterations?: number;
|
|
2369
|
+
/** Whether per-block style overrides are honoured. */
|
|
2370
|
+
allowStyleOverrides?: boolean;
|
|
2371
|
+
/** Design mode: still show nodes whose condition is false (marked as hidden). */
|
|
2372
|
+
designShowHidden?: boolean;
|
|
2373
|
+
}
|
|
2374
|
+
/**
|
|
2375
|
+
* Resolves a template into a `ResolvedDocument`: evaluates every binding,
|
|
2376
|
+
* expands repeaters, decides conditionals and cascades styles.
|
|
2377
|
+
*/
|
|
2378
|
+
declare function resolveTemplate(opts: ResolveOptions): ResolvedDocument;
|
|
2379
|
+
/** Convenience for tests and tooling: resolves and returns display text of an expression. */
|
|
2380
|
+
declare function evaluateToText(expr: string, data: ReportData, format?: Partial<FormatContext>): string;
|
|
2381
|
+
|
|
2382
|
+
/**
|
|
2383
|
+
* How an expression should be written where a person is going to read it:
|
|
2384
|
+
* `portfolio.allocation` as "Portfolio › Asset allocation", a piped value with
|
|
2385
|
+
* the filter named after it, a computed one marked with an ƒ.
|
|
2386
|
+
*
|
|
2387
|
+
* The canvas has always drawn its token chips this way. Sharing the same
|
|
2388
|
+
* function with the layer tree, the breadcrumb and the inspector is what stops
|
|
2389
|
+
* one part of the editor calling a thing "Asset allocation" while another calls
|
|
2390
|
+
* it "portfolio.allocation" — the raw path stays available as a tooltip, which
|
|
2391
|
+
* is the right place for it.
|
|
2392
|
+
*/
|
|
2393
|
+
declare function describeExpression(expr: string, scope: SchemaScope): {
|
|
2394
|
+
label: string;
|
|
2395
|
+
type: BindingInfo["type"];
|
|
2396
|
+
};
|
|
2397
|
+
/**
|
|
2398
|
+
* Rewrites the readable parts of a label written by a block: `{{ tokens }}` and
|
|
2399
|
+
* bare dotted paths become the names a person would use. Anything that does not
|
|
2400
|
+
* resolve is left exactly as it was, so an unknown path still shows itself
|
|
2401
|
+
* rather than turning into a guess.
|
|
2402
|
+
*/
|
|
2403
|
+
declare function humaniseLabel(text: string, scope: SchemaScope): string;
|
|
2404
|
+
|
|
2405
|
+
/**
|
|
2406
|
+
* Geometry produced by a measurer. All coordinates are in CSS px relative to the
|
|
2407
|
+
* top-left of the *section* the node belongs to (sections are laid out as
|
|
2408
|
+
* independent galleys at the page content width).
|
|
2409
|
+
*/
|
|
2410
|
+
interface TableRowGeometry {
|
|
2411
|
+
top: number;
|
|
2412
|
+
height: number;
|
|
2413
|
+
kind: "header" | "body" | "footer";
|
|
2414
|
+
}
|
|
2415
|
+
interface NodeGeometry {
|
|
2416
|
+
top: number;
|
|
2417
|
+
height: number;
|
|
2418
|
+
left: number;
|
|
2419
|
+
width: number;
|
|
2420
|
+
/** Text nodes: bottom of each line box (absolute y within the section). */
|
|
2421
|
+
lines?: number[];
|
|
2422
|
+
/** Table nodes: row boxes in document order. */
|
|
2423
|
+
rows?: TableRowGeometry[];
|
|
2424
|
+
}
|
|
2425
|
+
/** Geometry for every node in one section, keyed by resolved node key. */
|
|
2426
|
+
interface SectionGeometry {
|
|
2427
|
+
/** The section's own height. */
|
|
2428
|
+
height: number;
|
|
2429
|
+
width: number;
|
|
2430
|
+
nodes: Record<string, NodeGeometry>;
|
|
2431
|
+
}
|
|
2432
|
+
/** Geometry for every section in a resolved document, keyed by section key. */
|
|
2433
|
+
type GeometryMap = Record<string, SectionGeometry>;
|
|
2434
|
+
interface Measurer {
|
|
2435
|
+
/**
|
|
2436
|
+
* Measures the given sections at the given width. Implementations may cache by
|
|
2437
|
+
* section content; the paginator never mutates the result.
|
|
2438
|
+
*/
|
|
2439
|
+
measure(sections: ResolvedNode[], width: number): GeometryMap;
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
/** CSS pixels per millimetre at 96 dpi. */
|
|
2443
|
+
declare const PX_PER_MM: number;
|
|
2444
|
+
declare const PAGE_SIZES_MM: Record<PageSizeName, {
|
|
2445
|
+
width: number;
|
|
2446
|
+
height: number;
|
|
2447
|
+
}>;
|
|
2448
|
+
declare function mmToPx(mm: number): number;
|
|
2449
|
+
declare function pxToMm(px: number): number;
|
|
2450
|
+
declare function pageSizeMm(size: PageSize): {
|
|
2451
|
+
width: number;
|
|
2452
|
+
height: number;
|
|
2453
|
+
};
|
|
2454
|
+
/** Concrete page geometry in CSS px. */
|
|
2455
|
+
interface PageGeometry {
|
|
2456
|
+
width: number;
|
|
2457
|
+
height: number;
|
|
2458
|
+
margins: {
|
|
2459
|
+
top: number;
|
|
2460
|
+
right: number;
|
|
2461
|
+
bottom: number;
|
|
2462
|
+
left: number;
|
|
2463
|
+
};
|
|
2464
|
+
headerHeight: number;
|
|
2465
|
+
footerHeight: number;
|
|
2466
|
+
/** Width of the content column (page width minus horizontal margins). */
|
|
2467
|
+
contentWidth: number;
|
|
2468
|
+
/** Height available for body content on a regular page. */
|
|
2469
|
+
contentHeight: number;
|
|
2470
|
+
/** Y offset of the body content box from the page top. */
|
|
2471
|
+
contentTop: number;
|
|
2472
|
+
/** Y offset of the header region from the page top. */
|
|
2473
|
+
headerTop: number;
|
|
2474
|
+
/** Y offset of the footer region from the page top. */
|
|
2475
|
+
footerTop: number;
|
|
2476
|
+
}
|
|
2477
|
+
declare function computePageGeometry(page: PageSettings): PageGeometry;
|
|
2478
|
+
|
|
2479
|
+
interface RepeatedHeader {
|
|
2480
|
+
tableKey: string;
|
|
2481
|
+
height: number;
|
|
2482
|
+
left: number;
|
|
2483
|
+
width: number;
|
|
2484
|
+
}
|
|
2485
|
+
/**
|
|
2486
|
+
* A clip window over a section's full render, placed on a page.
|
|
2487
|
+
* `[from, to)` are y coordinates in the section's own coordinate space.
|
|
2488
|
+
*/
|
|
2489
|
+
interface PageFragment {
|
|
2490
|
+
sectionKey: string;
|
|
2491
|
+
from: number;
|
|
2492
|
+
to: number;
|
|
2493
|
+
/** Table headers to repeat above the clipped content (tables cut at `from`). */
|
|
2494
|
+
repeatHeaders: RepeatedHeader[];
|
|
2495
|
+
/** Y position of the fragment within the page content box. */
|
|
2496
|
+
y: number;
|
|
2497
|
+
/** Rendered height: (to - from) + repeated header heights. */
|
|
2498
|
+
height: number;
|
|
2499
|
+
/** True when this fragment continues a section started on an earlier page. */
|
|
2500
|
+
continued: boolean;
|
|
2501
|
+
/** True when the section continues on a later page. */
|
|
2502
|
+
continues: boolean;
|
|
2503
|
+
}
|
|
2504
|
+
interface Page {
|
|
2505
|
+
index: number;
|
|
2506
|
+
number: number;
|
|
2507
|
+
fragments: PageFragment[];
|
|
2508
|
+
/** Whether page 1 variants of header/footer apply. */
|
|
2509
|
+
first: boolean;
|
|
2510
|
+
}
|
|
2511
|
+
interface LayoutWarning {
|
|
2512
|
+
code: "forced-split" | "region-overflow" | "oversized-header" | "empty-document" | "no-op-break";
|
|
2513
|
+
message: string;
|
|
2514
|
+
nodeId?: string;
|
|
2515
|
+
sectionKey?: string;
|
|
2516
|
+
page?: number;
|
|
2517
|
+
}
|
|
2518
|
+
interface PagedDocument {
|
|
2519
|
+
pages: Page[];
|
|
2520
|
+
totalPages: number;
|
|
2521
|
+
geometry: PageGeometry;
|
|
2522
|
+
warnings: LayoutWarning[];
|
|
2523
|
+
}
|
|
2524
|
+
interface PaginateOptions {
|
|
2525
|
+
document: ResolvedDocument;
|
|
2526
|
+
geometry: GeometryMap;
|
|
2527
|
+
page: PageGeometry;
|
|
2528
|
+
/** Show at least this many pages (design canvas). */
|
|
2529
|
+
minPages?: number;
|
|
2530
|
+
/** Geometry for header/footer sections (for overflow warnings). */
|
|
2531
|
+
regionGeometry?: GeometryMap;
|
|
2532
|
+
}
|
|
2533
|
+
interface BreakCtx {
|
|
2534
|
+
geom: SectionGeometry;
|
|
2535
|
+
pageHeight: number;
|
|
2536
|
+
}
|
|
2537
|
+
/**
|
|
2538
|
+
* Largest valid break position y with minY < y <= limit inside a list of
|
|
2539
|
+
* siblings, or null if none exists.
|
|
2540
|
+
*/
|
|
2541
|
+
declare function bestBreak(ctx: BreakCtx, list: ResolvedNode[], limit: number, minY: number): number | null;
|
|
2542
|
+
/**
|
|
2543
|
+
* Pure, deterministic pagination. Given resolved sections and their measured
|
|
2544
|
+
* geometry, assigns clip-window fragments to pages.
|
|
2545
|
+
*/
|
|
2546
|
+
declare function paginate(opts: PaginateOptions): PagedDocument;
|
|
2547
|
+
|
|
2548
|
+
interface ValidateOptions {
|
|
2549
|
+
template: ReportTemplate;
|
|
2550
|
+
registry: BlockRegistry;
|
|
2551
|
+
dataSources?: DataSource[];
|
|
2552
|
+
theme?: Partial<Theme>;
|
|
2553
|
+
/** Font families the host guarantees are available (theme fonts are added automatically). */
|
|
2554
|
+
availableFonts?: string[];
|
|
2555
|
+
/** Skip the JSON shape check (already parsed). */
|
|
2556
|
+
skipSchema?: boolean;
|
|
2557
|
+
}
|
|
2558
|
+
interface ValidationResult {
|
|
2559
|
+
ok: boolean;
|
|
2560
|
+
issues: Issue[];
|
|
2561
|
+
errors: Issue[];
|
|
2562
|
+
warnings: Issue[];
|
|
2563
|
+
}
|
|
2564
|
+
/**
|
|
2565
|
+
* Statically analyses a template against a registry, data schemas and a theme.
|
|
2566
|
+
* Runs without data and without a DOM, so it can be used server-side before
|
|
2567
|
+
* accepting a template for storage.
|
|
2568
|
+
*/
|
|
2569
|
+
declare function validateTemplate(opts: ValidateOptions): ValidationResult;
|
|
2570
|
+
declare function itemSchemaOf(collectionExpr: string, scope: SchemaScope): FieldSchema | undefined;
|
|
2571
|
+
/** URL safety check shared by validation and renderers. */
|
|
2572
|
+
declare function isSafeUrl(url: string | undefined, opts?: {
|
|
2573
|
+
allowData?: boolean;
|
|
2574
|
+
}): boolean;
|
|
2575
|
+
|
|
2576
|
+
interface OutputCheckOptions {
|
|
2577
|
+
/** A document resolved in preview mode against the data you intend to ship. */
|
|
2578
|
+
resolved: ResolvedDocument;
|
|
2579
|
+
registry: BlockRegistry;
|
|
2580
|
+
/** Names the data set in the messages, e.g. "Edge case". */
|
|
2581
|
+
dataLabel?: string;
|
|
2582
|
+
/** Cap on issues returned, so a broken data set cannot flood the UI. */
|
|
2583
|
+
limit?: number;
|
|
2584
|
+
}
|
|
2585
|
+
/**
|
|
2586
|
+
* Reports what this particular data set does to the report: fields that come out
|
|
2587
|
+
* blank, blocks that render nothing, sections with no content at all.
|
|
2588
|
+
*
|
|
2589
|
+
* This is deliberately separate from `validateTemplate`, which asks whether the
|
|
2590
|
+
* design is sound and never looks at data. A template can be perfectly valid and
|
|
2591
|
+
* still produce "Values as at ." for a client whose review has no end date, and
|
|
2592
|
+
* only one of those two checks can ever tell you so.
|
|
2593
|
+
*
|
|
2594
|
+
* Three things it does not complain about, because complaining would train
|
|
2595
|
+
* people to ignore it:
|
|
2596
|
+
*
|
|
2597
|
+
* - Content hidden by a false condition. A preview resolution has already
|
|
2598
|
+
* dropped those nodes, so they cannot be reached from here at all.
|
|
2599
|
+
* - An expression that already handles the empty case — a `default:` fallback
|
|
2600
|
+
* or a conditional. Warning about those would be warning about the fix.
|
|
2601
|
+
* - Zero, false and empty-but-intended lists. `0` is a value; a table with an
|
|
2602
|
+
* empty message is a designed outcome, not an accident.
|
|
2603
|
+
* - Page-dependent tokens, which have no value until the paginator runs.
|
|
2604
|
+
*/
|
|
2605
|
+
declare function checkOutput(opts: OutputCheckOptions): Issue[];
|
|
2606
|
+
|
|
2607
|
+
type RegionId = "body" | "header" | "header:first" | "footer" | "footer:first";
|
|
2608
|
+
declare const REGION_IDS: RegionId[];
|
|
2609
|
+
declare function getRegion(template: ReportTemplate, region: RegionId): Node[];
|
|
2610
|
+
declare function readRegion(template: ReportTemplate, region: RegionId): Node[];
|
|
2611
|
+
interface NodeLocation {
|
|
2612
|
+
region: RegionId;
|
|
2613
|
+
/** Index path from the region root to the node. */
|
|
2614
|
+
path: number[];
|
|
2615
|
+
}
|
|
2616
|
+
interface NodeEntry {
|
|
2617
|
+
node: Node;
|
|
2618
|
+
parent: Node | null;
|
|
2619
|
+
region: RegionId;
|
|
2620
|
+
path: number[];
|
|
2621
|
+
depth: number;
|
|
2622
|
+
index: number;
|
|
2623
|
+
}
|
|
2624
|
+
type NodeIndex = Map<string, NodeEntry>;
|
|
2625
|
+
/** Builds an id → entry index over the whole template. */
|
|
2626
|
+
declare function indexTemplate(template: ReportTemplate): NodeIndex;
|
|
2627
|
+
declare function findNode(template: ReportTemplate, id: string): NodeEntry | undefined;
|
|
2628
|
+
/** Returns the list that contains the node at `location` and the node's index in it. */
|
|
2629
|
+
declare function listAt(template: ReportTemplate, location: NodeLocation): {
|
|
2630
|
+
list: Node[];
|
|
2631
|
+
index: number;
|
|
2632
|
+
};
|
|
2633
|
+
declare function nodeAt(template: ReportTemplate, location: NodeLocation): Node | undefined;
|
|
2634
|
+
/** Ancestor chain from the region root down to (and including) the node. */
|
|
2635
|
+
declare function ancestors(index: NodeIndex, id: string): NodeEntry[];
|
|
2636
|
+
declare function isDescendant(index: NodeIndex, ancestorId: string, id: string): boolean;
|
|
2637
|
+
/** Depth-first walk over every node in the template. */
|
|
2638
|
+
declare function walkTemplate(template: ReportTemplate, visit: (node: Node, region: RegionId, parent: Node | null) => void): void;
|
|
2639
|
+
declare function countNodes(template: ReportTemplate): number;
|
|
2640
|
+
/** Collects all block types used in the template. */
|
|
2641
|
+
declare function usedBlockTypes(template: ReportTemplate): Set<string>;
|
|
2642
|
+
|
|
2643
|
+
/**
|
|
2644
|
+
* Commands are plain data. Each is applied by a reducer that mutates an immer
|
|
2645
|
+
* draft; immer turns the mutation into immutable structural sharing + patches.
|
|
2646
|
+
*/
|
|
2647
|
+
type Command = {
|
|
2648
|
+
type: "insertNode";
|
|
2649
|
+
node: Node;
|
|
2650
|
+
at: NodeLocation;
|
|
2651
|
+
} | {
|
|
2652
|
+
type: "insertNodes";
|
|
2653
|
+
nodes: Node[];
|
|
2654
|
+
at: NodeLocation;
|
|
2655
|
+
} | {
|
|
2656
|
+
type: "removeNodes";
|
|
2657
|
+
ids: string[];
|
|
2658
|
+
} | {
|
|
2659
|
+
type: "moveNode";
|
|
2660
|
+
id: string;
|
|
2661
|
+
to: NodeLocation;
|
|
2662
|
+
} | {
|
|
2663
|
+
type: "duplicateNode";
|
|
2664
|
+
id: string;
|
|
2665
|
+
newId?: string;
|
|
2666
|
+
} | {
|
|
2667
|
+
type: "setProps";
|
|
2668
|
+
id: string;
|
|
2669
|
+
patch: Record<string, unknown>;
|
|
2670
|
+
} | {
|
|
2671
|
+
type: "setProp";
|
|
2672
|
+
id: string;
|
|
2673
|
+
path: string;
|
|
2674
|
+
value: unknown;
|
|
2675
|
+
} | {
|
|
2676
|
+
type: "setStyle";
|
|
2677
|
+
id: string;
|
|
2678
|
+
patch: BlockStyle | null;
|
|
2679
|
+
} | {
|
|
2680
|
+
type: "setFlow";
|
|
2681
|
+
id: string;
|
|
2682
|
+
patch: FlowOptions;
|
|
2683
|
+
} | {
|
|
2684
|
+
type: "setVisibleWhen";
|
|
2685
|
+
id: string;
|
|
2686
|
+
condition: Condition | undefined;
|
|
2687
|
+
} | {
|
|
2688
|
+
type: "setName";
|
|
2689
|
+
id: string;
|
|
2690
|
+
name: string | undefined;
|
|
2691
|
+
} | {
|
|
2692
|
+
type: "setLocked";
|
|
2693
|
+
id: string;
|
|
2694
|
+
locked: boolean;
|
|
2695
|
+
} | {
|
|
2696
|
+
type: "setRowLayout";
|
|
2697
|
+
id: string;
|
|
2698
|
+
layout: number[];
|
|
2699
|
+
} | {
|
|
2700
|
+
type: "wrapNodes";
|
|
2701
|
+
ids: string[];
|
|
2702
|
+
wrapper: Node;
|
|
2703
|
+
} | {
|
|
2704
|
+
type: "replaceNode";
|
|
2705
|
+
id: string;
|
|
2706
|
+
node: Node;
|
|
2707
|
+
} | {
|
|
2708
|
+
type: "setPage";
|
|
2709
|
+
patch: Partial<PageSettings>;
|
|
2710
|
+
} | {
|
|
2711
|
+
type: "setDocumentStyles";
|
|
2712
|
+
patch: Partial<DocumentStyles>;
|
|
2713
|
+
} | {
|
|
2714
|
+
type: "setTextStyle";
|
|
2715
|
+
id: string;
|
|
2716
|
+
patch: TextStyle | null;
|
|
2717
|
+
} | {
|
|
2718
|
+
type: "setTemplateName";
|
|
2719
|
+
name: string;
|
|
2720
|
+
} | {
|
|
2721
|
+
type: "setSettings";
|
|
2722
|
+
patch: NonNullable<ReportTemplate["settings"]>;
|
|
2723
|
+
} | {
|
|
2724
|
+
type: "setRegionFirstPage";
|
|
2725
|
+
region: "header" | "footer";
|
|
2726
|
+
enabled: boolean;
|
|
2727
|
+
} | {
|
|
2728
|
+
type: "addLibraryItem";
|
|
2729
|
+
item: LibraryItem;
|
|
2730
|
+
} | {
|
|
2731
|
+
type: "removeLibraryItem";
|
|
2732
|
+
id: string;
|
|
2733
|
+
} | {
|
|
2734
|
+
type: "replaceTemplate";
|
|
2735
|
+
template: ReportTemplate;
|
|
2736
|
+
};
|
|
2737
|
+
declare class CommandError extends Error {
|
|
2738
|
+
constructor(message: string);
|
|
2739
|
+
}
|
|
2740
|
+
/** Applies a command to a template draft. Throws `CommandError` for invalid operations. */
|
|
2741
|
+
declare function applyCommand(draft: Draft<ReportTemplate>, cmd: Command): void;
|
|
2742
|
+
|
|
2743
|
+
interface HistoryEntry {
|
|
2744
|
+
label: string;
|
|
2745
|
+
patches: Patch[];
|
|
2746
|
+
inversePatches: Patch[];
|
|
2747
|
+
selectionBefore: string[];
|
|
2748
|
+
selectionAfter: string[];
|
|
2749
|
+
at: number;
|
|
2750
|
+
/** Consecutive entries with the same merge key within `mergeWindowMs` are coalesced. */
|
|
2751
|
+
mergeKey?: string;
|
|
2752
|
+
}
|
|
2753
|
+
interface EditorState {
|
|
2754
|
+
template: ReportTemplate;
|
|
2755
|
+
selection: string[];
|
|
2756
|
+
hoverId: string | null;
|
|
2757
|
+
/** The node being edited inline (rich text), if any. */
|
|
2758
|
+
editingId: string | null;
|
|
2759
|
+
mode: "design" | "preview";
|
|
2760
|
+
zoom: number;
|
|
2761
|
+
activeRegion: RegionId;
|
|
2762
|
+
dirty: boolean;
|
|
2763
|
+
/** Monotonic counter incremented on every document change. */
|
|
2764
|
+
version: number;
|
|
2765
|
+
}
|
|
2766
|
+
interface DispatchOptions {
|
|
2767
|
+
label?: string;
|
|
2768
|
+
/** Coalesce with the previous history entry sharing this key (typing, slider drags). */
|
|
2769
|
+
mergeKey?: string;
|
|
2770
|
+
/** Do not record in history (e.g. transient drag previews). */
|
|
2771
|
+
skipHistory?: boolean;
|
|
2772
|
+
}
|
|
2773
|
+
interface EditorStoreOptions {
|
|
2774
|
+
template: ReportTemplate;
|
|
2775
|
+
maxHistory?: number;
|
|
2776
|
+
mergeWindowMs?: number;
|
|
2777
|
+
/** Called after every change, with the new template. */
|
|
2778
|
+
onChange?: (template: ReportTemplate, entry: HistoryEntry | null) => void;
|
|
2779
|
+
}
|
|
2780
|
+
type Listener = (state: EditorState, prev: EditorState) => void;
|
|
2781
|
+
/**
|
|
2782
|
+
* Framework-agnostic editor store. The document is immutable; every change goes
|
|
2783
|
+
* through `dispatch(command)` and is recorded as immer patches for undo/redo.
|
|
2784
|
+
*/
|
|
2785
|
+
declare class EditorStore {
|
|
2786
|
+
private state;
|
|
2787
|
+
private undoStack;
|
|
2788
|
+
private redoStack;
|
|
2789
|
+
private listeners;
|
|
2790
|
+
private txDepth;
|
|
2791
|
+
private txPatches;
|
|
2792
|
+
private txInverse;
|
|
2793
|
+
private txLabel;
|
|
2794
|
+
private txSelectionBefore;
|
|
2795
|
+
private txSkipHistory;
|
|
2796
|
+
private indexCache;
|
|
2797
|
+
/**
|
|
2798
|
+
* The history entry that was on top of the undo stack when the document was
|
|
2799
|
+
* last saved, so that undoing back to it reports clean again. Identity is the
|
|
2800
|
+
* whole test: undo pops, redo pushes, and a new edit pushes something else.
|
|
2801
|
+
*/
|
|
2802
|
+
private savedEntry;
|
|
2803
|
+
/** A change that bypassed history, which no amount of undoing can take back. */
|
|
2804
|
+
private unhistoried;
|
|
2805
|
+
private readonly maxHistory;
|
|
2806
|
+
private readonly mergeWindowMs;
|
|
2807
|
+
private readonly onChange?;
|
|
2808
|
+
constructor(opts: EditorStoreOptions);
|
|
2809
|
+
getState(): EditorState;
|
|
2810
|
+
get template(): ReportTemplate;
|
|
2811
|
+
/** Cached id → node index for the current document version. */
|
|
2812
|
+
index(): NodeIndex;
|
|
2813
|
+
getNode(id: string): Node | undefined;
|
|
2814
|
+
locationOf(id: string): NodeLocation | undefined;
|
|
2815
|
+
subscribe(listener: Listener): () => void;
|
|
2816
|
+
private setState;
|
|
2817
|
+
select(ids: string[] | string | null): void;
|
|
2818
|
+
toggleSelect(id: string): void;
|
|
2819
|
+
hover(id: string | null): void;
|
|
2820
|
+
setEditing(id: string | null): void;
|
|
2821
|
+
setMode(mode: EditorState["mode"]): void;
|
|
2822
|
+
setZoom(zoom: number): void;
|
|
2823
|
+
setActiveRegion(region: RegionId): void;
|
|
2824
|
+
markClean(): void;
|
|
2825
|
+
/** Whether the document differs from the last saved state. */
|
|
2826
|
+
private isDirty;
|
|
2827
|
+
/** Applies one command. Inside a transaction, patches accumulate into one history entry. */
|
|
2828
|
+
dispatch(command: Command, opts?: DispatchOptions): void;
|
|
2829
|
+
/**
|
|
2830
|
+
* Groups every dispatch inside `fn` into a single undo step. Nested
|
|
2831
|
+
* transactions join the outermost one. If `fn` throws, all changes roll back.
|
|
2832
|
+
*/
|
|
2833
|
+
transaction<T>(label: string, fn: () => T): T;
|
|
2834
|
+
private commitTemplate;
|
|
2835
|
+
private pushHistory;
|
|
2836
|
+
canUndo(): boolean;
|
|
2837
|
+
canRedo(): boolean;
|
|
2838
|
+
undoLabel(): string | undefined;
|
|
2839
|
+
redoLabel(): string | undefined;
|
|
2840
|
+
undo(): boolean;
|
|
2841
|
+
redo(): boolean;
|
|
2842
|
+
/** Replaces the document and clears history (loading a template). */
|
|
2843
|
+
load(template: ReportTemplate): void;
|
|
2844
|
+
history(): {
|
|
2845
|
+
undo: readonly HistoryEntry[];
|
|
2846
|
+
redo: readonly HistoryEntry[];
|
|
2847
|
+
};
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
interface RenderTreeOptions {
|
|
2851
|
+
registry: BlockRegistry;
|
|
2852
|
+
theme: Theme;
|
|
2853
|
+
styles: DocumentStyles;
|
|
2854
|
+
mode: RenderMode;
|
|
2855
|
+
page: PageContext;
|
|
2856
|
+
format: FormatContext;
|
|
2857
|
+
/** Content width in px at the root. */
|
|
2858
|
+
width: number;
|
|
2859
|
+
/** Hook for editors to add attributes to node wrappers. */
|
|
2860
|
+
decorate?: (node: ResolvedNode, props: VProps) => VProps;
|
|
2861
|
+
}
|
|
2862
|
+
/** Design-mode chip for a data token. */
|
|
2863
|
+
declare function tokenChip(expr: string, label: string | undefined, value?: string): VNode;
|
|
2864
|
+
declare function renderSegments(segments: ResolvedSegment[] | undefined, fallback: string | undefined, opts: RenderTreeOptions): VChild[];
|
|
2865
|
+
declare function renderInline(content: InlineNode[], opts: RenderTreeOptions): VChild[];
|
|
2866
|
+
declare function renderRichText(doc: RichTextDoc | undefined, opts: RenderTreeOptions): VChild[];
|
|
2867
|
+
declare function nodeAttrs(node: ResolvedNode, extra?: VProps): VProps;
|
|
2868
|
+
/** Width available to a column inside a row. */
|
|
2869
|
+
declare function columnWidth(rowWidth: number, span: number, gap: number, columns: number): number;
|
|
2870
|
+
/**
|
|
2871
|
+
* Renders a resolved node (and its subtree) to a VNode. This is the single
|
|
2872
|
+
* rendering path used by the editor canvas, the preview and the PDF service.
|
|
2873
|
+
*/
|
|
2874
|
+
declare function renderNode(node: ResolvedNode, opts: RenderTreeOptions, width?: number): VNode | null;
|
|
2875
|
+
/** Renders a list of resolved sections into a fragment-less flat list. */
|
|
2876
|
+
declare function renderSections(sections: ResolvedNode[], opts: RenderTreeOptions): VNode[];
|
|
2877
|
+
|
|
2878
|
+
export { type AnyVersionTemplate, type BinaryOp, type BindingInfo, type BindingKind, type BindingSpec, type BlockCategory, type BlockDefinition, type BlockNode, BlockRegistry, type BlockRegistryLike, type BlockStyle, type BorderSpec, type BorderStyle, type BreakMode, type BreakRun, CONDITION_OPERATORS, CURRENT_SCHEMA_VERSION, type CardStyle, type ColorValue, type Command, CommandError, type Condition, type ConditionGroup, type ConditionRule, type ContainerSpec, type CreateNodeOptions, type CreateTemplateOptions, type CustomPageSize, DEFAULT_PAGE_CONTEXT, DEFAULT_THEME, type DataSource, type DispatchOptions, type DocumentStyles, type EditorState, EditorStore, type EditorStoreOptions, type EvalContext, type Expr, ExpressionError, FUNCTION_NAMES, type FieldSchema, type FieldType, type FlowOptions, type FontValue, type FormatContext, GLOBAL_SCHEMAS, type GeometryMap, type HistoryEntry, type InlineNode, type InspectorApi, type InspectorComponent, type InspectorField, type InspectorFieldBase, type InspectorSection, type Issue, type IssueCode, type IssueSeverity, type IssueSource, type LayoutWarning, type LibraryItem, type LicenseTier, type List, type ListItem, MIGRATIONS, type Measurer, type Migration, MigrationError, type MigrationResult, type Node, type NodeEntry, type NodeGeometry, type NodeIndex, type NodeLocation, type OutputCheckOptions, PAGE_SIZES_MM, PIPES, PX_PER_MM, type Page, type PageContext, type PageFragment, type PageGeometry, type PageMargins, type PageOrientation, type PageRegionSettings, type PageSettings, type PageSize, type PageSizeName, type PagedDocument, type PaginateOptions, type Paragraph, type ParseResult, type PathSegment, type PipeDefinition, type PipeFn, REGION_IDS, ROW_LAYOUTS, type RegionContent, type RegionId, type RegistryOptions, type RenderContext, type RenderMode, type RenderTreeOptions, type RepeatedHeader, type ReportData, type ReportTemplate, type ResolveHookContext, type ResolveOptions, type ResolvedDocument, type ResolvedFlow, type ResolvedNode, type ResolvedRegion, type ResolvedRole, type ResolvedSegment, type ResolvedStyle, type RichTextDoc, SchemaScope, type SchemaVersion, Scope, type SectionGeometry, type SelectOption, type Spacing, type SplitMode, type StyleCascadeInput, type StyleGroup, type TableRowGeometry, type TableStyle, type TemplateMeta, type TemplateSegment, type TemplateSettings, type TextAlign, type TextMarks, type TextRun, type TextStyle, type TextStyleId, type Theme, type ThemeColors, type ThemeFontFace, type ThemeTableDefaults, type ThemeTokenInfo, type ThemeTypography, type TokenRef, type TokenRun, type TypeIssue, type TypeResult, type VChild, type VNode, type VProps, type ValidateContext, type ValidateOptions, type ValidationResult, type ValueType, type VerticalAlign, ancestors, applyCommand, bestBreak, bindingSpecsFor, blockStyleSchema, checkExpressionSyntax, checkOutput, classNames, cloneWithNewIds, collectPaths, columnWidth, compareValues, compileCondition, computePageGeometry, countNodes, createColumn, createId, createNode, createParagraph, createRichText, createRow, createSchemaScope, createSection, createTemplate, cssText, dataSourceSchemas, defaultDocumentStyles, defaultPageSettings, defineBlock, describeExpression, documentStylesSchema, escapeHtml, evaluate, evaluateAst, evaluateCondition, evaluateText, evaluateToText, exprToString, extractTemplateTokens, findNode, formatCurrency, formatDate, formatDatePattern, formatNumber, formatPercent, getField, getRegion, h, humaniseLabel, humanize, humanizeKey, indexTemplate, inlineFromTemplate, inlineToPlain, interpolate, isDarkColor, isDescendant, isEmptyValue, isRichTextDoc, isSafeUrl, isTokenRef, isVNode, issue, itemSchemaOf, labelForPath, listAt, listThemeTokens, looseEquals, mergeTheme, migrateTemplate, missingThemeValues, mmToPx, needsMigration, nodeAt, nodeAttrs, nodeSchema, pageSettingsSchema, pageSizeMm, paginate, parseExpression, parseTemplate, pathToString, pxToMm, readProperty, readRegion, renderInline, renderNode, renderRichText, renderSections, renderSegments, resolveDefaultProps, resolvePath, resolvePathSchema, resolveStyle, resolveTemplate, resolveToken, resolveValue, richTextFromTemplate, richTextToPlain, richTextTokens, setDeterministicIds, splitTemplate, styleString, styleToCss, synthesizeSampleData, synthesizeValue, templateSchema, textStyleLabel, toDate, toDisplayString, toHtml, toNumber, tokenChip, tokenize, truthy, typeCheck, typeCheckAst, usedBlockTypes, validateTemplate, walkTemplate, walkVNodes };
|