zcw-shared 1.28.0 → 1.30.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 +87 -55
- package/dist/functions/image/generatePlaceholderImage.d.ts +43 -0
- package/dist/functions/image/generatePlaceholderImage.js +331 -0
- package/dist/functions/image/generatePlaceholderImage.js.map +1 -0
- package/dist/functions/vue/dynamicMount.d.ts +6 -4
- package/dist/functions/vue/isVNode.d.ts +1 -1
- package/dist/functions/vue/isVueComponent.d.ts +1 -1
- package/dist/vue-hooks/browser/useBattery.d.ts +1 -1
- package/dist/vue-hooks/browser/useBluetooth.d.ts +1 -1
- package/dist/vue-hooks/browser/useCamera.d.ts +1 -1
- package/dist/vue-hooks/browser/useClipboard.d.ts +1 -1
- package/dist/vue-hooks/browser/useFileUpload.d.ts +25 -0
- package/dist/vue-hooks/browser/useFileUpload.js +81 -0
- package/dist/vue-hooks/browser/useFileUpload.js.map +1 -0
- package/dist/vue-hooks/browser/useFullscreen.d.ts +1 -1
- package/dist/vue-hooks/browser/useGamepad.d.ts +1 -1
- package/dist/vue-hooks/browser/useGeolocation.d.ts +1 -1
- package/dist/vue-hooks/browser/useMediaSession.d.ts +1 -1
- package/dist/vue-hooks/browser/useMicrophone.d.ts +1 -1
- package/dist/vue-hooks/browser/useNetwork.d.ts +1 -1
- package/dist/vue-hooks/browser/useOrientation.d.ts +1 -1
- package/dist/vue-hooks/browser/usePageVisibility.d.ts +1 -1
- package/dist/vue-hooks/browser/useScreenOrientation.d.ts +1 -1
- package/dist/vue-hooks/browser/useScreenWakeLock.d.ts +1 -1
- package/dist/vue-hooks/browser/useShare.d.ts +1 -1
- package/dist/vue-hooks/browser/useVibration.d.ts +1 -1
- package/dist/vue-hooks/dom/useAutoUpdate.d.ts +1 -1
- package/dist/vue-hooks/dom/useClickOutside.d.ts +1 -1
- package/dist/vue-hooks/dom/useDraggable.d.ts +4 -4
- package/dist/vue-hooks/dom/useEventListener.d.ts +1 -1
- package/dist/vue-hooks/dom/useResizable.d.ts +8 -3
- package/dist/vue-hooks/history/useDebouncedRefHistory.d.ts +1 -1
- package/dist/vue-hooks/history/useManualRefHistory.d.ts +1 -1
- package/dist/vue-hooks/history/useRefHistory.d.ts +1 -1
- package/dist/vue-hooks/state/injectLocal.d.ts +1 -1
- package/dist/vue-hooks/state/provideLocal.d.ts +1 -1
- package/dist/vue-hooks/state/useAsyncState.d.ts +1 -1
- package/dist/vue-hooks/state/useCounter.d.ts +1 -1
- package/dist/vue-hooks/state/useFileUpload.d.ts +23 -0
- package/dist/vue-hooks/state/useFileUpload.js +93 -0
- package/dist/vue-hooks/state/useFileUpload.js.map +1 -0
- package/dist/vue-hooks/state/useToggle.d.ts +1 -1
- package/dist/vue-hooks/time/useInterval.d.ts +1 -1
- package/dist/vue-hooks/time/useTimeout.d.ts +1 -1
- package/dist/vue-hooks/worker/useWebWorker.d.ts +4 -4
- package/dist/vue-hooks/worker/useWorkerFunction.d.ts +4 -4
- package/dist/vue-hooks/worker/useWorkerPool.d.ts +4 -4
- package/package.json +4 -2
- package/types/vue.d.ts +1 -1
- package/references/vue.d.ts +0 -242
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WorkerConstructor } from '../../../references/worker.d';
|
|
2
2
|
import type { setTimeout, clearTimeout, setInterval, clearInterval } from '../../../references/timer.d';
|
|
3
|
-
import type { Ref } from '
|
|
3
|
+
import type { Ref } from 'vue';
|
|
4
4
|
import type { WebWorkerOptions, WorkerTask, WorkerPoolResult, WorkerPoolStats } from '../../../types/worker';
|
|
5
5
|
export interface WorkerPoolDeps {
|
|
6
6
|
Worker: WorkerConstructor;
|
|
@@ -18,9 +18,9 @@ export default function useWorkerPool(deps: WorkerPoolDeps, options: WebWorkerOp
|
|
|
18
18
|
minPoolSize?: number;
|
|
19
19
|
maxPoolSize?: number;
|
|
20
20
|
}): {
|
|
21
|
-
isReady: Ref<boolean>;
|
|
22
|
-
isLoading: Ref<boolean>;
|
|
23
|
-
error: Ref<Error | null>;
|
|
21
|
+
isReady: Ref<boolean, boolean>;
|
|
22
|
+
isLoading: Ref<boolean, boolean>;
|
|
23
|
+
error: Ref<Error | null, Error | null>;
|
|
24
24
|
execute: <T>(task: WorkerTask) => Promise<WorkerPoolResult<T>>;
|
|
25
25
|
executeBatch: <T>(tasks: WorkerTask[]) => Promise<WorkerPoolResult<T>[]>;
|
|
26
26
|
cancelTask: (taskId: number) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcw-shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"references",
|
|
6
6
|
"dist",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"typescript": "^5.8.3",
|
|
35
35
|
"vitepress": "^1.6.4",
|
|
36
36
|
"vue": "^3.5.22",
|
|
37
|
-
"zcw-shared": "^1.
|
|
37
|
+
"zcw-shared": "^1.28.0",
|
|
38
38
|
"zcw-vue-ui": "^1.11.3"
|
|
39
39
|
},
|
|
40
40
|
"exports": {
|
|
@@ -148,6 +148,7 @@
|
|
|
148
148
|
"./functions/image/generateMacIcons": "./dist/functions/image/generateMacIcons.js",
|
|
149
149
|
"./functions/image/generateMacTrayIcon": "./dist/functions/image/generateMacTrayIcon.js",
|
|
150
150
|
"./functions/image/generatePaddedImage": "./dist/functions/image/generatePaddedImage.js",
|
|
151
|
+
"./functions/image/generatePlaceholderImage": "./dist/functions/image/generatePlaceholderImage.js",
|
|
151
152
|
"./functions/image/generatePwaIcons": "./dist/functions/image/generatePwaIcons.js",
|
|
152
153
|
"./functions/image/generateRoundedImage": "./dist/functions/image/generateRoundedImage.js",
|
|
153
154
|
"./functions/image/getImageDimensions": "./dist/functions/image/getImageDimensions.js",
|
|
@@ -257,6 +258,7 @@
|
|
|
257
258
|
"./vue-hooks/browser/useBluetooth": "./dist/vue-hooks/browser/useBluetooth.js",
|
|
258
259
|
"./vue-hooks/browser/useCamera": "./dist/vue-hooks/browser/useCamera.js",
|
|
259
260
|
"./vue-hooks/browser/useClipboard": "./dist/vue-hooks/browser/useClipboard.js",
|
|
261
|
+
"./vue-hooks/browser/useFileUpload": "./dist/vue-hooks/browser/useFileUpload.js",
|
|
260
262
|
"./vue-hooks/browser/useFullscreen": "./dist/vue-hooks/browser/useFullscreen.js",
|
|
261
263
|
"./vue-hooks/browser/useGamepad": "./dist/vue-hooks/browser/useGamepad.js",
|
|
262
264
|
"./vue-hooks/browser/useGeolocation": "./dist/vue-hooks/browser/useGeolocation.js",
|
package/types/vue.d.ts
CHANGED
package/references/vue.d.ts
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
// Vue 3 类型定义
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Vue 注入键类型
|
|
5
|
-
*/
|
|
6
|
-
export type InjectionKey<T> = symbol
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Vue 响应式引用
|
|
10
|
-
*/
|
|
11
|
-
export interface Ref<T = any> {
|
|
12
|
-
value: T
|
|
13
|
-
readonly [Symbol.toStringTag]: 'Ref'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Vue 计算属性引用
|
|
18
|
-
*/
|
|
19
|
-
export interface ComputedRef<T = any> extends WritableComputedRef<T> {
|
|
20
|
-
readonly value: T
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Vue 可写计算属性引用
|
|
25
|
-
*/
|
|
26
|
-
export interface WritableComputedRef<T> extends Ref<T> {
|
|
27
|
-
readonly effect: any
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Vue 响应式对象
|
|
32
|
-
*/
|
|
33
|
-
export type UnwrapRef<T> = {
|
|
34
|
-
[K in keyof T]: T[K] extends Ref<infer V> ? V : T[K]
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Vue 虚拟节点
|
|
39
|
-
*/
|
|
40
|
-
export interface VNode {
|
|
41
|
-
type: Component | string | symbol
|
|
42
|
-
props: Record<string, any> | null
|
|
43
|
-
children: VNode[] | string | null
|
|
44
|
-
key: string | number | symbol | null
|
|
45
|
-
ref: ((el: any) => void) | string | null
|
|
46
|
-
el: Element | null
|
|
47
|
-
appContext?: AppContext
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Vue 组件定义
|
|
52
|
-
*/
|
|
53
|
-
export interface Component {
|
|
54
|
-
name?: string
|
|
55
|
-
setup?: (props: any, ctx: any) => any
|
|
56
|
-
render?: (ctx: any) => VNode | VNode[]
|
|
57
|
-
template?: string
|
|
58
|
-
components?: Record<string, Component>
|
|
59
|
-
props?: string[] | Record<string, any>
|
|
60
|
-
emits?: string[] | Record<string, any>
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Vue 组件实例
|
|
65
|
-
*/
|
|
66
|
-
export interface ComponentInstance {
|
|
67
|
-
type: Component
|
|
68
|
-
parent: ComponentInstance | null
|
|
69
|
-
appContext: AppContext
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Vue 应用上下文
|
|
74
|
-
*/
|
|
75
|
-
export interface AppContext {
|
|
76
|
-
app: App
|
|
77
|
-
config: AppConfig
|
|
78
|
-
components: Record<string, Component>
|
|
79
|
-
provides: Record<string | symbol, any>
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Vue 应用实例
|
|
84
|
-
*/
|
|
85
|
-
export interface App {
|
|
86
|
-
version: string
|
|
87
|
-
config: AppConfig
|
|
88
|
-
use(plugin: any, ...options: any[]): App
|
|
89
|
-
component(name: string): Component | undefined
|
|
90
|
-
component(name: string, component: Component): App
|
|
91
|
-
mount(rootContainer: Element | string): ComponentInstance
|
|
92
|
-
unmount(): void
|
|
93
|
-
provide<T>(key: string | symbol, value: T): App
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Vue 应用配置
|
|
98
|
-
*/
|
|
99
|
-
export interface AppConfig {
|
|
100
|
-
errorHandler?: (err: any, instance: ComponentInstance | null, info: string) => void
|
|
101
|
-
warnHandler?: (msg: string, instance: ComponentInstance | null, trace: string) => void
|
|
102
|
-
globalProperties?: Record<string, any>
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Vue 生命周期钩子函数类型
|
|
107
|
-
*/
|
|
108
|
-
export type LifecycleHook = () => void
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Vue 监听器选项
|
|
112
|
-
*/
|
|
113
|
-
export interface WatchOptions {
|
|
114
|
-
immediate?: boolean
|
|
115
|
-
deep?: boolean
|
|
116
|
-
flush?: 'pre' | 'post' | 'sync'
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Vue 监听器停止函数
|
|
121
|
-
*/
|
|
122
|
-
export type WatchStopHandle = () => void
|
|
123
|
-
|
|
124
|
-
// Vue 3 Composition API 函数声明
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* 创建响应式引用
|
|
128
|
-
*/
|
|
129
|
-
export declare function ref<T>(value: T): Ref<UnwrapRef<T>>
|
|
130
|
-
export declare function ref<T = any>(): Ref<T | undefined>
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* 创建响应式对象
|
|
134
|
-
*/
|
|
135
|
-
export declare function reactive<T extends object>(target: T): UnwrapRef<T>
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* 创建计算属性
|
|
139
|
-
*/
|
|
140
|
-
export declare function computed<T>(
|
|
141
|
-
getter: () => T,
|
|
142
|
-
debugOptions?: any
|
|
143
|
-
): ComputedRef<T>
|
|
144
|
-
export declare function computed<T>(
|
|
145
|
-
options: {
|
|
146
|
-
get: () => T
|
|
147
|
-
set: (value: T) => void
|
|
148
|
-
},
|
|
149
|
-
debugOptions?: any
|
|
150
|
-
): WritableComputedRef<T>
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* 监听响应式数据变化
|
|
154
|
-
*/
|
|
155
|
-
export declare function watch<T>(
|
|
156
|
-
source: () => T,
|
|
157
|
-
callback: (newValue: T, oldValue: T) => void,
|
|
158
|
-
options?: WatchOptions
|
|
159
|
-
): WatchStopHandle
|
|
160
|
-
|
|
161
|
-
export declare function watch<T>(
|
|
162
|
-
source: Ref<T>,
|
|
163
|
-
callback: (newValue: T, oldValue: T) => void,
|
|
164
|
-
options?: WatchOptions
|
|
165
|
-
): WatchStopHandle
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* 立即监听响应式数据变化
|
|
169
|
-
*/
|
|
170
|
-
export declare function watchEffect(
|
|
171
|
-
effect: () => void,
|
|
172
|
-
options?: {
|
|
173
|
-
flush?: 'pre' | 'post' | 'sync'
|
|
174
|
-
onTrack?: (event: any) => void
|
|
175
|
-
onTrigger?: (event: any) => void
|
|
176
|
-
}
|
|
177
|
-
): WatchStopHandle
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* 组件挂载时执行
|
|
181
|
-
*/
|
|
182
|
-
export declare function onMounted(hook: LifecycleHook): void
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* 组件卸载时执行
|
|
186
|
-
*/
|
|
187
|
-
export declare function onUnmounted(hook: LifecycleHook): void
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* 组件更新前执行
|
|
191
|
-
*/
|
|
192
|
-
export declare function onBeforeUpdate(hook: LifecycleHook): void
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* 组件更新后执行
|
|
196
|
-
*/
|
|
197
|
-
export declare function onUpdated(hook: LifecycleHook): void
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* 组件挂载前执行
|
|
201
|
-
*/
|
|
202
|
-
export declare function onBeforeMount(hook: LifecycleHook): void
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* 组件卸载前执行
|
|
206
|
-
*/
|
|
207
|
-
export declare function onBeforeUnmount(hook: LifecycleHook): void
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* 获取当前组件实例
|
|
211
|
-
*/
|
|
212
|
-
export declare function getCurrentInstance(): ComponentInstance | null
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* 下一个DOM更新周期
|
|
216
|
-
*/
|
|
217
|
-
export declare function nextTick(fn?: () => void): Promise<void>
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* 创建Vue应用
|
|
221
|
-
*/
|
|
222
|
-
export declare function createApp(rootComponent: Component, rootProps?: any): App
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* 定义组件
|
|
226
|
-
*/
|
|
227
|
-
export declare function defineComponent<Props, RawBindings = object>(
|
|
228
|
-
setup: (props: Props, ctx: any) => RawBindings | (() => VNode | VNode[])
|
|
229
|
-
): Component
|
|
230
|
-
|
|
231
|
-
export declare function defineComponent(options: Component): Component
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Vue 运行时函数接口
|
|
235
|
-
*/
|
|
236
|
-
export interface VueRuntime {
|
|
237
|
-
createVNode: (type: any, props?: any, children?: any) => VNode
|
|
238
|
-
render: (vnode: VNode | null, container: any) => void
|
|
239
|
-
ref: <T>(value: T) => Ref<T>
|
|
240
|
-
onMounted: (fn: () => void) => void
|
|
241
|
-
onUnmounted: (fn: () => void) => void
|
|
242
|
-
}
|