@theguild/components 9.0.0-alpha-20250114081532-be0c7eff66d202aae63bc434b3f1b34eeb4d865d → 9.0.0

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.
@@ -0,0 +1,12 @@
1
+ import * as react from 'react';
2
+ import { FC } from 'react';
3
+
4
+ declare const ComparisonTable: FC<react.DetailedHTMLProps<react.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>> & {
5
+ Row: FC<react.ClassAttributes<HTMLTableRowElement> & react.HTMLAttributes<HTMLTableRowElement> & {
6
+ highlight?: boolean;
7
+ }>;
8
+ Header: FC<react.DetailedHTMLProps<react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
9
+ Cell: FC<react.DetailedHTMLProps<react.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>>;
10
+ };
11
+
12
+ export { ComparisonTable };
@@ -0,0 +1,43 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cn } from "@theguild/components";
3
+ const Table = ({ className, ...props }) => {
4
+ return /* @__PURE__ */ jsx(
5
+ "table",
6
+ {
7
+ className: cn(
8
+ "x:block x:overflow-x-auto nextra-scrollbar overflow-x-auto rounded-2xl border border-green-200",
9
+ className
10
+ ),
11
+ ...props
12
+ }
13
+ );
14
+ };
15
+ const TableRow = ({
16
+ highlight,
17
+ className,
18
+ ...props
19
+ }) => {
20
+ return /* @__PURE__ */ jsx("tr", { className: cn(highlight && "bg-green-100", className), ...props });
21
+ };
22
+ const cellStyle = cn(
23
+ "border border-green-200 p-4 first:border-l-0 last:border-r-0",
24
+ "[tbody_&]:border-b-0 [thead_&]:border-t-0",
25
+ "first:sticky",
26
+ "first:left-0",
27
+ "max-sm:first:drop-shadow-2xl",
28
+ "first:bg-[rgb(var(--nextra-bg))]"
29
+ );
30
+ const TableHeader = ({ className, ...props }) => {
31
+ return /* @__PURE__ */ jsx("th", { className: cn(cellStyle, "font-medium", className), ...props });
32
+ };
33
+ const TableCell = ({ className, ...props }) => {
34
+ return /* @__PURE__ */ jsx("td", { className: cn(cellStyle, className), ...props });
35
+ };
36
+ const ComparisonTable = Object.assign(Table, {
37
+ Row: TableRow,
38
+ Header: TableHeader,
39
+ Cell: TableCell
40
+ });
41
+ export {
42
+ ComparisonTable
43
+ };
@@ -6,7 +6,7 @@ const SvgHighlightDecoration = (props) => /* @__PURE__ */ jsxs("svg", { width: 8
6
6
  /* @__PURE__ */ jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }),
7
7
  /* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: 175, result: "effect1_foregroundBlur_711_1774" })
8
8
  ] }) }),
9
- /* @__PURE__ */ jsx("style", { children: "\n @supports (-moz-appearance: none) {\n .firefox-highlight-fix {\n opacity: 0.3;\n filter: blur(175px);\n }\n }\n " })
9
+ /* @__PURE__ */ jsx("style", { children: "@supports (-moz-appearance: none) {\n .firefox-highlight-fix {\n opacity: 0.3;\n filter: blur(175px);\n }\n }" })
10
10
  ] });
11
11
  export {
12
12
  SvgHighlightDecoration as ReactComponent
@@ -25,7 +25,7 @@ function ExploreMainProductCards({
25
25
  TextLink,
26
26
  {
27
27
  href: isHive ? "/ecosystem" : "https://the-guild.dev/graphql/hive/ecosystem",
28
- className: "mt-4 lg:mt-6",
28
+ className: "mt-4 text-green-800 lg:mt-6",
29
29
  children: [
30
30
  "Learn more",
31
31
  /* @__PURE__ */ jsx(ArrowIcon, {})
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+
3
+ declare const AttachPageFAQSchema: FC<{
4
+ faqPages: string[];
5
+ }>;
6
+
7
+ export { AttachPageFAQSchema };
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { useEffect } from "react";
3
+ import { usePathname } from "next/navigation";
4
+ const AttachPageFAQSchema = ({ faqPages }) => {
5
+ const pathname = usePathname();
6
+ useEffect(() => {
7
+ const html = document.querySelector("html");
8
+ if (faqPages.includes(pathname) && !html.hasAttribute("itemscope")) {
9
+ html.setAttribute("itemscope", "");
10
+ html.setAttribute("itemtype", "https://schema.org/FAQPage");
11
+ return () => {
12
+ html.removeAttribute("itemscope");
13
+ html.removeAttribute("itemtype");
14
+ };
15
+ }
16
+ }, []);
17
+ return null;
18
+ };
19
+ export {
20
+ AttachPageFAQSchema
21
+ };
@@ -0,0 +1,9 @@
1
+ import { FC, ComponentProps, ReactElement } from 'react';
2
+ import { AttachPageFAQSchema } from './attach-page-faq-schema.mjs';
3
+
4
+ declare const FrequentlyAskedQuestions: FC<ComponentProps<typeof AttachPageFAQSchema> & {
5
+ className?: string;
6
+ children: ReactElement;
7
+ }>;
8
+
9
+ export { FrequentlyAskedQuestions };
@@ -0,0 +1,90 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import {
3
+ Children,
4
+ cloneElement
5
+ } from "react";
6
+ import * as RadixAccordion from "@radix-ui/react-accordion";
7
+ import { ChevronDownIcon } from "@radix-ui/react-icons";
8
+ import { cn } from "../../cn";
9
+ import { Anchor } from "../anchor";
10
+ import { Heading } from "../heading";
11
+ import { AttachPageFAQSchema } from "./attach-page-faq-schema";
12
+ const UnwrapChild = (props) => props.children;
13
+ const a = (props) => /* @__PURE__ */ jsx(
14
+ Anchor,
15
+ {
16
+ className: "hive-focus rounded underline hover:text-blue-700",
17
+ ...props,
18
+ href: props.href,
19
+ children: props.children
20
+ }
21
+ );
22
+ const h2 = (props) => /* @__PURE__ */ jsx(Heading, { as: "h2", size: "md", className: "basis-1/2", ...props });
23
+ const FrequentlyAskedQuestions = ({ className, faqPages, children }) => {
24
+ return /* @__PURE__ */ jsxs(
25
+ "section",
26
+ {
27
+ className: cn(
28
+ className,
29
+ "flex flex-col gap-x-6 gap-y-2 px-4 py-6 text-green-1000 md:flex-row md:px-10 lg:gap-x-24 lg:px-[120px] lg:py-24"
30
+ ),
31
+ children: [
32
+ /* @__PURE__ */ jsx(AttachPageFAQSchema, { faqPages }),
33
+ cloneElement(children, {
34
+ components: {
35
+ a,
36
+ h2,
37
+ p: UnwrapChild,
38
+ ul: Accordion,
39
+ li: AccordionItem
40
+ }
41
+ })
42
+ ]
43
+ }
44
+ );
45
+ };
46
+ const Accordion = (props) => /* @__PURE__ */ jsx(RadixAccordion.Root, { asChild: true, type: "single", collapsible: true, children: /* @__PURE__ */ jsx("ul", { className: "basis-1/2 divide-y divide-beige-400 max-xl:grow", ...props }) });
47
+ const AccordionItem = (props) => {
48
+ const texts = Children.toArray(props.children).filter((child) => child !== "\n");
49
+ if (texts.length === 0) {
50
+ return null;
51
+ }
52
+ if (texts.length < 2) {
53
+ console.error(texts);
54
+ throw new Error(`Expected a question and an answer, got ${texts.length} items`);
55
+ }
56
+ const [first, ...answers] = texts;
57
+ const question = typeof first === "string" ? first : typeof first === "object" && "type" in first ? first.props.children : null;
58
+ if (!question) return null;
59
+ return /* @__PURE__ */ jsx(
60
+ RadixAccordion.Item,
61
+ {
62
+ asChild: true,
63
+ value: question,
64
+ className: "relative pb-0 focus-within:z-10 data-[state=open]:pb-4",
65
+ itemScope: true,
66
+ itemProp: "mainEntity",
67
+ itemType: "https://schema.org/Question",
68
+ children: /* @__PURE__ */ jsxs("li", { children: [
69
+ /* @__PURE__ */ jsx(RadixAccordion.Header, { children: /* @__PURE__ */ jsxs(RadixAccordion.Trigger, { className: "hive-focus duration-[.8s] -mx-2 my-1 flex w-[calc(100%+1rem)] items-center justify-between rounded-xl bg-white px-2 py-3 text-left font-medium transition-colors hover:bg-beige-100/80 md:my-2 md:py-4", children: [
70
+ /* @__PURE__ */ jsx("span", { itemProp: "name", children: question }),
71
+ /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-5 [[data-state='open']_&]:[transform:rotateX(180deg)]" })
72
+ ] }) }),
73
+ /* @__PURE__ */ jsx(
74
+ RadixAccordion.Content,
75
+ {
76
+ forceMount: true,
77
+ className: "overflow-hidden bg-white text-green-800 data-[state=closed]:hidden",
78
+ itemScope: true,
79
+ itemProp: "acceptedAnswer",
80
+ itemType: "https://schema.org/Answer",
81
+ children: /* @__PURE__ */ jsx("div", { itemProp: "text", className: "space-y-2", children: answers.map((answer, i) => /* @__PURE__ */ jsx("p", { children: answer }, i)) })
82
+ }
83
+ )
84
+ ] })
85
+ }
86
+ );
87
+ };
88
+ export {
89
+ FrequentlyAskedQuestions
90
+ };
@@ -1,6 +1,8 @@
1
1
  import { FC } from 'react';
2
2
  import { GiscusProps } from '@giscus/react';
3
3
 
4
- declare const Giscus: FC<GiscusProps>;
4
+ declare const Giscus: FC<Omit<GiscusProps, 'mapping'> & {
5
+ mapping?: GiscusProps['mapping'];
6
+ }>;
5
7
 
6
8
  export { Giscus };
@@ -1,13 +1,10 @@
1
1
  "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { jsx } from "react/jsx-runtime";
3
3
  import { useTheme } from "nextra-theme-docs";
4
- import { default as _Giscus } from "@giscus/react";
4
+ import { default as Giscus_ } from "@giscus/react";
5
5
  const Giscus = (props) => {
6
6
  const { resolvedTheme } = useTheme();
7
- return /* @__PURE__ */ jsxs(Fragment, { children: [
8
- /* @__PURE__ */ jsx("br", {}),
9
- /* @__PURE__ */ jsx(_Giscus, { theme: resolvedTheme, ...props })
10
- ] });
7
+ return /* @__PURE__ */ jsx(Giscus_, { theme: resolvedTheme, mapping: "pathname", ...props });
11
8
  };
12
9
  export {
13
10
  Giscus
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import react__default, { ReactNode, ComponentProps } from 'react';
2
+ import react__default, { ReactNode, ReactElement, ComponentProps } from 'react';
3
3
  import { Search } from 'nextra/components';
4
4
  export { GraphQLConfCard, GraphQLConfCardProps } from './graphql-conf-card.mjs';
5
5
  import 'next/image';
@@ -18,6 +18,7 @@ type HiveNavigationProps = {
18
18
  children: ReactNode;
19
19
  }[];
20
20
  developerMenu: DeveloperMenuProps['developerMenu'];
21
+ search?: ReactElement;
21
22
  searchProps?: ComponentProps<typeof Search>;
22
23
  };
23
24
  /**
@@ -32,7 +33,7 @@ type HiveNavigationProps = {
32
33
  * </HiveNavigation>
33
34
  * ```
34
35
  */
35
- declare function HiveNavigation({ companyMenuChildren, children, className, productName, logo, navLinks, developerMenu, searchProps, }: HiveNavigationProps): react_jsx_runtime.JSX.Element;
36
+ declare function HiveNavigation({ companyMenuChildren, children, className, productName, logo, navLinks, developerMenu, search, }: HiveNavigationProps): react_jsx_runtime.JSX.Element;
36
37
  interface ProductsMenuProps extends MenuContentColumnsProps {
37
38
  productName: string;
38
39
  }
@@ -51,7 +51,7 @@ function HiveNavigation({
51
51
  }
52
52
  ],
53
53
  developerMenu,
54
- searchProps
54
+ search = /* @__PURE__ */ jsx(Search, {})
55
55
  }) {
56
56
  const containerRef = useRef(null);
57
57
  return /* @__PURE__ */ jsxs(
@@ -100,13 +100,7 @@ function HiveNavigation({
100
100
  ] }),
101
101
  /* @__PURE__ */ jsx("div", { className: "flex-1" }),
102
102
  children,
103
- /* @__PURE__ */ jsx(
104
- Search,
105
- {
106
- className: "relative ml-4 basis-64 [&_:is(input,kbd)]:text-green-700 dark:[&_:is(input,kbd)]:text-neutral-300 [&_input]:h-12 [&_input]:w-full [&_input]:rounded-lg [&_input]:border [&_input]:border-green-200 [&_input]:bg-white [&_input]:pl-4 [&_input]:pr-8 [&_input]:ring-[hsl(var(--nextra-primary-hue)_var(--nextra-primary-saturation)_32%/var(--tw-ring-opacity))] [&_input]:ring-offset-[rgb(var(--nextra-bg))] dark:[&_input]:border-neutral-800 [&_input]:dark:bg-inherit [&_kbd]:absolute [&_kbd]:right-4 [&_kbd]:top-1/2 [&_kbd]:my-0 [&_kbd]:-translate-y-1/2 [&_kbd]:border-none [&_kbd]:bg-green-200 dark:[&_kbd]:bg-neutral-700",
107
- ...searchProps
108
- }
109
- ),
103
+ search,
110
104
  /* @__PURE__ */ jsxs(
111
105
  CallToAction,
112
106
  {
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- const SvgYoga = (props) => /* @__PURE__ */ jsxs("svg", { width: 53, height: 54, viewBox: "0 0 53 54", fill: "none", ...props, children: [
3
- /* @__PURE__ */ jsx("path", { d: "M35.213 10.37h-8.231l4.943-4.943L26.5 0l-5.427 5.427 4.943 4.943h-8.231a4 4 0 0 0-2.827 1.172L.5 26l5.427 5.427 17.747-17.746a3.997 3.997 0 0 1 5.652 0l17.747 17.746L52.5 26 38.04 11.54a4 4 0 0 0-2.827-1.172v.002ZM26.5 42.197l-5.426 5.426L26.5 53.05l5.426-5.426-5.426-5.427Z", fill: "currentColor" }),
4
- /* @__PURE__ */ jsx("path", { d: "M26.5 31.427h-8.713A4 4 0 0 0 14.96 32.6L10.79 36.77l5.427 5.427 7.46-7.46a3.997 3.997 0 0 1 5.653 0l7.46 7.46 5.427-5.427-4.172-4.171a4 4 0 0 0-2.827-1.172H26.5Z", fill: "currentColor" })
2
+ const SvgYoga = (props) => /* @__PURE__ */ jsxs("svg", { width: 53, height: 54, viewBox: "0 0 53 54", fill: "currentColor", ...props, children: [
3
+ /* @__PURE__ */ jsx("path", { d: "M35.213 10.37h-8.231l4.943-4.943L26.5 0l-5.427 5.427 4.943 4.943h-8.231a4 4 0 0 0-2.827 1.172L.5 26l5.427 5.427 17.747-17.746a3.997 3.997 0 0 1 5.652 0l17.747 17.746L52.5 26 38.04 11.54a4 4 0 0 0-2.827-1.172v.002ZM26.5 42.197l-5.426 5.426L26.5 53.05l5.426-5.426-5.426-5.427Z" }),
4
+ /* @__PURE__ */ jsx("path", { d: "M26.5 31.427h-8.713A4 4 0 0 0 14.96 32.6L10.79 36.77l5.427 5.427 7.46-7.46a3.997 3.997 0 0 1 5.653 0l7.46 7.46 5.427-5.427-4.172-4.171a4 4 0 0 0-2.827-1.172H26.5Z" })
5
5
  ] });
6
6
  export {
7
7
  SvgYoga as ReactComponent
@@ -31,6 +31,8 @@ export { ContactButton, ContactButtonProps, ContactTextLink, ContactTextLinkProp
31
31
  export { Giscus } from './giscus.mjs';
32
32
  export { VersionDropdown, VersionDropdownProps } from './version-dropdown.mjs';
33
33
  export { Dropdown, DropdownContent, DropdownItem, DropdownTrigger } from './dropdown.mjs';
34
+ export { FrequentlyAskedQuestions } from './faq/index.mjs';
35
+ export { ComparisonTable } from './comparison-table/index.mjs';
34
36
  export { GraphQLConfCard, GraphQLConfCardProps } from './hive-navigation/graphql-conf-card.mjs';
35
37
  import 'react';
36
38
  import 'url';
@@ -42,3 +44,4 @@ import 'react/jsx-runtime';
42
44
  import 'nextra/components';
43
45
  import '../products.mjs';
44
46
  import '@giscus/react';
47
+ import './faq/attach-page-faq-schema.mjs';
@@ -31,11 +31,15 @@ import { Giscus } from "./giscus";
31
31
  export * from "./product-card";
32
32
  export * from "./version-dropdown";
33
33
  export * from "./dropdown";
34
+ import { FrequentlyAskedQuestions } from "./faq";
35
+ import { ComparisonTable } from "./comparison-table";
34
36
  export {
35
37
  Anchor,
36
38
  Button,
37
39
  CardsColorful,
40
+ ComparisonTable,
38
41
  FeatureList,
42
+ FrequentlyAskedQuestions,
39
43
  GetYourAPIGameRightSection,
40
44
  Giscus,
41
45
  GraphQLConfCard,
@@ -47,7 +47,7 @@ const LegacyPackageCmd = ({
47
47
  ),
48
48
  [packages]
49
49
  );
50
- return /* @__PURE__ */ jsx(Tabs, { items: PACKAGE_MANAGERS, children: PACKAGE_MANAGERS.map((pkgManager, index) => /* @__PURE__ */ jsx(Tabs.Tab, { children: /* @__PURE__ */ jsx(Pre, { "data-filename": "Terminal", "data-copy": "", "data-language": "sh", "data-theme": "default", children: /* @__PURE__ */ jsx("code", { children: /* @__PURE__ */ jsx("span", { className: "line", children: commands[index] }) }) }) }, pkgManager)) });
50
+ return /* @__PURE__ */ jsx(Tabs, { items: PACKAGE_MANAGERS, children: PACKAGE_MANAGERS.map((pkgManager, index) => /* @__PURE__ */ jsx(Tabs.Tab, { children: /* @__PURE__ */ jsx(Pre, { "data-filename": "Terminal", "data-copy": "", "data-language": "sh", "data-theme": "default", children: /* @__PURE__ */ jsx("code", { children: /* @__PURE__ */ jsx("span", { className: "line mx-4", children: commands[index] }) }) }) }, pkgManager)) });
51
51
  };
52
52
  export {
53
53
  LegacyPackageCmd
package/dist/index.d.mts CHANGED
@@ -34,6 +34,8 @@ export { ContactButton, ContactButtonProps, ContactTextLink, ContactTextLinkProp
34
34
  export { Giscus } from './components/giscus.mjs';
35
35
  export { VersionDropdown, VersionDropdownProps } from './components/version-dropdown.mjs';
36
36
  export { Dropdown, DropdownContent, DropdownItem, DropdownTrigger } from './components/dropdown.mjs';
37
+ export { FrequentlyAskedQuestions } from './components/faq/index.mjs';
38
+ export { ComparisonTable } from './components/comparison-table/index.mjs';
37
39
  export { PRODUCTS } from './products.mjs';
38
40
  export { IEditorProps, IFeatureListProps, IHeroGradientProps, IHeroIllustrationProps, IHeroMarketplaceProps, IHeroVideoProps, IInfoListProps, ILink, IMarketplaceItemProps, IMarketplaceItemsProps, IMarketplaceListProps, IMarketplaceSearchProps, ISchemaPageProps } from './types/components.mjs';
39
41
  export { AngularLettermark, ConductorLettermark, ConfigLettermark, EnvelopLettermark, FetsLettermark, GraphQLESlintLettermark, HeltinLettermark, InspectorLettermark, KitQLLettermark, ModulesLettermark, SSELettermark, ScalarsLettermark, SofaLettermark, StitchingLettermark, ToolsLettermark, WSLettermark, WhatsAppLettermark } from './logos/index.mjs';
@@ -46,6 +48,7 @@ import 'url';
46
48
  import 'next/image';
47
49
  import 'react/jsx-runtime';
48
50
  import '@giscus/react';
51
+ import './components/faq/attach-page-faq-schema.mjs';
49
52
  import 'next/link';
50
53
  import 'react-player';
51
54
  import 'clsx';
@@ -0,0 +1,8 @@
1
+ import { FC, ReactNode } from 'react';
2
+
3
+ declare const Body: FC<{
4
+ lightOnlyPages: string[];
5
+ children: ReactNode;
6
+ }>;
7
+
8
+ export { Body };
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { usePathname } from "next/navigation";
4
+ const Body = ({ lightOnlyPages, children }) => {
5
+ const pathname = usePathname();
6
+ const isLightOnlyPage = lightOnlyPages.includes(pathname);
7
+ return /* @__PURE__ */ jsx("body", { className: isLightOnlyPage ? "light text-green-1000" : void 0, children });
8
+ };
9
+ export {
10
+ Body
11
+ };
@@ -6,6 +6,8 @@ export { convertToPageMap, createIndexPage, getPageMap, mergeMetaWithPageMap, no
6
6
  export { evaluate } from 'nextra/evaluate';
7
7
  export { fetchPackageInfo } from './npm.mjs';
8
8
  export { sharedMetaItems } from './shared-meta-items.mjs';
9
+ export { Body } from './body.client.mjs';
10
+ export { remarkLinkRewrite } from './remark-link-rewrite.mjs';
9
11
  export { GuildLayout, getDefaultMetadata } from './theme-layout.mjs';
10
12
  import 'next/image';
11
13
  import 'nextra';
@@ -13,6 +15,8 @@ import 'nextra/mdx-components/pre/index';
13
15
  import 'react/jsx-runtime';
14
16
  import 'react';
15
17
  import '../products.mjs';
18
+ import 'mdast';
19
+ import 'unified';
16
20
  import 'next';
17
21
  import 'nextra-theme-docs';
18
22
  import 'nextra/components';
@@ -11,9 +11,12 @@ import {
11
11
  } from "nextra/page-map";
12
12
  import { evaluate } from "nextra/evaluate";
13
13
  import { fetchPackageInfo } from "./npm.js";
14
- import { sharedMetaItems } from "./shared-meta-items";
14
+ import { sharedMetaItems } from "./shared-meta-items.js";
15
+ import { Body } from "./body.client.js";
16
+ import { remarkLinkRewrite } from "./remark-link-rewrite.js";
15
17
  import { GuildLayout, getDefaultMetadata } from "./theme-layout.js";
16
18
  export {
19
+ Body,
17
20
  GuildLayout,
18
21
  MDXRemote,
19
22
  compileMdx,
@@ -26,6 +29,7 @@ export {
26
29
  getPageMap,
27
30
  mergeMetaWithPageMap,
28
31
  normalizePageMap,
32
+ remarkLinkRewrite,
29
33
  sharedMetaItems,
30
34
  useMDXComponents
31
35
  };
@@ -1,7 +1,17 @@
1
1
  import { NextConfig } from 'next';
2
2
  import { NextraConfig } from 'nextra';
3
+ import { Plugin } from 'unified';
3
4
 
4
- declare const defaultNextraOptions: NextraConfig;
5
+ declare const defaultNextraOptions: {
6
+ defaultShowCopyCode: true;
7
+ whiteListTagsStyling: string[];
8
+ search: {
9
+ codeblocks: false;
10
+ };
11
+ mdxOptions: {
12
+ rehypePlugins: Plugin<[], any>[];
13
+ };
14
+ };
5
15
  interface WithGuildDocsOptions extends NextConfig {
6
16
  nextraConfig?: NextraConfig;
7
17
  }
@@ -0,0 +1,10 @@
1
+ import { Root } from 'mdast';
2
+ import { Plugin } from 'unified';
3
+
4
+ type RemarkLinkRewriteOptions = {
5
+ pattern: RegExp;
6
+ replace: string;
7
+ };
8
+ declare const remarkLinkRewrite: Plugin<[RemarkLinkRewriteOptions], Root>;
9
+
10
+ export { type RemarkLinkRewriteOptions, remarkLinkRewrite };
@@ -0,0 +1,13 @@
1
+ import { visit } from "unist-util-visit";
2
+ const EXTERNAL_URL_RE = /^https?:\/\//;
3
+ const remarkLinkRewrite = ({ pattern, replace }) => (ast) => {
4
+ visit(ast, "link", (node) => {
5
+ if (EXTERNAL_URL_RE.test(node.url)) {
6
+ return;
7
+ }
8
+ node.url = node.url.replace(pattern, replace);
9
+ });
10
+ };
11
+ export {
12
+ remarkLinkRewrite
13
+ };
@@ -1,9 +1,10 @@
1
- import { FC, ReactNode, ComponentProps } from 'react';
1
+ import { FC, ReactNode, ComponentProps, ReactElement } from 'react';
2
2
  import { Metadata } from 'next';
3
3
  import { PageMapItem } from 'nextra';
4
4
  import { Navbar, Layout } from 'nextra-theme-docs';
5
5
  import { Head } from 'nextra/components';
6
6
  import { HiveNavigation } from '../components/hive-navigation/index.mjs';
7
+ import { Body } from './body.client.mjs';
7
8
  import 'react/jsx-runtime';
8
9
  import '../components/hive-navigation/graphql-conf-card.mjs';
9
10
  import 'next/image';
@@ -37,6 +38,8 @@ declare const GuildLayout: FC<{
37
38
  */
38
39
  navbarProps: NavbarProps;
39
40
  pageMap?: PageMapItem[];
41
+ search?: ReactElement;
42
+ lightOnlyPages: ComponentProps<typeof Body>['lightOnlyPages'];
40
43
  }>;
41
44
  declare function getDefaultMetadata({ websiteName, description, productName, ...additionalMetadata }: {
42
45
  description?: string;
@@ -7,6 +7,7 @@ import { HiveFooter } from "../components/hive-footer";
7
7
  import { HiveNavigation } from "../components/hive-navigation";
8
8
  import { siteOrigin, siteUrl } from "../constants";
9
9
  import { PRODUCTS } from "../products";
10
+ import { Body } from "./body.client";
10
11
  const companyItem = {
11
12
  type: "menu",
12
13
  title: "Company",
@@ -41,6 +42,8 @@ const GuildLayout = async ({
41
42
  logo,
42
43
  layoutProps,
43
44
  navbarProps,
45
+ search,
46
+ lightOnlyPages,
44
47
  ...props
45
48
  }) => {
46
49
  const [meta, ...pageMap] = props.pageMap || await getPageMap();
@@ -67,8 +70,34 @@ const GuildLayout = async ({
67
70
  suppressHydrationWarning: true,
68
71
  ...htmlProps,
69
72
  children: [
70
- /* @__PURE__ */ jsx(Head, { ...headProps }),
71
- /* @__PURE__ */ jsx("body", { children: /* @__PURE__ */ jsx(
73
+ /* @__PURE__ */ jsx(
74
+ Head,
75
+ {
76
+ backgroundColor: { dark: "#111", light: "#fff" },
77
+ color: {
78
+ hue: { dark: 67, light: 171 },
79
+ saturation: { dark: 100, light: 42 },
80
+ lightness: { dark: 50, light: 24 }
81
+ },
82
+ ...headProps,
83
+ children: /* @__PURE__ */ jsx("style", { children: `
84
+ .dark:has(body.light) ::selection {
85
+ background: hsl(var(--nextra-primary-hue)var(--nextra-primary-saturation)calc(var(--nextra-primary-lightness) + 41%));
86
+ }
87
+ .dark:has(body.light) {
88
+ --nextra-primary-hue: 171deg;
89
+ --nextra-primary-saturation: 42%;
90
+ --nextra-primary-lightness: 24%;
91
+ --nextra-bg: 255, 255, 255;
92
+ }
93
+ .x\\:tracking-tight,
94
+ .nextra-steps :is(h2, h3, h4) {
95
+ letter-spacing: normal;
96
+ }
97
+ ` })
98
+ }
99
+ ),
100
+ /* @__PURE__ */ jsx(Body, { lightOnlyPages, children: /* @__PURE__ */ jsx(
72
101
  Layout,
73
102
  {
74
103
  footer: /* @__PURE__ */ jsx(
@@ -81,12 +110,14 @@ const GuildLayout = async ({
81
110
  description
82
111
  }
83
112
  ),
113
+ search,
84
114
  navbar: /* @__PURE__ */ jsx(
85
115
  HiveNavigation,
86
116
  {
87
117
  className: "max-w-[90rem]",
88
118
  productName: websiteName,
89
119
  navLinks: [],
120
+ search,
90
121
  ...navbarProps,
91
122
  logo: /* @__PURE__ */ jsxs(
92
123
  Anchor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theguild/components",
3
- "version": "9.0.0-alpha-20250114081532-be0c7eff66d202aae63bc434b3f1b34eeb4d865d",
3
+ "version": "9.0.0",
4
4
  "repository": {
5
5
  "url": "https://github.com/the-guild-org/docs",
6
6
  "directory": "packages/components"
@@ -46,6 +46,8 @@
46
46
  "dependencies": {
47
47
  "@giscus/react": "3.1.0",
48
48
  "@next/bundle-analyzer": "15.1.4",
49
+ "@radix-ui/react-accordion": "^1.2.2",
50
+ "@radix-ui/react-icons": "^1.3.2",
49
51
  "@radix-ui/react-navigation-menu": "^1.2.0",
50
52
  "clsx": "2.1.1",
51
53
  "fuzzy": "0.1.3",
@@ -54,12 +56,14 @@
54
56
  "react-paginate": "8.2.0",
55
57
  "react-player": "2.16.0",
56
58
  "semver": "^7.3.8",
57
- "tailwind-merge": "^2.5.2"
59
+ "tailwind-merge": "^2.5.2",
60
+ "unist-util-visit": "5.0.0"
58
61
  },
59
62
  "devDependencies": {
60
- "@svgr/babel-plugin-remove-jsx-attribute": "^8.0.0",
63
+ "@svgr/plugin-svgo": "^8.1.0",
61
64
  "@theguild/tailwind-config": "0.6.2",
62
65
  "@types/dedent": "0.7.2",
66
+ "@types/mdast": "4.0.4",
63
67
  "@types/react": "18.3.18",
64
68
  "@types/react-dom": "18.3.5",
65
69
  "@types/semver": "7.5.8",
package/style.css CHANGED
@@ -127,7 +127,23 @@
127
127
  :root {
128
128
  --nextra-navbar-height: 82px;
129
129
  }
130
-
130
+ @media (min-width: 768px) {
131
+ .nextra-search {
132
+ @apply ml-3 basis-64;
133
+ input,
134
+ kbd {
135
+ @apply text-green-700 dark:text-neutral-300;
136
+ }
137
+ input {
138
+ @apply h-12 w-full rounded-lg border border-green-200 bg-white pl-4 pr-8;
139
+ @apply ring-[hsl(var(--nextra-primary-hue)_var(--nextra-primary-saturation)_32%/var(--tw-ring-opacity))];
140
+ @apply ring-offset-[rgb(var(--nextra-bg))] dark:border-neutral-800 dark:bg-inherit;
141
+ }
142
+ kbd {
143
+ @apply absolute right-4 top-1/2 my-0 -translate-y-1/2 border-none bg-green-200 dark:bg-neutral-700;
144
+ }
145
+ }
146
+ }
131
147
  @media (max-width: 767px) {
132
148
  :root {
133
149
  --nextra-navbar-height: 64px;