lone-format 0.12.2 → 0.13.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.
Files changed (30) hide show
  1. package/dist/_chunks/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  2. package/dist/_chunks/index-13rwh2MK.js +788 -0
  3. package/dist/_chunks/index-DfjCsqDT.js +1005 -0
  4. package/dist/_chunks/index-DvNM7Tl4.js +1784 -0
  5. package/dist/components/JsonFormat/JsonNode.vue.d.ts +29 -0
  6. package/dist/components/JsonFormat/index.d.ts +2 -0
  7. package/dist/components/JsonFormat/index.js +4 -0
  8. package/dist/components/JsonFormat/index.vue.d.ts +50 -0
  9. package/dist/components/JsonFormat/themes.d.ts +29 -0
  10. package/dist/components/JsonFormat/types.d.ts +96 -0
  11. package/dist/components/SqlFormat/SqlClauseNode.vue.d.ts +13 -0
  12. package/dist/components/SqlFormat/index.d.ts +5 -0
  13. package/dist/components/SqlFormat/index.js +5 -0
  14. package/dist/components/SqlFormat/index.vue.d.ts +43 -0
  15. package/dist/components/SqlFormat/parser.d.ts +34 -0
  16. package/dist/components/SqlFormat/themes.d.ts +33 -0
  17. package/dist/components/SqlFormat/types.d.ts +99 -0
  18. package/dist/components/XmlFormat/XmlNode.vue.d.ts +37 -0
  19. package/dist/components/XmlFormat/index.d.ts +7 -0
  20. package/dist/components/XmlFormat/index.js +27 -0
  21. package/dist/components/XmlFormat/index.vue.d.ts +57 -0
  22. package/dist/components/XmlFormat/parser.d.ts +93 -0
  23. package/dist/components/XmlFormat/themes.d.ts +29 -0
  24. package/dist/components/XmlFormat/types.d.ts +113 -0
  25. package/dist/components/index.d.ts +6 -0
  26. package/dist/index.d.ts +6 -1
  27. package/dist/lone-format.js +13 -32008
  28. package/dist/types/components.d.ts +1 -0
  29. package/dist/types/index.d.ts +6 -0
  30. package/package.json +8 -3
@@ -0,0 +1,29 @@
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
+ * Minimal Light 主题
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 { githubLight, githubDark, minLight, slackOchin, themes };
@@ -0,0 +1,113 @@
1
+ /**
2
+ * XML 节点类型枚举
3
+ */
4
+ export type XmlNodeType = 'element' | 'text' | 'comment' | 'cdata' | 'declaration';
5
+ /**
6
+ * 主题类型枚举(复用 JSON 的主题)
7
+ */
8
+ export type ThemeType = 'github-light' | 'github-dark' | 'min-light' | 'slack-ochin';
9
+ /**
10
+ * 过滤器类型枚举(仅支持 XPath)
11
+ */
12
+ export type FilterType = 'xpath';
13
+ /**
14
+ * XML 节点接口
15
+ */
16
+ export interface XmlNode {
17
+ type: XmlNodeType;
18
+ tagName?: string;
19
+ attributes?: Record<string, string>;
20
+ children?: XmlNode[];
21
+ content?: string;
22
+ namespace?: string;
23
+ prefix?: string;
24
+ path?: string;
25
+ }
26
+ /**
27
+ * 过滤器配置接口
28
+ */
29
+ export interface FilterConfig {
30
+ type: FilterType;
31
+ expression: string;
32
+ }
33
+ /**
34
+ * 主题配置接口
35
+ */
36
+ export interface ThemeConfig {
37
+ name: ThemeType;
38
+ colors: {
39
+ background: string;
40
+ surfaceBackground: string;
41
+ border: string;
42
+ text: string;
43
+ textSecondary: string;
44
+ buttonBackground: string;
45
+ buttonBackgroundHover: string;
46
+ buttonBorder: string;
47
+ buttonText: string;
48
+ buttonPrimary: string;
49
+ buttonPrimaryHover: string;
50
+ success: string;
51
+ successBackground: string;
52
+ error: string;
53
+ errorBackground: string;
54
+ xmlTag: string;
55
+ xmlAttribute: string;
56
+ xmlAttributeValue: string;
57
+ xmlText: string;
58
+ xmlComment: string;
59
+ xmlCdata: string;
60
+ xmlDeclaration: string;
61
+ xmlBracket: string;
62
+ xmlEquals: string;
63
+ xmlQuote: string;
64
+ collapsedBackground: string;
65
+ collapsedBackgroundHover: string;
66
+ collapsedText: string;
67
+ indentLine: string;
68
+ };
69
+ }
70
+ /**
71
+ * XML 格式化选项
72
+ */
73
+ export interface XmlFormatOptions {
74
+ indentBy?: string;
75
+ format?: boolean;
76
+ showComments?: boolean;
77
+ showCdata?: boolean;
78
+ showDeclaration?: boolean;
79
+ preserveWhitespace?: boolean;
80
+ sortAttributes?: boolean;
81
+ selfClosingTags?: boolean;
82
+ }
83
+ /**
84
+ * 解析后的 XML 数据结构(fast-xml-parser 格式)
85
+ * 使用 preserveOrder: true 时返回数组结构
86
+ */
87
+ export type ParsedXml = any[] | {
88
+ [key: string]: any;
89
+ };
90
+ /**
91
+ * XmlFormat 组件暴露的方法接口
92
+ */
93
+ export interface XmlFormatExposed {
94
+ copyXml: () => Promise<void>;
95
+ compressSource: () => void;
96
+ formatSource: () => void;
97
+ expandAll: () => void;
98
+ collapseAll: () => void;
99
+ toggleExpand: (path: string) => void;
100
+ filter: (config: FilterConfig) => void;
101
+ clearFilter: () => void;
102
+ sort: () => void;
103
+ clearSort: () => void;
104
+ isSorted: () => boolean;
105
+ isValidXml: () => boolean;
106
+ getParsedXml: () => ParsedXml | null;
107
+ getFilteredXml: () => ParsedXml | null;
108
+ getExpandedNodes: () => Set<string>;
109
+ getParseError: () => string;
110
+ getFilterError: () => string;
111
+ parseXmlString: (xmlString: string) => void;
112
+ copyValue: (value: any) => Promise<void>;
113
+ }
@@ -0,0 +1,6 @@
1
+ export { default as JsonFormat } from './JsonFormat/index.vue';
2
+ export { default as XmlFormat } from './XmlFormat/index.vue';
3
+ export { default as SqlFormat } from './SqlFormat/index.vue';
4
+ export type { FilterConfig, FilterType, ThemeConfig, ThemeType, JsonFormatExposed } from './JsonFormat/types';
5
+ export type { XmlNode, XmlNodeType, ParsedXml, XmlFormatOptions, XmlFormatExposed } from './XmlFormat/types';
6
+ export type { SqlDialect, SqlFormatOptions, SqlFormatExposed } from './SqlFormat/types';
package/dist/index.d.ts CHANGED
@@ -1 +1,6 @@
1
- export {}
1
+ import { App } from 'vue';
2
+ declare const _default: {
3
+ install: (app: App) => void;
4
+ };
5
+ export default _default;
6
+ export * from './components';