@xiee/utils 1.13.65 → 1.13.66

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/default.css CHANGED
@@ -51,8 +51,8 @@ hr, .footnotes::before { border: 1px dashed #ddd; }
51
51
  .frontmatter { text-align: center; }
52
52
  #TOC {
53
53
  a { text-decoration: none; }
54
- & > ul { padding: 0; }
55
54
  ul { list-style: none; padding-left: 1em; }
55
+ & > ul { padding: 0; }
56
56
  ul ul { border-left: 1px solid lightsteelblue; }
57
57
  }
58
58
  table:not([class]), .body h2 { border-bottom: 1px solid #666; }
@@ -1,2 +1,2 @@
1
- body{max-width:800px;margin:auto;padding:1em;font-family:sans-serif;line-height:1.5}body,.abstract,code,.footnotes,footer,#refs,.caption{font-size:.9em}li li{font-size:.95em}ul:has(li>input[type=checkbox]){padding-left:1em;list-style:none}*,:before,:after{box-sizing:border-box}a{color:#4682b4}pre,img{max-width:100%}pre{white-space:pre-wrap;word-break:break-word}pre code{padding:1em;display:block;overflow-x:auto}code{font-family:DejaVu Sans Mono,Droid Sans Mono,Lucida Console,Consolas,Monaco,monospace}:not(pre)>code,code[class],div>.caption{background-color:#f8f8f8}pre>code:is(:not([class]),.language-plain,.language-none,.plain),.box,.figure,.table{background-color:inherit;border:1px solid #eee}pre>code{&.message{border-color:#9eeaf9}&.warning{background:#fff3cd;border-color:#fff3cd}&.error{background:#f8d7da;border-color:#f8d7da}}.fenced-chunk{border-left:1px solid #666}.code-fence{opacity:.4;border:1px dashed #666;border-left:2px solid;&:hover{opacity:inherit}}.box,.figure,.table{margin:1em auto}div>.caption{padding:1px 1em}.figure{& p:has(img),& pre:has(svg){text-align:center}}.flex-col{justify-content:space-between;display:flex}table :is(th,td){font-variant-numeric:tabular-nums;padding:5px}table:not([class]){border-top:1px solid #666;margin:1em auto;& thead th{border-bottom:1px solid #ddd}}table:not([class]),.table-striped{& thead,& tfoot,& tr:nth-child(2n){background:#f5f5f5}}blockquote{color:#666;border-left:.5em solid #eee;margin:0;padding:1px 1em}hr,.footnotes:before{border:1px dashed #ddd}.frontmatter{text-align:center}#TOC{& a{text-decoration:none}&>ul{padding:0}& ul{padding-left:1em;list-style:none}& ul ul{border-left:1px solid #b0c4de}}table:not([class]),.body h2{border-bottom:1px solid #666}.body .appendix,.appendix~h2{border-bottom-style:dashed}.main-number:after{content:"."}span[class^=ref-number-]{font-weight:700}.ref-number-fig:after,.ref-number-tab:after{content:":"}.cross-ref-chp:before{content:"Chapter "}.cross-ref-sec:before{content:"Section "}.cross-ref-fig:before,.ref-number-fig:before{content:"Figure "}.cross-ref-tab:before,.ref-number-tab:before{content:"Table "}.cross-ref-eqn:before,.MathJax_ref:has(mjx-mtext>mjx-c+mjx-c):before{content:"Equation "}.abstract,#refs{&:before{margin:1em auto;font-weight:700;display:block}}.abstract:before{content:"Abstract";text-align:center}#refs:before{content:"Bibliography";font-size:1.5em}.ref-paren-open:before{content:"("}.ref-paren-close:after{content:")"}.ref-semicolon:after{content:"; "}.ref-and:after{content:" and "}.ref-et-al:after{content:" et al.";font-style:italic}.footnote-ref a{&:before{content:"["}&:after{content:"]"}}section.footnotes{margin-top:2em;&:before{content:"";max-width:20em;display:block}}.fade{opacity:.6;background:repeating-linear-gradient(135deg,#fff,#fff 30px,#ddd 32px 32px)}@media print{body{max-width:100%}tr,img{break-inside:avoid}}@media only screen and (width>=992px){body:not(.pagesjs) pre:has(.line-numbers):not(:hover){white-space:pre}}
1
+ body{max-width:800px;margin:auto;padding:1em;font-family:sans-serif;line-height:1.5}body,.abstract,code,.footnotes,footer,#refs,.caption{font-size:.9em}li li{font-size:.95em}ul:has(li>input[type=checkbox]){padding-left:1em;list-style:none}*,:before,:after{box-sizing:border-box}a{color:#4682b4}pre,img{max-width:100%}pre{white-space:pre-wrap;word-break:break-word}pre code{padding:1em;display:block;overflow-x:auto}code{font-family:DejaVu Sans Mono,Droid Sans Mono,Lucida Console,Consolas,Monaco,monospace}:not(pre)>code,code[class],div>.caption{background-color:#f8f8f8}pre>code:is(:not([class]),.language-plain,.language-none,.plain),.box,.figure,.table{background-color:inherit;border:1px solid #eee}pre>code{&.message{border-color:#9eeaf9}&.warning{background:#fff3cd;border-color:#fff3cd}&.error{background:#f8d7da;border-color:#f8d7da}}.fenced-chunk{border-left:1px solid #666}.code-fence{opacity:.4;border:1px dashed #666;border-left:2px solid;&:hover{opacity:inherit}}.box,.figure,.table{margin:1em auto}div>.caption{padding:1px 1em}.figure{& p:has(img),& pre:has(svg){text-align:center}}.flex-col{justify-content:space-between;display:flex}table :is(th,td){font-variant-numeric:tabular-nums;padding:5px}table:not([class]){border-top:1px solid #666;margin:1em auto;& thead th{border-bottom:1px solid #ddd}}table:not([class]),.table-striped{& thead,& tfoot,& tr:nth-child(2n){background:#f5f5f5}}blockquote{color:#666;border-left:.5em solid #eee;margin:0;padding:1px 1em}hr,.footnotes:before{border:1px dashed #ddd}.frontmatter{text-align:center}#TOC{& a{text-decoration:none}& ul{padding-left:1em;list-style:none}&>ul{padding:0}& ul ul{border-left:1px solid #b0c4de}}table:not([class]),.body h2{border-bottom:1px solid #666}.body .appendix,.appendix~h2{border-bottom-style:dashed}.main-number:after{content:"."}span[class^=ref-number-]{font-weight:700}.ref-number-fig:after,.ref-number-tab:after{content:":"}.cross-ref-chp:before{content:"Chapter "}.cross-ref-sec:before{content:"Section "}.cross-ref-fig:before,.ref-number-fig:before{content:"Figure "}.cross-ref-tab:before,.ref-number-tab:before{content:"Table "}.cross-ref-eqn:before,.MathJax_ref:has(mjx-mtext>mjx-c+mjx-c):before{content:"Equation "}.abstract,#refs{&:before{margin:1em auto;font-weight:700;display:block}}.abstract:before{content:"Abstract";text-align:center}#refs:before{content:"Bibliography";font-size:1.5em}.ref-paren-open:before{content:"("}.ref-paren-close:after{content:")"}.ref-semicolon:after{content:"; "}.ref-and:after{content:" and "}.ref-et-al:after{content:" et al.";font-style:italic}.footnote-ref a{&:before{content:"["}&:after{content:"]"}}section.footnotes{margin-top:2em;&:before{content:"";max-width:20em;display:block}}.fade{opacity:.6;background:repeating-linear-gradient(135deg,#fff,#fff 30px,#ddd 32px 32px)}@media print{body{max-width:100%}tr,img{break-inside:avoid}}@media only screen and (width>=992px){body:not(.pagesjs) pre:has(.line-numbers):not(:hover){white-space:pre}}
2
2
  /*# sourceMappingURL=default.min.css.map */
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,oFAOA,oEACA,sBACA,iEACA,uCACA,gBACA,uBACA,+CACA,mDACA,2FACA,iEACA,oIACA,SACE,+BACA,kDACA,iDAEF,yCACA,oEAIE,yBAEF,oCACA,6BACA,QAAU,+CACV,qDACA,+DACA,6DAGE,yCAEF,kCACE,uDAEF,2EAMA,4CACA,+BACA,KACE,yBACA,eACA,sCACA,uCAEF,yDACA,wDACA,+BACA,yCACA,wDACA,yCACA,yCACA,+DACA,8DACA,yFACA,gBACE,wDAEF,sDACA,oDACA,mCACA,mCACA,kCACA,+BACA,qDACA,gBACE,qBACA,qBAEF,iCAEE,kDAEF,4FAKA,aACE,oBACA,2BAEF,sCACE","sources":["default.css"],"sourcesContent":["body {\n font-family: sans-serif;\n max-width: 800px;\n margin: auto;\n padding: 1em;\n line-height: 1.5;\n}\nbody, .abstract, code, .footnotes, footer, #refs, .caption { font-size: .9em; }\nli li { font-size: .95em; }\nul:has(li > input[type=\"checkbox\"]) { list-style: none; padding-left: 1em; }\n*, :before, :after { box-sizing: border-box; }\na { color: steelblue; }\npre, img { max-width: 100%; }\npre { white-space: pre-wrap; word-break: break-word; }\npre code { display: block; padding: 1em; overflow-x: auto; }\ncode { font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace; }\n:not(pre) > code, code[class], div > .caption { background-color: #f8f8f8; }\npre > code:is(:not([class]), .language-plain, .language-none, .plain), .box, .figure, .table { background-color: inherit; border: 1px solid #eee; }\npre > code {\n &.message { border-color: #9eeaf9; }\n &.warning { background: #fff3cd; border-color: #fff3cd; }\n &.error { background: #f8d7da; border-color: #f8d7da; }\n}\n.fenced-chunk { border-left: 1px solid #666; }\n.code-fence {\n opacity: .4;\n border: 1px dashed #666;\n border-left: 2px solid;\n &:hover { opacity: inherit; }\n}\n.box, .figure, .table { margin: 1em auto; }\ndiv > .caption { padding: 1px 1em; }\n.figure { p:has(img), pre:has(svg) { text-align: center; } }\n.flex-col { display: flex; justify-content: space-between; }\ntable :is(th, td) { padding: 5px; font-variant-numeric: tabular-nums; }\ntable:not([class]) {\n margin: 1em auto;\n border-top: 1px solid #666;\n thead th { border-bottom: 1px solid #ddd; }\n}\ntable:not([class]), .table-striped {\n thead, tfoot, tr:nth-child(even) { background: whitesmoke; }\n}\nblockquote {\n color: #666;\n margin: 0;\n padding: 1px 1em;\n border-left: .5em solid #eee;\n}\nhr, .footnotes::before { border: 1px dashed #ddd; }\n.frontmatter { text-align: center; }\n#TOC {\n a { text-decoration: none; }\n & > ul { padding: 0; }\n ul { list-style: none; padding-left: 1em; }\n ul ul { border-left: 1px solid lightsteelblue; }\n}\ntable:not([class]), .body h2 { border-bottom: 1px solid #666; }\n.body .appendix, .appendix ~ h2 { border-bottom-style: dashed; }\n.main-number::after { content: \".\"; }\nspan[class^=\"ref-number-\"] { font-weight: bold; }\n.ref-number-fig::after, .ref-number-tab::after { content: \":\"; }\n.cross-ref-chp::before { content: \"Chapter \"; }\n.cross-ref-sec::before { content: \"Section \"; }\n.cross-ref-fig::before, .ref-number-fig::before { content: \"Figure \"; }\n.cross-ref-tab::before, .ref-number-tab::before { content: \"Table \"; }\n.cross-ref-eqn::before, .MathJax_ref:has(mjx-mtext > mjx-c + mjx-c)::before { content: \"Equation \"; }\n.abstract, #refs {\n &::before { display: block; margin: 1em auto; font-weight: bold; }\n}\n.abstract::before { content: \"Abstract\"; text-align: center; }\n#refs::before { content: \"Bibliography\"; font-size: 1.5em; }\n.ref-paren-open::before { content: \"(\"; }\n.ref-paren-close::after { content: \")\"; }\n.ref-semicolon::after { content: \"; \"; }\n.ref-and::after { content: \" and \"; }\n.ref-et-al::after { content: \" et al.\"; font-style: italic; }\n.footnote-ref a {\n &::before { content: \"[\"; }\n &::after { content: \"]\"; }\n}\nsection.footnotes {\n margin-top: 2em;\n &::before { content: \"\"; display: block; max-width: 20em; }\n}\n.fade {\n background: repeating-linear-gradient(135deg, white, white 30px, #ddd 32px, #ddd 32px);\n opacity: 0.6;\n}\n\n@media print {\n body { max-width: 100%; }\n tr, img { break-inside: avoid; }\n}\n@media only screen and (min-width: 992px) {\n body:not(.pagesjs) pre:has(.line-numbers):not(:hover) { white-space: pre; }\n}\n"],"names":[]}
1
+ {"version":3,"mappings":"AAAA,oFAOA,oEACA,sBACA,iEACA,uCACA,gBACA,uBACA,+CACA,mDACA,2FACA,iEACA,oIACA,SACE,+BACA,kDACA,iDAEF,yCACA,oEAIE,yBAEF,oCACA,6BACA,QAAU,+CACV,qDACA,+DACA,6DAGE,yCAEF,kCACE,uDAEF,2EAMA,4CACA,+BACA,KACE,yBACA,sCACA,eACA,uCAEF,yDACA,wDACA,+BACA,yCACA,wDACA,yCACA,yCACA,+DACA,8DACA,yFACA,gBACE,wDAEF,sDACA,oDACA,mCACA,mCACA,kCACA,+BACA,qDACA,gBACE,qBACA,qBAEF,iCAEE,kDAEF,4FAKA,aACE,oBACA,2BAEF,sCACE","sources":["default.css"],"sourcesContent":["body {\n font-family: sans-serif;\n max-width: 800px;\n margin: auto;\n padding: 1em;\n line-height: 1.5;\n}\nbody, .abstract, code, .footnotes, footer, #refs, .caption { font-size: .9em; }\nli li { font-size: .95em; }\nul:has(li > input[type=\"checkbox\"]) { list-style: none; padding-left: 1em; }\n*, :before, :after { box-sizing: border-box; }\na { color: steelblue; }\npre, img { max-width: 100%; }\npre { white-space: pre-wrap; word-break: break-word; }\npre code { display: block; padding: 1em; overflow-x: auto; }\ncode { font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace; }\n:not(pre) > code, code[class], div > .caption { background-color: #f8f8f8; }\npre > code:is(:not([class]), .language-plain, .language-none, .plain), .box, .figure, .table { background-color: inherit; border: 1px solid #eee; }\npre > code {\n &.message { border-color: #9eeaf9; }\n &.warning { background: #fff3cd; border-color: #fff3cd; }\n &.error { background: #f8d7da; border-color: #f8d7da; }\n}\n.fenced-chunk { border-left: 1px solid #666; }\n.code-fence {\n opacity: .4;\n border: 1px dashed #666;\n border-left: 2px solid;\n &:hover { opacity: inherit; }\n}\n.box, .figure, .table { margin: 1em auto; }\ndiv > .caption { padding: 1px 1em; }\n.figure { p:has(img), pre:has(svg) { text-align: center; } }\n.flex-col { display: flex; justify-content: space-between; }\ntable :is(th, td) { padding: 5px; font-variant-numeric: tabular-nums; }\ntable:not([class]) {\n margin: 1em auto;\n border-top: 1px solid #666;\n thead th { border-bottom: 1px solid #ddd; }\n}\ntable:not([class]), .table-striped {\n thead, tfoot, tr:nth-child(even) { background: whitesmoke; }\n}\nblockquote {\n color: #666;\n margin: 0;\n padding: 1px 1em;\n border-left: .5em solid #eee;\n}\nhr, .footnotes::before { border: 1px dashed #ddd; }\n.frontmatter { text-align: center; }\n#TOC {\n a { text-decoration: none; }\n ul { list-style: none; padding-left: 1em; }\n & > ul { padding: 0; }\n ul ul { border-left: 1px solid lightsteelblue; }\n}\ntable:not([class]), .body h2 { border-bottom: 1px solid #666; }\n.body .appendix, .appendix ~ h2 { border-bottom-style: dashed; }\n.main-number::after { content: \".\"; }\nspan[class^=\"ref-number-\"] { font-weight: bold; }\n.ref-number-fig::after, .ref-number-tab::after { content: \":\"; }\n.cross-ref-chp::before { content: \"Chapter \"; }\n.cross-ref-sec::before { content: \"Section \"; }\n.cross-ref-fig::before, .ref-number-fig::before { content: \"Figure \"; }\n.cross-ref-tab::before, .ref-number-tab::before { content: \"Table \"; }\n.cross-ref-eqn::before, .MathJax_ref:has(mjx-mtext > mjx-c + mjx-c)::before { content: \"Equation \"; }\n.abstract, #refs {\n &::before { display: block; margin: 1em auto; font-weight: bold; }\n}\n.abstract::before { content: \"Abstract\"; text-align: center; }\n#refs::before { content: \"Bibliography\"; font-size: 1.5em; }\n.ref-paren-open::before { content: \"(\"; }\n.ref-paren-close::after { content: \")\"; }\n.ref-semicolon::after { content: \"; \"; }\n.ref-and::after { content: \" and \"; }\n.ref-et-al::after { content: \" et al.\"; font-style: italic; }\n.footnote-ref a {\n &::before { content: \"[\"; }\n &::after { content: \"]\"; }\n}\nsection.footnotes {\n margin-top: 2em;\n &::before { content: \"\"; display: block; max-width: 20em; }\n}\n.fade {\n background: repeating-linear-gradient(135deg, white, white 30px, #ddd 32px, #ddd 32px);\n opacity: 0.6;\n}\n\n@media print {\n body { max-width: 100%; }\n tr, img { break-inside: avoid; }\n}\n@media only screen and (min-width: 992px) {\n body:not(.pagesjs) pre:has(.line-numbers):not(:hover) { white-space: pre; }\n}\n"],"names":[]}
@@ -1,2 +1,4 @@
1
- .anchor { display: none; }
2
- :hover > .anchor { display: inline; }
1
+ .anchor {
2
+ &:not(:hover > *) { display: none; }
3
+ & > a::before { content: "#"; }
4
+ }
@@ -1,2 +1,2 @@
1
- .anchor{display:none}:hover>.anchor{display:inline}
1
+ .anchor{&:not(:hover>*){display:none}&>a:before{content:"#"}}
2
2
  /*# sourceMappingURL=heading-anchor.min.css.map */
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,qBACA","sources":["heading-anchor.css"],"sourcesContent":[".anchor { display: none; }\n:hover > .anchor { display: inline; }\n"],"names":[]}
1
+ {"version":3,"mappings":"AAAA,QACE,6BACA","sources":["heading-anchor.css"],"sourcesContent":[".anchor {\n &:not(:hover > *) { display: none; }\n & > a::before { content: \"#\"; }\n}\n"],"names":[]}
@@ -1,4 +1,4 @@
1
1
  document.querySelectorAll('h1,h2,h3,h4,h5,h6').forEach(h => {
2
2
  if (h.id && !h.querySelector('.anchor'))
3
- h.insertAdjacentHTML('beforeend', ` <span class="anchor"><a href="#${h.id}">#</a></span>`);
3
+ h.insertAdjacentHTML('beforeend', ` <span class="anchor"><a href="#${h.id}"></a></span>`);
4
4
  });
@@ -1,2 +1,2 @@
1
- document.querySelectorAll("h1,h2,h3,h4,h5,h6").forEach((e=>{e.id&&!e.querySelector(".anchor")&&e.insertAdjacentHTML("beforeend",` <span class="anchor"><a href="#${e.id}">#</a></span>`)}));
1
+ document.querySelectorAll("h1,h2,h3,h4,h5,h6").forEach((e=>{e.id&&!e.querySelector(".anchor")&&e.insertAdjacentHTML("beforeend",` <span class="anchor"><a href="#${e.id}"></a></span>`)}));
2
2
  //# sourceMappingURL=heading-anchor.min.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["document","querySelectorAll","forEach","h","id","querySelector","insertAdjacentHTML"],"sources":["heading-anchor.js"],"mappings":"AAAAA,SAASC,iBAAiB,qBAAqBC,SAAQC,IACjDA,EAAEC,KAAOD,EAAEE,cAAc,YAC3BF,EAAEG,mBAAmB,YAAa,mCAAmCH,EAAEC,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["document","querySelectorAll","forEach","h","id","querySelector","insertAdjacentHTML"],"sources":["heading-anchor.js"],"mappings":"AAAAA,SAASC,iBAAiB,qBAAqBC,SAAQC,IACjDA,EAAEC,KAAOD,EAAEE,cAAc,YAC3BF,EAAEG,mBAAmB,YAAa,mCAAmCH,EAAEC,kBAAkB","ignoreList":[]}
package/js/pages.js CHANGED
@@ -5,7 +5,11 @@
5
5
  function $$(s, el = d) { return el ? el.querySelectorAll(s) : []; }
6
6
  function nChild(el) { return el.childElementCount; }
7
7
 
8
- const tpl = d.createElement('div'), book = $$('h1').length > 1, fr_cls = 'pagesjs-fragmented';
8
+ const tpl = d.createElement('div'), book = $$('h1').length > 1, boxes = [],
9
+ fr_cls = 'pagesjs-fragmented', tb = ['top', 'bottom'].map(i => {
10
+ const v = getComputedStyle(d.documentElement).getPropertyValue(`--paper-margin-${i}`);
11
+ return +v.replace('px', '') || 0;
12
+ }); // top/bottom page margin
9
13
  tpl.className = 'pagesjs-page';
10
14
  tpl.innerHTML = `<div class="pagesjs-header"></div>
11
15
  <div class="pagesjs-body"></div>
@@ -15,12 +19,16 @@
15
19
  el && !$('.pagesjs-body', el) && el.insertAdjacentHTML('afterbegin', tpl.innerHTML);
16
20
  box = el || tpl.cloneNode(true); box_body = box.children[1];
17
21
  box_cls.length && box.classList.add(...box_cls);
22
+ boxes.push(box); // store new pages in boxes
18
23
  return box;
19
24
  }
20
- function testHeight(box, done) {
21
- const ret = box.scrollHeight > H;
22
- (done || ret) && box.classList.add('pagesjs-done');
23
- return ret;
25
+ function addOffset(box) {
26
+ const h = box.scrollHeight;
27
+ if (h > H && !box.dataset.pagesOffset) {
28
+ const n = calcPages(box, h);
29
+ if (n > 1) box.dataset.pagesOffset = n;
30
+ }
31
+ box.classList.add('pagesjs-done');
24
32
  }
25
33
  function removeBlank(el) {
26
34
  if (!el) return false;
@@ -29,6 +37,7 @@
29
37
  return v;
30
38
  }
31
39
  function fill(el) {
40
+ const n1 = boxes.length;
32
41
  // if the element is already a page, just use it as the box
33
42
  if (el.classList.contains('pagesjs-page')) {
34
43
  box.after(newPage(el));
@@ -36,20 +45,22 @@
36
45
  if (nChild(el) > 3) {
37
46
  box_body.append(...[...el.children].slice(3));
38
47
  // TODO: should we fragment this page if it's too long?
39
- testHeight(box, true);
40
48
  box.after(newPage()); // create a new empty page
41
49
  }
42
- return;
43
- }
44
- // create a new box when too much content (exceeding original height)
45
- if (testHeight(box)) {
46
- const [box2, box_body2] = [box, box_body]; // store old box
47
- box2.after(newPage());
48
- // if there's more than one child in the box, move the last child to next box
49
- nChild(box_body2) > 1 && box_body.append(box_body2.lastChild);
50
+ } else {
51
+ // create a new box when too much content (exceeding original height)
52
+ if (box.scrollHeight > H) {
53
+ const [box2, box_body2] = [box, box_body]; // store old box
54
+ box2.after(newPage());
55
+ // if there's more than one child in the box, move the last child to next box
56
+ nChild(box_body2) > 1 && box_body.append(box_body2.lastChild);
57
+ }
58
+ box_body.append(el);
59
+ fragment(el);
50
60
  }
51
- box_body.append(el);
52
- fragment(el);
61
+ const n2 = boxes.length;
62
+ // mark all boxes (except the last one) with class 'pagesjs-done'
63
+ n2 > n1 && n2 > 1 && boxes.splice(0, n2 - 1).forEach(addOffset);
53
64
  }
54
65
  // break elements that are relatively easy to break (such as <ul>)
55
66
  function fragment(el, container, parent, page) {
@@ -77,7 +88,7 @@
77
88
  el2.append(item);
78
89
  // usually there's no need to re-calculate size if item is not element (e.g., white space)
79
90
  if (item.nodeName.startsWith('#')) continue;
80
- if (testHeight(box_cur)) {
91
+ if (box_cur.scrollHeight > H) {
81
92
  // move item back to el if the clone el2 is not the only element on page or has more than one child
82
93
  (prev || nChild(el2) > 1) && el.insertBefore(item, el.firstChild);
83
94
  // update the start number of <ol> on next page
@@ -90,7 +101,7 @@
90
101
  const code = el.innerHTML.split('\n'), code2 = [];
91
102
  for (let i of code) {
92
103
  code2.push(i); el2.innerHTML = code2.join('\n');
93
- if (testHeight(box_cur)) {
104
+ if (box_cur.scrollHeight > H) {
94
105
  code2.pop(); el2.innerHTML = code2.join('\n');
95
106
  break;
96
107
  }
@@ -111,19 +122,14 @@
111
122
  return h && (h.dataset.shortTitle || h.innerText);
112
123
  }
113
124
  const main = shortTitle($('h1.title, .frontmatter h1, .title, h1')), // main title
114
- ps = (book ? 'h1' : 'h2') + ':not(.frontmatter *)', // page title selector
115
- tb = ['top', 'bottom'].map(i => {
116
- const v = getComputedStyle(d.documentElement).getPropertyValue(`--paper-margin-${i}`);
117
- return +v.replace('px', '') || 0;
118
- }); // top/bottom page margin
125
+ ps = (book ? 'h1' : 'h2') + ':not(.frontmatter *)'; // page title selector
119
126
 
120
127
  // calculate how many new pages we need for overflowed content (this is just
121
128
  // an estimate; if not accurate, use <div class="pagesjs-page" data-pages-offset="N">
122
129
  // to provide a number manually)
123
- function calcPages(box) {
130
+ function calcPages(box, h) {
124
131
  let n = +box.dataset.pagesOffset;
125
132
  if (n) return n;
126
- const h = box.scrollHeight;
127
133
  n = Math.ceil(h/H);
128
134
  if (n <= 1) return n;
129
135
  // consider top/bottom page margin and table headers (which may be repeated on each page)
@@ -177,18 +183,18 @@
177
183
  // clean up container and self if empty
178
184
  removeBlank(el.parentNode); removeBlank(el);
179
185
  });
186
+ boxes.forEach(addOffset); // mark the rest of pages as done
180
187
  cls.remove('pagesjs-filling');
181
188
 
182
189
  // add page number, title, etc. to data-* attributes of page elements
183
190
  let page_title, i = 0;
184
191
  $$('.pagesjs-page').forEach(box => {
185
192
  if (removeBlank(box)) return; // remove empty pages
186
- box.classList.remove('pagesjs-done');
187
193
  if (book) {
188
194
  if ($('.frontmatter', box)) return; // skip book frontmatter page
189
195
  $(ps, box) && (page_title = ''); // empty title for first page of chapter
190
196
  }
191
- const N = calcPages(box);
197
+ const N = +box.dataset.pagesOffset || 1;
192
198
  if (N > 1) box.classList.add('page-multiple');
193
199
  i += N;
194
200
  box.classList.add(`page-${i % 2 === 0 ? 'even' : 'odd'}`);
@@ -213,6 +219,9 @@
213
219
  p = $(`.pagesjs-page:has(#${id}) .pagesjs-header`);
214
220
  a.dataset.pageNumber = p ? p.dataset.pageNumber : '';
215
221
  });
222
+
223
+ // unhide all pages
224
+ $$('.pagesjs-done').forEach(box => box.classList.remove('pagesjs-done'));
216
225
  }
217
226
  addEventListener('beforeprint', paginate);
218
227
  // 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 n(t,n=e){return n?n.querySelectorAll(t):[]}function s(e){return e.childElementCount}const r=e.createElement("div"),a=n("h1").length>1,i="pagesjs-fragmented";r.className="pagesjs-page",r.innerHTML='<div class="pagesjs-header"></div>\n<div class="pagesjs-body"></div>\n<div class="pagesjs-footer"></div>';let o,c,l,d=[];function f(e){return e&&!t(".pagesjs-body",e)&&e.insertAdjacentHTML("afterbegin",r.innerHTML),o=e||r.cloneNode(!0),c=o.children[1],d.length&&o.classList.add(...d),o}function p(e,t){const n=e.scrollHeight>l;return(t||n)&&e.classList.add("pagesjs-done"),n}function g(e){if(!e)return!1;const t=""===e.innerText.trim();return t&&e.remove(),t}function h(e){if(e.classList.contains("pagesjs-page"))return o.after(f(e)),void(s(e)>3&&(c.append(...[...e.children].slice(3)),p(o,!0),o.after(f())));if(p(o)){const[e,t]=[o,c];e.after(f()),s(t)>1&&c.append(t.lastChild)}c.append(e),u(e)}function u(e,t,n,r){const a=e.tagName,d="CODE"===a;if((!d||!t)&&o.scrollHeight<=l)return;e.classList.add(i);const h=r||o,m=e.cloneNode();if(t?t.append(m):(c.append(m),h.after(f()),c.append(e)),"PRE"===a){const t=e.firstElementChild;"CODE"==t?.tagName&&/\n/.test(t.innerHTML)&&u(t,m,e,h)}else"DIV"===a&&1===s(e)&&u(e.firstElementChild,m,e,h);const L=m.previousElementSibling;if(["UL","OL","BLOCKQUOTE"].includes(a)&&s(e)>1)for(;;){const t=e.firstChild;if(!t)break;if(m.append(t),!t.nodeName.startsWith("#")&&p(h)){(L||s(m)>1)&&e.insertBefore(t,e.firstChild),"OL"===a&&(e.start+=s(m));break}}if(d){const t=e.innerHTML.split("\n"),s=[];for(let e of t)if(s.push(e),m.innerHTML=s.join("\n"),p(h)){s.pop(),m.innerHTML=s.join("\n");break}if(s.length>0&&(e.innerHTML=t.slice(s.length).join("\n"),g(n)))return}const b=g(m);b&&e.classList.remove(i),(!b||d||L)&&u(t?n:e)}function m(e){return e&&(e.dataset.shortTitle||e.innerText)}const L=m(t("h1.title, .frontmatter h1, .title, h1")),b=(a?"h1":"h2")+":not(.frontmatter *)",j=["top","bottom"].map((t=>+getComputedStyle(e.documentElement).getPropertyValue(`--paper-margin-${t}`).replace("px","")||0));function E(){if("complete"!==e.readyState)return setTimeout(E,10);const s=e.body.classList;if(s.contains("pagesjs"))return;s.add("pagesjs"),e.body.insertAdjacentElement("afterbegin",f()),l=o.clientHeight||window.innerHeight,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"),n('#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"})),[t(".frontmatter"),t("#TOC"),t(".abstract")].forEach((e=>{e&&(h(e),a&&o.after(f()))})),n(".body").forEach((e=>{d=["chapter","appendix"].filter((t=>e.classList.contains(t))),a&&(""===o.innerText?f(o):o.after(f())),[...e.children].map(h),g(e.parentNode),g(e)})),s.remove("pagesjs-filling");let r,i=0;n(".pagesjs-page").forEach((e=>{if(g(e))return;if(e.classList.remove("pagesjs-done"),a){if(t(".frontmatter",e))return;t(b,e)&&(r="")}const s=function(e){let t=+e.dataset.pagesOffset;if(t)return t;const s=e.scrollHeight;if(t=Math.ceil(s/l),t<=1)return t;const r=j.concat([...n("thead",e)].map((e=>+e.offsetHeight))).reduce(((e,t)=>e+t));if(!r)return t;function a(){return Math.ceil((s+(t-1)*r)/l)}let i=a();for(;i>t;)t=i,i=a();return t}(e);s>1&&e.classList.add("page-multiple"),i+=s,e.classList.add("page-"+(i%2==0?"even":"odd"));const o={pageNumber:i,mainTitle:L,pageTitle:r};let c;[e.children[0],e.children[2]].forEach((e=>{for(const t in o)o[t]&&(e.dataset[t]=o[t])})),r=m([...n(b,e)].pop())||r,n(".footnotes",e).forEach(((t,n)=>{0===n?(c=t,e.children[1].after(t)):(c.append(...t.children),t.remove())}))})),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:""}))}addEventListener("beforeprint",E);let T=sessionStorage.getItem("pagesjs");T&&E(),addEventListener("keypress",(e=>"p"===e.key&&(E(),T=T?"":"1",sessionStorage.setItem("pagesjs",T),T||location.reload())))})(document);
1
+ (e=>{function t(t,n=e){return n?.querySelector(t)}function n(t,n=e){return n?n.querySelectorAll(t):[]}function s(e){return e.childElementCount}const a=e.createElement("div"),r=n("h1").length>1,i=[],o="pagesjs-fragmented",c=["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 l,d,f,p=[];function g(e){return e&&!t(".pagesjs-body",e)&&e.insertAdjacentHTML("afterbegin",a.innerHTML),l=e||a.cloneNode(!0),d=l.children[1],p.length&&l.classList.add(...p),i.push(l),l}function h(e){const t=e.scrollHeight;if(t>f&&!e.dataset.pagesOffset){const s=function(e,t){let s=+e.dataset.pagesOffset;if(s)return s;if(s=Math.ceil(t/f),s<=1)return s;const a=c.concat([...n("thead",e)].map((e=>+e.offsetHeight))).reduce(((e,t)=>e+t));if(!a)return s;function r(){return Math.ceil((t+(s-1)*a)/f)}let i=r();for(;i>s;)s=i,i=r();return s}(e,t);s>1&&(e.dataset.pagesOffset=s)}e.classList.add("pagesjs-done")}function u(e){if(!e)return!1;const t=""===e.innerText.trim();return t&&e.remove(),t}function m(e){const t=i.length;if(e.classList.contains("pagesjs-page"))l.after(g(e)),s(e)>3&&(d.append(...[...e.children].slice(3)),l.after(g()));else{if(l.scrollHeight>f){const[e,t]=[l,d];e.after(g()),s(t)>1&&d.append(t.lastChild)}d.append(e),E(e)}const n=i.length;n>t&&n>1&&i.splice(0,n-1).forEach(h)}function E(e,t,n,a){const r=e.tagName,i="CODE"===r;if((!i||!t)&&l.scrollHeight<=f)return;e.classList.add(o);const c=a||l,p=e.cloneNode();if(t?t.append(p):(d.append(p),c.after(g()),d.append(e)),"PRE"===r){const t=e.firstElementChild;"CODE"==t?.tagName&&/\n/.test(t.innerHTML)&&E(t,p,e,c)}else"DIV"===r&&1===s(e)&&E(e.firstElementChild,p,e,c);const h=p.previousElementSibling;if(["UL","OL","BLOCKQUOTE"].includes(r)&&s(e)>1)for(;;){const t=e.firstChild;if(!t)break;if(p.append(t),!t.nodeName.startsWith("#")&&c.scrollHeight>f){(h||s(p)>1)&&e.insertBefore(t,e.firstChild),"OL"===r&&(e.start+=s(p));break}}if(i){const t=e.innerHTML.split("\n"),s=[];for(let e of t)if(s.push(e),p.innerHTML=s.join("\n"),c.scrollHeight>f){s.pop(),p.innerHTML=s.join("\n");break}if(s.length>0&&(e.innerHTML=t.slice(s.length).join("\n"),u(n)))return}const m=u(p);m&&e.classList.remove(o),(!m||i||h)&&E(t?n:e)}function L(e){return e&&(e.dataset.shortTitle||e.innerText)}const j=L(t("h1.title, .frontmatter h1, .title, h1")),b=(r?"h1":"h2")+":not(.frontmatter *)";function T(){if("complete"!==e.readyState)return setTimeout(T,10);const s=e.body.classList;if(s.contains("pagesjs"))return;s.add("pagesjs"),e.body.insertAdjacentElement("afterbegin",g()),f=l.clientHeight||window.innerHeight,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"),n('#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"})),[t(".frontmatter"),t("#TOC"),t(".abstract")].forEach((e=>{e&&(m(e),r&&l.after(g()))})),n(".body").forEach((e=>{p=["chapter","appendix"].filter((t=>e.classList.contains(t))),r&&(""===l.innerText?g(l):l.after(g())),[...e.children].map(m),u(e.parentNode),u(e)})),i.forEach(h),s.remove("pagesjs-filling");let a,o=0;n(".pagesjs-page").forEach((e=>{if(u(e))return;if(r){if(t(".frontmatter",e))return;t(b,e)&&(a="")}const s=+e.dataset.pagesOffset||1;s>1&&e.classList.add("page-multiple"),o+=s,e.classList.add("page-"+(o%2==0?"even":"odd"));const i={pageNumber:o,mainTitle:j,pageTitle:a};let c;[e.children[0],e.children[2]].forEach((e=>{for(const t in i)i[t]&&(e.dataset[t]=i[t])})),a=L([...n(b,e)].pop())||a,n(".footnotes",e).forEach(((t,n)=>{0===n?(c=t,e.children[1].after(t)):(c.append(...t.children),t.remove())}))})),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:""})),n(".pagesjs-done").forEach((e=>e.classList.remove("pagesjs-done")))}addEventListener("beforeprint",T);let v=sessionStorage.getItem("pagesjs");v&&T(),addEventListener("keypress",(e=>"p"===e.key&&(T(),v=v?"":"1",sessionStorage.setItem("pagesjs",v),v||location.reload())))})(document);
2
2
  //# sourceMappingURL=pages.min.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["d","$","s","el","querySelector","$$","querySelectorAll","nChild","childElementCount","tpl","createElement","book","length","fr_cls","className","innerHTML","box","box_body","H","box_cls","newPage","insertAdjacentHTML","cloneNode","children","classList","add","testHeight","done","ret","scrollHeight","removeBlank","v","innerText","trim","remove","fill","contains","after","append","slice","box2","box_body2","lastChild","fragment","container","parent","page","tag","tagName","is_code","box_cur","el2","code","firstElementChild","test","prev","previousElementSibling","includes","item","firstChild","nodeName","startsWith","insertBefore","start","split","code2","i","push","join","pop","el2_empty","shortTitle","h","dataset","main","ps","tb","map","getComputedStyle","documentElement","getPropertyValue","replace","paginate","readyState","setTimeout","cls","body","insertAdjacentElement","clientHeight","window","innerHeight","forEach","a","n","nextSibling","pageNumber","filter","parentNode","page_title","N","pagesOffset","Math","ceil","m","concat","offsetHeight","reduce","m1","m2","newPages","n2","calcPages","info","mainTitle","pageTitle","ft","key","p","CSS","escape","getAttribute","addEventListener","pg","sessionStorage","getItem","e","setItem","location","reload","document"],"sources":["pages.js"],"mappings":"AAEA,CAACA,IACC,SAAUC,EAAEC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D,MAAM8C,EAAO,CACXjB,WAAc7B,EAAG+C,UAAavC,EAAMwC,UAAahB,GAOnD,IAAIiB,EALJ,CAACnG,EAAIO,SAAS,GAAIP,EAAIO,SAAS,IAAIoE,SAAQxF,IACzC,IAAK,MAAMiH,KAAOJ,EAAMA,EAAKI,KAASjH,EAAGsE,QAAQ2C,GAAOJ,EAAKI,GAAK,IAGpElB,EAAa3B,EAAW,IAAIlE,EAAGsE,EAAI3D,IAAMqD,QAAU6B,EAGnD7F,EAAG,aAAcW,GAAK2E,SAAQ,CAACxF,EAAI+D,KAC3B,IAANA,GAAWiD,EAAKhH,EAAIa,EAAIO,SAAS,GAAGc,MAAMlC,KAAQgH,EAAG7E,UAAUnC,EAAGoB,UAAWpB,EAAG+B,SAAS,GACzF,IAIJ7B,EAAG,qBAAqBsF,SAAQC,IAC9B,MACEyB,EAAIpH,EAAE,sBADGqH,IAAIC,OAAO3B,EAAE4B,aAAa,QAAQvC,QAAQ,KAAM,yBAE3DW,EAAEnB,QAAQsB,WAAasB,EAAIA,EAAE5C,QAAQsB,WAAa,EAAE,GAExD,CACA0B,iBAAiB,cAAevC,GAEhC,IAAIwC,EAAKC,eAAeC,QAAQ,WAChCF,GAAMxC,IACNuC,iBAAiB,YAAYI,GAAe,MAAVA,EAAET,MAClClC,IAAYwC,EAAKA,EAAK,GAAK,IAAKC,eAAeG,QAAQ,UAAWJ,GAAKA,GAAMK,SAASC,WAEzF,EA7ND,CA6NGC","ignoreList":[]}
1
+ {"version":3,"names":["d","$","s","el","querySelector","$$","querySelectorAll","nChild","childElementCount","tpl","createElement","book","length","boxes","fr_cls","tb","map","i","getComputedStyle","documentElement","getPropertyValue","replace","className","innerHTML","box","box_body","H","box_cls","newPage","insertAdjacentHTML","cloneNode","children","classList","add","push","addOffset","h","scrollHeight","dataset","pagesOffset","n","Math","ceil","m","concat","offsetHeight","reduce","m1","m2","newPages","n2","calcPages","removeBlank","v","innerText","trim","remove","fill","n1","contains","after","append","slice","box2","box_body2","lastChild","fragment","splice","forEach","container","parent","page","tag","tagName","is_code","box_cur","el2","code","firstElementChild","test","prev","previousElementSibling","includes","item","firstChild","nodeName","startsWith","insertBefore","start","split","code2","join","pop","el2_empty","shortTitle","main","ps","paginate","readyState","setTimeout","cls","body","insertAdjacentElement","clientHeight","window","innerHeight","a","nextSibling","pageNumber","filter","parentNode","page_title","N","info","mainTitle","pageTitle","ft","key","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,GACxEC,EAAS,qBAAsBC,EAAK,CAAC,MAAO,UAAUC,KAAIC,IAC5CC,iBAAiBlB,EAAEmB,iBAAiBC,iBAAiB,kBAAkBH,KACvEI,QAAQ,KAAM,KAAO,IAEnCZ,EAAIa,UAAY,eAChBb,EAAIc,UAAY,2GAGhB,IAAIC,EAAKC,EAAUC,EAAGC,EAAU,GAChC,SAASC,EAAQzB,GAKf,OAJAA,IAAOF,EAAE,gBAAiBE,IAAOA,EAAG0B,mBAAmB,aAAcpB,EAAIc,WACzEC,EAAMrB,GAAMM,EAAIqB,WAAU,GAAOL,EAAWD,EAAIO,SAAS,GACzDJ,EAAQf,QAAUY,EAAIQ,UAAUC,OAAON,GACvCd,EAAMqB,KAAKV,GACJA,CACT,CACA,SAASW,EAAUX,GACjB,MAAMY,EAAIZ,EAAIa,aACd,GAAID,EAAIV,IAAMF,EAAIc,QAAQC,YAAa,CACrC,MAAMC,EAsGV,SAAmBhB,EAAKY,GACtB,IAAII,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G,QAAQ,KAAM,yBAE3DqF,EAAEpE,QAAQsE,WAAaU,EAAIA,EAAEhF,QAAQsE,WAAa,EAAE,IAItDvG,EAAG,iBAAiB+D,SAAQ5C,GAAOA,EAAIQ,UAAUwB,OAAO,iBAC1D,CACAkE,iBAAiB,cAAezB,GAEhC,IAAI0B,EAAKC,eAAeC,QAAQ,WAChCF,GAAM1B,IACNyB,iBAAiB,YAAYI,GAAe,MAAVA,EAAET,MAClCpB,IAAY0B,EAAKA,EAAK,GAAK,IAAKC,eAAeG,QAAQ,UAAWJ,GAAKA,GAAMK,SAASC,WAEzF,EAtOD,CAsOGC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiee/utils",
3
- "version": "1.13.65",
3
+ "version": "1.13.66",
4
4
  "description": "Miscellaneous tools and utilities to manipulate HTML pages",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"