@smartnet360/svelte-components 0.0.125 → 0.0.126

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.
Files changed (30) hide show
  1. package/dist/core/Auth/auth.svelte.js +47 -2
  2. package/dist/map-v3/demo/DemoMap.svelte +18 -0
  3. package/dist/map-v3/demo/demo-custom-cells.d.ts +21 -0
  4. package/dist/map-v3/demo/demo-custom-cells.js +48 -0
  5. package/dist/map-v3/features/cells/custom/components/CustomCellFilterControl.svelte +220 -0
  6. package/dist/map-v3/features/cells/custom/components/CustomCellFilterControl.svelte.d.ts +15 -0
  7. package/dist/map-v3/features/cells/custom/components/CustomCellSetManager.svelte +306 -0
  8. package/dist/map-v3/features/cells/custom/components/CustomCellSetManager.svelte.d.ts +10 -0
  9. package/dist/map-v3/features/cells/custom/components/index.d.ts +5 -0
  10. package/dist/map-v3/features/cells/custom/components/index.js +5 -0
  11. package/dist/map-v3/features/cells/custom/index.d.ts +32 -0
  12. package/dist/map-v3/features/cells/custom/index.js +35 -0
  13. package/dist/map-v3/features/cells/custom/layers/CustomCellsLayer.svelte +262 -0
  14. package/dist/map-v3/features/cells/custom/layers/CustomCellsLayer.svelte.d.ts +10 -0
  15. package/dist/map-v3/features/cells/custom/layers/index.d.ts +4 -0
  16. package/dist/map-v3/features/cells/custom/layers/index.js +4 -0
  17. package/dist/map-v3/features/cells/custom/logic/csv-parser.d.ts +20 -0
  18. package/dist/map-v3/features/cells/custom/logic/csv-parser.js +164 -0
  19. package/dist/map-v3/features/cells/custom/logic/index.d.ts +5 -0
  20. package/dist/map-v3/features/cells/custom/logic/index.js +5 -0
  21. package/dist/map-v3/features/cells/custom/logic/tree-adapter.d.ts +24 -0
  22. package/dist/map-v3/features/cells/custom/logic/tree-adapter.js +67 -0
  23. package/dist/map-v3/features/cells/custom/stores/custom-cell-sets.svelte.d.ts +78 -0
  24. package/dist/map-v3/features/cells/custom/stores/custom-cell-sets.svelte.js +242 -0
  25. package/dist/map-v3/features/cells/custom/stores/index.d.ts +4 -0
  26. package/dist/map-v3/features/cells/custom/stores/index.js +4 -0
  27. package/dist/map-v3/features/cells/custom/types.d.ts +83 -0
  28. package/dist/map-v3/features/cells/custom/types.js +23 -0
  29. package/dist/map-v3/shared/controls/MapControl.svelte +27 -3
  30. package/package.json +1 -1
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Custom Cells Feature - Type Definitions
3
+ *
4
+ * Types for ad-hoc cell layers loaded from CSV files.
5
+ * Custom cells reference existing cells by txId and add custom grouping/sizing.
6
+ */
7
+ import type { Cell } from '../../../../shared/demo';
8
+ /**
9
+ * A custom cell entry from CSV import
10
+ */
11
+ export interface CustomCell {
12
+ /** Required: Reference to cell in main data store */
13
+ txId: string;
14
+ /** Grouping field for TreeView (defaults to 'default' if not in CSV) */
15
+ customGroup: string;
16
+ /** Size multiplier for arc radius (defaults to 1) */
17
+ sizeFactor: number;
18
+ /** Any additional columns from CSV for tooltips */
19
+ extraFields: Record<string, string | number>;
20
+ /** Resolved cell data from main store (populated after import) */
21
+ resolvedCell?: Cell;
22
+ }
23
+ /**
24
+ * Import result from CSV parsing
25
+ */
26
+ export interface CustomCellImportResult {
27
+ /** Successfully parsed and matched cells */
28
+ cells: CustomCell[];
29
+ /** Cell IDs that weren't found in main data store */
30
+ unmatchedTxIds: string[];
31
+ /** Discovered custom groups */
32
+ groups: string[];
33
+ /** Extra column names found in CSV */
34
+ extraColumns: string[];
35
+ /** Total rows in CSV */
36
+ totalRows: number;
37
+ }
38
+ /**
39
+ * A custom cell set - represents one uploaded CSV
40
+ */
41
+ export interface CustomCellSet {
42
+ /** Unique identifier for this set */
43
+ id: string;
44
+ /** Display name (from filename or user input) */
45
+ name: string;
46
+ /** Cells in this set with resolved data */
47
+ cells: CustomCell[];
48
+ /** Cell IDs that weren't found during import */
49
+ unmatchedTxIds: string[];
50
+ /** All custom groups in this set */
51
+ groups: string[];
52
+ /** Extra column names for tooltip display */
53
+ extraColumns: string[];
54
+ /** Base arc radius in pixels (multiplied by sizeFactor per cell) */
55
+ baseSize: number;
56
+ /** Layer opacity (0-1) */
57
+ opacity: number;
58
+ /** Default color for groups without override */
59
+ defaultColor: string;
60
+ /** Per-group color overrides */
61
+ groupColors: Record<string, string>;
62
+ /** Whether this set's layer is visible */
63
+ visible: boolean;
64
+ /** Which groups are currently visible */
65
+ visibleGroups: Set<string>;
66
+ }
67
+ /**
68
+ * Configuration for creating a new custom cell set
69
+ */
70
+ export interface CustomCellSetConfig {
71
+ name: string;
72
+ cells: CustomCell[];
73
+ unmatchedTxIds?: string[];
74
+ groups?: string[];
75
+ extraColumns?: string[];
76
+ baseSize?: number;
77
+ opacity?: number;
78
+ defaultColor?: string;
79
+ }
80
+ /**
81
+ * Default color palette for custom cell groups
82
+ */
83
+ export declare const CUSTOM_CELL_PALETTE: string[];
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Custom Cells Feature - Type Definitions
3
+ *
4
+ * Types for ad-hoc cell layers loaded from CSV files.
5
+ * Custom cells reference existing cells by txId and add custom grouping/sizing.
6
+ */
7
+ /**
8
+ * Default color palette for custom cell groups
9
+ */
10
+ export const CUSTOM_CELL_PALETTE = [
11
+ '#e41a1c', // Red
12
+ '#377eb8', // Blue
13
+ '#4daf4a', // Green
14
+ '#984ea3', // Purple
15
+ '#ff7f00', // Orange
16
+ '#ffff33', // Yellow
17
+ '#a65628', // Brown
18
+ '#f781bf', // Pink
19
+ '#999999', // Gray
20
+ '#66c2a5', // Teal
21
+ '#fc8d62', // Coral
22
+ '#8da0cb', // Periwinkle
23
+ ];
@@ -60,6 +60,7 @@
60
60
  let controlElement: HTMLDivElement;
61
61
  let collapsed = $state(initiallyCollapsed);
62
62
  let control: IControl | null = null;
63
+ let isAdded = false;
63
64
 
64
65
  // Reactively add/remove control when map becomes available/unavailable
65
66
  $effect(() => {
@@ -67,13 +68,29 @@
67
68
  if (map && controlElement) {
68
69
  addControl(map);
69
70
  return () => {
71
+ console.log(`[MapControl] Effect cleanup called for: ${title}`);
70
72
  removeControl(map);
71
73
  };
72
74
  }
73
75
  });
74
76
 
77
+ // Ensure control is removed when component is destroyed
78
+ onDestroy(() => {
79
+ console.log(`[MapControl] onDestroy called for: ${title}`);
80
+ const map = mapStore?.map;
81
+ if (map) {
82
+ removeControl(map);
83
+ }
84
+ // Also explicitly remove from DOM as fallback
85
+ // (Mapbox moves the element to its own container)
86
+ if (controlElement?.parentNode) {
87
+ controlElement.parentNode.removeChild(controlElement);
88
+ }
89
+ });
90
+
75
91
  function addControl(map: MapboxMap) {
76
- if (control) return;
92
+ if (control || isAdded) return;
93
+ isAdded = true;
77
94
 
78
95
  // Create a custom Mapbox control
79
96
  control = {
@@ -81,7 +98,7 @@
81
98
  return controlElement;
82
99
  },
83
100
  onRemove: () => {
84
- // Cleanup handled in onDestroy/effect cleanup
101
+ // Mapbox will remove the element from its container
85
102
  }
86
103
  };
87
104
 
@@ -90,12 +107,19 @@
90
107
 
91
108
  function removeControl(map: MapboxMap) {
92
109
  if (control) {
110
+ console.log(`[MapControl] Removing control: ${title}`);
93
111
  try {
94
112
  map.removeControl(control);
95
113
  } catch (e) {
96
- // Control may already be removed or map destroyed
114
+ console.log(`[MapControl] Error removing control (may already be removed): ${title}`, e);
97
115
  }
98
116
  control = null;
117
+ isAdded = false;
118
+ }
119
+ // Fallback: ensure element is removed from DOM
120
+ if (controlElement?.parentNode) {
121
+ console.log(`[MapControl] Fallback DOM removal for: ${title}`);
122
+ controlElement.parentNode.removeChild(controlElement);
99
123
  }
100
124
  }
101
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartnet360/svelte-components",
3
- "version": "0.0.125",
3
+ "version": "0.0.126",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",