@runic-artifex/angular 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
|
@@ -18,7 +18,9 @@ match your Runic SDK packages. Angular 22 is supported.
|
|
|
18
18
|
`injectView(source)` connects a generated page reference, or
|
|
19
19
|
`{ connect: connect<Name> }` for a root ViewModel, for the lifetime of the
|
|
20
20
|
injection context and returns `state`, `client`, `error` and `pending`
|
|
21
|
-
signals and `retry()
|
|
21
|
+
signals and `retry()`. Each is its own signal: `client` stays the same object
|
|
22
|
+
for the connection, so an `effect` that reads only `client()` does not run
|
|
23
|
+
again when the View's state changes.
|
|
22
24
|
|
|
23
25
|
```ts
|
|
24
26
|
import { Component, input } from "@angular/core";
|
|
@@ -138,7 +140,7 @@ export class CounterPage {
|
|
|
138
140
|
|
|
139
141
|
Bind a text input to a member with `injectTextField(view, read, write, options?)`,
|
|
140
142
|
which wraps the framework-neutral
|
|
141
|
-
[text field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
143
|
+
[text field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#text-inputs)
|
|
142
144
|
for the lifetime of the injection context:
|
|
143
145
|
|
|
144
146
|
```ts
|
|
@@ -181,7 +183,7 @@ text at once and hides the race.
|
|
|
181
183
|
|
|
182
184
|
For generated Views prefer `injectField(view, field, options?)`: pass a descriptor of the
|
|
183
185
|
generated `{View}Fields`, such as `EditorFields.title`. It wraps the framework-neutral
|
|
184
|
-
[field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
186
|
+
[field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#fields)
|
|
185
187
|
for every kind (text, numbers, booleans, enums) and returns signals and actions:
|
|
186
188
|
|
|
187
189
|
- `value`, `text` (what a text input shows: `1.` stays while typing `1.5`), `editing`,
|
|
@@ -216,9 +218,10 @@ The options are those of the controller and `injector`:
|
|
|
216
218
|
|
|
217
219
|
- `commit: "pause"` writes the draft after `delay` milliseconds without input (700
|
|
218
220
|
by default) and at once on `commit()`, which blur calls; use it where each write is
|
|
219
|
-
an undo step or starts work in .NET. `commit()` resolves
|
|
220
|
-
settled, so a command that depends on the field can follow it
|
|
221
|
-
|
|
221
|
+
an undo step or starts work in .NET. `commit()` resolves with the field's state
|
|
222
|
+
once its writes settled, so a command that depends on the field can follow it
|
|
223
|
+
and skip a failed write:
|
|
224
|
+
`if ((await this.title.commit()).error === undefined) await this.editor.client()?.save();`.
|
|
222
225
|
- `checked: true` writes with the member's checked write: a change by another writer
|
|
223
226
|
since the draft started is a conflict instead of being overwritten.
|
|
224
227
|
- `coalesce` and `keepDraftOnError`, as for `injectTextField`.
|
|
@@ -392,14 +395,14 @@ For example, a navigation command whose departure guard awaits a dialog's
|
|
|
392
395
|
answer never completes while the answer waits behind it. Order such commands
|
|
393
396
|
by dispatch instead: start the next one once the previous one has been sent,
|
|
394
397
|
as the Notes example's
|
|
395
|
-
[`WindowOperations.runDispatched`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
398
|
+
[`WindowOperations.runDispatched`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/examples/notes-view-first/Angular/src/app/window-operations.ts)
|
|
396
399
|
does for its navigation commands.
|
|
397
400
|
|
|
398
401
|
## Operations
|
|
399
402
|
|
|
400
403
|
`injectOperation(start, options?)` observes a generated `start<Command>()` operation
|
|
401
404
|
through the framework-neutral
|
|
402
|
-
[operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
405
|
+
[operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#operation-feedback-and-latest-selection)
|
|
403
406
|
for the lifetime of the injection context:
|
|
404
407
|
|
|
405
408
|
```ts
|
|
@@ -425,7 +428,7 @@ context.
|
|
|
425
428
|
|
|
426
429
|
`injectLatestOperation(options?)` admits only the newest of several reads, for example
|
|
427
430
|
loading the item the user selected last, through the framework-neutral
|
|
428
|
-
[latest-operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
431
|
+
[latest-operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#operation-feedback-and-latest-selection).
|
|
429
432
|
Each `run(intent)` replaces the queued intent and cancels the active read; the next
|
|
430
433
|
read starts only after the previous one reaches its terminal status and the intent's
|
|
431
434
|
optional `waitForCompletion` barrier:
|
|
@@ -455,9 +458,9 @@ cancelling accepted work. Pass `injector` outside an injection context.
|
|
|
455
458
|
host for the lifetime of the injection context. It wraps `onBridgeConnection`
|
|
456
459
|
from `@runic-artifex/views` (re-exported here since 0.11, with the
|
|
457
460
|
`BridgeConnectionState` and `BridgeConnectionOptions` types) and returns `{ state }`, a signal of a
|
|
458
|
-
`BridgeConnectionState`: `connecting`, `connected`, `reconnecting` or `
|
|
459
|
-
closed set, see
|
|
460
|
-
[Connection state](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
461
|
+
`BridgeConnectionState`: `connecting`, `connected`, `reconnecting`, `lost` or `closed` (the
|
|
462
|
+
application closed the window, since 0.15; a closed set, see
|
|
463
|
+
[Connection state](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#connection-state)):
|
|
461
464
|
|
|
462
465
|
```ts
|
|
463
466
|
import { injectBridgeConnection } from "@runic-artifex/angular";
|
|
@@ -475,7 +478,7 @@ not observe and stays `connecting`. An invalid `lostAfter` throws a `RangeError`
|
|
|
475
478
|
`injectMenuBar(options?)` follows the declared menu bar of a Runic Desktop
|
|
476
479
|
window that leaves it to the page (`DesktopMenuBarPresentation.Page`) for the
|
|
477
480
|
lifetime of the injection context. It wraps `createMenuBarController` from
|
|
478
|
-
`@runic-artifex/views` (see [In-page menu bar](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
481
|
+
`@runic-artifex/views` (see [In-page menu bar](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#in-page-menu-bar))
|
|
479
482
|
and returns `{ state, invoke, handleKeyDown }`, where `state` is a signal of a
|
|
480
483
|
`MenuBarState`. The bar is rendered by the application's own menubar, for
|
|
481
484
|
example the CDK Menu's `cdkMenuBar`. Runic ships no menubar component.
|
|
@@ -500,7 +503,7 @@ it creates none and stays `connecting`.
|
|
|
500
503
|
### With the CDK Menu
|
|
501
504
|
|
|
502
505
|
The CDK's `cdkMenuBar` with `CdkMenuTrigger.open()` for `open` requests; the
|
|
503
|
-
[Notes example](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
506
|
+
[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
|
|
504
507
|
items (`cdkMenuItemCheckbox`, `cdkMenuItemRadio` in a `cdkMenuGroup`) and is
|
|
505
508
|
tested with real keys:
|
|
506
509
|
|
|
@@ -566,7 +569,7 @@ readonly message = computed(() => describeBridgeError(this.view.error()));
|
|
|
566
569
|
```
|
|
567
570
|
|
|
568
571
|
`instanceof` holds for errors from every copy of the package on the page.
|
|
569
|
-
[Errors and diagnostics](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
572
|
+
[Errors and diagnostics](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#errors-and-diagnostics)
|
|
570
573
|
lists the kinds. Any other value, such as an exception that your own connect
|
|
571
574
|
function or command callback throws, arrives unchanged.
|
|
572
575
|
|
|
@@ -617,16 +620,16 @@ application's own dialog.
|
|
|
617
620
|
departure before that is answered by the ViewModel's .NET fallback handler, or
|
|
618
621
|
fails closed without one.
|
|
619
622
|
|
|
620
|
-
The [ReactiveUI leave confirmation](https://github.com/Runic-Artifex/runic-sdk/blob/v0.
|
|
623
|
+
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)
|
|
621
624
|
has the .NET side and which View answers which departure. In a frontend test,
|
|
622
625
|
the generated mock's `interactions.<name>.request(input)` resolves with the
|
|
623
|
-
registered handler's answer; see the [Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
626
|
+
registered handler's answer; see the [Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#testing).
|
|
624
627
|
|
|
625
628
|
## Collection viewports
|
|
626
629
|
|
|
627
630
|
`injectCollectionViewport(element, options)` follows a fixed-row-height scroll
|
|
628
631
|
container and returns a signal with its
|
|
629
|
-
[`collectionViewport`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
632
|
+
[`collectionViewport`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/views#collectionviewportoptions)
|
|
630
633
|
range. Pass the container as a signal, such as a `viewChild`, and the options as
|
|
631
634
|
a function or signal, then send the range to the ViewModel from an effect:
|
|
632
635
|
|
|
@@ -9,8 +9,8 @@ export interface InjectBridgeConnectionOptions extends BridgeConnectionOptions {
|
|
|
9
9
|
readonly injector?: Injector;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Follows the page's connection to its .NET host (`connecting`, `connected`, `reconnecting
|
|
13
|
-
* `lost`) as a signal through `onBridgeConnection`, for the lifetime of the injection context.
|
|
12
|
+
* Follows the page's connection to its .NET host (`connecting`, `connected`, `reconnecting`,
|
|
13
|
+
* `lost` or `closed`) as a signal through `onBridgeConnection`, for the lifetime of the injection context.
|
|
14
14
|
* Destruction unsubscribes. Under server rendering (`PLATFORM_ID` `"server"`) it does not
|
|
15
15
|
* observe and stays `connecting`.
|
|
16
16
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { assertInInjectionContext, DestroyRef, inject, Injector, PLATFORM_ID, signal } from "@angular/core";
|
|
2
2
|
import { onBridgeConnection } from "@runic-artifex/views";
|
|
3
3
|
/**
|
|
4
|
-
* Follows the page's connection to its .NET host (`connecting`, `connected`, `reconnecting
|
|
5
|
-
* `lost`) as a signal through `onBridgeConnection`, for the lifetime of the injection context.
|
|
4
|
+
* Follows the page's connection to its .NET host (`connecting`, `connected`, `reconnecting`,
|
|
5
|
+
* `lost` or `closed`) as a signal through `onBridgeConnection`, for the lifetime of the injection context.
|
|
6
6
|
* Destruction unsubscribes. Under server rendering (`PLATFORM_ID` `"server"`) it does not
|
|
7
7
|
* observe and stays `connecting`.
|
|
8
8
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runic-artifex/angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@angular/core": ">=22.0.0 <23",
|
|
20
20
|
"@angular/forms": ">=22.0.0 <23",
|
|
21
|
-
"@runic-artifex/views": "0.
|
|
21
|
+
"@runic-artifex/views": "0.15.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependenciesMeta": {
|
|
24
24
|
"@angular/forms": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"url": "git+https://github.com/Runic-Artifex/runic-sdk.git",
|
|
33
33
|
"directory": "packages/web/angular"
|
|
34
34
|
},
|
|
35
|
-
"homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
35
|
+
"homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/v0.15.1/packages/web/angular#readme",
|
|
36
36
|
"bugs": {
|
|
37
37
|
"url": "https://github.com/Runic-Artifex/runic-sdk/issues"
|
|
38
38
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"pack:check": "bun pm pack --dry-run"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@runic-artifex/views": "0.
|
|
59
|
+
"@runic-artifex/views": "0.15.1",
|
|
60
60
|
"@angular/common": "22.2.3",
|
|
61
61
|
"@angular/compiler": "22.2.3",
|
|
62
62
|
"@angular/compiler-cli": "22.2.3",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"typescript": "6.0.3",
|
|
70
70
|
"vitest": "5.0.3"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "fce42f47296a4784532fbba0fec9602cd3778fbb"
|
|
73
73
|
}
|