@xiee/utils 1.14.144 → 1.14.145

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -35,6 +35,6 @@ CHROMIUM_PATH=/usr/bin/chromium-browser npm test # use an installed browser
35
35
 
36
36
  ## Releases
37
37
 
38
- 1. Commit the version bump in `package.json` as `Bump to X.Y.Z` (patch +1 unless told otherwise), after tests pass.
39
- 2. Tag that commit `vX.Y.Z` and push the commit and the tag. Pushing a `v*` tag triggers `.github/workflows/npm-publish.yml`, which builds the minified files, runs `npm publish`, and purges the CDN cache.
40
- 3. Pushing and tagging are outward-facing: do them only when the user asks for a release.
38
+ Use `./release.sh [-p] [-t] [patch|minor|major|X.Y.Z]` (default: patch). It runs the tests (`-t` skips them), bumps the version in `package.json` and `package-lock.json`, commits `Bump to X.Y.Z`, and tags `vX.Y.Z`. `-p` also pushes the commit and the tag; pushing a `v*` tag triggers `.github/workflows/npm-publish.yml`, which builds the minified files, runs `npm publish`, and purges the CDN cache.
39
+
40
+ Pushing and tagging are outward-facing: run the script (and pass `-p`) only when the user asks for a release.
package/css/article.css CHANGED
@@ -93,6 +93,7 @@ div:has(> table) { overflow-x: auto; }
93
93
 
94
94
  /* notes: positioned by sidenotes.js in a layer that has the content edges of the article */
95
95
  .sidenotes { position: relative; height: 0; }
96
+ .note-pop { display: none; }
96
97
  .side-note {
97
98
  position: absolute;
98
99
  right: var(--side-margin);
@@ -100,6 +101,15 @@ div:has(> table) { overflow-x: auto; }
100
101
  }
101
102
 
102
103
  @media (min-width: 79.002em) {
104
+ .note-ref:hover + .note-pop {
105
+ display: inline-block;
106
+ position: absolute;
107
+ z-index: 1;
108
+ background: #f8f8f8;
109
+ margin-left: 1em;
110
+ padding: .5em;
111
+ box-sizing: content-box;
112
+ }
103
113
  #TOC.side {
104
114
  .active {
105
115
  color: limegreen;
@@ -140,7 +150,6 @@ div:has(> table) { overflow-x: auto; }
140
150
  .side { float: none; }
141
151
  .sidenotes { height: auto; }
142
152
  .side-note { position: static; margin: 1em auto; }
143
- .side-note[data-dup] { display: none; }
144
153
  .side > :last-child { margin-bottom: 0; }
145
154
  .embed-left, .embed-right {
146
155
  float: inherit;
@@ -1,2 +1,2 @@
1
- :root,.pagesjs{--side-width:12.5rem;--side-gap:2em;--article-bg:#fff}@media (width>=93.75em){:root{--side-width:18.75rem}}body{--side-margin:calc(0px - var(--side-width) - var(--side-gap))}body,blockquote,.side{background:#fafafa}article:not(.pagesjs *),.frontmatter,.fullwidth,.embed-left,.embed-right{background:var(--article-bg);margin-top:2em;padding:1em;box-shadow:0 0 4px #ccc}.side{font-size:.85em}#TOC{top:0}.bg-number{color:#fff;background:#789;border-radius:5px;padding:1px 5px}div:has(>table){overflow-x:auto}.side{width:var(--side-width);max-height:100vh;margin:0 auto;overflow:auto}.side-left{float:left;clear:left;margin-left:var(--side-margin);position:sticky;&:not(article>*){margin-left:calc(var(--side-margin) + 1em)}}.side-right{float:right;clear:right;margin-right:var(--side-margin)}.quote-left,.quote-right{width:45%}.embed-left,.embed-right{margin-top:auto;padding:0}.quote-left,.embed-left{float:left;margin-right:1em}.quote-right,.embed-right{float:right;margin-left:1em}.embed-left{margin-left:var(--side-margin)}.embed-right{margin-right:var(--side-margin)}:is(.side,.embed-left,.embed-right)>:first-child{margin-top:0}:is(.embed-left,.embed-right)>:last-child{margin-bottom:0}:is(.quote-left,.quote-right){&>:first-child{padding-top:.1px}&>:last-child{padding-bottom:.1px}}.fullwidth{float:left;background:var(--article-bg);min-width:100%;max-width:calc(100vw - 2em);margin:1em 0 1em 50%;transform:translate(-50%);& *{max-width:calc(100vw - 4em);margin:auto 0}& :is(figcaption,.caption){width:50rem;margin-left:calc(50% - 25rem);padding:1em 1em 0}}.fullscroll{& *{max-width:initial}&,& figure,& .figure{overflow-x:auto}}.sidenotes{height:0;position:relative}.side-note{right:var(--side-margin);margin:0;position:absolute}@media (width>=79.002em){#TOC.side{& .active{color:#32cd32}&>ul>li:has(.active){background:var(--article-bg);padding:4px 2px 4px 0}& li li .active{border-left:3px solid;margin-left:calc(-1em - 3px);padding-left:1em}&:has(.active) li:not(:has(.active)) ul{display:none}}}@media (width<=79em){body:not(.pagesjs){& #TOC{position:initial;float:none;border:1px solid #eee;border-radius:5px;padding:1em}& .side{width:100%;max-height:none}& main .side{color:#2f4f4f;padding:0 2em}& .side-left,& .side-right{clear:both;background:0 0;margin:1em auto}& .side{float:none}& .sidenotes{height:auto}& .side-note{margin:1em auto;position:static}& .side-note[data-dup]{display:none}& .side>:last-child{margin-bottom:0}& .embed-left,& .embed-right{float:inherit;margin:auto;padding:1em}}}@media (width<=50em){body:not(.pagesjs){padding:initial;& article{padding:0 .5em}& :not(pre)>code{word-break:break-word}& .quote-left,& .quote-right{width:inherit;float:inherit;margin:auto}& .fullwidth{margin:initial;transform:initial;float:none;min-width:initial;background:0 0;border:none;& :is(figcaption,.caption){margin:initial;padding:initial}&:not(.fullscroll) *{max-width:100%}}}}@media print{body{background:0 0}}
1
+ :root,.pagesjs{--side-width:12.5rem;--side-gap:2em;--article-bg:#fff}@media (width>=93.75em){:root{--side-width:18.75rem}}body{--side-margin:calc(0px - var(--side-width) - var(--side-gap))}body,blockquote,.side{background:#fafafa}article:not(.pagesjs *),.frontmatter,.fullwidth,.embed-left,.embed-right{background:var(--article-bg);margin-top:2em;padding:1em;box-shadow:0 0 4px #ccc}.side{font-size:.85em}#TOC{top:0}.bg-number{color:#fff;background:#789;border-radius:5px;padding:1px 5px}div:has(>table){overflow-x:auto}.side{width:var(--side-width);max-height:100vh;margin:0 auto;overflow:auto}.side-left{float:left;clear:left;margin-left:var(--side-margin);position:sticky;&:not(article>*){margin-left:calc(var(--side-margin) + 1em)}}.side-right{float:right;clear:right;margin-right:var(--side-margin)}.quote-left,.quote-right{width:45%}.embed-left,.embed-right{margin-top:auto;padding:0}.quote-left,.embed-left{float:left;margin-right:1em}.quote-right,.embed-right{float:right;margin-left:1em}.embed-left{margin-left:var(--side-margin)}.embed-right{margin-right:var(--side-margin)}:is(.side,.embed-left,.embed-right)>:first-child{margin-top:0}:is(.embed-left,.embed-right)>:last-child{margin-bottom:0}:is(.quote-left,.quote-right){&>:first-child{padding-top:.1px}&>:last-child{padding-bottom:.1px}}.fullwidth{float:left;background:var(--article-bg);min-width:100%;max-width:calc(100vw - 2em);margin:1em 0 1em 50%;transform:translate(-50%);& *{max-width:calc(100vw - 4em);margin:auto 0}& :is(figcaption,.caption){width:50rem;margin-left:calc(50% - 25rem);padding:1em 1em 0}}.fullscroll{& *{max-width:initial}&,& figure,& .figure{overflow-x:auto}}.sidenotes{height:0;position:relative}.note-pop{display:none}.side-note{right:var(--side-margin);margin:0;position:absolute}@media (width>=79.002em){.note-ref:hover+.note-pop{z-index:1;box-sizing:content-box;background:#f8f8f8;margin-left:1em;padding:.5em;display:inline-block;position:absolute}#TOC.side{& .active{color:#32cd32}&>ul>li:has(.active){background:var(--article-bg);padding:4px 2px 4px 0}& li li .active{border-left:3px solid;margin-left:calc(-1em - 3px);padding-left:1em}&:has(.active) li:not(:has(.active)) ul{display:none}}}@media (width<=79em){body:not(.pagesjs){& #TOC{position:initial;float:none;border:1px solid #eee;border-radius:5px;padding:1em}& .side{width:100%;max-height:none}& main .side{color:#2f4f4f;padding:0 2em}& .side-left,& .side-right{clear:both;background:0 0;margin:1em auto}& .side{float:none}& .sidenotes{height:auto}& .side-note{margin:1em auto;position:static}& .side>:last-child{margin-bottom:0}& .embed-left,& .embed-right{float:inherit;margin:auto;padding:1em}}}@media (width<=50em){body:not(.pagesjs){padding:initial;& article{padding:0 .5em}& :not(pre)>code{word-break:break-word}& .quote-left,& .quote-right{width:inherit;float:inherit;margin:auto}& .fullwidth{margin:initial;transform:initial;float:none;min-width:initial;background:0 0;border:none;& :is(figcaption,.caption){margin:initial;padding:initial}&:not(.fullscroll) *{max-width:100%}}}}@media print{body{background:0 0}}
2
2
  /*# sourceMappingURL=article.min.css.map */
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,qEAKA,wBAA8B,6BAC9B,mEAGA,yCAEA,yJAMA,sBACA,WACA,wEAMA,gCAGA,2EAMA,gFAKE,6DAIF,oEAKA,mCACA,mDAIA,oDAIA,sDAIA,2CACA,6CACA,8DACA,0DACA,8BACE,gCACA,mCAIF,6IAOE,8CAIA,wFAMF,YACE,sBACA,sCAIF,sCACA,+DAMA,yBACE,UACE,wBAGA,wEAIA,oFAKA,uDAKJ,qBACE,mBACE,uFAOA,mCACA,yCAIA,qEAKA,mBACA,yBACA,6CACA,oCACA,oCACA,qEAOJ,qBACE,mCAEE,yBACA,uCACA,qEAKA,sGAOE,0DAIA,uCAKN,aACE","sources":["article.css"],"sourcesContent":[":root, .pagesjs {\n --side-width: 12.5rem;\n --side-gap: 2em;\n --article-bg: #fff;\n}\n@media (min-width: 93.75em) { :root { --side-width: 18.75rem; } }\nbody {\n --side-margin: calc(0px - var(--side-width) - var(--side-gap));\n}\nbody, blockquote, .side { background: #fafafa; }\n/* a card: an article, except in pages.js pages */\narticle:not(.pagesjs *), .frontmatter, .fullwidth, .embed-left, .embed-right {\n margin-top: 2em;\n padding: 1em;\n box-shadow: 0 0 4px #ccc;\n background: var(--article-bg);\n}\n.side { font-size: .85em; }\n#TOC { top: 0; }\n.bg-number {\n padding: 1px 5px;\n border-radius: 5px;\n background: lightslategray;\n color: #fff;\n}\ndiv:has(> table) { overflow-x: auto; }\n\n/* left/right elements*/\n.side {\n width: var(--side-width);\n margin: 0 auto;\n max-height: 100vh;\n overflow: auto;\n}\n.side-left {\n float: left;\n clear: left;\n margin-left: var(--side-margin);\n position: sticky;\n &:not(article > *) {\n margin-left: calc(var(--side-margin) + 1em);\n }\n}\n.side-right {\n float: right;\n clear: right;\n margin-right: var(--side-margin);\n}\n.quote-left, .quote-right { width: 45%; }\n.embed-left, .embed-right {\n margin-top: auto;\n padding: 0;\n}\n.quote-left, .embed-left {\n float: left;\n margin-right: 1em;\n}\n.quote-right, .embed-right {\n float: right;\n margin-left: 1em;\n}\n.embed-left { margin-left: var(--side-margin); }\n.embed-right { margin-right: var(--side-margin); }\n:is(.side, .embed-left, .embed-right) > :first-child { margin-top: 0; }\n:is(.embed-left, .embed-right) > :last-child { margin-bottom: 0; }\n:is(.quote-left, .quote-right) {\n & > :first-child { padding-top: .1px; }\n & > :last-child { padding-bottom: .1px; }\n}\n\n/* wide elements */\n.fullwidth {\n max-width: calc(100vw - 2em);\n margin: 1em 0 1em 50%;\n transform: translateX(-50%);\n float: left;\n min-width: 100%;\n background: var(--article-bg);\n & * {\n max-width: calc(100vw - 4em);\n margin: auto 0;\n }\n & :is(figcaption, .caption) {\n margin-left: calc(50% - 25rem);\n width: 50rem;\n padding: 1em 1em 0;\n }\n}\n.fullscroll {\n & * { max-width: initial; }\n &, & figure, & .figure { overflow-x: auto; }\n}\n\n/* notes: positioned by sidenotes.js in a layer that has the content edges of the article */\n.sidenotes { position: relative; height: 0; }\n.side-note {\n position: absolute;\n right: var(--side-margin);\n margin: 0;\n}\n\n@media (min-width: 79.002em) {\n #TOC.side {\n .active {\n color: limegreen;\n }\n & > ul > li:has(.active) {\n background: var(--article-bg);\n padding: 4px 2px 4px 0;\n }\n li li .active {\n border-left: 3px solid;\n margin-left: calc(-1em - 3px);\n padding-left: 1em;\n }\n &:has(.active) li:not(:has(.active)) ul {\n display: none;\n }\n }\n}\n@media (max-width: 79em) {\n body:not(.pagesjs) {\n #TOC {\n border: 1px solid #eee;\n border-radius: 5px;\n padding: 1em;\n position: initial;\n float: none;\n }\n .side { width: 100%; max-height: none; }\n main .side {\n padding: 0 2em;\n color: darkslategray;\n }\n .side-left, .side-right {\n clear: both;\n margin: 1em auto;\n background: none;\n }\n .side { float: none; }\n .sidenotes { height: auto; }\n .side-note { position: static; margin: 1em auto; }\n .side-note[data-dup] { display: none; }\n .side > :last-child { margin-bottom: 0; }\n .embed-left, .embed-right {\n float: inherit;\n margin: auto;\n padding: 1em;\n }\n }\n}\n@media (max-width: 50em) {\n body:not(.pagesjs) {\n padding: initial;\n article { padding: 0 .5em; }\n :not(pre) > code { word-break: break-word; }\n .quote-left, .quote-right {\n width: inherit;\n float: inherit;\n margin: auto;\n }\n .fullwidth {\n margin: initial;\n transform: initial;\n float: none;\n min-width: initial;\n background: none;\n border: none;\n & :is(figcaption, .caption) {\n margin: initial;\n padding: initial;\n }\n &:not(.fullscroll) * { max-width: 100%; }\n }\n }\n}\n\n@media print {\n body {\n background: none;\n }\n}\n"],"names":[]}
1
+ {"version":3,"mappings":"AAAA,qEAKA,wBAA8B,6BAC9B,mEAGA,yCAEA,yJAMA,sBACA,WACA,wEAMA,gCAGA,2EAMA,gFAKE,6DAIF,oEAKA,mCACA,mDAIA,oDAIA,sDAIA,2CACA,6CACA,8DACA,0DACA,8BACE,gCACA,mCAIF,6IAOE,8CAIA,wFAMF,YACE,sBACA,sCAIF,sCACA,uBACA,+DAMA,yBACE,kJASA,UACE,wBAGA,wEAIA,oFAKA,uDAKJ,qBACE,mBACE,uFAOA,mCACA,yCAIA,qEAKA,mBACA,yBACA,6CACA,oCACA,qEAOJ,qBACE,mCAEE,yBACA,uCACA,qEAKA,sGAOE,0DAIA,uCAKN,aACE","sources":["article.css"],"sourcesContent":[":root, .pagesjs {\n --side-width: 12.5rem;\n --side-gap: 2em;\n --article-bg: #fff;\n}\n@media (min-width: 93.75em) { :root { --side-width: 18.75rem; } }\nbody {\n --side-margin: calc(0px - var(--side-width) - var(--side-gap));\n}\nbody, blockquote, .side { background: #fafafa; }\n/* a card: an article, except in pages.js pages */\narticle:not(.pagesjs *), .frontmatter, .fullwidth, .embed-left, .embed-right {\n margin-top: 2em;\n padding: 1em;\n box-shadow: 0 0 4px #ccc;\n background: var(--article-bg);\n}\n.side { font-size: .85em; }\n#TOC { top: 0; }\n.bg-number {\n padding: 1px 5px;\n border-radius: 5px;\n background: lightslategray;\n color: #fff;\n}\ndiv:has(> table) { overflow-x: auto; }\n\n/* left/right elements*/\n.side {\n width: var(--side-width);\n margin: 0 auto;\n max-height: 100vh;\n overflow: auto;\n}\n.side-left {\n float: left;\n clear: left;\n margin-left: var(--side-margin);\n position: sticky;\n &:not(article > *) {\n margin-left: calc(var(--side-margin) + 1em);\n }\n}\n.side-right {\n float: right;\n clear: right;\n margin-right: var(--side-margin);\n}\n.quote-left, .quote-right { width: 45%; }\n.embed-left, .embed-right {\n margin-top: auto;\n padding: 0;\n}\n.quote-left, .embed-left {\n float: left;\n margin-right: 1em;\n}\n.quote-right, .embed-right {\n float: right;\n margin-left: 1em;\n}\n.embed-left { margin-left: var(--side-margin); }\n.embed-right { margin-right: var(--side-margin); }\n:is(.side, .embed-left, .embed-right) > :first-child { margin-top: 0; }\n:is(.embed-left, .embed-right) > :last-child { margin-bottom: 0; }\n:is(.quote-left, .quote-right) {\n & > :first-child { padding-top: .1px; }\n & > :last-child { padding-bottom: .1px; }\n}\n\n/* wide elements */\n.fullwidth {\n max-width: calc(100vw - 2em);\n margin: 1em 0 1em 50%;\n transform: translateX(-50%);\n float: left;\n min-width: 100%;\n background: var(--article-bg);\n & * {\n max-width: calc(100vw - 4em);\n margin: auto 0;\n }\n & :is(figcaption, .caption) {\n margin-left: calc(50% - 25rem);\n width: 50rem;\n padding: 1em 1em 0;\n }\n}\n.fullscroll {\n & * { max-width: initial; }\n &, & figure, & .figure { overflow-x: auto; }\n}\n\n/* notes: positioned by sidenotes.js in a layer that has the content edges of the article */\n.sidenotes { position: relative; height: 0; }\n.note-pop { display: none; }\n.side-note {\n position: absolute;\n right: var(--side-margin);\n margin: 0;\n}\n\n@media (min-width: 79.002em) {\n .note-ref:hover + .note-pop {\n display: inline-block;\n position: absolute;\n z-index: 1;\n background: #f8f8f8;\n margin-left: 1em;\n padding: .5em;\n box-sizing: content-box;\n }\n #TOC.side {\n .active {\n color: limegreen;\n }\n & > ul > li:has(.active) {\n background: var(--article-bg);\n padding: 4px 2px 4px 0;\n }\n li li .active {\n border-left: 3px solid;\n margin-left: calc(-1em - 3px);\n padding-left: 1em;\n }\n &:has(.active) li:not(:has(.active)) ul {\n display: none;\n }\n }\n}\n@media (max-width: 79em) {\n body:not(.pagesjs) {\n #TOC {\n border: 1px solid #eee;\n border-radius: 5px;\n padding: 1em;\n position: initial;\n float: none;\n }\n .side { width: 100%; max-height: none; }\n main .side {\n padding: 0 2em;\n color: darkslategray;\n }\n .side-left, .side-right {\n clear: both;\n margin: 1em auto;\n background: none;\n }\n .side { float: none; }\n .sidenotes { height: auto; }\n .side-note { position: static; margin: 1em auto; }\n .side > :last-child { margin-bottom: 0; }\n .embed-left, .embed-right {\n float: inherit;\n margin: auto;\n padding: 1em;\n }\n }\n}\n@media (max-width: 50em) {\n body:not(.pagesjs) {\n padding: initial;\n article { padding: 0 .5em; }\n :not(pre) > code { word-break: break-word; }\n .quote-left, .quote-right {\n width: inherit;\n float: inherit;\n margin: auto;\n }\n .fullwidth {\n margin: initial;\n transform: initial;\n float: none;\n min-width: initial;\n background: none;\n border: none;\n & :is(figcaption, .caption) {\n margin: initial;\n padding: initial;\n }\n &:not(.fullscroll) * { max-width: 100%; }\n }\n }\n}\n\n@media print {\n body {\n background: none;\n }\n}\n"],"names":[]}
package/js/sidenotes.js CHANGED
@@ -44,9 +44,15 @@
44
44
  a3.id ||= 'sn-' + ++count;
45
45
  s.dataset.noteFor = a3.id;
46
46
  s.dataset.noteId = el.id; // the same for all the references of a note
47
- // a note that is cited again: show only the first copy when notes are blocks in the text
48
- if (seen.has(el.id)) s.dataset.dup = ''; else seen.add(el.id);
49
- layerOf(a3).append(s);
47
+ // the margin shows a note once; a repeated reference gets a copy after it, which pops up on
48
+ // hover (and which pages.js turns into the note of its page when paginated)
49
+ if (seen.has(el.id)) {
50
+ s.classList.replace('side-note', 'note-pop');
51
+ a3.after(s);
52
+ } else {
53
+ seen.add(el.id);
54
+ layerOf(a3).append(s);
55
+ }
50
56
  a3.classList.add('note-ref');
51
57
  el.remove();
52
58
  });
@@ -1,2 +1,2 @@
1
- (e=>{const t=new Set,o=new Set;let n=0;e.querySelectorAll('.footnotes > ol > li[id^="fn"], #refs > [id^="ref-"]').forEach(s=>{const i=`a[href="#${s.id}"]`;e.querySelectorAll(`${i} > sup, sup > ${i}, .citation > ${i}, ${i}.citation`).forEach(i=>{const r=i.parentNode;("A"===i.tagName?i:r).removeAttribute("href");const l=e.createElement("div");for(l.className="side side-note footnotes",/^fn/.test(s.id)?(l.innerHTML=s.innerHTML,l.firstElementChild.insertAdjacentHTML("afterbegin",`<span class="bg-number">${i.innerText}</span> `),l.querySelector('a[href^="#fnref"]')?.remove()):l.innerHTML=s.outerHTML;"#text"===l.lastChild?.nodeName&&!l.lastChild.textContent.trim();)l.lastChild.remove();l.querySelectorAll(".fullwidth").forEach(e=>e.classList.remove("fullwidth"));const a=i.classList.contains("citation")?i:r;a.id||="sn-"+ ++n,l.dataset.noteFor=a.id,l.dataset.noteId=s.id,o.has(s.id)?l.dataset.dup="":o.add(s.id),(o=>{const n=o.closest("article, main, .main")||e.body;for(;o.parentElement!==n;)o=o.parentElement;return o.nextElementSibling?.matches(".sidenotes")||o.insertAdjacentHTML("afterend",'<div class="sidenotes"></div>'),t.add(n),o.nextElementSibling})(a).append(l),a.classList.add("note-ref"),s.remove()})}),e.querySelectorAll(".footnotes, #refs").forEach(e=>{e.innerText.trim()||e.remove()});const s=e.getElementById("TOC");s?.classList.contains("side")||s?.classList.add("side","side-left");const i=()=>{const o=[...e.querySelectorAll(".side-right:not(.side-note)")].map(e=>e.getBoundingClientRect()).filter(e=>e.height).sort((e,t)=>e.top-t.top);[...t].map(t=>[...t.querySelectorAll(":scope > .sidenotes > .side-note")].map(t=>{const o=e.getElementById(t.dataset.noteFor);return o&&[t,o.getBoundingClientRect().top,t.offsetHeight,t.parentNode.getBoundingClientRect().top]}).filter(Boolean).sort((e,t)=>e[1]-t[1])).forEach(e=>{let t=-1/0;e.forEach(([e,n,s,i])=>{n=Math.max(n,t),o.forEach(e=>{n<e.bottom&&n+s>e.top&&(n=e.bottom+16)}),e.style.top=n-i+"px",t=n+s+16})})};if(i(),t.size){const o=new ResizeObserver(i);t.forEach(e=>o.observe(e)),e.fonts?.ready.then(i)}const r=e.querySelectorAll(".side"),l=[];e.querySelectorAll("[data-auto-fullwidth]").forEach(e=>{l.push([e,e.getBoundingClientRect()])}),r.length&&e.body.classList.add("has-sidenotes"),r.forEach(e=>{const t=e.getBoundingClientRect();for(let e of l){const o=e[1];t.right<o.left||t.left>o.right||t.bottom<o.top||t.top>o.bottom||e[0].classList.remove("fullwidth")}})})(document);
1
+ (e=>{const t=new Set,o=new Set;let n=0;e.querySelectorAll('.footnotes > ol > li[id^="fn"], #refs > [id^="ref-"]').forEach(s=>{const i=`a[href="#${s.id}"]`;e.querySelectorAll(`${i} > sup, sup > ${i}, .citation > ${i}, ${i}.citation`).forEach(i=>{const r=i.parentNode;("A"===i.tagName?i:r).removeAttribute("href");const l=e.createElement("div");for(l.className="side side-note footnotes",/^fn/.test(s.id)?(l.innerHTML=s.innerHTML,l.firstElementChild.insertAdjacentHTML("afterbegin",`<span class="bg-number">${i.innerText}</span> `),l.querySelector('a[href^="#fnref"]')?.remove()):l.innerHTML=s.outerHTML;"#text"===l.lastChild?.nodeName&&!l.lastChild.textContent.trim();)l.lastChild.remove();l.querySelectorAll(".fullwidth").forEach(e=>e.classList.remove("fullwidth"));const a=i.classList.contains("citation")?i:r;a.id||="sn-"+ ++n,l.dataset.noteFor=a.id,l.dataset.noteId=s.id,o.has(s.id)?(l.classList.replace("side-note","note-pop"),a.after(l)):(o.add(s.id),(o=>{const n=o.closest("article, main, .main")||e.body;for(;o.parentElement!==n;)o=o.parentElement;return o.nextElementSibling?.matches(".sidenotes")||o.insertAdjacentHTML("afterend",'<div class="sidenotes"></div>'),t.add(n),o.nextElementSibling})(a).append(l)),a.classList.add("note-ref"),s.remove()})}),e.querySelectorAll(".footnotes, #refs").forEach(e=>{e.innerText.trim()||e.remove()});const s=e.getElementById("TOC");s?.classList.contains("side")||s?.classList.add("side","side-left");const i=()=>{const o=[...e.querySelectorAll(".side-right:not(.side-note)")].map(e=>e.getBoundingClientRect()).filter(e=>e.height).sort((e,t)=>e.top-t.top);[...t].map(t=>[...t.querySelectorAll(":scope > .sidenotes > .side-note")].map(t=>{const o=e.getElementById(t.dataset.noteFor);return o&&[t,o.getBoundingClientRect().top,t.offsetHeight,t.parentNode.getBoundingClientRect().top]}).filter(Boolean).sort((e,t)=>e[1]-t[1])).forEach(e=>{let t=-1/0;e.forEach(([e,n,s,i])=>{n=Math.max(n,t),o.forEach(e=>{n<e.bottom&&n+s>e.top&&(n=e.bottom+16)}),e.style.top=n-i+"px",t=n+s+16})})};if(i(),t.size){const o=new ResizeObserver(i);t.forEach(e=>o.observe(e)),e.fonts?.ready.then(i)}const r=e.querySelectorAll(".side"),l=[];e.querySelectorAll("[data-auto-fullwidth]").forEach(e=>{l.push([e,e.getBoundingClientRect()])}),r.length&&e.body.classList.add("has-sidenotes"),r.forEach(e=>{const t=e.getBoundingClientRect();for(let e of l){const o=e[1];t.right<o.left||t.left>o.right||t.bottom<o.top||t.top>o.bottom||e[0].classList.remove("fullwidth")}})})(document);
2
2
  //# sourceMappingURL=sidenotes.min.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["d","arts","Set","seen","count","querySelectorAll","forEach","el","h","id","a","a2","parentNode","tagName","removeAttribute","s","createElement","className","test","innerHTML","firstElementChild","insertAdjacentHTML","innerText","querySelector","remove","outerHTML","lastChild","nodeName","textContent","trim","classList","a3","contains","dataset","noteFor","noteId","has","dup","add","art","closest","body","parentElement","nextElementSibling","matches","layerOf","append","toc","getElementById","place","bars","map","e","getBoundingClientRect","filter","r","height","sort","p","q","top","offsetHeight","Boolean","row","end","Infinity","y","Math","max","bottom","style","size","ro","ResizeObserver","observe","fonts","ready","then","sides","fulls","push","length","r1","f","r2","right","left","document"],"sources":["sidenotes.js"],"mappings":"AACA,CAACA,IAQC,MAAMC,EAAO,IAAIC,IAAOC,EAAO,IAAID,IACnC,IAAIE,EAAQ,EAUZJ,EAAEK,i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MG,QAAUjF,EAAEyC,KAAKX,UAAUQ,IAAI,iBACrCwC,EAAMxE,QAAQS,IACZ,MAAMmE,EAAKnE,EAAEsC,wBACb,IAAK,IAAI8B,KAAKJ,EAAO,CACnB,MAAMK,EAAKD,EAAE,GACPD,EAAGG,MAAQD,EAAGE,MAAQJ,EAAGI,KAAOF,EAAGC,OAASH,EAAGb,OAASe,EAAGxB,KAAOsB,EAAGtB,IAAMwB,EAAGf,QAClFc,EAAE,GAAGrD,UAAUN,OAAO,YAE1B,GAEH,EArGD,CAqGG+D","ignoreList":[]}
1
+ {"version":3,"names":["d","arts","Set","seen","count","querySelectorAll","forEach","el","h","id","a","a2","parentNode","tagName","removeAttribute","s","createElement","className","test","innerHTML","firstElementChild","insertAdjacentHTML","innerText","querySelector","remove","outerHTML","lastChild","nodeName","textContent","trim","classList","a3","contains","dataset","noteFor","noteId","has","replace","after","add","art","closest","body","parentElement","nextElementSibling","matches","layerOf","append","toc","getElementById","place","bars","map","e","getBoundingClientRect","filter","r","height","sort","p","q","top","offsetHeight","Boolean","row","end","Infinity","y","Math","max","bottom","style","size","ro","ResizeObserver","observe","fonts","ready","then","sides","fulls","push","length","r1","f","r2","right","left","document"],"sources":["sidenotes.js"],"mappings":"AACA,CAACA,IAQC,MAAMC,EAAO,IAAIC,IAAOC,EAAO,IAAID,IACnC,IAAIE,EAAQ,EAUZJ,EAAEK,iBAAiB,wDAAwDC,QAAQC,IAEjF,MAAMC,EAAI,YAAYD,EAAGE,OACzBT,EAAEK,iBAAiB,GAAGG,kBAAkBA,kBAAkBA,MAAMA,cAAcF,QAAQI,IACpF,MAAMC,EAAKD,EAAEE,YACE,MAAdF,EAAEG,QAAkBH,EAAIC,GAAIG,gBAAgB,QAC7C,MAAMC,EAAIf,EAAEgB,cAAc,OAU1B,IATAD,EAAEE,UAAY,2BACV,MAAMC,KAAKX,EAAGE,KAChBM,EAAEI,UAAYZ,EAAGY,UAEjBJ,EAAEK,kBAAkBC,mBAAmB,aAAc,2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","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiee/utils",
3
- "version": "1.14.144",
3
+ "version": "1.14.145",
4
4
  "description": "Miscellaneous tools and utilities to manipulate HTML pages",
5
5
  "scripts": {
6
6
  "test": "playwright test"
package/release.sh ADDED
@@ -0,0 +1,39 @@
1
+ #!/bin/sh
2
+ # Make a release: bump the version in package.json and package-lock.json, commit it
3
+ # as "Bump to X.Y.Z", and tag it vX.Y.Z. Pushing the tag triggers npm-publish.yml,
4
+ # so the push is a separate step: pass -p to do it.
5
+ #
6
+ # Usage: ./release.sh [-p] [-t] [patch|minor|major|X.Y.Z] (default: patch)
7
+ # -p push the commit and the tag
8
+ # -t skip the tests
9
+
10
+ set -e
11
+
12
+ push= test=1
13
+ while getopts pt o; do
14
+ case $o in
15
+ p) push=1 ;;
16
+ t) test= ;;
17
+ *) exit 2 ;;
18
+ esac
19
+ done
20
+ shift $((OPTIND - 1))
21
+
22
+ cd "$(dirname "$0")"
23
+ [ "$(git branch --show-current)" = main ] || { echo "not on main" >&2; exit 1; }
24
+ git diff --quiet HEAD -- || { echo "uncommitted changes in tracked files" >&2; exit 1; }
25
+
26
+ [ -z "$test" ] || npm test
27
+
28
+ # updates both package.json and package-lock.json, without committing or tagging
29
+ v=$(npm version "${1:-patch}" --no-git-tag-version | sed 's/^v//')
30
+ git add package.json package-lock.json
31
+ git commit -q -m "Bump to $v"
32
+ git tag "v$v"
33
+ echo "committed and tagged v$v"
34
+
35
+ if [ -n "$push" ]; then
36
+ git push origin main "v$v"
37
+ else
38
+ echo "to publish: git push origin main v$v"
39
+ fi