cosey 0.6.16 → 0.6.18
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/components/copy/copy.style.js +5 -0
- package/components/editor/editor.style.js +2 -2
- package/components/highlight/highlight.api.d.ts +3 -0
- package/components/highlight/highlight.api.js +3 -0
- package/components/highlight/highlight.d.ts +6 -0
- package/components/highlight/highlight.js +11 -4
- package/components/highlight/highlight.style.d.ts +2 -1
- package/components/highlight/highlight.style.js +53 -13
- package/components/highlight/index.d.ts +9 -0
- package/package.json +1 -1
|
@@ -4,10 +4,15 @@ var stdin_default = getSimpleStyleHook("CoMask", (token) => {
|
|
|
4
4
|
const { componentCls } = token;
|
|
5
5
|
return {
|
|
6
6
|
[componentCls]: {
|
|
7
|
+
width: token.sizeLG,
|
|
8
|
+
height: `${token.sizeLG} !important`,
|
|
9
|
+
fontSize: token.fontSize,
|
|
10
|
+
transition: "none",
|
|
7
11
|
"&:not(.is-copied):hover": {
|
|
8
12
|
opacity: 0.75
|
|
9
13
|
},
|
|
10
14
|
"&.is-copied": {
|
|
15
|
+
fontSize: token.fontSizeXL,
|
|
11
16
|
[`${componentCls}-icon`]: {
|
|
12
17
|
color: token.colorSuccess
|
|
13
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getHljsDark } from '../highlight/highlight.style.js';
|
|
2
2
|
import { getGlobalStyleHook } from '../theme/getGlobalStyleHook.js';
|
|
3
3
|
import { getSimpleStyleHook } from '../theme/getSimpleStyleHook.js';
|
|
4
4
|
import { getTruncateStyle } from '../style/mixins.js';
|
|
@@ -357,7 +357,7 @@ const getEditorButtonStyle = (token) => {
|
|
|
357
357
|
};
|
|
358
358
|
};
|
|
359
359
|
const useHljsStyle = getGlobalStyleHook("CoGlobalHighlight", () => {
|
|
360
|
-
return
|
|
360
|
+
return getHljsDark();
|
|
361
361
|
});
|
|
362
362
|
var stdin_default = getSimpleStyleHook("CoEditor", (token) => {
|
|
363
363
|
return [getEditorStyle(token), getEditorToolbarStyle(token), getEditorButtonStyle(token)];
|
|
@@ -16,6 +16,9 @@ export declare const highlightProps: {
|
|
|
16
16
|
lang: {
|
|
17
17
|
type: PropType<xml | json | js | ts | plaintext | "css" | "scss" | "less" | (string & {})>;
|
|
18
18
|
};
|
|
19
|
+
maxHeight: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
};
|
|
19
22
|
};
|
|
20
23
|
export type HighlightProps = ExtractPropTypes<typeof highlightProps>;
|
|
21
24
|
export interface HighlightSlots {
|
|
@@ -5,6 +5,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
5
5
|
lang: {
|
|
6
6
|
type: import("vue").PropType<("html" | "svg" | "xml" | "xhtml" | "rss" | "atom" | "xjb" | "xsd" | "xsl" | "plist" | "wsf") | "json" | ("javascript" | "js" | "jsx" | "mjs" | "cjs") | ("typescript" | "ts" | "tsx" | "mts" | "cts") | ("text" | "plaintext" | "txt") | "css" | "scss" | "less" | (string & {})>;
|
|
7
7
|
};
|
|
8
|
+
maxHeight: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
};
|
|
8
11
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
12
|
code: {
|
|
10
13
|
type: StringConstructor;
|
|
@@ -12,5 +15,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
12
15
|
lang: {
|
|
13
16
|
type: import("vue").PropType<("html" | "svg" | "xml" | "xhtml" | "rss" | "atom" | "xjb" | "xsd" | "xsl" | "plist" | "wsf") | "json" | ("javascript" | "js" | "jsx" | "mjs" | "cjs") | ("typescript" | "ts" | "tsx" | "mts" | "cts") | ("text" | "plaintext" | "txt") | "css" | "scss" | "less" | (string & {})>;
|
|
14
17
|
};
|
|
18
|
+
maxHeight: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
};
|
|
15
21
|
}>> & Readonly<{}>, {}, import("vue").SlotsType<import("./highlight.api").HighlightSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
16
22
|
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, createVNode } from 'vue';
|
|
2
|
+
import { ElScrollbar } from 'element-plus';
|
|
2
3
|
import { highlightSlots, highlightProps } from './highlight.api.js';
|
|
3
4
|
import stdin_default$1 from './highlight.style.js';
|
|
4
5
|
import stdin_default$2 from '../copy/copy.js';
|
|
@@ -22,10 +23,16 @@ var stdin_default = defineComponent({
|
|
|
22
23
|
return () => {
|
|
23
24
|
return createVNode("div", {
|
|
24
25
|
"class": [hashId.value, prefixCls.value]
|
|
25
|
-
}, [createVNode(
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
26
|
+
}, [createVNode(ElScrollbar, {
|
|
27
|
+
"tag": "pre",
|
|
28
|
+
"class": `${prefixCls.value}-scroll`,
|
|
29
|
+
"view-class": "hljs",
|
|
30
|
+
"maxHeight": props.maxHeight
|
|
31
|
+
}, {
|
|
32
|
+
default: () => [createVNode("code", {
|
|
33
|
+
"innerHTML": highlightedCode.value
|
|
34
|
+
}, null)]
|
|
35
|
+
}), createVNode("div", {
|
|
29
36
|
"class": `${prefixCls.value}-copy`
|
|
30
37
|
}, [createVNode(stdin_default$2, {
|
|
31
38
|
"text": props.code,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CSSObject } from '../cssinjs';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function getHljsDark(): CSSObject;
|
|
3
|
+
export declare function getHljsLight(): CSSObject;
|
|
3
4
|
declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../theme/theme-context").ThemeManager) => {
|
|
4
5
|
hashId: import("vue").Ref<string, string>;
|
|
5
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSimpleStyleHook } from '../theme/getSimpleStyleHook.js';
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function getHljsDark() {
|
|
4
4
|
return {
|
|
5
5
|
".hljs": {
|
|
6
6
|
color: "#abb2bf",
|
|
@@ -42,31 +42,71 @@ function getHljs() {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
+
function getHljsLight() {
|
|
46
|
+
return {
|
|
47
|
+
".hljs": {
|
|
48
|
+
color: "#383a42",
|
|
49
|
+
background: "#fafafa"
|
|
50
|
+
},
|
|
51
|
+
".hljs-comment,.hljs-quote": {
|
|
52
|
+
color: "#a0a1a7",
|
|
53
|
+
fontStyle: "italic"
|
|
54
|
+
},
|
|
55
|
+
".hljs-doctag,.hljs-keyword,.hljs-formula": {
|
|
56
|
+
color: "#a626a4"
|
|
57
|
+
},
|
|
58
|
+
".hljs-section,.hljs-name,.hljs-selector-tag,.hljs-deletion,.hljs-subst": {
|
|
59
|
+
color: "#e45649"
|
|
60
|
+
},
|
|
61
|
+
".hljs-literal": {
|
|
62
|
+
color: "#0184bb"
|
|
63
|
+
},
|
|
64
|
+
".hljs-string,.hljs-regexp,.hljs-addition,.hljs-attribute,.hljs-meta .hljs-string": {
|
|
65
|
+
color: "#50a14f"
|
|
66
|
+
},
|
|
67
|
+
".hljs-attr,.hljs-variable,.hljs-template-variable,.hljs-type,.hljs-selector-class,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-number": {
|
|
68
|
+
color: "#986801"
|
|
69
|
+
},
|
|
70
|
+
".hljs-symbol,.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-title": {
|
|
71
|
+
color: "#4078f2"
|
|
72
|
+
},
|
|
73
|
+
".hljs-built_in,.hljs-title.class_,.hljs-class .hljs-title": {
|
|
74
|
+
color: "#c18401"
|
|
75
|
+
},
|
|
76
|
+
".hljs-emphasis": {
|
|
77
|
+
fontStyle: "italic"
|
|
78
|
+
},
|
|
79
|
+
".hljs-strong": {
|
|
80
|
+
fontWeight: "bold"
|
|
81
|
+
},
|
|
82
|
+
".hljs-link": {
|
|
83
|
+
textDecoration: "underline"
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
45
87
|
var stdin_default = getSimpleStyleHook("CoHighlight", (token) => {
|
|
46
88
|
const { componentCls } = token;
|
|
47
89
|
return {
|
|
48
90
|
[componentCls]: {
|
|
49
91
|
position: "relative",
|
|
50
|
-
|
|
51
|
-
padding: token.paddingSM,
|
|
52
|
-
overflow: "auto",
|
|
53
|
-
color: "#abb2bf",
|
|
54
|
-
background: "#282c34",
|
|
92
|
+
[`${componentCls}-scroll`]: {
|
|
55
93
|
borderRadius: token.borderRadius
|
|
56
94
|
},
|
|
95
|
+
pre: {
|
|
96
|
+
padding: token.paddingSM
|
|
97
|
+
},
|
|
57
98
|
[`${componentCls}-copy`]: {
|
|
58
99
|
position: "absolute",
|
|
59
100
|
insetBlockStart: token.sizeXXS,
|
|
60
101
|
insetInlineEnd: token.sizeXXS,
|
|
61
|
-
zIndex: 10
|
|
62
|
-
color: token.colorWhite,
|
|
63
|
-
"&:hover,&:active": {
|
|
64
|
-
color: `${token.colorWhite} !important`
|
|
65
|
-
}
|
|
102
|
+
zIndex: 10
|
|
66
103
|
},
|
|
67
|
-
...
|
|
104
|
+
...getHljsLight(),
|
|
105
|
+
":root.dark &": {
|
|
106
|
+
...getHljsDark()
|
|
107
|
+
}
|
|
68
108
|
}
|
|
69
109
|
};
|
|
70
110
|
});
|
|
71
111
|
|
|
72
|
-
export { stdin_default as default,
|
|
112
|
+
export { stdin_default as default, getHljsDark, getHljsLight };
|
|
@@ -7,6 +7,9 @@ declare const _Highlight: {
|
|
|
7
7
|
lang: {
|
|
8
8
|
type: import("vue").PropType<("html" | "svg" | "xml" | "xhtml" | "rss" | "atom" | "xjb" | "xsd" | "xsl" | "plist" | "wsf") | "json" | ("javascript" | "js" | "jsx" | "mjs" | "cjs") | ("typescript" | "ts" | "tsx" | "mts" | "cts") | ("text" | "plaintext" | "txt") | "css" | "scss" | "less" | (string & {})>;
|
|
9
9
|
};
|
|
10
|
+
maxHeight: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
};
|
|
10
13
|
}>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, true, {}, import("vue").SlotsType<import("./highlight.api").HighlightSlots>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
11
14
|
P: {};
|
|
12
15
|
B: {};
|
|
@@ -21,6 +24,9 @@ declare const _Highlight: {
|
|
|
21
24
|
lang: {
|
|
22
25
|
type: import("vue").PropType<("html" | "svg" | "xml" | "xhtml" | "rss" | "atom" | "xjb" | "xsd" | "xsl" | "plist" | "wsf") | "json" | ("javascript" | "js" | "jsx" | "mjs" | "cjs") | ("typescript" | "ts" | "tsx" | "mts" | "cts") | ("text" | "plaintext" | "txt") | "css" | "scss" | "less" | (string & {})>;
|
|
23
26
|
};
|
|
27
|
+
maxHeight: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
};
|
|
24
30
|
}>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {}>;
|
|
25
31
|
__isFragment?: never;
|
|
26
32
|
__isTeleport?: never;
|
|
@@ -32,6 +38,9 @@ declare const _Highlight: {
|
|
|
32
38
|
lang: {
|
|
33
39
|
type: import("vue").PropType<("html" | "svg" | "xml" | "xhtml" | "rss" | "atom" | "xjb" | "xsd" | "xsl" | "plist" | "wsf") | "json" | ("javascript" | "js" | "jsx" | "mjs" | "cjs") | ("typescript" | "ts" | "tsx" | "mts" | "cts") | ("text" | "plaintext" | "txt") | "css" | "scss" | "less" | (string & {})>;
|
|
34
40
|
};
|
|
41
|
+
maxHeight: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
};
|
|
35
44
|
}>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, import("vue").SlotsType<import("./highlight.api").HighlightSlots>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("vue").Plugin;
|
|
36
45
|
export { _Highlight as Highlight };
|
|
37
46
|
export default _Highlight;
|