@farming-labs/theme 0.0.2-beta.9 → 0.0.2
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/ai-search-dialog.d.mts +23 -1
- package/dist/ai-search-dialog.mjs +247 -37
- package/dist/colorful/index.d.mts +78 -0
- package/dist/colorful/index.mjs +82 -0
- package/dist/darkbold/index.d.mts +80 -0
- package/dist/darkbold/index.mjs +84 -0
- package/dist/docs-ai-features.d.mts +3 -1
- package/dist/docs-ai-features.mjs +63 -10
- package/dist/docs-api.d.mts +7 -6
- package/dist/docs-api.mjs +73 -4
- package/dist/docs-command-search.d.mts +10 -0
- package/dist/docs-command-search.mjs +654 -0
- package/dist/docs-layout.d.mts +20 -11
- package/dist/docs-layout.mjs +230 -50
- package/dist/docs-page-client.d.mts +20 -0
- package/dist/docs-page-client.mjs +119 -25
- package/dist/greentree/index.d.mts +80 -0
- package/dist/greentree/index.mjs +84 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +3 -2
- package/dist/page-actions.d.mts +4 -1
- package/dist/page-actions.mjs +8 -4
- package/dist/search.d.mts +1 -1
- package/dist/shiny/index.d.mts +79 -0
- package/dist/shiny/index.mjs +83 -0
- package/dist/sidebar-search-ai.d.mts +11 -0
- package/dist/sidebar-search-ai.mjs +128 -0
- package/package.json +38 -14
- package/styles/ai.css +408 -81
- package/styles/base.css +211 -14
- package/styles/colorful.css +266 -0
- package/styles/darkbold.css +575 -0
- package/styles/darksharp.css +27 -11
- package/styles/default.css +22 -1
- package/styles/greentree.css +719 -0
- package/styles/omni.css +359 -0
- package/styles/pixel-border.css +115 -52
- package/styles/shiny.css +505 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
//#region src/ai-search-dialog.d.ts
|
|
2
|
+
type LoaderVariant = "shimmer-dots" | "circular" | "dots" | "typing" | "wave" | "bars" | "pulse" | "pulse-dot" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
2
3
|
declare function DocsSearchDialog({
|
|
3
4
|
open,
|
|
4
5
|
onOpenChange,
|
|
5
6
|
api,
|
|
6
7
|
suggestedQuestions,
|
|
7
8
|
aiLabel,
|
|
9
|
+
loaderVariant,
|
|
8
10
|
loadingComponentHtml
|
|
9
11
|
}: {
|
|
10
12
|
open: boolean;
|
|
@@ -12,6 +14,7 @@ declare function DocsSearchDialog({
|
|
|
12
14
|
api?: string;
|
|
13
15
|
suggestedQuestions?: string[];
|
|
14
16
|
aiLabel?: string;
|
|
17
|
+
loaderVariant?: LoaderVariant;
|
|
15
18
|
loadingComponentHtml?: string;
|
|
16
19
|
}): any;
|
|
17
20
|
type FloatingPosition = "bottom-right" | "bottom-left" | "bottom-center";
|
|
@@ -23,6 +26,7 @@ declare function FloatingAIChat({
|
|
|
23
26
|
triggerComponentHtml,
|
|
24
27
|
suggestedQuestions,
|
|
25
28
|
aiLabel,
|
|
29
|
+
loaderVariant,
|
|
26
30
|
loadingComponentHtml
|
|
27
31
|
}: {
|
|
28
32
|
api?: string;
|
|
@@ -31,7 +35,25 @@ declare function FloatingAIChat({
|
|
|
31
35
|
triggerComponentHtml?: string;
|
|
32
36
|
suggestedQuestions?: string[];
|
|
33
37
|
aiLabel?: string;
|
|
38
|
+
loaderVariant?: LoaderVariant;
|
|
39
|
+
loadingComponentHtml?: string;
|
|
40
|
+
}): any;
|
|
41
|
+
declare function AIModalDialog({
|
|
42
|
+
open,
|
|
43
|
+
onOpenChange,
|
|
44
|
+
api,
|
|
45
|
+
suggestedQuestions,
|
|
46
|
+
aiLabel,
|
|
47
|
+
loaderVariant,
|
|
48
|
+
loadingComponentHtml
|
|
49
|
+
}: {
|
|
50
|
+
open: boolean;
|
|
51
|
+
onOpenChange: (open: boolean) => void;
|
|
52
|
+
api?: string;
|
|
53
|
+
suggestedQuestions?: string[];
|
|
54
|
+
aiLabel?: string;
|
|
55
|
+
loaderVariant?: LoaderVariant;
|
|
34
56
|
loadingComponentHtml?: string;
|
|
35
57
|
}): any;
|
|
36
58
|
//#endregion
|
|
37
|
-
export { DocsSearchDialog, FloatingAIChat };
|
|
59
|
+
export { AIModalDialog, DocsSearchDialog, FloatingAIChat };
|
|
@@ -143,33 +143,145 @@ function XIcon() {
|
|
|
143
143
|
children: [/* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }), /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })]
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
className: "fd-ai-
|
|
151
|
-
children: [
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
146
|
+
function LoaderIndicator({ variant = "shimmer-dots" }) {
|
|
147
|
+
const text = "Thinking";
|
|
148
|
+
switch (variant) {
|
|
149
|
+
case "circular": return /* @__PURE__ */ jsxs("div", {
|
|
150
|
+
className: "fd-ai-loader",
|
|
151
|
+
children: [/* @__PURE__ */ jsx("div", { className: "fd-ai-loader-circular" }), /* @__PURE__ */ jsx("span", {
|
|
152
|
+
className: "sr-only",
|
|
153
|
+
children: "Loading"
|
|
154
|
+
})]
|
|
155
|
+
});
|
|
156
|
+
case "dots": return /* @__PURE__ */ jsx("div", {
|
|
157
|
+
className: "fd-ai-loader",
|
|
158
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
159
|
+
className: "fd-ai-loader-dots",
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-bounce-dot" }),
|
|
162
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-bounce-dot" }),
|
|
163
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-bounce-dot" })
|
|
164
|
+
]
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
case "typing": return /* @__PURE__ */ jsx("div", {
|
|
168
|
+
className: "fd-ai-loader",
|
|
169
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
170
|
+
className: "fd-ai-loader-typing-dots",
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-typing-dot" }),
|
|
173
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-typing-dot" }),
|
|
174
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-typing-dot" })
|
|
175
|
+
]
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
case "wave": return /* @__PURE__ */ jsx("div", {
|
|
179
|
+
className: "fd-ai-loader",
|
|
180
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
181
|
+
className: "fd-ai-loader-wave",
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-wave-bar" }),
|
|
184
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-wave-bar" }),
|
|
185
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-wave-bar" }),
|
|
186
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-wave-bar" }),
|
|
187
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-wave-bar" })
|
|
188
|
+
]
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
case "bars": return /* @__PURE__ */ jsx("div", {
|
|
192
|
+
className: "fd-ai-loader",
|
|
193
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
194
|
+
className: "fd-ai-loader-bars",
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-bar" }),
|
|
197
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-bar" }),
|
|
198
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-bar" })
|
|
199
|
+
]
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
case "pulse": return /* @__PURE__ */ jsx("div", {
|
|
203
|
+
className: "fd-ai-loader",
|
|
204
|
+
children: /* @__PURE__ */ jsx("div", { className: "fd-ai-loader-pulse" })
|
|
205
|
+
});
|
|
206
|
+
case "pulse-dot": return /* @__PURE__ */ jsx("div", {
|
|
207
|
+
className: "fd-ai-loader",
|
|
208
|
+
children: /* @__PURE__ */ jsx("div", { className: "fd-ai-loader-pulse-dot" })
|
|
209
|
+
});
|
|
210
|
+
case "terminal": return /* @__PURE__ */ jsx("div", {
|
|
211
|
+
className: "fd-ai-loader",
|
|
212
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
213
|
+
className: "fd-ai-loader-terminal",
|
|
214
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
215
|
+
className: "fd-ai-loader-terminal-prompt",
|
|
216
|
+
children: ">"
|
|
217
|
+
}), /* @__PURE__ */ jsx("span", { className: "fd-ai-loader-terminal-cursor" })]
|
|
218
|
+
})
|
|
219
|
+
});
|
|
220
|
+
case "text-blink": return /* @__PURE__ */ jsx("div", {
|
|
221
|
+
className: "fd-ai-loader",
|
|
222
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
223
|
+
className: "fd-ai-loader-text-blink",
|
|
224
|
+
children: text
|
|
225
|
+
})
|
|
226
|
+
});
|
|
227
|
+
case "text-shimmer": return /* @__PURE__ */ jsx("div", {
|
|
228
|
+
className: "fd-ai-loader",
|
|
229
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
230
|
+
className: "fd-ai-loader-shimmer-text",
|
|
231
|
+
children: text
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
case "loading-dots": return /* @__PURE__ */ jsxs("div", {
|
|
235
|
+
className: "fd-ai-loader",
|
|
236
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
237
|
+
className: "fd-ai-loader-text",
|
|
238
|
+
children: text
|
|
239
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
240
|
+
className: "fd-ai-loader-text-dots",
|
|
241
|
+
children: [
|
|
242
|
+
/* @__PURE__ */ jsx("span", {
|
|
243
|
+
className: "fd-ai-loader-text-dot",
|
|
244
|
+
children: "."
|
|
245
|
+
}),
|
|
246
|
+
/* @__PURE__ */ jsx("span", {
|
|
247
|
+
className: "fd-ai-loader-text-dot",
|
|
248
|
+
children: "."
|
|
249
|
+
}),
|
|
250
|
+
/* @__PURE__ */ jsx("span", {
|
|
251
|
+
className: "fd-ai-loader-text-dot",
|
|
252
|
+
children: "."
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
})]
|
|
256
|
+
});
|
|
257
|
+
default: return /* @__PURE__ */ jsxs("div", {
|
|
258
|
+
className: "fd-ai-loader",
|
|
259
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
260
|
+
className: "fd-ai-loader-shimmer-text",
|
|
261
|
+
children: text
|
|
262
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
263
|
+
className: "fd-ai-loader-typing-dots",
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-typing-dot" }),
|
|
266
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-typing-dot" }),
|
|
267
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-typing-dot" })
|
|
268
|
+
]
|
|
269
|
+
})]
|
|
270
|
+
});
|
|
271
|
+
}
|
|
161
272
|
}
|
|
162
|
-
function
|
|
273
|
+
function InlineLoaderDots() {
|
|
163
274
|
return /* @__PURE__ */ jsxs("span", {
|
|
164
|
-
className: "fd-ai-
|
|
275
|
+
className: "fd-ai-loader-typing-dots",
|
|
276
|
+
style: { marginLeft: 0 },
|
|
165
277
|
children: [
|
|
166
|
-
/* @__PURE__ */ jsx("span", { className: "fd-ai-
|
|
167
|
-
/* @__PURE__ */ jsx("span", { className: "fd-ai-
|
|
168
|
-
/* @__PURE__ */ jsx("span", { className: "fd-ai-
|
|
278
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-typing-dot" }),
|
|
279
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-typing-dot" }),
|
|
280
|
+
/* @__PURE__ */ jsx("span", { className: "fd-ai-loader-typing-dot" })
|
|
169
281
|
]
|
|
170
282
|
});
|
|
171
283
|
}
|
|
172
|
-
function AIChat({ api, messages, setMessages, aiInput, setAiInput, isStreaming, setIsStreaming, suggestedQuestions, aiLabel, loadingComponentHtml }) {
|
|
284
|
+
function AIChat({ api, messages, setMessages, aiInput, setAiInput, isStreaming, setIsStreaming, suggestedQuestions, aiLabel, loaderVariant, loadingComponentHtml }) {
|
|
173
285
|
const label = aiLabel || "AI";
|
|
174
286
|
const aiInputRef = useRef(null);
|
|
175
287
|
const messagesEndRef = useRef(null);
|
|
@@ -311,7 +423,13 @@ function AIChat({ api, messages, setMessages, aiInput, setAiInput, isStreaming,
|
|
|
311
423
|
children: msg.content
|
|
312
424
|
}) : /* @__PURE__ */ jsx("div", {
|
|
313
425
|
className: "fd-ai-bubble-ai",
|
|
314
|
-
children: msg.content ? /* @__PURE__ */ jsx("div", {
|
|
426
|
+
children: msg.content ? /* @__PURE__ */ jsx("div", {
|
|
427
|
+
className: isStreaming && i === messages.length - 1 ? "fd-ai-streaming" : void 0,
|
|
428
|
+
dangerouslySetInnerHTML: { __html: renderMarkdown(msg.content) }
|
|
429
|
+
}) : loadingComponentHtml ? /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: loadingComponentHtml } }) : /* @__PURE__ */ jsx(LoaderIndicator, {
|
|
430
|
+
variant: loaderVariant,
|
|
431
|
+
label
|
|
432
|
+
})
|
|
315
433
|
})]
|
|
316
434
|
}, i)), /* @__PURE__ */ jsx("div", { ref: messagesEndRef })]
|
|
317
435
|
}), /* @__PURE__ */ jsxs("div", {
|
|
@@ -353,7 +471,7 @@ function AIChat({ api, messages, setMessages, aiInput, setAiInput, isStreaming,
|
|
|
353
471
|
})]
|
|
354
472
|
});
|
|
355
473
|
}
|
|
356
|
-
function DocsSearchDialog({ open, onOpenChange, api = "/api/docs", suggestedQuestions, aiLabel, loadingComponentHtml }) {
|
|
474
|
+
function DocsSearchDialog({ open, onOpenChange, api = "/api/docs", suggestedQuestions, aiLabel, loaderVariant, loadingComponentHtml }) {
|
|
357
475
|
const [tab, setTab] = useState("search");
|
|
358
476
|
const [searchQuery, setSearchQuery] = useState("");
|
|
359
477
|
const [searchResults, setSearchResults] = useState([]);
|
|
@@ -496,7 +614,7 @@ function DocsSearchDialog({ open, onOpenChange, api = "/api/docs", suggestedQues
|
|
|
496
614
|
onKeyDown: handleSearchKeyDown,
|
|
497
615
|
className: "fd-ai-input"
|
|
498
616
|
}),
|
|
499
|
-
isSearching && /* @__PURE__ */ jsx(
|
|
617
|
+
isSearching && /* @__PURE__ */ jsx(InlineLoaderDots, {})
|
|
500
618
|
]
|
|
501
619
|
}), /* @__PURE__ */ jsx("div", {
|
|
502
620
|
className: "fd-ai-results",
|
|
@@ -528,6 +646,7 @@ function DocsSearchDialog({ open, onOpenChange, api = "/api/docs", suggestedQues
|
|
|
528
646
|
setIsStreaming,
|
|
529
647
|
suggestedQuestions,
|
|
530
648
|
aiLabel,
|
|
649
|
+
loaderVariant,
|
|
531
650
|
loadingComponentHtml
|
|
532
651
|
})
|
|
533
652
|
]
|
|
@@ -602,7 +721,7 @@ function getContainerStyles(style, position) {
|
|
|
602
721
|
function getAnimation(style) {
|
|
603
722
|
return style === "modal" ? "fd-ai-float-center-in 200ms ease-out" : "fd-ai-float-in 200ms ease-out";
|
|
604
723
|
}
|
|
605
|
-
function FloatingAIChat({ api = "/api/docs", position = "bottom-right", floatingStyle = "panel", triggerComponentHtml, suggestedQuestions, aiLabel, loadingComponentHtml }) {
|
|
724
|
+
function FloatingAIChat({ api = "/api/docs", position = "bottom-right", floatingStyle = "panel", triggerComponentHtml, suggestedQuestions, aiLabel, loaderVariant, loadingComponentHtml }) {
|
|
606
725
|
const [mounted, setMounted] = useState(false);
|
|
607
726
|
const [isOpen, setIsOpen] = useState(false);
|
|
608
727
|
const [messages, setMessages] = useState([]);
|
|
@@ -640,6 +759,7 @@ function FloatingAIChat({ api = "/api/docs", position = "bottom-right", floating
|
|
|
640
759
|
setIsStreaming,
|
|
641
760
|
suggestedQuestions,
|
|
642
761
|
aiLabel,
|
|
762
|
+
loaderVariant,
|
|
643
763
|
loadingComponentHtml,
|
|
644
764
|
triggerComponentHtml,
|
|
645
765
|
position
|
|
@@ -688,6 +808,7 @@ function FloatingAIChat({ api = "/api/docs", position = "bottom-right", floating
|
|
|
688
808
|
setIsStreaming,
|
|
689
809
|
suggestedQuestions,
|
|
690
810
|
aiLabel,
|
|
811
|
+
loaderVariant,
|
|
691
812
|
loadingComponentHtml
|
|
692
813
|
})]
|
|
693
814
|
}),
|
|
@@ -696,16 +817,16 @@ function FloatingAIChat({ api = "/api/docs", position = "bottom-right", floating
|
|
|
696
817
|
className: "fd-ai-floating-trigger",
|
|
697
818
|
style: btnPosition,
|
|
698
819
|
dangerouslySetInnerHTML: { __html: triggerComponentHtml }
|
|
699
|
-
}) : /* @__PURE__ */
|
|
820
|
+
}) : /* @__PURE__ */ jsxs("button", {
|
|
700
821
|
onClick: () => setIsOpen(true),
|
|
701
822
|
"aria-label": `Ask ${aiName}`,
|
|
702
823
|
className: "fd-ai-floating-btn",
|
|
703
824
|
style: btnPosition,
|
|
704
|
-
children: /* @__PURE__ */ jsx(SparklesIcon, { size:
|
|
825
|
+
children: [/* @__PURE__ */ jsx(SparklesIcon, { size: 16 }), /* @__PURE__ */ jsxs("span", { children: ["Ask ", aiName] })]
|
|
705
826
|
}))
|
|
706
827
|
] }), document.body);
|
|
707
828
|
}
|
|
708
|
-
function FullModalAIChat({ api, isOpen, setIsOpen, messages, setMessages, aiInput, setAiInput, isStreaming, setIsStreaming, suggestedQuestions, aiLabel, loadingComponentHtml, triggerComponentHtml, position }) {
|
|
829
|
+
function FullModalAIChat({ api, isOpen, setIsOpen, messages, setMessages, aiInput, setAiInput, isStreaming, setIsStreaming, suggestedQuestions, aiLabel, loaderVariant, loadingComponentHtml, triggerComponentHtml, position }) {
|
|
709
830
|
const label = aiLabel || "AI";
|
|
710
831
|
const inputRef = useRef(null);
|
|
711
832
|
const listRef = useRef(null);
|
|
@@ -831,13 +952,12 @@ function FullModalAIChat({ api, isOpen, setIsOpen, messages, setMessages, aiInpu
|
|
|
831
952
|
children: msg.role === "user" ? "you" : label
|
|
832
953
|
}), /* @__PURE__ */ jsx("div", {
|
|
833
954
|
className: "fd-ai-fm-msg-content",
|
|
834
|
-
children: msg.content ? /* @__PURE__ */ jsx("div", {
|
|
835
|
-
className: "fd-ai-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
]
|
|
955
|
+
children: msg.content ? /* @__PURE__ */ jsx("div", {
|
|
956
|
+
className: isStreaming && i === messages.length - 1 ? "fd-ai-streaming" : void 0,
|
|
957
|
+
dangerouslySetInnerHTML: { __html: renderMarkdown(msg.content) }
|
|
958
|
+
}) : loadingComponentHtml ? /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: loadingComponentHtml } }) : /* @__PURE__ */ jsx(LoaderIndicator, {
|
|
959
|
+
variant: loaderVariant,
|
|
960
|
+
label
|
|
841
961
|
})
|
|
842
962
|
})]
|
|
843
963
|
}, i))
|
|
@@ -871,7 +991,7 @@ function FullModalAIChat({ api, isOpen, setIsOpen, messages, setMessages, aiInpu
|
|
|
871
991
|
}), isStreaming ? /* @__PURE__ */ jsx("button", {
|
|
872
992
|
className: "fd-ai-fm-send-btn",
|
|
873
993
|
onClick: () => setIsStreaming(false),
|
|
874
|
-
children: /* @__PURE__ */ jsx(
|
|
994
|
+
children: /* @__PURE__ */ jsx(InlineLoaderDots, {})
|
|
875
995
|
}) : /* @__PURE__ */ jsx("button", {
|
|
876
996
|
className: "fd-ai-fm-send-btn",
|
|
877
997
|
"data-active": canSend,
|
|
@@ -932,6 +1052,96 @@ function TrashIcon() {
|
|
|
932
1052
|
]
|
|
933
1053
|
});
|
|
934
1054
|
}
|
|
1055
|
+
function AIModalDialog({ open, onOpenChange, api = "/api/docs", suggestedQuestions, aiLabel, loaderVariant, loadingComponentHtml }) {
|
|
1056
|
+
const [messages, setMessages] = useState([]);
|
|
1057
|
+
const [aiInput, setAiInput] = useState("");
|
|
1058
|
+
const [isStreaming, setIsStreaming] = useState(false);
|
|
1059
|
+
useEffect(() => {
|
|
1060
|
+
if (!open) return;
|
|
1061
|
+
const handler = (e) => {
|
|
1062
|
+
if (e.key === "Escape") onOpenChange(false);
|
|
1063
|
+
};
|
|
1064
|
+
document.addEventListener("keydown", handler);
|
|
1065
|
+
return () => document.removeEventListener("keydown", handler);
|
|
1066
|
+
}, [open, onOpenChange]);
|
|
1067
|
+
useEffect(() => {
|
|
1068
|
+
if (open) document.body.style.overflow = "hidden";
|
|
1069
|
+
else document.body.style.overflow = "";
|
|
1070
|
+
return () => {
|
|
1071
|
+
document.body.style.overflow = "";
|
|
1072
|
+
};
|
|
1073
|
+
}, [open]);
|
|
1074
|
+
if (!open) return null;
|
|
1075
|
+
const aiName = aiLabel || "AI";
|
|
1076
|
+
return createPortal(/* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
1077
|
+
onClick: () => onOpenChange(false),
|
|
1078
|
+
className: "fd-ai-overlay"
|
|
1079
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1080
|
+
role: "dialog",
|
|
1081
|
+
"aria-modal": "true",
|
|
1082
|
+
onClick: (e) => e.stopPropagation(),
|
|
1083
|
+
className: "fd-ai-dialog fd-ai-modal-pure",
|
|
1084
|
+
style: {
|
|
1085
|
+
left: "50%",
|
|
1086
|
+
top: "50%",
|
|
1087
|
+
transform: "translate(-50%, -50%)",
|
|
1088
|
+
width: "min(680px, calc(100vw - 32px))",
|
|
1089
|
+
height: "min(560px, calc(100vh - 64px))",
|
|
1090
|
+
animation: "fd-ai-float-center-in 200ms ease-out"
|
|
1091
|
+
},
|
|
1092
|
+
children: [
|
|
1093
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1094
|
+
className: "fd-ai-header",
|
|
1095
|
+
children: [
|
|
1096
|
+
/* @__PURE__ */ jsx(SparklesIcon, { size: 16 }),
|
|
1097
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1098
|
+
className: "fd-ai-header-title",
|
|
1099
|
+
children: ["Ask ", aiName]
|
|
1100
|
+
}),
|
|
1101
|
+
/* @__PURE__ */ jsx("kbd", {
|
|
1102
|
+
className: "fd-ai-esc",
|
|
1103
|
+
children: "ESC"
|
|
1104
|
+
}),
|
|
1105
|
+
/* @__PURE__ */ jsx("button", {
|
|
1106
|
+
onClick: () => onOpenChange(false),
|
|
1107
|
+
className: "fd-ai-close-btn",
|
|
1108
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
1109
|
+
})
|
|
1110
|
+
]
|
|
1111
|
+
}),
|
|
1112
|
+
/* @__PURE__ */ jsx(AIChat, {
|
|
1113
|
+
api,
|
|
1114
|
+
messages,
|
|
1115
|
+
setMessages,
|
|
1116
|
+
aiInput,
|
|
1117
|
+
setAiInput,
|
|
1118
|
+
isStreaming,
|
|
1119
|
+
setIsStreaming,
|
|
1120
|
+
suggestedQuestions,
|
|
1121
|
+
aiLabel,
|
|
1122
|
+
loaderVariant,
|
|
1123
|
+
loadingComponentHtml
|
|
1124
|
+
}),
|
|
1125
|
+
/* @__PURE__ */ jsx("div", {
|
|
1126
|
+
className: "fd-ai-modal-footer",
|
|
1127
|
+
children: messages.length > 0 ? /* @__PURE__ */ jsxs("button", {
|
|
1128
|
+
className: "fd-ai-fm-clear-btn",
|
|
1129
|
+
onClick: () => {
|
|
1130
|
+
if (!isStreaming) {
|
|
1131
|
+
setMessages([]);
|
|
1132
|
+
setAiInput("");
|
|
1133
|
+
}
|
|
1134
|
+
},
|
|
1135
|
+
"aria-disabled": isStreaming,
|
|
1136
|
+
children: [/* @__PURE__ */ jsx(TrashIcon, {}), /* @__PURE__ */ jsx("span", { children: "Clear chat" })]
|
|
1137
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
1138
|
+
className: "fd-ai-modal-footer-hint",
|
|
1139
|
+
children: "AI can be inaccurate, please verify the information."
|
|
1140
|
+
})
|
|
1141
|
+
})
|
|
1142
|
+
]
|
|
1143
|
+
})] }), document.body);
|
|
1144
|
+
}
|
|
935
1145
|
|
|
936
1146
|
//#endregion
|
|
937
|
-
export { DocsSearchDialog, FloatingAIChat };
|
|
1147
|
+
export { AIModalDialog, DocsSearchDialog, FloatingAIChat };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as _farming_labs_docs0 from "@farming-labs/docs";
|
|
2
|
+
|
|
3
|
+
//#region src/colorful/index.d.ts
|
|
4
|
+
declare const ColorfulUIDefaults: {
|
|
5
|
+
colors: {
|
|
6
|
+
primary: string;
|
|
7
|
+
background: string;
|
|
8
|
+
muted: string;
|
|
9
|
+
border: string;
|
|
10
|
+
};
|
|
11
|
+
typography: {
|
|
12
|
+
font: {
|
|
13
|
+
style: {
|
|
14
|
+
sans: string;
|
|
15
|
+
mono: string;
|
|
16
|
+
};
|
|
17
|
+
h1: {
|
|
18
|
+
size: string;
|
|
19
|
+
weight: number;
|
|
20
|
+
lineHeight: string;
|
|
21
|
+
letterSpacing: string;
|
|
22
|
+
};
|
|
23
|
+
h2: {
|
|
24
|
+
size: string;
|
|
25
|
+
weight: number;
|
|
26
|
+
lineHeight: string;
|
|
27
|
+
};
|
|
28
|
+
h3: {
|
|
29
|
+
size: string;
|
|
30
|
+
weight: number;
|
|
31
|
+
lineHeight: string;
|
|
32
|
+
};
|
|
33
|
+
h4: {
|
|
34
|
+
size: string;
|
|
35
|
+
weight: number;
|
|
36
|
+
lineHeight: string;
|
|
37
|
+
};
|
|
38
|
+
body: {
|
|
39
|
+
size: string;
|
|
40
|
+
weight: number;
|
|
41
|
+
lineHeight: string;
|
|
42
|
+
};
|
|
43
|
+
small: {
|
|
44
|
+
size: string;
|
|
45
|
+
weight: number;
|
|
46
|
+
lineHeight: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
layout: {
|
|
51
|
+
contentWidth: number;
|
|
52
|
+
sidebarWidth: number;
|
|
53
|
+
toc: {
|
|
54
|
+
enabled: boolean;
|
|
55
|
+
depth: number;
|
|
56
|
+
style: "directional";
|
|
57
|
+
};
|
|
58
|
+
header: {
|
|
59
|
+
height: number;
|
|
60
|
+
sticky: boolean;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
components: {
|
|
64
|
+
Callout: {
|
|
65
|
+
variant: string;
|
|
66
|
+
icon: boolean;
|
|
67
|
+
};
|
|
68
|
+
CodeBlock: {
|
|
69
|
+
showCopyButton: boolean;
|
|
70
|
+
};
|
|
71
|
+
Tabs: {
|
|
72
|
+
style: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
declare const colorful: (overrides?: Partial<_farming_labs_docs0.DocsTheme>) => _farming_labs_docs0.DocsTheme;
|
|
77
|
+
//#endregion
|
|
78
|
+
export { ColorfulUIDefaults, colorful };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createTheme } from "@farming-labs/docs";
|
|
2
|
+
|
|
3
|
+
//#region src/colorful/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Colorful fumadocs theme preset — a faithful reproduction of the fumadocs
|
|
6
|
+
* default (neutral) theme with description support.
|
|
7
|
+
*
|
|
8
|
+
* CSS: `@import "@farming-labs/theme/colorful/css";`
|
|
9
|
+
*/
|
|
10
|
+
const ColorfulUIDefaults = {
|
|
11
|
+
colors: {
|
|
12
|
+
primary: "hsl(40, 96%, 40%)",
|
|
13
|
+
background: "#ffffff",
|
|
14
|
+
muted: "#64748b",
|
|
15
|
+
border: "#e5e7eb"
|
|
16
|
+
},
|
|
17
|
+
typography: { font: {
|
|
18
|
+
style: {
|
|
19
|
+
sans: "Inter, system-ui, sans-serif",
|
|
20
|
+
mono: "JetBrains Mono, monospace"
|
|
21
|
+
},
|
|
22
|
+
h1: {
|
|
23
|
+
size: "1.875rem",
|
|
24
|
+
weight: 700,
|
|
25
|
+
lineHeight: "1.2",
|
|
26
|
+
letterSpacing: "-0.02em"
|
|
27
|
+
},
|
|
28
|
+
h2: {
|
|
29
|
+
size: "1.5rem",
|
|
30
|
+
weight: 600,
|
|
31
|
+
lineHeight: "1.3"
|
|
32
|
+
},
|
|
33
|
+
h3: {
|
|
34
|
+
size: "1.25rem",
|
|
35
|
+
weight: 600,
|
|
36
|
+
lineHeight: "1.4"
|
|
37
|
+
},
|
|
38
|
+
h4: {
|
|
39
|
+
size: "1.125rem",
|
|
40
|
+
weight: 600,
|
|
41
|
+
lineHeight: "1.4"
|
|
42
|
+
},
|
|
43
|
+
body: {
|
|
44
|
+
size: "1rem",
|
|
45
|
+
weight: 400,
|
|
46
|
+
lineHeight: "1.75"
|
|
47
|
+
},
|
|
48
|
+
small: {
|
|
49
|
+
size: "0.875rem",
|
|
50
|
+
weight: 400,
|
|
51
|
+
lineHeight: "1.5"
|
|
52
|
+
}
|
|
53
|
+
} },
|
|
54
|
+
layout: {
|
|
55
|
+
contentWidth: 768,
|
|
56
|
+
sidebarWidth: 260,
|
|
57
|
+
toc: {
|
|
58
|
+
enabled: true,
|
|
59
|
+
depth: 3,
|
|
60
|
+
style: "directional"
|
|
61
|
+
},
|
|
62
|
+
header: {
|
|
63
|
+
height: 56,
|
|
64
|
+
sticky: true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
components: {
|
|
68
|
+
Callout: {
|
|
69
|
+
variant: "soft",
|
|
70
|
+
icon: true
|
|
71
|
+
},
|
|
72
|
+
CodeBlock: { showCopyButton: true },
|
|
73
|
+
Tabs: { style: "default" }
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const colorful = createTheme({
|
|
77
|
+
name: "fumadocs-colorful",
|
|
78
|
+
ui: ColorfulUIDefaults
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { ColorfulUIDefaults, colorful };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as _farming_labs_docs0 from "@farming-labs/docs";
|
|
2
|
+
|
|
3
|
+
//#region src/darkbold/index.d.ts
|
|
4
|
+
declare const DarkBoldUIDefaults: {
|
|
5
|
+
colors: {
|
|
6
|
+
primary: string;
|
|
7
|
+
background: string;
|
|
8
|
+
muted: string;
|
|
9
|
+
border: string;
|
|
10
|
+
};
|
|
11
|
+
typography: {
|
|
12
|
+
font: {
|
|
13
|
+
style: {
|
|
14
|
+
sans: string;
|
|
15
|
+
mono: string;
|
|
16
|
+
};
|
|
17
|
+
h1: {
|
|
18
|
+
size: string;
|
|
19
|
+
weight: number;
|
|
20
|
+
lineHeight: string;
|
|
21
|
+
letterSpacing: string;
|
|
22
|
+
};
|
|
23
|
+
h2: {
|
|
24
|
+
size: string;
|
|
25
|
+
weight: number;
|
|
26
|
+
lineHeight: string;
|
|
27
|
+
letterSpacing: string;
|
|
28
|
+
};
|
|
29
|
+
h3: {
|
|
30
|
+
size: string;
|
|
31
|
+
weight: number;
|
|
32
|
+
lineHeight: string;
|
|
33
|
+
letterSpacing: string;
|
|
34
|
+
};
|
|
35
|
+
h4: {
|
|
36
|
+
size: string;
|
|
37
|
+
weight: number;
|
|
38
|
+
lineHeight: string;
|
|
39
|
+
};
|
|
40
|
+
body: {
|
|
41
|
+
size: string;
|
|
42
|
+
weight: number;
|
|
43
|
+
lineHeight: string;
|
|
44
|
+
};
|
|
45
|
+
small: {
|
|
46
|
+
size: string;
|
|
47
|
+
weight: number;
|
|
48
|
+
lineHeight: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
layout: {
|
|
53
|
+
contentWidth: number;
|
|
54
|
+
sidebarWidth: number;
|
|
55
|
+
toc: {
|
|
56
|
+
enabled: boolean;
|
|
57
|
+
depth: number;
|
|
58
|
+
style: "default";
|
|
59
|
+
};
|
|
60
|
+
header: {
|
|
61
|
+
height: number;
|
|
62
|
+
sticky: boolean;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
components: {
|
|
66
|
+
Callout: {
|
|
67
|
+
variant: string;
|
|
68
|
+
icon: boolean;
|
|
69
|
+
};
|
|
70
|
+
CodeBlock: {
|
|
71
|
+
showCopyButton: boolean;
|
|
72
|
+
};
|
|
73
|
+
Tabs: {
|
|
74
|
+
style: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
declare const darkbold: (overrides?: Partial<_farming_labs_docs0.DocsTheme>) => _farming_labs_docs0.DocsTheme;
|
|
79
|
+
//#endregion
|
|
80
|
+
export { DarkBoldUIDefaults, darkbold };
|