@segnavia/format 0.37.0 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/board-edit.d.ts +2 -1
- package/dist/board-geometry.d.ts +2 -1
- package/dist/board-section-grid.d.ts +2 -1
- package/dist/board-sections.d.ts +2 -1
- package/dist/board.d.ts +8 -8
- package/dist/board.js +15 -11
- package/dist/book-exports.d.ts +4 -0
- package/dist/book-section.d.ts +225 -3
- package/dist/book-section.js +82 -17
- package/dist/book.d.ts +878 -416
- package/dist/book.js +236 -37
- package/dist/cover.d.ts +337 -0
- package/dist/cover.js +100 -0
- package/dist/deck-from-slides.d.ts +23 -4
- package/dist/deck.d.ts +144 -42
- package/dist/deck.js +22 -24
- package/dist/dependency-policy.d.ts +12 -0
- package/dist/dependency-policy.js +42 -0
- package/dist/direction.d.ts +1 -1
- package/dist/font-collection.d.ts +8 -0
- package/dist/font-collection.js +191 -0
- package/dist/font-face.d.ts +8 -0
- package/dist/font-face.js +24 -0
- package/dist/font-refusal.d.ts +5 -0
- package/dist/font-refusal.js +9 -0
- package/dist/font-signature.d.ts +5 -0
- package/dist/font-signature.js +13 -0
- package/dist/fonts.d.ts +6 -1
- package/dist/fonts.js +3 -1
- package/dist/geometry.d.ts +20 -0
- package/dist/geometry.js +18 -0
- package/dist/image-fit.d.ts +10 -0
- package/dist/image-fit.js +10 -0
- package/dist/imposition-marks.d.ts +1 -1
- package/dist/imposition-schema.d.ts +185 -0
- package/dist/imposition-schema.js +122 -0
- package/dist/imposition.d.ts +8 -6
- package/dist/index.d.ts +29 -1797
- package/dist/index.js +30 -210
- package/dist/json-schemas.d.ts +1860 -0
- package/dist/json-schemas.js +43 -0
- package/dist/local-font-limits.d.ts +15 -0
- package/dist/local-font-limits.js +24 -0
- package/dist/media.d.ts +152 -0
- package/dist/media.js +119 -0
- package/dist/note-series.d.ts +70 -0
- package/dist/note-series.js +153 -0
- package/dist/page.d.ts +174 -0
- package/dist/page.js +37 -0
- package/dist/paper.d.ts +2 -1
- package/dist/paper.js +2 -1
- package/dist/placement-cycle.d.ts +5 -0
- package/dist/placement-cycle.js +30 -0
- package/dist/placement-refusal.d.ts +5 -0
- package/dist/placement-refusal.js +6 -0
- package/dist/placement.d.ts +76 -0
- package/dist/placement.js +100 -0
- package/dist/print.d.ts +72 -0
- package/dist/print.js +38 -0
- package/dist/printed-page-imposition.d.ts +2 -1
- package/dist/printed-pages.d.ts +14 -0
- package/dist/printed-pages.js +14 -1
- package/dist/shots-used.d.ts +0 -1
- package/dist/shots-used.js +2 -2
- package/dist/slots.d.ts +13 -13
- package/package.json +1 -1
package/dist/book.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Direction, resolveDirection } from "./direction.js";
|
|
2
|
+
import { Placement } from "./placement.js";
|
|
2
3
|
import { Scripts } from "./scripts.js";
|
|
3
4
|
import { Slots } from "./slots.js";
|
|
4
5
|
import { FontReference } from "./fonts.js";
|
|
5
6
|
import { NoteMarker, NumberSystem, isHebrew } from "./numbering.js";
|
|
6
|
-
import { ParentPage, bookParentPages } from "./printed-pages.js";
|
|
7
|
-
import { BookChapterEntry, BookContents, BookFrontMatterEntry, BookOpens, BookSection, BookSectionParents, BookTemplate, Chapter, DesignedPage, DesignedSection, REGION_NAME, TemplatedPage, TemplatedSection, bookParentIssues, isBookContents, isChapter, isDesignedSection, isTemplatedSection } from "./book-section.js";
|
|
7
|
+
import { ParentPage, bookParentPages, flowingParentNames, resolveParentPages, textArea } from "./printed-pages.js";
|
|
8
|
+
import { BookChapterEntry, BookContents, BookFrontMatterEntry, BookItem, BookOpens, BookSection, BookSectionParents, BookTemplate, Chapter, DesignedPage, DesignedSection, MAX_PART_DEPTH, Part, PlacedSection, REGION_NAME, TemplatedPage, TemplatedSection, bookParentIssues, bookSections, isBookContents, isChapter, isDesignedSection, isPart, isPlacedSection, isTemplatedSection } from "./book-section.js";
|
|
9
|
+
import { NoteSeries, noteSeriesIssues, resolveNoteSeries } from "./note-series.js";
|
|
8
10
|
import { Orientation, Paper, sheetMm } from "./paper.js";
|
|
9
11
|
import { z } from "zod";
|
|
10
12
|
//#region src/book.ts
|
|
@@ -20,23 +22,31 @@ const BookPage = z.object({
|
|
|
20
22
|
}),
|
|
21
23
|
columnGap: z.number().nonnegative().default(4)
|
|
22
24
|
});
|
|
23
|
-
const BookRunningHeadSource = z.union([
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const BookRunningHeadSource = z.union([
|
|
26
|
+
z.literal("title"),
|
|
27
|
+
z.object({
|
|
28
|
+
mark: z.string().min(1),
|
|
29
|
+
which: z.enum(["first", "last"])
|
|
30
|
+
}),
|
|
31
|
+
z.object({ part: z.string().regex(REGION_NAME) })
|
|
32
|
+
]);
|
|
27
33
|
const BookRunningHead = z.object({
|
|
28
34
|
recto: BookRunningHeadSource.default("title"),
|
|
29
35
|
verso: BookRunningHeadSource.default("title")
|
|
30
36
|
});
|
|
31
37
|
const BookShape = z.object({
|
|
32
38
|
title: z.string(),
|
|
39
|
+
authors: z.array(z.string()).optional(),
|
|
40
|
+
subject: z.string().optional(),
|
|
33
41
|
mode: BookMode,
|
|
34
42
|
page: BookPage.optional(),
|
|
35
43
|
scripts: Scripts.default("refuse"),
|
|
36
44
|
dir: Direction.optional(),
|
|
37
45
|
lang: z.string().optional(),
|
|
38
|
-
frontMatter: z.array(
|
|
39
|
-
|
|
46
|
+
frontMatter: z.array(BookItem).default([]),
|
|
47
|
+
body: z.array(BookItem).optional(),
|
|
48
|
+
endMatter: z.array(BookItem).default([]),
|
|
49
|
+
chapters: z.array(BookChapterEntry).optional(),
|
|
40
50
|
parentPages: z.array(ParentPage).default([]),
|
|
41
51
|
templates: z.array(BookTemplate).default([]),
|
|
42
52
|
slots: Slots.optional(),
|
|
@@ -55,6 +65,7 @@ const BookShape = z.object({
|
|
|
55
65
|
placement: z.enum(["book", "chapter"]).default("book"),
|
|
56
66
|
title: z.string().optional()
|
|
57
67
|
}).default({ placement: "book" }),
|
|
68
|
+
notes: z.array(NoteSeries).default([]),
|
|
58
69
|
rectoOpenings: z.boolean().default(false),
|
|
59
70
|
orphans: z.number().int().min(1).default(2),
|
|
60
71
|
widows: z.number().int().min(1).default(2),
|
|
@@ -106,31 +117,138 @@ const BookView = BookShape.pick({
|
|
|
106
117
|
flow: z.string().optional(),
|
|
107
118
|
pagination: BookViewPagination.optional()
|
|
108
119
|
});
|
|
109
|
-
const
|
|
120
|
+
const ResolvedBook = BookShape.superRefine((book, ctx) => {
|
|
121
|
+
for (const { entry, path } of bookSections({
|
|
122
|
+
...book,
|
|
123
|
+
body: book.body ?? book.chapters ?? []
|
|
124
|
+
})) {
|
|
125
|
+
if (!isPlacedSection(entry)) continue;
|
|
126
|
+
try {
|
|
127
|
+
Placement.parse(entry.placement, "book");
|
|
128
|
+
} catch (error) {
|
|
129
|
+
ctx.addIssue({
|
|
130
|
+
code: "custom",
|
|
131
|
+
path: [...path, "placement"],
|
|
132
|
+
message: error instanceof Error ? error.message : String(error)
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const seen = /* @__PURE__ */ new Set();
|
|
137
|
+
book.notes.forEach(({ name }, index) => {
|
|
138
|
+
if (seen.has(name)) ctx.addIssue({
|
|
139
|
+
code: "custom",
|
|
140
|
+
path: [
|
|
141
|
+
"notes",
|
|
142
|
+
index,
|
|
143
|
+
"name"
|
|
144
|
+
],
|
|
145
|
+
message: `note series ${name} is duplicated; give every series a unique name`
|
|
146
|
+
});
|
|
147
|
+
seen.add(name);
|
|
148
|
+
if (name !== "footnote" && name !== "endnote") {
|
|
149
|
+
if (book.notes[index]?.placement === void 0) ctx.addIssue({
|
|
150
|
+
code: "custom",
|
|
151
|
+
path: [
|
|
152
|
+
"notes",
|
|
153
|
+
index,
|
|
154
|
+
"placement"
|
|
155
|
+
],
|
|
156
|
+
message: `note series ${name} needs placement`
|
|
157
|
+
});
|
|
158
|
+
if (book.notes[index]?.numbering === void 0) ctx.addIssue({
|
|
159
|
+
code: "custom",
|
|
160
|
+
path: [
|
|
161
|
+
"notes",
|
|
162
|
+
index,
|
|
163
|
+
"numbering"
|
|
164
|
+
],
|
|
165
|
+
message: `note series ${name} needs numbering`
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}).transform((book, ctx) => {
|
|
110
170
|
const hebrew = isHebrew(book.lang);
|
|
171
|
+
const { chapters, ...fields } = book;
|
|
172
|
+
if (book.body !== void 0 && chapters !== void 0) {
|
|
173
|
+
ctx.addIssue({
|
|
174
|
+
code: "custom",
|
|
175
|
+
path: ["body"],
|
|
176
|
+
message: "body and chapters were both given; keep body and remove chapters"
|
|
177
|
+
});
|
|
178
|
+
ctx.addIssue({
|
|
179
|
+
code: "custom",
|
|
180
|
+
path: ["chapters"],
|
|
181
|
+
message: "chapters and body were both given; keep body and remove chapters"
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const notes = resolveNoteSeries({
|
|
185
|
+
lang: book.lang,
|
|
186
|
+
footnotes: book.footnotes,
|
|
187
|
+
endnotes: book.endnotes,
|
|
188
|
+
notes: book.notes
|
|
189
|
+
});
|
|
190
|
+
const footnote = notes[0];
|
|
191
|
+
const endnote = notes[1];
|
|
192
|
+
if (!footnote || !endnote) throw new Error("note series resolution did not produce the two default series");
|
|
111
193
|
return {
|
|
112
|
-
...
|
|
194
|
+
...fields,
|
|
195
|
+
body: book.body ?? chapters ?? [],
|
|
196
|
+
bodyKey: book.body === void 0 && chapters !== void 0 ? "chapters" : "body",
|
|
113
197
|
numbering: {
|
|
114
198
|
frontMatter: book.numbering.frontMatter ?? (hebrew ? "arabic" : "roman-lower"),
|
|
115
199
|
body: book.numbering.body ?? (hebrew ? "hebrew" : "arabic")
|
|
116
200
|
},
|
|
117
201
|
footnotes: {
|
|
118
202
|
...book.footnotes,
|
|
119
|
-
marker:
|
|
203
|
+
marker: footnote.marker
|
|
120
204
|
},
|
|
121
205
|
endnotes: {
|
|
122
206
|
...book.endnotes,
|
|
123
|
-
marker:
|
|
124
|
-
title:
|
|
125
|
-
}
|
|
207
|
+
marker: endnote.marker,
|
|
208
|
+
title: endnote.title
|
|
209
|
+
},
|
|
210
|
+
notes
|
|
126
211
|
};
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
212
|
+
});
|
|
213
|
+
function partSectionIssues(items, path) {
|
|
214
|
+
return items.flatMap((entry, index) => {
|
|
215
|
+
if (!isPart(entry)) return [];
|
|
216
|
+
const partPath = [...path, index];
|
|
217
|
+
return [...!(entry.html !== void 0 || bookSections({
|
|
218
|
+
frontMatter: [],
|
|
219
|
+
body: entry.children,
|
|
220
|
+
endMatter: []
|
|
221
|
+
}).some(({ entry: child }) => !isPart(child) || child.html !== void 0)) ? [{
|
|
222
|
+
path: partPath,
|
|
223
|
+
message: `part ${partPath.join(".")} has no section; add html or a section inside it to clear this refusal`
|
|
224
|
+
}] : [], ...partSectionIssues(entry.children, [...partPath, "children"])];
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function structuralBookIssues(book) {
|
|
228
|
+
const issues = [];
|
|
229
|
+
if (book.body.length === 0) issues.push({
|
|
230
|
+
path: ["body"],
|
|
231
|
+
message: "a book needs at least one body entry; add a chapter or part"
|
|
232
|
+
});
|
|
233
|
+
issues.push(...partSectionIssues(book.frontMatter, ["frontMatter"]), ...partSectionIssues(book.body, [book.bodyKey]), ...partSectionIssues(book.endMatter, ["endMatter"]));
|
|
234
|
+
const sections = bookSections(book);
|
|
235
|
+
for (const section of sections) if (isBookContents(section.entry) && section.division !== "front") issues.push({
|
|
236
|
+
path: section.path,
|
|
237
|
+
message: `contents belongs in frontMatter; move this ${section.division} contents entry there`
|
|
238
|
+
});
|
|
239
|
+
const paths = sections.flatMap(({ entry, division, path }) => division === "front" && isBookContents(entry) ? [path.join(".")] : []);
|
|
240
|
+
if (paths.length > 1) issues.push({
|
|
131
241
|
path: ["frontMatter"],
|
|
132
|
-
message: `front-matter entries at
|
|
242
|
+
message: `front-matter entries at ${paths[0]} and ${paths[1]} are both contents entries; one must go`
|
|
133
243
|
});
|
|
244
|
+
return issues;
|
|
245
|
+
}
|
|
246
|
+
const RefinedBook = ResolvedBook.superRefine((book, ctx) => {
|
|
247
|
+
for (const issue of structuralBookIssues(book)) ctx.addIssue({
|
|
248
|
+
code: "custom",
|
|
249
|
+
...issue
|
|
250
|
+
});
|
|
251
|
+
const sections = bookSections(book);
|
|
134
252
|
if (book.mode === "paginated" && !book.page) ctx.addIssue({
|
|
135
253
|
code: "custom",
|
|
136
254
|
path: ["page"],
|
|
@@ -141,10 +259,9 @@ const Book = BookShape.transform((book) => {
|
|
|
141
259
|
path: ["numbering"],
|
|
142
260
|
message: `front-matter and body numbering are both ${book.numbering.body}; the two must differ when front matter is present`
|
|
143
261
|
});
|
|
144
|
-
|
|
262
|
+
for (const issue of noteSeriesIssues(book.notes, book.mode)) ctx.addIssue({
|
|
145
263
|
code: "custom",
|
|
146
|
-
|
|
147
|
-
message: "endnotes are placed at the end of each chapter only in paginated mode; use book placement or paginated mode"
|
|
264
|
+
...issue
|
|
148
265
|
});
|
|
149
266
|
for (const issue of bookParentIssues(book)) ctx.addIssue({
|
|
150
267
|
code: "custom",
|
|
@@ -152,19 +269,105 @@ const Book = BookShape.transform((book) => {
|
|
|
152
269
|
});
|
|
153
270
|
if (!book.page) return;
|
|
154
271
|
const trim = sheetMm(book.page);
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
path
|
|
160
|
-
|
|
272
|
+
const parents = resolveParentPages([...bookParentPages(book.page.margin), ...book.parentPages]);
|
|
273
|
+
const defaults = new Set(bookParentPages(book.page.margin).map((parent) => parent.name));
|
|
274
|
+
for (const parent of parents) {
|
|
275
|
+
const area = textArea(parent, trim);
|
|
276
|
+
const path = defaults.has(parent.name) ? ["page", "margin"] : ["parentPages"];
|
|
277
|
+
if (area.height <= 0) {
|
|
278
|
+
const total = parent.margin.top + parent.margin.bottom;
|
|
279
|
+
ctx.addIssue({
|
|
280
|
+
code: "custom",
|
|
281
|
+
path,
|
|
282
|
+
message: `parent page "${parent.name}" has top and bottom margins totaling ${total}mm on paper ${trim.height}mm high; reduce the vertical margins to leave a text area`
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
if (area.width <= 0) {
|
|
286
|
+
const total = parent.margin.inner + parent.margin.outer;
|
|
287
|
+
ctx.addIssue({
|
|
288
|
+
code: "custom",
|
|
289
|
+
path,
|
|
290
|
+
message: `parent page "${parent.name}" has inner and outer margins totaling ${total}mm on paper ${trim.width}mm wide; reduce the horizontal margins to leave a text area`
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const byName = new Map(parents.map((parent) => [parent.name, parent]));
|
|
295
|
+
sections.filter(({ entry }) => !isDesignedSection(entry) && !isTemplatedSection(entry)).forEach(({ entry: flow, path }, index) => {
|
|
296
|
+
const names = flowingParentNames(flow.parents);
|
|
297
|
+
const widths = Object.entries(names).flatMap(([role, name]) => {
|
|
298
|
+
const parent = byName.get(name);
|
|
299
|
+
return parent ? [{
|
|
300
|
+
role,
|
|
301
|
+
name,
|
|
302
|
+
width: textArea(parent, trim).width
|
|
303
|
+
}] : [];
|
|
304
|
+
});
|
|
305
|
+
const first = widths[0];
|
|
306
|
+
const different = widths.find((candidate) => candidate.width !== first?.width);
|
|
307
|
+
if (!first || !different) return;
|
|
308
|
+
const label = flow.title ?? `flow ${index + 1}`;
|
|
309
|
+
ctx.addIssue({
|
|
310
|
+
code: "custom",
|
|
311
|
+
path,
|
|
312
|
+
message: `the ${label} flow uses parent pages "${first.name}" (${first.width}mm) and "${different.name}" (${different.width}mm) with different text widths; make the widths equal or split the flow into sections to clear this refusal`
|
|
313
|
+
});
|
|
161
314
|
});
|
|
162
|
-
|
|
315
|
+
});
|
|
316
|
+
function partDepthIssues(value) {
|
|
317
|
+
if (typeof value !== "object" || value === null) return [];
|
|
318
|
+
const input = value;
|
|
319
|
+
const roots = [
|
|
320
|
+
["frontMatter", input.frontMatter],
|
|
321
|
+
["body", input.body],
|
|
322
|
+
["chapters", input.chapters],
|
|
323
|
+
["endMatter", input.endMatter]
|
|
324
|
+
];
|
|
325
|
+
const stack = [];
|
|
326
|
+
for (const [key, entries] of roots) {
|
|
327
|
+
if (!Array.isArray(entries)) continue;
|
|
328
|
+
entries.forEach((entry, index) => {
|
|
329
|
+
stack.push({
|
|
330
|
+
value: entry,
|
|
331
|
+
path: [key, index],
|
|
332
|
+
depth: 0
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
const issues = [];
|
|
337
|
+
while (stack.length > 0) {
|
|
338
|
+
const current = stack.pop();
|
|
339
|
+
if (!current || typeof current.value !== "object" || current.value === null || !("name" in current.value)) continue;
|
|
340
|
+
const depth = current.depth + 1;
|
|
341
|
+
if (depth > 6) {
|
|
342
|
+
issues.push({
|
|
343
|
+
path: current.path,
|
|
344
|
+
message: `part ${current.path.join(".")} exceeds the maximum part depth of 6; reduce the nesting to clear this refusal`
|
|
345
|
+
});
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
const children = current.value.children;
|
|
349
|
+
if (!Array.isArray(children)) continue;
|
|
350
|
+
children.forEach((child, index) => {
|
|
351
|
+
stack.push({
|
|
352
|
+
value: child,
|
|
353
|
+
path: [
|
|
354
|
+
...current.path,
|
|
355
|
+
"children",
|
|
356
|
+
index
|
|
357
|
+
],
|
|
358
|
+
depth
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
return issues;
|
|
363
|
+
}
|
|
364
|
+
const Book = z.preprocess((value, ctx) => {
|
|
365
|
+
for (const issue of partDepthIssues(value)) ctx.addIssue({
|
|
163
366
|
code: "custom",
|
|
164
|
-
|
|
165
|
-
message: `the inner and outer margins total ${horizontal}mm and the page is ${trim.width}mm wide; reduce the horizontal margins to leave a text area`
|
|
367
|
+
...issue
|
|
166
368
|
});
|
|
167
|
-
|
|
369
|
+
return value;
|
|
370
|
+
}, RefinedBook).transform(({ bodyKey: _bodyKey, ...book }) => book);
|
|
168
371
|
function resolveBookPagination(book) {
|
|
169
372
|
if (book.mode !== "paginated" || !book.page) return void 0;
|
|
170
373
|
return {
|
|
@@ -182,9 +385,5 @@ function resolveBookPagination(book) {
|
|
|
182
385
|
runningHead: book.runningHead
|
|
183
386
|
};
|
|
184
387
|
}
|
|
185
|
-
function noteMarkerIssues(book, used) {
|
|
186
|
-
if (!used.footnotes || !used.endnotes || book.footnotes.marker !== book.endnotes.marker) return [];
|
|
187
|
-
return [`footnote and endnote markers are both ${book.footnotes.marker}; the two must differ when both kinds are used`];
|
|
188
|
-
}
|
|
189
388
|
//#endregion
|
|
190
|
-
export { Book, BookChapterEntry, BookContents, BookFrontMatterEntry, BookMode, BookOpens, BookPage, BookRunningHead, BookRunningHeadSource, BookSection, BookSectionParents, BookShape, BookTemplate, BookView, BookViewPagination, Chapter, DesignedPage, DesignedSection, REGION_NAME, TemplatedPage, TemplatedSection, isBookContents, isChapter, isDesignedSection,
|
|
389
|
+
export { Book, BookChapterEntry, BookContents, BookFrontMatterEntry, BookItem, BookMode, BookOpens, BookPage, BookRunningHead, BookRunningHeadSource, BookSection, BookSectionParents, BookShape, BookTemplate, BookView, BookViewPagination, Chapter, DesignedPage, DesignedSection, MAX_PART_DEPTH, Part, PlacedSection, REGION_NAME, TemplatedPage, TemplatedSection, bookSections, isBookContents, isChapter, isDesignedSection, isPart, isPlacedSection, isTemplatedSection, resolveBookPagination };
|
package/dist/cover.d.ts
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { Motif } from "./motif.js";
|
|
2
|
+
import { Page } from "./page.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/cover.d.ts
|
|
5
|
+
export declare const COVER_SHEET: {
|
|
6
|
+
readonly width: 160;
|
|
7
|
+
readonly height: 100;
|
|
8
|
+
};
|
|
9
|
+
export declare const COVER_DRAWING_VERSION = 1;
|
|
10
|
+
export declare const Cover: z.ZodPipe<z.ZodObject<{
|
|
11
|
+
page: z.ZodObject<{
|
|
12
|
+
id: z.ZodOptional<z.ZodString>;
|
|
13
|
+
html: z.ZodString;
|
|
14
|
+
size: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"fluid">, z.ZodObject<{
|
|
15
|
+
width: z.ZodNumber;
|
|
16
|
+
height: z.ZodNumber;
|
|
17
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
18
|
+
width: z.ZodNumber;
|
|
19
|
+
height: z.ZodLiteral<"auto">;
|
|
20
|
+
}, z.core.$strip>]>>;
|
|
21
|
+
scripts: z.ZodDefault<z.ZodEnum<{
|
|
22
|
+
refuse: "refuse";
|
|
23
|
+
sandboxed: "sandboxed";
|
|
24
|
+
}>>;
|
|
25
|
+
dir: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
auto: "auto";
|
|
27
|
+
ltr: "ltr";
|
|
28
|
+
rtl: "rtl";
|
|
29
|
+
}>>;
|
|
30
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
31
|
+
print: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
paper: z.ZodUnion<readonly [z.ZodEnum<{
|
|
33
|
+
letter: "letter";
|
|
34
|
+
legal: "legal";
|
|
35
|
+
tabloid: "tabloid";
|
|
36
|
+
a3: "a3";
|
|
37
|
+
a4: "a4";
|
|
38
|
+
a5: "a5";
|
|
39
|
+
"business-card-us": "business-card-us";
|
|
40
|
+
"business-card-eu": "business-card-eu";
|
|
41
|
+
"business-card-square-us": "business-card-square-us";
|
|
42
|
+
"business-card-slim-us": "business-card-slim-us";
|
|
43
|
+
"postcard-4x6": "postcard-4x6";
|
|
44
|
+
"postcard-5x7": "postcard-5x7";
|
|
45
|
+
"postcard-6x9": "postcard-6x9";
|
|
46
|
+
"postcard-6x11": "postcard-6x11";
|
|
47
|
+
"card-square-4in": "card-square-4in";
|
|
48
|
+
"half-letter": "half-letter";
|
|
49
|
+
a6: "a6";
|
|
50
|
+
dl: "dl";
|
|
51
|
+
"rack-card-4x9": "rack-card-4x9";
|
|
52
|
+
"rack-card-3.5x8.5": "rack-card-3.5x8.5";
|
|
53
|
+
"poster-12x18": "poster-12x18";
|
|
54
|
+
"poster-16x20": "poster-16x20";
|
|
55
|
+
"poster-18x24": "poster-18x24";
|
|
56
|
+
"poster-24x36": "poster-24x36";
|
|
57
|
+
a2: "a2";
|
|
58
|
+
a1: "a1";
|
|
59
|
+
a0: "a0";
|
|
60
|
+
}>, z.ZodObject<{
|
|
61
|
+
width: z.ZodNumber;
|
|
62
|
+
height: z.ZodNumber;
|
|
63
|
+
unit: z.ZodEnum<{
|
|
64
|
+
mm: "mm";
|
|
65
|
+
in: "in";
|
|
66
|
+
pt: "pt";
|
|
67
|
+
}>;
|
|
68
|
+
}, z.core.$strip>]>;
|
|
69
|
+
orientation: z.ZodDefault<z.ZodEnum<{
|
|
70
|
+
portrait: "portrait";
|
|
71
|
+
landscape: "landscape";
|
|
72
|
+
}>>;
|
|
73
|
+
margin: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
top: z.ZodDefault<z.ZodNumber>;
|
|
75
|
+
right: z.ZodDefault<z.ZodNumber>;
|
|
76
|
+
bottom: z.ZodDefault<z.ZodNumber>;
|
|
77
|
+
left: z.ZodDefault<z.ZodNumber>;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
bleed: z.ZodDefault<z.ZodNumber>;
|
|
80
|
+
safe: z.ZodDefault<z.ZodNumber>;
|
|
81
|
+
marks: z.ZodDefault<z.ZodBoolean>;
|
|
82
|
+
markColor: z.ZodDefault<z.ZodEnum<{
|
|
83
|
+
black: "black";
|
|
84
|
+
registration: "registration";
|
|
85
|
+
}>>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
printedPages: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
parents: z.ZodArray<z.ZodObject<{
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
basedOn: z.ZodOptional<z.ZodString>;
|
|
91
|
+
margin: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
top: z.ZodNumber;
|
|
93
|
+
bottom: z.ZodNumber;
|
|
94
|
+
inner: z.ZodNumber;
|
|
95
|
+
outer: z.ZodNumber;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
head: z.ZodOptional<z.ZodString>;
|
|
98
|
+
foot: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
rules: z.ZodPipe<z.ZodObject<{
|
|
101
|
+
every: z.ZodString;
|
|
102
|
+
first: z.ZodOptional<z.ZodString>;
|
|
103
|
+
recto: z.ZodOptional<z.ZodString>;
|
|
104
|
+
verso: z.ZodOptional<z.ZodString>;
|
|
105
|
+
last: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
107
|
+
last?: string | undefined;
|
|
108
|
+
verso?: string | undefined;
|
|
109
|
+
recto?: string | undefined;
|
|
110
|
+
first?: string | undefined;
|
|
111
|
+
every: string;
|
|
112
|
+
}, {
|
|
113
|
+
[x: string]: unknown;
|
|
114
|
+
every: string;
|
|
115
|
+
first?: string | undefined;
|
|
116
|
+
recto?: string | undefined;
|
|
117
|
+
verso?: string | undefined;
|
|
118
|
+
last?: string | undefined;
|
|
119
|
+
}>>;
|
|
120
|
+
numbering: z.ZodOptional<z.ZodEnum<{
|
|
121
|
+
arabic: "arabic";
|
|
122
|
+
"roman-lower": "roman-lower";
|
|
123
|
+
"roman-upper": "roman-upper";
|
|
124
|
+
hebrew: "hebrew";
|
|
125
|
+
}>>;
|
|
126
|
+
}, z.core.$strip>>;
|
|
127
|
+
slots: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
128
|
+
key: z.ZodString;
|
|
129
|
+
label: z.ZodString;
|
|
130
|
+
type: z.ZodEnum<{
|
|
131
|
+
text: "text";
|
|
132
|
+
image: "image";
|
|
133
|
+
phone: "phone";
|
|
134
|
+
email: "email";
|
|
135
|
+
link: "link";
|
|
136
|
+
qr: "qr";
|
|
137
|
+
}>;
|
|
138
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
139
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
140
|
+
overflow: z.ZodDefault<z.ZodEnum<{
|
|
141
|
+
refuse: "refuse";
|
|
142
|
+
shrink: "shrink";
|
|
143
|
+
truncate: "truncate";
|
|
144
|
+
wrap: "wrap";
|
|
145
|
+
}>>;
|
|
146
|
+
minSize: z.ZodOptional<z.ZodNumber>;
|
|
147
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
148
|
+
key: string;
|
|
149
|
+
label: string;
|
|
150
|
+
type: "text" | "image" | "phone" | "email" | "link" | "qr";
|
|
151
|
+
required: boolean;
|
|
152
|
+
overflow: "refuse" | "shrink" | "truncate" | "wrap";
|
|
153
|
+
placeholder?: string | undefined;
|
|
154
|
+
minSize?: number | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
key: string;
|
|
157
|
+
label: string;
|
|
158
|
+
type: "text" | "image" | "phone" | "email" | "link" | "qr";
|
|
159
|
+
required: boolean;
|
|
160
|
+
overflow: "refuse" | "shrink" | "truncate" | "wrap";
|
|
161
|
+
placeholder?: string | undefined;
|
|
162
|
+
minSize?: number | undefined;
|
|
163
|
+
}>>>>;
|
|
164
|
+
fonts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
165
|
+
app: z.ZodString;
|
|
166
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
167
|
+
local: z.ZodString;
|
|
168
|
+
fallback: z.ZodString;
|
|
169
|
+
}, z.core.$strip>]>>>;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
id: z.ZodOptional<z.ZodString>;
|
|
172
|
+
name: z.ZodOptional<z.ZodString>;
|
|
173
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
174
|
+
page: {
|
|
175
|
+
print: {
|
|
176
|
+
paper: "letter" | "legal" | "tabloid" | "a3" | "a4" | "a5" | "business-card-us" | "business-card-eu" | "business-card-square-us" | "business-card-slim-us" | "postcard-4x6" | "postcard-5x7" | "postcard-6x9" | "postcard-6x11" | "card-square-4in" | "half-letter" | "a6" | "dl" | "rack-card-4x9" | "rack-card-3.5x8.5" | "poster-12x18" | "poster-16x20" | "poster-18x24" | "poster-24x36" | "a2" | "a1" | "a0" | {
|
|
177
|
+
width: number;
|
|
178
|
+
height: number;
|
|
179
|
+
unit: "mm" | "in" | "pt";
|
|
180
|
+
};
|
|
181
|
+
orientation: "portrait" | "landscape";
|
|
182
|
+
bleed: number;
|
|
183
|
+
safe: number;
|
|
184
|
+
marks: boolean;
|
|
185
|
+
markColor: "black" | "registration";
|
|
186
|
+
margin?: {
|
|
187
|
+
top: number;
|
|
188
|
+
right: number;
|
|
189
|
+
bottom: number;
|
|
190
|
+
left: number;
|
|
191
|
+
} | undefined;
|
|
192
|
+
};
|
|
193
|
+
html: string;
|
|
194
|
+
size: "fluid" | {
|
|
195
|
+
width: number;
|
|
196
|
+
height: number;
|
|
197
|
+
} | {
|
|
198
|
+
width: number;
|
|
199
|
+
height: "auto";
|
|
200
|
+
};
|
|
201
|
+
scripts: "refuse" | "sandboxed";
|
|
202
|
+
id?: string | undefined;
|
|
203
|
+
dir?: "auto" | "ltr" | "rtl" | undefined;
|
|
204
|
+
lang?: string | undefined;
|
|
205
|
+
printedPages?: {
|
|
206
|
+
parents: {
|
|
207
|
+
name: string;
|
|
208
|
+
basedOn?: string | undefined;
|
|
209
|
+
margin?: {
|
|
210
|
+
top: number;
|
|
211
|
+
bottom: number;
|
|
212
|
+
inner: number;
|
|
213
|
+
outer: number;
|
|
214
|
+
} | undefined;
|
|
215
|
+
head?: string | undefined;
|
|
216
|
+
foot?: string | undefined;
|
|
217
|
+
}[];
|
|
218
|
+
rules: {
|
|
219
|
+
last?: string | undefined;
|
|
220
|
+
verso?: string | undefined;
|
|
221
|
+
recto?: string | undefined;
|
|
222
|
+
first?: string | undefined;
|
|
223
|
+
every: string;
|
|
224
|
+
};
|
|
225
|
+
numbering?: "arabic" | "roman-lower" | "roman-upper" | "hebrew" | undefined;
|
|
226
|
+
} | undefined;
|
|
227
|
+
slots?: {
|
|
228
|
+
key: string;
|
|
229
|
+
label: string;
|
|
230
|
+
type: "text" | "image" | "phone" | "email" | "link" | "qr";
|
|
231
|
+
required: boolean;
|
|
232
|
+
overflow: "refuse" | "shrink" | "truncate" | "wrap";
|
|
233
|
+
placeholder?: string | undefined;
|
|
234
|
+
minSize?: number | undefined;
|
|
235
|
+
}[] | undefined;
|
|
236
|
+
fonts?: ({
|
|
237
|
+
app: string;
|
|
238
|
+
} | {
|
|
239
|
+
local: string;
|
|
240
|
+
fallback: string;
|
|
241
|
+
})[] | undefined;
|
|
242
|
+
};
|
|
243
|
+
id?: string | undefined;
|
|
244
|
+
name?: string | undefined;
|
|
245
|
+
}, {
|
|
246
|
+
page: {
|
|
247
|
+
html: string;
|
|
248
|
+
size: "fluid" | {
|
|
249
|
+
width: number;
|
|
250
|
+
height: number;
|
|
251
|
+
} | {
|
|
252
|
+
width: number;
|
|
253
|
+
height: "auto";
|
|
254
|
+
};
|
|
255
|
+
scripts: "refuse" | "sandboxed";
|
|
256
|
+
id?: string | undefined;
|
|
257
|
+
dir?: "auto" | "ltr" | "rtl" | undefined;
|
|
258
|
+
lang?: string | undefined;
|
|
259
|
+
print?: {
|
|
260
|
+
paper: "letter" | "legal" | "tabloid" | "a3" | "a4" | "a5" | "business-card-us" | "business-card-eu" | "business-card-square-us" | "business-card-slim-us" | "postcard-4x6" | "postcard-5x7" | "postcard-6x9" | "postcard-6x11" | "card-square-4in" | "half-letter" | "a6" | "dl" | "rack-card-4x9" | "rack-card-3.5x8.5" | "poster-12x18" | "poster-16x20" | "poster-18x24" | "poster-24x36" | "a2" | "a1" | "a0" | {
|
|
261
|
+
width: number;
|
|
262
|
+
height: number;
|
|
263
|
+
unit: "mm" | "in" | "pt";
|
|
264
|
+
};
|
|
265
|
+
orientation: "portrait" | "landscape";
|
|
266
|
+
bleed: number;
|
|
267
|
+
safe: number;
|
|
268
|
+
marks: boolean;
|
|
269
|
+
markColor: "black" | "registration";
|
|
270
|
+
margin?: {
|
|
271
|
+
top: number;
|
|
272
|
+
right: number;
|
|
273
|
+
bottom: number;
|
|
274
|
+
left: number;
|
|
275
|
+
} | undefined;
|
|
276
|
+
} | undefined;
|
|
277
|
+
printedPages?: {
|
|
278
|
+
parents: {
|
|
279
|
+
name: string;
|
|
280
|
+
basedOn?: string | undefined;
|
|
281
|
+
margin?: {
|
|
282
|
+
top: number;
|
|
283
|
+
bottom: number;
|
|
284
|
+
inner: number;
|
|
285
|
+
outer: number;
|
|
286
|
+
} | undefined;
|
|
287
|
+
head?: string | undefined;
|
|
288
|
+
foot?: string | undefined;
|
|
289
|
+
}[];
|
|
290
|
+
rules: {
|
|
291
|
+
last?: string | undefined;
|
|
292
|
+
verso?: string | undefined;
|
|
293
|
+
recto?: string | undefined;
|
|
294
|
+
first?: string | undefined;
|
|
295
|
+
every: string;
|
|
296
|
+
};
|
|
297
|
+
numbering?: "arabic" | "roman-lower" | "roman-upper" | "hebrew" | undefined;
|
|
298
|
+
} | undefined;
|
|
299
|
+
slots?: {
|
|
300
|
+
key: string;
|
|
301
|
+
label: string;
|
|
302
|
+
type: "text" | "image" | "phone" | "email" | "link" | "qr";
|
|
303
|
+
required: boolean;
|
|
304
|
+
overflow: "refuse" | "shrink" | "truncate" | "wrap";
|
|
305
|
+
placeholder?: string | undefined;
|
|
306
|
+
minSize?: number | undefined;
|
|
307
|
+
}[] | undefined;
|
|
308
|
+
fonts?: ({
|
|
309
|
+
app: string;
|
|
310
|
+
} | {
|
|
311
|
+
local: string;
|
|
312
|
+
fallback: string;
|
|
313
|
+
})[] | undefined;
|
|
314
|
+
};
|
|
315
|
+
id?: string | undefined;
|
|
316
|
+
name?: string | undefined;
|
|
317
|
+
}>>;
|
|
318
|
+
export type Cover = z.infer<typeof Cover>;
|
|
319
|
+
export type CoverInput = z.input<typeof Cover>;
|
|
320
|
+
export interface CoverDigestMaterial {
|
|
321
|
+
page: Page;
|
|
322
|
+
sheet: {
|
|
323
|
+
width: number;
|
|
324
|
+
height: number;
|
|
325
|
+
};
|
|
326
|
+
drawingVersion: number;
|
|
327
|
+
stamp: string;
|
|
328
|
+
fonts: readonly string[];
|
|
329
|
+
motifs: readonly Motif[];
|
|
330
|
+
}
|
|
331
|
+
export declare function digestCoverMaterial(material: CoverDigestMaterial): Promise<string>;
|
|
332
|
+
export declare function coverDigest(cover: Cover, inputs: {
|
|
333
|
+
stamp: string;
|
|
334
|
+
fonts?: readonly string[];
|
|
335
|
+
motifs?: readonly Motif[];
|
|
336
|
+
}): Promise<string>;
|
|
337
|
+
//#endregion
|