@cosmicdrift/kumiko-bundled-features 0.418.0 → 0.419.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/template-resolver/compile-document-body.js +3 -6
  2. package/dist/template-resolver/compile-document-styles.d.ts +3 -0
  3. package/dist/template-resolver/compile-document-styles.js +84 -0
  4. package/dist/template-resolver/document-frames.d.ts +3 -0
  5. package/dist/template-resolver/document-frames.js +19 -0
  6. package/dist/template-resolver/document-op-blocks.d.ts +495 -0
  7. package/dist/template-resolver/document-op-blocks.js +430 -0
  8. package/dist/template-resolver/document-ops.d.ts +1809 -37
  9. package/dist/template-resolver/document-ops.js +97 -104
  10. package/dist/template-resolver/document-print-only.d.ts +10 -0
  11. package/dist/template-resolver/document-print-only.js +24 -0
  12. package/dist/template-resolver/document-sanitizer.d.ts +1 -1
  13. package/dist/template-resolver/document-sanitizer.js +24 -13
  14. package/dist/template-resolver/feature.d.ts +3 -0
  15. package/dist/template-resolver/feature.js +14 -1
  16. package/dist/template-resolver/handlers/apply-layout.write.d.ts +29 -0
  17. package/dist/template-resolver/handlers/apply-layout.write.js +118 -0
  18. package/dist/template-resolver/handlers/create-layout.write.d.ts +15 -0
  19. package/dist/template-resolver/handlers/create-layout.write.js +78 -0
  20. package/dist/template-resolver/handlers/document-base.d.ts +2 -2
  21. package/dist/template-resolver/handlers/document-blocks.query.d.ts +10 -3
  22. package/dist/template-resolver/handlers/document-blocks.query.js +13 -8
  23. package/dist/template-resolver/handlers/document-region.d.ts +19 -0
  24. package/dist/template-resolver/handlers/document-region.js +27 -0
  25. package/dist/template-resolver/handlers/failure-reason.d.ts +2 -0
  26. package/dist/template-resolver/handlers/failure-reason.js +12 -0
  27. package/dist/template-resolver/handlers/import-bundle-system.write.js +4 -0
  28. package/dist/template-resolver/handlers/layout-source.query.d.ts +3 -3
  29. package/dist/template-resolver/handlers/layout-source.query.js +6 -2
  30. package/dist/template-resolver/handlers/overview.query.d.ts +8 -0
  31. package/dist/template-resolver/handlers/overview.query.js +12 -6
  32. package/dist/template-resolver/handlers/patch-draft.write.d.ts +905 -4
  33. package/dist/template-resolver/handlers/patch-draft.write.js +10 -6
  34. package/dist/template-resolver/handlers/publish-templates.write.d.ts +40 -0
  35. package/dist/template-resolver/handlers/publish-templates.write.js +61 -0
  36. package/dist/template-resolver/handlers/set.write.js +4 -1
  37. package/dist/template-resolver/handlers/template-write.js +7 -2
  38. package/dist/template-resolver/handlers/tenant-settings.d.ts +17 -0
  39. package/dist/template-resolver/handlers/tenant-settings.js +91 -0
  40. package/dist/template-resolver/handlers/toggle-status.write.d.ts +14 -9
  41. package/dist/template-resolver/handlers/toggle-status.write.js +11 -7
  42. package/dist/template-resolver/handlers/upsert-system.write.js +15 -9
  43. package/dist/template-resolver/handlers/usage.query.d.ts +14 -0
  44. package/dist/template-resolver/handlers/usage.query.js +80 -12
  45. package/dist/template-resolver/handlers/validate.query.d.ts +2 -0
  46. package/dist/template-resolver/handlers/validate.query.js +10 -0
  47. package/dist/template-resolver/i18n.js +3 -0
  48. package/dist/template-resolver/index.d.ts +7 -2
  49. package/dist/template-resolver/index.js +6 -2
  50. package/dist/template-resolver/layout-regions.d.ts +4 -5
  51. package/dist/template-resolver/layout-regions.js +38 -11
  52. package/dist/template-resolver/print-document.js +3 -1
  53. package/dist/template-resolver/seeding.js +4 -0
  54. package/dist/template-resolver/template-delivery-policy.d.ts +1 -0
  55. package/dist/template-resolver/template-delivery-policy.js +9 -1
  56. package/dist/template-resolver/template-edit-policy.d.ts +5 -1
  57. package/dist/template-resolver/template-edit-policy.js +29 -1
  58. package/dist/template-resolver/template-meta.d.ts +27 -2
  59. package/dist/template-resolver/template-meta.js +21 -5
  60. package/dist/template-resolver/template-preview.js +8 -8
  61. package/dist/template-resolver/template-validation.js +10 -3
  62. package/dist/template-resolver/web/constants.d.ts +7 -1
  63. package/dist/template-resolver/web/constants.js +21 -1
  64. package/dist/template-resolver/web/document-blocks.d.ts +1 -0
  65. package/dist/template-resolver/web/document-blocks.js +2 -0
  66. package/dist/template-resolver/web/document-editor-extensions.d.ts +9 -1
  67. package/dist/template-resolver/web/document-editor-extensions.js +27 -2
  68. package/dist/template-resolver/web/document-editor-fonts.d.ts +10 -0
  69. package/dist/template-resolver/web/document-editor-fonts.js +13 -0
  70. package/dist/template-resolver/web/document-fonts.d.ts +4 -0
  71. package/dist/template-resolver/web/document-fonts.js +18 -0
  72. package/dist/template-resolver/web/document-frame-control.d.ts +61 -0
  73. package/dist/template-resolver/web/document-frame-control.js +329 -0
  74. package/dist/template-resolver/web/document-frame-node-view.d.ts +4 -0
  75. package/dist/template-resolver/web/document-frame-node-view.js +173 -0
  76. package/dist/template-resolver/web/document-print-decorations.d.ts +12 -0
  77. package/dist/template-resolver/web/document-print-decorations.js +147 -0
  78. package/dist/template-resolver/web/document-print-defaults.d.ts +14 -0
  79. package/dist/template-resolver/web/document-print-defaults.js +25 -0
  80. package/dist/template-resolver/web/document-print-style.d.ts +71 -0
  81. package/dist/template-resolver/web/document-print-style.js +199 -0
  82. package/dist/template-resolver/web/document-repeat-strip.d.ts +8 -0
  83. package/dist/template-resolver/web/document-repeat-strip.js +78 -0
  84. package/dist/template-resolver/web/document-schema.js +23 -9
  85. package/dist/template-resolver/web/document-style-css.d.ts +29 -0
  86. package/dist/template-resolver/web/document-style-css.js +76 -0
  87. package/dist/template-resolver/web/document-tiptap-bubble.js +13 -3
  88. package/dist/template-resolver/web/document-tiptap-content.d.ts +2 -1
  89. package/dist/template-resolver/web/document-tiptap-content.js +36 -4
  90. package/dist/template-resolver/web/document-tiptap-context.d.ts +6 -2
  91. package/dist/template-resolver/web/document-tiptap-context.js +2 -1
  92. package/dist/template-resolver/web/document-tiptap-editor.d.ts +1 -1
  93. package/dist/template-resolver/web/document-tiptap-editor.js +13 -5
  94. package/dist/template-resolver/web/document-tiptap-helpers.d.ts +30 -1
  95. package/dist/template-resolver/web/document-tiptap-helpers.js +103 -2
  96. package/dist/template-resolver/web/document-tiptap-toolbar-groups.d.ts +5 -0
  97. package/dist/template-resolver/web/document-tiptap-toolbar-groups.js +89 -6
  98. package/dist/template-resolver/web/document-tiptap-toolbar.js +45 -8
  99. package/dist/template-resolver/web/document-toolbar-blocks.d.ts +17 -0
  100. package/dist/template-resolver/web/i18n.js +19 -0
  101. package/dist/template-resolver/web/index.d.ts +8 -2
  102. package/dist/template-resolver/web/index.js +6 -1
  103. package/dist/template-resolver/web/pdf-constants.d.ts +3 -0
  104. package/dist/template-resolver/web/pdf-constants.js +3 -0
  105. package/dist/template-resolver/web/qualified-names.d.ts +7 -0
  106. package/dist/template-resolver/web/qualified-names.js +6 -0
  107. package/dist/template-resolver/web/use-document-tiptap-model.d.ts +6 -2
  108. package/dist/template-resolver/web/use-document-tiptap-model.js +38 -3
  109. package/dist/tenant/company-config.d.ts +6 -0
  110. package/dist/tenant/company-config.js +41 -0
  111. package/dist/tenant/feature.js +11 -0
  112. package/dist/tenant/i18n.js +14 -0
  113. package/package.json +16 -11
  114. package/src/template-resolver/changes.json +38 -0
@@ -1,5 +1,6 @@
1
1
  import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
2
2
  import { isResourceImageContentType } from "../shared/index.js";
3
+ import { appendStyle, applyDocumentPrintStyles } from "./compile-document-styles.js";
3
4
  import { rewriteStepsBlock } from "./compile-steps-block.js";
4
5
  import { conditionScopeElement, withParsedDocument } from "./document-sanitizer.js";
5
6
  import { DOCUMENT_CONDITION_ATTRIBUTE, DOCUMENT_TEXT_ALIGNMENTS, isAllowedDocumentUrlHref, isDocumentPlaceholderHref, isDocumentReferenceName, isDocumentResourceKey, } from "./web/document-schema.js";
@@ -170,11 +171,6 @@ const MAIL_HEADING_STYLES = {
170
171
  h2: "margin:0 0 12px 0;font-size:24px;line-height:1.2;font-weight:700;letter-spacing:-0.02em;color:#0B0D12",
171
172
  h3: "margin:20px 0 8px 0;font-size:17px;line-height:1.3;font-weight:600;color:#0B0D12",
172
173
  };
173
- // Appended after an existing style (data-align) so the alignment survives.
174
- function appendStyle(element, style) {
175
- const existing = element.getAttribute("style");
176
- element.setAttribute("style", existing === null ? style : `${existing};${style}`);
177
- }
178
174
  function collectUniqueValidAttributes(html, selector, attribute, isValid) {
179
175
  return withParsedDocument(html, (root) => {
180
176
  const values = new Set();
@@ -228,7 +224,7 @@ function rewriteAlignment(element) {
228
224
  const align = element.getAttribute("data-align");
229
225
  element.removeAttribute("data-align");
230
226
  if (isOneOf(DOCUMENT_TEXT_ALIGNMENTS, align))
231
- element.setAttribute("style", `text-align:${align}`);
227
+ appendStyle(element, `text-align:${align}`);
232
228
  }
233
229
  function rewriteResourceImage(element, resourceSrc, maxWidthPx, maxHeightPx) {
234
230
  const key = element.getAttribute("data-resource") ?? "";
@@ -299,6 +295,7 @@ export function compileDocumentBodyToHandlebars(html, variables, options = {}) {
299
295
  const scrubbed = html.replaceAll(EXPRESSION_OPEN, "").replaceAll(EXPRESSION_CLOSE, "");
300
296
  const compiled = withParsedDocument(scrubbed, (root) => {
301
297
  stripScriptsAndActiveContent(root, options);
298
+ applyDocumentPrintStyles(root);
302
299
  if (options.alignmentAsInlineStyle === true)
303
300
  applyAlignmentInlineStyles(root);
304
301
  if (options.headingAsInlineStyle === true)
@@ -0,0 +1,3 @@
1
+ import type { Element as ScanElement } from "happy-dom";
2
+ export declare function appendStyle(element: ScanElement, style: string): void;
3
+ export declare function applyDocumentPrintStyles(root: ScanElement): void;
@@ -0,0 +1,84 @@
1
+ import { readBlockStyleAttributes, readCellBackground, readColwidth, readFrameAttributes, readTextStyleAttributes, } from "./web/document-print-style.js";
2
+ import { documentBlockStyleCss, documentCellStyleCss, documentFrameCss, documentTextStyleCss, } from "./web/document-style-css.js";
3
+ // Appended after an existing style (data-align) so the alignment survives.
4
+ export function appendStyle(element, style) {
5
+ if (style === "")
6
+ return;
7
+ const existing = element.getAttribute("style");
8
+ element.setAttribute("style", existing === null ? style : `${existing};${style}`);
9
+ }
10
+ function addClass(element, className) {
11
+ const existing = element.getAttribute("class");
12
+ element.setAttribute("class", existing === null ? className : `${existing} ${className}`);
13
+ }
14
+ function roundPercent(value) {
15
+ return Math.round(value * 100) / 100;
16
+ }
17
+ // Percentages sum to exactly 100 so the table keeps the full content width.
18
+ function columnPercentages(widths) {
19
+ const total = widths.reduce((sum, width) => sum + width, 0);
20
+ const percentages = widths.map((width) => roundPercent((width / total) * 100));
21
+ const last = percentages.length - 1;
22
+ const others = percentages.slice(0, last).reduce((sum, value) => sum + value, 0);
23
+ percentages[last] = roundPercent(100 - others);
24
+ return percentages;
25
+ }
26
+ function firstRowColumnWidths(table) {
27
+ const firstRow = Array.from(table.querySelectorAll("tr")).find((row) => row.closest("table") === table);
28
+ if (firstRow === undefined)
29
+ return null;
30
+ const widths = [];
31
+ for (const cell of Array.from(firstRow.children)) {
32
+ const colwidth = readColwidth(cell);
33
+ const span = Number(cell.getAttribute("colspan") ?? 1);
34
+ if (colwidth === null || colwidth.length !== span)
35
+ return null;
36
+ widths.push(...colwidth);
37
+ }
38
+ return widths.length > 0 ? widths : null;
39
+ }
40
+ function insertColgroup(table, widths) {
41
+ const document = table.ownerDocument;
42
+ const colgroup = document.createElement("colgroup");
43
+ for (const percentage of columnPercentages(widths)) {
44
+ const col = document.createElement("col");
45
+ col.setAttribute("style", `width:${percentage}%`);
46
+ colgroup.append(col);
47
+ }
48
+ table.insertBefore(colgroup, table.firstChild);
49
+ }
50
+ function applyFrames(root) {
51
+ for (const frame of Array.from(root.querySelectorAll("div[data-frame]"))) {
52
+ const box = readFrameAttributes(frame);
53
+ if (box === null) {
54
+ frame.replaceWith(...Array.from(frame.childNodes));
55
+ continue;
56
+ }
57
+ addClass(frame, "kumiko-frame");
58
+ appendStyle(frame, documentFrameCss(box));
59
+ }
60
+ }
61
+ function applyTables(root) {
62
+ for (const table of Array.from(root.querySelectorAll("table"))) {
63
+ if (table.getAttribute("data-borders") === "none")
64
+ addClass(table, "kumiko-table-plain");
65
+ const widths = firstRowColumnWidths(table);
66
+ if (widths !== null)
67
+ insertColgroup(table, widths);
68
+ }
69
+ for (const cell of Array.from(root.querySelectorAll("td, th"))) {
70
+ appendStyle(cell, documentCellStyleCss({ background: readCellBackground(cell) }));
71
+ }
72
+ }
73
+ // Runs before the placeholder rewrites: a rich text block host copies its paragraph's
74
+ // attributes, so the style has to be on the paragraph by then.
75
+ export function applyDocumentPrintStyles(root) {
76
+ applyFrames(root);
77
+ applyTables(root);
78
+ for (const span of Array.from(root.querySelectorAll("span[data-text-style]"))) {
79
+ appendStyle(span, documentTextStyleCss(readTextStyleAttributes(span)));
80
+ }
81
+ for (const block of Array.from(root.querySelectorAll("p, h1, h2, h3"))) {
82
+ appendStyle(block, documentBlockStyleCss(readBlockStyleAttributes(block)));
83
+ }
84
+ }
@@ -0,0 +1,3 @@
1
+ import { type DocumentFrameAttributes } from "./web/document-print-style.ts";
2
+ export declare function readTopLevelFrames(html: string): readonly DocumentFrameAttributes[];
3
+ export declare function flattenFramesForPreview(compiledHtml: string): string;
@@ -0,0 +1,19 @@
1
+ // Server-only (happy-dom). Frames are read from the stored body for page planning, and flattened
2
+ // for the editor preview, which shows the body outside a page where absolute coordinates mean nothing.
3
+ import { withParsedDocument } from "./document-sanitizer.js";
4
+ import { readFrameAttributes } from "./web/document-print-style.js";
5
+ const PREVIEW_FRAME_STYLE = "margin:8px 0;padding:6px;border:1px dashed #9ca3af;white-space:pre-line";
6
+ export function readTopLevelFrames(html) {
7
+ return withParsedDocument(html, (body) => Array.from(body.children).flatMap((child) => {
8
+ const frame = child.matches("div[data-frame]") ? readFrameAttributes(child) : null;
9
+ return frame === null ? [] : [frame];
10
+ }));
11
+ }
12
+ export function flattenFramesForPreview(compiledHtml) {
13
+ return withParsedDocument(compiledHtml, (body) => {
14
+ for (const frame of Array.from(body.querySelectorAll("div.kumiko-frame"))) {
15
+ frame.setAttribute("style", PREVIEW_FRAME_STYLE);
16
+ }
17
+ return body.innerHTML;
18
+ });
19
+ }
@@ -0,0 +1,495 @@
1
+ import type { FieldIssue } from "@cosmicdrift/kumiko-framework/errors";
2
+ import type { JSONContent } from "@tiptap/core";
3
+ import * as z from "zod";
4
+ import type { DocumentOpsKind } from "./web/constants.ts";
5
+ import { type DocumentToolbarBlock } from "./web/document-blocks.ts";
6
+ export declare const MAX_BODY_BLOCKS = 300;
7
+ export declare const DOCUMENT_BLOCK_INPUT_TYPES: readonly ["paragraph", "heading", "list", "table", "frame", "image", "button", "divider", "pageBreak"];
8
+ export type DocumentBlockInputType = (typeof DOCUMENT_BLOCK_INPUT_TYPES)[number];
9
+ type AllowedBlock = DocumentToolbarBlock | "frame";
10
+ export declare function allowedBlocksFor(kind: DocumentOpsKind): readonly AllowedBlock[];
11
+ export declare function patchIssue(path: string, code: string, params?: Readonly<Record<string, unknown>>): FieldIssue;
12
+ export declare const blockInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
13
+ align: z.ZodOptional<z.ZodEnum<{
14
+ center: "center";
15
+ justify: "justify";
16
+ left: "left";
17
+ right: "right";
18
+ }>>;
19
+ style: z.ZodOptional<z.ZodObject<{
20
+ lineHeight: z.ZodOptional<z.ZodNumber>;
21
+ spaceBeforePt: z.ZodOptional<z.ZodNumber>;
22
+ spaceAfterPt: z.ZodOptional<z.ZodNumber>;
23
+ }, z.core.$strip>>;
24
+ textStyle: z.ZodOptional<z.ZodObject<{
25
+ font: z.ZodOptional<z.ZodEnum<{
26
+ arial: "arial";
27
+ calibri: "calibri";
28
+ cambria: "cambria";
29
+ courier: "courier";
30
+ times: "times";
31
+ }>>;
32
+ sizePt: z.ZodOptional<z.ZodNumber>;
33
+ color: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strip>>;
35
+ text: z.ZodOptional<z.ZodString>;
36
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
37
+ font: z.ZodOptional<z.ZodEnum<{
38
+ arial: "arial";
39
+ calibri: "calibri";
40
+ cambria: "cambria";
41
+ courier: "courier";
42
+ times: "times";
43
+ }>>;
44
+ sizePt: z.ZodOptional<z.ZodNumber>;
45
+ color: z.ZodOptional<z.ZodString>;
46
+ text: z.ZodString;
47
+ bold: z.ZodOptional<z.ZodBoolean>;
48
+ italic: z.ZodOptional<z.ZodBoolean>;
49
+ underline: z.ZodOptional<z.ZodBoolean>;
50
+ }, z.core.$strip>>>;
51
+ type: z.ZodLiteral<"paragraph">;
52
+ }, z.core.$strip>, z.ZodObject<{
53
+ align: z.ZodOptional<z.ZodEnum<{
54
+ center: "center";
55
+ justify: "justify";
56
+ left: "left";
57
+ right: "right";
58
+ }>>;
59
+ style: z.ZodOptional<z.ZodObject<{
60
+ lineHeight: z.ZodOptional<z.ZodNumber>;
61
+ spaceBeforePt: z.ZodOptional<z.ZodNumber>;
62
+ spaceAfterPt: z.ZodOptional<z.ZodNumber>;
63
+ }, z.core.$strip>>;
64
+ textStyle: z.ZodOptional<z.ZodObject<{
65
+ font: z.ZodOptional<z.ZodEnum<{
66
+ arial: "arial";
67
+ calibri: "calibri";
68
+ cambria: "cambria";
69
+ courier: "courier";
70
+ times: "times";
71
+ }>>;
72
+ sizePt: z.ZodOptional<z.ZodNumber>;
73
+ color: z.ZodOptional<z.ZodString>;
74
+ }, z.core.$strip>>;
75
+ text: z.ZodOptional<z.ZodString>;
76
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
77
+ font: z.ZodOptional<z.ZodEnum<{
78
+ arial: "arial";
79
+ calibri: "calibri";
80
+ cambria: "cambria";
81
+ courier: "courier";
82
+ times: "times";
83
+ }>>;
84
+ sizePt: z.ZodOptional<z.ZodNumber>;
85
+ color: z.ZodOptional<z.ZodString>;
86
+ text: z.ZodString;
87
+ bold: z.ZodOptional<z.ZodBoolean>;
88
+ italic: z.ZodOptional<z.ZodBoolean>;
89
+ underline: z.ZodOptional<z.ZodBoolean>;
90
+ }, z.core.$strip>>>;
91
+ type: z.ZodLiteral<"heading">;
92
+ level: z.ZodNumber;
93
+ }, z.core.$strip>, z.ZodObject<{
94
+ align: z.ZodOptional<z.ZodEnum<{
95
+ center: "center";
96
+ justify: "justify";
97
+ left: "left";
98
+ right: "right";
99
+ }>>;
100
+ style: z.ZodOptional<z.ZodObject<{
101
+ lineHeight: z.ZodOptional<z.ZodNumber>;
102
+ spaceBeforePt: z.ZodOptional<z.ZodNumber>;
103
+ spaceAfterPt: z.ZodOptional<z.ZodNumber>;
104
+ }, z.core.$strip>>;
105
+ textStyle: z.ZodOptional<z.ZodObject<{
106
+ font: z.ZodOptional<z.ZodEnum<{
107
+ arial: "arial";
108
+ calibri: "calibri";
109
+ cambria: "cambria";
110
+ courier: "courier";
111
+ times: "times";
112
+ }>>;
113
+ sizePt: z.ZodOptional<z.ZodNumber>;
114
+ color: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$strip>>;
116
+ type: z.ZodLiteral<"list">;
117
+ ordered: z.ZodBoolean;
118
+ items: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
119
+ font: z.ZodOptional<z.ZodEnum<{
120
+ arial: "arial";
121
+ calibri: "calibri";
122
+ cambria: "cambria";
123
+ courier: "courier";
124
+ times: "times";
125
+ }>>;
126
+ sizePt: z.ZodOptional<z.ZodNumber>;
127
+ color: z.ZodOptional<z.ZodString>;
128
+ text: z.ZodString;
129
+ bold: z.ZodOptional<z.ZodBoolean>;
130
+ italic: z.ZodOptional<z.ZodBoolean>;
131
+ underline: z.ZodOptional<z.ZodBoolean>;
132
+ }, z.core.$strip>>]>>;
133
+ }, z.core.$strip>, z.ZodObject<{
134
+ type: z.ZodLiteral<"table">;
135
+ borders: z.ZodOptional<z.ZodLiteral<"none">>;
136
+ columnWidthsPx: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
137
+ header: z.ZodOptional<z.ZodObject<{
138
+ cells: z.ZodArray<z.ZodObject<{
139
+ text: z.ZodOptional<z.ZodString>;
140
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
141
+ font: z.ZodOptional<z.ZodEnum<{
142
+ arial: "arial";
143
+ calibri: "calibri";
144
+ cambria: "cambria";
145
+ courier: "courier";
146
+ times: "times";
147
+ }>>;
148
+ sizePt: z.ZodOptional<z.ZodNumber>;
149
+ color: z.ZodOptional<z.ZodString>;
150
+ text: z.ZodString;
151
+ bold: z.ZodOptional<z.ZodBoolean>;
152
+ italic: z.ZodOptional<z.ZodBoolean>;
153
+ underline: z.ZodOptional<z.ZodBoolean>;
154
+ }, z.core.$strip>>>;
155
+ background: z.ZodOptional<z.ZodString>;
156
+ align: z.ZodOptional<z.ZodEnum<{
157
+ center: "center";
158
+ justify: "justify";
159
+ left: "left";
160
+ right: "right";
161
+ }>>;
162
+ }, z.core.$strip>>;
163
+ }, z.core.$strip>>;
164
+ rows: z.ZodArray<z.ZodObject<{
165
+ cells: z.ZodArray<z.ZodObject<{
166
+ text: z.ZodOptional<z.ZodString>;
167
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
168
+ font: z.ZodOptional<z.ZodEnum<{
169
+ arial: "arial";
170
+ calibri: "calibri";
171
+ cambria: "cambria";
172
+ courier: "courier";
173
+ times: "times";
174
+ }>>;
175
+ sizePt: z.ZodOptional<z.ZodNumber>;
176
+ color: z.ZodOptional<z.ZodString>;
177
+ text: z.ZodString;
178
+ bold: z.ZodOptional<z.ZodBoolean>;
179
+ italic: z.ZodOptional<z.ZodBoolean>;
180
+ underline: z.ZodOptional<z.ZodBoolean>;
181
+ }, z.core.$strip>>>;
182
+ background: z.ZodOptional<z.ZodString>;
183
+ align: z.ZodOptional<z.ZodEnum<{
184
+ center: "center";
185
+ justify: "justify";
186
+ left: "left";
187
+ right: "right";
188
+ }>>;
189
+ }, z.core.$strip>>;
190
+ }, z.core.$strip>>;
191
+ repeat: z.ZodOptional<z.ZodObject<{
192
+ each: z.ZodString;
193
+ row: z.ZodObject<{
194
+ cells: z.ZodArray<z.ZodObject<{
195
+ text: z.ZodOptional<z.ZodString>;
196
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
197
+ font: z.ZodOptional<z.ZodEnum<{
198
+ arial: "arial";
199
+ calibri: "calibri";
200
+ cambria: "cambria";
201
+ courier: "courier";
202
+ times: "times";
203
+ }>>;
204
+ sizePt: z.ZodOptional<z.ZodNumber>;
205
+ color: z.ZodOptional<z.ZodString>;
206
+ text: z.ZodString;
207
+ bold: z.ZodOptional<z.ZodBoolean>;
208
+ italic: z.ZodOptional<z.ZodBoolean>;
209
+ underline: z.ZodOptional<z.ZodBoolean>;
210
+ }, z.core.$strip>>>;
211
+ background: z.ZodOptional<z.ZodString>;
212
+ align: z.ZodOptional<z.ZodEnum<{
213
+ center: "center";
214
+ justify: "justify";
215
+ left: "left";
216
+ right: "right";
217
+ }>>;
218
+ }, z.core.$strip>>;
219
+ }, z.core.$strip>;
220
+ }, z.core.$strip>>;
221
+ }, z.core.$strip>, z.ZodObject<{
222
+ type: z.ZodLiteral<"frame">;
223
+ xMm: z.ZodNumber;
224
+ yMm: z.ZodNumber;
225
+ widthMm: z.ZodNumber;
226
+ heightMm: z.ZodNumber;
227
+ preset: z.ZodOptional<z.ZodEnum<{
228
+ address: "address";
229
+ text: "text";
230
+ }>>;
231
+ reserveFlow: z.ZodOptional<z.ZodBoolean>;
232
+ blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
233
+ align: z.ZodOptional<z.ZodEnum<{
234
+ center: "center";
235
+ justify: "justify";
236
+ left: "left";
237
+ right: "right";
238
+ }>>;
239
+ style: z.ZodOptional<z.ZodObject<{
240
+ lineHeight: z.ZodOptional<z.ZodNumber>;
241
+ spaceBeforePt: z.ZodOptional<z.ZodNumber>;
242
+ spaceAfterPt: z.ZodOptional<z.ZodNumber>;
243
+ }, z.core.$strip>>;
244
+ textStyle: z.ZodOptional<z.ZodObject<{
245
+ font: z.ZodOptional<z.ZodEnum<{
246
+ arial: "arial";
247
+ calibri: "calibri";
248
+ cambria: "cambria";
249
+ courier: "courier";
250
+ times: "times";
251
+ }>>;
252
+ sizePt: z.ZodOptional<z.ZodNumber>;
253
+ color: z.ZodOptional<z.ZodString>;
254
+ }, z.core.$strip>>;
255
+ text: z.ZodOptional<z.ZodString>;
256
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
257
+ font: z.ZodOptional<z.ZodEnum<{
258
+ arial: "arial";
259
+ calibri: "calibri";
260
+ cambria: "cambria";
261
+ courier: "courier";
262
+ times: "times";
263
+ }>>;
264
+ sizePt: z.ZodOptional<z.ZodNumber>;
265
+ color: z.ZodOptional<z.ZodString>;
266
+ text: z.ZodString;
267
+ bold: z.ZodOptional<z.ZodBoolean>;
268
+ italic: z.ZodOptional<z.ZodBoolean>;
269
+ underline: z.ZodOptional<z.ZodBoolean>;
270
+ }, z.core.$strip>>>;
271
+ type: z.ZodLiteral<"paragraph">;
272
+ }, z.core.$strip>, z.ZodObject<{
273
+ align: z.ZodOptional<z.ZodEnum<{
274
+ center: "center";
275
+ justify: "justify";
276
+ left: "left";
277
+ right: "right";
278
+ }>>;
279
+ style: z.ZodOptional<z.ZodObject<{
280
+ lineHeight: z.ZodOptional<z.ZodNumber>;
281
+ spaceBeforePt: z.ZodOptional<z.ZodNumber>;
282
+ spaceAfterPt: z.ZodOptional<z.ZodNumber>;
283
+ }, z.core.$strip>>;
284
+ textStyle: z.ZodOptional<z.ZodObject<{
285
+ font: z.ZodOptional<z.ZodEnum<{
286
+ arial: "arial";
287
+ calibri: "calibri";
288
+ cambria: "cambria";
289
+ courier: "courier";
290
+ times: "times";
291
+ }>>;
292
+ sizePt: z.ZodOptional<z.ZodNumber>;
293
+ color: z.ZodOptional<z.ZodString>;
294
+ }, z.core.$strip>>;
295
+ text: z.ZodOptional<z.ZodString>;
296
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
297
+ font: z.ZodOptional<z.ZodEnum<{
298
+ arial: "arial";
299
+ calibri: "calibri";
300
+ cambria: "cambria";
301
+ courier: "courier";
302
+ times: "times";
303
+ }>>;
304
+ sizePt: z.ZodOptional<z.ZodNumber>;
305
+ color: z.ZodOptional<z.ZodString>;
306
+ text: z.ZodString;
307
+ bold: z.ZodOptional<z.ZodBoolean>;
308
+ italic: z.ZodOptional<z.ZodBoolean>;
309
+ underline: z.ZodOptional<z.ZodBoolean>;
310
+ }, z.core.$strip>>>;
311
+ type: z.ZodLiteral<"heading">;
312
+ level: z.ZodNumber;
313
+ }, z.core.$strip>, z.ZodObject<{
314
+ align: z.ZodOptional<z.ZodEnum<{
315
+ center: "center";
316
+ justify: "justify";
317
+ left: "left";
318
+ right: "right";
319
+ }>>;
320
+ style: z.ZodOptional<z.ZodObject<{
321
+ lineHeight: z.ZodOptional<z.ZodNumber>;
322
+ spaceBeforePt: z.ZodOptional<z.ZodNumber>;
323
+ spaceAfterPt: z.ZodOptional<z.ZodNumber>;
324
+ }, z.core.$strip>>;
325
+ textStyle: z.ZodOptional<z.ZodObject<{
326
+ font: z.ZodOptional<z.ZodEnum<{
327
+ arial: "arial";
328
+ calibri: "calibri";
329
+ cambria: "cambria";
330
+ courier: "courier";
331
+ times: "times";
332
+ }>>;
333
+ sizePt: z.ZodOptional<z.ZodNumber>;
334
+ color: z.ZodOptional<z.ZodString>;
335
+ }, z.core.$strip>>;
336
+ type: z.ZodLiteral<"list">;
337
+ ordered: z.ZodBoolean;
338
+ items: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
339
+ font: z.ZodOptional<z.ZodEnum<{
340
+ arial: "arial";
341
+ calibri: "calibri";
342
+ cambria: "cambria";
343
+ courier: "courier";
344
+ times: "times";
345
+ }>>;
346
+ sizePt: z.ZodOptional<z.ZodNumber>;
347
+ color: z.ZodOptional<z.ZodString>;
348
+ text: z.ZodString;
349
+ bold: z.ZodOptional<z.ZodBoolean>;
350
+ italic: z.ZodOptional<z.ZodBoolean>;
351
+ underline: z.ZodOptional<z.ZodBoolean>;
352
+ }, z.core.$strip>>]>>;
353
+ }, z.core.$strip>, z.ZodObject<{
354
+ type: z.ZodLiteral<"table">;
355
+ borders: z.ZodOptional<z.ZodLiteral<"none">>;
356
+ columnWidthsPx: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
357
+ header: z.ZodOptional<z.ZodObject<{
358
+ cells: z.ZodArray<z.ZodObject<{
359
+ text: z.ZodOptional<z.ZodString>;
360
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
361
+ font: z.ZodOptional<z.ZodEnum<{
362
+ arial: "arial";
363
+ calibri: "calibri";
364
+ cambria: "cambria";
365
+ courier: "courier";
366
+ times: "times";
367
+ }>>;
368
+ sizePt: z.ZodOptional<z.ZodNumber>;
369
+ color: z.ZodOptional<z.ZodString>;
370
+ text: z.ZodString;
371
+ bold: z.ZodOptional<z.ZodBoolean>;
372
+ italic: z.ZodOptional<z.ZodBoolean>;
373
+ underline: z.ZodOptional<z.ZodBoolean>;
374
+ }, z.core.$strip>>>;
375
+ background: z.ZodOptional<z.ZodString>;
376
+ align: z.ZodOptional<z.ZodEnum<{
377
+ center: "center";
378
+ justify: "justify";
379
+ left: "left";
380
+ right: "right";
381
+ }>>;
382
+ }, z.core.$strip>>;
383
+ }, z.core.$strip>>;
384
+ rows: z.ZodArray<z.ZodObject<{
385
+ cells: z.ZodArray<z.ZodObject<{
386
+ text: z.ZodOptional<z.ZodString>;
387
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
388
+ font: z.ZodOptional<z.ZodEnum<{
389
+ arial: "arial";
390
+ calibri: "calibri";
391
+ cambria: "cambria";
392
+ courier: "courier";
393
+ times: "times";
394
+ }>>;
395
+ sizePt: z.ZodOptional<z.ZodNumber>;
396
+ color: z.ZodOptional<z.ZodString>;
397
+ text: z.ZodString;
398
+ bold: z.ZodOptional<z.ZodBoolean>;
399
+ italic: z.ZodOptional<z.ZodBoolean>;
400
+ underline: z.ZodOptional<z.ZodBoolean>;
401
+ }, z.core.$strip>>>;
402
+ background: z.ZodOptional<z.ZodString>;
403
+ align: z.ZodOptional<z.ZodEnum<{
404
+ center: "center";
405
+ justify: "justify";
406
+ left: "left";
407
+ right: "right";
408
+ }>>;
409
+ }, z.core.$strip>>;
410
+ }, z.core.$strip>>;
411
+ repeat: z.ZodOptional<z.ZodObject<{
412
+ each: z.ZodString;
413
+ row: z.ZodObject<{
414
+ cells: z.ZodArray<z.ZodObject<{
415
+ text: z.ZodOptional<z.ZodString>;
416
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
417
+ font: z.ZodOptional<z.ZodEnum<{
418
+ arial: "arial";
419
+ calibri: "calibri";
420
+ cambria: "cambria";
421
+ courier: "courier";
422
+ times: "times";
423
+ }>>;
424
+ sizePt: z.ZodOptional<z.ZodNumber>;
425
+ color: z.ZodOptional<z.ZodString>;
426
+ text: z.ZodString;
427
+ bold: z.ZodOptional<z.ZodBoolean>;
428
+ italic: z.ZodOptional<z.ZodBoolean>;
429
+ underline: z.ZodOptional<z.ZodBoolean>;
430
+ }, z.core.$strip>>>;
431
+ background: z.ZodOptional<z.ZodString>;
432
+ align: z.ZodOptional<z.ZodEnum<{
433
+ center: "center";
434
+ justify: "justify";
435
+ left: "left";
436
+ right: "right";
437
+ }>>;
438
+ }, z.core.$strip>>;
439
+ }, z.core.$strip>;
440
+ }, z.core.$strip>>;
441
+ }, z.core.$strip>, z.ZodObject<{
442
+ type: z.ZodLiteral<"image">;
443
+ resource: z.ZodString;
444
+ alt: z.ZodOptional<z.ZodString>;
445
+ }, z.core.$strip>], "type">>;
446
+ }, z.core.$strip>, z.ZodObject<{
447
+ type: z.ZodLiteral<"image">;
448
+ resource: z.ZodString;
449
+ alt: z.ZodOptional<z.ZodString>;
450
+ }, z.core.$strip>, z.ZodObject<{
451
+ type: z.ZodLiteral<"button">;
452
+ text: z.ZodString;
453
+ href: z.ZodString;
454
+ }, z.core.$strip>, z.ZodObject<{
455
+ type: z.ZodLiteral<"divider">;
456
+ }, z.core.$strip>, z.ZodObject<{
457
+ type: z.ZodLiteral<"pageBreak">;
458
+ }, z.core.$strip>], "type">;
459
+ export type BlockInput = z.infer<typeof blockInputSchema>;
460
+ export declare const blockFormatSchema: z.ZodObject<{
461
+ align: z.ZodOptional<z.ZodEnum<{
462
+ center: "center";
463
+ justify: "justify";
464
+ left: "left";
465
+ right: "right";
466
+ }>>;
467
+ style: z.ZodOptional<z.ZodObject<{
468
+ lineHeight: z.ZodOptional<z.ZodNumber>;
469
+ spaceBeforePt: z.ZodOptional<z.ZodNumber>;
470
+ spaceAfterPt: z.ZodOptional<z.ZodNumber>;
471
+ }, z.core.$strip>>;
472
+ textStyle: z.ZodOptional<z.ZodObject<{
473
+ font: z.ZodOptional<z.ZodEnum<{
474
+ arial: "arial";
475
+ calibri: "calibri";
476
+ cambria: "cambria";
477
+ courier: "courier";
478
+ times: "times";
479
+ }>>;
480
+ sizePt: z.ZodOptional<z.ZodNumber>;
481
+ color: z.ZodOptional<z.ZodString>;
482
+ }, z.core.$strip>>;
483
+ }, z.core.$strip>;
484
+ export type TextFormat = z.infer<typeof blockFormatSchema>;
485
+ export type BuildContext = {
486
+ readonly kind: DocumentOpsKind;
487
+ readonly issues: FieldIssue[];
488
+ };
489
+ export declare function countBlocks(blocks: readonly BlockInput[]): number;
490
+ export declare function blockNode(ctx: BuildContext, path: string, input: BlockInput): JSONContent;
491
+ export declare function usesPrintStyling(node: JSONContent): boolean;
492
+ export declare function refusePrintStyling(kind: DocumentOpsKind, node: JSONContent, path: string): FieldIssue | null;
493
+ export declare const FORMATTABLE_NODE_TYPES: ReadonlySet<string>;
494
+ export declare function formatNode(ctx: BuildContext, path: string, node: JSONContent, format: TextFormat): JSONContent;
495
+ export {};