@stacksjs/docs 0.75.535 → 0.75.538
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/style-guide.js +31 -31
- package/package.json +5 -5
package/dist/style-guide.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{createHash as
|
|
3
|
-
`,L=(t,
|
|
4
|
-
<html lang="en" class="${u(r.bodyClass||"")}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline' 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; font-src 'self' data:; connect-src 'none'; form-action 'none'; base-uri 'none'"><title>${u(`${t.brand.name}: ${
|
|
5
|
-
`}async function
|
|
6
|
-
${e.content}`),l.props=ge(
|
|
7
|
-
`),n),
|
|
8
|
-
${
|
|
2
|
+
import{createHash as Re}from"crypto";import{existsSync as V}from"fs";import{lstat as Pe,mkdir as de,readFile as A,readdir as Ne,realpath as Z,rename as Te,rm as pe,writeFile as ue}from"fs/promises";import{basename as me,dirname as Y,isAbsolute as Fe,join as f,relative as x,resolve as p,sep as ye}from"path";import{pathToFileURL as De}from"url";import{generateCss as ze}from"@stacksjs/stx/dev-server/ts-css";import{renderTemplateString as Me}from"@stacksjs/stx/render";import{analyzeComponent as We}from"@stacksjs/stx/story/collect/analyzer";import{parseStoryContent as Ue}from"@stacksjs/stx/story/collect/parser";var Q=1,S=(t)=>t.split(ye).join("/"),b=(t)=>Re("sha256").update(t).digest("hex"),u=(t)=>t.replace(/[&<>"']/g,(o)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[o]),g=(t)=>u(t).replaceAll("|","|").replace(/\r?\n/g," "),X=(t)=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),J=(t)=>`${JSON.stringify(t,null,2)}
|
|
3
|
+
`,L=(t,o)=>[...t.matchAll(new RegExp(`@${o}\\s+([^\\n\\r]+)`,"g"))].map((n)=>n[1].replace(/\*\/.*$/,"").trim());function Xe(t,o=":root"){let n=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=t.match(new RegExp(`${n}\\s*\\{([^}]+)\\}`))?.[1];if(!r)throw Error(`Style guide: no token block for ${o}`);return[...r.matchAll(/(--[\w-]+)\s*:\s*([^;]+)(?:;|$)/g)].map((c)=>({name:c[1],value:c[2].trim()}))}function ge(t){let o=new Map,n=t.match(/\bdefineProps\s*<\s*(\w+)\s*>/)?.[1];if(n){let r=t.match(new RegExp(`interface\\s+${n}\\s*\\{([\\s\\S]*?)\\n\\}`))?.[1];for(let c of(r||"").matchAll(/(?:\/\*\*([\s\S]*?)\*\/\s*)?([\w$]+)(\?)?\s*:\s*([^;\n]+)[;\n]?/g)){let C=c[2];o.set(C,{name:C,type:c[4].trim(),description:`${c[3]?"Optional. ":"Required. "}${(c[1]||"").replace(/\s*\*\s*/g," ").trim()}`.trim()})}}for(let r of t.matchAll(/@prop\s+\{([^}]+)\}\s+(\S+)\s*([^\n\r]*)/g)){let c=r[2].replace(/^\[|\]$/g,"");o.set(c,{name:c,type:r[1],description:r[3].replace(/\*\/.*$/,"").trim()})}for(let r of t.matchAll(/\$props\.([a-z_$][\w$]*)|\buseReactiveProp(?:<[^>]+>)?\(\s*['"]([^'"]+)['"]/gi)){let c=r[1]||r[2];if(!o.has(c))o.set(c,{name:c,type:"Not declared",description:"Read by the implementation; see source for defaults and accepted values."})}return[...o.values()].sort((r,c)=>r.name.localeCompare(c.name))}async function ee(t){let o=[];for(let n of(await Ne(t,{withFileTypes:!0})).sort((r,c)=>r.name.localeCompare(c.name))){if(n.name.startsWith(".")||n.name==="node_modules")continue;let r=f(t,n.name);if(n.isDirectory())o.push(...await ee(r));else if(n.isFile()&&n.name.endsWith(".stx"))o.push(r)}return o}function w(t,o){let n=x(t,o);return n!==""&&!n.startsWith(`..${ye}`)&&n!==".."&&!Fe(n)}async function R(t,o){if(!w(t,o))throw Error(`Style guide: output must be inside the project: ${o}`);for(let n=o;n!==t;n=Y(n))try{if((await Pe(n)).isSymbolicLink())throw Error(`Style guide: refusing symlink output: ${n}`)}catch(r){if(r.code!=="ENOENT")throw r}}function fe(t){if(!t.startsWith("/")||/[?#<>"'\\]|\/\//.test(t)||t.split("/").includes(".."))throw Error(`Style guide: invalid local route: ${t}`);return t.replace(/\/$/,"")}function he(t,o,n,r){let c=`:root{color-scheme:light dark}*{box-sizing:border-box}body{margin:0;padding:24px;background:${r.background};color:${r.foreground};font-family:${t.brand.font||"system-ui,sans-serif"}}body>main{max-width:1100px;margin:auto}button,input,select,textarea{font:inherit}@media(max-width:480px){body{padding:16px}}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}`;return`<!doctype html>
|
|
4
|
+
<html lang="en" class="${u(r.bodyClass||"")}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline' 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; font-src 'self' data:; connect-src 'none'; form-action 'none'; base-uri 'none'"><title>${u(`${t.brand.name}: ${o}`)}</title><link rel="stylesheet" href="./components.css"><style>${c}</style></head><body class="${u(r.bodyClass||"")}"><main aria-label="${u(o)}">${n}</main></body></html>
|
|
5
|
+
`}async function Be(t=process.cwd(),o="config/style-guide.ts"){let n=p(t,o);if(!V(n))return;let r=await import(De(n).href);if(!r.default||typeof r.default!=="object")throw Error(`Style guide: ${o} must export a configuration object`);return r.default}async function Ie(t,o={}){let n=await Z(o.root||process.cwd()),r=p(n,t.output?.docs||"docs/style-guide/generated"),c=p(n,t.output?.public||"docs/public/style-guide/generated"),C=fe(t.output?.route||"/style-guide/generated"),z=fe(t.output?.publicUrl||"/style-guide/generated");if(await R(n,r),await R(n,c),r===c||w(r,c)||w(c,r))throw Error("Style guide: docs and public output directories must be separate");if(!t.brand?.name||!t.sources?.length)throw Error("Style guide: brand.name and at least one component source are required");let P=t.preview?.appearances?.map((e)=>X(e.name));if(P&&(!P.length||P.some((e)=>!e)||new Set(P).size!==P.length))throw Error("Style guide: appearance names must be nonempty and unique");let N=[],E=[],M=new Map,W=new Map,te=new Set;for(let e of t.sources){if(!/^[a-z0-9][a-z0-9-]*$/.test(e.id)||te.has(e.id))throw Error(`Style guide: source IDs must be unique lowercase slugs: ${e.id}`);te.add(e.id);let s=p(n,e.directory);if(w(s,r)||w(s,c)||s===r||s===c)throw Error("Style guide: outputs cannot be inside component sources");for(let i of await ee(s)){let a=S(x(s,i));if(e.exclude?.some((D)=>new Bun.Glob(D).match(a)))continue;let d={path:i,source:`${e.id}/${a}`,content:await A(i,"utf8")};if(N.push(d),i.endsWith(".story.stx")){M.set(i,d);continue}let l=me(i,".stx"),v=d.content.replace(/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<!--[\s\S]*?-->/g,""),I=We(v,l,d.source);W.set(`${e.id}/${a.slice(0,-4)}`,d.content),E.push({id:`${e.id}/${a.slice(0,-4)}`,name:l,source:w(n,i)?S(x(n,i)):d.source,library:e.label||e.id,description:L(d.content,"description")[0]||"",props:ge(d.content),slots:I.slots.map((D)=>D.name).sort(),events:L(d.content,"event"),dependencies:[...new Set(I.dependencies)].sort(),stories:[]})}}for(let[e,s]of(t.stories||[]).entries()){let i=p(n,s);for(let a of await ee(i)){if(!a.endsWith(".story.stx")||M.has(a))continue;let d={path:a,source:`stories-${e}/${S(x(i,a))}`,content:await A(a,"utf8")};N.push(d),M.set(a,d)}}let k=[];for(let e of[...M.values()].sort((s,i)=>s.source.localeCompare(i.source))){let s=Ue(e.content,e.path);if(!s||s.variants.some((l)=>!l.source))throw Error(`Style guide: ${e.source} needs a Story with explicit, nonempty Variants`);let i=`${X(e.source.replace(/\.story\.stx$/,""))}-${b(e.source).slice(0,8)}`,a=e.content.match(/<Story\b[^>]*\bcomponent=["']([^"']+)["']/)?.[1],d={id:i,title:s.title,group:s.group||"Patterns",component:a,file:e,variants:s.variants.map((l)=>({id:l.id,title:l.title,source:l.source}))};if(new Set(d.variants.map((l)=>l.id)).size!==d.variants.length)throw Error(`Style guide: duplicate variant titles in ${e.source}`);if(a){let l=E.find((v)=>v.id===a);if(!l)throw Error(`Style guide: unknown component ${a} in ${e.source}`);l.stories.push(i),W.set(a,`${W.get(a)}
|
|
6
|
+
${e.content}`),l.props=ge(W.get(a)),l.events=[...new Set([...l.events,...L(e.content,"event")])],l.description||=L(e.content,"description")[0]||""}k.push(d)}E.sort((e,s)=>e.id.localeCompare(s.id));let ne=await Promise.all((t.styles?.files||[]).map(async(e)=>({path:p(n,e),source:S(e),content:await A(p(n,e),"utf8")})));N.push(...ne);let se=t.styles?.utilities===!1?"":await ze(N.map((e)=>e.content).join(`
|
|
7
|
+
`),n),G=`${se}
|
|
8
|
+
${ne.map((e)=>e.content).join(`
|
|
9
9
|
`)}
|
|
10
10
|
${t.styles?.css||""}
|
|
11
|
-
`,m=new Map,
|
|
11
|
+
`,m=new Map,j={};async function H(e){if(!e.startsWith("/")||e.startsWith("//")||/[?#]/.test(e))throw Error(`Style guide: CSS assets must be local public paths: ${e}`);let s=p(n,"public",`.${e}`);if(!w(p(n,"public"),s)||!w(await Z(p(n,"public")),await Z(s)))throw Error(`Style guide: asset outside public: ${e}`);return A(s)}async function re(e){if(e.startsWith("data:")||e.startsWith("#"))return e;let s=await H(e),i=`${b(s).slice(0,12)}-${me(e)}`;return m.set(f(c,"assets",i),s),j[e]=b(s),`./assets/${i}`}let be=[...new Set([...G.matchAll(/url\(\s*['"]?([^)'"\s]+)['"]?\s*\)/g)].map((e)=>e[1]))],$e=new Set([...G.matchAll(/@font-face\s*\{[^}]*\}/gi)].flatMap((e)=>[...e[0].matchAll(/url\(\s*['"]?([^)'"\s]+)['"]?\s*\)/g)].map((s)=>s[1])));for(let e of be)if($e.has(e)&&!e.startsWith("data:")){let s=await H(e);j[e]=b(s);let i=Bun.file(e).type||"application/octet-stream";G=G.replaceAll(e,`data:${i};base64,${s.toString("base64")}`)}else G=G.replaceAll(e,await re(e));m.set(f(c,"components.css"),G);let we=b(await A(import.meta.path)),ve=JSON.parse(await A(p(Y(Bun.resolveSync("@stacksjs/stx/render",import.meta.dir)),"../package.json"),"utf8")).version,ie=()=>b(J({format:Q,implementation:we,renderer:ve,config:t,inputs:N.map((e)=>[e.source,b(e.content)]).sort(),utilityCss:b(se),assets:Object.fromEntries(Object.entries(j).sort())})),T=f(r,"manifest.json"),h;if(V(T)){if(await R(n,T),h=JSON.parse(await A(T,"utf8")),h.format!==Q||!h.files||typeof h.files!=="object")throw Error("Style guide: invalid ownership manifest");for(let e of Object.keys(h.files)){let s=p(n,e);if(!w(r,s)&&!w(c,s)||e!==S(x(n,s))||s===T)throw Error(`Style guide: invalid owned path: ${e}`);await R(n,s)}}let Se={...j},F=Boolean(h);for(let e of h?.assets||[])try{j[e]=b(await H(e))}catch{F=!1}if(F&&=h?.fingerprint===ie(),F&&h){for(let[e,s]of Object.entries(h.files))if(!V(p(n,e))||b(await A(p(n,e)))!==s){if(o.check)throw Error(`Style guide output is stale: ${e}. Run buddy docs:style-guide.`);F=!1;break}}if(F&&h)return{...h.result,checked:Boolean(o.check)};if(o.check)throw Error("Style guide is stale. Run buddy docs:style-guide and commit the generated files.");for(let e of Object.keys(j))delete j[e];Object.assign(j,Se);let _=(e)=>`components/${e.id.split("/").map((s)=>encodeURIComponent(s)).join("/")}`,oe=(e,s)=>`| ${e.join(" | ")} |
|
|
12
12
|
| ${e.map(()=>"---").join(" | ")} |
|
|
13
|
-
${s.map((
|
|
13
|
+
${s.map((i)=>`| ${i.map(g).join(" | ")} |`).join(`
|
|
14
14
|
`)}
|
|
15
15
|
`,U=(e,s)=>`---
|
|
16
16
|
title: ${JSON.stringify(`${t.brand.name}: ${e}`)}
|
|
@@ -22,15 +22,15 @@ description: ${JSON.stringify(`${e}. Production component reference for ${t.bran
|
|
|
22
22
|
# ${g(e)}
|
|
23
23
|
|
|
24
24
|
${s}
|
|
25
|
-
`,
|
|
25
|
+
`,B=(e,s)=>`[${g(s)}](${C}/${e})`,K=[{text:"Component guide",link:`${C}/`},{text:"Foundations",link:`${C}/foundations`}],xe=Object.values(t.tokens||{}).flat().filter((e)=>/^(?:#[\da-f]{3,8}\b|rgba?\(|hsla?\(|oklch\()/i.test(e.value)),ke=Object.entries(t.tokens||{}).filter(([e])=>/typography|fonts/i.test(e)).flatMap(([,e])=>e),je=xe.map((e)=>`<article style="border:1px solid #8885;min-width:0"><div style="height:80px;background:${u(e.value)}"></div><div style="padding:12px;overflow-wrap:anywhere"><strong>${u(e.name)}</strong><p>${u(e.value)}</p></div></article>`).join(""),Ce=`<header style="border-bottom:4px solid ${u(t.brand.accent)};padding-bottom:24px;margin-bottom:24px"><p>Design foundations</p><h1 style="font-size:32px;font-weight:700">${u(t.brand.name)}</h1><p>${u(t.brand.description||"")}</p></header><section aria-label="Color tokens" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:16px">${je}</section><section aria-label="Typography" style="margin-top:32px">${ke.map((e)=>`<article style="padding:20px 0;border-bottom:1px solid #8884"><p>${u(e.name)}: ${u(e.value)}</p><p style="font-family:${u(e.value)};font-size:28px;line-height:1.35">Training with purpose. Aa 0123456789</p></article>`).join("")}</section>`;m.set(f(c,"foundations.html"),he(t,"Foundations",Ce,{background:t.brand.background||"#fff",foreground:t.brand.foreground||"#17202a"}));let Ee=Object.entries(t.tokens||{}).map(([e,s])=>`## ${g(e)}
|
|
26
26
|
|
|
27
|
-
${oe(["Token","Value","Purpose"],s.map((
|
|
27
|
+
${oe(["Token","Value","Purpose"],s.map((i)=>[i.name,i.value,i.description||""]))}`).join(`
|
|
28
28
|
`);m.set(f(r,"foundations.md"),U("Foundations",`${g(t.brand.description||"")}
|
|
29
29
|
|
|
30
30
|
${(t.brand.principles||[]).map((e)=>`- ${g(e)}`).join(`
|
|
31
31
|
`)}
|
|
32
32
|
|
|
33
|
-
${
|
|
33
|
+
${Ee}
|
|
34
34
|
## Accessibility and behavior
|
|
35
35
|
|
|
36
36
|
Use semantic controls, visible keyboard focus, persistent labels and accessible names for icon actions. Test both appearances, reduced motion and touch targets. Destructive actions retain their semantic color when a brand changes. Disabled and busy states must remain distinguishable. The previews show browser rendering; validate native layout and interaction separately.
|
|
@@ -41,28 +41,28 @@ Read tokens and styles from the production theme in config/style-guide.ts. Keep
|
|
|
41
41
|
`)),m.set(f(r,"foundations.md"),`${m.get(f(r,"foundations.md"))}
|
|
42
42
|
## Visual specimens
|
|
43
43
|
|
|
44
|
-
<a href="${
|
|
44
|
+
<a href="${z}/foundations.html">Open branded color and typography specimens</a>
|
|
45
45
|
|
|
46
|
-
<iframe title="${u(t.brand.name)} foundations" src="${
|
|
47
|
-
`);for(let e of k){let s=[],
|
|
46
|
+
<iframe title="${u(t.brand.name)} foundations" src="${z}/foundations.html" loading="lazy" sandbox="allow-scripts allow-forms" style="width:100%;height:600px;border:1px solid #8884;border-radius:8px"></iframe>
|
|
47
|
+
`);for(let e of k){let s=[],i=[...e.file.content.matchAll(/<script\b[^>]*>[\s\S]*?<\/script>/gi)].map((l)=>l[0]).join(`
|
|
48
48
|
`),a=[...e.file.content.matchAll(/<style\b[^>]*>[\s\S]*?<\/style>/gi)].map((l)=>l[0]).join(`
|
|
49
|
-
`);for(let l of e.variants){let
|
|
49
|
+
`);for(let l of e.variants){let v=await Me(`${i}
|
|
50
50
|
${l.source}
|
|
51
|
-
${a}`,e.file.path,{options:{componentsDir:p(n,t.preview?.componentDirs?.[0]||t.sources[0].directory),additionalComponentsDirs:(t.preview?.componentDirs?.slice(1)||t.sources.slice(1).map((
|
|
52
|
-
`);let
|
|
53
|
-
<a href="${
|
|
51
|
+
${a}`,e.file.path,{options:{componentsDir:p(n,t.preview?.componentDirs?.[0]||t.sources[0].directory),additionalComponentsDirs:(t.preview?.componentDirs?.slice(1)||t.sources.slice(1).map((y)=>y.directory)).map((y)=>p(n,y)),storesDir:p(n,"storage/framework/runtime/style-guide/no-stores")},context:{},processClientScripts:!0});for(let y of[...v.matchAll(/\bsrc=["'](\/[^"']+)["']/g)])v=v.replaceAll(y[1],await re(y[1]));let I=v.replace(/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,"");if(/<[A-Z][\w.-]*(?:\s|\/?>)/.test(I))throw Error(`Style guide: unresolved component in ${e.file.source}: ${l.title}`);v=v.replace(/<script([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,(y,O,q)=>{if(/\bsrc\s*=/.test(O))return y;let le=`runtime-${b(q).slice(0,12)}.js`;return m.set(f(c,le),q),`<script${O} src="./${le}"></script>`}),s.push(`## ${g(l.title)}
|
|
52
|
+
`);let D=t.preview?.appearances||[{name:"Default",bodyClass:t.preview?.bodyClass,background:t.brand.background||"#fff",foreground:t.brand.foreground||"#17202a"}];for(let y of D){let O=`${e.id}-${l.id}-${X(y.name)}.html`,q=he(t,`${e.title}, ${l.title}, ${y.name}`,v,y);m.set(f(c,O),q),s.push(`
|
|
53
|
+
<a href="${z}/${O}">Open ${u(l.title)} preview (${u(y.name)})</a>
|
|
54
54
|
|
|
55
|
-
<iframe title="${u(`${e.title}: ${l.title}, ${
|
|
56
|
-
`)}let
|
|
55
|
+
<iframe title="${u(`${e.title}: ${l.title}, ${y.name}`)}" src="${z}/${O}" loading="lazy" sandbox="allow-scripts allow-forms" style="width:100%;height:440px;border:1px solid #8884;border-radius:8px"></iframe>
|
|
56
|
+
`)}let Oe=[i,l.source,a].filter(Boolean).join(`
|
|
57
57
|
|
|
58
58
|
`);s.push(`
|
|
59
59
|
\`\`\`stx
|
|
60
|
-
${
|
|
60
|
+
${Oe}
|
|
61
61
|
\`\`\`
|
|
62
|
-
`)}let d=
|
|
62
|
+
`)}let d=w(n,e.file.path)?S(x(n,e.file.path)):e.file.source;m.set(f(r,"patterns",`${e.id}.md`),U(e.title,`Source: \`${d}\`. Group: ${g(e.group)}. Local demonstration data only.
|
|
63
63
|
|
|
64
64
|
${s.join(`
|
|
65
|
-
`)}`)),
|
|
65
|
+
`)}`)),K.push({text:e.title,link:`${C}/patterns/${e.id}`})}for(let e of E){let s=e.stories.length?e.stories.map((a)=>B(`patterns/${a}`,k.find((d)=>d.id===a).title)).join(", "):"Reference only. Add an isolated .story.stx fixture before enabling a preview; this component is never executed by the inventory scan.",i=`${g(e.description||`${e.name} component in ${e.library}.`)}
|
|
66
66
|
|
|
67
67
|
Source: \`${e.source}\`. Stable ID: \`${e.id}\`.
|
|
68
68
|
|
|
@@ -87,17 +87,17 @@ ${e.events.length?e.events.map((a)=>`- ${g(a)}`).join(`
|
|
|
87
87
|
|
|
88
88
|
${e.dependencies.length?e.dependencies.map((a)=>`- \`${g(a)}\``).join(`
|
|
89
89
|
`):"No child component tags detected."}
|
|
90
|
-
`;m.set(f(r,`${
|
|
91
|
-
`),
|
|
90
|
+
`;m.set(f(r,`${_(e)}.md`),U(e.name,i)),K.push({text:`${e.library}: ${e.name}`,link:`${C}/${_(e)}`})}let Ae=E.map((e)=>`| ${B(_(e),e.name)} | ${g(e.library)} | ${e.stories.length?`${e.stories.length} fixture(s)`:"Reference only"} |`).join(`
|
|
91
|
+
`),Ge=k.map((e)=>`- ${B(`patterns/${e.id}`,e.title)} (${g(e.group)}, ${e.variants.length} variants)`).join(`
|
|
92
92
|
`);m.set(f(r,"index.md"),U(`${t.brand.name} component guide`,`${g(t.brand.description||"")}
|
|
93
93
|
|
|
94
|
-
${
|
|
94
|
+
${E.length} components, ${k.length} isolated stories and ${k.reduce((e,s)=>e+s.variants.length,0)} variants. Generated from production sources, with ${g(t.brand.name)} branding.
|
|
95
95
|
|
|
96
|
-
${
|
|
96
|
+
${B("foundations","Foundations, tokens and branding")}
|
|
97
97
|
|
|
98
98
|
## Patterns and live examples
|
|
99
99
|
|
|
100
|
-
${
|
|
100
|
+
${Ge||"No isolated stories configured yet."}
|
|
101
101
|
|
|
102
102
|
## All components
|
|
103
103
|
|
|
@@ -105,5 +105,5 @@ Every configured component is indexed. Reference-only entries do not claim teste
|
|
|
105
105
|
|
|
106
106
|
| Component | Library | Examples |
|
|
107
107
|
| --- | --- | --- |
|
|
108
|
-
${
|
|
109
|
-
`)),m.set(f(r,"sidebar.json"),J(
|
|
108
|
+
${Ae}
|
|
109
|
+
`)),m.set(f(r,"sidebar.json"),J(K)),m.set(f(c,"catalog.json"),J({brand:t.brand,tokens:t.tokens||{},components:E,stories:k.map((e)=>({id:e.id,title:e.title,group:e.group,source:w(n,e.file.path)?S(x(n,e.file.path)):e.file.source,variants:e.variants}))}));let ae={components:E.length,stories:k.length,variants:k.reduce((e,s)=>e+s.variants.length,0)},ce=Object.fromEntries([...m].map(([e,s])=>[S(x(n,e)),b(s)]).sort(([e],[s])=>e.localeCompare(s)));for(let e of m.keys())if(await R(n,e),V(e)&&!h?.files[S(x(n,e))])throw Error(`Style guide: refusing to overwrite an unowned file: ${S(x(n,e))}`);for(let[e,s]of m){await de(Y(e),{recursive:!0});let i=`${e}.style-guide-tmp`;await R(n,i),await ue(i,s,{flag:"wx"});try{await Te(i,e)}finally{await pe(i,{force:!0})}}for(let e of Object.keys(h?.files||{}))if(!ce[e])await pe(p(n,e),{force:!0});return await de(r,{recursive:!0}),await ue(T,J({format:Q,fingerprint:ie(),files:ce,result:ae,assets:Object.keys(j).sort()})),{...ae,checked:!1}}async function Ye(t={}){let o=p(t.root||process.cwd()),n=await Be(o,t.config);if(!n){if(t.optional)return;throw Error("Style guide: create config/style-guide.ts first. See the Stacks style guide documentation.")}return Ie(n,{root:o,check:t.check})}export{Ie as generateStyleGuide,Be as loadStyleGuideConfig,Ye as runStyleGuide,Xe as styleGuideCssTokens};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/docs",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.538",
|
|
6
6
|
"description": "The Stacks way to document.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@stacksjs/bunpress": "^0.2.25",
|
|
61
|
-
"@stacksjs/config": "0.75.
|
|
62
|
-
"@stacksjs/path": "0.75.
|
|
61
|
+
"@stacksjs/config": "0.75.538",
|
|
62
|
+
"@stacksjs/path": "0.75.538",
|
|
63
63
|
"@stacksjs/stx": "0.2.842"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@stacksjs/alias": "0.75.
|
|
67
|
-
"@stacksjs/server": "0.75.
|
|
66
|
+
"@stacksjs/alias": "0.75.538",
|
|
67
|
+
"@stacksjs/server": "0.75.538",
|
|
68
68
|
"better-dx": "^0.2.24"
|
|
69
69
|
}
|
|
70
70
|
}
|