zcw-shared 1.5.0 → 1.8.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/README.md +93 -363
- package/dist/constants/colorPatterns.d.ts +8 -2
- package/dist/constants/colorPatterns.js.map +1 -1
- package/dist/constants/namedColors.d.ts +16 -2
- package/dist/constants/namedColors.js.map +1 -1
- package/dist/constants/softwareConfigs.d.ts +0 -1
- package/dist/constants/softwareConfigs.js +0 -1
- package/dist/constants/softwareConfigs.js.map +1 -1
- package/dist/functions/ag-grid/generateLicense.d.ts +2 -2
- package/dist/functions/android/buildProject.d.ts +12 -0
- package/dist/functions/android/buildProject.js +123 -0
- package/dist/functions/android/buildProject.js.map +1 -0
- package/dist/functions/android/modifyGradle.d.ts +17 -0
- package/dist/functions/android/modifyGradle.js +69 -0
- package/dist/functions/android/modifyGradle.js.map +1 -0
- package/dist/functions/android/modifyManifest.d.ts +23 -0
- package/dist/functions/android/modifyManifest.js +198 -0
- package/dist/functions/android/modifyManifest.js.map +1 -0
- package/dist/functions/android/permission.d.ts +30 -0
- package/dist/functions/android/permission.js +65 -0
- package/dist/functions/android/permission.js.map +1 -0
- package/dist/functions/color/colorValidation.d.ts +11 -0
- package/dist/functions/color/colorValidation.js +35 -0
- package/dist/functions/color/colorValidation.js.map +1 -0
- package/dist/functions/color/convertColor.d.ts +0 -1
- package/dist/functions/color/convertColor.js +135 -166
- package/dist/functions/color/convertColor.js.map +1 -1
- package/dist/functions/color/deduplicateColors.js +23 -38
- package/dist/functions/color/deduplicateColors.js.map +1 -1
- package/dist/functions/color/detectColorFormat.d.ts +8 -2
- package/dist/functions/color/detectColorFormat.js +49 -51
- package/dist/functions/color/detectColorFormat.js.map +1 -1
- package/dist/functions/color/extractColors.js +48 -18
- package/dist/functions/color/extractColors.js.map +1 -1
- package/dist/functions/css/extractCssVariables.d.ts +1 -1
- package/dist/functions/css/extractCssVariables.js +1 -1
- package/dist/functions/css/extractCssVariables.js.map +1 -1
- package/dist/functions/debug/createDebugger.d.ts +8 -7
- package/dist/functions/debug/createDebugger.js +49 -39
- package/dist/functions/debug/createDebugger.js.map +1 -1
- package/dist/functions/dom/detectOverflow.d.ts +3 -3
- package/dist/functions/dom/detectOverflow.js +3 -3
- package/dist/functions/dom/detectOverflow.js.map +1 -1
- package/dist/functions/dom/getElementRect.d.ts +1 -1
- package/dist/functions/dom/getElementRect.js.map +1 -1
- package/dist/functions/dom/getRelativePosition.d.ts +1 -1
- package/dist/functions/dom/getRelativePosition.js.map +1 -1
- package/dist/functions/dom/getViewportRect.d.ts +2 -2
- package/dist/functions/dom/getViewportRect.js +2 -2
- package/dist/functions/dom/getViewportRect.js.map +1 -1
- package/dist/functions/dom/getViewportSize.d.ts +2 -2
- package/dist/functions/dom/getViewportSize.js.map +1 -1
- package/dist/functions/image/generateMacIcons.d.ts +3 -3
- package/dist/functions/image/generateMacIcons.js.map +1 -1
- package/dist/functions/image/generateMacTrayIcon.d.ts +3 -3
- package/dist/functions/image/generateMacTrayIcon.js.map +1 -1
- package/dist/functions/image/generatePaddedImage.d.ts +2 -2
- package/dist/functions/image/generatePaddedImage.js.map +1 -1
- package/dist/functions/image/generatePwaIcons.d.ts +3 -3
- package/dist/functions/image/generatePwaIcons.js.map +1 -1
- package/dist/functions/image/generateRoundedImage.d.ts +2 -2
- package/dist/functions/image/generateRoundedImage.js.map +1 -1
- package/dist/functions/ipc/dispatchIpcRequest.d.ts +2 -2
- package/dist/functions/ipc/dispatchIpcRequest.js +1 -1
- package/dist/functions/ipc/dispatchIpcRequest.js.map +1 -1
- package/dist/functions/software/findSoftware.d.ts +3 -3
- package/dist/functions/software/findSoftware.js +7 -9
- package/dist/functions/software/findSoftware.js.map +1 -1
- package/dist/functions/string/base64.d.ts +1 -1
- package/dist/functions/string/capitalize.js.map +1 -1
- package/dist/functions/string/caseConverter.d.ts +0 -1
- package/dist/functions/string/caseConverter.js +1 -8
- package/dist/functions/string/caseConverter.js.map +1 -1
- package/dist/functions/string/desensitize.js.map +1 -1
- package/dist/functions/string/htmlEscape.d.ts +4 -1
- package/dist/functions/string/htmlEscape.js +37 -25
- package/dist/functions/string/htmlEscape.js.map +1 -1
- package/dist/functions/string/levenshtein.js.map +1 -1
- package/dist/functions/string/normalize.js.map +1 -1
- package/dist/functions/string/pad.d.ts +0 -1
- package/dist/functions/string/pad.js +0 -3
- package/dist/functions/string/pad.js.map +1 -1
- package/dist/functions/string/palindrome.js.map +1 -1
- package/dist/functions/string/similarity.js.map +1 -1
- package/dist/functions/string/template.js.map +1 -1
- package/dist/functions/string/wordCount.js.map +1 -1
- package/dist/functions/tencent-cloud/getSecret.js.map +1 -1
- package/dist/functions/uniapp/app-plus/androidProjectStrategy.d.ts +7 -7
- package/dist/functions/uniapp/app-plus/androidProjectStrategy.js.map +1 -1
- package/dist/functions/uniapp/app-plus/buildAndroidApp.d.ts +2 -2
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js +98 -24
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js.map +1 -1
- package/dist/functions/uniapp/app-plus/configureAndroidManifest.d.ts +2 -2
- package/dist/functions/uniapp/app-plus/configureAndroidManifest.js.map +1 -1
- package/dist/functions/uniapp/app-plus/configureBuildGradle.d.ts +3 -3
- package/dist/functions/uniapp/app-plus/configureBuildGradle.js.map +1 -1
- package/dist/functions/uniapp/app-plus/configureDcloudControl.d.ts +2 -2
- package/dist/functions/uniapp/app-plus/configureDcloudControl.js.map +1 -1
- package/dist/functions/uniapp/app-plus/configureStrings.d.ts +2 -2
- package/dist/functions/uniapp/app-plus/configureStrings.js.map +1 -1
- package/dist/functions/uniapp/app-plus/copyAppResources.d.ts +2 -2
- package/dist/functions/uniapp/app-plus/copyAppResources.js.map +1 -1
- package/dist/functions/uniapp/app-plus/parseManifest.d.ts +2 -2
- package/dist/functions/uniapp/app-plus/parseManifest.js.map +1 -1
- package/dist/functions/uniapp/app-plus/validateOptions.d.ts +2 -2
- package/dist/functions/uniapp/app-plus/validateOptions.js.map +1 -1
- package/dist/functions/uniapp/build.d.ts +20 -0
- package/dist/functions/uniapp/build.js +84 -0
- package/dist/functions/uniapp/build.js.map +1 -0
- package/dist/functions/uniapp/detectAndroidProjectStructure.d.ts +7 -0
- package/dist/functions/uniapp/detectAndroidProjectStructure.js +30 -0
- package/dist/functions/uniapp/detectAndroidProjectStructure.js.map +1 -0
- package/dist/functions/uniapp/detectProjectType.d.ts +16 -0
- package/dist/functions/uniapp/detectProjectType.js +68 -0
- package/dist/functions/uniapp/detectProjectType.js.map +1 -0
- package/dist/functions/uniapp/parseManifest.d.ts +12 -0
- package/dist/functions/uniapp/parseManifest.js +46 -0
- package/dist/functions/uniapp/parseManifest.js.map +1 -0
- package/dist/functions/uniapp/waitForPages.d.ts +3 -2
- package/dist/functions/uniapp/waitForPages.js.map +1 -1
- package/dist/functions/utils/compose.js.map +1 -1
- package/dist/functions/utils/cond.js.map +1 -1
- package/dist/functions/utils/curry.js.map +1 -1
- package/dist/functions/utils/debounce.js.map +1 -1
- package/dist/functions/utils/evolve.js.map +1 -1
- package/dist/functions/utils/flow.js.map +1 -1
- package/dist/functions/utils/generateExports.d.ts +16 -0
- package/dist/functions/utils/generateExports.js +34 -0
- package/dist/functions/utils/generateExports.js.map +1 -0
- package/dist/functions/utils/isType.js.map +1 -1
- package/dist/functions/utils/memoize.js.map +1 -1
- package/dist/functions/utils/once.js.map +1 -1
- package/dist/functions/utils/partial.js.map +1 -1
- package/dist/functions/utils/pipe.js.map +1 -1
- package/dist/functions/utils/retryWithBackoff.js.map +1 -1
- package/dist/functions/utils/tap.js.map +1 -1
- package/dist/functions/utils/throttle.js.map +1 -1
- package/dist/functions/utils/until.js.map +1 -1
- package/dist/functions/utils/validate.js.map +1 -1
- package/dist/functions/utils/walk.d.ts +11 -0
- package/dist/functions/utils/walk.js +27 -0
- package/dist/functions/utils/walk.js.map +1 -0
- package/dist/functions/vue/dynamicMount.d.ts +5 -5
- package/dist/functions/vue/dynamicMount.js +3 -1
- package/dist/functions/vue/dynamicMount.js.map +1 -1
- package/dist/functions/vue/extractColorsFromVueFile.js +2 -11
- package/dist/functions/vue/extractColorsFromVueFile.js.map +1 -1
- package/dist/functions/vue/extractColorsFromVueSection.js.map +1 -1
- package/dist/functions/vue/filterSections.js.map +1 -1
- package/dist/functions/vue/isVNode.js +3 -1
- package/dist/functions/vue/isVNode.js.map +1 -1
- package/dist/functions/vue/isVueComponent.js.map +1 -1
- package/dist/functions/vue/parseVueFile.js.map +1 -1
- package/dist/functions/wechat/miniapp/downloadFile.d.ts +2 -2
- package/dist/functions/wechat/miniapp/downloadFile.js +8 -8
- package/dist/functions/wechat/miniapp/downloadFile.js.map +1 -1
- package/dist/functions/xml/modifyXml.d.ts +11 -0
- package/dist/functions/xml/modifyXml.js +46 -0
- package/dist/functions/xml/modifyXml.js.map +1 -0
- package/dist/hooks/useAi.d.ts +3 -3
- package/dist/hooks/useAi.js.map +1 -1
- package/dist/hooks/useAltool.d.ts +3 -32
- package/dist/hooks/useAltool.js.map +1 -1
- package/dist/hooks/useFetch.d.ts +2 -2
- package/dist/hooks/useFetch.js.map +1 -1
- package/dist/hooks/useLocalStorage.d.ts +4 -4
- package/dist/hooks/useLocalStorage.js +51 -18
- package/dist/hooks/useLocalStorage.js.map +1 -1
- package/dist/hooks/useSessionStorage.d.ts +4 -4
- package/dist/hooks/useSessionStorage.js +51 -18
- package/dist/hooks/useSessionStorage.js.map +1 -1
- package/dist/hooks/useStorage.d.ts +10 -3
- package/dist/hooks/useStorage.js +33 -35
- package/dist/hooks/useStorage.js.map +1 -1
- package/dist/hooks/useStorageWithIndexedDB.d.ts +4 -4
- package/dist/hooks/useStorageWithIndexedDB.js +39 -29
- package/dist/hooks/useStorageWithIndexedDB.js.map +1 -1
- package/dist/hooks/useWASM.d.ts +2 -2
- package/dist/hooks/useWASM.js +6 -10
- package/dist/hooks/useWASM.js.map +1 -1
- package/dist/hooks/useWebWorker.d.ts +25 -4
- package/dist/hooks/useWebWorker.js.map +1 -1
- package/dist/hooks/useWorkerFunction.d.ts +22 -4
- package/dist/hooks/useWorkerFunction.js +1 -1
- package/dist/hooks/useWorkerFunction.js.map +1 -1
- package/dist/hooks/useWorkerPool.d.ts +30 -4
- package/dist/hooks/useWorkerPool.js.map +1 -1
- package/package.json +17 -22
- package/references/arraybuffer.d.ts +109 -0
- package/references/blob.d.ts +37 -0
- package/references/browser.d.ts +55 -160
- package/references/chrome.extension.d.ts +83 -0
- package/references/console.d.ts +3 -142
- package/references/{crypto.d.ts → crypto-js.d.ts} +1 -1
- package/references/dom.d.ts +41 -0
- package/references/encoding.d.ts +24 -0
- package/references/fetch.d.ts +6 -151
- package/references/indexeddb.d.ts +49 -0
- package/references/json5.d.ts +0 -7
- package/references/location.d.ts +16 -0
- package/references/node.d.ts +105 -94
- package/references/storage.d.ts +6 -100
- package/references/timer.d.ts +4 -5
- package/references/uniapp.d.ts +47 -5
- package/references/url.d.ts +9 -114
- package/references/vue.d.ts +71 -98
- package/references/webassembly.d.ts +96 -122
- package/references/wechat.d.ts +1 -1
- package/references/worker.d.ts +78 -132
- package/references/xml.d.ts +71 -39
- package/types/altool.d.ts +49 -17
- package/types/android-build.d.ts +31 -56
- package/types/color.d.ts +0 -90
- package/types/geometry.d.ts +1 -38
- package/types/platform.d.ts +4 -0
- package/types/software.d.ts +0 -12
- package/types/storage.d.ts +3 -1
- package/types/uniapp-android-build.d.ts +49 -0
- package/types/worker.d.ts +3 -189
- package/references/browser.extension.d.ts +0 -14
- package/types/network.d.ts +0 -184
- package/types/util.d.ts +0 -27
- package/types/wasm.d.ts +0 -217
package/references/uniapp.d.ts
CHANGED
|
@@ -1,9 +1,51 @@
|
|
|
1
1
|
// UniApp 环境类型声明
|
|
2
|
-
import type { TimerEnvironment } from './timer.d'
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* UniApp 页面实例接口
|
|
5
|
+
*/
|
|
6
|
+
export interface UniPage {
|
|
7
|
+
route: string
|
|
8
|
+
options: Record<string, any>
|
|
9
|
+
$vm: any
|
|
6
10
|
}
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
/**
|
|
13
|
+
* UniApp 全局对象
|
|
14
|
+
* 定义 UniApp 框架的完整能力
|
|
15
|
+
*/
|
|
16
|
+
export interface UniApp {
|
|
17
|
+
// 页面管理
|
|
18
|
+
getCurrentPages(): any[]
|
|
19
|
+
|
|
20
|
+
// 路由导航
|
|
21
|
+
navigateTo(options: { url: string; success?: () => void; fail?: () => void }): void
|
|
22
|
+
redirectTo(options: { url: string; success?: () => void; fail?: () => void }): void
|
|
23
|
+
switchTab(options: { url: string; success?: () => void; fail?: () => void }): void
|
|
24
|
+
navigateBack(options?: { delta?: number; success?: () => void; fail?: () => void }): void
|
|
25
|
+
reLaunch(options: { url: string; success?: () => void; fail?: () => void }): void
|
|
26
|
+
|
|
27
|
+
// UI 交互
|
|
28
|
+
showToast(options: { title: string; icon?: 'success' | 'loading' | 'none'; duration?: number }): void
|
|
29
|
+
hideToast(): void
|
|
30
|
+
showModal(options: { title?: string; content: string; showCancel?: boolean; success?: (res: { confirm: boolean; cancel: boolean }) => void }): void
|
|
31
|
+
showActionSheet(options: { itemList: string[]; success?: (res: { tapIndex: number }) => void }): void
|
|
32
|
+
|
|
33
|
+
// 系统信息
|
|
34
|
+
getSystemInfo(options: { success?: (res: any) => void; fail?: () => void }): void
|
|
35
|
+
|
|
36
|
+
// 本地存储
|
|
37
|
+
getStorageSync(key: string): any
|
|
38
|
+
setStorageSync(key: string, data: any): void
|
|
39
|
+
removeStorageSync(key: string): void
|
|
40
|
+
clearStorageSync(): void
|
|
41
|
+
|
|
42
|
+
// 网络请求
|
|
43
|
+
request(options: {
|
|
44
|
+
url: string
|
|
45
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE'
|
|
46
|
+
data?: any
|
|
47
|
+
header?: Record<string, string>
|
|
48
|
+
success?: (res: any) => void
|
|
49
|
+
fail?: () => void
|
|
50
|
+
}): void
|
|
51
|
+
}
|
package/references/url.d.ts
CHANGED
|
@@ -1,161 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
* URL API 类型定义
|
|
3
|
-
* 包含浏览器和 Node.js 环境都支持的 URL 相关 API
|
|
4
|
-
*/
|
|
1
|
+
// URL API 类型定义
|
|
5
2
|
|
|
6
3
|
/**
|
|
7
|
-
* URL
|
|
8
|
-
* 用于解析和构造 URL
|
|
4
|
+
* URL 解析和构造类
|
|
9
5
|
*/
|
|
10
6
|
declare class URL {
|
|
11
|
-
/**
|
|
12
|
-
* 构造函数
|
|
13
|
-
* @param url URL 字符串
|
|
14
|
-
* @param base 基础 URL(可选)
|
|
15
|
-
*/
|
|
16
7
|
constructor(url: string, base?: string | URL)
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
// URL 组成部分
|
|
19
10
|
href: string
|
|
20
|
-
|
|
21
|
-
/** URL 的源(协议 + 主机名 + 端口) */
|
|
22
11
|
origin: string
|
|
23
|
-
|
|
24
|
-
/** URL 的协议部分 */
|
|
25
12
|
protocol: string
|
|
26
|
-
|
|
27
|
-
/** URL 的主机名部分 */
|
|
28
13
|
hostname: string
|
|
29
|
-
|
|
30
|
-
/** URL 的端口部分 */
|
|
31
14
|
port: string
|
|
32
|
-
|
|
33
|
-
/** URL 的路径部分 */
|
|
34
15
|
pathname: string
|
|
35
|
-
|
|
36
|
-
/** URL 的查询字符串部分 */
|
|
37
16
|
search: string
|
|
38
|
-
|
|
39
|
-
/** URL 的哈希部分 */
|
|
40
17
|
hash: string
|
|
41
|
-
|
|
42
|
-
/** URL 的用户名部分 */
|
|
43
18
|
username: string
|
|
44
|
-
|
|
45
|
-
/** URL 的密码部分 */
|
|
46
19
|
password: string
|
|
47
|
-
|
|
48
|
-
/** URL 的主机部分(主机名 + 端口) */
|
|
49
20
|
host: string
|
|
50
21
|
|
|
51
|
-
|
|
22
|
+
// 查询参数
|
|
52
23
|
searchParams: URLSearchParams
|
|
53
24
|
|
|
54
|
-
|
|
55
|
-
* 返回 URL 的字符串表示
|
|
56
|
-
*/
|
|
25
|
+
// 序列化方法
|
|
57
26
|
toString(): string
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* 返回 URL 的 JSON 表示
|
|
61
|
-
*/
|
|
62
27
|
toJSON(): string
|
|
63
28
|
}
|
|
64
29
|
|
|
65
30
|
/**
|
|
66
|
-
*
|
|
67
|
-
* 用于处理 URL 查询参数
|
|
31
|
+
* URL 查询参数处理类
|
|
68
32
|
*/
|
|
69
33
|
declare class URLSearchParams {
|
|
70
|
-
/**
|
|
71
|
-
* 构造函数
|
|
72
|
-
* @param init 初始化参数
|
|
73
|
-
*/
|
|
74
34
|
constructor(init?: string | string[][] | Record<string, string> | URLSearchParams)
|
|
75
35
|
|
|
76
|
-
|
|
77
|
-
* 添加参数
|
|
78
|
-
* @param name 参数名
|
|
79
|
-
* @param value 参数值
|
|
80
|
-
*/
|
|
36
|
+
// 参数操作
|
|
81
37
|
append(name: string, value: string): void
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* 删除参数
|
|
85
|
-
* @param name 参数名
|
|
86
|
-
*/
|
|
87
38
|
delete(name: string): void
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* 获取参数值
|
|
91
|
-
* @param name 参数名
|
|
92
|
-
*/
|
|
93
39
|
get(name: string): string | null
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* 获取所有同名参数值
|
|
97
|
-
* @param name 参数名
|
|
98
|
-
*/
|
|
99
40
|
getAll(name: string): string[]
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* 检查是否存在参数
|
|
103
|
-
* @param name 参数名
|
|
104
|
-
*/
|
|
105
41
|
has(name: string): boolean
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* 设置参数值
|
|
109
|
-
* @param name 参数名
|
|
110
|
-
* @param value 参数值
|
|
111
|
-
*/
|
|
112
42
|
set(name: string, value: string): void
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* 排序参数
|
|
116
|
-
*/
|
|
117
43
|
sort(): void
|
|
118
44
|
|
|
119
|
-
|
|
120
|
-
* 返回字符串表示
|
|
121
|
-
*/
|
|
45
|
+
// 序列化
|
|
122
46
|
toString(): string
|
|
123
47
|
|
|
124
|
-
|
|
125
|
-
* 返回迭代器
|
|
126
|
-
*/
|
|
48
|
+
// 迭代器
|
|
127
49
|
[Symbol.iterator](): IterableIterator<[string, string]>
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* 返回键的迭代器
|
|
131
|
-
*/
|
|
132
50
|
keys(): IterableIterator<string>
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* 返回值的迭代器
|
|
136
|
-
*/
|
|
137
51
|
values(): IterableIterator<string>
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* 返回键值对的迭代器
|
|
141
|
-
*/
|
|
142
52
|
entries(): IterableIterator<[string, string]>
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* 遍历参数
|
|
146
|
-
* @param callback 回调函数
|
|
147
|
-
* @param thisArg this 上下文
|
|
148
|
-
*/
|
|
149
53
|
forEach(callback: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void
|
|
150
54
|
}
|
|
151
55
|
|
|
152
|
-
/**
|
|
153
|
-
* URL 环境类型定义
|
|
154
|
-
*/
|
|
155
|
-
export interface URLEnvironment {
|
|
156
|
-
URL: typeof URL
|
|
157
|
-
URLSearchParams: typeof URLSearchParams
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// 导出 URL 相关类
|
|
161
56
|
export { URL, URLSearchParams }
|
package/references/vue.d.ts
CHANGED
|
@@ -1,113 +1,86 @@
|
|
|
1
|
-
// Vue
|
|
2
|
-
// 仅包含必要的 Vue 类型,避免全局污染
|
|
1
|
+
// Vue 类型定义
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Vue 虚拟节点
|
|
5
|
+
*/
|
|
6
|
+
export interface VNode {
|
|
7
|
+
type: Component | string | symbol
|
|
8
|
+
props: Record<string, any> | null
|
|
9
|
+
children: VNode[] | string | null
|
|
10
|
+
key: string | number | symbol | null
|
|
11
|
+
ref: ((el: any) => void) | string | null
|
|
12
|
+
el: Element | null
|
|
13
|
+
appContext?: AppContext
|
|
7
14
|
}
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
component: ComponentInstance | null
|
|
22
|
-
suspense: any | null
|
|
23
|
-
ssContent: VNode | null
|
|
24
|
-
ssFallback: VNode | null
|
|
25
|
-
el: Element | null
|
|
26
|
-
anchor: Element | null
|
|
27
|
-
target: Element | null
|
|
28
|
-
targetAnchor: Element | null
|
|
29
|
-
staticCount: number
|
|
30
|
-
shapeFlag: number
|
|
31
|
-
patchFlag: number
|
|
32
|
-
dynamicProps: string[] | null
|
|
33
|
-
dynamicChildren: VNode[] | null
|
|
34
|
-
appContext: AppContext | null
|
|
35
|
-
ctx: ComponentInstance | null
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface Component {
|
|
39
|
-
__v_isVue?: true
|
|
40
|
-
name?: string
|
|
41
|
-
setup?: (props: any, ctx: any) => any
|
|
42
|
-
render?: (ctx: any) => VNode | VNode[]
|
|
43
|
-
template?: string
|
|
44
|
-
components?: Record<string, Component>
|
|
45
|
-
directives?: Record<string, any>
|
|
46
|
-
props?: string[] | Record<string, any>
|
|
47
|
-
emits?: string[] | Record<string, any>
|
|
48
|
-
[key: string]: any
|
|
49
|
-
}
|
|
16
|
+
/**
|
|
17
|
+
* Vue 组件定义
|
|
18
|
+
*/
|
|
19
|
+
export interface Component {
|
|
20
|
+
name?: string
|
|
21
|
+
setup?: (props: any, ctx: any) => any
|
|
22
|
+
render?: (ctx: any) => VNode | VNode[]
|
|
23
|
+
template?: string
|
|
24
|
+
components?: Record<string, Component>
|
|
25
|
+
props?: string[] | Record<string, any>
|
|
26
|
+
emits?: string[] | Record<string, any>
|
|
27
|
+
}
|
|
50
28
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Vue 组件实例
|
|
31
|
+
*/
|
|
32
|
+
export interface ComponentInstance {
|
|
33
|
+
type: Component
|
|
34
|
+
parent: ComponentInstance | null
|
|
35
|
+
appContext: AppContext
|
|
36
|
+
}
|
|
57
37
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
emitsCache: WeakMap<Component, any>
|
|
68
|
-
reload?: () => void
|
|
69
|
-
}
|
|
38
|
+
/**
|
|
39
|
+
* Vue 应用上下文
|
|
40
|
+
*/
|
|
41
|
+
export interface AppContext {
|
|
42
|
+
app: App
|
|
43
|
+
config: AppConfig
|
|
44
|
+
components: Record<string, Component>
|
|
45
|
+
provides: Record<string | symbol, any>
|
|
46
|
+
}
|
|
70
47
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
48
|
+
/**
|
|
49
|
+
* Vue 应用实例
|
|
50
|
+
*/
|
|
51
|
+
export interface App {
|
|
52
|
+
version: string
|
|
53
|
+
config: AppConfig
|
|
54
|
+
use(plugin: any, ...options: any[]): App
|
|
55
|
+
component(name: string): Component | undefined
|
|
56
|
+
component(name: string, component: Component): App
|
|
57
|
+
mount(rootContainer: Element | string): ComponentInstance
|
|
58
|
+
unmount(): void
|
|
59
|
+
provide<T>(key: string | symbol, value: T): App
|
|
60
|
+
}
|
|
85
61
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
[key: string]: any
|
|
94
|
-
}
|
|
62
|
+
/**
|
|
63
|
+
* Vue 应用配置
|
|
64
|
+
*/
|
|
65
|
+
export interface AppConfig {
|
|
66
|
+
errorHandler?: (err: any, instance: ComponentInstance | null, info: string) => void
|
|
67
|
+
warnHandler?: (msg: string, instance: ComponentInstance | null, trace: string) => void
|
|
68
|
+
globalProperties?: Record<string, any>
|
|
95
69
|
}
|
|
96
70
|
|
|
97
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Vue 响应式引用
|
|
73
|
+
*/
|
|
98
74
|
export interface Ref<T> {
|
|
99
75
|
value: T
|
|
100
76
|
}
|
|
101
77
|
|
|
102
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Vue 运行时函数
|
|
80
|
+
*/
|
|
81
|
+
export interface VueRuntime {
|
|
82
|
+
createVNode: (type: any, props?: any, children?: any) => VNode
|
|
83
|
+
render: (vnode: VNode | null, container: any) => void
|
|
103
84
|
ref: <T>(value: T) => Ref<T>
|
|
104
85
|
onUnmounted: (fn: () => void) => void
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// 导出类型
|
|
108
|
-
export type VNode = Vue.VNode
|
|
109
|
-
export type Component = Vue.Component
|
|
110
|
-
export type ComponentInstance = Vue.ComponentInstance
|
|
111
|
-
export type AppContext = Vue.AppContext
|
|
112
|
-
export type App = Vue.App
|
|
113
|
-
export type AppConfig = Vue.AppConfig
|
|
86
|
+
}
|
|
@@ -2,126 +2,100 @@
|
|
|
2
2
|
* WebAssembly 环境类型定义
|
|
3
3
|
* 用于在不同环境下提供 WebAssembly API 的类型支持
|
|
4
4
|
*/
|
|
5
|
+
import type { BufferSource } from './arraybuffer.d'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
mutable?: boolean
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
interface ModuleExportDescriptor {
|
|
105
|
-
name: string
|
|
106
|
-
kind: ImportExportKind
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
interface ModuleImportDescriptor {
|
|
110
|
-
module: string
|
|
111
|
-
name: string
|
|
112
|
-
kind: ImportExportKind
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
interface WebAssemblyInstantiatedSource {
|
|
116
|
-
module: Module
|
|
117
|
-
instance: Instance
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// 类型别名
|
|
121
|
-
type Imports = Record<string, ModuleImports>
|
|
122
|
-
type ModuleImports = Record<string, ExportValue>
|
|
123
|
-
type ExportValue = Function | Global | Memory | Table
|
|
124
|
-
type ValueType = 'i32' | 'i64' | 'f32' | 'f64' | 'v128' | 'funcref' | 'externref'
|
|
125
|
-
type TableKind = 'funcref' | 'externref'
|
|
126
|
-
type ImportExportKind = 'function' | 'table' | 'memory' | 'global'
|
|
127
|
-
}
|
|
7
|
+
// 核心接口
|
|
8
|
+
export interface WebAssemblyModule {}
|
|
9
|
+
|
|
10
|
+
export interface WebAssemblyInstance {
|
|
11
|
+
exports: WebAssemblyExports
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface WebAssemblyMemory {
|
|
15
|
+
buffer: ArrayBuffer
|
|
16
|
+
grow(pages: number): number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface WebAssemblyExports {
|
|
20
|
+
memory?: WebAssemblyMemory
|
|
21
|
+
malloc?: (size: number) => number
|
|
22
|
+
free?: (pointer: number) => void
|
|
23
|
+
[key: string]: any
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface WebAssemblyGlobal {
|
|
27
|
+
value: any
|
|
28
|
+
valueOf(): any
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface WebAssemblyTable {
|
|
32
|
+
length: number
|
|
33
|
+
get(index: number): any
|
|
34
|
+
set(index: number, value: any): void
|
|
35
|
+
grow(delta: number, value?: any): number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 错误类型
|
|
39
|
+
export interface WebAssemblyCompileError extends Error {
|
|
40
|
+
name: 'CompileError'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface WebAssemblyLinkError extends Error {
|
|
44
|
+
name: 'LinkError'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface WebAssemblyRuntimeError extends Error {
|
|
48
|
+
name: 'RuntimeError'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 描述符接口
|
|
52
|
+
export interface WebAssemblyMemoryDescriptor {
|
|
53
|
+
initial: number
|
|
54
|
+
maximum?: number
|
|
55
|
+
shared?: boolean
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface WebAssemblyTableDescriptor {
|
|
59
|
+
element: WebAssemblyTableKind
|
|
60
|
+
initial: number
|
|
61
|
+
maximum?: number
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface WebAssemblyGlobalDescriptor {
|
|
65
|
+
value: WebAssemblyValueType
|
|
66
|
+
mutable?: boolean
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface WebAssemblyModuleExportDescriptor {
|
|
70
|
+
name: string
|
|
71
|
+
kind: WebAssemblyImportExportKind
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface WebAssemblyModuleImportDescriptor {
|
|
75
|
+
module: string
|
|
76
|
+
name: string
|
|
77
|
+
kind: WebAssemblyImportExportKind
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface WebAssemblyInstantiatedSource {
|
|
81
|
+
module: WebAssemblyModule
|
|
82
|
+
instance: WebAssemblyInstance
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// 类型别名
|
|
86
|
+
export type WebAssemblyImports = Record<string, WebAssemblyModuleImports>
|
|
87
|
+
export type WebAssemblyModuleImports = Record<string, WebAssemblyExportValue>
|
|
88
|
+
export type WebAssemblyExportValue = Function | WebAssemblyGlobal | WebAssemblyMemory | WebAssemblyTable
|
|
89
|
+
export type WebAssemblyValueType = 'i32' | 'i64' | 'f32' | 'f64' | 'v128' | 'funcref' | 'externref'
|
|
90
|
+
export type WebAssemblyTableKind = 'funcref' | 'externref'
|
|
91
|
+
export type WebAssemblyImportExportKind = 'function' | 'table' | 'memory' | 'global'
|
|
92
|
+
|
|
93
|
+
// WebAssembly 运行时函数
|
|
94
|
+
export interface WebAssemblyRuntime {
|
|
95
|
+
compile: (bytes: BufferSource) => Promise<WebAssemblyModule>
|
|
96
|
+
instantiate: {
|
|
97
|
+
(bytes: BufferSource, imports?: WebAssemblyImports): Promise<WebAssemblyInstantiatedSource>
|
|
98
|
+
(module: WebAssemblyModule, imports?: WebAssemblyImports): Promise<WebAssemblyInstance>
|
|
99
|
+
}
|
|
100
|
+
validate: (bytes: BufferSource) => boolean
|
|
101
|
+
}
|