@tmagic/editor 1.3.0-alpha.4 → 1.3.0-alpha.5
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/tmagic-editor.js +32 -15
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +32 -15
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/Editor.vue +19 -1
- package/src/layouts/CodeEditor.vue +2 -2
- package/src/layouts/Framework.vue +13 -17
- package/types/components/FunctionEditor.vue.d.ts +7 -7
- package/types/layouts/CodeEditor.vue.d.ts +6 -6
- package/types/layouts/Framework.vue.d.ts +7 -31
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.3.0-alpha.
|
|
2
|
+
"version": "1.3.0-alpha.5",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@babel/core": "^7.18.0",
|
|
48
48
|
"@element-plus/icons-vue": "^2.0.9",
|
|
49
|
-
"@tmagic/core": "1.3.0-alpha.
|
|
50
|
-
"@tmagic/design": "1.3.0-alpha.
|
|
51
|
-
"@tmagic/form": "1.3.0-alpha.
|
|
52
|
-
"@tmagic/schema": "1.3.0-alpha.
|
|
53
|
-
"@tmagic/stage": "1.3.0-alpha.
|
|
54
|
-
"@tmagic/table": "1.3.0-alpha.
|
|
55
|
-
"@tmagic/utils": "1.3.0-alpha.
|
|
49
|
+
"@tmagic/core": "1.3.0-alpha.5",
|
|
50
|
+
"@tmagic/design": "1.3.0-alpha.5",
|
|
51
|
+
"@tmagic/form": "1.3.0-alpha.5",
|
|
52
|
+
"@tmagic/schema": "1.3.0-alpha.5",
|
|
53
|
+
"@tmagic/stage": "1.3.0-alpha.5",
|
|
54
|
+
"@tmagic/table": "1.3.0-alpha.5",
|
|
55
|
+
"@tmagic/utils": "1.3.0-alpha.5",
|
|
56
56
|
"buffer": "^6.0.3",
|
|
57
57
|
"color": "^3.1.3",
|
|
58
58
|
"events": "^3.3.0",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"vue": "^3.3.4"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@tmagic/design": "1.3.0-alpha.
|
|
68
|
-
"@tmagic/form": "1.3.0-alpha.
|
|
67
|
+
"@tmagic/design": "1.3.0-alpha.5",
|
|
68
|
+
"@tmagic/form": "1.3.0-alpha.5",
|
|
69
69
|
"monaco-editor": "^0.34.0",
|
|
70
70
|
"vue": "^3.3.4"
|
|
71
71
|
},
|
package/src/Editor.vue
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Framework
|
|
2
|
+
<Framework>
|
|
3
|
+
<template #header>
|
|
4
|
+
<slot name="header"></slot>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
3
7
|
<template #nav>
|
|
4
8
|
<slot name="nav" :editorService="editorService"><TMagicNavMenu :data="menu"></TMagicNavMenu></slot>
|
|
5
9
|
</template>
|
|
6
10
|
|
|
11
|
+
<template #content-before>
|
|
12
|
+
<slot name="content-before"></slot>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<template #src-code><slot name="src-code" :editorService="editorService"></slot></template>
|
|
16
|
+
|
|
7
17
|
<template #sidebar>
|
|
8
18
|
<slot name="sidebar" :editorService="editorService">
|
|
9
19
|
<Sidebar :data="sidebar" :layer-content-menu="layerContentMenu">
|
|
@@ -60,6 +70,14 @@
|
|
|
60
70
|
</template>
|
|
61
71
|
|
|
62
72
|
<template #empty><slot name="empty" :editorService="editorService"></slot></template>
|
|
73
|
+
|
|
74
|
+
<template #content-after>
|
|
75
|
+
<slot name="content-after"></slot>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<template #footer>
|
|
79
|
+
<slot name="footer"></slot>
|
|
80
|
+
</template>
|
|
63
81
|
</Framework>
|
|
64
82
|
</template>
|
|
65
83
|
|
|
@@ -14,8 +14,8 @@ defineOptions({
|
|
|
14
14
|
|
|
15
15
|
const props = withDefaults(
|
|
16
16
|
defineProps<{
|
|
17
|
-
initValues?: string |
|
|
18
|
-
modifiedValues?: string |
|
|
17
|
+
initValues?: string | Record<string | number, any> | null;
|
|
18
|
+
modifiedValues?: string | Record<string | number, any> | null;
|
|
19
19
|
type?: 'diff';
|
|
20
20
|
language?: string;
|
|
21
21
|
options?: {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="m-editor">
|
|
3
|
-
<slot name="
|
|
3
|
+
<slot name="header"></slot>
|
|
4
4
|
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@save="saveCode"
|
|
11
|
-
|
|
5
|
+
<slot name="nav"></slot>
|
|
6
|
+
|
|
7
|
+
<slot name="content-before"></slot>
|
|
8
|
+
|
|
9
|
+
<slot name="src-code" v-if="showSrc">
|
|
10
|
+
<CodeEditor class="m-editor-content" :init-values="root" :options="codeOptions" @save="saveCode"></CodeEditor>
|
|
11
|
+
</slot>
|
|
12
12
|
|
|
13
13
|
<Layout
|
|
14
14
|
v-else
|
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
</TMagicScrollbar>
|
|
40
40
|
</template>
|
|
41
41
|
</Layout>
|
|
42
|
+
|
|
43
|
+
<slot name="content-after"></slot>
|
|
44
|
+
<slot name="footer"></slot>
|
|
42
45
|
</div>
|
|
43
46
|
</template>
|
|
44
47
|
|
|
@@ -51,6 +54,7 @@ import Layout from '@editor/components/Layout.vue';
|
|
|
51
54
|
import type { GetColumnWidth, Services } from '@editor/type';
|
|
52
55
|
|
|
53
56
|
import AddPageBox from './AddPageBox.vue';
|
|
57
|
+
import CodeEditor from './CodeEditor.vue';
|
|
54
58
|
|
|
55
59
|
defineOptions({
|
|
56
60
|
name: 'MEditorFramework',
|
|
@@ -59,15 +63,7 @@ defineOptions({
|
|
|
59
63
|
const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
60
64
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
defineProps<{
|
|
64
|
-
codeOptions?: Record<string, any>;
|
|
65
|
-
}>(),
|
|
66
|
-
{
|
|
67
|
-
codeOptions: () => ({}),
|
|
68
|
-
},
|
|
69
|
-
);
|
|
70
|
-
|
|
66
|
+
const codeOptions = inject('codeOptions', {});
|
|
71
67
|
const { editorService, uiService } = inject<Services>('services') || {};
|
|
72
68
|
|
|
73
69
|
const root = computed(() => editorService?.get('root'));
|
|
@@ -70,9 +70,9 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
70
70
|
class?: unknown;
|
|
71
71
|
style?: unknown;
|
|
72
72
|
readonly id: Id;
|
|
73
|
+
readonly language?: string | undefined;
|
|
73
74
|
readonly codeOptions?: Object | undefined;
|
|
74
75
|
readonly content: string;
|
|
75
|
-
readonly language?: string | undefined;
|
|
76
76
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
77
77
|
onSaveAndClose?: ((...args: any[]) => any) | undefined;
|
|
78
78
|
};
|
|
@@ -98,6 +98,9 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
98
98
|
type: import("vue").PropType<boolean>;
|
|
99
99
|
default: boolean;
|
|
100
100
|
};
|
|
101
|
+
language: {
|
|
102
|
+
type: import("vue").PropType<string>;
|
|
103
|
+
};
|
|
101
104
|
codeOptions: {
|
|
102
105
|
type: import("vue").PropType<Object>;
|
|
103
106
|
};
|
|
@@ -105,9 +108,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
105
108
|
type: import("vue").PropType<string>;
|
|
106
109
|
required: true;
|
|
107
110
|
};
|
|
108
|
-
language: {
|
|
109
|
-
type: import("vue").PropType<string>;
|
|
110
|
-
};
|
|
111
111
|
autoSaveDraft: {
|
|
112
112
|
type: import("vue").PropType<boolean>;
|
|
113
113
|
default: boolean;
|
|
@@ -150,6 +150,9 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
150
150
|
type: import("vue").PropType<boolean>;
|
|
151
151
|
default: boolean;
|
|
152
152
|
};
|
|
153
|
+
language: {
|
|
154
|
+
type: import("vue").PropType<string>;
|
|
155
|
+
};
|
|
153
156
|
codeOptions: {
|
|
154
157
|
type: import("vue").PropType<Object>;
|
|
155
158
|
};
|
|
@@ -157,9 +160,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
157
160
|
type: import("vue").PropType<string>;
|
|
158
161
|
required: true;
|
|
159
162
|
};
|
|
160
|
-
language: {
|
|
161
|
-
type: import("vue").PropType<string>;
|
|
162
|
-
};
|
|
163
163
|
autoSaveDraft: {
|
|
164
164
|
type: import("vue").PropType<boolean>;
|
|
165
165
|
default: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as monaco from 'monaco-editor';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
-
initValues?: string |
|
|
4
|
-
modifiedValues?: string |
|
|
3
|
+
initValues?: string | Record<string | number, any> | null | undefined;
|
|
4
|
+
modifiedValues?: string | Record<string | number, any> | null | undefined;
|
|
5
5
|
type?: "diff" | undefined;
|
|
6
6
|
language?: string | undefined;
|
|
7
7
|
options?: {
|
|
@@ -18,9 +18,9 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
18
18
|
getEditor(): monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor | null;
|
|
19
19
|
setEditorValue: (v: any, m: any) => void | undefined;
|
|
20
20
|
focus(): void;
|
|
21
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("
|
|
22
|
-
initValues?: string |
|
|
23
|
-
modifiedValues?: string |
|
|
21
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("initd" | "save")[], "initd" | "save", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
22
|
+
initValues?: string | Record<string | number, any> | null | undefined;
|
|
23
|
+
modifiedValues?: string | Record<string | number, any> | null | undefined;
|
|
24
24
|
type?: "diff" | undefined;
|
|
25
25
|
language?: string | undefined;
|
|
26
26
|
options?: {
|
|
@@ -34,8 +34,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
34
34
|
tabSize: number;
|
|
35
35
|
};
|
|
36
36
|
}>>> & {
|
|
37
|
-
onSave?: ((...args: any[]) => any) | undefined;
|
|
38
37
|
onInitd?: ((...args: any[]) => any) | undefined;
|
|
38
|
+
onSave?: ((...args: any[]) => any) | undefined;
|
|
39
39
|
}, {
|
|
40
40
|
options: {
|
|
41
41
|
[key: string]: any;
|
|
@@ -1,42 +1,18 @@
|
|
|
1
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
codeOptions?: Record<string, any> | undefined;
|
|
7
|
-
}>, {
|
|
8
|
-
codeOptions: () => {};
|
|
9
|
-
}>>>, {
|
|
10
|
-
codeOptions: Record<string, any>;
|
|
11
|
-
}, {}>, {
|
|
12
|
-
nav?(_: {
|
|
13
|
-
class: string;
|
|
14
|
-
}): any;
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
|
|
2
|
+
header?(_: {}): any;
|
|
3
|
+
nav?(_: {}): any;
|
|
4
|
+
"content-before"?(_: {}): any;
|
|
5
|
+
"src-code"?(_: {}): any;
|
|
15
6
|
sidebar?(_: {}): any;
|
|
16
7
|
workspace?(_: {}): any;
|
|
17
8
|
empty?(_: {}): any;
|
|
18
9
|
"props-panel"?(_: {}): any;
|
|
10
|
+
"content-after"?(_: {}): any;
|
|
11
|
+
footer?(_: {}): any;
|
|
19
12
|
}>;
|
|
20
13
|
export default _default;
|
|
21
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
22
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
23
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
24
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
25
|
-
} : {
|
|
26
|
-
type: import('vue').PropType<T[K]>;
|
|
27
|
-
required: true;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
type __VLS_WithDefaults<P, D> = {
|
|
31
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
32
|
-
default: D[K];
|
|
33
|
-
}> : P[K];
|
|
34
|
-
};
|
|
35
14
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
36
15
|
new (): {
|
|
37
16
|
$slots: S;
|
|
38
17
|
};
|
|
39
18
|
};
|
|
40
|
-
type __VLS_Prettify<T> = {
|
|
41
|
-
[K in keyof T]: T[K];
|
|
42
|
-
} & {};
|