@corti/dictation-web 0.0.0-test.562 → 0.0.0-test.571.1

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.
Files changed (129) hide show
  1. package/README.md +164 -112
  2. package/dist/bundle.js +1428 -546
  3. package/dist/components/audio-visualiser.d.ts +3 -2
  4. package/dist/components/audio-visualiser.js +15 -12
  5. package/dist/components/audio-visualiser.js.map +1 -1
  6. package/dist/components/corti-dictation.d.ts +26 -13
  7. package/dist/components/corti-dictation.js +70 -21
  8. package/dist/components/corti-dictation.js.map +1 -1
  9. package/dist/components/device-selector.d.ts +6 -16
  10. package/dist/components/device-selector.js +27 -58
  11. package/dist/components/device-selector.js.map +1 -1
  12. package/dist/components/keybinding-selector.d.ts +14 -0
  13. package/dist/components/keybinding-selector.js +81 -0
  14. package/dist/components/keybinding-selector.js.map +1 -0
  15. package/dist/components/language-selector.d.ts +8 -17
  16. package/dist/components/language-selector.js +26 -52
  17. package/dist/components/language-selector.js.map +1 -1
  18. package/dist/components/mode-selector.d.ts +14 -0
  19. package/dist/components/mode-selector.js +73 -0
  20. package/dist/components/mode-selector.js.map +1 -0
  21. package/dist/components/recording-button.d.ts +8 -14
  22. package/dist/components/recording-button.js +156 -96
  23. package/dist/components/recording-button.js.map +1 -1
  24. package/dist/components/settings-menu.d.ts +4 -2
  25. package/dist/components/settings-menu.js +34 -14
  26. package/dist/components/settings-menu.js.map +1 -1
  27. package/dist/constants.d.ts +5 -0
  28. package/dist/constants.js +5 -0
  29. package/dist/constants.js.map +1 -1
  30. package/dist/contexts/dictation-context.d.ts +24 -14
  31. package/dist/contexts/dictation-context.js +128 -46
  32. package/dist/contexts/dictation-context.js.map +1 -1
  33. package/dist/controllers/devices-controller.d.ts +26 -0
  34. package/dist/controllers/devices-controller.js +99 -0
  35. package/dist/controllers/devices-controller.js.map +1 -0
  36. package/dist/controllers/dictation-controller.d.ts +29 -0
  37. package/dist/controllers/dictation-controller.js +179 -0
  38. package/dist/controllers/dictation-controller.js.map +1 -0
  39. package/dist/controllers/keybinding-controller.d.ts +18 -0
  40. package/dist/controllers/keybinding-controller.js +83 -0
  41. package/dist/controllers/keybinding-controller.js.map +1 -0
  42. package/dist/controllers/languages-controller.d.ts +26 -0
  43. package/dist/controllers/languages-controller.js +83 -0
  44. package/dist/controllers/languages-controller.js.map +1 -0
  45. package/dist/controllers/media-controller.d.ts +24 -0
  46. package/dist/controllers/media-controller.js +115 -0
  47. package/dist/controllers/media-controller.js.map +1 -0
  48. package/dist/index.d.ts +9 -7
  49. package/dist/index.js +30 -20
  50. package/dist/index.js.map +1 -1
  51. package/dist/src/components/audio-visualiser.d.ts +1 -0
  52. package/dist/src/components/audio-visualiser.js +6 -3
  53. package/dist/src/components/audio-visualiser.js.map +1 -1
  54. package/dist/src/components/corti-dictation.d.ts +21 -6
  55. package/dist/src/components/corti-dictation.js +25 -2
  56. package/dist/src/components/corti-dictation.js.map +1 -1
  57. package/dist/src/components/recording-button.d.ts +4 -0
  58. package/dist/src/components/recording-button.js +34 -10
  59. package/dist/src/components/recording-button.js.map +1 -1
  60. package/dist/src/components/settings-menu.js +1 -1
  61. package/dist/src/components/settings-menu.js.map +1 -1
  62. package/dist/src/constants.js +24 -6
  63. package/dist/src/constants.js.map +1 -1
  64. package/dist/src/contexts/dictation-context.d.ts +19 -5
  65. package/dist/src/contexts/dictation-context.js +32 -12
  66. package/dist/src/contexts/dictation-context.js.map +1 -1
  67. package/dist/src/controllers/DictationController.d.ts +5 -0
  68. package/dist/src/controllers/DictationController.js +27 -8
  69. package/dist/src/controllers/DictationController.js.map +1 -1
  70. package/dist/src/controllers/MediaController.d.ts +6 -0
  71. package/dist/src/controllers/MediaController.js +17 -1
  72. package/dist/src/controllers/MediaController.js.map +1 -1
  73. package/dist/src/styles/ComponentStyles.js +5 -5
  74. package/dist/src/styles/ComponentStyles.js.map +1 -1
  75. package/dist/src/styles/audio-visualiser.js +1 -1
  76. package/dist/src/styles/audio-visualiser.js.map +1 -1
  77. package/dist/src/styles/buttons.js +12 -12
  78. package/dist/src/styles/buttons.js.map +1 -1
  79. package/dist/src/styles/callout.js +7 -7
  80. package/dist/src/styles/callout.js.map +1 -1
  81. package/dist/src/styles/select.js +8 -8
  82. package/dist/src/styles/select.js.map +1 -1
  83. package/dist/src/styles/settings-menu.js +4 -4
  84. package/dist/src/styles/settings-menu.js.map +1 -1
  85. package/dist/src/types.d.ts +5 -0
  86. package/dist/src/types.js.map +1 -1
  87. package/dist/src/utils/converters.js +4 -1
  88. package/dist/src/utils/converters.js.map +1 -1
  89. package/dist/src/utils/events.d.ts +11 -4
  90. package/dist/src/utils/events.js.map +1 -1
  91. package/dist/src/utils/languages.js +2 -1
  92. package/dist/src/utils/languages.js.map +1 -1
  93. package/dist/src/utils/media.d.ts +1 -1
  94. package/dist/src/utils/media.js +13 -1
  95. package/dist/src/utils/media.js.map +1 -1
  96. package/dist/src/utils/token.d.ts +1 -1
  97. package/dist/src/utils/token.js +12 -11
  98. package/dist/src/utils/token.js.map +1 -1
  99. package/dist/styles/buttons.js +1 -2
  100. package/dist/styles/buttons.js.map +1 -1
  101. package/dist/styles/component-styles.d.ts +3 -0
  102. package/dist/styles/component-styles.js +32 -0
  103. package/dist/styles/component-styles.js.map +1 -0
  104. package/dist/styles/keybinding-selector.d.ts +2 -0
  105. package/dist/styles/keybinding-selector.js +72 -0
  106. package/dist/styles/keybinding-selector.js.map +1 -0
  107. package/dist/styles/mode-selector.d.ts +2 -0
  108. package/dist/styles/mode-selector.js +56 -0
  109. package/dist/styles/mode-selector.js.map +1 -0
  110. package/dist/styles/select.d.ts +1 -1
  111. package/dist/styles/select.js +6 -10
  112. package/dist/styles/select.js.map +1 -1
  113. package/dist/styles/settings-menu.js +9 -1
  114. package/dist/styles/settings-menu.js.map +1 -1
  115. package/dist/tsconfig.stories.tsbuildinfo +1 -1
  116. package/dist/types.d.ts +3 -1
  117. package/dist/types.js.map +1 -1
  118. package/dist/utils/events.d.ts +16 -3
  119. package/dist/utils/events.js +22 -0
  120. package/dist/utils/events.js.map +1 -1
  121. package/dist/utils/keybinding.d.ts +36 -0
  122. package/dist/utils/keybinding.js +125 -0
  123. package/dist/utils/keybinding.js.map +1 -0
  124. package/dist/utils/languages.d.ts +4 -3
  125. package/dist/utils/languages.js.map +1 -1
  126. package/dist/utils/token.d.ts +1 -1
  127. package/dist/utils/token.js +12 -11
  128. package/dist/utils/token.js.map +1 -1
  129. package/package.json +9 -8
@@ -4,40 +4,50 @@ 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 _DictationRecordingButton_instances, _DictationRecordingButton_mediaController, _DictationRecordingButton_dictationController, _DictationRecordingButton_keybindingController, _DictationRecordingButton_handleMouseDown, _DictationRecordingButton_handleMouseUp, _DictationRecordingButton_handleMouseLeave, _DictationRecordingButton_handleWebSocketMessage, _DictationRecordingButton_handleWebSocketError, _DictationRecordingButton_handleWebSocketClose, _DictationRecordingButton_handleStart, _DictationRecordingButton_handleStop;
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 { accessTokenContext, authConfigContext, debugDisplayAudioContext, dictationConfigContext, recordingStateContext, regionContext, selectedDeviceContext, socketProxyContext, socketUrlContext, tenantNameContext, } from "../contexts/dictation-context.js";
11
- import { DictationController, } from "../controllers/DictationController.js";
12
- import { MediaController } from "../controllers/MediaController.js";
16
+ import { AUDIO_CHUNK_INTERVAL_MS } from "../constants.js";
17
+ import { accessTokenContext, authConfigContext, debugDisplayAudioContext, dictationConfigContext, keybindingContext, modeContext, recordingStateContext, regionContext, selectedDeviceContext, socketProxyContext, socketUrlContext, tenantNameContext, } from "../contexts/dictation-context.js";
18
+ import { DictationController, } from "../controllers/dictation-controller.js";
19
+ import { KeybindingController } from "../controllers/keybinding-controller.js";
20
+ import { MediaController } from "../controllers/media-controller.js";
13
21
  import ButtonStyles from "../styles/buttons.js";
14
22
  import RecordingButtonStyles from "../styles/recording-button.js";
15
23
  import { audioLevelChangedEvent, commandEvent, errorEvent, networkActivityEvent, recordingStateChangedEvent, streamClosedEvent, transcriptEvent, usageEvent, } from "../utils/events.js";
16
24
  import "./audio-visualiser.js";
17
25
  import "../icons/icons.js";
18
- let RecordingButton = class RecordingButton extends LitElement {
26
+ let DictationRecordingButton = class DictationRecordingButton extends LitElement {
19
27
  constructor() {
20
28
  super(...arguments);
29
+ _DictationRecordingButton_instances.add(this);
21
30
  this._recordingState = "stopped";
22
- this.preventFocus = false;
23
- this._mediaController = new MediaController(this);
24
- this._dictationController = new DictationController(this);
25
- this._handleWebSocketMessage = (message) => {
31
+ this.allowButtonFocus = false;
32
+ _DictationRecordingButton_mediaController.set(this, new MediaController(this));
33
+ _DictationRecordingButton_dictationController.set(this, new DictationController(this));
34
+ _DictationRecordingButton_keybindingController.set(this, new KeybindingController(this));
35
+ _DictationRecordingButton_handleWebSocketMessage.set(this, (message) => {
26
36
  switch (message.type) {
27
37
  case "CONFIG_ACCEPTED":
28
- this._mediaController.mediaRecorder?.start(250);
29
- this._mediaController.startAudioLevelMonitoring((level) => {
38
+ __classPrivateFieldGet(this, _DictationRecordingButton_mediaController, "f").mediaRecorder?.start(AUDIO_CHUNK_INTERVAL_MS);
39
+ __classPrivateFieldGet(this, _DictationRecordingButton_mediaController, "f").startAudioLevelMonitoring((level) => {
30
40
  this.dispatchEvent(audioLevelChangedEvent(level));
31
41
  });
32
42
  this.dispatchEvent(recordingStateChangedEvent("recording"));
33
43
  break;
34
44
  case "CONFIG_DENIED":
35
45
  this.dispatchEvent(errorEvent(`Config denied: ${message.reason ?? "Unknown reason"}`));
36
- this._handleStop();
46
+ __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
37
47
  break;
38
48
  case "CONFIG_TIMEOUT":
39
49
  this.dispatchEvent(errorEvent("Config timeout"));
40
- this._handleStop();
50
+ __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
41
51
  break;
42
52
  case "transcript":
43
53
  this.dispatchEvent(transcriptEvent(message));
@@ -50,81 +60,49 @@ let RecordingButton = class RecordingButton extends LitElement {
50
60
  break;
51
61
  case "error":
52
62
  this.dispatchEvent(errorEvent(message.error));
53
- this._handleStop();
63
+ __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
54
64
  break;
55
65
  }
56
- };
57
- this._handleWebSocketError = (error) => {
66
+ });
67
+ _DictationRecordingButton_handleWebSocketError.set(this, (error) => {
58
68
  this.dispatchEvent(errorEvent("Socket error: " + error.message));
59
- this._handleStop();
60
- };
61
- this._handleWebSocketClose = (event) => {
69
+ __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
70
+ });
71
+ _DictationRecordingButton_handleWebSocketClose.set(this, (event) => {
62
72
  this.dispatchEvent(streamClosedEvent(event));
63
- };
64
- }
65
- _handleMouseDown(event) {
66
- if (this.preventFocus) {
67
- event.preventDefault();
68
- }
69
- }
70
- async _handleStart() {
71
- this.dispatchEvent(recordingStateChangedEvent("initializing"));
72
- try {
73
- await this._mediaController.initialize(() => {
74
- if (this._recordingState === "recording") {
75
- this.dispatchEvent(errorEvent("Microphone access was lost."));
76
- this._handleStop();
77
- }
78
- });
79
- await this._dictationController.connect(this._mediaController.mediaRecorder, this._dictationConfig, {
80
- onClose: this._handleWebSocketClose,
81
- onError: this._handleWebSocketError,
82
- onMessage: this._handleWebSocketMessage,
83
- onNetworkActivity: (direction, data) => {
84
- this.dispatchEvent(networkActivityEvent(direction, data));
85
- },
86
- });
87
- }
88
- catch (error) {
89
- this.dispatchEvent(errorEvent(error));
90
- await this._handleStop();
91
- }
92
- }
93
- async _handleStop() {
94
- this.dispatchEvent(recordingStateChangedEvent("stopping"));
95
- try {
96
- this._mediaController.stopAudioLevelMonitoring();
97
- await this._mediaController.stopRecording();
98
- await this._dictationController.disconnect(this._handleWebSocketClose);
99
- await this._mediaController.cleanup();
100
- }
101
- catch (error) {
102
- this.dispatchEvent(errorEvent(error));
103
- }
104
- this.dispatchEvent(recordingStateChangedEvent("stopped"));
105
- }
106
- _handleClick() {
107
- if (this._recordingState === "stopped") {
108
- this._handleStart();
109
- }
110
- else if (this._recordingState === "recording") {
111
- this._handleStop();
112
- }
73
+ });
113
74
  }
114
75
  startRecording() {
115
76
  if (this._recordingState !== "stopped") {
116
77
  return;
117
78
  }
118
- this._handleStart();
79
+ __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStart).call(this);
119
80
  }
120
81
  stopRecording() {
121
- if (this._recordingState !== "recording") {
82
+ if (this._recordingState === "stopped" ||
83
+ this._recordingState === "stopping") {
122
84
  return;
123
85
  }
124
- this._handleStop();
86
+ if (this._recordingState === "initializing") {
87
+ this.addEventListener("recording-state-changed", (event) => {
88
+ if (event.detail
89
+ .state === "recording") {
90
+ __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
91
+ }
92
+ }, {
93
+ once: true,
94
+ });
95
+ return;
96
+ }
97
+ __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
125
98
  }
126
99
  toggleRecording() {
127
- this._handleClick();
100
+ if (this._recordingState === "stopped") {
101
+ __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStart).call(this);
102
+ }
103
+ else if (this._recordingState === "recording") {
104
+ __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
105
+ }
128
106
  }
129
107
  render() {
130
108
  const isLoading = this._recordingState === "initializing" ||
@@ -132,72 +110,154 @@ let RecordingButton = class RecordingButton extends LitElement {
132
110
  const isRecording = this._recordingState === "recording";
133
111
  return html `
134
112
  <button
135
- @mousedown=${this._handleMouseDown}
136
- @click=${this._handleClick}
113
+ @mousedown=${__classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleMouseDown)}
114
+ @mouseup=${__classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleMouseUp)}
115
+ @mouseleave=${__classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleMouseLeave)}
137
116
  ?disabled=${isLoading}
138
117
  class=${isRecording ? "red" : "accent"}
139
118
  aria-label=${isRecording ? "Stop recording" : "Start recording"}
140
119
  aria-pressed=${isRecording}
141
120
  >
142
121
  ${isLoading
143
- ? html `<icon-loading-spinner></icon-loading-spinner>`
122
+ ? html `<icon-loading-spinner />`
144
123
  : isRecording
145
- ? html `<icon-recording></icon-recording>`
146
- : html `<icon-mic-on></icon-mic-on>`}
147
- <audio-visualiser
148
- .level=${this._mediaController.audioLevel}
124
+ ? html `<icon-recording />`
125
+ : html `<icon-mic-on />`}
126
+ <dictation-audio-visualiser
127
+ .level=${__classPrivateFieldGet(this, _DictationRecordingButton_mediaController, "f").audioLevel}
149
128
  ?active=${isRecording}
150
- ></audio-visualiser>
129
+ />
151
130
  </button>
152
131
  `;
153
132
  }
154
133
  };
155
- RecordingButton.styles = [RecordingButtonStyles, ButtonStyles];
134
+ _DictationRecordingButton_mediaController = new WeakMap();
135
+ _DictationRecordingButton_dictationController = new WeakMap();
136
+ _DictationRecordingButton_keybindingController = new WeakMap();
137
+ _DictationRecordingButton_handleWebSocketMessage = new WeakMap();
138
+ _DictationRecordingButton_handleWebSocketError = new WeakMap();
139
+ _DictationRecordingButton_handleWebSocketClose = new WeakMap();
140
+ _DictationRecordingButton_instances = new WeakSet();
141
+ _DictationRecordingButton_handleMouseDown = function _DictationRecordingButton_handleMouseDown(event) {
142
+ if (!this.allowButtonFocus) {
143
+ event.preventDefault();
144
+ }
145
+ if (this._mode === "push-to-talk") {
146
+ this.startRecording();
147
+ }
148
+ };
149
+ _DictationRecordingButton_handleMouseUp = function _DictationRecordingButton_handleMouseUp() {
150
+ if (this._mode === "push-to-talk") {
151
+ this.stopRecording();
152
+ return;
153
+ }
154
+ if (this._mode === "toggle-to-talk") {
155
+ this.toggleRecording();
156
+ }
157
+ };
158
+ _DictationRecordingButton_handleMouseLeave = function _DictationRecordingButton_handleMouseLeave() {
159
+ if (this._mode === "push-to-talk") {
160
+ this.stopRecording();
161
+ }
162
+ };
163
+ _DictationRecordingButton_handleStart = async function _DictationRecordingButton_handleStart() {
164
+ this.dispatchEvent(recordingStateChangedEvent("initializing"));
165
+ try {
166
+ await __classPrivateFieldGet(this, _DictationRecordingButton_mediaController, "f").initialize(() => {
167
+ if (this._recordingState === "recording") {
168
+ this.dispatchEvent(errorEvent("Recording device access was lost."));
169
+ __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
170
+ }
171
+ });
172
+ const isNewConnection = await __classPrivateFieldGet(this, _DictationRecordingButton_dictationController, "f").connect(__classPrivateFieldGet(this, _DictationRecordingButton_mediaController, "f").mediaRecorder, this._dictationConfig, {
173
+ onClose: __classPrivateFieldGet(this, _DictationRecordingButton_handleWebSocketClose, "f"),
174
+ onError: __classPrivateFieldGet(this, _DictationRecordingButton_handleWebSocketError, "f"),
175
+ onMessage: __classPrivateFieldGet(this, _DictationRecordingButton_handleWebSocketMessage, "f"),
176
+ onNetworkActivity: (direction, data) => {
177
+ this.dispatchEvent(networkActivityEvent(direction, data));
178
+ },
179
+ });
180
+ // configuration has been accepted before
181
+ if (!isNewConnection) {
182
+ __classPrivateFieldGet(this, _DictationRecordingButton_mediaController, "f").mediaRecorder?.start(AUDIO_CHUNK_INTERVAL_MS);
183
+ __classPrivateFieldGet(this, _DictationRecordingButton_mediaController, "f").startAudioLevelMonitoring((level) => {
184
+ this.dispatchEvent(audioLevelChangedEvent(level));
185
+ });
186
+ this.dispatchEvent(recordingStateChangedEvent("recording"));
187
+ }
188
+ }
189
+ catch (error) {
190
+ this.dispatchEvent(errorEvent(error));
191
+ await __classPrivateFieldGet(this, _DictationRecordingButton_instances, "m", _DictationRecordingButton_handleStop).call(this);
192
+ }
193
+ };
194
+ _DictationRecordingButton_handleStop = async function _DictationRecordingButton_handleStop() {
195
+ this.dispatchEvent(recordingStateChangedEvent("stopping"));
196
+ try {
197
+ __classPrivateFieldGet(this, _DictationRecordingButton_mediaController, "f").stopAudioLevelMonitoring();
198
+ await __classPrivateFieldGet(this, _DictationRecordingButton_mediaController, "f").stopRecording();
199
+ await __classPrivateFieldGet(this, _DictationRecordingButton_dictationController, "f").disconnect(__classPrivateFieldGet(this, _DictationRecordingButton_handleWebSocketClose, "f"));
200
+ await __classPrivateFieldGet(this, _DictationRecordingButton_mediaController, "f").cleanup();
201
+ }
202
+ catch (error) {
203
+ this.dispatchEvent(errorEvent(error));
204
+ }
205
+ this.dispatchEvent(recordingStateChangedEvent("stopped"));
206
+ };
207
+ DictationRecordingButton.styles = [RecordingButtonStyles, ButtonStyles];
156
208
  __decorate([
157
209
  consume({ context: recordingStateContext, subscribe: true }),
158
210
  state()
159
- ], RecordingButton.prototype, "_recordingState", void 0);
211
+ ], DictationRecordingButton.prototype, "_recordingState", void 0);
160
212
  __decorate([
161
213
  consume({ context: selectedDeviceContext, subscribe: true }),
162
214
  state()
163
- ], RecordingButton.prototype, "_selectedDevice", void 0);
215
+ ], DictationRecordingButton.prototype, "_selectedDevice", void 0);
164
216
  __decorate([
165
217
  consume({ context: accessTokenContext, subscribe: true }),
166
218
  state()
167
- ], RecordingButton.prototype, "_accessToken", void 0);
219
+ ], DictationRecordingButton.prototype, "_accessToken", void 0);
168
220
  __decorate([
169
221
  consume({ context: authConfigContext, subscribe: true }),
170
222
  state()
171
- ], RecordingButton.prototype, "_authConfig", void 0);
223
+ ], DictationRecordingButton.prototype, "_authConfig", void 0);
172
224
  __decorate([
173
225
  consume({ context: regionContext, subscribe: true }),
174
226
  state()
175
- ], RecordingButton.prototype, "_region", void 0);
227
+ ], DictationRecordingButton.prototype, "_region", void 0);
176
228
  __decorate([
177
229
  consume({ context: tenantNameContext, subscribe: true }),
178
230
  state()
179
- ], RecordingButton.prototype, "_tenantName", void 0);
231
+ ], DictationRecordingButton.prototype, "_tenantName", void 0);
180
232
  __decorate([
181
233
  consume({ context: dictationConfigContext, subscribe: true }),
182
234
  state()
183
- ], RecordingButton.prototype, "_dictationConfig", void 0);
235
+ ], DictationRecordingButton.prototype, "_dictationConfig", void 0);
184
236
  __decorate([
185
237
  consume({ context: socketUrlContext, subscribe: true }),
186
238
  state()
187
- ], RecordingButton.prototype, "_socketUrl", void 0);
239
+ ], DictationRecordingButton.prototype, "_socketUrl", void 0);
188
240
  __decorate([
189
241
  consume({ context: socketProxyContext, subscribe: true }),
190
242
  state()
191
- ], RecordingButton.prototype, "_socketProxy", void 0);
243
+ ], DictationRecordingButton.prototype, "_socketProxy", void 0);
192
244
  __decorate([
193
245
  consume({ context: debugDisplayAudioContext, subscribe: true }),
194
246
  state()
195
- ], RecordingButton.prototype, "_debug_displayAudio", void 0);
247
+ ], DictationRecordingButton.prototype, "_debug_displayAudio", void 0);
248
+ __decorate([
249
+ consume({ context: keybindingContext, subscribe: true }),
250
+ state()
251
+ ], DictationRecordingButton.prototype, "_keybinding", void 0);
252
+ __decorate([
253
+ consume({ context: modeContext, subscribe: true }),
254
+ state()
255
+ ], DictationRecordingButton.prototype, "_mode", void 0);
196
256
  __decorate([
197
257
  property({ type: Boolean })
198
- ], RecordingButton.prototype, "preventFocus", void 0);
199
- RecordingButton = __decorate([
200
- customElement("recording-button")
201
- ], RecordingButton);
202
- export { RecordingButton };
258
+ ], DictationRecordingButton.prototype, "allowButtonFocus", void 0);
259
+ DictationRecordingButton = __decorate([
260
+ customElement("dictation-recording-button")
261
+ ], DictationRecordingButton);
262
+ export { DictationRecordingButton };
203
263
  //# sourceMappingURL=recording-button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recording-button.js","sourceRoot":"","sources":["../../src/components/recording-button.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAuB,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,mBAAmB,GAEpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAElE,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,iBAAiB,EACjB,eAAe,EACf,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,mBAAmB,CAAC;AAGpB,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAGG,oBAAe,GAAmB,SAAS,CAAC;QAuCpD,iBAAY,GAAY,KAAK,CAAC;QAEtB,qBAAgB,GAAG,IAAI,eAAe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AAE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACxD,KAAK,EAAE;oDAC0B;AAIlC;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACpD,KAAK,EAAE;gDACS;AAIjB;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACxD,KAAK,EAAE;oDACa;AAIrB;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC7D,KAAK,EAAE;yDACkC;AAI1C;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACvD,KAAK,EAAE;mDACY;AAIpB;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACzD,KAAK,EAAE;qDACoB;AAI5B;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC/D,KAAK,EAAE;4DACsB;AAG9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDACE;AA1CnB,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CAyM3B","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport { consume } from \"@lit/context\";\nimport { type CSSResultGroup, html, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport {\n accessTokenContext,\n authConfigContext,\n debugDisplayAudioContext,\n dictationConfigContext,\n recordingStateContext,\n regionContext,\n selectedDeviceContext,\n socketProxyContext,\n socketUrlContext,\n tenantNameContext,\n} from \"../contexts/dictation-context.js\";\nimport {\n DictationController,\n type TranscribeMessage,\n} from \"../controllers/DictationController.js\";\nimport { MediaController } from \"../controllers/MediaController.js\";\nimport ButtonStyles from \"../styles/buttons.js\";\nimport RecordingButtonStyles from \"../styles/recording-button.js\";\nimport type { ProxyOptions, RecordingState } from \"../types.js\";\nimport {\n audioLevelChangedEvent,\n commandEvent,\n errorEvent,\n networkActivityEvent,\n recordingStateChangedEvent,\n streamClosedEvent,\n transcriptEvent,\n usageEvent,\n} from \"../utils/events.js\";\n\nimport \"./audio-visualiser.js\";\nimport \"../icons/icons.js\";\n\n@customElement(\"recording-button\")\nexport class RecordingButton extends LitElement {\n @consume({ context: recordingStateContext, subscribe: true })\n @state()\n private _recordingState: RecordingState = \"stopped\";\n\n @consume({ context: selectedDeviceContext, subscribe: true })\n @state()\n _selectedDevice?: MediaDeviceInfo;\n\n @consume({ context: accessTokenContext, subscribe: true })\n @state()\n _accessToken?: string;\n\n @consume({ context: authConfigContext, subscribe: true })\n @state()\n _authConfig?: Corti.BearerOptions;\n\n @consume({ context: regionContext, subscribe: true })\n @state()\n _region?: string;\n\n @consume({ context: tenantNameContext, subscribe: true })\n @state()\n _tenantName?: string;\n\n @consume({ context: dictationConfigContext, subscribe: true })\n @state()\n _dictationConfig?: Corti.TranscribeConfig;\n\n @consume({ context: socketUrlContext, subscribe: true })\n @state()\n _socketUrl?: string;\n\n @consume({ context: socketProxyContext, subscribe: true })\n @state()\n _socketProxy?: ProxyOptions;\n\n @consume({ context: debugDisplayAudioContext, subscribe: true })\n @state()\n _debug_displayAudio?: boolean;\n\n @property({ type: Boolean })\n preventFocus: boolean = false;\n\n private _mediaController = new MediaController(this);\n private _dictationController = new DictationController(this);\n\n static styles: CSSResultGroup = [RecordingButtonStyles, ButtonStyles];\n\n private _handleMouseDown(event: MouseEvent): void {\n if (this.preventFocus) {\n event.preventDefault();\n }\n }\n\n private _handleWebSocketMessage = (message: TranscribeMessage): void => {\n switch (message.type) {\n case \"CONFIG_ACCEPTED\":\n this._mediaController.mediaRecorder?.start(250);\n this._mediaController.startAudioLevelMonitoring((level) => {\n this.dispatchEvent(audioLevelChangedEvent(level));\n });\n this.dispatchEvent(recordingStateChangedEvent(\"recording\"));\n break;\n case \"CONFIG_DENIED\":\n this.dispatchEvent(\n errorEvent(`Config denied: ${message.reason ?? \"Unknown reason\"}`),\n );\n this._handleStop();\n break;\n case \"CONFIG_TIMEOUT\":\n this.dispatchEvent(errorEvent(\"Config timeout\"));\n this._handleStop();\n break;\n case \"transcript\":\n this.dispatchEvent(transcriptEvent(message));\n break;\n case \"command\":\n this.dispatchEvent(commandEvent(message));\n break;\n case \"usage\":\n this.dispatchEvent(usageEvent(message));\n break;\n case \"error\":\n this.dispatchEvent(errorEvent(message.error));\n this._handleStop();\n break;\n }\n };\n\n private _handleWebSocketError = (error: Error): void => {\n this.dispatchEvent(errorEvent(\"Socket error: \" + error.message));\n this._handleStop();\n };\n\n private _handleWebSocketClose = (event: unknown): void => {\n this.dispatchEvent(streamClosedEvent(event));\n };\n\n private async _handleStart(): Promise<void> {\n this.dispatchEvent(recordingStateChangedEvent(\"initializing\"));\n\n try {\n await this._mediaController.initialize(() => {\n if (this._recordingState === \"recording\") {\n this.dispatchEvent(errorEvent(\"Microphone access was lost.\"));\n this._handleStop();\n }\n });\n\n await this._dictationController.connect(\n this._mediaController.mediaRecorder,\n this._dictationConfig,\n {\n onClose: this._handleWebSocketClose,\n onError: this._handleWebSocketError,\n onMessage: this._handleWebSocketMessage,\n onNetworkActivity: (direction, data) => {\n this.dispatchEvent(networkActivityEvent(direction, data));\n },\n },\n );\n } catch (error) {\n this.dispatchEvent(errorEvent(error));\n await this._handleStop();\n }\n }\n\n private async _handleStop(): Promise<void> {\n this.dispatchEvent(recordingStateChangedEvent(\"stopping\"));\n\n try {\n this._mediaController.stopAudioLevelMonitoring();\n await this._mediaController.stopRecording();\n\n await this._dictationController.disconnect(this._handleWebSocketClose);\n await this._mediaController.cleanup();\n } catch (error) {\n this.dispatchEvent(errorEvent(error));\n }\n\n this.dispatchEvent(recordingStateChangedEvent(\"stopped\"));\n }\n\n private _handleClick(): void {\n if (this._recordingState === \"stopped\") {\n this._handleStart();\n } else if (this._recordingState === \"recording\") {\n this._handleStop();\n }\n }\n\n public startRecording(): void {\n if (this._recordingState !== \"stopped\") {\n return;\n }\n\n this._handleStart();\n }\n\n public stopRecording(): void {\n if (this._recordingState !== \"recording\") {\n return;\n }\n\n this._handleStop();\n }\n\n public toggleRecording(): void {\n this._handleClick();\n }\n\n render() {\n const isLoading =\n this._recordingState === \"initializing\" ||\n this._recordingState === \"stopping\";\n const isRecording = this._recordingState === \"recording\";\n\n return html`\n <button\n @mousedown=${this._handleMouseDown}\n @click=${this._handleClick}\n ?disabled=${isLoading}\n class=${isRecording ? \"red\" : \"accent\"}\n aria-label=${isRecording ? \"Stop recording\" : \"Start recording\"}\n aria-pressed=${isRecording}\n >\n ${\n isLoading\n ? html`<icon-loading-spinner></icon-loading-spinner>`\n : isRecording\n ? html`<icon-recording></icon-recording>`\n : html`<icon-mic-on></icon-mic-on>`\n }\n <audio-visualiser\n .level=${this._mediaController.audioLevel}\n ?active=${isRecording}\n ></audio-visualiser>\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"recording-button\": RecordingButton;\n }\n}\n"]}
1
+ {"version":3,"file":"recording-button.js","sourceRoot":"","sources":["../../src/components/recording-button.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAuB,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,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O,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACvD,KAAK,EAAE;4DACY;AAIpB;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACzD,KAAK,EAAE;8DACoB;AAI5B;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC/D,KAAK,EAAE;qEACsB;AAI9B;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACxD,KAAK,EAAE;6DACoB;AAI5B;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClD,KAAK,EAAE;uDACc;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kEACM;AAlDvB,wBAAwB;IADpC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,wBAAwB,CAkQpC","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport { consume } from \"@lit/context\";\nimport { type CSSResultGroup, html, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { AUDIO_CHUNK_INTERVAL_MS } from \"../constants.js\";\nimport {\n accessTokenContext,\n authConfigContext,\n debugDisplayAudioContext,\n dictationConfigContext,\n keybindingContext,\n modeContext,\n recordingStateContext,\n regionContext,\n selectedDeviceContext,\n socketProxyContext,\n socketUrlContext,\n tenantNameContext,\n} from \"../contexts/dictation-context.js\";\nimport {\n DictationController,\n type TranscribeMessage,\n} from \"../controllers/dictation-controller.js\";\nimport { KeybindingController } from \"../controllers/keybinding-controller.js\";\nimport { MediaController } from \"../controllers/media-controller.js\";\nimport ButtonStyles from \"../styles/buttons.js\";\nimport RecordingButtonStyles from \"../styles/recording-button.js\";\nimport type { DictationMode, ProxyOptions, RecordingState } from \"../types.js\";\nimport {\n audioLevelChangedEvent,\n commandEvent,\n errorEvent,\n networkActivityEvent,\n type RecordingStateChangedEventDetail,\n recordingStateChangedEvent,\n streamClosedEvent,\n transcriptEvent,\n usageEvent,\n} from \"../utils/events.js\";\n\nimport \"./audio-visualiser.js\";\nimport \"../icons/icons.js\";\n\n@customElement(\"dictation-recording-button\")\nexport class DictationRecordingButton extends LitElement {\n @consume({ context: recordingStateContext, subscribe: true })\n @state()\n _recordingState: RecordingState = \"stopped\";\n\n @consume({ context: selectedDeviceContext, subscribe: true })\n @state()\n _selectedDevice?: MediaDeviceInfo;\n\n @consume({ context: accessTokenContext, subscribe: true })\n @state()\n _accessToken?: string;\n\n @consume({ context: authConfigContext, subscribe: true })\n @state()\n _authConfig?: Corti.BearerOptions;\n\n @consume({ context: regionContext, subscribe: true })\n @state()\n _region?: string;\n\n @consume({ context: tenantNameContext, subscribe: true })\n @state()\n _tenantName?: string;\n\n @consume({ context: dictationConfigContext, subscribe: true })\n @state()\n _dictationConfig?: Corti.TranscribeConfig;\n\n @consume({ context: socketUrlContext, subscribe: true })\n @state()\n _socketUrl?: string;\n\n @consume({ context: socketProxyContext, subscribe: true })\n @state()\n _socketProxy?: ProxyOptions;\n\n @consume({ context: debugDisplayAudioContext, subscribe: true })\n @state()\n _debug_displayAudio?: boolean;\n\n @consume({ context: keybindingContext, subscribe: true })\n @state()\n _keybinding?: string | null;\n\n @consume({ context: modeContext, subscribe: true })\n @state()\n _mode?: DictationMode;\n\n @property({ type: Boolean })\n allowButtonFocus: boolean = false;\n\n #mediaController = new MediaController(this);\n #dictationController = new DictationController(this);\n #keybindingController = new KeybindingController(this);\n\n static styles: CSSResultGroup = [RecordingButtonStyles, ButtonStyles];\n\n #handleMouseDown(event: MouseEvent): void {\n if (!this.allowButtonFocus) {\n event.preventDefault();\n }\n\n if (this._mode === \"push-to-talk\") {\n this.startRecording();\n }\n }\n\n #handleMouseUp(): void {\n if (this._mode === \"push-to-talk\") {\n this.stopRecording();\n return;\n }\n\n if (this._mode === \"toggle-to-talk\") {\n this.toggleRecording();\n }\n }\n\n #handleMouseLeave(): void {\n if (this._mode === \"push-to-talk\") {\n this.stopRecording();\n }\n }\n\n #handleWebSocketMessage = (message: TranscribeMessage): void => {\n switch (message.type) {\n case \"CONFIG_ACCEPTED\":\n this.#mediaController.mediaRecorder?.start(AUDIO_CHUNK_INTERVAL_MS);\n this.#mediaController.startAudioLevelMonitoring((level) => {\n this.dispatchEvent(audioLevelChangedEvent(level));\n });\n this.dispatchEvent(recordingStateChangedEvent(\"recording\"));\n break;\n case \"CONFIG_DENIED\":\n this.dispatchEvent(\n errorEvent(`Config denied: ${message.reason ?? \"Unknown reason\"}`),\n );\n this.#handleStop();\n break;\n case \"CONFIG_TIMEOUT\":\n this.dispatchEvent(errorEvent(\"Config timeout\"));\n this.#handleStop();\n break;\n case \"transcript\":\n this.dispatchEvent(transcriptEvent(message));\n break;\n case \"command\":\n this.dispatchEvent(commandEvent(message));\n break;\n case \"usage\":\n this.dispatchEvent(usageEvent(message));\n break;\n case \"error\":\n this.dispatchEvent(errorEvent(message.error));\n this.#handleStop();\n break;\n }\n };\n\n #handleWebSocketError = (error: Error): void => {\n this.dispatchEvent(errorEvent(\"Socket error: \" + error.message));\n this.#handleStop();\n };\n\n #handleWebSocketClose = (event: unknown): void => {\n this.dispatchEvent(streamClosedEvent(event));\n };\n\n async #handleStart(): Promise<void> {\n this.dispatchEvent(recordingStateChangedEvent(\"initializing\"));\n\n try {\n await this.#mediaController.initialize(() => {\n if (this._recordingState === \"recording\") {\n this.dispatchEvent(errorEvent(\"Recording device access was lost.\"));\n this.#handleStop();\n }\n });\n\n const isNewConnection = await this.#dictationController.connect(\n this.#mediaController.mediaRecorder,\n this._dictationConfig,\n {\n onClose: this.#handleWebSocketClose,\n onError: this.#handleWebSocketError,\n onMessage: this.#handleWebSocketMessage,\n onNetworkActivity: (direction, data) => {\n this.dispatchEvent(networkActivityEvent(direction, data));\n },\n },\n );\n\n // configuration has been accepted before\n if (!isNewConnection) {\n this.#mediaController.mediaRecorder?.start(AUDIO_CHUNK_INTERVAL_MS);\n this.#mediaController.startAudioLevelMonitoring((level) => {\n this.dispatchEvent(audioLevelChangedEvent(level));\n });\n this.dispatchEvent(recordingStateChangedEvent(\"recording\"));\n }\n } catch (error) {\n this.dispatchEvent(errorEvent(error));\n await this.#handleStop();\n }\n }\n\n async #handleStop(): Promise<void> {\n this.dispatchEvent(recordingStateChangedEvent(\"stopping\"));\n\n try {\n this.#mediaController.stopAudioLevelMonitoring();\n await this.#mediaController.stopRecording();\n\n await this.#dictationController.disconnect(this.#handleWebSocketClose);\n await this.#mediaController.cleanup();\n } catch (error) {\n this.dispatchEvent(errorEvent(error));\n }\n\n this.dispatchEvent(recordingStateChangedEvent(\"stopped\"));\n }\n\n public startRecording(): void {\n if (this._recordingState !== \"stopped\") {\n return;\n }\n\n this.#handleStart();\n }\n\n public stopRecording(): void {\n if (\n this._recordingState === \"stopped\" ||\n this._recordingState === \"stopping\"\n ) {\n return;\n }\n\n if (this._recordingState === \"initializing\") {\n this.addEventListener(\n \"recording-state-changed\",\n (event) => {\n if (\n (event as CustomEvent<RecordingStateChangedEventDetail>).detail\n .state === \"recording\"\n ) {\n this.#handleStop();\n }\n },\n {\n once: true,\n },\n );\n return;\n }\n\n this.#handleStop();\n }\n\n public toggleRecording(): void {\n if (this._recordingState === \"stopped\") {\n this.#handleStart();\n } else if (this._recordingState === \"recording\") {\n this.#handleStop();\n }\n }\n\n render() {\n const isLoading =\n this._recordingState === \"initializing\" ||\n this._recordingState === \"stopping\";\n const isRecording = this._recordingState === \"recording\";\n\n return html`\n <button\n @mousedown=${this.#handleMouseDown}\n @mouseup=${this.#handleMouseUp}\n @mouseleave=${this.#handleMouseLeave}\n ?disabled=${isLoading}\n class=${isRecording ? \"red\" : \"accent\"}\n aria-label=${isRecording ? \"Stop recording\" : \"Start recording\"}\n aria-pressed=${isRecording}\n >\n ${\n isLoading\n ? html`<icon-loading-spinner />`\n : isRecording\n ? html`<icon-recording />`\n : html`<icon-mic-on />`\n }\n <dictation-audio-visualiser\n .level=${this.#mediaController.audioLevel}\n ?active=${isRecording}\n />\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-recording-button\": DictationRecordingButton;\n }\n}\n"]}
@@ -1,9 +1,11 @@
1
1
  import { type CSSResultGroup, LitElement, nothing } from "lit";
2
2
  import type { ConfigurableSettings, RecordingState } from "../types.js";
3
3
  import "./device-selector.js";
4
+ import "./keybinding-selector.js";
4
5
  import "./language-selector.js";
6
+ import "./mode-selector.js";
5
7
  import "../icons/icons.js";
6
- export declare class SettingsMenu extends LitElement {
8
+ export declare class DictationSettingsMenu extends LitElement {
7
9
  _recordingState: RecordingState;
8
10
  settingsEnabled: ConfigurableSettings[];
9
11
  static styles: CSSResultGroup;
@@ -11,6 +13,6 @@ export declare class SettingsMenu extends LitElement {
11
13
  }
12
14
  declare global {
13
15
  interface HTMLElementTagNameMap {
14
- "settings-menu": SettingsMenu;
16
+ "dictation-settings-menu": DictationSettingsMenu;
15
17
  }
16
18
  }
@@ -13,25 +13,29 @@ import CalloutStyles from "../styles/callout.js";
13
13
  import SettingsMenuStyles from "../styles/settings-menu.js";
14
14
  import { commaSeparatedConverter } from "../utils/converters.js";
15
15
  import "./device-selector.js";
16
+ import "./keybinding-selector.js";
16
17
  import "./language-selector.js";
18
+ import "./mode-selector.js";
17
19
  import "../icons/icons.js";
18
- let SettingsMenu = class SettingsMenu extends LitElement {
20
+ let DictationSettingsMenu = class DictationSettingsMenu extends LitElement {
19
21
  constructor() {
20
22
  super(...arguments);
21
23
  this._recordingState = "stopped";
22
24
  this.settingsEnabled = ["device", "language"];
23
25
  }
24
26
  render() {
25
- if (!this.settingsEnabled || this.settingsEnabled.length === 0) {
27
+ if (this.settingsEnabled?.length === 0) {
26
28
  return nothing;
27
29
  }
28
30
  const isRecording = this._recordingState === "recording";
29
31
  const showDeviceSelector = this.settingsEnabled.includes("device");
30
32
  const showLanguageSelector = this.settingsEnabled.includes("language");
33
+ const showModeSelector = this.settingsEnabled.includes("mode");
34
+ const showKeybinding = this.settingsEnabled.includes("keybinding");
31
35
  return html `
32
36
  <div class="mic-selector">
33
37
  <button id="settings-popover-button" popovertarget="settings-popover">
34
- <icon-settings></icon-settings>
38
+ <icon-settings />
35
39
  </button>
36
40
  <div id="settings-popover" popover>
37
41
  <div class="settings-wrapper">
@@ -43,14 +47,30 @@ let SettingsMenu = class SettingsMenu extends LitElement {
43
47
  `
44
48
  : nothing}
45
49
  ${showDeviceSelector
46
- ? html `<device-selector
50
+ ? html `<dictation-device-selector
47
51
  ?disabled=${isRecording}
48
- ></device-selector>`
52
+ />`
49
53
  : nothing}
50
54
  ${showLanguageSelector
51
- ? html `<language-selector
55
+ ? html `<dictation-language-selector
52
56
  ?disabled=${isRecording}
53
- ></language-selector>`
57
+ />`
58
+ : nothing}
59
+ ${showModeSelector || showKeybinding
60
+ ? html `
61
+ <div class="settings-group">
62
+ ${showModeSelector
63
+ ? html `<dictation-mode-selector
64
+ ?disabled=${isRecording}
65
+ />`
66
+ : nothing}
67
+ ${showKeybinding
68
+ ? html `<dictation-keybinding-selector
69
+ ?disabled=${isRecording}
70
+ />`
71
+ : nothing}
72
+ </div>
73
+ `
54
74
  : nothing}
55
75
  </div>
56
76
  </div>
@@ -58,7 +78,7 @@ let SettingsMenu = class SettingsMenu extends LitElement {
58
78
  `;
59
79
  }
60
80
  };
61
- SettingsMenu.styles = [
81
+ DictationSettingsMenu.styles = [
62
82
  SettingsMenuStyles,
63
83
  ButtonStyles,
64
84
  CalloutStyles,
@@ -66,15 +86,15 @@ SettingsMenu.styles = [
66
86
  __decorate([
67
87
  consume({ context: recordingStateContext, subscribe: true }),
68
88
  state()
69
- ], SettingsMenu.prototype, "_recordingState", void 0);
89
+ ], DictationSettingsMenu.prototype, "_recordingState", void 0);
70
90
  __decorate([
71
91
  property({
72
92
  converter: commaSeparatedConverter,
73
93
  type: Array,
74
94
  })
75
- ], SettingsMenu.prototype, "settingsEnabled", void 0);
76
- SettingsMenu = __decorate([
77
- customElement("settings-menu")
78
- ], SettingsMenu);
79
- export { SettingsMenu };
95
+ ], DictationSettingsMenu.prototype, "settingsEnabled", void 0);
96
+ DictationSettingsMenu = __decorate([
97
+ customElement("dictation-settings-menu")
98
+ ], DictationSettingsMenu);
99
+ export { DictationSettingsMenu };
80
100
  //# sourceMappingURL=settings-menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings-menu.js","sourceRoot":"","sources":["../../src/components/settings-menu.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAuB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,sBAAsB,CAAC;AAC9B,OAAO,wBAAwB,CAAC;AAChC,OAAO,mBAAmB,CAAC;AAGpB,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QAGL,oBAAe,GAAmB,SAAS,CAAC;QAM5C,oBAAe,GAA2B,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAoDnE,CAAC;IA5CC,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/D,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,KAAK,WAAW,CAAC;QACzD,MAAM,kBAAkB,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnE,MAAM,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAEvE,OAAO,IAAI,CAAA;;;;;;;cAQD,WAAW;YACT,CAAC,CAAC,IAAI,CAAA;;;;iBAIL;YACD,CAAC,CAAC,OACN;cAEE,kBAAkB;YAChB,CAAC,CAAC,IAAI,CAAA;8BACQ,WAAW;oCACL;YACpB,CAAC,CAAC,OACN;cAEE,oBAAoB;YAClB,CAAC,CAAC,IAAI,CAAA;8BACQ,WAAW;sCACH;YACtB,CAAC,CAAC,OACN;;;;KAIP,CAAC;IACJ,CAAC;;AAjDM,mBAAM,GAAmB;IAC9B,kBAAkB;IAClB,YAAY;IACZ,aAAa;CACd,AAJY,CAIX;AAZF;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC5D,KAAK,EAAE;qDACoC;AAM5C;IAJC,QAAQ,CAAC;QACR,SAAS,EAAE,uBAAuB;QAClC,IAAI,EAAE,KAAK;KACZ,CAAC;qDAC+D;AATtD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA6DxB","sourcesContent":["import { consume } from \"@lit/context\";\nimport { type CSSResultGroup, html, LitElement, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { recordingStateContext } from \"../contexts/dictation-context.js\";\nimport ButtonStyles from \"../styles/buttons.js\";\nimport CalloutStyles from \"../styles/callout.js\";\nimport SettingsMenuStyles from \"../styles/settings-menu.js\";\nimport type { ConfigurableSettings, RecordingState } from \"../types.js\";\nimport { commaSeparatedConverter } from \"../utils/converters.js\";\n\nimport \"./device-selector.js\";\nimport \"./language-selector.js\";\nimport \"../icons/icons.js\";\n\n@customElement(\"settings-menu\")\nexport class SettingsMenu extends LitElement {\n @consume({ context: recordingStateContext, subscribe: true })\n @state()\n _recordingState: RecordingState = \"stopped\";\n\n @property({\n converter: commaSeparatedConverter,\n type: Array,\n })\n settingsEnabled: ConfigurableSettings[] = [\"device\", \"language\"];\n\n static styles: CSSResultGroup = [\n SettingsMenuStyles,\n ButtonStyles,\n CalloutStyles,\n ];\n\n render() {\n if (!this.settingsEnabled || this.settingsEnabled.length === 0) {\n return nothing;\n }\n\n const isRecording = this._recordingState === \"recording\";\n const showDeviceSelector = this.settingsEnabled.includes(\"device\");\n const showLanguageSelector = this.settingsEnabled.includes(\"language\");\n\n return html`\n <div class=\"mic-selector\">\n <button id=\"settings-popover-button\" popovertarget=\"settings-popover\">\n <icon-settings></icon-settings>\n </button>\n <div id=\"settings-popover\" popover>\n <div class=\"settings-wrapper\">\n ${\n isRecording\n ? html`\n <div class=\"callout warn\">\n Recording is in progress. Stop recording to change settings.\n </div>\n `\n : nothing\n }\n ${\n showDeviceSelector\n ? html`<device-selector\n ?disabled=${isRecording}\n ></device-selector>`\n : nothing\n }\n ${\n showLanguageSelector\n ? html`<language-selector\n ?disabled=${isRecording}\n ></language-selector>`\n : nothing\n }\n </div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"settings-menu\": SettingsMenu;\n }\n}\n"]}
1
+ {"version":3,"file":"settings-menu.js","sourceRoot":"","sources":["../../src/components/settings-menu.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAuB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,aAAa,MAAM,sBAAsB,CA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AI,CAAA;;sBAGA,gBAAgB;gBACd,CAAC,CAAC,IAAI,CAAA;wCACU,WAAW;6BACtB;gBACL,CAAC,CAAC,OACN;sBAEE,cAAc;gBACZ,CAAC,CAAC,IAAI,CAAA;wCACU,WAAW;6BACtB;gBACL,CAAC,CAAC,OACN;;iBAEH;YACD,CAAC,CAAC,OACN;;;;KAIP,CAAC;IACJ,CAAC;;AAzEM,4BAAM,GAAmB;IAC9B,kBAAkB;IAClB,YAAY;IACZ,aAAa;CACd,AAJY,CAIX;AAZF;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC5D,KAAK,EAAE;8DACoC;AAM5C;IAJC,QAAQ,CAAC;QACR,SAAS,EAAE,uBAAuB;QAClC,IAAI,EAAE,KAAK;KACZ,CAAC;8DAC+D;AATtD,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CAqFjC","sourcesContent":["import { consume } from \"@lit/context\";\nimport { type CSSResultGroup, html, LitElement, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { recordingStateContext } from \"../contexts/dictation-context.js\";\nimport ButtonStyles from \"../styles/buttons.js\";\nimport CalloutStyles from \"../styles/callout.js\";\nimport SettingsMenuStyles from \"../styles/settings-menu.js\";\nimport type { ConfigurableSettings, RecordingState } from \"../types.js\";\nimport { commaSeparatedConverter } from \"../utils/converters.js\";\n\nimport \"./device-selector.js\";\nimport \"./keybinding-selector.js\";\nimport \"./language-selector.js\";\nimport \"./mode-selector.js\";\nimport \"../icons/icons.js\";\n\n@customElement(\"dictation-settings-menu\")\nexport class DictationSettingsMenu extends LitElement {\n @consume({ context: recordingStateContext, subscribe: true })\n @state()\n _recordingState: RecordingState = \"stopped\";\n\n @property({\n converter: commaSeparatedConverter,\n type: Array,\n })\n settingsEnabled: ConfigurableSettings[] = [\"device\", \"language\"];\n\n static styles: CSSResultGroup = [\n SettingsMenuStyles,\n ButtonStyles,\n CalloutStyles,\n ];\n\n render() {\n if (this.settingsEnabled?.length === 0) {\n return nothing;\n }\n\n const isRecording = this._recordingState === \"recording\";\n const showDeviceSelector = this.settingsEnabled.includes(\"device\");\n const showLanguageSelector = this.settingsEnabled.includes(\"language\");\n const showModeSelector = this.settingsEnabled.includes(\"mode\");\n const showKeybinding = this.settingsEnabled.includes(\"keybinding\");\n\n return html`\n <div class=\"mic-selector\">\n <button id=\"settings-popover-button\" popovertarget=\"settings-popover\">\n <icon-settings />\n </button>\n <div id=\"settings-popover\" popover>\n <div class=\"settings-wrapper\">\n ${\n isRecording\n ? html`\n <div class=\"callout warn\">\n Recording is in progress. Stop recording to change settings.\n </div>\n `\n : nothing\n }\n ${\n showDeviceSelector\n ? html`<dictation-device-selector\n ?disabled=${isRecording}\n />`\n : nothing\n }\n ${\n showLanguageSelector\n ? html`<dictation-language-selector\n ?disabled=${isRecording}\n />`\n : nothing\n }\n ${\n showModeSelector || showKeybinding\n ? html`\n <div class=\"settings-group\">\n ${\n showModeSelector\n ? html`<dictation-mode-selector\n ?disabled=${isRecording}\n />`\n : nothing\n }\n ${\n showKeybinding\n ? html`<dictation-keybinding-selector\n ?disabled=${isRecording}\n />`\n : nothing\n }\n </div>\n `\n : nothing\n }\n </div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-settings-menu\": DictationSettingsMenu;\n }\n}\n"]}
@@ -2,3 +2,8 @@ import type { Corti } from "@corti/sdk";
2
2
  export declare const LANGUAGES_SUPPORTED_EU: Corti.TranscribeSupportedLanguage[];
3
3
  export declare const LANGUAGES_SUPPORTED_US: Corti.TranscribeSupportedLanguage[];
4
4
  export declare const DEFAULT_DICTATION_CONFIG: Corti.TranscribeConfig;
5
+ /**
6
+ * Interval in milliseconds at which MediaRecorder fires dataavailable events.
7
+ * This controls how often audio chunks are sent to the WebSocket.
8
+ */
9
+ export declare const AUDIO_CHUNK_INTERVAL_MS = 250;
package/dist/constants.js CHANGED
@@ -34,4 +34,9 @@ export const DEFAULT_DICTATION_CONFIG = {
34
34
  primaryLanguage: "en",
35
35
  spokenPunctuation: true,
36
36
  };
37
+ /**
38
+ * Interval in milliseconds at which MediaRecorder fires dataavailable events.
39
+ * This controls how often audio chunks are sent to the WebSocket.
40
+ */
41
+ export const AUDIO_CHUNK_INTERVAL_MS = 250;
37
42
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAwC;IACzE,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;CACT,CAAC,IAAI,EAAE,CAAC;AACT,MAAM,CAAC,MAAM,sBAAsB,GAAwC;IACzE,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACL,CAAC,IAAI,EAAE,CAAC;AACT,MAAM,CAAC,MAAM,wBAAwB,GAA2B;IAC9D,oBAAoB,EAAE,KAAK;IAC3B,eAAe,EAAE,IAAI;IACrB,iBAAiB,EAAE,IAAI;CACxB,CAAC","sourcesContent":["import type { Corti } from \"@corti/sdk\";\n\nexport const LANGUAGES_SUPPORTED_EU: Corti.TranscribeSupportedLanguage[] = [\n \"da\",\n \"de\",\n \"de-CH\",\n \"en\",\n \"en-GB\",\n \"es\",\n \"fr\",\n \"hu\",\n \"it\",\n \"nl\",\n \"no\",\n \"pt\",\n \"sv\",\n \"gsw-CH\",\n].sort();\nexport const LANGUAGES_SUPPORTED_US: Corti.TranscribeSupportedLanguage[] = [\n \"da\",\n \"de\",\n \"de-CH\",\n \"en\",\n \"en-GB\",\n \"es\",\n \"fr\",\n \"hu\",\n \"it\",\n \"nl\",\n \"no\",\n \"pt\",\n \"sv\",\n].sort();\nexport const DEFAULT_DICTATION_CONFIG: Corti.TranscribeConfig = {\n automaticPunctuation: false,\n primaryLanguage: \"en\",\n spokenPunctuation: true,\n};\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAwC;IACzE,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;CACT,CAAC,IAAI,EAAE,CAAC;AACT,MAAM,CAAC,MAAM,sBAAsB,GAAwC;IACzE,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACL,CAAC,IAAI,EAAE,CAAC;AACT,MAAM,CAAC,MAAM,wBAAwB,GAA2B;IAC9D,oBAAoB,EAAE,KAAK;IAC3B,eAAe,EAAE,IAAI;IACrB,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC","sourcesContent":["import type { Corti } from \"@corti/sdk\";\n\nexport const LANGUAGES_SUPPORTED_EU: Corti.TranscribeSupportedLanguage[] = [\n \"da\",\n \"de\",\n \"de-CH\",\n \"en\",\n \"en-GB\",\n \"es\",\n \"fr\",\n \"hu\",\n \"it\",\n \"nl\",\n \"no\",\n \"pt\",\n \"sv\",\n \"gsw-CH\",\n].sort();\nexport const LANGUAGES_SUPPORTED_US: Corti.TranscribeSupportedLanguage[] = [\n \"da\",\n \"de\",\n \"de-CH\",\n \"en\",\n \"en-GB\",\n \"es\",\n \"fr\",\n \"hu\",\n \"it\",\n \"nl\",\n \"no\",\n \"pt\",\n \"sv\",\n].sort();\nexport const DEFAULT_DICTATION_CONFIG: Corti.TranscribeConfig = {\n automaticPunctuation: false,\n primaryLanguage: \"en\",\n spokenPunctuation: true,\n};\n\n/**\n * Interval in milliseconds at which MediaRecorder fires dataavailable events.\n * This controls how often audio chunks are sent to the WebSocket.\n */\nexport const AUDIO_CHUNK_INTERVAL_MS = 250;\n"]}