@bonsae/nrg 0.22.0 → 0.22.2

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.
@@ -0,0 +1,132 @@
1
+ import { type PropType } from "vue";
2
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ modelValue: {
4
+ type: (StringConstructor | ArrayConstructor)[];
5
+ default: undefined;
6
+ };
7
+ value: {
8
+ type: (StringConstructor | ArrayConstructor)[];
9
+ default: () => string;
10
+ };
11
+ options: {
12
+ type: PropType<Array<{
13
+ value: string;
14
+ label: string;
15
+ }>>;
16
+ required: true;
17
+ validator: (value: Array<{
18
+ value: string;
19
+ label: string;
20
+ }>) => boolean;
21
+ };
22
+ multiple: {
23
+ type: BooleanConstructor;
24
+ default: boolean;
25
+ };
26
+ label: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ icon: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ required: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ error: {
39
+ type: StringConstructor;
40
+ default: string;
41
+ };
42
+ }>, {
43
+ selectWidget: import("vue").ShallowRef<any, any>;
44
+ }, {}, {
45
+ effectiveValue(): string | unknown[];
46
+ }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:value")[], "update:modelValue" | "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
47
+ modelValue: {
48
+ type: (StringConstructor | ArrayConstructor)[];
49
+ default: undefined;
50
+ };
51
+ value: {
52
+ type: (StringConstructor | ArrayConstructor)[];
53
+ default: () => string;
54
+ };
55
+ options: {
56
+ type: PropType<Array<{
57
+ value: string;
58
+ label: string;
59
+ }>>;
60
+ required: true;
61
+ validator: (value: Array<{
62
+ value: string;
63
+ label: string;
64
+ }>) => boolean;
65
+ };
66
+ multiple: {
67
+ type: BooleanConstructor;
68
+ default: boolean;
69
+ };
70
+ label: {
71
+ type: StringConstructor;
72
+ default: string;
73
+ };
74
+ icon: {
75
+ type: StringConstructor;
76
+ default: string;
77
+ };
78
+ required: {
79
+ type: BooleanConstructor;
80
+ default: boolean;
81
+ };
82
+ error: {
83
+ type: StringConstructor;
84
+ default: string;
85
+ };
86
+ }>> & Readonly<{
87
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
88
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
89
+ }>, {
90
+ label: string;
91
+ icon: string;
92
+ required: boolean;
93
+ modelValue: string | unknown[];
94
+ value: string | unknown[];
95
+ error: string;
96
+ multiple: boolean;
97
+ }, {}, {
98
+ NodeRedInputLabel: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
99
+ label: {
100
+ type: StringConstructor;
101
+ default: string;
102
+ };
103
+ icon: {
104
+ type: StringConstructor;
105
+ default: string;
106
+ };
107
+ required: {
108
+ type: BooleanConstructor;
109
+ default: boolean;
110
+ };
111
+ }>, {}, {}, {
112
+ iconClass(): string;
113
+ }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
114
+ label: {
115
+ type: StringConstructor;
116
+ default: string;
117
+ };
118
+ icon: {
119
+ type: StringConstructor;
120
+ default: string;
121
+ };
122
+ required: {
123
+ type: BooleanConstructor;
124
+ default: boolean;
125
+ };
126
+ }>> & Readonly<{}>, {
127
+ label: string;
128
+ icon: string;
129
+ required: boolean;
130
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
131
+ }, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
132
+ export default _default;
@@ -0,0 +1,36 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ modelValue: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ label: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ icon: {
11
+ type: StringConstructor;
12
+ default: string;
13
+ };
14
+ }>, {}, {}, {
15
+ iconClass(): string;
16
+ }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
17
+ modelValue: {
18
+ type: BooleanConstructor;
19
+ default: boolean;
20
+ };
21
+ label: {
22
+ type: StringConstructor;
23
+ default: string;
24
+ };
25
+ icon: {
26
+ type: StringConstructor;
27
+ default: string;
28
+ };
29
+ }>> & Readonly<{
30
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
31
+ }>, {
32
+ label: string;
33
+ icon: string;
34
+ modelValue: boolean;
35
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
36
+ export default _default;
@@ -0,0 +1,151 @@
1
+ import { type PropType } from "vue";
2
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ modelValue: {
4
+ type: PropType<{
5
+ value: string;
6
+ type: string;
7
+ } | undefined>;
8
+ default: undefined;
9
+ validator: (obj: {
10
+ value: string;
11
+ type: string;
12
+ } | undefined) => boolean;
13
+ };
14
+ value: {
15
+ type: PropType<{
16
+ value: string;
17
+ type: string;
18
+ } | undefined>;
19
+ default: undefined;
20
+ validator: (obj: {
21
+ value: string;
22
+ type: string;
23
+ } | undefined) => boolean;
24
+ };
25
+ types: {
26
+ type: PropType<(NodeRED.DefaultTypedInputType | NodeRED.TypedInputTypeDefinition)[]>;
27
+ default: () => readonly ["msg", "flow", "global", "str", "num", "bool", "json", "bin", "re", "jsonata", "date", "env", "node", "cred"];
28
+ };
29
+ label: {
30
+ type: StringConstructor;
31
+ default: string;
32
+ };
33
+ icon: {
34
+ type: StringConstructor;
35
+ default: string;
36
+ };
37
+ required: {
38
+ type: BooleanConstructor;
39
+ default: boolean;
40
+ };
41
+ error: {
42
+ type: StringConstructor;
43
+ default: string;
44
+ };
45
+ }>, {
46
+ inputWidget: import("vue").ShallowRef<any, any>;
47
+ mutationObserver: import("vue").ShallowRef<MutationObserver | null, MutationObserver | null>;
48
+ }, {}, {
49
+ effectiveValue(): {
50
+ value: string;
51
+ type: string;
52
+ };
53
+ isProvidedValueTypeValid(): boolean;
54
+ }, {
55
+ onChange(): void;
56
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:value")[], "update:modelValue" | "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
57
+ modelValue: {
58
+ type: PropType<{
59
+ value: string;
60
+ type: string;
61
+ } | undefined>;
62
+ default: undefined;
63
+ validator: (obj: {
64
+ value: string;
65
+ type: string;
66
+ } | undefined) => boolean;
67
+ };
68
+ value: {
69
+ type: PropType<{
70
+ value: string;
71
+ type: string;
72
+ } | undefined>;
73
+ default: undefined;
74
+ validator: (obj: {
75
+ value: string;
76
+ type: string;
77
+ } | undefined) => boolean;
78
+ };
79
+ types: {
80
+ type: PropType<(NodeRED.DefaultTypedInputType | NodeRED.TypedInputTypeDefinition)[]>;
81
+ default: () => readonly ["msg", "flow", "global", "str", "num", "bool", "json", "bin", "re", "jsonata", "date", "env", "node", "cred"];
82
+ };
83
+ label: {
84
+ type: StringConstructor;
85
+ default: string;
86
+ };
87
+ icon: {
88
+ type: StringConstructor;
89
+ default: string;
90
+ };
91
+ required: {
92
+ type: BooleanConstructor;
93
+ default: boolean;
94
+ };
95
+ error: {
96
+ type: StringConstructor;
97
+ default: string;
98
+ };
99
+ }>> & Readonly<{
100
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
101
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
102
+ }>, {
103
+ label: string;
104
+ icon: string;
105
+ required: boolean;
106
+ modelValue: {
107
+ value: string;
108
+ type: string;
109
+ } | undefined;
110
+ value: {
111
+ value: string;
112
+ type: string;
113
+ } | undefined;
114
+ error: string;
115
+ types: ("msg" | "flow" | "global" | "str" | "num" | "bool" | "json" | "bin" | "re" | "jsonata" | "date" | "env" | "node" | "cred" | NodeRED.TypedInputTypeDefinition)[];
116
+ }, {}, {
117
+ NodeRedInputLabel: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
118
+ label: {
119
+ type: StringConstructor;
120
+ default: string;
121
+ };
122
+ icon: {
123
+ type: StringConstructor;
124
+ default: string;
125
+ };
126
+ required: {
127
+ type: BooleanConstructor;
128
+ default: boolean;
129
+ };
130
+ }>, {}, {}, {
131
+ iconClass(): string;
132
+ }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
133
+ label: {
134
+ type: StringConstructor;
135
+ default: string;
136
+ };
137
+ icon: {
138
+ type: StringConstructor;
139
+ default: string;
140
+ };
141
+ required: {
142
+ type: BooleanConstructor;
143
+ default: boolean;
144
+ };
145
+ }>> & Readonly<{}>, {
146
+ label: string;
147
+ icon: string;
148
+ required: boolean;
149
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
150
+ }, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
151
+ export default _default;
@@ -0,0 +1,320 @@
1
+ /**
2
+ * Global type declarations for the Node-RED editor environment.
3
+ * These are provided by Node-RED at runtime, not imported.
4
+ *
5
+ * Based on: https://github.com/GogoVega/node-red/blob/33d83d016a0c990c/packages/node_modules/%40node-red/editor-client/types/index.d.ts
6
+ */
7
+
8
+ /// <reference types="jquery" />
9
+
10
+ // ---------------------------------------------------------------------------
11
+ // jQuery Node-RED widget extensions
12
+ // ---------------------------------------------------------------------------
13
+
14
+ interface JQuery<TElement = HTMLElement> {
15
+ // Node-RED TypedInput widget
16
+ typedInput(options: NodeRED.TypedInputOptions): this;
17
+ typedInput(action: "value"): string;
18
+ typedInput(action: "value", value: string): void;
19
+ typedInput(action: "type"): string;
20
+ typedInput(action: "type", value: string): void;
21
+ typedInput(action: "types", value: any[]): void;
22
+ typedInput(action: "validate"): boolean;
23
+ typedInput(
24
+ action: "validate",
25
+ options: { returnErrorMessage: boolean },
26
+ ): string | boolean;
27
+ typedInput(action: "disable", value?: boolean): void;
28
+ typedInput(action: "enable"): void;
29
+ typedInput(action: "focus"): void;
30
+ typedInput(action: "hide"): void;
31
+ typedInput(action: "show"): void;
32
+ typedInput(action: "width", value: string | number): void;
33
+
34
+ // Node-RED i18n
35
+ i18n(): this;
36
+ }
37
+
38
+ // ---------------------------------------------------------------------------
39
+ // Node-RED editor types
40
+ // ---------------------------------------------------------------------------
41
+
42
+ declare namespace NodeRED {
43
+ type UID = string;
44
+
45
+ // -- Nodes --
46
+
47
+ interface BaseNode {
48
+ id: UID;
49
+ type: string;
50
+ changed: boolean;
51
+ z?: string;
52
+ _def: any;
53
+ [key: string]: any;
54
+ }
55
+
56
+ interface Node extends BaseNode {
57
+ x: number;
58
+ y: number;
59
+ w: number;
60
+ h: number;
61
+ name: string;
62
+ wires: UID[][];
63
+ inputs: number;
64
+ outputs: number;
65
+ g?: string;
66
+ _: (key: string) => string;
67
+ }
68
+
69
+ interface ConfigNode extends BaseNode {
70
+ name: string;
71
+ credentials?: Record<string, any>;
72
+ users: BaseNode[];
73
+ _def: {
74
+ category: "config";
75
+ [key: string]: any;
76
+ };
77
+ }
78
+
79
+ interface Link {
80
+ source: BaseNode;
81
+ target: BaseNode;
82
+ sourcePort: number;
83
+ }
84
+
85
+ interface Workspace {
86
+ id: UID;
87
+ type: "tab";
88
+ label: string;
89
+ disabled: boolean;
90
+ info: string;
91
+ }
92
+
93
+ // -- Editor --
94
+
95
+ interface EditorOptions {
96
+ id: string;
97
+ stateId?: string;
98
+ mode?: string;
99
+ value?: string;
100
+ focus?: boolean;
101
+ globals?: Record<string, boolean>;
102
+ }
103
+
104
+ interface TrayButton {
105
+ id?: string;
106
+ class?: string;
107
+ click?: (event: JQuery.ClickEvent) => void;
108
+ text?: string;
109
+ }
110
+
111
+ interface TrayOptions {
112
+ title?: string;
113
+ buttons?: TrayButton[];
114
+ focusElement?: boolean;
115
+ maximized?: boolean;
116
+ width?: "inherit" | number | string;
117
+ overlay?: boolean;
118
+ open?: (tray: JQuery, done?: () => void) => void;
119
+ close?: () => void;
120
+ resize?: (options: { width: number; height?: number }) => void;
121
+ show?: () => void;
122
+ }
123
+
124
+ // -- Popover --
125
+
126
+ interface PopoverOptions {
127
+ target: JQuery;
128
+ direction?: string;
129
+ trigger?: "hover" | "click" | "modal";
130
+ content: string | JQuery | (() => string | JQuery);
131
+ delay?: { show: number; hide: number };
132
+ autoClose?: number;
133
+ width?: number | string;
134
+ maxWidth?: number | string;
135
+ tooltip?: boolean;
136
+ interactive?: boolean;
137
+ class?: string;
138
+ }
139
+
140
+ interface PopoverInstance {
141
+ readonly element: JQuery | null;
142
+ close(instant?: boolean): PopoverInstance;
143
+ open(instant?: boolean): PopoverInstance;
144
+ setContent(content: PopoverOptions["content"]): PopoverInstance;
145
+ move(options: Partial<PopoverOptions>): void;
146
+ }
147
+
148
+ interface TooltipInstance extends PopoverInstance {
149
+ delete(): void;
150
+ setAction(action: string): void;
151
+ }
152
+
153
+ // -- Notifications --
154
+
155
+ interface NotificationOptions {
156
+ type?: "warning" | "compact" | "success" | "error";
157
+ fixed?: boolean;
158
+ modal?: boolean;
159
+ timeout?: number;
160
+ buttons?: Array<{
161
+ text: string;
162
+ class?: string;
163
+ click?: (event: JQuery.ClickEvent) => void;
164
+ }>;
165
+ id?: string;
166
+ }
167
+
168
+ interface NotificationElement {
169
+ update(msg: string | JQuery, options?: NotificationOptions): void;
170
+ close(): void;
171
+ }
172
+
173
+ // -- TypedInput --
174
+
175
+ type DefaultTypedInputType =
176
+ (typeof import("../constants").TYPED_INPUT_TYPES)[number];
177
+
178
+ interface TypedInputTypeDefinition {
179
+ value?: string;
180
+ label?: string;
181
+ icon?: string;
182
+ hasValue?: boolean;
183
+ multiple?: boolean;
184
+ options?: string[] | Array<{ value: string; label: string }>;
185
+ validate?: ((value: string) => boolean) | RegExp;
186
+ valueLabel?: (container: JQuery, value: string) => void;
187
+ autoComplete?: (
188
+ value: string,
189
+ done: (result?: Array<{ value: string; label: string | JQuery }>) => void,
190
+ ) => void;
191
+ }
192
+
193
+ interface TypedInputOptions {
194
+ default?: DefaultTypedInputType | string;
195
+ types: Array<DefaultTypedInputType | TypedInputTypeDefinition>;
196
+ typeField?: JQuery.Selector | JQuery;
197
+ }
198
+ }
199
+
200
+ // ---------------------------------------------------------------------------
201
+ // RED global object
202
+ // ---------------------------------------------------------------------------
203
+
204
+ declare const RED: {
205
+ /** Internationalization / translation function */
206
+ _: (key: string, substitutions?: Record<string, string>) => string;
207
+
208
+ /** Node management */
209
+ nodes: {
210
+ registerType(type: string, definition: any): void;
211
+ node(id: NodeRED.UID): NodeRED.BaseNode | null;
212
+ dirty(): boolean;
213
+ dirty(dirty: boolean): void;
214
+ eachNode(callback: (node: NodeRED.Node) => void | false): void;
215
+ eachConfig(callback: (node: NodeRED.ConfigNode) => void | false): void;
216
+ filterNodes(filter: { z?: NodeRED.UID; type?: string }): NodeRED.BaseNode[];
217
+ filterLinks(filter: {
218
+ source?: NodeRED.BaseNode;
219
+ target?: NodeRED.BaseNode;
220
+ }): NodeRED.Link[];
221
+ getType(type: string): any;
222
+ id(): NodeRED.UID;
223
+ add(node: any): NodeRED.BaseNode;
224
+ remove(id: NodeRED.UID): {
225
+ links: NodeRED.Link[];
226
+ nodes: NodeRED.BaseNode[];
227
+ };
228
+ };
229
+
230
+ /** Code editor (ACE/Monaco) */
231
+ editor: {
232
+ createEditor(options: NodeRED.EditorOptions): any;
233
+ edit(node: NodeRED.Node, defaultTab?: any): void;
234
+ editConfig(
235
+ name: string,
236
+ type: string,
237
+ id: string,
238
+ prefix?: string,
239
+ editContext?: NodeRED.Node,
240
+ ): void;
241
+ prepareConfigNodeSelect(
242
+ node: NodeRED.BaseNode,
243
+ property: string,
244
+ type: string,
245
+ prefix?: string,
246
+ filter?: (configNode: NodeRED.ConfigNode) => boolean,
247
+ ): void;
248
+ validateNode(node: NodeRED.BaseNode): boolean;
249
+ };
250
+
251
+ /** Side panel tray */
252
+ tray: {
253
+ show(options: NodeRED.TrayOptions): void;
254
+ close(): void;
255
+ };
256
+
257
+ /** Popover / tooltip */
258
+ popover: {
259
+ create(options: NodeRED.PopoverOptions): NodeRED.PopoverInstance;
260
+ tooltip(
261
+ target: JQuery,
262
+ text: string,
263
+ direction?: string,
264
+ ): NodeRED.TooltipInstance;
265
+ };
266
+
267
+ /** Toast notifications */
268
+ notify(
269
+ message: string | JQuery,
270
+ options?: NodeRED.NotificationOptions,
271
+ ): NodeRED.NotificationElement;
272
+
273
+ /** Event system */
274
+ events: {
275
+ on(event: string, listener: (...args: any[]) => void): void;
276
+ off(event: string, listener: (...args: any[]) => void): void;
277
+ emit(event: string, ...args: any[]): void;
278
+ };
279
+
280
+ /** Undo/redo */
281
+ history: {
282
+ push(event: any): void;
283
+ pop(): any;
284
+ peek(): any;
285
+ list(): any[];
286
+ };
287
+
288
+ /** Keyboard shortcuts */
289
+ keyboard: {
290
+ add(scope: string, key: string, callback: () => void): void;
291
+ remove(key: string): void;
292
+ };
293
+
294
+ /** Runtime communication (WebSocket) */
295
+ comms: {
296
+ subscribe(topic: string, callback: (topic: string, msg: any) => void): void;
297
+ unsubscribe(
298
+ topic: string,
299
+ callback: (topic: string, msg: any) => void,
300
+ ): void;
301
+ };
302
+
303
+ /** Editor settings */
304
+ settings: {
305
+ get(key: string): any;
306
+ set(key: string, value: any): any;
307
+ remove(key: string): any;
308
+ [key: string]: any;
309
+ };
310
+
311
+ /** Canvas view */
312
+ view: {
313
+ focus(): void;
314
+ selection(): { nodes?: NodeRED.Node[] };
315
+ redraw(updateActive?: boolean): void;
316
+ };
317
+
318
+ /** Catch-all for untyped properties */
319
+ [key: string]: any;
320
+ };