@5even7/dlc-ui 0.2.13 → 0.2.14
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 +9 -0
- package/README.md +46 -10
- package/dist/emo.cjs +18827 -0
- package/dist/emo.mjs +664 -0
- package/dist/index.cjs +18382 -0
- package/dist/index.mjs +386 -1
- package/dist/index.umd.js +45256 -3767
- package/dist/index.umd.min.js +1 -1
- package/dist/progress.cjs +1 -2
- package/dist/progress.mjs +1 -2
- package/dist/vue2.cjs +18676 -197
- package/dist/vue2.mjs +424 -3
- package/dist/vue3.cjs +18676 -197
- package/dist/vue3.mjs +424 -3
- package/package.json +17 -4
- package/styles/emo.css +32 -0
- package/styles/theme.css +1 -0
- package/types/emo.d.ts +11 -0
- package/types/index.d.ts +84 -0
- package/types/vue2.d.ts +1 -0
- package/types/vue3.d.ts +33 -1
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@5even7/dlc-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
7
7
|
},
|
|
8
|
-
"description": "DLC
|
|
8
|
+
"description": "DLC 星云胶囊、流体进度、动态背景与 Lottie 表情组件库,支持 H5 / Vue2 / Vue3。",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
"require": "./dist/color.cjs",
|
|
42
42
|
"default": "./dist/color.mjs"
|
|
43
43
|
},
|
|
44
|
+
"./emo": {
|
|
45
|
+
"types": "./types/emo.d.ts",
|
|
46
|
+
"import": "./dist/emo.mjs",
|
|
47
|
+
"require": "./dist/emo.cjs",
|
|
48
|
+
"default": "./dist/emo.mjs"
|
|
49
|
+
},
|
|
44
50
|
"./vue3": {
|
|
45
51
|
"types": "./types/vue3.d.ts",
|
|
46
52
|
"import": "./dist/vue3.mjs",
|
|
@@ -57,6 +63,7 @@
|
|
|
57
63
|
"./capsule/style.css": "./styles/capsule.css",
|
|
58
64
|
"./progress/style.css": "./styles/progress.css",
|
|
59
65
|
"./color/style.css": "./styles/color.css",
|
|
66
|
+
"./emo/style.css": "./styles/emo.css",
|
|
60
67
|
"./package.json": "./package.json"
|
|
61
68
|
},
|
|
62
69
|
"files": [
|
|
@@ -79,7 +86,7 @@
|
|
|
79
86
|
"./styles/*.css"
|
|
80
87
|
],
|
|
81
88
|
"scripts": {
|
|
82
|
-
"build": "rollup -c && node scripts/copy-css.mjs",
|
|
89
|
+
"build": "node scripts/generate-emo-assets.mjs && rollup -c && node scripts/copy-css.mjs",
|
|
83
90
|
"test": "node --test",
|
|
84
91
|
"serve": "node scripts/serve.mjs",
|
|
85
92
|
"demo:h5": "node scripts/serve.mjs",
|
|
@@ -99,7 +106,10 @@
|
|
|
99
106
|
"vue2",
|
|
100
107
|
"vue3",
|
|
101
108
|
"h5",
|
|
102
|
-
"component"
|
|
109
|
+
"component",
|
|
110
|
+
"lottie",
|
|
111
|
+
"emotion",
|
|
112
|
+
"emoji"
|
|
103
113
|
],
|
|
104
114
|
"license": "MIT",
|
|
105
115
|
"engines": {
|
|
@@ -118,5 +128,8 @@
|
|
|
118
128
|
"resize-observer-polyfill": "^1.5.1",
|
|
119
129
|
"rollup": "^4.24.0",
|
|
120
130
|
"vue": "^3.4.0"
|
|
131
|
+
},
|
|
132
|
+
"dependencies": {
|
|
133
|
+
"lottie-web": "^5.13.0"
|
|
121
134
|
}
|
|
122
135
|
}
|
package/styles/emo.css
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.dlc-emo-root {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-grid;
|
|
4
|
+
place-items: center;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
flex: 0 0 auto;
|
|
8
|
+
vertical-align: middle;
|
|
9
|
+
background: var(--dlc-emo-background, transparent);
|
|
10
|
+
opacity: var(--dlc-emo-opacity, 1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.dlc-emo-stage,
|
|
14
|
+
.dlc-emo-stage > svg,
|
|
15
|
+
.dlc-emo-stage > canvas {
|
|
16
|
+
display: block;
|
|
17
|
+
width: 100% !important;
|
|
18
|
+
height: 100% !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.dlc-emo-stage {
|
|
22
|
+
position: absolute;
|
|
23
|
+
inset: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dlc-emo-root[data-fit='cover'] .dlc-emo-stage {
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.dlc-emo-root[data-paused='true'] {
|
|
31
|
+
--dlc-emo-play-state: paused;
|
|
32
|
+
}
|
package/styles/theme.css
CHANGED
package/types/emo.d.ts
ADDED
package/types/index.d.ts
CHANGED
|
@@ -25,6 +25,24 @@ export interface ProgressPreset {
|
|
|
25
25
|
colors: ColorTuple;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export interface EmoPreset {
|
|
29
|
+
type: string;
|
|
30
|
+
name: string;
|
|
31
|
+
label: string;
|
|
32
|
+
category: string;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
frames: number;
|
|
36
|
+
fps: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface EmoTypeDefinition {
|
|
40
|
+
type: string;
|
|
41
|
+
label: string;
|
|
42
|
+
names: string[];
|
|
43
|
+
colorChannels: Array<'color' | 'accentColor'>;
|
|
44
|
+
}
|
|
45
|
+
|
|
28
46
|
export interface Copy {
|
|
29
47
|
brandName: string;
|
|
30
48
|
valueSuffix: string;
|
|
@@ -111,6 +129,29 @@ export interface ColorBackgroundOptions {
|
|
|
111
129
|
[key: string]: unknown;
|
|
112
130
|
}
|
|
113
131
|
|
|
132
|
+
export interface EmoOptions {
|
|
133
|
+
type?: string;
|
|
134
|
+
name?: string;
|
|
135
|
+
width?: number | string;
|
|
136
|
+
height?: number | string;
|
|
137
|
+
color?: string;
|
|
138
|
+
accentColor?: string | null;
|
|
139
|
+
speed?: number;
|
|
140
|
+
loop?: boolean;
|
|
141
|
+
autoplay?: boolean;
|
|
142
|
+
direction?: 'forward' | 'reverse' | 1 | -1;
|
|
143
|
+
opacity?: number;
|
|
144
|
+
fit?: 'contain' | 'cover';
|
|
145
|
+
renderer?: 'svg' | 'canvas';
|
|
146
|
+
paused?: boolean;
|
|
147
|
+
segment?: [number, number] | null;
|
|
148
|
+
background?: string;
|
|
149
|
+
label?: string;
|
|
150
|
+
instanceName?: string;
|
|
151
|
+
respectReducedMotion?: boolean;
|
|
152
|
+
[key: string]: unknown;
|
|
153
|
+
}
|
|
154
|
+
|
|
114
155
|
export interface Emitter {
|
|
115
156
|
on(event: string, handler: (...args: any[]) => void): () => void;
|
|
116
157
|
off(event: string, handler: (...args: any[]) => void): boolean;
|
|
@@ -225,6 +266,43 @@ export interface ColorBackgroundController extends Emitter {
|
|
|
225
266
|
readonly mouseColor: boolean;
|
|
226
267
|
}
|
|
227
268
|
|
|
269
|
+
export interface EmoController extends Emitter {
|
|
270
|
+
element: HTMLElement;
|
|
271
|
+
readonly animation: any;
|
|
272
|
+
readonly preset: EmoPreset;
|
|
273
|
+
play(): this;
|
|
274
|
+
pause(): this;
|
|
275
|
+
stop(): this;
|
|
276
|
+
setPaused(value: boolean): this;
|
|
277
|
+
setSpeed(value: number): this;
|
|
278
|
+
setDirection(value: EmoOptions['direction']): this;
|
|
279
|
+
setSegment(value: EmoOptions['segment']): this;
|
|
280
|
+
setName(value: string): this;
|
|
281
|
+
setType(value: string): this;
|
|
282
|
+
setColors(color: string, accentColor?: string | null): this;
|
|
283
|
+
setOpacity(value: number): this;
|
|
284
|
+
setBackground(value: string): this;
|
|
285
|
+
setSize(width?: number | string, height?: number | string): this;
|
|
286
|
+
setFit(value: EmoOptions['fit']): this;
|
|
287
|
+
setRenderer(value: EmoOptions['renderer']): this;
|
|
288
|
+
setLoop(value: boolean): this;
|
|
289
|
+
setAutoplay(value: boolean): this;
|
|
290
|
+
setLabel(value: string): this;
|
|
291
|
+
dispose(): void;
|
|
292
|
+
readonly speed: number;
|
|
293
|
+
readonly loop: boolean;
|
|
294
|
+
readonly autoplay: boolean;
|
|
295
|
+
readonly direction: 1 | -1;
|
|
296
|
+
readonly opacity: number;
|
|
297
|
+
readonly fit: 'contain' | 'cover';
|
|
298
|
+
readonly renderer: 'svg' | 'canvas';
|
|
299
|
+
readonly paused: boolean;
|
|
300
|
+
readonly segment: [number, number] | null;
|
|
301
|
+
readonly color: string;
|
|
302
|
+
readonly accentColor: string | null;
|
|
303
|
+
readonly background: string;
|
|
304
|
+
}
|
|
305
|
+
|
|
228
306
|
export declare class ProgressCapsuleController {
|
|
229
307
|
value: number;
|
|
230
308
|
min: number;
|
|
@@ -248,15 +326,21 @@ export declare class ProgressCapsuleController {
|
|
|
248
326
|
export declare function createCapsule(container: HTMLElement, options?: CapsuleOptions): CapsuleController;
|
|
249
327
|
export declare function createProgressCapsule(container: HTMLElement, options?: ProgressOptions): ProgressController;
|
|
250
328
|
export declare function createColorBackground(host: HTMLElement, options?: ColorBackgroundOptions): ColorBackgroundController;
|
|
329
|
+
export declare function createEmo(container: HTMLElement, options?: EmoOptions): EmoController;
|
|
251
330
|
|
|
252
331
|
export declare const PRESETS: CapsulePreset[];
|
|
253
332
|
export declare const PROGRESS_PRESETS: ProgressPreset[];
|
|
254
333
|
export declare const ALL_PRESETS: Array<CapsulePreset | ProgressPreset>;
|
|
255
334
|
export declare function getPreset(kind: 'capsule' | 'progress', ref: string): CapsulePreset | ProgressPreset;
|
|
335
|
+
export declare const EMO_TYPES: EmoTypeDefinition[];
|
|
336
|
+
export declare const EMO_PRESETS: EmoPreset[];
|
|
337
|
+
export declare const EMO_CATEGORIES: Record<string, string>;
|
|
338
|
+
export declare function getEmoPreset(type?: string, name?: string): EmoPreset;
|
|
256
339
|
|
|
257
340
|
export declare const DEFAULTS: {
|
|
258
341
|
capsule: Required<Pick<CapsuleOptions, 'width' | 'height' | 'quality' | 'respectReducedMotion' | 'mouseColor' | 'renderer' | 'textRatio' | 'renderScale' | 'powerPreference' | 'fps' | 'paused' | 'static'>>;
|
|
259
342
|
progress: Required<Pick<ProgressOptions, 'width' | 'height' | 'min' | 'max' | 'step' | 'draggable' | 'keyboard' | 'disabled' | 'readonly' | 'direction' | 'precision' | 'valueSuffix' | 'edgeStyle' | 'quality' | 'respectReducedMotion' | 'renderer' | 'textRatio' | 'showValue' | 'renderScale' | 'powerPreference' | 'fps' | 'paused' | 'static'>>;
|
|
343
|
+
emo: Required<Pick<EmoOptions, 'type' | 'name' | 'width' | 'height' | 'color' | 'speed' | 'loop' | 'autoplay' | 'direction' | 'opacity' | 'fit' | 'renderer' | 'paused' | 'background' | 'respectReducedMotion'>> & Pick<EmoOptions, 'accentColor' | 'segment'>;
|
|
260
344
|
};
|
|
261
345
|
|
|
262
346
|
export declare const COPY: Copy;
|
package/types/vue2.d.ts
CHANGED
package/types/vue3.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CapsuleOptions, ProgressOptions } from './index.js';
|
|
1
|
+
import { CapsuleOptions, ProgressOptions, EmoOptions } from './index.js';
|
|
2
2
|
|
|
3
3
|
export interface CosmicCapsuleComponent {
|
|
4
4
|
name: 'dlc-capsule';
|
|
@@ -93,9 +93,40 @@ export interface ColorBackgroundComponent {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
export interface EmoComponent {
|
|
97
|
+
name: 'dlc-emo';
|
|
98
|
+
props: (keyof EmoOptions)[];
|
|
99
|
+
emits: string[];
|
|
100
|
+
mounted: () => void;
|
|
101
|
+
beforeUnmount: () => void;
|
|
102
|
+
render: (h: Function) => any;
|
|
103
|
+
methods: {
|
|
104
|
+
play(): any;
|
|
105
|
+
pause(): any;
|
|
106
|
+
stop(): any;
|
|
107
|
+
setPaused(value: boolean): any;
|
|
108
|
+
setSpeed(value: number): any;
|
|
109
|
+
setDirection(value: EmoOptions['direction']): any;
|
|
110
|
+
setSegment(value: EmoOptions['segment']): any;
|
|
111
|
+
setName(value: string): any;
|
|
112
|
+
setType(value: string): any;
|
|
113
|
+
setColors(color: string, accentColor?: string | null): any;
|
|
114
|
+
setOpacity(value: number): any;
|
|
115
|
+
setBackground(value: string): any;
|
|
116
|
+
setSize(width?: number | string, height?: number | string): any;
|
|
117
|
+
setFit(value: EmoOptions['fit']): any;
|
|
118
|
+
setRenderer(value: EmoOptions['renderer']): any;
|
|
119
|
+
setLoop(value: boolean): any;
|
|
120
|
+
setAutoplay(value: boolean): any;
|
|
121
|
+
setLabel(value: string): any;
|
|
122
|
+
getController(): any;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
96
126
|
export declare const DlcCapsule: CosmicCapsuleComponent;
|
|
97
127
|
export declare const DlcProgress: ProgressCapsuleComponent;
|
|
98
128
|
export declare const DlcColor: ColorBackgroundComponent;
|
|
129
|
+
export declare const DlcEmo: EmoComponent;
|
|
99
130
|
|
|
100
131
|
// 旧名兼容别名(deprecated)
|
|
101
132
|
export declare const CosmicCapsule: CosmicCapsuleComponent;
|
|
@@ -105,6 +136,7 @@ declare const _default: {
|
|
|
105
136
|
DlcCapsule: CosmicCapsuleComponent;
|
|
106
137
|
DlcProgress: ProgressCapsuleComponent;
|
|
107
138
|
DlcColor: ColorBackgroundComponent;
|
|
139
|
+
DlcEmo: EmoComponent;
|
|
108
140
|
CosmicCapsule: CosmicCapsuleComponent;
|
|
109
141
|
ProgressCapsule: ProgressCapsuleComponent;
|
|
110
142
|
ColorBackground: ColorBackgroundComponent;
|