@sepveneto/dnde-core 0.1.0

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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Widget-BRcHUoH6.d.cts +166 -0
  3. package/dist/Widget-BRcHUoH6.d.ts +166 -0
  4. package/dist/chunk-4QIIKQ6B.js +8 -0
  5. package/dist/chunk-4QVESRP3.js +0 -0
  6. package/dist/chunk-6FNC3XMI.js +45 -0
  7. package/dist/chunk-AEGKV2TZ.js +65 -0
  8. package/dist/chunk-CJZUQN2X.js +50 -0
  9. package/dist/chunk-D2MSIUE2.js +6 -0
  10. package/dist/chunk-QYATL3P2.js +15 -0
  11. package/dist/chunk-TM53N6AZ.js +24 -0
  12. package/dist/chunk-W776G2UQ.js +36 -0
  13. package/dist/chunk-WPER3YKQ.js +111 -0
  14. package/dist/chunk-XJ2IJHKH.js +8 -0
  15. package/dist/chunk-YSTVVZUQ.js +48 -0
  16. package/dist/class/Container.cjs +94 -0
  17. package/dist/class/Container.d.cts +10 -0
  18. package/dist/class/Container.d.ts +10 -0
  19. package/dist/class/Container.js +8 -0
  20. package/dist/class/Node.cjs +167 -0
  21. package/dist/class/Node.d.cts +49 -0
  22. package/dist/class/Node.d.ts +49 -0
  23. package/dist/class/Node.js +9 -0
  24. package/dist/class/Widget.cjs +84 -0
  25. package/dist/class/Widget.d.cts +4 -0
  26. package/dist/class/Widget.d.ts +4 -0
  27. package/dist/class/Widget.js +7 -0
  28. package/dist/class/index.cjs +238 -0
  29. package/dist/class/index.d.cts +6 -0
  30. package/dist/class/index.d.ts +6 -0
  31. package/dist/class/index.js +17 -0
  32. package/dist/helper/EventEmitter.cjs +60 -0
  33. package/dist/helper/EventEmitter.d.cts +12 -0
  34. package/dist/helper/EventEmitter.d.ts +12 -0
  35. package/dist/helper/EventEmitter.js +7 -0
  36. package/dist/helper/index.cjs +175 -0
  37. package/dist/helper/index.d.cts +7 -0
  38. package/dist/helper/index.d.ts +7 -0
  39. package/dist/helper/index.js +19 -0
  40. package/dist/helper/schema.cjs +92 -0
  41. package/dist/helper/schema.d.cts +27 -0
  42. package/dist/helper/schema.d.ts +27 -0
  43. package/dist/helper/schema.js +8 -0
  44. package/dist/helper/widget.cjs +73 -0
  45. package/dist/helper/widget.d.cts +51 -0
  46. package/dist/helper/widget.d.ts +51 -0
  47. package/dist/helper/widget.js +9 -0
  48. package/dist/index.cjs +211 -0
  49. package/dist/index.d.cts +10 -0
  50. package/dist/index.d.ts +10 -0
  51. package/dist/index.js +33 -0
  52. package/dist/internal.cjs +49 -0
  53. package/dist/internal.d.cts +18 -0
  54. package/dist/internal.d.ts +18 -0
  55. package/dist/internal.js +9 -0
  56. package/dist/tokens.cjs +30 -0
  57. package/dist/tokens.d.cts +15 -0
  58. package/dist/tokens.d.ts +15 -0
  59. package/dist/tokens.js +7 -0
  60. package/dist/types.cjs +32 -0
  61. package/dist/types.d.cts +4 -0
  62. package/dist/types.d.ts +4 -0
  63. package/dist/types.js +7 -0
  64. package/dist/utils.cjs +32 -0
  65. package/dist/utils.d.cts +3 -0
  66. package/dist/utils.d.ts +3 -0
  67. package/dist/utils.js +7 -0
  68. package/package.json +60 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SepVeneto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,166 @@
1
+ import { FormItemRule, UploadRequestOptions, InputInstance, ElOption, SelectInstance, InputNumberInstance } from 'element-plus';
2
+ import { CSSProperties } from 'vue';
3
+ import Validator from 'async-validator';
4
+
5
+ interface WidgetPos {
6
+ x?: number;
7
+ y?: number;
8
+ width?: number;
9
+ height?: number;
10
+ }
11
+ interface Base {
12
+ _uuid?: string;
13
+ _name: string;
14
+ _view: string;
15
+ _icon?: string;
16
+ container?: boolean;
17
+ meta?: {
18
+ draggable?: boolean;
19
+ };
20
+ schema?: {
21
+ props?: SchemaItem[];
22
+ style?: SchemaItem[];
23
+ };
24
+ style?: CSSProperties & WidgetPos;
25
+ }
26
+ type BaseKey = '_inContainer' | '_custom' | '_disableDel' | '_name' | '_schema' | '_uuid' | '_view';
27
+ type IWidget = Base;
28
+ type BoxModel = 'marginLeft' | 'marginTop' | 'marginRight' | 'marginBottom' | 'paddingLeft' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'borderLeft' | 'borderTop' | 'borderBottom' | 'borderight';
29
+ type SchemaRule = FormItemRule;
30
+ type ValidKey<T extends Base> = Exclude<keyof T, BaseKey> | `style.${string}` | 'isShow';
31
+ type SchemaOther<T extends Base> = {
32
+ [k in ValidKey<T>]: {
33
+ type: string;
34
+ label?: string;
35
+ key: k;
36
+ tips?: string;
37
+ link?: Record<string, SchemaOther<T>[]>;
38
+ _inContainer?: 'outer' | 'inner';
39
+ onChange?: (data: any) => void;
40
+ rules?: SchemaRule[];
41
+ [other: string]: any;
42
+ };
43
+ }[ValidKey<T>];
44
+ interface SchemaBox {
45
+ type: 'box';
46
+ _inContainer?: 'outer' | 'inner';
47
+ include?: BoxModel[];
48
+ exclude?: BoxModel[];
49
+ }
50
+ type ISchema<T extends Base = any> = (SchemaOther<T> | SchemaBox)[];
51
+ declare function isBox(schema: ISchema<any>[number]): schema is SchemaBox;
52
+ interface EditorConfig {
53
+ version?: string;
54
+ globalConfig: Record<PropertyKey, unknown>;
55
+ body: Record<PropertyKey, unknown>;
56
+ tabbars?: Record<PropertyKey, unknown>;
57
+ }
58
+ interface EditorSchema {
59
+ globalConfig?: SchemaOther<any>[];
60
+ $pageConfig?: Record<string, SchemaOther<any>[]>;
61
+ tabbar?: {
62
+ custom?: boolean;
63
+ };
64
+ [other: string]: ISchema | undefined | {
65
+ custom?: boolean;
66
+ } | SchemaOther<any>[];
67
+ }
68
+ interface EditorWidget {
69
+ _name: string;
70
+ _view: string;
71
+ _schema: string;
72
+ _inContainer?: 'outer' | 'inner';
73
+ style?: Partial<CSSProperties>;
74
+ [key: string]: unknown;
75
+ }
76
+ interface EditorRoute {
77
+ name: string;
78
+ path: string;
79
+ meta?: Record<PropertyKey, unknown> & {
80
+ title?: string;
81
+ };
82
+ }
83
+ type DisabledRules = boolean | Partial<{
84
+ delete: boolean;
85
+ custom: boolean;
86
+ sort: boolean;
87
+ }>;
88
+ type DisabledItemFn = (widget: EditorWidget) => DisabledRules;
89
+ type EditorWidgets = {
90
+ name: string;
91
+ group: EditorWidget[];
92
+ }[];
93
+ interface EditorSettings {
94
+ disabledItem?: DisabledItemFn;
95
+ disabledAdd?: boolean;
96
+ }
97
+ interface EditorData {
98
+ upload?: (data: UploadRequestOptions) => Promise<string>;
99
+ /**
100
+ * 组件视图的可访问地址
101
+ */
102
+ remoteUrl?: string;
103
+ /**
104
+ * 编辑器数据
105
+ */
106
+ config: EditorConfig;
107
+ /**
108
+ * 组件的配置项
109
+ */
110
+ schema?: EditorSchema;
111
+ /**
112
+ * 可配置的组件列表
113
+ */
114
+ widgets?: {
115
+ name: string;
116
+ group: EditorWidget[];
117
+ }[];
118
+ /**
119
+ * 编辑器的路由
120
+ */
121
+ routes?: EditorRoute[];
122
+ /**
123
+ * 编辑器配置
124
+ */
125
+ settings?: EditorSettings;
126
+ }
127
+
128
+ type Option = InstanceType<typeof ElOption>;
129
+ interface SchemaItemBase {
130
+ label: string;
131
+ key: string;
132
+ rules?: FormItemRule | FormItemRule[];
133
+ }
134
+ interface ShcemaItemInput extends SchemaItemBase {
135
+ type: 'input';
136
+ attrs?: InputInstance['$props'];
137
+ }
138
+ interface SchemaItemSelect extends SchemaItemBase {
139
+ type: 'select';
140
+ options?: Option['$props'][];
141
+ attrs?: SelectInstance['$props'];
142
+ }
143
+ interface SchemaItemNumber extends SchemaItemBase {
144
+ type: 'number';
145
+ attrs?: InputNumberInstance['$props'];
146
+ }
147
+ interface SchemaItemStyleNumber extends SchemaItemBase {
148
+ type: 'styleNumber';
149
+ }
150
+ type SchemaItem = ShcemaItemInput | SchemaItemSelect | SchemaItemNumber | SchemaItemStyleNumber;
151
+ declare class Widget {
152
+ name: string;
153
+ view: string;
154
+ _data: IWidget;
155
+ container: IWidget['container'];
156
+ constructor(widget: IWidget);
157
+ clone(): Widget;
158
+ get icon(): string | undefined;
159
+ get props(): SchemaItem[];
160
+ get style(): SchemaItem[];
161
+ get draggable(): boolean;
162
+ get validatorProps(): Validator;
163
+ get validatorStyle(): Validator;
164
+ }
165
+
166
+ export { type Base as B, type DisabledItemFn as D, type EditorConfig as E, type IWidget as I, type SchemaOther as S, type WidgetPos as W, type SchemaBox as a, type ISchema as b, type EditorSchema as c, type EditorWidget as d, type EditorRoute as e, type EditorWidgets as f, type EditorSettings as g, type EditorData as h, isBox as i, type SchemaItem as j, Widget as k };
@@ -0,0 +1,166 @@
1
+ import { FormItemRule, UploadRequestOptions, InputInstance, ElOption, SelectInstance, InputNumberInstance } from 'element-plus';
2
+ import { CSSProperties } from 'vue';
3
+ import Validator from 'async-validator';
4
+
5
+ interface WidgetPos {
6
+ x?: number;
7
+ y?: number;
8
+ width?: number;
9
+ height?: number;
10
+ }
11
+ interface Base {
12
+ _uuid?: string;
13
+ _name: string;
14
+ _view: string;
15
+ _icon?: string;
16
+ container?: boolean;
17
+ meta?: {
18
+ draggable?: boolean;
19
+ };
20
+ schema?: {
21
+ props?: SchemaItem[];
22
+ style?: SchemaItem[];
23
+ };
24
+ style?: CSSProperties & WidgetPos;
25
+ }
26
+ type BaseKey = '_inContainer' | '_custom' | '_disableDel' | '_name' | '_schema' | '_uuid' | '_view';
27
+ type IWidget = Base;
28
+ type BoxModel = 'marginLeft' | 'marginTop' | 'marginRight' | 'marginBottom' | 'paddingLeft' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'borderLeft' | 'borderTop' | 'borderBottom' | 'borderight';
29
+ type SchemaRule = FormItemRule;
30
+ type ValidKey<T extends Base> = Exclude<keyof T, BaseKey> | `style.${string}` | 'isShow';
31
+ type SchemaOther<T extends Base> = {
32
+ [k in ValidKey<T>]: {
33
+ type: string;
34
+ label?: string;
35
+ key: k;
36
+ tips?: string;
37
+ link?: Record<string, SchemaOther<T>[]>;
38
+ _inContainer?: 'outer' | 'inner';
39
+ onChange?: (data: any) => void;
40
+ rules?: SchemaRule[];
41
+ [other: string]: any;
42
+ };
43
+ }[ValidKey<T>];
44
+ interface SchemaBox {
45
+ type: 'box';
46
+ _inContainer?: 'outer' | 'inner';
47
+ include?: BoxModel[];
48
+ exclude?: BoxModel[];
49
+ }
50
+ type ISchema<T extends Base = any> = (SchemaOther<T> | SchemaBox)[];
51
+ declare function isBox(schema: ISchema<any>[number]): schema is SchemaBox;
52
+ interface EditorConfig {
53
+ version?: string;
54
+ globalConfig: Record<PropertyKey, unknown>;
55
+ body: Record<PropertyKey, unknown>;
56
+ tabbars?: Record<PropertyKey, unknown>;
57
+ }
58
+ interface EditorSchema {
59
+ globalConfig?: SchemaOther<any>[];
60
+ $pageConfig?: Record<string, SchemaOther<any>[]>;
61
+ tabbar?: {
62
+ custom?: boolean;
63
+ };
64
+ [other: string]: ISchema | undefined | {
65
+ custom?: boolean;
66
+ } | SchemaOther<any>[];
67
+ }
68
+ interface EditorWidget {
69
+ _name: string;
70
+ _view: string;
71
+ _schema: string;
72
+ _inContainer?: 'outer' | 'inner';
73
+ style?: Partial<CSSProperties>;
74
+ [key: string]: unknown;
75
+ }
76
+ interface EditorRoute {
77
+ name: string;
78
+ path: string;
79
+ meta?: Record<PropertyKey, unknown> & {
80
+ title?: string;
81
+ };
82
+ }
83
+ type DisabledRules = boolean | Partial<{
84
+ delete: boolean;
85
+ custom: boolean;
86
+ sort: boolean;
87
+ }>;
88
+ type DisabledItemFn = (widget: EditorWidget) => DisabledRules;
89
+ type EditorWidgets = {
90
+ name: string;
91
+ group: EditorWidget[];
92
+ }[];
93
+ interface EditorSettings {
94
+ disabledItem?: DisabledItemFn;
95
+ disabledAdd?: boolean;
96
+ }
97
+ interface EditorData {
98
+ upload?: (data: UploadRequestOptions) => Promise<string>;
99
+ /**
100
+ * 组件视图的可访问地址
101
+ */
102
+ remoteUrl?: string;
103
+ /**
104
+ * 编辑器数据
105
+ */
106
+ config: EditorConfig;
107
+ /**
108
+ * 组件的配置项
109
+ */
110
+ schema?: EditorSchema;
111
+ /**
112
+ * 可配置的组件列表
113
+ */
114
+ widgets?: {
115
+ name: string;
116
+ group: EditorWidget[];
117
+ }[];
118
+ /**
119
+ * 编辑器的路由
120
+ */
121
+ routes?: EditorRoute[];
122
+ /**
123
+ * 编辑器配置
124
+ */
125
+ settings?: EditorSettings;
126
+ }
127
+
128
+ type Option = InstanceType<typeof ElOption>;
129
+ interface SchemaItemBase {
130
+ label: string;
131
+ key: string;
132
+ rules?: FormItemRule | FormItemRule[];
133
+ }
134
+ interface ShcemaItemInput extends SchemaItemBase {
135
+ type: 'input';
136
+ attrs?: InputInstance['$props'];
137
+ }
138
+ interface SchemaItemSelect extends SchemaItemBase {
139
+ type: 'select';
140
+ options?: Option['$props'][];
141
+ attrs?: SelectInstance['$props'];
142
+ }
143
+ interface SchemaItemNumber extends SchemaItemBase {
144
+ type: 'number';
145
+ attrs?: InputNumberInstance['$props'];
146
+ }
147
+ interface SchemaItemStyleNumber extends SchemaItemBase {
148
+ type: 'styleNumber';
149
+ }
150
+ type SchemaItem = ShcemaItemInput | SchemaItemSelect | SchemaItemNumber | SchemaItemStyleNumber;
151
+ declare class Widget {
152
+ name: string;
153
+ view: string;
154
+ _data: IWidget;
155
+ container: IWidget['container'];
156
+ constructor(widget: IWidget);
157
+ clone(): Widget;
158
+ get icon(): string | undefined;
159
+ get props(): SchemaItem[];
160
+ get style(): SchemaItem[];
161
+ get draggable(): boolean;
162
+ get validatorProps(): Validator;
163
+ get validatorStyle(): Validator;
164
+ }
165
+
166
+ export { type Base as B, type DisabledItemFn as D, type EditorConfig as E, type IWidget as I, type SchemaOther as S, type WidgetPos as W, type SchemaBox as a, type ISchema as b, type EditorSchema as c, type EditorWidget as d, type EditorRoute as e, type EditorWidgets as f, type EditorSettings as g, type EditorData as h, isBox as i, type SchemaItem as j, Widget as k };
@@ -0,0 +1,8 @@
1
+ // src/types.ts
2
+ function isBox(schema) {
3
+ return schema.type === "box";
4
+ }
5
+
6
+ export {
7
+ isBox
8
+ };
File without changes
@@ -0,0 +1,45 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __async = (__this, __arguments, generator) => {
21
+ return new Promise((resolve, reject) => {
22
+ var fulfilled = (value) => {
23
+ try {
24
+ step(generator.next(value));
25
+ } catch (e) {
26
+ reject(e);
27
+ }
28
+ };
29
+ var rejected = (value) => {
30
+ try {
31
+ step(generator.throw(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ };
36
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
+ step((generator = generator.apply(__this, __arguments)).next());
38
+ });
39
+ };
40
+
41
+ export {
42
+ __spreadValues,
43
+ __spreadProps,
44
+ __async
45
+ };
@@ -0,0 +1,65 @@
1
+ import {
2
+ likeArray
3
+ } from "./chunk-XJ2IJHKH.js";
4
+
5
+ // src/helper/schema.ts
6
+ var schema = {
7
+ input(config) {
8
+ const base = {
9
+ label: config.label,
10
+ key: config.key,
11
+ type: "input",
12
+ rules: normalizeRules(config),
13
+ attrs: config.attrs
14
+ };
15
+ return base;
16
+ },
17
+ number(config) {
18
+ return {
19
+ label: config.label,
20
+ key: config.key,
21
+ type: "number",
22
+ rules: normalizeRules(config),
23
+ attrs: config.attrs
24
+ };
25
+ },
26
+ select(config) {
27
+ return {
28
+ label: config.label,
29
+ key: config.key,
30
+ type: "select",
31
+ attrs: config.attrs,
32
+ rules: normalizeRules(config),
33
+ options: config.options
34
+ };
35
+ },
36
+ styleNumber(config) {
37
+ return {
38
+ label: config.label,
39
+ key: config.key,
40
+ type: "styleNumber",
41
+ rules: normalizeRules(config)
42
+ };
43
+ }
44
+ };
45
+ function normalizeRules(config) {
46
+ const rules = likeArray(config.rules || []);
47
+ if (config.required) {
48
+ if (typeof config.required === "string") {
49
+ rules.push({
50
+ required: true,
51
+ message: config.required
52
+ });
53
+ } else if (config.required) {
54
+ rules.push({
55
+ required: true,
56
+ message: `\u8BF7\u586B\u5199${config.label}`
57
+ });
58
+ }
59
+ }
60
+ return rules;
61
+ }
62
+
63
+ export {
64
+ schema
65
+ };
@@ -0,0 +1,50 @@
1
+ // src/class/Widget.ts
2
+ import Validator from "async-validator";
3
+ var Widget = class _Widget {
4
+ constructor(widget) {
5
+ this._data = JSON.parse(JSON.stringify(widget));
6
+ this.name = widget._name;
7
+ this.view = widget._view;
8
+ this.container = widget.container;
9
+ }
10
+ clone() {
11
+ return new _Widget(this._data);
12
+ }
13
+ get icon() {
14
+ return this._data._icon;
15
+ }
16
+ get props() {
17
+ var _a;
18
+ return ((_a = this._data.schema) == null ? void 0 : _a.props) || [];
19
+ }
20
+ get style() {
21
+ var _a;
22
+ return ((_a = this._data.schema) == null ? void 0 : _a.style) || [];
23
+ }
24
+ get draggable() {
25
+ var _a, _b;
26
+ return (_b = (_a = this._data.meta) == null ? void 0 : _a.draggable) != null ? _b : true;
27
+ }
28
+ get validatorProps() {
29
+ var _a, _b;
30
+ const _rules = ((_b = (_a = this._data.schema) == null ? void 0 : _a.props) == null ? void 0 : _b.reduce((all, curr) => {
31
+ all[curr.key] = curr.rules || [];
32
+ return all;
33
+ }, {})) || {};
34
+ const validator = new Validator(_rules);
35
+ return validator;
36
+ }
37
+ get validatorStyle() {
38
+ var _a, _b;
39
+ const _rules = ((_b = (_a = this._data.schema) == null ? void 0 : _a.style) == null ? void 0 : _b.reduce((all, curr) => {
40
+ all[curr.key] = curr.rules || [];
41
+ return all;
42
+ }, {})) || {};
43
+ const validator = new Validator(_rules);
44
+ return validator;
45
+ }
46
+ };
47
+
48
+ export {
49
+ Widget
50
+ };
@@ -0,0 +1,6 @@
1
+ // src/tokens.ts
2
+ var editorContextKey = "$_EDITOR";
3
+
4
+ export {
5
+ editorContextKey
6
+ };
@@ -0,0 +1,15 @@
1
+ import {
2
+ Widget
3
+ } from "./chunk-CJZUQN2X.js";
4
+
5
+ // src/class/Container.ts
6
+ var Container = class extends Widget {
7
+ constructor(data) {
8
+ super(data);
9
+ this.view = "container";
10
+ }
11
+ };
12
+
13
+ export {
14
+ Container
15
+ };
@@ -0,0 +1,24 @@
1
+ // src/internal.ts
2
+ function createCopy(ctx) {
3
+ return {
4
+ name: "copy",
5
+ title: "\u590D\u5236",
6
+ action: (node) => {
7
+ ctx.addNode(node.copy(), node.parent, true);
8
+ }
9
+ };
10
+ }
11
+ function createDelete(ctx) {
12
+ return {
13
+ name: "delete",
14
+ title: "\u5220\u9664",
15
+ action: (node) => {
16
+ ctx.delNode(node.wid);
17
+ }
18
+ };
19
+ }
20
+
21
+ export {
22
+ createCopy,
23
+ createDelete
24
+ };
@@ -0,0 +1,36 @@
1
+ // src/helper/EventEmitter.ts
2
+ var EventEmitter = class {
3
+ constructor(subscribeFn) {
4
+ this.events = /* @__PURE__ */ new Map();
5
+ this.notify = subscribeFn;
6
+ }
7
+ on(event, callback) {
8
+ var _a;
9
+ if (!this.events.has(event)) {
10
+ this.events.set(event, []);
11
+ }
12
+ (_a = this.events.get(event)) == null ? void 0 : _a.push(callback);
13
+ }
14
+ emit(event, ...args) {
15
+ var _a;
16
+ this.notify(event, ...args);
17
+ if (this.events.has(event)) {
18
+ (_a = this.events.get(event)) == null ? void 0 : _a.forEach((callback) => {
19
+ callback(...args);
20
+ });
21
+ }
22
+ }
23
+ off(event, callback) {
24
+ var _a;
25
+ if (this.events.has(event)) {
26
+ this.events.set(event, ((_a = this.events.get(event)) == null ? void 0 : _a.filter((cb) => cb !== callback)) || []);
27
+ }
28
+ }
29
+ clear() {
30
+ this.events.clear();
31
+ }
32
+ };
33
+
34
+ export {
35
+ EventEmitter
36
+ };