@runic-artifex/angular 0.19.0 → 0.20.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.
Files changed (53) hide show
  1. package/README.md +130 -23
  2. package/dist/fesm2022/runic-artifex-angular-experimental.mjs +285 -0
  3. package/dist/fesm2022/runic-artifex-angular-experimental.mjs.map +1 -0
  4. package/dist/fesm2022/runic-artifex-angular-forms.mjs +246 -0
  5. package/dist/fesm2022/runic-artifex-angular-forms.mjs.map +1 -0
  6. package/dist/fesm2022/runic-artifex-angular.mjs +975 -0
  7. package/dist/fesm2022/runic-artifex-angular.mjs.map +1 -0
  8. package/dist/types/runic-artifex-angular-experimental.d.ts +85 -0
  9. package/dist/types/runic-artifex-angular-forms.d.ts +72 -0
  10. package/dist/types/runic-artifex-angular.d.ts +626 -0
  11. package/package.json +20 -17
  12. package/dist/esm/experimental.d.ts +0 -39
  13. package/dist/esm/experimental.js +0 -64
  14. package/dist/esm/forms/index.d.ts +0 -2
  15. package/dist/esm/forms/index.js +0 -2
  16. package/dist/esm/forms/runic-field.directive.d.ts +0 -48
  17. package/dist/esm/forms/runic-field.directive.js +0 -195
  18. package/dist/esm/forms/signal-forms.d.ts +0 -19
  19. package/dist/esm/forms/signal-forms.js +0 -29
  20. package/dist/esm/index.d.ts +0 -24
  21. package/dist/esm/index.js +0 -25
  22. package/dist/esm/inject-appearance.d.ts +0 -19
  23. package/dist/esm/inject-appearance.js +0 -28
  24. package/dist/esm/inject-bridge-connection.d.ts +0 -22
  25. package/dist/esm/inject-bridge-connection.js +0 -26
  26. package/dist/esm/inject-collection-viewport.d.ts +0 -13
  27. package/dist/esm/inject-collection-viewport.js +0 -31
  28. package/dist/esm/inject-command.d.ts +0 -35
  29. package/dist/esm/inject-command.js +0 -33
  30. package/dist/esm/inject-field.d.ts +0 -66
  31. package/dist/esm/inject-field.js +0 -58
  32. package/dist/esm/inject-form.d.ts +0 -40
  33. package/dist/esm/inject-form.js +0 -48
  34. package/dist/esm/inject-latest-operation.d.ts +0 -25
  35. package/dist/esm/inject-latest-operation.js +0 -35
  36. package/dist/esm/inject-menu-bar.d.ts +0 -32
  37. package/dist/esm/inject-menu-bar.js +0 -39
  38. package/dist/esm/inject-operation.d.ts +0 -23
  39. package/dist/esm/inject-operation.js +0 -33
  40. package/dist/esm/inject-query-collection.d.ts +0 -29
  41. package/dist/esm/inject-query-collection.js +0 -64
  42. package/dist/esm/inject-text-field.d.ts +0 -55
  43. package/dist/esm/inject-text-field.js +0 -51
  44. package/dist/esm/inject-text.d.ts +0 -57
  45. package/dist/esm/inject-text.js +0 -107
  46. package/dist/esm/inject-view-resource.d.ts +0 -39
  47. package/dist/esm/inject-view-resource.js +0 -98
  48. package/dist/esm/inject-view.d.ts +0 -41
  49. package/dist/esm/inject-view.js +0 -67
  50. package/dist/esm/instance.d.ts +0 -34
  51. package/dist/esm/instance.js +0 -48
  52. package/dist/esm/view-outlet.d.ts +0 -101
  53. package/dist/esm/view-outlet.js +0 -177
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runic-artifex-angular.mjs","names":["regionEntries","textOf","onBridgeConnection","resolveText","windowLocale","appearance","onAppearance"],"sources":["../../src/instance.ts","../../src/view-outlet.ts","../../src/inject-view.ts","../../src/inject-view-resource.ts","../../src/inject-command.ts","../../src/inject-operation.ts","../../src/inject-field.ts","../../src/inject-form.ts","../../src/inject-text-field.ts","../../src/inject-latest-operation.ts","../../src/inject-collection-viewport.ts","../../src/inject-query-collection.ts","../../src/inject-bridge-connection.ts","../../src/inject-text.ts","../../src/inject-appearance.ts","../../src/inject-menu-bar.ts"],"sourcesContent":["import { assertInInjectionContext, inject, InjectionToken, type Injector, type Provider } from \"@angular/core\";\nimport { defaultInstance, type RunicInstance } from \"@runic-artifex/views\";\n\n/**\n * The Runic instance (`createRunicInstance` in `@runic-artifex/views`) that the `inject*` helpers, `ViewOutlet` and the\n * `runicText` pipe connect and read through. Without a provider it is the default instance: the page instance, on\n * `globalThis.__runicBridge`, as before instances existed, or in a component bundle its element's.\n */\nexport const RUNIC_INSTANCE = new InjectionToken<RunicInstance>(\"RUNIC_INSTANCE\", {\n providedIn: \"root\",\n factory: () => defaultInstance(),\n});\n\n/**\n * Provides `instance` as the {@link RUNIC_INSTANCE} of an injector: `injectView`, `injectField`, `injectText`,\n * `injectBridgeConnection`, `injectAppearance` and the other helpers below it use it instead of the page instance. A\n * guest that renders inside another page, such as an embedded component, adds it to its application's or its root\n * component's `providers`.\n *\n * ```ts\n * const instance = createRunicInstance({ bridge });\n * bootstrapApplication(App, { providers: [provideRunicInstance(instance)] });\n * ```\n */\nexport function provideRunicInstance(instance: RunicInstance): Provider {\n return { provide: RUNIC_INSTANCE, useValue: instance };\n}\n\n/** Options of {@link injectRunicInstance}. */\nexport interface InjectRunicInstanceOptions {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n}\n\n/**\n * The Runic instance of the injection context: the nearest {@link provideRunicInstance}, or the default instance\n * (`defaultInstance()`: the page instance, or in a component bundle its element's).\n */\nexport function injectRunicInstance({ injector }: InjectRunicInstanceOptions = {}): RunicInstance {\n if (injector) return instanceOf(injector);\n assertInInjectionContext(injectRunicInstance);\n return inject(RUNIC_INSTANCE, { optional: true }) ?? defaultInstance();\n}\n\n/** @internal The Runic instance of `injector`. */\nexport function instanceOf(injector: Injector): RunicInstance {\n return injector.get(RUNIC_INSTANCE, null) ?? defaultInstance();\n}\n\n/** @internal The Runic instance of the injection context, or the default instance outside one. */\nexport function contextInstance(): RunicInstance {\n try { return inject(RUNIC_INSTANCE, { optional: true }) ?? defaultInstance(); }\n catch { return defaultInstance(); }\n}\n","import {\n Component, computed, Directive, effect, ElementRef, inject, input, isDevMode, Renderer2, signal, untracked, viewChild, ViewContainerRef,\n type InputSignal,\n type TemplateRef, type Type,\n} from \"@angular/core\";\nimport { regionEntries, type PageReference, type RegionCollection, type RegionEntry, type ViewRegistryPage } from \"@runic-artifex/views\";\nimport { missingViewMessage, reportMissingView } from \"@runic-artifex/views/bindings\";\nimport { injectRunicInstance } from \"./instance.js\";\n\n/**\n * A build-known map checks each generated reference against its component input. A nullable\n * reference, such as a region slot's `State[\"main\"]`, checks its non-null kinds. A component whose `page` input is a\n * shared page reference (`[RunicSharedClient]`), such as `ResultPagePageReference`, registers for each of its kinds.\n */\nexport type ViewRegistry<R extends PageReference | null | undefined> = {\n readonly [K in NonNullable<R>[\"kind\"]]: PageComponent<ViewRegistryPage<R, K>>;\n};\n\n// One component type per page type the entry accepts.\ntype PageComponent<P> = P extends unknown ? Type<{ readonly page: InputSignal<P> }> : never;\n\n/** The context of a `missing` template: the reference without a component, as `$implicit` (`let-page`) and `content`. */\nexport interface ViewOutletMissingContext<R extends PageReference = PageReference> {\n readonly $implicit: R;\n readonly content: R;\n}\n\n// Projected content renders while there is no reference, like React's `fallback`, Vue's default slot\n// and Svelte's `fallback` snippet: `<runic-view-outlet [content]=\"…\" [registry]=\"…\">Loading…</runic-view-outlet>`.\n\n/**\n * Headless host for a selected logical .NET View. A changed reference remounts its component, and\n * the projected content renders while there is no reference. A kind without a component renders\n * the `missing` template, for example localized text. Without it, a development build (`isDevMode()`) renders an\n * English alert, and a production build renders nothing and reports the kind (`installErrorReporting`,\n * `onBridgeDiagnostic`):\n *\n * ```html\n * <runic-view-outlet [content]=\"state()?.main\" [registry]=\"pages\" [missing]=\"missingView\" />\n * <ng-template #missingView let-page><p role=\"alert\">{{ missingText(page.kind) }}</p></ng-template>\n * ```\n *\n * The element keeps Angular's prefix convention: `<runic-view-outlet [content]=\"…\" [registry]=\"…\" />`.\n */\n@Component({ selector: \"runic-view-outlet\", standalone: true, template: `\n <ng-container #mount />\n @if (!content()) { <ng-content /> }\n @if (error(); as issue) { <p role=\"alert\">{{ issue }}</p> }\n ` })\nexport class ViewOutlet<R extends PageReference = PageReference> {\n readonly content = input<R | null | undefined>();\n readonly registry = input.required<ViewRegistry<R>>();\n /** Renders a reference whose kind has no registered component instead of the development alert. */\n readonly missing = input<TemplateRef<ViewOutletMissingContext<R>> | undefined>();\n readonly error = signal<string | undefined>(undefined);\n private readonly mount = viewChild.required(\"mount\", { read: ViewContainerRef });\n private readonly selected = computed(() => {\n const reference = this.content();\n if (!reference) return undefined;\n // A registry built without `satisfies ViewRegistry<R>` may miss a kind at run time.\n const component: Type<object> | undefined = this.registry()[reference.kind as R[\"kind\"]];\n // `missing` is a dependency only while the kind has no component, so changing it never remounts one.\n return { reference, component, missing: component ? undefined : this.missing() };\n });\n\n constructor() {\n const instance = injectRunicInstance();\n effect(() => {\n const container = this.mount();\n const selection = this.selected();\n // Creating the component runs its constructor and inputs; their signal\n // reads must not become dependencies of this effect.\n untracked(() => {\n container.clear();\n this.error.set(undefined);\n if (!selection) return;\n if (!selection.component) {\n if (selection.missing) {\n container.createEmbeddedView(selection.missing, { $implicit: selection.reference, content: selection.reference });\n return;\n }\n if (isDevMode()) this.error.set(missingViewMessage(selection.reference.kind));\n else instance.run(() => reportMissingView(selection.reference.kind));\n return;\n }\n const component = container.createComponent(selection.component);\n component.setInput(\"page\", selection.reference);\n });\n });\n }\n}\n\n/** How {@link RegionOutlets} renders the regions of a collection. */\nexport type RegionOutletsMode = \"keep-mounted\" | \"selected\";\n\n/**\n * Attributes that {@link RegionOutlets} sets on a region's wrapper, such as `id`, `role` and `aria-labelledby`. A\n * `null` or `undefined` value leaves the attribute out. `hidden`, `style` and `data-region-key` stay controlled by\n * the outlet and are ignored here.\n */\nexport type RegionPanelAttributes = Readonly<Record<string, string | null | undefined>>;\n\nconst outletAttributes = new Set([\"hidden\", \"style\", \"data-region-key\"]);\n\n// Sets the attributes of the latest panelProps result on its element and removes the ones it no longer returns.\n@Directive({ selector: \"[runicRegionPanel]\", standalone: true })\nexport class RegionPanel {\n readonly attributes = input<RegionPanelAttributes | undefined>(undefined, { alias: \"runicRegionPanel\" });\n\n constructor() {\n const element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const renderer = inject(Renderer2);\n let applied = new Set<string>();\n effect(() => {\n const set = new Set<string>();\n for (const [name, value] of Object.entries(this.attributes() ?? {})) {\n if (value === null || value === undefined || outletAttributes.has(name.toLowerCase())) continue;\n renderer.setAttribute(element, name, value);\n set.add(name);\n }\n for (const name of applied) if (!set.has(name)) renderer.removeAttribute(element, name);\n applied = set;\n });\n }\n}\n\n/**\n * Renders a {@link ViewOutlet} for the regions of a region collection, each in a `<div data-region-key>` tracked by\n * the region's key. A region that is not selected is rendered with `hidden` and an inline `display: none`, which\n * author CSS without `!important` cannot override. A new content reference in a region remounts only that region's\n * component. The projected content renders while the collection has no region, and `missing` is passed to each\n * outlet. `panelProps` returns attributes for each wrapper, so a tab can point `aria-controls` at its panel:\n *\n * ```html\n * <runic-region-outlets [collection]=\"state()?.documents\" [registry]=\"pages\" [panelProps]=\"panel\">No open documents</runic-region-outlets>\n * ```\n *\n * `mode` `\"keep-mounted\"` (the default) renders every region and hides all but the selected one, so each region\n * keeps its component and DOM. `\"selected\"` renders only the selected region.\n */\n@Component({ selector: \"runic-region-outlets\", standalone: true, imports: [ViewOutlet, RegionPanel], template: `\n @for (panel of shown(); track panel.region.key) {\n <div [runicRegionPanel]=\"panel.attributes\" [hidden]=\"!panel.region.selected\" [style.display]=\"panel.region.selected ? null : 'none'\"\n [attr.data-region-key]=\"panel.region.key\">\n <runic-view-outlet [content]=\"panel.region.content\" [registry]=\"registry()\" [missing]=\"missing()\" />\n </div>\n } @empty { <ng-content /> }\n ` })\nexport class RegionOutlets<R extends PageReference = PageReference> {\n readonly collection = input<RegionCollection<R> | null | undefined>();\n readonly registry = input.required<ViewRegistry<R>>();\n /** Renders a reference whose kind has no registered component instead of the English alert. */\n readonly missing = input<TemplateRef<ViewOutletMissingContext<R>> | undefined>();\n readonly mode = input<RegionOutletsMode>(\"keep-mounted\");\n /** Returns attributes for a region's wrapper, for example `{ id, role: \"tabpanel\", \"aria-labelledby\" }`. */\n readonly panelProps = input<((entry: RegionEntry<R>) => RegionPanelAttributes) | undefined>();\n protected readonly shown = computed(() => {\n const keepMounted = this.mode() === \"keep-mounted\";\n const panelProps = this.panelProps();\n return regionEntries(this.collection())\n .filter(region => keepMounted || region.selected)\n .map(region => ({ region, attributes: panelProps?.(region) }));\n });\n}\n\n/**\n * The name of {@link ViewOutlet} before 0.7.0-preview.7, where React, Vue and Svelte already used\n * `ViewOutlet`. It is the same component class, so it renders the same `<runic-view-outlet>` element\n * without a second component definition for that selector (NG0912).\n * @deprecated Import `ViewOutlet` instead; this alias is removed in the next major release.\n */\nexport const RunicViewOutlet = ViewOutlet;\n/**\n * The name of {@link ViewOutlet} before 0.7.0-preview.7.\n * @deprecated Import `ViewOutlet` instead; this alias is removed in the next major release.\n */\nexport type RunicViewOutlet<R extends PageReference = PageReference> = ViewOutlet<R>;\n","import { assertInInjectionContext, computed, DestroyRef, effect, inject, Injector, isSignal, signal, untracked, type Signal } from \"@angular/core\";\nimport { createViewController, type ViewClient, type ViewSource } from \"@runic-artifex/views\";\nimport { isViewClient, viewSourceIdentity, viewSourcePreview } from \"@runic-artifex/views/bindings\";\nimport { instanceOf } from \"./instance.js\";\n\nexport interface ViewHandle<TClient extends ViewClient> {\n /** The latest state, or undefined until the client connects. */\n readonly state: Signal<TClient[\"snapshot\"] | undefined>;\n /** The connected client for commands, or undefined until it connects. */\n readonly client: Signal<TClient | undefined>;\n /** The connection failure, if any. */\n readonly error: Signal<unknown>;\n /** True while a reference is connecting. */\n readonly pending: Signal<boolean>;\n /** Connects a reference again after a failure. */\n retry(): void;\n}\n\nexport interface InjectViewOptions<TClient extends ViewClient> {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n /** Releases a client this helper connected. Defaults to `client.dispose()`. */\n readonly release?: (client: TClient) => void;\n /**\n * Milliseconds a client this helper connected stays connected after the component unmounts or the source changes,\n * for the next helper that follows the same reference (StrictMode, HMR, `<Activity>`, A→B→A navigation). `0`\n * disposes it at once. Defaults to 2000. Read once, when the helper is created.\n */\n readonly keepAlive?: number;\n}\n\n/**\n * Connects a generated View reference for the lifetime of the injection\n * context (normally a component) and exposes its state as signals. Pass a\n * signal, such as a `page` input, to follow it: a changed reference releases\n * the previous client and connects the new one.\n *\n * A released client stays connected for `keepAlive` milliseconds (2000 by\n * default), and the next `injectView` of the same reference takes it over with\n * its state: an `@if` that toggles, HMR and A→B→A navigation show the View at\n * once instead of opening the route again.\n *\n * A reference is identified by its `connect` function, so a signal producing a\n * new `{ connect: connectShell }` object does not reconnect.\n */\nexport function injectView<TClient extends ViewClient>(source: Signal<ViewSource<TClient>> | ViewSource<TClient>,\n options: InjectViewOptions<TClient> = {}): ViewHandle<TClient> {\n if (!options.injector) assertInInjectionContext(injectView);\n const injector = options.injector ?? inject(Injector);\n // The controller connects in the injection context's Runic instance, also when the source changes or it retries.\n const instance = instanceOf(injector);\n const controller = instance.run(() => createViewController<TClient>({\n ...(options.release ? { release: options.release } : {}),\n ...(options.keepAlive === undefined ? {} : { keepAlive: options.keepAlive }),\n }));\n const current = signal(controller.current);\n controller.subscribe(() => current.set(controller.current));\n const read = (): ViewSource<TClient> => isSignal(source) ? source() : source;\n const identity = computed(() => viewSourceIdentity(read()));\n const observed = computed(() => {\n const value = read();\n return value && isViewClient(value) ? value : undefined;\n });\n // A changed reference does not show the previous one until the effect follows it.\n const fresh = computed(() => viewSourceIdentity(current().source) === identity());\n\n effect(() => {\n identity();\n untracked(() => {\n controller.setSource(read());\n current.set(controller.current);\n });\n }, { injector });\n injector.get(DestroyRef).onDestroy(() => controller.dispose());\n\n // A connected client is readable before the effect observes it, and so is a client kept for the reference\n // (keep-alive), so a component that is created again shows its View at once.\n const preview = computed(() => {\n const value = observed();\n if (value) return value === current().client ? undefined : instance.run(() => viewSourcePreview(value));\n return fresh() ? undefined : instance.run(() => viewSourcePreview(read()));\n });\n return {\n state: computed(() => preview()?.state ?? (fresh() ? current().state : undefined)),\n client: computed(() => preview()?.client ?? (fresh() ? current().client : undefined)),\n error: computed(() => fresh() ? current().error : undefined),\n pending: computed(() => preview() ? false : fresh() ? current().pending : identity() !== undefined),\n retry: () => controller.retry(),\n };\n}\n","import {\n assertInInjectionContext, computed, effect, inject, Injector, isSignal, resource, signal, untracked,\n type Resource, type ResourceStreamItem, type Signal, type WritableSignal,\n} from \"@angular/core\";\nimport { createViewController, type ViewClient, type ViewController, type ViewSource } from \"@runic-artifex/views\";\nimport { viewSourceIdentity } from \"@runic-artifex/views/bindings\";\nimport type { InjectViewOptions } from \"./inject-view.js\";\nimport { instanceOf } from \"./instance.js\";\n\n/**\n * A View connection as an Angular `Resource`: `value()` is the View's state, `status()` is `loading` until the\n * client connected (`reloading` after `reload()`), then `resolved`, or `error` with `error()` the connection\n * failure; `idle` while the source is `null` or `undefined`.\n */\nexport interface ViewResource<TClient extends ViewClient> extends Resource<TClient[\"snapshot\"] | undefined> {\n /** The connected client for commands, or undefined until it connects. */\n readonly client: Signal<TClient | undefined>;\n /** Connects again, for example after a failure. Returns false while the source is `null` or `undefined`. */\n reload(): boolean;\n /** Releases the client and returns the resource to `idle`; the injector's destruction does this too. */\n destroy(): void;\n}\n\nexport type InjectViewResourceOptions<TClient extends ViewClient> = InjectViewOptions<TClient>;\n\nfunction asError(cause: unknown): Error {\n return cause instanceof Error ? cause : new Error(String(cause), { cause });\n}\n\n/**\n * Connects a generated View reference as an Angular `resource()` for the lifetime of the injection context, the\n * asynchronous counterpart of `injectView` (D053.11): a template branches on `hasValue()`, `isLoading()` and\n * `error()` as for any resource, and `value()` is never `undefined` once `hasValue()` is true.\n *\n * ```ts\n * readonly page = input.required<CounterPageReference>();\n * readonly counter = injectViewResource(this.page);\n * ```\n * ```html\n * @if (counter.hasValue()) {\n * <button (click)=\"counter.client()?.increment()\">{{ counter.value().count }}</button>\n * } @else if (counter.error()) {\n * <p role=\"alert\">{{ describe(counter.error()) }}</p> <button (click)=\"counter.reload()\">Retry</button>\n * } @else { <p>Connecting…</p> }\n * ```\n *\n * A changed reference (by its `connect` function) releases the previous client and loads the new one. Released\n * clients are kept for `keepAlive` milliseconds, as with `injectView`, so a component that is created again\n * resolves at once.\n */\nexport function injectViewResource<TClient extends ViewClient>(source: Signal<ViewSource<TClient>> | ViewSource<TClient>,\n options: InjectViewResourceOptions<TClient> = {}): ViewResource<TClient> {\n if (!options.injector) assertInInjectionContext(injectViewResource);\n const injector = options.injector ?? inject(Injector);\n const instance = instanceOf(injector);\n const read = (): ViewSource<TClient> => isSignal(source) ? source() : source;\n const client = signal<TClient | undefined>(undefined);\n const controllerOptions = {\n ...(options.release ? { release: options.release } : {}),\n ...(options.keepAlive === undefined ? {} : { keepAlive: options.keepAlive }),\n };\n // The source is identified by its client or `connect` function, so a new wrapper object does not reload.\n const identity = computed(() => viewSourceIdentity(read()));\n // The controller of the latest load. A resource that becomes idle does not abort its last load, so it is released here.\n let active: ViewController<TClient> | undefined;\n effect(() => {\n if (identity() !== undefined) return;\n active?.dispose();\n active = undefined;\n client.set(undefined);\n }, { injector });\n const ref = resource<TClient[\"snapshot\"] | undefined, object | undefined>({\n injector,\n params: () => identity(),\n stream: async ({ abortSignal }) => {\n // Each load connects in the injection context's Runic instance.\n const controller = instance.run(() => createViewController<TClient>(controllerOptions));\n active = controller;\n abortSignal.addEventListener(\"abort\", () => {\n if (active === controller) active = undefined;\n controller.dispose();\n if (untracked(client) === controller.current.client) client.set(undefined);\n }, { once: true });\n controller.setSource(untracked(read));\n if (controller.current.pending) {\n await new Promise<void>(resolve => {\n const stop = controller.subscribe(() => { if (!controller.current.pending) { stop(); resolve(); } });\n abortSignal.addEventListener(\"abort\", () => { stop(); resolve(); }, { once: true });\n });\n }\n const value: WritableSignal<ResourceStreamItem<TClient[\"snapshot\"] | undefined>> = signal(\n controller.current.error !== undefined ? { error: asError(controller.current.error) } : { value: controller.current.state });\n if (abortSignal.aborted) return value;\n client.set(controller.current.client);\n controller.subscribe(() => {\n const current = controller.current;\n client.set(current.client);\n value.set(current.error !== undefined ? { error: asError(current.error) } : { value: current.state });\n });\n return value;\n },\n });\n return {\n value: ref.value.asReadonly(),\n status: ref.status,\n error: ref.error,\n isLoading: ref.isLoading,\n snapshot: ref.snapshot,\n hasValue: () => ref.hasValue(),\n client: client.asReadonly(),\n reload: () => ref.reload(),\n destroy: () => ref.destroy(),\n } as ViewResource<TClient>;\n}\n","import { assertInInjectionContext, DestroyRef, inject, Injector, signal, type Signal } from \"@angular/core\";\nimport { createCommandController, type BridgeOutcomeFailure } from \"@runic-artifex/views\";\nimport { instanceOf } from \"./instance.js\";\n\nexport interface CommandHandle<TArgs extends readonly unknown[], TResult, TFailure = BridgeOutcomeFailure<TResult>> {\n /**\n * Runs the command. Resolves to its result, including a `BridgeOutcome` with a\n * declared failure, which `failure` then holds, or to undefined after an\n * unexpected failure, which `error` then holds. Never rejects.\n */\n run(...args: TArgs): Promise<TResult | undefined>;\n /** True while a run is in flight. */\n readonly pending: Signal<boolean>;\n /** Why the latest run failed unexpectedly, until the next run starts. */\n readonly error: Signal<unknown>;\n /**\n * The declared failure of the latest run, for a command that resolves a\n * `BridgeOutcome`, until the next run starts. A superseded run sets neither.\n */\n readonly failure: Signal<TFailure | undefined>;\n /** Clears `error` and `failure`. */\n reset(): void;\n}\n\nexport interface InjectCommandOptions {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n}\n\n/**\n * Tracks a command's pending state and failure as signals for the lifetime of\n * the injection context. The command may read signals, such as a client:\n *\n * ```ts\n * readonly increment = injectCommand(() => this.counter.client()?.increment());\n * // <button [disabled]=\"!counter.client() || increment.pending()\" (click)=\"increment.run()\">\n * ```\n */\nexport function injectCommand<TArgs extends readonly unknown[], TReturn>(\n command: (...args: TArgs) => TReturn,\n options: InjectCommandOptions = {},\n): CommandHandle<TArgs, Awaited<TReturn>> {\n if (!options.injector) assertInInjectionContext(injectCommand);\n const injector = options.injector ?? inject(Injector);\n const controller = instanceOf(injector).run(() => createCommandController(command));\n const pending = signal(false);\n const error = signal<unknown>(undefined);\n const failure = signal<BridgeOutcomeFailure<Awaited<TReturn>> | undefined>(undefined);\n controller.subscribe(() => {\n pending.set(controller.current.pending);\n error.set(controller.current.error);\n failure.set(controller.current.failure);\n });\n injector.get(DestroyRef).onDestroy(() => controller.dispose());\n return {\n run: controller.run, pending: pending.asReadonly(), error: error.asReadonly(), failure: failure.asReadonly(), reset: controller.reset,\n };\n}\n","import { assertInInjectionContext, computed, DestroyRef, inject, Injector, signal, type Signal } from \"@angular/core\";\nimport {\n createOperationController,\n type BridgeOperation,\n type OperationController,\n type OperationControllerOptions,\n type OperationState,\n} from \"@runic-artifex/views\";\nimport { instanceOf } from \"./instance.js\";\n\n/** Each field of the operation's feedback as a signal, with `run`, `cancel` and `reset`. */\nexport type OperationHandle<TArgs extends readonly unknown[], TResult, TFailure = never> =\n { readonly [K in keyof OperationState<TResult, TFailure>]: Signal<OperationState<TResult, TFailure>[K]> }\n & Pick<OperationController<TArgs, TResult, TFailure>, \"run\" | \"cancel\" | \"reset\">;\n\nexport interface InjectOperationOptions<TResult, TFailure = never> extends OperationControllerOptions<TResult, TFailure> {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n}\n\n/**\n * Tracks Start admission, pending work, cancellation and terminal feedback of a\n * generated `start<Command>()` operation as signals for the lifetime of the\n * injection context. A run that ends `cancelled` sets `cancelled`, not `error`.\n * Destruction settles run promises without cancelling accepted work.\n *\n * ```ts\n * readonly push = injectOperation((remote: string) => this.workspace.client()?.startPush(remote));\n * // <button [disabled]=\"push.pending()\" (click)=\"push.run('origin')\">Push</button>\n * // @if (push.cancelled()) { <p role=\"status\">Push cancelled.</p> }\n * ```\n */\nexport function injectOperation<TArgs extends readonly unknown[], TResult, TFailure = never>(\n start: (...args: TArgs) => BridgeOperation<TResult, TFailure> | undefined | PromiseLike<BridgeOperation<TResult, TFailure> | undefined>,\n { injector: provided, ...options }: InjectOperationOptions<TResult, TFailure> = {},\n): OperationHandle<TArgs, TResult, TFailure> {\n if (!provided) assertInInjectionContext(injectOperation);\n const injector = provided ?? inject(Injector);\n const controller = instanceOf(injector).run(() => createOperationController(start, options));\n const state = signal(controller.current);\n controller.subscribe(() => state.set(controller.current));\n injector.get(DestroyRef).onDestroy(() => controller.dispose());\n const field = <K extends keyof OperationState<TResult, TFailure>>(key: K) => computed(() => state()[key]);\n return {\n run: controller.run, cancel: controller.cancel, reset: controller.reset,\n pending: field(\"pending\"), admitting: field(\"admitting\"), operation: field(\"operation\"), status: field(\"status\"),\n outcome: field(\"outcome\"), failure: field(\"failure\"), error: field(\"error\"), cancelled: field(\"cancelled\"),\n cancellationRequested: field(\"cancellationRequested\"), cancelling: field(\"cancelling\"),\n progress: field(\"progress\"), cancellation: field(\"cancellation\"), cancelError: field(\"cancelError\"),\n };\n}\n","import { assertInInjectionContext, computed, DestroyRef, effect, inject, Injector, signal, untracked, type Signal } from \"@angular/core\";\nimport {\n createFieldController,\n type BridgeField,\n type FieldBaseline,\n type FieldController,\n type FieldDefinition,\n type FieldOptions,\n type FieldState,\n type ViewClient,\n} from \"@runic-artifex/views\";\nimport { instanceOf } from \"./instance.js\";\n\n/** The View a field binds to: an {@link injectView} handle, or any pair of state and client signals. */\nexport interface FieldView<TClient extends ViewClient> {\n readonly state: Signal<TClient[\"snapshot\"] | undefined>;\n readonly client: Signal<TClient | undefined>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface InjectFieldOptions<TValue = any> extends FieldOptions<TValue> {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n}\n\n/** One View member bound to an input, as signals. See `FieldState` and `FieldController` in `@runic-artifex/views`. */\nexport interface FieldHandle<TValue> {\n /** The draft while one exists, otherwise the member's value in the View's state. */\n readonly value: Signal<TValue>;\n /** What a text input shows: the text typed while it does not parse or still means `value`, otherwise `value` formatted. */\n readonly text: Signal<string>;\n /**\n * True while a draft exists, from the first input until the last write settled and the state caught up, and after a\n * failed write. Keep the input enabled while it is true, rather than disabling it on the View's busy state, which\n * the field's own write causes.\n */\n readonly editing: Signal<boolean>;\n /** Why the latest write or text failed: a `BridgeError` of the write, or a `FieldError`. `undefined` otherwise. */\n readonly error: Signal<unknown>;\n /** The member's validation messages; `[]` when valid. */\n readonly errors: Signal<readonly string[]>;\n /** The producer's value and version while a checked write's `conflict` keeps the draft. */\n readonly conflict: Signal<FieldBaseline<TValue> | undefined>;\n /** The member's validation is in progress, such as an asynchronous rule that is still checking: show \"checking…\". */\n readonly validating: Signal<boolean>;\n /** The definition's `kind`, `nullable`, `integer` and `choices`. */\n readonly field: FieldController<unknown, unknown, TValue>[\"field\"];\n /** The user changed the value, such as a checkbox's `checked`. */\n input(value: TValue): void;\n /** The user changed the text: pass the `input` event, or the text. It is parsed for the field's kind. */\n inputText(event: Event | string): void;\n /** An IME composition started: the text is kept but not written until it ends. Bind it to `compositionstart`. */\n compositionStart(): void;\n /** The IME composition ended: pass the `compositionend` event, or the text, which is then written. */\n compositionEnd(event: Event | string): void;\n /**\n * The user is done with the field (bind it to `blur`): with `commit: \"pause\"` the draft is written now. Resolves\n * with the field's state once its writes settled, so a command that depends on the field can follow it.\n */\n commit(): Promise<FieldState<TValue>>;\n /** Writes the draft again after a failed write; after a `conflict`, over the producer's value. */\n retry(): void;\n /** Drops the draft, the error and a conflict and shows the View's value. Writes in flight still complete. */\n reset(): void;\n}\n\nfunction textOf(event: Event | string): string {\n if (typeof event === \"string\") return event;\n const target = event.target as { value?: unknown } | null;\n return typeof target?.value === \"string\" ? target.value : \"\";\n}\n\n/**\n * Binds one member of a View to an input for the lifetime of the injection context, through\n * `createFieldController`: pass a generated descriptor such as `EditorFields.title`. Typing never loses characters,\n * nothing is written during IME composition, checked-write receipts and the member's validation show as `error`,\n * `errors` and `conflict`, and once the last write settled the field shows the View's value.\n *\n * ```ts\n * readonly editor = injectView(this.page);\n * readonly title = injectField(this.editor, EditorFields.title);\n * // <input [runicField]=\"title\"> with RunicFieldDirective from @runic-artifex/angular/forms, or by hand:\n * // <input [value]=\"title.text()\" (input)=\"title.inputText($event)\" (blur)=\"title.commit()\"\n * // (compositionstart)=\"title.compositionStart()\" (compositionend)=\"title.compositionEnd($event)\">\n * ```\n */\nexport function injectField<TClient extends ViewClient, TValue>(\n view: FieldView<TClient>,\n field: BridgeField<TClient, TClient[\"snapshot\"], TValue> | FieldDefinition<TClient, TClient[\"snapshot\"], TValue>,\n { injector: provided, ...options }: InjectFieldOptions<TValue> = {},\n): FieldHandle<TValue> {\n if (!provided) assertInInjectionContext(injectField);\n const injector = provided ?? inject(Injector);\n const controller = instanceOf(injector).run(() => createFieldController<TClient[\"snapshot\"], TClient, TValue>(field, options));\n const current = signal(controller.current);\n controller.subscribe(() => current.set(controller.current));\n effect(() => {\n const state = view.state();\n const client = view.client();\n untracked(() => {\n controller.setSource(state === undefined || client === undefined ? undefined : { state, client });\n current.set(controller.current);\n });\n }, { injector });\n injector.get(DestroyRef).onDestroy(() => controller.dispose());\n return {\n value: computed(() => current().value),\n text: computed(() => current().text),\n editing: computed(() => current().editing),\n error: computed(() => current().error),\n errors: computed(() => current().errors),\n conflict: computed(() => current().conflict),\n validating: computed(() => current().validating),\n field: controller.field,\n input(value) { controller.input(value); },\n inputText(event) { controller.inputText(textOf(event)); },\n compositionStart() { controller.compositionStart(); },\n compositionEnd(event) { controller.compositionEnd(textOf(event)); },\n commit() { return controller.commit(); },\n retry() { controller.retry(); },\n reset() { controller.reset(); },\n };\n}\n","import { computed, signal, type Signal } from \"@angular/core\";\nimport {\n formFieldList,\n formStateOf,\n submitFields,\n type FormField,\n type FormFields,\n type FormState,\n type FormSubmitOptions,\n type FormSubmitResult,\n} from \"@runic-artifex/views\";\n\n/** A field as {@link injectForm} reads it: an `injectField` handle. */\nexport interface FormFieldHandle extends FormField {\n readonly editing: Signal<boolean>;\n readonly validating: Signal<boolean>;\n readonly errors: Signal<readonly string[]>;\n readonly error: Signal<unknown>;\n}\n\nexport interface InjectFormOptions {\n /** Whether the View reports unsaved changes, such as `computed(() => this.editor.state()?.isDirty === true)`. */\n readonly dirty?: Signal<boolean | undefined>;\n}\n\n/** A form bound by {@link injectForm}: its state as signals, and its actions. */\nexport interface FormHandle {\n /** The whole state. */\n readonly state: Signal<FormState>;\n readonly dirty: Signal<boolean>;\n readonly editing: Signal<boolean>;\n readonly validating: Signal<boolean>;\n readonly pending: Signal<boolean>;\n readonly valid: Signal<boolean>;\n readonly submitting: Signal<boolean>;\n /** Commits every field, waits for their writes and runs `command` unless a field's write or text failed. */\n submit<T>(command: () => T | PromiseLike<T>, options?: FormSubmitOptions): Promise<FormSubmitResult<T>>;\n /** Commits every field and resolves once their writes settled. */\n commit(): Promise<FormState>;\n /** Resets every field. */\n reset(): void;\n}\n\n/**\n * One dirty, pending and valid state over `injectField` handles, and a `submit` that writes every field before its\n * command (`createFormController` in `@runic-artifex/views`). It needs no injection context.\n *\n * ```ts\n * readonly form = injectForm({ title: this.title, body: this.body }, { dirty: computed(() => this.editor.state()?.isDirty === true) });\n * // <button [disabled]=\"!form.valid() || form.submitting()\" (click)=\"form.submit(() => editor.client()!.save())\">Save</button>\n * ```\n */\nexport function injectForm(fields: FormFields<FormFieldHandle>, options: InjectFormOptions = {}): FormHandle {\n const list = formFieldList(fields);\n const submitting = signal(false);\n const state = computed(() => formStateOf(\n list.map(field => ({ editing: field.editing(), validating: field.validating(), errors: field.errors(), error: field.error() })),\n options.dirty?.() === true, submitting()));\n return {\n state,\n dirty: computed(() => state().dirty),\n editing: computed(() => state().editing),\n validating: computed(() => state().validating),\n pending: computed(() => state().pending),\n valid: computed(() => state().valid),\n submitting: computed(() => state().submitting),\n async submit<T>(command: () => T | PromiseLike<T>, submitOptions: FormSubmitOptions = {}): Promise<FormSubmitResult<T>> {\n if (submitting()) return { status: \"busy\" };\n submitting.set(true);\n const read = (index: number) => {\n const field = list[index]!;\n return { editing: field.editing(), error: field.error(), validating: field.validating() };\n };\n try { return await submitFields(list, command, submitOptions, read); }\n finally { submitting.set(false); }\n },\n async commit(): Promise<FormState> {\n await Promise.all(list.map(field => field.commit()));\n return state();\n },\n reset() { for (const field of list) field.reset(); },\n };\n}\n","import { assertInInjectionContext, computed, DestroyRef, effect, inject, Injector, signal, untracked, type Signal } from \"@angular/core\";\nimport { createTextFieldController, type ViewClient } from \"@runic-artifex/views\";\nimport { instanceOf } from \"./instance.js\";\n\n/** A text input bound to one View member. */\nexport interface TextFieldHandle {\n /** What the input shows: the draft while one exists, otherwise the member's value in the View's state. */\n readonly value: Signal<string>;\n /**\n * True while a draft exists, from the first input until the last write settled and the state caught up, and after a\n * failed write. Keep the input enabled while it is true, rather than disabling it on the View's busy state, which\n * the field's own write causes.\n */\n readonly editing: Signal<boolean>;\n /** Why the latest write failed, until the next input or `reset()`. */\n readonly error: Signal<unknown>;\n /** The user changed the text: pass the `input` event, or the new text. */\n input(event: Event | string): void;\n /** An IME composition started: the text is kept but not written until it ends. Bind it to `compositionstart`. */\n compositionStart(): void;\n /** The IME composition ended: pass the `compositionend` event, or the text, which is then written. */\n compositionEnd(event: Event | string): void;\n /** Drops the draft and the error and shows the View's value. Writes in flight still complete. */\n reset(): void;\n}\n\nexport interface InjectTextFieldOptions {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n /**\n * With `true` (the default) at most one write is in flight, and text typed meanwhile is written next, as one\n * value. With `false` every input is written.\n */\n readonly coalesce?: boolean;\n /** With `true` (the default) a failed write keeps the draft and sets `error`; with `false` the field shows the View's value again. */\n readonly keepDraftOnError?: boolean;\n}\n\n/** The View a text field binds to: an {@link injectView} handle, or any pair of state and client signals. */\nexport interface TextFieldView<TClient extends ViewClient> {\n readonly state: Signal<TClient[\"snapshot\"] | undefined>;\n readonly client: Signal<TClient | undefined>;\n}\n\nfunction textOf(event: Event | string): string {\n if (typeof event === \"string\") return event;\n const target = event.target as { value?: unknown } | null;\n return typeof target?.value === \"string\" ? target.value : \"\";\n}\n\n/**\n * Binds a text input to one member of a View for the lifetime of the injection context, through\n * `createTextFieldController`. Typing key by key never loses characters: while its writes are in flight the field\n * shows what the user typed, at most one write is in flight (newer text is written next), nothing is written during\n * IME composition, and once the last write settled it shows the View's value, including any normalization.\n *\n * ```ts\n * readonly person = injectView(this.page);\n * readonly name = injectTextField(this.person, state => state.name, (client, value) => client.setName(value));\n * // <input [value]=\"name.value()\" (input)=\"name.input($event)\"\n * // (compositionstart)=\"name.compositionStart()\" (compositionend)=\"name.compositionEnd($event)\">\n * ```\n *\n * `write` may be a generated setter, a command or a checked write. Its failure sets `error` and keeps the draft.\n */\nexport function injectTextField<TClient extends ViewClient>(\n view: TextFieldView<TClient>,\n read: (state: TClient[\"snapshot\"]) => string,\n write: (client: TClient, value: string) => Promise<unknown>,\n { injector: provided, ...options }: InjectTextFieldOptions = {},\n): TextFieldHandle {\n if (!provided) assertInInjectionContext(injectTextField);\n const injector = provided ?? inject(Injector);\n const controller = instanceOf(injector).run(() => createTextFieldController<TClient[\"snapshot\"], TClient>({ read, write, ...options }));\n const current = signal(controller.current);\n controller.subscribe(() => current.set(controller.current));\n effect(() => {\n const state = view.state();\n const client = view.client();\n untracked(() => {\n controller.setSource(state === undefined || client === undefined ? undefined : { state, client });\n current.set(controller.current);\n });\n }, { injector });\n injector.get(DestroyRef).onDestroy(() => controller.dispose());\n return {\n value: computed(() => current().value),\n editing: computed(() => current().editing),\n error: computed(() => current().error),\n input(event) { controller.input(textOf(event)); },\n compositionStart() { controller.compositionStart(); },\n compositionEnd(event) { controller.compositionEnd(textOf(event)); },\n reset() { controller.reset(); },\n };\n}\n","import { assertInInjectionContext, computed, DestroyRef, inject, Injector, signal, type Signal } from \"@angular/core\";\nimport {\n createLatestOperationController,\n type LatestOperationController,\n type LatestOperationState,\n} from \"@runic-artifex/views\";\nimport { instanceOf } from \"./instance.js\";\n\n/** Each field of the latest-operation feedback as a signal, with `run` and `clear`. */\nexport type LatestOperationHandle<TResult, TFailure = never> =\n { readonly [K in keyof LatestOperationState<TResult, TFailure>]: Signal<LatestOperationState<TResult, TFailure>[K]> }\n & Pick<LatestOperationController<TResult, TFailure>, \"run\" | \"clear\">;\n\nexport interface InjectLatestOperationOptions {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n}\n\n/**\n * Admits only the newest selection, for reads such as \"load the selected item\", as signals\n * for the lifetime of the injection context. Each `run(intent)` replaces the queued intent\n * and cancels the active read, and the next read starts only after the previous one has\n * finished (including `waitForCompletion`). `blocked` means admission is uncertain; only\n * `clear(\"replace\")`, after the application has established a fresh session, clears it.\n * Destruction settles run promises without cancelling accepted work.\n *\n * ```ts\n * readonly load = injectLatestOperation<Item>();\n * select(id: string) { void this.load.run({ start: () => this.items.client()?.startLoad(id) }); }\n * // @if (load.outcome()?.ok) { <item-view [item]=\"load.outcome()!.value\" /> }\n * ```\n */\nexport function injectLatestOperation<TResult = void, TFailure = never>(\n { injector: provided }: InjectLatestOperationOptions = {},\n): LatestOperationHandle<TResult, TFailure> {\n if (!provided) assertInInjectionContext(injectLatestOperation);\n const injector = provided ?? inject(Injector);\n const controller = instanceOf(injector).run(() => createLatestOperationController<TResult, TFailure>());\n const state = signal(controller.current);\n controller.subscribe(() => state.set(controller.current));\n injector.get(DestroyRef).onDestroy(() => controller.dispose());\n const field = <K extends keyof LatestOperationState<TResult, TFailure>>(key: K) => computed(() => state()[key]);\n return {\n run: controller.run, clear: controller.clear,\n pending: field(\"pending\"), admitting: field(\"admitting\"), operation: field(\"operation\"), status: field(\"status\"),\n outcome: field(\"outcome\"), failure: field(\"failure\"), error: field(\"error\"), cancelled: field(\"cancelled\"),\n cancellationRequested: field(\"cancellationRequested\"), cancelling: field(\"cancelling\"),\n progress: field(\"progress\"), cancellation: field(\"cancellation\"), cancelError: field(\"cancelError\"), blocked: field(\"blocked\"),\n };\n}\n","import { assertInInjectionContext, DestroyRef, effect, ElementRef, inject, Injector, NgZone, signal, untracked, type Signal } from \"@angular/core\";\nimport { createCollectionViewportController, type CollectionViewport, type CollectionViewportOptions } from \"@runic-artifex/views\";\n\nexport interface InjectCollectionViewportOptions {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n}\n\n/**\n * Follows a fixed-row-height scroll container and returns the rows to request\n * from .NET as a signal. Pass the container, for example\n * `viewChild<ElementRef<HTMLElement>>(\"scroller\")`, and the list options as a\n * signal or function, then send `start` and `size` to the ViewModel from an effect.\n */\nexport function injectCollectionViewport(\n element: Signal<ElementRef<HTMLElement> | HTMLElement | null | undefined>,\n options: () => CollectionViewportOptions,\n { injector: provided }: InjectCollectionViewportOptions = {},\n): Signal<CollectionViewport> {\n if (!provided) assertInInjectionContext(injectCollectionViewport);\n const injector = provided ?? inject(Injector);\n const controller = createCollectionViewportController(untracked(options));\n const viewport = signal(controller.current);\n controller.subscribe(() => viewport.set(controller.current));\n effect(() => {\n const { totalCount, rowHeight, overscan } = options();\n untracked(() => controller.update({ totalCount, rowHeight, ...(overscan === undefined ? {} : { overscan }) }));\n }, { injector });\n // Scroll and resize events only update the viewport signal, which schedules\n // change detection itself, so they need not run change detection per event.\n const zone = injector.get(NgZone, null);\n effect(() => {\n const target = element();\n const attach = () => controller.attach(target instanceof ElementRef ? target.nativeElement : target);\n untracked(() => zone ? zone.runOutsideAngular(attach) : attach());\n }, { injector });\n injector.get(DestroyRef).onDestroy(() => controller.dispose());\n return viewport.asReadonly();\n}\n","import { assertInInjectionContext, DestroyRef, effect, ElementRef, inject, Injector, NgZone, signal, untracked, type Signal } from \"@angular/core\";\nimport {\n createQueryViewportController,\n type QueryCollection,\n type QueryViewport,\n type QueryViewportController,\n type QueryViewportOptions,\n type RunicQuery,\n} from \"@runic-artifex/views\";\n\nexport interface InjectQueryCollectionOptions {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n}\n\nexport interface QueryCollectionHandle<TRow> {\n /** The rows to render with their offsets, the spacer's `totalSize`, the total, query, loading and error state. */\n readonly viewport: Signal<QueryViewport<TRow>>;\n /**\n * Measures a rendered row's height until the returned function is called, for example from an `effect` over\n * `viewChildren` of the rows.\n */\n observe(element: Element | ElementRef<Element>, index: number): () => void;\n /** Scrolls to the row with `key` in the current query; resolves `false` when no row has it. */\n scrollToKey(key: string, align?: \"start\" | \"center\" | \"end\"): Promise<boolean>;\n scrollToIndex(index: number, align?: \"start\" | \"center\" | \"end\"): void;\n /** Changes the collection's sort and filter (ViewModel state every presentation shares). */\n setQuery(query: RunicQuery): Promise<void>;\n /** Loads the range again after a failure. */\n retry(): void;\n}\n\nconst empty: QueryViewport<never> = { items: [], totalSize: 0, total: null, query: { sort: [], filters: [] }, loading: false, error: undefined };\n\n/**\n * Follows a scroll container for a query collection (`client.queries.{name}`): it loads the rows the container shows\n * from .NET, with placeholders until they arrive, and lays them out with variable heights. Pass the container, for\n * example `viewChild<ElementRef<HTMLElement>>(\"scroller\")`, the collection as a function such as\n * `() => view.client()?.queries.rows`, and the options.\n */\nexport function injectQueryCollection<TRow>(\n element: Signal<ElementRef<HTMLElement> | HTMLElement | null | undefined>,\n collection: () => QueryCollection<TRow> | undefined,\n options: () => QueryViewportOptions,\n { injector: provided }: InjectQueryCollectionOptions = {},\n): QueryCollectionHandle<TRow> {\n if (!provided) assertInInjectionContext(injectQueryCollection);\n const injector = provided ?? inject(Injector);\n const viewport = signal<QueryViewport<TRow>>(empty);\n const zone = injector.get(NgZone, null);\n const outside = (run: () => void) => zone ? zone.runOutsideAngular(run) : run();\n let controller: QueryViewportController<TRow> | undefined;\n const container = () => {\n const target = untracked(element);\n return target instanceof ElementRef ? target.nativeElement : target ?? null;\n };\n let release: (() => void) | undefined;\n effect(() => {\n const current = collection();\n untracked(() => {\n release?.();\n release = undefined;\n if (!current) { viewport.set(empty); return; }\n const created = controller = createQueryViewportController(current, options());\n const stop = created.subscribe(() => viewport.set(created.current));\n outside(() => created.attach(container()));\n viewport.set(created.current);\n release = () => { stop(); created.dispose(); if (controller === created) controller = undefined; };\n });\n }, { injector });\n effect(() => {\n const { estimateSize, overscan } = options();\n untracked(() => controller?.update({ estimateSize, ...(overscan === undefined ? {} : { overscan }) }));\n }, { injector });\n // Scroll and resize events only update the viewport signal, which schedules change detection itself.\n effect(() => {\n element();\n untracked(() => outside(() => controller?.attach(container())));\n }, { injector });\n injector.get(DestroyRef).onDestroy(() => { release?.(); release = undefined; });\n return {\n viewport: viewport.asReadonly(),\n observe: (target, index) => controller?.observe(target instanceof ElementRef ? target.nativeElement : target, index) ?? (() => {}),\n scrollToKey: async (key, align) => controller ? controller.scrollToKey(key, align) : false,\n scrollToIndex: (index, align) => controller?.scrollToIndex(index, align),\n setQuery: async query => {\n const current = untracked(collection);\n if (!current) throw new TypeError(\"injectQueryCollection has no collection yet.\");\n await current.setQuery(query);\n },\n retry: () => untracked(collection)?.retry(),\n };\n}\n","import { assertInInjectionContext, DestroyRef, inject, Injector, PLATFORM_ID, signal, type Signal } from \"@angular/core\";\nimport { onBridgeConnection, type BridgeConnectionOptions, type BridgeConnectionState } from \"@runic-artifex/views\";\nimport { instanceOf } from \"./instance.js\";\n\nexport interface BridgeConnectionHandle {\n /** The connection to the .NET host, as `onBridgeConnection` reports it. */\n readonly state: Signal<BridgeConnectionState>;\n}\n\nexport interface InjectBridgeConnectionOptions extends BridgeConnectionOptions {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n}\n\n/**\n * Follows the connection of the injection context's Runic instance to its .NET host (`connecting`, `connected`, `reconnecting`,\n * `lost` or `closed`) as a signal through `onBridgeConnection`, for the lifetime of the injection context.\n * Destruction unsubscribes. Under server rendering (`PLATFORM_ID` `\"server\"`) it does not\n * observe and stays `connecting`.\n *\n * ```ts\n * readonly connection = injectBridgeConnection();\n * // @if (connection.state() === \"lost\") { <p role=\"alert\">The application stopped responding.</p> }\n * ```\n */\nexport function injectBridgeConnection(\n { injector: provided, ...options }: InjectBridgeConnectionOptions = {},\n): BridgeConnectionHandle {\n if (!provided) assertInInjectionContext(injectBridgeConnection);\n const injector = provided ?? inject(Injector);\n const state = signal<BridgeConnectionState>(\"connecting\");\n if (injector.get(PLATFORM_ID, null) !== \"server\") {\n const stop = instanceOf(injector).run(() => onBridgeConnection(next => state.set(next), options));\n injector.get(DestroyRef).onDestroy(stop);\n }\n return { state: state.asReadonly() };\n}\n","import {\n assertInInjectionContext, ChangeDetectorRef, computed, DestroyRef, inject, Injector, Pipe, PLATFORM_ID, signal,\n type OnDestroy, type PipeTransform, type Signal,\n} from \"@angular/core\";\nimport {\n onWindowLocale, resolveText, subscribeText, textLocale, textVersion, windowLocale, type FieldError, type RunicInstance,\n type TextReference,\n} from \"@runic-artifex/views\";\n// `translationsTextRevision`: the revision of the Runic Translations text-change channel, which the Translations Vite\n// plugin increments during development when it updates an edited message in place; always 0 in the production build of\n// views, which has no channel.\nimport { translationsTextRevision } from \"@runic-artifex/views/bindings\";\nimport { contextInstance, instanceOf } from \"./instance.js\";\n\nexport interface InjectTextOptions {\n /** Required outside an injection context. */\n readonly injector?: Injector;\n}\n\n/**\n * A text reference that a ViewModel produced, such as a status line or a validation message's `text`, in the window's\n * language (`resolveText`), as a signal that follows a language switch for the lifetime of the injection context.\n * `source` and `fallback` are read in a computed signal, so they may read other signals:\n * `injectText(() => view.state()?.status)`. A string shows as it is; `null` and `undefined` show `fallback`. Configure\n * the page's Translations runtime once with `configureTranslatedText`; without one, a reference shows its fallback text.\n * A field's `FieldError` shows the application's text for it (`configureFieldErrorText`), or its English message.\n * Under server rendering it does not observe a language switch. In templates, the `runicText` pipe does the same.\n *\n * ```ts\n * readonly status = injectText(() => this.view.state()?.status);\n * // <p>{{ status() }}</p>\n * ```\n */\nexport function injectText(\n source: () => TextReference | FieldError | string | null | undefined,\n fallback?: () => string | undefined,\n { injector: provided }: InjectTextOptions = {},\n): Signal<string> {\n if (!provided) assertInInjectionContext(injectText);\n const injector = provided ?? inject(Injector);\n const instance = instanceOf(injector);\n const version = signal(0);\n if (injector.get(PLATFORM_ID, null) !== \"server\") {\n const stop = instance.run(() => subscribeText(() => version.update(value => value + 1)));\n injector.get(DestroyRef).onDestroy(stop);\n }\n return computed(() => {\n version();\n const value = source(), otherwise = fallback?.();\n return instance.run(() => resolveText(value, otherwise));\n });\n}\n\n/**\n * The window's locale that the application set, or `null` while it sets none, as a signal for the lifetime of the\n * injection context, for example to bind `lang`.\n */\nexport function injectWindowLocale({ injector: provided }: InjectTextOptions = {}): Signal<string | null> {\n if (!provided) assertInInjectionContext(injectWindowLocale);\n const injector = provided ?? inject(Injector);\n const instance = instanceOf(injector);\n const locale = signal<string | null>(instance.run(windowLocale));\n if (injector.get(PLATFORM_ID, null) !== \"server\") {\n const stop = instance.run(() => onWindowLocale(next => locale.set(next)));\n injector.get(DestroyRef).onDestroy(stop);\n }\n return locale.asReadonly();\n}\n\nconst textLocales = new WeakMap<RunicInstance, Signal<string | undefined>>();\n\n/**\n * The locale that text is shown in (`textLocale`: the instance's Translations locale, which follows the window's\n * locale), as a signal. It is one signal per Runic instance and needs no injection context, so the page's locale\n * resolver can read it: a template that calls `m.*()` reads the signal through the resolver and renders again on a\n * language switch. During development it also notifies, with the same locale, when the Runic Translations Vite plugin\n * (0.12.0 or later) updates an edited message in place, so OnPush templates show the new text. `undefined` while the\n * instance has no Translations runtime and the application sets no window locale. The instance is `instance`, else\n * that of the injection context, else the page instance.\n *\n * ```ts\n * const textLocale = textLocaleSignal();\n * configureLocaleResolver(() => textLocale() ?? locale.getLocale());\n * ```\n */\nexport function textLocaleSignal(instance: RunicInstance = contextInstance()): Signal<string | undefined> {\n const existing = textLocales.get(instance);\n if (existing) return existing;\n let shown = instance.run(textLocale), revision = translationsTextRevision();\n // It notifies on equal values too: an in-place message update keeps the locale.\n const current = signal<string | undefined>(shown, { equal: () => false });\n instance.run(() => subscribeText(() => {\n const next = instance.run(textLocale), nextRevision = translationsTextRevision();\n if (next === shown && nextRevision === revision) return;\n shown = next;\n revision = nextRevision;\n current.set(next);\n }));\n const locale = current.asReadonly();\n textLocales.set(instance, locale);\n return locale;\n}\n\n/**\n * Shows a text reference in the window's language in a template, and marks the view for check when the language\n * changes: `{{ error.text | runicText: error.message }}`, `{{ state.status | runicText }}`. A string shows as it is;\n * `null` and `undefined` show the fallback argument; a field's error, `{{ name.error() | runicText }}`, the application's\n * text for it (`configureFieldErrorText`). The pipe is impure so that it sees a language switch; it formats\n * again only when the value, the fallback or the language changed, and returns its last text otherwise.\n */\n@Pipe({ name: \"runicText\", standalone: true, pure: false })\nexport class RunicTextPipe implements PipeTransform, OnDestroy {\n private readonly changes = inject(ChangeDetectorRef);\n private readonly instance = instanceOf(inject(Injector));\n private readonly stop = this.instance.run(() => subscribeText(() => this.changes.markForCheck()));\n\n private last: { value: unknown; fallback: string | undefined; version: number; text: string } | undefined;\n\n transform(value: TextReference | FieldError | string | null | undefined, fallback?: string): string {\n const version = this.instance.run(textVersion);\n const last = this.last;\n if (last && last.value === value && last.fallback === fallback && last.version === version) return last.text;\n const text = this.instance.run(() => resolveText(value, fallback));\n this.last = { value, fallback, version, text };\n return text;\n }\n\n ngOnDestroy(): void {\n this.stop();\n }\n}\n","import { assertInInjectionContext, DestroyRef, inject, Injector, PLATFORM_ID, signal, type Signal } from \"@angular/core\";\nimport { appearance, onAppearance, unknownAppearance, type Appearance } from \"@runic-artifex/views\";\nimport { instanceOf } from \"./instance.js\";\n\n/** Options of {@link injectAppearance}. */\nexport interface InjectAppearanceOptions {\n /** The injector to use outside an injection context. */\n readonly injector?: Injector;\n}\n\n/**\n * The appearance of the injection context's Runic instance (`appearance` from `@runic-artifex/views`) as a signal for the lifetime of the injection\n * context: the colour scheme, contrast and reduced motion of the page's engine combined with the desktop's values that a\n * Runic host pushes (`appearance/1`), which also carry the text scale, the accent colour and the forced-colours palette.\n * Every member is `null` under server rendering.\n *\n * ```ts\n * readonly appearance = injectAppearance();\n * readonly animate = computed(() => this.appearance().reducedMotion !== true);\n * ```\n */\nexport function injectAppearance({ injector: provided }: InjectAppearanceOptions = {}): Signal<Appearance> {\n if (!provided) assertInInjectionContext(injectAppearance);\n const injector = provided ?? inject(Injector);\n if (injector.get(PLATFORM_ID, null) === \"server\") return signal(unknownAppearance).asReadonly();\n const instance = instanceOf(injector);\n const current = signal<Appearance>(instance.run(appearance));\n const stop = instance.run(() => onAppearance(next => current.set(next)));\n injector.get(DestroyRef).onDestroy(stop);\n current.set(instance.run(appearance));\n return current.asReadonly();\n}\n","import { assertInInjectionContext, DestroyRef, inject, Injector, PLATFORM_ID, signal, type Signal } from \"@angular/core\";\nimport {\n BridgeError,\n createMenuBarController,\n type MenuBarController,\n type MenuBarControllerOptions,\n type MenuBarRequest,\n type MenuBarState,\n} from \"@runic-artifex/views\";\n\nexport type {\n MenuBarEntry,\n MenuBarInvokeResult,\n MenuBarItem,\n MenuBarMenu,\n MenuBarRequest,\n MenuBarSeparator,\n MenuBarState,\n} from \"@runic-artifex/views\";\nimport { instanceOf } from \"./instance.js\";\n\nexport interface MenuBarHandle {\n /** The menu bar as the page renders it; render a bar only when `placement` is `\"page\"`. */\n readonly state: Signal<MenuBarState>;\n /** Runs an item through the native bar's command path. Rejects with a BridgeError under server rendering. */\n readonly invoke: MenuBarController[\"invoke\"];\n /** Matches a `keydown` event against the items' shortcuts, for the `shortcuts: \"app\"` option. */\n readonly handleKeyDown: MenuBarController[\"handleKeyDown\"];\n}\n\nexport interface InjectMenuBarOptions extends Omit<MenuBarControllerOptions, \"signal\"> {\n /**\n * Receives the `focus` (Alt tap, F10) and `open` (Alt plus a menu's access key) requests: focus the first\n * `cdkMenuItem` of the bar or open a menu's `CdkMenuTrigger`.\n */\n readonly onRequest?: (request: MenuBarRequest) => void;\n /** Required outside an injection context. */\n readonly injector?: Injector;\n}\n\n/**\n * Follows the window's declared menu bar (Runic Desktop's `DesktopMenuBarPresentation.Page`) as a signal, as headless\n * state for the application's own menubar (for example the CDK Menu's `cdkMenuBar`), through\n * `createMenuBarController`, for the lifetime of the injection context. Destruction disposes the controller. Under\n * server rendering (`PLATFORM_ID` `\"server\"`) it creates none and stays `connecting`.\n *\n * ```ts\n * readonly menuBar = injectMenuBar({ onRequest: request => this.onMenuRequest(request) });\n * // @if (menuBar.state().placement === \"page\") { <div cdkMenuBar>…<button cdkMenuItem (cdkMenuItemTriggered)=\"menuBar.invoke(item)\"> }\n * ```\n */\nexport function injectMenuBar({ injector: provided, onRequest, ...options }: InjectMenuBarOptions = {}): MenuBarHandle {\n if (!provided) assertInInjectionContext(injectMenuBar);\n const injector = provided ?? inject(Injector);\n if (injector.get(PLATFORM_ID, null) === \"server\") {\n const state = signal<MenuBarState>(Object.freeze({\n status: \"connecting\", placement: \"none\", shortcuts: options.shortcuts === \"app\" ? \"app\" : \"host\",\n accessKeyHints: false, revision: 0, menus: Object.freeze([]),\n }));\n return {\n state: state.asReadonly(),\n invoke: () => Promise.reject(new BridgeError(\"unavailable\", \"The menu bar is not followed during server rendering.\", { route: \"runic.menu-bar\" })),\n handleKeyDown: () => false,\n };\n }\n const controller = instanceOf(injector).run(() => createMenuBarController(options));\n const state = signal(controller.current);\n controller.subscribe(() => state.set(controller.current));\n if (onRequest) controller.onRequest(onRequest);\n injector.get(DestroyRef).onDestroy(() => controller.dispose());\n return { state: state.asReadonly(), invoke: controller.invoke, handleKeyDown: controller.handleKeyDown };\n}\n"],"mappings":";;;;AAQA,MAAa,iBAAiB,IAAI,eAA8B,kBAAkB;CAChF,YAAY;CACZ,eAAe,gBAAe;AAC/B,CAAA;AAaD,SAAgB,qBAAqB,UAAuB;CAC1D,OAAO;EAAE,SAAS;EAAgB,UAAU;CAAQ;AACtD;AAYA,SAAgB,oBAAoB,EAAE,aAAyC,CAAA,GAAE;CAC/E,IAAI,UAAU,OAAO,WAAW,QAAQ;CACxC,yBAAyB,mBAAmB;CAC5C,OAAO,OAAO,gBAAgB,EAAE,UAAU,KAAI,CAAE,KAAK,gBAAe;AACtE;AAGA,SAAgB,WAAW,UAAkB;CAC3C,OAAO,SAAS,IAAI,gBAAgB,IAAI,KAAK,gBAAe;AAC9D;AAGA,SAAgB,kBAAe;CAC7B,IAAI;EAAE,OAAO,OAAO,gBAAgB,EAAE,UAAU,KAAI,CAAE,KAAK,gBAAe;CAAI,QACxE;EAAE,OAAO,gBAAe;CAAI;AACpC;ACJA,IAAa,aAAb,MAAa,WAAU;CACZ,UAAU,MAA6B,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACv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AAgB,MAAM,IAAI,WAAW,OAAO,CAAC;CACxD,IAAI,WAAW,WAAW,UAAU,SAAS;CAC7C,SAAS,IAAI,UAAU,CAAC,CAAC,gBAAgB,WAAW,QAAO,CAAE;CAC7D,OAAO;EAAE,OAAO,MAAM,WAAU;EAAI,QAAQ,WAAW;EAAQ,eAAe,WAAW;CAAa;AACxG"}
@@ -0,0 +1,85 @@
1
+ import { HostedRegionSizing, HostedRegionState, RunicHostedRegionElement } from "@runic-artifex/views/experimental";
2
+ import * as i0 from "@angular/core";
3
+ import { EnvironmentProviders, Provider, Type } from "@angular/core";
4
+ import { RunicComponentMount } from "@runic-artifex/views/component";
5
+ /** Options of {@link runicComponentMount}. */
6
+ interface RunicComponentMountOptions {
7
+ /**
8
+ * The providers of each element's application, after the ones the mount function adds (zoneless change detection,
9
+ * the element's Runic instance and the shadow root's styles). Leave out the document-level ones, such as the router's
10
+ * history, `provideBrowserGlobalErrorListeners` and `Title`: a component touches no document-level state.
11
+ */
12
+ readonly providers?: ReadonlyArray<Provider | EnvironmentProviders>;
13
+ }
14
+ /**
15
+ * The mount function of an Angular guest's component: the default export of the component build's entry module.
16
+ * Each element of the component gets an Angular application of its own, zoneless, whose `RUNIC_INSTANCE` is the
17
+ * element's Runic instance, and `component`, a standalone component, renders in the element's shadow root. Its styles
18
+ * (`styles`, `styleUrl`, with any `ViewEncapsulation` but `ShadowDom`) become constructable stylesheets of that shadow
19
+ * root. Removing the element destroys the application and removes its stylesheets.
20
+ *
21
+ * ```ts
22
+ * // src/component.ts, the `component.entry` of runic() in vite.config.ts
23
+ * import { runicComponentMount } from "@runic-artifex/angular/experimental";
24
+ * import { Widget } from "./app/widget";
25
+ *
26
+ * export default runicComponentMount(Widget);
27
+ * ```
28
+ */
29
+ export declare function runicComponentMount(component: Type<unknown>, options?: RunicComponentMountOptions): RunicComponentMount;
30
+ /** The `stateChange` output of {@link RunicHostedRegion}. */
31
+ export interface HostedRegionStateChange {
32
+ readonly state: HostedRegionState;
33
+ readonly previous: HostedRegionState;
34
+ }
35
+ /**
36
+ * A region where the host application shows a hosted guest's Window: the component's element is
37
+ * `<runic-hosted-region>` itself, and the page never gets a reference to its frame. Projected content shows while no
38
+ * guest page shows in the region; `state()` tells which state it is in:
39
+ *
40
+ * ```html
41
+ * <runic-hosted-region #check name="check" style="height: 420px" (stateChange)="onState($event)">
42
+ * @if (check.state() === "ended") { <button (click)="runAgain()">Run the check again</button> }
43
+ * @else { <p>Starting the check…</p> }
44
+ * </runic-hosted-region>
45
+ * ```
46
+ */
47
+ export declare class RunicHostedRegion {
48
+ #private;
49
+ /** The region's name, which the host application's policy embeds a guest's Window in. */
50
+ readonly name: import("@angular/core").InputSignal<string>;
51
+ /** `fill` (the default): the page's layout sets the height. `content-height`: the guest's page does. */
52
+ readonly sizing: import("@angular/core").InputSignal<HostedRegionSizing | undefined>;
53
+ /** The region's accessible name; without it, the guest page's title. */
54
+ readonly label: import("@angular/core").InputSignal<string | undefined>;
55
+ readonly stateChange: import("@angular/core").OutputEmitterRef<HostedRegionStateChange>;
56
+ /** The guest page's title as the host passed it on, or `null`. */
57
+ readonly titleChange: import("@angular/core").OutputEmitterRef<string | null>;
58
+ /** What the region shows now. */
59
+ readonly state: import("@angular/core").Signal<HostedRegionState>;
60
+ constructor();
61
+ protected stateChanged(event: Event): void;
62
+ protected titleChanged(event: Event): void;
63
+ static ɵfac: i0.ɵɵFactoryDeclaration<RunicHostedRegion, never>;
64
+ static ɵcmp: i0.ɵɵComponentDeclaration<RunicHostedRegion, "runic-hosted-region", ["runicHostedRegion"], {
65
+ "name": {
66
+ "alias": "name";
67
+ "required": true;
68
+ "isSignal": true;
69
+ };
70
+ "sizing": {
71
+ "alias": "sizing";
72
+ "required": false;
73
+ "isSignal": true;
74
+ };
75
+ "label": {
76
+ "alias": "label";
77
+ "required": false;
78
+ "isSignal": true;
79
+ };
80
+ }, {
81
+ "stateChange": "stateChange";
82
+ "titleChange": "titleChange";
83
+ }, never, ["*"], true, never>;
84
+ }
85
+ export type { HostedRegionSizing, HostedRegionState, RunicComponentMountOptions, RunicHostedRegionElement };
@@ -0,0 +1,72 @@
1
+ import { AbstractControl, ControlValueAccessor, ValidationErrors, Validator } from "@angular/forms";
2
+ import { FieldHandle } from "@runic-artifex/angular";
3
+ import * as i0 from "@angular/core";
4
+ import { WritableSignal } from "@angular/core";
5
+ import { PathKind, SchemaPath, SchemaPathRules } from "@angular/forms/signals";
6
+ /**
7
+ * Wires an `<input>`, `<textarea>` or `<select>` to an {@link injectField} handle: `<input [runicField]="title">`.
8
+ *
9
+ * Alone, it writes what the user types (`input`; `change` for checkboxes, radios and selects), holds writes during IME
10
+ * composition, commits on blur, keeps the element's `value` (or `checked`) equal to the field without moving the
11
+ * caret, and sets `aria-invalid` while the field has an `error` or `errors`.
12
+ *
13
+ * It is also the `ControlValueAccessor` and `Validator` of a `formControl` or `formControlName` on the same element:
14
+ * the View's value flows into the control without marking it dirty or emitting `valueChanges`, the user's input
15
+ * reaches it as usual, `patchValue` and `reset` write through to the View when they change the value, `disable()`
16
+ * disables the element, and the control is invalid with `{ runic: errors }` while the View reports `errors`.
17
+ */
18
+ export declare class RunicFieldDirective implements ControlValueAccessor, Validator {
19
+ /** The field to wire, from {@link injectField}. */
20
+ readonly runicField: import("@angular/core").InputSignal<FieldHandle<unknown>>;
21
+ protected readonly invalid: import("@angular/core").Signal<boolean>;
22
+ private readonly element;
23
+ private readonly injector;
24
+ private composing;
25
+ private changed;
26
+ private touched;
27
+ private validatorChanged;
28
+ private validated;
29
+ private synced;
30
+ constructor();
31
+ private wiring;
32
+ private control;
33
+ private syncControl;
34
+ private changedByUser;
35
+ protected onInput(): void;
36
+ protected onChange(): void;
37
+ protected onCompositionStart(): void;
38
+ protected onCompositionEnd(): void;
39
+ protected onBlur(): void;
40
+ /** A value set by the form (`setValue`, `patchValue`, `reset`): written to the View when it differs from the field's. */
41
+ writeValue(value: unknown): void;
42
+ registerOnChange(fn: (value: unknown) => void): void;
43
+ registerOnTouched(fn: () => void): void;
44
+ setDisabledState(disabled: boolean): void;
45
+ /** `{ runic: errors }` while the View reports validation messages for the field. */
46
+ validate(_control?: AbstractControl): ValidationErrors | null;
47
+ registerOnValidatorChange(fn: () => void): void;
48
+ static ɵfac: i0.ɵɵFactoryDeclaration<RunicFieldDirective, never>;
49
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RunicFieldDirective, "[runicField]", never, {
50
+ "runicField": {
51
+ "alias": "runicField";
52
+ "required": true;
53
+ "isSignal": true;
54
+ };
55
+ }, {}, never, never, true, never>;
56
+ }
57
+ /**
58
+ * A `WritableSignal` over an {@link injectField} handle, for a Signal Forms `form()`: it reads the field's `value`,
59
+ * and `set` and `update` write through the field (`input`), so the form's `[formField]` edits the View.
60
+ *
61
+ * ```ts
62
+ * readonly title = injectField(this.editor, EditorFields.title);
63
+ * readonly titleForm = form(runicFieldModel(this.title), path => validateRunicField(path, this.title));
64
+ * // <input [formField]="titleForm" (blur)="title.commit()">
65
+ * ```
66
+ */
67
+ export declare function runicFieldModel<TValue>(handle: FieldHandle<TValue>): WritableSignal<TValue>;
68
+ /**
69
+ * Adds the field's validation messages (`errors()`) to a Signal Forms schema path as errors of kind `runic`, each
70
+ * with its message.
71
+ */
72
+ export declare function validateRunicField<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, handle: Pick<FieldHandle<unknown>, "errors">): void;