@farming-labs/theme 0.0.7 → 0.0.8

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.
@@ -424,8 +424,9 @@ function createDocsLayout(config) {
424
424
  const githubUrl = typeof githubRaw === "string" ? githubRaw.replace(/\/$/, "") : githubRaw?.url.replace(/\/$/, "");
425
425
  const githubBranch = typeof githubRaw === "object" ? githubRaw.branch ?? "main" : "main";
426
426
  const githubDirectory = typeof githubRaw === "object" ? githubRaw.directory?.replace(/^\/|\/$/g, "") : void 0;
427
+ const staticExport = !!config.staticExport;
427
428
  const aiConfig = config.ai;
428
- const aiEnabled = !!aiConfig?.enabled;
429
+ const aiEnabled = !staticExport && !!aiConfig?.enabled;
429
430
  const aiMode = aiConfig?.mode ?? "search";
430
431
  const aiPosition = aiConfig?.position ?? "bottom-right";
431
432
  const aiFloatingStyle = aiConfig?.floatingStyle ?? "panel";
@@ -465,7 +466,7 @@ function createDocsLayout(config) {
465
466
  /* @__PURE__ */ jsx(TypographyStyle, { typography }),
466
467
  /* @__PURE__ */ jsx(LayoutStyle, { layout: layoutDimensions }),
467
468
  forcedTheme && /* @__PURE__ */ jsx(ForcedThemeScript, { theme: forcedTheme }),
468
- /* @__PURE__ */ jsx(DocsCommandSearch, {}),
469
+ !staticExport && /* @__PURE__ */ jsx(DocsCommandSearch, {}),
469
470
  aiEnabled && /* @__PURE__ */ jsx(DocsAIFeatures, {
470
471
  mode: aiMode,
471
472
  position: aiPosition,
@@ -0,0 +1,9 @@
1
+ import { ComponentProps } from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import Image from "next/image";
4
+
5
+ //#region src/mdx-img.d.ts
6
+ type ImgProps = ComponentProps<typeof Image>;
7
+ declare function MDXImg(props: ImgProps): react_jsx_runtime0.JSX.Element;
8
+ //#endregion
9
+ export { MDXImg };
@@ -0,0 +1,33 @@
1
+ "use client";
2
+
3
+ import { jsx } from "react/jsx-runtime";
4
+ import Image from "next/image";
5
+
6
+ //#region src/mdx-img.tsx
7
+ /**
8
+ * MDX image component that works with ![alt](url) when width/height are not provided.
9
+ * Fumadocs-ui's default img uses Next.js Image which requires width and height;
10
+ * markdown image syntax cannot provide these. This override uses unoptimized Image
11
+ * with default dimensions when missing, so external (e.g. GitHub) images work.
12
+ */
13
+ const DEFAULT_WIDTH = 800;
14
+ const DEFAULT_HEIGHT = 600;
15
+ function MDXImg(props) {
16
+ const { src, alt = "", width, height, style, ...rest } = props;
17
+ return /* @__PURE__ */ jsx(Image, {
18
+ src,
19
+ alt,
20
+ width: width != null ? Number(width) : DEFAULT_WIDTH,
21
+ height: height != null ? Number(height) : DEFAULT_HEIGHT,
22
+ unoptimized: !(width != null && height != null),
23
+ style: {
24
+ maxWidth: "100%",
25
+ height: "auto",
26
+ ...style
27
+ },
28
+ ...rest
29
+ });
30
+ }
31
+
32
+ //#endregion
33
+ export { MDXImg };
package/dist/mdx.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { MDXImg } from "./mdx-img.mjs";
1
2
  import * as react from "react";
2
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
4
  import { Tab, Tabs } from "fumadocs-ui/components/tabs";
@@ -8,6 +9,7 @@ import * as fumadocs_ui_components_callout0 from "fumadocs-ui/components/callout
8
9
 
9
10
  //#region src/mdx.d.ts
10
11
  declare const extendedMdxComponents: {
12
+ img: typeof MDXImg;
11
13
  Tab: typeof Tab;
12
14
  Tabs: typeof Tabs;
13
15
  CodeBlockTab: typeof fumadocs_ui_components_codeblock0.CodeBlockTab;
@@ -18,9 +20,6 @@ declare const extendedMdxComponents: {
18
20
  Card: typeof fumadocs_ui_components_card0.Card;
19
21
  Cards: typeof fumadocs_ui_components_card0.Cards;
20
22
  a: react.FC<react.AnchorHTMLAttributes<HTMLAnchorElement>>;
21
- img: (props: react.ImgHTMLAttributes<HTMLImageElement> & {
22
- sizes?: string;
23
- }) => react_jsx_runtime0.JSX.Element;
24
23
  h1: (props: react.HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime0.JSX.Element;
25
24
  h2: (props: react.HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime0.JSX.Element;
26
25
  h3: (props: react.HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime0.JSX.Element;
package/dist/mdx.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { MDXImg } from "./mdx-img.mjs";
1
2
  import { Tab, Tabs } from "fumadocs-ui/components/tabs";
2
3
  import defaultMdxComponents from "fumadocs-ui/mdx";
3
4
 
@@ -7,12 +8,15 @@ import defaultMdxComponents from "fumadocs-ui/mdx";
7
8
  *
8
9
  * Includes all default MDX components (headings, code blocks, callouts, cards)
9
10
  * plus Tabs/Tab for tabbed content and InstallTabs for package manager tabs.
11
+ * Overrides `img` so that ![alt](url) in markdown works without width/height
12
+ * (uses Next Image with unoptimized + default dimensions for external URLs).
10
13
  *
11
14
  * Usage in mdx-components.tsx:
12
15
  * import { getMDXComponents } from "@farming-labs/theme/mdx";
13
16
  */
14
17
  const extendedMdxComponents = {
15
18
  ...defaultMdxComponents,
19
+ img: MDXImg,
16
20
  Tab,
17
21
  Tabs
18
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/theme",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
5
5
  "keywords": [
6
6
  "docs",
@@ -103,7 +103,7 @@
103
103
  "next": ">=14.0.0",
104
104
  "tsdown": "^0.20.3",
105
105
  "typescript": "^5.9.3",
106
- "@farming-labs/docs": "0.0.7"
106
+ "@farming-labs/docs": "0.0.8"
107
107
  },
108
108
  "peerDependencies": {
109
109
  "@farming-labs/docs": ">=0.0.1",