postext 1.83.0 → 1.84.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__/checks/preflightFinishes.test.d.ts +2 -0
- package/dist/__tests__/checks/preflightFinishes.test.d.ts.map +1 -0
- package/dist/__tests__/checks/preflightFinishes.test.js +59 -0
- package/dist/__tests__/checks/preflightFinishes.test.js.map +1 -0
- package/dist/__tests__/color/inkFinishes.test.d.ts +2 -0
- package/dist/__tests__/color/inkFinishes.test.d.ts.map +1 -0
- package/dist/__tests__/color/inkFinishes.test.js +158 -0
- package/dist/__tests__/color/inkFinishes.test.js.map +1 -0
- package/dist/__tests__/defaults/stripRoundTrip.harness.d.ts.map +1 -1
- package/dist/__tests__/defaults/stripRoundTrip.harness.js +3 -1
- package/dist/__tests__/defaults/stripRoundTrip.harness.js.map +1 -1
- package/dist/__tests__/exports.test.js +34 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/paint/finishMask.test.d.ts +2 -0
- package/dist/__tests__/paint/finishMask.test.d.ts.map +1 -0
- package/dist/__tests__/paint/finishMask.test.js +243 -0
- package/dist/__tests__/paint/finishMask.test.js.map +1 -0
- package/dist/__tests__/paint/rasterCanvas.d.ts +84 -0
- package/dist/__tests__/paint/rasterCanvas.d.ts.map +1 -0
- package/dist/__tests__/paint/rasterCanvas.js +192 -0
- package/dist/__tests__/paint/rasterCanvas.js.map +1 -0
- package/dist/__tests__/parse/containers.test.js +1 -1
- package/dist/__tests__/parse/containers.test.js.map +1 -1
- package/dist/__tests__/pipeline/pages/dieCuts.test.d.ts +2 -0
- package/dist/__tests__/pipeline/pages/dieCuts.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/pages/dieCuts.test.js +194 -0
- package/dist/__tests__/pipeline/pages/dieCuts.test.js.map +1 -0
- package/dist/canvas-backend/cut/through.d.ts +41 -0
- package/dist/canvas-backend/cut/through.d.ts.map +1 -0
- package/dist/canvas-backend/cut/through.js +115 -0
- package/dist/canvas-backend/cut/through.js.map +1 -0
- package/dist/canvas-backend/cut/through.test.d.ts +2 -0
- package/dist/canvas-backend/cut/through.test.d.ts.map +1 -0
- package/dist/canvas-backend/cut/through.test.js +99 -0
- package/dist/canvas-backend/cut/through.test.js.map +1 -0
- package/dist/canvas-backend/finish/mask.d.ts +91 -0
- package/dist/canvas-backend/finish/mask.d.ts.map +1 -0
- package/dist/canvas-backend/finish/mask.js +284 -0
- package/dist/canvas-backend/finish/mask.js.map +1 -0
- package/dist/canvas-backend/finish/maskSvg.d.ts +25 -0
- package/dist/canvas-backend/finish/maskSvg.d.ts.map +1 -0
- package/dist/canvas-backend/finish/maskSvg.js +69 -0
- package/dist/canvas-backend/finish/maskSvg.js.map +1 -0
- package/dist/canvas-backend/finish/paint.d.ts +50 -0
- package/dist/canvas-backend/finish/paint.d.ts.map +1 -0
- package/dist/canvas-backend/finish/paint.js +131 -0
- package/dist/canvas-backend/finish/paint.js.map +1 -0
- package/dist/canvas-backend/finish/preview.d.ts +27 -0
- package/dist/canvas-backend/finish/preview.d.ts.map +1 -0
- package/dist/canvas-backend/finish/preview.js +103 -0
- package/dist/canvas-backend/finish/preview.js.map +1 -0
- package/dist/canvas-backend/index.d.ts +18 -0
- package/dist/canvas-backend/index.d.ts.map +1 -1
- package/dist/canvas-backend/index.js +23 -2
- package/dist/canvas-backend/index.js.map +1 -1
- package/dist/canvas-backend/renderResourceBlock/images.d.ts +6 -0
- package/dist/canvas-backend/renderResourceBlock/images.d.ts.map +1 -1
- package/dist/canvas-backend/renderResourceBlock/images.js +12 -0
- package/dist/canvas-backend/renderResourceBlock/images.js.map +1 -1
- package/dist/checks/configWarnings/collect.d.ts +3 -1
- package/dist/checks/configWarnings/collect.d.ts.map +1 -1
- package/dist/checks/configWarnings/collect.js +5 -2
- package/dist/checks/configWarnings/collect.js.map +1 -1
- package/dist/checks/configWarnings/dieCuts.d.ts +13 -0
- package/dist/checks/configWarnings/dieCuts.d.ts.map +1 -0
- package/dist/checks/configWarnings/dieCuts.js +68 -0
- package/dist/checks/configWarnings/dieCuts.js.map +1 -0
- package/dist/checks/preflight.d.ts +5 -161
- package/dist/checks/preflight.d.ts.map +1 -1
- package/dist/checks/preflight.js +11 -0
- package/dist/checks/preflight.js.map +1 -1
- package/dist/checks/preflightDieCuts.d.ts +20 -0
- package/dist/checks/preflightDieCuts.d.ts.map +1 -0
- package/dist/checks/preflightDieCuts.js +112 -0
- package/dist/checks/preflightDieCuts.js.map +1 -0
- package/dist/checks/preflightFinishes.d.ts +20 -0
- package/dist/checks/preflightFinishes.d.ts.map +1 -0
- package/dist/checks/preflightFinishes.js +75 -0
- package/dist/checks/preflightFinishes.js.map +1 -0
- package/dist/checks/preflightInks.d.ts +2 -2
- package/dist/checks/preflightInks.d.ts.map +1 -1
- package/dist/checks/preflightIssues.d.ts +216 -0
- package/dist/checks/preflightIssues.d.ts.map +1 -0
- package/dist/checks/preflightIssues.js +6 -0
- package/dist/checks/preflightIssues.js.map +1 -0
- package/dist/checks/preflightPlates.d.ts +2 -2
- package/dist/checks/preflightPlates.d.ts.map +1 -1
- package/dist/color/authored.d.ts +11 -7
- package/dist/color/authored.d.ts.map +1 -1
- package/dist/color/authored.js +11 -6
- package/dist/color/authored.js.map +1 -1
- package/dist/color/finishInks.d.ts +42 -0
- package/dist/color/finishInks.d.ts.map +1 -0
- package/dist/color/finishInks.js +71 -0
- package/dist/color/finishInks.js.map +1 -0
- package/dist/color/finishKinds.d.ts +28 -0
- package/dist/color/finishKinds.d.ts.map +1 -0
- package/dist/color/finishKinds.js +64 -0
- package/dist/color/finishKinds.js.map +1 -0
- package/dist/color/finishes.d.ts +22 -0
- package/dist/color/finishes.d.ts.map +1 -0
- package/dist/color/finishes.js +136 -0
- package/dist/color/finishes.js.map +1 -0
- package/dist/color/index.d.ts +2 -0
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.js +2 -0
- package/dist/color/index.js.map +1 -1
- package/dist/color/inks.d.ts +11 -8
- package/dist/color/inks.d.ts.map +1 -1
- package/dist/color/inks.js +13 -5
- package/dist/color/inks.js.map +1 -1
- package/dist/color/plates.d.ts +5 -5
- package/dist/color/plates.d.ts.map +1 -1
- package/dist/color/plates.js.map +1 -1
- package/dist/composed/pageMemo.d.ts +1 -1
- package/dist/composed/pageMemo.d.ts.map +1 -1
- package/dist/composed/pageMemo.js +4 -1
- package/dist/composed/pageMemo.js.map +1 -1
- package/dist/defaults/bookKeys.d.ts +1 -1
- package/dist/defaults/bookKeys.d.ts.map +1 -1
- package/dist/defaults/bookKeys.js +1 -1
- package/dist/defaults/bookKeys.js.map +1 -1
- package/dist/defaults/dieCuts.d.ts +10 -0
- package/dist/defaults/dieCuts.d.ts.map +1 -0
- package/dist/defaults/dieCuts.js +73 -0
- package/dist/defaults/dieCuts.js.map +1 -0
- package/dist/defaults/index.d.ts +2 -1
- package/dist/defaults/index.d.ts.map +1 -1
- package/dist/defaults/index.js +10 -1
- package/dist/defaults/index.js.map +1 -1
- package/dist/defaults/output/print.d.ts +5 -1
- package/dist/defaults/output/print.d.ts.map +1 -1
- package/dist/defaults/output/print.js +29 -0
- package/dist/defaults/output/print.js.map +1 -1
- package/dist/defaults/structure/headerFooter/resolve.d.ts.map +1 -1
- package/dist/defaults/structure/headerFooter/resolve.js +29 -0
- package/dist/defaults/structure/headerFooter/resolve.js.map +1 -1
- package/dist/design/elementKeys.d.ts +17 -0
- package/dist/design/elementKeys.d.ts.map +1 -1
- package/dist/design/elementKeys.js +5 -2
- package/dist/design/elementKeys.js.map +1 -1
- package/dist/design/layout/elements.d.ts.map +1 -1
- package/dist/design/layout/elements.js +6 -0
- package/dist/design/layout/elements.js.map +1 -1
- package/dist/design/layout/primitives.d.ts +3 -1
- package/dist/design/layout/primitives.d.ts.map +1 -1
- package/dist/design/layout/primitives.js.map +1 -1
- package/dist/designs/parts.d.ts +1 -1
- package/dist/designs/parts.js +1 -1
- package/dist/designs/parts.js.map +1 -1
- package/dist/dieCut/dieCut.test.d.ts +2 -0
- package/dist/dieCut/dieCut.test.d.ts.map +1 -0
- package/dist/dieCut/dieCut.test.js +146 -0
- package/dist/dieCut/dieCut.test.js.map +1 -0
- package/dist/dieCut/geometry.d.ts +50 -0
- package/dist/dieCut/geometry.d.ts.map +1 -0
- package/dist/dieCut/geometry.js +272 -0
- package/dist/dieCut/geometry.js.map +1 -0
- package/dist/dieCut/index.d.ts +7 -0
- package/dist/dieCut/index.d.ts.map +1 -0
- package/dist/dieCut/index.js +9 -0
- package/dist/dieCut/index.js.map +1 -0
- package/dist/dieCut/leaves.d.ts +16 -0
- package/dist/dieCut/leaves.d.ts.map +1 -0
- package/dist/dieCut/leaves.js +31 -0
- package/dist/dieCut/leaves.js.map +1 -0
- package/dist/dieCut/path2d.d.ts +16 -0
- package/dist/dieCut/path2d.d.ts.map +1 -0
- package/dist/dieCut/path2d.js +37 -0
- package/dist/dieCut/path2d.js.map +1 -0
- package/dist/dieCut/place.d.ts +59 -0
- package/dist/dieCut/place.d.ts.map +1 -0
- package/dist/dieCut/place.js +131 -0
- package/dist/dieCut/place.js.map +1 -0
- package/dist/dieCut/seeThrough.d.ts +19 -0
- package/dist/dieCut/seeThrough.d.ts.map +1 -0
- package/dist/dieCut/seeThrough.js +54 -0
- package/dist/dieCut/seeThrough.js.map +1 -0
- package/dist/dieCut/shapes.d.ts +42 -0
- package/dist/dieCut/shapes.d.ts.map +1 -0
- package/dist/dieCut/shapes.js +102 -0
- package/dist/dieCut/shapes.js.map +1 -0
- package/dist/html-backend/dieCut.d.ts +13 -0
- package/dist/html-backend/dieCut.d.ts.map +1 -0
- package/dist/html-backend/dieCut.js +55 -0
- package/dist/html-backend/dieCut.js.map +1 -0
- package/dist/html-backend/html-backend.d.ts +1 -0
- package/dist/html-backend/html-backend.d.ts.map +1 -1
- package/dist/html-backend/html-backend.js +1 -0
- package/dist/html-backend/html-backend.js.map +1 -1
- package/dist/html-backend/page.d.ts +5 -1
- package/dist/html-backend/page.d.ts.map +1 -1
- package/dist/html-backend/page.js +11 -4
- package/dist/html-backend/page.js.map +1 -1
- package/dist/html-backend/render.d.ts.map +1 -1
- package/dist/html-backend/render.js +32 -5
- package/dist/html-backend/render.js.map +1 -1
- package/dist/html-backend/through.d.ts +27 -0
- package/dist/html-backend/through.d.ts.map +1 -0
- package/dist/html-backend/through.js +83 -0
- package/dist/html-backend/through.js.map +1 -0
- package/dist/html-backend/through.test.d.ts +2 -0
- package/dist/html-backend/through.test.d.ts.map +1 -0
- package/dist/html-backend/through.test.js +116 -0
- package/dist/html-backend/through.test.js.map +1 -0
- package/dist/html-backend/varnish.d.ts +17 -0
- package/dist/html-backend/varnish.d.ts.map +1 -0
- package/dist/html-backend/varnish.js +68 -0
- package/dist/html-backend/varnish.js.map +1 -0
- package/dist/index.d.ts +7 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/migrate/markdownRuns.js +1 -1
- package/dist/migrate/markdownRuns.js.map +1 -1
- package/dist/paint/displayList/inline.d.ts.map +1 -1
- package/dist/paint/displayList/inline.js +4 -2
- package/dist/paint/displayList/inline.js.map +1 -1
- package/dist/paint/displayList/lines.d.ts.map +1 -1
- package/dist/paint/displayList/lines.js +2 -0
- package/dist/paint/displayList/lines.js.map +1 -1
- package/dist/paint/displayList/types.d.ts +8 -0
- package/dist/paint/displayList/types.d.ts.map +1 -1
- package/dist/parse/blockParser.d.ts.map +1 -1
- package/dist/parse/blockParser.js +1 -1
- package/dist/parse/blockParser.js.map +1 -1
- package/dist/parse/types/contentBlock.d.ts +3 -0
- package/dist/parse/types/contentBlock.d.ts.map +1 -1
- package/dist/pipeline/build/pass/blocks/blockDispatch.d.ts.map +1 -1
- package/dist/pipeline/build/pass/blocks/blockDispatch.js +3 -2
- package/dist/pipeline/build/pass/blocks/blockDispatch.js.map +1 -1
- package/dist/pipeline/build/pass/setup/passFinish.d.ts.map +1 -1
- package/dist/pipeline/build/pass/setup/passFinish.js +4 -0
- package/dist/pipeline/build/pass/setup/passFinish.js.map +1 -1
- package/dist/pipeline/build/pass.d.ts.map +1 -1
- package/dist/pipeline/build/pass.js +9 -0
- package/dist/pipeline/build/pass.js.map +1 -1
- package/dist/pipeline/config.d.ts.map +1 -1
- package/dist/pipeline/config.js +12 -1
- package/dist/pipeline/config.js.map +1 -1
- package/dist/pipeline/contentWarnings/formatWarning.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings/formatWarning.js +5 -0
- package/dist/pipeline/contentWarnings/formatWarning.js.map +1 -1
- package/dist/pipeline/contentWarnings/sourceWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings/sourceWarnings.js +10 -0
- package/dist/pipeline/contentWarnings/sourceWarnings.js.map +1 -1
- package/dist/pipeline/floats/dieWrap.d.ts +24 -0
- package/dist/pipeline/floats/dieWrap.d.ts.map +1 -0
- package/dist/pipeline/floats/dieWrap.js +102 -0
- package/dist/pipeline/floats/dieWrap.js.map +1 -0
- package/dist/pipeline/floats/textWrap.d.ts +10 -2
- package/dist/pipeline/floats/textWrap.d.ts.map +1 -1
- package/dist/pipeline/floats/textWrap.js +34 -3
- package/dist/pipeline/floats/textWrap.js.map +1 -1
- package/dist/pipeline/pages/dieCuts.d.ts +30 -0
- package/dist/pipeline/pages/dieCuts.d.ts.map +1 -0
- package/dist/pipeline/pages/dieCuts.js +140 -0
- package/dist/pipeline/pages/dieCuts.js.map +1 -0
- package/dist/pipeline/pages/headerFooter/primitives.js +2 -0
- package/dist/pipeline/pages/headerFooter/primitives.js.map +1 -1
- package/dist/svg/spotPaints.d.ts +18 -0
- package/dist/svg/spotPaints.d.ts.map +1 -1
- package/dist/svg/spotPaints.js +11 -6
- package/dist/svg/spotPaints.js.map +1 -1
- package/dist/types/config.d.ts +5 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/designCut.d.ts +48 -0
- package/dist/types/designCut.d.ts.map +1 -0
- package/dist/types/designCut.js +2 -0
- package/dist/types/designCut.js.map +1 -0
- package/dist/types/designElements.d.ts +7 -1
- package/dist/types/designElements.d.ts.map +1 -1
- package/dist/types/dieCuts.d.ts +88 -0
- package/dist/types/dieCuts.d.ts.map +1 -0
- package/dist/types/dieCuts.js +2 -0
- package/dist/types/dieCuts.js.map +1 -0
- package/dist/types/output/print.d.ts +29 -1
- package/dist/types/output/print.d.ts.map +1 -1
- package/dist/types/page.d.ts +26 -1
- package/dist/types/page.d.ts.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/vdt/contentWarnings/markup.d.ts +8 -0
- package/dist/vdt/contentWarnings/markup.d.ts.map +1 -1
- package/dist/vdt/design.d.ts +13 -1
- package/dist/vdt/design.d.ts.map +1 -1
- package/dist/vdt/design.js.map +1 -1
- package/dist/vdt/document.d.ts +5 -1
- package/dist/vdt/document.d.ts.map +1 -1
- package/dist/vdt/document.js.map +1 -1
- package/dist/vdt/pages.d.ts +20 -1
- package/dist/vdt/pages.d.ts.map +1 -1
- package/dist/vdt.d.ts +1 -1
- package/dist/vdt.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { VDTPathCommand } from '../vdt.js';
|
|
2
|
+
/** The calls a canvas path takes (a context, a `Path2D`). */
|
|
3
|
+
export interface PathSink {
|
|
4
|
+
moveTo(x: number, y: number): void;
|
|
5
|
+
lineTo(x: number, y: number): void;
|
|
6
|
+
bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): void;
|
|
7
|
+
quadraticCurveTo(x1: number, y1: number, x: number, y: number): void;
|
|
8
|
+
closePath(): void;
|
|
9
|
+
}
|
|
10
|
+
/** Traces `paths` on `sink`, each subpath after the last (no
|
|
11
|
+
* `beginPath`). */
|
|
12
|
+
export declare function traceDiePaths(sink: PathSink, paths: readonly (readonly VDTPathCommand[])[]): void;
|
|
13
|
+
/** A `Path2D` of `paths` (a page's `dieCut.holes`, or its `outline`);
|
|
14
|
+
* `undefined` where there is no `Path2D` (Node, a worker without one). */
|
|
15
|
+
export declare function dieCutPath2D(paths: readonly (readonly VDTPathCommand[])[]): Path2D | undefined;
|
|
16
|
+
//# sourceMappingURL=path2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path2d.d.ts","sourceRoot":"","sources":["../../src/dieCut/path2d.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,6DAA6D;AAC7D,MAAM,WAAW,QAAQ;IACvB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1F,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrE,SAAS,IAAI,IAAI,CAAC;CACnB;AAED;oBACoB;AACpB,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,GAAG,IAAI,CAsBjG;AAED;2EAC2E;AAC3E,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,GAAG,MAAM,GAAG,SAAS,CAK9F"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Die-cut outlines as canvas paths (#1565): traced on any context or
|
|
2
|
+
// `Path2D`, and a `Path2D` of them where the browser has one.
|
|
3
|
+
/** Traces `paths` on `sink`, each subpath after the last (no
|
|
4
|
+
* `beginPath`). */
|
|
5
|
+
export function traceDiePaths(sink, paths) {
|
|
6
|
+
for (const path of paths) {
|
|
7
|
+
for (const c of path) {
|
|
8
|
+
switch (c.op) {
|
|
9
|
+
case 'M':
|
|
10
|
+
sink.moveTo(c.x, c.y);
|
|
11
|
+
break;
|
|
12
|
+
case 'L':
|
|
13
|
+
sink.lineTo(c.x, c.y);
|
|
14
|
+
break;
|
|
15
|
+
case 'C':
|
|
16
|
+
sink.bezierCurveTo(c.x1, c.y1, c.x2, c.y2, c.x, c.y);
|
|
17
|
+
break;
|
|
18
|
+
case 'Q':
|
|
19
|
+
sink.quadraticCurveTo(c.x1, c.y1, c.x, c.y);
|
|
20
|
+
break;
|
|
21
|
+
case 'Z':
|
|
22
|
+
sink.closePath();
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** A `Path2D` of `paths` (a page's `dieCut.holes`, or its `outline`);
|
|
29
|
+
* `undefined` where there is no `Path2D` (Node, a worker without one). */
|
|
30
|
+
export function dieCutPath2D(paths) {
|
|
31
|
+
if (typeof Path2D === 'undefined')
|
|
32
|
+
return undefined;
|
|
33
|
+
const p = new Path2D();
|
|
34
|
+
traceDiePaths(p, paths);
|
|
35
|
+
return p;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=path2d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path2d.js","sourceRoot":"","sources":["../../src/dieCut/path2d.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,8DAA8D;AAa9D;oBACoB;AACpB,MAAM,UAAU,aAAa,CAAC,IAAc,EAAE,KAA6C;IACzF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACrB,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;gBACb,KAAK,GAAG;oBACN,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;oBACtB,MAAM;gBACR,KAAK,GAAG;oBACN,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;oBACtB,MAAM;gBACR,KAAK,GAAG;oBACN,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;oBACrD,MAAM;gBACR,KAAK,GAAG;oBACN,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC5C,MAAM;gBACR,KAAK,GAAG;oBACN,IAAI,CAAC,SAAS,EAAE,CAAC;oBACjB,MAAM;YACV,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;2EAC2E;AAC3E,MAAM,UAAU,YAAY,CAAC,KAA6C;IACxE,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,SAAS,CAAC;IACpD,MAAM,CAAC,GAAG,IAAI,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACxB,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ResolvedDieCutsConfig, ResolvedDieShape } from '../types.js';
|
|
2
|
+
import type { VDTDieCut, VDTPathCommand } from '../vdt.js';
|
|
3
|
+
import { type DieCutMetrics } from './shapes.js';
|
|
4
|
+
/** One die put on one page: its outline there (page px), how many leaves it
|
|
5
|
+
* goes through from that page's, and the gap text keeps from it. */
|
|
6
|
+
export interface DiePlacement {
|
|
7
|
+
/** Document page index (0-based) the die is placed on. */
|
|
8
|
+
pageIndex: number;
|
|
9
|
+
/** The die's id (a shape's, or a cut element's). */
|
|
10
|
+
id: string;
|
|
11
|
+
path: VDTPathCommand[];
|
|
12
|
+
leaves: number;
|
|
13
|
+
wrapGapPx: number;
|
|
14
|
+
}
|
|
15
|
+
/** The page numbers of a spec (`'5'`, `'3-12'`, `'3,7,11-13'`), 1-based,
|
|
16
|
+
* in the order written; parts that are not numbers or ranges are left
|
|
17
|
+
* out. */
|
|
18
|
+
export declare function parsePageList(spec: string): number[];
|
|
19
|
+
/** A die shape placed on document page `pageIndex`. */
|
|
20
|
+
export declare function shapePlacement(shape: ResolvedDieShape, pageIndex: number, metrics: DieCutMetrics): DiePlacement;
|
|
21
|
+
/** The placements `dieCuts.pages` asks for on a document of `pageCount`
|
|
22
|
+
* pages that starts `offset` pages into its book (page numbers count the
|
|
23
|
+
* book's pages), and the die ids it names that no shape has. */
|
|
24
|
+
export declare function configPlacements(config: ResolvedDieCutsConfig, metrics: DieCutMetrics, pageCount: number, offset?: number): {
|
|
25
|
+
placements: DiePlacement[];
|
|
26
|
+
unknown: string[];
|
|
27
|
+
};
|
|
28
|
+
/** The holes each page of the range carries from `placements`, mirrored
|
|
29
|
+
* for its side: one list per page, `[]` for a page nothing cuts. A hole
|
|
30
|
+
* that lands twice on a page (the same die, the same box) is kept once. */
|
|
31
|
+
export declare function holesByPage(placements: readonly DiePlacement[], pageCount: number, metrics: DieCutMetrics, offset?: number): {
|
|
32
|
+
path: VDTPathCommand[];
|
|
33
|
+
id: string;
|
|
34
|
+
wrapGapPx: number;
|
|
35
|
+
}[][];
|
|
36
|
+
/** The holes page `pageIndex` carries from `placements` (see
|
|
37
|
+
* {@link holesByPage}), worked out for that page alone: what the flow
|
|
38
|
+
* asks of a page as it opens, before the document's length is known. */
|
|
39
|
+
export declare function holesOnPage(placements: readonly DiePlacement[], pageIndex: number, metrics: DieCutMetrics, offset?: number): {
|
|
40
|
+
path: VDTPathCommand[];
|
|
41
|
+
id: string;
|
|
42
|
+
wrapGapPx: number;
|
|
43
|
+
}[];
|
|
44
|
+
/** What `buildDieCuts` lays out. */
|
|
45
|
+
export interface DieCutsInput {
|
|
46
|
+
config: ResolvedDieCutsConfig;
|
|
47
|
+
metrics: DieCutMetrics;
|
|
48
|
+
pageCount: number;
|
|
49
|
+
/** Physical pages before page 0 (`pageIndexOffset`). */
|
|
50
|
+
offset?: number;
|
|
51
|
+
binding?: 'left' | 'right';
|
|
52
|
+
/** Every die put on a page: `dieCuts.pages`, `:::diecut` runs, cut
|
|
53
|
+
* elements. */
|
|
54
|
+
placements: readonly DiePlacement[];
|
|
55
|
+
}
|
|
56
|
+
/** Each page's die-cut (see {@link VDTDieCut}), `undefined` for a page no
|
|
57
|
+
* die cuts and whose leaf keeps the plain trim. */
|
|
58
|
+
export declare function buildDieCuts(input: DieCutsInput): (VDTDieCut | undefined)[];
|
|
59
|
+
//# sourceMappingURL=place.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place.d.ts","sourceRoot":"","sources":["../../src/dieCut/place.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3D,OAAO,EAAE,KAAK,aAAa,EAA2C,MAAM,aAAa,CAAC;AAE1F;qEACqE;AACrE,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAKD;;WAEW;AACX,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAapD;AAED,uDAAuD;AACvD,wB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AAS,CAAC,EAAE,CAgB3E"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Die-cut placement (#1565): where each die cuts, page by page. A shape
|
|
2
|
+
// placed on a page cuts its whole leaf: the other side carries it
|
|
3
|
+
// mirrored across the sheet (x' = sheet width − x), and `leaves: N` takes
|
|
4
|
+
// it through the next N − 1 leaves too, each side as the one it lies on.
|
|
5
|
+
// Every leaf also gets the book's outline (rounded corners, a shape). Pure.
|
|
6
|
+
import { mirrorPath, pathBounds } from './geometry.js';
|
|
7
|
+
import { isRectoAt, leafAt, pagesOfLeaf } from './leaves.js';
|
|
8
|
+
import { dieShapePath, dieWrapGapPx, leafOutline } from './shapes.js';
|
|
9
|
+
/** The longest list a page spec expands to: a range runs no further. */
|
|
10
|
+
const MAX_PAGES = 100000;
|
|
11
|
+
/** The page numbers of a spec (`'5'`, `'3-12'`, `'3,7,11-13'`), 1-based,
|
|
12
|
+
* in the order written; parts that are not numbers or ranges are left
|
|
13
|
+
* out. */
|
|
14
|
+
export function parsePageList(spec) {
|
|
15
|
+
const out = [];
|
|
16
|
+
for (const part of spec.split(',')) {
|
|
17
|
+
const p = part.trim();
|
|
18
|
+
const m = /^(\d+)\s*(?:-\s*(\d+))?$/.exec(p);
|
|
19
|
+
if (!m)
|
|
20
|
+
continue;
|
|
21
|
+
const a = Number(m[1]);
|
|
22
|
+
const b = m[2] !== undefined ? Number(m[2]) : a;
|
|
23
|
+
const lo = Math.min(a, b);
|
|
24
|
+
const hi = Math.min(Math.max(a, b), lo + MAX_PAGES);
|
|
25
|
+
for (let n = lo; n <= hi; n++)
|
|
26
|
+
if (n >= 1)
|
|
27
|
+
out.push(n);
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
/** A die shape placed on document page `pageIndex`. */
|
|
32
|
+
export function shapePlacement(shape, pageIndex, metrics) {
|
|
33
|
+
return { pageIndex, id: shape.id, path: dieShapePath(shape, metrics), leaves: shape.leaves, wrapGapPx: dieWrapGapPx(shape, metrics) };
|
|
34
|
+
}
|
|
35
|
+
/** The placements `dieCuts.pages` asks for on a document of `pageCount`
|
|
36
|
+
* pages that starts `offset` pages into its book (page numbers count the
|
|
37
|
+
* book's pages), and the die ids it names that no shape has. */
|
|
38
|
+
export function configPlacements(config, metrics, pageCount, offset = 0) {
|
|
39
|
+
const placements = [];
|
|
40
|
+
const unknown = [];
|
|
41
|
+
for (const entry of config.pages) {
|
|
42
|
+
const shape = config.shapes.find((s) => s.id === entry.die);
|
|
43
|
+
if (!shape) {
|
|
44
|
+
if (!unknown.includes(entry.die))
|
|
45
|
+
unknown.push(entry.die);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
for (const n of parsePageList(entry.pages)) {
|
|
49
|
+
const i = n - 1 - offset;
|
|
50
|
+
// A die may be placed on a page of an earlier chapter whose leaf
|
|
51
|
+
// reaches into this one: kept while its leaves can.
|
|
52
|
+
if (i >= pageCount)
|
|
53
|
+
continue;
|
|
54
|
+
if (i < 0 && leafAt(i, offset) + shape.leaves - 1 < leafAt(0, offset))
|
|
55
|
+
continue;
|
|
56
|
+
placements.push(shapePlacement(shape, i, metrics));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return { placements, unknown };
|
|
60
|
+
}
|
|
61
|
+
/** The holes each page of the range carries from `placements`, mirrored
|
|
62
|
+
* for its side: one list per page, `[]` for a page nothing cuts. A hole
|
|
63
|
+
* that lands twice on a page (the same die, the same box) is kept once. */
|
|
64
|
+
export function holesByPage(placements, pageCount, metrics, offset = 0) {
|
|
65
|
+
const out = Array.from({ length: pageCount }, () => []);
|
|
66
|
+
const seen = Array.from({ length: pageCount }, () => new Set());
|
|
67
|
+
for (const p of placements) {
|
|
68
|
+
const first = leafAt(p.pageIndex, offset);
|
|
69
|
+
const recto = isRectoAt(p.pageIndex, offset);
|
|
70
|
+
let mirrored;
|
|
71
|
+
for (let leaf = first; leaf < first + Math.max(1, p.leaves); leaf++) {
|
|
72
|
+
for (const j of pagesOfLeaf(leaf, offset)) {
|
|
73
|
+
if (j < 0 || j >= pageCount)
|
|
74
|
+
continue;
|
|
75
|
+
const same = isRectoAt(j, offset) === recto;
|
|
76
|
+
const path = same ? p.path : (mirrored ??= mirrorPath(p.path, metrics.width));
|
|
77
|
+
const b = pathBounds(path);
|
|
78
|
+
const key = b ? `${p.id}|${Math.round(b.x)}|${Math.round(b.y)}|${Math.round(b.width)}|${Math.round(b.height)}` : p.id;
|
|
79
|
+
if (seen[j].has(key))
|
|
80
|
+
continue;
|
|
81
|
+
seen[j].add(key);
|
|
82
|
+
out[j].push({ path, id: p.id, wrapGapPx: p.wrapGapPx });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
/** The holes page `pageIndex` carries from `placements` (see
|
|
89
|
+
* {@link holesByPage}), worked out for that page alone: what the flow
|
|
90
|
+
* asks of a page as it opens, before the document's length is known. */
|
|
91
|
+
export function holesOnPage(placements, pageIndex, metrics, offset = 0) {
|
|
92
|
+
const leaf = leafAt(pageIndex, offset);
|
|
93
|
+
const recto = isRectoAt(pageIndex, offset);
|
|
94
|
+
const out = [];
|
|
95
|
+
const seen = new Set();
|
|
96
|
+
for (const p of placements) {
|
|
97
|
+
const first = leafAt(p.pageIndex, offset);
|
|
98
|
+
if (leaf < first || leaf >= first + Math.max(1, p.leaves))
|
|
99
|
+
continue;
|
|
100
|
+
const path = isRectoAt(p.pageIndex, offset) === recto ? p.path : mirrorPath(p.path, metrics.width);
|
|
101
|
+
const b = pathBounds(path);
|
|
102
|
+
const key = b ? `${p.id}|${Math.round(b.x)}|${Math.round(b.y)}|${Math.round(b.width)}|${Math.round(b.height)}` : p.id;
|
|
103
|
+
if (seen.has(key))
|
|
104
|
+
continue;
|
|
105
|
+
seen.add(key);
|
|
106
|
+
out.push({ path, id: p.id, wrapGapPx: p.wrapGapPx });
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
/** Each page's die-cut (see {@link VDTDieCut}), `undefined` for a page no
|
|
111
|
+
* die cuts and whose leaf keeps the plain trim. */
|
|
112
|
+
export function buildDieCuts(input) {
|
|
113
|
+
const offset = input.offset ?? 0;
|
|
114
|
+
const holes = holesByPage(input.placements, input.pageCount, input.metrics, offset);
|
|
115
|
+
const recto = leafOutline(input.config, input.metrics, 'recto', input.binding);
|
|
116
|
+
const verso = recto ? leafOutline(input.config, input.metrics, 'verso', input.binding) : undefined;
|
|
117
|
+
return holes.map((list, i) => {
|
|
118
|
+
const outline = isRectoAt(i, offset) ? recto : verso;
|
|
119
|
+
if (list.length === 0 && !outline)
|
|
120
|
+
return undefined;
|
|
121
|
+
const cut = {
|
|
122
|
+
holes: list.map((h) => h.path),
|
|
123
|
+
sources: list.map((h) => h.id),
|
|
124
|
+
wrapGapPx: list.map((h) => h.wrapGapPx),
|
|
125
|
+
};
|
|
126
|
+
if (outline)
|
|
127
|
+
cut.outline = outline;
|
|
128
|
+
return cut;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=place.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place.js","sourceRoot":"","sources":["../../src/dieCut/place.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,kEAAkE;AAClE,0EAA0E;AAC1E,yEAAyE;AACzE,4EAA4E;AAI5E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAsB,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAc1F,wEAAwE;AACxE,MAAM,SAAS,GAAG,MAAM,CAAC;AAEzB;;WAEW;AACX,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,I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KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnG,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QACrD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QACpD,MAAM,GAAG,GAAc;YACrB,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAC9B,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9B,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SACxC,CAAC;QACF,IAAI,OAAO;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACnC,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { VDTDocument, VDTPathCommand } from '../vdt.js';
|
|
2
|
+
/** One page seen through the holes above it: `pageIndex` (−1: past the
|
|
3
|
+
* book's end, the board or the background) and the holes of each page
|
|
4
|
+
* above it, nearest first. The layer shows where every one of those
|
|
5
|
+
* lists has a hole (each list is a union, the lists intersect). */
|
|
6
|
+
export interface SeeThroughLayer {
|
|
7
|
+
pageIndex: number;
|
|
8
|
+
clips: VDTPathCommand[][][];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The layers seen through page `i`'s holes, nearest first (see
|
|
12
|
+
* {@link SeeThroughLayer}): the page beneath (`pageBeneath`), then the one
|
|
13
|
+
* beneath it while its own holes meet what shows of it, and so on. The walk
|
|
14
|
+
* stops on a page whose holes miss the opening above, after `maxDepth`
|
|
15
|
+
* layers, or at the book's end, whose layer is `{ pageIndex: -1 }`. Empty
|
|
16
|
+
* for a page without holes.
|
|
17
|
+
*/
|
|
18
|
+
export declare function seeThrough(doc: Pick<VDTDocument, 'pages' | 'pageIndexOffset'>, i: number, maxDepth?: number): SeeThroughLayer[];
|
|
19
|
+
//# sourceMappingURL=seeThrough.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seeThrough.d.ts","sourceRoot":"","sources":["../../src/dieCut/seeThrough.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAe,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAI1E;;;oEAGoE;AACpE,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;CAC7B;AAiBD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,iBAAiB,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,SAAW,GAAG,eAAe,EAAE,CAkBjI"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// What a reader sees through the holes of a page (#1565, #1567): the page
|
|
2
|
+
// beneath, and the pages under that wherever the holes line up. Each layer
|
|
3
|
+
// shows through the holes of every page above it at once, so its clips
|
|
4
|
+
// intersect. Bounding boxes decide where the walk stops: no rasterising,
|
|
5
|
+
// so a tunnel twenty leaves deep costs twenty box tests. Pure.
|
|
6
|
+
import { intersectBoxes, pathBounds, unionBoxes } from './geometry.js';
|
|
7
|
+
import { pageBeneath } from './leaves.js';
|
|
8
|
+
/** The holes of `holes` whose boxes meet `region`, and the box of all of
|
|
9
|
+
* them within it. */
|
|
10
|
+
function holesIn(holes, region) {
|
|
11
|
+
const kept = [];
|
|
12
|
+
let box;
|
|
13
|
+
for (const h of holes) {
|
|
14
|
+
const b = pathBounds(h);
|
|
15
|
+
const meet = b ? intersectBoxes(b, region) : undefined;
|
|
16
|
+
if (!meet)
|
|
17
|
+
continue;
|
|
18
|
+
kept.push(h);
|
|
19
|
+
box = unionBoxes(box, meet);
|
|
20
|
+
}
|
|
21
|
+
return { kept, box };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The layers seen through page `i`'s holes, nearest first (see
|
|
25
|
+
* {@link SeeThroughLayer}): the page beneath (`pageBeneath`), then the one
|
|
26
|
+
* beneath it while its own holes meet what shows of it, and so on. The walk
|
|
27
|
+
* stops on a page whose holes miss the opening above, after `maxDepth`
|
|
28
|
+
* layers, or at the book's end, whose layer is `{ pageIndex: -1 }`. Empty
|
|
29
|
+
* for a page without holes.
|
|
30
|
+
*/
|
|
31
|
+
export function seeThrough(doc, i, maxDepth = Infinity) {
|
|
32
|
+
const own = doc.pages[i]?.dieCut?.holes ?? [];
|
|
33
|
+
let region = pathBounds(own);
|
|
34
|
+
if (!region || own.length === 0)
|
|
35
|
+
return [];
|
|
36
|
+
const clips = [own];
|
|
37
|
+
const layers = [];
|
|
38
|
+
let j = pageBeneath(doc, i);
|
|
39
|
+
while (layers.length < maxDepth) {
|
|
40
|
+
layers.push({ pageIndex: j, clips: clips.slice() });
|
|
41
|
+
if (j < 0)
|
|
42
|
+
break;
|
|
43
|
+
const { kept, box } = holesIn(doc.pages[j]?.dieCut?.holes ?? [], region);
|
|
44
|
+
if (kept.length === 0 || !box)
|
|
45
|
+
break;
|
|
46
|
+
region = intersectBoxes(region, box);
|
|
47
|
+
if (!region)
|
|
48
|
+
break;
|
|
49
|
+
clips.push(kept);
|
|
50
|
+
j = pageBeneath(doc, j);
|
|
51
|
+
}
|
|
52
|
+
return layers;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=seeThrough.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seeThrough.js","sourceR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I,CAAC,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC;YAAE,MAAM;QACjB,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;QACzE,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG;YAAE,MAAM;QACrC,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM;YAAE,MAAM;QACnB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ResolvedDieCutsConfig, ResolvedDieShape } from '../types.js';
|
|
2
|
+
import type { BoundingBox, VDTDocument, VDTPathCommand } from '../vdt.js';
|
|
3
|
+
/** What a die shape needs of the page to be laid on it: the resolution,
|
|
4
|
+
* where the trim starts (the bleed and slug before it) and the sheet's
|
|
5
|
+
* size, in px. */
|
|
6
|
+
export interface DieCutMetrics {
|
|
7
|
+
dpi: number;
|
|
8
|
+
/** Px from the sheet's edge to the trim's (0 without cut lines). */
|
|
9
|
+
trimOffset: number;
|
|
10
|
+
/** The sheet (page px, bleed included). */
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
/** What `em` lengths are measured against (px). Default 16. */
|
|
14
|
+
fontSizePx?: number;
|
|
15
|
+
}
|
|
16
|
+
/** The metrics of `doc`'s pages: every page of a document shares one
|
|
17
|
+
* sheet. */
|
|
18
|
+
export declare function dieMetricsOf(doc: Pick<VDTDocument, 'config' | 'trimOffset' | 'pages'>): DieCutMetrics;
|
|
19
|
+
/** A shape's outline inside `box` (page px): a rectangle, a rounded one
|
|
20
|
+
* (`radius`), a circle (the largest one the box holds, centred), an
|
|
21
|
+
* ellipse, or path data stretched from its `viewBox` to the box. Path
|
|
22
|
+
* data that cannot be read gives the box itself, so a hole never goes
|
|
23
|
+
* missing without a trace. */
|
|
24
|
+
export declare function dieShapeInBox(shape: Pick<ResolvedDieShape, 'shape' | 'radius' | 'd' | 'viewBox'>, box: BoundingBox, metrics: DieCutMetrics): VDTPathCommand[];
|
|
25
|
+
/** A die shape's box on the page it is placed on (page px): measured from
|
|
26
|
+
* the trim's top-left corner. */
|
|
27
|
+
export declare function dieShapeBox(shape: ResolvedDieShape, metrics: DieCutMetrics): BoundingBox;
|
|
28
|
+
/** A die shape's outline on the page it is placed on, in page px, or on
|
|
29
|
+
* the other side of its leaf when `mirrored` (`x' = sheet width − x`). */
|
|
30
|
+
export declare function dieShapePath(shape: ResolvedDieShape, metrics: DieCutMetrics, mirrored?: boolean): VDTPathCommand[];
|
|
31
|
+
/** The gap text keeps from a shape's hole (px); 0 when it does not wrap. */
|
|
32
|
+
export declare function dieWrapGapPx(shape: Pick<ResolvedDieShape, 'wrap'>, metrics: DieCutMetrics): number;
|
|
33
|
+
/**
|
|
34
|
+
* The outline every leaf is cut to, on a page of side `side`: the config's
|
|
35
|
+
* `outline` stretched to the trim (a recto's; a verso's mirrored), else
|
|
36
|
+
* the trim with its `corners` rounded (the fore-edge ones: right on a
|
|
37
|
+
* recto and left on a verso of a left-bound book, the other way round in a
|
|
38
|
+
* right-bound one; or all four). `undefined` when the leaf is the plain
|
|
39
|
+
* trim rectangle. An outline wins over corners.
|
|
40
|
+
*/
|
|
41
|
+
export declare function leafOutline(config: Pick<ResolvedDieCutsConfig, 'outline' | 'corners'>, metrics: DieCutMetrics, side: 'recto' | 'verso', binding?: 'left' | 'right'): VDTPathCommand[][] | undefined;
|
|
42
|
+
//# sourceMappingURL=shapes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapes.d.ts","sourceRoot":"","sources":["../../src/dieCut/shapes.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAa,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAK1E;;mBAEmB;AACnB,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;aACa;AACb,wBAAgB,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC,GAAG,aAAa,CASrG;AAID;;;;+BAI+B;AAC/B,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,QAAQ,GAAG,GAAG,GAAG,SAAS,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,cAAc,EAAE,CAsB7J;AAED;kCACkC;AAClC,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,GAAG,WAAW,CAOxF;AAED;2EAC2E;AAC3E,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,UAAQ,GAAG,cAAc,EAAE,CAGhH;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAElG;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,GAAG,SAAS,CAAC,EAC1D,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,OAAO,GAAG,OAAO,EACvB,OAAO,GAAE,MAAM,GAAG,OAAgB,GACjC,cAAc,EAAE,EAAE,GAAG,SAAS,CAoBhC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Die shapes as outlines in page px (#1565): a die shape of the config at
|
|
2
|
+
// its place on the trim, a shape stretched to a box (a composed page's
|
|
3
|
+
// `kind: 'cut'` element), and the outline of a whole leaf (rounded corners,
|
|
4
|
+
// a shaped book). Pure.
|
|
5
|
+
import { dimensionToPx } from '../units.js';
|
|
6
|
+
import { mapPath, parseSvgPathCached } from '../design/svgPath.js';
|
|
7
|
+
import { ellipsePath, mirrorPath, rectPath, roundRectPath } from './geometry.js';
|
|
8
|
+
/** The metrics of `doc`'s pages: every page of a document shares one
|
|
9
|
+
* sheet. */
|
|
10
|
+
export function dieMetricsOf(doc) {
|
|
11
|
+
const first = doc.pages[0];
|
|
12
|
+
const dpi = doc.config.page.dpi;
|
|
13
|
+
return {
|
|
14
|
+
dpi,
|
|
15
|
+
trimOffset: doc.trimOffset,
|
|
16
|
+
width: first?.width ?? dimensionToPx(doc.config.page.width, dpi) + 2 * doc.trimOffset,
|
|
17
|
+
height: first?.height ?? dimensionToPx(doc.config.page.height, dpi) + 2 * doc.trimOffset,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const px = (d, m) => dimensionToPx(d, m.dpi, m.fontSizePx ?? 16);
|
|
21
|
+
/** A shape's outline inside `box` (page px): a rectangle, a rounded one
|
|
22
|
+
* (`radius`), a circle (the largest one the box holds, centred), an
|
|
23
|
+
* ellipse, or path data stretched from its `viewBox` to the box. Path
|
|
24
|
+
* data that cannot be read gives the box itself, so a hole never goes
|
|
25
|
+
* missing without a trace. */
|
|
26
|
+
export function dieShapeInBox(shape, box, metrics) {
|
|
27
|
+
const { x, y, width: w, height: h } = box;
|
|
28
|
+
switch (shape.shape) {
|
|
29
|
+
case 'rect':
|
|
30
|
+
return rectPath(x, y, w, h);
|
|
31
|
+
case 'roundRect': {
|
|
32
|
+
const r = px(shape.radius, metrics);
|
|
33
|
+
return roundRectPath(x, y, w, h, [r, r, r, r]);
|
|
34
|
+
}
|
|
35
|
+
case 'circle': {
|
|
36
|
+
const d = Math.min(w, h);
|
|
37
|
+
return ellipsePath(x + (w - d) / 2, y + (h - d) / 2, d, d);
|
|
38
|
+
}
|
|
39
|
+
case 'ellipse':
|
|
40
|
+
return ellipsePath(x, y, w, h);
|
|
41
|
+
case 'path': {
|
|
42
|
+
const parsed = typeof shape.d === 'string' ? parseSvgPathCached(shape.d) : undefined;
|
|
43
|
+
if (!parsed?.ok || parsed.subpaths.length === 0)
|
|
44
|
+
return rectPath(x, y, w, h);
|
|
45
|
+
const [vw, vh] = shape.viewBox;
|
|
46
|
+
return mapPath(parsed.subpaths, x, y, w / vw, h / vh).flat();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** A die shape's box on the page it is placed on (page px): measured from
|
|
51
|
+
* the trim's top-left corner. */
|
|
52
|
+
export function dieShapeBox(shape, metrics) {
|
|
53
|
+
return {
|
|
54
|
+
x: metrics.trimOffset + px(shape.x, metrics),
|
|
55
|
+
y: metrics.trimOffset + px(shape.y, metrics),
|
|
56
|
+
width: Math.max(0, px(shape.width, metrics)),
|
|
57
|
+
height: Math.max(0, px(shape.height, metrics)),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** A die shape's outline on the page it is placed on, in page px, or on
|
|
61
|
+
* the other side of its leaf when `mirrored` (`x' = sheet width − x`). */
|
|
62
|
+
export function dieShapePath(shape, metrics, mirrored = false) {
|
|
63
|
+
const path = dieShapeInBox(shape, dieShapeBox(shape, metrics), metrics);
|
|
64
|
+
return mirrored ? mirrorPath(path, metrics.width) : path;
|
|
65
|
+
}
|
|
66
|
+
/** The gap text keeps from a shape's hole (px); 0 when it does not wrap. */
|
|
67
|
+
export function dieWrapGapPx(shape, metrics) {
|
|
68
|
+
return shape.wrap === false ? 0 : Math.max(0, px(shape.wrap.gap, metrics));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The outline every leaf is cut to, on a page of side `side`: the config's
|
|
72
|
+
* `outline` stretched to the trim (a recto's; a verso's mirrored), else
|
|
73
|
+
* the trim with its `corners` rounded (the fore-edge ones: right on a
|
|
74
|
+
* recto and left on a verso of a left-bound book, the other way round in a
|
|
75
|
+
* right-bound one; or all four). `undefined` when the leaf is the plain
|
|
76
|
+
* trim rectangle. An outline wins over corners.
|
|
77
|
+
*/
|
|
78
|
+
export function leafOutline(config, metrics, side, binding = 'left') {
|
|
79
|
+
const t = metrics.trimOffset;
|
|
80
|
+
const w = metrics.width - 2 * t;
|
|
81
|
+
const h = metrics.height - 2 * t;
|
|
82
|
+
if (config.outline) {
|
|
83
|
+
const parsed = parseSvgPathCached(config.outline.d);
|
|
84
|
+
if (!parsed.ok || parsed.subpaths.length === 0)
|
|
85
|
+
return undefined;
|
|
86
|
+
const [vw, vh] = config.outline.viewBox;
|
|
87
|
+
const recto = mapPath(parsed.subpaths, t, t, w / vw, h / vh);
|
|
88
|
+
return side === 'recto' ? recto : recto.map((p) => mirrorPath(p, metrics.width));
|
|
89
|
+
}
|
|
90
|
+
if (config.corners) {
|
|
91
|
+
const r = px(config.corners.radius, metrics);
|
|
92
|
+
if (!(r > 0))
|
|
93
|
+
return undefined;
|
|
94
|
+
if (config.corners.edges === 'all')
|
|
95
|
+
return [roundRectPath(t, t, w, h, [r, r, r, r])];
|
|
96
|
+
// The fore edge: the side away from the spine.
|
|
97
|
+
const foreRight = (side === 'recto') === (binding === 'left');
|
|
98
|
+
return [roundRectPath(t, t, w, h, foreRight ? [0, r, r, 0] : [r, 0, 0, r])];
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=shapes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapes.js","sourceRoot":"","sources":["../../src/dieCut/shapes.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,uEAAuE;AACvE,4EAA4E;AAC5E,wBAAwB;AAIxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAgBjF;aACa;AACb,MAAM,UAAU,YAAY,CAAC,GAAyD;IACpF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IAChC,OAAO;QACL,GAAG;QACH,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,UAAU;QACrF,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,UAAU;KACzF,CAAC;AACJ,CAAC;AAED,MAAM,EAAE,GAAG,CAAC,CAAY,EAAE,CAAgB,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,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MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,SAAS,CAAC;QAC/B,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK;YAAE,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrF,+CAA+C;QAC/C,MAAM,SAAS,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,KAAK,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC;QAC9D,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { VDTPage, VDTPathCommand } from '../vdt.js';
|
|
2
|
+
/** `paths` as SVG path data in page px. */
|
|
3
|
+
export declare function svgPathData(paths: readonly (readonly VDTPathCommand[])[]): string;
|
|
4
|
+
/**
|
|
5
|
+
* The `clip-path` declaration of a page with a die-cut: what is kept is the
|
|
6
|
+
* leaf's outline (else the bleed box, `bleedInset` inside the sheet, or the
|
|
7
|
+
* whole sheet), less every hole, as one even-odd path. `undefined` for a
|
|
8
|
+
* page nothing cuts. The path data holds only numbers and command letters.
|
|
9
|
+
* `holes: false` keeps the holes (a layer over them draws what shows
|
|
10
|
+
* through): only an outline is then cut, `undefined` without one.
|
|
11
|
+
*/
|
|
12
|
+
export declare function dieCutClipDecl(page: Pick<VDTPage, 'dieCut' | 'width' | 'height'>, bleedInset?: number, holes?: boolean): string | undefined;
|
|
13
|
+
//# sourceMappingURL=dieCut.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dieCut.d.ts","sourceRoot":"","sources":["../../src/html-backend/dieCut.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAOzD,2CAA2C;AAC3C,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,GAAG,MAAM,CAsBjF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC,EAAE,UAAU,SAAI,EAAE,KAAK,UAAO,GAAG,MAAM,GAAG,SAAS,CAUnI"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Die-cuts in the HTML viewer (#1567): a page's holes and its leaf's
|
|
2
|
+
// outline as the page's `clip-path`, merged with the bleed clip. On the
|
|
3
|
+
// print leaf (composed pages) the pages beneath are drawn in the holes by a
|
|
4
|
+
// layer over the page (`through.ts`), and the page is clipped to its
|
|
5
|
+
// outline alone; on the screen relayout, whose pages are not the print
|
|
6
|
+
// pages, a hole shows what is behind the page.
|
|
7
|
+
const n = (v) => {
|
|
8
|
+
const r = Math.round(v * 100) / 100;
|
|
9
|
+
return String(Object.is(r, -0) ? 0 : r);
|
|
10
|
+
};
|
|
11
|
+
/** `paths` as SVG path data in page px. */
|
|
12
|
+
export function svgPathData(paths) {
|
|
13
|
+
const out = [];
|
|
14
|
+
for (const path of paths) {
|
|
15
|
+
for (const c of path) {
|
|
16
|
+
switch (c.op) {
|
|
17
|
+
case 'M':
|
|
18
|
+
case 'L':
|
|
19
|
+
out.push(`${c.op}${n(c.x)} ${n(c.y)}`);
|
|
20
|
+
break;
|
|
21
|
+
case 'C':
|
|
22
|
+
out.push(`C${n(c.x1)} ${n(c.y1)} ${n(c.x2)} ${n(c.y2)} ${n(c.x)} ${n(c.y)}`);
|
|
23
|
+
break;
|
|
24
|
+
case 'Q':
|
|
25
|
+
out.push(`Q${n(c.x1)} ${n(c.y1)} ${n(c.x)} ${n(c.y)}`);
|
|
26
|
+
break;
|
|
27
|
+
case 'Z':
|
|
28
|
+
out.push('Z');
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return out.join('');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The `clip-path` declaration of a page with a die-cut: what is kept is the
|
|
37
|
+
* leaf's outline (else the bleed box, `bleedInset` inside the sheet, or the
|
|
38
|
+
* whole sheet), less every hole, as one even-odd path. `undefined` for a
|
|
39
|
+
* page nothing cuts. The path data holds only numbers and command letters.
|
|
40
|
+
* `holes: false` keeps the holes (a layer over them draws what shows
|
|
41
|
+
* through): only an outline is then cut, `undefined` without one.
|
|
42
|
+
*/
|
|
43
|
+
export function dieCutClipDecl(page, bleedInset = 0, holes = true) {
|
|
44
|
+
const found = page.dieCut;
|
|
45
|
+
const cut = found && !holes ? { ...found, holes: [] } : found;
|
|
46
|
+
if (!cut || (cut.holes.length === 0 && !cut.outline))
|
|
47
|
+
return undefined;
|
|
48
|
+
const b = Math.max(0, bleedInset);
|
|
49
|
+
const keep = cut.outline ?? [[
|
|
50
|
+
{ op: 'M', x: b, y: b }, { op: 'L', x: page.width - b, y: b }, { op: 'L', x: page.width - b, y: page.height - b },
|
|
51
|
+
{ op: 'L', x: b, y: page.height - b }, { op: 'Z' },
|
|
52
|
+
]];
|
|
53
|
+
return `clip-path:path(evenodd,'${svgPathData([...keep, ...cut.holes])}');`;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=dieCut.js.map
|
|
@@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EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACjH,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE;SACnD,CAAC,CAAC;IACH,OAAO,2BAA2B,WAAW,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;AAC9E,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { HTML_TEXT_RESET, renderToHtmlIndexed, renderToHtml } from './render.js';
|
|
2
2
|
export type { RenderHtmlOptions, HtmlRenderIndexPage, HtmlRenderIndex } from './render.js';
|
|
3
3
|
export { anchoredResourceIds } from './segmentText.js';
|
|
4
|
+
export { clearVarnishPaints } from './varnish.js';
|
|
4
5
|
export { tintHex, tintFilterElement } from './images.js';
|
|
5
6
|
export { renderHtmlBook, htmlBookFiles, htmlFontFaceRule, redistributableFaces, fontNoteWarning } from './book.js';
|
|
6
7
|
export type { RenderHtmlBookOptions, HtmlBookFace, HtmlBookFile, HtmlBookFontNote, HtmlBookWarning } from './book.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-backend.d.ts","sourceRoot":"","sources":["../../src/html-backend/html-backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACjF,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACnH,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"html-backend.d.ts","sourceRoot":"","sources":["../../src/html-backend/html-backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACjF,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACnH,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { HTML_TEXT_RESET, renderToHtmlIndexed, renderToHtml } from './render.js';
|
|
2
2
|
export { anchoredResourceIds } from './segmentText.js';
|
|
3
|
+
export { clearVarnishPaints } from './varnish.js';
|
|
3
4
|
export { tintHex, tintFilterElement } from './images.js';
|
|
4
5
|
// A whole book as one HTML page (#1544): the CLI's `postext html` and the
|
|
5
6
|
// Sandbox's Library write it here.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-backend.js","sourceRoot":"","sources":["../../src/html-backend/html-backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACzD,0EAA0E;AAC1E,mCAAmC;AACnC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"html-backend.js","sourceRoot":"","sources":["../../src/html-backend/html-backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACzD,0EAA0E;AAC1E,mCAAmC;AACnC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|