@easy-editor/core 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.
Files changed (71) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +9 -0
  3. package/README.md +3 -0
  4. package/dist/cjs/index.development.js +11252 -0
  5. package/dist/cjs/index.development.js.map +1 -0
  6. package/dist/cjs/index.js +11252 -0
  7. package/dist/cjs/index.js.map +1 -0
  8. package/dist/cjs/index.production.js +11252 -0
  9. package/dist/cjs/index.production.js.map +1 -0
  10. package/dist/designer/clipboard.d.ts +12 -0
  11. package/dist/designer/component-meta/component-meta-manager.d.ts +21 -0
  12. package/dist/designer/component-meta/component-meta.d.ts +30 -0
  13. package/dist/designer/component-meta/index.d.ts +3 -0
  14. package/dist/designer/component-meta/meta.d.ts +264 -0
  15. package/dist/designer/designer.d.ts +86 -0
  16. package/dist/designer/detecting.d.ts +23 -0
  17. package/dist/designer/dragon.d.ts +103 -0
  18. package/dist/designer/index.d.ts +10 -0
  19. package/dist/designer/location.d.ts +94 -0
  20. package/dist/designer/offset-observer.d.ts +41 -0
  21. package/dist/designer/selection.d.ts +27 -0
  22. package/dist/designer/sensor.d.ts +30 -0
  23. package/dist/designer/setting/index.d.ts +5 -0
  24. package/dist/designer/setting/setting-entry.d.ts +42 -0
  25. package/dist/designer/setting/setting-field.d.ts +49 -0
  26. package/dist/designer/setting/setting-manager.d.ts +16 -0
  27. package/dist/designer/setting/setting-prop-entry.d.ts +89 -0
  28. package/dist/designer/setting/setting-top-entry.d.ts +83 -0
  29. package/dist/document/document.d.ts +89 -0
  30. package/dist/document/history.d.ts +76 -0
  31. package/dist/document/index.d.ts +6 -0
  32. package/dist/document/node/node-children.d.ts +51 -0
  33. package/dist/document/node/node.d.ts +233 -0
  34. package/dist/document/prop/prop.d.ts +185 -0
  35. package/dist/document/prop/props.d.ts +57 -0
  36. package/dist/document/prop/value-to-source.d.ts +8 -0
  37. package/dist/editor.d.ts +94 -0
  38. package/dist/esm/index.development.js +11145 -0
  39. package/dist/esm/index.development.js.map +1 -0
  40. package/dist/esm/index.js +11145 -0
  41. package/dist/esm/index.js.map +1 -0
  42. package/dist/esm/index.production.js +11145 -0
  43. package/dist/esm/index.production.js.map +1 -0
  44. package/dist/index.d.ts +10 -0
  45. package/dist/index.js +11144 -0
  46. package/dist/plugin/index.d.ts +3 -0
  47. package/dist/plugin/plugin-context.d.ts +20 -0
  48. package/dist/plugin/plugin-extend.d.ts +32 -0
  49. package/dist/plugin/plugin-manager.d.ts +78 -0
  50. package/dist/plugin/plugin-runtime.d.ts +28 -0
  51. package/dist/plugin/sequencify.d.ts +19 -0
  52. package/dist/project/index.d.ts +1 -0
  53. package/dist/project/project.d.ts +68 -0
  54. package/dist/setter-manager/index.d.ts +1 -0
  55. package/dist/setter-manager/setter-manager.d.ts +29 -0
  56. package/dist/simulator/index.d.ts +3 -0
  57. package/dist/simulator/simulator-renderer.d.ts +41 -0
  58. package/dist/simulator/simulator.d.ts +106 -0
  59. package/dist/simulator/viewport.d.ts +29 -0
  60. package/dist/types/common.d.ts +11 -0
  61. package/dist/types/event.d.ts +12 -0
  62. package/dist/types/index.d.ts +3 -0
  63. package/dist/types/schema.d.ts +64 -0
  64. package/dist/utils/common.d.ts +1 -0
  65. package/dist/utils/event-bus.d.ts +45 -0
  66. package/dist/utils/hotkey.d.ts +87 -0
  67. package/dist/utils/index.d.ts +6 -0
  68. package/dist/utils/is.d.ts +2 -0
  69. package/dist/utils/logger.d.ts +18 -0
  70. package/dist/utils/unique-id.d.ts +5 -0
  71. package/package.json +67 -0
@@ -0,0 +1,87 @@
1
+ export interface HotkeyCallbackConfig {
2
+ callback: HotkeyCallback;
3
+ modifiers: string[];
4
+ action: string;
5
+ seq?: string;
6
+ level?: number;
7
+ combo?: string;
8
+ }
9
+ export type Disposable = () => void;
10
+ export type HotkeyCallback = (e: KeyboardEvent, combo?: string) => any | false;
11
+ export interface HotkeyCallbacks {
12
+ [key: string]: HotkeyCallbackConfig[];
13
+ }
14
+ export interface ApiHotkey {
15
+ /**
16
+ * 获取当前快捷键配置
17
+ *
18
+ * @experimental
19
+ * @since v1.1.0
20
+ */
21
+ get callbacks(): HotkeyCallbacks;
22
+ /**
23
+ * 绑定快捷键
24
+ * bind hotkey/hotkeys,
25
+ * @param combos 快捷键,格式如:['command + s'] 、['ctrl + shift + s'] 等
26
+ * @param callback 回调函数
27
+ * @param action
28
+ */
29
+ bind(combos: string[] | string, callback: HotkeyCallback, action?: string): Disposable;
30
+ }
31
+ export interface HotkeyConfig {
32
+ combos: string | string[];
33
+ callback: HotkeyCallback;
34
+ action?: string;
35
+ }
36
+ export declare class Hotkey {
37
+ readonly viewName: string;
38
+ logger: {
39
+ log: (message?: any, ...optionalParams: any[]) => void;
40
+ error: (message?: any, ...optionalParams: any[]) => void;
41
+ warn: (message?: any, ...optionalParams: any[]) => void;
42
+ };
43
+ /**
44
+ * 当前快捷键配置
45
+ */
46
+ callBacks: HotkeyCallbacks;
47
+ private directMap;
48
+ private sequenceLevels;
49
+ private resetTimer;
50
+ private ignoreNextKeyup;
51
+ private ignoreNextKeypress;
52
+ private nextExpectedAction;
53
+ private isActivate;
54
+ constructor(viewName?: string);
55
+ activate(activate: boolean): void;
56
+ mount(window: Window): () => void;
57
+ /**
58
+ * 绑定快捷键
59
+ * @param combos 快捷键,格式如:['command + s'] 、['ctrl + shift + s'] 等
60
+ * @param callback 回调函数
61
+ * @param action
62
+ */
63
+ bind(combos: string[] | string, callback: HotkeyCallback, action?: string): Hotkey;
64
+ batchBind(hotkeys: HotkeyConfig[]): Hotkey;
65
+ /**
66
+ * 解绑快捷键
67
+ * @param combos 快捷键,格式如:['command + s'] 、['ctrl + shift + s'] 等
68
+ * @param callback 回调函数
69
+ * @param action
70
+ */
71
+ unbind(combos: string[] | string, callback: HotkeyCallback, action?: string): void;
72
+ /**
73
+ * resets all sequence counters except for the ones passed in
74
+ */
75
+ private resetSequences;
76
+ /**
77
+ * finds all callbacks that match based on the keycode, modifiers,
78
+ * and action
79
+ */
80
+ private getMatches;
81
+ private handleKey;
82
+ private handleKeyEvent;
83
+ private resetSequenceTimer;
84
+ private bindSequence;
85
+ private bindSingle;
86
+ private bindMultiple;
87
+ }
@@ -0,0 +1,6 @@
1
+ export * from './common';
2
+ export * from './event-bus';
3
+ export * from './hotkey';
4
+ export * from './is';
5
+ export * from './logger';
6
+ export * from './unique-id';
@@ -0,0 +1,2 @@
1
+ export declare const isObject: (value: any) => value is Record<string, unknown>;
2
+ export declare const isPlainObject: (value: any) => value is any;
@@ -0,0 +1,18 @@
1
+ export interface Logger {
2
+ log: (...args: Parameters<(typeof console)['log']>) => void;
3
+ error: (...args: Parameters<(typeof console)['error']>) => void;
4
+ warn: (...args: Parameters<(typeof console)['warn']>) => void;
5
+ }
6
+ export declare const createLogger: (title: string) => {
7
+ log: (message?: any, ...optionalParams: any[]) => void;
8
+ error: (message?: any, ...optionalParams: any[]) => void;
9
+ warn: (message?: any, ...optionalParams: any[]) => void;
10
+ };
11
+ /**
12
+ * internal global logger
13
+ */
14
+ export declare const logger: {
15
+ log: (message?: any, ...optionalParams: any[]) => void;
16
+ error: (message?: any, ...optionalParams: any[]) => void;
17
+ warn: (message?: any, ...optionalParams: any[]) => void;
18
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * generate a unique id
3
+ * @param prefix a identifier prefix
4
+ */
5
+ export declare const uniqueId: (prefix?: string) => string;
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@easy-editor/core",
3
+ "version": "0.0.1",
4
+ "description": "A cross-framework low-code engine with scale-out design",
5
+ "type": "module",
6
+ "source": "src/index.ts",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "typings": "dist/index.d.ts",
10
+ "module": "dist/index.js",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/cjs/index.js",
15
+ "default": "./dist/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "LICENSE",
21
+ "CHANGELOG.md",
22
+ "README.md"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "homepage": "https://github.com/Easy-Editor/EasyEditor",
28
+ "license": "MIT",
29
+ "author": "JinSo <kimjinso@qq.com>",
30
+ "contributors": [
31
+ {
32
+ "name": "NoahCodeGG",
33
+ "email": "noahcodegg@gmail.com",
34
+ "url": "https://github.com/NoahCodeGG"
35
+ }
36
+ ],
37
+ "keywords": [
38
+ "@easy-editor",
39
+ "easyeditor",
40
+ "low-code",
41
+ "editor",
42
+ "engine"
43
+ ],
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "https://github.com/Easy-Editor/EasyEditor"
47
+ },
48
+ "bugs": {
49
+ "url": "https://github.com/Easy-Editor/EasyEditor/issues"
50
+ },
51
+ "dependencies": {
52
+ "mobx": "^6.13.5",
53
+ "nanoid": "^5.0.7"
54
+ },
55
+ "scripts": {
56
+ "dev": "deno run --watch ./src/index.ts",
57
+ "format": "biome format --write .",
58
+ "lint": "biome check .",
59
+ "build": "npm-run-all -nl build:*",
60
+ "build:clean": "rimraf dist/",
61
+ "build:js": "rollup -c",
62
+ "types": "npm-run-all -nl types:*",
63
+ "types:clean": "rimraf types/",
64
+ "types:src": "tsc --project tsconfig.build.json",
65
+ "test-types": "tsc --project tsconfig.test.json"
66
+ }
67
+ }