@easyv/biz-components 1.0.24 → 1.0.26
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/_virtual/index.es2.js +2 -2
- package/dist/_virtual/index.es3.js +2 -2
- package/dist/_virtual/index.es4.js +2 -2
- package/dist/components/ai-model-select/ai-model-select-panel.d.ts +6 -0
- package/dist/components/ai-model-select/ai-model-select-panel.es.js +32 -5
- package/dist/components/ai-model-select/ai-model-select-panel.es.js.map +1 -1
- package/dist/index.es.js +4 -1
- package/dist/index.es.js.map +1 -1
- package/dist/node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/.pnpm/co-web-worker@1.0.1/node_modules/co-web-worker/index.es.js +1 -1
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.es.js +1 -1
- package/dist/stats.html +1 -1
- package/dist/tailwindcss.pkg.css +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/wait-something/index.d.ts +9 -0
- package/dist/utils/wait-something/index.es.js +21 -0
- package/dist/utils/wait-something/index.es.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { InputRef } from 'antd';
|
|
1
2
|
import { AiModel, AiModelServiceProvider } from './types';
|
|
2
3
|
|
|
3
4
|
export interface AiModelSelectPanelProps {
|
|
4
5
|
className?: string;
|
|
5
6
|
modelServiceProviderList: AiModelServiceProvider[];
|
|
7
|
+
value?: {
|
|
8
|
+
modelProviderId: string;
|
|
9
|
+
modelId: string;
|
|
10
|
+
};
|
|
6
11
|
onSelect?: (AiModelServiceProvider: AiModelServiceProvider, model: AiModel) => void;
|
|
7
12
|
style?: React.CSSProperties;
|
|
8
13
|
titleClassName?: string;
|
|
@@ -12,6 +17,7 @@ export interface AiModelSelectPanelProps {
|
|
|
12
17
|
onChange: (value: string) => void;
|
|
13
18
|
onPressEnter: () => void;
|
|
14
19
|
onBlur: () => void;
|
|
20
|
+
ref: React.Ref<InputRef>;
|
|
15
21
|
}) => React.ReactNode;
|
|
16
22
|
}
|
|
17
23
|
export declare const AiModelSelectPanel: (props: AiModelSelectPanelProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useRef, useState, useEffect } from "react";
|
|
3
3
|
import { PlusOutlined, EditOutlined } from "../../node_modules/.pnpm/@easyv_react-icons@6.3.0/node_modules/@easyv/react-icons/dist/index.esm.es.js";
|
|
4
4
|
import classNames from "../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js";
|
|
5
5
|
import { produce } from "../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/dist/immer.es.js";
|
|
@@ -8,18 +8,41 @@ const AiModelSelectPanel = (props) => {
|
|
|
8
8
|
const {
|
|
9
9
|
className = "",
|
|
10
10
|
modelServiceProviderList,
|
|
11
|
+
value,
|
|
11
12
|
onSelect,
|
|
12
13
|
style,
|
|
13
14
|
titleClassName,
|
|
14
15
|
itemClassName,
|
|
15
16
|
renderInput
|
|
16
17
|
} = props;
|
|
18
|
+
const inputRef = useRef(null);
|
|
17
19
|
const [customModelServiceProviderList, setCustomModelServiceProviderList] = useState(
|
|
18
20
|
modelServiceProviderList.filter((item) => item.isCustom)
|
|
19
21
|
);
|
|
20
22
|
const [showInputProviderId, setShowInputProviderId] = useState("");
|
|
21
23
|
const [inputValue, setInputValue] = useState("");
|
|
22
24
|
const otherModelServiceProviderList = modelServiceProviderList.filter((item) => !item.isCustom);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!showInputProviderId) return;
|
|
27
|
+
const focusTimer = setTimeout(() => {
|
|
28
|
+
var _a;
|
|
29
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
30
|
+
}, 0);
|
|
31
|
+
const scrollTimer = setTimeout(() => {
|
|
32
|
+
const targetElement = document.querySelector(`[data-provider-id="${showInputProviderId}"]`);
|
|
33
|
+
if (targetElement) {
|
|
34
|
+
targetElement.scrollIntoView({
|
|
35
|
+
behavior: "smooth",
|
|
36
|
+
block: "nearest",
|
|
37
|
+
inline: "nearest"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, 0);
|
|
41
|
+
return () => {
|
|
42
|
+
clearTimeout(focusTimer);
|
|
43
|
+
clearTimeout(scrollTimer);
|
|
44
|
+
};
|
|
45
|
+
}, [showInputProviderId]);
|
|
23
46
|
const handleSelect = (modelProvider, model) => {
|
|
24
47
|
onSelect == null ? void 0 : onSelect(modelProvider, model);
|
|
25
48
|
};
|
|
@@ -86,13 +109,16 @@ const AiModelSelectPanel = (props) => {
|
|
|
86
109
|
setInputValue("");
|
|
87
110
|
}
|
|
88
111
|
};
|
|
112
|
+
const isSelected = (value == null ? void 0 : value.modelProviderId) === modelProvider.id && (value == null ? void 0 : value.modelId) === (model == null ? void 0 : model.id);
|
|
89
113
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
90
114
|
"div",
|
|
91
115
|
{
|
|
116
|
+
"data-provider-id": modelProvider.id,
|
|
92
117
|
className: classNames(
|
|
93
118
|
"biz-px-3 biz-py-[3px] biz-flex biz-items-center biz-gap-2",
|
|
94
119
|
"biz-text-text-2 biz-h-8 biz-w-full biz-box-border",
|
|
95
120
|
"hover:biz-bg-bg-white biz-cursor-pointer biz-group",
|
|
121
|
+
isSelected && "biz-bg-bg-white",
|
|
96
122
|
itemClassName
|
|
97
123
|
),
|
|
98
124
|
onClick: () => {
|
|
@@ -102,12 +128,13 @@ const AiModelSelectPanel = (props) => {
|
|
|
102
128
|
},
|
|
103
129
|
children: showInputProviderId === modelProvider.id ? renderInput({
|
|
104
130
|
value: inputValue,
|
|
105
|
-
onChange: (
|
|
131
|
+
onChange: (value2) => setInputValue(value2),
|
|
106
132
|
onPressEnter: handlePressEnter,
|
|
107
|
-
onBlur: handlePressEnter
|
|
133
|
+
onBlur: handlePressEnter,
|
|
134
|
+
ref: inputRef
|
|
108
135
|
}) : normalContent
|
|
109
136
|
},
|
|
110
|
-
model == null ? void 0 : model.id
|
|
137
|
+
(model == null ? void 0 : model.id) || `input-${modelProvider.id}`
|
|
111
138
|
);
|
|
112
139
|
};
|
|
113
140
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -115,7 +142,7 @@ const AiModelSelectPanel = (props) => {
|
|
|
115
142
|
{
|
|
116
143
|
style,
|
|
117
144
|
className: classNames(
|
|
118
|
-
"biz-bg-[#181B22] biz-border-one biz-rounded-[4px] biz-py-1",
|
|
145
|
+
"biz-bg-[#181B22] biz-border-one biz-rounded-[4px] biz-py-1 biz-h-[200px]",
|
|
119
146
|
"biz-flex biz-flex-col gap-1 biz-w-[160px] biz-max-h-[450px] biz-overflow-auto",
|
|
120
147
|
className
|
|
121
148
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-model-select-panel.es.js","sources":["../../../src/components/ai-model-select/ai-model-select-panel.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { EditOutlined, PlusOutlined } from '@easyv/react-icons';\nimport classNames from 'classnames';\nimport { produce } from 'immer';\nimport { IconBtn } from './iconBtn';\nimport { AiModel, AiModelServiceProvider } from './types';\n\nexport interface AiModelSelectPanelProps {\n className?: string;\n modelServiceProviderList: AiModelServiceProvider[];\n onSelect?: (AiModelServiceProvider: AiModelServiceProvider, model: AiModel) => void;\n style?: React.CSSProperties;\n titleClassName?: string;\n itemClassName?: string;\n renderInput: (props: {\n value: string;\n onChange: (value: string) => void;\n onPressEnter: () => void;\n onBlur: () => void;\n }) => React.ReactNode;\n}\n\nexport const AiModelSelectPanel = (props: AiModelSelectPanelProps) => {\n const {\n className = '',\n modelServiceProviderList,\n onSelect,\n style,\n titleClassName,\n itemClassName,\n renderInput,\n } = props;\n\n const [customModelServiceProviderList, setCustomModelServiceProviderList] = useState(\n modelServiceProviderList.filter((item) => item.isCustom),\n );\n const [showInputProviderId, setShowInputProviderId] = useState<string>('');\n const [inputValue, setInputValue] = useState<string>('');\n\n const otherModelServiceProviderList = modelServiceProviderList.filter((item) => !item.isCustom);\n\n const handleSelect = (modelProvider: AiModelServiceProvider, model: AiModel) => {\n onSelect?.(modelProvider, model);\n };\n\n const renderTitle = (modelProvider: AiModelServiceProvider) => {\n return (\n <div\n className={classNames(\n 'biz-h-6 biz-text-text-3 biz-px-3 biz-pt-1 biz-w-full',\n 'biz-flex biz-items-center biz-box-border biz-gap-2.5 biz-text-[14px]',\n titleClassName,\n )}\n title={modelProvider.name}\n >\n <div className='biz-w-0 biz-flex-1 biz-truncate'>{modelProvider.name}</div>\n {modelProvider.isCustom && modelProvider.modelList.length === 0 && (\n <IconBtn\n onClick={() => {\n setShowInputProviderId(modelProvider.id);\n }}\n icon={\n <PlusOutlined className='biz-w-3 biz-h-3 biz-text-text-2 hover:biz-text-text-1 biz-flex-center' />\n }\n />\n )}\n </div>\n );\n };\n\n const renderItem = (modelProvider: AiModelServiceProvider, model?: AiModel) => {\n if (modelProvider.isCustom) {\n if (modelProvider.id !== showInputProviderId && !modelProvider.modelList?.length) {\n return null;\n }\n }\n const normalContent = (\n <>\n <img src={modelProvider.iconSrc} className='biz-w-4 biz-h-4' />\n <div className='biz-truncate biz-w-0 biz-flex-1 biz-text-[14px]' title={model?.name}>\n {model?.name}\n </div>\n {modelProvider.isCustom && (\n <IconBtn\n onClick={(e) => {\n setShowInputProviderId(modelProvider.id);\n setInputValue(model?.name || '');\n e.stopPropagation();\n }}\n className='biz-hidden group-hover:!biz-flex'\n style={{ display: 'none' }}\n icon={\n <EditOutlined className='biz-w-3 biz-h-3 biz-text-text-2 hover:biz-text-text-1 biz-flex-center' />\n }\n />\n )}\n </>\n );\n\n const handlePressEnter = () => {\n if (inputValue) {\n setCustomModelServiceProviderList(\n produce(customModelServiceProviderList, (draft) => {\n const index = draft.findIndex((i) => i.id === modelProvider.id);\n if (index !== -1) {\n draft[index].modelList = [{ id: inputValue, name: inputValue }];\n }\n }),\n );\n setShowInputProviderId('');\n setInputValue('');\n }\n };\n\n return (\n <div\n key={model?.id}\n className={classNames(\n 'biz-px-3 biz-py-[3px] biz-flex biz-items-center biz-gap-2',\n 'biz-text-text-2 biz-h-8 biz-w-full biz-box-border',\n 'hover:biz-bg-bg-white biz-cursor-pointer biz-group',\n itemClassName,\n )}\n onClick={() => {\n if (model && !showInputProviderId) {\n handleSelect(modelProvider, model);\n }\n }}\n >\n {showInputProviderId === modelProvider.id\n ? renderInput({\n value: inputValue,\n onChange: (value) => setInputValue(value),\n onPressEnter: handlePressEnter,\n onBlur: handlePressEnter,\n })\n : normalContent}\n </div>\n );\n };\n\n return (\n <div\n style={style}\n className={classNames(\n 'biz-bg-[#181B22] biz-border-one biz-rounded-[4px] biz-py-1',\n 'biz-flex biz-flex-col gap-1 biz-w-[160px] biz-max-h-[450px] biz-overflow-auto',\n className,\n )}\n >\n {otherModelServiceProviderList.map((provider) => (\n <div\n key={provider.id}\n className='biz-flex biz-flex-col biz-gap-1 biz-w-full biz-box-border'\n >\n {renderTitle(provider)}\n <div className='biz-flex biz-flex-col gap-1 biz-w-full'>\n {provider.modelList.map((model) => renderItem(provider, model))}\n </div>\n </div>\n ))}\n {customModelServiceProviderList.map((provider) => (\n <div\n key={provider.id}\n className='biz-flex biz-flex-col biz-gap-1 biz-w-full biz-box-border'\n >\n {renderTitle(provider)}\n <div className='biz-flex biz-flex-col gap-1 biz-w-full'>\n {renderItem(provider, provider.modelList[0])}\n </div>\n </div>\n ))}\n </div>\n );\n};\n"],"names":["jsxs","jsx","Fragment"],"mappings":";;;;;;AAsBa,MAAA,qBAAqB,CAAC,UAAmC;AAC9D,QAAA;AAAA,IACJ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAEE,QAAA,CAAC,gCAAgC,i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A;AAAA,QACA;AAAA,MACF;AAAA,MAEC,UAAA;AAAA,QAA8B,8BAAA,IAAI,CAAC,aAClCA,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YAET,UAAA;AAAA,cAAA,YAAY,QAAQ;AAAA,cACpBC,kCAAAA,IAAA,OAAA,EAAI,WAAU,0CACZ,UAAS,SAAA,UAAU,IAAI,CAAC,UAAU,WAAW,UAAU,KAAK,CAAC,EAChE,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UANK,SAAS;AAAA,QAAA,CAQjB;AAAA,QACA,+BAA+B,IAAI,CAAC,aACnCD,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YAET,UAAA;AAAA,cAAA,YAAY,QAAQ;AAAA,cACrBC,kCAAAA,IAAC,OAAI,EAAA,WAAU,0CACZ,UAAA,WAAW,UAAU,SAAS,UAAU,CAAC,CAAC,EAC7C,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UANK,SAAS;AAAA,QAQjB,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ai-model-select-panel.es.js","sources":["../../../src/components/ai-model-select/ai-model-select-panel.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { EditOutlined, PlusOutlined } from '@easyv/react-icons';\nimport { InputRef } from 'antd';\nimport classNames from 'classnames';\nimport { produce } from 'immer';\nimport { IconBtn } from './iconBtn';\nimport { AiModel, AiModelServiceProvider } from './types';\n\nexport interface AiModelSelectPanelProps {\n className?: string;\n modelServiceProviderList: AiModelServiceProvider[];\n value?: {\n modelProviderId: string;\n modelId: string;\n };\n onSelect?: (AiModelServiceProvider: AiModelServiceProvider, model: AiModel) => void;\n style?: React.CSSProperties;\n titleClassName?: string;\n itemClassName?: string;\n renderInput: (props: {\n value: string;\n onChange: (value: string) => void;\n onPressEnter: () => void;\n onBlur: () => void;\n ref: React.Ref<InputRef>;\n }) => React.ReactNode;\n}\n\nexport const AiModelSelectPanel = (props: AiModelSelectPanelProps) => {\n const {\n className = '',\n modelServiceProviderList,\n value,\n onSelect,\n style,\n titleClassName,\n itemClassName,\n renderInput,\n } = props;\n\n const inputRef = useRef<InputRef>(null);\n\n const [customModelServiceProviderList, setCustomModelServiceProviderList] = useState(\n modelServiceProviderList.filter((item) => item.isCustom),\n );\n const [showInputProviderId, setShowInputProviderId] = useState<string>('');\n const [inputValue, setInputValue] = useState<string>('');\n\n const otherModelServiceProviderList = modelServiceProviderList.filter((item) => !item.isCustom);\n\n useEffect(() => {\n if (!showInputProviderId) return;\n\n // 聚焦到输入框\n const focusTimer = setTimeout(() => {\n inputRef.current?.focus();\n }, 0);\n\n // 滚动到输入框位置\n const scrollTimer = setTimeout(() => {\n // 使用唯一选择器查找包含输入框的元素\n const targetElement = document.querySelector(`[data-provider-id=\"${showInputProviderId}\"]`);\n if (targetElement) {\n targetElement.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n }\n }, 0);\n\n return () => {\n clearTimeout(focusTimer);\n clearTimeout(scrollTimer);\n };\n }, [showInputProviderId]);\n\n const handleSelect = (modelProvider: AiModelServiceProvider, model: AiModel) => {\n onSelect?.(modelProvider, model);\n };\n\n const renderTitle = (modelProvider: AiModelServiceProvider) => {\n return (\n <div\n className={classNames(\n 'biz-h-6 biz-text-text-3 biz-px-3 biz-pt-1 biz-w-full',\n 'biz-flex biz-items-center biz-box-border biz-gap-2.5 biz-text-[14px]',\n titleClassName,\n )}\n title={modelProvider.name}\n >\n <div className='biz-w-0 biz-flex-1 biz-truncate'>{modelProvider.name}</div>\n {modelProvider.isCustom && modelProvider.modelList.length === 0 && (\n <IconBtn\n onClick={() => {\n setShowInputProviderId(modelProvider.id);\n }}\n icon={\n <PlusOutlined className='biz-w-3 biz-h-3 biz-text-text-2 hover:biz-text-text-1 biz-flex-center' />\n }\n />\n )}\n </div>\n );\n };\n\n const renderItem = (modelProvider: AiModelServiceProvider, model?: AiModel) => {\n if (modelProvider.isCustom) {\n if (modelProvider.id !== showInputProviderId && !modelProvider.modelList?.length) {\n return null;\n }\n }\n const normalContent = (\n <>\n <img src={modelProvider.iconSrc} className='biz-w-4 biz-h-4' />\n <div className='biz-truncate biz-w-0 biz-flex-1 biz-text-[14px]' title={model?.name}>\n {model?.name}\n </div>\n {modelProvider.isCustom && (\n <IconBtn\n onClick={(e) => {\n setShowInputProviderId(modelProvider.id);\n setInputValue(model?.name || '');\n e.stopPropagation();\n }}\n className='biz-hidden group-hover:!biz-flex'\n style={{ display: 'none' }}\n icon={\n <EditOutlined className='biz-w-3 biz-h-3 biz-text-text-2 hover:biz-text-text-1 biz-flex-center' />\n }\n />\n )}\n </>\n );\n\n const handlePressEnter = () => {\n if (inputValue) {\n setCustomModelServiceProviderList(\n produce(customModelServiceProviderList, (draft) => {\n const index = draft.findIndex((i) => i.id === modelProvider.id);\n if (index !== -1) {\n draft[index].modelList = [{ id: inputValue, name: inputValue }];\n }\n }),\n );\n setShowInputProviderId('');\n setInputValue('');\n }\n };\n\n const isSelected = value?.modelProviderId === modelProvider.id && value?.modelId === model?.id;\n\n return (\n <div\n key={model?.id || `input-${modelProvider.id}`}\n data-provider-id={modelProvider.id}\n className={classNames(\n 'biz-px-3 biz-py-[3px] biz-flex biz-items-center biz-gap-2',\n 'biz-text-text-2 biz-h-8 biz-w-full biz-box-border',\n 'hover:biz-bg-bg-white biz-cursor-pointer biz-group',\n isSelected && 'biz-bg-bg-white',\n itemClassName,\n )}\n onClick={() => {\n if (model && !showInputProviderId) {\n handleSelect(modelProvider, model);\n }\n }}\n >\n {showInputProviderId === modelProvider.id\n ? renderInput({\n value: inputValue,\n onChange: (value) => setInputValue(value),\n onPressEnter: handlePressEnter,\n onBlur: handlePressEnter,\n ref: inputRef,\n })\n : normalContent}\n </div>\n );\n };\n\n return (\n <div\n style={style}\n className={classNames(\n 'biz-bg-[#181B22] biz-border-one biz-rounded-[4px] biz-py-1 biz-h-[200px]',\n 'biz-flex biz-flex-col gap-1 biz-w-[160px] biz-max-h-[450px] biz-overflow-auto',\n className,\n )}\n >\n {otherModelServiceProviderList.map((provider) => (\n <div\n key={provider.id}\n className='biz-flex biz-flex-col biz-gap-1 biz-w-full biz-box-border'\n >\n {renderTitle(provider)}\n <div className='biz-flex biz-flex-col gap-1 biz-w-full'>\n {provider.modelList.map((model) => renderItem(provider, model))}\n </div>\n </div>\n ))}\n {customModelServiceProviderList.map((provider) => (\n <div\n key={provider.id}\n className='biz-flex biz-flex-col biz-gap-1 biz-w-full biz-box-border'\n >\n {renderTitle(provider)}\n <div className='biz-flex biz-flex-col gap-1 biz-w-full'>\n {renderItem(provider, provider.modelList[0])}\n </div>\n </div>\n ))}\n </div>\n );\n};\n"],"names":["jsxs","jsx","Fragment","value"],"mappings":";;;;;;AA4Ba,MAAA,qBAAqB,CAAC,UAAmC;AAC9D,QAAA;AAAA,IACJ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAEE,QAAA,WAAW,OAAiB,IAAI;AAEhC,QAAA,CAAC,gCAAgC,iCAAiC,IAAI;AAAA,IAC1E,yBAAyB,OAAO,CAAC,SAAS,KAAK,QAAQ;AAAA,EACzD;AACA,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAiB,EAAE;AACzE,QAAM,CAAC,YAAY,aAAa,IAAI,SAAiB,EAAE;AAEvD,QAAM,gCAAgC,yBAAyB,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ;AAE9F,YAAU,MAAM;AACd,QAAI,CAAC,oBAAqB;AAGpB,UAAA,aAAa,WAAW,MAAM;;AAClC,qBAAS,YAAT,mBAAkB;AAAA,OACjB,CAAC;AAGE,UAAA,cAAc,WAAW,MAAM;AAEnC,YAAM,gBAAgB,SAAS,cAAc,sBAAsB,mBAAmB,IAAI;AAC1F,UAAI,eAAe;AACjB,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Ac,EAAE;AAAA,IAwB7C;AAAA,EAEJ;AAGE,SAAAH,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC,UAAA;AAAA,QAA8B,8BAAA,IAAI,CAAC,aAClCA,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YAET,UAAA;AAAA,cAAA,YAAY,QAAQ;AAAA,cACpBC,kCAAAA,IAAA,OAAA,EAAI,WAAU,0CACZ,UAAS,SAAA,UAAU,IAAI,CAAC,UAAU,WAAW,UAAU,KAAK,CAAC,EAChE,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UANK,SAAS;AAAA,QAAA,CAQjB;AAAA,QACA,+BAA+B,IAAI,CAAC,aACnCD,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YAET,UAAA;AAAA,cAAA,YAAY,QAAQ;AAAA,cACrBC,kCAAAA,IAAC,OAAI,EAAA,WAAU,0CACZ,UAAA,WAAW,UAAU,SAAS,UAAU,CAAC,CAAC,EAC7C,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UANK,SAAS;AAAA,QAQjB,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|
package/dist/index.es.js
CHANGED
|
@@ -21,6 +21,7 @@ import { XFStreamVoiceManager } from "./utils/xun-fei-voice/XF-stream-voice-mana
|
|
|
21
21
|
import { RecorderManager } from "./utils/xun-fei-voice/recorder-manager/RecorderManager.es.js";
|
|
22
22
|
import { AudioManager, defaultSampleRate } from "./utils/vosk-browser-manager/audio-manager/audio-manager.es.js";
|
|
23
23
|
import { VoskBrowserManager } from "./utils/vosk-browser-manager/vosk-browser-manager.es.js";
|
|
24
|
+
import { wait, waitSomeThingBeTrue } from "./utils/wait-something/index.es.js";
|
|
24
25
|
import { EasyvInput } from "./ant-components/input/input.es.js";
|
|
25
26
|
export {
|
|
26
27
|
AiAgentMessageType,
|
|
@@ -60,6 +61,8 @@ export {
|
|
|
60
61
|
useInitialized,
|
|
61
62
|
useSocketEvents,
|
|
62
63
|
useWatchValue,
|
|
63
|
-
useXunFeiSteamVoiceManager
|
|
64
|
+
useXunFeiSteamVoiceManager,
|
|
65
|
+
wait,
|
|
66
|
+
waitSomeThingBeTrue
|
|
64
67
|
};
|
|
65
68
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as classnames$1 } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as classnames$1 } from "../../../../../_virtual/index.es3.js";
|
|
3
3
|
/*!
|
|
4
4
|
Copyright (c) 2018 Jed Watson.
|
|
5
5
|
Licensed under the MIT License (MIT), see
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as coWebWorker } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as coWebWorker } from "../../../../../_virtual/index.es4.js";
|
|
3
3
|
class CrossOriginWorker extends Worker {
|
|
4
4
|
constructor(scriptUrl) {
|
|
5
5
|
const b = new Blob([`importScripts('${new URL(scriptUrl).toString()}')`], { type: "application/javascript" });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as propTypes } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as propTypes } from "../../../../../_virtual/index.es2.js";
|
|
3
3
|
import { __require as requireReactIs } from "../../../react-is@16.13.1/node_modules/react-is/index.es.js";
|
|
4
4
|
import { __require as requireFactoryWithTypeCheckers } from "./factoryWithTypeCheckers.es.js";
|
|
5
5
|
import { __require as requireFactoryWithThrowingShims } from "./factoryWithThrowingShims.es.js";
|