@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,146 @@
|
|
|
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/text-input.ts
|
|
21
|
+
var text_input_exports = {};
|
|
22
|
+
__export(text_input_exports, {
|
|
23
|
+
TextInput: () => TextInput
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(text_input_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/text-input.ts
|
|
109
|
+
var DEFAULT_PROPS = {
|
|
110
|
+
value: null
|
|
111
|
+
};
|
|
112
|
+
var TextInput = class extends Base {
|
|
113
|
+
/** @hidden */
|
|
114
|
+
events = new EventEmitter();
|
|
115
|
+
constructor(props) {
|
|
116
|
+
super(DEFAULT_PROPS, props);
|
|
117
|
+
}
|
|
118
|
+
addListener = this.events.addListener;
|
|
119
|
+
removeListener = this.events.removeListener;
|
|
120
|
+
/** @hidden */
|
|
121
|
+
getProtoInfo = (idMap) => {
|
|
122
|
+
return {
|
|
123
|
+
component: "text-input",
|
|
124
|
+
key: idMap.getId(this),
|
|
125
|
+
value: this.props.value ?? ""
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
/** @hidden */
|
|
129
|
+
handleMessage = (message) => {
|
|
130
|
+
if (message.component === "text-input") {
|
|
131
|
+
if (this.props.value !== message.value) {
|
|
132
|
+
this.updateProps({ value: message.value });
|
|
133
|
+
this.events.emit("change", message.value);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
getValue = () => this.props.value;
|
|
138
|
+
getValidatedValue = (validator) => this.props.value === "" ? null : validator(this.props.value || "");
|
|
139
|
+
setValue = (value) => {
|
|
140
|
+
this.updateProps({ value });
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
144
|
+
0 && (module.exports = {
|
|
145
|
+
TextInput
|
|
146
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { e as Base, I as IDMap, g as Component, j as TimelineState, k as TimelineComponent } from '../../base-BJAPu0O1.mjs';
|
|
2
|
+
import '@arcanejs/diff';
|
|
3
|
+
|
|
4
|
+
type InternalProps = {
|
|
5
|
+
state: TimelineState;
|
|
6
|
+
title: string | null;
|
|
7
|
+
subtitles: string[] | null;
|
|
8
|
+
source: TimelineComponent['source'] | null;
|
|
9
|
+
};
|
|
10
|
+
type Props = Partial<InternalProps>;
|
|
11
|
+
declare class Timeline extends Base<InternalProps> {
|
|
12
|
+
constructor(props?: Props);
|
|
13
|
+
/** @hidden */
|
|
14
|
+
getProtoInfo: (idMap: IDMap) => Component;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { type Props, Timeline };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { e as Base, I as IDMap, g as Component, j as TimelineState, k as TimelineComponent } from '../../base-BJAPu0O1.js';
|
|
2
|
+
import '@arcanejs/diff';
|
|
3
|
+
|
|
4
|
+
type InternalProps = {
|
|
5
|
+
state: TimelineState;
|
|
6
|
+
title: string | null;
|
|
7
|
+
subtitles: string[] | null;
|
|
8
|
+
source: TimelineComponent['source'] | null;
|
|
9
|
+
};
|
|
10
|
+
type Props = Partial<InternalProps>;
|
|
11
|
+
declare class Timeline extends Base<InternalProps> {
|
|
12
|
+
constructor(props?: Props);
|
|
13
|
+
/** @hidden */
|
|
14
|
+
getProtoInfo: (idMap: IDMap) => Component;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { type Props, Timeline };
|
|
@@ -0,0 +1,109 @@
|
|
|
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/timeline.ts
|
|
21
|
+
var timeline_exports = {};
|
|
22
|
+
__export(timeline_exports, {
|
|
23
|
+
Timeline: () => Timeline
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(timeline_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/timeline.ts
|
|
82
|
+
var DEFAULT_PROPS = {
|
|
83
|
+
state: {
|
|
84
|
+
state: "stopped",
|
|
85
|
+
totalTimeMillis: 0,
|
|
86
|
+
currentTimeMillis: 0
|
|
87
|
+
},
|
|
88
|
+
title: null,
|
|
89
|
+
subtitles: null,
|
|
90
|
+
source: null
|
|
91
|
+
};
|
|
92
|
+
var Timeline = class extends Base {
|
|
93
|
+
constructor(props) {
|
|
94
|
+
super(DEFAULT_PROPS, props);
|
|
95
|
+
}
|
|
96
|
+
/** @hidden */
|
|
97
|
+
getProtoInfo = (idMap) => ({
|
|
98
|
+
component: "timeline",
|
|
99
|
+
key: idMap.getId(this),
|
|
100
|
+
state: this.props.state,
|
|
101
|
+
title: this.props.title ?? void 0,
|
|
102
|
+
subtitles: this.props.subtitles ?? void 0,
|
|
103
|
+
source: this.props.source ?? void 0
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
Timeline
|
|
109
|
+
});
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { Diff } from '@arcanejs/diff';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Styling options for the [[Group]] component
|
|
5
|
+
*
|
|
6
|
+
* Default Styling: [[GROUP_DEFAULT_STYLE]]
|
|
7
|
+
*/
|
|
8
|
+
type GroupComponentStyle = {
|
|
9
|
+
/**
|
|
10
|
+
* In which way should child components of this group be organized?
|
|
11
|
+
*/
|
|
12
|
+
direction: 'horizontal' | 'vertical';
|
|
13
|
+
/**
|
|
14
|
+
* If true, when the group runs out of vertical or horizontal space, child
|
|
15
|
+
* components will be wrapped, and start to be arranged on additional columns
|
|
16
|
+
* or rows.
|
|
17
|
+
*/
|
|
18
|
+
wrap?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* If true, this group will have a border and a different color background
|
|
21
|
+
* to its parent.
|
|
22
|
+
*
|
|
23
|
+
* This allows you to add a distinctive border between components,
|
|
24
|
+
* without needing to set a header, add header components,
|
|
25
|
+
* or make it collapsible.
|
|
26
|
+
*/
|
|
27
|
+
border?: true;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Styling options for the [[Label]] component
|
|
31
|
+
*
|
|
32
|
+
* Default Styling: [[LABEL_DEFAULT_STYLE]]
|
|
33
|
+
*/
|
|
34
|
+
type LabelComponentStyle = {
|
|
35
|
+
/**
|
|
36
|
+
* If true, make the text of this label bold
|
|
37
|
+
*/
|
|
38
|
+
bold?: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type BaseComponent = {
|
|
42
|
+
key: number;
|
|
43
|
+
};
|
|
44
|
+
type ButtonComponent = BaseComponent & {
|
|
45
|
+
component: 'button';
|
|
46
|
+
text: string;
|
|
47
|
+
icon?: string;
|
|
48
|
+
state: {
|
|
49
|
+
state: 'normal' | 'pressed';
|
|
50
|
+
} | {
|
|
51
|
+
state: 'error';
|
|
52
|
+
error: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
type GroupCollapsedState = 'open' | 'closed';
|
|
56
|
+
type DefaultGroupCollapsedState = GroupCollapsedState | 'auto';
|
|
57
|
+
type GroupHeaderComponent = BaseComponent & {
|
|
58
|
+
component: 'group-header';
|
|
59
|
+
children: Component$1[];
|
|
60
|
+
};
|
|
61
|
+
type GroupComponent = BaseComponent & GroupComponentStyle & {
|
|
62
|
+
component: 'group';
|
|
63
|
+
title?: string;
|
|
64
|
+
children: Component$1[];
|
|
65
|
+
headers?: GroupHeaderComponent[];
|
|
66
|
+
labels?: Array<{
|
|
67
|
+
text: string;
|
|
68
|
+
}>;
|
|
69
|
+
editableTitle: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* If set, allows the group to be collapsed,
|
|
72
|
+
* by default set to the given state
|
|
73
|
+
*/
|
|
74
|
+
defaultCollapsibleState?: DefaultGroupCollapsedState;
|
|
75
|
+
};
|
|
76
|
+
type LabelComponent = BaseComponent & {
|
|
77
|
+
component: 'label';
|
|
78
|
+
bold?: boolean;
|
|
79
|
+
text: string;
|
|
80
|
+
};
|
|
81
|
+
type RectComponent = BaseComponent & {
|
|
82
|
+
component: 'rect';
|
|
83
|
+
color: string;
|
|
84
|
+
};
|
|
85
|
+
type SliderButtonComponent = BaseComponent & {
|
|
86
|
+
component: 'slider_button';
|
|
87
|
+
min: number;
|
|
88
|
+
max: number;
|
|
89
|
+
step: number;
|
|
90
|
+
value: number | null;
|
|
91
|
+
};
|
|
92
|
+
type SwitchComponent = BaseComponent & {
|
|
93
|
+
component: 'switch';
|
|
94
|
+
state: 'on' | 'off';
|
|
95
|
+
};
|
|
96
|
+
type TabComponent = BaseComponent & {
|
|
97
|
+
component: 'tab';
|
|
98
|
+
name: string;
|
|
99
|
+
child?: Component$1;
|
|
100
|
+
};
|
|
101
|
+
type TabsComponent = BaseComponent & {
|
|
102
|
+
component: 'tabs';
|
|
103
|
+
tabs: TabComponent[];
|
|
104
|
+
};
|
|
105
|
+
type TextInputComponent = BaseComponent & {
|
|
106
|
+
component: 'text-input';
|
|
107
|
+
value: string;
|
|
108
|
+
};
|
|
109
|
+
type TimelineState = {
|
|
110
|
+
state: 'playing';
|
|
111
|
+
totalTimeMillis: number;
|
|
112
|
+
effectiveStartTime: number;
|
|
113
|
+
speed: number;
|
|
114
|
+
} | {
|
|
115
|
+
state: 'stopped';
|
|
116
|
+
totalTimeMillis: number;
|
|
117
|
+
currentTimeMillis: number;
|
|
118
|
+
};
|
|
119
|
+
type TimelineComponent = BaseComponent & {
|
|
120
|
+
component: 'timeline';
|
|
121
|
+
state: TimelineState;
|
|
122
|
+
title?: string;
|
|
123
|
+
subtitles?: string[];
|
|
124
|
+
source?: {
|
|
125
|
+
name: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
type Component$1 = ButtonComponent | GroupHeaderComponent | GroupComponent | LabelComponent | RectComponent | SliderButtonComponent | SwitchComponent | TabComponent | TabsComponent | TextInputComponent | TimelineComponent;
|
|
129
|
+
type SendTreeMsg = {
|
|
130
|
+
type: 'tree-full';
|
|
131
|
+
root: GroupComponent;
|
|
132
|
+
};
|
|
133
|
+
type UpdateTreeMsg = {
|
|
134
|
+
type: 'tree-diff';
|
|
135
|
+
diff: Diff<GroupComponent>;
|
|
136
|
+
};
|
|
137
|
+
type ServerMessage = SendTreeMsg | UpdateTreeMsg;
|
|
138
|
+
type BaseClientComponentMessage = {
|
|
139
|
+
type: 'component-message';
|
|
140
|
+
componentKey: number;
|
|
141
|
+
};
|
|
142
|
+
type ButtonPressMessage = BaseClientComponentMessage & {
|
|
143
|
+
component: 'button';
|
|
144
|
+
};
|
|
145
|
+
type GroupTitleChangeMessage = BaseClientComponentMessage & {
|
|
146
|
+
component: 'group';
|
|
147
|
+
title: string;
|
|
148
|
+
};
|
|
149
|
+
type SliderButtonUpdateMessage = BaseClientComponentMessage & {
|
|
150
|
+
component: 'slider_button';
|
|
151
|
+
value: number;
|
|
152
|
+
};
|
|
153
|
+
type SwitchToggleMessage = BaseClientComponentMessage & {
|
|
154
|
+
component: 'switch';
|
|
155
|
+
};
|
|
156
|
+
type TextInputUpdateMessage = BaseClientComponentMessage & {
|
|
157
|
+
component: 'text-input';
|
|
158
|
+
value: string;
|
|
159
|
+
};
|
|
160
|
+
type ClientComponentMessage = ButtonPressMessage | GroupTitleChangeMessage | SliderButtonUpdateMessage | SwitchToggleMessage | TextInputUpdateMessage;
|
|
161
|
+
type ClientMessage = ClientComponentMessage;
|
|
162
|
+
|
|
163
|
+
declare class IDMap {
|
|
164
|
+
private readonly idMap;
|
|
165
|
+
private nextId;
|
|
166
|
+
getId(object: object): number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface Component {
|
|
170
|
+
getProtoInfo(idMap: IDMap): Component$1;
|
|
171
|
+
handleMessage(message: ClientComponentMessage): void;
|
|
172
|
+
routeMessage(idMap: IDMap, message: ClientComponentMessage): void;
|
|
173
|
+
setParent(parent: Parent | null): void;
|
|
174
|
+
}
|
|
175
|
+
declare abstract class Base<Props> implements Component {
|
|
176
|
+
/** @hidden */
|
|
177
|
+
private parent;
|
|
178
|
+
/** @hidden */
|
|
179
|
+
private readonly defaultProps;
|
|
180
|
+
/** @hidden */
|
|
181
|
+
private _props;
|
|
182
|
+
constructor(defaultProps: Props, props?: Partial<Props>);
|
|
183
|
+
get props(): Props;
|
|
184
|
+
set props(props: Partial<Props>);
|
|
185
|
+
setProps: (props: Partial<Props>) => void;
|
|
186
|
+
updateProps: (updates: Partial<Props>) => void;
|
|
187
|
+
/** @hidden */
|
|
188
|
+
setParent(parent: Parent | null): void;
|
|
189
|
+
/** @hidden */
|
|
190
|
+
updateTree(): void;
|
|
191
|
+
/** @hidden */
|
|
192
|
+
abstract getProtoInfo(idMap: IDMap): Component$1;
|
|
193
|
+
/** @hidden */
|
|
194
|
+
handleMessage(message: ClientComponentMessage): void;
|
|
195
|
+
routeMessage(_idMap: IDMap, _message: ClientComponentMessage): void;
|
|
196
|
+
}
|
|
197
|
+
/** @hidden */
|
|
198
|
+
interface Parent {
|
|
199
|
+
updateTree(): void;
|
|
200
|
+
removeChild(component: Component): void;
|
|
201
|
+
}
|
|
202
|
+
declare abstract class BaseParent<T> extends Base<T> implements Parent {
|
|
203
|
+
/** @hidden */
|
|
204
|
+
private children;
|
|
205
|
+
abstract validateChildren(children: Component[]): void;
|
|
206
|
+
appendChildren: <CS extends Component[]>(...children: CS) => CS;
|
|
207
|
+
appendChild: <C extends Component>(child: C) => C;
|
|
208
|
+
removeChild: (component: Component) => void;
|
|
209
|
+
removeAllChildren: () => void;
|
|
210
|
+
/**
|
|
211
|
+
* Return all children components that messages need to be routed to
|
|
212
|
+
*/
|
|
213
|
+
getChildren: () => readonly Component[];
|
|
214
|
+
/**
|
|
215
|
+
* TODO: we can do this better, right now it broadcasts the message to all
|
|
216
|
+
* components of the tree
|
|
217
|
+
*
|
|
218
|
+
* @hidden
|
|
219
|
+
*/
|
|
220
|
+
routeMessage(idMap: IDMap, message: ClientComponentMessage): void;
|
|
221
|
+
insertBefore(child: Component, beforeChild: Component): void;
|
|
222
|
+
}
|
|
223
|
+
interface Listenable<Map extends Record<string, (...args: any[]) => void>> {
|
|
224
|
+
addListener<T extends keyof Map>(type: T, listener: Map[T]): void;
|
|
225
|
+
removeListener<T extends keyof Map>(type: T, listener: Map[T]): void;
|
|
226
|
+
}
|
|
227
|
+
declare class EventEmitter<Map extends Record<string, (...args: any[]) => void>> implements Listenable<Map> {
|
|
228
|
+
private readonly listeners;
|
|
229
|
+
addListener: <T extends keyof Map>(type: T, listener: Map[T]) => void;
|
|
230
|
+
removeListener: <T extends keyof Map>(type: T, listener: Map[T]) => void;
|
|
231
|
+
emit: <T extends keyof Map>(type: T, ...args: Parameters<Map[T]>) => Promise<unknown>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export { BaseParent as B, type ClientMessage as C, EventEmitter as E, type GroupComponentStyle as G, IDMap as I, type Listenable as L, type Parent as P, type ServerMessage as S, type TabComponent as T, type Component as a, type GroupHeaderComponent as b, type GroupComponent as c, type ClientComponentMessage as d, Base as e, type ButtonComponent as f, type Component$1 as g, type LabelComponentStyle as h, type TabsComponent as i, type TimelineState as j, type TimelineComponent as k };
|