@arcanejs/toolkit 0.2.0 → 0.2.2
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/backend/components/base.d.mts +69 -2
- package/dist/backend/components/base.d.ts +69 -2
- package/dist/backend/components/base.js +10 -188
- package/dist/backend/components/base.mjs +2 -1
- package/dist/backend/components/button.d.mts +5 -4
- package/dist/backend/components/button.d.ts +5 -4
- package/dist/backend/components/button.js +5 -165
- package/dist/backend/components/button.mjs +3 -2
- package/dist/backend/components/group.d.mts +9 -7
- package/dist/backend/components/group.d.ts +9 -7
- package/dist/backend/components/group.js +6 -282
- package/dist/backend/components/group.mjs +3 -2
- package/dist/backend/components/label.d.mts +5 -3
- package/dist/backend/components/label.d.ts +5 -3
- package/dist/backend/components/label.js +5 -102
- package/dist/backend/components/label.mjs +3 -2
- package/dist/backend/components/rect.d.mts +4 -3
- package/dist/backend/components/rect.d.ts +4 -3
- package/dist/backend/components/rect.js +5 -102
- package/dist/backend/components/rect.mjs +3 -2
- package/dist/backend/components/slider-button.d.mts +5 -4
- package/dist/backend/components/slider-button.d.ts +5 -4
- package/dist/backend/components/slider-button.js +5 -158
- package/dist/backend/components/slider-button.mjs +3 -2
- package/dist/backend/components/switch.d.mts +5 -4
- package/dist/backend/components/switch.d.ts +5 -4
- package/dist/backend/components/switch.js +5 -141
- package/dist/backend/components/switch.mjs +3 -2
- package/dist/backend/components/tabs.d.mts +5 -4
- package/dist/backend/components/tabs.d.ts +5 -4
- package/dist/backend/components/tabs.js +7 -206
- package/dist/backend/components/tabs.mjs +3 -2
- package/dist/backend/components/text-input.d.mts +5 -4
- package/dist/backend/components/text-input.d.ts +5 -4
- package/dist/backend/components/text-input.js +5 -143
- package/dist/backend/components/text-input.mjs +3 -2
- package/dist/backend/components/timeline.d.mts +6 -5
- package/dist/backend/components/timeline.d.ts +6 -5
- package/dist/backend/components/timeline.js +5 -106
- package/dist/backend/components/timeline.mjs +3 -2
- package/dist/backend/util/index.d.mts +7 -0
- package/dist/backend/util/index.d.ts +7 -0
- package/dist/backend/util/index.js +7 -0
- package/dist/backend/util/index.mjs +7 -0
- package/dist/{chunk-L243ZOAR.mjs → chunk-3O4P67DM.mjs} +2 -4
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/{chunk-37VNFO5S.mjs → chunk-APCR3ITH.mjs} +1 -1
- package/dist/chunk-EABM5X65.js +17 -0
- package/dist/{chunk-P6X5GIDT.mjs → chunk-HNEUZVCX.mjs} +1 -1
- package/dist/{chunk-6LL3X7ZZ.mjs → chunk-IXTM35YM.mjs} +1 -1
- package/dist/{chunk-HVFTRNLQ.mjs → chunk-JW4GXS54.mjs} +1 -1
- package/dist/chunk-K24YPCR5.js +104 -0
- package/dist/chunk-KVJU3EAD.js +66 -0
- package/dist/chunk-M6EFK4GP.js +42 -0
- package/dist/chunk-MDFDWKGW.js +44 -0
- package/dist/chunk-OEIGZ3NQ.js +33 -0
- package/dist/chunk-P43QUQ4T.js +29 -0
- package/dist/chunk-RGHJEMWG.mjs +17 -0
- package/dist/chunk-RGIB65TI.js +29 -0
- package/dist/chunk-RJS32OOA.js +55 -0
- package/dist/{chunk-DBW4OPGN.mjs → chunk-SOC4TF3J.mjs} +1 -1
- package/dist/chunk-T2PJEXYO.js +59 -0
- package/dist/{chunk-DP3QFYSS.mjs → chunk-TAZH4BBH.mjs} +1 -1
- package/dist/{chunk-3ZBM7Q4A.mjs → chunk-TQ27Y7F4.mjs} +1 -1
- package/dist/chunk-UBWCVW2U.js +163 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/{chunk-HF77PS7J.mjs → chunk-ZCHM3JJJ.mjs} +0 -8
- package/dist/{chunk-GQZA5K4M.mjs → chunk-ZU5H6SVA.mjs} +1 -1
- package/dist/frontend.js +1345 -398
- package/dist/frontend.js.map +4 -4
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +82 -658
- package/dist/index.mjs +14 -24
- package/package.json +10 -2
- package/dist/base-BJAPu0O1.d.mts +0 -234
- package/dist/base-BJAPu0O1.d.ts +0 -234
|
@@ -1,286 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
19
2
|
|
|
20
|
-
// src/backend/components/group.ts
|
|
21
|
-
var group_exports = {};
|
|
22
|
-
__export(group_exports, {
|
|
23
|
-
Group: () => Group,
|
|
24
|
-
GroupHeader: () => GroupHeader
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(group_exports);
|
|
27
3
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
4
|
+
var _chunkK24YPCR5js = require('../../chunk-K24YPCR5.js');
|
|
5
|
+
require('../../chunk-UBWCVW2U.js');
|
|
6
|
+
require('../../chunk-3RG5ZIWI.js');
|
|
32
7
|
|
|
33
|
-
// src/backend/components/base.ts
|
|
34
|
-
var Base = class {
|
|
35
|
-
/** @hidden */
|
|
36
|
-
parent = null;
|
|
37
|
-
/** @hidden */
|
|
38
|
-
defaultProps;
|
|
39
|
-
/** @hidden */
|
|
40
|
-
_props;
|
|
41
|
-
constructor(defaultProps, props) {
|
|
42
|
-
this.defaultProps = defaultProps;
|
|
43
|
-
this._props = Object.freeze({
|
|
44
|
-
...defaultProps,
|
|
45
|
-
...props
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
get props() {
|
|
49
|
-
return this._props;
|
|
50
|
-
}
|
|
51
|
-
set props(props) {
|
|
52
|
-
this.setProps(props);
|
|
53
|
-
}
|
|
54
|
-
setProps = (props) => {
|
|
55
|
-
this._props = Object.freeze({
|
|
56
|
-
...this.defaultProps,
|
|
57
|
-
...props
|
|
58
|
-
});
|
|
59
|
-
this.updateTree();
|
|
60
|
-
};
|
|
61
|
-
updateProps = (updates) => {
|
|
62
|
-
this._props = Object.freeze({
|
|
63
|
-
...this._props,
|
|
64
|
-
...updates
|
|
65
|
-
});
|
|
66
|
-
this.updateTree();
|
|
67
|
-
};
|
|
68
|
-
/** @hidden */
|
|
69
|
-
setParent(parent) {
|
|
70
|
-
if (this.parent && this.parent !== parent) {
|
|
71
|
-
this.parent.removeChild(this);
|
|
72
|
-
}
|
|
73
|
-
this.parent = parent;
|
|
74
|
-
}
|
|
75
|
-
/** @hidden */
|
|
76
|
-
updateTree() {
|
|
77
|
-
if (this.parent) this.parent.updateTree();
|
|
78
|
-
}
|
|
79
|
-
/** @hidden */
|
|
80
|
-
handleMessage(message) {
|
|
81
|
-
console.log("Component Received Message:", message);
|
|
82
|
-
}
|
|
83
|
-
routeMessage(_idMap, _message) {
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
var BaseParent = class extends Base {
|
|
87
|
-
/** @hidden */
|
|
88
|
-
children = [];
|
|
89
|
-
appendChildren = (...children) => {
|
|
90
|
-
for (const c of children) {
|
|
91
|
-
const newChildren = [...this.children.filter((ch) => ch !== c), c];
|
|
92
|
-
this.validateChildren(newChildren);
|
|
93
|
-
this.children = Object.freeze(newChildren);
|
|
94
|
-
c.setParent(this);
|
|
95
|
-
}
|
|
96
|
-
this.updateTree();
|
|
97
|
-
return children;
|
|
98
|
-
};
|
|
99
|
-
appendChild = (child) => {
|
|
100
|
-
this.appendChildren(child);
|
|
101
|
-
return child;
|
|
102
|
-
};
|
|
103
|
-
removeChild = (component) => {
|
|
104
|
-
const match = this.children.findIndex((c) => c === component);
|
|
105
|
-
if (match >= 0) {
|
|
106
|
-
const removingChild = this.children[match];
|
|
107
|
-
const newChildren = [
|
|
108
|
-
...this.children.slice(0, match),
|
|
109
|
-
...this.children.slice(match + 1)
|
|
110
|
-
];
|
|
111
|
-
this.validateChildren(newChildren);
|
|
112
|
-
this.children = Object.freeze(newChildren);
|
|
113
|
-
removingChild?.setParent(null);
|
|
114
|
-
this.updateTree();
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
removeAllChildren = () => {
|
|
118
|
-
this.children.map((c) => c.setParent(null));
|
|
119
|
-
this.children = Object.freeze([]);
|
|
120
|
-
this.updateTree();
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Return all children components that messages need to be routed to
|
|
124
|
-
*/
|
|
125
|
-
getChildren = () => this.children;
|
|
126
|
-
/**
|
|
127
|
-
* TODO: we can do this better, right now it broadcasts the message to all
|
|
128
|
-
* components of the tree
|
|
129
|
-
*
|
|
130
|
-
* @hidden
|
|
131
|
-
*/
|
|
132
|
-
routeMessage(idMap, message) {
|
|
133
|
-
if (idMap.getId(this) === message.componentKey) {
|
|
134
|
-
this.handleMessage(message);
|
|
135
|
-
} else {
|
|
136
|
-
for (const c of this.children) {
|
|
137
|
-
if (idMap.getId(c) === message.componentKey) {
|
|
138
|
-
c.handleMessage(message);
|
|
139
|
-
} else {
|
|
140
|
-
c.routeMessage(idMap, message);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
insertBefore(child, beforeChild) {
|
|
146
|
-
const filteredChildren = this.children.filter((c) => c !== child);
|
|
147
|
-
let match = filteredChildren.findIndex((c) => c === beforeChild);
|
|
148
|
-
console.log("match", match);
|
|
149
|
-
if (match === -1) {
|
|
150
|
-
match = filteredChildren.length;
|
|
151
|
-
}
|
|
152
|
-
const newChildren = [
|
|
153
|
-
...filteredChildren.slice(0, match),
|
|
154
|
-
child,
|
|
155
|
-
...filteredChildren.slice(match)
|
|
156
|
-
];
|
|
157
|
-
this.validateChildren(newChildren);
|
|
158
|
-
this.children = Object.freeze(newChildren);
|
|
159
|
-
child.setParent(this);
|
|
160
|
-
this.updateTree();
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
var EventEmitter = class {
|
|
164
|
-
listeners = /* @__PURE__ */ new Map();
|
|
165
|
-
addListener = (type, listener) => {
|
|
166
|
-
let set = this.listeners.get(type);
|
|
167
|
-
if (!set) {
|
|
168
|
-
set = /* @__PURE__ */ new Set();
|
|
169
|
-
this.listeners.set(type, set);
|
|
170
|
-
}
|
|
171
|
-
set.add(listener);
|
|
172
|
-
};
|
|
173
|
-
removeListener = (type, listener) => {
|
|
174
|
-
this.listeners.get(type)?.delete(listener);
|
|
175
|
-
};
|
|
176
|
-
emit = (type, ...args) => {
|
|
177
|
-
return Promise.all(
|
|
178
|
-
[...this.listeners.get(type) || []].map(
|
|
179
|
-
(l) => new Promise((resolve, reject) => {
|
|
180
|
-
try {
|
|
181
|
-
resolve(l(...args));
|
|
182
|
-
} catch (e) {
|
|
183
|
-
reject(e);
|
|
184
|
-
}
|
|
185
|
-
})
|
|
186
|
-
)
|
|
187
|
-
);
|
|
188
|
-
};
|
|
189
|
-
};
|
|
190
8
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
...GROUP_DEFAULT_STYLE,
|
|
194
|
-
title: null,
|
|
195
|
-
labels: null
|
|
196
|
-
};
|
|
197
|
-
var GroupHeader = class extends BaseParent {
|
|
198
|
-
validateChildren = () => {
|
|
199
|
-
};
|
|
200
|
-
/** @hidden */
|
|
201
|
-
getProtoInfo = (idMap) => ({
|
|
202
|
-
component: "group-header",
|
|
203
|
-
key: idMap.getId(this),
|
|
204
|
-
children: this.getChildren().map((c) => c.getProtoInfo(idMap))
|
|
205
|
-
});
|
|
206
|
-
};
|
|
207
|
-
var Group = class extends BaseParent {
|
|
208
|
-
/** @hidden */
|
|
209
|
-
events = new EventEmitter();
|
|
210
|
-
constructor(props) {
|
|
211
|
-
super(DEFAULT_PROPS, props);
|
|
212
|
-
}
|
|
213
|
-
addListener = this.events.addListener;
|
|
214
|
-
removeListener = this.events.removeListener;
|
|
215
|
-
validateChildren = () => {
|
|
216
|
-
};
|
|
217
|
-
setOptions = (options) => {
|
|
218
|
-
this.updateProps(options);
|
|
219
|
-
};
|
|
220
|
-
setTitle = (title) => {
|
|
221
|
-
this.updateProps({ title });
|
|
222
|
-
};
|
|
223
|
-
addLabel = (label) => {
|
|
224
|
-
this.updateProps({ labels: [...this.props.labels || [], label] });
|
|
225
|
-
};
|
|
226
|
-
setLabels = (labels) => {
|
|
227
|
-
this.updateProps({ labels });
|
|
228
|
-
};
|
|
229
|
-
addHeaderChild = (child) => {
|
|
230
|
-
const header = new GroupHeader({});
|
|
231
|
-
header.appendChild(child);
|
|
232
|
-
this.appendChild(header);
|
|
233
|
-
return child;
|
|
234
|
-
};
|
|
235
|
-
removeHeaderChild = (child) => {
|
|
236
|
-
for (const c of this.getChildren()) {
|
|
237
|
-
if (c instanceof GroupHeader) {
|
|
238
|
-
c.removeChild(child);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
removeAllHeaderChildren = () => {
|
|
243
|
-
for (const child of this.getChildren()) {
|
|
244
|
-
if (child instanceof GroupHeader) {
|
|
245
|
-
child.removeAllChildren();
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
/** @hidden */
|
|
250
|
-
getProtoInfo = (idMap) => {
|
|
251
|
-
const children = [];
|
|
252
|
-
const headers = [];
|
|
253
|
-
for (const c of this.getChildren()) {
|
|
254
|
-
const childProto = c.getProtoInfo(idMap);
|
|
255
|
-
if (childProto.component === "group-header") {
|
|
256
|
-
headers.push(childProto);
|
|
257
|
-
} else {
|
|
258
|
-
children.push(childProto);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return {
|
|
262
|
-
component: "group",
|
|
263
|
-
key: idMap.getId(this),
|
|
264
|
-
title: this.props.title ?? void 0,
|
|
265
|
-
direction: this.props.direction,
|
|
266
|
-
border: this.props.border,
|
|
267
|
-
wrap: this.props.wrap,
|
|
268
|
-
children,
|
|
269
|
-
headers: headers.length > 0 ? headers : void 0,
|
|
270
|
-
labels: this.props.labels ?? void 0,
|
|
271
|
-
editableTitle: this.props.editableTitle || false,
|
|
272
|
-
defaultCollapsibleState: this.props.defaultCollapsibleState
|
|
273
|
-
};
|
|
274
|
-
};
|
|
275
|
-
/** @hidden */
|
|
276
|
-
handleMessage = (message) => {
|
|
277
|
-
if (message.component === "group") {
|
|
278
|
-
this.events.emit("title-changed", message.title);
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
283
|
-
0 && (module.exports = {
|
|
284
|
-
Group,
|
|
285
|
-
GroupHeader
|
|
286
|
-
});
|
|
9
|
+
|
|
10
|
+
exports.Group = _chunkK24YPCR5js.Group; exports.GroupHeader = _chunkK24YPCR5js.GroupHeader;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '@arcanejs/
|
|
1
|
+
import * as proto from '@arcanejs/protocol';
|
|
2
|
+
import { LabelComponentStyle } from '@arcanejs/protocol/styles';
|
|
3
|
+
import { IDMap } from '../util/index.mjs';
|
|
4
|
+
import { Base } from './base.mjs';
|
|
3
5
|
|
|
4
6
|
type InternalProps = LabelComponentStyle & {
|
|
5
7
|
text: string | null;
|
|
@@ -14,7 +16,7 @@ type Props = InternalProps;
|
|
|
14
16
|
declare class Label extends Base<InternalProps> {
|
|
15
17
|
constructor(props?: Props);
|
|
16
18
|
/** @hidden */
|
|
17
|
-
getProtoInfo(idMap: IDMap): Component;
|
|
19
|
+
getProtoInfo(idMap: IDMap): proto.Component;
|
|
18
20
|
setText(text: string): Label;
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '@arcanejs/
|
|
1
|
+
import * as proto from '@arcanejs/protocol';
|
|
2
|
+
import { LabelComponentStyle } from '@arcanejs/protocol/styles';
|
|
3
|
+
import { IDMap } from '../util/index.js';
|
|
4
|
+
import { Base } from './base.js';
|
|
3
5
|
|
|
4
6
|
type InternalProps = LabelComponentStyle & {
|
|
5
7
|
text: string | null;
|
|
@@ -14,7 +16,7 @@ type Props = InternalProps;
|
|
|
14
16
|
declare class Label extends Base<InternalProps> {
|
|
15
17
|
constructor(props?: Props);
|
|
16
18
|
/** @hidden */
|
|
17
|
-
getProtoInfo(idMap: IDMap): Component;
|
|
19
|
+
getProtoInfo(idMap: IDMap): proto.Component;
|
|
18
20
|
setText(text: string): Label;
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -1,105 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Label: () => Label
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(label_exports);
|
|
3
|
+
var _chunkP43QUQ4Tjs = require('../../chunk-P43QUQ4T.js');
|
|
4
|
+
require('../../chunk-UBWCVW2U.js');
|
|
5
|
+
require('../../chunk-3RG5ZIWI.js');
|
|
26
6
|
|
|
27
|
-
// src/backend/components/base.ts
|
|
28
|
-
var Base = class {
|
|
29
|
-
/** @hidden */
|
|
30
|
-
parent = null;
|
|
31
|
-
/** @hidden */
|
|
32
|
-
defaultProps;
|
|
33
|
-
/** @hidden */
|
|
34
|
-
_props;
|
|
35
|
-
constructor(defaultProps, props) {
|
|
36
|
-
this.defaultProps = defaultProps;
|
|
37
|
-
this._props = Object.freeze({
|
|
38
|
-
...defaultProps,
|
|
39
|
-
...props
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
get props() {
|
|
43
|
-
return this._props;
|
|
44
|
-
}
|
|
45
|
-
set props(props) {
|
|
46
|
-
this.setProps(props);
|
|
47
|
-
}
|
|
48
|
-
setProps = (props) => {
|
|
49
|
-
this._props = Object.freeze({
|
|
50
|
-
...this.defaultProps,
|
|
51
|
-
...props
|
|
52
|
-
});
|
|
53
|
-
this.updateTree();
|
|
54
|
-
};
|
|
55
|
-
updateProps = (updates) => {
|
|
56
|
-
this._props = Object.freeze({
|
|
57
|
-
...this._props,
|
|
58
|
-
...updates
|
|
59
|
-
});
|
|
60
|
-
this.updateTree();
|
|
61
|
-
};
|
|
62
|
-
/** @hidden */
|
|
63
|
-
setParent(parent) {
|
|
64
|
-
if (this.parent && this.parent !== parent) {
|
|
65
|
-
this.parent.removeChild(this);
|
|
66
|
-
}
|
|
67
|
-
this.parent = parent;
|
|
68
|
-
}
|
|
69
|
-
/** @hidden */
|
|
70
|
-
updateTree() {
|
|
71
|
-
if (this.parent) this.parent.updateTree();
|
|
72
|
-
}
|
|
73
|
-
/** @hidden */
|
|
74
|
-
handleMessage(message) {
|
|
75
|
-
console.log("Component Received Message:", message);
|
|
76
|
-
}
|
|
77
|
-
routeMessage(_idMap, _message) {
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
7
|
|
|
81
|
-
|
|
82
|
-
var Label = class extends Base {
|
|
83
|
-
constructor(props) {
|
|
84
|
-
super({ text: null }, props);
|
|
85
|
-
}
|
|
86
|
-
/** @hidden */
|
|
87
|
-
getProtoInfo(idMap) {
|
|
88
|
-
return {
|
|
89
|
-
component: "label",
|
|
90
|
-
key: idMap.getId(this),
|
|
91
|
-
bold: this.props.bold,
|
|
92
|
-
text: this.props.text ?? ""
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
setText(text) {
|
|
96
|
-
this.updateProps({
|
|
97
|
-
text
|
|
98
|
-
});
|
|
99
|
-
return this;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
-
0 && (module.exports = {
|
|
104
|
-
Label
|
|
105
|
-
});
|
|
8
|
+
exports.Label = _chunkP43QUQ4Tjs.Label;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '
|
|
1
|
+
import * as proto from '@arcanejs/protocol';
|
|
2
|
+
import { IDMap } from '../util/index.mjs';
|
|
3
|
+
import { Base } from './base.mjs';
|
|
3
4
|
|
|
4
5
|
type InternalProps = {
|
|
5
6
|
color: string;
|
|
@@ -13,7 +14,7 @@ type Props = Partial<InternalProps>;
|
|
|
13
14
|
declare class Rect extends Base<InternalProps> {
|
|
14
15
|
constructor(props?: Props);
|
|
15
16
|
/** @hidden */
|
|
16
|
-
getProtoInfo(idMap: IDMap): Component;
|
|
17
|
+
getProtoInfo(idMap: IDMap): proto.Component;
|
|
17
18
|
setColor(color: string): Rect;
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '
|
|
1
|
+
import * as proto from '@arcanejs/protocol';
|
|
2
|
+
import { IDMap } from '../util/index.js';
|
|
3
|
+
import { Base } from './base.js';
|
|
3
4
|
|
|
4
5
|
type InternalProps = {
|
|
5
6
|
color: string;
|
|
@@ -13,7 +14,7 @@ type Props = Partial<InternalProps>;
|
|
|
13
14
|
declare class Rect extends Base<InternalProps> {
|
|
14
15
|
constructor(props?: Props);
|
|
15
16
|
/** @hidden */
|
|
16
|
-
getProtoInfo(idMap: IDMap): Component;
|
|
17
|
+
getProtoInfo(idMap: IDMap): proto.Component;
|
|
17
18
|
setColor(color: string): Rect;
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -1,105 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Rect: () => Rect
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(rect_exports);
|
|
3
|
+
var _chunkRGIB65TIjs = require('../../chunk-RGIB65TI.js');
|
|
4
|
+
require('../../chunk-UBWCVW2U.js');
|
|
5
|
+
require('../../chunk-3RG5ZIWI.js');
|
|
26
6
|
|
|
27
|
-
// src/backend/components/base.ts
|
|
28
|
-
var Base = class {
|
|
29
|
-
/** @hidden */
|
|
30
|
-
parent = null;
|
|
31
|
-
/** @hidden */
|
|
32
|
-
defaultProps;
|
|
33
|
-
/** @hidden */
|
|
34
|
-
_props;
|
|
35
|
-
constructor(defaultProps, props) {
|
|
36
|
-
this.defaultProps = defaultProps;
|
|
37
|
-
this._props = Object.freeze({
|
|
38
|
-
...defaultProps,
|
|
39
|
-
...props
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
get props() {
|
|
43
|
-
return this._props;
|
|
44
|
-
}
|
|
45
|
-
set props(props) {
|
|
46
|
-
this.setProps(props);
|
|
47
|
-
}
|
|
48
|
-
setProps = (props) => {
|
|
49
|
-
this._props = Object.freeze({
|
|
50
|
-
...this.defaultProps,
|
|
51
|
-
...props
|
|
52
|
-
});
|
|
53
|
-
this.updateTree();
|
|
54
|
-
};
|
|
55
|
-
updateProps = (updates) => {
|
|
56
|
-
this._props = Object.freeze({
|
|
57
|
-
...this._props,
|
|
58
|
-
...updates
|
|
59
|
-
});
|
|
60
|
-
this.updateTree();
|
|
61
|
-
};
|
|
62
|
-
/** @hidden */
|
|
63
|
-
setParent(parent) {
|
|
64
|
-
if (this.parent && this.parent !== parent) {
|
|
65
|
-
this.parent.removeChild(this);
|
|
66
|
-
}
|
|
67
|
-
this.parent = parent;
|
|
68
|
-
}
|
|
69
|
-
/** @hidden */
|
|
70
|
-
updateTree() {
|
|
71
|
-
if (this.parent) this.parent.updateTree();
|
|
72
|
-
}
|
|
73
|
-
/** @hidden */
|
|
74
|
-
handleMessage(message) {
|
|
75
|
-
console.log("Component Received Message:", message);
|
|
76
|
-
}
|
|
77
|
-
routeMessage(_idMap, _message) {
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
7
|
|
|
81
|
-
|
|
82
|
-
var DEFAULT_PROPS = {
|
|
83
|
-
color: "rgba(0, 0, 0, 0)"
|
|
84
|
-
};
|
|
85
|
-
var Rect = class extends Base {
|
|
86
|
-
constructor(props) {
|
|
87
|
-
super(DEFAULT_PROPS, props);
|
|
88
|
-
}
|
|
89
|
-
/** @hidden */
|
|
90
|
-
getProtoInfo(idMap) {
|
|
91
|
-
return {
|
|
92
|
-
component: "rect",
|
|
93
|
-
key: idMap.getId(this),
|
|
94
|
-
color: this.props.color
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
setColor(color) {
|
|
98
|
-
this.updateProps({ color });
|
|
99
|
-
return this;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
-
0 && (module.exports = {
|
|
104
|
-
Rect
|
|
105
|
-
});
|
|
8
|
+
exports.Rect = _chunkRGIB65TIjs.Rect;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '
|
|
1
|
+
import * as proto from '@arcanejs/protocol';
|
|
2
|
+
import { IDMap } from '../util/index.mjs';
|
|
3
|
+
import { Base, Listenable } from './base.mjs';
|
|
3
4
|
|
|
4
5
|
type Events = {
|
|
5
6
|
change: (value: number) => void | Promise<void>;
|
|
@@ -21,9 +22,9 @@ declare class SliderButton extends Base<InternalProps> implements Listenable<Eve
|
|
|
21
22
|
addListener: <T extends "change">(type: T, listener: Events[T]) => void;
|
|
22
23
|
removeListener: <T extends "change">(type: T, listener: Events[T]) => void;
|
|
23
24
|
/** @hidden */
|
|
24
|
-
getProtoInfo(idMap: IDMap): Component;
|
|
25
|
+
getProtoInfo(idMap: IDMap): proto.Component;
|
|
25
26
|
/** @hidden */
|
|
26
|
-
handleMessage(message: ClientComponentMessage): void;
|
|
27
|
+
handleMessage(message: proto.ClientComponentMessage): void;
|
|
27
28
|
setValue(value: number): void;
|
|
28
29
|
private sanitizeNumber;
|
|
29
30
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '
|
|
1
|
+
import * as proto from '@arcanejs/protocol';
|
|
2
|
+
import { IDMap } from '../util/index.js';
|
|
3
|
+
import { Base, Listenable } from './base.js';
|
|
3
4
|
|
|
4
5
|
type Events = {
|
|
5
6
|
change: (value: number) => void | Promise<void>;
|
|
@@ -21,9 +22,9 @@ declare class SliderButton extends Base<InternalProps> implements Listenable<Eve
|
|
|
21
22
|
addListener: <T extends "change">(type: T, listener: Events[T]) => void;
|
|
22
23
|
removeListener: <T extends "change">(type: T, listener: Events[T]) => void;
|
|
23
24
|
/** @hidden */
|
|
24
|
-
getProtoInfo(idMap: IDMap): Component;
|
|
25
|
+
getProtoInfo(idMap: IDMap): proto.Component;
|
|
25
26
|
/** @hidden */
|
|
26
|
-
handleMessage(message: ClientComponentMessage): void;
|
|
27
|
+
handleMessage(message: proto.ClientComponentMessage): void;
|
|
27
28
|
setValue(value: number): void;
|
|
28
29
|
private sanitizeNumber;
|
|
29
30
|
}
|