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.
Files changed (69) hide show
  1. package/README.md +4 -6
  2. package/dist/{README-8db7btxb.md → README-syg2hn83.md} +1 -1
  3. package/dist/api/index.js +5 -5
  4. package/dist/{build-m78jcpf7.js → build-c48eer6f.js} +8 -8
  5. package/dist/checks/asset/extensions.d.ts +1 -1
  6. package/dist/checks/asset/index.d.ts +0 -1
  7. package/dist/checks/policy.d.ts +5 -4
  8. package/dist/checks/source/config-file.d.ts +9 -6
  9. package/dist/checks/source/dangling-links.d.ts +1 -1
  10. package/dist/checks/types.d.ts +2 -2
  11. package/dist/{cli-xsrffqzt.js → cli-54xt7pjg.js} +8 -8
  12. package/dist/{cli-2ppw6q9v.js → cli-5crpmz42.js} +80 -1
  13. package/dist/{cli-1h17ktsg.js → cli-93mkaw6v.js} +96 -209
  14. package/dist/{cli-n2tsxqpn.js → cli-d9mm3vvh.js} +7 -2
  15. package/dist/{cli-5jzyw06s.js → cli-gnpea9dx.js} +1 -1
  16. package/dist/{cli-s6djx4ma.js → cli-pspjxnc8.js} +1 -1
  17. package/dist/{cli-t8be9yeb.js → cli-rqh295j9.js} +12 -7
  18. package/dist/{cli-h4x81x97.js → cli-y6d1arem.js} +207 -142
  19. package/dist/cli.js +12 -12
  20. package/dist/{doctor-j71jqce3.js → doctor-ptb346k8.js} +4 -3
  21. package/dist/{engine-m4y10shc.js → engine-4rzdx6af.js} +1 -1
  22. package/dist/{engine-1r6q80tq.js → engine-6txhxmmv.js} +2 -2
  23. package/dist/{ext-fq2hg9va.js → ext-gy8szg3x.js} +8 -8
  24. package/dist/{extension-restore-9dh7c4tp.js → extension-restore-dymzcasz.js} +2 -2
  25. package/dist/{extension-restore-tmxtzkm0.js → extension-restore-m8tj43e7.js} +4 -4
  26. package/dist/{index-2ppw6q9v.js → index-5crpmz42.js} +80 -1
  27. package/dist/{index-nedd07bk.js → index-5kh4c78h.js} +8 -8
  28. package/dist/{index-0wee4408.js → index-8ywkd2sv.js} +12 -7
  29. package/dist/{index-prqvz3xm.js → index-ea94zbq4.js} +132 -228
  30. package/dist/{index-7pck1q9c.js → index-kaks3mm2.js} +206 -141
  31. package/dist/{index-nvmf22rt.js → index-yc3xj266.js} +1 -1
  32. package/dist/index.js +6 -6
  33. package/dist/lib/build-preflight.d.ts +4 -10
  34. package/dist/lib/build-runner.d.ts +1 -1
  35. package/dist/lib/ghostscript.d.ts +5 -2
  36. package/dist/lib/lint-rules.d.ts +5 -1
  37. package/dist/lib/manifest-config.d.ts +3 -2
  38. package/dist/lib/manifest-old-spellings.d.ts +64 -0
  39. package/dist/lib/markdown/chapter-id.d.ts +1 -1
  40. package/dist/lib/markdown/index.d.ts +1 -1
  41. package/dist/lib/markdown/table.d.ts +5 -3
  42. package/dist/lib/page-size.d.ts +14 -9
  43. package/dist/lib/pdf-inspect.d.ts +27 -0
  44. package/dist/lib/presets.d.ts +10 -8
  45. package/dist/lib/printsafe.d.ts +1 -1
  46. package/dist/lib/project-scaffold.d.ts +1 -1
  47. package/dist/lib/remote-auth/sync-messages.d.ts +2 -2
  48. package/dist/lib/targets.d.ts +4 -4
  49. package/dist/lib/validation-exec.d.ts +4 -4
  50. package/dist/{manifest-my7mdv8j.yaml → manifest-2kc56wvw.yaml} +3 -4
  51. package/dist/{manifest-8afhrk30.yaml → manifest-41ddzm13.yaml} +3 -4
  52. package/dist/{manifest-gf13sjp8.yaml → manifest-79zsgkpn.yaml} +3 -4
  53. package/dist/{manifest-d4f9q79e.yaml → manifest-sqzm4681.yaml} +3 -4
  54. package/dist/{manifest.schema-650pe0d1.json → manifest.schema-w86c1xw1.json} +19 -309
  55. package/dist/{new-s4zcaepg.js → new-t2t28ccb.js} +9 -15
  56. package/dist/{page-rules-fj09xct5.css → page-rules-ytj9p04v.css} +1 -1
  57. package/dist/{pdf-inspect-wnw4za71.js → pdf-inspect-b3mf81ex.js} +3 -1
  58. package/dist/{plugins-80emnf31.js → plugins-fec8t2bh.js} +1 -1
  59. package/dist/{plugins-4vaf27n9.js → plugins-sqa4msdk.js} +3 -3
  60. package/dist/{preflight-c7w1xdn3.js → preflight-srq8fktp.js} +8 -8
  61. package/dist/preview/file-watcher.d.ts +1 -3
  62. package/dist/{preview-mzytcwyk.js → preview-zsp9hstd.js} +8 -8
  63. package/dist/{publish-fez14ad4.js → publish-hhy31gr9.js} +8 -8
  64. package/dist/render.js +6 -1
  65. package/dist/schema/manifest.types.d.ts +40 -107
  66. package/dist/{tokens-ye64p899.css → tokens-n82t4k9h.css} +11 -4
  67. package/dist/{validate-p2chr6hr.js → validate-r9jdz85h.js} +8 -8
  68. package/package.json +1 -1
  69. package/dist/checks/asset/approved-fonts.d.ts +0 -3
@@ -1,16 +1,17 @@
1
1
  import {
2
2
  getSystemDiagnostics
3
- } from "./cli-n2tsxqpn.js";
3
+ } from "./cli-d9mm3vvh.js";
4
+ import"./cli-5crpmz42.js";
4
5
  import"./cli-asap4t1z.js";
5
6
  import {
6
7
  log
7
- } from "./cli-s6djx4ma.js";
8
+ } from "./cli-pspjxnc8.js";
8
9
  import {
9
10
  UsageError,
10
11
  rejectExtraPositionals,
11
12
  rejectUnknownFlags
12
13
  } from "./cli-d8xjns66.js";
13
- import"./cli-5jzyw06s.js";
14
+ import"./cli-gnpea9dx.js";
14
15
  import"./cli-46ycxe6r.js";
15
16
  import"./cli-37x76zdn.js";
16
17
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  build
3
- } from "./cli-xsrffqzt.js";
3
+ } from "./cli-54xt7pjg.js";
4
4
  import"./cli-eyyggect.js";
5
5
  import"./cli-asap4t1z.js";
6
6
  import {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  build
3
- } from "./index-nvmf22rt.js";
4
- import"./index-nedd07bk.js";
3
+ } from "./index-yc3xj266.js";
4
+ import"./index-5kh4c78h.js";
5
5
  import {
6
6
  BuildError
7
7
  } from "./index-46ycxe6r.js";
@@ -2,11 +2,11 @@ import {
2
2
  importExtensionFromFile,
3
3
  importExtensionFromUrl,
4
4
  searchNpmExtensions
5
- } from "./cli-1h17ktsg.js";
6
- import"./cli-n2tsxqpn.js";
5
+ } from "./cli-93mkaw6v.js";
6
+ import"./cli-d9mm3vvh.js";
7
7
  import"./cli-ht1bcqdd.js";
8
- import"./cli-xsrffqzt.js";
9
- import"./cli-2ppw6q9v.js";
8
+ import"./cli-54xt7pjg.js";
9
+ import"./cli-5crpmz42.js";
10
10
  import"./cli-eyyggect.js";
11
11
  import"./cli-asap4t1z.js";
12
12
  import"./cli-a35w7wzg.js";
@@ -18,12 +18,12 @@ import {
18
18
  removeExtension,
19
19
  setExtensionEnabled,
20
20
  updateExtensions
21
- } from "./cli-h4x81x97.js";
21
+ } from "./cli-y6d1arem.js";
22
22
  import {
23
23
  isPathSpecifier,
24
24
  parseExtensionSpecifier
25
- } from "./cli-t8be9yeb.js";
26
- import"./cli-s6djx4ma.js";
25
+ } from "./cli-rqh295j9.js";
26
+ import"./cli-pspjxnc8.js";
27
27
  import {
28
28
  UsageError,
29
29
  exitForUsage,
@@ -31,7 +31,7 @@ import {
31
31
  rejectUnknownFlags,
32
32
  resolveProjectDir
33
33
  } from "./cli-d8xjns66.js";
34
- import"./cli-5jzyw06s.js";
34
+ import"./cli-gnpea9dx.js";
35
35
  import {
36
36
  EXIT_CODES
37
37
  } from "./cli-46ycxe6r.js";
@@ -3,8 +3,8 @@ import {
3
3
  restoreForCommand,
4
4
  restoreOfflineMessage,
5
5
  restorePinnedExtensions
6
- } from "./index-7pck1q9c.js";
7
- import"./index-0wee4408.js";
6
+ } from "./index-kaks3mm2.js";
7
+ import"./index-8ywkd2sv.js";
8
8
  import"./index-46ycxe6r.js";
9
9
  import"./index-5x42amh8.js";
10
10
  import"./index-37x76zdn.js";
@@ -3,11 +3,11 @@ import {
3
3
  restoreForCommand,
4
4
  restoreOfflineMessage,
5
5
  restorePinnedExtensions
6
- } from "./cli-h4x81x97.js";
7
- import"./cli-t8be9yeb.js";
8
- import"./cli-s6djx4ma.js";
6
+ } from "./cli-y6d1arem.js";
7
+ import"./cli-rqh295j9.js";
8
+ import"./cli-pspjxnc8.js";
9
9
  import"./cli-d8xjns66.js";
10
- import"./cli-5jzyw06s.js";
10
+ import"./cli-gnpea9dx.js";
11
11
  import"./cli-46ycxe6r.js";
12
12
  import"./cli-y28j019d.js";
13
13
  import"./cli-37x76zdn.js";
@@ -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 };
@@ -697,7 +697,7 @@ import { fileURLToPath } from "node:url";
697
697
  var favicon_default = "./favicon-272ga6y0.ico";
698
698
 
699
699
  // src/assets/manifest.schema.json
700
- var manifest_schema_default = "./manifest.schema-650pe0d1.json";
700
+ var manifest_schema_default = "./manifest.schema-w86c1xw1.json";
701
701
 
702
702
  // src/assets/preview/scripts/preview-interface.js
703
703
  var preview_interface_default = "./preview-interface-nnmrxyqm.js";
@@ -718,25 +718,25 @@ var gutterpress_viewer_default = "./gutterpress-viewer-mafsby5k.js";
718
718
  var gutterpress_agent_default = "./gutterpress-agent-d29ry3ak.js";
719
719
 
720
720
  // src/assets/templates/book/manifest.yaml
721
- var manifest_default = "./manifest-8afhrk30.yaml";
721
+ var manifest_default = "./manifest-41ddzm13.yaml";
722
722
 
723
723
  // src/assets/templates/book/chapter-01.md
724
724
  var chapter_01_default = "./chapter-01-gsbjt584.md";
725
725
 
726
726
  // src/assets/templates/zine/manifest.yaml
727
- var manifest_default2 = "./manifest-d4f9q79e.yaml";
727
+ var manifest_default2 = "./manifest-sqzm4681.yaml";
728
728
 
729
729
  // src/assets/templates/zine/chapter-01.md
730
730
  var chapter_01_default2 = "./chapter-01-wgjfz4w6.md";
731
731
 
732
732
  // src/assets/templates/technical/manifest.yaml
733
- var manifest_default3 = "./manifest-my7mdv8j.yaml";
733
+ var manifest_default3 = "./manifest-2kc56wvw.yaml";
734
734
 
735
735
  // src/assets/templates/technical/chapter-01.md
736
736
  var chapter_01_default3 = "./chapter-01-6fn9pvd0.md";
737
737
 
738
738
  // src/assets/templates/paper/manifest.yaml
739
- var manifest_default4 = "./manifest-gf13sjp8.yaml";
739
+ var manifest_default4 = "./manifest-79zsgkpn.yaml";
740
740
 
741
741
  // src/assets/templates/paper/chapter-01.md
742
742
  var chapter_01_default4 = "./chapter-01-s71xrf5q.md";
@@ -769,7 +769,7 @@ var plugin_test_js_default = "./plugin.test.js-gxzqqfdh.tpl";
769
769
  var package_default2 = "./package-awwkt7sa.json";
770
770
 
771
771
  // src/assets/extension-templates/look/README.md
772
- var README_default2 = "./README-8db7btxb.md";
772
+ var README_default2 = "./README-syg2hn83.md";
773
773
 
774
774
  // src/assets/extension-templates/look/components.yaml
775
775
  var components_default = "./components-zzqdpt3m.yaml";
@@ -778,7 +778,7 @@ var components_default = "./components-zzqdpt3m.yaml";
778
778
  var callout_default = "./callout-hv56m16h.md";
779
779
 
780
780
  // src/assets/extension-templates/look/styles/tokens.css
781
- var tokens_default = "./tokens-ye64p899.css";
781
+ var tokens_default = "./tokens-n82t4k9h.css";
782
782
 
783
783
  // src/assets/extension-templates/look/styles/base.css
784
784
  var base_default = "./base-ypqh9n7f.css";
@@ -790,7 +790,7 @@ var components_default2 = "./components-aam0fe2z.css";
790
790
  var page_templates_default = "./page-templates-tx9ryt19.css";
791
791
 
792
792
  // src/assets/extension-templates/look/styles/page-rules.css
793
- var page_rules_default = "./page-rules-fj09xct5.css";
793
+ var page_rules_default = "./page-rules-ytj9p04v.css";
794
794
 
795
795
  // src/assets/extension-templates/look/styles/book.css
796
796
  var book_default = "./book-ted3tzrp.css";
@@ -20,7 +20,7 @@ import { pathToFileURL } from "node:url";
20
20
  var theme_default = `/* =============================================================================
21
21
  Clean Book — gutterpress built-in theme (theme.css)
22
22
  A calm, classic long-form book look. Change the :root tokens from the book's own stylesheet.
23
- The page SIZE comes from the manifest (Setup > Details), so it is deliberately not set here.
23
+ The page SIZE comes from the manifest (Setup > Book), so it is deliberately not set here.
24
24
  ============================================================================= */
25
25
 
26
26
  :root {
@@ -79,7 +79,7 @@ hr { border: 0; border-top: 1px solid var(--color-rule); margin: 1.5em 0; }
79
79
  var theme_default2 = `/* =============================================================================
80
80
  Zine — gutterpress built-in theme (theme.css)
81
81
  High-contrast, punchy, photocopier-friendly. Change the :root tokens from the book's own stylesheet.
82
- The page SIZE comes from the manifest (Setup > Details), so it is deliberately not set here.
82
+ The page SIZE comes from the manifest (Setup > Book), so it is deliberately not set here.
83
83
  ============================================================================= */
84
84
 
85
85
  :root {
@@ -140,7 +140,7 @@ code, pre { font-family: var(--font-mono); font-size: 0.95em; }
140
140
  var theme_default3 = `/* =============================================================================
141
141
  Technical Document — gutterpress built-in theme (theme.css)
142
142
  Clean sans-serif manual look with clear hierarchy. Change the :root tokens from the book's own stylesheet.
143
- The page SIZE comes from the manifest (Setup > Details), so it is deliberately not set here.
143
+ The page SIZE comes from the manifest (Setup > Book), so it is deliberately not set here.
144
144
  ============================================================================= */
145
145
 
146
146
  :root {
@@ -398,7 +398,7 @@ import { satisfies, validRange } from "semver";
398
398
  // package.json
399
399
  var package_default = {
400
400
  name: "gutterpress",
401
- version: "0.11.23-alpha.3",
401
+ version: "0.11.23-alpha.4",
402
402
  description: "Markdown-to-PDF converter for professional print layout using a native Chromium print engine and Ghostscript.",
403
403
  author: "itlackey",
404
404
  license: "MPL-2.0",
@@ -2507,7 +2507,12 @@ function splitCells(str2, spans) {
2507
2507
  lastPos = pos;
2508
2508
  }
2509
2509
  } else if (!isEscaped && spans[ch]) {
2510
- pos = spans[ch](str2, pos, max);
2510
+ const end = spans[ch](str2, pos, max);
2511
+ if (ch === 96) {
2512
+ current += str2.substring(lastPos, pos) + str2.substring(pos, end).replace(/\\\|/g, "|");
2513
+ lastPos = end;
2514
+ }
2515
+ pos = end;
2511
2516
  continue;
2512
2517
  }
2513
2518
  isEscaped = ch === 92;
@@ -3742,9 +3747,9 @@ async function loadNpmPackage(packageName, baseDir, version) {
3742
3747
  const looksLikeJsFilename = /\.(m?js|cjs)$/i.test(packageName);
3743
3748
  const suggestedPath = looksLikeJsFilename ? `./${packageName}` : `./plugins/${packageName}.js`;
3744
3749
  if (!looksLikeJsFilename && (!version || !isExactNpmVersion(version))) {
3745
- throw new Error(`Extension "${packageName}${version ? `@${version}` : ""}" is not pinned to an exact version, so it can't be downloaded automatically. Run \`gutterpress ext add ${packageName}\` (or use Book setup > Looks & features > Advanced in the desktop app) to download it and pin its version in your manifest.`);
3750
+ throw new Error(`Extension "${packageName}${version ? `@${version}` : ""}" is not pinned to an exact version, so it can't be downloaded automatically. Run \`gutterpress ext add ${packageName}\` (or use Book setup > Advanced in the desktop app) to download it and pin its version in your manifest.`);
3746
3751
  }
3747
- throw new Error(`Extension "${packageName}" not found. Install it with \`gutterpress ext add ${version ? `${packageName}@${version}` : packageName}\` (or Book setup > Looks & features > Advanced in the desktop app),
3752
+ throw new Error(`Extension "${packageName}" not found. Install it with \`gutterpress ext add ${version ? `${packageName}@${version}` : packageName}\` (or Book setup > Advanced in the desktop app),
3748
3753
  or reference a local file under \`extensions:\`:
3749
3754
  extensions:
3750
3755
  - ${suggestedPath}`);