@pmate/chat-sdk 0.1.5 → 0.1.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.
@@ -18,15 +18,16 @@ export function HoldToTalkButton({ tokens, active, disabled, text = "按住 说
18
18
  }, onPointerMove: onPressMove, onPointerUp: onPressEnd, onPointerCancel: onPressCancel, style: {
19
19
  width: "100%",
20
20
  borderRadius: tokens.radius.mobileHoldToTalk,
21
- background: active ? "#ECE2FF" : "#FFFFFF",
22
- color: active ? "#4E2DBF" : "#171717",
23
- border: `1px solid ${active ? "#BFA9FF" : "#E5E7EB"}`,
24
- boxShadow: active ? "0 14px 28px rgba(109, 74, 255, 0.22)" : "none",
25
- padding: "15px 18px",
26
- minHeight: 60,
27
- fontSize: 16,
28
- lineHeight: "22px",
29
- fontWeight: 600,
21
+ background: active ? tokens.color.surfaceInputRecording : "transparent",
22
+ color: active ? tokens.color.iconActive : tokens.color.textPrimary,
23
+ border: 0,
24
+ boxShadow: "none",
25
+ padding: "0 16px",
26
+ minHeight: 48,
27
+ fontFamily: tokens.typography.familyBase,
28
+ fontSize: tokens.typography.voiceHoldToTalk.size,
29
+ lineHeight: `${tokens.typography.voiceHoldToTalk.lineHeight}px`,
30
+ fontWeight: tokens.typography.voiceHoldToTalk.weight,
30
31
  opacity: disabled ? 0.55 : 1,
31
32
  userSelect: "none",
32
33
  WebkitUserSelect: "none",
@@ -1,2 +1,2 @@
1
1
  import type { ButtonHTMLAttributes } from "react";
2
- export declare function ImageTrigger(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function MoreTrigger(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from "react";
3
3
  import { PlusOutlineIcon } from "./icons";
4
- export function ImageTrigger(props) {
4
+ export function MoreTrigger(props) {
5
5
  const iconSize = Number(props["data-icon-size"] ?? 26);
6
6
  return (_jsx("button", { type: "button", "aria-label": "More", ...props, style: {
7
7
  display: "inline-flex",
@@ -4,8 +4,10 @@ type IconProps = {
4
4
  strokeWidth?: number;
5
5
  };
6
6
  export declare function MicOutlineIcon({ size, stroke, strokeWidth, }: IconProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function VoiceInputOutlineIcon({ size, stroke, strokeWidth, }: IconProps): import("react/jsx-runtime").JSX.Element;
7
8
  export declare function KeyboardOutlineIcon({ size, stroke, strokeWidth, }: IconProps): import("react/jsx-runtime").JSX.Element;
8
9
  export declare function SmileOutlineIcon({ size, stroke, strokeWidth, }: IconProps): import("react/jsx-runtime").JSX.Element;
9
10
  export declare function PlusOutlineIcon({ size, stroke, strokeWidth, }: IconProps): import("react/jsx-runtime").JSX.Element;
10
11
  export declare function ImageOutlineIcon({ size, stroke, strokeWidth, }: IconProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function FileOutlineIcon({ size, stroke, strokeWidth, }: IconProps): import("react/jsx-runtime").JSX.Element;
11
13
  export {};
@@ -6,7 +6,10 @@ function BaseIcon({ size = 22, children, }) {
6
6
  export function MicOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.9, }) {
7
7
  return (_jsxs(BaseIcon, { size: size, children: [_jsx("rect", { x: "9", y: "3", width: "6", height: "11", rx: "3", stroke: stroke, strokeWidth: strokeWidth }), _jsx("path", { d: "M6.5 11.5C6.5 14.5376 8.96243 17 12 17C15.0376 17 17.5 14.5376 17.5 11.5", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" }), _jsx("path", { d: "M12 17V21", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" }), _jsx("path", { d: "M8.5 21H15.5", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" })] }));
8
8
  }
9
- export function KeyboardOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.8, }) {
9
+ export function VoiceInputOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.7, }) {
10
+ return (_jsxs(BaseIcon, { size: size, children: [_jsx("circle", { cx: "12", cy: "12", r: "9", stroke: stroke, strokeWidth: strokeWidth }), _jsx("path", { d: "M7.4 10.6H8.9L11 8.7V15.3L8.9 13.4H7.4V10.6Z", stroke: stroke, strokeWidth: strokeWidth, strokeLinejoin: "round" }), _jsx("path", { d: "M13.25 9.6C13.9 10.2 14.25 11.02 14.25 12C14.25 12.98 13.9 13.8 13.25 14.4", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" }), _jsx("path", { d: "M15.45 7.45C16.63 8.55 17.3 10.12 17.3 12C17.3 13.88 16.63 15.45 15.45 16.55", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" })] }));
11
+ }
12
+ export function KeyboardOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.7, }) {
10
13
  return (_jsxs(BaseIcon, { size: size, children: [_jsx("rect", { x: "3", y: "5", width: "18", height: "14", rx: "3", stroke: stroke, strokeWidth: strokeWidth }), [
11
14
  [6.5, 9],
12
15
  [10, 9],
@@ -18,12 +21,15 @@ export function KeyboardOutlineIcon({ size, stroke = "currentColor", strokeWidth
18
21
  [17, 12.5],
19
22
  ].map(([cx, cy], index) => (_jsx("circle", { cx: cx, cy: cy, r: "0.8", fill: stroke }, index))), _jsx("path", { d: "M7 16.2H17", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" })] }));
20
23
  }
21
- export function SmileOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.8, }) {
24
+ export function SmileOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.7, }) {
22
25
  return (_jsxs(BaseIcon, { size: size, children: [_jsx("circle", { cx: "12", cy: "12", r: "9", stroke: stroke, strokeWidth: strokeWidth }), _jsx("circle", { cx: "9", cy: "10", r: "1", fill: stroke }), _jsx("circle", { cx: "15", cy: "10", r: "1", fill: stroke }), _jsx("path", { d: "M8.2 14.2C9.15 15.55 10.42 16.2 12 16.2C13.58 16.2 14.85 15.55 15.8 14.2", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" })] }));
23
26
  }
24
- export function PlusOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.8, }) {
27
+ export function PlusOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.7, }) {
25
28
  return (_jsxs(BaseIcon, { size: size, children: [_jsx("circle", { cx: "12", cy: "12", r: "9", stroke: stroke, strokeWidth: strokeWidth }), _jsx("path", { d: "M12 8V16", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" }), _jsx("path", { d: "M8 12H16", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" })] }));
26
29
  }
27
- export function ImageOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.8, }) {
30
+ export function ImageOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.7, }) {
28
31
  return (_jsxs(BaseIcon, { size: size, children: [_jsx("rect", { x: "4", y: "5", width: "16", height: "14", rx: "3", stroke: stroke, strokeWidth: strokeWidth }), _jsx("circle", { cx: "9", cy: "10", r: "1.6", stroke: stroke, strokeWidth: strokeWidth }), _jsx("path", { d: "M7 16L11.2 12.1C11.75 11.58 12.63 11.58 13.18 12.1L17 15.6", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })] }));
29
32
  }
33
+ export function FileOutlineIcon({ size, stroke = "currentColor", strokeWidth = 1.7, }) {
34
+ return (_jsxs(BaseIcon, { size: size, children: [_jsx("path", { d: "M7 3.8H13.4L18 8.4V20.2H7V3.8Z", stroke: stroke, strokeWidth: strokeWidth, strokeLinejoin: "round" }), _jsx("path", { d: "M13.4 3.8V8.4H18", stroke: stroke, strokeWidth: strokeWidth, strokeLinejoin: "round" }), _jsx("path", { d: "M9.7 12.4H15.3", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" }), _jsx("path", { d: "M9.7 15.5H14", stroke: stroke, strokeWidth: strokeWidth, strokeLinecap: "round" })] }));
35
+ }
@@ -1,6 +1,8 @@
1
1
  import type { ChatAttachment } from "../types/attachment";
2
2
  export declare function useAttachmentState(): {
3
3
  attachments: ChatAttachment[];
4
- addAttachment(attachment: Omit<ChatAttachment, "id" | "kind">): void;
4
+ addAttachment(attachment: Omit<ChatAttachment, "id" | "kind"> & {
5
+ kind?: ChatAttachment["kind"];
6
+ }): void;
5
7
  removeAttachment(id: string): void;
6
8
  };
package/lib/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export * from "./hooks/useVoiceInputController";
17
17
  export * from "./services/agentSdkASRClient";
18
18
  export * from "./services/authTokenResolver";
19
19
  export * from "./tokens/defaultTokens";
20
+ export * from "./tokens/chatInputThemes";
20
21
  export * from "./types/attachment";
21
22
  export * from "./types/chatInput";
22
23
  export * from "./types/voice";
package/lib/index.js CHANGED
@@ -17,6 +17,7 @@ export * from "./hooks/useVoiceInputController";
17
17
  export * from "./services/agentSdkASRClient";
18
18
  export * from "./services/authTokenResolver";
19
19
  export * from "./tokens/defaultTokens";
20
+ export * from "./tokens/chatInputThemes";
20
21
  export * from "./types/attachment";
21
22
  export * from "./types/chatInput";
22
23
  export * from "./types/voice";
@@ -0,0 +1,110 @@
1
+ export type ChatInputThemeName = "pmate" | "cli" | "compact";
2
+ export declare const chatInputThemes: {
3
+ pmate: {};
4
+ cli: {
5
+ color: {
6
+ brandPrimary: string;
7
+ surfaceInputDefault: string;
8
+ surfaceInputFocus: string;
9
+ surfaceInputRecording: string;
10
+ surfaceInputError: string;
11
+ textPrimary: string;
12
+ textSecondary: string;
13
+ iconDefault: string;
14
+ iconActive: string;
15
+ actionSendDefault: string;
16
+ actionSendDisabled: string;
17
+ actionSendTextOnPrimary: string;
18
+ borderDefault: string;
19
+ borderFocus: string;
20
+ borderError: string;
21
+ statusError: string;
22
+ statusWarning: string;
23
+ statusSuccess: string;
24
+ voiceWaveformActive: string;
25
+ voiceWaveformBackground: string;
26
+ };
27
+ spacing: {
28
+ inputOuter: number;
29
+ inputInner: number;
30
+ actionGap: number;
31
+ attachmentGap: number;
32
+ voiceWaveformGap: number;
33
+ mobileTouchInset: number;
34
+ desktopToolbarGap: number;
35
+ statusHintTop: number;
36
+ };
37
+ radius: {
38
+ inputSurface: number;
39
+ actionButton: number;
40
+ attachmentPreview: number;
41
+ waveformBar: number;
42
+ mobileHoldToTalk: number;
43
+ desktopInputSurface: number;
44
+ };
45
+ shadow: {
46
+ inputElevated: string;
47
+ recordingActive: string;
48
+ };
49
+ typography: {
50
+ familyBase: string;
51
+ familyMono: string;
52
+ inputText: {
53
+ size: number;
54
+ lineHeight: number;
55
+ weight: number;
56
+ };
57
+ statusHint: {
58
+ size: number;
59
+ lineHeight: number;
60
+ weight: number;
61
+ };
62
+ actionLabel: {
63
+ size: number;
64
+ lineHeight: number;
65
+ weight: number;
66
+ };
67
+ voiceHoldToTalk: {
68
+ size: number;
69
+ lineHeight: number;
70
+ weight: number;
71
+ };
72
+ };
73
+ };
74
+ compact: {
75
+ color: {
76
+ brandPrimary: string;
77
+ surfaceInputDefault: string;
78
+ surfaceInputFocus: string;
79
+ surfaceInputRecording: string;
80
+ surfaceInputError: string;
81
+ textPrimary: string;
82
+ textSecondary: string;
83
+ iconDefault: string;
84
+ iconActive: string;
85
+ actionSendDefault: string;
86
+ actionSendDisabled: string;
87
+ actionSendTextOnPrimary: string;
88
+ borderDefault: string;
89
+ borderFocus: string;
90
+ borderError: string;
91
+ statusError: string;
92
+ statusWarning: string;
93
+ statusSuccess: string;
94
+ voiceWaveformActive: string;
95
+ voiceWaveformBackground: string;
96
+ };
97
+ radius: {
98
+ inputSurface: number;
99
+ actionButton: number;
100
+ attachmentPreview: number;
101
+ waveformBar: number;
102
+ mobileHoldToTalk: number;
103
+ desktopInputSurface: number;
104
+ };
105
+ shadow: {
106
+ inputElevated: string;
107
+ recordingActive: string;
108
+ };
109
+ };
110
+ };
@@ -0,0 +1,93 @@
1
+ export const chatInputThemes = {
2
+ pmate: {},
3
+ cli: {
4
+ color: {
5
+ brandPrimary: "#25D6A0",
6
+ surfaceInputDefault: "#0B1512",
7
+ surfaceInputFocus: "#10201A",
8
+ surfaceInputRecording: "#132A22",
9
+ surfaceInputError: "#251111",
10
+ textPrimary: "#ECFFF7",
11
+ textSecondary: "#8CB6A8",
12
+ iconDefault: "#A4C7BA",
13
+ iconActive: "#25D6A0",
14
+ actionSendDefault: "#25D6A0",
15
+ actionSendDisabled: "#23483B",
16
+ actionSendTextOnPrimary: "#06100D",
17
+ borderDefault: "#263F37",
18
+ borderFocus: "#3A715F",
19
+ borderError: "#D66B6B",
20
+ statusError: "#FF8A8A",
21
+ statusWarning: "#E0B256",
22
+ statusSuccess: "#15D49A",
23
+ voiceWaveformActive: "#15D49A",
24
+ voiceWaveformBackground: "#214A3C",
25
+ },
26
+ spacing: {
27
+ inputOuter: 8,
28
+ inputInner: 10,
29
+ actionGap: 10,
30
+ attachmentGap: 8,
31
+ voiceWaveformGap: 4,
32
+ mobileTouchInset: 10,
33
+ desktopToolbarGap: 10,
34
+ statusHintTop: 6,
35
+ },
36
+ radius: {
37
+ inputSurface: 14,
38
+ actionButton: 18,
39
+ attachmentPreview: 10,
40
+ waveformBar: 2,
41
+ mobileHoldToTalk: 14,
42
+ desktopInputSurface: 14,
43
+ },
44
+ shadow: {
45
+ inputElevated: "0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px rgba(0, 0, 0, 0.18)",
46
+ recordingActive: "0 0 0 4px rgba(37, 214, 160, 0.16)",
47
+ },
48
+ typography: {
49
+ familyBase: '"SF Mono", "JetBrains Mono", monospace',
50
+ familyMono: '"SF Mono", "JetBrains Mono", monospace',
51
+ inputText: { size: 14, lineHeight: 20, weight: 500 },
52
+ statusHint: { size: 11, lineHeight: 16, weight: 500 },
53
+ actionLabel: { size: 12, lineHeight: 16, weight: 700 },
54
+ voiceHoldToTalk: { size: 13, lineHeight: 18, weight: 700 },
55
+ },
56
+ },
57
+ compact: {
58
+ color: {
59
+ brandPrimary: "#0EA5E9",
60
+ surfaceInputDefault: "#F8FAFC",
61
+ surfaceInputFocus: "#F0F9FF",
62
+ surfaceInputRecording: "#E0F2FE",
63
+ surfaceInputError: "#FFF1F2",
64
+ textPrimary: "#0F172A",
65
+ textSecondary: "#64748B",
66
+ iconDefault: "#475569",
67
+ iconActive: "#0284C7",
68
+ actionSendDefault: "#0F172A",
69
+ actionSendDisabled: "#CBD5E1",
70
+ actionSendTextOnPrimary: "#FFFFFF",
71
+ borderDefault: "#CBD5E1",
72
+ borderFocus: "#7DD3FC",
73
+ borderError: "#FDA4AF",
74
+ statusError: "#E11D48",
75
+ statusWarning: "#B45309",
76
+ statusSuccess: "#047857",
77
+ voiceWaveformActive: "#0284C7",
78
+ voiceWaveformBackground: "#BAE6FD",
79
+ },
80
+ radius: {
81
+ inputSurface: 10,
82
+ actionButton: 8,
83
+ attachmentPreview: 8,
84
+ waveformBar: 999,
85
+ mobileHoldToTalk: 10,
86
+ desktopInputSurface: 10,
87
+ },
88
+ shadow: {
89
+ inputElevated: "none",
90
+ recordingActive: "0 0 0 3px rgba(14, 165, 233, 0.16)",
91
+ },
92
+ },
93
+ };
@@ -1,25 +1,25 @@
1
1
  export const defaultChatInputTokens = {
2
2
  color: {
3
- brandPrimary: "#6D4AFF",
3
+ brandPrimary: "#12B886",
4
4
  surfaceInputDefault: "#FFFFFF",
5
- surfaceInputFocus: "#F7F4FF",
6
- surfaceInputRecording: "#EEE7FF",
5
+ surfaceInputFocus: "#F4F7F6",
6
+ surfaceInputRecording: "#E9F8F1",
7
7
  surfaceInputError: "#FFF1F3",
8
- textPrimary: "#1F1637",
9
- textSecondary: "#6F6790",
10
- iconDefault: "#6F6790",
11
- iconActive: "#6D4AFF",
12
- actionSendDefault: "#6D4AFF",
13
- actionSendDisabled: "#CFC6F6",
8
+ textPrimary: "#18211E",
9
+ textSecondary: "#65736E",
10
+ iconDefault: "#3F4A46",
11
+ iconActive: "#12B886",
12
+ actionSendDefault: "#12B886",
13
+ actionSendDisabled: "#B9D9CF",
14
14
  actionSendTextOnPrimary: "#FFFFFF",
15
- borderDefault: "#E6E0F7",
16
- borderFocus: "#B9A8FF",
15
+ borderDefault: "#DCE6E2",
16
+ borderFocus: "#8EDBC3",
17
17
  borderError: "#F2A7B5",
18
18
  statusError: "#D14363",
19
19
  statusWarning: "#D98E04",
20
20
  statusSuccess: "#2E9B62",
21
- voiceWaveformActive: "#7C5CFF",
22
- voiceWaveformBackground: "#DCD2FF",
21
+ voiceWaveformActive: "#12B886",
22
+ voiceWaveformBackground: "#CFEFE3",
23
23
  },
24
24
  spacing: {
25
25
  inputOuter: 12,
@@ -32,8 +32,8 @@ export const defaultChatInputTokens = {
32
32
  statusHintTop: 6,
33
33
  },
34
34
  radius: {
35
- inputSurface: 20,
36
- actionButton: 16,
35
+ inputSurface: 16,
36
+ actionButton: 18,
37
37
  attachmentPreview: 14,
38
38
  waveformBar: 999,
39
39
  mobileHoldToTalk: 18,
@@ -46,8 +46,8 @@ export const defaultChatInputTokens = {
46
46
  transcribingLoading: "900ms linear infinite",
47
47
  },
48
48
  shadow: {
49
- inputElevated: "0 6px 24px rgba(95, 70, 180, 0.08)",
50
- recordingActive: "0 0 0 4px rgba(109, 74, 255, 0.14)",
49
+ inputElevated: "0 1px 2px rgba(15, 23, 42, 0.04)",
50
+ recordingActive: "0 0 0 4px rgba(18, 184, 134, 0.14)",
51
51
  },
52
52
  typography: {
53
53
  familyBase: '"SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif',
@@ -1,7 +1,7 @@
1
1
  export type ChatAttachment = {
2
2
  id: string;
3
3
  name: string;
4
- kind: "image";
4
+ kind: "image" | "file";
5
5
  file?: File;
6
6
  url?: string;
7
7
  previewUrl?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/chat-sdk",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Cross-platform PMate chat input components, voice input primitives, and ASR helpers",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",