@easy-editor/plugin-dashboard 0.0.1

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.
@@ -0,0 +1,6 @@
1
+ import type { PropsWithChildren, Ref } from 'react';
2
+ interface GroupProps extends PropsWithChildren {
3
+ ref: Ref<HTMLDivElement>;
4
+ }
5
+ declare const Group: (props: GroupProps) => import("react").JSX.Element;
6
+ export default Group;
@@ -0,0 +1,3 @@
1
+ import type { Configure } from '@easy-editor/core';
2
+ declare const configure: Configure;
3
+ export default configure;
@@ -0,0 +1,3 @@
1
+ import GroupComponent from './component';
2
+ import GroupComponentMeta from './meta';
3
+ export { GroupComponent, GroupComponentMeta };
@@ -0,0 +1,3 @@
1
+ import type { ComponentMetadata } from '@easy-editor/core';
2
+ declare const meta: ComponentMetadata;
3
+ export default meta;
package/dist/type.d.ts ADDED
@@ -0,0 +1,91 @@
1
+ import type { ComponentInstance } from '@easy-editor/core';
2
+ import type { GuideLine } from './designer/guideline';
3
+ declare module '@easy-editor/core' {
4
+ interface Designer {
5
+ /**
6
+ * 辅助线
7
+ */
8
+ guideline: GuideLine;
9
+ }
10
+ interface Document {
11
+ /**
12
+ * 将一批 Node 组合成 Group
13
+ * TODO: Group 插入到哪里
14
+ */
15
+ group(nodeIdList: Node[] | string[]): Node | null;
16
+ /**
17
+ * 取消组合
18
+ * TODO: 取消组合后,Node 插入到哪里
19
+ */
20
+ ungroup(group: Node | string): void;
21
+ }
22
+ interface Node {
23
+ /**
24
+ * 获取 dashboard 容器 DOM
25
+ */
26
+ getDashboardContainer(): HTMLElement | null;
27
+ /**
28
+ * 获取 dashboard 位置信息
29
+ */
30
+ getDashboardRect(): DOMRect;
31
+ /**
32
+ * 更新 dashboard 位置信息
33
+ */
34
+ updateDashboardRect(rect: Partial<DOMRect>): void;
35
+ /**
36
+ * 是否是 Group
37
+ */
38
+ isGroup: boolean;
39
+ /**
40
+ * 获取当前处于的 Group
41
+ */
42
+ getCurrentGroup(): Node | null;
43
+ /**
44
+ * 获取最顶层的 Group
45
+ */
46
+ getTopGroup(): Node | null;
47
+ /**
48
+ * 获取当前 Node 的所有 Group
49
+ */
50
+ getAllGroups(): Node[];
51
+ /**
52
+ * 获取当前 Group 下的 Node
53
+ */
54
+ getNodesInGroup(): Node[];
55
+ /**
56
+ * 获取当前 Group 下的所有 Node
57
+ */
58
+ getAllNodesInGroup(): Node[];
59
+ }
60
+ interface NodeSchema {
61
+ /**
62
+ * 是否是分组
63
+ */
64
+ isGroup?: boolean;
65
+ /**
66
+ * dashboard 额外信息
67
+ */
68
+ $dashboard?: {
69
+ /**
70
+ * 位置信息
71
+ */
72
+ rect?: DashboardRect;
73
+ };
74
+ }
75
+ interface Simulator {
76
+ /**
77
+ * 获取组件在 dashboard 中的位置
78
+ */
79
+ computeDashboardRect(node: Node): DOMRect;
80
+ /**
81
+ * 获取组件实例在 dashboard 中的位置
82
+ */
83
+ computeComponentInstanceDashboardRect(instance: ComponentInstance): DOMRect;
84
+ }
85
+ }
86
+ export interface DashboardRect {
87
+ x?: number;
88
+ y?: number;
89
+ width?: number;
90
+ height?: number;
91
+ }
@@ -0,0 +1,21 @@
1
+ import type { Node } from '@easy-editor/core';
2
+ /**
3
+ * 更新节点在 dashboard 中的位置
4
+ * @param node 节点
5
+ * @param offset 节点相对于画布的偏移量
6
+ * @param groupOffset 节点相对于其父组节点的偏移量
7
+ */
8
+ export declare const updateNodeRect: (node: Node, offset?: {
9
+ x: number;
10
+ y: number;
11
+ }) => void;
12
+ /**
13
+ * 更新节点 DOM 在 dashboard 中的位置
14
+ * @param node 节点
15
+ * @param offset 节点相对于画布的偏移量
16
+ * @param groupOffset 节点相对于其父组节点的偏移量
17
+ */
18
+ export declare const updateNodeRectByDOM: (node: Node, offset?: {
19
+ x: number;
20
+ y: number;
21
+ }) => void;
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@easy-editor/plugin-dashboard",
3
+ "version": "0.0.1",
4
+ "description": "Dashboard plugin for EasyEditor.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "files": [
8
+ "dist",
9
+ "LICENSE",
10
+ "CHANGELOG.md",
11
+ "README.md"
12
+ ],
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "homepage": "https://github.com/Easy-Editor/EasyEditor",
17
+ "license": "MIT",
18
+ "author": "JinSo <kimjinso@qq.com>",
19
+ "keywords": [
20
+ "@easy-editor",
21
+ "easyeditor",
22
+ "low-code",
23
+ "editor",
24
+ "engine",
25
+ "plugin",
26
+ "dashboard"
27
+ ],
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/Easy-Editor/EasyEditor"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/Easy-Editor/EasyEditor/issues"
34
+ },
35
+ "peerDependencies": {
36
+ "mobx": "^6.13.5",
37
+ "react": "^19.0.0",
38
+ "react-dom": "^19.0.0",
39
+ "@types/react": "^18.3.12",
40
+ "@types/react-dom": "^18.3.1",
41
+ "@easy-editor/core": "0.0.2"
42
+ },
43
+ "scripts": {
44
+ "dev": "deno run --watch ./src/index.ts",
45
+ "format": "biome format --write .",
46
+ "lint": "biome check .",
47
+ "build": "npm-run-all -nl build:*",
48
+ "build:clean": "rimraf dist/",
49
+ "build:js": "rollup -c",
50
+ "types": "npm-run-all -nl types:*",
51
+ "types:src": "tsc --project tsconfig.build.json",
52
+ "test-types": "tsc --project tsconfig.test.json"
53
+ },
54
+ "types": "dist/index.d.ts",
55
+ "typings": "dist/index.d.ts",
56
+ "module": "dist/index.js",
57
+ "exports": {
58
+ ".": {
59
+ "import": "./dist/index.js",
60
+ "require": "./dist/cjs/index.js",
61
+ "default": "./dist/index.js"
62
+ }
63
+ }
64
+ }