@5even7/dlc-ui 0.1.0 → 0.2.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/CHANGELOG.md +10 -3
- package/README.md +25 -22
- package/dist/capsule.cjs +42 -33
- package/dist/capsule.mjs +51 -56
- package/dist/color.cjs +18 -20
- package/dist/color.mjs +24 -40
- package/dist/index.cjs +64 -40
- package/dist/index.mjs +95 -99
- package/dist/index.umd.js +64 -40
- package/dist/index.umd.min.js +1 -1
- package/dist/progress.cjs +38 -20
- package/dist/progress.mjs +53 -55
- package/dist/vue2.cjs +67 -50
- package/dist/vue2.mjs +113 -120
- package/dist/vue3.cjs +67 -50
- package/dist/vue3.mjs +113 -120
- package/package.json +1 -1
- package/types/index.d.ts +37 -36
package/dist/vue3.mjs
CHANGED
|
@@ -114,50 +114,50 @@ const PALETTES$1 = {
|
|
|
114
114
|
* Capsule 预置:仅星云材质 NC-01~NC-06(NC-07~09 aurora 已移除)。
|
|
115
115
|
* 颜色引用公共色板,seed/speed 决定形态与流速。
|
|
116
116
|
*/
|
|
117
|
-
const CAPSULE_PRESETS = [
|
|
118
|
-
{ id: 'original', code: 'NC-01', name: '
|
|
119
|
-
{ id: 'ocean', code: 'NC-02', name: '
|
|
120
|
-
{ id: 'klein', code: 'NC-03', name: '
|
|
121
|
-
{ id: 'ultraviolet', code: 'NC-04', name: '
|
|
122
|
-
{ id: 'chrome', code: 'NC-05', name: '
|
|
123
|
-
{ id: 'plus', code: 'NC-06', name: '
|
|
117
|
+
const CAPSULE_PRESETS = [
|
|
118
|
+
{ id: 'original', code: 'NC-01', name: '初光', group: 'warm', seed: 1.7, speed: 0.5, colors: [...PALETTES$1.original] },
|
|
119
|
+
{ id: 'ocean', code: 'NC-02', name: '沧溟', group: 'cold', seed: 8.2, speed: 0.48, colors: [...PALETTES$1.ocean] },
|
|
120
|
+
{ id: 'klein', code: 'NC-03', name: '玄夜', group: 'cold', seed: 14.1, speed: 0.49, colors: [...PALETTES$1.klein] },
|
|
121
|
+
{ id: 'ultraviolet', code: 'NC-04', name: '紫霄', group: 'cold', seed: 23.4, speed: 0.47, colors: [...PALETTES$1.ultraviolet] },
|
|
122
|
+
{ id: 'chrome', code: 'NC-05', name: '银汉', group: 'cold', seed: 37.8, speed: 0.42, colors: [...PALETTES$1.chrome] },
|
|
123
|
+
{ id: 'plus', code: 'NC-06', name: '熔金', group: 'warm', seed: 51.3, speed: 0.5, colors: [...PALETTES$1.plus] }
|
|
124
124
|
];
|
|
125
125
|
|
|
126
126
|
const PROGRESS_PRESETS = [
|
|
127
|
-
{
|
|
128
|
-
id: 'model-training',
|
|
129
|
-
code: 'NC-10',
|
|
130
|
-
name: '
|
|
127
|
+
{
|
|
128
|
+
id: 'model-training',
|
|
129
|
+
code: 'NC-10',
|
|
130
|
+
name: '星火',
|
|
131
131
|
subtitle: 'SHA 4.5 + 100 2026 TKN',
|
|
132
132
|
group: 'progress',
|
|
133
133
|
initialProgress: 43,
|
|
134
134
|
edgeStyle: 'flow',
|
|
135
135
|
colors: ['#2B1025', '#FF3F94', '#FF8A3D', '#FFF06A']
|
|
136
136
|
},
|
|
137
|
-
{
|
|
138
|
-
id: 'agent-migration',
|
|
139
|
-
code: 'NC-11',
|
|
140
|
-
name: '
|
|
137
|
+
{
|
|
138
|
+
id: 'agent-migration',
|
|
139
|
+
code: 'NC-11',
|
|
140
|
+
name: '迁流',
|
|
141
141
|
subtitle: 'TRANSFERRING PROTOCOL',
|
|
142
142
|
group: 'progress',
|
|
143
143
|
initialProgress: 33,
|
|
144
144
|
edgeStyle: 'flow',
|
|
145
145
|
colors: ['#101C37', '#245BFF', '#00CFFF', '#5DFFE6']
|
|
146
146
|
},
|
|
147
|
-
{
|
|
148
|
-
id: 'visual-training',
|
|
149
|
-
code: 'NC-12',
|
|
150
|
-
name: '
|
|
147
|
+
{
|
|
148
|
+
id: 'visual-training',
|
|
149
|
+
code: 'NC-12',
|
|
150
|
+
name: '幻境',
|
|
151
151
|
subtitle: 'GENERATING POWER ++',
|
|
152
152
|
group: 'progress',
|
|
153
153
|
initialProgress: 58,
|
|
154
154
|
edgeStyle: 'flow',
|
|
155
155
|
colors: ['#21142D', '#7042FF', '#42F58D', '#C4FF8A']
|
|
156
156
|
},
|
|
157
|
-
{
|
|
158
|
-
id: 'tide',
|
|
159
|
-
code: 'NC-13',
|
|
160
|
-
name: '
|
|
157
|
+
{
|
|
158
|
+
id: 'tide',
|
|
159
|
+
code: 'NC-13',
|
|
160
|
+
name: '汐潮',
|
|
161
161
|
subtitle: 'MOON PULL / COAST',
|
|
162
162
|
group: 'progress',
|
|
163
163
|
initialProgress: 30,
|
|
@@ -166,64 +166,33 @@ const PROGRESS_PRESETS = [
|
|
|
166
166
|
}
|
|
167
167
|
];
|
|
168
168
|
|
|
169
|
-
[...CAPSULE_PRESETS, ...PROGRESS_PRESETS];
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return Boolean(
|
|
186
|
-
preset &&
|
|
187
|
-
typeof preset.id === 'string' &&
|
|
188
|
-
typeof preset.code === 'string' &&
|
|
189
|
-
typeof preset.name === 'string' &&
|
|
190
|
-
preset.group === 'progress' &&
|
|
191
|
-
Number.isFinite(preset.initialProgress) &&
|
|
192
|
-
['flow', 'tide'].indexOf(preset.edgeStyle || 'flow') !== -1 &&
|
|
193
|
-
Array.isArray(preset.colors) &&
|
|
194
|
-
preset.colors.length === 4
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function getPreset(kind, ref) {
|
|
199
|
-
const list = kind === 'capsule' ? CAPSULE_PRESETS : kind === 'progress' ? PROGRESS_PRESETS : null;
|
|
200
|
-
if (!list) throw new Error(`Unknown preset kind: ${kind} (use "capsule" or "progress")`);
|
|
201
|
-
if (ref && typeof ref === 'object') {
|
|
202
|
-
const valid = kind === 'capsule' ? validatePreset(ref) : validateProgressPreset(ref);
|
|
203
|
-
if (!valid) throw new Error(`Invalid ${kind} preset object`);
|
|
204
|
-
return ref;
|
|
205
|
-
}
|
|
206
|
-
const key = String(ref).trim().toLowerCase();
|
|
207
|
-
const found = list.find(
|
|
208
|
-
(preset) =>
|
|
209
|
-
preset.id.toLowerCase() === key ||
|
|
210
|
-
preset.code.toLowerCase() === key ||
|
|
211
|
-
preset.name.toLowerCase() === key
|
|
212
|
-
);
|
|
213
|
-
if (!found) throw new Error(`Unknown ${kind} preset: ${ref}`);
|
|
214
|
-
return found;
|
|
169
|
+
[...CAPSULE_PRESETS, ...PROGRESS_PRESETS];
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Resolve a preset by its literary name (e.g. '沧溟').
|
|
173
|
+
* Matching is case-insensitive and ignores surrounding whitespace,
|
|
174
|
+
* so '沧溟' and ' 沧溟 ' both work.
|
|
175
|
+
*/
|
|
176
|
+
function getPreset(kind, ref) {
|
|
177
|
+
const list = kind === 'capsule' ? CAPSULE_PRESETS : kind === 'progress' ? PROGRESS_PRESETS : null;
|
|
178
|
+
if (!list) throw new Error(`Unknown preset kind: ${kind} (use "capsule" or "progress")`);
|
|
179
|
+
const key = String(ref).trim().toLowerCase();
|
|
180
|
+
const found = list.find(
|
|
181
|
+
(preset) => preset.name.toLowerCase() === key
|
|
182
|
+
);
|
|
183
|
+
if (!found) throw new Error(`Unknown ${kind} preset: ${ref}`);
|
|
184
|
+
return found;
|
|
215
185
|
}
|
|
216
186
|
|
|
217
187
|
const DEFAULTS = {
|
|
218
188
|
capsule: {
|
|
219
189
|
width: '100%',
|
|
220
190
|
height: 160,
|
|
221
|
-
quality: 'auto',
|
|
222
|
-
renderer: 'auto',
|
|
223
|
-
respectReducedMotion: true,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
showCopy: true
|
|
191
|
+
quality: 'auto',
|
|
192
|
+
renderer: 'auto',
|
|
193
|
+
respectReducedMotion: true,
|
|
194
|
+
mouseColor: true,
|
|
195
|
+
showCopy: true
|
|
227
196
|
},
|
|
228
197
|
progress: {
|
|
229
198
|
width: 454,
|
|
@@ -725,15 +694,15 @@ function prefersReducedMotion$1() {
|
|
|
725
694
|
* Mount a cosmic (nebula) capsule into `container`.
|
|
726
695
|
*
|
|
727
696
|
* Options: preset (id/code/name or object), width, height (number=px or
|
|
728
|
-
* string with px/%/vw/vh/em/rem), colors, seed, speed, quality,
|
|
729
|
-
* respectReducedMotion, copy, cssVars.
|
|
697
|
+
* string with px/%/vw/vh/em/rem), colors, seed, speed, quality,
|
|
698
|
+
* respectReducedMotion, copy, cssVars.
|
|
730
699
|
*/
|
|
731
700
|
function createCapsule(container, options = {}) {
|
|
732
701
|
if (!container || typeof container.appendChild !== 'function') {
|
|
733
702
|
throw new Error('createCapsule: container element is required');
|
|
734
703
|
}
|
|
735
704
|
|
|
736
|
-
const preset = { ...getPreset('capsule', options.preset ?? '
|
|
705
|
+
const preset = { ...getPreset('capsule', options.preset ?? '初光') };
|
|
737
706
|
const merged = normalizeOptions(DEFAULTS.capsule, preset, options);
|
|
738
707
|
const copy = { ...COPY, ...(merged.copy || {}) };
|
|
739
708
|
|
|
@@ -820,10 +789,8 @@ function createCapsule(container, options = {}) {
|
|
|
820
789
|
|
|
821
790
|
const visibility = createVisibilityGuard(root);
|
|
822
791
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
root.addEventListener('pointerleave', () => emitter.emit('pointerleave', { preset: { ...preset } }));
|
|
826
|
-
}
|
|
792
|
+
root.addEventListener('pointerenter', () => emitter.emit('pointerenter', { preset: { ...preset } }));
|
|
793
|
+
root.addEventListener('pointerleave', () => emitter.emit('pointerleave', { preset: { ...preset } }));
|
|
827
794
|
root.addEventListener('click', (event) => {
|
|
828
795
|
emitter.emit('click', { event, preset: { ...preset } });
|
|
829
796
|
});
|
|
@@ -863,12 +830,26 @@ function createCapsule(container, options = {}) {
|
|
|
863
830
|
emitter.emit('presetchange', { preset: { ...next } });
|
|
864
831
|
return this;
|
|
865
832
|
},
|
|
866
|
-
setColors(colors) {
|
|
867
|
-
if (!Array.isArray(colors) || colors.length !== 4) return this;
|
|
868
|
-
preset.colors = colors;
|
|
869
|
-
renderer.setPreset({ ...preset, colors });
|
|
870
|
-
return this;
|
|
871
|
-
},
|
|
833
|
+
setColors(colors) {
|
|
834
|
+
if (!Array.isArray(colors) || colors.length !== 4) return this;
|
|
835
|
+
preset.colors = colors;
|
|
836
|
+
renderer.setPreset({ ...preset, colors });
|
|
837
|
+
return this;
|
|
838
|
+
},
|
|
839
|
+
setSeed(seed) {
|
|
840
|
+
const value = Number(seed);
|
|
841
|
+
if (!Number.isFinite(value)) return this;
|
|
842
|
+
preset.seed = value;
|
|
843
|
+
renderer.setPreset({ ...preset });
|
|
844
|
+
return this;
|
|
845
|
+
},
|
|
846
|
+
setSpeed(speed) {
|
|
847
|
+
const value = Number(speed);
|
|
848
|
+
if (!Number.isFinite(value)) return this;
|
|
849
|
+
preset.speed = value;
|
|
850
|
+
renderer.setPreset({ ...preset });
|
|
851
|
+
return this;
|
|
852
|
+
},
|
|
872
853
|
setSize(width, height) {
|
|
873
854
|
if (width !== undefined) merged.width = width;
|
|
874
855
|
if (height !== undefined) merged.height = height;
|
|
@@ -2053,7 +2034,7 @@ function createProgressCapsule(container, options = {}) {
|
|
|
2053
2034
|
throw new Error('createProgressCapsule: container element is required');
|
|
2054
2035
|
}
|
|
2055
2036
|
|
|
2056
|
-
const preset = { ...getPreset('progress', options.preset ?? '
|
|
2037
|
+
const preset = { ...getPreset('progress', options.preset ?? '星火') };
|
|
2057
2038
|
const merged = normalizeOptions(DEFAULTS.progress, preset, options);
|
|
2058
2039
|
const copy = { ...COPY, ...(merged.copy || {}) };
|
|
2059
2040
|
|
|
@@ -2192,9 +2173,9 @@ function createProgressCapsule(container, options = {}) {
|
|
|
2192
2173
|
controller.setRange(min, max);
|
|
2193
2174
|
return this;
|
|
2194
2175
|
},
|
|
2195
|
-
setPreset(ref) {
|
|
2196
|
-
const next = getPreset('progress', ref);
|
|
2197
|
-
Object.assign(preset, next);
|
|
2176
|
+
setPreset(ref) {
|
|
2177
|
+
const next = getPreset('progress', ref);
|
|
2178
|
+
Object.assign(preset, next);
|
|
2198
2179
|
controller.preset = next;
|
|
2199
2180
|
controller.profile = next.edgeStyle === 'tide'
|
|
2200
2181
|
? FLOW_PROFILES.tide
|
|
@@ -2208,10 +2189,25 @@ function createProgressCapsule(container, options = {}) {
|
|
|
2208
2189
|
}
|
|
2209
2190
|
controller.webglActive = Boolean(overlay);
|
|
2210
2191
|
controller.resizeCanvas();
|
|
2211
|
-
emitter.emit('presetchange', { preset: { ...next } });
|
|
2212
|
-
return this;
|
|
2213
|
-
},
|
|
2214
|
-
|
|
2192
|
+
emitter.emit('presetchange', { preset: { ...next } });
|
|
2193
|
+
return this;
|
|
2194
|
+
},
|
|
2195
|
+
setEdgeStyle(edgeStyle) {
|
|
2196
|
+
const value = String(edgeStyle || '').toLowerCase();
|
|
2197
|
+
if (value !== 'flow' && value !== 'tide') return this;
|
|
2198
|
+
preset.edgeStyle = value;
|
|
2199
|
+
controller.profile = value === 'tide'
|
|
2200
|
+
? FLOW_PROFILES.tide
|
|
2201
|
+
: (FLOW_PROFILES[preset.id] || FLOW_PROFILES['visual-training']);
|
|
2202
|
+
if (overlay) {
|
|
2203
|
+
overlay.dispose();
|
|
2204
|
+
overlay = attachProgressFlowOverlay({ root, canvas, preset, getProgress: () => controller.value });
|
|
2205
|
+
}
|
|
2206
|
+
controller.webglActive = Boolean(overlay);
|
|
2207
|
+
controller.resizeCanvas();
|
|
2208
|
+
return this;
|
|
2209
|
+
},
|
|
2210
|
+
setColors(colors) {
|
|
2215
2211
|
if (!Array.isArray(colors) || colors.length !== 4) return this;
|
|
2216
2212
|
controller.setColors(colors);
|
|
2217
2213
|
if (overlay) overlay.setColors(colors);
|
|
@@ -2321,32 +2317,29 @@ function makeWrapper({ name, props, events, create, render, methods, watch }) {
|
|
|
2321
2317
|
function makeCapsuleWrapper(createCapsule, render) {
|
|
2322
2318
|
return makeWrapper({
|
|
2323
2319
|
name: 'CosmicCapsule',
|
|
2324
|
-
props: [
|
|
2325
|
-
'preset', 'width', 'height', 'colors', 'seed', 'speed',
|
|
2326
|
-
'mouseColor', 'renderer', 'quality', 'respectReducedMotion', 'copy', 'cssVars'
|
|
2320
|
+
props: [
|
|
2321
|
+
'preset', 'width', 'height', 'colors', 'seed', 'speed',
|
|
2322
|
+
'mouseColor', 'renderer', 'quality', 'respectReducedMotion', 'copy', 'cssVars'
|
|
2327
2323
|
],
|
|
2328
2324
|
events: CAPSULE_EVENTS,
|
|
2329
2325
|
create: createCapsule,
|
|
2330
2326
|
render,
|
|
2331
2327
|
watch: {
|
|
2332
|
-
seed(value) {
|
|
2333
|
-
const seed = Number(value);
|
|
2334
|
-
if (this.controller && Number.isFinite(seed)) {
|
|
2335
|
-
this.controller.
|
|
2336
|
-
}
|
|
2337
|
-
},
|
|
2338
|
-
speed(value) {
|
|
2339
|
-
const speed = Number(value);
|
|
2340
|
-
if (this.controller && Number.isFinite(speed)) {
|
|
2341
|
-
this.controller.
|
|
2342
|
-
}
|
|
2343
|
-
},
|
|
2344
|
-
|
|
2345
|
-
this.scheduleRecreate();
|
|
2346
|
-
},
|
|
2347
|
-
mouseColor() {
|
|
2348
|
-
this.scheduleRecreate();
|
|
2349
|
-
},
|
|
2328
|
+
seed(value) {
|
|
2329
|
+
const seed = Number(value);
|
|
2330
|
+
if (this.controller && Number.isFinite(seed)) {
|
|
2331
|
+
this.controller.setSeed(seed);
|
|
2332
|
+
}
|
|
2333
|
+
},
|
|
2334
|
+
speed(value) {
|
|
2335
|
+
const speed = Number(value);
|
|
2336
|
+
if (this.controller && Number.isFinite(speed)) {
|
|
2337
|
+
this.controller.setSpeed(speed);
|
|
2338
|
+
}
|
|
2339
|
+
},
|
|
2340
|
+
mouseColor() {
|
|
2341
|
+
this.scheduleRecreate();
|
|
2342
|
+
},
|
|
2350
2343
|
renderer() {
|
|
2351
2344
|
this.scheduleRecreate();
|
|
2352
2345
|
}
|
|
@@ -2385,9 +2378,9 @@ function makeProgressWrapper(createProgressCapsule, render) {
|
|
|
2385
2378
|
max(value) {
|
|
2386
2379
|
if (value !== undefined && this.controller) this.controller.setRange(this.controller.min, value);
|
|
2387
2380
|
},
|
|
2388
|
-
edgeStyle(value) {
|
|
2389
|
-
if (value && this.controller) this.controller.
|
|
2390
|
-
},
|
|
2381
|
+
edgeStyle(value) {
|
|
2382
|
+
if (value && this.controller) this.controller.setEdgeStyle(value);
|
|
2383
|
+
},
|
|
2391
2384
|
draggable() {
|
|
2392
2385
|
this.scheduleRecreate();
|
|
2393
2386
|
},
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -40,15 +40,15 @@ export interface Copy {
|
|
|
40
40
|
color?: string;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export interface CapsuleOptions {
|
|
44
|
-
preset?: string
|
|
43
|
+
export interface CapsuleOptions {
|
|
44
|
+
preset?: string;
|
|
45
45
|
width?: number | string;
|
|
46
46
|
height?: number | string;
|
|
47
|
-
colors?: string[];
|
|
48
|
-
seed?: number;
|
|
49
|
-
speed?: number;
|
|
50
|
-
|
|
51
|
-
renderer?: 'auto' | 'webgl2' | 'canvas2d';
|
|
47
|
+
colors?: string[];
|
|
48
|
+
seed?: number;
|
|
49
|
+
speed?: number;
|
|
50
|
+
mouseColor?: boolean;
|
|
51
|
+
renderer?: 'auto' | 'webgl2' | 'canvas2d';
|
|
52
52
|
showCopy?: boolean;
|
|
53
53
|
quality?: Quality;
|
|
54
54
|
respectReducedMotion?: boolean;
|
|
@@ -57,8 +57,8 @@ export interface CapsuleOptions {
|
|
|
57
57
|
[key: string]: unknown;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export interface ProgressOptions {
|
|
61
|
-
preset?: string
|
|
60
|
+
export interface ProgressOptions {
|
|
61
|
+
preset?: string;
|
|
62
62
|
width?: number | string;
|
|
63
63
|
height?: number | string;
|
|
64
64
|
value?: number;
|
|
@@ -77,8 +77,8 @@ export interface ProgressOptions {
|
|
|
77
77
|
[key: string]: unknown;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export interface ColorBackgroundOptions {
|
|
81
|
-
preset?: string
|
|
80
|
+
export interface ColorBackgroundOptions {
|
|
81
|
+
preset?: string;
|
|
82
82
|
colors?: string[];
|
|
83
83
|
seed?: number;
|
|
84
84
|
speed?: number;
|
|
@@ -98,10 +98,12 @@ export interface Emitter {
|
|
|
98
98
|
|
|
99
99
|
export interface CapsuleController extends Emitter {
|
|
100
100
|
element: HTMLElement;
|
|
101
|
-
canvas: HTMLCanvasElement;
|
|
102
|
-
preset: CapsulePreset;
|
|
103
|
-
setPreset(ref: string
|
|
104
|
-
setColors(colors: string[]): this;
|
|
101
|
+
canvas: HTMLCanvasElement;
|
|
102
|
+
preset: CapsulePreset;
|
|
103
|
+
setPreset(ref: string): this;
|
|
104
|
+
setColors(colors: string[]): this;
|
|
105
|
+
setSeed(seed: number): this;
|
|
106
|
+
setSpeed(speed: number): this;
|
|
105
107
|
setSize(width?: number | string, height?: number | string): this;
|
|
106
108
|
randomize(): this;
|
|
107
109
|
pause(): this;
|
|
@@ -110,18 +112,19 @@ export interface CapsuleController extends Emitter {
|
|
|
110
112
|
dispose(): void;
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
export interface ProgressController extends Emitter {
|
|
114
|
-
element: HTMLElement;
|
|
115
|
-
canvas: HTMLCanvasElement;
|
|
116
|
-
preset: ProgressPreset;
|
|
117
|
-
setValue(value: number, source?: string): this;
|
|
118
|
-
getValue(): number;
|
|
119
|
-
setRange(min: number, max: number): this;
|
|
120
|
-
setPreset(ref: string
|
|
121
|
-
setColors(colors: string[]): this;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
export interface ProgressController extends Emitter {
|
|
116
|
+
element: HTMLElement;
|
|
117
|
+
canvas: HTMLCanvasElement;
|
|
118
|
+
preset: ProgressPreset;
|
|
119
|
+
setValue(value: number, source?: string): this;
|
|
120
|
+
getValue(): number;
|
|
121
|
+
setRange(min: number, max: number): this;
|
|
122
|
+
setPreset(ref: string): this;
|
|
123
|
+
setColors(colors: string[]): this;
|
|
124
|
+
setEdgeStyle(style: 'flow' | 'tide'): this;
|
|
125
|
+
setSize(width?: number | string, height?: number | string): this;
|
|
126
|
+
randomize(): this;
|
|
127
|
+
pause(): this;
|
|
125
128
|
resume(): this;
|
|
126
129
|
setQuality(quality: Quality): this;
|
|
127
130
|
dispose(): void;
|
|
@@ -132,7 +135,7 @@ export interface ColorBackgroundController extends Emitter {
|
|
|
132
135
|
layer: HTMLElement;
|
|
133
136
|
canvas: HTMLCanvasElement;
|
|
134
137
|
preset: CapsulePreset;
|
|
135
|
-
setPreset(ref: string
|
|
138
|
+
setPreset(ref: string): this;
|
|
136
139
|
setColors(colors: string[]): this;
|
|
137
140
|
setQuality(quality: Quality): this;
|
|
138
141
|
setOpacity(value: number): this;
|
|
@@ -156,15 +159,13 @@ export declare function createCapsule(container: HTMLElement, options?: CapsuleO
|
|
|
156
159
|
export declare function createProgressCapsule(container: HTMLElement, options?: ProgressOptions): ProgressController;
|
|
157
160
|
export declare function createColorBackground(host: HTMLElement, options?: ColorBackgroundOptions): ColorBackgroundController;
|
|
158
161
|
|
|
159
|
-
export declare const PRESETS: CapsulePreset[];
|
|
160
|
-
export declare const PROGRESS_PRESETS: ProgressPreset[];
|
|
161
|
-
export declare const ALL_PRESETS: Array<CapsulePreset | ProgressPreset>;
|
|
162
|
-
export declare function
|
|
163
|
-
export declare function validateProgressPreset(preset: ProgressPreset): boolean;
|
|
164
|
-
export declare function getPreset(kind: 'capsule' | 'progress', ref: string): CapsulePreset | ProgressPreset;
|
|
162
|
+
export declare const PRESETS: CapsulePreset[];
|
|
163
|
+
export declare const PROGRESS_PRESETS: ProgressPreset[];
|
|
164
|
+
export declare const ALL_PRESETS: Array<CapsulePreset | ProgressPreset>;
|
|
165
|
+
export declare function getPreset(kind: 'capsule' | 'progress', ref: string): CapsulePreset | ProgressPreset;
|
|
165
166
|
|
|
166
|
-
export declare const DEFAULTS: {
|
|
167
|
-
capsule: Required<Pick<CapsuleOptions, 'width' | 'height' | 'quality' | 'respectReducedMotion' | '
|
|
167
|
+
export declare const DEFAULTS: {
|
|
168
|
+
capsule: Required<Pick<CapsuleOptions, 'width' | 'height' | 'quality' | 'respectReducedMotion' | 'mouseColor' | 'renderer' | 'showCopy'>>;
|
|
168
169
|
progress: Required<Pick<ProgressOptions, 'width' | 'height' | 'min' | 'max' | 'draggable' | 'keyboard' | 'edgeStyle' | 'quality' | 'respectReducedMotion' | 'renderer' | 'showCopy'>>;
|
|
169
170
|
};
|
|
170
171
|
|