@rainbow-robotics/plugin-ui 0.1.2-dev.9 → 1.0.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/README.md +236 -75
- package/build-dist.mjs +55 -17
- package/dist/host-ui.d.ts +49 -0
- package/dist/host-ui.d.ts.map +1 -0
- package/dist/host-ui.js +33 -0
- package/dist/host-ui.js.map +7 -0
- package/dist/manifest.d.ts +20 -4
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +1 -1
- package/dist/manifest.js.map +2 -2
- package/dist/pluginData.d.ts +62 -0
- package/dist/pluginData.d.ts.map +1 -0
- package/dist/react.d.ts +3436 -36
- package/dist/react.js +5 -54
- package/dist/react.js.map +2 -2
- package/dist/sdk.d.ts +38 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +29 -4
- package/dist/sdk.js.map +2 -2
- package/dist/viteHost.d.ts +46 -0
- package/dist/viteHost.d.ts.map +1 -0
- package/dist/viteHost.js +262 -0
- package/dist/viteHost.js.map +7 -0
- package/dist/ws.d.ts +53 -0
- package/dist/ws.d.ts.map +1 -1
- package/dist/ws.js +141 -0
- package/dist/ws.js.map +7 -0
- package/package.json +45 -21
- package/src/host-ui.ts +80 -0
- package/src/host.tsx +229 -308
- package/src/index.d.ts +1 -0
- package/src/manifest.ts +25 -4
- package/src/pluginData.tsx +232 -0
- package/src/react.tsx +9 -127
- package/src/sdk.ts +81 -13
- package/src/viteHost.ts +309 -0
- package/src/ws.ts +127 -20
- package/build-browser.mjs +0 -84
- package/dist/connect.d.ts +0 -11
- package/dist/connect.d.ts.map +0 -1
- package/dist/connect.js +0 -34
- package/dist/connect.js.map +0 -7
- package/dist/elements.d.ts +0 -195
- package/dist/elements.d.ts.map +0 -1
- package/dist/elements.js +0 -115
- package/dist/elements.js.map +0 -7
- package/dist/react.d.ts.map +0 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/chunks/chunk-37HVFFJB.js +0 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/chunks/chunk-4MGSRUAS.js +0 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/chunks/chunk-Q6XGCIPE.js +0 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/connect.js +0 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/elements.js +0 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/react.js +0 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/sdk.js +0 -1
- package/dist-browser/vendor/react-dom-client.js +0 -1
- package/dist-browser/vendor/react-jsx-dev-runtime.js +0 -1
- package/dist-browser/vendor/react-jsx-runtime.js +0 -1
- package/dist-browser/vendor/react-runtime.js +0 -65
- package/dist-browser/vendor/react.js +0 -1
- package/src/connect.ts +0 -62
- package/src/elements.ts +0 -257
package/src/elements.ts
DELETED
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* rb-* remote element contract — shared by the sandbox (plugin author) and the
|
|
3
|
-
* nexus host. This is the *stable* surface: it must only ever grow additively
|
|
4
|
-
* (new elements / new optional properties), never break existing shapes.
|
|
5
|
-
*
|
|
6
|
-
* Verified against @remote-dom/core@1.11.x:
|
|
7
|
-
* - `RemoteElement` lives in `@remote-dom/core/elements`
|
|
8
|
-
* - static `remoteProperties` (data) + static `remoteEvents` (callbacks)
|
|
9
|
-
*/
|
|
10
|
-
import { RemoteElement } from "@remote-dom/core/elements";
|
|
11
|
-
|
|
12
|
-
type RbNoMethods = Record<never, never>;
|
|
13
|
-
type RbNoSlots = Record<never, never>;
|
|
14
|
-
type RbNoEvents = Record<never, never>;
|
|
15
|
-
|
|
16
|
-
export interface RbSliderProps {
|
|
17
|
-
value?: number;
|
|
18
|
-
min?: number;
|
|
19
|
-
max?: number;
|
|
20
|
-
step?: number;
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface RbButtonProps {
|
|
25
|
-
label?: string;
|
|
26
|
-
variant?: string;
|
|
27
|
-
size?: string;
|
|
28
|
-
disabled?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface RbIconButtonProps {
|
|
32
|
-
icon?: string;
|
|
33
|
-
variant?: string;
|
|
34
|
-
size?: string;
|
|
35
|
-
disabled?: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export type RbTextProps = Record<never, never>;
|
|
39
|
-
|
|
40
|
-
export interface RbTextInputProps {
|
|
41
|
-
value?: string;
|
|
42
|
-
placeholder?: string;
|
|
43
|
-
disabled?: boolean;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface RbSwitchProps {
|
|
47
|
-
checked?: boolean;
|
|
48
|
-
disabled?: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** Option shape carried by `rb-select`'s `options` property. */
|
|
52
|
-
export interface RbSelectOption {
|
|
53
|
-
value: string;
|
|
54
|
-
label: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface RbSelectProps {
|
|
58
|
-
value?: string;
|
|
59
|
-
options?: RbSelectOption[];
|
|
60
|
-
placeholder?: string;
|
|
61
|
-
disabled?: boolean;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface RbSliderEvents {
|
|
65
|
-
change(detail: number): void;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface RbPressEvents {
|
|
69
|
-
press(): void;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface RbTextInputEvents {
|
|
73
|
-
input(detail: string): void;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface RbSwitchEvents {
|
|
77
|
-
change(detail: boolean): void;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface RbSelectEvents {
|
|
81
|
-
change(detail: string): void;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** Slider → host renders RBSlider (Radix array value, single-thumb contract). */
|
|
85
|
-
export class RbSliderElement extends RemoteElement<
|
|
86
|
-
RbSliderProps,
|
|
87
|
-
RbNoMethods,
|
|
88
|
-
RbNoSlots,
|
|
89
|
-
RbSliderEvents
|
|
90
|
-
> {
|
|
91
|
-
static get remoteProperties() {
|
|
92
|
-
return {
|
|
93
|
-
value: { type: Number },
|
|
94
|
-
min: { type: Number },
|
|
95
|
-
max: { type: Number },
|
|
96
|
-
step: { type: Number },
|
|
97
|
-
disabled: { type: Boolean },
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
static get remoteEvents() {
|
|
101
|
-
return ["change"] as const;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/** Button → host renders RBLabelButton. */
|
|
106
|
-
export class RbButtonElement extends RemoteElement<
|
|
107
|
-
RbButtonProps,
|
|
108
|
-
RbNoMethods,
|
|
109
|
-
RbNoSlots,
|
|
110
|
-
RbPressEvents
|
|
111
|
-
> {
|
|
112
|
-
static get remoteProperties() {
|
|
113
|
-
return {
|
|
114
|
-
label: { type: String },
|
|
115
|
-
variant: { type: String },
|
|
116
|
-
size: { type: String },
|
|
117
|
-
disabled: { type: Boolean },
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
static get remoteEvents() {
|
|
121
|
-
return ["press"] as const;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** Icon button → host renders RBIconButton with an icon resolved from RBIcons. */
|
|
126
|
-
export class RbIconButtonElement extends RemoteElement<
|
|
127
|
-
RbIconButtonProps,
|
|
128
|
-
RbNoMethods,
|
|
129
|
-
RbNoSlots,
|
|
130
|
-
RbPressEvents
|
|
131
|
-
> {
|
|
132
|
-
static get remoteProperties() {
|
|
133
|
-
return {
|
|
134
|
-
icon: { type: String },
|
|
135
|
-
variant: { type: String },
|
|
136
|
-
size: { type: String },
|
|
137
|
-
disabled: { type: Boolean },
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
static get remoteEvents() {
|
|
141
|
-
return ["press"] as const;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/** Plain text — renders its children as text on the host. */
|
|
146
|
-
export class RbTextElement extends RemoteElement<
|
|
147
|
-
RbTextProps,
|
|
148
|
-
RbNoMethods,
|
|
149
|
-
RbNoSlots,
|
|
150
|
-
RbNoEvents
|
|
151
|
-
> {
|
|
152
|
-
static get remoteProperties() {
|
|
153
|
-
return {};
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** Text input → host renders RBTextInput. */
|
|
158
|
-
export class RbTextInputElement extends RemoteElement<
|
|
159
|
-
RbTextInputProps,
|
|
160
|
-
RbNoMethods,
|
|
161
|
-
RbNoSlots,
|
|
162
|
-
RbTextInputEvents
|
|
163
|
-
> {
|
|
164
|
-
static get remoteProperties() {
|
|
165
|
-
return {
|
|
166
|
-
value: { type: String },
|
|
167
|
-
placeholder: { type: String },
|
|
168
|
-
disabled: { type: Boolean },
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
static get remoteEvents() {
|
|
172
|
-
return ["input"] as const;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/** Switch → host renders RBSwitch. */
|
|
177
|
-
export class RbSwitchElement extends RemoteElement<
|
|
178
|
-
RbSwitchProps,
|
|
179
|
-
RbNoMethods,
|
|
180
|
-
RbNoSlots,
|
|
181
|
-
RbSwitchEvents
|
|
182
|
-
> {
|
|
183
|
-
static get remoteProperties() {
|
|
184
|
-
return {
|
|
185
|
-
checked: { type: Boolean },
|
|
186
|
-
disabled: { type: Boolean },
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
static get remoteEvents() {
|
|
190
|
-
return ["change"] as const;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/** Select → host renders RBSelectBox. `options` is `[{value,label}]`. */
|
|
195
|
-
export class RbSelectElement extends RemoteElement<
|
|
196
|
-
RbSelectProps,
|
|
197
|
-
RbNoMethods,
|
|
198
|
-
RbNoSlots,
|
|
199
|
-
RbSelectEvents
|
|
200
|
-
> {
|
|
201
|
-
static get remoteProperties() {
|
|
202
|
-
return {
|
|
203
|
-
value: { type: String },
|
|
204
|
-
options: { type: Array },
|
|
205
|
-
placeholder: { type: String },
|
|
206
|
-
disabled: { type: Boolean },
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
static get remoteEvents() {
|
|
210
|
-
return ["change"] as const;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/** Custom element tag names in the contract. */
|
|
215
|
-
export const RB_ELEMENT_NAMES = [
|
|
216
|
-
"rb-slider",
|
|
217
|
-
"rb-button",
|
|
218
|
-
"rb-icon-button",
|
|
219
|
-
"rb-text",
|
|
220
|
-
"rb-text-input",
|
|
221
|
-
"rb-switch",
|
|
222
|
-
"rb-select",
|
|
223
|
-
] as const;
|
|
224
|
-
|
|
225
|
-
export type RbElementName = (typeof RB_ELEMENT_NAMES)[number];
|
|
226
|
-
|
|
227
|
-
declare global {
|
|
228
|
-
interface HTMLElementTagNameMap {
|
|
229
|
-
"rb-slider": RbSliderElement;
|
|
230
|
-
"rb-button": RbButtonElement;
|
|
231
|
-
"rb-icon-button": RbIconButtonElement;
|
|
232
|
-
"rb-text": RbTextElement;
|
|
233
|
-
"rb-text-input": RbTextInputElement;
|
|
234
|
-
"rb-switch": RbSwitchElement;
|
|
235
|
-
"rb-select": RbSelectElement;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
let defined = false;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Registers the rb-* custom elements. Safe to call multiple times; only the
|
|
243
|
-
* first call defines anything (subsequent calls are a no-op).
|
|
244
|
-
*/
|
|
245
|
-
export function defineElements(): void {
|
|
246
|
-
if (defined || typeof customElements === "undefined") return;
|
|
247
|
-
|
|
248
|
-
defined = true;
|
|
249
|
-
|
|
250
|
-
customElements.define("rb-slider", RbSliderElement);
|
|
251
|
-
customElements.define("rb-button", RbButtonElement);
|
|
252
|
-
customElements.define("rb-icon-button", RbIconButtonElement);
|
|
253
|
-
customElements.define("rb-text", RbTextElement);
|
|
254
|
-
customElements.define("rb-text-input", RbTextInputElement);
|
|
255
|
-
customElements.define("rb-switch", RbSwitchElement);
|
|
256
|
-
customElements.define("rb-select", RbSelectElement);
|
|
257
|
-
}
|