@runic-artifex/svelte 0.18.0 → 0.19.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.
- package/README.md +22 -22
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ the failure. Await it with `{#await}`:
|
|
|
86
86
|
The source is read once: wrap the component in `{#key page}` to follow another
|
|
87
87
|
reference. Do not `{#await page.connect()}` directly: nothing would dispose
|
|
88
88
|
that client. In SvelteKit, connect in a `load` function instead
|
|
89
|
-
([`@runic-artifex/sveltekit`](https://github.com/Runic-Artifex/runic-sdk/blob/v0.
|
|
89
|
+
([`@runic-artifex/sveltekit`](https://github.com/Runic-Artifex/runic-sdk/blob/v0.19.0/packages/web/svelte/../sveltekit/README.md#connecting-in-load)).
|
|
90
90
|
|
|
91
91
|
### Selecting state: `$derived`
|
|
92
92
|
|
|
@@ -182,10 +182,10 @@ handle also has `value` and `text`, which `bind:value={title.value}` reads and s
|
|
|
182
182
|
`errors` holds the member's validation messages from the descriptor (`[]` when valid), `error` why the latest write
|
|
183
183
|
or text failed (a `BridgeError` or a `FieldError`, whose `kind` is `rejected`, `conflict`, `committed-with-error` or
|
|
184
184
|
`invalid-text`). `FieldError`, `FieldOptions`, `FieldState` and `BridgeField` are exported from this package. See the
|
|
185
|
-
[field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
185
|
+
[field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#fields) for the receipts
|
|
186
186
|
and text forms. An `invalid-text` error has a `reason` and `arguments`: render `useText(() => name.error).current` after
|
|
187
187
|
`configureFieldErrorText` to show your own text for it in the window's language
|
|
188
|
-
([Translating field errors](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
188
|
+
([Translating field errors](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#translating-field-errors)).
|
|
189
189
|
|
|
190
190
|
#### Row cells and nested members
|
|
191
191
|
|
|
@@ -194,7 +194,7 @@ Since 0.16, `InvoiceFields.address.street` and `InvoiceFields.lines.at(line.id).
|
|
|
194
194
|
`useField(() => view, InvoiceFields.lines.at(line.id).quantity)` in the row's component and `{@attach quantity.attach}`
|
|
195
195
|
its input; `at(key)` returns the same descriptor for the same key. Such a field always writes checked, conflicts only
|
|
196
196
|
when another writer changed the same cell, and shows the messages .NET reports at the cell's validation path. See
|
|
197
|
-
[Fields below a member and row cells](https://github.com/Runic-Artifex/runic-sdk/blob/v0.
|
|
197
|
+
[Fields below a member and row cells](https://github.com/Runic-Artifex/runic-sdk/blob/v0.19.0/packages/web/svelte/../views/README.md#fields-below-a-member-and-row-cells).
|
|
198
198
|
|
|
199
199
|
### Forms: `useForm(() => fields, options?)`
|
|
200
200
|
|
|
@@ -210,7 +210,7 @@ const form = useForm(() => ({ title, step }), { dirty: () => editor.state?.isDir
|
|
|
210
210
|
|
|
211
211
|
Call during component initialization to bind a text input to a member through the
|
|
212
212
|
framework-neutral
|
|
213
|
-
[text field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
213
|
+
[text field controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#text-inputs):
|
|
214
214
|
|
|
215
215
|
```svelte
|
|
216
216
|
<script lang="ts">
|
|
@@ -270,7 +270,7 @@ the reference as its `page` prop:
|
|
|
270
270
|
The outlet is generic over the reference union, so the registry must have a
|
|
271
271
|
component for every kind with a matching `page` prop. A component whose `page`
|
|
272
272
|
is a shared page reference, such as `ResultPagePageReference` of a .NET
|
|
273
|
-
[`[RunicSharedClient]`](https://github.com/Runic-Artifex/runic-sdk/blob/v0.
|
|
273
|
+
[`[RunicSharedClient]`](https://github.com/Runic-Artifex/runic-sdk/blob/v0.19.0/packages/web/svelte/../../dotnet/Runic.Application.Views/README.md#shared-clients)
|
|
274
274
|
interface, registers for each of its kinds:
|
|
275
275
|
`{ ...registryEntries(resultPageKinds, ResultPage), settings: Settings }`. A different reference
|
|
276
276
|
remounts the component, and the optional `fallback` snippet renders while
|
|
@@ -420,7 +420,7 @@ Cancel and other callbacks responsive during observation.
|
|
|
420
420
|
## `useLatestOperation()`
|
|
421
421
|
|
|
422
422
|
For rapid read selection, `useLatestOperation()` wraps the framework-neutral
|
|
423
|
-
[latest-operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
423
|
+
[latest-operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#operation-feedback-and-latest-selection)
|
|
424
424
|
for the component's lifetime. It coalesces the latest intent across delayed receipts
|
|
425
425
|
and orders the next admission after terminal observation and any application drain
|
|
426
426
|
barrier:
|
|
@@ -451,7 +451,7 @@ establish that replacement boundary and own the old work's drain. Lost terminal
|
|
|
451
451
|
observation blocks further Starts instead of retrying blindly, with its reason in
|
|
452
452
|
`error`; ordinary Cancel does not clear this block. Component destruction settles
|
|
453
453
|
observation without cancelling accepted work. The
|
|
454
|
-
[operations package consumer](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
454
|
+
[operations package consumer](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/tests/fixtures/application/operations-consumer)
|
|
455
455
|
runs this hook against the packed packages and the desktop transport.
|
|
456
456
|
|
|
457
457
|
## `useBridgeConnection(options?)`
|
|
@@ -461,7 +461,7 @@ from `@runic-artifex/views` (re-exported here since 0.11, with the
|
|
|
461
461
|
`BridgeConnectionState` and `BridgeConnectionOptions` types) and returns `{ state }`, a reactive
|
|
462
462
|
`BridgeConnectionState`: `connecting`, `connected`, `reconnecting`, `lost` or `closed` (the
|
|
463
463
|
application closed the window, since 0.15; a closed set, see
|
|
464
|
-
[Connection state](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
464
|
+
[Connection state](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#connection-state)):
|
|
465
465
|
|
|
466
466
|
```svelte
|
|
467
467
|
<script lang="ts">
|
|
@@ -483,7 +483,7 @@ server render does not observe, and destroying the owner unsubscribes. An invali
|
|
|
483
483
|
Follows the declared menu bar of a Runic Desktop window that leaves it to the
|
|
484
484
|
page (`DesktopMenuBarPresentation.Page`) while its owner lives. It wraps
|
|
485
485
|
`createMenuBarController` from `@runic-artifex/views` (see
|
|
486
|
-
[In-page menu bar](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
486
|
+
[In-page menu bar](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#in-page-menu-bar)) and returns `{ state, invoke, handleKeyDown }`, where `state` is a
|
|
487
487
|
reactive `MenuBarState` property. The bar is rendered by the menubar component
|
|
488
488
|
of the application's own UI library. Runic ships no menubar component.
|
|
489
489
|
|
|
@@ -512,7 +512,7 @@ the `shortcuts: "app"` lease.
|
|
|
512
512
|
### With Bits UI
|
|
513
513
|
|
|
514
514
|
Bits UI's `Menubar.Root bind:value`; the
|
|
515
|
-
[Notes example](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
515
|
+
[Notes example](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/examples/notes-view-first#in-page-menu-bar) adds submenus, check and radio
|
|
516
516
|
items and is tested with real keys:
|
|
517
517
|
|
|
518
518
|
```svelte
|
|
@@ -568,7 +568,7 @@ Shows a text reference that a ViewModel produced, such as a status line or a
|
|
|
568
568
|
validation error's `text`, in the window's language, and renders again when the
|
|
569
569
|
language changes. A string shows as it is; `null` and `undefined` show
|
|
570
570
|
`fallback`. Connect the page's Translations runtime once with
|
|
571
|
-
`configureTranslatedText` ([Translated text](https://github.com/Runic-Artifex/runic-sdk/blob/v0.
|
|
571
|
+
`configureTranslatedText` ([Translated text](https://github.com/Runic-Artifex/runic-sdk/blob/v0.19.0/packages/dotnet/Runic.Application.Views/README.md#translated-text)).
|
|
572
572
|
`useWindowLocale()` reads the window's locale.
|
|
573
573
|
|
|
574
574
|
`useTextLocale().current` is the locale that text is shown in, as a reactive
|
|
@@ -599,7 +599,7 @@ const status = useText(() => view.state?.status);
|
|
|
599
599
|
Follows the page's appearance while its owner lives, as the reactive property
|
|
600
600
|
`current`: the colour scheme, contrast and reduced motion of the page's engine,
|
|
601
601
|
combined with the desktop's text scale, accent colour, forced-colours palette,
|
|
602
|
-
contrast and motion that a Runic host pushes ([Appearance](https://github.com/Runic-Artifex/runic-sdk/blob/v0.
|
|
602
|
+
contrast and motion that a Runic host pushes ([Appearance](https://github.com/Runic-Artifex/runic-sdk/blob/v0.19.0/packages/web/views/README.md#appearance)).
|
|
603
603
|
Every member is `null` under server rendering, so a SvelteKit page renders the
|
|
604
604
|
same on the server and in the browser until the browser's first effect.
|
|
605
605
|
|
|
@@ -628,7 +628,7 @@ const message = $derived(describeBridgeError(view.error));
|
|
|
628
628
|
```
|
|
629
629
|
|
|
630
630
|
`instanceof` holds for errors from every copy of the package on the page.
|
|
631
|
-
[Errors and diagnostics](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
631
|
+
[Errors and diagnostics](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#errors-and-diagnostics)
|
|
632
632
|
lists the kinds. Any other value, such as an exception that your own connect
|
|
633
633
|
function or command callback throws, arrives unchanged.
|
|
634
634
|
|
|
@@ -667,10 +667,10 @@ application's own dialog.
|
|
|
667
667
|
departure before that is answered by the ViewModel's .NET fallback handler, or
|
|
668
668
|
fails closed without one.
|
|
669
669
|
|
|
670
|
-
The [ReactiveUI leave confirmation](https://github.com/Runic-Artifex/runic-sdk/blob/v0.
|
|
670
|
+
The [ReactiveUI leave confirmation](https://github.com/Runic-Artifex/runic-sdk/blob/v0.19.0/packages/dotnet/Runic.Application.Views.ReactiveUI/README.md#leave-confirmation-in-a-web-view)
|
|
671
671
|
has the .NET side and which View answers which departure. In a frontend test,
|
|
672
672
|
the generated mock's `interactions.<name>.request(input)` resolves with the
|
|
673
|
-
registered handler's answer; see the [Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
673
|
+
registered handler's answer; see the [Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#testing).
|
|
674
674
|
|
|
675
675
|
## View requests
|
|
676
676
|
|
|
@@ -702,14 +702,14 @@ the page painted the state the request was raised with, so the field of that
|
|
|
702
702
|
state is rendered; `signal` aborts when the handler is replaced or removed, the
|
|
703
703
|
client is disposed or the connection is lost. A request is never replayed: one
|
|
704
704
|
raised before the effect ran, or while the page is disconnected, is not
|
|
705
|
-
delivered later. See [View requests](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
705
|
+
delivered later. See [View requests](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#view-requests) for the rules, and in a frontend
|
|
706
706
|
test raise one with the generated mock's `requests.<name>.raise(input)` (the
|
|
707
|
-
[Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
707
|
+
[Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#testing)).
|
|
708
708
|
|
|
709
709
|
## `useCollectionViewport(options)`
|
|
710
710
|
|
|
711
711
|
Follows a fixed-row-height scroll container and returns `{ viewport, attach }`.
|
|
712
|
-
`viewport` is the reactive [`collectionViewport`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
712
|
+
`viewport` is the reactive [`collectionViewport`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#collectionviewportoptions)
|
|
713
713
|
range; `attach` is an attachment for the container. Call it during component
|
|
714
714
|
initialization and send the range to the ViewModel from an effect:
|
|
715
715
|
|
|
@@ -734,7 +734,7 @@ Import them from there instead of `@runic-artifex/svelte`.
|
|
|
734
734
|
|
|
735
735
|
## `useQueryCollection(collection, options)`
|
|
736
736
|
|
|
737
|
-
Follows a scroll container for a [query collection](https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
737
|
+
Follows a scroll container for a [query collection](https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/views#query-collections) (`client.queries.{name}`), whose rows stay in .NET: it
|
|
738
738
|
loads the rows the container shows, with placeholders until they arrive, and lays them out with variable heights. Pass
|
|
739
739
|
getters of the collection and the options. `viewport` is the `QueryViewport` (`items` with `top` and `size`,
|
|
740
740
|
`totalSize`, `total`, `query`, `loading`, `error`); attach `attach` to the container and `measure(index)` to each row.
|
|
@@ -760,13 +760,13 @@ The package re-exports `installBackNavigation`, `installNavigationPath`,
|
|
|
760
760
|
`@runic-artifex/views` (since 0.16). Call the installs once where the page
|
|
761
761
|
starts, before or after mounting: the mouse's Back button and Alt+Left then go
|
|
762
762
|
back in the .NET window, and `#/customers/42` follows its path region. See
|
|
763
|
-
[Back and the URL](https://github.com/Runic-Artifex/runic-sdk/blob/v0.
|
|
763
|
+
[Back and the URL](https://github.com/Runic-Artifex/runic-sdk/blob/v0.19.0/packages/web/views/README.md#back-and-the-url).
|
|
764
764
|
|
|
765
765
|
## Hosted regions (experimental)
|
|
766
766
|
|
|
767
767
|
`RunicHostedRegion` from `@runic-artifex/svelte/experimental` renders
|
|
768
768
|
`<runic-hosted-region>`, a region where the host application shows a hosted guest's
|
|
769
|
-
Window ([hosted regions](https://github.com/Runic-Artifex/runic-sdk/blob/v0.
|
|
769
|
+
Window ([hosted regions](https://github.com/Runic-Artifex/runic-sdk/blob/v0.19.0/packages/web/svelte/../views/README.md#hosted-regions-experimental)). Its `fallback` snippet takes the region's state and
|
|
770
770
|
shows while no guest page shows in it:
|
|
771
771
|
|
|
772
772
|
```svelte
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runic-artifex/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Svelte 5 Application Views helpers for Runic",
|
|
5
|
-
"homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/v0.
|
|
5
|
+
"homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/v0.19.0/packages/web/svelte#readme",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/Runic-Artifex/runic-sdk/issues"
|
|
8
8
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"svelte": ">=5.57.1 <6",
|
|
49
|
-
"@runic-artifex/views": "0.
|
|
49
|
+
"@runic-artifex/views": "0.19.0"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"packageManager": "bun@1.4.4",
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@runic-artifex/views": "0.
|
|
62
|
+
"@runic-artifex/views": "0.19.0",
|
|
63
63
|
"@sveltejs/adapter-static": "4.0.0",
|
|
64
64
|
"@sveltejs/kit": "3.0.0",
|
|
65
65
|
"@sveltejs/package": "3.0.0",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"vitest": "5.0.3",
|
|
74
74
|
"vite": "8.3.4"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "9a09c23055f09f7505552d236c8acf69bdeeb02e"
|
|
77
77
|
}
|