postext 1.38.0 → 1.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/bundle.test.js +21 -0
- package/dist/__tests__/bundle.test.js.map +1 -1
- package/dist/__tests__/comics/frames.test.js +99 -10
- package/dist/__tests__/comics/frames.test.js.map +1 -1
- package/dist/__tests__/composed/figureWords.test.d.ts +2 -0
- package/dist/__tests__/composed/figureWords.test.d.ts.map +1 -0
- package/dist/__tests__/composed/figureWords.test.js +105 -0
- package/dist/__tests__/composed/figureWords.test.js.map +1 -0
- package/dist/__tests__/composed/fit.test.js +24 -7
- package/dist/__tests__/composed/fit.test.js.map +1 -1
- package/dist/__tests__/composed/frameModes.test.d.ts +2 -0
- package/dist/__tests__/composed/frameModes.test.d.ts.map +1 -0
- package/dist/__tests__/composed/frameModes.test.js +72 -0
- package/dist/__tests__/composed/frameModes.test.js.map +1 -0
- package/dist/__tests__/composed/frameWritingMode.test.d.ts +2 -0
- package/dist/__tests__/composed/frameWritingMode.test.d.ts.map +1 -0
- package/dist/__tests__/composed/frameWritingMode.test.js +211 -0
- package/dist/__tests__/composed/frameWritingMode.test.js.map +1 -0
- package/dist/__tests__/composed/groupStartGrid.test.d.ts +2 -0
- package/dist/__tests__/composed/groupStartGrid.test.d.ts.map +1 -0
- package/dist/__tests__/composed/groupStartGrid.test.js +66 -0
- package/dist/__tests__/composed/groupStartGrid.test.js.map +1 -0
- package/dist/__tests__/composed/labelsChecks.test.d.ts +2 -0
- package/dist/__tests__/composed/labelsChecks.test.d.ts.map +1 -0
- package/dist/__tests__/composed/labelsChecks.test.js +307 -0
- package/dist/__tests__/composed/labelsChecks.test.js.map +1 -0
- package/dist/__tests__/composed/logicalEdges.test.d.ts +2 -0
- package/dist/__tests__/composed/logicalEdges.test.d.ts.map +1 -0
- package/dist/__tests__/composed/logicalEdges.test.js +94 -0
- package/dist/__tests__/composed/logicalEdges.test.js.map +1 -0
- package/dist/__tests__/composed/sourceMap.test.js +62 -0
- package/dist/__tests__/composed/sourceMap.test.js.map +1 -1
- package/dist/__tests__/composed/spreadLabels.test.js +5 -2
- package/dist/__tests__/composed/spreadLabels.test.js.map +1 -1
- package/dist/__tests__/defaults/calloutStyleExtends.test.d.ts +2 -0
- package/dist/__tests__/defaults/calloutStyleExtends.test.d.ts.map +1 -0
- package/dist/__tests__/defaults/calloutStyleExtends.test.js +123 -0
- package/dist/__tests__/defaults/calloutStyleExtends.test.js.map +1 -0
- package/dist/__tests__/exports.test.js +2 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/paragraphDropCap.test.js +78 -0
- package/dist/__tests__/paragraphDropCap.test.js.map +1 -1
- package/dist/__tests__/pipeline/calloutCutRules.test.d.ts +2 -0
- package/dist/__tests__/pipeline/calloutCutRules.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/calloutCutRules.test.js +91 -0
- package/dist/__tests__/pipeline/calloutCutRules.test.js.map +1 -0
- package/dist/__tests__/pipeline/columnsWidows.test.d.ts +2 -0
- package/dist/__tests__/pipeline/columnsWidows.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/columnsWidows.test.js +76 -0
- package/dist/__tests__/pipeline/columnsWidows.test.js.map +1 -0
- package/dist/__tests__/vertical/canvasPaint.test.js +80 -0
- package/dist/__tests__/vertical/canvasPaint.test.js.map +1 -1
- package/dist/bundle/codec.d.ts.map +1 -1
- package/dist/bundle/codec.js +25 -2
- package/dist/bundle/codec.js.map +1 -1
- package/dist/canvas-backend/composed.d.ts +8 -1
- package/dist/canvas-backend/composed.d.ts.map +1 -1
- package/dist/canvas-backend/composed.js +21 -11
- package/dist/canvas-backend/composed.js.map +1 -1
- package/dist/canvas-backend/headerFooter.d.ts.map +1 -1
- package/dist/canvas-backend/headerFooter.js +11 -8
- package/dist/canvas-backend/headerFooter.js.map +1 -1
- package/dist/canvas-backend/index.d.ts.map +1 -1
- package/dist/canvas-backend/index.js +5 -3
- package/dist/canvas-backend/index.js.map +1 -1
- package/dist/canvas-backend/renderResourceBlock.d.ts.map +1 -1
- package/dist/canvas-backend/renderResourceBlock.js +7 -0
- package/dist/canvas-backend/renderResourceBlock.js.map +1 -1
- package/dist/comics/textPanels.d.ts +24 -6
- package/dist/comics/textPanels.d.ts.map +1 -1
- package/dist/comics/textPanels.js +84 -12
- package/dist/comics/textPanels.js.map +1 -1
- package/dist/composed/geometry.d.ts +1 -19
- package/dist/composed/geometry.d.ts.map +1 -1
- package/dist/composed/geometry.js +24 -2
- package/dist/composed/geometry.js.map +1 -1
- package/dist/composed/labels.d.ts +14 -1
- package/dist/composed/labels.d.ts.map +1 -1
- package/dist/composed/labels.js +206 -11
- package/dist/composed/labels.js.map +1 -1
- package/dist/composed/paint.d.ts +26 -0
- package/dist/composed/paint.d.ts.map +1 -1
- package/dist/composed/paint.js +25 -2
- package/dist/composed/paint.js.map +1 -1
- package/dist/composed/sourceMap.d.ts +7 -2
- package/dist/composed/sourceMap.d.ts.map +1 -1
- package/dist/composed/sourceMap.js +31 -16
- package/dist/composed/sourceMap.js.map +1 -1
- package/dist/composed/types.d.ts +3 -0
- package/dist/composed/types.d.ts.map +1 -1
- package/dist/composed/validate.d.ts.map +1 -1
- package/dist/composed/validate.js +2 -0
- package/dist/composed/validate.js.map +1 -1
- package/dist/composed/wrap.d.ts +7 -0
- package/dist/composed/wrap.d.ts.map +1 -1
- package/dist/composed/wrap.js +52 -4
- package/dist/composed/wrap.js.map +1 -1
- package/dist/configWarnings.d.ts.map +1 -1
- package/dist/configWarnings.js +33 -1
- package/dist/configWarnings.js.map +1 -1
- package/dist/contrast.d.ts +4 -2
- package/dist/contrast.d.ts.map +1 -1
- package/dist/contrast.js +22 -1
- package/dist/contrast.js.map +1 -1
- package/dist/defaults/calloutStyles.d.ts +14 -1
- package/dist/defaults/calloutStyles.d.ts.map +1 -1
- package/dist/defaults/calloutStyles.js +70 -2
- package/dist/defaults/calloutStyles.js.map +1 -1
- package/dist/defaults/index.d.ts +1 -1
- package/dist/defaults/index.d.ts.map +1 -1
- package/dist/defaults/index.js +1 -1
- package/dist/defaults/index.js.map +1 -1
- package/dist/design/layout.d.ts +5 -0
- package/dist/design/layout.d.ts.map +1 -1
- package/dist/design/layout.js +19 -9
- package/dist/design/layout.js.map +1 -1
- package/dist/design/logicalEdges.d.ts +27 -0
- package/dist/design/logicalEdges.d.ts.map +1 -0
- package/dist/design/logicalEdges.js +36 -0
- package/dist/design/logicalEdges.js.map +1 -0
- package/dist/html-backend.d.ts.map +1 -1
- package/dist/html-backend.js +42 -10
- package/dist/html-backend.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/parse/blockParser.d.ts.map +1 -1
- package/dist/parse/blockParser.js +36 -1
- package/dist/parse/blockParser.js.map +1 -1
- package/dist/parse/index.d.ts +1 -1
- package/dist/parse/index.d.ts.map +1 -1
- package/dist/parse/index.js.map +1 -1
- package/dist/parse/indexMarks.d.ts.map +1 -1
- package/dist/parse/indexMarks.js +2 -0
- package/dist/parse/indexMarks.js.map +1 -1
- package/dist/parse/types.d.ts +14 -0
- package/dist/parse/types.d.ts.map +1 -1
- package/dist/pipeline/build.d.ts.map +1 -1
- package/dist/pipeline/build.js +16 -4
- package/dist/pipeline/build.js.map +1 -1
- package/dist/pipeline/buildMeasurement.d.ts.map +1 -1
- package/dist/pipeline/buildMeasurement.js +1 -0
- package/dist/pipeline/buildMeasurement.js.map +1 -1
- package/dist/pipeline/calloutLayout.d.ts.map +1 -1
- package/dist/pipeline/calloutLayout.js +13 -32
- package/dist/pipeline/calloutLayout.js.map +1 -1
- package/dist/pipeline/columnsGroup.d.ts +3 -3
- package/dist/pipeline/columnsGroup.d.ts.map +1 -1
- package/dist/pipeline/columnsGroup.js +5 -4
- package/dist/pipeline/columnsGroup.js.map +1 -1
- package/dist/pipeline/composedLayout.d.ts +4 -1
- package/dist/pipeline/composedLayout.d.ts.map +1 -1
- package/dist/pipeline/composedLayout.js +167 -20
- package/dist/pipeline/composedLayout.js.map +1 -1
- package/dist/pipeline/contentWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings.js +23 -1
- package/dist/pipeline/contentWarnings.js.map +1 -1
- package/dist/pipeline/dropCap.d.ts.map +1 -1
- package/dist/pipeline/dropCap.js +11 -0
- package/dist/pipeline/dropCap.js.map +1 -1
- package/dist/pipeline/figureWords.d.ts +21 -0
- package/dist/pipeline/figureWords.d.ts.map +1 -0
- package/dist/pipeline/figureWords.js +43 -0
- package/dist/pipeline/figureWords.js.map +1 -0
- package/dist/pipeline/frameLayout.d.ts.map +1 -1
- package/dist/pipeline/frameLayout.js +12 -3
- package/dist/pipeline/frameLayout.js.map +1 -1
- package/dist/pipeline/headerFooter.d.ts +2 -0
- package/dist/pipeline/headerFooter.d.ts.map +1 -1
- package/dist/pipeline/headerFooter.js +10 -4
- package/dist/pipeline/headerFooter.js.map +1 -1
- package/dist/pipeline/partPalette.d.ts +4 -2
- package/dist/pipeline/partPalette.d.ts.map +1 -1
- package/dist/pipeline/partPalette.js +19 -0
- package/dist/pipeline/partPalette.js.map +1 -1
- package/dist/pipeline/verticalMetrics.d.ts +3 -2
- package/dist/pipeline/verticalMetrics.d.ts.map +1 -1
- package/dist/pipeline/verticalMetrics.js +25 -2
- package/dist/pipeline/verticalMetrics.js.map +1 -1
- package/dist/preflight.d.ts +1 -1
- package/dist/preflight.js +31 -3
- package/dist/preflight.js.map +1 -1
- package/dist/types.d.ts +19 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/vdt.d.ts +67 -1
- package/dist/vdt.d.ts.map +1 -1
- package/dist/vdt.js.map +1 -1
- package/dist/word/docxRead.d.ts.map +1 -1
- package/dist/word/docxRead.js +16 -2
- package/dist/word/docxRead.js.map +1 -1
- package/dist/word/index.d.ts +2 -0
- package/dist/word/index.d.ts.map +1 -1
- package/dist/word/index.js +1 -0
- package/dist/word/index.js.map +1 -1
- package/dist/word/model.d.ts +7 -0
- package/dist/word/model.d.ts.map +1 -1
- package/dist/word/model.js.map +1 -1
- package/dist/word/toDocx.d.ts.map +1 -1
- package/dist/word/toDocx.js +28 -13
- package/dist/word/toDocx.js.map +1 -1
- package/dist/word/tracking.d.ts +37 -0
- package/dist/word/tracking.d.ts.map +1 -0
- package/dist/word/tracking.js +137 -0
- package/dist/word/tracking.js.map +1 -0
- package/dist/word/word.test.js +79 -0
- package/dist/word/word.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnsGroup.js","sourceRoot":"","sources":["../../src/pipeline/columnsGroup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA8BH,MAAM,GAAG,GAAG,IAAI,CAAC;AAEjB;;;
|
|
1
|
+
{"version":3,"file":"columnsGroup.js","sourceRoot":"","sources":["../../src/pipeline/columnsGroup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA8BH,MAAM,GAAG,GAAG,IAAI,CAAC;AAEjB;;;uDAGuD;AACvD,MAAM,UAAU,YAAY,CAAC,KAA4B,EAAE,QAAgB,EAAE,QAAQ,GAAG,QAAQ;IAC9F,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACpC,MAAM,GAAG,GAAkB,EAAE,CAAC;IAC9B,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;QACtB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACV,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC;YAC3B,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,GAA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AAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC;IACzF,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,GAAG,CAAC;IAC5C,IAAI,EAAE,GAAG,KAAK,CAAC;IACf,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IAC9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,GAAG;YAAE,EAAE,GAAG,GAAG,CAAC;;YACrD,EAAE,GAAG,GAAG,CAAC;IAChB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -38,7 +38,7 @@ import { type FrameAreas, type Rect } from '../composed/geometry';
|
|
|
38
38
|
import { type ComposedContinuation, type ComposedContinuationInput } from '../composed/continuation';
|
|
39
39
|
import type { ResolvedFrame, ResolvedPageTemplate } from '../composed/types';
|
|
40
40
|
import { type PageTemplateSource } from '../composed/templates';
|
|
41
|
-
import { type PlannedCallout } from './calloutLayout';
|
|
41
|
+
import { type BoxExclusion, type PlannedCallout } from './calloutLayout';
|
|
42
42
|
import { type FrameLayoutPass } from './frameLayout';
|
|
43
43
|
/** A story of the page: the box `composed/wrap.ts` made of a chain's
|
|
44
44
|
* content, by the name of the chain's first frame. */
|
|
@@ -72,6 +72,9 @@ export interface ComposedPageInput {
|
|
|
72
72
|
* crosses the gutter. An `'auto'` height is measured at the width it
|
|
73
73
|
* returns. */
|
|
74
74
|
fitBox?: (frame: ResolvedFrame, rect: Rect) => Rect;
|
|
75
|
+
/** Shapes a frame's lines keep off, by frame name, in page (flow)
|
|
76
|
+
* coordinates: a comic text panel's slanted edges (#909). */
|
|
77
|
+
frameExclusions?: ReadonlyMap<string, readonly BoxExclusion[]>;
|
|
75
78
|
/** The document's locale (`config.locale`), named by `frameOverflow`. */
|
|
76
79
|
locale?: string;
|
|
77
80
|
/** The book's other templates, resolved for this page's side, in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composedLayout.d.ts","sourceRoot":"","sources":["../../src/pipeline/composedLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAa,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,
|
|
1
|
+
{"version":3,"file":"composedLayout.d.ts","sourceRoot":"","sources":["../../src/pipeline/composedLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAa,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAkC,KAAK,cAAc,EAAmE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAoE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGnQ,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,OAAO,EAAoE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAIpI,OAAO,EAAoH,KAAK,oB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,MAAM,GAAG,MAAM,CAE9G;AAED;mBACmB;AACnB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACpC,iDAAiD;IACjD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;CACjD;AAED;8BAC8B;AAC9B,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,EAC1C,MAAM,EAAE,kBAAkB,GACzB,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAqBlC;AAED,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAG5H"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { pageIsMirrored } from '../vdt';
|
|
1
|
+
import { pageIsMirrored, pageIsVertical } from '../vdt';
|
|
2
2
|
import { contourBounds, scaleContourAbout, shiftContour } from '../contour';
|
|
3
3
|
import { frameContour } from '../composed/contour';
|
|
4
4
|
import { dimensionToPx } from '../units';
|
|
5
|
-
import { frameBounds } from '../composed/paint';
|
|
6
|
-
import {
|
|
5
|
+
import { frameBounds, frameModeTurn, quarterTurnedRect } from '../composed/paint';
|
|
6
|
+
import { withMeasureWritingMode } from '../measure/vertical';
|
|
7
|
+
import { chainHead, FRAME_ATTR } from '../composed/wrap';
|
|
7
8
|
import { framePlaceable, nextFrameOf, groupPlaceable, placeBox, unionRect } from '../composed/geometry';
|
|
8
9
|
import { composedOrder, groupOfFrames, layoutGroup } from '../composed/groups';
|
|
9
10
|
import { reflowEvents } from '../composed/reflowLog';
|
|
@@ -357,6 +358,8 @@ export function layoutComposedPage(given) {
|
|
|
357
358
|
dpi,
|
|
358
359
|
emPx: input.emPx,
|
|
359
360
|
alternatives: input.alternatives,
|
|
361
|
+
// Not on a page continuation added: its template is not the fence's.
|
|
362
|
+
...(input.continuing ? {} : { fitsWithTemplate: (alt) => fitsWithTemplate(given, alt) }),
|
|
360
363
|
templateSource: templateAttr ? { sourceStart: templateAttr.sourceStart + input.bodyOffset, sourceEnd: templateAttr.sourceEnd + input.bodyOffset } : undefined,
|
|
361
364
|
budgetLeft: () => runs < COMPOSE_BUDGET,
|
|
362
365
|
holdsText: holdsText(frame),
|
|
@@ -424,6 +427,79 @@ export function layoutComposedPage(given) {
|
|
|
424
427
|
}
|
|
425
428
|
return { composed, blocks, warnings, laid, ...(fitted.size > 0 ? { fitted } : {}), ...(continuations.length > 0 ? { continuations } : {}) };
|
|
426
429
|
}
|
|
430
|
+
/** The page's stories as `wrapComposedPages` would group them for template
|
|
431
|
+
* `alt` (#937): a story whose head names a frame of `alt` stays the story
|
|
432
|
+
* of that frame's chain, one a `takes` frame took goes to `alt`'s frame
|
|
433
|
+
* that takes the same level, and the rest go to `alt`'s flow frame, after
|
|
434
|
+
* its own content, in Markdown order. Merged stories are boxes appended
|
|
435
|
+
* past the pass's content blocks (a pass of their own), so the page can
|
|
436
|
+
* be laid with them. `undefined` when some content would leave the page
|
|
437
|
+
* (no frame of `alt` takes it). */
|
|
438
|
+
function regroupStories(input, alt) {
|
|
439
|
+
const names = new Set(alt.frames.map((f) => f.name));
|
|
440
|
+
const flow = alt.frames.find((f) => f.flow);
|
|
441
|
+
const flowHead = flow ? chainHead(alt, flow.name) : undefined;
|
|
442
|
+
const current = input.template.frames;
|
|
443
|
+
const headIn = (head) => {
|
|
444
|
+
if (names.has(head))
|
|
445
|
+
return chainHead(alt, head);
|
|
446
|
+
const takes = current.find((f) => f.name === head)?.takes;
|
|
447
|
+
const taker = takes ? alt.frames.find((f) => f.takes === takes) : undefined;
|
|
448
|
+
return taker ? chainHead(alt, taker.name) : flowHead;
|
|
449
|
+
};
|
|
450
|
+
const groups = new Map();
|
|
451
|
+
for (const [head, story] of [...input.stories].sort((a, b) => a[1].startIdx - b[1].startIdx)) {
|
|
452
|
+
const to = headIn(head);
|
|
453
|
+
if (to === undefined)
|
|
454
|
+
return undefined;
|
|
455
|
+
groups.set(to, [...(groups.get(to) ?? []), [head, story]]);
|
|
456
|
+
}
|
|
457
|
+
if ([...groups].every(([to, list]) => list.length === 1 && list[0][0] === to))
|
|
458
|
+
return { pass: input.pass, stories: new Map(input.stories) };
|
|
459
|
+
const base = input.pass.contentBlocks;
|
|
460
|
+
const extra = [];
|
|
461
|
+
/** Where each appended box's blocks come from: the first story's box. */
|
|
462
|
+
const origin = new Map();
|
|
463
|
+
let nextId = base.reduce((m, b) => Math.max(m, b.containerId ?? 0), 0) + 1;
|
|
464
|
+
const stories = new Map();
|
|
465
|
+
for (const [to, list] of groups) {
|
|
466
|
+
if (list.length === 1 && list[0][0] === to) {
|
|
467
|
+
stories.set(to, list[0][1]);
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
const own = list.find(([h]) => h === to)?.[1] ?? list[0][1];
|
|
471
|
+
const open = base[own.startIdx];
|
|
472
|
+
const id = nextId++;
|
|
473
|
+
const startIdx = base.length + extra.length;
|
|
474
|
+
const attrs = { ...own.plan.attrs, [FRAME_ATTR]: to };
|
|
475
|
+
extra.push({ ...open, containerAttrs: attrs, containerId: id });
|
|
476
|
+
for (const [, s] of list)
|
|
477
|
+
extra.push(...base.slice(s.startIdx + 1, s.plan.endIdx));
|
|
478
|
+
const close = base[list[list.length - 1][1].plan.endIdx];
|
|
479
|
+
extra.push({ ...close, containerId: id });
|
|
480
|
+
origin.set(startIdx, own.startIdx);
|
|
481
|
+
stories.set(to, { startIdx, plan: { endIdx: base.length + extra.length - 1, attrs, containerId: id } });
|
|
482
|
+
}
|
|
483
|
+
const pass = {
|
|
484
|
+
...input.pass,
|
|
485
|
+
contentBlocks: [...base, ...extra],
|
|
486
|
+
measureCtxFor: (startIdx, style) => input.pass.measureCtxFor(origin.get(startIdx) ?? startIdx, style),
|
|
487
|
+
};
|
|
488
|
+
return { pass, stories };
|
|
489
|
+
}
|
|
490
|
+
/** The page fits when set with template `alt` (#937): its stories regrouped
|
|
491
|
+
* for it (`regroupStories`), its own reflow ladder run; no frame
|
|
492
|
+
* overflows, every story is laid, and nothing goes on to another page. */
|
|
493
|
+
function fitsWithTemplate(input, alt) {
|
|
494
|
+
const regrouped = regroupStories(input, alt);
|
|
495
|
+
if (!regrouped)
|
|
496
|
+
return false;
|
|
497
|
+
// No proposals of its own (`alternatives` left out).
|
|
498
|
+
const trial = layoutComposedPage({ ...input, template: alt, pass: regrouped.pass, stories: regrouped.stories, alternatives: undefined, continuing: undefined });
|
|
499
|
+
return !trial.continuations
|
|
500
|
+
&& trial.warnings.every((w) => w.kind !== 'frameOverflow')
|
|
501
|
+
&& [...regrouped.stories.keys()].every((h) => trial.laid.has(h));
|
|
502
|
+
}
|
|
427
503
|
const mmDim = (value) => ({ value, unit: 'mm' });
|
|
428
504
|
/** What would make `frame`'s content fit, each value worked out from the
|
|
429
505
|
* shortfall and, where the page can tell, tried on it (DESIGN §5.7). */
|
|
@@ -503,15 +579,14 @@ function overflowProposals(c) {
|
|
|
503
579
|
if (holds && !frame.overflow.continueIn)
|
|
504
580
|
out.push({ kind: 'continueNextPage', path: path('overflow/continueIn'), value: 'next-page' });
|
|
505
581
|
// Another template of the book with a frame of this name, where the
|
|
506
|
-
//
|
|
582
|
+
// page fits once set with it: its stories regrouped for it and its own
|
|
583
|
+
// ladder run (#937).
|
|
507
584
|
for (const alt of c.alternatives?.() ?? []) {
|
|
508
|
-
if (!c.budgetLeft())
|
|
585
|
+
if (!c.budgetLeft() || !c.fitsWithTemplate)
|
|
509
586
|
break;
|
|
510
587
|
if (!alt.frames.some((f) => f.name === name))
|
|
511
588
|
continue;
|
|
512
|
-
|
|
513
|
-
const laidThere = trial.frames.find((f) => f.name === name);
|
|
514
|
-
if (laidThere && laidThere.blockIds.length > 0 && laidThere.overflowPx <= 0.5) {
|
|
589
|
+
if (c.fitsWithTemplate(alt)) {
|
|
515
590
|
out.push({ kind: 'useTemplate', value: alt.id, ...(c.templateSource ?? {}) });
|
|
516
591
|
break;
|
|
517
592
|
}
|
|
@@ -603,6 +678,18 @@ function composePage(input, template, fit, collapsed) {
|
|
|
603
678
|
};
|
|
604
679
|
/** The scale of a frame's pictures (#858), below 1, or undefined. */
|
|
605
680
|
const pictureScale = (frame) => fit.pictures.get(headOf(frame.name))?.scale;
|
|
681
|
+
/** A frame set in a writing mode other than the page's flow (#944): its
|
|
682
|
+
* mode, else undefined. Its content is laid out in that mode, its lines
|
|
683
|
+
* along the box's height and following each other across its width. */
|
|
684
|
+
const pageMode = pageIsVertical(input.page) ? 'vertical-rl' : 'horizontal-tb';
|
|
685
|
+
// Not on a right-to-left page, whose mirrored flow would set a vertical
|
|
686
|
+
// frame's lines from left to right: there it keeps the page's mode.
|
|
687
|
+
const ownMode = (frame) => frame.writingMode !== undefined && frame.writingMode !== pageMode && !pageIsMirrored(input.page) ? frame.writingMode : undefined;
|
|
688
|
+
/** `fn` measured in the frame's own writing mode. */
|
|
689
|
+
const inMode = (frame, fn) => {
|
|
690
|
+
const mode = ownMode(frame);
|
|
691
|
+
return mode ? withMeasureWritingMode(mode, fn) : fn();
|
|
692
|
+
};
|
|
606
693
|
/** Rectangles in a frame's box coordinates, in its laid-out (scaled)
|
|
607
694
|
* coordinates. */
|
|
608
695
|
const unscale = (rs, s) => rs && s !== 1
|
|
@@ -683,6 +770,10 @@ function composePage(input, template, fit, collapsed) {
|
|
|
683
770
|
* meets, in the frame block's coordinates. */
|
|
684
771
|
const exclusionsFor = (frame, rect, open) => {
|
|
685
772
|
const out = [];
|
|
773
|
+
// The frame's own shapes (a comic panel's slanted edges, #909).
|
|
774
|
+
for (const ex of input.frameExclusions?.get(frame.name) ?? []) {
|
|
775
|
+
out.push({ x: ex.x - rect.x, y: ex.y - rect.y, width: ex.width, height: ex.height, ...(ex.contour ? { contour: shiftContour(ex.contour, -rect.x, -rect.y) } : {}) });
|
|
776
|
+
}
|
|
686
777
|
const g = input.pushGapPx;
|
|
687
778
|
for (const p of pushed) {
|
|
688
779
|
if (p.name === frame.name)
|
|
@@ -728,6 +819,8 @@ function composePage(input, template, fit, collapsed) {
|
|
|
728
819
|
const memo = new Map();
|
|
729
820
|
const s = textScale(p.frame);
|
|
730
821
|
const pic = pictureScale(p.frame);
|
|
822
|
+
if (ownMode(p.frame))
|
|
823
|
+
return turnedNaturalOf(p, memo, s, pic);
|
|
731
824
|
return (width) => {
|
|
732
825
|
if (!p.holds)
|
|
733
826
|
return 0;
|
|
@@ -743,6 +836,39 @@ function composePage(input, template, fit, collapsed) {
|
|
|
743
836
|
return h;
|
|
744
837
|
};
|
|
745
838
|
};
|
|
839
|
+
/** The height a frame set in its own writing mode (#944) needs at
|
|
840
|
+
* `width`: its lines run down the box, so the least height whose
|
|
841
|
+
* lines, following each other across, fit `width`; the area's height
|
|
842
|
+
* when even that is not enough (the frame then overflows). */
|
|
843
|
+
const turnedNaturalOf = (p, memo, s, pic) => (width) => {
|
|
844
|
+
if (!p.holds)
|
|
845
|
+
return 0;
|
|
846
|
+
const key = Math.round(width * 1000);
|
|
847
|
+
const known = memo.get(key);
|
|
848
|
+
if (known !== undefined)
|
|
849
|
+
return known;
|
|
850
|
+
const opts = { ...(pic !== undefined ? { pictureScale: pic } : {}), ...(p.fromMark !== undefined ? { continuedMark: p.fromMark } : {}) };
|
|
851
|
+
const across = (measure) => inMode(p.frame, () => p.st.L.layoutRange(p.st.cut, p.st.L.end, measure / s, p.blockId, p.continuation, input.mirrored, Object.keys(opts).length > 0 ? opts : undefined).totalHeight * s);
|
|
852
|
+
const most = Math.max(input.areas.area.height, input.emPx);
|
|
853
|
+
let h = most;
|
|
854
|
+
if (across(most) <= width + 0.5) {
|
|
855
|
+
let lo = Math.min(input.emPx, most);
|
|
856
|
+
let hi = most;
|
|
857
|
+
if (across(lo) <= width + 0.5)
|
|
858
|
+
hi = lo;
|
|
859
|
+
// Whole px are enough: a line is never set that finely.
|
|
860
|
+
while (hi - lo > 1) {
|
|
861
|
+
const mid = (lo + hi) / 2;
|
|
862
|
+
if (across(mid) <= width + 0.5)
|
|
863
|
+
hi = mid;
|
|
864
|
+
else
|
|
865
|
+
lo = mid;
|
|
866
|
+
}
|
|
867
|
+
h = hi;
|
|
868
|
+
}
|
|
869
|
+
memo.set(key, h);
|
|
870
|
+
return h;
|
|
871
|
+
};
|
|
746
872
|
/** `placeBox`, then the box the page lets the frame take (`fitBox`:
|
|
747
873
|
* off a spread's spine band, #861), its `'auto'` height measured at the
|
|
748
874
|
* width it is left with. Declared and final boxes alike: the band is
|
|
@@ -914,11 +1040,16 @@ function composePage(input, template, fit, collapsed) {
|
|
|
914
1040
|
/** Pour a frame's content into its box and record the frame. A frame
|
|
915
1041
|
* whose text the ladder scales (#858) is laid out in a box `1 / scale`
|
|
916
1042
|
* as large, painted at `scale` (`frameMatrix`). */
|
|
917
|
-
const fill = (p,
|
|
1043
|
+
const fill = (p, placed) => {
|
|
918
1044
|
const { frame, st, holds, continuation, blockId, before } = p;
|
|
919
1045
|
const style = styleOf(frame);
|
|
920
1046
|
const s = textScale(frame);
|
|
921
1047
|
const pic = pictureScale(frame);
|
|
1048
|
+
// A frame in its own writing mode (#944) is laid out in its box
|
|
1049
|
+
// turned a quarter turn, its lines along the box's height; painted
|
|
1050
|
+
// turned back (`VDTFrame.writingMode`).
|
|
1051
|
+
const turned = ownMode(frame);
|
|
1052
|
+
const rect = turned ? quarterTurnedRect(placed) : placed;
|
|
922
1053
|
const laidW = rect.width / s;
|
|
923
1054
|
const laidH = rect.height / s;
|
|
924
1055
|
let result;
|
|
@@ -928,14 +1059,16 @@ function composePage(input, template, fit, collapsed) {
|
|
|
928
1059
|
if (holds) {
|
|
929
1060
|
// What its content needs at its width, measured only when a
|
|
930
1061
|
// proposal asks (`lowerMin`), from where the frame starts.
|
|
931
|
-
const width =
|
|
1062
|
+
const width = placed.width;
|
|
932
1063
|
const startAt = { ...p, st: { ...st, cut: from } };
|
|
933
1064
|
let known;
|
|
934
1065
|
needs.set(frame.name, () => (known ??= naturalOf(startAt)(width)));
|
|
935
|
-
|
|
1066
|
+
// Text running round the frames that push it runs along the page's
|
|
1067
|
+
// lines: a frame set across them keeps its whole box.
|
|
1068
|
+
const exclusions = turned ? undefined : unscale(exclusionsFor(frame, rect, false), s);
|
|
936
1069
|
const extra = { ...(exclusions ? { exclusions } : {}), ...(pic !== undefined ? { pictureScale: pic } : {}), ...(p.fromMark !== undefined ? { continuedMark: p.fromMark } : {}) };
|
|
937
1070
|
const opts = { boxHeight: laidH, verticalAlign: frame.verticalAlign, ...extra };
|
|
938
|
-
const whole = st.L.layoutRange(from, st.L.end, laidW, blockId, continuation, input.mirrored, opts);
|
|
1071
|
+
const whole = inMode(frame, () => st.L.layoutRange(from, st.L.end, laidW, blockId, continuation, input.mirrored, opts));
|
|
939
1072
|
const nextName = nextFrameOf(frame);
|
|
940
1073
|
const nextFrame = nextName !== undefined ? byName.get(nextName) : undefined;
|
|
941
1074
|
const chained = nextFrame !== undefined && !vdtByName.has(nextFrame.name);
|
|
@@ -947,11 +1080,11 @@ function composePage(input, template, fit, collapsed) {
|
|
|
947
1080
|
const minLines = Math.max(1, style.splitMinLines);
|
|
948
1081
|
// A heading stays with what follows it, a list keeps two items
|
|
949
1082
|
// on each side of the cut (#913).
|
|
950
|
-
const frag = splitCalloutFragment(pass, st.L, from, laidW, laidH, blockId, continuation, minLines, input.mirrored, extra.exclusions || extra.pictureScale !== undefined || extra.continuedMark !== undefined ? extra : undefined, cutRules);
|
|
1083
|
+
const frag = inMode(frame, () => splitCalloutFragment(pass, st.L, from, laidW, laidH, blockId, continuation, minLines, input.mirrored, extra.exclusions || extra.pictureScale !== undefined || extra.continuedMark !== undefined ? extra : undefined, cutRules));
|
|
951
1084
|
const to = frag?.to ?? from;
|
|
952
1085
|
// A frame none of whose content fits draws nothing: the whole box
|
|
953
1086
|
// goes on (#912), not a tab and a mark over an empty piece.
|
|
954
|
-
result = frag ? st.L.layoutRange(from, to, laidW, blockId, continuation, input.mirrored, opts) : undefined;
|
|
1087
|
+
result = frag ? inMode(frame, () => st.L.layoutRange(from, to, laidW, blockId, continuation, input.mirrored, opts)) : undefined;
|
|
955
1088
|
st.cut = to;
|
|
956
1089
|
}
|
|
957
1090
|
else {
|
|
@@ -963,7 +1096,7 @@ function composePage(input, template, fit, collapsed) {
|
|
|
963
1096
|
}
|
|
964
1097
|
else if (st && frame.style) {
|
|
965
1098
|
// A styled frame with nothing (left) to hold still draws its box.
|
|
966
|
-
result = st.L.layoutRange(st.L.end, st.L.end, laidW, blockId, true, input.mirrored, { boxHeight: laidH });
|
|
1099
|
+
result = inMode(frame, () => st.L.layoutRange(st.L.end, st.L.end, laidW, blockId, true, input.mirrored, { boxHeight: laidH }));
|
|
967
1100
|
}
|
|
968
1101
|
// A frame cut below its least height overflows by the cut, holding
|
|
969
1102
|
// content or not (#911).
|
|
@@ -981,15 +1114,18 @@ function composePage(input, template, fit, collapsed) {
|
|
|
981
1114
|
const p = style.padding;
|
|
982
1115
|
const inner = { x: rect.x + pad(p.left), y: rect.y + pad(p.top), width: rect.width - pad(p.left) - pad(p.right), height: rect.height - pad(p.top) - pad(p.bottom) };
|
|
983
1116
|
const blocks = frameRuleBlocks(frame.rules, inner, linePx, 1, dpi, input.emPx);
|
|
1117
|
+
// On the page, a frame in its own writing mode turns its rules
|
|
1118
|
+
// with it (#944): across its lines, as the page shows them.
|
|
984
1119
|
if (blocks.length > 0)
|
|
985
|
-
emptyRules = blocks;
|
|
1120
|
+
emptyRules = turned ? blocks.map((b) => ({ ...b, bbox: turnRectAbout(b.bbox, rect, frameModeTurn({ writingMode: turned })) })) : blocks;
|
|
986
1121
|
}
|
|
987
1122
|
}
|
|
988
1123
|
const vdt = {
|
|
989
1124
|
id: frameIdOf(frame.name),
|
|
990
1125
|
name: frame.name,
|
|
991
1126
|
rect: { ...rect },
|
|
992
|
-
rotate: frame.rotate,
|
|
1127
|
+
rotate: frame.rotate + (turned ? frameModeTurn({ writingMode: turned }) : 0),
|
|
1128
|
+
...(turned ? { writingMode: turned } : {}),
|
|
993
1129
|
layer: frame.layer,
|
|
994
1130
|
...(frame.style ? { styleId: frame.style } : {}),
|
|
995
1131
|
scale: s,
|
|
@@ -1001,7 +1137,8 @@ function composePage(input, template, fit, collapsed) {
|
|
|
1001
1137
|
...(collapsed.has(frame.name) ? { collapsed: true } : {}),
|
|
1002
1138
|
...(emptyRules ? { rules: emptyRules } : {}),
|
|
1003
1139
|
};
|
|
1004
|
-
const
|
|
1140
|
+
const declPlaced = declared.get(frame.name);
|
|
1141
|
+
const decl = declPlaced && turned ? quarterTurnedRect(declPlaced) : declPlaced;
|
|
1005
1142
|
if (decl && !sameRect(decl, rect))
|
|
1006
1143
|
vdt.declaredRect = { ...decl };
|
|
1007
1144
|
if (before && vdtByName.has(before) && st && st.lastFrameId) {
|
|
@@ -1046,11 +1183,11 @@ function composePage(input, template, fit, collapsed) {
|
|
|
1046
1183
|
overflowLog.push({ frame: frame.name, kind: 'overflow', toMm: overflowMm });
|
|
1047
1184
|
}
|
|
1048
1185
|
if (frame.exclude === 'push') {
|
|
1049
|
-
const box = frameBounds({ rect, rotate: frame.rotate });
|
|
1186
|
+
const box = frameBounds({ rect: placed, rotate: frame.rotate });
|
|
1050
1187
|
pushRects.set(frame.name, box);
|
|
1051
1188
|
// `wrap: 'contour'` (#883): the shape of the pictures it holds; a
|
|
1052
1189
|
// turned frame pushes with its box.
|
|
1053
|
-
const shape = frame.wrap === 'contour' && frame.rotate === 0 && result
|
|
1190
|
+
const shape = frame.wrap === 'contour' && frame.rotate === 0 && !turned && result
|
|
1054
1191
|
? frameContour(result.children, { gapPx: input.pushGapPx, dpi, emPx: input.emPx, mirrored: pageIsMirrored(input.page), pageIndex: input.page.index })
|
|
1055
1192
|
: undefined;
|
|
1056
1193
|
if (shape)
|
|
@@ -1086,6 +1223,16 @@ function composePage(input, template, fit, collapsed) {
|
|
|
1086
1223
|
const { frames, blocks, log, laid, needs, fitted, notes, spills } = first.pushRects.size > 0 ? run(first.pushRects, first.pushShapes) : first;
|
|
1087
1224
|
return { frames, blocks, log, laid, needs, template, fitted, spills, ...(notes.length > 0 ? { notes } : {}) };
|
|
1088
1225
|
}
|
|
1226
|
+
/** `r` turned `deg` (±90) about the centre of `about`: an axis-aligned
|
|
1227
|
+
* box again, its width and height swapped. */
|
|
1228
|
+
function turnRectAbout(r, about, deg) {
|
|
1229
|
+
const cx = about.x + about.width / 2;
|
|
1230
|
+
const cy = about.y + about.height / 2;
|
|
1231
|
+
const turn = (x, y) => deg > 0 ? { x: cx - (y - cy), y: cy + (x - cx) } : { x: cx + (y - cy), y: cy - (x - cx) };
|
|
1232
|
+
const a = turn(r.x, r.y);
|
|
1233
|
+
const b = turn(r.x + r.width, r.y + r.height);
|
|
1234
|
+
return { x: Math.min(a.x, b.x), y: Math.min(a.y, b.y), width: Math.abs(b.x - a.x), height: Math.abs(b.y - a.y) };
|
|
1235
|
+
}
|
|
1089
1236
|
const sameRect = (a, b) => Math.abs(a.x - b.x) < 0.01 && Math.abs(a.y - b.y) < 0.01 && Math.abs(a.width - b.width) < 0.01 && Math.abs(a.height - b.height) < 0.01;
|
|
1090
1237
|
/** Each laid frame's declared and final boxes, in template order, with
|
|
1091
1238
|
* what moves it: what it anchors to (a group: its frames, last first),
|