@smartnet360/svelte-components 0.0.1-beta.2

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 (39) hide show
  1. package/dist/Desktop/Desktop.svelte +423 -0
  2. package/dist/Desktop/Desktop.svelte.d.ts +26 -0
  3. package/dist/Desktop/Grid/Half.svelte +50 -0
  4. package/dist/Desktop/Grid/Half.svelte.d.ts +29 -0
  5. package/dist/Desktop/Grid/Quarter.svelte +103 -0
  6. package/dist/Desktop/Grid/Quarter.svelte.d.ts +27 -0
  7. package/dist/Desktop/Grid/README.md +331 -0
  8. package/dist/Desktop/Grid/ResizeHandle.svelte +118 -0
  9. package/dist/Desktop/Grid/ResizeHandle.svelte.d.ts +23 -0
  10. package/dist/Desktop/Grid/index.d.ts +4 -0
  11. package/dist/Desktop/Grid/index.js +4 -0
  12. package/dist/Desktop/Grid/resizeStore.d.ts +16 -0
  13. package/dist/Desktop/Grid/resizeStore.js +39 -0
  14. package/dist/Desktop/GridRenderer.svelte +328 -0
  15. package/dist/Desktop/GridRenderer.svelte.d.ts +25 -0
  16. package/dist/Desktop/GridSelector/ComponentPalette.svelte +243 -0
  17. package/dist/Desktop/GridSelector/ComponentPalette.svelte.d.ts +27 -0
  18. package/dist/Desktop/GridSelector/ConfigurationPanel.svelte +242 -0
  19. package/dist/Desktop/GridSelector/ConfigurationPanel.svelte.d.ts +28 -0
  20. package/dist/Desktop/GridSelector/GridSelector.svelte +232 -0
  21. package/dist/Desktop/GridSelector/GridSelector.svelte.d.ts +43 -0
  22. package/dist/Desktop/GridSelector/LayoutPicker.svelte +241 -0
  23. package/dist/Desktop/GridSelector/LayoutPicker.svelte.d.ts +28 -0
  24. package/dist/Desktop/GridSelector/LayoutPreview.svelte +309 -0
  25. package/dist/Desktop/GridSelector/LayoutPreview.svelte.d.ts +32 -0
  26. package/dist/Desktop/GridSelector/index.d.ts +4 -0
  27. package/dist/Desktop/GridSelector/index.js +4 -0
  28. package/dist/Desktop/GridViewer.svelte +125 -0
  29. package/dist/Desktop/GridViewer.svelte.d.ts +21 -0
  30. package/dist/Desktop/README.md +279 -0
  31. package/dist/Desktop/gridLayouts.d.ts +76 -0
  32. package/dist/Desktop/gridLayouts.js +351 -0
  33. package/dist/Desktop/index.d.ts +7 -0
  34. package/dist/Desktop/index.js +7 -0
  35. package/dist/Desktop/launchHelpers.d.ts +25 -0
  36. package/dist/Desktop/launchHelpers.js +77 -0
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.js +1 -0
  39. package/package.json +65 -0
@@ -0,0 +1,242 @@
1
+
2
+
3
+ <script lang="ts">
4
+ /**
5
+ * Configuration Panel Component
6
+ *
7
+ * Provides the form for naming the grid and save/cancel actions.
8
+ * Shows validation errors and completion status.
9
+ */
10
+ import { createEventDispatcher } from 'svelte';
11
+
12
+ export let gridName: string = '';
13
+ export let isValid: boolean = false;
14
+ export let validationErrors: string[] = [];
15
+
16
+ const dispatch = createEventDispatcher<{
17
+ nameChanged: { name: string };
18
+ save: void;
19
+ cancel: void;
20
+ }>();
21
+
22
+ let nameInput: HTMLInputElement;
23
+
24
+ function handleNameInput(event: Event) {
25
+ const target = event.target as HTMLInputElement;
26
+ dispatch('nameChanged', { name: target.value });
27
+ }
28
+
29
+ function handleSave() {
30
+ if (isValid) {
31
+ dispatch('save');
32
+ }
33
+ }
34
+
35
+ function handleCancel() {
36
+ dispatch('cancel');
37
+ }
38
+
39
+ function handleKeydown(event: KeyboardEvent) {
40
+ if (event.key === 'Enter' && isValid) {
41
+ handleSave();
42
+ } else if (event.key === 'Escape') {
43
+ handleCancel();
44
+ }
45
+ }
46
+ </script>
47
+
48
+ <div class="configuration-panel p-3">
49
+ <div class="row align-items-center">
50
+ <!-- Grid Name Input -->
51
+ <div class="col-md-6">
52
+ <div class="form-group mb-0">
53
+ <label for="gridName" class="form-label mb-1">
54
+ <span class="step-number badge bg-primary me-2">3</span>
55
+ <strong>Grid Name</strong>
56
+ </label>
57
+ <input
58
+ bind:this={nameInput}
59
+ type="text"
60
+ id="gridName"
61
+ class="form-control"
62
+ class:is-invalid={validationErrors.some(e => e.includes('name'))}
63
+ placeholder="Enter grid name..."
64
+ bind:value={gridName}
65
+ on:input={handleNameInput}
66
+ on:keydown={handleKeydown}
67
+ maxlength="50"
68
+ />
69
+ {#if validationErrors.some(e => e.includes('name'))}
70
+ <div class="invalid-feedback">
71
+ {validationErrors.find(e => e.includes('name'))}
72
+ </div>
73
+ {/if}
74
+ </div>
75
+ </div>
76
+
77
+ <!-- Validation Status -->
78
+ <div class="col-md-3">
79
+ <div class="validation-status">
80
+ {#if validationErrors.length > 0}
81
+ <div class="status-indicator text-warning">
82
+ <i class="bi bi-exclamation-triangle me-1"></i>
83
+ <small>
84
+ {validationErrors.length} issue{validationErrors.length !== 1 ? 's' : ''} remaining
85
+ </small>
86
+ </div>
87
+ <div class="validation-errors mt-1">
88
+ {#each validationErrors as error}
89
+ <div class="text-danger small">
90
+ <i class="bi bi-x me-1"></i>
91
+ {error}
92
+ </div>
93
+ {/each}
94
+ </div>
95
+ {:else if gridName.trim()}
96
+ <div class="status-indicator text-success">
97
+ <i class="bi bi-check-circle me-1"></i>
98
+ <small>Ready to create</small>
99
+ </div>
100
+ {/if}
101
+ </div>
102
+ </div>
103
+
104
+ <!-- Action Buttons -->
105
+ <div class="col-md-3 text-end">
106
+ <div class="btn-group">
107
+ <button
108
+ type="button"
109
+ class="btn btn-outline-secondary"
110
+ on:click={handleCancel}
111
+ >
112
+ Cancel
113
+ </button>
114
+ <button
115
+ type="button"
116
+ class="btn btn-primary"
117
+ class:disabled={!isValid}
118
+ disabled={!isValid}
119
+ on:click={handleSave}
120
+ >
121
+ <i class="fas fa-save me-1"></i>
122
+ Create Grid
123
+ </button>
124
+ </div>
125
+ </div>
126
+ </div>
127
+
128
+ </div>
129
+
130
+ <style>
131
+ .configuration-panel {
132
+ background: #f8f9fa;
133
+ border-top: 1px solid #dee2e6;
134
+ min-height: 120px;
135
+ }
136
+
137
+ .validation-status {
138
+ min-height: 60px;
139
+ }
140
+
141
+ .status-indicator {
142
+ font-weight: 500;
143
+ display: flex;
144
+ align-items: center;
145
+ }
146
+
147
+ .validation-errors {
148
+ max-height: 80px;
149
+ overflow-y: auto;
150
+ }
151
+
152
+ .btn.disabled {
153
+ pointer-events: none;
154
+ opacity: 0.5;
155
+ }
156
+
157
+ /* Ensure form controls have proper spacing */
158
+ .form-group {
159
+ margin-bottom: 0;
160
+ }
161
+
162
+ .form-label {
163
+ font-size: 14px;
164
+ font-weight: 500;
165
+ color: #495057;
166
+ }
167
+
168
+ .form-control {
169
+ font-size: 14px;
170
+ }
171
+
172
+ .form-control:focus {
173
+ border-color: #007bff;
174
+ box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
175
+ }
176
+
177
+ /* Dark theme support */
178
+ :global(.theme-dark) .configuration-panel {
179
+ background: #2d2d2d;
180
+ border-color: #555;
181
+ color: #fff;
182
+ }
183
+
184
+ :global(.theme-dark) .form-label {
185
+ color: #fff;
186
+ }
187
+
188
+ :global(.theme-dark) .form-control {
189
+ background: #3d3d3d;
190
+ border-color: #555;
191
+ color: #fff;
192
+ }
193
+
194
+ :global(.theme-dark) .form-control:focus {
195
+ border-color: #4dabf7;
196
+ box-shadow: 0 0 0 0.2rem rgba(77, 171, 247, 0.25);
197
+ }
198
+
199
+ :global(.theme-dark) .btn-outline-secondary {
200
+ border-color: #6c757d;
201
+ color: #6c757d;
202
+ }
203
+
204
+ :global(.theme-dark) .btn-outline-secondary:hover {
205
+ background: #6c757d;
206
+ color: #fff;
207
+ }
208
+
209
+ /* Custom scrollbar for validation errors */
210
+ .validation-errors::-webkit-scrollbar {
211
+ width: 4px;
212
+ }
213
+
214
+ .validation-errors::-webkit-scrollbar-track {
215
+ background: #f1f1f1;
216
+ }
217
+
218
+ .validation-errors::-webkit-scrollbar-thumb {
219
+ background: #c1c1c1;
220
+ border-radius: 2px;
221
+ }
222
+
223
+ /* Responsive adjustments */
224
+ @media (max-width: 768px) {
225
+ .configuration-panel .row {
226
+ flex-direction: column;
227
+ gap: 1rem;
228
+ }
229
+
230
+ .col-md-3.text-end {
231
+ text-align: center !important;
232
+ }
233
+
234
+ .btn-group {
235
+ width: 100%;
236
+ }
237
+
238
+ .btn-group .btn {
239
+ flex: 1;
240
+ }
241
+ }
242
+ </style>
@@ -0,0 +1,28 @@
1
+ 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> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const ConfigurationPanel: $$__sveltets_2_IsomorphicComponent<{
15
+ gridName?: string;
16
+ isValid?: boolean;
17
+ validationErrors?: string[];
18
+ }, {
19
+ nameChanged: CustomEvent<{
20
+ name: string;
21
+ }>;
22
+ save: CustomEvent<void>;
23
+ cancel: CustomEvent<void>;
24
+ } & {
25
+ [evt: string]: CustomEvent<any>;
26
+ }, {}, {}, string>;
27
+ type ConfigurationPanel = InstanceType<typeof ConfigurationPanel>;
28
+ export default ConfigurationPanel;
@@ -0,0 +1,232 @@
1
+
2
+
3
+ <script context="module" lang="ts">
4
+ /**
5
+ * Grid Selector Component
6
+ *
7
+ * Visual interface for creating new grid configurations by:
8
+ * 1. Selecting a layout type from available options
9
+ * 2. Assigning components to grid slots via drag & drop
10
+ * 3. Naming and saving the grid configuration
11
+ */
12
+ // Component configuration interface
13
+ export interface ComponentConfig {
14
+ id: string;
15
+ name: string;
16
+ component: any;
17
+ icon?: string;
18
+ description?: string;
19
+ category?: string;
20
+ }
21
+ </script>
22
+
23
+ <script lang="ts">
24
+ import { createEventDispatcher } from 'svelte';
25
+ import {
26
+ getAllLayouts,
27
+ getLayoutsByCategory,
28
+ validateComponentAssignments,
29
+ createGridConfiguration,
30
+ type GridLayoutDefinition,
31
+ type ComponentAssignment,
32
+ type GridConfiguration
33
+ } from '../gridLayouts.js';
34
+ import LayoutPicker from './LayoutPicker.svelte';
35
+ import LayoutPreview from './LayoutPreview.svelte';
36
+ import ConfigurationPanel from './ConfigurationPanel.svelte';
37
+
38
+ // Props
39
+ export let availableComponents: ComponentConfig[] = [];
40
+ export let initialLayout: string = '';
41
+ export let theme: 'light' | 'dark' = 'light';
42
+ export let existingGrid: GridConfiguration | null = null;
43
+
44
+ const dispatch = createEventDispatcher<{
45
+ gridCreated: GridConfiguration;
46
+ cancel: void;
47
+ }>();
48
+
49
+ // State
50
+ let selectedLayoutId: string = initialLayout;
51
+ let selectedLayout: GridLayoutDefinition | null = null;
52
+ let gridName: string = '';
53
+ let componentAssignments: ComponentAssignment[] = [];
54
+ let isValid: boolean = false;
55
+ let validationErrors: string[] = [];
56
+
57
+ // Initialize state from existing grid if provided
58
+ if (existingGrid) {
59
+ selectedLayoutId = existingGrid.layoutId;
60
+ gridName = existingGrid.name;
61
+ componentAssignments = [...existingGrid.componentAssignments];
62
+ }
63
+
64
+ // Reactive updates
65
+ $: selectedLayout = selectedLayoutId ? getAllLayouts().find(l => l.id === selectedLayoutId) || null : null;
66
+ $: {
67
+ if (selectedLayout) {
68
+ const validation = validateComponentAssignments(selectedLayoutId, componentAssignments);
69
+ isValid = validation.isValid && gridName.trim().length > 0;
70
+ validationErrors = [
71
+ ...(gridName.trim().length === 0 ? ['Grid name is required'] : []),
72
+ ...validation.missingSlots.map(slot => `Component required for ${slot}`)
73
+ ];
74
+ } else {
75
+ isValid = false;
76
+ validationErrors = selectedLayoutId ? [] : ['Please select a layout'];
77
+ }
78
+ }
79
+
80
+ // Event handlers
81
+ function handleLayoutSelected(event: CustomEvent<{ layoutId: string }>) {
82
+ selectedLayoutId = event.detail.layoutId;
83
+ // Reset assignments when layout changes
84
+ componentAssignments = [];
85
+ }
86
+
87
+ function handleComponentAssigned(event: CustomEvent<{ slotId: string; componentId: string }>) {
88
+ const { slotId, componentId } = event.detail;
89
+
90
+ // Remove any existing assignment for this slot
91
+ componentAssignments = componentAssignments.filter(a => a.slotId !== slotId);
92
+
93
+ // Add new assignment if componentId is provided
94
+ if (componentId) {
95
+ componentAssignments = [...componentAssignments, { slotId, componentId }];
96
+ }
97
+ }
98
+
99
+ function handleComponentRemoved(event: CustomEvent<{ slotId: string }>) {
100
+ const { slotId } = event.detail;
101
+ componentAssignments = componentAssignments.filter(a => a.slotId !== slotId);
102
+ }
103
+
104
+ function handleGridNameChanged(event: CustomEvent<{ name: string }>) {
105
+ gridName = event.detail.name;
106
+ }
107
+
108
+ function handleSave() {
109
+ if (!isValid || !selectedLayout) return;
110
+
111
+ const gridConfig = createGridConfiguration(
112
+ gridName.trim(),
113
+ selectedLayoutId,
114
+ componentAssignments
115
+ );
116
+
117
+ dispatch('gridCreated', gridConfig);
118
+ }
119
+
120
+ function handleCancel() {
121
+ dispatch('cancel');
122
+ }
123
+
124
+ // Get layouts organized by category
125
+ const basicLayouts = getLayoutsByCategory('basic');
126
+ const asymmetricLayouts = getLayoutsByCategory('asymmetric');
127
+ const symmetricLayouts = getLayoutsByCategory('symmetric');
128
+ </script>
129
+
130
+ <div class="grid-selector" class:theme-dark={theme === 'dark'}>
131
+ <div class="container-fluid h-100">
132
+ <div class="row h-100">
133
+ <!-- Left Panel: Layout Selection & Component Palette -->
134
+ <div class="col-md-4 border-end bg-light h-100 d-flex flex-column">
135
+
136
+ <!-- Layout Picker -->
137
+ <div class="flex-grow-1 overflow-auto">
138
+ <LayoutPicker
139
+ {basicLayouts}
140
+ {asymmetricLayouts}
141
+ {symmetricLayouts}
142
+ {selectedLayoutId}
143
+ on:layoutSelected={handleLayoutSelected}
144
+ />
145
+ </div>
146
+ </div>
147
+
148
+ <!-- Right Panel: Preview & Configuration -->
149
+ <div class="col-md-8 h-100 d-flex flex-column">
150
+ <!-- Layout Preview -->
151
+ <div class="flex-grow-1 p-3">
152
+ <LayoutPreview
153
+ {selectedLayout}
154
+ {componentAssignments}
155
+ {availableComponents}
156
+ on:componentAssigned={handleComponentAssigned}
157
+ on:componentRemoved={handleComponentRemoved}
158
+ />
159
+ </div>
160
+
161
+ <!-- Configuration Panel -->
162
+ <div class="flex-shrink-0 border-top">
163
+ <ConfigurationPanel
164
+ {gridName}
165
+ {isValid}
166
+ {validationErrors}
167
+ on:nameChanged={handleGridNameChanged}
168
+ on:save={handleSave}
169
+ on:cancel={handleCancel}
170
+ />
171
+ </div>
172
+ </div>
173
+ </div>
174
+ </div>
175
+ </div>
176
+
177
+ <style>
178
+ .grid-selector {
179
+ height: 100vh;
180
+ background: #fff;
181
+ }
182
+
183
+ .grid-selector.theme-dark {
184
+ background: #1a1a1a;
185
+ color: #fff;
186
+ }
187
+
188
+ .grid-selector.theme-dark .bg-light {
189
+ background: #2d2d2d !important;
190
+ color: #fff;
191
+ }
192
+
193
+ .grid-selector.theme-dark .border-end,
194
+ .grid-selector.theme-dark .border-top {
195
+ border-color: #404040 !important;
196
+ }
197
+
198
+ /* Ensure full height usage */
199
+ .h-100 {
200
+ height: 100% !important;
201
+ }
202
+
203
+ /* Custom scrollbar for component palette */
204
+ .overflow-auto::-webkit-scrollbar {
205
+ width: 6px;
206
+ }
207
+
208
+ .overflow-auto::-webkit-scrollbar-track {
209
+ background: #f1f1f1;
210
+ }
211
+
212
+ .overflow-auto::-webkit-scrollbar-thumb {
213
+ background: #c1c1c1;
214
+ border-radius: 3px;
215
+ }
216
+
217
+ .overflow-auto::-webkit-scrollbar-thumb:hover {
218
+ background: #a8a8a8;
219
+ }
220
+
221
+ .theme-dark .overflow-auto::-webkit-scrollbar-track {
222
+ background: #2d2d2d;
223
+ }
224
+
225
+ .theme-dark .overflow-auto::-webkit-scrollbar-thumb {
226
+ background: #555;
227
+ }
228
+
229
+ .theme-dark .overflow-auto::-webkit-scrollbar-thumb:hover {
230
+ background: #666;
231
+ }
232
+ </style>
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Grid Selector Component
3
+ *
4
+ * Visual interface for creating new grid configurations by:
5
+ * 1. Selecting a layout type from available options
6
+ * 2. Assigning components to grid slots via drag & drop
7
+ * 3. Naming and saving the grid configuration
8
+ */
9
+ export interface ComponentConfig {
10
+ id: string;
11
+ name: string;
12
+ component: any;
13
+ icon?: string;
14
+ description?: string;
15
+ category?: string;
16
+ }
17
+ import { type GridConfiguration } from '../gridLayouts.js';
18
+ 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> {
19
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
20
+ $$bindings?: Bindings;
21
+ } & Exports;
22
+ (internal: unknown, props: Props & {
23
+ $$events?: Events;
24
+ $$slots?: Slots;
25
+ }): Exports & {
26
+ $set?: any;
27
+ $on?: any;
28
+ };
29
+ z_$$bindings?: Bindings;
30
+ }
31
+ declare const GridSelector: $$__sveltets_2_IsomorphicComponent<{
32
+ availableComponents?: ComponentConfig[];
33
+ initialLayout?: string;
34
+ theme?: "light" | "dark";
35
+ existingGrid?: GridConfiguration | null;
36
+ }, {
37
+ gridCreated: CustomEvent<GridConfiguration>;
38
+ cancel: CustomEvent<void>;
39
+ } & {
40
+ [evt: string]: CustomEvent<any>;
41
+ }, {}, {}, string>;
42
+ type GridSelector = InstanceType<typeof GridSelector>;
43
+ export default GridSelector;