@lobehub/ui 5.15.8 → 5.15.10
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/base-ui/Button/Button.d.mts +32 -0
- package/es/base-ui/Button/Button.mjs +100 -0
- package/es/base-ui/Button/Button.mjs.map +1 -0
- package/es/base-ui/Button/index.d.mts +3 -0
- package/es/base-ui/Button/style.d.mts +30 -0
- package/es/base-ui/Button/style.mjs +227 -0
- package/es/base-ui/Button/style.mjs.map +1 -0
- package/es/base-ui/Button/type.d.mts +36 -0
- package/es/base-ui/Modal/Modal.mjs +10 -13
- package/es/base-ui/Modal/Modal.mjs.map +1 -1
- package/es/base-ui/Modal/atoms.mjs +1 -1
- package/es/base-ui/Modal/atoms.mjs.map +1 -1
- package/es/base-ui/Modal/constants.d.mts +2 -0
- package/es/base-ui/Modal/constants.mjs +31 -16
- package/es/base-ui/Modal/constants.mjs.map +1 -1
- package/es/base-ui/Modal/imperative.mjs +7 -13
- package/es/base-ui/Modal/imperative.mjs.map +1 -1
- package/es/base-ui/Modal/style.mjs +47 -98
- package/es/base-ui/Modal/style.mjs.map +1 -1
- package/es/base-ui/Modal/type.d.mts +5 -8
- package/es/base-ui/index.d.mts +5 -2
- package/es/base-ui/index.mjs +4 -2
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.mjs","names":["lobeStaticStylish"],"sources":["../../src/CodeDiff/style.ts"],"sourcesContent":["import { createStaticStyles, cx } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { lobeStaticStylish } from '@/styles';\n\nexport const prefix = 'lobe-code-diff';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => {\n return {\n actions: css`\n position: absolute;\n
|
|
1
|
+
{"version":3,"file":"style.mjs","names":["lobeStaticStylish"],"sources":["../../src/CodeDiff/style.ts"],"sourcesContent":["import { createStaticStyles, cx } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { lobeStaticStylish } from '@/styles';\n\nexport const prefix = 'lobe-code-diff';\nexport const compactActionsCls = `${prefix}-actions-compact`;\nexport const compactLangCls = `${prefix}-lang`;\n\nexport const styles = createStaticStyles(({ css, cssVar }) => {\n return {\n actions: css`\n opacity: 0;\n transition: opacity 0.2s ${cssVar.motionEaseInOut};\n `,\n actionsCompact: cx(\n compactActionsCls,\n css`\n position: absolute;\n z-index: 2;\n inset-block-start: 8px;\n inset-inline-end: 8px;\n\n opacity: 0;\n\n transition: opacity 0.2s ${cssVar.motionEaseInOut};\n `,\n ),\n additions: css`\n font-family: ${cssVar.fontFamilyCode};\n font-size: 12px;\n color: ${cssVar.colorSuccess};\n `,\n body: css`\n overflow: auto;\n\n width: 100%;\n\n font-family: ${cssVar.fontFamilyCode};\n font-size: 13px;\n line-height: 1.6;\n `,\n bodyCollapsed: css`\n height: 0;\n opacity: 0;\n `,\n bodyRoot: css`\n overflow: hidden;\n transition: opacity 0.25s ${cssVar.motionEaseOut};\n `,\n borderless: lobeStaticStylish.variantBorderlessWithoutHover,\n deletions: css`\n font-family: ${cssVar.fontFamilyCode};\n font-size: 12px;\n color: ${cssVar.colorError};\n `,\n filled: cx(\n lobeStaticStylish.variantFilledWithoutHover,\n css`\n background: ${cssVar.colorFillQuaternary};\n `,\n ),\n header: css`\n cursor: pointer;\n\n position: relative;\n\n display: flex;\n gap: 8px;\n align-items: center;\n justify-content: space-between;\n\n padding: 4px;\n\n font-family: ${cssVar.fontFamilyCode};\n font-size: 13px;\n color: ${cssVar.colorTextSecondary};\n `,\n headerBorderless: css`\n padding-inline: 0;\n `,\n headerFilled: css`\n background: transparent;\n `,\n headerOutlined: css`\n & + .${prefix}-body {\n border-block-start: 1px solid ${cssVar.colorFillQuaternary};\n }\n `,\n outlined: lobeStaticStylish.variantOutlinedWithoutHover,\n lang: cx(\n compactLangCls,\n lobeStaticStylish.blur,\n css`\n position: absolute;\n z-index: 2;\n inset-block-end: 8px;\n inset-inline-end: 8px;\n\n font-family: ${cssVar.fontFamilyCode};\n color: ${cssVar.colorTextSecondary};\n\n opacity: 0;\n background: ${cssVar.colorFillQuaternary};\n\n transition: opacity 0.1s;\n `,\n ),\n root: cx(\n prefix,\n css`\n position: relative;\n\n overflow: hidden;\n\n width: 100%;\n border-radius: ${cssVar.borderRadius};\n\n transition: background-color 100ms ${cssVar.motionEaseOut};\n\n .language-title {\n opacity: 0.5;\n filter: grayscale(100%);\n transition:\n opacity,\n grayscale 0.2s ${cssVar.motionEaseInOut};\n }\n\n .panel-actions {\n opacity: 0;\n transition: opacity 0.2s ${cssVar.motionEaseInOut};\n }\n\n &:hover {\n .language-title {\n opacity: 1;\n filter: grayscale(0%);\n }\n\n .panel-actions {\n opacity: 1;\n }\n\n .${compactActionsCls} {\n opacity: 1;\n }\n\n .${compactLangCls} {\n opacity: 1;\n }\n }\n `,\n ),\n stats: css`\n display: flex;\n gap: 8px;\n align-items: center;\n `,\n };\n});\n\nexport const variants = cva(styles.root, {\n defaultVariants: {\n variant: 'filled',\n },\n\n variants: {\n variant: {\n filled: styles.filled,\n outlined: styles.outlined,\n borderless: styles.borderless,\n },\n },\n});\n\nexport const headerVariants = cva(styles.header, {\n defaultVariants: {\n variant: 'filled',\n },\n\n variants: {\n variant: {\n filled: cx(styles.headerFilled, styles.headerOutlined),\n outlined: styles.headerOutlined,\n borderless: styles.headerBorderless,\n },\n },\n});\n\nexport const bodyVariants = cva(styles.bodyRoot, {\n defaultVariants: {\n expand: true,\n },\n variants: {\n expand: {\n false: styles.bodyCollapsed,\n true: null,\n },\n },\n});\n"],"mappings":";;;;AAKA,MAAa,SAAS;AACtB,MAAa,oBAAoB,GAAG,OAAO;AAC3C,MAAa,iBAAiB,GAAG,OAAO;AAExC,MAAa,SAAS,oBAAoB,EAAE,KAAK,aAAa;AAC5D,QAAO;EACL,SAAS,GAAG;;iCAEiB,OAAO,gBAAgB;;EAEpD,gBAAgB,GACd,mBACA,GAAG;;;;;;;;mCAQ0B,OAAO,gBAAgB;QAErD;EACD,WAAW,GAAG;qBACG,OAAO,eAAe;;eAE5B,OAAO,aAAa;;EAE/B,MAAM,GAAG;;;;;qBAKQ,OAAO,eAAe;;;;EAIvC,eAAe,GAAG;;;;EAIlB,UAAU,GAAG;;kCAEiB,OAAO,cAAc;;EAEnD,YAAYA,cAAkB;EAC9B,WAAW,GAAG;qBACG,OAAO,eAAe;;eAE5B,OAAO,WAAW;;EAE7B,QAAQ,GACNA,cAAkB,2BAClB,GAAG;sBACa,OAAO,oBAAoB;QAE5C;EACD,QAAQ,GAAG;;;;;;;;;;;;qBAYM,OAAO,eAAe;;eAE5B,OAAO,mBAAmB;;EAErC,kBAAkB,GAAG;;;EAGrB,cAAc,GAAG;;;EAGjB,gBAAgB,GAAG;aACV,OAAO;wCACoB,OAAO,oBAAoB;;;EAG/D,UAAUA,cAAkB;EAC5B,MAAM,GACJ,gBACAA,cAAkB,MAClB,GAAG;;;;;;uBAMc,OAAO,eAAe;iBAC5B,OAAO,mBAAmB;;;sBAGrB,OAAO,oBAAoB;;;QAI5C;EACD,MAAM,GACJ,QACA,GAAG;;;;;;yBAMgB,OAAO,aAAa;;6CAEA,OAAO,cAAc;;;;;;;6BAOrC,OAAO,gBAAgB;;;;;qCAKf,OAAO,gBAAgB;;;;;;;;;;;;;aAa/C,kBAAkB;;;;aAIlB,eAAe;;;;QAKvB;EACD,OAAO,GAAG;;;;;EAKX;EACD;AAEF,MAAa,WAAW,IAAI,OAAO,MAAM;CACvC,iBAAiB,EACf,SAAS,UACV;CAED,UAAU,EACR,SAAS;EACP,QAAQ,OAAO;EACf,UAAU,OAAO;EACjB,YAAY,OAAO;EACpB,EACF;CACF,CAAC;AAEF,MAAa,iBAAiB,IAAI,OAAO,QAAQ;CAC/C,iBAAiB,EACf,SAAS,UACV;CAED,UAAU,EACR,SAAS;EACP,QAAQ,GAAG,OAAO,cAAc,OAAO,eAAe;EACtD,UAAU,OAAO;EACjB,YAAY,OAAO;EACpB,EACF;CACF,CAAC;AAEF,MAAa,eAAe,IAAI,OAAO,UAAU;CAC/C,iBAAiB,EACf,QAAQ,MACT;CACD,UAAU,EACR,QAAQ;EACN,OAAO,OAAO;EACd,MAAM;EACP,EACF;CACF,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import lobe_theme_default from "../Highlighter/theme/lobe-theme.mjs";
|
|
2
|
+
import { registerCustomTheme, resolveTheme } from "@pierre/diffs";
|
|
3
|
+
//#region src/CodeDiff/theme.ts
|
|
4
|
+
let isLobeDiffThemeRegistered = false;
|
|
5
|
+
const registerLobeDiffThemes = () => {
|
|
6
|
+
if (isLobeDiffThemeRegistered) return;
|
|
7
|
+
registerCustomTheme("lobe-theme", () => Promise.resolve(lobe_theme_default));
|
|
8
|
+
resolveTheme("lobe-theme");
|
|
9
|
+
isLobeDiffThemeRegistered = true;
|
|
10
|
+
};
|
|
11
|
+
const customSeparatorCSS = `
|
|
12
|
+
:host {
|
|
13
|
+
--diffs-dark-bg: transparent !important;
|
|
14
|
+
--diffs-light-bg: transparent !important;
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[data-gutter-buffer] {
|
|
19
|
+
opacity: 0.2 !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[data-code] {
|
|
23
|
+
padding-top: 0 !important;
|
|
24
|
+
padding-bottom: 0 !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[data-gutter] {
|
|
28
|
+
backdrop-filter: blur(16px) !important;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
const getLobeDiffOptions = ({ diffOptions, isDarkMode, viewMode }) => ({
|
|
32
|
+
theme: {
|
|
33
|
+
dark: "lobe-theme",
|
|
34
|
+
light: "lobe-theme"
|
|
35
|
+
},
|
|
36
|
+
themeType: isDarkMode ? "dark" : "light",
|
|
37
|
+
diffStyle: viewMode,
|
|
38
|
+
disableFileHeader: true,
|
|
39
|
+
unsafeCSS: customSeparatorCSS,
|
|
40
|
+
...diffOptions
|
|
41
|
+
});
|
|
42
|
+
//#endregion
|
|
43
|
+
export { getLobeDiffOptions, registerLobeDiffThemes };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=theme.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.mjs","names":["lobeTheme"],"sources":["../../src/CodeDiff/theme.ts"],"sourcesContent":["import type { FileDiffOptions } from '@pierre/diffs';\nimport { registerCustomTheme, resolveTheme } from '@pierre/diffs';\n\nimport lobeTheme from '@/Highlighter/theme/lobe-theme';\n\nimport type { DiffViewMode } from './type';\n\nlet isLobeDiffThemeRegistered = false;\n\nexport const registerLobeDiffThemes = () => {\n if (isLobeDiffThemeRegistered) return;\n\n registerCustomTheme('lobe-theme', () => Promise.resolve(lobeTheme as any));\n void resolveTheme('lobe-theme');\n\n isLobeDiffThemeRegistered = true;\n};\n\nconst customSeparatorCSS = `\n:host {\n --diffs-dark-bg: transparent !important;\n --diffs-light-bg: transparent !important;\n\n}\n\n[data-gutter-buffer] {\n opacity: 0.2 !important;\n}\n\n[data-code] {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n}\n\n[data-gutter] {\n backdrop-filter: blur(16px) !important;\n}\n`;\n\nexport const getLobeDiffOptions = ({\n diffOptions,\n isDarkMode,\n viewMode,\n}: {\n diffOptions?: FileDiffOptions<string>;\n isDarkMode: boolean;\n viewMode: DiffViewMode;\n}): FileDiffOptions<string> => ({\n theme: {\n dark: 'lobe-theme',\n light: 'lobe-theme',\n },\n themeType: isDarkMode ? 'dark' : 'light',\n diffStyle: viewMode,\n disableFileHeader: true,\n unsafeCSS: customSeparatorCSS,\n ...diffOptions,\n});\n"],"mappings":";;;AAOA,IAAI,4BAA4B;AAEhC,MAAa,+BAA+B;AAC1C,KAAI,0BAA2B;AAE/B,qBAAoB,oBAAoB,QAAQ,QAAQA,mBAAiB,CAAC;AACrE,cAAa,aAAa;AAE/B,6BAA4B;;AAG9B,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;AAqB3B,MAAa,sBAAsB,EACjC,aACA,YACA,gBAK8B;CAC9B,OAAO;EACL,MAAM;EACN,OAAO;EACR;CACD,WAAW,aAAa,SAAS;CACjC,WAAW;CACX,mBAAmB;CACnB,WAAW;CACX,GAAG;CACJ"}
|
package/es/CodeDiff/type.d.mts
CHANGED
|
@@ -20,6 +20,11 @@ interface CodeDiffProps extends Omit<FlexboxProps, 'children'> {
|
|
|
20
20
|
body?: string;
|
|
21
21
|
header?: string;
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Whether diff body is expanded by default
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
defaultExpand?: boolean;
|
|
23
28
|
/**
|
|
24
29
|
* Options for the diff component
|
|
25
30
|
*/
|
|
@@ -28,6 +33,11 @@ interface CodeDiffProps extends Omit<FlexboxProps, 'children'> {
|
|
|
28
33
|
* File name to display
|
|
29
34
|
*/
|
|
30
35
|
fileName?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to enable full-featured mode (collapsible header, richer interactions)
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
fullFeatured?: boolean;
|
|
31
41
|
/**
|
|
32
42
|
* Programming language for syntax highlighting
|
|
33
43
|
*/
|
|
@@ -78,6 +88,11 @@ interface PatchDiffProps extends Omit<FlexboxProps, 'children'> {
|
|
|
78
88
|
body?: string;
|
|
79
89
|
header?: string;
|
|
80
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* Whether diff body is expanded by default
|
|
93
|
+
* @default true
|
|
94
|
+
*/
|
|
95
|
+
defaultExpand?: boolean;
|
|
81
96
|
/**
|
|
82
97
|
* Options for the diff component
|
|
83
98
|
*/
|
|
@@ -86,6 +101,11 @@ interface PatchDiffProps extends Omit<FlexboxProps, 'children'> {
|
|
|
86
101
|
* File name to display (optional, extracted from patch if not provided)
|
|
87
102
|
*/
|
|
88
103
|
fileName?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Whether to enable full-featured mode (collapsible header, richer interactions)
|
|
106
|
+
* @default true
|
|
107
|
+
*/
|
|
108
|
+
fullFeatured?: boolean;
|
|
89
109
|
/**
|
|
90
110
|
* Programming language for syntax highlighting
|
|
91
111
|
*/
|
|
@@ -4,9 +4,9 @@ import Center from "../Flex/Center.mjs";
|
|
|
4
4
|
import Icon from "../Icon/Icon.mjs";
|
|
5
5
|
import Text from "../Text/Text.mjs";
|
|
6
6
|
import Button$1 from "../Button/Button.mjs";
|
|
7
|
+
import Tag$1 from "../Tag/Tag.mjs";
|
|
7
8
|
import { useTranslation } from "../i18n/useTranslation.mjs";
|
|
8
9
|
import emojiPicker_default from "../i18n/resources/en/emojiPicker.mjs";
|
|
9
|
-
import Tag$1 from "../Tag/Tag.mjs";
|
|
10
10
|
import { memo, useCallback, useRef, useState } from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { Upload, message } from "antd";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import FlexBasic_default from "../Flex/FlexBasic.mjs";
|
|
3
|
+
import Tag from "../Tag/Tag.mjs";
|
|
3
4
|
import { getCodeLanguageDisplayName } from "./const.mjs";
|
|
4
5
|
import SyntaxHighlighter from "./SyntaxHighlighter/index.mjs";
|
|
5
6
|
import CopyButton from "../CopyButton/CopyButton.mjs";
|
|
6
|
-
import Tag from "../Tag/Tag.mjs";
|
|
7
7
|
import { styles, variants } from "./style.mjs";
|
|
8
8
|
import HighlighterFullFeatured from "./FullFeatured.mjs";
|
|
9
9
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lobe-theme.mjs","names":[],"sources":["../../../src/Highlighter/theme/lobe-theme.ts"],"sourcesContent":["import { cssVar } from 'antd-style';\n\nexport default {\n displayName: 'Lobe Theme',\n name: 'lobe-theme',\n semanticHighlighting: true,\n tokenColors: [\n {\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'string',\n settings: {\n foreground: cssVar.colorSuccess,\n },\n },\n {\n scope: 'punctuation, constant.other.symbol',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'constant.character.escape, text.html constant.character.entity.named',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'constant.language.boolean',\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: 'constant.numeric',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope:\n 'variable, variable.parameter, support.variable, variable.language, support.constant, meta.definition.variable entity.name.function, meta.function-call.arguments',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'keyword.other',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'keyword, modifier, variable.language.this, support.type.object, constant.language',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'entity.name.function, support.function',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope: 'storage.type, storage.modifier, storage.control',\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: 'support.module, support.node',\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'support.type, constant.other.key',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'entity.name.type, entity.other.inherited-class, entity.other',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'comment',\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.colorTextQuaternary,\n },\n },\n {\n scope: 'comment punctuation.definition.comment, string.quoted.docstring',\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.colorTextQuaternary,\n },\n },\n {\n scope: 'punctuation',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'entity.name, entity.name.type.class, support.type, support.class, meta.use',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'variable.object.property, meta.field.declaration entity.name.function',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'meta.definition.method entity.name.function',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'meta.function entity.name.function',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope:\n 'template.expression.begin, template.expression.end, punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'meta.embedded, source.groovy.embedded, meta.template.expression',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'entity.name.tag.yaml',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope:\n 'meta.object-literal.key, meta.object-literal.key string, support.type.property-name.json',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'constant.language.json',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'entity.other.attribute-name.class',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'entity.other.attribute-name.id',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'source.css entity.name.tag',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'support.type.property-name.css',\n settings: {\n foreground: cssVar.colorTextSecondary,\n },\n },\n {\n scope: 'meta.tag, punctuation.definition.tag',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'entity.name.tag',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'entity.other.attribute-name',\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: 'punctuation.definition.entity.html',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'markup.heading',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'text.html.markdown meta.link.inline, meta.link.reference',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'text.html.markdown beginning.punctuation.definition.list',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'markup.italic',\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'markup.bold',\n settings: {\n fontStyle: 'bold',\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'markup.bold markup.italic, markup.italic markup.bold',\n settings: {\n fontStyle: 'italic bold',\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'markup.fenced_code.block.markdown punctuation.definition.markdown',\n settings: {\n foreground: cssVar.colorSuccess,\n },\n },\n {\n scope: 'markup.inline.raw.string.markdown',\n settings: {\n foreground: cssVar.colorSuccess,\n },\n },\n {\n scope: 'keyword.other.definition.ini',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'entity.name.section.group-title.ini',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'source.cs meta.class.identifier storage.type',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'source.cs meta.method.identifier entity.name.function',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'source.cs meta.method-call meta.method, source.cs entity.name.function',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope: 'source.cs storage.type',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'source.cs meta.method.return-type',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'source.cs meta.preprocessor',\n settings: {\n foreground: cssVar.colorTextQuaternary,\n },\n },\n {\n scope: 'source.cs entity.name.type.namespace',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'meta.jsx.children, SXNested',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'support.class.component',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'source.cpp meta.block variable.other',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'source.python meta.member.access.python',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'source.python meta.function-call.python, meta.function-call.arguments',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope: 'meta.block',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'entity.name.function.call',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope: 'source.php support.other.namespace, source.php meta.use support.class',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'constant.keyword',\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'entity.name.function',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n settings: {\n background: '#212121',\n foreground: cssVar.colorText,\n },\n },\n {\n scope: ['constant.other.placeholder'],\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: ['markup.deleted'],\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: ['markup.inserted'],\n settings: {\n foreground: cssVar.colorSuccess,\n },\n },\n {\n scope: ['markup.underline'],\n settings: {\n fontStyle: 'underline',\n },\n },\n {\n scope: ['keyword.control'],\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: ['variable.parameter'],\n settings: {\n fontStyle: 'italic',\n },\n },\n {\n scope: ['variable.parameter.function.language.special.self.python'],\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: ['constant.character.format.placeholder.other.python'],\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: ['markup.quote'],\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: ['punctuation.definition.quote'],\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: ['meta.structure.dictionary.json support.type.property-name.json'],\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.colorSuccess,\n },\n },\n ],\n type: 'dark',\n};\n"],"mappings":";;AAEA,IAAA,qBAAe;CACb,aAAa;CACb,MAAM;CACN,sBAAsB;CACtB,aAAa;EACX,EACE,UAAU,EACR,YAAY,OAAO,WACpB,EACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OACE;GACF,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OACE;GACF,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OACE;GACF,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,oBACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,qBACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD,EACE,UAAU;GACR,YAAY;GACZ,YAAY,OAAO;GACpB,EACF;EACD;GACE,OAAO,CAAC,6BAA6B;GACrC,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO,CAAC,iBAAiB;GACzB,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO,CAAC,kBAAkB;GAC1B,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO,CAAC,mBAAmB;GAC3B,UAAU,EACR,WAAW,aACZ;GACF;EACD;GACE,OAAO,CAAC,kBAAkB;GAC1B,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO,CAAC,qBAAqB;GAC7B,UAAU,EACR,WAAW,UACZ;GACF;EACD;GACE,OAAO,CAAC,2DAA2D;GACnE,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO,CAAC,qDAAqD;GAC7D,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO,CAAC,eAAe;GACvB,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO,CAAC,+BAA+B;GACvC,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO,CAAC,iEAAiE;GACzE,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO,CACL,qIACD;GACD,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO,CACL,yMACD;GACD,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO,CACL,6QACD;GACD,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO,CACL,iVACD;GACD,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO,CACL,qZACD;GACD,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OAAO,CACL,ydACD;GACD,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO,CACL,6hBACD;GACD,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO,CACL,imBACD;GACD,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACF;CACD,MAAM;CACP"}
|
|
1
|
+
{"version":3,"file":"lobe-theme.mjs","names":[],"sources":["../../../src/Highlighter/theme/lobe-theme.ts"],"sourcesContent":["import { cssVar } from 'antd-style';\n\nexport default {\n displayName: 'Lobe Theme',\n name: 'lobe-theme',\n semanticHighlighting: true,\n colors: {\n 'editor.background': cssVar.colorBgContainer,\n },\n tokenColors: [\n {\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'string',\n settings: {\n foreground: cssVar.colorSuccess,\n },\n },\n {\n scope: 'punctuation, constant.other.symbol',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'constant.character.escape, text.html constant.character.entity.named',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'constant.language.boolean',\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: 'constant.numeric',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope:\n 'variable, variable.parameter, support.variable, variable.language, support.constant, meta.definition.variable entity.name.function, meta.function-call.arguments',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'keyword.other',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'keyword, modifier, variable.language.this, support.type.object, constant.language',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'entity.name.function, support.function',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope: 'storage.type, storage.modifier, storage.control',\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: 'support.module, support.node',\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'support.type, constant.other.key',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'entity.name.type, entity.other.inherited-class, entity.other',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'comment',\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.colorTextQuaternary,\n },\n },\n {\n scope: 'comment punctuation.definition.comment, string.quoted.docstring',\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.colorTextQuaternary,\n },\n },\n {\n scope: 'punctuation',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'entity.name, entity.name.type.class, support.type, support.class, meta.use',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'variable.object.property, meta.field.declaration entity.name.function',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'meta.definition.method entity.name.function',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'meta.function entity.name.function',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope:\n 'template.expression.begin, template.expression.end, punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'meta.embedded, source.groovy.embedded, meta.template.expression',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'entity.name.tag.yaml',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope:\n 'meta.object-literal.key, meta.object-literal.key string, support.type.property-name.json',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'constant.language.json',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'entity.other.attribute-name.class',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'entity.other.attribute-name.id',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'source.css entity.name.tag',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'support.type.property-name.css',\n settings: {\n foreground: cssVar.colorTextSecondary,\n },\n },\n {\n scope: 'meta.tag, punctuation.definition.tag',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'entity.name.tag',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'entity.other.attribute-name',\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: 'punctuation.definition.entity.html',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'markup.heading',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'text.html.markdown meta.link.inline, meta.link.reference',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'text.html.markdown beginning.punctuation.definition.list',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'markup.italic',\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'markup.bold',\n settings: {\n fontStyle: 'bold',\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'markup.bold markup.italic, markup.italic markup.bold',\n settings: {\n fontStyle: 'italic bold',\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'markup.fenced_code.block.markdown punctuation.definition.markdown',\n settings: {\n foreground: cssVar.colorSuccess,\n },\n },\n {\n scope: 'markup.inline.raw.string.markdown',\n settings: {\n foreground: cssVar.colorSuccess,\n },\n },\n {\n scope: 'keyword.other.definition.ini',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'entity.name.section.group-title.ini',\n settings: {\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'source.cs meta.class.identifier storage.type',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'source.cs meta.method.identifier entity.name.function',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'source.cs meta.method-call meta.method, source.cs entity.name.function',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope: 'source.cs storage.type',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'source.cs meta.method.return-type',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'source.cs meta.preprocessor',\n settings: {\n foreground: cssVar.colorTextQuaternary,\n },\n },\n {\n scope: 'source.cs entity.name.type.namespace',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'meta.jsx.children, SXNested',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'support.class.component',\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: 'source.cpp meta.block variable.other',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'source.python meta.member.access.python',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'source.python meta.function-call.python, meta.function-call.arguments',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope: 'meta.block',\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: 'entity.name.function.call',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope: 'source.php support.other.namespace, source.php meta.use support.class',\n settings: {\n foreground: cssVar.colorText,\n },\n },\n {\n scope: 'constant.keyword',\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: 'entity.name.function',\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n settings: {\n background: '#212121',\n foreground: cssVar.colorText,\n },\n },\n {\n scope: ['constant.other.placeholder'],\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: ['markup.deleted'],\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: ['markup.inserted'],\n settings: {\n foreground: cssVar.colorSuccess,\n },\n },\n {\n scope: ['markup.underline'],\n settings: {\n fontStyle: 'underline',\n },\n },\n {\n scope: ['keyword.control'],\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: ['variable.parameter'],\n settings: {\n fontStyle: 'italic',\n },\n },\n {\n scope: ['variable.parameter.function.language.special.self.python'],\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: ['constant.character.format.placeholder.other.python'],\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: ['markup.quote'],\n settings: {\n fontStyle: 'italic',\n foreground: cssVar.colorInfo,\n },\n },\n {\n scope: ['punctuation.definition.quote'],\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: ['meta.structure.dictionary.json support.type.property-name.json'],\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.volcano10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.colorWarning,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.geekblue10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.purple10,\n },\n },\n {\n scope: [\n 'meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json',\n ],\n settings: {\n foreground: cssVar.colorSuccess,\n },\n },\n ],\n type: 'dark',\n};\n"],"mappings":";;AAEA,IAAA,qBAAe;CACb,aAAa;CACb,MAAM;CACN,sBAAsB;CACtB,QAAQ,EACN,qBAAqB,OAAO,kBAC7B;CACD,aAAa;EACX,EACE,UAAU,EACR,YAAY,OAAO,WACpB,EACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OACE;GACF,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OACE;GACF,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OACE;GACF,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,oBACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,qBACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO;GACP,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO;GACP,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD,EACE,UAAU;GACR,YAAY;GACZ,YAAY,OAAO;GACpB,EACF;EACD;GACE,OAAO,CAAC,6BAA6B;GACrC,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO,CAAC,iBAAiB;GACzB,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO,CAAC,kBAAkB;GAC1B,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO,CAAC,mBAAmB;GAC3B,UAAU,EACR,WAAW,aACZ;GACF;EACD;GACE,OAAO,CAAC,kBAAkB;GAC1B,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO,CAAC,qBAAqB;GAC7B,UAAU,EACR,WAAW,UACZ;GACF;EACD;GACE,OAAO,CAAC,2DAA2D;GACnE,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO,CAAC,qDAAqD;GAC7D,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO,CAAC,eAAe;GACvB,UAAU;IACR,WAAW;IACX,YAAY,OAAO;IACpB;GACF;EACD;GACE,OAAO,CAAC,+BAA+B;GACvC,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO,CAAC,iEAAiE;GACzE,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO,CACL,qIACD;GACD,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO,CACL,yMACD;GACD,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO,CACL,6QACD;GACD,UAAU,EACR,YAAY,OAAO,WACpB;GACF;EACD;GACE,OAAO,CACL,iVACD;GACD,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACD;GACE,OAAO,CACL,qZACD;GACD,UAAU,EACR,YAAY,OAAO,YACpB;GACF;EACD;GACE,OAAO,CACL,ydACD;GACD,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO,CACL,6hBACD;GACD,UAAU,EACR,YAAY,OAAO,UACpB;GACF;EACD;GACE,OAAO,CACL,imBACD;GACD,UAAU,EACR,YAAY,OAAO,cACpB;GACF;EACF;CACD,MAAM;CACP"}
|
package/es/Mermaid/Mermaid.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import FlexBasic_default from "../Flex/FlexBasic.mjs";
|
|
3
|
-
import CopyButton from "../CopyButton/CopyButton.mjs";
|
|
4
3
|
import Tag from "../Tag/Tag.mjs";
|
|
4
|
+
import CopyButton from "../CopyButton/CopyButton.mjs";
|
|
5
5
|
import { styles, variants } from "../Highlighter/style.mjs";
|
|
6
6
|
import MermaidFullFeatured from "./FullFeatured.mjs";
|
|
7
7
|
import SyntaxMermaid from "./SyntaxMermaid/index.mjs";
|
package/es/Tag/Tag.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { safeReadableColor } from "../utils/safeReadableColor.mjs";
|
|
2
3
|
import { colorsPreset, colorsPresetSystem, presetColors, presetSystemColors } from "./utils.mjs";
|
|
3
4
|
import { variants } from "./styles.mjs";
|
|
4
5
|
import { useMemo } from "react";
|
|
@@ -6,29 +7,40 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
7
|
import { Tag } from "antd";
|
|
7
8
|
import { cssVar, cx } from "antd-style";
|
|
8
9
|
//#region src/Tag/Tag.tsx
|
|
9
|
-
const Tag$1 = ({ className, ref, size = "middle", color, variant = "filled", children, onClick, style, ...rest }) => {
|
|
10
|
+
const Tag$1 = ({ className, ref, shape = "normal", size = "middle", color, variant = "filled", children, onClick, style, ...rest }) => {
|
|
10
11
|
const colors = useMemo(() => {
|
|
12
|
+
const resolveActualColor = (colorValue) => {
|
|
13
|
+
if (!colorValue || !colorValue.startsWith("var(")) return colorValue;
|
|
14
|
+
if (typeof window === "undefined") return colorValue;
|
|
15
|
+
const matched = colorValue.match(/var\((--[^,\s)]+)/);
|
|
16
|
+
if (!matched?.[1]) return colorValue;
|
|
17
|
+
return window.getComputedStyle(document.documentElement).getPropertyValue(matched[1]).trim() || colorValue;
|
|
18
|
+
};
|
|
11
19
|
let textColor = cssVar.colorTextSecondary;
|
|
12
20
|
let backgroundColor;
|
|
13
21
|
let borderColor;
|
|
14
22
|
const isBorderless = variant === "borderless";
|
|
15
23
|
const isFilled = variant === "filled";
|
|
24
|
+
const isSolid = variant === "solid";
|
|
16
25
|
const isPresetColor = color && presetColors.includes(color);
|
|
17
26
|
const isPresetSystemColors = color && presetSystemColors.has(color);
|
|
18
27
|
const isHexColor = color && color.startsWith("#");
|
|
19
28
|
if (isPresetColor) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
const solidBgColor = colorsPreset(color);
|
|
30
|
+
textColor = isSolid ? safeReadableColor(resolveActualColor(solidBgColor) || solidBgColor) : colorsPreset(color, "active");
|
|
31
|
+
backgroundColor = isSolid ? solidBgColor : isBorderless ? "transparent" : colorsPreset(color, "fillTertiary");
|
|
32
|
+
borderColor = isSolid ? solidBgColor : colorsPreset(color, isFilled ? "fillQuaternary" : "fillTertiary");
|
|
23
33
|
}
|
|
24
34
|
if (isPresetSystemColors) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
const solidBgColor = colorsPresetSystem(color);
|
|
36
|
+
textColor = isSolid ? safeReadableColor(resolveActualColor(solidBgColor) || solidBgColor) : colorsPresetSystem(color);
|
|
37
|
+
backgroundColor = isSolid ? solidBgColor : isBorderless ? "transparent" : colorsPresetSystem(color, "fillTertiary");
|
|
38
|
+
borderColor = isSolid ? solidBgColor : colorsPresetSystem(color, isFilled ? "fillQuaternary" : "fillTertiary");
|
|
28
39
|
}
|
|
29
40
|
if (isHexColor) {
|
|
30
|
-
textColor = cssVar.colorBgLayout;
|
|
31
|
-
backgroundColor = isBorderless ? "transparent" : color;
|
|
41
|
+
textColor = isSolid ? safeReadableColor(color) : cssVar.colorBgLayout;
|
|
42
|
+
backgroundColor = isSolid ? color : isBorderless ? "transparent" : color;
|
|
43
|
+
borderColor = isSolid ? color : borderColor;
|
|
32
44
|
}
|
|
33
45
|
return {
|
|
34
46
|
backgroundColor,
|
|
@@ -38,12 +50,13 @@ const Tag$1 = ({ className, ref, size = "middle", color, variant = "filled", chi
|
|
|
38
50
|
}, [color, variant]);
|
|
39
51
|
return /* @__PURE__ */ jsx(Tag, {
|
|
40
52
|
className: cx(variants({
|
|
53
|
+
shape,
|
|
41
54
|
size,
|
|
42
55
|
variant
|
|
43
56
|
}), className),
|
|
44
57
|
color,
|
|
45
58
|
ref,
|
|
46
|
-
variant: variant === "borderless" ? "outlined" : variant,
|
|
59
|
+
variant: variant === "borderless" ? "outlined" : variant === "solid" ? "filled" : variant,
|
|
47
60
|
style: {
|
|
48
61
|
background: colors?.backgroundColor,
|
|
49
62
|
borderColor: colors?.borderColor,
|
package/es/Tag/Tag.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.mjs","names":["Tag","AntTag"],"sources":["../../src/Tag/Tag.tsx"],"sourcesContent":["'use client';\n\nimport { Tag as AntTag } from 'antd';\nimport { cssVar, cx } from 'antd-style';\nimport { type FC, useMemo } from 'react';\n\nimport { colorsPreset, colorsPresetSystem, presetColors, presetSystemColors } from '@/Tag/utils';\n\nimport { variants } from './styles';\nimport type { TagProps } from './type';\n\nconst Tag: FC<TagProps> = ({\n className,\n ref,\n size = 'middle',\n color,\n variant = 'filled',\n children,\n onClick,\n style,\n ...rest\n}) => {\n const colors = useMemo(() => {\n let textColor = cssVar.colorTextSecondary;\n let backgroundColor;\n let borderColor;\n const isBorderless = variant === 'borderless';\n const isFilled = variant === 'filled';\n const isPresetColor = color && presetColors.includes(color);\n const isPresetSystemColors = color && presetSystemColors.has(color);\n const isHexColor = color && color.startsWith('#');\n\n if (isPresetColor) {\n textColor = colorsPreset(color, 'active');\n backgroundColor = isBorderless
|
|
1
|
+
{"version":3,"file":"Tag.mjs","names":["Tag","AntTag"],"sources":["../../src/Tag/Tag.tsx"],"sourcesContent":["'use client';\n\nimport { Tag as AntTag } from 'antd';\nimport { cssVar, cx } from 'antd-style';\nimport { type FC, useMemo } from 'react';\n\nimport { colorsPreset, colorsPresetSystem, presetColors, presetSystemColors } from '@/Tag/utils';\nimport { safeReadableColor } from '@/utils/safeReadableColor';\n\nimport { variants } from './styles';\nimport type { TagProps } from './type';\n\nconst Tag: FC<TagProps> = ({\n className,\n ref,\n shape = 'normal',\n size = 'middle',\n color,\n variant = 'filled',\n children,\n onClick,\n style,\n ...rest\n}) => {\n const colors = useMemo(() => {\n const resolveActualColor = (colorValue?: string) => {\n if (!colorValue || !colorValue.startsWith('var(')) return colorValue;\n if (typeof window === 'undefined') return colorValue;\n\n const matched = colorValue.match(/var\\((--[^,\\s)]+)/);\n if (!matched?.[1]) return colorValue;\n\n const resolved = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(matched[1])\n .trim();\n\n return resolved || colorValue;\n };\n\n let textColor = cssVar.colorTextSecondary;\n let backgroundColor;\n let borderColor;\n const isBorderless = variant === 'borderless';\n const isFilled = variant === 'filled';\n const isSolid = variant === 'solid';\n const isPresetColor = color && presetColors.includes(color);\n const isPresetSystemColors = color && presetSystemColors.has(color);\n const isHexColor = color && color.startsWith('#');\n\n if (isPresetColor) {\n const solidBgColor = colorsPreset(color);\n textColor = isSolid\n ? safeReadableColor(resolveActualColor(solidBgColor) || solidBgColor)\n : colorsPreset(color, 'active');\n backgroundColor = isSolid\n ? solidBgColor\n : isBorderless\n ? 'transparent'\n : colorsPreset(color, 'fillTertiary');\n borderColor = isSolid\n ? solidBgColor\n : colorsPreset(color, isFilled ? 'fillQuaternary' : 'fillTertiary');\n }\n if (isPresetSystemColors) {\n const solidBgColor = colorsPresetSystem(color);\n textColor = isSolid\n ? safeReadableColor(resolveActualColor(solidBgColor) || solidBgColor)\n : colorsPresetSystem(color);\n backgroundColor = isSolid\n ? solidBgColor\n : isBorderless\n ? 'transparent'\n : colorsPresetSystem(color, 'fillTertiary');\n borderColor = isSolid\n ? solidBgColor\n : colorsPresetSystem(color, isFilled ? 'fillQuaternary' : 'fillTertiary');\n }\n if (isHexColor) {\n textColor = isSolid ? safeReadableColor(color) : cssVar.colorBgLayout;\n backgroundColor = isSolid ? color : isBorderless ? 'transparent' : color;\n borderColor = isSolid ? color : borderColor;\n }\n\n return {\n backgroundColor,\n borderColor,\n textColor,\n };\n }, [color, variant]);\n\n return (\n <AntTag\n className={cx(variants({ shape, size, variant: variant as any }), className)}\n color={color}\n ref={ref}\n variant={variant === 'borderless' ? 'outlined' : variant === 'solid' ? 'filled' : variant}\n style={{\n background: colors?.backgroundColor,\n borderColor: colors?.borderColor,\n color: colors?.textColor,\n cursor: onClick ? 'pointer' : undefined,\n ...style,\n }}\n onClick={onClick}\n {...rest}\n >\n {children}\n </AntTag>\n );\n};\n\nTag.displayName = 'Tag';\n\nexport default Tag;\n"],"mappings":";;;;;;;;;AAYA,MAAMA,SAAqB,EACzB,WACA,KACA,QAAQ,UACR,OAAO,UACP,OACA,UAAU,UACV,UACA,SACA,OACA,GAAG,WACC;CACJ,MAAM,SAAS,cAAc;EAC3B,MAAM,sBAAsB,eAAwB;AAClD,OAAI,CAAC,cAAc,CAAC,WAAW,WAAW,OAAO,CAAE,QAAO;AAC1D,OAAI,OAAO,WAAW,YAAa,QAAO;GAE1C,MAAM,UAAU,WAAW,MAAM,oBAAoB;AACrD,OAAI,CAAC,UAAU,GAAI,QAAO;AAO1B,UALiB,OACd,iBAAiB,SAAS,gBAAgB,CAC1C,iBAAiB,QAAQ,GAAG,CAC5B,MAEY,IAAI;;EAGrB,IAAI,YAAY,OAAO;EACvB,IAAI;EACJ,IAAI;EACJ,MAAM,eAAe,YAAY;EACjC,MAAM,WAAW,YAAY;EAC7B,MAAM,UAAU,YAAY;EAC5B,MAAM,gBAAgB,SAAS,aAAa,SAAS,MAAM;EAC3D,MAAM,uBAAuB,SAAS,mBAAmB,IAAI,MAAM;EACnE,MAAM,aAAa,SAAS,MAAM,WAAW,IAAI;AAEjD,MAAI,eAAe;GACjB,MAAM,eAAe,aAAa,MAAM;AACxC,eAAY,UACR,kBAAkB,mBAAmB,aAAa,IAAI,aAAa,GACnE,aAAa,OAAO,SAAS;AACjC,qBAAkB,UACd,eACA,eACE,gBACA,aAAa,OAAO,eAAe;AACzC,iBAAc,UACV,eACA,aAAa,OAAO,WAAW,mBAAmB,eAAe;;AAEvE,MAAI,sBAAsB;GACxB,MAAM,eAAe,mBAAmB,MAAM;AAC9C,eAAY,UACR,kBAAkB,mBAAmB,aAAa,IAAI,aAAa,GACnE,mBAAmB,MAAM;AAC7B,qBAAkB,UACd,eACA,eACE,gBACA,mBAAmB,OAAO,eAAe;AAC/C,iBAAc,UACV,eACA,mBAAmB,OAAO,WAAW,mBAAmB,eAAe;;AAE7E,MAAI,YAAY;AACd,eAAY,UAAU,kBAAkB,MAAM,GAAG,OAAO;AACxD,qBAAkB,UAAU,QAAQ,eAAe,gBAAgB;AACnE,iBAAc,UAAU,QAAQ;;AAGlC,SAAO;GACL;GACA;GACA;GACD;IACA,CAAC,OAAO,QAAQ,CAAC;AAEpB,QACE,oBAACC,KAAD;EACE,WAAW,GAAG,SAAS;GAAE;GAAO;GAAe;GAAgB,CAAC,EAAE,UAAU;EACrE;EACF;EACL,SAAS,YAAY,eAAe,aAAa,YAAY,UAAU,WAAW;EAClF,OAAO;GACL,YAAY,QAAQ;GACpB,aAAa,QAAQ;GACrB,OAAO,QAAQ;GACf,QAAQ,UAAU,YAAY,KAAA;GAC9B,GAAG;GACJ;EACQ;EACT,GAAI;EAEH;EACM,CAAA;;AAIb,MAAI,cAAc"}
|
package/es/Tag/styles.mjs
CHANGED
|
@@ -14,6 +14,26 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
14
14
|
}
|
|
15
15
|
`,
|
|
16
16
|
outlined: staticStylish.variantOutlinedWithoutHover,
|
|
17
|
+
round: css`
|
|
18
|
+
&.${prefixCls}-tag {
|
|
19
|
+
border-radius: 999px !important;
|
|
20
|
+
}
|
|
21
|
+
`,
|
|
22
|
+
roundLarge: css`
|
|
23
|
+
&.${prefixCls}-tag {
|
|
24
|
+
padding-inline: 14px;
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
roundMiddle: css`
|
|
28
|
+
&.${prefixCls}-tag {
|
|
29
|
+
padding-inline: 10px;
|
|
30
|
+
}
|
|
31
|
+
`,
|
|
32
|
+
roundSmall: css`
|
|
33
|
+
&.${prefixCls}-tag {
|
|
34
|
+
padding-inline: 8px;
|
|
35
|
+
}
|
|
36
|
+
`,
|
|
17
37
|
root: css`
|
|
18
38
|
color: ${cssVar.colorTextSecondary};
|
|
19
39
|
|
|
@@ -51,14 +71,37 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
51
71
|
}));
|
|
52
72
|
const variants = cva(styles.root, {
|
|
53
73
|
defaultVariants: {
|
|
74
|
+
shape: "normal",
|
|
54
75
|
size: "middle",
|
|
55
76
|
variant: "filled"
|
|
56
77
|
},
|
|
78
|
+
compoundVariants: [
|
|
79
|
+
{
|
|
80
|
+
className: styles.roundSmall,
|
|
81
|
+
shape: "round",
|
|
82
|
+
size: "small"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
className: styles.roundMiddle,
|
|
86
|
+
shape: "round",
|
|
87
|
+
size: "middle"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
className: styles.roundLarge,
|
|
91
|
+
shape: "round",
|
|
92
|
+
size: "large"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
57
95
|
variants: {
|
|
96
|
+
shape: {
|
|
97
|
+
normal: null,
|
|
98
|
+
round: styles.round
|
|
99
|
+
},
|
|
58
100
|
variant: {
|
|
59
101
|
filled: styles.filled,
|
|
60
102
|
outlined: styles.outlined,
|
|
61
|
-
borderless: styles.borderless
|
|
103
|
+
borderless: styles.borderless,
|
|
104
|
+
solid: styles.filled
|
|
62
105
|
},
|
|
63
106
|
size: {
|
|
64
107
|
small: styles.small,
|
package/es/Tag/styles.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.mjs","names":["lobeStaticStylish"],"sources":["../../src/Tag/styles.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { lobeStaticStylish } from '@/styles';\n\nconst prefixCls = 'ant';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n borderless: lobeStaticStylish.variantBorderlessWithoutHover,\n filled: lobeStaticStylish.variantFilledWithoutHover,\n large: css`\n &.${prefixCls}-tag {\n height: 28px;\n padding-inline: 12px;\n border-radius: 6px !important;\n }\n `,\n outlined: lobeStaticStylish.variantOutlinedWithoutHover,\n root: css`\n color: ${cssVar.colorTextSecondary};\n\n &.${prefixCls}-tag {\n user-select: none;\n\n display: flex;\n gap: 0.4em;\n align-items: center;\n justify-content: center;\n\n width: fit-content;\n height: 22px;\n margin: 0;\n border-radius: 3px;\n\n line-height: 1.2;\n\n span {\n margin: 0;\n }\n\n span:not(.anticon) {\n line-height: inherit;\n }\n }\n `,\n small: css`\n &.${prefixCls}-tag {\n height: 20px;\n padding-inline: 4px;\n border-radius: 3px;\n }\n `,\n}));\n\nexport const variants = cva(styles.root, {\n defaultVariants: {\n size: 'middle',\n variant: 'filled',\n },\n\n variants: {\n variant: {\n filled: styles.filled,\n outlined: styles.outlined,\n borderless: styles.borderless,\n },\n size: {\n small: styles.small,\n middle: null,\n large: styles.large,\n },\n },\n});\n"],"mappings":";;;;AAKA,MAAM,YAAY;AAElB,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,YAAYA,cAAkB;CAC9B,QAAQA,cAAkB;CAC1B,OAAO,GAAG;QACJ,UAAU;;;;;;CAMhB,UAAUA,cAAkB;CAC5B,MAAM,GAAG;aACE,OAAO,mBAAmB;;QAE/B,UAAU;;;;;;;;;;;;;;;;;;;;;;;;CAwBhB,OAAO,GAAG;QACJ,UAAU;;;;;;CAMjB,EAAE;AAEH,MAAa,WAAW,IAAI,OAAO,MAAM;CACvC,iBAAiB;EACf,MAAM;EACN,SAAS;EACV;CAED,UAAU;EACR,SAAS;GACP,QAAQ,OAAO;GACf,UAAU,OAAO;GACjB,YAAY,OAAO;
|
|
1
|
+
{"version":3,"file":"styles.mjs","names":["lobeStaticStylish"],"sources":["../../src/Tag/styles.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { lobeStaticStylish } from '@/styles';\n\nconst prefixCls = 'ant';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n borderless: lobeStaticStylish.variantBorderlessWithoutHover,\n filled: lobeStaticStylish.variantFilledWithoutHover,\n large: css`\n &.${prefixCls}-tag {\n height: 28px;\n padding-inline: 12px;\n border-radius: 6px !important;\n }\n `,\n outlined: lobeStaticStylish.variantOutlinedWithoutHover,\n round: css`\n &.${prefixCls}-tag {\n border-radius: 999px !important;\n }\n `,\n roundLarge: css`\n &.${prefixCls}-tag {\n padding-inline: 14px;\n }\n `,\n roundMiddle: css`\n &.${prefixCls}-tag {\n padding-inline: 10px;\n }\n `,\n roundSmall: css`\n &.${prefixCls}-tag {\n padding-inline: 8px;\n }\n `,\n root: css`\n color: ${cssVar.colorTextSecondary};\n\n &.${prefixCls}-tag {\n user-select: none;\n\n display: flex;\n gap: 0.4em;\n align-items: center;\n justify-content: center;\n\n width: fit-content;\n height: 22px;\n margin: 0;\n border-radius: 3px;\n\n line-height: 1.2;\n\n span {\n margin: 0;\n }\n\n span:not(.anticon) {\n line-height: inherit;\n }\n }\n `,\n small: css`\n &.${prefixCls}-tag {\n height: 20px;\n padding-inline: 4px;\n border-radius: 3px;\n }\n `,\n}));\n\nexport const variants = cva(styles.root, {\n defaultVariants: {\n shape: 'normal',\n size: 'middle',\n variant: 'filled',\n },\n\n compoundVariants: [\n {\n className: styles.roundSmall,\n shape: 'round',\n size: 'small',\n },\n {\n className: styles.roundMiddle,\n shape: 'round',\n size: 'middle',\n },\n {\n className: styles.roundLarge,\n shape: 'round',\n size: 'large',\n },\n ],\n\n variants: {\n shape: {\n normal: null,\n round: styles.round,\n },\n variant: {\n filled: styles.filled,\n outlined: styles.outlined,\n borderless: styles.borderless,\n solid: styles.filled,\n },\n size: {\n small: styles.small,\n middle: null,\n large: styles.large,\n },\n },\n});\n"],"mappings":";;;;AAKA,MAAM,YAAY;AAElB,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,YAAYA,cAAkB;CAC9B,QAAQA,cAAkB;CAC1B,OAAO,GAAG;QACJ,UAAU;;;;;;CAMhB,UAAUA,cAAkB;CAC5B,OAAO,GAAG;QACJ,UAAU;;;;CAIhB,YAAY,GAAG;QACT,UAAU;;;;CAIhB,aAAa,GAAG;QACV,UAAU;;;;CAIhB,YAAY,GAAG;QACT,UAAU;;;;CAIhB,MAAM,GAAG;aACE,OAAO,mBAAmB;;QAE/B,UAAU;;;;;;;;;;;;;;;;;;;;;;;;CAwBhB,OAAO,GAAG;QACJ,UAAU;;;;;;CAMjB,EAAE;AAEH,MAAa,WAAW,IAAI,OAAO,MAAM;CACvC,iBAAiB;EACf,OAAO;EACP,MAAM;EACN,SAAS;EACV;CAED,kBAAkB;EAChB;GACE,WAAW,OAAO;GAClB,OAAO;GACP,MAAM;GACP;EACD;GACE,WAAW,OAAO;GAClB,OAAO;GACP,MAAM;GACP;EACD;GACE,WAAW,OAAO;GAClB,OAAO;GACP,MAAM;GACP;EACF;CAED,UAAU;EACR,OAAO;GACL,QAAQ;GACR,OAAO,OAAO;GACf;EACD,SAAS;GACP,QAAQ,OAAO;GACf,UAAU,OAAO;GACjB,YAAY,OAAO;GACnB,OAAO,OAAO;GACf;EACD,MAAM;GACJ,OAAO,OAAO;GACd,QAAQ;GACR,OAAO,OAAO;GACf;EACF;CACF,CAAC"}
|
package/es/Tag/type.d.mts
CHANGED
|
@@ -5,8 +5,9 @@ import { TagProps } from "antd";
|
|
|
5
5
|
interface TagProps$1 extends Omit<TagProps, 'color' | 'variant'> {
|
|
6
6
|
color?: TagProps['color'] | 'info';
|
|
7
7
|
ref?: Ref<HTMLDivElement>;
|
|
8
|
+
shape?: 'normal' | 'round';
|
|
8
9
|
size?: 'small' | 'middle' | 'large';
|
|
9
|
-
variant?: 'filled' | 'outlined' | 'borderless';
|
|
10
|
+
variant?: 'filled' | 'outlined' | 'borderless' | 'solid';
|
|
10
11
|
}
|
|
11
12
|
//#endregion
|
|
12
13
|
export { TagProps$1 as TagProps };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ButtonProps } from "./type.mjs";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/base-ui/Button/Button.d.ts
|
|
5
|
+
declare const Button: {
|
|
6
|
+
({
|
|
7
|
+
block,
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
classNames,
|
|
11
|
+
danger,
|
|
12
|
+
disabled,
|
|
13
|
+
ghost,
|
|
14
|
+
href,
|
|
15
|
+
htmlType,
|
|
16
|
+
icon,
|
|
17
|
+
iconPosition,
|
|
18
|
+
loading,
|
|
19
|
+
onClick,
|
|
20
|
+
ref,
|
|
21
|
+
shape,
|
|
22
|
+
size,
|
|
23
|
+
styles: userStyles,
|
|
24
|
+
target,
|
|
25
|
+
type,
|
|
26
|
+
...rest
|
|
27
|
+
}: ButtonProps): _$react_jsx_runtime0.JSX.Element;
|
|
28
|
+
displayName: string;
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Button };
|
|
32
|
+
//# sourceMappingURL=Button.d.mts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMotionComponent } from "../../MotionProvider/index.mjs";
|
|
3
|
+
import { styles } from "./style.mjs";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { cx } from "antd-style";
|
|
6
|
+
//#region src/base-ui/Button/Button.tsx
|
|
7
|
+
const resolveSizeCls = (size) => {
|
|
8
|
+
if (size === "small") return styles.sizeSmall;
|
|
9
|
+
if (size === "large") return styles.sizeLarge;
|
|
10
|
+
return styles.sizeMiddle;
|
|
11
|
+
};
|
|
12
|
+
const resolveIconOnlySizeCls = (size) => {
|
|
13
|
+
if (size === "small") return styles.iconOnlySmall;
|
|
14
|
+
if (size === "large") return styles.iconOnlyLarge;
|
|
15
|
+
return styles.iconOnlyMiddle;
|
|
16
|
+
};
|
|
17
|
+
const resolveVariantCls = ({ danger, ghost, type }) => {
|
|
18
|
+
if (ghost) {
|
|
19
|
+
if (danger) return styles.ghostDanger;
|
|
20
|
+
if (type === "primary") return styles.ghostPrimary;
|
|
21
|
+
return styles.ghostDefault;
|
|
22
|
+
}
|
|
23
|
+
switch (type) {
|
|
24
|
+
case "primary": return danger ? styles.dangerSolid : styles.variantPrimary;
|
|
25
|
+
case "dashed": return danger ? cx(styles.variantDashed, styles.dangerOutlined) : styles.variantDashed;
|
|
26
|
+
case "text": return danger ? cx(styles.variantText, styles.dangerInline) : styles.variantText;
|
|
27
|
+
case "link": return danger ? cx(styles.variantLink, styles.dangerInline) : styles.variantLink;
|
|
28
|
+
default: return danger ? cx(styles.variantDefault, styles.dangerOutlined) : styles.variantDefault;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const hoverAnim = { y: -.5 };
|
|
32
|
+
const tapAnim = { scale: .96 };
|
|
33
|
+
const motionTransition = {
|
|
34
|
+
damping: 26,
|
|
35
|
+
mass: .6,
|
|
36
|
+
stiffness: 600,
|
|
37
|
+
type: "spring"
|
|
38
|
+
};
|
|
39
|
+
const Button = ({ block, children, className, classNames, danger = false, disabled, ghost = false, href, htmlType = "button", icon, iconPosition = "start", loading, onClick, ref, shape = "default", size = "middle", styles: userStyles, target, type = "default", ...rest }) => {
|
|
40
|
+
const Motion = useMotionComponent();
|
|
41
|
+
const isDisabled = disabled || loading;
|
|
42
|
+
const sizeCls = resolveSizeCls(size);
|
|
43
|
+
const variantCls = resolveVariantCls({
|
|
44
|
+
danger,
|
|
45
|
+
ghost,
|
|
46
|
+
type
|
|
47
|
+
});
|
|
48
|
+
const shapeCls = shape === "circle" ? styles.shapeCircle : shape === "round" ? styles.shapeRound : void 0;
|
|
49
|
+
const iconOnlySizeCls = !(children !== void 0 && children !== null && children !== false && children !== "") && !!(loading || icon) ? resolveIconOnlySizeCls(size) : void 0;
|
|
50
|
+
const composedClassName = cx(styles.base, sizeCls, variantCls, shapeCls, block && styles.block, iconPosition === "end" && styles.iconEnd, iconOnlySizeCls, className);
|
|
51
|
+
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [loading ? /* @__PURE__ */ jsx("span", {
|
|
52
|
+
className: cx(styles.iconBox, classNames?.icon),
|
|
53
|
+
style: userStyles?.icon,
|
|
54
|
+
children: /* @__PURE__ */ jsx("span", { className: styles.spinner })
|
|
55
|
+
}) : icon ? /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: cx(styles.iconBox, classNames?.icon),
|
|
57
|
+
style: userStyles?.icon,
|
|
58
|
+
children: icon
|
|
59
|
+
}) : null, children] });
|
|
60
|
+
const motionGestures = isDisabled ? {} : {
|
|
61
|
+
transition: motionTransition,
|
|
62
|
+
whileHover: hoverAnim,
|
|
63
|
+
whileTap: tapAnim
|
|
64
|
+
};
|
|
65
|
+
if (href !== void 0) {
|
|
66
|
+
const handleAnchorClick = (e) => {
|
|
67
|
+
if (isDisabled) {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
onClick?.(e);
|
|
72
|
+
};
|
|
73
|
+
return /* @__PURE__ */ jsx(Motion.a, {
|
|
74
|
+
"aria-disabled": isDisabled || void 0,
|
|
75
|
+
href: isDisabled ? void 0 : href,
|
|
76
|
+
target,
|
|
77
|
+
...rest,
|
|
78
|
+
className: composedClassName,
|
|
79
|
+
ref,
|
|
80
|
+
onClick: handleAnchorClick,
|
|
81
|
+
...motionGestures,
|
|
82
|
+
children: inner
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return /* @__PURE__ */ jsx(Motion.button, {
|
|
86
|
+
type: htmlType,
|
|
87
|
+
...rest,
|
|
88
|
+
className: composedClassName,
|
|
89
|
+
disabled: isDisabled,
|
|
90
|
+
ref,
|
|
91
|
+
onClick,
|
|
92
|
+
...motionGestures,
|
|
93
|
+
children: inner
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
Button.displayName = "BaseButton";
|
|
97
|
+
//#endregion
|
|
98
|
+
export { Button as default };
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=Button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.mjs","names":[],"sources":["../../../src/base-ui/Button/Button.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport type { MouseEvent, Ref } from 'react';\n\nimport { useMotionComponent } from '@/MotionProvider';\n\nimport { styles } from './style';\nimport type { ButtonProps } from './type';\n\nconst resolveSizeCls = (size: ButtonProps['size']) => {\n if (size === 'small') return styles.sizeSmall;\n if (size === 'large') return styles.sizeLarge;\n return styles.sizeMiddle;\n};\n\nconst resolveIconOnlySizeCls = (size: ButtonProps['size']) => {\n if (size === 'small') return styles.iconOnlySmall;\n if (size === 'large') return styles.iconOnlyLarge;\n return styles.iconOnlyMiddle;\n};\n\nconst resolveVariantCls = ({\n danger,\n ghost,\n type,\n}: {\n danger: boolean;\n ghost: boolean;\n type: NonNullable<ButtonProps['type']>;\n}): string => {\n if (ghost) {\n if (danger) return styles.ghostDanger;\n if (type === 'primary') return styles.ghostPrimary;\n return styles.ghostDefault;\n }\n\n switch (type) {\n case 'primary': {\n return danger ? styles.dangerSolid : styles.variantPrimary;\n }\n case 'dashed': {\n return danger ? cx(styles.variantDashed, styles.dangerOutlined) : styles.variantDashed;\n }\n case 'text': {\n return danger ? cx(styles.variantText, styles.dangerInline) : styles.variantText;\n }\n case 'link': {\n return danger ? cx(styles.variantLink, styles.dangerInline) : styles.variantLink;\n }\n default: {\n return danger ? cx(styles.variantDefault, styles.dangerOutlined) : styles.variantDefault;\n }\n }\n};\n\nconst hoverAnim = { y: -0.5 };\nconst tapAnim = { scale: 0.96 };\nconst motionTransition = {\n damping: 26,\n mass: 0.6,\n stiffness: 600,\n type: 'spring' as const,\n};\n\nconst Button = ({\n block,\n children,\n className,\n classNames,\n danger = false,\n disabled,\n ghost = false,\n href,\n htmlType = 'button',\n icon,\n iconPosition = 'start',\n loading,\n onClick,\n ref,\n shape = 'default',\n size = 'middle',\n styles: userStyles,\n target,\n type = 'default',\n ...rest\n}: ButtonProps) => {\n const Motion = useMotionComponent();\n const isDisabled = disabled || loading;\n const sizeCls = resolveSizeCls(size);\n const variantCls = resolveVariantCls({ danger, ghost, type });\n const shapeCls =\n shape === 'circle' ? styles.shapeCircle : shape === 'round' ? styles.shapeRound : undefined;\n\n const hasChildren =\n children !== undefined && children !== null && children !== false && children !== '';\n const renderIcon = loading || icon;\n const iconOnly = !hasChildren && !!renderIcon;\n const iconOnlySizeCls = iconOnly ? resolveIconOnlySizeCls(size) : undefined;\n\n const composedClassName = cx(\n styles.base,\n sizeCls,\n variantCls,\n shapeCls,\n block && styles.block,\n iconPosition === 'end' && styles.iconEnd,\n iconOnlySizeCls,\n className,\n );\n\n const iconNode = loading ? (\n <span className={cx(styles.iconBox, classNames?.icon)} style={userStyles?.icon}>\n <span className={styles.spinner} />\n </span>\n ) : icon ? (\n <span className={cx(styles.iconBox, classNames?.icon)} style={userStyles?.icon}>\n {icon}\n </span>\n ) : null;\n\n const inner = (\n <>\n {iconNode}\n {children}\n </>\n );\n\n const motionGestures = isDisabled\n ? {}\n : { transition: motionTransition, whileHover: hoverAnim, whileTap: tapAnim };\n\n if (href !== undefined) {\n const handleAnchorClick = (e: MouseEvent<HTMLAnchorElement>) => {\n if (isDisabled) {\n e.preventDefault();\n return;\n }\n onClick?.(e as unknown as MouseEvent<HTMLButtonElement>);\n };\n\n return (\n <Motion.a\n aria-disabled={isDisabled || undefined}\n href={isDisabled ? undefined : href}\n target={target}\n {...(rest as any)}\n className={composedClassName}\n ref={ref as Ref<HTMLAnchorElement>}\n onClick={handleAnchorClick}\n {...motionGestures}\n >\n {inner}\n </Motion.a>\n );\n }\n\n return (\n <Motion.button\n type={htmlType}\n {...(rest as any)}\n className={composedClassName}\n disabled={isDisabled}\n ref={ref as Ref<HTMLButtonElement>}\n onClick={onClick}\n {...motionGestures}\n >\n {inner}\n </Motion.button>\n );\n};\n\nButton.displayName = 'BaseButton';\n\nexport default Button;\n"],"mappings":";;;;;;AAUA,MAAM,kBAAkB,SAA8B;AACpD,KAAI,SAAS,QAAS,QAAO,OAAO;AACpC,KAAI,SAAS,QAAS,QAAO,OAAO;AACpC,QAAO,OAAO;;AAGhB,MAAM,0BAA0B,SAA8B;AAC5D,KAAI,SAAS,QAAS,QAAO,OAAO;AACpC,KAAI,SAAS,QAAS,QAAO,OAAO;AACpC,QAAO,OAAO;;AAGhB,MAAM,qBAAqB,EACzB,QACA,OACA,WAKY;AACZ,KAAI,OAAO;AACT,MAAI,OAAQ,QAAO,OAAO;AAC1B,MAAI,SAAS,UAAW,QAAO,OAAO;AACtC,SAAO,OAAO;;AAGhB,SAAQ,MAAR;EACE,KAAK,UACH,QAAO,SAAS,OAAO,cAAc,OAAO;EAE9C,KAAK,SACH,QAAO,SAAS,GAAG,OAAO,eAAe,OAAO,eAAe,GAAG,OAAO;EAE3E,KAAK,OACH,QAAO,SAAS,GAAG,OAAO,aAAa,OAAO,aAAa,GAAG,OAAO;EAEvE,KAAK,OACH,QAAO,SAAS,GAAG,OAAO,aAAa,OAAO,aAAa,GAAG,OAAO;EAEvE,QACE,QAAO,SAAS,GAAG,OAAO,gBAAgB,OAAO,eAAe,GAAG,OAAO;;;AAKhF,MAAM,YAAY,EAAE,GAAG,KAAM;AAC7B,MAAM,UAAU,EAAE,OAAO,KAAM;AAC/B,MAAM,mBAAmB;CACvB,SAAS;CACT,MAAM;CACN,WAAW;CACX,MAAM;CACP;AAED,MAAM,UAAU,EACd,OACA,UACA,WACA,YACA,SAAS,OACT,UACA,QAAQ,OACR,MACA,WAAW,UACX,MACA,eAAe,SACf,SACA,SACA,KACA,QAAQ,WACR,OAAO,UACP,QAAQ,YACR,QACA,OAAO,WACP,GAAG,WACc;CACjB,MAAM,SAAS,oBAAoB;CACnC,MAAM,aAAa,YAAY;CAC/B,MAAM,UAAU,eAAe,KAAK;CACpC,MAAM,aAAa,kBAAkB;EAAE;EAAQ;EAAO;EAAM,CAAC;CAC7D,MAAM,WACJ,UAAU,WAAW,OAAO,cAAc,UAAU,UAAU,OAAO,aAAa,KAAA;CAMpF,MAAM,kBADW,EAFf,aAAa,KAAA,KAAa,aAAa,QAAQ,aAAa,SAAS,aAAa,OAEnD,CAAC,EADf,WAAW,QAEK,uBAAuB,KAAK,GAAG,KAAA;CAElE,MAAM,oBAAoB,GACxB,OAAO,MACP,SACA,YACA,UACA,SAAS,OAAO,OAChB,iBAAiB,SAAS,OAAO,SACjC,iBACA,UACD;CAYD,MAAM,QACJ,qBAAA,UAAA,EAAA,UAAA,CAXe,UACf,oBAAC,QAAD;EAAM,WAAW,GAAG,OAAO,SAAS,YAAY,KAAK;EAAE,OAAO,YAAY;YACxE,oBAAC,QAAD,EAAM,WAAW,OAAO,SAAW,CAAA;EAC9B,CAAA,GACL,OACF,oBAAC,QAAD;EAAM,WAAW,GAAG,OAAO,SAAS,YAAY,KAAK;EAAE,OAAO,YAAY;YACvE;EACI,CAAA,GACL,MAKC,SACA,EAAA,CAAA;CAGL,MAAM,iBAAiB,aACnB,EAAE,GACF;EAAE,YAAY;EAAkB,YAAY;EAAW,UAAU;EAAS;AAE9E,KAAI,SAAS,KAAA,GAAW;EACtB,MAAM,qBAAqB,MAAqC;AAC9D,OAAI,YAAY;AACd,MAAE,gBAAgB;AAClB;;AAEF,aAAU,EAA8C;;AAG1D,SACE,oBAAC,OAAO,GAAR;GACE,iBAAe,cAAc,KAAA;GAC7B,MAAM,aAAa,KAAA,IAAY;GACvB;GACR,GAAK;GACL,WAAW;GACN;GACL,SAAS;GACT,GAAI;aAEH;GACQ,CAAA;;AAIf,QACE,oBAAC,OAAO,QAAR;EACE,MAAM;EACN,GAAK;EACL,WAAW;EACX,UAAU;EACL;EACI;EACT,GAAI;YAEH;EACa,CAAA;;AAIpB,OAAO,cAAc"}
|