From 969164e41a5538b9f7a06bb046c9eb6a159e74ff Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 18 Apr 2022 01:48:44 +0000 Subject: [PATCH] chore(release): 1.1.3 ## [1.1.3](https://github.com/jaredLunde/exploration/compare/v1.1.2...v1.1.3) (2022-04-18) ### Bug Fixes * remove subpath from package.json ([#11](https://github.com/jaredLunde/exploration/issues/11)) ([dd87773](https://github.com/jaredLunde/exploration/commit/dd87773b3c0f7c85cb732f8a91bbbd7fc96d0366)) --- CHANGELOG.md | 7 ++ package.json | 2 +- types/file-tree.d.ts | 203 +++++++++++++++++++++++++++++++++ types/index.d.ts | 24 ++++ types/node.d.ts | 36 ++++++ types/observable-data.d.ts | 15 +++ types/path-fx.d.ts | 65 +++++++++++ types/tree/branch.d.ts | 41 +++++++ types/tree/leaf.d.ts | 32 ++++++ types/tree/nodes-by-id.d.ts | 2 + types/tree/observable.d.ts | 25 ++++ types/tree/tree.d.ts | 72 ++++++++++++ types/tsconfig.tsbuildinfo | 1 + types/types.d.ts | 2 + types/use-deferred-value.d.ts | 6 + types/use-dnd.d.ts | 89 +++++++++++++++ types/use-filter.d.ts | 10 ++ types/use-hotkeys.d.ts | 37 ++++++ types/use-node-plugins.d.ts | 29 +++++ types/use-observable.d.ts | 8 ++ types/use-resize-observer.d.ts | 5 + types/use-roving-focus.d.ts | 26 +++++ types/use-selections.d.ts | 51 +++++++++ types/use-traits.d.ts | 65 +++++++++++ types/use-transition.d.ts | 2 + types/use-virtualize.d.ts | 164 ++++++++++++++++++++++++++ types/use-visible-nodes.d.ts | 13 +++ types/utils.d.ts | 28 +++++ 28 files changed, 1059 insertions(+), 1 deletion(-) create mode 100644 types/file-tree.d.ts create mode 100644 types/index.d.ts create mode 100644 types/node.d.ts create mode 100644 types/observable-data.d.ts create mode 100644 types/path-fx.d.ts create mode 100644 types/tree/branch.d.ts create mode 100644 types/tree/leaf.d.ts create mode 100644 types/tree/nodes-by-id.d.ts create mode 100644 types/tree/observable.d.ts create mode 100644 types/tree/tree.d.ts create mode 100644 types/tsconfig.tsbuildinfo create mode 100644 types/types.d.ts create mode 100644 types/use-deferred-value.d.ts create mode 100644 types/use-dnd.d.ts create mode 100644 types/use-filter.d.ts create mode 100644 types/use-hotkeys.d.ts create mode 100644 types/use-node-plugins.d.ts create mode 100644 types/use-observable.d.ts create mode 100644 types/use-resize-observer.d.ts create mode 100644 types/use-roving-focus.d.ts create mode 100644 types/use-selections.d.ts create mode 100644 types/use-traits.d.ts create mode 100644 types/use-transition.d.ts create mode 100644 types/use-virtualize.d.ts create mode 100644 types/use-visible-nodes.d.ts create mode 100644 types/utils.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b5b62b..4f4ea14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.1.3](https://github.com/jaredLunde/exploration/compare/v1.1.2...v1.1.3) (2022-04-18) + + +### Bug Fixes + +* remove subpath from package.json ([#11](https://github.com/jaredLunde/exploration/issues/11)) ([dd87773](https://github.com/jaredLunde/exploration/commit/dd87773b3c0f7c85cb732f8a91bbbd7fc96d0366)) + ## [1.1.2](https://github.com/jaredLunde/exploration/compare/v1.1.1...v1.1.2) (2022-04-13) ### Bug Fixes diff --git a/package.json b/package.json index 9ed5a28..3a42b68 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "exploration", - "version": "1.1.2", + "version": "1.1.3", "description": "", "license": "MIT", "author": "Jared Lunde (https://jaredlunde.com/)", diff --git a/types/file-tree.d.ts b/types/file-tree.d.ts new file mode 100644 index 0000000..f5b9125 --- /dev/null +++ b/types/file-tree.d.ts @@ -0,0 +1,203 @@ +import { Branch } from "./tree/branch"; +import { Leaf } from "./tree/leaf"; +import type { GetNodes as GetNodesBase } from "./tree/tree"; +import { Tree } from "./tree/tree"; +/** + * Create a file tree that can be used with the React API. + * + * @param getNodes - A function that returns the nodes of the file tree. + * @param config - Configuration options for the file tree. + * @param config.comparator - A function that compares two nodes for sorting. + * @param config.root - The root node data of the file tree. + */ +export declare function createFileTree(getNodes: GetNodes, config?: FileTreeConfig): FileTree; +export declare class FileTree extends Tree> { + /** + * The root directory of the file tree + */ + root: Dir; + protected treeNodeMap: Map | Dir>; + nodesById: FileTreeNode[]; + /** + * Get a node by its ID. + * + * @param id - The ID of the node + */ + getById: (id: number) => FileTreeNode | undefined; + /** + * Expand a directory in the tree. + * + * @param dir - The directory to expand + * @param options - Options for expanding the directory + */ + expand: (dir: Dir, options?: { + /** + * Ensure that the directory's parents are visible in the tree, as well. + */ + ensureVisible?: boolean; + /** + * Expand all of the directory's child directories. + */ + recursive?: boolean; + }) => Promise; + /** + * Collapse a directory in the tree. + * + * @param dir - The directory to collapse + */ + collapse: (dir: Dir) => void; + /** + * Remove a node and its descendants from the tree. + */ + remove: (node: FileTreeNode) => void; + /** + * You can use this method to manually trigger a reload of a directory in the tree. + * + * @param dir - The branch to load nodes for + */ + loadNodes: (dir: Dir) => Promise; + constructor({ getNodes, comparator, root, }: { + getNodes: GetNodesBase>; + comparator: (a: FileTreeNode, b: FileTreeNode) => number; + root: Dir; + }); + /** + * Produce a new tree with the given function applied to the given node. + * This is similar to `immer`'s produce function as you're working on a draft + * and can freely mutate the object. + * + * @param dir - The directory to produce the tree for + * @param produceFn - The function to produce the tree with + */ + produce(dir: Dir, produceFn: (context: FileTreeFactory & { + /** + * The draft of the directory. + */ + get draft(): FileTreeNode[]; + /** + * Insert a node into the draft. + * + * @param node - The node to insert + */ + insert>(node: NodeType): NodeType; + /** + * Revert the draft back to its original state. + */ + revert(): void; + }) => void | (Dir | File)[]): void; + /** + * Move a node to a new parent. + * + * @param node - The node to move + * @param to - The new parent + */ + move(node: FileTreeNode, to: Dir): Promise; + /** + * Create a new file in a given directory. + * + * @param inDir - The directory to create the file in + * @param withData - The data for the file + */ + newFile(inDir: Dir, withData: FileTreeData): void; + /** + * Create a new directory in a given directory. + * + * @param inDir - The directory to create the directory in + * @param withData - The data for the directory + * @param expanded - Whether the directory should be expanded by default + */ + newDir(inDir: Dir, withData: FileTreeData, expanded?: boolean): void; + /** + * Rename a node. + * + * @param node - The node to rename + * @param newName - The new name for the node + */ + rename(node: FileTreeNode, newName: string): void; +} +export declare class File extends Leaf> { + /** + * The parent directory of the file + */ + get parent(): Dir | null; + /** + * The basename of the file + */ + get basename(): string; + /** + * The full path of the file + */ + get path(): string; +} +export declare class Dir extends Branch> { + /** + * The parent directory of this directory + */ + get parent(): Dir | null; + /** + * The basename of the directory + */ + get basename(): string; + /** + * The full path of the directory + */ + get path(): string; +} +/** + * A sort comparator for sorting path names + * + * @param a - A tree node + * @param b - A tree node to compare against `a` + */ +export declare function defaultComparator(a: FileTreeNode, b: FileTreeNode): number; +/** + * Returns `true` if the given node is a file + * + * @param treeNode - A tree node + */ +export declare function isFile(treeNode: FileTreeNode): treeNode is File; +/** + * Returns `true` if the given node is a directory + * + * @param treeNode - A tree node + */ +export declare function isDir(treeNode: FileTreeNode): treeNode is Dir; +export declare type FileTreeNode = File | Dir; +export declare type FileTreeData = { + name: string; + meta?: Meta; +}; +export declare type FileTreeFactory = { + /** + * Create a file node that can be inserted into the tree. + * + * @param data - The data to create a file with + */ + createFile(data: FileTreeData): File; + /** + * Create a directory node that can be inserted into the tree. + * + * @param data - The data to create a directory with + * @param expanded - Should the directory be expanded by default? + */ + createDir(data: FileTreeData, expanded?: boolean): Dir; +}; +export declare type GetNodes = { + /** + * Get the nodes for a given directory + * + * @param parent - The parent directory to get the nodes for + * @param factory - A factory to create nodes (file/dir) with + */ + (parent: Dir, factory: FileTreeFactory): Promise[]> | FileTreeNode[]; +}; +export declare type FileTreeConfig = { + /** + * A function that compares two nodes for sorting. + */ + comparator?: FileTree["comparator"]; + /** + * The root node data + */ + root?: Omit, "type">; +}; diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..c2341ec --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,24 @@ +export { createFileTree, defaultComparator, isDir, isFile, FileTree, Dir, File, } from "./file-tree"; +export type { FileTreeNode, FileTreeData, FileTreeFactory } from "./file-tree"; +export { Node } from "./node"; +export { ObservableMap, ObservableSet } from "./observable-data"; +export * as pathFx from "./path-fx"; +export { observable } from "./tree/observable"; +export type { Observable } from "./tree/observable"; +export { useDnd } from "./use-dnd"; +export type { DndEvent, DndProps, UseDndPlugin, UseDndConfig } from "./use-dnd"; +export { useFilter } from "./use-filter"; +export { useHotkeys } from "./use-hotkeys"; +export { useNodePlugins } from "./use-node-plugins"; +export type { NodePlugin } from "./use-node-plugins"; +export { useObservable } from "./use-observable"; +export { useTraits } from "./use-traits"; +export type { TraitsProps, UseTraitsPlugin } from "./use-traits"; +export { useRovingFocus } from "./use-roving-focus"; +export type { RovingFocusProps, UseRovingFocusPlugin, } from "./use-roving-focus"; +export { useSelections } from "./use-selections"; +export type { SelectionsProps, UseSelectionsPlugin } from "./use-selections"; +export { useVirtualize } from "./use-virtualize"; +export type { UseVirtualizeConfig, UseVirtualizeResult, } from "./use-virtualize"; +export { useVisibleNodes } from "./use-visible-nodes"; +export { mergeProps } from "./utils"; diff --git a/types/node.d.ts b/types/node.d.ts new file mode 100644 index 0000000..de16d69 --- /dev/null +++ b/types/node.d.ts @@ -0,0 +1,36 @@ +import * as React from "react"; +import type { FileTree, FileTreeNode } from "./file-tree"; +import type { NodePlugin } from "./use-node-plugins"; +/** + * A React component that renders a node in a file tree with plugins. The + * `` component uses this under the hood. + * + * @param props - Node props + */ +export declare function Node(props: NodeProps): React.DetailedReactHTMLElement, HTMLElement>; +export interface NodeProps { + /** + * A file tree node + */ + node: FileTreeNode; + /** + * The index of the node within the file tree list of visible nodes + */ + index: number; + /** + * The file tree that contains the node + */ + tree: FileTree; + /** + * A list of plugins to apply to the node. For example `useTraits()`. + */ + plugins?: NodePlugin[]; + /** + * Styles to apply to the `
` element + */ + style: React.CSSProperties; + /** + * Children to render within the node + */ + children: React.ReactNode; +} diff --git a/types/observable-data.d.ts b/types/observable-data.d.ts new file mode 100644 index 0000000..3b6011c --- /dev/null +++ b/types/observable-data.d.ts @@ -0,0 +1,15 @@ +import type { Observable } from "./tree/observable"; +export declare class ObservableSet extends Set { + didChange: Observable>; + constructor(initialValue?: T[]); + add(value: T): this; + delete(value: T): boolean; + clear(): this; +} +export declare class ObservableMap extends Map { + didChange: Observable>; + constructor(initialValue?: [K, V][]); + set(key: K, value: V): this; + delete(key: K): boolean; + clear(): this; +} diff --git a/types/path-fx.d.ts b/types/path-fx.d.ts new file mode 100644 index 0000000..5802c71 --- /dev/null +++ b/types/path-fx.d.ts @@ -0,0 +1,65 @@ +export { default as isRelative } from "is-relative"; +/** + * Join all arguments together and normalize the resulting path. + * + * @param paths - The paths to join + */ +export declare function join(...paths: string[]): string; +/** + * Solve the relative path from `from` to `to`. Paths must be absolute. + * + * @param from - The absolute path to start from + * @param to - The absolute path to solve to + */ +export declare function relative(from: string, to: string): string; +/** + * Splits a path into an array of path segments. + * + * @param path - The path to split. + */ +export declare function split(path: string): string[]; +/** + * Normalize a path, taking care of `..` and `.`, and removing redundant slashes. + * Unlike Node's `path`, this removes any trailing slashes. + * + * @param path - The path to normalize. + */ +export declare function normalize(path: string): string; +/** + * Returns `true` if `path` is inside `dir`. + * + * @param path - The path to check + * @param dir - The directory to check if the path is inside of. + */ +export declare function isPathInside(path: string, dir: string): boolean; +/** + * Get the depth of a path. + * + * @param path - The path to split. + */ +export declare function depth(path: string): number; +/** + * Return the last fragment of a path. + * + * @param path - The path to get the basename of. + */ +export declare function basename(path: string): string; +/** + * Returns the extension of a file path, which is the part of the path after the last `.`. + * If the path has no extension, returns an empty string. + * + * @param path - The path to get the extension of. + */ +export declare function extname(path: string): string; +/** + * Return the directory name of a path. + * + * @param path - The path to get the directory name of. + */ +export declare function dirname(path: string): string; +/** + * Remove any trailing slashes from a path. + * + * @param path - The path to remove trailing slashes from. + */ +export declare function removeTrailingSlashes(path: string): string; diff --git a/types/tree/branch.d.ts b/types/tree/branch.d.ts new file mode 100644 index 0000000..b457e87 --- /dev/null +++ b/types/tree/branch.d.ts @@ -0,0 +1,41 @@ +import { Leaf } from "./leaf"; +export declare class Branch extends Leaf { + /** + * The child node IDs of this branch + */ + nodes?: number[]; + /** + * A flag indicating the "intended" expansion status of this branch. If this is `true`, the branch + * is either already expanded OR is about to be expanded. Explained below. + * + * This value represents the "intended" expansion state not the "actual" expansion state. When + * `Tree#expand` is called, the value of this will be immediately become `true`, however because + * the child nodes of the branch in question might need to be loaded, the actual expansion won't + * take effect until the children are loaded. So in that interim time while children are loading, + * the branch isn't truly expanded even if the value is `true`. + * + * Depending on your use case you might want to rely on `Tree#isExpanded` for a "real-time" status. + */ + expanded: boolean; + constructor( + /** + * The parent node + */ + parent: Branch | null, + /** + * The data for this node + */ + data: NodeData, + /** + * Is the branch expanded? + */ + expanded?: boolean); + /** + * Returns `true` if the node is a child of this branch, regardless of + * depth. + * + * @param node - A tree node + */ + contains(node: Node): boolean; +} +export declare type Node = Leaf | Branch; diff --git a/types/tree/leaf.d.ts b/types/tree/leaf.d.ts new file mode 100644 index 0000000..508e8f9 --- /dev/null +++ b/types/tree/leaf.d.ts @@ -0,0 +1,32 @@ +import type { Branch } from "./branch"; +export declare class Leaf { + /** + * The data for this node + */ + data: NodeData; + /** + * The unique ID of the node + */ + readonly id: number; + /** + * The ID of the parent node + */ + parentId: number; + constructor( + /** + * The parent node + */ + parent: Branch | null, + /** + * The data for this node + */ + data: NodeData); + /** + * The parent node + */ + get parent(): Branch | null; + /** + * The depth of the node in the tree + */ + get depth(): number; +} diff --git a/types/tree/nodes-by-id.d.ts b/types/tree/nodes-by-id.d.ts new file mode 100644 index 0000000..a9ecd03 --- /dev/null +++ b/types/tree/nodes-by-id.d.ts @@ -0,0 +1,2 @@ +import type { Node } from "./branch"; +export declare const nodesById: Node[]; diff --git a/types/tree/observable.d.ts b/types/tree/observable.d.ts new file mode 100644 index 0000000..d761727 --- /dev/null +++ b/types/tree/observable.d.ts @@ -0,0 +1,25 @@ +/** + * A utility for emitting abd subscribing to changes to a value. + * + * @param initialValue - The initial value of the observable. + */ +export declare function observable(initialValue: T): Observable; +export declare function pureObservable(initialValue: T, areEqual?: (current: T, next: T) => boolean): Observable; +export declare type Observable = { + /** + * Emit a new value. + * + * @param value - The new value + */ + next(value: T): void; + /** + * Get the current value. + */ + getSnapshot(): T; + /** + * Subscribe to changes to the value. + * + * @param callback - A callback that is invoked when the value changes + */ + subscribe(callback: (value: T) => void): () => void; +}; diff --git a/types/tree/tree.d.ts b/types/tree/tree.d.ts new file mode 100644 index 0000000..aeab1ad --- /dev/null +++ b/types/tree/tree.d.ts @@ -0,0 +1,72 @@ +import type { Node } from "./branch"; +import { Branch } from "./branch"; +import { Leaf } from "./leaf"; +export declare class Tree { + private pendingLoadChildrenRequests; + private getNodes; + comparator?: (a: Node, b: Node) => number; + flatView: import("./observable").Observable; + root: Branch; + nodesById: Node[]; + constructor({ getNodes, root, comparator, }: { + getNodes: GetNodes; + root: Branch; + comparator?: (a: Node, b: Node) => number; + }); + get visibleNodes(): number[]; + getById(id: number): Node | undefined; + /** + * Ensures that the children of any given branch have been loaded and ready to be worked with. + * + * Call this method without any arguments to check if the root branch is loaded. + * + * ⚠ "Loaded" doesn't mean expanded, it just means the contents are "ready". Except when no arguments are given, the + * branch being checked is root, and root is always expanded. + * + * @param branch - The branch to check + */ + ensureLoaded(branch?: Branch): Promise; + expand(branch: Branch, options?: { + ensureVisible?: boolean; + recursive?: boolean; + }): Promise; + collapse(branch: Branch): void; + protected _produce(branch: Branch, produceFn: (context: { + get draft(): Node[]; + insert>(node: NodeType, insertionIndex?: number): NodeType; + revert(): void; + }) => void | Node[]): void; + remove(nodeToRemove: Node): void; + move(node: Node, to: Branch): Promise; + invalidateFlatView(): void; + /** + * A more accurate and real-time representation of whether a branch is expanded. + * + * `Branch#expanded` represents the "optimistic" expansion state of the branch in + * question not the actual status, because the child nodes might still need to be + * loaded before the change can be seen in the tree. + * + * @param branch - The branch to check + */ + isExpanded(branch: Branch): boolean; + /** + * Returns `true` if the node and its parents are visible in the tree. + * + * @param node - The node to check + */ + isVisible(node: Node): boolean; + /** + * You can use this method to manually trigger a reload of a branch in the tree. + * + * @param branch - The branch to load nodes for + */ + loadNodes(branch: Branch): Promise; + protected setNodes(branch: Branch, nodeIds: number[] | Node[]): void; + private createVisibleNodes; + dispose(): void; +} +export declare function isLeaf(node: Node | undefined): node is Leaf; +export declare function isBranch(node: Node | undefined): node is Branch; +export declare type GetNodes = { + (parent: Branch): Node[] | Promise[]>; +}; diff --git a/types/tsconfig.tsbuildinfo b/types/tsconfig.tsbuildinfo new file mode 100644 index 0000000..79fa61d --- /dev/null +++ b/types/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"program":{"fileNames":["../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es5.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.esnext.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.dom.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/.pnpm/typescript@4.6.3/node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/.pnpm/@types+react@18.0.0/node_modules/@types/react/global.d.ts","../node_modules/.pnpm/csstype@3.0.11/node_modules/csstype/index.d.ts","../node_modules/.pnpm/@types+prop-types@15.7.4/node_modules/@types/prop-types/index.d.ts","../node_modules/.pnpm/@types+scheduler@0.16.2/node_modules/@types/scheduler/tracing.d.ts","../node_modules/.pnpm/@types+react@18.0.0/node_modules/@types/react/index.d.ts","../src/tree/observable.ts","../src/use-observable.ts","../node_modules/.pnpm/trie-memoize@1.2.0/node_modules/trie-memoize/types/index.d.ts","../node_modules/.pnpm/@types+is-relative@1.0.0/node_modules/@types/is-relative/index.d.ts","../src/path-fx.ts","../src/tree/nodes-by-id.ts","../src/tree/leaf.ts","../src/tree/branch.ts","../node_modules/.pnpm/@essentials+memoize-one@1.1.0/node_modules/@essentials/memoize-one/types/index.d.ts","../src/tree/tree.ts","../src/file-tree.ts","../src/observable-data.ts","../node_modules/.pnpm/@types+use-sync-external-store@0.0.3/node_modules/@types/use-sync-external-store/index.d.ts","../node_modules/.pnpm/@types+use-sync-external-store@0.0.3/node_modules/@types/use-sync-external-store/shim/index.d.ts","../src/use-visible-nodes.ts","../src/use-selections.ts","../node_modules/.pnpm/clsx@1.1.1/node_modules/clsx/clsx.d.ts","../src/utils.ts","../src/use-dnd.ts","../node_modules/.pnpm/@essentials+request-timeout@1.3.0/node_modules/@essentials/request-timeout/types/index.d.ts","../src/use-deferred-value.ts","../src/use-node-plugins.ts","../src/node.tsx","../src/use-filter.ts","../node_modules/.pnpm/@react-hook+hotkey@3.1.0_react@18.0.0/node_modules/@react-hook/hotkey/types/index.d.ts","../src/types.ts","../src/use-roving-focus.ts","../src/use-hotkeys.ts","../src/use-traits.ts","../node_modules/.pnpm/@types+use-subscription@1.0.0/node_modules/@types/use-subscription/index.d.ts","../src/use-resize-observer.ts","../src/use-transition.ts","../src/use-virtualize.ts","../src/index.ts","../node_modules/.pnpm/@types+aria-query@4.2.2/node_modules/@types/aria-query/index.d.ts","../node_modules/.pnpm/@babel+types@7.17.0/node_modules/@babel/types/lib/index.d.ts","../node_modules/.pnpm/@types+babel__generator@7.6.4/node_modules/@types/babel__generator/index.d.ts","../node_modules/.pnpm/@babel+parser@7.17.9/node_modules/@babel/parser/typings/babel-parser.d.ts","../node_modules/.pnpm/@types+babel__template@7.4.1/node_modules/@types/babel__template/index.d.ts","../node_modules/.pnpm/@types+babel__traverse@7.14.2/node_modules/@types/babel__traverse/index.d.ts","../node_modules/.pnpm/@types+babel__core@7.1.19/node_modules/@types/babel__core/index.d.ts","../node_modules/.pnpm/@types+estree@0.0.39/node_modules/@types/estree/index.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/assert.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/assert/strict.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/globals.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/async_hooks.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/buffer.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/child_process.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/cluster.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/console.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/constants.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/crypto.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/dgram.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/dns.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/dns/promises.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/domain.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/events.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/fs.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/fs/promises.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/http.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/http2.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/https.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/inspector.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/module.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/net.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/os.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/path.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/perf_hooks.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/process.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/punycode.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/querystring.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/readline.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/repl.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/stream.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/stream/promises.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/stream/consumers.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/stream/web.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/string_decoder.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/timers.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/timers/promises.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/tls.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/trace_events.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/tty.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/url.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/util.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/v8.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/vm.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/wasi.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/worker_threads.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/zlib.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/globals.global.d.ts","../node_modules/.pnpm/@types+node@17.0.23/node_modules/@types/node/index.d.ts","../node_modules/.pnpm/@types+graceful-fs@4.1.5/node_modules/@types/graceful-fs/index.d.ts","../node_modules/.pnpm/@types+istanbul-lib-coverage@2.0.4/node_modules/@types/istanbul-lib-coverage/index.d.ts","../node_modules/.pnpm/@types+istanbul-lib-report@3.0.0/node_modules/@types/istanbul-lib-report/index.d.ts","../node_modules/.pnpm/@types+istanbul-reports@3.0.1/node_modules/@types/istanbul-reports/index.d.ts","../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/index.d.ts","../node_modules/.pnpm/jest-diff@27.5.1/node_modules/jest-diff/build/cleanupSemantic.d.ts","../node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/types.d.ts","../node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/index.d.ts","../node_modules/.pnpm/jest-diff@27.5.1/node_modules/jest-diff/build/types.d.ts","../node_modules/.pnpm/jest-diff@27.5.1/node_modules/jest-diff/build/diffLines.d.ts","../node_modules/.pnpm/jest-diff@27.5.1/node_modules/jest-diff/build/printDiffs.d.ts","../node_modules/.pnpm/jest-diff@27.5.1/node_modules/jest-diff/build/index.d.ts","../node_modules/.pnpm/jest-matcher-utils@27.5.1/node_modules/jest-matcher-utils/build/index.d.ts","../node_modules/.pnpm/@types+jest@27.4.1/node_modules/@types/jest/index.d.ts","../node_modules/.pnpm/@types+json-schema@7.0.11/node_modules/@types/json-schema/index.d.ts","../node_modules/.pnpm/@types+json5@0.0.29/node_modules/@types/json5/index.d.ts","../node_modules/.pnpm/@types+minimist@1.2.2/node_modules/@types/minimist/index.d.ts","../node_modules/.pnpm/@types+normalize-package-data@2.4.1/node_modules/@types/normalize-package-data/index.d.ts","../node_modules/.pnpm/@types+parse-json@4.0.0/node_modules/@types/parse-json/index.d.ts","../node_modules/.pnpm/@types+prettier@2.4.4/node_modules/@types/prettier/index.d.ts","../node_modules/.pnpm/@types+react-dom@18.0.0/node_modules/@types/react-dom/index.d.ts","../node_modules/.pnpm/@types+resolve@1.17.1/node_modules/@types/resolve/index.d.ts","../node_modules/.pnpm/@types+scheduler@0.16.2/node_modules/@types/scheduler/index.d.ts","../node_modules/.pnpm/@types+stack-utils@2.0.1/node_modules/@types/stack-utils/index.d.ts","../node_modules/.pnpm/@types+testing-library__jest-dom@5.14.3/node_modules/@types/testing-library__jest-dom/matchers.d.ts","../node_modules/.pnpm/@types+testing-library__jest-dom@5.14.3/node_modules/@types/testing-library__jest-dom/index.d.ts","../node_modules/.pnpm/@types+yargs-parser@21.0.0/node_modules/@types/yargs-parser/index.d.ts","../node_modules/.pnpm/@types+yargs@16.0.4/node_modules/@types/yargs/index.d.ts","../node_modules/.pnpm/@types+yoga-layout@1.9.2/node_modules/@types/yoga-layout/index.d.ts"],"fileInfos":[{"version":"3ac1b83264055b28c0165688fda6dfcc39001e9e7828f649299101c23ad0a0c3","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","746d62152361558ea6d6115cf0da4dd10ede041d14882ede3568bce5dc4b4f1f","2f93dda35dafec68ec217c9ce67f0f4fbbbb030c055ac312641565ad60dd7e26","aea179452def8a6152f98f63b191b84e7cbd69b0e248c91e61fb2e52328abe8c",{"version":"72704b10d97777e15f1a581b73f88273037ef752d2e50b72287bd0a90af64fe6","affectsGlobalScope":true},{"version":"dbb73d4d99be496175cb432c74c2615f78c76f4272f1d83cba11ee0ed6dbddf0","affectsGlobalScope":true},{"version":"d8996609230d17e90484a2dd58f22668f9a05a3bfe00bfb1d6271171e54a31fb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"5075b36ab861c8c0c45377cb8c96270d7c65f0eeaf105d53fac6850da61f1027","affectsGlobalScope":true},{"version":"6c55633c733c8378db65ac3da7a767c3cf2cf3057f0565a9124a16a3a2019e87","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"e8c9f4e445a489991ca1a4232667de3ac36b07ba75ea335971fbeacf2d26fe67","affectsGlobalScope":true},{"version":"34478567f8a80171f88f2f30808beb7da15eac0538ae91282dd33dce928d98ed","affectsGlobalScope":true},{"version":"6ea9ab679ea030cf46c16a711a316078e9e02619ebaf07a7fcd16964aba88f2d","affectsGlobalScope":true},{"version":"aedb8de1abb2ff1095c153854a6df7deae4a5709c37297f9d6e9948b6806fa66","affectsGlobalScope":true},{"version":"11ffe3c281f375fff9ffdde8bbec7669b4dd671905509079f866f2354a788064","affectsGlobalScope":true},{"version":"10bbdc1981b8d9310ee75bfac28ee0477bb2353e8529da8cff7cb26c409cb5e8","affectsGlobalScope":true},{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"ea0aa24a32c073b8639aa1f3130ba0add0f0f2f76b314d9ba988a5cb91d7e3c4","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"8325bbd311ca1a6b8239d89623c2dd943f77a94091e0f3203808f6e2f802202a","affectsGlobalScope":true},"26aa42d698f1a377cdd9980e0716d76cbee7e8224bae761dd1276f46a3d94d52","b278172ecb146b25c90004f8a25a9ef3fb1e4653dcdf107f48644ca810b89bb1","4e06db264babf972d222794c41f5fc0f0636e8187f87629966e12d41299512f4","f6d3956dbc2ee0fdf55c0b2dad571fbc41b1dddea88e0685c58b9c582f56aa25","32e16a87604c5c4429ad7f5c43e007043e1bd8122485f665eba2cf8f906d4a1e","30a99389119bbbe022caa9dcaa64600551f2e915f52ed772f1e06dbab291e07d","2a1c51c4cd2829fa4a5bb4e6f3dfef89776549f09cb29dd23f6f2e87b0308d16","3a7cf8b6c490a82c9427de73ef7c0f87005d31859dcdf7c5b94fa1513fb8be35","397bf7e491176b9c3f3647d557e21ef32c0bf7e3c2a7ad3120783c703046a572","e6730533a75c65f113a1ee238e4c55c5083e22761fb382377a610c35b754aa4c","6eca6dff99600cc9b9cb2dac6fb4ba6e80487b4f00baacdb908c121a89b49590","f4b414f6cc88648f401c4faff646aaff23902c7f8a1dedb16a0e0a6c9a59c071","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","49772eb27dab6d789bfbd51703bf88f5c49ec53636e022f6a86d79a9794984af","51ab064af1d098a1510b766d3024540bfd3926a75630335d088a9100ca609470","8d73825d47972d99835bc767235f785910fbfc6ee5f4c772e65c3760db3ffa2d","1552a249535ba9306d1ce112428864d06af27f6c50f24fb75b46fcc562927b0a","2e28e45f07a099441d500fc649dc4a2f2cbe1820a1b337e5feaf6b0df5ca63b7","29fcc9e2cd698a44d04d28c3c9a96126a13e7865b4c542c29f67b6aacf7776c3","79ce1d330067f96031d5308ed92866cd2d2278cde5b49b0703804b12dd54c120","3e9bf65c0c1b3e89501fef14e3bf50bd6ac9f5676b5cbbf3e77dd35b6bc722e8","eed3ac9936132ae2435b43fe945c63f8a1f0b0fe6cb035fc62b4612e0a123298","fb4637d1060627ed5ba75a73f65319db521c01e5c693c974e97971c4a09801e3","a36d34bf41548c462f6e2be1333bf9387f7e51bd8cb4610e2ec6793ee0818e0c","35b8c380f1b0db7cf4b3d0dfa1ae3a6b32ad4f1634fc269e0048ffb4b9831908","9da5f3e5ed573a81a5e55d2e4700a3ef4c6f5c1a931743a79a2bc8a3fceaed4e","48ac37253f393274de1d1122b10fb4ced4c1061cf48490d684c1e8c99cceb188","c63b8d7e5627e30af01b0b7a5f5f96b2e3aad52923b00108fb557c58e98ec414","c5ac5f7f82bc4ae19f4078c9fad9d42ec96de31af39aea03b92fda44321f7078","48857e2db9b8d54ce0f1f80819cad2321e82a9b0ea5093a7b72aef827a9b486d","ceb7b035b85252eec4836345fbb45f1ab41f270c826e67d1b30c1c265aa2af76","b5b7f570e53d10704fad3a88c89c5af56198afdc404e4b48486ea4252a8c4f7d","15acd8b81713d3056ee6eb4037490385de90fbf7d39fbc46556a320f7c151054","9cbcbd0f25fea659c4cbbe9edcdec061d151c73df82cd1d95bfe04e118142a00","5024433f8da3a7968f6d12cffd32f2cefae4442a9ad1c965fa2d23342338b700","2ff9995137f3e5d68971388ec58af0c79721626323884513f9f5e2e996ac1fdd","cc957354aa3c94c9961ebf46282cfde1e81d107fc5785a61f62c67f1dd3ac2eb","1a7cc144992d79b062c22ac0309c6624dbb0d49bbddff7ea3b9daa0c17bcac0a","93de1c6dab503f053efe8d304cb522bb3a89feab8c98f307a674a4fae04773e9","3b043cf9a81854a72963fdb57d1884fc4da1cf5be69b5e0a4c5b751e58cb6d88","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3","89ccbe04e737ce613f5f04990271cfa84901446350b8551b0555ddf19319723b","0cba3a5d7b81356222594442753cf90dd2892e5ccfe1d262aaca6896ba6c1380","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"c2ab70bbc7a24c42a790890739dd8a0ba9d2e15038b40dff8163a97a5d148c00","affectsGlobalScope":true},"422dbb183fdced59425ca072c8bd09efaa77ce4e2ab928ec0d8a1ce062d2a45a",{"version":"712ba0d43b44d144dfd01593f61af6e2e21cfae83e834d297643e7973e55ed61","affectsGlobalScope":true},"1dab5ab6bcf11de47ab9db295df8c4f1d92ffa750e8f095e88c71ce4c3299628","f71f46ccd5a90566f0a37b25b23bc4684381ab2180bdf6733f4e6624474e1894",{"version":"54e65985a3ee3cec182e6a555e20974ea936fc8b8d1738c14e8ed8a42bd921d4","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","98a3ebfa494b46265634a73459050befba5da8fdc6ca0ef9b7269421780f4ff3","34e5de87d983bc6aefef8b17658556e3157003e8d9555d3cb098c6bef0b5fbc8","cc0b61316c4f37393f1f9595e93b673f4184e9d07f4c127165a490ec4a928668","f27371653aded82b2b160f7a7033fb4a5b1534b6f6081ef7be1468f0f15327d3","c762cd6754b13a461c54b59d0ae0ab7aeef3c292c6cf889873f786ee4d8e75c9","f4ea7d5df644785bd9fbf419930cbaec118f0d8b4160037d2339b8e23c059e79",{"version":"bfea28e6162ed21a0aeed181b623dcf250aa79abf49e24a6b7e012655af36d81","affectsGlobalScope":true},"b8aca9d0c81abb02bec9b7621983ae65bde71da6727580070602bd2500a9ce2a","ae97e20f2e10dbeec193d6a2f9cd9a367a1e293e7d6b33b68bacea166afd7792","10d4796a130577d57003a77b95d8723530bbec84718e364aa2129fa8ffba0378","ad41bb744149e92adb06eb953da195115620a3f2ad48e7d3ae04d10762dae197","bf73c576885408d4a176f44a9035d798827cc5020d58284cb18d7573430d9022","7ae078ca42a670445ae0c6a97c029cb83d143d62abd1730efb33f68f0b2c0e82",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"5d0a9ea09d990b5788f867f1c79d4878f86f7384cb7dab38eecbf22f9efd063d","12eea70b5e11e924bb0543aea5eadc16ced318aa26001b453b0d561c2fd0bd1e","08777cd9318d294646b121838574e1dd7acbb22c21a03df84e1f2c87b1ad47f2","08a90bcdc717df3d50a2ce178d966a8c353fd23e5c392fd3594a6e39d9bb6304",{"version":"4cd4cff679c9b3d9239fd7bf70293ca4594583767526916af8e5d5a47d0219c7","affectsGlobalScope":true},"2a12d2da5ac4c4979401a3f6eaafa874747a37c365e4bc18aa2b171ae134d21b","002b837927b53f3714308ecd96f72ee8a053b8aeb28213d8ec6de23ed1608b66","1dc9c847473bb47279e398b22c740c83ea37a5c88bf66629666e3cf4c5b9f99c","a9e4a5a24bf2c44de4c98274975a1a705a0abbaad04df3557c2d3cd8b1727949","00fa7ce8bc8acc560dc341bbfdf37840a8c59e6a67c9bfa3fa5f36254df35db2","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","5f0ed51db151c2cdc4fa3bb0f44ce6066912ad001b607a34e65a96c52eb76248",{"version":"3345c276cab0e76dda86c0fb79104ff915a4580ba0f3e440870e183b1baec476","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","103d70bfbeb3cd3a3f26d1705bf986322d8738c2c143f38ebb743b1e228d7444","f52fbf64c7e480271a9096763c4882d356b05cab05bf56a64e68a95313cd2ce2","59bdb65f28d7ce52ccfc906e9aaf422f8b8534b2d21c32a27d7819be5ad81df7",{"version":"3a2da34079a2567161c1359316a32e712404b56566c45332ac9dcee015ecce9f","affectsGlobalScope":true},"28a2e7383fd898c386ffdcacedf0ec0845e5d1a86b5a43f25b86bc315f556b79","3aff9c8c36192e46a84afe7b926136d520487155154ab9ba982a8b544ea8fc95","a880cf8d85af2e4189c709b0fea613741649c0e40fffb4360ec70762563d5de0","85bbf436a15bbeda4db888be3062d47f99c66fd05d7c50f0f6473a9151b6a070","9f9c49c95ecd25e0cb2587751925976cf64fd184714cb11e213749c80cf0f927","f0c75c08a71f9212c93a719a25fb0320d53f2e50ca89a812640e08f8ad8c408c",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"9cafe917bf667f1027b2bb62e2de454ecd2119c80873ad76fc41d941089753b8","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","8b06ac3faeacb8484d84ddb44571d8f410697f98d7bfa86c0fda60373a9f5215","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","f5638f7c2f12a9a1a57b5c41b3c1ea7db3876c003bab68e6a57afd6bcc169af0","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"3fe15a491a792852283caeece8142bc7427a29c183d9fec8691d95a49c8932a1","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","209e814e8e71aec74f69686a9506dd7610b97ab59dcee9446266446f72a76d05","6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","6209c901f30cc321f4b86800d11fad3d67e73a3308f19946b1bc642af0280298","ca579f66ab81fbb94022268fcb98f8eab6ad5ba3b283ef65eba4bbd7df16e9e0","8a19491eba2108d5c333c249699f40aff05ad312c04a17504573b27d91f0aede","74b0245c42990ed8a849df955db3f4362c81b13f799ebc981b7bec2d5b414a57","b0d10e46cfe3f6c476b69af02eaa38e4ccc7430221ce3109ae84bb9fb8282298","bd0f4458d57115491a1dd9fe522fa1d6ffe45a85b12bbd463967f90b50e43c29",{"version":"06279f0df6f368af41fe267319e90b5af9d89ad489d1662164b94ce30a797c79","affectsGlobalScope":true},"70e9a18da08294f75bf23e46c7d69e67634c0765d355887b9b41f0d959e1426e","6ba73232c9d3267ca36ddb83e335d474d2c0e167481e3dec416c782894e11438","7693b0547e3b004443fa1f4327b61617e7317757a3e947ccc200c91111c77eca"],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"downlevelIteration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"jsx":2,"outDir":"./","strict":true,"target":1},"fileIdsList":[[92,142],[142],[56,142],[92,93,94,95,96,142],[92,94,142],[115,142,149],[142,151],[142,152],[142,157,162],[99,142],[102,142],[103,108,142],[104,114,115,122,131,141,142],[104,105,114,122,142],[106,142],[107,108,115,123,142],[108,131,138,142],[109,111,114,122,142],[110,142],[111,112,142],[113,114,142],[114,142],[114,115,116,131,141,142],[114,115,116,131,142],[117,122,131,141,142],[114,115,117,118,122,131,138,141,142],[117,119,131,138,141,142],[99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148],[114,120,142],[121,141,142],[111,114,122,131,142],[123,142],[124,142],[102,125,142],[126,140,142,146],[127,142],[128,142],[114,129,142],[129,130,142,144],[114,131,132,133,142],[131,133,142],[131,132,142],[134,142],[135,142],[114,136,137,142],[136,137,142],[108,122,131,138,142],[139,142],[122,140,142],[103,117,128,141,142],[108,142],[131,142,143],[142,144],[142,145],[103,108,114,116,125,131,141,142,144,146],[131,142,147],[52,53,54,55,142],[142,149],[142,163,174],[69,142],[142,176],[142,155,158],[142,155,158,159,160],[142,157],[142,154,161],[142,156],[61,62,63,64,66,142],[57,58,61,67,68,71,72,74,75,78,79,80,83,84,85,89,142],[56,57,59,67,78,142],[57,142],[60,142],[62,63,142],[62,64,142],[64,142],[57,62,63,64,65,142],[56,74,76,142],[56,57,58,59,67,74,142],[56,67,71,77,142],[67,71,72,81,82,83,142],[56,57,59,70,74,142],[56,57,142],[56,57,59,67,142],[56,57,59,67,68,71,142],[56,57,59,67,68,142],[56,59,67,71,74,76,82,86,87,88,142],[67,70,142],[73,142]],"referencedMap":[[94,1],[92,2],[65,2],[76,2],[81,3],[91,2],[97,4],[93,1],[95,5],[96,1],[98,2],[150,6],[60,2],[151,2],[152,7],[153,8],[163,9],[164,2],[165,2],[166,2],[99,10],[100,10],[102,11],[103,12],[104,13],[105,14],[106,15],[107,16],[108,17],[109,18],[110,19],[111,20],[112,20],[113,21],[114,22],[115,23],[116,24],[101,2],[148,2],[117,25],[118,26],[119,27],[149,28],[120,29],[121,30],[122,31],[123,32],[124,33],[125,34],[126,35],[127,36],[128,37],[129,38],[130,39],[131,40],[133,41],[132,42],[134,43],[135,44],[136,45],[137,46],[138,47],[139,48],[140,49],[141,50],[142,51],[143,52],[144,53],[145,54],[146,55],[147,56],[167,2],[168,2],[169,2],[54,2],[170,3],[52,2],[56,57],[171,58],[172,2],[55,2],[173,2],[175,59],[174,2],[86,2],[69,2],[70,60],[176,2],[177,61],[178,2],[154,2],[73,2],[53,2],[155,2],[159,62],[161,63],[160,62],[158,64],[162,65],[157,66],[156,2],[59,2],[11,2],[12,2],[14,2],[13,2],[2,2],[15,2],[16,2],[17,2],[18,2],[19,2],[20,2],[21,2],[22,2],[3,2],[4,2],[26,2],[23,2],[24,2],[25,2],[27,2],[28,2],[29,2],[5,2],[30,2],[31,2],[32,2],[33,2],[6,2],[34,2],[35,2],[36,2],[37,2],[7,2],[42,2],[38,2],[39,2],[40,2],[41,2],[8,2],[46,2],[43,2],[44,2],[45,2],[47,2],[9,2],[48,2],[49,2],[50,2],[1,2],[10,2],[51,2],[67,67],[90,68],[79,69],[68,70],[61,71],[64,72],[63,73],[62,74],[57,2],[66,75],[82,2],[77,76],[75,77],[80,78],[84,79],[78,80],[58,81],[87,3],[83,82],[72,83],[85,84],[88,3],[89,85],[71,86],[74,87]],"exportedModulesMap":[[94,1],[92,2],[65,2],[76,2],[81,3],[91,2],[97,4],[93,1],[95,5],[96,1],[98,2],[150,6],[60,2],[151,2],[152,7],[153,8],[163,9],[164,2],[165,2],[166,2],[99,10],[100,10],[102,11],[103,12],[104,13],[105,14],[106,15],[107,16],[108,17],[109,18],[110,19],[111,20],[112,20],[113,21],[114,22],[115,23],[116,24],[101,2],[148,2],[117,25],[118,26],[119,27],[149,28],[120,29],[121,30],[122,31],[123,32],[124,33],[125,34],[126,35],[127,36],[128,37],[129,38],[130,39],[131,40],[133,41],[132,42],[134,43],[135,44],[136,45],[137,46],[138,47],[139,48],[140,49],[141,50],[142,51],[143,52],[144,53],[145,54],[146,55],[147,56],[167,2],[168,2],[169,2],[54,2],[170,3],[52,2],[56,57],[171,58],[172,2],[55,2],[173,2],[175,59],[174,2],[86,2],[69,2],[70,60],[176,2],[177,61],[178,2],[154,2],[73,2],[53,2],[155,2],[159,62],[161,63],[160,62],[158,64],[162,65],[157,66],[156,2],[59,2],[11,2],[12,2],[14,2],[13,2],[2,2],[15,2],[16,2],[17,2],[18,2],[19,2],[20,2],[21,2],[22,2],[3,2],[4,2],[26,2],[23,2],[24,2],[25,2],[27,2],[28,2],[29,2],[5,2],[30,2],[31,2],[32,2],[33,2],[6,2],[34,2],[35,2],[36,2],[37,2],[7,2],[42,2],[38,2],[39,2],[40,2],[41,2],[8,2],[46,2],[43,2],[44,2],[45,2],[47,2],[9,2],[48,2],[49,2],[50,2],[1,2],[10,2],[51,2],[67,67],[90,68],[79,69],[68,70],[61,71],[64,72],[63,73],[62,74],[57,2],[66,75],[82,2],[77,76],[75,77],[80,78],[84,79],[78,80],[58,81],[87,3],[83,82],[72,83],[85,84],[88,3],[89,85],[71,86],[74,87]],"semanticDiagnosticsPerFile":[94,92,65,76,81,91,97,93,95,96,98,150,60,151,152,153,163,164,165,166,99,100,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,101,148,117,118,119,149,120,121,122,123,124,125,126,127,128,129,130,131,133,132,134,135,136,137,138,139,140,141,142,143,144,145,146,147,167,168,169,54,170,52,56,171,172,55,173,175,174,86,69,70,176,177,178,154,73,53,155,159,161,160,158,162,157,156,59,11,12,14,13,2,15,16,17,18,19,20,21,22,3,4,26,23,24,25,27,28,29,5,30,31,32,33,6,34,35,36,37,7,42,38,39,40,41,8,46,43,44,45,47,9,48,49,50,1,10,51,67,90,79,68,61,64,63,62,57,66,82,77,75,80,84,78,58,87,83,72,85,88,89,71,74]},"version":"4.6.3"} \ No newline at end of file diff --git a/types/types.d.ts b/types/types.d.ts new file mode 100644 index 0000000..5edf7de --- /dev/null +++ b/types/types.d.ts @@ -0,0 +1,2 @@ +/// +export declare type WindowRef = Window | React.MutableRefObject | HTMLElement | null; diff --git a/types/use-deferred-value.d.ts b/types/use-deferred-value.d.ts new file mode 100644 index 0000000..77a40fc --- /dev/null +++ b/types/use-deferred-value.d.ts @@ -0,0 +1,6 @@ +export declare const useDeferredValue: (value: T, options?: { + timeoutMs: number; +}) => T; +export declare function useThrottle(value: T, options?: { + timeoutMs: number; +}): T; diff --git a/types/use-dnd.d.ts b/types/use-dnd.d.ts new file mode 100644 index 0000000..3ecdf43 --- /dev/null +++ b/types/use-dnd.d.ts @@ -0,0 +1,89 @@ +import * as React from "react"; +import type { Dir, FileTree, FileTreeNode } from "./file-tree"; +import type { Observable } from "./tree/observable"; +/** + * A plugin hook for adding drag and drop to the file tree. + * + * @param fileTree - A file tree + * @param config - Configuration options + * @param config.dragOverExpandTimeout + */ +export declare function useDnd(fileTree: FileTree, config?: UseDndConfig): UseDndPlugin; +export declare type DndEvent = { + type: "start"; + /** + * The node that is being dragged + */ + node: FileTreeNode; +} | { + type: "end"; + /** + * The node that is being dragged + */ + node: FileTreeNode; +} | { + type: "enter"; + /** + * The node that is being dragged + */ + node: FileTreeNode; + /** + * The directory that the node is being dragged over + */ + dir: Dir; +} | { + type: "expanded"; + /** + * The node that is being dragged + */ + node: FileTreeNode; + /** + * The directory that the node is being dragged over + */ + dir: Dir; +} | { + type: "leave"; + /** + * The node that is being dragged + */ + node: FileTreeNode; + /** + * The directory that the node was being dragged over + */ + dir: Dir; +} | { + type: "drop"; + /** + * The node that is being dragged + */ + node: FileTreeNode; + /** + * The directory that the node is being dragged over + */ + dir: Dir; +}; +export interface DndProps { + draggable: true; + onDragStart: React.MouseEventHandler; + onDragEnd: React.MouseEventHandler; + onDragOver: React.MouseEventHandler; + onDragEnter: React.MouseEventHandler; + onDragLeave: React.MouseEventHandler; + onDrop: React.MouseEventHandler; +} +export interface UseDndConfig { + /** + * Timeout for expanding a directory when a draggable element enters it. + */ + dragOverExpandTimeout?: number; +} +export interface UseDndPlugin { + /** + * An observable that emits drag 'n drop events. + */ + didChange: Observable | null>; + /** + * Get the drag 'n drop props for a given node ID. + */ + getProps: (nodeId: number) => DndProps | React.HTMLAttributes; +} diff --git a/types/use-filter.d.ts b/types/use-filter.d.ts new file mode 100644 index 0000000..6e9f683 --- /dev/null +++ b/types/use-filter.d.ts @@ -0,0 +1,10 @@ +import type { FileTree, FileTreeNode } from "./file-tree"; +/** + * A hook that returns filtered visible nodes based on a filter function. + * + * @param fileTree - The file tree to use. + * @param filter - A _stable_ callback that returns `true` if the node should be visible. + * This needs to be memoized or hoisted to the top level to ensure the filtered nodes + * only get re-generated when the filter changes or the file tree's visible nodes change. + */ +export declare function useFilter(fileTree: FileTree, filter: ((node: FileTreeNode, i: number) => boolean) | null): number[]; diff --git a/types/use-hotkeys.d.ts b/types/use-hotkeys.d.ts new file mode 100644 index 0000000..b0771ac --- /dev/null +++ b/types/use-hotkeys.d.ts @@ -0,0 +1,37 @@ +import type { FileTree } from "./file-tree"; +import type { WindowRef } from "./types"; +import type { useRovingFocus } from "./use-roving-focus"; +import type { useSelections } from "./use-selections"; +/** + * A hook for adding standard hotkeys to the file tree. + * + * @param fileTree - A file tree + * @param config - Configuration options + */ +export declare function useHotkeys(fileTree: FileTree, config: UseHotkeysConfig): void; +export interface UseHotkeysConfig { + /** + * When using a hook like `useFilter` you can supply the filtered list of + * nodes to this option. By default, `useVirtualize()` uses the nodes returned + * by `useVisibleNodes()` + */ + nodes?: number[]; + /** + * A React ref created by useRef() or an HTML element for the container viewport + * you're rendering the list inside of. + */ + windowRef: WindowRef; + /** + * The returned value of the `useRovingFocus()` plugin + */ + rovingFocus: ReturnType; + /** + * The returned value of the `useSelections()` plugin + */ + selections: ReturnType; + /** + * A pattern to use for selecting the elements in the list. Must contain an + * `{index}` placeholder for the index of the element to select. + */ + querySelectorPattern?: string; +} diff --git a/types/use-node-plugins.d.ts b/types/use-node-plugins.d.ts new file mode 100644 index 0000000..5533447 --- /dev/null +++ b/types/use-node-plugins.d.ts @@ -0,0 +1,29 @@ +import * as React from "react"; +import type { Observable } from "./tree/observable"; +/** + * A hook that subscribes to plugins and retrieves props that should be applied + * to a given node. An example of a plugin wouuld be the `useTraits()` hook. + * + * @param nodeId - The node ID used to retrieve props from a plugin + * @param plugins - A list of file tree plugins + * @returns A memoized set of props returned by the plugins + * @example + * ```ts + * const traits = useTraits(fileTree) + * const props = useNodePlugins(fileTree.visibleNodes[0], [traits]) + * return
...
+ * ``` + */ +export declare function useNodePlugins(nodeId: number, plugins?: NodePlugin[]): React.HTMLAttributes; +export declare type NodePlugin = { + /** + * An observable that the `useNodePlugins()` hook will subscribe to. + */ + didChange: Observable; + /** + * A function that returns React props based on a node ID. + * + * @param nodeId - The ID of a node in the file tree. + */ + getProps(nodeId: number): React.HTMLAttributes; +}; diff --git a/types/use-observable.d.ts b/types/use-observable.d.ts new file mode 100644 index 0000000..d9a97fa --- /dev/null +++ b/types/use-observable.d.ts @@ -0,0 +1,8 @@ +import type { Observable } from "./tree/observable"; +/** + * A hook for subscribing to changes to the value of an observable. + * + * @param observable - An observable + * @param onChange - A callback that is invoked when the observable changes + */ +export declare function useObservable(observable: Observable, onChange: (value: T) => void | (() => void)): void; diff --git a/types/use-resize-observer.d.ts b/types/use-resize-observer.d.ts new file mode 100644 index 0000000..8bed53d --- /dev/null +++ b/types/use-resize-observer.d.ts @@ -0,0 +1,5 @@ +import * as React from "react"; +export declare function useResizeObserver(target: React.RefObject | T | null, callback: UseResizeObserverCallback, options?: { + ResizeObserver: R; +}): void; +export declare type UseResizeObserverCallback = (entry: ResizeObserverEntry, observer: ResizeObserver) => void; diff --git a/types/use-roving-focus.d.ts b/types/use-roving-focus.d.ts new file mode 100644 index 0000000..8a7e606 --- /dev/null +++ b/types/use-roving-focus.d.ts @@ -0,0 +1,26 @@ +import * as React from "react"; +import type { FileTree } from "./file-tree"; +import type { Observable } from "./tree/observable"; +/** + * A plugin hook for adding roving focus to file tree nodes. + * + * @param fileTree - A file tree + */ +export declare function useRovingFocus(fileTree: FileTree): UseRovingFocusPlugin; +export interface RovingFocusProps { + tabIndex: number; + onFocus(e: React.FocusEvent): void; + onBlur(e: React.FocusEvent): void; +} +export interface UseRovingFocusPlugin { + /** + * An observable that you can use to subscribe to changes to the focused node. + */ + didChange: Observable; + /** + * Get the React props for a given node ID. + * + * @param nodeId - A node ID + */ + getProps: (nodeId: number) => RovingFocusProps; +} diff --git a/types/use-selections.d.ts b/types/use-selections.d.ts new file mode 100644 index 0000000..ab6f4a9 --- /dev/null +++ b/types/use-selections.d.ts @@ -0,0 +1,51 @@ +import * as React from "react"; +import type { FileTree } from "./file-tree"; +import type { Observable } from "./tree/observable"; +/** + * A hook for adding select and multi-select to the file tree. + * + * @param fileTree - A file tree + * @param nodes - When using a hook like `useFilter` you can supply the filtered list of + * nodes to this option. By default, `useVirtualize()` uses the nodes returned by + * `useVisibleNodes()` + */ +export declare function useSelections(fileTree: FileTree, nodes?: number[]): UseSelectionsPlugin; +export interface SelectionsProps { + onClick: React.MouseEventHandler; +} +export interface UseSelectionsPlugin { + /** + * An observable that you can use to subscribe to changes to selections. + */ + didChange: Observable>; + /** + * Get the React props for a given node ID. + * + * @param nodeId - A node ID + */ + getProps(nodeId: number): SelectionsProps; + /** + * The head of the selections list + */ + get head(): number | null; + /** + * The tail of the selections list + */ + get tail(): number | null; + /** + * Select given node ids + * + * @param nodeIds - Node IDs + */ + select(...nodeIds: number[]): void; + /** + * Deselect given node ids + * + * @param nodeIds - Node IDs + */ + deselect(...nodeIds: number[]): void; + /** + * Clear all of the selections + */ + clear(): void; +} diff --git a/types/use-traits.d.ts b/types/use-traits.d.ts new file mode 100644 index 0000000..f2e7939 --- /dev/null +++ b/types/use-traits.d.ts @@ -0,0 +1,65 @@ +import type { FileTree } from "./file-tree"; +import type { Observable } from "./tree/observable"; +/** + * A hook that allows you to arbitrarily apply traits/decorations to nodes in the file + * tree. For example, if you wanted to add a class name to a node in the tree if it were + * selected, focused, et. al. you could use this hook to do that. Another example would + * be the `M` modified decorations in VSCode. + * + * @param fileTree - A file tree + * @param traits - The list of available traits that can be applied to nodes + */ +export declare function useTraits(fileTree: FileTree, traits: Trait[]): UseTraitsPlugin; +export interface TraitsProps { + className?: string; +} +export interface UseTraitsPlugin { + /** + * An observable that you can use to subscribe to changes to traits. + */ + didChange: Observable>>; + /** + * Get the React props for a given node ID. + * + * @param nodeId - A node ID + */ + getProps(nodeId: number): TraitsProps; + /** + * Adds a trait to given node IDs + * + * @param trait - The trait to apply to the given node IDs + * @param nodeIds - Node IDs to add the traits to + */ + add(trait: Extract, ...nodeIds: number[]): void; + /** + * Sets node IDs to a given trait. This is different from add in + * that it replaces any exist node IDs assigned to the trait. + * + * @param trait - The trait to apply to the given node IDs + * @param nodeIds - Node IDs to add the traits to + */ + set(trait: Extract, nodeIds: number[]): void; + /** + * Deletes a node ID from a given trait + * + * @param trait - The trait + * @param nodeId - The node ID to delete a trait for + */ + delete(trait: Extract, nodeId: number): void; + /** + * Clears all of the node IDs assigned to a given trait + * + * @param trait - The trait + */ + clear(trait: Extract): void; + /** + * Clears all of the node IDs assigned to all traits + */ + clearAll(): void; + /** + * Clears the traits assigned to a given node ID + * + * @param nodeId - A node ID + */ + clearNode(nodeId: number): void; +} diff --git a/types/use-transition.d.ts b/types/use-transition.d.ts new file mode 100644 index 0000000..b3e87f8 --- /dev/null +++ b/types/use-transition.d.ts @@ -0,0 +1,2 @@ +import * as React from "react"; +export declare const useTransition: () => [boolean, typeof React.startTransition]; diff --git a/types/use-virtualize.d.ts b/types/use-virtualize.d.ts new file mode 100644 index 0000000..27c9d51 --- /dev/null +++ b/types/use-virtualize.d.ts @@ -0,0 +1,164 @@ +import * as React from "react"; +import type { FileTree, FileTreeNode } from "./file-tree"; +import type { WindowRef } from "./types"; +/** + * A hook similar to `react-window`'s [`FixesSizeList`](https://react-window.vercel.app/#/examples/list/fixed-size) + * component. It allows you to render only enough components to fill a viewport, solving + * some important performance bottlenecks when rendering large lists. + * + * @param fileTree - The file tree to virtualize. + * @param config - Configuration options + */ +export declare function useVirtualize(fileTree: FileTree, config: UseVirtualizeConfig): UseVirtualizeResult; +export declare function useHeight(windowRef: WindowRef, ResizeObserver: any): number; +export declare function useGlobalWindowHeight(windowRef: WindowRef): number | null; +export declare function useScrollPosition(windowRef: WindowRef, { offset }?: UseScrollPosition): { + scrollTop: number; + isScrolling: boolean; +}; +export interface UseScrollPosition { + offset?: number; +} +export interface UseVirtualizeConfig { + /** + * The fixed height (in px) of each node in your list. + */ + nodeHeight: number; + /** + * Optionally set a gap (in px) between each node in your list. + */ + nodeGap?: number; + /** + * When using a hook like `useFilter` you can supply the filtered list of + * nodes to this option. By default, `useVirtualize()` uses the nodes returned + * by `useVisibleNodes()` + */ + nodes?: number[]; + /** + * This number is used for determining the number of nodes outside of the visible + * window to render. The default value is 2 which means "render 2 windows worth (2 * height) + * of content before and after the items in the visible window". A value of 3 would be + * 3 windows worth of grid cells, so it's a linear relationship. Overscanning is important + * for preventing tearing when scrolling through items in the grid, but setting too high of + * a value may create too much work for React to handle, so it's best that you tune this + * value accordingly. + * + * @default 2 + */ + overscanBy?: number; + /** + * A React ref created by useRef() or an HTML element for the container viewport + * you're rendering the list inside of. + */ + windowRef: WindowRef; + /** + * This hook uses a [`ResizeObserver`](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) + * for tracking the size of the viewport. If you need to polyfill ResizeObserver you can provide + * that polyfill here. By default, we use the `ResizeObserver` from the `window` global. + */ + ResizeObserver?: ResizeObserver; +} +export declare type ScrollToNodeConfig = { + /** + * The scrolling behavior + */ + behavior?: "smooth" | "auto"; + /** + * By default, the list will scroll as little as possible to ensure the item is + * visible. You can control the alignment of the item though by specifying a + * second alignment parameter. + * - `auto` - Scroll as little as possible to ensure the item is visible. (If the item + * is already visible, it won't scroll at all.) + * - `smart` - If the item is already visible, don't scroll at all. If it is less than + * one viewport away, scroll as little as possible so that it becomes visible. If + * it is more than one viewport away, scroll so that it is centered within the list. + * - `center` - Center align the item within the list. + * - `end` - Align the item to the end of the list (the bottom for vertical lists or the + * right for horizontal lists). + * - `start` - Align the item to the beginning of the list (the top for vertical lists or + * the left for horizontal lists). + * + * @default "auto" + */ + align?: "auto" | "smart" | "center" | "start" | "end"; +}; +export interface UseVirtualizeResult { + /** + * The current scroll position of the viewport + */ + scrollTop: number; + /** + * `true` if the viewport is currently scrolling + */ + isScrolling: boolean; + /** + * Scroll to a given node by its ID + * + * @param nodeId - The node ID to scroll to + * @param config - Configuration options + */ + scrollToNode(nodeId: number, config?: ScrollToNodeConfig): void; + /** + * Props that should be applied to the container you're mapping your virtualized + * nodes into. + * + * @example + * ```tsx + * const windowRef = React.useRef(null) + * const virtualize = useVirtualize(fileTree, {windowRef, nodeHeight: 24}) + * return ( + *
+ *
+ * {virtualize.map(props => )} + *
+ *
+ * ) + * ``` + */ + props: VirtualizeContainerProps; + /** + * Calls a defined render function on each node and returns an array that + * contains the resulting React elements. + * + * @param render - A callback that renders a node. + * @example + * ```tsx + * const windowRef = React.useRef(null) + * const virtualize = useVirtualize(fileTree, {windowRef, nodeHeight: 24}) + * return ( + *
+ *
+ * {virtualize.map(props => )} + *
+ *
+ * ) + * ``` + */ + map(render: (config: VirtualizeRenderProps) => React.ReactElement): React.ReactElement[]; +} +export interface VirtualizeRenderProps { + /** + * A stable key as required by React elements that are included in arrays + */ + key: number; + /** + * The index of the node within the list of visible nodes + */ + index: number; + /** + * A file tree node + */ + node: FileTreeNode; + /** + * The file tree that contains the node + */ + tree: FileTree; + /** + * Styles that need to be applied to the node element + */ + style: React.CSSProperties; +} +export interface VirtualizeContainerProps { + tabIndex: number; + style: React.CSSProperties; +} diff --git a/types/use-visible-nodes.d.ts b/types/use-visible-nodes.d.ts new file mode 100644 index 0000000..ac08b4a --- /dev/null +++ b/types/use-visible-nodes.d.ts @@ -0,0 +1,13 @@ +import type { FileTree } from "./file-tree"; +/** + * A hook that subscribes to updates to the file tree and returns the nodes that + * are currently visible in the file tree. + * + * @param fileTree - A file tree + * @example + * ```tsx + * const visibleNodes = useVisibleNodes(fileTree) + * return visibleNodes.map((node) =>
{node.basename}
) + * ``` + */ +export declare function useVisibleNodes(fileTree: FileTree): number[]; diff --git a/types/utils.d.ts b/types/utils.d.ts new file mode 100644 index 0000000..1be0424 --- /dev/null +++ b/types/utils.d.ts @@ -0,0 +1,28 @@ +/** + * Merges multiple props objects together. Event handlers are chained, + * classNames are combined, and styles are combined. + * + * For all other props, the last prop object overrides all previous ones. + * + * @param args - Multiple sets of props to merge together. + */ +export declare function mergeProps(args: T): UnionToIntersection>; +/** + * Calls all functions in the order they were chained with the same arguments. + * + * @param callbacks - Callbacks to chain together + */ +export declare function chain(...callbacks: Args): (...args: Args) => void; +export declare function throttle(callback: (...args: CallbackArguments) => void, fps?: number, leading?: boolean): (...args: CallbackArguments) => void; +export declare const perf: Performance | DateConstructor; +export declare function shallowEqual | null, B extends Record | null>(objA: A, objB: B | A): boolean; +interface Props { + [key: string]: any; +} +declare type TupleTypes = { + [P in keyof T]: T[P]; +} extends { + [key: number]: infer V; +} ? V : never; +declare type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +export {};