import { YjsProxiableValue, YjsProxy } from './types'; import * as Y from "yjs"; /** * Maps a Y.js value to its alias group (a set of Y.js values that should stay in sync). * When any member is mutated, the mutation is propagated to all siblings. * @internal */ export declare const aliasGroups: WeakMap, Set>>; /** * Maps a proxy to its alias group (a set of proxies that should stay in sync). * This is used to track aliases at the proxy level, which persists across attach/detach. * @internal */ export declare const proxyAliasGroups: WeakMap>; /** * Maps original JS objects to the first Y.js value created from them. * Used to track aliases across separate conversion operations. * @internal */ export declare const jsObjectToFirstYjsValue: WeakMap; /** * Gets the alias group for a Y.js value, or undefined if it has no aliases. * @internal */ export declare function getAliasGroup(yjsValue: YjsProxiableValue): Set> | undefined; /** * Links two Y.js values as aliases of each other. * Mutations to one will be propagated to the other. * @internal */ export declare function linkAliases(a: YjsProxiableValue, b: YjsProxiableValue): void; /** * Removes a Y.js value from its alias group (e.g., when deleted from document). * @internal */ export declare function unlinkAlias(yjsValue: YjsProxiableValue): void; /** * Gets siblings (other members of the alias group) for a Y.js value. * Only returns siblings in the same Y.Doc (cross-doc aliases are ignored). * Returns empty array if no aliases. * @internal */ export declare function getAliasSiblings(yjsValue: YjsProxiableValue): YjsProxiableValue[]; /** * Checks if two Y.js values are aliases of each other (part of the same alias group). * Two values are aliases if they originated from the same JS object reference * during conversion(s) and mutations to one will propagate to the other. * * @param a First Y.js value (Y.Map or Y.Array) * @param b Second Y.js value (Y.Map or Y.Array) * @returns `true` if the values are aliases, `false` otherwise */ export declare function areYjsValuesAliased(a: YjsProxiableValue, b: YjsProxiableValue): boolean; /** * Links two proxies as aliases of each other at the proxy level. * This is separate from Y.js value aliasing and persists across attach/detach. * @internal */ export declare function linkProxyAliases(a: YjsProxy, b: YjsProxy): void; /** * Gets proxy siblings (other members of the proxy alias group). * Returns empty array if no aliases. * @internal */ export declare function getProxyAliasSiblings(proxy: YjsProxy): YjsProxy[]; /** * Checks if two proxies are aliases of each other at the proxy level. * @internal */ export declare function areProxiesAliased(a: YjsProxy, b: YjsProxy): boolean; /** * Links a newly created proxy with sibling proxies from Y.js-level aliases. * Only links with siblings that already have proxies. * * @param proxy The newly created proxy * @param yjsValue The Y.js value the proxy wraps * @internal */ export declare function linkProxyWithExistingSiblings(proxy: YjsProxy, yjsValue: YjsProxiableValue): void; /** * Applies operations to a proxy and all its alias siblings. * Handles both attached (Y.js) and detached (JSON) modes, applying the appropriate function * to the original and propagating to all siblings. * * Note: `linkProxyWithExistingSiblings` eagerly creates proxies for Y.js siblings that exist * at proxy creation time. However, new Y.js aliases can be created later, so we also check * Y.js-level siblings to ensure all aliases receive mutations. * * @param proxy The proxy to apply operations to * @param yjsFn Function to apply to attached Y.js values (Y.Map or Y.Array) * @param jsonFn Function to apply to detached JSON values (object or array) * @internal */ export declare function applyToAllAliases(proxy: YjsProxy, yjsFn: (yjsValue: T) => void, jsonFn: (json: J) => void): void;