@vercel/geistdocs 2.7.8 → 2.7.10
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/cli/index.js +1 -1
- package/dist/components/dialog.d.ts +2 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +3 -0
- package/dist/config.d.ts +4 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/internal/chat/message.d.ts.map +1 -1
- package/dist/internal/chat/message.js +2 -5
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.js +209 -11
- package/dist/internal/navbar/desktop-menu.js +2 -2
- package/dist/internal/navbar/mobile-menu.d.ts +1 -1
- package/dist/internal/navbar/mobile-menu.d.ts.map +1 -1
- package/dist/internal/navbar/navbar-brand.d.ts.map +1 -1
- package/dist/internal/navbar/navbar-brand.js +2 -4
- package/dist/internal/navbar/navbar-logo.d.ts +10 -16
- package/dist/internal/navbar/navbar-logo.d.ts.map +1 -1
- package/dist/internal/navbar/navbar-logo.js +9 -78
- package/dist/navbar.d.ts.map +1 -1
- package/dist/navbar.js +3 -4
- package/dist/providers/public/components/dialog.d.ts +27 -0
- package/dist/providers/public/components/dialog.d.ts.map +1 -0
- package/dist/providers/public/components/dialog.js +17 -0
- package/docs/agents.md +2 -1
- package/docs/llms.txt +81 -1
- package/docs/manifest.json +10 -1
- package/docs/pages/components/dialog.md +74 -0
- package/docs/pages/components/index.md +1 -0
- package/docs/sitemap.md +1 -0
- package/package.json +5 -1
- package/public-foundation.css +12 -0
- package/template/components/geistdocs/dialog-demo.tsx +44 -0
- package/template/content/docs/components/dialog.mdx +70 -0
- package/template/content/docs/components/index.mdx +1 -0
- package/template/content/docs/components/meta.json +1 -0
- package/template/package.json +1 -1
- package/dist/providers/public/components/modal.d.ts +0 -22
- package/dist/providers/public/components/modal.d.ts.map +0 -1
- package/dist/providers/public/components/modal.js +0 -19
package/dist/cli/index.js
CHANGED
|
@@ -4,4 +4,4 @@ import{Option as Rn,program as A}from"commander";import{access as Ke,copyFile as
|
|
|
4
4
|
`);throw new AggregateError(i,`Mixedbread search sync did not complete:
|
|
5
5
|
${a}`)}return r},Ft=async({client:e,file:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})=>{let s=t,o=Date.now()+r;for(;s.status==="pending"||s.status==="in_progress";){if(Date.now()>=o)throw new Error(`Mixedbread timed out while indexing file ${t.id}.`);await i(n),s=await e.retrieveStoreFile(t.id)}if(s.status!=="completed")throw new Error(`Mixedbread failed to index file ${t.id} (${s.status}).`);return s},Dt=async({client:e,desired:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})=>{let s=await e.uploadFile({content:t.document.content,filename:`${U(t.document.id).slice(0,32)}.md`}),o;try{o=await e.createStoreFile({externalId:t.externalId,fileId:s,metadata:{...t.metadata,[g.rawFileId]:s}})}catch(a){try{await e.deleteFile(s)}catch(d){throw new AggregateError([a,d],`Mixedbread failed to attach and clean up raw file ${s}.`)}throw a}return Ft({client:e,file:o,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})},Ie=async({client:e,concurrency:t=St,manifest:n,pollIntervalMs:r=_t,pollTimeoutMs:i=Tt,revision:s,revisionAncestors:o=[],revisionTimestamp:a,sleep:d=Rt})=>{let c=_e(n);if(c.provider!=="mixedbread")return{deleted:0,skipped:c.documents.length,uploaded:0};let u=c.siteId?.trim();if(!u)throw new Error("Mixedbread retrieval requires a non-empty siteId in geistdocs.tsx.");if(c.documents.length===0)throw new Error("The Geistdocs search export is empty. Refusing to remove indexed documents.");let l=c.documents.map(p=>At(p,u,s,o,a)),m=new Map(l.map(p=>[p.document.id,p])),h=(await be(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),x=new Map,P=new Set;for(let p of h){W(p.metadata,s,a)&&P.add(p.metadata.documentId);let y=m.get(p.metadata.documentId);y&&p.metadata.contentHash===y.hash&&p.file.status==="completed"&&!x.has(p.metadata.documentId)&&x.set(p.metadata.documentId,p)}let _=l.filter(p=>!(x.has(p.document.id)||P.has(p.document.id)));await Ee(_,t,p=>Dt({client:e,desired:p,pollIntervalMs:r,pollTimeoutMs:i,sleep:d}));let b=(await be(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),D=new Set(b.filter(({metadata:p})=>W(p,s,a)).map(({metadata:p})=>p.documentId)),ie=new Set;for(let p of l){if(D.has(p.document.id))continue;let ae=b.filter(({file:V,metadata:k})=>V.status==="completed"&&k.documentId===p.document.id&&k.contentHash===p.hash).sort((V,k)=>V.file.id.localeCompare(k.file.id))[0];ae&&ie.add(ae.file.id)}let oe=b.filter(({file:p,metadata:y})=>p.status!=="pending"&&p.status!=="in_progress"&&!W(y,s,a)&&Mt({currentRevision:s,currentRevisionAncestors:o,currentRevisionTimestamp:a,desired:m.get(y.documentId),metadata:y})&&!ie.has(p.id));return await Ee(oe,t,async({file:p,metadata:y})=>{await e.deleteFile(y.rawFileId??p.id),await e.deleteStoreFile(p.id)}),{deleted:oe.length,skipped:l.length-_.length,uploaded:_.length}};var Ot=50,$t=e=>`vercel integration add mixedbread --name docs-${e||"your-site-id"} --environment production`,ve=(e,t)=>kt("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),Nt=e=>{let t=process.env.VERCEL_GIT_COMMIT_SHA?.trim(),n=[];try{n=ve(e,["rev-list",`--max-count=${Ot+1}`,t||"HEAD"]).split(`
|
|
6
6
|
`).filter(Boolean)}catch{n=[]}let r=t||n[0],i;for(let s of Array.from(new Set([r,"HEAD"].filter(Boolean))))try{let o=Number(ve(e,["show","-s","--format=%ct",s]));if(Number.isFinite(o)){i=o;break}}catch{}return{revision:r,revisionAncestors:n.filter(s=>s!==r),revisionTimestamp:i}},Pe=async({allowNonProduction:e=!1,dir:t=".next"}={})=>{let n=process.cwd();Ct.loadEnvConfig(n,!1);let r=process.env.MXBAI_API_KEY?.trim(),i=process.env.MXBAI_STORE_ID?.trim();if(process.env.VERCEL_ENV!=="production"&&!e){console.log("Geistdocs search sync skipped: this is not a production Vercel build.");return}if(!!r!=!!i)throw new Error("Mixedbread is partially configured. Set both MXBAI_API_KEY and MXBAI_STORE_ID.");let s;try{s=await Te({cwd:n,outputDirectory:t})}catch(a){if(!(r||i)){console.log("Geistdocs search sync skipped: no Mixedbread credentials or static search export were found.");return}throw a}if(s.provider!=="mixedbread"){console.log("Geistdocs search sync skipped: Ask AI uses local retrieval.");return}if(!(r&&i))throw new Error(["Mixedbread retrieval is enabled, but MXBAI_API_KEY or MXBAI_STORE_ID is missing.","From the root of this site's repository, linked to the correct Vercel project, run:",$t(s.siteId)].join(`
|
|
7
|
-
`));let o=await Ie({client:we({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:i}),manifest:s,...Nt(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as Gt,writeFileSync as Ut}from"fs";import{mkdir as Lt,readFile as Z,writeFile as jt}from"fs/promises";import{dirname as Bt,extname as Vt,relative as Fe,resolve as j}from"path";import{intro as Jt,isCancel as Ht,log as I,multiselect as Xt,outro as L,spinner as Kt}from"@clack/prompts";import{glob as Yt}from"glob";import{Node as F,Project as qt,SyntaxKind as zt}from"ts-morph";var Wt="geistdocs.tsx",Qt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,Ae=()=>({version:1,entries:{}}),Zt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},en=e=>{let t=j(process.cwd(),e);return Gt(t,"utf8")},Me=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],tn=e=>{try{let t=new qt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=en(e),s=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!s)return[];if(F.isObjectLiteralExpression(s))return Me(s);let o=s.getFirstDescendantByKind(zt.ObjectLiteralExpression);return o?Me(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},nn=async()=>{let e=await Xt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ht(e)&&(L("Translation cancelled"),process.exit(0)),e},rn=async e=>(await Yt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),sn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?Ae():{version:1,entries:n.entries}}catch{return Ae()}},Re=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Ut(t,n,"utf8")},on=async e=>{let t=await Promise.all(e.map(async n=>[n,await Zt(n)]));return Object.fromEntries(t)},an=(e,t)=>{let n=Vt(e);return`${e.slice(0,-n.length)}.${t}${n}`},De=(e,t)=>`${Fe(process.cwd(),e)}::${t}`,cn=(e,t,n,r,i=!1)=>{let s=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=an(a,c),l=De(a,c),m=r.entries[l];if(!i&&m?.hash===d){o+=1;continue}s.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:s,skippedCount:o}},dn=async e=>{await Lt(Bt(e),{recursive:!0})},ln=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let s=await r.text();throw new Error(`API request failed (${r.status}): ${s}`)}let i=await r.json();if(!i.translation)throw new Error("API response did not include a translation");return i.translation},pn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),i=await ln(t,r,e.locale);await dn(e.targetFile),await jt(e.targetFile,i,"utf8"),n.entries[De(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},ke=async(e,t)=>{Jt("Translate MDX content");let n=e??Qt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",i=tn(t.config??Wt),s=await rn(n);s.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),L("Translation cancelled"),process.exit(1)),I.info(`Found ${s.length} MDX file(s) matching pattern`),i.length===0&&(i=await nn());let o=j(process.cwd(),ee),a=await sn();await Re(a),I.info(`Using cache: ${o}`);let d=await on(s),{tasks:c,skippedCount:u}=cn(i,s,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),L(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Kt();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await pn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Fe(process.cwd(),x.targetFile)}`)})),await Re(a);m.stop("Translation complete!"),L(`Created/updated ${c.length} file(s)`)};import{access as un,copyFile as gn,mkdir as Ne,rm as re}from"fs/promises";import{dirname as mn,join as v}from"path";import{intro as fn,log as w,outro as B,spinner as Ge}from"@clack/prompts";import{glob as hn}from"glob";var wn=["**/*"],yn=["content/docs/**"],te=".geistdocs-tmp",xn=async(e,t)=>{let n=v(e,t);await re(n,{recursive:!0,force:!0}),await Ne(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),Ce=async(e,t,n)=>(await hn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),bn=async e=>{try{return await un(e),!0}catch{return!1}},En=async(e,t,n)=>{let r=v(t,e),i=v(n,e);return await bn(r)?(await gn(r,i),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Sn=async(e,t)=>{let n=v(t,e);return await re(n,{force:!0}),{success:!0}},Oe=20,$e=async(e,t,n)=>{let r=[];for(let i=0;i<e.length;i+=n){let s=e.slice(i,i+n),o=await Promise.all(s.map(t));r.push(...o)}return r},_n=async(e,t,n,r,i)=>{let s={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>mn(v(r,d))))];i.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>Ne(d,{recursive:!0}))),i.message(`Updating ${e.length} files...`);let a=await $e(e,async d=>{let c=await En(d,n,r);return{file:d,...c}},Oe);for(let{file:d,success:c,error:u}of a)c?s.success.push(d):s.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){i.message(`Deleting ${t.length} files...`);let d=await $e(t,async c=>{try{return await Sn(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Oe);for(let c of d)c.success?s.deleted.push(c.file):s.failed.push({file:c.file,error:c.error})}return s},Tn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},In=e=>e.includes("canary")?"canary":"latest",vn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(S)}`);if(!t.ok)throw new Error(`Failed to resolve ${S}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${S}`);return r},Pn=async e=>{let t=await M(e),n=J(t,S);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=In(n),i=await vn(r);return n===i?{currentVersion:n,nextVersion:i,updateTag:r,updated:!1}:($(t,S,i),await O(e,t),{currentVersion:n,nextVersion:i,updateTag:r,updated:!0})},An=async(e,t,n)=>{let r=await M(e);if(!le(r,S))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:i,nextVersion:s,updateTag:o,updated:a}=await Pn(e);if(!a)return w.success(i?`@vercel/geistdocs is already at ${s} (${o}).`:"No package version update was needed."),B("Package-based site is already up to date."),!0;w.info(`Bumping ${S} from ${i} to ${s} (${o})`);let d=Ge();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),B("Please review and test the upgraded package version."),!0},Mn=async(e,t,n,r,i)=>{let s=v(e,te),o=Ge(),a=i?.sync?s:t;o.start("Preparing template snapshot..."),i?.sync&&(await xn(e,te),await N(s)),o.message("Scanning for files...");let d=await Ce(n,r,a),c=[];if(i?.sync){o.message("Comparing with local files...");let l=await Ce(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),i?.sync&&await ne(s),B("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),i?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await _n(d,c,a,e,o);i?.sync&&(o.message("Cleaning up..."),await ne(s)),o.stop("Update complete!"),Tn(u),B("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),i=e&&e.length>0?e:wn,s=e&&e.length>0?[]:yn;try{if(fn("Let's update your Geistdocs project!"),await An(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await Mn(n,r,i,s,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(v(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.7.8","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").addOption(new Rn("--brand <brand>","Navbar brand").choices(["vercel","labs"]).default("vercel")).option("--disable-git","Disable git initialization").action(he);A.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(Ue);A.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(ke);var Fn=A.command("search").description("Manage the external search index used by Ask AI");Fn.command("sync").description("Sync the latest static docs export to Mixedbread").option("--dir <path>","Next.js output directory",".next").option("--allow-non-production","Run outside a production Vercel build").action(Pe);await A.parseAsync(process.argv).catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
|
|
7
|
+
`));let o=await Ie({client:we({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:i}),manifest:s,...Nt(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as Gt,writeFileSync as Ut}from"fs";import{mkdir as Lt,readFile as Z,writeFile as jt}from"fs/promises";import{dirname as Bt,extname as Vt,relative as Fe,resolve as j}from"path";import{intro as Jt,isCancel as Ht,log as I,multiselect as Xt,outro as L,spinner as Kt}from"@clack/prompts";import{glob as Yt}from"glob";import{Node as F,Project as qt,SyntaxKind as zt}from"ts-morph";var Wt="geistdocs.tsx",Qt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,Ae=()=>({version:1,entries:{}}),Zt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},en=e=>{let t=j(process.cwd(),e);return Gt(t,"utf8")},Me=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],tn=e=>{try{let t=new qt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=en(e),s=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!s)return[];if(F.isObjectLiteralExpression(s))return Me(s);let o=s.getFirstDescendantByKind(zt.ObjectLiteralExpression);return o?Me(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},nn=async()=>{let e=await Xt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ht(e)&&(L("Translation cancelled"),process.exit(0)),e},rn=async e=>(await Yt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),sn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?Ae():{version:1,entries:n.entries}}catch{return Ae()}},Re=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Ut(t,n,"utf8")},on=async e=>{let t=await Promise.all(e.map(async n=>[n,await Zt(n)]));return Object.fromEntries(t)},an=(e,t)=>{let n=Vt(e);return`${e.slice(0,-n.length)}.${t}${n}`},De=(e,t)=>`${Fe(process.cwd(),e)}::${t}`,cn=(e,t,n,r,i=!1)=>{let s=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=an(a,c),l=De(a,c),m=r.entries[l];if(!i&&m?.hash===d){o+=1;continue}s.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:s,skippedCount:o}},dn=async e=>{await Lt(Bt(e),{recursive:!0})},ln=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let s=await r.text();throw new Error(`API request failed (${r.status}): ${s}`)}let i=await r.json();if(!i.translation)throw new Error("API response did not include a translation");return i.translation},pn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),i=await ln(t,r,e.locale);await dn(e.targetFile),await jt(e.targetFile,i,"utf8"),n.entries[De(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},ke=async(e,t)=>{Jt("Translate MDX content");let n=e??Qt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",i=tn(t.config??Wt),s=await rn(n);s.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),L("Translation cancelled"),process.exit(1)),I.info(`Found ${s.length} MDX file(s) matching pattern`),i.length===0&&(i=await nn());let o=j(process.cwd(),ee),a=await sn();await Re(a),I.info(`Using cache: ${o}`);let d=await on(s),{tasks:c,skippedCount:u}=cn(i,s,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),L(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Kt();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await pn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Fe(process.cwd(),x.targetFile)}`)})),await Re(a);m.stop("Translation complete!"),L(`Created/updated ${c.length} file(s)`)};import{access as un,copyFile as gn,mkdir as Ne,rm as re}from"fs/promises";import{dirname as mn,join as v}from"path";import{intro as fn,log as w,outro as B,spinner as Ge}from"@clack/prompts";import{glob as hn}from"glob";var wn=["**/*"],yn=["content/docs/**"],te=".geistdocs-tmp",xn=async(e,t)=>{let n=v(e,t);await re(n,{recursive:!0,force:!0}),await Ne(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),Ce=async(e,t,n)=>(await hn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),bn=async e=>{try{return await un(e),!0}catch{return!1}},En=async(e,t,n)=>{let r=v(t,e),i=v(n,e);return await bn(r)?(await gn(r,i),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Sn=async(e,t)=>{let n=v(t,e);return await re(n,{force:!0}),{success:!0}},Oe=20,$e=async(e,t,n)=>{let r=[];for(let i=0;i<e.length;i+=n){let s=e.slice(i,i+n),o=await Promise.all(s.map(t));r.push(...o)}return r},_n=async(e,t,n,r,i)=>{let s={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>mn(v(r,d))))];i.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>Ne(d,{recursive:!0}))),i.message(`Updating ${e.length} files...`);let a=await $e(e,async d=>{let c=await En(d,n,r);return{file:d,...c}},Oe);for(let{file:d,success:c,error:u}of a)c?s.success.push(d):s.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){i.message(`Deleting ${t.length} files...`);let d=await $e(t,async c=>{try{return await Sn(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Oe);for(let c of d)c.success?s.deleted.push(c.file):s.failed.push({file:c.file,error:c.error})}return s},Tn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},In=e=>e.includes("canary")?"canary":"latest",vn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(S)}`);if(!t.ok)throw new Error(`Failed to resolve ${S}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${S}`);return r},Pn=async e=>{let t=await M(e),n=J(t,S);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=In(n),i=await vn(r);return n===i?{currentVersion:n,nextVersion:i,updateTag:r,updated:!1}:($(t,S,i),await O(e,t),{currentVersion:n,nextVersion:i,updateTag:r,updated:!0})},An=async(e,t,n)=>{let r=await M(e);if(!le(r,S))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:i,nextVersion:s,updateTag:o,updated:a}=await Pn(e);if(!a)return w.success(i?`@vercel/geistdocs is already at ${s} (${o}).`:"No package version update was needed."),B("Package-based site is already up to date."),!0;w.info(`Bumping ${S} from ${i} to ${s} (${o})`);let d=Ge();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),B("Please review and test the upgraded package version."),!0},Mn=async(e,t,n,r,i)=>{let s=v(e,te),o=Ge(),a=i?.sync?s:t;o.start("Preparing template snapshot..."),i?.sync&&(await xn(e,te),await N(s)),o.message("Scanning for files...");let d=await Ce(n,r,a),c=[];if(i?.sync){o.message("Comparing with local files...");let l=await Ce(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),i?.sync&&await ne(s),B("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),i?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await _n(d,c,a,e,o);i?.sync&&(o.message("Cleaning up..."),await ne(s)),o.stop("Update complete!"),Tn(u),B("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),i=e&&e.length>0?e:wn,s=e&&e.length>0?[]:yn;try{if(fn("Let's update your Geistdocs project!"),await An(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await Mn(n,r,i,s,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(v(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.7.10","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").addOption(new Rn("--brand <brand>","Navbar brand").choices(["vercel","labs"]).default("vercel")).option("--disable-git","Disable git initialization").action(he);A.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(Ue);A.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(ke);var Fn=A.command("search").description("Manage the external search index used by Ask AI");Fn.command("sync").description("Sync the latest static docs export to Mixedbread").option("--dir <path>","Next.js output directory",".next").option("--allow-non-production","Run outside a production Vercel build").action(Pe);await A.parseAsync(process.argv).catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAGA,cAAc,iCAAiC,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -17,16 +17,15 @@ export interface GeistdocsNavDropdownItem {
|
|
|
17
17
|
href: string;
|
|
18
18
|
label: string;
|
|
19
19
|
/**
|
|
20
|
-
* Optional column heading in the desktop panel
|
|
21
|
-
*
|
|
20
|
+
* Optional column heading in the desktop panel. Items without one group
|
|
21
|
+
* under the dropdown's own label.
|
|
22
22
|
*/
|
|
23
23
|
section?: string;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* A navbar item that opens a full-width panel of links instead of navigating,
|
|
27
|
-
* following the vercel.com header pattern
|
|
28
|
-
*
|
|
29
|
-
* mobile menu.
|
|
27
|
+
* following the vercel.com header pattern: columned sections of plain links
|
|
28
|
+
* on desktop, a collapsible section in the mobile menu.
|
|
30
29
|
*/
|
|
31
30
|
export interface GeistdocsNavDropdown {
|
|
32
31
|
items: GeistdocsNavDropdownItem[];
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,GAAG,SAAS,WAO7D,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,WAoBvE,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,WAavE,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,WAWtE,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,uCAAuC;AACvC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACl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IAC7B,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,iBAAiB,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAChD,aAAa,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC;IACnC,WAAW,CAAC,EAAE,0BAA0B,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC;AAED,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,eAAe,EAAE,QAAQ,CAAC,KAAG,CAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/message.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAEL,UAAU,EAEX,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/message.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAEL,UAAU,EAEX,MAAM,YAAY,CAAC;AAmMpB,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC1D,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,+BAA+B,YAAY,4CASlE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjE,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,4CAqBrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAErE,eAAO,MAAM,eAAe,gEACA,oBAAoB,6CAa/C,CAAC"}
|
|
@@ -5,17 +5,14 @@ import { memo, useState } from "react";
|
|
|
5
5
|
import { Streamdown, } from "streamdown";
|
|
6
6
|
import { IconArrowUpRightSmall } from "#geistdocs-assets/icons";
|
|
7
7
|
import { CodeBlock } from "#geistdocs-ui/components/code-block";
|
|
8
|
-
import {
|
|
8
|
+
import { Dialog, DialogAction, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "#geistdocs-ui/components/dialog";
|
|
9
9
|
import { cn } from "#geistdocs-ui/utils";
|
|
10
10
|
import { useGeistdocsConfig } from "../config-context";
|
|
11
11
|
import { resolveLinkHref } from "../link-href";
|
|
12
12
|
const CODE_LANGUAGE_PATTERN = /language-([\w-]+)/;
|
|
13
13
|
const FILENAME_PATTERN = /filename="([^"]+)"/;
|
|
14
14
|
const LinkSafetyModal = ({ isOpen, onClose, onConfirm, url, }) => {
|
|
15
|
-
return (_jsxs(
|
|
16
|
-
background: "var(--ds-background-200)",
|
|
17
|
-
boxShadow: "var(--ds-shadow-modal)",
|
|
18
|
-
}, width: 448, children: [_jsxs(ModalBody, { className: "bg-background-200", padding: 24, children: [_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: "Open external link?" }), _jsx(ModalSubtitle, { children: "You\u2019re about to visit an external website." })] }), _jsx("div", { className: "break-all rounded-md bg-gray-100 p-3 font-mono text-copy-13", children: url })] }), _jsxs(ModalActions, { children: [_jsx(ModalAction, { onClick: onClose, variant: "secondary", children: "Cancel" }), _jsx(ModalAction, { onClick: onConfirm, children: "Open link" })] })] }));
|
|
15
|
+
return (_jsxs(Dialog, { active: isOpen, drawer: false, onClickOutside: onClose, style: { background: "var(--ds-background-200)" }, width: 448, children: [_jsxs(DialogContent, { className: "bg-background-200", padding: 24, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Open external link?" }), _jsx(DialogDescription, { children: "You\u2019re about to visit an external website." })] }), _jsx("div", { className: "break-all rounded-md bg-gray-100 p-3 font-mono text-copy-13", children: url })] }), _jsxs(DialogFooter, { children: [_jsx(DialogClose, { onClick: onClose, variant: "secondary", children: "Cancel" }), _jsx(DialogAction, { onClick: onConfirm, children: "Open link" })] })] }));
|
|
19
16
|
};
|
|
20
17
|
const ChatLink = ({ children, className, href, node: _node, rel, target, ...props }) => {
|
|
21
18
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx-to-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/mdx-to-markdown.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,aAAa,EAAW,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"mdx-to-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/mdx-to-markdown.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,aAAa,EAAW,MAAM,SAAS,CAAC;AA0nCtD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,gBAAgB,aAAa,MAGjD,QAAQ,MAAM,oBAe7B,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,aAAa,WAlBF,MAAM,oBAkBoB,CAAC"}
|
|
@@ -177,6 +177,7 @@ const OMITTED_NODE_TYPES = new Set([
|
|
|
177
177
|
"mdxjsEsm",
|
|
178
178
|
"yaml",
|
|
179
179
|
]);
|
|
180
|
+
const TAB_LABEL_ATTRIBUTES = ["title", "label", "value"];
|
|
180
181
|
const OMITTED_COMPONENTS = new Set([
|
|
181
182
|
"CodeBlockTabsList",
|
|
182
183
|
"CodeBlockTabsTrigger",
|
|
@@ -209,10 +210,7 @@ const imageNodes = (node) => {
|
|
|
209
210
|
}
|
|
210
211
|
return nodes;
|
|
211
212
|
};
|
|
212
|
-
const
|
|
213
|
-
const title = getAttribute(node, "title");
|
|
214
|
-
const href = getAttribute(node, "href");
|
|
215
|
-
const description = getAttribute(node, "description");
|
|
213
|
+
const cardSummaryNodes = (title, href, description) => {
|
|
216
214
|
const nodes = [];
|
|
217
215
|
if (title) {
|
|
218
216
|
const titleNode = { type: "text", value: title };
|
|
@@ -223,9 +221,12 @@ const cardNodes = (node) => {
|
|
|
223
221
|
if (description) {
|
|
224
222
|
nodes.push(paragraph(description));
|
|
225
223
|
}
|
|
226
|
-
nodes.push(...blockChildren(node, true));
|
|
227
224
|
return nodes;
|
|
228
225
|
};
|
|
226
|
+
const cardNodes = (node) => [
|
|
227
|
+
...cardSummaryNodes(getAttribute(node, "title"), getAttribute(node, "href"), getAttribute(node, "description")),
|
|
228
|
+
...blockChildren(node, true),
|
|
229
|
+
];
|
|
229
230
|
const linkNodes = (node) => {
|
|
230
231
|
const href = getAttribute(node, "href");
|
|
231
232
|
if (!href) {
|
|
@@ -328,6 +329,163 @@ const typeTableNodes = (node) => {
|
|
|
328
329
|
},
|
|
329
330
|
];
|
|
330
331
|
};
|
|
332
|
+
const objectElements = (node) => node?.type === "ArrayExpression"
|
|
333
|
+
? (node.elements ?? []).filter((element) => element?.type === "ObjectExpression")
|
|
334
|
+
: [];
|
|
335
|
+
const listItem = (label, nested) => ({
|
|
336
|
+
children: [
|
|
337
|
+
{ children: label, type: "paragraph" },
|
|
338
|
+
...(nested.length > 0
|
|
339
|
+
? [{ children: nested, ordered: false, spread: false, type: "list" }]
|
|
340
|
+
: []),
|
|
341
|
+
],
|
|
342
|
+
spread: false,
|
|
343
|
+
type: "listItem",
|
|
344
|
+
});
|
|
345
|
+
const describedLabel = (label, description) => {
|
|
346
|
+
if (!description) {
|
|
347
|
+
return label;
|
|
348
|
+
}
|
|
349
|
+
return [
|
|
350
|
+
...label,
|
|
351
|
+
{
|
|
352
|
+
type: "text",
|
|
353
|
+
value: label.length > 0 ? `: ${description}` : description,
|
|
354
|
+
},
|
|
355
|
+
];
|
|
356
|
+
};
|
|
357
|
+
// A nested type in a parameter list: `{ type, description?, parameters }`.
|
|
358
|
+
// The page shows the type name over its parameters but not the description,
|
|
359
|
+
// so the export does the same.
|
|
360
|
+
const parameterGroupItems = (group) => {
|
|
361
|
+
const type = expressionString(objectProperty(group, "type"));
|
|
362
|
+
const nested = parameterItems(objectElements(objectProperty(group, "parameters")));
|
|
363
|
+
if (!type) {
|
|
364
|
+
return nested;
|
|
365
|
+
}
|
|
366
|
+
return [listItem([inlineCode(type)], nested)];
|
|
367
|
+
};
|
|
368
|
+
// One parameter: `{ name, type, isOptional?, description?, properties? }`.
|
|
369
|
+
// The page renders an optional name as `name?`, so the export does too.
|
|
370
|
+
function parameterItems(entries) {
|
|
371
|
+
return entries.flatMap((entry) => {
|
|
372
|
+
const name = expressionString(objectProperty(entry, "name"));
|
|
373
|
+
const type = expressionString(objectProperty(entry, "type"));
|
|
374
|
+
const description = expressionString(objectProperty(entry, "description"));
|
|
375
|
+
const optional = objectProperty(entry, "isOptional");
|
|
376
|
+
const nested = objectElements(objectProperty(entry, "properties")).flatMap(parameterGroupItems);
|
|
377
|
+
const label = [];
|
|
378
|
+
if (name) {
|
|
379
|
+
const isOptional = optional?.type === "Literal" && optional.value === true;
|
|
380
|
+
label.push(inlineCode(isOptional ? `${name}?` : name));
|
|
381
|
+
}
|
|
382
|
+
if (type) {
|
|
383
|
+
label.push(...(name
|
|
384
|
+
? [
|
|
385
|
+
{ type: "text", value: " (" },
|
|
386
|
+
inlineCode(type),
|
|
387
|
+
{ type: "text", value: ")" },
|
|
388
|
+
]
|
|
389
|
+
: [inlineCode(type)]));
|
|
390
|
+
}
|
|
391
|
+
const described = describedLabel(label, description);
|
|
392
|
+
if (described.length === 0) {
|
|
393
|
+
return nested;
|
|
394
|
+
}
|
|
395
|
+
return [listItem(described, nested)];
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
// `PropertiesTable` comes in two static shapes: Fumadocs' `type={{...}}`
|
|
399
|
+
// object (a flat table) and a `content={[...]}` parameter list whose entries
|
|
400
|
+
// can nest further types, which reads best as a nested list.
|
|
401
|
+
const propertiesTableNodes = (node) => {
|
|
402
|
+
const content = getAttributeExpression(node, "content");
|
|
403
|
+
if (content?.type !== "ArrayExpression") {
|
|
404
|
+
return typeTableNodes(node);
|
|
405
|
+
}
|
|
406
|
+
const items = parameterItems(objectElements(content));
|
|
407
|
+
return items.length > 0
|
|
408
|
+
? [{ children: items, ordered: false, spread: false, type: "list" }]
|
|
409
|
+
: [];
|
|
410
|
+
};
|
|
411
|
+
const TRIM_NEWLINES = /^\n+|\n+$/g;
|
|
412
|
+
// `Snippet` renders a copyable command or code line from its `text` prop: a
|
|
413
|
+
// string, a static template literal, or an array of lines. The page decides
|
|
414
|
+
// whether to show a shell prompt, so the fence carries no language.
|
|
415
|
+
const snippetNodes = (node) => {
|
|
416
|
+
const expression = getAttributeExpression(node, "text");
|
|
417
|
+
const text = getAttribute(node, "text");
|
|
418
|
+
let lines = [];
|
|
419
|
+
if (text !== undefined) {
|
|
420
|
+
lines = [text];
|
|
421
|
+
}
|
|
422
|
+
else if (expression?.type === "ArrayExpression") {
|
|
423
|
+
lines = (expression.elements ?? []).map((element) => expressionString(element ?? undefined));
|
|
424
|
+
}
|
|
425
|
+
if (lines.length === 0 || lines.some((line) => line === undefined)) {
|
|
426
|
+
return node.children ?? [];
|
|
427
|
+
}
|
|
428
|
+
const value = lines.join("\n").replace(TRIM_NEWLINES, "");
|
|
429
|
+
return value ? [{ type: "code", value }] : [];
|
|
430
|
+
};
|
|
431
|
+
// `IndexCards` lists section pages from a `cards={[{ title, description, href }]}`
|
|
432
|
+
// array; each card reads like a `Card`.
|
|
433
|
+
const indexCardsNodes = (node) => objectElements(getAttributeExpression(node, "cards")).flatMap((card) => cardSummaryNodes(expressionString(objectProperty(card, "title")), expressionString(objectProperty(card, "href")), expressionString(objectProperty(card, "description"))));
|
|
434
|
+
// `ExampleLinks` renders `examples={[{ title, link }]}` as a list of links.
|
|
435
|
+
const exampleLinksNodes = (node) => {
|
|
436
|
+
const items = objectElements(getAttributeExpression(node, "examples")).flatMap((example) => {
|
|
437
|
+
const title = expressionString(objectProperty(example, "title"));
|
|
438
|
+
const link = expressionString(objectProperty(example, "link"));
|
|
439
|
+
if (!(title && link)) {
|
|
440
|
+
return [];
|
|
441
|
+
}
|
|
442
|
+
return [
|
|
443
|
+
listItem([
|
|
444
|
+
{
|
|
445
|
+
children: [{ type: "text", value: title }],
|
|
446
|
+
type: "link",
|
|
447
|
+
url: link,
|
|
448
|
+
},
|
|
449
|
+
], []),
|
|
450
|
+
];
|
|
451
|
+
});
|
|
452
|
+
return items.length > 0
|
|
453
|
+
? [{ children: items, ordered: false, spread: false, type: "list" }]
|
|
454
|
+
: [];
|
|
455
|
+
};
|
|
456
|
+
// `GithubLink` renders a "View Example on GitHub" button for its `link`.
|
|
457
|
+
const githubLinkNodes = (node) => {
|
|
458
|
+
const link = getAttribute(node, "link");
|
|
459
|
+
return link
|
|
460
|
+
? [
|
|
461
|
+
{
|
|
462
|
+
children: [
|
|
463
|
+
{
|
|
464
|
+
children: [{ type: "text", value: "View Example on GitHub" }],
|
|
465
|
+
type: "link",
|
|
466
|
+
url: link,
|
|
467
|
+
},
|
|
468
|
+
],
|
|
469
|
+
type: "paragraph",
|
|
470
|
+
},
|
|
471
|
+
]
|
|
472
|
+
: [];
|
|
473
|
+
};
|
|
474
|
+
// `ChatGeneration` shows an example conversation: each `history` message as
|
|
475
|
+
// `Role: content`, then the `inputMessage` text waiting in the input box.
|
|
476
|
+
// The `outputMessage` appears only after a reader sends it, so it stays out.
|
|
477
|
+
const chatGenerationNodes = (node) => {
|
|
478
|
+
const history = objectElements(getAttributeExpression(node, "history")).flatMap((message) => {
|
|
479
|
+
const role = expressionString(objectProperty(message, "role"));
|
|
480
|
+
const content = expressionString(objectProperty(message, "content"));
|
|
481
|
+
if (!content) {
|
|
482
|
+
return [];
|
|
483
|
+
}
|
|
484
|
+
return [paragraph(role ? `${role}: ${content}` : content)];
|
|
485
|
+
});
|
|
486
|
+
const input = expressionString(objectProperty(getAttributeExpression(node, "inputMessage"), "content"));
|
|
487
|
+
return [...history, ...(input ? [paragraph(input)] : [])];
|
|
488
|
+
};
|
|
331
489
|
const mermaidNodes = (node) => {
|
|
332
490
|
const chart = getAttribute(node, "chart");
|
|
333
491
|
return chart ? [{ lang: "mermaid", type: "code", value: chart }] : [];
|
|
@@ -516,20 +674,27 @@ const COMPONENT_REPLACERS = {
|
|
|
516
674
|
APIPage: apiOperationNodes,
|
|
517
675
|
APISignature: endpointNodes,
|
|
518
676
|
Button: buttonNodes,
|
|
677
|
+
ButtonLink: linkNodes,
|
|
519
678
|
Callout: (node) => [calloutNode(node)],
|
|
520
679
|
Card: cardNodes,
|
|
680
|
+
CardPlayer: cardNodes,
|
|
681
|
+
ChatGeneration: chatGenerationNodes,
|
|
521
682
|
Details: (node) => blockChildren(node, true),
|
|
522
683
|
EndpointDisplay: endpointNodes,
|
|
684
|
+
ExampleLinks: exampleLinksNodes,
|
|
685
|
+
GithubLink: githubLinkNodes,
|
|
523
686
|
Image: imageNodes,
|
|
687
|
+
IndexCards: indexCardsNodes,
|
|
524
688
|
InstallPackages: packageNodes,
|
|
525
689
|
LearnMore: linkNodes,
|
|
526
690
|
Link: linkNodes,
|
|
527
691
|
MDXImage: imageNodes,
|
|
528
692
|
Mermaid: mermaidNodes,
|
|
529
693
|
PackageInstall: packageNodes,
|
|
530
|
-
PropertiesTable:
|
|
694
|
+
PropertiesTable: propertiesTableNodes,
|
|
695
|
+
Snippet: snippetNodes,
|
|
531
696
|
Summary: summaryNodes,
|
|
532
|
-
Tab: (node) => labelledContentNodes(node,
|
|
697
|
+
Tab: (node) => labelledContentNodes(node, TAB_LABEL_ATTRIBUTES),
|
|
533
698
|
ThemeAwareImage: themeAwareImageNodes,
|
|
534
699
|
TypeTable: typeTableNodes,
|
|
535
700
|
Video: videoNodes,
|
|
@@ -556,16 +721,46 @@ const replaceComponent = (node) => {
|
|
|
556
721
|
return node.children ?? [];
|
|
557
722
|
};
|
|
558
723
|
const isJsxElement = (node) => node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement";
|
|
559
|
-
|
|
560
|
-
|
|
724
|
+
// Read literals without evaluating MDX. A spread makes label positions unknown.
|
|
725
|
+
const tabLabels = (expression) => {
|
|
561
726
|
const elements = expression?.elements ?? [];
|
|
562
|
-
|
|
563
|
-
const labels = expression?.type === "ArrayExpression" &&
|
|
727
|
+
return expression?.type === "ArrayExpression" &&
|
|
564
728
|
!elements.some((element) => element?.type === "SpreadElement")
|
|
565
729
|
? elements.map((element) => element?.type === "Literal" && typeof element.value === "string"
|
|
566
730
|
? element.value
|
|
567
731
|
: undefined)
|
|
568
732
|
: [];
|
|
733
|
+
};
|
|
734
|
+
// Fumadocs `Tabs` names its panels in `items={[...]}`; a `Tab` without its own
|
|
735
|
+
// label takes the item at its position, so each panel keeps its heading.
|
|
736
|
+
const itemTabsNodes = (node) => {
|
|
737
|
+
const labels = tabLabels(getAttributeExpression(node, "items"));
|
|
738
|
+
let index = 0;
|
|
739
|
+
return (node.children ?? []).flatMap((child) => {
|
|
740
|
+
if (!isJsxElement(child) || child.name !== "Tab") {
|
|
741
|
+
return cleanNode(child);
|
|
742
|
+
}
|
|
743
|
+
const label = labels[index];
|
|
744
|
+
index += 1;
|
|
745
|
+
// A Tab that names itself (even dynamically) or spreads props keeps its
|
|
746
|
+
// own label, or none: its position no longer says which item it is.
|
|
747
|
+
const ownLabel = (child.attributes ?? []).some((entry) => entry.type === "mdxJsxExpressionAttribute" ||
|
|
748
|
+
(entry.type === "mdxJsxAttribute" &&
|
|
749
|
+
TAB_LABEL_ATTRIBUTES.includes(entry.name ?? "")));
|
|
750
|
+
if (!label || ownLabel) {
|
|
751
|
+
return cleanNode(child);
|
|
752
|
+
}
|
|
753
|
+
return cleanNode({
|
|
754
|
+
...child,
|
|
755
|
+
attributes: [
|
|
756
|
+
...(child.attributes ?? []),
|
|
757
|
+
{ name: "title", type: "mdxJsxAttribute", value: label },
|
|
758
|
+
],
|
|
759
|
+
});
|
|
760
|
+
});
|
|
761
|
+
};
|
|
762
|
+
const tabsNodes = (node) => {
|
|
763
|
+
const labels = tabLabels(getAttributeExpression(node, "tabs"));
|
|
569
764
|
return (node.children ?? []).flatMap((child) => {
|
|
570
765
|
if (!isJsxElement(child) || child.name !== "TabContent") {
|
|
571
766
|
return cleanNode(child);
|
|
@@ -632,6 +827,9 @@ const cleanNode = (node) => {
|
|
|
632
827
|
if (isJsxElement(node) && node.name === "TabsWithChildren") {
|
|
633
828
|
return tabsNodes(node);
|
|
634
829
|
}
|
|
830
|
+
if (isJsxElement(node) && node.name === "Tabs") {
|
|
831
|
+
return itemTabsNodes(node);
|
|
832
|
+
}
|
|
635
833
|
if (node.children) {
|
|
636
834
|
node.children = node.children.flatMap(cleanNode);
|
|
637
835
|
}
|
|
@@ -37,8 +37,8 @@ export function groupDropdownItems(dropdown) {
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* A nav dropdown rendered as a full-width panel below the header, following
|
|
40
|
-
* the vercel.com header pattern
|
|
41
|
-
*
|
|
40
|
+
* the vercel.com header pattern with columned sections and plain
|
|
41
|
+
* hover-underline links.
|
|
42
42
|
*/
|
|
43
43
|
const DropdownNavItem = ({ first, item, }) => {
|
|
44
44
|
const isActive = useNavActive();
|
|
@@ -4,7 +4,7 @@ interface MobileMenuProps {
|
|
|
4
4
|
githubUrl?: string | null;
|
|
5
5
|
nav: GeistdocsNavItem[];
|
|
6
6
|
ossProducts?: GeistdocsNavbarOssProduct[];
|
|
7
|
-
/** Whether the OSS
|
|
7
|
+
/** Whether the OSS product section is enabled (navbar variant is "oss"). */
|
|
8
8
|
showOss?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare const MobileMenu: ({ activeProduct, githubUrl, nav, ossProducts, showOss, }: MobileMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/mobile-menu.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,yBAAyB,EAEzB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAQtB,UAAU,eAAe;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,gBAAgB,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1C,
|
|
1
|
+
{"version":3,"file":"mobile-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/mobile-menu.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,yBAAyB,EAEzB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAQtB,UAAU,eAAe;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,gBAAgB,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1C,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA6PD,eAAO,MAAM,UAAU,GAAI,0DAMxB,eAAe,4CA0HjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar-brand.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/navbar-brand.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"navbar-brand.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/navbar-brand.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAG1E,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,OAAO,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,WAAW,GAAI,qBAGzB,gBAAgB,4CA0ClB,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import Link from "next/link";
|
|
3
|
-
import { LogoIconVercelSvg, LogoVercelOssSvg } from "#geistdocs-assets/logos";
|
|
4
3
|
import { LogoVercelLabs } from "./logo-vercel-labs";
|
|
5
4
|
export const NavbarBrand = ({ brand = "vercel", variant = "standard", }) => {
|
|
6
5
|
let label = "Vercel";
|
|
7
6
|
let href = "https://vercel.com/";
|
|
8
|
-
let logo = _jsx(
|
|
7
|
+
let logo = (_jsx("svg", { "aria-hidden": "true", focusable: "false", height: "18", viewBox: "0 0 115 100", width: "21", children: _jsx("g", { children: _jsx("path", { clipRule: "evenodd", d: "M57.5 0 115 100H0z", fill: "currentColor", fillRule: "evenodd" }) }) }));
|
|
9
8
|
if (brand === "labs") {
|
|
10
9
|
label = "Vercel Labs";
|
|
11
10
|
href = "https://vercel.com/labs";
|
|
@@ -14,7 +13,6 @@ export const NavbarBrand = ({ brand = "vercel", variant = "standard", }) => {
|
|
|
14
13
|
else if (variant === "oss") {
|
|
15
14
|
label = "Vercel Open Source";
|
|
16
15
|
href = "https://vercel.com/oss";
|
|
17
|
-
logo = (_jsxs(_Fragment, { children: [_jsx(LogoIconVercelSvg, { className: "@min-[640px]:hidden", size: 18 }), _jsx(LogoVercelOssSvg, { className: "@min-[640px]:block hidden shrink-0", height: 18 })] }));
|
|
18
16
|
}
|
|
19
17
|
return (_jsx(Link, { "aria-label": label, className: "-mx-2 flex items-center rounded-md p-2 text-gray-1000 outline-none focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-inset", href: href, rel: "noopener", target: "_blank", children: logo }));
|
|
20
18
|
};
|
|
@@ -1,41 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
2
|
import type { GeistdocsNavbarBrand, GeistdocsNavbarOssProduct } from "../../config";
|
|
3
3
|
export declare const DEFAULT_OSS_SECTION = "Open Source";
|
|
4
4
|
export declare const DEFAULT_OSS_PRODUCTS: GeistdocsNavbarOssProduct[];
|
|
5
5
|
/**
|
|
6
|
-
* Full-bleed panel below the header
|
|
7
|
-
*
|
|
8
|
-
* with forceMount + hidden-when-closed so links stay in the server HTML.
|
|
6
|
+
* Full-bleed panel below the header used by navbar dropdowns. Rendered with
|
|
7
|
+
* forceMount + hidden-when-closed so links stay in the server HTML.
|
|
9
8
|
*/
|
|
10
9
|
export declare const NAVBAR_PANEL_CLASSNAME = "fixed inset-x-0 top-16 z-30 w-screen bg-background-200 shadow-[0_1px_0_0_var(--ds-gray-alpha-300)] before:absolute before:inset-x-0 before:-top-3 before:h-3 before:content-[''] data-[state=closed]:hidden";
|
|
11
10
|
/**
|
|
12
|
-
* Plain hover-underline
|
|
13
|
-
*
|
|
11
|
+
* Plain hover-underline link for navbar dropdown panels. `active` marks the
|
|
12
|
+
* current page (aria-current + underline).
|
|
14
13
|
*/
|
|
15
14
|
export declare function PanelLink({ active, product, }: {
|
|
16
15
|
active?: boolean;
|
|
17
16
|
product: Pick<GeistdocsNavbarOssProduct, "external" | "href" | "label">;
|
|
18
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
19
18
|
/**
|
|
20
|
-
* Resolve the OSS
|
|
19
|
+
* Resolve the mobile OSS product list (custom or default) and drop the active
|
|
20
|
+
* product.
|
|
21
21
|
* Lives here (a "use client" module) because `DEFAULT_OSS_PRODUCTS` holds JSX
|
|
22
22
|
* and is a client-only value — resolving it on the server yields a client
|
|
23
23
|
* reference, not the array.
|
|
24
24
|
*/
|
|
25
25
|
export declare function resolveOssProducts(products: GeistdocsNavbarOssProduct[] | undefined, activeProduct: string | undefined): GeistdocsNavbarOssProduct[];
|
|
26
|
-
|
|
26
|
+
interface NavbarLogoProps {
|
|
27
27
|
brand?: GeistdocsNavbarBrand;
|
|
28
28
|
className?: string;
|
|
29
29
|
href?: string;
|
|
30
|
-
} & ({
|
|
31
|
-
activeProduct?: string;
|
|
32
|
-
variant: "oss";
|
|
33
30
|
logo: ReactNode;
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
variant?: "standard";
|
|
37
|
-
logo: ReactNode;
|
|
38
|
-
});
|
|
31
|
+
variant?: "oss" | "standard";
|
|
32
|
+
}
|
|
39
33
|
export declare function NavbarLogo({ brand, className, href, ...props }: NavbarLogoProps): import("react/jsx-runtime").JSX.Element;
|
|
40
34
|
export {};
|
|
41
35
|
//# sourceMappingURL=navbar-logo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar-logo.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/navbar-logo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"navbar-logo.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/navbar-logo.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAKtB,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,EAuF3D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,gNAC4K,CAAC;AAEhN;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,IAAI,CAAC,yBAAyB,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;CACzE,2CA+BA;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,yBAAyB,EAAE,GAAG,SAAS,EACjD,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,yBAAyB,EAAE,CAI7B;AAED,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC;CAC9B;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,IAAU,EACV,GAAG,KAAK,EACT,EAAE,eAAe,2CAmBjB"}
|