@lobehub/ui 5.34.2 → 5.35.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.
Files changed (103) hide show
  1. package/es/ActionIconGroup/ActionIconGroup.mjs +1 -1
  2. package/es/ActionIconGroup/ActionIconGroup.mjs.map +1 -1
  3. package/es/ActionIconGroup/type.d.mts +2 -2
  4. package/es/Alert/Alert.mjs +1 -1
  5. package/es/Alert/Alert.mjs.map +1 -1
  6. package/es/Burger/Burger.mjs +1 -1
  7. package/es/Burger/Burger.mjs.map +1 -1
  8. package/es/Burger/type.d.mts +2 -2
  9. package/es/CodeDiff/DiffPanel.mjs +1 -1
  10. package/es/CodeDiff/DiffPanel.mjs.map +1 -1
  11. package/es/CopyButton/CopyButton.mjs +1 -1
  12. package/es/CopyButton/CopyButton.mjs.map +1 -1
  13. package/es/CopyButton/type.d.mts +2 -2
  14. package/es/DownloadButton/DownloadButton.mjs +1 -1
  15. package/es/DownloadButton/DownloadButton.mjs.map +1 -1
  16. package/es/DownloadButton/type.d.mts +2 -2
  17. package/es/DraggablePanel/components/DraggablePanelHeader.mjs +1 -1
  18. package/es/DraggablePanel/components/DraggablePanelHeader.mjs.map +1 -1
  19. package/es/Drawer/Drawer.mjs +1 -1
  20. package/es/Drawer/Drawer.mjs.map +1 -1
  21. package/es/Drawer/type.d.mts +2 -2
  22. package/es/EditableText/ControlInput.d.mts +2 -2
  23. package/es/EditableText/ControlInput.mjs +1 -1
  24. package/es/EditableText/ControlInput.mjs.map +1 -1
  25. package/es/EditableText/EditableText.mjs +1 -1
  26. package/es/EditableText/EditableText.mjs.map +1 -1
  27. package/es/EmojiPicker/EmojiPicker.mjs +1 -1
  28. package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
  29. package/es/GuideCard/GuideCard.mjs +1 -1
  30. package/es/GuideCard/GuideCard.mjs.map +1 -1
  31. package/es/GuideCard/type.d.mts +2 -2
  32. package/es/Highlighter/FullFeatured.mjs +1 -1
  33. package/es/Highlighter/FullFeatured.mjs.map +1 -1
  34. package/es/Highlighter/type.d.mts +2 -2
  35. package/es/HotkeyInput/HotkeyInput.mjs +1 -1
  36. package/es/HotkeyInput/HotkeyInput.mjs.map +1 -1
  37. package/es/HtmlPreview/HtmlPreview.mjs +1 -1
  38. package/es/HtmlPreview/HtmlPreview.mjs.map +1 -1
  39. package/es/HtmlPreview/type.d.mts +2 -2
  40. package/es/Image/type.d.mts +1 -0
  41. package/es/Image/viewer/GalleryNav.mjs +1 -1
  42. package/es/Image/viewer/GalleryNav.mjs.map +1 -1
  43. package/es/Image/viewer/ImageViewer.mjs +75 -70
  44. package/es/Image/viewer/ImageViewer.mjs.map +1 -1
  45. package/es/Image/viewer/Toolbar.mjs +19 -7
  46. package/es/Image/viewer/Toolbar.mjs.map +1 -1
  47. package/es/Image/viewer/ViewerChrome.mjs +1 -1
  48. package/es/Image/viewer/ViewerChrome.mjs.map +1 -1
  49. package/es/Markdown/plugins/rehypeKatex.mjs +73 -0
  50. package/es/Markdown/plugins/rehypeKatex.mjs.map +1 -0
  51. package/es/Markdown/plugins/remarkCustomFootnotes.mjs +1 -2
  52. package/es/Markdown/plugins/remarkCustomFootnotes.mjs.map +1 -1
  53. package/es/Mermaid/FullFeatured.mjs +1 -1
  54. package/es/Mermaid/FullFeatured.mjs.map +1 -1
  55. package/es/Mermaid/type.d.mts +2 -2
  56. package/es/Modal/Modal.mjs +1 -1
  57. package/es/Modal/Modal.mjs.map +1 -1
  58. package/es/SortableList/components/DragHandle.d.mts +2 -2
  59. package/es/SortableList/components/DragHandle.mjs +1 -1
  60. package/es/SortableList/components/DragHandle.mjs.map +1 -1
  61. package/es/Tabs/Tabs.mjs +1 -1
  62. package/es/Tabs/Tabs.mjs.map +1 -1
  63. package/es/ThemeSwitch/ThemeSwitch.mjs +1 -1
  64. package/es/ThemeSwitch/ThemeSwitch.mjs.map +1 -1
  65. package/es/ThemeSwitch/type.d.mts +2 -2
  66. package/es/Toc/TocMobile.mjs +1 -1
  67. package/es/Toc/TocMobile.mjs.map +1 -1
  68. package/es/Video/index.mjs +1 -1
  69. package/es/Video/index.mjs.map +1 -1
  70. package/es/base-ui/Button/SplitButton.mjs +1 -1
  71. package/es/base-ui/Form/components/FormSubmitFooter.mjs +1 -1
  72. package/es/base-ui/Input/style.d.mts +1 -1
  73. package/es/base-ui/Modal/imperative.mjs +1 -1
  74. package/es/base-ui/Tag/Tag.mjs +1 -1
  75. package/es/base-ui/Tag/Tag.mjs.map +1 -1
  76. package/es/base-ui/Tag/style.mjs +8 -3
  77. package/es/base-ui/Tag/style.mjs.map +1 -1
  78. package/es/base-ui/Text/style.d.mts +1 -1
  79. package/es/base-ui/index.d.mts +4 -4
  80. package/es/base-ui/index.mjs +6 -6
  81. package/es/chat/ChatHeader/ChatHeader.mjs +1 -1
  82. package/es/chat/ChatHeader/ChatHeader.mjs.map +1 -1
  83. package/es/chat/EditableMessageList/EditableMessageList.mjs +1 -1
  84. package/es/chat/EditableMessageList/EditableMessageList.mjs.map +1 -1
  85. package/es/chat/TokenTag/TokenTag.mjs +1 -1
  86. package/es/chat/TokenTag/TokenTag.mjs.map +1 -1
  87. package/es/chat/TokenTag/type.d.mts +2 -2
  88. package/es/hooks/useMarkdown/useMarkdownRehypePlugins.mjs +1 -1
  89. package/es/hooks/useMarkdown/useMarkdownRehypePlugins.mjs.map +1 -1
  90. package/es/mdx/Mdx/index.mjs +1 -1
  91. package/es/mdx/Mdx/index.mjs.map +1 -1
  92. package/es/mobile/ChatHeader/ChatHeader.mjs +1 -1
  93. package/es/mobile/ChatHeader/ChatHeader.mjs.map +1 -1
  94. package/es/mobile/ChatInputArea/ChatInputArea.mjs +1 -1
  95. package/es/mobile/ChatInputArea/ChatInputArea.mjs.map +1 -1
  96. package/es/node_modules/.pnpm/unist-util-visit@5.1.0/node_modules/unist-util-visit/lib/index.mjs +2 -2
  97. package/package.json +4 -2
  98. package/es/node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.mjs +0 -117
  99. package/es/node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.mjs.map +0 -1
  100. package/es/node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.node.mjs +0 -12
  101. package/es/node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.node.mjs.map +0 -1
  102. package/es/node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.mjs +0 -330
  103. package/es/node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.mjs.map +0 -1
@@ -1,5 +1,8 @@
1
1
  import { Tooltip } from "./Tooltip/Tooltip.mjs";
2
2
  import TooltipGroup from "./Tooltip/TooltipGroup.mjs";
3
+ import { controlHeight } from "./controlSize.mjs";
4
+ import { styles as styles$4 } from "./Button/style.mjs";
5
+ import Button from "./Button/Button.mjs";
3
6
  import { styles as styles$9 } from "./Switch/style.mjs";
4
7
  import { SwitchIcon, SwitchRoot, SwitchThumb, useSwitchContext } from "./Switch/atoms.mjs";
5
8
  import Switch from "./Switch/Switch.mjs";
@@ -7,6 +10,9 @@ import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, D
7
10
  import { parseTrigger } from "../utils/parseTrigger.mjs";
8
11
  import { renderDropdownMenuItems } from "./DropdownMenu/renderItems.mjs";
9
12
  import DropdownMenu from "./DropdownMenu/DropdownMenu.mjs";
13
+ import SplitButton from "./Button/SplitButton.mjs";
14
+ import { styles as styles$1 } from "./ActionIcon/style.mjs";
15
+ import ActionIcon from "./ActionIcon/ActionIcon.mjs";
10
16
  import { closeContextMenu, setContextMenuInterceptor, showContextMenu, updateContextMenuItems } from "./ContextMenu/store.mjs";
11
17
  import { ContextMenuHost } from "./ContextMenu/ContextMenuHost.mjs";
12
18
  import { ContextMenuTrigger } from "./ContextMenu/ContextMenuTrigger.mjs";
@@ -23,12 +29,6 @@ import { ScrollArea } from "./ScrollArea/ScrollArea.mjs";
23
29
  import { styles } from "./Accordion/style.mjs";
24
30
  import { AccordionHeader, AccordionItem, AccordionPanel, AccordionRoot, AccordionTrigger, useAccordionContext } from "./Accordion/atoms.mjs";
25
31
  import Accordion from "./Accordion/Accordion.mjs";
26
- import { controlHeight } from "./controlSize.mjs";
27
- import { styles as styles$4 } from "./Button/style.mjs";
28
- import Button from "./Button/Button.mjs";
29
- import SplitButton from "./Button/SplitButton.mjs";
30
- import { styles as styles$1 } from "./ActionIcon/style.mjs";
31
- import ActionIcon from "./ActionIcon/ActionIcon.mjs";
32
32
  import { styles as styles$2 } from "./Alert/style.mjs";
33
33
  import Alert from "./Alert/Alert.mjs";
34
34
  import { rootVariants, styles as styles$6 } from "./Input/style.mjs";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import FlexBasic_default from "../../Flex/FlexBasic.mjs";
3
- import ActionIcon from "../../ActionIcon/ActionIcon.mjs";
3
+ import ActionIcon from "../../base-ui/ActionIcon/ActionIcon.mjs";
4
4
  import { styles } from "./style.mjs";
5
5
  import { memo } from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"ChatHeader.mjs","names":["Flexbox"],"sources":["../../../src/chat/ChatHeader/ChatHeader.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { ChevronLeft } from 'lucide-react';\nimport { memo } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport { Flexbox } from '@/Flex';\n\nimport { styles } from './style';\nimport type { ChatHeaderProps } from './type';\n\nconst ChatHeader = memo<ChatHeaderProps>(\n ({\n left,\n right,\n className,\n styles: contentStyles,\n gaps,\n classNames,\n showBackButton,\n onBackClick,\n children,\n gap = 16,\n ...rest\n }) => {\n return (\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.container, className)}\n distribution={'space-between'}\n gap={gap}\n paddingInline={16}\n {...rest}\n >\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.left, classNames?.left)}\n gap={gaps?.left || 12}\n justify={'flex-start'}\n style={contentStyles?.left}\n >\n {showBackButton && (\n <ActionIcon\n icon={ChevronLeft}\n style={{ marginRight: gaps?.left ? -gaps.left / 2 : -6 }}\n onClick={() => onBackClick?.()}\n />\n )}\n {left}\n </Flexbox>\n {children && (\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.center, classNames?.center)}\n gap={gaps?.center || 8}\n justify={'center'}\n style={contentStyles?.center}\n >\n {children}\n </Flexbox>\n )}\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.right, classNames?.right)}\n gap={gaps?.right || 8}\n justify={'flex-end'}\n style={contentStyles?.right}\n >\n {right}\n </Flexbox>\n </Flexbox>\n );\n },\n);\n\nChatHeader.displayName = 'ChatHeader';\n\nexport default ChatHeader;\n"],"mappings":";;;;;;;;;AAYA,MAAM,aAAa,MAChB,EACC,MACA,OACA,WACA,QAAQ,eACR,MACA,YACA,gBACA,aACA,UACA,MAAM,IACN,GAAG,WACC;CACJ,OACE,qBAACA,mBAAD;EACE,YAAA;EACA,OAAO;EACP,WAAW,GAAG,OAAO,WAAW,SAAS;EACzC,cAAc;EACT;EACL,eAAe;EACf,GAAI;EAPN,UAAA;GASE,qBAACA,mBAAD;IACE,YAAA;IACA,OAAO;IACP,WAAW,GAAG,OAAO,MAAM,YAAY,IAAI;IAC3C,KAAK,MAAM,QAAQ;IACnB,SAAS;IACT,OAAO,eAAe;IANxB,UAAA,CAQG,kBACC,oBAAC,YAAD;KACE,MAAM;KACN,OAAO,EAAE,aAAa,MAAM,OAAO,CAAC,KAAK,OAAO,IAAI,GAAG;KACvD,eAAe,cAAc;IAC9B,CAAA,GAEF,IACM;;GACR,YACC,oBAACA,mBAAD;IACE,YAAA;IACA,OAAO;IACP,WAAW,GAAG,OAAO,QAAQ,YAAY,MAAM;IAC/C,KAAK,MAAM,UAAU;IACrB,SAAS;IACT,OAAO,eAAe;IAErB;GACM,CAAA;GAEX,oBAACA,mBAAD;IACE,YAAA;IACA,OAAO;IACP,WAAW,GAAG,OAAO,OAAO,YAAY,KAAK;IAC7C,KAAK,MAAM,SAAS;IACpB,SAAS;IACT,OAAO,eAAe;IAErB,UAAA;GACM,CAAA;EACF;;AAEb,CACF;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"ChatHeader.mjs","names":["Flexbox"],"sources":["../../../src/chat/ChatHeader/ChatHeader.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { ChevronLeft } from 'lucide-react';\nimport { memo } from 'react';\n\nimport ActionIcon from '@/base-ui/ActionIcon';\nimport { Flexbox } from '@/Flex';\n\nimport { styles } from './style';\nimport type { ChatHeaderProps } from './type';\n\nconst ChatHeader = memo<ChatHeaderProps>(\n ({\n left,\n right,\n className,\n styles: contentStyles,\n gaps,\n classNames,\n showBackButton,\n onBackClick,\n children,\n gap = 16,\n ...rest\n }) => {\n return (\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.container, className)}\n distribution={'space-between'}\n gap={gap}\n paddingInline={16}\n {...rest}\n >\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.left, classNames?.left)}\n gap={gaps?.left || 12}\n justify={'flex-start'}\n style={contentStyles?.left}\n >\n {showBackButton && (\n <ActionIcon\n icon={ChevronLeft}\n style={{ marginRight: gaps?.left ? -gaps.left / 2 : -6 }}\n onClick={() => onBackClick?.()}\n />\n )}\n {left}\n </Flexbox>\n {children && (\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.center, classNames?.center)}\n gap={gaps?.center || 8}\n justify={'center'}\n style={contentStyles?.center}\n >\n {children}\n </Flexbox>\n )}\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.right, classNames?.right)}\n gap={gaps?.right || 8}\n justify={'flex-end'}\n style={contentStyles?.right}\n >\n {right}\n </Flexbox>\n </Flexbox>\n );\n },\n);\n\nChatHeader.displayName = 'ChatHeader';\n\nexport default ChatHeader;\n"],"mappings":";;;;;;;;;AAYA,MAAM,aAAa,MAChB,EACC,MACA,OACA,WACA,QAAQ,eACR,MACA,YACA,gBACA,aACA,UACA,MAAM,IACN,GAAG,WACC;CACJ,OACE,qBAACA,mBAAD;EACE,YAAA;EACA,OAAO;EACP,WAAW,GAAG,OAAO,WAAW,SAAS;EACzC,cAAc;EACT;EACL,eAAe;EACf,GAAI;EAPN,UAAA;GASE,qBAACA,mBAAD;IACE,YAAA;IACA,OAAO;IACP,WAAW,GAAG,OAAO,MAAM,YAAY,IAAI;IAC3C,KAAK,MAAM,QAAQ;IACnB,SAAS;IACT,OAAO,eAAe;IANxB,UAAA,CAQG,kBACC,oBAAC,YAAD;KACE,MAAM;KACN,OAAO,EAAE,aAAa,MAAM,OAAO,CAAC,KAAK,OAAO,IAAI,GAAG;KACvD,eAAe,cAAc;IAC9B,CAAA,GAEF,IACM;;GACR,YACC,oBAACA,mBAAD;IACE,YAAA;IACA,OAAO;IACP,WAAW,GAAG,OAAO,QAAQ,YAAY,MAAM;IAC/C,KAAK,MAAM,UAAU;IACrB,SAAS;IACT,OAAO,eAAe;IAErB;GACM,CAAA;GAEX,oBAACA,mBAAD;IACE,YAAA;IACA,OAAO;IACP,WAAW,GAAG,OAAO,OAAO,YAAY,KAAK;IAC7C,KAAK,MAAM,SAAS;IACpB,SAAS;IACT,OAAO,eAAe;IAErB,UAAA;GACM,CAAA;EACF;;AAEb,CACF;AAEA,WAAW,cAAc"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import FlexBasic_default from "../../Flex/FlexBasic.mjs";
3
- import ActionIcon from "../../ActionIcon/ActionIcon.mjs";
3
+ import ActionIcon from "../../base-ui/ActionIcon/ActionIcon.mjs";
4
4
  import Button from "../../Button/Button.mjs";
5
5
  import { useTranslation } from "../../i18n/useTranslation.mjs";
6
6
  import ControlInput from "../../EditableText/ControlInput.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"EditableMessageList.mjs","names":["editableMessageMessages","Flexbox"],"sources":["../../../src/chat/EditableMessageList/EditableMessageList.tsx"],"sourcesContent":["'use client';\n\nimport isEqual from 'fast-deep-equal';\nimport { Plus, Trash } from 'lucide-react';\nimport { memo, useEffect, useReducer } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport Button from '@/Button';\nimport ControlInput from '@/EditableText/ControlInput';\nimport { Flexbox } from '@/Flex';\nimport editableMessageMessages from '@/i18n/resources/en/editableMessage';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Select from '@/Select';\n\nimport { messagesReducer } from './messageReducer';\nimport { type EditableMessageListProps } from './type';\n\nconst EditableMessageList = memo<EditableMessageListProps>(\n ({ disabled, dataSources, onChange, texts }) => {\n const [chatMessages, dispatch] = useReducer(messagesReducer, dataSources);\n const { t } = useTranslation(editableMessageMessages);\n\n const addPropsText = texts?.addProps ?? t('editableMessage.addProps');\n const deleteText = texts?.delete ?? t('editableMessage.delete');\n const inputPlaceholderText = texts?.inputPlaceholder ?? t('editableMessage.inputPlaceholder');\n const outputPlaceholderText =\n texts?.outputPlaceholder ?? t('editableMessage.outputPlaceholder');\n const systemText = texts?.system ?? t('editableMessage.system');\n const inputText = texts?.input ?? t('editableMessage.input');\n const outputText = texts?.output ?? t('editableMessage.output');\n\n useEffect(() => {\n if (!isEqual(dataSources, chatMessages)) {\n onChange?.(chatMessages);\n }\n }, [chatMessages]);\n\n return dataSources ? (\n <Flexbox gap={12}>\n {chatMessages.map((item, index) => (\n <Flexbox\n horizontal\n align={'center'}\n gap={8}\n key={`${index}-${item.content}`}\n width={'100%'}\n >\n <Select\n disabled={disabled}\n style={{ width: 120 }}\n styles={{ popup: { root: { zIndex: 100 } } }}\n value={item.role}\n options={[\n { label: systemText, value: 'system' },\n { label: inputText, value: 'user' },\n { label: outputText, value: 'assistant' },\n ]}\n onChange={(value) => {\n dispatch({ index, role: value, type: 'updateMessageRole' });\n }}\n />\n <ControlInput\n disabled={disabled}\n placeholder={item.role === 'user' ? inputPlaceholderText : outputPlaceholderText}\n value={item.content}\n onChange={(e) => {\n dispatch({ index, message: e, type: 'updateMessage' });\n }}\n />\n <ActionIcon\n icon={Trash}\n title={deleteText}\n variant={'filled'}\n onClick={() => {\n dispatch({ index, type: 'deleteMessage' });\n }}\n />\n </Flexbox>\n ))}\n\n <Button\n block\n disabled={disabled}\n icon={Plus}\n onClick={() => {\n const lastMeg = chatMessages.at(-1);\n\n dispatch({\n message: { content: '', role: lastMeg?.role === 'user' ? 'assistant' : 'user' },\n type: 'addMessage',\n });\n }}\n >\n {addPropsText}\n </Button>\n </Flexbox>\n ) : undefined;\n },\n isEqual,\n);\n\nEditableMessageList.displayName = 'EditableMessageList';\n\nexport default EditableMessageList;\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,sBAAsB,MACzB,EAAE,UAAU,aAAa,UAAU,YAAY;CAC9C,MAAM,CAAC,cAAc,YAAY,WAAW,iBAAiB,WAAW;CACxE,MAAM,EAAE,MAAM,eAAeA,uBAAuB;CAEpD,MAAM,eAAe,OAAO,YAAY,EAAE,0BAA0B;CACpE,MAAM,aAAa,OAAO,UAAU,EAAE,wBAAwB;CAC9D,MAAM,uBAAuB,OAAO,oBAAoB,EAAE,kCAAkC;CAC5F,MAAM,wBACJ,OAAO,qBAAqB,EAAE,mCAAmC;CACnE,MAAM,aAAa,OAAO,UAAU,EAAE,wBAAwB;CAC9D,MAAM,YAAY,OAAO,SAAS,EAAE,uBAAuB;CAC3D,MAAM,aAAa,OAAO,UAAU,EAAE,wBAAwB;CAE9D,gBAAgB;EACd,IAAI,CAAC,QAAQ,aAAa,YAAY,GACpC,WAAW,YAAY;CAE3B,GAAG,CAAC,YAAY,CAAC;CAEjB,OAAO,cACL,qBAACC,mBAAD;EAAS,KAAK;EAAd,UAAA,CACG,aAAa,KAAK,MAAM,UACvB,qBAACA,mBAAD;GACE,YAAA;GACA,OAAO;GACP,KAAK;GAEL,OAAO;GALT,UAAA;IAOE,oBAAC,QAAD;KACY;KACV,OAAO,EAAE,OAAO,IAAI;KACpB,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,IAAI,EAAE,EAAE;KAC3C,OAAO,KAAK;KACZ,SAAS;MACP;OAAE,OAAO;OAAY,OAAO;MAAS;MACrC;OAAE,OAAO;OAAW,OAAO;MAAO;MAClC;OAAE,OAAO;OAAY,OAAO;MAAY;KAC1C;KACA,WAAW,UAAU;MACnB,SAAS;OAAE;OAAO,MAAM;OAAO,MAAM;MAAoB,CAAC;KAC5D;IACD,CAAA;IACD,oBAAC,cAAD;KACY;KACV,aAAa,KAAK,SAAS,SAAS,uBAAuB;KAC3D,OAAO,KAAK;KACZ,WAAW,MAAM;MACf,SAAS;OAAE;OAAO,SAAS;OAAG,MAAM;MAAgB,CAAC;KACvD;IACD,CAAA;IACD,oBAAC,YAAD;KACE,MAAM;KACN,OAAO;KACP,SAAS;KACT,eAAe;MACb,SAAS;OAAE;OAAO,MAAM;MAAgB,CAAC;KAC3C;IACD,CAAA;GACM;EAjCF,GAAA,GAAG,MAAM,GAAG,KAAK,SAiCf,CACV,GAED,oBAAC,QAAD;GACE,OAAA;GACU;GACV,MAAM;GACN,eAAe;IACb,MAAM,UAAU,aAAa,GAAG,EAAE;IAElC,SAAS;KACP,SAAS;MAAE,SAAS;MAAI,MAAM,SAAS,SAAS,SAAS,cAAc;KAAO;KAC9E,MAAM;IACR,CAAC;GACH;GAEC,UAAA;EACK,CAAA,CACD;CACP,CAAA,IAAA,KAAA;AACN,GACA,OACF;AAEA,oBAAoB,cAAc"}
1
+ {"version":3,"file":"EditableMessageList.mjs","names":["editableMessageMessages","Flexbox"],"sources":["../../../src/chat/EditableMessageList/EditableMessageList.tsx"],"sourcesContent":["'use client';\n\nimport isEqual from 'fast-deep-equal';\nimport { Plus, Trash } from 'lucide-react';\nimport { memo, useEffect, useReducer } from 'react';\n\nimport ActionIcon from '@/base-ui/ActionIcon';\nimport Button from '@/Button';\nimport ControlInput from '@/EditableText/ControlInput';\nimport { Flexbox } from '@/Flex';\nimport editableMessageMessages from '@/i18n/resources/en/editableMessage';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Select from '@/Select';\n\nimport { messagesReducer } from './messageReducer';\nimport { type EditableMessageListProps } from './type';\n\nconst EditableMessageList = memo<EditableMessageListProps>(\n ({ disabled, dataSources, onChange, texts }) => {\n const [chatMessages, dispatch] = useReducer(messagesReducer, dataSources);\n const { t } = useTranslation(editableMessageMessages);\n\n const addPropsText = texts?.addProps ?? t('editableMessage.addProps');\n const deleteText = texts?.delete ?? t('editableMessage.delete');\n const inputPlaceholderText = texts?.inputPlaceholder ?? t('editableMessage.inputPlaceholder');\n const outputPlaceholderText =\n texts?.outputPlaceholder ?? t('editableMessage.outputPlaceholder');\n const systemText = texts?.system ?? t('editableMessage.system');\n const inputText = texts?.input ?? t('editableMessage.input');\n const outputText = texts?.output ?? t('editableMessage.output');\n\n useEffect(() => {\n if (!isEqual(dataSources, chatMessages)) {\n onChange?.(chatMessages);\n }\n }, [chatMessages]);\n\n return dataSources ? (\n <Flexbox gap={12}>\n {chatMessages.map((item, index) => (\n <Flexbox\n horizontal\n align={'center'}\n gap={8}\n key={`${index}-${item.content}`}\n width={'100%'}\n >\n <Select\n disabled={disabled}\n style={{ width: 120 }}\n styles={{ popup: { root: { zIndex: 100 } } }}\n value={item.role}\n options={[\n { label: systemText, value: 'system' },\n { label: inputText, value: 'user' },\n { label: outputText, value: 'assistant' },\n ]}\n onChange={(value) => {\n dispatch({ index, role: value, type: 'updateMessageRole' });\n }}\n />\n <ControlInput\n disabled={disabled}\n placeholder={item.role === 'user' ? inputPlaceholderText : outputPlaceholderText}\n value={item.content}\n onChange={(e) => {\n dispatch({ index, message: e, type: 'updateMessage' });\n }}\n />\n <ActionIcon\n icon={Trash}\n title={deleteText}\n variant={'filled'}\n onClick={() => {\n dispatch({ index, type: 'deleteMessage' });\n }}\n />\n </Flexbox>\n ))}\n\n <Button\n block\n disabled={disabled}\n icon={Plus}\n onClick={() => {\n const lastMeg = chatMessages.at(-1);\n\n dispatch({\n message: { content: '', role: lastMeg?.role === 'user' ? 'assistant' : 'user' },\n type: 'addMessage',\n });\n }}\n >\n {addPropsText}\n </Button>\n </Flexbox>\n ) : undefined;\n },\n isEqual,\n);\n\nEditableMessageList.displayName = 'EditableMessageList';\n\nexport default EditableMessageList;\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,sBAAsB,MACzB,EAAE,UAAU,aAAa,UAAU,YAAY;CAC9C,MAAM,CAAC,cAAc,YAAY,WAAW,iBAAiB,WAAW;CACxE,MAAM,EAAE,MAAM,eAAeA,uBAAuB;CAEpD,MAAM,eAAe,OAAO,YAAY,EAAE,0BAA0B;CACpE,MAAM,aAAa,OAAO,UAAU,EAAE,wBAAwB;CAC9D,MAAM,uBAAuB,OAAO,oBAAoB,EAAE,kCAAkC;CAC5F,MAAM,wBACJ,OAAO,qBAAqB,EAAE,mCAAmC;CACnE,MAAM,aAAa,OAAO,UAAU,EAAE,wBAAwB;CAC9D,MAAM,YAAY,OAAO,SAAS,EAAE,uBAAuB;CAC3D,MAAM,aAAa,OAAO,UAAU,EAAE,wBAAwB;CAE9D,gBAAgB;EACd,IAAI,CAAC,QAAQ,aAAa,YAAY,GACpC,WAAW,YAAY;CAE3B,GAAG,CAAC,YAAY,CAAC;CAEjB,OAAO,cACL,qBAACC,mBAAD;EAAS,KAAK;EAAd,UAAA,CACG,aAAa,KAAK,MAAM,UACvB,qBAACA,mBAAD;GACE,YAAA;GACA,OAAO;GACP,KAAK;GAEL,OAAO;GALT,UAAA;IAOE,oBAAC,QAAD;KACY;KACV,OAAO,EAAE,OAAO,IAAI;KACpB,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,IAAI,EAAE,EAAE;KAC3C,OAAO,KAAK;KACZ,SAAS;MACP;OAAE,OAAO;OAAY,OAAO;MAAS;MACrC;OAAE,OAAO;OAAW,OAAO;MAAO;MAClC;OAAE,OAAO;OAAY,OAAO;MAAY;KAC1C;KACA,WAAW,UAAU;MACnB,SAAS;OAAE;OAAO,MAAM;OAAO,MAAM;MAAoB,CAAC;KAC5D;IACD,CAAA;IACD,oBAAC,cAAD;KACY;KACV,aAAa,KAAK,SAAS,SAAS,uBAAuB;KAC3D,OAAO,KAAK;KACZ,WAAW,MAAM;MACf,SAAS;OAAE;OAAO,SAAS;OAAG,MAAM;MAAgB,CAAC;KACvD;IACD,CAAA;IACD,oBAAC,YAAD;KACE,MAAM;KACN,OAAO;KACP,SAAS;KACT,eAAe;MACb,SAAS;OAAE;OAAO,MAAM;MAAgB,CAAC;KAC3C;IACD,CAAA;GACM;EAjCF,GAAA,GAAG,MAAM,GAAG,KAAK,SAiCf,CACV,GAED,oBAAC,QAAD;GACE,OAAA;GACU;GACV,MAAM;GACN,eAAe;IACb,MAAM,UAAU,aAAa,GAAG,EAAE;IAElC,SAAS;KACP,SAAS;MAAE,SAAS;MAAI,MAAM,SAAS,SAAS,SAAS,cAAc;KAAO;KAC9E,MAAM;IACR,CAAC;GACH;GAEC,UAAA;EACK,CAAA,CACD;CACP,CAAA,IAAA,KAAA;AACN,GACA,OACF;AAEA,oBAAoB,cAAc"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import ActionIcon from "../../ActionIcon/ActionIcon.mjs";
2
+ import ActionIcon from "../../base-ui/ActionIcon/ActionIcon.mjs";
3
3
  import { useTranslation } from "../../i18n/useTranslation.mjs";
4
4
  import chat_default from "../../i18n/resources/en/chat.mjs";
5
5
  import { useMemo } from "react";
@@ -1 +1 @@
1
- {"version":3,"file":"TokenTag.mjs","names":["chatMessages"],"sources":["../../../src/chat/TokenTag/TokenTag.tsx"],"sourcesContent":["'use client';\n\nimport { Progress } from 'antd';\nimport { cssVar } from 'antd-style';\nimport numeral from 'numeral';\nimport { type FC, useMemo } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport chatMessages from '@/i18n/resources/en/chat';\nimport { useTranslation } from '@/i18n/useTranslation';\n\nimport type { TokenTagProps } from './type';\n\nconst format = (number: number) => numeral(number).format('0,0');\n\nconst TokenTag: FC<TokenTagProps> = ({\n mode = 'remained',\n maxValue,\n value,\n text,\n showInfo,\n size = 20,\n ...rest\n}) => {\n const { t } = useTranslation(chatMessages);\n const valueLeft = maxValue - value;\n const percent = value / maxValue;\n const remainedText = text?.remained ?? t('tokenTag.remained');\n const usedText = text?.used ?? t('tokenTag.used');\n const overloadText = text?.overload ?? t('tokenTag.overload');\n\n const data = useMemo(() => {\n let type: 'normal' | 'low' | 'overload';\n let color;\n\n if (percent < 0.7) {\n type = 'normal';\n color = cssVar.colorText;\n } else if (percent < 0.9) {\n type = 'low';\n color = cssVar.colorWarning;\n } else {\n type = 'overload';\n color = cssVar.colorError;\n }\n return {\n color,\n type,\n };\n }, [percent]);\n\n const title =\n valueLeft > 0\n ? [\n mode === 'remained' ? remainedText : usedText,\n mode === 'remained' ? format(valueLeft) : format(value),\n ].join(' ')\n : overloadText;\n\n return (\n <ActionIcon\n size={size}\n title={showInfo ? title : undefined}\n icon={\n <Progress\n percent={percent * 100}\n showInfo={false}\n size={Number(typeof size === 'object' ? size?.size || 20 : size) || 20}\n strokeColor={data.color}\n type=\"circle\"\n />\n }\n {...rest}\n />\n );\n};\n\nTokenTag.displayName = 'TokenTag';\n\nexport default TokenTag;\n"],"mappings":";;;;;;;;;;AAaA,MAAM,UAAU,WAAmB,QAAQ,MAAM,CAAC,CAAC,OAAO,KAAK;AAE/D,MAAM,YAA+B,EACnC,OAAO,YACP,UACA,OACA,MACA,UACA,OAAO,IACP,GAAG,WACC;CACJ,MAAM,EAAE,MAAM,eAAeA,YAAY;CACzC,MAAM,YAAY,WAAW;CAC7B,MAAM,UAAU,QAAQ;CACxB,MAAM,eAAe,MAAM,YAAY,EAAE,mBAAmB;CAC5D,MAAM,WAAW,MAAM,QAAQ,EAAE,eAAe;CAChD,MAAM,eAAe,MAAM,YAAY,EAAE,mBAAmB;CAE5D,MAAM,OAAO,cAAc;EACzB,IAAI;EACJ,IAAI;EAEJ,IAAI,UAAU,IAAK;GACjB,OAAO;GACP,QAAQ,OAAO;EACjB,OAAO,IAAI,UAAU,IAAK;GACxB,OAAO;GACP,QAAQ,OAAO;EACjB,OAAO;GACL,OAAO;GACP,QAAQ,OAAO;EACjB;EACA,OAAO;GACL;GACA;EACF;CACF,GAAG,CAAC,OAAO,CAAC;CAEZ,MAAM,QACJ,YAAY,IACR,CACE,SAAS,aAAa,eAAe,UACrC,SAAS,aAAa,OAAO,SAAS,IAAI,OAAO,KAAK,CACxD,CAAC,CAAC,KAAK,GAAG,IACV;CAEN,OACE,oBAAC,YAAD;EACQ;EACN,OAAO,WAAW,QAAQ,KAAA;EAC1B,MACE,oBAAC,UAAD;GACE,SAAS,UAAU;GACnB,UAAU;GACV,MAAM,OAAO,OAAO,SAAS,WAAW,MAAM,QAAQ,KAAK,IAAI,KAAK;GACpE,aAAa,KAAK;GAClB,MAAK;EACN,CAAA;EAEH,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cAAc"}
1
+ {"version":3,"file":"TokenTag.mjs","names":["chatMessages"],"sources":["../../../src/chat/TokenTag/TokenTag.tsx"],"sourcesContent":["'use client';\n\nimport { Progress } from 'antd';\nimport { cssVar } from 'antd-style';\nimport numeral from 'numeral';\nimport { type FC, useMemo } from 'react';\n\nimport ActionIcon from '@/base-ui/ActionIcon';\nimport chatMessages from '@/i18n/resources/en/chat';\nimport { useTranslation } from '@/i18n/useTranslation';\n\nimport type { TokenTagProps } from './type';\n\nconst format = (number: number) => numeral(number).format('0,0');\n\nconst TokenTag: FC<TokenTagProps> = ({\n mode = 'remained',\n maxValue,\n value,\n text,\n showInfo,\n size = 20,\n ...rest\n}) => {\n const { t } = useTranslation(chatMessages);\n const valueLeft = maxValue - value;\n const percent = value / maxValue;\n const remainedText = text?.remained ?? t('tokenTag.remained');\n const usedText = text?.used ?? t('tokenTag.used');\n const overloadText = text?.overload ?? t('tokenTag.overload');\n\n const data = useMemo(() => {\n let type: 'normal' | 'low' | 'overload';\n let color;\n\n if (percent < 0.7) {\n type = 'normal';\n color = cssVar.colorText;\n } else if (percent < 0.9) {\n type = 'low';\n color = cssVar.colorWarning;\n } else {\n type = 'overload';\n color = cssVar.colorError;\n }\n return {\n color,\n type,\n };\n }, [percent]);\n\n const title =\n valueLeft > 0\n ? [\n mode === 'remained' ? remainedText : usedText,\n mode === 'remained' ? format(valueLeft) : format(value),\n ].join(' ')\n : overloadText;\n\n return (\n <ActionIcon\n size={size}\n title={showInfo ? title : undefined}\n icon={\n <Progress\n percent={percent * 100}\n showInfo={false}\n size={Number(typeof size === 'object' ? size?.size || 20 : size) || 20}\n strokeColor={data.color}\n type=\"circle\"\n />\n }\n {...rest}\n />\n );\n};\n\nTokenTag.displayName = 'TokenTag';\n\nexport default TokenTag;\n"],"mappings":";;;;;;;;;;AAaA,MAAM,UAAU,WAAmB,QAAQ,MAAM,CAAC,CAAC,OAAO,KAAK;AAE/D,MAAM,YAA+B,EACnC,OAAO,YACP,UACA,OACA,MACA,UACA,OAAO,IACP,GAAG,WACC;CACJ,MAAM,EAAE,MAAM,eAAeA,YAAY;CACzC,MAAM,YAAY,WAAW;CAC7B,MAAM,UAAU,QAAQ;CACxB,MAAM,eAAe,MAAM,YAAY,EAAE,mBAAmB;CAC5D,MAAM,WAAW,MAAM,QAAQ,EAAE,eAAe;CAChD,MAAM,eAAe,MAAM,YAAY,EAAE,mBAAmB;CAE5D,MAAM,OAAO,cAAc;EACzB,IAAI;EACJ,IAAI;EAEJ,IAAI,UAAU,IAAK;GACjB,OAAO;GACP,QAAQ,OAAO;EACjB,OAAO,IAAI,UAAU,IAAK;GACxB,OAAO;GACP,QAAQ,OAAO;EACjB,OAAO;GACL,OAAO;GACP,QAAQ,OAAO;EACjB;EACA,OAAO;GACL;GACA;EACF;CACF,GAAG,CAAC,OAAO,CAAC;CAEZ,MAAM,QACJ,YAAY,IACR,CACE,SAAS,aAAa,eAAe,UACrC,SAAS,aAAa,OAAO,SAAS,IAAI,OAAO,KAAK,CACxD,CAAC,CAAC,KAAK,GAAG,IACV;CAEN,OACE,oBAAC,YAAD;EACQ;EACN,OAAO,WAAW,QAAQ,KAAA;EAC1B,MACE,oBAAC,UAAD;GACE,SAAS,UAAU;GACnB,UAAU;GACV,MAAM,OAAO,OAAO,SAAS,WAAW,MAAM,QAAQ,KAAK,IAAI,KAAK;GACpE,aAAa,KAAK;GAClB,MAAK;EACN,CAAA;EAEH,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cAAc"}
@@ -1,5 +1,5 @@
1
- import { ActionIconProps } from "../../ActionIcon/type.mjs";
2
- import "../../ActionIcon/index.mjs";
1
+ import { ActionIconProps } from "../../base-ui/ActionIcon/type.mjs";
2
+ import "../../base-ui/ActionIcon/index.mjs";
3
3
  //#region src/chat/TokenTag/type.d.ts
4
4
  interface TokenTagProps extends ActionIconProps {
5
5
  maxValue: number;
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { useMarkdownContext } from "../../Markdown/components/MarkdownProvider.mjs";
3
3
  import { rehypeCustomFootnotes } from "../../Markdown/plugins/rehypeCustomFootnotes.mjs";
4
+ import { rehypeKatex } from "../../Markdown/plugins/rehypeKatex.mjs";
4
5
  import { rehypeKatexDir } from "../../Markdown/plugins/rehypeKatexDir.mjs";
5
6
  import { useMemo } from "react";
6
7
  import { rehypeGithubAlerts } from "rehype-github-alerts";
7
- import rehypeKatex from "rehype-katex";
8
8
  import rehypeRaw from "rehype-raw";
9
9
  //#region src/hooks/useMarkdown/useMarkdownRehypePlugins.ts
10
10
  const useMarkdownRehypePlugins = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"useMarkdownRehypePlugins.mjs","names":[],"sources":["../../../src/hooks/useMarkdown/useMarkdownRehypePlugins.ts"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport { rehypeGithubAlerts } from 'rehype-github-alerts';\nimport rehypeKatex from 'rehype-katex';\nimport rehypeRaw from 'rehype-raw';\nimport type { Pluggable } from 'unified';\n\nimport { useMarkdownContext } from '@/Markdown/components/MarkdownProvider';\nimport { rehypeCustomFootnotes } from '@/Markdown/plugins/rehypeCustomFootnotes';\nimport { rehypeKatexDir } from '@/Markdown/plugins/rehypeKatexDir';\n\nexport const useMarkdownRehypePlugins = (): Pluggable[] => {\n const {\n enableLatex,\n enableCustomFootnotes,\n enableGithubAlert,\n allowHtml,\n rehypePlugins = [],\n rehypePluginsAhead = [],\n } = useMarkdownContext();\n\n const memoPlugins = useMemo(\n () =>\n [\n allowHtml && rehypeRaw,\n enableGithubAlert && rehypeGithubAlerts,\n enableLatex && rehypeKatex,\n enableLatex && rehypeKatexDir,\n enableCustomFootnotes && rehypeCustomFootnotes,\n ].filter(Boolean) as Pluggable[],\n [enableLatex, enableGithubAlert, enableCustomFootnotes, allowHtml],\n );\n\n return useMemo(\n () => [...rehypePluginsAhead, ...memoPlugins, ...rehypePlugins],\n [rehypePlugins, memoPlugins, rehypePluginsAhead],\n );\n};\n"],"mappings":";;;;;;;;;AAYA,MAAa,iCAA8C;CACzD,MAAM,EACJ,aACA,uBACA,mBACA,WACA,gBAAgB,CAAC,GACjB,qBAAqB,CAAC,MACpB,mBAAmB;CAEvB,MAAM,cAAc,cAEhB;EACE,aAAa;EACb,qBAAqB;EACrB,eAAe;EACf,eAAe;EACf,yBAAyB;CAC3B,CAAC,CAAC,OAAO,OAAO,GAClB;EAAC;EAAa;EAAmB;EAAuB;CAAS,CACnE;CAEA,OAAO,cACC;EAAC,GAAG;EAAoB,GAAG;EAAa,GAAG;CAAa,GAC9D;EAAC;EAAe;EAAa;CAAkB,CACjD;AACF"}
1
+ {"version":3,"file":"useMarkdownRehypePlugins.mjs","names":[],"sources":["../../../src/hooks/useMarkdown/useMarkdownRehypePlugins.ts"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport { rehypeGithubAlerts } from 'rehype-github-alerts';\nimport rehypeRaw from 'rehype-raw';\nimport type { Pluggable } from 'unified';\n\nimport { useMarkdownContext } from '@/Markdown/components/MarkdownProvider';\nimport { rehypeCustomFootnotes } from '@/Markdown/plugins/rehypeCustomFootnotes';\nimport { rehypeKatex } from '@/Markdown/plugins/rehypeKatex';\nimport { rehypeKatexDir } from '@/Markdown/plugins/rehypeKatexDir';\n\nexport const useMarkdownRehypePlugins = (): Pluggable[] => {\n const {\n enableLatex,\n enableCustomFootnotes,\n enableGithubAlert,\n allowHtml,\n rehypePlugins = [],\n rehypePluginsAhead = [],\n } = useMarkdownContext();\n\n const memoPlugins = useMemo(\n () =>\n [\n allowHtml && rehypeRaw,\n enableGithubAlert && rehypeGithubAlerts,\n enableLatex && rehypeKatex,\n enableLatex && rehypeKatexDir,\n enableCustomFootnotes && rehypeCustomFootnotes,\n ].filter(Boolean) as Pluggable[],\n [enableLatex, enableGithubAlert, enableCustomFootnotes, allowHtml],\n );\n\n return useMemo(\n () => [...rehypePluginsAhead, ...memoPlugins, ...rehypePlugins],\n [rehypePlugins, memoPlugins, rehypePluginsAhead],\n );\n};\n"],"mappings":";;;;;;;;;AAYA,MAAa,iCAA8C;CACzD,MAAM,EACJ,aACA,uBACA,mBACA,WACA,gBAAgB,CAAC,GACjB,qBAAqB,CAAC,MACpB,mBAAmB;CAEvB,MAAM,cAAc,cAEhB;EACE,aAAa;EACb,qBAAqB;EACrB,eAAe;EACf,eAAe;EACf,yBAAyB;CAC3B,CAAC,CAAC,OAAO,OAAO,GAClB;EAAC;EAAa;EAAmB;EAAuB;CAAS,CACnE;CAEA,OAAO,cACC;EAAC,GAAG;EAAoB,GAAG;EAAa,GAAG;CAAa,GAC9D;EAAC;EAAe;EAAa;CAAkB,CACjD;AACF"}
@@ -5,6 +5,7 @@ import { styles } from "../../Markdown/style.mjs";
5
5
  import Image from "../mdxComponents/Image.mjs";
6
6
  import Video from "../mdxComponents/Video.mjs";
7
7
  import { useMarkdownContent } from "../../hooks/useMarkdown/useMarkdownContent.mjs";
8
+ import { rehypeKatex } from "../../Markdown/plugins/rehypeKatex.mjs";
8
9
  import Typography from "../../Markdown/Typography.mjs";
9
10
  import mdxComponents from "../mdxComponents/index.mjs";
10
11
  import CodeBlock from "../mdxComponents/CodeBlock.mjs";
@@ -12,7 +13,6 @@ import { memo, useEffect, useMemo, useState } from "react";
12
13
  import jsxRuntime, { jsx } from "react/jsx-runtime";
13
14
  import { cx } from "antd-style";
14
15
  import { rehypeGithubAlerts } from "rehype-github-alerts";
15
- import rehypeKatex from "rehype-katex";
16
16
  import remarkGfm from "remark-gfm";
17
17
  import remarkMath from "remark-math";
18
18
  import { evaluate } from "@mdx-js/mdx";
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/mdx/Mdx/index.tsx"],"sourcesContent":["'use client';\n\nimport { evaluate } from '@mdx-js/mdx';\nimport { cx } from 'antd-style';\nimport { memo, type ReactNode, useEffect, useMemo, useState } from 'react';\nimport jsxDevRuntime from 'react/jsx-dev-runtime';\nimport jsxRuntime from 'react/jsx-runtime';\nimport { rehypeGithubAlerts } from 'rehype-github-alerts';\nimport rehypeKatex from 'rehype-katex';\nimport remarkGfm from 'remark-gfm';\nimport remarkMath from 'remark-math';\nimport { type Pluggable } from 'unified';\n\nimport Alert from '@/Alert';\nimport { useMarkdownContent } from '@/hooks/useMarkdown';\nimport { PreviewGroup } from '@/Image';\nimport { Typography, type TypographyProps } from '@/Markdown';\nimport { styles } from '@/Markdown/style';\n\nimport mdxComponents from '../mdxComponents';\nimport CodeBlock from '../mdxComponents/CodeBlock';\nimport Image from '../mdxComponents/Image';\nimport Video from '../mdxComponents/Video';\n\nconst runtime = process.env.NODE_ENV === 'production' ? jsxRuntime : jsxDevRuntime;\n\nexport interface MdxProps extends Omit<TypographyProps, 'children'> {\n children: string;\n components?: any[];\n enableImageGallery?: boolean;\n enableLatex?: boolean;\n enableMermaid?: boolean;\n fallback?: ReactNode;\n fullFeaturedCodeBlock?: boolean;\n onDoubleClick?: () => void;\n rehypePlugins?: Pluggable[];\n remarkPlugins?: Pluggable[];\n variant?: 'normal' | 'chat';\n}\n\nconst Mdx = memo<MdxProps>(\n ({\n children,\n className,\n style,\n fullFeaturedCodeBlock = true,\n enableImageGallery,\n enableLatex = true,\n enableMermaid = true,\n rehypePlugins,\n remarkPlugins,\n components = {},\n fallback = null,\n fontSize,\n headerMultiple,\n lineHeight,\n marginMultiple,\n variant,\n ...rest\n }) => {\n const escapedContent = useMarkdownContent(children);\n\n const isChatMode = variant === 'chat';\n\n const [MDXContent, setMDXContent] = useState<any>(() => () => null);\n\n const innerRehypePlugins = Array.isArray(rehypePlugins) ? rehypePlugins : [rehypePlugins];\n const memoRehypePlugins = useMemo(\n () =>\n [rehypeGithubAlerts, enableLatex && rehypeKatex, ...innerRehypePlugins].filter(\n Boolean,\n ) as any,\n [enableLatex, ...innerRehypePlugins],\n );\n\n const innerRemarkPlugins = Array.isArray(remarkPlugins) ? remarkPlugins : [remarkPlugins];\n const memoRemarkPlugins = useMemo(\n () => [remarkGfm, enableLatex && remarkMath, ...innerRemarkPlugins].filter(Boolean) as any,\n [enableLatex, ...innerRemarkPlugins],\n );\n\n const memoComponents = useMemo(() => {\n const list: any = {};\n Object.entries({\n ...mdxComponents,\n img: Image,\n pre: (props: any) => (\n <CodeBlock\n {...props}\n enableMermaid={enableMermaid}\n fullFeatured={fullFeaturedCodeBlock}\n />\n ),\n video: Video,\n ...components,\n }).forEach(([key, Render]: any) => {\n list[key] = (props: any) => <Render {...props} />;\n });\n return list;\n }, [components, enableMermaid, fullFeaturedCodeBlock]);\n\n useEffect(() => {\n if (!escapedContent) return;\n (async () => {\n try {\n const { default: Content } = await evaluate(escapedContent, {\n ...runtime,\n development: process.env.NODE_ENV !== 'production',\n rehypePlugins: memoRehypePlugins,\n remarkPlugins: memoRemarkPlugins,\n });\n setMDXContent(() => Content);\n } catch (error: any) {\n // @ts-ignore\n setMDXContent(() => () => (\n <Alert\n description={String(error?.message as string)}\n title={'Error compiling MDX'}\n type=\"error\"\n style={{\n width: '100%',\n }}\n />\n ));\n console.error('Error compiling MDX:', error);\n }\n })();\n }, [escapedContent, memoRehypePlugins, memoRemarkPlugins]);\n\n if (!escapedContent || !MDXContent) return fallback;\n\n return (\n <Typography\n className={cx(enableLatex && styles.latex, isChatMode && styles.chat, className)}\n data-code-type=\"mdx\"\n fontSize={fontSize}\n headerMultiple={headerMultiple}\n lineHeight={lineHeight}\n marginMultiple={marginMultiple}\n style={style}\n {...rest}\n >\n <PreviewGroup enable={enableImageGallery}>\n <MDXContent components={memoComponents} />\n </PreviewGroup>\n </Typography>\n );\n },\n);\n\nMdx.displayName = 'Mdx';\n\nexport default Mdx;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,UAAU,QAAQ,IAAI,aAAa,eAAe,aAAa;AAgBrE,MAAM,MAAM,MACT,EACC,UACA,WACA,OACA,wBAAwB,MACxB,oBACA,cAAc,MACd,gBAAgB,MAChB,eACA,eACA,aAAa,CAAC,GACd,WAAW,MACX,UACA,gBACA,YACA,gBACA,SACA,GAAG,WACC;CACJ,MAAM,iBAAiB,mBAAmB,QAAQ;CAElD,MAAM,aAAa,YAAY;CAE/B,MAAM,CAAC,YAAY,iBAAiB,qBAA0B,IAAI;CAElE,MAAM,qBAAqB,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa;CACxF,MAAM,oBAAoB,cAEtB;EAAC;EAAoB,eAAe;EAAa,GAAG;CAAkB,CAAC,CAAC,OACtE,OACF,GACF,CAAC,aAAa,GAAG,kBAAkB,CACrC;CAEA,MAAM,qBAAqB,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa;CACxF,MAAM,oBAAoB,cAClB;EAAC;EAAW,eAAe;EAAY,GAAG;CAAkB,CAAC,CAAC,OAAO,OAAO,GAClF,CAAC,aAAa,GAAG,kBAAkB,CACrC;CAEA,MAAM,iBAAiB,cAAc;EACnC,MAAM,OAAY,CAAC;EACnB,OAAO,QAAQ;GACb,GAAG;GACH,KAAK;GACL,MAAM,UACJ,oBAAC,WAAD;IACE,GAAI;IACW;IACf,cAAc;GACf,CAAA;GAEH,OAAO;GACP,GAAG;EACL,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,YAAiB;GACjC,KAAK,QAAQ,UAAe,oBAAC,QAAD,EAAQ,GAAI,MAAQ,CAAA;EAClD,CAAC;EACD,OAAO;CACT,GAAG;EAAC;EAAY;EAAe;CAAqB,CAAC;CAErD,gBAAgB;EACd,IAAI,CAAC,gBAAgB;EACrB,CAAC,YAAY;GACX,IAAI;IACF,MAAM,EAAE,SAAS,YAAY,MAAM,SAAS,gBAAgB;KAC1D,GAAG;KACH,aAAa,QAAQ,IAAI,aAAa;KACtC,eAAe;KACf,eAAe;IACjB,CAAC;IACD,oBAAoB,OAAO;GAC7B,SAAS,OAAY;IAEnB,0BACE,oBAAC,OAAD;KACE,aAAa,OAAO,OAAO,OAAiB;KAC5C,OAAO;KACP,MAAK;KACL,OAAO,EACL,OAAO,OACT;IACD,CAAA,CACF;IACD,QAAQ,MAAM,wBAAwB,KAAK;GAC7C;EACF,EAAA,CAAG;CACL,GAAG;EAAC;EAAgB;EAAmB;CAAiB,CAAC;CAEzD,IAAI,CAAC,kBAAkB,CAAC,YAAY,OAAO;CAE3C,OACE,oBAAC,YAAD;EACE,WAAW,GAAG,eAAe,OAAO,OAAO,cAAc,OAAO,MAAM,SAAS;EAC/E,kBAAe;EACL;EACM;EACJ;EACI;EACT;EACP,GAAI;EAEJ,UAAA,oBAAC,cAAD;GAAc,QAAQ;GACpB,UAAA,oBAAC,YAAD,EAAY,YAAY,eAAiB,CAAA;EAC7B,CAAA;CACJ,CAAA;AAEhB,CACF;AAEA,IAAI,cAAc"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/mdx/Mdx/index.tsx"],"sourcesContent":["'use client';\n\nimport { evaluate } from '@mdx-js/mdx';\nimport { cx } from 'antd-style';\nimport { memo, type ReactNode, useEffect, useMemo, useState } from 'react';\nimport jsxDevRuntime from 'react/jsx-dev-runtime';\nimport jsxRuntime from 'react/jsx-runtime';\nimport { rehypeGithubAlerts } from 'rehype-github-alerts';\nimport remarkGfm from 'remark-gfm';\nimport remarkMath from 'remark-math';\nimport { type Pluggable } from 'unified';\n\nimport Alert from '@/Alert';\nimport { useMarkdownContent } from '@/hooks/useMarkdown';\nimport { PreviewGroup } from '@/Image';\nimport { Typography, type TypographyProps } from '@/Markdown';\nimport { rehypeKatex } from '@/Markdown/plugins/rehypeKatex';\nimport { styles } from '@/Markdown/style';\n\nimport mdxComponents from '../mdxComponents';\nimport CodeBlock from '../mdxComponents/CodeBlock';\nimport Image from '../mdxComponents/Image';\nimport Video from '../mdxComponents/Video';\n\nconst runtime = process.env.NODE_ENV === 'production' ? jsxRuntime : jsxDevRuntime;\n\nexport interface MdxProps extends Omit<TypographyProps, 'children'> {\n children: string;\n components?: any[];\n enableImageGallery?: boolean;\n enableLatex?: boolean;\n enableMermaid?: boolean;\n fallback?: ReactNode;\n fullFeaturedCodeBlock?: boolean;\n onDoubleClick?: () => void;\n rehypePlugins?: Pluggable[];\n remarkPlugins?: Pluggable[];\n variant?: 'normal' | 'chat';\n}\n\nconst Mdx = memo<MdxProps>(\n ({\n children,\n className,\n style,\n fullFeaturedCodeBlock = true,\n enableImageGallery,\n enableLatex = true,\n enableMermaid = true,\n rehypePlugins,\n remarkPlugins,\n components = {},\n fallback = null,\n fontSize,\n headerMultiple,\n lineHeight,\n marginMultiple,\n variant,\n ...rest\n }) => {\n const escapedContent = useMarkdownContent(children);\n\n const isChatMode = variant === 'chat';\n\n const [MDXContent, setMDXContent] = useState<any>(() => () => null);\n\n const innerRehypePlugins = Array.isArray(rehypePlugins) ? rehypePlugins : [rehypePlugins];\n const memoRehypePlugins = useMemo(\n () =>\n [rehypeGithubAlerts, enableLatex && rehypeKatex, ...innerRehypePlugins].filter(\n Boolean,\n ) as any,\n [enableLatex, ...innerRehypePlugins],\n );\n\n const innerRemarkPlugins = Array.isArray(remarkPlugins) ? remarkPlugins : [remarkPlugins];\n const memoRemarkPlugins = useMemo(\n () => [remarkGfm, enableLatex && remarkMath, ...innerRemarkPlugins].filter(Boolean) as any,\n [enableLatex, ...innerRemarkPlugins],\n );\n\n const memoComponents = useMemo(() => {\n const list: any = {};\n Object.entries({\n ...mdxComponents,\n img: Image,\n pre: (props: any) => (\n <CodeBlock\n {...props}\n enableMermaid={enableMermaid}\n fullFeatured={fullFeaturedCodeBlock}\n />\n ),\n video: Video,\n ...components,\n }).forEach(([key, Render]: any) => {\n list[key] = (props: any) => <Render {...props} />;\n });\n return list;\n }, [components, enableMermaid, fullFeaturedCodeBlock]);\n\n useEffect(() => {\n if (!escapedContent) return;\n (async () => {\n try {\n const { default: Content } = await evaluate(escapedContent, {\n ...runtime,\n development: process.env.NODE_ENV !== 'production',\n rehypePlugins: memoRehypePlugins,\n remarkPlugins: memoRemarkPlugins,\n });\n setMDXContent(() => Content);\n } catch (error: any) {\n // @ts-ignore\n setMDXContent(() => () => (\n <Alert\n description={String(error?.message as string)}\n title={'Error compiling MDX'}\n type=\"error\"\n style={{\n width: '100%',\n }}\n />\n ));\n console.error('Error compiling MDX:', error);\n }\n })();\n }, [escapedContent, memoRehypePlugins, memoRemarkPlugins]);\n\n if (!escapedContent || !MDXContent) return fallback;\n\n return (\n <Typography\n className={cx(enableLatex && styles.latex, isChatMode && styles.chat, className)}\n data-code-type=\"mdx\"\n fontSize={fontSize}\n headerMultiple={headerMultiple}\n lineHeight={lineHeight}\n marginMultiple={marginMultiple}\n style={style}\n {...rest}\n >\n <PreviewGroup enable={enableImageGallery}>\n <MDXContent components={memoComponents} />\n </PreviewGroup>\n </Typography>\n );\n },\n);\n\nMdx.displayName = 'Mdx';\n\nexport default Mdx;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,UAAU,QAAQ,IAAI,aAAa,eAAe,aAAa;AAgBrE,MAAM,MAAM,MACT,EACC,UACA,WACA,OACA,wBAAwB,MACxB,oBACA,cAAc,MACd,gBAAgB,MAChB,eACA,eACA,aAAa,CAAC,GACd,WAAW,MACX,UACA,gBACA,YACA,gBACA,SACA,GAAG,WACC;CACJ,MAAM,iBAAiB,mBAAmB,QAAQ;CAElD,MAAM,aAAa,YAAY;CAE/B,MAAM,CAAC,YAAY,iBAAiB,qBAA0B,IAAI;CAElE,MAAM,qBAAqB,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa;CACxF,MAAM,oBAAoB,cAEtB;EAAC;EAAoB,eAAe;EAAa,GAAG;CAAkB,CAAC,CAAC,OACtE,OACF,GACF,CAAC,aAAa,GAAG,kBAAkB,CACrC;CAEA,MAAM,qBAAqB,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa;CACxF,MAAM,oBAAoB,cAClB;EAAC;EAAW,eAAe;EAAY,GAAG;CAAkB,CAAC,CAAC,OAAO,OAAO,GAClF,CAAC,aAAa,GAAG,kBAAkB,CACrC;CAEA,MAAM,iBAAiB,cAAc;EACnC,MAAM,OAAY,CAAC;EACnB,OAAO,QAAQ;GACb,GAAG;GACH,KAAK;GACL,MAAM,UACJ,oBAAC,WAAD;IACE,GAAI;IACW;IACf,cAAc;GACf,CAAA;GAEH,OAAO;GACP,GAAG;EACL,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,YAAiB;GACjC,KAAK,QAAQ,UAAe,oBAAC,QAAD,EAAQ,GAAI,MAAQ,CAAA;EAClD,CAAC;EACD,OAAO;CACT,GAAG;EAAC;EAAY;EAAe;CAAqB,CAAC;CAErD,gBAAgB;EACd,IAAI,CAAC,gBAAgB;EACrB,CAAC,YAAY;GACX,IAAI;IACF,MAAM,EAAE,SAAS,YAAY,MAAM,SAAS,gBAAgB;KAC1D,GAAG;KACH,aAAa,QAAQ,IAAI,aAAa;KACtC,eAAe;KACf,eAAe;IACjB,CAAC;IACD,oBAAoB,OAAO;GAC7B,SAAS,OAAY;IAEnB,0BACE,oBAAC,OAAD;KACE,aAAa,OAAO,OAAO,OAAiB;KAC5C,OAAO;KACP,MAAK;KACL,OAAO,EACL,OAAO,OACT;IACD,CAAA,CACF;IACD,QAAQ,MAAM,wBAAwB,KAAK;GAC7C;EACF,EAAA,CAAG;CACL,GAAG;EAAC;EAAgB;EAAmB;CAAiB,CAAC;CAEzD,IAAI,CAAC,kBAAkB,CAAC,YAAY,OAAO;CAE3C,OACE,oBAAC,YAAD;EACE,WAAW,GAAG,eAAe,OAAO,OAAO,cAAc,OAAO,MAAM,SAAS;EAC/E,kBAAe;EACL;EACM;EACJ;EACI;EACT;EACP,GAAI;EAEJ,UAAA,oBAAC,cAAD;GAAc,QAAQ;GACpB,UAAA,oBAAC,YAAD,EAAY,YAAY,eAAiB,CAAA;EAC7B,CAAA;CACJ,CAAA;AAEhB,CACF;AAEA,IAAI,cAAc"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import FlexBasic_default from "../../Flex/FlexBasic.mjs";
3
- import ActionIcon from "../../ActionIcon/ActionIcon.mjs";
3
+ import ActionIcon from "../../base-ui/ActionIcon/ActionIcon.mjs";
4
4
  import SafeArea from "../SafeArea/SafeArea.mjs";
5
5
  import { styles } from "./style.mjs";
6
6
  import { memo } from "react";
@@ -1 +1 @@
1
- {"version":3,"file":"ChatHeader.mjs","names":["Flexbox","MobileSafeArea"],"sources":["../../../src/mobile/ChatHeader/ChatHeader.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { ChevronLeft } from 'lucide-react';\nimport { memo } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport { Flexbox } from '@/Flex';\nimport MobileSafeArea from '@/mobile/SafeArea';\n\nimport { styles } from './style';\nimport type { ChatHeaderProps } from './type';\n\nconst ChatHeader = memo<ChatHeaderProps>(\n ({\n ref,\n className,\n safeArea = true,\n style,\n center,\n left,\n right,\n gaps,\n classNames,\n onBackClick,\n showBackButton,\n styles: custmStyles,\n children,\n ...rest\n }) => {\n return (\n <Flexbox\n as={'header'}\n className={cx(styles.container, className)}\n ref={ref}\n style={style}\n {...rest}\n >\n {safeArea && <MobileSafeArea position={'top'} />}\n <Flexbox\n horizontal\n align={'center'}\n className={styles.inner}\n flex={1}\n justify={'space-between'}\n >\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.left, classNames?.left)}\n flex={1}\n gap={gaps?.left}\n style={custmStyles?.left}\n >\n {showBackButton && <ActionIcon icon={ChevronLeft} onClick={() => onBackClick?.()} />}\n {left}\n </Flexbox>\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.center, classNames?.center)}\n flex={1}\n gap={gaps?.center}\n justify={'center'}\n style={custmStyles?.center}\n >\n {children}\n {center}\n </Flexbox>\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.right, classNames?.right)}\n flex={1}\n gap={gaps?.right}\n style={custmStyles?.right}\n >\n {right}\n </Flexbox>\n </Flexbox>\n </Flexbox>\n );\n },\n);\n\nChatHeader.displayName = 'ChatHeader';\n\nexport default ChatHeader;\n"],"mappings":";;;;;;;;;;AAaA,MAAM,aAAa,MAChB,EACC,KACA,WACA,WAAW,MACX,OACA,QACA,MACA,OACA,MACA,YACA,aACA,gBACA,QAAQ,aACR,UACA,GAAG,WACC;CACJ,OACE,qBAACA,mBAAD;EACE,IAAI;EACJ,WAAW,GAAG,OAAO,WAAW,SAAS;EACpC;EACE;EACP,GAAI;EALN,UAAA,CAOG,YAAY,oBAACC,UAAD,EAAgB,UAAU,MAAQ,CAAA,GAC/C,qBAACD,mBAAD;GACE,YAAA;GACA,OAAO;GACP,WAAW,OAAO;GAClB,MAAM;GACN,SAAS;GALX,UAAA;IAOE,qBAACA,mBAAD;KACE,YAAA;KACA,OAAO;KACP,WAAW,GAAG,OAAO,MAAM,YAAY,IAAI;KAC3C,MAAM;KACN,KAAK,MAAM;KACX,OAAO,aAAa;KANtB,UAAA,CAQG,kBAAkB,oBAAC,YAAD;MAAY,MAAM;MAAa,eAAe,cAAc;KAAI,CAAA,GAClF,IACM;;IACT,qBAACA,mBAAD;KACE,YAAA;KACA,OAAO;KACP,WAAW,GAAG,OAAO,QAAQ,YAAY,MAAM;KAC/C,MAAM;KACN,KAAK,MAAM;KACX,SAAS;KACT,OAAO,aAAa;KAPtB,UAAA,CASG,UACA,MACM;;IACT,oBAACA,mBAAD;KACE,YAAA;KACA,OAAO;KACP,WAAW,GAAG,OAAO,OAAO,YAAY,KAAK;KAC7C,MAAM;KACN,KAAK,MAAM;KACX,OAAO,aAAa;KAEnB,UAAA;IACM,CAAA;GACF;EACF,CAAA,CAAA;;AAEb,CACF;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"ChatHeader.mjs","names":["Flexbox","MobileSafeArea"],"sources":["../../../src/mobile/ChatHeader/ChatHeader.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { ChevronLeft } from 'lucide-react';\nimport { memo } from 'react';\n\nimport ActionIcon from '@/base-ui/ActionIcon';\nimport { Flexbox } from '@/Flex';\nimport MobileSafeArea from '@/mobile/SafeArea';\n\nimport { styles } from './style';\nimport type { ChatHeaderProps } from './type';\n\nconst ChatHeader = memo<ChatHeaderProps>(\n ({\n ref,\n className,\n safeArea = true,\n style,\n center,\n left,\n right,\n gaps,\n classNames,\n onBackClick,\n showBackButton,\n styles: custmStyles,\n children,\n ...rest\n }) => {\n return (\n <Flexbox\n as={'header'}\n className={cx(styles.container, className)}\n ref={ref}\n style={style}\n {...rest}\n >\n {safeArea && <MobileSafeArea position={'top'} />}\n <Flexbox\n horizontal\n align={'center'}\n className={styles.inner}\n flex={1}\n justify={'space-between'}\n >\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.left, classNames?.left)}\n flex={1}\n gap={gaps?.left}\n style={custmStyles?.left}\n >\n {showBackButton && <ActionIcon icon={ChevronLeft} onClick={() => onBackClick?.()} />}\n {left}\n </Flexbox>\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.center, classNames?.center)}\n flex={1}\n gap={gaps?.center}\n justify={'center'}\n style={custmStyles?.center}\n >\n {children}\n {center}\n </Flexbox>\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.right, classNames?.right)}\n flex={1}\n gap={gaps?.right}\n style={custmStyles?.right}\n >\n {right}\n </Flexbox>\n </Flexbox>\n </Flexbox>\n );\n },\n);\n\nChatHeader.displayName = 'ChatHeader';\n\nexport default ChatHeader;\n"],"mappings":";;;;;;;;;;AAaA,MAAM,aAAa,MAChB,EACC,KACA,WACA,WAAW,MACX,OACA,QACA,MACA,OACA,MACA,YACA,aACA,gBACA,QAAQ,aACR,UACA,GAAG,WACC;CACJ,OACE,qBAACA,mBAAD;EACE,IAAI;EACJ,WAAW,GAAG,OAAO,WAAW,SAAS;EACpC;EACE;EACP,GAAI;EALN,UAAA,CAOG,YAAY,oBAACC,UAAD,EAAgB,UAAU,MAAQ,CAAA,GAC/C,qBAACD,mBAAD;GACE,YAAA;GACA,OAAO;GACP,WAAW,OAAO;GAClB,MAAM;GACN,SAAS;GALX,UAAA;IAOE,qBAACA,mBAAD;KACE,YAAA;KACA,OAAO;KACP,WAAW,GAAG,OAAO,MAAM,YAAY,IAAI;KAC3C,MAAM;KACN,KAAK,MAAM;KACX,OAAO,aAAa;KANtB,UAAA,CAQG,kBAAkB,oBAAC,YAAD;MAAY,MAAM;MAAa,eAAe,cAAc;KAAI,CAAA,GAClF,IACM;;IACT,qBAACA,mBAAD;KACE,YAAA;KACA,OAAO;KACP,WAAW,GAAG,OAAO,QAAQ,YAAY,MAAM;KAC/C,MAAM;KACN,KAAK,MAAM;KACX,SAAS;KACT,OAAO,aAAa;KAPtB,UAAA,CASG,UACA,MACM;;IACT,oBAACA,mBAAD;KACE,YAAA;KACA,OAAO;KACP,WAAW,GAAG,OAAO,OAAO,YAAY,KAAK;KAC7C,MAAM;KACN,KAAK,MAAM;KACX,OAAO,aAAa;KAEnB,UAAA;IACM,CAAA;GACF;EACF,CAAA,CAAA;;AAEb,CACF;AAEA,WAAW,cAAc"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import FlexBasic_default from "../../Flex/FlexBasic.mjs";
3
- import ActionIcon from "../../ActionIcon/ActionIcon.mjs";
3
+ import ActionIcon from "../../base-ui/ActionIcon/ActionIcon.mjs";
4
4
  import ChatInputAreaInner from "../../chat/ChatInputArea/components/ChatInputAreaInner.mjs";
5
5
  import SafeArea from "../SafeArea/SafeArea.mjs";
6
6
  import { styles } from "./style.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"ChatInputArea.mjs","names":["Flexbox"],"sources":["../../../src/mobile/ChatInputArea/ChatInputArea.tsx"],"sourcesContent":["'use client';\n\nimport { useSize } from 'ahooks';\nimport { cx } from 'antd-style';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport {\n type FC,\n memo,\n type PropsWithChildren,\n type ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport ChatInputAreaInner from '@/chat/ChatInputArea/components/ChatInputAreaInner';\nimport { Flexbox } from '@/Flex';\nimport SafeArea from '@/mobile/SafeArea';\n\nimport { styles } from './style';\nimport { type ChatInputAreaProps } from './type';\n\nconst ChatInputArea = memo<ChatInputAreaProps>(\n ({\n ref,\n className,\n style,\n topAddons,\n textAreaLeftAddons,\n textAreaRightAddons,\n bottomAddons,\n expand = false,\n setExpand,\n onSend,\n onInput,\n loading,\n value,\n safeArea,\n }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const size = useSize(containerRef);\n const [showFullscreen, setShowFullscreen] = useState<boolean>(false);\n const [isFocused, setIsFocused] = useState<boolean>(false);\n\n useEffect(() => {\n if (!size?.height) return;\n setShowFullscreen(size.height > 72);\n }, [size]);\n\n const InnerContainer: FC<\n PropsWithChildren & {\n bottomAddons?: ReactNode;\n textAreaLeftAddons?: ReactNode;\n textAreaRightAddons?: ReactNode;\n topAddons?: ReactNode;\n }\n > = useCallback(\n ({ children, ...r }) =>\n expand ? (\n <Flexbox className={styles.inner} gap={8}>\n <Flexbox horizontal gap={8} justify={'flex-end'}>\n {r.textAreaLeftAddons}\n {r.textAreaRightAddons}\n </Flexbox>\n {children}\n {r.topAddons}\n {r.bottomAddons}\n </Flexbox>\n ) : (\n <Flexbox horizontal align={'flex-end'} className={styles.inner} gap={8}>\n {r.textAreaLeftAddons}\n {children}\n {r.textAreaRightAddons}\n </Flexbox>\n ),\n [expand, loading],\n );\n\n const showAddons = !expand && !isFocused;\n\n return (\n <Flexbox\n className={cx(styles.container, expand && styles.expand, className)}\n gap={12}\n style={style}\n >\n {topAddons && <Flexbox style={showAddons ? {} : { display: 'none' }}>{topAddons}</Flexbox>}\n <Flexbox\n className={cx(expand && styles.expand)}\n ref={containerRef}\n style={{ position: 'relative' }}\n >\n {showFullscreen && (\n <ActionIcon\n active\n className={styles.expandButton}\n icon={expand ? ChevronDown : ChevronUp}\n id={'sssssss'}\n size={{ blockSize: 24, borderRadius: '50%', size: 14 }}\n style={expand ? { top: 6 } : {}}\n onClick={() => setExpand?.(!expand)}\n />\n )}\n <InnerContainer\n bottomAddons={bottomAddons}\n textAreaLeftAddons={textAreaLeftAddons}\n textAreaRightAddons={textAreaRightAddons}\n topAddons={topAddons}\n >\n <ChatInputAreaInner\n autoSize={expand ? false : { maxRows: 6, minRows: 1 }}\n className={styles.expandTextArea}\n loading={loading}\n ref={ref}\n style={{ height: 36, paddingBlock: 6 }}\n value={value}\n variant={expand ? 'borderless' : 'filled'}\n onBlur={() => setIsFocused(false)}\n onFocus={() => setIsFocused(true)}\n onInput={onInput}\n onSend={onSend}\n />\n </InnerContainer>\n </Flexbox>\n {bottomAddons && (\n <Flexbox style={showAddons ? {} : { display: 'none' }}>{bottomAddons}</Flexbox>\n )}\n {safeArea && !isFocused && <SafeArea position={'bottom'} />}\n </Flexbox>\n );\n },\n);\n\nChatInputArea.displayName = 'ChatInputArea';\n\nexport default ChatInputArea;\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAM,gBAAgB,MACnB,EACC,KACA,WACA,OACA,WACA,oBACA,qBACA,cACA,SAAS,OACT,WACA,QACA,SACA,SACA,OACA,eACI;CACJ,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,OAAO,QAAQ,YAAY;CACjC,MAAM,CAAC,gBAAgB,qBAAqB,SAAkB,KAAK;CACnE,MAAM,CAAC,WAAW,gBAAgB,SAAkB,KAAK;CAEzD,gBAAgB;EACd,IAAI,CAAC,MAAM,QAAQ;EACnB,kBAAkB,KAAK,SAAS,EAAE;CACpC,GAAG,CAAC,IAAI,CAAC;CAET,MAAM,iBAOF,aACD,EAAE,UAAU,GAAG,QACd,SACE,qBAACA,mBAAD;EAAS,WAAW,OAAO;EAAO,KAAK;EAAvC,UAAA;GACE,qBAACA,mBAAD;IAAS,YAAA;IAAW,KAAK;IAAG,SAAS;IAArC,UAAA,CACG,EAAE,oBACF,EAAE,mBACI;;GACR;GACA,EAAE;GACF,EAAE;EACI;CAET,CAAA,IAAA,qBAACA,mBAAD;EAAS,YAAA;EAAW,OAAO;EAAY,WAAW,OAAO;EAAO,KAAK;EAArE,UAAA;GACG,EAAE;GACF;GACA,EAAE;EACI;CAEb,CAAA,GAAA,CAAC,QAAQ,OAAO,CAClB;CAEA,MAAM,aAAa,CAAC,UAAU,CAAC;CAE/B,OACE,qBAACA,mBAAD;EACE,WAAW,GAAG,OAAO,WAAW,UAAU,OAAO,QAAQ,SAAS;EAClE,KAAK;EACE;EAHT,UAAA;GAKG,aAAa,oBAACA,mBAAD;IAAS,OAAO,aAAa,CAAC,IAAI,EAAE,SAAS,OAAO;IAAI,UAAA;GAAmB,CAAA;GACzF,qBAACA,mBAAD;IACE,WAAW,GAAG,UAAU,OAAO,MAAM;IACrC,KAAK;IACL,OAAO,EAAE,UAAU,WAAW;IAHhC,UAAA,CAKG,kBACC,oBAAC,YAAD;KACE,QAAA;KACA,WAAW,OAAO;KAClB,MAAM,SAAS,cAAc;KAC7B,IAAI;KACJ,MAAM;MAAE,WAAW;MAAI,cAAc;MAAO,MAAM;KAAG;KACrD,OAAO,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC;KAC9B,eAAe,YAAY,CAAC,MAAM;IACnC,CAAA,GAEH,oBAAC,gBAAD;KACgB;KACM;KACC;KACV;KAEX,UAAA,oBAAC,oBAAD;MACE,UAAU,SAAS,QAAQ;OAAE,SAAS;OAAG,SAAS;MAAE;MACpD,WAAW,OAAO;MACT;MACJ;MACL,OAAO;OAAE,QAAQ;OAAI,cAAc;MAAE;MAC9B;MACP,SAAS,SAAS,eAAe;MACjC,cAAc,aAAa,KAAK;MAChC,eAAe,aAAa,IAAI;MACvB;MACD;KACT,CAAA;IACa,CAAA,CACT;;GACR,gBACC,oBAACA,mBAAD;IAAS,OAAO,aAAa,CAAC,IAAI,EAAE,SAAS,OAAO;IAAI,UAAA;GAAsB,CAAA;GAE/E,YAAY,CAAC,aAAa,oBAAC,UAAD,EAAU,UAAU,SAAW,CAAA;EACnD;;AAEb,CACF;AAEA,cAAc,cAAc"}
1
+ {"version":3,"file":"ChatInputArea.mjs","names":["Flexbox"],"sources":["../../../src/mobile/ChatInputArea/ChatInputArea.tsx"],"sourcesContent":["'use client';\n\nimport { useSize } from 'ahooks';\nimport { cx } from 'antd-style';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport {\n type FC,\n memo,\n type PropsWithChildren,\n type ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport ActionIcon from '@/base-ui/ActionIcon';\nimport ChatInputAreaInner from '@/chat/ChatInputArea/components/ChatInputAreaInner';\nimport { Flexbox } from '@/Flex';\nimport SafeArea from '@/mobile/SafeArea';\n\nimport { styles } from './style';\nimport { type ChatInputAreaProps } from './type';\n\nconst ChatInputArea = memo<ChatInputAreaProps>(\n ({\n ref,\n className,\n style,\n topAddons,\n textAreaLeftAddons,\n textAreaRightAddons,\n bottomAddons,\n expand = false,\n setExpand,\n onSend,\n onInput,\n loading,\n value,\n safeArea,\n }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const size = useSize(containerRef);\n const [showFullscreen, setShowFullscreen] = useState<boolean>(false);\n const [isFocused, setIsFocused] = useState<boolean>(false);\n\n useEffect(() => {\n if (!size?.height) return;\n setShowFullscreen(size.height > 72);\n }, [size]);\n\n const InnerContainer: FC<\n PropsWithChildren & {\n bottomAddons?: ReactNode;\n textAreaLeftAddons?: ReactNode;\n textAreaRightAddons?: ReactNode;\n topAddons?: ReactNode;\n }\n > = useCallback(\n ({ children, ...r }) =>\n expand ? (\n <Flexbox className={styles.inner} gap={8}>\n <Flexbox horizontal gap={8} justify={'flex-end'}>\n {r.textAreaLeftAddons}\n {r.textAreaRightAddons}\n </Flexbox>\n {children}\n {r.topAddons}\n {r.bottomAddons}\n </Flexbox>\n ) : (\n <Flexbox horizontal align={'flex-end'} className={styles.inner} gap={8}>\n {r.textAreaLeftAddons}\n {children}\n {r.textAreaRightAddons}\n </Flexbox>\n ),\n [expand, loading],\n );\n\n const showAddons = !expand && !isFocused;\n\n return (\n <Flexbox\n className={cx(styles.container, expand && styles.expand, className)}\n gap={12}\n style={style}\n >\n {topAddons && <Flexbox style={showAddons ? {} : { display: 'none' }}>{topAddons}</Flexbox>}\n <Flexbox\n className={cx(expand && styles.expand)}\n ref={containerRef}\n style={{ position: 'relative' }}\n >\n {showFullscreen && (\n <ActionIcon\n active\n className={styles.expandButton}\n icon={expand ? ChevronDown : ChevronUp}\n id={'sssssss'}\n size={{ blockSize: 24, borderRadius: '50%', size: 14 }}\n style={expand ? { top: 6 } : {}}\n onClick={() => setExpand?.(!expand)}\n />\n )}\n <InnerContainer\n bottomAddons={bottomAddons}\n textAreaLeftAddons={textAreaLeftAddons}\n textAreaRightAddons={textAreaRightAddons}\n topAddons={topAddons}\n >\n <ChatInputAreaInner\n autoSize={expand ? false : { maxRows: 6, minRows: 1 }}\n className={styles.expandTextArea}\n loading={loading}\n ref={ref}\n style={{ height: 36, paddingBlock: 6 }}\n value={value}\n variant={expand ? 'borderless' : 'filled'}\n onBlur={() => setIsFocused(false)}\n onFocus={() => setIsFocused(true)}\n onInput={onInput}\n onSend={onSend}\n />\n </InnerContainer>\n </Flexbox>\n {bottomAddons && (\n <Flexbox style={showAddons ? {} : { display: 'none' }}>{bottomAddons}</Flexbox>\n )}\n {safeArea && !isFocused && <SafeArea position={'bottom'} />}\n </Flexbox>\n );\n },\n);\n\nChatInputArea.displayName = 'ChatInputArea';\n\nexport default ChatInputArea;\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAM,gBAAgB,MACnB,EACC,KACA,WACA,OACA,WACA,oBACA,qBACA,cACA,SAAS,OACT,WACA,QACA,SACA,SACA,OACA,eACI;CACJ,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,OAAO,QAAQ,YAAY;CACjC,MAAM,CAAC,gBAAgB,qBAAqB,SAAkB,KAAK;CACnE,MAAM,CAAC,WAAW,gBAAgB,SAAkB,KAAK;CAEzD,gBAAgB;EACd,IAAI,CAAC,MAAM,QAAQ;EACnB,kBAAkB,KAAK,SAAS,EAAE;CACpC,GAAG,CAAC,IAAI,CAAC;CAET,MAAM,iBAOF,aACD,EAAE,UAAU,GAAG,QACd,SACE,qBAACA,mBAAD;EAAS,WAAW,OAAO;EAAO,KAAK;EAAvC,UAAA;GACE,qBAACA,mBAAD;IAAS,YAAA;IAAW,KAAK;IAAG,SAAS;IAArC,UAAA,CACG,EAAE,oBACF,EAAE,mBACI;;GACR;GACA,EAAE;GACF,EAAE;EACI;CAET,CAAA,IAAA,qBAACA,mBAAD;EAAS,YAAA;EAAW,OAAO;EAAY,WAAW,OAAO;EAAO,KAAK;EAArE,UAAA;GACG,EAAE;GACF;GACA,EAAE;EACI;CAEb,CAAA,GAAA,CAAC,QAAQ,OAAO,CAClB;CAEA,MAAM,aAAa,CAAC,UAAU,CAAC;CAE/B,OACE,qBAACA,mBAAD;EACE,WAAW,GAAG,OAAO,WAAW,UAAU,OAAO,QAAQ,SAAS;EAClE,KAAK;EACE;EAHT,UAAA;GAKG,aAAa,oBAACA,mBAAD;IAAS,OAAO,aAAa,CAAC,IAAI,EAAE,SAAS,OAAO;IAAI,UAAA;GAAmB,CAAA;GACzF,qBAACA,mBAAD;IACE,WAAW,GAAG,UAAU,OAAO,MAAM;IACrC,KAAK;IACL,OAAO,EAAE,UAAU,WAAW;IAHhC,UAAA,CAKG,kBACC,oBAAC,YAAD;KACE,QAAA;KACA,WAAW,OAAO;KAClB,MAAM,SAAS,cAAc;KAC7B,IAAI;KACJ,MAAM;MAAE,WAAW;MAAI,cAAc;MAAO,MAAM;KAAG;KACrD,OAAO,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC;KAC9B,eAAe,YAAY,CAAC,MAAM;IACnC,CAAA,GAEH,oBAAC,gBAAD;KACgB;KACM;KACC;KACV;KAEX,UAAA,oBAAC,oBAAD;MACE,UAAU,SAAS,QAAQ;OAAE,SAAS;OAAG,SAAS;MAAE;MACpD,WAAW,OAAO;MACT;MACJ;MACL,OAAO;OAAE,QAAQ;OAAI,cAAc;MAAE;MAC9B;MACP,SAAS,SAAS,eAAe;MACjC,cAAc,aAAa,KAAK;MAChC,eAAe,aAAa,IAAI;MACvB;MACD;KACT,CAAA;IACa,CAAA,CACT;;GACR,gBACC,oBAACA,mBAAD;IAAS,OAAO,aAAa,CAAC,IAAI,EAAE,SAAS,OAAO;IAAI,UAAA;GAAsB,CAAA;GAE/E,YAAY,CAAC,aAAa,oBAAC,UAAD,EAAU,UAAU,SAAW,CAAA;EACnD;;AAEb,CACF;AAEA,cAAc,cAAc"}
@@ -1,4 +1,4 @@
1
- import { SKIP, visitParents } from "../../../../unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.mjs";
1
+ import { SKIP as SKIP$1, visitParents } from "unist-util-visit-parents";
2
2
  //#region node_modules/.pnpm/unist-util-visit@5.1.0/node_modules/unist-util-visit/lib/index.js
3
3
  /**
4
4
  * @import {Node as UnistNode, Parent as UnistParent} from 'unist'
@@ -284,6 +284,6 @@ function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
284
284
  }
285
285
  }
286
286
  //#endregion
287
- export { SKIP, visit };
287
+ export { SKIP$1 as SKIP, visit };
288
288
 
289
289
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "5.34.2",
3
+ "version": "5.35.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -167,7 +167,9 @@
167
167
  "emoji-mart": "^5.6.0",
168
168
  "es-toolkit": "^1.49.0",
169
169
  "fast-deep-equal": "^3.1.3",
170
+ "hast-util-from-html-isomorphic": "^2.0.0",
170
171
  "hast-util-to-jsx-runtime": "^2.3.6",
172
+ "hast-util-to-text": "^4.0.2",
171
173
  "html-url-attributes": "^3.0.1",
172
174
  "immer": "^11.1.11",
173
175
  "katex": "^0.18.1",
@@ -192,7 +194,6 @@
192
194
  "react-rnd": "^10.5.3",
193
195
  "react-zoom-pan-pinch": "^4.0.3",
194
196
  "rehype-github-alerts": "^4.2.0",
195
- "rehype-katex": "^7.0.1",
196
197
  "rehype-raw": "^7.0.0",
197
198
  "remark-breaks": "^4.0.0",
198
199
  "remark-cjk-friendly": "^2.3.1",
@@ -206,6 +207,7 @@
206
207
  "swr": "^2.4.2",
207
208
  "ts-md5": "^2.0.1",
208
209
  "unified": "^11.0.5",
210
+ "unist-util-visit-parents": "^6.0.2",
209
211
  "url-join": "^5.0.0",
210
212
  "use-merge-value": "^1.2.0",
211
213
  "uuid": "^14.0.1",
@@ -1,117 +0,0 @@
1
- //#region node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js
2
- /**
3
- * Generate an assertion from a test.
4
- *
5
- * Useful if you’re going to test many nodes, for example when creating a
6
- * utility where something else passes a compatible test.
7
- *
8
- * The created function is a bit faster because it expects valid input only:
9
- * a `node`, `index`, and `parent`.
10
- *
11
- * @param {Test} test
12
- * * when nullish, checks if `node` is a `Node`.
13
- * * when `string`, works like passing `(node) => node.type === test`.
14
- * * when `function` checks if function passed the node is true.
15
- * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
16
- * * when `array`, checks if any one of the subtests pass.
17
- * @returns {Check}
18
- * An assertion.
19
- */
20
- const convert = (
21
- /**
22
- * @param {Test} [test]
23
- * @returns {Check}
24
- */
25
- function(test) {
26
- if (test === null || test === void 0) return ok;
27
- if (typeof test === "function") return castFactory(test);
28
- if (typeof test === "object") return Array.isArray(test) ? anyFactory(test) : propertiesFactory(test);
29
- if (typeof test === "string") return typeFactory(test);
30
- throw new Error("Expected function, string, or object as test");
31
- });
32
- /**
33
- * @param {Array<Props | TestFunction | string>} tests
34
- * @returns {Check}
35
- */
36
- function anyFactory(tests) {
37
- /** @type {Array<Check>} */
38
- const checks = [];
39
- let index = -1;
40
- while (++index < tests.length) checks[index] = convert(tests[index]);
41
- return castFactory(any);
42
- /**
43
- * @this {unknown}
44
- * @type {TestFunction}
45
- */
46
- function any(...parameters) {
47
- let index = -1;
48
- while (++index < checks.length) if (checks[index].apply(this, parameters)) return true;
49
- return false;
50
- }
51
- }
52
- /**
53
- * Turn an object into a test for a node with a certain fields.
54
- *
55
- * @param {Props} check
56
- * @returns {Check}
57
- */
58
- function propertiesFactory(check) {
59
- const checkAsRecord = check;
60
- return castFactory(all);
61
- /**
62
- * @param {Node} node
63
- * @returns {boolean}
64
- */
65
- function all(node) {
66
- const nodeAsRecord = node;
67
- /** @type {string} */
68
- let key;
69
- for (key in check) if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
70
- return true;
71
- }
72
- }
73
- /**
74
- * Turn a string into a test for a node with a certain type.
75
- *
76
- * @param {string} check
77
- * @returns {Check}
78
- */
79
- function typeFactory(check) {
80
- return castFactory(type);
81
- /**
82
- * @param {Node} node
83
- */
84
- function type(node) {
85
- return node && node.type === check;
86
- }
87
- }
88
- /**
89
- * Turn a custom test into a test for a node that passes that test.
90
- *
91
- * @param {TestFunction} testFunction
92
- * @returns {Check}
93
- */
94
- function castFactory(testFunction) {
95
- return check;
96
- /**
97
- * @this {unknown}
98
- * @type {Check}
99
- */
100
- function check(value, index, parent) {
101
- return Boolean(looksLikeANode(value) && testFunction.call(this, value, typeof index === "number" ? index : void 0, parent || void 0));
102
- }
103
- }
104
- function ok() {
105
- return true;
106
- }
107
- /**
108
- * @param {unknown} value
109
- * @returns {value is Node}
110
- */
111
- function looksLikeANode(value) {
112
- return value !== null && typeof value === "object" && "type" in value;
113
- }
114
- //#endregion
115
- export { convert };
116
-
117
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js"],"sourcesContent":["/**\n * @import {Node, Parent} from 'unist'\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is a node.\n * @param {unknown} this\n * The given context.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The node’s parent.\n * @returns {boolean}\n * Whether this is a node and passes a test.\n *\n * @typedef {Record<string, unknown> | Node} Props\n * Object to check for equivalence.\n *\n * Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test\n * Check for an arbitrary node.\n *\n * @callback TestFunction\n * Check if a node passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Node} node\n * A node.\n * @param {number | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n * The node’s parent.\n * @returns {boolean | undefined | void}\n * Whether this node passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n * Thing to check, typically `Node`.\n * @param {Test} test\n * A check for a specific node.\n * @param {number | null | undefined} index\n * The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n * The node’s parent.\n * @param {unknown} context\n * Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n * Whether `node` is a node and passes a test.\n */\nexport const is =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n * (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n * (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((node?: null | undefined) => false) &\n * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [node]\n * @param {Test} [test]\n * @param {number | null | undefined} [index]\n * @param {Parent | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (node, test, index, parent, context) {\n const check = convert(test)\n\n if (\n index !== undefined &&\n index !== null &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite index')\n }\n\n if (\n parent !== undefined &&\n parent !== null &&\n (!is(parent) || !parent.children)\n ) {\n throw new Error('Expected parent node')\n }\n\n if (\n (parent === undefined || parent === null) !==\n (index === undefined || index === null)\n ) {\n throw new Error('Expected both parent and index')\n }\n\n return looksLikeANode(node)\n ? check.call(context, node, index, parent)\n : false\n }\n )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n * * when nullish, checks if `node` is a `Node`.\n * * when `string`, works like passing `(node) => node.type === test`.\n * * when `function` checks if function passed the node is true.\n * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n * * when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n * An assertion.\n */\nexport const convert =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return ok\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n if (typeof test === 'object') {\n return Array.isArray(test)\n ? anyFactory(test)\n : // Cast because `ReadonlyArray` goes into the above but `isArray`\n // narrows to `Array`.\n propertiesFactory(/** @type {Props} */ (test))\n }\n\n if (typeof test === 'string') {\n return typeFactory(test)\n }\n\n throw new Error('Expected function, string, or object as test')\n }\n )\n\n/**\n * @param {Array<Props | TestFunction | string>} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array<Check>} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convert(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propertiesFactory(check) {\n const checkAsRecord = /** @type {Record<string, unknown>} */ (check)\n\n return castFactory(all)\n\n /**\n * @param {Node} node\n * @returns {boolean}\n */\n function all(node) {\n const nodeAsRecord = /** @type {Record<string, unknown>} */ (\n /** @type {unknown} */ (node)\n )\n\n /** @type {string} */\n let key\n\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n }\n\n return true\n }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n return castFactory(type)\n\n /**\n * @param {Node} node\n */\n function type(node) {\n return node && node.type === check\n }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\nfunction ok() {\n return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n return value !== null && typeof value === 'object' && 'type' in value\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;AA4IA,MAAa;;;;;AAgBT,SAAU,MAAM;CACd,IAAI,SAAS,QAAQ,SAAS,KAAA,GAC5B,OAAO;CAGT,IAAI,OAAO,SAAS,YAClB,OAAO,YAAY,IAAI;CAGzB,IAAI,OAAO,SAAS,UAClB,OAAO,MAAM,QAAQ,IAAI,IACrB,WAAW,IAAI,IAGf,kBAAwC,IAAK;CAGnD,IAAI,OAAO,SAAS,UAClB,OAAO,YAAY,IAAI;CAGzB,MAAM,IAAI,MAAM,8CAA8C;AAChE;;;;;AAOJ,SAAS,WAAW,OAAO;;CAEzB,MAAM,SAAS,CAAC;CAChB,IAAI,QAAQ;CAEZ,OAAO,EAAE,QAAQ,MAAM,QACrB,OAAO,SAAS,QAAQ,MAAM,MAAM;CAGtC,OAAO,YAAY,GAAG;;;;;CAMtB,SAAS,IAAI,GAAG,YAAY;EAC1B,IAAI,QAAQ;EAEZ,OAAO,EAAE,QAAQ,OAAO,QACtB,IAAI,OAAO,MAAM,CAAC,MAAM,MAAM,UAAU,GAAG,OAAO;EAGpD,OAAO;CACT;AACF;;;;;;;AAQA,SAAS,kBAAkB,OAAO;CAChC,MAAM,gBAAwD;CAE9D,OAAO,YAAY,GAAG;;;;;CAMtB,SAAS,IAAI,MAAM;EACjB,MAAM,eACoB;;EAI1B,IAAI;EAEJ,KAAK,OAAO,OACV,IAAI,aAAa,SAAS,cAAc,MAAM,OAAO;EAGvD,OAAO;CACT;AACF;;;;;;;AAQA,SAAS,YAAY,OAAO;CAC1B,OAAO,YAAY,IAAI;;;;CAKvB,SAAS,KAAK,MAAM;EAClB,OAAO,QAAQ,KAAK,SAAS;CAC/B;AACF;;;;;;;AAQA,SAAS,YAAY,cAAc;CACjC,OAAO;;;;;CAMP,SAAS,MAAM,OAAO,OAAO,QAAQ;EACnC,OAAO,QACL,eAAe,KAAK,KAClB,aAAa,KACX,MACA,OACA,OAAO,UAAU,WAAW,QAAQ,KAAA,GACpC,UAAU,KAAA,CACZ,CACJ;CACF;AACF;AAEA,SAAS,KAAK;CACZ,OAAO;AACT;;;;;AAMA,SAAS,eAAe,OAAO;CAC7B,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,UAAU;AAClE"}
@@ -1,12 +0,0 @@
1
- //#region node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.node.js
2
- /**
3
- * @param {string} d
4
- * @returns {string}
5
- */
6
- function color(d) {
7
- return "\x1B[33m" + d + "\x1B[39m";
8
- }
9
- //#endregion
10
- export { color };
11
-
12
- //# sourceMappingURL=color.node.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"color.node.mjs","names":[],"sources":["../../../../../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.node.js"],"sourcesContent":["/**\n * @param {string} d\n * @returns {string}\n */\nexport function color(d) {\n return '\\u001B[33m' + d + '\\u001B[39m'\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAIA,SAAgB,MAAM,GAAG;CACvB,OAAO,aAAe,IAAI;AAC5B"}