@xiee/utils 1.13.67 → 1.13.69
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/css/pages.css +4 -6
- package/css/pages.min.css +1 -1
- package/css/pages.min.css.map +1 -1
- package/js/math-code.js +2 -2
- package/js/math-code.min.js +1 -1
- package/js/math-code.min.js.map +1 -1
- package/js/pages.js +98 -66
- package/js/pages.min.js +1 -1
- package/js/pages.min.js.map +1 -1
- package/package.json +1 -1
package/css/pages.css
CHANGED
|
@@ -41,9 +41,7 @@
|
|
|
41
41
|
height: var(--paper-height);
|
|
42
42
|
padding: var(--paper-margin-top) var(--paper-margin-right) var(--paper-margin-bottom) var(--paper-margin-left);
|
|
43
43
|
break-after: page;
|
|
44
|
-
|
|
45
|
-
display: flex;
|
|
46
|
-
}
|
|
44
|
+
display: flex;
|
|
47
45
|
flex-direction: column;
|
|
48
46
|
justify-content: space-between;
|
|
49
47
|
overflow: hidden;
|
|
@@ -57,7 +55,7 @@
|
|
|
57
55
|
border: none;
|
|
58
56
|
padding: 0;
|
|
59
57
|
margin-left: auto;
|
|
60
|
-
&:not(.
|
|
58
|
+
&:not(.chapter-toc):is(.fragment-first, :not(.pagesjs-fragmented))::before {
|
|
61
59
|
content: "Contents";
|
|
62
60
|
display: block;
|
|
63
61
|
font-weight: bold;
|
|
@@ -84,12 +82,12 @@
|
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
& > .pagesjs-body > .pagesjs-fragmented {
|
|
87
|
-
&:first
|
|
85
|
+
&:not(.fragment-first) {
|
|
88
86
|
&, & .pagesjs-fragmented {
|
|
89
87
|
border-top: none;
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
|
-
&:last
|
|
90
|
+
&:not(.fragment-last) {
|
|
93
91
|
&, & .pagesjs-fragmented {
|
|
94
92
|
border-bottom: none;
|
|
95
93
|
}
|
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;& .frontmatter,& .chapter{min-height:unset;box-shadow:none}&>*,&:not(:has(.frontmatter)):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;overflow:hidden
|
|
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;& .frontmatter,& .chapter{min-height:unset;box-shadow:none}&>*,&:not(:has(.frontmatter)):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}&>ul{columns:18em}& a{display:flex;&:after{content:attr(data-page-number);align-self:end}& .section-number{margin-right:.3em}& .dot-leader{border-bottom:1px dashed;flex:1 0 2em;margin:0 1ex 1ex}}}&>.pagesjs-body>.pagesjs-fragmented{&:not(.fragment-first){&,& .pagesjs-fragmented{border-top:none}}&:not(.fragment-last){&,& .pagesjs-fragmented{border-bottom:none}}}& .fullwidth{float:none;max-width:none;width:var(--paper-width);margin-left:calc(0px - var(--paper-margin-left));transform:none}& .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-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;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{height:auto;& .pagesjs-body:has(.footnotes){margin-bottom:1em}}}}@media print{.pagesjs{gap:0;margin:0;& .page-multiple{height:auto;padding-top:0;padding-bottom:0}}}
|
|
2
2
|
/*# sourceMappingURL=pages.min.css.map */
|
package/css/pages.min.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,0PAYA,0DAIA,2FAIA,6BAGA,wGAQE,2DAIA,oFAGA,
|
|
1
|
+
{"version":3,"mappings":"AAAA,0PAYA,0DAIA,2FAIA,6BAGA,wGAQE,2DAIA,oFAGA,iRASE,qBAGA,iFAGA,8CAIE,4JAOA,kBAGA,iBAEE,sDAIA,oCAGA,uEAOJ,oCACE,uBACE,yCAIF,sBACE,6CAKJ,gIAOA,iFAMA,wFAEE,sDAIF,2FAGA,wCAMJ,0FAKA,2GAIE,uCAGA,uCAIF,uGAIE,qBAGA,wCAIF,4CAIA,mBACE,SACE,wCAGA,gCAGA,kCAIF,+BAEE,4BAEE,qDAMN,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 .frontmatter, .chapter {\n min-height: unset;\n box-shadow: none;\n }\n & > *, &:not(:has(.frontmatter)):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 & > ul {\n columns: 18em;\n }\n a {\n display: flex;\n &::after {\n content: attr(data-page-number);\n align-self: end;\n }\n .section-number {\n margin-right: .3em;\n }\n .dot-leader {\n flex: 1 0 2em;\n border-bottom: dashed 1px;\n margin: 0 1ex 1ex;\n }\n }\n }\n & > .pagesjs-body > .pagesjs-fragmented {\n &:not(.fragment-first) {\n &, & .pagesjs-fragmented {\n border-top: none;\n }\n }\n &:not(.fragment-last) {\n &, & .pagesjs-fragmented {\n border-bottom: none;\n }\n }\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::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-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 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 height: auto;\n .pagesjs-body:has(.footnotes) {\n margin-bottom: 1em;\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":[]}
|
package/js/math-code.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// <code>$math$</code> to \(math\), and <code>$$math$$</code> to $$math$$:
|
|
2
2
|
// https://yihui.org/en/2018/07/latex-math-markdown/
|
|
3
|
-
|
|
3
|
+
document.querySelectorAll(':not(pre) > code:not(.nolatex)').forEach(code => {
|
|
4
4
|
// skip <pre> tags and <code> that has children or the nolatex class
|
|
5
|
-
if (code.
|
|
5
|
+
if (code.childElementCount > 0) return;
|
|
6
6
|
let text = code.textContent;
|
|
7
7
|
if (/^\$[^$]/.test(text) && /[^$]\$$/.test(text)) {
|
|
8
8
|
text = text.replace(/^\$/, '\\(').replace(/\$$/, '\\)');
|
package/js/math-code.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
document.querySelectorAll(":not(pre) > code:not(.nolatex)").forEach((t=>{if(t.childElementCount>0)return;let e=t.textContent;/^\$[^$]/.test(e)&&/[^$]\$$/.test(e)&&(e=e.replace(/^\$/,"\\(").replace(/\$$/,"\\)"),t.textContent=e),(/^\\\((.|\s)+\\\)$/.test(e)||/^\\\[(.|\s)+\\\]$/.test(e)||/^\$(.|\s)+\$$/.test(e)||/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(e))&&(t.outerHTML=t.innerHTML)}));
|
|
2
2
|
//# sourceMappingURL=math-code.min.js.map
|
package/js/math-code.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["document","
|
|
1
|
+
{"version":3,"names":["document","querySelectorAll","forEach","code","childElementCount","text","textContent","test","replace","outerHTML","innerHTML"],"sources":["math-code.js"],"mappings":"AAEAA,SAASC,iBAAiB,kCAAkCC,SAAQC,IAElE,GAAIA,EAAKC,kBAAoB,EAAG,OAChC,IAAIC,EAAOF,EAAKG,YACZ,UAAUC,KAAKF,IAAS,UAAUE,KAAKF,KACzCA,EAAOA,EAAKG,QAAQ,MAAO,OAAOA,QAAQ,MAAO,OACjDL,EAAKG,YAAcD,IAEjB,oBAAoBE,KAAKF,IAAS,oBAAoBE,KAAKF,IAC3D,gBAAgBE,KAAKF,IACrB,4CAA4CE,KAAKF,MACnDF,EAAKM,UAAYN,EAAKO,UACxB","ignoreList":[]}
|
package/js/pages.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
function nChild(el) { return el.childElementCount; }
|
|
7
7
|
|
|
8
8
|
const tpl = d.createElement('div'), book = $$('h1').length > 1, boxes = [],
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
fr_cls = 'pagesjs-fragmented', fr_1 = 'fragment-first', fr_2 = 'fragment-last',
|
|
10
|
+
tb = ['top', 'bottom'].map(i => {
|
|
11
11
|
const v = getComputedStyle(d.documentElement).getPropertyValue(`--paper-margin-${i}`);
|
|
12
12
|
return +v.replace('px', '') || 0;
|
|
13
13
|
}); // top/bottom page margin
|
|
@@ -15,30 +15,36 @@
|
|
|
15
15
|
tpl.innerHTML = `<div class="pagesjs-header"></div>
|
|
16
16
|
<div class="pagesjs-body"></div>
|
|
17
17
|
<div class="pagesjs-footer"></div>`;
|
|
18
|
-
let box, box_body, H,
|
|
18
|
+
let box, box_body, box_cls = [], box_n = 0, H, h_code, l_code = [];
|
|
19
19
|
function newPage(el) {
|
|
20
|
+
const n = boxes.length;
|
|
21
|
+
// finish previous n - 1 boxes
|
|
22
|
+
if (n - box_n > 1) {
|
|
23
|
+
boxes.slice(box_n, n - 1).forEach(finish);
|
|
24
|
+
box_n = n - 1;
|
|
25
|
+
}
|
|
20
26
|
el && !$('.pagesjs-body', el) && el.insertAdjacentHTML('afterbegin', tpl.innerHTML);
|
|
21
27
|
box = el || tpl.cloneNode(true); box_body = box.children[1];
|
|
22
28
|
box_cls.length && box.classList.add(...box_cls);
|
|
23
|
-
boxes.push(box); // store new pages in boxes
|
|
29
|
+
boxes.includes(box) || boxes.push(box); // store new pages in boxes
|
|
24
30
|
return box;
|
|
25
31
|
}
|
|
26
|
-
|
|
32
|
+
// compute page numbers and temporarily remove the box
|
|
33
|
+
function finish(box) {
|
|
27
34
|
const h = box.scrollHeight;
|
|
28
35
|
if (h > H && !box.dataset.pagesOffset) {
|
|
29
36
|
const n = calcPages(box, h);
|
|
30
37
|
if (n > 1) box.dataset.pagesOffset = n;
|
|
31
38
|
}
|
|
32
|
-
box.
|
|
39
|
+
box.remove();
|
|
33
40
|
}
|
|
34
|
-
function removeBlank(el) {
|
|
41
|
+
function removeBlank(el, html = false) {
|
|
35
42
|
if (!el) return false;
|
|
36
|
-
const v = el.innerText.trim() === '';
|
|
43
|
+
const v = (html ? el.innerHTML : el.innerText).trim() === '';
|
|
37
44
|
v && el.remove();
|
|
38
45
|
return v;
|
|
39
46
|
}
|
|
40
47
|
function fill(el) {
|
|
41
|
-
const n1 = boxes.length;
|
|
42
48
|
// if the element is already a page, just use it as the box
|
|
43
49
|
if (el.classList.contains('pagesjs-page')) {
|
|
44
50
|
box.after(newPage(el));
|
|
@@ -49,26 +55,31 @@
|
|
|
49
55
|
box.after(newPage()); // create a new empty page
|
|
50
56
|
}
|
|
51
57
|
} else {
|
|
52
|
-
// create a new box when too much content (exceeding original height)
|
|
53
|
-
if (box.scrollHeight > H) {
|
|
54
|
-
const [box2, box_body2] = [box, box_body]; // store old box
|
|
55
|
-
box2.after(newPage());
|
|
56
|
-
// if there's more than one child in the box, move the last child to next box
|
|
57
|
-
nChild(box_body2) > 1 && box_body.append(box_body2.lastChild);
|
|
58
|
-
}
|
|
59
58
|
box_body.append(el);
|
|
59
|
+
if (box.scrollHeight <= H) return;
|
|
60
|
+
const cls = el.classList, h0 = el.innerHTML, n0 = boxes.length;
|
|
60
61
|
fragment(el);
|
|
62
|
+
// remove empty pages
|
|
63
|
+
if (el.tagName === 'PRE') for (let i = boxes.length - 1; i >= n0; i--) {
|
|
64
|
+
removeBlank(boxes[i]) && boxes.splice(i, 1);
|
|
65
|
+
}
|
|
66
|
+
// if el can be fragmented, add class *-last, otherwise remove class (e.g.,
|
|
67
|
+
// current box can't even hold el's first child so move whole el to new box)
|
|
68
|
+
(cls.contains(fr_cls) && el.innerHTML !== h0) ? cls.add(fr_2) :
|
|
69
|
+
[el].concat(...$$(`.${fr_cls}`, el)).forEach(el => el.classList.remove(fr_cls, fr_1));
|
|
70
|
+
l_code = []; // clean up code lines
|
|
61
71
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
}
|
|
73
|
+
function fillCode(el, i1, i2) {
|
|
74
|
+
el.innerHTML = l_code.slice(i1, i2).join('\n');
|
|
65
75
|
}
|
|
66
76
|
// break elements that are relatively easy to break (such as <ul>)
|
|
67
77
|
function fragment(el, container, parent, page) {
|
|
68
|
-
const tag = el.tagName,
|
|
78
|
+
const tag = el.tagName, cls = el.classList, frag = cls.contains(fr_cls);
|
|
79
|
+
parent || frag && cls.remove(fr_1);
|
|
69
80
|
// if <code>, keep fragmenting; otherwise exit when box fits
|
|
70
|
-
if (!
|
|
71
|
-
|
|
81
|
+
if (!l_code.length && box.scrollHeight <= H) return;
|
|
82
|
+
parent ? cls.add(fr_cls) : (frag || cls.add(fr_cls, fr_1));
|
|
72
83
|
const box_cur = page || box, el2 = el.cloneNode(); // shallow clone (wrapper only)
|
|
73
84
|
// add the clone to current box, and move original el to next box
|
|
74
85
|
container ? container.append(el2) : (
|
|
@@ -77,21 +88,36 @@
|
|
|
77
88
|
// fragment <pre>'s <code> and <div>'s single child (e.g., #TOC > ul)
|
|
78
89
|
if (tag === 'PRE') {
|
|
79
90
|
const code = el.firstElementChild;
|
|
80
|
-
if (code?.tagName
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
if (code?.tagName == 'CODE') {
|
|
92
|
+
const initial = l_code.length;
|
|
93
|
+
// store all lines in l_code
|
|
94
|
+
if (!initial) l_code = code.innerHTML.split('\n');
|
|
95
|
+
let n_code = l_code.length;
|
|
96
|
+
if (n_code > 1 && l_code[n_code - 1] === '') n_code -= 1; // ignore trailing \n
|
|
97
|
+
if (n_code > 1) {
|
|
98
|
+
if (!initial) h_code = code.offsetHeight / n_code; // approx line height
|
|
99
|
+
code.innerHTML = ''; // temporarily empty <code>; will use l_code
|
|
100
|
+
if (fragment(code, el2, el, box_cur)) {
|
|
101
|
+
// exit if the rest of lines are empty
|
|
102
|
+
if (l_code.join('').trim() === '') {
|
|
103
|
+
el2.before(el); el.innerHTML = el2.innerHTML; el2.remove();
|
|
104
|
+
boxes.pop().remove(); newPage(boxes[boxes.length - 1]); l_code = [];
|
|
105
|
+
}
|
|
106
|
+
if (!l_code.length) return; fragment(el);
|
|
107
|
+
} else {
|
|
108
|
+
// the current page can't hold the block; fragment it on next page
|
|
109
|
+
el2.remove(); [code, el].forEach(el => el.classList.remove(fr_cls, fr_1));
|
|
110
|
+
fragment(el);
|
|
111
|
+
}
|
|
112
|
+
} else fillCode(code, 0);
|
|
88
113
|
}
|
|
114
|
+
return removeBlank(el2);
|
|
89
115
|
} else if (tag === 'DIV' && nChild(el) === 1) {
|
|
90
116
|
fragment(el.firstElementChild, el2, el, box_cur);
|
|
91
117
|
}
|
|
92
118
|
const prev = el2.previousElementSibling;
|
|
93
119
|
// keep moving el's first item to el2 until page height > H
|
|
94
|
-
if (['UL', 'OL', 'BLOCKQUOTE'].includes(tag) && nChild(el) > 1) while (true) {
|
|
120
|
+
if (['UL', 'OL', 'BLOCKQUOTE', 'FIELDSET'].includes(tag) && nChild(el) > 1) while (true) {
|
|
95
121
|
const item = el.firstChild;
|
|
96
122
|
if (!item) break;
|
|
97
123
|
el2.append(item);
|
|
@@ -106,37 +132,40 @@
|
|
|
106
132
|
}
|
|
107
133
|
}
|
|
108
134
|
// split lines in <code> and try to move as many lines into el2 as possible
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
for (i = 0; i < tops.length; i++) {
|
|
119
|
-
if (tops[i + 1] - tops[0] > delta) break;
|
|
135
|
+
if (container && tag === 'CODE') {
|
|
136
|
+
// figure out how many lines can fit the box via bisection
|
|
137
|
+
let i = 0, i1 = 1, i2 = n = l_code.length;
|
|
138
|
+
const sols = []; // solutions tried
|
|
139
|
+
while (i2 - i1 > 1) {
|
|
140
|
+
fillCode(el2, 0, i || 1);
|
|
141
|
+
const delta = H - box_cur.offsetHeight;
|
|
142
|
+
if (delta === 0) {
|
|
143
|
+
i1 = i || 1; break;
|
|
120
144
|
}
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
i += dir; fillCode();
|
|
127
|
-
if (box_cur.scrollHeight > H) {
|
|
128
|
-
i += -1; fillCode(); break;
|
|
145
|
+
if (delta < 0) {
|
|
146
|
+
if (i <= 0) break;
|
|
147
|
+
i2 = i;
|
|
148
|
+
} else {
|
|
149
|
+
i1 = i;
|
|
129
150
|
}
|
|
151
|
+
sols.push(i);
|
|
152
|
+
// estimate the number of (more or less) lines needed
|
|
153
|
+
const i3 = i + Math.round(delta / h_code);
|
|
154
|
+
// if a solution has been tried, shorten step and (in/de)crement by 1
|
|
155
|
+
i = sols.includes(i3) ? i + (delta > 0 ? 1 : -1) : i3;
|
|
156
|
+
(delta > 0 && i >= n) && (i2 = n + 1, i = n); // solution may be n
|
|
130
157
|
}
|
|
131
158
|
if (i > 0) {
|
|
132
|
-
|
|
133
|
-
|
|
159
|
+
fillCode(el2, 0, i1); l_code.splice(0, i1);
|
|
160
|
+
} else {
|
|
161
|
+
el2.innerHTML = ''; fillCode(el, 0); l_code = []; // not fragmented
|
|
134
162
|
}
|
|
163
|
+
return i > 0;
|
|
135
164
|
}
|
|
136
|
-
const el2_empty = removeBlank(el2);
|
|
165
|
+
const el2_empty = removeBlank(el2, true);
|
|
166
|
+
el2_empty && cls.remove(fr_cls, fr_1);
|
|
137
167
|
// if the clone is empty, remove it, otherwise keep fragmenting the remaining el
|
|
138
|
-
el2_empty
|
|
139
|
-
if (!el2_empty || is_code || prev) fragment(container ? parent : el);
|
|
168
|
+
if (!el2_empty || prev) fragment(container ? parent : el);
|
|
140
169
|
}
|
|
141
170
|
|
|
142
171
|
// use data-short-title of a header if exists, and fall back to inner text
|
|
@@ -193,26 +222,29 @@
|
|
|
193
222
|
a.dataset.pageNumber = '000'; // placeholder for page numbers
|
|
194
223
|
});
|
|
195
224
|
|
|
225
|
+
const els = [];
|
|
226
|
+
$$('.body').forEach(el => {
|
|
227
|
+
const ch = [...el.children];
|
|
228
|
+
els.push(ch); ch.forEach(el => el.remove());
|
|
229
|
+
});
|
|
196
230
|
// iteratively add elements to pages
|
|
197
|
-
|
|
198
|
-
|
|
231
|
+
$$('.frontmatter, .abstract, #TOC:not(.chapter-toc)').forEach(el => {
|
|
232
|
+
(fill(el), book && box.after(newPage()));
|
|
199
233
|
});
|
|
200
|
-
$$('.body').forEach(el => {
|
|
234
|
+
$$('.body').forEach((el, i) => {
|
|
201
235
|
// preserve book chapter classes if exist
|
|
202
236
|
box_cls = ['chapter', 'appendix'].filter(i => el.classList.contains(i));
|
|
203
237
|
book && (box.innerText === '' ? newPage(box) : box.after(newPage()));
|
|
204
|
-
[
|
|
238
|
+
els[i].forEach(fill);
|
|
205
239
|
// clean up container and self if empty
|
|
206
240
|
removeBlank(el.parentNode); removeBlank(el);
|
|
207
241
|
});
|
|
208
|
-
boxes.forEach(
|
|
209
|
-
$$(`pre > code i.${cd_cls}`).forEach(el => el.remove());
|
|
242
|
+
boxes.slice(box_n).forEach(finish); // finish the rest of pages
|
|
210
243
|
cls.remove('pagesjs-filling');
|
|
211
244
|
|
|
212
245
|
// add page number, title, etc. to data-* attributes of page elements
|
|
213
246
|
let page_title, i = 0;
|
|
214
|
-
|
|
215
|
-
if (removeBlank(box)) return; // remove empty pages
|
|
247
|
+
boxes.forEach(box => {
|
|
216
248
|
if (book) {
|
|
217
249
|
if ($('.frontmatter', box)) return; // skip book frontmatter page
|
|
218
250
|
$(ps, box) && (page_title = ''); // empty title for first page of chapter
|
|
@@ -236,15 +268,15 @@
|
|
|
236
268
|
});
|
|
237
269
|
});
|
|
238
270
|
|
|
271
|
+
// unhide all pages
|
|
272
|
+
d.body.prepend(...boxes);
|
|
273
|
+
|
|
239
274
|
// add page numbers to TOC with data-* attributes
|
|
240
275
|
$$('#TOC a[href^="#"]').forEach(a => {
|
|
241
276
|
const id = CSS.escape(a.getAttribute('href').replace(/^#/, '')),
|
|
242
277
|
p = $(`.pagesjs-page:has(#${id}) .pagesjs-header`);
|
|
243
278
|
a.dataset.pageNumber = p ? p.dataset.pageNumber : '';
|
|
244
279
|
});
|
|
245
|
-
|
|
246
|
-
// unhide all pages
|
|
247
|
-
$$('.pagesjs-done').forEach(box => box.classList.remove('pagesjs-done'));
|
|
248
280
|
}
|
|
249
281
|
addEventListener('beforeprint', paginate);
|
|
250
282
|
// persistent pagination upon page reload (press p again to cancel it)
|
package/js/pages.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(e=>{function t(t,n=e){return n?.querySelector(t)}function
|
|
1
|
+
(e=>{function t(t,n=e){return n?.querySelector(t)}function s(t,n=e){return n?n.querySelectorAll(t):[]}function r(e){return e.childElementCount}const a=e.createElement("div"),i=s("h1").length>1,o=[],c="pagesjs-fragmented",l="fragment-first",f=["top","bottom"].map((t=>+getComputedStyle(e.documentElement).getPropertyValue(`--paper-margin-${t}`).replace("px","")||0));a.className="pagesjs-page",a.innerHTML='<div class="pagesjs-header"></div>\n<div class="pagesjs-body"></div>\n<div class="pagesjs-footer"></div>';let d,p,h,g,u=[],m=0,E=[];function L(e){const n=o.length;return n-m>1&&(o.slice(m,n-1).forEach(b),m=n-1),e&&!t(".pagesjs-body",e)&&e.insertAdjacentHTML("afterbegin",a.innerHTML),d=e||a.cloneNode(!0),p=d.children[1],u.length&&d.classList.add(...u),o.includes(d)||o.push(d),d}function b(e){const t=e.scrollHeight;if(t>h&&!e.dataset.pagesOffset){const n=function(e,t){let n=+e.dataset.pagesOffset;if(n)return n;if(n=Math.ceil(t/h),n<=1)return n;const r=f.concat([...s("thead",e)].map((e=>+e.offsetHeight))).reduce(((e,t)=>e+t));if(!r)return n;function a(){return Math.ceil((t+(n-1)*r)/h)}let i=a();for(;i>n;)n=i,i=a();return n}(e,t);n>1&&(e.dataset.pagesOffset=n)}e.remove()}function T(e,t=!1){if(!e)return!1;const n=""===(t?e.innerHTML:e.innerText).trim();return n&&e.remove(),n}function v(e){if(e.classList.contains("pagesjs-page"))d.after(L(e)),r(e)>3&&(p.append(...[...e.children].slice(3)),d.after(L()));else{if(p.append(e),d.scrollHeight<=h)return;const t=e.classList,n=e.innerHTML,r=o.length;if(j(e),"PRE"===e.tagName)for(let e=o.length-1;e>=r;e--)T(o[e])&&o.splice(e,1);t.contains(c)&&e.innerHTML!==n?t.add("fragment-last"):[e].concat(...s(`.${c}`,e)).forEach((e=>e.classList.remove(c,l))),E=[]}}function H(e,t,n){e.innerHTML=E.slice(t,n).join("\n")}function j(e,t,s,a){const i=e.tagName,f=e.classList,u=f.contains(c);if(s||u&&f.remove(l),!E.length&&d.scrollHeight<=h)return;s?f.add(c):u||f.add(c,l);const m=a||d,b=e.cloneNode();if(t?t.append(b):(p.append(b),m.after(L()),p.append(e)),"PRE"===i){const t=e.firstElementChild;if("CODE"==t?.tagName){const n=E.length;n||(E=t.innerHTML.split("\n"));let s=E.length;if(s>1&&""===E[s-1]&&(s-=1),s>1)if(n||(g=t.offsetHeight/s),t.innerHTML="",j(t,b,e,m)){if(""===E.join("").trim()&&(b.before(e),e.innerHTML=b.innerHTML,b.remove(),o.pop().remove(),L(o[o.length-1]),E=[]),!E.length)return;j(e)}else b.remove(),[t,e].forEach((e=>e.classList.remove(c,l))),j(e);else H(t,0)}return T(b)}"DIV"===i&&1===r(e)&&j(e.firstElementChild,b,e,m);const v=b.previousElementSibling;if(["UL","OL","BLOCKQUOTE","FIELDSET"].includes(i)&&r(e)>1)for(;;){const t=e.firstChild;if(!t)break;if(b.append(t),!t.nodeName.startsWith("#")&&m.scrollHeight>h){(v||r(b)>1)&&e.insertBefore(t,e.firstChild),"OL"===i&&(e.start+=r(b));break}}if(t&&"CODE"===i){let t=0,s=1,r=n=E.length;const a=[];for(;r-s>1;){H(b,0,t||1);const e=h-m.offsetHeight;if(0===e){s=t||1;break}if(e<0){if(t<=0)break;r=t}else s=t;a.push(t);const i=t+Math.round(e/g);t=a.includes(i)?t+(e>0?1:-1):i,e>0&&t>=n&&(r=n+1,t=n)}return t>0?(H(b,0,s),E.splice(0,s)):(b.innerHTML="",H(e,0),E=[]),t>0}const M=T(b,!0);M&&f.remove(c,l),M&&!v||j(t?s:e)}function M(e){return e&&(e.dataset.shortTitle||e.innerText)}const C=M(t("h1.title, .frontmatter h1, .title, h1")),y=(i?"h1":"h2")+":not(.frontmatter *)";function O(){if("complete"!==e.readyState)return setTimeout(O,10);const n=e.body.classList;if(n.contains("pagesjs"))return;n.add("pagesjs"),e.body.insertAdjacentElement("afterbegin",L()),h=d.clientHeight||window.innerHeight,s(":is(#TOC, .footnotes, .chapter-before, .chapter-after):is(.side-left, .side-right).side").forEach((e=>{e.classList.remove("side","side-left","side-right")})),n.add("pagesjs-filling"),s('#TOC a[href^="#"]').forEach((t=>{const n=e.createElement("span"),s=t.firstElementChild;for(s?.classList.contains("section-number")?s.after(n):t.insertAdjacentElement("afterbegin",n);n.nextSibling;)n.append(n.nextSibling);t.insertAdjacentHTML("beforeend",'<span class="dot-leader"></span>'),t.dataset.pageNumber="000"}));const r=[];s(".body").forEach((e=>{const t=[...e.children];r.push(t),t.forEach((e=>e.remove()))})),s(".frontmatter, .abstract, #TOC:not(.chapter-toc)").forEach((e=>{v(e),i&&d.after(L())})),s(".body").forEach(((e,t)=>{u=["chapter","appendix"].filter((t=>e.classList.contains(t))),i&&(""===d.innerText?L(d):d.after(L())),r[t].forEach(v),T(e.parentNode),T(e)})),o.slice(m).forEach(b),n.remove("pagesjs-filling");let a,c=0;o.forEach((e=>{if(i){if(t(".frontmatter",e))return;t(y,e)&&(a="")}const n=+e.dataset.pagesOffset||1;n>1&&e.classList.add("page-multiple"),c+=n,e.classList.add("page-"+(c%2==0?"even":"odd"));const r={pageNumber:c,mainTitle:C,pageTitle:a};let o;[e.children[0],e.children[2]].forEach((e=>{for(const t in r)r[t]&&(e.dataset[t]=r[t])})),a=M([...s(y,e)].pop())||a,s(".footnotes",e).forEach(((t,n)=>{0===n?(o=t,e.children[1].after(t)):(o.append(...t.children),t.remove())}))})),e.body.prepend(...o),s('#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:""}))}addEventListener("beforeprint",O);let N=sessionStorage.getItem("pagesjs");N&&O(),addEventListener("keypress",(e=>"p"===e.key&&(O(),N=N?"":"1",sessionStorage.setItem("pagesjs",N),N||location.reload())))})(document);
|
|
2
2
|
//# sourceMappingURL=pages.min.js.map
|
package/js/pages.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["d","$","s","el","querySelector","$$","querySelectorAll","nChild","childElementCount","tpl","createElement","book","length","boxes","
|
|
1
|
+
{"version":3,"names":["d","$","s","el","querySelector","$$","querySelectorAll","nChild","childElementCount","tpl","createElement","book","length","boxes","fr_cls","fr_1","tb","map","i","getComputedStyle","documentElement","getPropertyValue","replace","className","innerHTML","box","box_body","H","h_code","box_cls","box_n","l_code","newPage","n","slice","forEach","finish","insertAdjacentHTML","cloneNode","children","classList","add","includes","push","h","scrollHeight","dataset","pagesOffset","Math","ceil","m","concat","offsetHeight","reduce","m1","m2","newPages","n2","calcPages","remove","removeBlank","html","v","innerText","trim","fill","contains","after","append","cls","h0","n0","fragment","tagName","splice","fillCode","i1","i2","join","container","parent","page","tag","frag","box_cur","el2","code","firstElementChild","initial","split","n_code","before","pop","prev","previousElementSibling","item","firstChild","nodeName","startsWith","insertBefore","start","sols","delta","i3","round","el2_empty","shortTitle","main","ps","paginate","readyState","setTimeout","body","insertAdjacentElement","clientHeight","window","innerHeight","a","nextSibling","pageNumber","els","ch","filter","parentNode","page_title","N","info","mainTitle","pageTitle","ft","key","prepend","p","CSS","escape","getAttribute","addEventListener","pg","sessionStorage","getItem","e","setItem","location","reload","document"],"sources":["pages.js"],"mappings":"AAEA,CAACA,IACC,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,CAEnD,MAAMC,EAAMT,EAAEU,cAAc,OAAQC,EAAON,EAAG,MAAMO,OAAS,EAAGC,EAAQ,GACtEC,EAAS,qBAAsBC,EAAO,iBACtCC,EAAK,CAAC,MAAO,UAAUC,KAAIC,IACfC,iBAAiBnB,EAAEoB,iBAAiBC,iBAAiB,kBAAkBH,KACvEI,QAAQ,KAAM,KAAO,IAEnCb,EAAIc,UAAY,eAChBd,EAAIe,UAAY,2GAGhB,IAAIC,EAAKC,EAAmCC,EAAGC,EAA5BC,EAAU,GAAIC,EAAQ,EAAcC,EAAS,GAChE,SAASC,EAAQ7B,GACf,MAAM8B,EAAIpB,EAAMD,OAUhB,OARIqB,EAAIH,EAAQ,IACdjB,EAAMqB,MAAMJ,EAAOG,EAAI,GAAGE,QAAQC,GAClCN,EAAQG,EAAI,GAEd9B,IAAOF,EAAE,gBAAiBE,IAAOA,EAAGkC,mBAAmB,aAAc5B,EAAIe,WACzEC,EAAMtB,GAAMM,EAAI6B,WAAU,GAAOZ,EAAWD,EAAIc,SAAS,GACzDV,EAAQjB,QAAUa,EAAIe,UAAUC,OAAOZ,GACvChB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