@5even7/dlc-ui 0.2.17 → 0.2.19
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 +147 -123
- package/LICENSE +21 -21
- package/README.md +338 -316
- package/THIRD_PARTY_NOTICES.md +57 -0
- package/dist/avatar-creator.cjs +7221 -0
- package/dist/avatar-creator.mjs +9278 -0
- package/dist/capsule.cjs +189 -68
- package/dist/capsule.mjs +1208 -1103
- package/dist/color.cjs +186 -67
- package/dist/color.mjs +1157 -1052
- package/dist/emo.cjs +1439 -410
- package/dist/emo.mjs +1405 -496
- package/dist/index.cjs +7808 -310
- package/dist/index.mjs +13435 -3802
- package/dist/index.umd.js +7786 -288
- package/dist/index.umd.min.js +1 -1
- package/dist/progress.cjs +195 -76
- package/dist/progress.mjs +2293 -2188
- package/dist/vue2.cjs +7827 -376
- package/dist/vue2.mjs +13841 -4267
- package/dist/vue3.cjs +7827 -376
- package/dist/vue3.mjs +13841 -4267
- package/package.json +146 -135
- package/styles/avatar-creator.css +13 -0
- package/styles/base.css +32 -32
- package/styles/color.css +18 -18
- package/styles/emo.css +89 -33
- package/styles/progress.css +96 -96
- package/styles/theme.css +1 -0
- package/types/avatar-creator.d.ts +124 -0
- package/types/capsule.d.ts +15 -15
- package/types/color.d.ts +15 -15
- package/types/emo.d.ts +37 -14
- package/types/index.d.ts +581 -417
- package/types/progress.d.ts +16 -16
- package/types/vue2.d.ts +11 -10
- package/types/vue3.d.ts +169 -144
package/styles/progress.css
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
/* ---------- Progress capsule ---------- */
|
|
2
|
-
|
|
3
|
-
.hj-progress-root {
|
|
4
|
-
--hj-bg: #202126;
|
|
5
|
-
border: 1px solid rgba(0, 0, 0, 0.34);
|
|
6
|
-
color: #ffffff;
|
|
7
|
-
box-shadow: var(--hj-shadow);
|
|
8
|
-
cursor: ew-resize;
|
|
9
|
-
touch-action: none;
|
|
10
|
-
user-select: none;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.hj-progress-root[data-draggable="false"] {
|
|
14
|
-
cursor: default;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.hj-progress-root.is-disabled {
|
|
18
|
-
cursor: default;
|
|
19
|
-
opacity: 0.55;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.hj-progress-root.is-disabled:focus-visible {
|
|
23
|
-
outline: none;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.hj-progress-root.is-readonly {
|
|
27
|
-
cursor: default;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.hj-progress-root:focus-visible {
|
|
31
|
-
outline: 2px solid rgba(255, 255, 255, 0.8);
|
|
32
|
-
outline-offset: 4px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.hj-progress-canvas {
|
|
36
|
-
transition: filter 180ms ease, opacity 160ms ease;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.hj-progress-overlay {
|
|
40
|
-
z-index: 2;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.hj-progress-root[data-direction="rtl"] > .hj-progress-canvas {
|
|
44
|
-
transform: scaleX(-1);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.hj-progress-root.has-webgl-progress > .hj-progress-canvas:not(.hj-progress-overlay) {
|
|
48
|
-
opacity: 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.hj-progress-root.is-dragging .hj-progress-canvas {
|
|
52
|
-
filter: saturate(1.15) brightness(1.08);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/* Text slot container: geometry only (same convention as capsule). */
|
|
56
|
-
.hj-progress-text {
|
|
57
|
-
position: absolute;
|
|
58
|
-
top: 50%;
|
|
59
|
-
left: var(--hj-text-left, var(--hj-copy-left, 30px));
|
|
60
|
-
z-index: 4;
|
|
61
|
-
width: var(--hj-text-width, var(--hj-copy-max-width, 54%));
|
|
62
|
-
background: var(--hj-text-bg, transparent);
|
|
63
|
-
padding: var(--hj-text-pad, 0);
|
|
64
|
-
border-radius: var(--hj-text-radius, 0);
|
|
65
|
-
overflow: hidden;
|
|
66
|
-
transform: translateY(-50%);
|
|
67
|
-
pointer-events: none;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/* Color slot container: region right of the text area. */
|
|
71
|
-
.hj-progress-visual {
|
|
72
|
-
position: absolute;
|
|
73
|
-
top: 0;
|
|
74
|
-
bottom: 0;
|
|
75
|
-
left: var(--hj-text-width, var(--hj-copy-max-width, 54%));
|
|
76
|
-
right: 0;
|
|
77
|
-
z-index: 3;
|
|
78
|
-
pointer-events: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.hj-progress-value {
|
|
82
|
-
position: absolute;
|
|
83
|
-
top: 50%;
|
|
84
|
-
right: var(--hj-value-right);
|
|
85
|
-
z-index: 5;
|
|
86
|
-
min-width: 24%;
|
|
87
|
-
color: #ffffff;
|
|
88
|
-
font-size: 44px;
|
|
89
|
-
font-weight: 480;
|
|
90
|
-
line-height: 1;
|
|
91
|
-
text-align: right;
|
|
92
|
-
letter-spacing: -0.045em;
|
|
93
|
-
text-shadow: 0 2px 12px rgba(0, 0, 0, 0.24);
|
|
94
|
-
transform: translateY(-50%);
|
|
95
|
-
pointer-events: none;
|
|
96
|
-
}
|
|
1
|
+
/* ---------- Progress capsule ---------- */
|
|
2
|
+
|
|
3
|
+
.hj-progress-root {
|
|
4
|
+
--hj-bg: #202126;
|
|
5
|
+
border: 1px solid rgba(0, 0, 0, 0.34);
|
|
6
|
+
color: #ffffff;
|
|
7
|
+
box-shadow: var(--hj-shadow);
|
|
8
|
+
cursor: ew-resize;
|
|
9
|
+
touch-action: none;
|
|
10
|
+
user-select: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.hj-progress-root[data-draggable="false"] {
|
|
14
|
+
cursor: default;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.hj-progress-root.is-disabled {
|
|
18
|
+
cursor: default;
|
|
19
|
+
opacity: 0.55;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.hj-progress-root.is-disabled:focus-visible {
|
|
23
|
+
outline: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.hj-progress-root.is-readonly {
|
|
27
|
+
cursor: default;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.hj-progress-root:focus-visible {
|
|
31
|
+
outline: 2px solid rgba(255, 255, 255, 0.8);
|
|
32
|
+
outline-offset: 4px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.hj-progress-canvas {
|
|
36
|
+
transition: filter 180ms ease, opacity 160ms ease;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.hj-progress-overlay {
|
|
40
|
+
z-index: 2;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.hj-progress-root[data-direction="rtl"] > .hj-progress-canvas {
|
|
44
|
+
transform: scaleX(-1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.hj-progress-root.has-webgl-progress > .hj-progress-canvas:not(.hj-progress-overlay) {
|
|
48
|
+
opacity: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.hj-progress-root.is-dragging .hj-progress-canvas {
|
|
52
|
+
filter: saturate(1.15) brightness(1.08);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Text slot container: geometry only (same convention as capsule). */
|
|
56
|
+
.hj-progress-text {
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 50%;
|
|
59
|
+
left: var(--hj-text-left, var(--hj-copy-left, 30px));
|
|
60
|
+
z-index: 4;
|
|
61
|
+
width: var(--hj-text-width, var(--hj-copy-max-width, 54%));
|
|
62
|
+
background: var(--hj-text-bg, transparent);
|
|
63
|
+
padding: var(--hj-text-pad, 0);
|
|
64
|
+
border-radius: var(--hj-text-radius, 0);
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
transform: translateY(-50%);
|
|
67
|
+
pointer-events: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Color slot container: region right of the text area. */
|
|
71
|
+
.hj-progress-visual {
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 0;
|
|
74
|
+
bottom: 0;
|
|
75
|
+
left: var(--hj-text-width, var(--hj-copy-max-width, 54%));
|
|
76
|
+
right: 0;
|
|
77
|
+
z-index: 3;
|
|
78
|
+
pointer-events: none;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.hj-progress-value {
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: 50%;
|
|
84
|
+
right: var(--hj-value-right);
|
|
85
|
+
z-index: 5;
|
|
86
|
+
min-width: 24%;
|
|
87
|
+
color: #ffffff;
|
|
88
|
+
font-size: 44px;
|
|
89
|
+
font-weight: 480;
|
|
90
|
+
line-height: 1;
|
|
91
|
+
text-align: right;
|
|
92
|
+
letter-spacing: -0.045em;
|
|
93
|
+
text-shadow: 0 2px 12px rgba(0, 0, 0, 0.24);
|
|
94
|
+
transform: translateY(-50%);
|
|
95
|
+
pointer-events: none;
|
|
96
|
+
}
|
package/styles/theme.css
CHANGED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dlc-avatar-creator types.
|
|
3
|
+
*
|
|
4
|
+
* Two option layers:
|
|
5
|
+
* common — provider / style / seed / size / background
|
|
6
|
+
* native — providerOptions, passed through to the upstream generator,
|
|
7
|
+
* validated against the upstream schema (names, types, defaults
|
|
8
|
+
* and array semantics unchanged). Use getStyleDefinitions()
|
|
9
|
+
* to inspect each style's schema and generated controls.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type AvatarProviderId = 'dicebear' | 'humation';
|
|
13
|
+
export type AvatarProviderStyleId = string;
|
|
14
|
+
|
|
15
|
+
export interface AvatarControl {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
kind: 'select' | 'color' | 'range' | 'switch' | 'tags';
|
|
19
|
+
options?: string[];
|
|
20
|
+
min?: number;
|
|
21
|
+
max?: number;
|
|
22
|
+
step?: number;
|
|
23
|
+
default?: unknown;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface AvatarStyleDefinition {
|
|
27
|
+
id: string;
|
|
28
|
+
label: string;
|
|
29
|
+
provider: AvatarProviderId;
|
|
30
|
+
title: string;
|
|
31
|
+
designer: string;
|
|
32
|
+
homepage: string;
|
|
33
|
+
source: string;
|
|
34
|
+
license: string;
|
|
35
|
+
licenseUrl: string;
|
|
36
|
+
schema: Record<string, unknown>;
|
|
37
|
+
controls: AvatarControl[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface AvatarProviderDefinition {
|
|
41
|
+
id: AvatarProviderId;
|
|
42
|
+
label: string;
|
|
43
|
+
styles: AvatarStyleDefinition[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface AvatarOptions {
|
|
47
|
+
provider?: AvatarProviderId | string;
|
|
48
|
+
style?: string;
|
|
49
|
+
seed?: string;
|
|
50
|
+
size?: number;
|
|
51
|
+
background?: string;
|
|
52
|
+
/** Native upstream parameters, validated against the upstream schema. */
|
|
53
|
+
providerOptions?: Record<string, unknown>;
|
|
54
|
+
/** Throw on unrecognized/invalid providerOptions instead of warning. */
|
|
55
|
+
strict?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AvatarRenderResult {
|
|
59
|
+
svg: string;
|
|
60
|
+
width: number;
|
|
61
|
+
height: number;
|
|
62
|
+
warnings: string[];
|
|
63
|
+
metadata: {
|
|
64
|
+
provider: string;
|
|
65
|
+
style: string;
|
|
66
|
+
seed: string;
|
|
67
|
+
size?: number;
|
|
68
|
+
background?: string;
|
|
69
|
+
license: string;
|
|
70
|
+
licenseUrl: string;
|
|
71
|
+
source: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface AvatarState {
|
|
76
|
+
provider?: string;
|
|
77
|
+
style?: string;
|
|
78
|
+
seed?: string;
|
|
79
|
+
size?: number;
|
|
80
|
+
background?: string;
|
|
81
|
+
providerOptions: Record<string, unknown>;
|
|
82
|
+
strict: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface AvatarController {
|
|
86
|
+
element: HTMLElement;
|
|
87
|
+
readonly state: AvatarState;
|
|
88
|
+
getSvg(): string;
|
|
89
|
+
getResult(): AvatarRenderResult;
|
|
90
|
+
toDataUri(): string;
|
|
91
|
+
setOptions(options: AvatarOptions): AvatarRenderResult;
|
|
92
|
+
setProvider(provider: string): AvatarRenderResult;
|
|
93
|
+
setStyle(style: string): AvatarRenderResult;
|
|
94
|
+
setSeed(seed: string): AvatarRenderResult;
|
|
95
|
+
setSize(size: number): AvatarRenderResult;
|
|
96
|
+
setBackground(background: string): AvatarRenderResult;
|
|
97
|
+
setProviderOptions(options: Record<string, unknown>): AvatarRenderResult;
|
|
98
|
+
randomize(): AvatarRenderResult;
|
|
99
|
+
on(event: string, handler: (...args: any[]) => void): () => void;
|
|
100
|
+
off(event: string, handler: (...args: any[]) => void): boolean;
|
|
101
|
+
destroy(): void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare function createAvatarSvg(options?: AvatarOptions): AvatarRenderResult;
|
|
105
|
+
export declare function createAvatarCreator(container: HTMLElement, options?: AvatarOptions): AvatarController;
|
|
106
|
+
export declare function getStyleDefinitions(): AvatarStyleDefinition[];
|
|
107
|
+
export declare function getProviders(): AvatarProviderDefinition[];
|
|
108
|
+
export declare function getProvider(providerId: string): AvatarProviderDefinition | undefined;
|
|
109
|
+
export declare function getStyleDefinition(providerId: string, styleId: string): AvatarStyleDefinition | undefined;
|
|
110
|
+
|
|
111
|
+
export declare function hashSeed(seed: string): number;
|
|
112
|
+
export declare function fnv1a(input: string): number;
|
|
113
|
+
export declare function createPrng(seed?: string): any;
|
|
114
|
+
export declare function escapeXml(content: string): string;
|
|
115
|
+
export declare function applySize(svg: string, size: number | string): string;
|
|
116
|
+
export declare function svgToDataUri(svg: string): string;
|
|
117
|
+
export declare function sanitizeSvg(svg: string): string;
|
|
118
|
+
export declare function cleanText(value: unknown, maxLength?: number): string;
|
|
119
|
+
export declare function validateProviderOptions(
|
|
120
|
+
schema: Record<string, unknown>,
|
|
121
|
+
input: Record<string, unknown>,
|
|
122
|
+
options?: { strict?: boolean }
|
|
123
|
+
): { normalized: Record<string, unknown>; warnings: string[] };
|
|
124
|
+
export declare function buildControlsFromSchema(schema: Record<string, unknown>): AvatarControl[];
|
package/types/capsule.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export {
|
|
2
|
-
CapsuleOptions,
|
|
3
|
-
CapsuleController,
|
|
4
|
-
CapsulePreset,
|
|
5
|
-
Quality,
|
|
6
|
-
PowerPreference,
|
|
7
|
-
createCapsule,
|
|
8
|
-
parseSize,
|
|
9
|
-
dprCapFor,
|
|
10
|
-
effectiveDprCap,
|
|
11
|
-
QUALITY_TIERS,
|
|
12
|
-
hexToRgb01,
|
|
13
|
-
hexToRgba,
|
|
14
|
-
validateColors
|
|
15
|
-
} from './index.js';
|
|
1
|
+
export {
|
|
2
|
+
CapsuleOptions,
|
|
3
|
+
CapsuleController,
|
|
4
|
+
CapsulePreset,
|
|
5
|
+
Quality,
|
|
6
|
+
PowerPreference,
|
|
7
|
+
createCapsule,
|
|
8
|
+
parseSize,
|
|
9
|
+
dprCapFor,
|
|
10
|
+
effectiveDprCap,
|
|
11
|
+
QUALITY_TIERS,
|
|
12
|
+
hexToRgb01,
|
|
13
|
+
hexToRgba,
|
|
14
|
+
validateColors
|
|
15
|
+
} from './index.js';
|
package/types/color.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export {
|
|
2
|
-
ColorBackgroundOptions,
|
|
3
|
-
ColorBackgroundController,
|
|
4
|
-
CapsulePreset,
|
|
5
|
-
Quality,
|
|
6
|
-
PowerPreference,
|
|
7
|
-
createColorBackground,
|
|
8
|
-
parseSize,
|
|
9
|
-
dprCapFor,
|
|
10
|
-
effectiveDprCap,
|
|
11
|
-
QUALITY_TIERS,
|
|
12
|
-
hexToRgb01,
|
|
13
|
-
hexToRgba,
|
|
14
|
-
validateColors
|
|
15
|
-
} from './index.js';
|
|
1
|
+
export {
|
|
2
|
+
ColorBackgroundOptions,
|
|
3
|
+
ColorBackgroundController,
|
|
4
|
+
CapsulePreset,
|
|
5
|
+
Quality,
|
|
6
|
+
PowerPreference,
|
|
7
|
+
createColorBackground,
|
|
8
|
+
parseSize,
|
|
9
|
+
dprCapFor,
|
|
10
|
+
effectiveDprCap,
|
|
11
|
+
QUALITY_TIERS,
|
|
12
|
+
hexToRgb01,
|
|
13
|
+
hexToRgba,
|
|
14
|
+
validateColors
|
|
15
|
+
} from './index.js';
|
package/types/emo.d.ts
CHANGED
|
@@ -1,14 +1,37 @@
|
|
|
1
|
-
export {
|
|
2
|
-
EmoOptions,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
export {
|
|
2
|
+
EmoOptions,
|
|
3
|
+
MiaoEmoOptions,
|
|
4
|
+
GrokEmoOptions,
|
|
5
|
+
EmoCommonOptions,
|
|
6
|
+
EmoPreset,
|
|
7
|
+
EmoTypeDefinition,
|
|
8
|
+
EmoController,
|
|
9
|
+
EmoType,
|
|
10
|
+
EmoEngine,
|
|
11
|
+
EmoPartColors,
|
|
12
|
+
MiaoPartColors,
|
|
13
|
+
MiaoPartColorKey,
|
|
14
|
+
MiaoName,
|
|
15
|
+
GrokPartColors,
|
|
16
|
+
GrokPartColorKey,
|
|
17
|
+
GrokShape,
|
|
18
|
+
GrokName,
|
|
19
|
+
GrokStateCategory,
|
|
20
|
+
GrokStateMeta,
|
|
21
|
+
GrokCategoryDef,
|
|
22
|
+
EmoPreviewCardOptions,
|
|
23
|
+
EmoPreviewCardController,
|
|
24
|
+
EMO_TYPES,
|
|
25
|
+
EMO_PRESETS,
|
|
26
|
+
EMO_CATEGORIES,
|
|
27
|
+
GROK_CATEGORIES,
|
|
28
|
+
GROK_NAMES,
|
|
29
|
+
GROK_STATE_META,
|
|
30
|
+
getGrokNamesFor,
|
|
31
|
+
getGrokStateMeta,
|
|
32
|
+
getEmoType,
|
|
33
|
+
getEmoPreset,
|
|
34
|
+
getEmoAnimation,
|
|
35
|
+
createEmo,
|
|
36
|
+
createEmoPreviewCard
|
|
37
|
+
} from './index.js';
|