@corti/dictation-web 0.6.0-rc.1 → 0.6.0
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/dist/bundle.js +137 -33
- package/dist/components/recording-button.js +4 -1
- package/dist/components/recording-button.js.map +1 -1
- package/dist/controllers/dictation-controller.d.ts +1 -1
- package/dist/controllers/dictation-controller.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/events.d.ts +2 -0
- package/dist/utils/events.js +7 -0
- package/dist/utils/events.js.map +1 -1
- package/package.json +2 -2
package/dist/utils/events.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type AudioLevelChangedEventDetail = {
|
|
|
22
22
|
export type TranscriptEventDetail = Corti.TranscribeTranscriptMessage;
|
|
23
23
|
export type CommandEventDetail = Corti.TranscribeCommandMessage;
|
|
24
24
|
export type UsageEventDetail = Corti.TranscribeUsageMessage;
|
|
25
|
+
export type DeltaUsageEventDetail = Corti.TranscribeDeltaUsageMessage;
|
|
25
26
|
export type ErrorEventDetail = {
|
|
26
27
|
message: string;
|
|
27
28
|
};
|
|
@@ -38,6 +39,7 @@ export declare function recordingStateChangedEvent(state: RecordingState, option
|
|
|
38
39
|
export declare function transcriptEvent(detail: TranscriptEventDetail): CustomEvent<TranscriptEventDetail>;
|
|
39
40
|
export declare function commandEvent(detail: CommandEventDetail): CustomEvent<CommandEventDetail>;
|
|
40
41
|
export declare function usageEvent(detail: UsageEventDetail): CustomEvent<UsageEventDetail>;
|
|
42
|
+
export declare function deltaUsageEvent(detail: DeltaUsageEventDetail): CustomEvent<DeltaUsageEventDetail>;
|
|
41
43
|
export declare function errorEvent(error: unknown): CustomEvent<ErrorEventDetail>;
|
|
42
44
|
/**
|
|
43
45
|
* @deprecated Use recording-state-changed event with detail.connection field instead.
|
package/dist/utils/events.js
CHANGED
|
@@ -54,6 +54,13 @@ export function usageEvent(detail) {
|
|
|
54
54
|
detail,
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
+
export function deltaUsageEvent(detail) {
|
|
58
|
+
return new CustomEvent("delta-usage", {
|
|
59
|
+
bubbles: true,
|
|
60
|
+
composed: true,
|
|
61
|
+
detail,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
57
64
|
function errorToMessage(error) {
|
|
58
65
|
if (error instanceof Error) {
|
|
59
66
|
return error.message;
|
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":"AAoCA,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,EA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AG,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;\nexport type DeltaUsageEventDetail = Corti.TranscribeDeltaUsageMessage;\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\nexport function deltaUsageEvent(\n detail: DeltaUsageEventDetail,\n): CustomEvent<DeltaUsageEventDetail> {\n return new CustomEvent(\"delta-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.6.0
|
|
5
|
+
"version": "0.6.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"storybook:build": "tsc && tsc -p tsconfig.stories.json && npm run analyze -- --exclude dist && storybook build"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@corti/sdk": "
|
|
60
|
+
"@corti/sdk": "1.0.0",
|
|
61
61
|
"@lit/context": "^1.1.6",
|
|
62
62
|
"lit": "^3.3.1"
|
|
63
63
|
},
|