@runic-artifex/vue 0.8.0-preview.5 → 0.9.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 CHANGED
@@ -11,7 +11,7 @@ bun add @runic-artifex/vue@preview @runic-artifex/views@preview
11
11
  ```
12
12
 
13
13
  Previews are published under the `preview` dist-tag. Install the versions that
14
- match your Runic SDK packages. Vue 3.5 or later is supported.
14
+ match your Runic SDK packages. Vue 3.5.30 or a later 3.x release is supported.
15
15
 
16
16
  ```vue
17
17
  <script setup lang="ts">
@@ -20,18 +20,23 @@ import type { CounterPageReference } from "./generated/counter.js";
20
20
 
21
21
  const props = defineProps<{ page: CounterPageReference }>();
22
22
  const { state, client, error } = useView(() => props.page);
23
- const increment = useCommand(() => client.value?.increment());
23
+ const { run: increment, pending, error: incrementError } = useCommand(() => client.value?.increment());
24
24
  </script>
25
25
 
26
26
  <template>
27
- <button :disabled="!client || increment.pending" @click="increment.run()">{{ state?.count ?? "…" }}</button>
28
- <p v-if="(increment.error ?? error) !== undefined" role="alert">{{ String(increment.error ?? error) }}</p>
27
+ <button :disabled="!client || pending" @click="increment()">{{ state?.count ?? "…" }}</button>
28
+ <p v-if="(incrementError ?? error) !== undefined" role="alert">{{ String(incrementError ?? error) }}</p>
29
29
  </template>
30
30
  ```
31
31
 
32
- ## `useView(source)`
32
+ Every composable returns its state as shallow refs, so a handle can be
33
+ destructured in `<script setup>` and its refs unwrap in the template.
33
34
 
34
- Returns shallow refs `{ state, client, error, pending }` and `retry()`:
35
+ ## `useView(source, options?)`
36
+
37
+ Returns shallow refs `{ state, client, error, pending }` and `retry()`.
38
+ `options.release(client)` replaces `client.dispose()` for a client the composable
39
+ connected:
35
40
 
36
41
  - A generated page reference, or `{ connect: connect<Name> }` for a root
37
42
  ViewModel, is connected while the current effect scope (normally the
@@ -43,6 +48,13 @@ Returns shallow refs `{ state, client, error, pending }` and `retry()`:
43
48
  - `pending` is true while a reference connects. `error` holds a failed
44
49
  connection; `retry()` connects again.
45
50
 
51
+ All four composables release their controller when the current effect scope is
52
+ disposed. Call them in a component's `setup()` (or `<script setup>`) or inside
53
+ `effectScope().run()`, and stop that scope to release them. Called outside an
54
+ effect scope, for example from a plain module or an event handler, nothing ever
55
+ releases them: `useView` keeps its client connected. Development builds warn
56
+ in the console when that happens.
57
+
46
58
  ### Read-only state and `v-model`
47
59
 
48
60
  As in any MVVM View, the ViewModel's C# setters decide what the page may set.
@@ -60,8 +72,8 @@ import type { CounterPageReference } from "./generated/counter.js";
60
72
 
61
73
  const props = defineProps<{ page: CounterPageReference }>();
62
74
  const { state, client } = useView(() => props.page);
63
- const setStep = useCommand((value: number) => client.value?.setStep(value));
64
- const step = computed({ get: () => state.value?.step ?? 1, set: value => void setStep.run(value) });
75
+ const { run: setStep } = useCommand((value: number) => client.value?.setStep(value));
76
+ const step = computed({ get: () => state.value?.step ?? 1, set: value => void setStep(value) });
65
77
  </script>
66
78
 
67
79
  <template>
@@ -101,15 +113,15 @@ prop accepts that reference.
101
113
 
102
114
  ## `useCommand(command)`
103
115
 
104
- Returns a reactive `{ run, pending, error, failure, reset }`. Read `increment.pending`,
105
- `increment.error` and `increment.failure` from the object rather than destructuring them.
116
+ Returns `{ run, pending, error, failure, reset }`, with `pending`, `error` and
117
+ `failure` as shallow refs.
106
118
  `run(...args)` resolves to the command's result, or to `undefined` after a
107
119
  failure, which `error` then holds until the next run. It never rejects, so
108
120
  handlers need no `try`/`catch`. One command can serve several buttons:
109
121
 
110
122
  ```ts
111
- const navigate = useCommand((name: "showWelcome" | "showCounter") => client.value?.[name]());
112
- // <button @click="navigate.run('showWelcome')">Welcome</button>
123
+ const { run: navigate } = useCommand((name: "showWelcome" | "showCounter") => client.value?.[name]());
124
+ // <button @click="navigate('showWelcome')">Welcome</button>
113
125
  ```
114
126
 
115
127
  For a command that declares a failure (`[RunicFailure]` in .NET), `run` resolves the
@@ -121,19 +133,20 @@ neither.
121
133
  ## `useOperation(start, options?)`
122
134
 
123
135
  Observes a generated `start<Command>()` operation through the framework-neutral
124
- [operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.8.0-preview.5/packages/web/views#operation-feedback-and-latest-selection)
125
- and returns a reactive object; read its state from the object rather than destructuring it:
136
+ [operation controller](https://github.com/Runic-Artifex/runic-sdk/tree/v0.9.0/packages/web/views#operation-feedback-and-latest-selection)
137
+ and returns each state field as a shallow ref, with `run`, `cancel` and `reset`:
126
138
 
127
139
  ```vue
128
140
  <script setup lang="ts">
129
- const push = useOperation((remote: string) => client.value?.startPush(remote));
141
+ const { run: push, cancel, pending, cancellationRequested, cancelled, error } =
142
+ useOperation((remote: string) => client.value?.startPush(remote));
130
143
  </script>
131
144
 
132
145
  <template>
133
- <button :disabled="!client || push.pending" @click="push.run('origin')">Push</button>
134
- <button v-if="push.pending" :disabled="push.cancellationRequested" @click="push.cancel()">Cancel</button>
135
- <p v-if="push.cancelled" role="status">Push cancelled.</p>
136
- <p v-if="push.error !== undefined" role="alert">{{ String(push.error) }}</p>
146
+ <button :disabled="!client || pending" @click="push('origin')">Push</button>
147
+ <button v-if="pending" :disabled="cancellationRequested" @click="cancel()">Cancel</button>
148
+ <p v-if="cancelled" role="status">Push cancelled.</p>
149
+ <p v-if="error !== undefined" role="alert">{{ String(error) }}</p>
137
150
  </template>
138
151
  ```
139
152
 
@@ -141,15 +154,86 @@ The result has `pending`, `admitting`, `operation`, `status`, `outcome`, `failur
141
154
  `error`, `cancelled`, `cancellationRequested`, `cancelling`, `cancellation` and
142
155
  `cancelError`, with `run(...args)`, `cancel()` and `reset()`, which never reject. A
143
156
  run that ends with a `cancelled` status sets `cancelled` and resolves to `undefined`
144
- without an `error`; `failed` and `timedOut` statuses are still `error`. `pending`
157
+ without an `error`; `failed` and `timed-out` statuses are still `error`. `pending`
145
158
  stays true after a Cancel response until the operation reaches its terminal status.
146
159
  Disposing the effect scope settles run promises without cancelling accepted work.
147
160
 
148
- ## `useCollectionViewport(options)`
161
+ ## Errors
162
+
163
+ The `error` of `useView` and of a command or operation handle is typed
164
+ `unknown`: it holds whatever the connection or the call rejected with. A Bridge
165
+ failure is a `BridgeError` from `@runic-artifex/views`; narrow it with
166
+ `instanceof` before reading `kind`, `route` or `detail`:
167
+
168
+ ```ts
169
+ import { BridgeError } from "@runic-artifex/views";
170
+
171
+ const offline = error.value instanceof BridgeError && error.value.kind === "disconnected";
172
+ ```
173
+
174
+ `instanceof` holds for errors from every copy of the package on the page.
175
+ [Errors and diagnostics](https://github.com/Runic-Artifex/runic-sdk/tree/v0.9.0/packages/web/views#errors-and-diagnostics)
176
+ lists the kinds. Any other value, such as an exception that your own connect
177
+ function or command callback throws, arrives unchanged.
178
+
179
+ The composables run in the browser or webview that a Runic host serves.
180
+ `useView` connects during `setup()`, which also runs in a server render: render
181
+ the components that use it on the client only.
182
+
183
+ ## Interactions
184
+
185
+ A ReactiveUI `Interaction<TInput, TOutput>` on the ViewModel, such as the
186
+ question of a `ReactiveLeaveConfirmation.WithInteraction` leave guard, is
187
+ `client.interactions.<name>` on the generated client. Register the page's answer
188
+ in `watchEffect`: `handle((prompt, { signal }) => …)` returns the function that
189
+ removes it, so pass that to `onCleanup`, and Vue removes the handler when the
190
+ client changes or the component unmounts:
191
+
192
+ ```vue
193
+ <script setup lang="ts">
194
+ import { watchEffect } from "vue";
195
+ import { useView } from "@runic-artifex/vue";
196
+ import type { EditPageReference } from "./generated/edit.js";
197
+
198
+ const props = defineProps<{ page: EditPageReference }>();
199
+ const { client } = useView(() => props.page);
200
+ watchEffect(onCleanup => {
201
+ const remove = client.value?.interactions.confirmDiscard.handle(
202
+ async (prompt, { signal }) => confirmDialog(`Discard the changes to ${prompt.itemName}?`, signal),
203
+ );
204
+ if (remove) onCleanup(remove);
205
+ });
206
+ </script>
207
+ ```
208
+
209
+ `prompt` and the answer are typed from the ViewModel's interaction. The handler
210
+ may return the answer or a promise of it; `confirmDialog` stands for the
211
+ application's own dialog.
212
+
213
+ - The page is asked for a departure that its own window starts: its Close, the
214
+ shell's Back in the same window, or a guarded window close.
215
+ - `signal` aborts when .NET no longer needs the answer, for example when the
216
+ departure is superseded or the window closes. Close the dialog then; a late
217
+ answer is ignored.
218
+ - The handler exists only after the client connected and the effect ran. A
219
+ departure before that is answered by the ViewModel's .NET fallback handler, or
220
+ fails closed without one.
221
+
222
+ The [ReactiveUI leave confirmation](https://github.com/Runic-Artifex/runic-sdk/blob/v0.9.0/packages/dotnet/Runic.Application.Views.ReactiveUI/README.md#leave-confirmation-in-a-web-view)
223
+ has the .NET side and which View answers which departure. In a frontend test,
224
+ the generated mock's `interactions.<name>.request(input)` resolves with the
225
+ registered handler's answer; see the [Testing guide](https://github.com/Runic-Artifex/runic-sdk/tree/v0.9.0/packages/web/views#testing).
226
+
227
+ ## `useCollectionViewport(options)` (experimental)
228
+
229
+ Exported from `@runic-artifex/vue/experimental`, like the
230
+ `@runic-artifex/views/experimental` controller it wraps.
149
231
 
150
232
  Follows a fixed-row-height scroll container and returns `{ viewport, attach }`.
151
- `viewport` is a shallow ref with the [`collectionViewport`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.8.0-preview.5/packages/web/views#collectionviewportoptions)
152
- range; `attach` is a function ref for the container. Pass a getter for the
233
+ `viewport` is a shallow ref with the [`collectionViewport`](https://github.com/Runic-Artifex/runic-sdk/tree/v0.9.0/packages/web/views#collectionviewportoptions-experimental)
234
+ range; `attach` is a function ref for the container. Bind it to a native element
235
+ such as a `<div>`: a component instance (`:ref="attach"` on a component) or a
236
+ non-HTML element detaches the viewport, and development builds warn. Pass a getter for the
153
237
  options and watch the range to send it to the ViewModel:
154
238
 
155
239
  ```vue
@@ -0,0 +1 @@
1
+ export { useCollectionViewport, type CollectionViewportHandle } from "./viewport.js";
@@ -0,0 +1,3 @@
1
+ // `@runic-artifex/vue/experimental`: composables whose shape may still change in a minor release
2
+ // (docs/experimental.md). Graduation moves an export to `@runic-artifex/vue`.
3
+ export { useCollectionViewport } from "./viewport.js";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { type Component, type ComponentPublicInstance, type MaybeRefOrGetter, type Ref } from "vue";
2
- import { type BridgeOperation, type BridgeOutcomeFailure, type OperationController, type OperationControllerOptions, type OperationState, type CollectionViewport, type CollectionViewportOptions, type ViewClient, type ViewReference, type ViewSource } from "@runic-artifex/views";
3
- export type { CollectionViewport, CollectionViewportOptions, ViewClient, ViewConnector, ViewReference, ViewSource } from "@runic-artifex/views";
1
+ import { type Component, type MaybeRefOrGetter, type Ref } from "vue";
2
+ import { type BridgeOperation, type BridgeOutcomeFailure, type OperationController, type OperationControllerOptions, type OperationState, type PageReference, type ViewClient, type ViewSource } from "@runic-artifex/views";
4
3
  export interface ViewHandle<TClient extends ViewClient> {
5
4
  /** The latest state, or undefined until the client connects. */
6
5
  readonly state: Readonly<Ref<TClient["snapshot"] | undefined>>;
@@ -17,25 +16,30 @@ export interface ViewHandle<TClient extends ViewClient> {
17
16
  * Connects a generated View reference while the current effect scope (for
18
17
  * example a component) is active and exposes its state as shallow refs. A
19
18
  * changed reference disposes the previous client; disposing the scope
20
- * disposes the current one.
19
+ * disposes the current one. Call it in `setup()` or `effectScope().run()`:
20
+ * outside an effect scope the client is never released (development builds warn).
21
21
  *
22
22
  * Pass a getter such as `() => props.page` to follow a prop. A reference is
23
23
  * identified by its `connect` function, so a getter returning a new
24
24
  * `{ connect: connectWorkspace }` object does not reconnect.
25
25
  */
26
- export declare function useView<TClient extends ViewClient>(source: MaybeRefOrGetter<ViewSource<TClient>>): ViewHandle<TClient>;
26
+ export interface UseViewOptions<TClient extends ViewClient> {
27
+ /** Releases a client this composable connected. Defaults to `client.dispose()`. */
28
+ readonly release?: (client: TClient) => void;
29
+ }
30
+ export declare function useView<TClient extends ViewClient>(source: MaybeRefOrGetter<ViewSource<TClient>>, options?: UseViewOptions<TClient>): ViewHandle<TClient>;
27
31
  /**
28
32
  * A build-known map checks each generated reference kind against its component's `page` prop. A nullable
29
33
  * reference, such as a region slot's `State["main"]`, checks its non-null kinds.
30
34
  */
31
- export type ViewRegistry<R extends ViewReference | null | undefined> = {
35
+ export type ViewRegistry<R extends PageReference | null | undefined> = {
32
36
  readonly [K in NonNullable<R>["kind"]]: Component<{
33
37
  page: Extract<NonNullable<R>, {
34
38
  readonly kind: K;
35
39
  }>;
36
40
  }>;
37
41
  };
38
- export interface ViewOutletProps<R extends ViewReference> {
42
+ export interface ViewOutletProps<R extends PageReference> {
39
43
  /** The presented reference, such as `state.main`. */
40
44
  content: R | null | undefined;
41
45
  registry: ViewRegistry<R>;
@@ -46,14 +50,14 @@ export interface ViewOutletProps<R extends ViewReference> {
46
50
  * component. A kind without a component renders an alert; the default slot
47
51
  * renders while there is no content.
48
52
  */
49
- export declare const ViewOutlet: new <R extends ViewReference>(props: (ViewOutletProps<R> & ({
50
- [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
51
- } | {
53
+ export declare const ViewOutlet: new <R extends PageReference>(props: (ViewOutletProps<R> & ({
52
54
  [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
53
- })) & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps) => import("vue").CreateComponentPublicInstanceWithMixins<ViewOutletProps<R> & ({
54
- [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
55
55
  } | {
56
+ [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
57
+ })) & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps) => import("vue").CreateComponentPublicInstanceWithMixins<ViewOutletProps<R> & ({
56
58
  [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
59
+ } | {
60
+ [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
57
61
  }), {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, import("vue").PublicProps, {}, false, {}, {}, {}, {}, string, {}, any, import("vue").ComponentProvideOptions, {
58
62
  P: {};
59
63
  B: {};
@@ -62,9 +66,9 @@ export declare const ViewOutlet: new <R extends ViewReference>(props: (ViewOutle
62
66
  M: {};
63
67
  Defaults: {};
64
68
  }, (ViewOutletProps<R> & {
65
- [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
66
- }) | (ViewOutletProps<R> & {
67
69
  [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
70
+ }) | (ViewOutletProps<R> & {
71
+ [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
68
72
  }), {}, {}, {}, {}, {}>;
69
73
  export interface CommandHandle<TArgs extends readonly unknown[], TResult, TFailure = BridgeOutcomeFailure<TResult>> {
70
74
  /**
@@ -74,53 +78,44 @@ export interface CommandHandle<TArgs extends readonly unknown[], TResult, TFailu
74
78
  */
75
79
  run(...args: TArgs): Promise<TResult | undefined>;
76
80
  /** True while a run is in flight. */
77
- readonly pending: boolean;
81
+ readonly pending: Readonly<Ref<boolean>>;
78
82
  /** Why the latest run failed unexpectedly, until the next run starts. */
79
- readonly error: unknown;
83
+ readonly error: Readonly<Ref<unknown>>;
80
84
  /**
81
85
  * The declared failure of the latest run, for a command that resolves a
82
86
  * `BridgeOutcome`, until the next run starts. A superseded run sets neither.
83
87
  */
84
- readonly failure: TFailure | undefined;
88
+ readonly failure: Readonly<Ref<TFailure | undefined>>;
85
89
  /** Clears `error` and `failure`. */
86
90
  reset(): void;
87
91
  }
88
92
  /**
89
- * Tracks a command's pending state and failure. The result is a reactive
90
- * object, so templates read `increment.pending` directly; do not destructure
91
- * `pending`, `error` or `failure`.
93
+ * Tracks a command's pending state and failure as shallow refs, like `useView`,
94
+ * so the handle can be destructured. Call it in `setup()` or `effectScope().run()`
95
+ * (development builds warn otherwise).
92
96
  *
93
97
  * ```vue
94
- * const increment = useCommand(() => client.value?.increment());
95
- * <button :disabled="!client || increment.pending" @click="increment.run()">…</button>
98
+ * const { run: increment, pending } = useCommand(() => client.value?.increment());
99
+ * <button :disabled="!client || pending" @click="increment()">…</button>
96
100
  * ```
97
101
  */
98
102
  export declare function useCommand<TArgs extends readonly unknown[], TReturn>(command: (...args: TArgs) => TReturn): CommandHandle<TArgs, Awaited<TReturn>>;
99
- export interface OperationHandle<TArgs extends readonly unknown[], TResult, TFailure = never> extends OperationState<TResult, TFailure>, Pick<OperationController<TArgs, TResult, TFailure>, "run" | "cancel" | "reset"> {
100
- }
103
+ /** Each {@link OperationState} field as a shallow ref, with the controller's `run`, `cancel` and `reset`. */
104
+ export type OperationHandle<TArgs extends readonly unknown[], TResult, TFailure = never> = {
105
+ readonly [K in keyof OperationState<TResult, TFailure>]-?: Readonly<Ref<OperationState<TResult, TFailure>[K]>>;
106
+ } & Pick<OperationController<TArgs, TResult, TFailure>, "run" | "cancel" | "reset">;
101
107
  /**
102
108
  * Tracks Start admission, pending work, cancellation and terminal feedback of a
103
- * generated `start<Command>()` operation. The result is a reactive object; do not
104
- * destructure its state. A run that ends `cancelled` sets `cancelled`, not `error`.
105
- * Scope disposal settles run promises without cancelling accepted work.
109
+ * generated `start<Command>()` operation, each state field a shallow ref, so the
110
+ * handle can be destructured. A run that ends `cancelled` sets `cancelled`, not `error`.
111
+ * Scope disposal settles run promises without cancelling accepted work. Call it in
112
+ * `setup()` or `effectScope().run()`: outside an effect scope it is never released
113
+ * (development builds warn).
106
114
  *
107
115
  * ```vue
108
- * const push = useOperation((remote: string) => client.value?.startPush(remote));
109
- * <button :disabled="push.pending" @click="push.run('origin')">Push</button>
110
- * <p v-if="push.cancelled" role="status">Push cancelled.</p>
116
+ * const { run: push, pending, cancelled } = useOperation((remote: string) => client.value?.startPush(remote));
117
+ * <button :disabled="pending" @click="push('origin')">Push</button>
118
+ * <p v-if="cancelled" role="status">Push cancelled.</p>
111
119
  * ```
112
120
  */
113
121
  export declare function useOperation<TArgs extends readonly unknown[], TResult, TFailure = never>(start: (...args: TArgs) => BridgeOperation<TResult, TFailure> | undefined | PromiseLike<BridgeOperation<TResult, TFailure> | undefined>, options?: OperationControllerOptions<TResult, TFailure>): OperationHandle<TArgs, TResult, TFailure>;
114
- export interface CollectionViewportHandle {
115
- /** The rows to request and the sizes to render. */
116
- readonly viewport: Readonly<Ref<CollectionViewport>>;
117
- /** A function ref for the scroll container: `<div :ref="attach">`. */
118
- attach(element: Element | ComponentPublicInstance | null): void;
119
- }
120
- /**
121
- * Follows a fixed-row-height scroll container and returns the rows to request
122
- * from .NET. Pass a getter such as `() => ({ totalCount: state.value?.totalCount ?? 0, rowHeight: 32 })`
123
- * and watch `viewport` to send `start` and `size` to the ViewModel.
124
- */
125
- export declare function useCollectionViewport(options: MaybeRefOrGetter<CollectionViewportOptions>): CollectionViewportHandle;
126
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,17 +1,9 @@
1
- import { defineComponent, getCurrentScope, h, onScopeDispose, shallowReactive, shallowRef, toValue, watch, } from "vue";
2
- import { createCollectionViewportController, createCommandController, createOperationController, createViewController, viewSourceIdentity, } from "@runic-artifex/views";
3
- /**
4
- * Connects a generated View reference while the current effect scope (for
5
- * example a component) is active and exposes its state as shallow refs. A
6
- * changed reference disposes the previous client; disposing the scope
7
- * disposes the current one.
8
- *
9
- * Pass a getter such as `() => props.page` to follow a prop. A reference is
10
- * identified by its `connect` function, so a getter returning a new
11
- * `{ connect: connectWorkspace }` object does not reconnect.
12
- */
13
- export function useView(source) {
14
- const controller = createViewController();
1
+ import { defineComponent, h, shallowRef, toValue, watch, } from "vue";
2
+ import { createCommandController, createOperationController, createViewController, } from "@runic-artifex/views";
3
+ import { viewSourceIdentity } from "@runic-artifex/views/bindings";
4
+ import { releaseWithScope } from "./scope.js";
5
+ export function useView(source, options = {}) {
6
+ const controller = createViewController(options.release ? { release: options.release } : {});
15
7
  const state = shallowRef();
16
8
  const client = shallowRef();
17
9
  const error = shallowRef();
@@ -28,8 +20,7 @@ export function useView(source) {
28
20
  controller.setSource(toValue(source));
29
21
  sync();
30
22
  }, { immediate: true });
31
- if (getCurrentScope())
32
- onScopeDispose(() => controller.dispose());
23
+ releaseWithScope("useView", () => controller.dispose());
33
24
  return { state, client, error, pending, retry: () => controller.retry() };
34
25
  }
35
26
  const referenceKeys = new WeakMap();
@@ -56,74 +47,54 @@ export const ViewOutlet = defineComponent((props, { slots }) => () => {
56
47
  return h(component, { key: referenceKey(content), page: content });
57
48
  }, { name: "ViewOutlet", props: ["content", "registry"] });
58
49
  /**
59
- * Tracks a command's pending state and failure. The result is a reactive
60
- * object, so templates read `increment.pending` directly; do not destructure
61
- * `pending`, `error` or `failure`.
50
+ * Tracks a command's pending state and failure as shallow refs, like `useView`,
51
+ * so the handle can be destructured. Call it in `setup()` or `effectScope().run()`
52
+ * (development builds warn otherwise).
62
53
  *
63
54
  * ```vue
64
- * const increment = useCommand(() => client.value?.increment());
65
- * <button :disabled="!client || increment.pending" @click="increment.run()">…</button>
55
+ * const { run: increment, pending } = useCommand(() => client.value?.increment());
56
+ * <button :disabled="!client || pending" @click="increment()">…</button>
66
57
  * ```
67
58
  */
68
59
  export function useCommand(command) {
69
60
  const controller = createCommandController(command);
70
- const handle = shallowReactive({
71
- run: controller.run, pending: false, error: undefined, failure: undefined, reset: controller.reset,
72
- });
61
+ const pending = shallowRef(controller.current.pending);
62
+ const error = shallowRef(controller.current.error);
63
+ // A conditional failure type does not distribute through shallowRef's overloads.
64
+ const failure = shallowRef(controller.current.failure);
73
65
  controller.subscribe(() => {
74
- const writable = handle;
75
- writable.pending = controller.current.pending;
76
- writable.error = controller.current.error;
77
- writable.failure = controller.current.failure;
66
+ pending.value = controller.current.pending;
67
+ error.value = controller.current.error;
68
+ failure.value = controller.current.failure;
78
69
  });
79
- if (getCurrentScope())
80
- onScopeDispose(() => controller.dispose());
81
- return handle;
70
+ releaseWithScope("useCommand", () => controller.dispose());
71
+ return { run: controller.run, pending, error, failure, reset: controller.reset };
82
72
  }
83
73
  /**
84
74
  * Tracks Start admission, pending work, cancellation and terminal feedback of a
85
- * generated `start<Command>()` operation. The result is a reactive object; do not
86
- * destructure its state. A run that ends `cancelled` sets `cancelled`, not `error`.
87
- * Scope disposal settles run promises without cancelling accepted work.
75
+ * generated `start<Command>()` operation, each state field a shallow ref, so the
76
+ * handle can be destructured. A run that ends `cancelled` sets `cancelled`, not `error`.
77
+ * Scope disposal settles run promises without cancelling accepted work. Call it in
78
+ * `setup()` or `effectScope().run()`: outside an effect scope it is never released
79
+ * (development builds warn).
88
80
  *
89
81
  * ```vue
90
- * const push = useOperation((remote: string) => client.value?.startPush(remote));
91
- * <button :disabled="push.pending" @click="push.run('origin')">Push</button>
92
- * <p v-if="push.cancelled" role="status">Push cancelled.</p>
82
+ * const { run: push, pending, cancelled } = useOperation((remote: string) => client.value?.startPush(remote));
83
+ * <button :disabled="pending" @click="push('origin')">Push</button>
84
+ * <p v-if="cancelled" role="status">Push cancelled.</p>
93
85
  * ```
94
86
  */
95
87
  export function useOperation(start, options = {}) {
96
88
  const controller = createOperationController(start, options);
97
- const handle = shallowReactive({
98
- ...controller.current, run: controller.run, cancel: controller.cancel, reset: controller.reset,
99
- });
100
- controller.subscribe(() => { Object.assign(handle, controller.current); });
101
- if (getCurrentScope())
102
- onScopeDispose(() => controller.dispose());
103
- return handle;
104
- }
105
- /**
106
- * Follows a fixed-row-height scroll container and returns the rows to request
107
- * from .NET. Pass a getter such as `() => ({ totalCount: state.value?.totalCount ?? 0, rowHeight: 32 })`
108
- * and watch `viewport` to send `start` and `size` to the ViewModel.
109
- */
110
- export function useCollectionViewport(options) {
111
- const controller = createCollectionViewportController(toValue(options));
112
- const viewport = shallowRef(controller.current);
113
- controller.subscribe(() => { viewport.value = controller.current; });
114
- watch(() => {
115
- const { totalCount, rowHeight, overscan } = toValue(options);
116
- return [totalCount, rowHeight, overscan];
117
- }, ([totalCount, rowHeight, overscan]) => {
118
- controller.update({ totalCount, rowHeight, ...(overscan === undefined ? {} : { overscan }) });
89
+ const refs = {};
90
+ const keys = Object.keys(controller.current);
91
+ for (const key of keys)
92
+ refs[key] = shallowRef(controller.current[key]);
93
+ controller.subscribe(() => {
94
+ const current = controller.current;
95
+ for (const key of keys)
96
+ refs[key].value = current[key];
119
97
  });
120
- if (getCurrentScope())
121
- onScopeDispose(() => controller.dispose());
122
- return {
123
- viewport,
124
- attach(element) {
125
- controller.attach(typeof HTMLElement !== "undefined" && element instanceof HTMLElement ? element : null);
126
- },
127
- };
98
+ releaseWithScope("useOperation", () => controller.dispose());
99
+ return { ...refs, run: controller.run, cancel: controller.cancel, reset: controller.reset };
128
100
  }
129
- //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export declare function releaseWithScope(composable: string, release: () => void): void;
package/dist/scope.js ADDED
@@ -0,0 +1,13 @@
1
+ import { getCurrentScope, onScopeDispose } from "vue";
2
+ // Ties a composable's controller to the current effect scope. Outside one (not
3
+ // in setup() or effectScope().run()) nothing ever releases it, so development
4
+ // builds say so.
5
+ export function releaseWithScope(composable, release) {
6
+ if (getCurrentScope()) {
7
+ onScopeDispose(release);
8
+ return;
9
+ }
10
+ if (process.env.NODE_ENV !== "production")
11
+ console.warn(`${composable} was called outside an active effect scope, so nothing releases it: ` +
12
+ "call it in a component's setup() or inside effectScope().run(), and stop that scope to release it.");
13
+ }
@@ -0,0 +1,20 @@
1
+ import { type ComponentPublicInstance, type MaybeRefOrGetter, type Ref } from "vue";
2
+ import { type CollectionViewport, type CollectionViewportOptions } from "@runic-artifex/views/experimental";
3
+ export interface CollectionViewportHandle {
4
+ /** The rows to request and the sizes to render. */
5
+ readonly viewport: Readonly<Ref<CollectionViewport>>;
6
+ /**
7
+ * A function ref for the scroll container, bound to a native element:
8
+ * `<div :ref="attach">`. A component instance or a non-HTML element detaches
9
+ * the viewport (development builds warn); bind a native element instead.
10
+ */
11
+ attach(element: Element | ComponentPublicInstance | null): void;
12
+ }
13
+ /**
14
+ * Follows a fixed-row-height scroll container and returns the rows to request
15
+ * from .NET. Pass a getter such as `() => ({ totalCount: state.value?.totalCount ?? 0, rowHeight: 32 })`
16
+ * and watch `viewport` to send `start` and `size` to the ViewModel. Call it in
17
+ * `setup()` or `effectScope().run()`: outside an effect scope it is never
18
+ * released (development builds warn).
19
+ */
20
+ export declare function useCollectionViewport(options: MaybeRefOrGetter<CollectionViewportOptions>): CollectionViewportHandle;
@@ -0,0 +1,37 @@
1
+ import { shallowRef, toValue, watch } from "vue";
2
+ import { createCollectionViewportController, } from "@runic-artifex/views/experimental";
3
+ import { releaseWithScope } from "./scope.js";
4
+ /**
5
+ * Follows a fixed-row-height scroll container and returns the rows to request
6
+ * from .NET. Pass a getter such as `() => ({ totalCount: state.value?.totalCount ?? 0, rowHeight: 32 })`
7
+ * and watch `viewport` to send `start` and `size` to the ViewModel. Call it in
8
+ * `setup()` or `effectScope().run()`: outside an effect scope it is never
9
+ * released (development builds warn).
10
+ */
11
+ export function useCollectionViewport(options) {
12
+ const controller = createCollectionViewportController(toValue(options));
13
+ const viewport = shallowRef(controller.current);
14
+ controller.subscribe(() => { viewport.value = controller.current; });
15
+ watch(() => {
16
+ const { totalCount, rowHeight, overscan } = toValue(options);
17
+ return [totalCount, rowHeight, overscan];
18
+ }, ([totalCount, rowHeight, overscan]) => {
19
+ controller.update({ totalCount, rowHeight, ...(overscan === undefined ? {} : { overscan }) });
20
+ });
21
+ releaseWithScope("useCollectionViewport", () => controller.dispose());
22
+ let warned = false;
23
+ return {
24
+ viewport,
25
+ attach(element) {
26
+ if (typeof HTMLElement === "undefined")
27
+ return controller.attach(null);
28
+ const container = element instanceof HTMLElement ? element : null;
29
+ if (process.env.NODE_ENV !== "production" && element !== null && container === null && !warned) {
30
+ warned = true;
31
+ console.warn("useCollectionViewport's attach received a component instance or a non-HTML element, so the viewport " +
32
+ "is detached: bind `:ref=\"attach\"` to a native scroll container such as a <div>.");
33
+ }
34
+ controller.attach(container);
35
+ },
36
+ };
37
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runic-artifex/vue",
3
- "version": "0.8.0-preview.5",
3
+ "version": "0.9.0",
4
4
  "description": "Vue composables for generated Runic Views clients",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -16,7 +16,13 @@
16
16
  "exports": {
17
17
  ".": {
18
18
  "types": "./dist/index.d.ts",
19
- "import": "./dist/index.js"
19
+ "import": "./dist/index.js",
20
+ "default": "./dist/index.js"
21
+ },
22
+ "./experimental": {
23
+ "types": "./dist/experimental.d.ts",
24
+ "import": "./dist/experimental.js",
25
+ "default": "./dist/experimental.js"
20
26
  },
21
27
  "./package.json": "./package.json"
22
28
  },
@@ -28,19 +34,16 @@
28
34
  "pack:check": "bun pm pack --dry-run"
29
35
  },
30
36
  "peerDependencies": {
31
- "vue": ">=3.5.0 <4",
32
- "@runic-artifex/views": "0.8.0-preview.5"
37
+ "vue": ">=3.5.30 <4",
38
+ "@runic-artifex/views": "0.9.0"
33
39
  },
34
40
  "devDependencies": {
35
- "@runic-artifex/views": "0.8.0-preview.5",
41
+ "@runic-artifex/views": "0.9.0",
36
42
  "happy-dom": "20.14.5",
37
43
  "typescript": "6.0.3",
38
44
  "vitest": "5.0.3",
39
45
  "vue": "3.5.43"
40
46
  },
41
- "engines": {
42
- "node": ">=24.18.0 <25"
43
- },
44
47
  "publishConfig": {
45
48
  "access": "public",
46
49
  "tag": "preview"
@@ -50,7 +53,7 @@
50
53
  "url": "git+https://github.com/Runic-Artifex/runic-sdk.git",
51
54
  "directory": "packages/web/vue"
52
55
  },
53
- "homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/v0.8.0-preview.5/packages/web/vue#readme",
56
+ "homepage": "https://github.com/Runic-Artifex/runic-sdk/tree/v0.9.0/packages/web/vue#readme",
54
57
  "bugs": {
55
58
  "url": "https://github.com/Runic-Artifex/runic-sdk/issues"
56
59
  },
@@ -60,5 +63,5 @@
60
63
  "views",
61
64
  "vue"
62
65
  ],
63
- "gitHead": "7b53b417bd0f6a360036a094c2902ea7e620b413"
66
+ "gitHead": "6793f99c726af8b1d05067108761905aa5e8d0d6"
64
67
  }
@@ -1 +0,0 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