@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.
Files changed (223) hide show
  1. package/README.md +163 -102
  2. package/dist/CortiDictation.d.ts +6 -2
  3. package/dist/CortiDictation.js +36 -14
  4. package/dist/CortiDictation.js.map +1 -1
  5. package/dist/bundle.js +3888 -1787
  6. package/dist/components/audio-visualiser.d.ts +5 -3
  7. package/dist/components/audio-visualiser.js +38 -46
  8. package/dist/components/audio-visualiser.js.map +1 -1
  9. package/dist/components/corti-dictation.d.ts +136 -0
  10. package/dist/components/corti-dictation.js +273 -0
  11. package/dist/components/corti-dictation.js.map +1 -0
  12. package/dist/components/device-selector.d.ts +14 -0
  13. package/dist/components/device-selector.js +75 -0
  14. package/dist/components/device-selector.js.map +1 -0
  15. package/dist/components/keybinding-selector.d.ts +14 -0
  16. package/dist/components/keybinding-selector.js +81 -0
  17. package/dist/components/keybinding-selector.js.map +1 -0
  18. package/dist/components/language-selector.d.ts +15 -0
  19. package/dist/components/language-selector.js +74 -0
  20. package/dist/components/language-selector.js.map +1 -0
  21. package/dist/components/mode-selector.d.ts +14 -0
  22. package/dist/components/mode-selector.js +73 -0
  23. package/dist/components/mode-selector.js.map +1 -0
  24. package/dist/components/recording-button.d.ts +31 -0
  25. package/dist/components/recording-button.js +262 -0
  26. package/dist/components/recording-button.js.map +1 -0
  27. package/dist/components/settings-menu.d.ts +12 -14
  28. package/dist/components/settings-menu.js +68 -153
  29. package/dist/components/settings-menu.js.map +1 -1
  30. package/dist/constants.d.ts +8 -2
  31. package/dist/constants.js +38 -12
  32. package/dist/constants.js.map +1 -1
  33. package/dist/contexts/dictation-context.d.ts +107 -0
  34. package/dist/contexts/dictation-context.js +290 -0
  35. package/dist/contexts/dictation-context.js.map +1 -0
  36. package/dist/controllers/DictationController.d.ts +35 -0
  37. package/dist/controllers/DictationController.js +130 -0
  38. package/dist/controllers/DictationController.js.map +1 -0
  39. package/dist/controllers/MediaController.d.ts +31 -0
  40. package/dist/controllers/MediaController.js +99 -0
  41. package/dist/controllers/MediaController.js.map +1 -0
  42. package/dist/controllers/devices-controller.d.ts +26 -0
  43. package/dist/controllers/devices-controller.js +99 -0
  44. package/dist/controllers/devices-controller.js.map +1 -0
  45. package/dist/controllers/dictation-controller.d.ts +29 -0
  46. package/dist/controllers/dictation-controller.js +179 -0
  47. package/dist/controllers/dictation-controller.js.map +1 -0
  48. package/dist/controllers/keybinding-controller.d.ts +17 -0
  49. package/dist/controllers/keybinding-controller.js +80 -0
  50. package/dist/controllers/keybinding-controller.js.map +1 -0
  51. package/dist/controllers/languages-controller.d.ts +26 -0
  52. package/dist/controllers/languages-controller.js +83 -0
  53. package/dist/controllers/languages-controller.js.map +1 -0
  54. package/dist/controllers/media-controller.d.ts +24 -0
  55. package/dist/controllers/media-controller.js +115 -0
  56. package/dist/controllers/media-controller.js.map +1 -0
  57. package/dist/index.d.ts +11 -1
  58. package/dist/index.js +39 -3
  59. package/dist/index.js.map +1 -1
  60. package/dist/package.json +14 -0
  61. package/dist/src/components/audio-visualiser.d.ts +14 -0
  62. package/dist/src/components/audio-visualiser.js +57 -0
  63. package/dist/src/components/audio-visualiser.js.map +1 -0
  64. package/dist/src/components/corti-dictation.d.ts +123 -0
  65. package/dist/src/components/corti-dictation.js +224 -0
  66. package/dist/src/components/corti-dictation.js.map +1 -0
  67. package/dist/src/components/device-selector.d.ts +24 -0
  68. package/dist/src/components/device-selector.js +106 -0
  69. package/dist/src/components/device-selector.js.map +1 -0
  70. package/dist/src/components/language-selector.d.ts +24 -0
  71. package/dist/src/components/language-selector.js +100 -0
  72. package/dist/src/components/language-selector.js.map +1 -0
  73. package/dist/src/components/recording-button.d.ts +37 -0
  74. package/dist/src/components/recording-button.js +203 -0
  75. package/dist/src/components/recording-button.js.map +1 -0
  76. package/dist/src/components/settings-menu.d.ts +16 -0
  77. package/dist/src/components/settings-menu.js +80 -0
  78. package/dist/src/components/settings-menu.js.map +1 -0
  79. package/dist/src/constants.d.ts +4 -0
  80. package/dist/src/constants.js +37 -0
  81. package/dist/src/constants.js.map +1 -0
  82. package/dist/src/contexts/dictation-context.d.ts +97 -0
  83. package/dist/src/contexts/dictation-context.js +208 -0
  84. package/dist/src/contexts/dictation-context.js.map +1 -0
  85. package/dist/src/controllers/DictationController.d.ts +35 -0
  86. package/dist/src/controllers/DictationController.js +130 -0
  87. package/dist/src/controllers/DictationController.js.map +1 -0
  88. package/dist/src/controllers/MediaController.d.ts +31 -0
  89. package/dist/src/controllers/MediaController.js +99 -0
  90. package/dist/src/controllers/MediaController.js.map +1 -0
  91. package/dist/src/icons/icons.d.ts +17 -0
  92. package/dist/src/icons/icons.js +158 -0
  93. package/dist/src/icons/icons.js.map +1 -0
  94. package/dist/src/styles/ComponentStyles.d.ts +2 -0
  95. package/dist/src/styles/ComponentStyles.js +18 -0
  96. package/dist/src/styles/ComponentStyles.js.map +1 -0
  97. package/dist/src/styles/audio-visualiser.d.ts +2 -0
  98. package/dist/src/styles/audio-visualiser.js +33 -0
  99. package/dist/src/styles/audio-visualiser.js.map +1 -0
  100. package/dist/src/styles/buttons.d.ts +2 -0
  101. package/dist/src/styles/buttons.js +52 -0
  102. package/dist/src/styles/buttons.js.map +1 -0
  103. package/dist/src/styles/callout.d.ts +2 -0
  104. package/dist/src/styles/callout.js +23 -0
  105. package/dist/src/styles/callout.js.map +1 -0
  106. package/dist/src/styles/default-theme.d.ts +2 -0
  107. package/dist/src/styles/default-theme.js +50 -0
  108. package/dist/src/styles/default-theme.js.map +1 -0
  109. package/dist/src/styles/recording-button.d.ts +2 -0
  110. package/dist/src/styles/recording-button.js +8 -0
  111. package/dist/src/styles/recording-button.js.map +1 -0
  112. package/dist/src/styles/select.d.ts +2 -0
  113. package/dist/src/styles/select.js +36 -0
  114. package/dist/src/styles/select.js.map +1 -0
  115. package/dist/src/styles/settings-menu.d.ts +2 -0
  116. package/dist/src/styles/settings-menu.js +34 -0
  117. package/dist/src/styles/settings-menu.js.map +1 -0
  118. package/dist/src/types.d.ts +7 -0
  119. package/dist/src/types.js +2 -0
  120. package/dist/src/types.js.map +1 -0
  121. package/dist/src/utils/auth.d.ts +9 -0
  122. package/dist/src/utils/auth.js +21 -0
  123. package/dist/src/utils/auth.js.map +1 -0
  124. package/dist/src/utils/converters.d.ts +4 -0
  125. package/dist/src/utils/converters.js +8 -0
  126. package/dist/src/utils/converters.js.map +1 -0
  127. package/dist/src/utils/devices.d.ts +26 -0
  128. package/dist/src/utils/devices.js +53 -0
  129. package/dist/src/utils/devices.js.map +1 -0
  130. package/dist/src/utils/events.d.ts +44 -0
  131. package/dist/src/utils/events.js +88 -0
  132. package/dist/src/utils/events.js.map +1 -0
  133. package/dist/src/utils/languages.d.ts +7 -0
  134. package/dist/src/utils/languages.js +29 -0
  135. package/dist/src/utils/languages.js.map +1 -0
  136. package/dist/src/utils/media.d.ts +6 -0
  137. package/dist/src/utils/media.js +39 -0
  138. package/dist/src/utils/media.js.map +1 -0
  139. package/dist/src/utils/token.d.ts +13 -0
  140. package/dist/src/utils/token.js +60 -0
  141. package/dist/src/utils/token.js.map +1 -0
  142. package/dist/src/utils/validation.d.ts +1 -0
  143. package/dist/src/utils/validation.js +7 -0
  144. package/dist/src/utils/validation.js.map +1 -0
  145. package/dist/stories/audio-visualiser.stories.d.ts +39 -0
  146. package/dist/stories/audio-visualiser.stories.js +71 -0
  147. package/dist/stories/audio-visualiser.stories.js.map +1 -0
  148. package/dist/stories/corti-dictation.stories.d.ts +27 -0
  149. package/dist/stories/corti-dictation.stories.js +129 -0
  150. package/dist/stories/corti-dictation.stories.js.map +1 -0
  151. package/dist/stories/device-selector.stories.d.ts +18 -0
  152. package/dist/stories/device-selector.stories.js +84 -0
  153. package/dist/stories/device-selector.stories.js.map +1 -0
  154. package/dist/stories/language-selector.stories.d.ts +18 -0
  155. package/dist/stories/language-selector.stories.js +53 -0
  156. package/dist/stories/language-selector.stories.js.map +1 -0
  157. package/dist/stories/recording-button.stories.d.ts +27 -0
  158. package/dist/stories/recording-button.stories.js +90 -0
  159. package/dist/stories/recording-button.stories.js.map +1 -0
  160. package/dist/stories/settings-menu.stories.d.ts +23 -0
  161. package/dist/stories/settings-menu.stories.js +156 -0
  162. package/dist/stories/settings-menu.stories.js.map +1 -0
  163. package/dist/styles/ComponentStyles.js +6 -41
  164. package/dist/styles/ComponentStyles.js.map +1 -1
  165. package/dist/styles/audio-visualiser.d.ts +2 -0
  166. package/dist/styles/audio-visualiser.js +33 -0
  167. package/dist/styles/audio-visualiser.js.map +1 -0
  168. package/dist/styles/buttons.js +19 -26
  169. package/dist/styles/buttons.js.map +1 -1
  170. package/dist/styles/callout.js +7 -17
  171. package/dist/styles/callout.js.map +1 -1
  172. package/dist/styles/component-styles.d.ts +3 -0
  173. package/dist/styles/component-styles.js +32 -0
  174. package/dist/styles/component-styles.js.map +1 -0
  175. package/dist/styles/default-theme.d.ts +2 -0
  176. package/dist/styles/default-theme.js +14 -0
  177. package/dist/styles/default-theme.js.map +1 -0
  178. package/dist/styles/keybinding-selector.d.ts +2 -0
  179. package/dist/styles/keybinding-selector.js +72 -0
  180. package/dist/styles/keybinding-selector.js.map +1 -0
  181. package/dist/styles/mode-selector.d.ts +2 -0
  182. package/dist/styles/mode-selector.js +54 -0
  183. package/dist/styles/mode-selector.js.map +1 -0
  184. package/dist/styles/recording-button.d.ts +2 -0
  185. package/dist/styles/recording-button.js +8 -0
  186. package/dist/styles/recording-button.js.map +1 -0
  187. package/dist/styles/select.d.ts +1 -1
  188. package/dist/styles/select.js +14 -18
  189. package/dist/styles/select.js.map +1 -1
  190. package/dist/styles/settings-menu.d.ts +2 -0
  191. package/dist/styles/settings-menu.js +42 -0
  192. package/dist/styles/settings-menu.js.map +1 -0
  193. package/dist/tsconfig.stories.tsbuildinfo +1 -0
  194. package/dist/types.d.ts +9 -8
  195. package/dist/types.js.map +1 -1
  196. package/dist/utils/auth.d.ts +9 -0
  197. package/dist/utils/auth.js +21 -0
  198. package/dist/utils/auth.js.map +1 -0
  199. package/dist/utils/converters.d.ts +4 -0
  200. package/dist/utils/converters.js +8 -0
  201. package/dist/utils/converters.js.map +1 -0
  202. package/dist/utils/devices.d.ts +26 -0
  203. package/dist/utils/devices.js +53 -0
  204. package/dist/utils/devices.js.map +1 -0
  205. package/dist/utils/events.d.ts +53 -0
  206. package/dist/utils/events.js +102 -0
  207. package/dist/utils/events.js.map +1 -0
  208. package/dist/utils/keybinding.d.ts +49 -0
  209. package/dist/utils/keybinding.js +140 -0
  210. package/dist/utils/keybinding.js.map +1 -0
  211. package/dist/utils/languages.d.ts +8 -0
  212. package/dist/utils/languages.js +29 -0
  213. package/dist/utils/languages.js.map +1 -0
  214. package/dist/utils/media.d.ts +6 -0
  215. package/dist/utils/media.js +39 -0
  216. package/dist/utils/media.js.map +1 -0
  217. package/dist/utils/token.d.ts +13 -0
  218. package/dist/utils/token.js +60 -0
  219. package/dist/utils/token.js.map +1 -0
  220. package/dist/utils/validation.d.ts +1 -0
  221. package/dist/utils/validation.js +7 -0
  222. package/dist/utils/validation.js.map +1 -0
  223. package/package.json +29 -55
@@ -1,12 +1,14 @@
1
- import { LitElement } from 'lit';
2
- export declare class AudioVisualiser extends LitElement {
1
+ import { LitElement, type PropertyValues } from "lit";
2
+ export declare class DictationAudioVisualiser extends LitElement {
3
3
  level: number;
4
4
  active: boolean;
5
+ segmentCount: number;
5
6
  static styles: import("lit").CSSResult;
7
+ willUpdate(changedProperties: PropertyValues<this>): void;
6
8
  render(): import("lit-html").TemplateResult<1>;
7
9
  }
8
10
  declare global {
9
11
  interface HTMLElementTagNameMap {
10
- 'audio-visualiser': AudioVisualiser;
12
+ "dictation-audio-visualiser": DictationAudioVisualiser;
11
13
  }
12
14
  }
@@ -4,62 +4,54 @@ 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
- import { LitElement, html, css } from 'lit';
8
- import { property, customElement } from 'lit/decorators.js';
9
- let AudioVisualiser = class AudioVisualiser extends LitElement {
7
+ import { html, LitElement } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ import { classMap } from "lit/directives/class-map.js";
10
+ import { map } from "lit/directives/map.js";
11
+ import { range } from "lit/directives/range.js";
12
+ import AudioVisualiserStyles from "../styles/audio-visualiser.js";
13
+ import { normalizeToRange } from "../utils/validation.js";
14
+ let DictationAudioVisualiser = class DictationAudioVisualiser extends LitElement {
10
15
  constructor() {
11
16
  super(...arguments);
12
- this.level = 0; // expects a value from 0 to 100
13
- this.active = true;
17
+ this.level = 0;
18
+ this.active = false;
19
+ this.segmentCount = 5;
14
20
  }
15
- render() {
16
- // Each segment represents 20%. Using Math.ceil to fill segments optimistically.
17
- const activeSegments = Math.round(this.level * 5);
18
- const segments = [];
19
- for (let i = 0; i < 5; i += 1) {
20
- segments.push(html `
21
- <div class="segment ${i < activeSegments ? 'active' : ''}"></div>
22
- `);
21
+ willUpdate(changedProperties) {
22
+ if (changedProperties.has("level")) {
23
+ this.level = normalizeToRange(this.level);
23
24
  }
25
+ }
26
+ render() {
27
+ // Each segment represents 20%. Using Math.round to fill segments.
28
+ const activeSegments = Math.round(this.level * this.segmentCount);
29
+ const segments = map(range(this.segmentCount), (i) => html `<div class=${classMap({
30
+ active: i < activeSegments,
31
+ segment: true,
32
+ })} />`);
24
33
  return html `
25
- <div class="container ${this.active ? 'active' : ''}">${segments}</div>
34
+ <div class=${classMap({
35
+ active: this.active,
36
+ container: true,
37
+ })}>
38
+ ${segments}
39
+ </div>
26
40
  `;
27
41
  }
28
42
  };
29
- AudioVisualiser.styles = css `
30
- :host {
31
- height: 100%;
32
- }
33
- .container {
34
- display: flex;
35
- width: 8px;
36
- flex-direction: column-reverse; /* Bottom-up stacking */
37
- height: 100%;
38
- gap: 1px;
39
- opacity: 0.5;
40
- &.active {
41
- opacity: 1;
42
- }
43
- }
44
- .segment {
45
- flex: 1;
46
- background-color: var(--action-accent-text-color);
47
- transition: background-color 0.25s;
48
- border-radius: 1px;
49
- opacity: 0.5;
50
- }
51
- .segment.active {
52
- opacity: 1;
53
- }
54
- `;
43
+ DictationAudioVisualiser.styles = AudioVisualiserStyles;
55
44
  __decorate([
56
45
  property({ type: Number })
57
- ], AudioVisualiser.prototype, "level", void 0);
46
+ ], DictationAudioVisualiser.prototype, "level", void 0);
58
47
  __decorate([
59
48
  property({ type: Boolean })
60
- ], AudioVisualiser.prototype, "active", void 0);
61
- AudioVisualiser = __decorate([
62
- customElement('audio-visualiser')
63
- ], AudioVisualiser);
64
- export { AudioVisualiser };
49
+ ], DictationAudioVisualiser.prototype, "active", void 0);
50
+ __decorate([
51
+ property({ type: Number })
52
+ ], DictationAudioVisualiser.prototype, "segmentCount", void 0);
53
+ DictationAudioVisualiser = __decorate([
54
+ customElement("dictation-audio-visualiser")
55
+ ], DictationAudioVisualiser);
56
+ export { DictationAudioVisualiser };
65
57
  //# sourceMappingURL=audio-visualiser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"audio-visualiser.js","sourceRoot":"","sources":["../../src/components/audio-visualiser.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGrD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QACuB,UAAK,GAAG,CAAC,CAAC,CAAC,gCAAgC;QAE1C,WAAM,GAAG,IAAI,CAAC;IA0C7C,CAAC;IAbC,MAAM;QACJ,gFAAgF;QAChF,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAClD,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAA;8BACM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;OACzD,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAA;8BACe,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ;KACjE,CAAC;IACJ,CAAC;;AAvCM,sBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBlB,AAzBY,CAyBX;AA7B0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAW;AAET;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAAe;AAHhC,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CA6C3B","sourcesContent":["import { LitElement, html, css } from 'lit';\nimport { property, customElement } from 'lit/decorators.js';\n\n@customElement('audio-visualiser')\nexport class AudioVisualiser extends LitElement {\n @property({ type: Number }) level = 0; // expects a value from 0 to 100\n\n @property({ type: Boolean }) active = true;\n\n static styles = css`\n :host {\n height: 100%;\n }\n .container {\n display: flex;\n width: 8px;\n flex-direction: column-reverse; /* Bottom-up stacking */\n height: 100%;\n gap: 1px;\n opacity: 0.5;\n &.active {\n opacity: 1;\n }\n }\n .segment {\n flex: 1;\n background-color: var(--action-accent-text-color);\n transition: background-color 0.25s;\n border-radius: 1px;\n opacity: 0.5;\n }\n .segment.active {\n opacity: 1;\n }\n `;\n\n render() {\n // Each segment represents 20%. Using Math.ceil to fill segments optimistically.\n const activeSegments = Math.round(this.level * 5);\n const segments = [];\n for (let i = 0; i < 5; i += 1) {\n segments.push(html`\n <div class=\"segment ${i < activeSegments ? 'active' : ''}\"></div>\n `);\n }\n return html`\n <div class=\"container ${this.active ? 'active' : ''}\">${segments}</div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'audio-visualiser': AudioVisualiser;\n }\n}\n"]}
1
+ {"version":3,"file":"audio-visualiser.js","sourceRoot":"","sources":["../../src/components/audio-visualiser.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAGnD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,UAAU;IAAjD;;QAEL,UAAK,GAAW,CAAC,CAAC;QAGlB,WAAM,GAAY,KAAK,CAAC;QAGxB,iBAAY,GAAW,CAAC,CAAC;IA+B3B,CAAC;IA3BC,UAAU,CAAC,iBAAuC;QAChD,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,MAAM;QACJ,kEAAkE;QAClE,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;QAClE,MAAM,QAAQ,GAAG,GAAG,CAClB,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,EACxB,CAAC,CAAC,EAAE,EAAE,CACJ,IAAI,CAAA,cAAc,QAAQ,CAAC;YACzB,MAAM,EAAE,CAAC,GAAG,cAAc;YAC1B,OAAO,EAAE,IAAI;SACd,CAAC,KAAK,CACV,CAAC;QAEF,OAAO,IAAI,CAAA;mBACI,QAAQ,CAAC;YACpB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI;SAChB,CAAC;UACE,QAAQ;;KAEb,CAAC;IACJ,CAAC;;AA5BM,+BAAM,GAAG,qBAAqB,AAAxB,CAAyB;AARtC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDACT;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDACJ;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DACF;AARd,wBAAwB;IADpC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,wBAAwB,CAuCpC","sourcesContent":["import { html, LitElement, type PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { map } from \"lit/directives/map.js\";\nimport { range } from \"lit/directives/range.js\";\nimport AudioVisualiserStyles from \"../styles/audio-visualiser.js\";\nimport { normalizeToRange } from \"../utils/validation.js\";\n\n@customElement(\"dictation-audio-visualiser\")\nexport class DictationAudioVisualiser extends LitElement {\n @property({ type: Number })\n level: number = 0;\n\n @property({ type: Boolean })\n active: boolean = false;\n\n @property({ type: Number })\n segmentCount: number = 5;\n\n static styles = AudioVisualiserStyles;\n\n willUpdate(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has(\"level\")) {\n this.level = normalizeToRange(this.level);\n }\n }\n\n render() {\n // Each segment represents 20%. Using Math.round to fill segments.\n const activeSegments = Math.round(this.level * this.segmentCount);\n const segments = map(\n range(this.segmentCount),\n (i) =>\n html`<div class=${classMap({\n active: i < activeSegments,\n segment: true,\n })} />`,\n );\n\n return html`\n <div class=${classMap({\n active: this.active,\n container: true,\n })}>\n ${segments}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-audio-visualiser\": DictationAudioVisualiser;\n }\n}\n"]}
@@ -0,0 +1,136 @@
1
+ import type { Corti } from "@corti/sdk";
2
+ import { LitElement } from "lit";
3
+ import type { ConfigurableSettings, DictationMode, ProxyOptions, RecordingState } from "../types.js";
4
+ import "../contexts/dictation-context.js";
5
+ import "./recording-button.js";
6
+ import "./settings-menu.js";
7
+ export declare class CortiDictation extends LitElement {
8
+ #private;
9
+ static styles: import("lit").CSSResult;
10
+ /**
11
+ * Latest access token
12
+ */
13
+ accessToken?: string;
14
+ /**
15
+ * Authentication configuration with optional refresh mechanism.
16
+ */
17
+ authConfig?: Corti.BearerOptions;
18
+ /**
19
+ * WebSocket URL for proxy connection. When provided, uses CortiWebSocketProxyClient instead of CortiClient.
20
+ */
21
+ socketUrl?: string;
22
+ /**
23
+ * Socket proxy configuration object. When provided, uses CortiWebSocketProxyClient instead of CortiClient.
24
+ */
25
+ socketProxy?: ProxyOptions;
26
+ /**
27
+ * List of all language codes available for use with the Web Component.
28
+ * Default list depends on the accessToken
29
+ */
30
+ set languagesSupported(value: Corti.TranscribeSupportedLanguage[] | undefined);
31
+ get languagesSupported(): Corti.TranscribeSupportedLanguage[];
32
+ _languagesSupported?: Corti.TranscribeSupportedLanguage[];
33
+ /**
34
+ * Which settings should be available in the UI.
35
+ * If an empty array is passed, the settings will be disabled entirely.
36
+ * Options are language and devices
37
+ */
38
+ settingsEnabled: ConfigurableSettings[];
39
+ /**
40
+ * When false (default), allows the start/stop button from taking focus when clicked,
41
+ * disabling textareas or other input elements to maintain focus.
42
+ * Set to "true" to allow the button to receive focus on click.
43
+ */
44
+ allowButtonFocus: boolean;
45
+ /**
46
+ * Overrides any device selection and instead uses getDisplayMedia to stream system audio.
47
+ * Should only be used for debugging.
48
+ */
49
+ debug_displayAudio: boolean;
50
+ /**
51
+ * Configuration settings for dictation
52
+ */
53
+ set dictationConfig(value: Corti.TranscribeConfig);
54
+ get dictationConfig(): Corti.TranscribeConfig;
55
+ _dictationConfig: Corti.TranscribeConfig;
56
+ /**
57
+ * List of available recording devices
58
+ */
59
+ set devices(value: MediaDeviceInfo[] | undefined);
60
+ get devices(): MediaDeviceInfo[];
61
+ _devices?: MediaDeviceInfo[];
62
+ /**
63
+ * The selected device used for recording (MediaDeviceInfo).
64
+ */
65
+ set selectedDevice(value: MediaDeviceInfo | undefined);
66
+ get selectedDevice(): MediaDeviceInfo | undefined;
67
+ _selectedDevice?: MediaDeviceInfo;
68
+ /**
69
+ * Current state of recording (stopped, recording, initializing and stopping, ).
70
+ */
71
+ get recordingState(): RecordingState;
72
+ /**
73
+ * Dictation mode: "toggle-to-talk" or "push-to-talk"
74
+ */
75
+ set mode(value: DictationMode);
76
+ get mode(): DictationMode;
77
+ _mode?: DictationMode;
78
+ /**
79
+ * Keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
80
+ * Combinations with "+" are not supported.
81
+ * Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
82
+ */
83
+ set keybinding(value: string | null | undefined);
84
+ get keybinding(): string | null | undefined;
85
+ _keybinding?: string | null;
86
+ /**
87
+ * Set the latest access token.
88
+ * @returns ServerConfig with environment, tenant, and accessToken
89
+ * @deprecated Use 'accessToken' property instead.
90
+ */
91
+ setAccessToken(token: string): {
92
+ accessToken: string | undefined;
93
+ environment: undefined;
94
+ tenant: undefined;
95
+ } | {
96
+ accessToken: string;
97
+ environment: string;
98
+ tenant: string;
99
+ };
100
+ /**
101
+ * Set the auth configuration for OAuth flows.
102
+ * @returns Promise with ServerConfig containing environment, tenant, and accessToken
103
+ * @deprecated Use 'authConfig' property instead.
104
+ */
105
+ setAuthConfig(config: Corti.BearerOptions): Promise<{
106
+ accessToken: string | undefined;
107
+ environment: undefined;
108
+ tenant: undefined;
109
+ } | {
110
+ accessToken: string;
111
+ environment: string;
112
+ tenant: string;
113
+ } | {
114
+ accessToken: undefined;
115
+ environment: undefined;
116
+ tenant: undefined;
117
+ }>;
118
+ /**
119
+ * Starts a recording.
120
+ */
121
+ startRecording(): void;
122
+ /**
123
+ * Stops a recording.
124
+ */
125
+ stopRecording(): void;
126
+ /**
127
+ * Starts or stops recording. Convenience layer on top of the start/stop methods.
128
+ */
129
+ toggleRecording(): void;
130
+ render(): import("lit-html").TemplateResult<1>;
131
+ }
132
+ declare global {
133
+ interface HTMLElementTagNameMap {
134
+ "corti-dictation": CortiDictation;
135
+ }
136
+ }
@@ -0,0 +1,273 @@
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 _CortiDictation_recordingButtonRef, _CortiDictation_contextProviderRef;
13
+ import { css, html, LitElement, nothing } from "lit";
14
+ import { customElement, property, state } from "lit/decorators.js";
15
+ import { classMap } from "lit/directives/class-map.js";
16
+ import { createRef, ref } from "lit/directives/ref.js";
17
+ import { DEFAULT_DICTATION_CONFIG } from "../constants.js";
18
+ import { commaSeparatedConverter } from "../utils/converters.js";
19
+ import "../contexts/dictation-context.js";
20
+ import "./recording-button.js";
21
+ import "./settings-menu.js";
22
+ let CortiDictation = class CortiDictation extends LitElement {
23
+ constructor() {
24
+ super(...arguments);
25
+ // ─────────────────────────────────────────────────────────────────────────────
26
+ // Private refs
27
+ // ─────────────────────────────────────────────────────────────────────────────
28
+ _CortiDictation_recordingButtonRef.set(this, createRef());
29
+ _CortiDictation_contextProviderRef.set(this, createRef());
30
+ /**
31
+ * Which settings should be available in the UI.
32
+ * If an empty array is passed, the settings will be disabled entirely.
33
+ * Options are language and devices
34
+ */
35
+ this.settingsEnabled = ["device", "language"];
36
+ /**
37
+ * When false (default), allows the start/stop button from taking focus when clicked,
38
+ * disabling textareas or other input elements to maintain focus.
39
+ * Set to "true" to allow the button to receive focus on click.
40
+ */
41
+ this.allowButtonFocus = false;
42
+ /**
43
+ * Overrides any device selection and instead uses getDisplayMedia to stream system audio.
44
+ * Should only be used for debugging.
45
+ */
46
+ this.debug_displayAudio = false;
47
+ this._dictationConfig = DEFAULT_DICTATION_CONFIG;
48
+ this._mode = "toggle-to-talk";
49
+ }
50
+ /**
51
+ * List of all language codes available for use with the Web Component.
52
+ * Default list depends on the accessToken
53
+ */
54
+ set languagesSupported(value) {
55
+ this._languagesSupported = value;
56
+ }
57
+ get languagesSupported() {
58
+ return (__classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.languages ||
59
+ this._languagesSupported ||
60
+ []);
61
+ }
62
+ /**
63
+ * Configuration settings for dictation
64
+ */
65
+ set dictationConfig(value) {
66
+ this._dictationConfig = value;
67
+ }
68
+ get dictationConfig() {
69
+ return (__classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.dictationConfig || this._dictationConfig);
70
+ }
71
+ /**
72
+ * List of available recording devices
73
+ */
74
+ set devices(value) {
75
+ this._devices = value;
76
+ }
77
+ get devices() {
78
+ return __classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.devices || this._devices || [];
79
+ }
80
+ /**
81
+ * The selected device used for recording (MediaDeviceInfo).
82
+ */
83
+ set selectedDevice(value) {
84
+ this._selectedDevice = value;
85
+ }
86
+ get selectedDevice() {
87
+ return (__classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.selectedDevice || this._selectedDevice);
88
+ }
89
+ /**
90
+ * Current state of recording (stopped, recording, initializing and stopping, ).
91
+ */
92
+ get recordingState() {
93
+ return __classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.recordingState || "stopped";
94
+ }
95
+ /**
96
+ * Dictation mode: "toggle-to-talk" or "push-to-talk"
97
+ */
98
+ set mode(value) {
99
+ this._mode = value;
100
+ }
101
+ get mode() {
102
+ return (__classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.mode || this._mode || "toggle-to-talk");
103
+ }
104
+ /**
105
+ * Keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
106
+ * Combinations with "+" are not supported.
107
+ * Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
108
+ */
109
+ set keybinding(value) {
110
+ this._keybinding = value;
111
+ }
112
+ get keybinding() {
113
+ return __classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.keybinding || this._keybinding;
114
+ }
115
+ // ─────────────────────────────────────────────────────────────────────────────
116
+ // Public methods
117
+ // ─────────────────────────────────────────────────────────────────────────────
118
+ /**
119
+ * Set the latest access token.
120
+ * @returns ServerConfig with environment, tenant, and accessToken
121
+ * @deprecated Use 'accessToken' property instead.
122
+ */
123
+ setAccessToken(token) {
124
+ this.accessToken = token;
125
+ return (__classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.setAccessToken(token) ?? {
126
+ accessToken: token,
127
+ environment: undefined,
128
+ tenant: undefined,
129
+ });
130
+ }
131
+ /**
132
+ * Set the auth configuration for OAuth flows.
133
+ * @returns Promise with ServerConfig containing environment, tenant, and accessToken
134
+ * @deprecated Use 'authConfig' property instead.
135
+ */
136
+ async setAuthConfig(config) {
137
+ this.authConfig = config;
138
+ return (__classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f").value?.setAuthConfig(config) ?? {
139
+ accessToken: undefined,
140
+ environment: undefined,
141
+ tenant: undefined,
142
+ });
143
+ }
144
+ /**
145
+ * Starts a recording.
146
+ */
147
+ startRecording() {
148
+ __classPrivateFieldGet(this, _CortiDictation_recordingButtonRef, "f").value?.startRecording();
149
+ }
150
+ /**
151
+ * Stops a recording.
152
+ */
153
+ stopRecording() {
154
+ __classPrivateFieldGet(this, _CortiDictation_recordingButtonRef, "f").value?.stopRecording();
155
+ }
156
+ /**
157
+ * Starts or stops recording. Convenience layer on top of the start/stop methods.
158
+ */
159
+ toggleRecording() {
160
+ __classPrivateFieldGet(this, _CortiDictation_recordingButtonRef, "f").value?.toggleRecording();
161
+ }
162
+ // ─────────────────────────────────────────────────────────────────────────────
163
+ // Render
164
+ // ─────────────────────────────────────────────────────────────────────────────
165
+ render() {
166
+ const isHidden = !this.accessToken &&
167
+ !this.authConfig &&
168
+ !this.socketUrl &&
169
+ !this.socketProxy;
170
+ return html `
171
+ <dictation-root
172
+ ${ref(__classPrivateFieldGet(this, _CortiDictation_contextProviderRef, "f"))}
173
+ class=${classMap({ hidden: isHidden })}
174
+ .accessToken=${this.accessToken}
175
+ .authConfig=${this.authConfig}
176
+ .socketUrl=${this.socketUrl}
177
+ .socketProxy=${this.socketProxy}
178
+ .dictationConfig=${this._dictationConfig}
179
+ .languages=${this._languagesSupported}
180
+ .devices=${this._devices}
181
+ .selectedDevice=${this._selectedDevice}
182
+ .debug_displayAudio=${this.debug_displayAudio}
183
+ .mode=${this._mode}
184
+ .keybinding=${this._keybinding}
185
+ >
186
+ <dictation-recording-button
187
+ ${ref(__classPrivateFieldGet(this, _CortiDictation_recordingButtonRef, "f"))}
188
+ ?allowButtonFocus=${this.allowButtonFocus}
189
+ ></dictation-recording-button>
190
+ ${this.settingsEnabled?.length > 0
191
+ ? html `<dictation-settings-menu
192
+ .settingsEnabled=${this.settingsEnabled}
193
+ ></dictation-settings-menu>`
194
+ : nothing}
195
+ </dictation-root>
196
+ `;
197
+ }
198
+ };
199
+ _CortiDictation_recordingButtonRef = new WeakMap();
200
+ _CortiDictation_contextProviderRef = new WeakMap();
201
+ CortiDictation.styles = css `
202
+ .hidden {
203
+ display: none;
204
+ }
205
+ `;
206
+ __decorate([
207
+ property({ type: String })
208
+ ], CortiDictation.prototype, "accessToken", void 0);
209
+ __decorate([
210
+ property({ attribute: false, type: Object })
211
+ ], CortiDictation.prototype, "authConfig", void 0);
212
+ __decorate([
213
+ property({ type: String })
214
+ ], CortiDictation.prototype, "socketUrl", void 0);
215
+ __decorate([
216
+ property({ attribute: false, type: Object })
217
+ ], CortiDictation.prototype, "socketProxy", void 0);
218
+ __decorate([
219
+ property({
220
+ converter: commaSeparatedConverter,
221
+ type: Array,
222
+ })
223
+ ], CortiDictation.prototype, "languagesSupported", null);
224
+ __decorate([
225
+ state()
226
+ ], CortiDictation.prototype, "_languagesSupported", void 0);
227
+ __decorate([
228
+ property({
229
+ converter: commaSeparatedConverter,
230
+ type: Array,
231
+ })
232
+ ], CortiDictation.prototype, "settingsEnabled", void 0);
233
+ __decorate([
234
+ property({ type: Boolean })
235
+ ], CortiDictation.prototype, "allowButtonFocus", void 0);
236
+ __decorate([
237
+ property({ attribute: "debug-display-audio", type: Boolean })
238
+ ], CortiDictation.prototype, "debug_displayAudio", void 0);
239
+ __decorate([
240
+ property({ attribute: false, type: Object })
241
+ ], CortiDictation.prototype, "dictationConfig", null);
242
+ __decorate([
243
+ state()
244
+ ], CortiDictation.prototype, "_dictationConfig", void 0);
245
+ __decorate([
246
+ property({ attribute: false, type: Array })
247
+ ], CortiDictation.prototype, "devices", null);
248
+ __decorate([
249
+ state()
250
+ ], CortiDictation.prototype, "_devices", void 0);
251
+ __decorate([
252
+ property({ attribute: false, type: Object })
253
+ ], CortiDictation.prototype, "selectedDevice", null);
254
+ __decorate([
255
+ state()
256
+ ], CortiDictation.prototype, "_selectedDevice", void 0);
257
+ __decorate([
258
+ property({ type: String })
259
+ ], CortiDictation.prototype, "mode", null);
260
+ __decorate([
261
+ state()
262
+ ], CortiDictation.prototype, "_mode", void 0);
263
+ __decorate([
264
+ property({ type: String })
265
+ ], CortiDictation.prototype, "keybinding", null);
266
+ __decorate([
267
+ state()
268
+ ], CortiDictation.prototype, "_keybinding", void 0);
269
+ CortiDictation = __decorate([
270
+ customElement("corti-dictation")
271
+ ], CortiDictation);
272
+ export { CortiDictation };
273
+ //# sourceMappingURL=corti-dictation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"corti-dictation.js","sourceRoot":"","sources":["../../src/components/corti-dictation.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAY,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAQ3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,OAAO,kCAAkC,CAAC;AAC1C,OAAO,uBAAuB,CAAC;AAC/B,OAAO,oBAAoB,CAAC;AAGrB,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QAML,gFAAgF;QAChF,eAAe;QACf,gFAAgF;QAEhF,6CAAqD,SAAS,EAAE,EAAC;QACjE,6CAA0C,SAAS,EAAE,EAAC;QAuDtD;;;;WAIG;QAKH,oBAAe,GAA2B,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAEjE;;;;WAIG;QAEH,qBAAgB,GAAY,KAAK,CAAC;QAElC;;;WAGG;QAEH,uBAAkB,GAAY,KAAK,CAAC;QAiBpC,qBAAgB,GAA2B,wBAAwB,CAAC;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AJC,QAAQ,CAAC;QACR,SAAS,EAAE,uBAAuB;QAClC,IAAI,EAAE,KAAK;KACZ,CAAC;wDAKD;AAWD;IADC,KAAK,EAAE;2DACkD;AAW1D;IAJC,QAAQ,CAAC;QACR,SAAS,EAAE,uBAAuB;QAClC,IAAI,EAAE,KAAK;KACZ,CAAC;uDAC+D;AAQjE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDACM;AAOlC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,qBAAqB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0DAC1B;AAMpC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAG5C;AASD;IADC,KAAK,EAAE;wDAC4D;AAMpE;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAG3C;AAOD;IADC,KAAK,EAAE;gDACqB;AAM7B;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAG5C;AASD;IADC,KAAK,EAAE;uDAC0B;AAalC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAG1B;AASD;IADC,KAAK,EAAE;6CACiC;AAQzC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAG1B;AAOD;IADC,KAAK,EAAE;mDACoB;AApLjB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA0R1B","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport { css, html, LitElement, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { createRef, type Ref, ref } from \"lit/directives/ref.js\";\nimport { DEFAULT_DICTATION_CONFIG } from \"../constants.js\";\nimport type { DictationRoot } from \"../contexts/dictation-context.js\";\nimport type {\n ConfigurableSettings,\n DictationMode,\n ProxyOptions,\n RecordingState,\n} from \"../types.js\";\nimport { commaSeparatedConverter } from \"../utils/converters.js\";\nimport type { DictationRecordingButton } from \"./recording-button.js\";\n\nimport \"../contexts/dictation-context.js\";\nimport \"./recording-button.js\";\nimport \"./settings-menu.js\";\n\n@customElement(\"corti-dictation\")\nexport class CortiDictation extends LitElement {\n static styles = css`\n .hidden {\n display: none;\n }\n `;\n // ─────────────────────────────────────────────────────────────────────────────\n // Private refs\n // ─────────────────────────────────────────────────────────────────────────────\n\n #recordingButtonRef: Ref<DictationRecordingButton> = createRef();\n #contextProviderRef: Ref<DictationRoot> = createRef();\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Properties\n // ─────────────────────────────────────────────────────────────────────────────\n\n /**\n * Latest access token\n */\n @property({ type: String })\n accessToken?: string;\n\n /**\n * Authentication configuration with optional refresh mechanism.\n */\n @property({ attribute: false, type: Object })\n authConfig?: Corti.BearerOptions;\n\n /**\n * WebSocket URL for proxy connection. When provided, uses CortiWebSocketProxyClient instead of CortiClient.\n */\n @property({ type: String })\n socketUrl?: string;\n\n /**\n * Socket proxy configuration object. When provided, uses CortiWebSocketProxyClient instead of CortiClient.\n */\n @property({ attribute: false, type: Object })\n socketProxy?: ProxyOptions;\n\n /**\n * List of all language codes available for use with the Web Component.\n * Default list depends on the accessToken\n */\n @property({\n converter: commaSeparatedConverter,\n type: Array,\n })\n set languagesSupported(value:\n | Corti.TranscribeSupportedLanguage[]\n | undefined) {\n this._languagesSupported = value;\n }\n\n get languagesSupported(): Corti.TranscribeSupportedLanguage[] {\n return (\n this.#contextProviderRef.value?.languages ||\n this._languagesSupported ||\n []\n );\n }\n\n @state()\n _languagesSupported?: Corti.TranscribeSupportedLanguage[];\n\n /**\n * Which settings should be available in the UI.\n * If an empty array is passed, the settings will be disabled entirely.\n * Options are language and devices\n */\n @property({\n converter: commaSeparatedConverter,\n type: Array,\n })\n settingsEnabled: ConfigurableSettings[] = [\"device\", \"language\"];\n\n /**\n * When false (default), allows the start/stop button from taking focus when clicked,\n * disabling textareas or other input elements to maintain focus.\n * Set to \"true\" to allow the button to receive focus on click.\n */\n @property({ type: Boolean })\n allowButtonFocus: boolean = false;\n\n /**\n * Overrides any device selection and instead uses getDisplayMedia to stream system audio.\n * Should only be used for debugging.\n */\n @property({ attribute: \"debug-display-audio\", type: Boolean })\n debug_displayAudio: boolean = false;\n\n /**\n * Configuration settings for dictation\n */\n @property({ attribute: false, type: Object })\n set dictationConfig(value: Corti.TranscribeConfig) {\n this._dictationConfig = value;\n }\n\n get dictationConfig(): Corti.TranscribeConfig {\n return (\n this.#contextProviderRef.value?.dictationConfig || this._dictationConfig\n );\n }\n\n @state()\n _dictationConfig: Corti.TranscribeConfig = DEFAULT_DICTATION_CONFIG;\n\n /**\n * List of available recording devices\n */\n @property({ attribute: false, type: Array })\n set devices(value: MediaDeviceInfo[] | undefined) {\n this._devices = value;\n }\n\n get devices(): MediaDeviceInfo[] {\n return this.#contextProviderRef.value?.devices || this._devices || [];\n }\n\n @state()\n _devices?: MediaDeviceInfo[];\n\n /**\n * The selected device used for recording (MediaDeviceInfo).\n */\n @property({ attribute: false, type: Object })\n set selectedDevice(value: MediaDeviceInfo | undefined) {\n this._selectedDevice = value;\n }\n\n get selectedDevice(): MediaDeviceInfo | undefined {\n return (\n this.#contextProviderRef.value?.selectedDevice || this._selectedDevice\n );\n }\n\n @state()\n _selectedDevice?: MediaDeviceInfo;\n\n /**\n * Current state of recording (stopped, recording, initializing and stopping, ).\n */\n get recordingState(): RecordingState {\n return this.#contextProviderRef.value?.recordingState || \"stopped\";\n }\n\n /**\n * Dictation mode: \"toggle-to-talk\" or \"push-to-talk\"\n */\n @property({ type: String })\n set mode(value: DictationMode) {\n this._mode = value;\n }\n\n get mode(): DictationMode {\n return (\n this.#contextProviderRef.value?.mode || this._mode || \"toggle-to-talk\"\n );\n }\n\n @state()\n _mode?: DictationMode = \"toggle-to-talk\";\n\n /**\n * Keybinding for keyboard shortcut. Single key only (e.g., \"`\", \"k\", \"meta\", \"ctrl\").\n * Combinations with \"+\" are not supported.\n * Defaults to \"`\" if keybinding is in settingsEnabled, otherwise undefined\n */\n @property({ type: String })\n set keybinding(value: string | null | undefined) {\n this._keybinding = value;\n }\n\n get keybinding(): string | null | undefined {\n return this.#contextProviderRef.value?.keybinding || this._keybinding;\n }\n\n @state()\n _keybinding?: string | null;\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Public methods\n // ─────────────────────────────────────────────────────────────────────────────\n\n /**\n * Set the latest access token.\n * @returns ServerConfig with environment, tenant, and accessToken\n * @deprecated Use 'accessToken' property instead.\n */\n public setAccessToken(token: string) {\n this.accessToken = token;\n\n return (\n this.#contextProviderRef.value?.setAccessToken(token) ?? {\n accessToken: token,\n environment: undefined,\n tenant: undefined,\n }\n );\n }\n\n /**\n * Set the auth configuration for OAuth flows.\n * @returns Promise with ServerConfig containing environment, tenant, and accessToken\n * @deprecated Use 'authConfig' property instead.\n */\n public async setAuthConfig(config: Corti.BearerOptions) {\n this.authConfig = config;\n\n return (\n this.#contextProviderRef.value?.setAuthConfig(config) ?? {\n accessToken: undefined,\n environment: undefined,\n tenant: undefined,\n }\n );\n }\n\n /**\n * Starts a recording.\n */\n public startRecording(): void {\n this.#recordingButtonRef.value?.startRecording();\n }\n\n /**\n * Stops a recording.\n */\n public stopRecording(): void {\n this.#recordingButtonRef.value?.stopRecording();\n }\n\n /**\n * Starts or stops recording. Convenience layer on top of the start/stop methods.\n */\n public toggleRecording(): void {\n this.#recordingButtonRef.value?.toggleRecording();\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Render\n // ─────────────────────────────────────────────────────────────────────────────\n\n render() {\n const isHidden =\n !this.accessToken &&\n !this.authConfig &&\n !this.socketUrl &&\n !this.socketProxy;\n\n return html`\n <dictation-root\n ${ref(this.#contextProviderRef)}\n class=${classMap({ hidden: isHidden })}\n .accessToken=${this.accessToken}\n .authConfig=${this.authConfig}\n .socketUrl=${this.socketUrl}\n .socketProxy=${this.socketProxy}\n .dictationConfig=${this._dictationConfig}\n .languages=${this._languagesSupported}\n .devices=${this._devices}\n .selectedDevice=${this._selectedDevice}\n .debug_displayAudio=${this.debug_displayAudio}\n .mode=${this._mode}\n .keybinding=${this._keybinding}\n >\n <dictation-recording-button\n ${ref(this.#recordingButtonRef)}\n ?allowButtonFocus=${this.allowButtonFocus}\n ></dictation-recording-button>\n ${\n this.settingsEnabled?.length > 0\n ? html`<dictation-settings-menu\n .settingsEnabled=${this.settingsEnabled}\n ></dictation-settings-menu>`\n : nothing\n }\n </dictation-root>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"corti-dictation\": CortiDictation;\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { LitElement } from "lit";
2
+ export declare class DictationDeviceSelector extends LitElement {
3
+ #private;
4
+ _devices?: MediaDeviceInfo[];
5
+ _selectedDevice?: MediaDeviceInfo;
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-device-selector": DictationDeviceSelector;
13
+ }
14
+ }