@kanonak-protocol/sdk 3.28.1 → 3.28.2
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.
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import{a as T}from"./chunk-NIGFQYVA.js";import{a as
|
|
1
|
+
import{a as T}from"./chunk-NIGFQYVA.js";import{a as $}from"./chunk-QIIQ4G2Q.js";import{c as y,d as f,g as v,j as d,k as O,l as g}from"./chunk-W6T7MOKY.js";function G(s){let e=s.replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),t=[],n=0;for(;n<e.length;){let r=e[n];if(r.trim()===""){n++;continue}let a=/^(\s*)```(\S*)\s*$/.exec(r);if(a){let c=a[2],u=[];for(n++;n<e.length&&!/^(\s*)```\s*$/.test(e[n]);)u.push(e[n]),n++;n++;let l=W(u.join(`
|
|
4
|
-
`)),
|
|
4
|
+
`)),b=c?` class="language-${z(c)}"`:"";t.push(`<pre><code${b}>${l}</code></pre>`);continue}let o=/^(#{1,6})\s+(.*)$/.exec(r);if(o){let c=o[1].length,u=_(o[2].trim());t.push(`<h${c}>${u}</h${c}>`),n++;continue}if(r.includes("|")&&n+1<e.length&&D(e[n+1])){let c=F(r),u=re(e[n+1]);n+=2;let l=[];for(;n<e.length&&e[n].trim()!==""&&e[n].includes("|");)l.push(F(e[n])),n++;t.push(ae(c,u,l));continue}if(/^\s*[-*]\s+/.test(r)){let c=[];for(;n<e.length&&/^\s*[-*]\s+/.test(e[n]);){let u=[e[n].replace(/^\s*[-*]\s+/,"")];for(n++;n<e.length&&e[n].trim()!==""&&!/^\s*[-*]\s+/.test(e[n])&&!/^\s*\d+\.\s+/.test(e[n]);)u.push(e[n]),n++;n<e.length&&e[n].trim()===""&&n++,c.push(`<li>${_(u.join(" ").trim())}</li>`)}t.push(`<ul>
|
|
5
5
|
${c.join(`
|
|
6
6
|
`)}
|
|
7
7
|
</ul>`);continue}if(/^\s*\d+\.\s+/.test(r)){let c=[];for(;n<e.length&&/^\s*\d+\.\s+/.test(e[n]);){let u=[e[n].replace(/^\s*\d+\.\s+/,"")];for(n++;n<e.length&&e[n].trim()!==""&&!/^\s*\d+\.\s+/.test(e[n])&&!/^\s*[-*]\s+/.test(e[n]);)u.push(e[n]),n++;n<e.length&&e[n].trim()===""&&n++,c.push(`<li>${_(u.join(" ").trim())}</li>`)}t.push(`<ol>
|
|
8
8
|
${c.join(`
|
|
9
9
|
`)}
|
|
10
10
|
</ol>`);continue}let i=[r];for(n++;n<e.length&&e[n].trim()!==""&&!/^(#{1,6})\s+/.test(e[n])&&!/^(\s*)```/.test(e[n])&&!/^\s*[-*]\s+/.test(e[n])&&!/^\s*\d+\.\s+/.test(e[n])&&!(e[n].includes("|")&&n+1<e.length&&D(e[n+1]));)i.push(e[n]),n++;t.push(`<p>${_(i.join(" "))}</p>`)}return t.join(`
|
|
11
|
-
`)}function D(s){return s.includes("-")?/^[\s|:-]+$/.test(s):!1}function F(s){let e=s.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&(e=e.slice(0,-1)),e.split("|").map(t=>t.trim())}function
|
|
11
|
+
`)}function D(s){return s.includes("-")?/^[\s|:-]+$/.test(s):!1}function F(s){let e=s.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&(e=e.slice(0,-1)),e.split("|").map(t=>t.trim())}function re(s){return F(s).map(e=>{let t=e.startsWith(":"),n=e.endsWith(":");return t&&n?"center":n?"right":t?"left":null})}function ae(s,e,t){let n=o=>{let i=e[o];return i?` style="text-align:${i}"`:""},r=s.map((o,i)=>`<th${n(i)}>${_(o)}</th>`).join(""),a=t.map(o=>`<tr>${o.map((c,u)=>`<td${n(u)}>${_(c)}</td>`).join("")}</tr>`).join(`
|
|
12
12
|
`);return`<table>
|
|
13
13
|
<thead><tr>${r}</tr></thead>
|
|
14
14
|
<tbody>
|
|
15
15
|
${a}
|
|
16
16
|
</tbody>
|
|
17
|
-
</table>`}function _(s){let e=W(s);return e=e.replace(/`([^`\n]+)`/g,(t,n)=>`<code>${n}</code>`),e=e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(t,n,r)=>`<a href="${z(r)}">${n}</a>`),e=e.replace(/\*\*([^*\n]+)\*\*/g,(t,n)=>`<strong>${n}</strong>`),e=e.replace(/(^|[^*])\*([^*\n]+)\*(?!\*)/g,(t,n,r)=>`${n}<em>${r}</em>`),e=e.replace(/(^|[\s(])_([^_\n]+)_(?=[\s).,;:!?]|$)/g,(t,n,r)=>`${n}<em>${r}</em>`),e}function W(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function z(s){return s.replace(/"/g,""").replace(/&/g,"&")}var P={publisher:"kanonak.org",package_:"derivation",name:"look"},
|
|
17
|
+
</table>`}function _(s){let e=W(s);return e=e.replace(/`([^`\n]+)`/g,(t,n)=>`<code>${n}</code>`),e=e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(t,n,r)=>`<a href="${z(r)}">${n}</a>`),e=e.replace(/\*\*([^*\n]+)\*\*/g,(t,n)=>`<strong>${n}</strong>`),e=e.replace(/(^|[^*])\*([^*\n]+)\*(?!\*)/g,(t,n,r)=>`${n}<em>${r}</em>`),e=e.replace(/(^|[\s(])_([^_\n]+)_(?=[\s).,;:!?]|$)/g,(t,n,r)=>`${n}<em>${r}</em>`),e}function W(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function z(s){return s.replace(/"/g,""").replace(/&/g,"&")}var P={publisher:"kanonak.org",package_:"derivation",name:"look"},C={publisher:"kanonak.org",package_:"derivation",name:"tokens"},x={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"},I={publisher:"kanonak.org",package_:"core-rdf",name:"label"},oe={publisher:"kanonak.org",package_:"core-rdf",name:"comment"},se={publisher:"kanonak.org",package_:"look",name:"Hero"},ie={publisher:"kanonak.org",package_:"look",name:"PropertyList"},ce={publisher:"kanonak.org",package_:"look",name:"BadgeRow"},ue={publisher:"kanonak.org",package_:"look",name:"ChipRow"},le={publisher:"kanonak.org",package_:"look",name:"ReferenceList"},q={publisher:"kanonak.org",package_:"look",name:"Markdown"},E={publisher:"kanonak.org",package_:"look",name:"NavGroup"},N={publisher:"kanonak.org",package_:"look",name:"NavLink"},Y={publisher:"kanonak.org",package_:"look",name:"target"},V={publisher:"kanonak.org",package_:"look",name:"bands"},pe={publisher:"kanonak.org",package_:"look",name:"title"},fe={publisher:"kanonak.org",package_:"look",name:"eyebrow"},de={publisher:"kanonak.org",package_:"look",name:"subtitle"},J={publisher:"kanonak.org",package_:"look",name:"badges"},R={publisher:"kanonak.org",package_:"look",name:"source"},ge={publisher:"kanonak.org",package_:"look",name:"chips"},B={publisher:"kanonak.org",package_:"look",name:"entries"},ke={publisher:"kanonak.org",package_:"look",name:"urlForm"},M=class{constructor(e){this.catalog=e}catalog;findCascadedLook(e){let t=new Set,n=S(e);for(;n.length>0;){let r=n.shift(),a=w(r.subject);if(t.has(a))continue;t.add(a);let o=j(this.catalog,r.subject);if(!o)continue;let i=Q(o);if(i)return{declaration:i,sourceClass:{publisher:r.subject.publisher,package_:r.subject.package_,name:r.subject.name}};for(let c of A(o))n.push(c)}if(!t.has(w(x))){let r=j(this.catalog,x);if(r){let a=Q(r);if(a)return{declaration:a,sourceClass:{...x}}}}}findCascadedTokens(e){let t=new Map;for(let[a,o]of H(e))t.has(a)||t.set(a,o);let n=new Set,r=S(e);for(;r.length>0;){let a=r.shift(),o=w(a.subject);if(n.has(o))continue;n.add(o);let i=ne(this.catalog,a.subject);if(i.length!==0)for(let c of i){for(let[u,l]of H(c))t.has(u)||t.set(u,l);for(let u of A(c))r.push(u)}}if(!n.has(w(x))){let a=ne(this.catalog,x);for(let o of a)for(let[i,c]of H(o))t.has(i)||t.set(i,c)}return t}renderStylesheet(e){let t=this.findCascadedTokens(e),n=[];for(let[a,o]of t)n.push(` --kan-${a}: ${o};`);return`${n.length>0?`:root {
|
|
18
18
|
${n.join(`
|
|
19
19
|
`)}
|
|
20
20
|
}`:":root { /* no tokens resolved */ }"}
|
|
21
|
-
${
|
|
21
|
+
${me}`}renderHtml(e){let t=this.findCascadedLook(e);if(!t)return`<!-- LookRenderer: no derivation.look found for ${e.namespace}/${e.name} -->`;let n=X(t.declaration);if(n.length===0)return"<!-- LookRenderer: look declaration has no bands -->";let r=te(e),a=[];for(let o of n)a.push(this.renderBand(o,e,r));return a.join(`
|
|
22
22
|
`)}renderDocument(e){let t=this.renderHtml(e),n=this.readPropertyValueText(e,I)??e.name,r=`${e.name}.css`,a=this.hasSvgDerivation(e)?`<figure class="kan-figure"><img src="${p(e.name)}.svg" alt=""></figure>
|
|
23
|
-
`:"",o=
|
|
23
|
+
`:"",o=te(e),i=this.renderNavGroup(e,o);return`<!doctype html>
|
|
24
24
|
<html lang="en">
|
|
25
25
|
<head>
|
|
26
26
|
<meta charset="utf-8">
|
|
@@ -35,16 +35,16 @@ ${a}${t}
|
|
|
35
35
|
</main>
|
|
36
36
|
</body>
|
|
37
37
|
</html>
|
|
38
|
-
`}hasSvgDerivation(e){let t=new Set,n=
|
|
38
|
+
`}hasSvgDerivation(e){let t=new Set,n=S(e);for(;n.length>0;){let r=n.shift(),a=w(r.subject);if(t.has(a))continue;t.add(a);let o=j(this.catalog,r.subject);if(o){for(let i of o.statement)if(i instanceof g&&k(i,"kanonak.org","derivation","derivations")){for(let c of i.object??[])if(c instanceof $)for(let u of c.statement){if(!(u instanceof d)||!k(u,"kanonak.org","derivation","format")||!(u.object instanceof f))continue;let l=u.object.subject;if(l.publisher==="kanonak.org"&&l.package_==="formats"&&l.name==="svg")return!0}}for(let i of A(o))n.push(i)}}return!1}renderBand(e,t,n){let r=Z(e);return r?h(r,se)?this.renderHero(e,t,n):h(r,ie)?this.renderPropertyList(e,t,n):h(r,ce)?this.renderBadgeRow(e,t,n):h(r,ue)?this.renderChipRow(e,t,n):h(r,le)?this.renderReferenceList(e,t,n):h(r,q)?this.renderMarkdown(e,t):h(r,E)?this.renderNavGroup(t,n):`<!-- LookRenderer: unsupported band ${r.publisher}/${r.package_}/${r.name} -->`:"<!-- LookRenderer: band has no rdf:type -->"}renderNavGroup(e,t){let n=this.findNavGroupForPublisher(t);if(!n)return"";let r=K(n,B);if(!(r instanceof g))return"";let a=r.object??[];if(a.length===0)return"";let o=[];for(let i of a){if(!(i instanceof f))continue;let c=j(this.catalog,{publisher:i.subject.publisher,package_:i.subject.package_,name:i.subject.name}),{href:u,label:l}=this.resolveNavEntry(i,c,t),b=`/${e.namespace?.split("/")[1]?.split("@")[0]}/${(e.namespace||"").split("@")[1]}/${e.name}`,U=u===b?' aria-current="page"':"";o.push(`<li><a class="kan-nav-link" href="${p(u)}"${U}>${p(l)}</a></li>`)}return`<nav class="kan-site-nav"><ul>
|
|
39
39
|
${o.join(`
|
|
40
40
|
`)}
|
|
41
|
-
</ul></nav>`}resolveNavEntry(e,t,n){if(t&&
|
|
41
|
+
</ul></nav>`}resolveNavEntry(e,t,n){if(t&&S(t).map(c=>c.subject).some(c=>c.publisher===N.publisher&&c.package_===N.package_&&c.name===N.name)){let c=L(t,I),u=K(t,Y);if(u instanceof d&&u.object instanceof f){let l=u.object,b=this.readLabelForUri({publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name});return{href:this.urlForReference(l,Y,n),label:c??b??l.subject.name}}}let r=T.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},"*",{contextPublisher:n}),a=t?L(t,I)??e.subject.name:e.subject.name;return{href:r,label:a}}findNavGroupForPublisher(e){for(let t of this.catalog){if(!(t instanceof y)||!(t.namespace||"").startsWith(`${e}/`))continue;if(S(t).map(o=>o.subject).some(o=>o.publisher===E.publisher&&o.package_===E.package_&&o.name===E.name))return t}}renderMarkdown(e,t){let n=m(e,R);if(!n)return"<!-- LookRenderer.Markdown: no look.source -->";let r=this.readPropertyValueText(t,n);return r?`<section class="kan-markdown">
|
|
42
42
|
${G(r)}
|
|
43
|
-
</section>`:""}renderRawMarkdown(e){let t=this.findCascadedLook(e);if(!t)return;let n=X(t.declaration),r=[];for(let a of n){let o=Z(a);if(!o||!h(o,q))continue;let i=
|
|
43
|
+
</section>`:""}renderRawMarkdown(e){let t=this.findCascadedLook(e);if(!t)return;let n=X(t.declaration),r=[];for(let a of n){let o=Z(a);if(!o||!h(o,q))continue;let i=m(a,R);if(!i)continue;let c=this.readPropertyValueText(e,i);c&&r.push(c)}return r.length>0?r.join(`
|
|
44
44
|
|
|
45
|
-
`):void 0}renderHero(e,t,n){let r=['<header class="kan-hero">'],a=
|
|
46
|
-
`)}renderPropertyList(e,t,n){let r=
|
|
47
|
-
`)}renderBadgeRow(e,t,n){let r=
|
|
45
|
+
`):void 0}renderHero(e,t,n){let r=['<header class="kan-hero">'],a=m(e,fe);if(a){let l=this.readPropertyValueText(t,a);l&&r.push(`<span class="kan-hero-eyebrow">${p(l)}</span>`)}let o=m(e,pe),i="";o&&(i=this.readPropertyValueText(t,o)??""),i||(i=t.name),r.push(`<h1 class="kan-hero-title">${p(i)}</h1>`);let c=m(e,de);if(c){let l=this.readPropertyValueText(t,c);l&&r.push(`<p class="kan-hero-subtitle">${p(l)}</p>`)}let u=m(e,J);if(u){let l=this.readPropertyValueReferences(t,u);if(l.length>0){let b=l.map(U=>this.renderBadge(U,J,n)).join("");r.push(`<div class="kan-hero-badges">${b}</div>`)}}return r.push("</header>"),r.join(`
|
|
46
|
+
`)}renderPropertyList(e,t,n){let r=m(e,R);if(!r)return"<!-- LookRenderer: PropertyList missing look.source -->";let a=this.readLabelForUri(r)??r.name,o=K(t,r),i=this.gatherValueItems(o),c=i.length>0?i.map(u=>`<li>${this.renderInlineValue(u,R,n)}</li>`).join(""):'<li class="kan-empty">(no values)</li>';return['<section class="kan-property-list">',`<h3 class="kan-property-list-title">${p(a)}</h3>`,`<ul class="kan-property-list-items">${c}</ul>`,"</section>"].join(`
|
|
47
|
+
`)}renderBadgeRow(e,t,n){let r=m(e,R);if(!r)return"<!-- LookRenderer: BadgeRow missing look.source -->";let a=this.readPropertyValueReferences(t,r);return a.length===0?"":`<div class="kan-badge-row">${a.map(i=>this.renderBadge(i,R,n)).join("")}</div>`}renderChipRow(e,t,n){let r=ee(e,ge);if(r.length===0)return"<!-- LookRenderer: ChipRow has no look.chips -->";let a=[];for(let o of r){let i=K(t,o);if(!i)continue;let c=this.readLabelForUri(o)??o.name,u=this.renderStatementInlineValue(i,o,n);u&&a.push(`<span class="kan-chip"><span class="kan-chip-key">${p(c)}</span> <span class="kan-chip-val">${u}</span></span>`)}return a.length===0?"":`<div class="kan-chip-row">${a.join("")}</div>`}renderReferenceList(e,t,n){let r=ee(e,B);if(r.length===0)return"<!-- LookRenderer: ReferenceList has no look.entries -->";let a=[];for(let o of r){let i=this.readPropertyValueReferences(t,o);if(i.length===0)continue;let c=this.readLabelForUri(o)??o.name,u=i.map(l=>this.renderReferenceLink(l,B,n)).join(", ");a.push(`<dt>${p(c)}</dt><dd>${u}</dd>`)}return a.length===0?"":`<dl class="kan-reference-list">${a.join("")}</dl>`}readPropertyValueText(e,t){let n=K(e,t);if(n){if(n instanceof v)return n.object;if(n instanceof d){let r=n.object;return this.readLabelForUri({publisher:r.subject.publisher,package_:r.subject.package_,name:r.subject.name})??r.subject.name}if(n instanceof g)return(n.object??[]).map(a=>a instanceof f?this.readLabelForUri({publisher:a.subject.publisher,package_:a.subject.package_,name:a.subject.name})??a.subject.name:a instanceof $?a.name??"":String(a)).filter(a=>a).join(", ")}}readPropertyValueReferences(e,t){let n=K(e,t);if(!n)return[];if(n instanceof d)return[n.object];if(n instanceof g){let r=[];for(let a of n.object??[])a instanceof f&&r.push(a);return r}return[]}gatherValueItems(e){return e?e instanceof g?e.object??[]:e instanceof d?[e.object]:e instanceof O?[e.object]:e instanceof v?[e.object]:[]:[]}renderInlineValue(e,t,n){return e instanceof f?this.renderReferenceLink(e,t,n):e instanceof $?p(e.name??"(embedded)"):typeof e=="string"?p(e):typeof e=="number"||typeof e=="boolean"?p(String(e)):""}renderStatementInlineValue(e,t,n){return e instanceof v?p(e.object):e instanceof d?this.renderReferenceLink(e.object,t,n):e instanceof g?(e.object??[]).map(a=>this.renderInlineValue(a,t,n)).filter(a=>a).join(", "):""}renderReferenceLink(e,t,n){let r=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name,a=this.urlForReference(e,t,n);return`<a class="kan-link" href="${p(a)}">${p(r)}</a>`}renderBadge(e,t,n){let r=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name,a=this.readCommentForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name}),o=this.urlForReference(e,t,n),i=a?` title="${p(a)}"`:"";return`<a class="kan-badge" href="${p(o)}"${i}>${p(r)}</a>`}urlForReference(e,t,n){let r=t?this.getUrlFormForProperty(t):"=";return T.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},r,{contextPublisher:n})}getUrlFormForProperty(e){let t=j(this.catalog,e);if(!t)return"=";let n=L(t,ke);return n==="*"||n==="^"||n==="~"||n==="="?n:"="}readLabelForUri(e){let t=j(this.catalog,e);if(t)return L(t,I)}readCommentForUri(e){let t=j(this.catalog,e);if(t)return L(t,oe)}};function H(s){let e=new Map;for(let t of s.statement){if(!(t instanceof O)||!k(t,C.publisher,C.package_,C.name))continue;let n=t.object;for(let r of n.statement){if(!(r instanceof v))continue;let a=r.predicate?.subject?.name;if(!a)continue;let o=r.object;e.has(a)||e.set(a,o)}}return e}function Q(s){for(let e of s.statement)if(e instanceof O&&k(e,P.publisher,P.package_,P.name))return e.object}function X(s){for(let e of s.statement){if(!(e instanceof g)||!k(e,V.publisher,V.package_,V.name))continue;let t=[];for(let n of e.object??[])n instanceof $&&t.push(n);return t}return[]}function Z(s){for(let e of s.statement)if(e instanceof d&&e.predicate?.subject?.name==="type"&&e.object instanceof f){let t=e.object.subject;return{publisher:t.publisher,package_:t.package_,name:t.name}}}function m(s,e){for(let t of s.statement)if(t instanceof d&&k(t,e.publisher,e.package_,e.name)&&t.object instanceof f){let n=t.object.subject;return{publisher:n.publisher,package_:n.package_,name:n.name}}}function ee(s,e){for(let t of s.statement){if(!(t instanceof g)||!k(t,e.publisher,e.package_,e.name))continue;let n=[];for(let r of t.object??[])r instanceof f&&n.push({publisher:r.subject.publisher,package_:r.subject.package_,name:r.subject.name});return n}return[]}function K(s,e){for(let t of s.statement)if(k(t,e.publisher,e.package_,e.name))return t}function L(s,e){for(let t of s.statement)if(t instanceof v&&k(t,e.publisher,e.package_,e.name))return t.object}function S(s){let e=[];for(let t of s.statement)if(t instanceof d){if(t.predicate?.subject?.name!=="type")continue;t.object instanceof f&&e.push(t.object)}else if(t instanceof g){if(t.predicate?.subject?.name!=="type")continue;for(let n of t.object??[])n instanceof f&&e.push(n)}return e}function A(s){let e=[];for(let t of s.statement)if(t instanceof d){if(t.predicate?.subject?.name!=="subClassOf")continue;t.object instanceof f&&e.push(t.object)}else if(t instanceof g){if(t.predicate?.subject?.name!=="subClassOf")continue;for(let n of t.object??[])n instanceof f&&e.push(n)}return e}function ne(s,e){let t=[];for(let n of s){if(!(n instanceof y)||n.name!==e.name)continue;(n.namespace||"").startsWith(`${e.publisher}/${e.package_}@`)&&t.push(n)}return t}function j(s,e){let t="version"in e?e.version:void 0;if(t){let n=`${e.publisher}/${e.package_}@${t.major}.${t.minor}.${t.patch}`;for(let r of s)if(r instanceof y&&r.name===e.name&&r.namespace===n)return r}for(let n of s){if(!(n instanceof y)||n.name!==e.name)continue;if((n.namespace||"").startsWith(`${e.publisher}/${e.package_}@`))return n}}function k(s,e,t,n){let r=s.predicate?.subject;return r?r.publisher===e&&r.package_===t&&r.name===n:!1}function h(s,e){return s.publisher===e.publisher&&s.package_===e.package_&&s.name===e.name}function w(s){return`${s.publisher}/${s.package_}/${s.name}`}function te(s){let e=s.namespace||"",t=e.indexOf("/");return t>=0?e.substring(0,t):e}function p(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var me=`
|
|
48
48
|
* { box-sizing: border-box; }
|
|
49
49
|
body {
|
|
50
50
|
background: var(--kan-bg);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ze,b as Qe,c as et,d as tt,e as rt,f as nt,g as ot,h as at,i as it,j as st}from"./chunk-JLFC6WKB.js";import{b as Yt}from"./chunk-
|
|
1
|
+
import{a as Ze,b as Qe,c as et,d as tt,e as rt,f as nt,g as ot,h as at,i as it,j as st}from"./chunk-JLFC6WKB.js";import{b as Yt}from"./chunk-LBNJCQ7K.js";import{a as qe,b as Ye,c as Xe,d as b,e as S,f as i}from"./chunk-POFL6NMI.js";import{a as qt}from"./chunk-BQOD26BC.js";import{a as Te,b as je,c as Le,d as Fe,e as Ne}from"./chunk-AZSZXLEH.js";import{a as Be,b as De,c as Oe,d as Ae}from"./chunk-AV4AVTI6.js";import{a as lt,b as dt,c as ut,d as pt}from"./chunk-TWIWVG7W.js";import{a as Je,b as mt,c as ft,d as yt,e as ht}from"./chunk-4TJZIM7A.js";import{a as gt}from"./chunk-NIGFQYVA.js";import{A as Mt,B as zt,C as Gt,D as Wt,E as Jt,a as kt,b as bt,c as St,d as Ct,e as Pt,f as Rt,g as wt,h as xt,i as $t,j as vt,k as Et,l as Kt,m as Bt,n as It,o as Tt,p as jt,q as Lt,r as Ft,s as Nt,t as Dt,u as Ot,v as At,w as Ut,x as Vt,y as Ht,z as _t}from"./chunk-MV2LZFUK.js";import"./chunk-FJ35VIV6.js";import{a as F,b as D,c as Me,e as We}from"./chunk-QIIQ4G2Q.js";import{a as Ue,b as j,c as L,d as N,e as He,f as _e,g as O,h as A,i as U,j as V,k as H,l as _}from"./chunk-W6T7MOKY.js";import{a as Ie}from"./chunk-MYITGTGJ.js";import{a as Pe,b as Re,c as we,d as xe,e as $e,f as ve,g as Ee,h as Ke}from"./chunk-FQHALFRR.js";import{b as ze,c as Ge}from"./chunk-5ILSX24H.js";import{a as Ve}from"./chunk-FUUTGGJS.js";import{a as ct}from"./chunk-ODIECDN7.js";import{VersionOperator as oo}from"@kanonak-protocol/types/document/models/enums";import{existsSync as fr,readFileSync as yr}from"fs";import{homedir as gr}from"os";import{join as hr}from"path";import{execFile as Xt}from"child_process";import{promisify as Zt}from"util";var C=Zt(Xt),P="kanonak",R="/usr/bin/security",p=class{async get(e){let r=i(e);try{let{stdout:n}=await C(R,["find-generic-password","-s",P,"-a",r,"-w"],{timeout:1e4});try{return JSON.parse(n.trim())}catch{throw new Error(`Stored credential for '${r}' is corrupted (not valid JSON).
|
|
2
2
|
Run 'kanonak logout ${r}' then 'kanonak login ${r}' to fix.`)}}catch(n){if(X(n,44))return null;throw new Error(`macOS Keychain read failed for '${r}': ${w(n)}
|
|
3
3
|
The Keychain may be locked or inaccessible.
|
|
4
4
|
Try unlocking it via Keychain Access.app or running 'security unlock-keychain'.`)}}async store(e,r){let n=i(e),o=JSON.stringify(r);try{await C(R,["add-generic-password","-s",P,"-a",n,"-U","-w",o],{timeout:1e4})}catch(a){throw new Error(`macOS Keychain write failed for '${n}': ${w(a)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as E,c as F,d as f,f as M}from"../chunk-2JQMUZWN.js";import{a as X,b as ye}from"../chunk-
|
|
1
|
+
import{b as E,c as F,d as f,f as M}from"../chunk-2JQMUZWN.js";import{a as X,b as ye}from"../chunk-LBNJCQ7K.js";import{a as Oe}from"../chunk-BQOD26BC.js";import"../chunk-TWIWVG7W.js";import"../chunk-NIGFQYVA.js";import{a as Ue}from"../chunk-FJ35VIV6.js";import{a as C,c as Re,e as Ce}from"../chunk-QIIQ4G2Q.js";import{b as K,c as w,d as b,g as L,h as U,i as O,j,k as T,l as S}from"../chunk-W6T7MOKY.js";import{a as Le}from"../chunk-MYITGTGJ.js";import"../chunk-5ILSX24H.js";import"../chunk-FUUTGGJS.js";var gt="kanonak.org",yt="document-ast",m=t=>({publisher:gt,package_:yt,name:t}),k={Document:m("Document"),Block:m("Block"),Inline:m("Inline"),StructuredValue:m("StructuredValue"),Heading:m("Heading"),Paragraph:m("Paragraph"),RawBlock:m("RawBlock"),Text:m("Text"),StructuredMap:m("StructuredMap"),StructuredEntry:m("StructuredEntry"),StructuredList:m("StructuredList"),StringScalar:m("StringScalar"),IntegerScalar:m("IntegerScalar"),EscapeHint:m("EscapeHint"),MediaType:m("MediaType"),metadata:m("metadata"),children:m("children"),level:m("level"),inlines:m("inlines"),text:m("text"),entries:m("entries"),key:m("key"),value:m("value"),escapeHint:m("escapeHint"),items:m("items"),stringValue:m("stringValue"),integerValue:m("integerValue"),rawContent:m("rawContent"),mediaType:m("mediaType"),mimeType:m("mimeType"),ESC_RAW:m("esc-raw"),ESC_YAML_SAFE:m("esc-yaml-safe"),ESC_TOML_STRING:m("esc-toml-string"),ESC_TOML_MULTILINE:m("esc-toml-multiline"),ESC_JSON:m("esc-json"),ESC_DYNAMODB_BOOL:m("esc-dynamodb-bool"),ESC_DYNAMODB_NUMBER:m("esc-dynamodb-number"),ESC_DYNAMODB_NULL:m("esc-dynamodb-null"),TEXT_PLAIN:m("text-plain"),TEXT_MARKDOWN:m("text-markdown"),TEXT_HTML:m("text-html"),TEXT_CSS:m("text-css"),APPLICATION_JSON:m("application-json"),TEXT_YAML:m("text-yaml"),IMAGE_SVG_XML:m("image-svg-xml"),ResourceLink:m("ResourceLink"),target:m("target"),linkLabel:m("linkLabel"),PropertyList:m("PropertyList"),propertyEntries:m("propertyEntries"),PropertyEntry:m("PropertyEntry"),propertyKey:m("propertyKey"),propertyValue:m("propertyValue"),Table:m("Table"),tableColumnLabels:m("tableColumnLabels"),tableRows:m("tableRows"),TableRow:m("TableRow"),tableCells:m("tableCells")};function Ne(t,e){return t.publisher===e.publisher&&t.package_===e.package_&&t.name===e.name}var Y=class{backendUri="kanonak.org/transformations/markdown-with-frontmatter";render(e,n){let r=kt(e.metadata,n),a=wt(e.children),u=["---",...r,"---","",a].join(`
|
|
2
2
|
`);return n?.trailingNewline&&(u.endsWith(`
|
|
3
3
|
`)||(u+=`
|
|
4
4
|
`)),u}};function kt(t,e){if(!t)return[];let n=new Map;for(let c of t.entries)n.set(ue(c.key),c);let r=new Map;if(e?.metadataRenames)for(let[c,l]of e.metadataRenames)r.set(ue(c),l);let i=(e?.metadataKeys??t.entries.map(c=>c.key)).map(ue),u=[];for(let c of i){let l=n.get(c);if(!l)continue;let p=r.get(c),y=ue(p??c),h=Ie(l.value,l.escapeHint);h!==void 0&&u.push(`${y}: ${h}`)}return u}function ue(t){let e=t.lastIndexOf(".");return e===-1?t:t.substring(e+1)||t}function Ie(t,e){switch(t.kind){case"StringScalar":return ht(t.stringValue,e);case"IntegerScalar":return String(t.integerValue);case"StructuredList":{let n=[];for(let r of t.items){let a=Ie(r,e);a!==void 0&&n.push(a)}return n.join(", ")}case"StructuredMap":return;default:return}}function ht(t,e){return!e||Ne(e,k.ESC_RAW)?t:Ne(e,k.ESC_YAML_SAFE)?bt(t):t}function bt(t){return t.includes(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanonak-protocol/sdk",
|
|
3
|
-
"version": "3.28.
|
|
3
|
+
"version": "3.28.2",
|
|
4
4
|
"description": "Kanonak Protocol SDK - Document repository and parsing implementations for TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"yaml-parser"
|
|
114
114
|
],
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@kanonak-protocol/types": "^3.28.
|
|
116
|
+
"@kanonak-protocol/types": "^3.28.2",
|
|
117
117
|
"ignore": "^7.0.5",
|
|
118
118
|
"js-yaml": "^4.1.0",
|
|
119
119
|
"yaml": "^2.7.0"
|