@pmate/chat-sdk 0.1.14 → 0.1.16

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.
@@ -236,15 +236,21 @@ function MobileInner(props) {
236
236
  transition: `color ${tokens.motion.stateTransition}, transform ${tokens.motion.pressFeedback}`,
237
237
  };
238
238
  return (_jsxs("div", { style: {
239
+ boxSizing: "border-box",
239
240
  position: "relative",
240
241
  width: "100%",
241
242
  maxWidth: "min(420px, calc(100vw - 16px))",
242
- padding: 0,
243
+ padding: "0 0 calc(18px + max(18px, env(safe-area-inset-bottom, 0px)))",
243
244
  background: "transparent",
244
245
  borderRadius: tokens.radius.inputSurface,
245
246
  border: 0,
246
247
  boxShadow: "none",
247
248
  overflow: "visible",
249
+ overscrollBehavior: "contain",
250
+ touchAction: "manipulation",
251
+ userSelect: "none",
252
+ WebkitUserSelect: "none",
253
+ WebkitTouchCallout: "none",
248
254
  }, children: [isRecordingOverlayVisible ? (_jsxs("div", { style: {
249
255
  position: "fixed",
250
256
  left: "50%",
@@ -1,13 +1,17 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from "react";
3
3
  export function HoldToTalkButton({ tokens, active, disabled, text = "按住 说话", activeText = "松开 结束", onPressStart, onPressMove, onPressEnd, onPressCancel, }) {
4
- return (_jsx("button", { type: "button", disabled: disabled, onContextMenu: (event) => {
4
+ const lockPointerGesture = (event) => {
5
+ event.preventDefault();
6
+ };
7
+ return (_jsx("button", { type: "button", "data-pmate-hold-to-talk": "true", disabled: disabled, onContextMenu: (event) => {
5
8
  event.preventDefault();
6
9
  }, onSelect: (event) => {
7
10
  event.preventDefault();
8
11
  }, onDragStart: (event) => {
9
12
  event.preventDefault();
10
13
  }, onPointerDown: (event) => {
14
+ lockPointerGesture(event);
11
15
  try {
12
16
  event.currentTarget.setPointerCapture(event.pointerId);
13
17
  }
@@ -15,7 +19,16 @@ export function HoldToTalkButton({ tokens, active, disabled, text = "按住 说
15
19
  // ignore unsupported pointer capture cases in test environments
16
20
  }
17
21
  onPressStart?.(event);
18
- }, onPointerMove: onPressMove, onPointerUp: onPressEnd, onPointerCancel: onPressCancel, style: {
22
+ }, onPointerMove: (event) => {
23
+ lockPointerGesture(event);
24
+ onPressMove?.(event);
25
+ }, onPointerUp: (event) => {
26
+ lockPointerGesture(event);
27
+ onPressEnd?.(event);
28
+ }, onPointerCancel: (event) => {
29
+ lockPointerGesture(event);
30
+ onPressCancel?.(event);
31
+ }, style: {
19
32
  width: "100%",
20
33
  borderRadius: tokens.radius.mobileHoldToTalk,
21
34
  background: active ? tokens.color.surfaceInputRecording : "transparent",
@@ -37,6 +50,7 @@ export function HoldToTalkButton({ tokens, active, disabled, text = "按住 说
37
50
  WebkitUserSelect: "none",
38
51
  WebkitTouchCallout: "none",
39
52
  WebkitTapHighlightColor: "transparent",
53
+ overscrollBehavior: "contain",
40
54
  touchAction: "none",
41
55
  transition: `all ${tokens.motion.stateTransition}`,
42
56
  }, children: active ? activeText : text }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/chat-sdk",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
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",
@@ -29,14 +29,6 @@
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
- "scripts": {
33
- "build": "tsc -p tsconfig.build.json && cp src/voice/recorder-processor.js lib/voice/recorder-processor.js",
34
- "prepack": "pnpm run build",
35
- "npm:publish": "pnpm run build && npm publish --access public --registry https://registry.npmjs.org/",
36
- "test": "vitest run",
37
- "storybook": "storybook dev -p 6009",
38
- "build-storybook": "storybook build --output-dir dist"
39
- },
40
32
  "dependencies": {
41
33
  "@emoji-mart/data": "^1.2.1",
42
34
  "@emoji-mart/react": "^1.1.1",
@@ -51,14 +43,21 @@
51
43
  "devDependencies": {
52
44
  "@storybook/addon-docs": "^9.0.17",
53
45
  "@storybook/react-vite": "9.0.17",
54
- "@tailwindcss/vite": "catalog:",
55
- "@types/react": "catalog:",
56
- "@types/react-dom": "catalog:",
57
- "react": "catalog:",
58
- "react-dom": "catalog:",
46
+ "@tailwindcss/vite": "^4.1.3",
47
+ "@types/react": "^19.2.7",
48
+ "@types/react-dom": "^19.2.3",
49
+ "react": "^19.1.1",
50
+ "react-dom": "^19.1.1",
59
51
  "storybook": "^9.0.17",
60
- "tailwindcss": "catalog:",
52
+ "tailwindcss": "^4.0.14",
61
53
  "typescript": "5.9.2",
62
54
  "vitest": "^4.0.17"
55
+ },
56
+ "scripts": {
57
+ "build": "tsc -p tsconfig.build.json && cp src/voice/recorder-processor.js lib/voice/recorder-processor.js",
58
+ "npm:publish": "pnpm run build && npm publish --access public --registry https://registry.npmjs.org/",
59
+ "test": "vitest run",
60
+ "storybook": "storybook dev -p 6009",
61
+ "build-storybook": "storybook build --output-dir dist"
63
62
  }
64
- }
63
+ }