@vortexm/vjt 0.1.3 → 0.1.5
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 +878 -85
- package/dist/lib/action-runtime.d.ts +26 -0
- package/dist/lib/dom-state.d.ts +2 -2
- package/dist/lib/logging.d.ts +1 -0
- package/dist/lib/network.d.ts +4 -0
- package/dist/lib/references.d.ts +2 -0
- package/dist/lib/types.d.ts +4 -1
- package/dist/lib/voice-runtime.d.ts +48 -0
- package/package.json +1 -1
|
@@ -6,12 +6,16 @@ export type ActionExecutionContext = {
|
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
8
8
|
} | null;
|
|
9
|
+
currentList?: unknown[];
|
|
10
|
+
currentIndex?: number;
|
|
9
11
|
};
|
|
10
12
|
type ActionRuntimeOptions = {
|
|
13
|
+
debugLogging: boolean;
|
|
11
14
|
actionsMap: ActionMap;
|
|
12
15
|
actionFunctions: Record<string, () => unknown>;
|
|
13
16
|
nodeById: Map<string, DescriptionNode>;
|
|
14
17
|
stateById: Map<string, WidgetState>;
|
|
18
|
+
stateByKey: Map<string, WidgetState>;
|
|
15
19
|
rerenderRoot: () => Promise<void>;
|
|
16
20
|
dispatchWidgetEvent: (node: DescriptionNode, eventName: WidgetEventName, key: string, inputValue?: unknown, pointer?: {
|
|
17
21
|
x: number;
|
|
@@ -26,6 +30,14 @@ type ActionRuntimeOptions = {
|
|
|
26
30
|
resolveMappedValue: (template: unknown, currentValue: unknown, responseValue: unknown) => unknown;
|
|
27
31
|
setWidgetEnabled: (widgetId: string, enabled: boolean) => void;
|
|
28
32
|
clearWidget: (widgetId: string) => void;
|
|
33
|
+
clearListElementState: (listKey: string) => void;
|
|
34
|
+
focusWidget: (reference: string) => void;
|
|
35
|
+
playAudio: (value: unknown) => Promise<void>;
|
|
36
|
+
stopPlaying: () => Promise<void>;
|
|
37
|
+
startRecording: () => Promise<void>;
|
|
38
|
+
stopRecording: () => Promise<void>;
|
|
39
|
+
startListening: () => Promise<void>;
|
|
40
|
+
stopListening: () => Promise<void>;
|
|
29
41
|
setUiReference: (widgetId: string, resourceRef: string) => void;
|
|
30
42
|
refreshWidgetTree: (widgetId: string) => Promise<void>;
|
|
31
43
|
renderWidgetTree: (widgetId: string) => Promise<void>;
|
|
@@ -48,10 +60,12 @@ type ActionRuntimeOptions = {
|
|
|
48
60
|
isWidgetEnabled: (node: DescriptionNode, key: string) => boolean;
|
|
49
61
|
};
|
|
50
62
|
export declare class ActionRuntime {
|
|
63
|
+
private readonly debugLogging;
|
|
51
64
|
private readonly actionsMap;
|
|
52
65
|
private readonly actionFunctions;
|
|
53
66
|
private readonly nodeById;
|
|
54
67
|
private readonly stateById;
|
|
68
|
+
private readonly stateByKey;
|
|
55
69
|
private readonly rerenderRoot;
|
|
56
70
|
private readonly dispatchWidgetEventImpl;
|
|
57
71
|
private readonly executeRequest;
|
|
@@ -61,6 +75,14 @@ export declare class ActionRuntime {
|
|
|
61
75
|
private readonly resolveMappedValue;
|
|
62
76
|
private readonly setWidgetEnabled;
|
|
63
77
|
private readonly clearWidget;
|
|
78
|
+
private readonly clearListElementState;
|
|
79
|
+
private readonly focusWidget;
|
|
80
|
+
private readonly playAudio;
|
|
81
|
+
private readonly stopPlaying;
|
|
82
|
+
private readonly startRecording;
|
|
83
|
+
private readonly stopRecording;
|
|
84
|
+
private readonly startListening;
|
|
85
|
+
private readonly stopListening;
|
|
64
86
|
private readonly setUiReference;
|
|
65
87
|
private readonly refreshWidgetTree;
|
|
66
88
|
private readonly renderWidgetTree;
|
|
@@ -80,5 +102,9 @@ export declare class ActionRuntime {
|
|
|
80
102
|
getInlineActionsForNode(node: DescriptionNode): ActionDefinition[] | undefined;
|
|
81
103
|
private runSingleAction;
|
|
82
104
|
private executeAction;
|
|
105
|
+
private unwrapListValue;
|
|
106
|
+
private getCurrentListState;
|
|
107
|
+
private cloneValue;
|
|
108
|
+
private stringifyValue;
|
|
83
109
|
}
|
|
84
110
|
export {};
|
package/dist/lib/dom-state.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export type PreservedElementState = {
|
|
|
15
15
|
}>;
|
|
16
16
|
};
|
|
17
17
|
export declare function isElementInsidePendingResetModal(element: HTMLElement, pendingResetModalIds: Set<string>): boolean;
|
|
18
|
-
export declare function captureElementState(root: HTMLElement, pendingResetModalIds: Set<string
|
|
19
|
-
export declare function restoreElementState(root: HTMLElement, state: PreservedElementState): void;
|
|
18
|
+
export declare function captureElementState(root: HTMLElement, pendingResetModalIds: Set<string>): PreservedElementState;
|
|
19
|
+
export declare function restoreElementState(root: HTMLElement, state: PreservedElementState, stateByKey: Map<string, WidgetState>): void;
|
|
20
20
|
export declare function adjustContextMenuPosition(root: HTMLElement, activeContextMenu: {
|
|
21
21
|
id: string;
|
|
22
22
|
x: number;
|
package/dist/lib/logging.d.ts
CHANGED
package/dist/lib/network.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ type ActionRunner = (actions: ActionDefinition[], inputValue: unknown, context:
|
|
|
4
4
|
responseValue?: unknown;
|
|
5
5
|
}) => Promise<unknown>;
|
|
6
6
|
type NetworkRuntimeOptions = {
|
|
7
|
+
debugLogging: boolean;
|
|
7
8
|
requestsMap: RequestMap;
|
|
8
9
|
sseConfigs: SseConfig[];
|
|
9
10
|
backendUrl?: string;
|
|
@@ -12,6 +13,7 @@ type NetworkRuntimeOptions = {
|
|
|
12
13
|
rerenderRoot: () => Promise<void>;
|
|
13
14
|
};
|
|
14
15
|
export declare class NetworkRuntime {
|
|
16
|
+
private readonly debugLogging;
|
|
15
17
|
private readonly requestsMap;
|
|
16
18
|
private readonly sseConfigs;
|
|
17
19
|
private readonly backendUrl?;
|
|
@@ -23,6 +25,8 @@ export declare class NetworkRuntime {
|
|
|
23
25
|
executeRequest(requestName: string, currentValue: unknown): Promise<unknown>;
|
|
24
26
|
buildSchemaValue(schema: RequestSchema, currentValue: unknown, responseValue: unknown): Promise<unknown>;
|
|
25
27
|
private stringifyPrimitive;
|
|
28
|
+
private createRequestError;
|
|
29
|
+
private toRequestErrorPayload;
|
|
26
30
|
coercePrimitiveSchemaValue(type: PrimitiveRequestType, value: unknown): unknown;
|
|
27
31
|
private handleSseEvent;
|
|
28
32
|
}
|
package/dist/lib/references.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ type ReferenceRuntimeHost = {
|
|
|
6
6
|
readonly nodeByKey: Map<string, DescriptionNode>;
|
|
7
7
|
getAppValue: (name: string) => unknown;
|
|
8
8
|
setAppValue: (name: string, value: unknown) => void;
|
|
9
|
+
getVarValue: (name: string) => unknown;
|
|
10
|
+
setVarValue: (name: string, value: unknown) => void;
|
|
9
11
|
ensureWidgetState: (node: DescriptionNode, key: string) => WidgetState;
|
|
10
12
|
resolveItemNodeKey: (node: DescriptionNode, listKey: string, index: number, fallbackPath: string) => string;
|
|
11
13
|
indexListElementNodes: (listNode: ListNode | GridViewNode, element: DescriptionNode, index: number) => void;
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ 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
6
|
export type WidgetEventName = 'onClick' | 'onUserValueChange' | 'onRefresh' | 'onEnter' | 'onShiftEnter' | 'onControlEnter';
|
|
7
|
-
export type SystemEventName = 'onBeforeRender' | 'onAfterRender' | 'onBeforeNavigate' | 'onAfterNavigate';
|
|
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
9
|
export type ActionDefinition = {
|
|
10
10
|
action: string;
|
|
@@ -34,6 +34,7 @@ export type RequestDefinition = {
|
|
|
34
34
|
request: RequestSchema;
|
|
35
35
|
response?: RequestSchema;
|
|
36
36
|
onResponse?: ActionDefinition[];
|
|
37
|
+
onError?: ActionDefinition[];
|
|
37
38
|
};
|
|
38
39
|
export type SseEventDefinition = {
|
|
39
40
|
name: string;
|
|
@@ -114,6 +115,7 @@ export type WidgetState = {
|
|
|
114
115
|
};
|
|
115
116
|
export type RuntimeSnapshot = {
|
|
116
117
|
stateByKey: Array<[string, WidgetState]>;
|
|
118
|
+
vars: Array<[string, unknown]>;
|
|
117
119
|
activeModalId: string | null;
|
|
118
120
|
activeContextMenu: {
|
|
119
121
|
id: string;
|
|
@@ -132,6 +134,7 @@ export type RenderJsonOptions = {
|
|
|
132
134
|
i18n?: I18nMap;
|
|
133
135
|
language?: string;
|
|
134
136
|
theme?: Theme;
|
|
137
|
+
debugLogging?: boolean;
|
|
135
138
|
actionsMap?: ActionMap;
|
|
136
139
|
requestsMap?: RequestMap;
|
|
137
140
|
sseConfigs?: SseConfigInput;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { SystemEventName } from './types.js';
|
|
2
|
+
type VoiceRuntimeOptions = {
|
|
3
|
+
debugLogging: boolean;
|
|
4
|
+
triggerSystemEvent: (eventName: SystemEventName, inputValue: unknown) => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
export declare class VoiceRuntime {
|
|
7
|
+
private readonly debugLogging;
|
|
8
|
+
private readonly triggerSystemEvent;
|
|
9
|
+
private readonly activePlayers;
|
|
10
|
+
private mediaStream;
|
|
11
|
+
private mediaRecorder;
|
|
12
|
+
private recordingChunks;
|
|
13
|
+
private recordingTimeoutId;
|
|
14
|
+
private listening;
|
|
15
|
+
private listenContext;
|
|
16
|
+
private listenAnalyser;
|
|
17
|
+
private listenSource;
|
|
18
|
+
private listenFrameId;
|
|
19
|
+
private lastSpeechAt;
|
|
20
|
+
private listeningStartedAt;
|
|
21
|
+
private recordingStartedFromListening;
|
|
22
|
+
private speechEventTriggered;
|
|
23
|
+
private readonly visibilityHandler;
|
|
24
|
+
private readonly pageHideHandler;
|
|
25
|
+
constructor(options: VoiceRuntimeOptions);
|
|
26
|
+
play(value: unknown): Promise<void>;
|
|
27
|
+
stopPlaying(): Promise<void>;
|
|
28
|
+
startRecording(): Promise<void>;
|
|
29
|
+
stopRecording(): void;
|
|
30
|
+
startListening(): Promise<void>;
|
|
31
|
+
stopListening(): Promise<void>;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
private startRecordingInternal;
|
|
34
|
+
private handleRecorderStop;
|
|
35
|
+
private handleRecordingError;
|
|
36
|
+
private handleListeningError;
|
|
37
|
+
private normalizePlayablePayload;
|
|
38
|
+
private getPreferredRecordingMimeType;
|
|
39
|
+
private ensureInputStream;
|
|
40
|
+
private clearRecordingTimeout;
|
|
41
|
+
private releaseInputStreamIfIdle;
|
|
42
|
+
private stopStreamTracks;
|
|
43
|
+
private normalizeErrorMessage;
|
|
44
|
+
private detachPlayer;
|
|
45
|
+
private finishPlayback;
|
|
46
|
+
private handlePageDeactivation;
|
|
47
|
+
}
|
|
48
|
+
export {};
|