/* * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ import { TreeActions, UseTreeActionsOptions } from "../types.js"; import "client-only"; //#region src/hooks/use-tree/actions/index.d.ts /** * Stateless hook that provides tree transformation operations without managing state. * * Returns pure functions that accept tree nodes and return new transformed tree nodes. * Does not modify the input tree - all operations are immutable transformations. * Each operation returns the complete updated tree structure. Use this hook when you * want to manage tree state yourself, or when integrating with external state management. * For complete state management, use {@link useTreeState} instead. * * Note: Each operation returns the whole tree. Future iterations might return only * the changed portion of the tree for performance optimization. * * @template T - The type of custom values stored in tree nodes (accessed via `node.values`). * * @param options - Configuration options for tree actions. * @param options.nodes - Current tree nodes to operate on. Used to build internal cache for operations. * @param options.selectionCascade - Enable cascade selection mode. When true, selection operations * automatically propagate to descendants and update parent indeterminate states. Default: false. * @returns Object containing all tree manipulation functions (insert, move, remove, select, expand, etc.). * * @example * ```tsx * // Basic usage with custom state management * const [tree, setTree] = useState(initialTree); * const actions = useTreeActions({ nodes: tree }); * * // Insert a new node * const updatedTree = actions.insertAfter('child1', [ * { key: 'newChild', label: 'New Child' } * ]); * setTree(updatedTree); * * // Move nodes * const movedTree = actions.moveInto('parent', new Set(['child1', 'child2'])); * setTree(movedTree); * * // Cascade selection * const actionsWithCascade = useTreeActions({ * nodes: tree, * selectionCascade: true * }); * const selectedTree = actionsWithCascade.onSelectionChange(new Set(['parent'])); * // All descendants of 'parent' are now selected too * ``` */ declare function useTreeActions({ nodes, selectionCascade }: UseTreeActionsOptions): TreeActions; //#endregion export { useTreeActions }; //# sourceMappingURL=index.d.ts.map