gutterpress 0.11.22-alpha.1 → 0.11.22-alpha.3
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/api/index.js +6 -6
- package/dist/{build-se85j9ec.js → build-shby4bg7.js} +9 -9
- package/dist/{cli-pfrg1r9x.js → cli-0s8sy5n9.js} +1 -1
- package/dist/{cli-fbwqv7p4.js → cli-17g57c61.js} +173 -61
- package/dist/{cli-sth219v1.js → cli-2ppw6q9v.js} +26 -6
- package/dist/{cli-5553w972.js → cli-3p7jejyd.js} +1 -1
- package/dist/{cli-8hccw62p.js → cli-9pk65fqf.js} +2 -2
- package/dist/{cli-yejbb9f8.js → cli-d0x3aq49.js} +1 -1
- package/dist/{cli-gmm3bdeq.js → cli-hndkg7bn.js} +2 -2
- package/dist/{cli-gc9av5hs.js → cli-nqvrp9wk.js} +1 -1
- package/dist/{cli-9vy4b6ec.js → cli-sge5cp21.js} +4 -4
- package/dist/cli.js +12 -12
- package/dist/{doctor-bv2t82zd.js → doctor-c6k6ycek.js} +3 -3
- package/dist/engine/shared/print-area.d.ts +77 -1
- package/dist/{engine-h4ehmrvf.js → engine-5p8tn9b4.js} +2 -2
- package/dist/{engine-qwkyhrej.js → engine-9710cd7x.js} +3 -3
- package/dist/{ext-a8ndp142.js → ext-t8re6kc7.js} +9 -9
- package/dist/{extension-restore-926mv2qk.js → extension-restore-3gsj0qxp.js} +3 -3
- package/dist/{extension-restore-q1f7njec.js → extension-restore-4rqvzzw4.js} +5 -5
- package/dist/{gutterpress-viewer-w7njnkj7.js → gutterpress-viewer-w9jzx6sb.js} +56 -52
- package/dist/{index-gmfh6n05.js → index-2d8j0enc.js} +2 -2
- package/dist/{index-sth219v1.js → index-2ppw6q9v.js} +26 -6
- package/dist/{index-5h9a38jn.js → index-apc8w9w8.js} +55 -55
- package/dist/{index-dhknsvfz.js → index-jsz0s3dy.js} +2 -2
- package/dist/{index-tkjvs1gf.js → index-p1a596m0.js} +162 -58
- package/dist/{index-38e18a7j.js → index-thmwa4f5.js} +1 -1
- package/dist/{index-dm7hx46j.js → index-xe83m9mc.js} +3 -3
- package/dist/index.js +7 -7
- package/dist/lib/markdown/assemble.d.ts +3 -2
- package/dist/lib/page-size.d.ts +3 -4
- package/dist/lib/pdf-inspect.d.ts +12 -0
- package/dist/lib/project-scaffold.d.ts +3 -3
- package/dist/{manifest.schema-n292sb77.json → manifest.schema-nvawq0xv.json} +2 -2
- package/dist/{new-nadp2hvb.js → new-w3wdd615.js} +9 -9
- package/dist/{pdf-inspect-zdmy7qca.js → pdf-inspect-wnw4za71.js} +1 -1
- package/dist/{plugins-yeh4shd7.js → plugins-8x9rsf21.js} +1 -1
- package/dist/{plugins-gy4q9vaa.js → plugins-cx4qwn7g.js} +3 -3
- package/dist/{preflight-c6q25xqa.js → preflight-aj2tpnxe.js} +9 -9
- package/dist/{preview-y8chv4cb.js → preview-dn5655f1.js} +9 -9
- package/dist/{publish-3qwvxsxa.js → publish-e0p9wgpd.js} +9 -9
- package/dist/render.js +586 -0
- package/dist/schema/manifest.types.d.ts +8 -3
- package/dist/{validate-w108kk87.js → validate-6wvf4mhr.js} +9 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./cli-d8xjns66.js";
|
|
9
9
|
import {
|
|
10
10
|
package_default
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-nqvrp9wk.js";
|
|
12
12
|
import {
|
|
13
13
|
EXIT_CODES
|
|
14
14
|
} from "./cli-46ycxe6r.js";
|
|
@@ -20,14 +20,14 @@ import {
|
|
|
20
20
|
import { defineCommand, parseArgs, runMain } from "citty";
|
|
21
21
|
import { statSync } from "node:fs";
|
|
22
22
|
var SUBCOMMANDS = {
|
|
23
|
-
new: () => import("./new-
|
|
24
|
-
preview: () => import("./preview-
|
|
25
|
-
build: () => import("./build-
|
|
26
|
-
publish: () => import("./publish-
|
|
27
|
-
validate: () => import("./validate-
|
|
28
|
-
preflight: () => import("./preflight-
|
|
29
|
-
doctor: () => import("./doctor-
|
|
30
|
-
ext: () => import("./ext-
|
|
23
|
+
new: () => import("./new-w3wdd615.js").then((m) => m.default),
|
|
24
|
+
preview: () => import("./preview-dn5655f1.js").then((m) => m.default),
|
|
25
|
+
build: () => import("./build-shby4bg7.js").then((m) => m.default),
|
|
26
|
+
publish: () => import("./publish-e0p9wgpd.js").then((m) => m.default),
|
|
27
|
+
validate: () => import("./validate-6wvf4mhr.js").then((m) => m.default),
|
|
28
|
+
preflight: () => import("./preflight-aj2tpnxe.js").then((m) => m.default),
|
|
29
|
+
doctor: () => import("./doctor-c6k6ycek.js").then((m) => m.default),
|
|
30
|
+
ext: () => import("./ext-t8re6kc7.js").then((m) => m.default)
|
|
31
31
|
};
|
|
32
32
|
var VERSION = package_default.version;
|
|
33
33
|
var main = defineCommand({
|
|
@@ -52,7 +52,7 @@ async function preflightRequiredInvocations(rawArgs) {
|
|
|
52
52
|
const [command, ...commandArgs] = rawArgs;
|
|
53
53
|
try {
|
|
54
54
|
if (command === "new") {
|
|
55
|
-
const { newArgs } = await import("./new-
|
|
55
|
+
const { newArgs } = await import("./new-w3wdd615.js");
|
|
56
56
|
rejectUnknownFlags(commandArgs, newArgs, "new");
|
|
57
57
|
const parsed = parseArgs(commandArgs, {
|
|
58
58
|
...newArgs,
|
|
@@ -64,7 +64,7 @@ async function preflightRequiredInvocations(rawArgs) {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
if (command === "preflight") {
|
|
67
|
-
const { preflightArgs } = await import("./preflight-
|
|
67
|
+
const { preflightArgs } = await import("./preflight-aj2tpnxe.js");
|
|
68
68
|
rejectUnknownFlags(commandArgs, preflightArgs, "preflight");
|
|
69
69
|
const parsed = parseArgs(commandArgs, {
|
|
70
70
|
...preflightArgs,
|
|
@@ -84,7 +84,7 @@ async function preflightRequiredInvocations(rawArgs) {
|
|
|
84
84
|
}
|
|
85
85
|
if (subcommand.startsWith("-"))
|
|
86
86
|
return;
|
|
87
|
-
const { EXT_SUBCOMMANDS, extAddArgs, extRemoveArgs, extEnableArgs, extDisableArgs } = await import("./ext-
|
|
87
|
+
const { EXT_SUBCOMMANDS, extAddArgs, extRemoveArgs, extEnableArgs, extDisableArgs } = await import("./ext-t8re6kc7.js");
|
|
88
88
|
if (!EXT_SUBCOMMANDS.includes(subcommand)) {
|
|
89
89
|
throw new UsageError(`gutterpress ext: unknown command "${subcommand}"`);
|
|
90
90
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSystemDiagnostics
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-d0x3aq49.js";
|
|
4
4
|
import"./cli-asap4t1z.js";
|
|
5
5
|
import {
|
|
6
6
|
log
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-3p7jejyd.js";
|
|
8
8
|
import {
|
|
9
9
|
UsageError,
|
|
10
10
|
rejectExtraPositionals,
|
|
11
11
|
rejectUnknownFlags
|
|
12
12
|
} from "./cli-d8xjns66.js";
|
|
13
|
-
import"./cli-
|
|
13
|
+
import"./cli-nqvrp9wk.js";
|
|
14
14
|
import"./cli-46ycxe6r.js";
|
|
15
15
|
import"./cli-37x76zdn.js";
|
|
16
16
|
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
* `<meta name="gp-print-area">` by the markdown assembly
|
|
5
5
|
* (lib/markdown/assemble.ts) and read back here by everything that needs it:
|
|
6
6
|
* the preview's print overlays (viewer/overlay.ts) and both engines' pinned
|
|
7
|
-
* art (pin-edges.ts — a pin sits on the printer's art-safe line).
|
|
7
|
+
* art (pin-edges.ts — a pin sits on the printer's art-safe line). The boxes
|
|
8
|
+
* those numbers draw on a page (`pageBoxes`) and the judge of a piece of ink
|
|
9
|
+
* against them (`judgeRect` / `classifyRect`) live here too, so the overlay
|
|
10
|
+
* and the `pdf.print.safe-margins` check (checks/pdf/safe-margins.ts) read
|
|
11
|
+
* one definition of "safe" — not in a module of their own, because the four
|
|
12
|
+
* numbers mean nothing but those boxes.
|
|
8
13
|
*
|
|
9
14
|
* Only the manifest feeds it — `page.width` x `page.height` (the sheet),
|
|
10
15
|
* `page.bleed` (a bleed the sheet already contains on the top, bottom and
|
|
@@ -56,6 +61,18 @@ export interface PrintAreaSource {
|
|
|
56
61
|
url: string;
|
|
57
62
|
};
|
|
58
63
|
}
|
|
64
|
+
/** A usable point value: finite and positive (a page dimension, an inset). */
|
|
65
|
+
export declare function isPositivePoints(value: unknown): value is number;
|
|
66
|
+
/**
|
|
67
|
+
* The `size` value written for a page — `8.5in 11in`, `595pt 842pt` — by
|
|
68
|
+
* everything that writes one: Book settings (lib/page-size.ts) into the
|
|
69
|
+
* book's stylesheet, and the assembly's manifest default
|
|
70
|
+
* (lib/markdown/assemble.ts), so one size has one spelling.
|
|
71
|
+
*/
|
|
72
|
+
export declare function formatPageSize(page: {
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
}): string;
|
|
59
76
|
/**
|
|
60
77
|
* The `<meta>` tag for one book. An unset bleed or text rule is written as 0,
|
|
61
78
|
* never left out; an unset art rule or gutter stays out (the reader takes each
|
|
@@ -71,3 +88,62 @@ export interface MetaDocument {
|
|
|
71
88
|
}
|
|
72
89
|
/** The book's print area from its `<meta name="gp-print-area">`; `null` without one. */
|
|
73
90
|
export declare function printAreaFromMeta(doc: MetaDocument): PrintArea | null;
|
|
91
|
+
export interface Rect {
|
|
92
|
+
x: number;
|
|
93
|
+
y: number;
|
|
94
|
+
w: number;
|
|
95
|
+
h: number;
|
|
96
|
+
}
|
|
97
|
+
/** The nested boxes of one page, in one unit, origin at the sheet's top-left. */
|
|
98
|
+
export interface PageBoxes {
|
|
99
|
+
/** the whole sheet (the bleed box when the sheet contains a bleed) */
|
|
100
|
+
sheet: Rect;
|
|
101
|
+
/** the cut page */
|
|
102
|
+
trim: Rect;
|
|
103
|
+
/** where TEXT is safe from the cut: the trim inset by `safe`, and by `gutter` at the binding */
|
|
104
|
+
safe: Rect;
|
|
105
|
+
/** where ART is safe from the cut: the trim inset by `artSafe`, and by `gutter` at the binding */
|
|
106
|
+
safeArt: Rect;
|
|
107
|
+
bleed: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Boxes for one page. The trim is the sheet pulled in by `bleed` on the top,
|
|
111
|
+
* bottom and OUTER edge — the right edge of a recto, the left edge of a verso;
|
|
112
|
+
* the binding edge has no bleed. The text box is the trim pulled in by `safe`
|
|
113
|
+
* on the top, bottom and outer edge and by `gutter` on the binding edge (left
|
|
114
|
+
* of a recto, right of a verso); the art box is pulled in by `artSafe` on the
|
|
115
|
+
* top, bottom and outer edge and by `gutter` on the binding edge.
|
|
116
|
+
*/
|
|
117
|
+
export declare function pageBoxes(area: PrintArea, side: PageSide, scale?: number): PageBoxes;
|
|
118
|
+
/**
|
|
119
|
+
* Where a piece of ink sits relative to its page, worst first:
|
|
120
|
+
* - `inside` within the box its rule allows
|
|
121
|
+
* - `unsafe` leaves that box but stays on the trimmed page
|
|
122
|
+
* - `bleed` crosses the trim but stays on the sheet (in the bleed band)
|
|
123
|
+
* - `off-page` crosses the sheet's edge: that part is not printed at all
|
|
124
|
+
*/
|
|
125
|
+
export type OverflowKind = "inside" | "unsafe" | "bleed" | "off-page";
|
|
126
|
+
/** The rule a piece of ink is judged by: text against `page.safe`, art against `page.artSafe`. */
|
|
127
|
+
export type OverflowRule = "text" | "art";
|
|
128
|
+
/** One edge of a page as drawn: `left` and `right` are the page's own, so the binding is a recto's left and a verso's right. */
|
|
129
|
+
export type PageEdge = "left" | "right" | "top" | "bottom";
|
|
130
|
+
/** The verdict on a piece of ink: see `judgeRect`. */
|
|
131
|
+
export interface Overflow {
|
|
132
|
+
kind: OverflowKind;
|
|
133
|
+
gap: number;
|
|
134
|
+
need: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Judge one rect of ink, edge by edge, against the box its rule allows (text:
|
|
138
|
+
* `boxes.safe`; art: `boxes.safeArt`). `kind` is the worst edge's and `edge`
|
|
139
|
+
* names it (`null` when the ink is inside). `gap` is how far that edge sits
|
|
140
|
+
* inside the trim (negative = past it) and `need` how far inside the rule
|
|
141
|
+
* wants it, in the boxes' unit. Art that runs out to the sheet's edge is
|
|
142
|
+
* bleeding there, as it should, so that edge passes. `tol` absorbs sub-pixel
|
|
143
|
+
* layout (LayoutUnit is 1/64 px) and PDF rounding so an exact fit is not flagged.
|
|
144
|
+
*/
|
|
145
|
+
export declare function judgeRect(r: Rect, boxes: PageBoxes, rule: OverflowRule, tol?: number): Overflow & {
|
|
146
|
+
edge: PageEdge | null;
|
|
147
|
+
};
|
|
148
|
+
/** `judgeRect` without the edge: the verdict the overlay paints. */
|
|
149
|
+
export declare function classifyRect(r: Rect, boxes: PageBoxes, rule: OverflowRule, tol?: number): Overflow;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
build
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
3
|
+
} from "./index-2d8j0enc.js";
|
|
4
|
+
import"./index-apc8w9w8.js";
|
|
5
5
|
import {
|
|
6
6
|
BuildError
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-jsz0s3dy.js";
|
|
8
8
|
import"./index-bt0qws5c.js";
|
|
9
9
|
import"./index-37x76zdn.js";
|
|
10
10
|
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
importExtensionFromFile,
|
|
3
3
|
importExtensionFromUrl,
|
|
4
4
|
searchNpmExtensions
|
|
5
|
-
} from "./cli-
|
|
6
|
-
import"./cli-
|
|
5
|
+
} from "./cli-17g57c61.js";
|
|
6
|
+
import"./cli-d0x3aq49.js";
|
|
7
7
|
import"./cli-ht1bcqdd.js";
|
|
8
|
-
import"./cli-
|
|
9
|
-
import"./cli-
|
|
8
|
+
import"./cli-9pk65fqf.js";
|
|
9
|
+
import"./cli-2ppw6q9v.js";
|
|
10
10
|
import"./cli-eyyggect.js";
|
|
11
11
|
import"./cli-asap4t1z.js";
|
|
12
12
|
import"./cli-habkc5ng.js";
|
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
removeExtension,
|
|
23
23
|
setExtensionEnabled,
|
|
24
24
|
updateExtensions
|
|
25
|
-
} from "./cli-
|
|
26
|
-
import"./cli-
|
|
27
|
-
import"./cli-
|
|
25
|
+
} from "./cli-sge5cp21.js";
|
|
26
|
+
import"./cli-0s8sy5n9.js";
|
|
27
|
+
import"./cli-3p7jejyd.js";
|
|
28
28
|
import {
|
|
29
29
|
UsageError,
|
|
30
30
|
exitForUsage,
|
|
@@ -32,8 +32,8 @@ import {
|
|
|
32
32
|
rejectUnknownFlags,
|
|
33
33
|
resolveProjectDir
|
|
34
34
|
} from "./cli-d8xjns66.js";
|
|
35
|
-
import"./cli-
|
|
36
|
-
import"./cli-
|
|
35
|
+
import"./cli-nqvrp9wk.js";
|
|
36
|
+
import"./cli-hndkg7bn.js";
|
|
37
37
|
import {
|
|
38
38
|
EXIT_CODES
|
|
39
39
|
} from "./cli-46ycxe6r.js";
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
restoreForCommand,
|
|
4
4
|
restoreOfflineMessage,
|
|
5
5
|
restorePinnedExtensions
|
|
6
|
-
} from "./index-
|
|
7
|
-
import"./index-
|
|
8
|
-
import"./index-
|
|
6
|
+
} from "./index-xe83m9mc.js";
|
|
7
|
+
import"./index-thmwa4f5.js";
|
|
8
|
+
import"./index-jsz0s3dy.js";
|
|
9
9
|
import"./index-r7jcsk6h.js";
|
|
10
10
|
import"./index-37x76zdn.js";
|
|
11
11
|
export {
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
restoreForCommand,
|
|
4
4
|
restoreOfflineMessage,
|
|
5
5
|
restorePinnedExtensions
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import"./cli-
|
|
8
|
-
import"./cli-
|
|
6
|
+
} from "./cli-sge5cp21.js";
|
|
7
|
+
import"./cli-0s8sy5n9.js";
|
|
8
|
+
import"./cli-3p7jejyd.js";
|
|
9
9
|
import"./cli-d8xjns66.js";
|
|
10
|
-
import"./cli-
|
|
11
|
-
import"./cli-
|
|
10
|
+
import"./cli-nqvrp9wk.js";
|
|
11
|
+
import"./cli-hndkg7bn.js";
|
|
12
12
|
import"./cli-46ycxe6r.js";
|
|
13
13
|
import"./cli-h3phdstf.js";
|
|
14
14
|
import"./cli-37x76zdn.js";
|
|
@@ -1136,6 +1136,62 @@
|
|
|
1136
1136
|
return null;
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
|
+
function pageBoxes(area, side, scale = 1) {
|
|
1140
|
+
const w = area.width * scale;
|
|
1141
|
+
const h = area.height * scale;
|
|
1142
|
+
const b = Math.max(0, area.bleed) * scale;
|
|
1143
|
+
const s = Math.max(0, area.safe) * scale;
|
|
1144
|
+
const a = Math.max(0, area.artSafe) * scale;
|
|
1145
|
+
const g = Math.max(0, area.gutter) * scale;
|
|
1146
|
+
const [textLeft, textRight] = side === "verso" ? [s, g] : [g, s];
|
|
1147
|
+
const [artLeft, artRight] = side === "verso" ? [a, g] : [g, a];
|
|
1148
|
+
const trim = { x: side === "verso" ? b : 0, y: b, w: Math.max(0, w - b), h: Math.max(0, h - 2 * b) };
|
|
1149
|
+
return {
|
|
1150
|
+
sheet: { x: 0, y: 0, w, h },
|
|
1151
|
+
trim,
|
|
1152
|
+
safe: {
|
|
1153
|
+
x: trim.x + textLeft,
|
|
1154
|
+
y: trim.y + s,
|
|
1155
|
+
w: Math.max(0, trim.w - textLeft - textRight),
|
|
1156
|
+
h: Math.max(0, trim.h - 2 * s)
|
|
1157
|
+
},
|
|
1158
|
+
safeArt: {
|
|
1159
|
+
x: trim.x + artLeft,
|
|
1160
|
+
y: trim.y + a,
|
|
1161
|
+
w: Math.max(0, trim.w - artLeft - artRight),
|
|
1162
|
+
h: Math.max(0, trim.h - 2 * a)
|
|
1163
|
+
},
|
|
1164
|
+
bleed: b
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
var SEVERITY = { inside: 0, unsafe: 1, bleed: 2, "off-page": 3 };
|
|
1168
|
+
function judgeRect(r, boxes, rule, tol = 0) {
|
|
1169
|
+
const { sheet, trim } = boxes;
|
|
1170
|
+
const safe = rule === "art" ? boxes.safeArt : boxes.safe;
|
|
1171
|
+
const sides = [
|
|
1172
|
+
["left", -r.x, -safe.x, -trim.x, -sheet.x],
|
|
1173
|
+
["right", r.x + r.w, safe.x + safe.w, trim.x + trim.w, sheet.x + sheet.w],
|
|
1174
|
+
["top", -r.y, -safe.y, -trim.y, -sheet.y],
|
|
1175
|
+
["bottom", r.y + r.h, safe.y + safe.h, trim.y + trim.h, sheet.y + sheet.h]
|
|
1176
|
+
];
|
|
1177
|
+
let worst = { kind: "inside", gap: 0, need: 0, edge: null };
|
|
1178
|
+
let beyond = 0;
|
|
1179
|
+
for (const [edge, ink, limit, trimEdge, sheetEdge] of sides) {
|
|
1180
|
+
const past = ink - limit;
|
|
1181
|
+
if (past <= tol || rule === "art" && ink >= sheetEdge - tol)
|
|
1182
|
+
continue;
|
|
1183
|
+
const kind = ink > sheetEdge + tol ? "off-page" : ink > trimEdge + tol ? "bleed" : "unsafe";
|
|
1184
|
+
if (SEVERITY[kind] > SEVERITY[worst.kind] || kind === worst.kind && past > beyond) {
|
|
1185
|
+
worst = { kind, gap: trimEdge - ink, need: trimEdge - limit, edge };
|
|
1186
|
+
beyond = past;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
return worst;
|
|
1190
|
+
}
|
|
1191
|
+
function classifyRect(r, boxes, rule, tol = 0) {
|
|
1192
|
+
const { kind, gap, need } = judgeRect(r, boxes, rule, tol);
|
|
1193
|
+
return { kind, gap, need };
|
|
1194
|
+
}
|
|
1139
1195
|
|
|
1140
1196
|
// src/engine/viewer/fragment.ts
|
|
1141
1197
|
var PX_PER_PT = 96 / 72;
|
|
@@ -2250,58 +2306,6 @@
|
|
|
2250
2306
|
}
|
|
2251
2307
|
|
|
2252
2308
|
// src/engine/viewer/overlay.ts
|
|
2253
|
-
function pageBoxes(area, side, scale = 1) {
|
|
2254
|
-
const w = area.width * scale;
|
|
2255
|
-
const h = area.height * scale;
|
|
2256
|
-
const b = Math.max(0, area.bleed) * scale;
|
|
2257
|
-
const s = Math.max(0, area.safe) * scale;
|
|
2258
|
-
const a = Math.max(0, area.artSafe) * scale;
|
|
2259
|
-
const g = Math.max(0, area.gutter) * scale;
|
|
2260
|
-
const [textLeft, textRight] = side === "verso" ? [s, g] : [g, s];
|
|
2261
|
-
const [artLeft, artRight] = side === "verso" ? [a, g] : [g, a];
|
|
2262
|
-
const trim = { x: side === "verso" ? b : 0, y: b, w: Math.max(0, w - b), h: Math.max(0, h - 2 * b) };
|
|
2263
|
-
return {
|
|
2264
|
-
sheet: { x: 0, y: 0, w, h },
|
|
2265
|
-
trim,
|
|
2266
|
-
safe: {
|
|
2267
|
-
x: trim.x + textLeft,
|
|
2268
|
-
y: trim.y + s,
|
|
2269
|
-
w: Math.max(0, trim.w - textLeft - textRight),
|
|
2270
|
-
h: Math.max(0, trim.h - 2 * s)
|
|
2271
|
-
},
|
|
2272
|
-
safeArt: {
|
|
2273
|
-
x: trim.x + artLeft,
|
|
2274
|
-
y: trim.y + a,
|
|
2275
|
-
w: Math.max(0, trim.w - artLeft - artRight),
|
|
2276
|
-
h: Math.max(0, trim.h - 2 * a)
|
|
2277
|
-
},
|
|
2278
|
-
bleed: b
|
|
2279
|
-
};
|
|
2280
|
-
}
|
|
2281
|
-
var SEVERITY = { inside: 0, unsafe: 1, bleed: 2, "off-page": 3 };
|
|
2282
|
-
function classifyRect(r, boxes, rule, tol = 0) {
|
|
2283
|
-
const { sheet, trim } = boxes;
|
|
2284
|
-
const safe = rule === "art" ? boxes.safeArt : boxes.safe;
|
|
2285
|
-
const sides = [
|
|
2286
|
-
[-r.x, -safe.x, -trim.x, -sheet.x],
|
|
2287
|
-
[r.x + r.w, safe.x + safe.w, trim.x + trim.w, sheet.x + sheet.w],
|
|
2288
|
-
[-r.y, -safe.y, -trim.y, -sheet.y],
|
|
2289
|
-
[r.y + r.h, safe.y + safe.h, trim.y + trim.h, sheet.y + sheet.h]
|
|
2290
|
-
];
|
|
2291
|
-
let worst = { kind: "inside", gap: 0, need: 0 };
|
|
2292
|
-
let beyond = 0;
|
|
2293
|
-
for (const [ink, limit, edge, sheetEdge] of sides) {
|
|
2294
|
-
const past = ink - limit;
|
|
2295
|
-
if (past <= tol || rule === "art" && ink >= sheetEdge - tol)
|
|
2296
|
-
continue;
|
|
2297
|
-
const kind = ink > sheetEdge + tol ? "off-page" : ink > edge + tol ? "bleed" : "unsafe";
|
|
2298
|
-
if (SEVERITY[kind] > SEVERITY[worst.kind] || kind === worst.kind && past > beyond) {
|
|
2299
|
-
worst = { kind, gap: edge - ink, need: edge - limit };
|
|
2300
|
-
beyond = past;
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
return worst;
|
|
2304
|
-
}
|
|
2305
2309
|
var INTENT_SELECTOR = ".gp-bleed, .gp-pin, .gp-flush, .gp-behind, .gp-page-full-bleed";
|
|
2306
2310
|
var OVERLAY_LAYERS = ["bleed", "safe", "art", "margins"];
|
|
2307
2311
|
function layersFrom(state) {
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
stringValueAt,
|
|
19
19
|
toFolioPage,
|
|
20
20
|
wantsRecto
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-apc8w9w8.js";
|
|
22
22
|
import {
|
|
23
23
|
getAssetPath
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-jsz0s3dy.js";
|
|
25
25
|
import {
|
|
26
26
|
launchChromium
|
|
27
27
|
} from "./index-bt0qws5c.js";
|
|
@@ -168,6 +168,14 @@ function getTextPass(doc) {
|
|
|
168
168
|
return p;
|
|
169
169
|
}
|
|
170
170
|
var opCache = new WeakMap;
|
|
171
|
+
var opSet = (names) => new Set(names.map((name) => OPS[name]).filter((op) => op !== undefined));
|
|
172
|
+
var IMAGE_OPS = opSet([
|
|
173
|
+
"paintImageXObject",
|
|
174
|
+
"paintImageXObjectRepeat",
|
|
175
|
+
"paintInlineImageXObject",
|
|
176
|
+
"paintImageMaskXObject",
|
|
177
|
+
"paintJpegXObject"
|
|
178
|
+
]);
|
|
171
179
|
function multiply(m1, m2) {
|
|
172
180
|
return [
|
|
173
181
|
m1[0] * m2[0] + m1[2] * m2[1],
|
|
@@ -219,14 +227,27 @@ function getOpPass(doc) {
|
|
|
219
227
|
ctm = stack.pop() ?? ctm;
|
|
220
228
|
} else if (fn === OPS.transform) {
|
|
221
229
|
ctm = multiply(ctm, args);
|
|
222
|
-
} else if (fn === OPS.
|
|
230
|
+
} else if (fn === OPS.paintFormXObjectBegin) {
|
|
231
|
+
stack.push(ctm.slice());
|
|
232
|
+
const matrix = args[0];
|
|
233
|
+
if (Array.isArray(matrix))
|
|
234
|
+
ctm = multiply(ctm, matrix);
|
|
235
|
+
} else if (fn === OPS.paintFormXObjectEnd) {
|
|
236
|
+
ctm = stack.pop() ?? ctm;
|
|
237
|
+
} else if (IMAGE_OPS.has(fn)) {
|
|
223
238
|
const name = typeof args[0] === "string" ? args[0] : "(inline)";
|
|
239
|
+
const [a, b, c, d, e, f] = ctm;
|
|
240
|
+
const xs = [e, a + e, c + e, a + c + e];
|
|
241
|
+
const ys = [f, b + f, d + f, b + d + f];
|
|
242
|
+
const x0 = Math.min(...xs);
|
|
243
|
+
const y0 = Math.min(...ys);
|
|
224
244
|
pageImages.push({
|
|
225
245
|
name,
|
|
226
|
-
placedW: Math.hypot(
|
|
227
|
-
placedH: Math.hypot(
|
|
228
|
-
x:
|
|
229
|
-
y:
|
|
246
|
+
placedW: Math.hypot(a, b),
|
|
247
|
+
placedH: Math.hypot(c, d),
|
|
248
|
+
x: e,
|
|
249
|
+
y: f,
|
|
250
|
+
bounds: { x: x0, y: y0, w: Math.max(...xs) - x0, h: Math.max(...ys) - y0 },
|
|
230
251
|
page: i
|
|
231
252
|
});
|
|
232
253
|
} else if (fn === OPS.setFont) {
|
|
@@ -254,7 +275,6 @@ function getOpPass(doc) {
|
|
|
254
275
|
}
|
|
255
276
|
return p;
|
|
256
277
|
}
|
|
257
|
-
var opSet = (names) => new Set(names.map((name) => OPS[name]).filter((op) => op !== undefined));
|
|
258
278
|
var FILL_COLOR_OPS = opSet(["setFillGray", "setFillRGBColor", "setFillCMYKColor", "setFillColor"]);
|
|
259
279
|
var STROKE_COLOR_OPS = opSet(["setStrokeGray", "setStrokeRGBColor", "setStrokeCMYKColor", "setStrokeColor"]);
|
|
260
280
|
var SHOW_TEXT_OPS = opSet(["showText", "showSpacedText", "nextLineShowText", "nextLineSetSpacingShowText"]);
|
|
@@ -120,60 +120,6 @@ function generatedContentCss(selectors) {
|
|
|
120
120
|
`);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
// src/engine/shared/margin-box-support.ts
|
|
124
|
-
var MARGIN_BOX_IGNORED_PROPERTIES = new Set([
|
|
125
|
-
"transform",
|
|
126
|
-
"rotate",
|
|
127
|
-
"translate",
|
|
128
|
-
"scale",
|
|
129
|
-
"perspective",
|
|
130
|
-
"box-shadow",
|
|
131
|
-
"opacity",
|
|
132
|
-
"outline",
|
|
133
|
-
"outline-color",
|
|
134
|
-
"outline-style",
|
|
135
|
-
"outline-width",
|
|
136
|
-
"outline-offset",
|
|
137
|
-
"filter",
|
|
138
|
-
"backdrop-filter",
|
|
139
|
-
"mix-blend-mode",
|
|
140
|
-
"clip-path"
|
|
141
|
-
]);
|
|
142
|
-
function isIgnoredMarginBoxProperty(property) {
|
|
143
|
-
return MARGIN_BOX_IGNORED_PROPERTIES.has(property.toLowerCase());
|
|
144
|
-
}
|
|
145
|
-
function marginBoxRectPt(name, g) {
|
|
146
|
-
const { top, right, bottom, left } = g.margin;
|
|
147
|
-
const cw = g.width - left - right;
|
|
148
|
-
const ch = g.height - top - bottom;
|
|
149
|
-
const third = (n) => n / 3;
|
|
150
|
-
const T = {
|
|
151
|
-
"top-left-corner": [0, 0, left, top],
|
|
152
|
-
"top-left": [left, 0, third(cw), top],
|
|
153
|
-
"top-center": [left + third(cw), 0, third(cw), top],
|
|
154
|
-
"top-right": [left + 2 * third(cw), 0, third(cw), top],
|
|
155
|
-
"top-right-corner": [g.width - right, 0, right, top],
|
|
156
|
-
"bottom-left-corner": [0, g.height - bottom, left, bottom],
|
|
157
|
-
"bottom-left": [left, g.height - bottom, third(cw), bottom],
|
|
158
|
-
"bottom-center": [left + third(cw), g.height - bottom, third(cw), bottom],
|
|
159
|
-
"bottom-right": [left + 2 * third(cw), g.height - bottom, third(cw), bottom],
|
|
160
|
-
"bottom-right-corner": [g.width - right, g.height - bottom, right, bottom],
|
|
161
|
-
"left-top": [0, top, left, third(ch)],
|
|
162
|
-
"left-middle": [0, top + third(ch), left, third(ch)],
|
|
163
|
-
"left-bottom": [0, top + 2 * third(ch), left, third(ch)],
|
|
164
|
-
"right-top": [g.width - right, top, right, third(ch)],
|
|
165
|
-
"right-middle": [g.width - right, top + third(ch), right, third(ch)],
|
|
166
|
-
"right-bottom": [g.width - right, top + 2 * third(ch), right, third(ch)]
|
|
167
|
-
};
|
|
168
|
-
const [x, y, w, h] = T[name] ?? [0, 0, 0, 0];
|
|
169
|
-
return { x, y, w, h };
|
|
170
|
-
}
|
|
171
|
-
function marginBoxAlign(name) {
|
|
172
|
-
if (name.includes("center") || name.includes("middle"))
|
|
173
|
-
return "center";
|
|
174
|
-
return /right/.test(name) ? "end" : "start";
|
|
175
|
-
}
|
|
176
|
-
|
|
177
123
|
// src/engine/shared/gcpm-extract.ts
|
|
178
124
|
var NESTED_AT_RULES = /^@(media|supports|layer|scope|container|document)\b/i;
|
|
179
125
|
function scanRules(css) {
|
|
@@ -734,4 +680,58 @@ function specificity(r) {
|
|
|
734
680
|
return (r.name ? 2 : 0) + r.pseudos.length;
|
|
735
681
|
}
|
|
736
682
|
|
|
737
|
-
|
|
683
|
+
// src/engine/shared/margin-box-support.ts
|
|
684
|
+
var MARGIN_BOX_IGNORED_PROPERTIES = new Set([
|
|
685
|
+
"transform",
|
|
686
|
+
"rotate",
|
|
687
|
+
"translate",
|
|
688
|
+
"scale",
|
|
689
|
+
"perspective",
|
|
690
|
+
"box-shadow",
|
|
691
|
+
"opacity",
|
|
692
|
+
"outline",
|
|
693
|
+
"outline-color",
|
|
694
|
+
"outline-style",
|
|
695
|
+
"outline-width",
|
|
696
|
+
"outline-offset",
|
|
697
|
+
"filter",
|
|
698
|
+
"backdrop-filter",
|
|
699
|
+
"mix-blend-mode",
|
|
700
|
+
"clip-path"
|
|
701
|
+
]);
|
|
702
|
+
function isIgnoredMarginBoxProperty(property) {
|
|
703
|
+
return MARGIN_BOX_IGNORED_PROPERTIES.has(property.toLowerCase());
|
|
704
|
+
}
|
|
705
|
+
function marginBoxRectPt(name, g) {
|
|
706
|
+
const { top, right, bottom, left } = g.margin;
|
|
707
|
+
const cw = g.width - left - right;
|
|
708
|
+
const ch = g.height - top - bottom;
|
|
709
|
+
const third = (n) => n / 3;
|
|
710
|
+
const T = {
|
|
711
|
+
"top-left-corner": [0, 0, left, top],
|
|
712
|
+
"top-left": [left, 0, third(cw), top],
|
|
713
|
+
"top-center": [left + third(cw), 0, third(cw), top],
|
|
714
|
+
"top-right": [left + 2 * third(cw), 0, third(cw), top],
|
|
715
|
+
"top-right-corner": [g.width - right, 0, right, top],
|
|
716
|
+
"bottom-left-corner": [0, g.height - bottom, left, bottom],
|
|
717
|
+
"bottom-left": [left, g.height - bottom, third(cw), bottom],
|
|
718
|
+
"bottom-center": [left + third(cw), g.height - bottom, third(cw), bottom],
|
|
719
|
+
"bottom-right": [left + 2 * third(cw), g.height - bottom, third(cw), bottom],
|
|
720
|
+
"bottom-right-corner": [g.width - right, g.height - bottom, right, bottom],
|
|
721
|
+
"left-top": [0, top, left, third(ch)],
|
|
722
|
+
"left-middle": [0, top + third(ch), left, third(ch)],
|
|
723
|
+
"left-bottom": [0, top + 2 * third(ch), left, third(ch)],
|
|
724
|
+
"right-top": [g.width - right, top, right, third(ch)],
|
|
725
|
+
"right-middle": [g.width - right, top + third(ch), right, third(ch)],
|
|
726
|
+
"right-bottom": [g.width - right, top + 2 * third(ch), right, third(ch)]
|
|
727
|
+
};
|
|
728
|
+
const [x, y, w, h] = T[name] ?? [0, 0, 0, 0];
|
|
729
|
+
return { x, y, w, h };
|
|
730
|
+
}
|
|
731
|
+
function marginBoxAlign(name) {
|
|
732
|
+
if (name.includes("center") || name.includes("middle"))
|
|
733
|
+
return "center";
|
|
734
|
+
return /right/.test(name) ? "end" : "start";
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
export { isRectoVersoBreak, wantsRecto, planRectoBlanks, lastPageMode, signaturePadding, parseWhich, stringValueAt, stringSymbols, cssQuote, counterStyleName, restartedPageValues, toFolioPage, leaderMarker, generatedContentCss, extract, splitTopLevel, parseSize, resolvePage, MARGIN_BOX_IGNORED_PROPERTIES, isIgnoredMarginBoxProperty, marginBoxRectPt, marginBoxAlign };
|
|
@@ -26,7 +26,7 @@ import { fileURLToPath } from "node:url";
|
|
|
26
26
|
var favicon_default = "./favicon-272ga6y0.ico";
|
|
27
27
|
|
|
28
28
|
// src/assets/manifest.schema.json
|
|
29
|
-
var manifest_schema_default = "./manifest.schema-
|
|
29
|
+
var manifest_schema_default = "./manifest.schema-nvawq0xv.json";
|
|
30
30
|
|
|
31
31
|
// src/assets/preview/scripts/preview-interface.js
|
|
32
32
|
var preview_interface_default = "./preview-interface-nnmrxyqm.js";
|
|
@@ -41,7 +41,7 @@ var preview_shell_default = "./preview-shell-wk9k3gcd.js";
|
|
|
41
41
|
var CGATS21_CRPC1_default = "./CGATS21_CRPC1-g0e3k7kr.icc";
|
|
42
42
|
|
|
43
43
|
// src/assets/engine/gutterpress-viewer.js
|
|
44
|
-
var gutterpress_viewer_default = "./gutterpress-viewer-
|
|
44
|
+
var gutterpress_viewer_default = "./gutterpress-viewer-w9jzx6sb.js";
|
|
45
45
|
|
|
46
46
|
// src/assets/engine/gutterpress-agent.js
|
|
47
47
|
var gutterpress_agent_default = "./gutterpress-agent-d29ry3ak.js";
|