postext 1.91.2 → 1.92.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/__tests__/exports.test.js +92 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/paint/cropMarks.test.js +31 -0
- package/dist/__tests__/paint/cropMarks.test.js.map +1 -1
- package/dist/__tests__/pipeline/pages/reliefPlates.test.d.ts +2 -0
- package/dist/__tests__/pipeline/pages/reliefPlates.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/pages/reliefPlates.test.js +92 -0
- package/dist/__tests__/pipeline/pages/reliefPlates.test.js.map +1 -0
- package/dist/__tests__/production/compose.test.d.ts +2 -0
- package/dist/__tests__/production/compose.test.d.ts.map +1 -0
- package/dist/__tests__/production/compose.test.js +177 -0
- package/dist/__tests__/production/compose.test.js.map +1 -0
- package/dist/__tests__/production/config.test.d.ts +2 -0
- package/dist/__tests__/production/config.test.d.ts.map +1 -0
- package/dist/__tests__/production/config.test.js +83 -0
- package/dist/__tests__/production/config.test.js.map +1 -0
- package/dist/__tests__/production/cover.test.d.ts +2 -0
- package/dist/__tests__/production/cover.test.d.ts.map +1 -0
- package/dist/__tests__/production/cover.test.js +273 -0
- package/dist/__tests__/production/cover.test.js.map +1 -0
- package/dist/__tests__/production/coverLayers.test.d.ts +2 -0
- package/dist/__tests__/production/coverLayers.test.d.ts.map +1 -0
- package/dist/__tests__/production/coverLayers.test.js +198 -0
- package/dist/__tests__/production/coverLayers.test.js.map +1 -0
- package/dist/__tests__/production/coverOutputs.test.d.ts +2 -0
- package/dist/__tests__/production/coverOutputs.test.d.ts.map +1 -0
- package/dist/__tests__/production/coverOutputs.test.js +104 -0
- package/dist/__tests__/production/coverOutputs.test.js.map +1 -0
- package/dist/__tests__/production/geometry.test.d.ts +2 -0
- package/dist/__tests__/production/geometry.test.d.ts.map +1 -0
- package/dist/__tests__/production/geometry.test.js +281 -0
- package/dist/__tests__/production/geometry.test.js.map +1 -0
- package/dist/__tests__/production/mirrorBleed.test.d.ts +2 -0
- package/dist/__tests__/production/mirrorBleed.test.d.ts.map +1 -0
- package/dist/__tests__/production/mirrorBleed.test.js +129 -0
- package/dist/__tests__/production/mirrorBleed.test.js.map +1 -0
- package/dist/__tests__/production/shapes.test.d.ts +2 -0
- package/dist/__tests__/production/shapes.test.d.ts.map +1 -0
- package/dist/__tests__/production/shapes.test.js +107 -0
- package/dist/__tests__/production/shapes.test.js.map +1 -0
- package/dist/__tests__/production/sheets.test.d.ts +2 -0
- package/dist/__tests__/production/sheets.test.d.ts.map +1 -0
- package/dist/__tests__/production/sheets.test.js +153 -0
- package/dist/__tests__/production/sheets.test.js.map +1 -0
- package/dist/bundle/api.d.ts +8 -0
- package/dist/bundle/api.d.ts.map +1 -1
- package/dist/bundle/api.js +3 -0
- package/dist/bundle/api.js.map +1 -1
- package/dist/bundle/codec/files.d.ts.map +1 -1
- package/dist/bundle/codec/files.js +2 -0
- package/dist/bundle/codec/files.js.map +1 -1
- package/dist/bundle/codec/plan.d.ts +12 -0
- package/dist/bundle/codec/plan.d.ts.map +1 -1
- package/dist/bundle/codec/plan.js +12 -1
- package/dist/bundle/codec/plan.js.map +1 -1
- package/dist/bundle/codec/read.d.ts +3 -0
- package/dist/bundle/codec/read.d.ts.map +1 -1
- package/dist/bundle/codec/read.js +14 -2
- package/dist/bundle/codec/read.js.map +1 -1
- package/dist/bundle/index.d.ts +1 -1
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/index.js.map +1 -1
- package/dist/bundle/manifest/locale.d.ts +3 -0
- package/dist/bundle/manifest/locale.d.ts.map +1 -1
- package/dist/bundle/manifest/locale.js +5 -0
- package/dist/bundle/manifest/locale.js.map +1 -1
- package/dist/bundle/manifest/validation.d.ts.map +1 -1
- package/dist/bundle/manifest/validation.js +4 -0
- package/dist/bundle/manifest/validation.js.map +1 -1
- package/dist/bundle/manifest.d.ts +1 -1
- package/dist/bundle/manifest.d.ts.map +1 -1
- package/dist/bundle/manifest.js +1 -1
- package/dist/bundle/manifest.js.map +1 -1
- package/dist/bundle/types.d.ts +7 -0
- package/dist/bundle/types.d.ts.map +1 -1
- package/dist/checks/configWarnings/collect.d.ts +6 -1
- package/dist/checks/configWarnings/collect.d.ts.map +1 -1
- package/dist/checks/configWarnings/collect.js +9 -1
- package/dist/checks/configWarnings/collect.js.map +1 -1
- package/dist/checks/configWarnings/cover.d.ts +17 -0
- package/dist/checks/configWarnings/cover.d.ts.map +1 -0
- package/dist/checks/configWarnings/cover.js +146 -0
- package/dist/checks/configWarnings/cover.js.map +1 -0
- package/dist/checks/configWarnings/production.d.ts +12 -0
- package/dist/checks/configWarnings/production.d.ts.map +1 -0
- package/dist/checks/configWarnings/production.js +48 -0
- package/dist/checks/configWarnings/production.js.map +1 -0
- package/dist/checks/preflight.d.ts.map +1 -1
- package/dist/checks/preflight.js +5 -0
- package/dist/checks/preflight.js.map +1 -1
- package/dist/checks/preflightFolds.d.ts +19 -0
- package/dist/checks/preflightFolds.d.ts.map +1 -0
- package/dist/checks/preflightFolds.js +81 -0
- package/dist/checks/preflightFolds.js.map +1 -0
- package/dist/checks/preflightIssues.d.ts +24 -0
- package/dist/checks/preflightIssues.d.ts.map +1 -1
- package/dist/composed/paint.d.ts +2 -1
- package/dist/composed/paint.d.ts.map +1 -1
- package/dist/composed/paint.js +3 -2
- package/dist/composed/paint.js.map +1 -1
- package/dist/defaults/bookKeys.d.ts +2 -2
- package/dist/defaults/bookKeys.d.ts.map +1 -1
- package/dist/defaults/bookKeys.js +2 -2
- package/dist/defaults/bookKeys.js.map +1 -1
- package/dist/defaults/index.d.ts +1 -1
- package/dist/defaults/index.d.ts.map +1 -1
- package/dist/defaults/index.js +1 -1
- package/dist/defaults/index.js.map +1 -1
- package/dist/defaults/output/folio.d.ts +6 -1
- package/dist/defaults/output/folio.d.ts.map +1 -1
- package/dist/defaults/output/folio.js +10 -0
- package/dist/defaults/output/folio.js.map +1 -1
- package/dist/defaults/output/production.d.ts +12 -0
- package/dist/defaults/output/production.d.ts.map +1 -0
- package/dist/defaults/output/production.js +83 -0
- package/dist/defaults/output/production.js.map +1 -0
- package/dist/defaults/page.d.ts.map +1 -1
- package/dist/defaults/page.js +4 -1
- package/dist/defaults/page.js.map +1 -1
- package/dist/defaults/structure/headerFooter/resolve.d.ts.map +1 -1
- package/dist/defaults/structure/headerFooter/resolve.js +1 -0
- package/dist/defaults/structure/headerFooter/resolve.js.map +1 -1
- package/dist/design/elementKeys.d.ts +6 -0
- package/dist/design/elementKeys.d.ts.map +1 -1
- package/dist/design/elementKeys.js +5 -5
- package/dist/design/elementKeys.js.map +1 -1
- package/dist/designs/parts.d.ts +2 -1
- package/dist/designs/parts.d.ts.map +1 -1
- package/dist/designs/parts.js +2 -1
- package/dist/designs/parts.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/paint/cropMarks.d.ts +2 -1
- package/dist/paint/cropMarks.d.ts.map +1 -1
- package/dist/paint/cropMarks.js +7 -1
- package/dist/paint/cropMarks.js.map +1 -1
- package/dist/pipeline/config.d.ts.map +1 -1
- package/dist/pipeline/config.js +9 -2
- package/dist/pipeline/config.js.map +1 -1
- package/dist/pipeline/pages/dieCuts.d.ts +2 -1
- package/dist/pipeline/pages/dieCuts.d.ts.map +1 -1
- package/dist/pipeline/pages/dieCuts.js +18 -2
- package/dist/pipeline/pages/dieCuts.js.map +1 -1
- package/dist/pipeline/pages/headerFooter/pageDecoration.d.ts.map +1 -1
- package/dist/pipeline/pages/headerFooter/pageDecoration.js +8 -3
- package/dist/pipeline/pages/headerFooter/pageDecoration.js.map +1 -1
- package/dist/pipeline/pages/headerFooter/slotLayout.d.ts +3 -2
- package/dist/pipeline/pages/headerFooter/slotLayout.d.ts.map +1 -1
- package/dist/pipeline/pages/headerFooter/slotLayout.js +1 -1
- package/dist/pipeline/pages/headerFooter/slotLayout.js.map +1 -1
- package/dist/production/barcodeSvg.d.ts +28 -0
- package/dist/production/barcodeSvg.d.ts.map +1 -0
- package/dist/production/barcodeSvg.js +64 -0
- package/dist/production/barcodeSvg.js.map +1 -0
- package/dist/production/buildCover.d.ts +104 -0
- package/dist/production/buildCover.d.ts.map +1 -0
- package/dist/production/buildCover.js +169 -0
- package/dist/production/buildCover.js.map +1 -0
- package/dist/production/catalogue.d.ts +40 -0
- package/dist/production/catalogue.d.ts.map +1 -0
- package/dist/production/catalogue.js +106 -0
- package/dist/production/catalogue.js.map +1 -0
- package/dist/production/compose.d.ts +120 -0
- package/dist/production/compose.d.ts.map +1 -0
- package/dist/production/compose.js +288 -0
- package/dist/production/compose.js.map +1 -0
- package/dist/production/config.d.ts +15 -0
- package/dist/production/config.d.ts.map +1 -0
- package/dist/production/config.js +143 -0
- package/dist/production/config.js.map +1 -0
- package/dist/production/coverArt.d.ts +74 -0
- package/dist/production/coverArt.d.ts.map +1 -0
- package/dist/production/coverArt.js +355 -0
- package/dist/production/coverArt.js.map +1 -0
- package/dist/production/coverDesign.d.ts +22 -0
- package/dist/production/coverDesign.d.ts.map +1 -0
- package/dist/production/coverDesign.js +111 -0
- package/dist/production/coverDesign.js.map +1 -0
- package/dist/production/coverLabels.d.ts +8 -0
- package/dist/production/coverLabels.d.ts.map +1 -0
- package/dist/production/coverLabels.js +23 -0
- package/dist/production/coverLabels.js.map +1 -0
- package/dist/production/coverSource.d.ts +79 -0
- package/dist/production/coverSource.d.ts.map +1 -0
- package/dist/production/coverSource.js +142 -0
- package/dist/production/coverSource.js.map +1 -0
- package/dist/production/exchange.d.ts +38 -0
- package/dist/production/exchange.d.ts.map +1 -0
- package/dist/production/exchange.js +146 -0
- package/dist/production/exchange.js.map +1 -0
- package/dist/production/folio.d.ts +21 -0
- package/dist/production/folio.d.ts.map +1 -0
- package/dist/production/folio.js +35 -0
- package/dist/production/folio.js.map +1 -0
- package/dist/production/geometry.d.ts +84 -0
- package/dist/production/geometry.d.ts.map +1 -0
- package/dist/production/geometry.js +220 -0
- package/dist/production/geometry.js.map +1 -0
- package/dist/production/guards.d.ts +6 -0
- package/dist/production/guards.d.ts.map +1 -0
- package/dist/production/guards.js +6 -0
- package/dist/production/guards.js.map +1 -0
- package/dist/production/index.d.ts +25 -0
- package/dist/production/index.d.ts.map +1 -0
- package/dist/production/index.js +19 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/isbn.d.ts +67 -0
- package/dist/production/isbn.d.ts.map +1 -0
- package/dist/production/isbn.js +135 -0
- package/dist/production/isbn.js.map +1 -0
- package/dist/production/measures.d.ts +30 -0
- package/dist/production/measures.d.ts.map +1 -0
- package/dist/production/measures.js +54 -0
- package/dist/production/measures.js.map +1 -0
- package/dist/production/mirrorBleed.d.ts +54 -0
- package/dist/production/mirrorBleed.d.ts.map +1 -0
- package/dist/production/mirrorBleed.js +92 -0
- package/dist/production/mirrorBleed.js.map +1 -0
- package/dist/production/shapes.d.ts +65 -0
- package/dist/production/shapes.d.ts.map +1 -0
- package/dist/production/shapes.js +313 -0
- package/dist/production/shapes.js.map +1 -0
- package/dist/production/spine.d.ts +38 -0
- package/dist/production/spine.d.ts.map +1 -0
- package/dist/production/spine.js +48 -0
- package/dist/production/spine.js.map +1 -0
- package/dist/production/svgSafe.d.ts +25 -0
- package/dist/production/svgSafe.d.ts.map +1 -0
- package/dist/production/svgSafe.js +33 -0
- package/dist/production/svgSafe.js.map +1 -0
- package/dist/production/version.d.ts +66 -0
- package/dist/production/version.d.ts.map +1 -0
- package/dist/production/version.js +68 -0
- package/dist/production/version.js.map +1 -0
- package/dist/types/config.d.ts +12 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/designCut.d.ts +13 -1
- package/dist/types/designCut.d.ts.map +1 -1
- package/dist/types/designElements.d.ts +15 -0
- package/dist/types/designElements.d.ts.map +1 -1
- package/dist/types/output/cover.d.ts +230 -0
- package/dist/types/output/cover.d.ts.map +1 -0
- package/dist/types/output/cover.js +2 -0
- package/dist/types/output/cover.js.map +1 -0
- package/dist/types/output/production.d.ts +186 -0
- package/dist/types/output/production.d.ts.map +1 -0
- package/dist/types/output/production.js +2 -0
- package/dist/types/output/production.js.map +1 -0
- package/dist/types/page.d.ts +5 -0
- package/dist/types/page.d.ts.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/util/base64.d.ts +3 -0
- package/dist/util/base64.d.ts.map +1 -0
- package/dist/util/base64.js +48 -0
- package/dist/util/base64.js.map +1 -0
- package/dist/util/png.d.ts +10 -0
- package/dist/util/png.d.ts.map +1 -0
- package/dist/util/png.js +60 -0
- package/dist/util/png.js.map +1 -0
- package/dist/util/xmlEscape.d.ts +6 -0
- package/dist/util/xmlEscape.d.ts.map +1 -0
- package/dist/util/xmlEscape.js +15 -0
- package/dist/util/xmlEscape.js.map +1 -0
- package/dist/vdt/design.d.ts +10 -1
- package/dist/vdt/design.d.ts.map +1 -1
- package/dist/vdt/design.js.map +1 -1
- package/dist/vdt/pages.d.ts +13 -0
- package/dist/vdt/pages.d.ts.map +1 -1
- package/dist/vdt.d.ts +1 -1
- package/dist/vdt.d.ts.map +1 -1
- package/dist/word/anchors/base64.d.ts +1 -2
- package/dist/word/anchors/base64.d.ts.map +1 -1
- package/dist/word/anchors/base64.js +2 -46
- package/dist/word/anchors/base64.js.map +1 -1
- package/dist/word/semantic/design/ground.d.ts.map +1 -1
- package/dist/word/semantic/design/ground.js +5 -47
- package/dist/word/semantic/design/ground.js.map +1 -1
- package/dist/word/xml.d.ts +1 -4
- package/dist/word/xml.d.ts.map +1 -1
- package/dist/word/xml.js +1 -13
- package/dist/word/xml.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import type { ColorValue, InkSheen } from '../page.js';
|
|
2
|
+
/** The zones of a production sheet (#1655), left to right: what each part
|
|
3
|
+
* of the sheet becomes once it is folded and bound. */
|
|
4
|
+
export type CoverZoneName = 'flapBack' | 'back' | 'jointBack' | 'spine' | 'jointFront' | 'front' | 'flapFront' | 'pastedown' | 'flyleaf' | 'hinge';
|
|
5
|
+
/** A rectangle on a sheet, mm from its corner (bleed included). */
|
|
6
|
+
export interface SheetRect {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
export interface CoverPoint {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
}
|
|
16
|
+
/** A node of a path: where it is, and the handles of the curve that comes
|
|
17
|
+
* into it and of the one that leaves it (absent: a straight side). */
|
|
18
|
+
export interface CoverPathNode extends CoverPoint {
|
|
19
|
+
in?: CoverPoint;
|
|
20
|
+
out?: CoverPoint;
|
|
21
|
+
}
|
|
22
|
+
/** Paths of nodes in fractions of the box (0, 0 its top-left corner; 1, 1
|
|
23
|
+
* its bottom-right), so the shape stretches with the box; a closed one
|
|
24
|
+
* joins its last node to its first. */
|
|
25
|
+
export type CoverPath = {
|
|
26
|
+
nodes: CoverPathNode[];
|
|
27
|
+
closed: boolean;
|
|
28
|
+
}[];
|
|
29
|
+
/** An outline: closed polygons, their points in fractions of the box they
|
|
30
|
+
* are laid in. Traced from a picture, it keeps its shape for a veil or a
|
|
31
|
+
* finish. */
|
|
32
|
+
export type CoverOutline = CoverPoint[][];
|
|
33
|
+
/** The effects of a box or a shape that a page's own box style cannot
|
|
34
|
+
* draw. A gradient or a shadow makes the element a picture of its own. */
|
|
35
|
+
export interface CoverEffects {
|
|
36
|
+
/** A box's corners, rounded to this radius, mm. */
|
|
37
|
+
radius?: number;
|
|
38
|
+
/** A border round it: its colour and width, mm. */
|
|
39
|
+
stroke?: {
|
|
40
|
+
color: ColorValue;
|
|
41
|
+
width: number;
|
|
42
|
+
};
|
|
43
|
+
/** A gradient from the element's colour to `to`, at `angle` degrees
|
|
44
|
+
* (0: left to right; 90: top to bottom). */
|
|
45
|
+
gradient?: {
|
|
46
|
+
to: ColorValue;
|
|
47
|
+
angle: number;
|
|
48
|
+
};
|
|
49
|
+
/** A soft shadow under it: its colour and opacity (0 … 1), how far it
|
|
50
|
+
* falls (mm, right and down) and how soft it is (mm). */
|
|
51
|
+
shadow?: {
|
|
52
|
+
color: ColorValue;
|
|
53
|
+
opacity: number;
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
blur: number;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Where an element stands: placed by the zone it stands in, so it moves
|
|
60
|
+
* with that zone when the spine grows or the binding changes. */
|
|
61
|
+
export interface CoverPlacement {
|
|
62
|
+
zone: CoverZoneName;
|
|
63
|
+
/** Its box, mm from the zone's top-left corner; it may run out of the
|
|
64
|
+
* zone, onto the sheet's other zones or into the bleed. */
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
width: number;
|
|
68
|
+
height: number;
|
|
69
|
+
/** The size of its zone when it was placed, mm. When the zone is
|
|
70
|
+
* another size now (the book's format changed, the spine grew), the
|
|
71
|
+
* element is scaled with it: a box or a shape on each axis, a picture
|
|
72
|
+
* evenly about where its centre falls, so it keeps its proportions.
|
|
73
|
+
* Absent: it stays as placed. */
|
|
74
|
+
basis?: {
|
|
75
|
+
width: number;
|
|
76
|
+
height: number;
|
|
77
|
+
};
|
|
78
|
+
/** A box or a shape that runs across zones (a band, a ground): its right
|
|
79
|
+
* edge, mm from the left of the zone it ends in, and that zone's width
|
|
80
|
+
* when it was placed. Each edge then follows its own zone. */
|
|
81
|
+
to?: {
|
|
82
|
+
zone: CoverZoneName;
|
|
83
|
+
x: number;
|
|
84
|
+
basis?: number;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** A movable element of a cover's design: a picture, a box of colour, a
|
|
88
|
+
* shape of colour, or the collection's catalogue (#1673): the pictures of
|
|
89
|
+
* its titles in a grid inside the box, the book's own outlined by
|
|
90
|
+
* `stroke`. */
|
|
91
|
+
export interface CoverElement extends CoverEffects, CoverPlacement {
|
|
92
|
+
/** Letters, digits, `-` and `_`. */
|
|
93
|
+
id: string;
|
|
94
|
+
kind: 'image' | 'box' | 'shape' | 'catalogue';
|
|
95
|
+
/** A catalogue's columns (default: every title in one row). */
|
|
96
|
+
columns?: number;
|
|
97
|
+
/** A catalogue's gap between its pictures, mm (default 3). */
|
|
98
|
+
gap?: number;
|
|
99
|
+
/** A catalogue's first and last titles, by their place in it from 1
|
|
100
|
+
* (default: all of them). */
|
|
101
|
+
first?: number;
|
|
102
|
+
last?: number;
|
|
103
|
+
/** A shape's outline, in its box (a traced one). */
|
|
104
|
+
outline?: CoverOutline;
|
|
105
|
+
/** A shape drawn by nodes, in its box; over `outline` when both are
|
|
106
|
+
* there. */
|
|
107
|
+
path?: CoverPath;
|
|
108
|
+
/** An image's picture: a bitmap or SVG resource of the book. */
|
|
109
|
+
resourceId?: string;
|
|
110
|
+
/** A box's or a shape's colour. */
|
|
111
|
+
color?: ColorValue;
|
|
112
|
+
/** Its opacity, 0 … 1 (default 1). A picture keeps its own
|
|
113
|
+
* transparency. */
|
|
114
|
+
opacity?: number;
|
|
115
|
+
/** How a picture fills its box: whole inside it (`contain`, the
|
|
116
|
+
* default), or covering it, cropped (`cover`). */
|
|
117
|
+
fit?: 'contain' | 'cover';
|
|
118
|
+
/** A picture cut to an outline (in fractions of its box): an
|
|
119
|
+
* illustration's own shape, a shine that shows only within it. The
|
|
120
|
+
* picture then fills the box, cropped to it. */
|
|
121
|
+
clip?: CoverOutline;
|
|
122
|
+
/** Past the design margin of a mirror bleed: `mirror` (the default)
|
|
123
|
+
* folds it out with the background; `own` paints the element as it is,
|
|
124
|
+
* over the fold. */
|
|
125
|
+
bleed?: 'mirror' | 'own';
|
|
126
|
+
}
|
|
127
|
+
/** A logo of the cover (the publisher's, the collection's, a seal): a
|
|
128
|
+
* picture placed as an element, over the effects, and the clear space
|
|
129
|
+
* (mm) nothing else should enter round it. */
|
|
130
|
+
export interface CoverLogo extends CoverElement {
|
|
131
|
+
kind: 'image';
|
|
132
|
+
clearance: number;
|
|
133
|
+
}
|
|
134
|
+
/** What a finish of the cover is: a varnish or a foil printed on a spot
|
|
135
|
+
* plate of its own (an ink with an `InkFinish`, #1563), or an emboss or a
|
|
136
|
+
* deboss, a relief die on a technical plate that prints nothing. */
|
|
137
|
+
export type CoverFinishProcess = 'varnish' | 'foil' | 'emboss' | 'deboss';
|
|
138
|
+
/** What a finish covers: a box of its own, placed like an element; the
|
|
139
|
+
* shape of an element, effect or logo of the design (a picture's contour
|
|
140
|
+
* when its resource has one); or a saved outline laid in a box of its
|
|
141
|
+
* own. */
|
|
142
|
+
export type CoverFinishShape = {
|
|
143
|
+
box: CoverPlacement;
|
|
144
|
+
} | {
|
|
145
|
+
element: string;
|
|
146
|
+
} | {
|
|
147
|
+
outline: CoverOutline;
|
|
148
|
+
box: CoverPlacement;
|
|
149
|
+
};
|
|
150
|
+
/** A finish of the cover. */
|
|
151
|
+
export interface CoverFinish {
|
|
152
|
+
/** Letters, digits, `-` and `_`. */
|
|
153
|
+
id: string;
|
|
154
|
+
process: CoverFinishProcess;
|
|
155
|
+
/** A varnish's or a foil's ink: a spot colour (`model: 'spot'`), a
|
|
156
|
+
* palette entry's when it names one. Its finish is set from `process`
|
|
157
|
+
* and `sheen`. Default: a varnish `Varnish`, a foil `Gold foil`. Not
|
|
158
|
+
* read for an emboss or a deboss. */
|
|
159
|
+
ink?: ColorValue;
|
|
160
|
+
/** Default `'gloss'`. Not read for an emboss or a deboss. */
|
|
161
|
+
sheen?: InkSheen;
|
|
162
|
+
shape: CoverFinishShape;
|
|
163
|
+
}
|
|
164
|
+
/** A text box of a cover: a frame the cover's Markdown fills by `name`
|
|
165
|
+
* (`:::frame{slot="name"}`), placed on `rect` (mm on the sheet, from its
|
|
166
|
+
* bleed's corner), its text laid along it or, with `rotate`, across it
|
|
167
|
+
* and turned a quarter about its centre (to read up the spine, −90, or
|
|
168
|
+
* down it, 90). */
|
|
169
|
+
export interface CoverTextFrame {
|
|
170
|
+
/** Letters, digits, `-` and `_`; not a zone's name. */
|
|
171
|
+
name: string;
|
|
172
|
+
rect: SheetRect;
|
|
173
|
+
rotate?: 90 | -90;
|
|
174
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The design of a book's covers (#1667), shared by every version of the
|
|
178
|
+
* book and by the books of a collection: a ground for the whole sheet, a
|
|
179
|
+
* picture over it and a ground per zone; the movable elements under the
|
|
180
|
+
* text, the effects and logos over it; and the finishes. The text is the
|
|
181
|
+
* cover's Markdown, filled by zone (`:::frame{slot="back"}`); the front
|
|
182
|
+
* and spine the Markdown leaves empty take the book's title, subtitle and
|
|
183
|
+
* author, set in the paragraph styles `cover-title`, `cover-subtitle`,
|
|
184
|
+
* `cover-author` and `cover-spine`.
|
|
185
|
+
*/
|
|
186
|
+
export interface CoverConfig {
|
|
187
|
+
background?: ColorValue;
|
|
188
|
+
/** A bitmap or SVG resource of the book, filling the whole sheet or
|
|
189
|
+
* only the front cover, cropped to cover it about `focus`. */
|
|
190
|
+
image?: {
|
|
191
|
+
resourceId: string;
|
|
192
|
+
area?: 'sheet' | 'front';
|
|
193
|
+
focus?: {
|
|
194
|
+
x: number;
|
|
195
|
+
y: number;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
/** A ground per zone, over the sheet's and its picture. */
|
|
199
|
+
zones?: Partial<Record<CoverZoneName, ColorValue>>;
|
|
200
|
+
/** The movable elements, back to front, over the grounds and under the
|
|
201
|
+
* text. */
|
|
202
|
+
elements?: CoverElement[];
|
|
203
|
+
/** Effects over the text, back to front: a translucent box, a picture
|
|
204
|
+
* with transparency of its own. */
|
|
205
|
+
effects?: CoverElement[];
|
|
206
|
+
logos?: CoverLogo[];
|
|
207
|
+
finishes?: CoverFinish[];
|
|
208
|
+
/** Text boxes placed by hand, each a frame of its own over the zones'. */
|
|
209
|
+
textBoxes?: CoverTextFrame[];
|
|
210
|
+
/** Where each zone's text sits in it. Default `'top'`; the spine's is
|
|
211
|
+
* always centred across it. */
|
|
212
|
+
verticalAlign?: Partial<Record<CoverZoneName, 'top' | 'middle' | 'bottom'>>;
|
|
213
|
+
/** Mirror bleed: the design is drawn this far past the trim, mm (2 at
|
|
214
|
+
* the least), and beyond it the background and the movable elements
|
|
215
|
+
* are mirrored out to the sheet's edge. Unset: no mirroring. */
|
|
216
|
+
mirrorMargin?: number;
|
|
217
|
+
/** The barcode's size against nominal, 0.8 … 2. Default 1. */
|
|
218
|
+
barcodeMagnification?: number;
|
|
219
|
+
/** A design of their own for a hardcover's sheets (#1673), each used in
|
|
220
|
+
* place of this one on its sheet: the case under a jacket, the jacket,
|
|
221
|
+
* both endpapers or one of them (`endpaperFront`, `endpaperBack`, over
|
|
222
|
+
* `endpapers`). A sheet without one takes this design. */
|
|
223
|
+
sheets?: Partial<Record<CoverSheetName, CoverSheetDesign>>;
|
|
224
|
+
}
|
|
225
|
+
/** The sheets of a version a design or a frame of the cover's text may
|
|
226
|
+
* name: `cover` is the cover of a softcover or the covering of a case. */
|
|
227
|
+
export type CoverSheetName = 'cover' | 'case' | 'jacket' | 'endpapers' | 'endpaperFront' | 'endpaperBack';
|
|
228
|
+
/** The design of one sheet: a cover design without sheets of its own. */
|
|
229
|
+
export type CoverSheetDesign = Omit<CoverConfig, 'sheets'>;
|
|
230
|
+
//# sourceMappingURL=cover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cover.d.ts","sourceRoot":"","sources":["../../../src/types/output/cover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEvD;wDACwD;AACxD,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,MAAM,GACN,WAAW,GACX,OAAO,GACP,YAAY,GACZ,OAAO,GACP,WAAW,GACX,WAAW,GACX,SAAS,GACT,OAAO,CAAC;AAEZ,mEAAmE;AACnE,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AQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B;wCACoC;IACpC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B;oCACgC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;IAC5E;;qEAEiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;+DAG2D;IAC3D,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,CAAC;CAC5D;AAED;2EAC2E;AAC3E,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,eAAe,GAAG,cAAc,CAAC;AAE1G,yEAAyE;AACzE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cover.js","sourceRoot":"","sources":["../../../src/types/output/cover.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { FolioPaperConfig } from './folio.js';
|
|
2
|
+
/** A measure of a binding profile, in millimetres, written so that one
|
|
3
|
+
* profile serves every trim:
|
|
4
|
+
* - a number: the same for any trim (a 3 mm square);
|
|
5
|
+
* - steps: the first whose `upTo` trim the book fits in, the last one
|
|
6
|
+
* (without `upTo`) for anything larger (board that the printer thickens
|
|
7
|
+
* on big books);
|
|
8
|
+
* - a ratio of the trim width or height, within `min` and `max` (flaps). */
|
|
9
|
+
export type ProductionLength = number | ProductionLengthStep[] | {
|
|
10
|
+
ratio: number;
|
|
11
|
+
of?: 'width' | 'height';
|
|
12
|
+
min?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
};
|
|
15
|
+
export interface ProductionLengthStep {
|
|
16
|
+
/** Trim this step covers, mm; a book fits when both sides are within. */
|
|
17
|
+
upTo?: {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
};
|
|
21
|
+
mm: number;
|
|
22
|
+
}
|
|
23
|
+
/** A trim size, mm. */
|
|
24
|
+
export interface TrimMm {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
}
|
|
28
|
+
/** A paper as a profile of the user's library: the stock Folio already
|
|
29
|
+
* knows (`type`, `grammage`, `bulk`, finish, shade…) with a name, and who
|
|
30
|
+
* sells it. */
|
|
31
|
+
export interface PaperProfile extends FolioPaperConfig {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
supplier?: string;
|
|
35
|
+
commercialName?: string;
|
|
36
|
+
}
|
|
37
|
+
/** How the cover is made: a softcover glued (`'perfect'`, PUR or hot
|
|
38
|
+
* melt) or sewn, or a case (hardcover) whose spine is flat or round. */
|
|
39
|
+
export type BindingStyle = 'perfect' | 'sewnSoftcover' | 'caseFlat' | 'caseRound';
|
|
40
|
+
/** The measures of a binding, every one a {@link ProductionLength}. Those of
|
|
41
|
+
* a softcover apply to a softcover, those of a case to a case; the jacket
|
|
42
|
+
* and the endpapers to whichever has them. */
|
|
43
|
+
export interface BindingMeasures {
|
|
44
|
+
/** Added to the thickness of the block for the spine: glue, sewing and,
|
|
45
|
+
* on a softcover, the cover board round it. */
|
|
46
|
+
spineAllowance: ProductionLength;
|
|
47
|
+
/** Softcover: bleed round the cover sheet. */
|
|
48
|
+
bleed: ProductionLength;
|
|
49
|
+
/** Softcover: distance of the hinge scores from each spine fold (0: the
|
|
50
|
+
* cover is only scored at the spine). */
|
|
51
|
+
hingeScore: ProductionLength;
|
|
52
|
+
/** Softcover: width of each flap. */
|
|
53
|
+
flapWidth: ProductionLength;
|
|
54
|
+
/** Softcover with flaps: how much narrower than the trim each cover
|
|
55
|
+
* panel is made, so the flap folds just inside the fore-edge. */
|
|
56
|
+
flapFoldInset: ProductionLength;
|
|
57
|
+
/** Case: board thickness. */
|
|
58
|
+
board: ProductionLength;
|
|
59
|
+
/** Case: how far the boards stand out from the block at head, foot and
|
|
60
|
+
* fore-edge (the square). */
|
|
61
|
+
square: ProductionLength;
|
|
62
|
+
/** Case: the joint (hinge gap) between each board and the spine. */
|
|
63
|
+
joint: ProductionLength;
|
|
64
|
+
/** Case: the cover material turned in round the boards. */
|
|
65
|
+
turnIn: ProductionLength;
|
|
66
|
+
/** Case: how much narrower than the trim each board is cut at the spine
|
|
67
|
+
* side, before the square is added at the fore-edge. */
|
|
68
|
+
boardSetback: ProductionLength;
|
|
69
|
+
/** Case: added to block + 2 × board for the width of the spine board. */
|
|
70
|
+
caseSpineAllowance: ProductionLength;
|
|
71
|
+
/** Round case: added to the flat case spine for the round. */
|
|
72
|
+
roundSpineAllowance: ProductionLength;
|
|
73
|
+
/** Jacket: extra width at each fore-edge fold, for the board it wraps. */
|
|
74
|
+
jacketFoldAllowance: ProductionLength;
|
|
75
|
+
/** Jacket: width of each flap. */
|
|
76
|
+
jacketFlapWidth: ProductionLength;
|
|
77
|
+
/** Jacket: bleed round the sheet. */
|
|
78
|
+
jacketBleed: ProductionLength;
|
|
79
|
+
/** Endpapers: glue strip along the fold, tipped onto the block. */
|
|
80
|
+
endpaperGlueStrip: ProductionLength;
|
|
81
|
+
/** Endpapers: bleed at head, foot and fore-edge (none at the fold). */
|
|
82
|
+
endpaperBleed: ProductionLength;
|
|
83
|
+
/** Safe zone kept clear inside each fold, score, joint and trim. */
|
|
84
|
+
safeMargin: ProductionLength;
|
|
85
|
+
/** How far past the trim the design is drawn, mm: beyond it, out to the
|
|
86
|
+
* end of the bleed or the turn-in, the background and the movable
|
|
87
|
+
* elements are mirrored (`coverPage`'s `mirrorMargin`). */
|
|
88
|
+
designMargin: ProductionLength;
|
|
89
|
+
}
|
|
90
|
+
/** What a binding profile can make; a book outside it gets a
|
|
91
|
+
* `profileOutOfRange` warning instead of a cover nobody can bind. */
|
|
92
|
+
export interface BindingAccepts {
|
|
93
|
+
trim?: {
|
|
94
|
+
min?: TrimMm;
|
|
95
|
+
max?: TrimMm;
|
|
96
|
+
};
|
|
97
|
+
spine?: {
|
|
98
|
+
min?: number;
|
|
99
|
+
max?: number;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** A binding as a profile of the user's library: a style, its measures
|
|
103
|
+
* (any left out take the defaults of the style) and its limits. */
|
|
104
|
+
export interface BindingProfile {
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
printer?: string;
|
|
108
|
+
style: BindingStyle;
|
|
109
|
+
/** Pages per signature: the page count is rounded up to it. */
|
|
110
|
+
signature?: number;
|
|
111
|
+
measures?: Partial<BindingMeasures>;
|
|
112
|
+
accepts?: BindingAccepts;
|
|
113
|
+
}
|
|
114
|
+
/** A version of the book as it is manufactured: a binding, its own ISBN
|
|
115
|
+
* and cover, over the same text block as the other versions (a paperback
|
|
116
|
+
* and a hardcover of one book). */
|
|
117
|
+
export interface ProductionVersion {
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
/** This version's ISBN: each binding has its own. */
|
|
121
|
+
isbn?: string;
|
|
122
|
+
/** Five-digit add-on printed after the barcode. In Spain it carries no
|
|
123
|
+
* price: the ISBN agency only allows it starting with 9, for the
|
|
124
|
+
* publisher's own use (90000: no price). */
|
|
125
|
+
isbnAddOn?: string;
|
|
126
|
+
/** The ISBN of the whole work, for a volume of a collection or of a work
|
|
127
|
+
* in several volumes: the barcode carries the volume's (`isbn`), and
|
|
128
|
+
* this one is printed as text beside it. */
|
|
129
|
+
workIsbn?: string;
|
|
130
|
+
/** A profile id of the library, or the profile itself. */
|
|
131
|
+
binding: string | BindingProfile;
|
|
132
|
+
/** Softcover: flaps; case: a dust jacket. */
|
|
133
|
+
flaps?: boolean;
|
|
134
|
+
/** Case: the cover printed and laminated over the boards, or cloth
|
|
135
|
+
* (stamped, usually under a jacket). Default `'printed'`. */
|
|
136
|
+
caseMaterial?: 'printed' | 'cloth';
|
|
137
|
+
/** Measures this version sets for itself, mm, over the profile's (the
|
|
138
|
+
* printer asks for a different joint on this one book). */
|
|
139
|
+
overrides?: Partial<Record<keyof BindingMeasures, number>>;
|
|
140
|
+
/** The spine as the printer gives it, mm: replaces the calculated one. */
|
|
141
|
+
spineOverride?: number;
|
|
142
|
+
/** How the spine is lettered: rising (`'bottomToTop'`, the usual way in
|
|
143
|
+
* Spain) or falling (`'topToBottom'`, ISO 6357), and the narrowest spine
|
|
144
|
+
* that takes text, mm. */
|
|
145
|
+
spineText?: {
|
|
146
|
+
direction?: 'bottomToTop' | 'topToBottom';
|
|
147
|
+
minSpine?: number;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/** The collection or multi-volume work a book belongs to: its own ISBN
|
|
151
|
+
* (printed as text next to the volume's), and its catalogue of
|
|
152
|
+
* advertisements for the endpapers. */
|
|
153
|
+
export interface ProductionCollection {
|
|
154
|
+
name: string;
|
|
155
|
+
/** The whole work's ISBN, printed beside the barcode of a version that
|
|
156
|
+
* names no `workIsbn` of its own. */
|
|
157
|
+
isbn?: string;
|
|
158
|
+
/** The collection's titles in order, each with an optional picture
|
|
159
|
+
* resource of the book: what `::catalogue` and a cover's `catalogue`
|
|
160
|
+
* element set on the endpapers. */
|
|
161
|
+
catalogue?: {
|
|
162
|
+
id: string;
|
|
163
|
+
title: string;
|
|
164
|
+
resource?: string;
|
|
165
|
+
}[];
|
|
166
|
+
/** The catalogue entry (`id`) that is this book: marked where the
|
|
167
|
+
* catalogue is set. */
|
|
168
|
+
volume?: string;
|
|
169
|
+
}
|
|
170
|
+
/** A book's print production (#1655, #1666): the versions it is published
|
|
171
|
+
* in, each with its binding and ISBN, the profiles they name, and the
|
|
172
|
+
* collection it belongs to. It belongs to the book, never to its design,
|
|
173
|
+
* and no layout reads it: the book block's paper is `folio.paper` and its
|
|
174
|
+
* pages' `:::paper` stocks. */
|
|
175
|
+
export interface ProductionConfig {
|
|
176
|
+
/** Each binding the book is published in, in order. */
|
|
177
|
+
versions?: ProductionVersion[];
|
|
178
|
+
/** Binding profiles the versions name, carried with the book so a bundle
|
|
179
|
+
* opened elsewhere finds them (the built-in ones need not be listed). */
|
|
180
|
+
bindings?: BindingProfile[];
|
|
181
|
+
/** Paper profiles the book was set up with, carried with it. */
|
|
182
|
+
papers?: PaperProfile[];
|
|
183
|
+
/** The collection or multi-volume work the book belongs to. */
|
|
184
|
+
collection?: ProductionCollection;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=production.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"production.d.ts","sourceRoot":"","sources":["../../../src/types/output/production.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;6EAM6E;AAC7E,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,oBAAoB,EAAE,GACtB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,MAAM,WAAW,oBAAoB;IACnC,yEAAyE;IACzE,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,uBAAuB;AACvB,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;gBAEgB;AAChB,MAAM,WAAW,YA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AAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9E;AAED;;wCAEwC;AACxC,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb;0CACsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;wCAEoC;IACpC,SAAS,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D;4BACwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;gCAIgC;AAChC,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC/B;8EAC0E;IAC1E,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;IAC5B,gEAAgE;IAChE,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,oBAAoB,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"production.js","sourceRoot":"","sources":["../../../src/types/output/production.ts"],"names":[],"mappings":""}
|
package/dist/types/page.d.ts
CHANGED
|
@@ -151,6 +151,10 @@ export interface CutLinesConfig {
|
|
|
151
151
|
* whatever its colour space, so they print on every plate. Default
|
|
152
152
|
* black. */
|
|
153
153
|
color?: ColorValue;
|
|
154
|
+
/** Where a cover sheet folds or is scored, measured from the left trim
|
|
155
|
+
* edge: a short mark above and below the sheet at each, outside the
|
|
156
|
+
* bleed, drawn as the crop marks are. Default none. */
|
|
157
|
+
foldMarks?: Dimension[];
|
|
154
158
|
}
|
|
155
159
|
/** How page numbers are written. */
|
|
156
160
|
export type PageNumberFormat = 'decimal' | 'lower-roman' | 'upper-roman' | 'lower-alpha' | 'upper-alpha' | EastAsianNumeralStyle | ArabicNumeralStyle;
|
|
@@ -222,6 +226,7 @@ export interface ResolvedPageConfig {
|
|
|
222
226
|
markOffset: Dimension;
|
|
223
227
|
markWidth: Dimension;
|
|
224
228
|
color: ColorValue;
|
|
229
|
+
foldMarks?: Dimension[];
|
|
225
230
|
};
|
|
226
231
|
baselineGrid: {
|
|
227
232
|
enabled: boolean;
|
package/dist/types/page.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/types/page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,+CAA+C;AAC/C,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAEjE;;;;gDAIgD;AAChD,MAAM,WAAW,SAAS;IACxB;;oCAEgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb;;yCAEqC;IACrC,IAAI,EAAE,WAAW,CAAC;IAClB;eACW;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;wBAGoB;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;yDAGqD;IACrD,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED;yCACyC;AACzC,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAEhG;8DAC8D;AAC9D,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAEtF;oBACoB;AACpB,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC;AAEjE;;;iEAGiE;AACjE,MAAM,WAAW,SAAS;IAC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C6D;IAC7D,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAED;;;wDAGwD;AACxD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,CAAC;AAEzE,mEAAmE;AACnE,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,aAAa,CAAC;AAE1D;;;;;;4BAM4B;AAC5B,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE/C;;;;;mBAKmB;AACnB,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAElE,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export type * from './types/text/lists.js';
|
|
|
23
23
|
export type * from './types/output/debug.js';
|
|
24
24
|
export type * from './types/output/viewers.js';
|
|
25
25
|
export type * from './types/output/folio.js';
|
|
26
|
+
export type * from './types/output/production.js';
|
|
27
|
+
export type * from './types/output/cover.js';
|
|
26
28
|
export type * from './types/text/math.js';
|
|
27
29
|
export type * from './types/structure/footnotes.js';
|
|
28
30
|
export type * from './types/structure/citations.js';
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,EAC/L,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAA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B,2BAA2B,CAAC;AAC/C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,mCAAmC,CAAC;AACvD,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,oCAAoC,CAAC;AACxD,mBAAmB,0BAA0B,CAAC;AAC9C,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src/util/base64.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAiBtD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAkBrD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Base64 for the Word export map and the pictures a cover makes of itself,
|
|
2
|
+
// without `btoa`/`atob` (absent in some Workers, limited to Latin-1 strings
|
|
3
|
+
// and slow on large inputs when spread through `String.fromCharCode`).
|
|
4
|
+
// Encodes in fixed chunks; decoding skips whitespace.
|
|
5
|
+
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
6
|
+
const LOOKUP = new Int16Array(128).fill(-1);
|
|
7
|
+
for (let i = 0; i < ALPHABET.length; i++)
|
|
8
|
+
LOOKUP[ALPHABET.charCodeAt(i)] = i;
|
|
9
|
+
const CHUNK = 3 * 4096;
|
|
10
|
+
export function base64Encode(bytes) {
|
|
11
|
+
const parts = [];
|
|
12
|
+
for (let start = 0; start < bytes.length; start += CHUNK) {
|
|
13
|
+
const end = Math.min(bytes.length, start + CHUNK);
|
|
14
|
+
let out = '';
|
|
15
|
+
for (let i = start; i < end; i += 3) {
|
|
16
|
+
const a = bytes[i];
|
|
17
|
+
const b = i + 1 < end ? bytes[i + 1] : 0;
|
|
18
|
+
const c = i + 2 < end ? bytes[i + 2] : 0;
|
|
19
|
+
const n = (a << 16) | (b << 8) | c;
|
|
20
|
+
out += ALPHABET[(n >> 18) & 63] + ALPHABET[(n >> 12) & 63];
|
|
21
|
+
out += i + 1 < end ? ALPHABET[(n >> 6) & 63] : '=';
|
|
22
|
+
out += i + 2 < end ? ALPHABET[n & 63] : '=';
|
|
23
|
+
}
|
|
24
|
+
parts.push(out);
|
|
25
|
+
}
|
|
26
|
+
return parts.join('');
|
|
27
|
+
}
|
|
28
|
+
export function base64Decode(text) {
|
|
29
|
+
const clean = text.replace(/[\s=]/g, '');
|
|
30
|
+
const out = new Uint8Array(Math.floor((clean.length * 3) / 4));
|
|
31
|
+
let o = 0;
|
|
32
|
+
let acc = 0;
|
|
33
|
+
let bits = 0;
|
|
34
|
+
for (let i = 0; i < clean.length; i++) {
|
|
35
|
+
const code = clean.charCodeAt(i);
|
|
36
|
+
const v = code < 128 ? LOOKUP[code] : -1;
|
|
37
|
+
if (v < 0)
|
|
38
|
+
throw new Error('base64Decode: invalid character');
|
|
39
|
+
acc = (acc << 6) | v;
|
|
40
|
+
bits += 6;
|
|
41
|
+
if (bits >= 8) {
|
|
42
|
+
bits -= 8;
|
|
43
|
+
out[o++] = (acc >> bits) & 0xff;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return o === out.length ? out : out.subarray(0, o);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=base64.js.map
|
|
@@ -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C,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAC9D,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,IAAI,CAAC,CAAC;QACV,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YACd,IAAI,IAAI,CAAC,CAAC;YACV,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC;QAClC,CAAC;IACH,CAAC;IACD,OAAO,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A PNG writer for the small pictures the engine makes of itself: a
|
|
3
|
+
* Word page's ground of one colour, a cover's gradient or shadow. Rows of
|
|
4
|
+
* 8-bit truecolour (RGB) or truecolour with alpha (RGBA) pixels, top to
|
|
5
|
+
* bottom, deflated by `fflate`.
|
|
6
|
+
*/
|
|
7
|
+
/** `width` × `height` pixels of `channels` bytes each (3: RGB, 4: RGBA),
|
|
8
|
+
* rows top to bottom, as a PNG. */
|
|
9
|
+
export declare function encodePng(width: number, height: number, pixels: Uint8Array, channels?: 3 | 4): Uint8Array;
|
|
10
|
+
//# sourceMappingURL=png.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../../src/util/png.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgCH;oCACoC;AACpC,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,GAAE,CAAC,GAAG,CAAK,GAAG,UAAU,CAoB5G"}
|
package/dist/util/png.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A PNG writer for the small pictures the engine makes of itself: a
|
|
3
|
+
* Word page's ground of one colour, a cover's gradient or shadow. Rows of
|
|
4
|
+
* 8-bit truecolour (RGB) or truecolour with alpha (RGBA) pixels, top to
|
|
5
|
+
* bottom, deflated by `fflate`.
|
|
6
|
+
*/
|
|
7
|
+
import { zlibSync } from 'fflate';
|
|
8
|
+
const CRC = (() => {
|
|
9
|
+
const t = new Uint32Array(256);
|
|
10
|
+
for (let n = 0; n < 256; n++) {
|
|
11
|
+
let c = n;
|
|
12
|
+
for (let k = 0; k < 8; k++)
|
|
13
|
+
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
14
|
+
t[n] = c >>> 0;
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
})();
|
|
18
|
+
function crc32(bytes) {
|
|
19
|
+
let c = 0xffffffff;
|
|
20
|
+
for (const b of bytes)
|
|
21
|
+
c = CRC[(c ^ b) & 0xff] ^ (c >>> 8);
|
|
22
|
+
return (c ^ 0xffffffff) >>> 0;
|
|
23
|
+
}
|
|
24
|
+
function chunk(type, data) {
|
|
25
|
+
const out = new Uint8Array(12 + data.length);
|
|
26
|
+
const view = new DataView(out.buffer);
|
|
27
|
+
view.setUint32(0, data.length);
|
|
28
|
+
for (let i = 0; i < 4; i++)
|
|
29
|
+
out[4 + i] = type.charCodeAt(i);
|
|
30
|
+
out.set(data, 8);
|
|
31
|
+
view.setUint32(8 + data.length, crc32(out.subarray(4, 8 + data.length)));
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
const SIGNATURE = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
35
|
+
/** `width` × `height` pixels of `channels` bytes each (3: RGB, 4: RGBA),
|
|
36
|
+
* rows top to bottom, as a PNG. */
|
|
37
|
+
export function encodePng(width, height, pixels, channels = 4) {
|
|
38
|
+
const row = width * channels;
|
|
39
|
+
if (pixels.length < row * height)
|
|
40
|
+
throw new RangeError('encodePng: fewer pixels than width × height');
|
|
41
|
+
const head = new Uint8Array(13);
|
|
42
|
+
const view = new DataView(head.buffer);
|
|
43
|
+
view.setUint32(0, width);
|
|
44
|
+
view.setUint32(4, height);
|
|
45
|
+
head[8] = 8; // bit depth
|
|
46
|
+
head[9] = channels === 4 ? 6 : 2; // truecolour with alpha, or without
|
|
47
|
+
// Each row starts with its filter (0: none).
|
|
48
|
+
const raw = new Uint8Array((row + 1) * height);
|
|
49
|
+
for (let y = 0; y < height; y++)
|
|
50
|
+
raw.set(pixels.subarray(y * row, (y + 1) * row), y * (row + 1) + 1);
|
|
51
|
+
const parts = [SIGNATURE, chunk('IHDR', head), chunk('IDAT', zlibSync(raw)), chunk('IEND', new Uint8Array(0))];
|
|
52
|
+
const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
|
|
53
|
+
let at = 0;
|
|
54
|
+
for (const p of parts) {
|
|
55
|
+
out.set(p, at);
|
|
56
|
+
at += p.length;
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=png.js.map
|