Commits (84)
FROM node:12-stretch FROM node:15-stretch
# Application parameters and variables # Application parameters and variables
ENV NODE_ENV=development ENV NODE_ENV=development
......
...@@ -138,6 +138,7 @@ layoutNode(node) ...@@ -138,6 +138,7 @@ layoutNode(node)
renderNode(node, sourceNode, layout) renderNode(node, sourceNode, layout)
onOverflow(overflow, rendered, bounds) onOverflow(overflow, rendered, bounds)
onBreakToken(breakToken, overflow, rendered) onBreakToken(breakToken, overflow, rendered)
afterOverflowRemoved(removed, rendered)
``` ```
## Setup ## Setup
......
This diff is collapsed.
{ {
"name": "pagedjs", "name": "pagedjs",
"version": "0.1.41", "version": "0.2.0",
"description": "Chunks up a document into paged media flows and applies print styles", "description": "Chunks up a document into paged media flows and applies print styles",
"author": "Fred Chasen", "author": "Fred Chasen",
"license": "MIT", "license": "MIT",
...@@ -10,32 +10,33 @@ ...@@ -10,32 +10,33 @@
"browser": "dist/paged.js", "browser": "dist/paged.js",
"dependencies": { "dependencies": {
"@babel/polyfill": "^7.10.1", "@babel/polyfill": "^7.10.1",
"@babel/runtime": "^7.10.2", "@babel/runtime": "^7.14.0",
"clear-cut": "^2.0.2", "clear-cut": "^2.0.2",
"css-tree": "1.0.0-alpha.39", "css-tree": "^1.1.3",
"event-emitter": "^0.3.5" "event-emitter": "^0.3.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.10.1", "@babel/cli": "^7.14.3",
"@babel/core": "^7.10.2", "@babel/core": "^7.14.3",
"@babel/plugin-proposal-async-generator-functions": "^7.10.1", "@babel/plugin-proposal-async-generator-functions": "^7.14.2",
"@babel/plugin-transform-runtime": "^7.10.1", "@babel/plugin-transform-runtime": "^7.14.3",
"@babel/preset-env": "^7.10.2", "@babel/preset-env": "^7.14.2",
"chalk": "^4.0.0", "@rollup/plugin-commonjs": "^19.0.0",
"eslint": "^7.1.0", "@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"chalk": "^4.1.1",
"eslint": "^7.27.0",
"express": "^4.17.1", "express": "^4.17.1",
"ghostscript4js": "^3.2.1", "ghostscript4js": "^3.2.1",
"jest": "^25.2.3", "jest": "^26.6.3",
"jest-image-snapshot": "^3.0.1", "jest-image-snapshot": "^4.5.0",
"puppeteer": "^3.3.0", "puppeteer": "^9.1.1",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"rollup": "^2.13.1", "rollup": "^2.38.3",
"rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-license": "^2.1.0",
"rollup-plugin-json": "^4.0.0", "rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-livereload": "^1.3.0",
"rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-serve": "^1.1.0"
"rollup-plugin-serve": "^1.0.1"
}, },
"scripts": { "scripts": {
"build": "rollup -c", "build": "rollup -c",
......
import resolve from 'rollup-plugin-node-resolve'; import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from 'rollup-plugin-commonjs'; import commonjs from "@rollup/plugin-commonjs";
import json from 'rollup-plugin-json'; import json from "@rollup/plugin-json";
import license from "rollup-plugin-license";
import pkg from './package.json'; import pkg from "./package.json";
const plugins = [ const plugins = [
resolve(), nodeResolve(),
commonjs({ commonjs({
include: 'node_modules/**' include: "node_modules/**"
}), }),
json() json(),
license({
banner: "@license Paged.js v<%= pkg.version %> | MIT | https://gitlab.pagedmedia.org/tools/pagedjs",
})
]; ];
export default [ export default [
...@@ -17,9 +21,9 @@ export default [ ...@@ -17,9 +21,9 @@ export default [
{ {
input: pkg.module, input: pkg.module,
output: { output: {
name: 'Paged', name: "Paged",
file: pkg.browser, file: pkg.browser,
format: 'umd' format: "umd"
}, },
plugins: plugins plugins: plugins
}, },
...@@ -27,9 +31,9 @@ export default [ ...@@ -27,9 +31,9 @@ export default [
{ {
input: pkg.module, input: pkg.module,
output: { output: {
name: "PagedModule", name: "PagedModule",
file: "./dist/paged.esm.js", file: "./dist/paged.esm.js",
format: 'es' format: "es"
}, },
plugins: plugins plugins: plugins
}, },
...@@ -37,9 +41,9 @@ export default [ ...@@ -37,9 +41,9 @@ export default [
{ {
input: "./src/polyfill/polyfill.js", input: "./src/polyfill/polyfill.js",
output: { output: {
name: 'PagedPolyfill', name: "PagedPolyfill",
file: "./dist/paged.polyfill.js", file: "./dist/paged.polyfill.js",
format: 'umd' format: "umd"
}, },
plugins: plugins plugins: plugins
} }
......
import resolve from 'rollup-plugin-node-resolve'; import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from 'rollup-plugin-commonjs'; import commonjs from "@rollup/plugin-commonjs";
import json from 'rollup-plugin-json'; import json from "@rollup/plugin-json";
import pkg from './package.json'; import pkg from './package.json';
const plugins = [ const plugins = [
resolve(), nodeResolve(),
commonjs(), commonjs(),
json() json()
]; ];
......
import resolve from 'rollup-plugin-node-resolve'; import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from 'rollup-plugin-commonjs'; import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import json from 'rollup-plugin-json';
// import builtins from 'rollup-plugin-node-builtins'; // import builtins from 'rollup-plugin-node-builtins';
// import globals from 'rollup-plugin-node-globals'; // import globals from 'rollup-plugin-node-globals';
import pkg from './package.json'; // import pkg from './package.json';
import serve from 'rollup-plugin-serve' import serve from 'rollup-plugin-serve'
import livereload from 'rollup-plugin-livereload' import livereload from 'rollup-plugin-livereload'
const plugins = [ const plugins = [
resolve(), nodeResolve(),
commonjs(), commonjs(),
json(), json(),
// globals(), // globals(),
......
<!DOCTYPE html PUBLIC>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>break-inside-avoid-table-cell</title>
<script src="../../../../dist/paged.polyfill.js"></script>
<style>
@page {
size: 210mm 100mm;
border: 1px solid #cfc2c2;
}
table {
border-collapse: collapse;
}
table, th, td {
border: 1px solid black;
}
tr, td {
break-inside: avoid;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
<td>d</td>
<td>e</td>
</tr>
<tr>
<td>
<p>Sed sollicitudin ac neque at tincidunt. Proin gravida neque sit amet euismod imperdiet.</p>
<p>Nunc eu faucibus mi, nec tincidunt turpis. In mi lacus, sagittis et <em>iaculis</em> id, tincidunt vitae dui. Sed <strong>aliquet ornare ornare</strong>.</p>
<p>Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vivamus iaculis finibus nisl in pharetra.</p>
</td>
<td><p>Lorem ipsum dolor sit amet</p></td>
<td><p>Lorem ipsum dolor sit amet</p></td>
<td><p>Lorem ipsum dolor sit amet</p></td>
<td><p>Lorem ipsum dolor sit amet</p></td>
</tr>
</tbody>
</table>
</body>
</html>
const TIMEOUT = 10000; // Some book might take longer than this to renderer
describe("break-inside-avoid-table-cell", () => {
let page;
beforeAll(async () => {
page = await loadPage("breaks/break-inside/break-inside-avoid/break-inside-avoid-table-cell.html");
return page.rendered;
}, TIMEOUT);
afterAll(async () => {
if (!DEBUG) {
await page.close();
}
});
it("should render 2 pages", async () => {
let pages = await page.$$eval(".pagedjs_page", (r) => {
return r.length;
});
expect(pages).toEqual(2);
});
if (!DEBUG) {
it("should create a pdf", async () => {
let pdf = await page.pdf(PDF_SETTINGS);
expect(pdf).toMatchPDFSnapshot(1);
expect(pdf).toMatchPDFSnapshot(2);
});
}
});