@lobehub/ui 5.15.8 → 5.15.9
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/CodeDiff/CodeDiff.mjs +43 -67
- package/es/CodeDiff/CodeDiff.mjs.map +1 -1
- package/es/CodeDiff/DiffPanel.mjs +118 -0
- package/es/CodeDiff/DiffPanel.mjs.map +1 -0
- package/es/CodeDiff/PatchDiff.mjs +39 -63
- package/es/CodeDiff/PatchDiff.mjs.map +1 -1
- package/es/CodeDiff/style.mjs +80 -29
- package/es/CodeDiff/style.mjs.map +1 -1
- package/es/CodeDiff/theme.mjs +45 -0
- package/es/CodeDiff/theme.mjs.map +1 -0
- package/es/CodeDiff/type.d.mts +20 -0
- package/es/EmojiPicker/AvatarUploader.mjs +1 -1
- package/es/Highlighter/Highlighter.mjs +1 -1
- package/es/Highlighter/theme/lobe-theme.d.mts +3 -0
- package/es/Highlighter/theme/lobe-theme.mjs +1 -0
- package/es/Highlighter/theme/lobe-theme.mjs.map +1 -1
- package/es/Mermaid/Mermaid.mjs +1 -1
- package/es/Tag/Tag.mjs +23 -10
- package/es/Tag/Tag.mjs.map +1 -1
- package/es/Tag/styles.mjs +44 -1
- package/es/Tag/styles.mjs.map +1 -1
- package/es/Tag/type.d.mts +2 -1
- package/es/color/colors/blue.d.mts +2 -2
- package/es/color/colors/blue.mjs +50 -50
- package/es/color/colors/blue.mjs.map +1 -1
- package/es/color/colors/index.d.mts +1 -1
- package/es/color/colors/index.mjs +2 -2
- package/es/color/colors/index.mjs.map +1 -1
- package/es/color/index.d.mts +2 -2
- package/es/color/index.mjs +2 -2
- package/es/hooks/useHighlight.mjs +1 -1
- package/es/hooks/useStreamHighlight.mjs +1 -1
- package/es/index.mjs +2 -2
- package/es/styles/customTheme.mjs +2 -2
- package/es/styles/customTheme.mjs.map +1 -1
- package/es/styles/theme/token/dark.mjs +2 -2
- package/es/styles/theme/token/dark.mjs.map +1 -1
- package/es/utils/safeReadableColor.mjs +1 -0
- package/es/utils/safeReadableColor.mjs.map +1 -1
- package/package.json +1 -1
package/es/CodeDiff/CodeDiff.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { headerVariants, styles, variants } from "./style.mjs";
|
|
2
|
+
import { DiffPanel } from "./DiffPanel.mjs";
|
|
3
|
+
import { getLobeDiffOptions, registerLobeDiffThemes } from "./theme.mjs";
|
|
5
4
|
import { memo, useMemo } from "react";
|
|
6
|
-
import { jsx
|
|
7
|
-
import {
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useThemeMode } from "antd-style";
|
|
8
7
|
import { MultiFileDiff } from "@pierre/diffs/react";
|
|
9
8
|
//#region src/CodeDiff/CodeDiff.tsx
|
|
9
|
+
registerLobeDiffThemes();
|
|
10
10
|
const countContentChanges = (oldContent, newContent) => {
|
|
11
11
|
const oldLines = oldContent.split("\n");
|
|
12
12
|
const newLines = newContent.split("\n");
|
|
@@ -21,7 +21,8 @@ const countContentChanges = (oldContent, newContent) => {
|
|
|
21
21
|
deletions
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
const CodeDiff = memo(({ oldContent, newContent, language, fileName, viewMode = "split", showHeader = true, variant = "filled", className, classNames, styles: customStyles, actionsRender, diffOptions, ...rest }) => {
|
|
24
|
+
const CodeDiff = memo(({ oldContent, newContent, language, fileName, viewMode = "split", showHeader = true, defaultExpand = true, fullFeatured = true, variant = "filled", className, classNames, styles: customStyles, actionsRender, diffOptions, ...rest }) => {
|
|
25
|
+
const { isDarkMode } = useThemeMode();
|
|
25
26
|
const displayName = useMemo(() => {
|
|
26
27
|
if (fileName) return fileName;
|
|
27
28
|
if (language) return language;
|
|
@@ -49,67 +50,42 @@ const CodeDiff = memo(({ oldContent, newContent, language, fileName, viewMode =
|
|
|
49
50
|
language,
|
|
50
51
|
fileName
|
|
51
52
|
]);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
className: styles.stats,
|
|
89
|
-
gap: 8,
|
|
90
|
-
children: [deletions > 0 && /* @__PURE__ */ jsxs("span", {
|
|
91
|
-
className: styles.deletions,
|
|
92
|
-
children: ["-", deletions]
|
|
93
|
-
}), additions > 0 && /* @__PURE__ */ jsxs("span", {
|
|
94
|
-
className: styles.additions,
|
|
95
|
-
children: ["+", additions]
|
|
96
|
-
})]
|
|
97
|
-
}), actions && /* @__PURE__ */ jsx(FlexBasic_default, {
|
|
98
|
-
align: "center",
|
|
99
|
-
className: cx(`lobe-code-diff-actions`, styles.actions),
|
|
100
|
-
gap: 4,
|
|
101
|
-
children: actions
|
|
102
|
-
})]
|
|
103
|
-
})]
|
|
104
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
105
|
-
className: cx(styles.body, classNames?.body),
|
|
106
|
-
style: customStyles?.body,
|
|
107
|
-
children: /* @__PURE__ */ jsx(MultiFileDiff, {
|
|
108
|
-
newFile,
|
|
109
|
-
oldFile,
|
|
110
|
-
options
|
|
111
|
-
})
|
|
112
|
-
})]
|
|
53
|
+
return /* @__PURE__ */ jsx(DiffPanel, {
|
|
54
|
+
actions,
|
|
55
|
+
additions,
|
|
56
|
+
body: /* @__PURE__ */ jsx(MultiFileDiff, {
|
|
57
|
+
newFile: useMemo(() => ({
|
|
58
|
+
contents: newContent,
|
|
59
|
+
lang: language,
|
|
60
|
+
name: fileName || "file"
|
|
61
|
+
}), [
|
|
62
|
+
newContent,
|
|
63
|
+
language,
|
|
64
|
+
fileName
|
|
65
|
+
]),
|
|
66
|
+
oldFile,
|
|
67
|
+
options: useMemo(() => getLobeDiffOptions({
|
|
68
|
+
diffOptions,
|
|
69
|
+
isDarkMode,
|
|
70
|
+
viewMode
|
|
71
|
+
}), [
|
|
72
|
+
isDarkMode,
|
|
73
|
+
viewMode,
|
|
74
|
+
diffOptions
|
|
75
|
+
])
|
|
76
|
+
}),
|
|
77
|
+
className,
|
|
78
|
+
classNames,
|
|
79
|
+
dataCodeType: "code-diff",
|
|
80
|
+
defaultExpand,
|
|
81
|
+
deletions,
|
|
82
|
+
displayName,
|
|
83
|
+
fileName,
|
|
84
|
+
fullFeatured,
|
|
85
|
+
showHeader,
|
|
86
|
+
styles: customStyles,
|
|
87
|
+
variant,
|
|
88
|
+
...rest
|
|
113
89
|
});
|
|
114
90
|
});
|
|
115
91
|
CodeDiff.displayName = "CodeDiff";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeDiff.mjs","names":[
|
|
1
|
+
{"version":3,"file":"CodeDiff.mjs","names":[],"sources":["../../src/CodeDiff/CodeDiff.tsx"],"sourcesContent":["'use client';\n\nimport type { FileDiffOptions } from '@pierre/diffs';\nimport { MultiFileDiff } from '@pierre/diffs/react';\nimport { useThemeMode } from 'antd-style';\nimport { memo, useMemo } from 'react';\n\nimport { DiffPanel } from './DiffPanel';\nimport { getLobeDiffOptions, registerLobeDiffThemes } from './theme';\nimport type { CodeDiffProps } from './type';\n\nregisterLobeDiffThemes();\n\nconst countContentChanges = (\n oldContent: string,\n newContent: string,\n): { additions: number; deletions: number } => {\n const oldLines = oldContent.split('\\n');\n const newLines = newContent.split('\\n');\n\n const oldSet = new Set(oldLines);\n const newSet = new Set(newLines);\n\n let deletions = 0;\n let additions = 0;\n\n for (const line of oldLines) {\n if (!newSet.has(line)) {\n deletions++;\n }\n }\n\n for (const line of newLines) {\n if (!oldSet.has(line)) {\n additions++;\n }\n }\n\n return { additions, deletions };\n};\n\nexport const CodeDiff = memo<CodeDiffProps>(\n ({\n oldContent,\n newContent,\n language,\n fileName,\n viewMode = 'split',\n showHeader = true,\n defaultExpand = true,\n fullFeatured = true,\n variant = 'filled',\n className,\n classNames,\n styles: customStyles,\n actionsRender,\n diffOptions,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n\n const displayName = useMemo(() => {\n if (fileName) return fileName;\n if (language) return language;\n return 'diff';\n }, [fileName, language]);\n\n const { additions, deletions } = useMemo(\n () => countContentChanges(oldContent, newContent),\n [oldContent, newContent],\n );\n\n const actions = useMemo(() => {\n if (!actionsRender) return null;\n return actionsRender({\n newContent,\n oldContent,\n originalNode: null,\n });\n }, [actionsRender, oldContent, newContent]);\n\n const oldFile = useMemo(\n () => ({\n contents: oldContent,\n lang: language as any,\n name: fileName || 'file',\n }),\n [oldContent, language, fileName],\n );\n\n const newFile = useMemo(\n () => ({\n contents: newContent,\n lang: language as any,\n name: fileName || 'file',\n }),\n [newContent, language, fileName],\n );\n\n const options = useMemo<FileDiffOptions<string>>(\n () => getLobeDiffOptions({ diffOptions, isDarkMode, viewMode }),\n [isDarkMode, viewMode, diffOptions],\n );\n\n return (\n <DiffPanel\n actions={actions}\n additions={additions}\n body={<MultiFileDiff newFile={newFile} oldFile={oldFile} options={options} />}\n className={className}\n classNames={classNames}\n dataCodeType=\"code-diff\"\n defaultExpand={defaultExpand}\n deletions={deletions}\n displayName={displayName}\n fileName={fileName}\n fullFeatured={fullFeatured}\n showHeader={showHeader}\n styles={customStyles}\n variant={variant}\n {...rest}\n />\n );\n },\n);\n\nCodeDiff.displayName = 'CodeDiff';\n\nexport default CodeDiff;\n"],"mappings":";;;;;;;;AAWA,wBAAwB;AAExB,MAAM,uBACJ,YACA,eAC6C;CAC7C,MAAM,WAAW,WAAW,MAAM,KAAK;CACvC,MAAM,WAAW,WAAW,MAAM,KAAK;CAEvC,MAAM,SAAS,IAAI,IAAI,SAAS;CAChC,MAAM,SAAS,IAAI,IAAI,SAAS;CAEhC,IAAI,YAAY;CAChB,IAAI,YAAY;AAEhB,MAAK,MAAM,QAAQ,SACjB,KAAI,CAAC,OAAO,IAAI,KAAK,CACnB;AAIJ,MAAK,MAAM,QAAQ,SACjB,KAAI,CAAC,OAAO,IAAI,KAAK,CACnB;AAIJ,QAAO;EAAE;EAAW;EAAW;;AAGjC,MAAa,WAAW,MACrB,EACC,YACA,YACA,UACA,UACA,WAAW,SACX,aAAa,MACb,gBAAgB,MAChB,eAAe,MACf,UAAU,UACV,WACA,YACA,QAAQ,cACR,eACA,aACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,cAAc;CAErC,MAAM,cAAc,cAAc;AAChC,MAAI,SAAU,QAAO;AACrB,MAAI,SAAU,QAAO;AACrB,SAAO;IACN,CAAC,UAAU,SAAS,CAAC;CAExB,MAAM,EAAE,WAAW,cAAc,cACzB,oBAAoB,YAAY,WAAW,EACjD,CAAC,YAAY,WAAW,CACzB;CAED,MAAM,UAAU,cAAc;AAC5B,MAAI,CAAC,cAAe,QAAO;AAC3B,SAAO,cAAc;GACnB;GACA;GACA,cAAc;GACf,CAAC;IACD;EAAC;EAAe;EAAY;EAAW,CAAC;CAE3C,MAAM,UAAU,eACP;EACL,UAAU;EACV,MAAM;EACN,MAAM,YAAY;EACnB,GACD;EAAC;EAAY;EAAU;EAAS,CACjC;AAgBD,QACE,oBAAC,WAAD;EACW;EACE;EACX,MAAM,oBAAC,eAAD;GAAe,SAlBT,eACP;IACL,UAAU;IACV,MAAM;IACN,MAAM,YAAY;IACnB,GACD;IAAC;IAAY;IAAU;IAAS,CAYO;GAAW;GAAS,SAT7C,cACR,mBAAmB;IAAE;IAAa;IAAY;IAAU,CAAC,EAC/D;IAAC;IAAY;IAAU;IAAY,CAOwC;GAAI,CAAA;EAClE;EACC;EACZ,cAAa;EACE;EACJ;EACE;EACH;EACI;EACF;EACZ,QAAQ;EACC;EACT,GAAI;EACJ,CAAA;EAGP;AAED,SAAS,cAAc"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import FlexBasic_default from "../Flex/FlexBasic.mjs";
|
|
3
|
+
import Text from "../Text/Text.mjs";
|
|
4
|
+
import { stopPropagation } from "../utils/dom.mjs";
|
|
5
|
+
import ActionIcon from "../ActionIcon/ActionIcon.mjs";
|
|
6
|
+
import MaterialFileTypeIcon from "../MaterialFileTypeIcon/MaterialFileTypeIcon.mjs";
|
|
7
|
+
import Tag from "../Tag/Tag.mjs";
|
|
8
|
+
import { bodyVariants, headerVariants, prefix, styles, variants } from "./style.mjs";
|
|
9
|
+
import { memo, useCallback, useState } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { cx } from "antd-style";
|
|
12
|
+
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
13
|
+
//#region src/CodeDiff/DiffPanel.tsx
|
|
14
|
+
const DiffPanel = memo(({ actions, body, className, classNames, dataCodeType, defaultExpand = true, deletions, displayName, fileName, fullFeatured = true, showHeader = true, styles: customStyles, variant = "filled", additions, ...rest }) => {
|
|
15
|
+
const [expand, setExpand] = useState(defaultExpand);
|
|
16
|
+
const handleToggleExpand = useCallback(() => {
|
|
17
|
+
setExpand((prev) => !prev);
|
|
18
|
+
}, []);
|
|
19
|
+
if (!fullFeatured) return /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
20
|
+
className: cx(variants({ variant }), className),
|
|
21
|
+
"data-code-type": dataCodeType,
|
|
22
|
+
...rest,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx(FlexBasic_default, {
|
|
25
|
+
horizontal: true,
|
|
26
|
+
align: "center",
|
|
27
|
+
className: styles.actionsCompact,
|
|
28
|
+
flex: "none",
|
|
29
|
+
gap: 4,
|
|
30
|
+
children: actions
|
|
31
|
+
}),
|
|
32
|
+
showHeader && /* @__PURE__ */ jsx(Tag, {
|
|
33
|
+
className: styles.lang,
|
|
34
|
+
children: displayName
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ jsx("div", {
|
|
37
|
+
className: cx(styles.body, classNames?.body),
|
|
38
|
+
style: customStyles?.body,
|
|
39
|
+
children: body
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
return /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
44
|
+
className: cx(variants({ variant }), className),
|
|
45
|
+
"data-code-type": dataCodeType,
|
|
46
|
+
...rest,
|
|
47
|
+
children: [showHeader && /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
48
|
+
horizontal: true,
|
|
49
|
+
align: "center",
|
|
50
|
+
className: cx(headerVariants({ variant }), classNames?.header),
|
|
51
|
+
justify: "space-between",
|
|
52
|
+
style: customStyles?.header,
|
|
53
|
+
onClick: handleToggleExpand,
|
|
54
|
+
children: [/* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
55
|
+
horizontal: true,
|
|
56
|
+
align: "center",
|
|
57
|
+
className: "language-title",
|
|
58
|
+
flex: 1,
|
|
59
|
+
gap: 4,
|
|
60
|
+
justify: "flex-start",
|
|
61
|
+
paddingInline: 8,
|
|
62
|
+
children: [/* @__PURE__ */ jsx(MaterialFileTypeIcon, {
|
|
63
|
+
fallbackUnknownType: false,
|
|
64
|
+
filename: fileName || displayName,
|
|
65
|
+
size: 18,
|
|
66
|
+
type: "file",
|
|
67
|
+
variant: "raw"
|
|
68
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
69
|
+
ellipsis: true,
|
|
70
|
+
fontSize: 13,
|
|
71
|
+
children: displayName
|
|
72
|
+
})]
|
|
73
|
+
}), /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
74
|
+
horizontal: true,
|
|
75
|
+
align: "center",
|
|
76
|
+
flex: "none",
|
|
77
|
+
gap: 8,
|
|
78
|
+
onClick: stopPropagation,
|
|
79
|
+
children: [
|
|
80
|
+
actions && /* @__PURE__ */ jsx(FlexBasic_default, {
|
|
81
|
+
horizontal: true,
|
|
82
|
+
align: "center",
|
|
83
|
+
className: cx("panel-actions", `lobe-code-diff-actions`, styles.actions),
|
|
84
|
+
flex: "none",
|
|
85
|
+
gap: 4,
|
|
86
|
+
children: actions
|
|
87
|
+
}),
|
|
88
|
+
(deletions > 0 || additions > 0) && /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
89
|
+
horizontal: true,
|
|
90
|
+
className: styles.stats,
|
|
91
|
+
gap: 8,
|
|
92
|
+
children: [deletions > 0 && /* @__PURE__ */ jsxs("span", {
|
|
93
|
+
className: styles.deletions,
|
|
94
|
+
children: ["-", deletions]
|
|
95
|
+
}), additions > 0 && /* @__PURE__ */ jsxs("span", {
|
|
96
|
+
className: styles.additions,
|
|
97
|
+
children: ["+", additions]
|
|
98
|
+
})]
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx(ActionIcon, {
|
|
101
|
+
icon: expand ? ChevronDown : ChevronRight,
|
|
102
|
+
size: "small",
|
|
103
|
+
onClick: handleToggleExpand
|
|
104
|
+
})
|
|
105
|
+
]
|
|
106
|
+
})]
|
|
107
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
108
|
+
className: cx(bodyVariants({ expand }), `${prefix}-body`, styles.body, classNames?.body),
|
|
109
|
+
style: customStyles?.body,
|
|
110
|
+
children: body
|
|
111
|
+
})]
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
DiffPanel.displayName = "DiffPanel";
|
|
115
|
+
//#endregion
|
|
116
|
+
export { DiffPanel };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=DiffPanel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiffPanel.mjs","names":["Flexbox"],"sources":["../../src/CodeDiff/DiffPanel.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { ChevronDown, ChevronRight } from 'lucide-react';\nimport type { CSSProperties, ReactNode } from 'react';\nimport { memo, useCallback, useState } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport type { FlexboxProps } from '@/Flex';\nimport { Flexbox } from '@/Flex';\nimport MaterialFileTypeIcon from '@/MaterialFileTypeIcon';\nimport Tag from '@/Tag';\nimport Text from '@/Text';\nimport { stopPropagation } from '@/utils/dom';\n\nimport { bodyVariants, headerVariants, prefix, styles, variants } from './style';\n\ninterface DiffPanelProps extends Omit<FlexboxProps, 'children'> {\n actions?: ReactNode;\n additions: number;\n body: ReactNode;\n classNames?: {\n body?: string;\n header?: string;\n };\n dataCodeType: string;\n defaultExpand?: boolean;\n deletions: number;\n displayName: string;\n fileName?: string;\n fullFeatured?: boolean;\n showHeader?: boolean;\n styles?: {\n body?: CSSProperties;\n header?: CSSProperties;\n };\n variant?: 'filled' | 'outlined' | 'borderless';\n}\n\nexport const DiffPanel = memo<DiffPanelProps>(\n ({\n actions,\n body,\n className,\n classNames,\n dataCodeType,\n defaultExpand = true,\n deletions,\n displayName,\n fileName,\n fullFeatured = true,\n showHeader = true,\n styles: customStyles,\n variant = 'filled',\n additions,\n ...rest\n }) => {\n const [expand, setExpand] = useState(defaultExpand);\n\n const handleToggleExpand = useCallback(() => {\n setExpand((prev) => !prev);\n }, []);\n\n if (!fullFeatured)\n return (\n <Flexbox\n className={cx(variants({ variant }), className)}\n data-code-type={dataCodeType}\n {...rest}\n >\n <Flexbox horizontal align=\"center\" className={styles.actionsCompact} flex=\"none\" gap={4}>\n {actions}\n </Flexbox>\n {showHeader && <Tag className={styles.lang}>{displayName}</Tag>}\n <div className={cx(styles.body, classNames?.body)} style={customStyles?.body}>\n {body}\n </div>\n </Flexbox>\n );\n\n return (\n <Flexbox\n className={cx(variants({ variant }), className)}\n data-code-type={dataCodeType}\n {...rest}\n >\n {showHeader && (\n <Flexbox\n horizontal\n align=\"center\"\n className={cx(headerVariants({ variant }), classNames?.header)}\n justify=\"space-between\"\n style={customStyles?.header}\n onClick={handleToggleExpand}\n >\n <Flexbox\n horizontal\n align=\"center\"\n className=\"language-title\"\n flex={1}\n gap={4}\n justify=\"flex-start\"\n paddingInline={8}\n >\n <MaterialFileTypeIcon\n fallbackUnknownType={false}\n filename={fileName || displayName}\n size={18}\n type=\"file\"\n variant=\"raw\"\n />\n <Text ellipsis fontSize={13}>\n {displayName}\n </Text>\n </Flexbox>\n <Flexbox horizontal align=\"center\" flex=\"none\" gap={8} onClick={stopPropagation}>\n {actions && (\n <Flexbox\n horizontal\n align=\"center\"\n className={cx('panel-actions', `${prefix}-actions`, styles.actions)}\n flex=\"none\"\n gap={4}\n >\n {actions}\n </Flexbox>\n )}\n {(deletions > 0 || additions > 0) && (\n <Flexbox horizontal className={styles.stats} gap={8}>\n {deletions > 0 && <span className={styles.deletions}>-{deletions}</span>}\n {additions > 0 && <span className={styles.additions}>+{additions}</span>}\n </Flexbox>\n )}\n <ActionIcon\n icon={expand ? ChevronDown : ChevronRight}\n size=\"small\"\n onClick={handleToggleExpand}\n />\n </Flexbox>\n </Flexbox>\n )}\n <div\n className={cx(bodyVariants({ expand }), `${prefix}-body`, styles.body, classNames?.body)}\n style={customStyles?.body}\n >\n {body}\n </div>\n </Flexbox>\n );\n },\n);\n\nDiffPanel.displayName = 'DiffPanel';\n"],"mappings":";;;;;;;;;;;;;AAuCA,MAAa,YAAY,MACtB,EACC,SACA,MACA,WACA,YACA,cACA,gBAAgB,MAChB,WACA,aACA,UACA,eAAe,MACf,aAAa,MACb,QAAQ,cACR,UAAU,UACV,WACA,GAAG,WACC;CACJ,MAAM,CAAC,QAAQ,aAAa,SAAS,cAAc;CAEnD,MAAM,qBAAqB,kBAAkB;AAC3C,aAAW,SAAS,CAAC,KAAK;IACzB,EAAE,CAAC;AAEN,KAAI,CAAC,aACH,QACE,qBAACA,mBAAD;EACE,WAAW,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,UAAU;EAC/C,kBAAgB;EAChB,GAAI;YAHN;GAKE,oBAACA,mBAAD;IAAS,YAAA;IAAW,OAAM;IAAS,WAAW,OAAO;IAAgB,MAAK;IAAO,KAAK;cACnF;IACO,CAAA;GACT,cAAc,oBAAC,KAAD;IAAK,WAAW,OAAO;cAAO;IAAkB,CAAA;GAC/D,oBAAC,OAAD;IAAK,WAAW,GAAG,OAAO,MAAM,YAAY,KAAK;IAAE,OAAO,cAAc;cACrE;IACG,CAAA;GACE;;AAGd,QACE,qBAACA,mBAAD;EACE,WAAW,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,UAAU;EAC/C,kBAAgB;EAChB,GAAI;YAHN,CAKG,cACC,qBAACA,mBAAD;GACE,YAAA;GACA,OAAM;GACN,WAAW,GAAG,eAAe,EAAE,SAAS,CAAC,EAAE,YAAY,OAAO;GAC9D,SAAQ;GACR,OAAO,cAAc;GACrB,SAAS;aANX,CAQE,qBAACA,mBAAD;IACE,YAAA;IACA,OAAM;IACN,WAAU;IACV,MAAM;IACN,KAAK;IACL,SAAQ;IACR,eAAe;cAPjB,CASE,oBAAC,sBAAD;KACE,qBAAqB;KACrB,UAAU,YAAY;KACtB,MAAM;KACN,MAAK;KACL,SAAQ;KACR,CAAA,EACF,oBAAC,MAAD;KAAM,UAAA;KAAS,UAAU;eACtB;KACI,CAAA,CACC;OACV,qBAACA,mBAAD;IAAS,YAAA;IAAW,OAAM;IAAS,MAAK;IAAO,KAAK;IAAG,SAAS;cAAhE;KACG,WACC,oBAACA,mBAAD;MACE,YAAA;MACA,OAAM;MACN,WAAW,GAAG,iBAAiB,0BAAqB,OAAO,QAAQ;MACnE,MAAK;MACL,KAAK;gBAEJ;MACO,CAAA;MAEV,YAAY,KAAK,YAAY,MAC7B,qBAACA,mBAAD;MAAS,YAAA;MAAW,WAAW,OAAO;MAAO,KAAK;gBAAlD,CACG,YAAY,KAAK,qBAAC,QAAD;OAAM,WAAW,OAAO;iBAAxB,CAAmC,KAAE,UAAiB;UACvE,YAAY,KAAK,qBAAC,QAAD;OAAM,WAAW,OAAO;iBAAxB,CAAmC,KAAE,UAAiB;SAChE;;KAEZ,oBAAC,YAAD;MACE,MAAM,SAAS,cAAc;MAC7B,MAAK;MACL,SAAS;MACT,CAAA;KACM;MACF;MAEZ,oBAAC,OAAD;GACE,WAAW,GAAG,aAAa,EAAE,QAAQ,CAAC,EAAE,GAAG,OAAO,QAAQ,OAAO,MAAM,YAAY,KAAK;GACxF,OAAO,cAAc;aAEpB;GACG,CAAA,CACE;;EAGf;AAED,UAAU,cAAc"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { headerVariants, styles, variants } from "./style.mjs";
|
|
2
|
+
import { DiffPanel } from "./DiffPanel.mjs";
|
|
3
|
+
import { getLobeDiffOptions, registerLobeDiffThemes } from "./theme.mjs";
|
|
5
4
|
import { memo, useMemo } from "react";
|
|
6
|
-
import { jsx
|
|
7
|
-
import {
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useThemeMode } from "antd-style";
|
|
8
7
|
import { PatchDiff } from "@pierre/diffs/react";
|
|
9
8
|
//#region src/CodeDiff/PatchDiff.tsx
|
|
9
|
+
registerLobeDiffThemes();
|
|
10
10
|
const countPatchChanges = (patch) => {
|
|
11
11
|
const lines = patch.split("\n");
|
|
12
12
|
let additions = 0;
|
|
@@ -18,7 +18,8 @@ const countPatchChanges = (patch) => {
|
|
|
18
18
|
deletions
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
const PatchDiff$1 = memo(({ patch, language, fileName, viewMode = "split", showHeader = true, variant = "filled", className, classNames, styles: customStyles, actionsRender, diffOptions, ...rest }) => {
|
|
21
|
+
const PatchDiff$1 = memo(({ patch, language, fileName, viewMode = "split", showHeader = true, defaultExpand = true, fullFeatured = true, variant = "filled", className, classNames, styles: customStyles, actionsRender, diffOptions, ...rest }) => {
|
|
22
|
+
const { isDarkMode } = useThemeMode();
|
|
22
23
|
const displayName = useMemo(() => {
|
|
23
24
|
if (fileName) return fileName;
|
|
24
25
|
const match = patch.match(/^(?:-{3}|\+{3})\s+(?:a\/|b\/)?(.+?)(?:\t|$)/m);
|
|
@@ -31,64 +32,39 @@ const PatchDiff$1 = memo(({ patch, language, fileName, viewMode = "split", showH
|
|
|
31
32
|
language
|
|
32
33
|
]);
|
|
33
34
|
const { additions, deletions } = useMemo(() => countPatchChanges(patch), [patch]);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
}, [actionsRender, patch]);
|
|
41
|
-
const options = useMemo(() => ({
|
|
42
|
-
diffStyle: viewMode,
|
|
43
|
-
disableFileHeader: true,
|
|
44
|
-
...diffOptions
|
|
45
|
-
}), [viewMode, diffOptions]);
|
|
46
|
-
return /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
47
|
-
className: cx(variants({ variant }), className),
|
|
48
|
-
"data-code-type": "patch-diff",
|
|
49
|
-
...rest,
|
|
50
|
-
children: [showHeader && /* @__PURE__ */ jsxs("div", {
|
|
51
|
-
className: cx(headerVariants({ variant }), classNames?.header),
|
|
52
|
-
style: customStyles?.header,
|
|
53
|
-
children: [/* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
54
|
-
horizontal: true,
|
|
55
|
-
align: "center",
|
|
56
|
-
gap: 8,
|
|
57
|
-
children: [/* @__PURE__ */ jsx(MaterialFileTypeIcon, {
|
|
58
|
-
filename: fileName || displayName,
|
|
59
|
-
size: 18,
|
|
60
|
-
type: "file"
|
|
61
|
-
}), /* @__PURE__ */ jsx("span", { children: displayName })]
|
|
62
|
-
}), /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
63
|
-
horizontal: true,
|
|
64
|
-
align: "center",
|
|
65
|
-
gap: 8,
|
|
66
|
-
children: [(deletions > 0 || additions > 0) && /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
67
|
-
horizontal: true,
|
|
68
|
-
className: styles.stats,
|
|
69
|
-
gap: 8,
|
|
70
|
-
children: [deletions > 0 && /* @__PURE__ */ jsxs("span", {
|
|
71
|
-
className: styles.deletions,
|
|
72
|
-
children: ["-", deletions]
|
|
73
|
-
}), additions > 0 && /* @__PURE__ */ jsxs("span", {
|
|
74
|
-
className: styles.additions,
|
|
75
|
-
children: ["+", additions]
|
|
76
|
-
})]
|
|
77
|
-
}), actions && /* @__PURE__ */ jsx(FlexBasic_default, {
|
|
78
|
-
align: "center",
|
|
79
|
-
className: cx(`lobe-code-diff-actions`, styles.actions),
|
|
80
|
-
gap: 4,
|
|
81
|
-
children: actions
|
|
82
|
-
})]
|
|
83
|
-
})]
|
|
84
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
85
|
-
className: cx(styles.body, classNames?.body),
|
|
86
|
-
style: customStyles?.body,
|
|
87
|
-
children: /* @__PURE__ */ jsx(PatchDiff, {
|
|
88
|
-
options,
|
|
35
|
+
return /* @__PURE__ */ jsx(DiffPanel, {
|
|
36
|
+
actions: useMemo(() => {
|
|
37
|
+
if (!actionsRender) return null;
|
|
38
|
+
return actionsRender({
|
|
39
|
+
originalNode: null,
|
|
89
40
|
patch
|
|
90
|
-
})
|
|
91
|
-
})
|
|
41
|
+
});
|
|
42
|
+
}, [actionsRender, patch]),
|
|
43
|
+
additions,
|
|
44
|
+
body: /* @__PURE__ */ jsx(PatchDiff, {
|
|
45
|
+
options: useMemo(() => getLobeDiffOptions({
|
|
46
|
+
diffOptions,
|
|
47
|
+
isDarkMode,
|
|
48
|
+
viewMode
|
|
49
|
+
}), [
|
|
50
|
+
isDarkMode,
|
|
51
|
+
viewMode,
|
|
52
|
+
diffOptions
|
|
53
|
+
]),
|
|
54
|
+
patch
|
|
55
|
+
}),
|
|
56
|
+
className,
|
|
57
|
+
classNames,
|
|
58
|
+
dataCodeType: "patch-diff",
|
|
59
|
+
defaultExpand,
|
|
60
|
+
deletions,
|
|
61
|
+
displayName,
|
|
62
|
+
fileName,
|
|
63
|
+
fullFeatured,
|
|
64
|
+
showHeader,
|
|
65
|
+
styles: customStyles,
|
|
66
|
+
variant,
|
|
67
|
+
...rest
|
|
92
68
|
});
|
|
93
69
|
});
|
|
94
70
|
PatchDiff$1.displayName = "PatchDiff";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PatchDiff.mjs","names":["PatchDiff","
|
|
1
|
+
{"version":3,"file":"PatchDiff.mjs","names":["PatchDiff","PierrePatchDiff"],"sources":["../../src/CodeDiff/PatchDiff.tsx"],"sourcesContent":["'use client';\n\nimport type { FileDiffOptions } from '@pierre/diffs';\nimport { PatchDiff as PierrePatchDiff } from '@pierre/diffs/react';\nimport { useThemeMode } from 'antd-style';\nimport { memo, useMemo } from 'react';\n\nimport { DiffPanel } from './DiffPanel';\nimport { getLobeDiffOptions, registerLobeDiffThemes } from './theme';\nimport type { PatchDiffProps } from './type';\n\nregisterLobeDiffThemes();\n\nconst countPatchChanges = (patch: string): { additions: number; deletions: number } => {\n const lines = patch.split('\\n');\n let additions = 0;\n let deletions = 0;\n\n for (const line of lines) {\n if (line.startsWith('+') && !line.startsWith('+++')) {\n additions++;\n } else if (line.startsWith('-') && !line.startsWith('---')) {\n deletions++;\n }\n }\n\n return { additions, deletions };\n};\n\nexport const PatchDiff = memo<PatchDiffProps>(\n ({\n patch,\n language,\n fileName,\n viewMode = 'split',\n showHeader = true,\n defaultExpand = true,\n fullFeatured = true,\n variant = 'filled',\n className,\n classNames,\n styles: customStyles,\n actionsRender,\n diffOptions,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n\n const displayName = useMemo(() => {\n if (fileName) return fileName;\n // Try to extract filename from patch header\n const match = patch.match(/^(?:-{3}|\\+{3})\\s+(?:a\\/|b\\/)?(.+?)(?:\\t|$)/m);\n if (match?.[1]) return match[1];\n if (language) return language;\n return 'patch';\n }, [fileName, patch, language]);\n\n const { additions, deletions } = useMemo(() => countPatchChanges(patch), [patch]);\n\n const actions = useMemo(() => {\n if (!actionsRender) return null;\n return actionsRender({\n originalNode: null,\n patch,\n });\n }, [actionsRender, patch]);\n\n const options = useMemo<FileDiffOptions<string>>(\n () => getLobeDiffOptions({ diffOptions, isDarkMode, viewMode }),\n [isDarkMode, viewMode, diffOptions],\n );\n\n return (\n <DiffPanel\n actions={actions}\n additions={additions}\n body={<PierrePatchDiff options={options} patch={patch} />}\n className={className}\n classNames={classNames}\n dataCodeType=\"patch-diff\"\n defaultExpand={defaultExpand}\n deletions={deletions}\n displayName={displayName}\n fileName={fileName}\n fullFeatured={fullFeatured}\n showHeader={showHeader}\n styles={customStyles}\n variant={variant}\n {...rest}\n />\n );\n },\n);\n\nPatchDiff.displayName = 'PatchDiff';\n\nexport default PatchDiff;\n"],"mappings":";;;;;;;;AAWA,wBAAwB;AAExB,MAAM,qBAAqB,UAA4D;CACrF,MAAM,QAAQ,MAAM,MAAM,KAAK;CAC/B,IAAI,YAAY;CAChB,IAAI,YAAY;AAEhB,MAAK,MAAM,QAAQ,MACjB,KAAI,KAAK,WAAW,IAAI,IAAI,CAAC,KAAK,WAAW,MAAM,CACjD;UACS,KAAK,WAAW,IAAI,IAAI,CAAC,KAAK,WAAW,MAAM,CACxD;AAIJ,QAAO;EAAE;EAAW;EAAW;;AAGjC,MAAaA,cAAY,MACtB,EACC,OACA,UACA,UACA,WAAW,SACX,aAAa,MACb,gBAAgB,MAChB,eAAe,MACf,UAAU,UACV,WACA,YACA,QAAQ,cACR,eACA,aACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,cAAc;CAErC,MAAM,cAAc,cAAc;AAChC,MAAI,SAAU,QAAO;EAErB,MAAM,QAAQ,MAAM,MAAM,+CAA+C;AACzE,MAAI,QAAQ,GAAI,QAAO,MAAM;AAC7B,MAAI,SAAU,QAAO;AACrB,SAAO;IACN;EAAC;EAAU;EAAO;EAAS,CAAC;CAE/B,MAAM,EAAE,WAAW,cAAc,cAAc,kBAAkB,MAAM,EAAE,CAAC,MAAM,CAAC;AAejF,QACE,oBAAC,WAAD;EACE,SAfY,cAAc;AAC5B,OAAI,CAAC,cAAe,QAAO;AAC3B,UAAO,cAAc;IACnB,cAAc;IACd;IACD,CAAC;KACD,CAAC,eAAe,MAAM,CASL;EACL;EACX,MAAM,oBAACC,WAAD;GAAiB,SATX,cACR,mBAAmB;IAAE;IAAa;IAAY;IAAU,CAAC,EAC/D;IAAC;IAAY;IAAU;IAAY,CAOM;GAAS;GAAS,CAAA;EAC9C;EACC;EACZ,cAAa;EACE;EACJ;EACE;EACH;EACI;EACF;EACZ,QAAQ;EACC;EACT,GAAI;EACJ,CAAA;EAGP;AAED,YAAU,cAAc"}
|
package/es/CodeDiff/style.mjs
CHANGED
|
@@ -3,21 +3,28 @@ import { createStaticStyles, cx } from "antd-style";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
//#region src/CodeDiff/style.ts
|
|
5
5
|
const prefix = "lobe-code-diff";
|
|
6
|
+
const compactActionsCls = `${prefix}-actions-compact`;
|
|
7
|
+
const compactLangCls = `${prefix}-lang`;
|
|
6
8
|
const styles = createStaticStyles(({ css, cssVar }) => {
|
|
7
9
|
return {
|
|
8
10
|
actions: css`
|
|
9
|
-
position: absolute;
|
|
10
|
-
z-index: 2;
|
|
11
|
-
inset-block-start: 8px;
|
|
12
|
-
inset-inline-end: 8px;
|
|
13
|
-
|
|
14
11
|
opacity: 0;
|
|
15
12
|
transition: opacity 0.2s ${cssVar.motionEaseInOut};
|
|
16
13
|
`,
|
|
14
|
+
actionsCompact: cx(compactActionsCls, css`
|
|
15
|
+
position: absolute;
|
|
16
|
+
z-index: 2;
|
|
17
|
+
inset-block-start: 8px;
|
|
18
|
+
inset-inline-end: 8px;
|
|
19
|
+
|
|
20
|
+
opacity: 0;
|
|
21
|
+
|
|
22
|
+
transition: opacity 0.2s ${cssVar.motionEaseInOut};
|
|
23
|
+
`),
|
|
17
24
|
additions: css`
|
|
18
|
-
color: ${cssVar.colorSuccess};
|
|
19
25
|
font-family: ${cssVar.fontFamilyCode};
|
|
20
26
|
font-size: 12px;
|
|
27
|
+
color: ${cssVar.colorSuccess};
|
|
21
28
|
`,
|
|
22
29
|
body: css`
|
|
23
30
|
overflow: auto;
|
|
@@ -27,55 +34,66 @@ const styles = createStaticStyles(({ css, cssVar }) => {
|
|
|
27
34
|
font-family: ${cssVar.fontFamilyCode};
|
|
28
35
|
font-size: 13px;
|
|
29
36
|
line-height: 1.6;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
--pdiff-gutter-color: ${cssVar.colorTextQuaternary};
|
|
39
|
-
--pdiff-added-bg: ${cssVar.colorSuccessBgHover};
|
|
40
|
-
--pdiff-added-highlight-bg: ${cssVar.colorSuccessBg};
|
|
41
|
-
--pdiff-removed-bg: ${cssVar.colorErrorBgHover};
|
|
42
|
-
--pdiff-removed-highlight-bg: ${cssVar.colorErrorBg};
|
|
43
|
-
--pdiff-info-bg: ${cssVar.colorInfoBg};
|
|
37
|
+
`,
|
|
38
|
+
bodyCollapsed: css`
|
|
39
|
+
height: 0;
|
|
40
|
+
opacity: 0;
|
|
41
|
+
`,
|
|
42
|
+
bodyRoot: css`
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
transition: opacity 0.25s ${cssVar.motionEaseOut};
|
|
44
45
|
`,
|
|
45
46
|
borderless: staticStylish.variantBorderlessWithoutHover,
|
|
46
47
|
deletions: css`
|
|
47
|
-
color: ${cssVar.colorError};
|
|
48
48
|
font-family: ${cssVar.fontFamilyCode};
|
|
49
49
|
font-size: 12px;
|
|
50
|
+
color: ${cssVar.colorError};
|
|
50
51
|
`,
|
|
51
52
|
filled: cx(staticStylish.variantFilledWithoutHover, css`
|
|
52
53
|
background: ${cssVar.colorFillQuaternary};
|
|
53
54
|
`),
|
|
54
55
|
header: css`
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
|
|
58
|
+
position: relative;
|
|
59
|
+
|
|
55
60
|
display: flex;
|
|
56
61
|
gap: 8px;
|
|
57
62
|
align-items: center;
|
|
58
63
|
justify-content: space-between;
|
|
59
64
|
|
|
60
|
-
padding:
|
|
65
|
+
padding: 4px;
|
|
61
66
|
|
|
62
67
|
font-family: ${cssVar.fontFamilyCode};
|
|
63
68
|
font-size: 13px;
|
|
64
69
|
color: ${cssVar.colorTextSecondary};
|
|
65
|
-
|
|
66
|
-
border-block-end: 1px solid ${cssVar.colorBorderSecondary};
|
|
67
70
|
`,
|
|
68
71
|
headerBorderless: css`
|
|
69
72
|
padding-inline: 0;
|
|
70
|
-
border-block-end: none;
|
|
71
73
|
`,
|
|
72
74
|
headerFilled: css`
|
|
73
75
|
background: transparent;
|
|
74
76
|
`,
|
|
75
77
|
headerOutlined: css`
|
|
76
|
-
|
|
78
|
+
& + .${prefix}-body {
|
|
79
|
+
border-block-start: 1px solid ${cssVar.colorFillQuaternary};
|
|
80
|
+
}
|
|
77
81
|
`,
|
|
78
82
|
outlined: staticStylish.variantOutlinedWithoutHover,
|
|
83
|
+
lang: cx(compactLangCls, staticStylish.blur, css`
|
|
84
|
+
position: absolute;
|
|
85
|
+
z-index: 2;
|
|
86
|
+
inset-block-end: 8px;
|
|
87
|
+
inset-inline-end: 8px;
|
|
88
|
+
|
|
89
|
+
font-family: ${cssVar.fontFamilyCode};
|
|
90
|
+
color: ${cssVar.colorTextSecondary};
|
|
91
|
+
|
|
92
|
+
opacity: 0;
|
|
93
|
+
background: ${cssVar.colorFillQuaternary};
|
|
94
|
+
|
|
95
|
+
transition: opacity 0.1s;
|
|
96
|
+
`),
|
|
79
97
|
root: cx(prefix, css`
|
|
80
98
|
position: relative;
|
|
81
99
|
|
|
@@ -86,8 +104,34 @@ const styles = createStaticStyles(({ css, cssVar }) => {
|
|
|
86
104
|
|
|
87
105
|
transition: background-color 100ms ${cssVar.motionEaseOut};
|
|
88
106
|
|
|
107
|
+
.language-title {
|
|
108
|
+
opacity: 0.5;
|
|
109
|
+
filter: grayscale(100%);
|
|
110
|
+
transition:
|
|
111
|
+
opacity,
|
|
112
|
+
grayscale 0.2s ${cssVar.motionEaseInOut};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.panel-actions {
|
|
116
|
+
opacity: 0;
|
|
117
|
+
transition: opacity 0.2s ${cssVar.motionEaseInOut};
|
|
118
|
+
}
|
|
119
|
+
|
|
89
120
|
&:hover {
|
|
90
|
-
|
|
121
|
+
.language-title {
|
|
122
|
+
opacity: 1;
|
|
123
|
+
filter: grayscale(0%);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.panel-actions {
|
|
127
|
+
opacity: 1;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.${compactActionsCls} {
|
|
131
|
+
opacity: 1;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.${compactLangCls} {
|
|
91
135
|
opacity: 1;
|
|
92
136
|
}
|
|
93
137
|
}
|
|
@@ -110,12 +154,19 @@ const variants = cva(styles.root, {
|
|
|
110
154
|
const headerVariants = cva(styles.header, {
|
|
111
155
|
defaultVariants: { variant: "filled" },
|
|
112
156
|
variants: { variant: {
|
|
113
|
-
filled: styles.headerFilled,
|
|
157
|
+
filled: cx(styles.headerFilled, styles.headerOutlined),
|
|
114
158
|
outlined: styles.headerOutlined,
|
|
115
159
|
borderless: styles.headerBorderless
|
|
116
160
|
} }
|
|
117
161
|
});
|
|
162
|
+
const bodyVariants = cva(styles.bodyRoot, {
|
|
163
|
+
defaultVariants: { expand: true },
|
|
164
|
+
variants: { expand: {
|
|
165
|
+
false: styles.bodyCollapsed,
|
|
166
|
+
true: null
|
|
167
|
+
} }
|
|
168
|
+
});
|
|
118
169
|
//#endregion
|
|
119
|
-
export { headerVariants, prefix, styles, variants };
|
|
170
|
+
export { bodyVariants, headerVariants, prefix, styles, variants };
|
|
120
171
|
|
|
121
172
|
//# sourceMappingURL=style.mjs.map
|