@zengrid/core 1.0.2 → 1.0.5
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/index.cjs.js +43 -55
- package/dist/index.esm.js +2 -14
- package/dist/package.json +3 -2
- package/dist/src/a11y/aria-manager.d.ts.map +1 -1
- package/dist/src/a11y/focus-manager.d.ts.map +1 -1
- package/dist/src/a11y/index.d.ts.map +1 -1
- package/dist/src/data/data-accessor/array-accessor.d.ts.map +1 -1
- package/dist/src/data/data-accessor/column-store-accessor.d.ts.map +1 -1
- package/dist/src/data/data-accessor/data-accessor.interface.d.ts.map +1 -1
- package/dist/src/data/data-accessor/index.d.ts.map +1 -1
- package/dist/src/data/data-accessor/sparse-matrix-accessor.d.ts.map +1 -1
- package/dist/src/data/data-manager.d.ts.map +1 -1
- package/dist/src/data/data-source.interface.d.ts.map +1 -1
- package/dist/src/data/grid-data-model.d.ts +2 -2
- package/dist/src/data/grid-data-model.d.ts.map +1 -1
- package/dist/src/data/index-map/index-map.d.ts.map +1 -1
- package/dist/src/data/index-map/index-map.interface.d.ts.map +1 -1
- package/dist/src/data/index-map/index.d.ts.map +1 -1
- package/dist/src/data/index.d.ts.map +1 -1
- package/dist/src/editing/cell-editor.interface.d.ts.map +1 -1
- package/dist/src/editing/date-editor.d.ts.map +1 -1
- package/dist/src/editing/editor-manager.d.ts.map +1 -1
- package/dist/src/editing/index.d.ts.map +1 -1
- package/dist/src/editing/number-editor.d.ts.map +1 -1
- package/dist/src/editing/select-editor.d.ts.map +1 -1
- package/dist/src/editing/text-editor.d.ts.map +1 -1
- package/dist/src/events/event-emitter.d.ts.map +1 -1
- package/dist/src/events/grid-events.d.ts.map +1 -1
- package/dist/src/events/index.d.ts.map +1 -1
- package/dist/src/features/autofill/autofill-manager.d.ts +1 -1
- package/dist/src/features/autofill/autofill-manager.d.ts.map +1 -1
- package/dist/src/features/autofill/index.d.ts.map +1 -1
- package/dist/src/features/column-resize/auto-fit-calculator.d.ts.map +1 -1
- package/dist/src/features/column-resize/column-resize-manager.d.ts.map +1 -1
- package/dist/src/features/column-resize/column-resize-manager.interface.d.ts.map +1 -1
- package/dist/src/features/column-resize/index.d.ts.map +1 -1
- package/dist/src/features/column-resize/resize-constraint-manager.d.ts.map +1 -1
- package/dist/src/features/column-resize/resize-handle-renderer.d.ts.map +1 -1
- package/dist/src/features/column-resize/resize-preview.d.ts.map +1 -1
- package/dist/src/features/column-resize/resize-state-manager.d.ts.map +1 -1
- package/dist/src/features/column-resize/resize-strategies.d.ts.map +1 -1
- package/dist/src/features/column-resize/resize-test-helper.d.ts.map +1 -1
- package/dist/src/features/column-resize/resize-zone-detector.d.ts.map +1 -1
- package/dist/src/features/copy-paste/clipboard-manager.d.ts.map +1 -1
- package/dist/src/features/copy-paste/index.d.ts.map +1 -1
- package/dist/src/features/filtering/adapters/adapter.interface.d.ts.map +1 -1
- package/dist/src/features/filtering/adapters/graphql-adapter.d.ts.map +1 -1
- package/dist/src/features/filtering/adapters/index.d.ts.map +1 -1
- package/dist/src/features/filtering/adapters/rest-adapter.d.ts.map +1 -1
- package/dist/src/features/filtering/adapters/sql-adapter.d.ts.map +1 -1
- package/dist/src/features/filtering/adapters/types.d.ts.map +1 -1
- package/dist/src/features/filtering/column-filter.d.ts.map +1 -1
- package/dist/src/features/filtering/filter-autocomplete.d.ts.map +1 -1
- package/dist/src/features/filtering/filter-cache.d.ts.map +1 -1
- package/dist/src/features/filtering/filter-compiler.d.ts.map +1 -1
- package/dist/src/features/filtering/filter-export-manager.d.ts.map +1 -1
- package/dist/src/features/filtering/filter-index-manager.d.ts +1 -1
- package/dist/src/features/filtering/filter-index-manager.d.ts.map +1 -1
- package/dist/src/features/filtering/filter-manager.d.ts +1 -1
- package/dist/src/features/filtering/filter-manager.d.ts.map +1 -1
- package/dist/src/features/filtering/filter-optimizer.d.ts.map +1 -1
- package/dist/src/features/filtering/filter-query-parser.d.ts.map +1 -1
- package/dist/src/features/filtering/index.d.ts.map +1 -1
- package/dist/src/features/filtering/range-filter-optimizer.d.ts.map +1 -1
- package/dist/src/features/filtering/substring-filter.d.ts.map +1 -1
- package/dist/src/features/filtering/types.d.ts.map +1 -1
- package/dist/src/features/formulas/formula-calculator.d.ts.map +1 -1
- package/dist/src/features/formulas/index.d.ts.map +1 -1
- package/dist/src/features/hit-testing/index.d.ts.map +1 -1
- package/dist/src/features/hit-testing/spatial-hit-tester.d.ts +1 -1
- package/dist/src/features/hit-testing/spatial-hit-tester.d.ts.map +1 -1
- package/dist/src/features/loading/index.d.ts.map +1 -1
- package/dist/src/features/loading/loading-indicator.d.ts.map +1 -1
- package/dist/src/features/pagination/index.d.ts.map +1 -1
- package/dist/src/features/pagination/paginator.d.ts.map +1 -1
- package/dist/src/features/selection/index.d.ts.map +1 -1
- package/dist/src/features/selection/selection-manager.d.ts.map +1 -1
- package/dist/src/features/sorting/index.d.ts.map +1 -1
- package/dist/src/features/sorting/row-sorter.interface.d.ts.map +1 -1
- package/dist/src/features/sorting/single-column-sorter.d.ts.map +1 -1
- package/dist/src/features/sorting/sort-manager.d.ts.map +1 -1
- package/dist/src/features/undo-redo/index.d.ts.map +1 -1
- package/dist/src/features/undo-redo/undo-redo-manager.d.ts.map +1 -1
- package/dist/src/grid.d.ts.map +1 -1
- package/dist/src/i18n/index.d.ts.map +1 -1
- package/dist/src/i18n/locale-manager.d.ts.map +1 -1
- package/dist/src/i18n/rtl-support.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/keyboard/index.d.ts.map +1 -1
- package/dist/src/keyboard/keyboard-navigator.d.ts.map +1 -1
- package/dist/src/rendering/cache/index.d.ts.map +1 -1
- package/dist/src/rendering/cache/renderer-cache.d.ts.map +1 -1
- package/dist/src/rendering/cache/renderer-cache.interface.d.ts.map +1 -1
- package/dist/src/rendering/cell-pool/cell-pool.d.ts.map +1 -1
- package/dist/src/rendering/cell-pool/cell-pool.interface.d.ts.map +1 -1
- package/dist/src/rendering/cell-pool/index.d.ts.map +1 -1
- package/dist/src/rendering/cell-positioner/cell-positioner.d.ts.map +1 -1
- package/dist/src/rendering/cell-positioner/cell-positioner.interface.d.ts.map +1 -1
- package/dist/src/rendering/cell-positioner/index.d.ts.map +1 -1
- package/dist/src/rendering/height-provider/height-provider.interface.d.ts.map +1 -1
- package/dist/src/rendering/height-provider/index.d.ts.map +1 -1
- package/dist/src/rendering/height-provider/uniform-height-provider.d.ts.map +1 -1
- package/dist/src/rendering/height-provider/variable-height-provider.d.ts.map +1 -1
- package/dist/src/rendering/renderers/advanced-cell-renderer.d.ts.map +1 -1
- package/dist/src/rendering/renderers/image-renderer.d.ts.map +1 -1
- package/dist/src/rendering/renderers/index.d.ts.map +1 -1
- package/dist/src/rendering/renderers/number-renderer.d.ts.map +1 -1
- package/dist/src/rendering/renderers/renderer-registry.d.ts.map +1 -1
- package/dist/src/rendering/renderers/renderer.interface.d.ts.map +1 -1
- package/dist/src/rendering/renderers/text-renderer.d.ts.map +1 -1
- package/dist/src/rendering/spatial-hit-tester.d.ts +1 -1
- package/dist/src/rendering/spatial-hit-tester.d.ts.map +1 -1
- package/dist/src/rendering/virtual-scroller/index.d.ts.map +1 -1
- package/dist/src/rendering/virtual-scroller/virtual-scroller.d.ts.map +1 -1
- package/dist/src/rendering/virtual-scroller/virtual-scroller.interface.d.ts.map +1 -1
- package/dist/src/rendering/width-provider/index.d.ts.map +1 -1
- package/dist/src/rendering/width-provider/uniform-width-provider.d.ts.map +1 -1
- package/dist/src/rendering/width-provider/variable-width-provider.d.ts.map +1 -1
- package/dist/src/rendering/width-provider/width-provider.interface.d.ts.map +1 -1
- package/dist/src/selection/hit-tester.d.ts.map +1 -1
- package/dist/src/selection/hit-tester.interface.d.ts.map +1 -1
- package/dist/src/selection/index.d.ts.map +1 -1
- package/dist/src/selection/range-utils.d.ts.map +1 -1
- package/dist/src/selection/range-utils.interface.d.ts.map +1 -1
- package/dist/src/shared/algorithms/filter/bloom-filter.d.ts +120 -0
- package/dist/src/shared/algorithms/filter/bloom-filter.d.ts.map +1 -0
- package/dist/src/shared/algorithms/filter/index.d.ts +7 -0
- package/dist/src/shared/algorithms/filter/index.d.ts.map +1 -0
- package/dist/src/shared/algorithms/graph/bfs.d.ts +71 -0
- package/dist/src/shared/algorithms/graph/bfs.d.ts.map +1 -0
- package/dist/src/shared/algorithms/graph/dfs.d.ts +62 -0
- package/dist/src/shared/algorithms/graph/dfs.d.ts.map +1 -0
- package/dist/src/shared/algorithms/graph/graph.interface.d.ts +63 -0
- package/dist/src/shared/algorithms/graph/graph.interface.d.ts.map +1 -0
- package/dist/src/shared/algorithms/graph/index.d.ts +9 -0
- package/dist/src/shared/algorithms/graph/index.d.ts.map +1 -0
- package/dist/src/shared/algorithms/index.d.ts +11 -0
- package/dist/src/shared/algorithms/index.d.ts.map +1 -0
- package/dist/src/shared/algorithms/pattern/index.d.ts +8 -0
- package/dist/src/shared/algorithms/pattern/index.d.ts.map +1 -0
- package/dist/src/shared/algorithms/pattern/sequence-detector.d.ts +62 -0
- package/dist/src/shared/algorithms/pattern/sequence-detector.d.ts.map +1 -0
- package/dist/src/shared/algorithms/search/binary-search.d.ts +86 -0
- package/dist/src/shared/algorithms/search/binary-search.d.ts.map +1 -0
- package/dist/src/shared/algorithms/search/index.d.ts +6 -0
- package/dist/src/shared/algorithms/search/index.d.ts.map +1 -0
- package/dist/src/shared/algorithms/sorting/comparators.d.ts +126 -0
- package/dist/src/shared/algorithms/sorting/comparators.d.ts.map +1 -0
- package/dist/src/shared/algorithms/sorting/index.d.ts +9 -0
- package/dist/src/shared/algorithms/sorting/index.d.ts.map +1 -0
- package/dist/src/shared/algorithms/sorting/sorting.interface.d.ts +38 -0
- package/dist/src/shared/algorithms/sorting/sorting.interface.d.ts.map +1 -0
- package/dist/src/shared/algorithms/sorting/timsort.d.ts +55 -0
- package/dist/src/shared/algorithms/sorting/timsort.d.ts.map +1 -0
- package/dist/src/shared/data-structures/column-store/column-store.d.ts +52 -0
- package/dist/src/shared/data-structures/column-store/column-store.d.ts.map +1 -0
- package/dist/src/shared/data-structures/column-store/column-store.interface.d.ts +155 -0
- package/dist/src/shared/data-structures/column-store/column-store.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/column-store/index.d.ts +6 -0
- package/dist/src/shared/data-structures/column-store/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/command-stack/command-stack.d.ts +61 -0
- package/dist/src/shared/data-structures/command-stack/command-stack.d.ts.map +1 -0
- package/dist/src/shared/data-structures/command-stack/command-stack.interface.d.ts +80 -0
- package/dist/src/shared/data-structures/command-stack/command-stack.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/command-stack/index.d.ts +3 -0
- package/dist/src/shared/data-structures/command-stack/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/dependency-graph/dependency-graph.d.ts +147 -0
- package/dist/src/shared/data-structures/dependency-graph/dependency-graph.d.ts.map +1 -0
- package/dist/src/shared/data-structures/dependency-graph/dependency-graph.interface.d.ts +161 -0
- package/dist/src/shared/data-structures/dependency-graph/dependency-graph.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/dependency-graph/index.d.ts +8 -0
- package/dist/src/shared/data-structures/dependency-graph/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/disjoint-set/disjoint-set.d.ts +84 -0
- package/dist/src/shared/data-structures/disjoint-set/disjoint-set.d.ts.map +1 -0
- package/dist/src/shared/data-structures/disjoint-set/disjoint-set.interface.d.ts +185 -0
- package/dist/src/shared/data-structures/disjoint-set/disjoint-set.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/disjoint-set/index.d.ts +7 -0
- package/dist/src/shared/data-structures/disjoint-set/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/index-map/index-map.d.ts +150 -0
- package/dist/src/shared/data-structures/index-map/index-map.d.ts.map +1 -0
- package/dist/src/shared/data-structures/index-map/index-map.interface.d.ts +186 -0
- package/dist/src/shared/data-structures/index-map/index-map.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/index-map/index.d.ts +6 -0
- package/dist/src/shared/data-structures/index-map/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/index.d.ts +36 -0
- package/dist/src/shared/data-structures/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/interval-tree/index.d.ts +7 -0
- package/dist/src/shared/data-structures/interval-tree/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/interval-tree/interval-tree.d.ts +141 -0
- package/dist/src/shared/data-structures/interval-tree/interval-tree.d.ts.map +1 -0
- package/dist/src/shared/data-structures/interval-tree/interval-tree.interface.d.ts +212 -0
- package/dist/src/shared/data-structures/interval-tree/interval-tree.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/lru-cache/index.d.ts +3 -0
- package/dist/src/shared/data-structures/lru-cache/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/lru-cache/lru-cache.d.ts +134 -0
- package/dist/src/shared/data-structures/lru-cache/lru-cache.d.ts.map +1 -0
- package/dist/src/shared/data-structures/lru-cache/lru-cache.interface.d.ts +173 -0
- package/dist/src/shared/data-structures/lru-cache/lru-cache.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/prefix-sum-array/index.d.ts +6 -0
- package/dist/src/shared/data-structures/prefix-sum-array/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/prefix-sum-array/prefix-sum-array.d.ts +63 -0
- package/dist/src/shared/data-structures/prefix-sum-array/prefix-sum-array.d.ts.map +1 -0
- package/dist/src/shared/data-structures/prefix-sum-array/prefix-sum-array.interface.d.ts +80 -0
- package/dist/src/shared/data-structures/prefix-sum-array/prefix-sum-array.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/rtree/index.d.ts +8 -0
- package/dist/src/shared/data-structures/rtree/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/rtree/rtree.d.ts +81 -0
- package/dist/src/shared/data-structures/rtree/rtree.d.ts.map +1 -0
- package/dist/src/shared/data-structures/rtree/rtree.interface.d.ts +143 -0
- package/dist/src/shared/data-structures/rtree/rtree.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/segment-tree/index.d.ts +4 -0
- package/dist/src/shared/data-structures/segment-tree/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/segment-tree/segment-tree.d.ts +134 -0
- package/dist/src/shared/data-structures/segment-tree/segment-tree.d.ts.map +1 -0
- package/dist/src/shared/data-structures/segment-tree/segment-tree.interface.d.ts +202 -0
- package/dist/src/shared/data-structures/segment-tree/segment-tree.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/skip-list/index.d.ts +4 -0
- package/dist/src/shared/data-structures/skip-list/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/skip-list/skip-list.d.ts +137 -0
- package/dist/src/shared/data-structures/skip-list/skip-list.d.ts.map +1 -0
- package/dist/src/shared/data-structures/skip-list/skip-list.interface.d.ts +223 -0
- package/dist/src/shared/data-structures/skip-list/skip-list.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/sparse-matrix/index.d.ts +6 -0
- package/dist/src/shared/data-structures/sparse-matrix/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/sparse-matrix/sparse-matrix.d.ts +44 -0
- package/dist/src/shared/data-structures/sparse-matrix/sparse-matrix.d.ts.map +1 -0
- package/dist/src/shared/data-structures/sparse-matrix/sparse-matrix.interface.d.ts +105 -0
- package/dist/src/shared/data-structures/sparse-matrix/sparse-matrix.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/suffix-array/index.d.ts +3 -0
- package/dist/src/shared/data-structures/suffix-array/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/suffix-array/suffix-array.d.ts +102 -0
- package/dist/src/shared/data-structures/suffix-array/suffix-array.d.ts.map +1 -0
- package/dist/src/shared/data-structures/suffix-array/suffix-array.interface.d.ts +117 -0
- package/dist/src/shared/data-structures/suffix-array/suffix-array.interface.d.ts.map +1 -0
- package/dist/src/shared/data-structures/trie/index.d.ts +8 -0
- package/dist/src/shared/data-structures/trie/index.d.ts.map +1 -0
- package/dist/src/shared/data-structures/trie/trie.d.ts +205 -0
- package/dist/src/shared/data-structures/trie/trie.d.ts.map +1 -0
- package/dist/src/shared/data-structures/trie/trie.interface.d.ts +117 -0
- package/dist/src/shared/data-structures/trie/trie.interface.d.ts.map +1 -0
- package/dist/src/shared/index.d.ts +47 -0
- package/dist/src/shared/index.d.ts.map +1 -0
- package/dist/src/shared/patterns/coordinator.d.ts +90 -0
- package/dist/src/shared/patterns/coordinator.d.ts.map +1 -0
- package/dist/src/shared/patterns/event-emitter.d.ts +106 -0
- package/dist/src/shared/patterns/event-emitter.d.ts.map +1 -0
- package/dist/src/shared/patterns/factory.d.ts +120 -0
- package/dist/src/shared/patterns/factory.d.ts.map +1 -0
- package/dist/src/shared/patterns/index.d.ts +21 -0
- package/dist/src/shared/patterns/index.d.ts.map +1 -0
- package/dist/src/shared/patterns/mediator.d.ts +116 -0
- package/dist/src/shared/patterns/mediator.d.ts.map +1 -0
- package/dist/src/shared/patterns/object-pool.d.ts +178 -0
- package/dist/src/shared/patterns/object-pool.d.ts.map +1 -0
- package/dist/src/shared/patterns/observer.d.ts +89 -0
- package/dist/src/shared/patterns/observer.d.ts.map +1 -0
- package/dist/src/shared/patterns/operation-mode.d.ts +75 -0
- package/dist/src/shared/patterns/operation-mode.d.ts.map +1 -0
- package/dist/src/shared/patterns/state-machine.d.ts +122 -0
- package/dist/src/shared/patterns/state-machine.d.ts.map +1 -0
- package/dist/src/shared/types/common.d.ts +56 -0
- package/dist/src/shared/types/common.d.ts.map +1 -0
- package/dist/src/shared/types/index.d.ts +5 -0
- package/dist/src/shared/types/index.d.ts.map +1 -0
- package/dist/src/shared/utils/index.d.ts +7 -0
- package/dist/src/shared/utils/index.d.ts.map +1 -0
- package/dist/src/shared/utils/timing.d.ts +104 -0
- package/dist/src/shared/utils/timing.d.ts.map +1 -0
- package/dist/src/shared/utils/timing.interface.d.ts +96 -0
- package/dist/src/shared/utils/timing.interface.d.ts.map +1 -0
- package/dist/src/touch/index.d.ts.map +1 -1
- package/dist/src/touch/touch-handler.d.ts.map +1 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LRU Cache Interface
|
|
3
|
+
*
|
|
4
|
+
* Used for:
|
|
5
|
+
* - Caching rendered cells to avoid re-rendering
|
|
6
|
+
* - Caching formula evaluation results
|
|
7
|
+
* - Caching formatted values (numbers, dates)
|
|
8
|
+
* - Caching API responses
|
|
9
|
+
* - Memory-bounded caches with automatic eviction
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Cache entry metadata
|
|
13
|
+
*/
|
|
14
|
+
export interface CacheEntry<V> {
|
|
15
|
+
/**
|
|
16
|
+
* The cached value
|
|
17
|
+
*/
|
|
18
|
+
value: V;
|
|
19
|
+
/**
|
|
20
|
+
* Timestamp when entry was created
|
|
21
|
+
*/
|
|
22
|
+
createdAt: number;
|
|
23
|
+
/**
|
|
24
|
+
* Timestamp when entry was last accessed
|
|
25
|
+
*/
|
|
26
|
+
lastAccessedAt: number;
|
|
27
|
+
/**
|
|
28
|
+
* Number of times this entry has been accessed
|
|
29
|
+
*/
|
|
30
|
+
accessCount: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Cache statistics
|
|
34
|
+
*/
|
|
35
|
+
export interface CacheStats {
|
|
36
|
+
/**
|
|
37
|
+
* Current number of entries
|
|
38
|
+
*/
|
|
39
|
+
size: number;
|
|
40
|
+
/**
|
|
41
|
+
* Maximum capacity
|
|
42
|
+
*/
|
|
43
|
+
capacity: number;
|
|
44
|
+
/**
|
|
45
|
+
* Total number of get operations
|
|
46
|
+
*/
|
|
47
|
+
hits: number;
|
|
48
|
+
/**
|
|
49
|
+
* Total number of failed get operations
|
|
50
|
+
*/
|
|
51
|
+
misses: number;
|
|
52
|
+
/**
|
|
53
|
+
* Hit rate (hits / (hits + misses))
|
|
54
|
+
*/
|
|
55
|
+
hitRate: number;
|
|
56
|
+
/**
|
|
57
|
+
* Total number of evictions
|
|
58
|
+
*/
|
|
59
|
+
evictions: number;
|
|
60
|
+
/**
|
|
61
|
+
* Total number of set operations
|
|
62
|
+
*/
|
|
63
|
+
sets: number;
|
|
64
|
+
/**
|
|
65
|
+
* Memory usage in bytes (approximate)
|
|
66
|
+
*/
|
|
67
|
+
memoryBytes: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* LRU Cache options
|
|
71
|
+
*/
|
|
72
|
+
export interface LRUCacheOptions {
|
|
73
|
+
/**
|
|
74
|
+
* Maximum number of entries
|
|
75
|
+
* @default 1000
|
|
76
|
+
*/
|
|
77
|
+
capacity?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Time-to-live in milliseconds (0 = infinite)
|
|
80
|
+
* @default 0
|
|
81
|
+
*/
|
|
82
|
+
ttl?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Callback when an entry is evicted
|
|
85
|
+
*/
|
|
86
|
+
onEvict?: <K, V>(key: K, value: V) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Track access statistics
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
trackStats?: boolean;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* LRU Cache interface
|
|
95
|
+
*/
|
|
96
|
+
export interface ILRUCache<K, V> {
|
|
97
|
+
/**
|
|
98
|
+
* Get a value from the cache
|
|
99
|
+
*
|
|
100
|
+
* @param key - The key to look up
|
|
101
|
+
* @returns The cached value or undefined if not found or expired
|
|
102
|
+
*/
|
|
103
|
+
get(key: K): V | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Set a value in the cache
|
|
106
|
+
*
|
|
107
|
+
* @param key - The key to store
|
|
108
|
+
* @param value - The value to cache
|
|
109
|
+
*/
|
|
110
|
+
set(key: K, value: V): void;
|
|
111
|
+
/**
|
|
112
|
+
* Check if a key exists in the cache
|
|
113
|
+
*
|
|
114
|
+
* @param key - The key to check
|
|
115
|
+
* @returns True if the key exists and is not expired
|
|
116
|
+
*/
|
|
117
|
+
has(key: K): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Delete a specific entry
|
|
120
|
+
*
|
|
121
|
+
* @param key - The key to delete
|
|
122
|
+
* @returns True if the entry existed and was deleted
|
|
123
|
+
*/
|
|
124
|
+
delete(key: K): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Clear all entries from the cache
|
|
127
|
+
*/
|
|
128
|
+
clear(): void;
|
|
129
|
+
/**
|
|
130
|
+
* Get the current size of the cache
|
|
131
|
+
*
|
|
132
|
+
* @returns Number of entries
|
|
133
|
+
*/
|
|
134
|
+
size(): number;
|
|
135
|
+
/**
|
|
136
|
+
* Get cache statistics
|
|
137
|
+
*
|
|
138
|
+
* @returns Statistics object
|
|
139
|
+
*/
|
|
140
|
+
getStats(): CacheStats;
|
|
141
|
+
/**
|
|
142
|
+
* Get all keys in the cache (in LRU order)
|
|
143
|
+
*
|
|
144
|
+
* @returns Array of keys, oldest first
|
|
145
|
+
*/
|
|
146
|
+
keys(): K[];
|
|
147
|
+
/**
|
|
148
|
+
* Get all values in the cache (in LRU order)
|
|
149
|
+
*
|
|
150
|
+
* @returns Array of values, oldest first
|
|
151
|
+
*/
|
|
152
|
+
values(): V[];
|
|
153
|
+
/**
|
|
154
|
+
* Get all entries with metadata
|
|
155
|
+
*
|
|
156
|
+
* @returns Array of entries with metadata
|
|
157
|
+
*/
|
|
158
|
+
entries(): Array<[K, CacheEntry<V>]>;
|
|
159
|
+
/**
|
|
160
|
+
* Peek at a value without updating LRU order
|
|
161
|
+
*
|
|
162
|
+
* @param key - The key to peek at
|
|
163
|
+
* @returns The cached value or undefined
|
|
164
|
+
*/
|
|
165
|
+
peek(key: K): V | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* Resize the cache capacity
|
|
168
|
+
*
|
|
169
|
+
* @param newCapacity - New maximum capacity
|
|
170
|
+
*/
|
|
171
|
+
resize(newCapacity: number): void;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=lru-cache.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru-cache.interface.d.ts","sourceRoot":"","sources":["../../../../../src/shared/data-structures/lru-cache/lru-cache.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAE3C;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC;IAC7B;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAE3B;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAE5B;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;IAErB;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;IAExB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;;OAIG;IACH,IAAI,IAAI,MAAM,CAAC;IAEf;;;;OAIG;IACH,QAAQ,IAAI,UAAU,CAAC;IAEvB;;;;OAIG;IACH,IAAI,IAAI,CAAC,EAAE,CAAC;IAEZ;;;;OAIG;IACH,MAAM,IAAI,CAAC,EAAE,CAAC;IAEd;;;;OAIG;IACH,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAErC;;;;;OAKG;IACH,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAE5B;;;;OAIG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prefix Sum Array - Efficient range queries and offset calculations
|
|
3
|
+
*/
|
|
4
|
+
export { PrefixSumArray } from './prefix-sum-array';
|
|
5
|
+
export type { PrefixSumArray as IPrefixSumArray, PrefixSumArrayOptions, } from './prefix-sum-array.interface';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/data-structures/prefix-sum-array/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EACV,cAAc,IAAI,eAAe,EACjC,qBAAqB,GACtB,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { PrefixSumArray as IPrefixSumArray, PrefixSumArrayOptions } from './prefix-sum-array.interface';
|
|
2
|
+
/**
|
|
3
|
+
* PrefixSumArray implementation
|
|
4
|
+
*
|
|
5
|
+
* Stores cumulative sums for efficient range queries and offset lookups.
|
|
6
|
+
* Essential for virtual scrolling with variable row heights.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Row heights: [30, 40, 50, 30, 60]
|
|
11
|
+
* const heights = new PrefixSumArray({ values: [30, 40, 50, 30, 60] });
|
|
12
|
+
*
|
|
13
|
+
* // Get offset to row 2 (sum of rows 0 and 1)
|
|
14
|
+
* heights.getOffset(2); // 70 (30 + 40)
|
|
15
|
+
*
|
|
16
|
+
* // Find which row is at scroll offset 100
|
|
17
|
+
* heights.findIndexAtOffset(100); // 2 (rows 0,1,2 total 120, row 2 starts at 70)
|
|
18
|
+
*
|
|
19
|
+
* // Get range sum (rows 1-3)
|
|
20
|
+
* heights.getRangeSum(1, 4); // 120 (40 + 50 + 30)
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class PrefixSumArray implements IPrefixSumArray {
|
|
24
|
+
private values;
|
|
25
|
+
private sums;
|
|
26
|
+
constructor(options?: PrefixSumArrayOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Build prefix sum array from values
|
|
29
|
+
* sums[i] = sum of values[0...i-1]
|
|
30
|
+
* sums[0] = 0 (no elements before index 0)
|
|
31
|
+
*/
|
|
32
|
+
private build;
|
|
33
|
+
getOffset(index: number): number;
|
|
34
|
+
getSumUpTo(index: number): number;
|
|
35
|
+
getRangeSum(start: number, end: number): number;
|
|
36
|
+
findIndexAtOffset(offset: number): number;
|
|
37
|
+
update(index: number, newValue: number): void;
|
|
38
|
+
getValue(index: number): number;
|
|
39
|
+
get length(): number;
|
|
40
|
+
get total(): number;
|
|
41
|
+
get prefixSums(): ReadonlyArray<number>;
|
|
42
|
+
/**
|
|
43
|
+
* Add a new value to the end
|
|
44
|
+
* @param value - Value to append
|
|
45
|
+
*/
|
|
46
|
+
push(value: number): void;
|
|
47
|
+
/**
|
|
48
|
+
* Remove and return the last value
|
|
49
|
+
* @returns Removed value or undefined if empty
|
|
50
|
+
*/
|
|
51
|
+
pop(): number | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all values
|
|
54
|
+
*/
|
|
55
|
+
clear(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Create from array of values
|
|
58
|
+
* @param values - Array of non-negative numbers
|
|
59
|
+
* @returns New PrefixSumArray instance
|
|
60
|
+
*/
|
|
61
|
+
static from(values: number[]): PrefixSumArray;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=prefix-sum-array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefix-sum-array.d.ts","sourceRoot":"","sources":["../../../../../src/shared/data-structures/prefix-sum-array/prefix-sum-array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,IAAI,eAAe,EACjC,qBAAqB,EACtB,MAAM,8BAA8B,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,IAAI,CAAW;gBAEX,OAAO,GAAE,qBAA0B;IAM/C;;;;OAIG;IACH,OAAO,CAAC,KAAK;IASb,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAShC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IASjC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAS/C,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IA6BzC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAoB7C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAS/B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,UAAU,IAAI,aAAa,CAAC,MAAM,CAAC,CAEtC;IAED;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IASzB;;;OAGG;IACH,GAAG,IAAI,MAAM,GAAG,SAAS;IASzB;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc;CAG9C"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prefix Sum Array interfaces for ZenGrid
|
|
3
|
+
* Used for efficient range queries and offset calculations
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Prefix Sum Array for cumulative calculations
|
|
7
|
+
*
|
|
8
|
+
* Useful for:
|
|
9
|
+
* - Variable row heights in virtual scrolling
|
|
10
|
+
* - Finding element at specific offset (O(log n) with binary search)
|
|
11
|
+
* - Range sum queries
|
|
12
|
+
*/
|
|
13
|
+
export interface PrefixSumArray {
|
|
14
|
+
/**
|
|
15
|
+
* Get cumulative sum up to (but not including) index
|
|
16
|
+
* @param index - Index to query
|
|
17
|
+
* @returns Sum of values[0] through values[index-1]
|
|
18
|
+
* @complexity O(1)
|
|
19
|
+
*/
|
|
20
|
+
getOffset(index: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* Get cumulative sum up to and including index
|
|
23
|
+
* @param index - Index to query
|
|
24
|
+
* @returns Sum of values[0] through values[index]
|
|
25
|
+
* @complexity O(1)
|
|
26
|
+
*/
|
|
27
|
+
getSumUpTo(index: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Get sum of range [start, end)
|
|
30
|
+
* @param start - Start index (inclusive)
|
|
31
|
+
* @param end - End index (exclusive)
|
|
32
|
+
* @returns Sum of values[start] through values[end-1]
|
|
33
|
+
* @complexity O(1)
|
|
34
|
+
*/
|
|
35
|
+
getRangeSum(start: number, end: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Find index where cumulative sum >= target offset
|
|
38
|
+
* Uses binary search internally
|
|
39
|
+
* @param offset - Target cumulative value
|
|
40
|
+
* @returns Index where cumulative sum >= offset
|
|
41
|
+
* @complexity O(log n)
|
|
42
|
+
*/
|
|
43
|
+
findIndexAtOffset(offset: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* Update value at index and rebuild prefix sums
|
|
46
|
+
* @param index - Index to update
|
|
47
|
+
* @param newValue - New value
|
|
48
|
+
* @complexity O(n) - requires rebuilding from index onward
|
|
49
|
+
*/
|
|
50
|
+
update(index: number, newValue: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* Get original value at index (not cumulative)
|
|
53
|
+
* @param index - Index to query
|
|
54
|
+
* @returns Original value
|
|
55
|
+
* @complexity O(1)
|
|
56
|
+
*/
|
|
57
|
+
getValue(index: number): number;
|
|
58
|
+
/**
|
|
59
|
+
* Total number of elements
|
|
60
|
+
*/
|
|
61
|
+
readonly length: number;
|
|
62
|
+
/**
|
|
63
|
+
* Total sum of all values
|
|
64
|
+
*/
|
|
65
|
+
readonly total: number;
|
|
66
|
+
/**
|
|
67
|
+
* Get underlying prefix sum array (for debugging)
|
|
68
|
+
*/
|
|
69
|
+
readonly prefixSums: ReadonlyArray<number>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Options for creating a PrefixSumArray
|
|
73
|
+
*/
|
|
74
|
+
export interface PrefixSumArrayOptions {
|
|
75
|
+
/**
|
|
76
|
+
* Initial values to build prefix sums from
|
|
77
|
+
*/
|
|
78
|
+
values?: number[];
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=prefix-sum-array.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefix-sum-array.interface.d.ts","sourceRoot":"","sources":["../../../../../src/shared/data-structures/prefix-sum-array/prefix-sum-array.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEjC;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAElC;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhD;;;;;;OAMG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1C;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9C;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* R-Tree (Spatial Index) data structure
|
|
3
|
+
*
|
|
4
|
+
* Used for efficient spatial queries, hit testing, and range searching.
|
|
5
|
+
*/
|
|
6
|
+
export { RTree } from './rtree';
|
|
7
|
+
export type { IRTree, Rectangle, RTreeData, RTreeOptions, RTreeSearchResult, RTreeStats, } from './rtree.interface';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/data-structures/rtree/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EACV,MAAM,EACN,SAAS,EACT,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,UAAU,GACX,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { IRTree, Rectangle, RTreeOptions, RTreeSearchResult, RTreeStats } from './rtree.interface';
|
|
2
|
+
/**
|
|
3
|
+
* R-Tree - Spatial Index Data Structure
|
|
4
|
+
*
|
|
5
|
+
* An R-Tree is a tree data structure for indexing spatial data.
|
|
6
|
+
* It groups nearby objects and represents them with their minimum bounding rectangle (MBR).
|
|
7
|
+
*
|
|
8
|
+
* **Time Complexity:**
|
|
9
|
+
* - Insert: O(log n) average, O(n) worst case
|
|
10
|
+
* - Search: O(log n + k) where k = number of results
|
|
11
|
+
* - Delete: O(log n) average
|
|
12
|
+
*
|
|
13
|
+
* **Space Complexity:** O(n)
|
|
14
|
+
*
|
|
15
|
+
* **Use Cases in Grid:**
|
|
16
|
+
* - Hit testing: Find cell at mouse coordinates - O(log n)
|
|
17
|
+
* - Range queries: Find all cells in viewport - O(log n + k)
|
|
18
|
+
* - Merged cells: Detect overlapping cell ranges
|
|
19
|
+
* - Selection optimization: Quickly find cells in selection rect
|
|
20
|
+
*/
|
|
21
|
+
export declare class RTree<T = any> implements IRTree<T> {
|
|
22
|
+
private root;
|
|
23
|
+
private options;
|
|
24
|
+
private itemCount;
|
|
25
|
+
constructor(options?: RTreeOptions);
|
|
26
|
+
/**
|
|
27
|
+
* Insert an item into the R-Tree
|
|
28
|
+
*/
|
|
29
|
+
insert(rect: Rectangle, data: T): void;
|
|
30
|
+
/**
|
|
31
|
+
* Search for items intersecting a rectangle
|
|
32
|
+
*/
|
|
33
|
+
search(rect: Rectangle): RTreeSearchResult<T>[];
|
|
34
|
+
/**
|
|
35
|
+
* Search for items at a specific point
|
|
36
|
+
*/
|
|
37
|
+
searchAtPoint(x: number, y: number): RTreeSearchResult<T>[];
|
|
38
|
+
/**
|
|
39
|
+
* Find nearest neighbors to a point
|
|
40
|
+
*/
|
|
41
|
+
nearest(x: number, y: number, maxResults?: number, maxDistance?: number): RTreeSearchResult<T>[];
|
|
42
|
+
/**
|
|
43
|
+
* Remove an item from the tree
|
|
44
|
+
*/
|
|
45
|
+
remove(rect: Rectangle, data?: T): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Clear all items from the tree
|
|
48
|
+
*/
|
|
49
|
+
clear(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get all items in the tree
|
|
52
|
+
*/
|
|
53
|
+
all(): RTreeSearchResult<T>[];
|
|
54
|
+
/**
|
|
55
|
+
* Check if the tree is empty
|
|
56
|
+
*/
|
|
57
|
+
isEmpty(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Get statistics about the tree
|
|
60
|
+
*/
|
|
61
|
+
getStats(): RTreeStats;
|
|
62
|
+
/**
|
|
63
|
+
* Rebuild the tree for better performance
|
|
64
|
+
*/
|
|
65
|
+
rebuild(): void;
|
|
66
|
+
private createNode;
|
|
67
|
+
private isNode;
|
|
68
|
+
private calcBBox;
|
|
69
|
+
private extendBBox;
|
|
70
|
+
private intersects;
|
|
71
|
+
private rectangleDistanceTo;
|
|
72
|
+
private searchNode;
|
|
73
|
+
private insertItem;
|
|
74
|
+
private enlargementNeeded;
|
|
75
|
+
private area;
|
|
76
|
+
private split;
|
|
77
|
+
private findItem;
|
|
78
|
+
private rectanglesEqual;
|
|
79
|
+
private getAllItems;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=rtree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rtree.d.ts","sourceRoot":"","sources":["../../../../../src/shared/data-structures/rtree/rtree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EAET,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAmB3B;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,KAAK,CAAC,CAAC,GAAG,GAAG,CAAE,YAAW,MAAM,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,SAAS,CAAa;gBAElB,OAAO,GAAE,YAAiB;IAStC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IAMtC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE;IAQ/C;;OAEG;IACH,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE;IAS3D;;OAEG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,GAAE,MAAU,EAAE,WAAW,GAAE,MAAiB,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE;IAuD7G;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO;IAmC1C;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,GAAG,IAAI,iBAAiB,CAAC,CAAC,CAAC,EAAE;IAQ7B;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,QAAQ,IAAI,UAAU;IAuBtB;;OAEG;IACH,OAAO,IAAI,IAAI;IAWf,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,QAAQ;IAuBhB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,UAAU;IA6DlB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,KAAK;IA8Bb,OAAO,CAAC,QAAQ;IAgChB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,WAAW;CAcpB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* R-Tree (Spatial Index) Interface
|
|
3
|
+
*
|
|
4
|
+
* Used for:
|
|
5
|
+
* - Efficient spatial queries (hit testing, range queries)
|
|
6
|
+
* - Finding cells at point (x, y)
|
|
7
|
+
* - Finding cells in rectangular region
|
|
8
|
+
* - Merged cell detection
|
|
9
|
+
* - Selection range optimization
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* 2D Rectangle (Axis-Aligned Bounding Box)
|
|
13
|
+
*/
|
|
14
|
+
export interface Rectangle {
|
|
15
|
+
/**
|
|
16
|
+
* Minimum X coordinate (left edge)
|
|
17
|
+
*/
|
|
18
|
+
minX: number;
|
|
19
|
+
/**
|
|
20
|
+
* Minimum Y coordinate (top edge)
|
|
21
|
+
*/
|
|
22
|
+
minY: number;
|
|
23
|
+
/**
|
|
24
|
+
* Maximum X coordinate (right edge)
|
|
25
|
+
*/
|
|
26
|
+
maxX: number;
|
|
27
|
+
/**
|
|
28
|
+
* Maximum Y coordinate (bottom edge)
|
|
29
|
+
*/
|
|
30
|
+
maxY: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* R-Tree node data
|
|
34
|
+
*/
|
|
35
|
+
export interface RTreeData<T = any> {
|
|
36
|
+
/**
|
|
37
|
+
* The bounding rectangle
|
|
38
|
+
*/
|
|
39
|
+
rect: Rectangle;
|
|
40
|
+
/**
|
|
41
|
+
* Associated data
|
|
42
|
+
*/
|
|
43
|
+
data: T;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* R-Tree search result
|
|
47
|
+
*/
|
|
48
|
+
export interface RTreeSearchResult<T = any> {
|
|
49
|
+
/**
|
|
50
|
+
* The bounding rectangle
|
|
51
|
+
*/
|
|
52
|
+
rect: Rectangle;
|
|
53
|
+
/**
|
|
54
|
+
* Associated data
|
|
55
|
+
*/
|
|
56
|
+
data: T;
|
|
57
|
+
/**
|
|
58
|
+
* Distance from query point (if applicable)
|
|
59
|
+
*/
|
|
60
|
+
distance?: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* R-Tree configuration options
|
|
64
|
+
*/
|
|
65
|
+
export interface RTreeOptions {
|
|
66
|
+
/**
|
|
67
|
+
* Maximum entries per node
|
|
68
|
+
* @default 9
|
|
69
|
+
*/
|
|
70
|
+
maxEntries?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Minimum entries per node
|
|
73
|
+
* @default Math.ceil(maxEntries * 0.4)
|
|
74
|
+
*/
|
|
75
|
+
minEntries?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* R-Tree statistics
|
|
79
|
+
*/
|
|
80
|
+
export interface RTreeStats {
|
|
81
|
+
/**
|
|
82
|
+
* Total number of items in the tree
|
|
83
|
+
*/
|
|
84
|
+
size: number;
|
|
85
|
+
/**
|
|
86
|
+
* Height of the tree
|
|
87
|
+
*/
|
|
88
|
+
height: number;
|
|
89
|
+
/**
|
|
90
|
+
* Total number of nodes
|
|
91
|
+
*/
|
|
92
|
+
nodeCount: number;
|
|
93
|
+
/**
|
|
94
|
+
* Bounding box of all items
|
|
95
|
+
*/
|
|
96
|
+
bounds: Rectangle | null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* R-Tree interface
|
|
100
|
+
*/
|
|
101
|
+
export interface IRTree<T = any> {
|
|
102
|
+
/**
|
|
103
|
+
* Insert an item into the tree
|
|
104
|
+
*/
|
|
105
|
+
insert(rect: Rectangle, data: T): void;
|
|
106
|
+
/**
|
|
107
|
+
* Search for items intersecting a rectangle
|
|
108
|
+
*/
|
|
109
|
+
search(rect: Rectangle): RTreeSearchResult<T>[];
|
|
110
|
+
/**
|
|
111
|
+
* Search for items at a specific point
|
|
112
|
+
*/
|
|
113
|
+
searchAtPoint(x: number, y: number): RTreeSearchResult<T>[];
|
|
114
|
+
/**
|
|
115
|
+
* Find nearest neighbors to a point
|
|
116
|
+
*/
|
|
117
|
+
nearest(x: number, y: number, maxResults?: number, maxDistance?: number): RTreeSearchResult<T>[];
|
|
118
|
+
/**
|
|
119
|
+
* Remove an item from the tree
|
|
120
|
+
*/
|
|
121
|
+
remove(rect: Rectangle, data?: T): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Remove all items from the tree
|
|
124
|
+
*/
|
|
125
|
+
clear(): void;
|
|
126
|
+
/**
|
|
127
|
+
* Get all items in the tree
|
|
128
|
+
*/
|
|
129
|
+
all(): RTreeSearchResult<T>[];
|
|
130
|
+
/**
|
|
131
|
+
* Check if the tree is empty
|
|
132
|
+
*/
|
|
133
|
+
isEmpty(): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Get statistics about the tree
|
|
136
|
+
*/
|
|
137
|
+
getStats(): RTreeStats;
|
|
138
|
+
/**
|
|
139
|
+
* Rebuild the tree (optimize structure)
|
|
140
|
+
*/
|
|
141
|
+
rebuild(): void;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=rtree.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rtree.interface.d.ts","sourceRoot":"","sources":["../../../../../src/shared/data-structures/rtree/rtree.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,GAAG;IAChC;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;IAEhB;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC;CACT;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,GAAG;IACxC;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;IAEhB;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,GAAG;IAC7B;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAEvC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;IAEhD;;OAEG;IACH,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;IAE5D;;OAEG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;IAEjG;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IAE3C;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,GAAG,IAAI,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;IAE9B;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC;IAEnB;;OAEG;IACH,QAAQ,IAAI,UAAU,CAAC;IAEvB;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { SegmentTree } from './segment-tree';
|
|
2
|
+
export type { ISegmentTree, SegmentTreeOptions, AggregateFunction, } from './segment-tree.interface';
|
|
3
|
+
export { Aggregations, SegmentTreeUtils, AggregationType } from './segment-tree.interface';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/data-structures/segment-tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|