spec-up-t 1.6.0-beta.3 → 1.6.0-beta.4

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.
@@ -111,7 +111,7 @@ function showModal(e){const n=document.createElement("div");n.className="spec-up
111
111
  function tokenInput(){document.querySelector(".button-token-input").addEventListener("click",(()=>{const t=prompt("Please enter your GitHub token:");t?(localStorage.setItem("githubToken",t),console.log("GitHub token is set.")):alert("GitHub token is not set.")}))}document.addEventListener("DOMContentLoaded",(function(){tokenInput()}));
112
112
  !function(){"use strict";const e=e=>document.querySelector(e);async function t(){const t=e(".service-menu");if(!t)return;const n=[{href:"./index.pdf",title:"Download this page as a PDF",cls:"button-pdf-download"},{href:"./index.docx",title:"Download this page as a DOCX",cls:"button-docx-download"}],o=await Promise.all(n.map((e=>{return t=e.href,fetch(t,{method:"HEAD"}).then((e=>e.ok)).catch((()=>!1));var t})));let r=t.firstElementChild;n.forEach(((n,a)=>{if(!o[a])return;if(s=n.cls,e(`.service-menu .${s}`))return;var s;const c=function(e,t,n){const o=document.createElement("a");return o.classList.add(n,"btn","d-block","btn-sm","btn-outline-secondary"),o.target="_blank",o.rel="noopener noreferrer",o.href=e,o.title=t,o.setAttribute("aria-label",t),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" class="me-1" viewBox="0 0 16 16"> <path d="M4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.5L9.5 0H4zm0 1h5v4h4v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zm7 4h-1V2l3 3h-2z"/> </svg>',o}(n.href,n.title,n.cls);t.insertBefore(c,r),r=c}))}window.SpecUpDownloads={addButtons:t},document.addEventListener("DOMContentLoaded",t,{once:!1});try{document.dispatchEvent(new CustomEvent("specup-downloads-ready"))}catch(e){}}();
113
113
  function insertTrefs(e){!function(e){const n=[];document.querySelectorAll("dl.terms-and-definitions-list dt span.term-external").forEach((e=>{const t=e.dataset.originalTerm,r=e.closest("dt");if(r){const e=r.nextElementSibling;if(e?.classList.contains("term-external")&&e.classList.contains("meta-info-content-wrapper"))return}n.push({element:e,textContent:t,dt:r,parent:r?.parentNode})}));const t=n.map((n=>{const{textContent:t,dt:r,parent:o}=n;if(!r||!o)return null;const i=e.xtrefs.find((e=>e.term===t)),a=document.createDocumentFragment(),s=document.createElement("dd");if(s.classList.add("term-external","meta-info-content-wrapper","collapsed"),i){const e=i.avatarUrl?`![avatar](${i.avatarUrl})`:"",n=i.owner||"Unknown",r=i.repo&&i.repoUrl?`[${i.repo}](${i.repoUrl})`:"Unknown",o=i.commitHash||"Unknown",d=i.ghPageUrl?new URL(`#term:${i.term}`,i.ghPageUrl).href:"Unknown",l=`\n| Property | Value |\n| -------- | ----- |\n| Original Term | ${t} |\n| Link | ${d} |\n| Owner | ${e} ${n} |\n| Repo | ${r} |\n| Commit hash | ${o} |\n `;s.innerHTML=md.render(l),a.appendChild(s);let c=i.content.split("\n").map((e=>e.replace(/^\s*~\s*/,""))).join("\n").replace(/\]\]/g,"");const m=document.createElement("div");m.innerHTML=md.render(c),m.querySelectorAll("a").forEach((e=>{const n=e=>{try{return null!==document.getElementById(e)}catch{return!1}};try{const t=new URL(e.href);if(t.hostname!==window.location.hostname)return;if(t.hash&&n(t.hash.slice(1)))return;e.replaceWith(...e.childNodes)}catch{if(e.href.startsWith("#")&&n(e.href.slice(1)))return;e.replaceWith(...e.childNodes)}})),c=m.innerHTML;const f=document.createElement("div");f.innerHTML=md.render(c);const p=f.querySelectorAll("dd");if(p.length>0)Array.from(p).forEach((e=>{const n=e.cloneNode(!0);n.classList.add("term-external","term-external-embedded"),a.appendChild(n)}));else{const e=document.createElement("dd");e.classList.add("term-external","term-external-embedded"),e.innerHTML=f.innerHTML,a.appendChild(e)}}else{s.innerHTML=md.render("\n| Property | Value |\n| -------- | ----- |\n| Owner | Unknown |\n| Repo | Unknown |\n| Commit hash | not found |\n "),a.appendChild(s);const e=document.createElement("dd");e.innerHTML="<p>This term was not found in the external repository.</p>",a.appendChild(e)}return{dt:r,parent:o,fragment:a}})).filter(Boolean);requestAnimationFrame((()=>{t.forEach((e=>{const{dt:n,parent:t,fragment:r}=e;t.insertBefore(r,n.nextSibling)})),document.dispatchEvent(new CustomEvent("trefs-inserted",{detail:{count:t.length}}))}))}(e)}function initializeOnTrefsInserted(e){let n=!1;document.addEventListener("trefs-inserted",(function(t){n||(n=!0,e(),t.detail&&console.log(`Collapsible definitions initialized after ${t.detail.count} xrefs were inserted`))})),setTimeout((()=>{n||(console.warn("trefs-inserted event was not received, initializing collapsible definitions anyway"),e(),n=!0)}),1e3)}document.addEventListener("DOMContentLoaded",(()=>{"undefined"!=typeof allXTrefs&&allXTrefs?.xtrefs?insertTrefs(allXTrefs):(console.error("allXTrefs is undefined or missing xtrefs property"),document.dispatchEvent(new CustomEvent("trefs-inserted",{detail:{count:0,error:"Missing xtrefs data"}})))}));
114
- function insertIrefs(){!function(){const e=document.querySelectorAll("span.iref-placeholder");if(0===e.length)return void document.dispatchEvent(new CustomEvent("irefs-inserted",{detail:{count:0}}));const t=[];e.forEach((e=>{const n=e.dataset.irefTerm,r=e.dataset.irefOriginal;if(!n)return void console.warn("iref placeholder missing data-iref-term attribute",e);const o=`term:${n}`,i=document.getElementById(o);if(!i){console.warn(`iref: term "${r}" (id: ${n}) not found in terms-and-definitions-list`);const o=document.createElement("div");o.className="iref-not-found",o.innerHTML=`<p class="text-warning"><em>[[iref: ${r}]] - Term not found in definitions list</em></p>`;const i=document.createDocumentFragment();return i.appendChild(o),void t.push({placeholder:e,fragment:i})}const d=i.closest("dt");if(!d)return void console.warn(`iref: could not find <dt> element for term "${r}"`);const s=document.createDocumentFragment(),l=document.createElement("div");l.className="iref-content";const c=document.createElement("dl");c.className="iref-definition-list";const a=d.cloneNode(!0);a.classList.add("iref-term"),a.classList.add("term-reference");const m=a.querySelector("a.toc-anchor");m&&m.remove();a.querySelectorAll("[id]").forEach((e=>{e.removeAttribute("id")}));a.querySelectorAll(".edit-term-buttons").forEach((e=>{e.remove()}));const f=d.querySelector('[id^="term:"]');if(f){const e=f.getAttribute("id"),t=document.createElement("a");t.href=`#${e}`,t.className="iref-go-to-glossary-button btn btn-sm btn-outline-primary py-1",t.innerHTML='<span class="iref-button-icon"></span>Go to glossary',t.title=`Go to original definition of ${r}`,a.appendChild(t)}c.appendChild(a);let u=d.nextElementSibling;for(;u&&"dd"===u.tagName.toLowerCase();){const e=u.cloneNode(!0);e.classList.add("iref-definition"),c.appendChild(e),u=u.nextElementSibling}l.appendChild(c),s.appendChild(l),t.push({placeholder:e,fragment:s})})),requestAnimationFrame((()=>{t.forEach((e=>{const{placeholder:t,fragment:n}=e;t.parentNode.replaceChild(n,t)})),document.dispatchEvent(new CustomEvent("irefs-inserted",{detail:{count:t.length}})),console.log(`Inserted ${t.length} inline reference(s)`)}))}()}document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll("span.iref-placeholder").length>0&&document.querySelectorAll("dl.terms-and-definitions-list dt.term-external").length>0?document.addEventListener("trefs-inserted",(()=>{insertIrefs()}),{once:!0}):insertIrefs()}));
114
+ function insertIrefs(){!function(){const e=document.querySelectorAll("span.iref-placeholder");if(0===e.length)return void document.dispatchEvent(new CustomEvent("irefs-inserted",{detail:{count:0}}));const t=[];e.forEach((e=>{const n=e.dataset.irefTerm,r=e.dataset.irefOriginal;if(!n)return void console.warn("iref placeholder missing data-iref-term attribute",e);const o=`term:${n}`,i=document.getElementById(o);if(!i){console.warn(`iref: term "${r}" (id: ${n}) not found in terms-and-definitions-list`);const o=document.createElement("div");o.className="iref-not-found",o.innerHTML=`<p class="text-warning"><em>[[iref: ${r}]] - Term not found in definitions list</em></p>`;const i=document.createDocumentFragment();return i.appendChild(o),void t.push({placeholder:e,fragment:i})}const d=i.closest("dt");if(!d)return void console.warn(`iref: could not find <dt> element for term "${r}"`);const s=document.createDocumentFragment(),l=document.createElement("div");l.className="iref-content";const c=document.createElement("dl");c.className="iref-definition-list";const a=d.cloneNode(!0);a.classList.add("iref-term"),a.classList.add("term-reference");const m=a.querySelector("a.toc-anchor");m&&m.remove();a.querySelectorAll("[id]").forEach((e=>{e.removeAttribute("id")}));a.querySelectorAll(".edit-term-buttons").forEach((e=>{e.remove()}));const f=d.querySelector('[id^="term:"]');if(f){const e=f.getAttribute("id"),t=document.createElement("a");t.href=`#${e}`,t.className="iref-go-to-glossary-button btn btn-sm btn-outline-secondary py-1 ms-5",t.innerHTML='<span class="iref-button-icon"></span>Glossary',t.title=`Go to original definition of ${r}`,a.appendChild(t)}c.appendChild(a);let u=d.nextElementSibling;for(;u&&"dd"===u.tagName.toLowerCase();){const e=u.cloneNode(!0);e.classList.add("iref-definition"),c.appendChild(e),u=u.nextElementSibling}l.appendChild(c),s.appendChild(l),t.push({placeholder:e,fragment:s})})),requestAnimationFrame((()=>{t.forEach((e=>{const{placeholder:t,fragment:n}=e;t.parentNode.replaceChild(n,t)})),document.dispatchEvent(new CustomEvent("irefs-inserted",{detail:{count:t.length}})),console.log(`Inserted ${t.length} inline reference(s)`)}))}()}document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll("span.iref-placeholder").length>0&&document.querySelectorAll("dl.terms-and-definitions-list dt.term-external").length>0?document.addEventListener("trefs-inserted",(()=>{insertIrefs()}),{once:!0}):insertIrefs()}));
115
115
  function getOrCreateButtonContainer(t){let n=t.querySelector(".definition-buttons-container");return n||(n=document.createElement("div"),n.classList.add("definition-buttons-container"),t.appendChild(n)),n}function addButtonToContainer(t,n,e=!1){const i=getOrCreateButtonContainer(t);return e?i.insertBefore(n,i.firstChild):i.appendChild(n),i}
116
116
  function collapseDefinitions(){let{dds:t,dts:e,regularDds:s,specialDds:a}=function(){const t=document.querySelectorAll("#content dl.terms-and-definitions-list > dd");return{dds:t,dts:document.querySelectorAll("#content dl.terms-and-definitions-list > dt"),regularDds:Array.from(t).filter((t=>!i(t.textContent.trim()))),specialDds:Array.from(t).filter((t=>i(t.textContent.trim())))}}();function i(t){return["Source","See also","More in","Also see","See:","See also","See more","See more in","See more about","See more on","See more at","More:","Note:","Paraphrased by","Beware:","eSSIF-Lab: ","W3C VC:","NIST:","Supporting definitions:"].some((e=>t.startsWith(e)))}a.forEach((t=>{t.classList.add("terms-def-extra-info")})),e.forEach((t=>{if(t.querySelector(".collapse-all-defs-button"))return;const e=document.createElement("button");e.classList.add("collapse-all-defs-button","btn-outline-secondary","d-print-none","btn","p-0","fs-5","d-flex","align-items-center","justify-content-center"),e.innerHTML='<span class="state-indicator" data-state="0">①</span><span class="state-indicator" data-state="1">②</span><span class="state-indicator" data-state="2">③</span>',e.setAttribute("id","toggleButton"),e.setAttribute("title","Change how much info is shown"),e.setAttribute("data-state","2"),e.querySelector('.state-indicator[data-state="2"]').classList.add("active"),addButtonToContainer(t,e)})),document.addEventListener("click",(e=>{if(e.target.classList.contains("collapse-all-defs-button")||e.target.classList.contains("state-indicator")){const i=e.target.classList.contains("collapse-all-defs-button")?e.target:e.target.closest(".collapse-all-defs-button"),n=i.getBoundingClientRect();document.documentElement.classList.add("definitions-transitioning"),i.style.position="fixed",i.style.top=`${n.top}px`,i.style.right=window.innerWidth-n.right+"px",i.style.zIndex="1000",function(){const e=document.querySelectorAll(".collapse-all-defs-button");switch((parseInt(e[0].dataset.state||0)+1)%3){case 0:t.forEach((t=>{t.classList.add("hidden"),t.classList.remove("visible")})),e.forEach((t=>{t.dataset.state=0,t.title="Show basic definitions",t.querySelectorAll(".state-indicator").forEach((t=>{0===parseInt(t.dataset.state)?t.classList.add("active"):t.classList.remove("active")}))})),document.querySelector("html").classList.add("defs-hidden");break;case 1:s.forEach((t=>{t.classList.remove("hidden"),t.classList.add("visible")})),a.forEach((t=>{t.classList.add("hidden"),t.classList.remove("visible")})),e.forEach((t=>{t.dataset.state=1,t.title="Show all definitions",t.querySelectorAll(".state-indicator").forEach((t=>{1===parseInt(t.dataset.state)?t.classList.add("active"):t.classList.remove("active")}))})),document.querySelector("html").classList.remove("defs-hidden");break;case 2:t.forEach((t=>{t.classList.remove("hidden"),t.classList.add("visible")})),a.forEach((t=>{t.classList.add("terms-def-extra-info")})),e.forEach((t=>{t.dataset.state=2,t.title="Hide all definitions",t.querySelectorAll(".state-indicator").forEach((t=>{2===parseInt(t.dataset.state)?t.classList.add("active"):t.classList.remove("active")}))})),document.querySelector("html").classList.remove("defs-hidden")}}(),requestAnimationFrame((()=>{i.style.position="",i.style.top="",i.style.right="",i.style.zIndex="",document.documentElement.classList.remove("definitions-transitioning");const t=i.getBoundingClientRect();window.scrollTo({top:window.scrollY+(t.top-n.top),behavior:"instant"})}))}}))}document.addEventListener("DOMContentLoaded",(function(){initializeOnTrefsInserted(collapseDefinitions)}));
117
117
  function createToggleButton(e){const t=document.createElement("button");t.classList.add("meta-info-toggle-button","btn","fs-1","d-flex","align-items-center","justify-content-center"),t.innerHTML='<i class="bi bi-info-circle" style="margin-top: -0.5em;"></i>',t.title="Meta info",t.addEventListener("click",(function(t){t.preventDefault(),t.stopPropagation();e.classList.contains("collapsed")?(e.classList.remove("collapsed"),e.getBoundingClientRect()):e.classList.add("collapsed")}));let n=e.previousElementSibling;for(;n&&"DT"!==n.tagName;)n=n.previousElementSibling;n?addButtonToContainer(n,t,!0):e.insertBefore(t,e.firstChild)}function collapseMetaInfo(){document.querySelectorAll("dl > dd:has(table)").forEach((function(e){e.classList.add("meta-info-content-wrapper");const t=document.createElement("div");for(t.classList.add("meta-info-inner-wrapper");e.firstChild&&e.firstChild!==e.querySelector(".meta-info-toggle-button");)t.appendChild(e.firstChild);e.querySelector(".meta-info-toggle-button")||createToggleButton(e),e.appendChild(t),e.classList.add("collapsed")}))}document.addEventListener("DOMContentLoaded",(function(){initializeOnTrefsInserted(collapseMetaInfo)}));
@@ -130,8 +130,8 @@ function insertIrefs() {
130
130
  // Create a button-styled link with arrow icon
131
131
  const glossaryLink = document.createElement('a');
132
132
  glossaryLink.href = `#${termIdAttr}`;
133
- glossaryLink.className = 'iref-go-to-glossary-button btn btn-sm btn-outline-primary py-1';
134
- glossaryLink.innerHTML = '<span class="iref-button-icon"></span>Go to glossary';
133
+ glossaryLink.className = 'iref-go-to-glossary-button btn btn-sm btn-outline-secondary py-1';
134
+ glossaryLink.innerHTML = '<span class="iref-button-icon"></span>Glossary';
135
135
  glossaryLink.title = `Go to original definition of ${originalTerm}`;
136
136
 
137
137
  // Append the button to the cloned dt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-up-t",
3
- "version": "1.6.0-beta.3",
3
+ "version": "1.6.0-beta.4",
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": {