@tmagic/editor 1.3.6 → 1.3.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.
- package/LICENSE +5432 -0
- package/dist/style.css +34 -11
- package/dist/tmagic-editor.js +1360 -957
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +1382 -977
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +17 -17
- package/src/Editor.vue +15 -7
- package/src/components/CodeBlockEditor.vue +2 -2
- package/src/components/ContentMenu.vue +5 -5
- package/src/components/ScrollBar.vue +2 -2
- package/src/components/ScrollViewer.vue +2 -2
- package/src/components/SplitView.vue +2 -2
- package/src/components/Tree.vue +1 -1
- package/src/components/TreeNode.vue +3 -3
- package/src/editorProps.ts +14 -4
- package/src/fields/PageFragmentSelect.vue +63 -0
- package/src/hooks/use-getso.ts +2 -2
- package/src/hooks/use-stage.ts +18 -1
- package/src/index.ts +3 -0
- package/src/initService.ts +15 -5
- package/src/layouts/AddPageBox.vue +16 -4
- package/src/layouts/CodeEditor.vue +2 -2
- package/src/layouts/Framework.vue +19 -3
- package/src/layouts/PropsPanel.vue +9 -7
- package/src/layouts/page-bar/AddButton.vue +48 -0
- package/src/layouts/page-bar/PageBar.vue +158 -0
- package/src/layouts/{workspace → page-bar}/PageBarScrollContainer.vue +61 -35
- package/src/layouts/page-bar/SwitchTypeButton.vue +45 -0
- package/src/layouts/sidebar/Sidebar.vue +2 -0
- package/src/layouts/sidebar/layer/LayerMenu.vue +39 -27
- package/src/layouts/sidebar/layer/LayerPanel.vue +7 -1
- package/src/layouts/sidebar/layer/use-click.ts +5 -3
- package/src/layouts/sidebar/layer/use-keybinding.ts +8 -8
- package/src/layouts/sidebar/layer/use-node-status.ts +3 -3
- package/src/layouts/workspace/Workspace.vue +6 -7
- package/src/layouts/workspace/viewer/NodeListMenu.vue +2 -2
- package/src/layouts/workspace/viewer/Stage.vue +12 -5
- package/src/layouts/workspace/viewer/ViewerMenu.vue +93 -80
- package/src/services/dataSource.ts +17 -0
- package/src/services/dep.ts +4 -0
- package/src/services/editor.ts +66 -35
- package/src/services/history.ts +6 -2
- package/src/services/keybinding.ts +48 -13
- package/src/theme/code-block.scss +0 -16
- package/src/theme/page-bar.scss +18 -1
- package/src/theme/page-fragment-select.scss +14 -0
- package/src/theme/theme.scss +1 -0
- package/src/theme/tree.scss +6 -0
- package/src/type.ts +23 -7
- package/src/utils/content-menu.ts +2 -2
- package/src/utils/editor.ts +22 -15
- package/src/utils/operator.ts +4 -4
- package/types/components/ToolButton.vue.d.ts +2 -2
- package/types/editorProps.d.ts +11 -2
- package/types/fields/PageFragmentSelect.vue.d.ts +31 -0
- package/types/index.d.ts +1 -0
- package/types/layouts/AddPageBox.vue.d.ts +14 -1
- package/types/layouts/Framework.vue.d.ts +14 -1
- package/types/layouts/PropsPanel.vue.d.ts +19 -10
- package/types/layouts/page-bar/AddButton.vue.d.ts +16 -0
- package/types/layouts/page-bar/PageBar.vue.d.ts +28 -0
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +24 -0
- package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +20 -0
- package/types/layouts/sidebar/Sidebar.vue.d.ts +2 -0
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +22 -3
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +2 -0
- package/types/layouts/sidebar/layer/use-click.d.ts +25 -3
- package/types/layouts/sidebar/layer/use-keybinding.d.ts +1 -1
- package/types/layouts/workspace/Workspace.vue.d.ts +2 -0
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +2 -0
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +8 -0
- package/types/services/dataSource.d.ts +2 -0
- package/types/services/dep.d.ts +1 -0
- package/types/services/editor.d.ts +3 -2
- package/types/services/history.d.ts +3 -2
- package/types/services/keybinding.d.ts +21 -1
- package/types/type.d.ts +26 -12
- package/types/utils/editor.d.ts +9 -7
- package/src/layouts/workspace/PageBar.vue +0 -87
- package/types/layouts/workspace/PageBar.vue.d.ts +0 -15
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +0 -9
package/types/utils/editor.d.ts
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import type { Id, MApp, MContainer, MNode, MPage } from '@tmagic/schema';
|
|
1
|
+
import type { Id, MApp, MContainer, MNode, MPage, MPageFragment } from '@tmagic/schema';
|
|
2
|
+
import { NodeType } from '@tmagic/schema';
|
|
2
3
|
import type StageCore from '@tmagic/stage';
|
|
3
4
|
import { Layout } from '../type';
|
|
4
5
|
export declare const COPY_STORAGE_KEY = "$MagicEditorCopyData";
|
|
5
6
|
/**
|
|
6
7
|
* 获取所有页面配置
|
|
7
|
-
* @param
|
|
8
|
+
* @param root DSL跟节点
|
|
8
9
|
* @returns 所有页面配置
|
|
9
10
|
*/
|
|
10
|
-
export declare const getPageList: (
|
|
11
|
+
export declare const getPageList: (root?: MApp | null) => MPage[];
|
|
12
|
+
export declare const getPageFragmentList: (root?: MApp | null) => MPageFragment[];
|
|
11
13
|
/**
|
|
12
14
|
* 获取所有页面名称
|
|
13
15
|
* @param pages 所有页面配置
|
|
14
16
|
* @returns 所有页面名称
|
|
15
17
|
*/
|
|
16
|
-
export declare const getPageNameList: (pages: MPage[]) => string[];
|
|
18
|
+
export declare const getPageNameList: (pages: (MPage | MPageFragment)[]) => string[];
|
|
17
19
|
/**
|
|
18
20
|
* 新增页面时,生成页面名称
|
|
19
21
|
* @param {Object} pageNameList 所有页面名称
|
|
20
22
|
* @returns {string}
|
|
21
23
|
*/
|
|
22
|
-
export declare const generatePageName: (pageNameList: string[]) => string;
|
|
24
|
+
export declare const generatePageName: (pageNameList: string[], type: NodeType.PAGE | NodeType.PAGE_FRAGMENT) => string;
|
|
23
25
|
/**
|
|
24
26
|
* 新增页面时,生成页面名称
|
|
25
27
|
* @param {Object} app 所有页面配置
|
|
26
28
|
* @returns {string}
|
|
27
29
|
*/
|
|
28
|
-
export declare const generatePageNameByApp: (app: MApp) => string;
|
|
30
|
+
export declare const generatePageNameByApp: (app: MApp, type: NodeType.PAGE | NodeType.PAGE_FRAGMENT) => string;
|
|
29
31
|
/**
|
|
30
32
|
* @param {Object} node
|
|
31
33
|
* @returns {boolean}
|
|
@@ -34,7 +36,7 @@ export declare const isFixed: (node: MNode) => boolean;
|
|
|
34
36
|
export declare const getNodeIndex: (id: Id, parent: MContainer | MApp) => number;
|
|
35
37
|
export declare const getRelativeStyle: (style?: Record<string, any>) => Record<string, any>;
|
|
36
38
|
export declare const getInitPositionStyle: (style: Record<string, any> | undefined, layout: Layout) => Record<string, any>;
|
|
37
|
-
export declare const
|
|
39
|
+
export declare const setChildrenLayout: (node: MContainer, layout: Layout) => MContainer;
|
|
38
40
|
export declare const setLayout: (node: MNode, layout: Layout) => import("@tmagic/schema").MComponent | undefined;
|
|
39
41
|
export declare const change2Fixed: (node: MNode, root: MApp) => {
|
|
40
42
|
left: number;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<PageBarScrollContainer>
|
|
3
|
-
<div
|
|
4
|
-
v-for="item in (root && root.items) || []"
|
|
5
|
-
class="m-editor-page-bar-item"
|
|
6
|
-
:key="item.key"
|
|
7
|
-
:class="{ active: page?.id === item.id }"
|
|
8
|
-
@click="switchPage(item)"
|
|
9
|
-
>
|
|
10
|
-
<div class="m-editor-page-bar-title">
|
|
11
|
-
<slot name="page-bar-title" :page="item">
|
|
12
|
-
<TMagicTooltip effect="dark" placement="top-start" :content="item.name">
|
|
13
|
-
<span>{{ item.name || item.id }}</span>
|
|
14
|
-
</TMagicTooltip>
|
|
15
|
-
</slot>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<TMagicPopover popper-class="page-bar-popover" placement="top" :width="160" trigger="hover">
|
|
19
|
-
<div>
|
|
20
|
-
<slot name="page-bar-popover" :page="item">
|
|
21
|
-
<ToolButton
|
|
22
|
-
:data="{
|
|
23
|
-
type: 'button',
|
|
24
|
-
text: '复制',
|
|
25
|
-
icon: DocumentCopy,
|
|
26
|
-
handler: () => copy(item),
|
|
27
|
-
}"
|
|
28
|
-
></ToolButton>
|
|
29
|
-
<ToolButton
|
|
30
|
-
:data="{
|
|
31
|
-
type: 'button',
|
|
32
|
-
text: '删除',
|
|
33
|
-
icon: Delete,
|
|
34
|
-
handler: () => remove(item),
|
|
35
|
-
}"
|
|
36
|
-
></ToolButton>
|
|
37
|
-
</slot>
|
|
38
|
-
</div>
|
|
39
|
-
<template #reference>
|
|
40
|
-
<TMagicIcon class="m-editor-page-bar-menu-icon">
|
|
41
|
-
<CaretBottom></CaretBottom>
|
|
42
|
-
</TMagicIcon>
|
|
43
|
-
</template>
|
|
44
|
-
</TMagicPopover>
|
|
45
|
-
</div>
|
|
46
|
-
</PageBarScrollContainer>
|
|
47
|
-
</template>
|
|
48
|
-
|
|
49
|
-
<script lang="ts" setup>
|
|
50
|
-
import { computed, inject } from 'vue';
|
|
51
|
-
import { CaretBottom, Delete, DocumentCopy } from '@element-plus/icons-vue';
|
|
52
|
-
|
|
53
|
-
import { TMagicIcon, TMagicPopover, TMagicTooltip } from '@tmagic/design';
|
|
54
|
-
import type { MPage } from '@tmagic/schema';
|
|
55
|
-
|
|
56
|
-
import ToolButton from '@editor/components/ToolButton.vue';
|
|
57
|
-
import type { Services } from '@editor/type';
|
|
58
|
-
|
|
59
|
-
import PageBarScrollContainer from './PageBarScrollContainer.vue';
|
|
60
|
-
|
|
61
|
-
defineOptions({
|
|
62
|
-
name: 'MEditorPageBar',
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const services = inject<Services>('services');
|
|
66
|
-
const editorService = services?.editorService;
|
|
67
|
-
|
|
68
|
-
const root = computed(() => editorService?.get('root'));
|
|
69
|
-
|
|
70
|
-
const page = computed(() => editorService?.get('page'));
|
|
71
|
-
|
|
72
|
-
const switchPage = (page: MPage) => {
|
|
73
|
-
editorService?.select(page);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const copy = (node: MPage) => {
|
|
77
|
-
node && editorService?.copy(node);
|
|
78
|
-
editorService?.paste({
|
|
79
|
-
left: 0,
|
|
80
|
-
top: 0,
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const remove = (node: MPage) => {
|
|
85
|
-
editorService?.remove(node);
|
|
86
|
-
};
|
|
87
|
-
</script>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { MPage } from '@tmagic/schema';
|
|
2
|
-
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<{}>>, {}, {}>, {
|
|
3
|
-
"page-bar-title"?(_: {
|
|
4
|
-
page: MPage;
|
|
5
|
-
}): any;
|
|
6
|
-
"page-bar-popover"?(_: {
|
|
7
|
-
page: MPage;
|
|
8
|
-
}): any;
|
|
9
|
-
}>;
|
|
10
|
-
export default _default;
|
|
11
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
12
|
-
new (): {
|
|
13
|
-
$slots: S;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
default?(_: {}): any;
|
|
3
|
-
}>;
|
|
4
|
-
export default _default;
|
|
5
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
6
|
-
new (): {
|
|
7
|
-
$slots: S;
|
|
8
|
-
};
|
|
9
|
-
};
|