gutterpress 0.11.23-alpha.3 → 0.11.23-alpha.4
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 +4 -6
- package/dist/{README-8db7btxb.md → README-syg2hn83.md} +1 -1
- package/dist/api/index.js +5 -5
- package/dist/{build-m78jcpf7.js → build-c48eer6f.js} +8 -8
- package/dist/checks/asset/extensions.d.ts +1 -1
- package/dist/checks/asset/index.d.ts +0 -1
- package/dist/checks/policy.d.ts +5 -4
- package/dist/checks/source/config-file.d.ts +9 -6
- package/dist/checks/source/dangling-links.d.ts +1 -1
- package/dist/checks/types.d.ts +2 -2
- package/dist/{cli-xsrffqzt.js → cli-54xt7pjg.js} +8 -8
- package/dist/{cli-2ppw6q9v.js → cli-5crpmz42.js} +80 -1
- package/dist/{cli-1h17ktsg.js → cli-93mkaw6v.js} +96 -209
- package/dist/{cli-n2tsxqpn.js → cli-d9mm3vvh.js} +7 -2
- package/dist/{cli-5jzyw06s.js → cli-gnpea9dx.js} +1 -1
- package/dist/{cli-s6djx4ma.js → cli-pspjxnc8.js} +1 -1
- package/dist/{cli-t8be9yeb.js → cli-rqh295j9.js} +12 -7
- package/dist/{cli-h4x81x97.js → cli-y6d1arem.js} +207 -142
- package/dist/cli.js +12 -12
- package/dist/{doctor-j71jqce3.js → doctor-ptb346k8.js} +4 -3
- package/dist/{engine-m4y10shc.js → engine-4rzdx6af.js} +1 -1
- package/dist/{engine-1r6q80tq.js → engine-6txhxmmv.js} +2 -2
- package/dist/{ext-fq2hg9va.js → ext-gy8szg3x.js} +8 -8
- package/dist/{extension-restore-9dh7c4tp.js → extension-restore-dymzcasz.js} +2 -2
- package/dist/{extension-restore-tmxtzkm0.js → extension-restore-m8tj43e7.js} +4 -4
- package/dist/{index-2ppw6q9v.js → index-5crpmz42.js} +80 -1
- package/dist/{index-nedd07bk.js → index-5kh4c78h.js} +8 -8
- package/dist/{index-0wee4408.js → index-8ywkd2sv.js} +12 -7
- package/dist/{index-prqvz3xm.js → index-ea94zbq4.js} +132 -228
- package/dist/{index-7pck1q9c.js → index-kaks3mm2.js} +206 -141
- package/dist/{index-nvmf22rt.js → index-yc3xj266.js} +1 -1
- package/dist/index.js +6 -6
- package/dist/lib/build-preflight.d.ts +4 -10
- package/dist/lib/build-runner.d.ts +1 -1
- package/dist/lib/ghostscript.d.ts +5 -2
- package/dist/lib/lint-rules.d.ts +5 -1
- package/dist/lib/manifest-config.d.ts +3 -2
- package/dist/lib/manifest-old-spellings.d.ts +64 -0
- package/dist/lib/markdown/chapter-id.d.ts +1 -1
- package/dist/lib/markdown/index.d.ts +1 -1
- package/dist/lib/markdown/table.d.ts +5 -3
- package/dist/lib/page-size.d.ts +14 -9
- package/dist/lib/pdf-inspect.d.ts +27 -0
- package/dist/lib/presets.d.ts +10 -8
- package/dist/lib/printsafe.d.ts +1 -1
- package/dist/lib/project-scaffold.d.ts +1 -1
- package/dist/lib/remote-auth/sync-messages.d.ts +2 -2
- package/dist/lib/targets.d.ts +4 -4
- package/dist/lib/validation-exec.d.ts +4 -4
- package/dist/{manifest-my7mdv8j.yaml → manifest-2kc56wvw.yaml} +3 -4
- package/dist/{manifest-8afhrk30.yaml → manifest-41ddzm13.yaml} +3 -4
- package/dist/{manifest-gf13sjp8.yaml → manifest-79zsgkpn.yaml} +3 -4
- package/dist/{manifest-d4f9q79e.yaml → manifest-sqzm4681.yaml} +3 -4
- package/dist/{manifest.schema-650pe0d1.json → manifest.schema-w86c1xw1.json} +19 -309
- package/dist/{new-s4zcaepg.js → new-t2t28ccb.js} +9 -15
- package/dist/{page-rules-fj09xct5.css → page-rules-ytj9p04v.css} +1 -1
- package/dist/{pdf-inspect-wnw4za71.js → pdf-inspect-b3mf81ex.js} +3 -1
- package/dist/{plugins-80emnf31.js → plugins-fec8t2bh.js} +1 -1
- package/dist/{plugins-4vaf27n9.js → plugins-sqa4msdk.js} +3 -3
- package/dist/{preflight-c7w1xdn3.js → preflight-srq8fktp.js} +8 -8
- package/dist/preview/file-watcher.d.ts +1 -3
- package/dist/{preview-mzytcwyk.js → preview-zsp9hstd.js} +8 -8
- package/dist/{publish-fez14ad4.js → publish-hhy31gr9.js} +8 -8
- package/dist/render.js +6 -1
- package/dist/schema/manifest.types.d.ts +40 -107
- package/dist/{tokens-ye64p899.css → tokens-n82t4k9h.css} +11 -4
- package/dist/{validate-p2chr6hr.js → validate-r9jdz85h.js} +8 -8
- package/package.json +1 -1
- package/dist/checks/asset/approved-fonts.d.ts +0 -3
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ A Gutterpress project is a directory. The CLI doesn't impose much structure; the
|
|
|
90
90
|
my-book/
|
|
91
91
|
├─ manifest.yaml ← optional but recommended; metadata + config
|
|
92
92
|
├─ chapter-01.md ← markdown files, processed in alphabetical order
|
|
93
|
-
├─ chapter-02.md (or in the order listed in manifest.yaml#
|
|
93
|
+
├─ chapter-02.md (or in the order listed in manifest.yaml#chapters)
|
|
94
94
|
├─ css/ ← your stylesheets
|
|
95
95
|
│ └─ print.css
|
|
96
96
|
└─ images/ ← images referenced from markdown or CSS
|
|
@@ -123,10 +123,9 @@ preset: dtrpg
|
|
|
123
123
|
styles:
|
|
124
124
|
- css/print.css
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
- chapter-02.md
|
|
126
|
+
chapters:
|
|
127
|
+
- chapter-01.md
|
|
128
|
+
- chapter-02.md
|
|
130
129
|
```
|
|
131
130
|
|
|
132
131
|
The full configuration cascade is `CLI flags > manifest.yaml > preset defaults`. See the [configuration reference](https://github.com/dimm-city/gutterpress/blob/main/examples/gutterpress-user-guide/01-getting-started.md#manifest-configuration) for details.
|
|
@@ -163,7 +162,6 @@ gutterpress new <name> [--kind <id>] [options]
|
|
|
163
162
|
--targets <ids> Publish targets recorded in the manifest (comma-separated: dtrpg, itch; or "none") — default: the preset's
|
|
164
163
|
--page-width <pt> Trim width in points, 72pt = 1in (required with --preset custom; optional override otherwise)
|
|
165
164
|
--page-height <pt> Trim height in points, 72pt = 1in (required with --preset custom; optional override otherwise)
|
|
166
|
-
--page-tolerance <pt> Allowed trim deviation when validating a built PDF (default: 0.5)
|
|
167
165
|
--git Initialise local version history (default: true; use --no-git to skip)
|
|
168
166
|
--no-git
|
|
169
167
|
```
|
|
@@ -160,7 +160,7 @@ one place, and chapters written afterwards get it for free.
|
|
|
160
160
|
|
|
161
161
|
A look never declares `@page { size }` or `@page { margin }`. The book's
|
|
162
162
|
manifest records both (`preset:`, `page: width / height / margin`, which the
|
|
163
|
-
app edits under Setup >
|
|
163
|
+
app edits under Setup > Book), 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.js
CHANGED
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
substituteVariables,
|
|
102
102
|
syncProject,
|
|
103
103
|
testRemoteAccess
|
|
104
|
-
} from "../index-
|
|
104
|
+
} from "../index-ea94zbq4.js";
|
|
105
105
|
import {
|
|
106
106
|
DEFAULT_NPM_REGISTRY,
|
|
107
107
|
MANIFEST_FILENAMES,
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
setExtensionEnabled,
|
|
131
131
|
updateExtensions,
|
|
132
132
|
validateProjectExtensions
|
|
133
|
-
} from "../index-
|
|
133
|
+
} from "../index-kaks3mm2.js";
|
|
134
134
|
import {
|
|
135
135
|
BUNDLED_EXTENSIONS,
|
|
136
136
|
EXTENSION_MANIFEST_FILENAME,
|
|
@@ -145,13 +145,13 @@ import {
|
|
|
145
145
|
pathEscapesFolder,
|
|
146
146
|
readExtensionMeta,
|
|
147
147
|
resolveExtension
|
|
148
|
-
} from "../index-
|
|
148
|
+
} from "../index-8ywkd2sv.js";
|
|
149
149
|
import"../index-ht1bcqdd.js";
|
|
150
|
-
import"../index-
|
|
150
|
+
import"../index-5kh4c78h.js";
|
|
151
151
|
import {
|
|
152
152
|
BuildError
|
|
153
153
|
} from "../index-46ycxe6r.js";
|
|
154
|
-
import"../index-
|
|
154
|
+
import"../index-5crpmz42.js";
|
|
155
155
|
import {
|
|
156
156
|
DEFAULT_PRINT_OPTS,
|
|
157
157
|
assertMilestone,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runBuild,
|
|
3
3
|
splitOutPath
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import"./cli-
|
|
4
|
+
} from "./cli-93mkaw6v.js";
|
|
5
|
+
import"./cli-d9mm3vvh.js";
|
|
6
6
|
import"./cli-ht1bcqdd.js";
|
|
7
|
-
import"./cli-
|
|
8
|
-
import"./cli-
|
|
7
|
+
import"./cli-54xt7pjg.js";
|
|
8
|
+
import"./cli-5crpmz42.js";
|
|
9
9
|
import"./cli-eyyggect.js";
|
|
10
10
|
import"./cli-asap4t1z.js";
|
|
11
11
|
import"./cli-a35w7wzg.js";
|
|
12
12
|
import"./cli-v5mp7a6q.js";
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-
|
|
13
|
+
import"./cli-y6d1arem.js";
|
|
14
|
+
import"./cli-rqh295j9.js";
|
|
15
15
|
import {
|
|
16
16
|
log
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-pspjxnc8.js";
|
|
18
18
|
import {
|
|
19
19
|
UsageError,
|
|
20
20
|
parseFormat,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
rejectExtraPositionals,
|
|
23
23
|
rejectUnknownFlags
|
|
24
24
|
} from "./cli-d8xjns66.js";
|
|
25
|
-
import"./cli-
|
|
25
|
+
import"./cli-gnpea9dx.js";
|
|
26
26
|
import {
|
|
27
27
|
BuildError
|
|
28
28
|
} from "./cli-46ycxe6r.js";
|
|
@@ -28,7 +28,7 @@ export declare const ALL_IMAGE_EXTS: readonly ["png", "jpg", "jpeg", "tiff", "ti
|
|
|
28
28
|
* the run has no book to resolve them from (a `--pdf`-only run).
|
|
29
29
|
*/
|
|
30
30
|
export declare function shippedImages(ctx: CheckContext, exts: readonly string[]): string[];
|
|
31
|
-
/** Font file extensions
|
|
31
|
+
/** Font file extensions the font-license check looks for. */
|
|
32
32
|
export declare const FONT_EXTS: readonly ["woff", "woff2", "otf", "ttf", "eot"];
|
|
33
33
|
/**
|
|
34
34
|
* Directories no asset scan should ever descend into, as glob patterns.
|
package/dist/checks/policy.d.ts
CHANGED
|
@@ -11,10 +11,11 @@ export declare const INSPECT_FAILED_CODE = "inspect-failed";
|
|
|
11
11
|
* Used by BOTH the runner (execution) and tool-check (tool probing) so the two
|
|
12
12
|
* can never drift.
|
|
13
13
|
*
|
|
14
|
-
* Order:
|
|
15
|
-
* declarative `enabledWhen(config)` predicate —
|
|
16
|
-
* express a
|
|
17
|
-
* instead of hard-coding special cases in the
|
|
14
|
+
* Order: a check's level `off` (preset, target, `checks:` or the CLI) wins
|
|
15
|
+
* first, then the check's own declarative `enabledWhen(config)` predicate —
|
|
16
|
+
* the canonical, per-check way to express a build-setting gate (e.g.
|
|
17
|
+
* `print.signature > 1`) instead of hard-coding special cases in the
|
|
18
|
+
* runner/tool-check.
|
|
18
19
|
*/
|
|
19
20
|
export declare function isCheckEnabled(check: Check, config: ResolvedConfig): boolean;
|
|
20
21
|
/** Selector inputs shared by check execution and tool probing. */
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Locate a lint config file for a source check
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Locate a lint config file for a source check by its usual name: the first
|
|
3
|
+
* of `names` in the book's folder, else in the folder above, and so on up to
|
|
4
|
+
* the repository the book lives in (the nearest folder with a `.git`), or the
|
|
5
|
+
* filesystem root when there is none. A book inside a larger repository
|
|
6
|
+
* therefore uses the repository's own `.markdownlint.jsonc`, as the linters'
|
|
7
|
+
* own command-line tools do. Returns null when nothing matches. Shared by the
|
|
8
|
+
* markdownlint, htmlhint and CSS-ownership checks so their config discovery
|
|
9
|
+
* can never drift.
|
|
7
10
|
*/
|
|
8
|
-
export declare function findConfigFile(
|
|
11
|
+
export declare function findConfigFile(startDir: string, names: readonly string[]): string | null;
|
|
@@ -12,7 +12,7 @@ import type { Check } from "../types";
|
|
|
12
12
|
* `source.links.local-refs` answers a different question — does the target
|
|
13
13
|
* exist on disk — and a link can pass that while still being unopenable from
|
|
14
14
|
* a PDF, which is why this is its own check (and can be switched off for an
|
|
15
|
-
* HTML-only book via `
|
|
15
|
+
* HTML-only book via `checks:` in the manifest).
|
|
16
16
|
*/
|
|
17
17
|
declare const check: Check;
|
|
18
18
|
export default check;
|
package/dist/checks/types.d.ts
CHANGED
|
@@ -55,8 +55,8 @@ export interface Check {
|
|
|
55
55
|
requiredTools?: string[];
|
|
56
56
|
/**
|
|
57
57
|
* Declarative enable gate driven by config (beyond the generic
|
|
58
|
-
* `
|
|
59
|
-
*
|
|
58
|
+
* `checks: { <id>: off }`). Lets a check run only when a build setting it
|
|
59
|
+
* depends on is in effect — e.g. `print.signature > 1` — so the runner and
|
|
60
60
|
* tool-check never need per-check special cases. Returning `false` disables
|
|
61
61
|
* the check for enablement/tool-probing purposes.
|
|
62
62
|
*/
|
|
@@ -1140,7 +1140,7 @@ import { fileURLToPath } from "node:url";
|
|
|
1140
1140
|
var favicon_default = "./favicon-272ga6y0.ico";
|
|
1141
1141
|
|
|
1142
1142
|
// src/assets/manifest.schema.json
|
|
1143
|
-
var manifest_schema_default = "./manifest.schema-
|
|
1143
|
+
var manifest_schema_default = "./manifest.schema-w86c1xw1.json";
|
|
1144
1144
|
|
|
1145
1145
|
// src/assets/preview/scripts/preview-interface.js
|
|
1146
1146
|
var preview_interface_default = "./preview-interface-nnmrxyqm.js";
|
|
@@ -1161,25 +1161,25 @@ var gutterpress_viewer_default = "./gutterpress-viewer-mafsby5k.js";
|
|
|
1161
1161
|
var gutterpress_agent_default = "./gutterpress-agent-d29ry3ak.js";
|
|
1162
1162
|
|
|
1163
1163
|
// src/assets/templates/book/manifest.yaml
|
|
1164
|
-
var manifest_default = "./manifest-
|
|
1164
|
+
var manifest_default = "./manifest-41ddzm13.yaml";
|
|
1165
1165
|
|
|
1166
1166
|
// src/assets/templates/book/chapter-01.md
|
|
1167
1167
|
var chapter_01_default = "./chapter-01-gsbjt584.md";
|
|
1168
1168
|
|
|
1169
1169
|
// src/assets/templates/zine/manifest.yaml
|
|
1170
|
-
var manifest_default2 = "./manifest-
|
|
1170
|
+
var manifest_default2 = "./manifest-sqzm4681.yaml";
|
|
1171
1171
|
|
|
1172
1172
|
// src/assets/templates/zine/chapter-01.md
|
|
1173
1173
|
var chapter_01_default2 = "./chapter-01-wgjfz4w6.md";
|
|
1174
1174
|
|
|
1175
1175
|
// src/assets/templates/technical/manifest.yaml
|
|
1176
|
-
var manifest_default3 = "./manifest-
|
|
1176
|
+
var manifest_default3 = "./manifest-2kc56wvw.yaml";
|
|
1177
1177
|
|
|
1178
1178
|
// src/assets/templates/technical/chapter-01.md
|
|
1179
1179
|
var chapter_01_default3 = "./chapter-01-6fn9pvd0.md";
|
|
1180
1180
|
|
|
1181
1181
|
// src/assets/templates/paper/manifest.yaml
|
|
1182
|
-
var manifest_default4 = "./manifest-
|
|
1182
|
+
var manifest_default4 = "./manifest-79zsgkpn.yaml";
|
|
1183
1183
|
|
|
1184
1184
|
// src/assets/templates/paper/chapter-01.md
|
|
1185
1185
|
var chapter_01_default4 = "./chapter-01-s71xrf5q.md";
|
|
@@ -1212,7 +1212,7 @@ var plugin_test_js_default = "./plugin.test.js-gxzqqfdh.tpl";
|
|
|
1212
1212
|
var package_default2 = "./package-awwkt7sa.json";
|
|
1213
1213
|
|
|
1214
1214
|
// src/assets/extension-templates/look/README.md
|
|
1215
|
-
var README_default2 = "./README-
|
|
1215
|
+
var README_default2 = "./README-syg2hn83.md";
|
|
1216
1216
|
|
|
1217
1217
|
// src/assets/extension-templates/look/components.yaml
|
|
1218
1218
|
var components_default = "./components-zzqdpt3m.yaml";
|
|
@@ -1221,7 +1221,7 @@ var components_default = "./components-zzqdpt3m.yaml";
|
|
|
1221
1221
|
var callout_default = "./callout-hv56m16h.md";
|
|
1222
1222
|
|
|
1223
1223
|
// src/assets/extension-templates/look/styles/tokens.css
|
|
1224
|
-
var tokens_default = "./tokens-
|
|
1224
|
+
var tokens_default = "./tokens-n82t4k9h.css";
|
|
1225
1225
|
|
|
1226
1226
|
// src/assets/extension-templates/look/styles/base.css
|
|
1227
1227
|
var base_default = "./base-ypqh9n7f.css";
|
|
@@ -1233,7 +1233,7 @@ var components_default2 = "./components-aam0fe2z.css";
|
|
|
1233
1233
|
var page_templates_default = "./page-templates-tx9ryt19.css";
|
|
1234
1234
|
|
|
1235
1235
|
// src/assets/extension-templates/look/styles/page-rules.css
|
|
1236
|
-
var page_rules_default = "./page-rules-
|
|
1236
|
+
var page_rules_default = "./page-rules-ytj9p04v.css";
|
|
1237
1237
|
|
|
1238
1238
|
// src/assets/extension-templates/look/styles/book.css
|
|
1239
1239
|
var book_default = "./book-ted3tzrp.css";
|
|
@@ -348,6 +348,85 @@ async function unsplittableTextReasons(pdfBytes, pages) {
|
|
|
348
348
|
}
|
|
349
349
|
return reasons;
|
|
350
350
|
}
|
|
351
|
+
var FILL_PAINT_OPS = opSet(["fill", "eoFill", "fillStroke", "eoFillStroke", "closeFillStroke", "closeEOFillStroke"]);
|
|
352
|
+
var STROKE_PAINT_OPS = opSet(["stroke", "closeStroke", "fillStroke", "eoFillStroke", "closeFillStroke", "closeEOFillStroke"]);
|
|
353
|
+
var SLIVER_PT = 0.25;
|
|
354
|
+
async function pagesWithVisibleShadingPaints(pdfBytes, pages) {
|
|
355
|
+
const box = (b, m) => {
|
|
356
|
+
const xs = [];
|
|
357
|
+
const ys = [];
|
|
358
|
+
const corners = [[b[0], b[1]], [b[2], b[1]], [b[2], b[3]], [b[0], b[3]]];
|
|
359
|
+
for (const [x, y] of corners) {
|
|
360
|
+
xs.push(m[0] * x + m[2] * y + m[4]);
|
|
361
|
+
ys.push(m[1] * x + m[3] * y + m[5]);
|
|
362
|
+
}
|
|
363
|
+
return [Math.min(...xs), Math.min(...ys), Math.max(...xs), Math.max(...ys)];
|
|
364
|
+
};
|
|
365
|
+
const intersect = (a, b) => a ? [Math.max(a[0], b[0]), Math.max(a[1], b[1]), Math.min(a[2], b[2]), Math.min(a[3], b[3])] : b;
|
|
366
|
+
const visible = (b) => !b || b[2] - b[0] >= SLIVER_PT && b[3] - b[1] >= SLIVER_PT;
|
|
367
|
+
const doc = await getDocumentProxy(new Uint8Array(pdfBytes));
|
|
368
|
+
const out = [];
|
|
369
|
+
try {
|
|
370
|
+
for (const i of pages) {
|
|
371
|
+
const ops = await (await doc.getPage(i)).getOperatorList();
|
|
372
|
+
let ctm = [1, 0, 0, 1, 0, 0];
|
|
373
|
+
let clip = null;
|
|
374
|
+
let fillShading = false;
|
|
375
|
+
let strokeShading = false;
|
|
376
|
+
let pendingClip = false;
|
|
377
|
+
const stack = [];
|
|
378
|
+
let found = false;
|
|
379
|
+
for (let j = 0;j < ops.fnArray.length && !found; j++) {
|
|
380
|
+
const fn = ops.fnArray[j];
|
|
381
|
+
const args = ops.argsArray[j];
|
|
382
|
+
if (fn === OPS.save)
|
|
383
|
+
stack.push([ctm, clip, fillShading, strokeShading]);
|
|
384
|
+
else if (fn === OPS.restore || fn === OPS.paintFormXObjectEnd) {
|
|
385
|
+
const saved = stack.pop();
|
|
386
|
+
if (saved)
|
|
387
|
+
[ctm, clip, fillShading, strokeShading] = saved;
|
|
388
|
+
} else if (fn === OPS.transform)
|
|
389
|
+
ctm = multiply(ctm, args);
|
|
390
|
+
else if (fn === OPS.paintFormXObjectBegin) {
|
|
391
|
+
stack.push([ctm, clip, fillShading, strokeShading]);
|
|
392
|
+
if (Array.isArray(args[0]))
|
|
393
|
+
ctm = multiply(ctm, args[0]);
|
|
394
|
+
if (Array.isArray(args[1]))
|
|
395
|
+
clip = intersect(clip, box(args[1], ctm));
|
|
396
|
+
} else if (fn === OPS.setFillColorN)
|
|
397
|
+
fillShading = args[0] === "Shading";
|
|
398
|
+
else if (fn === OPS.setStrokeColorN)
|
|
399
|
+
strokeShading = args[0] === "Shading";
|
|
400
|
+
else if (FILL_COLOR_OPS.has(fn))
|
|
401
|
+
fillShading = false;
|
|
402
|
+
else if (STROKE_COLOR_OPS.has(fn))
|
|
403
|
+
strokeShading = false;
|
|
404
|
+
else if (fn === OPS.clip || fn === OPS.eoClip)
|
|
405
|
+
pendingClip = true;
|
|
406
|
+
else if (fn === OPS.constructPath) {
|
|
407
|
+
const paintOp = args[0];
|
|
408
|
+
const bounds = args[2] ? box(args[2], ctm) : null;
|
|
409
|
+
if (fillShading && FILL_PAINT_OPS.has(paintOp) && bounds)
|
|
410
|
+
found = visible(intersect(clip, bounds));
|
|
411
|
+
if (strokeShading && STROKE_PAINT_OPS.has(paintOp))
|
|
412
|
+
found = true;
|
|
413
|
+
if (pendingClip) {
|
|
414
|
+
clip = bounds ? intersect(clip, bounds) : [0, 0, 0, 0];
|
|
415
|
+
pendingClip = false;
|
|
416
|
+
}
|
|
417
|
+
} else if (fn === OPS.shadingFill)
|
|
418
|
+
found = visible(clip);
|
|
419
|
+
else if (SHOW_TEXT_OPS.has(fn) && fillShading)
|
|
420
|
+
found = true;
|
|
421
|
+
}
|
|
422
|
+
if (found)
|
|
423
|
+
out.push(i);
|
|
424
|
+
}
|
|
425
|
+
} finally {
|
|
426
|
+
await doc.destroy();
|
|
427
|
+
}
|
|
428
|
+
return out;
|
|
429
|
+
}
|
|
351
430
|
function getImagePixelSize(page, name, timeoutMs = 2000) {
|
|
352
431
|
return new Promise((resolve) => {
|
|
353
432
|
let done = false;
|
|
@@ -435,4 +514,4 @@ async function isLoadable(doc) {
|
|
|
435
514
|
}
|
|
436
515
|
}
|
|
437
516
|
|
|
438
|
-
export { DOC_CACHE_MAX, loadPdf, retainPdfCache, clearPdfCache, pendingGraceDestroyCount, getPageSize, getOutlineCount, getPageLabels, countLinkAnnotations, getTextPass, getOpPass, unsplittableTextReasons, pageHasMarks, getImageResolutions, isLoadable };
|
|
517
|
+
export { DOC_CACHE_MAX, loadPdf, retainPdfCache, clearPdfCache, pendingGraceDestroyCount, getPageSize, getOutlineCount, getPageLabels, countLinkAnnotations, getTextPass, getOpPass, unsplittableTextReasons, pagesWithVisibleShadingPaints, pageHasMarks, getImageResolutions, isLoadable };
|