@vercel/geistdocs 2.7.0 → 2.7.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.
- package/dist/cli/index.js +1 -1
- package/dist/components/toasts.d.ts +10 -0
- package/dist/components/toasts.d.ts.map +1 -0
- package/dist/components/toasts.js +16 -0
- package/dist/providers/public/components/toasts.d.ts +1 -0
- package/dist/providers/public/components/toasts.d.ts.map +1 -1
- package/dist/providers/public/components/toasts.js +21 -1
- package/docs/agents.md +2 -2
- package/docs/llms.txt +78 -34
- package/docs/manifest.json +10 -10
- package/docs/pages/components/code-block.md +37 -1
- package/docs/pages/components/index.md +2 -2
- package/docs/pages/components/toast.md +49 -0
- package/docs/pages/migration.md +1 -1
- package/docs/pages/provider.md +11 -3
- package/docs/sitemap.md +1 -1
- package/package.json +5 -1
- package/template/components/geistdocs/toast-demo.tsx +33 -0
- package/template/content/docs/components/code-block.mdx +37 -1
- package/template/content/docs/components/index.mdx +2 -2
- package/template/content/docs/components/meta.json +1 -1
- package/template/content/docs/components/toast.mdx +45 -0
- package/template/content/docs/migration.mdx +1 -1
- package/template/content/docs/provider.cn.mdx +11 -3
- package/template/content/docs/provider.mdx +11 -3
- package/template/package.json +1 -1
- package/docs/pages/components/code-block-tabs.md +0 -49
- package/template/content/docs/components/code-block-tabs.mdx +0 -45
package/dist/cli/index.js
CHANGED
|
@@ -4,4 +4,4 @@ import{Option as Rn,program as A}from"commander";import{access as Ke,copyFile as
|
|
|
4
4
|
`);throw new AggregateError(i,`Mixedbread search sync did not complete:
|
|
5
5
|
${a}`)}return r},Ft=async({client:e,file:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})=>{let s=t,o=Date.now()+r;for(;s.status==="pending"||s.status==="in_progress";){if(Date.now()>=o)throw new Error(`Mixedbread timed out while indexing file ${t.id}.`);await i(n),s=await e.retrieveStoreFile(t.id)}if(s.status!=="completed")throw new Error(`Mixedbread failed to index file ${t.id} (${s.status}).`);return s},Dt=async({client:e,desired:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})=>{let s=await e.uploadFile({content:t.document.content,filename:`${U(t.document.id).slice(0,32)}.md`}),o;try{o=await e.createStoreFile({externalId:t.externalId,fileId:s,metadata:{...t.metadata,[g.rawFileId]:s}})}catch(a){try{await e.deleteFile(s)}catch(d){throw new AggregateError([a,d],`Mixedbread failed to attach and clean up raw file ${s}.`)}throw a}return Ft({client:e,file:o,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})},Ie=async({client:e,concurrency:t=St,manifest:n,pollIntervalMs:r=_t,pollTimeoutMs:i=Tt,revision:s,revisionAncestors:o=[],revisionTimestamp:a,sleep:d=Rt})=>{let c=_e(n);if(c.provider!=="mixedbread")return{deleted:0,skipped:c.documents.length,uploaded:0};let u=c.siteId?.trim();if(!u)throw new Error("Mixedbread retrieval requires a non-empty siteId in geistdocs.tsx.");if(c.documents.length===0)throw new Error("The Geistdocs search export is empty. Refusing to remove indexed documents.");let l=c.documents.map(p=>At(p,u,s,o,a)),m=new Map(l.map(p=>[p.document.id,p])),h=(await be(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),x=new Map,P=new Set;for(let p of h){W(p.metadata,s,a)&&P.add(p.metadata.documentId);let y=m.get(p.metadata.documentId);y&&p.metadata.contentHash===y.hash&&p.file.status==="completed"&&!x.has(p.metadata.documentId)&&x.set(p.metadata.documentId,p)}let _=l.filter(p=>!(x.has(p.document.id)||P.has(p.document.id)));await Ee(_,t,p=>Dt({client:e,desired:p,pollIntervalMs:r,pollTimeoutMs:i,sleep:d}));let b=(await be(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),D=new Set(b.filter(({metadata:p})=>W(p,s,a)).map(({metadata:p})=>p.documentId)),ie=new Set;for(let p of l){if(D.has(p.document.id))continue;let ae=b.filter(({file:V,metadata:k})=>V.status==="completed"&&k.documentId===p.document.id&&k.contentHash===p.hash).sort((V,k)=>V.file.id.localeCompare(k.file.id))[0];ae&&ie.add(ae.file.id)}let oe=b.filter(({file:p,metadata:y})=>p.status!=="pending"&&p.status!=="in_progress"&&!W(y,s,a)&&Mt({currentRevision:s,currentRevisionAncestors:o,currentRevisionTimestamp:a,desired:m.get(y.documentId),metadata:y})&&!ie.has(p.id));return await Ee(oe,t,async({file:p,metadata:y})=>{await e.deleteFile(y.rawFileId??p.id),await e.deleteStoreFile(p.id)}),{deleted:oe.length,skipped:l.length-_.length,uploaded:_.length}};var Ot=50,$t=e=>`vercel integration add mixedbread --name docs-${e||"your-site-id"} --environment production`,ve=(e,t)=>kt("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),Nt=e=>{let t=process.env.VERCEL_GIT_COMMIT_SHA?.trim(),n=[];try{n=ve(e,["rev-list",`--max-count=${Ot+1}`,t||"HEAD"]).split(`
|
|
6
6
|
`).filter(Boolean)}catch{n=[]}let r=t||n[0],i;for(let s of Array.from(new Set([r,"HEAD"].filter(Boolean))))try{let o=Number(ve(e,["show","-s","--format=%ct",s]));if(Number.isFinite(o)){i=o;break}}catch{}return{revision:r,revisionAncestors:n.filter(s=>s!==r),revisionTimestamp:i}},Pe=async({allowNonProduction:e=!1,dir:t=".next"}={})=>{let n=process.cwd();Ct.loadEnvConfig(n,!1);let r=process.env.MXBAI_API_KEY?.trim(),i=process.env.MXBAI_STORE_ID?.trim();if(process.env.VERCEL_ENV!=="production"&&!e){console.log("Geistdocs search sync skipped: this is not a production Vercel build.");return}if(!!r!=!!i)throw new Error("Mixedbread is partially configured. Set both MXBAI_API_KEY and MXBAI_STORE_ID.");let s;try{s=await Te({cwd:n,outputDirectory:t})}catch(a){if(!(r||i)){console.log("Geistdocs search sync skipped: no Mixedbread credentials or static search export were found.");return}throw a}if(s.provider!=="mixedbread"){console.log("Geistdocs search sync skipped: Ask AI uses local retrieval.");return}if(!(r&&i))throw new Error(["Mixedbread retrieval is enabled, but MXBAI_API_KEY or MXBAI_STORE_ID is missing.","From the root of this site's repository, linked to the correct Vercel project, run:",$t(s.siteId)].join(`
|
|
7
|
-
`));let o=await Ie({client:we({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:i}),manifest:s,...Nt(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as Gt,writeFileSync as Ut}from"fs";import{mkdir as Lt,readFile as Z,writeFile as jt}from"fs/promises";import{dirname as Bt,extname as Vt,relative as Fe,resolve as j}from"path";import{intro as Jt,isCancel as Ht,log as I,multiselect as Xt,outro as L,spinner as Kt}from"@clack/prompts";import{glob as Yt}from"glob";import{Node as F,Project as qt,SyntaxKind as zt}from"ts-morph";var Wt="geistdocs.tsx",Qt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,Ae=()=>({version:1,entries:{}}),Zt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},en=e=>{let t=j(process.cwd(),e);return Gt(t,"utf8")},Me=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],tn=e=>{try{let t=new qt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=en(e),s=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!s)return[];if(F.isObjectLiteralExpression(s))return Me(s);let o=s.getFirstDescendantByKind(zt.ObjectLiteralExpression);return o?Me(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},nn=async()=>{let e=await Xt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ht(e)&&(L("Translation cancelled"),process.exit(0)),e},rn=async e=>(await Yt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),sn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?Ae():{version:1,entries:n.entries}}catch{return Ae()}},Re=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Ut(t,n,"utf8")},on=async e=>{let t=await Promise.all(e.map(async n=>[n,await Zt(n)]));return Object.fromEntries(t)},an=(e,t)=>{let n=Vt(e);return`${e.slice(0,-n.length)}.${t}${n}`},De=(e,t)=>`${Fe(process.cwd(),e)}::${t}`,cn=(e,t,n,r,i=!1)=>{let s=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=an(a,c),l=De(a,c),m=r.entries[l];if(!i&&m?.hash===d){o+=1;continue}s.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:s,skippedCount:o}},dn=async e=>{await Lt(Bt(e),{recursive:!0})},ln=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let s=await r.text();throw new Error(`API request failed (${r.status}): ${s}`)}let i=await r.json();if(!i.translation)throw new Error("API response did not include a translation");return i.translation},pn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),i=await ln(t,r,e.locale);await dn(e.targetFile),await jt(e.targetFile,i,"utf8"),n.entries[De(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},ke=async(e,t)=>{Jt("Translate MDX content");let n=e??Qt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",i=tn(t.config??Wt),s=await rn(n);s.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),L("Translation cancelled"),process.exit(1)),I.info(`Found ${s.length} MDX file(s) matching pattern`),i.length===0&&(i=await nn());let o=j(process.cwd(),ee),a=await sn();await Re(a),I.info(`Using cache: ${o}`);let d=await on(s),{tasks:c,skippedCount:u}=cn(i,s,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),L(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Kt();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await pn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Fe(process.cwd(),x.targetFile)}`)})),await Re(a);m.stop("Translation complete!"),L(`Created/updated ${c.length} file(s)`)};import{access as un,copyFile as gn,mkdir as Ne,rm as re}from"fs/promises";import{dirname as mn,join as v}from"path";import{intro as fn,log as w,outro as B,spinner as Ge}from"@clack/prompts";import{glob as hn}from"glob";var wn=["**/*"],yn=["content/docs/**"],te=".geistdocs-tmp",xn=async(e,t)=>{let n=v(e,t);await re(n,{recursive:!0,force:!0}),await Ne(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),Ce=async(e,t,n)=>(await hn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),bn=async e=>{try{return await un(e),!0}catch{return!1}},En=async(e,t,n)=>{let r=v(t,e),i=v(n,e);return await bn(r)?(await gn(r,i),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Sn=async(e,t)=>{let n=v(t,e);return await re(n,{force:!0}),{success:!0}},Oe=20,$e=async(e,t,n)=>{let r=[];for(let i=0;i<e.length;i+=n){let s=e.slice(i,i+n),o=await Promise.all(s.map(t));r.push(...o)}return r},_n=async(e,t,n,r,i)=>{let s={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>mn(v(r,d))))];i.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>Ne(d,{recursive:!0}))),i.message(`Updating ${e.length} files...`);let a=await $e(e,async d=>{let c=await En(d,n,r);return{file:d,...c}},Oe);for(let{file:d,success:c,error:u}of a)c?s.success.push(d):s.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){i.message(`Deleting ${t.length} files...`);let d=await $e(t,async c=>{try{return await Sn(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Oe);for(let c of d)c.success?s.deleted.push(c.file):s.failed.push({file:c.file,error:c.error})}return s},Tn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},In=e=>e.includes("canary")?"canary":"latest",vn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(S)}`);if(!t.ok)throw new Error(`Failed to resolve ${S}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${S}`);return r},Pn=async e=>{let t=await M(e),n=J(t,S);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=In(n),i=await vn(r);return n===i?{currentVersion:n,nextVersion:i,updateTag:r,updated:!1}:($(t,S,i),await O(e,t),{currentVersion:n,nextVersion:i,updateTag:r,updated:!0})},An=async(e,t,n)=>{let r=await M(e);if(!le(r,S))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:i,nextVersion:s,updateTag:o,updated:a}=await Pn(e);if(!a)return w.success(i?`@vercel/geistdocs is already at ${s} (${o}).`:"No package version update was needed."),B("Package-based site is already up to date."),!0;w.info(`Bumping ${S} from ${i} to ${s} (${o})`);let d=Ge();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),B("Please review and test the upgraded package version."),!0},Mn=async(e,t,n,r,i)=>{let s=v(e,te),o=Ge(),a=i?.sync?s:t;o.start("Preparing template snapshot..."),i?.sync&&(await xn(e,te),await N(s)),o.message("Scanning for files...");let d=await Ce(n,r,a),c=[];if(i?.sync){o.message("Comparing with local files...");let l=await Ce(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),i?.sync&&await ne(s),B("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),i?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await _n(d,c,a,e,o);i?.sync&&(o.message("Cleaning up..."),await ne(s)),o.stop("Update complete!"),Tn(u),B("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),i=e&&e.length>0?e:wn,s=e&&e.length>0?[]:yn;try{if(fn("Let's update your Geistdocs project!"),await An(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await Mn(n,r,i,s,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(v(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.7.0","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").addOption(new Rn("--brand <brand>","Navbar brand").choices(["vercel","labs"]).default("vercel")).option("--disable-git","Disable git initialization").action(he);A.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(Ue);A.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(ke);var Fn=A.command("search").description("Manage the external search index used by Ask AI");Fn.command("sync").description("Sync the latest static docs export to Mixedbread").option("--dir <path>","Next.js output directory",".next").option("--allow-non-production","Run outside a production Vercel build").action(Pe);await A.parseAsync(process.argv).catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
|
|
7
|
+
`));let o=await Ie({client:we({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:i}),manifest:s,...Nt(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as Gt,writeFileSync as Ut}from"fs";import{mkdir as Lt,readFile as Z,writeFile as jt}from"fs/promises";import{dirname as Bt,extname as Vt,relative as Fe,resolve as j}from"path";import{intro as Jt,isCancel as Ht,log as I,multiselect as Xt,outro as L,spinner as Kt}from"@clack/prompts";import{glob as Yt}from"glob";import{Node as F,Project as qt,SyntaxKind as zt}from"ts-morph";var Wt="geistdocs.tsx",Qt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,Ae=()=>({version:1,entries:{}}),Zt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},en=e=>{let t=j(process.cwd(),e);return Gt(t,"utf8")},Me=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],tn=e=>{try{let t=new qt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=en(e),s=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!s)return[];if(F.isObjectLiteralExpression(s))return Me(s);let o=s.getFirstDescendantByKind(zt.ObjectLiteralExpression);return o?Me(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},nn=async()=>{let e=await Xt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ht(e)&&(L("Translation cancelled"),process.exit(0)),e},rn=async e=>(await Yt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),sn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?Ae():{version:1,entries:n.entries}}catch{return Ae()}},Re=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Ut(t,n,"utf8")},on=async e=>{let t=await Promise.all(e.map(async n=>[n,await Zt(n)]));return Object.fromEntries(t)},an=(e,t)=>{let n=Vt(e);return`${e.slice(0,-n.length)}.${t}${n}`},De=(e,t)=>`${Fe(process.cwd(),e)}::${t}`,cn=(e,t,n,r,i=!1)=>{let s=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=an(a,c),l=De(a,c),m=r.entries[l];if(!i&&m?.hash===d){o+=1;continue}s.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:s,skippedCount:o}},dn=async e=>{await Lt(Bt(e),{recursive:!0})},ln=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let s=await r.text();throw new Error(`API request failed (${r.status}): ${s}`)}let i=await r.json();if(!i.translation)throw new Error("API response did not include a translation");return i.translation},pn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),i=await ln(t,r,e.locale);await dn(e.targetFile),await jt(e.targetFile,i,"utf8"),n.entries[De(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},ke=async(e,t)=>{Jt("Translate MDX content");let n=e??Qt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",i=tn(t.config??Wt),s=await rn(n);s.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),L("Translation cancelled"),process.exit(1)),I.info(`Found ${s.length} MDX file(s) matching pattern`),i.length===0&&(i=await nn());let o=j(process.cwd(),ee),a=await sn();await Re(a),I.info(`Using cache: ${o}`);let d=await on(s),{tasks:c,skippedCount:u}=cn(i,s,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),L(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Kt();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await pn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Fe(process.cwd(),x.targetFile)}`)})),await Re(a);m.stop("Translation complete!"),L(`Created/updated ${c.length} file(s)`)};import{access as un,copyFile as gn,mkdir as Ne,rm as re}from"fs/promises";import{dirname as mn,join as v}from"path";import{intro as fn,log as w,outro as B,spinner as Ge}from"@clack/prompts";import{glob as hn}from"glob";var wn=["**/*"],yn=["content/docs/**"],te=".geistdocs-tmp",xn=async(e,t)=>{let n=v(e,t);await re(n,{recursive:!0,force:!0}),await Ne(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),Ce=async(e,t,n)=>(await hn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),bn=async e=>{try{return await un(e),!0}catch{return!1}},En=async(e,t,n)=>{let r=v(t,e),i=v(n,e);return await bn(r)?(await gn(r,i),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Sn=async(e,t)=>{let n=v(t,e);return await re(n,{force:!0}),{success:!0}},Oe=20,$e=async(e,t,n)=>{let r=[];for(let i=0;i<e.length;i+=n){let s=e.slice(i,i+n),o=await Promise.all(s.map(t));r.push(...o)}return r},_n=async(e,t,n,r,i)=>{let s={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>mn(v(r,d))))];i.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>Ne(d,{recursive:!0}))),i.message(`Updating ${e.length} files...`);let a=await $e(e,async d=>{let c=await En(d,n,r);return{file:d,...c}},Oe);for(let{file:d,success:c,error:u}of a)c?s.success.push(d):s.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){i.message(`Deleting ${t.length} files...`);let d=await $e(t,async c=>{try{return await Sn(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Oe);for(let c of d)c.success?s.deleted.push(c.file):s.failed.push({file:c.file,error:c.error})}return s},Tn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},In=e=>e.includes("canary")?"canary":"latest",vn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(S)}`);if(!t.ok)throw new Error(`Failed to resolve ${S}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${S}`);return r},Pn=async e=>{let t=await M(e),n=J(t,S);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=In(n),i=await vn(r);return n===i?{currentVersion:n,nextVersion:i,updateTag:r,updated:!1}:($(t,S,i),await O(e,t),{currentVersion:n,nextVersion:i,updateTag:r,updated:!0})},An=async(e,t,n)=>{let r=await M(e);if(!le(r,S))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:i,nextVersion:s,updateTag:o,updated:a}=await Pn(e);if(!a)return w.success(i?`@vercel/geistdocs is already at ${s} (${o}).`:"No package version update was needed."),B("Package-based site is already up to date."),!0;w.info(`Bumping ${S} from ${i} to ${s} (${o})`);let d=Ge();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),B("Please review and test the upgraded package version."),!0},Mn=async(e,t,n,r,i)=>{let s=v(e,te),o=Ge(),a=i?.sync?s:t;o.start("Preparing template snapshot..."),i?.sync&&(await xn(e,te),await N(s)),o.message("Scanning for files...");let d=await Ce(n,r,a),c=[];if(i?.sync){o.message("Comparing with local files...");let l=await Ce(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),i?.sync&&await ne(s),B("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),i?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await _n(d,c,a,e,o);i?.sync&&(o.message("Cleaning up..."),await ne(s)),o.stop("Update complete!"),Tn(u),B("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),i=e&&e.length>0?e:wn,s=e&&e.length>0?[]:yn;try{if(fn("Let's update your Geistdocs project!"),await An(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await Mn(n,r,i,s,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(v(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.7.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});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ToastMessage {
|
|
2
|
+
text: string;
|
|
3
|
+
}
|
|
4
|
+
export interface StatusToasts {
|
|
5
|
+
error: (message: ToastMessage) => void;
|
|
6
|
+
success: (message: ToastMessage) => void;
|
|
7
|
+
warning: (message: ToastMessage) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useToasts: () => StatusToasts;
|
|
10
|
+
//# sourceMappingURL=toasts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toasts.d.ts","sourceRoot":"","sources":["../../src/components/toasts.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,SAAS,QAAO,YAc5B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useToasts as useProviderToasts } from "#geistdocs-ui/components/toasts";
|
|
3
|
+
export const useToasts = () => {
|
|
4
|
+
const toasts = useProviderToasts();
|
|
5
|
+
return {
|
|
6
|
+
error: ({ text }) => {
|
|
7
|
+
toasts.error({ text });
|
|
8
|
+
},
|
|
9
|
+
success: ({ text }) => {
|
|
10
|
+
toasts.success({ text });
|
|
11
|
+
},
|
|
12
|
+
warning: ({ text }) => {
|
|
13
|
+
toasts.warning({ text });
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -5,6 +5,7 @@ export declare const Toasts: () => import("react/jsx-runtime").JSX.Element;
|
|
|
5
5
|
export declare const useToasts: () => {
|
|
6
6
|
error: ({ text }: ToastMessage) => string | number;
|
|
7
7
|
success: ({ text }: ToastMessage) => string | number;
|
|
8
|
+
warning: ({ text }: ToastMessage) => string | number;
|
|
8
9
|
};
|
|
9
10
|
export {};
|
|
10
11
|
//# sourceMappingURL=toasts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toasts.d.ts","sourceRoot":"","sources":["../../../../src/providers/public/components/toasts.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toasts.d.ts","sourceRoot":"","sources":["../../../../src/providers/public/components/toasts.tsx"],"names":[],"mappings":"AAKA,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAcD,eAAO,MAAM,MAAM,+CAkBlB,CAAC;AAEF,eAAO,MAAM,SAAS;sBACF,YAAY;wBACV,YAAY;wBACZ,YAAY;CAChC,CAAC"}
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Toaster, toast } from "sonner";
|
|
4
|
-
|
|
4
|
+
import { IconCross } from "../../../assets/geistcn/icons/named/icon-cross";
|
|
5
|
+
const toastClassNames = {
|
|
6
|
+
closeButton: "absolute top-1/2 right-3 inline-flex size-8 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-inherit transition-colors duration-150 ease-in-out hover:bg-[var(--ds-gray-alpha-200)] focus-visible:outline-2 focus-visible:outline-current focus-visible:outline-offset-2 [&_svg]:size-4",
|
|
7
|
+
content: "w-full",
|
|
8
|
+
error: "border-0 bg-[var(--ds-red-800)] text-white",
|
|
9
|
+
success: "border-0 bg-[var(--ds-blue-700)] text-white",
|
|
10
|
+
title: "w-full pr-10 font-normal text-pretty [word-break:break-word]",
|
|
11
|
+
toast: "relative flex min-h-[53px] w-[420px] max-w-[min(420px,calc(100vw-48px))] items-center rounded-xl border-0 bg-[var(--ds-background-100)] p-4 text-sm leading-[21px] text-[var(--ds-gray-1000)] shadow-[var(--ds-shadow-border-base),0_1px_1px_rgba(0,0,0,0.02),0_4px_8px_-4px_rgba(0,0,0,0.04),0_16px_24px_-8px_rgba(0,0,0,0.06),var(--ds-shadow-background-border)] max-sm:max-w-[calc(100vw-32px)]",
|
|
12
|
+
warning: "border-0 bg-[var(--ds-amber-800)] text-[var(--ds-gray-1000)]",
|
|
13
|
+
};
|
|
14
|
+
export const Toasts = () => (_jsx(Toaster, { closeButton: true, duration: 3500, icons: {
|
|
15
|
+
close: _jsx(IconCross, {}),
|
|
16
|
+
error: null,
|
|
17
|
+
success: null,
|
|
18
|
+
warning: null,
|
|
19
|
+
}, offset: "var(--geist-gap, 24px)", toastOptions: {
|
|
20
|
+
closeButtonAriaLabel: "Dismiss toast",
|
|
21
|
+
classNames: toastClassNames,
|
|
22
|
+
unstyled: true,
|
|
23
|
+
}, visibleToasts: 3 }));
|
|
5
24
|
export const useToasts = () => ({
|
|
6
25
|
error: ({ text }) => toast.error(text),
|
|
7
26
|
success: ({ text }) => toast.success(text),
|
|
27
|
+
warning: ({ text }) => toast.warning(text),
|
|
8
28
|
});
|
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.7.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.7.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
|
|
@@ -41,7 +41,6 @@ They are generated from `apps/template/content/docs` during the package build.
|
|
|
41
41
|
- [Button](pages/components/button.md): Use the provider-backed Button in application UI or directly in MDX.
|
|
42
42
|
- [Callout](pages/components/callout.md): Use Callout directly or compose its container, title, and description primitives.
|
|
43
43
|
- [Code Block](pages/components/code-block.md): Use CodeBlock when code is highlighted or assembled outside authored Markdown fences.
|
|
44
|
-
- [Code Block Tabs](pages/components/code-block-tabs.md): Compose code-block tab lists, triggers, and panels outside authored MDX.
|
|
45
44
|
- [Collapsible](pages/components/collapsible.md): Compose Collapsible, CollapsibleTrigger, and CollapsibleContent in custom React UI.
|
|
46
45
|
- [Command Prompt](pages/components/command-prompt.md): Compose the CommandPrompt primitives for application-owned install and setup commands.
|
|
47
46
|
- [Components](pages/components/index.md): Browse every component subpath exported by Geistdocs. These components can be imported into application code without relying on the default MDX component map.
|
|
@@ -67,6 +66,7 @@ They are generated from `apps/template/content/docs` during the package build.
|
|
|
67
66
|
- [Table of contents](pages/table-of-contents.md): Geistdocs builds the "On this page" outline from your headings, indents sub-headings under their parent, and tracks the active section along a straight vertical guide rail.
|
|
68
67
|
- [Tabs](pages/components/tabs.md): Use Tabs for navigation-only controls or TabsWithChildren and TabContent for mounted content panels.
|
|
69
68
|
- [Theme Switcher](pages/components/theme-switcher.md): Use ThemeSwitcher in custom navigation, settings, and footer UI.
|
|
69
|
+
- [Toast](pages/components/toast.md): Trigger provider-backed success, warning, and error notifications.
|
|
70
70
|
- [Toggle](pages/components/toggle.md): Toggle is the provider-backed replacement for the former Switch export.
|
|
71
71
|
- [Tooltip](pages/components/tooltip.md): Wrap controls with provider-backed Tooltip content outside MDX.
|
|
72
72
|
- [Video](pages/components/video.md): Use Video for embedded video sources inside React UI or authored MDX.
|
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.7.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.7.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
|
|
@@ -24,7 +24,6 @@ They describe how to build package-backed Geistdocs sites and how to use the pac
|
|
|
24
24
|
- [Button](pages/components/button.md): Use the provider-backed Button in application UI or directly in MDX.
|
|
25
25
|
- [Callout](pages/components/callout.md): Use Callout directly or compose its container, title, and description primitives.
|
|
26
26
|
- [Code Block](pages/components/code-block.md): Use CodeBlock when code is highlighted or assembled outside authored Markdown fences.
|
|
27
|
-
- [Code Block Tabs](pages/components/code-block-tabs.md): Compose code-block tab lists, triggers, and panels outside authored MDX.
|
|
28
27
|
- [Collapsible](pages/components/collapsible.md): Compose Collapsible, CollapsibleTrigger, and CollapsibleContent in custom React UI.
|
|
29
28
|
- [Command Prompt](pages/components/command-prompt.md): Compose the CommandPrompt primitives for application-owned install and setup commands.
|
|
30
29
|
- [Components](pages/components/index.md): Browse every component subpath exported by Geistdocs. These components can be imported into application code without relying on the default MDX component map.
|
|
@@ -50,6 +49,7 @@ They describe how to build package-backed Geistdocs sites and how to use the pac
|
|
|
50
49
|
- [Table of contents](pages/table-of-contents.md): Geistdocs builds the "On this page" outline from your headings, indents sub-headings under their parent, and tracks the active section along a straight vertical guide rail.
|
|
51
50
|
- [Tabs](pages/components/tabs.md): Use Tabs for navigation-only controls or TabsWithChildren and TabContent for mounted content panels.
|
|
52
51
|
- [Theme Switcher](pages/components/theme-switcher.md): Use ThemeSwitcher in custom navigation, settings, and footer UI.
|
|
52
|
+
- [Toast](pages/components/toast.md): Trigger provider-backed success, warning, and error notifications.
|
|
53
53
|
- [Toggle](pages/components/toggle.md): Toggle is the provider-backed replacement for the former Switch export.
|
|
54
54
|
- [Tooltip](pages/components/tooltip.md): Wrap controls with provider-backed Tooltip content outside MDX.
|
|
55
55
|
- [Video](pages/components/video.md): Use Video for embedded video sources inside React UI or authored MDX.
|
|
@@ -598,7 +598,7 @@ Replace imports according to this table:
|
|
|
598
598
|
| `components/badge`, `components/button`, `components/input`, `components/theme-switcher`, or `components/tooltip` | Keep the import package-backed. Geistdocs resolves these template primitives through the selected public or private provider. |
|
|
599
599
|
| `components/dialog`, `components/drawer`, `components/kbd`, `components/separator`, `components/sheet`, `components/spinner`, or `components/textarea` | Import the matching component directly from `@vercel/geistcn/components/<name>` in approved private projects, or keep an application-owned public equivalent. |
|
|
600
600
|
| `components/switch` | Replace `Switch` with package-backed `Toggle` from `components/toggle`, and replace `onCheckedChange` with `onChange`. |
|
|
601
|
-
| `components/sonner` | Use
|
|
601
|
+
| `components/sonner` | Use the package-backed `useToasts` from `components/toasts`. |
|
|
602
602
|
| `components/theme-aware-image` | Use `Image` from `@vercel/geistcn/components/image` with `srcLight` and `srcDark`. |
|
|
603
603
|
| `assets/icons`, `assets/icons/*`, `assets/logos`, or `assets/logos/*` | Keep the import package-backed. Both Geistdocs package variants expose the index and deep asset subpaths. |
|
|
604
604
|
| `components/button-group`, `components/card`, or `components/input-group` | Use an appropriate Geistcn component or keep an application-owned composition. There is no direct Geistcn replacement with the same API. |
|
|
@@ -2444,10 +2444,18 @@ If Ask AI fails while rendering, its panel shows **Try again** and **Close** act
|
|
|
2444
2444
|
The provider includes a global toast notification system. Use it anywhere in your app:
|
|
2445
2445
|
|
|
2446
2446
|
```tsx title="page.tsx"
|
|
2447
|
-
|
|
2447
|
+
"use client";
|
|
2448
|
+
|
|
2449
|
+
import { useToasts } from "@vercel/geistdocs/components/toasts";
|
|
2448
2450
|
|
|
2449
|
-
|
|
2450
|
-
toast
|
|
2451
|
+
export function StatusActions() {
|
|
2452
|
+
const toast = useToasts();
|
|
2453
|
+
|
|
2454
|
+
// Trigger these from your event handlers:
|
|
2455
|
+
toast.success({ text: "Changes saved" });
|
|
2456
|
+
toast.warning({ text: "Review these changes" });
|
|
2457
|
+
toast.error({ text: "Something went wrong" });
|
|
2458
|
+
}
|
|
2451
2459
|
```
|
|
2452
2460
|
|
|
2453
2461
|
## Analytics
|
|
@@ -4071,13 +4079,20 @@ url: /docs/components/code-block
|
|
|
4071
4079
|
source: apps/template/content/docs/components/code-block.mdx
|
|
4072
4080
|
related:
|
|
4073
4081
|
- /docs/components
|
|
4074
|
-
- /docs/components/code-block-tabs
|
|
4075
4082
|
- /docs/syntax
|
|
4076
4083
|
---
|
|
4077
4084
|
|
|
4078
4085
|
# Code Block
|
|
4079
4086
|
|
|
4080
4087
|
import { CodeBlock } from "@vercel/geistdocs/components/code-block";
|
|
4088
|
+
import {
|
|
4089
|
+
CodeBlockTab,
|
|
4090
|
+
CodeBlockTabs,
|
|
4091
|
+
CodeBlockTabsList,
|
|
4092
|
+
CodeBlockTabsTrigger,
|
|
4093
|
+
} from "@vercel/geistdocs/components/code-block-tabs";
|
|
4094
|
+
|
|
4095
|
+
## Code block
|
|
4081
4096
|
|
|
4082
4097
|
<div className="not-prose my-6">
|
|
4083
4098
|
<CodeBlock title="example.ts">{'export const enabled = true;'}</CodeBlock>
|
|
@@ -4089,31 +4104,7 @@ import { CodeBlock } from "@vercel/geistdocs/components/code-block";
|
|
|
4089
4104
|
|
|
4090
4105
|
Pass a `title` to show header chrome with a filename-aware icon and copy control. Markdown code fences use `CodeBlock` automatically through the default MDX map.
|
|
4091
4106
|
|
|
4092
|
-
|
|
4093
|
-
---
|
|
4094
|
-
|
|
4095
|
-
---
|
|
4096
|
-
title: Code Block Tabs
|
|
4097
|
-
description: Group multiple code examples in one tabbed surface
|
|
4098
|
-
type: reference
|
|
4099
|
-
summary: Compose code-block tab lists, triggers, and panels outside authored MDX.
|
|
4100
|
-
url: /docs/components/code-block-tabs
|
|
4101
|
-
source: apps/template/content/docs/components/code-block-tabs.mdx
|
|
4102
|
-
related:
|
|
4103
|
-
- /docs/components
|
|
4104
|
-
- /docs/components/code-block
|
|
4105
|
-
- /docs/syntax
|
|
4106
|
-
---
|
|
4107
|
-
|
|
4108
|
-
# Code Block Tabs
|
|
4109
|
-
|
|
4110
|
-
import { CodeBlock } from "@vercel/geistdocs/components/code-block";
|
|
4111
|
-
import {
|
|
4112
|
-
CodeBlockTab,
|
|
4113
|
-
CodeBlockTabs,
|
|
4114
|
-
CodeBlockTabsList,
|
|
4115
|
-
CodeBlockTabsTrigger,
|
|
4116
|
-
} from "@vercel/geistdocs/components/code-block-tabs";
|
|
4107
|
+
## Code block with tabs
|
|
4117
4108
|
|
|
4118
4109
|
<div className="not-prose my-6">
|
|
4119
4110
|
<CodeBlockTabs defaultValue="pnpm">
|
|
@@ -4279,13 +4270,13 @@ Internal projects using `@vercel/geistdocs-private` use the same component subpa
|
|
|
4279
4270
|
| [Input](/docs/components/input) | `components/input` | Text input fields with provider-backed styling |
|
|
4280
4271
|
| [Toggle](/docs/components/toggle) | `components/toggle` | Controlled boolean controls |
|
|
4281
4272
|
| [Tooltip](/docs/components/tooltip) | `components/tooltip` | Contextual hover and focus labels |
|
|
4273
|
+
| [Toast](/docs/components/toast) | `components/toasts` | Global success, warning, and error notifications |
|
|
4282
4274
|
| [Theme Switcher](/docs/components/theme-switcher) | `components/theme-switcher` | System, light, and dark theme selection |
|
|
4283
4275
|
| [Tabs](/docs/components/tabs) | `components/tabs`, `components/tabs-with-children` | Tab navigation and mounted content panels |
|
|
4284
4276
|
| [Collapsible](/docs/components/collapsible) | `components/collapsible` | Expandable content regions |
|
|
4285
4277
|
| [Details](/docs/components/details) | `components/details` | Styled native disclosure elements |
|
|
4286
4278
|
| [Callout](/docs/components/callout) | `components/callout` | Notices with optional titles and descriptions |
|
|
4287
|
-
| [Code Block](/docs/components/code-block) | `components/code-block` | Highlighted code
|
|
4288
|
-
| [Code Block Tabs](/docs/components/code-block-tabs) | `components/code-block-tabs` | Multiple code examples in one tabbed surface |
|
|
4279
|
+
| [Code Block](/docs/components/code-block) | `components/code-block`, `components/code-block-tabs` | Highlighted code and tabbed code groups |
|
|
4289
4280
|
| [Command Prompt](/docs/components/command-prompt) | `components/command-prompt` | Command surfaces with copy support and alternatives |
|
|
4290
4281
|
| [Copy Prompt](/docs/components/copy-prompt) | `components/copy-prompt` | Copyable prompts for agents and language models |
|
|
4291
4282
|
| [Dropdown Menu](/docs/components/dropdown-menu) | `components/dropdown-menu` | Accessible action menus |
|
|
@@ -5953,6 +5944,59 @@ Use the compact variant where space is limited:
|
|
|
5953
5944
|
```
|
|
5954
5945
|
|
|
5955
5946
|
|
|
5947
|
+
---
|
|
5948
|
+
|
|
5949
|
+
---
|
|
5950
|
+
title: Toast
|
|
5951
|
+
description: Show global status notifications
|
|
5952
|
+
type: reference
|
|
5953
|
+
summary: Trigger provider-backed success, warning, and error notifications.
|
|
5954
|
+
url: /docs/components/toast
|
|
5955
|
+
source: apps/template/content/docs/components/toast.mdx
|
|
5956
|
+
related:
|
|
5957
|
+
- /docs/components
|
|
5958
|
+
- /docs/provider
|
|
5959
|
+
---
|
|
5960
|
+
|
|
5961
|
+
# Toast
|
|
5962
|
+
|
|
5963
|
+
import { ToastDemo } from "@/components/geistdocs/toast-demo";
|
|
5964
|
+
|
|
5965
|
+
Use the buttons to preview every status variant:
|
|
5966
|
+
|
|
5967
|
+
<div className="not-prose my-6 flex min-h-32 items-center justify-center rounded-lg border border-gray-400 bg-background-100 p-6">
|
|
5968
|
+
<ToastDemo />
|
|
5969
|
+
</div>
|
|
5970
|
+
|
|
5971
|
+
```tsx
|
|
5972
|
+
"use client";
|
|
5973
|
+
|
|
5974
|
+
import { useToasts } from "@vercel/geistdocs/components/toasts";
|
|
5975
|
+
|
|
5976
|
+
export function StatusButtons() {
|
|
5977
|
+
const toast = useToasts();
|
|
5978
|
+
|
|
5979
|
+
return (
|
|
5980
|
+
<div>
|
|
5981
|
+
<button onClick={() => toast.success({ text: "Changes saved" })}>
|
|
5982
|
+
Success
|
|
5983
|
+
</button>
|
|
5984
|
+
<button
|
|
5985
|
+
onClick={() => toast.warning({ text: "Review these changes" })}
|
|
5986
|
+
>
|
|
5987
|
+
Warning
|
|
5988
|
+
</button>
|
|
5989
|
+
<button onClick={() => toast.error({ text: "Something went wrong" })}>
|
|
5990
|
+
Error
|
|
5991
|
+
</button>
|
|
5992
|
+
</div>
|
|
5993
|
+
);
|
|
5994
|
+
}
|
|
5995
|
+
```
|
|
5996
|
+
|
|
5997
|
+
`GeistdocsProvider` mounts the global toast area. Use `success`, `warning`, or `error` with a `{ text }` message from any client component below the provider.
|
|
5998
|
+
|
|
5999
|
+
|
|
5956
6000
|
---
|
|
5957
6001
|
|
|
5958
6002
|
---
|
package/docs/manifest.json
CHANGED
|
@@ -179,15 +179,6 @@
|
|
|
179
179
|
"type": "reference",
|
|
180
180
|
"url": "/docs/components/code-block"
|
|
181
181
|
},
|
|
182
|
-
{
|
|
183
|
-
"description": "Group multiple code examples in one tabbed surface",
|
|
184
|
-
"path": "pages/components/code-block-tabs.md",
|
|
185
|
-
"source": "apps/template/content/docs/components/code-block-tabs.mdx",
|
|
186
|
-
"summary": "Compose code-block tab lists, triggers, and panels outside authored MDX.",
|
|
187
|
-
"title": "Code Block Tabs",
|
|
188
|
-
"type": "reference",
|
|
189
|
-
"url": "/docs/components/code-block-tabs"
|
|
190
|
-
},
|
|
191
182
|
{
|
|
192
183
|
"description": "Show and hide expandable content regions",
|
|
193
184
|
"path": "pages/components/collapsible.md",
|
|
@@ -413,6 +404,15 @@
|
|
|
413
404
|
"type": "reference",
|
|
414
405
|
"url": "/docs/components/theme-switcher"
|
|
415
406
|
},
|
|
407
|
+
{
|
|
408
|
+
"description": "Show global status notifications",
|
|
409
|
+
"path": "pages/components/toast.md",
|
|
410
|
+
"source": "apps/template/content/docs/components/toast.mdx",
|
|
411
|
+
"summary": "Trigger provider-backed success, warning, and error notifications.",
|
|
412
|
+
"title": "Toast",
|
|
413
|
+
"type": "reference",
|
|
414
|
+
"url": "/docs/components/toast"
|
|
415
|
+
},
|
|
416
416
|
{
|
|
417
417
|
"description": "Render controlled boolean controls",
|
|
418
418
|
"path": "pages/components/toggle.md",
|
|
@@ -449,5 +449,5 @@
|
|
|
449
449
|
}
|
|
450
450
|
],
|
|
451
451
|
"source": "apps/template/content/docs",
|
|
452
|
-
"version": "2.7.
|
|
452
|
+
"version": "2.7.1"
|
|
453
453
|
}
|
|
@@ -7,13 +7,20 @@ url: /docs/components/code-block
|
|
|
7
7
|
source: apps/template/content/docs/components/code-block.mdx
|
|
8
8
|
related:
|
|
9
9
|
- /docs/components
|
|
10
|
-
- /docs/components/code-block-tabs
|
|
11
10
|
- /docs/syntax
|
|
12
11
|
---
|
|
13
12
|
|
|
14
13
|
# Code Block
|
|
15
14
|
|
|
16
15
|
import { CodeBlock } from "@vercel/geistdocs/components/code-block";
|
|
16
|
+
import {
|
|
17
|
+
CodeBlockTab,
|
|
18
|
+
CodeBlockTabs,
|
|
19
|
+
CodeBlockTabsList,
|
|
20
|
+
CodeBlockTabsTrigger,
|
|
21
|
+
} from "@vercel/geistdocs/components/code-block-tabs";
|
|
22
|
+
|
|
23
|
+
## Code block
|
|
17
24
|
|
|
18
25
|
<div className="not-prose my-6">
|
|
19
26
|
<CodeBlock title="example.ts">{'export const enabled = true;'}</CodeBlock>
|
|
@@ -24,3 +31,32 @@ import { CodeBlock } from "@vercel/geistdocs/components/code-block";
|
|
|
24
31
|
```
|
|
25
32
|
|
|
26
33
|
Pass a `title` to show header chrome with a filename-aware icon and copy control. Markdown code fences use `CodeBlock` automatically through the default MDX map.
|
|
34
|
+
|
|
35
|
+
## Code block with tabs
|
|
36
|
+
|
|
37
|
+
<div className="not-prose my-6">
|
|
38
|
+
<CodeBlockTabs defaultValue="pnpm">
|
|
39
|
+
<CodeBlockTabsList>
|
|
40
|
+
<CodeBlockTabsTrigger value="pnpm">pnpm</CodeBlockTabsTrigger>
|
|
41
|
+
<CodeBlockTabsTrigger value="npm">npm</CodeBlockTabsTrigger>
|
|
42
|
+
</CodeBlockTabsList>
|
|
43
|
+
<CodeBlockTab value="pnpm">
|
|
44
|
+
<CodeBlock title="Terminal">pnpm add @vercel/geistdocs</CodeBlock>
|
|
45
|
+
</CodeBlockTab>
|
|
46
|
+
<CodeBlockTab value="npm">
|
|
47
|
+
<CodeBlock title="Terminal">npm install @vercel/geistdocs</CodeBlock>
|
|
48
|
+
</CodeBlockTab>
|
|
49
|
+
</CodeBlockTabs>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import {
|
|
54
|
+
CodeBlockTab,
|
|
55
|
+
CodeBlockTabs,
|
|
56
|
+
CodeBlockTabsList,
|
|
57
|
+
CodeBlockTabsTrigger,
|
|
58
|
+
CompactCodeBlockTabs,
|
|
59
|
+
} from "@vercel/geistdocs/components/code-block-tabs";
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The same components are available without imports in authored MDX.
|
|
@@ -27,13 +27,13 @@ Internal projects using `@vercel/geistdocs-private` use the same component subpa
|
|
|
27
27
|
| [Input](/docs/components/input) | `components/input` | Text input fields with provider-backed styling |
|
|
28
28
|
| [Toggle](/docs/components/toggle) | `components/toggle` | Controlled boolean controls |
|
|
29
29
|
| [Tooltip](/docs/components/tooltip) | `components/tooltip` | Contextual hover and focus labels |
|
|
30
|
+
| [Toast](/docs/components/toast) | `components/toasts` | Global success, warning, and error notifications |
|
|
30
31
|
| [Theme Switcher](/docs/components/theme-switcher) | `components/theme-switcher` | System, light, and dark theme selection |
|
|
31
32
|
| [Tabs](/docs/components/tabs) | `components/tabs`, `components/tabs-with-children` | Tab navigation and mounted content panels |
|
|
32
33
|
| [Collapsible](/docs/components/collapsible) | `components/collapsible` | Expandable content regions |
|
|
33
34
|
| [Details](/docs/components/details) | `components/details` | Styled native disclosure elements |
|
|
34
35
|
| [Callout](/docs/components/callout) | `components/callout` | Notices with optional titles and descriptions |
|
|
35
|
-
| [Code Block](/docs/components/code-block) | `components/code-block` | Highlighted code
|
|
36
|
-
| [Code Block Tabs](/docs/components/code-block-tabs) | `components/code-block-tabs` | Multiple code examples in one tabbed surface |
|
|
36
|
+
| [Code Block](/docs/components/code-block) | `components/code-block`, `components/code-block-tabs` | Highlighted code and tabbed code groups |
|
|
37
37
|
| [Command Prompt](/docs/components/command-prompt) | `components/command-prompt` | Command surfaces with copy support and alternatives |
|
|
38
38
|
| [Copy Prompt](/docs/components/copy-prompt) | `components/copy-prompt` | Copyable prompts for agents and language models |
|
|
39
39
|
| [Dropdown Menu](/docs/components/dropdown-menu) | `components/dropdown-menu` | Accessible action menus |
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Toast
|
|
3
|
+
description: Show global status notifications
|
|
4
|
+
type: reference
|
|
5
|
+
summary: Trigger provider-backed success, warning, and error notifications.
|
|
6
|
+
url: /docs/components/toast
|
|
7
|
+
source: apps/template/content/docs/components/toast.mdx
|
|
8
|
+
related:
|
|
9
|
+
- /docs/components
|
|
10
|
+
- /docs/provider
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Toast
|
|
14
|
+
|
|
15
|
+
import { ToastDemo } from "@/components/geistdocs/toast-demo";
|
|
16
|
+
|
|
17
|
+
Use the buttons to preview every status variant:
|
|
18
|
+
|
|
19
|
+
<div className="not-prose my-6 flex min-h-32 items-center justify-center rounded-lg border border-gray-400 bg-background-100 p-6">
|
|
20
|
+
<ToastDemo />
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
"use client";
|
|
25
|
+
|
|
26
|
+
import { useToasts } from "@vercel/geistdocs/components/toasts";
|
|
27
|
+
|
|
28
|
+
export function StatusButtons() {
|
|
29
|
+
const toast = useToasts();
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div>
|
|
33
|
+
<button onClick={() => toast.success({ text: "Changes saved" })}>
|
|
34
|
+
Success
|
|
35
|
+
</button>
|
|
36
|
+
<button
|
|
37
|
+
onClick={() => toast.warning({ text: "Review these changes" })}
|
|
38
|
+
>
|
|
39
|
+
Warning
|
|
40
|
+
</button>
|
|
41
|
+
<button onClick={() => toast.error({ text: "Something went wrong" })}>
|
|
42
|
+
Error
|
|
43
|
+
</button>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`GeistdocsProvider` mounts the global toast area. Use `success`, `warning`, or `error` with a `{ text }` message from any client component below the provider.
|
package/docs/pages/migration.md
CHANGED
|
@@ -114,7 +114,7 @@ Replace imports according to this table:
|
|
|
114
114
|
| `components/badge`, `components/button`, `components/input`, `components/theme-switcher`, or `components/tooltip` | Keep the import package-backed. Geistdocs resolves these template primitives through the selected public or private provider. |
|
|
115
115
|
| `components/dialog`, `components/drawer`, `components/kbd`, `components/separator`, `components/sheet`, `components/spinner`, or `components/textarea` | Import the matching component directly from `@vercel/geistcn/components/<name>` in approved private projects, or keep an application-owned public equivalent. |
|
|
116
116
|
| `components/switch` | Replace `Switch` with package-backed `Toggle` from `components/toggle`, and replace `onCheckedChange` with `onChange`. |
|
|
117
|
-
| `components/sonner` | Use
|
|
117
|
+
| `components/sonner` | Use the package-backed `useToasts` from `components/toasts`. |
|
|
118
118
|
| `components/theme-aware-image` | Use `Image` from `@vercel/geistcn/components/image` with `srcLight` and `srcDark`. |
|
|
119
119
|
| `assets/icons`, `assets/icons/*`, `assets/logos`, or `assets/logos/*` | Keep the import package-backed. Both Geistdocs package variants expose the index and deep asset subpaths. |
|
|
120
120
|
| `components/button-group`, `components/card`, or `components/input-group` | Use an appropriate Geistcn component or keep an application-owned composition. There is no direct Geistcn replacement with the same API. |
|
package/docs/pages/provider.md
CHANGED
|
@@ -98,10 +98,18 @@ If Ask AI fails while rendering, its panel shows **Try again** and **Close** act
|
|
|
98
98
|
The provider includes a global toast notification system. Use it anywhere in your app:
|
|
99
99
|
|
|
100
100
|
```tsx title="page.tsx"
|
|
101
|
-
|
|
101
|
+
"use client";
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
import { useToasts } from "@vercel/geistdocs/components/toasts";
|
|
104
|
+
|
|
105
|
+
export function StatusActions() {
|
|
106
|
+
const toast = useToasts();
|
|
107
|
+
|
|
108
|
+
// Trigger these from your event handlers:
|
|
109
|
+
toast.success({ text: "Changes saved" });
|
|
110
|
+
toast.warning({ text: "Review these changes" });
|
|
111
|
+
toast.error({ text: "Something went wrong" });
|
|
112
|
+
}
|
|
105
113
|
```
|
|
106
114
|
|
|
107
115
|
## Analytics
|
package/docs/sitemap.md
CHANGED
|
@@ -22,7 +22,6 @@ Use it to choose focused page files from `docs/pages/` before reading the full `
|
|
|
22
22
|
- [Button](pages/components/button.md) | URL: /docs/components/button | Type: reference | Summary: Use the provider-backed Button in application UI or directly in MDX.
|
|
23
23
|
- [Callout](pages/components/callout.md) | URL: /docs/components/callout | Type: reference | Summary: Use Callout directly or compose its container, title, and description primitives.
|
|
24
24
|
- [Code Block](pages/components/code-block.md) | URL: /docs/components/code-block | Type: reference | Summary: Use CodeBlock when code is highlighted or assembled outside authored Markdown fences.
|
|
25
|
-
- [Code Block Tabs](pages/components/code-block-tabs.md) | URL: /docs/components/code-block-tabs | Type: reference | Summary: Compose code-block tab lists, triggers, and panels outside authored MDX.
|
|
26
25
|
- [Collapsible](pages/components/collapsible.md) | URL: /docs/components/collapsible | Type: reference | Summary: Compose Collapsible, CollapsibleTrigger, and CollapsibleContent in custom React UI.
|
|
27
26
|
- [Command Prompt](pages/components/command-prompt.md) | URL: /docs/components/command-prompt | Type: reference | Summary: Compose the CommandPrompt primitives for application-owned install and setup commands.
|
|
28
27
|
- [Components](pages/components/index.md) | URL: /docs/components/index | Type: overview | Summary: Browse every component subpath exported by Geistdocs. These components can be imported into application code without relying on the default MDX component map.
|
|
@@ -48,6 +47,7 @@ Use it to choose focused page files from `docs/pages/` before reading the full `
|
|
|
48
47
|
- [Table of contents](pages/table-of-contents.md) | URL: /docs/table-of-contents | Type: reference | Summary: Geistdocs builds the "On this page" outline from your headings, indents sub-headings under their parent, and tracks the active section along a straight vertical guide rail.
|
|
49
48
|
- [Tabs](pages/components/tabs.md) | URL: /docs/components/tabs | Type: reference | Summary: Use Tabs for navigation-only controls or TabsWithChildren and TabContent for mounted content panels.
|
|
50
49
|
- [Theme Switcher](pages/components/theme-switcher.md) | URL: /docs/components/theme-switcher | Type: reference | Summary: Use ThemeSwitcher in custom navigation, settings, and footer UI.
|
|
50
|
+
- [Toast](pages/components/toast.md) | URL: /docs/components/toast | Type: reference | Summary: Trigger provider-backed success, warning, and error notifications.
|
|
51
51
|
- [Toggle](pages/components/toggle.md) | URL: /docs/components/toggle | Type: reference | Summary: Toggle is the provider-backed replacement for the former Switch export.
|
|
52
52
|
- [Tooltip](pages/components/tooltip.md) | URL: /docs/components/tooltip | Type: reference | Summary: Wrap controls with provider-backed Tooltip content outside MDX.
|
|
53
53
|
- [Video](pages/components/video.md) | URL: /docs/components/video | Type: reference | Summary: Use Video for embedded video sources inside React UI or authored MDX.
|
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.7.
|
|
4
|
+
"version": "2.7.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -192,6 +192,10 @@
|
|
|
192
192
|
"types": "./dist/providers/public/components/tooltip.d.ts",
|
|
193
193
|
"default": "./dist/providers/public/components/tooltip.js"
|
|
194
194
|
},
|
|
195
|
+
"./components/toasts": {
|
|
196
|
+
"types": "./dist/components/toasts.d.ts",
|
|
197
|
+
"default": "./dist/components/toasts.js"
|
|
198
|
+
},
|
|
195
199
|
"./components/theme-switcher": {
|
|
196
200
|
"types": "./dist/providers/public/components/theme-switcher.d.ts",
|
|
197
201
|
"default": "./dist/providers/public/components/theme-switcher.js"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Button } from "@vercel/geistdocs/components/button";
|
|
4
|
+
import { useToasts } from "@vercel/geistdocs/components/toasts";
|
|
5
|
+
|
|
6
|
+
export function ToastDemo() {
|
|
7
|
+
const toast = useToasts();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex flex-wrap justify-center gap-2">
|
|
11
|
+
<Button
|
|
12
|
+
onClick={() => toast.success({ text: "Changes saved" })}
|
|
13
|
+
variant="secondary"
|
|
14
|
+
>
|
|
15
|
+
Success
|
|
16
|
+
</Button>
|
|
17
|
+
<Button
|
|
18
|
+
onClick={() =>
|
|
19
|
+
toast.warning({ text: "Review these changes before continuing" })
|
|
20
|
+
}
|
|
21
|
+
variant="secondary"
|
|
22
|
+
>
|
|
23
|
+
Warning
|
|
24
|
+
</Button>
|
|
25
|
+
<Button
|
|
26
|
+
onClick={() => toast.error({ text: "Something went wrong" })}
|
|
27
|
+
variant="secondary"
|
|
28
|
+
>
|
|
29
|
+
Error
|
|
30
|
+
</Button>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -5,11 +5,18 @@ type: reference
|
|
|
5
5
|
summary: Use CodeBlock when code is highlighted or assembled outside authored Markdown fences.
|
|
6
6
|
related:
|
|
7
7
|
- /docs/components
|
|
8
|
-
- /docs/components/code-block-tabs
|
|
9
8
|
- /docs/syntax
|
|
10
9
|
---
|
|
11
10
|
|
|
12
11
|
import { CodeBlock } from "@vercel/geistdocs/components/code-block";
|
|
12
|
+
import {
|
|
13
|
+
CodeBlockTab,
|
|
14
|
+
CodeBlockTabs,
|
|
15
|
+
CodeBlockTabsList,
|
|
16
|
+
CodeBlockTabsTrigger,
|
|
17
|
+
} from "@vercel/geistdocs/components/code-block-tabs";
|
|
18
|
+
|
|
19
|
+
## Code block
|
|
13
20
|
|
|
14
21
|
<div className="not-prose my-6">
|
|
15
22
|
<CodeBlock title="example.ts">{'export const enabled = true;'}</CodeBlock>
|
|
@@ -20,3 +27,32 @@ import { CodeBlock } from "@vercel/geistdocs/components/code-block";
|
|
|
20
27
|
```
|
|
21
28
|
|
|
22
29
|
Pass a `title` to show header chrome with a filename-aware icon and copy control. Markdown code fences use `CodeBlock` automatically through the default MDX map.
|
|
30
|
+
|
|
31
|
+
## Code block with tabs
|
|
32
|
+
|
|
33
|
+
<div className="not-prose my-6">
|
|
34
|
+
<CodeBlockTabs defaultValue="pnpm">
|
|
35
|
+
<CodeBlockTabsList>
|
|
36
|
+
<CodeBlockTabsTrigger value="pnpm">pnpm</CodeBlockTabsTrigger>
|
|
37
|
+
<CodeBlockTabsTrigger value="npm">npm</CodeBlockTabsTrigger>
|
|
38
|
+
</CodeBlockTabsList>
|
|
39
|
+
<CodeBlockTab value="pnpm">
|
|
40
|
+
<CodeBlock title="Terminal">pnpm add @vercel/geistdocs</CodeBlock>
|
|
41
|
+
</CodeBlockTab>
|
|
42
|
+
<CodeBlockTab value="npm">
|
|
43
|
+
<CodeBlock title="Terminal">npm install @vercel/geistdocs</CodeBlock>
|
|
44
|
+
</CodeBlockTab>
|
|
45
|
+
</CodeBlockTabs>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import {
|
|
50
|
+
CodeBlockTab,
|
|
51
|
+
CodeBlockTabs,
|
|
52
|
+
CodeBlockTabsList,
|
|
53
|
+
CodeBlockTabsTrigger,
|
|
54
|
+
CompactCodeBlockTabs,
|
|
55
|
+
} from "@vercel/geistdocs/components/code-block-tabs";
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The same components are available without imports in authored MDX.
|
|
@@ -23,13 +23,13 @@ Internal projects using `@vercel/geistdocs-private` use the same component subpa
|
|
|
23
23
|
| [Input](/docs/components/input) | `components/input` | Text input fields with provider-backed styling |
|
|
24
24
|
| [Toggle](/docs/components/toggle) | `components/toggle` | Controlled boolean controls |
|
|
25
25
|
| [Tooltip](/docs/components/tooltip) | `components/tooltip` | Contextual hover and focus labels |
|
|
26
|
+
| [Toast](/docs/components/toast) | `components/toasts` | Global success, warning, and error notifications |
|
|
26
27
|
| [Theme Switcher](/docs/components/theme-switcher) | `components/theme-switcher` | System, light, and dark theme selection |
|
|
27
28
|
| [Tabs](/docs/components/tabs) | `components/tabs`, `components/tabs-with-children` | Tab navigation and mounted content panels |
|
|
28
29
|
| [Collapsible](/docs/components/collapsible) | `components/collapsible` | Expandable content regions |
|
|
29
30
|
| [Details](/docs/components/details) | `components/details` | Styled native disclosure elements |
|
|
30
31
|
| [Callout](/docs/components/callout) | `components/callout` | Notices with optional titles and descriptions |
|
|
31
|
-
| [Code Block](/docs/components/code-block) | `components/code-block` | Highlighted code
|
|
32
|
-
| [Code Block Tabs](/docs/components/code-block-tabs) | `components/code-block-tabs` | Multiple code examples in one tabbed surface |
|
|
32
|
+
| [Code Block](/docs/components/code-block) | `components/code-block`, `components/code-block-tabs` | Highlighted code and tabbed code groups |
|
|
33
33
|
| [Command Prompt](/docs/components/command-prompt) | `components/command-prompt` | Command surfaces with copy support and alternatives |
|
|
34
34
|
| [Copy Prompt](/docs/components/copy-prompt) | `components/copy-prompt` | Copyable prompts for agents and language models |
|
|
35
35
|
| [Dropdown Menu](/docs/components/dropdown-menu) | `components/dropdown-menu` | Accessible action menus |
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Toast
|
|
3
|
+
description: Show global status notifications
|
|
4
|
+
type: reference
|
|
5
|
+
summary: Trigger provider-backed success, warning, and error notifications.
|
|
6
|
+
related:
|
|
7
|
+
- /docs/components
|
|
8
|
+
- /docs/provider
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
import { ToastDemo } from "@/components/geistdocs/toast-demo";
|
|
12
|
+
|
|
13
|
+
Use the buttons to preview every status variant:
|
|
14
|
+
|
|
15
|
+
<div className="not-prose my-6 flex min-h-32 items-center justify-center rounded-lg border border-gray-400 bg-background-100 p-6">
|
|
16
|
+
<ToastDemo />
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
"use client";
|
|
21
|
+
|
|
22
|
+
import { useToasts } from "@vercel/geistdocs/components/toasts";
|
|
23
|
+
|
|
24
|
+
export function StatusButtons() {
|
|
25
|
+
const toast = useToasts();
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div>
|
|
29
|
+
<button onClick={() => toast.success({ text: "Changes saved" })}>
|
|
30
|
+
Success
|
|
31
|
+
</button>
|
|
32
|
+
<button
|
|
33
|
+
onClick={() => toast.warning({ text: "Review these changes" })}
|
|
34
|
+
>
|
|
35
|
+
Warning
|
|
36
|
+
</button>
|
|
37
|
+
<button onClick={() => toast.error({ text: "Something went wrong" })}>
|
|
38
|
+
Error
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`GeistdocsProvider` mounts the global toast area. Use `success`, `warning`, or `error` with a `{ text }` message from any client component below the provider.
|
|
@@ -113,7 +113,7 @@ Replace imports according to this table:
|
|
|
113
113
|
| `components/badge`, `components/button`, `components/input`, `components/theme-switcher`, or `components/tooltip` | Keep the import package-backed. Geistdocs resolves these template primitives through the selected public or private provider. |
|
|
114
114
|
| `components/dialog`, `components/drawer`, `components/kbd`, `components/separator`, `components/sheet`, `components/spinner`, or `components/textarea` | Import the matching component directly from `@vercel/geistcn/components/<name>` in approved private projects, or keep an application-owned public equivalent. |
|
|
115
115
|
| `components/switch` | Replace `Switch` with package-backed `Toggle` from `components/toggle`, and replace `onCheckedChange` with `onChange`. |
|
|
116
|
-
| `components/sonner` | Use
|
|
116
|
+
| `components/sonner` | Use the package-backed `useToasts` from `components/toasts`. |
|
|
117
117
|
| `components/theme-aware-image` | Use `Image` from `@vercel/geistcn/components/image` with `srcLight` and `srcDark`. |
|
|
118
118
|
| `assets/icons`, `assets/icons/*`, `assets/logos`, or `assets/logos/*` | Keep the import package-backed. Both Geistdocs package variants expose the index and deep asset subpaths. |
|
|
119
119
|
| `components/button-group`, `components/card`, or `components/input-group` | Use an appropriate Geistcn component or keep an application-owned composition. There is no direct Geistcn replacement with the same API. |
|
|
@@ -54,10 +54,18 @@ const Layout = ({ children }: LayoutProps) => (
|
|
|
54
54
|
该提供者包含一个全局的 toast 通知系统。可在应用的任何位置使用:
|
|
55
55
|
|
|
56
56
|
```tsx title="page.tsx"
|
|
57
|
-
|
|
57
|
+
"use client";
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
import { useToasts } from "@vercel/geistdocs/components/toasts";
|
|
60
|
+
|
|
61
|
+
export function StatusActions() {
|
|
62
|
+
const toast = useToasts();
|
|
63
|
+
|
|
64
|
+
// Trigger these from your event handlers:
|
|
65
|
+
toast.success({ text: "Changes saved" });
|
|
66
|
+
toast.warning({ text: "Review these changes" });
|
|
67
|
+
toast.error({ text: "Something went wrong" });
|
|
68
|
+
}
|
|
61
69
|
```
|
|
62
70
|
|
|
63
71
|
## 分析
|
|
@@ -97,10 +97,18 @@ If Ask AI fails while rendering, its panel shows **Try again** and **Close** act
|
|
|
97
97
|
The provider includes a global toast notification system. Use it anywhere in your app:
|
|
98
98
|
|
|
99
99
|
```tsx title="page.tsx"
|
|
100
|
-
|
|
100
|
+
"use client";
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
import { useToasts } from "@vercel/geistdocs/components/toasts";
|
|
103
|
+
|
|
104
|
+
export function StatusActions() {
|
|
105
|
+
const toast = useToasts();
|
|
106
|
+
|
|
107
|
+
// Trigger these from your event handlers:
|
|
108
|
+
toast.success({ text: "Changes saved" });
|
|
109
|
+
toast.warning({ text: "Review these changes" });
|
|
110
|
+
toast.error({ text: "Something went wrong" });
|
|
111
|
+
}
|
|
104
112
|
```
|
|
105
113
|
|
|
106
114
|
## Analytics
|
package/template/package.json
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Code Block Tabs
|
|
3
|
-
description: Group multiple code examples in one tabbed surface
|
|
4
|
-
type: reference
|
|
5
|
-
summary: Compose code-block tab lists, triggers, and panels outside authored MDX.
|
|
6
|
-
url: /docs/components/code-block-tabs
|
|
7
|
-
source: apps/template/content/docs/components/code-block-tabs.mdx
|
|
8
|
-
related:
|
|
9
|
-
- /docs/components
|
|
10
|
-
- /docs/components/code-block
|
|
11
|
-
- /docs/syntax
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# Code Block Tabs
|
|
15
|
-
|
|
16
|
-
import { CodeBlock } from "@vercel/geistdocs/components/code-block";
|
|
17
|
-
import {
|
|
18
|
-
CodeBlockTab,
|
|
19
|
-
CodeBlockTabs,
|
|
20
|
-
CodeBlockTabsList,
|
|
21
|
-
CodeBlockTabsTrigger,
|
|
22
|
-
} from "@vercel/geistdocs/components/code-block-tabs";
|
|
23
|
-
|
|
24
|
-
<div className="not-prose my-6">
|
|
25
|
-
<CodeBlockTabs defaultValue="pnpm">
|
|
26
|
-
<CodeBlockTabsList>
|
|
27
|
-
<CodeBlockTabsTrigger value="pnpm">pnpm</CodeBlockTabsTrigger>
|
|
28
|
-
<CodeBlockTabsTrigger value="npm">npm</CodeBlockTabsTrigger>
|
|
29
|
-
</CodeBlockTabsList>
|
|
30
|
-
<CodeBlockTab value="pnpm">
|
|
31
|
-
<CodeBlock title="Terminal">pnpm add @vercel/geistdocs</CodeBlock>
|
|
32
|
-
</CodeBlockTab>
|
|
33
|
-
<CodeBlockTab value="npm">
|
|
34
|
-
<CodeBlock title="Terminal">npm install @vercel/geistdocs</CodeBlock>
|
|
35
|
-
</CodeBlockTab>
|
|
36
|
-
</CodeBlockTabs>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
```tsx
|
|
40
|
-
import {
|
|
41
|
-
CodeBlockTab,
|
|
42
|
-
CodeBlockTabs,
|
|
43
|
-
CodeBlockTabsList,
|
|
44
|
-
CodeBlockTabsTrigger,
|
|
45
|
-
CompactCodeBlockTabs,
|
|
46
|
-
} from "@vercel/geistdocs/components/code-block-tabs";
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
The same components are available without imports in authored MDX.
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Code Block Tabs
|
|
3
|
-
description: Group multiple code examples in one tabbed surface
|
|
4
|
-
type: reference
|
|
5
|
-
summary: Compose code-block tab lists, triggers, and panels outside authored MDX.
|
|
6
|
-
related:
|
|
7
|
-
- /docs/components
|
|
8
|
-
- /docs/components/code-block
|
|
9
|
-
- /docs/syntax
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
import { CodeBlock } from "@vercel/geistdocs/components/code-block";
|
|
13
|
-
import {
|
|
14
|
-
CodeBlockTab,
|
|
15
|
-
CodeBlockTabs,
|
|
16
|
-
CodeBlockTabsList,
|
|
17
|
-
CodeBlockTabsTrigger,
|
|
18
|
-
} from "@vercel/geistdocs/components/code-block-tabs";
|
|
19
|
-
|
|
20
|
-
<div className="not-prose my-6">
|
|
21
|
-
<CodeBlockTabs defaultValue="pnpm">
|
|
22
|
-
<CodeBlockTabsList>
|
|
23
|
-
<CodeBlockTabsTrigger value="pnpm">pnpm</CodeBlockTabsTrigger>
|
|
24
|
-
<CodeBlockTabsTrigger value="npm">npm</CodeBlockTabsTrigger>
|
|
25
|
-
</CodeBlockTabsList>
|
|
26
|
-
<CodeBlockTab value="pnpm">
|
|
27
|
-
<CodeBlock title="Terminal">pnpm add @vercel/geistdocs</CodeBlock>
|
|
28
|
-
</CodeBlockTab>
|
|
29
|
-
<CodeBlockTab value="npm">
|
|
30
|
-
<CodeBlock title="Terminal">npm install @vercel/geistdocs</CodeBlock>
|
|
31
|
-
</CodeBlockTab>
|
|
32
|
-
</CodeBlockTabs>
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
import {
|
|
37
|
-
CodeBlockTab,
|
|
38
|
-
CodeBlockTabs,
|
|
39
|
-
CodeBlockTabsList,
|
|
40
|
-
CodeBlockTabsTrigger,
|
|
41
|
-
CompactCodeBlockTabs,
|
|
42
|
-
} from "@vercel/geistdocs/components/code-block-tabs";
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
The same components are available without imports in authored MDX.
|