@minicode-dev/chat 0.0.0-stage → 0.1.0

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +123 -2
  3. package/assets/sounds/battleship_audio_pack/assets/cannon_fire.ogg +0 -0
  4. package/assets/sounds/battleship_audio_pack/assets/cruiser_damage_alarm.ogg +0 -0
  5. package/assets/sounds/battleship_audio_pack/assets/defeat.ogg +0 -0
  6. package/assets/sounds/battleship_audio_pack/assets/ocean_ambient_loop.ogg +0 -0
  7. package/assets/sounds/battleship_audio_pack/assets/projectile_flyby.ogg +0 -0
  8. package/assets/sounds/battleship_audio_pack/assets/ship_heavy_hit.ogg +0 -0
  9. package/assets/sounds/battleship_audio_pack/assets/ship_hit.ogg +0 -0
  10. package/assets/sounds/battleship_audio_pack/assets/ship_place.ogg +0 -0
  11. package/assets/sounds/battleship_audio_pack/assets/ship_rotate.ogg +0 -0
  12. package/assets/sounds/battleship_audio_pack/assets/ship_sinking.ogg +0 -0
  13. package/assets/sounds/battleship_audio_pack/assets/sonar_ping.ogg +0 -0
  14. package/assets/sounds/battleship_audio_pack/assets/ui_click.ogg +0 -0
  15. package/assets/sounds/battleship_audio_pack/assets/victory.ogg +0 -0
  16. package/assets/sounds/battleship_audio_pack/assets/water_splash.ogg +0 -0
  17. package/assets/sounds/connect4/close.ogg +0 -0
  18. package/assets/sounds/connect4/draw.ogg +0 -0
  19. package/assets/sounds/connect4/drop.ogg +0 -0
  20. package/assets/sounds/connect4/invite.ogg +0 -0
  21. package/assets/sounds/connect4/lose.ogg +0 -0
  22. package/assets/sounds/connect4/start.ogg +0 -0
  23. package/assets/sounds/connect4/turn.ogg +0 -0
  24. package/assets/sounds/connect4/win.ogg +0 -0
  25. package/assets/sounds/notification.mp3 +0 -0
  26. package/assets/sounds/notification.ogg +0 -0
  27. package/assets/sounds/ting.mp3 +0 -0
  28. package/assets/sounds/ting.ogg +0 -0
  29. package/dist/chunks/BattleshipGameCard-CW_A8Nim.js +958 -0
  30. package/dist/chunks/BattleshipGameCard-CW_A8Nim.js.map +1 -0
  31. package/dist/chunks/BattleshipPrototype-Duz-S1JE.js +373 -0
  32. package/dist/chunks/BattleshipPrototype-Duz-S1JE.js.map +1 -0
  33. package/dist/chunks/battleship-DXKuIZ1I.js +124 -0
  34. package/dist/chunks/battleship-DXKuIZ1I.js.map +1 -0
  35. package/dist/chunks/connect4Sounds-Do3nvVFx.js +1847 -0
  36. package/dist/chunks/connect4Sounds-Do3nvVFx.js.map +1 -0
  37. package/dist/chunks/createBattleScene-HIAvjixn.js +1621 -0
  38. package/dist/chunks/createBattleScene-HIAvjixn.js.map +1 -0
  39. package/dist/chunks/webglSupport-2WjPEPZ_.js +16 -0
  40. package/dist/chunks/webglSupport-2WjPEPZ_.js.map +1 -0
  41. package/dist/index.js +9519 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/styles.css +2 -0
  44. package/index.d.ts +470 -0
  45. package/package.json +66 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@minicode-dev/chat` (owner: Minicode, project: LIRA).
4
+
5
+ ## 0.1.0 (unreleased)
6
+
7
+ First release extracted from LIRA.
8
+
9
+ ### Added
10
+
11
+ - Package inside the LIRA npm workspace (`packages/chat`), restricted publish under the `@minicode-dev` scope.
12
+ - `LiraChatProvider` with `config` / `transport` / `stores` / `chatStore`, `normalizeConfig` and `DEFAULT_CONFIG`.
13
+ - `ChatTransport` contract, `createStandaloneTransport` and the LIRA transport adapter.
14
+ - Connected placements `ChatWindow`, `ChatPage`, `ChatButton`, `ChatNotifications`, plus presentational primitives
15
+ (`ChatWindowShell`, `MessageList`, `MessageBubble`, `MessageComposer`, emoji/GIF/sticker pickers).
16
+ - Frozen protocol helpers (`LIRA_EDIT_V1:` / `LIRA_REACT_V1:` prefixes, stickers, reactions).
17
+ - Games (Connect 4, Battleship 3D with optional `three`), notifications and PWA helpers.
18
+ - Library build (Vite, ESM) to `dist/index.js` + `dist/styles.css`; hand-written `index.d.ts`.
19
+ - Sounds shipped in `assets/sounds/`, served by the host (`setChatAssetsBaseUrl`).
20
+
21
+ ### Changed
22
+
23
+ - `emojibase-data` is loaded lazily with dynamic `import()` (cached); the emoji picker and autocomplete
24
+ re-render when the catalog arrives (`useEmojiDataReady`).
package/README.md CHANGED
@@ -1,3 +1,124 @@
1
- # Temporary Holding Version
1
+ # @minicode-dev/chat
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Real-time chat for React (WebSocket, reactions, editing, emoji, GIFs/stickers via KLIPY, file and voice
4
+ attachments, notifications, Connect 4 and 3D Battleship) extracted from LIRA.
5
+
6
+ - Owner: **Minicode** · Project: **LIRA** · License: UNLICENSED (private, internal use only).
7
+ - Migration plan and status: `docs/MBSoft-Chat-NPM-Migration.md` in the LIRA repository.
8
+
9
+ ## Installation (private registry)
10
+
11
+ The package is published as a **restricted** package under the `@minicode-dev` scope. Add an `.npmrc` to the
12
+ host project (keep the token out of git, e.g. via an environment variable):
13
+
14
+ ```ini
15
+ @minicode-dev:registry=https://registry.npmjs.org/
16
+ //registry.npmjs.org/:_authToken=${NPM_TOKEN}
17
+ ```
18
+
19
+ ```bash
20
+ npm install @minicode-dev/chat react react-dom zustand lucide-react
21
+ # Only if Battleship 3D is enabled:
22
+ npm install three@">=0.134.0 <0.138.0"
23
+ ```
24
+
25
+ ### Peer dependencies
26
+
27
+ | Package | Range | Notes |
28
+ |---|---|---|
29
+ | `react`, `react-dom` | `>=18` | |
30
+ | `zustand` | `^4.5.0 \|\| ^5.0.0` | |
31
+ | `lucide-react` | `>=0.400.0` | |
32
+ | `three` | `>=0.134.0 <0.138.0` | Optional, only for Battleship 3D (loaded lazily). |
33
+
34
+ `emojibase-data` and `dayjs` are regular dependencies. The emoji catalog (~1.4 MB of JSON) is loaded with
35
+ dynamic `import()` the first time the composer/emoji picker mounts, so the host bundler must support
36
+ JSON imports (Vite, webpack 5, Rollup with `@rollup/plugin-json`, esbuild do).
37
+
38
+ ## Usage
39
+
40
+ ```jsx
41
+ import {
42
+ LiraChatProvider, ChatButton, ChatWindow, ChatPage, ChatNotifications,
43
+ } from '@minicode-dev/chat';
44
+ import '@minicode-dev/chat/styles.css';
45
+
46
+ const config = {
47
+ websocket: { url: 'wss://chat.example.com/ws' },
48
+ auth: { getToken: () => localStorage.getItem('token') },
49
+ callbacks: { onError: (error) => console.error(error) },
50
+ };
51
+
52
+ export function App() {
53
+ return (
54
+ <LiraChatProvider config={config}>
55
+ <ChatButton label="Chat" />
56
+ <ChatWindow placement="floating" />
57
+ <ChatNotifications />
58
+ </LiraChatProvider>
59
+ );
60
+ }
61
+
62
+ // Full-page route (e.g. /chat, also used by the "detach" window):
63
+ export function ChatRoute() {
64
+ return (
65
+ <LiraChatProvider config={config}>
66
+ <ChatPage />
67
+ </LiraChatProvider>
68
+ );
69
+ }
70
+ ```
71
+
72
+ - `LiraChatProvider` props: `config`, `transport` (inject your own `ChatTransport`, e.g. the LIRA adapter;
73
+ the provider never closes an injected transport), `stores`, `chatStore` and `children`. Without a
74
+ `transport`, a standalone WebSocket transport is created from `config.websocket.url`.
75
+ - `ChatWindow` props: `placement` (`'floating' | 'modal' | 'embedded'`), `open` / `onOpenChange`
76
+ (controlled mode), `className`, `BattleshipPreviewComponent`.
77
+ - `ChatPage`: `className`. `ChatButton`: `className`, `label`. `ChatNotifications`: no props.
78
+ - Lower level: `createStandaloneTransport`, `createChatStore`, hooks (`useChatConfig`, `useChatTransport`,
79
+ `useChatConnection`, `useChatUnreadTotal`) and presentational primitives (`ChatWindowShell`,
80
+ `MessageList`, `MessageComposer`, pickers…). See `index.d.ts` for the full typed API; anything not
81
+ exported from the package root is internal.
82
+
83
+ ## Styles
84
+
85
+ Import the stylesheet once, anywhere in the host app:
86
+
87
+ ```js
88
+ import '@minicode-dev/chat/styles.css';
89
+ ```
90
+
91
+ ## Assets (sounds)
92
+
93
+ Notification and game sounds ship in `assets/sounds/` (`ting.*`, `notification.*`, `connect4/*.ogg`,
94
+ `battleship_audio_pack/assets/*.ogg`) but **the host serves them**. By default the chat requests them
95
+ from `/sounds/...`. Either:
96
+
97
+ 1. Copy them into the host's public folder, e.g. in a `postinstall`/build step:
98
+
99
+ ```bash
100
+ cp -R node_modules/@minicode-dev/chat/assets/sounds public/sounds
101
+ ```
102
+
103
+ 2. Or serve them from another path/CDN and point the chat at it, before any sound plays:
104
+
105
+ ```js
106
+ import { setChatAssetsBaseUrl } from '@minicode-dev/chat';
107
+ setChatAssetsBaseUrl('https://cdn.example.com/minicode-chat/sounds');
108
+ ```
109
+
110
+ (`config.assets.baseUrl` exists in the config schema but is not wired yet; use the function.)
111
+
112
+ The files are also exposed as `@minicode-dev/chat/assets/*` for bundlers that can import asset URLs.
113
+
114
+ ## Development (LIRA workspace)
115
+
116
+ Inside the LIRA repo the package lives in `packages/chat` and is consumed **from source** through the
117
+ aliases in the root `vite.config.js`. The exports also carry a custom `@minicode-dev/source` condition that
118
+ points at `src/` for tooling that opts into it (`resolve.conditions`); it is never resolved by default.
119
+
120
+ ```bash
121
+ npm run build:chat # vite library build -> packages/chat/dist (index.js + styles.css)
122
+ npm pack -w @minicode-dev/chat # runs prepack (build) and creates the tarball
123
+ npm publish -w @minicode-dev/chat
124
+ ```
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file