gutterpress 0.11.23-alpha.7 → 0.11.23-beta.2
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/README.md +3 -1
- package/dist/{README-syg2hn83.md → README-8rct3axy.md} +2 -2
- package/dist/api/index.d.ts +3 -3
- package/dist/api/index.js +8 -6
- package/dist/{build-w572wq10.js → build-3e18wnqj.js} +9 -8
- package/dist/{cli-mmgtqnmr.js → cli-0ep11b0q.js} +1 -1
- package/dist/cli-65gy8ask.js +82 -0
- package/dist/{cli-6pv84kf3.js → cli-88arpdke.js} +6 -84
- package/dist/{cli-eatdqx3z.js → cli-9n9kg58f.js} +1 -1
- package/dist/{cli-58fsk6d7.js → cli-pd2cje5b.js} +187 -44
- package/dist/{cli-3cvq3n1c.js → cli-pnrararp.js} +189 -85
- package/dist/{cli-wyg7qstd.js → cli-tgnyvra3.js} +15 -5
- package/dist/{cli-31anr0r9.js → cli-v0evdpdf.js} +68 -28
- package/dist/{cli-5ba6bm6z.js → cli-x7gcdg6w.js} +1 -1
- package/dist/cli.js +12 -12
- package/dist/{doctor-2f3zqmza.js → doctor-2f4s9dyn.js} +3 -3
- package/dist/engine/compiler/postprocess.d.ts +3 -0
- package/dist/engine/shared/page-vars.d.ts +32 -0
- package/dist/engine/shared/pdf-inspect.d.ts +33 -0
- package/dist/{engine-4rabsgwq.js → engine-c4pxz79g.js} +2 -1
- package/dist/{engine-wm4fggac.js → engine-cs5g2ez0.js} +3 -3
- package/dist/{ext-0cgky8n3.js → ext-70gv86v5.js} +9 -8
- package/dist/{extension-restore-vghc58vx.js → extension-restore-chj5nx3t.js} +3 -3
- package/dist/{extension-restore-e7je32pr.js → extension-restore-pd87p8r2.js} +5 -4
- package/dist/{gutterpress-agent-d29ry3ak.js → gutterpress-agent-wyryqehx.js} +13 -4
- package/dist/{gutterpress-viewer-mafsby5k.js → gutterpress-viewer-ywkf49q5.js} +90 -166
- package/dist/{index-nfysshcc.js → index-0k43evt0.js} +309 -155
- package/dist/{index-wm4x7xbf.js → index-2t1gdma7.js} +178 -35
- package/dist/{index-cw03e9p4.js → index-7j3hkwya.js} +68 -28
- package/dist/{index-fp7xwvpr.js → index-80vg3ed6.js} +15 -5
- package/dist/{index-2vxzxyyj.js → index-swfdgn2n.js} +10 -10
- package/dist/index-tayzfr9c.js +99 -0
- package/dist/{index-hphcn7th.js → index-ytjkvwy5.js} +5 -85
- package/dist/index.d.ts +2 -0
- package/dist/index.js +234 -7
- package/dist/lib/book-css.d.ts +56 -0
- package/dist/lib/markdown/assemble.d.ts +58 -0
- package/dist/lib/markdown/gutterpress-css.d.ts +1 -1
- package/dist/lib/publish/google-drive.d.ts +12 -4
- package/dist/lib/publish/manifest-publish.d.ts +6 -0
- package/dist/lib/publish/providers/gdrive-folder.d.ts +30 -0
- package/dist/lib/publish/run-publish.d.ts +6 -1
- package/dist/lib/publish/types.d.ts +52 -5
- package/dist/lib/remote-auth/converge-merge.d.ts +3 -3
- package/dist/lib/remote-auth/sync-messages.d.ts +2 -2
- package/dist/lib/root-tokens.d.ts +76 -0
- package/dist/lib/source-provider.d.ts +27 -0
- package/dist/lib/version-changes.d.ts +26 -16
- package/dist/{manifest-79zsgkpn.yaml → manifest-0vwaskj2.yaml} +1 -1
- package/dist/{manifest-2kc56wvw.yaml → manifest-aya31jwt.yaml} +1 -1
- package/dist/{manifest-41ddzm13.yaml → manifest-mffah3hr.yaml} +1 -1
- package/dist/{manifest-sqzm4681.yaml → manifest-wbcv8cbp.yaml} +2 -2
- package/dist/{manifest.schema-93sd7zje.json → manifest.schema-0jgj0jt1.json} +1 -1
- package/dist/{new-88rkrv71.js → new-d61n5cn0.js} +9 -8
- package/dist/{page-rules-ytj9p04v.css → page-rules-vnja6grt.css} +2 -2
- package/dist/{plugins-3aj0wc5h.js → plugins-0hhw6s17.js} +1 -1
- package/dist/{plugins-sprxsz5d.js → plugins-e0n46s6m.js} +3 -3
- package/dist/{preflight-11dg1qkk.js → preflight-fjayhjr5.js} +9 -8
- package/dist/{preview-nftp782j.js → preview-h815jrfb.js} +9 -8
- package/dist/{publish-6tgxfck9.js → publish-ft39zgma.js} +25 -9
- package/dist/render.js +77 -26
- package/dist/schema/manifest.types.d.ts +2 -1
- package/dist/{source-provider-n7vehh6t.js → source-provider-j1w7byeq.js} +5 -1
- package/dist/{source-provider-tgzet3j5.js → source-provider-tjaf303m.js} +5 -1
- package/dist/test-helpers/vocabulary.d.ts +12 -0
- package/dist/{tokens-n82t4k9h.css → tokens-a7grv940.css} +4 -5
- package/dist/{validate-pktqrye5.js → validate-b201dbrb.js} +9 -8
- package/package.json +1 -1
- package/dist/index-46ycxe6r.js +0 -18
package/README.md
CHANGED
|
@@ -221,7 +221,7 @@ gutterpress build [input-dir] [options]
|
|
|
221
221
|
--skip-lint Skip the CSS print-safety check (default: it runs for pdf/pdfx)
|
|
222
222
|
--skip-pre-validate Skip pre-build validation
|
|
223
223
|
--skip-post-validate Skip post-build PDF/X validation
|
|
224
|
-
--allow-shrink Build anyway when content is wider than the page content box. Chromium then scales the WHOLE book down to fit it — the build reports
|
|
224
|
+
--allow-shrink Build anyway when content is wider than the page content box. Chromium then scales the WHOLE book down to fit it — the build reports the scale the PDF printed at (e.g. "printed at 72.0000% of its declared size") plus every offender, as warnings.
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
A `--out <dir>` is shared between formats safely: each build delivers only
|
|
@@ -253,6 +253,8 @@ gutterpress publish [project] [options]
|
|
|
253
253
|
--account <label> Named-credential label for --connect/--disconnect (keep several accounts per provider); omit for the default
|
|
254
254
|
--token <key> API key for --connect (prefer stdin/env var to keep it out of shell history)
|
|
255
255
|
--file <path> Artifact to publish (PDF path, or HTML export dir). Default: the manifest's output location
|
|
256
|
+
--folder-id <id> Google Drive: publish to this folder for this run only (the manifest is not changed)
|
|
257
|
+
--folder <name> Google Drive: publish to the folder with this name in your own Drive, for this run only
|
|
256
258
|
--manifest <path> Path to manifest.yaml
|
|
257
259
|
--dry-run Preflight only; don't contact the platform
|
|
258
260
|
--json Machine-readable JSON output (CI)
|
|
@@ -159,8 +159,8 @@ one place, and chapters written afterwards get it for free.
|
|
|
159
159
|
### 4. The page size and margins are the book's, not the look's
|
|
160
160
|
|
|
161
161
|
A look never declares `@page { size }` or `@page { margin }`. The book's
|
|
162
|
-
manifest records both (`preset:`, `page: width / height / margin`, which
|
|
163
|
-
|
|
162
|
+
manifest records both (`preset:`, `page: width / height / margin`, which an
|
|
163
|
+
author sets in Book setup), and the build writes them as the `@page`
|
|
164
164
|
rule after every stylesheet, so a `size` in a look is ignored and reported by
|
|
165
165
|
the print-safety check, and a `margin` holds only until the author sets
|
|
166
166
|
margins in the app. `page-rules.css` owns what IS a look's: the margin boxes
|
package/dist/api/index.d.ts
CHANGED
|
@@ -55,8 +55,8 @@ export { readPageSetup, setPageSetup } from "../lib/page-size.ts";
|
|
|
55
55
|
export type { PageMargin, PageSetup, PageSetupChange, PageSizeChoice, PageSizePoints } from "../lib/page-size.ts";
|
|
56
56
|
export { providerFor, restoreVersionWithBackup, isNoChangesError, countUnversionedChanges, whenGitIdle, AUTO_SNAPSHOT_MESSAGE, RESTORE_BACKUP_MESSAGE, HISTORY_PAGE_LIMIT, listRevisions, createRevision, revisionNameFrom, switchBranch, SWITCH_BRANCH_SNAPSHOT_MESSAGE, } from "../lib/source-provider.ts";
|
|
57
57
|
export type { ListHistoryOptions, HistoryPage, UnversionedChanges, Revision, RevisionList, CreateRevisionOptions, SwitchBranchOptions, SwitchBranchResult, } from "../lib/source-provider.ts";
|
|
58
|
-
export { describeVersions, listOnlineVersions, compareVersionFile, exportVersionTree, VERSION_CHANGES_SHOWN, } from "../lib/version-changes.ts";
|
|
59
|
-
export type { VersionEntry, VersionFileChange, CompareRow } from "../lib/version-changes.ts";
|
|
58
|
+
export { describeVersions, listVersionChanges, listOnlineVersions, compareVersionFile, exportVersionTree, VERSION_CHANGES_SHOWN, } from "../lib/version-changes.ts";
|
|
59
|
+
export type { VersionEntry, VersionChanges, VersionFileChange, CompareRow } from "../lib/version-changes.ts";
|
|
60
60
|
export { autoSnapshotDelayMs, autoSyncDelayMs, isGitInternalPath, AUTO_SNAPSHOT_DEFAULT_MINUTES, AUTO_SYNC_MIN_MINUTES, AUTO_SYNC_MAX_MINUTES, AUTO_SYNC_DEFAULT_MINUTES, AUTO_SYNC_PUSH_INTERVAL_MINUTES, } from "../lib/host-policy.ts";
|
|
61
61
|
export type { AutoSnapshotPolicy, AutoSyncPolicy, } from "../lib/host-policy.ts";
|
|
62
62
|
export { FileTokenStore, defaultConfigDir, extractUrlCredential, } from "../lib/remote-auth/token-store.ts";
|
|
@@ -98,6 +98,6 @@ export type { PublishSavedAccount } from "../lib/publish/types.ts";
|
|
|
98
98
|
export { PublishSelectionsStore } from "../lib/publish/selections.ts";
|
|
99
99
|
export type { PublishAccountSelection } from "../lib/publish/selections.ts";
|
|
100
100
|
export { readPublishSettings, savePublishSettings, setPublishProviderConfig, } from "../lib/publish/manifest-publish.ts";
|
|
101
|
-
export type { PublishProvider, PublishProviderId, PublishProviderInfo, PublishProviderKind, PublishConfigField, PublishArtifact, PublishArtifactFormat, PublishAuthStatus, PublishDeps, PublishListingMetadata, PublishOutcome, PublishProduct, PublishProject, PublishRequest, PreflightIssue, CommandRunner, CommandResult, PublishPluginContext, PublishPluginFunction, PublishPluginResult, } from "../lib/publish/types.ts";
|
|
101
|
+
export type { PublishProvider, PublishProviderId, PublishProviderInfo, PublishProviderKind, PublishConfigField, PublishArtifact, PublishArtifactFormat, PublishAuthStatus, PublishDeps, PublishDestinationStatus, PublishListingMetadata, PublishOutcome, PublishProduct, PublishProject, PublishRequest, PreflightIssue, CommandRunner, CommandResult, PublishPluginContext, PublishPluginFunction, PublishPluginResult, } from "../lib/publish/types.ts";
|
|
102
102
|
export { resolveLogger } from "../lib/remote-auth/operation-log.ts";
|
|
103
103
|
export type { OperationLogger, LogData } from "../lib/remote-auth/operation-log.ts";
|
package/dist/api/index.js
CHANGED
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
listPublishProviders,
|
|
63
63
|
listRepoBooks,
|
|
64
64
|
listSnippets,
|
|
65
|
+
listVersionChanges,
|
|
65
66
|
parseRemoteOrigin,
|
|
66
67
|
pkceChallengeFromVerifier,
|
|
67
68
|
publishConnectionStatus,
|
|
@@ -104,7 +105,7 @@ import {
|
|
|
104
105
|
substituteVariables,
|
|
105
106
|
syncProject,
|
|
106
107
|
testRemoteAccess
|
|
107
|
-
} from "../index-
|
|
108
|
+
} from "../index-0k43evt0.js";
|
|
108
109
|
import {
|
|
109
110
|
DEFAULT_NPM_REGISTRY,
|
|
110
111
|
MANIFEST_FILENAMES,
|
|
@@ -133,7 +134,7 @@ import {
|
|
|
133
134
|
setExtensionEnabled,
|
|
134
135
|
updateExtensions,
|
|
135
136
|
validateProjectExtensions
|
|
136
|
-
} from "../index-
|
|
137
|
+
} from "../index-ytjkvwy5.js";
|
|
137
138
|
import {
|
|
138
139
|
BUNDLED_EXTENSIONS,
|
|
139
140
|
EXTENSION_MANIFEST_FILENAME,
|
|
@@ -148,12 +149,12 @@ import {
|
|
|
148
149
|
pathEscapesFolder,
|
|
149
150
|
readExtensionMeta,
|
|
150
151
|
resolveExtension
|
|
151
|
-
} from "../index-
|
|
152
|
+
} from "../index-80vg3ed6.js";
|
|
152
153
|
import"../index-ht1bcqdd.js";
|
|
153
|
-
import"../index-
|
|
154
|
+
import"../index-swfdgn2n.js";
|
|
154
155
|
import {
|
|
155
156
|
BuildError
|
|
156
|
-
} from "../index-
|
|
157
|
+
} from "../index-tayzfr9c.js";
|
|
157
158
|
import"../index-5crpmz42.js";
|
|
158
159
|
import {
|
|
159
160
|
DEFAULT_PRINT_OPTS,
|
|
@@ -175,7 +176,7 @@ import {
|
|
|
175
176
|
revisionNameFrom,
|
|
176
177
|
switchBranch,
|
|
177
178
|
whenGitIdle
|
|
178
|
-
} from "../index-
|
|
179
|
+
} from "../index-7j3hkwya.js";
|
|
179
180
|
import {
|
|
180
181
|
EXTENSIONS_DIR
|
|
181
182
|
} from "../index-5x42amh8.js";
|
|
@@ -256,6 +257,7 @@ export {
|
|
|
256
257
|
parseExtensionSpecifier,
|
|
257
258
|
npmRegistryUrl,
|
|
258
259
|
loadManifestWithPath,
|
|
260
|
+
listVersionChanges,
|
|
259
261
|
listSnippets,
|
|
260
262
|
listRevisions,
|
|
261
263
|
listRepoBooks,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runBuild,
|
|
3
3
|
splitOutPath
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import"./cli-
|
|
4
|
+
} from "./cli-pnrararp.js";
|
|
5
|
+
import"./cli-0ep11b0q.js";
|
|
6
6
|
import"./cli-ht1bcqdd.js";
|
|
7
|
-
import"./cli-
|
|
7
|
+
import"./cli-pd2cje5b.js";
|
|
8
8
|
import"./cli-5crpmz42.js";
|
|
9
9
|
import"./cli-eyyggect.js";
|
|
10
10
|
import"./cli-asap4t1z.js";
|
|
11
|
-
import"./cli-
|
|
11
|
+
import"./cli-v0evdpdf.js";
|
|
12
12
|
import"./cli-v5mp7a6q.js";
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-
|
|
13
|
+
import"./cli-88arpdke.js";
|
|
14
|
+
import"./cli-tgnyvra3.js";
|
|
15
15
|
import {
|
|
16
16
|
log
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-9n9kg58f.js";
|
|
18
18
|
import {
|
|
19
19
|
UsageError,
|
|
20
20
|
parseFormat,
|
|
@@ -22,7 +22,8 @@ import {
|
|
|
22
22
|
rejectExtraPositionals,
|
|
23
23
|
rejectUnknownFlags
|
|
24
24
|
} from "./cli-d8xjns66.js";
|
|
25
|
-
import"./cli-
|
|
25
|
+
import"./cli-x7gcdg6w.js";
|
|
26
|
+
import"./cli-65gy8ask.js";
|
|
26
27
|
import {
|
|
27
28
|
BuildError
|
|
28
29
|
} from "./cli-46ycxe6r.js";
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// src/engine/shared/print-area.ts
|
|
2
|
+
function isPositivePoints(value) {
|
|
3
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
4
|
+
}
|
|
5
|
+
function isNonNegativePoints(value) {
|
|
6
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
7
|
+
}
|
|
8
|
+
var round3 = (n) => Math.round(n * 1000) / 1000;
|
|
9
|
+
function cssLength(pt) {
|
|
10
|
+
const inches = round3(pt / 72);
|
|
11
|
+
return Math.abs(inches * 72 - pt) < 0.000001 ? `${inches}in` : `${round3(pt)}pt`;
|
|
12
|
+
}
|
|
13
|
+
function formatPageSize(page) {
|
|
14
|
+
return `${cssLength(page.width)} ${cssLength(page.height)}`;
|
|
15
|
+
}
|
|
16
|
+
function printAreaMeta(page) {
|
|
17
|
+
const area = JSON.stringify({
|
|
18
|
+
width: page.width,
|
|
19
|
+
height: page.height,
|
|
20
|
+
bleed: page.bleed ?? 0,
|
|
21
|
+
safe: page.safe ?? 0,
|
|
22
|
+
artSafe: page.artSafe,
|
|
23
|
+
gutter: page.gutter,
|
|
24
|
+
preset: page.preset,
|
|
25
|
+
spec: page.spec
|
|
26
|
+
});
|
|
27
|
+
return `<meta name="gp-print-area" content='${area.replace(/&/g, "&").replace(/'/g, "'")}'>`;
|
|
28
|
+
}
|
|
29
|
+
function pageBoxes(area, side, scale = 1) {
|
|
30
|
+
const w = area.width * scale;
|
|
31
|
+
const h = area.height * scale;
|
|
32
|
+
const b = Math.max(0, area.bleed) * scale;
|
|
33
|
+
const s = Math.max(0, area.safe) * scale;
|
|
34
|
+
const a = Math.max(0, area.artSafe) * scale;
|
|
35
|
+
const g = Math.max(0, area.gutter) * scale;
|
|
36
|
+
const [textLeft, textRight] = side === "verso" ? [s, g] : [g, s];
|
|
37
|
+
const [artLeft, artRight] = side === "verso" ? [a, g] : [g, a];
|
|
38
|
+
const trim = { x: side === "verso" ? b : 0, y: b, w: Math.max(0, w - b), h: Math.max(0, h - 2 * b) };
|
|
39
|
+
return {
|
|
40
|
+
sheet: { x: 0, y: 0, w, h },
|
|
41
|
+
trim,
|
|
42
|
+
safe: {
|
|
43
|
+
x: trim.x + textLeft,
|
|
44
|
+
y: trim.y + s,
|
|
45
|
+
w: Math.max(0, trim.w - textLeft - textRight),
|
|
46
|
+
h: Math.max(0, trim.h - 2 * s)
|
|
47
|
+
},
|
|
48
|
+
safeArt: {
|
|
49
|
+
x: trim.x + artLeft,
|
|
50
|
+
y: trim.y + a,
|
|
51
|
+
w: Math.max(0, trim.w - artLeft - artRight),
|
|
52
|
+
h: Math.max(0, trim.h - 2 * a)
|
|
53
|
+
},
|
|
54
|
+
bleed: b
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
var SEVERITY = { inside: 0, unsafe: 1, bleed: 2, "off-page": 3 };
|
|
58
|
+
function judgeRect(r, boxes, rule, tol = 0) {
|
|
59
|
+
const { sheet, trim } = boxes;
|
|
60
|
+
const safe = rule === "art" ? boxes.safeArt : boxes.safe;
|
|
61
|
+
const sides = [
|
|
62
|
+
["left", -r.x, -safe.x, -trim.x, -sheet.x],
|
|
63
|
+
["right", r.x + r.w, safe.x + safe.w, trim.x + trim.w, sheet.x + sheet.w],
|
|
64
|
+
["top", -r.y, -safe.y, -trim.y, -sheet.y],
|
|
65
|
+
["bottom", r.y + r.h, safe.y + safe.h, trim.y + trim.h, sheet.y + sheet.h]
|
|
66
|
+
];
|
|
67
|
+
let worst = { kind: "inside", gap: 0, need: 0, edge: null };
|
|
68
|
+
let beyond = 0;
|
|
69
|
+
for (const [edge, ink, limit, trimEdge, sheetEdge] of sides) {
|
|
70
|
+
const past = ink - limit;
|
|
71
|
+
if (past <= tol || rule === "art" && ink >= sheetEdge - tol)
|
|
72
|
+
continue;
|
|
73
|
+
const kind = ink > sheetEdge + tol ? "off-page" : ink > trimEdge + tol ? "bleed" : "unsafe";
|
|
74
|
+
if (SEVERITY[kind] > SEVERITY[worst.kind] || kind === worst.kind && past > beyond) {
|
|
75
|
+
worst = { kind, gap: trimEdge - ink, need: trimEdge - limit, edge };
|
|
76
|
+
beyond = past;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return worst;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { isPositivePoints, isNonNegativePoints, round3, cssLength, formatPageSize, printAreaMeta, pageBoxes, judgeRect };
|
|
@@ -11,13 +11,16 @@ import {
|
|
|
11
11
|
prettify,
|
|
12
12
|
readExtensionMeta,
|
|
13
13
|
slugify
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-tgnyvra3.js";
|
|
15
15
|
import {
|
|
16
16
|
log
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-9n9kg58f.js";
|
|
18
18
|
import {
|
|
19
19
|
UsageError
|
|
20
20
|
} from "./cli-d8xjns66.js";
|
|
21
|
+
import {
|
|
22
|
+
isNonNegativePoints
|
|
23
|
+
} from "./cli-65gy8ask.js";
|
|
21
24
|
import {
|
|
22
25
|
BuildError,
|
|
23
26
|
EXIT_CODES
|
|
@@ -94,87 +97,6 @@ import { existsSync, statSync } from "node:fs";
|
|
|
94
97
|
import { resolve, dirname } from "node:path";
|
|
95
98
|
import { parse as parseYaml, YAMLParseError } from "yaml";
|
|
96
99
|
|
|
97
|
-
// src/engine/shared/print-area.ts
|
|
98
|
-
function isPositivePoints(value) {
|
|
99
|
-
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
100
|
-
}
|
|
101
|
-
function isNonNegativePoints(value) {
|
|
102
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
103
|
-
}
|
|
104
|
-
var round3 = (n) => Math.round(n * 1000) / 1000;
|
|
105
|
-
function cssLength(pt) {
|
|
106
|
-
const inches = round3(pt / 72);
|
|
107
|
-
return Math.abs(inches * 72 - pt) < 0.000001 ? `${inches}in` : `${round3(pt)}pt`;
|
|
108
|
-
}
|
|
109
|
-
function formatPageSize(page) {
|
|
110
|
-
return `${cssLength(page.width)} ${cssLength(page.height)}`;
|
|
111
|
-
}
|
|
112
|
-
function printAreaMeta(page) {
|
|
113
|
-
const area = JSON.stringify({
|
|
114
|
-
width: page.width,
|
|
115
|
-
height: page.height,
|
|
116
|
-
bleed: page.bleed ?? 0,
|
|
117
|
-
safe: page.safe ?? 0,
|
|
118
|
-
artSafe: page.artSafe,
|
|
119
|
-
gutter: page.gutter,
|
|
120
|
-
preset: page.preset,
|
|
121
|
-
spec: page.spec
|
|
122
|
-
});
|
|
123
|
-
return `<meta name="gp-print-area" content='${area.replace(/&/g, "&").replace(/'/g, "'")}'>`;
|
|
124
|
-
}
|
|
125
|
-
function pageBoxes(area, side, scale = 1) {
|
|
126
|
-
const w = area.width * scale;
|
|
127
|
-
const h = area.height * scale;
|
|
128
|
-
const b = Math.max(0, area.bleed) * scale;
|
|
129
|
-
const s = Math.max(0, area.safe) * scale;
|
|
130
|
-
const a = Math.max(0, area.artSafe) * scale;
|
|
131
|
-
const g = Math.max(0, area.gutter) * scale;
|
|
132
|
-
const [textLeft, textRight] = side === "verso" ? [s, g] : [g, s];
|
|
133
|
-
const [artLeft, artRight] = side === "verso" ? [a, g] : [g, a];
|
|
134
|
-
const trim = { x: side === "verso" ? b : 0, y: b, w: Math.max(0, w - b), h: Math.max(0, h - 2 * b) };
|
|
135
|
-
return {
|
|
136
|
-
sheet: { x: 0, y: 0, w, h },
|
|
137
|
-
trim,
|
|
138
|
-
safe: {
|
|
139
|
-
x: trim.x + textLeft,
|
|
140
|
-
y: trim.y + s,
|
|
141
|
-
w: Math.max(0, trim.w - textLeft - textRight),
|
|
142
|
-
h: Math.max(0, trim.h - 2 * s)
|
|
143
|
-
},
|
|
144
|
-
safeArt: {
|
|
145
|
-
x: trim.x + artLeft,
|
|
146
|
-
y: trim.y + a,
|
|
147
|
-
w: Math.max(0, trim.w - artLeft - artRight),
|
|
148
|
-
h: Math.max(0, trim.h - 2 * a)
|
|
149
|
-
},
|
|
150
|
-
bleed: b
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
var SEVERITY = { inside: 0, unsafe: 1, bleed: 2, "off-page": 3 };
|
|
154
|
-
function judgeRect(r, boxes, rule, tol = 0) {
|
|
155
|
-
const { sheet, trim } = boxes;
|
|
156
|
-
const safe = rule === "art" ? boxes.safeArt : boxes.safe;
|
|
157
|
-
const sides = [
|
|
158
|
-
["left", -r.x, -safe.x, -trim.x, -sheet.x],
|
|
159
|
-
["right", r.x + r.w, safe.x + safe.w, trim.x + trim.w, sheet.x + sheet.w],
|
|
160
|
-
["top", -r.y, -safe.y, -trim.y, -sheet.y],
|
|
161
|
-
["bottom", r.y + r.h, safe.y + safe.h, trim.y + trim.h, sheet.y + sheet.h]
|
|
162
|
-
];
|
|
163
|
-
let worst = { kind: "inside", gap: 0, need: 0, edge: null };
|
|
164
|
-
let beyond = 0;
|
|
165
|
-
for (const [edge, ink, limit, trimEdge, sheetEdge] of sides) {
|
|
166
|
-
const past = ink - limit;
|
|
167
|
-
if (past <= tol || rule === "art" && ink >= sheetEdge - tol)
|
|
168
|
-
continue;
|
|
169
|
-
const kind = ink > sheetEdge + tol ? "off-page" : ink > trimEdge + tol ? "bleed" : "unsafe";
|
|
170
|
-
if (SEVERITY[kind] > SEVERITY[worst.kind] || kind === worst.kind && past > beyond) {
|
|
171
|
-
worst = { kind, gap: trimEdge - ink, need: trimEdge - limit, edge };
|
|
172
|
-
beyond = past;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return worst;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
100
|
// src/lib/presets.ts
|
|
179
101
|
var PRESET_IDS = ["dtrpg", "book", "custom"];
|
|
180
102
|
var DTRPG_PRESET = {
|
|
@@ -2195,4 +2117,4 @@ async function restoreForCommand(dir, options) {
|
|
|
2195
2117
|
log.warn(problem);
|
|
2196
2118
|
}
|
|
2197
2119
|
|
|
2198
|
-
export {
|
|
2120
|
+
export { PRESET_IDS, PRESETS, TARGETS, TARGET_IDS, publishTargetFor, resolveTargets, applyDefaultPdfStrictChecks, MANIFEST_FILENAMES, loadManifest, loadManifestWithPath, resolveConfig, resolveConfigForTarget, FriendlyHttpError, withFetchTimeout, loadManifestDoc, writeManifestDoc, npmRegistryUrl, ensureProjectGitignore, listProjectExtensions, setExtensionEnabled, removeExtension, addExtension, checkExtensionUpdates, updateExtensions, uniqueExtensionId, restorePinnedExtensions, restoreFailureMessage, restoreOfflineMessage, restoreForCommand };
|