import { UseDeepSignalResult } from "@ng-org/alien-deepsignals/svelte4"; import { DiscreteRoot } from "../../types.ts"; /** * Svelte 4 hook to subscribe to discrete (JSON) CRDT documents. * You can modify the returned object like any other JSON object. Changes are immediately * reflected in the CRDT. * * Establishes a 2-way binding: Modifications to the object are immediately committed, * changes coming from the backend (or other components) cause an immediate rerender. * * In comparison to {@link svelte4UseShape}, discrete CRDTs are untyped. * You can put any JSON data inside and need to validate the schema yourself. * * @param documentIdOrPromise The NURI of the CRDT document or a promise to that. * @returns The store of the reactive JSON object of the CRDT document or undefined. * * @example * ```svelte * * *
*
* {#if !doc} * Loading... * {:else if doc.expenses.length === 0} *

* Nothing tracked yet - log your first purchase to kick things off. *

* {:else} * {#each doc.expenses as expense, index (expense['@id']) } * * {/each} * {/if} *
*
* ``` * * --- * In the ExpenseCard component: * ```svelte * let { * expense = $bindable(), * }: { expense: Expense; } = $props(); * * *
* {expense.title = event.currentTarget?.value ?? ""}} * placeholder="Expense title" * /> *
* ``` * */ export declare function useDiscrete(documentIdOrPromise: string | Promise | undefined): { doc: UseDeepSignalResult; }; //# sourceMappingURL=useDiscrete.svelte.d.ts.map