@corti/dictation-web 0.5.0-rc → 0.5.0-rc.2

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 (37) hide show
  1. package/README.md +24 -38
  2. package/dist/bundle.js +327 -380
  3. package/dist/components/corti-dictation.d.ts +13 -9
  4. package/dist/components/corti-dictation.js +22 -17
  5. package/dist/components/corti-dictation.js.map +1 -1
  6. package/dist/components/keybinding-input.d.ts +16 -0
  7. package/dist/components/keybinding-input.js +94 -0
  8. package/dist/components/keybinding-input.js.map +1 -0
  9. package/dist/components/keybinding-selector.d.ts +3 -3
  10. package/dist/components/keybinding-selector.js +19 -48
  11. package/dist/components/keybinding-selector.js.map +1 -1
  12. package/dist/components/recording-button.d.ts +3 -3
  13. package/dist/components/recording-button.js +9 -37
  14. package/dist/components/recording-button.js.map +1 -1
  15. package/dist/components/settings-menu.d.ts +0 -1
  16. package/dist/components/settings-menu.js +4 -17
  17. package/dist/components/settings-menu.js.map +1 -1
  18. package/dist/contexts/dictation-context.d.ts +6 -6
  19. package/dist/contexts/dictation-context.js +24 -23
  20. package/dist/contexts/dictation-context.js.map +1 -1
  21. package/dist/controllers/keybinding-controller.d.ts +2 -3
  22. package/dist/controllers/keybinding-controller.js +20 -17
  23. package/dist/controllers/keybinding-controller.js.map +1 -1
  24. package/dist/index.d.ts +2 -3
  25. package/dist/index.js +0 -5
  26. package/dist/index.js.map +1 -1
  27. package/dist/styles/keybinding-selector.js +10 -4
  28. package/dist/styles/keybinding-selector.js.map +1 -1
  29. package/dist/styles/settings-menu.js +0 -8
  30. package/dist/styles/settings-menu.js.map +1 -1
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/dist/types.d.ts +1 -2
  33. package/dist/types.js.map +1 -1
  34. package/dist/utils/events.d.ts +4 -6
  35. package/dist/utils/events.js +2 -9
  36. package/dist/utils/events.js.map +1 -1
  37. package/package.json +2 -2
package/dist/types.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export type RecordingState = "initializing" | "recording" | "stopping" | "stopped";
2
- export type DictationMode = "toggle-to-talk" | "push-to-talk";
3
2
  export type Keybinding = string;
4
- export type ConfigurableSettings = "device" | "language" | "mode" | "keybinding";
3
+ export type ConfigurableSettings = "device" | "language" | "keybinding";
5
4
  export type ProxyOptions = {
6
5
  url: string;
7
6
  protocols?: string[];
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type RecordingState =\n | \"initializing\"\n | \"recording\"\n | \"stopping\"\n | \"stopped\";\n\nexport type DictationMode = \"toggle-to-talk\" | \"push-to-talk\";\n\nexport type Keybinding = string;\n\nexport type ConfigurableSettings =\n | \"device\"\n | \"language\"\n | \"mode\"\n | \"keybinding\";\n\nexport type ProxyOptions = {\n url: string;\n protocols?: string[];\n queryParameters?: Record<string, string>;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type RecordingState =\n | \"initializing\"\n | \"recording\"\n | \"stopping\"\n | \"stopped\";\n\nexport type Keybinding = string;\n\nexport type ConfigurableSettings = \"device\" | \"language\" | \"keybinding\";\n\nexport type ProxyOptions = {\n url: string;\n protocols?: string[];\n queryParameters?: Record<string, string>;\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { Corti } from "@corti/sdk";
2
- import type { DictationMode, RecordingState } from "../types.js";
2
+ import type { RecordingState } from "../types.js";
3
3
  export type LanguagesChangedEventDetail = {
4
4
  languages: Corti.TranscribeSupportedLanguage[];
5
5
  selectedLanguage: string | undefined;
@@ -42,16 +42,14 @@ export type NetworkActivityEventDetail = {
42
42
  data: unknown;
43
43
  };
44
44
  export declare function networkActivityEvent(direction: "sent" | "received", data: unknown): CustomEvent<NetworkActivityEventDetail>;
45
- export type ModeChangedEventDetail = {
46
- mode: DictationMode;
47
- };
48
45
  export type KeybindingChangedEventDetail = {
49
46
  key: string | null | undefined;
50
47
  code: string | null | undefined;
48
+ keybinding: string | null;
49
+ type?: "push-to-talk" | "toggle-to-talk";
51
50
  };
52
51
  export type KeybindingActivatedEventDetail = {
53
52
  keyboardEvent: KeyboardEvent;
54
53
  };
55
- export declare function modeChangedEvent(mode: DictationMode): CustomEvent<ModeChangedEventDetail>;
56
- export declare function keybindingChangedEvent(key: string | null | undefined, code: string | null | undefined): CustomEvent<KeybindingChangedEventDetail>;
54
+ export declare function keybindingChangedEvent(key: string | null | undefined, code: string | null | undefined, keybinding: string | null, type?: "push-to-talk" | "toggle-to-talk"): CustomEvent<KeybindingChangedEventDetail>;
57
55
  export declare function keybindingActivatedEvent(keyboardEvent: KeyboardEvent): CustomEvent<KeybindingActivatedEventDetail>;
@@ -85,18 +85,11 @@ export function networkActivityEvent(direction, data) {
85
85
  detail: { data, direction },
86
86
  });
87
87
  }
88
- export function modeChangedEvent(mode) {
89
- return new CustomEvent("mode-changed", {
90
- bubbles: true,
91
- composed: true,
92
- detail: { mode },
93
- });
94
- }
95
- export function keybindingChangedEvent(key, code) {
88
+ export function keybindingChangedEvent(key, code, keybinding, type) {
96
89
  return new CustomEvent("keybinding-changed", {
97
90
  bubbles: true,
98
91
  composed: true,
99
- detail: { code, key },
92
+ detail: { code, key, keybinding, type },
100
93
  });
101
94
  }
102
95
  export function keybindingActivatedEvent(keyboardEvent) {
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAiCA,MAAM,UAAU,qBAAqB,CACnC,SAA8C,EAC9C,gBAAoC;IAEpC,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE;QAC1C,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE;KACxC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAgB;I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;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE;KACtB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,aAA4B;IAE5B,OAAO,IAAI,WAAW,CAAC,sBAAsB,EAAE;QAC7C,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,aAAa,EAAE;KAC1B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport type { DictationMode, RecordingState } from \"../types.js\";\n\nexport type LanguagesChangedEventDetail = {\n languages: Corti.TranscribeSupportedLanguage[];\n selectedLanguage: string | undefined;\n};\n\nexport type LanguageChangedEventDetail = {\n language: string;\n};\n\nexport type RecordingDevicesChangedEventDetail = {\n devices: MediaDeviceInfo[];\n selectedDevice: MediaDeviceInfo | undefined;\n};\n\nexport type RecordingStateChangedEventDetail = {\n state: RecordingState;\n};\n\nexport type AudioLevelChangedEventDetail = {\n audioLevel: number;\n};\n\nexport type TranscriptEventDetail = Corti.TranscribeTranscriptMessage;\nexport type CommandEventDetail = Corti.TranscribeCommandMessage;\nexport type UsageEventDetail = Corti.TranscribeUsageMessage;\n\nexport type ErrorEventDetail = {\n message: string;\n};\n\nexport function languagesChangedEvent(\n languages: Corti.TranscribeSupportedLanguage[],\n selectedLanguage: string | undefined,\n): CustomEvent<LanguagesChangedEventDetail> {\n return new CustomEvent(\"languages-changed\", {\n bubbles: true,\n composed: true,\n detail: { languages, selectedLanguage },\n });\n}\n\n/**\n * @deprecated Use languagesChangedEvent instead. This event is kept for backward compatibility.\n */\nexport function languageChangedEvent(\n language: string,\n): CustomEvent<LanguageChangedEventDetail> {\n return new CustomEvent(\"language-changed\", {\n bubbles: true,\n composed: true,\n detail: { language },\n });\n}\n\nexport function recordingDevicesChangedEvent(\n devices: MediaDeviceInfo[],\n selectedDevice: MediaDeviceInfo | undefined,\n): CustomEvent<RecordingDevicesChangedEventDetail> {\n return new CustomEvent(\"recording-devices-changed\", {\n bubbles: true,\n composed: true,\n detail: { devices, selectedDevice },\n });\n}\n\nexport function recordingStateChangedEvent(\n state: RecordingState,\n): CustomEvent<RecordingStateChangedEventDetail> {\n return new CustomEvent(\"recording-state-changed\", {\n bubbles: true,\n composed: true,\n detail: { state },\n });\n}\n\nexport function transcriptEvent(\n detail: TranscriptEventDetail,\n): CustomEvent<TranscriptEventDetail> {\n return new CustomEvent(\"transcript\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function commandEvent(\n detail: CommandEventDetail,\n): CustomEvent<CommandEventDetail> {\n return new CustomEvent(\"command\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function usageEvent(\n detail: UsageEventDetail,\n): CustomEvent<UsageEventDetail> {\n return new CustomEvent(\"usage\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function errorEvent(error: unknown): CustomEvent<ErrorEventDetail> {\n const message =\n error instanceof Error && error.message ? error.message : String(error);\n\n return new CustomEvent(\"error\", {\n bubbles: false,\n composed: true,\n detail: { message },\n });\n}\n\nexport function streamClosedEvent(detail: unknown): CustomEvent {\n return new CustomEvent(\"stream-closed\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function readyEvent(): CustomEvent {\n return new CustomEvent(\"ready\", {\n bubbles: true,\n composed: true,\n });\n}\n\nexport function audioLevelChangedEvent(\n audioLevel: number,\n): CustomEvent<AudioLevelChangedEventDetail> {\n return new CustomEvent(\"audio-level-changed\", {\n bubbles: true,\n composed: true,\n detail: { audioLevel },\n });\n}\n\nexport type NetworkActivityEventDetail = {\n direction: \"sent\" | \"received\";\n data: unknown;\n};\n\nexport function networkActivityEvent(\n direction: \"sent\" | \"received\",\n data: unknown,\n): CustomEvent<NetworkActivityEventDetail> {\n return new CustomEvent(\"network-activity\", {\n bubbles: true,\n composed: true,\n detail: { data, direction },\n });\n}\n\nexport type ModeChangedEventDetail = {\n mode: DictationMode;\n};\n\nexport type KeybindingChangedEventDetail = {\n key: string | null | undefined;\n code: string | null | undefined;\n};\n\nexport type KeybindingActivatedEventDetail = {\n keyboardEvent: KeyboardEvent;\n};\n\nexport function modeChangedEvent(\n mode: DictationMode,\n): CustomEvent<ModeChangedEventDetail> {\n return new CustomEvent(\"mode-changed\", {\n bubbles: true,\n composed: true,\n detail: { mode },\n });\n}\n\nexport function keybindingChangedEvent(\n key: string | null | undefined,\n code: string | null | undefined,\n): CustomEvent<KeybindingChangedEventDetail> {\n return new CustomEvent(\"keybinding-changed\", {\n bubbles: true,\n composed: true,\n detail: { code, key },\n });\n}\n\nexport function keybindingActivatedEvent(\n keyboardEvent: KeyboardEvent,\n): CustomEvent<KeybindingActivatedEventDetail> {\n return new CustomEvent(\"keybinding-activated\", {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: { keyboardEvent },\n });\n}\n"]}
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAiCA,MAAM,UAAU,qBAAqB,CACnC,SAA8C,EAC9C,gBAAoC;IAEpC,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE;QAC1C,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE;KACxC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAgB;IAEhB,OAAO,IAAI,WAAW,CAAC,kBAAkB,EAAE;QACzC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,QAAQ,EAAE;KACrB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,OAA0B,EAC1B,cAA2C;IAE3C,OAAO,IAAI,WAAW,CAAC,2BAA2B,EAAE;QAClD,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd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AAI;QACd,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE;QAC9B,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,UAAkB;IAElB,OAAO,IAAI,WAAW,CAAC,qBAAqB,EAAE;QAC5C,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,UAAU,EAAE;KACvB,CAAC,CAAC;AACL,CAAC;AAOD,MAAM,UAAU,oBAAoB,CAClC,SAA8B,EAC9B,IAAa;IAEb,OAAO,IAAI,WAAW,CAAC,kBAAkB,EAAE;QACzC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC5B,CAAC,CAAC;AACL,CAAC;AAaD,MAAM,UAAU,sBAAsB,CACpC,GAA8B,EAC9B,IAA+B,EAC/B,UAAyB,EACzB,IAAwC;IAExC,OAAO,IAAI,WAAW,CAAC,oBAAoB,EAAE;QAC3C,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE;KACxC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,aAA4B;IAE5B,OAAO,IAAI,WAAW,CAAC,sBAAsB,EAAE;QAC7C,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,aAAa,EAAE;KAC1B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport type { RecordingState } from \"../types.js\";\n\nexport type LanguagesChangedEventDetail = {\n languages: Corti.TranscribeSupportedLanguage[];\n selectedLanguage: string | undefined;\n};\n\nexport type LanguageChangedEventDetail = {\n language: string;\n};\n\nexport type RecordingDevicesChangedEventDetail = {\n devices: MediaDeviceInfo[];\n selectedDevice: MediaDeviceInfo | undefined;\n};\n\nexport type RecordingStateChangedEventDetail = {\n state: RecordingState;\n};\n\nexport type AudioLevelChangedEventDetail = {\n audioLevel: number;\n};\n\nexport type TranscriptEventDetail = Corti.TranscribeTranscriptMessage;\nexport type CommandEventDetail = Corti.TranscribeCommandMessage;\nexport type UsageEventDetail = Corti.TranscribeUsageMessage;\n\nexport type ErrorEventDetail = {\n message: string;\n};\n\nexport function languagesChangedEvent(\n languages: Corti.TranscribeSupportedLanguage[],\n selectedLanguage: string | undefined,\n): CustomEvent<LanguagesChangedEventDetail> {\n return new CustomEvent(\"languages-changed\", {\n bubbles: true,\n composed: true,\n detail: { languages, selectedLanguage },\n });\n}\n\n/**\n * @deprecated Use languagesChangedEvent instead. This event is kept for backward compatibility.\n */\nexport function languageChangedEvent(\n language: string,\n): CustomEvent<LanguageChangedEventDetail> {\n return new CustomEvent(\"language-changed\", {\n bubbles: true,\n composed: true,\n detail: { language },\n });\n}\n\nexport function recordingDevicesChangedEvent(\n devices: MediaDeviceInfo[],\n selectedDevice: MediaDeviceInfo | undefined,\n): CustomEvent<RecordingDevicesChangedEventDetail> {\n return new CustomEvent(\"recording-devices-changed\", {\n bubbles: true,\n composed: true,\n detail: { devices, selectedDevice },\n });\n}\n\nexport function recordingStateChangedEvent(\n state: RecordingState,\n): CustomEvent<RecordingStateChangedEventDetail> {\n return new CustomEvent(\"recording-state-changed\", {\n bubbles: true,\n composed: true,\n detail: { state },\n });\n}\n\nexport function transcriptEvent(\n detail: TranscriptEventDetail,\n): CustomEvent<TranscriptEventDetail> {\n return new CustomEvent(\"transcript\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function commandEvent(\n detail: CommandEventDetail,\n): CustomEvent<CommandEventDetail> {\n return new CustomEvent(\"command\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function usageEvent(\n detail: UsageEventDetail,\n): CustomEvent<UsageEventDetail> {\n return new CustomEvent(\"usage\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function errorEvent(error: unknown): CustomEvent<ErrorEventDetail> {\n const message =\n error instanceof Error && error.message ? error.message : String(error);\n\n return new CustomEvent(\"error\", {\n bubbles: false,\n composed: true,\n detail: { message },\n });\n}\n\nexport function streamClosedEvent(detail: unknown): CustomEvent {\n return new CustomEvent(\"stream-closed\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function readyEvent(): CustomEvent {\n return new CustomEvent(\"ready\", {\n bubbles: true,\n composed: true,\n });\n}\n\nexport function audioLevelChangedEvent(\n audioLevel: number,\n): CustomEvent<AudioLevelChangedEventDetail> {\n return new CustomEvent(\"audio-level-changed\", {\n bubbles: true,\n composed: true,\n detail: { audioLevel },\n });\n}\n\nexport type NetworkActivityEventDetail = {\n direction: \"sent\" | \"received\";\n data: unknown;\n};\n\nexport function networkActivityEvent(\n direction: \"sent\" | \"received\",\n data: unknown,\n): CustomEvent<NetworkActivityEventDetail> {\n return new CustomEvent(\"network-activity\", {\n bubbles: true,\n composed: true,\n detail: { data, direction },\n });\n}\n\nexport type KeybindingChangedEventDetail = {\n key: string | null | undefined;\n code: string | null | undefined;\n keybinding: string | null;\n type?: \"push-to-talk\" | \"toggle-to-talk\";\n};\n\nexport type KeybindingActivatedEventDetail = {\n keyboardEvent: KeyboardEvent;\n};\n\nexport function keybindingChangedEvent(\n key: string | null | undefined,\n code: string | null | undefined,\n keybinding: string | null,\n type?: \"push-to-talk\" | \"toggle-to-talk\",\n): CustomEvent<KeybindingChangedEventDetail> {\n return new CustomEvent(\"keybinding-changed\", {\n bubbles: true,\n composed: true,\n detail: { code, key, keybinding, type },\n });\n}\n\nexport function keybindingActivatedEvent(\n keyboardEvent: KeyboardEvent,\n): CustomEvent<KeybindingActivatedEventDetail> {\n return new CustomEvent(\"keybinding-activated\", {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: { keyboardEvent },\n });\n}\n"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@corti/dictation-web",
3
3
  "description": "Web component for Corti Dictation",
4
4
  "author": "Corti ApS",
5
- "version": "0.5.0-rc",
5
+ "version": "0.5.0-rc.2",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
@@ -58,7 +58,7 @@
58
58
  "storybook:build": "tsc && tsc -p tsconfig.stories.json && npm run analyze -- --exclude dist && storybook build"
59
59
  },
60
60
  "dependencies": {
61
- "@corti/sdk": "^0.8.0",
61
+ "@corti/sdk": "^0.9.0-rc",
62
62
  "@lit/context": "^1.1.6",
63
63
  "lit": "^3.3.1"
64
64
  },