@xiee/utils 1.14.135 → 1.14.137

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/AGENTS.md ADDED
@@ -0,0 +1,39 @@
1
+ # Notes for AI agents
2
+
3
+ Small browser scripts and stylesheets in `js/` and `css/`, published as `@xiee/utils`. The `*.min.*` files are built by `build.sh` in CI; don't edit or commit them.
4
+
5
+ ## Tests
6
+
7
+ Playwright tests in `tests/` load HTML fixtures in headless Chromium (jsdom is no use: the scripts need real layout and a real browser).
8
+
9
+ ```sh
10
+ npm ci # first time only
11
+ npx playwright install chromium # first time only, unless a browser is installed
12
+ npm test # all tests
13
+ npx playwright test -g tabset # tests whose name matches
14
+ CHROMIUM_PATH=/usr/bin/chromium-browser npm test # use an installed browser
15
+ ```
16
+
17
+ - `.npmrc` pins the public npm registry so `package-lock.json` never gets URLs of a machine-specific (e.g., internal) registry; check with `grep -c resolved package-lock.json` vs `grep -c registry.npmjs.org package-lock.json` after changing dependencies.
18
+ - Fix a bug or add a feature => add a test that fails without the change.
19
+ - Tests for a script go in `tests/<script>.spec.js`; write the fixture HTML inline and load the script from the repo by absolute `file://` URL (see `fixture()` in `tests/helper.js`).
20
+ - Assert behavior and invariants, not pixels or exact layout. A hang shows up as a timeout.
21
+ - `pages.js` tests (`tests/pages.spec.js`): `paginate()` paginates a fixture and returns the pages. Invariants: pagination finishes, pages fit, no blank page, no text lost/duplicated/reordered, the pieces of broken elements are consistent (`bad` from `paginate()`: a non-last piece ends its parent on the page, a non-first piece starts it, none is both first and last).
22
+ - Testing `pages.js` on a real document (e.g., the litedown book): use its raw HTML (`curl`), or open the live URL and `page.route()` the CDN `pages.min.js/css` to the repo files. Don't save `page.content()` and test that: the re-parsing closes `<p>` at the `<div>` of a note that `sidenotes.js` put inside it, which creates bugs that don't exist.
23
+ - Tests for white space at page bottoms: a filler `div` of `B - free` px (`B`: body height of a probe page) before the block, sweep `free` over a range (the page capacity is not exactly the body height), assert on page 1 (see `firstPages()`), and check that the test fails without the change.
24
+ - Fill mode (`pagesjs-filling`: `height: auto`, `scrollHeight` is the natural height) differs from the final layout (fixed height; the body may hang over into the space above the footer). What the reader sees must be measured in the final layout (`checkOffsets()` for `page-multiple`).
25
+ - Footnotes and citations are measured as a `.footnotes` block after the page body, like in the end (`syncNotes()`); in the text they are hidden markers (`span.pagesjs-note`) that go with their references. Don't measure them inline or add CSS to approximate their space.
26
+ - By design, not bugs: a 2-line paragraph is not split (orphan/widow), a heading may end a page, `.figure`/diagrams/flex containers are never broken (they overflow small pages), `moveShortHead()` compares with one line.
27
+ - To compare a change: dump the `.pagesjs-page` HTML before and after (normalize file paths in link titles, random `md-<n>-<n>` ids and `data-page-number`), and check that the concatenated body text is identical.
28
+
29
+ ## Performance of `pages.js`
30
+
31
+ - The time is the browser's style and layout, not the JS: every `scrollHeight`/`getBoundingClientRect()` read after a DOM change is a forced layout with a large fixed cost (0.3-0.6 ms). Count and batch the reads (see `fitting()`) instead of tuning the JS. `:has()` rules are re-evaluated on every DOM change in the page being filled, so don't use one that can match an ancestor of the content (e.g., `.pagesjs-page:has(.pagesjs-front)` cost 8% on the litedown book; `pages.js` adds the class `page-front` instead). Rules on content cost less (`pre:has(code[data-file])` was about 3% on the litedown book); a child combinator `:has(> ...)` does not make them cheaper, a class on the subject does (`pre.file`, which the book sets in a script).
32
+ - Measure on the litedown book (and on a flat variant of it, without the chapter wrappers, since the children of the root take another path than those of a broken element). On a shared machine wall time is useless; compare the thread CPU time (CDP `Performance.getMetrics`, `ThreadTime`), the minimum of several runs, with the variants interleaved.
33
+ - A speedup must not change the pages: compare the `.pagesjs-page` HTML before and after (see above) on those documents and on random ones (paragraphs, lists, tables, code, figures, big margins).
34
+
35
+ ## Releases
36
+
37
+ 1. Commit the version bump in `package.json` as `Bump to X.Y.Z` (patch +1 unless told otherwise), after tests pass.
38
+ 2. Tag that commit `vX.Y.Z` and push the commit and the tag. Pushing a `v*` tag triggers `.github/workflows/npm-publish.yml`, which builds the minified files, runs `npm publish`, and purges the CDN cache.
39
+ 3. Pushing and tagging are outward-facing: do them only when the user asks for a release.
@@ -94,7 +94,7 @@
94
94
  * {
95
95
  flex: 1 0 min-content;
96
96
  }
97
- pre:has(code[data-file]) {
97
+ pre.file {
98
98
  border: groove mintcream;
99
99
  border-top: none;
100
100
  &::before {
@@ -119,7 +119,7 @@ code[data-file]::before {
119
119
  margin: -1em -1em 1em 1em;
120
120
  }
121
121
 
122
- pre:has(code[data-file]) {
122
+ pre.file {
123
123
  &::before {
124
124
  content: "Output";
125
125
  text-transform: uppercase;
@@ -128,10 +128,10 @@ pre:has(code[data-file]) {
128
128
  padding: .5em 1em;
129
129
  border-bottom: none;
130
130
  }
131
- &:has(code[data-file$=".Rmd"])::before {
131
+ &.example::before {
132
132
  content: "♧ Example";
133
133
  }
134
- &:has(code[data-source])::before {
134
+ &.source::before {
135
135
  content: "♧ Source";
136
136
  }
137
137
  /* pieces of a code block split across pages: label only on the first piece,
@@ -1,2 +1,2 @@
1
- .pagesjs #TOC>ul>li>ul>li>ul>li>ul,.chapter-toc>ul>li>ul>li>ul{display:none}.pagesjs{& #tab\:assets tr>:nth-child(2){display:none}}.epigraph{margin-bottom:4em;padding:5px;position:relative;&,& blockquote{border:1px solid}&:before,&:after,& blockquote:before,& blockquote:after{content:"•";text-align:center;border:1px solid;width:1em;height:1em;line-height:1;display:inline-block;position:absolute}&:before{left:5px}&:after{content:"❀";color:#639;text-align:right;opacity:.2;border:none;font-size:3em;inset:5px 5px auto auto}& blockquote{padding:1em;&:before{inset:auto auto 5px 5px}&:after{inset:auto 5px 5px auto}}&.pagesjs-fragmented{&:not(.fragment-first),&:not(.fragment-last) blockquote{&:before,&:after{display:none}}&:not(.fragment-first){&,& blockquote{padding-top:1px}}&:not(.fragment-last){&,& blockquote{padding-bottom:1px}}}}.new-road{& p{justify-content:center;gap:.5em;display:flex}& button:before{font-size:200%}& .old-knit,& .new-fuse{&:hover:before{content:"❓ "}}& .old-knit{&:before{content:"🧶 "}&:focus:before{content:"😡 "}}& .new-fuse:before{content:"↯ "}& .new-preview:before{content:"⏵ "}& .new-fuse:focus:before{content:"😇 "}}.flex-col{gap:.5em;& *{flex:1 0 min-content}& pre:has(code[data-file]){border:groove #f5fffa;border-top:none;&:before{border-top:groove #f5fffa;border-bottom:none;border-left:none;border-right:groove #f5fffa}& code{border:none;border-top:1px dashed #d3d3d3}}}code[data-file]:before{content:attr(data-file);float:right;background:#ffffe0;margin:-1em -1em 1em 1em;padding:.5em;font-size:.9em;display:inline-block}pre:has(code[data-file]){&:before{content:"Output";text-transform:uppercase;border-bottom:none;padding:.5em 1em;font-weight:700;display:inline-block}&:has(code[data-file$=\.Rmd]):before{content:"♧ Example"}&:has(code[data-source]):before{content:"♧ Source"}&.pagesjs-fragmented{&:not(.fragment-first){&:before,& code:before{content:unset}& code{border-top:none}}&:not(.fragment-last) code{border-bottom:none}}& code,&:before{border:groove #f5fffa}&:before{border-bottom:none}}pre .ex-out:after{content:"⏵";font-size:1.5em;text-decoration:none;position:absolute;inset:auto 5px 0 auto}.no-ref-label{& .cross-ref-sec:before{content:""}}.larger{font-size:1.5em}
1
+ .pagesjs #TOC>ul>li>ul>li>ul>li>ul,.chapter-toc>ul>li>ul>li>ul{display:none}.pagesjs{& #tab\:assets tr>:nth-child(2){display:none}}.epigraph{margin-bottom:4em;padding:5px;position:relative;&,& blockquote{border:1px solid}&:before,&:after,& blockquote:before,& blockquote:after{content:"•";text-align:center;border:1px solid;width:1em;height:1em;line-height:1;display:inline-block;position:absolute}&:before{left:5px}&:after{content:"❀";color:#639;text-align:right;opacity:.2;border:none;font-size:3em;inset:5px 5px auto auto}& blockquote{padding:1em;&:before{inset:auto auto 5px 5px}&:after{inset:auto 5px 5px auto}}&.pagesjs-fragmented{&:not(.fragment-first),&:not(.fragment-last) blockquote{&:before,&:after{display:none}}&:not(.fragment-first){&,& blockquote{padding-top:1px}}&:not(.fragment-last){&,& blockquote{padding-bottom:1px}}}}.new-road{& p{justify-content:center;gap:.5em;display:flex}& button:before{font-size:200%}& .old-knit,& .new-fuse{&:hover:before{content:"❓ "}}& .old-knit{&:before{content:"🧶 "}&:focus:before{content:"😡 "}}& .new-fuse:before{content:"↯ "}& .new-preview:before{content:"⏵ "}& .new-fuse:focus:before{content:"😇 "}}.flex-col{gap:.5em;& *{flex:1 0 min-content}& pre.file{border:groove #f5fffa;border-top:none;&:before{border-top:groove #f5fffa;border-bottom:none;border-left:none;border-right:groove #f5fffa}& code{border:none;border-top:1px dashed #d3d3d3}}}code[data-file]:before{content:attr(data-file);float:right;background:#ffffe0;margin:-1em -1em 1em 1em;padding:.5em;font-size:.9em;display:inline-block}pre.file{&:before{content:"Output";text-transform:uppercase;border-bottom:none;padding:.5em 1em;font-weight:700;display:inline-block}&.example:before{content:"♧ Example"}&.source:before{content:"♧ Source"}&.pagesjs-fragmented{&:not(.fragment-first){&:before,& code:before{content:unset}& code{border-top:none}}&:not(.fragment-last) code{border-bottom:none}}& code,&:before{border:groove #f5fffa}&:before{border-bottom:none}}pre .ex-out:after{content:"⏵";font-size:1.5em;text-decoration:none;position:absolute;inset:auto 5px 0 auto}.no-ref-label{& .cross-ref-sec:before{content:""}}.larger{font-size:1.5em}
2
2
  /*# sourceMappingURL=book-litedown.min.css.map */
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAGA,4EAIA,SACE,8CAKF,0DAIE,gCAGA,mLAUA,kBAGA,+GASA,yBAEE,iCAGA,iCAIF,qBACE,wDACE,+BAIF,uBACE,gCAIF,sBACE,qCAQN,UACE,iDAKA,+BACA,wBACE,+BAEF,YACE,yBACA,gCAEF,kCACA,qCACA,0CAIF,mBAEE,yBAGA,iEAGE,mGAKA,mDAOJ,wJAUA,yBACE,4HAQA,2DAGA,qDAKA,qBACE,uBACE,qCAGA,wBAIF,+CAIF,sCAGA,6BAKF,6GAQA,cACE,oCAKF","sources":["book-litedown.css"],"sourcesContent":["/* CSS for https://yihui.org/litedown/ */\n\n/* hide 4th-level TOC items when printing to PDF and 3rd-level in chapter TOC */\n.pagesjs #TOC > ul > li > ul > li > ul > li > ul, .chapter-toc > ul > li > ul > li > ul {\n display: none;\n}\n\n.pagesjs {\n #tab\\:assets tr > :nth-child(2) {\n display: none;\n }\n}\n\n.epigraph {\n position: relative;\n padding: 5px;\n margin-bottom: 4em;\n &, blockquote {\n border: 1px solid;\n }\n &::before, &::after, blockquote::before, blockquote::after {\n content: \"•\";\n position: absolute;\n border: 1px solid;\n display: inline-block;\n width: 1em;\n height: 1em;\n text-align: center;\n line-height: 1;\n }\n &::before {\n left: 5px;\n }\n &::after {\n content: \"❀\";\n color: rebeccapurple;\n font-size: 3em;\n text-align: right;\n border: none;\n opacity: .2;\n inset: 5px 5px auto auto;\n }\n blockquote {\n padding: 1em;\n &::before {\n inset: auto auto 5px 5px;\n }\n &::after {\n inset: auto 5px 5px auto;\n }\n }\n &.pagesjs-fragmented {\n &:not(.fragment-first), &:not(.fragment-last) blockquote {\n &::before, &::after {\n display: none;\n }\n }\n &:not(.fragment-first) {\n &, blockquote {\n padding-top: 1px;\n }\n }\n &:not(.fragment-last) {\n &, blockquote {\n padding-bottom: 1px;\n }\n }\n }\n}\n\n/* a tale of two buttons */\n.new-road {\n p {\n display: flex;\n justify-content: center;\n gap: .5em;\n }\n button::before { font-size: 200%; }\n .old-knit, .new-fuse {\n &:hover::before { content: \"❓ \"; }\n }\n .old-knit {\n &::before { content: \"🧶 \"; }\n &:focus::before { content: \"😡 \"; }\n }\n .new-fuse::before { content: \"↯ \"; }\n .new-preview::before { content: \"⏵ \"; }\n .new-fuse:focus::before { content: \"😇 \"; }\n}\n\n/* arrange elements in columns */\n.flex-col {\n gap: .5em;\n * {\n flex: 1 0 min-content;\n }\n pre:has(code[data-file]) {\n border: groove mintcream;\n border-top: none;\n &::before {\n border: groove mintcream;\n border-left: none;\n border-bottom: none;\n }\n code {\n border: none;\n border-top: 1px dashed lightgray;\n }\n }\n}\n\ncode[data-file]::before {\n content: attr(data-file);\n font-size: .9em;\n float: right;\n background: lightyellow;\n display: inline-block;\n padding: .5em;\n margin: -1em -1em 1em 1em;\n}\n\npre:has(code[data-file]) {\n &::before {\n content: \"Output\";\n text-transform: uppercase;\n font-weight: bold;\n display: inline-block;\n padding: .5em 1em;\n border-bottom: none;\n }\n &:has(code[data-file$=\".Rmd\"])::before {\n content: \"♧ Example\";\n }\n &:has(code[data-source])::before {\n content: \"♧ Source\";\n }\n /* pieces of a code block split across pages: label only on the first piece,\n and no border on the sides where it is cut */\n &.pagesjs-fragmented {\n &:not(.fragment-first) {\n &::before, code::before {\n content: unset;\n }\n code {\n border-top: none;\n }\n }\n &:not(.fragment-last) code {\n border-bottom: none;\n }\n }\n code, &::before {\n border: groove mintcream;\n }\n &::before {\n border-bottom: none;\n }\n}\n\npre .ex-out::after {\n content: \"⏵\";\n position: absolute;\n inset: auto 5px 0 auto;\n text-decoration: none;\n font-size: 1.5em;\n}\n\n.no-ref-label {\n .cross-ref-sec:before {\n content: \"\";\n }\n}\n\n.larger { font-size: 1.5em; }\n"],"names":[]}
1
+ {"version":3,"mappings":"AAGA,4EAIA,SACE,8CAKF,0DAIE,gCAGA,mLAUA,kBAGA,+GASA,yBAEE,iCAGA,iCAIF,qBACE,wDACE,+BAIF,uBACE,gCAIF,sBACE,qCAQN,UACE,iDAKA,+BACA,wBACE,+BAEF,YACE,yBACA,gCAEF,kCACA,qCACA,0CAIF,mBAEE,yBAGA,iDAGE,mGAKA,mDAOJ,wJAUA,SACE,4HAQA,uCAGA,qCAKA,qBACE,uBACE,qCAGA,wBAIF,+CAIF,sCAGA,6BAKF,6GAQA,cACE,oCAKF","sources":["book-litedown.css"],"sourcesContent":["/* CSS for https://yihui.org/litedown/ */\n\n/* hide 4th-level TOC items when printing to PDF and 3rd-level in chapter TOC */\n.pagesjs #TOC > ul > li > ul > li > ul > li > ul, .chapter-toc > ul > li > ul > li > ul {\n display: none;\n}\n\n.pagesjs {\n #tab\\:assets tr > :nth-child(2) {\n display: none;\n }\n}\n\n.epigraph {\n position: relative;\n padding: 5px;\n margin-bottom: 4em;\n &, blockquote {\n border: 1px solid;\n }\n &::before, &::after, blockquote::before, blockquote::after {\n content: \"•\";\n position: absolute;\n border: 1px solid;\n display: inline-block;\n width: 1em;\n height: 1em;\n text-align: center;\n line-height: 1;\n }\n &::before {\n left: 5px;\n }\n &::after {\n content: \"❀\";\n color: rebeccapurple;\n font-size: 3em;\n text-align: right;\n border: none;\n opacity: .2;\n inset: 5px 5px auto auto;\n }\n blockquote {\n padding: 1em;\n &::before {\n inset: auto auto 5px 5px;\n }\n &::after {\n inset: auto 5px 5px auto;\n }\n }\n &.pagesjs-fragmented {\n &:not(.fragment-first), &:not(.fragment-last) blockquote {\n &::before, &::after {\n display: none;\n }\n }\n &:not(.fragment-first) {\n &, blockquote {\n padding-top: 1px;\n }\n }\n &:not(.fragment-last) {\n &, blockquote {\n padding-bottom: 1px;\n }\n }\n }\n}\n\n/* a tale of two buttons */\n.new-road {\n p {\n display: flex;\n justify-content: center;\n gap: .5em;\n }\n button::before { font-size: 200%; }\n .old-knit, .new-fuse {\n &:hover::before { content: \"❓ \"; }\n }\n .old-knit {\n &::before { content: \"🧶 \"; }\n &:focus::before { content: \"😡 \"; }\n }\n .new-fuse::before { content: \"↯ \"; }\n .new-preview::before { content: \"⏵ \"; }\n .new-fuse:focus::before { content: \"😇 \"; }\n}\n\n/* arrange elements in columns */\n.flex-col {\n gap: .5em;\n * {\n flex: 1 0 min-content;\n }\n pre.file {\n border: groove mintcream;\n border-top: none;\n &::before {\n border: groove mintcream;\n border-left: none;\n border-bottom: none;\n }\n code {\n border: none;\n border-top: 1px dashed lightgray;\n }\n }\n}\n\ncode[data-file]::before {\n content: attr(data-file);\n font-size: .9em;\n float: right;\n background: lightyellow;\n display: inline-block;\n padding: .5em;\n margin: -1em -1em 1em 1em;\n}\n\npre.file {\n &::before {\n content: \"Output\";\n text-transform: uppercase;\n font-weight: bold;\n display: inline-block;\n padding: .5em 1em;\n border-bottom: none;\n }\n &.example::before {\n content: \"♧ Example\";\n }\n &.source::before {\n content: \"♧ Source\";\n }\n /* pieces of a code block split across pages: label only on the first piece,\n and no border on the sides where it is cut */\n &.pagesjs-fragmented {\n &:not(.fragment-first) {\n &::before, code::before {\n content: unset;\n }\n code {\n border-top: none;\n }\n }\n &:not(.fragment-last) code {\n border-bottom: none;\n }\n }\n code, &::before {\n border: groove mintcream;\n }\n &::before {\n border-bottom: none;\n }\n}\n\npre .ex-out::after {\n content: \"⏵\";\n position: absolute;\n inset: auto 5px 0 auto;\n text-decoration: none;\n font-size: 1.5em;\n}\n\n.no-ref-label {\n .cross-ref-sec:before {\n content: \"\";\n }\n}\n\n.larger { font-size: 1.5em; }\n"],"names":[]}
package/css/book.css CHANGED
@@ -49,7 +49,7 @@ h1 .section-number {
49
49
  article h2 { border-bottom-style: dashed; }
50
50
  /* TODO: style for h1.part and printing */
51
51
 
52
- .pagesjs .pagesjs-page:first-child:has(.pagesjs-front) {
52
+ .pagesjs .pagesjs-page.page-front:first-child {
53
53
  padding: 0;
54
54
  .pagesjs-header, .pagesjs-footer {
55
55
  display: none;
package/css/book.min.css CHANGED
@@ -1,2 +1,2 @@
1
- body{font-family:Palatino,Georgia,serif}.frontmatter,.chapter{min-height:calc(100vh - 1em)}.frontmatter{background:#fff;padding-bottom:0;&>div{background:#ebf6f9;margin:0 -1em;padding:1em}& .title{margin-top:-1em;padding:20vh 1em 1em}}@media (width>=79.002em){body:not(.pagesjs) .chapter-toc{display:none}}.chapter-toc{border:1px solid var(--border-color);border-radius:5px;margin-bottom:2em;padding:1em}.chapter{&:not(.appendix) .main-number{&:before{content:"Chapter "}&:after{content:none}}& h1{border-bottom:1px solid;margin:1em auto 3em;&:has(+.epigraph){margin-bottom:2em}}}h1 .section-number{border-bottom:4px solid;margin-bottom:-4px;display:inline-block}article h2{border-bottom-style:dashed}.pagesjs .pagesjs-page:first-child:has(.pagesjs-front){padding:0;& .pagesjs-header,& .pagesjs-footer{display:none}& .pagesjs-front{padding:var(--paper-margin-top) var(--paper-margin-right) var(--paper-margin-bottom) var(--paper-margin-left);height:100%;margin:0;& .title{margin-top:calc(0px - var(--paper-margin-top))}&>div{margin:0 calc(0px - var(--paper-margin-right)) 0 calc(0px - var(--paper-margin-left))}}}
1
+ body{font-family:Palatino,Georgia,serif}.frontmatter,.chapter{min-height:calc(100vh - 1em)}.frontmatter{background:#fff;padding-bottom:0;&>div{background:#ebf6f9;margin:0 -1em;padding:1em}& .title{margin-top:-1em;padding:20vh 1em 1em}}@media (width>=79.002em){body:not(.pagesjs) .chapter-toc{display:none}}.chapter-toc{border:1px solid var(--border-color);border-radius:5px;margin-bottom:2em;padding:1em}.chapter{&:not(.appendix) .main-number{&:before{content:"Chapter "}&:after{content:none}}& h1{border-bottom:1px solid;margin:1em auto 3em;&:has(+.epigraph){margin-bottom:2em}}}h1 .section-number{border-bottom:4px solid;margin-bottom:-4px;display:inline-block}article h2{border-bottom-style:dashed}.pagesjs .pagesjs-page.page-front:first-child{padding:0;& .pagesjs-header,& .pagesjs-footer{display:none}& .pagesjs-front{padding:var(--paper-margin-top) var(--paper-margin-right) var(--paper-margin-bottom) var(--paper-margin-left);height:100%;margin:0;& .title{margin-top:calc(0px - var(--paper-margin-top))}&>div{margin:0 calc(0px - var(--paper-margin-right)) 0 calc(0px - var(--paper-margin-left))}}}
2
2
  /*# sourceMappingURL=book.min.css.map */
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,wCAGA,mDAGA,8CAKE,mDAKA,+CAKF,yBACE,8CAIF,kGAMA,SACE,8BACE,4BACA,sBAEF,iDAGE,sCAGJ,mFAKA,sCAGA,iEAEE,iDAGA,oJAIE,wDAGA","sources":["book.css"],"sourcesContent":["body {\n font-family: Palatino, Georgia, serif;\n}\n.frontmatter, .chapter {\n min-height: calc(100vh - 1em);\n}\n.frontmatter {\n background-image: radial-gradient(#b6cee2 1px, #fff 1px);\n background-size: 2em 2em;\n background: #fff;\n padding-bottom: 0;\n & > div {\n margin: 0 -1em;\n background: #ebf6f9;\n padding: 1em;\n }\n & .title {\n padding: 20vh 1em 1em;\n margin-top: -1em;\n }\n}\n@media (min-width: 79.002em) {\n body:not(.pagesjs) .chapter-toc {\n display: none;\n }\n}\n.chapter-toc {\n border: 1px solid var(--border-color);\n border-radius: 5px;\n padding: 1em;\n margin-bottom: 2em;\n}\n.chapter {\n &:not(.appendix) .main-number {\n &::before { content: \"Chapter \"; }\n &::after { content: none; }\n }\n h1 {\n margin: 1em auto 3em;\n border-bottom: 1px solid;\n &:has(+ .epigraph) { margin-bottom: 2em; }\n }\n}\nh1 .section-number {\n display: inline-block;\n border-bottom: 4px solid;\n margin-bottom: -4px;\n}\narticle h2 { border-bottom-style: dashed; }\n/* TODO: style for h1.part and printing */\n\n.pagesjs .pagesjs-page:first-child:has(.pagesjs-front) {\n padding: 0;\n .pagesjs-header, .pagesjs-footer {\n display: none;\n }\n .pagesjs-front {\n margin: 0;\n padding: var(--paper-margin-top) var(--paper-margin-right) var(--paper-margin-bottom) var(--paper-margin-left);\n height: 100%;\n .title {\n margin-top: calc(0px - var(--paper-margin-top));\n }\n & > div {\n margin: 0 calc(0px - var(--paper-margin-right)) 0 calc(0px - var(--paper-margin-left));\n }\n }\n}\n"],"names":[]}
1
+ {"version":3,"mappings":"AAAA,wCAGA,mDAGA,8CAKE,mDAKA,+CAKF,yBACE,8CAIF,kGAMA,SACE,8BACE,4BACA,sBAEF,iDAGE,sCAGJ,mFAKA,sCAGA,wDAEE,iDAGA,oJAIE,wDAGA","sources":["book.css"],"sourcesContent":["body {\n font-family: Palatino, Georgia, serif;\n}\n.frontmatter, .chapter {\n min-height: calc(100vh - 1em);\n}\n.frontmatter {\n background-image: radial-gradient(#b6cee2 1px, #fff 1px);\n background-size: 2em 2em;\n background: #fff;\n padding-bottom: 0;\n & > div {\n margin: 0 -1em;\n background: #ebf6f9;\n padding: 1em;\n }\n & .title {\n padding: 20vh 1em 1em;\n margin-top: -1em;\n }\n}\n@media (min-width: 79.002em) {\n body:not(.pagesjs) .chapter-toc {\n display: none;\n }\n}\n.chapter-toc {\n border: 1px solid var(--border-color);\n border-radius: 5px;\n padding: 1em;\n margin-bottom: 2em;\n}\n.chapter {\n &:not(.appendix) .main-number {\n &::before { content: \"Chapter \"; }\n &::after { content: none; }\n }\n h1 {\n margin: 1em auto 3em;\n border-bottom: 1px solid;\n &:has(+ .epigraph) { margin-bottom: 2em; }\n }\n}\nh1 .section-number {\n display: inline-block;\n border-bottom: 4px solid;\n margin-bottom: -4px;\n}\narticle h2 { border-bottom-style: dashed; }\n/* TODO: style for h1.part and printing */\n\n.pagesjs .pagesjs-page.page-front:first-child {\n padding: 0;\n .pagesjs-header, .pagesjs-footer {\n display: none;\n }\n .pagesjs-front {\n margin: 0;\n padding: var(--paper-margin-top) var(--paper-margin-right) var(--paper-margin-bottom) var(--paper-margin-left);\n height: 100%;\n .title {\n margin-top: calc(0px - var(--paper-margin-top));\n }\n & > div {\n margin: 0 calc(0px - var(--paper-margin-right)) 0 calc(0px - var(--paper-margin-left));\n }\n }\n}\n"],"names":[]}
package/css/pages.css CHANGED
@@ -195,7 +195,7 @@
195
195
  margin-top: var(--page-footer-top);
196
196
  align-items: start;
197
197
  &::before {
198
- content: " ";
198
+ content: attr(data-page-url);
199
199
  }
200
200
  &::after {
201
201
  content: attr(data-page-number);
@@ -208,9 +208,7 @@
208
208
  }
209
209
  @media only screen {
210
210
  .pagesjs {
211
- &:has(.pagesjs-page) {
212
- background: #f7f7f7;
213
- }
211
+ background: #f7f7f7;
214
212
  .pagesjs-page {
215
213
  background: white;
216
214
  }
@@ -223,13 +221,6 @@
223
221
  .pagesjs-page {
224
222
  opacity: 0; /* don't show the page that is being filled (only the progress) */
225
223
  height: auto;
226
- .pagesjs-body:has(.footnotes) {
227
- margin-bottom: 1em;
228
- .footnotes {
229
- float: left;
230
- width: 100%;
231
- }
232
- }
233
224
  }
234
225
  }
235
226
  }
package/css/pages.min.css CHANGED
@@ -1,2 +1,2 @@
1
- :root{--paper-width:210mm;--paper-height:297mm;--paper-margin-top:40px;--paper-margin-right:80px;--paper-margin-bottom:40px;--paper-margin-left:80px;--page-header-height:40px;--page-header-bottom:40px;--page-footer-height:40px;--page-footer-top:40px}@page{size:var(--paper-width) var(--paper-height);margin:0}@page multiple{margin-top:var(--paper-margin-top);margin-bottom:var(--paper-margin-bottom)}.page-multiple{page:multiple}.pagesjs{flex-wrap:wrap;justify-content:center;gap:5mm;max-width:100%;margin:5mm;padding:0;display:flex;& .pagesjs-front,& .chapter{min-height:unset;box-shadow:none}&>*,&:not(:has(.pagesjs-front)):has(.chapter-toc) #TOC:not(.chapter-toc){display:none}& .pagesjs-page{width:var(--paper-width);height:var(--paper-height);padding:var(--paper-margin-top) var(--paper-margin-right) var(--paper-margin-bottom) var(--paper-margin-left);break-after:page;flex-direction:column;justify-content:space-between;display:flex;overflow:hidden;& img{max-width:100%}& .chapter-before,& .chapter-after,& .buttons:has(+.chapter-before){display:none}& #TOC{border:none;margin-left:auto;padding:0;&:not(.chapter-toc):is(.fragment-first,:not(.pagesjs-fragmented)):before{content:"Contents";margin-bottom:1em;font-size:1.5em;font-weight:700;display:block}& a{display:flex;&:after{content:attr(data-page-number);align-self:end;margin-left:1ch}& .section-number{margin-right:.3em}& .toc-text{flex:1 0;position:relative;overflow:hidden;&:after{content:"";border-bottom:1px dashed;width:100%;margin-left:1ch;position:absolute;bottom:1.5ex}}}}& .pagesjs-wrap{box-shadow:none!important;float:none!important;background:0 0!important;border:none!important;width:auto!important;max-width:none!important;height:auto!important;min-height:0!important;margin:0!important;padding:0!important;display:block!important;position:static!important;transform:none!important}& .pagesjs-run{display:block}& .pagesjs-fragmented{&:not(.fragment-first){border-top:none;margin-top:0;padding-top:0;&>thead{opacity:.5}}&:not(.fragment-last){border-bottom:none;margin-bottom:0;padding-bottom:0;&>tfoot{opacity:.5}}}& li.pagesjs-fragmented:not(.fragment-first)::marker{content:""}& .fullwidth{float:none;max-width:none;width:var(--paper-width);margin-left:calc(0px - var(--paper-margin-left));transform:none}& .footnotes{margin-top:1.5em}& .footnotes:before{content:"";border-top:1px solid;max-width:20em;display:block}&:has(.side-left,.embed-left) .pagesjs-body{padding-left:calc(0px - var(--side-margin));& .fullwidth{transform:translate(var(--side-margin))}}&:has(.side-right,.embed-right) .pagesjs-body{padding-right:calc(0px - var(--side-margin))}& .side{background:0 0;font-size:.9em}}}.pagesjs>.pagesjs-progress{z-index:9999;color:#fff;background:#000000bf;border-radius:1em;padding:.3em .8em;font:14px sans-serif;display:block;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.pagesjs-settle .pagesjs-body{padding:0!important}.pagesjs-header,.pagesjs-footer{justify-content:space-between;font-size:.9em;display:flex}.pagesjs-header{flex:0 0 var(--page-header-height);margin-bottom:var(--page-header-bottom);align-items:end;&:before{content:attr(data-main-title)}&:after{content:attr(data-page-title)}}.pagesjs-footer{flex:0 0 var(--page-footer-height);margin-top:var(--page-footer-top);align-items:start;&:before{content:" "}&:after{content:attr(data-page-number)}}.pagesjs-body{flex-grow:1;min-height:0;position:relative}@media only screen{.pagesjs{&:has(.pagesjs-page){background:#f7f7f7}& .pagesjs-page{background:#fff}& .page-multiple{overflow-y:auto}}.pagesjs-filling{display:block;& .pagesjs-page{opacity:0;height:auto;& .pagesjs-body:has(.footnotes){margin-bottom:1em;& .footnotes{float:left;width:100%}}}}}@media print{.pagesjs{gap:0;margin:0;& .page-multiple{height:auto;padding-top:0;padding-bottom:0}}}
1
+ :root{--paper-width:210mm;--paper-height:297mm;--paper-margin-top:40px;--paper-margin-right:80px;--paper-margin-bottom:40px;--paper-margin-left:80px;--page-header-height:40px;--page-header-bottom:40px;--page-footer-height:40px;--page-footer-top:40px}@page{size:var(--paper-width) var(--paper-height);margin:0}@page multiple{margin-top:var(--paper-margin-top);margin-bottom:var(--paper-margin-bottom)}.page-multiple{page:multiple}.pagesjs{flex-wrap:wrap;justify-content:center;gap:5mm;max-width:100%;margin:5mm;padding:0;display:flex;& .pagesjs-front,& .chapter{min-height:unset;box-shadow:none}&>*,&:not(:has(.pagesjs-front)):has(.chapter-toc) #TOC:not(.chapter-toc){display:none}& .pagesjs-page{width:var(--paper-width);height:var(--paper-height);padding:var(--paper-margin-top) var(--paper-margin-right) var(--paper-margin-bottom) var(--paper-margin-left);break-after:page;flex-direction:column;justify-content:space-between;display:flex;overflow:hidden;& img{max-width:100%}& .chapter-before,& .chapter-after,& .buttons:has(+.chapter-before){display:none}& #TOC{border:none;margin-left:auto;padding:0;&:not(.chapter-toc):is(.fragment-first,:not(.pagesjs-fragmented)):before{content:"Contents";margin-bottom:1em;font-size:1.5em;font-weight:700;display:block}& a{display:flex;&:after{content:attr(data-page-number);align-self:end;margin-left:1ch}& .section-number{margin-right:.3em}& .toc-text{flex:1 0;position:relative;overflow:hidden;&:after{content:"";border-bottom:1px dashed;width:100%;margin-left:1ch;position:absolute;bottom:1.5ex}}}}& .pagesjs-wrap{box-shadow:none!important;float:none!important;background:0 0!important;border:none!important;width:auto!important;max-width:none!important;height:auto!important;min-height:0!important;margin:0!important;padding:0!important;display:block!important;position:static!important;transform:none!important}& .pagesjs-run{display:block}& .pagesjs-fragmented{&:not(.fragment-first){border-top:none;margin-top:0;padding-top:0;&>thead{opacity:.5}}&:not(.fragment-last){border-bottom:none;margin-bottom:0;padding-bottom:0;&>tfoot{opacity:.5}}}& li.pagesjs-fragmented:not(.fragment-first)::marker{content:""}& .fullwidth{float:none;max-width:none;width:var(--paper-width);margin-left:calc(0px - var(--paper-margin-left));transform:none}& .footnotes{margin-top:1.5em}& .footnotes:before{content:"";border-top:1px solid;max-width:20em;display:block}&:has(.side-left,.embed-left) .pagesjs-body{padding-left:calc(0px - var(--side-margin));& .fullwidth{transform:translate(var(--side-margin))}}&:has(.side-right,.embed-right) .pagesjs-body{padding-right:calc(0px - var(--side-margin))}& .side{background:0 0;font-size:.9em}}}.pagesjs>.pagesjs-progress{z-index:9999;color:#fff;background:#000000bf;border-radius:1em;padding:.3em .8em;font:14px sans-serif;display:block;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.pagesjs-settle .pagesjs-body{padding:0!important}.pagesjs-header,.pagesjs-footer{justify-content:space-between;font-size:.9em;display:flex}.pagesjs-header{flex:0 0 var(--page-header-height);margin-bottom:var(--page-header-bottom);align-items:end;&:before{content:attr(data-main-title)}&:after{content:attr(data-page-title)}}.pagesjs-footer{flex:0 0 var(--page-footer-height);margin-top:var(--page-footer-top);align-items:start;&:before{content:attr(data-page-url)}&:after{content:attr(data-page-number)}}.pagesjs-body{flex-grow:1;min-height:0;position:relative}@media only screen{.pagesjs{background:#f7f7f7;& .pagesjs-page{background:#fff}& .page-multiple{overflow-y:auto}}.pagesjs-filling{display:block;& .pagesjs-page{opacity:0;height:auto}}}@media print{.pagesjs{gap:0;margin:0;& .page-multiple{height:auto;padding-top:0;padding-bottom:0}}}
2
2
  /*# sourceMappingURL=pages.min.css.map */
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,0PAYA,2DAIA,2FAIA,6BAGA,wGAQE,6DAIA,sFAGA,oRASE,qBAGA,iFAGA,8CAIE,4JAOA,iBAEE,sEAKA,oCAGA,uDAIE,yGAaN,2TAeA,6BAIA,sBACE,kEAIE,oBAEF,0EAIE,qBAIJ,gEAGA,gIAOA,8BAGA,iFAMA,wFAEE,sDAIF,2FAGA,wCAMJ,8MAaA,kDAIA,0FAKA,2GAIE,uCAGA,uCAIF,uGAIE,qBAGA,wCAIF,yDAKA,mBACE,SACE,wCAGA,gCAGA,kCAIF,+BAEE,sCAGE,kDAEE,uCAQR,aACE,wBAGE","sources":["pages.css"],"sourcesContent":[":root {\n --paper-width: 210mm;\n --paper-height: 297mm;\n --paper-margin-top: 40px;\n --paper-margin-right: 80px;\n --paper-margin-bottom: 40px;\n --paper-margin-left: 80px;\n --page-header-height: 40px;\n --page-header-bottom: 40px;\n --page-footer-height: 40px;\n --page-footer-top: 40px;\n}\n@page {\n size: var(--paper-width) var(--paper-height);\n margin: 0;\n}\n@page multiple {\n margin-top: var(--paper-margin-top);\n margin-bottom: var(--paper-margin-bottom);\n}\n.page-multiple {\n page: multiple;\n}\n.pagesjs {\n padding: 0;\n max-width: 100%;\n margin: 5mm;\n display: flex;\n justify-content: center;\n flex-wrap: wrap;\n gap: 5mm;\n .pagesjs-front, .chapter {\n min-height: unset;\n box-shadow: none;\n }\n & > *, &:not(:has(.pagesjs-front)):has(.chapter-toc) #TOC:not(.chapter-toc) {\n display: none;\n }\n .pagesjs-page {\n width: var(--paper-width);\n height: var(--paper-height);\n padding: var(--paper-margin-top) var(--paper-margin-right) var(--paper-margin-bottom) var(--paper-margin-left);\n break-after: page;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow: hidden;\n img {\n max-width: 100%;\n }\n .chapter-before, .chapter-after, .buttons:has(+ .chapter-before) {\n display: none;\n }\n #TOC {\n border: none;\n padding: 0;\n margin-left: auto;\n &:not(.chapter-toc):is(.fragment-first, :not(.pagesjs-fragmented))::before {\n content: \"Contents\";\n display: block;\n font-weight: bold;\n font-size: 1.5em;\n margin-bottom: 1em;\n }\n a {\n display: flex;\n &::after {\n content: attr(data-page-number);\n align-self: end;\n margin-left: 1ch;\n }\n .section-number {\n margin-right: .3em;\n }\n .toc-text {\n position: relative;\n flex: 1 0;\n overflow: hidden;\n &::after {\n content: \"\";\n width: 100%;\n position: absolute;\n bottom: 1.5ex;\n margin-left: 1ch;\n border-bottom: dashed 1px;\n }\n }\n }\n }\n /* wrappers cloned from the content root and its ancestors: keep their\n context for CSS selectors, but not their boxes */\n .pagesjs-wrap {\n display: block !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n box-shadow: none !important;\n background: none !important;\n width: auto !important;\n max-width: none !important;\n min-height: 0 !important;\n height: auto !important;\n float: none !important;\n position: static !important;\n transform: none !important;\n }\n .pagesjs-run {\n display: block;\n }\n /* pieces of a fragmented element: slice it (instead of decorating each piece) */\n .pagesjs-fragmented {\n &:not(.fragment-first) {\n border-top: none;\n margin-top: 0;\n padding-top: 0;\n & > thead { opacity: .5; }\n }\n &:not(.fragment-last) {\n border-bottom: none;\n margin-bottom: 0;\n padding-bottom: 0;\n & > tfoot { opacity: .5; }\n }\n }\n /* a list item continued from the previous page has no marker */\n li.pagesjs-fragmented:not(.fragment-first)::marker {\n content: \"\";\n }\n .fullwidth {\n float: none;\n max-width: none;\n width: var(--paper-width);\n margin-left: calc(0px - var(--paper-margin-left));\n transform: none;\n }\n .footnotes {\n margin-top: 1.5em;\n }\n .footnotes::before {\n content: \"\";\n display: block;\n max-width: 20em;\n border-top: solid 1px;\n }\n &:has(.side-left, .embed-left) .pagesjs-body {\n padding-left: calc(0px - var(--side-margin));\n .fullwidth {\n transform: translate(var(--side-margin));\n }\n }\n &:has(.side-right, .embed-right) .pagesjs-body {\n padding-right: calc(0px - var(--side-margin));\n }\n .side {\n font-size: .9em;\n background: none;\n }\n }\n}\n.pagesjs > .pagesjs-progress {\n display: block;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999;\n padding: .3em .8em;\n border-radius: 1em;\n background: rgba(0, 0, 0, .75);\n color: white;\n font: 14px sans-serif;\n}\n.pagesjs-settle .pagesjs-body {\n /* the probe page that holds all content has sides, but normal pages don't */\n padding: 0 !important;\n}\n.pagesjs-header, .pagesjs-footer {\n font-size: .9em;\n display: flex;\n justify-content: space-between;\n}\n.pagesjs-header {\n flex: 0 0 var(--page-header-height);\n margin-bottom: var(--page-header-bottom);\n align-items: end;\n &::before {\n content: attr(data-main-title);\n }\n &::after {\n content: attr(data-page-title);\n }\n}\n.pagesjs-footer {\n flex: 0 0 var(--page-footer-height);\n margin-top: var(--page-footer-top);\n align-items: start;\n &::before {\n content: \" \";\n }\n &::after {\n content: attr(data-page-number);\n }\n}\n.pagesjs-body {\n flex-grow: 1;\n min-height: 0; /* don't let the body push the footer down when content overhangs by a few pixels */\n position: relative;\n}\n@media only screen {\n .pagesjs {\n &:has(.pagesjs-page) {\n background: #f7f7f7;\n }\n .pagesjs-page {\n background: white;\n }\n .page-multiple {\n overflow-y: auto;\n }\n }\n .pagesjs-filling {\n display: block;\n .pagesjs-page {\n opacity: 0; /* don't show the page that is being filled (only the progress) */\n height: auto;\n .pagesjs-body:has(.footnotes) {\n margin-bottom: 1em;\n .footnotes {\n float: left;\n width: 100%;\n }\n }\n }\n }\n}\n@media print {\n .pagesjs {\n margin: 0;\n gap: 0;\n .page-multiple {\n padding-top: 0;\n padding-bottom: 0;\n height: auto;\n }\n }\n}\n"],"names":[]}
1
+ {"version":3,"mappings":"AAAA,0PAYA,2DAIA,2FAIA,6BAGA,wGAQE,6DAIA,sFAGA,oRASE,qBAGA,iFAGA,8CAIE,4JAOA,iBAEE,sEAKA,oCAGA,uDAIE,yGAaN,2TAeA,6BAIA,sBACE,kEAIE,oBAEF,0EAIE,qBAIJ,gEAGA,gIAOA,8BAGA,iFAMA,wFAEE,sDAIF,2FAGA,wCAMJ,8MAaA,kDAIA,0FAKA,2GAIE,uCAGA,uCAIF,uGAIE,qCAGA,wCAIF,yDAKA,mBACE,4BAEE,gCAGA,kCAIF,+BAEE,wCAMJ,aACE,wBAGE","sources":["pages.css"],"sourcesContent":[":root {\n --paper-width: 210mm;\n --paper-height: 297mm;\n --paper-margin-top: 40px;\n --paper-margin-right: 80px;\n --paper-margin-bottom: 40px;\n --paper-margin-left: 80px;\n --page-header-height: 40px;\n --page-header-bottom: 40px;\n --page-footer-height: 40px;\n --page-footer-top: 40px;\n}\n@page {\n size: var(--paper-width) var(--paper-height);\n margin: 0;\n}\n@page multiple {\n margin-top: var(--paper-margin-top);\n margin-bottom: var(--paper-margin-bottom);\n}\n.page-multiple {\n page: multiple;\n}\n.pagesjs {\n padding: 0;\n max-width: 100%;\n margin: 5mm;\n display: flex;\n justify-content: center;\n flex-wrap: wrap;\n gap: 5mm;\n .pagesjs-front, .chapter {\n min-height: unset;\n box-shadow: none;\n }\n & > *, &:not(:has(.pagesjs-front)):has(.chapter-toc) #TOC:not(.chapter-toc) {\n display: none;\n }\n .pagesjs-page {\n width: var(--paper-width);\n height: var(--paper-height);\n padding: var(--paper-margin-top) var(--paper-margin-right) var(--paper-margin-bottom) var(--paper-margin-left);\n break-after: page;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow: hidden;\n img {\n max-width: 100%;\n }\n .chapter-before, .chapter-after, .buttons:has(+ .chapter-before) {\n display: none;\n }\n #TOC {\n border: none;\n padding: 0;\n margin-left: auto;\n &:not(.chapter-toc):is(.fragment-first, :not(.pagesjs-fragmented))::before {\n content: \"Contents\";\n display: block;\n font-weight: bold;\n font-size: 1.5em;\n margin-bottom: 1em;\n }\n a {\n display: flex;\n &::after {\n content: attr(data-page-number);\n align-self: end;\n margin-left: 1ch;\n }\n .section-number {\n margin-right: .3em;\n }\n .toc-text {\n position: relative;\n flex: 1 0;\n overflow: hidden;\n &::after {\n content: \"\";\n width: 100%;\n position: absolute;\n bottom: 1.5ex;\n margin-left: 1ch;\n border-bottom: dashed 1px;\n }\n }\n }\n }\n /* wrappers cloned from the content root and its ancestors: keep their\n context for CSS selectors, but not their boxes */\n .pagesjs-wrap {\n display: block !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n box-shadow: none !important;\n background: none !important;\n width: auto !important;\n max-width: none !important;\n min-height: 0 !important;\n height: auto !important;\n float: none !important;\n position: static !important;\n transform: none !important;\n }\n .pagesjs-run {\n display: block;\n }\n /* pieces of a fragmented element: slice it (instead of decorating each piece) */\n .pagesjs-fragmented {\n &:not(.fragment-first) {\n border-top: none;\n margin-top: 0;\n padding-top: 0;\n & > thead { opacity: .5; }\n }\n &:not(.fragment-last) {\n border-bottom: none;\n margin-bottom: 0;\n padding-bottom: 0;\n & > tfoot { opacity: .5; }\n }\n }\n /* a list item continued from the previous page has no marker */\n li.pagesjs-fragmented:not(.fragment-first)::marker {\n content: \"\";\n }\n .fullwidth {\n float: none;\n max-width: none;\n width: var(--paper-width);\n margin-left: calc(0px - var(--paper-margin-left));\n transform: none;\n }\n .footnotes {\n margin-top: 1.5em;\n }\n .footnotes::before {\n content: \"\";\n display: block;\n max-width: 20em;\n border-top: solid 1px;\n }\n &:has(.side-left, .embed-left) .pagesjs-body {\n padding-left: calc(0px - var(--side-margin));\n .fullwidth {\n transform: translate(var(--side-margin));\n }\n }\n &:has(.side-right, .embed-right) .pagesjs-body {\n padding-right: calc(0px - var(--side-margin));\n }\n .side {\n font-size: .9em;\n background: none;\n }\n }\n}\n.pagesjs > .pagesjs-progress {\n display: block;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999;\n padding: .3em .8em;\n border-radius: 1em;\n background: rgba(0, 0, 0, .75);\n color: white;\n font: 14px sans-serif;\n}\n.pagesjs-settle .pagesjs-body {\n /* the probe page that holds all content has sides, but normal pages don't */\n padding: 0 !important;\n}\n.pagesjs-header, .pagesjs-footer {\n font-size: .9em;\n display: flex;\n justify-content: space-between;\n}\n.pagesjs-header {\n flex: 0 0 var(--page-header-height);\n margin-bottom: var(--page-header-bottom);\n align-items: end;\n &::before {\n content: attr(data-main-title);\n }\n &::after {\n content: attr(data-page-title);\n }\n}\n.pagesjs-footer {\n flex: 0 0 var(--page-footer-height);\n margin-top: var(--page-footer-top);\n align-items: start;\n &::before {\n content: attr(data-page-url);\n }\n &::after {\n content: attr(data-page-number);\n }\n}\n.pagesjs-body {\n flex-grow: 1;\n min-height: 0; /* don't let the body push the footer down when content overhangs by a few pixels */\n position: relative;\n}\n@media only screen {\n .pagesjs {\n background: #f7f7f7;\n .pagesjs-page {\n background: white;\n }\n .page-multiple {\n overflow-y: auto;\n }\n }\n .pagesjs-filling {\n display: block;\n .pagesjs-page {\n opacity: 0; /* don't show the page that is being filled (only the progress) */\n height: auto;\n }\n }\n}\n@media print {\n .pagesjs {\n margin: 0;\n gap: 0;\n .page-multiple {\n padding-top: 0;\n padding-bottom: 0;\n height: auto;\n }\n }\n}\n"],"names":[]}
package/js/pages.js CHANGED
@@ -2,20 +2,25 @@
2
2
  // each box holds as much content as possible without exceeding the page height.
3
3
  //
4
4
  // How it works:
5
- // 1. The content root (e.g., <main>) is emptied, and its children are put on
6
- // pages one by one (fill() -> place()). Only the current page is in the DOM, so
7
- // measuring it is cheap (box.scrollHeight > H means the page overflows).
8
- // 2. When an element makes the page overflow, split() puts as much of it as
5
+ // 1. The content root (e.g., <main>) is emptied, and all its content is laid out
6
+ // once on a probe page (probe()), so that content that reacts to the page width
7
+ // settles and the positions of the blocks are known.
8
+ // 2. The children are put on pages one by one (fill() -> place()). Only the current
9
+ // page is in the DOM, so measuring it is cheap (box.scrollHeight > H means the
10
+ // page overflows), but each measurement is a forced layout; so children that
11
+ // surely fit, according to their positions on the probe page, are put on a page
12
+ // together and measured once (fitting()).
13
+ // 3. When an element makes the page overflow, split() puts as much of it as
9
14
  // possible on the current page and returns the rest, which goes to the next
10
15
  // page. An element can be broken in different ways (kindOf()): block elements
11
16
  // (e.g., lists and quotes) are cloned and their children are moved into the
12
- // clone one by one, with the child that overflows broken recursively; text,
17
+ // clone as in step 2, with the child that overflows broken recursively; text,
13
18
  // table rows, and code lines are broken by lines/rows. Every piece of a broken
14
19
  // element has the classes pagesjs-fragmented, fragment-first, fragment-last
15
20
  // (the pieces can be styled differently in pages.css).
16
- // 3. Each page contains empty copies of the ancestors of the content root, so
21
+ // 4. Each page contains empty copies of the ancestors of the content root, so
17
22
  // CSS selectors that depend on them still work (see ctx()).
18
- // 4. In the end, page numbers and titles are added to the headers/footers.
23
+ // 5. In the end, page numbers and titles are added to the headers/footers.
19
24
  (d => {
20
25
 
21
26
  // --- Utilities -----------------------------------------------------
@@ -23,13 +28,30 @@
23
28
  function $(s, el = d) { return el?.querySelector(s); }
24
29
  function $$(s, el = d) { return el ? el.querySelectorAll(s) : []; }
25
30
  function nChild(el) { return el.childElementCount; }
31
+ function kids(el) { return [...el.children]; }
32
+ function firstEl(el) { return el.firstElementChild; }
33
+ function lastEl(el) { return el.lastElementChild; }
34
+ function rect(el) { return el.getBoundingClientRect(); }
35
+ function style(el) { return getComputedStyle(el); }
36
+ function num(v) { return parseFloat(v) || 0; }
37
+ function has(el, c) { return el.classList.contains(c); }
38
+ function addCls(el, ...c) { el.classList.add(...c); }
39
+ function rmCls(el, ...c) { el.classList.remove(...c); }
40
+ function make(tag, cls) {
41
+ const el = d.createElement(tag);
42
+ if (cls) el.className = cls;
43
+ return el;
44
+ }
45
+ function range() { return d.createRange(); }
46
+ function on(type, fn) { addEventListener(type, fn); }
47
+ function fire(type) { dispatchEvent(new Event(type)); }
26
48
 
27
49
  // --- Constants and state -------------------------------------------
28
50
 
29
51
  const
30
52
  book = $$('h1').length > 1, // a document with multiple <h1> is a book (chapters)
31
53
  // elements that are never broken across pages (CSS break-inside: avoid also works)
32
- atomic = 'h1,h2,h3,h4,h5,h6,hr,img,svg,video,canvas,iframe,object,embed,math,mjx-container,figure,.figure,details',
54
+ atomic = 'h1,h2,h3,h4,h5,h6,hr,img,svg,video,canvas,iframe,object,embed,math,mjx-container,figure,.figure,.caption,details',
33
55
  // classes of the pieces of a broken element
34
56
  fr_cls = 'pagesjs-fragmented', fr_1 = 'fragment-first', fr_2 = 'fragment-last',
35
57
  // pixels that the content may hang over the bottom of a page (the page has a
@@ -37,14 +59,16 @@
37
59
  tol = 3,
38
60
  // top/bottom page margin
39
61
  tb = ['top', 'bottom'].map(i =>
40
- parseFloat(getComputedStyle(d.documentElement).getPropertyValue(`--paper-margin-${i}`)) || 0
62
+ num(style(d.documentElement).getPropertyValue(`--paper-margin-${i}`))
41
63
  ),
42
64
  // the template of a page
43
- tpl = d.createElement('div'),
65
+ tpl = make('div', 'pagesjs-page'),
44
66
  boxes = [], // all pages
45
67
  wrapped = new WeakSet(), // elements whose runs of inline nodes have been wrapped
46
- hold = d.createElement('div'); // a hidden container for elements that need styles
47
- tpl.className = 'pagesjs-page';
68
+ guessed = new WeakSet(), // pages whose number of physical pages is an estimate (see calcPages())
69
+ notes = new Map(), // the items of each note (footnote or citation), by its marker (see detachNotes())
70
+ probeY = new WeakMap(), // the bottoms of the blocks on the probe page (see fitting())
71
+ hold = make('div'); // a hidden container for elements that need styles
48
72
  tpl.innerHTML = `<div class="pagesjs-header"></div>
49
73
  <div class="pagesjs-body"></div>
50
74
  <div class="pagesjs-footer"></div>`;
@@ -55,7 +79,8 @@
55
79
  box_ctx, // where the content goes in the body (see ctx())
56
80
  wrap = [], // the ancestors of the content root (outermost first)
57
81
  H, B, // the height of a page and of its body
58
- H_min, // the height of a single-line paragraph
82
+ H_min, H_line, // the height of a single-line paragraph (with margins) and of a line
83
+ used, // the height of the content of the page when it was last measured (see overflows())
59
84
  main_title, // the title of the document
60
85
  probed, // the content that is on the probe page (see probe())
61
86
  pending, // the rest of the pagination, which is waiting for the probe
@@ -77,32 +102,58 @@
77
102
  // descendants, until one with padding/border at the bottom.
78
103
  function trailingMargin(body = box_body) {
79
104
  let m = 0;
80
- for (let e = body.lastElementChild; e; e = e.lastElementChild) {
81
- const cs = getComputedStyle(e);
82
- m = Math.max(m, parseFloat(cs.marginBottom) || 0);
83
- if (parseFloat(cs.paddingBottom) || parseFloat(cs.borderBottomWidth)) break;
105
+ for (let e = lastEl(body); e; e = lastEl(e)) {
106
+ const cs = style(e);
107
+ m = Math.max(m, num(cs.marginBottom));
108
+ if (num(cs.paddingBottom) || num(cs.borderBottomWidth)) break;
84
109
  }
85
110
  return m;
86
111
  }
87
112
  // the height of the page without the margin at the end of its content
88
- function pageHeight() { return box.getBoundingClientRect().height - trailingMargin(); }
113
+ function pageHeight() { syncNotes(); return rect(box).height - trailingMargin(); }
89
114
  // does the page overflow?
90
- function overflows() { return box.scrollHeight - trailingMargin() > H; }
115
+ function overflows() { syncNotes(); return (used = box.scrollHeight - trailingMargin()) > H; }
116
+ // The notes are not measured inline (where they are floats next to their references),
117
+ // but in a block after the page body, as in the end: put the notes of the references
118
+ // that are on the page there (and take the others off).
119
+ function syncNotes(b = box) {
120
+ const body = b.children[1], ms = [...$$('.pagesjs-note', body)], items = ms.flatMap(m => notes.get(m));
121
+ let c = $(':scope > .footnotes', b);
122
+ if (!items.length) return c?.remove();
123
+ c || body.after(c = make('div'));
124
+ c.className = 'footnotes';
125
+ if (items.some((e, i) => c.children[i] !== e) || nChild(c) !== items.length) c.replaceChildren(...items);
126
+ }
91
127
  // start the next page and finish current page
92
128
  function nextPage(el, callback) {
93
129
  const cur = box; cur.after(newPage(el)); callback && callback(); finish(cur);
94
130
  }
95
131
  // compute page numbers and temporarily remove the box
96
132
  function finish(box) {
133
+ syncNotes(box);
97
134
  const h = box.scrollHeight;
98
135
  // tolerate a few pixels (and the margin of the last element) hanging over the page bottom
99
136
  if (h - trailingMargin(box.children[1]) > H && !box.dataset.pagesOffset) {
100
137
  const n = calcPages(box, h);
101
- if (n > 1) box.dataset.pagesOffset = n;
138
+ if (n > 1) box.dataset.pagesOffset = n, guessed.add(box);
102
139
  }
103
140
  box.remove();
104
141
  progress && (progress.textContent = `Paginating: ${++n_done} pages done`);
105
142
  }
143
+ // The height of a page in fill mode is its natural height, which includes spaces that
144
+ // are not needed in the end (e.g., the margins of the last element), so a page that is a
145
+ // few pixels too tall may be fine with its fixed height. Check the pages in the end:
146
+ // if the content doesn't reach the notes/footer after the body and nothing hangs over
147
+ // the paper, the estimated number of pages is wrong.
148
+ function checkOffsets() {
149
+ boxes.forEach(box => {
150
+ if (!guessed.has(box)) return;
151
+ const body = box.children[1], r = range();
152
+ r.selectNodeContents(body);
153
+ if (rect(r).bottom <= rect(body.nextElementSibling).top &&
154
+ box.scrollHeight <= box.clientHeight + 1) delete box.dataset.pagesOffset;
155
+ });
156
+ }
106
157
  // calculate how many new pages we need for overflowed content (this is just
107
158
  // an estimate; if not accurate, use <div class="pagesjs-page" data-pages-offset="N">
108
159
  // to provide a number manually)
@@ -135,7 +186,7 @@
135
186
  if (!wrap.length) return box_body;
136
187
  if (!box_ctx || !box_body.contains(box_ctx)) {
137
188
  box_ctx = wrap.reduce((p, el) => {
138
- const c = el.cloneNode(); c.classList.add('pagesjs-wrap');
189
+ const c = el.cloneNode(); addCls(c, 'pagesjs-wrap');
139
190
  return p.appendChild(c);
140
191
  }, box_body);
141
192
  }
@@ -153,17 +204,17 @@
153
204
 
154
205
  function* fill(el, more = true) {
155
206
  // if the element is already a page, just use it as the box
156
- if (el.classList.contains('pagesjs-page')) {
207
+ if (has(el, 'pagesjs-page')) {
157
208
  nextPage(el, () => nChild(el) > 3 && (
158
209
  // if current element is not empty, fill its content into the box
159
- box_body.append(...[...el.children].slice(3)),
210
+ box_body.append(...kids(el).slice(3)),
160
211
  // TODO: should we fragment this page if it's too long?
161
212
  nextPage() // create a new empty page
162
213
  ));
163
214
  } else {
164
215
  // in a book, a chapter (a container of <h1>) starts on a new page
165
216
  if (book && box.innerText !== '' && $('h1', el)) nextPage();
166
- if (el.innerText.trim() && H - box.scrollHeight < H_min) nextPage();
217
+ if (el.innerText.trim() && (syncNotes(), H - box.scrollHeight < H_min)) nextPage();
167
218
  yield* place(el, more);
168
219
  }
169
220
  }
@@ -196,14 +247,16 @@
196
247
  function split(el, container, kind, more) {
197
248
  // (for a block, prev is determined after it is cut, to avoid laying it out)
198
249
  const k = kind || kindOf(el), prev = k === 'block' ? undefined : hasPrev(el),
199
- first = !el.classList.contains(fr_cls), r = k && splitters[k](el, container, prev, first, more);
250
+ first = !has(el, fr_cls), r = k && splitters[k](el, container, prev, first, more);
200
251
  if (!r) return prev && (el.remove(), el);
201
252
  const [head, rest] = r;
202
253
  if (blank(head)) return head.remove(), rest; // nothing fits
203
254
  if (rest) {
204
- rest.classList.add(fr_cls); rest.classList.remove(fr_1, fr_2);
255
+ addCls(rest, fr_cls); rmCls(rest, fr_1, fr_2);
256
+ } else if (has(head, fr_1)) {
257
+ rmCls(head, fr_cls, fr_1, fr_2); // it's not really split
205
258
  } else {
206
- head.classList.add(fr_2); // the last piece (also the first if it's not really split)
259
+ addCls(head, fr_2); // the last piece
207
260
  }
208
261
  return rest;
209
262
  }
@@ -212,12 +265,12 @@
212
265
  function isBigBlock(el) {
213
266
  return !['TABLE', 'PRE'].includes(el.tagName) && el.getElementsByTagName('*').length > 300;
214
267
  }
215
- function blank(el) { return !el.firstElementChild && !el.textContent.trim(); }
268
+ function blank(el) { return !firstEl(el) && !el.textContent.trim(); }
216
269
  // is there anything above el on the page (which means el may go to the next page)?
217
270
  function hasPrev(el) {
218
271
  for (; el && el !== box_body; el = el.parentNode)
219
272
  for (let p = el.previousElementSibling; p; p = p.previousElementSibling)
220
- if (p.getBoundingClientRect().height) return true;
273
+ if (rect(p).height) return true;
221
274
  return false;
222
275
  }
223
276
  function inFlow(cs) {
@@ -226,19 +279,19 @@
226
279
  // text, inline elements, and out-of-flow elements go with the text around them
227
280
  function isInline(n) {
228
281
  if (n.nodeType !== 1) return true;
229
- const cs = getComputedStyle(n), v = cs.display;
282
+ const cs = style(n), v = cs.display;
230
283
  return v.startsWith('inline') || v === 'none' || v === 'contents' || !inFlow(cs);
231
284
  }
232
285
  // is an element a part of the text (inline, and not a float, etc.)?
233
286
  function inTextFlow(el) {
234
- const cs = getComputedStyle(el);
287
+ const cs = style(el);
235
288
  return (cs.display.startsWith('inline') || cs.display === 'contents') && inFlow(cs);
236
289
  }
237
290
  // lines of <pre><code>; tags open at the end of a line (e.g., a multi-line
238
291
  // comment) are closed there and reopened on the next line, so each line is balanced
239
292
  function codeLines(pre) {
240
293
  const open = [];
241
- return pre.firstElementChild.innerHTML.replace(/\n$/, '').split('\n').map(line => {
294
+ return firstEl(pre).innerHTML.replace(/\n$/, '').split('\n').map(line => {
242
295
  const start = open.map(t => t[0]).join('');
243
296
  line.replace(/<(\/?)([a-z][\w-]*)[^>]*>/gi, (m, c, t) => {
244
297
  c ? open.pop() : open.push([m, t]);
@@ -249,26 +302,26 @@
249
302
  // how can the element be broken: by 'block' (its child blocks), 'inline' (text
250
303
  // lines), 'table' (rows), 'code' (lines), or not at all (undefined)?
251
304
  function kindOf(el) {
252
- const cs = getComputedStyle(el), t = el.tagName;
305
+ const cs = style(el), t = el.tagName;
253
306
  if (/avoid/.test(cs.breakInside) || el.matches(atomic)) return;
254
307
  if (t === 'TABLE') return el.tBodies[0] && 'table';
255
308
  if (!['block', 'list-item', 'flow-root'].includes(cs.display) || !inFlow(cs)) return;
256
309
  if (t === 'PRE') {
257
- if (el.firstElementChild?.tagName === 'CODE' && codeLines(el).length > 1) return 'code';
310
+ if (firstEl(el)?.tagName === 'CODE' && codeLines(el).length > 1) return 'code';
258
311
  // wrapped long lines: move to the next page if it fits there, otherwise break by lines
259
312
  if (el.offsetHeight <= B) return;
260
313
  }
261
- return [...el.children].some(c => !isInline(c)) ? 'block' : 'inline';
314
+ return kids(el).some(c => !isInline(c)) ? 'block' : 'inline';
262
315
  }
263
316
  function mark(el, first) {
264
- el.classList.add(fr_cls); el.classList.remove(fr_2); first && el.classList.add(fr_1);
317
+ addCls(el, fr_cls); rmCls(el, fr_2); first && addCls(el, fr_1);
265
318
  }
266
319
  // pieces of a fragmented element that are put on a page as a whole are the last
267
320
  // pieces; mark them (and their fragmented descendants) before measuring, since
268
321
  // the size of the last piece is different (see pages.css); if it turns out to be
269
322
  // too big and is split, the mark is removed
270
323
  function endFrag(el) {
271
- if (el.nodeType === 1) [el, ...$$('.' + fr_cls, el)].forEach(e => e.classList.contains(fr_cls) && e.classList.add(fr_2));
324
+ if (el.nodeType === 1) [el, ...$$('.' + fr_cls, el)].forEach(e => has(e, fr_cls) && addCls(e, fr_2));
272
325
  }
273
326
  // shallow clone el (wrapper only) as the first piece of el in container
274
327
  function cut(el, container, first) {
@@ -280,15 +333,15 @@
280
333
  // so mixed content (e.g., <li>text<ul>...</ul></li>) can be broken as paragraphs
281
334
  function wrapRuns(el) {
282
335
  // (a run is made of inline nodes already; wrapping it again would nest runs endlessly)
283
- if (wrapped.has(el) || el.classList.contains('pagesjs-run')) return;
336
+ if (wrapped.has(el) || has(el, 'pagesjs-run')) return;
284
337
  wrapped.add(el);
285
338
  // computed styles are available only in the DOM (but not necessarily on a page)
286
339
  el.isConnected || hold.append(el);
287
340
  let run = [];
288
341
  function flush() {
289
342
  if (run.some(n => n.nodeType === 1 || n.nodeType === 3 && n.nodeValue.trim())) {
290
- const s = d.createElement('span');
291
- s.className = 'pagesjs-run'; run[0].before(s); s.append(...run);
343
+ const s = make('span', 'pagesjs-run');
344
+ run[0].before(s); s.append(...run);
292
345
  }
293
346
  run = [];
294
347
  }
@@ -301,6 +354,29 @@
301
354
 
302
355
  // --- Breaking elements ---------------------------------------------
303
356
 
357
+ // Measuring the page after each child is slow (a forced layout), so put several children
358
+ // on it at once when they surely fit: the nodes (in order) that end a line above the page
359
+ // bottom, going by their distances on the probe page from the last child on the page. If
360
+ // they turn out not to fit, they are taken back, so the estimate affects the speed but not
361
+ // the result. The children of the content root need the room that fill() asks for (H_min,
362
+ // and as much again for the margin after the previous child).
363
+ function fitting(head, nodes, root) {
364
+ const prev = lastEl(head), y0 = prev && !has(prev, fr_cls) ? probeY.get(prev) : undefined, run = [];
365
+ if (y0 === undefined || !used) return run;
366
+ let y = y0, n = 0;
367
+ for (const c of nodes) {
368
+ if (c.nodeType === 1) {
369
+ const y1 = probeY.get(c);
370
+ if (!(y1 >= y) || c.matches(`.${fr_cls}, .pagesjs-page`) || isBigBlock(c) || $('.pagesjs-note', c) ||
371
+ used + y1 - y0 + H_line > H || root && (used + y - y0 + 2 * H_min > H || book && $('h1', c))) break;
372
+ y = y1;
373
+ }
374
+ run.push(c);
375
+ c.nodeType === 1 && (n = run.length);
376
+ }
377
+ return run.slice(0, n);
378
+ }
379
+ function* siblings(n) { for (; n; n = n.nextSibling) yield n; }
304
380
  // move children to a clone of el one by one until the page is full, and split
305
381
  // the child that overflows recursively, so elements can be broken at any depth
306
382
  function splitBlock(el, container, prev, first, more) {
@@ -313,10 +389,15 @@
313
389
  endFrag(item);
314
390
  const big = isBigBlock(item);
315
391
  if (!big) {
316
- head.append(item);
392
+ const run = fitting(head, siblings(item));
393
+ run.length || run.push(item);
394
+ head.append(...run);
317
395
  if (!overflows()) continue;
396
+ // (the estimate was too optimistic) take back all but the first
397
+ if (run.length > 1 && (el.prepend(...run.slice(1)), !overflows())) continue;
318
398
  }
319
- const n = nChild(head), rest = split(item, head, big ? 'block' : undefined, more || !!el.firstElementChild);
399
+ const n = nChild(head), rest = split(item, head, big ? 'block' : undefined, more || !!firstEl(el));
400
+ used = null; // (the page has changed)
320
401
  if (rest) { partial = nChild(head) > n; el.prepend(rest); break; }
321
402
  }
322
403
  blank(el) && fitLastPiece(head, el, prev); // (may push children to el)
@@ -326,37 +407,53 @@
326
407
  return [head, blank(el) ? null : el];
327
408
  }
328
409
 
329
- // a legend (which is too tall for moveShortHead() when it's in a framed block)
330
- // should not be the last child of a piece that is continued, so move it (and
331
- // those before it) to the rest (el)
410
+ // a legend or a caption (which is too tall for moveShortHead() when it's in a framed
411
+ // block or above a table) should not be the last child of a piece that is continued,
412
+ // so move it (and those before it) to the rest (el)
332
413
  function moveTrailingHeadings(head, el, prev) {
333
- for (let h; (h = head.lastElementChild)?.matches('legend') && (nChild(head) > 1 || prev);)
414
+ for (let h; (h = lastEl(head))?.matches('legend, .caption') && (nChild(head) > 1 || prev);)
334
415
  el.prepend(h);
335
416
  }
336
417
  // if only about one line (e.g., a legend or the first list item) is left on the
337
418
  // page, and no child was split, move it to the next page with the rest (el)
338
419
  function moveShortHead(head, el) {
339
- if (!blank(el) && head.getBoundingClientRect().height < 1.5 * H_min)
420
+ if (!blank(el) && rect(head).height < 1.5 * H_line) {
421
+ rejoin(lastEl(head), firstEl(el));
340
422
  el.prepend(...head.childNodes);
423
+ }
424
+ }
425
+ // put back the piece a (at the end of the head) into its rest b (at the start of el),
426
+ // so they are one element again
427
+ function rejoin(a, b) {
428
+ if (!a || !b || !has(a, fr_cls) || !has(b, fr_cls) || a.tagName !== b.tagName) return;
429
+ rejoin(lastEl(a), firstEl(b));
430
+ b.prepend(...a.childNodes);
431
+ // (b is not marked as the last piece yet; if a was the first piece, they are the original element)
432
+ rmCls(b, ...has(a, fr_1) ? [fr_cls, fr_1, fr_2] : [fr_1]);
433
+ a.remove();
341
434
  }
342
435
  // If all children fit, head is the last piece, which has bottom margin/padding/
343
- // border that were hidden when it was measured as a non-last piece; push the
344
- // last children out (into el) if it is too big now.
436
+ // border that were hidden when it was measured as a non-last piece; if it is too
437
+ // big now, break the last child (or push it out entirely if it can't be broken).
345
438
  function fitLastPiece(head, el, prev) {
346
- head.classList.add(fr_2);
347
- while (overflows() && head.lastElementChild && (nChild(head) > 1 || prev))
348
- el.prepend(head.lastElementChild);
349
- blank(el) || head.classList.remove(fr_2);
439
+ addCls(head, fr_2);
440
+ while (overflows() && lastEl(head) && (nChild(head) > 1 || prev)) {
441
+ const last = lastEl(head), rest = split(last, head, undefined, true);
442
+ if (!rest) break;
443
+ el.prepend(rest);
444
+ if (rest !== last) break; // (a piece of the child is still on the page)
445
+ }
446
+ blank(el) || rmCls(head, fr_2);
350
447
  }
351
448
  // update the start number of the rest of <ol> (an item split in half counts once)
352
449
  function fixOlStart(head, el) {
353
- el.start += nChild(head) - (el.firstElementChild.classList.contains(fr_cls) ? 1 : 0);
450
+ el.start += nChild(head) - (has(firstEl(el), fr_cls) ? 1 : 0);
354
451
  }
355
452
  // split <p> by testing if a range fits the current box
356
453
  function splitInline(el, container, prev, first, more) {
357
454
  const ends = lineStarts(el);
358
455
  if (ends.length < 2) return; // single-line paragraph
359
- const r = d.createRange(), rest = el.cloneNode(), n = ends.length;
456
+ const r = range(), rest = el.cloneNode(), n = ends.length;
360
457
  let k = n; // number of lines left in el
361
458
  function cutLine() {
362
459
  const loc = ends[--k];
@@ -381,7 +478,7 @@
381
478
 
382
479
  // find the break position of each line (exclude block elements like footnotes)
383
480
  function lineStarts(el) {
384
- const r = d.createRange(), ends = [{node: el, i: 0}];
481
+ const r = range(), ends = [{node: el, i: 0}];
385
482
  const walker = d.createTreeWalker(el, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT);
386
483
  let node, prev;
387
484
  // if the previous rect is at top-right of current rect, assume a line ends
@@ -399,9 +496,9 @@
399
496
  if (node.firstChild) continue; // for element nodes, traverse to bottom
400
497
  }
401
498
  if (node.tagName) {
402
- const rect = node.getBoundingClientRect();
403
- newLine(rect) && ends.push({node, i: -1});
404
- prev = rect;
499
+ const rc = rect(node);
500
+ newLine(rc) && ends.push({node, i: -1});
501
+ prev = rc;
405
502
  } else if (node.textContent.trim()) {
406
503
  // a text node has one rect per line, and a new line starts at the first
407
504
  // character that makes the range of the text have one more rect
@@ -429,42 +526,45 @@
429
526
  function splitTable(el, container, prev, first) {
430
527
  const head = cut(el, container, first), tb = el.tBodies[0], tb2 = tb.cloneNode(),
431
528
  rows = [...tb.rows], n = rows.length, min = prev ? 0 : 1;
432
- head.append(tb2);
433
- // copy table header and footer
434
- [el.tHead, el.tFoot].forEach(t => t && head.append(t.cloneNode(true)));
529
+ // the caption (which is not broken) goes with the first rows, unless it is below the table
530
+ const cap = el.caption && style(el.caption).captionSide !== 'bottom' ? el.caption : null;
531
+ function clear() { cap && el.prepend(cap); head.innerHTML = ''; }
532
+ cap && head.append(cap);
533
+ // copy table header and footer (the header goes first, as in the original)
534
+ [el.tHead, tb2, el.tFoot].forEach(t => t && head.append(t === tb2 ? t : t.cloneNode(true)));
435
535
  // Put all rows in the page and lay them out once. The rows whose bottoms are
436
536
  // below (the bottom of the last row - the overflow) do not fit; put them back.
437
537
  tb2.append(...rows);
438
538
  const over = pageHeight() - H - .5; // (see fitLines())
439
539
  if (over >= 0) {
440
- const limit = rows[n - 1].getBoundingClientRect().bottom - over;
540
+ const limit = rect(rows[n - 1]).bottom - over;
441
541
  let lo = 0, hi = n; // the first row that is below the limit (by bisection)
442
542
  while (lo < hi) {
443
543
  const mid = (lo + hi) >> 1;
444
- rows[mid].getBoundingClientRect().bottom <= limit ? lo = mid + 1 : hi = mid;
544
+ rect(rows[mid]).bottom <= limit ? lo = mid + 1 : hi = mid;
445
545
  }
446
546
  let k = Math.max(lo, min);
447
547
  tb.prepend(...rows.slice(k));
448
548
  while (k > min && pageHeight() > H + .5) tb.prepend(rows[--k]); // make sure they fit
449
549
  }
450
550
  // clear the clone if current page can't fit even one row
451
- tb2.rows.length || (head.innerHTML = '');
551
+ tb2.rows.length || clear();
452
552
  // avoid a single row on either page
453
553
  const m = tb2.rows.length;
454
554
  if (tb.rows.length === 1 && m > 1 || m === 1 && prev && tb.rows.length) {
455
555
  tb.prepend(tb2.rows[m - 1]);
456
- if (m === 1) head.innerHTML = '';
556
+ if (m === 1) clear();
457
557
  }
458
558
  return [head, tb.rows.length ? el : null];
459
559
  }
460
560
  // split lines in <code> and move as many lines into the clone as possible
461
561
  function splitCode(el, container, prev, first) {
462
- const code = el.firstElementChild, lines = codeLines(el);
562
+ const code = firstEl(el), lines = codeLines(el);
463
563
  // other children go to the first piece, except those after <code> in the normal
464
564
  // flow (e.g., a link to the output), which go to the last piece
465
- const kids = [...el.children], tail = kids.filter((c, j) => j > kids.indexOf(code) && inFlow(getComputedStyle(c)));
565
+ const ch = kids(el), tail = ch.filter((c, j) => j > ch.indexOf(code) && inFlow(style(c)));
466
566
  const head = cut(el, container, first), code2 = code.cloneNode();
467
- head.append(code2, ...kids.filter(c => c !== code && !tail.includes(c)));
567
+ head.append(code2, ...ch.filter(c => c !== code && !tail.includes(c)));
468
568
  let i = fitLines(code2, lines, prev);
469
569
  // avoid a single line on either page
470
570
  if (i > 1 && lines.length - i === 1) i--;
@@ -487,12 +587,12 @@
487
587
  // (the page fits if its height is rounded to H or less, i.e., it is < H + .5)
488
588
  const over = pageHeight() - H - .5;
489
589
  if (over < 0) return n;
490
- const r = d.createRange(), bottoms = []; // the bottom of each line
590
+ const r = range(), bottoms = []; // the bottom of each line
491
591
  code.childNodes.forEach(node => {
492
592
  if (node.nodeType !== 3) return;
493
593
  for (let i = node.data.indexOf('\n'); i >= 0; i = node.data.indexOf('\n', i + 1)) {
494
594
  r.setStart(node, i); r.setEnd(node, i + 1);
495
- bottoms.push(r.getBoundingClientRect().bottom);
595
+ bottoms.push(rect(r).bottom);
496
596
  }
497
597
  });
498
598
  // the bottom of the last line (which has no line break), and the space after it
@@ -519,7 +619,7 @@
519
619
  // a ResizeObserver) settle at the page width before measuring anything: put all
520
620
  // content on a probe page and wait for a few frames.
521
621
  function probe(roots, els) {
522
- box.classList.add('pagesjs-settle');
622
+ addCls(box, 'pagesjs-settle');
523
623
  roots.forEach((el, i) => {
524
624
  wrap = ancestors(el); box_ctx = null; ctx().append(...els[i]);
525
625
  });
@@ -532,11 +632,17 @@
532
632
  })();
533
633
  });
534
634
  }
635
+ // record the bottoms of the blocks that may be children of a broken element
636
+ function markY(el) {
637
+ probeY.set(el, rect(el).bottom);
638
+ el.matches(`p, pre, table, ${atomic}`) || kids(el).forEach(markY);
639
+ }
535
640
  function unprobe() {
536
641
  if (!probed) return;
642
+ probed.forEach(ch => ch.forEach(markY)); // (before removing anything, to lay out only once)
537
643
  probed.forEach(ch => ch.forEach(el => el.remove()));
538
644
  box_body.innerHTML = ''; box_ctx = null; wrap = [];
539
- box.classList.remove('pagesjs-settle');
645
+ rmCls(box, 'pagesjs-settle');
540
646
  probed = null;
541
647
  }
542
648
 
@@ -550,42 +656,43 @@
550
656
  // add page number, title, etc. to data-* attributes of page elements
551
657
  function numberPages() {
552
658
  let page_title, i = 0;
659
+ const u = new URL(location.href); // page URL without ?paged=1, shown on the last page
660
+ u.searchParams.delete('paged');
553
661
  boxes.forEach(box => {
554
662
  if (book) {
555
663
  if ($('.pagesjs-front', box)) return; // skip book frontmatter page
556
664
  $(ps, box) && (page_title = ''); // empty title for first page of chapter
557
665
  }
558
666
  const N = +box.dataset.pagesOffset || 1;
559
- if (N > 1) box.classList.add('page-multiple');
667
+ if (N > 1) addCls(box, 'page-multiple');
560
668
  i += N;
561
- box.classList.add(`page-${i % 2 === 0 ? 'even' : 'odd'}`);
669
+ addCls(box, `page-${i % 2 === 0 ? 'even' : 'odd'}`);
562
670
  const info = {
563
- 'pageNumber': i, 'mainTitle': main_title, 'pageTitle': page_title
671
+ 'pageNumber': i, 'mainTitle': main_title, 'pageTitle': page_title,
672
+ 'pageUrl': box === boxes.at(-1) && u.href
564
673
  };
565
- [box.children[0], box.children[2]].forEach(el => {
674
+ [box.children[0], lastEl(box)].forEach(el => {
566
675
  for (const key in info) info[key] && (el.dataset[key] = info[key]);
567
676
  });
568
677
  // find page title for next page
569
678
  page_title = shortTitle([...$$(ps, box)].pop()) || page_title;
570
- let ft; // first footnote on page
571
- // move all footnotes after the page body
572
- $$('.footnotes', box).forEach((el, i) => {
573
- i === 0 ? (ft = el, box.children[1].after(el)) : (ft.append(...el.children), el.remove());
574
- });
575
679
  });
576
680
  }
577
681
 
578
682
  // add page numbers to TOC with data-* attributes
579
683
  function numberToc() {
580
684
  $$('#TOC a[href^="#"]').forEach(a => {
581
- const id = CSS.escape(a.getAttribute('href').replace(/^#/, '')),
582
- p = $(`.pagesjs-page:has(#${id}) .pagesjs-header`);
583
- a.dataset.pageNumber = p ? p.dataset.pageNumber : '';
685
+ const p = d.getElementById(a.getAttribute('href').slice(1))?.closest('.pagesjs-page');
686
+ a.dataset.pageNumber = p?.children[0].dataset.pageNumber ?? '';
584
687
  });
585
688
  }
586
689
 
587
690
  // --- Pagination ----------------------------------------------------
588
691
 
692
+ function ownText(el) {
693
+ return [...el.childNodes].some(n => n.nodeType === 3 && n.nodeValue.trim());
694
+ }
695
+ function canBeRoot(el) { return !['PRE', 'TABLE'].includes(el.tagName) && !ownText(el); }
589
696
  // The content root is specified via <body data-pages-root="selector">, or is
590
697
  // <main> (or an element with role="main"), or the top-level <article> elements,
591
698
  // or <body>. If <main> only has a child (e.g., <article>), the child is the root
@@ -595,7 +702,9 @@ i === 0 ? (ft = el, box.children[1].after(el)) : (ft.append(...el.children), el.
595
702
  if (x.length) return x;
596
703
  let main = $('main, [role="main"]');
597
704
  // if it only contains a wrapper (e.g., an <article>), use the wrapper instead
598
- while (main?.childElementCount === 1) main = main.firstElementChild;
705
+ // (but not an element that is broken by its own, or has text, which would be lost)
706
+ while (main && nChild(main) === 1 && !ownText(main) && canBeRoot(firstEl(main)))
707
+ main = firstEl(main);
599
708
  if (main) return [main];
600
709
  const articles = [...$$('article')].filter(el => !el.parentNode.closest('article'));
601
710
  return articles.length ? articles : [d.body];
@@ -604,29 +713,40 @@ i === 0 ? (ft = el, box.children[1].after(el)) : (ft.append(...el.children), el.
604
713
  // <body>) by default, or specified via <body data-pages-front="selector">; it is
605
714
  // put on its own page in a book.
606
715
  function markFrontmatter() {
607
- $$(d.body.dataset.pagesFront || 'body > header').forEach(el => el.classList.add('pagesjs-front'));
716
+ $$(d.body.dataset.pagesFront || 'body > header').forEach(el => addCls(el, 'pagesjs-front'));
608
717
  }
609
718
  // remove the classes of the TOC, footnotes, etc. that put them in the margin on
610
719
  // screen but are not suitable for printing
611
720
  function removeSideClasses() {
612
721
  $$(':is(#TOC, .footnotes, .chapter-before, .chapter-after):is(.side-left, .side-right).side').forEach(el => {
613
- el.classList.remove('side', 'side-left', 'side-right');
722
+ rmCls(el, 'side', 'side-left', 'side-right');
723
+ });
724
+ }
725
+ // Replace the notes (footnotes and citations that sidenotes.js has put after their
726
+ // references) with markers, which go with the references when the text is broken.
727
+ function detachNotes() {
728
+ $$('.footnotes').forEach(el => {
729
+ const p = el.previousElementSibling;
730
+ if (!p || !has(p, 'note-ref')) return;
731
+ const m = make('span', 'pagesjs-note');
732
+ m.hidden = true;
733
+ notes.set(m, kids(el)); el.replaceWith(m);
614
734
  });
615
735
  }
616
736
  // test how much space a single-line paragraph needs
617
737
  function measureMinHeight() {
618
- const p = d.createElement('p'), H0 = box.scrollHeight;
738
+ const p = make('p'), H0 = box.scrollHeight;
619
739
  p.innerText = 'A'; box_body.append(p);
620
- H_min = box.scrollHeight - H0; p.remove();
740
+ H_min = box.scrollHeight - H0; H_line = rect(p).height; p.remove();
621
741
  }
622
742
  // add dot leaders to TOC (page numbers will be added after the pages are ready)
623
743
  function addTocLeaders() {
624
744
  $$('#TOC a[href^="#"]').forEach(a => {
625
- const s = d.createElement('span'); // move TOC item content into a span
626
- s.className = 'toc-text'; a.append(s);
745
+ const s = make('span', 'toc-text'); // move TOC item content into a span
746
+ a.append(s);
627
747
  let c; while (c = s.previousSibling) {
628
748
  // exclude section number spans
629
- if (c.classList?.contains('section-number')) break; s.prepend(c);
749
+ if (c.nodeType === 1 && has(c, 'section-number')) break; s.prepend(c);
630
750
  }
631
751
  a.dataset.pageNumber = '000'; // placeholder for page numbers
632
752
  });
@@ -638,7 +758,7 @@ i === 0 ? (ft = el, box.children[1].after(el)) : (ft.append(...el.children), el.
638
758
  // move <style>/<link> into <head> so styles can be applied globally (not
639
759
  // only when they are in the DOM), no matter how deeply they are nested
640
760
  $$('style, link[rel="stylesheet"]', el).forEach(el => d.head.append(el));
641
- const ch = [...el.children].filter(el => ![box, hold, progress].includes(el) &&
761
+ const ch = kids(el).filter(el => ![box, hold, progress].includes(el) &&
642
762
  !['SCRIPT', 'NOSCRIPT', 'TEMPLATE'].includes(el.tagName));
643
763
  ch.forEach(el => el.remove());
644
764
  return ch;
@@ -647,13 +767,21 @@ i === 0 ? (ft = el, box.children[1].after(el)) : (ft.append(...el.children), el.
647
767
  // iteratively add elements to pages
648
768
  function* fillPages(roots, els) {
649
769
  for (const el of $$('.pagesjs-front, .abstract, #TOC:not(.chapter-toc)')) {
770
+ // mark the first page if it has the frontmatter (for styling; :has() would be re-checked on every change)
771
+ has(el, 'pagesjs-front') && box === boxes[0] && addCls(box, 'page-front');
650
772
  yield* fill(el);
651
773
  book && nextPage();
652
774
  }
653
775
  for (const [i, el] of roots.entries()) {
654
776
  wrap = ancestors(el); box_ctx = null;
655
777
  book && (box.innerText === '' ? newPage(box) : nextPage());
656
- for (const [j, child] of els[i].entries()) yield* fill(child, i < roots.length - 1 || j < els[i].length - 1);
778
+ const list = els[i];
779
+ for (let j = 0; j < list.length; j++) {
780
+ yield* fill(list[j], i < roots.length - 1 || j < list.length - 1);
781
+ // put the next children on the page at once if they surely fit
782
+ const run = fitting(ctx(), list.slice(j + 1), true);
783
+ run.length && (ctx().append(...run), overflows() ? run.forEach(e => e.remove()) : j += run.length);
784
+ }
657
785
  // clean up container and self if empty
658
786
  removeBlank(el.parentNode); removeBlank(el);
659
787
  }
@@ -675,11 +803,12 @@ i === 0 ? (ft = el, box.children[1].after(el)) : (ft.append(...el.children), el.
675
803
  // nobody sees the progress in a headless browser (and printing has to be sync)
676
804
  const quiet = sync || /Headless/.test(navigator.userAgent) || navigator.webdriver;
677
805
  // we need to wait for all resources to be fully loaded before paginating
678
- if (d.readyState !== 'complete') return addEventListener('load', () => paginate(sync));
806
+ if (d.readyState !== 'complete') return on('load', () => paginate(sync));
679
807
 
680
808
  const cls = d.body.classList;
681
809
  if (cls.contains('pagesjs')) return; // already paginated
682
- dispatchEvent(new Event('pagesjs:before'));
810
+ fire('pagesjs:before');
811
+ const t0 = performance.now();
683
812
 
684
813
  markFrontmatter();
685
814
  // (get the title while the document is visible, so innerText works)
@@ -688,8 +817,7 @@ i === 0 ? (ft = el, box.children[1].after(el)) : (ft.append(...el.children), el.
688
817
  cls.add('pagesjs');
689
818
  d.body.append(hold);
690
819
  if (!quiet) { // a simple indicator to tell users to wait
691
- progress = d.createElement('div');
692
- progress.className = 'pagesjs-progress';
820
+ progress = make('div', 'pagesjs-progress');
693
821
  progress.textContent = 'Paginating...';
694
822
  d.body.append(progress);
695
823
  }
@@ -700,16 +828,21 @@ i === 0 ? (ft = el, box.children[1].after(el)) : (ft.append(...el.children), el.
700
828
  measureMinHeight();
701
829
  addTocLeaders();
702
830
 
831
+ detachNotes();
703
832
  const roots = findRoots(), els = detachContent(roots);
704
833
  function* run() {
705
834
  yield* fillPages(roots, els);
706
835
  cls.remove('pagesjs-filling');
707
- numberPages();
708
836
  d.body.prepend(...boxes); // unhide all pages
837
+ checkOffsets();
838
+ numberPages();
709
839
  numberToc();
710
840
  hold.remove(); progress?.remove();
711
841
  finished = true;
712
- dispatchEvent(new Event('pagesjs:after'));
842
+ const over = boxes.filter(b => b.classList.contains('page-multiple')).length;
843
+ console.info(`pages.js: ${boxes.length} pages in ${Math.round(performance.now() - t0)} ms` +
844
+ (over ? `; ${over} overflow their page` : ''));
845
+ fire('pagesjs:after');
713
846
  }
714
847
  // Pagination is async unless it has to be sync (beforeprint). If printing
715
848
  // starts while it's pending (e.g., headless printing right after the page is
@@ -717,7 +850,7 @@ i === 0 ? (ft = el, box.children[1].after(el)) : (ft.append(...el.children), el.
717
850
  pending = sync => { pending = null; unprobe(); running = run(); return advance(sync || quiet); };
718
851
  sync ? pending(true) : probe(roots, els).then(() => pending?.());
719
852
  }
720
- addEventListener('beforeprint', () => {
853
+ on('beforeprint', () => {
721
854
  if (pending) pending(true);
722
855
  else if (running) while (!running.next().done); // finish the pagination in progress
723
856
  else paginate(true);
@@ -725,13 +858,13 @@ i === 0 ? (ft = el, box.children[1].after(el)) : (ft.append(...el.children), el.
725
858
  // A script that controls the browser can request the pagination by dispatching
726
859
  // pagesjs:paginate, and wait for pagesjs:after (which is also dispatched if the
727
860
  // pagination was already finished)
728
- addEventListener('pagesjs:paginate', () => {
729
- finished ? dispatchEvent(new Event('pagesjs:after')) : paginate();
861
+ on('pagesjs:paginate', () => {
862
+ finished ? fire('pagesjs:after') : paginate();
730
863
  });
731
864
  // use query param ?paged=1 to indicate pagination (press p to toggle)
732
865
  const SP = new URLSearchParams(location.search);
733
866
  SP.get('paged') && paginate();
734
- addEventListener('keypress', e => {
867
+ on('keypress', e => {
735
868
  if (e.key === 'p') {
736
869
  if (SP.get('paged')) {
737
870
  SP.delete('paged'); location.href = location.pathname + (SP.size ? `?${SP}` : '');
package/js/pages.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (e=>{function t(t,n=e){return n?.querySelector(t)}function n(t,n=e){return n?n.querySelectorAll(t):[]}function o(e){return e.childElementCount}const i=n("h1").length>1,r="h1,h2,h3,h4,h5,h6,hr,img,svg,video,canvas,iframe,object,embed,math,mjx-container,figure,.figure,details",s="pagesjs-fragmented",a="fragment-first",l="fragment-last",c=["top","bottom"].map(t=>parseFloat(getComputedStyle(e.documentElement).getPropertyValue(`--paper-margin-${t}`))||0),d=e.createElement("div"),f=[],p=new WeakSet,u=e.createElement("div");d.className="pagesjs-page",d.innerHTML='<div class="pagesjs-header"></div>\n<div class="pagesjs-body"></div>\n<div class="pagesjs-footer"></div>',u.style.display="none";let g,h,m,E,v,b,C,T,L,y,N,j,H=[],S=0;function x(e){return e&&!t(".pagesjs-body",e)&&e.insertAdjacentHTML("afterbegin",d.innerHTML),g=e||d.cloneNode(!0),h=g.children[1],m=null,f.includes(g)||f.push(g),g}function M(e=h){let t=0;for(let n=e.lastElementChild;n;n=n.lastElementChild){const e=getComputedStyle(n);if(t=Math.max(t,parseFloat(e.marginBottom)||0),parseFloat(e.paddingBottom)||parseFloat(e.borderBottomWidth))break}return t}function w(){return g.getBoundingClientRect().height-M()}function R(){return g.scrollHeight-M()>E}function O(e,t){const n=g;n.after(x(e)),t&&t(),B(n)}function B(e){const t=e.scrollHeight;if(t-M(e.children[1])>E&&!e.dataset.pagesOffset){const o=function(e,t){let o=+e.dataset.pagesOffset;if(o)return o;if(o=Math.ceil(t/E),o<=1)return o;const i=c.concat([...n("thead",e)].map(e=>+e.offsetHeight)).reduce((e,t)=>e+t);if(!i)return o;function r(){return Math.ceil((t+(o-1)*i)/E)}let s=r();for(;s>o;)o=s,s=r();return o}(e,t);o>1&&(e.dataset.pagesOffset=o)}e.remove(),N&&(N.textContent=`Paginating: ${++S} pages done`)}function k(t){const n=[];for(;t&&t!==e.body;t=t.parentNode)n.unshift(t);return n}function A(){return H.length?(m&&h.contains(m)||(m=H.reduce((e,t)=>{const n=t.cloneNode();return n.classList.add("pagesjs-wrap"),e.appendChild(n)},h)),m):h}function P(e){if(!e||"BODY"===e.tagName)return!1;const t=!("P"===e.tagName?e.innerHTML:e.innerText).trim();return t&&e.remove(),t}function*F(e,n=!0){e.classList.contains("pagesjs-page")?O(e,()=>o(e)>3&&(h.append(...[...e.children].slice(3)),O())):(i&&""!==g.innerText&&t("h1",e)&&O(),e.innerText.trim()&&E-g.scrollHeight<b&&O(),yield*function*(e,t){for(;;){const n=A();if(J(e),$(e))e=W(e,n,"block",t);else{if(n.append(e),!R())return;e=W(e,n,void 0,t)}if(!e)return;O(),yield}}(e,n))}function W(e,t,n,o){const i=n||function(e){const t=getComputedStyle(e),n=e.tagName;if(/avoid/.test(t.breakInside)||e.matches(r))return;if("TABLE"===n)return e.tBodies[0]&&"table";if(!["block","list-item","flow-root"].includes(t.display)||!z(t))return;if("PRE"===n){if("CODE"===e.firstElementChild?.tagName&&X(e).length>1)return"code";if(e.offsetHeight<=v)return}return[...e.children].some(e=>!D(e))?"block":"inline"}(e),c="block"===i?void 0:I(e),d=!e.classList.contains(s),f=i&&Y[i](e,t,c,d,o);if(!f)return c&&(e.remove(),e);const[p,u]=f;return q(p)?(p.remove(),u):(u?(u.classList.add(s),u.classList.remove(a,l)):p.classList.add(l),u)}function $(e){return!["TABLE","PRE"].includes(e.tagName)&&e.getElementsByTagName("*").length>300}function q(e){return!e.firstElementChild&&!e.textContent.trim()}function I(e){for(;e&&e!==h;e=e.parentNode)for(let t=e.previousElementSibling;t;t=t.previousElementSibling)if(t.getBoundingClientRect().height)return!0;return!1}function z(e){return"none"===e.float&&!["absolute","fixed"].includes(e.position)}function D(e){if(1!==e.nodeType)return!0;const t=getComputedStyle(e),n=t.display;return n.startsWith("inline")||"none"===n||"contents"===n||!z(t)}function V(e){const t=getComputedStyle(e);return(t.display.startsWith("inline")||"contents"===t.display)&&z(t)}function X(e){const t=[];return e.firstElementChild.innerHTML.replace(/\n$/,"").split("\n").map(e=>{const n=t.map(e=>e[0]).join("");return e.replace(/<(\/?)([a-z][\w-]*)[^>]*>/gi,(e,n,o)=>{n?t.pop():t.push([e,o])}),n+e+t.map(e=>`</${e[1]}>`).reverse().join("")})}function _(e,t){e.classList.add(s),e.classList.remove(l),t&&e.classList.add(a)}function J(e){1===e.nodeType&&[e,...n("."+s,e)].forEach(e=>e.classList.contains(s)&&e.classList.add(l))}function U(e,t,n){const o=e.cloneNode();return e.remove(),t.append(o),_(o,n),o}const Y={block:function(t,n,i,r,s){!function(t){if(p.has(t)||t.classList.contains("pagesjs-run"))return;p.add(t),t.isConnected||u.append(t);let n=[];function o(){if(n.some(e=>1===e.nodeType||3===e.nodeType&&e.nodeValue.trim())){const t=e.createElement("span");t.className="pagesjs-run",n[0].before(t),t.append(...n)}n=[]}for(const e of[...t.childNodes])D(e)?n.push(e):o();o(),t.parentNode===u&&t.remove()}(t);const a=U(t,n,r);let l,c;i=I(a);for(;l=t.firstChild;){if(1!==l.nodeType){a.append(l);continue}J(l);const e=$(l);if(!e&&(a.append(l),!R()))continue;const n=o(a),i=W(l,a,e?"block":void 0,s||!!t.firstElementChild);if(i){c=o(a)>n,t.prepend(i);break}}return q(t)&&Q(a,t,i),q(t)||G(a,t,i),i&&!c&&K(a,t),"OL"===t.tagName&&o(a)&&!q(t)&&Z(a,t),[a,q(t)?null:t]},inline:function(n,o,i,r,s){const a=function(n){const o=e.createRange(),i=[{node:n,i:0}],r=e.createTreeWalker(n,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT);let s,a;function l(e){return a&&a.bottom<=e.top&&a.right>e.left}for(;s=r.nextNode();){const e=s.tagName;if(e){if(("MJX-CONTAINER"===e||"SPAN"===e&&t(".katex",s)||!V(s))&&(s=r.nextSibling(),!s))break;if(s.firstChild)continue}if(s.tagName){const e=s.getBoundingClientRect();l(e)&&i.push({node:s,i:-1}),a=e}else if(s.textContent.trim()){o.selectNodeContents(s);const e=o.getClientRects();if(!e.length)continue;l(e[0])&&i.push({node:s,i:0});for(let t=1;t<e.length;t++)i.push({node:s,i:ee(s,t,o)});a=e[e.length-1]}}return i}(n);if(a.length<2)return;const l=e.createRange(),c=n.cloneNode(),d=a.length;let f=d;function p(){const e=a[--f];e.i<0?l.setStartBefore(e.node):l.setStart(e.node,e.i),l.setEnd(n,n.childNodes.length),c.prepend(l.extractContents());const t=n.lastChild;""===t?.innerHTML&&t.remove()}_(n,r);for(;f>(i?0:1)&&(p(),!(f>0)||R()););f>1&&d-f===1&&!s&&p();return[n,c]},table:function(e,t,n,o){const i=U(e,t,o),r=e.tBodies[0],s=r.cloneNode(),a=[...r.rows],l=a.length,c=n?0:1;i.append(s),[e.tHead,e.tFoot].forEach(e=>e&&i.append(e.cloneNode(!0))),s.append(...a);const d=w()-E-.5;if(d>=0){const e=a[l-1].getBoundingClientRect().bottom-d;let t=0,n=l;for(;t<n;){const o=t+n>>1;a[o].getBoundingClientRect().bottom<=e?t=o+1:n=o}let o=Math.max(t,c);for(r.prepend(...a.slice(o));o>c&&w()>E+.5;)r.prepend(a[--o])}s.rows.length||(i.innerHTML="");const f=s.rows.length;(1===r.rows.length&&f>1||1===f&&n&&r.rows.length)&&(r.prepend(s.rows[f-1]),1===f&&(i.innerHTML=""));return[i,r.rows.length?e:null]},code:function(t,n,o,i){const r=t.firstElementChild,s=X(t),a=[...t.children],l=a.filter((e,t)=>t>a.indexOf(r)&&z(getComputedStyle(e))),c=U(t,n,i),d=r.cloneNode();c.append(d,...a.filter(e=>e!==r&&!l.includes(e)));let f=function(t,n,o){const i=n.length,r=o?0:1;t.innerHTML=n.join("\n");const s=w()-E-.5;if(s<0)return i;const a=e.createRange(),l=[];t.childNodes.forEach(e=>{if(3===e.nodeType)for(let t=e.data.indexOf("\n");t>=0;t=e.data.indexOf("\n",t+1))a.setStart(e,t),a.setEnd(e,t+1),l.push(a.getBoundingClientRect().bottom)}),a.selectNodeContents(t);const c=a.getClientRects(),d=c[c.length-1].bottom;l.push(d);let f=0;for(;f<i&&l[f]<=d-s;)f++;for(;f&&f<i&&!n[f].trim();)f++;t.innerHTML=n.slice(0,Math.max(f,r)).join("\n");for(;f>r&&w()>E+.5;)t.innerHTML=n.slice(0,--f).join("\n");return Math.max(f,r)}(d,s,o);f>1&&s.length-f===1&&f--;1===f&&o&&(f=0);f?d.innerHTML=s.slice(0,f).join("\n"):c.innerHTML="";return r.innerHTML=s.slice(f).join("\n"),r.innerHTML.trim()?[c,t]:(f&&c.append(...l),[c,null])}};function G(e,t,n){for(let i;(i=e.lastElementChild)?.matches("legend")&&(o(e)>1||n);)t.prepend(i)}function K(e,t){!q(t)&&e.getBoundingClientRect().height<1.5*b&&t.prepend(...e.childNodes)}function Q(e,t,n){for(e.classList.add(l);R()&&e.lastElementChild&&(o(e)>1||n);)t.prepend(e.lastElementChild);q(t)||e.classList.remove(l)}function Z(e,t){t.start+=o(e)-(t.firstElementChild.classList.contains(s)?1:0)}function ee(e,t,n){let o=0,i=e.length;for(;o<i;){const r=o+i>>1;n.setStart(e,0),n.setEnd(e,r),n.getClientRects().length>t?i=r:o=r+1}return o-1}function te(e){return e&&(e.dataset.shortTitle||e.innerText)}const ne=(i?"h1":"h2")+":not(.pagesjs-front *)";function oe(e){const t=performance.now();for(;!y.next().done;)if(!(e||performance.now()-t<500))return new Promise(e=>{requestAnimationFrame(e),setTimeout(e,50)}).then(()=>oe())}function ie(o){const r=o||/Headless/.test(navigator.userAgent)||navigator.webdriver;if("complete"!==e.readyState)return addEventListener("load",()=>ie(o));const s=e.body.classList;if(s.contains("pagesjs"))return;dispatchEvent(new Event("pagesjs:before")),n(e.body.dataset.pagesFront||"body > header").forEach(e=>e.classList.add("pagesjs-front")),C=te(t("h1.title, .pagesjs-front h1, .title, h1")),s.add("pagesjs"),e.body.append(u),r||(N=e.createElement("div"),N.className="pagesjs-progress",N.textContent="Paginating...",e.body.append(N)),e.body.insertAdjacentElement("afterbegin",x()),E=(g.clientHeight||window.innerHeight)+3,v=h.clientHeight||E,n(":is(#TOC, .footnotes, .chapter-before, .chapter-after):is(.side-left, .side-right).side").forEach(e=>{e.classList.remove("side","side-left","side-right")}),s.add("pagesjs-filling"),function(){const t=e.createElement("p"),n=g.scrollHeight;t.innerText="A",h.append(t),b=g.scrollHeight-n,t.remove()}(),n('#TOC a[href^="#"]').forEach(t=>{const n=e.createElement("span");let o;for(n.className="toc-text",t.append(n);(o=n.previousSibling)&&!o.classList?.contains("section-number");)n.prepend(o);t.dataset.pageNumber="000"});const a=function(){const o=e.body.dataset.pagesRoot,i=o?[...n(o)]:[];if(i.length)return i;let r=t('main, [role="main"]');for(;1===r?.childElementCount;)r=r.firstElementChild;if(r)return[r];const s=[...n("article")].filter(e=>!e.parentNode.closest("article"));return s.length?s:[e.body]}(),l=function(t){return t.map(t=>{n('style, link[rel="stylesheet"]',t).forEach(t=>e.head.append(t));const o=[...t.children].filter(e=>![g,u,N].includes(e)&&!["SCRIPT","NOSCRIPT","TEMPLATE"].includes(e.tagName));return o.forEach(e=>e.remove()),o})}(a);function*c(){yield*function*(e,t){for(const e of n(".pagesjs-front, .abstract, #TOC:not(.chapter-toc)"))yield*F(e),i&&O();for(const[n,o]of e.entries()){H=k(o),m=null,i&&(""===g.innerText?x(g):O());for(const[o,i]of t[n].entries())yield*F(i,n<e.length-1||o<t[n].length-1);P(o.parentNode),P(o)}B(g),n(".pagesjs-run").forEach(e=>e.replaceWith(...e.childNodes))}(a,l),s.remove("pagesjs-filling"),function(){let e,o=0;f.forEach(r=>{if(i){if(t(".pagesjs-front",r))return;t(ne,r)&&(e="")}const s=+r.dataset.pagesOffset||1;s>1&&r.classList.add("page-multiple"),o+=s,r.classList.add("page-"+(o%2==0?"even":"odd"));const a={pageNumber:o,mainTitle:C,pageTitle:e};let l;[r.children[0],r.children[2]].forEach(e=>{for(const t in a)a[t]&&(e.dataset[t]=a[t])}),e=te([...n(ne,r)].pop())||e,n(".footnotes",r).forEach((e,t)=>{0===t?(l=e,r.children[1].after(e)):(l.append(...e.children),e.remove())})})}(),e.body.prepend(...f),n('#TOC a[href^="#"]').forEach(e=>{const n=t(`.pagesjs-page:has(#${CSS.escape(e.getAttribute("href").replace(/^#/,""))}) .pagesjs-header`);e.dataset.pageNumber=n?n.dataset.pageNumber:""}),u.remove(),N?.remove(),j=!0,dispatchEvent(new Event("pagesjs:after"))}L=e=>(L=null,T&&(T.forEach(e=>e.forEach(e=>e.remove())),h.innerHTML="",m=null,H=[],g.classList.remove("pagesjs-settle"),T=null),y=c(),oe(e||r)),o?L(!0):function(e,t){return g.classList.add("pagesjs-settle"),e.forEach((e,n)=>{H=k(e),m=null,A().append(...t[n])}),T=t,new Promise(e=>{const t=setTimeout(e,500);let n=0;!function o(){requestAnimationFrame(()=>++n<3?o():(clearTimeout(t),e()))}()})}(a,l).then(()=>L?.())}addEventListener("beforeprint",()=>{if(L)L(!0);else if(y)for(;!y.next().done;);else ie(!0)}),addEventListener("pagesjs:paginate",()=>{j?dispatchEvent(new Event("pagesjs:after")):ie()});const re=new URLSearchParams(location.search);re.get("paged")&&ie(),addEventListener("keypress",e=>{"p"===e.key&&(re.get("paged")?(re.delete("paged"),location.href=location.pathname+(re.size?`?${re}`:"")):(ie(),re.set("paged",1),history.replaceState({},"",`${location.pathname}?${re}`)))})})(document);
1
+ (e=>{function t(t,n=e){return n?.querySelector(t)}function n(t,n=e){return n?n.querySelectorAll(t):[]}function o(e){return e.childElementCount}function r(e){return[...e.children]}function i(e){return e.firstElementChild}function s(e){return e.lastElementChild}function a(e){return e.getBoundingClientRect()}function c(e){return getComputedStyle(e)}function l(e){return parseFloat(e)||0}function f(e,t){return e.classList.contains(t)}function d(e,...t){e.classList.add(...t)}function p(e,...t){e.classList.remove(...t)}function u(t,n){const o=e.createElement(t);return n&&(o.className=n),o}function g(){return e.createRange()}function h(e,t){addEventListener(e,t)}function m(e){dispatchEvent(new Event(e))}const b=n("h1").length>1,T="h1,h2,h3,h4,h5,h6,hr,img,svg,video,canvas,iframe,object,embed,math,mjx-container,figure,.figure,.caption,details",E="pagesjs-fragmented",v="fragment-first",N="fragment-last",y=["top","bottom"].map(t=>l(c(e.documentElement).getPropertyValue(`--paper-margin-${t}`))),j=u("div","pagesjs-page"),H=[],C=new WeakSet,L=new WeakSet,x=new Map,M=new WeakMap,w=u("div");j.innerHTML='<div class="pagesjs-header"></div>\n<div class="pagesjs-body"></div>\n<div class="pagesjs-footer"></div>',w.style.display="none";let S,k,O,P,A,R,B,$,W,F,I,q,U,V,z=[],D=0;function X(e){return e&&!t(".pagesjs-body",e)&&e.insertAdjacentHTML("afterbegin",j.innerHTML),S=e||j.cloneNode(!0),k=S.children[1],O=null,H.includes(S)||H.push(S),S}function _(e=k){let t=0;for(let n=s(e);n;n=s(n)){const e=c(n);if(t=Math.max(t,l(e.marginBottom)),l(e.paddingBottom)||l(e.borderBottomWidth))break}return t}function J(){return G(),a(S).height-_()}function Y(){return G(),($=S.scrollHeight-_())>P}function G(e=S){const r=e.children[1],i=[...n(".pagesjs-note",r)].flatMap(e=>x.get(e));let s=t(":scope > .footnotes",e);if(!i.length)return s?.remove();s||r.after(s=u("div")),s.className="footnotes",(i.some((e,t)=>s.children[t]!==e)||o(s)!==i.length)&&s.replaceChildren(...i)}function K(e,t){const n=S;n.after(X(e)),t&&t(),Q(n)}function Q(e){G(e);const t=e.scrollHeight;if(t-_(e.children[1])>P&&!e.dataset.pagesOffset){const o=function(e,t){let o=+e.dataset.pagesOffset;if(o)return o;if(o=Math.ceil(t/P),o<=1)return o;const r=y.concat([...n("thead",e)].map(e=>+e.offsetHeight)).reduce((e,t)=>e+t);if(!r)return o;function i(){return Math.ceil((t+(o-1)*r)/P)}let s=i();for(;s>o;)o=s,s=i();return o}(e,t);o>1&&(e.dataset.pagesOffset=o,L.add(e))}e.remove(),U&&(U.textContent=`Paginating: ${++D} pages done`)}function Z(t){const n=[];for(;t&&t!==e.body;t=t.parentNode)n.unshift(t);return n}function ee(){return z.length?(O&&k.contains(O)||(O=z.reduce((e,t)=>{const n=t.cloneNode();return d(n,"pagesjs-wrap"),e.appendChild(n)},k)),O):k}function te(e){if(!e||"BODY"===e.tagName)return!1;const t=!("P"===e.tagName?e.innerHTML:e.innerText).trim();return t&&e.remove(),t}function*ne(e,n=!0){f(e,"pagesjs-page")?K(e,()=>o(e)>3&&(k.append(...r(e).slice(3)),K())):(b&&""!==S.innerText&&t("h1",e)&&K(),e.innerText.trim()&&(G(),P-S.scrollHeight<R)&&K(),yield*function*(e,t){for(;;){const n=ee();if(pe(e),re(e))e=oe(e,n,"block",t);else{if(n.append(e),!Y())return;e=oe(e,n,void 0,t)}if(!e)return;K(),yield}}(e,n))}function oe(e,t,n,o){const s=n||function(e){const t=c(e),n=e.tagName;if(/avoid/.test(t.breakInside)||e.matches(T))return;if("TABLE"===n)return e.tBodies[0]&&"table";if(!["block","list-item","flow-root"].includes(t.display)||!ae(t))return;if("PRE"===n){if("CODE"===i(e)?.tagName&&fe(e).length>1)return"code";if(e.offsetHeight<=A)return}return r(e).some(e=>!ce(e))?"block":"inline"}(e),a="block"===s?void 0:se(e),l=!f(e,E),u=s&&ge[s](e,t,a,l,o);if(!u)return a&&(e.remove(),e);const[g,h]=u;return ie(g)?(g.remove(),h):(h?(d(h,E),p(h,v,N)):f(g,v)?p(g,E,v,N):d(g,N),h)}function re(e){return!["TABLE","PRE"].includes(e.tagName)&&e.getElementsByTagName("*").length>300}function ie(e){return!i(e)&&!e.textContent.trim()}function se(e){for(;e&&e!==k;e=e.parentNode)for(let t=e.previousElementSibling;t;t=t.previousElementSibling)if(a(t).height)return!0;return!1}function ae(e){return"none"===e.float&&!["absolute","fixed"].includes(e.position)}function ce(e){if(1!==e.nodeType)return!0;const t=c(e),n=t.display;return n.startsWith("inline")||"none"===n||"contents"===n||!ae(t)}function le(e){const t=c(e);return(t.display.startsWith("inline")||"contents"===t.display)&&ae(t)}function fe(e){const t=[];return i(e).innerHTML.replace(/\n$/,"").split("\n").map(e=>{const n=t.map(e=>e[0]).join("");return e.replace(/<(\/?)([a-z][\w-]*)[^>]*>/gi,(e,n,o)=>{n?t.pop():t.push([e,o])}),n+e+t.map(e=>`</${e[1]}>`).reverse().join("")})}function de(e,t){d(e,E),p(e,N),t&&d(e,v)}function pe(e){1===e.nodeType&&[e,...n("."+E,e)].forEach(e=>f(e,E)&&d(e,N))}function ue(e,t,n){const o=e.cloneNode();return e.remove(),t.append(o),de(o,n),o}const ge={block:function(e,t,n,r,s){!function(e){if(C.has(e)||f(e,"pagesjs-run"))return;C.add(e),e.isConnected||w.append(e);let t=[];function n(){if(t.some(e=>1===e.nodeType||3===e.nodeType&&e.nodeValue.trim())){const e=u("span","pagesjs-run");t[0].before(e),e.append(...t)}t=[]}for(const o of[...e.childNodes])ce(o)?t.push(o):n();n(),e.parentNode===w&&e.remove()}(e);const a=ue(e,t,r);let c,l;n=se(a);for(;c=e.firstChild;){if(1!==c.nodeType){a.append(c);continue}pe(c);const t=re(c);if(!t){const t=he(a,me(c));if(t.length||t.push(c),a.append(...t),!Y())continue;if(t.length>1&&(e.prepend(...t.slice(1)),!Y()))continue}const n=o(a),r=oe(c,a,t?"block":void 0,s||!!i(e));if($=null,r){l=o(a)>n,e.prepend(r);break}}return ie(e)&&ve(a,e,n),ie(e)||be(a,e,n),n&&!l&&Te(a,e),"OL"===e.tagName&&o(a)&&!ie(e)&&Ne(a,e),[a,ie(e)?null:e]},inline:function(n,o,r,i,s){const c=function(n){const o=g(),r=[{node:n,i:0}],i=e.createTreeWalker(n,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT);let s,c;function l(e){return c&&c.bottom<=e.top&&c.right>e.left}for(;s=i.nextNode();){const e=s.tagName;if(e){if(("MJX-CONTAINER"===e||"SPAN"===e&&t(".katex",s)||!le(s))&&(s=i.nextSibling(),!s))break;if(s.firstChild)continue}if(s.tagName){const e=a(s);l(e)&&r.push({node:s,i:-1}),c=e}else if(s.textContent.trim()){o.selectNodeContents(s);const e=o.getClientRects();if(!e.length)continue;l(e[0])&&r.push({node:s,i:0});for(let t=1;t<e.length;t++)r.push({node:s,i:ye(s,t,o)});c=e[e.length-1]}}return r}(n);if(c.length<2)return;const l=g(),f=n.cloneNode(),d=c.length;let p=d;function u(){const e=c[--p];e.i<0?l.setStartBefore(e.node):l.setStart(e.node,e.i),l.setEnd(n,n.childNodes.length),f.prepend(l.extractContents());const t=n.lastChild;""===t?.innerHTML&&t.remove()}de(n,i);for(;p>(r?0:1)&&(u(),!(p>0)||Y()););p>1&&d-p===1&&!s&&u();return[n,f]},table:function(e,t,n,o){const r=ue(e,t,o),i=e.tBodies[0],s=i.cloneNode(),l=[...i.rows],f=l.length,d=n?0:1,p=e.caption&&"bottom"!==c(e.caption).captionSide?e.caption:null;function u(){p&&e.prepend(p),r.innerHTML=""}p&&r.append(p),[e.tHead,s,e.tFoot].forEach(e=>e&&r.append(e===s?e:e.cloneNode(!0))),s.append(...l);const g=J()-P-.5;if(g>=0){const e=a(l[f-1]).bottom-g;let t=0,n=f;for(;t<n;){const o=t+n>>1;a(l[o]).bottom<=e?t=o+1:n=o}let o=Math.max(t,d);for(i.prepend(...l.slice(o));o>d&&J()>P+.5;)i.prepend(l[--o])}s.rows.length||u();const h=s.rows.length;(1===i.rows.length&&h>1||1===h&&n&&i.rows.length)&&(i.prepend(s.rows[h-1]),1===h&&u());return[r,i.rows.length?e:null]},code:function(e,t,n,o){const s=i(e),l=fe(e),f=r(e),d=f.filter((e,t)=>t>f.indexOf(s)&&ae(c(e))),p=ue(e,t,o),u=s.cloneNode();p.append(u,...f.filter(e=>e!==s&&!d.includes(e)));let h=function(e,t,n){const o=t.length,r=n?0:1;e.innerHTML=t.join("\n");const i=J()-P-.5;if(i<0)return o;const s=g(),c=[];e.childNodes.forEach(e=>{if(3===e.nodeType)for(let t=e.data.indexOf("\n");t>=0;t=e.data.indexOf("\n",t+1))s.setStart(e,t),s.setEnd(e,t+1),c.push(a(s).bottom)}),s.selectNodeContents(e);const l=s.getClientRects(),f=l[l.length-1].bottom;c.push(f);let d=0;for(;d<o&&c[d]<=f-i;)d++;for(;d&&d<o&&!t[d].trim();)d++;e.innerHTML=t.slice(0,Math.max(d,r)).join("\n");for(;d>r&&J()>P+.5;)e.innerHTML=t.slice(0,--d).join("\n");return Math.max(d,r)}(u,l,n);h>1&&l.length-h===1&&h--;1===h&&n&&(h=0);h?u.innerHTML=l.slice(0,h).join("\n"):p.innerHTML="";return s.innerHTML=l.slice(h).join("\n"),s.innerHTML.trim()?[p,e]:(h&&p.append(...d),[p,null])}};function he(e,n,o){const r=s(e),i=r&&!f(r,E)?M.get(r):void 0,a=[];if(void 0===i||!$)return a;let c=i,l=0;for(const e of n){if(1===e.nodeType){const n=M.get(e);if(!(n>=c)||e.matches(`.${E}, .pagesjs-page`)||re(e)||t(".pagesjs-note",e)||$+n-i+B>P||o&&($+c-i+2*R>P||b&&t("h1",e)))break;c=n}a.push(e),1===e.nodeType&&(l=a.length)}return a.slice(0,l)}function*me(e){for(;e;e=e.nextSibling)yield e}function be(e,t,n){for(let r;(r=s(e))?.matches("legend, .caption")&&(o(e)>1||n);)t.prepend(r)}function Te(e,t){!ie(t)&&a(e).height<1.5*B&&(Ee(s(e),i(t)),t.prepend(...e.childNodes))}function Ee(e,t){e&&t&&f(e,E)&&f(t,E)&&e.tagName===t.tagName&&(Ee(s(e),i(t)),t.prepend(...e.childNodes),p(t,...f(e,v)?[E,v,N]:[v]),e.remove())}function ve(e,t,n){for(d(e,N);Y()&&s(e)&&(o(e)>1||n);){const n=s(e),o=oe(n,e,void 0,!0);if(!o)break;if(t.prepend(o),o!==n)break}ie(t)||p(e,N)}function Ne(e,t){t.start+=o(e)-(f(i(t),E)?1:0)}function ye(e,t,n){let o=0,r=e.length;for(;o<r;){const i=o+r>>1;n.setStart(e,0),n.setEnd(e,i),n.getClientRects().length>t?r=i:o=i+1}return o-1}function je(e){M.set(e,a(e).bottom),e.matches(`p, pre, table, ${T}`)||r(e).forEach(je)}function He(e){return e&&(e.dataset.shortTitle||e.innerText)}const Ce=(b?"h1":"h2")+":not(.pagesjs-front *)";function Le(e){return[...e.childNodes].some(e=>3===e.nodeType&&e.nodeValue.trim())}function xe(e){return!["PRE","TABLE"].includes(e.tagName)&&!Le(e)}function Me(e){const t=performance.now();for(;!q.next().done;)if(!(e||performance.now()-t<500))return new Promise(e=>{requestAnimationFrame(e),setTimeout(e,50)}).then(()=>Me())}function we(c){const l=c||/Headless/.test(navigator.userAgent)||navigator.webdriver;if("complete"!==e.readyState)return h("load",()=>we(c));const T=e.body.classList;if(T.contains("pagesjs"))return;m("pagesjs:before");const E=performance.now();n(e.body.dataset.pagesFront||"body > header").forEach(e=>d(e,"pagesjs-front")),W=He(t("h1.title, .pagesjs-front h1, .title, h1")),T.add("pagesjs"),e.body.append(w),l||(U=u("div","pagesjs-progress"),U.textContent="Paginating...",e.body.append(U)),e.body.insertAdjacentElement("afterbegin",X()),P=(S.clientHeight||window.innerHeight)+3,A=k.clientHeight||P,n(":is(#TOC, .footnotes, .chapter-before, .chapter-after):is(.side-left, .side-right).side").forEach(e=>{p(e,"side","side-left","side-right")}),T.add("pagesjs-filling"),function(){const e=u("p"),t=S.scrollHeight;e.innerText="A",k.append(e),R=S.scrollHeight-t,B=a(e).height,e.remove()}(),n('#TOC a[href^="#"]').forEach(e=>{const t=u("span","toc-text");let n;for(e.append(t);(n=t.previousSibling)&&(1!==n.nodeType||!f(n,"section-number"));)t.prepend(n);e.dataset.pageNumber="000"}),n(".footnotes").forEach(e=>{const t=e.previousElementSibling;if(!t||!f(t,"note-ref"))return;const n=u("span","pagesjs-note");n.hidden=!0,x.set(n,r(e)),e.replaceWith(n)});const v=function(){const r=e.body.dataset.pagesRoot,s=r?[...n(r)]:[];if(s.length)return s;let a=t('main, [role="main"]');for(;a&&1===o(a)&&!Le(a)&&xe(i(a));)a=i(a);if(a)return[a];const c=[...n("article")].filter(e=>!e.parentNode.closest("article"));return c.length?c:[e.body]}(),N=function(t){return t.map(t=>{n('style, link[rel="stylesheet"]',t).forEach(t=>e.head.append(t));const o=r(t).filter(e=>![S,w,U].includes(e)&&!["SCRIPT","NOSCRIPT","TEMPLATE"].includes(e.tagName));return o.forEach(e=>e.remove()),o})}(v);function*y(){yield*function*(e,t){for(const e of n(".pagesjs-front, .abstract, #TOC:not(.chapter-toc)"))f(e,"pagesjs-front")&&S===H[0]&&d(S,"page-front"),yield*ne(e),b&&K();for(const[n,o]of e.entries()){z=Z(o),O=null,b&&(""===S.innerText?X(S):K());const r=t[n];for(let t=0;t<r.length;t++){yield*ne(r[t],n<e.length-1||t<r.length-1);const o=he(ee(),r.slice(t+1),!0);o.length&&(ee().append(...o),Y()?o.forEach(e=>e.remove()):t+=o.length)}te(o.parentNode),te(o)}Q(S),n(".pagesjs-run").forEach(e=>e.replaceWith(...e.childNodes))}(v,N),T.remove("pagesjs-filling"),e.body.prepend(...H),H.forEach(e=>{if(!L.has(e))return;const t=e.children[1],n=g();n.selectNodeContents(t),a(n).bottom<=a(t.nextElementSibling).top&&e.scrollHeight<=e.clientHeight+1&&delete e.dataset.pagesOffset}),function(){let e,o=0;const r=new URL(location.href);r.searchParams.delete("paged"),H.forEach(i=>{if(b){if(t(".pagesjs-front",i))return;t(Ce,i)&&(e="")}const a=+i.dataset.pagesOffset||1;a>1&&d(i,"page-multiple"),o+=a,d(i,"page-"+(o%2==0?"even":"odd"));const c={pageNumber:o,mainTitle:W,pageTitle:e,pageUrl:i===H.at(-1)&&r.href};[i.children[0],s(i)].forEach(e=>{for(const t in c)c[t]&&(e.dataset[t]=c[t])}),e=He([...n(Ce,i)].pop())||e})}(),n('#TOC a[href^="#"]').forEach(t=>{const n=e.getElementById(t.getAttribute("href").slice(1))?.closest(".pagesjs-page");t.dataset.pageNumber=n?.children[0].dataset.pageNumber??""}),w.remove(),U?.remove(),V=!0;const o=H.filter(e=>e.classList.contains("page-multiple")).length;console.info(`pages.js: ${H.length} pages in ${Math.round(performance.now()-E)} ms`+(o?`; ${o} overflow their page`:"")),m("pagesjs:after")}I=e=>(I=null,F&&(F.forEach(e=>e.forEach(je)),F.forEach(e=>e.forEach(e=>e.remove())),k.innerHTML="",O=null,z=[],p(S,"pagesjs-settle"),F=null),q=y(),Me(e||l)),c?I(!0):function(e,t){return d(S,"pagesjs-settle"),e.forEach((e,n)=>{z=Z(e),O=null,ee().append(...t[n])}),F=t,new Promise(e=>{const t=setTimeout(e,500);let n=0;!function o(){requestAnimationFrame(()=>++n<3?o():(clearTimeout(t),e()))}()})}(v,N).then(()=>I?.())}h("beforeprint",()=>{if(I)I(!0);else if(q)for(;!q.next().done;);else we(!0)}),h("pagesjs:paginate",()=>{V?m("pagesjs:after"):we()});const Se=new URLSearchParams(location.search);Se.get("paged")&&we(),h("keypress",e=>{"p"===e.key&&(Se.get("paged")?(Se.delete("paged"),location.href=location.pathname+(Se.size?`?${Se}`:"")):(we(),Se.set("paged",1),history.replaceState({},"",`${location.pathname}?${Se}`)))})})(document);
2
2
  //# sourceMappingURL=pages.min.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["d","$","s","el","querySelector","$$","querySelectorAll","nChild","childElementCount","book","length","atomic","fr_cls","fr_1","fr_2","tb","map","i","parseFloat","getComputedStyle","documentElement","getPropertyValue","tpl","createElement","boxes","wrapped","WeakSet","hold","className","innerHTML","style","display","box","box_body","box_ctx","H","B","H_min","main_title","probed","pending","running","progress","finished","wrap","n_done","newPage","insertAdjacentHTML","cloneNode","children","includes","push","trailingMargin","body","m","e","lastElementChild","cs","Math","max","marginBottom","paddingBottom","borderBottomWidth","pageHeight","getBoundingClientRect","height","overflows","scrollHeight","nextPage","callback","cur","after","finish","h","dataset","pagesOffset","n","ceil","concat","offsetHeight","reduce","m1","m2","nPages","n2","calcPages","remove","textContent","ancestors","a","parentNode","unshift","ctx","contains","p","c","classList","add","appendChild","removeBlank","tagName","v","innerText","trim","fill","more","append","slice","endFrag","isBigBlock","split","undefined","place","container","kind","k","t","test","breakInside","matches","tBodies","inFlow","firstElementChild","codeLines","some","isInline","kindOf","prev","hasPrev","first","r","splitters","head","rest","blank","getElementsByTagName","previousElementSibling","float","position","nodeType","startsWith","inTextFlow","pre","open","replace","line","start","join","pop","reverse","mark","forEach","cut","block","has","isConnected","run","flush","nodeValue","before","childNodes","wrapRuns","item","partial","firstChild","big","prepend","fitLastPiece","moveTrailingHeadings","moveShortHead","fixOlStart","inline","ends","createRange","node","walker","createTreeWalker","NodeFilter","SHOW_TEXT","SHOW_ELEMENT","newLine","rect","bottom","top","right","left","nextNode","nextSibling","selectNodeContents","rects","getClientRects","lineOffset","lineStarts","cutLine","loc","setStartBefore","setStart","setEnd","extractContents","last","lastChild","table","tb2","rows","min","tHead","tFoot","over","limit","lo","hi","mid","code","lines","kids","tail","filter","j","indexOf","code2","bottoms","data","fitLines","shortTitle","ps","advance","sync","performance","now","next","done","Promise","go","requestAnimationFrame","setTimeout","then","paginate","quiet","navigator","userAgent","webdriver","readyState","addEventListener","cls","dispatchEvent","Event","pagesFront","insertAdjacentElement","clientHeight","window","innerHeight","H0","measureMinHeight","previousSibling","pageNumber","roots","sel","pagesRoot","x","main","articles","closest","findRoots","els","ch","detachContent","entries","child","replaceWith","fillPages","page_title","N","info","mainTitle","pageTitle","ft","key","numberPages","CSS","escape","getAttribute","tick","clearTimeout","probe","SP","URLSearchParams","location","search","get","delete","href","pathname","size","set","history","replaceState","document"],"sources":["pages.js"],"mappings":"AAkBA,CAACA,IAIC,SAAUC,EAAEC,EAAGC,EAAKH,GAAK,OAAOG,GAAIC,cAAcF,EAAI,CACtD,SAASG,EAAGH,EAAGC,EAAKH,GAAK,OAAOG,EAAKA,EAAGG,iBAAiBJ,GAAK,EAAI,CAClE,SAASK,EAAOJ,GAAM,OAAOA,EAAGK,iBAAmB,CAInD,MACEC,EAAOJ,EAAG,MAAMK,OAAS,EAEzBC,EAAS,0GAETC,EAAS,qBAAsBC,EAAO,iBAAkBC,EAAO,gBAK/DC,EAAK,CAAC,MAAO,UAAUC,IAAIC,GACzBC,WAAWC,iBAAiBnB,EAAEoB,iBAAiBC,iBAAiB,kBAAkBJ,OAAS,GAG7FK,EAAMtB,EAAEuB,cAAc,OACtBC,EAAQ,GACRC,EAAU,IAAIC,QACdC,EAAO3B,EAAEuB,cAAc,OACzBD,EAAIM,UAAY,eAChBN,EAAIO,UAAY,2GAGhBF,EAAKG,MAAMC,QAAU,OAErB,IACEC,EAAKC,EACL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Mc,UAAU6J,EAAItP,MAE5DsB,EAASgO,EACF,IAAIhC,QAAQD,IACjB,MAAMlH,EAAIsH,WAAWJ,EAAM,KAC3B,IAAI1J,EAAI,GACR,SAAU6M,IACRhD,sBAAsB,MAAQ7J,EAAI,EAAI6M,KAAUC,aAAatK,GAAIkH,KAClE,CAFD,IAIJ,CAwLyBqD,CAAM5B,EAAOQ,GAAK5B,KAAK,IAAMnM,MACtD,CACA0M,iBAAiB,cAAe,KAC9B,GAAI1M,EAASA,GAAQ,QAChB,GAAIC,EAAS,MAAQA,EAAQ4L,OAAOC,YACpCM,IAAS,KAKhBM,iBAAiB,mBAAoB,KACnCvM,EAAWyM,cAAc,IAAIC,MAAM,kBAAoBT,OAGzD,MAAMgD,GAAK,IAAIC,gBAAgBC,SAASC,QACxCH,GAAGI,IAAI,UAAYpD,KACnBM,iBAAiB,WAAY3L,IACb,MAAVA,EAAE6N,MACAQ,GAAGI,IAAI,UACTJ,GAAGK,OAAO,SAAUH,SAASI,KAAOJ,SAASK,UAAYP,GAAGQ,KAAO,IAAIR,KAAO,MAE9EhD,KACAgD,GAAGS,IAAI,QAAS,GAAIC,QAAQC,aAAa,CAAC,EAAG,GAAI,GAAGT,SAASK,YAAYP,SAIhF,EArtBD,CAqtBGY","ignoreList":[]}
1
+ {"version":3,"names":["d","$","s","el","querySelector","$$","querySelectorAll","nChild","childElementCount","kids","children","firstEl","firstElementChild","lastEl","lastElementChild","rect","getBoundingClientRect","style","getComputedStyle","num","v","parseFloat","has","c","classList","contains","addCls","add","rmCls","remove","make","tag","cls","createElement","className","range","createRange","on","type","fn","addEventListener","fire","dispatchEvent","Event","book","length","atomic","fr_cls","fr_1","fr_2","tb","map","i","documentElement","getPropertyValue","tpl","boxes","wrapped","WeakSet","guessed","notes","Map","probeY","WeakMap","hold","innerHTML","display","box","box_body","box_ctx","H","B","H_min","H_line","used","main_title","probed","pending","running","progress","finished","wrap","n_done","newPage","insertAdjacentHTML","cloneNode","includes","push","trailingMargin","body","m","e","cs","Math","max","marginBottom","paddingBottom","borderBottomWidth","pageHeight","syncNotes","height","overflows","scrollHeight","b","items","flatMap","get","after","some","replaceChildren","nextPage","callback","cur","finish","h","dataset","pagesOffset","n","ceil","concat","offsetHeight","reduce","m1","m2","nPages","n2","calcPages","textContent","ancestors","a","parentNode","unshift","ctx","p","appendChild","removeBlank","tagName","innerText","trim","fill","more","append","slice","endFrag","isBigBlock","split","undefined","place","container","kind","k","t","test","breakInside","matches","tBodies","inFlow","codeLines","isInline","kindOf","prev","hasPrev","first","r","splitters","head","rest","blank","getElementsByTagName","previousElementSibling","float","position","nodeType","startsWith","inTextFlow","pre","open","replace","line","start","join","pop","reverse","mark","forEach","cut","block","isConnected","run","flush","nodeValue","before","childNodes","wrapRuns","item","partial","firstChild","big","fitting","siblings","prepend","fitLastPiece","moveTrailingHeadings","moveShortHead","fixOlStart","inline","ends","node","walker","createTreeWalker","NodeFilter","SHOW_TEXT","SHOW_ELEMENT","newLine","bottom","top","right","left","nextNode","nextSibling","rc","selectNodeContents","rects","getClientRects","lineOffset","lineStarts","cutLine","loc","setStartBefore","setStart","setEnd","extractContents","last","lastChild","table","tb2","rows","min","cap","caption","captionSide","clear","tHead","tFoot","over","limit","lo","hi","mid","code","lines","ch","tail","filter","j","indexOf","code2","bottoms","data","fitLines","nodes","root","y0","y","y1","rejoin","markY","set","shortTitle","ps","ownText","canBeRoot","advance","sync","performance","now","next","done","Promise","go","requestAnimationFrame","setTimeout","then","paginate","quiet","navigator","userAgent","webdriver","readyState","t0","pagesFront","insertAdjacentElement","clientHeight","window","innerHeight","H0","measureMinHeight","previousSibling","pageNumber","hidden","replaceWith","roots","sel","pagesRoot","x","main","articles","closest","findRoots","els","detachContent","entries","list","fillPages","nextElementSibling","page_title","u","URL","location","href","searchParams","delete","N","info","mainTitle","pageTitle","pageUrl","at","key","numberPages","getElementById","getAttribute","console","round","tick","clearTimeout","probe","SP","URLSearchParams","search","pathname","size","history","replaceState","document"],"sources":["pages.js"],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SAAUyN,IACRtD,sBAAsB,MAAQnK,EAAI,EAAIyN,KAAUC,aAAaxL,GAAI8H,KAClE,CAFD,IAIJ,CAyNyB2D,CAAMnC,EAAOQ,GAAK3B,KAAK,IAAM7M,MACtD,CACAxC,EAAG,cAAe,KAChB,GAAIwC,EAASA,GAAQ,QAChB,GAAIC,EAAS,MAAQA,EAAQsM,OAAOC,YACpCM,IAAS,KAKhBtP,EAAG,mBAAoB,KACrB2C,EAAWvC,EAAK,iBAAmBkP,OAGrC,MAAMsD,GAAK,IAAIC,gBAAgBpB,SAASqB,QACxCF,GAAGvO,IAAI,UAAYiL,KACnBtP,EAAG,WAAYsD,IACC,MAAVA,EAAE6O,MACAS,GAAGvO,IAAI,UACTuO,GAAGhB,OAAO,SAAUH,SAASC,KAAOD,SAASsB,UAAYH,GAAGI,KAAO,IAAIJ,KAAO,MAE9EtD,KACAsD,GAAGtE,IAAI,QAAS,GAAI2E,QAAQC,aAAa,CAAC,EAAG,GAAI,GAAGzB,SAASsB,YAAYH,SAIhF,EAr1BD,CAq1BGO","ignoreList":[]}
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@xiee/utils",
3
- "version": "1.14.135",
3
+ "version": "1.14.137",
4
4
  "description": "Miscellaneous tools and utilities to manipulate HTML pages",
5
5
  "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
6
+ "test": "playwright test"
7
7
  },
8
8
  "repository": {
9
9
  "type": "git",
@@ -23,5 +23,9 @@
23
23
  "bugs": {
24
24
  "url": "https://github.com/yihui/lite.js/issues"
25
25
  },
26
- "homepage": "https://github.com/yihui/lite.js#readme"
26
+ "homepage": "https://github.com/yihui/lite.js#readme",
27
+ "type": "module",
28
+ "devDependencies": {
29
+ "@playwright/test": "^1.64.1"
30
+ }
27
31
  }
@@ -1,10 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: "github-actions"
4
- directory: "/"
5
- schedule:
6
- interval: "monthly"
7
- groups:
8
- all-dependencies:
9
- patterns:
10
- - "*"
@@ -1,26 +0,0 @@
1
- name: Node.js Package
2
-
3
- on:
4
- push:
5
- tags:
6
- - 'v*'
7
-
8
- permissions:
9
- id-token: write # Required for OIDC
10
- contents: read
11
-
12
- jobs:
13
- build:
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: actions/checkout@v7
17
- with:
18
- fetch-depth: 0
19
- fetch-tags: true
20
- - uses: actions/setup-node@v7
21
- with:
22
- registry-url: 'https://registry.npmjs.org'
23
- - run: sudo npm install -g npm@latest
24
- - run: ./build.sh
25
- - run: npm publish
26
- - run: ./purge.sh