@runic-artifex/svelte

Version 0.7.0-preview.5. Read from the published package.

@runic-artifex/svelte

CollectionViewport re-export
export { CollectionViewport } from '@runic-artifex/views'

Re-exported from CollectionViewport.

CollectionViewportHandle interface
CollectionViewportOptions re-export
export { CollectionViewportOptions } from '@runic-artifex/views'

Re-exported from CollectionViewportOptions.

CommandHandle interface
useCollectionViewport function
function useCollectionViewport(options: () => CollectionViewportOptions): CollectionViewportHandle;

Follows a fixed-row-height scroll container and returns the rows to request from .NET. Call it during component initialization with a getter, such as useCollectionViewport(() => ({ totalCount: rows.state?.totalCount ?? 0, rowHeight: 32 })), and send viewport.start and viewport.size to the ViewModel from an effect.

useCommand function
function useCommand<TArgs extends readonly unknown[], TReturn>(command: (...args: TArgs) => TReturn): CommandHandle<TArgs, Awaited<TReturn>>;

Tracks a command's pending state and failure as reactive properties. The command may close over reactive values:

const increment = useCommand(() => counter.client?.increment());
<button disabled={!counter.client || increment.pending} onclick={() => increment.run()}>…</button>
useView function
function useView<TClient extends ViewClient>(source: () => ViewSource<TClient>): ViewHandle<TClient>;

Connects a generated View reference while the calling component is mounted and exposes its state as reactive properties. Call it during component initialization with a getter, such as useView(() => page), so a changed prop disposes the previous client and connects the new one. A reference is identified by its connect function, so a getter returning a new { connect: connectShell } object does not reconnect.

ViewClient re-export
export { ViewClient } from '@runic-artifex/views'

Re-exported from ViewClient.

ViewConnector re-export
export { ViewConnector } from '@runic-artifex/views'

Re-exported from ViewConnector.

ViewHandle interface
ViewOutlet constant
const ViewOutlet: $$IsomorphicComponent;
type ViewOutlet<R extends ViewReference> = InstanceType<typeof ViewOutlet<R>>;

No documentation.

ViewReference re-export
export { ViewReference } from '@runic-artifex/views'

Re-exported from ViewReference.

ViewRegistry type alias
type ViewRegistry<R extends ViewReference> = {
    readonly [K in R["kind"]]: Component<{
        page: Extract<R, {
            readonly kind: K;
        }>;
    }>;
};

Compile-time check that every View kind has a component with a matching page prop.

ViewSource re-export
export { ViewSource } from '@runic-artifex/views'

Re-exported from ViewSource.

@runic-artifex/svelte/views

CollectionViewport re-export
export { CollectionViewport } from '@runic-artifex/views'

Re-exported from CollectionViewport.

CollectionViewportHandle interface
CollectionViewportOptions re-export
export { CollectionViewportOptions } from '@runic-artifex/views'

Re-exported from CollectionViewportOptions.

CommandHandle interface
useCollectionViewport function
function useCollectionViewport(options: () => CollectionViewportOptions): CollectionViewportHandle;

Follows a fixed-row-height scroll container and returns the rows to request from .NET. Call it during component initialization with a getter, such as useCollectionViewport(() => ({ totalCount: rows.state?.totalCount ?? 0, rowHeight: 32 })), and send viewport.start and viewport.size to the ViewModel from an effect.

useCommand function
function useCommand<TArgs extends readonly unknown[], TReturn>(command: (...args: TArgs) => TReturn): CommandHandle<TArgs, Awaited<TReturn>>;

Tracks a command's pending state and failure as reactive properties. The command may close over reactive values:

const increment = useCommand(() => counter.client?.increment());
<button disabled={!counter.client || increment.pending} onclick={() => increment.run()}>…</button>
useView function
function useView<TClient extends ViewClient>(source: () => ViewSource<TClient>): ViewHandle<TClient>;

Connects a generated View reference while the calling component is mounted and exposes its state as reactive properties. Call it during component initialization with a getter, such as useView(() => page), so a changed prop disposes the previous client and connects the new one. A reference is identified by its connect function, so a getter returning a new { connect: connectShell } object does not reconnect.

ViewClient re-export
export { ViewClient } from '@runic-artifex/views'

Re-exported from ViewClient.

ViewConnector re-export
export { ViewConnector } from '@runic-artifex/views'

Re-exported from ViewConnector.

ViewHandle interface
ViewOutlet constant
const ViewOutlet: $$IsomorphicComponent;
type ViewOutlet<R extends ViewReference> = InstanceType<typeof ViewOutlet<R>>;

No documentation.

ViewReference re-export
export { ViewReference } from '@runic-artifex/views'

Re-exported from ViewReference.

ViewRegistry type alias
type ViewRegistry<R extends ViewReference> = {
    readonly [K in R["kind"]]: Component<{
        page: Extract<R, {
            readonly kind: K;
        }>;
    }>;
};

Compile-time check that every View kind has a component with a matching page prop.

ViewSource re-export
export { ViewSource } from '@runic-artifex/views'

Re-exported from ViewSource.