zf-dbs 0.1.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.
@@ -0,0 +1,99 @@
1
+ import { defineComponent as c, ref as r, onMounted as d, nextTick as p, onBeforeUnmount as f, computed as m, openBlock as u, createElementBlock as g, createElementVNode as w, normalizeStyle as $, unref as v, renderSlot as x } from "vue";
2
+ import { _ } from "./CHgC5LLL.mjs";
3
+ const E = /* @__PURE__ */ c({
4
+ __name: "zf-scale-container",
5
+ props: {
6
+ width: {},
7
+ height: {},
8
+ mode: { default: "aspectFit" }
9
+ },
10
+ setup(l) {
11
+ const e = l, a = r(null), i = r(0), n = r(0), o = () => {
12
+ i.value = a.value?.clientWidth || 0, n.value = a.value?.clientHeight || 0;
13
+ };
14
+ d(() => {
15
+ window.addEventListener("resize", o), p(o), o();
16
+ }), f(() => {
17
+ window.removeEventListener("resize", o);
18
+ });
19
+ const h = m(() => {
20
+ if (e.mode === "scaleToFill") {
21
+ const t = i.value / e.width, s = n.value / e.height;
22
+ return {
23
+ width: `${e.width}px`,
24
+ height: `${e.height}px`,
25
+ transform: `scale(${t}, ${s})`,
26
+ transformOrigin: "0 0"
27
+ };
28
+ } else if (e.mode === "aspectFit") {
29
+ const t = Math.min(i.value / e.width, n.value / e.height);
30
+ return {
31
+ width: `${e.width}px`,
32
+ height: `${e.height}px`,
33
+ transform: `scale(${t}, ${t}) translate(-50%, -50%)`,
34
+ transformOrigin: "0 0",
35
+ position: "absolute",
36
+ top: "50%",
37
+ left: "50%"
38
+ };
39
+ } else if (e.mode === "aspectFill") {
40
+ const t = Math.max(i.value / e.width, n.value / e.height);
41
+ return {
42
+ width: `${e.width}px`,
43
+ height: `${e.height}px`,
44
+ transform: `scale(${t}, ${t}) translate(-50%, -50%)`,
45
+ transformOrigin: "0 0",
46
+ position: "absolute",
47
+ top: "50%",
48
+ left: "50%"
49
+ };
50
+ } else if (e.mode === "widthFix") {
51
+ const t = i.value / e.width;
52
+ return {
53
+ width: `${e.width}px`,
54
+ height: `${e.height}px`,
55
+ transform: `scale(${t}, ${t}) translate(-50%, -50%)`,
56
+ transformOrigin: "0 0",
57
+ position: "absolute",
58
+ top: "50%",
59
+ left: "50%"
60
+ };
61
+ } else if (e.mode === "heightFix") {
62
+ const t = n.value / e.height;
63
+ return {
64
+ width: `${e.width}px`,
65
+ height: `${e.height}px`,
66
+ transform: `scale(${t}, ${t}) translate(-50%, -50%)`,
67
+ transformOrigin: "0 0",
68
+ position: "absolute",
69
+ top: "50%",
70
+ left: "50%"
71
+ };
72
+ } else if (e.mode === "center")
73
+ return {
74
+ width: `${e.width}px`,
75
+ height: `${e.height}px`,
76
+ position: "absolute",
77
+ top: "50%",
78
+ left: "50%",
79
+ transform: "translate(-50%, -50%)"
80
+ };
81
+ return {};
82
+ });
83
+ return (t, s) => (u(), g("div", {
84
+ ref_key: "containerElement",
85
+ ref: a,
86
+ class: "zf-scale-container"
87
+ }, [
88
+ w("div", {
89
+ class: "zf-scale-wrapper",
90
+ style: $(v(h))
91
+ }, [
92
+ x(t.$slots, "default", {}, void 0, !0)
93
+ ], 4)
94
+ ], 512));
95
+ }
96
+ }), F = /* @__PURE__ */ _(E, [["__scopeId", "data-v-db947fd0"]]);
97
+ export {
98
+ F as Z
99
+ };
@@ -0,0 +1 @@
1
+ export * from './zf-app'
@@ -0,0 +1,5 @@
1
+ import { z as p, z as e } from "../chunks/CaRNyYcg.mjs";
2
+ export {
3
+ p as ZfApp,
4
+ e as default
5
+ };
@@ -0,0 +1 @@
1
+ export * from './zf-scale-container'
@@ -0,0 +1,5 @@
1
+ import { Z as f, Z as o } from "../chunks/zkyql-F5.mjs";
2
+ export {
3
+ f as ZfScaleContainer,
4
+ o as default
5
+ };
@@ -0,0 +1 @@
1
+ export * from './zf-tween-number'
@@ -0,0 +1,5 @@
1
+ import { z as f, z as r } from "../chunks/B52ac7eU.mjs";
2
+ export {
3
+ f as ZfTweenNumber,
4
+ r as default
5
+ };
@@ -0,0 +1,416 @@
1
+ import type { App } from 'vue';
2
+ import { ComponentOptionsMixin } from 'vue';
3
+ import type { ComputedRef as ComputedRef_2 } from 'vue';
4
+ import { DefineComponent } from 'vue';
5
+ import type { DefineRequestGetOptions } from './type';
6
+ import type { DefineRequestOptions } from './type';
7
+ import { PropType as PropType_2 } from 'vue';
8
+ import { PublicProps } from 'vue';
9
+ import type { Ref as Ref_2 } from 'vue';
10
+ import type { RequestError } from './type';
11
+ import type { RequestInstance } from './type';
12
+ import type { RequestResult } from './type';
13
+ import type { UnwrapNestedRefs } from 'vue';
14
+
15
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
16
+
17
+ declare type __VLS_NonUndefinedable_2<T> = T extends undefined ? never : T;
18
+
19
+ declare type __VLS_Prettify<T> = {
20
+ [K in keyof T]: T[K];
21
+ } & {};
22
+
23
+ declare type __VLS_Prettify_2<T> = {
24
+ [K in keyof T]: T[K];
25
+ } & {};
26
+
27
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
28
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
29
+ type: PropType_2<__VLS_NonUndefinedable<T[K]>>;
30
+ } : {
31
+ type: PropType_2<T[K]>;
32
+ required: true;
33
+ };
34
+ };
35
+
36
+ declare type __VLS_TypePropsToRuntimeProps_2<T> = {
37
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
38
+ type: PropType_2<__VLS_NonUndefinedable_2<T[K]>>;
39
+ } : {
40
+ type: PropType_2<T[K]>;
41
+ required: true;
42
+ };
43
+ };
44
+
45
+ declare type __VLS_WithDefaults<P, D> = {
46
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
47
+ default: D[K];
48
+ }> : P[K];
49
+ };
50
+
51
+ declare type __VLS_WithDefaults_2<P, D> = {
52
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify_2<P[K] & {
53
+ default: D[K];
54
+ }> : P[K];
55
+ };
56
+
57
+ declare type __VLS_WithTemplateSlots<T, S> = T & {
58
+ new (): {
59
+ $slots: S;
60
+ };
61
+ };
62
+
63
+ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
64
+ new (): {
65
+ $slots: S;
66
+ };
67
+ };
68
+
69
+ declare type __VLS_WithTemplateSlots_3<T, S> = T & {
70
+ new (): {
71
+ $slots: S;
72
+ };
73
+ };
74
+
75
+ declare type AutoGetTokenHandle = () => HandleResult | Promise<HandleResult>;
76
+
77
+ declare type Config = {
78
+ /** 项目名称 */
79
+ appTitle: string;
80
+ /** 项目高度,用于计算缩放比例(非必要不要修改,通过修改宽度来适配) */
81
+ appHeight: number;
82
+ /** 项目宽度,用于计算缩放比例,如果需要适配多个宽度,可以通过配置 appWidths 参数适配多个宽度,比如 appWidths: [1920, 1366],同时配置 appWidths 和 appWidth 时,appWidths 优先级更高 */
83
+ appWidth: number;
84
+ /** 项目宽度,用于计算缩放比例,如果需要适配单个宽度,可以通过配置 appWidth 参数适配单个宽度,比如 appWidth: 1920,同时配置 appWidths 和 appWidth 时,appWidths 优先级更高 */
85
+ appWidths: number[];
86
+ /** 是否使用缩放 */
87
+ useScale: boolean;
88
+ /** 是否拉伸缩放 */
89
+ useStretch: boolean;
90
+ /** 是否嵌入到 UE 中 */
91
+ useUE: boolean;
92
+ /** 轮询间隔 */
93
+ pollingInterval: number;
94
+ /** API 请求接口基础路径 */
95
+ requestBaseURL: string;
96
+ /** API 请求是否启用 Mock */
97
+ requestUseMock: boolean;
98
+ /** API 请求格式 Code Key */
99
+ requestFormatCodeKey: string;
100
+ /** API 请求格式提示消息 Key */
101
+ requestFormatMessageKey: string;
102
+ /** API 请求格式数据 Key */
103
+ requestFormatDataKey: string;
104
+ /** API 请求成功 Code */
105
+ requestSuccessCode: string | number | (string | number)[];
106
+ /** API 请求认证失败需要鉴权 Code */
107
+ requestErrorAuthCode: string | number | (string | number)[];
108
+ /** API 请求认证失败处理方法 */
109
+ requestErrorAuthHandle?: (error: RequestError) => void;
110
+ /** API 请求错误忽略提示消息 Code */
111
+ requestErrorIgnoreMessageCode: string | number | (string | number)[];
112
+ /** API 请求错误消息翻译 */
113
+ requestErrorMessageTranslation?: Record<string, string>;
114
+ /** API Token 存储 Key */
115
+ requestTokenCacheKey: string;
116
+ /** API 请求 Header Token Key */
117
+ requestTokenHeaderKey: string;
118
+ /** API Token 获取方法自动处理 */
119
+ requestAutoGetTokenHandle?: TokenHandle['autoGetTokenHandle'];
120
+ /** 配置签名 */
121
+ sign?: string;
122
+ /** 其他配置 */
123
+ [key: string]: any;
124
+ };
125
+
126
+ declare const _default: {
127
+ install(app: App): void;
128
+ };
129
+ export default _default;
130
+
131
+ export declare function defineConfig(value: Partial<Config>): globalThis.Ref<Config>;
132
+
133
+ export declare function defineRequest(options: DefineRequestOptions | DefineRequestGetOptions): RequestInstance;
134
+
135
+ declare type DefineService = <Params = undefined, Result = RequestResult>(handle: Service<Params, Result>) => Service<Params, Result>;
136
+
137
+ export declare const defineService: DefineService;
138
+
139
+ /** 事件监听器 */
140
+ declare class EventListener_2 {
141
+ #private;
142
+ /**
143
+ * 返回监听器数组
144
+ * @param name 事件名
145
+ */
146
+ listeners(name: string): Function[];
147
+ /**
148
+ * 注册事件
149
+ * @param name 事件名
150
+ * @param listener 回调函数
151
+ */
152
+ on(name: string, listener: Function): void;
153
+ /**
154
+ * 注册只触发一次的事件
155
+ * @param name 事件名
156
+ * @param listener 回调函数
157
+ */
158
+ once(name: string, listener: Function): void;
159
+ /**
160
+ * 注销事件
161
+ * @param name 事件名
162
+ * @param listener 回调函数
163
+ */
164
+ off(name: string, listener?: Function): void;
165
+ /**
166
+ * 手动触发事件
167
+ * @param name
168
+ */
169
+ trigger(name: string, ...args: any[]): void;
170
+ }
171
+ export { EventListener_2 as EventListener }
172
+
173
+ /**
174
+ * 使用配置
175
+ */
176
+ export declare function getConfig(): {
177
+ [x: string]: any;
178
+ appTitle: string;
179
+ appHeight: number;
180
+ appWidth: number;
181
+ appWidths: number[];
182
+ useScale: boolean;
183
+ useStretch: boolean;
184
+ useUE: boolean;
185
+ pollingInterval: number;
186
+ requestBaseURL: string;
187
+ requestUseMock: boolean;
188
+ requestFormatCodeKey: string;
189
+ requestFormatMessageKey: string;
190
+ requestFormatDataKey: string;
191
+ requestSuccessCode: string | number | (string | number)[];
192
+ requestErrorAuthCode: string | number | (string | number)[];
193
+ requestErrorAuthHandle?: ((error: RequestError) => void) | undefined;
194
+ requestErrorIgnoreMessageCode: string | number | (string | number)[];
195
+ requestErrorMessageTranslation?: Record<string, string> | undefined;
196
+ requestTokenCacheKey: string;
197
+ requestTokenHeaderKey: string;
198
+ requestAutoGetTokenHandle?: (() => {
199
+ token: string;
200
+ expires: number;
201
+ } | Promise<{
202
+ token: string;
203
+ expires: number;
204
+ }>) | undefined;
205
+ sign?: string | undefined;
206
+ };
207
+
208
+ declare type HandleResult = {
209
+ token: string;
210
+ expires: number;
211
+ };
212
+
213
+ declare class Polling<T = any> {
214
+ private _value?;
215
+ get value(): T | undefined;
216
+ interval: number;
217
+ private listener;
218
+ private _running;
219
+ get running(): boolean;
220
+ private timer?;
221
+ constructor(listener: Polling<T>['listener'], defaultValue?: Polling<T>['value']);
222
+ private polling;
223
+ trigger(): Promise<T>;
224
+ start(): void;
225
+ stop(): void;
226
+ }
227
+
228
+ export declare const request: RequestInstance;
229
+
230
+ declare type Service<Params = Record<string, unknown>, Result = RequestResult> = Params extends undefined ? ServiceNoParams<Params, Result> : ServiceHasParams<Params, Result>;
231
+
232
+ declare type ServiceHasParams<Params = Record<string, unknown>, Result = RequestResult> = (params: Params, config?: Record<string, unknown>) => Promise<Result>;
233
+
234
+ declare type ServiceNoParams<Params = Record<string, unknown>, Result = RequestResult> = (params?: Params, config?: Record<string, unknown>) => Promise<Result>;
235
+
236
+ declare type SetInterval = typeof setInterval;
237
+
238
+ declare type SetTimeout = typeof setTimeout;
239
+
240
+ declare type Timer = ReturnType<SetInterval> | null;
241
+
242
+ declare type Timer_2 = ReturnType<SetTimeout> | null;
243
+
244
+ declare type TimerRef = Ref_2<Timer>;
245
+
246
+ declare type TimerRef_2 = Ref_2<Timer_2>;
247
+
248
+ export declare class TokenHandle {
249
+ key: string;
250
+ autoGetTokenHandle?: AutoGetTokenHandle;
251
+ /**
252
+ * @param key Token key
253
+ * @param autoGetTokenHandle Token 处理函数
254
+ */
255
+ constructor(key: string, autoGetTokenHandle?: AutoGetTokenHandle);
256
+ /**
257
+ * 获取 Token
258
+ * @returns Token
259
+ */
260
+ getToken(): Promise<string | null>;
261
+ /**
262
+ * 设置 Token
263
+ * @param token Token
264
+ * @param options 选项
265
+ * @returns Token
266
+ */
267
+ setToken(token: string, options?: {
268
+ expires?: number;
269
+ }): Promise<void>;
270
+ static baseKey: string;
271
+ /**
272
+ * 获取 Token
273
+ * @param options 选项 { key: Token key }
274
+ * @returns Token
275
+ */
276
+ static getToken(options?: {
277
+ key?: string;
278
+ }): string | null;
279
+ /**
280
+ * 设置 Token
281
+ * @param token Token
282
+ * @param options 选项 { key: Token key, expires: Token 过期时间 }
283
+ */
284
+ static setToken(token: string, options?: {
285
+ expires?: number;
286
+ key?: string;
287
+ }): void;
288
+ }
289
+
290
+ export declare class Ue extends EventListener_2 {
291
+ /**
292
+ * 发送事件
293
+ * @param {string} name 事件名称
294
+ * @param {unknown[]} args 参数
295
+ */
296
+ emit(name: string, ...args: unknown[]): void;
297
+ /**
298
+ * 注册事件
299
+ * @param {string} name 事件名称
300
+ * @param {UnknownFunction} listener 事件处理函数
301
+ */
302
+ on(name: string, listener: UnknownFunction): void;
303
+ /**
304
+ * 注销事件
305
+ * @param {string} name 事件名称
306
+ * @param {UnknownFunction} listener 事件处理函数
307
+ */
308
+ off(name: string, listener?: UnknownFunction): void;
309
+ }
310
+
311
+ export declare const ue: Ue;
312
+
313
+ declare type UnknownFunction = (...args: unknown[]) => unknown;
314
+
315
+ /**
316
+ * 使用配置
317
+ */
318
+ export declare function useConfig(): Ref_2<Config>;
319
+
320
+ declare type UseInterval = <TArgs extends any[]>(handler: (...args: TArgs) => void, timeout?: number, ...args: TArgs) => TimerRef;
321
+
322
+ export declare const useInterval: UseInterval;
323
+
324
+ export declare function usePolling<T>(listener: () => Promise<T> | T): UnwrapNestedRefs<Polling<T>>;
325
+
326
+ export declare function usePolling<T, D extends T>(listener: () => Promise<T> | T, defaultValue: D): UnwrapNestedRefs<Omit<Polling<D>, 'value'> & {
327
+ value: D;
328
+ }>;
329
+
330
+ export declare function usePollingRef<T>(listener: () => Promise<T> | T): ComputedRef_2<T | undefined>;
331
+
332
+ export declare function usePollingRef<T, D extends T>(listener: () => Promise<T> | T, defaultValue: D): ComputedRef_2<D>;
333
+
334
+ declare type UseTimeout = <TArgs extends any[]>(handler: (...args: TArgs) => void, timeout?: number, ...args: TArgs) => TimerRef_2;
335
+
336
+ export declare const useTimeout: UseTimeout;
337
+
338
+ export declare const ZfApp: __VLS_WithTemplateSlots<DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<globalThis.ExtractPropTypes<{}>>, {}, {}>, {
339
+ default?(_: {}): any;
340
+ }>;
341
+
342
+ export declare const ZfScaleContainer: __VLS_WithTemplateSlots_2<DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
343
+ /** 宽度 */
344
+ width: number;
345
+ /** 高度 */
346
+ height: number;
347
+ /** 裁剪、缩放的模式 */
348
+ mode?: "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | "center" | undefined;
349
+ }>, {
350
+ mode: string;
351
+ }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
352
+ /** 宽度 */
353
+ width: number;
354
+ /** 高度 */
355
+ height: number;
356
+ /** 裁剪、缩放的模式 */
357
+ mode?: "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | "center" | undefined;
358
+ }>, {
359
+ mode: string;
360
+ }>>>, {
361
+ mode: "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | "center";
362
+ }, {}>, {
363
+ default?(_: {}): any;
364
+ }>;
365
+
366
+ export declare const ZfTweenNumber: __VLS_WithTemplateSlots_3<DefineComponent<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<{
367
+ value?: string | number | undefined;
368
+ thousand?: boolean | undefined;
369
+ duration?: number | undefined;
370
+ tag?: "div" | "span" | undefined;
371
+ class?: string | Record<string, boolean> | (string | Record<string, boolean>)[] | undefined;
372
+ style?: string | Record<string, string | number> | (string | Record<string, string | number>)[] | undefined;
373
+ }>, {
374
+ value: string;
375
+ thousand: undefined;
376
+ duration: number;
377
+ tag: undefined;
378
+ class: string;
379
+ style: string;
380
+ }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<{
381
+ value?: string | number | undefined;
382
+ thousand?: boolean | undefined;
383
+ duration?: number | undefined;
384
+ tag?: "div" | "span" | undefined;
385
+ class?: string | Record<string, boolean> | (string | Record<string, boolean>)[] | undefined;
386
+ style?: string | Record<string, string | number> | (string | Record<string, string | number>)[] | undefined;
387
+ }>, {
388
+ value: string;
389
+ thousand: undefined;
390
+ duration: number;
391
+ tag: undefined;
392
+ class: string;
393
+ style: string;
394
+ }>>>, {
395
+ style: string | Record<string, string | number> | (string | Record<string, string | number>)[];
396
+ class: string | Record<string, boolean> | (string | Record<string, boolean>)[];
397
+ value: string | number;
398
+ thousand: boolean;
399
+ duration: number;
400
+ tag: "div" | "span";
401
+ }, {}>, {
402
+ default?(_: {
403
+ value: string | number;
404
+ prefix: string;
405
+ number: string;
406
+ negativeFlag: boolean;
407
+ thousandFlag: boolean;
408
+ integer: string;
409
+ decimal: string;
410
+ decimalFull: string;
411
+ decimalDecimal: number;
412
+ append: string;
413
+ }): any;
414
+ }>;
415
+
416
+ export { }