@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/vue2.mjs
CHANGED
|
@@ -112,50 +112,50 @@ const PALETTES$1 = {
|
|
|
112
112
|
* Capsule 预置:仅星云材质 NC-01~NC-06(NC-07~09 aurora 已移除)。
|
|
113
113
|
* 颜色引用公共色板,seed/speed 决定形态与流速。
|
|
114
114
|
*/
|
|
115
|
-
const CAPSULE_PRESETS = [
|
|
116
|
-
{ id: 'original', code: 'NC-01', name: '
|
|
117
|
-
{ id: 'ocean', code: 'NC-02', name: '
|
|
118
|
-
{ id: 'klein', code: 'NC-03', name: '
|
|
119
|
-
{ id: 'ultraviolet', code: 'NC-04', name: '
|
|
120
|
-
{ id: 'chrome', code: 'NC-05', name: '
|
|
121
|
-
{ id: 'plus', code: 'NC-06', name: '
|
|
115
|
+
const CAPSULE_PRESETS = [
|
|
116
|
+
{ id: 'original', code: 'NC-01', name: '初光', group: 'warm', seed: 1.7, speed: 0.5, colors: [...PALETTES$1.original] },
|
|
117
|
+
{ id: 'ocean', code: 'NC-02', name: '沧溟', group: 'cold', seed: 8.2, speed: 0.48, colors: [...PALETTES$1.ocean] },
|
|
118
|
+
{ id: 'klein', code: 'NC-03', name: '玄夜', group: 'cold', seed: 14.1, speed: 0.49, colors: [...PALETTES$1.klein] },
|
|
119
|
+
{ id: 'ultraviolet', code: 'NC-04', name: '紫霄', group: 'cold', seed: 23.4, speed: 0.47, colors: [...PALETTES$1.ultraviolet] },
|
|
120
|
+
{ id: 'chrome', code: 'NC-05', name: '银汉', group: 'cold', seed: 37.8, speed: 0.42, colors: [...PALETTES$1.chrome] },
|
|
121
|
+
{ id: 'plus', code: 'NC-06', name: '熔金', group: 'warm', seed: 51.3, speed: 0.5, colors: [...PALETTES$1.plus] }
|
|
122
122
|
];
|
|
123
123
|
|
|
124
124
|
const PROGRESS_PRESETS = [
|
|
125
|
-
{
|
|
126
|
-
id: 'model-training',
|
|
127
|
-
code: 'NC-10',
|
|
128
|
-
name: '
|
|
125
|
+
{
|
|
126
|
+
id: 'model-training',
|
|
127
|
+
code: 'NC-10',
|
|
128
|
+
name: '星火',
|
|
129
129
|
subtitle: 'SHA 4.5 + 100 2026 TKN',
|
|
130
130
|
group: 'progress',
|
|
131
131
|
initialProgress: 43,
|
|
132
132
|
edgeStyle: 'flow',
|
|
133
133
|
colors: ['#2B1025', '#FF3F94', '#FF8A3D', '#FFF06A']
|
|
134
134
|
},
|
|
135
|
-
{
|
|
136
|
-
id: 'agent-migration',
|
|
137
|
-
code: 'NC-11',
|
|
138
|
-
name: '
|
|
135
|
+
{
|
|
136
|
+
id: 'agent-migration',
|
|
137
|
+
code: 'NC-11',
|
|
138
|
+
name: '迁流',
|
|
139
139
|
subtitle: 'TRANSFERRING PROTOCOL',
|
|
140
140
|
group: 'progress',
|
|
141
141
|
initialProgress: 33,
|
|
142
142
|
edgeStyle: 'flow',
|
|
143
143
|
colors: ['#101C37', '#245BFF', '#00CFFF', '#5DFFE6']
|
|
144
144
|
},
|
|
145
|
-
{
|
|
146
|
-
id: 'visual-training',
|
|
147
|
-
code: 'NC-12',
|
|
148
|
-
name: '
|
|
145
|
+
{
|
|
146
|
+
id: 'visual-training',
|
|
147
|
+
code: 'NC-12',
|
|
148
|
+
name: '幻境',
|
|
149
149
|
subtitle: 'GENERATING POWER ++',
|
|
150
150
|
group: 'progress',
|
|
151
151
|
initialProgress: 58,
|
|
152
152
|
edgeStyle: 'flow',
|
|
153
153
|
colors: ['#21142D', '#7042FF', '#42F58D', '#C4FF8A']
|
|
154
154
|
},
|
|
155
|
-
{
|
|
156
|
-
id: 'tide',
|
|
157
|
-
code: 'NC-13',
|
|
158
|
-
name: '
|
|
155
|
+
{
|
|
156
|
+
id: 'tide',
|
|
157
|
+
code: 'NC-13',
|
|
158
|
+
name: '汐潮',
|
|
159
159
|
subtitle: 'MOON PULL / COAST',
|
|
160
160
|
group: 'progress',
|
|
161
161
|
initialProgress: 30,
|
|
@@ -164,64 +164,33 @@ const PROGRESS_PRESETS = [
|
|
|
164
164
|
}
|
|
165
165
|
];
|
|
166
166
|
|
|
167
|
-
[...CAPSULE_PRESETS, ...PROGRESS_PRESETS];
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
return Boolean(
|
|
184
|
-
preset &&
|
|
185
|
-
typeof preset.id === 'string' &&
|
|
186
|
-
typeof preset.code === 'string' &&
|
|
187
|
-
typeof preset.name === 'string' &&
|
|
188
|
-
preset.group === 'progress' &&
|
|
189
|
-
Number.isFinite(preset.initialProgress) &&
|
|
190
|
-
['flow', 'tide'].indexOf(preset.edgeStyle || 'flow') !== -1 &&
|
|
191
|
-
Array.isArray(preset.colors) &&
|
|
192
|
-
preset.colors.length === 4
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function getPreset(kind, ref) {
|
|
197
|
-
const list = kind === 'capsule' ? CAPSULE_PRESETS : kind === 'progress' ? PROGRESS_PRESETS : null;
|
|
198
|
-
if (!list) throw new Error(`Unknown preset kind: ${kind} (use "capsule" or "progress")`);
|
|
199
|
-
if (ref && typeof ref === 'object') {
|
|
200
|
-
const valid = kind === 'capsule' ? validatePreset(ref) : validateProgressPreset(ref);
|
|
201
|
-
if (!valid) throw new Error(`Invalid ${kind} preset object`);
|
|
202
|
-
return ref;
|
|
203
|
-
}
|
|
204
|
-
const key = String(ref).trim().toLowerCase();
|
|
205
|
-
const found = list.find(
|
|
206
|
-
(preset) =>
|
|
207
|
-
preset.id.toLowerCase() === key ||
|
|
208
|
-
preset.code.toLowerCase() === key ||
|
|
209
|
-
preset.name.toLowerCase() === key
|
|
210
|
-
);
|
|
211
|
-
if (!found) throw new Error(`Unknown ${kind} preset: ${ref}`);
|
|
212
|
-
return found;
|
|
167
|
+
[...CAPSULE_PRESETS, ...PROGRESS_PRESETS];
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Resolve a preset by its literary name (e.g. '沧溟').
|
|
171
|
+
* Matching is case-insensitive and ignores surrounding whitespace,
|
|
172
|
+
* so '沧溟' and ' 沧溟 ' both work.
|
|
173
|
+
*/
|
|
174
|
+
function getPreset(kind, ref) {
|
|
175
|
+
const list = kind === 'capsule' ? CAPSULE_PRESETS : kind === 'progress' ? PROGRESS_PRESETS : null;
|
|
176
|
+
if (!list) throw new Error(`Unknown preset kind: ${kind} (use "capsule" or "progress")`);
|
|
177
|
+
const key = String(ref).trim().toLowerCase();
|
|
178
|
+
const found = list.find(
|
|
179
|
+
(preset) => preset.name.toLowerCase() === key
|
|
180
|
+
);
|
|
181
|
+
if (!found) throw new Error(`Unknown ${kind} preset: ${ref}`);
|
|
182
|
+
return found;
|
|
213
183
|
}
|
|
214
184
|
|
|
215
185
|
const DEFAULTS = {
|
|
216
186
|
capsule: {
|
|
217
187
|
width: '100%',
|
|
218
188
|
height: 160,
|
|
219
|
-
quality: 'auto',
|
|
220
|
-
renderer: 'auto',
|
|
221
|
-
respectReducedMotion: true,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
showCopy: true
|
|
189
|
+
quality: 'auto',
|
|
190
|
+
renderer: 'auto',
|
|
191
|
+
respectReducedMotion: true,
|
|
192
|
+
mouseColor: true,
|
|
193
|
+
showCopy: true
|
|
225
194
|
},
|
|
226
195
|
progress: {
|
|
227
196
|
width: 454,
|
|
@@ -723,15 +692,15 @@ function prefersReducedMotion$1() {
|
|
|
723
692
|
* Mount a cosmic (nebula) capsule into `container`.
|
|
724
693
|
*
|
|
725
694
|
* Options: preset (id/code/name or object), width, height (number=px or
|
|
726
|
-
* string with px/%/vw/vh/em/rem), colors, seed, speed, quality,
|
|
727
|
-
* respectReducedMotion, copy, cssVars.
|
|
695
|
+
* string with px/%/vw/vh/em/rem), colors, seed, speed, quality,
|
|
696
|
+
* respectReducedMotion, copy, cssVars.
|
|
728
697
|
*/
|
|
729
698
|
function createCapsule(container, options = {}) {
|
|
730
699
|
if (!container || typeof container.appendChild !== 'function') {
|
|
731
700
|
throw new Error('createCapsule: container element is required');
|
|
732
701
|
}
|
|
733
702
|
|
|
734
|
-
const preset = { ...getPreset('capsule', options.preset ?? '
|
|
703
|
+
const preset = { ...getPreset('capsule', options.preset ?? '初光') };
|
|
735
704
|
const merged = normalizeOptions(DEFAULTS.capsule, preset, options);
|
|
736
705
|
const copy = { ...COPY, ...(merged.copy || {}) };
|
|
737
706
|
|
|
@@ -818,10 +787,8 @@ function createCapsule(container, options = {}) {
|
|
|
818
787
|
|
|
819
788
|
const visibility = createVisibilityGuard(root);
|
|
820
789
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
root.addEventListener('pointerleave', () => emitter.emit('pointerleave', { preset: { ...preset } }));
|
|
824
|
-
}
|
|
790
|
+
root.addEventListener('pointerenter', () => emitter.emit('pointerenter', { preset: { ...preset } }));
|
|
791
|
+
root.addEventListener('pointerleave', () => emitter.emit('pointerleave', { preset: { ...preset } }));
|
|
825
792
|
root.addEventListener('click', (event) => {
|
|
826
793
|
emitter.emit('click', { event, preset: { ...preset } });
|
|
827
794
|
});
|
|
@@ -861,12 +828,26 @@ function createCapsule(container, options = {}) {
|
|
|
861
828
|
emitter.emit('presetchange', { preset: { ...next } });
|
|
862
829
|
return this;
|
|
863
830
|
},
|
|
864
|
-
setColors(colors) {
|
|
865
|
-
if (!Array.isArray(colors) || colors.length !== 4) return this;
|
|
866
|
-
preset.colors = colors;
|
|
867
|
-
renderer.setPreset({ ...preset, colors });
|
|
868
|
-
return this;
|
|
869
|
-
},
|
|
831
|
+
setColors(colors) {
|
|
832
|
+
if (!Array.isArray(colors) || colors.length !== 4) return this;
|
|
833
|
+
preset.colors = colors;
|
|
834
|
+
renderer.setPreset({ ...preset, colors });
|
|
835
|
+
return this;
|
|
836
|
+
},
|
|
837
|
+
setSeed(seed) {
|
|
838
|
+
const value = Number(seed);
|
|
839
|
+
if (!Number.isFinite(value)) return this;
|
|
840
|
+
preset.seed = value;
|
|
841
|
+
renderer.setPreset({ ...preset });
|
|
842
|
+
return this;
|
|
843
|
+
},
|
|
844
|
+
setSpeed(speed) {
|
|
845
|
+
const value = Number(speed);
|
|
846
|
+
if (!Number.isFinite(value)) return this;
|
|
847
|
+
preset.speed = value;
|
|
848
|
+
renderer.setPreset({ ...preset });
|
|
849
|
+
return this;
|
|
850
|
+
},
|
|
870
851
|
setSize(width, height) {
|
|
871
852
|
if (width !== undefined) merged.width = width;
|
|
872
853
|
if (height !== undefined) merged.height = height;
|
|
@@ -2051,7 +2032,7 @@ function createProgressCapsule(container, options = {}) {
|
|
|
2051
2032
|
throw new Error('createProgressCapsule: container element is required');
|
|
2052
2033
|
}
|
|
2053
2034
|
|
|
2054
|
-
const preset = { ...getPreset('progress', options.preset ?? '
|
|
2035
|
+
const preset = { ...getPreset('progress', options.preset ?? '星火') };
|
|
2055
2036
|
const merged = normalizeOptions(DEFAULTS.progress, preset, options);
|
|
2056
2037
|
const copy = { ...COPY, ...(merged.copy || {}) };
|
|
2057
2038
|
|
|
@@ -2190,9 +2171,9 @@ function createProgressCapsule(container, options = {}) {
|
|
|
2190
2171
|
controller.setRange(min, max);
|
|
2191
2172
|
return this;
|
|
2192
2173
|
},
|
|
2193
|
-
setPreset(ref) {
|
|
2194
|
-
const next = getPreset('progress', ref);
|
|
2195
|
-
Object.assign(preset, next);
|
|
2174
|
+
setPreset(ref) {
|
|
2175
|
+
const next = getPreset('progress', ref);
|
|
2176
|
+
Object.assign(preset, next);
|
|
2196
2177
|
controller.preset = next;
|
|
2197
2178
|
controller.profile = next.edgeStyle === 'tide'
|
|
2198
2179
|
? FLOW_PROFILES.tide
|
|
@@ -2206,10 +2187,25 @@ function createProgressCapsule(container, options = {}) {
|
|
|
2206
2187
|
}
|
|
2207
2188
|
controller.webglActive = Boolean(overlay);
|
|
2208
2189
|
controller.resizeCanvas();
|
|
2209
|
-
emitter.emit('presetchange', { preset: { ...next } });
|
|
2210
|
-
return this;
|
|
2211
|
-
},
|
|
2212
|
-
|
|
2190
|
+
emitter.emit('presetchange', { preset: { ...next } });
|
|
2191
|
+
return this;
|
|
2192
|
+
},
|
|
2193
|
+
setEdgeStyle(edgeStyle) {
|
|
2194
|
+
const value = String(edgeStyle || '').toLowerCase();
|
|
2195
|
+
if (value !== 'flow' && value !== 'tide') return this;
|
|
2196
|
+
preset.edgeStyle = value;
|
|
2197
|
+
controller.profile = value === 'tide'
|
|
2198
|
+
? FLOW_PROFILES.tide
|
|
2199
|
+
: (FLOW_PROFILES[preset.id] || FLOW_PROFILES['visual-training']);
|
|
2200
|
+
if (overlay) {
|
|
2201
|
+
overlay.dispose();
|
|
2202
|
+
overlay = attachProgressFlowOverlay({ root, canvas, preset, getProgress: () => controller.value });
|
|
2203
|
+
}
|
|
2204
|
+
controller.webglActive = Boolean(overlay);
|
|
2205
|
+
controller.resizeCanvas();
|
|
2206
|
+
return this;
|
|
2207
|
+
},
|
|
2208
|
+
setColors(colors) {
|
|
2213
2209
|
if (!Array.isArray(colors) || colors.length !== 4) return this;
|
|
2214
2210
|
controller.setColors(colors);
|
|
2215
2211
|
if (overlay) overlay.setColors(colors);
|
|
@@ -2319,32 +2315,29 @@ function makeWrapper({ name, props, events, create, render, methods, watch }) {
|
|
|
2319
2315
|
function makeCapsuleWrapper(createCapsule, render) {
|
|
2320
2316
|
return makeWrapper({
|
|
2321
2317
|
name: 'CosmicCapsule',
|
|
2322
|
-
props: [
|
|
2323
|
-
'preset', 'width', 'height', 'colors', 'seed', 'speed',
|
|
2324
|
-
'mouseColor', 'renderer', 'quality', 'respectReducedMotion', 'copy', 'cssVars'
|
|
2318
|
+
props: [
|
|
2319
|
+
'preset', 'width', 'height', 'colors', 'seed', 'speed',
|
|
2320
|
+
'mouseColor', 'renderer', 'quality', 'respectReducedMotion', 'copy', 'cssVars'
|
|
2325
2321
|
],
|
|
2326
2322
|
events: CAPSULE_EVENTS,
|
|
2327
2323
|
create: createCapsule,
|
|
2328
2324
|
render,
|
|
2329
2325
|
watch: {
|
|
2330
|
-
seed(value) {
|
|
2331
|
-
const seed = Number(value);
|
|
2332
|
-
if (this.controller && Number.isFinite(seed)) {
|
|
2333
|
-
this.controller.
|
|
2334
|
-
}
|
|
2335
|
-
},
|
|
2336
|
-
speed(value) {
|
|
2337
|
-
const speed = Number(value);
|
|
2338
|
-
if (this.controller && Number.isFinite(speed)) {
|
|
2339
|
-
this.controller.
|
|
2340
|
-
}
|
|
2341
|
-
},
|
|
2342
|
-
|
|
2343
|
-
this.scheduleRecreate();
|
|
2344
|
-
},
|
|
2345
|
-
mouseColor() {
|
|
2346
|
-
this.scheduleRecreate();
|
|
2347
|
-
},
|
|
2326
|
+
seed(value) {
|
|
2327
|
+
const seed = Number(value);
|
|
2328
|
+
if (this.controller && Number.isFinite(seed)) {
|
|
2329
|
+
this.controller.setSeed(seed);
|
|
2330
|
+
}
|
|
2331
|
+
},
|
|
2332
|
+
speed(value) {
|
|
2333
|
+
const speed = Number(value);
|
|
2334
|
+
if (this.controller && Number.isFinite(speed)) {
|
|
2335
|
+
this.controller.setSpeed(speed);
|
|
2336
|
+
}
|
|
2337
|
+
},
|
|
2338
|
+
mouseColor() {
|
|
2339
|
+
this.scheduleRecreate();
|
|
2340
|
+
},
|
|
2348
2341
|
renderer() {
|
|
2349
2342
|
this.scheduleRecreate();
|
|
2350
2343
|
}
|
|
@@ -2383,9 +2376,9 @@ function makeProgressWrapper(createProgressCapsule, render) {
|
|
|
2383
2376
|
max(value) {
|
|
2384
2377
|
if (value !== undefined && this.controller) this.controller.setRange(this.controller.min, value);
|
|
2385
2378
|
},
|
|
2386
|
-
edgeStyle(value) {
|
|
2387
|
-
if (value && this.controller) this.controller.
|
|
2388
|
-
},
|
|
2379
|
+
edgeStyle(value) {
|
|
2380
|
+
if (value && this.controller) this.controller.setEdgeStyle(value);
|
|
2381
|
+
},
|
|
2389
2382
|
draggable() {
|
|
2390
2383
|
this.scheduleRecreate();
|
|
2391
2384
|
},
|
package/dist/vue3.cjs
CHANGED
|
@@ -322,7 +322,7 @@ var PALETTES$1 = {
|
|
|
322
322
|
var CAPSULE_PRESETS = [{
|
|
323
323
|
id: 'original',
|
|
324
324
|
code: 'NC-01',
|
|
325
|
-
name: '
|
|
325
|
+
name: '初光',
|
|
326
326
|
group: 'warm',
|
|
327
327
|
seed: 1.7,
|
|
328
328
|
speed: 0.5,
|
|
@@ -330,7 +330,7 @@ var CAPSULE_PRESETS = [{
|
|
|
330
330
|
}, {
|
|
331
331
|
id: 'ocean',
|
|
332
332
|
code: 'NC-02',
|
|
333
|
-
name: '
|
|
333
|
+
name: '沧溟',
|
|
334
334
|
group: 'cold',
|
|
335
335
|
seed: 8.2,
|
|
336
336
|
speed: 0.48,
|
|
@@ -338,7 +338,7 @@ var CAPSULE_PRESETS = [{
|
|
|
338
338
|
}, {
|
|
339
339
|
id: 'klein',
|
|
340
340
|
code: 'NC-03',
|
|
341
|
-
name: '
|
|
341
|
+
name: '玄夜',
|
|
342
342
|
group: 'cold',
|
|
343
343
|
seed: 14.1,
|
|
344
344
|
speed: 0.49,
|
|
@@ -346,7 +346,7 @@ var CAPSULE_PRESETS = [{
|
|
|
346
346
|
}, {
|
|
347
347
|
id: 'ultraviolet',
|
|
348
348
|
code: 'NC-04',
|
|
349
|
-
name: '
|
|
349
|
+
name: '紫霄',
|
|
350
350
|
group: 'cold',
|
|
351
351
|
seed: 23.4,
|
|
352
352
|
speed: 0.47,
|
|
@@ -354,7 +354,7 @@ var CAPSULE_PRESETS = [{
|
|
|
354
354
|
}, {
|
|
355
355
|
id: 'chrome',
|
|
356
356
|
code: 'NC-05',
|
|
357
|
-
name: '
|
|
357
|
+
name: '银汉',
|
|
358
358
|
group: 'cold',
|
|
359
359
|
seed: 37.8,
|
|
360
360
|
speed: 0.42,
|
|
@@ -362,7 +362,7 @@ var CAPSULE_PRESETS = [{
|
|
|
362
362
|
}, {
|
|
363
363
|
id: 'plus',
|
|
364
364
|
code: 'NC-06',
|
|
365
|
-
name: '
|
|
365
|
+
name: '熔金',
|
|
366
366
|
group: 'warm',
|
|
367
367
|
seed: 51.3,
|
|
368
368
|
speed: 0.5,
|
|
@@ -372,7 +372,7 @@ var CAPSULE_PRESETS = [{
|
|
|
372
372
|
var PROGRESS_PRESETS = [{
|
|
373
373
|
id: 'model-training',
|
|
374
374
|
code: 'NC-10',
|
|
375
|
-
name: '
|
|
375
|
+
name: '星火',
|
|
376
376
|
subtitle: 'SHA 4.5 + 100 2026 TKN',
|
|
377
377
|
group: 'progress',
|
|
378
378
|
initialProgress: 43,
|
|
@@ -381,7 +381,7 @@ var PROGRESS_PRESETS = [{
|
|
|
381
381
|
}, {
|
|
382
382
|
id: 'agent-migration',
|
|
383
383
|
code: 'NC-11',
|
|
384
|
-
name: '
|
|
384
|
+
name: '迁流',
|
|
385
385
|
subtitle: 'TRANSFERRING PROTOCOL',
|
|
386
386
|
group: 'progress',
|
|
387
387
|
initialProgress: 33,
|
|
@@ -390,7 +390,7 @@ var PROGRESS_PRESETS = [{
|
|
|
390
390
|
}, {
|
|
391
391
|
id: 'visual-training',
|
|
392
392
|
code: 'NC-12',
|
|
393
|
-
name: '
|
|
393
|
+
name: '幻境',
|
|
394
394
|
subtitle: 'GENERATING POWER ++',
|
|
395
395
|
group: 'progress',
|
|
396
396
|
initialProgress: 58,
|
|
@@ -399,7 +399,7 @@ var PROGRESS_PRESETS = [{
|
|
|
399
399
|
}, {
|
|
400
400
|
id: 'tide',
|
|
401
401
|
code: 'NC-13',
|
|
402
|
-
name: '
|
|
402
|
+
name: '汐潮',
|
|
403
403
|
subtitle: 'MOON PULL / COAST',
|
|
404
404
|
group: 'progress',
|
|
405
405
|
initialProgress: 30,
|
|
@@ -408,23 +408,18 @@ var PROGRESS_PRESETS = [{
|
|
|
408
408
|
}];
|
|
409
409
|
|
|
410
410
|
[].concat(_toConsumableArray(CAPSULE_PRESETS), _toConsumableArray(PROGRESS_PRESETS));
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Resolve a preset by its literary name (e.g. '沧溟').
|
|
414
|
+
* Matching is case-insensitive and ignores surrounding whitespace,
|
|
415
|
+
* so '沧溟' and ' 沧溟 ' both work.
|
|
416
|
+
*/
|
|
417
417
|
function getPreset(kind, ref) {
|
|
418
418
|
var list = kind === 'capsule' ? CAPSULE_PRESETS : kind === 'progress' ? PROGRESS_PRESETS : null;
|
|
419
419
|
if (!list) throw new Error("Unknown preset kind: ".concat(kind, " (use \"capsule\" or \"progress\")"));
|
|
420
|
-
if (ref && _typeof(ref) === 'object') {
|
|
421
|
-
var valid = kind === 'capsule' ? validatePreset(ref) : validateProgressPreset(ref);
|
|
422
|
-
if (!valid) throw new Error("Invalid ".concat(kind, " preset object"));
|
|
423
|
-
return ref;
|
|
424
|
-
}
|
|
425
420
|
var key = String(ref).trim().toLowerCase();
|
|
426
421
|
var found = list.find(function (preset) {
|
|
427
|
-
return preset.
|
|
422
|
+
return preset.name.toLowerCase() === key;
|
|
428
423
|
});
|
|
429
424
|
if (!found) throw new Error("Unknown ".concat(kind, " preset: ").concat(ref));
|
|
430
425
|
return found;
|
|
@@ -437,7 +432,6 @@ var DEFAULTS = {
|
|
|
437
432
|
quality: 'auto',
|
|
438
433
|
renderer: 'auto',
|
|
439
434
|
respectReducedMotion: true,
|
|
440
|
-
interactive: true,
|
|
441
435
|
mouseColor: true,
|
|
442
436
|
showCopy: true
|
|
443
437
|
},
|
|
@@ -858,8 +852,8 @@ function prefersReducedMotion$1() {
|
|
|
858
852
|
* Mount a cosmic (nebula) capsule into `container`.
|
|
859
853
|
*
|
|
860
854
|
* Options: preset (id/code/name or object), width, height (number=px or
|
|
861
|
-
* string with px/%/vw/vh/em/rem), colors, seed, speed, quality,
|
|
862
|
-
* respectReducedMotion, copy, cssVars.
|
|
855
|
+
* string with px/%/vw/vh/em/rem), colors, seed, speed, quality,
|
|
856
|
+
* respectReducedMotion, copy, cssVars.
|
|
863
857
|
*/
|
|
864
858
|
function createCapsule(container) {
|
|
865
859
|
var _options$preset;
|
|
@@ -867,7 +861,7 @@ function createCapsule(container) {
|
|
|
867
861
|
if (!container || typeof container.appendChild !== 'function') {
|
|
868
862
|
throw new Error('createCapsule: container element is required');
|
|
869
863
|
}
|
|
870
|
-
var preset = _objectSpread2({}, getPreset('capsule', (_options$preset = options.preset) !== null && _options$preset !== void 0 ? _options$preset : '
|
|
864
|
+
var preset = _objectSpread2({}, getPreset('capsule', (_options$preset = options.preset) !== null && _options$preset !== void 0 ? _options$preset : '初光'));
|
|
871
865
|
var merged = normalizeOptions(DEFAULTS.capsule, preset, options);
|
|
872
866
|
var copy = _objectSpread2(_objectSpread2({}, COPY), merged.copy || {});
|
|
873
867
|
var root = document.createElement('div');
|
|
@@ -946,18 +940,16 @@ function createCapsule(container) {
|
|
|
946
940
|
}) : null;
|
|
947
941
|
if (resizeObserver) resizeObserver.observe(root);else window.addEventListener('resize', renderer.resize);
|
|
948
942
|
var visibility = createVisibilityGuard(root);
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
preset: _objectSpread2({}, preset)
|
|
953
|
-
});
|
|
943
|
+
root.addEventListener('pointerenter', function () {
|
|
944
|
+
return emitter.emit('pointerenter', {
|
|
945
|
+
preset: _objectSpread2({}, preset)
|
|
954
946
|
});
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
})
|
|
947
|
+
});
|
|
948
|
+
root.addEventListener('pointerleave', function () {
|
|
949
|
+
return emitter.emit('pointerleave', {
|
|
950
|
+
preset: _objectSpread2({}, preset)
|
|
959
951
|
});
|
|
960
|
-
}
|
|
952
|
+
});
|
|
961
953
|
root.addEventListener('click', function (event) {
|
|
962
954
|
emitter.emit('click', {
|
|
963
955
|
event: event,
|
|
@@ -1022,6 +1014,20 @@ function createCapsule(container) {
|
|
|
1022
1014
|
}));
|
|
1023
1015
|
return this;
|
|
1024
1016
|
},
|
|
1017
|
+
setSeed: function setSeed(seed) {
|
|
1018
|
+
var value = Number(seed);
|
|
1019
|
+
if (!Number.isFinite(value)) return this;
|
|
1020
|
+
preset.seed = value;
|
|
1021
|
+
renderer.setPreset(_objectSpread2({}, preset));
|
|
1022
|
+
return this;
|
|
1023
|
+
},
|
|
1024
|
+
setSpeed: function setSpeed(speed) {
|
|
1025
|
+
var value = Number(speed);
|
|
1026
|
+
if (!Number.isFinite(value)) return this;
|
|
1027
|
+
preset.speed = value;
|
|
1028
|
+
renderer.setPreset(_objectSpread2({}, preset));
|
|
1029
|
+
return this;
|
|
1030
|
+
},
|
|
1025
1031
|
setSize: function setSize(width, height) {
|
|
1026
1032
|
if (width !== undefined) merged.width = width;
|
|
1027
1033
|
if (height !== undefined) merged.height = height;
|
|
@@ -2050,7 +2056,7 @@ function createProgressCapsule(container) {
|
|
|
2050
2056
|
if (!container || typeof container.appendChild !== 'function') {
|
|
2051
2057
|
throw new Error('createProgressCapsule: container element is required');
|
|
2052
2058
|
}
|
|
2053
|
-
var preset = _objectSpread2({}, getPreset('progress', (_options$preset = options.preset) !== null && _options$preset !== void 0 ? _options$preset : '
|
|
2059
|
+
var preset = _objectSpread2({}, getPreset('progress', (_options$preset = options.preset) !== null && _options$preset !== void 0 ? _options$preset : '星火'));
|
|
2054
2060
|
var merged = normalizeOptions(DEFAULTS.progress, preset, options);
|
|
2055
2061
|
var copy = _objectSpread2(_objectSpread2({}, COPY), merged.copy || {});
|
|
2056
2062
|
var root = document.createElement('div');
|
|
@@ -2206,6 +2212,26 @@ function createProgressCapsule(container) {
|
|
|
2206
2212
|
});
|
|
2207
2213
|
return this;
|
|
2208
2214
|
},
|
|
2215
|
+
setEdgeStyle: function setEdgeStyle(edgeStyle) {
|
|
2216
|
+
var value = String(edgeStyle || '').toLowerCase();
|
|
2217
|
+
if (value !== 'flow' && value !== 'tide') return this;
|
|
2218
|
+
preset.edgeStyle = value;
|
|
2219
|
+
controller.profile = value === 'tide' ? FLOW_PROFILES.tide : FLOW_PROFILES[preset.id] || FLOW_PROFILES['visual-training'];
|
|
2220
|
+
if (overlay) {
|
|
2221
|
+
overlay.dispose();
|
|
2222
|
+
overlay = attachProgressFlowOverlay({
|
|
2223
|
+
root: root,
|
|
2224
|
+
canvas: canvas,
|
|
2225
|
+
preset: preset,
|
|
2226
|
+
getProgress: function getProgress() {
|
|
2227
|
+
return controller.value;
|
|
2228
|
+
}
|
|
2229
|
+
});
|
|
2230
|
+
}
|
|
2231
|
+
controller.webglActive = Boolean(overlay);
|
|
2232
|
+
controller.resizeCanvas();
|
|
2233
|
+
return this;
|
|
2234
|
+
},
|
|
2209
2235
|
setColors: function setColors(colors) {
|
|
2210
2236
|
if (!Array.isArray(colors) || colors.length !== 4) return this;
|
|
2211
2237
|
controller.setColors(colors);
|
|
@@ -2343,7 +2369,7 @@ function makeWrapper(_ref) {
|
|
|
2343
2369
|
function makeCapsuleWrapper(createCapsule, render) {
|
|
2344
2370
|
return makeWrapper({
|
|
2345
2371
|
name: 'CosmicCapsule',
|
|
2346
|
-
props: ['preset', 'width', 'height', 'colors', 'seed', 'speed', '
|
|
2372
|
+
props: ['preset', 'width', 'height', 'colors', 'seed', 'speed', 'mouseColor', 'renderer', 'quality', 'respectReducedMotion', 'copy', 'cssVars'],
|
|
2347
2373
|
events: CAPSULE_EVENTS,
|
|
2348
2374
|
create: createCapsule,
|
|
2349
2375
|
render: render,
|
|
@@ -2351,22 +2377,15 @@ function makeCapsuleWrapper(createCapsule, render) {
|
|
|
2351
2377
|
seed: function seed(value) {
|
|
2352
2378
|
var seed = Number(value);
|
|
2353
2379
|
if (this.controller && Number.isFinite(seed)) {
|
|
2354
|
-
this.controller.
|
|
2355
|
-
seed: seed
|
|
2356
|
-
}));
|
|
2380
|
+
this.controller.setSeed(seed);
|
|
2357
2381
|
}
|
|
2358
2382
|
},
|
|
2359
2383
|
speed: function speed(value) {
|
|
2360
2384
|
var speed = Number(value);
|
|
2361
2385
|
if (this.controller && Number.isFinite(speed)) {
|
|
2362
|
-
this.controller.
|
|
2363
|
-
speed: speed
|
|
2364
|
-
}));
|
|
2386
|
+
this.controller.setSpeed(speed);
|
|
2365
2387
|
}
|
|
2366
2388
|
},
|
|
2367
|
-
interactive: function interactive() {
|
|
2368
|
-
this.scheduleRecreate();
|
|
2369
|
-
},
|
|
2370
2389
|
mouseColor: function mouseColor() {
|
|
2371
2390
|
this.scheduleRecreate();
|
|
2372
2391
|
},
|
|
@@ -2420,9 +2439,7 @@ function makeProgressWrapper(createProgressCapsule, render) {
|
|
|
2420
2439
|
if (value !== undefined && this.controller) this.controller.setRange(this.controller.min, value);
|
|
2421
2440
|
},
|
|
2422
2441
|
edgeStyle: function edgeStyle(value) {
|
|
2423
|
-
if (value && this.controller) this.controller.
|
|
2424
|
-
edgeStyle: value
|
|
2425
|
-
}));
|
|
2442
|
+
if (value && this.controller) this.controller.setEdgeStyle(value);
|
|
2426
2443
|
},
|
|
2427
2444
|
draggable: function draggable() {
|
|
2428
2445
|
this.scheduleRecreate();
|