@bg-effects/shared 1.0.4 → 1.0.5
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/index.d.ts +309 -0
- package/dist/index.js +469 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +3 -0
- package/dist/index.umd.cjs.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { AllowedComponentProps } from 'vue';
|
|
2
|
+
import { ComponentCustomProps } from 'vue';
|
|
3
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
4
|
+
import { ComponentProvideOptions } from 'vue';
|
|
5
|
+
import { ComputedRef } from 'vue';
|
|
6
|
+
import { DefineComponent } from 'vue';
|
|
7
|
+
import { PublicProps } from 'vue';
|
|
8
|
+
import { ShallowUnwrapRef } from 'vue';
|
|
9
|
+
import { VNode } from 'vue';
|
|
10
|
+
import { VNodeProps } from 'vue';
|
|
11
|
+
|
|
12
|
+
declare const __VLS_component: DefineComponent<Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
13
|
+
"update:collapsed": (value: boolean) => any;
|
|
14
|
+
}, string, PublicProps, Readonly<Props_4> & Readonly<{
|
|
15
|
+
"onUpdate:collapsed"?: (value: boolean) => any;
|
|
16
|
+
}>, {
|
|
17
|
+
className: string;
|
|
18
|
+
title: string;
|
|
19
|
+
collapsible: boolean;
|
|
20
|
+
collapsed: boolean;
|
|
21
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
22
|
+
|
|
23
|
+
declare const __VLS_component_2: DefineComponent<Props_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_5> & Readonly<{}>, {
|
|
24
|
+
className: string;
|
|
25
|
+
title: string;
|
|
26
|
+
spacing: "sm" | "md" | "lg";
|
|
27
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
28
|
+
|
|
29
|
+
declare type __VLS_PrettifyLocal<T> = {
|
|
30
|
+
[K in keyof T]: T[K];
|
|
31
|
+
} & {};
|
|
32
|
+
|
|
33
|
+
declare type __VLS_PrettifyLocal_2<T> = {
|
|
34
|
+
[K in keyof T]: T[K];
|
|
35
|
+
} & {};
|
|
36
|
+
|
|
37
|
+
declare type __VLS_PrettifyLocal_3<T> = {
|
|
38
|
+
[K in keyof T]: T[K];
|
|
39
|
+
} & {};
|
|
40
|
+
|
|
41
|
+
declare function __VLS_template(): {
|
|
42
|
+
attrs: Partial<{}>;
|
|
43
|
+
slots: {
|
|
44
|
+
header?(_: {}): any;
|
|
45
|
+
default?(_: {}): any;
|
|
46
|
+
};
|
|
47
|
+
refs: {};
|
|
48
|
+
rootEl: HTMLDivElement;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
declare function __VLS_template_2(): {
|
|
52
|
+
attrs: Partial<{}>;
|
|
53
|
+
slots: {
|
|
54
|
+
default?(_: {}): any;
|
|
55
|
+
};
|
|
56
|
+
refs: {};
|
|
57
|
+
rootEl: HTMLDivElement;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
61
|
+
|
|
62
|
+
declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
|
|
63
|
+
|
|
64
|
+
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
65
|
+
new (): {
|
|
66
|
+
$slots: S;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
declare type __VLS_WithTemplateSlots_2<T, S> = T & {
|
|
71
|
+
new (): {
|
|
72
|
+
$slots: S;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export declare function adjustColor(hex: string, options?: {
|
|
77
|
+
brightness?: number;
|
|
78
|
+
offset?: [number, number, number];
|
|
79
|
+
alpha?: number;
|
|
80
|
+
}): string;
|
|
81
|
+
|
|
82
|
+
export declare const ButtonGroup: <T extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal_2<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
83
|
+
props: __VLS_PrettifyLocal_2<Pick<Partial<{}> & Omit<{
|
|
84
|
+
readonly "onUpdate:modelValue"?: (value: T) => any;
|
|
85
|
+
} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, "onUpdate:modelValue"> & {
|
|
86
|
+
modelValue: T;
|
|
87
|
+
options: ButtonOption<T>[];
|
|
88
|
+
label?: string;
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
columns?: number;
|
|
91
|
+
layout?: "horizontal" | "vertical";
|
|
92
|
+
className?: string;
|
|
93
|
+
} & Partial<{}>> & PublicProps;
|
|
94
|
+
expose(exposed: ShallowUnwrapRef< {}>): void;
|
|
95
|
+
attrs: any;
|
|
96
|
+
slots: {};
|
|
97
|
+
emit: (evt: "update:modelValue", value: T) => void;
|
|
98
|
+
}>) => VNode & {
|
|
99
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* ButtonGroup - Multiple choice button group
|
|
104
|
+
* Used as replacement for Select dropdown when options are limited
|
|
105
|
+
*/
|
|
106
|
+
export declare interface ButtonOption<V extends string | number = string | number> {
|
|
107
|
+
value: V;
|
|
108
|
+
label: string;
|
|
109
|
+
disabled?: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export declare const clampNumber: (value: number, min: number, max: number) => number;
|
|
113
|
+
|
|
114
|
+
export declare const ColorPicker: DefineComponent<Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
115
|
+
"update:modelValue": (value: string) => any;
|
|
116
|
+
}, string, PublicProps, Readonly<Props_2> & Readonly<{
|
|
117
|
+
"onUpdate:modelValue"?: (value: string) => any;
|
|
118
|
+
}>, {
|
|
119
|
+
disabled: boolean;
|
|
120
|
+
className: string;
|
|
121
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
122
|
+
inputRef: HTMLInputElement;
|
|
123
|
+
}, HTMLDivElement>;
|
|
124
|
+
|
|
125
|
+
export declare function generateHarmoniousPalette(count: number, options?: {
|
|
126
|
+
baseHue?: number;
|
|
127
|
+
saturation?: number;
|
|
128
|
+
lightness?: number;
|
|
129
|
+
}): string[];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 生成随机颜色数组
|
|
133
|
+
* 30% 概率从预设配色中选取,70% 概率生成和谐配色
|
|
134
|
+
* @param count 颜色数量
|
|
135
|
+
* @param options 配置选项
|
|
136
|
+
* @returns 颜色数组
|
|
137
|
+
*/
|
|
138
|
+
export declare function generateRandomPalette(count: number, options?: {
|
|
139
|
+
baseHue?: number;
|
|
140
|
+
saturation?: number;
|
|
141
|
+
lightness?: number;
|
|
142
|
+
}): string[];
|
|
143
|
+
|
|
144
|
+
export declare function hexToRgb(hex: string): [number, number, number];
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 将十六进制颜色转换为归一化的RGB数组(0-1范围)
|
|
148
|
+
* 用于WebGL shader
|
|
149
|
+
*/
|
|
150
|
+
export declare function hexToRgbNormalized(hex: string): [number, number, number];
|
|
151
|
+
|
|
152
|
+
export declare function hit(chance: number): boolean;
|
|
153
|
+
|
|
154
|
+
export declare function hslToHex(h: number, s: number, l: number): string;
|
|
155
|
+
|
|
156
|
+
export declare interface I18nMessages {
|
|
157
|
+
[key: string]: any;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export declare function normalizeHexColor(value: string | undefined, fallback: string): string;
|
|
161
|
+
|
|
162
|
+
export declare const normalizeIntRange: (value: number | undefined, min: number, max: number, fallback: number) => number;
|
|
163
|
+
|
|
164
|
+
declare type Option_2<V extends string | number = string | number> = ButtonOption<V>;
|
|
165
|
+
export { Option_2 as Option }
|
|
166
|
+
|
|
167
|
+
declare interface Option_3<V extends string | number = string | number> {
|
|
168
|
+
value: V;
|
|
169
|
+
label: string;
|
|
170
|
+
disabled?: boolean;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export declare const Panel: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
174
|
+
|
|
175
|
+
declare interface Props {
|
|
176
|
+
modelValue: number;
|
|
177
|
+
label: string;
|
|
178
|
+
min?: number;
|
|
179
|
+
max?: number;
|
|
180
|
+
step?: number;
|
|
181
|
+
suffix?: string;
|
|
182
|
+
disabled?: boolean;
|
|
183
|
+
className?: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare interface Props_2 {
|
|
187
|
+
modelValue: string;
|
|
188
|
+
label: string;
|
|
189
|
+
disabled?: boolean;
|
|
190
|
+
className?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare interface Props_3 {
|
|
194
|
+
modelValue: boolean;
|
|
195
|
+
label: string;
|
|
196
|
+
disabled?: boolean;
|
|
197
|
+
className?: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare interface Props_4 {
|
|
201
|
+
title?: string;
|
|
202
|
+
collapsible?: boolean;
|
|
203
|
+
collapsed?: boolean;
|
|
204
|
+
className?: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
declare interface Props_5 {
|
|
208
|
+
title?: string;
|
|
209
|
+
spacing?: 'sm' | 'md' | 'lg';
|
|
210
|
+
className?: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* 随机数处理工具库
|
|
215
|
+
*/
|
|
216
|
+
export declare function rand(min: number, max: number, precision?: number): number;
|
|
217
|
+
|
|
218
|
+
export declare function randInt(min: number, max: number): number;
|
|
219
|
+
|
|
220
|
+
export declare function rgbToHex(r: number, g: number, b: number): string;
|
|
221
|
+
|
|
222
|
+
export declare function safeHexToRgbNormalized(value: string, fallback: string): [number, number, number];
|
|
223
|
+
|
|
224
|
+
export declare function sample<T>(array: T[]): T;
|
|
225
|
+
|
|
226
|
+
export declare const Section: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
227
|
+
|
|
228
|
+
export declare const Select: <T extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
229
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
230
|
+
readonly "onUpdate:modelValue"?: (value: T) => any;
|
|
231
|
+
} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, "onUpdate:modelValue"> & {
|
|
232
|
+
modelValue: T;
|
|
233
|
+
options: Option_3<T>[];
|
|
234
|
+
label?: string;
|
|
235
|
+
disabled?: boolean;
|
|
236
|
+
className?: string;
|
|
237
|
+
} & Partial<{}>> & PublicProps;
|
|
238
|
+
expose(exposed: ShallowUnwrapRef< {}>): void;
|
|
239
|
+
attrs: any;
|
|
240
|
+
slots: {};
|
|
241
|
+
emit: (evt: "update:modelValue", value: T) => void;
|
|
242
|
+
}>) => VNode & {
|
|
243
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export declare function shortId(length?: number): string;
|
|
247
|
+
|
|
248
|
+
export declare const Slider: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
249
|
+
"update:modelValue": (value: number) => any;
|
|
250
|
+
}, string, PublicProps, Readonly<Props> & Readonly<{
|
|
251
|
+
"onUpdate:modelValue"?: (value: number) => any;
|
|
252
|
+
}>, {
|
|
253
|
+
min: number;
|
|
254
|
+
max: number;
|
|
255
|
+
step: number;
|
|
256
|
+
suffix: string;
|
|
257
|
+
disabled: boolean;
|
|
258
|
+
className: string;
|
|
259
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
260
|
+
|
|
261
|
+
declare interface SubTabItem<T> {
|
|
262
|
+
id: T;
|
|
263
|
+
label: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export declare const SubTabs: <T extends string>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal_3<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
267
|
+
props: __VLS_PrettifyLocal_3<Pick<Partial<{}> & Omit<{
|
|
268
|
+
readonly "onUpdate:modelValue"?: (value: T) => any;
|
|
269
|
+
} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, "onUpdate:modelValue"> & {
|
|
270
|
+
tabs: SubTabItem<T>[];
|
|
271
|
+
modelValue: T;
|
|
272
|
+
rows?: number;
|
|
273
|
+
className?: string;
|
|
274
|
+
} & Partial<{}>> & PublicProps;
|
|
275
|
+
expose(exposed: ShallowUnwrapRef< {}>): void;
|
|
276
|
+
attrs: any;
|
|
277
|
+
slots: {};
|
|
278
|
+
emit: (evt: "update:modelValue", value: T) => void;
|
|
279
|
+
}>) => VNode & {
|
|
280
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export declare const Toggle: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
284
|
+
"update:modelValue": (value: boolean) => any;
|
|
285
|
+
}, string, PublicProps, Readonly<Props_3> & Readonly<{
|
|
286
|
+
"onUpdate:modelValue"?: (value: boolean) => any;
|
|
287
|
+
}>, {
|
|
288
|
+
disabled: boolean;
|
|
289
|
+
className: string;
|
|
290
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
291
|
+
|
|
292
|
+
export declare function useI18n(options: UseI18nOptions): {
|
|
293
|
+
t: (path: string) => string;
|
|
294
|
+
tObj: (item: Record<string, string>) => string;
|
|
295
|
+
locale: ComputedRef<string>;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
export declare interface UseI18nOptions {
|
|
299
|
+
messages: Record<string, I18nMessages>;
|
|
300
|
+
locale: ComputedRef<string> | string;
|
|
301
|
+
fallbackLocale?: string;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* 预设的活力配色方案(10种)
|
|
306
|
+
*/
|
|
307
|
+
export declare const VIBRANT_PALETTES: string[][];
|
|
308
|
+
|
|
309
|
+
export { }
|