@farming-labs/theme 0.1.59 → 0.1.60

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { useCallback, useEffect, useRef, useState } from "react";
4
4
  import { createPortal } from "react-dom";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { highlight } from "sugar-high";
7
7
 
8
8
  //#region src/ai-search-dialog.tsx
@@ -635,7 +635,7 @@ function DocsSearchDialog({ open, onOpenChange, api = "/api/docs", suggestedQues
635
635
  };
636
636
  if (!open) return null;
637
637
  const aiName = aiLabel || "AI";
638
- return createPortal(/* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
638
+ return createPortal(/* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
639
639
  onClick: () => onOpenChange(false),
640
640
  className: "fd-ai-overlay"
641
641
  }), /* @__PURE__ */ jsxs("div", {
@@ -863,7 +863,7 @@ function FloatingAIChat({ api = "/api/docs", position = "bottom-right", floating
863
863
  const isModal = floatingStyle === "modal";
864
864
  const containerStyles = getContainerStyles(floatingStyle, position);
865
865
  const aiName = aiLabel || "AI";
866
- return createPortal(/* @__PURE__ */ jsxs(Fragment, { children: [
866
+ return createPortal(/* @__PURE__ */ jsxs(Fragment$1, { children: [
867
867
  isOpen && isModal && /* @__PURE__ */ jsx("div", {
868
868
  onClick: () => setIsOpen(false),
869
869
  className: "fd-ai-overlay"
@@ -1030,7 +1030,7 @@ function FullModalAIChat({ api, isOpen, setIsOpen, messages, setMessages, aiInpu
1030
1030
  if (canSend) submitQuestion(aiInput);
1031
1031
  }
1032
1032
  };
1033
- return createPortal(/* @__PURE__ */ jsxs(Fragment, { children: [isOpen && /* @__PURE__ */ jsxs("div", {
1033
+ return createPortal(/* @__PURE__ */ jsxs(Fragment$1, { children: [isOpen && /* @__PURE__ */ jsxs("div", {
1034
1034
  className: "fd-ai-fm-overlay",
1035
1035
  onClick: (e) => {
1036
1036
  if (e.target === e.currentTarget) setIsOpen(false);
@@ -1186,7 +1186,7 @@ function AIModalDialog({ open, onOpenChange, api = "/api/docs", suggestedQuestio
1186
1186
  }, [open]);
1187
1187
  if (!open) return null;
1188
1188
  const aiName = aiLabel || "AI";
1189
- return createPortal(/* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
1189
+ return createPortal(/* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
1190
1190
  onClick: () => onOpenChange(false),
1191
1191
  className: "fd-ai-overlay"
1192
1192
  }), /* @__PURE__ */ jsxs("div", {
@@ -4,7 +4,7 @@ import { useWindowSearchParams } from "./client-location.mjs";
4
4
  import { resolveClientLocale, withLangInUrl } from "./i18n.mjs";
5
5
  import { AIModalDialog, DocsSearchDialog, FloatingAIChat } from "./ai-search-dialog.mjs";
6
6
  import { useEffect, useState } from "react";
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
8
 
9
9
  //#region src/docs-ai-features.tsx
10
10
  /**
@@ -124,7 +124,7 @@ function SidebarIconModeAI({ api, suggestedQuestions, aiLabel, loaderVariant, lo
124
124
  window.removeEventListener("fd-open-ai", onAI);
125
125
  };
126
126
  }, []);
127
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DocsSearchDialog, {
127
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DocsSearchDialog, {
128
128
  open: searchOpen,
129
129
  onOpenChange: setSearchOpen,
130
130
  api,
@@ -4,7 +4,7 @@ import { useWindowSearchParams } from "./client-location.mjs";
4
4
  import { resolveClientLocale, withLangInUrl } from "./i18n.mjs";
5
5
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
6
6
  import { createPortal } from "react-dom";
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
8
 
9
9
  //#region src/docs-command-search.tsx
10
10
  function cn(...classes) {
@@ -56,7 +56,7 @@ function fuzzyScore(query, text) {
56
56
  };
57
57
  }
58
58
  function HighlightedLabel({ label, indices }) {
59
- if (!indices.length) return /* @__PURE__ */ jsx(Fragment, { children: label });
59
+ if (!indices.length) return /* @__PURE__ */ jsx(Fragment$1, { children: label });
60
60
  const out = [];
61
61
  for (let pos = 0; pos < label.length; pos++) if (indices.includes(pos)) {
62
62
  let run = label[pos];
@@ -71,7 +71,7 @@ function HighlightedLabel({ label, indices }) {
71
71
  }, `m-${pos}`));
72
72
  pos = p - 1;
73
73
  } else out.push(/* @__PURE__ */ jsx("span", { children: label[pos] }, `t-${pos}`));
74
- return /* @__PURE__ */ jsx(Fragment, { children: out });
74
+ return /* @__PURE__ */ jsx(Fragment$1, { children: out });
75
75
  }
76
76
  function SearchIcon() {
77
77
  return /* @__PURE__ */ jsxs("svg", {
@@ -492,7 +492,7 @@ function DocsCommandSearch({ api = "/api/docs", locale }) {
492
492
  }
493
493
  if (!mounted || !open) return null;
494
494
  const allItems = [...recentItems, ...displayItems];
495
- return createPortal(/* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
495
+ return createPortal(/* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
496
496
  className: "omni-overlay",
497
497
  onClick: () => setOpen(false)
498
498
  }), /* @__PURE__ */ jsxs("div", {
@@ -4,11 +4,11 @@ import { PageActions } from "./page-actions.mjs";
4
4
  import { useWindowSearchParams } from "./client-location.mjs";
5
5
  import { DocsFeedback } from "./docs-feedback.mjs";
6
6
  import { resolveClientLocale, withLangInUrl } from "./i18n.mjs";
7
- import { Children, cloneElement, isValidElement, useEffect, useState } from "react";
7
+ import { Children, Fragment, cloneElement, isValidElement, useEffect, useState } from "react";
8
8
  import { DocsBody, DocsPage, EditOnGitHub } from "fumadocs-ui/layouts/docs/page";
9
9
  import { createPortal } from "react-dom";
10
10
  import { usePathname, useRouter } from "fumadocs-core/framework";
11
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
12
 
13
13
  //#region src/docs-page-client.tsx
14
14
  /**
@@ -124,6 +124,7 @@ function injectTitleDecorations(node, { description, belowTitle }) {
124
124
  node,
125
125
  inserted: false
126
126
  };
127
+ const insertedExtras = extras.map((extra, index) => /* @__PURE__ */ jsx(Fragment, { children: extra }, `fd-title-decoration-${index}`));
127
128
  function visit(current) {
128
129
  if (current == null || typeof current === "boolean") return current;
129
130
  if (inserted) return current;
@@ -134,7 +135,7 @@ function injectTitleDecorations(node, { description, belowTitle }) {
134
135
  if (!isValidElement(current)) return current;
135
136
  if (typeof current.type === "string" && current.type === "h1") {
136
137
  inserted = true;
137
- return Children.toArray([current, ...extras]);
138
+ return /* @__PURE__ */ jsxs(Fragment, { children: [current, insertedExtras] }, "fd-title-decoration-block");
138
139
  }
139
140
  const childProps = current.props ?? null;
140
141
  if (childProps?.children === void 0) return current;
@@ -159,7 +160,7 @@ function injectTitleDecorations(node, { description, belowTitle }) {
159
160
  }
160
161
  function TitleDecorations({ description, belowTitle }) {
161
162
  if (!description && !belowTitle) return null;
162
- return /* @__PURE__ */ jsx(Fragment, { children: Children.toArray([description, belowTitle].filter(Boolean)) });
163
+ return /* @__PURE__ */ jsx(Fragment$1, { children: Children.toArray([description, belowTitle].filter(Boolean)) });
163
164
  }
164
165
  function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled = true, changelogBasePath, entry = "docs", locale, copyMarkdown = false, openDocs = false, openDocsProviders, pageActionsPosition = "below-title", pageActionsAlignment = "left", githubUrl, contentDir, githubBranch = "main", githubDirectory, editOnGithubUrl, lastModifiedMap, lastModified: lastModifiedProp, readingTimeMap, readingTime: readingTimeProp, readingTimeEnabled = false, lastUpdatedEnabled = true, lastUpdatedPosition = "footer", llmsTxtEnabled = false, descriptionMap, description, feedbackEnabled = false, feedbackQuestion, feedbackPlaceholder, feedbackPositiveLabel, feedbackNegativeLabel, feedbackSubmitLabel, feedbackOnFeedback, children }) {
165
166
  const fdTocStyle = tocStyle === "directional" ? "clerk" : void 0;
@@ -318,6 +319,7 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
318
319
  description: titleDescription,
319
320
  belowTitle: belowTitleBlock
320
321
  }), titlePortalHost) : null;
322
+ const renderedChildren = Children.toArray(decoratedChildren);
321
323
  return /* @__PURE__ */ jsxs(DocsPage, {
322
324
  full: false,
323
325
  toc,
@@ -360,7 +362,7 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
360
362
  children: [
361
363
  /* @__PURE__ */ jsx("div", {
362
364
  style: { flex: 1 },
363
- children: decoratedChildren
365
+ children: renderedChildren
364
366
  }),
365
367
  titleDecorationsPortal,
366
368
  !isChangelogRoute && feedbackEnabled && /* @__PURE__ */ jsx(DocsFeedback, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/theme",
3
- "version": "0.1.59",
3
+ "version": "0.1.60",
4
4
  "description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
5
5
  "keywords": [
6
6
  "docs",
@@ -133,7 +133,7 @@
133
133
  "tsdown": "^0.20.3",
134
134
  "typescript": "^5.9.3",
135
135
  "vitest": "^3.2.4",
136
- "@farming-labs/docs": "0.1.59"
136
+ "@farming-labs/docs": "0.1.60"
137
137
  },
138
138
  "peerDependencies": {
139
139
  "@farming-labs/docs": ">=0.0.1",