@smartnet360/svelte-components 0.0.39 → 0.0.41

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 (33) hide show
  1. package/dist/apps/antenna-pattern/components/AntennaDiagrams.svelte +0 -5
  2. package/dist/apps/antenna-pattern/components/DbNotification.svelte +1 -1
  3. package/dist/apps/antenna-pattern/components/chart-engines/PolarBarChart.svelte +2 -0
  4. package/dist/apps/antenna-pattern/components/chart-engines/PolarBarChart.svelte.d.ts +1 -0
  5. package/dist/apps/site-check/SiteCheck.svelte +5 -3
  6. package/dist/apps/site-check/SiteCheck.svelte.d.ts +2 -1
  7. package/dist/apps/site-check/helper.js +3 -0
  8. package/dist/core/Charts/ChartCard.svelte +9 -12
  9. package/dist/core/Charts/ChartCard.svelte.d.ts +5 -21
  10. package/dist/core/Charts/ChartComponent.svelte +2 -2
  11. package/dist/core/Charts/editor/ChartLayoutEditor.svelte +8 -8
  12. package/dist/core/Charts/editor/GridPreview.svelte +0 -3
  13. package/dist/core/Charts/editor/KPIPicker.svelte +6 -7
  14. package/dist/core/Charts/editor/KPIPicker.svelte.d.ts +4 -20
  15. package/dist/core/Charts/editor/PropertiesPanel.svelte +6 -3
  16. package/dist/core/Charts/editor/PropertiesPanel.svelte.d.ts +8 -18
  17. package/dist/core/Map/Map.svelte +312 -0
  18. package/dist/core/Map/Map.svelte.d.ts +230 -0
  19. package/dist/core/Map/index.d.ts +9 -0
  20. package/dist/core/Map/index.js +9 -0
  21. package/dist/core/Map/mapSettings.d.ts +147 -0
  22. package/dist/core/Map/mapSettings.js +226 -0
  23. package/dist/core/Map/mapStore.d.ts +73 -0
  24. package/dist/core/Map/mapStore.js +136 -0
  25. package/dist/core/Map/types.d.ts +72 -0
  26. package/dist/core/Map/types.js +32 -0
  27. package/dist/core/Settings/FieldRenderer.svelte +19 -15
  28. package/dist/core/Settings/FieldRenderer.svelte.d.ts +12 -25
  29. package/dist/core/Settings/Settings.svelte +48 -29
  30. package/dist/core/Settings/Settings.svelte.d.ts +26 -20
  31. package/dist/core/index.d.ts +1 -0
  32. package/dist/core/index.js +2 -0
  33. package/package.json +15 -11
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { onMount } from 'svelte';
2
+ import { untrack } from 'svelte';
3
3
  import type { SettingsSchema } from './types';
4
4
  import { createSettingsStore } from './store';
5
5
  import FieldRenderer from './FieldRenderer.svelte';
@@ -22,42 +22,61 @@
22
22
  * ```
23
23
  */
24
24
 
25
- /** The settings schema defining all segments and fields */
26
- export let schema: SettingsSchema;
27
-
28
- /** The settings store instance (create externally for access in parent) */
29
- export let settings: ReturnType<typeof createSettingsStore>;
25
+ interface Props {
26
+ /** The settings schema defining all segments and fields */
27
+ schema: SettingsSchema;
28
+ /** The settings store instance (create externally for access in parent) */
29
+ settings: ReturnType<typeof createSettingsStore>;
30
+ /** Optional: Callback when settings change */
31
+ onChange?: ((values: any) => void) | undefined;
32
+ }
30
33
 
31
- /** Optional: Callback when settings change */
32
- export let onChange: ((values: any) => void) | undefined = undefined;
34
+ let { schema, settings, onChange }: Props = $props();
33
35
 
34
36
  // Current values (hierarchical structure: { segment: { field: value } })
35
- let currentValues: Record<string, Record<string, any>> = {};
37
+ let currentValues = $state<Record<string, Record<string, any>>>({});
36
38
 
37
- // Track collapsed state of segments
38
- let collapsedSegments = new Map<string, boolean>();
39
+ // Track collapsed state of segments - using a plain object for better reactivity
40
+ let collapsedSegments = $state<Record<string, boolean>>({});
39
41
 
40
- onMount(() => {
41
- // Initialize collapsed states from schema
42
+ // Initialize collapsed states from schema (derived, not in effect)
43
+ let initialCollapsedStates = $derived.by(() => {
44
+ const states: Record<string, boolean> = {};
42
45
  schema.segments.forEach((segment) => {
43
- collapsedSegments.set(segment.id, segment.collapsed || false);
46
+ states[segment.id] = segment.collapsed || false;
44
47
  });
45
-
46
- // Subscribe to store changes
47
- const unsubscribe = settings.subscribe((values) => {
48
- currentValues = values;
49
- if (onChange) {
50
- onChange(values);
48
+ return states;
49
+ });
50
+
51
+ // One-time initialization of collapsed segments
52
+ $effect(() => {
53
+ // Use untrack to prevent this from re-running when collapsedSegments changes
54
+ untrack(() => {
55
+ if (Object.keys(collapsedSegments).length === 0) {
56
+ collapsedSegments = { ...initialCollapsedStates };
51
57
  }
52
58
  });
59
+ });
60
+
61
+ // Subscribe to store changes - this is necessary for external store integration
62
+ $effect(() => {
63
+ const unsubscribe = settings.subscribe((values) => {
64
+ // Using untrack to avoid circular dependencies
65
+ untrack(() => {
66
+ currentValues = values;
67
+ });
68
+ // Call onChange outside untrack so it can access reactive state if needed
69
+ onChange?.(values);
70
+ });
53
71
 
54
72
  return unsubscribe;
55
73
  });
56
74
 
57
75
  function toggleSegment(segmentId: string) {
58
- const current = collapsedSegments.get(segmentId) || false;
59
- collapsedSegments.set(segmentId, !current);
60
- collapsedSegments = collapsedSegments; // Trigger reactivity
76
+ collapsedSegments = {
77
+ ...collapsedSegments,
78
+ [segmentId]: !collapsedSegments[segmentId]
79
+ };
61
80
  }
62
81
 
63
82
  function resetSegmentHandler(segmentId: string) {
@@ -90,7 +109,7 @@
90
109
  <small class="text-muted">Schema v{schema.version}</small>
91
110
  {/if}
92
111
  </div>
93
- <button class="btn btn-outline-secondary btn-sm" on:click={resetAll}>
112
+ <button class="btn btn-outline-secondary btn-sm" onclick={resetAll}>
94
113
  Reset All
95
114
  </button>
96
115
  </div>
@@ -117,24 +136,24 @@
117
136
  <div class="d-flex gap-2">
118
137
  <button
119
138
  class="btn btn-sm btn-link text-decoration-none p-0"
120
- on:click={() => resetSegmentHandler(segment.id)}
139
+ onclick={() => resetSegmentHandler(segment.id)}
121
140
  title="Reset to defaults"
122
141
  >
123
142
 
124
143
  </button>
125
144
  <button
126
145
  class="btn btn-sm btn-link text-decoration-none p-0"
127
- on:click={() => toggleSegment(segment.id)}
128
- title={collapsedSegments.get(segment.id) ? 'Expand' : 'Collapse'}
146
+ onclick={() => toggleSegment(segment.id)}
147
+ title={collapsedSegments[segment.id] ? 'Expand' : 'Collapse'}
129
148
  >
130
- {collapsedSegments.get(segment.id) ? '▶' : '▼'}
149
+ {collapsedSegments[segment.id] ? '▶' : '▼'}
131
150
  </button>
132
151
  </div>
133
152
  </div>
134
153
  </div>
135
154
 
136
155
  <!-- Card Body -->
137
- {#if !collapsedSegments.get(segment.id)}
156
+ {#if !collapsedSegments[segment.id]}
138
157
  <div class="card-body">
139
158
  {#each segment.fields as field (field.id)}
140
159
  {#if isFieldVisible(field, segment.id)}
@@ -1,24 +1,30 @@
1
1
  import type { SettingsSchema } from './types';
2
2
  import { createSettingsStore } from './store';
3
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
4
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
5
- $$bindings?: Bindings;
6
- } & Exports;
7
- (internal: unknown, props: Props & {
8
- $$events?: Events;
9
- $$slots?: Slots;
10
- }): Exports & {
11
- $set?: any;
12
- $on?: any;
13
- };
14
- z_$$bindings?: Bindings;
3
+ /**
4
+ * Settings Component
5
+ *
6
+ * Reusable settings panel that accepts a schema and renders
7
+ * a data-driven UI with automatic persistence.
8
+ * Provides hierarchical access: $settings.segment.field
9
+ *
10
+ * @example
11
+ * ```svelte
12
+ * const settings = createSettingsStore(mySchema, 'myApp');
13
+ * <Settings schema={mySchema} {settings} />
14
+ *
15
+ * // Access settings in parent:
16
+ * $settings.appearance.theme
17
+ * $settings.editor.fontSize
18
+ * ```
19
+ */
20
+ interface Props {
21
+ /** The settings schema defining all segments and fields */
22
+ schema: SettingsSchema;
23
+ /** The settings store instance (create externally for access in parent) */
24
+ settings: ReturnType<typeof createSettingsStore>;
25
+ /** Optional: Callback when settings change */
26
+ onChange?: ((values: any) => void) | undefined;
15
27
  }
16
- declare const Settings: $$__sveltets_2_IsomorphicComponent<{
17
- /** The settings schema defining all segments and fields */ schema: SettingsSchema;
18
- /** The settings store instance (create externally for access in parent) */ settings: ReturnType<typeof createSettingsStore>;
19
- /** Optional: Callback when settings change */ onChange?: ((values: any) => void) | undefined;
20
- }, {
21
- [evt: string]: CustomEvent<any>;
22
- }, {}, {}, string>;
23
- type Settings = InstanceType<typeof Settings>;
28
+ declare const Settings: import("svelte").Component<Props, {}, "">;
29
+ type Settings = ReturnType<typeof Settings>;
24
30
  export default Settings;
@@ -3,3 +3,4 @@ export * from './Charts/index.js';
3
3
  export * from './TreeView/index.js';
4
4
  export * from './Settings/index.js';
5
5
  export * from './logger/index.js';
6
+ export * from './Map/index.js';
@@ -10,3 +10,5 @@ export * from './TreeView/index.js';
10
10
  export * from './Settings/index.js';
11
11
  // Logger utility for debugging and monitoring
12
12
  export * from './logger/index.js';
13
+ // Map component - Mapbox GL + Deck.GL integration
14
+ export * from './Map/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartnet360/svelte-components",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -32,22 +32,27 @@
32
32
  }
33
33
  },
34
34
  "peerDependencies": {
35
- "plotly.js-dist-min": "^3.1.0",
36
- "svelte": "^5.0.0",
37
35
  "bootstrap": "^5.2.3",
38
- "dexie": "^4.0.11"
36
+ "dexie": "^4.0.11",
37
+ "plotly.js-dist-min": "^3.1.0",
38
+ "svelte": "^5.0.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@eslint/compat": "^1.2.5",
42
42
  "@eslint/js": "^9.18.0",
43
43
  "@sveltejs/adapter-auto": "^6.0.0",
44
+ "@sveltejs/adapter-static": "^3.0.9",
44
45
  "@sveltejs/kit": "^2.22.0",
45
46
  "@sveltejs/package": "^2.0.0",
46
47
  "@sveltejs/vite-plugin-svelte": "^6.0.0",
48
+ "bootstrap": "^5.2.3",
49
+ "bootstrap-icons": "^1.13.1",
50
+ "dexie": "^4.0.11",
47
51
  "eslint": "^9.18.0",
48
52
  "eslint-config-prettier": "^10.0.1",
49
53
  "eslint-plugin-svelte": "^3.0.0",
50
54
  "globals": "^16.0.0",
55
+ "plotly.js-dist-min": "^3.1.0",
51
56
  "prettier": "^3.4.2",
52
57
  "prettier-plugin-svelte": "^3.3.3",
53
58
  "publint": "^0.3.2",
@@ -56,15 +61,14 @@
56
61
  "svelte-check": "^4.0.0",
57
62
  "typescript": "^5.0.0",
58
63
  "typescript-eslint": "^8.20.0",
59
- "vite": "^7.0.4",
60
- "@sveltejs/adapter-static": "^3.0.9",
61
- "bootstrap": "^5.2.3",
62
- "bootstrap-icons": "^1.13.1",
63
- "dexie": "^4.0.11",
64
- "plotly.js-dist-min": "^3.1.0"
64
+ "vite": "^7.0.4"
65
65
  },
66
66
  "keywords": [
67
67
  "svelte"
68
68
  ],
69
- "dependencies": {}
69
+ "dependencies": {
70
+ "@turf/turf": "^7.2.0",
71
+ "deck.gl": "^9.2.2",
72
+ "mapbox-gl": "^3.15.0"
73
+ }
70
74
  }