@zengrid/shared 1.0.2 → 1.0.3
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/package.json +1 -1
- package/dist/README.md +0 -44
- package/dist/index.cjs.default.js +0 -1
- package/dist/index.cjs.js +0 -6250
- package/dist/index.cjs.mjs +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +0 -6207
- package/dist/package.json +0 -54
- package/dist/src/algorithms/filter/bloom-filter.d.ts +0 -120
- package/dist/src/algorithms/filter/bloom-filter.d.ts.map +0 -1
- package/dist/src/algorithms/filter/index.d.ts +0 -7
- package/dist/src/algorithms/filter/index.d.ts.map +0 -1
- package/dist/src/algorithms/graph/bfs.d.ts +0 -71
- package/dist/src/algorithms/graph/bfs.d.ts.map +0 -1
- package/dist/src/algorithms/graph/dfs.d.ts +0 -62
- package/dist/src/algorithms/graph/dfs.d.ts.map +0 -1
- package/dist/src/algorithms/graph/graph.interface.d.ts +0 -63
- package/dist/src/algorithms/graph/graph.interface.d.ts.map +0 -1
- package/dist/src/algorithms/graph/index.d.ts +0 -9
- package/dist/src/algorithms/graph/index.d.ts.map +0 -1
- package/dist/src/algorithms/index.d.ts +0 -11
- package/dist/src/algorithms/index.d.ts.map +0 -1
- package/dist/src/algorithms/pattern/index.d.ts +0 -8
- package/dist/src/algorithms/pattern/index.d.ts.map +0 -1
- package/dist/src/algorithms/pattern/sequence-detector.d.ts +0 -62
- package/dist/src/algorithms/pattern/sequence-detector.d.ts.map +0 -1
- package/dist/src/algorithms/search/binary-search.d.ts +0 -86
- package/dist/src/algorithms/search/binary-search.d.ts.map +0 -1
- package/dist/src/algorithms/search/index.d.ts +0 -6
- package/dist/src/algorithms/search/index.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/comparators.d.ts +0 -126
- package/dist/src/algorithms/sorting/comparators.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/index.d.ts +0 -9
- package/dist/src/algorithms/sorting/index.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/sorting.interface.d.ts +0 -38
- package/dist/src/algorithms/sorting/sorting.interface.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/timsort.d.ts +0 -55
- package/dist/src/algorithms/sorting/timsort.d.ts.map +0 -1
- package/dist/src/data-structures/column-store/column-store.d.ts +0 -52
- package/dist/src/data-structures/column-store/column-store.d.ts.map +0 -1
- package/dist/src/data-structures/column-store/column-store.interface.d.ts +0 -155
- package/dist/src/data-structures/column-store/column-store.interface.d.ts.map +0 -1
- package/dist/src/data-structures/column-store/index.d.ts +0 -6
- package/dist/src/data-structures/column-store/index.d.ts.map +0 -1
- package/dist/src/data-structures/command-stack/command-stack.d.ts +0 -61
- package/dist/src/data-structures/command-stack/command-stack.d.ts.map +0 -1
- package/dist/src/data-structures/command-stack/command-stack.interface.d.ts +0 -80
- package/dist/src/data-structures/command-stack/command-stack.interface.d.ts.map +0 -1
- package/dist/src/data-structures/command-stack/index.d.ts +0 -3
- package/dist/src/data-structures/command-stack/index.d.ts.map +0 -1
- package/dist/src/data-structures/dependency-graph/dependency-graph.d.ts +0 -147
- package/dist/src/data-structures/dependency-graph/dependency-graph.d.ts.map +0 -1
- package/dist/src/data-structures/dependency-graph/dependency-graph.interface.d.ts +0 -161
- package/dist/src/data-structures/dependency-graph/dependency-graph.interface.d.ts.map +0 -1
- package/dist/src/data-structures/dependency-graph/index.d.ts +0 -8
- package/dist/src/data-structures/dependency-graph/index.d.ts.map +0 -1
- package/dist/src/data-structures/disjoint-set/disjoint-set.d.ts +0 -84
- package/dist/src/data-structures/disjoint-set/disjoint-set.d.ts.map +0 -1
- package/dist/src/data-structures/disjoint-set/disjoint-set.interface.d.ts +0 -185
- package/dist/src/data-structures/disjoint-set/disjoint-set.interface.d.ts.map +0 -1
- package/dist/src/data-structures/disjoint-set/index.d.ts +0 -7
- package/dist/src/data-structures/disjoint-set/index.d.ts.map +0 -1
- package/dist/src/data-structures/index-map/index-map.d.ts +0 -150
- package/dist/src/data-structures/index-map/index-map.d.ts.map +0 -1
- package/dist/src/data-structures/index-map/index-map.interface.d.ts +0 -186
- package/dist/src/data-structures/index-map/index-map.interface.d.ts.map +0 -1
- package/dist/src/data-structures/index-map/index.d.ts +0 -6
- package/dist/src/data-structures/index-map/index.d.ts.map +0 -1
- package/dist/src/data-structures/index.d.ts +0 -36
- package/dist/src/data-structures/index.d.ts.map +0 -1
- package/dist/src/data-structures/interval-tree/index.d.ts +0 -7
- package/dist/src/data-structures/interval-tree/index.d.ts.map +0 -1
- package/dist/src/data-structures/interval-tree/interval-tree.d.ts +0 -141
- package/dist/src/data-structures/interval-tree/interval-tree.d.ts.map +0 -1
- package/dist/src/data-structures/interval-tree/interval-tree.interface.d.ts +0 -212
- package/dist/src/data-structures/interval-tree/interval-tree.interface.d.ts.map +0 -1
- package/dist/src/data-structures/lru-cache/index.d.ts +0 -3
- package/dist/src/data-structures/lru-cache/index.d.ts.map +0 -1
- package/dist/src/data-structures/lru-cache/lru-cache.d.ts +0 -134
- package/dist/src/data-structures/lru-cache/lru-cache.d.ts.map +0 -1
- package/dist/src/data-structures/lru-cache/lru-cache.interface.d.ts +0 -173
- package/dist/src/data-structures/lru-cache/lru-cache.interface.d.ts.map +0 -1
- package/dist/src/data-structures/prefix-sum-array/index.d.ts +0 -6
- package/dist/src/data-structures/prefix-sum-array/index.d.ts.map +0 -1
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.d.ts +0 -63
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.d.ts.map +0 -1
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.interface.d.ts +0 -80
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.interface.d.ts.map +0 -1
- package/dist/src/data-structures/rtree/index.d.ts +0 -8
- package/dist/src/data-structures/rtree/index.d.ts.map +0 -1
- package/dist/src/data-structures/rtree/rtree.d.ts +0 -81
- package/dist/src/data-structures/rtree/rtree.d.ts.map +0 -1
- package/dist/src/data-structures/rtree/rtree.interface.d.ts +0 -143
- package/dist/src/data-structures/rtree/rtree.interface.d.ts.map +0 -1
- package/dist/src/data-structures/segment-tree/index.d.ts +0 -4
- package/dist/src/data-structures/segment-tree/index.d.ts.map +0 -1
- package/dist/src/data-structures/segment-tree/segment-tree.d.ts +0 -134
- package/dist/src/data-structures/segment-tree/segment-tree.d.ts.map +0 -1
- package/dist/src/data-structures/segment-tree/segment-tree.interface.d.ts +0 -202
- package/dist/src/data-structures/segment-tree/segment-tree.interface.d.ts.map +0 -1
- package/dist/src/data-structures/skip-list/index.d.ts +0 -4
- package/dist/src/data-structures/skip-list/index.d.ts.map +0 -1
- package/dist/src/data-structures/skip-list/skip-list.d.ts +0 -137
- package/dist/src/data-structures/skip-list/skip-list.d.ts.map +0 -1
- package/dist/src/data-structures/skip-list/skip-list.interface.d.ts +0 -223
- package/dist/src/data-structures/skip-list/skip-list.interface.d.ts.map +0 -1
- package/dist/src/data-structures/sparse-matrix/index.d.ts +0 -6
- package/dist/src/data-structures/sparse-matrix/index.d.ts.map +0 -1
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.d.ts +0 -44
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.d.ts.map +0 -1
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.interface.d.ts +0 -105
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.interface.d.ts.map +0 -1
- package/dist/src/data-structures/suffix-array/index.d.ts +0 -3
- package/dist/src/data-structures/suffix-array/index.d.ts.map +0 -1
- package/dist/src/data-structures/suffix-array/suffix-array.d.ts +0 -102
- package/dist/src/data-structures/suffix-array/suffix-array.d.ts.map +0 -1
- package/dist/src/data-structures/suffix-array/suffix-array.interface.d.ts +0 -117
- package/dist/src/data-structures/suffix-array/suffix-array.interface.d.ts.map +0 -1
- package/dist/src/data-structures/trie/index.d.ts +0 -8
- package/dist/src/data-structures/trie/index.d.ts.map +0 -1
- package/dist/src/data-structures/trie/trie.d.ts +0 -205
- package/dist/src/data-structures/trie/trie.d.ts.map +0 -1
- package/dist/src/data-structures/trie/trie.interface.d.ts +0 -117
- package/dist/src/data-structures/trie/trie.interface.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -47
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/patterns/coordinator.d.ts +0 -90
- package/dist/src/patterns/coordinator.d.ts.map +0 -1
- package/dist/src/patterns/event-emitter.d.ts +0 -106
- package/dist/src/patterns/event-emitter.d.ts.map +0 -1
- package/dist/src/patterns/factory.d.ts +0 -120
- package/dist/src/patterns/factory.d.ts.map +0 -1
- package/dist/src/patterns/index.d.ts +0 -21
- package/dist/src/patterns/index.d.ts.map +0 -1
- package/dist/src/patterns/mediator.d.ts +0 -116
- package/dist/src/patterns/mediator.d.ts.map +0 -1
- package/dist/src/patterns/object-pool.d.ts +0 -178
- package/dist/src/patterns/object-pool.d.ts.map +0 -1
- package/dist/src/patterns/observer.d.ts +0 -89
- package/dist/src/patterns/observer.d.ts.map +0 -1
- package/dist/src/patterns/operation-mode.d.ts +0 -75
- package/dist/src/patterns/operation-mode.d.ts.map +0 -1
- package/dist/src/patterns/state-machine.d.ts +0 -122
- package/dist/src/patterns/state-machine.d.ts.map +0 -1
- package/dist/src/types/common.d.ts +0 -56
- package/dist/src/types/common.d.ts.map +0 -1
- package/dist/src/types/index.d.ts +0 -5
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts +0 -7
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/timing.d.ts +0 -104
- package/dist/src/utils/timing.d.ts.map +0 -1
- package/dist/src/utils/timing.interface.d.ts +0 -96
- package/dist/src/utils/timing.interface.d.ts.map +0 -1
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import type { Comparator } from '../../types/common';
|
|
2
|
-
import type { NullPosition } from './sorting.interface';
|
|
3
|
-
/**
|
|
4
|
-
* Options for string comparator
|
|
5
|
-
*/
|
|
6
|
-
export interface StringComparatorOptions {
|
|
7
|
-
/** Case-insensitive comparison */
|
|
8
|
-
caseInsensitive?: boolean;
|
|
9
|
-
/** Use locale-aware comparison */
|
|
10
|
-
localeCompare?: boolean;
|
|
11
|
-
/** Locale for comparison (e.g., 'en-US') */
|
|
12
|
-
locale?: string;
|
|
13
|
-
/** Where to place null/undefined values */
|
|
14
|
-
nullPosition?: NullPosition;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Create a numeric comparator
|
|
18
|
-
*
|
|
19
|
-
* @param nullPosition - Where to place null values in sort order
|
|
20
|
-
* @returns Comparator function
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* const numbers = [3, null, 1, undefined, 2];
|
|
25
|
-
* numbers.sort(numericComparator('last'));
|
|
26
|
-
* // [1, 2, 3, null, undefined]
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare function numericComparator(nullPosition?: NullPosition): Comparator<any>;
|
|
30
|
-
/**
|
|
31
|
-
* Create a string comparator
|
|
32
|
-
*
|
|
33
|
-
* @param options - Comparator options
|
|
34
|
-
* @returns Comparator function
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```typescript
|
|
38
|
-
* const names = ['Bob', 'alice', 'Charlie'];
|
|
39
|
-
* names.sort(stringComparator({ caseInsensitive: true }));
|
|
40
|
-
* // ['alice', 'Bob', 'Charlie']
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export declare function stringComparator(options?: StringComparatorOptions): Comparator<any>;
|
|
44
|
-
/**
|
|
45
|
-
* Create a date comparator
|
|
46
|
-
*
|
|
47
|
-
* @param nullPosition - Where to place null values
|
|
48
|
-
* @returns Comparator function
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```typescript
|
|
52
|
-
* const dates = [new Date('2023-01-15'), null, new Date('2023-01-01')];
|
|
53
|
-
* dates.sort(dateComparator('last'));
|
|
54
|
-
* // [2023-01-01, 2023-01-15, null]
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
export declare function dateComparator(nullPosition?: NullPosition): Comparator<any>;
|
|
58
|
-
/**
|
|
59
|
-
* Create a boolean comparator (false < true)
|
|
60
|
-
*
|
|
61
|
-
* @param nullPosition - Where to place null values
|
|
62
|
-
* @returns Comparator function
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```typescript
|
|
66
|
-
* const values = [true, null, false, true];
|
|
67
|
-
* values.sort(booleanComparator('last'));
|
|
68
|
-
* // [false, true, true, null]
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
export declare function booleanComparator(nullPosition?: NullPosition): Comparator<any>;
|
|
72
|
-
/**
|
|
73
|
-
* Auto-detect type and create appropriate comparator
|
|
74
|
-
*
|
|
75
|
-
* @param sampleValues - Sample values to detect type from
|
|
76
|
-
* @param options - Options for the comparator
|
|
77
|
-
* @returns Comparator function
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```typescript
|
|
81
|
-
* const data = [3, 1, 4, 1, 5];
|
|
82
|
-
* data.sort(autoComparator(data));
|
|
83
|
-
* // [1, 1, 3, 4, 5] - numeric comparison
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export declare function autoComparator(sampleValues: any[], options?: {
|
|
87
|
-
nullPosition?: NullPosition;
|
|
88
|
-
}): Comparator<any>;
|
|
89
|
-
/**
|
|
90
|
-
* Reverse a comparator (ascending to descending)
|
|
91
|
-
*
|
|
92
|
-
* @param comparator - Comparator to reverse
|
|
93
|
-
* @returns Reversed comparator
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```typescript
|
|
97
|
-
* const desc = reverseComparator(numericComparator());
|
|
98
|
-
* [1, 2, 3].sort(desc);
|
|
99
|
-
* // [3, 2, 1]
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
export declare function reverseComparator<T>(comparator: Comparator<T>): Comparator<T>;
|
|
103
|
-
/**
|
|
104
|
-
* Chain multiple comparators (for multi-column sort)
|
|
105
|
-
*
|
|
106
|
-
* @param comparators - Comparators in priority order
|
|
107
|
-
* @returns Chained comparator
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* ```typescript
|
|
111
|
-
* // Sort by age, then by name
|
|
112
|
-
* const data = [
|
|
113
|
-
* { age: 30, name: 'Bob' },
|
|
114
|
-
* { age: 25, name: 'Alice' },
|
|
115
|
-
* { age: 30, name: 'Charlie' }
|
|
116
|
-
* ];
|
|
117
|
-
*
|
|
118
|
-
* data.sort(chainComparators(
|
|
119
|
-
* (a, b) => a.age - b.age,
|
|
120
|
-
* (a, b) => a.name.localeCompare(b.name)
|
|
121
|
-
* ));
|
|
122
|
-
* // Alice (25), Bob (30), Charlie (30)
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
export declare function chainComparators<T>(...comparators: Comparator<T>[]): Comparator<T>;
|
|
126
|
-
//# sourceMappingURL=comparators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"comparators.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/algorithms/sorting/comparators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,kCAAkC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,GAAE,YAAqB,GAClC,UAAU,CAAC,GAAG,CAAC,CAajB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,uBAA4B,GACpC,UAAU,CAAC,GAAG,CAAC,CAyBjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,YAAY,GAAE,YAAqB,GAClC,UAAU,CAAC,GAAG,CAAC,CAgBjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,GAAE,YAAqB,GAClC,UAAU,CAAC,GAAG,CAAC,CAQjB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,YAAY,EAAE,GAAG,EAAE,EACnB,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,YAAY,CAAA;CAAO,GAC5C,UAAU,CAAC,GAAG,CAAC,CA2BjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GACxB,UAAU,CAAC,CAAC,CAAC,CAEf;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAC9B,UAAU,CAAC,CAAC,CAAC,CAUf"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sorting algorithms and comparators
|
|
3
|
-
* @packageDocumentation
|
|
4
|
-
*/
|
|
5
|
-
export type { NullPosition, TimsortOptions, SortMetadata, } from './sorting.interface';
|
|
6
|
-
export { numericComparator, stringComparator, dateComparator, booleanComparator, autoComparator, reverseComparator, chainComparators, } from './comparators';
|
|
7
|
-
export type { StringComparatorOptions } from './comparators';
|
|
8
|
-
export { timsort, timsortIndices, isSorted } from './timsort';
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/algorithms/sorting/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Position for null/undefined values in sort order
|
|
3
|
-
*/
|
|
4
|
-
export type NullPosition = 'first' | 'last' | 'natural';
|
|
5
|
-
/**
|
|
6
|
-
* Options for Timsort algorithm
|
|
7
|
-
*/
|
|
8
|
-
export interface TimsortOptions {
|
|
9
|
-
/**
|
|
10
|
-
* Minimum run length for merge sort
|
|
11
|
-
* Smaller values = more merges, larger values = more insertions
|
|
12
|
-
* Default: 32 (optimal for most cases)
|
|
13
|
-
*/
|
|
14
|
-
minRun?: number;
|
|
15
|
-
/**
|
|
16
|
-
* Whether to use stable sorting
|
|
17
|
-
* Default: true
|
|
18
|
-
*/
|
|
19
|
-
stable?: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Result of a sort operation with metadata
|
|
23
|
-
*/
|
|
24
|
-
export interface SortMetadata {
|
|
25
|
-
/**
|
|
26
|
-
* Time taken in milliseconds
|
|
27
|
-
*/
|
|
28
|
-
duration: number;
|
|
29
|
-
/**
|
|
30
|
-
* Number of comparisons performed
|
|
31
|
-
*/
|
|
32
|
-
comparisons?: number;
|
|
33
|
-
/**
|
|
34
|
-
* Number of swaps/moves performed
|
|
35
|
-
*/
|
|
36
|
-
swaps?: number;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=sorting.interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sorting.interface.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/algorithms/sorting/sorting.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { Comparator } from '../../types/common';
|
|
2
|
-
import type { TimsortOptions } from './sorting.interface';
|
|
3
|
-
/**
|
|
4
|
-
* Timsort - Production-grade stable O(n log n) sorting algorithm
|
|
5
|
-
*
|
|
6
|
-
* This is a full implementation of Timsort with all optimizations:
|
|
7
|
-
* - Natural run detection (finds already-sorted sequences)
|
|
8
|
-
* - Galloping mode (binary search optimization during merges)
|
|
9
|
-
* - Stack-based merge strategy (maintains merge invariants)
|
|
10
|
-
* - Reusable temporary buffer (reduces allocations)
|
|
11
|
-
*
|
|
12
|
-
* Used by Python, Java, and V8's Array.sort().
|
|
13
|
-
*
|
|
14
|
-
* @param array - Array to sort (modified in-place)
|
|
15
|
-
* @param comparator - Comparison function
|
|
16
|
-
* @param options - Timsort options
|
|
17
|
-
* @returns The sorted array
|
|
18
|
-
*
|
|
19
|
-
* @complexity
|
|
20
|
-
* - Time: O(n log n) worst case, O(n) best case (already sorted)
|
|
21
|
-
* - Space: O(n) for temporary merge buffer
|
|
22
|
-
*/
|
|
23
|
-
export declare function timsort<T>(array: T[], comparator: Comparator<T>, options?: TimsortOptions): T[];
|
|
24
|
-
/**
|
|
25
|
-
* Sort indices based on values without modifying the values
|
|
26
|
-
*
|
|
27
|
-
* @param indices - Array of indices to sort
|
|
28
|
-
* @param getValue - Function to get value at an index
|
|
29
|
-
* @param comparator - Comparison function for values
|
|
30
|
-
* @param options - Timsort options
|
|
31
|
-
* @returns Sorted array of indices
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* const values = ['Charlie', 'Alice', 'Bob'];
|
|
36
|
-
* const indices = [0, 1, 2];
|
|
37
|
-
*
|
|
38
|
-
* const sorted = timsortIndices(
|
|
39
|
-
* indices,
|
|
40
|
-
* (i) => values[i],
|
|
41
|
-
* (a, b) => a.localeCompare(b)
|
|
42
|
-
* );
|
|
43
|
-
* // sorted = [1, 2, 0] (Alice, Bob, Charlie)
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function timsortIndices<T>(indices: number[], getValue: (index: number) => T, comparator: Comparator<T>, options?: TimsortOptions): number[];
|
|
47
|
-
/**
|
|
48
|
-
* Check if an array is sorted
|
|
49
|
-
*
|
|
50
|
-
* @param array - Array to check
|
|
51
|
-
* @param comparator - Comparison function
|
|
52
|
-
* @returns True if sorted
|
|
53
|
-
*/
|
|
54
|
-
export declare function isSorted<T>(array: readonly T[], comparator: Comparator<T>): boolean;
|
|
55
|
-
//# sourceMappingURL=timsort.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timsort.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/algorithms/sorting/timsort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAyB1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACvB,KAAK,EAAE,CAAC,EAAE,EACV,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EACzB,OAAO,GAAE,cAAmB,GAC3B,CAAC,EAAE,CAUL;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,OAAO,EAAE,MAAM,EAAE,EACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,EAC9B,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EACzB,OAAO,GAAE,cAAmB,GAC3B,MAAM,EAAE,CAOV;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GACxB,OAAO,CAOT"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { ColumnStore as IColumnStore, ColumnStoreOptions, ColumnDefinition, AggregateOperation, AggregationResult } from './column-store.interface';
|
|
2
|
-
/**
|
|
3
|
-
* ColumnStore implementation using typed arrays
|
|
4
|
-
*
|
|
5
|
-
* Column-oriented storage for dense grid data.
|
|
6
|
-
* Uses typed arrays for numeric columns for better performance and memory efficiency.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const store = new ColumnStore({
|
|
11
|
-
* rowCount: 1000,
|
|
12
|
-
* columns: [
|
|
13
|
-
* { name: 'id', type: 'int32' },
|
|
14
|
-
* { name: 'value', type: 'float64' },
|
|
15
|
-
* { name: 'label', type: 'string' }
|
|
16
|
-
* ]
|
|
17
|
-
* });
|
|
18
|
-
*
|
|
19
|
-
* store.setValue(0, 'id', 1);
|
|
20
|
-
* store.setValue(0, 'value', 99.5);
|
|
21
|
-
* store.setValue(0, 'label', 'Item 1');
|
|
22
|
-
*
|
|
23
|
-
* const sum = store.aggregate('value', 'sum');
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export declare class ColumnStore implements IColumnStore {
|
|
27
|
-
private data;
|
|
28
|
-
private columnTypes;
|
|
29
|
-
private rows;
|
|
30
|
-
private autoGrow;
|
|
31
|
-
constructor(options?: ColumnStoreOptions);
|
|
32
|
-
addColumn(definition: ColumnDefinition): void;
|
|
33
|
-
private createColumn;
|
|
34
|
-
private fillColumn;
|
|
35
|
-
removeColumn(columnName: string): boolean;
|
|
36
|
-
hasColumn(columnName: string): boolean;
|
|
37
|
-
getValue(row: number, columnName: string): any;
|
|
38
|
-
setValue(row: number, columnName: string, value: any): void;
|
|
39
|
-
private coerceValue;
|
|
40
|
-
getRow(row: number): Record<string, any>;
|
|
41
|
-
setRow(row: number, values: Record<string, any>): void;
|
|
42
|
-
getColumn(columnName: string): any[];
|
|
43
|
-
setColumn(columnName: string, values: any[]): void;
|
|
44
|
-
aggregate(columnName: string, operation: AggregateOperation): AggregationResult;
|
|
45
|
-
addRows(count: number): void;
|
|
46
|
-
clear(): void;
|
|
47
|
-
private ensureRowExists;
|
|
48
|
-
get rowCount(): number;
|
|
49
|
-
get columnCount(): number;
|
|
50
|
-
get columns(): ReadonlyArray<string>;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=column-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column-store.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/data-structures/column-store/column-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,IAAI,YAAY,EAC3B,kBAAkB,EAClB,gBAAgB,EAEhB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,IAAI,CAAiD;IAC7D,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAU;gBAEd,OAAO,GAAE,kBAAuB;IAc5C,SAAS,CAAC,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAgB7C,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,UAAU;IAalB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAQzC,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAItC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG;IAW9C,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAY3D,OAAO,CAAC,WAAW;IA8BnB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAUxC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAUtD,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,EAAE;IASpC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;IAmBlD,SAAS,CACP,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,kBAAkB,GAC5B,iBAAiB;IA+FpB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAiC5B,KAAK,IAAI,IAAI;IAYb,OAAO,CAAC,eAAe;IAgBvB,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAEnC;CACF"}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Column Store interfaces for ZenGrid
|
|
3
|
-
* Column-oriented storage using typed arrays for performance
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Supported column data types
|
|
7
|
-
*/
|
|
8
|
-
export type ColumnType = 'int32' | 'float64' | 'string' | 'boolean';
|
|
9
|
-
/**
|
|
10
|
-
* Aggregation operations
|
|
11
|
-
*/
|
|
12
|
-
export type AggregateOperation = 'sum' | 'avg' | 'min' | 'max' | 'count';
|
|
13
|
-
/**
|
|
14
|
-
* Column definition
|
|
15
|
-
*/
|
|
16
|
-
export interface ColumnDefinition {
|
|
17
|
-
/** Column name/identifier */
|
|
18
|
-
name: string;
|
|
19
|
-
/** Data type */
|
|
20
|
-
type: ColumnType;
|
|
21
|
-
/** Default value for new rows */
|
|
22
|
-
defaultValue?: any;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Aggregation result
|
|
26
|
-
*/
|
|
27
|
-
export interface AggregationResult {
|
|
28
|
-
operation: AggregateOperation;
|
|
29
|
-
column: string;
|
|
30
|
-
value: number;
|
|
31
|
-
count: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Column Store interface
|
|
35
|
-
*
|
|
36
|
-
* Column-oriented storage for dense grid data.
|
|
37
|
-
* Uses typed arrays (Float64Array, Int32Array) for numeric columns for better performance.
|
|
38
|
-
*/
|
|
39
|
-
export interface ColumnStore {
|
|
40
|
-
/**
|
|
41
|
-
* Add a new column
|
|
42
|
-
* @param definition - Column definition
|
|
43
|
-
* @complexity O(n) where n = rowCount
|
|
44
|
-
*/
|
|
45
|
-
addColumn(definition: ColumnDefinition): void;
|
|
46
|
-
/**
|
|
47
|
-
* Remove a column
|
|
48
|
-
* @param columnName - Column to remove
|
|
49
|
-
* @returns true if column existed and was removed
|
|
50
|
-
* @complexity O(1)
|
|
51
|
-
*/
|
|
52
|
-
removeColumn(columnName: string): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Check if column exists
|
|
55
|
-
* @param columnName - Column name
|
|
56
|
-
* @complexity O(1)
|
|
57
|
-
*/
|
|
58
|
-
hasColumn(columnName: string): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Get value at (row, column)
|
|
61
|
-
* @param row - Row index
|
|
62
|
-
* @param columnName - Column name
|
|
63
|
-
* @returns Value or undefined if out of bounds
|
|
64
|
-
* @complexity O(1)
|
|
65
|
-
*/
|
|
66
|
-
getValue(row: number, columnName: string): any;
|
|
67
|
-
/**
|
|
68
|
-
* Set value at (row, column)
|
|
69
|
-
* @param row - Row index
|
|
70
|
-
* @param columnName - Column name
|
|
71
|
-
* @param value - Value to set
|
|
72
|
-
* @complexity O(1)
|
|
73
|
-
*/
|
|
74
|
-
setValue(row: number, columnName: string, value: any): void;
|
|
75
|
-
/**
|
|
76
|
-
* Get entire row as object
|
|
77
|
-
* @param row - Row index
|
|
78
|
-
* @returns Object with column names as keys
|
|
79
|
-
* @complexity O(c) where c = number of columns
|
|
80
|
-
*/
|
|
81
|
-
getRow(row: number): Record<string, any>;
|
|
82
|
-
/**
|
|
83
|
-
* Set multiple values in a row
|
|
84
|
-
* @param row - Row index
|
|
85
|
-
* @param values - Object with column names and values
|
|
86
|
-
* @complexity O(k) where k = Object.keys(values).length
|
|
87
|
-
*/
|
|
88
|
-
setRow(row: number, values: Record<string, any>): void;
|
|
89
|
-
/**
|
|
90
|
-
* Get entire column as array
|
|
91
|
-
* @param columnName - Column name
|
|
92
|
-
* @returns Copy of column data
|
|
93
|
-
* @complexity O(n) where n = rowCount
|
|
94
|
-
*/
|
|
95
|
-
getColumn(columnName: string): any[];
|
|
96
|
-
/**
|
|
97
|
-
* Set entire column
|
|
98
|
-
* @param columnName - Column name
|
|
99
|
-
* @param values - Array of values (length must match rowCount)
|
|
100
|
-
* @complexity O(n)
|
|
101
|
-
*/
|
|
102
|
-
setColumn(columnName: string, values: any[]): void;
|
|
103
|
-
/**
|
|
104
|
-
* Perform aggregation on a column
|
|
105
|
-
* @param columnName - Column to aggregate
|
|
106
|
-
* @param operation - Aggregation operation
|
|
107
|
-
* @returns Aggregation result
|
|
108
|
-
* @complexity O(n)
|
|
109
|
-
*/
|
|
110
|
-
aggregate(columnName: string, operation: AggregateOperation): AggregationResult;
|
|
111
|
-
/**
|
|
112
|
-
* Add new rows (expand capacity)
|
|
113
|
-
* @param count - Number of rows to add
|
|
114
|
-
* @complexity O(n * c) where n = count, c = columns
|
|
115
|
-
*/
|
|
116
|
-
addRows(count: number): void;
|
|
117
|
-
/**
|
|
118
|
-
* Clear all data but keep column definitions
|
|
119
|
-
* @complexity O(c) where c = number of columns
|
|
120
|
-
*/
|
|
121
|
-
clear(): void;
|
|
122
|
-
/**
|
|
123
|
-
* Number of rows
|
|
124
|
-
*/
|
|
125
|
-
readonly rowCount: number;
|
|
126
|
-
/**
|
|
127
|
-
* Number of columns
|
|
128
|
-
*/
|
|
129
|
-
readonly columnCount: number;
|
|
130
|
-
/**
|
|
131
|
-
* Column names
|
|
132
|
-
*/
|
|
133
|
-
readonly columns: ReadonlyArray<string>;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Options for creating a ColumnStore
|
|
137
|
-
*/
|
|
138
|
-
export interface ColumnStoreOptions {
|
|
139
|
-
/**
|
|
140
|
-
* Initial row count
|
|
141
|
-
* @default 0
|
|
142
|
-
*/
|
|
143
|
-
rowCount?: number;
|
|
144
|
-
/**
|
|
145
|
-
* Column definitions
|
|
146
|
-
* @default []
|
|
147
|
-
*/
|
|
148
|
-
columns?: ColumnDefinition[];
|
|
149
|
-
/**
|
|
150
|
-
* Whether to grow automatically when accessing rows beyond rowCount
|
|
151
|
-
* @default false
|
|
152
|
-
*/
|
|
153
|
-
autoGrow?: boolean;
|
|
154
|
-
}
|
|
155
|
-
//# sourceMappingURL=column-store.interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column-store.interface.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/data-structures/column-store/column-store.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,iCAAiC;IACjC,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,SAAS,CAAC,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE9C;;;;;OAKG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IAE1C;;;;OAIG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IAEvC;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,CAAC;IAE/C;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;IAE5D;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEzC;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAEvD;;;;;OAKG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC;IAErC;;;;;OAKG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEnD;;;;;;OAMG;IACH,SAAS,CACP,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,kBAAkB,GAC5B,iBAAiB,CAAC;IAErB;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;OAGG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Column Store - Column-oriented storage with typed arrays
|
|
3
|
-
*/
|
|
4
|
-
export { ColumnStore } from './column-store';
|
|
5
|
-
export type { ColumnStore as IColumnStore, ColumnStoreOptions, ColumnDefinition, ColumnType, AggregateOperation, AggregationResult, } from './column-store.interface';
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/data-structures/column-store/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EACV,WAAW,IAAI,YAAY,EAC3B,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { ICommand, ICommandStack, ICommandStackOptions } from './command-stack.interface';
|
|
2
|
-
/**
|
|
3
|
-
* Implementation of a command stack for undo/redo functionality.
|
|
4
|
-
*
|
|
5
|
-
* Time Complexity:
|
|
6
|
-
* - execute: O(1)
|
|
7
|
-
* - undo: O(1)
|
|
8
|
-
* - redo: O(1)
|
|
9
|
-
* - canUndo/canRedo: O(1)
|
|
10
|
-
* - clear: O(1)
|
|
11
|
-
*
|
|
12
|
-
* Space Complexity: O(n) where n is the number of commands (up to maxSize)
|
|
13
|
-
*/
|
|
14
|
-
export declare class CommandStack implements ICommandStack {
|
|
15
|
-
private undoStack;
|
|
16
|
-
private redoStack;
|
|
17
|
-
private readonly maxSize;
|
|
18
|
-
constructor(options?: ICommandStackOptions);
|
|
19
|
-
/**
|
|
20
|
-
* Executes a command and adds it to the undo stack.
|
|
21
|
-
* Clears the redo stack as new actions invalidate the redo history.
|
|
22
|
-
*/
|
|
23
|
-
execute(command: ICommand): void;
|
|
24
|
-
/**
|
|
25
|
-
* Undoes the last executed command.
|
|
26
|
-
*/
|
|
27
|
-
undo(): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Redoes the last undone command.
|
|
30
|
-
*/
|
|
31
|
-
redo(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Checks if there are commands that can be undone.
|
|
34
|
-
*/
|
|
35
|
-
canUndo(): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Checks if there are commands that can be redone.
|
|
38
|
-
*/
|
|
39
|
-
canRedo(): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Clears all commands from both stacks.
|
|
42
|
-
*/
|
|
43
|
-
clear(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Gets the number of commands in the undo stack.
|
|
46
|
-
*/
|
|
47
|
-
getUndoCount(): number;
|
|
48
|
-
/**
|
|
49
|
-
* Gets the number of commands in the redo stack.
|
|
50
|
-
*/
|
|
51
|
-
getRedoCount(): number;
|
|
52
|
-
/**
|
|
53
|
-
* Gets the descriptions of all commands in the undo stack.
|
|
54
|
-
*/
|
|
55
|
-
getUndoHistory(): string[];
|
|
56
|
-
/**
|
|
57
|
-
* Gets the descriptions of all commands in the redo stack.
|
|
58
|
-
*/
|
|
59
|
-
getRedoHistory(): string[];
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=command-stack.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-stack.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/data-structures/command-stack/command-stack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,YAAW,aAAa;IAChD,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,GAAE,oBAAyB;IAQ9C;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,IAAI;IAehC;;OAEG;IACH,IAAI,IAAI,OAAO;IAYf;;OAEG;IACH,IAAI,IAAI,OAAO;IAmBf;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,YAAY,IAAI,MAAM;IAItB;;OAEG;IACH,YAAY,IAAI,MAAM;IAItB;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;IAM1B;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;CAK3B"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a command that can be executed, undone, and redone.
|
|
3
|
-
*/
|
|
4
|
-
export interface ICommand {
|
|
5
|
-
/**
|
|
6
|
-
* Executes the command.
|
|
7
|
-
*/
|
|
8
|
-
execute(): void;
|
|
9
|
-
/**
|
|
10
|
-
* Undoes the command.
|
|
11
|
-
*/
|
|
12
|
-
undo(): void;
|
|
13
|
-
/**
|
|
14
|
-
* Redoes the command (default implementation calls execute).
|
|
15
|
-
*/
|
|
16
|
-
redo?(): void;
|
|
17
|
-
/**
|
|
18
|
-
* Optional description of the command for debugging.
|
|
19
|
-
*/
|
|
20
|
-
description?: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Configuration options for CommandStack.
|
|
24
|
-
*/
|
|
25
|
-
export interface ICommandStackOptions {
|
|
26
|
-
/**
|
|
27
|
-
* Maximum number of commands to keep in history.
|
|
28
|
-
* @default 100
|
|
29
|
-
*/
|
|
30
|
-
maxSize?: number;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Interface for a command stack that supports undo/redo operations.
|
|
34
|
-
*/
|
|
35
|
-
export interface ICommandStack {
|
|
36
|
-
/**
|
|
37
|
-
* Executes a command and adds it to the undo stack.
|
|
38
|
-
* Clears the redo stack.
|
|
39
|
-
*/
|
|
40
|
-
execute(command: ICommand): void;
|
|
41
|
-
/**
|
|
42
|
-
* Undoes the last executed command.
|
|
43
|
-
* @returns true if a command was undone, false otherwise
|
|
44
|
-
*/
|
|
45
|
-
undo(): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Redoes the last undone command.
|
|
48
|
-
* @returns true if a command was redone, false otherwise
|
|
49
|
-
*/
|
|
50
|
-
redo(): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Checks if there are commands that can be undone.
|
|
53
|
-
*/
|
|
54
|
-
canUndo(): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Checks if there are commands that can be redone.
|
|
57
|
-
*/
|
|
58
|
-
canRedo(): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Clears all commands from the stack.
|
|
61
|
-
*/
|
|
62
|
-
clear(): void;
|
|
63
|
-
/**
|
|
64
|
-
* Gets the number of commands in the undo stack.
|
|
65
|
-
*/
|
|
66
|
-
getUndoCount(): number;
|
|
67
|
-
/**
|
|
68
|
-
* Gets the number of commands in the redo stack.
|
|
69
|
-
*/
|
|
70
|
-
getRedoCount(): number;
|
|
71
|
-
/**
|
|
72
|
-
* Gets the descriptions of all commands in the undo stack.
|
|
73
|
-
*/
|
|
74
|
-
getUndoHistory(): string[];
|
|
75
|
-
/**
|
|
76
|
-
* Gets the descriptions of all commands in the redo stack.
|
|
77
|
-
*/
|
|
78
|
-
getRedoHistory(): string[];
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=command-stack.interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-stack.interface.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/data-structures/command-stack/command-stack.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;IAEhB;;OAEG;IACH,IAAI,IAAI,IAAI,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC;IAEhB;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC;IAEhB;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC;IAEnB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC;IAEvB;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC;IAEvB;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE,CAAC;IAE3B;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE,CAAC;CAC5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/shared/src/data-structures/command-stack/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC"}
|