@5even7/dlc-ui 0.2.14 → 0.2.16
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/CHANGELOG.md +120 -116
- package/LICENSE +21 -21
- package/README.md +313 -313
- package/dist/capsule.cjs +32 -32
- package/dist/capsule.mjs +1070 -1070
- package/dist/color.cjs +33 -33
- package/dist/color.mjs +1019 -1019
- package/dist/emo.cjs +19008 -7492
- package/dist/emo.mjs +439 -436
- package/dist/index.cjs +19061 -7545
- package/dist/index.mjs +3748 -3745
- package/dist/index.umd.js +33624 -45215
- package/dist/index.umd.min.js +1 -1
- package/dist/progress.cjs +42 -42
- package/dist/progress.mjs +2154 -2154
- package/dist/vue2.cjs +19074 -7558
- package/dist/vue2.mjs +4184 -4181
- package/dist/vue3.cjs +19074 -7558
- package/dist/vue3.mjs +4184 -4181
- package/package.json +135 -135
- package/styles/base.css +32 -32
- package/styles/color.css +18 -18
- package/styles/emo.css +33 -32
- package/styles/progress.css +96 -96
- package/types/capsule.d.ts +15 -15
- package/types/color.d.ts +15 -15
- package/types/emo.d.ts +11 -11
- package/types/index.d.ts +393 -393
- package/types/progress.d.ts +16 -16
- package/types/vue2.d.ts +10 -10
- package/types/vue3.d.ts +144 -144
package/types/index.d.ts
CHANGED
|
@@ -1,393 +1,393 @@
|
|
|
1
|
-
export type Quality = 'auto' | 'low' | 'medium' | 'high';
|
|
2
|
-
export type PowerPreference = 'default' | 'high-performance' | 'low-power';
|
|
3
|
-
export type ColorTuple = [string, string, string, string];
|
|
4
|
-
|
|
5
|
-
export interface CapsulePreset {
|
|
6
|
-
id: string;
|
|
7
|
-
code: string;
|
|
8
|
-
name: string;
|
|
9
|
-
group: 'warm' | 'cold';
|
|
10
|
-
theme?: 'light' | 'dark';
|
|
11
|
-
subtitle?: string;
|
|
12
|
-
seed: number;
|
|
13
|
-
speed: number;
|
|
14
|
-
colors: ColorTuple;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ProgressPreset {
|
|
18
|
-
id: string;
|
|
19
|
-
code: string;
|
|
20
|
-
name: string;
|
|
21
|
-
group: 'progress';
|
|
22
|
-
subtitle?: string;
|
|
23
|
-
initialProgress: number;
|
|
24
|
-
edgeStyle: 'flow' | 'tide';
|
|
25
|
-
colors: ColorTuple;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface EmoPreset {
|
|
29
|
-
type: string;
|
|
30
|
-
name: string;
|
|
31
|
-
label: string;
|
|
32
|
-
category: string;
|
|
33
|
-
width: number;
|
|
34
|
-
height: number;
|
|
35
|
-
frames: number;
|
|
36
|
-
fps: number;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface EmoTypeDefinition {
|
|
40
|
-
type: string;
|
|
41
|
-
label: string;
|
|
42
|
-
names: string[];
|
|
43
|
-
colorChannels: Array<'color' | 'accentColor'>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface Copy {
|
|
47
|
-
brandName: string;
|
|
48
|
-
valueSuffix: string;
|
|
49
|
-
progressAria: string;
|
|
50
|
-
capsuleAria: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface CapsuleOptions {
|
|
54
|
-
preset?: string;
|
|
55
|
-
width?: number | string;
|
|
56
|
-
height?: number | string;
|
|
57
|
-
colors?: string[];
|
|
58
|
-
seed?: number;
|
|
59
|
-
speed?: number;
|
|
60
|
-
textRatio?: number;
|
|
61
|
-
text?: string | Node | Node[];
|
|
62
|
-
colorContent?: string | Node | Node[];
|
|
63
|
-
label?: string;
|
|
64
|
-
mouseColor?: boolean;
|
|
65
|
-
renderer?: 'auto' | 'webgl2' | 'canvas2d';
|
|
66
|
-
quality?: Quality;
|
|
67
|
-
renderScale?: number;
|
|
68
|
-
powerPreference?: PowerPreference;
|
|
69
|
-
fps?: number;
|
|
70
|
-
paused?: boolean;
|
|
71
|
-
static?: boolean;
|
|
72
|
-
respectReducedMotion?: boolean;
|
|
73
|
-
cssVars?: Record<string, string>;
|
|
74
|
-
[key: string]: unknown;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface ProgressOptions {
|
|
78
|
-
preset?: string;
|
|
79
|
-
width?: number | string;
|
|
80
|
-
height?: number | string;
|
|
81
|
-
value?: number;
|
|
82
|
-
modelValue?: number;
|
|
83
|
-
min?: number;
|
|
84
|
-
max?: number;
|
|
85
|
-
step?: number | 'any';
|
|
86
|
-
draggable?: boolean;
|
|
87
|
-
keyboard?: boolean;
|
|
88
|
-
disabled?: boolean;
|
|
89
|
-
readonly?: boolean;
|
|
90
|
-
valueSuffix?: string;
|
|
91
|
-
precision?: number;
|
|
92
|
-
formatValue?: (value: number, context: { min: number; max: number; suffix: string }) => string;
|
|
93
|
-
direction?: 'ltr' | 'rtl';
|
|
94
|
-
edgeStyle?: 'flow' | 'tide';
|
|
95
|
-
colors?: string[];
|
|
96
|
-
textRatio?: number;
|
|
97
|
-
text?: string | Node | Node[];
|
|
98
|
-
colorContent?: string | Node | Node[];
|
|
99
|
-
label?: string;
|
|
100
|
-
showValue?: boolean;
|
|
101
|
-
renderer?: 'auto' | 'webgl2' | 'canvas2d';
|
|
102
|
-
quality?: Quality;
|
|
103
|
-
renderScale?: number;
|
|
104
|
-
powerPreference?: PowerPreference;
|
|
105
|
-
fps?: number;
|
|
106
|
-
paused?: boolean;
|
|
107
|
-
static?: boolean;
|
|
108
|
-
respectReducedMotion?: boolean;
|
|
109
|
-
cssVars?: Record<string, string>;
|
|
110
|
-
[key: string]: unknown;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface ColorBackgroundOptions {
|
|
114
|
-
preset?: string;
|
|
115
|
-
colors?: string[];
|
|
116
|
-
seed?: number;
|
|
117
|
-
speed?: number;
|
|
118
|
-
renderer?: 'auto' | 'webgl2' | 'canvas2d';
|
|
119
|
-
quality?: Quality;
|
|
120
|
-
renderScale?: number;
|
|
121
|
-
powerPreference?: PowerPreference;
|
|
122
|
-
fps?: number;
|
|
123
|
-
paused?: boolean;
|
|
124
|
-
static?: boolean;
|
|
125
|
-
mouseColor?: boolean;
|
|
126
|
-
respectReducedMotion?: boolean;
|
|
127
|
-
opacity?: number;
|
|
128
|
-
fallbackColor?: boolean | string;
|
|
129
|
-
[key: string]: unknown;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface EmoOptions {
|
|
133
|
-
type?: string;
|
|
134
|
-
name?: string;
|
|
135
|
-
width?: number | string;
|
|
136
|
-
height?: number | string;
|
|
137
|
-
color?: string;
|
|
138
|
-
accentColor?: string | null;
|
|
139
|
-
speed?: number;
|
|
140
|
-
loop?: boolean;
|
|
141
|
-
autoplay?: boolean;
|
|
142
|
-
direction?: 'forward' | 'reverse' | 1 | -1;
|
|
143
|
-
opacity?: number;
|
|
144
|
-
fit?: 'contain' | 'cover';
|
|
145
|
-
renderer?: 'svg' | 'canvas';
|
|
146
|
-
paused?: boolean;
|
|
147
|
-
segment?: [number, number] | null;
|
|
148
|
-
background?: string;
|
|
149
|
-
label?: string;
|
|
150
|
-
instanceName?: string;
|
|
151
|
-
respectReducedMotion?: boolean;
|
|
152
|
-
[key: string]: unknown;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface Emitter {
|
|
156
|
-
on(event: string, handler: (...args: any[]) => void): () => void;
|
|
157
|
-
off(event: string, handler: (...args: any[]) => void): boolean;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export interface CapsuleController extends Emitter {
|
|
161
|
-
element: HTMLElement;
|
|
162
|
-
canvas: HTMLCanvasElement;
|
|
163
|
-
preset: CapsulePreset;
|
|
164
|
-
setPreset(ref: string): this;
|
|
165
|
-
setColors(colors: string[]): this;
|
|
166
|
-
setSeed(seed: number): this;
|
|
167
|
-
setSpeed(speed: number): this;
|
|
168
|
-
setMouseColor(value: boolean): this;
|
|
169
|
-
setText(content: string | Node | Node[]): this;
|
|
170
|
-
setColorContent(content: string | Node | Node[]): this;
|
|
171
|
-
setTextRatio(ratio: number): this;
|
|
172
|
-
setCssVars(vars: Record<string, string>): this;
|
|
173
|
-
setLabel(label: string): this;
|
|
174
|
-
setSize(width?: number | string, height?: number | string): this;
|
|
175
|
-
randomize(): this;
|
|
176
|
-
pause(): this;
|
|
177
|
-
resume(): this;
|
|
178
|
-
setQuality(quality: Quality): this;
|
|
179
|
-
setRenderScale(value: number): this;
|
|
180
|
-
setPaused(value: boolean): this;
|
|
181
|
-
setStatic(value: boolean): this;
|
|
182
|
-
setFps(value: number): this;
|
|
183
|
-
readonly paused: boolean;
|
|
184
|
-
readonly static: boolean;
|
|
185
|
-
readonly fps: number;
|
|
186
|
-
readonly quality: Quality;
|
|
187
|
-
readonly renderScale: number;
|
|
188
|
-
readonly mouseColor: boolean;
|
|
189
|
-
dispose(): void;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export interface ProgressController extends Emitter {
|
|
193
|
-
element: HTMLElement;
|
|
194
|
-
canvas: HTMLCanvasElement;
|
|
195
|
-
preset: ProgressPreset;
|
|
196
|
-
setValue(value: number, source?: string): this;
|
|
197
|
-
getValue(): number;
|
|
198
|
-
setRange(min: number, max: number): this;
|
|
199
|
-
setStep(step: number | 'any'): this;
|
|
200
|
-
setPreset(ref: string): this;
|
|
201
|
-
setColors(colors: string[]): this;
|
|
202
|
-
setEdgeStyle(style: 'flow' | 'tide'): this;
|
|
203
|
-
setText(content: string | Node | Node[]): this;
|
|
204
|
-
setColorContent(content: string | Node | Node[]): this;
|
|
205
|
-
setTextRatio(ratio: number): this;
|
|
206
|
-
setCssVars(vars: Record<string, string>): this;
|
|
207
|
-
setLabel(label: string): this;
|
|
208
|
-
setValueSuffix(suffix: string): this;
|
|
209
|
-
setPrecision(precision: number): this;
|
|
210
|
-
setFormatValue(formatter: ProgressOptions['formatValue'] | null): this;
|
|
211
|
-
setDirection(direction: 'ltr' | 'rtl'): this;
|
|
212
|
-
setShowValue(show: boolean): this;
|
|
213
|
-
setSize(width?: number | string, height?: number | string): this;
|
|
214
|
-
randomize(): this;
|
|
215
|
-
pause(): this;
|
|
216
|
-
resume(): this;
|
|
217
|
-
setQuality(quality: Quality): this;
|
|
218
|
-
setRenderScale(value: number): this;
|
|
219
|
-
setPaused(value: boolean): this;
|
|
220
|
-
setStatic(value: boolean): this;
|
|
221
|
-
setFps(value: number): this;
|
|
222
|
-
readonly min: number;
|
|
223
|
-
readonly max: number;
|
|
224
|
-
readonly step: number | 'any';
|
|
225
|
-
readonly precision: number;
|
|
226
|
-
readonly formatValue: ProgressOptions['formatValue'] | null;
|
|
227
|
-
readonly direction: 'ltr' | 'rtl';
|
|
228
|
-
readonly showValue: boolean;
|
|
229
|
-
readonly valueSuffix: string;
|
|
230
|
-
readonly paused: boolean;
|
|
231
|
-
readonly static: boolean;
|
|
232
|
-
readonly fps: number;
|
|
233
|
-
readonly quality: Quality;
|
|
234
|
-
readonly renderScale: number;
|
|
235
|
-
dispose(): void;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export interface ColorBackgroundController extends Emitter {
|
|
239
|
-
element: HTMLElement;
|
|
240
|
-
layer: HTMLElement;
|
|
241
|
-
canvas: HTMLCanvasElement;
|
|
242
|
-
preset: CapsulePreset;
|
|
243
|
-
setPreset(ref: string): this;
|
|
244
|
-
setColors(colors: string[]): this;
|
|
245
|
-
setSeed(seed: number): this;
|
|
246
|
-
setSpeed(speed: number): this;
|
|
247
|
-
setFallbackColor(value: boolean | string): this;
|
|
248
|
-
setMouseColor(value: boolean): this;
|
|
249
|
-
setQuality(quality: Quality): this;
|
|
250
|
-
setRenderScale(value: number): this;
|
|
251
|
-
setPaused(value: boolean): this;
|
|
252
|
-
setStatic(value: boolean): this;
|
|
253
|
-
setFps(value: number): this;
|
|
254
|
-
setOpacity(value: number): this;
|
|
255
|
-
randomize(): this;
|
|
256
|
-
pause(): this;
|
|
257
|
-
resume(): this;
|
|
258
|
-
dispose(): void;
|
|
259
|
-
readonly paused: boolean;
|
|
260
|
-
readonly static: boolean;
|
|
261
|
-
readonly fps: number;
|
|
262
|
-
readonly quality: Quality;
|
|
263
|
-
readonly renderScale: number;
|
|
264
|
-
readonly opacity: number;
|
|
265
|
-
readonly fallbackColor: boolean | string;
|
|
266
|
-
readonly mouseColor: boolean;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
export interface EmoController extends Emitter {
|
|
270
|
-
element: HTMLElement;
|
|
271
|
-
readonly animation: any;
|
|
272
|
-
readonly preset: EmoPreset;
|
|
273
|
-
play(): this;
|
|
274
|
-
pause(): this;
|
|
275
|
-
stop(): this;
|
|
276
|
-
setPaused(value: boolean): this;
|
|
277
|
-
setSpeed(value: number): this;
|
|
278
|
-
setDirection(value: EmoOptions['direction']): this;
|
|
279
|
-
setSegment(value: EmoOptions['segment']): this;
|
|
280
|
-
setName(value: string): this;
|
|
281
|
-
setType(value: string): this;
|
|
282
|
-
setColors(color: string, accentColor?: string | null): this;
|
|
283
|
-
setOpacity(value: number): this;
|
|
284
|
-
setBackground(value: string): this;
|
|
285
|
-
setSize(width?: number | string, height?: number | string): this;
|
|
286
|
-
setFit(value: EmoOptions['fit']): this;
|
|
287
|
-
setRenderer(value: EmoOptions['renderer']): this;
|
|
288
|
-
setLoop(value: boolean): this;
|
|
289
|
-
setAutoplay(value: boolean): this;
|
|
290
|
-
setLabel(value: string): this;
|
|
291
|
-
dispose(): void;
|
|
292
|
-
readonly speed: number;
|
|
293
|
-
readonly loop: boolean;
|
|
294
|
-
readonly autoplay: boolean;
|
|
295
|
-
readonly direction: 1 | -1;
|
|
296
|
-
readonly opacity: number;
|
|
297
|
-
readonly fit: 'contain' | 'cover';
|
|
298
|
-
readonly renderer: 'svg' | 'canvas';
|
|
299
|
-
readonly paused: boolean;
|
|
300
|
-
readonly segment: [number, number] | null;
|
|
301
|
-
readonly color: string;
|
|
302
|
-
readonly accentColor: string | null;
|
|
303
|
-
readonly background: string;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
export declare class ProgressCapsuleController {
|
|
307
|
-
value: number;
|
|
308
|
-
min: number;
|
|
309
|
-
max: number;
|
|
310
|
-
step: number | 'any';
|
|
311
|
-
webglActive: boolean;
|
|
312
|
-
setProgress(nextValue: number, source?: string): boolean;
|
|
313
|
-
setRange(min: number, max: number): this;
|
|
314
|
-
setStep(step: number | 'any'): this;
|
|
315
|
-
setPrecision(precision: number): this;
|
|
316
|
-
setFormatValue(formatter: ProgressOptions['formatValue'] | null): this;
|
|
317
|
-
setDirection(direction: 'ltr' | 'rtl'): this;
|
|
318
|
-
setValueSuffix(suffix: string): this;
|
|
319
|
-
setShowValue(show: boolean): this;
|
|
320
|
-
update(delta: number, paused: boolean, now: number): void;
|
|
321
|
-
draw(): void;
|
|
322
|
-
randomize(): number;
|
|
323
|
-
dispose(): void;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
export declare function createCapsule(container: HTMLElement, options?: CapsuleOptions): CapsuleController;
|
|
327
|
-
export declare function createProgressCapsule(container: HTMLElement, options?: ProgressOptions): ProgressController;
|
|
328
|
-
export declare function createColorBackground(host: HTMLElement, options?: ColorBackgroundOptions): ColorBackgroundController;
|
|
329
|
-
export declare function createEmo(container: HTMLElement, options?: EmoOptions): EmoController;
|
|
330
|
-
|
|
331
|
-
export declare const PRESETS: CapsulePreset[];
|
|
332
|
-
export declare const PROGRESS_PRESETS: ProgressPreset[];
|
|
333
|
-
export declare const ALL_PRESETS: Array<CapsulePreset | ProgressPreset>;
|
|
334
|
-
export declare function getPreset(kind: 'capsule' | 'progress', ref: string): CapsulePreset | ProgressPreset;
|
|
335
|
-
export declare const EMO_TYPES: EmoTypeDefinition[];
|
|
336
|
-
export declare const EMO_PRESETS: EmoPreset[];
|
|
337
|
-
export declare const EMO_CATEGORIES: Record<string, string>;
|
|
338
|
-
export declare function getEmoPreset(type?: string, name?: string): EmoPreset;
|
|
339
|
-
|
|
340
|
-
export declare const DEFAULTS: {
|
|
341
|
-
capsule: Required<Pick<CapsuleOptions, 'width' | 'height' | 'quality' | 'respectReducedMotion' | 'mouseColor' | 'renderer' | 'textRatio' | 'renderScale' | 'powerPreference' | 'fps' | 'paused' | 'static'>>;
|
|
342
|
-
progress: Required<Pick<ProgressOptions, 'width' | 'height' | 'min' | 'max' | 'step' | 'draggable' | 'keyboard' | 'disabled' | 'readonly' | 'direction' | 'precision' | 'valueSuffix' | 'edgeStyle' | 'quality' | 'respectReducedMotion' | 'renderer' | 'textRatio' | 'showValue' | 'renderScale' | 'powerPreference' | 'fps' | 'paused' | 'static'>>;
|
|
343
|
-
emo: Required<Pick<EmoOptions, 'type' | 'name' | 'width' | 'height' | 'color' | 'speed' | 'loop' | 'autoplay' | 'direction' | 'opacity' | 'fit' | 'renderer' | 'paused' | 'background' | 'respectReducedMotion'>> & Pick<EmoOptions, 'accentColor' | 'segment'>;
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
export declare const COPY: Copy;
|
|
347
|
-
export declare function parseSize(value: number | string): string;
|
|
348
|
-
export declare const QUALITY_TIERS: Record<'low' | 'medium' | 'high', { dpr: number }>;
|
|
349
|
-
export declare function dprCapFor(quality: Quality): number;
|
|
350
|
-
export declare function effectiveDprCap(quality: Quality, renderScale?: number): number;
|
|
351
|
-
export declare function pauseAll(): void;
|
|
352
|
-
export declare function resumeAll(): void;
|
|
353
|
-
export declare function hexToRgb01(hex: string): [number, number, number];
|
|
354
|
-
export declare function hexToRgba(hex: string, alpha?: number): string;
|
|
355
|
-
export declare function normalizeColor(color: string): string | null;
|
|
356
|
-
export declare function validateColors(colors: unknown): boolean;
|
|
357
|
-
|
|
358
|
-
export declare class CosmicRenderer {
|
|
359
|
-
constructor(canvas: HTMLCanvasElement, preset: CapsulePreset, options?: {
|
|
360
|
-
dprCap?: number;
|
|
361
|
-
mouseColor?: boolean;
|
|
362
|
-
eventTarget?: HTMLElement;
|
|
363
|
-
powerPreference?: PowerPreference;
|
|
364
|
-
onContextLost?: (event: Event) => void;
|
|
365
|
-
onContextRestored?: () => void;
|
|
366
|
-
});
|
|
367
|
-
draw(elapsedSeconds: number, paused?: boolean): void;
|
|
368
|
-
setPreset(preset: CapsulePreset): void;
|
|
369
|
-
setDprCap(cap: number): void;
|
|
370
|
-
randomize(): void;
|
|
371
|
-
resize(): void;
|
|
372
|
-
dispose(): void;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
export declare class FallbackRenderer {
|
|
376
|
-
constructor(canvas: HTMLCanvasElement, preset: CapsulePreset, options?: { dprCap?: number });
|
|
377
|
-
draw(elapsedSeconds: number): void;
|
|
378
|
-
setPreset(preset: CapsulePreset): void;
|
|
379
|
-
setDprCap(cap: number): void;
|
|
380
|
-
resize(): void;
|
|
381
|
-
dispose(): void;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
export declare class ProgressFlowRenderer {
|
|
385
|
-
constructor(canvas: HTMLCanvasElement, preset: ProgressPreset, options?: {
|
|
386
|
-
powerPreference?: PowerPreference;
|
|
387
|
-
onContextLost?: (event: Event) => void;
|
|
388
|
-
onContextRestored?: () => void;
|
|
389
|
-
});
|
|
390
|
-
draw(time: number, progress: number, effectImage?: CanvasImageSource | null): void;
|
|
391
|
-
resize(width: number, height: number, dpr: number): void;
|
|
392
|
-
dispose(): void;
|
|
393
|
-
}
|
|
1
|
+
export type Quality = 'auto' | 'low' | 'medium' | 'high';
|
|
2
|
+
export type PowerPreference = 'default' | 'high-performance' | 'low-power';
|
|
3
|
+
export type ColorTuple = [string, string, string, string];
|
|
4
|
+
|
|
5
|
+
export interface CapsulePreset {
|
|
6
|
+
id: string;
|
|
7
|
+
code: string;
|
|
8
|
+
name: string;
|
|
9
|
+
group: 'warm' | 'cold';
|
|
10
|
+
theme?: 'light' | 'dark';
|
|
11
|
+
subtitle?: string;
|
|
12
|
+
seed: number;
|
|
13
|
+
speed: number;
|
|
14
|
+
colors: ColorTuple;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ProgressPreset {
|
|
18
|
+
id: string;
|
|
19
|
+
code: string;
|
|
20
|
+
name: string;
|
|
21
|
+
group: 'progress';
|
|
22
|
+
subtitle?: string;
|
|
23
|
+
initialProgress: number;
|
|
24
|
+
edgeStyle: 'flow' | 'tide';
|
|
25
|
+
colors: ColorTuple;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface EmoPreset {
|
|
29
|
+
type: string;
|
|
30
|
+
name: string;
|
|
31
|
+
label: string;
|
|
32
|
+
category: string;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
frames: number;
|
|
36
|
+
fps: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface EmoTypeDefinition {
|
|
40
|
+
type: string;
|
|
41
|
+
label: string;
|
|
42
|
+
names: string[];
|
|
43
|
+
colorChannels: Array<'color' | 'accentColor'>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface Copy {
|
|
47
|
+
brandName: string;
|
|
48
|
+
valueSuffix: string;
|
|
49
|
+
progressAria: string;
|
|
50
|
+
capsuleAria: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface CapsuleOptions {
|
|
54
|
+
preset?: string;
|
|
55
|
+
width?: number | string;
|
|
56
|
+
height?: number | string;
|
|
57
|
+
colors?: string[];
|
|
58
|
+
seed?: number;
|
|
59
|
+
speed?: number;
|
|
60
|
+
textRatio?: number;
|
|
61
|
+
text?: string | Node | Node[];
|
|
62
|
+
colorContent?: string | Node | Node[];
|
|
63
|
+
label?: string;
|
|
64
|
+
mouseColor?: boolean;
|
|
65
|
+
renderer?: 'auto' | 'webgl2' | 'canvas2d';
|
|
66
|
+
quality?: Quality;
|
|
67
|
+
renderScale?: number;
|
|
68
|
+
powerPreference?: PowerPreference;
|
|
69
|
+
fps?: number;
|
|
70
|
+
paused?: boolean;
|
|
71
|
+
static?: boolean;
|
|
72
|
+
respectReducedMotion?: boolean;
|
|
73
|
+
cssVars?: Record<string, string>;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface ProgressOptions {
|
|
78
|
+
preset?: string;
|
|
79
|
+
width?: number | string;
|
|
80
|
+
height?: number | string;
|
|
81
|
+
value?: number;
|
|
82
|
+
modelValue?: number;
|
|
83
|
+
min?: number;
|
|
84
|
+
max?: number;
|
|
85
|
+
step?: number | 'any';
|
|
86
|
+
draggable?: boolean;
|
|
87
|
+
keyboard?: boolean;
|
|
88
|
+
disabled?: boolean;
|
|
89
|
+
readonly?: boolean;
|
|
90
|
+
valueSuffix?: string;
|
|
91
|
+
precision?: number;
|
|
92
|
+
formatValue?: (value: number, context: { min: number; max: number; suffix: string }) => string;
|
|
93
|
+
direction?: 'ltr' | 'rtl';
|
|
94
|
+
edgeStyle?: 'flow' | 'tide';
|
|
95
|
+
colors?: string[];
|
|
96
|
+
textRatio?: number;
|
|
97
|
+
text?: string | Node | Node[];
|
|
98
|
+
colorContent?: string | Node | Node[];
|
|
99
|
+
label?: string;
|
|
100
|
+
showValue?: boolean;
|
|
101
|
+
renderer?: 'auto' | 'webgl2' | 'canvas2d';
|
|
102
|
+
quality?: Quality;
|
|
103
|
+
renderScale?: number;
|
|
104
|
+
powerPreference?: PowerPreference;
|
|
105
|
+
fps?: number;
|
|
106
|
+
paused?: boolean;
|
|
107
|
+
static?: boolean;
|
|
108
|
+
respectReducedMotion?: boolean;
|
|
109
|
+
cssVars?: Record<string, string>;
|
|
110
|
+
[key: string]: unknown;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface ColorBackgroundOptions {
|
|
114
|
+
preset?: string;
|
|
115
|
+
colors?: string[];
|
|
116
|
+
seed?: number;
|
|
117
|
+
speed?: number;
|
|
118
|
+
renderer?: 'auto' | 'webgl2' | 'canvas2d';
|
|
119
|
+
quality?: Quality;
|
|
120
|
+
renderScale?: number;
|
|
121
|
+
powerPreference?: PowerPreference;
|
|
122
|
+
fps?: number;
|
|
123
|
+
paused?: boolean;
|
|
124
|
+
static?: boolean;
|
|
125
|
+
mouseColor?: boolean;
|
|
126
|
+
respectReducedMotion?: boolean;
|
|
127
|
+
opacity?: number;
|
|
128
|
+
fallbackColor?: boolean | string;
|
|
129
|
+
[key: string]: unknown;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface EmoOptions {
|
|
133
|
+
type?: string;
|
|
134
|
+
name?: string;
|
|
135
|
+
width?: number | string;
|
|
136
|
+
height?: number | string;
|
|
137
|
+
color?: string;
|
|
138
|
+
accentColor?: string | null;
|
|
139
|
+
speed?: number;
|
|
140
|
+
loop?: boolean;
|
|
141
|
+
autoplay?: boolean;
|
|
142
|
+
direction?: 'forward' | 'reverse' | 1 | -1;
|
|
143
|
+
opacity?: number;
|
|
144
|
+
fit?: 'contain' | 'cover' | 'fill';
|
|
145
|
+
renderer?: 'svg' | 'canvas';
|
|
146
|
+
paused?: boolean;
|
|
147
|
+
segment?: [number, number] | null;
|
|
148
|
+
background?: string;
|
|
149
|
+
label?: string;
|
|
150
|
+
instanceName?: string;
|
|
151
|
+
respectReducedMotion?: boolean;
|
|
152
|
+
[key: string]: unknown;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface Emitter {
|
|
156
|
+
on(event: string, handler: (...args: any[]) => void): () => void;
|
|
157
|
+
off(event: string, handler: (...args: any[]) => void): boolean;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface CapsuleController extends Emitter {
|
|
161
|
+
element: HTMLElement;
|
|
162
|
+
canvas: HTMLCanvasElement;
|
|
163
|
+
preset: CapsulePreset;
|
|
164
|
+
setPreset(ref: string): this;
|
|
165
|
+
setColors(colors: string[]): this;
|
|
166
|
+
setSeed(seed: number): this;
|
|
167
|
+
setSpeed(speed: number): this;
|
|
168
|
+
setMouseColor(value: boolean): this;
|
|
169
|
+
setText(content: string | Node | Node[]): this;
|
|
170
|
+
setColorContent(content: string | Node | Node[]): this;
|
|
171
|
+
setTextRatio(ratio: number): this;
|
|
172
|
+
setCssVars(vars: Record<string, string>): this;
|
|
173
|
+
setLabel(label: string): this;
|
|
174
|
+
setSize(width?: number | string, height?: number | string): this;
|
|
175
|
+
randomize(): this;
|
|
176
|
+
pause(): this;
|
|
177
|
+
resume(): this;
|
|
178
|
+
setQuality(quality: Quality): this;
|
|
179
|
+
setRenderScale(value: number): this;
|
|
180
|
+
setPaused(value: boolean): this;
|
|
181
|
+
setStatic(value: boolean): this;
|
|
182
|
+
setFps(value: number): this;
|
|
183
|
+
readonly paused: boolean;
|
|
184
|
+
readonly static: boolean;
|
|
185
|
+
readonly fps: number;
|
|
186
|
+
readonly quality: Quality;
|
|
187
|
+
readonly renderScale: number;
|
|
188
|
+
readonly mouseColor: boolean;
|
|
189
|
+
dispose(): void;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface ProgressController extends Emitter {
|
|
193
|
+
element: HTMLElement;
|
|
194
|
+
canvas: HTMLCanvasElement;
|
|
195
|
+
preset: ProgressPreset;
|
|
196
|
+
setValue(value: number, source?: string): this;
|
|
197
|
+
getValue(): number;
|
|
198
|
+
setRange(min: number, max: number): this;
|
|
199
|
+
setStep(step: number | 'any'): this;
|
|
200
|
+
setPreset(ref: string): this;
|
|
201
|
+
setColors(colors: string[]): this;
|
|
202
|
+
setEdgeStyle(style: 'flow' | 'tide'): this;
|
|
203
|
+
setText(content: string | Node | Node[]): this;
|
|
204
|
+
setColorContent(content: string | Node | Node[]): this;
|
|
205
|
+
setTextRatio(ratio: number): this;
|
|
206
|
+
setCssVars(vars: Record<string, string>): this;
|
|
207
|
+
setLabel(label: string): this;
|
|
208
|
+
setValueSuffix(suffix: string): this;
|
|
209
|
+
setPrecision(precision: number): this;
|
|
210
|
+
setFormatValue(formatter: ProgressOptions['formatValue'] | null): this;
|
|
211
|
+
setDirection(direction: 'ltr' | 'rtl'): this;
|
|
212
|
+
setShowValue(show: boolean): this;
|
|
213
|
+
setSize(width?: number | string, height?: number | string): this;
|
|
214
|
+
randomize(): this;
|
|
215
|
+
pause(): this;
|
|
216
|
+
resume(): this;
|
|
217
|
+
setQuality(quality: Quality): this;
|
|
218
|
+
setRenderScale(value: number): this;
|
|
219
|
+
setPaused(value: boolean): this;
|
|
220
|
+
setStatic(value: boolean): this;
|
|
221
|
+
setFps(value: number): this;
|
|
222
|
+
readonly min: number;
|
|
223
|
+
readonly max: number;
|
|
224
|
+
readonly step: number | 'any';
|
|
225
|
+
readonly precision: number;
|
|
226
|
+
readonly formatValue: ProgressOptions['formatValue'] | null;
|
|
227
|
+
readonly direction: 'ltr' | 'rtl';
|
|
228
|
+
readonly showValue: boolean;
|
|
229
|
+
readonly valueSuffix: string;
|
|
230
|
+
readonly paused: boolean;
|
|
231
|
+
readonly static: boolean;
|
|
232
|
+
readonly fps: number;
|
|
233
|
+
readonly quality: Quality;
|
|
234
|
+
readonly renderScale: number;
|
|
235
|
+
dispose(): void;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface ColorBackgroundController extends Emitter {
|
|
239
|
+
element: HTMLElement;
|
|
240
|
+
layer: HTMLElement;
|
|
241
|
+
canvas: HTMLCanvasElement;
|
|
242
|
+
preset: CapsulePreset;
|
|
243
|
+
setPreset(ref: string): this;
|
|
244
|
+
setColors(colors: string[]): this;
|
|
245
|
+
setSeed(seed: number): this;
|
|
246
|
+
setSpeed(speed: number): this;
|
|
247
|
+
setFallbackColor(value: boolean | string): this;
|
|
248
|
+
setMouseColor(value: boolean): this;
|
|
249
|
+
setQuality(quality: Quality): this;
|
|
250
|
+
setRenderScale(value: number): this;
|
|
251
|
+
setPaused(value: boolean): this;
|
|
252
|
+
setStatic(value: boolean): this;
|
|
253
|
+
setFps(value: number): this;
|
|
254
|
+
setOpacity(value: number): this;
|
|
255
|
+
randomize(): this;
|
|
256
|
+
pause(): this;
|
|
257
|
+
resume(): this;
|
|
258
|
+
dispose(): void;
|
|
259
|
+
readonly paused: boolean;
|
|
260
|
+
readonly static: boolean;
|
|
261
|
+
readonly fps: number;
|
|
262
|
+
readonly quality: Quality;
|
|
263
|
+
readonly renderScale: number;
|
|
264
|
+
readonly opacity: number;
|
|
265
|
+
readonly fallbackColor: boolean | string;
|
|
266
|
+
readonly mouseColor: boolean;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface EmoController extends Emitter {
|
|
270
|
+
element: HTMLElement;
|
|
271
|
+
readonly animation: any;
|
|
272
|
+
readonly preset: EmoPreset;
|
|
273
|
+
play(): this;
|
|
274
|
+
pause(): this;
|
|
275
|
+
stop(): this;
|
|
276
|
+
setPaused(value: boolean): this;
|
|
277
|
+
setSpeed(value: number): this;
|
|
278
|
+
setDirection(value: EmoOptions['direction']): this;
|
|
279
|
+
setSegment(value: EmoOptions['segment']): this;
|
|
280
|
+
setName(value: string): this;
|
|
281
|
+
setType(value: string): this;
|
|
282
|
+
setColors(color: string, accentColor?: string | null): this;
|
|
283
|
+
setOpacity(value: number): this;
|
|
284
|
+
setBackground(value: string): this;
|
|
285
|
+
setSize(width?: number | string, height?: number | string): this;
|
|
286
|
+
setFit(value: EmoOptions['fit']): this;
|
|
287
|
+
setRenderer(value: EmoOptions['renderer']): this;
|
|
288
|
+
setLoop(value: boolean): this;
|
|
289
|
+
setAutoplay(value: boolean): this;
|
|
290
|
+
setLabel(value: string): this;
|
|
291
|
+
dispose(): void;
|
|
292
|
+
readonly speed: number;
|
|
293
|
+
readonly loop: boolean;
|
|
294
|
+
readonly autoplay: boolean;
|
|
295
|
+
readonly direction: 1 | -1;
|
|
296
|
+
readonly opacity: number;
|
|
297
|
+
readonly fit: 'contain' | 'cover' | 'fill';
|
|
298
|
+
readonly renderer: 'svg' | 'canvas';
|
|
299
|
+
readonly paused: boolean;
|
|
300
|
+
readonly segment: [number, number] | null;
|
|
301
|
+
readonly color: string;
|
|
302
|
+
readonly accentColor: string | null;
|
|
303
|
+
readonly background: string;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export declare class ProgressCapsuleController {
|
|
307
|
+
value: number;
|
|
308
|
+
min: number;
|
|
309
|
+
max: number;
|
|
310
|
+
step: number | 'any';
|
|
311
|
+
webglActive: boolean;
|
|
312
|
+
setProgress(nextValue: number, source?: string): boolean;
|
|
313
|
+
setRange(min: number, max: number): this;
|
|
314
|
+
setStep(step: number | 'any'): this;
|
|
315
|
+
setPrecision(precision: number): this;
|
|
316
|
+
setFormatValue(formatter: ProgressOptions['formatValue'] | null): this;
|
|
317
|
+
setDirection(direction: 'ltr' | 'rtl'): this;
|
|
318
|
+
setValueSuffix(suffix: string): this;
|
|
319
|
+
setShowValue(show: boolean): this;
|
|
320
|
+
update(delta: number, paused: boolean, now: number): void;
|
|
321
|
+
draw(): void;
|
|
322
|
+
randomize(): number;
|
|
323
|
+
dispose(): void;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export declare function createCapsule(container: HTMLElement, options?: CapsuleOptions): CapsuleController;
|
|
327
|
+
export declare function createProgressCapsule(container: HTMLElement, options?: ProgressOptions): ProgressController;
|
|
328
|
+
export declare function createColorBackground(host: HTMLElement, options?: ColorBackgroundOptions): ColorBackgroundController;
|
|
329
|
+
export declare function createEmo(container: HTMLElement, options?: EmoOptions): EmoController;
|
|
330
|
+
|
|
331
|
+
export declare const PRESETS: CapsulePreset[];
|
|
332
|
+
export declare const PROGRESS_PRESETS: ProgressPreset[];
|
|
333
|
+
export declare const ALL_PRESETS: Array<CapsulePreset | ProgressPreset>;
|
|
334
|
+
export declare function getPreset(kind: 'capsule' | 'progress', ref: string): CapsulePreset | ProgressPreset;
|
|
335
|
+
export declare const EMO_TYPES: EmoTypeDefinition[];
|
|
336
|
+
export declare const EMO_PRESETS: EmoPreset[];
|
|
337
|
+
export declare const EMO_CATEGORIES: Record<string, string>;
|
|
338
|
+
export declare function getEmoPreset(type?: string, name?: string): EmoPreset;
|
|
339
|
+
|
|
340
|
+
export declare const DEFAULTS: {
|
|
341
|
+
capsule: Required<Pick<CapsuleOptions, 'width' | 'height' | 'quality' | 'respectReducedMotion' | 'mouseColor' | 'renderer' | 'textRatio' | 'renderScale' | 'powerPreference' | 'fps' | 'paused' | 'static'>>;
|
|
342
|
+
progress: Required<Pick<ProgressOptions, 'width' | 'height' | 'min' | 'max' | 'step' | 'draggable' | 'keyboard' | 'disabled' | 'readonly' | 'direction' | 'precision' | 'valueSuffix' | 'edgeStyle' | 'quality' | 'respectReducedMotion' | 'renderer' | 'textRatio' | 'showValue' | 'renderScale' | 'powerPreference' | 'fps' | 'paused' | 'static'>>;
|
|
343
|
+
emo: Required<Pick<EmoOptions, 'type' | 'name' | 'width' | 'height' | 'color' | 'speed' | 'loop' | 'autoplay' | 'direction' | 'opacity' | 'fit' | 'renderer' | 'paused' | 'background' | 'respectReducedMotion'>> & Pick<EmoOptions, 'accentColor' | 'segment'>;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
export declare const COPY: Copy;
|
|
347
|
+
export declare function parseSize(value: number | string): string;
|
|
348
|
+
export declare const QUALITY_TIERS: Record<'low' | 'medium' | 'high', { dpr: number }>;
|
|
349
|
+
export declare function dprCapFor(quality: Quality): number;
|
|
350
|
+
export declare function effectiveDprCap(quality: Quality, renderScale?: number): number;
|
|
351
|
+
export declare function pauseAll(): void;
|
|
352
|
+
export declare function resumeAll(): void;
|
|
353
|
+
export declare function hexToRgb01(hex: string): [number, number, number];
|
|
354
|
+
export declare function hexToRgba(hex: string, alpha?: number): string;
|
|
355
|
+
export declare function normalizeColor(color: string): string | null;
|
|
356
|
+
export declare function validateColors(colors: unknown): boolean;
|
|
357
|
+
|
|
358
|
+
export declare class CosmicRenderer {
|
|
359
|
+
constructor(canvas: HTMLCanvasElement, preset: CapsulePreset, options?: {
|
|
360
|
+
dprCap?: number;
|
|
361
|
+
mouseColor?: boolean;
|
|
362
|
+
eventTarget?: HTMLElement;
|
|
363
|
+
powerPreference?: PowerPreference;
|
|
364
|
+
onContextLost?: (event: Event) => void;
|
|
365
|
+
onContextRestored?: () => void;
|
|
366
|
+
});
|
|
367
|
+
draw(elapsedSeconds: number, paused?: boolean): void;
|
|
368
|
+
setPreset(preset: CapsulePreset): void;
|
|
369
|
+
setDprCap(cap: number): void;
|
|
370
|
+
randomize(): void;
|
|
371
|
+
resize(): void;
|
|
372
|
+
dispose(): void;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export declare class FallbackRenderer {
|
|
376
|
+
constructor(canvas: HTMLCanvasElement, preset: CapsulePreset, options?: { dprCap?: number });
|
|
377
|
+
draw(elapsedSeconds: number): void;
|
|
378
|
+
setPreset(preset: CapsulePreset): void;
|
|
379
|
+
setDprCap(cap: number): void;
|
|
380
|
+
resize(): void;
|
|
381
|
+
dispose(): void;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export declare class ProgressFlowRenderer {
|
|
385
|
+
constructor(canvas: HTMLCanvasElement, preset: ProgressPreset, options?: {
|
|
386
|
+
powerPreference?: PowerPreference;
|
|
387
|
+
onContextLost?: (event: Event) => void;
|
|
388
|
+
onContextRestored?: () => void;
|
|
389
|
+
});
|
|
390
|
+
draw(time: number, progress: number, effectImage?: CanvasImageSource | null): void;
|
|
391
|
+
resize(width: number, height: number, dpr: number): void;
|
|
392
|
+
dispose(): void;
|
|
393
|
+
}
|