@tmagic/editor 1.1.0-beta.5 → 1.1.0-beta.8

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 (103) hide show
  1. package/dist/style.css +4 -0
  2. package/dist/{tmagic-editor.es.js → tmagic-editor.mjs} +1417 -1228
  3. package/dist/tmagic-editor.mjs.map +1 -0
  4. package/dist/tmagic-editor.umd.js +1433 -1242
  5. package/dist/tmagic-editor.umd.js.map +1 -1
  6. package/package.json +21 -19
  7. package/src/Editor.vue +14 -12
  8. package/src/components/ContentMenu.vue +87 -99
  9. package/src/components/Icon.vue +1 -1
  10. package/src/components/ScrollViewer.vue +1 -1
  11. package/src/components/ToolButton.vue +150 -167
  12. package/src/fields/UISelect.vue +49 -70
  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 +2 -2
  20. package/src/layouts/sidebar/LayerMenu.vue +2 -2
  21. package/src/layouts/sidebar/LayerPanel.vue +3 -3
  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 +195 -222
  27. package/src/layouts/workspace/ViewerMenu.vue +140 -147
  28. package/src/layouts/workspace/Workspace.vue +11 -11
  29. package/src/services/BaseService.ts +1 -1
  30. package/src/services/componentList.ts +3 -3
  31. package/src/services/editor.ts +137 -139
  32. package/src/services/events.ts +1 -1
  33. package/src/services/history.ts +1 -1
  34. package/src/services/props.ts +18 -5
  35. package/src/services/storage.ts +133 -0
  36. package/src/services/ui.ts +2 -2
  37. package/src/theme/component-list-panel.scss +5 -0
  38. package/src/type.ts +22 -6
  39. package/src/utils/config.ts +1 -1
  40. package/src/utils/editor.ts +18 -11
  41. package/src/utils/operator.ts +163 -0
  42. package/src/utils/props.ts +2 -2
  43. package/src/utils/scroll-viewer.ts +1 -1
  44. package/tsconfig.build.json +13 -0
  45. package/{dist/types/src → types}/Editor.vue.d.ts +7 -8
  46. package/types/components/ContentMenu.vue.d.ts +116 -0
  47. package/types/components/Icon.vue.d.ts +13 -0
  48. package/types/components/ScrollViewer.vue.d.ts +22 -0
  49. package/types/components/ToolButton.vue.d.ts +109 -0
  50. package/types/fields/Code.vue.d.ts +23 -0
  51. package/{dist/types/src → types}/fields/CodeLink.vue.d.ts +4 -6
  52. package/types/fields/UISelect.vue.d.ts +83 -0
  53. package/{dist/types/src → types}/index.d.ts +4 -1
  54. package/types/layouts/AddPageBox.vue.d.ts +4 -0
  55. package/{dist/types/src → types}/layouts/CodeEditor.vue.d.ts +11 -13
  56. package/types/layouts/Framework.vue.d.ts +22 -0
  57. package/types/layouts/NavMenu.vue.d.ts +25 -0
  58. package/types/layouts/PropsPanel.vue.d.ts +245 -0
  59. package/types/layouts/Resizer.vue.d.ts +12 -0
  60. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +14 -0
  61. package/types/layouts/sidebar/LayerMenu.vue.d.ts +100 -0
  62. package/types/layouts/sidebar/LayerPanel.vue.d.ts +1099 -0
  63. package/{dist/types/src → types}/layouts/sidebar/Sidebar.vue.d.ts +3 -5
  64. package/types/layouts/sidebar/TabPane.vue.d.ts +14 -0
  65. package/types/layouts/workspace/PageBar.vue.d.ts +54 -0
  66. package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +48 -0
  67. package/types/layouts/workspace/Stage.vue.d.ts +46 -0
  68. package/types/layouts/workspace/ViewerMenu.vue.d.ts +88 -0
  69. package/types/layouts/workspace/Workspace.vue.d.ts +6 -0
  70. package/{dist/types/src → types}/services/BaseService.d.ts +0 -0
  71. package/types/services/componentList.d.ts +14 -0
  72. package/{dist/types/src → types}/services/editor.d.ts +22 -12
  73. package/{dist/types/src → types}/services/events.d.ts +0 -0
  74. package/{dist/types/src → types}/services/history.d.ts +0 -0
  75. package/{dist/types/src → types}/services/props.d.ts +6 -0
  76. package/types/services/storage.d.ts +56 -0
  77. package/{dist/types/src → types}/services/ui.d.ts +1 -1
  78. package/{dist/types/src → types}/type.d.ts +15 -0
  79. package/{dist/types/src → types}/utils/compose.d.ts +1 -1
  80. package/{dist/types/src → types}/utils/config.d.ts +0 -0
  81. package/{dist/types/src → types}/utils/editor.d.ts +6 -3
  82. package/{dist/types/src → types}/utils/index.d.ts +0 -0
  83. package/{dist/types/src → types}/utils/logger.d.ts +0 -0
  84. package/types/utils/operator.d.ts +27 -0
  85. package/{dist/types/src → types}/utils/polyfills.d.ts +0 -0
  86. package/{dist/types/src → types}/utils/props.d.ts +2 -2
  87. package/{dist/types/src → types}/utils/scroll-viewer.d.ts +0 -0
  88. package/{dist/types/src → types}/utils/undo-redo.d.ts +0 -0
  89. package/dist/tmagic-editor.es.js.map +0 -1
  90. package/dist/types/src/components/Icon.vue.d.ts +0 -14
  91. package/dist/types/src/components/ScrollViewer.vue.d.ts +0 -24
  92. package/dist/types/src/fields/Code.vue.d.ts +0 -25
  93. package/dist/types/src/layouts/AddPageBox.vue.d.ts +0 -5
  94. package/dist/types/src/layouts/Framework.vue.d.ts +0 -24
  95. package/dist/types/src/layouts/NavMenu.vue.d.ts +0 -27
  96. package/dist/types/src/layouts/PropsPanel.vue.d.ts +0 -13
  97. package/dist/types/src/layouts/Resizer.vue.d.ts +0 -14
  98. package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +0 -16
  99. package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +0 -16
  100. package/dist/types/src/layouts/workspace/Workspace.vue.d.ts +0 -8
  101. package/dist/types/src/shims-vue.d.ts +0 -6
  102. package/dist/types/src/vite-env.d.ts +0 -1
  103. 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,19 +59,32 @@ 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[]>;
69
76
  /**
70
77
  * 删除组件
71
78
  * @param {Object} node
72
79
  * @return {Object} 删除的组件配置
73
80
  */
74
- remove(node: MNode): Promise<MNode | void>;
81
+ remove(nodeOrNodeList: MNode | MNode[]): Promise<MNode | MNode[]>;
82
+ /**
83
+ * 批量删除
84
+ * @param nodes 批量删除的节点
85
+ * @returns 批量删除的节点
86
+ */
87
+ multiRemove(nodes: MNode[]): Promise<MNode[]>;
75
88
  /**
76
89
  * 更新节点
77
90
  * @param config 新的节点配置,配置中需要有id信息
@@ -90,16 +103,13 @@ declare class Editor extends BaseService {
90
103
  * @param config 组件节点配置
91
104
  * @returns 组件节点配置
92
105
  */
93
- copy(config: MNode): Promise<void>;
106
+ copy(config: MNode | MNode[]): Promise<void>;
94
107
  /**
95
108
  * 从localStorage中获取节点,然后添加到当前容器中
96
- * @param position 如果设置,指定组件位置
109
+ * @param position 粘贴的坐标
97
110
  * @returns 添加后的组件节点配置
98
111
  */
99
- paste(position?: {
100
- left?: number;
101
- top?: number;
102
- }): Promise<MNode | void>;
112
+ paste(position?: PastePosition): Promise<MNode | MNode[] | void>;
103
113
  /**
104
114
  * 将指点节点设置居中
105
115
  * @param config 组件节点配置
File without changes
File without changes
@@ -30,6 +30,12 @@ declare class Props extends BaseService {
30
30
  * @returns 组件初始值
31
31
  */
32
32
  getPropsValue(type: string, { inputEvent, ...defaultValue }?: Record<string, any>): Promise<any>;
33
+ /**
34
+ * 生成指定位数的GUID,无【-】格式
35
+ * @param digit 位数,默认值8
36
+ * @returns
37
+ */
38
+ guid(digit?: number): string;
33
39
  createId(type: string | number): Promise<string>;
34
40
  /**
35
41
  * 将组件与组件的子元素配置中的id都设置成一个新的ID
@@ -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();
@@ -8,6 +8,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;
@@ -39,6 +41,7 @@ export interface StoreState {
39
41
  parent: MContainer | null;
40
42
  node: MNode | null;
41
43
  highlightNode: MNode | null;
44
+ nodes: MNode[];
42
45
  stage: StageCore | null;
43
46
  modifiedNodeIds: Map<Id, Id>;
44
47
  pageLength: number;
@@ -95,6 +98,18 @@ export interface AddMNode {
95
98
  inputEvent?: DragEvent;
96
99
  [key: string]: any;
97
100
  }
101
+ export interface PastePosition {
102
+ left?: number;
103
+ top?: number;
104
+ /**
105
+ * 粘贴位置X方向偏移量
106
+ */
107
+ offsetX?: number;
108
+ /**
109
+ * 粘贴位置Y方向偏移量
110
+ */
111
+ offsetY?: number;
112
+ }
98
113
  /**
99
114
  * 菜单按钮
100
115
  */
@@ -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
@@ -33,12 +33,15 @@ export declare const generatePageNameByApp: (app: MApp) => string;
33
33
  export declare const isFixed: (node: MNode) => boolean;
34
34
  export declare const getNodeIndex: (node: MNode, parent: MContainer | MApp) => number;
35
35
  export declare const getRelativeStyle: (style?: Record<string, any>) => Record<string, any>;
36
- export declare const getInitPositionStyle: (style: Record<string, any> | undefined, layout: Layout, parentNode: MNode, stage: StageCore) => Record<string, any>;
36
+ export declare const getInitPositionStyle: (style: Record<string, any> | undefined, layout: Layout) => Record<string, any>;
37
37
  export declare const setLayout: (node: MNode, layout: Layout) => MNode;
38
38
  export declare const change2Fixed: (node: MNode, root: MApp) => {
39
39
  left: number;
40
40
  top: number;
41
41
  };
42
- export declare const Fixed2Other: (node: MNode, root: MApp, getLayout: (parent: MNode, node?: MNode | undefined) => Promise<Layout>) => Promise<Record<string, any>>;
42
+ export declare const Fixed2Other: (node: MNode, root: MApp, getLayout: (parent: MNode, node?: MNode) => Promise<Layout>) => Promise<Record<string, any>>;
43
43
  export declare const getGuideLineFromCache: (key: string) => number[];
44
- export declare const fixNodeLeft: (config: MNode, parent: MContainer, doc?: Document | undefined) => any;
44
+ export declare const fixNodeLeft: (config: MNode, parent: MContainer, doc?: Document) => any;
45
+ export declare const fixNodePosition: (config: MNode, parent: MContainer, stage: StageCore | null) => {
46
+ [key: string]: any;
47
+ } | undefined;
File without changes
File without changes
@@ -0,0 +1,27 @@
1
+ import { Id, MContainer, MNode } from '@tmagic/schema';
2
+ import { AddMNode, PastePosition } from '../type';
3
+ /**
4
+ * 粘贴前置操作:返回分配了新id以及校准了坐标的配置
5
+ * @param position 粘贴的坐标
6
+ * @param config 待粘贴的元素配置(复制时保存的那份配置)
7
+ * @returns
8
+ */
9
+ export declare const beforePaste: (position: PastePosition, config: MNode[]) => Promise<MNode[]>;
10
+ /**
11
+ * 将元素粘贴到容器内时,将相对于画布坐标转换为相对于容器的坐标
12
+ * @param position PastePosition 粘贴时相对于画布的坐标
13
+ * @param id 元素id
14
+ * @returns PastePosition 转换后的坐标
15
+ */
16
+ export declare const getPositionInContainer: (position: PastePosition | undefined, id: Id) => {
17
+ left: number;
18
+ top: number;
19
+ };
20
+ /**
21
+ * 删除前置操作:实现了在编辑器中删除元素节点,并返回父级元素信息以供stage更新
22
+ * @param node 待删除的节点
23
+ * @returns 父级元素,root根元素
24
+ */
25
+ export declare const beforeRemove: (node: MNode) => Promise<MContainer | void>;
26
+ export declare const getAddParent: (addNode: AddMNode | MNode[]) => MContainer | undefined;
27
+ export declare const getDefaultConfig: (addNode: AddMNode, parentNode: MContainer) => Promise<any>;
File without changes
@@ -1,4 +1,4 @@
1
- import type { ChildConfig, FormConfig, FormState } from '@tmagic/form';
1
+ import { FormConfig, FormState } from '@tmagic/form';
2
2
  /**
3
3
  * 统一为组件属性表单加上事件、高级、样式配置
4
4
  * @param config 组件属性配置
@@ -9,7 +9,7 @@ export declare const fillConfig: (config?: FormConfig) => {
9
9
  items: ({
10
10
  title: string;
11
11
  labelWidth: string;
12
- items: (ChildConfig & {
12
+ items: (import("@tmagic/form").ChildConfig & {
13
13
  [key: string]: any;
14
14
  })[];
15
15
  } | {
File without changes