spec-up-t 0.11.14 → 0.11.16
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/assets/compiled/body.js +2 -2
- package/assets/js/addAnchorsToTerms.js +16 -2
- package/assets/js/edit-term-buttons.js +17 -4
- package/docs/index.html +2490 -0
- package/package.json +1 -1
- /package/spec/{term-definitions → terms-definitions}/term-1.md +0 -0
- /package/spec/{term-definitions → terms-definitions}/term-2.md +0 -0
- /package/spec/{term-definitions → terms-definitions}/term-3.md +0 -0
- /package/spec/{term-definitions → terms-definitions}/term-4.md +0 -0
package/assets/compiled/body.js
CHANGED
|
@@ -50,7 +50,7 @@ window.FontAwesomeKitConfig={asyncLoading:{enabled:!0},autoA11y:{enabled:!0},bas
|
|
|
50
50
|
* @license MIT
|
|
51
51
|
* @since 2024-06-09
|
|
52
52
|
*/
|
|
53
|
-
function editTermButtons(){const t=((e=specConfig.spec_directory).startsWith("./")?e=e.substring(2):e.startsWith("/")&&(e=e.substring(1)),e.endsWith("/")&&(e=e.slice(0,-1)),e);var e;document.querySelectorAll('span[id^="term:"]').forEach(e=>{const s=e.getAttribute("id").split(":")[1];
|
|
53
|
+
function editTermButtons(){const t=((e=specConfig.spec_directory).startsWith("./")?e=e.substring(2):e.startsWith("/")&&(e=e.substring(1)),e.endsWith("/")&&(e=e.slice(0,-1)),e);var e;document.querySelectorAll('dt:has(> span[id^="term:"])').forEach(e=>{const s=function(t){let e=t;for(;e.querySelector('span[id^="term:"]');)e=e.querySelector('span[id^="term:"]');return e}(e);console.log("term: ",s);const o=s.getAttribute("id");console.log("url: ",o);const r=o.split(":")[1];console.log("fileName: ",r),s.innerHTML+=`<sup class="edit-term-button-sup"><a target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/${specConfig.source.repo}/blob/main/${t}/${specConfig.spec_terms_directory}/${r}.md" class="edit-term-button btn">Edit ${r}</a></sup><sup class="history-term-button-sup"><a target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/${specConfig.source.repo}/commits/main/${t}/${specConfig.spec_terms_directory}/${r}.md" class="history-term-button btn">History</a></sup>`})}document.addEventListener("DOMContentLoaded",(function(){editTermButtons()}));
|
|
54
54
|
function inPageSearch(){const e=document.querySelector("span[issue-count]"),t=specConfig.searchHighlightStyle||"ssi",n="search-h7vc6omi2hr2880",i=document.querySelector("main article");let c=document.createElement("div");c.setAttribute("id","container-"+n),c.setAttribute("class","container-"+n),e.after(c);let o=document.createElement("input");o.setAttribute("type","text"),o.setAttribute("id",n),o.setAttribute("placeholder","🔍"),c.appendChild(o),setTimeout(()=>{o.focus()},1e3);const r=document.createElement("div");r.setAttribute("id","back-and-forth-buttons-container-"+n);const a=document.createElement("button");a.setAttribute("id","one-match-backward-"+n),a.setAttribute("disabled","disabled"),a.setAttribute("title","Go to previous match. Shortcut key: Left Arrow"),a.textContent="▲",r.appendChild(a);const s=document.createElement("button");s.setAttribute("id","one-match-forward-"+n),s.setAttribute("disabled","disabled"),s.setAttribute("title","Go to next match. Shortcut key: Right Arrow"),s.textContent="▼",r.appendChild(s),c.appendChild(r);const d=document.createElement("span");d.setAttribute("id","total-matches-"+n),d.innerHTML="0 matches",c.appendChild(d),o.addEventListener("input",(function(){f(o.value)}));const h="highlight-matches-"+n,l={dif:"highlight-matches-DIF-search-h7vc6omi2hr2880",toip:"highlight-matches-ToIP-search-h7vc6omi2hr2880",btc:"highlight-matches-BTC-search-h7vc6omi2hr2880",keri:"highlight-matches-KERI-search-h7vc6omi2hr2880",ssi:"highlight-matches-SSI-search-h7vc6omi2hr2880",gleif:"highlight-matches-GLEIF-search-h7vc6omi2hr2880"}[t.toLowerCase()];let u=0,m=-1;function b(e){e.scrollIntoView({behavior:"smooth",block:"start"});const t=e.getBoundingClientRect(),n=t.top+window.pageYOffset-(window.innerHeight-t.height)/2;window.scrollTo({top:n,behavior:"smooth"})}function p(){m<=0?document.getElementById("one-match-backward-"+n).setAttribute("disabled","disabled"):document.getElementById("one-match-backward-"+n).removeAttribute("disabled"),m>=u-1?document.getElementById("one-match-forward-"+n).setAttribute("disabled","disabled"):document.getElementById("one-match-forward-"+n).removeAttribute("disabled")}function g(){d.innerHTML=u+" matches"}const f=function(e,t){let n;return function(){const i=this,c=arguments;clearTimeout(n),n=setTimeout(()=>e.apply(i,c),t)}}((function(e){if(function(){document.querySelectorAll("span."+h).forEach(e=>{Array.from(e.childNodes).forEach(t=>{t.nodeType===Node.ELEMENT_NODE&&e.removeChild(t)}),e.classList.contains(h)&&(e.outerHTML=e.innerHTML)})}(),u=0,m=-1,""===e)return void g();let t=0;!function i(c){if(3===c.nodeType){const i=function(i){const c=i.nodeValue,o=new RegExp(e,"gi");let r,a=0,s=document.createDocumentFragment();for(;null!==(r=o.exec(c));){s.appendChild(document.createTextNode(c.substring(a,r.index)));const e=document.createElement("span");e.textContent=r[0],e.classList.add(h),e.classList.add(l),e.setAttribute("id",n+"-"+t),s.appendChild(e),u=t+1,t++,a=r.index+r[0].length}return s.appendChild(document.createTextNode(c.substring(a))),s}(c);i.childNodes.length>1&&c.parentNode.replaceChild(i,c)}else 1===c.nodeType&&Array.from(c.childNodes).forEach(i)}(i);let c=document.querySelector("."+l);null!==c&&b(c);g(),p(),m=-1}),600);a.addEventListener("click",(function(){m--;const e=document.querySelector("#"+n+"-"+m);e&&b(e),e.classList.add("active"),setTimeout(()=>{e.classList.remove("active")},3e3),p()})),s.addEventListener("click",(function(){m++;const e=document.querySelector("#"+n+"-"+m);e&&b(e),e.classList.add("active"),setTimeout(()=>{e.classList.remove("active")},3e3),p()})),document.addEventListener("keyup",e=>{switch(e.key){case"ArrowRight":s.click();break;case"ArrowLeft":a.click()}})}document.addEventListener("DOMContentLoaded",(function(){inPageSearch()}));
|
|
55
55
|
function highlightMenuItems(){let t=null;function e(t){document.querySelectorAll("#toc_list a").forEach(t=>{t.classList.remove("highlight-cfib41dyhcd99sm")});const e=document.querySelector(`#toc_list a[href="#${t.id}"]`);e&&(e.classList.add("highlight-cfib41dyhcd99sm"),e.scrollIntoView({behavior:"smooth",block:"center"}))}const o=new IntersectionObserver((o,n)=>{const c=o.filter(t=>t.isIntersecting).map(t=>t.target);c.length>0?(t=c[0],e(t)):t&&e(t)},{root:null,rootMargin:"0px",threshold:.1});document.querySelectorAll("h2, h3, h4, h5, h6").forEach(t=>o.observe(t))}document.addEventListener("DOMContentLoaded",(function(){highlightMenuItems()}));
|
|
56
56
|
function backToTop(){const n=document.createElement("a");n.id="back-to-top-a1zncgtqfpzsig8",n.href="#content",n.innerHTML="↑",document.body.appendChild(n);const t=function(n,t){let e;return function(){const o=this,c=arguments;clearTimeout(e),e=setTimeout(()=>n.apply(o,c),t)}}((function(){window.scrollY>300?n.style.display="flex":n.style.display="none"}),600);window.addEventListener("scroll",(function(){t()}))}document.addEventListener("DOMContentLoaded",(function(){backToTop()}));
|
|
@@ -62,5 +62,5 @@ function backToTop(){const n=document.createElement("a");n.id="back-to-top-a1znc
|
|
|
62
62
|
* @since 2024-06-09
|
|
63
63
|
*/
|
|
64
64
|
function fetchCommitHashes(){document.querySelectorAll("[data-local-href]").forEach(e=>{const t=e.getAttribute("data-local-href").split(":");allXrefs.xrefs.forEach(r=>{if(r.externalSpec===t[1]&&r.term.toLowerCase()===t[2].toLowerCase()){const t=r.commitHash&&r.commitHash[0]?r.commitHash[0].substring(0,7):"No hash",o=document.createElement("a");o.href="https://github.com/"+r.owner+"/"+r.repo+"/compare/"+r.commitHash+"..main/"+r.terms_dir+"/"+r.term.replace(/ /g," - ").toLowerCase()+".md",o.target="_blank",o.classList.add("diff","xref-info-links","btn"),o.innerHTML="Diff",e.parentNode.insertBefore(o,e.nextSibling);const n=document.createElement("a");n.href="https://github.com/"+r.owner+"/"+r.repo+"/blob/main/"+r.terms_dir+"/"+r.term.replace(/ /g,"-").toLowerCase()+".md",n.target="_blank",n.classList.add("latest-version","xref-info-links","btn"),n.innerHTML="Latest",o.parentNode.insertBefore(n,e.nextSibling);const a=document.createElement("a");a.href="https://github.com/"+r.owner+"/"+r.repo+"/blob/"+r.commitHash+"/"+r.terms_dir+"/"+r.term.replace(/ /g,"-").toLowerCase()+".md",a.target="_blank",a.classList.add("exact-commit-hash","xref-info-links","btn"),a.innerHTML=t,n.parentNode.insertBefore(a,e.nextSibling)}})})}document.addEventListener("DOMContentLoaded",(function(){fetchCommitHashes()}));
|
|
65
|
-
function addAnchorsToTerms(){document.querySelectorAll(
|
|
65
|
+
function addAnchorsToTerms(){document.querySelectorAll('dt:has(> span[id^="term:"])').forEach(e=>{const t=function(e){let t=e;for(;t.querySelector('span[id^="term:"]');)t=t.querySelector('span[id^="term:"]');return t}(e),r=t.getAttribute("id"),n=document.createElement("a");n.setAttribute("href","#"+r),n.setAttribute("class","toc-anchor"),n.innerHTML="§ ",t.parentNode.insertBefore(n,t)})}document.addEventListener("DOMContentLoaded",(function(){addAnchorsToTerms()}));
|
|
66
66
|
!function(){var e=window.markdownit();delegateEvent("pointerup","[panel-toggle]",(e,t)=>{slidepanels.toggle(t.getAttribute("panel-toggle"))},{passive:!0}),window.addEventListener("hashchange",e=>slidepanels.close());let t=specConfig.source;t&&"github"===t.host&&fetch(`https://api.github.com/repos/${t.account+"/"+t.repo}/issues`).then(e=>e.json()).then(t=>{let n=t.length;document.querySelectorAll("[issue-count]").forEach(e=>{e.setAttribute("issue-count",n)}),repo_issue_list.innerHTML=t.map(t=>`<li class="repo-issue">\n <detail-box>\n <section>${e.render(t.body||"")}</section>\n <header class="repo-issue-title">\n <span class="repo-issue-number">${t.number}</span>\n <span class="repo-issue-link">\n <a href="${t.html_url}" target="_blank">${t.title}</a>\n </span>\n <span detail-box-toggle></span>\n </header>\n </detail-box>\n </li>`).join(""),Prism.highlightAllUnder(repo_issue_list)}),mermaid.initialize({startOnLoad:!0,theme:"neutral"}),document.querySelectorAll(".chartjs").forEach(e=>{new Chart(e,JSON.parse(e.textContent))});let n=new WeakMap;delegateEvent("pointerover",".term-reference, .spec-reference",(e,t)=>{const s=t.getAttribute("data-local-href")||t.getAttribute("href")||"";let l=document.getElementById(s.replace("#",""));if(!l||n.has(t))return;let r=l.closest("dt, td:first-child");if(!r)return;let i={allowHTML:!0,inlinePositioning:!0};switch(r.tagName){case"DT":i.content=r.nextElementSibling.textContent;break;case"TD":let e=r.closest("table"),t=Array.from(r.closest("tr").children);if(t.shift(),e){let n=Array.from(e.querySelectorAll("thead th"));n.shift(),n.length&&(i.content=`\n <header>${r.textContent}</header>\n <table>\n ${n.map((e,n)=>`<tr><td>${e.textContent}:</td><td>${t[n]?t[n].textContent:""}</td></tr>`).join("")}\n </table>`)}}i.content&&n.set(t,tippy(t,i))},{passive:!0})}();
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
function addAnchorsToTerms() {
|
|
2
|
-
|
|
2
|
+
// Function to find the deepest <span>
|
|
3
|
+
// Spec-Up is generating nested spans. The deepest span is the main term, and that is what we need.
|
|
4
|
+
function findDeepestSpan(element) {
|
|
5
|
+
let currentElement = element;
|
|
6
|
+
// While there is a <span> child, keep going deeper
|
|
7
|
+
while (currentElement.querySelector('span[id^="term:"]')) {
|
|
8
|
+
currentElement = currentElement.querySelector('span[id^="term:"]');
|
|
9
|
+
}
|
|
10
|
+
return currentElement;
|
|
11
|
+
}
|
|
3
12
|
|
|
4
|
-
|
|
13
|
+
|
|
14
|
+
const dts = document.querySelectorAll('dt:has(> span[id^="term:"])');
|
|
15
|
+
|
|
16
|
+
dts.forEach(item => {
|
|
17
|
+
|
|
18
|
+
const dt = findDeepestSpan(item);
|
|
5
19
|
// dt.classList.add('toc-anchor');
|
|
6
20
|
const id = dt.getAttribute('id');
|
|
7
21
|
const a = document.createElement('a');
|
|
@@ -7,8 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function editTermButtons() {
|
|
10
|
-
//
|
|
11
|
-
//
|
|
10
|
+
// Function to find the deepest <span>
|
|
11
|
+
// Spec-Up is generating nested spans. The deepest span is the main term, and that is what we need.
|
|
12
|
+
function findDeepestSpan(element) {
|
|
13
|
+
let currentElement = element;
|
|
14
|
+
// While there is a <span> child, keep going deeper
|
|
15
|
+
while (currentElement.querySelector('span[id^="term:"]')) {
|
|
16
|
+
currentElement = currentElement.querySelector('span[id^="term:"]');
|
|
17
|
+
}
|
|
18
|
+
return currentElement;
|
|
19
|
+
}
|
|
12
20
|
|
|
13
21
|
// Remove "./" or "/" from the beginning of a string and "/" at the end of the string
|
|
14
22
|
function cleanPath(path) {
|
|
@@ -31,14 +39,19 @@ function editTermButtons() {
|
|
|
31
39
|
|
|
32
40
|
const cleanedSpecDir = cleanPath(specConfig.spec_directory);
|
|
33
41
|
|
|
34
|
-
|
|
42
|
+
// Find all definition terms that have spans with the id of "term:...". These are the definitions we are looking for.
|
|
43
|
+
document.querySelectorAll('dt:has(> span[id^="term:"])').forEach(item => {
|
|
44
|
+
const term = findDeepestSpan(item);
|
|
45
|
+
console.log('term: ', term);
|
|
35
46
|
const url = term.getAttribute('id');
|
|
47
|
+
console.log('url: ', url);
|
|
36
48
|
|
|
37
49
|
// cut “url” on the “:” and keep the second part
|
|
38
50
|
const fileName = url.split(":")[1];
|
|
51
|
+
console.log('fileName: ', fileName);
|
|
39
52
|
|
|
40
53
|
// add edit and history buttons to term
|
|
41
|
-
term.innerHTML += `<sup class="edit-term-button-sup"><a target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/${specConfig.source.repo}/blob/main/${cleanedSpecDir}/${specConfig.spec_terms_directory}/${fileName}.md" class="edit-term-button btn">Edit</a></sup><sup class="history-term-button-sup"><a target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/${specConfig.source.repo}/commits/main/${cleanedSpecDir}/${specConfig.spec_terms_directory}/${fileName}.md" class="history-term-button btn">History</a></sup>`;
|
|
54
|
+
term.innerHTML += `<sup class="edit-term-button-sup"><a target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/${specConfig.source.repo}/blob/main/${cleanedSpecDir}/${specConfig.spec_terms_directory}/${fileName}.md" class="edit-term-button btn">Edit ${fileName}</a></sup><sup class="history-term-button-sup"><a target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/${specConfig.source.repo}/commits/main/${cleanedSpecDir}/${specConfig.spec_terms_directory}/${fileName}.md" class="history-term-button btn">History</a></sup>`;
|
|
42
55
|
});
|
|
43
56
|
}
|
|
44
57
|
|