lone-format 0.12.2 → 0.14.0
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/dist/_chunks/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/_chunks/index-5wbkWClK.js +1006 -0
- package/dist/_chunks/index-AlOFzpXl.js +795 -0
- package/dist/_chunks/index-BAEkF-Fh.js +1785 -0
- package/dist/components/JsonFormat/JsonNode.vue.d.ts +29 -0
- package/dist/components/JsonFormat/index.d.ts +2 -0
- package/dist/components/JsonFormat/index.js +4 -0
- package/dist/components/JsonFormat/index.vue.d.ts +51 -0
- package/dist/components/JsonFormat/themes.d.ts +29 -0
- package/dist/components/JsonFormat/types.d.ts +97 -0
- package/dist/components/SqlFormat/SqlClauseNode.vue.d.ts +13 -0
- package/dist/components/SqlFormat/index.d.ts +5 -0
- package/dist/components/SqlFormat/index.js +5 -0
- package/dist/components/SqlFormat/index.vue.d.ts +44 -0
- package/dist/components/SqlFormat/parser.d.ts +34 -0
- package/dist/components/SqlFormat/themes.d.ts +33 -0
- package/dist/components/SqlFormat/types.d.ts +100 -0
- package/dist/components/XmlFormat/XmlNode.vue.d.ts +37 -0
- package/dist/components/XmlFormat/index.d.ts +7 -0
- package/dist/components/XmlFormat/index.js +27 -0
- package/dist/components/XmlFormat/index.vue.d.ts +58 -0
- package/dist/components/XmlFormat/parser.d.ts +93 -0
- package/dist/components/XmlFormat/themes.d.ts +29 -0
- package/dist/components/XmlFormat/types.d.ts +114 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/index.d.ts +6 -1
- package/dist/lone-format.css +1 -1
- package/dist/lone-format.js +13 -32008
- package/dist/lone-format.umd.cjs +50 -50
- package/dist/types/components.d.ts +1 -0
- package/dist/types/index.d.ts +6 -0
- package/package.json +8 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ThemeConfig } from './types';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
interface Props {
|
|
4
|
+
value: any;
|
|
5
|
+
keyName: string;
|
|
6
|
+
level: number;
|
|
7
|
+
path?: string;
|
|
8
|
+
expanded: Set<string>;
|
|
9
|
+
isLast?: boolean;
|
|
10
|
+
theme: ThemeConfig;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
13
|
+
"update:value": (path: string, value: any) => any;
|
|
14
|
+
"toggle-expand": (path: string) => any;
|
|
15
|
+
copy: (value: any) => any;
|
|
16
|
+
"update:key": (oldPath: string, newKey: string) => any;
|
|
17
|
+
}, string, PublicProps, Readonly<Props> & Readonly<{
|
|
18
|
+
"onUpdate:value"?: ((path: string, value: any) => any) | undefined;
|
|
19
|
+
"onToggle-expand"?: ((path: string) => any) | undefined;
|
|
20
|
+
onCopy?: ((value: any) => any) | undefined;
|
|
21
|
+
"onUpdate:key"?: ((oldPath: string, newKey: string) => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
path: string;
|
|
24
|
+
isLast: boolean;
|
|
25
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
26
|
+
keyRef: HTMLSpanElement;
|
|
27
|
+
valueRef: HTMLSpanElement;
|
|
28
|
+
}, HTMLDivElement>;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FilterConfig, ThemeType } from './types';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
interface Props {
|
|
4
|
+
modelValue: string;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
maxDepth?: number;
|
|
7
|
+
theme?: ThemeType;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: DefineComponent<Props, {
|
|
10
|
+
copyJson: () => Promise<void>;
|
|
11
|
+
compressSource: () => void;
|
|
12
|
+
expandAll: () => void;
|
|
13
|
+
collapseAll: () => void;
|
|
14
|
+
toggleExpand: (path: string) => void;
|
|
15
|
+
updateValue: (path: string, newValue: any) => void;
|
|
16
|
+
updateKey: (oldPath: string, newKey: string) => void;
|
|
17
|
+
filter: (config: FilterConfig) => void;
|
|
18
|
+
clearFilter: () => void;
|
|
19
|
+
sortKeys: () => void;
|
|
20
|
+
clearSortKeys: () => void;
|
|
21
|
+
isSorted: () => boolean;
|
|
22
|
+
isValidJson: () => boolean;
|
|
23
|
+
getParsedJson: () => any;
|
|
24
|
+
getFilteredJson: () => any;
|
|
25
|
+
getExpandedNodes: () => Set<string> & Omit<Set<string>, keyof Set<any>>;
|
|
26
|
+
getParseError: () => string;
|
|
27
|
+
getFilterError: () => string;
|
|
28
|
+
parseJson: (jsonString: string) => void;
|
|
29
|
+
copyValue: (value: any) => Promise<void>;
|
|
30
|
+
getValue: (value: any) => string;
|
|
31
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
32
|
+
"update:modelValue": (value: string) => any;
|
|
33
|
+
"copy-success": (value: string) => any;
|
|
34
|
+
"copy-error": (error: Error) => any;
|
|
35
|
+
"expand-all": () => any;
|
|
36
|
+
"collapse-all": () => any;
|
|
37
|
+
compress: (value: string) => any;
|
|
38
|
+
}, string, PublicProps, Readonly<Props> & Readonly<{
|
|
39
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
40
|
+
"onCopy-success"?: ((value: string) => any) | undefined;
|
|
41
|
+
"onCopy-error"?: ((error: Error) => any) | undefined;
|
|
42
|
+
"onExpand-all"?: (() => any) | undefined;
|
|
43
|
+
"onCollapse-all"?: (() => any) | undefined;
|
|
44
|
+
onCompress?: ((value: string) => any) | undefined;
|
|
45
|
+
}>, {
|
|
46
|
+
theme: ThemeType;
|
|
47
|
+
modelValue: string;
|
|
48
|
+
readonly: boolean;
|
|
49
|
+
maxDepth: number;
|
|
50
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ThemeConfig, ThemeType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* GitHub Light 主题配置
|
|
4
|
+
*/
|
|
5
|
+
export declare const githubLightTheme: ThemeConfig;
|
|
6
|
+
/**
|
|
7
|
+
* GitHub Dark 主题配置
|
|
8
|
+
*/
|
|
9
|
+
export declare const githubDarkTheme: ThemeConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Min Light 主题配置 - 极简浅色主题
|
|
12
|
+
*/
|
|
13
|
+
export declare const minLightTheme: ThemeConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Slack Ochin 主题配置 - 温暖橙色主题
|
|
16
|
+
*/
|
|
17
|
+
export declare const slackOchinTheme: ThemeConfig;
|
|
18
|
+
/**
|
|
19
|
+
* 预定义主题集合
|
|
20
|
+
*/
|
|
21
|
+
export declare const themes: Record<ThemeType, ThemeConfig>;
|
|
22
|
+
/**
|
|
23
|
+
* 获取主题配置
|
|
24
|
+
*/
|
|
25
|
+
export declare function getTheme(theme?: ThemeType): ThemeConfig;
|
|
26
|
+
/**
|
|
27
|
+
* 获取所有可用主题名称
|
|
28
|
+
*/
|
|
29
|
+
export declare function getAvailableThemes(): ThemeType[];
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter 类型枚举
|
|
3
|
+
*/
|
|
4
|
+
export type FilterType = 'jsonpath' | 'js';
|
|
5
|
+
/**
|
|
6
|
+
* 主题类型枚举
|
|
7
|
+
*/
|
|
8
|
+
export type ThemeType = 'github-light' | 'github-dark' | 'min-light' | 'slack-ochin';
|
|
9
|
+
/**
|
|
10
|
+
* Filter 配置接口
|
|
11
|
+
*/
|
|
12
|
+
export interface FilterConfig {
|
|
13
|
+
type: FilterType;
|
|
14
|
+
expression: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 主题配置接口
|
|
18
|
+
*/
|
|
19
|
+
export interface ThemeConfig {
|
|
20
|
+
name: ThemeType;
|
|
21
|
+
colors: {
|
|
22
|
+
background: string;
|
|
23
|
+
surfaceBackground: string;
|
|
24
|
+
border: string;
|
|
25
|
+
text: string;
|
|
26
|
+
textSecondary: string;
|
|
27
|
+
buttonBackground: string;
|
|
28
|
+
buttonBackgroundHover: string;
|
|
29
|
+
buttonBorder: string;
|
|
30
|
+
buttonText: string;
|
|
31
|
+
buttonPrimary: string;
|
|
32
|
+
buttonPrimaryHover: string;
|
|
33
|
+
success: string;
|
|
34
|
+
successBackground: string;
|
|
35
|
+
error: string;
|
|
36
|
+
errorBackground: string;
|
|
37
|
+
syntaxString: string;
|
|
38
|
+
syntaxNumber: string;
|
|
39
|
+
syntaxBoolean: string;
|
|
40
|
+
syntaxNull: string;
|
|
41
|
+
syntaxKey: string;
|
|
42
|
+
syntaxBracket: string;
|
|
43
|
+
hoverBackground: string;
|
|
44
|
+
selectionBackground: string;
|
|
45
|
+
collapsedBackground: string;
|
|
46
|
+
collapsedBackgroundHover: string;
|
|
47
|
+
collapsedText: string;
|
|
48
|
+
indentLine: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* JsonFormat 组件暴露的方法接口
|
|
53
|
+
*/
|
|
54
|
+
export interface JsonFormatExposed {
|
|
55
|
+
copyJson: () => Promise<void>;
|
|
56
|
+
expandAll: () => void;
|
|
57
|
+
collapseAll: () => void;
|
|
58
|
+
toggleExpand: (path: string) => void;
|
|
59
|
+
updateValue: (path: string, newValue: any) => void;
|
|
60
|
+
updateKey: (oldPath: string, newKey: string) => void;
|
|
61
|
+
filter: (config: FilterConfig) => void;
|
|
62
|
+
clearFilter: () => void;
|
|
63
|
+
sortKeys: () => void;
|
|
64
|
+
clearSortKeys: () => void;
|
|
65
|
+
isSorted: () => boolean;
|
|
66
|
+
isValidJson: () => boolean;
|
|
67
|
+
getParsedJson: () => any;
|
|
68
|
+
getFilteredJson: () => any;
|
|
69
|
+
getExpandedNodes: () => Set<string>;
|
|
70
|
+
getParseError: () => string;
|
|
71
|
+
getFilterError: () => string;
|
|
72
|
+
parseJson: (jsonString: string) => void;
|
|
73
|
+
copyValue: (value: any) => Promise<void>;
|
|
74
|
+
getValue: (value: any) => string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* JsonFormat 组件的 Props 接口
|
|
78
|
+
*/
|
|
79
|
+
export interface JsonFormatProps {
|
|
80
|
+
modelValue: string;
|
|
81
|
+
readonly?: boolean;
|
|
82
|
+
maxDepth?: number;
|
|
83
|
+
showToolbar?: boolean;
|
|
84
|
+
theme?: ThemeType;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* JsonFormat 组件的事件接口
|
|
88
|
+
*/
|
|
89
|
+
export interface JsonFormatEmits {
|
|
90
|
+
'update:modelValue': [value: string];
|
|
91
|
+
'copy-success': [value: string];
|
|
92
|
+
'copy-error': [error: Error];
|
|
93
|
+
'expand-all': [];
|
|
94
|
+
'collapse-all': [];
|
|
95
|
+
'filter-success': [filteredData: any];
|
|
96
|
+
'filter-error': [error: Error];
|
|
97
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SqlClause, ThemeConfig } from './types';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
interface Props {
|
|
4
|
+
clause: SqlClause;
|
|
5
|
+
expandedClauses: Set<string>;
|
|
6
|
+
theme: ThemeConfig;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
9
|
+
toggle: (path: string) => any;
|
|
10
|
+
}, string, PublicProps, Readonly<Props> & Readonly<{
|
|
11
|
+
onToggle?: ((path: string) => any) | undefined;
|
|
12
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ThemeType, SqlDialect } from './types';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
interface Props {
|
|
4
|
+
modelValue: string;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
theme?: ThemeType;
|
|
7
|
+
dialect?: SqlDialect;
|
|
8
|
+
tabWidth?: number;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: DefineComponent<Props, {
|
|
11
|
+
copySql: () => Promise<void>;
|
|
12
|
+
formatSource: () => void;
|
|
13
|
+
compressSource: () => void;
|
|
14
|
+
expandAll: () => void;
|
|
15
|
+
collapseAll: () => void;
|
|
16
|
+
toggleExpand: (path: string) => void;
|
|
17
|
+
isValidSql: () => boolean;
|
|
18
|
+
getParsedSql: () => null;
|
|
19
|
+
getParseError: () => string;
|
|
20
|
+
getValue: () => string;
|
|
21
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
22
|
+
"update:modelValue": (value: string) => any;
|
|
23
|
+
"copy-success": (value: string) => any;
|
|
24
|
+
"copy-error": (error: Error) => any;
|
|
25
|
+
"expand-all": () => any;
|
|
26
|
+
"collapse-all": () => any;
|
|
27
|
+
compress: (value: string) => any;
|
|
28
|
+
format: (value: string) => any;
|
|
29
|
+
}, string, PublicProps, Readonly<Props> & Readonly<{
|
|
30
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
31
|
+
"onCopy-success"?: ((value: string) => any) | undefined;
|
|
32
|
+
"onCopy-error"?: ((error: Error) => any) | undefined;
|
|
33
|
+
"onExpand-all"?: (() => any) | undefined;
|
|
34
|
+
"onCollapse-all"?: (() => any) | undefined;
|
|
35
|
+
onCompress?: ((value: string) => any) | undefined;
|
|
36
|
+
onFormat?: ((value: string) => any) | undefined;
|
|
37
|
+
}>, {
|
|
38
|
+
theme: ThemeType;
|
|
39
|
+
modelValue: string;
|
|
40
|
+
readonly: boolean;
|
|
41
|
+
tabWidth: number;
|
|
42
|
+
dialect: SqlDialect;
|
|
43
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ParsedSql, SqlFormatOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 验证 SQL 字符串
|
|
4
|
+
* 使用 sql-formatter 进行验证,同时保留基础检查
|
|
5
|
+
*/
|
|
6
|
+
export declare const validateSql: (sqlString: string) => {
|
|
7
|
+
valid: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 格式化 SQL 字符串
|
|
12
|
+
* 使用 sql-formatter 进行格式化
|
|
13
|
+
*/
|
|
14
|
+
export declare const formatSql: (sqlString: string, options?: SqlFormatOptions) => string;
|
|
15
|
+
/**
|
|
16
|
+
* 压缩 SQL(移除多余空格和换行)
|
|
17
|
+
*/
|
|
18
|
+
export declare const compressSql: (sqlString: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* 解析 SQL 为子句结构
|
|
21
|
+
* 使用 sql-formatter 格式化后进行解析;子查询内部递归拆分为嵌套子句。
|
|
22
|
+
*/
|
|
23
|
+
export declare const parseSqlClauses: (sqlString: string) => ParsedSql;
|
|
24
|
+
/**
|
|
25
|
+
* SQL 语法 Token 类型
|
|
26
|
+
*/
|
|
27
|
+
export interface SqlToken {
|
|
28
|
+
type: 'keyword' | 'function' | 'string' | 'number' | 'comment' | 'operator' | 'identifier' | 'punctuation' | 'whitespace';
|
|
29
|
+
value: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 高亮 SQL 语法(返回带有标记的 token 数组)
|
|
33
|
+
*/
|
|
34
|
+
export declare const tokenizeSql: (sqlString: string) => SqlToken[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ThemeConfig, ThemeType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* GitHub Light 主题
|
|
4
|
+
*/
|
|
5
|
+
declare const githubLight: ThemeConfig;
|
|
6
|
+
/**
|
|
7
|
+
* GitHub Dark 主题
|
|
8
|
+
*/
|
|
9
|
+
declare const githubDark: ThemeConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Min Light 主题 - 与 JsonFormat 保持一致
|
|
12
|
+
*/
|
|
13
|
+
declare const minLight: ThemeConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Slack Ochin 主题
|
|
16
|
+
*/
|
|
17
|
+
declare const slackOchin: ThemeConfig;
|
|
18
|
+
/**
|
|
19
|
+
* 主题映射表
|
|
20
|
+
*/
|
|
21
|
+
declare const themes: Record<ThemeType, ThemeConfig>;
|
|
22
|
+
/**
|
|
23
|
+
* 获取主题配置
|
|
24
|
+
*/
|
|
25
|
+
export declare const getTheme: (themeName: ThemeType) => ThemeConfig;
|
|
26
|
+
/**
|
|
27
|
+
* 获取所有主题名称
|
|
28
|
+
*/
|
|
29
|
+
export declare const getThemeNames: () => ThemeType[];
|
|
30
|
+
/**
|
|
31
|
+
* 导出所有主题
|
|
32
|
+
*/
|
|
33
|
+
export { githubLight, githubDark, minLight, slackOchin, themes };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQL 方言类型枚举
|
|
3
|
+
*/
|
|
4
|
+
export type SqlDialect = 'mysql' | 'postgresql' | 'sqlite' | 'sql' | 'plsql' | 'tsql';
|
|
5
|
+
/**
|
|
6
|
+
* 主题类型枚举(复用现有主题)
|
|
7
|
+
*/
|
|
8
|
+
export type ThemeType = 'github-light' | 'github-dark' | 'min-light' | 'slack-ochin';
|
|
9
|
+
/**
|
|
10
|
+
* SQL 子句类型
|
|
11
|
+
*/
|
|
12
|
+
export type SqlClauseType = 'SELECT' | 'FROM' | 'JOIN' | 'WHERE' | 'GROUP BY' | 'HAVING' | 'ORDER BY' | 'LIMIT' | 'INSERT' | 'INSERT INTO' | 'VALUES' | 'VALUE_TUPLE' | 'UPDATE' | 'SET' | 'DELETE' | 'CREATE' | 'ALTER' | 'DROP' | 'UNKNOWN';
|
|
13
|
+
/**
|
|
14
|
+
* 子句正文片段:要么是普通文本(括号、别名等),要么是嵌套的子句(子查询内部)
|
|
15
|
+
*/
|
|
16
|
+
export type SqlBodySegment = {
|
|
17
|
+
kind: 'text';
|
|
18
|
+
text: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'clause';
|
|
21
|
+
clause: SqlClause;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* SQL 子句节点接口
|
|
25
|
+
*/
|
|
26
|
+
export interface SqlClause {
|
|
27
|
+
type: SqlClauseType;
|
|
28
|
+
content: string;
|
|
29
|
+
raw: string;
|
|
30
|
+
collapsible: boolean;
|
|
31
|
+
path?: string;
|
|
32
|
+
body?: SqlBodySegment[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 主题配置接口
|
|
36
|
+
*/
|
|
37
|
+
export interface ThemeConfig {
|
|
38
|
+
name: ThemeType;
|
|
39
|
+
colors: {
|
|
40
|
+
background: string;
|
|
41
|
+
surfaceBackground: string;
|
|
42
|
+
hoverBackground: string;
|
|
43
|
+
border: string;
|
|
44
|
+
text: string;
|
|
45
|
+
textSecondary: string;
|
|
46
|
+
buttonBackground: string;
|
|
47
|
+
buttonBackgroundHover: string;
|
|
48
|
+
buttonBorder: string;
|
|
49
|
+
buttonText: string;
|
|
50
|
+
buttonPrimary: string;
|
|
51
|
+
buttonPrimaryHover: string;
|
|
52
|
+
success: string;
|
|
53
|
+
successBackground: string;
|
|
54
|
+
error: string;
|
|
55
|
+
errorBackground: string;
|
|
56
|
+
sqlKeyword: string;
|
|
57
|
+
sqlFunction: string;
|
|
58
|
+
sqlString: string;
|
|
59
|
+
sqlNumber: string;
|
|
60
|
+
sqlComment: string;
|
|
61
|
+
sqlOperator: string;
|
|
62
|
+
sqlIdentifier: string;
|
|
63
|
+
sqlPunctuation: string;
|
|
64
|
+
collapsedBackground: string;
|
|
65
|
+
collapsedText: string;
|
|
66
|
+
indentLine: string;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* SQL 格式化选项
|
|
71
|
+
*/
|
|
72
|
+
export interface SqlFormatOptions {
|
|
73
|
+
dialect?: SqlDialect;
|
|
74
|
+
tabWidth?: number;
|
|
75
|
+
keywordCase?: 'upper' | 'lower' | 'preserve';
|
|
76
|
+
useTabs?: boolean;
|
|
77
|
+
linesBetweenQueries?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* SQL 格式化组件暴露的方法
|
|
81
|
+
*/
|
|
82
|
+
export interface SqlFormatExposed {
|
|
83
|
+
copySql: () => Promise<void>;
|
|
84
|
+
formatSource: () => void;
|
|
85
|
+
compressSource: () => void;
|
|
86
|
+
expandAll: () => void;
|
|
87
|
+
collapseAll: () => void;
|
|
88
|
+
toggleExpand: (path: string) => void;
|
|
89
|
+
isValidSql: () => boolean;
|
|
90
|
+
getParsedSql: () => SqlClause[] | null;
|
|
91
|
+
getParseError: () => string;
|
|
92
|
+
getValue: () => string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 解析后的 SQL 数据
|
|
96
|
+
*/
|
|
97
|
+
export interface ParsedSql {
|
|
98
|
+
clauses: SqlClause[];
|
|
99
|
+
raw: string;
|
|
100
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ThemeConfig } from './types';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
interface Props {
|
|
4
|
+
node: any;
|
|
5
|
+
index: number;
|
|
6
|
+
level: number;
|
|
7
|
+
parentPath?: string;
|
|
8
|
+
expanded: Set<string>;
|
|
9
|
+
theme: ThemeConfig;
|
|
10
|
+
selfClosingTags?: Set<string>;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
13
|
+
"toggle-expand": (path: string) => any;
|
|
14
|
+
copy: (value: any) => any;
|
|
15
|
+
"update:tagName": (path: string, oldTag: string, newTag: string) => any;
|
|
16
|
+
"update:attributeName": (path: string, oldAttrName: string, newAttrName: string) => any;
|
|
17
|
+
"update:attributeValue": (path: string, attrName: string, newValue: string) => any;
|
|
18
|
+
"update:textContent": (path: string, newContent: string) => any;
|
|
19
|
+
"update:cdataContent": (path: string, newContent: string) => any;
|
|
20
|
+
}, string, PublicProps, Readonly<Props> & Readonly<{
|
|
21
|
+
"onToggle-expand"?: ((path: string) => any) | undefined;
|
|
22
|
+
onCopy?: ((value: any) => any) | undefined;
|
|
23
|
+
"onUpdate:tagName"?: ((path: string, oldTag: string, newTag: string) => any) | undefined;
|
|
24
|
+
"onUpdate:attributeName"?: ((path: string, oldAttrName: string, newAttrName: string) => any) | undefined;
|
|
25
|
+
"onUpdate:attributeValue"?: ((path: string, attrName: string, newValue: string) => any) | undefined;
|
|
26
|
+
"onUpdate:textContent"?: ((path: string, newContent: string) => any) | undefined;
|
|
27
|
+
"onUpdate:cdataContent"?: ((path: string, newContent: string) => any) | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
level: number;
|
|
30
|
+
parentPath: string;
|
|
31
|
+
selfClosingTags: Set<string>;
|
|
32
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
33
|
+
tagNameRef: HTMLSpanElement;
|
|
34
|
+
cdataContentRef: HTMLSpanElement;
|
|
35
|
+
textContentRef: HTMLSpanElement;
|
|
36
|
+
}, HTMLDivElement>;
|
|
37
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { X as s } from "../../_chunks/index-BAEkF-Fh.js";
|
|
2
|
+
import { a as o, o as m, d as l, r, e as i, i as g, k as n, q as d, f as h, h as X, l as f, g as u, c as b, b as c, j as p, n as x, m as N, p as k, s as A, t as C, v as T } from "../../_chunks/index-BAEkF-Fh.js";
|
|
3
|
+
export {
|
|
4
|
+
s as XmlFormat,
|
|
5
|
+
o as XmlNode,
|
|
6
|
+
m as annotateSelfClosingInfo,
|
|
7
|
+
l as buildXml,
|
|
8
|
+
r as buildXmlFromArray,
|
|
9
|
+
i as compressXml,
|
|
10
|
+
g as countNodes,
|
|
11
|
+
s as default,
|
|
12
|
+
n as extractAttributes,
|
|
13
|
+
d as extractSelfClosingTags,
|
|
14
|
+
h as formatXml,
|
|
15
|
+
X as getRootNodeName,
|
|
16
|
+
f as getTextContent,
|
|
17
|
+
u as getTheme,
|
|
18
|
+
b as githubDark,
|
|
19
|
+
c as githubLight,
|
|
20
|
+
p as hasAttributes,
|
|
21
|
+
x as isEmptyNode,
|
|
22
|
+
N as minLight,
|
|
23
|
+
k as parseXml,
|
|
24
|
+
A as slackOchin,
|
|
25
|
+
C as themes,
|
|
26
|
+
T as validateXml
|
|
27
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ThemeType, ParsedXml, FilterConfig } from './types';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
interface Props {
|
|
4
|
+
modelValue: string;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
maxDepth?: number;
|
|
7
|
+
theme?: ThemeType;
|
|
8
|
+
showComments?: boolean;
|
|
9
|
+
showCdata?: boolean;
|
|
10
|
+
preserveWhitespace?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: DefineComponent<Props, {
|
|
13
|
+
copyXml: () => Promise<void>;
|
|
14
|
+
compressSource: () => void;
|
|
15
|
+
formatSource: () => void;
|
|
16
|
+
expandAll: () => void;
|
|
17
|
+
collapseAll: () => void;
|
|
18
|
+
toggleExpand: (path: string) => void;
|
|
19
|
+
filter: (config: FilterConfig) => void;
|
|
20
|
+
clearFilter: () => void;
|
|
21
|
+
sort: () => void;
|
|
22
|
+
clearSort: () => void;
|
|
23
|
+
isSorted: () => boolean;
|
|
24
|
+
isValidXml: () => boolean;
|
|
25
|
+
getParsedXml: () => ParsedXml | null;
|
|
26
|
+
getFilteredXml: () => ParsedXml | null;
|
|
27
|
+
getExpandedNodes: () => Set<string> & Omit<Set<string>, keyof Set<any>>;
|
|
28
|
+
getParseError: () => string;
|
|
29
|
+
getFilterError: () => string;
|
|
30
|
+
parseXmlString: (xmlString: string) => void;
|
|
31
|
+
copyValue: (value: any) => Promise<void>;
|
|
32
|
+
getValue: (value: any) => string;
|
|
33
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
34
|
+
"update:modelValue": (value: string) => any;
|
|
35
|
+
"copy-success": (value: string) => any;
|
|
36
|
+
"copy-error": (error: Error) => any;
|
|
37
|
+
"expand-all": () => any;
|
|
38
|
+
"collapse-all": () => any;
|
|
39
|
+
compress: (value: string) => any;
|
|
40
|
+
format: (value: string) => any;
|
|
41
|
+
}, string, PublicProps, Readonly<Props> & Readonly<{
|
|
42
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
43
|
+
"onCopy-success"?: ((value: string) => any) | undefined;
|
|
44
|
+
"onCopy-error"?: ((error: Error) => any) | undefined;
|
|
45
|
+
"onExpand-all"?: (() => any) | undefined;
|
|
46
|
+
"onCollapse-all"?: (() => any) | undefined;
|
|
47
|
+
onCompress?: ((value: string) => any) | undefined;
|
|
48
|
+
onFormat?: ((value: string) => any) | undefined;
|
|
49
|
+
}>, {
|
|
50
|
+
theme: ThemeType;
|
|
51
|
+
modelValue: string;
|
|
52
|
+
readonly: boolean;
|
|
53
|
+
maxDepth: number;
|
|
54
|
+
showComments: boolean;
|
|
55
|
+
showCdata: boolean;
|
|
56
|
+
preserveWhitespace: boolean;
|
|
57
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
58
|
+
export default _default;
|