react-arborist 0.1.12 → 0.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{lib/components → components}/drop-cursor.d.ts +1 -0
- package/dist/{lib/components → components}/preview.d.ts +1 -0
- package/dist/{lib/components → components}/row.d.ts +0 -0
- package/dist/{lib/components → components}/tree.d.ts +0 -0
- package/dist/{lib/context.d.ts → context.d.ts} +4 -3
- package/dist/{lib/data → data}/enrich-tree.d.ts +1 -1
- package/dist/{lib/data → data}/flatten-tree.d.ts +0 -0
- package/dist/dnd/compute-drop.d.ts +37 -0
- package/dist/{lib/dnd → dnd}/drag-hook.d.ts +0 -0
- package/dist/{lib/dnd → dnd}/drop-hook.d.ts +0 -0
- package/dist/{lib/dnd → dnd}/outer-drop-hook.d.ts +0 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1354 -0
- package/dist/index.js.map +1 -0
- package/dist/module.js +1346 -0
- package/dist/module.js.map +1 -0
- package/dist/{lib/provider.d.ts → provider.d.ts} +1 -0
- package/dist/{lib/reducer.d.ts → reducer.d.ts} +4 -3
- package/dist/{lib/selection → selection}/range.d.ts +0 -0
- package/dist/{lib/selection → selection}/selection-hook.d.ts +0 -0
- package/dist/{lib/selection → selection}/selection.d.ts +0 -0
- package/dist/{lib/tree-api-hook.d.ts → tree-api-hook.d.ts} +0 -0
- package/dist/{lib/tree-api.d.ts → tree-api.d.ts} +4 -3
- package/dist/{lib/types.d.ts → types.d.ts} +8 -3
- package/dist/types.d.ts.map +1 -0
- package/dist/{lib/utils.d.ts → utils.d.ts} +2 -0
- package/package.json +16 -43
- package/src/components/drop-cursor.tsx +47 -0
- package/src/components/preview.tsx +108 -0
- package/src/components/row.tsx +119 -0
- package/src/components/tree.tsx +118 -0
- package/src/context.tsx +52 -0
- package/src/data/enrich-tree.ts +74 -0
- package/src/data/flatten-tree.ts +17 -0
- package/src/data/make-tree.ts +37 -0
- package/src/dnd/compute-drop.ts +184 -0
- package/src/dnd/drag-hook.ts +48 -0
- package/src/dnd/drop-hook.ts +66 -0
- package/src/dnd/measure-hover.ts +26 -0
- package/src/dnd/outer-drop-hook.ts +50 -0
- package/src/index.ts +5 -0
- package/src/provider.tsx +61 -0
- package/src/reducer.ts +161 -0
- package/src/selection/range.ts +41 -0
- package/src/selection/selection-hook.ts +24 -0
- package/src/selection/selection.test.ts +111 -0
- package/src/selection/selection.ts +186 -0
- package/src/tree-api-hook.ts +34 -0
- package/src/tree-api.ts +129 -0
- package/src/types.ts +147 -0
- package/src/utils.ts +35 -0
- package/tsconfig.json +28 -0
- package/README.md +0 -197
- package/dist/lib/components/drop-cursor.js +0 -53
- package/dist/lib/components/preview.js +0 -91
- package/dist/lib/components/row.js +0 -122
- package/dist/lib/components/tree.js +0 -76
- package/dist/lib/context.js +0 -57
- package/dist/lib/data/enrich-tree.js +0 -48
- package/dist/lib/data/flatten-tree.js +0 -20
- package/dist/lib/data/make-tree.d.ts +0 -5
- package/dist/lib/data/make-tree.js +0 -40
- package/dist/lib/data/visible-nodes-hook.d.ts +0 -2
- package/dist/lib/data/visible-nodes-hook.js +0 -19
- package/dist/lib/dnd/compute-drop.d.ts +0 -24
- package/dist/lib/dnd/compute-drop.js +0 -113
- package/dist/lib/dnd/drag-hook.js +0 -36
- package/dist/lib/dnd/drop-hook.js +0 -60
- package/dist/lib/dnd/measure-hover.d.ts +0 -8
- package/dist/lib/dnd/measure-hover.js +0 -21
- package/dist/lib/dnd/outer-drop-hook.js +0 -50
- package/dist/lib/index.d.ts +0 -3
- package/dist/lib/index.js +0 -7
- package/dist/lib/provider.js +0 -44
- package/dist/lib/reducer.js +0 -149
- package/dist/lib/selection/range.js +0 -45
- package/dist/lib/selection/selection-hook.js +0 -24
- package/dist/lib/selection/selection.js +0 -192
- package/dist/lib/selection/selection.test.d.ts +0 -1
- package/dist/lib/selection/selection.test.js +0 -102
- package/dist/lib/tree-api-hook.js +0 -26
- package/dist/lib/tree-api.js +0 -130
- package/dist/lib/tree-monitor.d.ts +0 -15
- package/dist/lib/tree-monitor.js +0 -32
- package/dist/lib/types.js +0 -2
- package/dist/lib/utils.js +0 -31
|
File without changes
|
|
File without changes
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { Cursor } from "./dnd/compute-drop";
|
|
3
|
+
import { IdObj, SelectionState, StaticContext } from "./types";
|
|
3
4
|
export declare const CursorParentId: import("react").Context<string | null>;
|
|
4
5
|
export declare function useCursorParentId(): string | null;
|
|
5
6
|
export declare const IsCursorOverFolder: import("react").Context<boolean>;
|
|
6
7
|
export declare function useIsCursorOverFolder(): boolean;
|
|
7
|
-
export declare const CursorLocationContext: import("react").Context<
|
|
8
|
-
export declare function useCursorLocation():
|
|
8
|
+
export declare const CursorLocationContext: import("react").Context<Cursor | null>;
|
|
9
|
+
export declare function useCursorLocation(): Cursor | null;
|
|
9
10
|
export declare const Static: import("react").Context<StaticContext<IdObj> | null>;
|
|
10
11
|
export declare function useStaticContext(): StaticContext<IdObj>;
|
|
11
12
|
export declare const DispatchContext: import("react").Context<null>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TreeProps, IdObj, Node } from "../types";
|
|
2
|
-
export declare function enrichTree<T extends IdObj>(model: T, hideRoot?: boolean, getChildren?: TreeProps<T>["getChildren"], isOpen?: TreeProps<T>["isOpen"],
|
|
2
|
+
export declare function enrichTree<T extends IdObj>(model: T, hideRoot?: boolean, getChildren?: TreeProps<T>["getChildren"], isOpen?: TreeProps<T>["isOpen"], disableDrag?: TreeProps<T>["disableDrag"], disableDrop?: TreeProps<T>["disableDrop"], openByDefault?: boolean): Node<T>;
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { XYCoord } from "react-dnd";
|
|
2
|
+
import { Node } from "../types";
|
|
3
|
+
import { DropResult } from "./drop-hook";
|
|
4
|
+
declare type Args = {
|
|
5
|
+
element: HTMLElement;
|
|
6
|
+
offset: XYCoord;
|
|
7
|
+
indent: number;
|
|
8
|
+
node: Node | null;
|
|
9
|
+
prevNode: Node | null;
|
|
10
|
+
nextNode: Node | null;
|
|
11
|
+
};
|
|
12
|
+
export declare type ComputedDrop = {
|
|
13
|
+
drop: DropResult | null;
|
|
14
|
+
cursor: Cursor | null;
|
|
15
|
+
};
|
|
16
|
+
declare function lineCursor(index: number, level: number): {
|
|
17
|
+
type: "line";
|
|
18
|
+
index: number;
|
|
19
|
+
level: number;
|
|
20
|
+
};
|
|
21
|
+
declare function noCursor(): {
|
|
22
|
+
type: "none";
|
|
23
|
+
};
|
|
24
|
+
declare function highlightCursor(id: string): {
|
|
25
|
+
type: "highlight";
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
28
|
+
export declare type LineCursor = ReturnType<typeof lineCursor>;
|
|
29
|
+
export declare type NoCursor = ReturnType<typeof noCursor>;
|
|
30
|
+
export declare type HighlightCursor = ReturnType<typeof highlightCursor>;
|
|
31
|
+
export declare type Cursor = LineCursor | NoCursor | HighlightCursor;
|
|
32
|
+
/**
|
|
33
|
+
* This is the most complex, tricky function in the whole repo.
|
|
34
|
+
* It could be simplified and made more understandable.
|
|
35
|
+
*/
|
|
36
|
+
export declare function computeDrop(args: Args): ComputedDrop;
|
|
37
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
ADDED