import type { HsonNode, JsonValue } from "../../core/types.js"; import type { LivePathPart, LivePath, LiveMapEditResult } from "../../types/livemap.types.js"; import { type OrderedProjectedValue } from "../../core/ordered-projected-value.js"; /** * Internal physical witness for one data path. This intentionally stays * out of the public LiveMap surface: consumers should continue to use logical * data paths, while internal bridges can reuse the editor's canonical * wrapper traversal. */ export type InternalProjectedHsonLocation = Readonly<{ wrapperPath: readonly number[]; valuePath: readonly number[]; scalarValuePath?: readonly number[]; }>; /** * Parent resolution for a projected LiveMap path. * * `parent` is the value node that owns the final path segment. For the first * mutation slice this must be an object value node. `key` is the final projected * path segment to read or write under that parent. */ type ResolvedParent = Readonly<{ parent: HsonNode; key: LivePathPart; }>; /** * Clone a LiveMap Hson root for staged editor preflight or detached reads. * * Batch validation uses this to prove every editor operation can apply before * mutating the live graph, and `LiveMap.root()` uses it for detached canonical * snapshots. It preserves attrs/meta/content without sharing graph-owned * object identity, including structured style values. */ export declare function clone_live_root(root: HsonNode): HsonNode; /** * Read the projected JSON value at a LiveMap path. * * This is the editor's read entry point. It resolves the data path through * Hson wrapper nodes, unwraps the value payload, and converts that value node * back into ordinary JSON-ish data. */ export declare function snap_live_path(root: HsonNode, path: LivePath): JsonValue | undefined; /** Read one data path as the immutable internal carrier. */ export declare function project_live_path(root: HsonNode, path: LivePath): OrderedProjectedValue | undefined; /** * Resolve a data path to the value payload node at that path. * * Example: for `["user", "name"]`, this returns the `_hson_str` or `_hson_val` * payload inside the `name` property wrapper, not the `name` wrapper itself. */ export declare function resolve_value_node(root: HsonNode, path: LivePath): HsonNode | undefined; /** * Resolve one data path through the same wrapper rules as the editor, * retaining physical canonical paths for internal location/provenance work. */ export declare function resolve_projected_hson_location(root: HsonNode, path: LivePath): InternalProjectedHsonLocation | undefined; /** * Resolve a data path to the wrapper node at that path. * * For object properties this is the user-key wrapper, such as a node with * `$_tag === "name"`. For array items this is the `_hson_ii` wrapper. Keeping * this separate from `resolve_value_node()` is important because mutation often * needs to replace or remove the wrapper, while reads usually want the payload. */ export declare function resolve_wrapper_node(root: HsonNode, path: LivePath): HsonNode | undefined; /** * Resolve the parent value node for a data path. * * This is the mutation-oriented resolver. Given `["user", "name"]`, it returns * the value node for `["user"]` plus the final key `"name"`. */ export declare function resolve_parent_node(root: HsonNode, path: LivePath): ResolvedParent | undefined; /** * Set a data object-property path to a JSON value. * * This is the first mutation slice and is intentionally narrow: * - it supports replacing or adding properties on an already-resolved object * - it does not replace the root yet * - it can replace existing array indexes * - it does not auto-create missing parent containers yet * * The editor path setter only replaces existing array indexes. Higher-level array handle helpers perform append/insert/remove by replacing the scoped array value. * The editor returns raw edit information. Core wraps that into commit/op form. */ export declare function set_live_path(root: HsonNode, path: LivePath, value: JsonValue): LiveMapEditResult; type LiveMapProjectedEditResult = Readonly<{ changed: boolean; prev: OrderedProjectedValue | undefined; next: OrderedProjectedValue | undefined; }>; /** Apply one already-admitted carrier value without rereading JavaScript input. */ export declare function set_live_path_from_projected(root: HsonNode, path: LivePath, nextCarrier: OrderedProjectedValue): LiveMapProjectedEditResult; /** * Delete a data object-property path. * * This first delete slice is intentionally narrow: * - it can remove object properties from an already-resolved object * - missing object properties are unchanged, not errors * - it does not replace or delete the root * - it does not delete array indexes directly; higher-level array handle helpers remove/reorder by replacing the scoped array value * - it does not auto-remove empty parent containers * * The editor returns raw edit information. Core wraps that into commit/op form. */ export declare function delete_live_path(root: HsonNode, path: LivePath): LiveMapEditResult; /** * Replace the projected LiveMap root value in place. * * Core owns a stable root node reference that path handles and subscriptions * close over, so root replacement must overwrite the existing root node rather * than returning a new one. The replacement value is converted through the same * editor-local JSON projection used by path writes. */ export declare function replace_live_root(root: HsonNode, value: JsonValue): LiveMapEditResult; /** Replace the data root from one already-admitted carrier. */ export declare function replace_live_root_from_projected(root: HsonNode, nextCarrier: OrderedProjectedValue): LiveMapProjectedEditResult; /** * Replace the projected LiveMap value at any endpoint path. * * Root replacement preserves the root node object identity. Non-root * replacement swaps the endpoint wrapper under its existing parent, so * unspecified object siblings inside the replaced endpoint are removed while * outer/root identity remains stable. */ export declare function replace_live_path(root: HsonNode, path: LivePath, value: JsonValue): LiveMapEditResult; /** Replace one resolved path from one already-admitted carrier. */ export declare function replace_live_path_from_projected(root: HsonNode, path: LivePath, nextCarrier: OrderedProjectedValue): LiveMapProjectedEditResult; /** * Convert a Hson value node into projected JSON data. * * This is the data-map JSON projection, not a canonical document snapshot. * Unknown/user element nodes retain the historical object fallback for data * compatibility, but document LiveMaps do not expose this lossy reader. */ export declare function node_to_json_value(node: HsonNode): JsonValue; /** Internal exact root installation that preserves the owned root object. */ export declare function overwrite_hson_node(target: HsonNode, source: HsonNode): void; export {}; //# sourceMappingURL=livemap.editor.d.ts.map