@smartnet360/svelte-components 0.0.102 → 0.0.103
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/apps/antenna-pattern/index.d.ts +1 -0
- package/dist/apps/antenna-pattern/index.js +1 -0
- package/dist/apps/antenna-pattern/utils/load-static-antennas.d.ts +17 -0
- package/dist/apps/antenna-pattern/utils/load-static-antennas.js +83 -0
- package/dist/apps/site-check/SiteCheck.svelte +4 -6
- package/dist/core/Charts/ChartCard.svelte +122 -12
- package/dist/core/Charts/ChartCard.svelte.d.ts +2 -0
- package/dist/core/Charts/ChartComponent.svelte +8 -6
- package/dist/core/CoverageMap/ai/AITools.d.ts +117 -0
- package/dist/core/CoverageMap/ai/AITools.js +380 -0
- package/dist/core/CoverageMap/core/CoverageCalculator.d.ts +138 -0
- package/dist/core/CoverageMap/core/CoverageCalculator.js +375 -0
- package/dist/core/CoverageMap/core/GridCalculator.d.ts +115 -0
- package/dist/core/CoverageMap/core/GridCalculator.js +484 -0
- package/dist/core/CoverageMap/core/PathLossModels.d.ts +253 -0
- package/dist/core/CoverageMap/core/PathLossModels.js +380 -0
- package/dist/core/CoverageMap/core/SignalProcessor.d.ts +288 -0
- package/dist/core/CoverageMap/core/SignalProcessor.js +424 -0
- package/dist/core/CoverageMap/data/AntennaStore.d.ts +165 -0
- package/dist/core/CoverageMap/data/AntennaStore.js +327 -0
- package/dist/core/CoverageMap/data/SiteStore.d.ts +155 -0
- package/dist/core/CoverageMap/data/SiteStore.js +355 -0
- package/dist/core/CoverageMap/index.d.ts +74 -0
- package/dist/core/CoverageMap/index.js +103 -0
- package/dist/core/CoverageMap/types.d.ts +252 -0
- package/dist/core/CoverageMap/types.js +7 -0
- package/dist/core/CoverageMap/utils/geoUtils.d.ts +223 -0
- package/dist/core/CoverageMap/utils/geoUtils.js +374 -0
- package/dist/core/CoverageMap/utils/rfUtils.d.ts +329 -0
- package/dist/core/CoverageMap/utils/rfUtils.js +434 -0
- package/dist/core/CoverageMap/visualization/ColorSchemes.d.ts +149 -0
- package/dist/core/CoverageMap/visualization/ColorSchemes.js +377 -0
- package/dist/core/TreeView/index.d.ts +4 -4
- package/dist/core/TreeView/index.js +5 -5
- package/dist/core/TreeView/tree-utils.d.ts +12 -0
- package/dist/core/TreeView/tree-utils.js +115 -6
- package/dist/core/TreeView/tree.store.svelte.d.ts +94 -0
- package/dist/core/TreeView/tree.store.svelte.js +274 -0
- package/dist/map-v2/features/cells/controls/CellFilterControl.svelte +16 -27
- package/dist/map-v2/features/repeaters/controls/RepeaterFilterControl.svelte +33 -42
- package/dist/map-v2/features/sites/controls/SiteFilterControl.svelte +12 -19
- package/dist/map-v3/core/components/Map.svelte +4 -0
- package/dist/map-v3/core/stores/map.store.svelte.js +2 -0
- package/dist/map-v3/features/cells/components/CellFilterControl.svelte +24 -30
- package/dist/map-v3/features/coverage/index.d.ts +12 -0
- package/dist/map-v3/features/coverage/index.js +16 -0
- package/dist/map-v3/features/coverage/layers/CoverageLayer.svelte +198 -0
- package/dist/map-v3/features/coverage/layers/CoverageLayer.svelte.d.ts +10 -0
- package/dist/map-v3/features/coverage/logic/coloring.d.ts +28 -0
- package/dist/map-v3/features/coverage/logic/coloring.js +77 -0
- package/dist/map-v3/features/coverage/logic/geometry.d.ts +33 -0
- package/dist/map-v3/features/coverage/logic/geometry.js +112 -0
- package/dist/map-v3/features/coverage/stores/coverage.data.svelte.d.ts +46 -0
- package/dist/map-v3/features/coverage/stores/coverage.data.svelte.js +95 -0
- package/dist/map-v3/features/coverage/stores/coverage.display.svelte.d.ts +33 -0
- package/dist/map-v3/features/coverage/stores/coverage.display.svelte.js +90 -0
- package/dist/map-v3/features/coverage/types.d.ts +52 -0
- package/dist/map-v3/features/coverage/types.js +7 -0
- package/dist/map-v3/features/repeaters/components/RepeaterFilterControl.svelte +14 -20
- package/dist/map-v3/features/sites/components/SiteFilterControl.svelte +23 -33
- package/dist/map-v3/index.d.ts +4 -0
- package/dist/map-v3/index.js +5 -0
- package/package.json +2 -2
- package/dist/core/TreeView/tree.store.d.ts +0 -10
- package/dist/core/TreeView/tree.store.js +0 -320
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tree Store
|
|
3
|
-
* Svelte writable store for managing tree state with persistence
|
|
4
|
-
*/
|
|
5
|
-
import { writable } from 'svelte/store';
|
|
6
|
-
import { flattenTree, buildInitialState, calculateIndeterminateStates, getDescendantPaths, getParentPath, getAncestorPaths, saveStateToStorage, loadStateFromStorage, clearStorageForNamespace } from './tree-utils';
|
|
7
|
-
import { log } from '../logger';
|
|
8
|
-
/**
|
|
9
|
-
* Create a tree store with state management and persistence
|
|
10
|
-
*/
|
|
11
|
-
export function createTreeStore(config) {
|
|
12
|
-
log('🌲 Creating TreeStore', {
|
|
13
|
-
namespace: config.namespace,
|
|
14
|
-
nodeCount: config.nodes.length,
|
|
15
|
-
persistState: config.persistState,
|
|
16
|
-
defaultExpandAll: config.defaultExpandAll
|
|
17
|
-
});
|
|
18
|
-
const separator = config.pathSeparator || ':';
|
|
19
|
-
// Flatten tree structure
|
|
20
|
-
const nodesMap = flattenTree(config.nodes, config);
|
|
21
|
-
log('📊 Tree flattened', {
|
|
22
|
-
totalNodes: nodesMap.size,
|
|
23
|
-
separator
|
|
24
|
-
});
|
|
25
|
-
// Build initial state
|
|
26
|
-
let state = buildInitialState(nodesMap, config);
|
|
27
|
-
log('🔧 Initial state built', {
|
|
28
|
-
checkedPaths: state.checkedPaths.size,
|
|
29
|
-
expandedPaths: state.expandedPaths.size
|
|
30
|
-
});
|
|
31
|
-
// Load persisted state if enabled
|
|
32
|
-
if (config.persistState && config.namespace) {
|
|
33
|
-
const persistedState = loadStateFromStorage(config.namespace, state);
|
|
34
|
-
state = { ...state, ...persistedState };
|
|
35
|
-
log('💾 Loaded persisted state', {
|
|
36
|
-
namespace: config.namespace,
|
|
37
|
-
checkedPaths: state.checkedPaths.size,
|
|
38
|
-
expandedPaths: state.expandedPaths.size
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
// Create writable store
|
|
42
|
-
const store = writable({
|
|
43
|
-
state,
|
|
44
|
-
config,
|
|
45
|
-
toggle: () => { },
|
|
46
|
-
toggleExpand: () => { },
|
|
47
|
-
expandAll: () => { },
|
|
48
|
-
collapseAll: () => { },
|
|
49
|
-
checkAll: () => { },
|
|
50
|
-
uncheckAll: () => { },
|
|
51
|
-
getCheckedPaths: () => [],
|
|
52
|
-
getCheckedLeafPaths: () => [],
|
|
53
|
-
clearStorage: () => { }
|
|
54
|
-
});
|
|
55
|
-
/**
|
|
56
|
-
* Update state and trigger reactivity
|
|
57
|
-
*/
|
|
58
|
-
function updateState(updater) {
|
|
59
|
-
store.update(current => {
|
|
60
|
-
const newState = updater(current.state);
|
|
61
|
-
// Persist if enabled
|
|
62
|
-
if (config.persistState && config.namespace) {
|
|
63
|
-
saveStateToStorage(config.namespace, newState);
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
...current,
|
|
67
|
-
state: newState
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Toggle a node's checked state (with cascading)
|
|
73
|
-
*
|
|
74
|
-
* Logic:
|
|
75
|
-
* 1. Toggle the clicked node
|
|
76
|
-
* 2. Cascade DOWN to all descendants (check/uncheck all children)
|
|
77
|
-
* 3. Propagate UP to all ancestors (update based on their children's states)
|
|
78
|
-
*/
|
|
79
|
-
function toggle(path) {
|
|
80
|
-
log('🔄 Toggling node', { path });
|
|
81
|
-
updateState(state => {
|
|
82
|
-
const nodeState = state.nodes.get(path);
|
|
83
|
-
if (!nodeState) {
|
|
84
|
-
log('⚠️ Node not found', { path });
|
|
85
|
-
return state;
|
|
86
|
-
}
|
|
87
|
-
const newChecked = !state.checkedPaths.has(path);
|
|
88
|
-
const newCheckedPaths = new Set(state.checkedPaths);
|
|
89
|
-
log('📌 Toggle action', { path, newChecked });
|
|
90
|
-
// STEP 0: If singleRootSelect mode and this is a root node being checked, uncheck all other roots
|
|
91
|
-
if (config.singleRootSelect && newChecked && nodeState.level === 0) {
|
|
92
|
-
log('🔘 Single root select mode: unchecking other roots', { path });
|
|
93
|
-
// Uncheck all root nodes and their descendants
|
|
94
|
-
state.rootPaths.forEach(rootPath => {
|
|
95
|
-
if (rootPath !== path) {
|
|
96
|
-
newCheckedPaths.delete(rootPath);
|
|
97
|
-
// Also uncheck all descendants of this root
|
|
98
|
-
const rootDescendants = getDescendantPaths(rootPath, state.nodes, separator);
|
|
99
|
-
rootDescendants.forEach(descendantPath => {
|
|
100
|
-
newCheckedPaths.delete(descendantPath);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
// STEP 0.5: If singleLevel1Select mode and this is a Level 1 node being checked, uncheck sibling Level 1 nodes
|
|
106
|
-
if (config.singleLevel1Select && newChecked && nodeState.level === 1) {
|
|
107
|
-
log('🔘 Single Level 1 select mode: unchecking sibling Level 1 nodes', { path });
|
|
108
|
-
const parentPath = nodeState.parentPath;
|
|
109
|
-
// Find and uncheck all Level 1 siblings (same parent, same level, different path)
|
|
110
|
-
state.nodes.forEach((node, nodePath) => {
|
|
111
|
-
if (node.level === 1 &&
|
|
112
|
-
node.parentPath === parentPath &&
|
|
113
|
-
nodePath !== path) {
|
|
114
|
-
newCheckedPaths.delete(nodePath);
|
|
115
|
-
// Also uncheck all descendants of this sibling
|
|
116
|
-
const siblingDescendants = getDescendantPaths(nodePath, state.nodes, separator);
|
|
117
|
-
siblingDescendants.forEach(descendantPath => {
|
|
118
|
-
newCheckedPaths.delete(descendantPath);
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
// STEP 1: Update this node
|
|
124
|
-
if (newChecked) {
|
|
125
|
-
newCheckedPaths.add(path);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
newCheckedPaths.delete(path);
|
|
129
|
-
}
|
|
130
|
-
// STEP 2: CASCADE DOWN - Update all descendants to match
|
|
131
|
-
const descendants = getDescendantPaths(path, state.nodes, separator);
|
|
132
|
-
log('⬇️ Cascading to descendants', {
|
|
133
|
-
path,
|
|
134
|
-
descendantCount: descendants.length,
|
|
135
|
-
newChecked
|
|
136
|
-
});
|
|
137
|
-
descendants.forEach(descendantPath => {
|
|
138
|
-
if (newChecked) {
|
|
139
|
-
newCheckedPaths.add(descendantPath);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
newCheckedPaths.delete(descendantPath);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
// STEP 3: PROPAGATE UP - Update all ancestors based on their children
|
|
146
|
-
// We need to update from the deepest ancestor up to the root
|
|
147
|
-
const ancestorPaths = getAncestorPaths(path, separator);
|
|
148
|
-
log('⬆️ Propagating to ancestors', {
|
|
149
|
-
path,
|
|
150
|
-
ancestorCount: ancestorPaths.length,
|
|
151
|
-
ancestors: ancestorPaths
|
|
152
|
-
});
|
|
153
|
-
// Process ancestors from deepest to shallowest (reverse order)
|
|
154
|
-
// This ensures we calculate states correctly as we go up
|
|
155
|
-
for (let i = ancestorPaths.length - 1; i >= 0; i--) {
|
|
156
|
-
const ancestorPath = ancestorPaths[i];
|
|
157
|
-
const ancestor = state.nodes.get(ancestorPath);
|
|
158
|
-
if (!ancestor)
|
|
159
|
-
continue;
|
|
160
|
-
// Count how many direct children are checked
|
|
161
|
-
const checkedChildrenCount = ancestor.childPaths.filter(childPath => newCheckedPaths.has(childPath)).length;
|
|
162
|
-
const totalChildren = ancestor.childPaths.length;
|
|
163
|
-
log('👨👧👦 Checking ancestor children', {
|
|
164
|
-
ancestorPath,
|
|
165
|
-
checkedChildrenCount,
|
|
166
|
-
totalChildren
|
|
167
|
-
});
|
|
168
|
-
// Update ancestor based on children states:
|
|
169
|
-
// - All children checked → check parent
|
|
170
|
-
// - No children checked → uncheck parent
|
|
171
|
-
// - Some children checked → uncheck parent (will show indeterminate)
|
|
172
|
-
if (checkedChildrenCount === totalChildren) {
|
|
173
|
-
newCheckedPaths.add(ancestorPath);
|
|
174
|
-
log('✅ All children checked, checking parent', { ancestorPath });
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
newCheckedPaths.delete(ancestorPath);
|
|
178
|
-
if (checkedChildrenCount > 0) {
|
|
179
|
-
log('➖ Some children checked, parent will be indeterminate', { ancestorPath });
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
log('❌ No children checked, unchecking parent', { ancestorPath });
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
// STEP 4: Recalculate indeterminate states
|
|
187
|
-
const newIndeterminatePaths = calculateIndeterminateStates(state.nodes, newCheckedPaths);
|
|
188
|
-
log('✅ Toggle complete', {
|
|
189
|
-
path,
|
|
190
|
-
newChecked,
|
|
191
|
-
totalChecked: newCheckedPaths.size,
|
|
192
|
-
indeterminate: newIndeterminatePaths.size
|
|
193
|
-
});
|
|
194
|
-
return {
|
|
195
|
-
...state,
|
|
196
|
-
checkedPaths: newCheckedPaths,
|
|
197
|
-
indeterminatePaths: newIndeterminatePaths
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Toggle expanded/collapsed state
|
|
203
|
-
*/
|
|
204
|
-
function toggleExpand(path) {
|
|
205
|
-
updateState(state => {
|
|
206
|
-
const newExpandedPaths = new Set(state.expandedPaths);
|
|
207
|
-
if (newExpandedPaths.has(path)) {
|
|
208
|
-
newExpandedPaths.delete(path);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
newExpandedPaths.add(path);
|
|
212
|
-
}
|
|
213
|
-
return {
|
|
214
|
-
...state,
|
|
215
|
-
expandedPaths: newExpandedPaths
|
|
216
|
-
};
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Expand all nodes
|
|
221
|
-
*/
|
|
222
|
-
function expandAll() {
|
|
223
|
-
updateState(state => {
|
|
224
|
-
const newExpandedPaths = new Set();
|
|
225
|
-
// Add all nodes with children
|
|
226
|
-
state.nodes.forEach((nodeState, path) => {
|
|
227
|
-
if (nodeState.childPaths.length > 0) {
|
|
228
|
-
newExpandedPaths.add(path);
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
return {
|
|
232
|
-
...state,
|
|
233
|
-
expandedPaths: newExpandedPaths
|
|
234
|
-
};
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Collapse all nodes
|
|
239
|
-
*/
|
|
240
|
-
function collapseAll() {
|
|
241
|
-
updateState(state => ({
|
|
242
|
-
...state,
|
|
243
|
-
expandedPaths: new Set()
|
|
244
|
-
}));
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Check all nodes
|
|
248
|
-
*/
|
|
249
|
-
function checkAll() {
|
|
250
|
-
log('✅ Check all nodes');
|
|
251
|
-
updateState(state => {
|
|
252
|
-
const newCheckedPaths = new Set();
|
|
253
|
-
state.nodes.forEach((_, path) => {
|
|
254
|
-
newCheckedPaths.add(path);
|
|
255
|
-
});
|
|
256
|
-
log('✅ All nodes checked', { totalChecked: newCheckedPaths.size });
|
|
257
|
-
return {
|
|
258
|
-
...state,
|
|
259
|
-
checkedPaths: newCheckedPaths,
|
|
260
|
-
indeterminatePaths: new Set() // No indeterminate when all checked
|
|
261
|
-
};
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Uncheck all nodes
|
|
266
|
-
*/
|
|
267
|
-
function uncheckAll() {
|
|
268
|
-
log('❌ Uncheck all nodes');
|
|
269
|
-
updateState(state => ({
|
|
270
|
-
...state,
|
|
271
|
-
checkedPaths: new Set(),
|
|
272
|
-
indeterminatePaths: new Set()
|
|
273
|
-
}));
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Get all checked paths
|
|
277
|
-
*/
|
|
278
|
-
function getCheckedPaths() {
|
|
279
|
-
let result = [];
|
|
280
|
-
store.subscribe(value => {
|
|
281
|
-
result = Array.from(value.state.checkedPaths);
|
|
282
|
-
})();
|
|
283
|
-
return result;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Get only checked leaf paths (nodes without children)
|
|
287
|
-
*/
|
|
288
|
-
function getCheckedLeafPaths() {
|
|
289
|
-
let result = [];
|
|
290
|
-
store.subscribe(value => {
|
|
291
|
-
result = Array.from(value.state.checkedPaths).filter(path => {
|
|
292
|
-
const node = value.state.nodes.get(path);
|
|
293
|
-
return node && node.childPaths.length === 0;
|
|
294
|
-
});
|
|
295
|
-
})();
|
|
296
|
-
return result;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Clear localStorage
|
|
300
|
-
*/
|
|
301
|
-
function clearStorage() {
|
|
302
|
-
if (config.namespace) {
|
|
303
|
-
clearStorageForNamespace(config.namespace);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
// Initialize store with methods
|
|
307
|
-
store.update(current => ({
|
|
308
|
-
...current,
|
|
309
|
-
toggle,
|
|
310
|
-
toggleExpand,
|
|
311
|
-
expandAll,
|
|
312
|
-
collapseAll,
|
|
313
|
-
checkAll,
|
|
314
|
-
uncheckAll,
|
|
315
|
-
getCheckedPaths,
|
|
316
|
-
getCheckedLeafPaths,
|
|
317
|
-
clearStorage
|
|
318
|
-
}));
|
|
319
|
-
return store;
|
|
320
|
-
}
|