@vercel/geistdocs 2.14.0-canary.fbbc4b6 → 2.14.1

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.
Files changed (35) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/components/code-block-tabs.d.ts.map +1 -1
  3. package/dist/components/code-block-tabs.js +4 -1
  4. package/dist/controls.d.ts.map +1 -1
  5. package/dist/controls.js +2 -2
  6. package/dist/internal/chat/dots-spinner.d.ts.map +1 -1
  7. package/dist/internal/chat/dots-spinner.js +4 -1
  8. package/dist/internal/chat/page-attachment.js +1 -1
  9. package/dist/internal/chat/shell.d.ts.map +1 -1
  10. package/dist/internal/chat/shell.js +65 -9
  11. package/dist/internal/navbar/desktop-menu.d.ts.map +1 -1
  12. package/dist/internal/navbar/desktop-menu.js +3 -1
  13. package/dist/internal/navbar/mobile-menu.d.ts.map +1 -1
  14. package/dist/internal/navbar/mobile-menu.js +28 -9
  15. package/dist/internal/navbar/navbar-logo.d.ts +3 -2
  16. package/dist/internal/navbar/navbar-logo.d.ts.map +1 -1
  17. package/dist/internal/navbar/navbar-logo.js +6 -3
  18. package/dist/internal/navbar/use-server-panel-mount.d.ts +9 -0
  19. package/dist/internal/navbar/use-server-panel-mount.d.ts.map +1 -0
  20. package/dist/internal/navbar/use-server-panel-mount.js +11 -0
  21. package/dist/internal/provider-client.d.ts.map +1 -1
  22. package/dist/internal/provider-client.js +24 -12
  23. package/dist/internal/search.d.ts.map +1 -1
  24. package/dist/internal/search.js +36 -4
  25. package/dist/source-config.d.ts +6 -0
  26. package/dist/source-config.d.ts.map +1 -1
  27. package/dist/source-config.js +13 -0
  28. package/docs/agents.md +1 -1
  29. package/docs/llms.txt +1 -1
  30. package/docs/manifest.json +1 -1
  31. package/package.json +8 -6
  32. package/rehype-task-list-labels.d.ts +9 -0
  33. package/rehype-task-list-labels.js +52 -0
  34. package/source-config.js +14 -0
  35. package/template/package.json +1 -1
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.14.0-canary.fbbc4b6","-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.14.1","-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});
@@ -1 +1 @@
1
- {"version":3,"file":"code-block-tabs.d.ts","sourceRoot":"","sources":["../../src/components/code-block-tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,WAAW,EACZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAIf,eAAO,MAAM,iBAAiB,GAAI,OAAO,cAAc,CAAC,OAAO,QAAQ,CAAC,4CAYvE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,wBAGlC,cAAc,CAAC,OAAO,WAAW,CAAC,4CAUpC,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,uBAG3B,cAAc,CAAC,OAAO,IAAI,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,4CA8DrD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,EAAE,SAAS,CAAC,4CACrB,CAAC;AAE1C,eAAO,MAAM,YAAY,GAAI,OAAO,cAAc,CAAC,OAAO,WAAW,CAAC,4CAErE,CAAC"}
1
+ {"version":3,"file":"code-block-tabs.d.ts","sourceRoot":"","sources":["../../src/components/code-block-tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,WAAW,EACZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAIf,eAAO,MAAM,iBAAiB,GAAI,OAAO,cAAc,CAAC,OAAO,QAAQ,CAAC,4CAYvE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,wBAGlC,cAAc,CAAC,OAAO,WAAW,CAAC,4CAUpC,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,uBAG3B,cAAc,CAAC,OAAO,IAAI,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,4CA8DrD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,EAAE,SAAS,CAAC,4CACrB,CAAC;AAE1C,eAAO,MAAM,YAAY,GAAI,OAAO,cAAc,CAAC,OAAO,WAAW,CAAC,4CAUrE,CAAC"}
@@ -29,4 +29,7 @@ export const CodeBlockTabs = ({ compact = false, ...props }) => {
29
29
  return (_jsxs("div", { className: "not-prose relative [&_[role=tablist]]:hidden", children: [_jsxs("div", { className: "group absolute top-1.5 right-12 z-2 h-7", children: [_jsxs("div", { "aria-hidden": "true", className: "flex h-full cursor-pointer items-center gap-1 whitespace-nowrap rounded-md border-none bg-background-200 px-2 py-0 font-sans text-gray-900 text-label-13 leading-none transition-colors duration-200 group-focus-within:shadow-[var(--ds-focus-ring)] group-hover:bg-gray-200", children: [_jsx("span", { children: selectedLabel }), _jsx(IconChevronDown, { size: 16 })] }), _jsx("select", { "aria-label": "Code language", className: "absolute inset-0 cursor-pointer bg-gray-100 opacity-0 outline-hidden", onChange: (event) => setValue(event.target.value), value: value, children: options.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value))) })] }), tabs] }));
30
30
  };
31
31
  export const CompactCodeBlockTabs = (props) => _jsx(CodeBlockTabs, { ...props, compact: true });
32
- export const CodeBlockTab = (props) => (_jsx(TabsContent, { ...props, className: cn("[&>div]:mb-0", props.className) }));
32
+ export const CodeBlockTab = (props) => (
33
+ // The private provider wraps code blocks in a `display: contents` region, so
34
+ // the margin reset also has to reach through that wrapper.
35
+ _jsx(TabsContent, { ...props, className: cn("[&>[data-focusable-code-region]>div]:mb-0 [&>div]:mb-0", props.className) }));
@@ -1 +1 @@
1
- {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAgC,MAAM,OAAO,CAAC;AAWrE,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AAQjC,YAAY,EACV,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,uBAwBnC,CAAC;AAEF,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,GAAI,wBAAwB,iBAAiB,4CAqBrE,CAAC;AAEF,eAAO,MAAM,WAAW,+CA0CvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDA+B5B,CAAC;AAEF,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;IACpD,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;CAChD;AAED,eAAO,MAAM,WAAW,GAAI,0DAOzB,gBAAgB,mDA+BlB,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,qBAAqB,cAAc,SAc5D,CAAC"}
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAgC,MAAM,OAAO,CAAC;AAWrE,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AAQjC,YAAY,EACV,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,uBAwBnC,CAAC;AAEF,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,GAAI,wBAAwB,iBAAiB,4CAqBrE,CAAC;AAEF,eAAO,MAAM,WAAW,+CA0CvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDA+B5B,CAAC;AAEF,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;IACpD,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;CAChD;AAED,eAAO,MAAM,WAAW,GAAI,0DAOzB,gBAAgB,mDAgClB,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,qBAAqB,cAAc,SAc5D,CAAC"}
package/dist/controls.js CHANGED
@@ -36,7 +36,7 @@ export const useGeistdocsChat = () => {
36
36
  };
37
37
  export const SearchButton = ({ className, onClick }) => {
38
38
  const { setOpenSearch } = useSearchContext();
39
- return (_jsxs("button", { className: cn("flex h-8 cursor-pointer items-center justify-between rounded-md border-0 bg-background-100 py-0 pr-1.5 pl-3.5 font-normal font-sans text-gray-1000 text-sm shadow-[0_0_0_1px_var(--ds-gray-400)] outline-none hover:bg-gray-100 focus-visible:shadow-focus-ring", className), onClick: () => {
39
+ return (_jsxs("button", { className: cn("flex h-8 cursor-pointer items-center justify-between rounded-md border-0 bg-background-100 py-0 pr-1.5 pl-3.5 font-normal font-sans text-gray-1000 text-sm shadow-[0_0_0_1px_var(--ds-gray-400)] outline-none hover:bg-gray-100 focus-visible:shadow-[var(--ds-focus-ring)]", className), onClick: () => {
40
40
  setOpenSearch(true);
41
41
  onClick?.();
42
42
  }, type: "button", children: [_jsx("span", { className: "pr-6", children: "Search\u2026" }), _jsx(Kbd, { className: "inline-flex items-center justify-center rounded", small: true, children: "\u2318K" })] }));
@@ -67,7 +67,7 @@ export const AskAIButton = ({ children, className, prompt, size = "small", varia
67
67
  if (!enabled) {
68
68
  return null;
69
69
  }
70
- return (_jsx(Button, { className: cn("shrink-0", className), onClick: () => {
70
+ return (_jsx(Button, { className: cn("shrink-0", className), "data-geistdocs-ask-ai": "", onClick: () => {
71
71
  preloadChat();
72
72
  if (prompt) {
73
73
  setPrompt(prompt);
@@ -1 +1 @@
1
- {"version":3,"file":"dots-spinner.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/dots-spinner.tsx"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,KAAW,GACZ,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAmBA"}
1
+ {"version":3,"file":"dots-spinner.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/dots-spinner.tsx"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,KAAW,GACZ,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAyBA"}
@@ -17,5 +17,8 @@ export function DotsSpinner({ className, speed = 150, }) {
17
17
  ref.current.textContent = FRAMES[currentFrame];
18
18
  },
19
19
  });
20
- return (_jsx("span", { className: cn("inline-block w-4 text-center", className), ref: ref, children: FRAMES[0] }));
20
+ return (
21
+ // Decorative: the frames change every tick, and callers render a text
22
+ // label alongside it.
23
+ _jsx("span", { "aria-hidden": "true", className: cn("inline-block w-4 text-center", className), ref: ref, children: FRAMES[0] }));
21
24
  }
@@ -6,7 +6,7 @@ import { getChatPageLabel, getMessagePageAttachment, } from "./commands";
6
6
  /** Removable card above the prompt input naming the page the next message carries. */
7
7
  export const ChatPageAttachmentCard = ({ onRemove, page, }) => {
8
8
  const label = getChatPageLabel(page);
9
- return (_jsxs("div", { className: "flex min-w-0 items-center gap-2 rounded-md border border-gray-alpha-400 bg-background-200 py-1.5 pr-1 pl-2.5 text-gray-1000 text-label-13", "data-geistdocs-chat-page-attachment": true, children: [_jsx(IconFileText, { className: "shrink-0 text-gray-900", size: 14 }), _jsxs("span", { className: "min-w-0 flex-1 truncate", title: page.url, children: [_jsx("span", { className: "sr-only", children: "Asking about " }), label] }), _jsx("button", { "aria-label": `Remove ${label}`, className: "flex size-6 shrink-0 cursor-pointer items-center justify-center rounded text-gray-900 hover:bg-gray-alpha-100 hover:text-gray-1000 focus-visible:shadow-focus-ring focus-visible:outline-none", onClick: onRemove, type: "button", children: _jsx(IconCross, { size: 12 }) })] }));
9
+ return (_jsxs("div", { className: "flex min-w-0 items-center gap-2 rounded-md border border-gray-alpha-400 bg-background-200 py-1.5 pr-1 pl-2.5 text-gray-1000 text-label-13", "data-geistdocs-chat-page-attachment": true, children: [_jsx(IconFileText, { className: "shrink-0 text-gray-900", size: 14 }), _jsxs("span", { className: "min-w-0 flex-1 truncate", title: page.url, children: [_jsx("span", { className: "sr-only", children: "Asking about " }), label] }), _jsx("button", { "aria-label": `Remove ${label}`, className: "flex size-6 shrink-0 cursor-pointer items-center justify-center rounded text-gray-900 hover:bg-gray-alpha-100 hover:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none", onClick: onRemove, type: "button", children: _jsx(IconCross, { size: 12 }) })] }));
10
10
  };
11
11
  /** Chip on a sent user message naming the page it was asked about. */
12
12
  export const ChatMessagePageChip = ({ className, metadata, }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/shell.tsx"],"names":[],"mappings":"AAuaA,eAAO,MAAM,kBAAkB,sDA+D9B,CAAC"}
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/shell.tsx"],"names":[],"mappings":"AA6eA,eAAO,MAAM,kBAAkB,sDAiE9B,CAAC"}
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useChat } from "@ai-sdk/react";
4
4
  import { catchError } from "next/error";
5
5
  import { Portal } from "radix-ui";
6
- import { useEffect, useRef } from "react";
6
+ import { useEffect, useLayoutEffect, useRef, useState, } from "react";
7
7
  import { IconChevronDoubleRight, IconFullscreen, IconFullscreenClose, IconTrash, } from "#geistdocs-assets/icons";
8
8
  import { Button } from "#geistdocs-ui/components/button";
9
9
  import { Drawer, DrawerTitle } from "#geistdocs-ui/components/drawer";
@@ -118,13 +118,25 @@ const GeistdocsChatPanel = ({ clearConversation, expandable, session, textareaRe
118
118
  };
119
119
  return (_jsxs("aside", { "aria-label": `${chatTitle} chat`, className: "flex size-full w-full flex-col overflow-hidden whitespace-nowrap bg-background-100", children: [_jsxs("div", { className: cn("sticky top-0 z-10 flex h-16 shrink-0 items-center justify-between bg-background-100 py-2 pr-2 pl-3.5", isExpanded && EXPANDED_COLUMN), children: [_jsx("h2", { className: "font-semibold text-sm", children: chatTitle }), _jsxs("div", { className: "flex items-center gap-0.5", children: [_jsx(CopyChat, { messages: messages }), expandable ? (_jsx(Tooltip, { position: "bottom", text: expandLabel, children: _jsx(Button, { "aria-label": expandLabel, "aria-pressed": isExpanded, className: "text-gray-800! shadow-none", onClick: () => setIsExpanded(!isExpanded), shape: "square", size: "small", svgOnly: true, typeName: "button", variant: "tertiary", children: isExpanded ? (_jsx(IconFullscreenClose, { size: 14 })) : (_jsx(IconFullscreen, { size: 14 })) }) })) : null, _jsx(Tooltip, { position: "bottom", text: "Delete chat", children: _jsx(Button, { "aria-label": "Delete chat", className: "text-gray-800! disabled:bg-gray-alpha-100!", disabled: messages.length === 0 ||
120
120
  status === "streaming" ||
121
- status === "submitted", onClick: handleClearChat, shape: "square", size: "small", svgOnly: true, typeName: "button", variant: "tertiary", children: _jsx(IconTrash, { size: 14 }) }) }), _jsx(Tooltip, { position: "bottom", text: "Close chat", children: _jsx(Button, { "aria-label": "Close chat", className: "text-gray-800! shadow-none", onClick: () => setIsOpen(false), shape: "square", size: "small", svgOnly: true, typeName: "button", variant: "tertiary", children: _jsx(IconChevronDoubleRight, { size: 14 }) }) })] })] }), _jsxs(Conversation, { children: [_jsxs(ConversationContent, { className: cn(isExpanded && EXPANDED_COLUMN), children: [messages.map((message, index) => (_jsxs(Message, { avatar: message.role === "user" ? userAvatar : undefined, from: message.role, children: [_jsx(MessageMetadata, { inProgress: isActiveAssistantMessage({
122
- index,
123
- messages,
124
- status,
125
- }), parts: message.parts }), _jsx(ChatMessagePageChip, { metadata: message.metadata }), message.parts
126
- .filter((part) => part.type === "text")
127
- .map((part) => (_jsx(MessageContent, { children: _jsx(MessageResponse, { className: "text-wrap", children: part.text }) }, `${message.id}-${part.type}-${part.text}`))), _jsx(MessageActions, { index: index, messages: messages, setMessages: setMessages, status: status })] }, message.id))), shouldShowPendingActivity({ messages, status }) ? (_jsx("div", { className: "h-12 animate-pulse pt-2 text-gray-900 text-sm", children: _jsx(DotsSpinner, {}) })) : null] }), _jsx(ConversationScrollButton, {})] }), _jsxs("div", { className: cn("relative grid w-auto shrink-0 gap-3 whitespace-normal p-4 text-left", isExpanded && EXPANDED_COLUMN), children: [messages.length ? null : (_jsxs(_Fragment, { children: [_jsx(Suggestions, { className: "w-full cursor-text", children: suggestions.map((suggestion) => (_jsx(Suggestion, { className: "w-full", icon: suggestion.icon, onClick: handleSuggestionClick, suggestion: suggestion.text, variant: "tertiary" }, suggestion.key))) }), _jsxs("p", { className: "mb-3 whitespace-normal px-2 text-left text-gray-900 text-label-14", children: ["Tip: You can open and close chat with", _jsx(Kbd, { className: "material-base ml-1.5 text-gray-900", meta: true, small: true }), _jsx(Kbd, { className: "material-base ml-1 font-mono! text-gray-900", small: true, children: "I" })] })] })), commandState.attachedPage ? (_jsx(ChatPageAttachmentCard, { onRemove: commands.detachPage, page: commandState.attachedPage })) : null, _jsx(ChatPromptInput, { onChange: setPrompt, onStop: stop, onSubmit: (event) => {
121
+ status === "submitted", onClick: handleClearChat, shape: "square", size: "small", svgOnly: true, typeName: "button", variant: "tertiary", children: _jsx(IconTrash, { size: 14 }) }) }), _jsx(Tooltip, { position: "bottom", text: "Close chat", children: _jsx(Button, { "aria-label": "Close chat", className: "text-gray-800! shadow-none", onClick: () => setIsOpen(false), shape: "square", size: "small", svgOnly: true, typeName: "button", variant: "tertiary", children: _jsx(IconChevronDoubleRight, { size: 14 }) }) })] })] }), _jsxs(Conversation, { children: [_jsxs(ConversationContent, { className: cn(isExpanded && EXPANDED_COLUMN), children: [messages.map((message, index) => {
122
+ const inProgress = isActiveAssistantMessage({
123
+ index,
124
+ messages,
125
+ status,
126
+ });
127
+ return (_jsxs(Message
128
+ // Screen readers hold the log's announcement until the
129
+ // answer finishes streaming instead of reading each chunk.
130
+ , { "aria-busy": inProgress || undefined, avatar: message.role === "user" ? userAvatar : undefined, from: message.role, children: [_jsx(MessageMetadata, { inProgress: inProgress, parts: message.parts }), _jsx(ChatMessagePageChip, { metadata: message.metadata }), message.parts
131
+ .filter((part) => part.type === "text")
132
+ .map((part, partIndex) => (
133
+ // Keyed by position, not text, so streamed chunks update
134
+ // the answer in place instead of remounting it inside the
135
+ // live log on every chunk. Parts only append, so a part's
136
+ // position is its identity.
137
+ // biome-ignore lint/suspicious/noArrayIndexKey: text parts have no ID and only append
138
+ _jsx(MessageContent, { children: _jsx(MessageResponse, { className: "text-wrap", children: part.text }) }, `${message.id}-${partIndex}`))), _jsx(MessageActions, { index: index, messages: messages, setMessages: setMessages, status: status })] }, message.id));
139
+ }), shouldShowPendingActivity({ messages, status }) ? (_jsxs("div", { className: "h-12 animate-pulse pt-2 text-gray-900 text-sm", children: [_jsx(DotsSpinner, {}), _jsx("span", { className: "sr-only", children: "Thinking\u2026" })] })) : null] }), _jsx(ConversationScrollButton, {})] }), _jsxs("div", { className: cn("relative grid w-auto shrink-0 gap-3 whitespace-normal p-4 text-left", isExpanded && EXPANDED_COLUMN), children: [messages.length ? null : (_jsxs(_Fragment, { children: [_jsx(Suggestions, { className: "w-full cursor-text", children: suggestions.map((suggestion) => (_jsx(Suggestion, { className: "w-full", icon: suggestion.icon, onClick: handleSuggestionClick, suggestion: suggestion.text, variant: "tertiary" }, suggestion.key))) }), _jsxs("p", { className: "mb-3 whitespace-normal px-2 text-left text-gray-900 text-label-14", children: ["Tip: You can open and close chat with", _jsx(Kbd, { className: "material-base ml-1.5 text-gray-900", meta: true, small: true }), _jsx(Kbd, { className: "material-base ml-1 font-mono! text-gray-900", small: true, children: "I" })] })] })), commandState.attachedPage ? (_jsx(ChatPageAttachmentCard, { onRemove: commands.detachPage, page: commandState.attachedPage })) : null, _jsx(ChatPromptInput, { onChange: setPrompt, onStop: stop, onSubmit: (event) => {
128
140
  event.preventDefault();
129
141
  handleSubmit().catch((error) => {
130
142
  console.error("Failed to submit chat message:", error);
@@ -146,11 +158,55 @@ const GeistdocsChatError = ({ chatTitle, onClose, retry, }) => {
146
158
  };
147
159
  const GeistdocsChatErrorFallback = ({ chatTitle, onClose }, { retry }) => (_jsx(GeistdocsChatError, { chatTitle: chatTitle, onClose: onClose, retry: retry }));
148
160
  const GeistdocsChatErrorBoundary = catchError(GeistdocsChatErrorFallback);
161
+ const isVisible = (element) => element instanceof HTMLElement &&
162
+ element.isConnected &&
163
+ element.getClientRects().length > 0;
164
+ /**
165
+ * Keeps the closed desktop panel out of the tab order and accessibility tree,
166
+ * and returns focus to the control that opened it. `inert` is toggled here
167
+ * rather than as a prop so focus inside the panel can be read before it is
168
+ * applied: once inert, the browser drops focus to the body. The panel is held
169
+ * in state because its portal mounts it a commit after the shell.
170
+ */
171
+ const useDesktopPanelFocus = (isOpen) => {
172
+ const [panel, setPanel] = useState(null);
173
+ const openerRef = useRef(null);
174
+ useLayoutEffect(() => {
175
+ if (!panel) {
176
+ return;
177
+ }
178
+ if (isOpen) {
179
+ panel.inert = false;
180
+ openerRef.current = document.activeElement;
181
+ return;
182
+ }
183
+ const hadFocus = panel.contains(document.activeElement);
184
+ panel.inert = true;
185
+ if (!hadFocus) {
186
+ return;
187
+ }
188
+ // Wait a frame: the navbar swaps between two Ask AI buttons as the panel
189
+ // releases its space, so the opener may only be visible after layout.
190
+ const frame = requestAnimationFrame(() => {
191
+ const opener = openerRef.current;
192
+ const canRestore = isVisible(opener) &&
193
+ opener !== document.body &&
194
+ !panel.contains(opener);
195
+ const target = canRestore
196
+ ? opener
197
+ : [...document.querySelectorAll("header [data-geistdocs-ask-ai]")].find(isVisible);
198
+ target?.focus();
199
+ });
200
+ return () => cancelAnimationFrame(frame);
201
+ }, [isOpen, panel]);
202
+ return setPanel;
203
+ };
149
204
  export const GeistdocsChatShell = () => {
150
205
  const { chatTitle, enabled, isExpanded, isOpen, setIsOpen } = useGeistdocsChatContext();
151
206
  // The shell mounts only on the client after hydration, so read the
152
207
  // breakpoint now instead of starting as desktop for a frame.
153
208
  const isMobile = useIsMobileAfterHydration();
209
+ const setDesktopPanel = useDesktopPanelFocus(isOpen);
154
210
  if (!enabled) {
155
211
  return null;
156
212
  }
@@ -159,5 +215,5 @@ export const GeistdocsChatShell = () => {
159
215
  // modal surfaces like the search command menu, dialogs, and
160
216
  // dropdowns (z-50), so opening the command menu paints over an
161
217
  // open chat panel.
162
- "fixed inset-y-0 right-0 z-45 hidden h-full flex-col gap-4 border-l bg-background-100 transition-transform min-[768px]:flex", isExpanded ? "w-screen border-l-0" : "w-[400px] max-w-[75vw]", "translate-x-full data-[state=open]:translate-x-0"), "data-state": isOpen ? "open" : "closed", children: _jsx(GeistdocsChatErrorBoundary, { chatTitle: chatTitle, onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { active: !isMobile, expandable: true, focusOnOpen: true, isOpen: isOpen }) }) }) }), _jsx("div", { className: "min-[768px]:hidden", children: _jsxs(Drawer, { className: "flex max-h-none flex-col rounded-none bg-background-100", height: "100dvh", onDismiss: () => setIsOpen(false), repositionInputs: false, show: isMobile && isOpen, children: [_jsx(DrawerTitle, { className: "sr-only", children: chatTitle }), _jsx(GeistdocsChatErrorBoundary, { chatTitle: chatTitle, onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { active: isMobile, focusOnOpen: false, isOpen: isOpen }) })] }) })] }));
218
+ "fixed inset-y-0 right-0 z-45 hidden h-full flex-col gap-4 border-l bg-background-100 transition-transform min-[768px]:flex", isExpanded ? "w-screen border-l-0" : "w-[400px] max-w-[75vw]", "translate-x-full data-[state=open]:translate-x-0"), "data-state": isOpen ? "open" : "closed", ref: setDesktopPanel, children: _jsx(GeistdocsChatErrorBoundary, { chatTitle: chatTitle, onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { active: !isMobile, expandable: true, focusOnOpen: true, isOpen: isOpen }) }) }) }), _jsx("div", { className: "min-[768px]:hidden", children: _jsxs(Drawer, { className: "flex max-h-none flex-col rounded-none bg-background-100", height: "100dvh", onDismiss: () => setIsOpen(false), repositionInputs: false, show: isMobile && isOpen, children: [_jsx(DrawerTitle, { className: "sr-only", children: chatTitle }), _jsx(GeistdocsChatErrorBoundary, { chatTitle: chatTitle, onClose: () => setIsOpen(false), children: _jsx(GeistdocsChatInner, { active: isMobile, focusOnOpen: false, isOpen: isOpen }) })] }) })] }));
163
219
  };
@@ -1 +1 @@
1
- {"version":3,"file":"desktop-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/desktop-menu.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAYtB,UAAU,gBAAgB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAiBD,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,wBAAwB,EAAE,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,oBAAoB,GAC7B,eAAe,EAAE,CAYnB;AA8DD,eAAO,MAAM,WAAW,GAAI,sBAAsB,gBAAgB,4CAuEjE,CAAC"}
1
+ {"version":3,"file":"desktop-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/desktop-menu.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAatB,UAAU,gBAAgB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAiBD,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,wBAAwB,EAAE,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,oBAAoB,GAC7B,eAAe,EAAE,CAYnB;AA+DD,eAAO,MAAM,WAAW,GAAI,sBAAsB,gBAAgB,4CAuEjE,CAAC"}
@@ -8,6 +8,7 @@ import { LocalizedLink } from "../localized-link";
8
8
  import { NavigationMenu, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, } from "../ui/navigation-menu";
9
9
  import { NAVBAR_PANEL_CLASSNAME, PanelLink } from "./navbar-logo";
10
10
  import { useNavActive } from "./use-nav-active";
11
+ import { useServerPanelMount } from "./use-server-panel-mount";
11
12
  /**
12
13
  * Shared styling for top-level nav triggers and links: full-height hit target
13
14
  * with a floating focus ring. The first item gets extra left padding to keep
@@ -44,7 +45,8 @@ const DropdownNavItem = ({ first, item, navItems, }) => {
44
45
  const isActive = useNavActive(navItems);
45
46
  const hasActiveChild = item.items.some((child) => !isExternal(child) && isActive(child.href));
46
47
  const sections = groupDropdownItems(item);
47
- return (_jsxs(NavigationMenuItem, { className: "flex", children: [_jsx(NavigationMenuTrigger, { className: topLevelItemClassName(first), "data-active": hasActiveChild ? "" : undefined, children: item.label }), _jsx(NavigationMenuPrimitive.Content, { className: NAVBAR_PANEL_CLASSNAME, forceMount: true, children: _jsx("div", { className: "mx-auto w-full max-w-[1448px] px-2", children: _jsx("div", { className: "flex flex-nowrap gap-x-10 pt-4 pb-6 pl-4", children: sections.map((section) => (_jsxs("div", { className: "min-w-[180px] shrink-0", children: [_jsx("p", { className: "text-gray-900 text-label-14", children: section.heading }), _jsx("ul", { className: "mt-[5px] flex list-none flex-col", children: section.items.map((child) => (_jsx("li", { className: "flex", children: _jsx(PanelLink, { active: !isExternal(child) && isActive(child.href), product: child }) }, child.href))) })] }, section.heading))) }) }) })] }));
48
+ const forceMount = useServerPanelMount();
49
+ return (_jsxs(NavigationMenuItem, { className: "flex", children: [_jsx(NavigationMenuTrigger, { className: topLevelItemClassName(first), "data-active": hasActiveChild ? "" : undefined, children: item.label }), _jsx(NavigationMenuPrimitive.Content, { className: NAVBAR_PANEL_CLASSNAME, forceMount: forceMount, children: _jsx("div", { className: "mx-auto w-full max-w-[1448px] px-2", children: _jsx("div", { className: "flex flex-nowrap gap-x-10 pt-4 pb-6 pl-4", children: sections.map((section) => (_jsxs("div", { className: "min-w-[180px] shrink-0", children: [_jsx("p", { className: "text-gray-900 text-label-14", children: section.heading }), _jsx("ul", { className: "mt-[5px] flex list-none flex-col", children: section.items.map((child) => (_jsx("li", { className: "flex", children: _jsx(PanelLink, { active: !isExternal(child) && isActive(child.href), product: child }) }, child.href))) })] }, section.heading))) }) }) })] }));
48
50
  };
49
51
  export const DesktopMenu = ({ items, className }) => {
50
52
  const isActive = useNavActive(items);
@@ -1 +1 @@
1
- {"version":3,"file":"mobile-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/mobile-menu.tsx"],"names":[],"mappings":"AAQA,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;AA+YD,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,4CAEhD,CAAC"}
1
+ {"version":3,"file":"mobile-menu.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/mobile-menu.tsx"],"names":[],"mappings":"AAQA,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;AAobD,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,4CAEhD,CAAC"}
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { usePathname } from "next/navigation";
4
4
  import { useMediaQuery } from "phase/react";
5
- import { useEffect, useState } from "react";
5
+ import { useEffect, useId, useRef, useState } from "react";
6
6
  import { IconChevronDownSmall } from "#geistdocs-assets/icons";
7
7
  import { ThemeSwitcher } from "#geistdocs-ui/components/theme-switcher";
8
8
  import { cn } from "#geistdocs-ui/utils";
@@ -13,7 +13,7 @@ import { groupDropdownItems } from "./desktop-menu";
13
13
  import { DEFAULT_OSS_SECTION, resolveOssProducts } from "./navbar-logo";
14
14
  import { useNavActive } from "./use-nav-active";
15
15
  function NavLink({ href, external, active, onClick, children, }) {
16
- const className = cn("flex min-h-11 items-center gap-1 rounded-md px-3 font-normal text-2xl text-gray-900 no-underline outline-none transition-colors hover:bg-gray-alpha-100 hover:text-gray-1000", active && "text-gray-1000");
16
+ const className = cn("flex min-h-11 items-center gap-1 rounded-md px-3 font-normal text-2xl text-gray-900 no-underline outline-none transition-colors hover:bg-gray-alpha-100 hover:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)]", active && "text-gray-1000");
17
17
  // Inline span so the arrow baseline-aligns to the label.
18
18
  const content = (_jsxs("span", { children: [children, external ? _jsx(ExternalArrow, {}) : null] }));
19
19
  if (!external) {
@@ -23,7 +23,7 @@ function NavLink({ href, external, active, onClick, children, }) {
23
23
  }
24
24
  /** Secondary sheet link used inside collapsible groups (OSS + nav dropdowns). */
25
25
  function SubNavLink({ active, children, external, href, onClick, }) {
26
- const className = "flex items-center gap-1 rounded-md px-3 py-1.5 font-normal text-gray-1000 text-xl no-underline outline-none transition-colors hover:bg-gray-alpha-100";
26
+ const className = "flex items-center gap-1 rounded-md px-3 py-1.5 font-normal text-gray-1000 text-xl no-underline outline-none transition-colors hover:bg-gray-alpha-100 focus-visible:shadow-[var(--ds-focus-ring)]";
27
27
  if (!external) {
28
28
  return (_jsx(LocalizedLink, { "aria-current": active ? "page" : undefined, className: className, href: href, onClick: onClick, children: children }));
29
29
  }
@@ -42,22 +42,25 @@ function NavDropdownCollapsible({ dropdown, navItems, onLinkClick, }) {
42
42
  const external = item.external ?? item.href.startsWith("http");
43
43
  return (_jsx("li", { children: _jsx(SubNavLink, { active: !external && isActive(item.href), external: external, href: item.href, onClick: onLinkClick, children: _jsxs("span", { children: [item.label, external ? _jsx(ExternalArrow, {}) : null] }) }) }, item.href));
44
44
  });
45
- return (_jsxs("details", { className: "group flex flex-col", name: "geistdocs-mobile-nav", children: [_jsxs("summary", { className: "flex min-h-11 cursor-pointer list-none items-center justify-between rounded-md px-3 font-normal text-2xl text-gray-900 outline-none transition-colors hover:bg-gray-alpha-100 hover:text-gray-1000 [&::-webkit-details-marker]:hidden", children: [_jsx("span", { children: dropdown.label }), _jsx(IconChevronDownSmall, { className: "relative shrink-0 text-gray-700 transition-transform duration-150 group-open:rotate-180", size: 24 })] }), flat ? (_jsx("ul", { className: "flex list-none flex-col py-2", children: renderItems(dropdown.items) })) : (_jsx("div", { className: "flex flex-col gap-6 px-3 py-4", children: sections.map((section) => (_jsxs("div", { className: "flex flex-col", children: [_jsx("p", { className: "mb-2 font-mono text-gray-700 text-xs uppercase tracking-wider", children: section.heading }), _jsx("ul", { className: "-mx-3 flex list-none flex-col", children: renderItems(section.items) })] }, section.heading))) }))] }));
45
+ return (_jsxs("details", { className: "group flex flex-col", name: "geistdocs-mobile-nav", children: [_jsxs("summary", { className: "flex min-h-11 cursor-pointer list-none items-center justify-between rounded-md px-3 font-normal text-2xl text-gray-900 outline-none transition-colors hover:bg-gray-alpha-100 hover:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] [&::-webkit-details-marker]:hidden", children: [_jsx("span", { children: dropdown.label }), _jsx(IconChevronDownSmall, { className: "relative shrink-0 text-gray-700 transition-transform duration-150 group-open:rotate-180", size: 24 })] }), flat ? (_jsx("ul", { className: "flex list-none flex-col py-2", children: renderItems(dropdown.items) })) : (_jsx("div", { className: "flex flex-col gap-6 px-3 py-4", children: sections.map((section) => (_jsxs("div", { className: "flex flex-col", children: [_jsx("p", { className: "mb-2 font-mono text-gray-700 text-xs uppercase tracking-wider", children: section.heading }), _jsx("ul", { className: "-mx-3 flex list-none flex-col", children: renderItems(section.items) })] }, section.heading))) }))] }));
46
46
  }
47
47
  /** Collapsible OSS menu (`<details>`) with uppercase subsection headings. */
48
48
  function OssCollapsible({ sections, onLinkClick, }) {
49
49
  if (sections.length === 0) {
50
50
  return null;
51
51
  }
52
- return (_jsxs("details", { className: "group flex flex-col", name: "geistdocs-mobile-nav", children: [_jsxs("summary", { className: "flex min-h-11 cursor-pointer list-none items-center justify-between rounded-md px-3 font-normal text-2xl text-gray-900 outline-none transition-colors hover:bg-gray-alpha-100 hover:text-gray-1000 [&::-webkit-details-marker]:hidden", children: [_jsxs("span", { children: ["Vercel OSS", _jsx(ExternalArrow, { className: "mt-1" })] }), _jsx(IconChevronDownSmall, { className: "relative shrink-0 text-gray-700 transition-transform duration-150 group-open:rotate-180", size: 24 })] }), _jsx("div", { className: "flex flex-col gap-6 px-3 py-4", children: sections.map((section) => (_jsxs("div", { className: "flex flex-col", children: [_jsx("p", { className: "mb-2 font-mono text-gray-700 text-xs uppercase tracking-wider", children: section.heading }), _jsx("ul", { className: "-mx-3 flex list-none flex-col", children: section.items.map((product) => (_jsx("li", { children: _jsx(SubNavLink, { external: product.external ?? product.href.startsWith("http"), href: product.href, onClick: onLinkClick, children: product.label }) }, product.href))) })] }, section.heading))) })] }));
52
+ return (_jsxs("details", { className: "group flex flex-col", name: "geistdocs-mobile-nav", children: [_jsxs("summary", { className: "flex min-h-11 cursor-pointer list-none items-center justify-between rounded-md px-3 font-normal text-2xl text-gray-900 outline-none transition-colors hover:bg-gray-alpha-100 hover:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] [&::-webkit-details-marker]:hidden", children: [_jsxs("span", { children: ["Vercel OSS", _jsx(ExternalArrow, { className: "mt-1" })] }), _jsx(IconChevronDownSmall, { className: "relative shrink-0 text-gray-700 transition-transform duration-150 group-open:rotate-180", size: 24 })] }), _jsx("div", { className: "flex flex-col gap-6 px-3 py-4", children: sections.map((section) => (_jsxs("div", { className: "flex flex-col", children: [_jsx("p", { className: "mb-2 font-mono text-gray-700 text-xs uppercase tracking-wider", children: section.heading }), _jsx("ul", { className: "-mx-3 flex list-none flex-col", children: section.items.map((product) => (_jsx("li", { children: _jsx(SubNavLink, { external: product.external ?? product.href.startsWith("http"), href: product.href, onClick: onLinkClick, children: product.label }) }, product.href))) })] }, section.heading))) })] }));
53
53
  }
54
- function MobileMenuButton({ expanded, onClick, }) {
55
- return (_jsx("button", { "aria-expanded": expanded, "aria-label": expanded ? "Close menu" : "Open menu", className: "relative flex @min-[1024px]:hidden size-8 items-center justify-center rounded-full border border-gray-200 transition-colors hover:bg-gray-100", "data-slot": "mobile-menu-toggle", onClick: onClick, type: "button", children: _jsxs("span", { className: "flex flex-col items-center justify-center gap-[5px]", children: [_jsx("span", { className: cn("block h-[1.5px] w-3.5 bg-gray-1000 transition-transform duration-150", expanded && "translate-y-[3.25px] rotate-45") }), _jsx("span", { className: cn("block h-[1.5px] w-3.5 bg-gray-1000 transition-transform duration-150", expanded && "-translate-y-[3.25px] -rotate-45") })] }) }));
54
+ function MobileMenuButton({ controls, expanded, onClick, ref, }) {
55
+ return (_jsx("button", { "aria-controls": controls, "aria-expanded": expanded, "aria-label": expanded ? "Close menu" : "Open menu", className: "relative flex @min-[1024px]:hidden size-8 items-center justify-center rounded-full border border-gray-200 transition-colors hover:bg-gray-100", "data-slot": "mobile-menu-toggle", onClick: onClick, ref: ref, type: "button", children: _jsxs("span", { className: "flex flex-col items-center justify-center gap-[5px]", children: [_jsx("span", { className: cn("block h-[1.5px] w-3.5 bg-gray-1000 transition-transform duration-150", expanded && "translate-y-[3.25px] rotate-45") }), _jsx("span", { className: cn("block h-[1.5px] w-3.5 bg-gray-1000 transition-transform duration-150", expanded && "-translate-y-[3.25px] -rotate-45") })] }) }));
56
56
  }
57
57
  const MobileMenuState = ({ activeProduct, githubUrl, nav, ossProducts, showOss = false, }) => {
58
58
  const isDesktop = useMediaQuery("(min-width: 1024px)");
59
59
  const [show, setShow] = useState(false);
60
60
  const isActive = useNavActive(nav);
61
+ const panelId = useId();
62
+ const toggleRef = useRef(null);
63
+ const panelRef = useRef(null);
61
64
  // Resolve the default/custom list and drop the active product here on the
62
65
  // client, where `DEFAULT_OSS_PRODUCTS` is a real array (see resolveOssProducts).
63
66
  const products = showOss
@@ -92,6 +95,11 @@ const MobileMenuState = ({ activeProduct, githubUrl, nav, ossProducts, showOss =
92
95
  const handleEscape = (e) => {
93
96
  if (e.key === "Escape" && show) {
94
97
  setShow(false);
98
+ // The closed panel is inert, so return focus to the toggle instead of
99
+ // leaving it on an element that just disappeared.
100
+ if (panelRef.current?.contains(document.activeElement)) {
101
+ toggleRef.current?.focus();
102
+ }
95
103
  }
96
104
  };
97
105
  document.addEventListener("keydown", handleEscape);
@@ -120,8 +128,19 @@ const MobileMenuState = ({ activeProduct, githubUrl, nav, ossProducts, showOss =
120
128
  };
121
129
  }, [show]);
122
130
  const close = () => setShow(false);
123
- return (_jsxs(_Fragment, { children: [_jsx(MobileMenuButton, { expanded: show, onClick: () => setShow(!show) }), _jsx("div", { className: cn("fixed inset-0 top-16 z-40 @min-[1024px]:hidden bg-background-200", show
131
+ // The open panel covers the page below the navbar, so focus that leaves it
132
+ // for page content (Tab past the last control) wraps to the toggle instead.
133
+ // Moving back into the navbar, which stays visible, is left alone.
134
+ const keepFocusInMenu = (event) => {
135
+ const next = event.relatedTarget;
136
+ const navbar = event.currentTarget.closest("header");
137
+ if (!(next instanceof Node) || navbar?.contains(next)) {
138
+ return;
139
+ }
140
+ toggleRef.current?.focus();
141
+ };
142
+ return (_jsxs(_Fragment, { children: [_jsx(MobileMenuButton, { controls: panelId, expanded: show, onClick: () => setShow(!show), ref: toggleRef }), _jsx("div", { className: cn("fixed inset-0 top-16 z-40 @min-[1024px]:hidden bg-background-200", show
124
143
  ? "pointer-events-auto opacity-100"
125
- : "pointer-events-none opacity-0"), onClick: close }), _jsxs("div", { className: cn("fixed inset-x-0 top-16 bottom-0 z-40 @min-[1024px]:hidden overflow-y-auto bg-background-200 px-2", show ? "opacity-100" : "pointer-events-none opacity-0"), children: [_jsx("div", { className: "p-4", children: _jsx(SearchButton, { className: "w-full py-4.5", onClick: close }) }), _jsxs("nav", { className: "flex flex-col px-1", children: [nav.map((item) => "items" in item ? (_jsx(NavDropdownCollapsible, { dropdown: item, navItems: nav, onLinkClick: close }, item.label)) : (_jsx(NavLink, { active: isActive(item.href), external: item.href.startsWith("http"), href: item.href, onClick: close, children: item.label }, item.href))), githubUrl ? (_jsx(NavLink, { external: true, href: githubUrl, onClick: close, children: "GitHub" })) : null, _jsx(OssCollapsible, { onLinkClick: close, sections: ossSections })] }), _jsx("div", { className: "mt-2 flex justify-end px-4 py-4", children: _jsx(ThemeSwitcher, { small: true }) })] })] }));
144
+ : "pointer-events-none opacity-0"), onClick: close }), _jsxs("div", { className: cn("fixed inset-x-0 top-16 bottom-0 z-40 @min-[1024px]:hidden overflow-y-auto bg-background-200 px-2", show ? "opacity-100" : "pointer-events-none invisible opacity-0"), id: panelId, inert: !show, onBlur: keepFocusInMenu, ref: panelRef, children: [_jsx("div", { className: "p-4", children: _jsx(SearchButton, { className: "w-full py-4.5", onClick: close }) }), _jsxs("nav", { className: "flex flex-col px-1", children: [nav.map((item) => "items" in item ? (_jsx(NavDropdownCollapsible, { dropdown: item, navItems: nav, onLinkClick: close }, item.label)) : (_jsx(NavLink, { active: isActive(item.href), external: item.href.startsWith("http"), href: item.href, onClick: close, children: item.label }, item.href))), githubUrl ? (_jsx(NavLink, { external: true, href: githubUrl, onClick: close, children: "GitHub" })) : null, _jsx(OssCollapsible, { onLinkClick: close, sections: ossSections })] }), _jsx("div", { className: "mt-2 flex justify-end px-4 py-4", children: _jsx(ThemeSwitcher, { small: true }) })] })] }));
126
145
  };
127
146
  export const MobileMenu = (props) => (_jsx(MobileMenuState, { ...props }, usePathname()));
@@ -3,8 +3,9 @@ import type { GeistdocsNavbarBrand, GeistdocsNavbarOssProduct } from "../../conf
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 used by navbar dropdowns. Rendered with
7
- * forceMount + hidden-when-closed so links stay in the server HTML.
6
+ * Full-bleed panel below the header used by navbar dropdowns. Hidden when
7
+ * closed, and force-mounted in the server HTML so links stay crawlable (see
8
+ * useServerPanelMount).
8
9
  */
9
10
  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";
10
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"navbar-logo.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/navbar-logo.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAWtB,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,EAuF3D,CAAC;AAqBF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,gNAC4K,CAAC;AAIhN;;;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;AAwCD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,yBAAyB,EAAE,GAAG,SAAS,EACjD,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,yBAAyB,EAAE,CAI7B;AAED,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,CACA;IACE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1C,OAAO,EAAE,KAAK,CAAC;CAChB,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB,CACJ,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,IAAU,EACV,GAAG,KAAK,EACT,EAAE,eAAe,2CA0MjB"}
1
+ {"version":3,"file":"navbar-logo.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/navbar-logo.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAYtB,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,EAuF3D,CAAC;AAqBF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,gNAC4K,CAAC;AAIhN;;;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;AAwCD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,yBAAyB,EAAE,GAAG,SAAS,EACjD,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,yBAAyB,EAAE,CAI7B;AAED,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,CACA;IACE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1C,OAAO,EAAE,KAAK,CAAC;CAChB,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB,CACJ,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,IAAU,EACV,GAAG,KAAK,EACT,EAAE,eAAe,2CA2MjB"}
@@ -10,6 +10,7 @@ import { cn } from "#geistdocs-ui/utils";
10
10
  import { LocalizedLink, useLocalizedHref } from "../localized-link";
11
11
  import { NavigationMenu, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, } from "../ui/navigation-menu";
12
12
  import { NavbarBrand } from "./navbar-brand";
13
+ import { useServerPanelMount } from "./use-server-panel-mount";
13
14
  export const DEFAULT_OSS_SECTION = "Open Source";
14
15
  export const DEFAULT_OSS_PRODUCTS = [
15
16
  {
@@ -114,8 +115,9 @@ function groupOssProducts(products) {
114
115
  return sections;
115
116
  }
116
117
  /**
117
- * Full-bleed panel below the header used by navbar dropdowns. Rendered with
118
- * forceMount + hidden-when-closed so links stay in the server HTML.
118
+ * Full-bleed panel below the header used by navbar dropdowns. Hidden when
119
+ * closed, and force-mounted in the server HTML so links stay crawlable (see
120
+ * useServerPanelMount).
119
121
  */
120
122
  export 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";
121
123
  const POINTER_LEAVE_GRACE_MS = 200;
@@ -151,6 +153,7 @@ export function NavbarLogo({ brand, className, href = "/", ...props }) {
151
153
  const featuredProducts = ossProducts.filter((product) => product.featured);
152
154
  const ossSections = groupOssProducts(ossProducts.filter((product) => !product.featured));
153
155
  const [navValue, setNavValue] = useState("");
156
+ const forceMount = useServerPanelMount();
154
157
  const logoHoveredRef = useRef(false);
155
158
  const suppressLogoHoverRef = useRef(false);
156
159
  const pointerLeaveTimeoutRef = useRef(undefined);
@@ -210,7 +213,7 @@ export function NavbarLogo({ brand, className, href = "/", ...props }) {
210
213
  event.key === "ArrowUp") {
211
214
  suppressLogoHoverRef.current = false;
212
215
  }
213
- } }), _jsx(NavigationMenuPrimitive.Content, { className: NAVBAR_PANEL_CLASSNAME, forceMount: true, onClickCapture: () => {
216
+ } }), _jsx(NavigationMenuPrimitive.Content, { className: NAVBAR_PANEL_CLASSNAME, forceMount: forceMount, onClickCapture: () => {
214
217
  cancelPointerLeave();
215
218
  logoHoveredRef.current = false;
216
219
  }, onEscapeKeyDown: () => {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `forceMount` for navbar dropdown panels: `true` during server rendering and
3
+ * hydration, so crawlers see the panel links in the HTML, then `undefined` so
4
+ * a closed panel unmounts. A mounted Radix panel, even hidden, stays the
5
+ * topmost dismissable layer and marks every Escape on the page handled,
6
+ * which stops other surfaces, like the Ask AI panel, from closing on Escape.
7
+ */
8
+ export declare const useServerPanelMount: () => true | undefined;
9
+ //# sourceMappingURL=use-server-panel-mount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-server-panel-mount.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/use-server-panel-mount.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,QAAO,IAAI,GAAG,SAK3C,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { useSyncExternalStore } from "react";
3
+ const subscribe = () => () => undefined;
4
+ /**
5
+ * `forceMount` for navbar dropdown panels: `true` during server rendering and
6
+ * hydration, so crawlers see the panel links in the HTML, then `undefined` so
7
+ * a closed panel unmounts. A mounted Radix panel, even hidden, stays the
8
+ * topmost dismissable layer and marks every Escape on the page handled,
9
+ * which stops other surfaces, like the Ask AI panel, from closing on Escape.
10
+ */
11
+ export const useServerPanelMount = () => useSyncExternalStore(subscribe, () => undefined, () => true);
@@ -1 +1 @@
1
- {"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAMjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAUtD,KAAK,kBAAkB,GAAG,WAAW,CACnC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC9C,CAAC;AAEF,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,QAAQ,CAAC;IAC3D,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;QAC7C,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;KACjE,CAAC;CACH;AAqGD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAQ9D,CAAC"}
1
+ {"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAMjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAUtD,KAAK,kBAAkB,GAAG,WAAW,CACnC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC9C,CAAC;AAEF,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,QAAQ,CAAC;IAC3D,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;QAC7C,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;KACjE,CAAC;CACH;AAmHD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAQ9D,CAAC"}
@@ -22,18 +22,26 @@ const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props
22
22
  if (!enabled) {
23
23
  return;
24
24
  }
25
- const handleKeyDown = (event) => {
26
- if (event.key === "Escape" && isOpen) {
27
- event.preventDefault();
28
- // The first Escape returns an expanded desktop panel to the sidebar.
29
- if (isExpanded && !isMobile) {
30
- setIsExpanded(false);
31
- }
32
- else {
33
- setIsOpen(false);
34
- }
25
+ // Escape listens in the bubble phase and skips handled events, so a
26
+ // dialog, menu, or tooltip layered over the page closes first. Radix
27
+ // layers dismiss in the capture phase and mark the event handled.
28
+ const handleEscape = (event) => {
29
+ if (event.key !== "Escape" ||
30
+ !isOpen ||
31
+ event.defaultPrevented ||
32
+ event.isComposing) {
35
33
  return;
36
34
  }
35
+ event.preventDefault();
36
+ // The first Escape returns an expanded desktop panel to the sidebar.
37
+ if (isExpanded && !isMobile) {
38
+ setIsExpanded(false);
39
+ }
40
+ else {
41
+ setIsOpen(false);
42
+ }
43
+ };
44
+ const handleShortcut = (event) => {
37
45
  if ((event.metaKey || event.ctrlKey) &&
38
46
  !event.altKey &&
39
47
  !event.shiftKey &&
@@ -42,8 +50,12 @@ const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props
42
50
  setIsOpen((open) => !open);
43
51
  }
44
52
  };
45
- document.addEventListener("keydown", handleKeyDown, true);
46
- return () => document.removeEventListener("keydown", handleKeyDown, true);
53
+ document.addEventListener("keydown", handleEscape);
54
+ document.addEventListener("keydown", handleShortcut, true);
55
+ return () => {
56
+ document.removeEventListener("keydown", handleEscape);
57
+ document.removeEventListener("keydown", handleShortcut, true);
58
+ };
47
59
  }, [enabled, isExpanded, isMobile, isOpen, setIsExpanded, setIsOpen]);
48
60
  // fumadocs spreads the provider's `search.options` onto the dialog, which is
49
61
  // how a consumer reaches `tag`. Typed here so it survives the hand-off.
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/internal/search.tsx"],"names":[],"mappings":"AAIA,OAAO,EAWL,KAAK,WAAW,EAGjB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAI3D,eAAO,MAAM,qBAAqB,GAAI,4DAOnC,WAAW,GAAG;IACf;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAChD;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;CAClB,4CAuEA,CAAC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/internal/search.tsx"],"names":[],"mappings":"AAIA,OAAO,EAWL,KAAK,WAAW,EAIjB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AA+C3D,eAAO,MAAM,qBAAqB,GAAI,4DAOnC,WAAW,GAAG;IACf;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAChD;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;CAClB,4CAqGA,CAAC"}
@@ -2,12 +2,33 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useDocsSearch } from "fumadocs-core/search/client";
4
4
  import { useOnChange } from "fumadocs-core/utils/use-on-change";
5
- import { SearchDialog as FumadocsSearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogListItem, SearchDialogOverlay, TagsList, TagsListItem, } from "fumadocs-ui/components/dialog/search";
5
+ import { SearchDialog as FumadocsSearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogListItem, SearchDialogOverlay, TagsList, TagsListItem, useSearchList, } from "fumadocs-ui/components/dialog/search";
6
6
  import { useI18n } from "fumadocs-ui/contexts/i18n";
7
- import { useState } from "react";
7
+ import { useEffect, useId, useState } from "react";
8
8
  import { getPublicPath } from "../config";
9
+ const WHITESPACE_PATTERN = /\s/g;
10
+ const getOptionId = (listId, itemId) => `${listId}-${itemId.replaceAll(WHITESPACE_PATTERN, "-")}`;
11
+ /**
12
+ * A result rendered as a real component, since fumadocs calls `Item` as a
13
+ * plain function. It reports the arrow-key selection to the input's
14
+ * `aria-activedescendant`, and follows Tab focus so Enter opens the result
15
+ * the reader focused rather than the arrow-key selection.
16
+ */
17
+ const SearchResult = ({ item, listId, onActiveChange, ...props }) => {
18
+ const { active, setActive } = useSearchList();
19
+ const id = getOptionId(listId, item.id);
20
+ const isActive = active === item.id;
21
+ useEffect(() => {
22
+ if (isActive) {
23
+ onActiveChange(id);
24
+ }
25
+ }, [id, isActive, onActiveChange]);
26
+ return (_jsx(SearchDialogListItem, { ...props, id: id, item: item, onFocus: () => setActive(item.id), role: "option" }));
27
+ };
9
28
  export const GeistdocsSearchDialog = ({ allowClear = false, basePath, onTagChange, tag, tags, ...props }) => {
10
- const { locale } = useI18n();
29
+ const { locale, text } = useI18n();
30
+ const listId = useId();
31
+ const [activeOptionId, setActiveOptionId] = useState();
11
32
  const hasTags = tags !== undefined && tags.length > 0;
12
33
  // Holds whatever scope is in force, which is not always a pill: an array scope
13
34
  // has no single pill to select, and it stays in force until a reader picks
@@ -24,7 +45,18 @@ export const GeistdocsSearchDialog = ({ allowClear = false, basePath, onTagChang
24
45
  tag: hasTags ? selected : tag,
25
46
  api: getPublicPath("/api/search", basePath),
26
47
  });
27
- return (_jsxs(FumadocsSearchDialog, { isLoading: query.isLoading, onSearchChange: setSearch, search: search, ...props, children: [_jsx(SearchDialogOverlay, { className: "bg-background-100/80 backdrop-blur-none" }), _jsxs(SearchDialogContent, { className: "w-[640px] max-w-[calc(100vw-1rem)] border-none shadow-[var(--ds-shadow-modal)]", "data-geistdocs-command-modal": true, onEscapeKeyDown: () => props.onOpenChange(false), children: [_jsxs(SearchDialogHeader, { children: [_jsx(SearchDialogIcon, {}), _jsx(SearchDialogInput, {}), _jsx(SearchDialogClose, {})] }), _jsx(SearchDialogList, { "aria-label": "Search results", Item: (itemProps) => (_jsx(SearchDialogListItem, { ...itemProps, role: "option" })), items: query.data === "empty" ? null : query.data, role: "listbox" }), hasTags ? (_jsx(SearchDialogFooter, { children: _jsx(TagsList, { allowClear: allowClear, onTagChange: (value) => {
48
+ const results = Array.isArray(query.data) ? query.data : null;
49
+ const hasResults = results !== null && results.length > 0;
50
+ let resultStatus = "";
51
+ if (results && !query.isLoading) {
52
+ resultStatus = hasResults
53
+ ? `${results.length} ${results.length === 1 ? "result" : "results"}`
54
+ : text.searchNoResult;
55
+ }
56
+ return (_jsxs(FumadocsSearchDialog, { isLoading: query.isLoading, onSearchChange: setSearch, search: search, ...props, children: [_jsx(SearchDialogOverlay, { className: "bg-background-100/80 backdrop-blur-none" }), _jsxs(SearchDialogContent, { className: "w-[640px] max-w-[calc(100vw-1rem)] border-none shadow-[var(--ds-shadow-modal)]", "data-geistdocs-command-modal": true, onEscapeKeyDown: () => props.onOpenChange(false), children: [_jsxs(SearchDialogHeader, { children: [_jsx(SearchDialogIcon, {}), _jsx(SearchDialogInput, { "aria-activedescendant": hasResults ? activeOptionId : undefined, "aria-autocomplete": "list", "aria-controls": listId, "aria-expanded": hasResults, "aria-label": text.search, role: "combobox" }), _jsx(SearchDialogClose, {}), _jsx("p", { "aria-live": "polite", className: "sr-only", role: "status", children: resultStatus })] }), _jsx(SearchDialogList, { "aria-label": hasResults ? "Search results" : undefined, Item: (itemProps) => (_jsx(SearchResult, { ...itemProps, listId: listId, onActiveChange: setActiveOptionId })), id: listId, items: query.data === "empty" ? null : query.data,
57
+ // Only a listbox while it holds options: the empty state is a
58
+ // message, announced through the status region instead.
59
+ role: hasResults ? "listbox" : undefined }), hasTags ? (_jsx(SearchDialogFooter, { children: _jsx(TagsList, { allowClear: allowClear, onTagChange: (value) => {
28
60
  setSelected(value);
29
61
  onTagChange?.(value);
30
62
  }, tag: typeof selected === "string" ? selected : undefined, children: tags.map((item) => (_jsx(TagsListItem, { value: item.value, children: item.name }, item.value))) }) })) : null] })] }));
@@ -76,6 +76,12 @@ export declare const geistdocsMetaSchema: z.ZodObject<{
76
76
  defaultOpen: z.ZodOptional<z.ZodBoolean>;
77
77
  icon: z.ZodOptional<z.ZodString>;
78
78
  }, z.core.$strip>;
79
+ /**
80
+ * Adds Geistdocs rehype plugins after the consumer's. An array is handed to
81
+ * Fumadocs, which places it among its defaults; a function receives those
82
+ * defaults and returns the final list.
83
+ */
84
+ export declare const resolveGeistdocsRehypePlugins: (consumerPlugins: DefaultMDXOptions["rehypePlugins"]) => NonNullable<DefaultMDXOptions["rehypePlugins"]>;
79
85
  export declare const defineGeistdocsSourceConfig: (config?: GeistdocsSourceConfigOptions) => import("fumadocs-mdx/config").GlobalConfig;
80
86
  export {};
81
87
  //# sourceMappingURL=source-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,iBAAiB,EACtB,YAAY,IAAI,oBAAoB,EAGrC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,KAAK,mBAAmB,GAAG,WAAW,CACpC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAC3C,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;CAC1C;AAQD;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,SAAS,EAAE,EACrB,kBAAiB,SAAS,EAAO,KAChC,SAAS,EAgBX,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAsG3B,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCrC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;iBAAa,CAAC;AAE9C,eAAO,MAAM,2BAA2B,GACtC,SAAQ,4BAAiC,+CAwB1C,CAAC"}
1
+ {"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,iBAAiB,EACtB,YAAY,IAAI,oBAAoB,EAGrC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,KAAK,mBAAmB,GAAG,WAAW,CACpC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAC3C,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;CAC1C;AAQD;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,SAAS,EAAE,EACrB,kBAAiB,SAAS,EAAO,KAChC,SAAS,EAgBX,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAsG3B,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCrC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;iBAAa,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GACxC,iBAAiB,iBAAiB,CAAC,eAAe,CAAC,KAClD,WAAW,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAKhD,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,SAAQ,4BAAiC,+CA2B1C,CAAC"}
@@ -2,6 +2,7 @@ import { remarkHeading, remarkMdxMermaid, remarkSteps, remarkStructure, } from "
2
2
  import { defineConfig as defineFumadocsConfig, frontmatterSchema, metaSchema, } from "fumadocs-mdx/config";
3
3
  import lastModified from "fumadocs-mdx/plugins/last-modified";
4
4
  import { z } from "zod";
5
+ import { rehypeTaskListLabels } from "../rehype-task-list-labels.js";
5
6
  import { remarkDetails } from "../remark-details.js";
6
7
  import { getLastModified } from "./internal/last-modified.js";
7
8
  const pluginOf = (entry) => Array.isArray(entry) ? entry[0] : entry;
@@ -163,6 +164,17 @@ export const geistdocsFrontmatterSchema = frontmatterSchema.extend({
163
164
  .optional(),
164
165
  });
165
166
  export const geistdocsMetaSchema = metaSchema;
167
+ /**
168
+ * Adds Geistdocs rehype plugins after the consumer's. An array is handed to
169
+ * Fumadocs, which places it among its defaults; a function receives those
170
+ * defaults and returns the final list.
171
+ */
172
+ export const resolveGeistdocsRehypePlugins = (consumerPlugins) => {
173
+ if (typeof consumerPlugins === "function") {
174
+ return (defaults) => [...consumerPlugins(defaults), rehypeTaskListLabels];
175
+ }
176
+ return [...(consumerPlugins ?? []), rehypeTaskListLabels];
177
+ };
166
178
  export const defineGeistdocsSourceConfig = (config = {}) => {
167
179
  const existingRemarkPlugins = Array.isArray(config.mdxOptions?.remarkPlugins)
168
180
  ? config.mdxOptions.remarkPlugins
@@ -173,6 +185,7 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
173
185
  mdxOptions: {
174
186
  ...config.mdxOptions,
175
187
  remarkPlugins: (defaults) => resolveGeistdocsRemarkPlugins(defaults, existingRemarkPlugins),
188
+ rehypePlugins: resolveGeistdocsRehypePlugins(config.mdxOptions?.rehypePlugins),
176
189
  rehypeCodeOptions: {
177
190
  ...config.mdxOptions?.rehypeCodeOptions,
178
191
  themes: { light: geistShikiTheme, dark: geistShikiTheme },
package/docs/agents.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Geistdocs Package Docs
2
2
 
3
- These docs are bundled with `@vercel/geistdocs` 2.14.0-canary.fbbc4b6 so agents can understand the installed package without web access.
3
+ These docs are bundled with `@vercel/geistdocs` 2.14.1 so agents can understand the installed package without web access.
4
4
  They are generated from `apps/template/content/docs` during the package build.
5
5
 
6
6
  ## How to use these files
package/docs/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # Geistdocs Package Documentation
2
2
 
3
- These docs are bundled with `@vercel/geistdocs` 2.14.0-canary.fbbc4b6.
3
+ These docs are bundled with `@vercel/geistdocs` 2.14.1.
4
4
  They describe how to build package-backed Geistdocs sites and how to use the package APIs from generated project adapters.
5
5
 
6
6
  ## Documentation Index
@@ -467,5 +467,5 @@
467
467
  }
468
468
  ],
469
469
  "source": "apps/template/content/docs",
470
- "version": "2.14.0-canary.fbbc4b6"
470
+ "version": "2.14.1"
471
471
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vercel/geistdocs",
3
3
  "description": "Runtime and CLI for Geistdocs projects.",
4
- "version": "2.14.0-canary.fbbc4b6",
4
+ "version": "2.14.1",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,6 +27,8 @@
27
27
  "cli.js",
28
28
  "dist",
29
29
  "docs",
30
+ "rehype-task-list-labels.d.ts",
31
+ "rehype-task-list-labels.js",
30
32
  "remark-details.d.ts",
31
33
  "remark-details.js",
32
34
  "source-config.js",
@@ -299,10 +301,6 @@
299
301
  "./theme.css": "./theme.css",
300
302
  "./package.json": "./package.json"
301
303
  },
302
- "scripts": {
303
- "build": "rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
304
- "dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
305
- },
306
304
  "dependencies": {
307
305
  "@ai-sdk/react": "^3.0.134",
308
306
  "@clack/prompts": "^0.11.0",
@@ -366,5 +364,9 @@
366
364
  "react-dom": "^19.2.3",
367
365
  "tsup": "^8.5.1",
368
366
  "typescript": "^5.9.3"
367
+ },
368
+ "scripts": {
369
+ "build": "rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
370
+ "dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
369
371
  }
370
- }
372
+ }
@@ -0,0 +1,9 @@
1
+ interface HastNode {
2
+ children?: HastNode[];
3
+ properties?: Record<string, unknown>;
4
+ tagName?: string;
5
+ type: string;
6
+ value?: string;
7
+ }
8
+
9
+ export declare const rehypeTaskListLabels: () => (tree: HastNode) => void;
@@ -0,0 +1,52 @@
1
+ const NESTED_LIST_TAGS = new Set(["ol", "ul"]);
2
+
3
+ const hasClass = (node, name) => {
4
+ const className = node.properties?.className;
5
+ return Array.isArray(className) && className.includes(name);
6
+ };
7
+
8
+ const isTaskCheckbox = (node) =>
9
+ node.type === "element" &&
10
+ node.tagName === "input" &&
11
+ node.properties?.type === "checkbox";
12
+
13
+ // Text of a task item, without nested lists: their items label themselves.
14
+ const textOf = (node) => {
15
+ if (node.type === "text") {
16
+ return node.value ?? "";
17
+ }
18
+ if (NESTED_LIST_TAGS.has(node.tagName)) {
19
+ return "";
20
+ }
21
+ return (node.children ?? []).map(textOf).join("");
22
+ };
23
+
24
+ const visit = (node, inTaskItem) => {
25
+ const children = node.children ?? [];
26
+ const isTaskItem =
27
+ node.type === "element" &&
28
+ node.tagName === "li" &&
29
+ hasClass(node, "task-list-item");
30
+
31
+ for (const child of children) {
32
+ if (
33
+ (inTaskItem || isTaskItem) &&
34
+ isTaskCheckbox(child) &&
35
+ child.properties.ariaLabel === undefined
36
+ ) {
37
+ const label = children.map(textOf).join("").trim();
38
+ if (label) {
39
+ child.properties.ariaLabel = label;
40
+ }
41
+ }
42
+ // A loose task item wraps its checkbox in the item's first paragraph.
43
+ visit(child, isTaskItem && child.tagName === "p");
44
+ }
45
+ };
46
+
47
+ // Names GFM task-list checkboxes (`- [x] Item`) after their item text.
48
+ // remark-gfm renders a bare `<input type="checkbox" disabled>`, which screen
49
+ // readers announce as an unlabeled checkbox.
50
+ export const rehypeTaskListLabels = () => (tree) => {
51
+ visit(tree, false);
52
+ };
package/source-config.js CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  } from "fumadocs-mdx/config";
16
16
  import lastModified from "fumadocs-mdx/plugins/last-modified";
17
17
  import { z } from "zod";
18
+ import { rehypeTaskListLabels } from "./rehype-task-list-labels.js";
18
19
  import { remarkDetails } from "./remark-details.js";
19
20
 
20
21
  // Mirrors src/internal/last-modified.ts. This file must stay dependency-free
@@ -272,6 +273,16 @@ export const resolveGeistdocsRemarkPlugins = (
272
273
  return list;
273
274
  };
274
275
 
276
+ // Mirrors src/source-config.ts. Geistdocs rehype plugins run after the
277
+ // consumer's: an array is handed to Fumadocs, which places it among its
278
+ // defaults; a function receives those defaults and returns the final list.
279
+ export const resolveGeistdocsRehypePlugins = (consumerPlugins) => {
280
+ if (typeof consumerPlugins === "function") {
281
+ return (defaults) => [...consumerPlugins(defaults), rehypeTaskListLabels];
282
+ }
283
+ return [...(consumerPlugins ?? []), rehypeTaskListLabels];
284
+ };
285
+
275
286
  export const defineGeistdocsSourceConfig = (config = {}) => {
276
287
  const existingRemarkPlugins = Array.isArray(config.mdxOptions?.remarkPlugins)
277
288
  ? config.mdxOptions.remarkPlugins
@@ -284,6 +295,9 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
284
295
  ...config.mdxOptions,
285
296
  remarkPlugins: (defaults) =>
286
297
  resolveGeistdocsRemarkPlugins(defaults, existingRemarkPlugins),
298
+ rehypePlugins: resolveGeistdocsRehypePlugins(
299
+ config.mdxOptions?.rehypePlugins
300
+ ),
287
301
  rehypeCodeOptions: {
288
302
  ...config.mdxOptions?.rehypeCodeOptions,
289
303
  themes: { light: geistShikiTheme, dark: geistShikiTheme },
@@ -17,7 +17,7 @@
17
17
  "@streamdown/code": "^1.0.1",
18
18
  "@vercel/agent-readability": "^0.7.0",
19
19
  "@vercel/analytics": "^1.6.1",
20
- "@vercel/geistdocs": "2.14.0-canary.fbbc4b6",
20
+ "@vercel/geistdocs": "2.14.1",
21
21
  "@vercel/speed-insights": "^1.3.1",
22
22
  "ai": "^6.0.132",
23
23
  "clsx": "^2.1.1",