@speechos/client 0.2.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/form-detector.d.cts +25 -0
- package/dist/form-detector.d.ts +25 -0
- package/dist/index.cjs +335 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.iife.js +30529 -0
- package/dist/index.iife.js.map +1 -0
- package/dist/index.iife.min.js +1243 -0
- package/dist/index.iife.min.js.map +1 -0
- package/dist/index.js +259 -0
- package/dist/index.js.map +1 -0
- package/dist/speechos.d.cts +74 -0
- package/dist/speechos.d.ts +74 -0
- package/dist/ui/action-bubbles.d.cts +17 -0
- package/dist/ui/action-bubbles.d.ts +17 -0
- package/dist/ui/icons.d.cts +88 -0
- package/dist/ui/icons.d.ts +88 -0
- package/dist/ui/index.d.cts +20 -0
- package/dist/ui/index.d.ts +20 -0
- package/dist/ui/mic-button.d.cts +34 -0
- package/dist/ui/mic-button.d.ts +34 -0
- package/dist/ui/settings-button.d.cts +16 -0
- package/dist/ui/settings-button.d.ts +16 -0
- package/dist/ui/settings-modal.d.cts +34 -0
- package/dist/ui/settings-modal.d.ts +34 -0
- package/dist/ui/styles/theme.d.cts +17 -0
- package/dist/ui/styles/theme.d.ts +17 -0
- package/dist/ui/widget.d.cts +64 -0
- package/dist/ui/widget.d.ts +64 -0
- package/package.json +70 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI module exports
|
|
3
|
+
* Lit-based Shadow DOM components
|
|
4
|
+
*/
|
|
5
|
+
import "./widget.js";
|
|
6
|
+
import "./mic-button.js";
|
|
7
|
+
import "./action-bubbles.js";
|
|
8
|
+
import "./settings-button.js";
|
|
9
|
+
import "./settings-modal.js";
|
|
10
|
+
export { SpeechOSWidget } from "./widget.js";
|
|
11
|
+
export { SpeechOSMicButton } from "./mic-button.js";
|
|
12
|
+
export { SpeechOSActionBubbles } from "./action-bubbles.js";
|
|
13
|
+
export { SpeechOSSettingsButton } from "./settings-button.js";
|
|
14
|
+
export { SpeechOSSettingsModal } from "./settings-modal.js";
|
|
15
|
+
/**
|
|
16
|
+
* Register all custom elements
|
|
17
|
+
* This is automatically called when importing this module,
|
|
18
|
+
* but can be called explicitly if needed
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerComponents(): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Microphone button component
|
|
3
|
+
* A circular button that toggles the action bubbles and handles recording states
|
|
4
|
+
*/
|
|
5
|
+
import { LitElement, type CSSResultGroup, type TemplateResult } from "lit";
|
|
6
|
+
import type { RecordingState, SpeechOSAction } from "@speechos/core";
|
|
7
|
+
export declare class SpeechOSMicButton extends LitElement {
|
|
8
|
+
static styles: CSSResultGroup;
|
|
9
|
+
expanded: boolean;
|
|
10
|
+
recordingState: RecordingState;
|
|
11
|
+
activeAction: SpeechOSAction | null;
|
|
12
|
+
editPreviewText: string;
|
|
13
|
+
errorMessage: string | null;
|
|
14
|
+
private handleClick;
|
|
15
|
+
private handleCancel;
|
|
16
|
+
private stopEvent;
|
|
17
|
+
private handleClose;
|
|
18
|
+
private handleRetry;
|
|
19
|
+
private getButtonClass;
|
|
20
|
+
private renderIcon;
|
|
21
|
+
private getAriaLabel;
|
|
22
|
+
/**
|
|
23
|
+
* Truncate and format preview text for display
|
|
24
|
+
*/
|
|
25
|
+
private formatPreviewText;
|
|
26
|
+
private getStatusLabel;
|
|
27
|
+
private getStatusClass;
|
|
28
|
+
render(): TemplateResult;
|
|
29
|
+
}
|
|
30
|
+
declare global {
|
|
31
|
+
interface HTMLElementTagNameMap {
|
|
32
|
+
"speechos-mic-button": SpeechOSMicButton;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Microphone button component
|
|
3
|
+
* A circular button that toggles the action bubbles and handles recording states
|
|
4
|
+
*/
|
|
5
|
+
import { LitElement, type CSSResultGroup, type TemplateResult } from "lit";
|
|
6
|
+
import type { RecordingState, SpeechOSAction } from "@speechos/core";
|
|
7
|
+
export declare class SpeechOSMicButton extends LitElement {
|
|
8
|
+
static styles: CSSResultGroup;
|
|
9
|
+
expanded: boolean;
|
|
10
|
+
recordingState: RecordingState;
|
|
11
|
+
activeAction: SpeechOSAction | null;
|
|
12
|
+
editPreviewText: string;
|
|
13
|
+
errorMessage: string | null;
|
|
14
|
+
private handleClick;
|
|
15
|
+
private handleCancel;
|
|
16
|
+
private stopEvent;
|
|
17
|
+
private handleClose;
|
|
18
|
+
private handleRetry;
|
|
19
|
+
private getButtonClass;
|
|
20
|
+
private renderIcon;
|
|
21
|
+
private getAriaLabel;
|
|
22
|
+
/**
|
|
23
|
+
* Truncate and format preview text for display
|
|
24
|
+
*/
|
|
25
|
+
private formatPreviewText;
|
|
26
|
+
private getStatusLabel;
|
|
27
|
+
private getStatusClass;
|
|
28
|
+
render(): TemplateResult;
|
|
29
|
+
}
|
|
30
|
+
declare global {
|
|
31
|
+
interface HTMLElementTagNameMap {
|
|
32
|
+
"speechos-mic-button": SpeechOSMicButton;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings button component
|
|
3
|
+
* A small gear icon button that opens the settings modal
|
|
4
|
+
*/
|
|
5
|
+
import { LitElement, type CSSResultGroup } from "lit";
|
|
6
|
+
export declare class SpeechOSSettingsButton extends LitElement {
|
|
7
|
+
static styles: CSSResultGroup;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
private handleClick;
|
|
10
|
+
render(): import("lit").TemplateResult;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
"speechos-settings-button": SpeechOSSettingsButton;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings button component
|
|
3
|
+
* A small gear icon button that opens the settings modal
|
|
4
|
+
*/
|
|
5
|
+
import { LitElement, type CSSResultGroup } from "lit";
|
|
6
|
+
export declare class SpeechOSSettingsButton extends LitElement {
|
|
7
|
+
static styles: CSSResultGroup;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
private handleClick;
|
|
10
|
+
render(): import("lit").TemplateResult;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
"speechos-settings-button": SpeechOSSettingsButton;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings modal component
|
|
3
|
+
* Displays transcript history, help, about, and settings in a tabbed interface
|
|
4
|
+
*/
|
|
5
|
+
import { LitElement, type CSSResultGroup } from "lit";
|
|
6
|
+
export declare class SpeechOSSettingsModal extends LitElement {
|
|
7
|
+
static styles: CSSResultGroup;
|
|
8
|
+
open: boolean;
|
|
9
|
+
private activeTab;
|
|
10
|
+
private transcripts;
|
|
11
|
+
private tabs;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
14
|
+
private loadTranscripts;
|
|
15
|
+
private handleOverlayClick;
|
|
16
|
+
private handleClose;
|
|
17
|
+
private close;
|
|
18
|
+
private handleTabClick;
|
|
19
|
+
private handleDeleteTranscript;
|
|
20
|
+
private handleClearAll;
|
|
21
|
+
private handleCopyTranscript;
|
|
22
|
+
private formatTime;
|
|
23
|
+
private renderTranscriptsTab;
|
|
24
|
+
private renderHelpTab;
|
|
25
|
+
private renderAboutTab;
|
|
26
|
+
private renderSettingsTab;
|
|
27
|
+
private renderTabContent;
|
|
28
|
+
render(): import("lit").TemplateResult;
|
|
29
|
+
}
|
|
30
|
+
declare global {
|
|
31
|
+
interface HTMLElementTagNameMap {
|
|
32
|
+
"speechos-settings-modal": SpeechOSSettingsModal;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings modal component
|
|
3
|
+
* Displays transcript history, help, about, and settings in a tabbed interface
|
|
4
|
+
*/
|
|
5
|
+
import { LitElement, type CSSResultGroup } from "lit";
|
|
6
|
+
export declare class SpeechOSSettingsModal extends LitElement {
|
|
7
|
+
static styles: CSSResultGroup;
|
|
8
|
+
open: boolean;
|
|
9
|
+
private activeTab;
|
|
10
|
+
private transcripts;
|
|
11
|
+
private tabs;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
14
|
+
private loadTranscripts;
|
|
15
|
+
private handleOverlayClick;
|
|
16
|
+
private handleClose;
|
|
17
|
+
private close;
|
|
18
|
+
private handleTabClick;
|
|
19
|
+
private handleDeleteTranscript;
|
|
20
|
+
private handleClearAll;
|
|
21
|
+
private handleCopyTranscript;
|
|
22
|
+
private formatTime;
|
|
23
|
+
private renderTranscriptsTab;
|
|
24
|
+
private renderHelpTab;
|
|
25
|
+
private renderAboutTab;
|
|
26
|
+
private renderSettingsTab;
|
|
27
|
+
private renderTabContent;
|
|
28
|
+
render(): import("lit").TemplateResult;
|
|
29
|
+
}
|
|
30
|
+
declare global {
|
|
31
|
+
interface HTMLElementTagNameMap {
|
|
32
|
+
"speechos-settings-modal": SpeechOSSettingsModal;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared styles and CSS variables for SpeechOS UI components
|
|
3
|
+
*/
|
|
4
|
+
import { type CSSResult } from 'lit';
|
|
5
|
+
/**
|
|
6
|
+
* CSS variables and theme tokens
|
|
7
|
+
* These can be customized by the host application
|
|
8
|
+
*/
|
|
9
|
+
export declare const themeStyles: CSSResult;
|
|
10
|
+
/**
|
|
11
|
+
* Common animation keyframes
|
|
12
|
+
*/
|
|
13
|
+
export declare const animations: CSSResult;
|
|
14
|
+
/**
|
|
15
|
+
* Utility styles for common patterns
|
|
16
|
+
*/
|
|
17
|
+
export declare const utilityStyles: CSSResult;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared styles and CSS variables for SpeechOS UI components
|
|
3
|
+
*/
|
|
4
|
+
import { type CSSResult } from 'lit';
|
|
5
|
+
/**
|
|
6
|
+
* CSS variables and theme tokens
|
|
7
|
+
* These can be customized by the host application
|
|
8
|
+
*/
|
|
9
|
+
export declare const themeStyles: CSSResult;
|
|
10
|
+
/**
|
|
11
|
+
* Common animation keyframes
|
|
12
|
+
*/
|
|
13
|
+
export declare const animations: CSSResult;
|
|
14
|
+
/**
|
|
15
|
+
* Utility styles for common patterns
|
|
16
|
+
*/
|
|
17
|
+
export declare const utilityStyles: CSSResult;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main widget container component
|
|
3
|
+
* Composes mic button and action bubbles with state management
|
|
4
|
+
*/
|
|
5
|
+
import { LitElement, type CSSResultGroup, type TemplateResult } from "lit";
|
|
6
|
+
import "./mic-button.js";
|
|
7
|
+
import "./action-bubbles.js";
|
|
8
|
+
import "./settings-button.js";
|
|
9
|
+
import "./settings-modal.js";
|
|
10
|
+
export declare class SpeechOSWidget extends LitElement {
|
|
11
|
+
static styles: CSSResultGroup;
|
|
12
|
+
private widgetState;
|
|
13
|
+
private settingsOpen;
|
|
14
|
+
private stateUnsubscribe?;
|
|
15
|
+
private errorEventUnsubscribe?;
|
|
16
|
+
private dictationTargetElement;
|
|
17
|
+
private editTargetElement;
|
|
18
|
+
private dictationCursorStart;
|
|
19
|
+
private dictationCursorEnd;
|
|
20
|
+
private editSelectionStart;
|
|
21
|
+
private editSelectionEnd;
|
|
22
|
+
private editSelectedText;
|
|
23
|
+
private boundClickOutsideHandler;
|
|
24
|
+
private modalElement;
|
|
25
|
+
private customPosition;
|
|
26
|
+
private isDragging;
|
|
27
|
+
private dragStartPos;
|
|
28
|
+
private dragOffset;
|
|
29
|
+
private boundDragMove;
|
|
30
|
+
private boundDragEnd;
|
|
31
|
+
private static readonly DRAG_THRESHOLD;
|
|
32
|
+
private suppressNextClick;
|
|
33
|
+
connectedCallback(): void;
|
|
34
|
+
disconnectedCallback(): void;
|
|
35
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
36
|
+
private handleClickOutside;
|
|
37
|
+
private isFormField;
|
|
38
|
+
private updatePosition;
|
|
39
|
+
private handleMicClick;
|
|
40
|
+
private handleStopRecording;
|
|
41
|
+
private handleCancelOperation;
|
|
42
|
+
private handleRetryConnection;
|
|
43
|
+
private handleCloseWidget;
|
|
44
|
+
private handleSettingsClick;
|
|
45
|
+
private handleDragStart;
|
|
46
|
+
private handleDragMove;
|
|
47
|
+
private handleDragEnd;
|
|
48
|
+
private applyCustomPosition;
|
|
49
|
+
private insertTranscription;
|
|
50
|
+
private handleActionSelect;
|
|
51
|
+
private withMinDisplayTime;
|
|
52
|
+
private startDictation;
|
|
53
|
+
private startEdit;
|
|
54
|
+
private handleStopEdit;
|
|
55
|
+
private supportsSelection;
|
|
56
|
+
private getElementContent;
|
|
57
|
+
private applyEdit;
|
|
58
|
+
render(): TemplateResult | string;
|
|
59
|
+
}
|
|
60
|
+
declare global {
|
|
61
|
+
interface HTMLElementTagNameMap {
|
|
62
|
+
"speechos-widget": SpeechOSWidget;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main widget container component
|
|
3
|
+
* Composes mic button and action bubbles with state management
|
|
4
|
+
*/
|
|
5
|
+
import { LitElement, type CSSResultGroup, type TemplateResult } from "lit";
|
|
6
|
+
import "./mic-button.js";
|
|
7
|
+
import "./action-bubbles.js";
|
|
8
|
+
import "./settings-button.js";
|
|
9
|
+
import "./settings-modal.js";
|
|
10
|
+
export declare class SpeechOSWidget extends LitElement {
|
|
11
|
+
static styles: CSSResultGroup;
|
|
12
|
+
private widgetState;
|
|
13
|
+
private settingsOpen;
|
|
14
|
+
private stateUnsubscribe?;
|
|
15
|
+
private errorEventUnsubscribe?;
|
|
16
|
+
private dictationTargetElement;
|
|
17
|
+
private editTargetElement;
|
|
18
|
+
private dictationCursorStart;
|
|
19
|
+
private dictationCursorEnd;
|
|
20
|
+
private editSelectionStart;
|
|
21
|
+
private editSelectionEnd;
|
|
22
|
+
private editSelectedText;
|
|
23
|
+
private boundClickOutsideHandler;
|
|
24
|
+
private modalElement;
|
|
25
|
+
private customPosition;
|
|
26
|
+
private isDragging;
|
|
27
|
+
private dragStartPos;
|
|
28
|
+
private dragOffset;
|
|
29
|
+
private boundDragMove;
|
|
30
|
+
private boundDragEnd;
|
|
31
|
+
private static readonly DRAG_THRESHOLD;
|
|
32
|
+
private suppressNextClick;
|
|
33
|
+
connectedCallback(): void;
|
|
34
|
+
disconnectedCallback(): void;
|
|
35
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
36
|
+
private handleClickOutside;
|
|
37
|
+
private isFormField;
|
|
38
|
+
private updatePosition;
|
|
39
|
+
private handleMicClick;
|
|
40
|
+
private handleStopRecording;
|
|
41
|
+
private handleCancelOperation;
|
|
42
|
+
private handleRetryConnection;
|
|
43
|
+
private handleCloseWidget;
|
|
44
|
+
private handleSettingsClick;
|
|
45
|
+
private handleDragStart;
|
|
46
|
+
private handleDragMove;
|
|
47
|
+
private handleDragEnd;
|
|
48
|
+
private applyCustomPosition;
|
|
49
|
+
private insertTranscription;
|
|
50
|
+
private handleActionSelect;
|
|
51
|
+
private withMinDisplayTime;
|
|
52
|
+
private startDictation;
|
|
53
|
+
private startEdit;
|
|
54
|
+
private handleStopEdit;
|
|
55
|
+
private supportsSelection;
|
|
56
|
+
private getElementContent;
|
|
57
|
+
private applyEdit;
|
|
58
|
+
render(): TemplateResult | string;
|
|
59
|
+
}
|
|
60
|
+
declare global {
|
|
61
|
+
interface HTMLElementTagNameMap {
|
|
62
|
+
"speechos-widget": SpeechOSWidget;
|
|
63
|
+
}
|
|
64
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@speechos/client",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Vanilla JS client SDK for embedding SpeechOS into web applications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/speechos-org/speechos.git",
|
|
26
|
+
"directory": "speechos-client/packages/client"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://speechos.ai",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/speechos-org/speechos/issues"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "npm run build:ts && npm run build:iife",
|
|
34
|
+
"build:ts": "tsdown",
|
|
35
|
+
"build:iife": "rollup -c rollup.config.js",
|
|
36
|
+
"dev": "tsdown --watch",
|
|
37
|
+
"dev:iife": "rollup -c rollup.config.js --watch",
|
|
38
|
+
"type-check": "tsc --noEmit",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"test:watch": "vitest"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"speechos",
|
|
44
|
+
"sdk",
|
|
45
|
+
"client",
|
|
46
|
+
"embed",
|
|
47
|
+
"voice",
|
|
48
|
+
"ai"
|
|
49
|
+
],
|
|
50
|
+
"author": "SpeechOS",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@rollup/plugin-alias": "^6.0.0",
|
|
54
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
55
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
56
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
57
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
58
|
+
"happy-dom": "^20.1.0",
|
|
59
|
+
"rollup": "^4.30.1",
|
|
60
|
+
"tsdown": "^0.2.0",
|
|
61
|
+
"tslib": "^2.8.1",
|
|
62
|
+
"typescript": "^5.7.3",
|
|
63
|
+
"vitest": "^4.0.16"
|
|
64
|
+
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"@speechos/core": "*",
|
|
67
|
+
"lit": "^3.3.2",
|
|
68
|
+
"lucide": "^0.562.0"
|
|
69
|
+
}
|
|
70
|
+
}
|