@arcanejs/toolkit 0.1.1 → 0.2.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/dist/backend/components/base.d.mts +69 -2
- package/dist/backend/components/base.d.ts +69 -2
- 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.mjs +3 -2
- package/dist/backend/components/group.d.mts +9 -8
- package/dist/backend/components/group.d.ts +9 -8
- package/dist/backend/components/group.js +4 -7
- 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.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.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.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.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.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.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.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 +43 -0
- package/dist/backend/util/index.mjs +7 -0
- package/dist/{chunk-S5DQIYC2.mjs → chunk-3O4P67DM.mjs} +3 -6
- package/dist/{chunk-37VNFO5S.mjs → chunk-APCR3ITH.mjs} +1 -1
- 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-RGHJEMWG.mjs +17 -0
- package/dist/{chunk-DBW4OPGN.mjs → chunk-SOC4TF3J.mjs} +1 -1
- package/dist/{chunk-DP3QFYSS.mjs → chunk-TAZH4BBH.mjs} +1 -1
- package/dist/{chunk-3ZBM7Q4A.mjs → chunk-TQ27Y7F4.mjs} +1 -1
- 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 +2 -5
- package/dist/index.mjs +14 -24
- package/package.json +11 -3
- package/dist/base-BJAPu0O1.d.mts +0 -234
- package/dist/base-BJAPu0O1.d.ts +0 -234
package/dist/index.d.mts
CHANGED
|
@@ -2,9 +2,10 @@ import _ from 'lodash';
|
|
|
2
2
|
import * as http from 'http';
|
|
3
3
|
import { Application } from 'express';
|
|
4
4
|
import { WebSocket } from 'ws';
|
|
5
|
-
import {
|
|
5
|
+
import { ClientMessage, ServerMessage } from '@arcanejs/protocol';
|
|
6
6
|
import { Group } from './backend/components/group.mjs';
|
|
7
7
|
export { GroupHeader } from './backend/components/group.mjs';
|
|
8
|
+
import { Component } from './backend/components/base.mjs';
|
|
8
9
|
export { Button } from './backend/components/button.mjs';
|
|
9
10
|
export { Label } from './backend/components/label.mjs';
|
|
10
11
|
export { Rect } from './backend/components/rect.mjs';
|
|
@@ -13,7 +14,8 @@ export { Switch } from './backend/components/switch.mjs';
|
|
|
13
14
|
export { Tab, Tabs } from './backend/components/tabs.mjs';
|
|
14
15
|
export { TextInput } from './backend/components/text-input.mjs';
|
|
15
16
|
export { Timeline } from './backend/components/timeline.mjs';
|
|
16
|
-
import '@arcanejs/
|
|
17
|
+
import '@arcanejs/protocol/styles';
|
|
18
|
+
import './backend/util/index.mjs';
|
|
17
19
|
|
|
18
20
|
interface Connection {
|
|
19
21
|
sendMessage(msg: ServerMessage): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import _ from 'lodash';
|
|
|
2
2
|
import * as http from 'http';
|
|
3
3
|
import { Application } from 'express';
|
|
4
4
|
import { WebSocket } from 'ws';
|
|
5
|
-
import {
|
|
5
|
+
import { ClientMessage, ServerMessage } from '@arcanejs/protocol';
|
|
6
6
|
import { Group } from './backend/components/group.js';
|
|
7
7
|
export { GroupHeader } from './backend/components/group.js';
|
|
8
|
+
import { Component } from './backend/components/base.js';
|
|
8
9
|
export { Button } from './backend/components/button.js';
|
|
9
10
|
export { Label } from './backend/components/label.js';
|
|
10
11
|
export { Rect } from './backend/components/rect.js';
|
|
@@ -13,7 +14,8 @@ export { Switch } from './backend/components/switch.js';
|
|
|
13
14
|
export { Tab, Tabs } from './backend/components/tabs.js';
|
|
14
15
|
export { TextInput } from './backend/components/text-input.js';
|
|
15
16
|
export { Timeline } from './backend/components/timeline.js';
|
|
16
|
-
import '@arcanejs/
|
|
17
|
+
import '@arcanejs/protocol/styles';
|
|
18
|
+
import './backend/util/index.js';
|
|
17
19
|
|
|
18
20
|
interface Connection {
|
|
19
21
|
sendMessage(msg: ServerMessage): void;
|
package/dist/index.js
CHANGED
|
@@ -503,17 +503,14 @@ var Button = class extends Base {
|
|
|
503
503
|
};
|
|
504
504
|
};
|
|
505
505
|
|
|
506
|
-
// src/
|
|
506
|
+
// src/backend/components/group.ts
|
|
507
507
|
var GROUP_DEFAULT_STYLE = {
|
|
508
508
|
direction: "horizontal"
|
|
509
509
|
};
|
|
510
|
-
|
|
511
|
-
// src/backend/components/group.ts
|
|
512
510
|
var DEFAULT_PROPS2 = {
|
|
513
511
|
...GROUP_DEFAULT_STYLE,
|
|
514
512
|
title: null,
|
|
515
|
-
labels: null
|
|
516
|
-
headerComponents: null
|
|
513
|
+
labels: null
|
|
517
514
|
};
|
|
518
515
|
var GroupHeader = class extends BaseParent {
|
|
519
516
|
validateChildren = () => {
|
package/dist/index.mjs
CHANGED
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Tab,
|
|
3
3
|
Tabs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TQ27Y7F4.mjs";
|
|
5
5
|
import {
|
|
6
6
|
TextInput
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IXTM35YM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
Timeline
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SOC4TF3J.mjs";
|
|
11
|
+
import {
|
|
12
|
+
IDMap
|
|
13
|
+
} from "./chunk-RGHJEMWG.mjs";
|
|
11
14
|
import {
|
|
12
15
|
Button
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TAZH4BBH.mjs";
|
|
14
17
|
import {
|
|
15
18
|
Group,
|
|
16
19
|
GroupHeader
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3O4P67DM.mjs";
|
|
18
21
|
import {
|
|
19
22
|
Label
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-HNEUZVCX.mjs";
|
|
21
24
|
import {
|
|
22
25
|
Rect
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ZU5H6SVA.mjs";
|
|
24
27
|
import {
|
|
25
28
|
SliderButton
|
|
26
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-JW4GXS54.mjs";
|
|
27
30
|
import {
|
|
28
31
|
Switch
|
|
29
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-APCR3ITH.mjs";
|
|
33
|
+
import "./chunk-ZCHM3JJJ.mjs";
|
|
30
34
|
import {
|
|
31
35
|
__require
|
|
32
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-Y6FXYEAI.mjs";
|
|
33
37
|
|
|
34
38
|
// src/backend/toolkit.ts
|
|
35
39
|
import _ from "lodash";
|
|
@@ -151,20 +155,6 @@ var Server = class {
|
|
|
151
155
|
};
|
|
152
156
|
};
|
|
153
157
|
|
|
154
|
-
// src/backend/util/id-map.ts
|
|
155
|
-
var IDMap = class {
|
|
156
|
-
idMap = /* @__PURE__ */ new WeakMap();
|
|
157
|
-
nextId = 0;
|
|
158
|
-
getId(object) {
|
|
159
|
-
let i = this.idMap.get(object);
|
|
160
|
-
if (i === void 0) {
|
|
161
|
-
i = this.nextId++;
|
|
162
|
-
this.idMap.set(object, i);
|
|
163
|
-
}
|
|
164
|
-
return i;
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
|
|
168
158
|
// src/backend/toolkit.ts
|
|
169
159
|
import { WebSocketServer } from "ws";
|
|
170
160
|
import { createServer } from "http";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcanejs/toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Build web-accessible control interfaces for your long-running Node.js processes",
|
|
6
6
|
"keywords": [
|
|
@@ -82,6 +82,12 @@
|
|
|
82
82
|
"import": "./dist/backend/components/timeline.mjs",
|
|
83
83
|
"require": "./dist/backend/components/timeline.js",
|
|
84
84
|
"types": "./dist/backend/components/timeline.d.ts"
|
|
85
|
+
},
|
|
86
|
+
"./util": {
|
|
87
|
+
"@arcanejs/source": "./src/backend/util/index.ts",
|
|
88
|
+
"import": "./dist/backend/util/index.mjs",
|
|
89
|
+
"require": "./dist/backend/util/index.js",
|
|
90
|
+
"types": "./dist/backend/util/index.d.ts"
|
|
85
91
|
}
|
|
86
92
|
},
|
|
87
93
|
"devDependencies": {
|
|
@@ -100,14 +106,16 @@
|
|
|
100
106
|
"tsup": "^8.1.0",
|
|
101
107
|
"typescript": "^5.3.3",
|
|
102
108
|
"@arcanejs/eslint-config": "^0.0.0",
|
|
103
|
-
"@arcanejs/typescript-config": "^0.0.0"
|
|
109
|
+
"@arcanejs/typescript-config": "^0.0.0",
|
|
110
|
+
"@arcanejs/toolkit-frontend": "^0.0.2"
|
|
104
111
|
},
|
|
105
112
|
"dependencies": {
|
|
106
113
|
"express": "^4.21.1",
|
|
107
114
|
"lodash": "^4.17.21",
|
|
108
115
|
"material-symbols": "^0.25.0",
|
|
109
116
|
"ws": "^8.18.0",
|
|
110
|
-
"@arcanejs/diff": "^0.3.1"
|
|
117
|
+
"@arcanejs/diff": "^0.3.1",
|
|
118
|
+
"@arcanejs/protocol": "^0.1.1"
|
|
111
119
|
},
|
|
112
120
|
"files": [
|
|
113
121
|
"dist"
|
package/dist/base-BJAPu0O1.d.mts
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
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 };
|
package/dist/base-BJAPu0O1.d.ts
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
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 };
|