@runic-artifex/react 0.14.0 → 0.15.1

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/README.md CHANGED
@@ -61,6 +61,9 @@ a client alive in a cache:
61
61
  Kept clients are handed over, not shared: two mounted components of the same
62
62
  reference have a client each.
63
63
  - An already connected client is observed and left to its owner.
64
+ - `client` stays the same object for the connection, so
65
+ `useEffect(…, [view.client])` does not run again when the View's state
66
+ changes.
64
67
  - `state` renders through `useSyncExternalStore`, so concurrent rendering sees
65
68
  one consistent snapshot.
66
69
  - `pending` is true while a reference connects. `error` holds a failed
@@ -196,13 +199,13 @@ same on every render. `aria-invalid` is true while the field has `errors` or an
196
199
  `errors` holds the member's validation messages from the descriptor (`[]` when valid), `error` why the latest write
197
200
  or text failed (a `BridgeError` or a `FieldError`, whose `kind` is `rejected`, `conflict`, `committed-with-error` or
198
201
  `invalid-text`). `FieldError`, `FieldOptions`, `FieldState` and `BridgeField` are exported from this package. See the
199
- [field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/views#fields) for the receipts
202
+ [field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#fields) for the receipts
200
203
  and text forms.
201
204
 
202
205
  ### Text inputs: `useTextField(view, read, write, options?)`
203
206
 
204
207
  Binds a controlled text input to a member through the framework-neutral
205
- [text field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/views#text-inputs)
208
+ [text field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#text-inputs)
206
209
  while the component is mounted. `read` and `write` may close over render values:
207
210
 
208
211
  ```tsx
@@ -322,7 +325,7 @@ neither.
322
325
  ## `useOperation(start, options?)`
323
326
 
324
327
  Observes a generated `start<Command>()` operation through the framework-neutral
325
- [operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/views#operation-feedback-and-latest-selection).
328
+ [operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#operation-feedback-and-latest-selection).
326
329
  `run(...args)` calls the latest `start`, so it may close over the current client:
327
330
 
328
331
  ```tsx
@@ -354,7 +357,7 @@ controller's options.
354
357
 
355
358
  Admits only the newest of several reads, for example loading the item the user
356
359
  selected last, through the framework-neutral
357
- [latest-operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/views#operation-feedback-and-latest-selection).
360
+ [latest-operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#operation-feedback-and-latest-selection).
358
361
  Each `run(intent)` replaces the queued intent and cancels the active read; the next
359
362
  read starts only after the previous one reaches its terminal status and the intent's
360
363
  optional `waitForCompletion` barrier:
@@ -383,8 +386,9 @@ Renders the page's connection to its .NET host while the component is mounted.
383
386
  It wraps `onBridgeConnection` from `@runic-artifex/views` (re-exported here since 0.11, with the
384
387
  `BridgeConnectionState` and `BridgeConnectionOptions` types) and returns
385
388
  `{ state }`, where `state` is a `BridgeConnectionState`: `connecting`,
386
- `connected`, `reconnecting` or `lost` (a closed set, see
387
- [Connection state](https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/views#connection-state)):
389
+ `connected`, `reconnecting`, `lost` or `closed` (the application closed the
390
+ window, since 0.15; a closed set, see
391
+ [Connection state](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#connection-state)):
388
392
 
389
393
  ```tsx
390
394
  import { useBridgeConnection } from "@runic-artifex/react";
@@ -405,7 +409,7 @@ subscribes again; an invalid one throws a `RangeError`. A server render reads
405
409
  Follows the declared menu bar of a Runic Desktop window that leaves it to the
406
410
  page (`DesktopMenuBarPresentation.Page`) while the component is mounted. It
407
411
  wraps `createMenuBarController` from `@runic-artifex/views` (see
408
- [In-page menu bar](https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/views#in-page-menu-bar)) and returns `{ state, invoke, handleKeyDown }`: `state` is a
412
+ [In-page menu bar](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#in-page-menu-bar)) and returns `{ state, invoke, handleKeyDown }`: `state` is a
409
413
  `MenuBarState`, and the bar is rendered by the menubar component of the
410
414
  application's own UI library. Runic ships no menubar component.
411
415
 
@@ -435,7 +439,7 @@ The controller starts in an effect, so a server render reads `connecting`, and
435
439
 
436
440
  Base UI's `Menubar` (`@base-ui/react`, the base of shadcn/ui's Base UI
437
441
  Menubar) with a controlled open menu; the
438
- [Notes example](https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/examples/notes-view-first#in-page-menu-bar) adds submenus, check and radio
442
+ [Notes example](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/examples/notes-view-first#in-page-menu-bar) adds submenus, check and radio
439
443
  items and is tested with real keys:
440
444
 
441
445
  ```tsx
@@ -503,7 +507,7 @@ const offline = isBridgeError(error, "disconnected");
503
507
  ```
504
508
 
505
509
  `instanceof` holds for errors from every copy of the package on the page.
506
- [Errors and diagnostics](https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/views#errors-and-diagnostics)
510
+ [Errors and diagnostics](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#errors-and-diagnostics)
507
511
  lists the kinds. Any other value, such as an exception that your own connect
508
512
  function or command callback throws, arrives unchanged.
509
513
 
@@ -545,16 +549,16 @@ the application's own dialog.
545
549
  such as a close during the page's first render, is answered by the
546
550
  ViewModel's .NET fallback handler, or fails closed without one.
547
551
 
548
- The [ReactiveUI leave confirmation](https://github.com/Runic-Artifex/runic-sdk/blob/v0.14.0/packages/dotnet/Runic.Application.Views.ReactiveUI/README.md#leave-confirmation-in-a-web-view)
552
+ The [ReactiveUI leave confirmation](https://github.com/Runic-Artifex/runic-sdk/blob/v0.15.1/packages/dotnet/Runic.Application.Views.ReactiveUI/README.md#leave-confirmation-in-a-web-view)
549
553
  has the .NET side and which View answers which departure. In a frontend test,
550
554
  the generated mock's `interactions.<name>.request(input)` resolves with the
551
555
  registered handler's answer; see the
552
- [Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/views#testing).
556
+ [Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#testing).
553
557
 
554
558
  ## `useCollectionViewport(options)`
555
559
 
556
560
  Follows a fixed-row-height scroll container and returns `{ viewport, ref }`.
557
- `viewport` is the [`collectionViewport`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/views#collectionviewportoptions)
561
+ `viewport` is the [`collectionViewport`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#collectionviewportoptions)
558
562
  range for the container; it changes only when the range or sizes change. Send
559
563
  the range to the ViewModel from an effect:
560
564
 
package/dist/index.d.ts CHANGED
@@ -304,8 +304,8 @@ export interface BridgeConnectionHandle {
304
304
  readonly state: BridgeConnectionState;
305
305
  }
306
306
  /**
307
- * Renders the page's connection to its .NET host (`connecting`, `connected`, `reconnecting`
308
- * or `lost`) while the component is mounted, through `onBridgeConnection`. A changed
307
+ * Renders the page's connection to its .NET host (`connecting`, `connected`, `reconnecting`,
308
+ * `lost` or `closed`) while the component is mounted, through `onBridgeConnection`. A changed
309
309
  * `lostAfter` subscribes again. The server snapshot is `connecting`.
310
310
  *
311
311
  * ```tsx
package/dist/index.js CHANGED
@@ -398,8 +398,8 @@ function currentBridgeConnection(options) {
398
398
  return current;
399
399
  }
400
400
  /**
401
- * Renders the page's connection to its .NET host (`connecting`, `connected`, `reconnecting`
402
- * or `lost`) while the component is mounted, through `onBridgeConnection`. A changed
401
+ * Renders the page's connection to its .NET host (`connecting`, `connected`, `reconnecting`,
402
+ * `lost` or `closed`) while the component is mounted, through `onBridgeConnection`. A changed
403
403
  * `lostAfter` subscribes again. The server snapshot is `connecting`.
404
404
  *
405
405
  * ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runic-artifex/react",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "description": "React hooks for generated Runic Views clients",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,10 +30,10 @@
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=18.3.0 <20",
33
- "@runic-artifex/views": "0.14.0"
33
+ "@runic-artifex/views": "0.15.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@runic-artifex/views": "0.14.0",
36
+ "@runic-artifex/views": "0.15.1",
37
37
  "@types/react": "19.3.0",
38
38
  "@types/react-dom": "19.3.0",
39
39
  "esbuild": "0.28.2",
@@ -53,7 +53,7 @@
53
53
  "url": "git+https://github.com/Runic-Artifex/runic-sdk.git",
54
54
  "directory": "packages/web/react"
55
55
  },
56
- "homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/v0.14.0/packages/web/react#readme",
56
+ "homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/react#readme",
57
57
  "bugs": {
58
58
  "url": "https://github.com/Runic-Artifex/runic-sdk/issues"
59
59
  },
@@ -63,5 +63,5 @@
63
63
  "views",
64
64
  "react"
65
65
  ],
66
- "gitHead": "11dc038ea80315c4d2b7e15cbd03dfe175ed6124"
66
+ "gitHead": "fce42f47296a4784532fbba0fec9602cd3778fbb"
67
67
  }