@dynamix-layout/core 1.1.0 → 1.2.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/CHANGELOG.md +29 -0
- package/README.md +1 -1
- package/dist/core.cjs +57 -0
- package/dist/core.es.js +409 -290
- package/dist/core.iife.js +3 -3
- package/dist/core.umd.js +3 -3
- package/dist/types/index.d.cts +522 -0
- package/dist/types/index.d.ts +522 -2
- package/package.json +12 -9
- package/dist/core.cjs.js +0 -57
- 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/index.d.ts
CHANGED
|
@@ -1,2 +1,522 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
/** @deprecated Internal; removed in 2.0. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
2
|
+
export declare function areNodeOptionsEqual(a: NodeOptions, b: NodeOptions): boolean;
|
|
3
|
+
|
|
4
|
+
/** @deprecated Internal; removed in 2.0. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
5
|
+
export declare function areNodeOptionsMapEqual(mapA: Map<string, NodeOptions>, mapB: Map<string, NodeOptions>): boolean;
|
|
6
|
+
|
|
7
|
+
export declare interface BaseNode {
|
|
8
|
+
typNode: NodeTypeWithBond;
|
|
9
|
+
nodName: string;
|
|
10
|
+
uidNode: string;
|
|
11
|
+
nodPart: number;
|
|
12
|
+
nodeDir: boolean;
|
|
13
|
+
nodDims: Dimension;
|
|
14
|
+
nodOpen?: string | boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @deprecated Internal; removed in 2.0. Splitters are `snapshot.splitters`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
18
|
+
export declare class Bond {
|
|
19
|
+
dims: Dimension;
|
|
20
|
+
unId: string;
|
|
21
|
+
next: Node_2 | null;
|
|
22
|
+
prev: Node_2 | null;
|
|
23
|
+
host: Node_2 | null;
|
|
24
|
+
constructor(parent?: Node_2 | null, next?: Node_2 | null, prev?: Node_2 | null);
|
|
25
|
+
toJSON(): LayoutTree;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare type ChangeListener<T> = (newValue: T) => void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Coalesces bursts of updates (pointer events can fire several times per
|
|
32
|
+
* frame) into at most one `onFlush` call per animation frame.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createFrameScheduler<T>(onFlush: (value: T) => void): FrameScheduler<T>;
|
|
35
|
+
|
|
36
|
+
/** @deprecated Internal; removed in 2.0. Use `layout.subscribe()`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
37
|
+
export declare function createReactiveState<T>(initialValue: T, comparator?: (a: T, b: T) => boolean): ReactiveValue<T>;
|
|
38
|
+
|
|
39
|
+
/** @deprecated Replaced in 2.0 by `Rect { x, y, width, height }`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
40
|
+
export declare type Dimension = {
|
|
41
|
+
w: number;
|
|
42
|
+
h: number;
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export declare type DropArea = 'top' | 'bottom' | 'left' | 'right' | 'contain';
|
|
48
|
+
|
|
49
|
+
/** Where a dragged tab or tabset would land, in viewport coordinates. */
|
|
50
|
+
export declare interface DropPreview {
|
|
51
|
+
area: DropArea;
|
|
52
|
+
left: number;
|
|
53
|
+
top: number;
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** @deprecated Replaced in 2.0 by `createLayout(options)`, which returns an independent instance (no static state). See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
59
|
+
export declare class DynamixLayoutCore {
|
|
60
|
+
static get _root(): Node_2;
|
|
61
|
+
static set _root(value: Node_2);
|
|
62
|
+
static get _tree(): LayoutTree | null;
|
|
63
|
+
static set _tree(value: LayoutTree | null);
|
|
64
|
+
static get _minW(): number;
|
|
65
|
+
static set _minW(value: number);
|
|
66
|
+
static get _minH(): number;
|
|
67
|
+
static set _minH(value: number);
|
|
68
|
+
static get _bond(): number;
|
|
69
|
+
static set _bond(value: number);
|
|
70
|
+
static get _inst(): DynamixLayoutCore | null;
|
|
71
|
+
static set _inst(value: DynamixLayoutCore | null);
|
|
72
|
+
nodeOps: ReactiveValue<Map<string, NodeOptions>>;
|
|
73
|
+
cntdown: ReturnType<typeof setTimeout> | null;
|
|
74
|
+
tabsIds: TabsIds;
|
|
75
|
+
constructor(options?: {
|
|
76
|
+
tabs?: string[];
|
|
77
|
+
tree?: LayoutTree | null;
|
|
78
|
+
minW?: number;
|
|
79
|
+
minH?: number;
|
|
80
|
+
bond?: number;
|
|
81
|
+
uqid?: string;
|
|
82
|
+
tabsIds?: TabsIds;
|
|
83
|
+
/** Generates ids for new nodes and bonds (default `crypto.randomUUID`). */
|
|
84
|
+
createId?: () => string;
|
|
85
|
+
/** Schedules deferred updates (default `setTimeout`/`clearTimeout`). */
|
|
86
|
+
timer?: Timer;
|
|
87
|
+
/** Size of a folded tabset along its row; pass the tab bar height. */
|
|
88
|
+
collapsedSize?: number;
|
|
89
|
+
});
|
|
90
|
+
JSONLayoutIterator(root: LayoutTree): IterableIterator<LayoutTree>;
|
|
91
|
+
NodeLayoutIterator(root: Node_2): IterableIterator<Node_2>;
|
|
92
|
+
NodeLayoutRecursiveIterator(root: Node_2): IterableIterator<Node_2>;
|
|
93
|
+
updateChildDirections(parent: Node_2): void;
|
|
94
|
+
createNodeLayout(root?: LayoutTree | null): void;
|
|
95
|
+
createNodeTreeFromJSONTree(json: LayoutTree, host: Node_2): void;
|
|
96
|
+
createBinaryNodeTreeFromQueue(queue: Queue<string>, host?: Node_2): void;
|
|
97
|
+
createNodeFromJSON(json: LayoutTree): Node_2;
|
|
98
|
+
calcTabsetCountAndMinDim(root?: Node_2, clear?: boolean): void;
|
|
99
|
+
pruneStaleDirections(): void;
|
|
100
|
+
calculateRootAdjustment(): RootAdjustment;
|
|
101
|
+
calcDimensions(root?: Node_2, supress?: boolean): void;
|
|
102
|
+
updateDimension(dim: Dimension, disableTimeout?: boolean, timeout?: number): void;
|
|
103
|
+
updateSlider(id: string, dim: {
|
|
104
|
+
x: number;
|
|
105
|
+
y: number;
|
|
106
|
+
}, disableTimeout?: boolean, timeout?: number): void;
|
|
107
|
+
updateSliderDimension(id: string, dim: {
|
|
108
|
+
x: number;
|
|
109
|
+
y: number;
|
|
110
|
+
}): void;
|
|
111
|
+
updateTree(src: string, des: string, layout: 'top' | 'bottom' | 'left' | 'right' | 'contain'): boolean;
|
|
112
|
+
isOnlyContent(node: Node_2): boolean;
|
|
113
|
+
moveNodeAsTab(src: Node_2, des: Node_2, layout: 'left' | 'right' | 'contain'): void;
|
|
114
|
+
moveRelativeToRoot(src: Node_2, des: Node_2, layout: 'top' | 'bottom' | 'left' | 'right'): void;
|
|
115
|
+
moveRelativeToTabset(src: Node_2, des: Node_2, layout: 'top' | 'bottom' | 'left' | 'right'): void;
|
|
116
|
+
insertNode(des: Node_2, src: Node_2, flag: boolean): void;
|
|
117
|
+
insertNodeWithNewParent(src: Node_2, des: Node_2, flag: boolean): void;
|
|
118
|
+
moveAdjacentNodeToGrandParent(src: Node_2): void;
|
|
119
|
+
removeRelation(src: Node_2, fix?: boolean): Node_2 | undefined;
|
|
120
|
+
removeNode(src: Node_2): void;
|
|
121
|
+
removeKid(kid: Node_2): void;
|
|
122
|
+
clearAllCache(): void;
|
|
123
|
+
/** Uid of the maximized tabset, or null. */
|
|
124
|
+
get maximizedId(): string | null;
|
|
125
|
+
/** Show one tabset over the whole layout; the others stay mounted. */
|
|
126
|
+
maximize(id: string): boolean;
|
|
127
|
+
/** Leave maximized mode; the previous split is restored exactly. */
|
|
128
|
+
restore(): boolean;
|
|
129
|
+
toggleMaximize(id: string): boolean;
|
|
130
|
+
/** Fold a tabset to a strip along its row (its tab bar). */
|
|
131
|
+
collapse(id: string): boolean;
|
|
132
|
+
/** Unfold a tabset; it returns to its previous size. */
|
|
133
|
+
expand(id: string): boolean;
|
|
134
|
+
toggleCollapse(id: string): boolean;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export declare interface FrameScheduler<T> {
|
|
138
|
+
/** Remember `value`; `onFlush` runs with the latest value on the next frame. */
|
|
139
|
+
schedule: (value: T) => void;
|
|
140
|
+
/** Run a pending flush now (e.g. on pointer up). */
|
|
141
|
+
flush: () => void;
|
|
142
|
+
/** Drop a pending flush (e.g. on unmount). */
|
|
143
|
+
cancel: () => void;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Insertion marker between the tabs of a tab bar. `index` is the tab the
|
|
148
|
+
* marker sits next to. Returns null when the pointer is above or below the bar.
|
|
149
|
+
* @deprecated Replaced in 2.0 by `layout.getDropTarget()` and `layout.getDropIndicatorRect()`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md
|
|
150
|
+
*/
|
|
151
|
+
export declare function getNavbarDropPreview(navbarRect: PreviewRect, tabRects: PreviewRect[], clientX: number, clientY: number): (DropPreview & {
|
|
152
|
+
index: number;
|
|
153
|
+
}) | null;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The half of the whole layout a root-edge drop would take.
|
|
157
|
+
* @deprecated Replaced in 2.0 by `layout.getDropTarget()` and `layout.getDropIndicatorRect()`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md
|
|
158
|
+
*/
|
|
159
|
+
export declare function getRootSplitPreview(container: Dimension, side: RootSide): DropPreview;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Where a tabset's tab bar goes. A folded tabset in a side-by-side row shows
|
|
163
|
+
* its tab bar rotated 90 degrees: an element `h` wide and `w` tall, rotated
|
|
164
|
+
* around its top-left corner and placed at `x + w`, covers exactly the strip.
|
|
165
|
+
*/
|
|
166
|
+
export declare function getTabbarPlacement(tabset: Pick<NodeOptions, 'nodDims' | 'nodFold' | 'nodeDir'>, tabbarHeight: number): TabbarPlacement;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Area of a tabset below its tab bar; never negative when squeezed.
|
|
170
|
+
* @deprecated Replaced in 2.0 by `getTabContentRect(tabsetRect, tabBarHeight)`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md
|
|
171
|
+
*/
|
|
172
|
+
export declare function getTabBodyRect(tabset: Dimension, tabbarHeight: number): Dimension;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Splits a tabset into thirds: the outer thirds drop beside it, the middle
|
|
176
|
+
* drops into it as a tab.
|
|
177
|
+
* @deprecated Replaced in 2.0 by `layout.getDropTarget()` and `layout.getDropIndicatorRect()`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md
|
|
178
|
+
*/
|
|
179
|
+
export declare function getTabsetDropPreview(rect: PreviewRect, clientX: number, clientY: number): DropPreview;
|
|
180
|
+
|
|
181
|
+
/** @deprecated Replaced in 2.0 by `layout.getDropTarget()` and `layout.getDropIndicatorRect()`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
182
|
+
export declare function isSameDropPreview(a: Partial<DropPreview>, b: DropPreview): boolean;
|
|
183
|
+
|
|
184
|
+
/** @deprecated Replaced in 2.0 by `LayoutJSON` (v1 trees load automatically; `LayoutTreeV1` describes this shape). See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
185
|
+
export declare type LayoutTree = Omit<BaseNode, 'nodeDir' | 'nodDims'> & {
|
|
186
|
+
nodKids?: LayoutTree[];
|
|
187
|
+
/** Tabset only: folded to a strip along its parent row. */
|
|
188
|
+
nodFold?: boolean;
|
|
189
|
+
/** Root only: uid of the maximized tabset. */
|
|
190
|
+
nodMaxd?: string;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/** @deprecated Internal; removed in 2.0. Read layout state from `layout.getSnapshot()` / `subscribe()`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
194
|
+
declare class Node_2 {
|
|
195
|
+
static cache: NodeCache;
|
|
196
|
+
kids: Queue<Node_2>;
|
|
197
|
+
dims: Dimension;
|
|
198
|
+
unId: string;
|
|
199
|
+
next: Bond | null;
|
|
200
|
+
prev: Bond | null;
|
|
201
|
+
type: 'row' | 'tabset' | 'tab' | 'bond';
|
|
202
|
+
name: string;
|
|
203
|
+
part: number;
|
|
204
|
+
host: Node_2 | null;
|
|
205
|
+
open: string;
|
|
206
|
+
/** Tabset only: folded to a strip along its parent row. */
|
|
207
|
+
collapsed: boolean;
|
|
208
|
+
/** Fold order, used to pick which sibling to unfold. */
|
|
209
|
+
foldedAt: number;
|
|
210
|
+
constructor(options?: {
|
|
211
|
+
type?: 'row' | 'tabset' | 'tab' | 'bond';
|
|
212
|
+
host?: Node_2 | null;
|
|
213
|
+
name?: string;
|
|
214
|
+
part?: number;
|
|
215
|
+
dims?: Dimension;
|
|
216
|
+
unId?: string;
|
|
217
|
+
open?: string;
|
|
218
|
+
});
|
|
219
|
+
addBond(parent: Node_2 | null, prev?: Node_2 | null): void;
|
|
220
|
+
getReqDimension(): {
|
|
221
|
+
width: number;
|
|
222
|
+
height: number;
|
|
223
|
+
};
|
|
224
|
+
calcDimensions(): void;
|
|
225
|
+
toJSON(): LayoutTree;
|
|
226
|
+
}
|
|
227
|
+
export { Node_2 as Node }
|
|
228
|
+
|
|
229
|
+
export declare interface NodeCache {
|
|
230
|
+
dimMins: Map<string, {
|
|
231
|
+
minWidth: number;
|
|
232
|
+
minHeight: number;
|
|
233
|
+
}>;
|
|
234
|
+
mapDirs: Map<string, boolean>;
|
|
235
|
+
tabCnts: Map<string, {
|
|
236
|
+
horizontal: number;
|
|
237
|
+
vertical: number;
|
|
238
|
+
}>;
|
|
239
|
+
mapElem: Map<string, Node_2 | Bond>;
|
|
240
|
+
nodOpts: ReactiveValue<Map<string, NodeOptions>>;
|
|
241
|
+
bndOpts: ReactiveValue<Map<string, NodeOptions>>;
|
|
242
|
+
tabOpts: ReactiveValue<Map<string, NodeOptions>>;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** @deprecated Replaced in 2.0 by `TabsetState`, `SplitterState`, `TabState` and `snapshot.rects`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
246
|
+
export declare interface NodeOptions extends BaseNode {
|
|
247
|
+
nodKids?: BaseNode[];
|
|
248
|
+
/** Tabset: folded to a strip (ignored while it is maximized). */
|
|
249
|
+
nodFold?: boolean;
|
|
250
|
+
/** Tabset: currently maximized over the whole layout. */
|
|
251
|
+
nodMaxd?: boolean;
|
|
252
|
+
/** Hidden because another tabset is maximized (content stays mounted). */
|
|
253
|
+
nodHidden?: boolean;
|
|
254
|
+
/** Bond: next to a folded tabset, so it cannot be dragged. */
|
|
255
|
+
nodLocked?: boolean;
|
|
256
|
+
/** Tabset: can be folded (it has siblings in its row). */
|
|
257
|
+
nodFoldable?: boolean;
|
|
258
|
+
/** Tabset: can be maximized (the layout has more than one tabset). */
|
|
259
|
+
nodMaximizable?: boolean;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export declare type NodeType = 'row' | 'tabset' | 'tab';
|
|
263
|
+
|
|
264
|
+
export declare type NodeTypeWithBond = NodeType | 'bond';
|
|
265
|
+
|
|
266
|
+
export declare function placeTabbar(el: HTMLElement, placement: TabbarPlacement): void;
|
|
267
|
+
|
|
268
|
+
export declare type PreviewRect = Pick<DOMRect, 'left' | 'top' | 'right' | 'bottom' | 'width' | 'height'>;
|
|
269
|
+
|
|
270
|
+
/** @deprecated Internal; removed in 2.0. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
271
|
+
export declare class Queue<T> {
|
|
272
|
+
private buffer;
|
|
273
|
+
private head;
|
|
274
|
+
private tail;
|
|
275
|
+
private count;
|
|
276
|
+
private capacity;
|
|
277
|
+
constructor(initialCapacity?: number, array?: T[]);
|
|
278
|
+
/**
|
|
279
|
+
* Add element to the back of the queue - O(1) amortized
|
|
280
|
+
* Used for FIFO and FILO patterns
|
|
281
|
+
*/
|
|
282
|
+
enqueue(item: T): void;
|
|
283
|
+
/**
|
|
284
|
+
* Add element to the front of the queue - O(1) amortized
|
|
285
|
+
* Used for LIFO and LILO patterns
|
|
286
|
+
*/
|
|
287
|
+
enqueueFront(item: T): void;
|
|
288
|
+
/**
|
|
289
|
+
* Insert element at specific logical index - O(n)
|
|
290
|
+
* All elements at and after the index are shifted right
|
|
291
|
+
* @param index - Logical index (0 = front of queue)
|
|
292
|
+
* @param item - Element to insert
|
|
293
|
+
* @returns true if insertion successful, false if index out of bounds
|
|
294
|
+
*/
|
|
295
|
+
insert(index: number, item: T): boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Insert array of elements at specific logical index - O(n + m) where n is elements to shift, m is array length
|
|
298
|
+
* All elements at and after the index are shifted right to make room for the entire array
|
|
299
|
+
* @param index - Logical index (0 = front of queue)
|
|
300
|
+
* @param items - Array of elements to insert
|
|
301
|
+
* @returns true if insertion successful, false if index out of bounds
|
|
302
|
+
*/
|
|
303
|
+
insertArray(index: number, items: T[]): boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Insert another queue at specific logical index - O(n + m) where n is elements to shift, m is queue size
|
|
306
|
+
* All elements at and after the index are shifted right to make room for the entire queue
|
|
307
|
+
* @param index - Logical index (0 = front of queue)
|
|
308
|
+
* @param queue - Queue to insert
|
|
309
|
+
* @returns true if insertion successful, false if index out of bounds
|
|
310
|
+
*/
|
|
311
|
+
insertQueue(index: number, queue: Queue<T>): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Alias for enqueue (add to back)
|
|
314
|
+
*/
|
|
315
|
+
push(item: T): void;
|
|
316
|
+
/**
|
|
317
|
+
* Alias for enqueueFront (add to front)
|
|
318
|
+
*/
|
|
319
|
+
unshift(item: T): void;
|
|
320
|
+
/**
|
|
321
|
+
* Remove and return element from front of queue - O(1)
|
|
322
|
+
* Used for FIFO and LIFO patterns
|
|
323
|
+
*/
|
|
324
|
+
dequeue(): T | undefined;
|
|
325
|
+
/**
|
|
326
|
+
* Remove and return element from back of queue - O(1)
|
|
327
|
+
* Used for FILO and LILO patterns
|
|
328
|
+
*/
|
|
329
|
+
dequeueBack(): T | undefined;
|
|
330
|
+
indexOf(item: T): number;
|
|
331
|
+
remove(item: T): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Remove element at specific logical index - O(n)
|
|
334
|
+
* All elements after the index are shifted left
|
|
335
|
+
* @param index - Logical index (0 = front of queue)
|
|
336
|
+
* @returns The removed element, or undefined if index out of bounds
|
|
337
|
+
*/
|
|
338
|
+
removeAt(index: number): T | undefined;
|
|
339
|
+
/**
|
|
340
|
+
* Alias for dequeue (remove from front)
|
|
341
|
+
*/
|
|
342
|
+
shift(): T | undefined;
|
|
343
|
+
/**
|
|
344
|
+
* Alias for dequeueBack (remove from back)
|
|
345
|
+
*/
|
|
346
|
+
pop(): T | undefined;
|
|
347
|
+
/**
|
|
348
|
+
* FIFO: First In, First Out
|
|
349
|
+
* Add to back, remove from front
|
|
350
|
+
*/
|
|
351
|
+
fifoAdd(item: T): void;
|
|
352
|
+
fifoRemove(): T | undefined;
|
|
353
|
+
/**
|
|
354
|
+
* FILO: First In, Last Out
|
|
355
|
+
* Add to back, remove from back
|
|
356
|
+
*/
|
|
357
|
+
filoAdd(item: T): void;
|
|
358
|
+
filoRemove(): T | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* LIFO: Last In, First Out
|
|
361
|
+
* Add to front, remove from front
|
|
362
|
+
*/
|
|
363
|
+
lifoAdd(item: T): void;
|
|
364
|
+
lifoRemove(): T | undefined;
|
|
365
|
+
/**
|
|
366
|
+
* LILO: Last In, Last Out
|
|
367
|
+
* Add to front, remove from back
|
|
368
|
+
*/
|
|
369
|
+
liloAdd(item: T): void;
|
|
370
|
+
liloRemove(): T | undefined;
|
|
371
|
+
/**
|
|
372
|
+
* Get element at logical index (0 = front of queue) - O(1)
|
|
373
|
+
*/
|
|
374
|
+
get(index: number): T | undefined;
|
|
375
|
+
/**
|
|
376
|
+
* Set element at logical index - O(1)
|
|
377
|
+
*/
|
|
378
|
+
set(index: number, item: T): boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Get the front element without removing it - O(1)
|
|
381
|
+
*/
|
|
382
|
+
peek(): T | undefined;
|
|
383
|
+
/**
|
|
384
|
+
* Get the back element without removing it - O(1)
|
|
385
|
+
*/
|
|
386
|
+
peekBack(): T | undefined;
|
|
387
|
+
/**
|
|
388
|
+
* Alias for peek (front element)
|
|
389
|
+
*/
|
|
390
|
+
front(): T | undefined;
|
|
391
|
+
/**
|
|
392
|
+
* Alias for peekBack (back element)
|
|
393
|
+
*/
|
|
394
|
+
back(): T | undefined;
|
|
395
|
+
/**
|
|
396
|
+
* Get current size of queue - O(1)
|
|
397
|
+
*/
|
|
398
|
+
size(): number;
|
|
399
|
+
/**
|
|
400
|
+
* Get current capacity - O(1)
|
|
401
|
+
*/
|
|
402
|
+
getCapacity(): number;
|
|
403
|
+
/**
|
|
404
|
+
* Check if queue is empty - O(1)
|
|
405
|
+
*/
|
|
406
|
+
isEmpty(): boolean;
|
|
407
|
+
/**
|
|
408
|
+
* Check if queue is full - O(1)
|
|
409
|
+
*/
|
|
410
|
+
isFull(): boolean;
|
|
411
|
+
/**
|
|
412
|
+
* Clear all elements from queue - O(1)
|
|
413
|
+
*/
|
|
414
|
+
clear(): void;
|
|
415
|
+
/**
|
|
416
|
+
* Convert queue to array (maintains order from front to back) - O(n)
|
|
417
|
+
*/
|
|
418
|
+
toArray(): T[];
|
|
419
|
+
/**
|
|
420
|
+
* Forward iterator support for for...of loops - O(n) total
|
|
421
|
+
* Iterates from front to back
|
|
422
|
+
*/
|
|
423
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
424
|
+
/**
|
|
425
|
+
* Forward iterator (same as Symbol.iterator) - O(n) total
|
|
426
|
+
* Iterates from front to back
|
|
427
|
+
*/
|
|
428
|
+
forward(): IterableIterator<T>;
|
|
429
|
+
/**
|
|
430
|
+
* Reverse iterator - O(n) total
|
|
431
|
+
* Iterates from back to front
|
|
432
|
+
*/
|
|
433
|
+
reverse(): IterableIterator<T>;
|
|
434
|
+
/**
|
|
435
|
+
* Iterator with index information - O(n) total
|
|
436
|
+
* Returns [index, value] pairs from front to back
|
|
437
|
+
*/
|
|
438
|
+
entries(): IterableIterator<[number, T]>;
|
|
439
|
+
/**
|
|
440
|
+
* Iterator for keys (indices) - O(n) total
|
|
441
|
+
*/
|
|
442
|
+
keys(): IterableIterator<number>;
|
|
443
|
+
/**
|
|
444
|
+
* Iterator for values only - O(n) total
|
|
445
|
+
* Same as Symbol.iterator but more explicit
|
|
446
|
+
*/
|
|
447
|
+
values(): IterableIterator<T>;
|
|
448
|
+
/**
|
|
449
|
+
* Get string representation - O(n)
|
|
450
|
+
*/
|
|
451
|
+
toString(): string;
|
|
452
|
+
/**
|
|
453
|
+
* Private method to resize buffer when capacity is exceeded
|
|
454
|
+
*/
|
|
455
|
+
private resize;
|
|
456
|
+
/**
|
|
457
|
+
* Shift elements left (towards head) to make room for insertion
|
|
458
|
+
* Used when inserting closer to head
|
|
459
|
+
*/
|
|
460
|
+
private shiftLeft;
|
|
461
|
+
/**
|
|
462
|
+
* Shift elements right (towards tail) to make room for insertion
|
|
463
|
+
* Used when inserting closer to tail
|
|
464
|
+
*/
|
|
465
|
+
private shiftRight;
|
|
466
|
+
/**
|
|
467
|
+
* Shift elements right (towards tail) to fill gap after removal
|
|
468
|
+
* Used when removing closer to head
|
|
469
|
+
*/
|
|
470
|
+
private shiftRightForRemoval;
|
|
471
|
+
/**
|
|
472
|
+
* Shift elements left (towards head) to fill gap after removal
|
|
473
|
+
* Used when removing closer to tail
|
|
474
|
+
*/
|
|
475
|
+
private shiftLeftForRemoval;
|
|
476
|
+
/**
|
|
477
|
+
* Shift elements left (towards head) to make room for array insertion
|
|
478
|
+
* Used when inserting array closer to head
|
|
479
|
+
*/
|
|
480
|
+
private shiftLeftArray;
|
|
481
|
+
/**
|
|
482
|
+
* Shift elements right (towards tail) to make room for array insertion
|
|
483
|
+
* Used when inserting array closer to tail
|
|
484
|
+
*/
|
|
485
|
+
private shiftRightArray;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export declare interface ReactiveValue<T> {
|
|
489
|
+
get: () => T;
|
|
490
|
+
set: (newValue: T, flag?: boolean) => void;
|
|
491
|
+
onChange: (listener: ChangeListener<T>) => () => void;
|
|
492
|
+
nextChange: () => Promise<T>;
|
|
493
|
+
onChangePromise: (listener: ChangeListener<T>) => () => void;
|
|
494
|
+
triggerChange: () => void;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export declare interface RootAdjustment {
|
|
498
|
+
adjustedW: number;
|
|
499
|
+
adjustedH: number;
|
|
500
|
+
wasAdjusted: boolean;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
export declare type RootSide = Exclude<DropArea, 'contain'>;
|
|
504
|
+
|
|
505
|
+
/** @deprecated Replaced in 2.0 by `applyRect(element, rect)`. See https://github.com/xcode-studio/dynamix-layout/blob/main/docs/migration-v1-to-v2.md */
|
|
506
|
+
export declare function setElementRect(el: HTMLElement, { x, y, w, h }: Dimension): void;
|
|
507
|
+
|
|
508
|
+
export declare interface TabbarPlacement {
|
|
509
|
+
/** Box to give the tab bar element before `rotated` is applied. */
|
|
510
|
+
rect: Dimension;
|
|
511
|
+
/** Folded tabset in a side-by-side row: the bar is drawn as a vertical strip. */
|
|
512
|
+
rotated: boolean;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export declare type TabsIds = Map<string, string>;
|
|
516
|
+
|
|
517
|
+
declare type Timer = {
|
|
518
|
+
set: (callback: () => void, ms: number) => ReturnType<typeof setTimeout>;
|
|
519
|
+
clear: (handle: ReturnType<typeof setTimeout>) => void;
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamix-layout/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Dynamix Layout/Core is a JavaScript package for creating dynamic layouts with ease.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dynamix-layout",
|
|
@@ -21,23 +21,27 @@
|
|
|
21
21
|
],
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/xcode-studio/dynamix-layout.git",
|
|
24
|
+
"url": "git+https://github.com/xcode-studio/dynamix-layout.git",
|
|
25
25
|
"directory": "packages/core"
|
|
26
26
|
},
|
|
27
27
|
"bugs": {
|
|
28
28
|
"url": "https://github.com/xcode-studio/dynamix-layout/issues"
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/xcode-studio/dynamix-layout#readme",
|
|
31
|
-
"main": "./dist/core.cjs
|
|
31
|
+
"main": "./dist/core.cjs",
|
|
32
32
|
"module": "./dist/core.es.js",
|
|
33
|
-
"browser": "./dist/core.iife.js",
|
|
34
33
|
"types": "./dist/types/index.d.ts",
|
|
35
34
|
"typings": "./dist/types/index.d.ts",
|
|
36
35
|
"exports": {
|
|
37
36
|
".": {
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./dist/types/index.d.ts",
|
|
39
|
+
"default": "./dist/core.es.js"
|
|
40
|
+
},
|
|
41
|
+
"require": {
|
|
42
|
+
"types": "./dist/types/index.d.cts",
|
|
43
|
+
"default": "./dist/core.cjs"
|
|
44
|
+
}
|
|
41
45
|
}
|
|
42
46
|
},
|
|
43
47
|
"files": [
|
|
@@ -53,8 +57,7 @@
|
|
|
53
57
|
},
|
|
54
58
|
"type": "module",
|
|
55
59
|
"engines": {
|
|
56
|
-
"node": ">=
|
|
57
|
-
"pnpm": ">=10.13.1"
|
|
60
|
+
"node": ">=18"
|
|
58
61
|
},
|
|
59
62
|
"devDependencies": {
|
|
60
63
|
"@changesets/cli": "^2.31.1",
|