@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/progress.cjs
CHANGED
|
@@ -307,7 +307,7 @@ var PALETTES$1 = {
|
|
|
307
307
|
var CAPSULE_PRESETS = [{
|
|
308
308
|
id: 'original',
|
|
309
309
|
code: 'NC-01',
|
|
310
|
-
name: '
|
|
310
|
+
name: '初光',
|
|
311
311
|
group: 'warm',
|
|
312
312
|
seed: 1.7,
|
|
313
313
|
speed: 0.5,
|
|
@@ -315,7 +315,7 @@ var CAPSULE_PRESETS = [{
|
|
|
315
315
|
}, {
|
|
316
316
|
id: 'ocean',
|
|
317
317
|
code: 'NC-02',
|
|
318
|
-
name: '
|
|
318
|
+
name: '沧溟',
|
|
319
319
|
group: 'cold',
|
|
320
320
|
seed: 8.2,
|
|
321
321
|
speed: 0.48,
|
|
@@ -323,7 +323,7 @@ var CAPSULE_PRESETS = [{
|
|
|
323
323
|
}, {
|
|
324
324
|
id: 'klein',
|
|
325
325
|
code: 'NC-03',
|
|
326
|
-
name: '
|
|
326
|
+
name: '玄夜',
|
|
327
327
|
group: 'cold',
|
|
328
328
|
seed: 14.1,
|
|
329
329
|
speed: 0.49,
|
|
@@ -331,7 +331,7 @@ var CAPSULE_PRESETS = [{
|
|
|
331
331
|
}, {
|
|
332
332
|
id: 'ultraviolet',
|
|
333
333
|
code: 'NC-04',
|
|
334
|
-
name: '
|
|
334
|
+
name: '紫霄',
|
|
335
335
|
group: 'cold',
|
|
336
336
|
seed: 23.4,
|
|
337
337
|
speed: 0.47,
|
|
@@ -339,7 +339,7 @@ var CAPSULE_PRESETS = [{
|
|
|
339
339
|
}, {
|
|
340
340
|
id: 'chrome',
|
|
341
341
|
code: 'NC-05',
|
|
342
|
-
name: '
|
|
342
|
+
name: '银汉',
|
|
343
343
|
group: 'cold',
|
|
344
344
|
seed: 37.8,
|
|
345
345
|
speed: 0.42,
|
|
@@ -347,7 +347,7 @@ var CAPSULE_PRESETS = [{
|
|
|
347
347
|
}, {
|
|
348
348
|
id: 'plus',
|
|
349
349
|
code: 'NC-06',
|
|
350
|
-
name: '
|
|
350
|
+
name: '熔金',
|
|
351
351
|
group: 'warm',
|
|
352
352
|
seed: 51.3,
|
|
353
353
|
speed: 0.5,
|
|
@@ -357,7 +357,7 @@ var CAPSULE_PRESETS = [{
|
|
|
357
357
|
var PROGRESS_PRESETS = [{
|
|
358
358
|
id: 'model-training',
|
|
359
359
|
code: 'NC-10',
|
|
360
|
-
name: '
|
|
360
|
+
name: '星火',
|
|
361
361
|
subtitle: 'SHA 4.5 + 100 2026 TKN',
|
|
362
362
|
group: 'progress',
|
|
363
363
|
initialProgress: 43,
|
|
@@ -366,7 +366,7 @@ var PROGRESS_PRESETS = [{
|
|
|
366
366
|
}, {
|
|
367
367
|
id: 'agent-migration',
|
|
368
368
|
code: 'NC-11',
|
|
369
|
-
name: '
|
|
369
|
+
name: '迁流',
|
|
370
370
|
subtitle: 'TRANSFERRING PROTOCOL',
|
|
371
371
|
group: 'progress',
|
|
372
372
|
initialProgress: 33,
|
|
@@ -375,7 +375,7 @@ var PROGRESS_PRESETS = [{
|
|
|
375
375
|
}, {
|
|
376
376
|
id: 'visual-training',
|
|
377
377
|
code: 'NC-12',
|
|
378
|
-
name: '
|
|
378
|
+
name: '幻境',
|
|
379
379
|
subtitle: 'GENERATING POWER ++',
|
|
380
380
|
group: 'progress',
|
|
381
381
|
initialProgress: 58,
|
|
@@ -384,7 +384,7 @@ var PROGRESS_PRESETS = [{
|
|
|
384
384
|
}, {
|
|
385
385
|
id: 'tide',
|
|
386
386
|
code: 'NC-13',
|
|
387
|
-
name: '
|
|
387
|
+
name: '汐潮',
|
|
388
388
|
subtitle: 'MOON PULL / COAST',
|
|
389
389
|
group: 'progress',
|
|
390
390
|
initialProgress: 30,
|
|
@@ -393,20 +393,18 @@ var PROGRESS_PRESETS = [{
|
|
|
393
393
|
}];
|
|
394
394
|
|
|
395
395
|
[].concat(_toConsumableArray(CAPSULE_PRESETS), _toConsumableArray(PROGRESS_PRESETS));
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Resolve a preset by its literary name (e.g. '沧溟').
|
|
399
|
+
* Matching is case-insensitive and ignores surrounding whitespace,
|
|
400
|
+
* so '沧溟' and ' 沧溟 ' both work.
|
|
401
|
+
*/
|
|
399
402
|
function getPreset(kind, ref) {
|
|
400
403
|
var list = PROGRESS_PRESETS ;
|
|
401
404
|
if (!list) throw new Error("Unknown preset kind: ".concat(kind, " (use \"capsule\" or \"progress\")"));
|
|
402
|
-
if (ref && _typeof(ref) === 'object') {
|
|
403
|
-
var valid = validateProgressPreset(ref);
|
|
404
|
-
if (!valid) throw new Error("Invalid ".concat(kind, " preset object"));
|
|
405
|
-
return ref;
|
|
406
|
-
}
|
|
407
405
|
var key = String(ref).trim().toLowerCase();
|
|
408
406
|
var found = list.find(function (preset) {
|
|
409
|
-
return preset.
|
|
407
|
+
return preset.name.toLowerCase() === key;
|
|
410
408
|
});
|
|
411
409
|
if (!found) throw new Error("Unknown ".concat(kind, " preset: ").concat(ref));
|
|
412
410
|
return found;
|
|
@@ -1549,7 +1547,7 @@ function createProgressCapsule(container) {
|
|
|
1549
1547
|
if (!container || typeof container.appendChild !== 'function') {
|
|
1550
1548
|
throw new Error('createProgressCapsule: container element is required');
|
|
1551
1549
|
}
|
|
1552
|
-
var preset = _objectSpread2({}, getPreset('progress', (_options$preset = options.preset) !== null && _options$preset !== void 0 ? _options$preset : '
|
|
1550
|
+
var preset = _objectSpread2({}, getPreset('progress', (_options$preset = options.preset) !== null && _options$preset !== void 0 ? _options$preset : '星火'));
|
|
1553
1551
|
var merged = normalizeOptions(DEFAULTS.progress, preset, options);
|
|
1554
1552
|
var copy = _objectSpread2(_objectSpread2({}, COPY), merged.copy || {});
|
|
1555
1553
|
var root = document.createElement('div');
|
|
@@ -1705,6 +1703,26 @@ function createProgressCapsule(container) {
|
|
|
1705
1703
|
});
|
|
1706
1704
|
return this;
|
|
1707
1705
|
},
|
|
1706
|
+
setEdgeStyle: function setEdgeStyle(edgeStyle) {
|
|
1707
|
+
var value = String(edgeStyle || '').toLowerCase();
|
|
1708
|
+
if (value !== 'flow' && value !== 'tide') return this;
|
|
1709
|
+
preset.edgeStyle = value;
|
|
1710
|
+
controller.profile = value === 'tide' ? FLOW_PROFILES.tide : FLOW_PROFILES[preset.id] || FLOW_PROFILES['visual-training'];
|
|
1711
|
+
if (overlay) {
|
|
1712
|
+
overlay.dispose();
|
|
1713
|
+
overlay = attachProgressFlowOverlay({
|
|
1714
|
+
root: root,
|
|
1715
|
+
canvas: canvas,
|
|
1716
|
+
preset: preset,
|
|
1717
|
+
getProgress: function getProgress() {
|
|
1718
|
+
return controller.value;
|
|
1719
|
+
}
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
controller.webglActive = Boolean(overlay);
|
|
1723
|
+
controller.resizeCanvas();
|
|
1724
|
+
return this;
|
|
1725
|
+
},
|
|
1708
1726
|
setColors: function setColors(colors) {
|
|
1709
1727
|
if (!Array.isArray(colors) || colors.length !== 4) return this;
|
|
1710
1728
|
controller.setColors(colors);
|
package/dist/progress.mjs
CHANGED
|
@@ -96,40 +96,40 @@ function normalizeOptions(defaults, preset, user) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
const PROGRESS_PRESETS = [
|
|
99
|
-
{
|
|
100
|
-
id: 'model-training',
|
|
101
|
-
code: 'NC-10',
|
|
102
|
-
name: '
|
|
99
|
+
{
|
|
100
|
+
id: 'model-training',
|
|
101
|
+
code: 'NC-10',
|
|
102
|
+
name: '星火',
|
|
103
103
|
subtitle: 'SHA 4.5 + 100 2026 TKN',
|
|
104
104
|
group: 'progress',
|
|
105
105
|
initialProgress: 43,
|
|
106
106
|
edgeStyle: 'flow',
|
|
107
107
|
colors: ['#2B1025', '#FF3F94', '#FF8A3D', '#FFF06A']
|
|
108
108
|
},
|
|
109
|
-
{
|
|
110
|
-
id: 'agent-migration',
|
|
111
|
-
code: 'NC-11',
|
|
112
|
-
name: '
|
|
109
|
+
{
|
|
110
|
+
id: 'agent-migration',
|
|
111
|
+
code: 'NC-11',
|
|
112
|
+
name: '迁流',
|
|
113
113
|
subtitle: 'TRANSFERRING PROTOCOL',
|
|
114
114
|
group: 'progress',
|
|
115
115
|
initialProgress: 33,
|
|
116
116
|
edgeStyle: 'flow',
|
|
117
117
|
colors: ['#101C37', '#245BFF', '#00CFFF', '#5DFFE6']
|
|
118
118
|
},
|
|
119
|
-
{
|
|
120
|
-
id: 'visual-training',
|
|
121
|
-
code: 'NC-12',
|
|
122
|
-
name: '
|
|
119
|
+
{
|
|
120
|
+
id: 'visual-training',
|
|
121
|
+
code: 'NC-12',
|
|
122
|
+
name: '幻境',
|
|
123
123
|
subtitle: 'GENERATING POWER ++',
|
|
124
124
|
group: 'progress',
|
|
125
125
|
initialProgress: 58,
|
|
126
126
|
edgeStyle: 'flow',
|
|
127
127
|
colors: ['#21142D', '#7042FF', '#42F58D', '#C4FF8A']
|
|
128
128
|
},
|
|
129
|
-
{
|
|
130
|
-
id: 'tide',
|
|
131
|
-
code: 'NC-13',
|
|
132
|
-
name: '
|
|
129
|
+
{
|
|
130
|
+
id: 'tide',
|
|
131
|
+
code: 'NC-13',
|
|
132
|
+
name: '汐潮',
|
|
133
133
|
subtitle: 'MOON PULL / COAST',
|
|
134
134
|
group: 'progress',
|
|
135
135
|
initialProgress: 30,
|
|
@@ -138,37 +138,20 @@ const PROGRESS_PRESETS = [
|
|
|
138
138
|
}
|
|
139
139
|
];
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
preset.
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function getPreset(kind, ref) {
|
|
156
|
-
const list = PROGRESS_PRESETS ;
|
|
157
|
-
if (!list) throw new Error(`Unknown preset kind: ${kind} (use "capsule" or "progress")`);
|
|
158
|
-
if (ref && typeof ref === 'object') {
|
|
159
|
-
const valid = validateProgressPreset(ref);
|
|
160
|
-
if (!valid) throw new Error(`Invalid ${kind} preset object`);
|
|
161
|
-
return ref;
|
|
162
|
-
}
|
|
163
|
-
const key = String(ref).trim().toLowerCase();
|
|
164
|
-
const found = list.find(
|
|
165
|
-
(preset) =>
|
|
166
|
-
preset.id.toLowerCase() === key ||
|
|
167
|
-
preset.code.toLowerCase() === key ||
|
|
168
|
-
preset.name.toLowerCase() === key
|
|
169
|
-
);
|
|
170
|
-
if (!found) throw new Error(`Unknown ${kind} preset: ${ref}`);
|
|
171
|
-
return found;
|
|
141
|
+
/**
|
|
142
|
+
* Resolve a preset by its literary name (e.g. '沧溟').
|
|
143
|
+
* Matching is case-insensitive and ignores surrounding whitespace,
|
|
144
|
+
* so '沧溟' and ' 沧溟 ' both work.
|
|
145
|
+
*/
|
|
146
|
+
function getPreset(kind, ref) {
|
|
147
|
+
const list = PROGRESS_PRESETS ;
|
|
148
|
+
if (!list) throw new Error(`Unknown preset kind: ${kind} (use "capsule" or "progress")`);
|
|
149
|
+
const key = String(ref).trim().toLowerCase();
|
|
150
|
+
const found = list.find(
|
|
151
|
+
(preset) => preset.name.toLowerCase() === key
|
|
152
|
+
);
|
|
153
|
+
if (!found) throw new Error(`Unknown ${kind} preset: ${ref}`);
|
|
154
|
+
return found;
|
|
172
155
|
}
|
|
173
156
|
|
|
174
157
|
const DEFAULTS = {
|
|
@@ -1455,7 +1438,7 @@ function createProgressCapsule(container, options = {}) {
|
|
|
1455
1438
|
throw new Error('createProgressCapsule: container element is required');
|
|
1456
1439
|
}
|
|
1457
1440
|
|
|
1458
|
-
const preset = { ...getPreset('progress', options.preset ?? '
|
|
1441
|
+
const preset = { ...getPreset('progress', options.preset ?? '星火') };
|
|
1459
1442
|
const merged = normalizeOptions(DEFAULTS.progress, preset, options);
|
|
1460
1443
|
const copy = { ...COPY, ...(merged.copy || {}) };
|
|
1461
1444
|
|
|
@@ -1594,9 +1577,9 @@ function createProgressCapsule(container, options = {}) {
|
|
|
1594
1577
|
controller.setRange(min, max);
|
|
1595
1578
|
return this;
|
|
1596
1579
|
},
|
|
1597
|
-
setPreset(ref) {
|
|
1598
|
-
const next = getPreset('progress', ref);
|
|
1599
|
-
Object.assign(preset, next);
|
|
1580
|
+
setPreset(ref) {
|
|
1581
|
+
const next = getPreset('progress', ref);
|
|
1582
|
+
Object.assign(preset, next);
|
|
1600
1583
|
controller.preset = next;
|
|
1601
1584
|
controller.profile = next.edgeStyle === 'tide'
|
|
1602
1585
|
? FLOW_PROFILES.tide
|
|
@@ -1610,10 +1593,25 @@ function createProgressCapsule(container, options = {}) {
|
|
|
1610
1593
|
}
|
|
1611
1594
|
controller.webglActive = Boolean(overlay);
|
|
1612
1595
|
controller.resizeCanvas();
|
|
1613
|
-
emitter.emit('presetchange', { preset: { ...next } });
|
|
1614
|
-
return this;
|
|
1615
|
-
},
|
|
1616
|
-
|
|
1596
|
+
emitter.emit('presetchange', { preset: { ...next } });
|
|
1597
|
+
return this;
|
|
1598
|
+
},
|
|
1599
|
+
setEdgeStyle(edgeStyle) {
|
|
1600
|
+
const value = String(edgeStyle || '').toLowerCase();
|
|
1601
|
+
if (value !== 'flow' && value !== 'tide') return this;
|
|
1602
|
+
preset.edgeStyle = value;
|
|
1603
|
+
controller.profile = value === 'tide'
|
|
1604
|
+
? FLOW_PROFILES.tide
|
|
1605
|
+
: (FLOW_PROFILES[preset.id] || FLOW_PROFILES['visual-training']);
|
|
1606
|
+
if (overlay) {
|
|
1607
|
+
overlay.dispose();
|
|
1608
|
+
overlay = attachProgressFlowOverlay({ root, canvas, preset, getProgress: () => controller.value });
|
|
1609
|
+
}
|
|
1610
|
+
controller.webglActive = Boolean(overlay);
|
|
1611
|
+
controller.resizeCanvas();
|
|
1612
|
+
return this;
|
|
1613
|
+
},
|
|
1614
|
+
setColors(colors) {
|
|
1617
1615
|
if (!Array.isArray(colors) || colors.length !== 4) return this;
|
|
1618
1616
|
controller.setColors(colors);
|
|
1619
1617
|
if (overlay) overlay.setColors(colors);
|
package/dist/vue2.cjs
CHANGED
|
@@ -320,7 +320,7 @@ var PALETTES$1 = {
|
|
|
320
320
|
var CAPSULE_PRESETS = [{
|
|
321
321
|
id: 'original',
|
|
322
322
|
code: 'NC-01',
|
|
323
|
-
name: '
|
|
323
|
+
name: '初光',
|
|
324
324
|
group: 'warm',
|
|
325
325
|
seed: 1.7,
|
|
326
326
|
speed: 0.5,
|
|
@@ -328,7 +328,7 @@ var CAPSULE_PRESETS = [{
|
|
|
328
328
|
}, {
|
|
329
329
|
id: 'ocean',
|
|
330
330
|
code: 'NC-02',
|
|
331
|
-
name: '
|
|
331
|
+
name: '沧溟',
|
|
332
332
|
group: 'cold',
|
|
333
333
|
seed: 8.2,
|
|
334
334
|
speed: 0.48,
|
|
@@ -336,7 +336,7 @@ var CAPSULE_PRESETS = [{
|
|
|
336
336
|
}, {
|
|
337
337
|
id: 'klein',
|
|
338
338
|
code: 'NC-03',
|
|
339
|
-
name: '
|
|
339
|
+
name: '玄夜',
|
|
340
340
|
group: 'cold',
|
|
341
341
|
seed: 14.1,
|
|
342
342
|
speed: 0.49,
|
|
@@ -344,7 +344,7 @@ var CAPSULE_PRESETS = [{
|
|
|
344
344
|
}, {
|
|
345
345
|
id: 'ultraviolet',
|
|
346
346
|
code: 'NC-04',
|
|
347
|
-
name: '
|
|
347
|
+
name: '紫霄',
|
|
348
348
|
group: 'cold',
|
|
349
349
|
seed: 23.4,
|
|
350
350
|
speed: 0.47,
|
|
@@ -352,7 +352,7 @@ var CAPSULE_PRESETS = [{
|
|
|
352
352
|
}, {
|
|
353
353
|
id: 'chrome',
|
|
354
354
|
code: 'NC-05',
|
|
355
|
-
name: '
|
|
355
|
+
name: '银汉',
|
|
356
356
|
group: 'cold',
|
|
357
357
|
seed: 37.8,
|
|
358
358
|
speed: 0.42,
|
|
@@ -360,7 +360,7 @@ var CAPSULE_PRESETS = [{
|
|
|
360
360
|
}, {
|
|
361
361
|
id: 'plus',
|
|
362
362
|
code: 'NC-06',
|
|
363
|
-
name: '
|
|
363
|
+
name: '熔金',
|
|
364
364
|
group: 'warm',
|
|
365
365
|
seed: 51.3,
|
|
366
366
|
speed: 0.5,
|
|
@@ -370,7 +370,7 @@ var CAPSULE_PRESETS = [{
|
|
|
370
370
|
var PROGRESS_PRESETS = [{
|
|
371
371
|
id: 'model-training',
|
|
372
372
|
code: 'NC-10',
|
|
373
|
-
name: '
|
|
373
|
+
name: '星火',
|
|
374
374
|
subtitle: 'SHA 4.5 + 100 2026 TKN',
|
|
375
375
|
group: 'progress',
|
|
376
376
|
initialProgress: 43,
|
|
@@ -379,7 +379,7 @@ var PROGRESS_PRESETS = [{
|
|
|
379
379
|
}, {
|
|
380
380
|
id: 'agent-migration',
|
|
381
381
|
code: 'NC-11',
|
|
382
|
-
name: '
|
|
382
|
+
name: '迁流',
|
|
383
383
|
subtitle: 'TRANSFERRING PROTOCOL',
|
|
384
384
|
group: 'progress',
|
|
385
385
|
initialProgress: 33,
|
|
@@ -388,7 +388,7 @@ var PROGRESS_PRESETS = [{
|
|
|
388
388
|
}, {
|
|
389
389
|
id: 'visual-training',
|
|
390
390
|
code: 'NC-12',
|
|
391
|
-
name: '
|
|
391
|
+
name: '幻境',
|
|
392
392
|
subtitle: 'GENERATING POWER ++',
|
|
393
393
|
group: 'progress',
|
|
394
394
|
initialProgress: 58,
|
|
@@ -397,7 +397,7 @@ var PROGRESS_PRESETS = [{
|
|
|
397
397
|
}, {
|
|
398
398
|
id: 'tide',
|
|
399
399
|
code: 'NC-13',
|
|
400
|
-
name: '
|
|
400
|
+
name: '汐潮',
|
|
401
401
|
subtitle: 'MOON PULL / COAST',
|
|
402
402
|
group: 'progress',
|
|
403
403
|
initialProgress: 30,
|
|
@@ -406,23 +406,18 @@ var PROGRESS_PRESETS = [{
|
|
|
406
406
|
}];
|
|
407
407
|
|
|
408
408
|
[].concat(_toConsumableArray(CAPSULE_PRESETS), _toConsumableArray(PROGRESS_PRESETS));
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Resolve a preset by its literary name (e.g. '沧溟').
|
|
412
|
+
* Matching is case-insensitive and ignores surrounding whitespace,
|
|
413
|
+
* so '沧溟' and ' 沧溟 ' both work.
|
|
414
|
+
*/
|
|
415
415
|
function getPreset(kind, ref) {
|
|
416
416
|
var list = kind === 'capsule' ? CAPSULE_PRESETS : kind === 'progress' ? PROGRESS_PRESETS : null;
|
|
417
417
|
if (!list) throw new Error("Unknown preset kind: ".concat(kind, " (use \"capsule\" or \"progress\")"));
|
|
418
|
-
if (ref && _typeof(ref) === 'object') {
|
|
419
|
-
var valid = kind === 'capsule' ? validatePreset(ref) : validateProgressPreset(ref);
|
|
420
|
-
if (!valid) throw new Error("Invalid ".concat(kind, " preset object"));
|
|
421
|
-
return ref;
|
|
422
|
-
}
|
|
423
418
|
var key = String(ref).trim().toLowerCase();
|
|
424
419
|
var found = list.find(function (preset) {
|
|
425
|
-
return preset.
|
|
420
|
+
return preset.name.toLowerCase() === key;
|
|
426
421
|
});
|
|
427
422
|
if (!found) throw new Error("Unknown ".concat(kind, " preset: ").concat(ref));
|
|
428
423
|
return found;
|
|
@@ -435,7 +430,6 @@ var DEFAULTS = {
|
|
|
435
430
|
quality: 'auto',
|
|
436
431
|
renderer: 'auto',
|
|
437
432
|
respectReducedMotion: true,
|
|
438
|
-
interactive: true,
|
|
439
433
|
mouseColor: true,
|
|
440
434
|
showCopy: true
|
|
441
435
|
},
|
|
@@ -856,8 +850,8 @@ function prefersReducedMotion$1() {
|
|
|
856
850
|
* Mount a cosmic (nebula) capsule into `container`.
|
|
857
851
|
*
|
|
858
852
|
* Options: preset (id/code/name or object), width, height (number=px or
|
|
859
|
-
* string with px/%/vw/vh/em/rem), colors, seed, speed, quality,
|
|
860
|
-
* respectReducedMotion, copy, cssVars.
|
|
853
|
+
* string with px/%/vw/vh/em/rem), colors, seed, speed, quality,
|
|
854
|
+
* respectReducedMotion, copy, cssVars.
|
|
861
855
|
*/
|
|
862
856
|
function createCapsule(container) {
|
|
863
857
|
var _options$preset;
|
|
@@ -865,7 +859,7 @@ function createCapsule(container) {
|
|
|
865
859
|
if (!container || typeof container.appendChild !== 'function') {
|
|
866
860
|
throw new Error('createCapsule: container element is required');
|
|
867
861
|
}
|
|
868
|
-
var preset = _objectSpread2({}, getPreset('capsule', (_options$preset = options.preset) !== null && _options$preset !== void 0 ? _options$preset : '
|
|
862
|
+
var preset = _objectSpread2({}, getPreset('capsule', (_options$preset = options.preset) !== null && _options$preset !== void 0 ? _options$preset : '初光'));
|
|
869
863
|
var merged = normalizeOptions(DEFAULTS.capsule, preset, options);
|
|
870
864
|
var copy = _objectSpread2(_objectSpread2({}, COPY), merged.copy || {});
|
|
871
865
|
var root = document.createElement('div');
|
|
@@ -944,18 +938,16 @@ function createCapsule(container) {
|
|
|
944
938
|
}) : null;
|
|
945
939
|
if (resizeObserver) resizeObserver.observe(root);else window.addEventListener('resize', renderer.resize);
|
|
946
940
|
var visibility = createVisibilityGuard(root);
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
preset: _objectSpread2({}, preset)
|
|
951
|
-
});
|
|
941
|
+
root.addEventListener('pointerenter', function () {
|
|
942
|
+
return emitter.emit('pointerenter', {
|
|
943
|
+
preset: _objectSpread2({}, preset)
|
|
952
944
|
});
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
})
|
|
945
|
+
});
|
|
946
|
+
root.addEventListener('pointerleave', function () {
|
|
947
|
+
return emitter.emit('pointerleave', {
|
|
948
|
+
preset: _objectSpread2({}, preset)
|
|
957
949
|
});
|
|
958
|
-
}
|
|
950
|
+
});
|
|
959
951
|
root.addEventListener('click', function (event) {
|
|
960
952
|
emitter.emit('click', {
|
|
961
953
|
event: event,
|
|
@@ -1020,6 +1012,20 @@ function createCapsule(container) {
|
|
|
1020
1012
|
}));
|
|
1021
1013
|
return this;
|
|
1022
1014
|
},
|
|
1015
|
+
setSeed: function setSeed(seed) {
|
|
1016
|
+
var value = Number(seed);
|
|
1017
|
+
if (!Number.isFinite(value)) return this;
|
|
1018
|
+
preset.seed = value;
|
|
1019
|
+
renderer.setPreset(_objectSpread2({}, preset));
|
|
1020
|
+
return this;
|
|
1021
|
+
},
|
|
1022
|
+
setSpeed: function setSpeed(speed) {
|
|
1023
|
+
var value = Number(speed);
|
|
1024
|
+
if (!Number.isFinite(value)) return this;
|
|
1025
|
+
preset.speed = value;
|
|
1026
|
+
renderer.setPreset(_objectSpread2({}, preset));
|
|
1027
|
+
return this;
|
|
1028
|
+
},
|
|
1023
1029
|
setSize: function setSize(width, height) {
|
|
1024
1030
|
if (width !== undefined) merged.width = width;
|
|
1025
1031
|
if (height !== undefined) merged.height = height;
|
|
@@ -2048,7 +2054,7 @@ function createProgressCapsule(container) {
|
|
|
2048
2054
|
if (!container || typeof container.appendChild !== 'function') {
|
|
2049
2055
|
throw new Error('createProgressCapsule: container element is required');
|
|
2050
2056
|
}
|
|
2051
|
-
var preset = _objectSpread2({}, getPreset('progress', (_options$preset = options.preset) !== null && _options$preset !== void 0 ? _options$preset : '
|
|
2057
|
+
var preset = _objectSpread2({}, getPreset('progress', (_options$preset = options.preset) !== null && _options$preset !== void 0 ? _options$preset : '星火'));
|
|
2052
2058
|
var merged = normalizeOptions(DEFAULTS.progress, preset, options);
|
|
2053
2059
|
var copy = _objectSpread2(_objectSpread2({}, COPY), merged.copy || {});
|
|
2054
2060
|
var root = document.createElement('div');
|
|
@@ -2204,6 +2210,26 @@ function createProgressCapsule(container) {
|
|
|
2204
2210
|
});
|
|
2205
2211
|
return this;
|
|
2206
2212
|
},
|
|
2213
|
+
setEdgeStyle: function setEdgeStyle(edgeStyle) {
|
|
2214
|
+
var value = String(edgeStyle || '').toLowerCase();
|
|
2215
|
+
if (value !== 'flow' && value !== 'tide') return this;
|
|
2216
|
+
preset.edgeStyle = value;
|
|
2217
|
+
controller.profile = value === 'tide' ? FLOW_PROFILES.tide : FLOW_PROFILES[preset.id] || FLOW_PROFILES['visual-training'];
|
|
2218
|
+
if (overlay) {
|
|
2219
|
+
overlay.dispose();
|
|
2220
|
+
overlay = attachProgressFlowOverlay({
|
|
2221
|
+
root: root,
|
|
2222
|
+
canvas: canvas,
|
|
2223
|
+
preset: preset,
|
|
2224
|
+
getProgress: function getProgress() {
|
|
2225
|
+
return controller.value;
|
|
2226
|
+
}
|
|
2227
|
+
});
|
|
2228
|
+
}
|
|
2229
|
+
controller.webglActive = Boolean(overlay);
|
|
2230
|
+
controller.resizeCanvas();
|
|
2231
|
+
return this;
|
|
2232
|
+
},
|
|
2207
2233
|
setColors: function setColors(colors) {
|
|
2208
2234
|
if (!Array.isArray(colors) || colors.length !== 4) return this;
|
|
2209
2235
|
controller.setColors(colors);
|
|
@@ -2341,7 +2367,7 @@ function makeWrapper(_ref) {
|
|
|
2341
2367
|
function makeCapsuleWrapper(createCapsule, render) {
|
|
2342
2368
|
return makeWrapper({
|
|
2343
2369
|
name: 'CosmicCapsule',
|
|
2344
|
-
props: ['preset', 'width', 'height', 'colors', 'seed', 'speed', '
|
|
2370
|
+
props: ['preset', 'width', 'height', 'colors', 'seed', 'speed', 'mouseColor', 'renderer', 'quality', 'respectReducedMotion', 'copy', 'cssVars'],
|
|
2345
2371
|
events: CAPSULE_EVENTS,
|
|
2346
2372
|
create: createCapsule,
|
|
2347
2373
|
render: render,
|
|
@@ -2349,22 +2375,15 @@ function makeCapsuleWrapper(createCapsule, render) {
|
|
|
2349
2375
|
seed: function seed(value) {
|
|
2350
2376
|
var seed = Number(value);
|
|
2351
2377
|
if (this.controller && Number.isFinite(seed)) {
|
|
2352
|
-
this.controller.
|
|
2353
|
-
seed: seed
|
|
2354
|
-
}));
|
|
2378
|
+
this.controller.setSeed(seed);
|
|
2355
2379
|
}
|
|
2356
2380
|
},
|
|
2357
2381
|
speed: function speed(value) {
|
|
2358
2382
|
var speed = Number(value);
|
|
2359
2383
|
if (this.controller && Number.isFinite(speed)) {
|
|
2360
|
-
this.controller.
|
|
2361
|
-
speed: speed
|
|
2362
|
-
}));
|
|
2384
|
+
this.controller.setSpeed(speed);
|
|
2363
2385
|
}
|
|
2364
2386
|
},
|
|
2365
|
-
interactive: function interactive() {
|
|
2366
|
-
this.scheduleRecreate();
|
|
2367
|
-
},
|
|
2368
2387
|
mouseColor: function mouseColor() {
|
|
2369
2388
|
this.scheduleRecreate();
|
|
2370
2389
|
},
|
|
@@ -2418,9 +2437,7 @@ function makeProgressWrapper(createProgressCapsule, render) {
|
|
|
2418
2437
|
if (value !== undefined && this.controller) this.controller.setRange(this.controller.min, value);
|
|
2419
2438
|
},
|
|
2420
2439
|
edgeStyle: function edgeStyle(value) {
|
|
2421
|
-
if (value && this.controller) this.controller.
|
|
2422
|
-
edgeStyle: value
|
|
2423
|
-
}));
|
|
2440
|
+
if (value && this.controller) this.controller.setEdgeStyle(value);
|
|
2424
2441
|
},
|
|
2425
2442
|
draggable: function draggable() {
|
|
2426
2443
|
this.scheduleRecreate();
|