@runic-artifex/react 0.15.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 +14 -11
- package/package.json +5 -5
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.15.
|
|
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.15.
|
|
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.15.
|
|
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.15.
|
|
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:
|
|
@@ -385,7 +388,7 @@ It wraps `onBridgeConnection` from `@runic-artifex/views` (re-exported here sinc
|
|
|
385
388
|
`{ state }`, where `state` is a `BridgeConnectionState`: `connecting`,
|
|
386
389
|
`connected`, `reconnecting`, `lost` or `closed` (the application closed the
|
|
387
390
|
window, since 0.15; a closed set, see
|
|
388
|
-
[Connection state](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.
|
|
391
|
+
[Connection state](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#connection-state)):
|
|
389
392
|
|
|
390
393
|
```tsx
|
|
391
394
|
import { useBridgeConnection } from "@runic-artifex/react";
|
|
@@ -406,7 +409,7 @@ subscribes again; an invalid one throws a `RangeError`. A server render reads
|
|
|
406
409
|
Follows the declared menu bar of a Runic Desktop window that leaves it to the
|
|
407
410
|
page (`DesktopMenuBarPresentation.Page`) while the component is mounted. It
|
|
408
411
|
wraps `createMenuBarController` from `@runic-artifex/views` (see
|
|
409
|
-
[In-page menu bar](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.
|
|
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
|
|
410
413
|
`MenuBarState`, and the bar is rendered by the menubar component of the
|
|
411
414
|
application's own UI library. Runic ships no menubar component.
|
|
412
415
|
|
|
@@ -436,7 +439,7 @@ The controller starts in an effect, so a server render reads `connecting`, and
|
|
|
436
439
|
|
|
437
440
|
Base UI's `Menubar` (`@base-ui/react`, the base of shadcn/ui's Base UI
|
|
438
441
|
Menubar) with a controlled open menu; the
|
|
439
|
-
[Notes example](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.
|
|
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
|
|
440
443
|
items and is tested with real keys:
|
|
441
444
|
|
|
442
445
|
```tsx
|
|
@@ -504,7 +507,7 @@ const offline = isBridgeError(error, "disconnected");
|
|
|
504
507
|
```
|
|
505
508
|
|
|
506
509
|
`instanceof` holds for errors from every copy of the package on the page.
|
|
507
|
-
[Errors and diagnostics](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.
|
|
510
|
+
[Errors and diagnostics](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#errors-and-diagnostics)
|
|
508
511
|
lists the kinds. Any other value, such as an exception that your own connect
|
|
509
512
|
function or command callback throws, arrives unchanged.
|
|
510
513
|
|
|
@@ -546,16 +549,16 @@ the application's own dialog.
|
|
|
546
549
|
such as a close during the page's first render, is answered by the
|
|
547
550
|
ViewModel's .NET fallback handler, or fails closed without one.
|
|
548
551
|
|
|
549
|
-
The [ReactiveUI leave confirmation](https://github.com/Runic-Artifex/runic-sdk/blob/v0.15.
|
|
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)
|
|
550
553
|
has the .NET side and which View answers which departure. In a frontend test,
|
|
551
554
|
the generated mock's `interactions.<name>.request(input)` resolves with the
|
|
552
555
|
registered handler's answer; see the
|
|
553
|
-
[Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.
|
|
556
|
+
[Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#testing).
|
|
554
557
|
|
|
555
558
|
## `useCollectionViewport(options)`
|
|
556
559
|
|
|
557
560
|
Follows a fixed-row-height scroll container and returns `{ viewport, ref }`.
|
|
558
|
-
`viewport` is the [`collectionViewport`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.
|
|
561
|
+
`viewport` is the [`collectionViewport`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#collectionviewportoptions)
|
|
559
562
|
range for the container; it changes only when the range or sizes change. Send
|
|
560
563
|
the range to the ViewModel from an effect:
|
|
561
564
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runic-artifex/react",
|
|
3
|
-
"version": "0.15.
|
|
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.15.
|
|
33
|
+
"@runic-artifex/views": "0.15.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@runic-artifex/views": "0.15.
|
|
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.15.
|
|
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": "
|
|
66
|
+
"gitHead": "fce42f47296a4784532fbba0fec9602cd3778fbb"
|
|
67
67
|
}
|