@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
package/dist/color.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
|
|
@@ -261,10 +261,10 @@ function effectiveDprCap(quality) {
|
|
|
261
261
|
return Math.max(0.5, dprCapFor(quality) * normalizedScale);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
/**
|
|
265
|
-
* Merge defaults < preset < user. Unknown user keys are preserved so the
|
|
266
|
-
* component API can grow (new props, cssVars, callbacks) without a breaking
|
|
267
|
-
* change.
|
|
264
|
+
/**
|
|
265
|
+
* Merge defaults < preset < user. Unknown user keys are preserved so the
|
|
266
|
+
* component API can grow (new props, cssVars, callbacks) without a breaking
|
|
267
|
+
* change.
|
|
268
268
|
*/
|
|
269
269
|
function normalizeOptions(defaults, preset, user) {
|
|
270
270
|
// undefined means "not provided" (e.g. Vue $props with unset props):
|
|
@@ -282,9 +282,9 @@ function normalizeOptions(defaults, preset, user) {
|
|
|
282
282
|
return _objectSpread2(_objectSpread2(_objectSpread2({}, defaults), presetOptions), userOptions);
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
/**
|
|
286
|
-
* 公共色板:NC-01~NC-06 的四色组(底色 / 主色 / 辅色 / 高光色)。
|
|
287
|
-
* Capsule 预置与 dlc-color 等组件共用,新增色板只改这里。
|
|
285
|
+
/**
|
|
286
|
+
* 公共色板:NC-01~NC-06 的四色组(底色 / 主色 / 辅色 / 高光色)。
|
|
287
|
+
* Capsule 预置与 dlc-color 等组件共用,新增色板只改这里。
|
|
288
288
|
*/
|
|
289
289
|
var PALETTES = {
|
|
290
290
|
original: ['#FFF3EA', '#F5B27A', '#F67BC6', '#A978E8'],
|
|
@@ -295,9 +295,9 @@ var PALETTES = {
|
|
|
295
295
|
plus: ['#FFF0E6', '#F6C26B', '#F98A64', '#E86D74']
|
|
296
296
|
};
|
|
297
297
|
|
|
298
|
-
/**
|
|
299
|
-
* Capsule 预置:仅星云材质 NC-01~NC-06(NC-07~09 aurora 已移除)。
|
|
300
|
-
* 颜色引用公共色板,seed/speed 决定形态与流速。
|
|
298
|
+
/**
|
|
299
|
+
* Capsule 预置:仅星云材质 NC-01~NC-06(NC-07~09 aurora 已移除)。
|
|
300
|
+
* 颜色引用公共色板,seed/speed 决定形态与流速。
|
|
301
301
|
*/
|
|
302
302
|
var CAPSULE_PRESETS = [{
|
|
303
303
|
id: 'original',
|
|
@@ -427,10 +427,16 @@ var DEFAULTS = {
|
|
|
427
427
|
|
|
428
428
|
/**
|
|
429
429
|
* Color helpers. `normalizeColor` converts any supported CSS color
|
|
430
|
-
* (hex / named / rgb() / rgba()) into a 6-digit hex string,
|
|
431
|
-
* keep working with #rrggbb only. rgba() alpha is
|
|
432
|
-
* the WebGL shader has no per-color alpha channel, and
|
|
433
|
-
* opaque by design — use component-level `opacity` for
|
|
430
|
+
* (hex / named / rgb() / rgba() / hsl() / hsla()) into a 6-digit hex string,
|
|
431
|
+
* so renderers can keep working with #rrggbb only. rgba()/hsla() alpha is
|
|
432
|
+
* intentionally dropped: the WebGL shader has no per-color alpha channel, and
|
|
433
|
+
* the component is opaque by design — use component-level `opacity` for
|
|
434
|
+
* transparency.
|
|
435
|
+
*
|
|
436
|
+
* `normalizeColorWithAlpha` keeps the alpha channel: it returns a 6-digit hex
|
|
437
|
+
* when alpha is 1, an 8-digit #rrggbbaa hex when alpha < 1, and the literal
|
|
438
|
+
* string 'transparent' for `transparent`. Use it for renderers (e.g. SVG)
|
|
439
|
+
* that can represent per-color transparency.
|
|
434
440
|
*/
|
|
435
441
|
|
|
436
442
|
var NAMED_COLORS = {
|
|
@@ -586,48 +592,161 @@ var NAMED_COLORS = {
|
|
|
586
592
|
function clampChannel(value) {
|
|
587
593
|
return Math.min(255, Math.max(0, Math.round(value)));
|
|
588
594
|
}
|
|
589
|
-
function
|
|
590
|
-
|
|
595
|
+
function clampUnit(value) {
|
|
596
|
+
return Math.min(1, Math.max(0, value));
|
|
597
|
+
}
|
|
598
|
+
function hexPair(value) {
|
|
599
|
+
var text = clampChannel(value).toString(16);
|
|
600
|
+
return text.length === 1 ? "0".concat(text) : text;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Parse the argument list of rgb()/rgba()/hsl()/hsla() (comma syntax or
|
|
605
|
+
* modern space + slash syntax). Returns { parts, alpha } where alpha is 1 when
|
|
606
|
+
* omitted. Returns null when the argument list cannot be parsed.
|
|
607
|
+
*/
|
|
608
|
+
function parseFunctionArgs(args) {
|
|
609
|
+
var parts = args.split(/[,\s]+/).map(function (part) {
|
|
610
|
+
return part.trim();
|
|
611
|
+
}).filter(function (part) {
|
|
612
|
+
return part !== '' && part !== '/';
|
|
613
|
+
});
|
|
591
614
|
if (parts.length < 3) return null;
|
|
592
|
-
var
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
615
|
+
var alpha = 1;
|
|
616
|
+
if (parts.length >= 4) {
|
|
617
|
+
var alphaText = parts.pop().trim();
|
|
618
|
+
if (alphaText.endsWith('%')) {
|
|
619
|
+
var percent = parseFloat(alphaText);
|
|
620
|
+
if (!Number.isFinite(percent)) return null;
|
|
621
|
+
alpha = clampUnit(percent / 100);
|
|
622
|
+
} else {
|
|
623
|
+
var number = Number(alphaText);
|
|
624
|
+
if (!Number.isFinite(number)) return null;
|
|
625
|
+
alpha = clampUnit(number);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return {
|
|
629
|
+
parts: parts,
|
|
630
|
+
alpha: alpha
|
|
605
631
|
};
|
|
606
|
-
|
|
632
|
+
}
|
|
633
|
+
function parseChannel(value) {
|
|
634
|
+
if (typeof value !== 'string' || value === '') return null;
|
|
635
|
+
var text = value.trim();
|
|
636
|
+
if (text.endsWith('%')) return clampChannel(parseFloat(text) / 100 * 255);
|
|
637
|
+
var number = Number(text);
|
|
638
|
+
return Number.isFinite(number) ? clampChannel(number) : null;
|
|
639
|
+
}
|
|
640
|
+
function parsePercent(value) {
|
|
641
|
+
if (typeof value !== 'string' || value === '') return null;
|
|
642
|
+
var text = value.trim();
|
|
643
|
+
if (!text.endsWith('%')) return null;
|
|
644
|
+
var number = parseFloat(text);
|
|
645
|
+
return Number.isFinite(number) ? Math.min(100, Math.max(0, number)) : null;
|
|
646
|
+
}
|
|
647
|
+
function parseHue(value) {
|
|
648
|
+
if (typeof value !== 'string' || value === '') return null;
|
|
649
|
+
var number = parseFloat(value);
|
|
650
|
+
return Number.isFinite(number) ? number : null;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/** Standard HSL -> RGB. h in degrees, s/l in 0..100, returns r/g/b in 0..255. */
|
|
654
|
+
function hslToRgb(h, s, l) {
|
|
655
|
+
var hue = (h % 360 + 360) % 360 / 360;
|
|
656
|
+
var saturation = s / 100;
|
|
657
|
+
var lightness = l / 100;
|
|
658
|
+
var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
|
|
659
|
+
var section = hue * 6;
|
|
660
|
+
var x = chroma * (1 - Math.abs(section % 2 - 1));
|
|
661
|
+
var red = 0;
|
|
662
|
+
var green = 0;
|
|
663
|
+
var blue = 0;
|
|
664
|
+
if (section < 1) {
|
|
665
|
+
red = chroma;
|
|
666
|
+
green = x;
|
|
667
|
+
} else if (section < 2) {
|
|
668
|
+
red = x;
|
|
669
|
+
green = chroma;
|
|
670
|
+
} else if (section < 3) {
|
|
671
|
+
green = chroma;
|
|
672
|
+
blue = x;
|
|
673
|
+
} else if (section < 4) {
|
|
674
|
+
green = x;
|
|
675
|
+
blue = chroma;
|
|
676
|
+
} else if (section < 5) {
|
|
677
|
+
red = x;
|
|
678
|
+
blue = chroma;
|
|
679
|
+
} else {
|
|
680
|
+
red = chroma;
|
|
681
|
+
blue = x;
|
|
682
|
+
}
|
|
683
|
+
var match = lightness - chroma / 2;
|
|
684
|
+
return [Math.round((red + match) * 255), Math.round((green + match) * 255), Math.round((blue + match) * 255)];
|
|
607
685
|
}
|
|
608
686
|
|
|
609
687
|
/**
|
|
610
|
-
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
* including percentages. Alpha in rgba() is ignored.
|
|
688
|
+
* Parse any supported CSS color. When keepAlpha is true the alpha channel is
|
|
689
|
+
* preserved (8-digit hex for alpha < 1); when false it is dropped. 'transparent'
|
|
690
|
+
* is only preserved when keepAlpha is true.
|
|
614
691
|
*/
|
|
615
|
-
function
|
|
692
|
+
function parseColor(value, keepAlpha) {
|
|
616
693
|
if (typeof value !== 'string') return null;
|
|
617
694
|
var input = value.trim();
|
|
618
695
|
if (!input) return null;
|
|
619
696
|
var lower = input.toLowerCase();
|
|
620
697
|
if (NAMED_COLORS[lower]) return NAMED_COLORS[lower];
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
698
|
+
// #rgb / #rgba / #rrggbb / #rrggbbaa,以及无 # 前缀的 6/8 位 hex(dicebear 习惯)
|
|
699
|
+
var hexMatch = input.match(/^#?([0-9a-f]{3,8})$/i);
|
|
700
|
+
if (hexMatch) {
|
|
701
|
+
var _hex = hexMatch[1].toLowerCase();
|
|
702
|
+
if (_hex.length === 3 || _hex.length === 4) {
|
|
703
|
+
_hex = _hex.split('').map(function (c) {
|
|
704
|
+
return c + c;
|
|
705
|
+
}).join('');
|
|
706
|
+
}
|
|
707
|
+
return "#".concat(_hex.slice(0, 6));
|
|
708
|
+
}
|
|
709
|
+
var funcMatch = input.match(/^(rgba?|hsla?)\(([^)]*)\)$/i);
|
|
710
|
+
if (!funcMatch) return null;
|
|
711
|
+
var kind = funcMatch[1].toLowerCase();
|
|
712
|
+
var parsed = parseFunctionArgs(funcMatch[2]);
|
|
713
|
+
if (!parsed) return null;
|
|
714
|
+
var parts = parsed.parts;
|
|
715
|
+
parsed.alpha;
|
|
716
|
+
var red;
|
|
717
|
+
var green;
|
|
718
|
+
var blue;
|
|
719
|
+
if (kind === 'rgb' || kind === 'rgba') {
|
|
720
|
+
if (parts.length !== 3) return null;
|
|
721
|
+
red = parseChannel(parts[0]);
|
|
722
|
+
green = parseChannel(parts[1]);
|
|
723
|
+
blue = parseChannel(parts[2]);
|
|
724
|
+
if (red === null || green === null || blue === null) return null;
|
|
725
|
+
} else {
|
|
726
|
+
if (parts.length !== 3) return null;
|
|
727
|
+
var hue = parseHue(parts[0]);
|
|
728
|
+
var saturation = parsePercent(parts[1]);
|
|
729
|
+
var lightness = parsePercent(parts[2]);
|
|
730
|
+
if (hue === null || saturation === null || lightness === null) return null;
|
|
731
|
+
var _hslToRgb = hslToRgb(hue, saturation, lightness);
|
|
732
|
+
var _hslToRgb2 = _slicedToArray(_hslToRgb, 3);
|
|
733
|
+
red = _hslToRgb2[0];
|
|
734
|
+
green = _hslToRgb2[1];
|
|
735
|
+
blue = _hslToRgb2[2];
|
|
627
736
|
}
|
|
628
|
-
var
|
|
629
|
-
|
|
630
|
-
|
|
737
|
+
var hex = "#".concat(hexPair(red)).concat(hexPair(green)).concat(hexPair(blue));
|
|
738
|
+
return hex;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Convert any supported CSS color into `#rrggbb`. Returns null when the
|
|
743
|
+
* value cannot be parsed. Supports: #rgb / #rgba / #rrggbb / #rrggbbaa
|
|
744
|
+
* (case-insensitive), bare 6/8-digit hex, CSS named colors, rgb() / rgba() /
|
|
745
|
+
* hsl() / hsla() with comma or modern space syntax, including percentages.
|
|
746
|
+
* Alpha is ignored.
|
|
747
|
+
*/
|
|
748
|
+
function normalizeColor(value) {
|
|
749
|
+
return parseColor(value);
|
|
631
750
|
}
|
|
632
751
|
function hexToRgb01(color) {
|
|
633
752
|
var hex = normalizeColor(color);
|
|
@@ -960,10 +1079,10 @@ var FallbackRenderer = /*#__PURE__*/function () {
|
|
|
960
1079
|
}]);
|
|
961
1080
|
}();
|
|
962
1081
|
|
|
963
|
-
/**
|
|
964
|
-
* Document-level shared rAF scheduler. Every component instance subscribes
|
|
965
|
-
* its own frame callback; the whole page runs ONE animation loop (like the
|
|
966
|
-
* original demo), which avoids jank from many competing rAF loops.
|
|
1082
|
+
/**
|
|
1083
|
+
* Document-level shared rAF scheduler. Every component instance subscribes
|
|
1084
|
+
* its own frame callback; the whole page runs ONE animation loop (like the
|
|
1085
|
+
* original demo), which avoids jank from many competing rAF loops.
|
|
967
1086
|
*/
|
|
968
1087
|
var subscribers = [];
|
|
969
1088
|
var running = false;
|
|
@@ -1040,9 +1159,9 @@ function subscribeScheduler(onFrame, isPaused) {
|
|
|
1040
1159
|
};
|
|
1041
1160
|
}
|
|
1042
1161
|
|
|
1043
|
-
/**
|
|
1044
|
-
* Gates drawing on "element intersects viewport AND the page tab is visible".
|
|
1045
|
-
* Falls back to always-visible when IntersectionObserver is unavailable.
|
|
1162
|
+
/**
|
|
1163
|
+
* Gates drawing on "element intersects viewport AND the page tab is visible".
|
|
1164
|
+
* Falls back to always-visible when IntersectionObserver is unavailable.
|
|
1046
1165
|
*/
|
|
1047
1166
|
function createVisibilityGuard(element) {
|
|
1048
1167
|
var onChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -1180,19 +1299,19 @@ function releaseHostStyles(host) {
|
|
|
1180
1299
|
HOST_STYLES.delete(host);
|
|
1181
1300
|
}
|
|
1182
1301
|
|
|
1183
|
-
/**
|
|
1184
|
-
* Mount the cosmic (nebula) material as a background layer inside `host`.
|
|
1185
|
-
*
|
|
1186
|
-
* The layer is absolutely positioned and defaults to `z-index: -1`, so it
|
|
1187
|
-
* paints behind the host's in-flow content: text/buttons/images inside the
|
|
1188
|
-
* host sit on top with zero extra CSS. Host gets `position: relative;
|
|
1189
|
-
* isolation: isolate` automatically so the layer can never escape its box
|
|
1190
|
-
* (or break stacking outside it).
|
|
1191
|
-
*
|
|
1192
|
-
* Options: preset (literary name), colors, seed, speed, quality,
|
|
1193
|
-
* renderer, renderScale, powerPreference, fps, paused/static, mouseColor,
|
|
1194
|
-
* respectReducedMotion, opacity (0-1), fallbackColor (true=preset base
|
|
1195
|
-
* color, a hex string, or false to disable).
|
|
1302
|
+
/**
|
|
1303
|
+
* Mount the cosmic (nebula) material as a background layer inside `host`.
|
|
1304
|
+
*
|
|
1305
|
+
* The layer is absolutely positioned and defaults to `z-index: -1`, so it
|
|
1306
|
+
* paints behind the host's in-flow content: text/buttons/images inside the
|
|
1307
|
+
* host sit on top with zero extra CSS. Host gets `position: relative;
|
|
1308
|
+
* isolation: isolate` automatically so the layer can never escape its box
|
|
1309
|
+
* (or break stacking outside it).
|
|
1310
|
+
*
|
|
1311
|
+
* Options: preset (literary name), colors, seed, speed, quality,
|
|
1312
|
+
* renderer, renderScale, powerPreference, fps, paused/static, mouseColor,
|
|
1313
|
+
* respectReducedMotion, opacity (0-1), fallbackColor (true=preset base
|
|
1314
|
+
* color, a hex string, or false to disable).
|
|
1196
1315
|
*/
|
|
1197
1316
|
function createColorBackground(host) {
|
|
1198
1317
|
var _options$preset;
|