@smartnet360/svelte-components 0.0.1 → 0.0.3
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/Charts/ChartCard.svelte +204 -0
- package/dist/Charts/ChartCard.svelte.d.ts +11 -0
- package/dist/Charts/ChartComponent.svelte +226 -0
- package/dist/Charts/ChartComponent.svelte.d.ts +12 -0
- package/dist/Charts/adapt.d.ts +37 -0
- package/dist/Charts/adapt.js +192 -0
- package/dist/Charts/charts.model.d.ts +34 -0
- package/dist/Charts/charts.model.js +1 -0
- package/dist/Charts/data-utils.d.ts +13 -0
- package/dist/Charts/data-utils.js +131 -0
- package/dist/Charts/index.d.ts +7 -0
- package/dist/Charts/index.js +4 -0
- package/dist/Charts/plotly.d.ts +4 -0
- package/dist/Desktop/Desktop.svelte +2 -0
- package/dist/Desktop/Desktop.svelte.d.ts +1 -0
- package/dist/Desktop/GridRenderer.svelte +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +7 -4
- package/dist/Desktop/Grid/README.md +0 -331
- package/dist/Desktop/README.md +0 -279
package/dist/Desktop/README.md
DELETED
@@ -1,279 +0,0 @@
|
|
1
|
-
# Desktop Component - Grid Orchestrator
|
2
|
-
|
3
|
-
## Overview
|
4
|
-
|
5
|
-
The **Desktop component** acts as a powerful orchestrator for managing multiple grid layouts within your application. It serves as a launchpad that allows users to create, configure, and switch between different grid-based layouts, each containing various components.
|
6
|
-
|
7
|
-
## Architecture
|
8
|
-
|
9
|
-
### Core Components
|
10
|
-
|
11
|
-
1. **Desktop (Launcher)** - Main orchestrator component
|
12
|
-
2. **Grid Selector** - Configuration interface for creating new grids
|
13
|
-
3. **Grid** - Individual layout engine (implemented in `/Grid/`)
|
14
|
-
|
15
|
-
### How It Works
|
16
|
-
|
17
|
-
```
|
18
|
-
Desktop (Orchestrator)
|
19
|
-
├── Stores multiple grid configurations
|
20
|
-
├── Displays launcher interface
|
21
|
-
└── Manages grid lifecycle
|
22
|
-
|
23
|
-
Grid Selector
|
24
|
-
├── Layout type selection
|
25
|
-
├── Component assignment
|
26
|
-
└── Grid naming
|
27
|
-
|
28
|
-
Grid (Layout Engine)
|
29
|
-
├── Renders chosen layout
|
30
|
-
├── Handles component placement
|
31
|
-
└── Supports resizing & fullscreen
|
32
|
-
```
|
33
|
-
|
34
|
-
## Features
|
35
|
-
|
36
|
-
### ✅ Multi-Grid Management
|
37
|
-
- **Grid Storage**: Persists multiple grid configurations with unique names
|
38
|
-
- **Launcher View**: Visual interface showing all available grids
|
39
|
-
- **Grid Switching**: Seamless switching between different layouts
|
40
|
-
|
41
|
-
### ✅ Grid Creation & Configuration
|
42
|
-
- **Layout Types**: Pre-built options (half-half, half+quarters, etc.)
|
43
|
-
- **Component Assignment**: Drag-and-drop component placement into grid cells
|
44
|
-
- **Custom Naming**: User-defined names for each grid configuration
|
45
|
-
|
46
|
-
### ✅ Reusability & Isolation
|
47
|
-
- **Namespace Support**: App-specific prefixes for data isolation
|
48
|
-
- **Component Injection**: Parent app provides available components
|
49
|
-
- **State Management**: Isolated settings per application instance
|
50
|
-
|
51
|
-
## Usage
|
52
|
-
|
53
|
-
### Basic Setup
|
54
|
-
|
55
|
-
```svelte
|
56
|
-
<script lang="ts">
|
57
|
-
import { Desktop } from '$lib/Desktop/index.js';
|
58
|
-
|
59
|
-
// Available components for grid cells
|
60
|
-
const availableComponents = [
|
61
|
-
{ id: 'chart', name: 'Chart', component: Chart },
|
62
|
-
{ id: 'list', name: 'Task List', component: List },
|
63
|
-
{ id: 'form', name: 'Contact Form', component: Form }
|
64
|
-
];
|
65
|
-
|
66
|
-
// App-specific namespace
|
67
|
-
const namespace = 'myApp-desktop';
|
68
|
-
</script>
|
69
|
-
|
70
|
-
<Desktop {availableComponents} {namespace} />
|
71
|
-
```
|
72
|
-
|
73
|
-
### Component Registration
|
74
|
-
|
75
|
-
```typescript
|
76
|
-
const availableComponents = [
|
77
|
-
{
|
78
|
-
id: 'chart',
|
79
|
-
name: 'Analytics Chart',
|
80
|
-
component: ChartComponent,
|
81
|
-
icon: '📊',
|
82
|
-
description: 'Data visualization component'
|
83
|
-
},
|
84
|
-
{
|
85
|
-
id: 'tasks',
|
86
|
-
name: 'Task Manager',
|
87
|
-
component: TaskListComponent,
|
88
|
-
icon: '✅',
|
89
|
-
description: 'Project task management'
|
90
|
-
}
|
91
|
-
];
|
92
|
-
```
|
93
|
-
|
94
|
-
## Grid Layout Types
|
95
|
-
|
96
|
-
### Built-in Layouts
|
97
|
-
|
98
|
-
1. **Half-Half** - Two equal vertical sections
|
99
|
-
2. **Half+Quarters** - Left half + right stacked quarters
|
100
|
-
3. **Quarters+Half** - Left stacked quarters + right half
|
101
|
-
4. **All-Quarters** - Four equal quadrants
|
102
|
-
|
103
|
-
### Custom Layouts
|
104
|
-
|
105
|
-
The system supports extending with custom layout types by implementing the Grid interface.
|
106
|
-
|
107
|
-
## Data Management
|
108
|
-
|
109
|
-
### Namespace Isolation
|
110
|
-
|
111
|
-
```typescript
|
112
|
-
// Each app gets its own data space
|
113
|
-
const namespace = 'myApp-desktop';
|
114
|
-
|
115
|
-
// Data is stored as:
|
116
|
-
// myApp-desktop:grids
|
117
|
-
// myApp-desktop:settings
|
118
|
-
// myApp-desktop:layouts
|
119
|
-
```
|
120
|
-
|
121
|
-
### Grid Configuration Storage
|
122
|
-
|
123
|
-
```json
|
124
|
-
{
|
125
|
-
"id": "dashboard-grid",
|
126
|
-
"name": "Main Dashboard",
|
127
|
-
"layout": "half-quarters",
|
128
|
-
"components": {
|
129
|
-
"top-left": "chart",
|
130
|
-
"bottom-left": "tasks",
|
131
|
-
"top-right": "form",
|
132
|
-
"bottom-right": "text"
|
133
|
-
},
|
134
|
-
"created": "2025-01-15T10:30:00Z"
|
135
|
-
}
|
136
|
-
```
|
137
|
-
|
138
|
-
## API Reference
|
139
|
-
|
140
|
-
### Desktop Props
|
141
|
-
|
142
|
-
| Prop | Type | Required | Description |
|
143
|
-
|------|------|----------|-------------|
|
144
|
-
| `availableComponents` | `ComponentConfig[]` | ✅ | Components available for grid cells |
|
145
|
-
| `namespace` | `string` | ✅ | App-specific identifier for data isolation |
|
146
|
-
| `theme` | `string` | ❌ | Visual theme ('light', 'dark', 'auto') |
|
147
|
-
| `maxGrids` | `number` | ❌ | Maximum number of grids (default: 10) |
|
148
|
-
|
149
|
-
### ComponentConfig Interface
|
150
|
-
|
151
|
-
```typescript
|
152
|
-
interface ComponentConfig {
|
153
|
-
id: string; // Unique identifier
|
154
|
-
name: string; // Display name
|
155
|
-
component: any; // Svelte component
|
156
|
-
icon?: string; // Icon emoji or URL
|
157
|
-
description?: string; // Help text
|
158
|
-
category?: string; // Grouping category
|
159
|
-
}
|
160
|
-
```
|
161
|
-
|
162
|
-
## Integration Examples
|
163
|
-
|
164
|
-
### With SvelteKit
|
165
|
-
|
166
|
-
```svelte
|
167
|
-
<!-- +page.svelte -->
|
168
|
-
<script lang="ts">
|
169
|
-
import { Desktop } from '$lib/Desktop/index.js';
|
170
|
-
import { Chart, List, Form } from '$lib/components/index.js';
|
171
|
-
|
172
|
-
const components = [
|
173
|
-
{ id: 'chart', name: 'Chart', component: Chart },
|
174
|
-
{ id: 'list', name: 'List', component: List },
|
175
|
-
{ id: 'form', name: 'Form', component: Form }
|
176
|
-
];
|
177
|
-
</script>
|
178
|
-
|
179
|
-
<svelte:head>
|
180
|
-
<title>My App - Desktop</title>
|
181
|
-
</svelte:head>
|
182
|
-
|
183
|
-
<Desktop {components} namespace="my-svelte-app" />
|
184
|
-
```
|
185
|
-
|
186
|
-
### With Custom Components
|
187
|
-
|
188
|
-
```svelte
|
189
|
-
<script lang="ts">
|
190
|
-
import { Desktop } from '$lib/Desktop/index.js';
|
191
|
-
import CustomChart from './components/CustomChart.svelte';
|
192
|
-
import UserProfile from './components/UserProfile.svelte';
|
193
|
-
|
194
|
-
const components = [
|
195
|
-
{
|
196
|
-
id: 'custom-chart',
|
197
|
-
name: 'Custom Analytics',
|
198
|
-
component: CustomChart,
|
199
|
-
icon: '📈',
|
200
|
-
category: 'Analytics'
|
201
|
-
},
|
202
|
-
{
|
203
|
-
id: 'user-profile',
|
204
|
-
name: 'User Profile',
|
205
|
-
component: UserProfile,
|
206
|
-
icon: '👤',
|
207
|
-
category: 'User Management'
|
208
|
-
}
|
209
|
-
];
|
210
|
-
</script>
|
211
|
-
|
212
|
-
<Desktop {components} namespace="enterprise-app" />
|
213
|
-
```
|
214
|
-
|
215
|
-
## Current Implementation Status
|
216
|
-
|
217
|
-
### ✅ Completed Features
|
218
|
-
- Grid layout engine with resizing
|
219
|
-
- Component assignment system
|
220
|
-
- Basic launcher interface
|
221
|
-
- Namespace-based data isolation
|
222
|
-
|
223
|
-
### 🔄 In Development
|
224
|
-
- Visual grid selector interface
|
225
|
-
- Drag-and-drop component assignment
|
226
|
-
- Grid naming and management
|
227
|
-
- Advanced layout customization
|
228
|
-
|
229
|
-
### 📋 Planned Features
|
230
|
-
- Grid templates and presets
|
231
|
-
- Component marketplace
|
232
|
-
- Grid sharing and export
|
233
|
-
- Advanced theming options
|
234
|
-
|
235
|
-
## Best Practices
|
236
|
-
|
237
|
-
### Component Design
|
238
|
-
- **Keep components focused** - Each component should have a single responsibility
|
239
|
-
- **Handle resize events** - Components should respond to container size changes
|
240
|
-
- **Use consistent APIs** - Follow established prop and event patterns
|
241
|
-
|
242
|
-
### Performance
|
243
|
-
- **Lazy loading** - Load components only when needed
|
244
|
-
- **Memoization** - Cache expensive computations
|
245
|
-
- **Virtual scrolling** - For large component lists
|
246
|
-
|
247
|
-
### User Experience
|
248
|
-
- **Clear naming** - Use descriptive names for grids and components
|
249
|
-
- **Visual feedback** - Show loading states and transitions
|
250
|
-
- **Error handling** - Graceful fallbacks for missing components
|
251
|
-
|
252
|
-
## Troubleshooting
|
253
|
-
|
254
|
-
### Common Issues
|
255
|
-
|
256
|
-
**Components not loading**
|
257
|
-
- Check component registration in `availableComponents`
|
258
|
-
- Verify component exports and imports
|
259
|
-
|
260
|
-
**Grid configurations not saving**
|
261
|
-
- Ensure namespace is properly set
|
262
|
-
- Check browser storage permissions
|
263
|
-
|
264
|
-
**Layout not responsive**
|
265
|
-
- Verify Grid component implementation
|
266
|
-
- Check CSS Grid support in target browsers
|
267
|
-
|
268
|
-
## Contributing
|
269
|
-
|
270
|
-
When adding new features:
|
271
|
-
|
272
|
-
1. **Follow the orchestrator pattern** - Desktop manages, Grid renders
|
273
|
-
2. **Maintain namespace isolation** - All data operations use the provided namespace
|
274
|
-
3. **Test component compatibility** - Ensure new components work with the Grid system
|
275
|
-
4. **Update documentation** - Keep README and API docs current
|
276
|
-
|
277
|
-
---
|
278
|
-
|
279
|
-
**Is this clear enough?** The Desktop component acts as an orchestrator that manages multiple Grid instances, providing a launcher interface for users to create, configure, and switch between different grid layouts. Each grid can contain different components arranged in various layout patterns, with all configurations isolated by namespace for multi-app reusability.
|