@corti/dictation-web 0.0.0-test.571.2 → 0.0.0-test.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -39
- package/dist/bundle.js +1120 -535
- package/dist/components/corti-dictation.d.ts +23 -9
- package/dist/components/corti-dictation.js +36 -17
- package/dist/components/corti-dictation.js.map +1 -1
- package/dist/components/keybinding-input.d.ts +16 -0
- package/dist/components/keybinding-input.js +94 -0
- package/dist/components/keybinding-input.js.map +1 -0
- package/dist/components/keybinding-selector.d.ts +3 -3
- package/dist/components/keybinding-selector.js +21 -49
- package/dist/components/keybinding-selector.js.map +1 -1
- package/dist/components/recording-button.d.ts +5 -3
- package/dist/components/recording-button.js +100 -45
- package/dist/components/recording-button.js.map +1 -1
- package/dist/components/settings-menu.d.ts +0 -1
- package/dist/components/settings-menu.js +4 -17
- package/dist/components/settings-menu.js.map +1 -1
- package/dist/contexts/dictation-context.d.ts +6 -6
- package/dist/contexts/dictation-context.js +24 -23
- package/dist/contexts/dictation-context.js.map +1 -1
- package/dist/controllers/dictation-controller.d.ts +8 -2
- package/dist/controllers/dictation-controller.js +151 -45
- package/dist/controllers/dictation-controller.js.map +1 -1
- package/dist/controllers/keybinding-controller.d.ts +2 -3
- package/dist/controllers/keybinding-controller.js +20 -17
- package/dist/controllers/keybinding-controller.js.map +1 -1
- package/dist/controllers/media-controller.d.ts +2 -1
- package/dist/controllers/media-controller.js +14 -3
- package/dist/controllers/media-controller.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +0 -5
- package/dist/index.js.map +1 -1
- package/dist/styles/keybinding-selector.js +10 -4
- package/dist/styles/keybinding-selector.js.map +1 -1
- package/dist/styles/settings-menu.js +0 -8
- package/dist/styles/settings-menu.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/types.js.map +1 -1
- package/dist/utils/events.d.ts +13 -7
- package/dist/utils/events.js +26 -12
- package/dist/utils/events.js.map +1 -1
- package/package.json +2 -4
- package/dist/components/mode-selector.d.ts +0 -14
- package/dist/components/mode-selector.js +0 -73
- package/dist/components/mode-selector.js.map +0 -1
- package/dist/package.json +0 -94
- package/dist/styles/mode-selector.d.ts +0 -2
- package/dist/styles/mode-selector.js +0 -56
- package/dist/styles/mode-selector.js.map +0 -1
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" | "
|
|
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
|
|
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"]}
|
package/dist/utils/events.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Corti } from "@corti/sdk";
|
|
2
|
-
import type {
|
|
2
|
+
import type { RecordingState } from "../types.js";
|
|
3
3
|
export type LanguagesChangedEventDetail = {
|
|
4
4
|
languages: Corti.TranscribeSupportedLanguage[];
|
|
5
5
|
selectedLanguage: string | undefined;
|
|
@@ -13,6 +13,8 @@ export type RecordingDevicesChangedEventDetail = {
|
|
|
13
13
|
};
|
|
14
14
|
export type RecordingStateChangedEventDetail = {
|
|
15
15
|
state: RecordingState;
|
|
16
|
+
connection?: "CONNECTING" | "OPEN" | "CLOSING" | "CLOSED" | null;
|
|
17
|
+
processing?: boolean;
|
|
16
18
|
};
|
|
17
19
|
export type AudioLevelChangedEventDetail = {
|
|
18
20
|
audioLevel: number;
|
|
@@ -29,11 +31,17 @@ export declare function languagesChangedEvent(languages: Corti.TranscribeSupport
|
|
|
29
31
|
*/
|
|
30
32
|
export declare function languageChangedEvent(language: string): CustomEvent<LanguageChangedEventDetail>;
|
|
31
33
|
export declare function recordingDevicesChangedEvent(devices: MediaDeviceInfo[], selectedDevice: MediaDeviceInfo | undefined): CustomEvent<RecordingDevicesChangedEventDetail>;
|
|
32
|
-
export declare function recordingStateChangedEvent(state: RecordingState
|
|
34
|
+
export declare function recordingStateChangedEvent(state: RecordingState, options?: Partial<{
|
|
35
|
+
connection: "CONNECTING" | "OPEN" | "CLOSING" | "CLOSED" | null;
|
|
36
|
+
processing: boolean;
|
|
37
|
+
}>): CustomEvent<RecordingStateChangedEventDetail>;
|
|
33
38
|
export declare function transcriptEvent(detail: TranscriptEventDetail): CustomEvent<TranscriptEventDetail>;
|
|
34
39
|
export declare function commandEvent(detail: CommandEventDetail): CustomEvent<CommandEventDetail>;
|
|
35
40
|
export declare function usageEvent(detail: UsageEventDetail): CustomEvent<UsageEventDetail>;
|
|
36
41
|
export declare function errorEvent(error: unknown): CustomEvent<ErrorEventDetail>;
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use recording-state-changed event with detail.connection field instead.
|
|
44
|
+
*/
|
|
37
45
|
export declare function streamClosedEvent(detail: unknown): CustomEvent;
|
|
38
46
|
export declare function readyEvent(): CustomEvent;
|
|
39
47
|
export declare function audioLevelChangedEvent(audioLevel: number): CustomEvent<AudioLevelChangedEventDetail>;
|
|
@@ -42,16 +50,14 @@ export type NetworkActivityEventDetail = {
|
|
|
42
50
|
data: unknown;
|
|
43
51
|
};
|
|
44
52
|
export declare function networkActivityEvent(direction: "sent" | "received", data: unknown): CustomEvent<NetworkActivityEventDetail>;
|
|
45
|
-
export type ModeChangedEventDetail = {
|
|
46
|
-
mode: DictationMode;
|
|
47
|
-
};
|
|
48
53
|
export type KeybindingChangedEventDetail = {
|
|
49
54
|
key: string | null | undefined;
|
|
50
55
|
code: string | null | undefined;
|
|
56
|
+
keybinding: string | null;
|
|
57
|
+
type?: "push-to-talk" | "toggle-to-talk";
|
|
51
58
|
};
|
|
52
59
|
export type KeybindingActivatedEventDetail = {
|
|
53
60
|
keyboardEvent: KeyboardEvent;
|
|
54
61
|
};
|
|
55
|
-
export declare function
|
|
56
|
-
export declare function keybindingChangedEvent(key: string | null | undefined, code: string | null | undefined): CustomEvent<KeybindingChangedEventDetail>;
|
|
62
|
+
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
63
|
export declare function keybindingActivatedEvent(keyboardEvent: KeyboardEvent): CustomEvent<KeybindingActivatedEventDetail>;
|
package/dist/utils/events.js
CHANGED
|
@@ -22,11 +22,15 @@ export function recordingDevicesChangedEvent(devices, selectedDevice) {
|
|
|
22
22
|
detail: { devices, selectedDevice },
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
export function recordingStateChangedEvent(state) {
|
|
25
|
+
export function recordingStateChangedEvent(state, options = {}) {
|
|
26
26
|
return new CustomEvent("recording-state-changed", {
|
|
27
27
|
bubbles: true,
|
|
28
28
|
composed: true,
|
|
29
|
-
detail: {
|
|
29
|
+
detail: {
|
|
30
|
+
connection: options.connection,
|
|
31
|
+
processing: options.processing,
|
|
32
|
+
state,
|
|
33
|
+
},
|
|
30
34
|
});
|
|
31
35
|
}
|
|
32
36
|
export function transcriptEvent(detail) {
|
|
@@ -50,14 +54,31 @@ export function usageEvent(detail) {
|
|
|
50
54
|
detail,
|
|
51
55
|
});
|
|
52
56
|
}
|
|
57
|
+
function errorToMessage(error) {
|
|
58
|
+
if (error instanceof Error) {
|
|
59
|
+
return error.message;
|
|
60
|
+
}
|
|
61
|
+
if (typeof error === "object" && error !== null) {
|
|
62
|
+
try {
|
|
63
|
+
return JSON.stringify(error);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return String(error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return String(error);
|
|
70
|
+
}
|
|
53
71
|
export function errorEvent(error) {
|
|
54
|
-
const message =
|
|
72
|
+
const message = errorToMessage(error);
|
|
55
73
|
return new CustomEvent("error", {
|
|
56
74
|
bubbles: false,
|
|
57
75
|
composed: true,
|
|
58
76
|
detail: { message },
|
|
59
77
|
});
|
|
60
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated Use recording-state-changed event with detail.connection field instead.
|
|
81
|
+
*/
|
|
61
82
|
export function streamClosedEvent(detail) {
|
|
62
83
|
return new CustomEvent("stream-closed", {
|
|
63
84
|
bubbles: true,
|
|
@@ -85,18 +106,11 @@ export function networkActivityEvent(direction, data) {
|
|
|
85
106
|
detail: { data, direction },
|
|
86
107
|
});
|
|
87
108
|
}
|
|
88
|
-
export function
|
|
89
|
-
return new CustomEvent("mode-changed", {
|
|
90
|
-
bubbles: true,
|
|
91
|
-
composed: true,
|
|
92
|
-
detail: { mode },
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
export function keybindingChangedEvent(key, code) {
|
|
109
|
+
export function keybindingChangedEvent(key, code, keybinding, type) {
|
|
96
110
|
return new CustomEvent("keybinding-changed", {
|
|
97
111
|
bubbles: true,
|
|
98
112
|
composed: true,
|
|
99
|
-
detail: { code, key },
|
|
113
|
+
detail: { code, key, keybinding, type },
|
|
100
114
|
});
|
|
101
115
|
}
|
|
102
116
|
export function keybindingActivatedEvent(keyboardEvent) {
|
package/dist/utils/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAmCA,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,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;KACpC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAqB,EACrB,UAGK,EAAE;IAEP,OAAO,IAAI,WAAW,CAAC,yBAAyB,EAAE;QAChD,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,KAAK;SACN;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,MAA6B;IAE7B,OAAO,IAAI,WAAW,CAAC,YAAY,EAAE;QACnC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,MAA0B;IAE1B,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE;QAChC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,MAAwB;IAExB,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE;QAC9B,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAEtC,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE;QAC9B,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,OAAO,EAAE;KACpB,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC/C,OAAO,IAAI,WAAW,CAAC,eAAe,EAAE;QACtC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;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 connection?: \"CONNECTING\" | \"OPEN\" | \"CLOSING\" | \"CLOSED\" | null;\n processing?: boolean;\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 options: Partial<{\n connection: \"CONNECTING\" | \"OPEN\" | \"CLOSING\" | \"CLOSED\" | null;\n processing: boolean;\n }> = {},\n): CustomEvent<RecordingStateChangedEventDetail> {\n return new CustomEvent(\"recording-state-changed\", {\n bubbles: true,\n composed: true,\n detail: {\n connection: options.connection,\n processing: options.processing,\n state,\n },\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\nfunction errorToMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n\n if (typeof error === \"object\" && error !== null) {\n try {\n return JSON.stringify(error);\n } catch {\n return String(error);\n }\n }\n\n return String(error);\n}\n\nexport function errorEvent(error: unknown): CustomEvent<ErrorEventDetail> {\n const message = errorToMessage(error);\n\n return new CustomEvent(\"error\", {\n bubbles: false,\n composed: true,\n detail: { message },\n });\n}\n\n/**\n * @deprecated Use recording-state-changed event with detail.connection field instead.\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.0.0-test.
|
|
5
|
+
"version": "0.0.0-test.7",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"build": "tsc && npm run analyze -- --exclude dist",
|
|
45
45
|
"build:bundle": "esbuild dist/index.js --bundle --outfile=dist/bundle.js --format=esm --platform=browser",
|
|
46
46
|
"release": "npm run build && npm run build:bundle && npm publish --access public",
|
|
47
|
-
"start": "npm run build && npm run build:bundle && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"web-dev-server\"",
|
|
48
47
|
"prepublish": "tsc && npm run analyze -- --exclude dist",
|
|
49
48
|
"lint": "biome check .",
|
|
50
49
|
"format": "biome format --write .",
|
|
@@ -58,7 +57,7 @@
|
|
|
58
57
|
"storybook:build": "tsc && tsc -p tsconfig.stories.json && npm run analyze -- --exclude dist && storybook build"
|
|
59
58
|
},
|
|
60
59
|
"dependencies": {
|
|
61
|
-
"@corti/sdk": "^0.
|
|
60
|
+
"@corti/sdk": "^0.10.1",
|
|
62
61
|
"@lit/context": "^1.1.6",
|
|
63
62
|
"lit": "^3.3.1"
|
|
64
63
|
},
|
|
@@ -72,7 +71,6 @@
|
|
|
72
71
|
"@storybook/web-components": "10.1.5",
|
|
73
72
|
"@storybook/web-components-vite": "^10.1.5",
|
|
74
73
|
"@types/mocha": "^10.0.7",
|
|
75
|
-
"@web/dev-server": "^0.4.6",
|
|
76
74
|
"@web/storybook-builder": "^0.1.16",
|
|
77
75
|
"@web/storybook-framework-web-components": "^0.1.2",
|
|
78
76
|
"@web/test-runner": "^0.18.2",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
2
|
-
import type { DictationMode } from "../types.js";
|
|
3
|
-
export declare class DictationModeSelector extends LitElement {
|
|
4
|
-
#private;
|
|
5
|
-
_mode: DictationMode;
|
|
6
|
-
disabled: boolean;
|
|
7
|
-
static styles: import("lit").CSSResult[];
|
|
8
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
-
}
|
|
10
|
-
declare global {
|
|
11
|
-
interface HTMLElementTagNameMap {
|
|
12
|
-
"dictation-mode-selector": DictationModeSelector;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _DictationModeSelector_instances, _DictationModeSelector_handleModeChange;
|
|
13
|
-
import { consume } from "@lit/context";
|
|
14
|
-
import { html, LitElement } from "lit";
|
|
15
|
-
import { customElement, property, state } from "lit/decorators.js";
|
|
16
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
17
|
-
import { modeContext } from "../contexts/dictation-context.js";
|
|
18
|
-
import ModeSelectorStyles from "../styles/mode-selector.js";
|
|
19
|
-
import { modeChangedEvent } from "../utils/events.js";
|
|
20
|
-
let DictationModeSelector = class DictationModeSelector extends LitElement {
|
|
21
|
-
constructor() {
|
|
22
|
-
super(...arguments);
|
|
23
|
-
_DictationModeSelector_instances.add(this);
|
|
24
|
-
this._mode = "toggle-to-talk";
|
|
25
|
-
this.disabled = false;
|
|
26
|
-
}
|
|
27
|
-
render() {
|
|
28
|
-
return html `
|
|
29
|
-
<div>
|
|
30
|
-
<label>Dictation Mode</label>
|
|
31
|
-
<div class="mode-selector-tabs">
|
|
32
|
-
<button
|
|
33
|
-
class=${classMap({
|
|
34
|
-
active: this._mode === "toggle-to-talk",
|
|
35
|
-
"mode-selector-tab": true,
|
|
36
|
-
})}
|
|
37
|
-
@click=${() => __classPrivateFieldGet(this, _DictationModeSelector_instances, "m", _DictationModeSelector_handleModeChange).call(this, "toggle-to-talk")}
|
|
38
|
-
?disabled=${this.disabled}
|
|
39
|
-
>
|
|
40
|
-
Toggle-to-Talk
|
|
41
|
-
</button>
|
|
42
|
-
<button
|
|
43
|
-
class=${classMap({
|
|
44
|
-
active: this._mode === "push-to-talk",
|
|
45
|
-
"mode-selector-tab": true,
|
|
46
|
-
})}
|
|
47
|
-
@click=${() => __classPrivateFieldGet(this, _DictationModeSelector_instances, "m", _DictationModeSelector_handleModeChange).call(this, "push-to-talk")}
|
|
48
|
-
?disabled=${this.disabled}
|
|
49
|
-
>
|
|
50
|
-
Push-to-Talk
|
|
51
|
-
</button>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
`;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
_DictationModeSelector_instances = new WeakSet();
|
|
58
|
-
_DictationModeSelector_handleModeChange = function _DictationModeSelector_handleModeChange(mode) {
|
|
59
|
-
this.dispatchEvent(modeChangedEvent(mode));
|
|
60
|
-
};
|
|
61
|
-
DictationModeSelector.styles = ModeSelectorStyles;
|
|
62
|
-
__decorate([
|
|
63
|
-
consume({ context: modeContext, subscribe: true }),
|
|
64
|
-
state()
|
|
65
|
-
], DictationModeSelector.prototype, "_mode", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
property({ type: Boolean })
|
|
68
|
-
], DictationModeSelector.prototype, "disabled", void 0);
|
|
69
|
-
DictationModeSelector = __decorate([
|
|
70
|
-
customElement("dictation-mode-selector")
|
|
71
|
-
], DictationModeSelector);
|
|
72
|
-
export { DictationModeSelector };
|
|
73
|
-
//# sourceMappingURL=mode-selector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mode-selector.js","sourceRoot":"","sources":["../../src/components/mode-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG/C,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAA9C;;;QAGL,UAAK,GAAkB,gBAAgB,CAAC;QAGxC,aAAQ,GAAY,KAAK,CAAC;IAqC5B,CAAC;IA7BC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;oBAKK,QAAQ,CAAC;YACf,MAAM,EAAE,IAAI,CAAC,KAAK,KAAK,gBAAgB;YACvC,mBAAmB,EAAE,IAAI;SAC1B,CAAC;qBACO,GAAG,EAAE,CAAC,uBAAA,IAAI,iFAAkB,MAAtB,IAAI,EAAmB,gBAAgB,CAAC;wBAC3C,IAAI,CAAC,QAAQ;;;;;oBAKjB,QAAQ,CAAC;YACf,MAAM,EAAE,IAAI,CAAC,KAAK,KAAK,cAAc;YACrC,mBAAmB,EAAE,IAAI;SAC1B,CAAC;qBACO,GAAG,EAAE,CAAC,uBAAA,IAAI,iFAAkB,MAAtB,IAAI,EAAmB,cAAc,CAAC;wBACzC,IAAI,CAAC,QAAQ;;;;;;KAMhC,CAAC;IACJ,CAAC;;;2FAhCiB,IAAmB;IACnC,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7C,CAAC;AAJM,4BAAM,GAAG,kBAAkB,AAArB,CAAsB;AALnC;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClD,KAAK,EAAE;oDACgC;AAGxC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDACF;AANf,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CA2CjC","sourcesContent":["import { consume } from \"@lit/context\";\nimport { html, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { modeContext } from \"../contexts/dictation-context.js\";\nimport ModeSelectorStyles from \"../styles/mode-selector.js\";\nimport type { DictationMode } from \"../types.js\";\nimport { modeChangedEvent } from \"../utils/events.js\";\n\n@customElement(\"dictation-mode-selector\")\nexport class DictationModeSelector extends LitElement {\n @consume({ context: modeContext, subscribe: true })\n @state()\n _mode: DictationMode = \"toggle-to-talk\";\n\n @property({ type: Boolean })\n disabled: boolean = false;\n\n static styles = ModeSelectorStyles;\n\n #handleModeChange(mode: DictationMode): void {\n this.dispatchEvent(modeChangedEvent(mode));\n }\n\n render() {\n return html`\n <div>\n <label>Dictation Mode</label>\n <div class=\"mode-selector-tabs\">\n <button\n class=${classMap({\n active: this._mode === \"toggle-to-talk\",\n \"mode-selector-tab\": true,\n })}\n @click=${() => this.#handleModeChange(\"toggle-to-talk\")}\n ?disabled=${this.disabled}\n >\n Toggle-to-Talk\n </button>\n <button\n class=${classMap({\n active: this._mode === \"push-to-talk\",\n \"mode-selector-tab\": true,\n })}\n @click=${() => this.#handleModeChange(\"push-to-talk\")}\n ?disabled=${this.disabled}\n >\n Push-to-Talk\n </button>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dictation-mode-selector\": DictationModeSelector;\n }\n}\n"]}
|
package/dist/package.json
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@corti/dictation-web",
|
|
3
|
-
"description": "Web component for Corti Dictation",
|
|
4
|
-
"author": "Corti ApS",
|
|
5
|
-
"version": "0.0.0-test.571.1",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"main": "dist/index.js",
|
|
9
|
-
"module": "dist/index.js",
|
|
10
|
-
"types": "dist/index.d.ts",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/index.js",
|
|
15
|
-
"browser": "./dist/bundle.js",
|
|
16
|
-
"default": "./dist/bundle.js"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"jsdelivr": "./dist/bundle.js",
|
|
20
|
-
"browser": "./dist/bundle.js",
|
|
21
|
-
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
],
|
|
24
|
-
"bugs": {
|
|
25
|
-
"url": "https://docs.corti.ai",
|
|
26
|
-
"email": "help@corti.ai"
|
|
27
|
-
},
|
|
28
|
-
"repository": "github:corticph/dictation-web",
|
|
29
|
-
"homepage": "https://docs.corti.ai/stt/dictation-web",
|
|
30
|
-
"keywords": [
|
|
31
|
-
"corti",
|
|
32
|
-
"dictation",
|
|
33
|
-
"web",
|
|
34
|
-
"sdk",
|
|
35
|
-
"speech",
|
|
36
|
-
"recognition",
|
|
37
|
-
"transcription",
|
|
38
|
-
"audio",
|
|
39
|
-
"medical",
|
|
40
|
-
"healthcare"
|
|
41
|
-
],
|
|
42
|
-
"scripts": {
|
|
43
|
-
"analyze": "cem analyze --litelement",
|
|
44
|
-
"build": "tsc && npm run analyze -- --exclude dist",
|
|
45
|
-
"build:bundle": "esbuild dist/index.js --bundle --outfile=dist/bundle.js --format=esm --platform=browser",
|
|
46
|
-
"release": "npm run build && npm run build:bundle && npm publish --access public",
|
|
47
|
-
"start": "npm run build && npm run build:bundle && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"web-dev-server\"",
|
|
48
|
-
"prepublish": "tsc && npm run analyze -- --exclude dist",
|
|
49
|
-
"lint": "biome check .",
|
|
50
|
-
"format": "biome format --write .",
|
|
51
|
-
"biome:check": "biome check .",
|
|
52
|
-
"biome:format": "biome format --write .",
|
|
53
|
-
"biome:fix": "biome check --write .",
|
|
54
|
-
"prepare": "husky && husky install",
|
|
55
|
-
"test": "tsc && wtr --coverage",
|
|
56
|
-
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
|
|
57
|
-
"storybook": "npm run analyze -- --exclude dist && storybook dev -p 8080",
|
|
58
|
-
"storybook:build": "tsc && tsc -p tsconfig.stories.json && npm run analyze -- --exclude dist && storybook build"
|
|
59
|
-
},
|
|
60
|
-
"dependencies": {
|
|
61
|
-
"@corti/sdk": "^0.8.0",
|
|
62
|
-
"@lit/context": "^1.1.6",
|
|
63
|
-
"lit": "^3.3.1"
|
|
64
|
-
},
|
|
65
|
-
"devDependencies": {
|
|
66
|
-
"@biomejs/biome": "^2.3.6",
|
|
67
|
-
"@custom-elements-manifest/analyzer": "^0.10.3",
|
|
68
|
-
"@open-wc/testing": "^4.0.0",
|
|
69
|
-
"@storybook/addon-a11y": "10.1.5",
|
|
70
|
-
"@storybook/addon-docs": "^10.1.5",
|
|
71
|
-
"@storybook/addon-links": "10.1.5",
|
|
72
|
-
"@storybook/web-components": "10.1.5",
|
|
73
|
-
"@storybook/web-components-vite": "^10.1.5",
|
|
74
|
-
"@types/mocha": "^10.0.7",
|
|
75
|
-
"@web/dev-server": "^0.4.6",
|
|
76
|
-
"@web/storybook-builder": "^0.1.16",
|
|
77
|
-
"@web/storybook-framework-web-components": "^0.1.2",
|
|
78
|
-
"@web/test-runner": "^0.18.2",
|
|
79
|
-
"concurrently": "^8.2.2",
|
|
80
|
-
"esbuild": "^0.25.0",
|
|
81
|
-
"husky": "^8.0.0",
|
|
82
|
-
"lint-staged": "^15.2.7",
|
|
83
|
-
"sinon": "^19.0.2",
|
|
84
|
-
"storybook": "10.1.5",
|
|
85
|
-
"tslib": "^2.6.3",
|
|
86
|
-
"typescript": "^5.5.3"
|
|
87
|
-
},
|
|
88
|
-
"customElements": "custom-elements.json",
|
|
89
|
-
"lint-staged": {
|
|
90
|
-
"*.ts": [
|
|
91
|
-
"biome check --write"
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
import { LabelStyles } from "./component-styles.js";
|
|
3
|
-
const ModeSelectorStyles = [
|
|
4
|
-
LabelStyles,
|
|
5
|
-
css `
|
|
6
|
-
:host {
|
|
7
|
-
display: block;
|
|
8
|
-
}
|
|
9
|
-
.mode-selector-tabs {
|
|
10
|
-
display: flex;
|
|
11
|
-
background: var(--muted-background, light-dark(#fafafa, #2a2a2a));
|
|
12
|
-
border: 1px solid var(--card-border-color, light-dark(#ddd, #555));
|
|
13
|
-
border-radius: var(--card-inner-border-radius, 6px);
|
|
14
|
-
padding: 0;
|
|
15
|
-
overflow: hidden;
|
|
16
|
-
align-items: center;
|
|
17
|
-
justify-content: center;
|
|
18
|
-
text-wrap: nowrap;
|
|
19
|
-
gap: 2px;
|
|
20
|
-
}
|
|
21
|
-
.mode-selector-tab {
|
|
22
|
-
flex: 1;
|
|
23
|
-
padding: 4px 8px;
|
|
24
|
-
border: 1px solid transparent;
|
|
25
|
-
background: transparent;
|
|
26
|
-
font-size: 14px;
|
|
27
|
-
font-weight: 500;
|
|
28
|
-
line-height: 24px;
|
|
29
|
-
color: var(--component-text-color, light-dark(#333, #eee));
|
|
30
|
-
opacity: 0.6;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
transition: all 0.2s;
|
|
33
|
-
height: 32px;
|
|
34
|
-
display: flex;
|
|
35
|
-
align-items: center;
|
|
36
|
-
justify-content: center;
|
|
37
|
-
border-radius: var(--card-inner-border-radius, 6px);
|
|
38
|
-
margin: -1px;
|
|
39
|
-
}
|
|
40
|
-
.mode-selector-tab:hover:not(:disabled) {
|
|
41
|
-
opacity: 1;
|
|
42
|
-
}
|
|
43
|
-
.mode-selector-tab.active {
|
|
44
|
-
background: var(--card-background, light-dark(#fff, #333));
|
|
45
|
-
border-color: var(--card-border-color, light-dark(#ddd, #555));
|
|
46
|
-
box-shadow: var(--card-box-shadow, 0 2px 5px rgba(0, 0, 0, 0.1));
|
|
47
|
-
opacity: 1;
|
|
48
|
-
}
|
|
49
|
-
.mode-selector-tab:disabled {
|
|
50
|
-
opacity: 0.5;
|
|
51
|
-
cursor: not-allowed;
|
|
52
|
-
}
|
|
53
|
-
`,
|
|
54
|
-
];
|
|
55
|
-
export default ModeSelectorStyles;
|
|
56
|
-
//# sourceMappingURL=mode-selector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mode-selector.js","sourceRoot":"","sources":["../../src/styles/mode-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,kBAAkB,GAAG;IACzB,WAAW;IACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDJ;CACA,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { css } from \"lit\";\nimport { LabelStyles } from \"./component-styles.js\";\n\nconst ModeSelectorStyles = [\n LabelStyles,\n css`\n :host {\n display: block;\n }\n .mode-selector-tabs {\n display: flex;\n background: var(--muted-background, light-dark(#fafafa, #2a2a2a));\n border: 1px solid var(--card-border-color, light-dark(#ddd, #555));\n border-radius: var(--card-inner-border-radius, 6px);\n padding: 0;\n overflow: hidden;\n align-items: center;\n justify-content: center;\n text-wrap: nowrap;\n gap: 2px;\n }\n .mode-selector-tab {\n flex: 1;\n padding: 4px 8px;\n border: 1px solid transparent;\n background: transparent;\n font-size: 14px;\n font-weight: 500;\n line-height: 24px;\n color: var(--component-text-color, light-dark(#333, #eee));\n opacity: 0.6;\n cursor: pointer;\n transition: all 0.2s;\n height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--card-inner-border-radius, 6px);\n margin: -1px;\n }\n .mode-selector-tab:hover:not(:disabled) {\n opacity: 1;\n }\n .mode-selector-tab.active {\n background: var(--card-background, light-dark(#fff, #333));\n border-color: var(--card-border-color, light-dark(#ddd, #555));\n box-shadow: var(--card-box-shadow, 0 2px 5px rgba(0, 0, 0, 0.1));\n opacity: 1;\n }\n .mode-selector-tab:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n`,\n];\n\nexport default ModeSelectorStyles;\n"]}
|