@vercel/geistdocs 2.14.6 → 2.14.7
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/controls.d.ts +3 -40
- package/dist/controls.d.ts.map +1 -1
- package/dist/controls.js +5 -96
- package/dist/internal/controls-client.d.ts +40 -0
- package/dist/internal/controls-client.d.ts.map +1 -0
- package/dist/internal/controls-client.js +87 -0
- package/dist/internal/language-selector.d.ts +2 -0
- package/dist/internal/language-selector.d.ts.map +1 -0
- package/dist/internal/language-selector.js +12 -0
- package/dist/internal/navbar/mobile-menu.js +1 -1
- package/dist/internal/page-action-options.d.ts +37 -0
- package/dist/internal/page-action-options.d.ts.map +1 -0
- package/dist/internal/page-action-options.js +39 -0
- package/dist/internal/page-actions-client.d.ts +1 -31
- package/dist/internal/page-actions-client.d.ts.map +1 -1
- package/dist/internal/page-actions-client.js +5 -103
- package/dist/internal/page-actions-gate.d.ts +3 -0
- package/dist/internal/page-actions-gate.d.ts.map +1 -0
- package/dist/internal/page-actions-gate.js +15 -0
- package/dist/internal/provider-client.d.ts.map +1 -1
- package/dist/internal/provider-client.js +26 -1
- package/dist/internal/relative-docs-link.d.ts +7 -0
- package/dist/internal/relative-docs-link.d.ts.map +1 -0
- package/dist/internal/relative-docs-link.js +22 -0
- package/dist/internal/sidebar.d.ts.map +1 -1
- package/dist/internal/sidebar.js +1 -1
- package/dist/internal/toc-actions-client.d.ts +9 -0
- package/dist/internal/toc-actions-client.d.ts.map +1 -0
- package/dist/internal/toc-actions-client.js +78 -0
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +5 -2
- package/dist/navbar.js +1 -1
- package/dist/pages/changelog.js +1 -1
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +4 -3
- package/docs/agents.md +1 -1
- package/docs/llms.txt +4 -1
- package/docs/manifest.json +1 -1
- package/docs/pages/provider.md +3 -0
- package/package.json +1 -1
- package/template/content/docs/provider.mdx +3 -0
- 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.6","-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.7","-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});
|
package/dist/controls.d.ts
CHANGED
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
/**
|
|
5
|
-
* Control the Ask AI chat from custom components rendered inside
|
|
6
|
-
* `GeistdocsProvider`.
|
|
7
|
-
*/
|
|
8
|
-
export declare const useGeistdocsChat: () => GeistdocsChatController;
|
|
9
|
-
interface SearchButtonProps {
|
|
10
|
-
className?: string;
|
|
11
|
-
onClick?: () => void;
|
|
12
|
-
}
|
|
13
|
-
export declare const SearchButton: ({ className, onClick }: SearchButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export declare const ThemeToggle: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export declare const LanguageSelector: () => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
-
interface AskAIButtonProps {
|
|
17
|
-
children?: ReactNode;
|
|
18
|
-
className?: string;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
prompt?: string;
|
|
21
|
-
size?: "tiny" | "small" | "medium" | "large" | null;
|
|
22
|
-
variant?: "default" | "secondary" | "tertiary";
|
|
23
|
-
}
|
|
24
|
-
export declare const AskAIButton: ({ children, className, prompt, size, variant, ...props }: AskAIButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
25
|
-
export interface AskAIUserProps {
|
|
26
|
-
/**
|
|
27
|
-
* The reader's avatar. Only `http(s)` URLs and root-relative paths are
|
|
28
|
-
* rendered; other values are ignored. `null` is accepted for auth session
|
|
29
|
-
* fields that may be empty.
|
|
30
|
-
*/
|
|
31
|
-
avatarUrl?: string | null;
|
|
32
|
-
/** The reader's name, used as the avatar's alt text. */
|
|
33
|
-
name?: string | null;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Identify the signed-in reader to Ask AI. Renders nothing; while mounted
|
|
37
|
-
* with an `avatarUrl`, the reader's avatar appears beside their chat
|
|
38
|
-
* messages. Unmount it, or pass no `avatarUrl`, to clear the reader.
|
|
39
|
-
*/
|
|
40
|
-
export declare const AskAIUser: ({ avatarUrl, name }: AskAIUserProps) => null;
|
|
1
|
+
export type { AskAIUserProps, GeistdocsChatController, GeistdocsChatPage, } from "./internal/controls-client";
|
|
2
|
+
export { AskAIButton, AskAIUser, SearchButton, ThemeToggle, useGeistdocsChat, } from "./internal/controls-client";
|
|
3
|
+
export { LanguageSelector } from "./internal/language-selector";
|
|
41
4
|
//# sourceMappingURL=controls.d.ts.map
|
package/dist/controls.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EACL,WAAW,EACX,SAAS,EACT,YAAY,EACZ,WAAW,EACX,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/controls.js
CHANGED
|
@@ -1,96 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { IconCheck, IconLanguages, IconMoon, IconSun, } from "#geistdocs-assets/icons";
|
|
7
|
-
import { Button } from "#geistdocs-ui/components/button";
|
|
8
|
-
import { Kbd } from "#geistdocs-ui/components/kbd";
|
|
9
|
-
import { useTheme } from "#geistdocs-ui/core";
|
|
10
|
-
import { cn } from "#geistdocs-ui/utils";
|
|
11
|
-
import { useGeistdocsChatContext, } from "./internal/chat/context";
|
|
12
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "./internal/ui/dropdown-menu";
|
|
13
|
-
/**
|
|
14
|
-
* Control the Ask AI chat from custom components rendered inside
|
|
15
|
-
* `GeistdocsProvider`.
|
|
16
|
-
*/
|
|
17
|
-
export const useGeistdocsChat = () => {
|
|
18
|
-
const { ask, enabled, isOpen, openWithPage, setIsOpen } = useGeistdocsChatContext();
|
|
19
|
-
return useMemo(() => ({
|
|
20
|
-
ask,
|
|
21
|
-
close: () => setIsOpen(false),
|
|
22
|
-
enabled,
|
|
23
|
-
isOpen,
|
|
24
|
-
open: () => {
|
|
25
|
-
if (enabled) {
|
|
26
|
-
setIsOpen(true);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
openWithPage,
|
|
30
|
-
toggle: () => {
|
|
31
|
-
if (enabled) {
|
|
32
|
-
setIsOpen((open) => !open);
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
}), [ask, enabled, isOpen, openWithPage, setIsOpen]);
|
|
36
|
-
};
|
|
37
|
-
export const SearchButton = ({ className, onClick }) => {
|
|
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-[var(--ds-focus-ring)]", className), onClick: () => {
|
|
40
|
-
setOpenSearch(true);
|
|
41
|
-
onClick?.();
|
|
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" })] }));
|
|
43
|
-
};
|
|
44
|
-
export const ThemeToggle = () => {
|
|
45
|
-
const { resolvedTheme, setTheme } = useTheme();
|
|
46
|
-
const [mounted, setMounted] = useState(false);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
setMounted(true);
|
|
49
|
-
}, []);
|
|
50
|
-
if (!mounted) {
|
|
51
|
-
return (_jsx(Button, { "aria-label": "Toggle Theme", shape: "square", size: "small", svgOnly: true, type: "unstyled", typeName: "button", children: _jsx("div", { className: "size-4" }) }));
|
|
52
|
-
}
|
|
53
|
-
const Icon = resolvedTheme === "dark" ? IconMoon : IconSun;
|
|
54
|
-
return (_jsx(Button, { "aria-label": resolvedTheme === "dark"
|
|
55
|
-
? "Switch to Light Theme"
|
|
56
|
-
: "Switch to Dark Theme", onClick: () => setTheme(resolvedTheme === "dark" ? "light" : "dark"), shape: "square", size: "small", svgOnly: true, type: "unstyled", typeName: "button", children: _jsx(Icon, { className: "size-4" }) }));
|
|
57
|
-
};
|
|
58
|
-
export const LanguageSelector = () => {
|
|
59
|
-
const { locale, locales, onChange } = useI18n();
|
|
60
|
-
if (!locales) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { "aria-label": "Select Language", className: "flex items-center justify-center rounded-md p-2 hover:bg-gray-alpha-100 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:bg-gray-alpha-300", children: [_jsx(IconLanguages, { className: "size-4.5" }), _jsx("span", { className: "sr-only", children: "Select Language" })] }), _jsx(DropdownMenuContent, { align: "end", children: locales.map((lang) => (_jsxs(DropdownMenuItem, { className: "flex cursor-pointer items-center justify-between", disabled: locale === lang.locale, onClick: () => onChange?.(lang.locale), children: [lang.name, locale === lang.locale && _jsx(IconCheck, { className: "size-4" })] }, lang.locale))) })] }));
|
|
64
|
-
};
|
|
65
|
-
export const AskAIButton = ({ children, className, prompt, size = "small", variant = "secondary", ...props }) => {
|
|
66
|
-
const { enabled, isOpen, preloadChat, setIsOpen, setPrompt } = useGeistdocsChatContext();
|
|
67
|
-
if (!enabled) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
return (_jsx(Button, { className: cn("shrink-0", className), "data-geistdocs-ask-ai": "", onClick: () => {
|
|
71
|
-
preloadChat();
|
|
72
|
-
if (prompt) {
|
|
73
|
-
setPrompt(prompt);
|
|
74
|
-
setIsOpen(true);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
setIsOpen(!isOpen);
|
|
78
|
-
}, onFocus: preloadChat, onMouseEnter: preloadChat, size: size, typeName: "button", variant: variant, ...props, children: children ?? _jsx("span", { children: "Ask AI" }) }));
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Identify the signed-in reader to Ask AI. Renders nothing; while mounted
|
|
82
|
-
* with an `avatarUrl`, the reader's avatar appears beside their chat
|
|
83
|
-
* messages. Unmount it, or pass no `avatarUrl`, to clear the reader.
|
|
84
|
-
*/
|
|
85
|
-
export const AskAIUser = ({ avatarUrl, name }) => {
|
|
86
|
-
const { setUser } = useGeistdocsChatContext();
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
if (!avatarUrl) {
|
|
89
|
-
setUser(null);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
setUser({ avatarUrl, name: name ?? undefined });
|
|
93
|
-
return () => setUser(null);
|
|
94
|
-
}, [avatarUrl, name, setUser]);
|
|
95
|
-
return null;
|
|
96
|
-
};
|
|
1
|
+
// Keep the public API server-neutral; client boundaries live on the concrete
|
|
2
|
+
// modules so importing search/chat controls does not include the language menu.
|
|
3
|
+
// biome-ignore lint/performance/noBarrelFile: preserve the public controls entrypoint while separating its client modules.
|
|
4
|
+
export { AskAIButton, AskAIUser, SearchButton, ThemeToggle, useGeistdocsChat, } from "./internal/controls-client";
|
|
5
|
+
export { LanguageSelector } from "./internal/language-selector";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type GeistdocsChatController } from "./chat/context";
|
|
3
|
+
export type { GeistdocsChatController, GeistdocsChatPage, } from "./chat/context";
|
|
4
|
+
/**
|
|
5
|
+
* Control the Ask AI chat from custom components rendered inside
|
|
6
|
+
* `GeistdocsProvider`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useGeistdocsChat: () => GeistdocsChatController;
|
|
9
|
+
interface SearchButtonProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const SearchButton: ({ className, onClick }: SearchButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const ThemeToggle: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
interface AskAIButtonProps {
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
prompt?: string;
|
|
20
|
+
size?: "tiny" | "small" | "medium" | "large" | null;
|
|
21
|
+
variant?: "default" | "secondary" | "tertiary";
|
|
22
|
+
}
|
|
23
|
+
export declare const AskAIButton: ({ children, className, prompt, size, variant, ...props }: AskAIButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
+
export interface AskAIUserProps {
|
|
25
|
+
/**
|
|
26
|
+
* The reader's avatar. Only `http(s)` URLs and root-relative paths are
|
|
27
|
+
* rendered; other values are ignored. `null` is accepted for auth session
|
|
28
|
+
* fields that may be empty.
|
|
29
|
+
*/
|
|
30
|
+
avatarUrl?: string | null;
|
|
31
|
+
/** The reader's name, used as the avatar's alt text. */
|
|
32
|
+
name?: string | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Identify the signed-in reader to Ask AI. Renders nothing; while mounted
|
|
36
|
+
* with an `avatarUrl`, the reader's avatar appears beside their chat
|
|
37
|
+
* messages. Unmount it, or pass no `avatarUrl`, to clear the reader.
|
|
38
|
+
*/
|
|
39
|
+
export declare const AskAIUser: ({ avatarUrl, name }: AskAIUserProps) => null;
|
|
40
|
+
//# sourceMappingURL=controls-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls-client.d.ts","sourceRoot":"","sources":["../../src/internal/controls-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAgC,MAAM,OAAO,CAAC;AAMrE,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB;;;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,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"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useSearchContext } from "fumadocs-ui/contexts/search";
|
|
4
|
+
import { useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { IconMoon, IconSun } from "#geistdocs-assets/icons";
|
|
6
|
+
import { Button } from "#geistdocs-ui/components/button";
|
|
7
|
+
import { Kbd } from "#geistdocs-ui/components/kbd";
|
|
8
|
+
import { useTheme } from "#geistdocs-ui/core";
|
|
9
|
+
import { cn } from "#geistdocs-ui/utils";
|
|
10
|
+
import { useGeistdocsChatContext, } from "./chat/context";
|
|
11
|
+
/**
|
|
12
|
+
* Control the Ask AI chat from custom components rendered inside
|
|
13
|
+
* `GeistdocsProvider`.
|
|
14
|
+
*/
|
|
15
|
+
export const useGeistdocsChat = () => {
|
|
16
|
+
const { ask, enabled, isOpen, openWithPage, setIsOpen } = useGeistdocsChatContext();
|
|
17
|
+
return useMemo(() => ({
|
|
18
|
+
ask,
|
|
19
|
+
close: () => setIsOpen(false),
|
|
20
|
+
enabled,
|
|
21
|
+
isOpen,
|
|
22
|
+
open: () => {
|
|
23
|
+
if (enabled) {
|
|
24
|
+
setIsOpen(true);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
openWithPage,
|
|
28
|
+
toggle: () => {
|
|
29
|
+
if (enabled) {
|
|
30
|
+
setIsOpen((open) => !open);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
}), [ask, enabled, isOpen, openWithPage, setIsOpen]);
|
|
34
|
+
};
|
|
35
|
+
export const SearchButton = ({ className, onClick }) => {
|
|
36
|
+
const { setOpenSearch } = useSearchContext();
|
|
37
|
+
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: () => {
|
|
38
|
+
setOpenSearch(true);
|
|
39
|
+
onClick?.();
|
|
40
|
+
}, 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" })] }));
|
|
41
|
+
};
|
|
42
|
+
export const ThemeToggle = () => {
|
|
43
|
+
const { resolvedTheme, setTheme } = useTheme();
|
|
44
|
+
const [mounted, setMounted] = useState(false);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
setMounted(true);
|
|
47
|
+
}, []);
|
|
48
|
+
if (!mounted) {
|
|
49
|
+
return (_jsx(Button, { "aria-label": "Toggle Theme", shape: "square", size: "small", svgOnly: true, type: "unstyled", typeName: "button", children: _jsx("div", { className: "size-4" }) }));
|
|
50
|
+
}
|
|
51
|
+
const Icon = resolvedTheme === "dark" ? IconMoon : IconSun;
|
|
52
|
+
return (_jsx(Button, { "aria-label": resolvedTheme === "dark"
|
|
53
|
+
? "Switch to Light Theme"
|
|
54
|
+
: "Switch to Dark Theme", onClick: () => setTheme(resolvedTheme === "dark" ? "light" : "dark"), shape: "square", size: "small", svgOnly: true, type: "unstyled", typeName: "button", children: _jsx(Icon, { className: "size-4" }) }));
|
|
55
|
+
};
|
|
56
|
+
export const AskAIButton = ({ children, className, prompt, size = "small", variant = "secondary", ...props }) => {
|
|
57
|
+
const { enabled, isOpen, preloadChat, setIsOpen, setPrompt } = useGeistdocsChatContext();
|
|
58
|
+
if (!enabled) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return (_jsx(Button, { className: cn("shrink-0", className), "data-geistdocs-ask-ai": "", onClick: () => {
|
|
62
|
+
preloadChat();
|
|
63
|
+
if (prompt) {
|
|
64
|
+
setPrompt(prompt);
|
|
65
|
+
setIsOpen(true);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
setIsOpen(!isOpen);
|
|
69
|
+
}, onFocus: preloadChat, onMouseEnter: preloadChat, size: size, typeName: "button", variant: variant, ...props, children: children ?? _jsx("span", { children: "Ask AI" }) }));
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Identify the signed-in reader to Ask AI. Renders nothing; while mounted
|
|
73
|
+
* with an `avatarUrl`, the reader's avatar appears beside their chat
|
|
74
|
+
* messages. Unmount it, or pass no `avatarUrl`, to clear the reader.
|
|
75
|
+
*/
|
|
76
|
+
export const AskAIUser = ({ avatarUrl, name }) => {
|
|
77
|
+
const { setUser } = useGeistdocsChatContext();
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (!avatarUrl) {
|
|
80
|
+
setUser(null);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
setUser({ avatarUrl, name: name ?? undefined });
|
|
84
|
+
return () => setUser(null);
|
|
85
|
+
}, [avatarUrl, name, setUser]);
|
|
86
|
+
return null;
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language-selector.d.ts","sourceRoot":"","sources":["../../src/internal/language-selector.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,gBAAgB,sDA+B5B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useI18n } from "fumadocs-ui/contexts/i18n";
|
|
4
|
+
import { IconCheck, IconLanguages } from "#geistdocs-assets/icons";
|
|
5
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "./ui/dropdown-menu";
|
|
6
|
+
export const LanguageSelector = () => {
|
|
7
|
+
const { locale, locales, onChange } = useI18n();
|
|
8
|
+
if (!locales) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { "aria-label": "Select Language", className: "flex items-center justify-center rounded-md p-2 hover:bg-gray-alpha-100 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:bg-gray-alpha-300", children: [_jsx(IconLanguages, { className: "size-4.5" }), _jsx("span", { className: "sr-only", children: "Select Language" })] }), _jsx(DropdownMenuContent, { align: "end", children: locales.map((lang) => (_jsxs(DropdownMenuItem, { className: "flex cursor-pointer items-center justify-between", disabled: locale === lang.locale, onClick: () => onChange?.(lang.locale), children: [lang.name, locale === lang.locale && _jsx(IconCheck, { className: "size-4" })] }, lang.locale))) })] }));
|
|
12
|
+
};
|
|
@@ -6,7 +6,7 @@ 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";
|
|
9
|
-
import { SearchButton } from "
|
|
9
|
+
import { SearchButton } from "../controls-client";
|
|
10
10
|
import { ExternalArrow } from "../external-arrow";
|
|
11
11
|
import { LocalizedLink } from "../localized-link";
|
|
12
12
|
import { groupDropdownItems } from "./desktop-menu";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { GeistdocsConfig } from "../config";
|
|
2
|
+
export interface PageActionsProps {
|
|
3
|
+
config: Pick<GeistdocsConfig, "ai" | "feedback" | "github" | "pageActions" | "siteId">;
|
|
4
|
+
/**
|
|
5
|
+
* Which variant to render. Defaults to both. Use "desktop" to render only
|
|
6
|
+
* the dropdown (beside the title) and "mobile" to render only the inline
|
|
7
|
+
* action row (below the title).
|
|
8
|
+
*/
|
|
9
|
+
only?: "desktop" | "mobile";
|
|
10
|
+
page: {
|
|
11
|
+
markdownUrl: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether "Ask AI about this page" attaches the page to the next Ask AI
|
|
15
|
+
* message. Pages the chat route cannot resolve, such as changelog
|
|
16
|
+
* entries, set `false` to pre-fill a prompt with the page URL instead.
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
attachToChat?: boolean;
|
|
20
|
+
/** Page title, shown when the page is attached to an Ask AI message. */
|
|
21
|
+
title?: string;
|
|
22
|
+
url: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare const getEditSourceUrl: ({ github, path, }: {
|
|
26
|
+
github?: GeistdocsConfig["github"];
|
|
27
|
+
path?: string;
|
|
28
|
+
}) => string | undefined;
|
|
29
|
+
export declare const getPageActionOptions: (config: PageActionsProps["config"], page: PageActionsProps["page"], chatEnabled: boolean) => {
|
|
30
|
+
askAIEnabled: boolean;
|
|
31
|
+
copyEnabled: boolean;
|
|
32
|
+
editSourceEnabled: boolean;
|
|
33
|
+
editSourceUrl: string | undefined;
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
openInChatEnabled: boolean;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=page-action-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-action-options.d.ts","sourceRoot":"","sources":["../../src/internal/page-action-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,IAAI,CACV,eAAe,EACf,IAAI,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CACxD,CAAC;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;;;;WAKG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,wEAAwE;QACxE,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAsBD,eAAO,MAAM,gBAAgB,GAAI,mBAG9B;IACD,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,uBAQA,CAAC;AAIF,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,gBAAgB,CAAC,QAAQ,CAAC,EAClC,MAAM,gBAAgB,CAAC,MAAM,CAAC,EAC9B,aAAa,OAAO;;;;;;;CAwBrB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const DEFAULT_EDIT_PATH = "content/docs/{path}";
|
|
2
|
+
const trimSlashes = (value) => value.replace(/^\/+|\/+$/g, "");
|
|
3
|
+
const resolveEditPath = ({ editPath = DEFAULT_EDIT_PATH, path, }) => {
|
|
4
|
+
const pagePath = trimSlashes(path);
|
|
5
|
+
if (editPath.includes("{path}")) {
|
|
6
|
+
return trimSlashes(editPath.replaceAll("{path}", pagePath));
|
|
7
|
+
}
|
|
8
|
+
return `${trimSlashes(editPath)}/${pagePath}`;
|
|
9
|
+
};
|
|
10
|
+
export const getEditSourceUrl = ({ github, path, }) => {
|
|
11
|
+
if (github?.owner && github?.repo && path) {
|
|
12
|
+
const branch = github.branch ?? "main";
|
|
13
|
+
const editPath = resolveEditPath({ editPath: github.editPath, path });
|
|
14
|
+
return `https://github.com/${github.owner}/${github.repo}/edit/${branch}/${editPath}`;
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
};
|
|
18
|
+
// Keep the lightweight loading boundary and the menu's visibility rules in
|
|
19
|
+
// sync, including sites that disable chat through their provider.
|
|
20
|
+
export const getPageActionOptions = (config, page, chatEnabled) => {
|
|
21
|
+
const copyEnabled = config.pageActions?.copyPage !== false;
|
|
22
|
+
const openInChatEnabled = config.pageActions?.openInChat !== false;
|
|
23
|
+
const askAIEnabled = chatEnabled &&
|
|
24
|
+
config.ai?.enabled !== false &&
|
|
25
|
+
config.pageActions?.askAI !== false;
|
|
26
|
+
const editSourceUrl = getEditSourceUrl({
|
|
27
|
+
github: config.github,
|
|
28
|
+
path: page.path,
|
|
29
|
+
});
|
|
30
|
+
const editSourceEnabled = config.pageActions?.editSource !== false && Boolean(editSourceUrl);
|
|
31
|
+
return {
|
|
32
|
+
askAIEnabled,
|
|
33
|
+
copyEnabled,
|
|
34
|
+
editSourceEnabled,
|
|
35
|
+
editSourceUrl,
|
|
36
|
+
enabled: copyEnabled || openInChatEnabled || askAIEnabled || editSourceEnabled,
|
|
37
|
+
openInChatEnabled,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { GeistdocsConfig } from "../config";
|
|
3
|
-
interface PageActionsProps {
|
|
4
|
-
config: Pick<GeistdocsConfig, "ai" | "feedback" | "github" | "pageActions" | "siteId">;
|
|
5
|
-
/**
|
|
6
|
-
* Which variant to render. Defaults to both. Use "desktop" to render only
|
|
7
|
-
* the dropdown (beside the title) and "mobile" to render only the inline
|
|
8
|
-
* action row (below the title).
|
|
9
|
-
*/
|
|
10
|
-
only?: "desktop" | "mobile";
|
|
11
|
-
page: {
|
|
12
|
-
markdownUrl: string;
|
|
13
|
-
path?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Whether "Ask AI about this page" attaches the page to the next Ask AI
|
|
16
|
-
* message. Pages the chat route cannot resolve, such as changelog
|
|
17
|
-
* entries, set `false` to pre-fill a prompt with the page URL instead.
|
|
18
|
-
* @default true
|
|
19
|
-
*/
|
|
20
|
-
attachToChat?: boolean;
|
|
21
|
-
/** Page title, shown when the page is attached to an Ask AI message. */
|
|
22
|
-
title?: string;
|
|
23
|
-
url: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
interface GeistdocsTableOfContentsActionsProps {
|
|
27
|
-
config: Pick<GeistdocsConfig, "feedback" | "pageActions" | "siteId">;
|
|
28
|
-
extraActions: ReactNode[];
|
|
29
|
-
}
|
|
1
|
+
import { type PageActionsProps } from "./page-action-options";
|
|
30
2
|
export declare const GeistdocsPageActions: ({ config, page, only, }: PageActionsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
31
|
-
export declare const GeistdocsTableOfContentsActions: ({ config, extraActions, }: GeistdocsTableOfContentsActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
export {};
|
|
33
3
|
//# sourceMappingURL=page-actions-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-actions-client.d.ts","sourceRoot":"","sources":["../../src/internal/page-actions-client.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page-actions-client.d.ts","sourceRoot":"","sources":["../../src/internal/page-actions-client.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAsf/B,eAAO,MAAM,oBAAoB,GAAI,yBAIlC,gBAAgB,mDA0GlB,CAAC"}
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { IconAcronymMarkdown, IconArrowCircleUp, IconCheck, IconChevronDown, IconChevronLeft, IconChevronRight, IconCopy, IconExternal, IconMessage, IconThumbUp, } from "#geistdocs-assets/icons";
|
|
4
|
+
import { useRef, useState, } from "react";
|
|
5
|
+
import { IconAcronymMarkdown, IconCheck, IconChevronDown, IconChevronLeft, IconChevronRight, IconCopy, IconExternal, IconMessage, } from "#geistdocs-assets/icons";
|
|
7
6
|
import { LogoIconGithub, LogoIconV0 } from "#geistdocs-assets/logos";
|
|
8
|
-
import { Button } from "#geistdocs-ui/components/button";
|
|
9
|
-
import { Textarea } from "#geistdocs-ui/components/textarea";
|
|
10
7
|
import { cn } from "#geistdocs-ui/utils";
|
|
11
8
|
import { useGeistdocsChatContext } from "./chat/context";
|
|
12
|
-
import {
|
|
9
|
+
import { getPageActionOptions, } from "./page-action-options";
|
|
13
10
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "./ui/dropdown-menu";
|
|
14
|
-
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
15
11
|
import { useIsMobile } from "./use-mobile";
|
|
16
|
-
const actionClassName = "group flex min-h-8 w-full min-w-0 touch-manipulation items-center gap-2 rounded-md text-left text-gray-900 text-label-14 transition-colors hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-offset-2 focus-visible:ring-offset-background-100 motion-reduce:transition-none [&_svg]:size-4 [&_svg]:shrink-0 [&_span]:min-w-0 [&_span]:truncate";
|
|
17
12
|
// Inline page-action link (icon + label) used in the mobile action row.
|
|
18
13
|
const inlineActionClassName = "group flex touch-manipulation items-center gap-1.5 whitespace-nowrap text-gray-900 text-label-12 font-medium transition-colors hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-offset-2 focus-visible:ring-offset-background-100 motion-reduce:transition-none [&_svg]:size-3.5 [&_svg]:shrink-0";
|
|
19
|
-
const DEFAULT_EDIT_PATH = "content/docs/{path}";
|
|
20
14
|
const markdownRequests = new Map();
|
|
21
15
|
const getMarkdown = (url) => {
|
|
22
16
|
const cached = markdownRequests.get(url);
|
|
@@ -37,20 +31,6 @@ const getMarkdown = (url) => {
|
|
|
37
31
|
markdownRequests.set(url, request);
|
|
38
32
|
return request;
|
|
39
33
|
};
|
|
40
|
-
const trimSlashes = (value) => value.replace(/^\/+|\/+$/g, "");
|
|
41
|
-
const resolveEditPath = ({ editPath = DEFAULT_EDIT_PATH, path, }) => {
|
|
42
|
-
const pagePath = trimSlashes(path);
|
|
43
|
-
if (editPath.includes("{path}")) {
|
|
44
|
-
return trimSlashes(editPath.replaceAll("{path}", pagePath));
|
|
45
|
-
}
|
|
46
|
-
return `${trimSlashes(editPath)}/${pagePath}`;
|
|
47
|
-
};
|
|
48
|
-
const feedbackEmotions = [
|
|
49
|
-
{ name: "cry", emoji: "😭" },
|
|
50
|
-
{ name: "sad", emoji: "😕" },
|
|
51
|
-
{ name: "happy", emoji: "🙂" },
|
|
52
|
-
{ name: "amazed", emoji: "🤩" },
|
|
53
|
-
];
|
|
54
34
|
const openInProviders = [
|
|
55
35
|
{
|
|
56
36
|
id: "v0",
|
|
@@ -77,14 +57,6 @@ const openInProviders = [
|
|
|
77
57
|
},
|
|
78
58
|
},
|
|
79
59
|
];
|
|
80
|
-
const getEditSourceUrl = ({ github, path, }) => {
|
|
81
|
-
if (github?.owner && github?.repo && path) {
|
|
82
|
-
const branch = github.branch ?? "main";
|
|
83
|
-
const editPath = resolveEditPath({ editPath: github.editPath, path });
|
|
84
|
-
return `https://github.com/${github.owner}/${github.repo}/edit/${branch}/${editPath}`;
|
|
85
|
-
}
|
|
86
|
-
return undefined;
|
|
87
|
-
};
|
|
88
60
|
const getPageQuery = (href, origin) => {
|
|
89
61
|
const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
|
|
90
62
|
const productionHost = process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL;
|
|
@@ -108,10 +80,6 @@ const getPageQuery = (href, origin) => {
|
|
|
108
80
|
}
|
|
109
81
|
return `Read this page, I want to ask questions about it. ${url}`;
|
|
110
82
|
};
|
|
111
|
-
const ScrollTopAction = () => (_jsxs("button", { className: actionClassName, onClick: () => {
|
|
112
|
-
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
113
|
-
window.scrollTo({ top: 0, behavior: reduceMotion ? "auto" : "smooth" });
|
|
114
|
-
}, type: "button", children: [_jsx(IconArrowCircleUp, { className: "size-3.5" }), _jsx("span", { children: "Scroll to top" })] }));
|
|
115
83
|
const PageActionMenuItemContent = ({ description, icon, title, }) => (_jsxs("span", { className: "grid w-full grid-cols-[20px_minmax(0,1fr)] items-center gap-3 text-left", children: [_jsx("span", { className: "flex size-5 items-center justify-center text-gray-900", children: icon }), _jsxs("span", { className: "flex min-w-0 flex-col items-start gap-0.5", children: [_jsx("span", { className: "text-gray-1000 text-label-14", children: title }), _jsx("span", { className: "text-copy-13 text-gray-900", children: description })] })] }));
|
|
116
84
|
const OpenInProviderItems = ({ providers, query, }) => providers.map((provider) => (_jsx(DropdownMenuItem, { asChild: true, children: _jsxs("a", { className: "flex items-center gap-2 text-label-14", href: provider.getHref(query), rel: "noopener noreferrer", target: "_blank", children: [_jsx("span", { className: "flex-1", translate: "no", children: provider.label }), _jsx(IconExternal, { className: "size-4 shrink-0" })] }) }, provider.id)));
|
|
117
85
|
const ProviderMenuView = ({ backRef, onBack, providers, query, }) => (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { className: "text-label-14", onSelect: (event) => {
|
|
@@ -124,53 +92,6 @@ const PageActionsMainMenu = ({ askAIEnabled, copyEnabled, editSourceEnabled, edi
|
|
|
124
92
|
onShowProviders();
|
|
125
93
|
}, ref: openInChatRef, children: [_jsx(PageActionMenuItemContent, { description: "Use this page in another AI chat", icon: _jsx(IconExternal, { className: "size-4" }), title: "Open in another chat" }), _jsx(IconChevronRight, { className: "size-4" })] })) : (_jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { className: "h-auto p-2", children: _jsx(PageActionMenuItemContent, { description: "Use this page in another AI chat", icon: _jsx(IconExternal, { className: "size-4" }), title: "Open in another chat" }) }), _jsx(DropdownMenuSubContent, { className: "w-52", sideOffset: 12, children: _jsx(OpenInProviderItems, { providers: otherProviders, query: query }) })] }))] })) : null, askAIEnabled ? (_jsx(DropdownMenuItem, { className: "h-auto p-2", onSelect: onAskAI, children: _jsx(PageActionMenuItemContent, { description: "Chat with this page as context", icon: _jsx(IconMessage, { className: "size-4" }), title: "Ask AI about this page" }) })) : null, editSourceEnabled ? (_jsx(DropdownMenuItem, { asChild: true, className: "h-auto p-2", children: _jsx("a", { href: editSourceUrl, rel: "noopener noreferrer", target: "_blank", children: _jsx(PageActionMenuItemContent, { description: "Suggest changes to this page", icon: _jsx(LogoIconGithub, { "aria-hidden": "true", size: 16 }), title: "Edit this page on GitHub" }) }) })) : null] }));
|
|
126
94
|
};
|
|
127
|
-
const FeedbackAction = ({ siteId }) => {
|
|
128
|
-
const isMobile = useIsMobile();
|
|
129
|
-
const url = usePathname();
|
|
130
|
-
const [submitted, setSubmitted] = useState(false);
|
|
131
|
-
const [emotion, setEmotion] = useState(null);
|
|
132
|
-
const [message, setMessage] = useState("");
|
|
133
|
-
const [failed, setFailed] = useState(false);
|
|
134
|
-
const [isPending, startTransition] = useTransition();
|
|
135
|
-
useEffect(() => {
|
|
136
|
-
const item = localStorage.getItem(`docs-feedback-${url}`);
|
|
137
|
-
if (!item) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
setSubmitted(true);
|
|
141
|
-
}, [url]);
|
|
142
|
-
const submit = (event) => {
|
|
143
|
-
event.preventDefault();
|
|
144
|
-
if (!emotion) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
startTransition(async () => {
|
|
148
|
-
const feedback = {
|
|
149
|
-
emotion,
|
|
150
|
-
message,
|
|
151
|
-
};
|
|
152
|
-
const result = await sendFeedback({ url, feedback, siteId });
|
|
153
|
-
// Keep the form (and the visitor's text) so a failed submission can
|
|
154
|
-
// be retried.
|
|
155
|
-
if (!result.success) {
|
|
156
|
-
setFailed(true);
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
setFailed(false);
|
|
160
|
-
setSubmitted(true);
|
|
161
|
-
localStorage.setItem(`docs-feedback-${url}`, "1");
|
|
162
|
-
setMessage("");
|
|
163
|
-
setEmotion(null);
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
|
-
return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { className: actionClassName, type: "button", children: [_jsx(IconThumbUp, { className: "size-3.5" }), _jsx("span", { children: "Give feedback" })] }) }), _jsx(PopoverContent, { className: "overflow-hidden p-0", children: _jsx("div", { className: "overflow-visible", children: submitted ? (_jsx("div", { className: "flex flex-col items-center gap-3 rounded-xl bg-background-200 px-3 py-6 text-center text-copy-14", role: "status", children: _jsx("p", { children: "Thank you for your feedback!" }) })) : (_jsxs("form", { className: "flex flex-col", onSubmit: submit, children: [_jsx("div", { className: "p-2", children: _jsx(Textarea, { "aria-label": "Feedback", autoComplete: "off", autoFocus: !isMobile, className: "max-h-48 min-h-24 shadow-none", name: "feedback", onChange: (event) => setMessage(event.target.value), onKeyDown: (event) => {
|
|
167
|
-
if (!event.shiftKey && event.key === "Enter") {
|
|
168
|
-
event.currentTarget.form?.requestSubmit();
|
|
169
|
-
}
|
|
170
|
-
}, placeholder: "Leave your feedback\u2026", required: true, value: message }) }), _jsxs("div", { className: "flex items-center justify-end gap-1 px-2 text-gray-900", children: [_jsx(IconAcronymMarkdown, { "aria-hidden": "true", className: "inline size-3" }), _jsx("p", { className: "text-label-12", children: " supported" })] }), failed ? (_jsx("p", { className: "px-2 pb-1 text-label-12 text-red-900", role: "alert", children: "Sending feedback failed. Please try again." })) : null, _jsxs("div", { className: "mt-2 flex items-center justify-between border-t bg-background-200 p-2", children: [_jsx("div", { className: "flex items-center gap-px", children: feedbackEmotions.map((entry) => (_jsxs(Button, { className: emotion === entry.name
|
|
171
|
-
? "bg-gray-100 text-gray-1000"
|
|
172
|
-
: "text-gray-900 hover:text-gray-1000", onClick: () => setEmotion(entry.name), size: "small", type: "unstyled", typeName: "button", children: [entry.emoji, _jsx("span", { className: "sr-only", children: entry.name })] }, entry.name))) }), _jsx(Button, { disabled: isPending || !emotion || !message, size: "small", typeName: "submit", children: "Send" })] })] })) }) })] }));
|
|
173
|
-
};
|
|
174
95
|
// The mobile action row: three primary actions rendered inline below the
|
|
175
96
|
// page title.
|
|
176
97
|
const InlinePageActions = ({ askAIEnabled, checked, copyEnabled, onAskAI, onCopy, onPrefetchMarkdown, onViewMarkdown, }) => {
|
|
@@ -213,18 +134,9 @@ export const GeistdocsPageActions = ({ config, page, only, }) => {
|
|
|
213
134
|
const handleViewMarkdown = () => {
|
|
214
135
|
window.open(markdownUrl, "_blank", "noopener");
|
|
215
136
|
};
|
|
216
|
-
const editSourceUrl =
|
|
217
|
-
github: config.github,
|
|
218
|
-
path: page.path,
|
|
219
|
-
});
|
|
137
|
+
const { askAIEnabled, copyEnabled, editSourceEnabled, editSourceUrl, enabled, openInChatEnabled, } = getPageActionOptions(config, page, chatEnabled);
|
|
220
138
|
const query = getPageQuery(page.url);
|
|
221
|
-
|
|
222
|
-
const openInChatEnabled = config.pageActions?.openInChat !== false;
|
|
223
|
-
const askAIEnabled = chatEnabled &&
|
|
224
|
-
config.ai?.enabled !== false &&
|
|
225
|
-
config.pageActions?.askAI !== false;
|
|
226
|
-
const editSourceEnabled = config.pageActions?.editSource !== false && Boolean(editSourceUrl);
|
|
227
|
-
if (!(copyEnabled || openInChatEnabled || askAIEnabled || editSourceEnabled)) {
|
|
139
|
+
if (!enabled) {
|
|
228
140
|
return null;
|
|
229
141
|
}
|
|
230
142
|
const v0Provider = openInProviders[0];
|
|
@@ -247,13 +159,3 @@ export const GeistdocsPageActions = ({ config, page, only, }) => {
|
|
|
247
159
|
: "mb-2 self-end @max-[960px]:hidden";
|
|
248
160
|
return (_jsxs("div", { className: rootClassName, onFocusCapture: preloadChat, onPointerEnter: preloadChat, children: [showDesktop ? (_jsx(DesktopPageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, editSourceEnabled: editSourceEnabled, editSourceUrl: editSourceUrl, isMobile: isMobile, menuView: menuView, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown, openInChatEnabled: openInChatEnabled, openInChatRef: openInChatRef, otherProviders: otherProviders, providersBackRef: providersBackRef, query: query, setMenuView: setMenuView, v0Provider: v0Provider })) : null, showMobile && (copyEnabled || askAIEnabled) ? (_jsx(InlinePageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown })) : null, _jsx("span", { "aria-live": "polite", className: "sr-only", children: checked ? "Page copied" : "" })] }));
|
|
249
161
|
};
|
|
250
|
-
export const GeistdocsTableOfContentsActions = ({ config, extraActions, }) => {
|
|
251
|
-
const actions = [];
|
|
252
|
-
if (config.pageActions?.scrollTop !== false) {
|
|
253
|
-
actions.push(_jsx(ScrollTopAction, {}, "scroll-top"));
|
|
254
|
-
}
|
|
255
|
-
if (config.feedback?.enabled !== false) {
|
|
256
|
-
actions.push(_jsx(FeedbackAction, { siteId: config.siteId }, "feedback"));
|
|
257
|
-
}
|
|
258
|
-
return (_jsxs(_Fragment, { children: [actions, extraActions] }));
|
|
259
|
-
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-actions-gate.d.ts","sourceRoot":"","sources":["../../src/internal/page-actions-gate.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAQ/B,eAAO,MAAM,oBAAoB,GAAI,OAAO,gBAAgB,mDAW3D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { lazy, Suspense } from "react";
|
|
4
|
+
import { useGeistdocsChatContext } from "./chat/context";
|
|
5
|
+
import { getPageActionOptions, } from "./page-action-options";
|
|
6
|
+
const PageActions = lazy(() => import("./page-actions-client").then((module) => ({
|
|
7
|
+
default: module.GeistdocsPageActions,
|
|
8
|
+
})));
|
|
9
|
+
export const GeistdocsPageActions = (props) => {
|
|
10
|
+
const { enabled: chatEnabled } = useGeistdocsChatContext();
|
|
11
|
+
if (!getPageActionOptions(props.config, props.page, chatEnabled).enabled) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return (_jsx(Suspense, { fallback: null, children: _jsx(PageActions, { ...props }) }));
|
|
15
|
+
};
|
|
@@ -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;
|
|
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;AAqJD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAQ9D,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { RootProvider } from "fumadocs-ui/provider/next";
|
|
4
4
|
import { lazy, Suspense, useCallback, useEffect, } from "react";
|
|
5
5
|
import { Toasts } from "#geistdocs-ui/components/toasts";
|
|
6
|
-
import { GeistProvider } from "#geistdocs-ui/core";
|
|
6
|
+
import { GeistProvider, useTheme } from "#geistdocs-ui/core";
|
|
7
7
|
import { GeistdocsChatProvider, useGeistdocsChatContext } from "./chat/context";
|
|
8
8
|
import { ChatLoadingSkeleton } from "./chat/loading-skeleton";
|
|
9
9
|
import { GeistdocsConfigProvider } from "./config-context";
|
|
@@ -18,6 +18,7 @@ const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props
|
|
|
18
18
|
const { i18n, i18nProvider } = createGeistdocsI18n(config);
|
|
19
19
|
const { enabled, hasBeenOpened, isExpanded, isOpen, setIsExpanded, setIsOpen, } = useGeistdocsChatContext();
|
|
20
20
|
const isMobile = useIsMobile();
|
|
21
|
+
const { forcedTheme, resolvedTheme, setTheme } = useTheme();
|
|
21
22
|
useEffect(() => {
|
|
22
23
|
if (!enabled) {
|
|
23
24
|
return;
|
|
@@ -57,6 +58,30 @@ const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props
|
|
|
57
58
|
document.removeEventListener("keydown", handleShortcut, true);
|
|
58
59
|
};
|
|
59
60
|
}, [enabled, isExpanded, isMobile, isOpen, setIsExpanded, setIsOpen]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (forcedTheme) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const handleThemeShortcut = (event) => {
|
|
66
|
+
if (event.metaKey ||
|
|
67
|
+
event.ctrlKey ||
|
|
68
|
+
event.altKey ||
|
|
69
|
+
event.shiftKey ||
|
|
70
|
+
event.key.toLowerCase() !== "t") {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const activeElement = document.activeElement;
|
|
74
|
+
if (activeElement &&
|
|
75
|
+
activeElement !== document.body &&
|
|
76
|
+
activeElement !== document.documentElement) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
81
|
+
};
|
|
82
|
+
window.addEventListener("keydown", handleThemeShortcut);
|
|
83
|
+
return () => window.removeEventListener("keydown", handleThemeShortcut);
|
|
84
|
+
}, [forcedTheme, resolvedTheme, setTheme]);
|
|
60
85
|
// fumadocs spreads the provider's `search.options` onto the dialog, which is
|
|
61
86
|
// how a consumer reaches `tag`. Typed here so it survives the hand-off.
|
|
62
87
|
const SearchDialogComponent = useCallback((searchProps) => (_jsx(GeistdocsLazySearchDialog, { basePath: config.basePath, ...searchProps })), [config.basePath]);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentProps, ComponentType } from "react";
|
|
2
|
+
import type { GeistdocsSourceBundle } from "../source";
|
|
3
|
+
export declare const createRelativeDocsLink: (source: Pick<GeistdocsSourceBundle["source"], "getPageByHref">, page: {
|
|
4
|
+
locale?: string;
|
|
5
|
+
path: string;
|
|
6
|
+
}, Link: ComponentType<ComponentProps<"a">>) => ({ href, ...props }: ComponentProps<"a">) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=relative-docs-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relative-docs-link.d.ts","sourceRoot":"","sources":["../../src/internal/relative-docs-link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAIvD,eAAO,MAAM,sBAAsB,GACjC,QAAQ,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC,EAC9D,MAAM;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACvC,MAAM,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,0BAEM,cAAc,CAAC,GAAG,CAAC,4CAgBlE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
// Resolve through the same source loader without importing Fumadocs' entire
|
|
4
|
+
// default MDX component map just to get its relative-link helper.
|
|
5
|
+
export const createRelativeDocsLink = (source, page, Link) => {
|
|
6
|
+
const RelativeDocsLink = ({ href, ...props }) => {
|
|
7
|
+
let resolvedHref = href;
|
|
8
|
+
if (href?.startsWith(".")) {
|
|
9
|
+
const target = source.getPageByHref(href, {
|
|
10
|
+
dir: dirname(page.path),
|
|
11
|
+
language: page.locale,
|
|
12
|
+
});
|
|
13
|
+
if (target) {
|
|
14
|
+
resolvedHref = target.hash
|
|
15
|
+
? `${target.page.url}#${target.hash}`
|
|
16
|
+
: target.page.url;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return _jsx(Link, { href: resolvedHref, ...props });
|
|
20
|
+
};
|
|
21
|
+
return RelativeDocsLink;
|
|
22
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,OAAO,CAAC;AAef,OAAO,EAAE,KAAK,oBAAoB,EAAuB,MAAM,YAAY,CAAC;AAw/B5E,eAAO,MAAM,gBAAgB,GAAI,6CAK9B;IACD,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,2EAA2E;IAC3E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,4CAkEA,CAAC"}
|
package/dist/internal/sidebar.js
CHANGED
|
@@ -8,8 +8,8 @@ import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState, } from "r
|
|
|
8
8
|
import { IconArrowUpRightSmall, IconChevronRightSmall, IconCross, } from "#geistdocs-assets/icons";
|
|
9
9
|
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from "#geistdocs-ui/components/sheet";
|
|
10
10
|
import { cn } from "#geistdocs-ui/utils";
|
|
11
|
-
import { SearchButton } from "../controls";
|
|
12
11
|
import { useGeistdocsSidebar } from "../sidebar";
|
|
12
|
+
import { SearchButton } from "./controls-client";
|
|
13
13
|
import { MouseDownNavigation } from "./mousedown-navigation";
|
|
14
14
|
import { SIDEBAR_DESKTOP_MIN_WIDTH } from "./sidebar-responsive";
|
|
15
15
|
import { findActiveRootSection, getDescendantFolderIds, getFolderLinkClickAction, getInitialOpenFolderIds, getSidebarBadgeTone, getSidebarItemBadge, getSidebarNodeId, getSidebarRootGroups, getSidebarSectionItems, hasSeparateRootDisclosure, isExternalSidebarItem, isExternalSidebarUrl, isSidebarItemCurrent, openFolderId, toggleFolderId, } from "./sidebar-tree";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { GeistdocsConfig } from "../config";
|
|
3
|
+
interface GeistdocsTableOfContentsActionsProps {
|
|
4
|
+
config: Pick<GeistdocsConfig, "feedback" | "pageActions" | "siteId">;
|
|
5
|
+
extraActions: ReactNode[];
|
|
6
|
+
}
|
|
7
|
+
export declare const GeistdocsTableOfContentsActions: ({ config, extraActions, }: GeistdocsTableOfContentsActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=toc-actions-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toc-actions-client.d.ts","sourceRoot":"","sources":["../../src/internal/toc-actions-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAQf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,UAAU,oCAAoC;IAC5C,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;IACrE,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B;AAwKD,eAAO,MAAM,+BAA+B,GAAI,2BAG7C,oCAAoC,4CAiBtC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { usePathname } from "next/navigation";
|
|
4
|
+
import { useEffect, useState, useTransition, } from "react";
|
|
5
|
+
import { IconAcronymMarkdown, IconArrowCircleUp, IconThumbUp, } from "#geistdocs-assets/icons";
|
|
6
|
+
import { Button } from "#geistdocs-ui/components/button";
|
|
7
|
+
import { Textarea } from "#geistdocs-ui/components/textarea";
|
|
8
|
+
import { sendFeedback } from "./feedback-action";
|
|
9
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
10
|
+
import { useIsMobile } from "./use-mobile";
|
|
11
|
+
const actionClassName = "group flex min-h-8 w-full min-w-0 touch-manipulation items-center gap-2 rounded-md text-left text-gray-900 text-label-14 transition-colors hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-offset-2 focus-visible:ring-offset-background-100 motion-reduce:transition-none [&_svg]:size-4 [&_svg]:shrink-0 [&_span]:min-w-0 [&_span]:truncate";
|
|
12
|
+
const feedbackEmotions = [
|
|
13
|
+
{ name: "cry", emoji: "😭" },
|
|
14
|
+
{ name: "sad", emoji: "😕" },
|
|
15
|
+
{ name: "happy", emoji: "🙂" },
|
|
16
|
+
{ name: "amazed", emoji: "🤩" },
|
|
17
|
+
];
|
|
18
|
+
const ScrollTopAction = () => (_jsxs("button", { className: actionClassName, onClick: () => {
|
|
19
|
+
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
20
|
+
window.scrollTo({ top: 0, behavior: reduceMotion ? "auto" : "smooth" });
|
|
21
|
+
}, type: "button", children: [_jsx(IconArrowCircleUp, { className: "size-3.5" }), _jsx("span", { children: "Scroll to top" })] }));
|
|
22
|
+
const FeedbackAction = ({ siteId }) => {
|
|
23
|
+
const isMobile = useIsMobile();
|
|
24
|
+
const url = usePathname();
|
|
25
|
+
const [submitted, setSubmitted] = useState(false);
|
|
26
|
+
const [emotion, setEmotion] = useState(null);
|
|
27
|
+
const [message, setMessage] = useState("");
|
|
28
|
+
const [failed, setFailed] = useState(false);
|
|
29
|
+
const [isPending, startTransition] = useTransition();
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const item = localStorage.getItem(`docs-feedback-${url}`);
|
|
32
|
+
if (!item) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
setSubmitted(true);
|
|
36
|
+
}, [url]);
|
|
37
|
+
const submit = (event) => {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
if (!emotion) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
startTransition(async () => {
|
|
43
|
+
const feedback = {
|
|
44
|
+
emotion,
|
|
45
|
+
message,
|
|
46
|
+
};
|
|
47
|
+
const result = await sendFeedback({ url, feedback, siteId });
|
|
48
|
+
// Keep the form (and the visitor's text) so a failed submission can
|
|
49
|
+
// be retried.
|
|
50
|
+
if (!result.success) {
|
|
51
|
+
setFailed(true);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
setFailed(false);
|
|
55
|
+
setSubmitted(true);
|
|
56
|
+
localStorage.setItem(`docs-feedback-${url}`, "1");
|
|
57
|
+
setMessage("");
|
|
58
|
+
setEmotion(null);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { className: actionClassName, type: "button", children: [_jsx(IconThumbUp, { className: "size-3.5" }), _jsx("span", { children: "Give feedback" })] }) }), _jsx(PopoverContent, { className: "overflow-hidden p-0", children: _jsx("div", { className: "overflow-visible", children: submitted ? (_jsx("div", { className: "flex flex-col items-center gap-3 rounded-xl bg-background-200 px-3 py-6 text-center text-copy-14", role: "status", children: _jsx("p", { children: "Thank you for your feedback!" }) })) : (_jsxs("form", { className: "flex flex-col", onSubmit: submit, children: [_jsx("div", { className: "p-2", children: _jsx(Textarea, { "aria-label": "Feedback", autoComplete: "off", autoFocus: !isMobile, className: "max-h-48 min-h-24 shadow-none", name: "feedback", onChange: (event) => setMessage(event.target.value), onKeyDown: (event) => {
|
|
62
|
+
if (!event.shiftKey && event.key === "Enter") {
|
|
63
|
+
event.currentTarget.form?.requestSubmit();
|
|
64
|
+
}
|
|
65
|
+
}, placeholder: "Leave your feedback\u2026", required: true, value: message }) }), _jsxs("div", { className: "flex items-center justify-end gap-1 px-2 text-gray-900", children: [_jsx(IconAcronymMarkdown, { "aria-hidden": "true", className: "inline size-3" }), _jsx("p", { className: "text-label-12", children: " supported" })] }), failed ? (_jsx("p", { className: "px-2 pb-1 text-label-12 text-red-900", role: "alert", children: "Sending feedback failed. Please try again." })) : null, _jsxs("div", { className: "mt-2 flex items-center justify-between border-t bg-background-200 p-2", children: [_jsx("div", { className: "flex items-center gap-px", children: feedbackEmotions.map((entry) => (_jsxs(Button, { className: emotion === entry.name
|
|
66
|
+
? "bg-gray-100 text-gray-1000"
|
|
67
|
+
: "text-gray-900 hover:text-gray-1000", onClick: () => setEmotion(entry.name), size: "small", type: "unstyled", typeName: "button", children: [entry.emoji, _jsx("span", { className: "sr-only", children: entry.name })] }, entry.name))) }), _jsx(Button, { disabled: isPending || !emotion || !message, size: "small", typeName: "submit", children: "Send" })] })] })) }) })] }));
|
|
68
|
+
};
|
|
69
|
+
export const GeistdocsTableOfContentsActions = ({ config, extraActions, }) => {
|
|
70
|
+
const actions = [];
|
|
71
|
+
if (config.pageActions?.scrollTop !== false) {
|
|
72
|
+
actions.push(_jsx(ScrollTopAction, {}, "scroll-top"));
|
|
73
|
+
}
|
|
74
|
+
if (config.feedback?.enabled !== false) {
|
|
75
|
+
actions.push(_jsx(FeedbackAction, { siteId: config.siteId }, "feedback"));
|
|
76
|
+
}
|
|
77
|
+
return (_jsxs(_Fragment, { children: [actions, extraActions] }));
|
|
78
|
+
};
|
package/dist/mdx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAiC/C,OAAO,KAAK,EAAE,4BAA4B,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAK3F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAC1C,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,eAAO,MAAM,yBAAyB,GACpC,aAAa,sBAAsB,KAClC,sBAsED,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAC9B,aAAa,sBAAsB,KAClC,sBAA+D,CAAC;AAEnE,eAAO,MAAM,2BAA2B,GACtC,GAAG,eAAe,KAAK,CAAC,sBAAsB,GAAG,SAAS,CAAC,KAC1D,sBACkD,CAAC"}
|
package/dist/mdx.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { Image as FrameworkImage } from "fumadocs-core/framework";
|
|
3
|
+
import { Card, Cards } from "fumadocs-ui/components/card";
|
|
3
4
|
import Link from "next/link";
|
|
4
5
|
import { cn } from "#geistdocs-ui/utils";
|
|
5
6
|
import { Blockquote } from "./components/blockquote";
|
|
@@ -21,7 +22,9 @@ import { geistShikiTheme as shikiTheme } from "./shiki-theme";
|
|
|
21
22
|
// language grammar, into every server function that renders MDX.
|
|
22
23
|
export const geistShikiTheme = shikiTheme;
|
|
23
24
|
export const getGeistdocsMDXComponents = (components) => ({
|
|
24
|
-
|
|
25
|
+
Card,
|
|
26
|
+
Cards,
|
|
27
|
+
img: (props) => (_jsx(FrameworkImage, { sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px", ...props, className: cn("rounded-lg", props.className), src: props.src })),
|
|
25
28
|
h1: (props) => _jsx(Heading, { as: "h1", ...props }),
|
|
26
29
|
h2: (props) => _jsx(Heading, { as: "h2", ...props }),
|
|
27
30
|
h3: (props) => _jsx(Heading, { as: "h3", ...props }),
|
package/dist/navbar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AskAIButton, SearchButton } from "./controls";
|
|
2
|
+
import { AskAIButton, SearchButton } from "./internal/controls-client";
|
|
3
3
|
import { GitHubButton, getGithubRepoUrl } from "./internal/github-button";
|
|
4
4
|
import { DesktopMenu } from "./internal/navbar/desktop-menu";
|
|
5
5
|
import { MobileMenu } from "./internal/navbar/mobile-menu";
|
package/dist/pages/changelog.js
CHANGED
|
@@ -3,7 +3,7 @@ import { notFound, redirect } from "next/navigation";
|
|
|
3
3
|
import { getChangelogPage, getChangelogPageParams, getChangelogPagePath, getChangelogPath, parseChangelogPage, } from "../internal/changelog";
|
|
4
4
|
import { ChangelogFeed } from "../internal/changelog-feed";
|
|
5
5
|
import { getGeistdocsLanguageConfig, getLanguageStaticParams, omitLanguageParam, resolveRouteLanguage, } from "../internal/languages";
|
|
6
|
-
import { GeistdocsPageActions } from "../internal/page-actions-
|
|
6
|
+
import { GeistdocsPageActions } from "../internal/page-actions-gate";
|
|
7
7
|
const TRAILING_SLASH_PATTERN = /\/$/;
|
|
8
8
|
export const createChangelogPage = (options) => {
|
|
9
9
|
const { config, source, path = "/changelog", title = "Changelog", description = "The latest releases, improvements, and fixes.", getLang, markdownPath, dataPath, pageSize = 10, } = options;
|
package/dist/pages/docs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,WAAW,CAAC;AAgB9E,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAChF,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,KAAK,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;AACvC,KAAK,qBAAqB,GAAG,WAAW,CACtC,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CAC1D,CAAC;AACF,MAAM,WAAW,cACf,SAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB,CACpC,MAAM,SAAS,cAAc,GAAG,cAAc;IAE9C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,MAAM,oBAAoB,CAC9B,MAAM,SAAS,cAAc,GAAG,cAAc,IAC5C,CACF,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,qBAAqB,CAAC,MAAM,CAAC,KACnC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhC,KAAK,WAAW,GACZ,aAAa,GACb,CAAC,CAAC,OAAO,EAAE;IACT,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;CACtB,KAAK,aAAa,CAAC,CAAC;AAEzB,KAAK,eAAe,GAAG,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEpE,UAAU,wBAAwB;IAChC,MAAM,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;CACpC;AA4BD,UAAU,cAAc,CAAC,MAAM,SAAS,cAAc,GAAG,cAAc;IACrE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,oBAAoB,CAAC,MAAM,SAAS,cAAc,GAAG,cAAc,CAC3E,SAAQ,cAAc,CAAC,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,kBAAkB,CAAC,MAAM,SAAS,cAAc,GAAG,cAAc,CACzE,SAAQ,oBAAoB,CAAC,MAAM,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,sBAAsB,GACjC,SAAS,6BAA6B,WACI,CAAC;AAE7C,UAAU,YAAa,SAAQ,2BAA2B;IACxD,IAAI,EAAE,aAAa,CAAC;QAAE,UAAU,CAAC,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,qBAAqB,CACpC,MAAM,SAAS,cAAc,GAAG,cAAc;IAE9C,4EAA4E;IAC5E,WAAW,CAAC,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,EAAE,IAAI,CACV,eAAe,EACb,IAAI,GACJ,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,QAAQ,GACR,aAAa,GACb,QAAQ,GACR,gBAAgB,GAChB,SAAS,CACZ,CAAC;IACF,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC;IACzD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;IACjE,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;IACzD,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;IACrE,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE;QACnB,QAAQ,EAAE,QAAQ,CAAC;QACnB,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;KAChB,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,wBAAwB,CAAC;IACrC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE;QACpB,IAAI,EAAE,YAAY,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,aAAa,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;KACvB,KAAK,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE;QACtB,IAAI,EAAE,YAAY,CAAC;QACnB,UAAU,EAAE,OAAO,cAAc,CAAC;QAClC,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,YAAY,CAAC;KACtB,KAAK,YAAY,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,qBAAqB,CAAC,EAAE,cAAc,CACpC,OAAO,gBAAgB,CACxB,CAAC,uBAAuB,CAAC,CAAC;CAC5B;AAmDD,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,cAAc,GAAG,cAAc,EAAE,0MAgB5E,qBAAqB,CAAC,MAAM,CAAC;uBAgPJ;QAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE;0BAvKlB,MAAM;;;;oCAwLtC;QACD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KACzB,KAAG,OAAO,CAAC,QAAQ,CAAC;CAqDtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAA4B,CAAC"}
|
package/dist/pages/docs.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Link from "fumadocs-core/link";
|
|
3
3
|
import { DocsBody as FumadocsDocsBody, DocsPage as FumadocsDocsPage, DocsTitle as FumadocsDocsTitle, } from "fumadocs-ui/layouts/docs/page";
|
|
4
|
-
import { createRelativeLink } from "fumadocs-ui/mdx";
|
|
5
4
|
import { notFound } from "next/navigation";
|
|
6
5
|
import { cache, } from "react";
|
|
7
6
|
import { cn } from "#geistdocs-ui/utils";
|
|
@@ -14,11 +13,13 @@ import { omitLanguageParam, resolveRouteLanguage } from "../internal/languages";
|
|
|
14
13
|
import { resolveLinkHref, stripBasePathFromHref } from "../internal/link-href";
|
|
15
14
|
import { resolvePageMarkdownUrl as resolveInternalPageMarkdownUrl } from "../internal/markdown-url.js";
|
|
16
15
|
import { createPageActions as createInternalPageActions } from "../internal/page-actions";
|
|
17
|
-
import { GeistdocsPageActions
|
|
16
|
+
import { GeistdocsPageActions } from "../internal/page-actions-gate";
|
|
18
17
|
import { PageBreadcrumb } from "../internal/page-breadcrumb";
|
|
19
18
|
import { getPageFooterItems, PageFooter } from "../internal/page-footer";
|
|
20
19
|
import { filterPageTree } from "../internal/page-tree-visibility";
|
|
20
|
+
import { createRelativeDocsLink } from "../internal/relative-docs-link";
|
|
21
21
|
import { GeistdocsTableOfContents } from "../internal/table-of-contents";
|
|
22
|
+
import { GeistdocsTableOfContentsActions } from "../internal/toc-actions-client";
|
|
22
23
|
import { createMdxComponents } from "../mdx";
|
|
23
24
|
import { getPageRobots, } from "../page-visibility";
|
|
24
25
|
const renderPrefetchedDocsLink = (siteUrl, basePath, { children, className, href, rel, target, ...props }) => {
|
|
@@ -106,7 +107,7 @@ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions =
|
|
|
106
107
|
const pageTree = await getPageTree(resolvedParams);
|
|
107
108
|
const data = page.data;
|
|
108
109
|
const MDX = data.body;
|
|
109
|
-
const defaultLink =
|
|
110
|
+
const defaultLink = createRelativeDocsLink(source.source, page, DocsLink);
|
|
110
111
|
const link = resolveLink
|
|
111
112
|
? resolveLink({
|
|
112
113
|
link: defaultLink,
|
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.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.14.7 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.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.14.7.
|
|
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
|
|
@@ -2509,6 +2509,9 @@ The provider handles these behaviors:
|
|
|
2509
2509
|
2. **Analytics**: Integrates Vercel Analytics and Speed Insights when the local adapter includes them.
|
|
2510
2510
|
3. **Search**: Configures the search dialog and connects it to your search API.
|
|
2511
2511
|
4. **Ask AI**: Provides the client state used by the chat sidebar and page actions.
|
|
2512
|
+
5. **Theme shortcut**: Press `T` with no modifiers while the page has focus to switch between light and dark themes. The shortcut is disabled when a theme is forced.
|
|
2513
|
+
|
|
2514
|
+
The shortcut is part of the package provider, so generated consumer projects get it by default. It does not run while an input, button, link, or other element has focus.
|
|
2512
2515
|
|
|
2513
2516
|
## Usage
|
|
2514
2517
|
|
package/docs/manifest.json
CHANGED
package/docs/pages/provider.md
CHANGED
|
@@ -25,6 +25,9 @@ The provider handles these behaviors:
|
|
|
25
25
|
2. **Analytics**: Integrates Vercel Analytics and Speed Insights when the local adapter includes them.
|
|
26
26
|
3. **Search**: Configures the search dialog and connects it to your search API.
|
|
27
27
|
4. **Ask AI**: Provides the client state used by the chat sidebar and page actions.
|
|
28
|
+
5. **Theme shortcut**: Press `T` with no modifiers while the page has focus to switch between light and dark themes. The shortcut is disabled when a theme is forced.
|
|
29
|
+
|
|
30
|
+
The shortcut is part of the package provider, so generated consumer projects get it by default. It does not run while an input, button, link, or other element has focus.
|
|
28
31
|
|
|
29
32
|
## Usage
|
|
30
33
|
|
package/package.json
CHANGED
|
@@ -23,6 +23,9 @@ The provider handles these behaviors:
|
|
|
23
23
|
2. **Analytics**: Integrates Vercel Analytics and Speed Insights when the local adapter includes them.
|
|
24
24
|
3. **Search**: Configures the search dialog and connects it to your search API.
|
|
25
25
|
4. **Ask AI**: Provides the client state used by the chat sidebar and page actions.
|
|
26
|
+
5. **Theme shortcut**: Press `T` with no modifiers while the page has focus to switch between light and dark themes. The shortcut is disabled when a theme is forced.
|
|
27
|
+
|
|
28
|
+
The shortcut is part of the package provider, so generated consumer projects get it by default. It does not run while an input, button, link, or other element has focus.
|
|
26
29
|
|
|
27
30
|
## Usage
|
|
28
31
|
|
package/template/package.json
CHANGED