@corti/dictation-web 0.6.0 → 0.7.0-ambient
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/bundle.js +1838 -1455
- package/dist/components/ambient-recording-button.d.ts +16 -0
- package/dist/components/ambient-recording-button.js +68 -0
- package/dist/components/ambient-recording-button.js.map +1 -0
- package/dist/components/corti-ambient.d.ts +27 -0
- package/dist/components/corti-ambient.js +97 -0
- package/dist/components/corti-ambient.js.map +1 -0
- package/dist/components/corti-dictation.d.ts +9 -109
- package/dist/components/corti-dictation.js +12 -187
- package/dist/components/corti-dictation.js.map +1 -1
- package/dist/components/corti-root.d.ts +121 -0
- package/dist/components/corti-root.js +196 -0
- package/dist/components/corti-root.js.map +1 -0
- package/dist/components/device-selector.js +1 -1
- package/dist/components/device-selector.js.map +1 -1
- package/dist/components/dictation-recording-button.d.ts +13 -0
- package/dist/components/dictation-recording-button.js +30 -0
- package/dist/components/dictation-recording-button.js.map +1 -0
- package/dist/components/keybinding-input.js +1 -1
- package/dist/components/keybinding-input.js.map +1 -1
- package/dist/components/keybinding-selector.js +1 -1
- package/dist/components/keybinding-selector.js.map +1 -1
- package/dist/components/language-selector.js +2 -1
- package/dist/components/language-selector.js.map +1 -1
- package/dist/components/{recording-button.d.ts → recording-button-base.d.ts} +7 -9
- package/dist/components/recording-button-base.js +321 -0
- package/dist/components/recording-button-base.js.map +1 -0
- package/dist/components/settings-menu.js +1 -1
- package/dist/components/settings-menu.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +9 -0
- package/dist/constants.js.map +1 -1
- package/dist/contexts/ambient-context.d.ts +18 -0
- package/dist/contexts/ambient-context.js +48 -0
- package/dist/contexts/ambient-context.js.map +1 -0
- package/dist/contexts/dictation-context.d.ts +3 -92
- package/dist/contexts/dictation-context.js +5 -257
- package/dist/contexts/dictation-context.js.map +1 -1
- package/dist/contexts/mixins/auth-context.d.ts +32 -0
- package/dist/contexts/mixins/auth-context.js +116 -0
- package/dist/contexts/mixins/auth-context.js.map +1 -0
- package/dist/contexts/mixins/devices-context.d.ts +14 -0
- package/dist/contexts/mixins/devices-context.js +58 -0
- package/dist/contexts/mixins/devices-context.js.map +1 -0
- package/dist/contexts/mixins/keybindings-context.d.ts +13 -0
- package/dist/contexts/mixins/keybindings-context.js +62 -0
- package/dist/contexts/mixins/keybindings-context.js.map +1 -0
- package/dist/contexts/mixins/languages-context.d.ts +11 -0
- package/dist/contexts/mixins/languages-context.js +54 -0
- package/dist/contexts/mixins/languages-context.js.map +1 -0
- package/dist/contexts/mixins/proxy-context.d.ts +14 -0
- package/dist/contexts/mixins/proxy-context.js +24 -0
- package/dist/contexts/mixins/proxy-context.js.map +1 -0
- package/dist/contexts/mixins/recording-state-context.d.ts +13 -0
- package/dist/contexts/mixins/recording-state-context.js +30 -0
- package/dist/contexts/mixins/recording-state-context.js.map +1 -0
- package/dist/contexts/mixins/types.d.ts +5 -0
- package/dist/contexts/mixins/types.js +2 -0
- package/dist/contexts/mixins/types.js.map +1 -0
- package/dist/contexts/root-context.d.ts +8 -0
- package/dist/contexts/root-context.js +34 -0
- package/dist/contexts/root-context.js.map +1 -0
- package/dist/controllers/ambient-controller.d.ts +16 -0
- package/dist/controllers/ambient-controller.js +24 -0
- package/dist/controllers/ambient-controller.js.map +1 -0
- package/dist/controllers/dictation-controller.d.ts +8 -31
- package/dist/controllers/dictation-controller.js +17 -283
- package/dist/controllers/dictation-controller.js.map +1 -1
- package/dist/controllers/languages-controller.js +0 -4
- package/dist/controllers/languages-controller.js.map +1 -1
- package/dist/controllers/socket-controller.d.ts +51 -0
- package/dist/controllers/socket-controller.js +281 -0
- package/dist/controllers/socket-controller.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/devices.d.ts +12 -8
- package/dist/utils/devices.js +39 -28
- package/dist/utils/devices.js.map +1 -1
- package/dist/utils/events.d.ts +5 -3
- package/dist/utils/events.js +7 -0
- package/dist/utils/events.js.map +1 -1
- package/dist/utils/keybinding.d.ts +2 -1
- package/dist/utils/keybinding.js +12 -6
- package/dist/utils/keybinding.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/recording-button.js +0 -331
- package/dist/components/recording-button.js.map +0 -1
|
@@ -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;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,CAAC;QAEjE;;;;WAIG;QAEH,qBAAgB,GAAY,KAAK,CAAC;QAElC;;;WAGG;QAEH,uBAAkB,GAAY,KAAK,CAAC;QAiBpC,qBAAgB,GAA2B,wBAAwB,CAAC;IAuMtE,CAAC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T1B","sourcesContent":["import type { Corti, CortiAuth } 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?: CortiAuth.AuthTokenDerivable;\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: CortiAuth.AuthTokenDerivable) {\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"]}
|
|
1
|
+
{"version":3,"file":"corti-dictation.js","sourceRoot":"","sources":["../../src/components/corti-dictation.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,iCAAiC,CAAC;AACzC,OAAO,oBAAoB,CAAC;AAGrB,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,SAGnC;IAHM;QAIL,gFAAgF;QAChF,aAAa;QACb,gFAAgF;;QAEhF;;;WAGG;QAEH,uBAAkB,GAAY,KAAK,CAAC;QAiBpC,qBAAgB,GAA2B,wBAAwB,CAAC;IAiFtE,CAAC;IAhGC;;OAEG;IAEH,IAAI,eAAe,CAAC,KAA6B;QAC/C,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,CACL,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,eAAe,IAAI,IAAI,CAAC,gBAAgB,CACzE,CAAC;IACJ,CAAC;IAKD,gFAAgF;IAChF,iBAAiB;IACjB,gFAAgF;IAEhF;;;;OAIG;IACI,cAAc,CAAC,KAAa;QACjC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAEzB,OAAO,CACL,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI;YACvD,WAAW,EAAE,KAAK;YAClB,WAAW,E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AC,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;AA9BzD,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA+G1B","sourcesContent":["import type { Corti, CortiAuth } from \"@corti/sdk\";\nimport { html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ref } from \"lit/directives/ref.js\";\nimport { DEFAULT_DICTATION_CONFIG } from \"../constants.js\";\nimport type { DictationRoot } from \"../contexts/dictation-context.js\";\nimport { CortiRoot } from \"./corti-root.js\";\nimport type { DictationRecordingButton } from \"./dictation-recording-button.js\";\n\nimport \"../contexts/dictation-context.js\";\nimport \"./dictation-recording-button.js\";\nimport \"./settings-menu.js\";\n\n@customElement(\"corti-dictation\")\nexport class CortiDictation extends CortiRoot<\n DictationRoot,\n DictationRecordingButton\n> {\n // ─────────────────────────────────────────────────────────────────────────────\n // Properties\n // ─────────────────────────────────────────────────────────────────────────────\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 // 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: CortiAuth.AuthTokenDerivable) {\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 // 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,121 @@
|
|
|
1
|
+
import type { Corti, CortiAuth } from "@corti/sdk";
|
|
2
|
+
import { LitElement } from "lit";
|
|
3
|
+
import { type Ref } from "lit/directives/ref.js";
|
|
4
|
+
import type { ConfigurableSettings, ProxyOptions, RecordingState } from "../types.js";
|
|
5
|
+
type CortiProviderRoot = LitElement & {
|
|
6
|
+
recordingState?: RecordingState;
|
|
7
|
+
languages?: Corti.TranscribeSupportedLanguage[];
|
|
8
|
+
devices?: MediaDeviceInfo[];
|
|
9
|
+
selectedDevice?: MediaDeviceInfo | undefined;
|
|
10
|
+
pushToTalkKeybinding?: string | null | undefined;
|
|
11
|
+
toggleToTalkKeybinding?: string | null | undefined;
|
|
12
|
+
};
|
|
13
|
+
type CortiRecordingButtonHost = LitElement & {
|
|
14
|
+
startRecording(): void;
|
|
15
|
+
stopRecording(): void;
|
|
16
|
+
toggleRecording(): void;
|
|
17
|
+
openConnection(): Promise<void>;
|
|
18
|
+
closeConnection(): Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Shared base for all-in-one Corti host elements (e.g. corti-dictation, corti-ambient).
|
|
22
|
+
* Intentionally minimal; shared behavior will move here incrementally.
|
|
23
|
+
*/
|
|
24
|
+
export declare class CortiRoot<TRoot extends CortiProviderRoot = CortiProviderRoot, TRecordingButton extends CortiRecordingButtonHost = CortiRecordingButtonHost> extends LitElement {
|
|
25
|
+
static styles: import("lit").CSSResult;
|
|
26
|
+
/**
|
|
27
|
+
* Latest access token
|
|
28
|
+
*/
|
|
29
|
+
accessToken?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Authentication configuration with optional refresh mechanism.
|
|
32
|
+
*/
|
|
33
|
+
authConfig?: CortiAuth.AuthTokenDerivable;
|
|
34
|
+
/**
|
|
35
|
+
* WebSocket URL for proxy connection. When provided, uses CortiWebSocketProxyClient instead of CortiClient.
|
|
36
|
+
*/
|
|
37
|
+
socketUrl?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Socket proxy configuration object. When provided, uses CortiWebSocketProxyClient instead of CortiClient.
|
|
40
|
+
*/
|
|
41
|
+
socketProxy?: ProxyOptions;
|
|
42
|
+
/**
|
|
43
|
+
* Which settings should be available in the UI.
|
|
44
|
+
* If an empty array is passed, the settings will be disabled entirely.
|
|
45
|
+
* Options are language and devices
|
|
46
|
+
*/
|
|
47
|
+
settingsEnabled: ConfigurableSettings[];
|
|
48
|
+
/**
|
|
49
|
+
* When false (default), allows the start/stop button from taking focus when clicked,
|
|
50
|
+
* disabling textareas or other input elements to maintain focus.
|
|
51
|
+
* Set to "true" to allow the button to receive focus on click.
|
|
52
|
+
*/
|
|
53
|
+
allowButtonFocus: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* List of all language codes available for use with the Web Component.
|
|
56
|
+
* Default list depends on the accessToken
|
|
57
|
+
*/
|
|
58
|
+
set languagesSupported(value: Corti.TranscribeSupportedLanguage[] | undefined);
|
|
59
|
+
get languagesSupported(): Corti.TranscribeSupportedLanguage[];
|
|
60
|
+
protected _languagesSupported?: Corti.TranscribeSupportedLanguage[];
|
|
61
|
+
/**
|
|
62
|
+
* List of available recording devices
|
|
63
|
+
*/
|
|
64
|
+
set devices(value: MediaDeviceInfo[] | undefined);
|
|
65
|
+
get devices(): MediaDeviceInfo[];
|
|
66
|
+
protected _devices?: MediaDeviceInfo[];
|
|
67
|
+
/**
|
|
68
|
+
* The selected device used for recording (MediaDeviceInfo).
|
|
69
|
+
*/
|
|
70
|
+
set selectedDevice(value: MediaDeviceInfo | undefined);
|
|
71
|
+
get selectedDevice(): MediaDeviceInfo | undefined;
|
|
72
|
+
protected _selectedDevice?: MediaDeviceInfo;
|
|
73
|
+
/**
|
|
74
|
+
* Push-to-talk keybinding for keyboard shortcut. Single key only (e.g., "Space", "k", "meta", "ctrl").
|
|
75
|
+
* Combinations with "+" are not supported.
|
|
76
|
+
* Keydown starts recording, keyup stops recording.
|
|
77
|
+
* Defaults to "Space" if keybinding is in settingsEnabled, otherwise undefined
|
|
78
|
+
*/
|
|
79
|
+
set pushToTalkKeybinding(value: string | null | undefined);
|
|
80
|
+
get pushToTalkKeybinding(): string | null | undefined;
|
|
81
|
+
protected _pushToTalkKeybinding?: string | null;
|
|
82
|
+
/**
|
|
83
|
+
* Toggle-to-talk keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
|
|
84
|
+
* Combinations with "+" are not supported.
|
|
85
|
+
* Pressing the key toggles recording on/off.
|
|
86
|
+
* Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
|
|
87
|
+
*/
|
|
88
|
+
set toggleToTalkKeybinding(value: string | null | undefined);
|
|
89
|
+
get toggleToTalkKeybinding(): string | null | undefined;
|
|
90
|
+
protected _toggleToTalkKeybinding?: string | null;
|
|
91
|
+
protected _contextProviderRef: Ref<TRoot>;
|
|
92
|
+
protected _recordingButtonRef: Ref<TRecordingButton>;
|
|
93
|
+
/**
|
|
94
|
+
* Current state of recording (stopped, recording, initializing and stopping, ).
|
|
95
|
+
*/
|
|
96
|
+
get recordingState(): RecordingState;
|
|
97
|
+
/**
|
|
98
|
+
* Starts a recording.
|
|
99
|
+
*/
|
|
100
|
+
startRecording(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Stops a recording.
|
|
103
|
+
*/
|
|
104
|
+
stopRecording(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Starts or stops recording. Convenience layer on top of the start/stop methods.
|
|
107
|
+
*/
|
|
108
|
+
toggleRecording(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Opens the WebSocket connection without starting recording.
|
|
111
|
+
* Use this to pre-establish the connection before recording starts.
|
|
112
|
+
*/
|
|
113
|
+
openConnection(): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Closes the WebSocket connection by sending "end" and waiting for "ended".
|
|
116
|
+
* Call this to receive "usage" statistics or when done with the connection.
|
|
117
|
+
*/
|
|
118
|
+
closeConnection(): Promise<void>;
|
|
119
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
120
|
+
}
|
|
121
|
+
export {};
|
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
import { css, html, LitElement } from "lit";
|
|
8
|
+
import { property, state } from "lit/decorators.js";
|
|
9
|
+
import { createRef } from "lit/directives/ref.js";
|
|
10
|
+
import { commaSeparatedConverter } from "../utils/converters.js";
|
|
11
|
+
/**
|
|
12
|
+
* Shared base for all-in-one Corti host elements (e.g. corti-dictation, corti-ambient).
|
|
13
|
+
* Intentionally minimal; shared behavior will move here incrementally.
|
|
14
|
+
*/
|
|
15
|
+
export class CortiRoot extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
/**
|
|
19
|
+
* Which settings should be available in the UI.
|
|
20
|
+
* If an empty array is passed, the settings will be disabled entirely.
|
|
21
|
+
* Options are language and devices
|
|
22
|
+
*/
|
|
23
|
+
this.settingsEnabled = ["device", "language"];
|
|
24
|
+
/**
|
|
25
|
+
* When false (default), allows the start/stop button from taking focus when clicked,
|
|
26
|
+
* disabling textareas or other input elements to maintain focus.
|
|
27
|
+
* Set to "true" to allow the button to receive focus on click.
|
|
28
|
+
*/
|
|
29
|
+
this.allowButtonFocus = false;
|
|
30
|
+
this._contextProviderRef = createRef();
|
|
31
|
+
this._recordingButtonRef = createRef();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* List of all language codes available for use with the Web Component.
|
|
35
|
+
* Default list depends on the accessToken
|
|
36
|
+
*/
|
|
37
|
+
set languagesSupported(value) {
|
|
38
|
+
this._languagesSupported = value;
|
|
39
|
+
}
|
|
40
|
+
get languagesSupported() {
|
|
41
|
+
return (this._contextProviderRef.value?.languages ||
|
|
42
|
+
this._languagesSupported ||
|
|
43
|
+
[]);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* List of available recording devices
|
|
47
|
+
*/
|
|
48
|
+
set devices(value) {
|
|
49
|
+
this._devices = value;
|
|
50
|
+
}
|
|
51
|
+
get devices() {
|
|
52
|
+
return this._contextProviderRef.value?.devices || this._devices || [];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The selected device used for recording (MediaDeviceInfo).
|
|
56
|
+
*/
|
|
57
|
+
set selectedDevice(value) {
|
|
58
|
+
this._selectedDevice = value;
|
|
59
|
+
}
|
|
60
|
+
get selectedDevice() {
|
|
61
|
+
return (this._contextProviderRef.value?.selectedDevice || this._selectedDevice);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Push-to-talk keybinding for keyboard shortcut. Single key only (e.g., "Space", "k", "meta", "ctrl").
|
|
65
|
+
* Combinations with "+" are not supported.
|
|
66
|
+
* Keydown starts recording, keyup stops recording.
|
|
67
|
+
* Defaults to "Space" if keybinding is in settingsEnabled, otherwise undefined
|
|
68
|
+
*/
|
|
69
|
+
set pushToTalkKeybinding(value) {
|
|
70
|
+
this._pushToTalkKeybinding = value;
|
|
71
|
+
}
|
|
72
|
+
get pushToTalkKeybinding() {
|
|
73
|
+
return (this._contextProviderRef.value?.pushToTalkKeybinding ||
|
|
74
|
+
this._pushToTalkKeybinding);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Toggle-to-talk keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
|
|
78
|
+
* Combinations with "+" are not supported.
|
|
79
|
+
* Pressing the key toggles recording on/off.
|
|
80
|
+
* Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
|
|
81
|
+
*/
|
|
82
|
+
set toggleToTalkKeybinding(value) {
|
|
83
|
+
this._toggleToTalkKeybinding = value;
|
|
84
|
+
}
|
|
85
|
+
get toggleToTalkKeybinding() {
|
|
86
|
+
return (this._contextProviderRef.value?.toggleToTalkKeybinding ||
|
|
87
|
+
this._toggleToTalkKeybinding);
|
|
88
|
+
}
|
|
89
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
90
|
+
// Public methods
|
|
91
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
92
|
+
/**
|
|
93
|
+
* Current state of recording (stopped, recording, initializing and stopping, ).
|
|
94
|
+
*/
|
|
95
|
+
get recordingState() {
|
|
96
|
+
return this._contextProviderRef.value?.recordingState ?? "stopped";
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Starts a recording.
|
|
100
|
+
*/
|
|
101
|
+
startRecording() {
|
|
102
|
+
this._recordingButtonRef.value?.startRecording();
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Stops a recording.
|
|
106
|
+
*/
|
|
107
|
+
stopRecording() {
|
|
108
|
+
this._recordingButtonRef.value?.stopRecording();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Starts or stops recording. Convenience layer on top of the start/stop methods.
|
|
112
|
+
*/
|
|
113
|
+
toggleRecording() {
|
|
114
|
+
this._recordingButtonRef.value?.toggleRecording();
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Opens the WebSocket connection without starting recording.
|
|
118
|
+
* Use this to pre-establish the connection before recording starts.
|
|
119
|
+
*/
|
|
120
|
+
async openConnection() {
|
|
121
|
+
await this._recordingButtonRef.value?.openConnection();
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Closes the WebSocket connection by sending "end" and waiting for "ended".
|
|
125
|
+
* Call this to receive "usage" statistics or when done with the connection.
|
|
126
|
+
*/
|
|
127
|
+
async closeConnection() {
|
|
128
|
+
await this._recordingButtonRef.value?.closeConnection();
|
|
129
|
+
}
|
|
130
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
131
|
+
// Render
|
|
132
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
133
|
+
render() {
|
|
134
|
+
return html ``;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
CortiRoot.styles = css `
|
|
138
|
+
.hidden {
|
|
139
|
+
display: none;
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ type: String })
|
|
144
|
+
], CortiRoot.prototype, "accessToken", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
property({ attribute: false, type: Object })
|
|
147
|
+
], CortiRoot.prototype, "authConfig", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ type: String })
|
|
150
|
+
], CortiRoot.prototype, "socketUrl", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ attribute: false, type: Object })
|
|
153
|
+
], CortiRoot.prototype, "socketProxy", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
property({
|
|
156
|
+
converter: commaSeparatedConverter,
|
|
157
|
+
type: Array,
|
|
158
|
+
})
|
|
159
|
+
], CortiRoot.prototype, "settingsEnabled", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: Boolean })
|
|
162
|
+
], CortiRoot.prototype, "allowButtonFocus", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
property({
|
|
165
|
+
converter: commaSeparatedConverter,
|
|
166
|
+
type: Array,
|
|
167
|
+
})
|
|
168
|
+
], CortiRoot.prototype, "languagesSupported", null);
|
|
169
|
+
__decorate([
|
|
170
|
+
state()
|
|
171
|
+
], CortiRoot.prototype, "_languagesSupported", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
property({ attribute: false, type: Array })
|
|
174
|
+
], CortiRoot.prototype, "devices", null);
|
|
175
|
+
__decorate([
|
|
176
|
+
state()
|
|
177
|
+
], CortiRoot.prototype, "_devices", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
property({ attribute: false, type: Object })
|
|
180
|
+
], CortiRoot.prototype, "selectedDevice", null);
|
|
181
|
+
__decorate([
|
|
182
|
+
state()
|
|
183
|
+
], CortiRoot.prototype, "_selectedDevice", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
property({ type: String })
|
|
186
|
+
], CortiRoot.prototype, "pushToTalkKeybinding", null);
|
|
187
|
+
__decorate([
|
|
188
|
+
state()
|
|
189
|
+
], CortiRoot.prototype, "_pushToTalkKeybinding", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
property({ type: String })
|
|
192
|
+
], CortiRoot.prototype, "toggleToTalkKeybinding", null);
|
|
193
|
+
__decorate([
|
|
194
|
+
state()
|
|
195
|
+
], CortiRoot.prototype, "_toggleToTalkKeybinding", void 0);
|
|
196
|
+
//# sourceMappingURL=corti-root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corti-root.js","sourceRoot":"","sources":["../../src/components/corti-root.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAY,MAAM,uBAAuB,CAAC;AAM5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAmBjE;;;GAGG;AACH,MAAM,OAAO,SAGX,SAAQ,UAAU;IAHpB;;QAsCE;;;;WAIG;QAKH,oBAAe,GAA2B,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAEjE;;;;WAIG;QAEH,qBAAgB,GAAY,KAAK,CAAC;QAqGxB,wBAAmB,GAAe,SAAS,EAAE,CAAC;QAC9C,wBAAmB,GAA0B,SAAS,EAAE,CAAC;IAyDrE,CAAC;IA7JC;;;OAGG;IAKH,IAAI,kBAAkB,CAAC,KAEV;QACX,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;IACnC,CAAC;IAED,IAAI,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E,KAAK;KACZ,CAAC;mDAKD;AAWS;IADT,KAAK,EAAE;sDAC4D;AAMpE;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;wCAG3C;AAOS;IADT,KAAK,EAAE;2CAC+B;AAMvC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAG5C;AASS;IADT,KAAK,EAAE;kDACoC;AAS5C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAG1B;AAUS;IADT,KAAK,EAAE;wDACwC;AAShD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAG1B;AAUS;IADT,KAAK,EAAE;0DAC0C","sourcesContent":["import type { Corti, CortiAuth } from \"@corti/sdk\";\nimport { css, html, LitElement } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { createRef, type Ref } from \"lit/directives/ref.js\";\nimport type {\n ConfigurableSettings,\n ProxyOptions,\n RecordingState,\n} from \"../types.js\";\nimport { commaSeparatedConverter } from \"../utils/converters.js\";\n\ntype CortiProviderRoot = LitElement & {\n recordingState?: RecordingState;\n languages?: Corti.TranscribeSupportedLanguage[];\n devices?: MediaDeviceInfo[];\n selectedDevice?: MediaDeviceInfo | undefined;\n pushToTalkKeybinding?: string | null | undefined;\n toggleToTalkKeybinding?: string | null | undefined;\n};\n\ntype CortiRecordingButtonHost = LitElement & {\n startRecording(): void;\n stopRecording(): void;\n toggleRecording(): void;\n openConnection(): Promise<void>;\n closeConnection(): Promise<void>;\n};\n\n/**\n * Shared base for all-in-one Corti host elements (e.g. corti-dictation, corti-ambient).\n * Intentionally minimal; shared behavior will move here incrementally.\n */\nexport class CortiRoot<\n TRoot extends CortiProviderRoot = CortiProviderRoot,\n TRecordingButton extends CortiRecordingButtonHost = CortiRecordingButtonHost,\n> extends LitElement {\n static styles = css`\n .hidden {\n display: none;\n }\n `;\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?: CortiAuth.AuthTokenDerivable;\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 * 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 * 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 protected _languagesSupported?: Corti.TranscribeSupportedLanguage[];\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 protected _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 protected _selectedDevice?: MediaDeviceInfo;\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 protected _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 protected _toggleToTalkKeybinding?: string | null;\n\n protected _contextProviderRef: Ref<TRoot> = createRef();\n protected _recordingButtonRef: Ref<TRecordingButton> = createRef();\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Public methods\n // ─────────────────────────────────────────────────────────────────────────────\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 * 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 return html``;\n }\n}\n"]}
|
|
@@ -13,7 +13,7 @@ var _DictationDeviceSelector_instances, _DictationDeviceSelector_handleSelectDev
|
|
|
13
13
|
import { consume } from "@lit/context";
|
|
14
14
|
import { html, LitElement } from "lit";
|
|
15
15
|
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
-
import { devicesContext, selectedDeviceContext, } from "../contexts/
|
|
16
|
+
import { devicesContext, selectedDeviceContext, } from "../contexts/mixins/devices-context.js";
|
|
17
17
|
import SelectStyles from "../styles/select.js";
|
|
18
18
|
import { recordingDevicesChangedEvent } from "../utils/events.js";
|
|
19
19
|
let DictationDeviceSelector = class DictationDeviceSelector extends LitElement {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-selector.js","sourceRoot":"","sources":["../../src/components/device-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,cAAc,EACd,qBAAqB,GACtB,MAAM,
|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AE,CAAC;QACZ,OAAO;IACT,CAAC;IAED,IAAI,CAAC,aAAa,CAChB,4BAA4B,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,EAAE,MAAM,CAAC,CAC1D,CAAC;AACJ,CAAC;AAbM,8BAAM,GAAG,YAAY,AAAf,CAAgB;AAT7B;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrD,KAAK,EAAE;yDACqB;AAI7B;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC5D,KAAK,EAAE;gEAC0B;AAGlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yDACF;AAVf,uBAAuB;IADnC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,uBAAuB,CAqDnC","sourcesContent":["import { consume } from \"@lit/context\";\nimport { html, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport {\n devicesContext,\n selectedDeviceContext,\n} from \"../contexts/mixins/devices-context.js\";\nimport SelectStyles from \"../styles/select.js\";\nimport { recordingDevicesChangedEvent } from \"../utils/events.js\";\n\n@customElement(\"dictation-device-selector\")\nexport class DictationDeviceSelector extends LitElement {\n @consume({ context: devicesContext, subscribe: true })\n @state()\n _devices?: MediaDeviceInfo[];\n\n @consume({ context: selectedDeviceContext, subscribe: true })\n @state()\n _selectedDevice?: MediaDeviceInfo;\n\n @property({ type: Boolean })\n disabled: boolean = false;\n\n static styles = SelectStyles;\n\n #handleSelectDevice(e: Event): void {\n const deviceId = (e.target as HTMLSelectElement).value;\n const device = this._devices?.find((d) => d.deviceId === deviceId);\n\n if (!device) {\n return;\n }\n\n this.dispatchEvent(\n recordingDevicesChangedEvent(this._devices || [], device),\n );\n }\n\n render() {\n return html`\n <div>\n <label id=\"device-select-label\" for=\"device-select\">\n Recording Device\n </label>\n <select\n id=\"device-select\"\n aria-labelledby=\"device-select-label\"\n @change=${this.#handleSelectDevice}\n ?disabled=${this.disabled || !this._devices || this._devices.length === 0}\n >\n ${this._devices?.map(\n (device) => html`\n <option\n value=${device.deviceId}\n ?selected=${this._selectedDevice?.deviceId === device.deviceId}\n >\n ${device.label || \"Unknown Device\"}\n </option>\n `,\n )}\n </select>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-device-selector\": DictationDeviceSelector;\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Corti } from "@corti/sdk";
|
|
2
|
+
import { DictationController, type TranscribeMessage } from "../controllers/dictation-controller.js";
|
|
3
|
+
import { RecordingButtonBase } from "./recording-button-base.js";
|
|
4
|
+
export declare class DictationRecordingButton extends RecordingButtonBase<Corti.TranscribeConfig, TranscribeMessage> {
|
|
5
|
+
protected _dictationConfig?: Corti.TranscribeConfig;
|
|
6
|
+
protected _socketController: DictationController;
|
|
7
|
+
protected _getConnectConfig(): Corti.TranscribeConfig;
|
|
8
|
+
}
|
|
9
|
+
declare global {
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
"dictation-recording-button": DictationRecordingButton;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
import { consume } from "@lit/context";
|
|
8
|
+
import { customElement, state } from "lit/decorators.js";
|
|
9
|
+
import { DEFAULT_DICTATION_CONFIG } from "../constants.js";
|
|
10
|
+
import { dictationConfigContext } from "../contexts/dictation-context.js";
|
|
11
|
+
import { DictationController, } from "../controllers/dictation-controller.js";
|
|
12
|
+
import { RecordingButtonBase } from "./recording-button-base.js";
|
|
13
|
+
let DictationRecordingButton = class DictationRecordingButton extends RecordingButtonBase {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this._socketController = new DictationController(this);
|
|
17
|
+
}
|
|
18
|
+
_getConnectConfig() {
|
|
19
|
+
return this._dictationConfig ?? DEFAULT_DICTATION_CONFIG;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
__decorate([
|
|
23
|
+
consume({ context: dictationConfigContext, subscribe: true }),
|
|
24
|
+
state()
|
|
25
|
+
], DictationRecordingButton.prototype, "_dictationConfig", void 0);
|
|
26
|
+
DictationRecordingButton = __decorate([
|
|
27
|
+
customElement("dictation-recording-button")
|
|
28
|
+
], DictationRecordingButton);
|
|
29
|
+
export { DictationRecordingButton };
|
|
30
|
+
//# sourceMappingURL=dictation-recording-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictation-recording-button.js","sourceRoot":"","sources":["../../src/components/dictation-recording-button.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EACL,mBAAmB,GAEpB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAG1D,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,mBAG7C;IAHM;;QAQK,sBAAiB,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAK9D,CAAC;IAHW,iBAAiB;QACzB,OAAO,IAAI,CAAC,gBAAgB,IAAI,wBAAwB,CAAC;IAC3D,CAAC;CACF,CAAA;AAPW;IAFT,OAAO,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC7D,KAAK,EAAE;kEAC4C;AANzC,wBAAwB;IADpC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,wBAAwB,CAapC","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport { consume } from \"@lit/context\";\nimport { customElement, state } from \"lit/decorators.js\";\nimport { DEFAULT_DICTATION_CONFIG } from \"../constants.js\";\nimport { dictationConfigContext } from \"../contexts/dictation-context.js\";\nimport {\n DictationController,\n type TranscribeMessage,\n} from \"../controllers/dictation-controller.js\";\nimport { RecordingButtonBase } from \"./recording-button-base.js\";\n\n@customElement(\"dictation-recording-button\")\nexport class DictationRecordingButton extends RecordingButtonBase<\n Corti.TranscribeConfig,\n TranscribeMessage\n> {\n @consume({ context: dictationConfigContext, subscribe: true })\n @state()\n protected _dictationConfig?: Corti.TranscribeConfig;\n\n protected _socketController = new DictationController(this);\n\n protected _getConnectConfig(): Corti.TranscribeConfig {\n return this._dictationConfig ?? DEFAULT_DICTATION_CONFIG;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-recording-button\": DictationRecordingButton;\n }\n}\n"]}
|
|
@@ -13,7 +13,7 @@ var _DictationKeybindingInput_instances, _DictationKeybindingInput_handleKeybind
|
|
|
13
13
|
import { consume } from "@lit/context";
|
|
14
14
|
import { html, LitElement } from "lit";
|
|
15
15
|
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
-
import { pushToTalkKeybindingContext, toggleToTalkKeybindingContext, } from "../contexts/
|
|
16
|
+
import { pushToTalkKeybindingContext, toggleToTalkKeybindingContext, } from "../contexts/mixins/keybindings-context.js";
|
|
17
17
|
import KeybindingSelectorStyles from "../styles/keybinding-selector.js";
|
|
18
18
|
import { keybindingChangedEvent } from "../utils/events.js";
|
|
19
19
|
import { normalizeKeybinding } from "../utils/keybinding.js";
|
|
@@ -1 +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,
|
|
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,2CAA2C,CAAC;AACnD,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,IAAI,CAAC,cAAc,KAAK,cAAc;YACpC,CAAC,CA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,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/mixins/keybindings-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"]}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { consume } from "@lit/context";
|
|
8
8
|
import { html, LitElement } from "lit";
|
|
9
9
|
import { customElement, property, state } from "lit/decorators.js";
|
|
10
|
-
import { pushToTalkKeybindingContext, toggleToTalkKeybindingContext, } from "../contexts/
|
|
10
|
+
import { pushToTalkKeybindingContext, toggleToTalkKeybindingContext, } from "../contexts/mixins/keybindings-context.js";
|
|
11
11
|
import KeybindingSelectorStyles from "../styles/keybinding-selector.js";
|
|
12
12
|
import "./keybinding-input.js";
|
|
13
13
|
let DictationKeybindingSelector = class DictationKeybindingSelector extends LitElement {
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":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AA2B,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/mixins/keybindings-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"]}
|
|
@@ -13,7 +13,8 @@ var _DictationLanguageSelector_instances, _DictationLanguageSelector_handleSelec
|
|
|
13
13
|
import { consume } from "@lit/context";
|
|
14
14
|
import { html, LitElement } from "lit";
|
|
15
15
|
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
-
import { dictationConfigContext
|
|
16
|
+
import { dictationConfigContext } from "../contexts/dictation-context.js";
|
|
17
|
+
import { languagesContext } from "../contexts/mixins/languages-context.js";
|
|
17
18
|
import SelectStyles from "../styles/select.js";
|
|
18
19
|
import { languageChangedEvent, languagesChangedEvent, } from "../utils/events.js";
|
|
19
20
|
import { getLanguageName } from "../utils/languages.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language-selector.js","sourceRoot":"","sources":["../../src/components/language-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,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,
|
|
1
|
+
{"version":3,"file":"language-selector.js","sourceRoot":"","sources":["../../src/components/language-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,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,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGjD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,UAAU;IAAlD;;;QAUL,aAAQ,GAAY,KAAK,CAAC;IAuC5B,CAAC;IA1BC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;oBAQK,uBAAA,IAAI,6FAAsB;sBACxB,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;;YAE3E,IAAI,CAAC,UAAU,EAAE,GAAG,CACpB,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAA;;wBAEN,QAAQ;4BACJ,IAAI,CAAC,gBAAgB,EAAE,eAAe,KAAK,QAAQ;;kBAE7D,eAAe,CAAC,QAAQ,CAAC;;aAE9B,CACF;;;KAGN,CAAC;IACJ,CAAC;;;2GAlCqB,CAAQ;IAC5B,MAAM,QAAQ,GAAI,CAAC,CAAC,MAA4B,CAAC,KAAK,CAAC;IAEvD,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE3E,qCAAqC;IACrC,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;AACrD,CAAC;AATM,gCAAM,GAAG,YAAY,AAAf,CAAgB;AAT7B;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACvD,KAAK,EAAE;6DACyC;AAIjD;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC7D,KAAK,EAAE;mEACkC;AAG1C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DACF;AAVf,yBAAyB;IADrC,aAAa,CAAC,6BAA6B,CAAC;GAChC,yBAAyB,CAiDrC","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport { consume } from \"@lit/context\";\nimport { html, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { dictationConfigContext } from \"../contexts/dictation-context.js\";\nimport { languagesContext } from \"../contexts/mixins/languages-context.js\";\nimport SelectStyles from \"../styles/select.js\";\nimport {\n languageChangedEvent,\n languagesChangedEvent,\n} from \"../utils/events.js\";\nimport { getLanguageName } from \"../utils/languages.js\";\n\n@customElement(\"dictation-language-selector\")\nexport class DictationLanguageSelector extends LitElement {\n @consume({ context: languagesContext, subscribe: true })\n @state()\n _languages?: Corti.TranscribeSupportedLanguage[];\n\n @consume({ context: dictationConfigContext, subscribe: true })\n @state()\n _dictationConfig?: Corti.TranscribeConfig;\n\n @property({ type: Boolean })\n disabled: boolean = false;\n\n static styles = SelectStyles;\n\n #handleSelectLanguage(e: Event): void {\n const language = (e.target as HTMLSelectElement).value;\n\n this.dispatchEvent(languagesChangedEvent(this._languages || [], language));\n\n // Dispatch backward compatible event\n this.dispatchEvent(languageChangedEvent(language));\n }\n\n render() {\n return html`\n <div>\n <label id=\"language-select-label\" for=\"language-select\">\n Dictation Language\n </label>\n <select\n id=\"language-select\"\n aria-labelledby=\"language-select-label\"\n @change=${this.#handleSelectLanguage}\n ?disabled=${this.disabled || !this._languages || this._languages.length === 0}\n >\n ${this._languages?.map(\n (language) => html`\n <option\n value=${language}\n ?selected=${this._dictationConfig?.primaryLanguage === language}\n >\n ${getLanguageName(language)}\n </option>\n `,\n )}\n </select>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-language-selector\": DictationLanguageSelector;\n }\n}\n"]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CortiAuth } from "@corti/sdk";
|
|
2
2
|
import { type CSSResultGroup, LitElement, type PropertyValues } from "lit";
|
|
3
|
-
import type {
|
|
3
|
+
import type { TranscribeMessage } from "../controllers/dictation-controller.js";
|
|
4
|
+
import type { SocketController, SocketControllerOutboundItem, SocketControllerWebSocket } from "../controllers/socket-controller.js";
|
|
5
|
+
import type { ProxyOptions, RecordingSocketInboundMessage, RecordingState } from "../types.js";
|
|
4
6
|
import "./audio-visualiser.js";
|
|
5
7
|
import "../icons/icons.js";
|
|
6
|
-
export declare class
|
|
8
|
+
export declare abstract class RecordingButtonBase<TConfig, TMessage extends RecordingSocketInboundMessage = TranscribeMessage> extends LitElement {
|
|
7
9
|
#private;
|
|
8
10
|
_recordingState: RecordingState;
|
|
9
11
|
_selectedDevice?: MediaDeviceInfo;
|
|
@@ -11,13 +13,14 @@ export declare class DictationRecordingButton extends LitElement {
|
|
|
11
13
|
_authConfig?: CortiAuth.AuthTokenDerivable;
|
|
12
14
|
_region?: string;
|
|
13
15
|
_tenantName?: string;
|
|
14
|
-
_dictationConfig?: Corti.TranscribeConfig;
|
|
15
16
|
_socketUrl?: string;
|
|
16
17
|
_socketProxy?: ProxyOptions;
|
|
17
18
|
_debug_displayAudio?: boolean;
|
|
18
19
|
_pushToTalkKeybinding?: string | null;
|
|
19
20
|
_toggleToTalkKeybinding?: string | null;
|
|
20
21
|
allowButtonFocus: boolean;
|
|
22
|
+
protected abstract _socketController: SocketController<SocketControllerOutboundItem, TMessage, TConfig, SocketControllerWebSocket>;
|
|
23
|
+
protected abstract _getConnectConfig(): TConfig;
|
|
21
24
|
static styles: CSSResultGroup;
|
|
22
25
|
protected update(changedProperties: PropertyValues): void;
|
|
23
26
|
startRecording(): void;
|
|
@@ -27,8 +30,3 @@ export declare class DictationRecordingButton extends LitElement {
|
|
|
27
30
|
closeConnection(): Promise<void>;
|
|
28
31
|
render(): import("lit-html").TemplateResult<1>;
|
|
29
32
|
}
|
|
30
|
-
declare global {
|
|
31
|
-
interface HTMLElementTagNameMap {
|
|
32
|
-
"dictation-recording-button": DictationRecordingButton;
|
|
33
|
-
}
|
|
34
|
-
}
|