@minicode-dev/chat 0.1.2 → 0.1.4
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 +18 -0
- package/README.md +132 -2
- package/assets/sounds/effects/cerdito_disco_original.mp3 +0 -0
- package/assets/sounds/effects/confetti.mp3 +0 -0
- package/assets/sounds/effects/nudge.mp3 +0 -0
- package/dist/index.js +2385 -1658
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/index.d.ts +35 -0
- package/package.json +6 -2
package/index.d.ts
CHANGED
|
@@ -97,6 +97,8 @@ export interface ChatFeatures {
|
|
|
97
97
|
voice?: boolean;
|
|
98
98
|
gifs?: boolean;
|
|
99
99
|
stickers?: boolean;
|
|
100
|
+
/** Embed the first supported YouTube video link in each message. Default true. */
|
|
101
|
+
youtube?: boolean;
|
|
100
102
|
presence?: boolean;
|
|
101
103
|
groups?: boolean;
|
|
102
104
|
privateChats?: boolean;
|
|
@@ -107,6 +109,7 @@ export interface ChatFeatures {
|
|
|
107
109
|
|
|
108
110
|
export interface ChatCustomEmoji {
|
|
109
111
|
shortcode: string;
|
|
112
|
+
/** Shared HTTP(S) or relative image URL; entries without a usable URL are ignored. */
|
|
110
113
|
url?: string;
|
|
111
114
|
label?: string;
|
|
112
115
|
keywords?: string[];
|
|
@@ -114,6 +117,37 @@ export interface ChatCustomEmoji {
|
|
|
114
117
|
[key: string]: any;
|
|
115
118
|
}
|
|
116
119
|
|
|
120
|
+
export type ChatEffectId = 'nudge' | 'pig-disco' | 'confetti';
|
|
121
|
+
export interface ChatEffectEvent { effectId: ChatEffectId; id: string; sentAt: number; }
|
|
122
|
+
export interface ChatEffectDefinition {
|
|
123
|
+
id: ChatEffectId;
|
|
124
|
+
label: string;
|
|
125
|
+
emoji: string;
|
|
126
|
+
durationMs: number;
|
|
127
|
+
description: string;
|
|
128
|
+
}
|
|
129
|
+
export interface ChatEffectsConfig {
|
|
130
|
+
enabled?: boolean;
|
|
131
|
+
sound?: boolean;
|
|
132
|
+
/** 0 to 1. */
|
|
133
|
+
volume?: number;
|
|
134
|
+
/** Default true: new received effects play automatically in the visible conversation. */
|
|
135
|
+
autoPlay?: boolean;
|
|
136
|
+
/** Minimum interval between sends and automatic playback; default 5000. */
|
|
137
|
+
cooldownMs?: number;
|
|
138
|
+
/** Maximum incoming event age for automatic playback; default 10000. */
|
|
139
|
+
maxAgeMs?: number;
|
|
140
|
+
/** Default false. */
|
|
141
|
+
allowGroups?: boolean;
|
|
142
|
+
/** Changes made through the effects picker, so the host can persist preferences. */
|
|
143
|
+
onPreferencesChange?: (patch: { sound?: boolean; autoPlay?: boolean }) => void;
|
|
144
|
+
}
|
|
145
|
+
export const EFFECT_CATALOG: readonly ChatEffectDefinition[];
|
|
146
|
+
export function getChatEffect(id: string): ChatEffectDefinition | undefined;
|
|
147
|
+
export const EFFECT_PREFIX: string;
|
|
148
|
+
export function encodeEffect(event: { effectId: ChatEffectId; id?: string; sentAt?: number }): string;
|
|
149
|
+
export function decodeEffect(text: unknown): ChatEffectEvent | null;
|
|
150
|
+
|
|
117
151
|
export interface ChatStorageAdapter {
|
|
118
152
|
getItem(key: string): string | null;
|
|
119
153
|
setItem(key: string, value: string): void;
|
|
@@ -160,6 +194,7 @@ export interface ChatConfig {
|
|
|
160
194
|
sound?: boolean;
|
|
161
195
|
appBadge?: boolean;
|
|
162
196
|
} | false;
|
|
197
|
+
effects?: ChatEffectsConfig | false;
|
|
163
198
|
assets?: { baseUrl?: string | null };
|
|
164
199
|
storage?: { prefix?: string; adapter?: ChatStorageAdapter };
|
|
165
200
|
locale?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minicode-dev/chat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "LIRA real-time chat (WebSocket, media, games) as a React package.",
|
|
6
6
|
"author": "Minicode",
|
|
@@ -41,7 +41,10 @@
|
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "vite build",
|
|
43
43
|
"prepack": "npm run build",
|
|
44
|
-
"release": "node scripts/release.mjs"
|
|
44
|
+
"release": "node scripts/release.mjs",
|
|
45
|
+
"dev": "vite --config demo/vite.config.js",
|
|
46
|
+
"audio:samples": "node scripts/generate-audio-samples.mjs",
|
|
47
|
+
"predev": "npm run audio:samples"
|
|
45
48
|
},
|
|
46
49
|
"peerDependencies": {
|
|
47
50
|
"lucide-react": ">=0.400.0",
|
|
@@ -64,6 +67,7 @@
|
|
|
64
67
|
},
|
|
65
68
|
"devDependencies": {
|
|
66
69
|
"@vitejs/plugin-react-swc": "^4.3.3",
|
|
70
|
+
"three": "^0.137.5",
|
|
67
71
|
"vite": "^8.3.5"
|
|
68
72
|
}
|
|
69
73
|
}
|