@tmagic/editor 1.1.0-beta.1 → 1.1.0-beta.12

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 (106) hide show
  1. package/dist/style.css +5 -1
  2. package/dist/{tmagic-editor.es.js → tmagic-editor.mjs} +1449 -1205
  3. package/dist/tmagic-editor.mjs.map +1 -0
  4. package/dist/tmagic-editor.umd.js +1463 -1219
  5. package/dist/tmagic-editor.umd.js.map +1 -1
  6. package/package.json +23 -21
  7. package/src/Editor.vue +24 -15
  8. package/src/components/ContentMenu.vue +87 -99
  9. package/src/components/Icon.vue +1 -1
  10. package/src/components/ScrollViewer.vue +2 -2
  11. package/src/components/ToolButton.vue +150 -167
  12. package/src/fields/UISelect.vue +51 -72
  13. package/src/index.ts +2 -1
  14. package/src/layouts/AddPageBox.vue +2 -2
  15. package/src/layouts/Framework.vue +1 -1
  16. package/src/layouts/NavMenu.vue +2 -2
  17. package/src/layouts/PropsPanel.vue +1 -1
  18. package/src/layouts/Resizer.vue +1 -1
  19. package/src/layouts/sidebar/ComponentListPanel.vue +6 -17
  20. package/src/layouts/sidebar/LayerMenu.vue +2 -2
  21. package/src/layouts/sidebar/LayerPanel.vue +52 -12
  22. package/src/layouts/sidebar/Sidebar.vue +1 -1
  23. package/src/layouts/sidebar/TabPane.vue +2 -2
  24. package/src/layouts/workspace/PageBar.vue +63 -192
  25. package/src/layouts/workspace/PageBarScrollContainer.vue +111 -0
  26. package/src/layouts/workspace/Stage.vue +198 -219
  27. package/src/layouts/workspace/ViewerMenu.vue +140 -147
  28. package/src/layouts/workspace/Workspace.vue +14 -12
  29. package/src/services/BaseService.ts +5 -10
  30. package/src/services/componentList.ts +3 -3
  31. package/src/services/editor.ts +208 -147
  32. package/src/services/events.ts +1 -1
  33. package/src/services/history.ts +1 -1
  34. package/src/services/props.ts +74 -49
  35. package/src/services/storage.ts +133 -0
  36. package/src/services/ui.ts +10 -4
  37. package/src/theme/component-list-panel.scss +5 -0
  38. package/src/theme/framework.scss +1 -1
  39. package/src/theme/stage.scss +2 -2
  40. package/src/type.ts +25 -7
  41. package/src/utils/config.ts +1 -1
  42. package/src/utils/editor.ts +20 -12
  43. package/src/utils/operator.ts +109 -0
  44. package/src/utils/props.ts +2 -27
  45. package/src/utils/scroll-viewer.ts +1 -1
  46. package/tsconfig.build.json +13 -0
  47. package/{dist/types/src → types}/Editor.vue.d.ts +17 -9
  48. package/types/components/ContentMenu.vue.d.ts +116 -0
  49. package/types/components/Icon.vue.d.ts +13 -0
  50. package/types/components/ScrollViewer.vue.d.ts +22 -0
  51. package/types/components/ToolButton.vue.d.ts +109 -0
  52. package/types/fields/Code.vue.d.ts +23 -0
  53. package/{dist/types/src → types}/fields/CodeLink.vue.d.ts +4 -6
  54. package/types/fields/UISelect.vue.d.ts +83 -0
  55. package/{dist/types/src → types}/index.d.ts +4 -1
  56. package/types/layouts/AddPageBox.vue.d.ts +4 -0
  57. package/{dist/types/src → types}/layouts/CodeEditor.vue.d.ts +11 -13
  58. package/types/layouts/Framework.vue.d.ts +22 -0
  59. package/types/layouts/NavMenu.vue.d.ts +25 -0
  60. package/types/layouts/PropsPanel.vue.d.ts +245 -0
  61. package/types/layouts/Resizer.vue.d.ts +12 -0
  62. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +14 -0
  63. package/types/layouts/sidebar/LayerMenu.vue.d.ts +100 -0
  64. package/types/layouts/sidebar/LayerPanel.vue.d.ts +1101 -0
  65. package/{dist/types/src → types}/layouts/sidebar/Sidebar.vue.d.ts +3 -5
  66. package/types/layouts/sidebar/TabPane.vue.d.ts +14 -0
  67. package/types/layouts/workspace/PageBar.vue.d.ts +54 -0
  68. package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +48 -0
  69. package/types/layouts/workspace/Stage.vue.d.ts +46 -0
  70. package/types/layouts/workspace/ViewerMenu.vue.d.ts +88 -0
  71. package/types/layouts/workspace/Workspace.vue.d.ts +6 -0
  72. package/{dist/types/src → types}/services/BaseService.d.ts +0 -0
  73. package/types/services/componentList.d.ts +14 -0
  74. package/{dist/types/src → types}/services/editor.d.ts +22 -14
  75. package/{dist/types/src → types}/services/events.d.ts +0 -0
  76. package/{dist/types/src → types}/services/history.d.ts +0 -0
  77. package/types/services/props.d.ts +97 -0
  78. package/types/services/storage.d.ts +56 -0
  79. package/{dist/types/src → types}/services/ui.d.ts +1 -1
  80. package/{dist/types/src → types}/type.d.ts +18 -1
  81. package/{dist/types/src → types}/utils/compose.d.ts +1 -1
  82. package/{dist/types/src → types}/utils/config.d.ts +0 -0
  83. package/{dist/types/src → types}/utils/editor.d.ts +6 -3
  84. package/{dist/types/src → types}/utils/index.d.ts +0 -0
  85. package/{dist/types/src → types}/utils/logger.d.ts +0 -0
  86. package/types/utils/operator.d.ts +21 -0
  87. package/{dist/types/src → types}/utils/polyfills.d.ts +0 -0
  88. package/{dist/types/src → types}/utils/props.d.ts +2 -23
  89. package/{dist/types/src → types}/utils/scroll-viewer.d.ts +0 -0
  90. package/{dist/types/src → types}/utils/undo-redo.d.ts +0 -0
  91. package/dist/tmagic-editor.es.js.map +0 -1
  92. package/dist/types/src/components/Icon.vue.d.ts +0 -14
  93. package/dist/types/src/components/ScrollViewer.vue.d.ts +0 -24
  94. package/dist/types/src/fields/Code.vue.d.ts +0 -25
  95. package/dist/types/src/layouts/AddPageBox.vue.d.ts +0 -5
  96. package/dist/types/src/layouts/Framework.vue.d.ts +0 -24
  97. package/dist/types/src/layouts/NavMenu.vue.d.ts +0 -27
  98. package/dist/types/src/layouts/PropsPanel.vue.d.ts +0 -13
  99. package/dist/types/src/layouts/Resizer.vue.d.ts +0 -14
  100. package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +0 -16
  101. package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +0 -16
  102. package/dist/types/src/layouts/workspace/Workspace.vue.d.ts +0 -8
  103. package/dist/types/src/services/props.d.ts +0 -42
  104. package/dist/types/src/shims-vue.d.ts +0 -6
  105. package/dist/types/src/vite-env.d.ts +0 -1
  106. package/src/vite-env.d.ts +0 -1
@@ -1,8 +1,6 @@
1
- import type { Ref } from '@vue/reactivity';
2
- import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from '@vue/runtime-core';
3
1
  import { PropType } from 'vue';
4
2
  import { SideBarData } from '../../type';
5
- declare const _default: DefineComponent<{
3
+ declare const _default: import("vue").DefineComponent<{
6
4
  data: {
7
5
  type: PropType<SideBarData>;
8
6
  default: () => {
@@ -12,8 +10,8 @@ declare const _default: DefineComponent<{
12
10
  };
13
11
  };
14
12
  }, {
15
- activeTabName: Ref<string>;
16
- }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
13
+ activeTabName: import("vue").Ref<string>;
14
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
17
15
  data: {
18
16
  type: PropType<SideBarData>;
19
17
  default: () => {
@@ -0,0 +1,14 @@
1
+ import { PropType } from 'vue';
2
+ import { SideComponent, SideItem } from '../../type';
3
+ declare const _default: import("vue").DefineComponent<{
4
+ data: {
5
+ type: PropType<SideItem>;
6
+ };
7
+ }, {
8
+ config: import("vue").ComputedRef<SideComponent | undefined>;
9
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
10
+ data: {
11
+ type: PropType<SideItem>;
12
+ };
13
+ }>>, {}>;
14
+ export default _default;
@@ -0,0 +1,54 @@
1
+ import type { MPage } from '@tmagic/schema';
2
+ declare const _default: {
3
+ new (...args: any[]): {
4
+ $: import("vue").ComponentInternalInstance;
5
+ $data: {};
6
+ $props: Partial<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
7
+ $attrs: {
8
+ [x: string]: unknown;
9
+ };
10
+ $refs: {
11
+ [x: string]: unknown;
12
+ };
13
+ $slots: Readonly<{
14
+ [name: string]: import("vue").Slot | undefined;
15
+ }>;
16
+ $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
17
+ $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
18
+ $emit: ((event: string, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
19
+ $el: any;
20
+ $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {}> & {
21
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
22
+ created?: ((() => void) | (() => void)[]) | undefined;
23
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
24
+ mounted?: ((() => void) | (() => void)[]) | undefined;
25
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
26
+ updated?: ((() => void) | (() => void)[]) | undefined;
27
+ activated?: ((() => void) | (() => void)[]) | undefined;
28
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
29
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
30
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
31
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
32
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
33
+ renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
34
+ renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
35
+ errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
36
+ };
37
+ $forceUpdate: () => void;
38
+ $nextTick: typeof import("vue").nextTick;
39
+ $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
40
+ } & Readonly<import("vue").ExtractPropTypes<{}>> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
41
+ __isFragment?: undefined;
42
+ __isTeleport?: undefined;
43
+ __isSuspense?: undefined;
44
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
45
+ $slots: {
46
+ 'page-bar-title': (_: {
47
+ page: MPage;
48
+ }) => any;
49
+ 'page-bar-popover': (_: {
50
+ page: MPage;
51
+ }) => any;
52
+ };
53
+ });
54
+ export default _default;
@@ -0,0 +1,48 @@
1
+ declare const _default: {
2
+ new (...args: any[]): {
3
+ $: import("vue").ComponentInternalInstance;
4
+ $data: {};
5
+ $props: Partial<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
6
+ $attrs: {
7
+ [x: string]: unknown;
8
+ };
9
+ $refs: {
10
+ [x: string]: unknown;
11
+ };
12
+ $slots: Readonly<{
13
+ [name: string]: import("vue").Slot | undefined;
14
+ }>;
15
+ $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
16
+ $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
17
+ $emit: ((event: string, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
18
+ $el: any;
19
+ $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {}> & {
20
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
21
+ created?: ((() => void) | (() => void)[]) | undefined;
22
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
23
+ mounted?: ((() => void) | (() => void)[]) | undefined;
24
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
25
+ updated?: ((() => void) | (() => void)[]) | undefined;
26
+ activated?: ((() => void) | (() => void)[]) | undefined;
27
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
28
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
29
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
30
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
31
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
32
+ renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
33
+ renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
34
+ errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
35
+ };
36
+ $forceUpdate: () => void;
37
+ $nextTick: typeof import("vue").nextTick;
38
+ $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
39
+ } & Readonly<import("vue").ExtractPropTypes<{}>> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
40
+ __isFragment?: undefined;
41
+ __isTeleport?: undefined;
42
+ __isSuspense?: undefined;
43
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
44
+ $slots: {
45
+ default: (_: {}) => any;
46
+ };
47
+ });
48
+ export default _default;
@@ -0,0 +1,46 @@
1
+ declare const _default: {
2
+ new (...args: any[]): {
3
+ $: import("vue").ComponentInternalInstance;
4
+ $data: {};
5
+ $props: Partial<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
6
+ $attrs: {
7
+ [x: string]: unknown;
8
+ };
9
+ $refs: {
10
+ [x: string]: unknown;
11
+ };
12
+ $slots: Readonly<{
13
+ [name: string]: import("vue").Slot | undefined;
14
+ }>;
15
+ $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
16
+ $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
17
+ $emit: ((event: string, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
18
+ $el: any;
19
+ $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {}> & {
20
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
21
+ created?: ((() => void) | (() => void)[]) | undefined;
22
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
23
+ mounted?: ((() => void) | (() => void)[]) | undefined;
24
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
25
+ updated?: ((() => void) | (() => void)[]) | undefined;
26
+ activated?: ((() => void) | (() => void)[]) | undefined;
27
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
28
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
29
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
30
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
31
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
32
+ renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
33
+ renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
34
+ errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
35
+ };
36
+ $forceUpdate: () => void;
37
+ $nextTick: typeof import("vue").nextTick;
38
+ $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
39
+ } & Readonly<import("vue").ExtractPropTypes<{}>> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
40
+ __isFragment?: undefined;
41
+ __isTeleport?: undefined;
42
+ __isSuspense?: undefined;
43
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
44
+ $slots: {};
45
+ });
46
+ export default _default;
@@ -0,0 +1,88 @@
1
+ declare const _default: {
2
+ new (...args: any[]): {
3
+ $: import("vue").ComponentInternalInstance;
4
+ $data: {};
5
+ $props: Partial<{
6
+ isMultiSelect: boolean;
7
+ }> & Omit<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
8
+ isMultiSelect?: boolean | undefined;
9
+ }>, {
10
+ isMultiSelect: boolean;
11
+ }>>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "isMultiSelect">;
12
+ $attrs: {
13
+ [x: string]: unknown;
14
+ };
15
+ $refs: {
16
+ [x: string]: unknown;
17
+ };
18
+ $slots: Readonly<{
19
+ [name: string]: import("vue").Slot | undefined;
20
+ }>;
21
+ $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
22
+ $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
23
+ $emit: (event: string, ...args: any[]) => void;
24
+ $el: any;
25
+ $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
26
+ isMultiSelect?: boolean | undefined;
27
+ }>, {
28
+ isMultiSelect: boolean;
29
+ }>>>, {
30
+ show: (e: MouseEvent) => Promise<void>;
31
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, {
32
+ isMultiSelect: boolean;
33
+ }> & {
34
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
35
+ created?: ((() => void) | (() => void)[]) | undefined;
36
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
37
+ mounted?: ((() => void) | (() => void)[]) | undefined;
38
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
39
+ updated?: ((() => void) | (() => void)[]) | undefined;
40
+ activated?: ((() => void) | (() => void)[]) | undefined;
41
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
42
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
43
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
44
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
45
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
46
+ renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
47
+ renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
48
+ errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
49
+ };
50
+ $forceUpdate: () => void;
51
+ $nextTick: typeof import("vue").nextTick;
52
+ $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
53
+ } & Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
54
+ isMultiSelect?: boolean | undefined;
55
+ }>, {
56
+ isMultiSelect: boolean;
57
+ }>>> & import("vue").ShallowUnwrapRef<{
58
+ show: (e: MouseEvent) => Promise<void>;
59
+ }> & {} & import("vue").ComponentCustomProperties;
60
+ __isFragment?: undefined;
61
+ __isTeleport?: undefined;
62
+ __isSuspense?: undefined;
63
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
64
+ isMultiSelect?: boolean | undefined;
65
+ }>, {
66
+ isMultiSelect: boolean;
67
+ }>>>, {
68
+ show: (e: MouseEvent) => Promise<void>;
69
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, {
70
+ isMultiSelect: boolean;
71
+ }> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
72
+ $slots: {};
73
+ });
74
+ export default _default;
75
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
76
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
77
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
78
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
79
+ } : {
80
+ type: import('vue').PropType<T[K]>;
81
+ required: true;
82
+ };
83
+ };
84
+ declare type __VLS_WithDefaults<P, D> = {
85
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
86
+ default: D[K];
87
+ } : P[K];
88
+ };
@@ -0,0 +1,6 @@
1
+ import type { MPage } from '@tmagic/schema';
2
+ declare const _default: import("vue").DefineComponent<{}, {
3
+ workspace: import("vue").Ref<HTMLDivElement | undefined>;
4
+ page: import("vue").ComputedRef<MPage | undefined>;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
6
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import type { ComponentGroup } from '../type';
2
+ import BaseService from './BaseService';
3
+ declare class ComponentList extends BaseService {
4
+ private state;
5
+ constructor();
6
+ /**
7
+ * @param componentGroupList 组件列表配置
8
+ */
9
+ setList(componentGroupList: ComponentGroup[]): void;
10
+ getList(): ComponentGroup[];
11
+ }
12
+ export declare type ComponentListService = ComponentList;
13
+ declare const _default: ComponentList;
14
+ export default _default;
@@ -1,22 +1,22 @@
1
1
  import type { Id, MContainer, MNode } from '@tmagic/schema';
2
2
  import { StepValue } from '../services/history';
3
- import type { AddMNode, EditorNodeInfo, StoreState } from '../type';
3
+ import type { AddMNode, EditorNodeInfo, PastePosition, StoreState } from '../type';
4
4
  import { LayerOffset, Layout } from '../type';
5
5
  import BaseService from './BaseService';
6
6
  declare class Editor extends BaseService {
7
+ state: StoreState;
7
8
  private isHistoryStateChange;
8
- private state;
9
9
  constructor();
10
10
  /**
11
11
  * 设置当前指点节点配置
12
- * @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode'
12
+ * @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes'
13
13
  * @param value MNode
14
14
  * @returns MNode
15
15
  */
16
16
  set<T = MNode>(name: keyof StoreState, value: T): void;
17
17
  /**
18
18
  * 获取当前指点节点配置
19
- * @param name 'root' | 'page' | 'parent' | 'node'
19
+ * @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes'
20
20
  * @returns MNode
21
21
  */
22
22
  get<T = MNode>(name: keyof StoreState): T;
@@ -59,25 +59,34 @@ declare class Editor extends BaseService {
59
59
  * @returns 当前高亮的节点配置
60
60
  */
61
61
  highlight(config: MNode | Id): void;
62
+ /**
63
+ * 多选
64
+ * @param ids 指定节点ID
65
+ * @returns 加入多选的节点配置
66
+ */
67
+ multiSelect(ids: Id[]): void;
68
+ doAdd(node: MNode, parent: MContainer): Promise<MNode>;
62
69
  /**
63
70
  * 向指点容器添加组件节点
64
71
  * @param addConfig 将要添加的组件节点配置
65
72
  * @param parent 要添加到的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
66
73
  * @returns 添加后的节点
67
74
  */
68
- add(addNode: AddMNode, parent?: MContainer | null): Promise<MNode>;
75
+ add(addNode: AddMNode | MNode[], parent?: MContainer | null): Promise<MNode | MNode[]>;
76
+ doRemove(node: MNode): Promise<void>;
69
77
  /**
70
78
  * 删除组件
71
79
  * @param {Object} node
72
80
  * @return {Object} 删除的组件配置
73
81
  */
74
- remove(node: MNode): Promise<MNode | void>;
82
+ remove(nodeOrNodeList: MNode | MNode[]): Promise<void>;
83
+ doUpdate(config: MNode): Promise<MNode>;
75
84
  /**
76
85
  * 更新节点
77
86
  * @param config 新的节点配置,配置中需要有id信息
78
87
  * @returns 更新后的节点配置
79
88
  */
80
- update(config: MNode): Promise<MNode>;
89
+ update(config: MNode | MNode[]): Promise<MNode | MNode[]>;
81
90
  /**
82
91
  * 将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
83
92
  * @param id1 组件ID
@@ -90,22 +99,21 @@ declare class Editor extends BaseService {
90
99
  * @param config 组件节点配置
91
100
  * @returns 组件节点配置
92
101
  */
93
- copy(config: MNode): Promise<void>;
102
+ copy(config: MNode | MNode[]): Promise<void>;
94
103
  /**
95
104
  * 从localStorage中获取节点,然后添加到当前容器中
96
- * @param position 如果设置,指定组件位置
105
+ * @param position 粘贴的坐标
97
106
  * @returns 添加后的组件节点配置
98
107
  */
99
- paste(position?: {
100
- left?: number;
101
- top?: number;
102
- }): Promise<MNode | void>;
108
+ paste(position?: PastePosition): Promise<MNode | MNode[] | void>;
109
+ doPaste(config: MNode[], position?: PastePosition): Promise<MNode[]>;
110
+ doAlignCenter(config: MNode): Promise<MNode>;
103
111
  /**
104
112
  * 将指点节点设置居中
105
113
  * @param config 组件节点配置
106
114
  * @returns 当前组件节点配置
107
115
  */
108
- alignCenter(config: MNode): Promise<MNode | void>;
116
+ alignCenter(config: MNode | MNode[]): Promise<MNode | MNode[]>;
109
117
  /**
110
118
  * 移动当前选中节点位置
111
119
  * @param offset 偏移量
File without changes
File without changes
@@ -0,0 +1,97 @@
1
+ import type { FormConfig } from '@tmagic/form';
2
+ import type { MNode } from '@tmagic/schema';
3
+ import BaseService from './BaseService';
4
+ declare class Props extends BaseService {
5
+ private state;
6
+ constructor();
7
+ setPropsConfigs(configs: Record<string, FormConfig>): void;
8
+ fillConfig(config: FormConfig): Promise<{
9
+ type: string;
10
+ items: ({
11
+ title: string;
12
+ labelWidth: string;
13
+ items: (import("@tmagic/form").ChildConfig & {
14
+ [key: string]: any;
15
+ })[];
16
+ } | {
17
+ title: string;
18
+ items: {
19
+ type: string;
20
+ name: string;
21
+ items: ({
22
+ name: string;
23
+ label: string;
24
+ type: string;
25
+ options: (mForm: import("@tmagic/form").FormState, { formValue }: any) => {
26
+ text: string;
27
+ value: string;
28
+ }[];
29
+ } | {
30
+ name: string;
31
+ label: string;
32
+ type: string;
33
+ options?: undefined;
34
+ })[];
35
+ }[];
36
+ labelWidth?: undefined;
37
+ })[];
38
+ }[]>;
39
+ /**
40
+ * 为指定类型组件设置组件属性表单配置
41
+ * @param type 组件类型
42
+ * @param config 组件属性表单配置
43
+ */
44
+ setPropsConfig(type: string, config: FormConfig): Promise<void>;
45
+ /**
46
+ * 获取指点类型的组件属性表单配置
47
+ * @param type 组件类型
48
+ * @returns 组件属性表单配置
49
+ */
50
+ getPropsConfig(type: string): Promise<FormConfig>;
51
+ setPropsValues(values: Record<string, MNode>): void;
52
+ /**
53
+ * 为指点类型组件设置组件初始值
54
+ * @param type 组件类型
55
+ * @param value 组件初始值
56
+ */
57
+ setPropsValue(type: string, value: MNode): void;
58
+ /**
59
+ * 获取指定类型的组件初始值
60
+ * @param type 组件类型
61
+ * @returns 组件初始值
62
+ */
63
+ getPropsValue(type: string, { inputEvent, ...defaultValue }?: Record<string, any>): Promise<any>;
64
+ createId(type: string | number): Promise<string>;
65
+ /**
66
+ * 将组件与组件的子元素配置中的id都设置成一个新的ID
67
+ * @param {Object} config 组件配置
68
+ */
69
+ setNewItemId(config: MNode): Promise<MNode>;
70
+ /**
71
+ * 获取默认属性配置
72
+ * @param type 组件类型
73
+ * @returns Object
74
+ */
75
+ getDefaultPropsValue(type: string): Promise<{
76
+ type: string;
77
+ layout: string;
78
+ style: {};
79
+ name: string;
80
+ items: never[];
81
+ } | {
82
+ type: string;
83
+ style: {};
84
+ name: string;
85
+ layout?: undefined;
86
+ items?: undefined;
87
+ }>;
88
+ /**
89
+ * 生成指定位数的GUID,无【-】格式
90
+ * @param digit 位数,默认值8
91
+ * @returns
92
+ */
93
+ private guid;
94
+ }
95
+ export declare type PropsService = Props;
96
+ declare const _default: Props;
97
+ export default _default;
@@ -0,0 +1,56 @@
1
+ import BaseService from './BaseService';
2
+ interface Options {
3
+ namespace?: string;
4
+ protocol?: Protocol;
5
+ }
6
+ export declare enum Protocol {
7
+ OBJECT = "object",
8
+ JSON = "json",
9
+ STRING = "string",
10
+ NUMBER = "number",
11
+ BOOLEAN = "boolean"
12
+ }
13
+ /**
14
+ * 数据存储服务
15
+ */
16
+ export declare class WebStorage extends BaseService {
17
+ private storage;
18
+ private namespace;
19
+ constructor();
20
+ /**
21
+ * 获取数据存储对象,可以通过
22
+ * const storageService = new StorageService();
23
+ * storageService.usePlugin({
24
+ * // 替换存储对象为 sessionStorage
25
+ * async afterGetStorage(): Promise<Storage> {
26
+ * return window.sessionStorage;
27
+ * },
28
+ * });
29
+ */
30
+ getStorage(): Promise<Storage>;
31
+ getNamespace(): Promise<string>;
32
+ /**
33
+ * 清理,支持storageService.usePlugin
34
+ */
35
+ clear(): Promise<void>;
36
+ /**
37
+ * 获取存储项,支持storageService.usePlugin
38
+ */
39
+ getItem(key: string, options?: Options): Promise<any>;
40
+ /**
41
+ * 获取指定索引位置的key
42
+ */
43
+ key(index: number): Promise<string | null>;
44
+ /**
45
+ * 移除存储项,支持storageService.usePlugin
46
+ */
47
+ removeItem(key: string, options?: Options): Promise<void>;
48
+ /**
49
+ * 设置存储项,支持storageService.usePlugin
50
+ */
51
+ setItem(key: string, value: any, options?: Options): Promise<void>;
52
+ private getValueAndProtocol;
53
+ }
54
+ export declare type StorageService = WebStorage;
55
+ declare const _default: WebStorage;
56
+ export default _default;
@@ -19,7 +19,7 @@ declare const state: {
19
19
  };
20
20
  showGuides: boolean;
21
21
  showRule: boolean;
22
- propsPanelSize: "small" | "default" | "large";
22
+ propsPanelSize: "small" | "large" | "default";
23
23
  };
24
24
  declare class Ui extends BaseService {
25
25
  constructor();
@@ -2,12 +2,13 @@ import type { Component } from 'vue';
2
2
  import type { FormConfig } from '@tmagic/form';
3
3
  import type { Id, MApp, MContainer, MNode, MPage } from '@tmagic/schema';
4
4
  import type StageCore from '@tmagic/stage';
5
- import type { MoveableOptions } from '@tmagic/stage';
5
+ import type { ContainerHighlightType, MoveableOptions } from '@tmagic/stage';
6
6
  import type { ComponentListService } from './services/componentList';
7
7
  import type { EditorService } from './services/editor';
8
8
  import type { EventsService } from './services/events';
9
9
  import type { HistoryService } from './services/history';
10
10
  import type { PropsService } from './services/props';
11
+ import type { StorageService } from './services/storage';
11
12
  import type { UiService } from './services/ui';
12
13
  export declare type BeforeAdd = (config: MNode, parent: MContainer) => Promise<MNode> | MNode;
13
14
  export declare type GetConfig = (config: FormConfig) => Promise<FormConfig> | FormConfig;
@@ -17,6 +18,7 @@ export interface InstallOptions {
17
18
  export interface Services {
18
19
  editorService: EditorService;
19
20
  historyService: HistoryService;
21
+ storageService: StorageService;
20
22
  eventsService: EventsService;
21
23
  propsService: PropsService;
22
24
  componentListService: ComponentListService;
@@ -27,6 +29,7 @@ export interface StageOptions {
27
29
  autoScrollIntoView: boolean;
28
30
  containerHighlightClassName: string;
29
31
  containerHighlightDuration: number;
32
+ containerHighlightType: ContainerHighlightType;
30
33
  render: () => HTMLDivElement;
31
34
  moveableOptions: MoveableOptions | ((core?: StageCore) => MoveableOptions);
32
35
  canSelect: (el: HTMLElement) => boolean | Promise<boolean>;
@@ -39,6 +42,7 @@ export interface StoreState {
39
42
  parent: MContainer | null;
40
43
  node: MNode | null;
41
44
  highlightNode: MNode | null;
45
+ nodes: MNode[];
42
46
  stage: StageCore | null;
43
47
  modifiedNodeIds: Map<Id, Id>;
44
48
  pageLength: number;
@@ -92,8 +96,21 @@ export interface EditorNodeInfo {
92
96
  export interface AddMNode {
93
97
  type: string;
94
98
  name?: string;
99
+ inputEvent?: DragEvent;
95
100
  [key: string]: any;
96
101
  }
102
+ export interface PastePosition {
103
+ left?: number;
104
+ top?: number;
105
+ /**
106
+ * 粘贴位置X方向偏移量
107
+ */
108
+ offsetX?: number;
109
+ /**
110
+ * 粘贴位置Y方向偏移量
111
+ */
112
+ offsetY?: number;
113
+ }
97
114
  /**
98
115
  * 菜单按钮
99
116
  */
@@ -2,4 +2,4 @@
2
2
  * @param {Array} middleware
3
3
  * @return {Function}
4
4
  */
5
- export declare const compose: (middleware: Function[]) => (args: any[], next?: Function | undefined) => Promise<void>;
5
+ export declare const compose: (middleware: Function[]) => (args: any[], next?: Function) => Promise<void>;
File without changes