@5even7/dlc-ui 0.2.18 → 0.2.20
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 +158 -144
- package/EXTENDING.md +114 -0
- package/LICENSE +21 -21
- package/README.md +389 -338
- package/THIRD_PARTY_NOTICES.md +221 -0
- package/dist/avatar-creator/styles/humation.mjs +26 -0
- package/dist/avatar-creator/styles.mjs +76 -0
- package/dist/avatar-creator.cjs +7831 -0
- package/dist/avatar-creator.mjs +74 -0
- package/dist/capsule.cjs +185 -66
- package/dist/capsule.mjs +364 -1340
- package/dist/chunks/avatar-creator-DiAmhpRa.mjs +687 -0
- package/dist/chunks/color-DnmNceaf.mjs +350 -0
- package/dist/chunks/controls-B5_ctvvA.mjs +160 -0
- package/dist/chunks/copy-7J0XIj_0.mjs +13 -0
- package/dist/chunks/cosmic-fallback-v8G5_ibh.mjs +408 -0
- package/dist/chunks/emitter-CxLYMSbw.mjs +38 -0
- package/dist/chunks/emo-Dvahy5Qr.mjs +1140 -0
- package/dist/chunks/hash-BiO02UNb.mjs +38 -0
- package/dist/chunks/humation-B9OPUGL7.mjs +2987 -0
- package/dist/chunks/identicon-BUdMd-yf.mjs +3063 -0
- package/dist/chunks/index-BchW1tWE.mjs +478 -0
- package/dist/chunks/index-BtH8Lbra.mjs +296 -0
- package/dist/chunks/index-C02dvGLD.mjs +263 -0
- package/dist/chunks/index-CFybYBA1.mjs +278 -0
- package/dist/chunks/index-DgI872-7.mjs +241 -0
- package/dist/chunks/index-_sf_14Zu.mjs +455 -0
- package/dist/chunks/index-w5Pzdwhv.mjs +305 -0
- package/dist/chunks/motion-a8_f8_Ui.mjs +177 -0
- package/dist/chunks/number-BqWLX0iQ.mjs +231 -0
- package/dist/chunks/progress-KweS4Rx0.mjs +1836 -0
- package/dist/chunks/size-Bztk2ryJ.mjs +22 -0
- package/dist/chunks/wrapper-DXhy1E7Z.mjs +514 -0
- package/dist/color.cjs +186 -67
- package/dist/color.mjs +341 -1280
- package/dist/emo/miao/angry.mjs +4 -0
- package/dist/emo/miao/asleep.mjs +4 -0
- package/dist/emo/miao/badminton.mjs +4 -0
- package/dist/emo/miao/confident.mjs +4 -0
- package/dist/emo/miao/cry.mjs +4 -0
- package/dist/emo/miao/investigate.mjs +4 -0
- package/dist/emo/miao/laugh.mjs +4 -0
- package/dist/emo/miao/leisure.mjs +4 -0
- package/dist/emo/miao/mock.mjs +4 -0
- package/dist/emo/miao/music.mjs +4 -0
- package/dist/emo/miao/mute.mjs +4 -0
- package/dist/emo/miao/panic.mjs +4 -0
- package/dist/emo/miao/ponder.mjs +4 -0
- package/dist/emo/miao/question.mjs +4 -0
- package/dist/emo/miao/sad.mjs +4 -0
- package/dist/emo/miao/shocked.mjs +4 -0
- package/dist/emo/miao/shy.mjs +4 -0
- package/dist/emo/miao/sigh.mjs +4 -0
- package/dist/emo/miao/smile.mjs +4 -0
- package/dist/emo/miao/snigger.mjs +4 -0
- package/dist/emo/miao/static.mjs +4 -0
- package/dist/emo/miao/yawn.mjs +4 -0
- package/dist/emo/miao/yummy.mjs +4 -0
- package/dist/emo.cjs +27161 -25964
- package/dist/emo.mjs +8 -1421
- package/dist/index.cjs +32729 -24466
- package/dist/index.mjs +16 -4757
- package/dist/index.umd.js +33115 -24852
- package/dist/index.umd.min.js +3 -1
- package/dist/progress.cjs +195 -76
- package/dist/progress.mjs +7 -2448
- package/dist/vue2.cjs +33282 -25002
- package/dist/vue2.mjs +63 -5131
- package/dist/vue3.cjs +33282 -25002
- package/dist/vue3.mjs +53 -5122
- package/package.json +161 -136
- package/styles/avatar-creator.css +38 -0
- package/styles/base.css +32 -32
- package/styles/color.css +18 -18
- package/styles/emo.css +110 -89
- package/styles/progress.css +96 -96
- package/styles/theme.css +1 -0
- package/types/avatar-creator-styles.d.ts +10 -0
- package/types/avatar-creator.d.ts +143 -0
- package/types/capsule.d.ts +15 -15
- package/types/color.d.ts +15 -15
- package/types/emo-miao.d.ts +9 -0
- package/types/emo.d.ts +38 -37
- package/types/index.d.ts +593 -554
- package/types/progress.d.ts +16 -16
- package/types/vue2.d.ts +11 -10
- package/types/vue3.d.ts +169 -146
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export { c as createAvatarCreator, a as createAvatarSvg, f as dicebearProvider, g as getProvider, b as getProviders, d as getStyleDefinition, e as getStyleDefinitions } from './chunks/avatar-creator-DiAmhpRa.mjs';
|
|
2
|
+
import { h as hashSeed } from './chunks/hash-BiO02UNb.mjs';
|
|
3
|
+
export { f as fnv1a } from './chunks/hash-BiO02UNb.mjs';
|
|
4
|
+
export { a as applySize, b as buildControlsFromSchema, c as cleanText, e as escapeXml, s as sanitizeSvg, d as svgToDataUri } from './chunks/controls-B5_ctvvA.mjs';
|
|
5
|
+
export { v as validateProviderOptions } from './chunks/identicon-BUdMd-yf.mjs';
|
|
6
|
+
import './chunks/emitter-CxLYMSbw.mjs';
|
|
7
|
+
import './chunks/color-DnmNceaf.mjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Deterministic PRNG for seed-driven avatar generation.
|
|
11
|
+
*
|
|
12
|
+
* Same xorshift algorithm as DiceBear so that a given seed always yields the
|
|
13
|
+
* same "random" outcome, both inside this library and across the vendored
|
|
14
|
+
* upstream styles (which receive their own upstream PRNG instance from
|
|
15
|
+
* vendors/dicebear — this one is for DLC-level picking, e.g. random style
|
|
16
|
+
* selection and humation seed fallbacks).
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const MIN = -2147483648;
|
|
20
|
+
const MAX = 2147483647;
|
|
21
|
+
const MAX_SEED_LENGTH = 1024;
|
|
22
|
+
|
|
23
|
+
function createPrng(seed = '') {
|
|
24
|
+
seed = String(seed).slice(0, MAX_SEED_LENGTH);
|
|
25
|
+
let value = hashSeed(seed) || 1;
|
|
26
|
+
|
|
27
|
+
const next = () => (value = xorshift(value));
|
|
28
|
+
const integer = (min, max) =>
|
|
29
|
+
Math.floor(((next() - MIN) / (MAX - MIN)) * (max + 1 - min) + min);
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
seed,
|
|
33
|
+
next,
|
|
34
|
+
bool(likelihood = 50) {
|
|
35
|
+
return integer(1, 100) <= likelihood;
|
|
36
|
+
},
|
|
37
|
+
integer(min, max) {
|
|
38
|
+
return integer(min, max);
|
|
39
|
+
},
|
|
40
|
+
pick(arr, fallback) {
|
|
41
|
+
if (arr.length === 0) {
|
|
42
|
+
next();
|
|
43
|
+
return fallback;
|
|
44
|
+
}
|
|
45
|
+
return arr[integer(0, arr.length - 1)] ?? fallback;
|
|
46
|
+
},
|
|
47
|
+
shuffle(arr) {
|
|
48
|
+
const internalPrng = createPrng(next().toString());
|
|
49
|
+
const workingArray = [...arr];
|
|
50
|
+
for (let i = workingArray.length - 1; i > 0; i--) {
|
|
51
|
+
const j = internalPrng.integer(0, i);
|
|
52
|
+
[workingArray[i], workingArray[j]] = [workingArray[j], workingArray[i]];
|
|
53
|
+
}
|
|
54
|
+
return workingArray;
|
|
55
|
+
},
|
|
56
|
+
string(length, characters = 'abcdefghijklmnopqrstuvwxyz1234567890') {
|
|
57
|
+
const internalPrng = createPrng(next().toString());
|
|
58
|
+
let str = '';
|
|
59
|
+
for (let i = 0; i < length; i++) {
|
|
60
|
+
str += characters[internalPrng.integer(0, characters.length - 1)];
|
|
61
|
+
}
|
|
62
|
+
return str;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function xorshift(value) {
|
|
68
|
+
value ^= value << 13;
|
|
69
|
+
value ^= value >> 17;
|
|
70
|
+
value ^= value << 5;
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { createPrng, hashSeed };
|
package/dist/capsule.cjs
CHANGED
|
@@ -182,9 +182,9 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
/**
|
|
186
|
-
* Tiny event emitter. Accepts any event name so the API stays open for
|
|
187
|
-
* future events (hover, click, custom) without breaking changes.
|
|
185
|
+
/**
|
|
186
|
+
* Tiny event emitter. Accepts any event name so the API stays open for
|
|
187
|
+
* future events (hover, click, custom) without breaking changes.
|
|
188
188
|
*/
|
|
189
189
|
function createEmitter() {
|
|
190
190
|
// Plain object storage (no Map/Set) so the legacy build has no API
|
|
@@ -234,9 +234,9 @@ function createEmitter() {
|
|
|
234
234
|
|
|
235
235
|
var UNIT_PATTERN = /^[\d.]+(?:px|%|vw|vh|vmin|vmax|em|rem)$/;
|
|
236
236
|
|
|
237
|
-
/**
|
|
238
|
-
* Normalize a size option to a CSS length string.
|
|
239
|
-
* Accepts numbers (treated as px) or strings with px/%, vw/vh/vmin/vmax, em/rem.
|
|
237
|
+
/**
|
|
238
|
+
* Normalize a size option to a CSS length string.
|
|
239
|
+
* Accepts numbers (treated as px) or strings with px/%, vw/vh/vmin/vmax, em/rem.
|
|
240
240
|
*/
|
|
241
241
|
function parseSize(value) {
|
|
242
242
|
if (typeof value === 'number') {
|
|
@@ -282,10 +282,10 @@ function effectiveDprCap(quality) {
|
|
|
282
282
|
return Math.max(0.5, dprCapFor(quality) * normalizedScale);
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
/**
|
|
286
|
-
* Merge defaults < preset < user. Unknown user keys are preserved so the
|
|
287
|
-
* component API can grow (new props, cssVars, callbacks) without a breaking
|
|
288
|
-
* change.
|
|
285
|
+
/**
|
|
286
|
+
* Merge defaults < preset < user. Unknown user keys are preserved so the
|
|
287
|
+
* component API can grow (new props, cssVars, callbacks) without a breaking
|
|
288
|
+
* change.
|
|
289
289
|
*/
|
|
290
290
|
function normalizeOptions(defaults, preset, user) {
|
|
291
291
|
// undefined means "not provided" (e.g. Vue $props with unset props):
|
|
@@ -303,9 +303,9 @@ function normalizeOptions(defaults, preset, user) {
|
|
|
303
303
|
return _objectSpread2(_objectSpread2(_objectSpread2({}, defaults), presetOptions), userOptions);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
/**
|
|
307
|
-
* 公共色板:NC-01~NC-06 的四色组(底色 / 主色 / 辅色 / 高光色)。
|
|
308
|
-
* Capsule 预置与 dlc-color 等组件共用,新增色板只改这里。
|
|
306
|
+
/**
|
|
307
|
+
* 公共色板:NC-01~NC-06 的四色组(底色 / 主色 / 辅色 / 高光色)。
|
|
308
|
+
* Capsule 预置与 dlc-color 等组件共用,新增色板只改这里。
|
|
309
309
|
*/
|
|
310
310
|
var PALETTES = {
|
|
311
311
|
original: ['#FFF3EA', '#F5B27A', '#F67BC6', '#A978E8'],
|
|
@@ -316,9 +316,9 @@ var PALETTES = {
|
|
|
316
316
|
plus: ['#FFF0E6', '#F6C26B', '#F98A64', '#E86D74']
|
|
317
317
|
};
|
|
318
318
|
|
|
319
|
-
/**
|
|
320
|
-
* Capsule 预置:仅星云材质 NC-01~NC-06(NC-07~09 aurora 已移除)。
|
|
321
|
-
* 颜色引用公共色板,seed/speed 决定形态与流速。
|
|
319
|
+
/**
|
|
320
|
+
* Capsule 预置:仅星云材质 NC-01~NC-06(NC-07~09 aurora 已移除)。
|
|
321
|
+
* 颜色引用公共色板,seed/speed 决定形态与流速。
|
|
322
322
|
*/
|
|
323
323
|
var CAPSULE_PRESETS = [{
|
|
324
324
|
id: 'original',
|
|
@@ -466,10 +466,16 @@ var COPY = {
|
|
|
466
466
|
|
|
467
467
|
/**
|
|
468
468
|
* Color helpers. `normalizeColor` converts any supported CSS color
|
|
469
|
-
* (hex / named / rgb() / rgba()) into a 6-digit hex string,
|
|
470
|
-
* keep working with #rrggbb only. rgba() alpha is
|
|
471
|
-
* the WebGL shader has no per-color alpha channel, and
|
|
472
|
-
* opaque by design — use component-level `opacity` for
|
|
469
|
+
* (hex / named / rgb() / rgba() / hsl() / hsla()) into a 6-digit hex string,
|
|
470
|
+
* so renderers can keep working with #rrggbb only. rgba()/hsla() alpha is
|
|
471
|
+
* intentionally dropped: the WebGL shader has no per-color alpha channel, and
|
|
472
|
+
* the component is opaque by design — use component-level `opacity` for
|
|
473
|
+
* transparency.
|
|
474
|
+
*
|
|
475
|
+
* `normalizeColorWithAlpha` keeps the alpha channel: it returns a 6-digit hex
|
|
476
|
+
* when alpha is 1, an 8-digit #rrggbbaa hex when alpha < 1, and the literal
|
|
477
|
+
* string 'transparent' for `transparent`. Use it for renderers (e.g. SVG)
|
|
478
|
+
* that can represent per-color transparency.
|
|
473
479
|
*/
|
|
474
480
|
|
|
475
481
|
var NAMED_COLORS = {
|
|
@@ -625,48 +631,161 @@ var NAMED_COLORS = {
|
|
|
625
631
|
function clampChannel(value) {
|
|
626
632
|
return Math.min(255, Math.max(0, Math.round(value)));
|
|
627
633
|
}
|
|
628
|
-
function
|
|
629
|
-
|
|
634
|
+
function clampUnit(value) {
|
|
635
|
+
return Math.min(1, Math.max(0, value));
|
|
636
|
+
}
|
|
637
|
+
function hexPair(value) {
|
|
638
|
+
var text = clampChannel(value).toString(16);
|
|
639
|
+
return text.length === 1 ? "0".concat(text) : text;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Parse the argument list of rgb()/rgba()/hsl()/hsla() (comma syntax or
|
|
644
|
+
* modern space + slash syntax). Returns { parts, alpha } where alpha is 1 when
|
|
645
|
+
* omitted. Returns null when the argument list cannot be parsed.
|
|
646
|
+
*/
|
|
647
|
+
function parseFunctionArgs(args) {
|
|
648
|
+
var parts = args.split(/[,\s]+/).map(function (part) {
|
|
649
|
+
return part.trim();
|
|
650
|
+
}).filter(function (part) {
|
|
651
|
+
return part !== '' && part !== '/';
|
|
652
|
+
});
|
|
630
653
|
if (parts.length < 3) return null;
|
|
631
|
-
var
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
654
|
+
var alpha = 1;
|
|
655
|
+
if (parts.length >= 4) {
|
|
656
|
+
var alphaText = parts.pop().trim();
|
|
657
|
+
if (alphaText.endsWith('%')) {
|
|
658
|
+
var percent = parseFloat(alphaText);
|
|
659
|
+
if (!Number.isFinite(percent)) return null;
|
|
660
|
+
alpha = clampUnit(percent / 100);
|
|
661
|
+
} else {
|
|
662
|
+
var number = Number(alphaText);
|
|
663
|
+
if (!Number.isFinite(number)) return null;
|
|
664
|
+
alpha = clampUnit(number);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
return {
|
|
668
|
+
parts: parts,
|
|
669
|
+
alpha: alpha
|
|
644
670
|
};
|
|
645
|
-
|
|
671
|
+
}
|
|
672
|
+
function parseChannel(value) {
|
|
673
|
+
if (typeof value !== 'string' || value === '') return null;
|
|
674
|
+
var text = value.trim();
|
|
675
|
+
if (text.endsWith('%')) return clampChannel(parseFloat(text) / 100 * 255);
|
|
676
|
+
var number = Number(text);
|
|
677
|
+
return Number.isFinite(number) ? clampChannel(number) : null;
|
|
678
|
+
}
|
|
679
|
+
function parsePercent(value) {
|
|
680
|
+
if (typeof value !== 'string' || value === '') return null;
|
|
681
|
+
var text = value.trim();
|
|
682
|
+
if (!text.endsWith('%')) return null;
|
|
683
|
+
var number = parseFloat(text);
|
|
684
|
+
return Number.isFinite(number) ? Math.min(100, Math.max(0, number)) : null;
|
|
685
|
+
}
|
|
686
|
+
function parseHue(value) {
|
|
687
|
+
if (typeof value !== 'string' || value === '') return null;
|
|
688
|
+
var number = parseFloat(value);
|
|
689
|
+
return Number.isFinite(number) ? number : null;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/** Standard HSL -> RGB. h in degrees, s/l in 0..100, returns r/g/b in 0..255. */
|
|
693
|
+
function hslToRgb(h, s, l) {
|
|
694
|
+
var hue = (h % 360 + 360) % 360 / 360;
|
|
695
|
+
var saturation = s / 100;
|
|
696
|
+
var lightness = l / 100;
|
|
697
|
+
var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
|
|
698
|
+
var section = hue * 6;
|
|
699
|
+
var x = chroma * (1 - Math.abs(section % 2 - 1));
|
|
700
|
+
var red = 0;
|
|
701
|
+
var green = 0;
|
|
702
|
+
var blue = 0;
|
|
703
|
+
if (section < 1) {
|
|
704
|
+
red = chroma;
|
|
705
|
+
green = x;
|
|
706
|
+
} else if (section < 2) {
|
|
707
|
+
red = x;
|
|
708
|
+
green = chroma;
|
|
709
|
+
} else if (section < 3) {
|
|
710
|
+
green = chroma;
|
|
711
|
+
blue = x;
|
|
712
|
+
} else if (section < 4) {
|
|
713
|
+
green = x;
|
|
714
|
+
blue = chroma;
|
|
715
|
+
} else if (section < 5) {
|
|
716
|
+
red = x;
|
|
717
|
+
blue = chroma;
|
|
718
|
+
} else {
|
|
719
|
+
red = chroma;
|
|
720
|
+
blue = x;
|
|
721
|
+
}
|
|
722
|
+
var match = lightness - chroma / 2;
|
|
723
|
+
return [Math.round((red + match) * 255), Math.round((green + match) * 255), Math.round((blue + match) * 255)];
|
|
646
724
|
}
|
|
647
725
|
|
|
648
726
|
/**
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
652
|
-
* including percentages. Alpha in rgba() is ignored.
|
|
727
|
+
* Parse any supported CSS color. When keepAlpha is true the alpha channel is
|
|
728
|
+
* preserved (8-digit hex for alpha < 1); when false it is dropped. 'transparent'
|
|
729
|
+
* is only preserved when keepAlpha is true.
|
|
653
730
|
*/
|
|
654
|
-
function
|
|
731
|
+
function parseColor(value, keepAlpha) {
|
|
655
732
|
if (typeof value !== 'string') return null;
|
|
656
733
|
var input = value.trim();
|
|
657
734
|
if (!input) return null;
|
|
658
735
|
var lower = input.toLowerCase();
|
|
659
736
|
if (NAMED_COLORS[lower]) return NAMED_COLORS[lower];
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
737
|
+
// #rgb / #rgba / #rrggbb / #rrggbbaa,以及无 # 前缀的 6/8 位 hex(dicebear 习惯)
|
|
738
|
+
var hexMatch = input.match(/^#?([0-9a-f]{3,8})$/i);
|
|
739
|
+
if (hexMatch) {
|
|
740
|
+
var _hex = hexMatch[1].toLowerCase();
|
|
741
|
+
if (_hex.length === 3 || _hex.length === 4) {
|
|
742
|
+
_hex = _hex.split('').map(function (c) {
|
|
743
|
+
return c + c;
|
|
744
|
+
}).join('');
|
|
745
|
+
}
|
|
746
|
+
return "#".concat(_hex.slice(0, 6));
|
|
747
|
+
}
|
|
748
|
+
var funcMatch = input.match(/^(rgba?|hsla?)\(([^)]*)\)$/i);
|
|
749
|
+
if (!funcMatch) return null;
|
|
750
|
+
var kind = funcMatch[1].toLowerCase();
|
|
751
|
+
var parsed = parseFunctionArgs(funcMatch[2]);
|
|
752
|
+
if (!parsed) return null;
|
|
753
|
+
var parts = parsed.parts;
|
|
754
|
+
parsed.alpha;
|
|
755
|
+
var red;
|
|
756
|
+
var green;
|
|
757
|
+
var blue;
|
|
758
|
+
if (kind === 'rgb' || kind === 'rgba') {
|
|
759
|
+
if (parts.length !== 3) return null;
|
|
760
|
+
red = parseChannel(parts[0]);
|
|
761
|
+
green = parseChannel(parts[1]);
|
|
762
|
+
blue = parseChannel(parts[2]);
|
|
763
|
+
if (red === null || green === null || blue === null) return null;
|
|
764
|
+
} else {
|
|
765
|
+
if (parts.length !== 3) return null;
|
|
766
|
+
var hue = parseHue(parts[0]);
|
|
767
|
+
var saturation = parsePercent(parts[1]);
|
|
768
|
+
var lightness = parsePercent(parts[2]);
|
|
769
|
+
if (hue === null || saturation === null || lightness === null) return null;
|
|
770
|
+
var _hslToRgb = hslToRgb(hue, saturation, lightness);
|
|
771
|
+
var _hslToRgb2 = _slicedToArray(_hslToRgb, 3);
|
|
772
|
+
red = _hslToRgb2[0];
|
|
773
|
+
green = _hslToRgb2[1];
|
|
774
|
+
blue = _hslToRgb2[2];
|
|
666
775
|
}
|
|
667
|
-
var
|
|
668
|
-
|
|
669
|
-
|
|
776
|
+
var hex = "#".concat(hexPair(red)).concat(hexPair(green)).concat(hexPair(blue));
|
|
777
|
+
return hex;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Convert any supported CSS color into `#rrggbb`. Returns null when the
|
|
782
|
+
* value cannot be parsed. Supports: #rgb / #rgba / #rrggbb / #rrggbbaa
|
|
783
|
+
* (case-insensitive), bare 6/8-digit hex, CSS named colors, rgb() / rgba() /
|
|
784
|
+
* hsl() / hsla() with comma or modern space syntax, including percentages.
|
|
785
|
+
* Alpha is ignored.
|
|
786
|
+
*/
|
|
787
|
+
function normalizeColor(value) {
|
|
788
|
+
return parseColor(value);
|
|
670
789
|
}
|
|
671
790
|
function hexToRgb01(color) {
|
|
672
791
|
var hex = normalizeColor(color);
|
|
@@ -999,10 +1118,10 @@ var FallbackRenderer = /*#__PURE__*/function () {
|
|
|
999
1118
|
}]);
|
|
1000
1119
|
}();
|
|
1001
1120
|
|
|
1002
|
-
/**
|
|
1003
|
-
* Document-level shared rAF scheduler. Every component instance subscribes
|
|
1004
|
-
* its own frame callback; the whole page runs ONE animation loop (like the
|
|
1005
|
-
* original demo), which avoids jank from many competing rAF loops.
|
|
1121
|
+
/**
|
|
1122
|
+
* Document-level shared rAF scheduler. Every component instance subscribes
|
|
1123
|
+
* its own frame callback; the whole page runs ONE animation loop (like the
|
|
1124
|
+
* original demo), which avoids jank from many competing rAF loops.
|
|
1006
1125
|
*/
|
|
1007
1126
|
var subscribers = [];
|
|
1008
1127
|
var running = false;
|
|
@@ -1079,9 +1198,9 @@ function subscribeScheduler(onFrame, isPaused) {
|
|
|
1079
1198
|
};
|
|
1080
1199
|
}
|
|
1081
1200
|
|
|
1082
|
-
/**
|
|
1083
|
-
* Gates drawing on "element intersects viewport AND the page tab is visible".
|
|
1084
|
-
* Falls back to always-visible when IntersectionObserver is unavailable.
|
|
1201
|
+
/**
|
|
1202
|
+
* Gates drawing on "element intersects viewport AND the page tab is visible".
|
|
1203
|
+
* Falls back to always-visible when IntersectionObserver is unavailable.
|
|
1085
1204
|
*/
|
|
1086
1205
|
function createVisibilityGuard(element) {
|
|
1087
1206
|
var onChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -1192,15 +1311,15 @@ function toFiniteNumber(value) {
|
|
|
1192
1311
|
return Number.isFinite(number) ? number : null;
|
|
1193
1312
|
}
|
|
1194
1313
|
|
|
1195
|
-
/**
|
|
1196
|
-
* Mount a cosmic (nebula) capsule into `container`.
|
|
1197
|
-
*
|
|
1198
|
-
* Options: preset (literary name), width, height (number=px or string with
|
|
1199
|
-
* px/%/vw/vh/em/rem), colors, seed, speed, textRatio (0-100, text region
|
|
1200
|
-
* width in percent), text (HTML string or DOM nodes for the text slot),
|
|
1201
|
-
* colorContent (HTML string or DOM nodes for the color slot), quality,
|
|
1202
|
-
* renderer, quality, renderScale, powerPreference, fps, paused/static,
|
|
1203
|
-
* respectReducedMotion, mouseColor, cssVars.
|
|
1314
|
+
/**
|
|
1315
|
+
* Mount a cosmic (nebula) capsule into `container`.
|
|
1316
|
+
*
|
|
1317
|
+
* Options: preset (literary name), width, height (number=px or string with
|
|
1318
|
+
* px/%/vw/vh/em/rem), colors, seed, speed, textRatio (0-100, text region
|
|
1319
|
+
* width in percent), text (HTML string or DOM nodes for the text slot),
|
|
1320
|
+
* colorContent (HTML string or DOM nodes for the color slot), quality,
|
|
1321
|
+
* renderer, quality, renderScale, powerPreference, fps, paused/static,
|
|
1322
|
+
* respectReducedMotion, mouseColor, cssVars.
|
|
1204
1323
|
*/
|
|
1205
1324
|
function createCapsule(container) {
|
|
1206
1325
|
var _options$preset;
|