@5even7/dlc-ui 0.2.16 → 0.2.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5even7/dlc-ui",
3
- "version": "0.2.16",
3
+ "version": "0.2.18",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -72,7 +72,8 @@
72
72
  "types",
73
73
  "README.md",
74
74
  "LICENSE",
75
- "CHANGELOG.md"
75
+ "CHANGELOG.md",
76
+ "THIRD_PARTY_NOTICES.md"
76
77
  ],
77
78
  "peerDependencies": {
78
79
  "vue": ">=2.7.0"
package/styles/emo.css CHANGED
@@ -28,6 +28,62 @@
28
28
  overflow: hidden;
29
29
  }
30
30
 
31
- .dlc-emo-root[data-paused='true'] {
32
- --dlc-emo-play-state: paused;
31
+
32
+ /* Grok SVG renderer */
33
+
34
+ .dlc-grok {
35
+ display: block;
36
+ width: 100% !important;
37
+ height: 100% !important;
38
+ will-change: transform;
39
+ }
40
+
41
+ .dlc-grok__body {
42
+ fill: #2f86ed;
43
+ }
44
+
45
+ .dlc-grok__eye {
46
+ fill: #fffdf7;
47
+ }
48
+
49
+ .dlc-grok.act-bounce { animation: dlc-grok-bounce 0.85s ease; }
50
+ .dlc-grok.act-tilt { animation: dlc-grok-tilt 0.8s ease; }
51
+ .dlc-grok.act-scan .dlc-grok__eyes { animation: dlc-grok-scan 0.8s ease; }
52
+ .dlc-grok.act-turn { animation: dlc-grok-turn 0.9s ease; }
53
+ .dlc-grok.act-pulse { animation: dlc-grok-pulse 0.9s ease; }
54
+ .dlc-grok.act-glitch { animation: dlc-grok-glitch 0.55s steps(2); }
55
+
56
+ @keyframes dlc-grok-bounce {
57
+ 0%, 100% { transform: translateY(0); }
58
+ 40% { transform: translateY(-34px) scale(0.96, 1.04); }
59
+ 65% { transform: translateY(4px) scale(1.05, 0.94); }
60
+ }
61
+
62
+ @keyframes dlc-grok-tilt {
63
+ 35% { transform: rotate(-19deg) translate(-8px, 5px); }
64
+ 70% { transform: rotate(8deg); }
65
+ }
66
+
67
+ @keyframes dlc-grok-scan {
68
+ 0%, 100% { transform: translate(0); }
69
+ 30% { transform: translate(-24px, 2px); }
70
+ 70% { transform: translate(24px, -2px); }
71
+ }
72
+
73
+ @keyframes dlc-grok-turn {
74
+ 0%, 100% { transform: rotateY(0); }
75
+ 48% { transform: rotateY(180deg) scale(0.82); }
76
+ }
77
+
78
+ @keyframes dlc-grok-pulse {
79
+ 0%, 100% { transform: scale(1); }
80
+ 35% { transform: scale(1.08, 0.92); }
81
+ 65% { transform: scale(0.94, 1.08); }
82
+ }
83
+
84
+ @keyframes dlc-grok-glitch {
85
+ 0%, 100% { transform: translate(0); }
86
+ 25% { transform: translate(-9px, 3px); filter: drop-shadow(8px 0 #ff9500); }
87
+ 50% { transform: translate(10px, -3px); filter: drop-shadow(-8px 0 #79e2d0); }
88
+ 75% { transform: translate(-4px, 1px); }
33
89
  }
package/types/emo.d.ts CHANGED
@@ -1,11 +1,37 @@
1
1
  export {
2
2
  EmoOptions,
3
+ MiaoEmoOptions,
4
+ GrokEmoOptions,
5
+ EmoCommonOptions,
3
6
  EmoPreset,
4
7
  EmoTypeDefinition,
5
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,
6
24
  EMO_TYPES,
7
25
  EMO_PRESETS,
8
26
  EMO_CATEGORIES,
27
+ GROK_CATEGORIES,
28
+ GROK_NAMES,
29
+ GROK_STATE_META,
30
+ getGrokNamesFor,
31
+ getGrokStateMeta,
32
+ getEmoType,
9
33
  getEmoPreset,
10
- createEmo
34
+ getEmoAnimation,
35
+ createEmo,
36
+ createEmoPreviewCard
11
37
  } from './index.js';
package/types/index.d.ts CHANGED
@@ -2,6 +2,140 @@ export type Quality = 'auto' | 'low' | 'medium' | 'high';
2
2
  export type PowerPreference = 'default' | 'high-performance' | 'low-power';
3
3
  export type ColorTuple = [string, string, string, string];
4
4
 
5
+ export type MiaoPartColorKey =
6
+ | 'leftEye'
7
+ | 'rightEye'
8
+ | 'mouth'
9
+ | 'mouthFill'
10
+ | 'sleepBreath'
11
+ | 'shuttlecock'
12
+ | 'meditationFigure'
13
+ | 'meditationBubble'
14
+ | 'musicNotes'
15
+ | 'leftEyeOverlay'
16
+ | 'questionMark'
17
+ | 'leftBlush'
18
+ | 'rightBlush'
19
+ | 'sighBreath'
20
+ | 'particles';
21
+
22
+ /**
23
+ * Per-part color overrides for a Miao emoji. Values are any CSS color
24
+ * (#fff / #rrggbb / named / rgb() / rgba(), alpha ignored); null or missing
25
+ * keys keep the asset's original color, and keys the current animation does
26
+ * not support are ignored.
27
+ */
28
+ export type MiaoPartColors = Partial<Record<MiaoPartColorKey, string | null>>;
29
+
30
+ export type EmoType = 'miao' | 'grok';
31
+ export type EmoEngine = 'lottie' | 'grok';
32
+
33
+ export type GrokPartColorKey = 'body' | 'eyes';
34
+
35
+ /**
36
+ * Per-part color overrides for a Grok emoji. Values are any CSS color;
37
+ * null or missing keys keep the original color.
38
+ */
39
+ export type GrokPartColors = Partial<Record<GrokPartColorKey, string | null>>;
40
+
41
+ export type EmoPartColors = MiaoPartColors | GrokPartColors;
42
+
43
+ export type GrokShape =
44
+ | 'blob'
45
+ | 'pebble'
46
+ | 'squircle'
47
+ | 'capsule'
48
+ | 'triangle'
49
+ | 'hex'
50
+ | 'cloud'
51
+ | 'drop';
52
+
53
+ export type MiaoName =
54
+ | 'angry'
55
+ | 'cry'
56
+ | 'sad'
57
+ | 'sigh'
58
+ | 'investigate'
59
+ | 'mute'
60
+ | 'ponder'
61
+ | 'question'
62
+ | 'static'
63
+ | 'asleep'
64
+ | 'yawn'
65
+ | 'badminton'
66
+ | 'confident'
67
+ | 'laugh'
68
+ | 'leisure'
69
+ | 'music'
70
+ | 'smile'
71
+ | 'yummy'
72
+ | 'mock'
73
+ | 'shy'
74
+ | 'snigger'
75
+ | 'panic'
76
+ | 'shocked';
77
+
78
+ export type GrokName =
79
+ | 'sleeping'
80
+ | 'idle'
81
+ | 'listening'
82
+ | 'thinking'
83
+ | 'searching'
84
+ | 'working'
85
+ | 'happy'
86
+ | 'surprised'
87
+ | 'angry'
88
+ | 'sad'
89
+ | 'loading'
90
+ | 'confused'
91
+ | 'receiving';
92
+
93
+ /**
94
+ * Grok state presentation categories. Only organizes Docs / Playground
95
+ * display; all 13 public names stay valid regardless of category.
96
+ */
97
+ export type GrokStateCategory = 'emotion' | 'agent' | 'lifecycle';
98
+
99
+ /**
100
+ * Presentation metadata for one Grok state. A Grok `name` is a dynamic state
101
+ * module (expression pool + cadence + blink + body motion), so its static
102
+ * first frame may look similar to other states even when the dynamics differ.
103
+ */
104
+ export interface GrokStateMeta {
105
+ category: GrokStateCategory;
106
+ /** Chinese display name. */
107
+ label: string;
108
+ /** Short usage note shown on Docs cards. */
109
+ description?: string;
110
+ /** 'upstream' = ported from LaoA-GrokBot; 'dlc' reserved for DLC extensions. */
111
+ source: 'upstream' | 'dlc';
112
+ }
113
+
114
+ export interface GrokCategoryDef {
115
+ key: GrokStateCategory;
116
+ label: string;
117
+ }
118
+
119
+ export interface EmoPreviewCardOptions {
120
+ container: HTMLElement;
121
+ options: EmoOptions;
122
+ /** Auto-pause after this many ms of preview (default 2800). */
123
+ playFor?: number;
124
+ /** Keep the card static when the user prefers reduced motion (default true). */
125
+ respectReducedMotion?: boolean;
126
+ /** Pause the preview when the card leaves the viewport (default false). */
127
+ trackViewport?: boolean;
128
+ }
129
+
130
+ export interface EmoPreviewCardController {
131
+ element: HTMLElement;
132
+ controller: EmoController;
133
+ start(): void;
134
+ stop(): void;
135
+ setViewportVisible(visible: boolean): void;
136
+ dispose(): void;
137
+ }
138
+
5
139
  export interface CapsulePreset {
6
140
  id: string;
7
141
  code: string;
@@ -26,21 +160,25 @@ export interface ProgressPreset {
26
160
  }
27
161
 
28
162
  export interface EmoPreset {
29
- type: string;
163
+ type: EmoType;
30
164
  name: string;
31
165
  label: string;
32
166
  category: string;
33
167
  width: number;
34
168
  height: number;
35
- frames: number;
36
- fps: number;
169
+ engine: EmoEngine;
170
+ frames?: number;
171
+ fps?: number;
37
172
  }
38
173
 
39
174
  export interface EmoTypeDefinition {
40
- type: string;
175
+ type: EmoType;
41
176
  label: string;
177
+ defaultName: string;
178
+ engine: EmoEngine;
42
179
  names: string[];
43
- colorChannels: Array<'color' | 'accentColor'>;
180
+ partColors: string[];
181
+ shapes?: string[];
44
182
  }
45
183
 
46
184
  export interface Copy {
@@ -129,22 +267,15 @@ export interface ColorBackgroundOptions {
129
267
  [key: string]: unknown;
130
268
  }
131
269
 
132
- export interface EmoOptions {
133
- type?: string;
134
- name?: string;
270
+ export interface EmoCommonOptions {
135
271
  width?: number | string;
136
272
  height?: number | string;
137
- color?: string;
138
- accentColor?: string | null;
139
273
  speed?: number;
140
274
  loop?: boolean;
141
275
  autoplay?: boolean;
142
- direction?: 'forward' | 'reverse' | 1 | -1;
276
+ paused?: boolean;
143
277
  opacity?: number;
144
278
  fit?: 'contain' | 'cover' | 'fill';
145
- renderer?: 'svg' | 'canvas';
146
- paused?: boolean;
147
- segment?: [number, number] | null;
148
279
  background?: string;
149
280
  label?: string;
150
281
  instanceName?: string;
@@ -152,6 +283,25 @@ export interface EmoOptions {
152
283
  [key: string]: unknown;
153
284
  }
154
285
 
286
+ export interface MiaoEmoOptions extends EmoCommonOptions {
287
+ type?: 'miao';
288
+ name?: MiaoName;
289
+ partColors?: MiaoPartColors;
290
+ renderer?: 'svg' | 'canvas';
291
+ direction?: 'forward' | 'reverse' | 1 | -1;
292
+ segment?: [number, number] | null;
293
+ }
294
+
295
+ export interface GrokEmoOptions extends EmoCommonOptions {
296
+ type: 'grok';
297
+ name?: GrokName;
298
+ partColors?: GrokPartColors;
299
+ shape?: GrokShape;
300
+ interactive?: boolean;
301
+ }
302
+
303
+ export type EmoOptions = MiaoEmoOptions | GrokEmoOptions;
304
+
155
305
  export interface Emitter {
156
306
  on(event: string, handler: (...args: any[]) => void): () => void;
157
307
  off(event: string, handler: (...args: any[]) => void): boolean;
@@ -275,18 +425,20 @@ export interface EmoController extends Emitter {
275
425
  stop(): this;
276
426
  setPaused(value: boolean): this;
277
427
  setSpeed(value: number): this;
278
- setDirection(value: EmoOptions['direction']): this;
279
- setSegment(value: EmoOptions['segment']): this;
428
+ setDirection(value: MiaoEmoOptions['direction']): this;
429
+ setSegment(value: [number, number] | null): this;
280
430
  setName(value: string): this;
281
- setType(value: string): this;
282
- setColors(color: string, accentColor?: string | null): this;
431
+ setType(value: EmoType): this;
432
+ setPartColors(value: EmoPartColors): this;
283
433
  setOpacity(value: number): this;
284
434
  setBackground(value: string): this;
285
435
  setSize(width?: number | string, height?: number | string): this;
286
- setFit(value: EmoOptions['fit']): this;
287
- setRenderer(value: EmoOptions['renderer']): this;
436
+ setFit(value: EmoCommonOptions['fit']): this;
437
+ setRenderer(value: 'svg' | 'canvas'): this;
288
438
  setLoop(value: boolean): this;
289
439
  setAutoplay(value: boolean): this;
440
+ setShape(value: GrokShape): this;
441
+ setInteractive(value: boolean): this;
290
442
  setLabel(value: string): this;
291
443
  dispose(): void;
292
444
  readonly speed: number;
@@ -298,9 +450,10 @@ export interface EmoController extends Emitter {
298
450
  readonly renderer: 'svg' | 'canvas';
299
451
  readonly paused: boolean;
300
452
  readonly segment: [number, number] | null;
301
- readonly color: string;
302
- readonly accentColor: string | null;
453
+ readonly partColors: EmoPartColors;
303
454
  readonly background: string;
455
+ readonly shape: GrokShape;
456
+ readonly interactive: boolean;
304
457
  }
305
458
 
306
459
  export declare class ProgressCapsuleController {
@@ -327,6 +480,7 @@ export declare function createCapsule(container: HTMLElement, options?: CapsuleO
327
480
  export declare function createProgressCapsule(container: HTMLElement, options?: ProgressOptions): ProgressController;
328
481
  export declare function createColorBackground(host: HTMLElement, options?: ColorBackgroundOptions): ColorBackgroundController;
329
482
  export declare function createEmo(container: HTMLElement, options?: EmoOptions): EmoController;
483
+ export declare function createEmoPreviewCard(options: EmoPreviewCardOptions): EmoPreviewCardController;
330
484
 
331
485
  export declare const PRESETS: CapsulePreset[];
332
486
  export declare const PROGRESS_PRESETS: ProgressPreset[];
@@ -335,12 +489,19 @@ export declare function getPreset(kind: 'capsule' | 'progress', ref: string): Ca
335
489
  export declare const EMO_TYPES: EmoTypeDefinition[];
336
490
  export declare const EMO_PRESETS: EmoPreset[];
337
491
  export declare const EMO_CATEGORIES: Record<string, string>;
492
+ export declare function getEmoType(type?: string): EmoTypeDefinition;
338
493
  export declare function getEmoPreset(type?: string, name?: string): EmoPreset;
494
+ export declare function getEmoAnimation(type?: string, name?: string): any;
495
+ export declare const GROK_CATEGORIES: GrokCategoryDef[];
496
+ export declare const GROK_NAMES: GrokName[];
497
+ export declare const GROK_STATE_META: Record<GrokName, GrokStateMeta>;
498
+ export declare function getGrokNamesFor(tab: GrokStateCategory | 'all' | string): GrokName[];
499
+ export declare function getGrokStateMeta(name: string): GrokStateMeta;
339
500
 
340
501
  export declare const DEFAULTS: {
341
502
  capsule: Required<Pick<CapsuleOptions, 'width' | 'height' | 'quality' | 'respectReducedMotion' | 'mouseColor' | 'renderer' | 'textRatio' | 'renderScale' | 'powerPreference' | 'fps' | 'paused' | 'static'>>;
342
503
  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'>;
504
+ emo: Required<Pick<EmoCommonOptions, 'width' | 'height' | 'speed' | 'loop' | 'autoplay' | 'paused' | 'opacity' | 'fit' | 'background' | 'respectReducedMotion'>> & Pick<MiaoEmoOptions, 'type' | 'name' | 'partColors' | 'direction' | 'renderer' | 'segment'>;
344
505
  };
345
506
 
346
507
  export declare const COPY: Copy;
package/types/vue3.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CapsuleOptions, ProgressOptions, EmoOptions } from './index.js';
1
+ import { CapsuleOptions, ProgressOptions, MiaoEmoOptions, GrokEmoOptions, EmoCommonOptions } from './index.js';
2
2
 
3
3
  export interface CosmicCapsuleComponent {
4
4
  name: 'dlc-capsule';
@@ -95,7 +95,7 @@ export interface ColorBackgroundComponent {
95
95
 
96
96
  export interface EmoComponent {
97
97
  name: 'dlc-emo';
98
- props: (keyof EmoOptions)[];
98
+ props: (keyof MiaoEmoOptions | keyof GrokEmoOptions)[];
99
99
  emits: string[];
100
100
  mounted: () => void;
101
101
  beforeUnmount: () => void;
@@ -106,18 +106,20 @@ export interface EmoComponent {
106
106
  stop(): any;
107
107
  setPaused(value: boolean): any;
108
108
  setSpeed(value: number): any;
109
- setDirection(value: EmoOptions['direction']): any;
110
- setSegment(value: EmoOptions['segment']): any;
109
+ setDirection(value: MiaoEmoOptions['direction']): any;
110
+ setSegment(value: [number, number] | null): any;
111
111
  setName(value: string): any;
112
112
  setType(value: string): any;
113
- setColors(color: string, accentColor?: string | null): any;
113
+ setPartColors(value: import('./index').EmoPartColors): any;
114
114
  setOpacity(value: number): any;
115
115
  setBackground(value: string): any;
116
116
  setSize(width?: number | string, height?: number | string): any;
117
- setFit(value: EmoOptions['fit']): any;
118
- setRenderer(value: EmoOptions['renderer']): any;
117
+ setFit(value: EmoCommonOptions['fit']): any;
118
+ setRenderer(value: 'svg' | 'canvas'): any;
119
119
  setLoop(value: boolean): any;
120
120
  setAutoplay(value: boolean): any;
121
+ setShape(value: import('./index').GrokShape): any;
122
+ setInteractive(value: boolean): any;
121
123
  setLabel(value: string): any;
122
124
  getController(): any;
123
125
  };