@vortexm/vjt 0.1.7 → 0.1.9
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/index.d.ts +1 -1
- package/dist/index.js +690 -54
- package/dist/lib/action-runtime.d.ts +14 -1
- package/dist/lib/references.d.ts +6 -2
- package/dist/lib/resource-manager.d.ts +4 -1
- package/dist/lib/types.d.ts +12 -1
- package/dist/lib/voice-runtime.d.ts +1 -1
- package/dist/lib/widgets/bindings.d.ts +1 -1
- package/dist/lib/widgets/context.d.ts +1 -0
- package/dist/lib/widgets/image.d.ts +1 -0
- package/package.json +1 -1
|
@@ -29,9 +29,14 @@ type ActionRuntimeOptions = {
|
|
|
29
29
|
}) => void;
|
|
30
30
|
resolveMappedValue: (template: unknown, currentValue: unknown, responseValue: unknown) => unknown;
|
|
31
31
|
setWidgetEnabled: (widgetId: string, enabled: boolean) => void;
|
|
32
|
+
setWidgetVisible: (widgetId: string, visible: boolean) => void;
|
|
32
33
|
clearWidget: (widgetId: string) => void;
|
|
33
34
|
clearListElementState: (listKey: string) => void;
|
|
34
35
|
focusWidget: (reference: string) => void;
|
|
36
|
+
moveCursorToEnd: (reference: string) => void;
|
|
37
|
+
scrollWidgetToTop: (reference: string) => void;
|
|
38
|
+
scrollWidgetToBottom: (reference: string) => void;
|
|
39
|
+
scrollWidgetToElementByIndex: (reference: string, index: unknown) => void;
|
|
35
40
|
playAudio: (value: unknown) => Promise<void>;
|
|
36
41
|
stopPlaying: () => Promise<void>;
|
|
37
42
|
copyToClipboard: (value: unknown) => Promise<void>;
|
|
@@ -39,7 +44,7 @@ type ActionRuntimeOptions = {
|
|
|
39
44
|
confirmModal: (options: unknown, inputValue: unknown) => Promise<boolean>;
|
|
40
45
|
startRecording: () => Promise<void>;
|
|
41
46
|
stopRecording: () => Promise<void>;
|
|
42
|
-
startListening: () => Promise<void>;
|
|
47
|
+
startListening: (args?: unknown) => Promise<void>;
|
|
43
48
|
stopListening: () => Promise<void>;
|
|
44
49
|
setUiReference: (widgetId: string, resourceRef: string) => void;
|
|
45
50
|
refreshWidgetTree: (widgetId: string) => Promise<void>;
|
|
@@ -79,9 +84,14 @@ export declare class ActionRuntime {
|
|
|
79
84
|
private readonly assignReference;
|
|
80
85
|
private readonly resolveMappedValue;
|
|
81
86
|
private readonly setWidgetEnabled;
|
|
87
|
+
private readonly setWidgetVisible;
|
|
82
88
|
private readonly clearWidget;
|
|
83
89
|
private readonly clearListElementState;
|
|
84
90
|
private readonly focusWidget;
|
|
91
|
+
private readonly moveCursorToEnd;
|
|
92
|
+
private readonly scrollWidgetToTop;
|
|
93
|
+
private readonly scrollWidgetToBottom;
|
|
94
|
+
private readonly scrollWidgetToElementByIndex;
|
|
85
95
|
private readonly playAudio;
|
|
86
96
|
private readonly stopPlaying;
|
|
87
97
|
private readonly copyToClipboard;
|
|
@@ -115,5 +125,8 @@ export declare class ActionRuntime {
|
|
|
115
125
|
private cloneValue;
|
|
116
126
|
private stringifyValue;
|
|
117
127
|
private isCurrentScopedReference;
|
|
128
|
+
private countValue;
|
|
129
|
+
private toNumber;
|
|
130
|
+
private asListWidgetState;
|
|
118
131
|
}
|
|
119
132
|
export {};
|
package/dist/lib/references.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ type ReferenceRuntimeHost = {
|
|
|
4
4
|
readonly stateByKey: Map<string, WidgetState>;
|
|
5
5
|
readonly nodeById: Map<string, DescriptionNode>;
|
|
6
6
|
readonly nodeByKey: Map<string, DescriptionNode>;
|
|
7
|
+
getUiResource: (ref: string) => DescriptionNode | null;
|
|
7
8
|
getAppValue: (name: string) => unknown;
|
|
8
9
|
setAppValue: (name: string, value: unknown) => void;
|
|
9
10
|
getVarValue: (name: string) => unknown;
|
|
@@ -19,12 +20,15 @@ export declare class ReferenceRuntime {
|
|
|
19
20
|
resolveReference(reference: string, currentValue: unknown, responseValue: unknown): unknown;
|
|
20
21
|
resolveCurrentReference(reference: string, currentValue: unknown): unknown;
|
|
21
22
|
readWidgetField(state: WidgetState, field: string): unknown;
|
|
22
|
-
assignReference(reference: string, inputValue: unknown,
|
|
23
|
+
assignReference(reference: string, inputValue: unknown, currentValue: unknown, options?: {
|
|
23
24
|
cookieTtl?: unknown;
|
|
24
25
|
}): void;
|
|
26
|
+
private assignCurrentReference;
|
|
25
27
|
clearListElementState(listKey: string): void;
|
|
26
28
|
resolveMappedValue(template: unknown, currentValue: unknown, responseValue: unknown): unknown;
|
|
27
29
|
isListElementContext(value: unknown): value is ListElementContext;
|
|
28
|
-
findNamedWidget(node: DescriptionNode | undefined, name: string): DescriptionNode | null;
|
|
30
|
+
findNamedWidget(node: DescriptionNode | undefined, name: string, currentValue?: unknown): DescriptionNode | null;
|
|
31
|
+
private resolveListDescriptorNode;
|
|
32
|
+
private resolveUiReferenceNode;
|
|
29
33
|
}
|
|
30
34
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { ActionMap, DescriptionNode, I18nMap, RequestMap, SseConfig, SystemEventsMap, StyleMap } from './types.js';
|
|
1
|
+
import type { ActionMap, DescriptionNode, I18nMap, RequestMap, RouteDefinition, RoutesConfigInput, SseConfig, SystemEventsMap, StyleMap } from './types.js';
|
|
2
2
|
export type ResourceManagerInput = {
|
|
3
3
|
ui?: Record<string, DescriptionNode>;
|
|
4
4
|
actions?: ActionMap;
|
|
5
5
|
requests?: RequestMap;
|
|
6
|
+
routes?: RoutesConfigInput;
|
|
6
7
|
sse?: Record<string, SseConfig>;
|
|
7
8
|
systemEvents?: SystemEventsMap;
|
|
8
9
|
i18n?: I18nMap;
|
|
@@ -12,6 +13,7 @@ export declare class ResourceManager {
|
|
|
12
13
|
private readonly ui;
|
|
13
14
|
private actions;
|
|
14
15
|
private requests;
|
|
16
|
+
private routes;
|
|
15
17
|
private sse;
|
|
16
18
|
private systemEvents;
|
|
17
19
|
private i18n;
|
|
@@ -21,6 +23,7 @@ export declare class ResourceManager {
|
|
|
21
23
|
setUi(name: string, description: DescriptionNode): void;
|
|
22
24
|
getActionsMap(): ActionMap;
|
|
23
25
|
getRequestsMap(): RequestMap;
|
|
26
|
+
getRoutes(): RouteDefinition[];
|
|
24
27
|
getSseConfigs(): SseConfig[];
|
|
25
28
|
getSystemEvents(): SystemEventsMap;
|
|
26
29
|
getI18n(): I18nMap;
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -3,9 +3,16 @@ export type LayoutType = 'vertical' | 'horizontal' | 'grid';
|
|
|
3
3
|
export type TextAlign = 'left' | 'center' | 'right';
|
|
4
4
|
export type VerticalAlign = 'top' | 'center' | 'bottom';
|
|
5
5
|
export type HeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
6
|
-
export type WidgetEventName = 'onClick' | 'onUserValueChange' | 'onRefresh' | 'onEnter' | 'onShiftEnter' | 'onControlEnter';
|
|
6
|
+
export type WidgetEventName = 'onClick' | 'onUserValueChange' | 'onRefresh' | 'onEnter' | 'onShiftEnter' | 'onControlEnter' | 'onPaste';
|
|
7
7
|
export type SystemEventName = 'onBeforeRender' | 'onAfterRender' | 'onBeforeNavigate' | 'onAfterNavigate' | 'onSpeechDetected' | 'onRecordingStarted' | 'onRecordingStopped' | 'onRecordingError' | 'onListeningError' | 'onListeringError' | 'onPlayFinished' | 'onPlayingStopped';
|
|
8
8
|
export type PrimitiveRequestType = 'int' | 'float' | 'boolean' | 'string';
|
|
9
|
+
export type RouteDefinition = {
|
|
10
|
+
path: string;
|
|
11
|
+
ui: string;
|
|
12
|
+
};
|
|
13
|
+
export type RoutesConfigInput = RouteDefinition[] | {
|
|
14
|
+
routes: RouteDefinition[];
|
|
15
|
+
};
|
|
9
16
|
export type ActionDefinition = {
|
|
10
17
|
action: string;
|
|
11
18
|
andThen?: ActionDefinition[];
|
|
@@ -51,6 +58,7 @@ export type BaseNode = {
|
|
|
51
58
|
name?: string;
|
|
52
59
|
style?: string | string[];
|
|
53
60
|
css?: string;
|
|
61
|
+
visible?: boolean | string;
|
|
54
62
|
enabled?: boolean | string;
|
|
55
63
|
events?: WidgetEvents;
|
|
56
64
|
[key: string]: unknown;
|
|
@@ -96,8 +104,10 @@ export type WidgetState = {
|
|
|
96
104
|
currentRef?: string;
|
|
97
105
|
text?: string;
|
|
98
106
|
url?: string;
|
|
107
|
+
base64?: string;
|
|
99
108
|
placeholder?: string;
|
|
100
109
|
enabled?: boolean;
|
|
110
|
+
visible?: boolean;
|
|
101
111
|
editable?: boolean;
|
|
102
112
|
checked?: boolean;
|
|
103
113
|
condition?: boolean;
|
|
@@ -139,6 +149,7 @@ export type RenderJsonOptions = {
|
|
|
139
149
|
requestsMap?: RequestMap;
|
|
140
150
|
sseConfigs?: SseConfigInput;
|
|
141
151
|
systemEvents?: SystemEventsMap;
|
|
152
|
+
routes?: RoutesConfigInput;
|
|
142
153
|
actionFunctions?: Record<string, () => unknown>;
|
|
143
154
|
backendUrl?: string;
|
|
144
155
|
resourceManager?: ResourceManager;
|
|
@@ -27,7 +27,7 @@ export declare class VoiceRuntime {
|
|
|
27
27
|
stopPlaying(): Promise<void>;
|
|
28
28
|
startRecording(): Promise<void>;
|
|
29
29
|
stopRecording(): void;
|
|
30
|
-
startListening(): Promise<void>;
|
|
30
|
+
startListening(args?: unknown): Promise<void>;
|
|
31
31
|
stopListening(): Promise<void>;
|
|
32
32
|
dispose(): void;
|
|
33
33
|
private startRecordingInternal;
|
|
@@ -12,7 +12,7 @@ type BindingEnvironment = {
|
|
|
12
12
|
}) => void;
|
|
13
13
|
updatePointerFromEvent: (event: MouseEvent) => void;
|
|
14
14
|
updateOwningListElementDescriptor: (element: HTMLElement, mutate: (descriptor: DescriptionNode) => void) => void;
|
|
15
|
-
dispatchWidgetEvent: (node: DescriptionNode, eventName: 'onClick' | 'onUserValueChange' | 'onEnter' | 'onShiftEnter' | 'onControlEnter', key: string, inputValue?: unknown, pointer?: {
|
|
15
|
+
dispatchWidgetEvent: (node: DescriptionNode, eventName: 'onClick' | 'onUserValueChange' | 'onEnter' | 'onShiftEnter' | 'onControlEnter' | 'onPaste', key: string, inputValue?: unknown, pointer?: {
|
|
16
16
|
x: number;
|
|
17
17
|
y: number;
|
|
18
18
|
} | null) => Promise<void>;
|
|
@@ -29,6 +29,7 @@ export type WidgetRenderEnvironment = {
|
|
|
29
29
|
escapeHtml: (value: unknown) => string;
|
|
30
30
|
buildStyleString: (node: DescriptionNode) => string;
|
|
31
31
|
resolveI18nValue: (value: string | undefined) => string;
|
|
32
|
+
resolveTextValue: (value: string | undefined, itemContext: ListElementContext | null) => string;
|
|
32
33
|
getUiResource: (ref: string) => DescriptionNode | null;
|
|
33
34
|
resolveReference: (reference: string, currentValue: unknown, responseValue: unknown) => unknown;
|
|
34
35
|
buildWidgetDataAttributes: (key: string, node: DescriptionNode) => string;
|