@lobehub/ui 5.15.7 → 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/base-ui/DropdownMenu/sharedStyle.mjs +9 -4
- package/es/base-ui/DropdownMenu/sharedStyle.mjs.map +1 -1
- package/es/base-ui/Switch/atoms.d.mts +2 -4
- package/es/base-ui/Switch/atoms.mjs +12 -8
- package/es/base-ui/Switch/atoms.mjs.map +1 -1
- package/es/base-ui/Switch/style.mjs +36 -10
- package/es/base-ui/Switch/style.mjs.map +1 -1
- package/es/base-ui/Switch/type.d.mts +1 -0
- 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 };
|
|
@@ -38,14 +38,19 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
38
38
|
groupLabel: css`
|
|
39
39
|
user-select: none;
|
|
40
40
|
|
|
41
|
-
padding-block: 4px
|
|
41
|
+
padding-block: 8px 4px;
|
|
42
42
|
padding-inline: 12px;
|
|
43
43
|
|
|
44
|
-
font-size:
|
|
45
|
-
font-weight:
|
|
44
|
+
font-size: 10px;
|
|
45
|
+
font-weight: 600;
|
|
46
46
|
line-height: 14px;
|
|
47
47
|
color: ${cssVar.colorTextTertiary};
|
|
48
|
-
text-transform:
|
|
48
|
+
text-transform: uppercase;
|
|
49
|
+
letter-spacing: 0.6px;
|
|
50
|
+
|
|
51
|
+
[role='group']:first-child > & {
|
|
52
|
+
padding-block-start: 4px;
|
|
53
|
+
}
|
|
49
54
|
`,
|
|
50
55
|
icon: css`
|
|
51
56
|
display: flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedStyle.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/sharedStyle.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n danger: css`\n --lobe-menu-icon-color: ${cssVar.colorError};\n\n color: ${cssVar.colorError} !important;\n\n &:hover {\n background: ${cssVar.colorErrorBg} !important;\n }\n `,\n\n empty: css`\n cursor: default;\n font-style: italic;\n color: ${cssVar.colorTextTertiary};\n `,\n\n extra: css`\n margin-inline-start: auto;\n padding-inline-start: 16px;\n\n font-family: ${cssVar.fontFamilyCode};\n font-size: 12px;\n color: ${cssVar.colorTextTertiary};\n `,\n\n footer: css`\n flex-shrink: 0;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-start: 1px solid ${cssVar.colorBorder};\n `,\n\n header: css`\n flex-shrink: 0;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-end: 1px solid ${cssVar.colorBorder};\n `,\n\n groupLabel: css`\n user-select: none;\n\n padding-block: 4px
|
|
1
|
+
{"version":3,"file":"sharedStyle.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/sharedStyle.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n danger: css`\n --lobe-menu-icon-color: ${cssVar.colorError};\n\n color: ${cssVar.colorError} !important;\n\n &:hover {\n background: ${cssVar.colorErrorBg} !important;\n }\n `,\n\n empty: css`\n cursor: default;\n font-style: italic;\n color: ${cssVar.colorTextTertiary};\n `,\n\n extra: css`\n margin-inline-start: auto;\n padding-inline-start: 16px;\n\n font-family: ${cssVar.fontFamilyCode};\n font-size: 12px;\n color: ${cssVar.colorTextTertiary};\n `,\n\n footer: css`\n flex-shrink: 0;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-start: 1px solid ${cssVar.colorBorder};\n `,\n\n header: css`\n flex-shrink: 0;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-end: 1px solid ${cssVar.colorBorder};\n `,\n\n groupLabel: css`\n user-select: none;\n\n padding-block: 8px 4px;\n padding-inline: 12px;\n\n font-size: 10px;\n font-weight: 600;\n line-height: 14px;\n color: ${cssVar.colorTextTertiary};\n text-transform: uppercase;\n letter-spacing: 0.6px;\n\n [role='group']:first-child > & {\n padding-block-start: 4px;\n }\n `,\n\n icon: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 14px;\n height: 14px;\n margin-inline-end: 12px;\n\n color: var(--lobe-menu-icon-color, ${cssVar.colorTextSecondary});\n\n & svg {\n width: 100%;\n height: 100%;\n }\n `,\n\n item: css`\n user-select: none;\n\n position: relative;\n\n overflow: hidden;\n display: flex;\n align-items: center;\n\n width: 100%;\n min-height: 32px;\n padding-block: 6px;\n padding-inline: 12px;\n border-radius: ${cssVar.borderRadiusSM};\n\n font-size: 14px;\n line-height: 20px;\n color: ${cssVar.colorText};\n\n outline: none;\n\n transition: all 150ms ${cssVar.motionEaseOut};\n\n &:hover {\n background: ${cssVar.colorFillTertiary};\n }\n\n &:active {\n background: ${cssVar.colorFillSecondary};\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n opacity: 0.5;\n\n &:hover {\n background: transparent;\n }\n }\n\n &[data-highlighted]:not([data-disabled]) {\n background: ${cssVar.colorFillTertiary};\n }\n\n &[data-state='open']:not([data-disabled]),\n &[data-open]:not([data-disabled]),\n &[aria-expanded='true']:not([data-disabled]) {\n background: ${cssVar.colorFillTertiary};\n }\n `,\n\n itemContent: css`\n display: flex;\n flex: 1;\n gap: 0;\n align-items: center;\n `,\n\n itemContentAlignStart: css`\n align-items: flex-start;\n `,\n\n iconAlignStart: css`\n align-self: flex-start;\n margin-block-start: 2px;\n `,\n\n label: css`\n overflow: hidden;\n flex: 1;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n & a,\n & a:visited,\n & a:hover,\n & a:active {\n color: inherit;\n }\n `,\n\n labelGroup: css`\n overflow: hidden;\n display: flex;\n flex: 1;\n flex-direction: column;\n\n min-width: 0;\n `,\n\n desc: css`\n overflow: hidden;\n\n font-size: 12px;\n line-height: 16px;\n color: ${cssVar.colorTextTertiary};\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n\n popup: css`\n min-width: 220px;\n padding: 4px;\n border-radius: ${cssVar.borderRadius};\n\n background: ${cssVar.colorBgElevated};\n outline: none;\n box-shadow:\n 0 0 0 1px ${cssVar.colorBorder},\n 0 4px 12px 0 rgb(0 0 0 / 8%),\n 0 1px 3px 0 rgb(0 0 0 / 6%);\n\n &[data-has-header] {\n padding-block-start: 0;\n }\n\n &[data-has-footer] {\n padding-block-end: 0;\n }\n `,\n\n popupWithSlots: css`\n overflow: hidden;\n display: flex;\n flex-direction: column;\n max-height: var(--available-height);\n `,\n\n slotViewport: css`\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n `,\n\n positioner: css`\n --lobe-dropdown-animation-duration: 140ms;\n --lobe-dropdown-animation-scale-y: 0.92;\n --lobe-dropdown-animation-ease-in: ease-in;\n --lobe-dropdown-animation-ease-out: ${cssVar.motionEaseOut};\n\n z-index: 1100;\n\n & > * {\n will-change: opacity, transform;\n transform-origin: var(--transform-origin);\n animation: none;\n }\n\n &[data-open] > * {\n transform: scaleY(1);\n opacity: 1;\n transition:\n opacity var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-out),\n transform var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-out);\n }\n\n &[data-open] > *[data-starting-style] {\n transform: scaleY(var(--lobe-dropdown-animation-scale-y));\n opacity: 0;\n }\n\n &[data-closed] > * {\n transform: scaleY(var(--lobe-dropdown-animation-scale-y));\n opacity: 0;\n transition:\n opacity var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-in),\n transform var(--lobe-dropdown-animation-duration) var(--lobe-dropdown-animation-ease-in);\n }\n\n &[data-hover-trigger] {\n --lobe-dropdown-animation-duration: 140ms;\n }\n\n &[data-submenu],\n &[data-nested] {\n --lobe-dropdown-animation-duration: 0ms;\n --lobe-dropdown-animation-scale-y: 1;\n\n z-index: 1199;\n }\n\n &[data-side='left'],\n &[data-side='right'] {\n --lobe-dropdown-animation-duration: 0ms;\n --lobe-dropdown-animation-scale-y: 1;\n }\n `,\n\n separator: css`\n height: 1px;\n margin-block: 4px;\n margin-inline: 0;\n background: ${cssVar.colorBorder};\n `,\n\n submenuArrow: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 16px;\n height: 16px;\n margin-inline-start: 8px;\n\n color: var(--lobe-menu-icon-color, ${cssVar.colorTextSecondary});\n\n & svg {\n width: 12px;\n height: 12px;\n }\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,QAAQ,GAAG;8BACiB,OAAO,WAAW;;aAEnC,OAAO,WAAW;;;oBAGX,OAAO,aAAa;;;CAItC,OAAO,GAAG;;;aAGC,OAAO,kBAAkB;;CAGpC,OAAO,GAAG;;;;mBAIO,OAAO,eAAe;;aAE5B,OAAO,kBAAkB;;CAGpC,QAAQ,GAAG;;;;oCAIuB,OAAO,YAAY;;CAGrD,QAAQ,GAAG;;;;kCAIqB,OAAO,YAAY;;CAGnD,YAAY,GAAG;;;;;;;;;aASJ,OAAO,kBAAkB;;;;;;;;CASpC,MAAM,GAAG;;;;;;;;;;yCAU8B,OAAO,mBAAmB;;;;;;;CAQjE,MAAM,GAAG;;;;;;;;;;;;;qBAaU,OAAO,eAAe;;;;aAI9B,OAAO,UAAU;;;;4BAIF,OAAO,cAAc;;;oBAG7B,OAAO,kBAAkB;;;;oBAIzB,OAAO,mBAAmB;;;;;eAK/B,OAAO,kBAAkB;;;;;;;;;oBASpB,OAAO,kBAAkB;;;;;;oBAMzB,OAAO,kBAAkB;;;CAI3C,aAAa,GAAG;;;;;;CAOhB,uBAAuB,GAAG;;;CAI1B,gBAAgB,GAAG;;;;CAKnB,OAAO,GAAG;;;;;;;;;;;;;CAcV,YAAY,GAAG;;;;;;;;CASf,MAAM,GAAG;;;;;aAKE,OAAO,kBAAkB;;;;CAKpC,OAAO,GAAG;;;qBAGS,OAAO,aAAa;;kBAEvB,OAAO,gBAAgB;;;kBAGvB,OAAO,YAAY;;;;;;;;;;;;CAanC,gBAAgB,GAAG;;;;;;CAOnB,cAAc,GAAG;;;;;CAMjB,YAAY,GAAG;;;;0CAIyB,OAAO,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD7D,WAAW,GAAG;;;;kBAIE,OAAO,YAAY;;CAGnC,cAAc,GAAG;;;;;;;;;;yCAUsB,OAAO,mBAAmB;;;;;;;CAOlE,EAAE"}
|
|
@@ -43,12 +43,10 @@ declare const SwitchIcon: {
|
|
|
43
43
|
children,
|
|
44
44
|
className,
|
|
45
45
|
position,
|
|
46
|
+
size,
|
|
46
47
|
transition,
|
|
47
48
|
...rest
|
|
48
|
-
}: SwitchIconProps
|
|
49
|
-
children?: React.ReactNode;
|
|
50
|
-
size?: "default" | "small";
|
|
51
|
-
}): _$react_jsx_runtime0.JSX.Element;
|
|
49
|
+
}: SwitchIconProps): _$react_jsx_runtime0.JSX.Element;
|
|
52
50
|
displayName: string;
|
|
53
51
|
};
|
|
54
52
|
//#endregion
|
|
@@ -4,6 +4,7 @@ import { rootVariants, styles, thumbVariants } from "./style.mjs";
|
|
|
4
4
|
import { createContext, use, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { cx } from "antd-style";
|
|
7
|
+
import { useReducedMotion } from "motion/react";
|
|
7
8
|
import useMergeState from "use-merge-value";
|
|
8
9
|
import { Switch } from "@base-ui/react/switch";
|
|
9
10
|
//#region src/base-ui/Switch/atoms.tsx
|
|
@@ -72,19 +73,21 @@ const SwitchRoot = ({ checked, className, defaultChecked, onCheckedChange, onCli
|
|
|
72
73
|
};
|
|
73
74
|
SwitchRoot.displayName = "SwitchRoot";
|
|
74
75
|
const SwitchThumb = ({ className, pressedAnimation, size = "default", transition = {
|
|
75
|
-
damping:
|
|
76
|
-
stiffness:
|
|
76
|
+
damping: 24,
|
|
77
|
+
stiffness: 360,
|
|
77
78
|
type: "spring"
|
|
78
79
|
}, children, ...rest }) => {
|
|
79
80
|
const Motion = useMotionComponent();
|
|
80
81
|
const { isPressed } = useSwitchContext();
|
|
82
|
+
const shouldReduceMotion = useReducedMotion();
|
|
81
83
|
const baseClassName = thumbVariants({ size });
|
|
82
|
-
const
|
|
84
|
+
const effectiveAnimate = !shouldReduceMotion && isPressed ? pressedAnimation || { width: size === "small" ? 16 : 22 } : void 0;
|
|
85
|
+
const effectiveTransition = shouldReduceMotion ? { duration: 0 } : transition;
|
|
83
86
|
return /* @__PURE__ */ jsx(Switch.Thumb, { render: /* @__PURE__ */ jsx(Motion.span, {
|
|
84
87
|
layout: true,
|
|
85
|
-
animate:
|
|
88
|
+
animate: effectiveAnimate,
|
|
86
89
|
className: cx(baseClassName, className),
|
|
87
|
-
transition,
|
|
90
|
+
transition: effectiveTransition,
|
|
88
91
|
...rest,
|
|
89
92
|
children
|
|
90
93
|
}) });
|
|
@@ -95,13 +98,13 @@ const getIconPositionClass = (position, size) => {
|
|
|
95
98
|
if (position === "left") return size === "small" ? styles.iconLeftSmall : styles.iconLeft;
|
|
96
99
|
return size === "small" ? styles.iconRightSmall : styles.iconRight;
|
|
97
100
|
};
|
|
98
|
-
const SwitchIcon = ({ children, className, position, transition = {
|
|
101
|
+
const SwitchIcon = ({ children, className, position, size = "default", transition = {
|
|
99
102
|
bounce: 0,
|
|
100
103
|
type: "spring"
|
|
101
104
|
}, ...rest }) => {
|
|
102
105
|
const Motion = useMotionComponent();
|
|
103
106
|
const { isChecked } = useSwitchContext();
|
|
104
|
-
const
|
|
107
|
+
const shouldReduceMotion = useReducedMotion();
|
|
105
108
|
const isAnimated = useMemo(() => {
|
|
106
109
|
if (position === "right") return !isChecked;
|
|
107
110
|
if (position === "left") return isChecked;
|
|
@@ -109,6 +112,7 @@ const SwitchIcon = ({ children, className, position, transition = {
|
|
|
109
112
|
return false;
|
|
110
113
|
}, [position, isChecked]);
|
|
111
114
|
const positionClass = getIconPositionClass(position, size);
|
|
115
|
+
const effectiveTransition = shouldReduceMotion ? { duration: 0 } : transition;
|
|
112
116
|
return /* @__PURE__ */ jsx(Motion.span, {
|
|
113
117
|
animate: isAnimated ? {
|
|
114
118
|
opacity: 1,
|
|
@@ -118,7 +122,7 @@ const SwitchIcon = ({ children, className, position, transition = {
|
|
|
118
122
|
scale: 0
|
|
119
123
|
},
|
|
120
124
|
className: cx(styles.icon, positionClass, className),
|
|
121
|
-
transition,
|
|
125
|
+
transition: effectiveTransition,
|
|
122
126
|
...rest,
|
|
123
127
|
children
|
|
124
128
|
});
|