persagy-vant 0.0.27 → 0.0.28
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/es/cascader/Cascader.d.ts +1 -1
- package/es/cascader/index.d.ts +1 -1
- package/es/coupon-list/style/index.mjs +1 -1
- package/es/coupon-list/style/less.mjs +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.mjs +4 -4
- package/es/label/Label.d.ts +92 -0
- package/es/label/Label.mjs +95 -0
- package/es/label/index.css +1 -0
- package/es/label/index.d.ts +64 -0
- package/es/label/index.less +113 -0
- package/es/label/index.mjs +8 -0
- package/es/label/style/index.mjs +6 -0
- package/es/label/style/less.mjs +6 -0
- package/es/label/var.less +11 -0
- package/es/location-select/style/index.mjs +1 -1
- package/es/location-select/style/less.mjs +1 -1
- package/es/material-add/MaterialAdd.d.ts +105 -1
- package/es/material-add/MaterialAdd.mjs +63 -23
- package/es/material-add/index.d.ts +73 -1
- package/es/quantity-input/QuantityInput.d.ts +1 -1
- package/es/quantity-input/index.d.ts +2 -2
- package/es/radio-panel/RadioPanel.d.ts +46 -1
- package/es/radio-panel/RadioPanel.mjs +115 -29
- package/es/radio-panel/index.css +1 -1
- package/es/radio-panel/index.d.ts +35 -1
- package/es/radio-panel/index.less +17 -0
- package/es/radio-panel/style/index.mjs +4 -0
- package/es/radio-panel/style/less.mjs +4 -0
- package/es/sticky/Sticky.d.ts +1 -1
- package/es/sticky/index.d.ts +1 -1
- package/es/tabs/TabsTitle.mjs +1 -0
- package/es/tabs/index.css +1 -1
- package/es/tabs/index.less +11 -0
- package/es/tag/Tag.d.ts +1 -1
- package/es/tag/index.css +1 -1
- package/es/tag/index.less +7 -0
- package/es/tag/var.less +3 -0
- package/lib/cascader/Cascader.d.ts +1 -1
- package/lib/cascader/index.d.ts +1 -1
- package/lib/coupon-list/style/index.js +1 -1
- package/lib/coupon-list/style/less.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +4 -4
- package/lib/index.less +6 -6
- package/lib/label/Label.d.ts +92 -0
- package/lib/label/Label.js +114 -0
- package/lib/label/index.css +1 -0
- package/lib/label/index.d.ts +64 -0
- package/lib/{bot-mobile/session-filter.js → label/index.js} +16 -13
- package/lib/label/index.less +113 -0
- package/lib/label/style/index.js +6 -0
- package/lib/label/style/less.js +6 -0
- package/lib/label/var.less +11 -0
- package/lib/location-select/style/index.js +1 -1
- package/lib/location-select/style/less.js +1 -1
- package/lib/material-add/MaterialAdd.d.ts +105 -1
- package/lib/material-add/MaterialAdd.js +63 -23
- package/lib/material-add/index.d.ts +73 -1
- package/lib/quantity-input/QuantityInput.d.ts +1 -1
- package/lib/quantity-input/index.d.ts +2 -2
- package/lib/radio-panel/RadioPanel.d.ts +46 -1
- package/lib/radio-panel/RadioPanel.js +114 -28
- package/lib/radio-panel/index.css +1 -1
- package/lib/radio-panel/index.d.ts +35 -1
- package/lib/radio-panel/index.less +17 -0
- package/lib/radio-panel/style/index.js +4 -0
- package/lib/radio-panel/style/less.js +4 -0
- package/lib/sticky/Sticky.d.ts +1 -1
- package/lib/sticky/index.d.ts +1 -1
- package/lib/tabs/TabsTitle.js +1 -0
- package/lib/tabs/index.css +1 -1
- package/lib/tabs/index.less +11 -0
- package/lib/tag/Tag.d.ts +1 -1
- package/lib/tag/index.css +1 -1
- package/lib/tag/index.less +7 -0
- package/lib/tag/var.less +3 -0
- package/lib/vant.cjs.js +1212 -1769
- package/lib/vant.es.js +1212 -1769
- package/lib/vant.js +13016 -24376
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +4 -4
- package/es/bot-mobile/BotFab.d.ts +0 -72
- package/es/bot-mobile/BotFab.mjs +0 -152
- package/es/bot-mobile/BotHistoryDrawer.d.ts +0 -72
- package/es/bot-mobile/BotHistoryDrawer.mjs +0 -97
- package/es/bot-mobile/BotMobile.d.ts +0 -83
- package/es/bot-mobile/BotMobile.mjs +0 -47
- package/es/bot-mobile/BotMobileContextTags.d.ts +0 -52
- package/es/bot-mobile/BotMobileContextTags.mjs +0 -52
- package/es/bot-mobile/BotMobilePrompts.d.ts +0 -54
- package/es/bot-mobile/BotMobilePrompts.mjs +0 -49
- package/es/bot-mobile/BotMobileSheet.d.ts +0 -92
- package/es/bot-mobile/BotMobileSheet.mjs +0 -50
- package/es/bot-mobile/BotMobileView.d.ts +0 -82
- package/es/bot-mobile/BotMobileView.mjs +0 -45
- package/es/bot-mobile/BotSessionList.d.ts +0 -71
- package/es/bot-mobile/BotSessionList.mjs +0 -99
- package/es/bot-mobile/BotVoiceBar.d.ts +0 -80
- package/es/bot-mobile/BotVoiceBar.mjs +0 -138
- package/es/bot-mobile/fab-position.d.ts +0 -9
- package/es/bot-mobile/fab-position.mjs +0 -10
- package/es/bot-mobile/fab-position.test.d.ts +0 -1
- package/es/bot-mobile/fab-position.test.mjs +0 -29
- package/es/bot-mobile/index.css +0 -1
- package/es/bot-mobile/index.d.ts +0 -469
- package/es/bot-mobile/index.less +0 -464
- package/es/bot-mobile/index.mjs +0 -50
- package/es/bot-mobile/session-filter.d.ts +0 -6
- package/es/bot-mobile/session-filter.mjs +0 -15
- package/es/bot-mobile/session-item.d.ts +0 -15
- package/es/bot-mobile/session-item.mjs +0 -73
- package/es/bot-mobile/style/index.mjs +0 -15
- package/es/bot-mobile/style/less.mjs +0 -15
- package/es/bot-mobile/types.d.ts +0 -23
- package/es/bot-mobile/types.mjs +0 -0
- package/es/bot-mobile/var.less +0 -58
- package/es/bot-mobile/voice-zone.d.ts +0 -6
- package/es/bot-mobile/voice-zone.mjs +0 -6
- package/es/bot-mobile/voice-zone.test.d.ts +0 -1
- package/es/bot-mobile/voice-zone.test.mjs +0 -19
- package/lib/bot-mobile/BotFab.d.ts +0 -72
- package/lib/bot-mobile/BotFab.js +0 -171
- package/lib/bot-mobile/BotHistoryDrawer.d.ts +0 -72
- package/lib/bot-mobile/BotHistoryDrawer.js +0 -116
- package/lib/bot-mobile/BotMobile.d.ts +0 -83
- package/lib/bot-mobile/BotMobile.js +0 -66
- package/lib/bot-mobile/BotMobileContextTags.d.ts +0 -52
- package/lib/bot-mobile/BotMobileContextTags.js +0 -71
- package/lib/bot-mobile/BotMobilePrompts.d.ts +0 -54
- package/lib/bot-mobile/BotMobilePrompts.js +0 -68
- package/lib/bot-mobile/BotMobileSheet.d.ts +0 -92
- package/lib/bot-mobile/BotMobileSheet.js +0 -79
- package/lib/bot-mobile/BotMobileView.d.ts +0 -82
- package/lib/bot-mobile/BotMobileView.js +0 -64
- package/lib/bot-mobile/BotSessionList.d.ts +0 -71
- package/lib/bot-mobile/BotSessionList.js +0 -118
- package/lib/bot-mobile/BotVoiceBar.d.ts +0 -80
- package/lib/bot-mobile/BotVoiceBar.js +0 -157
- package/lib/bot-mobile/fab-position.d.ts +0 -9
- package/lib/bot-mobile/fab-position.js +0 -29
- package/lib/bot-mobile/fab-position.test.d.ts +0 -1
- package/lib/bot-mobile/fab-position.test.js +0 -29
- package/lib/bot-mobile/index.css +0 -1
- package/lib/bot-mobile/index.d.ts +0 -469
- package/lib/bot-mobile/index.js +0 -79
- package/lib/bot-mobile/index.less +0 -464
- package/lib/bot-mobile/session-filter.d.ts +0 -6
- package/lib/bot-mobile/session-item.d.ts +0 -15
- package/lib/bot-mobile/session-item.js +0 -92
- package/lib/bot-mobile/style/index.js +0 -15
- package/lib/bot-mobile/style/less.js +0 -15
- package/lib/bot-mobile/types.d.ts +0 -23
- package/lib/bot-mobile/types.js +0 -15
- package/lib/bot-mobile/var.less +0 -58
- package/lib/bot-mobile/voice-zone.d.ts +0 -6
- package/lib/bot-mobile/voice-zone.js +0 -25
- package/lib/bot-mobile/voice-zone.test.d.ts +0 -1
- package/lib/bot-mobile/voice-zone.test.js +0 -19
- /package/es/{bot-mobile → label}/var.css +0 -0
- /package/lib/{bot-mobile → label}/var.css +0 -0
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name2 in all)
|
|
7
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var stdin_exports = {};
|
|
19
|
-
__export(stdin_exports, {
|
|
20
|
-
botSessionListProps: () => botSessionListProps,
|
|
21
|
-
default: () => stdin_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
24
|
-
var import_vue = require("vue");
|
|
25
|
-
var import_utils = require("../utils");
|
|
26
|
-
var import_icon = require("../icon");
|
|
27
|
-
var import_empty = require("../empty");
|
|
28
|
-
var import_loading = require("../loading");
|
|
29
|
-
var import_search = require("../search");
|
|
30
|
-
var import_session_filter = require("./session-filter");
|
|
31
|
-
var import_session_item = require("./session-item");
|
|
32
|
-
const [name, bem] = (0, import_utils.createNamespace)("bot-mobile-session-list");
|
|
33
|
-
const botSessionListProps = {
|
|
34
|
-
sessions: (0, import_utils.makeArrayProp)(),
|
|
35
|
-
activeId: (0, import_utils.makeStringProp)(""),
|
|
36
|
-
searchable: import_utils.truthProp,
|
|
37
|
-
loading: Boolean,
|
|
38
|
-
emptyText: (0, import_utils.makeStringProp)("\u6682\u65E0\u4F1A\u8BDD")
|
|
39
|
-
};
|
|
40
|
-
var stdin_default = (0, import_vue.defineComponent)({
|
|
41
|
-
name,
|
|
42
|
-
props: botSessionListProps,
|
|
43
|
-
emits: ["select", "rename", "delete", "create"],
|
|
44
|
-
setup(props, {
|
|
45
|
-
emit
|
|
46
|
-
}) {
|
|
47
|
-
const keyword = (0, import_vue.ref)("");
|
|
48
|
-
const editingId = (0, import_vue.ref)("");
|
|
49
|
-
const editingName = (0, import_vue.ref)("");
|
|
50
|
-
const startRename = (session) => {
|
|
51
|
-
editingId.value = session.id;
|
|
52
|
-
editingName.value = session.name;
|
|
53
|
-
};
|
|
54
|
-
const cancelRename = () => {
|
|
55
|
-
editingId.value = "";
|
|
56
|
-
editingName.value = "";
|
|
57
|
-
};
|
|
58
|
-
const commitRename = (session) => {
|
|
59
|
-
if (editingId.value !== session.id) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const nextName = editingName.value.trim();
|
|
63
|
-
cancelRename();
|
|
64
|
-
if (nextName && nextName !== session.name) {
|
|
65
|
-
emit("rename", {
|
|
66
|
-
session,
|
|
67
|
-
name: nextName
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const renderList = (sessions) => (0, import_vue.createVNode)("div", {
|
|
72
|
-
"class": bem("list")
|
|
73
|
-
}, [sessions.map((session) => (0, import_session_item.renderSessionItem)({
|
|
74
|
-
key: session.id,
|
|
75
|
-
session,
|
|
76
|
-
active: session.id === props.activeId,
|
|
77
|
-
editing: editingId.value === session.id,
|
|
78
|
-
editingName: editingName.value,
|
|
79
|
-
onSelect: () => emit("select", session),
|
|
80
|
-
onStartRename: () => startRename(session),
|
|
81
|
-
onEditingNameInput: (value) => {
|
|
82
|
-
editingName.value = value;
|
|
83
|
-
},
|
|
84
|
-
onCommitRename: () => commitRename(session),
|
|
85
|
-
onCancelRename: cancelRename,
|
|
86
|
-
onDelete: () => emit("delete", session)
|
|
87
|
-
}))]);
|
|
88
|
-
return () => {
|
|
89
|
-
const filtered = (0, import_session_filter.filterSessions)(props.sessions, keyword.value);
|
|
90
|
-
return (0, import_vue.createVNode)("div", {
|
|
91
|
-
"class": bem()
|
|
92
|
-
}, [(0, import_vue.createVNode)("div", {
|
|
93
|
-
"class": bem("toolbar")
|
|
94
|
-
}, [props.searchable && (0, import_vue.createVNode)(import_search.Search, {
|
|
95
|
-
"modelValue": keyword.value,
|
|
96
|
-
"onUpdate:modelValue": ($event) => keyword.value = $event,
|
|
97
|
-
"class": bem("search"),
|
|
98
|
-
"shape": "round",
|
|
99
|
-
"placeholder": "\u641C\u7D22\u4F1A\u8BDD",
|
|
100
|
-
"clearable": true
|
|
101
|
-
}, null), (0, import_vue.createVNode)(import_icon.Icon, {
|
|
102
|
-
"name": "plus",
|
|
103
|
-
"class": bem("create"),
|
|
104
|
-
"onClick": () => emit("create")
|
|
105
|
-
}, null)]), props.loading ? (0, import_vue.createVNode)("div", {
|
|
106
|
-
"class": bem("loading")
|
|
107
|
-
}, [(0, import_vue.createVNode)(import_loading.Loading, {
|
|
108
|
-
"size": "24",
|
|
109
|
-
"vertical": true
|
|
110
|
-
}, {
|
|
111
|
-
default: () => [(0, import_vue.createTextVNode)("\u52A0\u8F7D\u4E2D...")]
|
|
112
|
-
})]) : filtered.length === 0 ? (0, import_vue.createVNode)(import_empty.Empty, {
|
|
113
|
-
"class": bem("empty"),
|
|
114
|
-
"description": props.emptyText
|
|
115
|
-
}, null) : renderList(filtered)]);
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { type ExtractPropTypes } from 'vue';
|
|
2
|
-
export declare type BotVoiceBarState = 'idle' | 'recording' | 'transcribing';
|
|
3
|
-
export declare const botVoiceBarProps: {
|
|
4
|
-
state: {
|
|
5
|
-
type: import("vue").PropType<BotVoiceBarState>;
|
|
6
|
-
default: BotVoiceBarState;
|
|
7
|
-
};
|
|
8
|
-
elapsedLabel: {
|
|
9
|
-
type: import("vue").PropType<string>;
|
|
10
|
-
default: string;
|
|
11
|
-
};
|
|
12
|
-
amplitudes: {
|
|
13
|
-
type: import("vue").PropType<number[]>;
|
|
14
|
-
default: () => never[];
|
|
15
|
-
};
|
|
16
|
-
cancelDistance: {
|
|
17
|
-
type: NumberConstructor;
|
|
18
|
-
default: number;
|
|
19
|
-
};
|
|
20
|
-
hint: {
|
|
21
|
-
type: import("vue").PropType<string>;
|
|
22
|
-
default: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export declare type BotVoiceBarProps = ExtractPropTypes<typeof botVoiceBarProps>;
|
|
26
|
-
declare const _default: import("vue").DefineComponent<{
|
|
27
|
-
state: {
|
|
28
|
-
type: import("vue").PropType<BotVoiceBarState>;
|
|
29
|
-
default: BotVoiceBarState;
|
|
30
|
-
};
|
|
31
|
-
elapsedLabel: {
|
|
32
|
-
type: import("vue").PropType<string>;
|
|
33
|
-
default: string;
|
|
34
|
-
};
|
|
35
|
-
amplitudes: {
|
|
36
|
-
type: import("vue").PropType<number[]>;
|
|
37
|
-
default: () => never[];
|
|
38
|
-
};
|
|
39
|
-
cancelDistance: {
|
|
40
|
-
type: NumberConstructor;
|
|
41
|
-
default: number;
|
|
42
|
-
};
|
|
43
|
-
hint: {
|
|
44
|
-
type: import("vue").PropType<string>;
|
|
45
|
-
default: string;
|
|
46
|
-
};
|
|
47
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("start" | "cancel" | "adopt" | "cancelZoneChange")[], "start" | "cancel" | "adopt" | "cancelZoneChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
48
|
-
state: {
|
|
49
|
-
type: import("vue").PropType<BotVoiceBarState>;
|
|
50
|
-
default: BotVoiceBarState;
|
|
51
|
-
};
|
|
52
|
-
elapsedLabel: {
|
|
53
|
-
type: import("vue").PropType<string>;
|
|
54
|
-
default: string;
|
|
55
|
-
};
|
|
56
|
-
amplitudes: {
|
|
57
|
-
type: import("vue").PropType<number[]>;
|
|
58
|
-
default: () => never[];
|
|
59
|
-
};
|
|
60
|
-
cancelDistance: {
|
|
61
|
-
type: NumberConstructor;
|
|
62
|
-
default: number;
|
|
63
|
-
};
|
|
64
|
-
hint: {
|
|
65
|
-
type: import("vue").PropType<string>;
|
|
66
|
-
default: string;
|
|
67
|
-
};
|
|
68
|
-
}>> & {
|
|
69
|
-
onCancel?: ((...args: any[]) => any) | undefined;
|
|
70
|
-
onStart?: ((...args: any[]) => any) | undefined;
|
|
71
|
-
onAdopt?: ((...args: any[]) => any) | undefined;
|
|
72
|
-
onCancelZoneChange?: ((...args: any[]) => any) | undefined;
|
|
73
|
-
}, {
|
|
74
|
-
state: BotVoiceBarState;
|
|
75
|
-
elapsedLabel: string;
|
|
76
|
-
amplitudes: number[];
|
|
77
|
-
cancelDistance: number;
|
|
78
|
-
hint: string;
|
|
79
|
-
}>;
|
|
80
|
-
export default _default;
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name2 in all)
|
|
7
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var stdin_exports = {};
|
|
19
|
-
__export(stdin_exports, {
|
|
20
|
-
botVoiceBarProps: () => botVoiceBarProps,
|
|
21
|
-
default: () => stdin_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
24
|
-
var import_vue = require("vue");
|
|
25
|
-
var import_utils = require("../utils");
|
|
26
|
-
var import_loading = require("../loading");
|
|
27
|
-
var import_voice_zone = require("./voice-zone");
|
|
28
|
-
const [name, bem] = (0, import_utils.createNamespace)("bot-mobile-voice-bar");
|
|
29
|
-
const CANVAS_WIDTH = 240;
|
|
30
|
-
const CANVAS_HEIGHT = 32;
|
|
31
|
-
const BAR_WIDTH = 3;
|
|
32
|
-
const BAR_GAP = 2;
|
|
33
|
-
const MIN_BAR_HEIGHT = 2;
|
|
34
|
-
const FALLBACK_WAVE_COLOR = "#246fe5";
|
|
35
|
-
const botVoiceBarProps = {
|
|
36
|
-
state: (0, import_utils.makeStringProp)("idle"),
|
|
37
|
-
elapsedLabel: (0, import_utils.makeStringProp)("0:00"),
|
|
38
|
-
amplitudes: (0, import_utils.makeArrayProp)(),
|
|
39
|
-
cancelDistance: (0, import_utils.makeNumberProp)(60),
|
|
40
|
-
hint: (0, import_utils.makeStringProp)("")
|
|
41
|
-
};
|
|
42
|
-
var stdin_default = (0, import_vue.defineComponent)({
|
|
43
|
-
name,
|
|
44
|
-
props: botVoiceBarProps,
|
|
45
|
-
emits: ["start", "cancel", "adopt", "cancelZoneChange"],
|
|
46
|
-
setup(props, {
|
|
47
|
-
emit
|
|
48
|
-
}) {
|
|
49
|
-
const canvasRef = (0, import_vue.ref)();
|
|
50
|
-
const inCancelZone = (0, import_vue.ref)(false);
|
|
51
|
-
let pressing = false;
|
|
52
|
-
let startY = 0;
|
|
53
|
-
const onPointerDown = (event) => {
|
|
54
|
-
if (event.button !== 0) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (props.state !== "idle") {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const el = event.currentTarget;
|
|
61
|
-
try {
|
|
62
|
-
el.setPointerCapture(event.pointerId);
|
|
63
|
-
} catch (e) {
|
|
64
|
-
}
|
|
65
|
-
pressing = true;
|
|
66
|
-
startY = event.clientY;
|
|
67
|
-
inCancelZone.value = false;
|
|
68
|
-
emit("start");
|
|
69
|
-
};
|
|
70
|
-
const onPointerMove = (event) => {
|
|
71
|
-
if (!pressing) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const next = (0, import_voice_zone.isInCancelZone)(startY, event.clientY, props.cancelDistance);
|
|
75
|
-
if (next !== inCancelZone.value) {
|
|
76
|
-
inCancelZone.value = next;
|
|
77
|
-
emit("cancelZoneChange", next);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
const finishGesture = (cancelled) => {
|
|
81
|
-
if (!pressing) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
pressing = false;
|
|
85
|
-
const shouldCancel = cancelled || inCancelZone.value;
|
|
86
|
-
inCancelZone.value = false;
|
|
87
|
-
emit(shouldCancel ? "cancel" : "adopt");
|
|
88
|
-
};
|
|
89
|
-
const onPointerUp = () => finishGesture(false);
|
|
90
|
-
const onPointerCancel = () => finishGesture(true);
|
|
91
|
-
const resolveWaveColor = (el) => {
|
|
92
|
-
if (typeof getComputedStyle !== "function") {
|
|
93
|
-
return FALLBACK_WAVE_COLOR;
|
|
94
|
-
}
|
|
95
|
-
const value = getComputedStyle(el).color;
|
|
96
|
-
return value || FALLBACK_WAVE_COLOR;
|
|
97
|
-
};
|
|
98
|
-
const drawWave = () => {
|
|
99
|
-
const canvas = canvasRef.value;
|
|
100
|
-
if (!canvas) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const ctx = canvas.getContext("2d");
|
|
104
|
-
if (!ctx) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
108
|
-
ctx.fillStyle = resolveWaveColor(canvas);
|
|
109
|
-
const step = BAR_WIDTH + BAR_GAP;
|
|
110
|
-
const maxBars = Math.max(1, Math.floor(canvas.width / step));
|
|
111
|
-
const bars = props.amplitudes.slice(-maxBars);
|
|
112
|
-
const offsetX = canvas.width - bars.length * step;
|
|
113
|
-
bars.forEach((amplitude, index) => {
|
|
114
|
-
const clamped = Math.min(1, Math.max(0, amplitude));
|
|
115
|
-
const barHeight = Math.max(MIN_BAR_HEIGHT, clamped * canvas.height);
|
|
116
|
-
const x = offsetX + index * step;
|
|
117
|
-
const y = (canvas.height - barHeight) / 2;
|
|
118
|
-
ctx.fillRect(x, y, BAR_WIDTH, barHeight);
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
(0, import_vue.onMounted)(drawWave);
|
|
122
|
-
(0, import_vue.watch)(() => props.amplitudes, drawWave);
|
|
123
|
-
(0, import_vue.watch)(() => props.state, drawWave);
|
|
124
|
-
const renderTranscribing = () => (0, import_vue.createVNode)("div", {
|
|
125
|
-
"class": bem("transcribing")
|
|
126
|
-
}, [(0, import_vue.createVNode)(import_loading.Loading, {
|
|
127
|
-
"size": "16"
|
|
128
|
-
}, null), (0, import_vue.createVNode)("span", {
|
|
129
|
-
"class": bem("transcribing-text")
|
|
130
|
-
}, [props.hint || "\u6B63\u5728\u8BC6\u522B..."])]);
|
|
131
|
-
const renderWave = () => (0, import_vue.createVNode)(import_vue.Fragment, null, [(0, import_vue.createVNode)("canvas", {
|
|
132
|
-
"ref": canvasRef,
|
|
133
|
-
"class": bem("wave"),
|
|
134
|
-
"width": CANVAS_WIDTH,
|
|
135
|
-
"height": CANVAS_HEIGHT
|
|
136
|
-
}, null), (0, import_vue.createVNode)("div", {
|
|
137
|
-
"class": bem("info")
|
|
138
|
-
}, [(0, import_vue.createVNode)("span", {
|
|
139
|
-
"class": bem("elapsed")
|
|
140
|
-
}, [props.elapsedLabel]), props.hint && (0, import_vue.createVNode)("span", {
|
|
141
|
-
"class": bem("hint")
|
|
142
|
-
}, [props.hint])])]);
|
|
143
|
-
return () => (0, import_vue.createVNode)("div", {
|
|
144
|
-
"class": bem({
|
|
145
|
-
recording: props.state === "recording",
|
|
146
|
-
transcribing: props.state === "transcribing",
|
|
147
|
-
"cancel-zone": inCancelZone.value
|
|
148
|
-
}),
|
|
149
|
-
"role": "button",
|
|
150
|
-
"tabindex": 0,
|
|
151
|
-
"onPointerdown": onPointerDown,
|
|
152
|
-
"onPointermove": onPointerMove,
|
|
153
|
-
"onPointerup": onPointerUp,
|
|
154
|
-
"onPointercancel": onPointerCancel
|
|
155
|
-
}, [props.state === "transcribing" ? renderTranscribing() : renderWave()]);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BotFab 纯几何逻辑:吸边判定 + 拖拽/点击判定。
|
|
3
|
-
* 拆成纯函数便于单测,组件内 pointer 事件处理只负责采集坐标、调用这里。
|
|
4
|
-
*/
|
|
5
|
-
export declare type FabSide = 'left' | 'right';
|
|
6
|
-
/** 松手时按水平中线吸到最近边;恰好落在中点视为右半区(>=) */
|
|
7
|
-
export declare function resolveSnapSide(x: number, viewportWidth: number): FabSide;
|
|
8
|
-
/** 位移在阈值内视为点击,否则视为拖拽;阈值默认 6px,按欧氏距离计算 */
|
|
9
|
-
export declare function isTapNotDrag(dx: number, dy: number, threshold?: number): boolean;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var stdin_exports = {};
|
|
19
|
-
__export(stdin_exports, {
|
|
20
|
-
isTapNotDrag: () => isTapNotDrag,
|
|
21
|
-
resolveSnapSide: () => resolveSnapSide
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
24
|
-
function resolveSnapSide(x, viewportWidth) {
|
|
25
|
-
return x >= viewportWidth / 2 ? "right" : "left";
|
|
26
|
-
}
|
|
27
|
-
function isTapNotDrag(dx, dy, threshold = 6) {
|
|
28
|
-
return Math.sqrt(dx * dx + dy * dy) < threshold;
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var import_fab_position = require("./fab-position");
|
|
2
|
-
describe("resolveSnapSide", () => {
|
|
3
|
-
test("should resolve to left when x is in the left half of the viewport", () => {
|
|
4
|
-
expect((0, import_fab_position.resolveSnapSide)(50, 375)).toBe("left");
|
|
5
|
-
});
|
|
6
|
-
test("should resolve to right when x is in the right half of the viewport", () => {
|
|
7
|
-
expect((0, import_fab_position.resolveSnapSide)(300, 375)).toBe("right");
|
|
8
|
-
});
|
|
9
|
-
test("should resolve to right when x is exactly at the horizontal midline", () => {
|
|
10
|
-
expect((0, import_fab_position.resolveSnapSide)(187.5, 375)).toBe("right");
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
describe("isTapNotDrag", () => {
|
|
14
|
-
test("should be a tap when displacement is below the default 6px threshold", () => {
|
|
15
|
-
expect((0, import_fab_position.isTapNotDrag)(5, 0)).toBe(true);
|
|
16
|
-
});
|
|
17
|
-
test("should be a drag when displacement reaches the default 6px threshold", () => {
|
|
18
|
-
expect((0, import_fab_position.isTapNotDrag)(6, 0)).toBe(false);
|
|
19
|
-
});
|
|
20
|
-
test("should combine x/y displacement as euclidean distance", () => {
|
|
21
|
-
expect((0, import_fab_position.isTapNotDrag)(3, 4)).toBe(true);
|
|
22
|
-
expect((0, import_fab_position.isTapNotDrag)(4, 3)).toBe(true);
|
|
23
|
-
expect((0, import_fab_position.isTapNotDrag)(6, 8)).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
test("should respect a custom threshold", () => {
|
|
26
|
-
expect((0, import_fab_position.isTapNotDrag)(10, 0, 20)).toBe(true);
|
|
27
|
-
expect((0, import_fab_position.isTapNotDrag)(20, 0, 20)).toBe(false);
|
|
28
|
-
});
|
|
29
|
-
});
|
package/lib/bot-mobile/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{--van-bot-mobile-primary-color: var(--van-primary-color);--van-bot-mobile-text-color: var(--van-text-color);--van-bot-mobile-border-color: var(--van-border-color);--van-bot-mobile-background-color: var(--van-background-color-light);--van-bot-mobile-prompts-title-color: var(--van-text-color-2);--van-bot-mobile-prompts-title-font-size: var(--van-font-size-sm);--van-bot-mobile-prompts-item-background: var(--van-background-color-light);--van-bot-mobile-prompts-item-border-color: var(--van-border-color);--van-bot-mobile-prompts-item-active-background: var(--van-active-color);--van-bot-mobile-prompts-item-selected-background: var(--van-blue-100);--van-bot-mobile-prompts-item-selected-border-color: var(--van-primary-color);--van-bot-mobile-prompts-item-selected-color: var(--van-primary-color);--van-bot-mobile-prompts-item-title-color: var(--van-text-color);--van-bot-mobile-prompts-item-desc-color: var(--van-text-color-2);--van-bot-mobile-context-tags-gap: 8px;--van-bot-mobile-context-tags-padding: 4px 12px;--van-bot-mobile-context-tags-font-size: var(--van-font-size-md);--van-bot-mobile-context-tags-line-height: var(--van-line-height-lg);--van-bot-mobile-context-tags-border-radius: var(--van-border-radius-lg);--van-bot-mobile-context-tags-color: var(--van-gray-8);--van-bot-mobile-context-tags-background-color: var(--van-gray-2);--van-bot-mobile-context-tags-selected-color: var(--van-bot-mobile-primary-color);--van-bot-mobile-context-tags-selected-background-color: var(--van-blue-100);--van-bot-mobile-context-tags-active-opacity: var(--van-active-opacity);--van-bot-mobile-sheet-height: 90%;--van-bot-mobile-fab-size: 56px;--van-bot-mobile-fab-z-index: 999;--van-bot-mobile-fab-color: var(--van-white);--van-bot-mobile-fab-background: var(--van-bot-mobile-primary-color);--van-bot-mobile-fab-shadow: 0 2px 8px rgba(0, 0, 0, .2);--van-bot-mobile-session-item-active-background: var(--van-active-color);--van-bot-mobile-session-item-name-color: var(--van-text-color);--van-bot-mobile-session-item-meta-color: var(--van-text-color-2);--van-bot-mobile-session-item-action-color: var(--van-text-color-3);--van-bot-mobile-session-item-danger-color: var(--van-danger-color);--van-bot-mobile-history-drawer-header-height: 52px;--van-bot-mobile-history-drawer-title-color: var(--van-text-color);--van-bot-mobile-voice-bar-height: 64px;--van-bot-mobile-voice-bar-background: var(--van-background-color-light);--van-bot-mobile-voice-bar-border-color: var(--van-border-color);--van-bot-mobile-voice-bar-recording-background: var(--van-blue-50);--van-bot-mobile-voice-bar-cancel-zone-background: var(--van-red);--van-bot-mobile-voice-bar-elapsed-color: var(--van-text-color);--van-bot-mobile-voice-bar-hint-color: var(--van-text-color-2);--van-bot-mobile-voice-bar-wave-color: var(--van-bot-mobile-primary-color);--van-bot-mobile-session-list-toolbar-padding: 8px 16px;--van-bot-mobile-session-list-create-color: var(--van-bot-mobile-primary-color)}.van-bot-mobile,.van-bot-mobile-view{width:100%;height:100%}.van-bot-mobile .bot-card,.van-bot-mobile-view .bot-card{--primary-color: var(--van-bot-mobile-primary-color);--accent: var(--van-bot-mobile-primary-color);--ink-1: var(--van-bot-mobile-text-color);--line: var(--van-bot-mobile-border-color);--gray-0: var(--van-bot-mobile-background-color)}.van-bot-mobile-prompts{width:100%}.van-bot-mobile-prompts__title{margin-bottom:8px;color:var(--van-bot-mobile-prompts-title-color);font-size:var(--van-bot-mobile-prompts-title-font-size);line-height:1.4}.van-bot-mobile-prompts__list{display:flex;flex-direction:column;gap:8px}.van-bot-mobile-prompts__item{box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;gap:4px;min-height:44px;padding:8px 12px;background:var(--van-bot-mobile-prompts-item-background);border:1px solid var(--van-bot-mobile-prompts-item-border-color);border-radius:8px;cursor:pointer}.van-bot-mobile-prompts__item:active{background:var(--van-bot-mobile-prompts-item-active-background)}.van-bot-mobile-prompts__item--active{background:var(--van-bot-mobile-prompts-item-selected-background);border-color:var(--van-bot-mobile-prompts-item-selected-border-color)}.van-bot-mobile-prompts__item--active .van-bot-mobile-prompts__item-title{color:var(--van-bot-mobile-prompts-item-selected-color);font-weight:var(--van-font-weight-bold)}.van-bot-mobile-prompts__item-title{color:var(--van-bot-mobile-prompts-item-title-color);font-size:var(--van-font-size-md);font-weight:500;line-height:1.4}.van-bot-mobile-prompts__item-desc{overflow:hidden;color:var(--van-bot-mobile-prompts-item-desc-color);font-size:var(--van-bot-mobile-prompts-title-font-size);line-height:1.4;text-overflow:ellipsis;white-space:nowrap}.van-bot-mobile-sheet{height:var(--van-bot-mobile-sheet-height)}.van-bot-mobile-sheet .van-bot-mobile{display:flex;flex-direction:column;height:100%}.van-bot-mobile-sheet .van-bot-mobile .bot-card{flex:1;min-height:0}.van-bot-mobile-context-tags{display:flex;flex-wrap:nowrap;gap:var(--van-bot-mobile-context-tags-gap);width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.van-bot-mobile-context-tags__item{box-sizing:border-box;display:flex;flex:none;align-items:center;justify-content:center;min-height:44px;padding:var(--van-bot-mobile-context-tags-padding);color:var(--van-bot-mobile-context-tags-color);font-size:var(--van-bot-mobile-context-tags-font-size);line-height:var(--van-bot-mobile-context-tags-line-height);white-space:nowrap;background:var(--van-bot-mobile-context-tags-background-color);border-radius:var(--van-bot-mobile-context-tags-border-radius);cursor:pointer}.van-bot-mobile-context-tags__item:active{opacity:var(--van-bot-mobile-context-tags-active-opacity)}.van-bot-mobile-context-tags__item--selected{color:var(--van-bot-mobile-context-tags-selected-color);background:var(--van-bot-mobile-context-tags-selected-background-color)}.van-bot-mobile-fab{position:fixed;z-index:var(--van-bot-mobile-fab-z-index);box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:var(--van-bot-mobile-fab-size);height:var(--van-bot-mobile-fab-size);color:var(--van-bot-mobile-fab-color);background:var(--van-bot-mobile-fab-background);border-radius:50%;box-shadow:var(--van-bot-mobile-fab-shadow);cursor:pointer;touch-action:none;transition:left .25s ease,right .25s ease,top .25s ease}.van-bot-mobile-fab--dragging{transition:none}.van-bot-mobile-fab__icon{font-size:24px}.van-bot-mobile-history-drawer{box-sizing:border-box;display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.van-bot-mobile-history-drawer__header{box-sizing:border-box;display:flex;flex:none;align-items:center;justify-content:space-between;height:var(--van-bot-mobile-history-drawer-header-height);padding:0 16px;border-bottom:1px solid var(--van-bot-mobile-border-color)}.van-bot-mobile-history-drawer__close,.van-bot-mobile-history-drawer__create{display:flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;font-size:20px;cursor:pointer}.van-bot-mobile-history-drawer__title{overflow:hidden;color:var(--van-bot-mobile-history-drawer-title-color);font-size:var(--van-font-size-lg);font-weight:500;text-align:center;text-overflow:ellipsis;white-space:nowrap}.van-bot-mobile-history-drawer__search{flex:none}.van-bot-mobile-history-drawer__list{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch}.van-bot-mobile-session-item{box-sizing:border-box;display:flex;align-items:center;min-height:44px;padding:8px 16px;border-bottom:1px solid var(--van-bot-mobile-border-color)}.van-bot-mobile-session-item--active{background:var(--van-bot-mobile-session-item-active-background)}.van-bot-mobile-session-item__body{display:flex;flex:1;flex-direction:column;justify-content:center;min-width:0;min-height:44px;cursor:pointer}.van-bot-mobile-session-item__name{overflow:hidden;color:var(--van-bot-mobile-session-item-name-color);font-size:var(--van-font-size-md);line-height:1.4;text-overflow:ellipsis;white-space:nowrap}.van-bot-mobile-session-item__meta{display:flex;gap:8px;overflow:hidden;color:var(--van-bot-mobile-session-item-meta-color);font-size:var(--van-font-size-sm);line-height:1.4}.van-bot-mobile-session-item__preview{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.van-bot-mobile-session-item__time{flex:none}.van-bot-mobile-session-item__input{flex:1;box-sizing:border-box;min-height:44px;padding:0 8px;color:var(--van-bot-mobile-session-item-name-color);font-size:var(--van-font-size-md);background:var(--van-background-color);border:1px solid var(--van-bot-mobile-primary-color);border-radius:var(--van-border-radius-md);outline:none}.van-bot-mobile-session-item__actions{display:flex;flex:none;gap:4px;margin-left:8px}.van-bot-mobile-session-item__action{display:flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;color:var(--van-bot-mobile-session-item-action-color);font-size:18px;cursor:pointer}.van-bot-mobile-session-item__action--danger{color:var(--van-bot-mobile-session-item-danger-color)}.van-bot-mobile-voice-bar{box-sizing:border-box;display:flex;align-items:center;justify-content:center;height:var(--van-bot-mobile-voice-bar-height);padding:0 16px;background:var(--van-bot-mobile-voice-bar-background);border:1px solid var(--van-bot-mobile-voice-bar-border-color);border-radius:var(--van-border-radius-lg);cursor:pointer;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.van-bot-mobile-voice-bar--recording{background:var(--van-bot-mobile-voice-bar-recording-background)}.van-bot-mobile-voice-bar--cancel-zone{background:var(--van-bot-mobile-voice-bar-cancel-zone-background)}.van-bot-mobile-voice-bar__wave{width:100%;height:32px;color:var(--van-bot-mobile-voice-bar-wave-color)}.van-bot-mobile-voice-bar__info{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:2px}.van-bot-mobile-voice-bar__elapsed{color:var(--van-bot-mobile-voice-bar-elapsed-color);font-size:var(--van-font-size-sm)}.van-bot-mobile-voice-bar__hint{color:var(--van-bot-mobile-voice-bar-hint-color);font-size:var(--van-font-size-sm)}.van-bot-mobile-voice-bar__transcribing{display:flex;align-items:center;gap:8px}.van-bot-mobile-voice-bar__transcribing-text{color:var(--van-bot-mobile-voice-bar-hint-color);font-size:var(--van-font-size-sm)}.van-bot-mobile-session-list{display:flex;flex-direction:column;width:100%;height:100%}.van-bot-mobile-session-list__toolbar{box-sizing:border-box;display:flex;flex:none;align-items:center;gap:8px;padding:var(--van-bot-mobile-session-list-toolbar-padding)}.van-bot-mobile-session-list__search{flex:1}.van-bot-mobile-session-list__create{display:flex;flex:none;align-items:center;justify-content:center;min-width:44px;min-height:44px;color:var(--van-bot-mobile-session-list-create-color);font-size:20px;cursor:pointer}.van-bot-mobile-session-list__list{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch}.van-bot-mobile-session-list__loading{display:flex;flex:1;align-items:center;justify-content:center;padding:32px 0}.van-bot-mobile-session-list__empty{flex:1}
|