postext 1.34.0 → 1.34.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__/bundle.test.js +33 -1
- package/dist/__tests__/bundle.test.js.map +1 -1
- package/dist/__tests__/codeBlocks.test.js +88 -0
- package/dist/__tests__/codeBlocks.test.js.map +1 -1
- package/dist/__tests__/composed/fixtures/page8.d.ts +20 -0
- package/dist/__tests__/composed/fixtures/page8.d.ts.map +1 -0
- package/dist/__tests__/composed/fixtures/page8.js +159 -0
- package/dist/__tests__/composed/fixtures/page8.js.map +1 -0
- package/dist/__tests__/composed/layout.test.d.ts +2 -0
- package/dist/__tests__/composed/layout.test.d.ts.map +1 -0
- package/dist/__tests__/composed/layout.test.js +387 -0
- package/dist/__tests__/composed/layout.test.js.map +1 -0
- package/dist/__tests__/composed/slotChecks.test.js +6 -3
- package/dist/__tests__/composed/slotChecks.test.js.map +1 -1
- package/dist/__tests__/composedPaint.test.d.ts +2 -0
- package/dist/__tests__/composedPaint.test.d.ts.map +1 -0
- package/dist/__tests__/composedPaint.test.js +191 -0
- package/dist/__tests__/composedPaint.test.js.map +1 -0
- package/dist/__tests__/defaults/stripRoundTrip.test.js +3 -2
- package/dist/__tests__/defaults/stripRoundTrip.test.js.map +1 -1
- package/dist/__tests__/exports.test.js +12 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/highlightMarks.test.d.ts +2 -0
- package/dist/__tests__/highlightMarks.test.d.ts.map +1 -0
- package/dist/__tests__/highlightMarks.test.js +169 -0
- package/dist/__tests__/highlightMarks.test.js.map +1 -0
- package/dist/__tests__/tocPartLeader.test.d.ts +2 -0
- package/dist/__tests__/tocPartLeader.test.d.ts.map +1 -0
- package/dist/__tests__/tocPartLeader.test.js +133 -0
- package/dist/__tests__/tocPartLeader.test.js.map +1 -0
- package/dist/bundle/api.d.ts +8 -0
- package/dist/bundle/api.d.ts.map +1 -1
- package/dist/bundle/api.js +6 -3
- package/dist/bundle/api.js.map +1 -1
- package/dist/bundle/codec.d.ts +5 -0
- package/dist/bundle/codec.d.ts.map +1 -1
- package/dist/bundle/codec.js +4 -0
- package/dist/bundle/codec.js.map +1 -1
- package/dist/bundle/index.d.ts +2 -2
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/index.js.map +1 -1
- package/dist/bundle/manifest.d.ts +14 -0
- package/dist/bundle/manifest.d.ts.map +1 -1
- package/dist/bundle/manifest.js +13 -0
- package/dist/bundle/manifest.js.map +1 -1
- package/dist/bundle/types.d.ts +7 -0
- package/dist/bundle/types.d.ts.map +1 -1
- package/dist/canvas-backend/annotations.d.ts +6 -0
- package/dist/canvas-backend/annotations.d.ts.map +1 -1
- package/dist/canvas-backend/annotations.js +39 -0
- package/dist/canvas-backend/annotations.js.map +1 -1
- package/dist/canvas-backend/blockRender.d.ts.map +1 -1
- package/dist/canvas-backend/blockRender.js +6 -1
- package/dist/canvas-backend/blockRender.js.map +1 -1
- package/dist/canvas-backend/composed.d.ts +15 -0
- package/dist/canvas-backend/composed.d.ts.map +1 -0
- package/dist/canvas-backend/composed.js +41 -0
- package/dist/canvas-backend/composed.js.map +1 -0
- package/dist/canvas-backend/index.d.ts.map +1 -1
- package/dist/canvas-backend/index.js +15 -1
- 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 +4 -1
- package/dist/canvas-backend/renderResourceBlock.js.map +1 -1
- package/dist/composed/geometry.d.ts +108 -0
- package/dist/composed/geometry.d.ts.map +1 -0
- package/dist/composed/geometry.js +241 -0
- package/dist/composed/geometry.js.map +1 -0
- package/dist/composed/paint.d.ts +41 -0
- package/dist/composed/paint.d.ts.map +1 -0
- package/dist/composed/paint.js +83 -0
- package/dist/composed/paint.js.map +1 -0
- package/dist/composed/types.d.ts +1 -44
- package/dist/composed/types.d.ts.map +1 -1
- package/dist/composed/wrap.d.ts +52 -0
- package/dist/composed/wrap.d.ts.map +1 -0
- package/dist/composed/wrap.js +234 -0
- package/dist/composed/wrap.js.map +1 -0
- package/dist/configWarnings.js +1 -1
- package/dist/configWarnings.js.map +1 -1
- package/dist/defaults/codeStyle.d.ts.map +1 -1
- package/dist/defaults/codeStyle.js +1 -0
- package/dist/defaults/codeStyle.js.map +1 -1
- package/dist/defaults/index.d.ts +1 -0
- package/dist/defaults/index.d.ts.map +1 -1
- package/dist/defaults/index.js +9 -0
- package/dist/defaults/index.js.map +1 -1
- package/dist/defaults/markStyles.d.ts +23 -0
- package/dist/defaults/markStyles.d.ts.map +1 -0
- package/dist/defaults/markStyles.js +80 -0
- package/dist/defaults/markStyles.js.map +1 -0
- package/dist/defaults/shared.d.ts.map +1 -1
- package/dist/defaults/shared.js +12 -0
- package/dist/defaults/shared.js.map +1 -1
- package/dist/design/bidiText.d.ts +4 -1
- package/dist/design/bidiText.d.ts.map +1 -1
- package/dist/design/bidiText.js +5 -2
- package/dist/design/bidiText.js.map +1 -1
- package/dist/design/layout.d.ts +10 -0
- package/dist/design/layout.d.ts.map +1 -1
- package/dist/design/layout.js +110 -8
- package/dist/design/layout.js.map +1 -1
- package/dist/design/placeholders.d.ts +28 -2
- package/dist/design/placeholders.d.ts.map +1 -1
- package/dist/design/placeholders.js +24 -1
- package/dist/design/placeholders.js.map +1 -1
- package/dist/design/richText.d.ts +2 -0
- package/dist/design/richText.d.ts.map +1 -1
- package/dist/design/richText.js.map +1 -1
- package/dist/highlightMarks.d.ts +33 -0
- package/dist/highlightMarks.d.ts.map +1 -0
- package/dist/highlightMarks.js +209 -0
- package/dist/highlightMarks.js.map +1 -0
- package/dist/html-backend.d.ts.map +1 -1
- package/dist/html-backend.js +65 -8
- package/dist/html-backend.js.map +1 -1
- package/dist/htmlAnnotations.d.ts +5 -0
- package/dist/htmlAnnotations.d.ts.map +1 -1
- package/dist/htmlAnnotations.js +16 -0
- package/dist/htmlAnnotations.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/knuthPlass/richAdapter.d.ts +3 -0
- package/dist/knuthPlass/richAdapter.d.ts.map +1 -1
- package/dist/knuthPlass/richAdapter.js +3 -2
- package/dist/knuthPlass/richAdapter.js.map +1 -1
- package/dist/measure/cache.js +3 -3
- package/dist/measure/cache.js.map +1 -1
- package/dist/measure/chipEdges.d.ts +13 -1
- package/dist/measure/chipEdges.d.ts.map +1 -1
- package/dist/measure/chipEdges.js +59 -1
- package/dist/measure/chipEdges.js.map +1 -1
- package/dist/measure/links.d.ts.map +1 -1
- package/dist/measure/links.js +78 -5
- package/dist/measure/links.js.map +1 -1
- package/dist/measure/rich.d.ts +3 -0
- package/dist/measure/rich.d.ts.map +1 -1
- package/dist/measure/rich.js +19 -4
- package/dist/measure/rich.js.map +1 -1
- package/dist/parse/inlineFormatting.d.ts +14 -0
- package/dist/parse/inlineFormatting.d.ts.map +1 -1
- package/dist/parse/inlineFormatting.js +104 -5
- package/dist/parse/inlineFormatting.js.map +1 -1
- package/dist/parse/links.js +1 -1
- package/dist/parse/links.js.map +1 -1
- package/dist/parse/softBreaks.js +1 -1
- package/dist/parse/softBreaks.js.map +1 -1
- package/dist/parse/sourceMapping.d.ts.map +1 -1
- package/dist/parse/sourceMapping.js +19 -3
- package/dist/parse/sourceMapping.js.map +1 -1
- package/dist/parse/types.d.ts +24 -0
- package/dist/parse/types.d.ts.map +1 -1
- package/dist/pipeline/build.d.ts.map +1 -1
- package/dist/pipeline/build.js +156 -300
- package/dist/pipeline/build.js.map +1 -1
- package/dist/pipeline/calloutLayout.d.ts +33 -0
- package/dist/pipeline/calloutLayout.d.ts.map +1 -1
- package/dist/pipeline/calloutLayout.js +91 -2
- package/dist/pipeline/calloutLayout.js.map +1 -1
- package/dist/pipeline/codeInline.d.ts +10 -1
- package/dist/pipeline/codeInline.d.ts.map +1 -1
- package/dist/pipeline/codeInline.js +96 -15
- package/dist/pipeline/codeInline.js.map +1 -1
- package/dist/pipeline/composedLayout.d.ts +88 -0
- package/dist/pipeline/composedLayout.d.ts.map +1 -0
- package/dist/pipeline/composedLayout.js +320 -0
- package/dist/pipeline/composedLayout.js.map +1 -0
- package/dist/pipeline/config.d.ts.map +1 -1
- package/dist/pipeline/config.js +2 -1
- package/dist/pipeline/config.js.map +1 -1
- package/dist/pipeline/contentWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings.js +32 -1
- package/dist/pipeline/contentWarnings.js.map +1 -1
- package/dist/pipeline/floatSlots.js +1 -1
- package/dist/pipeline/floatSlots.js.map +1 -1
- package/dist/pipeline/frameLayout.d.ts +120 -0
- package/dist/pipeline/frameLayout.d.ts.map +1 -0
- package/dist/pipeline/frameLayout.js +279 -0
- package/dist/pipeline/frameLayout.js.map +1 -0
- package/dist/pipeline/headerFooter.d.ts.map +1 -1
- package/dist/pipeline/headerFooter.js +48 -3
- package/dist/pipeline/headerFooter.js.map +1 -1
- package/dist/pipeline/pageRoles.d.ts +1 -0
- package/dist/pipeline/pageRoles.d.ts.map +1 -1
- package/dist/pipeline/pageRoles.js +3 -0
- package/dist/pipeline/pageRoles.js.map +1 -1
- package/dist/pipeline/placement.js +1 -1
- package/dist/pipeline/placement.js.map +1 -1
- package/dist/pipeline/resourceLayout.d.ts.map +1 -1
- package/dist/pipeline/resourceLayout.js +5 -3
- package/dist/pipeline/resourceLayout.js.map +1 -1
- package/dist/pipeline/tabs.js +1 -1
- package/dist/pipeline/tabs.js.map +1 -1
- package/dist/types.d.ts +69 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/vdt.d.ts +169 -1
- 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
|
@@ -19,11 +19,12 @@ import { measureSpacedWidth, measureTextWidth, withMeasureLanguage } from './mea
|
|
|
19
19
|
import { trackedLigaturePieces } from './measure/trackedLigatures';
|
|
20
20
|
import { cellsOf, lineWordSegmentsInOrder, sameSetWidth } from './wordPieces';
|
|
21
21
|
import { fontFamilyOf } from './measure/vertical';
|
|
22
|
-
import { lineMarksHtml, rubyHtml, verticalLineMarksHtml, warichuHtml, sideMarkerHtml, RT_OPEN, RUBY_OPEN, rubyGroupOf, kuntenHtml, verticalKuntenTateHtml } from './htmlAnnotations';
|
|
22
|
+
import { lineHighlightsHtml, lineMarksHtml, rubyHtml, verticalLineMarksHtml, warichuHtml, sideMarkerHtml, RT_OPEN, RUBY_OPEN, rubyGroupOf, kuntenHtml, verticalKuntenTateHtml } from './htmlAnnotations';
|
|
23
23
|
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 { composedFrameBlockIds, composedPaintOrder, frameClips, frameMatrix } from './composed/paint';
|
|
27
28
|
import { taskBoxSvgBody, taskBoxText } from './taskBox';
|
|
28
29
|
/**
|
|
29
30
|
* Declarations of every box of CJK text measured with no punctuation
|
|
@@ -1710,7 +1711,7 @@ lead = '') {
|
|
|
1710
1711
|
strikethroughDecl +
|
|
1711
1712
|
trackingDecl +
|
|
1712
1713
|
(lineCjkDecl(line) ? cjkTextDecl(tracking !== 0) : '') +
|
|
1713
|
-
`">${lead}${renderSegments(line, block, targets, rootDir, rootLang, lineEndText(line, next))}</div>`);
|
|
1714
|
+
`">${lineHighlightsHtml(line)}${lead}${renderSegments(line, block, targets, rootDir, rootLang, lineEndText(line, next))}</div>`);
|
|
1714
1715
|
}
|
|
1715
1716
|
/**
|
|
1716
1717
|
* A paragraph's drop cap (#623), as the first runs of its first line's box:
|
|
@@ -2235,7 +2236,7 @@ end = '') {
|
|
|
2235
2236
|
// measured with the tracking in its widths.
|
|
2236
2237
|
(line.letterSpacing ? `letter-spacing:${line.letterSpacing}px;${ligaturesDecl()}` : '') +
|
|
2237
2238
|
(lineDecl ? cjkTextDecl(!!line.letterSpacing) : '') +
|
|
2238
|
-
`">${parts.join('')}</div>`);
|
|
2239
|
+
`">${lineHighlightsHtml(line)}${parts.join('')}</div>`);
|
|
2239
2240
|
}
|
|
2240
2241
|
/** An image fitted to a box: `<img>` from `resourceImageUrl`, or the neutral
|
|
2241
2242
|
* placeholder the canvas backend paints when nothing is registered. */
|
|
@@ -2626,7 +2627,10 @@ function renderDesignTextBlock(block, options) {
|
|
|
2626
2627
|
// indents its text, and so would a box inside it.
|
|
2627
2628
|
: run.inkOffset !== undefined ? esc(run.text)
|
|
2628
2629
|
: wordsHtml(run.text, trackedIn(run.fontString, block.letterSpacingPx));
|
|
2629
|
-
|
|
2630
|
+
// A contents part row's leader (#889): painted, hidden from
|
|
2631
|
+
// assistive technology, as an entry row's is.
|
|
2632
|
+
const hidden = run.leader ? ' aria-hidden="true"' : '';
|
|
2633
|
+
return fontDecl || cjkDecl || stackDecl || shiftDecl || boxDecl || hidden ? `<span${hidden} style="${fontDecl}${cjkDecl}${cellsDecl}${stackDecl}${shiftDecl}${boxDecl}">${text}</span>` : text;
|
|
2630
2634
|
}).join('')
|
|
2631
2635
|
: letterlessRunHtml(line.text, block.fontString, false, line.width, block.letterSpacingPx ?? 0) ?? wordsHtml(line.text, trackedIn(block.fontString, block.letterSpacingPx));
|
|
2632
2636
|
// A line that carries directions (an order, a right-to-left run): a box
|
|
@@ -2905,11 +2909,42 @@ verticalRegion, verticalDigits) {
|
|
|
2905
2909
|
}
|
|
2906
2910
|
}
|
|
2907
2911
|
// Floated resources live in page bands outside the columns (a span:'page'
|
|
2908
|
-
// float crosses the gutter); they carry absolute geometry already.
|
|
2912
|
+
// float crosses the gutter); they carry absolute geometry already. A
|
|
2913
|
+
// composed page's frames (#855) are floats painted with their frames.
|
|
2914
|
+
const frameIds = composedFrameBlockIds(page);
|
|
2909
2915
|
for (const fb of page.floats ?? []) {
|
|
2916
|
+
if (frameIds.has(fb.id))
|
|
2917
|
+
continue;
|
|
2910
2918
|
blocks.push({ id: fb.id, html: renderBlock(fb, options, stripInBlock(fb)) });
|
|
2911
2919
|
}
|
|
2912
|
-
|
|
2920
|
+
// The frames in layer order, each in a box of its own that turns it and
|
|
2921
|
+
// clips it, the template's decoration at layer 0; through a flow frame
|
|
2922
|
+
// the decoration stands on the sheet, after the flow.
|
|
2923
|
+
const composedFlow = page.composed !== undefined && !plainFlow;
|
|
2924
|
+
const composedDecorationHtml = page.composed?.decoration ? renderDesignSlot(page.composed.decoration, composedFlow ? { ...options, vertical: undefined } : options) : '';
|
|
2925
|
+
const composedParts = [];
|
|
2926
|
+
/** The frames' boxes and the decoration: what a patcher of blocks must
|
|
2927
|
+
* also compare (`decorationHtml`). */
|
|
2928
|
+
const composedShape = [];
|
|
2929
|
+
for (const item of composedPaintOrder(page)) {
|
|
2930
|
+
if (item.kind === 'decoration') {
|
|
2931
|
+
if (!composedFlow)
|
|
2932
|
+
composedParts.push(composedDecorationHtml);
|
|
2933
|
+
continue;
|
|
2934
|
+
}
|
|
2935
|
+
if (item.blocks.length === 0)
|
|
2936
|
+
continue;
|
|
2937
|
+
const open = composedFrameOpen(item.frame);
|
|
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);
|
|
2944
|
+
}
|
|
2945
|
+
composedParts.push('</div>');
|
|
2946
|
+
}
|
|
2947
|
+
const blocksHtml = blocks.filter((b) => !frameIds.has(b.id)).map((b) => b.html).join('') + composedParts.join('');
|
|
2913
2948
|
// Same paint order as the canvas backend: the opener / part band goes
|
|
2914
2949
|
// under the body (a part page's full-bleed background must not cover its
|
|
2915
2950
|
// chapter list); header and footer paint on top.
|
|
@@ -2937,7 +2972,8 @@ verticalRegion, verticalDigits) {
|
|
|
2937
2972
|
// flow frame), under the running heads, as the canvas paints them.
|
|
2938
2973
|
const comicHtml = page.comic ? comicMarkup(page.comic) : '';
|
|
2939
2974
|
const sheetComicsHtml = comicHtml + (plainFlow ? '' : comics.filter((c) => c !== page.comic).map(comicMarkup).join(''));
|
|
2940
|
-
const
|
|
2975
|
+
const sheetComposedHtml = composedFlow ? composedDecorationHtml : '';
|
|
2976
|
+
const decorationHtml = defsHtml + gridHtml + openerHtml + footnoteRulesHtml + sheetComicsHtml + composedShape.join('') + composedDecorationHtml + slotParts.join('');
|
|
2941
2977
|
// A vertical page's flow: one box turned a quarter turn clockwise, its
|
|
2942
2978
|
// text lines turned back and set vertically (see `renderVerticalLine`).
|
|
2943
2979
|
const anchorsHtml = (options.anchors ?? [])
|
|
@@ -2953,7 +2989,7 @@ verticalRegion, verticalDigits) {
|
|
|
2953
2989
|
? `<div class="pt-flow" style="position:absolute;left:0;top:0;width:${page.height}px;height:${page.width}px;transform:translate(${page.width}px,0) rotate(90deg);transform-origin:0 0;">${flowHtml}</div>`
|
|
2954
2990
|
: page.flow?.writingMode === 'horizontal-tb'
|
|
2955
2991
|
? `<div class="pt-flow pt-flow-mirrored" style="position:absolute;left:0;top:0;width:${page.width}px;height:${page.height}px;transform:scaleX(-1);transform-origin:${page.flow.mirror.originX / 2}px 0;">${MIRRORED_FLOW_STYLE}${flowHtml}</div>`
|
|
2956
|
-
: flowHtml) + sheetComicsHtml + slotParts.join('');
|
|
2992
|
+
: flowHtml) + sheetComposedHtml + sheetComicsHtml + slotParts.join('');
|
|
2957
2993
|
// A right-to-left document's pages say so, with its language, for a host
|
|
2958
2994
|
// that mounts them apart from the document's root (#379); so do a
|
|
2959
2995
|
// Japanese document's, whose glyph forms (a pan-CJK face's `locl`) and
|
|
@@ -2969,6 +3005,27 @@ verticalRegion, verticalDigits) {
|
|
|
2969
3005
|
`">${innerHtml}</div>`;
|
|
2970
3006
|
return { outerHtml, innerHtml, blocks, decorationHtml, ...(comicHtml ? { comicHtml } : {}) };
|
|
2971
3007
|
}
|
|
3008
|
+
/** A number of a frame's box, to four decimals. */
|
|
3009
|
+
function frameNum(v) {
|
|
3010
|
+
const r = Math.round(v * 1e4) / 1e4;
|
|
3011
|
+
return String(Object.is(r, -0) ? 0 : r);
|
|
3012
|
+
}
|
|
3013
|
+
/** The opening tag of a composed page's frame (#855): an empty box at the
|
|
3014
|
+
* page's origin, so the frame's blocks keep their page coordinates, turned
|
|
3015
|
+
* about the frame's centre (`frameMatrix`) and, when the frame's content
|
|
3016
|
+
* overflows it, clipped to the frame's box (`frameClips`). */
|
|
3017
|
+
function composedFrameOpen(frame) {
|
|
3018
|
+
const decls = ['position:absolute', 'left:0', 'top:0', 'width:0', 'height:0'];
|
|
3019
|
+
const m = frameMatrix(frame);
|
|
3020
|
+
if (m)
|
|
3021
|
+
decls.push('transform-origin:0 0', `transform:matrix(${m.map(frameNum).join(',')})`);
|
|
3022
|
+
if (frameClips(frame)) {
|
|
3023
|
+
const { x, y, width, height } = frame.rect;
|
|
3024
|
+
const [l, t, r, b] = [x, y, x + width, y + height].map(frameNum);
|
|
3025
|
+
decls.push(`clip-path:polygon(${l}px ${t}px,${r}px ${t}px,${r}px ${b}px,${l}px ${b}px)`);
|
|
3026
|
+
}
|
|
3027
|
+
return `<div class="pt-frame" data-frame-id="${esc(frame.id)}" data-layer="${frame.layer}" style="${decls.join(';')};">`;
|
|
3028
|
+
}
|
|
2972
3029
|
/** The markup of a comic on a page (its comic page, a half of a spread or
|
|
2973
3030
|
* a strip, on the sheet; #565): see `renderComicHtml`. Its pictures come
|
|
2974
3031
|
* from `resourceImageUrl` (a miss reported once and drawn as a
|