@tmagic/editor 1.3.0-alpha.0 → 1.3.0-alpha.10
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/style.css +46 -9
- package/dist/tmagic-editor.js +1764 -871
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +1781 -882
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +19 -20
- package/src/Editor.vue +29 -3
- package/src/components/CodeDraftEditor.vue +5 -1
- package/src/components/ContentMenu.vue +30 -11
- package/src/components/FunctionEditor.vue +12 -5
- package/src/components/Icon.vue +5 -1
- package/src/components/Resizer.vue +45 -0
- package/src/components/ScrollBar.vue +5 -1
- package/src/components/ScrollViewer.vue +5 -1
- package/src/components/SearchInput.vue +4 -0
- package/src/components/{Layout.vue → SplitView.vue} +8 -4
- package/src/components/ToolButton.vue +5 -1
- package/src/editorProps.ts +5 -1
- package/src/fields/Code.vue +5 -1
- package/src/fields/CodeLink.vue +9 -3
- package/src/fields/CodeSelect.vue +8 -2
- package/src/fields/CodeSelectCol.vue +6 -2
- package/src/fields/DataSourceFields.vue +5 -1
- package/src/fields/DataSourceInput.vue +358 -0
- package/src/fields/DataSourceSelect.vue +75 -0
- package/src/fields/EventSelect.vue +9 -3
- package/src/fields/KeyValue.vue +4 -0
- package/src/fields/UISelect.vue +5 -1
- package/src/icons/AppManageIcon.vue +5 -1
- package/src/icons/CenterIcon.vue +13 -0
- package/src/icons/CodeIcon.vue +5 -1
- package/src/index.ts +13 -3
- package/src/initService.ts +73 -0
- package/src/layouts/AddPageBox.vue +5 -1
- package/src/layouts/CodeEditor.vue +34 -10
- package/src/layouts/Framework.vue +25 -25
- package/src/layouts/NavMenu.vue +5 -1
- package/src/layouts/PropsPanel.vue +14 -4
- package/src/layouts/sidebar/ComponentListPanel.vue +8 -5
- package/src/layouts/sidebar/LayerMenu.vue +13 -25
- package/src/layouts/sidebar/LayerNode.vue +40 -0
- package/src/layouts/sidebar/LayerPanel.vue +70 -27
- package/src/layouts/sidebar/Sidebar.vue +11 -7
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +8 -4
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +5 -1
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +4 -0
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +22 -2
- package/src/layouts/workspace/Breadcrumb.vue +5 -1
- package/src/layouts/workspace/PageBar.vue +5 -1
- package/src/layouts/workspace/PageBarScrollContainer.vue +5 -1
- package/src/layouts/workspace/Stage.vue +29 -7
- package/src/layouts/workspace/ViewerMenu.vue +15 -36
- package/src/layouts/workspace/Workspace.vue +9 -134
- package/src/services/codeBlock.ts +3 -2
- package/src/services/dep.ts +4 -0
- package/src/services/keybinding.ts +185 -0
- package/src/services/storage.ts +3 -2
- package/src/theme/content-menu.scss +1 -1
- package/src/theme/data-source-input.scss +18 -0
- package/src/theme/framework.scss +0 -3
- package/src/theme/layer-panel.scss +6 -0
- package/src/theme/layout.scss +4 -0
- package/src/theme/resizer.scss +25 -10
- package/src/theme/stage.scss +4 -0
- package/src/theme/theme.scss +1 -0
- package/src/type.ts +59 -1
- package/src/utils/config.ts +1 -1
- package/src/utils/content-menu.ts +92 -0
- package/src/utils/dep.ts +7 -1
- package/src/utils/keybinding-config.ts +120 -0
- package/src/utils/props.ts +34 -0
- package/types/Editor.vue.d.ts +7 -1
- package/types/components/CodeDraftEditor.vue.d.ts +6 -3
- package/types/components/ContentMenu.vue.d.ts +10 -5
- package/types/components/FunctionEditor.vue.d.ts +74 -51
- package/types/components/Icon.vue.d.ts +2 -2
- package/types/{layouts → components}/Resizer.vue.d.ts +2 -2
- package/types/components/ScrollBar.vue.d.ts +1 -1
- package/types/components/ScrollViewer.vue.d.ts +8 -5
- package/types/components/SearchInput.vue.d.ts +1 -1
- package/types/components/{Layout.vue.d.ts → SplitView.vue.d.ts} +9 -6
- package/types/components/ToolButton.vue.d.ts +8 -5
- package/types/editorProps.d.ts +4 -1
- package/types/fields/Code.vue.d.ts +1 -1
- package/types/fields/CodeLink.vue.d.ts +9 -9
- package/types/fields/CodeSelect.vue.d.ts +10 -7
- package/types/fields/CodeSelectCol.vue.d.ts +8 -5
- package/types/fields/DataSourceFields.vue.d.ts +8 -5
- package/types/fields/DataSourceInput.vue.d.ts +54 -0
- package/types/fields/DataSourceSelect.vue.d.ts +56 -0
- package/types/fields/EventSelect.vue.d.ts +3 -3
- package/types/fields/KeyValue.vue.d.ts +8 -5
- package/types/fields/UISelect.vue.d.ts +1 -1
- package/types/icons/AppManageIcon.vue.d.ts +1 -1
- package/types/icons/CenterIcon.vue.d.ts +2 -0
- package/types/icons/CodeIcon.vue.d.ts +1 -1
- package/types/index.d.ts +7 -2
- package/types/initService.d.ts +1 -1
- package/types/layouts/AddPageBox.vue.d.ts +1 -1
- package/types/layouts/CodeEditor.vue.d.ts +16 -10
- package/types/layouts/Framework.vue.d.ts +11 -32
- package/types/layouts/NavMenu.vue.d.ts +7 -4
- package/types/layouts/PropsPanel.vue.d.ts +276 -4
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +4 -4
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
- package/types/layouts/sidebar/LayerNode.vue.d.ts +16 -0
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +5 -5
- package/types/layouts/sidebar/Sidebar.vue.d.ts +18 -15
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +4 -4
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +7 -7
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +3 -3
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
- package/types/layouts/workspace/PageBar.vue.d.ts +5 -5
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +2 -2
- package/types/layouts/workspace/Stage.vue.d.ts +2 -2
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +7 -4
- package/types/layouts/workspace/Workspace.vue.d.ts +9 -9
- package/types/services/keybinding.d.ts +20 -0
- package/types/type.d.ts +56 -1
- package/types/utils/config.d.ts +1 -1
- package/types/utils/content-menu.d.ts +7 -0
- package/types/utils/keybinding-config.d.ts +3 -0
- package/src/layouts/Resizer.vue +0 -32
package/types/type.d.ts
CHANGED
|
@@ -5,11 +5,12 @@ import type StageCore from '@tmagic/stage';
|
|
|
5
5
|
import type { ContainerHighlightType, CustomizeMoveableOptionsCallbackConfig, MoveableOptions, UpdateDragEl } from '@tmagic/stage';
|
|
6
6
|
import type { CodeBlockService } from './services/codeBlock';
|
|
7
7
|
import type { ComponentListService } from './services/componentList';
|
|
8
|
-
import { DataSourceService } from './services/dataSource';
|
|
8
|
+
import type { DataSourceService } from './services/dataSource';
|
|
9
9
|
import type { DepService } from './services/dep';
|
|
10
10
|
import type { EditorService } from './services/editor';
|
|
11
11
|
import type { EventsService } from './services/events';
|
|
12
12
|
import type { HistoryService } from './services/history';
|
|
13
|
+
import type { KeybindingService } from './services/keybinding';
|
|
13
14
|
import type { PropsService } from './services/props';
|
|
14
15
|
import type { StorageService } from './services/storage';
|
|
15
16
|
import type { UiService } from './services/ui';
|
|
@@ -17,6 +18,7 @@ import type { UndoRedo } from './utils/undo-redo';
|
|
|
17
18
|
export type BeforeAdd = (config: MNode, parent: MContainer) => Promise<MNode> | MNode;
|
|
18
19
|
export type GetConfig = (config: FormConfig) => Promise<FormConfig> | FormConfig;
|
|
19
20
|
export interface InstallOptions {
|
|
21
|
+
parseDSL: (dsl: string) => MApp;
|
|
20
22
|
[key: string]: any;
|
|
21
23
|
}
|
|
22
24
|
export interface Services {
|
|
@@ -30,6 +32,7 @@ export interface Services {
|
|
|
30
32
|
codeBlockService: CodeBlockService;
|
|
31
33
|
depService: DepService;
|
|
32
34
|
dataSourceService: DataSourceService;
|
|
35
|
+
keybindingService: KeybindingService;
|
|
33
36
|
}
|
|
34
37
|
export interface StageOptions {
|
|
35
38
|
runtimeUrl: string;
|
|
@@ -344,3 +347,55 @@ export interface EventSelectConfig {
|
|
|
344
347
|
/** 联动代码配置 */
|
|
345
348
|
codeActionConfig?: FormItem;
|
|
346
349
|
}
|
|
350
|
+
export declare enum KeyBindingCommand {
|
|
351
|
+
/** 复制 */
|
|
352
|
+
COPY_NODE = "tmagic-system-copy-node",
|
|
353
|
+
/** 粘贴 */
|
|
354
|
+
PASTE_NODE = "tmagic-system-paste-node",
|
|
355
|
+
/** 删除 */
|
|
356
|
+
DELETE_NODE = "tmagic-system-delete-node",
|
|
357
|
+
/** 剪切 */
|
|
358
|
+
CUT_NODE = "tmagic-system-cut-node",
|
|
359
|
+
/** 撤销 */
|
|
360
|
+
UNDO = "tmagic-system-undo",
|
|
361
|
+
/** 重做 */
|
|
362
|
+
REDO = "tmagic-system-redo",
|
|
363
|
+
/** 放大 */
|
|
364
|
+
ZOOM_IN = "tmagic-system-zoom-in",
|
|
365
|
+
/** 缩小 */
|
|
366
|
+
ZOOM_OUT = "tmagic-system-zoom-out",
|
|
367
|
+
/** 缩放到实际大小 */
|
|
368
|
+
ZOOM_RESET = "tmagic-system-zoom-reset",
|
|
369
|
+
/** 缩放以适应 */
|
|
370
|
+
ZOOM_FIT = "tmagic-system-zoom-fit",
|
|
371
|
+
/** 向上移动1px */
|
|
372
|
+
MOVE_UP_1 = "tmagic-system-move-up-1",
|
|
373
|
+
/** 向下移动1px */
|
|
374
|
+
MOVE_DOWN_1 = "tmagic-system-move-down-1",
|
|
375
|
+
/** 向左移动1px */
|
|
376
|
+
MOVE_LEFT_1 = "tmagic-system-move-left-1",
|
|
377
|
+
/** 向右移动1px */
|
|
378
|
+
MOVE_RIGHT_1 = "tmagic-system-move-right-1",
|
|
379
|
+
/** 向上移动10px */
|
|
380
|
+
MOVE_UP_10 = "tmagic-system-move-up-10",
|
|
381
|
+
/** 向下移动10px */
|
|
382
|
+
MOVE_DOWN_10 = "tmagic-system-move-down-10",
|
|
383
|
+
/** 向左移动10px */
|
|
384
|
+
MOVE_LEFT_10 = "tmagic-system-move-left-10",
|
|
385
|
+
/** 向右移动10px */
|
|
386
|
+
MOVE_RIGHT_10 = "tmagic-system-move-right-10",
|
|
387
|
+
/** 切换组件 */
|
|
388
|
+
SWITCH_NODE = "tmagic-system-switch-node"
|
|
389
|
+
}
|
|
390
|
+
export interface KeyBindingItem {
|
|
391
|
+
command: KeyBindingCommand | string;
|
|
392
|
+
keybinding?: string | string[];
|
|
393
|
+
when: [string, 'keyup' | 'keydown'][];
|
|
394
|
+
}
|
|
395
|
+
export interface KeyBindingCacheItem {
|
|
396
|
+
type: string;
|
|
397
|
+
command: KeyBindingCommand | string;
|
|
398
|
+
keybinding?: string | string[];
|
|
399
|
+
eventType: 'keyup' | 'keydown';
|
|
400
|
+
binded: boolean;
|
|
401
|
+
}
|
package/types/utils/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { InstallOptions } from '../type';
|
|
2
2
|
declare const setConfig: (option: InstallOptions) => void;
|
|
3
|
-
declare const getConfig: (key:
|
|
3
|
+
declare const getConfig: <K extends keyof InstallOptions>(key: K) => InstallOptions[K];
|
|
4
4
|
export { getConfig, setConfig };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import ContentMenu from '../components/ContentMenu.vue';
|
|
3
|
+
import type { MenuButton, Services } from '../type';
|
|
4
|
+
export declare const useDeleteMenu: () => MenuButton;
|
|
5
|
+
export declare const useCopyMenu: () => MenuButton;
|
|
6
|
+
export declare const usePasteMenu: (menu?: Ref<InstanceType<typeof ContentMenu> | undefined>) => MenuButton;
|
|
7
|
+
export declare const useMoveToMenu: (services?: Services) => MenuButton;
|
package/src/layouts/Resizer.vue
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span ref="target" class="m-editor-resizer">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</span>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script lang="ts" setup name="MEditorResizer">
|
|
8
|
-
import { onMounted, onUnmounted, ref } from 'vue';
|
|
9
|
-
import Gesto from 'gesto';
|
|
10
|
-
|
|
11
|
-
const emit = defineEmits(['change']);
|
|
12
|
-
|
|
13
|
-
const target = ref<HTMLSpanElement>();
|
|
14
|
-
|
|
15
|
-
let getso: Gesto;
|
|
16
|
-
|
|
17
|
-
onMounted(() => {
|
|
18
|
-
if (!target.value) return;
|
|
19
|
-
getso = new Gesto(target.value, {
|
|
20
|
-
container: window,
|
|
21
|
-
pinchOutside: true,
|
|
22
|
-
}).on('drag', (e) => {
|
|
23
|
-
if (!target.value) return;
|
|
24
|
-
|
|
25
|
-
emit('change', e.deltaX);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
onUnmounted(() => {
|
|
30
|
-
getso?.unset();
|
|
31
|
-
});
|
|
32
|
-
</script>
|