@mantine-vue/code-highlight 1.1.2
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/cjs/index.cjs +1985 -0
- package/cjs/index.cjs.map +1 -0
- package/esm/index.mjs +1974 -0
- package/esm/index.mjs.map +1 -0
- package/lib/CodeHighlight/CodeHighlight.context.d.ts +5 -0
- package/lib/CodeHighlight/CodeHighlight.d.ts +506 -0
- package/lib/CodeHighlight/CodeHighlightControl/CodeHighlightControl.d.ts +68 -0
- package/lib/CodeHighlight/CopyCodeButton/CopyCodeButton.d.ts +32 -0
- package/lib/CodeHighlight/CopyCodeButton/CopyIcon.d.ts +13 -0
- package/lib/CodeHighlight/ExpandCodeButton/ExpandCodeButton.d.ts +41 -0
- package/lib/CodeHighlight/ExpandCodeButton/ExpandIcon.d.ts +13 -0
- package/lib/CodeHighlight/InlineCodeHighlight.d.ts +108 -0
- package/lib/CodeHighlightProvider/CodeHighlightProvider.d.ts +34 -0
- package/lib/CodeHighlightProvider/adapters/highlight-js-adapter.d.ts +2 -0
- package/lib/CodeHighlightProvider/adapters/index.d.ts +3 -0
- package/lib/CodeHighlightProvider/adapters/plain-text-adapter.d.ts +2 -0
- package/lib/CodeHighlightProvider/adapters/shiki-adapter.d.ts +7 -0
- package/lib/CodeHighlightProvider/adapters/shiki-themes.d.ts +430 -0
- package/lib/CodeHighlightProvider/index.d.ts +2 -0
- package/lib/CodeHighlightTabs/CodeHighlightTabs.d.ts +256 -0
- package/lib/CodeHighlightTabs/FileIcon.d.ts +34 -0
- package/lib/index.d.mts +15 -0
- package/lib/index.d.ts +15 -0
- package/package.json +46 -0
- package/styles.css +356 -0
- package/styles.layer.css +358 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { type PropType, type VNodeChild } from 'vue';
|
|
2
|
+
import { type CodeHighlightSettings, type CodeHighlightStylesNames } from '../CodeHighlight/CodeHighlight';
|
|
3
|
+
export type CodeHighlightDefaultLanguage = 'tsx' | 'scss' | 'html' | 'bash' | 'json';
|
|
4
|
+
export interface CodeHighlightTabsCode {
|
|
5
|
+
language?: CodeHighlightDefaultLanguage | (string & {});
|
|
6
|
+
code: string;
|
|
7
|
+
fileName?: string;
|
|
8
|
+
icon?: VNodeChild;
|
|
9
|
+
}
|
|
10
|
+
export type CodeHighlightTabsStylesNames = 'root' | 'files' | 'file' | 'fileIcon' | 'filesScrollarea' | CodeHighlightStylesNames;
|
|
11
|
+
export interface CodeHighlightTabsProps extends CodeHighlightSettings {
|
|
12
|
+
code: CodeHighlightTabsCode[];
|
|
13
|
+
getFileIcon?: (fileName: string) => VNodeChild;
|
|
14
|
+
defaultActiveTab?: number;
|
|
15
|
+
activeTab?: number;
|
|
16
|
+
onTabChange?: (tab: number) => void;
|
|
17
|
+
classNames?: any;
|
|
18
|
+
styles?: any;
|
|
19
|
+
vars?: any;
|
|
20
|
+
unstyled?: boolean;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}
|
|
23
|
+
export interface CodeHighlightTabsFactory {
|
|
24
|
+
props: CodeHighlightTabsProps;
|
|
25
|
+
stylesNames: CodeHighlightTabsStylesNames;
|
|
26
|
+
}
|
|
27
|
+
export declare const CodeHighlightTabs: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
28
|
+
code: {
|
|
29
|
+
type: PropType<CodeHighlightTabsCode[]>;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
getFileIcon: {
|
|
33
|
+
type: PropType<(fileName: string) => VNodeChild>;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
defaultActiveTab: {
|
|
37
|
+
type: NumberConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
activeTab: {
|
|
41
|
+
type: NumberConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
onTabChange: {
|
|
45
|
+
type: PropType<(tab: number) => void>;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
defaultExpanded: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
expanded: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
default: undefined;
|
|
55
|
+
};
|
|
56
|
+
onExpandedChange: {
|
|
57
|
+
type: PropType<(expanded: boolean) => void>;
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
withCopyButton: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
64
|
+
withExpandButton: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
68
|
+
withBorder: {
|
|
69
|
+
type: BooleanConstructor;
|
|
70
|
+
default: boolean;
|
|
71
|
+
};
|
|
72
|
+
radius: {
|
|
73
|
+
type: PropType<string | number>;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
maxCollapsedHeight: {
|
|
77
|
+
type: PropType<string | number>;
|
|
78
|
+
default: undefined;
|
|
79
|
+
};
|
|
80
|
+
copyLabel: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
84
|
+
copiedLabel: {
|
|
85
|
+
type: StringConstructor;
|
|
86
|
+
default: undefined;
|
|
87
|
+
};
|
|
88
|
+
expandCodeLabel: {
|
|
89
|
+
type: StringConstructor;
|
|
90
|
+
default: undefined;
|
|
91
|
+
};
|
|
92
|
+
collapseCodeLabel: {
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
background: {
|
|
97
|
+
type: StringConstructor;
|
|
98
|
+
default: undefined;
|
|
99
|
+
};
|
|
100
|
+
controls: {
|
|
101
|
+
type: PropType<CodeHighlightSettings["controls"]>;
|
|
102
|
+
default: undefined;
|
|
103
|
+
};
|
|
104
|
+
codeColorScheme: {
|
|
105
|
+
type: PropType<CodeHighlightSettings["codeColorScheme"]>;
|
|
106
|
+
default: undefined;
|
|
107
|
+
};
|
|
108
|
+
withLineNumbers: {
|
|
109
|
+
type: BooleanConstructor;
|
|
110
|
+
default: boolean;
|
|
111
|
+
};
|
|
112
|
+
classNames: {
|
|
113
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
114
|
+
default: undefined;
|
|
115
|
+
};
|
|
116
|
+
styles: {
|
|
117
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
118
|
+
default: undefined;
|
|
119
|
+
};
|
|
120
|
+
vars: {
|
|
121
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
122
|
+
default: undefined;
|
|
123
|
+
};
|
|
124
|
+
unstyled: {
|
|
125
|
+
type: BooleanConstructor;
|
|
126
|
+
default: boolean;
|
|
127
|
+
};
|
|
128
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
129
|
+
[key: string]: any;
|
|
130
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
131
|
+
code: {
|
|
132
|
+
type: PropType<CodeHighlightTabsCode[]>;
|
|
133
|
+
required: true;
|
|
134
|
+
};
|
|
135
|
+
getFileIcon: {
|
|
136
|
+
type: PropType<(fileName: string) => VNodeChild>;
|
|
137
|
+
default: undefined;
|
|
138
|
+
};
|
|
139
|
+
defaultActiveTab: {
|
|
140
|
+
type: NumberConstructor;
|
|
141
|
+
default: undefined;
|
|
142
|
+
};
|
|
143
|
+
activeTab: {
|
|
144
|
+
type: NumberConstructor;
|
|
145
|
+
default: undefined;
|
|
146
|
+
};
|
|
147
|
+
onTabChange: {
|
|
148
|
+
type: PropType<(tab: number) => void>;
|
|
149
|
+
default: undefined;
|
|
150
|
+
};
|
|
151
|
+
defaultExpanded: {
|
|
152
|
+
type: BooleanConstructor;
|
|
153
|
+
default: undefined;
|
|
154
|
+
};
|
|
155
|
+
expanded: {
|
|
156
|
+
type: BooleanConstructor;
|
|
157
|
+
default: undefined;
|
|
158
|
+
};
|
|
159
|
+
onExpandedChange: {
|
|
160
|
+
type: PropType<(expanded: boolean) => void>;
|
|
161
|
+
default: undefined;
|
|
162
|
+
};
|
|
163
|
+
withCopyButton: {
|
|
164
|
+
type: BooleanConstructor;
|
|
165
|
+
default: undefined;
|
|
166
|
+
};
|
|
167
|
+
withExpandButton: {
|
|
168
|
+
type: BooleanConstructor;
|
|
169
|
+
default: boolean;
|
|
170
|
+
};
|
|
171
|
+
withBorder: {
|
|
172
|
+
type: BooleanConstructor;
|
|
173
|
+
default: boolean;
|
|
174
|
+
};
|
|
175
|
+
radius: {
|
|
176
|
+
type: PropType<string | number>;
|
|
177
|
+
default: undefined;
|
|
178
|
+
};
|
|
179
|
+
maxCollapsedHeight: {
|
|
180
|
+
type: PropType<string | number>;
|
|
181
|
+
default: undefined;
|
|
182
|
+
};
|
|
183
|
+
copyLabel: {
|
|
184
|
+
type: StringConstructor;
|
|
185
|
+
default: undefined;
|
|
186
|
+
};
|
|
187
|
+
copiedLabel: {
|
|
188
|
+
type: StringConstructor;
|
|
189
|
+
default: undefined;
|
|
190
|
+
};
|
|
191
|
+
expandCodeLabel: {
|
|
192
|
+
type: StringConstructor;
|
|
193
|
+
default: undefined;
|
|
194
|
+
};
|
|
195
|
+
collapseCodeLabel: {
|
|
196
|
+
type: StringConstructor;
|
|
197
|
+
default: undefined;
|
|
198
|
+
};
|
|
199
|
+
background: {
|
|
200
|
+
type: StringConstructor;
|
|
201
|
+
default: undefined;
|
|
202
|
+
};
|
|
203
|
+
controls: {
|
|
204
|
+
type: PropType<CodeHighlightSettings["controls"]>;
|
|
205
|
+
default: undefined;
|
|
206
|
+
};
|
|
207
|
+
codeColorScheme: {
|
|
208
|
+
type: PropType<CodeHighlightSettings["codeColorScheme"]>;
|
|
209
|
+
default: undefined;
|
|
210
|
+
};
|
|
211
|
+
withLineNumbers: {
|
|
212
|
+
type: BooleanConstructor;
|
|
213
|
+
default: boolean;
|
|
214
|
+
};
|
|
215
|
+
classNames: {
|
|
216
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
217
|
+
default: undefined;
|
|
218
|
+
};
|
|
219
|
+
styles: {
|
|
220
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
221
|
+
default: undefined;
|
|
222
|
+
};
|
|
223
|
+
vars: {
|
|
224
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
225
|
+
default: undefined;
|
|
226
|
+
};
|
|
227
|
+
unstyled: {
|
|
228
|
+
type: BooleanConstructor;
|
|
229
|
+
default: boolean;
|
|
230
|
+
};
|
|
231
|
+
}>> & Readonly<{}>, {
|
|
232
|
+
radius: string | number;
|
|
233
|
+
classNames: Function | Record<string, any>;
|
|
234
|
+
styles: Function | Record<string, any>;
|
|
235
|
+
expanded: boolean;
|
|
236
|
+
background: string;
|
|
237
|
+
vars: Function | Record<string, any>;
|
|
238
|
+
unstyled: boolean;
|
|
239
|
+
withBorder: boolean;
|
|
240
|
+
defaultExpanded: boolean;
|
|
241
|
+
onExpandedChange: (expanded: boolean) => void;
|
|
242
|
+
controls: VNodeChild[] | (() => VNodeChild) | undefined;
|
|
243
|
+
copiedLabel: string;
|
|
244
|
+
copyLabel: string;
|
|
245
|
+
collapseCodeLabel: string;
|
|
246
|
+
expandCodeLabel: string;
|
|
247
|
+
maxCollapsedHeight: string | number;
|
|
248
|
+
withCopyButton: boolean;
|
|
249
|
+
withExpandButton: boolean;
|
|
250
|
+
withLineNumbers: boolean;
|
|
251
|
+
codeColorScheme: "light" | "dark" | (string & {}) | undefined;
|
|
252
|
+
getFileIcon: (fileName: string) => VNodeChild;
|
|
253
|
+
defaultActiveTab: number;
|
|
254
|
+
activeTab: number;
|
|
255
|
+
onTabChange: (tab: number) => void;
|
|
256
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type PropType, type VNodeChild } from 'vue';
|
|
2
|
+
export declare const FileIcon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
fileName: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: undefined;
|
|
6
|
+
};
|
|
7
|
+
getFileIcon: {
|
|
8
|
+
type: PropType<(fileName: string) => VNodeChild>;
|
|
9
|
+
default: undefined;
|
|
10
|
+
};
|
|
11
|
+
fileIcon: {
|
|
12
|
+
type: PropType<VNodeChild>;
|
|
13
|
+
default: undefined;
|
|
14
|
+
};
|
|
15
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
18
|
+
fileName: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: undefined;
|
|
21
|
+
};
|
|
22
|
+
getFileIcon: {
|
|
23
|
+
type: PropType<(fileName: string) => VNodeChild>;
|
|
24
|
+
default: undefined;
|
|
25
|
+
};
|
|
26
|
+
fileIcon: {
|
|
27
|
+
type: PropType<VNodeChild>;
|
|
28
|
+
default: undefined;
|
|
29
|
+
};
|
|
30
|
+
}>> & Readonly<{}>, {
|
|
31
|
+
fileName: string;
|
|
32
|
+
getFileIcon: (fileName: string) => VNodeChild;
|
|
33
|
+
fileIcon: VNodeChild;
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { CodeHighlight } from './CodeHighlight/CodeHighlight';
|
|
2
|
+
export { InlineCodeHighlight } from './CodeHighlight/InlineCodeHighlight';
|
|
3
|
+
export { CodeHighlightTabs } from './CodeHighlightTabs/CodeHighlightTabs';
|
|
4
|
+
export { CodeHighlightControl } from './CodeHighlight/CodeHighlightControl/CodeHighlightControl';
|
|
5
|
+
export { useCodeHighlightContext } from './CodeHighlight/CodeHighlight.context';
|
|
6
|
+
export { CodeHighlightAdapterProvider, useHighlight, } from './CodeHighlightProvider/CodeHighlightProvider';
|
|
7
|
+
export { createHighlightJsAdapter } from './CodeHighlightProvider/adapters/highlight-js-adapter';
|
|
8
|
+
export { createShikiAdapter, stripShikiCodeBlocks, } from './CodeHighlightProvider/adapters/shiki-adapter';
|
|
9
|
+
export { plainTextAdapter } from './CodeHighlightProvider/adapters/plain-text-adapter';
|
|
10
|
+
export type { CodeHighlightAdapter, Highlighter, HighlighterInput, } from './CodeHighlightProvider/CodeHighlightProvider';
|
|
11
|
+
export type { CodeHighlightCssVariables, CodeHighlightFactory, CodeHighlightProps, CodeHighlightSettings, CodeHighlightStylesNames, } from './CodeHighlight/CodeHighlight';
|
|
12
|
+
export type { CodeHighlightContextValue } from './CodeHighlight/CodeHighlight.context';
|
|
13
|
+
export type { CodeHighlightControlProps } from './CodeHighlight/CodeHighlightControl/CodeHighlightControl';
|
|
14
|
+
export type { InlineCodeHighlightCssVariables, InlineCodeHighlightFactory, InlineCodeHighlightProps, InlineCodeHighlightStylesNames, } from './CodeHighlight/InlineCodeHighlight';
|
|
15
|
+
export type { CodeHighlightDefaultLanguage, CodeHighlightTabsCode, CodeHighlightTabsFactory, CodeHighlightTabsProps, CodeHighlightTabsStylesNames, } from './CodeHighlightTabs/CodeHighlightTabs';
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { CodeHighlight } from './CodeHighlight/CodeHighlight';
|
|
2
|
+
export { InlineCodeHighlight } from './CodeHighlight/InlineCodeHighlight';
|
|
3
|
+
export { CodeHighlightTabs } from './CodeHighlightTabs/CodeHighlightTabs';
|
|
4
|
+
export { CodeHighlightControl } from './CodeHighlight/CodeHighlightControl/CodeHighlightControl';
|
|
5
|
+
export { useCodeHighlightContext } from './CodeHighlight/CodeHighlight.context';
|
|
6
|
+
export { CodeHighlightAdapterProvider, useHighlight, } from './CodeHighlightProvider/CodeHighlightProvider';
|
|
7
|
+
export { createHighlightJsAdapter } from './CodeHighlightProvider/adapters/highlight-js-adapter';
|
|
8
|
+
export { createShikiAdapter, stripShikiCodeBlocks, } from './CodeHighlightProvider/adapters/shiki-adapter';
|
|
9
|
+
export { plainTextAdapter } from './CodeHighlightProvider/adapters/plain-text-adapter';
|
|
10
|
+
export type { CodeHighlightAdapter, Highlighter, HighlighterInput, } from './CodeHighlightProvider/CodeHighlightProvider';
|
|
11
|
+
export type { CodeHighlightCssVariables, CodeHighlightFactory, CodeHighlightProps, CodeHighlightSettings, CodeHighlightStylesNames, } from './CodeHighlight/CodeHighlight';
|
|
12
|
+
export type { CodeHighlightContextValue } from './CodeHighlight/CodeHighlight.context';
|
|
13
|
+
export type { CodeHighlightControlProps } from './CodeHighlight/CodeHighlightControl/CodeHighlightControl';
|
|
14
|
+
export type { InlineCodeHighlightCssVariables, InlineCodeHighlightFactory, InlineCodeHighlightProps, InlineCodeHighlightStylesNames, } from './CodeHighlight/InlineCodeHighlight';
|
|
15
|
+
export type { CodeHighlightDefaultLanguage, CodeHighlightTabsCode, CodeHighlightTabsFactory, CodeHighlightTabsProps, CodeHighlightTabsStylesNames, } from './CodeHighlightTabs/CodeHighlightTabs';
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mantine-vue/code-highlight",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "Vue code highlight components equivalent to @mantine/code-highlight",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"files": [
|
|
7
|
+
"cjs",
|
|
8
|
+
"esm",
|
|
9
|
+
"lib",
|
|
10
|
+
"styles.css",
|
|
11
|
+
"styles.layer.css",
|
|
12
|
+
"styles"
|
|
13
|
+
],
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"*.css"
|
|
16
|
+
],
|
|
17
|
+
"main": "./cjs/index.cjs",
|
|
18
|
+
"module": "./esm/index.mjs",
|
|
19
|
+
"types": "./lib/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./lib/index.d.mts",
|
|
24
|
+
"default": "./esm/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"require": {
|
|
27
|
+
"types": "./lib/index.d.ts",
|
|
28
|
+
"default": "./cjs/index.cjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"./styles.css": "./styles.css",
|
|
32
|
+
"./styles.layer.css": "./styles.layer.css"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@mantine-vue/core": "workspace:*",
|
|
36
|
+
"@mantine-vue/hooks": "workspace:*",
|
|
37
|
+
"@vue/compiler-dom": "^3.5.0",
|
|
38
|
+
"@vue/test-utils": "^2.4.6",
|
|
39
|
+
"vue": "^3.5.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@mantine-vue/core": "1.1.1",
|
|
43
|
+
"@mantine-vue/hooks": "1.1.2",
|
|
44
|
+
"vue": "^3.5.0"
|
|
45
|
+
}
|
|
46
|
+
}
|