@pmate/chat-sdk 0.1.6 → 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.
- package/dist/assets/{ChatInput.stories-CSt4WoEv.js → ChatInput.stories-BABdkDrt.js} +22 -179
- package/dist/assets/{Color-AVL7NMMY-BspvszXC.js → Color-AVL7NMMY-D33umUzR.js} +1 -1
- package/dist/assets/{DocsRenderer-PQXLIZUC-BM8CapQZ.js → DocsRenderer-PQXLIZUC-BUYhEk48.js} +4 -4
- package/dist/assets/{client-Bw6ZM57k.js → client-De2ACSn_.js} +1 -1
- package/dist/assets/{iframe-Dci6y3pc.js → iframe-DVJDoCiO.js} +3 -3
- package/dist/assets/{iframe-DnNTepBm.css → iframe-q28pAgAa.css} +1 -1
- package/dist/assets/{index-DQ_t8Ou6.js → index-CkuJGuix.js} +1 -1
- package/dist/assets/{react-18-3UzO1Bv7.js → react-18-DfLUnvSL.js} +1 -1
- package/dist/iframe.html +2 -2
- package/dist/index.json +1 -1
- package/dist/project.json +1 -1
- package/lib/components/AttachmentPreview.js +20 -4
- package/lib/components/ChatInputDesktop.js +144 -43
- package/lib/components/ChatInputMobile.js +119 -44
- package/lib/components/HoldToTalkButton.js +10 -9
- package/lib/components/ImageTrigger.d.ts +1 -1
- package/lib/components/ImageTrigger.js +1 -1
- package/lib/components/icons.d.ts +2 -0
- package/lib/components/icons.js +10 -4
- package/lib/hooks/useAttachmentState.d.ts +3 -1
- package/lib/tokens/chatInputThemes.js +20 -20
- package/lib/tokens/defaultTokens.js +17 -17
- package/lib/types/attachment.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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 ?
|
|
22
|
-
color: active ?
|
|
23
|
-
border:
|
|
24
|
-
boxShadow:
|
|
25
|
-
padding: "
|
|
26
|
-
minHeight:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
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
|
|
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 {};
|
package/lib/components/icons.js
CHANGED
|
@@ -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
|
|
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.
|
|
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.
|
|
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.
|
|
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">
|
|
4
|
+
addAttachment(attachment: Omit<ChatAttachment, "id" | "kind"> & {
|
|
5
|
+
kind?: ChatAttachment["kind"];
|
|
6
|
+
}): void;
|
|
5
7
|
removeAttachment(id: string): void;
|
|
6
8
|
};
|
|
@@ -2,20 +2,20 @@ export const chatInputThemes = {
|
|
|
2
2
|
pmate: {},
|
|
3
3
|
cli: {
|
|
4
4
|
color: {
|
|
5
|
-
brandPrimary: "#
|
|
6
|
-
surfaceInputDefault: "#
|
|
7
|
-
surfaceInputFocus: "#
|
|
8
|
-
surfaceInputRecording: "#
|
|
5
|
+
brandPrimary: "#25D6A0",
|
|
6
|
+
surfaceInputDefault: "#0B1512",
|
|
7
|
+
surfaceInputFocus: "#10201A",
|
|
8
|
+
surfaceInputRecording: "#132A22",
|
|
9
9
|
surfaceInputError: "#251111",
|
|
10
|
-
textPrimary: "#
|
|
11
|
-
textSecondary: "#
|
|
12
|
-
iconDefault: "#
|
|
13
|
-
iconActive: "#
|
|
14
|
-
actionSendDefault: "#
|
|
10
|
+
textPrimary: "#ECFFF7",
|
|
11
|
+
textSecondary: "#8CB6A8",
|
|
12
|
+
iconDefault: "#A4C7BA",
|
|
13
|
+
iconActive: "#25D6A0",
|
|
14
|
+
actionSendDefault: "#25D6A0",
|
|
15
15
|
actionSendDisabled: "#23483B",
|
|
16
16
|
actionSendTextOnPrimary: "#06100D",
|
|
17
|
-
borderDefault: "#
|
|
18
|
-
borderFocus: "#
|
|
17
|
+
borderDefault: "#263F37",
|
|
18
|
+
borderFocus: "#3A715F",
|
|
19
19
|
borderError: "#D66B6B",
|
|
20
20
|
statusError: "#FF8A8A",
|
|
21
21
|
statusWarning: "#E0B256",
|
|
@@ -24,9 +24,9 @@ export const chatInputThemes = {
|
|
|
24
24
|
voiceWaveformBackground: "#214A3C",
|
|
25
25
|
},
|
|
26
26
|
spacing: {
|
|
27
|
-
inputOuter:
|
|
27
|
+
inputOuter: 8,
|
|
28
28
|
inputInner: 10,
|
|
29
|
-
actionGap:
|
|
29
|
+
actionGap: 10,
|
|
30
30
|
attachmentGap: 8,
|
|
31
31
|
voiceWaveformGap: 4,
|
|
32
32
|
mobileTouchInset: 10,
|
|
@@ -34,16 +34,16 @@ export const chatInputThemes = {
|
|
|
34
34
|
statusHintTop: 6,
|
|
35
35
|
},
|
|
36
36
|
radius: {
|
|
37
|
-
inputSurface:
|
|
38
|
-
actionButton:
|
|
39
|
-
attachmentPreview:
|
|
37
|
+
inputSurface: 14,
|
|
38
|
+
actionButton: 18,
|
|
39
|
+
attachmentPreview: 10,
|
|
40
40
|
waveformBar: 2,
|
|
41
|
-
mobileHoldToTalk:
|
|
42
|
-
desktopInputSurface:
|
|
41
|
+
mobileHoldToTalk: 14,
|
|
42
|
+
desktopInputSurface: 14,
|
|
43
43
|
},
|
|
44
44
|
shadow: {
|
|
45
|
-
inputElevated: "0 0 0
|
|
46
|
-
recordingActive: "0 0 0
|
|
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
47
|
},
|
|
48
48
|
typography: {
|
|
49
49
|
familyBase: '"SF Mono", "JetBrains Mono", monospace',
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
export const defaultChatInputTokens = {
|
|
2
2
|
color: {
|
|
3
|
-
brandPrimary: "#
|
|
3
|
+
brandPrimary: "#12B886",
|
|
4
4
|
surfaceInputDefault: "#FFFFFF",
|
|
5
|
-
surfaceInputFocus: "#
|
|
6
|
-
surfaceInputRecording: "#
|
|
5
|
+
surfaceInputFocus: "#F4F7F6",
|
|
6
|
+
surfaceInputRecording: "#E9F8F1",
|
|
7
7
|
surfaceInputError: "#FFF1F3",
|
|
8
|
-
textPrimary: "#
|
|
9
|
-
textSecondary: "#
|
|
10
|
-
iconDefault: "#
|
|
11
|
-
iconActive: "#
|
|
12
|
-
actionSendDefault: "#
|
|
13
|
-
actionSendDisabled: "#
|
|
8
|
+
textPrimary: "#18211E",
|
|
9
|
+
textSecondary: "#65736E",
|
|
10
|
+
iconDefault: "#3F4A46",
|
|
11
|
+
iconActive: "#12B886",
|
|
12
|
+
actionSendDefault: "#12B886",
|
|
13
|
+
actionSendDisabled: "#B9D9CF",
|
|
14
14
|
actionSendTextOnPrimary: "#FFFFFF",
|
|
15
|
-
borderDefault: "#
|
|
16
|
-
borderFocus: "#
|
|
15
|
+
borderDefault: "#DCE6E2",
|
|
16
|
+
borderFocus: "#8EDBC3",
|
|
17
17
|
borderError: "#F2A7B5",
|
|
18
18
|
statusError: "#D14363",
|
|
19
19
|
statusWarning: "#D98E04",
|
|
20
20
|
statusSuccess: "#2E9B62",
|
|
21
|
-
voiceWaveformActive: "#
|
|
22
|
-
voiceWaveformBackground: "#
|
|
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:
|
|
36
|
-
actionButton:
|
|
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
|
|
50
|
-
recordingActive: "0 0 0 4px rgba(
|
|
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',
|