@corti/dictation-web 0.0.0-rc.359 → 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 +163 -102
- package/dist/CortiDictation.d.ts +6 -2
- package/dist/CortiDictation.js +36 -14
- package/dist/CortiDictation.js.map +1 -1
- package/dist/bundle.js +3888 -1787
- package/dist/components/audio-visualiser.d.ts +5 -3
- package/dist/components/audio-visualiser.js +38 -46
- package/dist/components/audio-visualiser.js.map +1 -1
- package/dist/components/corti-dictation.d.ts +136 -0
- package/dist/components/corti-dictation.js +273 -0
- package/dist/components/corti-dictation.js.map +1 -0
- package/dist/components/device-selector.d.ts +14 -0
- package/dist/components/device-selector.js +75 -0
- package/dist/components/device-selector.js.map +1 -0
- 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 +15 -0
- package/dist/components/language-selector.js +74 -0
- package/dist/components/language-selector.js.map +1 -0
- 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 +31 -0
- package/dist/components/recording-button.js +262 -0
- package/dist/components/recording-button.js.map +1 -0
- package/dist/components/settings-menu.d.ts +12 -14
- package/dist/components/settings-menu.js +68 -153
- package/dist/components/settings-menu.js.map +1 -1
- package/dist/constants.d.ts +8 -2
- package/dist/constants.js +38 -12
- package/dist/constants.js.map +1 -1
- package/dist/contexts/dictation-context.d.ts +107 -0
- package/dist/contexts/dictation-context.js +290 -0
- package/dist/contexts/dictation-context.js.map +1 -0
- package/dist/controllers/DictationController.d.ts +35 -0
- package/dist/controllers/DictationController.js +130 -0
- package/dist/controllers/DictationController.js.map +1 -0
- package/dist/controllers/MediaController.d.ts +31 -0
- package/dist/controllers/MediaController.js +99 -0
- package/dist/controllers/MediaController.js.map +1 -0
- 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 +11 -1
- package/dist/index.js +39 -3
- package/dist/index.js.map +1 -1
- package/dist/package.json +14 -0
- package/dist/src/components/audio-visualiser.d.ts +14 -0
- package/dist/src/components/audio-visualiser.js +57 -0
- package/dist/src/components/audio-visualiser.js.map +1 -0
- package/dist/src/components/corti-dictation.d.ts +123 -0
- package/dist/src/components/corti-dictation.js +224 -0
- package/dist/src/components/corti-dictation.js.map +1 -0
- package/dist/src/components/device-selector.d.ts +24 -0
- package/dist/src/components/device-selector.js +106 -0
- package/dist/src/components/device-selector.js.map +1 -0
- package/dist/src/components/language-selector.d.ts +24 -0
- package/dist/src/components/language-selector.js +100 -0
- package/dist/src/components/language-selector.js.map +1 -0
- package/dist/src/components/recording-button.d.ts +37 -0
- package/dist/src/components/recording-button.js +203 -0
- package/dist/src/components/recording-button.js.map +1 -0
- package/dist/src/components/settings-menu.d.ts +16 -0
- package/dist/src/components/settings-menu.js +80 -0
- package/dist/src/components/settings-menu.js.map +1 -0
- package/dist/src/constants.d.ts +4 -0
- package/dist/src/constants.js +37 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/contexts/dictation-context.d.ts +97 -0
- package/dist/src/contexts/dictation-context.js +208 -0
- package/dist/src/contexts/dictation-context.js.map +1 -0
- package/dist/src/controllers/DictationController.d.ts +35 -0
- package/dist/src/controllers/DictationController.js +130 -0
- package/dist/src/controllers/DictationController.js.map +1 -0
- package/dist/src/controllers/MediaController.d.ts +31 -0
- package/dist/src/controllers/MediaController.js +99 -0
- package/dist/src/controllers/MediaController.js.map +1 -0
- package/dist/src/icons/icons.d.ts +17 -0
- package/dist/src/icons/icons.js +158 -0
- package/dist/src/icons/icons.js.map +1 -0
- package/dist/src/styles/ComponentStyles.d.ts +2 -0
- package/dist/src/styles/ComponentStyles.js +18 -0
- package/dist/src/styles/ComponentStyles.js.map +1 -0
- package/dist/src/styles/audio-visualiser.d.ts +2 -0
- package/dist/src/styles/audio-visualiser.js +33 -0
- package/dist/src/styles/audio-visualiser.js.map +1 -0
- package/dist/src/styles/buttons.d.ts +2 -0
- package/dist/src/styles/buttons.js +52 -0
- package/dist/src/styles/buttons.js.map +1 -0
- package/dist/src/styles/callout.d.ts +2 -0
- package/dist/src/styles/callout.js +23 -0
- package/dist/src/styles/callout.js.map +1 -0
- package/dist/src/styles/default-theme.d.ts +2 -0
- package/dist/src/styles/default-theme.js +50 -0
- package/dist/src/styles/default-theme.js.map +1 -0
- package/dist/src/styles/recording-button.d.ts +2 -0
- package/dist/src/styles/recording-button.js +8 -0
- package/dist/src/styles/recording-button.js.map +1 -0
- package/dist/src/styles/select.d.ts +2 -0
- package/dist/src/styles/select.js +36 -0
- package/dist/src/styles/select.js.map +1 -0
- package/dist/src/styles/settings-menu.d.ts +2 -0
- package/dist/src/styles/settings-menu.js +34 -0
- package/dist/src/styles/settings-menu.js.map +1 -0
- package/dist/src/types.d.ts +7 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/auth.d.ts +9 -0
- package/dist/src/utils/auth.js +21 -0
- package/dist/src/utils/auth.js.map +1 -0
- package/dist/src/utils/converters.d.ts +4 -0
- package/dist/src/utils/converters.js +8 -0
- package/dist/src/utils/converters.js.map +1 -0
- package/dist/src/utils/devices.d.ts +26 -0
- package/dist/src/utils/devices.js +53 -0
- package/dist/src/utils/devices.js.map +1 -0
- package/dist/src/utils/events.d.ts +44 -0
- package/dist/src/utils/events.js +88 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/src/utils/languages.d.ts +7 -0
- package/dist/src/utils/languages.js +29 -0
- package/dist/src/utils/languages.js.map +1 -0
- package/dist/src/utils/media.d.ts +6 -0
- package/dist/src/utils/media.js +39 -0
- package/dist/src/utils/media.js.map +1 -0
- package/dist/src/utils/token.d.ts +13 -0
- package/dist/src/utils/token.js +60 -0
- package/dist/src/utils/token.js.map +1 -0
- package/dist/src/utils/validation.d.ts +1 -0
- package/dist/src/utils/validation.js +7 -0
- package/dist/src/utils/validation.js.map +1 -0
- package/dist/stories/audio-visualiser.stories.d.ts +39 -0
- package/dist/stories/audio-visualiser.stories.js +71 -0
- package/dist/stories/audio-visualiser.stories.js.map +1 -0
- package/dist/stories/corti-dictation.stories.d.ts +27 -0
- package/dist/stories/corti-dictation.stories.js +129 -0
- package/dist/stories/corti-dictation.stories.js.map +1 -0
- package/dist/stories/device-selector.stories.d.ts +18 -0
- package/dist/stories/device-selector.stories.js +84 -0
- package/dist/stories/device-selector.stories.js.map +1 -0
- package/dist/stories/language-selector.stories.d.ts +18 -0
- package/dist/stories/language-selector.stories.js +53 -0
- package/dist/stories/language-selector.stories.js.map +1 -0
- package/dist/stories/recording-button.stories.d.ts +27 -0
- package/dist/stories/recording-button.stories.js +90 -0
- package/dist/stories/recording-button.stories.js.map +1 -0
- package/dist/stories/settings-menu.stories.d.ts +23 -0
- package/dist/stories/settings-menu.stories.js +156 -0
- package/dist/stories/settings-menu.stories.js.map +1 -0
- package/dist/styles/ComponentStyles.js +6 -41
- package/dist/styles/ComponentStyles.js.map +1 -1
- package/dist/styles/audio-visualiser.d.ts +2 -0
- package/dist/styles/audio-visualiser.js +33 -0
- package/dist/styles/audio-visualiser.js.map +1 -0
- package/dist/styles/buttons.js +19 -26
- package/dist/styles/buttons.js.map +1 -1
- package/dist/styles/callout.js +7 -17
- package/dist/styles/callout.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/default-theme.d.ts +2 -0
- package/dist/styles/default-theme.js +14 -0
- package/dist/styles/default-theme.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/recording-button.d.ts +2 -0
- package/dist/styles/recording-button.js +8 -0
- package/dist/styles/recording-button.js.map +1 -0
- package/dist/styles/select.d.ts +1 -1
- package/dist/styles/select.js +14 -18
- package/dist/styles/select.js.map +1 -1
- package/dist/styles/settings-menu.d.ts +2 -0
- package/dist/styles/settings-menu.js +42 -0
- package/dist/styles/settings-menu.js.map +1 -0
- package/dist/tsconfig.stories.tsbuildinfo +1 -0
- package/dist/types.d.ts +9 -8
- package/dist/types.js.map +1 -1
- package/dist/utils/auth.d.ts +9 -0
- package/dist/utils/auth.js +21 -0
- package/dist/utils/auth.js.map +1 -0
- package/dist/utils/converters.d.ts +4 -0
- package/dist/utils/converters.js +8 -0
- package/dist/utils/converters.js.map +1 -0
- package/dist/utils/devices.d.ts +26 -0
- package/dist/utils/devices.js +53 -0
- package/dist/utils/devices.js.map +1 -0
- package/dist/utils/events.d.ts +53 -0
- package/dist/utils/events.js +102 -0
- package/dist/utils/events.js.map +1 -0
- 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 +8 -0
- package/dist/utils/languages.js +29 -0
- package/dist/utils/languages.js.map +1 -0
- package/dist/utils/media.d.ts +6 -0
- package/dist/utils/media.js +39 -0
- package/dist/utils/media.js.map +1 -0
- package/dist/utils/token.d.ts +13 -0
- package/dist/utils/token.js +60 -0
- package/dist/utils/token.js.map +1 -0
- package/dist/utils/validation.d.ts +1 -0
- package/dist/utils/validation.js +7 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +29 -55
|
@@ -0,0 +1,75 @@
|
|
|
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 _DictationDeviceSelector_instances, _DictationDeviceSelector_handleSelectDevice;
|
|
13
|
+
import { consume } from "@lit/context";
|
|
14
|
+
import { html, LitElement } from "lit";
|
|
15
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
+
import { devicesContext, selectedDeviceContext, } from "../contexts/dictation-context.js";
|
|
17
|
+
import SelectStyles from "../styles/select.js";
|
|
18
|
+
import { recordingDevicesChangedEvent } from "../utils/events.js";
|
|
19
|
+
let DictationDeviceSelector = class DictationDeviceSelector extends LitElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
_DictationDeviceSelector_instances.add(this);
|
|
23
|
+
this.disabled = false;
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
return html `
|
|
27
|
+
<div>
|
|
28
|
+
<label id="device-select-label" for="device-select">
|
|
29
|
+
Recording Device
|
|
30
|
+
</label>
|
|
31
|
+
<select
|
|
32
|
+
id="device-select"
|
|
33
|
+
aria-labelledby="device-select-label"
|
|
34
|
+
@change=${__classPrivateFieldGet(this, _DictationDeviceSelector_instances, "m", _DictationDeviceSelector_handleSelectDevice)}
|
|
35
|
+
?disabled=${this.disabled || !this._devices || this._devices.length === 0}
|
|
36
|
+
>
|
|
37
|
+
${this._devices?.map((device) => html `
|
|
38
|
+
<option
|
|
39
|
+
value=${device.deviceId}
|
|
40
|
+
?selected=${this._selectedDevice?.deviceId === device.deviceId}
|
|
41
|
+
>
|
|
42
|
+
${device.label || "Unknown Device"}
|
|
43
|
+
</option>
|
|
44
|
+
`)}
|
|
45
|
+
</select>
|
|
46
|
+
</div>
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
_DictationDeviceSelector_instances = new WeakSet();
|
|
51
|
+
_DictationDeviceSelector_handleSelectDevice = function _DictationDeviceSelector_handleSelectDevice(e) {
|
|
52
|
+
const deviceId = e.target.value;
|
|
53
|
+
const device = this._devices?.find((d) => d.deviceId === deviceId);
|
|
54
|
+
if (!device) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.dispatchEvent(recordingDevicesChangedEvent(this._devices || [], device));
|
|
58
|
+
};
|
|
59
|
+
DictationDeviceSelector.styles = SelectStyles;
|
|
60
|
+
__decorate([
|
|
61
|
+
consume({ context: devicesContext, subscribe: true }),
|
|
62
|
+
state()
|
|
63
|
+
], DictationDeviceSelector.prototype, "_devices", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
consume({ context: selectedDeviceContext, subscribe: true }),
|
|
66
|
+
state()
|
|
67
|
+
], DictationDeviceSelector.prototype, "_selectedDevice", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
property({ type: Boolean })
|
|
70
|
+
], DictationDeviceSelector.prototype, "disabled", void 0);
|
|
71
|
+
DictationDeviceSelector = __decorate([
|
|
72
|
+
customElement("dictation-device-selector")
|
|
73
|
+
], DictationDeviceSelector);
|
|
74
|
+
export { DictationDeviceSelector };
|
|
75
|
+
//# sourceMappingURL=device-selector.js.map
|
|
@@ -0,0 +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,kCAAkC,CAAC;AAC1C,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAG3D,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,UAAU;IAAhD;;;QAUL,aAAQ,GAAY,KAAK,CAAC;IA2C5B,CAAC;IA1BC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;oBAQK,uBAAA,IAAI,uFAAoB;sBACtB,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;;YAEvE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAClB,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAA;;wBAEJ,MAAM,CAAC,QAAQ;4BACX,IAAI,CAAC,eAAe,EAAE,QAAQ,KAAK,MAAM,CAAC,QAAQ;;kBAE5D,MAAM,CAAC,KAAK,IAAI,gBAAgB;;aAErC,CACF;;;KAGN,CAAC;IACJ,CAAC;;;mGAtCmB,CAAQ;IAC1B,MAAM,QAAQ,GAAI,CAAC,CAAC,MAA4B,CAAC,KAAK,CAAC;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IAEnE,IAAI,CAAC,MAAM,EAAE,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/dictation-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,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"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
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;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
static styles: import("lit").CSSResult[];
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
interface HTMLElementTagNameMap {
|
|
13
|
+
"dictation-language-selector": DictationLanguageSelector;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
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 _DictationLanguageSelector_instances, _DictationLanguageSelector_handleSelectLanguage;
|
|
13
|
+
import { consume } from "@lit/context";
|
|
14
|
+
import { html, LitElement } from "lit";
|
|
15
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
+
import { dictationConfigContext, languagesContext, } from "../contexts/dictation-context.js";
|
|
17
|
+
import SelectStyles from "../styles/select.js";
|
|
18
|
+
import { languageChangedEvent, languagesChangedEvent, } from "../utils/events.js";
|
|
19
|
+
import { getLanguageName } from "../utils/languages.js";
|
|
20
|
+
let DictationLanguageSelector = class DictationLanguageSelector extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
_DictationLanguageSelector_instances.add(this);
|
|
24
|
+
this.disabled = false;
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
return html `
|
|
28
|
+
<div>
|
|
29
|
+
<label id="language-select-label" for="language-select">
|
|
30
|
+
Dictation Language
|
|
31
|
+
</label>
|
|
32
|
+
<select
|
|
33
|
+
id="language-select"
|
|
34
|
+
aria-labelledby="language-select-label"
|
|
35
|
+
@change=${__classPrivateFieldGet(this, _DictationLanguageSelector_instances, "m", _DictationLanguageSelector_handleSelectLanguage)}
|
|
36
|
+
?disabled=${this.disabled || !this._languages || this._languages.length === 0}
|
|
37
|
+
>
|
|
38
|
+
${this._languages?.map((language) => html `
|
|
39
|
+
<option
|
|
40
|
+
value=${language}
|
|
41
|
+
?selected=${this._dictationConfig?.primaryLanguage === language}
|
|
42
|
+
>
|
|
43
|
+
${getLanguageName(language)}
|
|
44
|
+
</option>
|
|
45
|
+
`)}
|
|
46
|
+
</select>
|
|
47
|
+
</div>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
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;
|
|
59
|
+
__decorate([
|
|
60
|
+
consume({ context: languagesContext, subscribe: true }),
|
|
61
|
+
state()
|
|
62
|
+
], DictationLanguageSelector.prototype, "_languages", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
consume({ context: dictationConfigContext, subscribe: true }),
|
|
65
|
+
state()
|
|
66
|
+
], DictationLanguageSelector.prototype, "_dictationConfig", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
property({ type: Boolean })
|
|
69
|
+
], DictationLanguageSelector.prototype, "disabled", void 0);
|
|
70
|
+
DictationLanguageSelector = __decorate([
|
|
71
|
+
customElement("dictation-language-selector")
|
|
72
|
+
], DictationLanguageSelector);
|
|
73
|
+
export { DictationLanguageSelector };
|
|
74
|
+
//# sourceMappingURL=language-selector.js.map
|
|
@@ -0,0 +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,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"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Corti } from "@corti/sdk";
|
|
2
|
+
import { type CSSResultGroup, LitElement } from "lit";
|
|
3
|
+
import type { DictationMode, ProxyOptions, RecordingState } from "../types.js";
|
|
4
|
+
import "./audio-visualiser.js";
|
|
5
|
+
import "../icons/icons.js";
|
|
6
|
+
export declare class DictationRecordingButton extends LitElement {
|
|
7
|
+
#private;
|
|
8
|
+
_recordingState: RecordingState;
|
|
9
|
+
_selectedDevice?: MediaDeviceInfo;
|
|
10
|
+
_accessToken?: string;
|
|
11
|
+
_authConfig?: Corti.BearerOptions;
|
|
12
|
+
_region?: string;
|
|
13
|
+
_tenantName?: string;
|
|
14
|
+
_dictationConfig?: Corti.TranscribeConfig;
|
|
15
|
+
_socketUrl?: string;
|
|
16
|
+
_socketProxy?: ProxyOptions;
|
|
17
|
+
_debug_displayAudio?: boolean;
|
|
18
|
+
_keybinding?: string | null;
|
|
19
|
+
_mode?: DictationMode;
|
|
20
|
+
allowButtonFocus: boolean;
|
|
21
|
+
static styles: CSSResultGroup;
|
|
22
|
+
startRecording(): void;
|
|
23
|
+
stopRecording(): void;
|
|
24
|
+
toggleRecording(): void;
|
|
25
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
26
|
+
}
|
|
27
|
+
declare global {
|
|
28
|
+
interface HTMLElementTagNameMap {
|
|
29
|
+
"dictation-recording-button": DictationRecordingButton;
|
|
30
|
+
}
|
|
31
|
+
}
|