@lobehub/editor 4.29.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/es/codemirror/components/CopyButton.js +1 -1
- package/es/codemirror/components/LanguageSelect.js +1 -3
- package/es/codemirror/components/MoreOptions.js +1 -2
- package/es/codemirror/components/Toolbar.js +1 -2
- package/es/codemirror/components/style.js +1 -1
- package/es/codemirror/style.js +1 -1
- package/es/codemirror/theme.js +1 -1
- package/es/editor-kernel/react/useAnchor.js +1 -1
- package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.js +1 -1
- package/es/plugins/auto-complete/react/style.js +1 -1
- package/es/plugins/block/react/ReactBlockPlugin.js +2 -4
- package/es/plugins/block/react/style.js +1 -1
- package/es/plugins/code/react/CodeReactPlugin.js +1 -1
- package/es/plugins/code/react/style.js +1 -1
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +1 -1
- package/es/plugins/codeblock/react/style.js +1 -1
- package/es/plugins/codemirror-block/react/CodemirrorNode.js +1 -3
- package/es/plugins/codemirror-block/react/MermaidPreview.js +1 -2
- package/es/plugins/collapsible/react/ReactCollapsiblePlugin.js +1 -1
- package/es/plugins/collapsible/react/style.js +74 -64
- package/es/plugins/common/react/Placeholder/style.js +1 -1
- package/es/plugins/common/react/ReactPlainText.js +1 -1
- package/es/plugins/common/react/style.js +1 -1
- package/es/plugins/file/react/components/ReactFile.js +1 -1
- package/es/plugins/file/react/style.js +1 -1
- package/es/plugins/hr/react/components/HRNode.js +1 -1
- package/es/plugins/hr/react/style.js +1 -1
- package/es/plugins/image/react/components/Image.js +1 -3
- package/es/plugins/image/react/components/ImageEditPopover.js +1 -3
- package/es/plugins/image/react/components/LazyImage.js +1 -1
- package/es/plugins/image/react/components/ResizeHandle.js +1 -1
- package/es/plugins/image/react/components/style.js +1 -1
- package/es/plugins/image/react/style.js +1 -1
- package/es/plugins/link/react/ReactLinkPlugin.js +1 -1
- package/es/plugins/link/react/components/LinkEdit.js +1 -3
- package/es/plugins/link/react/components/LinkToolbar.js +1 -1
- package/es/plugins/link/react/style.js +1 -1
- package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.js +1 -1
- package/es/plugins/link-highlight/react/style.js +1 -1
- package/es/plugins/list/react/style.js +1 -1
- package/es/plugins/litexml/react/DiffNodeToolbar/index.js +1 -3
- package/es/plugins/litexml/react/DiffNodeToolbar/style.js +1 -1
- package/es/plugins/litexml/react/TableRowDiffToolbar.js +1 -3
- package/es/plugins/litexml/react/style.js +1 -1
- package/es/plugins/markdown/react/index.js +1 -1
- package/es/plugins/math/react/components/MathEditorContainer.js +1 -1
- package/es/plugins/math/react/components/MathEditorContent.js +1 -2
- package/es/plugins/math/react/components/Placeholder.js +1 -3
- package/es/plugins/math/react/style.js +1 -1
- package/es/plugins/mention/react/components/Mention.js +1 -1
- package/es/plugins/mention/react/style.js +1 -1
- package/es/plugins/slash/react/components/DefaultSlashMenu.js +1 -2
- package/es/plugins/slash/service/i-slash-service.d.ts +1 -1
- package/es/plugins/table/react/TableActionMenu/ActionMenu.js +1 -1
- package/es/plugins/table/react/TableActionMenu/index.js +1 -1
- package/es/plugins/table/react/TableActionMenu/style.js +1 -1
- package/es/plugins/table/react/TableColController.js +1 -1
- package/es/plugins/table/react/TableController/style.js +1 -1
- package/es/plugins/table/react/TableControllerButton.js +2 -2
- package/es/plugins/table/react/TableControllerMenu.js +2 -2
- package/es/plugins/table/react/TableHoverActions/index.js +1 -2
- package/es/plugins/table/react/TableHoverActions/style.js +1 -1
- package/es/plugins/table/react/TableResize/index.js +2 -2
- package/es/plugins/table/react/TableResize/style.js +1 -1
- package/es/plugins/table/react/TableRowController.js +1 -1
- package/es/plugins/table/react/index.js +1 -1
- package/es/plugins/table/react/style.js +1 -1
- package/es/plugins/toolbar/react/index.js +1 -2
- package/es/plugins/toolbar/react/style.js +1 -1
- package/es/react/ChatInput/ChatInput.js +1 -2
- package/es/react/ChatInput/style.js +1 -1
- package/es/react/ChatInput/type.d.ts +1 -1
- package/es/react/ChatInputActionBar/ChatInputActionBar.js +1 -2
- package/es/react/ChatInputActionBar/style.js +1 -1
- package/es/react/ChatInputActionBar/type.d.ts +1 -1
- package/es/react/ChatInputActions/ChatInputActions.js +1 -2
- package/es/react/ChatInputActions/components/ActionItem.js +1 -1
- package/es/react/ChatInputActions/components/ActionRender.js +1 -1
- package/es/react/ChatInputActions/components/CollapsedActions.js +1 -2
- package/es/react/ChatInputActions/style.js +1 -1
- package/es/react/ChatInputActions/type.d.ts +4 -4
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.js +1 -3
- package/es/react/CodeLanguageSelect/style.js +1 -1
- package/es/react/CodeLanguageSelect/type.d.ts +1 -1
- package/es/react/FloatActions/FloatActions.js +1 -2
- package/es/react/FloatActions/components/ActionItem.js +1 -1
- package/es/react/FloatActions/components/ActionRender.js +1 -1
- package/es/react/FloatActions/components/CollapsedActions.js +1 -2
- package/es/react/FloatActions/style.js +1 -1
- package/es/react/FloatActions/type.d.ts +4 -4
- package/es/react/SendButton/SendButton.js +1 -2
- package/es/react/SendButton/components/SendIcon.js +1 -1
- package/es/react/SendButton/components/StopIcon.js +1 -1
- package/es/react/SendButton/style.js +1 -1
- package/es/react/SendButton/type.d.ts +1 -1
- package/es/renderer/LexicalDiff.js +1 -1
- package/es/renderer/LexicalRenderer.js +1 -1
- package/es/renderer/diff/compute.js +2 -2
- package/es/renderer/diff/style.js +1 -1
- package/es/renderer/engine/render-builtin-node.js +2 -2
- package/es/renderer/renderers/codeblock.js +1 -1
- package/es/renderer/renderers/horizontalrule.js +1 -1
- package/es/renderer/renderers/mermaid.js +1 -1
- package/es/renderer/style.js +1 -1
- package/package.json +3 -5
|
@@ -3,8 +3,8 @@ import { useLexicalComposerContext } from "../../../editor-kernel/react/react-co
|
|
|
3
3
|
import { INodePlugin } from "../../inode/plugin/index.js";
|
|
4
4
|
import { MarkdownPlugin } from "../plugin/index.js";
|
|
5
5
|
import { useTranslation } from "../../../editor-kernel/react/useTranslation.js";
|
|
6
|
-
import { useLayoutEffect } from "react";
|
|
7
6
|
import { toast } from "@lobehub/ui";
|
|
7
|
+
import { useLayoutEffect } from "react";
|
|
8
8
|
//#region src/plugins/markdown/react/index.tsx
|
|
9
9
|
const ReactMarkdownPlugin = () => {
|
|
10
10
|
const [editor] = useLexicalComposerContext();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cleanPosition, updatePosition } from "../../../../utils/updatePosition.js";
|
|
2
2
|
import { styles } from "../style.js";
|
|
3
|
+
import { Flexbox, Popover } from "@lobehub/ui";
|
|
3
4
|
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import { Flexbox, Popover } from "@lobehub/ui";
|
|
6
6
|
//#region src/plugins/math/react/components/MathEditorContainer.tsx
|
|
7
7
|
const MathEditorContainer = memo(({ children, isBlockMode, mathDOM, onFocus, prev }) => {
|
|
8
8
|
const anchorRef = useRef(null);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { CONTROL_OR_META, init_sys } from "../../../../common/sys.js";
|
|
2
2
|
import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
|
|
3
3
|
import { styles } from "../style.js";
|
|
4
|
-
import { Button, Text, TextArea } from "@lobehub/ui
|
|
4
|
+
import { Button, Flexbox, Hotkey, Text, TextArea } from "@lobehub/ui";
|
|
5
5
|
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Flexbox, Hotkey } from "@lobehub/ui";
|
|
8
7
|
import { isModifierMatch } from "lexical";
|
|
9
8
|
import { renderToString } from "katex";
|
|
10
9
|
//#region src/plugins/math/react/components/MathEditorContent.tsx
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
|
|
2
2
|
import { styles } from "../style.js";
|
|
3
|
-
import { Text } from "@lobehub/ui
|
|
3
|
+
import { Center, Text, cx } from "@lobehub/ui";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import { Center } from "@lobehub/ui";
|
|
6
|
-
import { cx } from "antd-style";
|
|
7
5
|
//#region src/plugins/math/react/components/Placeholder.tsx
|
|
8
6
|
const Placeholder = ({ mathBlock }) => {
|
|
9
7
|
const t = useTranslation();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useLexicalNodeSelection } from "../../../../editor-kernel/react/useLexicalNodeSelection.js";
|
|
2
|
+
import { cx } from "@lobehub/ui";
|
|
2
3
|
import { useCallback, useEffect, useRef } from "react";
|
|
3
4
|
import { jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { cx } from "antd-style";
|
|
5
5
|
import { CLICK_COMMAND, COMMAND_PRIORITY_LOW } from "lexical";
|
|
6
6
|
//#region src/plugins/mention/react/components/Mention.tsx
|
|
7
7
|
const Mention = ({ node, editor, className }) => {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { flattenSlashOptions, isSlashDividerOption, isSlashSectionOption } from "../../service/i-slash-service.js";
|
|
3
3
|
import { shouldShowLoadingPlaceholder } from "./menuLoading.js";
|
|
4
|
+
import { Icon, LOBE_THEME_APP_ID, createStaticStyles, menuSharedStyles } from "@lobehub/ui";
|
|
4
5
|
import { isValidElement, useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { Icon, LOBE_THEME_APP_ID, menuSharedStyles } from "@lobehub/ui";
|
|
7
|
-
import { createStaticStyles } from "antd-style";
|
|
8
7
|
import { createPortal } from "react-dom";
|
|
9
8
|
import { autoUpdate, flip, offset, shift, size, useFloating } from "@floating-ui/react";
|
|
10
9
|
//#region src/plugins/slash/react/components/DefaultSlashMenu.tsx
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IEditor, IServiceID } from "../../../types/kernel.js";
|
|
2
2
|
import "../../../types/index.js";
|
|
3
3
|
import "../utils/utils.js";
|
|
4
|
-
import { ReactNode } from "react";
|
|
5
4
|
import { MenuItemType } from "@lobehub/ui";
|
|
5
|
+
import { ReactNode } from "react";
|
|
6
6
|
import Fuse, { IFuseOptions } from "fuse.js";
|
|
7
7
|
//#region src/plugins/slash/service/i-slash-service.d.ts
|
|
8
8
|
type ISlashDividerOption = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
|
|
2
2
|
import { $canUnmerge, $selectLastDescendant, computeSelectionCount, currentCellBackgroundColor } from "./utils.js";
|
|
3
|
+
import { DropdownMenu } from "@lobehub/ui";
|
|
3
4
|
import { Grid2X2XIcon, PanelBottomCloseIcon, PanelLeftCloseIcon, PanelRightCloseIcon, PanelTopCloseIcon, TableColumnsSplitIcon, TableRowsSplitIcon } from "lucide-react";
|
|
4
5
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { DropdownMenu } from "@lobehub/ui";
|
|
7
7
|
import { $computeTableMapSkipCellCheck, $deleteTableColumnAtSelection, $deleteTableRowAtSelection, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $insertTableColumnAtSelection, $insertTableRowAtSelection, $isTableCellNode, $isTableSelection, $mergeCells, $unmergeCell, TableCellHeaderStates, TableCellNode, getTableElement, getTableObserverFromTableElement } from "@lexical/table";
|
|
8
8
|
import { $getSelection, $setSelection } from "lexical";
|
|
9
9
|
//#region src/plugins/table/react/TableActionMenu/ActionMenu.tsx
|
|
@@ -2,7 +2,7 @@ import { useAnchor } from "../../../../editor-kernel/react/useAnchor.js";
|
|
|
2
2
|
import { cleanPosition, updatePosition } from "../../../../utils/updatePosition.js";
|
|
3
3
|
import TableActionMenu$1 from "./ActionMenu.js";
|
|
4
4
|
import { styles } from "./style.js";
|
|
5
|
-
import { ActionIcon } from "@lobehub/ui
|
|
5
|
+
import { ActionIcon } from "@lobehub/ui";
|
|
6
6
|
import { ChevronDown } from "lucide-react";
|
|
7
7
|
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -6,9 +6,9 @@ import { styles } from "./TableController/style.js";
|
|
|
6
6
|
import { createTableDragImage } from "./TableController/utils.js";
|
|
7
7
|
import TableControllerMenu from "./TableControllerMenu.js";
|
|
8
8
|
import TableInsertButton from "./TableInsertButton.js";
|
|
9
|
+
import { cx } from "@lobehub/ui";
|
|
9
10
|
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
10
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { cx } from "antd-style";
|
|
12
12
|
import { $computeTableMapSkipCellCheck } from "@lexical/table";
|
|
13
13
|
//#region src/plugins/table/react/TableColController.tsx
|
|
14
14
|
const INSERT_BUTTON_HIDE_DELAY = 160;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createStaticStyles } from "
|
|
1
|
+
import { createStaticStyles } from "@lobehub/ui";
|
|
2
2
|
//#region src/plugins/table/react/TableController/style.ts
|
|
3
3
|
const styles = createStaticStyles(({ css, cssVar }) => {
|
|
4
4
|
const selectedBackground = `color-mix(in srgb, ${cssVar.colorPrimaryBg} 72%, ${cssVar.colorPrimary} 28%)`;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { LOBE_THEME_APP_ID, cx } from "@lobehub/ui";
|
|
1
2
|
import { memo, useEffect, useState } from "react";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cx } from "antd-style";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
5
|
//#region src/plugins/table/react/TableControllerButton.tsx
|
|
6
6
|
const BUTTON_SIZE = 24;
|
|
7
7
|
const getPortalContainer = () => {
|
|
8
8
|
if (typeof document === "undefined") return null;
|
|
9
|
-
return document.querySelector(
|
|
9
|
+
return document.querySelector(`#${LOBE_THEME_APP_ID}`) || document.body;
|
|
10
10
|
};
|
|
11
11
|
const getButtonStyle = (reference, position, offset = 0, gap) => {
|
|
12
12
|
if (!reference) return {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styles } from "./TableController/style.js";
|
|
2
|
+
import { LOBE_THEME_APP_ID, cx } from "@lobehub/ui";
|
|
2
3
|
import { memo, useEffect, useRef, useState } from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { cx } from "antd-style";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
//#region src/plugins/table/react/TableControllerMenu.tsx
|
|
7
7
|
const MENU_GAP = 8;
|
|
@@ -12,7 +12,7 @@ const isSeparatorItem = (item) => {
|
|
|
12
12
|
};
|
|
13
13
|
const getPortalContainer = () => {
|
|
14
14
|
if (typeof document === "undefined") return null;
|
|
15
|
-
return document.querySelector(
|
|
15
|
+
return document.querySelector(`#${LOBE_THEME_APP_ID}`) || document.body;
|
|
16
16
|
};
|
|
17
17
|
const getMenuStyle = (anchorElement, items, position, menuElement) => {
|
|
18
18
|
if (!anchorElement || typeof window === "undefined") return {};
|
|
@@ -2,11 +2,10 @@ import { useLexicalComposerContext } from "../../../../editor-kernel/react/react
|
|
|
2
2
|
import { useAnchor } from "../../../../editor-kernel/react/useAnchor.js";
|
|
3
3
|
import { styles } from "./style.js";
|
|
4
4
|
import { getMouseInfo, useDebounce } from "./utils.js";
|
|
5
|
-
import { ActionIcon } from "@lobehub/ui
|
|
5
|
+
import { ActionIcon, cx } from "@lobehub/ui";
|
|
6
6
|
import { PlusIcon } from "lucide-react";
|
|
7
7
|
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { cx } from "antd-style";
|
|
10
9
|
import { $getTableAndElementByKey, $getTableColumnIndexFromTableCellNode, $getTableRowIndexFromTableCellNode, $insertTableColumnAtSelection, $insertTableRowAtSelection, $isTableCellNode, $isTableNode, TableNode, getTableElement } from "@lexical/table";
|
|
11
10
|
import { $getNearestNodeFromDOMNode } from "lexical";
|
|
12
11
|
import { $findMatchingParent, mergeRegister } from "@lexical/utils";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createDefaultTableColWidths, syncTableWidthDOM } from "../../utils/index.js";
|
|
2
2
|
import { styles } from "./style.js";
|
|
3
3
|
import { getCellColumnIndex, getCellNodeHeight } from "./utils.js";
|
|
4
|
+
import { LOBE_THEME_APP_ID, cssVar, cx } from "@lobehub/ui";
|
|
4
5
|
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
5
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { cssVar, cx } from "antd-style";
|
|
7
7
|
import { $computeTableMapSkipCellCheck, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $isTableCellNode, $isTableNode, $isTableRowNode, TableNode, getDOMCellFromTarget, getTableElement } from "@lexical/table";
|
|
8
8
|
import { $getNearestNodeFromDOMNode, $getNodeByKey, HISTORIC_TAG, SKIP_SCROLL_INTO_VIEW_TAG, isHTMLElement } from "lexical";
|
|
9
9
|
import { calculateZoomLevel, mergeRegister } from "@lexical/utils";
|
|
@@ -317,7 +317,7 @@ const TableCellResize = memo(({ editor, eventEmitter, resizeMode }) => {
|
|
|
317
317
|
});
|
|
318
318
|
var TableResize_default = memo(({ editor, eventEmitter, resizeMode }) => {
|
|
319
319
|
if (typeof document === "undefined") return null;
|
|
320
|
-
const container = document.querySelector(
|
|
320
|
+
const container = document.querySelector(`#${LOBE_THEME_APP_ID}`) || document.body;
|
|
321
321
|
return createPortal(/* @__PURE__ */ jsx(TableCellResize, {
|
|
322
322
|
editor,
|
|
323
323
|
eventEmitter,
|
|
@@ -5,9 +5,9 @@ import { styles } from "./TableController/style.js";
|
|
|
5
5
|
import { createTableDragImage } from "./TableController/utils.js";
|
|
6
6
|
import TableControllerMenu from "./TableControllerMenu.js";
|
|
7
7
|
import TableInsertButton from "./TableInsertButton.js";
|
|
8
|
+
import { cx } from "@lobehub/ui";
|
|
8
9
|
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { cx } from "antd-style";
|
|
11
11
|
import { $computeTableMapSkipCellCheck } from "@lexical/table";
|
|
12
12
|
//#region src/plugins/table/react/TableRowController.tsx
|
|
13
13
|
const INSERT_BUTTON_HIDE_DELAY = 160;
|
|
@@ -14,9 +14,9 @@ import TableResize_default from "./TableResize/index.js";
|
|
|
14
14
|
import TableRowController from "./TableRowController.js";
|
|
15
15
|
import { useAutoFitPastedTable } from "./useAutoFitPastedTable.js";
|
|
16
16
|
import { useScrollFocusedTableCellIntoView } from "./useScrollFocusedTableCellIntoView.js";
|
|
17
|
+
import { cx } from "@lobehub/ui";
|
|
17
18
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useState } from "react";
|
|
18
19
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
-
import { cx } from "antd-style";
|
|
20
20
|
import { $findTableNode, $getElementForTableNode, $isTableNode, $isTableSelection } from "@lexical/table";
|
|
21
21
|
import EventEmitter from "eventemitter3";
|
|
22
22
|
import { $getNodeByKey, $getSelection, $isRangeSelection } from "lexical";
|
|
@@ -6,10 +6,9 @@ import { HIDE_TOOLBAR_COMMAND, registerToolbarCommand } from "../command/index.j
|
|
|
6
6
|
import { getDOMRangeRect } from "../utils/getDOMRangeRect.js";
|
|
7
7
|
import { setFloatingElemPosition } from "../utils/setFloatingElemPosition.js";
|
|
8
8
|
import { styles } from "./style.js";
|
|
9
|
+
import { Block, LOBE_THEME_APP_ID, cx, useThemeMode } from "@lobehub/ui";
|
|
9
10
|
import { useCallback, useRef, useState } from "react";
|
|
10
11
|
import { jsx } from "react/jsx-runtime";
|
|
11
|
-
import { Block, LOBE_THEME_APP_ID } from "@lobehub/ui";
|
|
12
|
-
import { cx, useThemeMode } from "antd-style";
|
|
13
12
|
import { $getSelection, COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND, getDOMSelection } from "lexical";
|
|
14
13
|
import { mergeRegister } from "@lexical/utils";
|
|
15
14
|
import { createPortal } from "react-dom";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useHeight } from "../hooks/useSize.js";
|
|
3
3
|
import { styles } from "./style.js";
|
|
4
|
+
import { Flexbox, cx, useThemeMode } from "@lobehub/ui";
|
|
4
5
|
import { useCallback } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { Flexbox } from "@lobehub/ui";
|
|
7
|
-
import { cx, useThemeMode } from "antd-style";
|
|
8
7
|
import { Resizable } from "re-resizable";
|
|
9
8
|
import useMergeState from "use-merge-value";
|
|
10
9
|
//#region src/react/ChatInput/ChatInput.tsx
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode, Ref } from "react";
|
|
2
1
|
import { FlexboxProps } from "@lobehub/ui";
|
|
2
|
+
import { CSSProperties, ReactNode, Ref } from "react";
|
|
3
3
|
//#region src/react/ChatInput/type.d.ts
|
|
4
4
|
interface ChatInputProps extends Omit<FlexboxProps, 'height'> {
|
|
5
5
|
classNames?: {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { styles } from "./style.js";
|
|
3
|
+
import { Flexbox, cx } from "@lobehub/ui";
|
|
3
4
|
import { jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { Flexbox } from "@lobehub/ui";
|
|
5
|
-
import { cx } from "antd-style";
|
|
6
5
|
//#region src/react/ChatInputActionBar/ChatInputActionBar.tsx
|
|
7
6
|
const ChatInputActionBar = ({ className, style, left, right, ...rest }) => {
|
|
8
7
|
return /* @__PURE__ */ jsxs(Flexbox, {
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
import { styles } from "./style.js";
|
|
3
3
|
import ActionItem from "./components/ActionItem.js";
|
|
4
4
|
import { useDisplayActionCount } from "./components/useDisplayActionCount.js";
|
|
5
|
+
import { Flexbox, TooltipGroup, cx } from "@lobehub/ui";
|
|
5
6
|
import { memo, useMemo } from "react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { Flexbox, TooltipGroup } from "@lobehub/ui";
|
|
8
|
-
import { cx } from "antd-style";
|
|
9
8
|
import useMergeState from "use-merge-value";
|
|
10
9
|
//#region src/react/ChatInputActions/ChatInputActions.tsx
|
|
11
10
|
const ChatInputActions = memo(({ gap = 2, disabled, items = [], onActionClick, className, collapseOffset = 0, autoCollapse = true, defaultGroupCollapse = false, onGroupCollapseChange, groupCollapse, ...rest }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import ActionRender from "./ActionRender.js";
|
|
3
3
|
import CollapsedActions from "./CollapsedActions.js";
|
|
4
|
-
import { ActionIcon, DropdownMenu } from "@lobehub/ui
|
|
4
|
+
import { ActionIcon, DropdownMenu } from "@lobehub/ui";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/react/ChatInputActions/components/ActionItem.tsx
|
|
7
7
|
const ActionItem = ({ item, disabled, onActionClick, groupCollapsed, collapsed, gap, setGroupCollapsed }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styles } from "../style.js";
|
|
2
|
-
import { ActionIcon, Divider } from "@lobehub/ui
|
|
2
|
+
import { ActionIcon, Divider } from "@lobehub/ui";
|
|
3
3
|
import { isValidElement } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/react/ChatInputActions/components/ActionRender.tsx
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { styles } from "../style.js";
|
|
3
|
-
import { ActionIcon } from "@lobehub/ui
|
|
3
|
+
import { ActionIcon, Flexbox, Popover, useMotionComponent } from "@lobehub/ui";
|
|
4
4
|
import { CircleChevronLeftIcon, CircleChevronRightIcon, CircleChevronUpIcon } from "lucide-react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { Flexbox, Popover, useMotionComponent } from "@lobehub/ui";
|
|
7
6
|
//#region src/react/ChatInputActions/components/CollapsedActions.tsx
|
|
8
7
|
const CollapsedActions = ({ children, groupCollapse = false, onGroupCollapseChange, gap, mode }) => {
|
|
9
8
|
const Motion = useMotionComponent();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
1
|
import { FlexboxProps, MenuInfo, MenuItemType, TooltipProps } from "@lobehub/ui";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
3
|
//#region src/react/ChatInputActions/type.d.ts
|
|
4
4
|
type ChatInputActionEvent = Pick<MenuInfo, 'key' | 'keyPath' | 'domEvent'>;
|
|
5
5
|
interface ActionItem extends MenuItemType {
|
|
@@ -16,11 +16,11 @@ type CollapseItem = {
|
|
|
16
16
|
children: (ActionItem | DividerItem)[];
|
|
17
17
|
type: 'collapse';
|
|
18
18
|
};
|
|
19
|
-
type DropdownItem = Omit<ActionItem, 'children' | 'type'> & {
|
|
19
|
+
type DropdownItem$1 = Omit<ActionItem, 'children' | 'type'> & {
|
|
20
20
|
children: MenuItemType[];
|
|
21
21
|
type: 'dropdown';
|
|
22
22
|
};
|
|
23
|
-
type ChatInputActionItem = ActionItem | DividerItem | CollapseItem | DropdownItem;
|
|
23
|
+
type ChatInputActionItem = ActionItem | DividerItem | CollapseItem | DropdownItem$1;
|
|
24
24
|
interface ChatInputActionsProps extends Omit<FlexboxProps, 'children'> {
|
|
25
25
|
autoCollapse?: boolean;
|
|
26
26
|
collapseOffset?: number;
|
|
@@ -32,4 +32,4 @@ interface ChatInputActionsProps extends Omit<FlexboxProps, 'children'> {
|
|
|
32
32
|
onGroupCollapseChange?: (collapse: boolean) => void;
|
|
33
33
|
}
|
|
34
34
|
//#endregion
|
|
35
|
-
export { ActionItem, ChatInputActionEvent, ChatInputActionItem, ChatInputActionsProps, CollapseItem, DividerItem, DropdownItem };
|
|
35
|
+
export { ActionItem, ChatInputActionEvent, ChatInputActionItem, ChatInputActionsProps, CollapseItem, DividerItem, DropdownItem$1 as DropdownItem };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { styles } from "./style.js";
|
|
3
|
-
import { Select, Text } from "@lobehub/ui
|
|
3
|
+
import { Flexbox, MaterialFileTypeIcon, Select, Text, cx } from "@lobehub/ui";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { Flexbox, MaterialFileTypeIcon } from "@lobehub/ui";
|
|
7
|
-
import { cx } from "antd-style";
|
|
8
6
|
import { bundledLanguagesInfo } from "shiki";
|
|
9
7
|
//#region src/react/CodeLanguageSelect/CodeLanguageSelect.tsx
|
|
10
8
|
const CodeLanguageSelect = ({ className, ...rest }) => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { styles } from "./style.js";
|
|
3
3
|
import ActionItem from "./components/ActionItem.js";
|
|
4
|
+
import { Flexbox, cx } from "@lobehub/ui";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import { Flexbox } from "@lobehub/ui";
|
|
6
|
-
import { cx } from "antd-style";
|
|
7
6
|
import useMergeState from "use-merge-value";
|
|
8
7
|
//#region src/react/FloatActions/FloatActions.tsx
|
|
9
8
|
const FloatActions = ({ gap = 2, disabled, items = [], onActionClick, className, defaultGroupCollapse = false, onGroupCollapseChange, groupCollapse, ...rest }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import ActionRender from "./ActionRender.js";
|
|
3
3
|
import CollapsedActions from "./CollapsedActions.js";
|
|
4
|
-
import { ActionIcon, DropdownMenu } from "@lobehub/ui
|
|
4
|
+
import { ActionIcon, DropdownMenu } from "@lobehub/ui";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/react/FloatActions/components/ActionItem.tsx
|
|
7
7
|
const ActionItem = ({ item, disabled, onActionClick, groupCollapsed, gap, setGroupCollapsed }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styles } from "../style.js";
|
|
2
|
-
import { ActionIcon, Divider } from "@lobehub/ui
|
|
2
|
+
import { ActionIcon, Divider } from "@lobehub/ui";
|
|
3
3
|
import { isValidElement } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/react/FloatActions/components/ActionRender.tsx
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { styles } from "../style.js";
|
|
3
|
-
import { ActionIcon } from "@lobehub/ui
|
|
3
|
+
import { ActionIcon, Flexbox, Popover, useMotionComponent } from "@lobehub/ui";
|
|
4
4
|
import { CircleChevronLeftIcon, CircleChevronRightIcon, CircleChevronUpIcon } from "lucide-react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { Flexbox, Popover, useMotionComponent } from "@lobehub/ui";
|
|
7
6
|
//#region src/react/FloatActions/components/CollapsedActions.tsx
|
|
8
7
|
const CollapsedActions = ({ children, groupCollapse = false, onGroupCollapseChange, gap, mode }) => {
|
|
9
8
|
const Motion = useMotionComponent();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
1
|
import { FlexboxProps, MenuInfo, MenuItemType, TooltipProps } from "@lobehub/ui";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
3
|
//#region src/react/FloatActions/type.d.ts
|
|
4
4
|
type FloatActionsEvent = Pick<MenuInfo, 'key' | 'keyPath' | 'domEvent'>;
|
|
5
5
|
interface ActionItem extends MenuItemType {
|
|
@@ -15,11 +15,11 @@ type CollapseItem = {
|
|
|
15
15
|
children: (ActionItem | DividerItem)[];
|
|
16
16
|
type: 'collapse';
|
|
17
17
|
};
|
|
18
|
-
type DropdownItem = Omit<ActionItem, 'children' | 'type'> & {
|
|
18
|
+
type DropdownItem$1 = Omit<ActionItem, 'children' | 'type'> & {
|
|
19
19
|
children: MenuItemType[];
|
|
20
20
|
type: 'dropdown';
|
|
21
21
|
};
|
|
22
|
-
type FloatActionsItem = ActionItem | DividerItem | CollapseItem | DropdownItem;
|
|
22
|
+
type FloatActionsItem = ActionItem | DividerItem | CollapseItem | DropdownItem$1;
|
|
23
23
|
interface FloatActionsProps extends Omit<FlexboxProps, 'children'> {
|
|
24
24
|
defaultGroupCollapse?: boolean;
|
|
25
25
|
disabled?: boolean;
|
|
@@ -29,4 +29,4 @@ interface FloatActionsProps extends Omit<FlexboxProps, 'children'> {
|
|
|
29
29
|
onGroupCollapseChange?: (collapse: boolean) => void;
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
|
-
export { ActionItem, CollapseItem, DividerItem, DropdownItem, FloatActionsEvent, FloatActionsItem, FloatActionsProps };
|
|
32
|
+
export { ActionItem, CollapseItem, DividerItem, DropdownItem$1 as DropdownItem, FloatActionsEvent, FloatActionsItem, FloatActionsProps };
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
import SendIcon from "./components/SendIcon.js";
|
|
3
3
|
import StopIcon from "./components/StopIcon.js";
|
|
4
4
|
import { styles } from "./style.js";
|
|
5
|
-
import { Button, SplitButton } from "@lobehub/ui
|
|
5
|
+
import { Button, SplitButton, cx } from "@lobehub/ui";
|
|
6
6
|
import { useMemo } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { cx } from "antd-style";
|
|
9
8
|
//#region src/react/SendButton/SendButton.tsx
|
|
10
9
|
const SendButton = ({ type = "primary", menu, className, style, loading, generating, size = 32, shape, onSend, onStop, disabled, onClick, placement = "topRight", trigger, title, ...rest }) => {
|
|
11
10
|
const cssVariables = useMemo(() => ({ "--send-button-size": `${size}px` }), [size]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { createStaticStyles, cx } from "@lobehub/ui";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createStaticStyles, cx } from "antd-style";
|
|
4
4
|
//#region src/react/SendButton/components/SendIcon.tsx
|
|
5
5
|
const styles = createStaticStyles(({ css }) => ({ icon: css`
|
|
6
6
|
flex: none;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { createStaticStyles, cssVar, cx } from "@lobehub/ui";
|
|
1
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createStaticStyles, cssVar, cx } from "antd-style";
|
|
3
3
|
//#region src/react/SendButton/components/StopIcon.tsx
|
|
4
4
|
const styles = createStaticStyles(({ css }) => ({
|
|
5
5
|
icon: css`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonProps, DropdownItem, DropdownMenuProps } from "@lobehub/ui
|
|
1
|
+
import { ButtonProps, DropdownItem, DropdownMenuProps } from "@lobehub/ui";
|
|
2
2
|
import { CSSProperties, MouseEvent, Ref } from "react";
|
|
3
3
|
//#region src/react/SendButton/type.d.ts
|
|
4
4
|
type SendButtonClickHandler = (e: MouseEvent<HTMLElement>) => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { computeLexicalDiffRows } from "./diff/compute.js";
|
|
2
2
|
import { diffStyles } from "./diff/style.js";
|
|
3
3
|
import { LexicalRenderer } from "./LexicalRenderer.js";
|
|
4
|
+
import { cx } from "@lobehub/ui";
|
|
4
5
|
import { useMemo } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { cx } from "antd-style";
|
|
7
7
|
//#region src/renderer/LexicalDiff.tsx
|
|
8
8
|
function wrapBlock(block) {
|
|
9
9
|
return { root: {
|
|
@@ -2,8 +2,8 @@ import { getCSSVariables, getRendererClassName } from "./style.js";
|
|
|
2
2
|
import { renderNode } from "./engine/render-tree.js";
|
|
3
3
|
import { rendererNodes } from "./nodes/index.js";
|
|
4
4
|
import { createDefaultRenderers } from "./renderers/index.js";
|
|
5
|
-
import { createElement, use, useMemo } from "react";
|
|
6
5
|
import { MotionComponent, MotionProvider } from "@lobehub/ui";
|
|
6
|
+
import { createElement, use, useMemo } from "react";
|
|
7
7
|
import { createHeadlessEditor } from "@lexical/headless";
|
|
8
8
|
import { $getRoot } from "lexical";
|
|
9
9
|
import { motion } from "motion/react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/renderer/diff/compute.ts
|
|
2
2
|
const CHAR_DIFF_MAX_MATRIX_CELLS = 5e4;
|
|
3
|
-
const DELETE_MARK_STYLE = "background-color: color-mix(in srgb, var(--
|
|
4
|
-
const INSERT_MARK_STYLE = "background-color: color-mix(in srgb, var(--
|
|
3
|
+
const DELETE_MARK_STYLE = "background-color: color-mix(in srgb, var(--lobe-color-error) 18%, transparent); text-decoration: line-through;";
|
|
4
|
+
const INSERT_MARK_STYLE = "background-color: color-mix(in srgb, var(--lobe-color-success) 18%, transparent);";
|
|
5
5
|
function getBaseNodeType(node) {
|
|
6
6
|
if (!node) return null;
|
|
7
7
|
const type = node.type;
|