Skip to content

Commit f812a77

Browse files
committed
perf: delay allOf merging as much as possible + update tree list"
1 parent ac38957 commit f812a77

File tree

20 files changed

+103
-97
lines changed

20 files changed

+103
-97
lines changed

.yalc/@stoplight/tree-list/index.cjs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.yalc/@stoplight/tree-list/index.es.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.yalc/@stoplight/tree-list/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stoplight/tree-list",
3-
"version": "0.0.1-2d0c8d7d",
3+
"version": "0.0.1-3a4ec67a",
44
"description": "A React component that renders a file tree like interface.",
55
"keywords": [],
66
"sideEffects": false,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import { Tree } from 'src/tree/tree';
22
export declare const smallTree: Tree;
33
export declare const largeTree: Tree;
4+
export declare const createStressTree: () => Tree;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

.yalc/@stoplight/tree-list/src/tree/async.d.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { TreeFragment, TreeListParentNode } from '../types';
2+
import { ITreeIterationOptions, Tree } from './tree';
3+
export declare type ComputeRowsFn = (node: TreeListParentNode) => TreeFragment | Promise<TreeFragment>;
4+
export declare class ComputableTree extends Tree {
5+
protected readonly computeRows: ComputeRowsFn;
6+
private visited;
7+
constructor(computeRows: ComputeRowsFn, iterationOptions?: ITreeIterationOptions | null, root?: TreeListParentNode, cacheSize?: number);
8+
private computeTree;
9+
unwrap(node: TreeListParentNode): Promise<void>;
10+
invalidate(): void;
11+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export { Tree } from './tree';
22
export { TreeState } from './state';
33
export { GenericTree } from './generic';
4-
export { AsyncTree } from './async';
4+
export { ComputableTree, ComputeRowsFn } from './computable';

.yalc/@stoplight/tree-list/src/tree/tree.d.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Optional } from '@stoplight/types';
2-
import { DeprecatedTreeListNode, TreeListNode, TreeListParentNode } from '../types';
2+
import { DeprecatedTreeListNode, TreeFragment, TreeListNode, TreeListParentNode } from '../types';
33
import { IndexLookup } from './cache';
44
declare type Arrayish = Pick<typeof Array['prototype'], 'indexOf' | 'every'>;
55
declare type Range = {
@@ -12,17 +12,18 @@ export interface ITreeIterationOptions {
1212
readonly expanded: ((node: TreeListParentNode) => boolean) | null;
1313
}
1414
export declare class Tree implements Arrayish {
15-
protected readonly tree: TreeListParentNode;
1615
protected readonly iterationOptions: ITreeIterationOptions | null;
17-
root: TreeListParentNode;
16+
protected readonly tree: TreeListParentNode;
17+
protected _root: TreeListParentNode;
18+
get root(): import("../types").ITreeListNodeWithChildren;
1819
protected readonly indexLookup: IndexLookup<TreeListNode>;
19-
private readonly wrapped;
20-
private readonly sorted;
21-
private readonly filtered;
20+
private wrapped;
21+
private sorted;
22+
private filtered;
2223
private _count;
2324
get count(): number;
2425
set count(val: number);
25-
constructor(tree: TreeListParentNode, iterationOptions?: ITreeIterationOptions | null, cacheSize?: number);
26+
constructor(iterationOptions?: ITreeIterationOptions | null, tree?: TreeListParentNode, cacheSize?: number);
2627
static getLevel(node: TreeListNode): any;
2728
static getDropZoneId(node: TreeListNode): any;
2829
clearCache(): void;
@@ -38,6 +39,8 @@ export declare class Tree implements Arrayish {
3839
static getOffsetForNode(node: TreeListNode): number;
3940
protected _itemAt(node: TreeListParentNode, pos: number, boundaries: Range): Optional<TreeListNode>;
4041
protected static readonly boundaries: Range;
42+
private static getLastItem;
43+
protected static getNodeIndex(node: TreeListNode): number;
4144
private static nextItem;
4245
nextItem(node: TreeListNode): Optional<TreeListNode>;
4346
prevItem(node: TreeListNode): Optional<TreeListNode>;
@@ -51,10 +54,11 @@ export declare class Tree implements Arrayish {
5154
protected invalidateChildren(node: TreeListParentNode): void;
5255
wrap(node: TreeListParentNode): void;
5356
unwrap(node: TreeListParentNode): void;
54-
moveNode(node: TreeListNode, parentId: string | null): void;
55-
insertNode(node: TreeListNode, parentId: string | null): void;
56-
insertTreeFragment(fragment: TreeListNode[], parentId: string | null): void;
57+
moveNode(node: TreeListNode, parent: TreeListParentNode): void;
58+
insertNode(node: TreeListNode, parent: TreeListParentNode): void;
59+
insertTreeFragment(fragment: TreeFragment, parent: TreeListParentNode): void;
5760
removeNode(node: TreeListNode): void;
61+
replaceNode(node: TreeListNode, newNode: TreeListNode): void;
5862
protected getCount(node: TreeListParentNode): any;
5963
protected resetCounter(node: TreeListParentNode): void;
6064
protected processTreeFragment(node: TreeListParentNode): number;

.yalc/@stoplight/tree-list/src/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export interface ITreeListNode {
100100
export interface ITreeListNodeWithChildren extends ITreeListNode {
101101
children: TreeListNode[];
102102
}
103+
export declare type TreeFragment = TreeListNode[];
103104
export declare type TreeListNode = ITreeListNode | ITreeListNodeWithChildren;
104105
export declare type TreeListParentNode = ITreeListNodeWithChildren;
105106
export declare type DeprecatedTreeListNode<T extends object = object> = Omit<TreeListNode, 'parent' | 'children'> & {

0 commit comments

Comments
 (0)