tina4js 1.0.9 → 1.0.10

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 (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +41 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tina4js",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Sub-3KB reactive framework — signals, web components, routing, PWA",
5
5
  "type": "module",
6
6
  "main": "dist/tina4.cjs.js",
package/readme.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # Tina4-JS
2
2
 
3
- Sub-3KB reactive framework — signals, web components, routing, and PWA.
3
+ Sub-3KB reactive framework — signals, web components, routing, PWA, WebSocket, and API client.
4
4
 
5
5
  Works standalone or embedded inside [tina4-php](https://github.com/tina4stack/tina4-php) / [tina4-python](https://github.com/tina4stack/tina4-python).
6
6
 
7
+ **[Live Gallery — 9 real-world examples](https://tina4stack.github.io/tina4-js/examples/gallery/)** · dashboards, CRUD, chat, auth, cart, forms, PWA, data tables, and live search — all self-contained, no build step.
8
+
7
9
  ## Why?
8
10
 
9
11
  | Feature | React | Preact | Vue | **tina4-js** |
@@ -193,6 +195,29 @@ pwa.register({
193
195
  });
194
196
  ```
195
197
 
198
+ ### WebSocket — Signal-driven real-time
199
+
200
+ ```ts
201
+ import { ws } from 'tina4js/ws';
202
+
203
+ const socket = ws.connect('wss://api.example.com/ws');
204
+
205
+ // Reactive signals — use in html templates
206
+ socket.status.value; // 'connecting' | 'connected' | 'disconnected' | 'error'
207
+ socket.connected.value; // boolean
208
+ socket.lastMessage.value;
209
+
210
+ // Pipe messages into a signal
211
+ const messages = signal([]);
212
+ socket.pipe(messages, (msg, current) => [...current, msg]);
213
+
214
+ // Send
215
+ socket.send({ type: 'ping' }); // objects auto-JSON serialised
216
+
217
+ // Auto-reconnects with exponential backoff by default
218
+ socket.close(); // intentional close — no reconnect
219
+ ```
220
+
196
221
  ### Debug Overlay
197
222
 
198
223
  A built-in debug overlay that shows live signal values, component tree, route history, and API calls.
@@ -240,6 +265,21 @@ npm run dev # dev server
240
265
 
241
266
  ## Changelog
242
267
 
268
+ ### 1.0.9
269
+ - **Fix:** All `@event` handlers are now automatically wrapped in `batch()` — multiple signal writes inside a single handler produce exactly one re-render after the event finishes, preventing mid-event DOM rebuilds and duplicate handler calls on re-rendered elements
270
+
271
+ ### 1.0.8
272
+ - Added `--css` flag to `tina4 create` — scaffolds with [tina4-css](https://www.npmjs.com/package/tina4-css) included
273
+ - Added gallery of 9 real-world examples: [live demo](https://tina4stack.github.io/tina4-js/examples/gallery/)
274
+
275
+ ### 1.0.7
276
+ - Added WebSocket module (`tina4js/ws`) with signal-driven status, auto-reconnect with exponential backoff, `pipe()` for streaming messages into signals, and JSON auto-parse/serialise
277
+ - Fixed effect error isolation — a throwing effect no longer blocks sibling effects
278
+ - Fixed API request/response correlation for concurrent requests
279
+ - Fixed API tracker always showing empty URL in debug overlay
280
+ - Added per-request `headers` and `params` to all API methods
281
+ - 231 tests across 10 test files
282
+
243
283
  ### 1.0.5
244
284
  - **Fix:** Effects now properly unsubscribe from signals on dispose — prevents stale subscriptions accumulating in signal subscriber sets across navigations
245
285
  - **Fix:** Function bindings in `html` templates now dispose inner effects when re-evaluated — fixes duplicate DOM nodes from nested reactive lists and conditionals