@bysages/react 0.4.3 → 0.5.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.
- package/dist/ai-B3vbpXlK.mjs +309 -0
- package/dist/ai-prompt-input-k34KssHJ.mjs +401 -0
- package/dist/{ai-response-CjjjprMY.mjs → ai-response-DTxdL5rX.mjs} +9 -11
- package/dist/{chevron-BA7kV9m7.mjs → chevron-DnImlNip.mjs} +2 -3
- package/dist/components/accordion/index.d.mts +1 -2
- package/dist/components/accordion/index.mjs +3 -4
- package/dist/components/affix/index.d.mts +1 -2
- package/dist/components/affix/index.mjs +2 -3
- package/dist/components/ai/index.d.mts +107 -2
- package/dist/components/ai/index.mjs +7 -82
- package/dist/components/ai-action/index.d.mts +0 -2
- package/dist/components/ai-action/index.mjs +2 -3
- package/dist/components/ai-attachments/index.d.mts +0 -2
- package/dist/components/ai-attachments/index.mjs +4 -5
- package/dist/components/ai-message/index.d.mts +2 -14
- package/dist/components/ai-message/index.mjs +5 -4
- package/dist/components/ai-prompt-input/index.d.mts +14 -18
- package/dist/components/ai-prompt-input/index.mjs +1 -126
- package/dist/components/ai-reasoning/index.d.mts +0 -2
- package/dist/components/ai-reasoning/index.mjs +3 -4
- package/dist/components/ai-response/index.d.mts +1 -3
- package/dist/components/ai-response/index.mjs +1 -2
- package/dist/components/ai-source/index.d.mts +0 -2
- package/dist/components/ai-source/index.mjs +2 -3
- package/dist/components/ai-suggestion/index.d.mts +0 -2
- package/dist/components/ai-suggestion/index.mjs +2 -3
- package/dist/components/ai-tool/index.d.mts +2 -24
- package/dist/components/ai-tool/index.mjs +46 -14
- package/dist/components/alert/index.d.mts +1 -2
- package/dist/components/alert/index.mjs +2 -3
- package/dist/components/angle-slider/index.d.mts +1 -2
- package/dist/components/angle-slider/index.mjs +2 -3
- package/dist/components/aspect-ratio/index.d.mts +1 -2
- package/dist/components/aspect-ratio/index.mjs +2 -3
- package/dist/components/autocomplete/index.d.mts +1 -2
- package/dist/components/autocomplete/index.mjs +3 -4
- package/dist/components/avatar/index.d.mts +13 -4
- package/dist/components/avatar/index.mjs +20 -6
- package/dist/components/avatar-group/index.d.mts +1 -2
- package/dist/components/avatar-group/index.mjs +2 -3
- package/dist/components/back-top/index.d.mts +1 -2
- package/dist/components/back-top/index.mjs +3 -4
- package/dist/components/badge/index.d.mts +1 -2
- package/dist/components/badge/index.mjs +2 -3
- package/dist/components/banner/index.d.mts +17 -4
- package/dist/components/banner/index.mjs +21 -6
- package/dist/components/bento/index.d.mts +1 -3
- package/dist/components/bento/index.mjs +1 -2
- package/dist/components/block-ui/index.d.mts +1 -2
- package/dist/components/block-ui/index.mjs +2 -3
- package/dist/components/breadcrumb/index.d.mts +16 -3
- package/dist/components/breadcrumb/index.mjs +22 -5
- package/dist/components/browser/index.d.mts +1 -3
- package/dist/components/browser/index.mjs +1 -2
- package/dist/components/button/index.d.mts +1 -2
- package/dist/components/button/index.mjs +2 -3
- package/dist/components/button-group/index.d.mts +1 -2
- package/dist/components/button-group/index.mjs +1 -2
- package/dist/components/calendar/index.d.mts +1 -2
- package/dist/components/calendar/index.mjs +3 -4
- package/dist/components/card/index.d.mts +1 -3
- package/dist/components/card/index.mjs +1 -2
- package/dist/components/carousel/index.d.mts +1 -2
- package/dist/components/carousel/index.mjs +3 -4
- package/dist/components/cascade-select/index.d.mts +1 -2
- package/dist/components/cascade-select/index.mjs +6 -7
- package/dist/components/checkbox/index.d.mts +1 -2
- package/dist/components/checkbox/index.mjs +3 -4
- package/dist/components/checkbox-group/index.d.mts +1 -2
- package/dist/components/checkbox-group/index.mjs +3 -4
- package/dist/components/chip/index.d.mts +1 -2
- package/dist/components/chip/index.mjs +2 -3
- package/dist/components/client-only/index.d.mts +0 -2
- package/dist/components/client-only/index.mjs +2 -3
- package/dist/components/clipboard/index.d.mts +1 -2
- package/dist/components/clipboard/index.mjs +3 -4
- package/dist/components/collapsible/index.d.mts +1 -2
- package/dist/components/collapsible/index.mjs +3 -4
- package/dist/components/collection/index.mjs +1 -2
- package/dist/components/color-picker/index.d.mts +3 -2
- package/dist/components/color-picker/index.mjs +38 -25
- package/dist/components/combobox/index.d.mts +1 -2
- package/dist/components/combobox/index.mjs +3 -4
- package/dist/components/command/index.d.mts +1 -2
- package/dist/components/command/index.mjs +3 -4
- package/dist/components/comment/index.d.mts +1 -2
- package/dist/components/comment/index.mjs +2 -3
- package/dist/components/config-provider/index.d.mts +1 -2
- package/dist/components/config-provider/index.mjs +2 -3
- package/dist/components/container/index.d.mts +1 -2
- package/dist/components/container/index.mjs +2 -3
- package/dist/components/data-view/index.d.mts +1 -2
- package/dist/components/data-view/index.mjs +3 -4
- package/dist/components/date-input/index.d.mts +0 -2
- package/dist/components/date-input/index.mjs +2 -3
- package/dist/components/date-picker/index.d.mts +0 -2
- package/dist/components/date-picker/index.mjs +3 -4
- package/dist/components/deferred-content/index.d.mts +1 -2
- package/dist/components/deferred-content/index.mjs +2 -3
- package/dist/components/descriptions/index.d.mts +1 -2
- package/dist/components/descriptions/index.mjs +2 -3
- package/dist/components/dialog/index.d.mts +31 -4
- package/dist/components/dialog/index.mjs +41 -10
- package/dist/components/dock/index.d.mts +1 -3
- package/dist/components/dock/index.mjs +1 -2
- package/dist/components/download-trigger/index.d.mts +0 -2
- package/dist/components/download-trigger/index.mjs +2 -3
- package/dist/components/drawer/index.d.mts +1 -2
- package/dist/components/drawer/index.mjs +3 -4
- package/dist/components/dynamic-input/index.d.mts +1 -2
- package/dist/components/dynamic-input/index.mjs +5 -6
- package/dist/components/editable/index.d.mts +1 -2
- package/dist/components/editable/index.mjs +3 -4
- package/dist/components/ellipsis/index.d.mts +1 -2
- package/dist/components/ellipsis/index.mjs +2 -3
- package/dist/components/empty/index.d.mts +1 -3
- package/dist/components/empty/index.mjs +1 -2
- package/dist/components/field/index.d.mts +1 -2
- package/dist/components/field/index.mjs +2 -3
- package/dist/components/fieldset/index.d.mts +1 -2
- package/dist/components/fieldset/index.mjs +2 -3
- package/dist/components/file-upload/index.d.mts +1 -2
- package/dist/components/file-upload/index.mjs +4 -9
- package/dist/components/float-button/index.d.mts +23 -3
- package/dist/components/float-button/index.mjs +30 -5
- package/dist/components/floating-panel/index.d.mts +1 -2
- package/dist/components/floating-panel/index.mjs +8 -4
- package/dist/components/focus-trap/index.d.mts +0 -2
- package/dist/components/focus-trap/index.mjs +2 -3
- package/dist/components/form/index.d.mts +0 -2
- package/dist/components/form/index.mjs +2 -3
- package/dist/components/format/index.d.mts +1 -3
- package/dist/components/format/index.mjs +1 -2
- package/dist/components/frame/index.d.mts +1 -3
- package/dist/components/frame/index.mjs +3 -4
- package/dist/components/grid/index.d.mts +1 -2
- package/dist/components/grid/index.mjs +2 -3
- package/dist/components/highlight/index.d.mts +1 -3
- package/dist/components/highlight/index.mjs +2 -3
- package/dist/components/hover-card/index.d.mts +1 -2
- package/dist/components/hover-card/index.mjs +2 -3
- package/dist/components/icon/index.d.mts +1 -2
- package/dist/components/icon/index.mjs +2 -3
- package/dist/components/image/index.d.mts +1 -2
- package/dist/components/image/index.mjs +3 -4
- package/dist/components/image-cropper/index.d.mts +1 -2
- package/dist/components/image-cropper/index.mjs +2 -3
- package/dist/components/image-viewer/index.d.mts +1 -1
- package/dist/components/image-viewer/index.mjs +1 -2
- package/dist/components/input/index.d.mts +1 -3
- package/dist/components/input/index.mjs +1 -2
- package/dist/components/input-group/index.d.mts +1 -3
- package/dist/components/input-group/index.mjs +1 -2
- package/dist/components/json-tree-view/index.d.mts +1 -2
- package/dist/components/json-tree-view/index.mjs +3 -4
- package/dist/components/kbd/index.d.mts +1 -2
- package/dist/components/kbd/index.mjs +2 -3
- package/dist/components/layout/index.d.mts +1 -2
- package/dist/components/layout/index.mjs +19 -15
- package/dist/components/link/index.d.mts +1 -2
- package/dist/components/link/index.mjs +2 -3
- package/dist/components/list/index.d.mts +1 -2
- package/dist/components/list/index.mjs +1 -2
- package/dist/components/listbox/index.d.mts +0 -2
- package/dist/components/listbox/index.mjs +3 -4
- package/dist/components/marquee/index.d.mts +1 -2
- package/dist/components/marquee/index.mjs +2 -3
- package/dist/components/masonry/index.d.mts +1 -2
- package/dist/components/masonry/index.mjs +2 -3
- package/dist/components/media-player/index.d.mts +1 -1
- package/dist/components/media-player/index.mjs +1 -2
- package/dist/components/mentions/index.d.mts +2 -2
- package/dist/components/mentions/index.mjs +1 -2
- package/dist/components/menu/index.d.mts +1 -2
- package/dist/components/menu/index.mjs +3 -4
- package/dist/components/menubar/index.d.mts +1 -2
- package/dist/components/menubar/index.mjs +2 -3
- package/dist/components/meter/index.d.mts +1 -3
- package/dist/components/meter/index.mjs +1 -2
- package/dist/components/navigation-menu/index.d.mts +1 -2
- package/dist/components/navigation-menu/index.mjs +2 -3
- package/dist/components/number-input/index.d.mts +1 -2
- package/dist/components/number-input/index.mjs +3 -4
- package/dist/components/order-list/index.d.mts +1 -2
- package/dist/components/order-list/index.mjs +4 -5
- package/dist/components/page-header/index.d.mts +1 -3
- package/dist/components/page-header/index.mjs +1 -2
- package/dist/components/pagination/index.d.mts +3 -4
- package/dist/components/pagination/index.mjs +3 -4
- package/dist/components/password-input/index.d.mts +1 -2
- package/dist/components/password-input/index.mjs +3 -4
- package/dist/components/pin-input/index.d.mts +1 -2
- package/dist/components/pin-input/index.mjs +2 -3
- package/dist/components/popconfirm/index.d.mts +2 -3
- package/dist/components/popconfirm/index.mjs +2 -3
- package/dist/components/popover/index.d.mts +1 -1
- package/dist/components/popover/index.mjs +3 -4
- package/dist/components/presence/index.d.mts +0 -2
- package/dist/components/presence/index.mjs +2 -3
- package/dist/components/progress/index.d.mts +1 -2
- package/dist/components/progress/index.mjs +2 -3
- package/dist/components/progress-group/index.d.mts +1 -2
- package/dist/components/progress-group/index.mjs +2 -3
- package/dist/components/qr-code/index.d.mts +1 -2
- package/dist/components/qr-code/index.mjs +2 -3
- package/dist/components/radio-group/index.d.mts +1 -2
- package/dist/components/radio-group/index.mjs +2 -3
- package/dist/components/rating-group/index.d.mts +1 -2
- package/dist/components/rating-group/index.mjs +3 -4
- package/dist/components/result/index.d.mts +1 -2
- package/dist/components/result/index.mjs +2 -3
- package/dist/components/scroll-area/index.d.mts +8 -3
- package/dist/components/scroll-area/index.mjs +7 -6
- package/dist/components/segment-group/index.d.mts +1 -2
- package/dist/components/segment-group/index.mjs +2 -3
- package/dist/components/select/index.d.mts +1 -1
- package/dist/components/select/index.mjs +1 -2
- package/dist/components/separator/index.d.mts +1 -2
- package/dist/components/separator/index.mjs +2 -3
- package/dist/components/signature-pad/index.d.mts +1 -2
- package/dist/components/signature-pad/index.mjs +3 -4
- package/dist/components/skeleton/index.d.mts +1 -2
- package/dist/components/skeleton/index.mjs +2 -3
- package/dist/components/slider/index.d.mts +1 -2
- package/dist/components/slider/index.mjs +2 -3
- package/dist/components/spinner/index.d.mts +1 -2
- package/dist/components/spinner/index.mjs +3 -4
- package/dist/components/split-button/index.d.mts +1 -2
- package/dist/components/split-button/index.mjs +4 -5
- package/dist/components/splitter/index.d.mts +1 -2
- package/dist/components/splitter/index.mjs +2 -3
- package/dist/components/spotlight/index.d.mts +1 -2
- package/dist/components/spotlight/index.mjs +2 -3
- package/dist/components/stack/index.d.mts +1 -2
- package/dist/components/stack/index.mjs +2 -3
- package/dist/components/stat/index.d.mts +1 -3
- package/dist/components/stat/index.mjs +1 -2
- package/dist/components/steps/index.d.mts +0 -2
- package/dist/components/steps/index.mjs +2 -3
- package/dist/components/swap/index.d.mts +1 -2
- package/dist/components/swap/index.mjs +3 -4
- package/dist/components/switch/index.d.mts +1 -2
- package/dist/components/switch/index.mjs +2 -3
- package/dist/components/table/index.d.mts +0 -2
- package/dist/components/table/index.mjs +5 -6
- package/dist/components/tabs/index.d.mts +9 -3
- package/dist/components/tabs/index.mjs +36 -8
- package/dist/components/tag/index.d.mts +1 -2
- package/dist/components/tag/index.mjs +3 -4
- package/dist/components/tags-input/index.d.mts +1 -2
- package/dist/components/tags-input/index.mjs +3 -4
- package/dist/components/terminal/index.d.mts +4 -3
- package/dist/components/terminal/index.mjs +8 -7
- package/dist/components/textarea/index.d.mts +1 -2
- package/dist/components/textarea/index.mjs +2 -3
- package/dist/components/timeline/index.d.mts +1 -2
- package/dist/components/timeline/index.mjs +1 -2
- package/dist/components/timer/index.d.mts +1 -2
- package/dist/components/timer/index.mjs +2 -3
- package/dist/components/toast/index.d.mts +0 -2
- package/dist/components/toast/index.mjs +18 -6
- package/dist/components/toc/index.d.mts +1 -2
- package/dist/components/toc/index.mjs +2 -3
- package/dist/components/toggle/index.d.mts +1 -2
- package/dist/components/toggle/index.mjs +2 -3
- package/dist/components/toggle-group/index.d.mts +1 -2
- package/dist/components/toggle-group/index.mjs +3 -4
- package/dist/components/toolbar/index.d.mts +1 -2
- package/dist/components/toolbar/index.mjs +2 -3
- package/dist/components/tooltip/index.d.mts +1 -2
- package/dist/components/tooltip/index.mjs +2 -3
- package/dist/components/tour/index.d.mts +0 -2
- package/dist/components/tour/index.mjs +2 -3
- package/dist/components/transfer/index.d.mts +1 -2
- package/dist/components/transfer/index.mjs +5 -6
- package/dist/components/tree-select/index.d.mts +2 -3
- package/dist/components/tree-select/index.mjs +5 -6
- package/dist/components/tree-view/index.d.mts +15 -5
- package/dist/components/tree-view/index.mjs +30 -12
- package/dist/components/typography/index.d.mts +1 -3
- package/dist/components/typography/index.mjs +1 -2
- package/dist/components/user/index.d.mts +1 -2
- package/dist/components/user/index.mjs +2 -3
- package/dist/components/virtual-list/index.d.mts +1 -2
- package/dist/components/virtual-list/index.mjs +2 -3
- package/dist/components/watermark/index.d.mts +1 -2
- package/dist/components/watermark/index.mjs +2 -3
- package/dist/{family-DE_GQeeM.mjs → family-Co1YsN4N.mjs} +1 -2
- package/dist/generative/index.d.mts +0 -2
- package/dist/generative/index.mjs +146 -106
- package/dist/{icon-Cri0-7-x.mjs → icon-C9udWCyz.mjs} +1 -2
- package/dist/{id-C37UYLwJ.mjs → id-Ctic_3o8.mjs} +1 -2
- package/dist/{image-viewer-D4FuYrk6.mjs → image-viewer-BYiXpi1X.mjs} +21 -26
- package/dist/{index-Eu-Bttta.d.mts → index-BVdkcSSY.d.mts} +0 -2
- package/dist/index-CjO4Ggf0.d.mts +115 -0
- package/dist/{index-Dj8S4eyJ.d.mts → index-D4C52fI7.d.mts} +0 -4
- package/dist/{index-BcRdWGY-.d.mts → index-DIZEFqJM.d.mts} +0 -8
- package/dist/{index-Bbg4heDO.d.mts → index-DcpvCyt6.d.mts} +63 -18
- package/dist/{index-D_iKc2Uw.d.mts → index-DczfbPCg.d.mts} +0 -4
- package/dist/index-lCsvE2Vl.d.mts +37 -0
- package/dist/index.d.mts +14 -14
- package/dist/index.mjs +10 -10
- package/dist/{input-BDpQ0e6G.mjs → input-YRjehBhU.mjs} +3 -5
- package/dist/{media-player-C0WcjVI-.mjs → media-player-CO2Cczl-.mjs} +7 -12
- package/dist/mentions-De7ChJbl.mjs +335 -0
- package/dist/{messages-1jJWtaYU.mjs → messages-B6n0lVyt.mjs} +1 -2
- package/dist/{select-D_soVdWK.mjs → select-DQ5669_K.mjs} +4 -6
- package/package.json +17 -17
- package/dist/index-B4twHAQC.d.mts +0 -10456
- package/dist/mentions-BwnyvdXz.mjs +0 -213
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { n as iconHtml, r as iconNode } from "./icon-C9udWCyz.mjs";
|
|
2
|
+
import { t as useElementId } from "./id-Ctic_3o8.mjs";
|
|
3
|
+
import { t as withSelfRoot } from "./family-Co1YsN4N.mjs";
|
|
4
|
+
import { n as useComponentMessages } from "./messages-B6n0lVyt.mjs";
|
|
5
|
+
import { Button } from "./components/button/index.mjs";
|
|
6
|
+
import { Field } from "./components/field/index.mjs";
|
|
7
|
+
import { n as MentionsVessel, r as useMentions } from "./mentions-De7ChJbl.mjs";
|
|
8
|
+
import { injectComponentStyle } from "@bysages/core/styling";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { useEffect, useRef } from "react";
|
|
11
|
+
// src/components/ai-prompt-input/editor.ts
|
|
12
|
+
const triggerList = (triggers) => {
|
|
13
|
+
return (triggers == null ? ["@"] : Array.isArray(triggers) ? triggers : [triggers]).filter((trigger) => trigger.length > 0);
|
|
14
|
+
};
|
|
15
|
+
const tokensFor = (value, entries, triggers) => {
|
|
16
|
+
const tokens = [];
|
|
17
|
+
const add = (pattern, entry, trigger) => {
|
|
18
|
+
if (!pattern || !value.includes(pattern)) return;
|
|
19
|
+
tokens.push({
|
|
20
|
+
pattern,
|
|
21
|
+
entry,
|
|
22
|
+
trigger
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
entries.forEach((entry) => {
|
|
26
|
+
triggers.forEach((trigger) => {
|
|
27
|
+
add(trigger + entry.label, entry, trigger);
|
|
28
|
+
const inserted = entry.insertText?.trim();
|
|
29
|
+
if (inserted?.startsWith(trigger)) add(inserted, entry, trigger);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return tokens.sort((left, right) => {
|
|
33
|
+
return value.indexOf(left.pattern) - value.indexOf(right.pattern) || right.pattern.length - left.pattern.length;
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const readToken = (node) => ({
|
|
37
|
+
pattern: `${node.dataset.promptTrigger ?? "@"}${node.dataset.promptLabel ?? ""}`,
|
|
38
|
+
trigger: node.dataset.promptTrigger ?? "@",
|
|
39
|
+
entry: {
|
|
40
|
+
id: node.dataset.promptId,
|
|
41
|
+
label: node.dataset.promptLabel ?? "",
|
|
42
|
+
value: node.dataset.promptValue ?? "",
|
|
43
|
+
icon: node.dataset.promptIcon,
|
|
44
|
+
kind: node.dataset.promptKind
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const readNode = (node) => {
|
|
48
|
+
if (node.nodeType === Node.TEXT_NODE) return node.textContent ?? "";
|
|
49
|
+
if (!(node instanceof HTMLElement)) return "";
|
|
50
|
+
if (node.tagName === "BR") return "\n";
|
|
51
|
+
if (node.dataset.promptToken === "") return readToken(node).pattern;
|
|
52
|
+
const block = node.tagName === "DIV" || node.tagName === "P";
|
|
53
|
+
const children = Array.from(node.childNodes).map(readNode).join("");
|
|
54
|
+
return block && children ? `${children}\n` : children;
|
|
55
|
+
};
|
|
56
|
+
const serializeEditor = (root) => Array.from(root.childNodes).map(readNode).join("").replace(/\n$/, "");
|
|
57
|
+
const readCaret = (root) => {
|
|
58
|
+
const selection = window.getSelection();
|
|
59
|
+
if (document.activeElement !== root || !selection || selection.rangeCount === 0) return serializeEditor(root).length;
|
|
60
|
+
const selected = selection.getRangeAt(selection.rangeCount - 1);
|
|
61
|
+
const range = document.createRange();
|
|
62
|
+
range.selectNodeContents(root);
|
|
63
|
+
range.setEnd(selected.endContainer, selected.endOffset);
|
|
64
|
+
return range.toString().length;
|
|
65
|
+
};
|
|
66
|
+
const caretPosition = (root, offset) => {
|
|
67
|
+
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
|
|
68
|
+
let remaining = offset;
|
|
69
|
+
let node = walker.nextNode();
|
|
70
|
+
let last = null;
|
|
71
|
+
while (node) {
|
|
72
|
+
const text = node;
|
|
73
|
+
if (remaining <= text.data.length) return {
|
|
74
|
+
container: text,
|
|
75
|
+
offset: remaining
|
|
76
|
+
};
|
|
77
|
+
remaining -= text.data.length;
|
|
78
|
+
last = text;
|
|
79
|
+
node = walker.nextNode();
|
|
80
|
+
}
|
|
81
|
+
return last ? {
|
|
82
|
+
container: last,
|
|
83
|
+
offset: last.data.length
|
|
84
|
+
} : {
|
|
85
|
+
container: root,
|
|
86
|
+
offset: root.childNodes.length
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
const tokenNode = (model) => {
|
|
90
|
+
const node = document.createElement("span");
|
|
91
|
+
node.contentEditable = "false";
|
|
92
|
+
node.dataset.promptToken = "";
|
|
93
|
+
node.setAttribute("data-scope", "ai");
|
|
94
|
+
node.setAttribute("data-part", "prompt-mention");
|
|
95
|
+
node.dataset.promptTrigger = model.trigger;
|
|
96
|
+
node.dataset.promptLabel = model.entry.label;
|
|
97
|
+
node.dataset.promptValue = model.entry.value;
|
|
98
|
+
if (model.entry.kind != null) node.dataset.promptKind = model.entry.kind;
|
|
99
|
+
if (model.entry.id) node.dataset.promptId = model.entry.id;
|
|
100
|
+
if (model.entry.icon) node.dataset.promptIcon = model.entry.icon;
|
|
101
|
+
node.title = `${model.trigger}${model.entry.label}`;
|
|
102
|
+
const trigger = document.createElement("span");
|
|
103
|
+
trigger.textContent = model.trigger;
|
|
104
|
+
trigger.setAttribute("data-scope", "ai");
|
|
105
|
+
trigger.setAttribute("data-part", "mention-trigger");
|
|
106
|
+
node.append(trigger);
|
|
107
|
+
if (model.entry.icon) {
|
|
108
|
+
const icon = document.createElement("span");
|
|
109
|
+
icon.setAttribute("data-scope", "ai");
|
|
110
|
+
icon.setAttribute("data-part", "mention-icon");
|
|
111
|
+
icon.innerHTML = iconHtml(model.entry.icon, {
|
|
112
|
+
"data-scope": "icon",
|
|
113
|
+
"data-part": "root",
|
|
114
|
+
"data-size": "inherit"
|
|
115
|
+
});
|
|
116
|
+
node.append(icon);
|
|
117
|
+
}
|
|
118
|
+
const label = document.createElement("span");
|
|
119
|
+
label.textContent = model.entry.label;
|
|
120
|
+
label.setAttribute("data-scope", "ai");
|
|
121
|
+
label.setAttribute("data-part", "mention-label");
|
|
122
|
+
node.append(label);
|
|
123
|
+
return node;
|
|
124
|
+
};
|
|
125
|
+
const renderEditor = (root, value, entries, triggers) => {
|
|
126
|
+
const fragment = document.createDocumentFragment();
|
|
127
|
+
let cursor = 0;
|
|
128
|
+
tokensFor(value, entries, triggerList(triggers)).forEach((model) => {
|
|
129
|
+
const start = value.indexOf(model.pattern, cursor);
|
|
130
|
+
if (start === -1) return;
|
|
131
|
+
if (start > cursor) fragment.append(value.slice(cursor, start));
|
|
132
|
+
fragment.append(tokenNode(model));
|
|
133
|
+
cursor = start + model.pattern.length;
|
|
134
|
+
});
|
|
135
|
+
if (cursor < value.length) fragment.append(value.slice(cursor));
|
|
136
|
+
root.replaceChildren(fragment);
|
|
137
|
+
root.toggleAttribute("data-empty", root.childNodes.length === 0);
|
|
138
|
+
};
|
|
139
|
+
/** Insert a mention as a rich token. The hidden trigger text keeps the
|
|
140
|
+
* browser selection and the serialized plain text in step. */
|
|
141
|
+
const insertEditorToken = (root, entry, trigger, start, end) => {
|
|
142
|
+
const hasTailSpace = /^\s/.test(serializeEditor(root).slice(end));
|
|
143
|
+
const range = document.createRange();
|
|
144
|
+
const from = caretPosition(root, start);
|
|
145
|
+
const to = caretPosition(root, end);
|
|
146
|
+
range.setStart(from.container, from.offset);
|
|
147
|
+
range.setEnd(to.container, to.offset);
|
|
148
|
+
range.deleteContents();
|
|
149
|
+
const node = tokenNode({
|
|
150
|
+
pattern: trigger + entry.label,
|
|
151
|
+
entry,
|
|
152
|
+
trigger
|
|
153
|
+
});
|
|
154
|
+
range.insertNode(node);
|
|
155
|
+
let tail = null;
|
|
156
|
+
if (!hasTailSpace) {
|
|
157
|
+
tail = document.createTextNode(" ");
|
|
158
|
+
node.after(tail);
|
|
159
|
+
}
|
|
160
|
+
root.focus();
|
|
161
|
+
const selection = window.getSelection();
|
|
162
|
+
const followingText = (() => {
|
|
163
|
+
let current = node.nextSibling;
|
|
164
|
+
while (current) {
|
|
165
|
+
if (current.nodeType === Node.TEXT_NODE) return current;
|
|
166
|
+
const text = document.createTreeWalker(current, NodeFilter.SHOW_TEXT).nextNode();
|
|
167
|
+
if (text) return text;
|
|
168
|
+
current = current.nextSibling;
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
})();
|
|
172
|
+
const target = tail ?? followingText;
|
|
173
|
+
if (selection && target) {
|
|
174
|
+
const caret = document.createRange();
|
|
175
|
+
if (tail) caret.selectNodeContents(tail);
|
|
176
|
+
else caret.setStart(target, 0);
|
|
177
|
+
caret.collapse(true);
|
|
178
|
+
selection.removeAllRanges();
|
|
179
|
+
selection.addRange(caret);
|
|
180
|
+
}
|
|
181
|
+
return serializeEditor(root);
|
|
182
|
+
};
|
|
183
|
+
const setEditorCaret = (root, offset) => {
|
|
184
|
+
const position = caretPosition(root, offset);
|
|
185
|
+
const selection = window.getSelection();
|
|
186
|
+
if (!selection) return;
|
|
187
|
+
const range = document.createRange();
|
|
188
|
+
range.setStart(position.container, position.offset);
|
|
189
|
+
range.collapse(true);
|
|
190
|
+
selection.removeAllRanges();
|
|
191
|
+
selection.addRange(range);
|
|
192
|
+
};
|
|
193
|
+
const insertLineBreak = (root) => {
|
|
194
|
+
document.execCommand("insertLineBreak");
|
|
195
|
+
return serializeEditor(root);
|
|
196
|
+
};
|
|
197
|
+
// src/components/ai-prompt-input/index.tsx
|
|
198
|
+
const arrowUpIcon = iconNode("arrow-up", {
|
|
199
|
+
width: 14,
|
|
200
|
+
height: 14
|
|
201
|
+
});
|
|
202
|
+
const stopIcon = iconNode("square", {
|
|
203
|
+
width: 14,
|
|
204
|
+
height: 14
|
|
205
|
+
});
|
|
206
|
+
/** An empty slot leaves no part in the anatomy — the bare vessel keeps
|
|
207
|
+
* its single-line posture. */
|
|
208
|
+
function row(part, content) {
|
|
209
|
+
if (content == null || Array.isArray(content) && content.length === 0) return null;
|
|
210
|
+
return /* @__PURE__ */ jsx("div", {
|
|
211
|
+
"data-scope": "ai",
|
|
212
|
+
"data-part": part,
|
|
213
|
+
children: content
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function PromptInputImpl({ value, onValueChange, onSubmit, onStop, placeholder, "aria-label": ariaLabel, disabled = false, busy = false, mentions, onSelect, header, leading, trailing, footer, footerEnd, ...rest }) {
|
|
217
|
+
injectComponentStyle("ai");
|
|
218
|
+
const fieldRef = useRef(null);
|
|
219
|
+
const editorRef = useRef(null);
|
|
220
|
+
const hostId = useElementId("ai-prompt", rest);
|
|
221
|
+
const messages = useComponentMessages();
|
|
222
|
+
const placeholderText = placeholder ?? messages.ai.conversation;
|
|
223
|
+
const mentionsActive = mentions != null;
|
|
224
|
+
const mentionState = useMentions(() => ({
|
|
225
|
+
items: mentions?.items ?? [],
|
|
226
|
+
trigger: mentions?.trigger,
|
|
227
|
+
triggers: mentions?.triggers,
|
|
228
|
+
commitKeys: mentions?.commitKeys ?? [
|
|
229
|
+
"Enter",
|
|
230
|
+
" ",
|
|
231
|
+
"Tab"
|
|
232
|
+
]
|
|
233
|
+
}), () => fieldRef.current, {
|
|
234
|
+
getCaret: () => mentions ? readCaret(editorRef.current) : void 0,
|
|
235
|
+
getText: () => mentions ? serializeEditor(editorRef.current) : fieldRef.current?.value ?? value,
|
|
236
|
+
setText: (next) => onValueChange?.(next),
|
|
237
|
+
select: (entry) => {
|
|
238
|
+
onSelect?.(entry);
|
|
239
|
+
return mentions?.insertOnSelect !== false || mentions?.clearQueryOnSelect !== false;
|
|
240
|
+
},
|
|
241
|
+
commit: (entry) => insertChoice(entry)
|
|
242
|
+
});
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
const editor = editorRef.current;
|
|
245
|
+
if (!editor) return;
|
|
246
|
+
renderEditor(editor, value, mentions?.items ?? [], mentions?.triggers);
|
|
247
|
+
editor.toggleAttribute("data-empty", !value);
|
|
248
|
+
});
|
|
249
|
+
const publishEditor = () => {
|
|
250
|
+
const editor = editorRef.current;
|
|
251
|
+
if (!editor) return;
|
|
252
|
+
const next = serializeEditor(editor);
|
|
253
|
+
editor.toggleAttribute("data-empty", !next);
|
|
254
|
+
onValueChange?.(next);
|
|
255
|
+
};
|
|
256
|
+
const insertChoice = (entry) => {
|
|
257
|
+
const editor = editorRef.current;
|
|
258
|
+
const clearQuery = mentions?.insertOnSelect === false && mentions?.clearQueryOnSelect !== false;
|
|
259
|
+
if (!editor || entry.disabled || mentions?.insertOnSelect === false && !clearQuery) {
|
|
260
|
+
mentionState.close();
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (clearQuery) {
|
|
264
|
+
const text = serializeEditor(editor);
|
|
265
|
+
const next = text.slice(0, mentionState.anchorIndex.current) + text.slice(mentionState.caretIndex.current);
|
|
266
|
+
renderEditor(editor, next, mentions?.items ?? [], mentions?.triggers);
|
|
267
|
+
editor.toggleAttribute("data-empty", !next);
|
|
268
|
+
editor.focus();
|
|
269
|
+
setEditorCaret(editor, mentionState.anchorIndex.current);
|
|
270
|
+
onValueChange?.(next);
|
|
271
|
+
mentionState.close();
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
onSelect?.(entry);
|
|
275
|
+
const next = insertEditorToken(editor, entry, mentionState.activeTrigger.current, mentionState.anchorIndex.current, mentionState.caretIndex.current);
|
|
276
|
+
editor.toggleAttribute("data-empty", !next);
|
|
277
|
+
onValueChange?.(next);
|
|
278
|
+
mentionState.close();
|
|
279
|
+
};
|
|
280
|
+
const submit = () => {
|
|
281
|
+
const text = value.trim();
|
|
282
|
+
if (!text || disabled || busy) return;
|
|
283
|
+
onSubmit?.(text);
|
|
284
|
+
onValueChange?.("");
|
|
285
|
+
};
|
|
286
|
+
const editorKeydown = (event) => {
|
|
287
|
+
if (event.nativeEvent.isComposing || event.keyCode === 229) return;
|
|
288
|
+
if (event.key === "Enter" && event.shiftKey) {
|
|
289
|
+
event.preventDefault();
|
|
290
|
+
const editor = editorRef.current;
|
|
291
|
+
if (!editor) return;
|
|
292
|
+
onValueChange?.(insertLineBreak(editor));
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (mentionState.onKeydown(event)) return;
|
|
296
|
+
if (event.key === "Enter") {
|
|
297
|
+
event.preventDefault();
|
|
298
|
+
submit();
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const seal = busy ? /* @__PURE__ */ jsx(Button, {
|
|
302
|
+
variant: "solid",
|
|
303
|
+
size: "sm",
|
|
304
|
+
square: true,
|
|
305
|
+
type: "button",
|
|
306
|
+
"aria-label": messages.ai.stop,
|
|
307
|
+
disabled,
|
|
308
|
+
onClick: () => onStop?.(),
|
|
309
|
+
children: stopIcon
|
|
310
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
311
|
+
variant: "solid",
|
|
312
|
+
size: "sm",
|
|
313
|
+
square: true,
|
|
314
|
+
type: "submit",
|
|
315
|
+
"aria-label": messages.ai.send,
|
|
316
|
+
disabled: disabled || !value.trim(),
|
|
317
|
+
children: arrowUpIcon
|
|
318
|
+
});
|
|
319
|
+
const hasFooter = footer != null && (!Array.isArray(footer) || footer.length > 0);
|
|
320
|
+
return /* @__PURE__ */ jsxs("form", {
|
|
321
|
+
...rest,
|
|
322
|
+
"data-scope": "ai",
|
|
323
|
+
"data-part": "prompt",
|
|
324
|
+
onSubmit: (event) => {
|
|
325
|
+
event.preventDefault();
|
|
326
|
+
submit();
|
|
327
|
+
},
|
|
328
|
+
children: [
|
|
329
|
+
row("prompt-header", header),
|
|
330
|
+
/* @__PURE__ */ jsxs("div", {
|
|
331
|
+
"data-scope": "ai",
|
|
332
|
+
"data-part": "prompt-main",
|
|
333
|
+
children: [
|
|
334
|
+
row("prompt-leading", leading),
|
|
335
|
+
mentionsActive ? /* @__PURE__ */ jsx("div", {
|
|
336
|
+
ref: editorRef,
|
|
337
|
+
contentEditable: !disabled,
|
|
338
|
+
role: "combobox",
|
|
339
|
+
"aria-autocomplete": "list",
|
|
340
|
+
tabIndex: disabled ? void 0 : 0,
|
|
341
|
+
"aria-label": ariaLabel ?? messages.ai.conversation,
|
|
342
|
+
"aria-expanded": mentionState.open,
|
|
343
|
+
"aria-controls": mentionState.open ? `${hostId}:mentions:popup` : void 0,
|
|
344
|
+
"aria-disabled": disabled || void 0,
|
|
345
|
+
"data-scope": "ai",
|
|
346
|
+
"data-part": "prompt-editor",
|
|
347
|
+
"data-empty": value ? void 0 : "",
|
|
348
|
+
"data-placeholder": placeholderText,
|
|
349
|
+
"data-disabled": disabled || void 0,
|
|
350
|
+
onInput: () => {
|
|
351
|
+
publishEditor();
|
|
352
|
+
if (!disabled) mentionState.onInput();
|
|
353
|
+
},
|
|
354
|
+
onKeyDown: editorKeydown
|
|
355
|
+
}) : /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(Field.Textarea, {
|
|
356
|
+
ref: fieldRef,
|
|
357
|
+
autoresize: true,
|
|
358
|
+
rows: 1,
|
|
359
|
+
value,
|
|
360
|
+
placeholder: placeholderText,
|
|
361
|
+
"aria-label": ariaLabel ?? messages.ai.conversation,
|
|
362
|
+
disabled,
|
|
363
|
+
onChange: (event) => {
|
|
364
|
+
onValueChange?.(event.target.value);
|
|
365
|
+
mentionState.onInput();
|
|
366
|
+
},
|
|
367
|
+
onKeyDown: (event) => {
|
|
368
|
+
if (event.nativeEvent.isComposing || event.keyCode === 229) return;
|
|
369
|
+
if (mentionState.onKeydown(event)) return;
|
|
370
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
371
|
+
event.preventDefault();
|
|
372
|
+
submit();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}) }),
|
|
376
|
+
mentionsActive ? /* @__PURE__ */ jsx(MentionsVessel, {
|
|
377
|
+
id: `${hostId}:mentions`,
|
|
378
|
+
open: mentionState.open,
|
|
379
|
+
matches: mentionState.matches,
|
|
380
|
+
active: mentionState.active,
|
|
381
|
+
anchor: editorRef.current,
|
|
382
|
+
placement: mentions?.placement ?? "top-start",
|
|
383
|
+
onInsert: insertChoice,
|
|
384
|
+
onActiveChange: mentionState.setActive,
|
|
385
|
+
onOpenChange: (open) => {
|
|
386
|
+
if (!open) mentionState.close();
|
|
387
|
+
}
|
|
388
|
+
}) : null,
|
|
389
|
+
row("prompt-trailing", hasFooter ? trailing : trailing ?? seal)
|
|
390
|
+
]
|
|
391
|
+
}),
|
|
392
|
+
hasFooter ? /* @__PURE__ */ jsxs("div", {
|
|
393
|
+
"data-scope": "ai",
|
|
394
|
+
"data-part": "prompt-footer",
|
|
395
|
+
children: [footer, row("prompt-end", footerEnd == null ? seal : /* @__PURE__ */ jsxs(Fragment, { children: [footerEnd, seal] }))]
|
|
396
|
+
}) : null
|
|
397
|
+
]
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
const PromptInput = withSelfRoot(PromptInputImpl);
|
|
401
|
+
export { PromptInput as t };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as iconHtml } from "./icon-
|
|
2
|
-
import { t as withSelfRoot } from "./family-
|
|
3
|
-
import { n as useComponentMessages } from "./messages-
|
|
1
|
+
import { n as iconHtml } from "./icon-C9udWCyz.mjs";
|
|
2
|
+
import { t as withSelfRoot } from "./family-Co1YsN4N.mjs";
|
|
3
|
+
import { n as useComponentMessages } from "./messages-B6n0lVyt.mjs";
|
|
4
4
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import { renderMarkdown } from "@bysages/core/markdown";
|
|
8
|
+
// src/components/ai-response/code-copy.ts
|
|
9
9
|
/** The two curated icons a copy affordance needs: the stamp and its
|
|
10
10
|
* confirmation. Inline SVG keeps the enhancement framework-agnostic —
|
|
11
11
|
* it lives beside the renderer's generated code HTML. */
|
|
@@ -67,8 +67,7 @@ async function clickCodeCopy(event, copyLabel, copiedLabel) {
|
|
|
67
67
|
button.setAttribute("aria-label", copyLabel);
|
|
68
68
|
}, REVERT_MS);
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
//#region src/components/ai-response/tables.ts
|
|
70
|
+
// src/components/ai-response/tables.ts
|
|
72
71
|
/** Wide tables ride a scrolling lane instead of bursting the column.
|
|
73
72
|
* The lane is a plain div: the table-as-scroll-container form is what
|
|
74
73
|
* ate the mouse wheel over plain tables. Idempotent, so it can run
|
|
@@ -106,10 +105,10 @@ function wrapResponseTables(root) {
|
|
|
106
105
|
watchLane(lane);
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
|
-
|
|
110
|
-
//#region src/components/ai-response/index.tsx
|
|
108
|
+
// src/components/ai-response/index.tsx
|
|
111
109
|
function ResponseImpl({ content, highlighter, copyLabel, copiedLabel, ...rest }) {
|
|
112
110
|
injectComponentStyle("ai");
|
|
111
|
+
injectComponentStyle("markdown");
|
|
113
112
|
const messages = useComponentMessages();
|
|
114
113
|
const resolvedCopyLabel = copyLabel ?? messages.ai.copyCode;
|
|
115
114
|
const resolvedCopiedLabel = copiedLabel ?? messages.ai.copied;
|
|
@@ -132,9 +131,8 @@ function ResponseImpl({ content, highlighter, copyLabel, copiedLabel, ...rest })
|
|
|
132
131
|
"data-scope": "ai",
|
|
133
132
|
"data-part": "response",
|
|
134
133
|
onClick,
|
|
135
|
-
dangerouslySetInnerHTML: { __html:
|
|
134
|
+
dangerouslySetInnerHTML: { __html: renderMarkdown(content, highlighter ? { highlighter } : void 0) }
|
|
136
135
|
});
|
|
137
136
|
}
|
|
138
137
|
const Response = withSelfRoot(ResponseImpl);
|
|
139
|
-
//#endregion
|
|
140
138
|
export { Response as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { r as iconNode } from "./icon-
|
|
2
|
-
|
|
1
|
+
import { r as iconNode } from "./icon-C9udWCyz.mjs";
|
|
2
|
+
// src/components/ai/chevron.tsx
|
|
3
3
|
/** The folding chevron the shared indicator turns. */
|
|
4
4
|
const chevron = iconNode("chevron-right");
|
|
5
|
-
//#endregion
|
|
6
5
|
export { chevron as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Accordion as Accordion$1 } from "@ark-ui/react/accordion";
|
|
2
|
-
//#region src/components/accordion/index.d.ts
|
|
3
2
|
export type AccordionItem = {
|
|
4
3
|
value: string;
|
|
5
4
|
title: string;
|
|
@@ -22,4 +21,4 @@ declare namespace AccordionFacade {
|
|
|
22
21
|
}
|
|
23
22
|
type AccordionParts = typeof Accordion$1;
|
|
24
23
|
export declare const Accordion: typeof AccordionFacade & AccordionParts;
|
|
25
|
-
|
|
24
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as iconNode } from "../../icon-
|
|
2
|
-
import { t as useElementId } from "../../id-
|
|
1
|
+
import { r as iconNode } from "../../icon-C9udWCyz.mjs";
|
|
2
|
+
import { t as useElementId } from "../../id-Ctic_3o8.mjs";
|
|
3
3
|
import { Accordion as Accordion$1 } from "@ark-ui/react/accordion";
|
|
4
4
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/components/accordion/index.tsx
|
|
7
7
|
/** Ark's Accordion, dressed in the paper-and-ink system: a ruled sheet
|
|
8
8
|
* folded by quiet rows, unfolding with a spring-chevoned dissolve. The
|
|
9
9
|
* API is Ark's own — Root, Item, ItemTrigger, ItemContent, ItemIndicator. */
|
|
@@ -36,5 +36,4 @@ const Accordion = Object.assign(AccordionFacade, {
|
|
|
36
36
|
Root: AccordionRoot
|
|
37
37
|
});
|
|
38
38
|
injectComponentStyle("accordion");
|
|
39
|
-
//#endregion
|
|
40
39
|
export { Accordion };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
-
//#region src/components/affix/index.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* A nail: the wrapped content travels with the page until it reaches its
|
|
5
4
|
* offset, then stays put while the page moves on. The semantics are
|
|
@@ -20,4 +19,4 @@ declare function AffixImpl({ offsetTop, offsetBottom, ...rest }: AffixProps): im
|
|
|
20
19
|
export declare const Affix: typeof AffixImpl & {
|
|
21
20
|
Root: typeof AffixImpl;
|
|
22
21
|
};
|
|
23
|
-
|
|
22
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as withSelfRoot } from "../../family-
|
|
1
|
+
import { t as withSelfRoot } from "../../family-Co1YsN4N.mjs";
|
|
2
2
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/affix/index.tsx
|
|
5
5
|
function AffixImpl({ offsetTop, offsetBottom, ...rest }) {
|
|
6
6
|
injectComponentStyle("affix");
|
|
7
7
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -16,5 +16,4 @@ function AffixImpl({ offsetTop, offsetBottom, ...rest }) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
const Affix = withSelfRoot(AffixImpl);
|
|
19
|
-
//#endregion
|
|
20
19
|
export { Affix };
|
|
@@ -1,2 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ActionProps } from "../ai-action/index.mjs";
|
|
2
|
+
import { r as ToolProps } from "../../index-lCsvE2Vl.mjs";
|
|
3
|
+
import { C as toolPartDisplay, S as AiToolDisplay, _ as AiSdkSourceDocumentPart, a as AiMediaProps, b as AiSdkTextPart, c as AiPartsSlots, d as AiSdkFilePart, f as AiSdkMediaPart, g as AiSdkReasoningPart, h as AiSdkReasoningFilePart, i as AiMediaKind, l as AiSdkCustomPart, m as AiSdkMessagePart, n as MessageProps, o as AiParts, p as AiSdkMessage, r as AiMedia, s as AiPartsProps, u as AiSdkDataPart, v as AiSdkSourceUrlPart, x as AiSdkToolPart, y as AiSdkStepStartPart } from "../../index-CjO4Ggf0.mjs";
|
|
4
|
+
import { PromptInputProps } from "../ai-prompt-input/index.mjs";
|
|
5
|
+
import { ReasoningProps } from "../ai-reasoning/index.mjs";
|
|
6
|
+
import { ResponseProps } from "../ai-response/index.mjs";
|
|
7
|
+
import { SourceProps, SourcesProps } from "../ai-source/index.mjs";
|
|
8
|
+
import { SuggestionProps } from "../ai-suggestion/index.mjs";
|
|
9
|
+
import { HTMLAttributes } from "react";
|
|
10
|
+
import { ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatState, ChatStatus, CreateUIMessage, CustomContentUIPart, DataUIPart, DynamicToolUIPart, FileUIPart, InferUITools, ProviderMetadata, ProviderReference, ReasoningFileUIPart, ReasoningUIPart, SourceDocumentUIPart, SourceUrlUIPart, StepStartUIPart, TextUIPart, ToolSet, ToolUIPart, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UITool, UIToolInvocation, UITools } from "ai";
|
|
11
|
+
/** The log itself: the column every stroke lands in, a landmark to
|
|
12
|
+
* screen readers. While the reply streams, the log follows its growth —
|
|
13
|
+
* but only while the reader rests at the bottom edge. */
|
|
14
|
+
export declare function AiConversation({ autoScroll, children, ...rest }: HTMLAttributes<HTMLElement> & {
|
|
15
|
+
autoScroll?: boolean;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
/** The optional jump-to-latest door: an explicit part the caller drops
|
|
18
|
+
* inside the conversation when the log scrolls. It watches the log's
|
|
19
|
+
* distance from the bottom edge and surfaces only while the reader is
|
|
20
|
+
* away — clicking returns to the stream. Nothing renders by default. */
|
|
21
|
+
export declare function AiJumpToLatest({ threshold, onJump, children, ...rest }: HTMLAttributes<HTMLButtonElement> & {
|
|
22
|
+
threshold?: number;
|
|
23
|
+
onJump?: () => void;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
25
|
+
/** The bubble's inner measure — content that belongs to neither side
|
|
26
|
+
* specifically. */
|
|
27
|
+
export declare const AiContent: {
|
|
28
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
} & {
|
|
31
|
+
Root: {
|
|
32
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/** The quiet row under a message — copy, retry, feedback. */
|
|
37
|
+
export declare const AiActions: {
|
|
38
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
39
|
+
displayName: string;
|
|
40
|
+
} & {
|
|
41
|
+
Root: {
|
|
42
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
43
|
+
displayName: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
/** The while-it-works whisper for the in-flight turns. */
|
|
47
|
+
declare function AiLoader({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
48
|
+
/** The whole family under one handle — `Ai.Conversation`,
|
|
49
|
+
* `Ai.Message`, and the rest, exactly as before the split. */
|
|
50
|
+
export declare const Ai: typeof AiConversation & {
|
|
51
|
+
Root: typeof AiConversation;
|
|
52
|
+
Conversation: typeof AiConversation;
|
|
53
|
+
MessageContent: {
|
|
54
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
55
|
+
displayName: string;
|
|
56
|
+
} & {
|
|
57
|
+
Root: {
|
|
58
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
59
|
+
displayName: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
Actions: {
|
|
63
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
64
|
+
displayName: string;
|
|
65
|
+
} & {
|
|
66
|
+
Root: {
|
|
67
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
68
|
+
displayName: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
Loader: typeof AiLoader;
|
|
72
|
+
Media: ((props: AiMediaProps) => import("react").JSX.Element | null) & {
|
|
73
|
+
Root: (props: AiMediaProps) => import("react").JSX.Element | null;
|
|
74
|
+
};
|
|
75
|
+
Parts: (<MESSAGE extends AiSdkMessage>(props: AiPartsProps<MESSAGE>) => string | number | bigint | true | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react").JSX.Element) & {
|
|
76
|
+
Root: <MESSAGE extends AiSdkMessage>(props: AiPartsProps<MESSAGE>) => string | number | bigint | true | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react").JSX.Element;
|
|
77
|
+
};
|
|
78
|
+
JumpToLatest: typeof AiJumpToLatest;
|
|
79
|
+
Message: (<MESSAGE extends AiSdkMessage>({ message, role: roleProp, children, ...rest }: MessageProps<MESSAGE>) => import("react").JSX.Element) & {
|
|
80
|
+
Root: <MESSAGE extends AiSdkMessage>({ message, role: roleProp, children, ...rest }: MessageProps<MESSAGE>) => import("react").JSX.Element;
|
|
81
|
+
};
|
|
82
|
+
Response: (({ content, highlighter, copyLabel, copiedLabel, ...rest }: ResponseProps) => import("react").JSX.Element) & {
|
|
83
|
+
Root: ({ content, highlighter, copyLabel, copiedLabel, ...rest }: ResponseProps) => import("react").JSX.Element;
|
|
84
|
+
};
|
|
85
|
+
Reasoning: (({ label, children, ...rest }: ReasoningProps) => import("react").JSX.Element) & {
|
|
86
|
+
Root: ({ label, children, ...rest }: ReasoningProps) => import("react").JSX.Element;
|
|
87
|
+
};
|
|
88
|
+
Tool: (({ name, label, status, approval, input, inputValue, output, outputValue, defaultOpen, onApprove, onDeny, ...rest }: ToolProps) => import("react").JSX.Element) & {
|
|
89
|
+
Root: ({ name, label, status, approval, input, inputValue, output, outputValue, defaultOpen, onApprove, onDeny, ...rest }: ToolProps) => import("react").JSX.Element;
|
|
90
|
+
};
|
|
91
|
+
Sources: (({ children, ...rest }: SourcesProps) => import("react").JSX.Element) & {
|
|
92
|
+
Root: ({ children, ...rest }: SourcesProps) => import("react").JSX.Element;
|
|
93
|
+
};
|
|
94
|
+
Source: (({ href, children, ...rest }: SourceProps) => import("react").JSX.Element) & {
|
|
95
|
+
Root: ({ href, children, ...rest }: SourceProps) => import("react").JSX.Element;
|
|
96
|
+
};
|
|
97
|
+
Action: (({ label, children, ...rest }: ActionProps) => import("react").JSX.Element) & {
|
|
98
|
+
Root: ({ label, children, ...rest }: ActionProps) => import("react").JSX.Element;
|
|
99
|
+
};
|
|
100
|
+
Suggestion: (({ prompt, onSelect, ...rest }: SuggestionProps) => import("react").JSX.Element) & {
|
|
101
|
+
Root: ({ prompt, onSelect, ...rest }: SuggestionProps) => import("react").JSX.Element;
|
|
102
|
+
};
|
|
103
|
+
PromptInput: (({ value, onValueChange, onSubmit, onStop, placeholder, "aria-label": ariaLabel, disabled, busy, mentions, onSelect, header, leading, trailing, footer, footerEnd, ...rest }: PromptInputProps) => import("react").JSX.Element) & {
|
|
104
|
+
Root: ({ value, onValueChange, onSubmit, onStop, placeholder, "aria-label": ariaLabel, disabled, busy, mentions, onSelect, header, leading, trailing, footer, footerEnd, ...rest }: PromptInputProps) => import("react").JSX.Element;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export { AiMedia, type AiMediaKind, type AiMediaProps, AiParts, type AiPartsProps, type AiPartsSlots, type AiSdkCustomPart, type AiSdkDataPart, type AiSdkFilePart, type AiSdkMediaPart, type AiSdkMessage, type AiSdkMessagePart, type AiSdkReasoningFilePart, type AiSdkReasoningPart, type AiSdkSourceDocumentPart, type AiSdkSourceUrlPart, type AiSdkStepStartPart, type AiSdkTextPart, type AiSdkToolPart, type AiToolDisplay, type ChatOnDataCallback, type ChatOnErrorCallback, type ChatOnFinishCallback, type ChatState, type ChatStatus, type CreateUIMessage, type CustomContentUIPart, type DataUIPart, type DynamicToolUIPart, type FileUIPart, type InferUITools, type MessageProps, type ProviderMetadata, type ProviderReference, type ReasoningFileUIPart, type ReasoningUIPart, type SourceDocumentUIPart, type SourceUrlUIPart, type StepStartUIPart, type TextUIPart, type ToolSet, type ToolUIPart, type UIDataTypes, type UIMessage, type UIMessageChunk, type UIMessagePart, type UITool, type UIToolInvocation, type UITools, toolPartDisplay };
|