@kanonak-protocol/sdk 3.30.0 → 3.31.0
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/dist/chunk-DNV7ES5F.js +116 -0
- package/dist/index.js +1 -1
- package/dist/look/LookRenderer.d.ts +35 -2
- package/dist/transformations/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-M5P56WR3.js +0 -116
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import{a as ee}from"./chunk-NIGFQYVA.js";import{a as te}from"./chunk-4YHWMYAZ.js";import{c as J,d as R,g as B,h as fe,i as Ke,j as U,k as Z,l as F}from"./chunk-W6T7MOKY.js";function Le(u){let e=u.replace(/\r\n/g,`
|
|
2
|
+
`).split(`
|
|
3
|
+
`),t=[],n=0;for(;n<e.length;){let s=e[n];if(s.trim()===""){n++;continue}let o=/^(\s*)```(\S*)\s*$/.exec(s);if(o){let i=o[2],c=[];for(n++;n<e.length&&!/^(\s*)```\s*$/.test(e[n]);)c.push(e[n]),n++;n++;let l=we(c.join(`
|
|
4
|
+
`)),d=i?` class="language-${Oe(i)}"`:"";t.push(`<pre><code${d}>${l}</code></pre>`);continue}let r=/^(#{1,6})\s+(.*)$/.exec(s);if(r){let i=r[1].length,c=ne(r[2].trim());t.push(`<h${i}>${c}</h${i}>`),n++;continue}if(s.includes("|")&&n+1<e.length&&Se(e[n+1])){let i=de(s),c=Xe(e[n+1]);n+=2;let l=[];for(;n<e.length&&e[n].trim()!==""&&e[n].includes("|");)l.push(de(e[n])),n++;t.push(ze(i,c,l));continue}if(/^\s*[-*]\s+/.test(s)){let i=[];for(;n<e.length&&/^\s*[-*]\s+/.test(e[n]);){let c=[e[n].replace(/^\s*[-*]\s+/,"")];for(n++;n<e.length&&e[n].trim()!==""&&!/^\s*[-*]\s+/.test(e[n])&&!/^\s*\d+\.\s+/.test(e[n]);)c.push(e[n]),n++;n<e.length&&e[n].trim()===""&&n++,i.push(`<li>${ne(c.join(" ").trim())}</li>`)}t.push(`<ul>
|
|
5
|
+
${i.join(`
|
|
6
|
+
`)}
|
|
7
|
+
</ul>`);continue}if(/^\s*\d+\.\s+/.test(s)){let i=[];for(;n<e.length&&/^\s*\d+\.\s+/.test(e[n]);){let c=[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]);)c.push(e[n]),n++;n<e.length&&e[n].trim()===""&&n++,i.push(`<li>${ne(c.join(" ").trim())}</li>`)}t.push(`<ol>
|
|
8
|
+
${i.join(`
|
|
9
|
+
`)}
|
|
10
|
+
</ol>`);continue}let a=[s];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&&Se(e[n+1]));)a.push(e[n]),n++;t.push(`<p>${ne(a.join(" "))}</p>`)}return t.join(`
|
|
11
|
+
`)}function Se(u){return u.includes("-")?/^[\s|:-]+$/.test(u):!1}function de(u){let e=u.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&(e=e.slice(0,-1)),e.split("|").map(t=>t.trim())}function Xe(u){return de(u).map(e=>{let t=e.startsWith(":"),n=e.endsWith(":");return t&&n?"center":n?"right":t?"left":null})}function ze(u,e,t){let n=r=>{let a=e[r];return a?` style="text-align:${a}"`:""},s=u.map((r,a)=>`<th${n(a)}>${ne(r)}</th>`).join(""),o=t.map(r=>`<tr>${r.map((i,c)=>`<td${n(c)}>${ne(i)}</td>`).join("")}</tr>`).join(`
|
|
12
|
+
`);return`<table>
|
|
13
|
+
<thead><tr>${s}</tr></thead>
|
|
14
|
+
<tbody>
|
|
15
|
+
${o}
|
|
16
|
+
</tbody>
|
|
17
|
+
</table>`}function ne(u){let e=we(u);return e=e.replace(/`([^`\n]+)`/g,(t,n)=>`<code>${n}</code>`),e=e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(t,n,s)=>`<a href="${Oe(s)}">${n}</a>`),e=e.replace(/\*\*([^*\n]+)\*\*/g,(t,n)=>`<strong>${n}</strong>`),e=e.replace(/(^|[^*])\*([^*\n]+)\*(?!\*)/g,(t,n,s)=>`${n}<em>${s}</em>`),e=e.replace(/(^|[\s(])_([^_\n]+)_(?=[\s).,;:!?]|$)/g,(t,n,s)=>`${n}<em>${s}</em>`),e}function we(u){return u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Oe(u){return u.replace(/"/g,""").replace(/&/g,"&")}var pe={publisher:"kanonak.org",package_:"derivation",name:"look"},he={publisher:"kanonak.org",package_:"derivation",name:"tokens"},N={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"},H={publisher:"kanonak.org",package_:"core-rdf",name:"label"},Ie={publisher:"kanonak.org",package_:"core-rdf",name:"comment"},Qe={publisher:"kanonak.org",package_:"look",name:"Hero"},Ze={publisher:"kanonak.org",package_:"look",name:"PropertyList"},en={publisher:"kanonak.org",package_:"look",name:"BadgeRow"},nn={publisher:"kanonak.org",package_:"look",name:"ChipRow"},tn={publisher:"kanonak.org",package_:"look",name:"ReferenceList"},Ue={publisher:"kanonak.org",package_:"look",name:"Markdown"},oe={publisher:"kanonak.org",package_:"look",name:"NavGroup"},ke={publisher:"kanonak.org",package_:"look",name:"NavLink"},xe={publisher:"kanonak.org",package_:"look",name:"target"},sn={publisher:"kanonak.org",package_:"look",name:"ResourceGrid"},rn={publisher:"kanonak.org",package_:"look",name:"Timeline"},an={publisher:"kanonak.org",package_:"look",name:"VersionDiff"},Fe={publisher:"kanonak.org",package_:"look",name:"orderBy"},Ee={publisher:"kanonak.org",package_:"look",name:"track"},Pe={publisher:"kanonak.org",package_:"look",name:"metricPath"},Te={publisher:"kanonak.org",package_:"look",name:"hueBy"},on={publisher:"kanonak.org",package_:"look",name:"lowerPath"},cn={publisher:"kanonak.org",package_:"look",name:"upperPath"},un={publisher:"kanonak.org",package_:"look",name:"axisMin"},ln={publisher:"kanonak.org",package_:"look",name:"axisMax"},fn={publisher:"kanonak.org",package_:"look",name:"valueLabel"};var dn={publisher:"kanonak.org",package_:"look",name:"semanticSvg"},pn={publisher:"kanonak.org",package_:"look",name:"tierChip"},hn={publisher:"kanonak.org",package_:"look",name:"tierIcon"},kn={publisher:"kanonak.org",package_:"look",name:"tierCard"},gn={publisher:"kanonak.org",package_:"look",name:"tierFull"};var ge={publisher:"kanonak.org",package_:"look",name:"bands"},mn={publisher:"kanonak.org",package_:"look",name:"title"},bn={publisher:"kanonak.org",package_:"look",name:"eyebrow"},jn={publisher:"kanonak.org",package_:"look",name:"subtitle"},Ce={publisher:"kanonak.org",package_:"look",name:"badges"},A={publisher:"kanonak.org",package_:"look",name:"source"},$n={publisher:"kanonak.org",package_:"look",name:"chips"},me={publisher:"kanonak.org",package_:"look",name:"entries"},_n={publisher:"kanonak.org",package_:"look",name:"urlForm"},$e=class{constructor(e){this.catalog=e}catalog;findCascadedLook(e){let t=je(e);if(t)return{declaration:t,sourceClass:{publisher:G(e),package_:(e.namespace||"").split("/")[1]?.split("@")[0]??"",name:e.name}};let n=new Set,s=D(e);for(;s.length>0;){let o=s.shift(),r=z(o.subject);if(n.has(r))continue;n.add(r);let a=x(this.catalog,o.subject);if(!a)continue;let i=je(a);if(i)return{declaration:i,sourceClass:{publisher:o.subject.publisher,package_:o.subject.package_,name:o.subject.name}};for(let c of ie(a))s.push(c)}if(!n.has(z(N))){let o=x(this.catalog,N);if(o){let r=je(o);if(r)return{declaration:r,sourceClass:{...N}}}}}findCascadedTokens(e){let t=new Map;for(let[o,r]of be(e))t.has(o)||t.set(o,r);let n=new Set,s=D(e);for(;s.length>0;){let o=s.shift(),r=z(o.subject);if(n.has(r))continue;n.add(r);let a=ce(this.catalog,o.subject);if(a.length!==0)for(let i of a){for(let[c,l]of be(i))t.has(c)||t.set(c,l);for(let c of ie(i))s.push(c)}}if(!n.has(z(N))){let o=ce(this.catalog,N);for(let r of o)for(let[a,i]of be(r))t.has(a)||t.set(a,i)}return t}renderSvg(e){let t=v(e,H)??e.name,n=(t.trim().charAt(0)||"?").toUpperCase(),s=`${e.namespace??""}/${e.name}`,o={label:t,firstLetter:n,uri:s},r=this.collectCascadedSvgTiers(e),a=m=>this.applyPlaceholders(m,e,o),i=a(r.tierChip??""),c=a(r.tierIcon??""),l=a(r.tierCard??""),d=a(r.tierFull??""),k=[...this.findCascadedTokens(e)].map(([m,b])=>`--kan-${m}: ${b};`).join(" ");return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" width="400" height="400" style="${se(k)}">
|
|
18
|
+
<style>
|
|
19
|
+
.tier-chip,.tier-icon,.tier-card{display:none}
|
|
20
|
+
.tier-full{display:block}
|
|
21
|
+
@media (max-width:400px){.tier-full{display:none}.tier-card{display:block}}
|
|
22
|
+
@media (max-width:160px){.tier-card{display:none}.tier-icon{display:block}}
|
|
23
|
+
@media (max-width:60px){.tier-icon{display:none}.tier-chip{display:block}}
|
|
24
|
+
</style>
|
|
25
|
+
<g class="tier-chip">${i}</g>
|
|
26
|
+
<g class="tier-icon">${c}</g>
|
|
27
|
+
<g class="tier-card">${l}</g>
|
|
28
|
+
<g class="tier-full">${d}</g>
|
|
29
|
+
</svg>`}applyPlaceholders(e,t,n){return e.replace(/\{\{([^}]+)\}\}/g,(s,o)=>{let r=o.trim();if(n[r]!==void 0)return se(n[r]);let a=this.resolvePath(t,r);return a===void 0?`{{${r}}}`:se(a)})}resolvePath(e,t){let n=t.split("/").map(a=>a.trim()).filter(a=>a.length>0);if(n.length===0)return;let s=e;for(let a=0;a<n.length-1;a++){if(!s)return;let i=Be(n[a]),c=He(s,i);if(!c)return;if(c instanceof U&&c.object instanceof R){let l=x(this.catalog,c.object.subject);if(!l)return;s=l}else if(c instanceof Z)s=c.object;else return}if(!s)return;let o=Be(n[n.length-1]),r=He(s,o);if(r){if(r instanceof B||r instanceof fe||r instanceof Ke)return String(r.object);if(r instanceof U&&r.object instanceof R){let a=r.object,i=x(this.catalog,a.subject);return i?v(i,H)??a.subject.name:a.subject.name}}}collectCascadedSvgTiers(e){let t={},n=r=>{let a=X(r,dn);if(!(a instanceof Z))return;let i=a.object,c=v(i,pn),l=v(i,hn),d=v(i,kn),g=v(i,gn);t.tierChip===void 0&&c!==void 0&&(t.tierChip=c),t.tierIcon===void 0&&l!==void 0&&(t.tierIcon=l),t.tierCard===void 0&&d!==void 0&&(t.tierCard=d),t.tierFull===void 0&&g!==void 0&&(t.tierFull=g)};n(e);let s=new Set,o=D(e);for(;o.length>0;){let r=o.shift(),a=z(r.subject);if(s.has(a))continue;s.add(a);let i=ce(this.catalog,r.subject);for(let c of i){n(c);for(let l of ie(c))o.push(l)}}if(!s.has(z(N)))for(let r of ce(this.catalog,N))n(r);return t}renderStylesheet(e){let t=this.findCascadedTokens(e),n=[];for(let[r,a]of t)n.push(` --kan-${r}: ${a};`);let s=n.length>0?`:root {
|
|
30
|
+
${n.join(`
|
|
31
|
+
`)}
|
|
32
|
+
}`:":root { /* no tokens resolved */ }",o=this.findBaseStylesheet(G(e))??"";return`${s}
|
|
33
|
+
${o}`}findBaseStylesheet(e){let t="kanonak.org/site/content",n,s;for(let r of this.catalog){if(!(r instanceof J)||r.name!=="base-stylesheet")continue;let a=r.namespace||"";a.startsWith(`${e}/look-styles@`)?n=r:a.startsWith("kanonak.org/look-styles@")&&(s=r)}let o=n??s;if(o)for(let r of o.statement){let a=r.predicate?.subject;if(!a)continue;if(`${a.publisher}/${a.package_}/${a.name}`===t&&r instanceof B)return r.object}}renderHtml(e){let t=this.findCascadedLook(e);if(!t)return`<!-- LookRenderer: no derivation.look found for ${e.namespace}/${e.name} -->`;let n=Ne(t.declaration);if(n.length===0)return"<!-- LookRenderer: look declaration has no bands -->";let s=G(e),o=[];for(let r of n)o.push(this.renderBand(r,e,s));return o.join(`
|
|
34
|
+
`)}renderPublisherIndex(e,t,n){let s=n?this.renderNavGroup(n,e):"",o=t.map(a=>{let i=a.comment?`<p class="kan-resource-card-subtitle">${f(a.comment)}</p>`:"";return`<a class="kan-resource-card" href="${f(a.href)}"><h3 class="kan-resource-card-title">${f(a.label)}</h3>${i}</a>`}).join(`
|
|
35
|
+
`),r=`<header class="kan-hero">
|
|
36
|
+
<h1 class="kan-hero-title">${f(e)}</h1>
|
|
37
|
+
</header>
|
|
38
|
+
<section class="kan-resource-grid">
|
|
39
|
+
${o}
|
|
40
|
+
</section>`;return`<!doctype html>
|
|
41
|
+
<html lang="en">
|
|
42
|
+
<head>
|
|
43
|
+
<meta charset="utf-8">
|
|
44
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
45
|
+
<title>${f(e)}</title>
|
|
46
|
+
<link rel="stylesheet" href="index.css">
|
|
47
|
+
</head>
|
|
48
|
+
<body>
|
|
49
|
+
${s}
|
|
50
|
+
<main class="kan-main">
|
|
51
|
+
${r}
|
|
52
|
+
</main>
|
|
53
|
+
</body>
|
|
54
|
+
</html>
|
|
55
|
+
`}renderPublisherIndexStylesheet(e){return e?this.renderStylesheet(e):""}hasDeclaredView(e){let t=this.findCascadedLook(e);return t?!(t.sourceClass.publisher===N.publisher&&t.sourceClass.package_===N.package_&&t.sourceClass.name===N.name):!1}renderPackageVersionList(e,t,n){let s=G(n),o=this.renderNavGroup(n,s),r=this.renderBreadcrumb(n,s,{bareOverview:!0}),a=t.map(c=>`<a class="kan-resource-card" href="/${f(e)}/${f(c)}/"><h3 class="kan-resource-card-title">${f(c)}</h3></a>`).join(`
|
|
56
|
+
`),i=`<header class="kan-hero">
|
|
57
|
+
<span class="kan-hero-eyebrow">PACKAGE</span>
|
|
58
|
+
<h1 class="kan-hero-title">${f(e)}</h1>
|
|
59
|
+
</header>
|
|
60
|
+
<section class="kan-resource-grid">
|
|
61
|
+
${a}
|
|
62
|
+
</section>`;return`<!doctype html>
|
|
63
|
+
<html lang="en">
|
|
64
|
+
<head>
|
|
65
|
+
<meta charset="utf-8">
|
|
66
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
67
|
+
<title>${f(e)}</title>
|
|
68
|
+
<link rel="stylesheet" href="${f(n.name)}.css">
|
|
69
|
+
</head>
|
|
70
|
+
<body>
|
|
71
|
+
${o}
|
|
72
|
+
${r}
|
|
73
|
+
<main class="kan-main">
|
|
74
|
+
${i}
|
|
75
|
+
</main>
|
|
76
|
+
</body>
|
|
77
|
+
</html>
|
|
78
|
+
`}renderDocument(e,t){let n=this.renderHtml(e),s=this.readPropertyValueText(e,H)??e.name,o=`${e.name}.css`,r=this.hasSvgDerivation(e)?`<figure class="kan-figure"><img src="${f(e.name)}.svg" alt=""></figure>
|
|
79
|
+
`:"",a=G(e),i=this.renderNavGroup(e,a),c=this.renderBreadcrumb(e,a,t);return`<!doctype html>
|
|
80
|
+
<html lang="en">
|
|
81
|
+
<head>
|
|
82
|
+
<meta charset="utf-8">
|
|
83
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
84
|
+
<title>${f(s)}</title>
|
|
85
|
+
<link rel="stylesheet" href="${f(o)}">
|
|
86
|
+
</head>
|
|
87
|
+
<body>
|
|
88
|
+
${i}
|
|
89
|
+
${c}
|
|
90
|
+
<main class="kan-main">
|
|
91
|
+
${r}${n}
|
|
92
|
+
</main>
|
|
93
|
+
</body>
|
|
94
|
+
</html>
|
|
95
|
+
`}hasSvgDerivation(e){let t=new Set,n=D(e);for(;n.length>0;){let s=n.shift(),o=z(s.subject);if(t.has(o))continue;t.add(o);let r=x(this.catalog,s.subject);if(r){for(let a of r.statement)if(a instanceof F&&V(a,"kanonak.org","derivation","derivations")){for(let i of a.object??[])if(i instanceof te)for(let c of i.statement){if(!(c instanceof U)||!V(c,"kanonak.org","derivation","format")||!(c.object instanceof R))continue;let l=c.object.subject;if(l.publisher==="kanonak.org"&&l.package_==="formats"&&l.name==="svg")return!0}}for(let a of ie(r))n.push(a)}}return!1}renderBand(e,t,n){let s=Ve(e);return s?E(s,Qe)?this.renderHero(e,t,n):E(s,Ze)?this.renderPropertyList(e,t,n):E(s,en)?this.renderBadgeRow(e,t,n):E(s,nn)?this.renderChipRow(e,t,n):E(s,tn)?this.renderReferenceList(e,t,n):E(s,Ue)?this.renderMarkdown(e,t):E(s,oe)?this.renderNavGroup(t,n):E(s,sn)?this.renderResourceGrid(e,n,t):E(s,rn)?this.renderTimeline(e,n):E(s,an)?this.renderVersionDiff(e,n):`<!-- LookRenderer: unsupported band ${s.publisher}/${s.package_}/${s.name} -->`:"<!-- LookRenderer: band has no rdf:type -->"}collectTrackedSeries(e,t,n,s){let{hueBy:o,lowerPath:r,upperPath:a}=s??{},i=new Map,c=e.length,l=(d,g)=>{let k=this.resolvePath(d,g);return k===void 0?NaN:parseFloat(k)};return e.forEach((d,g)=>{let k=this.readPropertyValueReferences(d,t);for(let m of k){let b=x(this.catalog,{publisher:m.subject.publisher,package_:m.subject.package_,name:m.subject.name,...m.subject.version?{version:m.subject.version}:{}});if(!b)continue;let h=m.subject.name,j=i.get(h);j||(j={key:h,label:v(b,H)??h,points:new Array(c).fill(null),...r?{lower:new Array(c).fill(null)}:{},...a?{upper:new Array(c).fill(null)}:{}},i.set(h,j));let y=l(b,n);if(Number.isFinite(y)&&(j.points[g]=y),r&&j.lower){let $=l(b,r);Number.isFinite($)&&(j.lower[g]=$)}if(a&&j.upper){let $=l(b,a);Number.isFinite($)&&(j.upper[g]=$)}if(o){let $=l(b,o);Number.isFinite($)&&(j.hue=$)}j.lastSubject=b}}),[...i.values()]}hrefForSubject(e,t,n="="){let s=e.namespace||"",o=s.split("/")[1]?.split("@")[0]??"",r=s.split("@")[1]??"",a=r?this.parseVersion(r):void 0;return ee.formatResourceUrl({publisher:G(e),package_:o,name:e.name,...a?{version:a}:{}},n,{contextPublisher:t})}renderVersionDiff(e,t){let n=K(e,A);if(!n)return"<!-- LookRenderer.VersionDiff: no look.source -->";let s=v(e,Pe),o=K(e,Ee);if(!o||!s)return"<!-- LookRenderer.VersionDiff: needs look.track + look.metricPath -->";let r=K(e,Fe),a=v(e,Te),i=this.findInstancesOfClass(n);if(i.length===0)return"<!-- LookRenderer.VersionDiff: no instances -->";let c=k=>r?this.readPropertyValueText(k,r)??"":"",l=i.slice().sort((k,m)=>c(k).localeCompare(c(m))),d=this.collectTrackedSeries(l,o,s,{hueBy:a});return d.length===0?"<!-- LookRenderer.VersionDiff: no tracked series -->":`<section class="kan-vdiff">${d.map((k,m)=>{let b=k.hue!==void 0?k.hue:Math.round(m*360/d.length),h=k.points.filter(W=>W!==null);if(h.length===0)return"";let j=h[0],y=h[h.length-1],$=y-j,P;if(Math.abs($)>=.005){let W=$>0?"up":"down",q=$>0?"\u25B2":"\u25BC";P=`<span class="kan-vdiff-delta ${W}">${$>0?"+":""}${$.toFixed(2)} ${q}</span>`}else P='<span class="kan-vdiff-delta flat">\u2014</span>';let Q=k.lastSubject?`<a href="${f(this.hrefForSubject(k.lastSubject,t))}">${f(k.label)}</a>`:f(k.label);return`<div class="kan-vdiff-row" style="--kan-vdiff-hue:${b}"><span class="kan-vdiff-label">${Q}</span><span class="kan-vdiff-start">${j.toFixed(2)}</span>`+this.sparkline(k.points,b)+`<span class="kan-vdiff-end">${y.toFixed(2)}</span>`+P+"</div>"}).join("")}</section>`}sparkline(e,t){let r=`hsl(${t},65%,60%)`,a=e.filter(h=>h!==null);if(a.length===0)return'<svg class="kan-vdiff-spark" viewBox="0 0 132 30" xmlns="http://www.w3.org/2000/svg"></svg>';let i=Math.min(...a),l=Math.max(...a)-i,d=e.length,g=h=>d<=1?132/2:4+h/(d-1)*124,k=h=>l<1e-9?30/2:26-(h-i)/l*22,m=[],b=[];return e.forEach((h,j)=>{if(h===null)return;let y=g(j),$=k(h);m.push(`${y.toFixed(1)},${$.toFixed(1)}`),b.push(`<circle cx="${y.toFixed(1)}" cy="${$.toFixed(1)}" r="2" fill="${r}"/>`)}),`<svg class="kan-vdiff-spark" viewBox="0 0 132 30" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" role="img"><polyline points="${m.join(" ")}" fill="none" stroke="${r}" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>`+b.join("")+"</svg>"}renderTimeline(e,t){let n=K(e,A);if(!n)return"<!-- LookRenderer.Timeline: no look.source -->";let s=K(e,Fe),o=this.findInstancesOfClass(n);if(o.length===0)return"<!-- LookRenderer.Timeline: no instances -->";let r=d=>s?this.readPropertyValueText(d,s)??"":"",a=o.slice().sort((d,g)=>r(d).localeCompare(r(g))),i=K(e,Ee),c=v(e,Pe);return i&&c?this.renderTrajectoryChart(a,i,c,e,t,r):`<section class="kan-timeline"><ol>
|
|
96
|
+
${a.map(d=>{let g=d.namespace||"",k=g.split("/")[1]?.split("@")[0]??"",m=g.split("@")[1]??"",b=m?this.parseVersion(m):void 0,h=ee.formatResourceUrl({publisher:G(d),package_:k,name:d.name,...b?{version:b}:{}},"=",{contextPublisher:t}),j=r(d),y=j?`<span class="kan-timeline-date">${f(j)}</span>`:"",$=m||d.name;return`<li class="kan-timeline-node"><a href="${f(h)}"><span class="kan-timeline-key">${f($)}</span>${y}</a></li>`}).join(`
|
|
97
|
+
`)}
|
|
98
|
+
</ol></section>`}renderTrajectoryChart(e,t,n,s,o,r){let a=s,i=v(a,Te),c=v(a,on),l=v(a,cn),d=v(a,fn),g=Me(a,un),k=Me(a,ln),m=e.length,b=this.collectTrackedSeries(e,t,n,{hueBy:i,lowerPath:c,upperPath:l});if(b.length===0)return"<!-- LookRenderer.Timeline: no tracked series -->";let h=[];for(let p of b){for(let _ of p.points)_!==null&&h.push(_);for(let _ of p.lower??[])_!==null&&h.push(_);for(let _ of p.upper??[])_!==null&&h.push(_)}if(h.length===0)return"<!-- LookRenderer.Timeline: no metric values -->";let j=Math.min(...h),y=Math.max(...h);y-j<1e-9&&(j-=.5,y+=.5);let $=(y-j)*.08,P=g!==void 0?g:j-$,Q=k!==void 0?k:y+$;Q-P<1e-9&&(Q=P+1);let W=1e3,q=440,S={top:28,right:24,bottom:56,left:52},_e=W-S.left-S.right,De=q-S.top-S.bottom,re=p=>m<=1?S.left+_e/2:S.left+p/(m-1)*_e,ae=p=>S.top+(1-(p-P)/(Q-P))*De,ue=(p,_)=>p.hue!==void 0?p.hue:Math.round(_*360/b.length),le=[];for(let p=0;p<5;p++){let _=P+p*(Q-P)/4,T=ae(_);le.push(`<line x1="${S.left}" y1="${T.toFixed(1)}" x2="${(W-S.right).toFixed(1)}" y2="${T.toFixed(1)}" class="kan-fan-grid"/>`),le.push(`<text x="${(S.left-8).toFixed(1)}" y="${(T+4).toFixed(1)}" class="kan-fan-axis" text-anchor="end">${_.toFixed(2)}</text>`)}let ve=[];e.forEach((p,_)=>{let T=this.hrefForSubject(p,o),w=(p.namespace||"").split("@")[1]??"",L=re(_),O=vn(r(p));ve.push(`<a href="${f(T)}" class="kan-fan-xtick"><line x1="${L.toFixed(1)}" y1="${S.top}" x2="${L.toFixed(1)}" y2="${(q-S.bottom).toFixed(1)}" class="kan-fan-vline"/><text x="${L.toFixed(1)}" y="${(q-S.bottom+20).toFixed(1)}" class="kan-fan-xlabel" text-anchor="middle">${se(w||p.name)}</text>`+(O?`<text x="${L.toFixed(1)}" y="${(q-S.bottom+36).toFixed(1)}" class="kan-fan-xdate" text-anchor="middle">${se(O)}</text>`:"")+"</a>")});let Re=[];b.forEach((p,_)=>{if(!p.lower||!p.upper)return;let T=ue(p,_),w=[],L=[];for(let I=0;I<m;I++){let Y=p.upper[I],M=p.lower[I];Y==null||M===null||M===void 0||(w.push(`${re(I).toFixed(1)},${ae(Y).toFixed(1)}`),L.unshift(`${re(I).toFixed(1)},${ae(M).toFixed(1)}`))}let O=w.concat(L);O.length<3||Re.push(`<polygon class="kan-fan-band" points="${O.join(" ")}" fill="hsl(${T},65%,60%)"/>`)});let ye=[];b.forEach((p,_)=>{let w=`hsl(${ue(p,_)},65%,60%)`,L=[],O=[];p.points.forEach((I,Y)=>{if(I===null)return;let M=re(Y),C=ae(I);L.push(`${M.toFixed(1)},${C.toFixed(1)}`),O.push(`<circle cx="${M.toFixed(1)}" cy="${C.toFixed(1)}" r="3.5" fill="${w}"/>`)}),L.length!==0&&ye.push(`<g class="kan-fan-series" data-series="${f(p.key)}"><polyline points="${L.join(" ")}" fill="none" stroke="${w}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/>`+O.join("")+"</g>")});let Ge=`<svg class="kan-fan-svg" viewBox="0 0 ${W} ${q}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img">`+le.join("")+ve.join("")+Re.join("")+ye.join("")+"</svg>",We=d?`${f(d)}=`:"",qe=b.map((p,_)=>{let T=ue(p,_),w=p.points.filter(C=>C!==null),L=w.length?w[0]:void 0,O=w.length?w[w.length-1]:void 0,I="";if(O!==void 0&&L!==void 0){let C=O-L;if(Math.abs(C)>=.005){let Ye=C>0?"up":"down",Je=C>0?"\u25B2":"\u25BC";I=` <span class="kan-fan-delta ${Ye}">${C>0?"+":""}${C.toFixed(2)} ${Je}</span>`}else I=' <span class="kan-fan-delta flat">\u2014</span>'}let Y=O!==void 0?`${We}${O.toFixed(2)}`:"\u2014",M=p.lastSubject?`<a href="${f(this.hrefForSubject(p.lastSubject,o))}">${f(p.label)}</a>`:f(p.label);return`<div class="kan-fan-legend-item" style="--kan-fan-hue:${T}"><span class="kan-fan-swatch"></span><span class="kan-fan-legend-label">${M}</span><span class="kan-fan-legend-cur">${Y}${I}</span></div>`});return`<section class="kan-fan"><div class="kan-fan-chart">${Ge}</div><div class="kan-fan-legend">${qe.join("")}</div></section>`}renderResourceGrid(e,t,n){let s=K(e,A);if(!s)return"<!-- LookRenderer.ResourceGrid: no look.source -->";let o=x(this.catalog,s),r=o?D(o).some(c=>{let l=c.subject.name;return l==="ObjectProperty"||l==="DatatypeProperty"||l==="Property"}):!1,a=[];if(r&&n){let c=this.readPropertyValueReferences(n,s);for(let l of c){let d=x(this.catalog,{publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name,...l.subject.version?{version:l.subject.version}:{}});d&&a.push(d)}}else a=this.findInstancesOfClass(s);if(a.length===0)return`<!-- LookRenderer.ResourceGrid: no resources for ${s.publisher}/${s.package_}/${s.name} -->`;let i=[];for(let c of a){let l=v(c,H)??c.name,d=v(c,Ie),g=c.namespace||"",k=g.split("/")[1]?.split("@")[0]??"",m=g.split("@")[1]??"",b=m?this.parseVersion(m):void 0,h=ee.formatResourceUrl({publisher:G(c),package_:k,name:c.name,...b?{version:b}:{}},"=",{contextPublisher:t}),j=d?`<p class="kan-resource-card-subtitle">${f(d)}</p>`:"";i.push(`<a class="kan-resource-card" href="${f(h)}"><h3 class="kan-resource-card-title">${f(l)}</h3>${j}</a>`)}return`<section class="kan-resource-grid">
|
|
99
|
+
${i.join(`
|
|
100
|
+
`)}
|
|
101
|
+
</section>`}parseVersion(e){let t=e.split(".").map(Number);if(!(t.length!==3||t.some(n=>Number.isNaN(n))))return{major:t[0],minor:t[1],patch:t[2]}}findInstancesOfClass(e){let t=[];for(let n of this.catalog){if(!(n instanceof J))continue;D(n).map(r=>r.subject).some(r=>r.publisher===e.publisher&&r.package_===e.package_&&r.name===e.name)&&t.push(n)}return t}renderBreadcrumb(e,t,n){let o=(e.namespace||"").split("/");if(o.length<2)return"";let r=o[0],a=o[1]??"",i=a.split("@")[0]??"",c=a.split("@")[1]??"";if(!r||!i)return"";if(n?.bareOverview)return`<nav class="kan-breadcrumb"><ol>
|
|
102
|
+
<li><a href="/">${f(r)}</a></li>
|
|
103
|
+
<li aria-current="page">${f(i)}</li>
|
|
104
|
+
</ol></nav>`;let l=e.name,g=!!x(this.catalog,{publisher:r,package_:i,name:i}),k=c?`${i}@${c}`:i,m=c?`/${i}/${c}/${i}`:`/${i}/${i}`,b=e.name===i,h=[];return h.push(`<li><a href="/">${f(r)}</a></li>`),b?h.push(`<li aria-current="page">${f(k)}</li>`):(h.push(g?`<li><a href="${f(m)}">${f(k)}</a></li>`:`<li>${f(k)}</li>`),h.push(`<li aria-current="page">${f(l)}</li>`)),`<nav class="kan-breadcrumb"><ol>
|
|
105
|
+
${h.join(`
|
|
106
|
+
`)}
|
|
107
|
+
</ol></nav>`}renderNavGroup(e,t){let n=this.findNavGroupForPublisher(t);if(!n)return"";let s=X(n,me);if(!(s instanceof F))return"";let o=s.object??[];if(o.length===0)return"";let r=[];for(let a of o){if(!(a instanceof R))continue;let i=x(this.catalog,{publisher:a.subject.publisher,package_:a.subject.package_,name:a.subject.name}),{href:c,label:l}=this.resolveNavEntry(a,i,t),d=`/${e.namespace?.split("/")[1]?.split("@")[0]}/${(e.namespace||"").split("@")[1]}/${e.name}`,g=c===d?' aria-current="page"':"";r.push(`<li><a class="kan-nav-link" href="${f(c)}"${g}>${f(l)}</a></li>`)}return`<nav class="kan-site-nav"><ul>
|
|
108
|
+
${r.join(`
|
|
109
|
+
`)}
|
|
110
|
+
</ul></nav>`}resolveNavEntry(e,t,n){if(t&&D(t).map(i=>i.subject).some(i=>i.publisher===ke.publisher&&i.package_===ke.package_&&i.name===ke.name)){let i=v(t,H),c=X(t,xe);if(c instanceof U&&c.object instanceof R){let l=c.object,d=this.readLabelForUri({publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name});return{href:this.urlForReference(l,xe,n),label:i??d??l.subject.name}}}let s=ee.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},"*",{contextPublisher:n}),o=t?v(t,H)??e.subject.name:e.subject.name;return{href:s,label:o}}findNavGroupForPublisher(e){for(let t of this.catalog){if(!(t instanceof J)||!(t.namespace||"").startsWith(`${e}/`))continue;if(D(t).map(r=>r.subject).some(r=>r.publisher===oe.publisher&&r.package_===oe.package_&&r.name===oe.name))return t}}renderMarkdown(e,t){let n=K(e,A);if(!n)return"<!-- LookRenderer.Markdown: no look.source -->";let s=this.readPropertyValueText(t,n);return s?`<section class="kan-markdown">
|
|
111
|
+
${Le(s)}
|
|
112
|
+
</section>`:""}renderRawMarkdown(e){let t=this.findCascadedLook(e);if(!t)return;let n=Ne(t.declaration),s=[];for(let o of n){let r=Ve(o);if(!r||!E(r,Ue))continue;let a=K(o,A);if(!a)continue;let i=this.readPropertyValueText(e,a);i&&s.push(i)}return s.length>0?s.join(`
|
|
113
|
+
|
|
114
|
+
`):void 0}renderHero(e,t,n){let s=['<header class="kan-hero">'],o=K(e,bn);if(o){let l=this.readPropertyValueText(t,o);l&&s.push(`<span class="kan-hero-eyebrow">${f(l)}</span>`)}let r=K(e,mn),a="";r&&(a=this.readPropertyValueText(t,r)??""),a||(a=t.name),s.push(`<h1 class="kan-hero-title">${f(a)}</h1>`);let i=K(e,jn);if(i){let l=this.readPropertyValueText(t,i);l&&s.push(`<p class="kan-hero-subtitle">${f(l)}</p>`)}let c=K(e,Ce);if(c){let l=this.readPropertyValueReferences(t,c);if(l.length>0){let d=l.map(g=>this.renderBadge(g,Ce,n)).join("");s.push(`<div class="kan-hero-badges">${d}</div>`)}}return s.push("</header>"),s.join(`
|
|
115
|
+
`)}renderPropertyList(e,t,n){let s=K(e,A);if(!s)return"<!-- LookRenderer: PropertyList missing look.source -->";let o=this.readLabelForUri(s)??s.name,r=X(t,s),a=this.gatherValueItems(r),i=a.length>0?a.map(c=>`<li>${this.renderInlineValue(c,A,n)}</li>`).join(""):'<li class="kan-empty">(no values)</li>';return['<section class="kan-property-list">',`<h3 class="kan-property-list-title">${f(o)}</h3>`,`<ul class="kan-property-list-items">${i}</ul>`,"</section>"].join(`
|
|
116
|
+
`)}renderBadgeRow(e,t,n){let s=K(e,A);if(!s)return"<!-- LookRenderer: BadgeRow missing look.source -->";let o=this.readPropertyValueReferences(t,s);return o.length===0?"":`<div class="kan-badge-row">${o.map(a=>this.renderBadge(a,A,n)).join("")}</div>`}renderChipRow(e,t,n){let s=Ae(e,$n);if(s.length===0)return"<!-- LookRenderer: ChipRow has no look.chips -->";let o=[];for(let r of s){let a=X(t,r);if(!a)continue;let i=this.readLabelForUri(r)??r.name,c=this.renderStatementInlineValue(a,r,n);c&&o.push(`<span class="kan-chip"><span class="kan-chip-key">${f(i)}</span> <span class="kan-chip-val">${c}</span></span>`)}return o.length===0?"":`<div class="kan-chip-row">${o.join("")}</div>`}renderReferenceList(e,t,n){let s=Ae(e,me);if(s.length===0)return"<!-- LookRenderer: ReferenceList has no look.entries -->";let o=[];for(let r of s){let a=this.readPropertyValueReferences(t,r);if(a.length===0)continue;let i=this.readLabelForUri(r)??r.name,c=a.map(l=>this.renderReferenceLink(l,me,n)).join(", ");o.push(`<dt>${f(i)}</dt><dd>${c}</dd>`)}return o.length===0?"":`<dl class="kan-reference-list">${o.join("")}</dl>`}readPropertyValueText(e,t){let n=X(e,t);if(n){if(n instanceof B)return n.object;if(n instanceof U){let s=n.object;return this.readLabelForUri({publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name})??s.subject.name}if(n instanceof F)return(n.object??[]).map(o=>o instanceof R?this.readLabelForUri({publisher:o.subject.publisher,package_:o.subject.package_,name:o.subject.name})??o.subject.name:o instanceof te?o.name??"":String(o)).filter(o=>o).join(", ")}}readPropertyValueReferences(e,t){let n=X(e,t);if(!n)return[];if(n instanceof U)return[n.object];if(n instanceof F){let s=[];for(let o of n.object??[])o instanceof R&&s.push(o);return s}return[]}gatherValueItems(e){return e?e instanceof F?e.object??[]:e instanceof U?[e.object]:e instanceof Z?[e.object]:e instanceof B?[e.object]:[]:[]}renderInlineValue(e,t,n){return e instanceof R?this.renderReferenceLink(e,t,n):e instanceof te?f(e.name??"(embedded)"):typeof e=="string"?f(e):typeof e=="number"||typeof e=="boolean"?f(String(e)):""}renderStatementInlineValue(e,t,n){return e instanceof B?f(e.object):e instanceof U?this.renderReferenceLink(e.object,t,n):e instanceof F?(e.object??[]).map(o=>this.renderInlineValue(o,t,n)).filter(o=>o).join(", "):""}renderReferenceLink(e,t,n){let s=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name,o=this.urlForReference(e,t,n);return`<a class="kan-link" href="${f(o)}">${f(s)}</a>`}renderBadge(e,t,n){let s=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name,o=this.readCommentForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name}),r=this.urlForReference(e,t,n),a=o?` title="${f(o)}"`:"";return`<a class="kan-badge" href="${f(r)}"${a}>${f(s)}</a>`}urlForReference(e,t,n){let s=t?this.getUrlFormForProperty(t):"=";return ee.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},s,{contextPublisher:n})}getUrlFormForProperty(e){let t=x(this.catalog,e);if(!t)return"=";let n=v(t,_n);return n==="*"||n==="^"||n==="~"||n==="="?n:"="}readLabelForUri(e){let t=x(this.catalog,e);if(t)return v(t,H)}readCommentForUri(e){let t=x(this.catalog,e);if(t)return v(t,Ie)}};function be(u){let e=new Map;for(let t of u.statement){if(!(t instanceof Z)||!V(t,he.publisher,he.package_,he.name))continue;let n=t.object;for(let s of n.statement){if(!(s instanceof B))continue;let o=s.predicate?.subject?.name;if(!o)continue;let r=s.object;e.has(o)||e.set(o,r)}}return e}function je(u){for(let e of u.statement)if(e instanceof Z&&V(e,pe.publisher,pe.package_,pe.name))return e.object}function Ne(u){for(let e of u.statement){if(!(e instanceof F)||!V(e,ge.publisher,ge.package_,ge.name))continue;let t=[];for(let n of e.object??[])n instanceof te&&t.push(n);return t}return[]}function Ve(u){for(let e of u.statement)if(e instanceof U&&e.predicate?.subject?.name==="type"&&e.object instanceof R){let t=e.object.subject;return{publisher:t.publisher,package_:t.package_,name:t.name}}}function K(u,e){for(let t of u.statement)if(t instanceof U&&V(t,e.publisher,e.package_,e.name)&&t.object instanceof R){let n=t.object.subject;return{publisher:n.publisher,package_:n.package_,name:n.name}}}function Ae(u,e){for(let t of u.statement){if(!(t instanceof F)||!V(t,e.publisher,e.package_,e.name))continue;let n=[];for(let s of t.object??[])s instanceof R&&n.push({publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name});return n}return[]}function X(u,e){for(let t of u.statement)if(V(t,e.publisher,e.package_,e.name))return t}function v(u,e){for(let t of u.statement)if(t instanceof B&&V(t,e.publisher,e.package_,e.name))return t.object}function Me(u,e){for(let t of u.statement)if(t instanceof fe&&V(t,e.publisher,e.package_,e.name))return t.object}function D(u){let e=[];for(let t of u.statement)if(t instanceof U){if(t.predicate?.subject?.name!=="type")continue;t.object instanceof R&&e.push(t.object)}else if(t instanceof F){if(t.predicate?.subject?.name!=="type")continue;for(let n of t.object??[])n instanceof R&&e.push(n)}return e}function ie(u){let e=[];for(let t of u.statement)if(t instanceof U){if(t.predicate?.subject?.name!=="subClassOf")continue;t.object instanceof R&&e.push(t.object)}else if(t instanceof F){if(t.predicate?.subject?.name!=="subClassOf")continue;for(let n of t.object??[])n instanceof R&&e.push(n)}return e}function ce(u,e){let t=[];for(let n of u){if(!(n instanceof J)||n.name!==e.name)continue;(n.namespace||"").startsWith(`${e.publisher}/${e.package_}@`)&&t.push(n)}return t}function x(u,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 s of u)if(s instanceof J&&s.name===e.name&&s.namespace===n)return s}for(let n of u){if(!(n instanceof J)||n.name!==e.name)continue;if((n.namespace||"").startsWith(`${e.publisher}/${e.package_}@`))return n}}function V(u,e,t,n){let s=u.predicate?.subject;return s?s.publisher===e&&s.package_===t&&s.name===n:!1}function E(u,e){return u.publisher===e.publisher&&u.package_===e.package_&&u.name===e.name}function z(u){return`${u.publisher}/${u.package_}/${u.name}`}function G(u){let e=u.namespace||"",t=e.indexOf("/");return t>=0?e.substring(0,t):e}function f(u){return u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Be(u){let e=u.lastIndexOf(".");return e>=0?u.substring(e+1):u}function He(u,e){for(let t of u.statement)if(t.predicate?.subject?.name===e)return t}function se(u){return u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function vn(u){if(!u)return"";let e=/^(\d{4})-(\d{2})-(\d{2})/.exec(u);return e?`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][parseInt(e[2],10)-1]??e[2]} ${parseInt(e[3],10)}`:u}export{Le as a,$e as b};
|
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-2BQ6SOU6.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-2BQ6SOU6.js";import{b as Yt}from"./chunk-DNV7ES5F.js";import{a as qe,b as Ye,c as Xe,d as b,e as S,f as i}from"./chunk-REH5YNFQ.js";import{a as qt}from"./chunk-2VCFHCFN.js";import{a as Te,b as je,c as Le,d as Fe,e as Ne}from"./chunk-5AH6GIPO.js";import{a as Be,b as De,c as Oe,d as Ae}from"./chunk-VQFL5C7Q.js";import{a as lt,b as dt,c as ut,d as pt}from"./chunk-IIP6J4EP.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-A2JTW3ON.js";import"./chunk-FJ35VIV6.js";import{a as F,b as D,c as Me,e as We}from"./chunk-4YHWMYAZ.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-7CUTGGH3.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)}
|
|
@@ -190,13 +190,46 @@ export declare class LookRenderer {
|
|
|
190
190
|
* chronological sequence of clickable nodes. Each node links to the
|
|
191
191
|
* instance's exact-version URL and shows its order value + key.
|
|
192
192
|
*/
|
|
193
|
+
/**
|
|
194
|
+
* Follow a `track` property's referenced sub-resources across a sorted
|
|
195
|
+
* sequence of source instances, aligning them by stable resource key.
|
|
196
|
+
* Returns one TrackedSeries per distinct key, with `points[i]` set to
|
|
197
|
+
* the `metricPath` value resolved on that key's sub-resource in the
|
|
198
|
+
* i-th instance (null when absent / unresolvable). The optional `hueBy`
|
|
199
|
+
* path supplies each series' hue. Shared by the Timeline trajectory
|
|
200
|
+
* chart and the VersionDiff trend rows.
|
|
201
|
+
*/
|
|
202
|
+
private collectTrackedSeries;
|
|
203
|
+
/**
|
|
204
|
+
* Build a resource URL from a parsed SubjectKanonak (namespace
|
|
205
|
+
* `publisher/package@version`), applying the given URL form.
|
|
206
|
+
*/
|
|
207
|
+
private hrefForSubject;
|
|
208
|
+
/**
|
|
209
|
+
* Render a VersionDiff band — the "Changes" trend rows. Same inputs as
|
|
210
|
+
* the Timeline trajectory mode (`source` + `orderBy` + `track` +
|
|
211
|
+
* `metricPath`, optional `hueBy`), but one compact row per tracked key:
|
|
212
|
+
* the (linked) label, the first value, a small autoscaled sparkline of
|
|
213
|
+
* the metric across the version sequence, the latest value, and a
|
|
214
|
+
* total-change delta badge (latest − first).
|
|
215
|
+
*/
|
|
216
|
+
private renderVersionDiff;
|
|
217
|
+
/**
|
|
218
|
+
* A small inline-SVG sparkline for one series, autoscaled to the
|
|
219
|
+
* series' own [min,max] so small moves are visible. Flat series render
|
|
220
|
+
* a centered baseline. Nulls break the line.
|
|
221
|
+
*/
|
|
222
|
+
private sparkline;
|
|
193
223
|
private renderTimeline;
|
|
194
224
|
/**
|
|
195
225
|
* Render the Timeline trajectory chart — a server-rendered inline SVG with
|
|
196
226
|
* one line per tracked sub-resource (aligned by stable key) across the
|
|
197
227
|
* version sequence, plus an HTML legend reporting each series' latest
|
|
198
|
-
* value and its
|
|
199
|
-
*
|
|
228
|
+
* value and its change from the first version. Ontology-neutral: the Y
|
|
229
|
+
* axis autoscales to the data unless the band declares `axisMin`/
|
|
230
|
+
* `axisMax`; the legend value carries an optional `valueLabel` prefix;
|
|
231
|
+
* and when the band declares `lowerPath`/`upperPath`, a shaded envelope
|
|
232
|
+
* is drawn between those two metric paths per series. Each series is
|
|
200
233
|
* themed by `hueBy` when present, else by an evenly spaced palette.
|
|
201
234
|
*/
|
|
202
235
|
private renderTrajectoryChart;
|
|
@@ -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-DNV7ES5F.js";import{a as Oe}from"../chunk-2VCFHCFN.js";import"../chunk-IIP6J4EP.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-4YHWMYAZ.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-7CUTGGH3.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.
|
|
3
|
+
"version": "3.31.0",
|
|
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.
|
|
116
|
+
"@kanonak-protocol/types": "^3.31.0",
|
|
117
117
|
"ignore": "^7.0.5",
|
|
118
118
|
"js-yaml": "^4.1.0",
|
|
119
119
|
"yaml": "^2.7.0"
|
package/dist/chunk-M5P56WR3.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import{a as D}from"./chunk-NIGFQYVA.js";import{a as Q}from"./chunk-4YHWMYAZ.js";import{c as G,d as j,g as P,h as me,i as be,j as K,k as Y,l as x}from"./chunk-W6T7MOKY.js";function _e(u){let e=u.replace(/\r\n/g,`
|
|
2
|
-
`).split(`
|
|
3
|
-
`),t=[],n=0;for(;n<e.length;){let s=e[n];if(s.trim()===""){n++;continue}let a=/^(\s*)```(\S*)\s*$/.exec(s);if(a){let i=a[2],c=[];for(n++;n<e.length&&!/^(\s*)```\s*$/.test(e[n]);)c.push(e[n]),n++;n++;let l=$e(c.join(`
|
|
4
|
-
`)),d=i?` class="language-${ve(i)}"`:"";t.push(`<pre><code${d}>${l}</code></pre>`);continue}let r=/^(#{1,6})\s+(.*)$/.exec(s);if(r){let i=r[1].length,c=J(r[2].trim());t.push(`<h${i}>${c}</h${i}>`),n++;continue}if(s.includes("|")&&n+1<e.length&&je(e[n+1])){let i=re(s),c=Ce(e[n+1]);n+=2;let l=[];for(;n<e.length&&e[n].trim()!==""&&e[n].includes("|");)l.push(re(e[n])),n++;t.push(Te(i,c,l));continue}if(/^\s*[-*]\s+/.test(s)){let i=[];for(;n<e.length&&/^\s*[-*]\s+/.test(e[n]);){let c=[e[n].replace(/^\s*[-*]\s+/,"")];for(n++;n<e.length&&e[n].trim()!==""&&!/^\s*[-*]\s+/.test(e[n])&&!/^\s*\d+\.\s+/.test(e[n]);)c.push(e[n]),n++;n<e.length&&e[n].trim()===""&&n++,i.push(`<li>${J(c.join(" ").trim())}</li>`)}t.push(`<ul>
|
|
5
|
-
${i.join(`
|
|
6
|
-
`)}
|
|
7
|
-
</ul>`);continue}if(/^\s*\d+\.\s+/.test(s)){let i=[];for(;n<e.length&&/^\s*\d+\.\s+/.test(e[n]);){let c=[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]);)c.push(e[n]),n++;n<e.length&&e[n].trim()===""&&n++,i.push(`<li>${J(c.join(" ").trim())}</li>`)}t.push(`<ol>
|
|
8
|
-
${i.join(`
|
|
9
|
-
`)}
|
|
10
|
-
</ol>`);continue}let o=[s];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&&je(e[n+1]));)o.push(e[n]),n++;t.push(`<p>${J(o.join(" "))}</p>`)}return t.join(`
|
|
11
|
-
`)}function je(u){return u.includes("-")?/^[\s|:-]+$/.test(u):!1}function re(u){let e=u.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&(e=e.slice(0,-1)),e.split("|").map(t=>t.trim())}function Ce(u){return re(u).map(e=>{let t=e.startsWith(":"),n=e.endsWith(":");return t&&n?"center":n?"right":t?"left":null})}function Te(u,e,t){let n=r=>{let o=e[r];return o?` style="text-align:${o}"`:""},s=u.map((r,o)=>`<th${n(o)}>${J(r)}</th>`).join(""),a=t.map(r=>`<tr>${r.map((i,c)=>`<td${n(c)}>${J(i)}</td>`).join("")}</tr>`).join(`
|
|
12
|
-
`);return`<table>
|
|
13
|
-
<thead><tr>${s}</tr></thead>
|
|
14
|
-
<tbody>
|
|
15
|
-
${a}
|
|
16
|
-
</tbody>
|
|
17
|
-
</table>`}function J(u){let e=$e(u);return e=e.replace(/`([^`\n]+)`/g,(t,n)=>`<code>${n}</code>`),e=e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(t,n,s)=>`<a href="${ve(s)}">${n}</a>`),e=e.replace(/\*\*([^*\n]+)\*\*/g,(t,n)=>`<strong>${n}</strong>`),e=e.replace(/(^|[^*])\*([^*\n]+)\*(?!\*)/g,(t,n,s)=>`${n}<em>${s}</em>`),e=e.replace(/(^|[\s(])_([^_\n]+)_(?=[\s).,;:!?]|$)/g,(t,n,s)=>`${n}<em>${s}</em>`),e}function $e(u){return u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ve(u){return u.replace(/"/g,""").replace(/&/g,"&")}var ae={publisher:"kanonak.org",package_:"derivation",name:"look"},oe={publisher:"kanonak.org",package_:"derivation",name:"tokens"},E={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"},N={publisher:"kanonak.org",package_:"core-rdf",name:"label"},Re={publisher:"kanonak.org",package_:"core-rdf",name:"comment"},Pe={publisher:"kanonak.org",package_:"look",name:"Hero"},Ne={publisher:"kanonak.org",package_:"look",name:"PropertyList"},Ve={publisher:"kanonak.org",package_:"look",name:"BadgeRow"},Ae={publisher:"kanonak.org",package_:"look",name:"ChipRow"},Be={publisher:"kanonak.org",package_:"look",name:"ReferenceList"},ye={publisher:"kanonak.org",package_:"look",name:"Markdown"},ee={publisher:"kanonak.org",package_:"look",name:"NavGroup"},ie={publisher:"kanonak.org",package_:"look",name:"NavLink"},Ke={publisher:"kanonak.org",package_:"look",name:"target"},Me={publisher:"kanonak.org",package_:"look",name:"ResourceGrid"},He={publisher:"kanonak.org",package_:"look",name:"Timeline"},Ge={publisher:"kanonak.org",package_:"look",name:"orderBy"},De={publisher:"kanonak.org",package_:"look",name:"track"},We={publisher:"kanonak.org",package_:"look",name:"metricPath"},qe={publisher:"kanonak.org",package_:"look",name:"hueBy"};var Ye={publisher:"kanonak.org",package_:"look",name:"semanticSvg"},Je={publisher:"kanonak.org",package_:"look",name:"tierChip"},ze={publisher:"kanonak.org",package_:"look",name:"tierIcon"},Qe={publisher:"kanonak.org",package_:"look",name:"tierCard"},Xe={publisher:"kanonak.org",package_:"look",name:"tierFull"};var ce={publisher:"kanonak.org",package_:"look",name:"bands"},Ze={publisher:"kanonak.org",package_:"look",name:"title"},en={publisher:"kanonak.org",package_:"look",name:"eyebrow"},nn={publisher:"kanonak.org",package_:"look",name:"subtitle"},Se={publisher:"kanonak.org",package_:"look",name:"badges"},V={publisher:"kanonak.org",package_:"look",name:"source"},tn={publisher:"kanonak.org",package_:"look",name:"chips"},ue={publisher:"kanonak.org",package_:"look",name:"entries"},sn={publisher:"kanonak.org",package_:"look",name:"urlForm"},de=class{constructor(e){this.catalog=e}catalog;findCascadedLook(e){let t=fe(e);if(t)return{declaration:t,sourceClass:{publisher:C(e),package_:(e.namespace||"").split("/")[1]?.split("@")[0]??"",name:e.name}};let n=new Set,s=A(e);for(;s.length>0;){let a=s.shift(),r=q(a.subject);if(n.has(r))continue;n.add(r);let o=S(this.catalog,a.subject);if(!o)continue;let i=fe(o);if(i)return{declaration:i,sourceClass:{publisher:a.subject.publisher,package_:a.subject.package_,name:a.subject.name}};for(let c of ne(o))s.push(c)}if(!n.has(q(E))){let a=S(this.catalog,E);if(a){let r=fe(a);if(r)return{declaration:r,sourceClass:{...E}}}}}findCascadedTokens(e){let t=new Map;for(let[a,r]of le(e))t.has(a)||t.set(a,r);let n=new Set,s=A(e);for(;s.length>0;){let a=s.shift(),r=q(a.subject);if(n.has(r))continue;n.add(r);let o=te(this.catalog,a.subject);if(o.length!==0)for(let i of o){for(let[c,l]of le(i))t.has(c)||t.set(c,l);for(let c of ne(i))s.push(c)}}if(!n.has(q(E))){let a=te(this.catalog,E);for(let r of a)for(let[o,i]of le(r))t.has(o)||t.set(o,i)}return t}renderSvg(e){let t=_(e,N)??e.name,n=(t.trim().charAt(0)||"?").toUpperCase(),s=`${e.namespace??""}/${e.name}`,a={label:t,firstLetter:n,uri:s},r=this.collectCascadedSvgTiers(e),o=$=>this.applyPlaceholders($,e,a),i=o(r.tierChip??""),c=o(r.tierIcon??""),l=o(r.tierCard??""),d=o(r.tierFull??""),h=[...this.findCascadedTokens(e)].map(([$,I])=>`--kan-${$}: ${I};`).join(" ");return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" width="400" height="400" style="${X(h)}">
|
|
18
|
-
<style>
|
|
19
|
-
.tier-chip,.tier-icon,.tier-card{display:none}
|
|
20
|
-
.tier-full{display:block}
|
|
21
|
-
@media (max-width:400px){.tier-full{display:none}.tier-card{display:block}}
|
|
22
|
-
@media (max-width:160px){.tier-card{display:none}.tier-icon{display:block}}
|
|
23
|
-
@media (max-width:60px){.tier-icon{display:none}.tier-chip{display:block}}
|
|
24
|
-
</style>
|
|
25
|
-
<g class="tier-chip">${i}</g>
|
|
26
|
-
<g class="tier-icon">${c}</g>
|
|
27
|
-
<g class="tier-card">${l}</g>
|
|
28
|
-
<g class="tier-full">${d}</g>
|
|
29
|
-
</svg>`}applyPlaceholders(e,t,n){return e.replace(/\{\{([^}]+)\}\}/g,(s,a)=>{let r=a.trim();if(n[r]!==void 0)return X(n[r]);let o=this.resolvePath(t,r);return o===void 0?`{{${r}}}`:X(o)})}resolvePath(e,t){let n=t.split("/").map(o=>o.trim()).filter(o=>o.length>0);if(n.length===0)return;let s=e;for(let o=0;o<n.length-1;o++){if(!s)return;let i=Ue(n[o]),c=we(s,i);if(!c)return;if(c instanceof K&&c.object instanceof j){let l=S(this.catalog,c.object.subject);if(!l)return;s=l}else if(c instanceof Y)s=c.object;else return}if(!s)return;let a=Ue(n[n.length-1]),r=we(s,a);if(r){if(r instanceof P||r instanceof me||r instanceof be)return String(r.object);if(r instanceof K&&r.object instanceof j){let o=r.object,i=S(this.catalog,o.subject);return i?_(i,N)??o.subject.name:o.subject.name}}}collectCascadedSvgTiers(e){let t={},n=r=>{let o=W(r,Ye);if(!(o instanceof Y))return;let i=o.object,c=_(i,Je),l=_(i,ze),d=_(i,Qe),g=_(i,Xe);t.tierChip===void 0&&c!==void 0&&(t.tierChip=c),t.tierIcon===void 0&&l!==void 0&&(t.tierIcon=l),t.tierCard===void 0&&d!==void 0&&(t.tierCard=d),t.tierFull===void 0&&g!==void 0&&(t.tierFull=g)};n(e);let s=new Set,a=A(e);for(;a.length>0;){let r=a.shift(),o=q(r.subject);if(s.has(o))continue;s.add(o);let i=te(this.catalog,r.subject);for(let c of i){n(c);for(let l of ne(c))a.push(l)}}if(!s.has(q(E)))for(let r of te(this.catalog,E))n(r);return t}renderStylesheet(e){let t=this.findCascadedTokens(e),n=[];for(let[r,o]of t)n.push(` --kan-${r}: ${o};`);let s=n.length>0?`:root {
|
|
30
|
-
${n.join(`
|
|
31
|
-
`)}
|
|
32
|
-
}`:":root { /* no tokens resolved */ }",a=this.findBaseStylesheet(C(e))??"";return`${s}
|
|
33
|
-
${a}`}findBaseStylesheet(e){let t="kanonak.org/site/content",n,s;for(let r of this.catalog){if(!(r instanceof G)||r.name!=="base-stylesheet")continue;let o=r.namespace||"";o.startsWith(`${e}/look-styles@`)?n=r:o.startsWith("kanonak.org/look-styles@")&&(s=r)}let a=n??s;if(a)for(let r of a.statement){let o=r.predicate?.subject;if(!o)continue;if(`${o.publisher}/${o.package_}/${o.name}`===t&&r instanceof P)return r.object}}renderHtml(e){let t=this.findCascadedLook(e);if(!t)return`<!-- LookRenderer: no derivation.look found for ${e.namespace}/${e.name} -->`;let n=Le(t.declaration);if(n.length===0)return"<!-- LookRenderer: look declaration has no bands -->";let s=C(e),a=[];for(let r of n)a.push(this.renderBand(r,e,s));return a.join(`
|
|
34
|
-
`)}renderPublisherIndex(e,t,n){let s=n?this.renderNavGroup(n,e):"",a=t.map(o=>{let i=o.comment?`<p class="kan-resource-card-subtitle">${f(o.comment)}</p>`:"";return`<a class="kan-resource-card" href="${f(o.href)}"><h3 class="kan-resource-card-title">${f(o.label)}</h3>${i}</a>`}).join(`
|
|
35
|
-
`),r=`<header class="kan-hero">
|
|
36
|
-
<h1 class="kan-hero-title">${f(e)}</h1>
|
|
37
|
-
</header>
|
|
38
|
-
<section class="kan-resource-grid">
|
|
39
|
-
${a}
|
|
40
|
-
</section>`;return`<!doctype html>
|
|
41
|
-
<html lang="en">
|
|
42
|
-
<head>
|
|
43
|
-
<meta charset="utf-8">
|
|
44
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
45
|
-
<title>${f(e)}</title>
|
|
46
|
-
<link rel="stylesheet" href="index.css">
|
|
47
|
-
</head>
|
|
48
|
-
<body>
|
|
49
|
-
${s}
|
|
50
|
-
<main class="kan-main">
|
|
51
|
-
${r}
|
|
52
|
-
</main>
|
|
53
|
-
</body>
|
|
54
|
-
</html>
|
|
55
|
-
`}renderPublisherIndexStylesheet(e){return e?this.renderStylesheet(e):""}hasDeclaredView(e){let t=this.findCascadedLook(e);return t?!(t.sourceClass.publisher===E.publisher&&t.sourceClass.package_===E.package_&&t.sourceClass.name===E.name):!1}renderPackageVersionList(e,t,n){let s=C(n),a=this.renderNavGroup(n,s),r=this.renderBreadcrumb(n,s,{bareOverview:!0}),o=t.map(c=>`<a class="kan-resource-card" href="/${f(e)}/${f(c)}/"><h3 class="kan-resource-card-title">${f(c)}</h3></a>`).join(`
|
|
56
|
-
`),i=`<header class="kan-hero">
|
|
57
|
-
<span class="kan-hero-eyebrow">PACKAGE</span>
|
|
58
|
-
<h1 class="kan-hero-title">${f(e)}</h1>
|
|
59
|
-
</header>
|
|
60
|
-
<section class="kan-resource-grid">
|
|
61
|
-
${o}
|
|
62
|
-
</section>`;return`<!doctype html>
|
|
63
|
-
<html lang="en">
|
|
64
|
-
<head>
|
|
65
|
-
<meta charset="utf-8">
|
|
66
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
67
|
-
<title>${f(e)}</title>
|
|
68
|
-
<link rel="stylesheet" href="${f(n.name)}.css">
|
|
69
|
-
</head>
|
|
70
|
-
<body>
|
|
71
|
-
${a}
|
|
72
|
-
${r}
|
|
73
|
-
<main class="kan-main">
|
|
74
|
-
${i}
|
|
75
|
-
</main>
|
|
76
|
-
</body>
|
|
77
|
-
</html>
|
|
78
|
-
`}renderDocument(e,t){let n=this.renderHtml(e),s=this.readPropertyValueText(e,N)??e.name,a=`${e.name}.css`,r=this.hasSvgDerivation(e)?`<figure class="kan-figure"><img src="${f(e.name)}.svg" alt=""></figure>
|
|
79
|
-
`:"",o=C(e),i=this.renderNavGroup(e,o),c=this.renderBreadcrumb(e,o,t);return`<!doctype html>
|
|
80
|
-
<html lang="en">
|
|
81
|
-
<head>
|
|
82
|
-
<meta charset="utf-8">
|
|
83
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
84
|
-
<title>${f(s)}</title>
|
|
85
|
-
<link rel="stylesheet" href="${f(a)}">
|
|
86
|
-
</head>
|
|
87
|
-
<body>
|
|
88
|
-
${i}
|
|
89
|
-
${c}
|
|
90
|
-
<main class="kan-main">
|
|
91
|
-
${r}${n}
|
|
92
|
-
</main>
|
|
93
|
-
</body>
|
|
94
|
-
</html>
|
|
95
|
-
`}hasSvgDerivation(e){let t=new Set,n=A(e);for(;n.length>0;){let s=n.shift(),a=q(s.subject);if(t.has(a))continue;t.add(a);let r=S(this.catalog,s.subject);if(r){for(let o of r.statement)if(o instanceof x&&T(o,"kanonak.org","derivation","derivations")){for(let i of o.object??[])if(i instanceof Q)for(let c of i.statement){if(!(c instanceof K)||!T(c,"kanonak.org","derivation","format")||!(c.object instanceof j))continue;let l=c.object.subject;if(l.publisher==="kanonak.org"&&l.package_==="formats"&&l.name==="svg")return!0}}for(let o of ne(r))n.push(o)}}return!1}renderBand(e,t,n){let s=Oe(e);return s?F(s,Pe)?this.renderHero(e,t,n):F(s,Ne)?this.renderPropertyList(e,t,n):F(s,Ve)?this.renderBadgeRow(e,t,n):F(s,Ae)?this.renderChipRow(e,t,n):F(s,Be)?this.renderReferenceList(e,t,n):F(s,ye)?this.renderMarkdown(e,t):F(s,ee)?this.renderNavGroup(t,n):F(s,Me)?this.renderResourceGrid(e,n,t):F(s,He)?this.renderTimeline(e,n):`<!-- LookRenderer: unsupported band ${s.publisher}/${s.package_}/${s.name} -->`:"<!-- LookRenderer: band has no rdf:type -->"}renderTimeline(e,t){let n=O(e,V);if(!n)return"<!-- LookRenderer.Timeline: no look.source -->";let s=O(e,Ge),a=this.findInstancesOfClass(n);if(a.length===0)return"<!-- LookRenderer.Timeline: no instances -->";let r=d=>s?this.readPropertyValueText(d,s)??"":"",o=a.slice().sort((d,g)=>r(d).localeCompare(r(g))),i=O(e,De),c=_(e,We);return i&&c?this.renderTrajectoryChart(o,i,c,e,t,r):`<section class="kan-timeline"><ol>
|
|
96
|
-
${o.map(d=>{let g=d.namespace||"",h=g.split("/")[1]?.split("@")[0]??"",$=g.split("@")[1]??"",I=$?this.parseVersion($):void 0,L=D.formatResourceUrl({publisher:C(d),package_:h,name:d.name,...I?{version:I}:{}},"=",{contextPublisher:t}),B=r(d),Z=B?`<span class="kan-timeline-date">${f(B)}</span>`:"",z=$||d.name;return`<li class="kan-timeline-node"><a href="${f(L)}"><span class="kan-timeline-key">${f(z)}</span>${Z}</a></li>`}).join(`
|
|
97
|
-
`)}
|
|
98
|
-
</ol></section>`}renderTrajectoryChart(e,t,n,s,a,r){let o=_(s,qe),i=new Map,c=e.length;e.forEach((p,R)=>{let M=this.readPropertyValueReferences(p,t);for(let k of M){let m=S(this.catalog,{publisher:k.subject.publisher,package_:k.subject.package_,name:k.subject.name,...k.subject.version?{version:k.subject.version}:{}});if(!m)continue;let y=k.subject.name,v=i.get(y);v||(v={key:y,label:_(m,N)??y,points:new Array(c).fill(null)},i.set(y,v));let U=this.resolvePath(m,n),w=U===void 0?NaN:parseFloat(U);if(Number.isFinite(w)&&(v.points[R]=w),o){let b=this.resolvePath(m,o),H=b===void 0?NaN:parseFloat(b);Number.isFinite(H)&&(v.hue=H)}v.lastSubject=m}});let l=[...i.values()];if(l.length===0)return"<!-- LookRenderer.Timeline: no tracked series -->";let d=1e3,g=440,h={top:28,right:24,bottom:56,left:52},$=d-h.left-h.right,I=g-h.top-h.bottom,L=p=>c<=1?h.left+$/2:h.left+p/(c-1)*$,B=p=>h.top+(1-p)*I,Z=(p,R)=>p.hue!==void 0?p.hue:Math.round(R*360/l.length),z=[];for(let p of[0,.25,.5,.75,1]){let R=B(p);z.push(`<line x1="${h.left}" y1="${R.toFixed(1)}" x2="${(d-h.right).toFixed(1)}" y2="${R.toFixed(1)}" class="kan-fan-grid"/>`),z.push(`<text x="${(h.left-8).toFixed(1)}" y="${(R+4).toFixed(1)}" class="kan-fan-axis" text-anchor="end">${p.toFixed(2)}</text>`)}let pe=[];e.forEach((p,R)=>{let M=p.namespace||"",k=M.split("/")[1]?.split("@")[0]??"",m=M.split("@")[1]??"",y=m?this.parseVersion(m):void 0,v=D.formatResourceUrl({publisher:C(p),package_:k,name:p.name,...y?{version:y}:{}},"=",{contextPublisher:a}),U=L(R),w=rn(r(p));pe.push(`<a href="${f(v)}" class="kan-fan-xtick"><line x1="${U.toFixed(1)}" y1="${h.top}" x2="${U.toFixed(1)}" y2="${(g-h.bottom).toFixed(1)}" class="kan-fan-vline"/><text x="${U.toFixed(1)}" y="${(g-h.bottom+20).toFixed(1)}" class="kan-fan-xlabel" text-anchor="middle">${X(m||p.name)}</text>`+(w?`<text x="${U.toFixed(1)}" y="${(g-h.bottom+36).toFixed(1)}" class="kan-fan-xdate" text-anchor="middle">${X(w)}</text>`:"")+"</a>")});let ge=[];l.forEach((p,R)=>{let k=`hsl(${Z(p,R)},65%,60%)`,m=[],y=[];p.points.forEach((v,U)=>{if(v===null)return;let w=L(U),b=B(v);m.push(`${w.toFixed(1)},${b.toFixed(1)}`),y.push(`<circle cx="${w.toFixed(1)}" cy="${b.toFixed(1)}" r="3.5" fill="${k}"/>`)}),m.length!==0&&ge.push(`<g class="kan-fan-series" data-series="${f(p.key)}"><polyline points="${m.join(" ")}" fill="none" stroke="${k}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/>`+y.join("")+"</g>")});let xe=`<svg class="kan-fan-svg" viewBox="0 0 ${d} ${g}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img">`+z.join("")+pe.join("")+ge.join("")+"</svg>",Ee=l.map((p,R)=>{let M=Z(p,R),k=p.points.filter(b=>b!==null),m=k.length?k[k.length-1]:void 0,y=k.length>=2?k[k.length-2]:void 0,v="";if(m!==void 0&&y!==void 0){let b=m-y;if(Math.abs(b)>=.005){let H=b>0?"up":"down",se=b>0?"\u25B2":"\u25BC";v=` <span class="kan-fan-delta ${H}">${b>0?"+":""}${b.toFixed(2)} ${se}</span>`}else v=' <span class="kan-fan-delta flat">\u2014</span>'}let U=m!==void 0?`\u03BC=${m.toFixed(2)}`:"\u2014",w=f(p.label);if(p.lastSubject){let b=p.lastSubject,H=b.namespace||"",se=H.split("/")[1]?.split("@")[0]??"",he=H.split("@")[1]??"",ke=he?this.parseVersion(he):void 0,Fe=D.formatResourceUrl({publisher:C(b),package_:se,name:b.name,...ke?{version:ke}:{}},"=",{contextPublisher:a});w=`<a href="${f(Fe)}">${f(p.label)}</a>`}return`<div class="kan-fan-legend-item" style="--kan-fan-hue:${M}"><span class="kan-fan-swatch"></span><span class="kan-fan-legend-label">${w}</span><span class="kan-fan-legend-cur">${U}${v}</span></div>`});return`<section class="kan-fan"><div class="kan-fan-chart">${xe}</div><div class="kan-fan-legend">${Ee.join("")}</div></section>`}renderResourceGrid(e,t,n){let s=O(e,V);if(!s)return"<!-- LookRenderer.ResourceGrid: no look.source -->";let a=S(this.catalog,s),r=a?A(a).some(c=>{let l=c.subject.name;return l==="ObjectProperty"||l==="DatatypeProperty"||l==="Property"}):!1,o=[];if(r&&n){let c=this.readPropertyValueReferences(n,s);for(let l of c){let d=S(this.catalog,{publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name,...l.subject.version?{version:l.subject.version}:{}});d&&o.push(d)}}else o=this.findInstancesOfClass(s);if(o.length===0)return`<!-- LookRenderer.ResourceGrid: no resources for ${s.publisher}/${s.package_}/${s.name} -->`;let i=[];for(let c of o){let l=_(c,N)??c.name,d=_(c,Re),g=c.namespace||"",h=g.split("/")[1]?.split("@")[0]??"",$=g.split("@")[1]??"",I=$?this.parseVersion($):void 0,L=D.formatResourceUrl({publisher:C(c),package_:h,name:c.name,...I?{version:I}:{}},"=",{contextPublisher:t}),B=d?`<p class="kan-resource-card-subtitle">${f(d)}</p>`:"";i.push(`<a class="kan-resource-card" href="${f(L)}"><h3 class="kan-resource-card-title">${f(l)}</h3>${B}</a>`)}return`<section class="kan-resource-grid">
|
|
99
|
-
${i.join(`
|
|
100
|
-
`)}
|
|
101
|
-
</section>`}parseVersion(e){let t=e.split(".").map(Number);if(!(t.length!==3||t.some(n=>Number.isNaN(n))))return{major:t[0],minor:t[1],patch:t[2]}}findInstancesOfClass(e){let t=[];for(let n of this.catalog){if(!(n instanceof G))continue;A(n).map(r=>r.subject).some(r=>r.publisher===e.publisher&&r.package_===e.package_&&r.name===e.name)&&t.push(n)}return t}renderBreadcrumb(e,t,n){let a=(e.namespace||"").split("/");if(a.length<2)return"";let r=a[0],o=a[1]??"",i=o.split("@")[0]??"",c=o.split("@")[1]??"";if(!r||!i)return"";if(n?.bareOverview)return`<nav class="kan-breadcrumb"><ol>
|
|
102
|
-
<li><a href="/">${f(r)}</a></li>
|
|
103
|
-
<li aria-current="page">${f(i)}</li>
|
|
104
|
-
</ol></nav>`;let l=e.name,g=!!S(this.catalog,{publisher:r,package_:i,name:i}),h=c?`${i}@${c}`:i,$=c?`/${i}/${c}/${i}`:`/${i}/${i}`,I=e.name===i,L=[];return L.push(`<li><a href="/">${f(r)}</a></li>`),I?L.push(`<li aria-current="page">${f(h)}</li>`):(L.push(g?`<li><a href="${f($)}">${f(h)}</a></li>`:`<li>${f(h)}</li>`),L.push(`<li aria-current="page">${f(l)}</li>`)),`<nav class="kan-breadcrumb"><ol>
|
|
105
|
-
${L.join(`
|
|
106
|
-
`)}
|
|
107
|
-
</ol></nav>`}renderNavGroup(e,t){let n=this.findNavGroupForPublisher(t);if(!n)return"";let s=W(n,ue);if(!(s instanceof x))return"";let a=s.object??[];if(a.length===0)return"";let r=[];for(let o of a){if(!(o instanceof j))continue;let i=S(this.catalog,{publisher:o.subject.publisher,package_:o.subject.package_,name:o.subject.name}),{href:c,label:l}=this.resolveNavEntry(o,i,t),d=`/${e.namespace?.split("/")[1]?.split("@")[0]}/${(e.namespace||"").split("@")[1]}/${e.name}`,g=c===d?' aria-current="page"':"";r.push(`<li><a class="kan-nav-link" href="${f(c)}"${g}>${f(l)}</a></li>`)}return`<nav class="kan-site-nav"><ul>
|
|
108
|
-
${r.join(`
|
|
109
|
-
`)}
|
|
110
|
-
</ul></nav>`}resolveNavEntry(e,t,n){if(t&&A(t).map(i=>i.subject).some(i=>i.publisher===ie.publisher&&i.package_===ie.package_&&i.name===ie.name)){let i=_(t,N),c=W(t,Ke);if(c instanceof K&&c.object instanceof j){let l=c.object,d=this.readLabelForUri({publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name});return{href:this.urlForReference(l,Ke,n),label:i??d??l.subject.name}}}let s=D.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},"*",{contextPublisher:n}),a=t?_(t,N)??e.subject.name:e.subject.name;return{href:s,label:a}}findNavGroupForPublisher(e){for(let t of this.catalog){if(!(t instanceof G)||!(t.namespace||"").startsWith(`${e}/`))continue;if(A(t).map(r=>r.subject).some(r=>r.publisher===ee.publisher&&r.package_===ee.package_&&r.name===ee.name))return t}}renderMarkdown(e,t){let n=O(e,V);if(!n)return"<!-- LookRenderer.Markdown: no look.source -->";let s=this.readPropertyValueText(t,n);return s?`<section class="kan-markdown">
|
|
111
|
-
${_e(s)}
|
|
112
|
-
</section>`:""}renderRawMarkdown(e){let t=this.findCascadedLook(e);if(!t)return;let n=Le(t.declaration),s=[];for(let a of n){let r=Oe(a);if(!r||!F(r,ye))continue;let o=O(a,V);if(!o)continue;let i=this.readPropertyValueText(e,o);i&&s.push(i)}return s.length>0?s.join(`
|
|
113
|
-
|
|
114
|
-
`):void 0}renderHero(e,t,n){let s=['<header class="kan-hero">'],a=O(e,en);if(a){let l=this.readPropertyValueText(t,a);l&&s.push(`<span class="kan-hero-eyebrow">${f(l)}</span>`)}let r=O(e,Ze),o="";r&&(o=this.readPropertyValueText(t,r)??""),o||(o=t.name),s.push(`<h1 class="kan-hero-title">${f(o)}</h1>`);let i=O(e,nn);if(i){let l=this.readPropertyValueText(t,i);l&&s.push(`<p class="kan-hero-subtitle">${f(l)}</p>`)}let c=O(e,Se);if(c){let l=this.readPropertyValueReferences(t,c);if(l.length>0){let d=l.map(g=>this.renderBadge(g,Se,n)).join("");s.push(`<div class="kan-hero-badges">${d}</div>`)}}return s.push("</header>"),s.join(`
|
|
115
|
-
`)}renderPropertyList(e,t,n){let s=O(e,V);if(!s)return"<!-- LookRenderer: PropertyList missing look.source -->";let a=this.readLabelForUri(s)??s.name,r=W(t,s),o=this.gatherValueItems(r),i=o.length>0?o.map(c=>`<li>${this.renderInlineValue(c,V,n)}</li>`).join(""):'<li class="kan-empty">(no values)</li>';return['<section class="kan-property-list">',`<h3 class="kan-property-list-title">${f(a)}</h3>`,`<ul class="kan-property-list-items">${i}</ul>`,"</section>"].join(`
|
|
116
|
-
`)}renderBadgeRow(e,t,n){let s=O(e,V);if(!s)return"<!-- LookRenderer: BadgeRow missing look.source -->";let a=this.readPropertyValueReferences(t,s);return a.length===0?"":`<div class="kan-badge-row">${a.map(o=>this.renderBadge(o,V,n)).join("")}</div>`}renderChipRow(e,t,n){let s=Ie(e,tn);if(s.length===0)return"<!-- LookRenderer: ChipRow has no look.chips -->";let a=[];for(let r of s){let o=W(t,r);if(!o)continue;let i=this.readLabelForUri(r)??r.name,c=this.renderStatementInlineValue(o,r,n);c&&a.push(`<span class="kan-chip"><span class="kan-chip-key">${f(i)}</span> <span class="kan-chip-val">${c}</span></span>`)}return a.length===0?"":`<div class="kan-chip-row">${a.join("")}</div>`}renderReferenceList(e,t,n){let s=Ie(e,ue);if(s.length===0)return"<!-- LookRenderer: ReferenceList has no look.entries -->";let a=[];for(let r of s){let o=this.readPropertyValueReferences(t,r);if(o.length===0)continue;let i=this.readLabelForUri(r)??r.name,c=o.map(l=>this.renderReferenceLink(l,ue,n)).join(", ");a.push(`<dt>${f(i)}</dt><dd>${c}</dd>`)}return a.length===0?"":`<dl class="kan-reference-list">${a.join("")}</dl>`}readPropertyValueText(e,t){let n=W(e,t);if(n){if(n instanceof P)return n.object;if(n instanceof K){let s=n.object;return this.readLabelForUri({publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name})??s.subject.name}if(n instanceof x)return(n.object??[]).map(a=>a instanceof j?this.readLabelForUri({publisher:a.subject.publisher,package_:a.subject.package_,name:a.subject.name})??a.subject.name:a instanceof Q?a.name??"":String(a)).filter(a=>a).join(", ")}}readPropertyValueReferences(e,t){let n=W(e,t);if(!n)return[];if(n instanceof K)return[n.object];if(n instanceof x){let s=[];for(let a of n.object??[])a instanceof j&&s.push(a);return s}return[]}gatherValueItems(e){return e?e instanceof x?e.object??[]:e instanceof K?[e.object]:e instanceof Y?[e.object]:e instanceof P?[e.object]:[]:[]}renderInlineValue(e,t,n){return e instanceof j?this.renderReferenceLink(e,t,n):e instanceof Q?f(e.name??"(embedded)"):typeof e=="string"?f(e):typeof e=="number"||typeof e=="boolean"?f(String(e)):""}renderStatementInlineValue(e,t,n){return e instanceof P?f(e.object):e instanceof K?this.renderReferenceLink(e.object,t,n):e instanceof x?(e.object??[]).map(a=>this.renderInlineValue(a,t,n)).filter(a=>a).join(", "):""}renderReferenceLink(e,t,n){let s=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="${f(a)}">${f(s)}</a>`}renderBadge(e,t,n){let s=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}),r=this.urlForReference(e,t,n),o=a?` title="${f(a)}"`:"";return`<a class="kan-badge" href="${f(r)}"${o}>${f(s)}</a>`}urlForReference(e,t,n){let s=t?this.getUrlFormForProperty(t):"=";return D.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},s,{contextPublisher:n})}getUrlFormForProperty(e){let t=S(this.catalog,e);if(!t)return"=";let n=_(t,sn);return n==="*"||n==="^"||n==="~"||n==="="?n:"="}readLabelForUri(e){let t=S(this.catalog,e);if(t)return _(t,N)}readCommentForUri(e){let t=S(this.catalog,e);if(t)return _(t,Re)}};function le(u){let e=new Map;for(let t of u.statement){if(!(t instanceof Y)||!T(t,oe.publisher,oe.package_,oe.name))continue;let n=t.object;for(let s of n.statement){if(!(s instanceof P))continue;let a=s.predicate?.subject?.name;if(!a)continue;let r=s.object;e.has(a)||e.set(a,r)}}return e}function fe(u){for(let e of u.statement)if(e instanceof Y&&T(e,ae.publisher,ae.package_,ae.name))return e.object}function Le(u){for(let e of u.statement){if(!(e instanceof x)||!T(e,ce.publisher,ce.package_,ce.name))continue;let t=[];for(let n of e.object??[])n instanceof Q&&t.push(n);return t}return[]}function Oe(u){for(let e of u.statement)if(e instanceof K&&e.predicate?.subject?.name==="type"&&e.object instanceof j){let t=e.object.subject;return{publisher:t.publisher,package_:t.package_,name:t.name}}}function O(u,e){for(let t of u.statement)if(t instanceof K&&T(t,e.publisher,e.package_,e.name)&&t.object instanceof j){let n=t.object.subject;return{publisher:n.publisher,package_:n.package_,name:n.name}}}function Ie(u,e){for(let t of u.statement){if(!(t instanceof x)||!T(t,e.publisher,e.package_,e.name))continue;let n=[];for(let s of t.object??[])s instanceof j&&n.push({publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name});return n}return[]}function W(u,e){for(let t of u.statement)if(T(t,e.publisher,e.package_,e.name))return t}function _(u,e){for(let t of u.statement)if(t instanceof P&&T(t,e.publisher,e.package_,e.name))return t.object}function A(u){let e=[];for(let t of u.statement)if(t instanceof K){if(t.predicate?.subject?.name!=="type")continue;t.object instanceof j&&e.push(t.object)}else if(t instanceof x){if(t.predicate?.subject?.name!=="type")continue;for(let n of t.object??[])n instanceof j&&e.push(n)}return e}function ne(u){let e=[];for(let t of u.statement)if(t instanceof K){if(t.predicate?.subject?.name!=="subClassOf")continue;t.object instanceof j&&e.push(t.object)}else if(t instanceof x){if(t.predicate?.subject?.name!=="subClassOf")continue;for(let n of t.object??[])n instanceof j&&e.push(n)}return e}function te(u,e){let t=[];for(let n of u){if(!(n instanceof G)||n.name!==e.name)continue;(n.namespace||"").startsWith(`${e.publisher}/${e.package_}@`)&&t.push(n)}return t}function S(u,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 s of u)if(s instanceof G&&s.name===e.name&&s.namespace===n)return s}for(let n of u){if(!(n instanceof G)||n.name!==e.name)continue;if((n.namespace||"").startsWith(`${e.publisher}/${e.package_}@`))return n}}function T(u,e,t,n){let s=u.predicate?.subject;return s?s.publisher===e&&s.package_===t&&s.name===n:!1}function F(u,e){return u.publisher===e.publisher&&u.package_===e.package_&&u.name===e.name}function q(u){return`${u.publisher}/${u.package_}/${u.name}`}function C(u){let e=u.namespace||"",t=e.indexOf("/");return t>=0?e.substring(0,t):e}function f(u){return u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ue(u){let e=u.lastIndexOf(".");return e>=0?u.substring(e+1):u}function we(u,e){for(let t of u.statement)if(t.predicate?.subject?.name===e)return t}function X(u){return u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function rn(u){if(!u)return"";let e=/^(\d{4})-(\d{2})-(\d{2})/.exec(u);return e?`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][parseInt(e[2],10)-1]??e[2]} ${parseInt(e[3],10)}`:u}export{_e as a,de as b};
|