spec-up-t 1.0.36 → 1.0.37
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
CHANGED
|
@@ -87,7 +87,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
87
87
|
* @license MIT
|
|
88
88
|
* @since 2024-06-09
|
|
89
89
|
*/
|
|
90
|
-
function
|
|
90
|
+
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 n=function(t){let e=t;for(;e.querySelector('span[id^="term:"]');)e=e.querySelector('span[id^="term:"]');return e}(e),s=n.getAttribute("id").split(":")[1];n.innerHTML+=`<span class="edit-term-buttons"><a title="Link to the term file in the Github repo in a new tab" target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/${specConfig.source.repo}/blob/main/${t}/${specConfig.spec_terms_directory}/${s}.md" class="edit-term-button btn">🖊️</a><a title="Link to a GitHub page that shows a history of the edits in a new tab" target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/${specConfig.source.repo}/commits/main/${t}/${specConfig.spec_terms_directory}/${s}.md" class="history-term-button btn">📅</a></span>`})}document.addEventListener("DOMContentLoaded",(function(){editTermButtons()}));
|
|
91
91
|
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()}));
|
|
92
92
|
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()}));
|
|
93
93
|
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()}));
|
|
@@ -127,11 +127,11 @@ function helpButtons(){const t=document.createElement("a");t.textContent="?",t.c
|
|
|
127
127
|
function createAlphabetIndex(){const e=document.getElementById("alphabet-index-h7vc6omi2hr2880"),t=document.querySelector(".terms-and-definitions-list").querySelectorAll("dt"),n={};t.forEach(e=>{const t=e.querySelector("span");if(t&&t.id){const e=t.id,o=e.charAt(e.indexOf("term:")+5).toUpperCase();n[o]||(n[o]=t.id)}});const o=document.createElement("div");o.className="alphabet-index";const r=document.createElement("p");r.className="number-of-terms",r.textContent=`– There are ${t.length} terms –`;const c=e.parentNode;c.insertBefore(r,e.nextSibling),c.insertBefore(o,r.nextSibling),Object.keys(n).sort().forEach(e=>{const t=document.createElement("a");t.href="#"+n[e],t.textContent=e,o.appendChild(t)})}document.addEventListener("DOMContentLoaded",(function(){createAlphabetIndex()}));
|
|
128
128
|
function collapseDefinitions(){const t=document.querySelectorAll("#content dl dd"),e=document.querySelectorAll(".collapse-all-defs-button");document.querySelectorAll("dt").forEach(t=>{const e=document.createElement("button");e.classList.add("collapse-all-defs-button","btn"),e.innerHTML="▲",e.setAttribute("id","toggleButton"),t.appendChild(e)}),document.addEventListener("click",n=>{n.target.classList.contains("collapse-all-defs-button")&&(!function(){const n=t[0].classList.contains("hidden");t.forEach(t=>{t.classList.toggle("hidden",!n),t.classList.toggle("visible",n)}),e.forEach(t=>{t.innerHTML=n?"▲":"▼",t.title=n?"Collapse all definitions":"Expand all definitions"})}(),n.target.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"}),setTimeout(()=>{window.scrollBy({top:-100,behavior:"smooth"})},500))})}document.addEventListener("DOMContentLoaded",(function(){collapseDefinitions()}));
|
|
129
129
|
/**
|
|
130
|
-
* @file This file
|
|
130
|
+
* @file This file adds an href attribute to the snapshot link on the page via client side JS DOM manipulation.
|
|
131
131
|
* @author Kor Dwarshuis
|
|
132
132
|
* @version 0.0.1
|
|
133
133
|
* @license MIT
|
|
134
134
|
* @since 2024-09-25
|
|
135
135
|
*/
|
|
136
|
-
function addHrefToSnapshotLink(){const
|
|
136
|
+
function addHrefToSnapshotLink(){const e=document.querySelector(".snapshots a"),t=window.location.href,n=t.match(/^(https?:\/\/[^\/]+(?:\/[^\/]+)*)\/versions\/(?:[^\/]+\/)?/);let o;o=n?n[1]+"/versions/":t.replace(/\/$/,"")+"/versions/",e&&e.setAttribute("href",o)}document.addEventListener("DOMContentLoaded",(function(){addHrefToSnapshotLink()}));
|
|
137
137
|
!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})}();
|
|
@@ -7,28 +7,28 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function addHrefToSnapshotLink() {
|
|
10
|
-
// Find the snapshot link and add the href attribute
|
|
11
10
|
const snapshotLink = document.querySelector('.snapshots a');
|
|
12
11
|
|
|
13
12
|
// Get the current URL of the page
|
|
14
13
|
const currentUrl = window.location.href;
|
|
15
14
|
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
// Regex to match up to and including the 'versions/' directory (if it exists)
|
|
16
|
+
const versionsMatch = currentUrl.match(/^(https?:\/\/[^\/]+(?:\/[^\/]+)*)\/versions\/(?:[^\/]+\/)?/);
|
|
17
|
+
|
|
18
|
+
// If we are already in the 'versions' directory or deeper, strip down to 'versions/'
|
|
19
|
+
// Otherwise, append '/versions/' to the current directory
|
|
20
|
+
let snapshotLinkHref;
|
|
21
|
+
if (versionsMatch) {
|
|
22
|
+
snapshotLinkHref = `${versionsMatch[1]}/versions/`;
|
|
23
|
+
} else {
|
|
24
|
+
// Append '/versions/' to the current directory
|
|
25
|
+
snapshotLinkHref = currentUrl.replace(/\/$/, '') + '/versions/';
|
|
26
|
+
}
|
|
26
27
|
|
|
27
28
|
// Set the 'href' attribute of the snapshot link element to the constructed URL
|
|
28
29
|
if (snapshotLink) {
|
|
29
30
|
snapshotLink.setAttribute('href', snapshotLinkHref);
|
|
30
31
|
}
|
|
31
|
-
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
document.addEventListener("DOMContentLoaded", function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"description": "Technical specification drafting tool that generates rich specification documents from markdown. Forked from https://github.com/decentralized-identity/spec-up by Daniel Buchner (https://github.com/csuwildcat)",
|
|
5
5
|
"main": "./index",
|
|
6
6
|
"repository": {
|