@corti/dictation-web 0.6.0-rc → 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/README.md +1 -1
- package/dist/bundle.js +6875 -5532
- package/dist/components/corti-dictation.d.ts +3 -3
- package/dist/components/corti-dictation.js.map +1 -1
- package/dist/components/recording-button.d.ts +2 -2
- package/dist/components/recording-button.js +16 -17
- package/dist/components/recording-button.js.map +1 -1
- package/dist/contexts/dictation-context.d.ts +6 -6
- package/dist/contexts/dictation-context.js.map +1 -1
- package/dist/controllers/dictation-controller.d.ts +7 -4
- package/dist/controllers/dictation-controller.js +140 -34
- package/dist/controllers/dictation-controller.js.map +1 -1
- package/dist/controllers/media-controller.d.ts +1 -3
- package/dist/controllers/media-controller.js +4 -22
- package/dist/controllers/media-controller.js.map +1 -1
- package/dist/icons/icons.d.ts +1 -1
- package/dist/icons/icons.js +7 -7
- package/dist/icons/icons.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles/audio-visualiser.js.map +1 -1
- package/dist/styles/callout.js +1 -1
- package/dist/styles/callout.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/auth.d.ts +2 -2
- package/dist/utils/auth.js.map +1 -1
- package/dist/utils/events.d.ts +2 -0
- package/dist/utils/events.js +22 -1
- package/dist/utils/events.js.map +1 -1
- package/package.json +3 -5
- 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/utils/auth.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CortiAuth } from "@corti/sdk";
|
|
2
2
|
/**
|
|
3
3
|
* Extracts the initial access token from auth config
|
|
4
4
|
* @throws Error if token is missing or invalid
|
|
5
5
|
*/
|
|
6
|
-
export declare function getInitialToken(config:
|
|
6
|
+
export declare function getInitialToken(config: CortiAuth.AuthTokenDerivable): Promise<{
|
|
7
7
|
accessToken: string;
|
|
8
8
|
refreshToken?: string;
|
|
9
9
|
}>;
|
package/dist/utils/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAoC;IAEpC,MAAM,YAAY,GAChB,aAAa,IAAI,MAAM;QACrB,CAAC,CAAC;YACE,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC;QACH,CAAC,CAAC,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;IAExC,IACE,CAAC,YAAY,EAAE,WAAW;QAC1B,OAAO,YAAY,CAAC,WAAW,KAAK,QAAQ,EAC5C,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAED,OAAO;QACL,WAAW,EAAE,YAAY,CAAC,WAAW;QACrC,YAAY,EAAE,YAAY,CAAC,YAAY;KACxC,CAAC;AACJ,CAAC","sourcesContent":["import type { CortiAuth } from \"@corti/sdk\";\n\n/**\n * Extracts the initial access token from auth config\n * @throws Error if token is missing or invalid\n */\nexport async function getInitialToken(\n config: CortiAuth.AuthTokenDerivable,\n): Promise<{ accessToken: string; refreshToken?: string }> {\n const initialToken =\n \"accessToken\" in config\n ? {\n accessToken: config.accessToken,\n refreshToken: config.refreshToken,\n }\n : await config.refreshAccessToken();\n\n if (\n !initialToken?.accessToken ||\n typeof initialToken.accessToken !== \"string\"\n ) {\n throw new Error(\"Access token is required and must be a string\");\n }\n\n return {\n accessToken: initialToken.accessToken,\n refreshToken: initialToken.refreshToken,\n };\n}\n"]}
|
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,8 +54,29 @@ 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
|
+
}
|
|
64
|
+
function errorToMessage(error) {
|
|
65
|
+
if (error instanceof Error) {
|
|
66
|
+
return error.message;
|
|
67
|
+
}
|
|
68
|
+
if (typeof error === "object" && error !== null) {
|
|
69
|
+
try {
|
|
70
|
+
return JSON.stringify(error);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return String(error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return String(error);
|
|
77
|
+
}
|
|
57
78
|
export function errorEvent(error) {
|
|
58
|
-
const message =
|
|
79
|
+
const message = errorToMessage(error);
|
|
59
80
|
return new CustomEvent("error", {
|
|
60
81
|
bubbles: false,
|
|
61
82
|
composed: true,
|
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,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AAI;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;\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",
|
|
@@ -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 .",
|
|
@@ -52,13 +51,13 @@
|
|
|
52
51
|
"biome:format": "biome format --write .",
|
|
53
52
|
"biome:fix": "biome check --write .",
|
|
54
53
|
"prepare": "husky && husky install",
|
|
55
|
-
"test": "tsc && wtr --coverage",
|
|
54
|
+
"test": "tsc -p tsconfig.test.json && wtr --coverage",
|
|
56
55
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
|
|
57
56
|
"storybook": "npm run analyze -- --exclude dist && storybook dev -p 8080",
|
|
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": "
|
|
60
|
+
"@corti/sdk": "1.0.0",
|
|
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"]}
|