@arcanejs/toolkit 0.0.2 → 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.
- package/dist/backend/components/base.d.mts +2 -0
- package/dist/backend/components/base.d.ts +2 -0
- package/dist/backend/components/base.js +189 -0
- package/dist/backend/components/base.mjs +10 -0
- package/dist/backend/components/button.d.mts +30 -0
- package/dist/backend/components/button.d.ts +30 -0
- package/dist/backend/components/button.js +168 -0
- package/dist/backend/components/button.mjs +7 -0
- package/dist/backend/components/group.d.mts +51 -0
- package/dist/backend/components/group.d.ts +51 -0
- package/dist/backend/components/group.js +287 -0
- package/dist/backend/components/group.mjs +9 -0
- package/dist/backend/components/label.d.mts +21 -0
- package/dist/backend/components/label.d.ts +21 -0
- package/dist/backend/components/label.js +105 -0
- package/dist/backend/components/label.mjs +7 -0
- package/dist/backend/components/rect.d.mts +20 -0
- package/dist/backend/components/rect.d.ts +20 -0
- package/dist/backend/components/rect.js +105 -0
- package/dist/backend/components/rect.mjs +7 -0
- package/dist/backend/components/slider-button.d.mts +31 -0
- package/dist/backend/components/slider-button.d.ts +31 -0
- package/dist/backend/components/slider-button.js +161 -0
- package/dist/backend/components/slider-button.mjs +7 -0
- package/dist/backend/components/switch.d.mts +24 -0
- package/dist/backend/components/switch.d.ts +24 -0
- package/dist/backend/components/switch.js +144 -0
- package/dist/backend/components/switch.mjs +7 -0
- package/dist/backend/components/tabs.d.mts +28 -0
- package/dist/backend/components/tabs.d.ts +28 -0
- package/dist/backend/components/tabs.js +209 -0
- package/dist/backend/components/tabs.mjs +9 -0
- package/dist/backend/components/text-input.d.mts +26 -0
- package/dist/backend/components/text-input.d.ts +26 -0
- package/dist/backend/components/text-input.js +146 -0
- package/dist/backend/components/text-input.mjs +7 -0
- package/dist/backend/components/timeline.d.mts +17 -0
- package/dist/backend/components/timeline.d.ts +17 -0
- package/dist/backend/components/timeline.js +109 -0
- package/dist/backend/components/timeline.mjs +7 -0
- package/dist/base-BJAPu0O1.d.mts +234 -0
- package/dist/base-BJAPu0O1.d.ts +234 -0
- package/dist/chunk-37VNFO5S.mjs +42 -0
- package/dist/chunk-3ZBM7Q4A.mjs +55 -0
- package/dist/chunk-6LL3X7ZZ.mjs +44 -0
- package/dist/chunk-DBW4OPGN.mjs +33 -0
- package/dist/chunk-DP3QFYSS.mjs +66 -0
- package/dist/chunk-GQZA5K4M.mjs +29 -0
- package/dist/chunk-HF77PS7J.mjs +171 -0
- package/dist/chunk-HVFTRNLQ.mjs +59 -0
- package/dist/chunk-P6X5GIDT.mjs +29 -0
- package/dist/chunk-S5DQIYC2.mjs +107 -0
- package/dist/frontend.js +26321 -0
- package/dist/frontend.js.map +7 -0
- package/dist/index.d.mts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +852 -1
- package/dist/index.mjs +288 -2
- package/package.json +86 -6
|
@@ -0,0 +1,287 @@
|
|
|
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);
|
|
19
|
+
|
|
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
|
+
|
|
28
|
+
// src/shared/styles.ts
|
|
29
|
+
var GROUP_DEFAULT_STYLE = {
|
|
30
|
+
direction: "horizontal"
|
|
31
|
+
};
|
|
32
|
+
|
|
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
|
+
|
|
191
|
+
// src/backend/components/group.ts
|
|
192
|
+
var DEFAULT_PROPS = {
|
|
193
|
+
...GROUP_DEFAULT_STYLE,
|
|
194
|
+
title: null,
|
|
195
|
+
labels: null,
|
|
196
|
+
headerComponents: null
|
|
197
|
+
};
|
|
198
|
+
var GroupHeader = class extends BaseParent {
|
|
199
|
+
validateChildren = () => {
|
|
200
|
+
};
|
|
201
|
+
/** @hidden */
|
|
202
|
+
getProtoInfo = (idMap) => ({
|
|
203
|
+
component: "group-header",
|
|
204
|
+
key: idMap.getId(this),
|
|
205
|
+
children: this.getChildren().map((c) => c.getProtoInfo(idMap))
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
var Group = class extends BaseParent {
|
|
209
|
+
/** @hidden */
|
|
210
|
+
events = new EventEmitter();
|
|
211
|
+
constructor(props) {
|
|
212
|
+
super(DEFAULT_PROPS, props);
|
|
213
|
+
}
|
|
214
|
+
addListener = this.events.addListener;
|
|
215
|
+
removeListener = this.events.removeListener;
|
|
216
|
+
validateChildren = () => {
|
|
217
|
+
};
|
|
218
|
+
setOptions = (options) => {
|
|
219
|
+
this.updateProps(options);
|
|
220
|
+
};
|
|
221
|
+
setTitle = (title) => {
|
|
222
|
+
this.updateProps({ title });
|
|
223
|
+
};
|
|
224
|
+
addLabel = (label) => {
|
|
225
|
+
this.updateProps({ labels: [...this.props.labels || [], label] });
|
|
226
|
+
};
|
|
227
|
+
setLabels = (labels) => {
|
|
228
|
+
this.updateProps({ labels });
|
|
229
|
+
};
|
|
230
|
+
addHeaderChild = (child) => {
|
|
231
|
+
const header = new GroupHeader({});
|
|
232
|
+
header.appendChild(child);
|
|
233
|
+
this.appendChild(header);
|
|
234
|
+
return child;
|
|
235
|
+
};
|
|
236
|
+
removeHeaderChild = (child) => {
|
|
237
|
+
for (const c of this.getChildren()) {
|
|
238
|
+
if (c instanceof GroupHeader) {
|
|
239
|
+
c.removeChild(child);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
removeAllHeaderChildren = () => {
|
|
244
|
+
for (const child of this.getChildren()) {
|
|
245
|
+
if (child instanceof GroupHeader) {
|
|
246
|
+
child.removeAllChildren();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
/** @hidden */
|
|
251
|
+
getProtoInfo = (idMap) => {
|
|
252
|
+
const children = [];
|
|
253
|
+
const headers = [];
|
|
254
|
+
for (const c of this.getChildren()) {
|
|
255
|
+
const childProto = c.getProtoInfo(idMap);
|
|
256
|
+
if (childProto.component === "group-header") {
|
|
257
|
+
headers.push(childProto);
|
|
258
|
+
} else {
|
|
259
|
+
children.push(childProto);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
component: "group",
|
|
264
|
+
key: idMap.getId(this),
|
|
265
|
+
title: this.props.title ?? void 0,
|
|
266
|
+
direction: this.props.direction,
|
|
267
|
+
border: this.props.border,
|
|
268
|
+
wrap: this.props.wrap,
|
|
269
|
+
children,
|
|
270
|
+
headers: headers.length > 0 ? headers : void 0,
|
|
271
|
+
labels: this.props.labels ?? void 0,
|
|
272
|
+
editableTitle: this.props.editableTitle || false,
|
|
273
|
+
defaultCollapsibleState: this.props.defaultCollapsibleState
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
/** @hidden */
|
|
277
|
+
handleMessage = (message) => {
|
|
278
|
+
if (message.component === "group") {
|
|
279
|
+
this.events.emit("title-changed", message.title);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
284
|
+
0 && (module.exports = {
|
|
285
|
+
Group,
|
|
286
|
+
GroupHeader
|
|
287
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { e as Base, I as IDMap, g as Component, h as LabelComponentStyle } from '../../base-BJAPu0O1.mjs';
|
|
2
|
+
import '@arcanejs/diff';
|
|
3
|
+
|
|
4
|
+
type InternalProps = LabelComponentStyle & {
|
|
5
|
+
text: string | null;
|
|
6
|
+
};
|
|
7
|
+
type Props = InternalProps;
|
|
8
|
+
/**
|
|
9
|
+
* A simple text component. Could be used to label components in a desk, or for
|
|
10
|
+
* more dynamic purposes such as displaying the status of something.
|
|
11
|
+
*
|
|
12
|
+
* 
|
|
13
|
+
*/
|
|
14
|
+
declare class Label extends Base<InternalProps> {
|
|
15
|
+
constructor(props?: Props);
|
|
16
|
+
/** @hidden */
|
|
17
|
+
getProtoInfo(idMap: IDMap): Component;
|
|
18
|
+
setText(text: string): Label;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Label, type Props };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { e as Base, I as IDMap, g as Component, h as LabelComponentStyle } from '../../base-BJAPu0O1.js';
|
|
2
|
+
import '@arcanejs/diff';
|
|
3
|
+
|
|
4
|
+
type InternalProps = LabelComponentStyle & {
|
|
5
|
+
text: string | null;
|
|
6
|
+
};
|
|
7
|
+
type Props = InternalProps;
|
|
8
|
+
/**
|
|
9
|
+
* A simple text component. Could be used to label components in a desk, or for
|
|
10
|
+
* more dynamic purposes such as displaying the status of something.
|
|
11
|
+
*
|
|
12
|
+
* 
|
|
13
|
+
*/
|
|
14
|
+
declare class Label extends Base<InternalProps> {
|
|
15
|
+
constructor(props?: Props);
|
|
16
|
+
/** @hidden */
|
|
17
|
+
getProtoInfo(idMap: IDMap): Component;
|
|
18
|
+
setText(text: string): Label;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Label, type Props };
|
|
@@ -0,0 +1,105 @@
|
|
|
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);
|
|
19
|
+
|
|
20
|
+
// src/backend/components/label.ts
|
|
21
|
+
var label_exports = {};
|
|
22
|
+
__export(label_exports, {
|
|
23
|
+
Label: () => Label
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(label_exports);
|
|
26
|
+
|
|
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
|
+
|
|
81
|
+
// src/backend/components/label.ts
|
|
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
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { e as Base, I as IDMap, g as Component } from '../../base-BJAPu0O1.mjs';
|
|
2
|
+
import '@arcanejs/diff';
|
|
3
|
+
|
|
4
|
+
type InternalProps = {
|
|
5
|
+
color: string;
|
|
6
|
+
};
|
|
7
|
+
type Props = Partial<InternalProps>;
|
|
8
|
+
/**
|
|
9
|
+
* A simple rectangle component. Could be used for example to indicate
|
|
10
|
+
* certain states, or represent the color of certain lights or fixtures,
|
|
11
|
+
* or perhaps colors used in a chase.
|
|
12
|
+
*/
|
|
13
|
+
declare class Rect extends Base<InternalProps> {
|
|
14
|
+
constructor(props?: Props);
|
|
15
|
+
/** @hidden */
|
|
16
|
+
getProtoInfo(idMap: IDMap): Component;
|
|
17
|
+
setColor(color: string): Rect;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { type Props, Rect };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { e as Base, I as IDMap, g as Component } from '../../base-BJAPu0O1.js';
|
|
2
|
+
import '@arcanejs/diff';
|
|
3
|
+
|
|
4
|
+
type InternalProps = {
|
|
5
|
+
color: string;
|
|
6
|
+
};
|
|
7
|
+
type Props = Partial<InternalProps>;
|
|
8
|
+
/**
|
|
9
|
+
* A simple rectangle component. Could be used for example to indicate
|
|
10
|
+
* certain states, or represent the color of certain lights or fixtures,
|
|
11
|
+
* or perhaps colors used in a chase.
|
|
12
|
+
*/
|
|
13
|
+
declare class Rect extends Base<InternalProps> {
|
|
14
|
+
constructor(props?: Props);
|
|
15
|
+
/** @hidden */
|
|
16
|
+
getProtoInfo(idMap: IDMap): Component;
|
|
17
|
+
setColor(color: string): Rect;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { type Props, Rect };
|
|
@@ -0,0 +1,105 @@
|
|
|
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);
|
|
19
|
+
|
|
20
|
+
// src/backend/components/rect.ts
|
|
21
|
+
var rect_exports = {};
|
|
22
|
+
__export(rect_exports, {
|
|
23
|
+
Rect: () => Rect
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(rect_exports);
|
|
26
|
+
|
|
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
|
+
|
|
81
|
+
// src/backend/components/rect.ts
|
|
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
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { e as Base, L as Listenable, I as IDMap, g as Component, d as ClientComponentMessage } from '../../base-BJAPu0O1.mjs';
|
|
2
|
+
import '@arcanejs/diff';
|
|
3
|
+
|
|
4
|
+
type Events = {
|
|
5
|
+
change: (value: number) => void | Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
type SliderMode = 'writeThrough' | 'writeBack';
|
|
8
|
+
type InternalProps = {
|
|
9
|
+
min: number;
|
|
10
|
+
max: number;
|
|
11
|
+
step: number;
|
|
12
|
+
value: number | null;
|
|
13
|
+
mode: SliderMode;
|
|
14
|
+
};
|
|
15
|
+
type RequiredProps = 'value';
|
|
16
|
+
type Props = Pick<InternalProps, RequiredProps> & Partial<Omit<InternalProps, RequiredProps>>;
|
|
17
|
+
declare class SliderButton extends Base<InternalProps> implements Listenable<Events> {
|
|
18
|
+
/** @hidden */
|
|
19
|
+
private readonly events;
|
|
20
|
+
constructor(props?: Props);
|
|
21
|
+
addListener: <T extends "change">(type: T, listener: Events[T]) => void;
|
|
22
|
+
removeListener: <T extends "change">(type: T, listener: Events[T]) => void;
|
|
23
|
+
/** @hidden */
|
|
24
|
+
getProtoInfo(idMap: IDMap): Component;
|
|
25
|
+
/** @hidden */
|
|
26
|
+
handleMessage(message: ClientComponentMessage): void;
|
|
27
|
+
setValue(value: number): void;
|
|
28
|
+
private sanitizeNumber;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { type Events, type Props, SliderButton, type SliderMode };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { e as Base, L as Listenable, I as IDMap, g as Component, d as ClientComponentMessage } from '../../base-BJAPu0O1.js';
|
|
2
|
+
import '@arcanejs/diff';
|
|
3
|
+
|
|
4
|
+
type Events = {
|
|
5
|
+
change: (value: number) => void | Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
type SliderMode = 'writeThrough' | 'writeBack';
|
|
8
|
+
type InternalProps = {
|
|
9
|
+
min: number;
|
|
10
|
+
max: number;
|
|
11
|
+
step: number;
|
|
12
|
+
value: number | null;
|
|
13
|
+
mode: SliderMode;
|
|
14
|
+
};
|
|
15
|
+
type RequiredProps = 'value';
|
|
16
|
+
type Props = Pick<InternalProps, RequiredProps> & Partial<Omit<InternalProps, RequiredProps>>;
|
|
17
|
+
declare class SliderButton extends Base<InternalProps> implements Listenable<Events> {
|
|
18
|
+
/** @hidden */
|
|
19
|
+
private readonly events;
|
|
20
|
+
constructor(props?: Props);
|
|
21
|
+
addListener: <T extends "change">(type: T, listener: Events[T]) => void;
|
|
22
|
+
removeListener: <T extends "change">(type: T, listener: Events[T]) => void;
|
|
23
|
+
/** @hidden */
|
|
24
|
+
getProtoInfo(idMap: IDMap): Component;
|
|
25
|
+
/** @hidden */
|
|
26
|
+
handleMessage(message: ClientComponentMessage): void;
|
|
27
|
+
setValue(value: number): void;
|
|
28
|
+
private sanitizeNumber;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { type Events, type Props, SliderButton, type SliderMode };
|