spec-up-t 1.1.49 → 1.1.50

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.
@@ -95,7 +95,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
95
95
  * @license MIT
96
96
  * @since 2024-06-09
97
97
  */
98
- 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="p-1 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="p-1 history-term-button btn">📅</a></span>`})}document.addEventListener("DOMContentLoaded",(function(){editTermButtons()}));
98
+ 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],o=specConfig.source.branch||"main";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/${o}/${t}/${specConfig.spec_terms_directory}/${s}.md" class="p-1 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/${o}/${t}/${specConfig.spec_terms_directory}/${s}.md" class="p-1 history-term-button btn">📅</a></span>`})}document.addEventListener("DOMContentLoaded",(function(){editTermButtons()}));
99
99
  function createAlphabetIndex(){const e=document.getElementById("terminology-section-utility-container"),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-container";const c=document.createElement("p");c.className="number-of-terms",c.textContent=`– There are ${t.length} terms –`,e.appendChild(c),Object.keys(n).sort().forEach(e=>{const t=document.createElement("a");t.href="#"+n[e],t.textContent=e,o.appendChild(t)}),e.appendChild(o)}document.addEventListener("DOMContentLoaded",(function(){createAlphabetIndex()}));
100
100
  function inPageSearch(){const t=document.getElementById("terminology-section-utility-container"),e=specConfig.searchHighlightStyle||"ssi",n="search-h7vc6omi2hr2880",i=document.querySelector(".terms-and-definitions-list"),o=document.createElement("div");o.setAttribute("id","container-"+n),o.classList.add("input-group","mb-3","d-flex","align-items-center"),o.setAttribute("role","search"),t.appendChild(o);const s=document.createElement("input");s.setAttribute("type","text"),s.setAttribute("id",n),s.classList.add("form-control"),s.setAttribute("placeholder","🔍"),s.setAttribute("aria-label","Search terms"),s.setAttribute("autocomplete","off"),o.appendChild(s);const c=document.createElement("div");c.classList.add("input-group-append");const a=document.createElement("button");a.setAttribute("id","one-match-backward-"+n),a.classList.add("btn","btn-outline-secondary"),a.setAttribute("type","button"),a.setAttribute("disabled","true"),a.setAttribute("title","Go to previous match (Left Arrow)"),a.setAttribute("aria-label","Go to previous match"),a.innerHTML='<span aria-hidden="true">▲</span>',c.appendChild(a);const r=document.createElement("button");r.setAttribute("id","one-match-forward-"+n),r.classList.add("btn","btn-outline-secondary"),r.setAttribute("type","button"),r.setAttribute("disabled","true"),r.setAttribute("title","Go to next match (Right Arrow)"),r.setAttribute("aria-label","Go to next match"),r.innerHTML='<span aria-hidden="true">▼</span>',c.appendChild(r);const d=document.createElement("span");d.setAttribute("id","total-matches-"+n),d.classList.add("input-group-text"),d.innerHTML="0 matches",d.setAttribute("aria-live","polite"),d.setAttribute("role","status"),o.appendChild(d),o.appendChild(c),s.addEventListener("input",(function(){f(s.value)})),document.addEventListener("click",t=>{t.target.classList.contains("collapse-all-defs-button")&&f(s.value)});const l="highlight-matches-"+n,u={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"}[e.toLowerCase()];let h=0,m=-1;function p(t){t.scrollIntoView({behavior:"smooth",block:"start"});const e=t.getBoundingClientRect(),n=e.top+window.pageYOffset-(window.innerHeight-e.height)/2;window.scrollTo({top:n,behavior:"smooth"})}function b(){m<=0?document.getElementById("one-match-backward-"+n).setAttribute("disabled","disabled"):document.getElementById("one-match-backward-"+n).removeAttribute("disabled"),m>=h-1?document.getElementById("one-match-forward-"+n).setAttribute("disabled","disabled"):document.getElementById("one-match-forward-"+n).removeAttribute("disabled")}function g(){d.innerHTML=h+" matches"}const f=function(t,e){let n;return function(){const i=this,o=arguments;clearTimeout(n),n=setTimeout(()=>t.apply(i,o),e)}}((function(t){void document.querySelectorAll("span."+l).forEach(t=>{Array.from(t.childNodes).forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&t.removeChild(e)}),t.classList.contains(l)&&(t.outerHTML=t.innerHTML)}),h=0,m=-1,t.length>=2&&('"'===t[0]&&'"'===t[t.length-1]||"'"===t[0]&&"'"===t[t.length-1])&&(t=t.substring(1,t.length-1));if(""===t)return void g();let e=0;!function i(o){if(3!==o.nodeType||function(t){for(;t;){if(t.classList&&t.classList.contains("hidden"))return!0;t=t.parentNode}return!1}(o))1===o.nodeType&&Array.from(o.childNodes).forEach(i);else{const i=function(i){const o=i.nodeValue,s=new RegExp(t,"gi");let c,a=0,r=document.createDocumentFragment();for(;null!==(c=s.exec(o));){r.appendChild(document.createTextNode(o.substring(a,c.index)));const t=document.createElement("span");t.textContent=c[0],t.classList.add(l),t.classList.add(u),t.setAttribute("id",n+"-"+e),r.appendChild(t),h=e+1,e++,a=c.index+c[0].length}return r.appendChild(document.createTextNode(o.substring(a))),r}(o);i.childNodes.length>1&&o.parentNode.replaceChild(i,o)}}(i);let o=document.querySelector("."+u);null!==o&&p(o);g(),b(),m=-1}),600);a.addEventListener("click",(function(){m--;const t=document.querySelector("#"+n+"-"+m);t&&p(t),t.classList.add("active"),setTimeout(()=>{t.classList.remove("active")},3e3),b()})),r.addEventListener("click",(function(){m++;const t=document.querySelector("#"+n+"-"+m);t&&p(t),t.classList.add("active"),setTimeout(()=>{t.classList.remove("active")},3e3),b()})),document.addEventListener("keyup",t=>{switch(t.key){case"ArrowRight":r.click();break;case"ArrowLeft":a.click()}})}document.addEventListener("DOMContentLoaded",(function(){inPageSearch()}));
101
101
  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()}));
@@ -46,9 +46,10 @@ function editTermButtons() {
46
46
 
47
47
  // cut “url” on the “:” and keep the second part
48
48
  const fileName = url.split(":")[1];
49
+ const branch = specConfig.source.branch || "main";
49
50
 
50
51
  // add edit and history buttons to term
51
- term.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/${cleanedSpecDir}/${specConfig.spec_terms_directory}/${fileName}.md" class="p-1 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/${cleanedSpecDir}/${specConfig.spec_terms_directory}/${fileName}.md" class="p-1 history-term-button btn">📅</a></span>`;
52
+ term.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/${branch}/${cleanedSpecDir}/${specConfig.spec_terms_directory}/${fileName}.md" class="p-1 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/${branch}/${cleanedSpecDir}/${specConfig.spec_terms_directory}/${fileName}.md" class="p-1 history-term-button btn">📅</a></span>`;
52
53
  });
53
54
  }
54
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-up-t",
3
- "version": "1.1.49",
3
+ "version": "1.1.50",
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": {