@corti/dictation-web 0.0.0-test.571.2 → 0.0.0-test.7
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 +25 -39
- package/dist/bundle.js +1120 -535
- package/dist/components/corti-dictation.d.ts +23 -9
- package/dist/components/corti-dictation.js +36 -17
- package/dist/components/corti-dictation.js.map +1 -1
- package/dist/components/keybinding-input.d.ts +16 -0
- package/dist/components/keybinding-input.js +94 -0
- package/dist/components/keybinding-input.js.map +1 -0
- package/dist/components/keybinding-selector.d.ts +3 -3
- package/dist/components/keybinding-selector.js +21 -49
- package/dist/components/keybinding-selector.js.map +1 -1
- package/dist/components/recording-button.d.ts +5 -3
- package/dist/components/recording-button.js +100 -45
- package/dist/components/recording-button.js.map +1 -1
- package/dist/components/settings-menu.d.ts +0 -1
- package/dist/components/settings-menu.js +4 -17
- package/dist/components/settings-menu.js.map +1 -1
- package/dist/contexts/dictation-context.d.ts +6 -6
- package/dist/contexts/dictation-context.js +24 -23
- package/dist/contexts/dictation-context.js.map +1 -1
- package/dist/controllers/dictation-controller.d.ts +8 -2
- package/dist/controllers/dictation-controller.js +151 -45
- package/dist/controllers/dictation-controller.js.map +1 -1
- package/dist/controllers/keybinding-controller.d.ts +2 -3
- package/dist/controllers/keybinding-controller.js +20 -17
- package/dist/controllers/keybinding-controller.js.map +1 -1
- package/dist/controllers/media-controller.d.ts +2 -1
- package/dist/controllers/media-controller.js +14 -3
- package/dist/controllers/media-controller.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +0 -5
- package/dist/index.js.map +1 -1
- package/dist/styles/keybinding-selector.js +10 -4
- package/dist/styles/keybinding-selector.js.map +1 -1
- package/dist/styles/settings-menu.js +0 -8
- package/dist/styles/settings-menu.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/types.js.map +1 -1
- package/dist/utils/events.d.ts +13 -7
- package/dist/utils/events.js +26 -12
- package/dist/utils/events.js.map +1 -1
- package/package.json +2 -4
- package/dist/components/mode-selector.d.ts +0 -14
- package/dist/components/mode-selector.js +0 -73
- package/dist/components/mode-selector.js.map +0 -1
- package/dist/package.json +0 -94
- package/dist/styles/mode-selector.d.ts +0 -2
- package/dist/styles/mode-selector.js +0 -56
- package/dist/styles/mode-selector.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Corti } from "@corti/sdk";
|
|
2
2
|
import { LitElement } from "lit";
|
|
3
|
-
import type { ConfigurableSettings,
|
|
3
|
+
import type { ConfigurableSettings, ProxyOptions, RecordingState } from "../types.js";
|
|
4
4
|
import "../contexts/dictation-context.js";
|
|
5
5
|
import "./recording-button.js";
|
|
6
6
|
import "./settings-menu.js";
|
|
@@ -70,19 +70,23 @@ export declare class CortiDictation extends LitElement {
|
|
|
70
70
|
*/
|
|
71
71
|
get recordingState(): RecordingState;
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* Push-to-talk keybinding for keyboard shortcut. Single key only (e.g., "Space", "k", "meta", "ctrl").
|
|
74
|
+
* Combinations with "+" are not supported.
|
|
75
|
+
* Keydown starts recording, keyup stops recording.
|
|
76
|
+
* Defaults to "Space" if keybinding is in settingsEnabled, otherwise undefined
|
|
74
77
|
*/
|
|
75
|
-
set
|
|
76
|
-
get
|
|
77
|
-
|
|
78
|
+
set pushToTalkKeybinding(value: string | null | undefined);
|
|
79
|
+
get pushToTalkKeybinding(): string | null | undefined;
|
|
80
|
+
_pushToTalkKeybinding?: string | null;
|
|
78
81
|
/**
|
|
79
|
-
*
|
|
82
|
+
* Toggle-to-talk keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
|
|
80
83
|
* Combinations with "+" are not supported.
|
|
84
|
+
* Pressing the key toggles recording on/off.
|
|
81
85
|
* Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
|
|
82
86
|
*/
|
|
83
|
-
set
|
|
84
|
-
get
|
|
85
|
-
|
|
87
|
+
set toggleToTalkKeybinding(value: string | null | undefined);
|
|
88
|
+
get toggleToTalkKeybinding(): string | null | undefined;
|
|
89
|
+
_toggleToTalkKeybinding?: string | null;
|
|
86
90
|
/**
|
|
87
91
|
* Set the latest access token.
|
|
88
92
|
* @returns ServerConfig with environment, tenant, and accessToken
|
|
@@ -127,6 +131,16 @@ export declare class CortiDictation extends LitElement {
|
|
|
127
131
|
* Starts or stops recording. Convenience layer on top of the start/stop methods.
|
|
128
132
|
*/
|
|
129
133
|
toggleRecording(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Opens the WebSocket connection without starting recording.
|
|
136
|
+
* Use this to pre-establish the connection before recording starts.
|
|
137
|
+
*/
|
|
138
|
+
openConnection(): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Closes the WebSocket connection by sending "end" and waiting for "ended".
|
|
141
|
+
* Call this to receive "usage" statistics or when done with the connection.
|
|
142
|
+
*/
|
|
143
|
+
closeConnection(): Promise<void>;
|
|
130
144
|
render(): import("lit-html").TemplateResult<1>;
|
|
131
145
|
}
|
|
132
146
|
declare global {
|
|
@@ -45,7 +45,6 @@ let CortiDictation = class CortiDictation extends LitElement {
|
|
|
45
45
|
*/
|
|
46
46
|
this.debug_displayAudio = false;
|
|
47
47
|
this._dictationConfig = DEFAULT_DICTATION_CONFIG;
|
|
48
|
-
this._mode = "toggle-to-talk";
|
|
49
48
|
}
|
|
50
49
|
/**
|
|
51
50
|
* List of all language codes available for use with the Web Component.
|
|
@@ -93,24 +92,30 @@ let CortiDictation = class CortiDictation extends LitElement {
|
|
|
93
92
|
return __classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.recordingState || "stopped";
|
|
94
93
|
}
|
|
95
94
|
/**
|
|
96
|
-
*
|
|
95
|
+
* Push-to-talk keybinding for keyboard shortcut. Single key only (e.g., "Space", "k", "meta", "ctrl").
|
|
96
|
+
* Combinations with "+" are not supported.
|
|
97
|
+
* Keydown starts recording, keyup stops recording.
|
|
98
|
+
* Defaults to "Space" if keybinding is in settingsEnabled, otherwise undefined
|
|
97
99
|
*/
|
|
98
|
-
set
|
|
99
|
-
this.
|
|
100
|
+
set pushToTalkKeybinding(value) {
|
|
101
|
+
this._pushToTalkKeybinding = value;
|
|
100
102
|
}
|
|
101
|
-
get
|
|
102
|
-
return (__classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.
|
|
103
|
+
get pushToTalkKeybinding() {
|
|
104
|
+
return (__classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.pushToTalkKeybinding ||
|
|
105
|
+
this._pushToTalkKeybinding);
|
|
103
106
|
}
|
|
104
107
|
/**
|
|
105
|
-
*
|
|
108
|
+
* Toggle-to-talk keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
|
|
106
109
|
* Combinations with "+" are not supported.
|
|
110
|
+
* Pressing the key toggles recording on/off.
|
|
107
111
|
* Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
|
|
108
112
|
*/
|
|
109
|
-
set
|
|
110
|
-
this.
|
|
113
|
+
set toggleToTalkKeybinding(value) {
|
|
114
|
+
this._toggleToTalkKeybinding = value;
|
|
111
115
|
}
|
|
112
|
-
get
|
|
113
|
-
return __classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.
|
|
116
|
+
get toggleToTalkKeybinding() {
|
|
117
|
+
return (__classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.toggleToTalkKeybinding ||
|
|
118
|
+
this._toggleToTalkKeybinding);
|
|
114
119
|
}
|
|
115
120
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
116
121
|
// Public methods
|
|
@@ -159,6 +164,20 @@ let CortiDictation = class CortiDictation extends LitElement {
|
|
|
159
164
|
toggleRecording() {
|
|
160
165
|
__classPrivateFieldGet(this, _CortiDictation_recordingButtonRef, "f").value?.toggleRecording();
|
|
161
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Opens the WebSocket connection without starting recording.
|
|
169
|
+
* Use this to pre-establish the connection before recording starts.
|
|
170
|
+
*/
|
|
171
|
+
async openConnection() {
|
|
172
|
+
await __classPrivateFieldGet(this, _CortiDictation_recordingButtonRef, "f").value?.openConnection();
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Closes the WebSocket connection by sending "end" and waiting for "ended".
|
|
176
|
+
* Call this to receive "usage" statistics or when done with the connection.
|
|
177
|
+
*/
|
|
178
|
+
async closeConnection() {
|
|
179
|
+
await __classPrivateFieldGet(this, _CortiDictation_recordingButtonRef, "f").value?.closeConnection();
|
|
180
|
+
}
|
|
162
181
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
163
182
|
// Render
|
|
164
183
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -180,8 +199,8 @@ let CortiDictation = class CortiDictation extends LitElement {
|
|
|
180
199
|
.devices=${this._devices}
|
|
181
200
|
.selectedDevice=${this._selectedDevice}
|
|
182
201
|
.debug_displayAudio=${this.debug_displayAudio}
|
|
183
|
-
.
|
|
184
|
-
.
|
|
202
|
+
.pushToTalkKeybinding=${this._pushToTalkKeybinding}
|
|
203
|
+
.toggleToTalkKeybinding=${this._toggleToTalkKeybinding}
|
|
185
204
|
>
|
|
186
205
|
<dictation-recording-button
|
|
187
206
|
${ref(__classPrivateFieldGet(this, _CortiDictation_recordingButtonRef, "f"))}
|
|
@@ -256,16 +275,16 @@ __decorate([
|
|
|
256
275
|
], CortiDictation.prototype, "_selectedDevice", void 0);
|
|
257
276
|
__decorate([
|
|
258
277
|
property({ type: String })
|
|
259
|
-
], CortiDictation.prototype, "
|
|
278
|
+
], CortiDictation.prototype, "pushToTalkKeybinding", null);
|
|
260
279
|
__decorate([
|
|
261
280
|
state()
|
|
262
|
-
], CortiDictation.prototype, "
|
|
281
|
+
], CortiDictation.prototype, "_pushToTalkKeybinding", void 0);
|
|
263
282
|
__decorate([
|
|
264
283
|
property({ type: String })
|
|
265
|
-
], CortiDictation.prototype, "
|
|
284
|
+
], CortiDictation.prototype, "toggleToTalkKeybinding", null);
|
|
266
285
|
__decorate([
|
|
267
286
|
state()
|
|
268
|
-
], CortiDictation.prototype, "
|
|
287
|
+
], CortiDictation.prototype, "_toggleToTalkKeybinding", void 0);
|
|
269
288
|
CortiDictation = __decorate([
|
|
270
289
|
customElement("corti-dictation")
|
|
271
290
|
], CortiDictation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corti-dictation.js","sourceRoot":"","sources":["../../src/components/corti-dictation.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAY,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAQ3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,OAAO,kCAAkC,CAAC;AAC1C,OAAO,uBAAuB,CAAC;AAC/B,OAAO,oBAAoB,CAAC;AAGrB,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QAML,gFAAgF;QAChF,eAAe;QACf,gFAAgF;QAEhF,6CAAqD,SAAS,EAAE,EAAC;QACjE,6CAA0C,SAAS,EAAE,EAAC;QAuDtD;;;;WAIG;QAKH,oBAAe,GAA2B,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAEjE;;;;WAIG;QAEH,qBAAgB,GAAY,KAAK,CAAC;QAElC;;;WAGG;QAEH,uBAAkB,GAAY,KAAK,CAAC;QAiBpC,qBAAgB,GAA2B,wBAAwB,CAAC;QAwDpE,UAAK,GAAmB,gBAAgB,CAAC;IAuH3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;QAClC,IAAI,EAAE,KAAK;KACZ,CAAC;wDAKD;AAWD;IADC,KAAK,EAAE;2DACkD;AAW1D;IAJC,QAAQ,CAAC;QACR,SAAS,EAAE,uBAAuB;QAClC,IAAI,EAAE,KAAK;KACZ,CAAC;uDAC+D;AAQjE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDACM;AAOlC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,qBAAqB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0DAC1B;AAMpC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAG5C;AASD;IADC,KAAK,EAAE;wDAC4D;AAMpE;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAG3C;AAOD;IADC,KAAK,EAAE;gDACqB;AAM7B;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAG5C;AASD;IADC,KAAK,EAAE;uDAC0B;AAalC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAG1B;AASD;IADC,KAAK,EAAE;6CACiC;AAQzC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAG1B;AAOD;IADC,KAAK,EAAE;mDACoB;AApLjB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA0R1B","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport { css, html, LitElement, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { createRef, type Ref, ref } from \"lit/directives/ref.js\";\nimport { DEFAULT_DICTATION_CONFIG } from \"../constants.js\";\nimport type { DictationRoot } from \"../contexts/dictation-context.js\";\nimport type {\n ConfigurableSettings,\n DictationMode,\n ProxyOptions,\n RecordingState,\n} from \"../types.js\";\nimport { commaSeparatedConverter } from \"../utils/converters.js\";\nimport type { DictationRecordingButton } from \"./recording-button.js\";\n\nimport \"../contexts/dictation-context.js\";\nimport \"./recording-button.js\";\nimport \"./settings-menu.js\";\n\n@customElement(\"corti-dictation\")\nexport class CortiDictation extends LitElement {\n static styles = css`\n .hidden {\n display: none;\n }\n `;\n // ─────────────────────────────────────────────────────────────────────────────\n // Private refs\n // ─────────────────────────────────────────────────────────────────────────────\n\n #recordingButtonRef: Ref<DictationRecordingButton> = createRef();\n #contextProviderRef: Ref<DictationRoot> = createRef();\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Properties\n // ─────────────────────────────────────────────────────────────────────────────\n\n /**\n * Latest access token\n */\n @property({ type: String })\n accessToken?: string;\n\n /**\n * Authentication configuration with optional refresh mechanism.\n */\n @property({ attribute: false, type: Object })\n authConfig?: Corti.BearerOptions;\n\n /**\n * WebSocket URL for proxy connection. When provided, uses CortiWebSocketProxyClient instead of CortiClient.\n */\n @property({ type: String })\n socketUrl?: string;\n\n /**\n * Socket proxy configuration object. When provided, uses CortiWebSocketProxyClient instead of CortiClient.\n */\n @property({ attribute: false, type: Object })\n socketProxy?: ProxyOptions;\n\n /**\n * List of all language codes available for use with the Web Component.\n * Default list depends on the accessToken\n */\n @property({\n converter: commaSeparatedConverter,\n type: Array,\n })\n set languagesSupported(value:\n | Corti.TranscribeSupportedLanguage[]\n | undefined) {\n this._languagesSupported = value;\n }\n\n get languagesSupported(): Corti.TranscribeSupportedLanguage[] {\n return (\n this.#contextProviderRef.value?.languages ||\n this._languagesSupported ||\n []\n );\n }\n\n @state()\n _languagesSupported?: Corti.TranscribeSupportedLanguage[];\n\n /**\n * Which settings should be available in the UI.\n * If an empty array is passed, the settings will be disabled entirely.\n * Options are language and devices\n */\n @property({\n converter: commaSeparatedConverter,\n type: Array,\n })\n settingsEnabled: ConfigurableSettings[] = [\"device\", \"language\"];\n\n /**\n * When false (default), allows the start/stop button from taking focus when clicked,\n * disabling textareas or other input elements to maintain focus.\n * Set to \"true\" to allow the button to receive focus on click.\n */\n @property({ type: Boolean })\n allowButtonFocus: boolean = false;\n\n /**\n * Overrides any device selection and instead uses getDisplayMedia to stream system audio.\n * Should only be used for debugging.\n */\n @property({ attribute: \"debug-display-audio\", type: Boolean })\n debug_displayAudio: boolean = false;\n\n /**\n * Configuration settings for dictation\n */\n @property({ attribute: false, type: Object })\n set dictationConfig(value: Corti.TranscribeConfig) {\n this._dictationConfig = value;\n }\n\n get dictationConfig(): Corti.TranscribeConfig {\n return (\n this.#contextProviderRef.value?.dictationConfig || this._dictationConfig\n );\n }\n\n @state()\n _dictationConfig: Corti.TranscribeConfig = DEFAULT_DICTATION_CONFIG;\n\n /**\n * List of available recording devices\n */\n @property({ attribute: false, type: Array })\n set devices(value: MediaDeviceInfo[] | undefined) {\n this._devices = value;\n }\n\n get devices(): MediaDeviceInfo[] {\n return this.#contextProviderRef.value?.devices || this._devices || [];\n }\n\n @state()\n _devices?: MediaDeviceInfo[];\n\n /**\n * The selected device used for recording (MediaDeviceInfo).\n */\n @property({ attribute: false, type: Object })\n set selectedDevice(value: MediaDeviceInfo | undefined) {\n this._selectedDevice = value;\n }\n\n get selectedDevice(): MediaDeviceInfo | undefined {\n return (\n this.#contextProviderRef.value?.selectedDevice || this._selectedDevice\n );\n }\n\n @state()\n _selectedDevice?: MediaDeviceInfo;\n\n /**\n * Current state of recording (stopped, recording, initializing and stopping, ).\n */\n get recordingState(): RecordingState {\n return this.#contextProviderRef.value?.recordingState || \"stopped\";\n }\n\n /**\n * Dictation mode: \"toggle-to-talk\" or \"push-to-talk\"\n */\n @property({ type: String })\n set mode(value: DictationMode) {\n this._mode = value;\n }\n\n get mode(): DictationMode {\n return (\n this.#contextProviderRef.value?.mode || this._mode || \"toggle-to-talk\"\n );\n }\n\n @state()\n _mode?: DictationMode = \"toggle-to-talk\";\n\n /**\n * Keybinding for keyboard shortcut. Single key only (e.g., \"`\", \"k\", \"meta\", \"ctrl\").\n * Combinations with \"+\" are not supported.\n * Defaults to \"`\" if keybinding is in settingsEnabled, otherwise undefined\n */\n @property({ type: String })\n set keybinding(value: string | null | undefined) {\n this._keybinding = value;\n }\n\n get keybinding(): string | null | undefined {\n return this.#contextProviderRef.value?.keybinding || this._keybinding;\n }\n\n @state()\n _keybinding?: string | null;\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Public methods\n // ─────────────────────────────────────────────────────────────────────────────\n\n /**\n * Set the latest access token.\n * @returns ServerConfig with environment, tenant, and accessToken\n * @deprecated Use 'accessToken' property instead.\n */\n public setAccessToken(token: string) {\n this.accessToken = token;\n\n return (\n this.#contextProviderRef.value?.setAccessToken(token) ?? {\n accessToken: token,\n environment: undefined,\n tenant: undefined,\n }\n );\n }\n\n /**\n * Set the auth configuration for OAuth flows.\n * @returns Promise with ServerConfig containing environment, tenant, and accessToken\n * @deprecated Use 'authConfig' property instead.\n */\n public async setAuthConfig(config: Corti.BearerOptions) {\n this.authConfig = config;\n\n return (\n this.#contextProviderRef.value?.setAuthConfig(config) ?? {\n accessToken: undefined,\n environment: undefined,\n tenant: undefined,\n }\n );\n }\n\n /**\n * Starts a recording.\n */\n public startRecording(): void {\n this.#recordingButtonRef.value?.startRecording();\n }\n\n /**\n * Stops a recording.\n */\n public stopRecording(): void {\n this.#recordingButtonRef.value?.stopRecording();\n }\n\n /**\n * Starts or stops recording. Convenience layer on top of the start/stop methods.\n */\n public toggleRecording(): void {\n this.#recordingButtonRef.value?.toggleRecording();\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Render\n // ─────────────────────────────────────────────────────────────────────────────\n\n render() {\n const isHidden =\n !this.accessToken &&\n !this.authConfig &&\n !this.socketUrl &&\n !this.socketProxy;\n\n return html`\n <dictation-root\n ${ref(this.#contextProviderRef)}\n class=${classMap({ hidden: isHidden })}\n .accessToken=${this.accessToken}\n .authConfig=${this.authConfig}\n .socketUrl=${this.socketUrl}\n .socketProxy=${this.socketProxy}\n .dictationConfig=${this._dictationConfig}\n .languages=${this._languagesSupported}\n .devices=${this._devices}\n .selectedDevice=${this._selectedDevice}\n .debug_displayAudio=${this.debug_displayAudio}\n .mode=${this._mode}\n .keybinding=${this._keybinding}\n >\n <dictation-recording-button\n ${ref(this.#recordingButtonRef)}\n ?allowButtonFocus=${this.allowButtonFocus}\n ></dictation-recording-button>\n ${\n this.settingsEnabled?.length > 0\n ? html`<dictation-settings-menu\n .settingsEnabled=${this.settingsEnabled}\n ></dictation-settings-menu>`\n : nothing\n }\n </dictation-root>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"corti-dictation\": CortiDictation;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"corti-dictation.js","sourceRoot":"","sources":["../../src/components/corti-dictation.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAY,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAO3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,OAAO,kCAAkC,CAAC;AAC1C,OAAO,uBAAuB,CAAC;AAC/B,OAAO,oBAAoB,CAAC;AAGrB,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QAML,gFAAgF;QAChF,eAAe;QACf,gFAAgF;QAEhF,6CAAqD,SAAS,EAAE,EAAC;QACjE,6CAA0C,SAAS,EAAE,EAAC;QAuDtD;;;;WAIG;QAKH,oBAAe,GAA2B,CAAC,QAAQ,EAAE,UAAU,CAAC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ADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAG1B;AAUD;IADC,KAAK,EAAE;+DACgC;AA5L7B,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAkT1B","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport { css, html, LitElement, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { createRef, type Ref, ref } from \"lit/directives/ref.js\";\nimport { DEFAULT_DICTATION_CONFIG } from \"../constants.js\";\nimport type { DictationRoot } from \"../contexts/dictation-context.js\";\nimport type {\n ConfigurableSettings,\n ProxyOptions,\n RecordingState,\n} from \"../types.js\";\nimport { commaSeparatedConverter } from \"../utils/converters.js\";\nimport type { DictationRecordingButton } from \"./recording-button.js\";\n\nimport \"../contexts/dictation-context.js\";\nimport \"./recording-button.js\";\nimport \"./settings-menu.js\";\n\n@customElement(\"corti-dictation\")\nexport class CortiDictation extends LitElement {\n static styles = css`\n .hidden {\n display: none;\n }\n `;\n // ─────────────────────────────────────────────────────────────────────────────\n // Private refs\n // ─────────────────────────────────────────────────────────────────────────────\n\n #recordingButtonRef: Ref<DictationRecordingButton> = createRef();\n #contextProviderRef: Ref<DictationRoot> = createRef();\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Properties\n // ─────────────────────────────────────────────────────────────────────────────\n\n /**\n * Latest access token\n */\n @property({ type: String })\n accessToken?: string;\n\n /**\n * Authentication configuration with optional refresh mechanism.\n */\n @property({ attribute: false, type: Object })\n authConfig?: Corti.BearerOptions;\n\n /**\n * WebSocket URL for proxy connection. When provided, uses CortiWebSocketProxyClient instead of CortiClient.\n */\n @property({ type: String })\n socketUrl?: string;\n\n /**\n * Socket proxy configuration object. When provided, uses CortiWebSocketProxyClient instead of CortiClient.\n */\n @property({ attribute: false, type: Object })\n socketProxy?: ProxyOptions;\n\n /**\n * List of all language codes available for use with the Web Component.\n * Default list depends on the accessToken\n */\n @property({\n converter: commaSeparatedConverter,\n type: Array,\n })\n set languagesSupported(value:\n | Corti.TranscribeSupportedLanguage[]\n | undefined) {\n this._languagesSupported = value;\n }\n\n get languagesSupported(): Corti.TranscribeSupportedLanguage[] {\n return (\n this.#contextProviderRef.value?.languages ||\n this._languagesSupported ||\n []\n );\n }\n\n @state()\n _languagesSupported?: Corti.TranscribeSupportedLanguage[];\n\n /**\n * Which settings should be available in the UI.\n * If an empty array is passed, the settings will be disabled entirely.\n * Options are language and devices\n */\n @property({\n converter: commaSeparatedConverter,\n type: Array,\n })\n settingsEnabled: ConfigurableSettings[] = [\"device\", \"language\"];\n\n /**\n * When false (default), allows the start/stop button from taking focus when clicked,\n * disabling textareas or other input elements to maintain focus.\n * Set to \"true\" to allow the button to receive focus on click.\n */\n @property({ type: Boolean })\n allowButtonFocus: boolean = false;\n\n /**\n * Overrides any device selection and instead uses getDisplayMedia to stream system audio.\n * Should only be used for debugging.\n */\n @property({ attribute: \"debug-display-audio\", type: Boolean })\n debug_displayAudio: boolean = false;\n\n /**\n * Configuration settings for dictation\n */\n @property({ attribute: false, type: Object })\n set dictationConfig(value: Corti.TranscribeConfig) {\n this._dictationConfig = value;\n }\n\n get dictationConfig(): Corti.TranscribeConfig {\n return (\n this.#contextProviderRef.value?.dictationConfig || this._dictationConfig\n );\n }\n\n @state()\n _dictationConfig: Corti.TranscribeConfig = DEFAULT_DICTATION_CONFIG;\n\n /**\n * List of available recording devices\n */\n @property({ attribute: false, type: Array })\n set devices(value: MediaDeviceInfo[] | undefined) {\n this._devices = value;\n }\n\n get devices(): MediaDeviceInfo[] {\n return this.#contextProviderRef.value?.devices || this._devices || [];\n }\n\n @state()\n _devices?: MediaDeviceInfo[];\n\n /**\n * The selected device used for recording (MediaDeviceInfo).\n */\n @property({ attribute: false, type: Object })\n set selectedDevice(value: MediaDeviceInfo | undefined) {\n this._selectedDevice = value;\n }\n\n get selectedDevice(): MediaDeviceInfo | undefined {\n return (\n this.#contextProviderRef.value?.selectedDevice || this._selectedDevice\n );\n }\n\n @state()\n _selectedDevice?: MediaDeviceInfo;\n\n /**\n * Current state of recording (stopped, recording, initializing and stopping, ).\n */\n get recordingState(): RecordingState {\n return this.#contextProviderRef.value?.recordingState || \"stopped\";\n }\n\n /**\n * Push-to-talk keybinding for keyboard shortcut. Single key only (e.g., \"Space\", \"k\", \"meta\", \"ctrl\").\n * Combinations with \"+\" are not supported.\n * Keydown starts recording, keyup stops recording.\n * Defaults to \"Space\" if keybinding is in settingsEnabled, otherwise undefined\n */\n @property({ type: String })\n set pushToTalkKeybinding(value: string | null | undefined) {\n this._pushToTalkKeybinding = value;\n }\n\n get pushToTalkKeybinding(): string | null | undefined {\n return (\n this.#contextProviderRef.value?.pushToTalkKeybinding ||\n this._pushToTalkKeybinding\n );\n }\n\n @state()\n _pushToTalkKeybinding?: string | null;\n\n /**\n * Toggle-to-talk keybinding for keyboard shortcut. Single key only (e.g., \"`\", \"k\", \"meta\", \"ctrl\").\n * Combinations with \"+\" are not supported.\n * Pressing the key toggles recording on/off.\n * Defaults to \"`\" if keybinding is in settingsEnabled, otherwise undefined\n */\n @property({ type: String })\n set toggleToTalkKeybinding(value: string | null | undefined) {\n this._toggleToTalkKeybinding = value;\n }\n\n get toggleToTalkKeybinding(): string | null | undefined {\n return (\n this.#contextProviderRef.value?.toggleToTalkKeybinding ||\n this._toggleToTalkKeybinding\n );\n }\n\n @state()\n _toggleToTalkKeybinding?: string | null;\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Public methods\n // ─────────────────────────────────────────────────────────────────────────────\n\n /**\n * Set the latest access token.\n * @returns ServerConfig with environment, tenant, and accessToken\n * @deprecated Use 'accessToken' property instead.\n */\n public setAccessToken(token: string) {\n this.accessToken = token;\n\n return (\n this.#contextProviderRef.value?.setAccessToken(token) ?? {\n accessToken: token,\n environment: undefined,\n tenant: undefined,\n }\n );\n }\n\n /**\n * Set the auth configuration for OAuth flows.\n * @returns Promise with ServerConfig containing environment, tenant, and accessToken\n * @deprecated Use 'authConfig' property instead.\n */\n public async setAuthConfig(config: Corti.BearerOptions) {\n this.authConfig = config;\n\n return (\n this.#contextProviderRef.value?.setAuthConfig(config) ?? {\n accessToken: undefined,\n environment: undefined,\n tenant: undefined,\n }\n );\n }\n\n /**\n * Starts a recording.\n */\n public startRecording(): void {\n this.#recordingButtonRef.value?.startRecording();\n }\n\n /**\n * Stops a recording.\n */\n public stopRecording(): void {\n this.#recordingButtonRef.value?.stopRecording();\n }\n\n /**\n * Starts or stops recording. Convenience layer on top of the start/stop methods.\n */\n public toggleRecording(): void {\n this.#recordingButtonRef.value?.toggleRecording();\n }\n\n /**\n * Opens the WebSocket connection without starting recording.\n * Use this to pre-establish the connection before recording starts.\n */\n public async openConnection(): Promise<void> {\n await this.#recordingButtonRef.value?.openConnection();\n }\n\n /**\n * Closes the WebSocket connection by sending \"end\" and waiting for \"ended\".\n * Call this to receive \"usage\" statistics or when done with the connection.\n */\n public async closeConnection(): Promise<void> {\n await this.#recordingButtonRef.value?.closeConnection();\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Render\n // ─────────────────────────────────────────────────────────────────────────────\n\n render() {\n const isHidden =\n !this.accessToken &&\n !this.authConfig &&\n !this.socketUrl &&\n !this.socketProxy;\n\n return html`\n <dictation-root\n ${ref(this.#contextProviderRef)}\n class=${classMap({ hidden: isHidden })}\n .accessToken=${this.accessToken}\n .authConfig=${this.authConfig}\n .socketUrl=${this.socketUrl}\n .socketProxy=${this.socketProxy}\n .dictationConfig=${this._dictationConfig}\n .languages=${this._languagesSupported}\n .devices=${this._devices}\n .selectedDevice=${this._selectedDevice}\n .debug_displayAudio=${this.debug_displayAudio}\n .pushToTalkKeybinding=${this._pushToTalkKeybinding}\n .toggleToTalkKeybinding=${this._toggleToTalkKeybinding}\n >\n <dictation-recording-button\n ${ref(this.#recordingButtonRef)}\n ?allowButtonFocus=${this.allowButtonFocus}\n ></dictation-recording-button>\n ${\n this.settingsEnabled?.length > 0\n ? html`<dictation-settings-menu\n .settingsEnabled=${this.settingsEnabled}\n ></dictation-settings-menu>`\n : nothing\n }\n </dictation-root>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"corti-dictation\": CortiDictation;\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export declare class DictationKeybindingInput extends LitElement {
|
|
3
|
+
#private;
|
|
4
|
+
keybindingType: "push-to-talk" | "toggle-to-talk";
|
|
5
|
+
_pushToTalkKeybinding?: string | null;
|
|
6
|
+
_toggleToTalkKeybinding?: string | null;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
_isCapturingKeybinding: boolean;
|
|
9
|
+
static styles: import("lit").CSSResult[];
|
|
10
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
"dictation-keybinding-input": DictationKeybindingInput;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _DictationKeybindingInput_instances, _DictationKeybindingInput_handleKeybindingInputFocus, _DictationKeybindingInput_handleKeybindingInputBlur, _DictationKeybindingInput_handleKeybindingKeyDown;
|
|
13
|
+
import { consume } from "@lit/context";
|
|
14
|
+
import { html, LitElement } from "lit";
|
|
15
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
+
import { pushToTalkKeybindingContext, toggleToTalkKeybindingContext, } from "../contexts/dictation-context.js";
|
|
17
|
+
import KeybindingSelectorStyles from "../styles/keybinding-selector.js";
|
|
18
|
+
import { keybindingChangedEvent } from "../utils/events.js";
|
|
19
|
+
import { normalizeKeybinding } from "../utils/keybinding.js";
|
|
20
|
+
let DictationKeybindingInput = class DictationKeybindingInput extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
_DictationKeybindingInput_instances.add(this);
|
|
24
|
+
this.keybindingType = "toggle-to-talk";
|
|
25
|
+
this.disabled = false;
|
|
26
|
+
this._isCapturingKeybinding = false;
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
const keybinding = this.keybindingType === "push-to-talk"
|
|
30
|
+
? this._pushToTalkKeybinding
|
|
31
|
+
: this._toggleToTalkKeybinding;
|
|
32
|
+
const label = this.keybindingType === "push-to-talk"
|
|
33
|
+
? "Push-to-Talk keybinding"
|
|
34
|
+
: "Toggle-to-Talk keybinding";
|
|
35
|
+
return html `
|
|
36
|
+
<div>
|
|
37
|
+
<label>${label}</label>
|
|
38
|
+
<div class="keybinding-selector-wrapper">
|
|
39
|
+
${keybinding && html `<div class="keybinding-key">${keybinding}</div>`}
|
|
40
|
+
<input
|
|
41
|
+
type="text"
|
|
42
|
+
class="keybinding-selector-input"
|
|
43
|
+
.value=""
|
|
44
|
+
placeholder="Click and press a key..."
|
|
45
|
+
readonly
|
|
46
|
+
@focusin=${__classPrivateFieldGet(this, _DictationKeybindingInput_instances, "m", _DictationKeybindingInput_handleKeybindingInputFocus)}
|
|
47
|
+
@focusout=${__classPrivateFieldGet(this, _DictationKeybindingInput_instances, "m", _DictationKeybindingInput_handleKeybindingInputBlur)}
|
|
48
|
+
@keydown=${__classPrivateFieldGet(this, _DictationKeybindingInput_instances, "m", _DictationKeybindingInput_handleKeybindingKeyDown)}
|
|
49
|
+
?disabled=${this.disabled}
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
_DictationKeybindingInput_instances = new WeakSet();
|
|
57
|
+
_DictationKeybindingInput_handleKeybindingInputFocus = function _DictationKeybindingInput_handleKeybindingInputFocus() {
|
|
58
|
+
this._isCapturingKeybinding = true;
|
|
59
|
+
};
|
|
60
|
+
_DictationKeybindingInput_handleKeybindingInputBlur = function _DictationKeybindingInput_handleKeybindingInputBlur() {
|
|
61
|
+
this._isCapturingKeybinding = false;
|
|
62
|
+
};
|
|
63
|
+
_DictationKeybindingInput_handleKeybindingKeyDown = function _DictationKeybindingInput_handleKeybindingKeyDown(event) {
|
|
64
|
+
if (!this._isCapturingKeybinding) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
event.stopPropagation();
|
|
69
|
+
const keybinding = normalizeKeybinding(event.key);
|
|
70
|
+
this.dispatchEvent(keybindingChangedEvent(event.key, event.code, keybinding, this.keybindingType));
|
|
71
|
+
};
|
|
72
|
+
DictationKeybindingInput.styles = KeybindingSelectorStyles;
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: String })
|
|
75
|
+
], DictationKeybindingInput.prototype, "keybindingType", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
consume({ context: pushToTalkKeybindingContext, subscribe: true }),
|
|
78
|
+
state()
|
|
79
|
+
], DictationKeybindingInput.prototype, "_pushToTalkKeybinding", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
consume({ context: toggleToTalkKeybindingContext, subscribe: true }),
|
|
82
|
+
state()
|
|
83
|
+
], DictationKeybindingInput.prototype, "_toggleToTalkKeybinding", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
property({ type: Boolean })
|
|
86
|
+
], DictationKeybindingInput.prototype, "disabled", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
state()
|
|
89
|
+
], DictationKeybindingInput.prototype, "_isCapturingKeybinding", void 0);
|
|
90
|
+
DictationKeybindingInput = __decorate([
|
|
91
|
+
customElement("dictation-keybinding-input")
|
|
92
|
+
], DictationKeybindingInput);
|
|
93
|
+
export { DictationKeybindingInput };
|
|
94
|
+
//# sourceMappingURL=keybinding-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keybinding-input.js","sourceRoot":"","sources":["../../src/components/keybinding-input.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,wBAAwB,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGtD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,UAAU;IAAjD;;;QAEL,mBAAc,GAAsC,gBAAgB,CAAC;QAWrE,aAAQ,GAAY,KAAK,CAAC;QAG1B,2BAAsB,GAAY,KAAK,CAAC;IA8D1C,CAAC;IA9BC,MAAM;QACJ,MAAM,UAAU,GACd,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,EAAE,6BAA6B,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACpE,KAAK,EAAE;yEACgC;AAGxC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0DACF;AAG1B;IADC,KAAK,EAAE;wEACgC;AAhB7B,wBAAwB;IADpC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,wBAAwB,CA8EpC","sourcesContent":["import { consume } from \"@lit/context\";\nimport { html, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport {\n pushToTalkKeybindingContext,\n toggleToTalkKeybindingContext,\n} from \"../contexts/dictation-context.js\";\nimport KeybindingSelectorStyles from \"../styles/keybinding-selector.js\";\nimport { keybindingChangedEvent } from \"../utils/events.js\";\nimport { normalizeKeybinding } from \"../utils/keybinding.js\";\n\n@customElement(\"dictation-keybinding-input\")\nexport class DictationKeybindingInput extends LitElement {\n @property({ type: String })\n keybindingType: \"push-to-talk\" | \"toggle-to-talk\" = \"toggle-to-talk\";\n\n @consume({ context: pushToTalkKeybindingContext, subscribe: true })\n @state()\n _pushToTalkKeybinding?: string | null;\n\n @consume({ context: toggleToTalkKeybindingContext, subscribe: true })\n @state()\n _toggleToTalkKeybinding?: string | null;\n\n @property({ type: Boolean })\n disabled: boolean = false;\n\n @state()\n _isCapturingKeybinding: boolean = false;\n\n static styles = KeybindingSelectorStyles;\n\n #handleKeybindingInputFocus(): void {\n this._isCapturingKeybinding = true;\n }\n\n #handleKeybindingInputBlur(): void {\n this._isCapturingKeybinding = false;\n }\n\n #handleKeybindingKeyDown(event: KeyboardEvent): void {\n if (!this._isCapturingKeybinding) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n const keybinding = normalizeKeybinding(event.key);\n\n this.dispatchEvent(\n keybindingChangedEvent(\n event.key,\n event.code,\n keybinding,\n this.keybindingType,\n ),\n );\n }\n\n render() {\n const keybinding =\n this.keybindingType === \"push-to-talk\"\n ? this._pushToTalkKeybinding\n : this._toggleToTalkKeybinding;\n const label =\n this.keybindingType === \"push-to-talk\"\n ? \"Push-to-Talk keybinding\"\n : \"Toggle-to-Talk keybinding\";\n\n return html`\n <div>\n <label>${label}</label>\n <div class=\"keybinding-selector-wrapper\">\n ${keybinding && html`<div class=\"keybinding-key\">${keybinding}</div>`}\n <input\n type=\"text\"\n class=\"keybinding-selector-input\"\n .value=\"\"\n placeholder=\"Click and press a key...\"\n readonly\n @focusin=${this.#handleKeybindingInputFocus}\n @focusout=${this.#handleKeybindingInputBlur}\n @keydown=${this.#handleKeybindingKeyDown}\n ?disabled=${this.disabled}\n />\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-keybinding-input\": DictationKeybindingInput;\n }\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
import "./keybinding-input.js";
|
|
2
3
|
export declare class DictationKeybindingSelector extends LitElement {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
_pushToTalkKeybinding?: string | null;
|
|
5
|
+
_toggleToTalkKeybinding?: string | null;
|
|
5
6
|
disabled: boolean;
|
|
6
|
-
_isCapturingKeybinding: boolean;
|
|
7
7
|
static styles: import("lit").CSSResult[];
|
|
8
8
|
render(): import("lit-html").TemplateResult<1>;
|
|
9
9
|
}
|
|
@@ -4,76 +4,48 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _DictationKeybindingSelector_instances, _DictationKeybindingSelector_handleKeybindingInputFocus, _DictationKeybindingSelector_handleKeybindingInputBlur, _DictationKeybindingSelector_handleKeybindingKeyDown;
|
|
13
7
|
import { consume } from "@lit/context";
|
|
14
8
|
import { html, LitElement } from "lit";
|
|
15
9
|
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
-
import {
|
|
10
|
+
import { pushToTalkKeybindingContext, toggleToTalkKeybindingContext, } from "../contexts/dictation-context.js";
|
|
17
11
|
import KeybindingSelectorStyles from "../styles/keybinding-selector.js";
|
|
18
|
-
import
|
|
12
|
+
import "./keybinding-input.js";
|
|
19
13
|
let DictationKeybindingSelector = class DictationKeybindingSelector extends LitElement {
|
|
20
14
|
constructor() {
|
|
21
15
|
super(...arguments);
|
|
22
|
-
_DictationKeybindingSelector_instances.add(this);
|
|
23
16
|
this.disabled = false;
|
|
24
|
-
this._isCapturingKeybinding = false;
|
|
25
17
|
}
|
|
26
18
|
render() {
|
|
27
19
|
return html `
|
|
28
|
-
<div>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
?disabled=${this.disabled}
|
|
42
|
-
/>
|
|
43
|
-
</div>
|
|
44
|
-
<p class="keybinding-help">
|
|
45
|
-
Press ${this._keybinding} to start/stop recording
|
|
46
|
-
</p>
|
|
20
|
+
<div class="settings-group">
|
|
21
|
+
<dictation-keybinding-input
|
|
22
|
+
keybindingType="toggle-to-talk"
|
|
23
|
+
?disabled=${this.disabled}
|
|
24
|
+
></dictation-keybinding-input>
|
|
25
|
+
<dictation-keybinding-input
|
|
26
|
+
keybindingType="push-to-talk"
|
|
27
|
+
?disabled=${this.disabled}
|
|
28
|
+
></dictation-keybinding-input>
|
|
29
|
+
${(this._toggleToTalkKeybinding || this._pushToTalkKeybinding) &&
|
|
30
|
+
html `<p class="keybinding-help">
|
|
31
|
+
${html `Press ${[this._toggleToTalkKeybinding, this._pushToTalkKeybinding].join(" or ")} to start/stop recording`}
|
|
32
|
+
</p>`}
|
|
47
33
|
</div>
|
|
48
34
|
`;
|
|
49
35
|
}
|
|
50
36
|
};
|
|
51
|
-
_DictationKeybindingSelector_instances = new WeakSet();
|
|
52
|
-
_DictationKeybindingSelector_handleKeybindingInputFocus = function _DictationKeybindingSelector_handleKeybindingInputFocus() {
|
|
53
|
-
this._isCapturingKeybinding = true;
|
|
54
|
-
};
|
|
55
|
-
_DictationKeybindingSelector_handleKeybindingInputBlur = function _DictationKeybindingSelector_handleKeybindingInputBlur() {
|
|
56
|
-
this._isCapturingKeybinding = false;
|
|
57
|
-
};
|
|
58
|
-
_DictationKeybindingSelector_handleKeybindingKeyDown = function _DictationKeybindingSelector_handleKeybindingKeyDown(event) {
|
|
59
|
-
if (!this._isCapturingKeybinding) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
event.preventDefault();
|
|
63
|
-
event.stopPropagation();
|
|
64
|
-
this.dispatchEvent(keybindingChangedEvent(event.key, event.code));
|
|
65
|
-
};
|
|
66
37
|
DictationKeybindingSelector.styles = KeybindingSelectorStyles;
|
|
67
38
|
__decorate([
|
|
68
|
-
consume({ context:
|
|
39
|
+
consume({ context: pushToTalkKeybindingContext, subscribe: true }),
|
|
69
40
|
state()
|
|
70
|
-
], DictationKeybindingSelector.prototype, "
|
|
41
|
+
], DictationKeybindingSelector.prototype, "_pushToTalkKeybinding", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
consume({ context: toggleToTalkKeybindingContext, subscribe: true }),
|
|
44
|
+
state()
|
|
45
|
+
], DictationKeybindingSelector.prototype, "_toggleToTalkKeybinding", void 0);
|
|
71
46
|
__decorate([
|
|
72
47
|
property({ type: Boolean })
|
|
73
48
|
], DictationKeybindingSelector.prototype, "disabled", void 0);
|
|
74
|
-
__decorate([
|
|
75
|
-
state()
|
|
76
|
-
], DictationKeybindingSelector.prototype, "_isCapturingKeybinding", void 0);
|
|
77
49
|
DictationKeybindingSelector = __decorate([
|
|
78
50
|
customElement("dictation-keybinding-selector")
|
|
79
51
|
], DictationKeybindingSelector);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keybinding-selector.js","sourceRoot":"","sources":["../../src/components/keybinding-selector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keybinding-selector.js","sourceRoot":"","sources":["../../src/components/keybinding-selector.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,wBAAwB,MAAM,kCAAkC,CAAC;AAExE,OAAO,uBAAuB,CAAC;AAGxB,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,UAAU;IAApD;;QAUL,aAAQ,GAAY,KAAK,CAAC;IAwB5B,CAAC;IApBC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;sBAIO,IAAI,CAAC,QAAQ;;;;sBAIb,IAAI,CAAC,QAAQ;;UAGzB,CAAC,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC,qBAAqB,CAAC;YAC5D,IAAI,CAAA;cACA,IAAI,CAAA,SAAS,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,0BAA0B;eAEpH;;KAEH,CAAC;IACJ,CAAC;;AArBM,kCAAM,GAAG,wBAAwB,AAA3B,CAA4B;AATzC;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClE,KAAK,EAAE;0EAC8B;AAItC;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACpE,KAAK,EAAE;4EACgC;AAGxC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6DACF;AAVf,2BAA2B;IADvC,aAAa,CAAC,+BAA+B,CAAC;GAClC,2BAA2B,CAkCvC","sourcesContent":["import { consume } from \"@lit/context\";\nimport { html, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport {\n pushToTalkKeybindingContext,\n toggleToTalkKeybindingContext,\n} from \"../contexts/dictation-context.js\";\nimport KeybindingSelectorStyles from \"../styles/keybinding-selector.js\";\n\nimport \"./keybinding-input.js\";\n\n@customElement(\"dictation-keybinding-selector\")\nexport class DictationKeybindingSelector extends LitElement {\n @consume({ context: pushToTalkKeybindingContext, subscribe: true })\n @state()\n _pushToTalkKeybinding?: string | null;\n\n @consume({ context: toggleToTalkKeybindingContext, subscribe: true })\n @state()\n _toggleToTalkKeybinding?: string | null;\n\n @property({ type: Boolean })\n disabled: boolean = false;\n\n static styles = KeybindingSelectorStyles;\n\n render() {\n return html`\n <div class=\"settings-group\">\n <dictation-keybinding-input\n keybindingType=\"toggle-to-talk\"\n ?disabled=${this.disabled}\n ></dictation-keybinding-input>\n <dictation-keybinding-input\n keybindingType=\"push-to-talk\"\n ?disabled=${this.disabled}\n ></dictation-keybinding-input>\n ${\n (this._toggleToTalkKeybinding || this._pushToTalkKeybinding) &&\n html`<p class=\"keybinding-help\">\n ${html`Press ${[this._toggleToTalkKeybinding, this._pushToTalkKeybinding].join(\" or \")} to start/stop recording`}\n </p>`\n }\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-keybinding-selector\": DictationKeybindingSelector;\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Corti } from "@corti/sdk";
|
|
2
2
|
import { type CSSResultGroup, LitElement, type PropertyValues } from "lit";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ProxyOptions, RecordingState } from "../types.js";
|
|
4
4
|
import "./audio-visualiser.js";
|
|
5
5
|
import "../icons/icons.js";
|
|
6
6
|
export declare class DictationRecordingButton extends LitElement {
|
|
@@ -15,14 +15,16 @@ export declare class DictationRecordingButton extends LitElement {
|
|
|
15
15
|
_socketUrl?: string;
|
|
16
16
|
_socketProxy?: ProxyOptions;
|
|
17
17
|
_debug_displayAudio?: boolean;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
_pushToTalkKeybinding?: string | null;
|
|
19
|
+
_toggleToTalkKeybinding?: string | null;
|
|
20
20
|
allowButtonFocus: boolean;
|
|
21
21
|
static styles: CSSResultGroup;
|
|
22
22
|
protected update(changedProperties: PropertyValues): void;
|
|
23
23
|
startRecording(): void;
|
|
24
24
|
stopRecording(): void;
|
|
25
25
|
toggleRecording(): void;
|
|
26
|
+
openConnection(): Promise<void>;
|
|
27
|
+
closeConnection(): Promise<void>;
|
|
26
28
|
render(): import("lit-html").TemplateResult<1>;
|
|
27
29
|
}
|
|
28
30
|
declare global {
|