@amaster.ai/components-templates 1.11.0 → 1.13.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/components/ai-assistant/package.json +6 -5
- package/components/ai-assistant/template/components/chat-recommends.tsx +28 -6
- package/components/ai-assistant/template/components/ui-renderer-lazy.tsx +14 -26
- package/components/ai-assistant-taro/package.json +5 -6
- package/package.json +2 -1
- package/packages/cli/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amaster-react-project",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite --force",
|
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
"check:build": "amaster-cli check build --stack react-vite",
|
|
14
14
|
"check:ast": "amaster-cli check ast --stack react-vite",
|
|
15
15
|
"check:route": "amaster-cli check route --stack react-vite",
|
|
16
|
-
"preview": "vite preview"
|
|
16
|
+
"preview": "vite preview",
|
|
17
|
+
"prepare": "bun scripts/prepare.mjs || true"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"@a2a-js/sdk": "^0.3.7",
|
|
20
|
-
"@amaster.ai/client": "1.1.0-beta.
|
|
21
|
-
"@amaster.ai/vite-plugins": "1.1.0-beta.
|
|
21
|
+
"@amaster.ai/client": "1.1.0-beta.69",
|
|
22
|
+
"@amaster.ai/vite-plugins": "1.1.0-beta.69",
|
|
22
23
|
"@fontsource-variable/inter": "^5.2.8",
|
|
23
24
|
"@fortawesome/fontawesome-free": "^6.1.1",
|
|
24
25
|
"@hookform/resolvers": "^5.2.2",
|
|
@@ -88,7 +89,7 @@
|
|
|
88
89
|
"vaul": "^1.1.2",
|
|
89
90
|
"video-react": "^0.16.0",
|
|
90
91
|
"xss": "^1.0.15",
|
|
91
|
-
"zod": "^
|
|
92
|
+
"zod": "^4.0.0"
|
|
92
93
|
},
|
|
93
94
|
"devDependencies": {
|
|
94
95
|
"@amaster.ai/cli": "1.1.0-beta.68",
|
|
@@ -18,7 +18,9 @@ const ChatRecommends: React.FC<{
|
|
|
18
18
|
pointerId: number;
|
|
19
19
|
startX: number;
|
|
20
20
|
startScrollLeft: number;
|
|
21
|
+
dragging: boolean;
|
|
21
22
|
} | null>(null);
|
|
23
|
+
const suppressClickRef = useRef(false);
|
|
22
24
|
const [isDraggingScroll, setIsDraggingScroll] = useState(false);
|
|
23
25
|
|
|
24
26
|
if (hidden || !data || data.length === 0) return null;
|
|
@@ -33,9 +35,10 @@ const ChatRecommends: React.FC<{
|
|
|
33
35
|
pointerId: e.pointerId,
|
|
34
36
|
startX: e.clientX,
|
|
35
37
|
startScrollLeft: container.scrollLeft,
|
|
38
|
+
dragging: false,
|
|
36
39
|
};
|
|
40
|
+
suppressClickRef.current = false;
|
|
37
41
|
setIsDraggingScroll(false);
|
|
38
|
-
container.setPointerCapture(e.pointerId);
|
|
39
42
|
};
|
|
40
43
|
|
|
41
44
|
const handlePointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
@@ -44,9 +47,16 @@ const ChatRecommends: React.FC<{
|
|
|
44
47
|
if (!container || !dragState || dragState.pointerId !== e.pointerId) return;
|
|
45
48
|
|
|
46
49
|
const deltaX = e.clientX - dragState.startX;
|
|
47
|
-
if (Math.abs(deltaX) > 4) {
|
|
50
|
+
if (Math.abs(deltaX) > 4 && !dragState.dragging) {
|
|
51
|
+
dragState.dragging = true;
|
|
52
|
+
suppressClickRef.current = true;
|
|
48
53
|
setIsDraggingScroll(true);
|
|
54
|
+
container.setPointerCapture(e.pointerId);
|
|
49
55
|
}
|
|
56
|
+
|
|
57
|
+
if (!dragState.dragging) return;
|
|
58
|
+
|
|
59
|
+
e.preventDefault();
|
|
50
60
|
container.scrollLeft = dragState.startScrollLeft - deltaX;
|
|
51
61
|
};
|
|
52
62
|
|
|
@@ -55,13 +65,19 @@ const ChatRecommends: React.FC<{
|
|
|
55
65
|
const dragState = dragStateRef.current;
|
|
56
66
|
if (!container || !dragState || dragState.pointerId !== e.pointerId) return;
|
|
57
67
|
|
|
58
|
-
if (container.hasPointerCapture(e.pointerId)) {
|
|
68
|
+
if (dragState.dragging && container.hasPointerCapture(e.pointerId)) {
|
|
59
69
|
container.releasePointerCapture(e.pointerId);
|
|
60
70
|
}
|
|
61
71
|
|
|
62
|
-
|
|
72
|
+
if (dragState.dragging) {
|
|
73
|
+
window.setTimeout(() => {
|
|
74
|
+
suppressClickRef.current = false;
|
|
75
|
+
setIsDraggingScroll(false);
|
|
76
|
+
}, 0);
|
|
77
|
+
} else {
|
|
78
|
+
suppressClickRef.current = false;
|
|
63
79
|
setIsDraggingScroll(false);
|
|
64
|
-
}
|
|
80
|
+
}
|
|
65
81
|
dragStateRef.current = null;
|
|
66
82
|
};
|
|
67
83
|
|
|
@@ -80,8 +96,14 @@ const ChatRecommends: React.FC<{
|
|
|
80
96
|
<Button
|
|
81
97
|
key={prompt}
|
|
82
98
|
variant="outline"
|
|
99
|
+
onClickCapture={(e) => {
|
|
100
|
+
if (suppressClickRef.current) {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
e.stopPropagation();
|
|
103
|
+
}
|
|
104
|
+
}}
|
|
83
105
|
onClick={() => {
|
|
84
|
-
if (!
|
|
106
|
+
if (!suppressClickRef.current) {
|
|
85
107
|
onSend(prompt);
|
|
86
108
|
}
|
|
87
109
|
}}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
VisibilityProvider,
|
|
6
6
|
ValidationProvider,
|
|
7
7
|
ActionProvider,
|
|
8
|
-
defineRegistry
|
|
8
|
+
defineRegistry,
|
|
9
9
|
} from "@json-render/react";
|
|
10
10
|
import { defineCatalog } from "@json-render/core";
|
|
11
11
|
import { schema } from "@json-render/react/schema";
|
|
@@ -40,6 +40,15 @@ const CHART_COLORS = [
|
|
|
40
40
|
"#3B82F6",
|
|
41
41
|
];
|
|
42
42
|
|
|
43
|
+
const chartSchema = {
|
|
44
|
+
props: z.object({
|
|
45
|
+
data: z.array(z.record(z.any(), z.any())),
|
|
46
|
+
xKey: z.string(),
|
|
47
|
+
yKey: z.string(),
|
|
48
|
+
height: z.number().optional(),
|
|
49
|
+
}),
|
|
50
|
+
};
|
|
51
|
+
|
|
43
52
|
const catalog = defineCatalog(schema, {
|
|
44
53
|
components: {
|
|
45
54
|
Card: shadcnComponentDefinitions.Card,
|
|
@@ -78,38 +87,17 @@ const catalog = defineCatalog(schema, {
|
|
|
78
87
|
Toggle: shadcnComponentDefinitions.Toggle,
|
|
79
88
|
ToggleGroup: shadcnComponentDefinitions.ToggleGroup,
|
|
80
89
|
ButtonGroup: shadcnComponentDefinitions.ButtonGroup,
|
|
81
|
-
BarChart:
|
|
82
|
-
|
|
83
|
-
data: z.array(z.record(z.any())),
|
|
84
|
-
xKey: z.string(),
|
|
85
|
-
yKey: z.string(),
|
|
86
|
-
height: z.number().optional(),
|
|
87
|
-
}),
|
|
88
|
-
},
|
|
89
|
-
LineChart: {
|
|
90
|
-
props: z.object({
|
|
91
|
-
data: z.array(z.record(z.any())),
|
|
92
|
-
xKey: z.string(),
|
|
93
|
-
yKey: z.string(),
|
|
94
|
-
height: z.number().optional(),
|
|
95
|
-
}),
|
|
96
|
-
},
|
|
90
|
+
BarChart: chartSchema,
|
|
91
|
+
LineChart: chartSchema,
|
|
97
92
|
PieChart: {
|
|
98
93
|
props: z.object({
|
|
99
|
-
data: z.array(z.record(z.any())),
|
|
94
|
+
data: z.array(z.record(z.any(), z.any())),
|
|
100
95
|
nameKey: z.string(),
|
|
101
96
|
valueKey: z.string(),
|
|
102
97
|
height: z.number().optional(),
|
|
103
98
|
}),
|
|
104
99
|
},
|
|
105
|
-
AreaChart:
|
|
106
|
-
props: z.object({
|
|
107
|
-
data: z.array(z.record(z.any())),
|
|
108
|
-
xKey: z.string(),
|
|
109
|
-
yKey: z.string(),
|
|
110
|
-
height: z.number().optional(),
|
|
111
|
-
}),
|
|
112
|
-
},
|
|
100
|
+
AreaChart: chartSchema,
|
|
113
101
|
},
|
|
114
102
|
actions: {},
|
|
115
103
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taro-project",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "开箱即用的基于Taro + React + Zustand + TailwindCSS + TypeScript的模板",
|
|
5
5
|
"author": "amaster.ai",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"type-check": "amaster-cli check type --stack taro",
|
|
35
35
|
"check:build": "amaster-cli check build --stack taro",
|
|
36
36
|
"precommit": "bun run lint:check && bun run type-check",
|
|
37
|
-
"prepare": "
|
|
37
|
+
"prepare": "bun scripts/prepare.mjs || true",
|
|
38
38
|
"postinstall": "weapp-tw patch || true",
|
|
39
39
|
"patch": "weapp-tw patch"
|
|
40
40
|
},
|
|
@@ -46,10 +46,9 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@a2a-js/sdk": "^0.3.7",
|
|
49
|
-
"@amaster.ai/
|
|
50
|
-
"@amaster.ai/
|
|
51
|
-
"@amaster.ai/
|
|
52
|
-
"@amaster.ai/vite-plugins": "1.1.0-beta.68",
|
|
49
|
+
"@amaster.ai/client": "1.1.0-beta.69",
|
|
50
|
+
"@amaster.ai/taro-echarts-ui": "1.1.0-beta.69",
|
|
51
|
+
"@amaster.ai/vite-plugins": "1.1.0-beta.69",
|
|
53
52
|
"@babel/runtime": "^7.28.3",
|
|
54
53
|
"@tarojs/components": "4.1.5",
|
|
55
54
|
"@tarojs/helper": "4.1.5",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amaster.ai/components-templates",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Amaster component templates collection",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"globby": "^14.0.0",
|
|
66
66
|
"ora": "^8.0.1",
|
|
67
67
|
"prompts": "^2.4.2",
|
|
68
|
+
"react-helmet-async": "^3.0.0",
|
|
68
69
|
"read-pkg": "^9.0.1",
|
|
69
70
|
"write-pkg": "^6.0.1"
|
|
70
71
|
}
|