@corti/dictation-web 0.0.0-test.562 → 0.0.0-test.571
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 +164 -112
- package/dist/bundle.js +1416 -546
- package/dist/components/audio-visualiser.d.ts +3 -2
- package/dist/components/audio-visualiser.js +15 -12
- package/dist/components/audio-visualiser.js.map +1 -1
- package/dist/components/corti-dictation.d.ts +26 -13
- package/dist/components/corti-dictation.js +70 -21
- package/dist/components/corti-dictation.js.map +1 -1
- package/dist/components/device-selector.d.ts +6 -16
- package/dist/components/device-selector.js +27 -58
- package/dist/components/device-selector.js.map +1 -1
- package/dist/components/keybinding-selector.d.ts +14 -0
- package/dist/components/keybinding-selector.js +81 -0
- package/dist/components/keybinding-selector.js.map +1 -0
- package/dist/components/language-selector.d.ts +8 -17
- package/dist/components/language-selector.js +26 -52
- package/dist/components/language-selector.js.map +1 -1
- package/dist/components/mode-selector.d.ts +14 -0
- package/dist/components/mode-selector.js +73 -0
- package/dist/components/mode-selector.js.map +1 -0
- package/dist/components/recording-button.d.ts +8 -14
- package/dist/components/recording-button.js +155 -96
- package/dist/components/recording-button.js.map +1 -1
- package/dist/components/settings-menu.d.ts +4 -2
- package/dist/components/settings-menu.js +34 -14
- package/dist/components/settings-menu.js.map +1 -1
- package/dist/constants.d.ts +5 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -1
- package/dist/contexts/dictation-context.d.ts +24 -14
- package/dist/contexts/dictation-context.js +128 -46
- package/dist/contexts/dictation-context.js.map +1 -1
- package/dist/controllers/devices-controller.d.ts +26 -0
- package/dist/controllers/devices-controller.js +99 -0
- package/dist/controllers/devices-controller.js.map +1 -0
- package/dist/controllers/dictation-controller.d.ts +29 -0
- package/dist/controllers/dictation-controller.js +179 -0
- package/dist/controllers/dictation-controller.js.map +1 -0
- package/dist/controllers/keybinding-controller.d.ts +17 -0
- package/dist/controllers/keybinding-controller.js +80 -0
- package/dist/controllers/keybinding-controller.js.map +1 -0
- package/dist/controllers/languages-controller.d.ts +26 -0
- package/dist/controllers/languages-controller.js +83 -0
- package/dist/controllers/languages-controller.js.map +1 -0
- package/dist/controllers/media-controller.d.ts +24 -0
- package/dist/controllers/media-controller.js +115 -0
- package/dist/controllers/media-controller.js.map +1 -0
- package/dist/index.d.ts +9 -7
- package/dist/index.js +30 -20
- package/dist/index.js.map +1 -1
- package/dist/src/components/audio-visualiser.d.ts +1 -0
- package/dist/src/components/audio-visualiser.js +6 -3
- package/dist/src/components/audio-visualiser.js.map +1 -1
- package/dist/src/components/corti-dictation.d.ts +21 -6
- package/dist/src/components/corti-dictation.js +25 -2
- package/dist/src/components/corti-dictation.js.map +1 -1
- package/dist/src/components/recording-button.d.ts +4 -0
- package/dist/src/components/recording-button.js +34 -10
- package/dist/src/components/recording-button.js.map +1 -1
- package/dist/src/components/settings-menu.js +1 -1
- package/dist/src/components/settings-menu.js.map +1 -1
- package/dist/src/constants.js +24 -6
- package/dist/src/constants.js.map +1 -1
- package/dist/src/contexts/dictation-context.d.ts +19 -5
- package/dist/src/contexts/dictation-context.js +32 -12
- package/dist/src/contexts/dictation-context.js.map +1 -1
- package/dist/src/controllers/DictationController.d.ts +5 -0
- package/dist/src/controllers/DictationController.js +27 -8
- package/dist/src/controllers/DictationController.js.map +1 -1
- package/dist/src/controllers/MediaController.d.ts +6 -0
- package/dist/src/controllers/MediaController.js +17 -1
- package/dist/src/controllers/MediaController.js.map +1 -1
- package/dist/src/styles/ComponentStyles.js +5 -5
- package/dist/src/styles/ComponentStyles.js.map +1 -1
- package/dist/src/styles/audio-visualiser.js +1 -1
- package/dist/src/styles/audio-visualiser.js.map +1 -1
- package/dist/src/styles/buttons.js +12 -12
- package/dist/src/styles/buttons.js.map +1 -1
- package/dist/src/styles/callout.js +7 -7
- package/dist/src/styles/callout.js.map +1 -1
- package/dist/src/styles/select.js +8 -8
- package/dist/src/styles/select.js.map +1 -1
- package/dist/src/styles/settings-menu.js +4 -4
- package/dist/src/styles/settings-menu.js.map +1 -1
- package/dist/src/types.d.ts +5 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/converters.js +4 -1
- package/dist/src/utils/converters.js.map +1 -1
- package/dist/src/utils/events.d.ts +11 -4
- package/dist/src/utils/events.js.map +1 -1
- package/dist/src/utils/languages.js +2 -1
- package/dist/src/utils/languages.js.map +1 -1
- package/dist/src/utils/media.d.ts +1 -1
- package/dist/src/utils/media.js +13 -1
- package/dist/src/utils/media.js.map +1 -1
- package/dist/src/utils/token.d.ts +1 -1
- package/dist/src/utils/token.js +12 -11
- package/dist/src/utils/token.js.map +1 -1
- package/dist/styles/buttons.js +1 -2
- package/dist/styles/buttons.js.map +1 -1
- package/dist/styles/component-styles.d.ts +3 -0
- package/dist/styles/component-styles.js +32 -0
- package/dist/styles/component-styles.js.map +1 -0
- package/dist/styles/keybinding-selector.d.ts +2 -0
- package/dist/styles/keybinding-selector.js +72 -0
- package/dist/styles/keybinding-selector.js.map +1 -0
- package/dist/styles/mode-selector.d.ts +2 -0
- package/dist/styles/mode-selector.js +54 -0
- package/dist/styles/mode-selector.js.map +1 -0
- package/dist/styles/select.d.ts +1 -1
- package/dist/styles/select.js +6 -10
- package/dist/styles/select.js.map +1 -1
- package/dist/styles/settings-menu.js +9 -1
- package/dist/styles/settings-menu.js.map +1 -1
- package/dist/tsconfig.stories.tsbuildinfo +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/events.d.ts +12 -3
- package/dist/utils/events.js +14 -0
- package/dist/utils/events.js.map +1 -1
- package/dist/utils/keybinding.d.ts +49 -0
- package/dist/utils/keybinding.js +140 -0
- package/dist/utils/keybinding.js.map +1 -0
- package/dist/utils/languages.d.ts +4 -3
- package/dist/utils/languages.js.map +1 -1
- package/dist/utils/token.d.ts +1 -1
- package/dist/utils/token.js +12 -11
- package/dist/utils/token.js.map +1 -1
- package/package.json +9 -8
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export declare class DictationKeybindingSelector extends LitElement {
|
|
3
|
+
#private;
|
|
4
|
+
_keybinding?: string | null;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
_isCapturingKeybinding: boolean;
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
+
}
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
"dictation-keybinding-selector": DictationKeybindingSelector;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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 _DictationKeybindingSelector_instances, _DictationKeybindingSelector_handleKeybindingInputFocus, _DictationKeybindingSelector_handleKeybindingInputBlur, _DictationKeybindingSelector_handleKeybindingKeyDown;
|
|
13
|
+
import { consume } from "@lit/context";
|
|
14
|
+
import { html, LitElement } from "lit";
|
|
15
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
+
import { keybindingContext } from "../contexts/dictation-context.js";
|
|
17
|
+
import KeybindingSelectorStyles from "../styles/keybinding-selector.js";
|
|
18
|
+
import { keybindingChangedEvent } from "../utils/events.js";
|
|
19
|
+
let DictationKeybindingSelector = class DictationKeybindingSelector extends LitElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
_DictationKeybindingSelector_instances.add(this);
|
|
23
|
+
this.disabled = false;
|
|
24
|
+
this._isCapturingKeybinding = false;
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
return html `
|
|
28
|
+
<div>
|
|
29
|
+
<label>Keybinding</label>
|
|
30
|
+
<div class="keybinding-selector-wrapper">
|
|
31
|
+
<div class="keybinding-key">${this._keybinding}</div>
|
|
32
|
+
<input
|
|
33
|
+
type="text"
|
|
34
|
+
class="keybinding-selector-input"
|
|
35
|
+
.value=""
|
|
36
|
+
placeholder="Click and press a key..."
|
|
37
|
+
readonly
|
|
38
|
+
@focusin=${__classPrivateFieldGet(this, _DictationKeybindingSelector_instances, "m", _DictationKeybindingSelector_handleKeybindingInputFocus)}
|
|
39
|
+
@focusout=${__classPrivateFieldGet(this, _DictationKeybindingSelector_instances, "m", _DictationKeybindingSelector_handleKeybindingInputBlur)}
|
|
40
|
+
@keydown=${__classPrivateFieldGet(this, _DictationKeybindingSelector_instances, "m", _DictationKeybindingSelector_handleKeybindingKeyDown)}
|
|
41
|
+
?disabled=${this.disabled}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
<p class="keybinding-help">
|
|
45
|
+
Press ${this._keybinding} to start/stop recording
|
|
46
|
+
</p>
|
|
47
|
+
</div>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
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
|
+
DictationKeybindingSelector.styles = KeybindingSelectorStyles;
|
|
67
|
+
__decorate([
|
|
68
|
+
consume({ context: keybindingContext, subscribe: true }),
|
|
69
|
+
state()
|
|
70
|
+
], DictationKeybindingSelector.prototype, "_keybinding", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
property({ type: Boolean })
|
|
73
|
+
], DictationKeybindingSelector.prototype, "disabled", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
state()
|
|
76
|
+
], DictationKeybindingSelector.prototype, "_isCapturingKeybinding", void 0);
|
|
77
|
+
DictationKeybindingSelector = __decorate([
|
|
78
|
+
customElement("dictation-keybinding-selector")
|
|
79
|
+
], DictationKeybindingSelector);
|
|
80
|
+
export { DictationKeybindingSelector };
|
|
81
|
+
//# sourceMappingURL=keybinding-selector.js.map
|
|
@@ -0,0 +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,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,wBAAwB,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGrD,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,UAAU;IAApD;;;QAML,aAAQ,GAAY,KAAK,CAAC;QAG1B,2BAAsB,GAAY,KAAK,CAAC;IA+C1C,CAAC;IAxBC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;wCAIyB,IAAI,CAAC,WAAW;;;;;;;uBAOjC,uBAAA,IAAI,uGAA4B;wBAC/B,uBAAA,IAAI,sGAA2B;uBAChC,uBAAA,IAAI,oGAAyB;wBAC5B,IAAI,CAAC,QAAQ;;;;kBAInB,IAAI,CAAC,WAAW;;;KAG7B,CAAC;IACJ,CAAC;;;;IAzCC,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;AACrC,CAAC;;IAGC,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC;AACtC,CAAC;qHAEwB,KAAoB;IAC3C,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;QACjC,OAAO;IACT,CAAC;IAED,KAAK,CAAC,cAAc,EAAE,CAAC;IACvB,KAAK,CAAC,eAAe,EAAE,CAAC;IAExB,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACpE,CAAC;AAnBM,kCAAM,GAAG,wBAAwB,AAA3B,CAA4B;AARzC;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACxD,KAAK,EAAE;gEACoB;AAG5B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6DACF;AAG1B;IADC,KAAK,EAAE;2EACgC;AAT7B,2BAA2B;IADvC,aAAa,CAAC,+BAA+B,CAAC;GAClC,2BAA2B,CAwDvC","sourcesContent":["import { consume } from \"@lit/context\";\nimport { html, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { keybindingContext } from \"../contexts/dictation-context.js\";\nimport KeybindingSelectorStyles from \"../styles/keybinding-selector.js\";\nimport { keybindingChangedEvent } from \"../utils/events.js\";\n\n@customElement(\"dictation-keybinding-selector\")\nexport class DictationKeybindingSelector extends LitElement {\n @consume({ context: keybindingContext, subscribe: true })\n @state()\n _keybinding?: 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 this.dispatchEvent(keybindingChangedEvent(event.key, event.code));\n }\n\n render() {\n return html`\n <div>\n <label>Keybinding</label>\n <div class=\"keybinding-selector-wrapper\">\n <div class=\"keybinding-key\">${this._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 <p class=\"keybinding-help\">\n Press ${this._keybinding} to start/stop recording\n </p>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-keybinding-selector\": DictationKeybindingSelector;\n }\n}\n"]}
|
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
private
|
|
1
|
+
import type { Corti } from "@corti/sdk";
|
|
2
|
+
import { LitElement } from "lit";
|
|
3
|
+
export declare class DictationLanguageSelector extends LitElement {
|
|
4
|
+
#private;
|
|
5
|
+
_languages?: Corti.TranscribeSupportedLanguage[];
|
|
6
|
+
_dictationConfig?: Corti.TranscribeConfig;
|
|
5
7
|
disabled: boolean;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal cache of loaded languages to check if languages were auto-loaded or provided via property
|
|
9
|
-
* @private
|
|
10
|
-
*/
|
|
11
|
-
private _loadedLanguages;
|
|
12
|
-
private _languagesAutoLoaded;
|
|
13
|
-
static styles: import("lit").CSSResult;
|
|
14
|
-
connectedCallback(): Promise<void>;
|
|
15
|
-
updated(changedProperties: PropertyValues<this>): void;
|
|
16
|
-
private _loadLanguages;
|
|
17
|
-
private _handleSelectLanguage;
|
|
8
|
+
static styles: import("lit").CSSResult[];
|
|
18
9
|
render(): import("lit-html").TemplateResult<1>;
|
|
19
10
|
}
|
|
20
11
|
declare global {
|
|
21
12
|
interface HTMLElementTagNameMap {
|
|
22
|
-
"language-selector":
|
|
13
|
+
"dictation-language-selector": DictationLanguageSelector;
|
|
23
14
|
}
|
|
24
15
|
}
|
|
@@ -4,53 +4,24 @@ 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 _DictationLanguageSelector_instances, _DictationLanguageSelector_handleSelectLanguage;
|
|
7
13
|
import { consume } from "@lit/context";
|
|
8
14
|
import { html, LitElement } from "lit";
|
|
9
15
|
import { customElement, property, state } from "lit/decorators.js";
|
|
10
|
-
import { dictationConfigContext, languagesContext,
|
|
16
|
+
import { dictationConfigContext, languagesContext, } from "../contexts/dictation-context.js";
|
|
11
17
|
import SelectStyles from "../styles/select.js";
|
|
12
18
|
import { languageChangedEvent, languagesChangedEvent, } from "../utils/events.js";
|
|
13
|
-
import { getLanguageName
|
|
14
|
-
let
|
|
19
|
+
import { getLanguageName } from "../utils/languages.js";
|
|
20
|
+
let DictationLanguageSelector = class DictationLanguageSelector extends LitElement {
|
|
15
21
|
constructor() {
|
|
16
22
|
super(...arguments);
|
|
23
|
+
_DictationLanguageSelector_instances.add(this);
|
|
17
24
|
this.disabled = false;
|
|
18
|
-
/**
|
|
19
|
-
* Internal cache of loaded languages to check if languages were auto-loaded or provided via property
|
|
20
|
-
* @private
|
|
21
|
-
*/
|
|
22
|
-
this._loadedLanguages = [];
|
|
23
|
-
}
|
|
24
|
-
_languagesAutoLoaded() {
|
|
25
|
-
return this._loadedLanguages === this._languages;
|
|
26
|
-
}
|
|
27
|
-
async connectedCallback() {
|
|
28
|
-
super.connectedCallback();
|
|
29
|
-
if (this._languages) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
await this._loadLanguages();
|
|
33
|
-
}
|
|
34
|
-
updated(changedProperties) {
|
|
35
|
-
if (changedProperties.has("_region") && this._languagesAutoLoaded()) {
|
|
36
|
-
this._loadLanguages();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async _loadLanguages() {
|
|
40
|
-
const { languages, defaultLanguage } = getLanguagesByRegion(this._region);
|
|
41
|
-
this._loadedLanguages = languages;
|
|
42
|
-
const selectedLanguage = this._dictationConfig?.primaryLanguage ?? defaultLanguage;
|
|
43
|
-
this.dispatchEvent(languagesChangedEvent(languages, selectedLanguage));
|
|
44
|
-
// Dispatch backward compatible event
|
|
45
|
-
if (selectedLanguage) {
|
|
46
|
-
this.dispatchEvent(languageChangedEvent(selectedLanguage));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
_handleSelectLanguage(e) {
|
|
50
|
-
const language = e.target.value;
|
|
51
|
-
this.dispatchEvent(languagesChangedEvent(this._languages || [], language));
|
|
52
|
-
// Dispatch backward compatible event
|
|
53
|
-
this.dispatchEvent(languageChangedEvent(language));
|
|
54
25
|
}
|
|
55
26
|
render() {
|
|
56
27
|
return html `
|
|
@@ -61,7 +32,7 @@ let LanguageSelector = class LanguageSelector extends LitElement {
|
|
|
61
32
|
<select
|
|
62
33
|
id="language-select"
|
|
63
34
|
aria-labelledby="language-select-label"
|
|
64
|
-
@change=${this
|
|
35
|
+
@change=${__classPrivateFieldGet(this, _DictationLanguageSelector_instances, "m", _DictationLanguageSelector_handleSelectLanguage)}
|
|
65
36
|
?disabled=${this.disabled || !this._languages || this._languages.length === 0}
|
|
66
37
|
>
|
|
67
38
|
${this._languages?.map((language) => html `
|
|
@@ -77,24 +48,27 @@ let LanguageSelector = class LanguageSelector extends LitElement {
|
|
|
77
48
|
`;
|
|
78
49
|
}
|
|
79
50
|
};
|
|
80
|
-
|
|
51
|
+
_DictationLanguageSelector_instances = new WeakSet();
|
|
52
|
+
_DictationLanguageSelector_handleSelectLanguage = function _DictationLanguageSelector_handleSelectLanguage(e) {
|
|
53
|
+
const language = e.target.value;
|
|
54
|
+
this.dispatchEvent(languagesChangedEvent(this._languages || [], language));
|
|
55
|
+
// Dispatch backward compatible event
|
|
56
|
+
this.dispatchEvent(languageChangedEvent(language));
|
|
57
|
+
};
|
|
58
|
+
DictationLanguageSelector.styles = SelectStyles;
|
|
81
59
|
__decorate([
|
|
82
60
|
consume({ context: languagesContext, subscribe: true }),
|
|
83
61
|
state()
|
|
84
|
-
],
|
|
62
|
+
], DictationLanguageSelector.prototype, "_languages", void 0);
|
|
85
63
|
__decorate([
|
|
86
64
|
consume({ context: dictationConfigContext, subscribe: true }),
|
|
87
65
|
state()
|
|
88
|
-
],
|
|
66
|
+
], DictationLanguageSelector.prototype, "_dictationConfig", void 0);
|
|
89
67
|
__decorate([
|
|
90
68
|
property({ type: Boolean })
|
|
91
|
-
],
|
|
92
|
-
__decorate([
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
LanguageSelector = __decorate([
|
|
97
|
-
customElement("language-selector")
|
|
98
|
-
], LanguageSelector);
|
|
99
|
-
export { LanguageSelector };
|
|
69
|
+
], DictationLanguageSelector.prototype, "disabled", void 0);
|
|
70
|
+
DictationLanguageSelector = __decorate([
|
|
71
|
+
customElement("dictation-language-selector")
|
|
72
|
+
], DictationLanguageSelector);
|
|
73
|
+
export { DictationLanguageSelector };
|
|
100
74
|
//# sourceMappingURL=language-selector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language-selector.js","sourceRoot":"","sources":["../../src/components/language-selector.ts"],"names":[],"mappings":"
|
|
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,EACL,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,kCAAkC,CAAC;AAC1C,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 {\n dictationConfigContext,\n languagesContext,\n} from \"../contexts/dictation-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"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import type { DictationMode } from "../types.js";
|
|
3
|
+
export declare class DictationModeSelector extends LitElement {
|
|
4
|
+
#private;
|
|
5
|
+
_mode: DictationMode;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
+
}
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
"dictation-mode-selector": DictationModeSelector;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 _DictationModeSelector_instances, _DictationModeSelector_handleModeChange;
|
|
13
|
+
import { consume } from "@lit/context";
|
|
14
|
+
import { html, LitElement } from "lit";
|
|
15
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
17
|
+
import { modeContext } from "../contexts/dictation-context.js";
|
|
18
|
+
import ModeSelectorStyles from "../styles/mode-selector.js";
|
|
19
|
+
import { modeChangedEvent } from "../utils/events.js";
|
|
20
|
+
let DictationModeSelector = class DictationModeSelector extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
_DictationModeSelector_instances.add(this);
|
|
24
|
+
this._mode = "toggle-to-talk";
|
|
25
|
+
this.disabled = false;
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return html `
|
|
29
|
+
<div>
|
|
30
|
+
<label>Dictation Mode</label>
|
|
31
|
+
<div class="mode-selector-tabs">
|
|
32
|
+
<button
|
|
33
|
+
class=${classMap({
|
|
34
|
+
active: this._mode === "toggle-to-talk",
|
|
35
|
+
"mode-selector-tab": true,
|
|
36
|
+
})}
|
|
37
|
+
@click=${() => __classPrivateFieldGet(this, _DictationModeSelector_instances, "m", _DictationModeSelector_handleModeChange).call(this, "toggle-to-talk")}
|
|
38
|
+
?disabled=${this.disabled}
|
|
39
|
+
>
|
|
40
|
+
Toggle-to-Talk
|
|
41
|
+
</button>
|
|
42
|
+
<button
|
|
43
|
+
class=${classMap({
|
|
44
|
+
active: this._mode === "push-to-talk",
|
|
45
|
+
"mode-selector-tab": true,
|
|
46
|
+
})}
|
|
47
|
+
@click=${() => __classPrivateFieldGet(this, _DictationModeSelector_instances, "m", _DictationModeSelector_handleModeChange).call(this, "push-to-talk")}
|
|
48
|
+
?disabled=${this.disabled}
|
|
49
|
+
>
|
|
50
|
+
Push-to-Talk
|
|
51
|
+
</button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
_DictationModeSelector_instances = new WeakSet();
|
|
58
|
+
_DictationModeSelector_handleModeChange = function _DictationModeSelector_handleModeChange(mode) {
|
|
59
|
+
this.dispatchEvent(modeChangedEvent(mode));
|
|
60
|
+
};
|
|
61
|
+
DictationModeSelector.styles = ModeSelectorStyles;
|
|
62
|
+
__decorate([
|
|
63
|
+
consume({ context: modeContext, subscribe: true }),
|
|
64
|
+
state()
|
|
65
|
+
], DictationModeSelector.prototype, "_mode", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
property({ type: Boolean })
|
|
68
|
+
], DictationModeSelector.prototype, "disabled", void 0);
|
|
69
|
+
DictationModeSelector = __decorate([
|
|
70
|
+
customElement("dictation-mode-selector")
|
|
71
|
+
], DictationModeSelector);
|
|
72
|
+
export { DictationModeSelector };
|
|
73
|
+
//# sourceMappingURL=mode-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode-selector.js","sourceRoot":"","sources":["../../src/components/mode-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,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG/C,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAA9C;;;QAGL,UAAK,GAAkB,gBAAgB,CAAC;QAGxC,aAAQ,GAAY,KAAK,CAAC;IAqC5B,CAAC;IA7BC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;oBAKK,QAAQ,CAAC;YACf,MAAM,EAAE,IAAI,CAAC,KAAK,KAAK,gBAAgB;YACvC,mBAAmB,EAAE,IAAI;SAC1B,CAAC;qBACO,GAAG,EAAE,CAAC,uBAAA,IAAI,iFAAkB,MAAtB,IAAI,EAAmB,gBAAgB,CAAC;wBAC3C,IAAI,CAAC,QAAQ;;;;;oBAKjB,QAAQ,CAAC;YACf,MAAM,EAAE,IAAI,CAAC,KAAK,KAAK,cAAc;YACrC,mBAAmB,EAAE,IAAI;SAC1B,CAAC;qBACO,GAAG,EAAE,CAAC,uBAAA,IAAI,iFAAkB,MAAtB,IAAI,EAAmB,cAAc,CAAC;wBACzC,IAAI,CAAC,QAAQ;;;;;;KAMhC,CAAC;IACJ,CAAC;;;2FAhCiB,IAAmB;IACnC,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7C,CAAC;AAJM,4BAAM,GAAG,kBAAkB,AAArB,CAAsB;AALnC;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClD,KAAK,EAAE;oDACgC;AAGxC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDACF;AANf,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CA2CjC","sourcesContent":["import { consume } from \"@lit/context\";\nimport { html, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { modeContext } from \"../contexts/dictation-context.js\";\nimport ModeSelectorStyles from \"../styles/mode-selector.js\";\nimport type { DictationMode } from \"../types.js\";\nimport { modeChangedEvent } from \"../utils/events.js\";\n\n@customElement(\"dictation-mode-selector\")\nexport class DictationModeSelector extends LitElement {\n @consume({ context: modeContext, subscribe: true })\n @state()\n _mode: DictationMode = \"toggle-to-talk\";\n\n @property({ type: Boolean })\n disabled: boolean = false;\n\n static styles = ModeSelectorStyles;\n\n #handleModeChange(mode: DictationMode): void {\n this.dispatchEvent(modeChangedEvent(mode));\n }\n\n render() {\n return html`\n <div>\n <label>Dictation Mode</label>\n <div class=\"mode-selector-tabs\">\n <button\n class=${classMap({\n active: this._mode === \"toggle-to-talk\",\n \"mode-selector-tab\": true,\n })}\n @click=${() => this.#handleModeChange(\"toggle-to-talk\")}\n ?disabled=${this.disabled}\n >\n Toggle-to-Talk\n </button>\n <button\n class=${classMap({\n active: this._mode === \"push-to-talk\",\n \"mode-selector-tab\": true,\n })}\n @click=${() => this.#handleModeChange(\"push-to-talk\")}\n ?disabled=${this.disabled}\n >\n Push-to-Talk\n </button>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-mode-selector\": DictationModeSelector;\n }\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Corti } from "@corti/sdk";
|
|
2
2
|
import { type CSSResultGroup, LitElement } from "lit";
|
|
3
|
-
import type { ProxyOptions } from "../types.js";
|
|
3
|
+
import type { DictationMode, ProxyOptions, RecordingState } from "../types.js";
|
|
4
4
|
import "./audio-visualiser.js";
|
|
5
5
|
import "../icons/icons.js";
|
|
6
|
-
export declare class
|
|
7
|
-
private
|
|
6
|
+
export declare class DictationRecordingButton extends LitElement {
|
|
7
|
+
#private;
|
|
8
|
+
_recordingState: RecordingState;
|
|
8
9
|
_selectedDevice?: MediaDeviceInfo;
|
|
9
10
|
_accessToken?: string;
|
|
10
11
|
_authConfig?: Corti.BearerOptions;
|
|
@@ -14,17 +15,10 @@ export declare class RecordingButton extends LitElement {
|
|
|
14
15
|
_socketUrl?: string;
|
|
15
16
|
_socketProxy?: ProxyOptions;
|
|
16
17
|
_debug_displayAudio?: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
_keybinding?: string | null;
|
|
19
|
+
_mode?: DictationMode;
|
|
20
|
+
allowButtonFocus: boolean;
|
|
20
21
|
static styles: CSSResultGroup;
|
|
21
|
-
private _handleMouseDown;
|
|
22
|
-
private _handleWebSocketMessage;
|
|
23
|
-
private _handleWebSocketError;
|
|
24
|
-
private _handleWebSocketClose;
|
|
25
|
-
private _handleStart;
|
|
26
|
-
private _handleStop;
|
|
27
|
-
private _handleClick;
|
|
28
22
|
startRecording(): void;
|
|
29
23
|
stopRecording(): void;
|
|
30
24
|
toggleRecording(): void;
|
|
@@ -32,6 +26,6 @@ export declare class RecordingButton extends LitElement {
|
|
|
32
26
|
}
|
|
33
27
|
declare global {
|
|
34
28
|
interface HTMLElementTagNameMap {
|
|
35
|
-
"recording-button":
|
|
29
|
+
"dictation-recording-button": DictationRecordingButton;
|
|
36
30
|
}
|
|
37
31
|
}
|