postext 1.34.1 → 1.35.1

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 (94) hide show
  1. package/dist/__tests__/composed/fixtures/page8.d.ts.map +1 -1
  2. package/dist/__tests__/composed/fixtures/page8.js +6 -3
  3. package/dist/__tests__/composed/fixtures/page8.js.map +1 -1
  4. package/dist/__tests__/composed/fixtures/timeline.d.ts +26 -0
  5. package/dist/__tests__/composed/fixtures/timeline.d.ts.map +1 -0
  6. package/dist/__tests__/composed/fixtures/timeline.js +153 -0
  7. package/dist/__tests__/composed/fixtures/timeline.js.map +1 -0
  8. package/dist/__tests__/composed/groups.test.d.ts +2 -0
  9. package/dist/__tests__/composed/groups.test.d.ts.map +1 -0
  10. package/dist/__tests__/composed/groups.test.js +361 -0
  11. package/dist/__tests__/composed/groups.test.js.map +1 -0
  12. package/dist/__tests__/composed/outsidePrint.test.d.ts +2 -0
  13. package/dist/__tests__/composed/outsidePrint.test.d.ts.map +1 -0
  14. package/dist/__tests__/composed/outsidePrint.test.js +116 -0
  15. package/dist/__tests__/composed/outsidePrint.test.js.map +1 -0
  16. package/dist/__tests__/composed/spread.test.d.ts +2 -0
  17. package/dist/__tests__/composed/spread.test.d.ts.map +1 -0
  18. package/dist/__tests__/composed/spread.test.js +475 -0
  19. package/dist/__tests__/composed/spread.test.js.map +1 -0
  20. package/dist/__tests__/composedPaint.test.js +10 -2
  21. package/dist/__tests__/composedPaint.test.js.map +1 -1
  22. package/dist/__tests__/exports.test.js +13 -0
  23. package/dist/__tests__/exports.test.js.map +1 -1
  24. package/dist/canvas-backend/composed.d.ts +5 -1
  25. package/dist/canvas-backend/composed.d.ts.map +1 -1
  26. package/dist/canvas-backend/composed.js +28 -1
  27. package/dist/canvas-backend/composed.js.map +1 -1
  28. package/dist/canvas-backend/index.js +2 -2
  29. package/dist/canvas-backend/index.js.map +1 -1
  30. package/dist/composed/groups.d.ts +95 -0
  31. package/dist/composed/groups.d.ts.map +1 -0
  32. package/dist/composed/groups.js +359 -0
  33. package/dist/composed/groups.js.map +1 -0
  34. package/dist/composed/labelText.d.ts +15 -0
  35. package/dist/composed/labelText.d.ts.map +1 -0
  36. package/dist/composed/labelText.js +16 -0
  37. package/dist/composed/labelText.js.map +1 -0
  38. package/dist/composed/paint.d.ts +25 -2
  39. package/dist/composed/paint.d.ts.map +1 -1
  40. package/dist/composed/paint.js +46 -1
  41. package/dist/composed/paint.js.map +1 -1
  42. package/dist/composed/reflowLog.d.ts +39 -0
  43. package/dist/composed/reflowLog.d.ts.map +1 -0
  44. package/dist/composed/reflowLog.js +123 -0
  45. package/dist/composed/reflowLog.js.map +1 -0
  46. package/dist/composed/slotChecks.d.ts +7 -2
  47. package/dist/composed/slotChecks.d.ts.map +1 -1
  48. package/dist/composed/slotChecks.js +21 -0
  49. package/dist/composed/slotChecks.js.map +1 -1
  50. package/dist/composed/spread.d.ts +106 -0
  51. package/dist/composed/spread.d.ts.map +1 -0
  52. package/dist/composed/spread.js +178 -0
  53. package/dist/composed/spread.js.map +1 -0
  54. package/dist/defaults/headerFooter.d.ts.map +1 -1
  55. package/dist/defaults/headerFooter.js +4 -0
  56. package/dist/defaults/headerFooter.js.map +1 -1
  57. package/dist/design/layout.d.ts +9 -0
  58. package/dist/design/layout.d.ts.map +1 -1
  59. package/dist/design/layout.js +1 -1
  60. package/dist/design/layout.js.map +1 -1
  61. package/dist/html-backend.d.ts.map +1 -1
  62. package/dist/html-backend.js +56 -26
  63. package/dist/html-backend.js.map +1 -1
  64. package/dist/index.d.ts +9 -2
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +9 -1
  67. package/dist/index.js.map +1 -1
  68. package/dist/pipeline/build.d.ts.map +1 -1
  69. package/dist/pipeline/build.js +76 -20
  70. package/dist/pipeline/build.js.map +1 -1
  71. package/dist/pipeline/buildMeasurement.d.ts +4 -1
  72. package/dist/pipeline/buildMeasurement.d.ts.map +1 -1
  73. package/dist/pipeline/buildMeasurement.js +19 -1
  74. package/dist/pipeline/buildMeasurement.js.map +1 -1
  75. package/dist/pipeline/calloutLayout.d.ts +3 -1
  76. package/dist/pipeline/calloutLayout.d.ts.map +1 -1
  77. package/dist/pipeline/calloutLayout.js +2 -1
  78. package/dist/pipeline/calloutLayout.js.map +1 -1
  79. package/dist/pipeline/composedLayout.d.ts +6 -1
  80. package/dist/pipeline/composedLayout.d.ts.map +1 -1
  81. package/dist/pipeline/composedLayout.js +223 -23
  82. package/dist/pipeline/composedLayout.js.map +1 -1
  83. package/dist/pipeline/contentWarnings.d.ts.map +1 -1
  84. package/dist/pipeline/contentWarnings.js +7 -1
  85. package/dist/pipeline/contentWarnings.js.map +1 -1
  86. package/dist/pipeline/headerFooter.d.ts.map +1 -1
  87. package/dist/pipeline/headerFooter.js +55 -7
  88. package/dist/pipeline/headerFooter.js.map +1 -1
  89. package/dist/types.d.ts +20 -0
  90. package/dist/types.d.ts.map +1 -1
  91. package/dist/vdt.d.ts +83 -5
  92. package/dist/vdt.d.ts.map +1 -1
  93. package/dist/vdt.js.map +1 -1
  94. package/package.json +1 -1
@@ -0,0 +1,123 @@
1
+ /** Smallest change the log reports, in millimetres. */
2
+ const MIN_MM = 0.5;
3
+ /** To 0.1 mm; a hair over the half rounds up, so two lengths that differ
4
+ * only in float noise round alike. */
5
+ const round = (mm) => Math.round(mm * 10 + (mm >= 0 ? 1e-6 : -1e-6)) / 10;
6
+ /** The events of a page's frames, in `motions` order (template order):
7
+ * per frame its size first (height, then width), then its moves. */
8
+ export function reflowEvents(motions, pxPerMm) {
9
+ const mm = (v) => v / pxPerMm;
10
+ const sized = new Set();
11
+ const moved = new Set();
12
+ for (const m of motions) {
13
+ if (Math.abs(mm(m.final.height - m.declared.height)) >= MIN_MM || Math.abs(mm(m.final.width - m.declared.width)) >= MIN_MM)
14
+ sized.add(m.name);
15
+ if (Math.abs(mm(m.final.y - m.declared.y)) >= MIN_MM || Math.abs(mm(m.final.x - m.declared.x)) >= MIN_MM)
16
+ moved.add(m.name);
17
+ }
18
+ const byName = new Map(motions.map((m) => [m.name, m]));
19
+ const causes = new Map();
20
+ /** The frame whose change set this one off: the nearest dependency that
21
+ * changed size, else the cause of the nearest one that moved. */
22
+ const causeOf = (name, seen = new Set()) => {
23
+ if (causes.has(name))
24
+ return causes.get(name);
25
+ if (seen.has(name))
26
+ return undefined;
27
+ seen.add(name);
28
+ const deps = byName.get(name)?.deps ?? [];
29
+ let found = deps.find((d) => sized.has(d) && d !== name);
30
+ if (!found) {
31
+ const via = deps.find((d) => moved.has(d) && d !== name);
32
+ if (via)
33
+ found = causeOf(via, seen) ?? via;
34
+ }
35
+ causes.set(name, found);
36
+ return found;
37
+ };
38
+ /** Both ends in mm, the change rounded once: «moved down 3.4 mm» reads
39
+ * the same off any two frames that moved together. */
40
+ const span = (from, to) => {
41
+ const fromMm = round(mm(from));
42
+ return { fromMm, toMm: round(fromMm + round(mm(to - from))) };
43
+ };
44
+ const out = [];
45
+ for (const m of motions) {
46
+ const cause = causeOf(m.name);
47
+ const withCause = cause !== undefined ? { cause } : {};
48
+ const size = (from, to, axis) => {
49
+ if (Math.abs(mm(to - from)) < MIN_MM)
50
+ return;
51
+ const grew = to > from;
52
+ out.push({
53
+ frame: m.name,
54
+ kind: grew ? 'grew' : 'resized',
55
+ ...span(from, to),
56
+ ...(axis === 'x' ? { axis } : {}),
57
+ // A frame grows for its own content; one that gives space back
58
+ // does so for another's.
59
+ ...(grew ? {} : withCause),
60
+ });
61
+ };
62
+ size(m.declared.height, m.final.height, 'y');
63
+ size(m.declared.width, m.final.width, 'x');
64
+ const move = (from, to, axis) => {
65
+ if (Math.abs(mm(to - from)) < MIN_MM)
66
+ return;
67
+ out.push({ frame: m.name, kind: 'moved', ...span(from, to), ...(axis === 'x' ? { axis } : {}), ...withCause });
68
+ };
69
+ move(m.declared.y, m.final.y, 'y');
70
+ move(m.declared.x, m.final.x, 'x');
71
+ }
72
+ return out;
73
+ }
74
+ const num = (v) => String(Math.round(v * 10) / 10);
75
+ /** One event in words, in English (the command line's language):
76
+ * «dinero grew 8 mm», «gasto moved down 8 mm», «foto narrowed 4 mm». */
77
+ export function describeReflowEvent(e) {
78
+ const delta = e.fromMm !== undefined && e.toMm !== undefined ? Math.abs(e.toMm - e.fromMm) : undefined;
79
+ const by = delta !== undefined ? ` ${num(delta)} mm` : '';
80
+ const x = e.axis === 'x';
81
+ switch (e.kind) {
82
+ case 'grew':
83
+ return `${e.frame} grew${by}${x ? ' wider' : ''}`;
84
+ case 'resized':
85
+ if (e.fromMm !== undefined && e.toMm !== undefined && e.toMm < e.fromMm)
86
+ return `${e.frame} ${x ? 'narrowed' : 'gave up'}${by}${e.cause ? ` for ${e.cause}` : ''}`;
87
+ return `${e.frame} resized to ${num(e.toMm ?? 0)} mm`;
88
+ case 'moved': {
89
+ const forward = (e.toMm ?? 0) > (e.fromMm ?? 0);
90
+ const dir = x ? (forward ? 'right' : 'left') : forward ? 'down' : 'up';
91
+ return `${e.frame} moved ${dir}${by}`;
92
+ }
93
+ case 'overflow':
94
+ return `${e.frame} overflows by ${num(e.toMm ?? 0)} mm`;
95
+ case 'imageScaled':
96
+ return `${e.frame}: picture at ${Math.round((e.scale ?? 1) * 100)} %`;
97
+ case 'textScaled':
98
+ return `${e.frame}: text at ${Math.round((e.scale ?? 1) * 100)} %`;
99
+ case 'continued':
100
+ return `${e.frame} continued${e.cause ? ` in ${e.cause}` : ''}`;
101
+ default:
102
+ return `${e.frame} ${String(e.kind)}`;
103
+ }
104
+ }
105
+ /** The reflow log of every composed page of `doc` that has one. */
106
+ export function composedReflowLog(doc) {
107
+ const out = [];
108
+ for (const page of doc.pages) {
109
+ const c = page.composed;
110
+ if (!c || c.log.length === 0)
111
+ continue;
112
+ out.push({
113
+ pageIndex: page.index,
114
+ pageLabel: String(page.pageLabel ?? page.pageNumberValue ?? page.index + 1),
115
+ template: c.template,
116
+ fenceIndex: c.fenceIndex,
117
+ events: c.log.map((e) => ({ ...e })),
118
+ lines: c.log.map(describeReflowEvent),
119
+ });
120
+ }
121
+ return out;
122
+ }
123
+ //# sourceMappingURL=reflowLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflowLog.js","sourceRoot":"","sources":["../../src/composed/reflowLog.ts"],"names":[],"mappings":"AAoBA,uDAAuD;AACvD,MAAM,MAAM,GAAG,GAAG,CAAC;AAEnB;uCACuC;AACvC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;AAE1F;qEACqE;AACrE,MAAM,UAAU,YAAY,CAAC,OAA+B,EAAE,OAAe;IAC3E,MAAM,EAAE,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC;IAC9C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,MAAM;YAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9I,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,IAAI,IAAI,CAAC,GA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AAG,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACvC,GAAG,CAAC,IAAI,CAAC;YACP,SAAS,EAAE,IAAI,CAAC,KAAK;YACrB,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;YAC3E,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;YACpC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC;SACtC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Content warnings of composed pages (#854, DESIGN §3.2, §5.7): a page
3
3
  * fence naming no template, a slot the template lacks, a template frame
4
- * that receives nothing. Pure: read from the parsed pages and the
4
+ * that receives nothing, a fence and a template that disagree about
5
+ * spreads (#861). Pure: read from the parsed pages and the
5
6
  * configuration, before any layout.
6
7
  */
7
8
  import type { ContentWarning } from '../vdt';
@@ -10,7 +11,7 @@ import type { ComposedPagesConfigKeys } from './types';
10
11
  /** The composed-page warnings, as {@link checkComposedSlots} returns them
11
12
  * (source offsets as in the pages it read). */
12
13
  export type ComposedSlotWarning = Extract<ContentWarning, {
13
- kind: 'templateUnknown' | 'slotUnknown' | 'slotEmpty';
14
+ kind: 'templateUnknown' | 'slotUnknown' | 'slotEmpty' | 'spreadMismatch';
14
15
  }>;
15
16
  /**
16
17
  * `templateUnknown`, `slotUnknown` and `slotEmpty` for each page:
@@ -24,6 +25,10 @@ export type ComposedSlotWarning = Extract<ContentWarning, {
24
25
  * without a slot). Not raised for an `optional` frame, nor for a frame
25
26
  * other frames continue into (`next`, `overflow.continueIn: '#x'`),
26
27
  * which fills only when they overflow.
28
+ * - `spreadMismatch`: the fence's `spread` flag and the template's `spread`
29
+ * (inherited through `extends`) differ. The template decides: a spread
30
+ * template is laid over two facing pages, any other on one page. Points
31
+ * at the `spread` attribute, else the `template` value.
27
32
  */
28
33
  export declare function checkComposedSlots(pages: readonly ParsedComposedPage[], config: Pick<ComposedPagesConfigKeys, 'pageTemplates'> | undefined): ComposedSlotWarning[];
29
34
  //# sourceMappingURL=slotChecks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"slotChecks.d.ts","sourceRoot":"","sources":["../../src/composed/slotChecks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,uBAAuB,EAA6B,MAAM,SAAS,CAAC;AAElF;gDACgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,iBAAiB,GAAG,aAAa,GAAG,WAAW,CAAA;CAAE,CAAC,CAAC;AAsCrH;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,kBAAkB,EAAE,EACpC,MAAM,EAAE,IAAI,CAAC,uBAAuB,EAAE,eAAe,CAAC,GAAG,SAAS,GACjE,mBAAmB,EAAE,CA+CvB"}
1
+ {"version":3,"file":"slotChecks.d.ts","sourceRoot":"","sources":["../../src/composed/slotChecks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,uBAAuB,EAA6B,MAAM,SAAS,CAAC;AAElF;gDACgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,iBAAiB,GAAG,aAAa,GAAG,WAAW,GAAG,gBAAgB,CAAA;CAAE,CAAC,CAAC;AAiDxI;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,kBAAkB,EAAE,EACpC,MAAM,EAAE,IAAI,CAAC,uBAAuB,EAAE,eAAe,CAAC,GAAG,SAAS,GACjE,mBAAmB,EAAE,CAqDvB"}
@@ -26,6 +26,17 @@ function templateFrames(template, byId) {
26
26
  }
27
27
  return [...frames.values()];
28
28
  }
29
+ /** Whether a template is a spread: its own `spread`, else the nearest
30
+ * ancestor's through `extends` (the key is inherited). */
31
+ function templateSpread(template, byId) {
32
+ const seen = new Set();
33
+ for (let t = template; t && !seen.has(t.id); t = t.extends ? byId.get(t.extends) : undefined) {
34
+ seen.add(t.id);
35
+ if (t.spread !== undefined)
36
+ return t.spread === true;
37
+ }
38
+ return false;
39
+ }
29
40
  /** Frame names only a variant (`variants.recto` / `verso`) adds: a slot may
30
41
  * name them, and they are not reported empty. */
31
42
  function variantFrameNames(template) {
@@ -49,6 +60,10 @@ function variantFrameNames(template) {
49
60
  * without a slot). Not raised for an `optional` frame, nor for a frame
50
61
  * other frames continue into (`next`, `overflow.continueIn: '#x'`),
51
62
  * which fills only when they overflow.
63
+ * - `spreadMismatch`: the fence's `spread` flag and the template's `spread`
64
+ * (inherited through `extends`) differ. The template decides: a spread
65
+ * template is laid over two facing pages, any other on one page. Points
66
+ * at the `spread` attribute, else the `template` value.
52
67
  */
53
68
  export function checkComposedSlots(pages, config) {
54
69
  const out = [];
@@ -66,6 +81,12 @@ export function checkComposedSlots(pages, config) {
66
81
  out.push({ kind: 'templateUnknown', template: page.template, fenceIndex: page.fenceIndex, sourceStart: at.sourceStart, sourceEnd: at.sourceEnd });
67
82
  continue;
68
83
  }
84
+ // The template decides how the page is laid; the fence says so too.
85
+ const spread = templateSpread(template, byId);
86
+ if (spread !== page.spread) {
87
+ const at = page.attrSources.spread ?? page.attrSources.template ?? page.fence;
88
+ out.push({ kind: 'spreadMismatch', template: template.id, fenceIndex: page.fenceIndex, fence: page.spread, templateSpread: spread, sourceStart: at.sourceStart, sourceEnd: at.sourceEnd });
89
+ }
69
90
  const frames = templateFrames(template, byId);
70
91
  const known = new Set(frames.map((f) => f.name));
71
92
  const variants = variantFrameNames(template);
@@ -1 +1 @@
1
- {"version":3,"file":"slotChecks.js","sourceRoot":"","sources":["../../src/composed/slotChecks.ts"],"names":[],"mappings":"AAcA;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,QAAsB,EAAE,IAAuC;IACrF,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,IAAI,CAAC,GAA6B,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;QACvH,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC9C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YAC/B,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ;gBAAE,SAAS;YAC/C,IAAI,CAAC,CAAC,MAAM;gBAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;;gBAC/B,MAAM,CAA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AI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/E,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,CAAC,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;gBAAE,SAAS;YAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,SAAS;mBAC1C,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;mBACpE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,WAAW,CAAC,CAAC;YACtC,IAAI,MAAM;gBAAE,SAAS;YACrB,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QAC3K,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Spread templates (#861, DESIGN §2.1): a `spread: true` template laid as
3
+ * one sheet of two facing pages, then cut at the spine, as comic spreads
4
+ * are (`comics/spread.ts`).
5
+ *
6
+ * The sheet is in *spread coordinates*: the first page's frame, with the
7
+ * second page's set against it so that the two trim boxes meet at the
8
+ * spine (`shift` = the trim's width). The first page is the one on the
9
+ * left of the flow: the left page of a left-to-right book, the right page
10
+ * of a book whose flow is mirrored (right to left), whose frames are in
11
+ * flow coordinates. The template's `area` spans both pages (both inner
12
+ * margins inside it), the trim and the bleed run from one outer edge to
13
+ * the other, with no bleed at the spine.
14
+ *
15
+ * - The gutter: a band of `gutter` centred on the spine. A frame without
16
+ * `crossGutter` that meets it is kept off it, on the side of its centre
17
+ * (its edge moved to the band's, or the frame moved out when it starts
18
+ * inside it); an `'auto'` height is measured at the narrower width.
19
+ * - The cut: each frame goes to the page that holds it. A frame crossing
20
+ * the spine is read on the page holding its centre (the first page when
21
+ * it is centred on the spine); the facing page gets
22
+ * a copy of its blocks moved onto its own sheet (`VDTFrame.facingBlocks`),
23
+ * painted, never read. Each page clips its frames and its decoration to
24
+ * its bleed box (`VDTComposedPage.sheetClip`), so a band across the spine
25
+ * shows its own half on each side.
26
+ * - Decoration is laid once, over the physical sheet of two pages, then
27
+ * cut the same way ({@link splitSpreadDecoration}).
28
+ */
29
+ import type { BoundingBox, ContentWarning, VDTBlock, VDTComposedPage, VDTDesignSlot, VDTPage } from '../vdt';
30
+ import { type ComposedPageInput } from '../pipeline/composedLayout';
31
+ import type { FrameAreas, Rect } from './geometry';
32
+ import type { ResolvedFrame, ResolvedPageTemplate } from './types';
33
+ /** The sheet of two pages a spread template is laid on. */
34
+ export interface SpreadSheet {
35
+ /** Where the second page's sheet starts in spread coordinates. */
36
+ shift: number;
37
+ /** The spine's x. */
38
+ spine: number;
39
+ /** The template's area, the trim and the bleed of the sheet. */
40
+ areas: FrameAreas;
41
+ /** What each page shows of the sheet: its bleed box, in spread
42
+ * coordinates (the first page's, then the second's). */
43
+ shows: [Rect, Rect];
44
+ }
45
+ /**
46
+ * The sheet of two pages: `trim` and `bleed` are one page's boxes (the
47
+ * same on every page, centred on the sheet, so a mirrored flow reads them
48
+ * unchanged); `first` and `second` the pages' content areas.
49
+ */
50
+ export declare function spreadSheet(area: ResolvedPageTemplate['area'], first: Rect, second: Rect, trim: Rect, bleed: Rect): SpreadSheet;
51
+ /**
52
+ * The box a frame takes on a spread: `rect` as placed, or, for a frame
53
+ * without `crossGutter` that meets the spine band `[spine − g/2, spine +
54
+ * g/2]`, the box kept off it on the side of its centre: a frame reaching
55
+ * across the whole band is cut at the band's edge; one whose inner edge
56
+ * falls inside the band moves out whole, keeping its width.
57
+ */
58
+ export declare function keepOffGutter(frame: Pick<ResolvedFrame, 'crossGutter'>, rect: Rect, spine: number, gutterPx: number): Rect;
59
+ /** One page of a laid spread. */
60
+ export interface ComposedSpreadSide {
61
+ page: VDTPage;
62
+ composed: VDTComposedPage;
63
+ /** Blocks the page reads (each frame's box first): its `page.floats`
64
+ * and `doc.blocks`. The facing copies are on their frames. */
65
+ blocks: VDTBlock[];
66
+ }
67
+ export interface ComposedSpreadLayout {
68
+ /** The first page of the flow, then the second. */
69
+ sides: [ComposedSpreadSide, ComposedSpreadSide];
70
+ warnings: ContentWarning[];
71
+ laid: Set<string>;
72
+ }
73
+ export interface ComposedSpreadInput extends Omit<ComposedPageInput, 'page' | 'areas' | 'fitBox'> {
74
+ /** The page on the left of the flow, and the page after it in the flow. */
75
+ first: VDTPage;
76
+ second: VDTPage;
77
+ /** Each page's physical side of the open book. */
78
+ firstSide: 'left' | 'right';
79
+ /** One page's trim and bleed boxes. */
80
+ trim: Rect;
81
+ bleed: Rect;
82
+ }
83
+ /**
84
+ * Lay a spread template over two facing pages: one composed layout on the
85
+ * sheet of two pages ({@link spreadSheet}), frames kept off the spine band
86
+ * ({@link keepOffGutter}), then each frame and its blocks moved to the page
87
+ * that holds it, and the half of a frame crossing the spine copied onto
88
+ * the facing page.
89
+ */
90
+ export declare function layoutComposedSpread(input: ComposedSpreadInput): ComposedSpreadLayout;
91
+ /**
92
+ * The decoration of a spread, laid once over the physical sheet of two
93
+ * pages (the left page's sheet with the right page's set against it at
94
+ * `shift`), cut for each page: the blocks that reach the page's bleed box
95
+ * (`shows`, in sheet coordinates), moved onto its own sheet. A block
96
+ * crossing the spine goes to both pages; each paints it clipped to its
97
+ * `sheetClip`.
98
+ */
99
+ export declare function splitSpreadDecoration(slot: VDTDesignSlot, shift: number, shows: {
100
+ left: BoundingBox;
101
+ right: BoundingBox;
102
+ }): {
103
+ left: VDTDesignSlot;
104
+ right: VDTDesignSlot;
105
+ };
106
+ //# sourceMappingURL=spread.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spread.d.ts","sourceRoot":"","sources":["../../src/composed/spread.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAe,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAY,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEpI,OAAO,EAAgC,KAAK,iBAAiB,EAA2B,MAAM,4BAA4B,CAAC;AAE3H,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAMnE,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,KAAK,EAAE,UAAU,CAAC;IAClB;6DACyD;IACzD,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;CACrB;AAQD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,WAAW,CAY/H;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAY1H;AAED,iCAAiC;AACjC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC;IAC1B;mEAC+D;IAC/D,MAAM,EAAE,QAAQ,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,mDAAmD;IACnD,KAAK,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;IAChD,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnB;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC/F,2EAA2E;IAC3E,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,kDAAkD;IAClD,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,uCAAuC;IACvC,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,IAAI,CAAC;CACb;AAeD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CA4ErF;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,CAczK"}
@@ -0,0 +1,178 @@
1
+ import { offsetBlock, offsetDesignBlock } from '../pipeline/calloutLayout';
2
+ import { layoutComposedPage, lengthPx } from '../pipeline/composedLayout';
3
+ import { frameBounds } from './paint';
4
+ const MM_PER_IN = 25.4;
5
+ /** Below this a frame touches the spine without crossing it (px). */
6
+ const SPINE_EPS = 0.5;
7
+ const unionOf = (a, b) => {
8
+ const x = Math.min(a.x, b.x);
9
+ const y = Math.min(a.y, b.y);
10
+ return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
11
+ };
12
+ /**
13
+ * The sheet of two pages: `trim` and `bleed` are one page's boxes (the
14
+ * same on every page, centred on the sheet, so a mirrored flow reads them
15
+ * unchanged); `first` and `second` the pages' content areas.
16
+ */
17
+ export function spreadSheet(area, first, second, trim, bleed) {
18
+ const spine = trim.x + trim.width;
19
+ const shift = spine - trim.x;
20
+ const page = { x: trim.x, y: trim.y, width: shift + trim.width, height: trim.height };
21
+ const bleedBox = { x: bleed.x, y: bleed.y, width: shift + bleed.width, height: bleed.height };
22
+ const content = unionOf(first, { ...second, x: second.x + shift });
23
+ return {
24
+ shift,
25
+ spine,
26
+ areas: { area: area === 'trim' ? page : area === 'bleed' ? bleedBox : content, page, bleed: bleedBox },
27
+ shows: [{ ...bleed }, { ...bleed, x: bleed.x + shift }],
28
+ };
29
+ }
30
+ /**
31
+ * The box a frame takes on a spread: `rect` as placed, or, for a frame
32
+ * without `crossGutter` that meets the spine band `[spine − g/2, spine +
33
+ * g/2]`, the box kept off it on the side of its centre: a frame reaching
34
+ * across the whole band is cut at the band's edge; one whose inner edge
35
+ * falls inside the band moves out whole, keeping its width.
36
+ */
37
+ export function keepOffGutter(frame, rect, spine, gutterPx) {
38
+ if (frame.crossGutter)
39
+ return rect;
40
+ const lo = spine - gutterPx / 2;
41
+ const hi = spine + gutterPx / 2;
42
+ const right = rect.x + rect.width;
43
+ if (right <= lo + SPINE_EPS || rect.x >= hi - SPINE_EPS)
44
+ return rect;
45
+ // A frame centred on the spine stays on the first page.
46
+ const centre = rect.x + rect.width / 2;
47
+ if (centre <= spine + SPINE_EPS) {
48
+ return right > hi ? { ...rect, width: Math.max(0, lo - rect.x) } : { ...rect, x: lo - rect.width };
49
+ }
50
+ return rect.x < lo ? { ...rect, x: hi, width: Math.max(0, right - hi) } : { ...rect, x: hi };
51
+ }
52
+ /** Copies of `blocks` moved by `dx` onto page `pageIndex` (ids suffixed
53
+ * `suffix`). The laid blocks are never moved in place: a box typesetter
54
+ * may share measured parts between runs. */
55
+ function movedCopies(blocks, dx, pageIndex, suffix) {
56
+ return blocks.map((b) => {
57
+ const c = structuredClone(b);
58
+ if (dx !== 0)
59
+ offsetBlock(c, dx, 0);
60
+ c.pageIndex = pageIndex;
61
+ if (suffix)
62
+ c.id = `${c.id}${suffix}`;
63
+ return c;
64
+ });
65
+ }
66
+ /**
67
+ * Lay a spread template over two facing pages: one composed layout on the
68
+ * sheet of two pages ({@link spreadSheet}), frames kept off the spine band
69
+ * ({@link keepOffGutter}), then each frame and its blocks moved to the page
70
+ * that holds it, and the half of a frame crossing the spine copied onto
71
+ * the facing page.
72
+ */
73
+ export function layoutComposedSpread(input) {
74
+ const { first, second, template, dpi } = input;
75
+ const sheet = spreadSheet(template.area, first.contentArea, second.contentArea, input.trim, input.bleed);
76
+ const gutterPx = lengthPx(template.gutter, dpi, input.emPx);
77
+ const resized = new Map();
78
+ const mm = (v) => Math.round((v / dpi) * MM_PER_IN * 10) / 10;
79
+ const out = layoutComposedPage({
80
+ ...input,
81
+ page: first,
82
+ areas: sheet.areas,
83
+ fitBox: (frame, rect) => {
84
+ const kept = keepOffGutter(frame, rect, sheet.spine, gutterPx);
85
+ if (kept !== rect && Math.abs(kept.width - rect.width) > 0.5) {
86
+ resized.set(frame.name, { frame: frame.name, kind: 'resized', fromMm: mm(rect.width), toMm: mm(kept.width), cause: 'gutter' });
87
+ }
88
+ else if (kept !== rect) {
89
+ resized.set(frame.name, { frame: frame.name, kind: 'moved', fromMm: mm(rect.x), toMm: mm(kept.x), cause: 'gutter' });
90
+ }
91
+ return kept;
92
+ },
93
+ });
94
+ const pages = [first, second];
95
+ const byId = new Map(out.blocks.map((b) => [b.id, b]));
96
+ const sideFrames = [[], []];
97
+ const sideBlocks = [[], []];
98
+ const sideOf = new Map();
99
+ for (const frame of out.composed.frames) {
100
+ const b = frameBounds(frame);
101
+ const onFirst = b.x < sheet.spine - SPINE_EPS;
102
+ const onSecond = b.x + b.width > sheet.spine + SPINE_EPS;
103
+ const owner = onFirst && onSecond ? (b.x + b.width / 2 <= sheet.spine + SPINE_EPS ? 0 : 1) : onSecond ? 1 : 0;
104
+ sideOf.set(frame.name, owner);
105
+ const blocks = frame.blockIds.map((id) => byId.get(id)).filter((x) => x !== undefined);
106
+ const dx = owner === 0 ? 0 : -sheet.shift;
107
+ const own = owner === 0 ? blocks : movedCopies(blocks, dx, second.index, '');
108
+ for (const blk of own)
109
+ blk.pageIndex = pages[owner].index;
110
+ const moved = (by) => ({
111
+ ...frame,
112
+ rect: { ...frame.rect, x: frame.rect.x + by },
113
+ ...(frame.declaredRect ? { declaredRect: { ...frame.declaredRect, x: frame.declaredRect.x + by } } : {}),
114
+ });
115
+ sideFrames[owner].push(moved(dx));
116
+ sideBlocks[owner].push(...own);
117
+ if (onFirst && onSecond) {
118
+ const other = owner === 0 ? 1 : 0;
119
+ const odx = other === 0 ? 0 : -sheet.shift;
120
+ sideFrames[other].push({
121
+ ...moved(odx),
122
+ blockIds: [],
123
+ facingBlocks: movedCopies(blocks, odx, pages[other].index, '-facing'),
124
+ });
125
+ }
126
+ }
127
+ // Template order on each page record, as on a single page.
128
+ const order = new Map(template.frames.map((f, i) => [f.name, i]));
129
+ for (const list of sideFrames)
130
+ list.sort((a, b) => order.get(a.name) - order.get(b.name));
131
+ const log = [[], []];
132
+ for (const ev of [...resized.values(), ...out.composed.log])
133
+ log[sideOf.get(ev.frame) ?? 0].push(ev);
134
+ const warnings = out.warnings.map((w) => {
135
+ const side = w.kind === 'frameOverflow' ? sideOf.get(w.frame) ?? 0 : 0;
136
+ return side === 1 ? { ...w, pageIndex: second.index } : w;
137
+ });
138
+ const secondSide = input.firstSide === 'left' ? 'right' : 'left';
139
+ const side = (i) => {
140
+ const page = pages[i];
141
+ const show = sheet.shows[i];
142
+ const composed = {
143
+ ...out.composed,
144
+ spread: i === 0 ? input.firstSide : secondSide,
145
+ facingPage: pages[i === 0 ? 1 : 0].index,
146
+ sheetClip: { ...show, x: show.x - (i === 0 ? 0 : sheet.shift) },
147
+ frames: sideFrames[i],
148
+ log: log[i],
149
+ };
150
+ return { page, composed, blocks: sideBlocks[i] };
151
+ };
152
+ return { sides: [side(0), side(1)], warnings, laid: out.laid };
153
+ }
154
+ /**
155
+ * The decoration of a spread, laid once over the physical sheet of two
156
+ * pages (the left page's sheet with the right page's set against it at
157
+ * `shift`), cut for each page: the blocks that reach the page's bleed box
158
+ * (`shows`, in sheet coordinates), moved onto its own sheet. A block
159
+ * crossing the spine goes to both pages; each paints it clipped to its
160
+ * `sheetClip`.
161
+ */
162
+ export function splitSpreadDecoration(slot, shift, shows) {
163
+ const cut = (box, dx) => {
164
+ const blocks = slot.blocks
165
+ .filter((b) => b.bbox.x < box.x + box.width && b.bbox.x + b.bbox.width > box.x)
166
+ .map((b) => {
167
+ const c = structuredClone(b);
168
+ if (dx !== 0)
169
+ offsetDesignBlock(c, dx, 0);
170
+ return c;
171
+ });
172
+ const x = Math.max(slot.bbox.x, box.x);
173
+ const right = Math.min(slot.bbox.x + slot.bbox.width, box.x + box.width);
174
+ return { bbox: { x: x + dx, y: slot.bbox.y, width: Math.max(0, right - x), height: slot.bbox.height }, blocks };
175
+ };
176
+ return { left: cut(shows.left, 0), right: cut(shows.right, -shift) };
177
+ }
178
+ //# sourceMappingURL=spread.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spread.js","sourceRoot":"","sources":["../../src/composed/spread.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAmD,MAAM,4BAA4B,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAItC,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,qEAAqE;AACrE,MAAM,SAAS,GAAG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,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,IAAI,GAAE,cAAyB,GAC9B,UAAU,GAAG,SAAS,CAMxB;AAED,eAAO,MAAM,yBAAyB,gCAA0B,CAAC"}
@@ -352,6 +352,7 @@ function resolveTextElement(el, idx, kind) {
352
352
  ...(el.inlineMarks ? { inlineMarks: true } : {}),
353
353
  ...(el.stroke ? { stroke: el.stroke } : {}),
354
354
  ...(el.reserve === false ? { reserve: false } : {}),
355
+ ...(el.pin ? { pin: true } : {}),
355
356
  ...(el.writingMode === 'vertical-rl' ? { writingMode: 'vertical-rl' } : {}),
356
357
  ...(el.direction === 'ltr' || el.direction === 'rtl' || el.direction === 'auto' ? { direction: el.direction } : {}),
357
358
  box: el.box,
@@ -374,6 +375,7 @@ function resolveRuleElement(el, idx) {
374
375
  color: el.color ?? { ...DEFAULT_RULE_ELEMENT.color },
375
376
  thickness: el.thickness ?? { ...DEFAULT_RULE_ELEMENT.thickness },
376
377
  ...(el.reserve === false ? { reserve: false } : {}),
378
+ ...(el.pin ? { pin: true } : {}),
377
379
  };
378
380
  }
379
381
  function resolveBoxElement(el, idx) {
@@ -389,6 +391,7 @@ function resolveBoxElement(el, idx) {
389
391
  },
390
392
  style: el.style,
391
393
  ...(el.reserve === false ? { reserve: false } : {}),
394
+ ...(el.pin ? { pin: true } : {}),
392
395
  };
393
396
  }
394
397
  function resolveImageElement(el, idx) {
@@ -404,6 +407,7 @@ function resolveImageElement(el, idx) {
404
407
  },
405
408
  resourceId: el.resourceId,
406
409
  ...(el.reserve === false ? { reserve: false } : {}),
410
+ ...(el.pin ? { pin: true } : {}),
407
411
  ...(el.decorative ? { decorative: true } : {}),
408
412
  };
409
413
  }