@xiee/utils 1.13.63 → 1.13.65
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 +1 -1
- package/css/default.min.css +1 -1
- package/css/default.min.css.map +1 -1
- package/css/pages.css +5 -3
- package/css/pages.min.css +1 -1
- package/css/pages.min.css.map +1 -1
- package/js/pages.js +10 -3
- package/js/pages.min.js +1 -1
- package/js/pages.min.js.map +1 -1
- package/package.json +1 -1
package/css/default.css
CHANGED
|
@@ -15,7 +15,7 @@ pre { white-space: pre-wrap; word-break: break-word; }
|
|
|
15
15
|
pre code { display: block; padding: 1em; overflow-x: auto; }
|
|
16
16
|
code { font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace; }
|
|
17
17
|
:not(pre) > code, code[class], div > .caption { background-color: #f8f8f8; }
|
|
18
|
-
pre > code:is(:not([class]), .language-plain, .language-none), .box, .figure, .table { background-color: inherit; border: 1px solid #eee; }
|
|
18
|
+
pre > code:is(:not([class]), .language-plain, .language-none, .plain), .box, .figure, .table { background-color: inherit; border: 1px solid #eee; }
|
|
19
19
|
pre > code {
|
|
20
20
|
&.message { border-color: #9eeaf9; }
|
|
21
21
|
&.warning { background: #fff3cd; border-color: #fff3cd; }
|
package/css/default.min.css
CHANGED
|
@@ -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),.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: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}}
|
|
2
2
|
/*# sourceMappingURL=default.min.css.map */
|
package/css/default.min.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,oFAOA,oEACA,sBACA,iEACA,uCACA,gBACA,uBACA,+CACA,mDACA,2FACA,iEACA,
|
|
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":[]}
|
package/css/pages.css
CHANGED
|
@@ -33,15 +33,17 @@
|
|
|
33
33
|
min-height: unset;
|
|
34
34
|
box-shadow: none;
|
|
35
35
|
}
|
|
36
|
-
&:not(:has(.frontmatter)):has(.chapter-toc) #TOC:not(.chapter-toc) {
|
|
36
|
+
& > *, &:not(:has(.frontmatter)):has(.chapter-toc) #TOC:not(.chapter-toc) {
|
|
37
37
|
display: none;
|
|
38
38
|
}
|
|
39
39
|
.pagesjs-page {
|
|
40
40
|
width: var(--paper-width);
|
|
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
|
-
|
|
44
|
-
|
|
43
|
+
break-after: page;
|
|
44
|
+
&:not(.pagesjs-done) {
|
|
45
|
+
display: flex;
|
|
46
|
+
}
|
|
45
47
|
flex-direction: column;
|
|
46
48
|
justify-content: space-between;
|
|
47
49
|
overflow: hidden;
|
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}
|
|
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;&:not(.pagesjs-done){display:flex}& img{max-width:100%}& .chapter-before,& .chapter-after,& .buttons:has(+.chapter-before){display:none}& #TOC{border:none;margin-left:auto;padding:0;&:not(.pagesjs-page:has(#TOC)~.pagesjs-page *):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}}}& .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-color:#f7f7f7}& .pagesjs-page{background-color:#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,
|
|
1
|
+
{"version":3,"mappings":"AAAA,0PAYA,0DAIA,2FAIA,6BAGA,wGAQE,2DAIA,oFAGA,oQAKE,kCAMA,qBAGA,iFAGA,8CAIE,yIAOA,kBAGA,iBAEE,sDAIA,oCAGA,uEAOJ,gIAOA,iFAMA,wFAEE,sDAIF,2FAGA,wCAMJ,0FAKA,2GAIE,uCAGA,uCAIF,uGAIE,qBAGA,wCAIF,4CAIA,mBACE,SACE,8CAGA,sCAGA,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 &:not(.pagesjs-done) {\n display: flex;\n }\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(.pagesjs-page:has(#TOC) ~ .pagesjs-page *)::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 .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-color: #f7f7f7;\n }\n .pagesjs-page {\n background-color: 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/pages.js
CHANGED
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
box_cls.length && box.classList.add(...box_cls);
|
|
18
18
|
return box;
|
|
19
19
|
}
|
|
20
|
+
function testHeight(box, done) {
|
|
21
|
+
const ret = box.scrollHeight > H;
|
|
22
|
+
(done || ret) && box.classList.add('pagesjs-done');
|
|
23
|
+
return ret;
|
|
24
|
+
}
|
|
20
25
|
function removeBlank(el) {
|
|
21
26
|
if (!el) return false;
|
|
22
27
|
const v = el.innerText.trim() === '';
|
|
@@ -31,12 +36,13 @@
|
|
|
31
36
|
if (nChild(el) > 3) {
|
|
32
37
|
box_body.append(...[...el.children].slice(3));
|
|
33
38
|
// TODO: should we fragment this page if it's too long?
|
|
39
|
+
testHeight(box, true);
|
|
34
40
|
box.after(newPage()); // create a new empty page
|
|
35
41
|
}
|
|
36
42
|
return;
|
|
37
43
|
}
|
|
38
44
|
// create a new box when too much content (exceeding original height)
|
|
39
|
-
if (box
|
|
45
|
+
if (testHeight(box)) {
|
|
40
46
|
const [box2, box_body2] = [box, box_body]; // store old box
|
|
41
47
|
box2.after(newPage());
|
|
42
48
|
// if there's more than one child in the box, move the last child to next box
|
|
@@ -71,7 +77,7 @@
|
|
|
71
77
|
el2.append(item);
|
|
72
78
|
// usually there's no need to re-calculate size if item is not element (e.g., white space)
|
|
73
79
|
if (item.nodeName.startsWith('#')) continue;
|
|
74
|
-
if (box_cur
|
|
80
|
+
if (testHeight(box_cur)) {
|
|
75
81
|
// move item back to el if the clone el2 is not the only element on page or has more than one child
|
|
76
82
|
(prev || nChild(el2) > 1) && el.insertBefore(item, el.firstChild);
|
|
77
83
|
// update the start number of <ol> on next page
|
|
@@ -84,7 +90,7 @@
|
|
|
84
90
|
const code = el.innerHTML.split('\n'), code2 = [];
|
|
85
91
|
for (let i of code) {
|
|
86
92
|
code2.push(i); el2.innerHTML = code2.join('\n');
|
|
87
|
-
if (box_cur
|
|
93
|
+
if (testHeight(box_cur)) {
|
|
88
94
|
code2.pop(); el2.innerHTML = code2.join('\n');
|
|
89
95
|
break;
|
|
90
96
|
}
|
|
@@ -177,6 +183,7 @@
|
|
|
177
183
|
let page_title, i = 0;
|
|
178
184
|
$$('.pagesjs-page').forEach(box => {
|
|
179
185
|
if (removeBlank(box)) return; // remove empty pages
|
|
186
|
+
box.classList.remove('pagesjs-done');
|
|
180
187
|
if (book) {
|
|
181
188
|
if ($('.frontmatter', box)) return; // skip book frontmatter page
|
|
182
189
|
$(ps, box) && (page_title = ''); // empty title for first page of chapter
|
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
|
|
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);
|
|
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","fr_cls","className","innerHTML","box","box_body","H","box_cls","newPage","insertAdjacentHTML","cloneNode","children","classList","add","removeBlank","v","innerText","trim","remove","fill","contains","after","append","slice","
|
|
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,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,EAAS,qBACzEJ,EAAIK,UAAY,eAChBL,EAAIM,UAAY,2GAGhB,IAAIC,EAAKC,EAAUC,EAAGC,EAAU,GAChC,SAASC,EAAQjB,GAIf,OAHAA,IAAOF,EAAE,gBAAiBE,IAAOA,EAAGkB,mBAAmB,aAAcZ,EAAIM,WACzEC,EAAMb,GAAMM,EAAIa,WAAU,GAAOL,EAAWD,EAAIO,SAAS,GACzDJ,EAAQP,QAAUI,EAAIQ,UAAUC,OAAON,GAChCH,CACT,CACA,SAASU,EAAWV,EAAKW,GACvB,MAAMC,EAAMZ,EAAIa,aAAeX,EAE/B,OADCS,GAAQC,IAAQZ,EAAIQ,UAAUC,IA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