@segnavia/format 0.38.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 +2 -2
- package/dist/book-section.d.ts +171 -0
- package/dist/book-section.js +13 -2
- package/dist/book.d.ts +185 -43
- package/dist/book.js +18 -2
- 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/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 +23 -1756
- package/dist/index.js +29 -212
- package/dist/json-schemas.d.ts +1860 -0
- package/dist/json-schemas.js +43 -0
- package/dist/media.d.ts +152 -0
- package/dist/media.js +119 -0
- package/dist/note-series.d.ts +4 -4
- package/dist/note-series.js +0 -5
- package/dist/page.d.ts +174 -0
- package/dist/page.js +37 -0
- package/dist/paper.d.ts +1 -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/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/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
|
package/dist/cover.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { sheetMm } from "./paper.js";
|
|
2
|
+
import { Print } from "./print.js";
|
|
3
|
+
import { Page } from "./page.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/cover.ts
|
|
6
|
+
const COVER_SHEET = {
|
|
7
|
+
width: 160,
|
|
8
|
+
height: 100
|
|
9
|
+
};
|
|
10
|
+
const COVER_DRAWING_VERSION = 1;
|
|
11
|
+
const COVER_PRINT = {
|
|
12
|
+
paper: {
|
|
13
|
+
width: COVER_SHEET.width,
|
|
14
|
+
height: COVER_SHEET.height,
|
|
15
|
+
unit: "mm"
|
|
16
|
+
},
|
|
17
|
+
orientation: "landscape"
|
|
18
|
+
};
|
|
19
|
+
const Cover = z.object({
|
|
20
|
+
page: Page,
|
|
21
|
+
id: z.string().optional(),
|
|
22
|
+
name: z.string().optional()
|
|
23
|
+
}).transform((cover) => ({
|
|
24
|
+
...cover,
|
|
25
|
+
page: {
|
|
26
|
+
...cover.page,
|
|
27
|
+
print: cover.page.print ?? Print.parse(COVER_PRINT)
|
|
28
|
+
}
|
|
29
|
+
})).superRefine((cover, ctx) => {
|
|
30
|
+
const print = cover.page.print;
|
|
31
|
+
if (print.bleed !== 0) ctx.addIssue({
|
|
32
|
+
code: "custom",
|
|
33
|
+
path: [
|
|
34
|
+
"page",
|
|
35
|
+
"print",
|
|
36
|
+
"bleed"
|
|
37
|
+
],
|
|
38
|
+
message: "page.print.bleed must be 0; remove bleed from the cover"
|
|
39
|
+
});
|
|
40
|
+
if (print.safe !== 0) ctx.addIssue({
|
|
41
|
+
code: "custom",
|
|
42
|
+
path: [
|
|
43
|
+
"page",
|
|
44
|
+
"print",
|
|
45
|
+
"safe"
|
|
46
|
+
],
|
|
47
|
+
message: "page.print.safe must be 0; remove the safe area from the cover"
|
|
48
|
+
});
|
|
49
|
+
if (print.marks) ctx.addIssue({
|
|
50
|
+
code: "custom",
|
|
51
|
+
path: [
|
|
52
|
+
"page",
|
|
53
|
+
"print",
|
|
54
|
+
"marks"
|
|
55
|
+
],
|
|
56
|
+
message: "page.print.marks must be false; remove marks from the cover"
|
|
57
|
+
});
|
|
58
|
+
if (cover.page.scripts !== "refuse") ctx.addIssue({
|
|
59
|
+
code: "custom",
|
|
60
|
+
path: ["page", "scripts"],
|
|
61
|
+
message: "page.scripts must be 'refuse'; refuse scripts on the cover"
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
function canonicalValue(value) {
|
|
65
|
+
if (Array.isArray(value)) return value.filter((item) => item !== void 0).map(canonicalValue);
|
|
66
|
+
if (value === null || typeof value !== "object") return value;
|
|
67
|
+
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0).sort(([left], [right]) => compareText(left, right)).map(([key, entry]) => [key, canonicalValue(entry)]));
|
|
68
|
+
}
|
|
69
|
+
function compareText(left, right) {
|
|
70
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
71
|
+
}
|
|
72
|
+
function canonicalJson(value) {
|
|
73
|
+
return JSON.stringify(canonicalValue(value));
|
|
74
|
+
}
|
|
75
|
+
function orderedMotifs(motifs) {
|
|
76
|
+
return [...motifs].sort((left, right) => compareText(left.key, right.key) || compareText(left.revision, right.revision) || compareText(canonicalJson(left), canonicalJson(right)));
|
|
77
|
+
}
|
|
78
|
+
async function digestCoverMaterial(material) {
|
|
79
|
+
const { id: _pageId, ...page } = material.page;
|
|
80
|
+
const canonical = canonicalJson({
|
|
81
|
+
...material,
|
|
82
|
+
page,
|
|
83
|
+
fonts: [...material.fonts].sort(),
|
|
84
|
+
motifs: orderedMotifs(material.motifs)
|
|
85
|
+
});
|
|
86
|
+
const digest = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(canonical));
|
|
87
|
+
return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
88
|
+
}
|
|
89
|
+
function coverDigest(cover, inputs) {
|
|
90
|
+
return digestCoverMaterial({
|
|
91
|
+
page: cover.page,
|
|
92
|
+
sheet: sheetMm(cover.page.print),
|
|
93
|
+
drawingVersion: 1,
|
|
94
|
+
stamp: inputs.stamp,
|
|
95
|
+
fonts: inputs.fonts ?? [],
|
|
96
|
+
motifs: inputs.motifs ?? []
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { COVER_DRAWING_VERSION, COVER_SHEET, Cover, coverDigest, digestCoverMaterial };
|
|
@@ -88,6 +88,25 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
|
|
|
88
88
|
alt: string;
|
|
89
89
|
fit?: "width" | "contain" | "cover" | "focus" | undefined;
|
|
90
90
|
frame?: boolean | undefined;
|
|
91
|
+
} | {
|
|
92
|
+
media: {
|
|
93
|
+
kind: "deck" | "page" | "paper" | "book" | "media" | "shot";
|
|
94
|
+
address: string;
|
|
95
|
+
page?: string | number | undefined;
|
|
96
|
+
box?: "media" | "bleed" | "crop" | "trim" | "art" | undefined;
|
|
97
|
+
crop?: {
|
|
98
|
+
top?: string | undefined;
|
|
99
|
+
right?: string | undefined;
|
|
100
|
+
bottom?: string | undefined;
|
|
101
|
+
left?: string | undefined;
|
|
102
|
+
} | undefined;
|
|
103
|
+
fit?: "width" | "contain" | "cover" | "focus" | undefined;
|
|
104
|
+
alt?: {
|
|
105
|
+
text: string;
|
|
106
|
+
lang?: string | undefined;
|
|
107
|
+
dir?: "auto" | "ltr" | "rtl" | undefined;
|
|
108
|
+
} | undefined;
|
|
109
|
+
};
|
|
91
110
|
};
|
|
92
111
|
notes?: string | undefined;
|
|
93
112
|
narration?: {
|
|
@@ -106,7 +125,7 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
|
|
|
106
125
|
untilWord?: number | undefined;
|
|
107
126
|
}[];
|
|
108
127
|
lang?: string | undefined;
|
|
109
|
-
dir?: "
|
|
128
|
+
dir?: "auto" | "ltr" | "rtl" | undefined;
|
|
110
129
|
voice?: string | undefined;
|
|
111
130
|
} | undefined;
|
|
112
131
|
beforeMs?: number | undefined;
|
|
@@ -114,18 +133,18 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
|
|
|
114
133
|
holdMs?: number | undefined;
|
|
115
134
|
printAtMs?: number | undefined;
|
|
116
135
|
}[];
|
|
117
|
-
dir?: "
|
|
136
|
+
dir?: "auto" | "ltr" | "rtl" | undefined;
|
|
118
137
|
lang?: string | undefined;
|
|
119
138
|
transition?: {
|
|
120
139
|
kind: "none" | "fade" | "slide";
|
|
121
140
|
duration: number;
|
|
122
141
|
} | undefined;
|
|
123
|
-
playback?: "
|
|
142
|
+
playback?: "segmented" | "continuous" | undefined;
|
|
124
143
|
captions?: "on" | "off" | "viewer" | undefined;
|
|
125
144
|
slots?: {
|
|
126
145
|
key: string;
|
|
127
146
|
label: string;
|
|
128
|
-
type: "text" | "
|
|
147
|
+
type: "text" | "image" | "phone" | "email" | "link" | "qr";
|
|
129
148
|
required: boolean;
|
|
130
149
|
overflow: "refuse" | "shrink" | "truncate" | "wrap";
|
|
131
150
|
placeholder?: string | undefined;
|