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.
- package/dist/__tests__/composed/fixtures/page8.d.ts.map +1 -1
- package/dist/__tests__/composed/fixtures/page8.js +6 -3
- package/dist/__tests__/composed/fixtures/page8.js.map +1 -1
- package/dist/__tests__/composed/fixtures/timeline.d.ts +26 -0
- package/dist/__tests__/composed/fixtures/timeline.d.ts.map +1 -0
- package/dist/__tests__/composed/fixtures/timeline.js +153 -0
- package/dist/__tests__/composed/fixtures/timeline.js.map +1 -0
- package/dist/__tests__/composed/groups.test.d.ts +2 -0
- package/dist/__tests__/composed/groups.test.d.ts.map +1 -0
- package/dist/__tests__/composed/groups.test.js +361 -0
- package/dist/__tests__/composed/groups.test.js.map +1 -0
- package/dist/__tests__/composed/outsidePrint.test.d.ts +2 -0
- package/dist/__tests__/composed/outsidePrint.test.d.ts.map +1 -0
- package/dist/__tests__/composed/outsidePrint.test.js +116 -0
- package/dist/__tests__/composed/outsidePrint.test.js.map +1 -0
- package/dist/__tests__/composed/spread.test.d.ts +2 -0
- package/dist/__tests__/composed/spread.test.d.ts.map +1 -0
- package/dist/__tests__/composed/spread.test.js +475 -0
- package/dist/__tests__/composed/spread.test.js.map +1 -0
- package/dist/__tests__/composedPaint.test.js +10 -2
- package/dist/__tests__/composedPaint.test.js.map +1 -1
- package/dist/__tests__/exports.test.js +13 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/canvas-backend/composed.d.ts +5 -1
- package/dist/canvas-backend/composed.d.ts.map +1 -1
- package/dist/canvas-backend/composed.js +28 -1
- package/dist/canvas-backend/composed.js.map +1 -1
- package/dist/canvas-backend/index.js +2 -2
- package/dist/canvas-backend/index.js.map +1 -1
- package/dist/composed/groups.d.ts +95 -0
- package/dist/composed/groups.d.ts.map +1 -0
- package/dist/composed/groups.js +359 -0
- package/dist/composed/groups.js.map +1 -0
- package/dist/composed/labelText.d.ts +15 -0
- package/dist/composed/labelText.d.ts.map +1 -0
- package/dist/composed/labelText.js +16 -0
- package/dist/composed/labelText.js.map +1 -0
- package/dist/composed/paint.d.ts +25 -2
- package/dist/composed/paint.d.ts.map +1 -1
- package/dist/composed/paint.js +46 -1
- package/dist/composed/paint.js.map +1 -1
- package/dist/composed/reflowLog.d.ts +39 -0
- package/dist/composed/reflowLog.d.ts.map +1 -0
- package/dist/composed/reflowLog.js +123 -0
- package/dist/composed/reflowLog.js.map +1 -0
- package/dist/composed/slotChecks.d.ts +7 -2
- package/dist/composed/slotChecks.d.ts.map +1 -1
- package/dist/composed/slotChecks.js +21 -0
- package/dist/composed/slotChecks.js.map +1 -1
- package/dist/composed/spread.d.ts +106 -0
- package/dist/composed/spread.d.ts.map +1 -0
- package/dist/composed/spread.js +178 -0
- package/dist/composed/spread.js.map +1 -0
- package/dist/defaults/headerFooter.d.ts.map +1 -1
- package/dist/defaults/headerFooter.js +4 -0
- package/dist/defaults/headerFooter.js.map +1 -1
- package/dist/design/layout.d.ts +9 -0
- package/dist/design/layout.d.ts.map +1 -1
- package/dist/design/layout.js +1 -1
- package/dist/design/layout.js.map +1 -1
- package/dist/html-backend.d.ts.map +1 -1
- package/dist/html-backend.js +56 -26
- package/dist/html-backend.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/pipeline/build.d.ts.map +1 -1
- package/dist/pipeline/build.js +76 -20
- package/dist/pipeline/build.js.map +1 -1
- package/dist/pipeline/buildMeasurement.d.ts +4 -1
- package/dist/pipeline/buildMeasurement.d.ts.map +1 -1
- package/dist/pipeline/buildMeasurement.js +19 -1
- package/dist/pipeline/buildMeasurement.js.map +1 -1
- package/dist/pipeline/calloutLayout.d.ts +3 -1
- package/dist/pipeline/calloutLayout.d.ts.map +1 -1
- package/dist/pipeline/calloutLayout.js +2 -1
- package/dist/pipeline/calloutLayout.js.map +1 -1
- package/dist/pipeline/composedLayout.d.ts +6 -1
- package/dist/pipeline/composedLayout.d.ts.map +1 -1
- package/dist/pipeline/composedLayout.js +223 -23
- package/dist/pipeline/composedLayout.js.map +1 -1
- package/dist/pipeline/contentWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings.js +7 -1
- package/dist/pipeline/contentWarnings.js.map +1 -1
- package/dist/pipeline/headerFooter.d.ts.map +1 -1
- package/dist/pipeline/headerFooter.js +55 -7
- package/dist/pipeline/headerFooter.js.map +1 -1
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/vdt.d.ts +83 -5
- package/dist/vdt.d.ts.map +1 -1
- package/dist/vdt.js.map +1 -1
- package/package.json +1 -1
package/dist/html-backend.js
CHANGED
|
@@ -24,7 +24,8 @@ import { playMarkTriangle, qrModuleRuns } from './pipeline/videoOverlay';
|
|
|
24
24
|
import { isHlsMimeType, mediaFragment, videoElementAttributes, videoEmbedAllow } from './video/url';
|
|
25
25
|
import { renderComicHtml } from './htmlComic';
|
|
26
26
|
import { comicBlockOnSheet, pageComics } from './comics/transform';
|
|
27
|
-
import {
|
|
27
|
+
import { altWithLabels } from './composed/labelText';
|
|
28
|
+
import { composedFrameBlockIds, composedPaintOrder, composedReadingOrder, composedSheetClip, frameClips, frameMatrix } from './composed/paint';
|
|
28
29
|
import { taskBoxSvgBody, taskBoxText } from './taskBox';
|
|
29
30
|
/**
|
|
30
31
|
* Declarations of every box of CJK text measured with no punctuation
|
|
@@ -2489,7 +2490,8 @@ function renderResourceBlockHtml(block, paint) {
|
|
|
2489
2490
|
else if (rb.kind === 'bitmap' || rb.kind === 'svg') {
|
|
2490
2491
|
const url = rb.fileId ? imageUrl(options, rb.fileId, rb.resource.id) : undefined;
|
|
2491
2492
|
// `<img>`, or a neutral placeholder matching the canvas backend's colours.
|
|
2492
|
-
|
|
2493
|
+
// A `:::figure`'s labels follow its alternative text (#862).
|
|
2494
|
+
parts.push(renderFittedImage(url, altWithLabels(rb.resource.altText ?? '', rb.labels), rb.kind === 'svg' ? 'SVG' : 'Image', bx, by, bw, bh, options, rb.kind === 'svg', rb.bodySource));
|
|
2493
2495
|
}
|
|
2494
2496
|
else if (rb.kind === 'table') {
|
|
2495
2497
|
parts.push(renderResourceTable(rb, bx, by, options));
|
|
@@ -2917,34 +2919,58 @@ verticalRegion, verticalDigits) {
|
|
|
2917
2919
|
continue;
|
|
2918
2920
|
blocks.push({ id: fb.id, html: renderBlock(fb, options, stripInBlock(fb)) });
|
|
2919
2921
|
}
|
|
2920
|
-
// The frames
|
|
2921
|
-
//
|
|
2922
|
-
//
|
|
2922
|
+
// The frames, each in a box of its own that turns it and clips it, in
|
|
2923
|
+
// reading order (Markdown order, #862: what a screen reader and a
|
|
2924
|
+
// fixed-layout EPUB read), painted in layer order by their `z-index`
|
|
2925
|
+
// inside one stacking context, the template's decoration at layer 0;
|
|
2926
|
+
// through a flow frame the decoration stands on the sheet, after the flow.
|
|
2923
2927
|
const composedFlow = page.composed !== undefined && !plainFlow;
|
|
2924
|
-
|
|
2928
|
+
// On a page of a spread (#861) the frames and the decoration show the
|
|
2929
|
+
// page's share of the sheet only.
|
|
2930
|
+
const sheetClip = composedSheetClip(page);
|
|
2931
|
+
const sheetClipped = (html) => {
|
|
2932
|
+
if (!sheetClip || html === '')
|
|
2933
|
+
return html;
|
|
2934
|
+
const [l, t, r, b] = [sheetClip.x, sheetClip.y, sheetClip.x + sheetClip.width, sheetClip.y + sheetClip.height].map(frameNum);
|
|
2935
|
+
return `<div class="pt-sheet-clip" style="position:absolute;left:0;top:0;width:0;height:0;overflow:visible;clip-path:polygon(${l}px ${t}px,${r}px ${t}px,${r}px ${b}px,${l}px ${b}px);">${html}</div>`;
|
|
2936
|
+
};
|
|
2937
|
+
const composedDecorationHtml = page.composed?.decoration ? sheetClipped(renderDesignSlot(page.composed.decoration, composedFlow ? { ...options, vertical: undefined } : options)) : '';
|
|
2925
2938
|
const composedParts = [];
|
|
2926
2939
|
/** The frames' boxes and the decoration: what a patcher of blocks must
|
|
2927
2940
|
* also compare (`decorationHtml`). */
|
|
2928
2941
|
const composedShape = [];
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2942
|
+
if (page.composed) {
|
|
2943
|
+
const paint = composedPaintOrder(page);
|
|
2944
|
+
for (const item of composedReadingOrder(paint)) {
|
|
2945
|
+
const z = paint.indexOf(item) + 1;
|
|
2946
|
+
if (item.kind === 'decoration') {
|
|
2947
|
+
if (!composedFlow && composedDecorationHtml)
|
|
2948
|
+
composedParts.push(`<div class="pt-frame-decoration" style="position:absolute;left:0;top:0;width:0;height:0;z-index:${z};">${composedDecorationHtml}</div>`);
|
|
2949
|
+
continue;
|
|
2950
|
+
}
|
|
2951
|
+
if (item.blocks.length === 0)
|
|
2952
|
+
continue;
|
|
2953
|
+
const open = composedFrameOpen(item.frame, z, item.facing);
|
|
2954
|
+
composedShape.push(open);
|
|
2955
|
+
composedParts.push(open);
|
|
2956
|
+
for (const b of item.blocks) {
|
|
2957
|
+
const html = renderBlock(b, options, stripInBlock(b));
|
|
2958
|
+
// The facing page's half of a frame across a spread's spine is
|
|
2959
|
+
// painted only: no block of the page's to patch or select.
|
|
2960
|
+
if (item.facing)
|
|
2961
|
+
composedShape.push(html);
|
|
2962
|
+
else
|
|
2963
|
+
blocks.push({ id: b.id, html });
|
|
2964
|
+
composedParts.push(html);
|
|
2965
|
+
}
|
|
2966
|
+
composedParts.push('</div>');
|
|
2934
2967
|
}
|
|
2935
|
-
if (
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
composedShape.push(open);
|
|
2939
|
-
composedParts.push(open);
|
|
2940
|
-
for (const b of item.blocks) {
|
|
2941
|
-
const html = renderBlock(b, options, stripInBlock(b));
|
|
2942
|
-
blocks.push({ id: b.id, html });
|
|
2943
|
-
composedParts.push(html);
|
|
2968
|
+
if (composedParts.length > 0) {
|
|
2969
|
+
composedParts.unshift('<div class="pt-composed" style="position:absolute;left:0;top:0;width:0;height:0;z-index:0;">');
|
|
2970
|
+
composedParts.push('</div>');
|
|
2944
2971
|
}
|
|
2945
|
-
composedParts.push('</div>');
|
|
2946
2972
|
}
|
|
2947
|
-
const blocksHtml = blocks.filter((b) => !frameIds.has(b.id)).map((b) => b.html).join('') + composedParts.join('');
|
|
2973
|
+
const blocksHtml = blocks.filter((b) => !frameIds.has(b.id)).map((b) => b.html).join('') + sheetClipped(composedParts.join(''));
|
|
2948
2974
|
// Same paint order as the canvas backend: the opener / part band goes
|
|
2949
2975
|
// under the body (a part page's full-bleed background must not cover its
|
|
2950
2976
|
// chapter list); header and footer paint on top.
|
|
@@ -3013,9 +3039,13 @@ function frameNum(v) {
|
|
|
3013
3039
|
/** The opening tag of a composed page's frame (#855): an empty box at the
|
|
3014
3040
|
* page's origin, so the frame's blocks keep their page coordinates, turned
|
|
3015
3041
|
* about the frame's centre (`frameMatrix`) and, when the frame's content
|
|
3016
|
-
* overflows it, clipped to the frame's box (`frameClips`).
|
|
3017
|
-
|
|
3018
|
-
|
|
3042
|
+
* overflows it, clipped to the frame's box (`frameClips`). `z`: its place
|
|
3043
|
+
* in the paint order (`composedPaintOrder`), as the frames are written
|
|
3044
|
+
* in reading order. The facing page's half of a frame across a spread's
|
|
3045
|
+
* spine (#861) is hidden from assistive technology: the text is read on
|
|
3046
|
+
* the other page. */
|
|
3047
|
+
function composedFrameOpen(frame, z, facing = false) {
|
|
3048
|
+
const decls = ['position:absolute', 'left:0', 'top:0', 'width:0', 'height:0', `z-index:${z}`];
|
|
3019
3049
|
const m = frameMatrix(frame);
|
|
3020
3050
|
if (m)
|
|
3021
3051
|
decls.push('transform-origin:0 0', `transform:matrix(${m.map(frameNum).join(',')})`);
|
|
@@ -3024,7 +3054,7 @@ function composedFrameOpen(frame) {
|
|
|
3024
3054
|
const [l, t, r, b] = [x, y, x + width, y + height].map(frameNum);
|
|
3025
3055
|
decls.push(`clip-path:polygon(${l}px ${t}px,${r}px ${t}px,${r}px ${b}px,${l}px ${b}px)`);
|
|
3026
3056
|
}
|
|
3027
|
-
return `<div class="pt-frame" data-frame-id="${esc(frame.id)}" data-layer="${frame.layer}" style="${decls.join(';')};">`;
|
|
3057
|
+
return `<div class="pt-frame" data-frame-id="${esc(frame.id)}" data-layer="${frame.layer}"${facing ? ' data-facing="true" aria-hidden="true"' : ''} style="${decls.join(';')};">`;
|
|
3028
3058
|
}
|
|
3029
3059
|
/** The markup of a comic on a page (its comic page, a half of a spread or
|
|
3030
3060
|
* a strip, on the sheet; #565): see `renderComicHtml`. Its pictures come
|