@dynamix-layout/core 1.1.0 → 1.1.1
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/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/dist/{core.cjs.js → core.cjs} +1 -1
- package/dist/core.es.js +5 -5
- package/dist/core.iife.js +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/types/index.d.cts +472 -0
- package/dist/types/index.d.ts +472 -2
- package/package.json +12 -9
- package/dist/types/app/comparator.d.ts +0 -3
- package/dist/types/app/dom.d.ts +0 -17
- package/dist/types/app/drop-preview.d.ts +0 -27
- package/dist/types/app/dynamix.d.ts +0 -69
- package/dist/types/app/geometry.d.ts +0 -9
- package/dist/types/app/index.d.ts +0 -6
- package/dist/types/app/node.d.ts +0 -40
- package/dist/types/app/queue.d.ts +0 -217
- package/dist/types/app/reactive-state.d.ts +0 -3
- package/dist/types/app/slider.d.ts +0 -10
- package/dist/types/app/state.d.ts +0 -20
- package/dist/types/app/tree-builder.d.ts +0 -13
- package/dist/types/app/tree-mutations.d.ts +0 -17
- package/dist/types/type/index.d.ts +0 -54
package/dist/types/app/node.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Queue } from './queue';
|
|
2
|
-
import { Dimension, LayoutTree, NodeCache } from '../type';
|
|
3
|
-
export declare class Node {
|
|
4
|
-
static cache: NodeCache;
|
|
5
|
-
kids: Queue<Node>;
|
|
6
|
-
dims: Dimension;
|
|
7
|
-
unId: string;
|
|
8
|
-
next: Bond | null;
|
|
9
|
-
prev: Bond | null;
|
|
10
|
-
type: 'row' | 'tabset' | 'tab' | 'bond';
|
|
11
|
-
name: string;
|
|
12
|
-
part: number;
|
|
13
|
-
host: Node | null;
|
|
14
|
-
open: string;
|
|
15
|
-
constructor(options?: {
|
|
16
|
-
type?: 'row' | 'tabset' | 'tab' | 'bond';
|
|
17
|
-
host?: Node | null;
|
|
18
|
-
name?: string;
|
|
19
|
-
part?: number;
|
|
20
|
-
dims?: Dimension;
|
|
21
|
-
unId?: string;
|
|
22
|
-
open?: string;
|
|
23
|
-
});
|
|
24
|
-
addBond(parent: Node | null, prev?: Node | null): void;
|
|
25
|
-
getReqDimension(): {
|
|
26
|
-
width: number;
|
|
27
|
-
height: number;
|
|
28
|
-
};
|
|
29
|
-
calcDimensions(): void;
|
|
30
|
-
toJSON(): LayoutTree;
|
|
31
|
-
}
|
|
32
|
-
export declare class Bond {
|
|
33
|
-
dims: Dimension;
|
|
34
|
-
unId: string;
|
|
35
|
-
next: Node | null;
|
|
36
|
-
prev: Node | null;
|
|
37
|
-
host: Node | null;
|
|
38
|
-
constructor(parent?: Node | null, next?: Node | null, prev?: Node | null);
|
|
39
|
-
toJSON(): LayoutTree;
|
|
40
|
-
}
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
declare class Queue<T> {
|
|
2
|
-
private buffer;
|
|
3
|
-
private head;
|
|
4
|
-
private tail;
|
|
5
|
-
private count;
|
|
6
|
-
private capacity;
|
|
7
|
-
constructor(initialCapacity?: number, array?: T[]);
|
|
8
|
-
/**
|
|
9
|
-
* Add element to the back of the queue - O(1) amortized
|
|
10
|
-
* Used for FIFO and FILO patterns
|
|
11
|
-
*/
|
|
12
|
-
enqueue(item: T): void;
|
|
13
|
-
/**
|
|
14
|
-
* Add element to the front of the queue - O(1) amortized
|
|
15
|
-
* Used for LIFO and LILO patterns
|
|
16
|
-
*/
|
|
17
|
-
enqueueFront(item: T): void;
|
|
18
|
-
/**
|
|
19
|
-
* Insert element at specific logical index - O(n)
|
|
20
|
-
* All elements at and after the index are shifted right
|
|
21
|
-
* @param index - Logical index (0 = front of queue)
|
|
22
|
-
* @param item - Element to insert
|
|
23
|
-
* @returns true if insertion successful, false if index out of bounds
|
|
24
|
-
*/
|
|
25
|
-
insert(index: number, item: T): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Insert array of elements at specific logical index - O(n + m) where n is elements to shift, m is array length
|
|
28
|
-
* All elements at and after the index are shifted right to make room for the entire array
|
|
29
|
-
* @param index - Logical index (0 = front of queue)
|
|
30
|
-
* @param items - Array of elements to insert
|
|
31
|
-
* @returns true if insertion successful, false if index out of bounds
|
|
32
|
-
*/
|
|
33
|
-
insertArray(index: number, items: T[]): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Insert another queue at specific logical index - O(n + m) where n is elements to shift, m is queue size
|
|
36
|
-
* All elements at and after the index are shifted right to make room for the entire queue
|
|
37
|
-
* @param index - Logical index (0 = front of queue)
|
|
38
|
-
* @param queue - Queue to insert
|
|
39
|
-
* @returns true if insertion successful, false if index out of bounds
|
|
40
|
-
*/
|
|
41
|
-
insertQueue(index: number, queue: Queue<T>): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Alias for enqueue (add to back)
|
|
44
|
-
*/
|
|
45
|
-
push(item: T): void;
|
|
46
|
-
/**
|
|
47
|
-
* Alias for enqueueFront (add to front)
|
|
48
|
-
*/
|
|
49
|
-
unshift(item: T): void;
|
|
50
|
-
/**
|
|
51
|
-
* Remove and return element from front of queue - O(1)
|
|
52
|
-
* Used for FIFO and LIFO patterns
|
|
53
|
-
*/
|
|
54
|
-
dequeue(): T | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Remove and return element from back of queue - O(1)
|
|
57
|
-
* Used for FILO and LILO patterns
|
|
58
|
-
*/
|
|
59
|
-
dequeueBack(): T | undefined;
|
|
60
|
-
indexOf(item: T): number;
|
|
61
|
-
remove(item: T): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Remove element at specific logical index - O(n)
|
|
64
|
-
* All elements after the index are shifted left
|
|
65
|
-
* @param index - Logical index (0 = front of queue)
|
|
66
|
-
* @returns The removed element, or undefined if index out of bounds
|
|
67
|
-
*/
|
|
68
|
-
removeAt(index: number): T | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* Alias for dequeue (remove from front)
|
|
71
|
-
*/
|
|
72
|
-
shift(): T | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Alias for dequeueBack (remove from back)
|
|
75
|
-
*/
|
|
76
|
-
pop(): T | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* FIFO: First In, First Out
|
|
79
|
-
* Add to back, remove from front
|
|
80
|
-
*/
|
|
81
|
-
fifoAdd(item: T): void;
|
|
82
|
-
fifoRemove(): T | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* FILO: First In, Last Out
|
|
85
|
-
* Add to back, remove from back
|
|
86
|
-
*/
|
|
87
|
-
filoAdd(item: T): void;
|
|
88
|
-
filoRemove(): T | undefined;
|
|
89
|
-
/**
|
|
90
|
-
* LIFO: Last In, First Out
|
|
91
|
-
* Add to front, remove from front
|
|
92
|
-
*/
|
|
93
|
-
lifoAdd(item: T): void;
|
|
94
|
-
lifoRemove(): T | undefined;
|
|
95
|
-
/**
|
|
96
|
-
* LILO: Last In, Last Out
|
|
97
|
-
* Add to front, remove from back
|
|
98
|
-
*/
|
|
99
|
-
liloAdd(item: T): void;
|
|
100
|
-
liloRemove(): T | undefined;
|
|
101
|
-
/**
|
|
102
|
-
* Get element at logical index (0 = front of queue) - O(1)
|
|
103
|
-
*/
|
|
104
|
-
get(index: number): T | undefined;
|
|
105
|
-
/**
|
|
106
|
-
* Set element at logical index - O(1)
|
|
107
|
-
*/
|
|
108
|
-
set(index: number, item: T): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Get the front element without removing it - O(1)
|
|
111
|
-
*/
|
|
112
|
-
peek(): T | undefined;
|
|
113
|
-
/**
|
|
114
|
-
* Get the back element without removing it - O(1)
|
|
115
|
-
*/
|
|
116
|
-
peekBack(): T | undefined;
|
|
117
|
-
/**
|
|
118
|
-
* Alias for peek (front element)
|
|
119
|
-
*/
|
|
120
|
-
front(): T | undefined;
|
|
121
|
-
/**
|
|
122
|
-
* Alias for peekBack (back element)
|
|
123
|
-
*/
|
|
124
|
-
back(): T | undefined;
|
|
125
|
-
/**
|
|
126
|
-
* Get current size of queue - O(1)
|
|
127
|
-
*/
|
|
128
|
-
size(): number;
|
|
129
|
-
/**
|
|
130
|
-
* Get current capacity - O(1)
|
|
131
|
-
*/
|
|
132
|
-
getCapacity(): number;
|
|
133
|
-
/**
|
|
134
|
-
* Check if queue is empty - O(1)
|
|
135
|
-
*/
|
|
136
|
-
isEmpty(): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Check if queue is full - O(1)
|
|
139
|
-
*/
|
|
140
|
-
isFull(): boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Clear all elements from queue - O(1)
|
|
143
|
-
*/
|
|
144
|
-
clear(): void;
|
|
145
|
-
/**
|
|
146
|
-
* Convert queue to array (maintains order from front to back) - O(n)
|
|
147
|
-
*/
|
|
148
|
-
toArray(): T[];
|
|
149
|
-
/**
|
|
150
|
-
* Forward iterator support for for...of loops - O(n) total
|
|
151
|
-
* Iterates from front to back
|
|
152
|
-
*/
|
|
153
|
-
[Symbol.iterator](): IterableIterator<T>;
|
|
154
|
-
/**
|
|
155
|
-
* Forward iterator (same as Symbol.iterator) - O(n) total
|
|
156
|
-
* Iterates from front to back
|
|
157
|
-
*/
|
|
158
|
-
forward(): IterableIterator<T>;
|
|
159
|
-
/**
|
|
160
|
-
* Reverse iterator - O(n) total
|
|
161
|
-
* Iterates from back to front
|
|
162
|
-
*/
|
|
163
|
-
reverse(): IterableIterator<T>;
|
|
164
|
-
/**
|
|
165
|
-
* Iterator with index information - O(n) total
|
|
166
|
-
* Returns [index, value] pairs from front to back
|
|
167
|
-
*/
|
|
168
|
-
entries(): IterableIterator<[number, T]>;
|
|
169
|
-
/**
|
|
170
|
-
* Iterator for keys (indices) - O(n) total
|
|
171
|
-
*/
|
|
172
|
-
keys(): IterableIterator<number>;
|
|
173
|
-
/**
|
|
174
|
-
* Iterator for values only - O(n) total
|
|
175
|
-
* Same as Symbol.iterator but more explicit
|
|
176
|
-
*/
|
|
177
|
-
values(): IterableIterator<T>;
|
|
178
|
-
/**
|
|
179
|
-
* Get string representation - O(n)
|
|
180
|
-
*/
|
|
181
|
-
toString(): string;
|
|
182
|
-
/**
|
|
183
|
-
* Private method to resize buffer when capacity is exceeded
|
|
184
|
-
*/
|
|
185
|
-
private resize;
|
|
186
|
-
/**
|
|
187
|
-
* Shift elements left (towards head) to make room for insertion
|
|
188
|
-
* Used when inserting closer to head
|
|
189
|
-
*/
|
|
190
|
-
private shiftLeft;
|
|
191
|
-
/**
|
|
192
|
-
* Shift elements right (towards tail) to make room for insertion
|
|
193
|
-
* Used when inserting closer to tail
|
|
194
|
-
*/
|
|
195
|
-
private shiftRight;
|
|
196
|
-
/**
|
|
197
|
-
* Shift elements right (towards tail) to fill gap after removal
|
|
198
|
-
* Used when removing closer to head
|
|
199
|
-
*/
|
|
200
|
-
private shiftRightForRemoval;
|
|
201
|
-
/**
|
|
202
|
-
* Shift elements left (towards head) to fill gap after removal
|
|
203
|
-
* Used when removing closer to tail
|
|
204
|
-
*/
|
|
205
|
-
private shiftLeftForRemoval;
|
|
206
|
-
/**
|
|
207
|
-
* Shift elements left (towards head) to make room for array insertion
|
|
208
|
-
* Used when inserting array closer to head
|
|
209
|
-
*/
|
|
210
|
-
private shiftLeftArray;
|
|
211
|
-
/**
|
|
212
|
-
* Shift elements right (towards tail) to make room for array insertion
|
|
213
|
-
* Used when inserting array closer to tail
|
|
214
|
-
*/
|
|
215
|
-
private shiftRightArray;
|
|
216
|
-
}
|
|
217
|
-
export { Queue };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DynamixLayoutCore as Layout } from './dynamix';
|
|
2
|
-
/** Moving a bond (slider) between two siblings. */
|
|
3
|
-
export declare function updateSlider(engine: Layout, id: string, dim: {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
}, disableTimeout?: boolean, timeout?: number): void;
|
|
7
|
-
export declare function updateSliderDimension(engine: Layout, id: string, dim: {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
}): void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Node } from './node';
|
|
2
|
-
import { DynamixLayoutCore } from './dynamix';
|
|
3
|
-
import { LayoutTree } from '../type';
|
|
4
|
-
export type Timer = {
|
|
5
|
-
set: (callback: () => void, ms: number) => ReturnType<typeof setTimeout>;
|
|
6
|
-
clear: (handle: ReturnType<typeof setTimeout>) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const defaultCreateId: () => string;
|
|
9
|
-
export declare const defaultTimer: Timer;
|
|
10
|
-
/** Shared layout settings and the current root, used by every layout module. */
|
|
11
|
-
export declare const layoutState: {
|
|
12
|
-
createId: () => string;
|
|
13
|
-
timer: Timer;
|
|
14
|
-
root: Node;
|
|
15
|
-
tree: LayoutTree | null;
|
|
16
|
-
minW: number;
|
|
17
|
-
minH: number;
|
|
18
|
-
bond: number;
|
|
19
|
-
inst: DynamixLayoutCore | null;
|
|
20
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Queue } from './queue';
|
|
2
|
-
import { Node } from './node';
|
|
3
|
-
import { LayoutTree } from '../type';
|
|
4
|
-
import { DynamixLayoutCore as Layout } from './dynamix';
|
|
5
|
-
/** Building the node tree from a saved layout or a list of tabs, and walking it. */
|
|
6
|
-
export declare function JSONLayoutIterator(root: LayoutTree): IterableIterator<LayoutTree>;
|
|
7
|
-
export declare function NodeLayoutIterator(root: Node): IterableIterator<Node>;
|
|
8
|
-
export declare function NodeLayoutRecursiveIterator(engine: Layout, root: Node): IterableIterator<Node>;
|
|
9
|
-
export declare function updateChildDirections(engine: Layout, parent: Node): void;
|
|
10
|
-
export declare function createNodeLayout(engine: Layout, root?: LayoutTree | null): void;
|
|
11
|
-
export declare function createNodeTreeFromJSONTree(engine: Layout, json: LayoutTree, host: Node): void;
|
|
12
|
-
export declare function createBinaryNodeTreeFromQueue(engine: Layout, queue: Queue<string>, host?: Node): void;
|
|
13
|
-
export declare function createNodeFromJSON(engine: Layout, json: LayoutTree): Node;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Node } from './node';
|
|
2
|
-
import { DynamixLayoutCore as Layout } from './dynamix';
|
|
3
|
-
/** Drag and drop: moving tabs/tabsets and keeping bonds and caches consistent. */
|
|
4
|
-
export declare function updateTree(engine: Layout, src: string, des: string, layout: 'top' | 'bottom' | 'left' | 'right' | 'contain'): boolean;
|
|
5
|
-
export declare function isOnlyContent(engine: Layout, node: Node): boolean;
|
|
6
|
-
export declare function moveNodeAsTab(engine: Layout, src: Node, des: Node, layout: 'left' | 'right' | 'contain'): void;
|
|
7
|
-
type Side = 'top' | 'bottom' | 'left' | 'right';
|
|
8
|
-
export declare function moveRelativeToRoot(engine: Layout, src: Node, des: Node, layout: Side): void;
|
|
9
|
-
export declare function moveRelativeToTabset(engine: Layout, src: Node, des: Node, layout: Side): void;
|
|
10
|
-
export declare function insertNode(engine: Layout, des: Node, src: Node, flag: boolean): void;
|
|
11
|
-
export declare function insertNodeWithNewParent(engine: Layout, src: Node, des: Node, flag: boolean): void;
|
|
12
|
-
export declare function moveAdjacentNodeToGrandParent(engine: Layout, src: Node): void;
|
|
13
|
-
export declare function removeRelation(src: Node, fix?: boolean): Node | undefined;
|
|
14
|
-
export declare function removeNode(engine: Layout, src: Node): void;
|
|
15
|
-
export declare function removeKid(kid: Node): void;
|
|
16
|
-
export declare function clearAllCache(): void;
|
|
17
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Node, Bond } from '../app/dynamix';
|
|
2
|
-
export type Dimension = {
|
|
3
|
-
w: number;
|
|
4
|
-
h: number;
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
};
|
|
8
|
-
export interface NodeCache {
|
|
9
|
-
dimMins: Map<string, {
|
|
10
|
-
minWidth: number;
|
|
11
|
-
minHeight: number;
|
|
12
|
-
}>;
|
|
13
|
-
mapDirs: Map<string, boolean>;
|
|
14
|
-
tabCnts: Map<string, {
|
|
15
|
-
horizontal: number;
|
|
16
|
-
vertical: number;
|
|
17
|
-
}>;
|
|
18
|
-
mapElem: Map<string, Node | Bond>;
|
|
19
|
-
nodOpts: ReactiveValue<Map<string, NodeOptions>>;
|
|
20
|
-
bndOpts: ReactiveValue<Map<string, NodeOptions>>;
|
|
21
|
-
tabOpts: ReactiveValue<Map<string, NodeOptions>>;
|
|
22
|
-
}
|
|
23
|
-
export type NodeType = 'row' | 'tabset' | 'tab';
|
|
24
|
-
export type NodeTypeWithBond = NodeType | 'bond';
|
|
25
|
-
export type TabsIds = Map<string, string>;
|
|
26
|
-
export interface BaseNode {
|
|
27
|
-
typNode: NodeTypeWithBond;
|
|
28
|
-
nodName: string;
|
|
29
|
-
uidNode: string;
|
|
30
|
-
nodPart: number;
|
|
31
|
-
nodeDir: boolean;
|
|
32
|
-
nodDims: Dimension;
|
|
33
|
-
nodOpen?: string | boolean;
|
|
34
|
-
}
|
|
35
|
-
export type LayoutTree = Omit<BaseNode, 'nodeDir' | 'nodDims'> & {
|
|
36
|
-
nodKids?: LayoutTree[];
|
|
37
|
-
};
|
|
38
|
-
export interface NodeOptions extends BaseNode {
|
|
39
|
-
nodKids?: BaseNode[];
|
|
40
|
-
}
|
|
41
|
-
export interface RootAdjustment {
|
|
42
|
-
adjustedW: number;
|
|
43
|
-
adjustedH: number;
|
|
44
|
-
wasAdjusted: boolean;
|
|
45
|
-
}
|
|
46
|
-
export type ChangeListener<T> = (newValue: T) => void;
|
|
47
|
-
export interface ReactiveValue<T> {
|
|
48
|
-
get: () => T;
|
|
49
|
-
set: (newValue: T, flag?: boolean) => void;
|
|
50
|
-
onChange: (listener: ChangeListener<T>) => () => void;
|
|
51
|
-
nextChange: () => Promise<T>;
|
|
52
|
-
onChangePromise: (listener: ChangeListener<T>) => () => void;
|
|
53
|
-
triggerChange: () => void;
|
|
54
|
-
}
|