@arcanejs/protocol 0.3.0 → 0.4.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/core.d.mts +134 -0
- package/dist/core.d.ts +134 -0
- package/dist/core.js +7 -0
- package/dist/core.mjs +7 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.d.ts +15 -133
- package/dist/index.js +1 -0
- package/dist/index.mjs +0 -0
- package/dist/logging.d.mts +8 -0
- package/dist/logging.d.ts +3 -1
- package/dist/logging.js +1 -0
- package/dist/logging.mjs +0 -0
- package/dist/styles.d.mts +39 -0
- package/dist/styles.d.ts +4 -2
- package/dist/styles.js +1 -0
- package/dist/styles.mjs +0 -0
- package/package.json +14 -5
package/dist/core.d.mts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { BaseComponentProto, AnyComponentProto, BaseClientComponentMessage } from './index.mjs';
|
|
2
|
+
import { GroupComponentStyle } from './styles.mjs';
|
|
3
|
+
import '@arcanejs/diff';
|
|
4
|
+
|
|
5
|
+
type CoreNamespace = 'core';
|
|
6
|
+
type Gradient = Array<{
|
|
7
|
+
/**
|
|
8
|
+
* CSS color value
|
|
9
|
+
*/
|
|
10
|
+
color: string;
|
|
11
|
+
/**
|
|
12
|
+
* Position of the color in the gradient, between 0 and 1
|
|
13
|
+
*/
|
|
14
|
+
position: number;
|
|
15
|
+
}>;
|
|
16
|
+
type ButtonComponent = BaseComponentProto<CoreNamespace> & {
|
|
17
|
+
component: 'button';
|
|
18
|
+
text: string;
|
|
19
|
+
icon?: string;
|
|
20
|
+
state: {
|
|
21
|
+
state: 'normal' | 'pressed';
|
|
22
|
+
} | {
|
|
23
|
+
state: 'error';
|
|
24
|
+
error: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
type GroupCollapsedState = 'open' | 'closed';
|
|
28
|
+
type DefaultGroupCollapsedState = GroupCollapsedState | 'auto';
|
|
29
|
+
type GroupHeaderComponent = BaseComponentProto<CoreNamespace> & {
|
|
30
|
+
component: 'group-header';
|
|
31
|
+
children: AnyComponentProto[];
|
|
32
|
+
};
|
|
33
|
+
type GroupComponent = BaseComponentProto<CoreNamespace> & GroupComponentStyle & {
|
|
34
|
+
component: 'group';
|
|
35
|
+
title?: string;
|
|
36
|
+
children: AnyComponentProto[];
|
|
37
|
+
headers?: GroupHeaderComponent[];
|
|
38
|
+
labels?: Array<{
|
|
39
|
+
text: string;
|
|
40
|
+
}>;
|
|
41
|
+
editableTitle: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If set, allows the group to be collapsed,
|
|
44
|
+
* by default set to the given state
|
|
45
|
+
*/
|
|
46
|
+
defaultCollapsibleState?: DefaultGroupCollapsedState;
|
|
47
|
+
};
|
|
48
|
+
type LabelComponent = BaseComponentProto<CoreNamespace> & {
|
|
49
|
+
component: 'label';
|
|
50
|
+
bold?: boolean;
|
|
51
|
+
text: string;
|
|
52
|
+
};
|
|
53
|
+
type RectComponent = BaseComponentProto<CoreNamespace> & {
|
|
54
|
+
component: 'rect';
|
|
55
|
+
color: string;
|
|
56
|
+
/**
|
|
57
|
+
* Set to true if the component should increase its size to fill the available space.
|
|
58
|
+
*/
|
|
59
|
+
grow?: boolean;
|
|
60
|
+
};
|
|
61
|
+
type SliderButtonComponent = BaseComponentProto<CoreNamespace> & {
|
|
62
|
+
component: 'slider_button';
|
|
63
|
+
min: number;
|
|
64
|
+
max: number;
|
|
65
|
+
step: number;
|
|
66
|
+
value: number | null;
|
|
67
|
+
gradient?: Gradient;
|
|
68
|
+
/**
|
|
69
|
+
* Set to true if the component should increase its size to fill the available space.
|
|
70
|
+
*/
|
|
71
|
+
grow?: boolean;
|
|
72
|
+
};
|
|
73
|
+
type SwitchComponent = BaseComponentProto<CoreNamespace> & {
|
|
74
|
+
component: 'switch';
|
|
75
|
+
state: 'on' | 'off';
|
|
76
|
+
};
|
|
77
|
+
type TabComponent = BaseComponentProto<CoreNamespace> & {
|
|
78
|
+
component: 'tab';
|
|
79
|
+
name: string;
|
|
80
|
+
child?: AnyComponentProto;
|
|
81
|
+
};
|
|
82
|
+
type TabsComponent = BaseComponentProto<CoreNamespace> & {
|
|
83
|
+
component: 'tabs';
|
|
84
|
+
tabs: TabComponent[];
|
|
85
|
+
};
|
|
86
|
+
type TextInputComponent = BaseComponentProto<CoreNamespace> & {
|
|
87
|
+
component: 'text-input';
|
|
88
|
+
value: string;
|
|
89
|
+
};
|
|
90
|
+
type TimelineState = {
|
|
91
|
+
state: 'playing';
|
|
92
|
+
totalTimeMillis: number;
|
|
93
|
+
effectiveStartTime: number;
|
|
94
|
+
speed: number;
|
|
95
|
+
} | {
|
|
96
|
+
state: 'stopped';
|
|
97
|
+
totalTimeMillis: number;
|
|
98
|
+
currentTimeMillis: number;
|
|
99
|
+
};
|
|
100
|
+
type TimelineComponent = BaseComponentProto<CoreNamespace> & {
|
|
101
|
+
component: 'timeline';
|
|
102
|
+
state: TimelineState;
|
|
103
|
+
title?: string;
|
|
104
|
+
subtitles?: string[];
|
|
105
|
+
source?: {
|
|
106
|
+
name: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
type CoreComponent = ButtonComponent | GroupComponent | GroupHeaderComponent | LabelComponent | RectComponent | SliderButtonComponent | SwitchComponent | TabComponent | TabsComponent | TextInputComponent | TimelineComponent;
|
|
110
|
+
declare const isCoreComponent: (component: AnyComponentProto) => component is CoreComponent;
|
|
111
|
+
type ButtonPressMessage = BaseClientComponentMessage<CoreNamespace> & {
|
|
112
|
+
component: 'button';
|
|
113
|
+
};
|
|
114
|
+
type GroupTitleChangeMessage = BaseClientComponentMessage<CoreNamespace> & {
|
|
115
|
+
component: 'group';
|
|
116
|
+
title: string;
|
|
117
|
+
};
|
|
118
|
+
type SliderButtonUpdateMessage = BaseClientComponentMessage<CoreNamespace> & {
|
|
119
|
+
component: 'slider_button';
|
|
120
|
+
value: number;
|
|
121
|
+
};
|
|
122
|
+
type SwitchToggleMessage = BaseClientComponentMessage<CoreNamespace> & {
|
|
123
|
+
component: 'switch';
|
|
124
|
+
};
|
|
125
|
+
type TextInputUpdateMessage = BaseClientComponentMessage<CoreNamespace> & {
|
|
126
|
+
component: 'text-input';
|
|
127
|
+
value: string;
|
|
128
|
+
};
|
|
129
|
+
type CoreComponentMessage = ButtonPressMessage | GroupTitleChangeMessage | SliderButtonUpdateMessage | SwitchToggleMessage | TextInputUpdateMessage;
|
|
130
|
+
declare const isCoreComponentMessage: <C extends "button" | "group" | "slider_button" | "switch" | "text-input">(message: BaseClientComponentMessage<string>, component: C) => message is CoreComponentMessage & {
|
|
131
|
+
component: C;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export { type ButtonComponent, type ButtonPressMessage, type CoreComponent, type CoreComponentMessage, type CoreNamespace, type DefaultGroupCollapsedState, type Gradient, type GroupCollapsedState, type GroupComponent, type GroupHeaderComponent, type GroupTitleChangeMessage, type LabelComponent, type RectComponent, type SliderButtonComponent, type SliderButtonUpdateMessage, type SwitchComponent, type SwitchToggleMessage, type TabComponent, type TabsComponent, type TextInputComponent, type TextInputUpdateMessage, type TimelineComponent, type TimelineState, isCoreComponent, isCoreComponentMessage };
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { BaseComponentProto, AnyComponentProto, BaseClientComponentMessage } from './index.js';
|
|
2
|
+
import { GroupComponentStyle } from './styles.js';
|
|
3
|
+
import '@arcanejs/diff';
|
|
4
|
+
|
|
5
|
+
type CoreNamespace = 'core';
|
|
6
|
+
type Gradient = Array<{
|
|
7
|
+
/**
|
|
8
|
+
* CSS color value
|
|
9
|
+
*/
|
|
10
|
+
color: string;
|
|
11
|
+
/**
|
|
12
|
+
* Position of the color in the gradient, between 0 and 1
|
|
13
|
+
*/
|
|
14
|
+
position: number;
|
|
15
|
+
}>;
|
|
16
|
+
type ButtonComponent = BaseComponentProto<CoreNamespace> & {
|
|
17
|
+
component: 'button';
|
|
18
|
+
text: string;
|
|
19
|
+
icon?: string;
|
|
20
|
+
state: {
|
|
21
|
+
state: 'normal' | 'pressed';
|
|
22
|
+
} | {
|
|
23
|
+
state: 'error';
|
|
24
|
+
error: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
type GroupCollapsedState = 'open' | 'closed';
|
|
28
|
+
type DefaultGroupCollapsedState = GroupCollapsedState | 'auto';
|
|
29
|
+
type GroupHeaderComponent = BaseComponentProto<CoreNamespace> & {
|
|
30
|
+
component: 'group-header';
|
|
31
|
+
children: AnyComponentProto[];
|
|
32
|
+
};
|
|
33
|
+
type GroupComponent = BaseComponentProto<CoreNamespace> & GroupComponentStyle & {
|
|
34
|
+
component: 'group';
|
|
35
|
+
title?: string;
|
|
36
|
+
children: AnyComponentProto[];
|
|
37
|
+
headers?: GroupHeaderComponent[];
|
|
38
|
+
labels?: Array<{
|
|
39
|
+
text: string;
|
|
40
|
+
}>;
|
|
41
|
+
editableTitle: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If set, allows the group to be collapsed,
|
|
44
|
+
* by default set to the given state
|
|
45
|
+
*/
|
|
46
|
+
defaultCollapsibleState?: DefaultGroupCollapsedState;
|
|
47
|
+
};
|
|
48
|
+
type LabelComponent = BaseComponentProto<CoreNamespace> & {
|
|
49
|
+
component: 'label';
|
|
50
|
+
bold?: boolean;
|
|
51
|
+
text: string;
|
|
52
|
+
};
|
|
53
|
+
type RectComponent = BaseComponentProto<CoreNamespace> & {
|
|
54
|
+
component: 'rect';
|
|
55
|
+
color: string;
|
|
56
|
+
/**
|
|
57
|
+
* Set to true if the component should increase its size to fill the available space.
|
|
58
|
+
*/
|
|
59
|
+
grow?: boolean;
|
|
60
|
+
};
|
|
61
|
+
type SliderButtonComponent = BaseComponentProto<CoreNamespace> & {
|
|
62
|
+
component: 'slider_button';
|
|
63
|
+
min: number;
|
|
64
|
+
max: number;
|
|
65
|
+
step: number;
|
|
66
|
+
value: number | null;
|
|
67
|
+
gradient?: Gradient;
|
|
68
|
+
/**
|
|
69
|
+
* Set to true if the component should increase its size to fill the available space.
|
|
70
|
+
*/
|
|
71
|
+
grow?: boolean;
|
|
72
|
+
};
|
|
73
|
+
type SwitchComponent = BaseComponentProto<CoreNamespace> & {
|
|
74
|
+
component: 'switch';
|
|
75
|
+
state: 'on' | 'off';
|
|
76
|
+
};
|
|
77
|
+
type TabComponent = BaseComponentProto<CoreNamespace> & {
|
|
78
|
+
component: 'tab';
|
|
79
|
+
name: string;
|
|
80
|
+
child?: AnyComponentProto;
|
|
81
|
+
};
|
|
82
|
+
type TabsComponent = BaseComponentProto<CoreNamespace> & {
|
|
83
|
+
component: 'tabs';
|
|
84
|
+
tabs: TabComponent[];
|
|
85
|
+
};
|
|
86
|
+
type TextInputComponent = BaseComponentProto<CoreNamespace> & {
|
|
87
|
+
component: 'text-input';
|
|
88
|
+
value: string;
|
|
89
|
+
};
|
|
90
|
+
type TimelineState = {
|
|
91
|
+
state: 'playing';
|
|
92
|
+
totalTimeMillis: number;
|
|
93
|
+
effectiveStartTime: number;
|
|
94
|
+
speed: number;
|
|
95
|
+
} | {
|
|
96
|
+
state: 'stopped';
|
|
97
|
+
totalTimeMillis: number;
|
|
98
|
+
currentTimeMillis: number;
|
|
99
|
+
};
|
|
100
|
+
type TimelineComponent = BaseComponentProto<CoreNamespace> & {
|
|
101
|
+
component: 'timeline';
|
|
102
|
+
state: TimelineState;
|
|
103
|
+
title?: string;
|
|
104
|
+
subtitles?: string[];
|
|
105
|
+
source?: {
|
|
106
|
+
name: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
type CoreComponent = ButtonComponent | GroupComponent | GroupHeaderComponent | LabelComponent | RectComponent | SliderButtonComponent | SwitchComponent | TabComponent | TabsComponent | TextInputComponent | TimelineComponent;
|
|
110
|
+
declare const isCoreComponent: (component: AnyComponentProto) => component is CoreComponent;
|
|
111
|
+
type ButtonPressMessage = BaseClientComponentMessage<CoreNamespace> & {
|
|
112
|
+
component: 'button';
|
|
113
|
+
};
|
|
114
|
+
type GroupTitleChangeMessage = BaseClientComponentMessage<CoreNamespace> & {
|
|
115
|
+
component: 'group';
|
|
116
|
+
title: string;
|
|
117
|
+
};
|
|
118
|
+
type SliderButtonUpdateMessage = BaseClientComponentMessage<CoreNamespace> & {
|
|
119
|
+
component: 'slider_button';
|
|
120
|
+
value: number;
|
|
121
|
+
};
|
|
122
|
+
type SwitchToggleMessage = BaseClientComponentMessage<CoreNamespace> & {
|
|
123
|
+
component: 'switch';
|
|
124
|
+
};
|
|
125
|
+
type TextInputUpdateMessage = BaseClientComponentMessage<CoreNamespace> & {
|
|
126
|
+
component: 'text-input';
|
|
127
|
+
value: string;
|
|
128
|
+
};
|
|
129
|
+
type CoreComponentMessage = ButtonPressMessage | GroupTitleChangeMessage | SliderButtonUpdateMessage | SwitchToggleMessage | TextInputUpdateMessage;
|
|
130
|
+
declare const isCoreComponentMessage: <C extends "button" | "group" | "slider_button" | "switch" | "text-input">(message: BaseClientComponentMessage<string>, component: C) => message is CoreComponentMessage & {
|
|
131
|
+
component: C;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export { type ButtonComponent, type ButtonPressMessage, type CoreComponent, type CoreComponentMessage, type CoreNamespace, type DefaultGroupCollapsedState, type Gradient, type GroupCollapsedState, type GroupComponent, type GroupHeaderComponent, type GroupTitleChangeMessage, type LabelComponent, type RectComponent, type SliderButtonComponent, type SliderButtonUpdateMessage, type SwitchComponent, type SwitchToggleMessage, type TabComponent, type TabsComponent, type TextInputComponent, type TextInputUpdateMessage, type TimelineComponent, type TimelineState, isCoreComponent, isCoreComponentMessage };
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/core.ts
|
|
2
|
+
var isCoreComponent = (component) => component.namespace === "core";
|
|
3
|
+
var isCoreComponentMessage = (message, component) => message.namespace === "core" && message.component === component;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.isCoreComponent = isCoreComponent; exports.isCoreComponentMessage = isCoreComponentMessage;
|
package/dist/core.mjs
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Diff } from '@arcanejs/diff';
|
|
2
|
+
|
|
3
|
+
type BaseComponentProto<Namespace extends string> = {
|
|
4
|
+
key: number;
|
|
5
|
+
namespace: Namespace;
|
|
6
|
+
};
|
|
7
|
+
type AnyComponentProto = BaseComponentProto<string>;
|
|
8
|
+
type SendTreeMsg = {
|
|
9
|
+
type: 'tree-full';
|
|
10
|
+
root: BaseComponentProto<string>;
|
|
11
|
+
};
|
|
12
|
+
type UpdateTreeMsg = {
|
|
13
|
+
type: 'tree-diff';
|
|
14
|
+
diff: Diff<BaseComponentProto<string>>;
|
|
15
|
+
};
|
|
16
|
+
type ServerMessage = SendTreeMsg | UpdateTreeMsg;
|
|
17
|
+
type BaseClientComponentMessage<Namespace extends string> = {
|
|
18
|
+
type: 'component-message';
|
|
19
|
+
namespace: Namespace;
|
|
20
|
+
componentKey: number;
|
|
21
|
+
};
|
|
22
|
+
type AnyClientComponentMessage = BaseClientComponentMessage<string>;
|
|
23
|
+
type ClientMessage = AnyClientComponentMessage;
|
|
24
|
+
|
|
25
|
+
export type { AnyClientComponentMessage, AnyComponentProto, BaseClientComponentMessage, BaseComponentProto, ClientMessage, SendTreeMsg, ServerMessage, UpdateTreeMsg };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,143 +1,25 @@
|
|
|
1
1
|
import { Diff } from '@arcanejs/diff';
|
|
2
|
-
|
|
3
|
-
type
|
|
2
|
+
|
|
3
|
+
type BaseComponentProto<Namespace extends string> = {
|
|
4
4
|
key: number;
|
|
5
|
+
namespace: Namespace;
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* CSS color value
|
|
9
|
-
*/
|
|
10
|
-
color: string;
|
|
11
|
-
/**
|
|
12
|
-
* Position of the color in the gradient, between 0 and 1
|
|
13
|
-
*/
|
|
14
|
-
position: number;
|
|
15
|
-
}>;
|
|
16
|
-
export type ButtonComponent = BaseComponent & {
|
|
17
|
-
component: 'button';
|
|
18
|
-
text: string;
|
|
19
|
-
icon?: string;
|
|
20
|
-
state: {
|
|
21
|
-
state: 'normal' | 'pressed';
|
|
22
|
-
} | {
|
|
23
|
-
state: 'error';
|
|
24
|
-
error: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export type GroupCollapsedState = 'open' | 'closed';
|
|
28
|
-
export type DefaultGroupCollapsedState = GroupCollapsedState | 'auto';
|
|
29
|
-
export type GroupHeaderComponent = BaseComponent & {
|
|
30
|
-
component: 'group-header';
|
|
31
|
-
children: Component[];
|
|
32
|
-
};
|
|
33
|
-
export type GroupComponent = BaseComponent & GroupComponentStyle & {
|
|
34
|
-
component: 'group';
|
|
35
|
-
title?: string;
|
|
36
|
-
children: Component[];
|
|
37
|
-
headers?: GroupHeaderComponent[];
|
|
38
|
-
labels?: Array<{
|
|
39
|
-
text: string;
|
|
40
|
-
}>;
|
|
41
|
-
editableTitle: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* If set, allows the group to be collapsed,
|
|
44
|
-
* by default set to the given state
|
|
45
|
-
*/
|
|
46
|
-
defaultCollapsibleState?: DefaultGroupCollapsedState;
|
|
47
|
-
};
|
|
48
|
-
export type LabelComponent = BaseComponent & {
|
|
49
|
-
component: 'label';
|
|
50
|
-
bold?: boolean;
|
|
51
|
-
text: string;
|
|
52
|
-
};
|
|
53
|
-
export type RectComponent = BaseComponent & {
|
|
54
|
-
component: 'rect';
|
|
55
|
-
color: string;
|
|
56
|
-
/**
|
|
57
|
-
* Set to true if the component should increase its size to fill the available space.
|
|
58
|
-
*/
|
|
59
|
-
grow?: boolean;
|
|
60
|
-
};
|
|
61
|
-
export type SliderButtonComponent = BaseComponent & {
|
|
62
|
-
component: 'slider_button';
|
|
63
|
-
min: number;
|
|
64
|
-
max: number;
|
|
65
|
-
step: number;
|
|
66
|
-
value: number | null;
|
|
67
|
-
gradient?: Gradient;
|
|
68
|
-
/**
|
|
69
|
-
* Set to true if the component should increase its size to fill the available space.
|
|
70
|
-
*/
|
|
71
|
-
grow?: boolean;
|
|
72
|
-
};
|
|
73
|
-
export type SwitchComponent = BaseComponent & {
|
|
74
|
-
component: 'switch';
|
|
75
|
-
state: 'on' | 'off';
|
|
76
|
-
};
|
|
77
|
-
export type TabComponent = BaseComponent & {
|
|
78
|
-
component: 'tab';
|
|
79
|
-
name: string;
|
|
80
|
-
child?: Component;
|
|
81
|
-
};
|
|
82
|
-
export type TabsComponent = BaseComponent & {
|
|
83
|
-
component: 'tabs';
|
|
84
|
-
tabs: TabComponent[];
|
|
85
|
-
};
|
|
86
|
-
export type TextInputComponent = BaseComponent & {
|
|
87
|
-
component: 'text-input';
|
|
88
|
-
value: string;
|
|
89
|
-
};
|
|
90
|
-
export type TimelineState = {
|
|
91
|
-
state: 'playing';
|
|
92
|
-
totalTimeMillis: number;
|
|
93
|
-
effectiveStartTime: number;
|
|
94
|
-
speed: number;
|
|
95
|
-
} | {
|
|
96
|
-
state: 'stopped';
|
|
97
|
-
totalTimeMillis: number;
|
|
98
|
-
currentTimeMillis: number;
|
|
99
|
-
};
|
|
100
|
-
export type TimelineComponent = BaseComponent & {
|
|
101
|
-
component: 'timeline';
|
|
102
|
-
state: TimelineState;
|
|
103
|
-
title?: string;
|
|
104
|
-
subtitles?: string[];
|
|
105
|
-
source?: {
|
|
106
|
-
name: string;
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
export type Component = ButtonComponent | GroupHeaderComponent | GroupComponent | LabelComponent | RectComponent | SliderButtonComponent | SwitchComponent | TabComponent | TabsComponent | TextInputComponent | TimelineComponent;
|
|
110
|
-
export type SendTreeMsg = {
|
|
7
|
+
type AnyComponentProto = BaseComponentProto<string>;
|
|
8
|
+
type SendTreeMsg = {
|
|
111
9
|
type: 'tree-full';
|
|
112
|
-
root:
|
|
10
|
+
root: BaseComponentProto<string>;
|
|
113
11
|
};
|
|
114
|
-
|
|
12
|
+
type UpdateTreeMsg = {
|
|
115
13
|
type: 'tree-diff';
|
|
116
|
-
diff: Diff<
|
|
14
|
+
diff: Diff<BaseComponentProto<string>>;
|
|
117
15
|
};
|
|
118
|
-
|
|
119
|
-
|
|
16
|
+
type ServerMessage = SendTreeMsg | UpdateTreeMsg;
|
|
17
|
+
type BaseClientComponentMessage<Namespace extends string> = {
|
|
120
18
|
type: 'component-message';
|
|
19
|
+
namespace: Namespace;
|
|
121
20
|
componentKey: number;
|
|
122
21
|
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
export type
|
|
127
|
-
component: 'group';
|
|
128
|
-
title: string;
|
|
129
|
-
};
|
|
130
|
-
export type SliderButtonUpdateMessage = BaseClientComponentMessage & {
|
|
131
|
-
component: 'slider_button';
|
|
132
|
-
value: number;
|
|
133
|
-
};
|
|
134
|
-
export type SwitchToggleMessage = BaseClientComponentMessage & {
|
|
135
|
-
component: 'switch';
|
|
136
|
-
};
|
|
137
|
-
export type TextInputUpdateMessage = BaseClientComponentMessage & {
|
|
138
|
-
component: 'text-input';
|
|
139
|
-
value: string;
|
|
140
|
-
};
|
|
141
|
-
export type ClientComponentMessage = ButtonPressMessage | GroupTitleChangeMessage | SliderButtonUpdateMessage | SwitchToggleMessage | TextInputUpdateMessage;
|
|
142
|
-
export type ClientMessage = ClientComponentMessage;
|
|
143
|
-
export {};
|
|
22
|
+
type AnyClientComponentMessage = BaseClientComponentMessage<string>;
|
|
23
|
+
type ClientMessage = AnyClientComponentMessage;
|
|
24
|
+
|
|
25
|
+
export type { AnyClientComponentMessage, AnyComponentProto, BaseClientComponentMessage, BaseComponentProto, ClientMessage, SendTreeMsg, ServerMessage, UpdateTreeMsg };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/index.mjs
ADDED
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Logger = {
|
|
2
|
+
debug: (message: string, ...args: unknown[]) => void;
|
|
3
|
+
info: (message: string, ...args: unknown[]) => void;
|
|
4
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
5
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type { Logger };
|
package/dist/logging.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
type Logger = {
|
|
2
2
|
debug: (message: string, ...args: unknown[]) => void;
|
|
3
3
|
info: (message: string, ...args: unknown[]) => void;
|
|
4
4
|
warn: (message: string, ...args: unknown[]) => void;
|
|
5
5
|
error: (message: string, ...args: unknown[]) => void;
|
|
6
6
|
};
|
|
7
|
+
|
|
8
|
+
export type { Logger };
|
package/dist/logging.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/logging.mjs
ADDED
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styling options for the [[Group]] component
|
|
3
|
+
*
|
|
4
|
+
* Default Styling: [[GROUP_DEFAULT_STYLE]]
|
|
5
|
+
*/
|
|
6
|
+
type GroupComponentStyle = {
|
|
7
|
+
/**
|
|
8
|
+
* In which way should child components of this group be organized?
|
|
9
|
+
*/
|
|
10
|
+
direction: 'horizontal' | 'vertical';
|
|
11
|
+
/**
|
|
12
|
+
* If true, when the group runs out of vertical or horizontal space, child
|
|
13
|
+
* components will be wrapped, and start to be arranged on additional columns
|
|
14
|
+
* or rows.
|
|
15
|
+
*/
|
|
16
|
+
wrap?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* If true, this group will have a border and a different color background
|
|
19
|
+
* to its parent.
|
|
20
|
+
*
|
|
21
|
+
* This allows you to add a distinctive border between components,
|
|
22
|
+
* without needing to set a header, add header components,
|
|
23
|
+
* or make it collapsible.
|
|
24
|
+
*/
|
|
25
|
+
border?: true;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Styling options for the [[Label]] component
|
|
29
|
+
*
|
|
30
|
+
* Default Styling: [[LABEL_DEFAULT_STYLE]]
|
|
31
|
+
*/
|
|
32
|
+
type LabelComponentStyle = {
|
|
33
|
+
/**
|
|
34
|
+
* If true, make the text of this label bold
|
|
35
|
+
*/
|
|
36
|
+
bold?: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type { GroupComponentStyle, LabelComponentStyle };
|
package/dist/styles.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Default Styling: [[GROUP_DEFAULT_STYLE]]
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
type GroupComponentStyle = {
|
|
7
7
|
/**
|
|
8
8
|
* In which way should child components of this group be organized?
|
|
9
9
|
*/
|
|
@@ -29,9 +29,11 @@ export type GroupComponentStyle = {
|
|
|
29
29
|
*
|
|
30
30
|
* Default Styling: [[LABEL_DEFAULT_STYLE]]
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
type LabelComponentStyle = {
|
|
33
33
|
/**
|
|
34
34
|
* If true, make the text of this label bold
|
|
35
35
|
*/
|
|
36
36
|
bold?: boolean;
|
|
37
37
|
};
|
|
38
|
+
|
|
39
|
+
export type { GroupComponentStyle, LabelComponentStyle };
|
package/dist/styles.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/styles.mjs
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcanejs/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JSON protocol types for the @arcanejs Toolkit",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
"@arcanejs/source": "./src/index.ts",
|
|
18
18
|
"types": "./dist/index.d.ts"
|
|
19
19
|
},
|
|
20
|
+
"./core": {
|
|
21
|
+
"@arcanejs/source": "./src/core.ts",
|
|
22
|
+
"types": "./dist/core.d.ts",
|
|
23
|
+
"import": "./dist/core.mjs",
|
|
24
|
+
"require": "./dist/core.js"
|
|
25
|
+
},
|
|
20
26
|
"./logging": {
|
|
21
27
|
"@arcanejs/source": "./src/logging.ts",
|
|
22
28
|
"types": "./dist/logging.d.ts"
|
|
@@ -27,15 +33,18 @@
|
|
|
27
33
|
},
|
|
28
34
|
"./package.json": "./package.json"
|
|
29
35
|
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@arcanejs/diff": "^0.5.1"
|
|
38
|
+
},
|
|
30
39
|
"devDependencies": {
|
|
31
40
|
"@types/eslint": "^8.56.5",
|
|
32
41
|
"@types/jest": "^29.5.12",
|
|
33
42
|
"check-export-map": "^1.3.1",
|
|
34
43
|
"eslint": "^8.57.0",
|
|
44
|
+
"tsup": "^8.1.0",
|
|
35
45
|
"typescript": "^5.3.3",
|
|
36
|
-
"@arcanejs/
|
|
37
|
-
"@arcanejs/eslint-config": "^0.0.0"
|
|
38
|
-
"@arcanejs/typescript-config": "^0.0.0"
|
|
46
|
+
"@arcanejs/typescript-config": "^0.0.0",
|
|
47
|
+
"@arcanejs/eslint-config": "^0.0.0"
|
|
39
48
|
},
|
|
40
49
|
"files": [
|
|
41
50
|
"dist"
|
|
@@ -45,6 +54,6 @@
|
|
|
45
54
|
},
|
|
46
55
|
"scripts": {
|
|
47
56
|
"lint": "eslint . --max-warnings 0",
|
|
48
|
-
"build": "rm -rf dist &&
|
|
57
|
+
"build": "rm -rf dist && tsup && check-export-map"
|
|
49
58
|
}
|
|
50
59
|
}
|