@lobehub/ui 6.0.0-beta.4 → 6.0.0-beta.6
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/es/ActionIcon/style.mjs +1 -1
- package/es/ActionIcon/style.mjs.map +1 -1
- package/es/Anchor/Anchor.mjs +2 -2
- package/es/Anchor/Anchor.mjs.map +1 -1
- package/es/Carousel/Carousel.mjs +1 -1
- package/es/Carousel/Carousel.mjs.map +1 -1
- package/es/CodeDiff/CodeDiff.mjs.map +1 -1
- package/es/CodeDiff/PatchDiff.mjs.map +1 -1
- package/es/CodeDiff/theme.mjs.map +1 -1
- package/es/CodeDiff/type.d.mts +2 -2
- package/es/CodeEditor/CodeEditor.mjs +1 -1
- package/es/CodeEditor/CodeEditor.mjs.map +1 -1
- package/es/ColorPicker/ColorPicker.mjs +1 -1
- package/es/ColorPicker/ColorPicker.mjs.map +1 -1
- package/es/ColorSwatches/ColorSwatches.mjs +18 -23
- package/es/ColorSwatches/ColorSwatches.mjs.map +1 -1
- package/es/ColorSwatches/CustomPicker.mjs +101 -0
- package/es/ColorSwatches/CustomPicker.mjs.map +1 -0
- package/es/ColorSwatches/index.d.mts +2 -2
- package/es/ColorSwatches/marker.stylex.mjs +9 -0
- package/es/ColorSwatches/marker.stylex.mjs.map +1 -0
- package/es/ColorSwatches/style.mjs +36 -0
- package/es/ColorSwatches/style.mjs.map +1 -1
- package/es/ColorSwatches/type.d.mts +9 -0
- package/es/ConfigProvider/cdnAssets.mjs +6 -0
- package/es/ConfigProvider/cdnAssets.mjs.map +1 -0
- package/es/ConfigProvider/index.mjs +2 -1
- package/es/ConfigProvider/index.mjs.map +1 -1
- package/es/ContextMenu/store.d.mts +0 -1
- package/es/ContextMenu/store.mjs.map +1 -1
- package/es/DatePicker/DatePicker.mjs +1 -1
- package/es/DatePicker/DatePicker.mjs.map +1 -1
- package/es/DatePicker/DateRangePicker.mjs +1 -1
- package/es/DatePicker/DateRangePicker.mjs.map +1 -1
- package/es/DraggablePanel/atoms.mjs +1 -1
- package/es/DraggablePanel/atoms.mjs.map +1 -1
- package/es/DraggableSideNav/DraggableSideNav.mjs +2 -2
- package/es/DraggableSideNav/DraggableSideNav.mjs.map +1 -1
- package/es/Drawer/atoms.mjs +1 -1
- package/es/Drawer/atoms.mjs.map +1 -1
- package/es/DropdownMenu/atoms.mjs +1 -1
- package/es/DropdownMenu/atoms.mjs.map +1 -1
- package/es/EditableText/ControlInput.mjs +42 -29
- package/es/EditableText/ControlInput.mjs.map +1 -1
- package/es/EditableText/EditableText.mjs +1 -1
- package/es/EditableText/EditableText.mjs.map +1 -1
- package/es/EmojiPicker/EmojiPicker.mjs +3 -9
- package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
- package/es/EmojiPicker/useEmojiMartI18n.mjs +37 -0
- package/es/EmojiPicker/useEmojiMartI18n.mjs.map +1 -0
- package/es/FormKit/engine/tanstack.mjs +1 -1
- package/es/FormKit/engine/tanstack.mjs.map +1 -1
- package/es/Grid/style.mjs +1 -1
- package/es/Grid/style.mjs.map +1 -1
- package/es/HotkeyInput/HotkeyInput.mjs +1 -1
- package/es/HotkeyInput/HotkeyInput.mjs.map +1 -1
- package/es/Image/type.d.mts +1 -0
- package/es/Image/viewer/ImageViewer.mjs +2 -1
- package/es/Image/viewer/ImageViewer.mjs.map +1 -1
- package/es/Image/viewer/Toolbar.mjs +19 -6
- package/es/Image/viewer/Toolbar.mjs.map +1 -1
- package/es/Image/viewer/ViewerChrome.mjs.map +1 -1
- package/es/ImageSelect/ImageSelect.mjs +1 -1
- package/es/ImageSelect/ImageSelect.mjs.map +1 -1
- package/es/Input/Input.mjs +7 -5
- package/es/Input/Input.mjs.map +1 -1
- package/es/Input/TextArea.mjs +1 -1
- package/es/Input/TextArea.mjs.map +1 -1
- package/es/Input/style.mjs +3 -3
- package/es/Input/style.mjs.map +1 -1
- package/es/Modal/atoms.mjs +3 -3
- package/es/Modal/atoms.mjs.map +1 -1
- package/es/Pagination/Pagination.mjs +1 -1
- package/es/Pagination/Pagination.mjs.map +1 -1
- package/es/Popover/PopoverInGroup.mjs +1 -1
- package/es/Popover/PopoverInGroup.mjs.map +1 -1
- package/es/Popover/atoms.mjs +1 -1
- package/es/Popover/atoms.mjs.map +1 -1
- package/es/Rate/Rate.mjs +1 -1
- package/es/Rate/Rate.mjs.map +1 -1
- package/es/ScrollShadow/ScrollShadow.mjs +1 -1
- package/es/ScrollShadow/ScrollShadow.mjs.map +1 -1
- package/es/SearchBar/SearchBar.mjs +31 -25
- package/es/SearchBar/SearchBar.mjs.map +1 -1
- package/es/Segmented/Segmented.mjs +1 -1
- package/es/Segmented/Segmented.mjs.map +1 -1
- package/es/Select/atoms.mjs +1 -1
- package/es/Select/atoms.mjs.map +1 -1
- package/es/Switch/atoms.mjs +1 -1
- package/es/Switch/atoms.mjs.map +1 -1
- package/es/Tabs/Tabs.mjs +35 -21
- package/es/Tabs/Tabs.mjs.map +1 -1
- package/es/ToggleGroup/ToggleGroup.mjs +1 -1
- package/es/ToggleGroup/ToggleGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipInGroup.mjs +1 -1
- package/es/Tooltip/TooltipInGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipStandalone.mjs +1 -1
- package/es/Tooltip/TooltipStandalone.mjs.map +1 -1
- package/es/Tree/Tree.mjs +1 -1
- package/es/Tree/Tree.mjs.map +1 -1
- package/es/awesome/Giscus/style.mjs +9 -9
- package/es/awesome/Giscus/style.mjs.map +1 -1
- package/es/awesome/Grainient/Grainient.d.mts +11 -0
- package/es/awesome/Grainient/Grainient.mjs +314 -0
- package/es/awesome/Grainient/Grainient.mjs.map +1 -0
- package/es/awesome/Grainient/index.d.mts +3 -0
- package/es/awesome/Grainient/style.mjs +23 -0
- package/es/awesome/Grainient/style.mjs.map +1 -0
- package/es/awesome/Grainient/type.d.mts +121 -0
- package/es/awesome/GridBackground/GridBackground.mjs +1 -1
- package/es/awesome/GridBackground/GridBackground.mjs.map +1 -1
- package/es/awesome/GridBackground/GridShowcase.mjs +4 -4
- package/es/awesome/GridBackground/GridShowcase.mjs.map +1 -1
- package/es/awesome/Spline/ParentSize.mjs +1 -1
- package/es/awesome/Spline/ParentSize.mjs.map +1 -1
- package/es/awesome/index.d.mts +4 -1
- package/es/awesome/index.mjs +2 -1
- package/es/chat/BackBottom/BackBottom.mjs +1 -1
- package/es/chat/BackBottom/BackBottom.mjs.map +1 -1
- package/es/chat/BackBottom/type.d.mts +2 -2
- package/es/chat/EditableMessage/EditableMessage.mjs +1 -1
- package/es/chat/EditableMessage/EditableMessage.mjs.map +1 -1
- package/es/chat/EditableMessageList/EditableMessageList.mjs +1 -1
- package/es/chat/EditableMessageList/EditableMessageList.mjs.map +1 -1
- package/es/chat/EditableMessageList/messageReducer.mjs +30 -23
- package/es/chat/EditableMessageList/messageReducer.mjs.map +1 -1
- package/es/chat/MessageModal/MessageModal.mjs +1 -1
- package/es/chat/MessageModal/MessageModal.mjs.map +1 -1
- package/es/chat/TokenTag/TokenTag.mjs +2 -3
- package/es/chat/TokenTag/TokenTag.mjs.map +1 -1
- package/es/dashboard/AuthLayout/Aside.d.mts +10 -0
- package/es/dashboard/AuthLayout/Aside.mjs +31 -0
- package/es/dashboard/AuthLayout/Aside.mjs.map +1 -0
- package/es/dashboard/AuthLayout/AuthLayout.d.mts +3 -1
- package/es/dashboard/AuthLayout/AuthLayout.mjs +93 -37
- package/es/dashboard/AuthLayout/AuthLayout.mjs.map +1 -1
- package/es/dashboard/AuthLayout/index.d.mts +3 -2
- package/es/dashboard/AuthLayout/style.mjs +98 -1
- package/es/dashboard/AuthLayout/style.mjs.map +1 -1
- package/es/dashboard/AuthLayout/type.d.mts +38 -2
- package/es/dashboard/AuthTools/AuthLocaleSwitch.d.mts +10 -0
- package/es/dashboard/AuthTools/AuthLocaleSwitch.mjs +33 -0
- package/es/dashboard/AuthTools/AuthLocaleSwitch.mjs.map +1 -0
- package/es/dashboard/AuthTools/AuthThemeSwitch.d.mts +10 -0
- package/es/dashboard/AuthTools/AuthThemeSwitch.mjs +59 -0
- package/es/dashboard/AuthTools/AuthThemeSwitch.mjs.map +1 -0
- package/es/dashboard/AuthTools/index.d.mts +4 -0
- package/es/dashboard/AuthTools/style.mjs +27 -0
- package/es/dashboard/AuthTools/style.mjs.map +1 -0
- package/es/dashboard/AuthTools/type.d.mts +29 -0
- package/es/dashboard/ChartGrid/ChartGrid.d.mts +10 -0
- package/es/dashboard/ChartGrid/ChartGrid.mjs +19 -0
- package/es/dashboard/ChartGrid/ChartGrid.mjs.map +1 -0
- package/es/dashboard/ChartGrid/index.d.mts +3 -0
- package/es/dashboard/ChartGrid/style.mjs +18 -0
- package/es/dashboard/ChartGrid/style.mjs.map +1 -0
- package/es/dashboard/ChartGrid/type.d.mts +8 -0
- package/es/dashboard/ConsoleNav/Skeleton.d.mts +15 -0
- package/es/dashboard/ConsoleNav/Skeleton.mjs +82 -0
- package/es/dashboard/ConsoleNav/Skeleton.mjs.map +1 -0
- package/es/dashboard/ConsoleNav/index.d.mts +3 -2
- package/es/dashboard/ConsoleNav/style.mjs +18 -0
- package/es/dashboard/ConsoleNav/style.mjs.map +1 -1
- package/es/dashboard/ConsoleNav/type.d.mts +13 -0
- package/es/dashboard/ConsoleShell/ConsoleShell.d.mts +1 -1
- package/es/dashboard/ConsoleShell/ConsoleShell.mjs +26 -6
- package/es/dashboard/ConsoleShell/ConsoleShell.mjs.map +1 -1
- package/es/dashboard/ConsoleShell/style.mjs +10 -0
- package/es/dashboard/ConsoleShell/style.mjs.map +1 -1
- package/es/dashboard/ConsoleShell/type.d.mts +11 -0
- package/es/dashboard/FilterSidebar/FilterSidebar.mjs +18 -17
- package/es/dashboard/FilterSidebar/FilterSidebar.mjs.map +1 -1
- package/es/dashboard/FilterStrip/FilterStrip.d.mts +11 -0
- package/es/dashboard/FilterStrip/FilterStrip.mjs +55 -0
- package/es/dashboard/FilterStrip/FilterStrip.mjs.map +1 -0
- package/es/dashboard/FilterStrip/index.d.mts +3 -0
- package/es/dashboard/FilterStrip/style.mjs +78 -0
- package/es/dashboard/FilterStrip/style.mjs.map +1 -0
- package/es/dashboard/FilterStrip/type.d.mts +25 -0
- package/es/dashboard/LabelWithKey/LabelWithKey.d.mts +10 -0
- package/es/dashboard/LabelWithKey/LabelWithKey.mjs +18 -0
- package/es/dashboard/LabelWithKey/LabelWithKey.mjs.map +1 -0
- package/es/dashboard/LabelWithKey/index.d.mts +3 -0
- package/es/dashboard/LabelWithKey/type.d.mts +11 -0
- package/es/dashboard/MetricStrip/MetricCell.mjs +81 -0
- package/es/dashboard/MetricStrip/MetricCell.mjs.map +1 -0
- package/es/dashboard/MetricStrip/MetricStrip.d.mts +13 -0
- package/es/dashboard/MetricStrip/MetricStrip.mjs +47 -0
- package/es/dashboard/MetricStrip/MetricStrip.mjs.map +1 -0
- package/es/dashboard/MetricStrip/index.d.mts +3 -0
- package/es/dashboard/MetricStrip/style.mjs +156 -0
- package/es/dashboard/MetricStrip/style.mjs.map +1 -0
- package/es/dashboard/MetricStrip/type.d.mts +36 -0
- package/es/dashboard/PageSkeleton/PageSkeleton.mjs +20 -18
- package/es/dashboard/PageSkeleton/PageSkeleton.mjs.map +1 -1
- package/es/dashboard/PageSkeleton/style.mjs +1 -1
- package/es/dashboard/PageSkeleton/style.mjs.map +1 -1
- package/es/dashboard/PageToolbar/PageToolbar.d.mts +10 -0
- package/es/dashboard/PageToolbar/PageToolbar.mjs +22 -0
- package/es/dashboard/PageToolbar/PageToolbar.mjs.map +1 -0
- package/es/dashboard/PageToolbar/index.d.mts +3 -0
- package/es/dashboard/PageToolbar/style.mjs +36 -0
- package/es/dashboard/PageToolbar/style.mjs.map +1 -0
- package/es/dashboard/PageToolbar/type.d.mts +11 -0
- package/es/dashboard/PanelSurface/PanelSurface.d.mts +10 -0
- package/es/dashboard/PanelSurface/PanelSurface.mjs +40 -0
- package/es/dashboard/PanelSurface/PanelSurface.mjs.map +1 -0
- package/es/dashboard/PanelSurface/index.d.mts +3 -0
- package/es/dashboard/PanelSurface/style.mjs +25 -0
- package/es/dashboard/PanelSurface/style.mjs.map +1 -0
- package/es/dashboard/PanelSurface/type.d.mts +17 -0
- package/es/dashboard/Section/Section.d.mts +10 -0
- package/es/dashboard/Section/Section.mjs +81 -0
- package/es/dashboard/Section/Section.mjs.map +1 -0
- package/es/dashboard/Section/index.d.mts +3 -0
- package/es/dashboard/Section/style.mjs +31 -0
- package/es/dashboard/Section/style.mjs.map +1 -0
- package/es/dashboard/Section/type.d.mts +23 -0
- package/es/dashboard/StatCard/StatCard.d.mts +2 -1
- package/es/dashboard/StatCard/StatCard.mjs +28 -91
- package/es/dashboard/StatCard/StatCard.mjs.map +1 -1
- package/es/dashboard/StatCard/type.d.mts +16 -5
- package/es/dashboard/Surface/Surface.d.mts +4 -3
- package/es/dashboard/Surface/Surface.mjs +91 -8
- package/es/dashboard/Surface/Surface.mjs.map +1 -1
- package/es/dashboard/Surface/index.d.mts +3 -2
- package/es/dashboard/Surface/link.d.mts +16 -0
- package/es/dashboard/Surface/link.mjs +40 -0
- package/es/dashboard/Surface/link.mjs.map +1 -0
- package/es/dashboard/Surface/marker.stylex.mjs +9 -0
- package/es/dashboard/Surface/marker.stylex.mjs.map +1 -0
- package/es/dashboard/Surface/style.d.mts +2 -0
- package/es/dashboard/Surface/style.mjs +155 -14
- package/es/dashboard/Surface/style.mjs.map +1 -1
- package/es/dashboard/Surface/type.d.mts +29 -1
- package/es/dashboard/TableIconActions/TableIconActions.d.mts +17 -0
- package/es/dashboard/TableIconActions/TableIconActions.mjs +39 -0
- package/es/dashboard/TableIconActions/TableIconActions.mjs.map +1 -0
- package/es/dashboard/TableIconActions/index.d.mts +3 -0
- package/es/dashboard/TableIconActions/type.d.mts +17 -0
- package/es/dashboard/TitleWithTips/TitleWithTips.d.mts +10 -0
- package/es/dashboard/TitleWithTips/TitleWithTips.mjs +28 -0
- package/es/dashboard/TitleWithTips/TitleWithTips.mjs.map +1 -0
- package/es/dashboard/TitleWithTips/index.d.mts +3 -0
- package/es/dashboard/TitleWithTips/type.d.mts +10 -0
- package/es/dashboard/index.d.mts +38 -4
- package/es/dashboard/index.mjs +17 -3
- package/es/hooks/useControlledState.mjs +20 -0
- package/es/hooks/useControlledState.mjs.map +1 -0
- package/es/hooks/useHighlight.mjs +2 -2
- package/es/hooks/useHighlight.mjs.map +1 -1
- package/es/hooks/useHover.mjs +22 -0
- package/es/hooks/useHover.mjs.map +1 -0
- package/es/hooks/useScroll.d.mts +8 -0
- package/es/hooks/useScroll.mjs +33 -0
- package/es/hooks/useScroll.mjs.map +1 -0
- package/es/hooks/useSize.mjs +26 -0
- package/es/hooks/useSize.mjs.map +1 -0
- package/es/internal/virtual/VirtualScrollArea.mjs +1 -1
- package/es/internal/virtual/VirtualScrollArea.mjs.map +1 -1
- package/es/mobile/ChatInputArea/ChatInputArea.mjs +1 -1
- package/es/mobile/ChatInputArea/ChatInputArea.mjs.map +1 -1
- package/es/mobile/TabBar/TabBar.mjs +1 -1
- package/es/mobile/TabBar/TabBar.mjs.map +1 -1
- package/es/node_modules/.pnpm/@eslint_core@1.2.1/node_modules/@eslint/core/dist/esm/types.d.mts +2 -46
- package/es/node_modules/.pnpm/@eslint_plugin-kit@0.7.3/node_modules/@eslint/plugin-kit/dist/cjs/index.d.mts +1 -1
- package/es/node_modules/.pnpm/@types_estree@1.0.9/node_modules/@types/estree/index.d.mts +1 -4
- package/es/node_modules/.pnpm/eslint@10.12.0_jiti@2.6.1_supports-color@10.2.2/node_modules/eslint/lib/types/index.d.mts +1 -1
- package/es/style.css +339 -32
- package/es/styles/theme/token/neutral.mjs +5 -5
- package/es/styles/theme/token/neutral.mjs.map +1 -1
- package/es/utils/colorMath.mjs +52 -0
- package/es/utils/colorMath.mjs.map +1 -0
- package/es/utils/formatNumber.mjs +7 -0
- package/es/utils/formatNumber.mjs.map +1 -0
- package/es/utils/genCdnUrl.mjs +6 -3
- package/es/utils/genCdnUrl.mjs.map +1 -1
- package/es/utils/hashString.mjs +19 -0
- package/es/utils/hashString.mjs.map +1 -0
- package/es/utils/mergeRefs.mjs +20 -0
- package/es/utils/mergeRefs.mjs.map +1 -0
- package/es/utils/placement.d.mts +5 -5
- package/es/utils/placement.mjs.map +1 -1
- package/package.json +16 -42
- package/es/dashboard/StatCard/style.mjs +0 -105
- package/es/dashboard/StatCard/style.mjs.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import FlexBasic_default from "../../Flex/FlexBasic.mjs";
|
|
3
|
+
import { withAlpha } from "../../utils/colorMath.mjs";
|
|
3
4
|
import { useTheme } from "../../styles/theme/scope.mjs";
|
|
4
5
|
import GridBackground from "./GridBackground.mjs";
|
|
5
6
|
import { memo } from "react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { rgba } from "polished";
|
|
8
8
|
//#region src/awesome/GridBackground/GridShowcase.tsx
|
|
9
9
|
const GridShowcase = memo(({ style, children, backgroundColor = "#001dff", innerProps, ...rest }) => {
|
|
10
10
|
const theme = useTheme();
|
|
@@ -18,8 +18,8 @@ const GridShowcase = memo(({ style, children, backgroundColor = "#001dff", inner
|
|
|
18
18
|
/* @__PURE__ */ jsx(GridBackground, {
|
|
19
19
|
animation: true,
|
|
20
20
|
flip: true,
|
|
21
|
-
colorBack:
|
|
22
|
-
colorFront:
|
|
21
|
+
colorBack: withAlpha(theme.colorText, .12),
|
|
22
|
+
colorFront: withAlpha(theme.colorText, .6)
|
|
23
23
|
}),
|
|
24
24
|
/* @__PURE__ */ jsx(FlexBasic_default, {
|
|
25
25
|
align: "center",
|
|
@@ -36,7 +36,7 @@ const GridShowcase = memo(({ style, children, backgroundColor = "#001dff", inner
|
|
|
36
36
|
reverse: true,
|
|
37
37
|
showBackground: true,
|
|
38
38
|
backgroundColor,
|
|
39
|
-
colorBack:
|
|
39
|
+
colorBack: withAlpha(theme.colorText, .24),
|
|
40
40
|
colorFront: theme.colorText,
|
|
41
41
|
style: { zIndex: 0 }
|
|
42
42
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridShowcase.mjs","names":["Flexbox"],"sources":["../../../src/awesome/GridBackground/GridShowcase.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"GridShowcase.mjs","names":["Flexbox"],"sources":["../../../src/awesome/GridBackground/GridShowcase.tsx"],"sourcesContent":["'use client';\n\nimport { memo } from 'react';\n\nimport { Flexbox } from '@/Flex';\nimport { useTheme } from '@/styles/theme/scope';\nimport { withAlpha } from '@/utils/colorMath';\n\nimport GridBackground from './GridBackground';\nimport type { GridShowcaseProps } from './type';\n\nconst GridShowcase = memo<GridShowcaseProps>(\n ({ style, children, backgroundColor = '#001dff', innerProps, ...rest }) => {\n const theme = useTheme();\n\n return (\n <Flexbox style={{ position: 'relative', ...style }} {...rest}>\n <GridBackground\n animation\n flip\n colorBack={withAlpha(theme.colorText, 0.12)}\n colorFront={withAlpha(theme.colorText, 0.6)}\n />\n <Flexbox align={'center'} {...innerProps} style={{ zIndex: 4, ...innerProps?.style }}>\n {children}\n </Flexbox>\n <GridBackground\n animation\n random\n reverse\n showBackground\n backgroundColor={backgroundColor}\n colorBack={withAlpha(theme.colorText, 0.24)}\n colorFront={theme.colorText}\n style={{ zIndex: 0 }}\n />\n </Flexbox>\n );\n },\n);\n\nGridShowcase.displayName = 'GridShowcase';\n\nexport default GridShowcase;\n"],"mappings":";;;;;;;;AAWA,MAAM,eAAe,MAClB,EAAE,OAAO,UAAU,kBAAkB,WAAW,YAAY,GAAG,WAAW;CACzE,MAAM,QAAQ,SAAS;CAEvB,OACE,qBAACA,mBAAD;EAAS,OAAO;GAAE,UAAU;GAAY,GAAG;EAAM;EAAG,GAAI;EAAxD,UAAA;GACE,oBAAC,gBAAD;IACE,WAAA;IACA,MAAA;IACA,WAAW,UAAU,MAAM,WAAW,GAAI;IAC1C,YAAY,UAAU,MAAM,WAAW,EAAG;GAC3C,CAAA;GACD,oBAACA,mBAAD;IAAS,OAAO;IAAU,GAAI;IAAY,OAAO;KAAE,QAAQ;KAAG,GAAG,YAAY;IAAM;IAChF;GACM,CAAA;GACT,oBAAC,gBAAD;IACE,WAAA;IACA,QAAA;IACA,SAAA;IACA,gBAAA;IACiB;IACjB,WAAW,UAAU,MAAM,WAAW,GAAI;IAC1C,YAAY,MAAM;IAClB,OAAO,EAAE,QAAQ,EAAE;GACpB,CAAA;EACM;;AAEb,CACF;AAEA,aAAa,cAAc"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { mergeRefs } from "../../utils/mergeRefs.mjs";
|
|
1
2
|
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { debounce } from "es-toolkit/compat";
|
|
4
|
-
import { mergeRefs } from "react-merge-refs";
|
|
5
5
|
//#region src/awesome/Spline/ParentSize.tsx
|
|
6
6
|
const defaultIgnoreDimensions = [];
|
|
7
7
|
const defaultParentSizeStyles = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParentSize.mjs","names":[],"sources":["../../../src/awesome/Spline/ParentSize.tsx"],"sourcesContent":["import { debounce } from 'es-toolkit/compat';\nimport {\n type CSSProperties,\n memo,\n type ReactNode,\n type Ref,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { mergeRefs } from '
|
|
1
|
+
{"version":3,"file":"ParentSize.mjs","names":[],"sources":["../../../src/awesome/Spline/ParentSize.tsx"],"sourcesContent":["import { debounce } from 'es-toolkit/compat';\nimport {\n type CSSProperties,\n memo,\n type ReactNode,\n type Ref,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { mergeRefs } from '@/utils/mergeRefs';\n\ninterface ResizeObserverCallback {\n (entries: ResizeObserverEntry[], observer: ResizeObserver): void;\n}\n\ninterface ResizeObserverPolyfill {\n new (callback: ResizeObserverCallback): ResizeObserver;\n}\n\n// @TODO remove when upgraded to TS 4 which has its own declaration\ninterface PrivateWindow {\n ResizeObserver: ResizeObserverPolyfill;\n}\n\nexport interface ParentSizeProps {\n /** Child render function `({ width, height, top, left, ref, resize }) => ReactNode`. */\n children: (\n args: {\n ref: HTMLDivElement | null;\n resize: (state: ParentSizeState) => void;\n } & ParentSizeState,\n ) => ReactNode;\n /** Optional `className` to add to the parent `div` wrapper used for size measurement. */\n className?: string;\n /** Child render updates upon resize are delayed until `debounceTime` milliseconds _after_ the last resize event is observed. */\n debounceTime?: number;\n /** Optional flag to toggle leading debounce calls. When set to true this will ensure that the component always renders immediately. (defaults to true) */\n enableDebounceLeadingCall?: boolean;\n /** Optional dimensions provided won't trigger a state change when changed. */\n ignoreDimensions?: keyof ParentSizeState | (keyof ParentSizeState)[];\n /** Optional `style` object to apply to the parent `div` wrapper used for size measurement. */\n parentSizeStyles?: CSSProperties;\n ref?: Ref<HTMLDivElement>;\n /** Optionally inject a ResizeObserver polyfill, else this *must* be globally available. */\n resizeObserverPolyfill?: ResizeObserverPolyfill;\n}\n\ntype ParentSizeState = {\n height: number;\n left: number;\n top: number;\n width: number;\n};\n\nexport type ParentSizeProvidedProps = ParentSizeState;\n\nconst defaultIgnoreDimensions: ParentSizeProps['ignoreDimensions'] = [];\nconst defaultParentSizeStyles = { height: '100%', width: '100%' };\n\nconst ParentSize = memo<ParentSizeProps>(\n ({\n ref,\n className,\n children,\n debounceTime = 300,\n ignoreDimensions = defaultIgnoreDimensions,\n parentSizeStyles,\n enableDebounceLeadingCall = true,\n resizeObserverPolyfill,\n ...restProps\n }) => {\n const target = useRef<HTMLDivElement | null>(null);\n const animationFrameID = useRef(0);\n\n const [state, setState] = useState<ParentSizeState>({\n height: 0,\n left: 0,\n top: 0,\n width: 0,\n });\n\n const resize = useMemo(() => {\n const normalized = Array.isArray(ignoreDimensions) ? ignoreDimensions : [ignoreDimensions];\n\n return debounce(\n (incoming: ParentSizeState) => {\n setState((existing) => {\n const stateKeys = Object.keys(existing) as (keyof ParentSizeState)[];\n const keysWithChanges = stateKeys.filter((key) => existing[key] !== incoming[key]);\n const shouldBail = keysWithChanges.every((key) => normalized.includes(key));\n\n return shouldBail ? existing : incoming;\n });\n },\n debounceTime,\n { leading: enableDebounceLeadingCall },\n );\n }, [debounceTime, enableDebounceLeadingCall, ignoreDimensions]);\n\n useEffect(() => {\n const LocalResizeObserver =\n resizeObserverPolyfill || (window as unknown as PrivateWindow).ResizeObserver;\n\n const observer = new LocalResizeObserver((entries) => {\n for (const entry of entries) {\n const { left, top, width, height } = entry?.contentRect ?? {};\n animationFrameID.current = window.requestAnimationFrame(() => {\n resize({ height, left, top, width });\n });\n }\n });\n if (target.current) observer.observe(target.current);\n\n return () => {\n window.cancelAnimationFrame(animationFrameID.current);\n observer.disconnect();\n resize.cancel();\n };\n }, [resize, resizeObserverPolyfill]);\n\n return (\n <div\n className={className}\n ref={mergeRefs<HTMLDivElement>([ref, target])}\n style={{ ...defaultParentSizeStyles, ...parentSizeStyles }}\n {...restProps}\n >\n {children({\n ...state,\n ref: target.current,\n resize,\n })}\n </div>\n );\n },\n);\n\nexport default ParentSize;\n"],"mappings":";;;;;AA2DA,MAAM,0BAA+D,CAAC;AACtE,MAAM,0BAA0B;CAAE,QAAQ;CAAQ,OAAO;AAAO;AAEhE,MAAM,aAAa,MAChB,EACC,KACA,WACA,UACA,eAAe,KACf,mBAAmB,yBACnB,kBACA,4BAA4B,MAC5B,wBACA,GAAG,gBACC;CACJ,MAAM,SAAS,OAA8B,IAAI;CACjD,MAAM,mBAAmB,OAAO,CAAC;CAEjC,MAAM,CAAC,OAAO,YAAY,SAA0B;EAClD,QAAQ;EACR,MAAM;EACN,KAAK;EACL,OAAO;CACT,CAAC;CAED,MAAM,SAAS,cAAc;EAC3B,MAAM,aAAa,MAAM,QAAQ,gBAAgB,IAAI,mBAAmB,CAAC,gBAAgB;EAEzF,OAAO,UACJ,aAA8B;GAC7B,UAAU,aAAa;IAKrB,OAJkB,OAAO,KAAK,QACE,CAAC,CAAC,QAAQ,QAAQ,SAAS,SAAS,SAAS,IAC5C,CAAC,CAAC,OAAO,QAAQ,WAAW,SAAS,GAAG,CAEzD,IAAI,WAAW;GACjC,CAAC;EACH,GACA,cACA,EAAE,SAAS,0BAA0B,CACvC;CACF,GAAG;EAAC;EAAc;EAA2B;CAAgB,CAAC;CAE9D,gBAAgB;EAId,MAAM,WAAW,KAFf,0BAA2B,OAAoC,iBAEvB,YAAY;GACpD,KAAK,MAAM,SAAS,SAAS;IAC3B,MAAM,EAAE,MAAM,KAAK,OAAO,WAAW,OAAO,eAAe,CAAC;IAC5D,iBAAiB,UAAU,OAAO,4BAA4B;KAC5D,OAAO;MAAE;MAAQ;MAAM;MAAK;KAAM,CAAC;IACrC,CAAC;GACH;EACF,CAAC;EACD,IAAI,OAAO,SAAS,SAAS,QAAQ,OAAO,OAAO;EAEnD,aAAa;GACX,OAAO,qBAAqB,iBAAiB,OAAO;GACpD,SAAS,WAAW;GACpB,OAAO,OAAO;EAChB;CACF,GAAG,CAAC,QAAQ,sBAAsB,CAAC;CAEnC,OACE,oBAAC,OAAD;EACa;EACX,KAAK,UAA0B,CAAC,KAAK,MAAM,CAAC;EAC5C,OAAO;GAAE,GAAG;GAAyB,GAAG;EAAiB;EACzD,GAAI;EAEH,UAAA,SAAS;GACR,GAAG;GACH,KAAK,OAAO;GACZ;EACF,CAAC;CACE,CAAA;AAET,CACF"}
|
package/es/awesome/index.d.mts
CHANGED
|
@@ -35,6 +35,9 @@ import "./Giscus/index.mjs";
|
|
|
35
35
|
import { GradientButtonProps } from "./GradientButton/type.mjs";
|
|
36
36
|
import GradientButton from "./GradientButton/GradientButton.mjs";
|
|
37
37
|
import "./GradientButton/index.mjs";
|
|
38
|
+
import { GrainientProps } from "./Grainient/type.mjs";
|
|
39
|
+
import Grainient from "./Grainient/Grainient.mjs";
|
|
40
|
+
import "./Grainient/index.mjs";
|
|
38
41
|
import { GridBackgroundProps, GridShowcaseProps } from "./GridBackground/type.mjs";
|
|
39
42
|
import GridBackground from "./GridBackground/GridBackground.mjs";
|
|
40
43
|
import GridShowcase from "./GridBackground/GridShowcase.mjs";
|
|
@@ -64,4 +67,4 @@ import "./Spotlight/index.mjs";
|
|
|
64
67
|
import { CursorStyle, SegmentMode, TypewriterEffectProps } from "./TypewriterEffect/type.mjs";
|
|
65
68
|
import TypewriterEffect from "./TypewriterEffect/TypewriterEffect.mjs";
|
|
66
69
|
import "./TypewriterEffect/index.mjs";
|
|
67
|
-
export { AgentSkillCard, type AgentSkillCardAgent, type AgentSkillCardMode, type AgentSkillCardPanel, type AgentSkillCardProps, AuroraBackground, type AuroraBackgroundProps, BentoCard, type BentoCardProps, BentoGrid, type BentoGridProps, BottomGradientButton, type BottomGradientButtonProps, CodeShowcase, type CodeShowcaseItem, type CodeShowcaseProps, type CursorStyle, DEFAULT_SKILL_AGENTS, FeatureGrid, type FeatureGridItem, type FeatureGridProps, type FeatureItemType, Features, type FeaturesProps, FluidGradient, type FluidGradientProps, Giscus, type GiscusProps, GradientButton, type GradientButtonProps, GridBackground, type GridBackgroundProps, GridShowcase, type GridShowcaseProps, Hero, type HeroAction, type HeroProps, InstallBanner, type InstallBannerProps, LANDING_GRADIENT_VAR, LANDING_PALETTE_DARK, LANDING_PALETTE_LIGHT, type LandingAction, LandingHero, type LandingHeroAction, type LandingHeroProps, type LandingLinkProps, type LandingLinkRender, type LandingNavigate, type LandingPalette, LandingSection, type LandingSectionProps, LogoMarquee, type LogoMarqueeItem, type LogoMarqueeProps, type SegmentMode, Spline, type SplineProps, Spotlight, SpotlightCard, type SpotlightCardProps, type SpotlightProps, TypewriterEffect, type TypewriterEffectProps, accentGradient as landingAccentGradient };
|
|
70
|
+
export { AgentSkillCard, type AgentSkillCardAgent, type AgentSkillCardMode, type AgentSkillCardPanel, type AgentSkillCardProps, AuroraBackground, type AuroraBackgroundProps, BentoCard, type BentoCardProps, BentoGrid, type BentoGridProps, BottomGradientButton, type BottomGradientButtonProps, CodeShowcase, type CodeShowcaseItem, type CodeShowcaseProps, type CursorStyle, DEFAULT_SKILL_AGENTS, FeatureGrid, type FeatureGridItem, type FeatureGridProps, type FeatureItemType, Features, type FeaturesProps, FluidGradient, type FluidGradientProps, Giscus, type GiscusProps, GradientButton, type GradientButtonProps, Grainient, type GrainientProps, GridBackground, type GridBackgroundProps, GridShowcase, type GridShowcaseProps, Hero, type HeroAction, type HeroProps, InstallBanner, type InstallBannerProps, LANDING_GRADIENT_VAR, LANDING_PALETTE_DARK, LANDING_PALETTE_LIGHT, type LandingAction, LandingHero, type LandingHeroAction, type LandingHeroProps, type LandingLinkProps, type LandingLinkRender, type LandingNavigate, type LandingPalette, LandingSection, type LandingSectionProps, LogoMarquee, type LogoMarqueeItem, type LogoMarqueeProps, type SegmentMode, Spline, type SplineProps, Spotlight, SpotlightCard, type SpotlightCardProps, type SpotlightProps, TypewriterEffect, type TypewriterEffectProps, accentGradient as landingAccentGradient };
|
package/es/awesome/index.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import { LANDING_GRADIENT_VAR, LANDING_PALETTE_DARK, LANDING_PALETTE_LIGHT, acce
|
|
|
13
13
|
import FluidGradient from "./FluidGradient/FluidGradient.mjs";
|
|
14
14
|
import Giscus from "./Giscus/Giscus.mjs";
|
|
15
15
|
import GradientButton from "./GradientButton/GradientButton.mjs";
|
|
16
|
+
import Grainient from "./Grainient/Grainient.mjs";
|
|
16
17
|
import GridBackground from "./GridBackground/GridBackground.mjs";
|
|
17
18
|
import GridShowcase from "./GridBackground/GridShowcase.mjs";
|
|
18
19
|
import Hero from "./Hero/Hero.mjs";
|
|
@@ -22,4 +23,4 @@ import LandingSection from "./LandingSection/LandingSection.mjs";
|
|
|
22
23
|
import LogoMarquee from "./LogoMarquee/LogoMarquee.mjs";
|
|
23
24
|
import Spline from "./Spline/Spine.mjs";
|
|
24
25
|
import TypewriterEffect from "./TypewriterEffect/TypewriterEffect.mjs";
|
|
25
|
-
export { AgentSkillCard, AuroraBackground, BentoCard, BentoGrid, BottomGradientButton, CodeShowcase, DEFAULT_SKILL_AGENTS, FeatureGrid, Features, FluidGradient, Giscus, GradientButton, GridBackground, GridShowcase, Hero, InstallBanner, LANDING_GRADIENT_VAR, LANDING_PALETTE_DARK, LANDING_PALETTE_LIGHT, LandingHero, LandingSection, LogoMarquee, Spline, Spotlight, SpotlightCard, TypewriterEffect, accentGradient as landingAccentGradient };
|
|
26
|
+
export { AgentSkillCard, AuroraBackground, BentoCard, BentoGrid, BottomGradientButton, CodeShowcase, DEFAULT_SKILL_AGENTS, FeatureGrid, Features, FluidGradient, Giscus, GradientButton, Grainient, GridBackground, GridShowcase, Hero, InstallBanner, LANDING_GRADIENT_VAR, LANDING_PALETTE_DARK, LANDING_PALETTE_LIGHT, LandingHero, LandingSection, LogoMarquee, Spline, Spotlight, SpotlightCard, TypewriterEffect, accentGradient as landingAccentGradient };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ButtonImpl } from "../../Button/Button.mjs";
|
|
3
|
+
import { useScroll } from "../../hooks/useScroll.mjs";
|
|
3
4
|
import { styles } from "./style.mjs";
|
|
4
5
|
import { memo, useEffect, useRef, useState } from "react";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
import { ListEnd } from "lucide-react";
|
|
7
|
-
import { useScroll } from "ahooks";
|
|
8
8
|
//#region src/chat/BackBottom/BackBottom.tsx
|
|
9
9
|
const BackBottom = memo(({ visibilityHeight = 240, target, onClick, style, className, text }) => {
|
|
10
10
|
const [visible, setVisible] = useState(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackBottom.mjs","names":[],"sources":["../../../src/chat/BackBottom/BackBottom.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"BackBottom.mjs","names":[],"sources":["../../../src/chat/BackBottom/BackBottom.tsx"],"sourcesContent":["'use client';\n\nimport { ListEnd } from 'lucide-react';\nimport { memo, type MouseEventHandler, useEffect, useRef, useState } from 'react';\n\nimport { ButtonImpl } from '@/Button/Button';\nimport { useScroll } from '@/hooks/useScroll';\n\nimport { styles } from './style';\nimport { type BackBottomProps } from './type';\n\nconst BackBottom = memo<BackBottomProps>(\n ({ visibilityHeight = 240, target, onClick, style, className, text }) => {\n const [visible, setVisible] = useState<boolean>(false);\n const ref = useRef<HTMLButtonElement>(null);\n const current = (target as any)?.current;\n const scrollHeight = current?.scrollHeight || 0;\n const clientHeight = current?.clientHeight || 0;\n const scroll = useScroll(target);\n\n useEffect(() => {\n if (scroll?.top) {\n setVisible(scroll?.top + clientHeight + visibilityHeight < scrollHeight);\n }\n }, [scrollHeight, scroll, visibilityHeight]);\n\n const scrollToBottom: MouseEventHandler<HTMLElement> = (e) => {\n (target as any)?.current?.scrollTo({ behavior: 'smooth', left: 0, top: scrollHeight });\n onClick?.(e);\n };\n\n return (\n <ButtonImpl\n className={className}\n icon={ListEnd}\n ref={ref}\n shape={'round'}\n size={'small'}\n style={style}\n type={'fill'}\n xstyle={[styles.root, visible ? styles.visible : styles.hidden]}\n onClick={scrollToBottom}\n >\n {text || 'Back to bottom'}\n </ButtonImpl>\n );\n },\n);\n\nBackBottom.displayName = 'BackBottom';\n\nexport default BackBottom;\n"],"mappings":";;;;;;;;AAWA,MAAM,aAAa,MAChB,EAAE,mBAAmB,KAAK,QAAQ,SAAS,OAAO,WAAW,WAAW;CACvE,MAAM,CAAC,SAAS,cAAc,SAAkB,KAAK;CACrD,MAAM,MAAM,OAA0B,IAAI;CAC1C,MAAM,UAAW,QAAgB;CACjC,MAAM,eAAe,SAAS,gBAAgB;CAC9C,MAAM,eAAe,SAAS,gBAAgB;CAC9C,MAAM,SAAS,UAAU,MAAM;CAE/B,gBAAgB;EACd,IAAI,QAAQ,KACV,WAAW,QAAQ,MAAM,eAAe,mBAAmB,YAAY;CAE3E,GAAG;EAAC;EAAc;EAAQ;CAAgB,CAAC;CAE3C,MAAM,kBAAkD,MAAM;EAC5D,QAAiB,SAAS,SAAS;GAAE,UAAU;GAAU,MAAM;GAAG,KAAK;EAAa,CAAC;EACrF,UAAU,CAAC;CACb;CAEA,OACE,oBAAC,YAAD;EACa;EACX,MAAM;EACD;EACL,OAAO;EACP,MAAM;EACC;EACP,MAAM;EACN,QAAQ,CAAC,OAAO,MAAM,UAAU,OAAO,UAAU,OAAO,MAAM;EAC9D,SAAS;EAER,UAAA,QAAQ;CACC,CAAA;AAEhB,CACF;AAEA,WAAW,cAAc"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { ScrollTarget } from "../../hooks/useScroll.mjs";
|
|
1
2
|
import { CSSProperties, MouseEventHandler } from "react";
|
|
2
|
-
import { Target } from "ahooks/lib/useScroll/index.js";
|
|
3
3
|
//#region src/chat/BackBottom/type.d.ts
|
|
4
4
|
export interface BackBottomProps {
|
|
5
5
|
className?: string;
|
|
6
6
|
onClick?: MouseEventHandler<HTMLElement>;
|
|
7
7
|
style?: CSSProperties;
|
|
8
|
-
target:
|
|
8
|
+
target: ScrollTarget;
|
|
9
9
|
text?: string;
|
|
10
10
|
visibilityHeight?: number;
|
|
11
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useControlledState } from "../../hooks/useControlledState.mjs";
|
|
2
3
|
import Markdown from "../../Markdown/Markdown.mjs";
|
|
3
4
|
import MessageInput from "../MessageInput/MessageInput.mjs";
|
|
4
5
|
import MessageModal from "../MessageModal/MessageModal.mjs";
|
|
5
6
|
import { memo } from "react";
|
|
6
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import clsx from "clsx";
|
|
8
|
-
import useControlledState from "use-merge-value";
|
|
9
9
|
//#region src/chat/EditableMessage/EditableMessage.tsx
|
|
10
10
|
const EditableMessage = memo(({ value, onChange, classNames = {}, onEditingChange, editing, openModal, onOpenChange, placeholder, showEditWhenEmpty = false, styles: customStyles, className, style, height, variant, editButtonSize, text, fullFeaturedCodeBlock, model, fontSize, language = "markdown", markdownProps }) => {
|
|
11
11
|
const [isEdit, setTyping] = useControlledState(false, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableMessage.mjs","names":[],"sources":["../../../src/chat/EditableMessage/EditableMessage.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { memo } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"EditableMessage.mjs","names":[],"sources":["../../../src/chat/EditableMessage/EditableMessage.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { memo } from 'react';\n\nimport MessageInput from '@/chat/MessageInput';\nimport MessageModal from '@/chat/MessageModal';\nimport { useControlledState } from '@/hooks/useControlledState';\nimport Markdown from '@/Markdown';\n\nimport { type EditableMessageProps } from './type';\n\nconst EditableMessage = memo<EditableMessageProps>(\n ({\n value,\n onChange,\n classNames = {},\n onEditingChange,\n editing,\n openModal,\n onOpenChange,\n placeholder,\n showEditWhenEmpty = false,\n styles: customStyles,\n className,\n style,\n height,\n variant,\n editButtonSize,\n text,\n fullFeaturedCodeBlock,\n model,\n fontSize,\n language = 'markdown',\n markdownProps,\n }) => {\n const [isEdit, setTyping] = useControlledState(false, {\n onChange: onEditingChange,\n value: editing,\n });\n\n const [expand, setExpand] = useControlledState<boolean>(false, {\n onChange: onOpenChange,\n value: openModal,\n });\n\n const isAutoSize = height === 'auto';\n\n const input = (\n <MessageInput\n shortcut\n className={clsx(className, classNames?.input)}\n classNames={classNames}\n defaultValue={value}\n editButtonSize={editButtonSize}\n height={height}\n language={language}\n placeholder={placeholder}\n styles={customStyles}\n text={text}\n variant={variant}\n style={{\n ...style,\n ...customStyles?.input,\n }}\n onCancel={() => setTyping(false)}\n onConfirm={(text) => {\n onChange?.(text);\n setTyping(false);\n }}\n />\n );\n\n if (!value && showEditWhenEmpty) return input;\n\n return (\n <>\n {!expand && isEdit ? (\n input\n ) : (\n <Markdown\n className={clsx(className, classNames?.markdown)}\n fontSize={fontSize}\n fullFeaturedCodeBlock={fullFeaturedCodeBlock}\n variant={'chat'}\n style={{\n height: isAutoSize ? 'unset' : height,\n ...style,\n ...customStyles?.markdown,\n }}\n {...markdownProps}\n >\n {value || placeholder || ''}\n </Markdown>\n )}\n {expand && (\n <MessageModal\n editing={isEdit}\n extra={model?.extra}\n footer={model?.footer}\n height={height}\n language={language}\n open={expand}\n placeholder={placeholder}\n text={text}\n value={value}\n onChange={onChange}\n onEditingChange={setTyping}\n onOpenChange={(e) => {\n setExpand(e);\n setTyping(false);\n }}\n />\n )}\n </>\n );\n },\n);\n\nEditableMessage.displayName = 'EditableMessage';\n\nexport default EditableMessage;\n"],"mappings":";;;;;;;;;AAYA,MAAM,kBAAkB,MACrB,EACC,OACA,UACA,aAAa,CAAC,GACd,iBACA,SACA,WACA,cACA,aACA,oBAAoB,OACpB,QAAQ,cACR,WACA,OACA,QACA,SACA,gBACA,MACA,uBACA,OACA,UACA,WAAW,YACX,oBACI;CACJ,MAAM,CAAC,QAAQ,aAAa,mBAAmB,OAAO;EACpD,UAAU;EACV,OAAO;CACT,CAAC;CAED,MAAM,CAAC,QAAQ,aAAa,mBAA4B,OAAO;EAC7D,UAAU;EACV,OAAO;CACT,CAAC;CAED,MAAM,aAAa,WAAW;CAE9B,MAAM,QACJ,oBAAC,cAAD;EACE,UAAA;EACA,WAAW,KAAK,WAAW,YAAY,KAAK;EAChC;EACZ,cAAc;EACE;EACR;EACE;EACG;EACb,QAAQ;EACF;EACG;EACT,OAAO;GACL,GAAG;GACH,GAAG,cAAc;EACnB;EACA,gBAAgB,UAAU,KAAK;EAC/B,YAAY,SAAS;GACnB,WAAW,IAAI;GACf,UAAU,KAAK;EACjB;CACD,CAAA;CAGH,IAAI,CAAC,SAAS,mBAAmB,OAAO;CAExC,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,CAAC,UAAU,SACV,QAEA,oBAAC,UAAD;EACE,WAAW,KAAK,WAAW,YAAY,QAAQ;EACrC;EACa;EACvB,SAAS;EACT,OAAO;GACL,QAAQ,aAAa,UAAU;GAC/B,GAAG;GACH,GAAG,cAAc;EACnB;EACA,GAAI;EAEH,UAAA,SAAS,eAAe;CACjB,CAAA,GAEX,UACC,oBAAC,cAAD;EACE,SAAS;EACT,OAAO,OAAO;EACd,QAAQ,OAAO;EACP;EACE;EACV,MAAM;EACO;EACP;EACC;EACG;EACV,iBAAiB;EACjB,eAAe,MAAM;GACnB,UAAU,CAAC;GACX,UAAU,KAAK;EACjB;CACD,CAAA,CAEH,EAAA,CAAA;AAEN,CACF;AAEA,gBAAgB,cAAc"}
|
|
@@ -10,7 +10,7 @@ import { messagesReducer } from "./messageReducer.mjs";
|
|
|
10
10
|
import { memo, useEffect, useReducer } from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { Plus, Trash } from "lucide-react";
|
|
13
|
-
import isEqual from "
|
|
13
|
+
import { isEqual } from "es-toolkit/compat";
|
|
14
14
|
//#region src/chat/EditableMessageList/EditableMessageList.tsx
|
|
15
15
|
const EditableMessageList = memo(({ disabled, dataSources, onChange, texts }) => {
|
|
16
16
|
const [chatMessages, dispatch] = useReducer(messagesReducer, dataSources);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableMessageList.mjs","names":["editableMessageMessages","Flexbox"],"sources":["../../../src/chat/EditableMessageList/EditableMessageList.tsx"],"sourcesContent":["'use client';\n\nimport isEqual from '
|
|
1
|
+
{"version":3,"file":"EditableMessageList.mjs","names":["editableMessageMessages","Flexbox"],"sources":["../../../src/chat/EditableMessageList/EditableMessageList.tsx"],"sourcesContent":["'use client';\n\nimport { isEqual } from 'es-toolkit/compat';\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 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,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;EAhCF,GAAA,GAAG,MAAM,GAAG,KAAK,SAgCf,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,39 +1,46 @@
|
|
|
1
|
-
import { produce } from "immer";
|
|
2
1
|
//#region src/chat/EditableMessageList/messageReducer.ts
|
|
3
2
|
const messagesReducer = (state, payload) => {
|
|
4
3
|
switch (payload.type) {
|
|
5
4
|
case "addMessage": return [...state, payload.message];
|
|
6
|
-
case "insertMessage": return
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
case "insertMessage": return [
|
|
6
|
+
...state.slice(0, payload.index),
|
|
7
|
+
payload.message,
|
|
8
|
+
...state.slice(payload.index)
|
|
9
|
+
];
|
|
9
10
|
case "deleteMessage": return state.filter((_, index) => index !== payload.index);
|
|
10
11
|
case "resetMessages": return [];
|
|
11
|
-
case "updateMessage":
|
|
12
|
+
case "updateMessage": {
|
|
12
13
|
const { index, message } = payload;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
return state.map((item, i) => i === index ? {
|
|
15
|
+
...item,
|
|
16
|
+
content: message
|
|
17
|
+
} : item);
|
|
18
|
+
}
|
|
19
|
+
case "updateMessageRole": {
|
|
16
20
|
const { index, role } = payload;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
return state.map((item, i) => i === index ? {
|
|
22
|
+
...item,
|
|
23
|
+
role
|
|
24
|
+
} : item);
|
|
25
|
+
}
|
|
26
|
+
case "addUserMessage": return [...state, {
|
|
27
|
+
content: payload.message,
|
|
28
|
+
role: "user"
|
|
29
|
+
}];
|
|
30
|
+
case "updateLatestBotMessage": {
|
|
27
31
|
const newMessage = {
|
|
28
|
-
content: responseStream.join(""),
|
|
32
|
+
content: payload.responseStream.join(""),
|
|
29
33
|
role: "assistant"
|
|
30
34
|
};
|
|
31
35
|
return [...state.slice(0, -1), newMessage];
|
|
32
|
-
}
|
|
33
|
-
case "setErrorMessage":
|
|
36
|
+
}
|
|
37
|
+
case "setErrorMessage": {
|
|
34
38
|
const { index, error } = payload;
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
return state.map((item, i) => i === index ? {
|
|
40
|
+
...item,
|
|
41
|
+
error
|
|
42
|
+
} : item);
|
|
43
|
+
}
|
|
37
44
|
default: throw new Error("暂未实现的 type,请检查 reducer");
|
|
38
45
|
}
|
|
39
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageReducer.mjs","names":[],"sources":["../../../src/chat/EditableMessageList/messageReducer.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"messageReducer.mjs","names":[],"sources":["../../../src/chat/EditableMessageList/messageReducer.ts"],"sourcesContent":["import type { ChatMessageError, LLMMessage, LLMRoleType } from '@/chat/types';\n\nexport type MessageDispatch =\n | { message: LLMMessage; type: 'addMessage' }\n | { index: number; message: LLMMessage; type: 'insertMessage' }\n | { index: number; type: 'deleteMessage' }\n | { type: 'resetMessages' }\n | { index: number; message: string; type: 'updateMessage' }\n | { index: number; role: LLMRoleType; type: 'updateMessageRole' }\n //\n | { message: string; type: 'addUserMessage' }\n | { responseStream: string[]; type: 'updateLatestBotMessage' }\n | { index: number; message: string; type: 'updateMessageChoice' }\n | {\n error: ChatMessageError | undefined;\n index: number;\n type: 'setErrorMessage';\n };\n\nexport const messagesReducer = (state: LLMMessage[], payload: MessageDispatch): LLMMessage[] => {\n switch (payload.type) {\n case 'addMessage': {\n return [...state, payload.message];\n }\n\n case 'insertMessage': {\n return [...state.slice(0, payload.index), payload.message, ...state.slice(payload.index)];\n }\n\n case 'deleteMessage': {\n return state.filter((_, index) => index !== payload.index);\n }\n case 'resetMessages': {\n return [];\n }\n\n case 'updateMessage': {\n const { index, message } = payload;\n return state.map((item, i) => (i === index ? { ...item, content: message } : item));\n }\n case 'updateMessageRole': {\n const { index, role } = payload;\n return state.map((item, i) => (i === index ? { ...item, role } : item));\n }\n\n case 'addUserMessage': {\n return [...state, { content: payload.message, role: 'user' }];\n }\n\n case 'updateLatestBotMessage': {\n const newMessage: LLMMessage = {\n content: payload.responseStream.join(''),\n role: 'assistant',\n };\n return [...state.slice(0, -1), newMessage];\n }\n\n case 'setErrorMessage': {\n const { index, error } = payload;\n return state.map((item, i) => (i === index ? ({ ...item, error } as LLMMessage) : item));\n }\n\n default: {\n throw new Error('暂未实现的 type,请检查 reducer');\n }\n }\n};\n"],"mappings":";AAmBA,MAAa,mBAAmB,OAAqB,YAA2C;CAC9F,QAAQ,QAAQ,MAAhB;EACE,KAAK,cACH,OAAO,CAAC,GAAG,OAAO,QAAQ,OAAO;EAGnC,KAAK,iBACH,OAAO;GAAC,GAAG,MAAM,MAAM,GAAG,QAAQ,KAAK;GAAG,QAAQ;GAAS,GAAG,MAAM,MAAM,QAAQ,KAAK;EAAC;EAG1F,KAAK,iBACH,OAAO,MAAM,QAAQ,GAAG,UAAU,UAAU,QAAQ,KAAK;EAE3D,KAAK,iBACH,OAAO,CAAC;EAGV,KAAK,iBAAiB;GACpB,MAAM,EAAE,OAAO,YAAY;GAC3B,OAAO,MAAM,KAAK,MAAM,MAAO,MAAM,QAAQ;IAAE,GAAG;IAAM,SAAS;GAAQ,IAAI,IAAK;EACpF;EACA,KAAK,qBAAqB;GACxB,MAAM,EAAE,OAAO,SAAS;GACxB,OAAO,MAAM,KAAK,MAAM,MAAO,MAAM,QAAQ;IAAE,GAAG;IAAM;GAAK,IAAI,IAAK;EACxE;EAEA,KAAK,kBACH,OAAO,CAAC,GAAG,OAAO;GAAE,SAAS,QAAQ;GAAS,MAAM;EAAO,CAAC;EAG9D,KAAK,0BAA0B;GAC7B,MAAM,aAAyB;IAC7B,SAAS,QAAQ,eAAe,KAAK,EAAE;IACvC,MAAM;GACR;GACA,OAAO,CAAC,GAAG,MAAM,MAAM,GAAG,EAAE,GAAG,UAAU;EAC3C;EAEA,KAAK,mBAAmB;GACtB,MAAM,EAAE,OAAO,UAAU;GACzB,OAAO,MAAM,KAAK,MAAM,MAAO,MAAM,QAAS;IAAE,GAAG;IAAM;GAAM,IAAmB,IAAK;EACzF;EAEA,SACE,MAAM,IAAI,MAAM,wBAAwB;CAE5C;AACF"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import Button from "../../Button/Button.mjs";
|
|
3
3
|
import FlexBasic_default from "../../Flex/FlexBasic.mjs";
|
|
4
4
|
import { useResponsive } from "../../styles/theme/scope.mjs";
|
|
5
|
+
import { useControlledState } from "../../hooks/useControlledState.mjs";
|
|
5
6
|
import { useTranslation } from "../../i18n/useTranslation.mjs";
|
|
6
7
|
import TextArea_default from "../../Input/TextArea.mjs";
|
|
7
8
|
import CodeEditor from "../../CodeEditor/CodeEditor.mjs";
|
|
@@ -11,7 +12,6 @@ import { styles, textAreaStyle } from "../MessageInput/style.mjs";
|
|
|
11
12
|
import messageModal_default from "../../i18n/resources/en/messageModal.mjs";
|
|
12
13
|
import { memo, useState } from "react";
|
|
13
14
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import useControlledState from "use-merge-value";
|
|
15
15
|
//#region src/chat/MessageModal/MessageModal.tsx
|
|
16
16
|
const MessageModal = memo(({ editing, open, height = "75vh", onOpenChange, onEditingChange, placeholder, value, language = "markdown", onChange, text, footer, extra }) => {
|
|
17
17
|
const { mobile } = useResponsive();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageModal.mjs","names":["messageModalMessages","Flexbox","TextArea","textStyles"],"sources":["../../../src/chat/MessageModal/MessageModal.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useState } from 'react';\
|
|
1
|
+
{"version":3,"file":"MessageModal.mjs","names":["messageModalMessages","Flexbox","TextArea","textStyles"],"sources":["../../../src/chat/MessageModal/MessageModal.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useState } from 'react';\n\nimport Button from '@/Button';\nimport { styles as textStyles, textAreaStyle } from '@/chat/MessageInput/style';\nimport CodeEditor from '@/CodeEditor';\nimport { Flexbox } from '@/Flex';\nimport { useControlledState } from '@/hooks/useControlledState';\nimport messageModalMessages from '@/i18n/resources/en/messageModal';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport { TextArea } from '@/Input';\nimport Markdown from '@/Markdown';\nimport { Modal } from '@/Modal';\nimport { useResponsive } from '@/styles/theme/scope';\n\nimport { type MessageModalProps } from './type';\n\nconst MessageModal = memo<MessageModalProps>(\n ({\n editing,\n open,\n height = '75vh',\n onOpenChange,\n onEditingChange,\n placeholder,\n value,\n language = 'markdown',\n onChange,\n text,\n footer,\n extra,\n }) => {\n const { mobile } = useResponsive();\n const { t } = useTranslation(messageModalMessages);\n const [isEdit, setTyping] = useControlledState(false, {\n onChange: onEditingChange,\n value: editing,\n });\n\n const [showModal, setShowModal] = useControlledState(false, {\n onChange: onOpenChange,\n value: open,\n });\n\n const [temporaryValue, setMessage] = useState(value);\n\n const confirmText = text?.confirm ?? t('messageModal.confirm');\n const cancelText = text?.cancel ?? t('messageModal.cancel');\n const editText = text?.edit ?? t('messageModal.edit');\n\n const modalFooter = isEdit ? (\n <Flexbox direction={'horizontal-reverse'} gap={8}>\n <Button\n type=\"primary\"\n onClick={() => {\n setTyping(false);\n onChange?.(temporaryValue);\n setMessage(value);\n }}\n >\n {confirmText}\n </Button>\n <Button\n onClick={() => {\n setTyping(false);\n setMessage(value);\n }}\n >\n {cancelText}\n </Button>\n </Flexbox>\n ) : (\n footer\n );\n\n return (\n <Modal\n allowFullscreen\n destroyOnHidden\n cancelText={cancelText}\n footer={modalFooter}\n height={height}\n okText={editText}\n open={showModal}\n title={text?.title}\n onOk={() => setTyping(true)}\n onCancel={() => {\n setShowModal(false);\n setTyping(false);\n setMessage(value);\n }}\n >\n {isEdit ? (\n mobile ? (\n <TextArea\n autoSize\n className={textStyles}\n defaultValue={temporaryValue}\n placeholder={placeholder}\n style={textAreaStyle}\n value={temporaryValue}\n variant={'borderless'}\n onBlur={(e) => setMessage(e.target.value)}\n onChange={(value) => setMessage(value.target.value)}\n />\n ) : (\n <CodeEditor\n className={textStyles}\n defaultValue={temporaryValue}\n language={language}\n placeholder={placeholder}\n value={temporaryValue}\n variant={'borderless'}\n onBlur={(e) => setMessage(e.target.value)}\n onValueChange={(value) => setMessage(value)}\n />\n )\n ) : (\n <>\n {extra}\n <Markdown variant={'chat'}>{String(value || placeholder)}</Markdown>\n </>\n )}\n </Modal>\n );\n },\n);\n\nMessageModal.displayName = 'MessageModal';\n\nexport default MessageModal;\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAM,eAAe,MAClB,EACC,SACA,MACA,SAAS,QACT,cACA,iBACA,aACA,OACA,WAAW,YACX,UACA,MACA,QACA,YACI;CACJ,MAAM,EAAE,WAAW,cAAc;CACjC,MAAM,EAAE,MAAM,eAAeA,oBAAoB;CACjD,MAAM,CAAC,QAAQ,aAAa,mBAAmB,OAAO;EACpD,UAAU;EACV,OAAO;CACT,CAAC;CAED,MAAM,CAAC,WAAW,gBAAgB,mBAAmB,OAAO;EAC1D,UAAU;EACV,OAAO;CACT,CAAC;CAED,MAAM,CAAC,gBAAgB,cAAc,SAAS,KAAK;CAEnD,MAAM,cAAc,MAAM,WAAW,EAAE,sBAAsB;CAC7D,MAAM,aAAa,MAAM,UAAU,EAAE,qBAAqB;CAC1D,MAAM,WAAW,MAAM,QAAQ,EAAE,mBAAmB;CA2BpD,OACE,oBAAC,OAAD;EACE,iBAAA;EACA,iBAAA;EACY;EACZ,QA9BgB,SAClB,qBAACC,mBAAD;GAAS,WAAW;GAAsB,KAAK;GAA/C,UAAA,CACE,oBAAC,QAAD;IACE,MAAK;IACL,eAAe;KACb,UAAU,KAAK;KACf,WAAW,cAAc;KACzB,WAAW,KAAK;IAClB;IAEC,UAAA;GACK,CAAA,GACR,oBAAC,QAAD;IACE,eAAe;KACb,UAAU,KAAK;KACf,WAAW,KAAK;IAClB;IAEC,UAAA;GACK,CAAA,CACD;EAET,CAAA,IAAA;EASU;EACR,QAAQ;EACR,MAAM;EACN,OAAO,MAAM;EACb,YAAY,UAAU,IAAI;EAC1B,gBAAgB;GACd,aAAa,KAAK;GAClB,UAAU,KAAK;GACf,WAAW,KAAK;EAClB;EAEC,UAAA,SACC,SACE,oBAACC,kBAAD;GACE,UAAA;GACA,WAAWC;GACX,cAAc;GACD;GACb,OAAO;GACP,OAAO;GACP,SAAS;GACT,SAAS,MAAM,WAAW,EAAE,OAAO,KAAK;GACxC,WAAW,UAAU,WAAW,MAAM,OAAO,KAAK;EACnD,CAAA,IAED,oBAAC,YAAD;GACE,WAAWA;GACX,cAAc;GACJ;GACG;GACb,OAAO;GACP,SAAS;GACT,SAAS,MAAM,WAAW,EAAE,OAAO,KAAK;GACxC,gBAAgB,UAAU,WAAW,KAAK;EAC3C,CAAA,IAGH,qBAAA,YAAA,EAAA,UAAA,CACG,OACD,oBAAC,UAAD;GAAU,SAAS;GAAS,UAAA,OAAO,SAAS,WAAW;EAAY,CAAA,CACnE,EAAA,CAAA;CAEC,CAAA;AAEX,CACF;AAEA,aAAa,cAAc"}
|
|
@@ -4,11 +4,10 @@ import ActionIcon from "../../ActionIcon/ActionIcon.mjs";
|
|
|
4
4
|
import { useTranslation } from "../../i18n/useTranslation.mjs";
|
|
5
5
|
import Progress from "../../Progress/Progress.mjs";
|
|
6
6
|
import chat_default from "../../i18n/resources/en/chat.mjs";
|
|
7
|
+
import { formatNumber } from "../../utils/formatNumber.mjs";
|
|
7
8
|
import { useMemo } from "react";
|
|
8
9
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import numeral from "numeral";
|
|
10
10
|
//#region src/chat/TokenTag/TokenTag.tsx
|
|
11
|
-
const format = (number) => numeral(number).format("0,0");
|
|
12
11
|
const TokenTag = ({ mode = "remained", maxValue, value, text, showInfo, size = 20, ...rest }) => {
|
|
13
12
|
const { t } = useTranslation(chat_default);
|
|
14
13
|
const valueLeft = maxValue - value;
|
|
@@ -34,7 +33,7 @@ const TokenTag = ({ mode = "remained", maxValue, value, text, showInfo, size = 2
|
|
|
34
33
|
type
|
|
35
34
|
};
|
|
36
35
|
}, [percent]);
|
|
37
|
-
const title = valueLeft > 0 ? [mode === "remained" ? remainedText : usedText, mode === "remained" ?
|
|
36
|
+
const title = valueLeft > 0 ? [mode === "remained" ? remainedText : usedText, mode === "remained" ? formatNumber(valueLeft) : formatNumber(value)].join(" ") : overloadText;
|
|
38
37
|
return /* @__PURE__ */ jsx(ActionIcon, {
|
|
39
38
|
size,
|
|
40
39
|
title: showInfo ? title : void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenTag.mjs","names":["chatMessages"],"sources":["../../../src/chat/TokenTag/TokenTag.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"file":"TokenTag.mjs","names":["chatMessages"],"sources":["../../../src/chat/TokenTag/TokenTag.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, useMemo } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport chatMessages from '@/i18n/resources/en/chat';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Progress from '@/Progress';\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\nimport { formatNumber } from '@/utils/formatNumber';\n\nimport type { TokenTagProps } from './type';\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' ? formatNumber(valueLeft) : formatNumber(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,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,aAAa,SAAS,IAAI,aAAa,KAAK,CACpE,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AuthLayoutAsideProps } from "./type.mjs";
|
|
2
|
+
//#region src/dashboard/AuthLayout/Aside.d.ts
|
|
3
|
+
/** Inset art panel for `AuthLayout`'s `aside` slot, with a scrim and copy at the bottom. */
|
|
4
|
+
declare function AuthLayoutAside({ background, className, kicker, line, style, ...rest }: AuthLayoutAsideProps): import("react").JSX.Element;
|
|
5
|
+
declare namespace AuthLayoutAside {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { AuthLayoutAside as default };
|
|
10
|
+
//# sourceMappingURL=Aside.d.mts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { styleProps } from "../../styles/stylex/props.mjs";
|
|
3
|
+
import { styles } from "./style.mjs";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as stylex from "@stylexjs/stylex";
|
|
6
|
+
//#region src/dashboard/AuthLayout/Aside.tsx
|
|
7
|
+
/** Inset art panel for `AuthLayout`'s `aside` slot, with a scrim and copy at the bottom. */
|
|
8
|
+
function AuthLayoutAside({ background, className, kicker, line, style, ...rest }) {
|
|
9
|
+
return /* @__PURE__ */ jsx("div", {
|
|
10
|
+
...rest,
|
|
11
|
+
...styleProps(styles.asidePlate, className, style),
|
|
12
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
...stylex.props(styles.asidePanel),
|
|
14
|
+
children: [background, kicker || line ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", { ...stylex.props(styles.asideScrim) }), /* @__PURE__ */ jsxs("div", {
|
|
15
|
+
...stylex.props(styles.asideCopy),
|
|
16
|
+
children: [kicker ? /* @__PURE__ */ jsx("p", {
|
|
17
|
+
...stylex.props(styles.asideKicker),
|
|
18
|
+
children: kicker
|
|
19
|
+
}) : null, line ? /* @__PURE__ */ jsx("p", {
|
|
20
|
+
...stylex.props(styles.asideLine),
|
|
21
|
+
children: line
|
|
22
|
+
}) : null]
|
|
23
|
+
})] }) : null]
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
AuthLayoutAside.displayName = "AuthLayoutAside";
|
|
28
|
+
//#endregion
|
|
29
|
+
export { AuthLayoutAside as default };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=Aside.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Aside.mjs","names":[],"sources":["../../../src/dashboard/AuthLayout/Aside.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\n\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { styles } from './style';\nimport type { AuthLayoutAsideProps } from './type';\n\n/** Inset art panel for `AuthLayout`'s `aside` slot, with a scrim and copy at the bottom. */\nfunction AuthLayoutAside({\n background,\n className,\n kicker,\n line,\n style,\n ...rest\n}: AuthLayoutAsideProps) {\n return (\n <div {...rest} {...styleProps(styles.asidePlate, className, style)}>\n <div {...stylex.props(styles.asidePanel)}>\n {background}\n {kicker || line ? (\n <>\n <div {...stylex.props(styles.asideScrim)} />\n <div {...stylex.props(styles.asideCopy)}>\n {kicker ? <p {...stylex.props(styles.asideKicker)}>{kicker}</p> : null}\n {line ? <p {...stylex.props(styles.asideLine)}>{line}</p> : null}\n </div>\n </>\n ) : null}\n </div>\n </div>\n );\n}\n\nAuthLayoutAside.displayName = 'AuthLayoutAside';\n\nexport default AuthLayoutAside;\n"],"mappings":";;;;;;;AAQA,SAAS,gBAAgB,EACvB,YACA,WACA,QACA,MACA,OACA,GAAG,QACoB;CACvB,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,GAAI,WAAW,OAAO,YAAY,WAAW,KAAK;EACpE,UAAA,qBAAC,OAAD;GAAK,GAAI,OAAO,MAAM,OAAO,UAAU;GAAvC,UAAA,CACG,YACA,UAAU,OAAO,qBAAA,UAAA,EAAA,UAAA,CACd,oBAAC,OAAD,EAAK,GAAI,OAAO,MAAM,OAAO,UAAU,EAAI,CAAA,GAC3C,qBAAC,OAAD;IAAK,GAAI,OAAO,MAAM,OAAO,SAAS;IAAtC,UAAA,CACG,SAAS,oBAAC,KAAD;KAAG,GAAI,OAAO,MAAM,OAAO,WAAW;KAAI,UAAA;IAAU,CAAA,IAAI,MACjE,OAAO,oBAAC,KAAD;KAAG,GAAI,OAAO,MAAM,OAAO,SAAS;KAAI,UAAA;IAAQ,CAAA,IAAI,IACzD;GACL,CAAA,CAAA,EAAA,CAAA,IAAI,IACL;;CACF,CAAA;AACT;AACA,gBAAgB,cAAc"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AuthLayoutProps } from "./type.mjs";
|
|
2
|
+
import AuthLayoutAside from "./Aside.mjs";
|
|
2
3
|
//#region src/dashboard/AuthLayout/AuthLayout.d.ts
|
|
3
|
-
declare function AuthLayout({ aside, brand, children, className, description, style, title, tools, ...rest }: AuthLayoutProps): import("react").JSX.Element;
|
|
4
|
+
declare function AuthLayout({ alert, aside, background, brand, card, children, className, description, footer, loading, logo, style, title, tools, variant, ...rest }: AuthLayoutProps): import("react").JSX.Element;
|
|
4
5
|
declare namespace AuthLayout {
|
|
5
6
|
var displayName: string;
|
|
7
|
+
var Aside: typeof AuthLayoutAside;
|
|
6
8
|
}
|
|
7
9
|
//#endregion
|
|
8
10
|
export { AuthLayout as default };
|