@arcanejs/toolkit 0.0.3 → 0.1.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.
- package/README.md +19 -0
- 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 +84 -4
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# `@arcanejs/toolkit`
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@arcanejs/toolkit)
|
|
4
|
+
|
|
5
|
+
This package provides the core functionality behind the ArcaneJS framework,
|
|
6
|
+
allowing you to quickly build single-process Node.js apps with
|
|
7
|
+
real-time interactive control panels that are exposed as web pages.
|
|
8
|
+
|
|
9
|
+
This library provides a tree-like API for creating & updating control panels,
|
|
10
|
+
and responding to user input.
|
|
11
|
+
|
|
12
|
+
We highly-recommend that rather than integrating with this library directly,
|
|
13
|
+
you make use of the
|
|
14
|
+
[`@arcanejs/react-toolkit`](https://www.npmjs.com/package/@arcanejs/react-toolkit)
|
|
15
|
+
library, that allows you to compose your control panels using server-side react.
|
|
16
|
+
|
|
17
|
+
For more details,
|
|
18
|
+
please see the main documentation on our GitHub repository:
|
|
19
|
+
[github.com/arcanejs/arcanejs](https://github.com/arcanejs/arcanejs#arcanejs)
|
|
@@ -0,0 +1,189 @@
|
|
|
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/base.ts
|
|
21
|
+
var base_exports = {};
|
|
22
|
+
__export(base_exports, {
|
|
23
|
+
Base: () => Base,
|
|
24
|
+
BaseParent: () => BaseParent,
|
|
25
|
+
EventEmitter: () => EventEmitter
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(base_exports);
|
|
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
|
+
var BaseParent = class extends Base {
|
|
81
|
+
/** @hidden */
|
|
82
|
+
children = [];
|
|
83
|
+
appendChildren = (...children) => {
|
|
84
|
+
for (const c of children) {
|
|
85
|
+
const newChildren = [...this.children.filter((ch) => ch !== c), c];
|
|
86
|
+
this.validateChildren(newChildren);
|
|
87
|
+
this.children = Object.freeze(newChildren);
|
|
88
|
+
c.setParent(this);
|
|
89
|
+
}
|
|
90
|
+
this.updateTree();
|
|
91
|
+
return children;
|
|
92
|
+
};
|
|
93
|
+
appendChild = (child) => {
|
|
94
|
+
this.appendChildren(child);
|
|
95
|
+
return child;
|
|
96
|
+
};
|
|
97
|
+
removeChild = (component) => {
|
|
98
|
+
const match = this.children.findIndex((c) => c === component);
|
|
99
|
+
if (match >= 0) {
|
|
100
|
+
const removingChild = this.children[match];
|
|
101
|
+
const newChildren = [
|
|
102
|
+
...this.children.slice(0, match),
|
|
103
|
+
...this.children.slice(match + 1)
|
|
104
|
+
];
|
|
105
|
+
this.validateChildren(newChildren);
|
|
106
|
+
this.children = Object.freeze(newChildren);
|
|
107
|
+
removingChild?.setParent(null);
|
|
108
|
+
this.updateTree();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
removeAllChildren = () => {
|
|
112
|
+
this.children.map((c) => c.setParent(null));
|
|
113
|
+
this.children = Object.freeze([]);
|
|
114
|
+
this.updateTree();
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Return all children components that messages need to be routed to
|
|
118
|
+
*/
|
|
119
|
+
getChildren = () => this.children;
|
|
120
|
+
/**
|
|
121
|
+
* TODO: we can do this better, right now it broadcasts the message to all
|
|
122
|
+
* components of the tree
|
|
123
|
+
*
|
|
124
|
+
* @hidden
|
|
125
|
+
*/
|
|
126
|
+
routeMessage(idMap, message) {
|
|
127
|
+
if (idMap.getId(this) === message.componentKey) {
|
|
128
|
+
this.handleMessage(message);
|
|
129
|
+
} else {
|
|
130
|
+
for (const c of this.children) {
|
|
131
|
+
if (idMap.getId(c) === message.componentKey) {
|
|
132
|
+
c.handleMessage(message);
|
|
133
|
+
} else {
|
|
134
|
+
c.routeMessage(idMap, message);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
insertBefore(child, beforeChild) {
|
|
140
|
+
const filteredChildren = this.children.filter((c) => c !== child);
|
|
141
|
+
let match = filteredChildren.findIndex((c) => c === beforeChild);
|
|
142
|
+
console.log("match", match);
|
|
143
|
+
if (match === -1) {
|
|
144
|
+
match = filteredChildren.length;
|
|
145
|
+
}
|
|
146
|
+
const newChildren = [
|
|
147
|
+
...filteredChildren.slice(0, match),
|
|
148
|
+
child,
|
|
149
|
+
...filteredChildren.slice(match)
|
|
150
|
+
];
|
|
151
|
+
this.validateChildren(newChildren);
|
|
152
|
+
this.children = Object.freeze(newChildren);
|
|
153
|
+
child.setParent(this);
|
|
154
|
+
this.updateTree();
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var EventEmitter = class {
|
|
158
|
+
listeners = /* @__PURE__ */ new Map();
|
|
159
|
+
addListener = (type, listener) => {
|
|
160
|
+
let set = this.listeners.get(type);
|
|
161
|
+
if (!set) {
|
|
162
|
+
set = /* @__PURE__ */ new Set();
|
|
163
|
+
this.listeners.set(type, set);
|
|
164
|
+
}
|
|
165
|
+
set.add(listener);
|
|
166
|
+
};
|
|
167
|
+
removeListener = (type, listener) => {
|
|
168
|
+
this.listeners.get(type)?.delete(listener);
|
|
169
|
+
};
|
|
170
|
+
emit = (type, ...args) => {
|
|
171
|
+
return Promise.all(
|
|
172
|
+
[...this.listeners.get(type) || []].map(
|
|
173
|
+
(l) => new Promise((resolve, reject) => {
|
|
174
|
+
try {
|
|
175
|
+
resolve(l(...args));
|
|
176
|
+
} catch (e) {
|
|
177
|
+
reject(e);
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
)
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
185
|
+
0 && (module.exports = {
|
|
186
|
+
Base,
|
|
187
|
+
BaseParent,
|
|
188
|
+
EventEmitter
|
|
189
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { e as Base, L as Listenable, I as IDMap, f as ButtonComponent, d as ClientComponentMessage } from '../../base-BJAPu0O1.mjs';
|
|
2
|
+
import '@arcanejs/diff';
|
|
3
|
+
|
|
4
|
+
type Events = {
|
|
5
|
+
click: () => void | Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
type ButtonMode = 'normal' | 'pressed';
|
|
8
|
+
type InternalProps = {
|
|
9
|
+
text: string | null;
|
|
10
|
+
icon: string | null;
|
|
11
|
+
mode: ButtonMode;
|
|
12
|
+
error: string | null;
|
|
13
|
+
};
|
|
14
|
+
type Props = Partial<InternalProps>;
|
|
15
|
+
declare class Button extends Base<InternalProps> implements Listenable<Events> {
|
|
16
|
+
/** @hidden */
|
|
17
|
+
private readonly events;
|
|
18
|
+
constructor(props?: Props);
|
|
19
|
+
addListener: <T extends "click">(type: T, listener: Events[T]) => void;
|
|
20
|
+
removeListener: <T extends "click">(type: T, listener: Events[T]) => void;
|
|
21
|
+
setText: (text: string | null) => this;
|
|
22
|
+
setIcon: (icon: string | undefined | null) => this;
|
|
23
|
+
setMode: (mode: ButtonMode) => this;
|
|
24
|
+
/** @hidden */
|
|
25
|
+
getProtoInfo: (idMap: IDMap) => ButtonComponent;
|
|
26
|
+
/** @hidden */
|
|
27
|
+
handleMessage: (message: ClientComponentMessage) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Button, type ButtonMode, type Events, type InternalProps, type Props };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { e as Base, L as Listenable, I as IDMap, f as ButtonComponent, d as ClientComponentMessage } from '../../base-BJAPu0O1.js';
|
|
2
|
+
import '@arcanejs/diff';
|
|
3
|
+
|
|
4
|
+
type Events = {
|
|
5
|
+
click: () => void | Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
type ButtonMode = 'normal' | 'pressed';
|
|
8
|
+
type InternalProps = {
|
|
9
|
+
text: string | null;
|
|
10
|
+
icon: string | null;
|
|
11
|
+
mode: ButtonMode;
|
|
12
|
+
error: string | null;
|
|
13
|
+
};
|
|
14
|
+
type Props = Partial<InternalProps>;
|
|
15
|
+
declare class Button extends Base<InternalProps> implements Listenable<Events> {
|
|
16
|
+
/** @hidden */
|
|
17
|
+
private readonly events;
|
|
18
|
+
constructor(props?: Props);
|
|
19
|
+
addListener: <T extends "click">(type: T, listener: Events[T]) => void;
|
|
20
|
+
removeListener: <T extends "click">(type: T, listener: Events[T]) => void;
|
|
21
|
+
setText: (text: string | null) => this;
|
|
22
|
+
setIcon: (icon: string | undefined | null) => this;
|
|
23
|
+
setMode: (mode: ButtonMode) => this;
|
|
24
|
+
/** @hidden */
|
|
25
|
+
getProtoInfo: (idMap: IDMap) => ButtonComponent;
|
|
26
|
+
/** @hidden */
|
|
27
|
+
handleMessage: (message: ClientComponentMessage) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Button, type ButtonMode, type Events, type InternalProps, type Props };
|
|
@@ -0,0 +1,168 @@
|
|
|
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/button.ts
|
|
21
|
+
var button_exports = {};
|
|
22
|
+
__export(button_exports, {
|
|
23
|
+
Button: () => Button
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(button_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
|
+
var EventEmitter = class {
|
|
81
|
+
listeners = /* @__PURE__ */ new Map();
|
|
82
|
+
addListener = (type, listener) => {
|
|
83
|
+
let set = this.listeners.get(type);
|
|
84
|
+
if (!set) {
|
|
85
|
+
set = /* @__PURE__ */ new Set();
|
|
86
|
+
this.listeners.set(type, set);
|
|
87
|
+
}
|
|
88
|
+
set.add(listener);
|
|
89
|
+
};
|
|
90
|
+
removeListener = (type, listener) => {
|
|
91
|
+
this.listeners.get(type)?.delete(listener);
|
|
92
|
+
};
|
|
93
|
+
emit = (type, ...args) => {
|
|
94
|
+
return Promise.all(
|
|
95
|
+
[...this.listeners.get(type) || []].map(
|
|
96
|
+
(l) => new Promise((resolve, reject) => {
|
|
97
|
+
try {
|
|
98
|
+
resolve(l(...args));
|
|
99
|
+
} catch (e) {
|
|
100
|
+
reject(e);
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
)
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// src/backend/components/button.ts
|
|
109
|
+
var DEFAULT_PROPS = {
|
|
110
|
+
text: null,
|
|
111
|
+
icon: null,
|
|
112
|
+
mode: "normal",
|
|
113
|
+
error: null
|
|
114
|
+
};
|
|
115
|
+
var Button = class extends Base {
|
|
116
|
+
/** @hidden */
|
|
117
|
+
events = new EventEmitter();
|
|
118
|
+
constructor(props) {
|
|
119
|
+
super(DEFAULT_PROPS, props);
|
|
120
|
+
}
|
|
121
|
+
addListener = this.events.addListener;
|
|
122
|
+
removeListener = this.events.removeListener;
|
|
123
|
+
setText = (text) => {
|
|
124
|
+
this.updateProps({ text });
|
|
125
|
+
return this;
|
|
126
|
+
};
|
|
127
|
+
setIcon = (icon) => {
|
|
128
|
+
this.updateProps({ icon: icon ?? null });
|
|
129
|
+
return this;
|
|
130
|
+
};
|
|
131
|
+
setMode = (mode) => {
|
|
132
|
+
this.updateProps({
|
|
133
|
+
mode,
|
|
134
|
+
error: null
|
|
135
|
+
});
|
|
136
|
+
return this;
|
|
137
|
+
};
|
|
138
|
+
/** @hidden */
|
|
139
|
+
getProtoInfo = (idMap) => {
|
|
140
|
+
return {
|
|
141
|
+
component: "button",
|
|
142
|
+
key: idMap.getId(this),
|
|
143
|
+
text: this.props.text || "",
|
|
144
|
+
state: this.props.error ? { state: "error", error: this.props.error } : { state: this.props.mode },
|
|
145
|
+
icon: this.props.icon ?? void 0
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
/** @hidden */
|
|
149
|
+
handleMessage = (message) => {
|
|
150
|
+
if (message.component === "button") {
|
|
151
|
+
this.events.emit("click").then(() => {
|
|
152
|
+
if (this.props.error) {
|
|
153
|
+
this.updateProps({
|
|
154
|
+
error: null
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}).catch((e) => {
|
|
158
|
+
this.updateProps({
|
|
159
|
+
error: `${e}`
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
166
|
+
0 && (module.exports = {
|
|
167
|
+
Button
|
|
168
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { G as GroupComponentStyle, a as Component, B as BaseParent, I as IDMap, b as GroupHeaderComponent, L as Listenable, c as GroupComponent, d as ClientComponentMessage } from '../../base-BJAPu0O1.mjs';
|
|
2
|
+
import { Button } from './button.mjs';
|
|
3
|
+
import '@arcanejs/diff';
|
|
4
|
+
|
|
5
|
+
type Label = (GroupComponent['labels'] & Array<unknown>)[number];
|
|
6
|
+
type GroupOptions = {
|
|
7
|
+
editableTitle?: boolean;
|
|
8
|
+
defaultCollapsibleState?: GroupComponent['defaultCollapsibleState'];
|
|
9
|
+
};
|
|
10
|
+
type Events = {
|
|
11
|
+
'title-changed': (title: string) => void;
|
|
12
|
+
};
|
|
13
|
+
type InternalProps = GroupComponentStyle & GroupOptions & {
|
|
14
|
+
title: string | null;
|
|
15
|
+
labels: Label[] | null;
|
|
16
|
+
headerComponents: Component[] | null;
|
|
17
|
+
};
|
|
18
|
+
type Props = Partial<InternalProps>;
|
|
19
|
+
declare class GroupHeader extends BaseParent<Record<never, never>> {
|
|
20
|
+
validateChildren: () => void;
|
|
21
|
+
/** @hidden */
|
|
22
|
+
getProtoInfo: (idMap: IDMap) => GroupHeaderComponent;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A collection of components, grouped in either a row or column. Can contain
|
|
26
|
+
* further groups as children to organize components however you wish, and have
|
|
27
|
+
* a number of styling options (such as removing the border).
|
|
28
|
+
*
|
|
29
|
+
* 
|
|
30
|
+
*/
|
|
31
|
+
declare class Group extends BaseParent<InternalProps> implements Listenable<Events> {
|
|
32
|
+
/** @hidden */
|
|
33
|
+
private readonly events;
|
|
34
|
+
constructor(props?: Props);
|
|
35
|
+
addListener: <T extends "title-changed">(type: T, listener: Events[T]) => void;
|
|
36
|
+
removeListener: <T extends "title-changed">(type: T, listener: Events[T]) => void;
|
|
37
|
+
validateChildren: () => void;
|
|
38
|
+
setOptions: (options: GroupOptions) => void;
|
|
39
|
+
setTitle: (title: string) => void;
|
|
40
|
+
addLabel: (label: Label) => void;
|
|
41
|
+
setLabels: (labels: Label[]) => void;
|
|
42
|
+
addHeaderChild: <C extends Button>(child: C) => C;
|
|
43
|
+
removeHeaderChild: (child: Button) => void;
|
|
44
|
+
removeAllHeaderChildren: () => void;
|
|
45
|
+
/** @hidden */
|
|
46
|
+
getProtoInfo: (idMap: IDMap) => GroupComponent;
|
|
47
|
+
/** @hidden */
|
|
48
|
+
handleMessage: (message: ClientComponentMessage) => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { type Events, Group, GroupHeader, type InternalProps, type Props };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { G as GroupComponentStyle, a as Component, B as BaseParent, I as IDMap, b as GroupHeaderComponent, L as Listenable, c as GroupComponent, d as ClientComponentMessage } from '../../base-BJAPu0O1.js';
|
|
2
|
+
import { Button } from './button.js';
|
|
3
|
+
import '@arcanejs/diff';
|
|
4
|
+
|
|
5
|
+
type Label = (GroupComponent['labels'] & Array<unknown>)[number];
|
|
6
|
+
type GroupOptions = {
|
|
7
|
+
editableTitle?: boolean;
|
|
8
|
+
defaultCollapsibleState?: GroupComponent['defaultCollapsibleState'];
|
|
9
|
+
};
|
|
10
|
+
type Events = {
|
|
11
|
+
'title-changed': (title: string) => void;
|
|
12
|
+
};
|
|
13
|
+
type InternalProps = GroupComponentStyle & GroupOptions & {
|
|
14
|
+
title: string | null;
|
|
15
|
+
labels: Label[] | null;
|
|
16
|
+
headerComponents: Component[] | null;
|
|
17
|
+
};
|
|
18
|
+
type Props = Partial<InternalProps>;
|
|
19
|
+
declare class GroupHeader extends BaseParent<Record<never, never>> {
|
|
20
|
+
validateChildren: () => void;
|
|
21
|
+
/** @hidden */
|
|
22
|
+
getProtoInfo: (idMap: IDMap) => GroupHeaderComponent;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A collection of components, grouped in either a row or column. Can contain
|
|
26
|
+
* further groups as children to organize components however you wish, and have
|
|
27
|
+
* a number of styling options (such as removing the border).
|
|
28
|
+
*
|
|
29
|
+
* 
|
|
30
|
+
*/
|
|
31
|
+
declare class Group extends BaseParent<InternalProps> implements Listenable<Events> {
|
|
32
|
+
/** @hidden */
|
|
33
|
+
private readonly events;
|
|
34
|
+
constructor(props?: Props);
|
|
35
|
+
addListener: <T extends "title-changed">(type: T, listener: Events[T]) => void;
|
|
36
|
+
removeListener: <T extends "title-changed">(type: T, listener: Events[T]) => void;
|
|
37
|
+
validateChildren: () => void;
|
|
38
|
+
setOptions: (options: GroupOptions) => void;
|
|
39
|
+
setTitle: (title: string) => void;
|
|
40
|
+
addLabel: (label: Label) => void;
|
|
41
|
+
setLabels: (labels: Label[]) => void;
|
|
42
|
+
addHeaderChild: <C extends Button>(child: C) => C;
|
|
43
|
+
removeHeaderChild: (child: Button) => void;
|
|
44
|
+
removeAllHeaderChildren: () => void;
|
|
45
|
+
/** @hidden */
|
|
46
|
+
getProtoInfo: (idMap: IDMap) => GroupComponent;
|
|
47
|
+
/** @hidden */
|
|
48
|
+
handleMessage: (message: ClientComponentMessage) => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { type Events, Group, GroupHeader, type InternalProps, type Props };
|