@smartnet360/svelte-components 0.0.118 → 0.0.120
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/components/AntennaDiagramsV2.svelte +412 -0
- package/dist/apps/antenna-pattern/components/AntennaDiagramsV2.svelte.d.ts +8 -0
- package/dist/apps/antenna-pattern/index.d.ts +3 -0
- package/dist/apps/antenna-pattern/index.js +4 -0
- package/dist/apps/antenna-pattern/types.d.ts +87 -0
- package/dist/apps/antenna-pattern/types.js +5 -0
- package/dist/apps/antenna-pattern/utils/antenna-helpers.d.ts +57 -0
- package/dist/apps/antenna-pattern/utils/antenna-helpers.js +140 -0
- package/dist/apps/antenna-tools/band-config.d.ts +53 -0
- package/dist/apps/antenna-tools/band-config.js +112 -0
- package/dist/apps/antenna-tools/components/AntennaControls.svelte +558 -0
- package/dist/apps/antenna-tools/components/AntennaControls.svelte.d.ts +16 -0
- package/dist/apps/antenna-tools/components/AntennaSettingsModal.svelte +304 -0
- package/dist/apps/antenna-tools/components/AntennaSettingsModal.svelte.d.ts +8 -0
- package/dist/apps/antenna-tools/components/AntennaTools.svelte +597 -0
- package/dist/apps/antenna-tools/components/AntennaTools.svelte.d.ts +42 -0
- package/dist/apps/antenna-tools/components/DatabaseViewer.svelte +278 -0
- package/dist/apps/antenna-tools/components/DatabaseViewer.svelte.d.ts +3 -0
- package/dist/apps/antenna-tools/components/DbNotification.svelte +67 -0
- package/dist/apps/antenna-tools/components/DbNotification.svelte.d.ts +18 -0
- package/dist/apps/antenna-tools/components/JsonImporter.svelte +115 -0
- package/dist/apps/antenna-tools/components/JsonImporter.svelte.d.ts +6 -0
- package/dist/apps/antenna-tools/components/MSIConverter.svelte +282 -0
- package/dist/apps/antenna-tools/components/MSIConverter.svelte.d.ts +6 -0
- package/dist/apps/antenna-tools/components/chart-engines/PolarAreaChart.svelte +123 -0
- package/dist/apps/antenna-tools/components/chart-engines/PolarAreaChart.svelte.d.ts +16 -0
- package/dist/apps/antenna-tools/components/chart-engines/PolarLineChart.svelte +123 -0
- package/dist/apps/antenna-tools/components/chart-engines/PolarLineChart.svelte.d.ts +16 -0
- package/dist/apps/antenna-tools/components/chart-engines/index.d.ts +9 -0
- package/dist/apps/antenna-tools/components/chart-engines/index.js +9 -0
- package/dist/apps/antenna-tools/components/index.d.ts +8 -0
- package/dist/apps/antenna-tools/components/index.js +10 -0
- package/dist/apps/antenna-tools/db.d.ts +28 -0
- package/dist/apps/antenna-tools/db.js +45 -0
- package/dist/apps/antenna-tools/index.d.ts +26 -0
- package/dist/apps/antenna-tools/index.js +40 -0
- package/dist/apps/antenna-tools/stores/antennas.d.ts +13 -0
- package/dist/apps/antenna-tools/stores/antennas.js +25 -0
- package/dist/apps/antenna-tools/stores/db-status.d.ts +32 -0
- package/dist/apps/antenna-tools/stores/db-status.js +38 -0
- package/dist/apps/antenna-tools/stores/index.d.ts +5 -0
- package/dist/apps/antenna-tools/stores/index.js +5 -0
- package/dist/apps/antenna-tools/types.d.ts +137 -0
- package/dist/apps/antenna-tools/types.js +16 -0
- package/dist/apps/antenna-tools/utils/antenna-helpers.d.ts +83 -0
- package/dist/apps/antenna-tools/utils/antenna-helpers.js +198 -0
- package/dist/apps/antenna-tools/utils/chart-engines/index.d.ts +5 -0
- package/dist/apps/antenna-tools/utils/chart-engines/index.js +5 -0
- package/dist/apps/antenna-tools/utils/chart-engines/polar-area-utils.d.ts +94 -0
- package/dist/apps/antenna-tools/utils/chart-engines/polar-area-utils.js +151 -0
- package/dist/apps/antenna-tools/utils/chart-engines/polar-line-utils.d.ts +93 -0
- package/dist/apps/antenna-tools/utils/chart-engines/polar-line-utils.js +139 -0
- package/dist/apps/antenna-tools/utils/db-utils.d.ts +50 -0
- package/dist/apps/antenna-tools/utils/db-utils.js +266 -0
- package/dist/apps/antenna-tools/utils/index.d.ts +7 -0
- package/dist/apps/antenna-tools/utils/index.js +7 -0
- package/dist/apps/antenna-tools/utils/msi-parser.d.ts +21 -0
- package/dist/apps/antenna-tools/utils/msi-parser.js +215 -0
- package/dist/apps/antenna-tools/utils/recent-antennas.d.ts +24 -0
- package/dist/apps/antenna-tools/utils/recent-antennas.js +64 -0
- package/package.json +1 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antenna Data Utilities
|
|
3
|
+
* Helper functions for working with antenna data, tilts, and searches
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Find an antenna by name with fallback matching strategies
|
|
7
|
+
* @param antennas - Array of all antennas
|
|
8
|
+
* @param name - Name pattern to search for
|
|
9
|
+
* @returns Search result with antenna and match type
|
|
10
|
+
*/
|
|
11
|
+
export function findAntennaByName(antennas, name) {
|
|
12
|
+
if (!name || antennas.length === 0) {
|
|
13
|
+
return { antenna: null, matchType: 'not-found' };
|
|
14
|
+
}
|
|
15
|
+
// Strategy 1: Exact match
|
|
16
|
+
let found = antennas.find(a => a.name === name);
|
|
17
|
+
if (found) {
|
|
18
|
+
return { antenna: found, matchType: 'exact' };
|
|
19
|
+
}
|
|
20
|
+
// Strategy 2: Case-insensitive match
|
|
21
|
+
const lowerName = name.toLowerCase();
|
|
22
|
+
found = antennas.find(a => a.name.toLowerCase() === lowerName);
|
|
23
|
+
if (found) {
|
|
24
|
+
return { antenna: found, matchType: 'case-insensitive' };
|
|
25
|
+
}
|
|
26
|
+
// Strategy 3: Partial match (name contains search term)
|
|
27
|
+
found = antennas.find(a => a.name.toLowerCase().includes(lowerName));
|
|
28
|
+
if (found) {
|
|
29
|
+
return { antenna: found, matchType: 'partial' };
|
|
30
|
+
}
|
|
31
|
+
return { antenna: null, matchType: 'not-found' };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Collect all available electrical tilts for an antenna model
|
|
35
|
+
* Searches all antennas with the same name and extracts unique tilt values
|
|
36
|
+
* @param antennas - Array of all antennas
|
|
37
|
+
* @param antennaName - The antenna model name
|
|
38
|
+
* @param frequency - Optional frequency to filter by
|
|
39
|
+
* @returns Sorted array of tilt values as strings
|
|
40
|
+
*/
|
|
41
|
+
export function collectAvailableTilts(antennas, antennaName, frequency) {
|
|
42
|
+
if (!antennaName)
|
|
43
|
+
return ['0'];
|
|
44
|
+
// Find all antennas with the same name
|
|
45
|
+
let sameModel = antennas.filter(a => a.name === antennaName);
|
|
46
|
+
// Optionally filter by frequency
|
|
47
|
+
if (frequency) {
|
|
48
|
+
sameModel = sameModel.filter(a => a.frequency === frequency);
|
|
49
|
+
}
|
|
50
|
+
// Collect all unique tilts
|
|
51
|
+
const allTilts = new Set();
|
|
52
|
+
for (const antenna of sameModel) {
|
|
53
|
+
if (antenna.tilt) {
|
|
54
|
+
const tiltStr = antenna.tilt.toString();
|
|
55
|
+
if (tiltStr.includes(',')) {
|
|
56
|
+
tiltStr.split(',').forEach(t => allTilts.add(t.trim()));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
allTilts.add(tiltStr.trim());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Return sorted array (numerically)
|
|
64
|
+
const sorted = Array.from(allTilts).sort((a, b) => parseFloat(a) - parseFloat(b));
|
|
65
|
+
return sorted.length > 0 ? sorted : ['0'];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Collect all available frequencies for an antenna model
|
|
69
|
+
* @param antennas - Array of all antennas
|
|
70
|
+
* @param antennaName - The antenna model name
|
|
71
|
+
* @returns Sorted array of unique frequencies
|
|
72
|
+
*/
|
|
73
|
+
export function collectAvailableFrequencies(antennas, antennaName) {
|
|
74
|
+
if (!antennaName)
|
|
75
|
+
return [];
|
|
76
|
+
const sameModel = antennas.filter(a => a.name === antennaName);
|
|
77
|
+
const frequencies = new Set();
|
|
78
|
+
for (const antenna of sameModel) {
|
|
79
|
+
if (antenna.frequency) {
|
|
80
|
+
frequencies.add(antenna.frequency);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return Array.from(frequencies).sort((a, b) => a - b);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Find the index of a tilt value in the available tilts array
|
|
87
|
+
* @param availableTilts - Array of available tilt values
|
|
88
|
+
* @param tiltValue - The tilt value to find (as number)
|
|
89
|
+
* @returns Index in the array, or 0 if not found
|
|
90
|
+
*/
|
|
91
|
+
export function findTiltIndex(availableTilts, tiltValue) {
|
|
92
|
+
const index = availableTilts.findIndex(t => parseInt(t, 10) === tiltValue);
|
|
93
|
+
return index >= 0 ? index : 0;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get the tilt value at a given index
|
|
97
|
+
* @param availableTilts - Array of available tilt values
|
|
98
|
+
* @param index - Index to retrieve
|
|
99
|
+
* @returns Tilt value as number
|
|
100
|
+
*/
|
|
101
|
+
export function getTiltValue(availableTilts, index) {
|
|
102
|
+
const tilt = availableTilts[index];
|
|
103
|
+
return tilt ? parseInt(tilt, 10) : 0;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Find an antenna with specific name, frequency, and tilt
|
|
107
|
+
* @param antennas - Array of all antennas
|
|
108
|
+
* @param name - Antenna model name
|
|
109
|
+
* @param frequency - Target frequency (optional)
|
|
110
|
+
* @param tiltValue - Target tilt value
|
|
111
|
+
* @returns Matching antenna or null
|
|
112
|
+
*/
|
|
113
|
+
export function findAntennaWithTilt(antennas, name, frequency, tiltValue) {
|
|
114
|
+
return antennas.find(antenna => {
|
|
115
|
+
if (antenna.name !== name)
|
|
116
|
+
return false;
|
|
117
|
+
if (frequency && antenna.frequency !== frequency)
|
|
118
|
+
return false;
|
|
119
|
+
if (antenna.tilt) {
|
|
120
|
+
const tiltStr = antenna.tilt.toString();
|
|
121
|
+
const antennaTilts = tiltStr.includes(',')
|
|
122
|
+
? tiltStr.split(',').map(t => t.trim())
|
|
123
|
+
: [tiltStr.trim()];
|
|
124
|
+
return antennaTilts.includes(tiltValue);
|
|
125
|
+
}
|
|
126
|
+
return tiltValue === '0';
|
|
127
|
+
}) || null;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get unique antenna models (by name)
|
|
131
|
+
* @param antennas - Array of all antennas
|
|
132
|
+
* @returns Array of unique antenna names
|
|
133
|
+
*/
|
|
134
|
+
export function getUniqueAntennaModels(antennas) {
|
|
135
|
+
const names = new Set();
|
|
136
|
+
for (const antenna of antennas) {
|
|
137
|
+
names.add(antenna.name);
|
|
138
|
+
}
|
|
139
|
+
return Array.from(names).sort();
|
|
140
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antenna Tools - Band Configuration
|
|
3
|
+
* Frequency band definitions and purge utilities
|
|
4
|
+
*/
|
|
5
|
+
import type { BandDefinition, Antenna, RawAntenna } from './types';
|
|
6
|
+
import { STANDARD_BANDS } from './types';
|
|
7
|
+
export { STANDARD_BANDS };
|
|
8
|
+
export type { BandDefinition };
|
|
9
|
+
/**
|
|
10
|
+
* Get the center frequency of a band
|
|
11
|
+
*/
|
|
12
|
+
export declare function getBandCenterFrequency(band: BandDefinition): number;
|
|
13
|
+
/**
|
|
14
|
+
* Find which band a frequency belongs to
|
|
15
|
+
* @returns Band definition or null if not in any standard band
|
|
16
|
+
*/
|
|
17
|
+
export declare function findBandForFrequency(frequencyMHz: number): BandDefinition | null;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a frequency is within any standard band
|
|
20
|
+
*/
|
|
21
|
+
export declare function isFrequencyInStandardBand(frequencyMHz: number): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Purge antennas - keep only one per band (closest to center frequency)
|
|
24
|
+
*
|
|
25
|
+
* For each antenna name + tilt combination:
|
|
26
|
+
* - For each standard band, find antennas within the band's frequency range
|
|
27
|
+
* - Keep only the one closest to the center frequency
|
|
28
|
+
* - Update frequency to band name (700, 800, etc.)
|
|
29
|
+
* - Store original frequency in originalFrequency field
|
|
30
|
+
*
|
|
31
|
+
* @param rawAntennas - Antennas parsed from MSI files (with actual MHz frequencies)
|
|
32
|
+
* @returns Purged antennas with band names as frequencies
|
|
33
|
+
*/
|
|
34
|
+
export declare function purgeAntennas(rawAntennas: RawAntenna[]): Antenna[];
|
|
35
|
+
/**
|
|
36
|
+
* Get purge statistics
|
|
37
|
+
*/
|
|
38
|
+
export interface PurgeStats {
|
|
39
|
+
/** Total raw antennas before purge */
|
|
40
|
+
totalBefore: number;
|
|
41
|
+
/** Total antennas after purge */
|
|
42
|
+
totalAfter: number;
|
|
43
|
+
/** Number of antennas removed */
|
|
44
|
+
removed: number;
|
|
45
|
+
/** Reduction percentage */
|
|
46
|
+
reductionPercent: number;
|
|
47
|
+
/** Antennas per band */
|
|
48
|
+
perBand: Record<string, number>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Calculate purge statistics
|
|
52
|
+
*/
|
|
53
|
+
export declare function calculatePurgeStats(rawCount: number, purgedAntennas: Antenna[]): PurgeStats;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antenna Tools - Band Configuration
|
|
3
|
+
* Frequency band definitions and purge utilities
|
|
4
|
+
*/
|
|
5
|
+
import { STANDARD_BANDS } from './types';
|
|
6
|
+
// Re-export for convenience
|
|
7
|
+
export { STANDARD_BANDS };
|
|
8
|
+
/**
|
|
9
|
+
* Get the center frequency of a band
|
|
10
|
+
*/
|
|
11
|
+
export function getBandCenterFrequency(band) {
|
|
12
|
+
return (band.dlMin + band.dlMax) / 2;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Find which band a frequency belongs to
|
|
16
|
+
* @returns Band definition or null if not in any standard band
|
|
17
|
+
*/
|
|
18
|
+
export function findBandForFrequency(frequencyMHz) {
|
|
19
|
+
return STANDARD_BANDS.find(band => frequencyMHz >= band.dlMin && frequencyMHz <= band.dlMax) || null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Check if a frequency is within any standard band
|
|
23
|
+
*/
|
|
24
|
+
export function isFrequencyInStandardBand(frequencyMHz) {
|
|
25
|
+
return findBandForFrequency(frequencyMHz) !== null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Group raw antennas by name and tilt
|
|
29
|
+
*/
|
|
30
|
+
function groupByNameAndTilt(antennas) {
|
|
31
|
+
const groups = new Map();
|
|
32
|
+
for (const antenna of antennas) {
|
|
33
|
+
const key = `${antenna.name}__${antenna.tilt}`;
|
|
34
|
+
const group = groups.get(key) || [];
|
|
35
|
+
group.push(antenna);
|
|
36
|
+
groups.set(key, group);
|
|
37
|
+
}
|
|
38
|
+
return groups;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Purge antennas - keep only one per band (closest to center frequency)
|
|
42
|
+
*
|
|
43
|
+
* For each antenna name + tilt combination:
|
|
44
|
+
* - For each standard band, find antennas within the band's frequency range
|
|
45
|
+
* - Keep only the one closest to the center frequency
|
|
46
|
+
* - Update frequency to band name (700, 800, etc.)
|
|
47
|
+
* - Store original frequency in originalFrequency field
|
|
48
|
+
*
|
|
49
|
+
* @param rawAntennas - Antennas parsed from MSI files (with actual MHz frequencies)
|
|
50
|
+
* @returns Purged antennas with band names as frequencies
|
|
51
|
+
*/
|
|
52
|
+
export function purgeAntennas(rawAntennas) {
|
|
53
|
+
const purged = [];
|
|
54
|
+
// Group by antenna name + tilt
|
|
55
|
+
const groups = groupByNameAndTilt(rawAntennas);
|
|
56
|
+
for (const [_key, group] of groups) {
|
|
57
|
+
// For each standard band
|
|
58
|
+
for (const band of STANDARD_BANDS) {
|
|
59
|
+
// Find antennas in this band's frequency range
|
|
60
|
+
const inBand = group.filter(a => a.frequency >= band.dlMin && a.frequency <= band.dlMax);
|
|
61
|
+
if (inBand.length === 0)
|
|
62
|
+
continue;
|
|
63
|
+
// Find the one closest to center frequency
|
|
64
|
+
const centerFreq = getBandCenterFrequency(band);
|
|
65
|
+
const closest = inBand.reduce((best, current) => {
|
|
66
|
+
const bestDist = Math.abs(best.frequency - centerFreq);
|
|
67
|
+
const currDist = Math.abs(current.frequency - centerFreq);
|
|
68
|
+
return currDist < bestDist ? current : best;
|
|
69
|
+
});
|
|
70
|
+
// Create purged antenna with band name as frequency
|
|
71
|
+
// Explicitly copy only serializable properties (avoid spread which may include non-cloneable data)
|
|
72
|
+
const purgedAntenna = {
|
|
73
|
+
name: closest.name,
|
|
74
|
+
frequency: parseInt(band.name, 10), // Use band name as frequency (700, 800, etc.)
|
|
75
|
+
originalFrequency: closest.frequency, // Store original MHz
|
|
76
|
+
gain_dBd: closest.gain_dBd,
|
|
77
|
+
tilt: closest.tilt,
|
|
78
|
+
comment: closest.comment,
|
|
79
|
+
horizontal: closest.horizontal,
|
|
80
|
+
pattern: Array.isArray(closest.pattern) ? [...closest.pattern] : [],
|
|
81
|
+
vertical_pattern: Array.isArray(closest.vertical_pattern) ? [...closest.vertical_pattern] : [],
|
|
82
|
+
polarization: closest.polarization,
|
|
83
|
+
x_pol: closest.x_pol,
|
|
84
|
+
co: closest.co,
|
|
85
|
+
tilt_from_filename: closest.tilt_from_filename,
|
|
86
|
+
sourcePath: closest.sourcePath,
|
|
87
|
+
};
|
|
88
|
+
purged.push(purgedAntenna);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return purged;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Calculate purge statistics
|
|
95
|
+
*/
|
|
96
|
+
export function calculatePurgeStats(rawCount, purgedAntennas) {
|
|
97
|
+
const perBand = {};
|
|
98
|
+
for (const antenna of purgedAntennas) {
|
|
99
|
+
const bandName = antenna.frequency.toString();
|
|
100
|
+
perBand[bandName] = (perBand[bandName] || 0) + 1;
|
|
101
|
+
}
|
|
102
|
+
const totalAfter = purgedAntennas.length;
|
|
103
|
+
const removed = rawCount - totalAfter;
|
|
104
|
+
const reductionPercent = rawCount > 0 ? Math.round((removed / rawCount) * 100) : 0;
|
|
105
|
+
return {
|
|
106
|
+
totalBefore: rawCount,
|
|
107
|
+
totalAfter,
|
|
108
|
+
removed,
|
|
109
|
+
reductionPercent,
|
|
110
|
+
perBand
|
|
111
|
+
};
|
|
112
|
+
}
|