@shotleybuilder/svelte-table-kit 0.1.0
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/LICENSE +21 -0
- package/README.md +247 -0
- package/dist/TableKit.svelte +838 -0
- package/dist/TableKit.svelte.d.ts +31 -0
- package/dist/components/FilterBar.svelte +291 -0
- package/dist/components/FilterBar.svelte.d.ts +24 -0
- package/dist/components/FilterCondition.svelte +135 -0
- package/dist/components/FilterCondition.svelte.d.ts +23 -0
- package/dist/components/GroupBar.svelte +283 -0
- package/dist/components/GroupBar.svelte.d.ts +21 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +15 -0
- package/dist/presets/index.d.ts +6 -0
- package/dist/presets/index.js +27 -0
- package/dist/stores/persistence.d.ts +58 -0
- package/dist/stores/persistence.js +127 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.js +2 -0
- package/dist/utils/config.d.ts +18 -0
- package/dist/utils/config.js +32 -0
- package/dist/utils/filters.d.ts +21 -0
- package/dist/utils/filters.js +101 -0
- package/dist/utils/formatters.d.ts +16 -0
- package/dist/utils/formatters.js +39 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sertantai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# 🎯 Svelte Table Kit
|
|
2
|
+
|
|
3
|
+
**A comprehensive, AI-configurable data table component for Svelte and SvelteKit, built on TanStack Table v8.**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@sertantai/svelte-table-kit)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
Svelte Table Kit brings Airtable-like functionality to your Svelte applications with a headless, fully customizable table component. Perfect for dashboards, data grids, and complex data visualization needs.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ✨ Features
|
|
13
|
+
|
|
14
|
+
**Core Table Features:**
|
|
15
|
+
- 🎯 Column visibility picker with show/hide controls
|
|
16
|
+
- 📏 Column resizing with drag handles
|
|
17
|
+
- 🔄 Column reordering via native HTML5 drag & drop
|
|
18
|
+
- 🔍 **Advanced filtering** - 12 operators with AND/OR logic
|
|
19
|
+
- 📊 **Multi-level grouping** - Up to 3 nested levels (like Airtable)
|
|
20
|
+
- ⬆️ Multi-column sorting with visual indicators
|
|
21
|
+
- 📄 Pagination with customizable page sizes
|
|
22
|
+
- 💾 LocalStorage persistence for all user preferences
|
|
23
|
+
|
|
24
|
+
**Advanced Filtering:**
|
|
25
|
+
- 12 filter operators: equals, contains, starts with, greater than, etc.
|
|
26
|
+
- AND/OR logic between conditions
|
|
27
|
+
- Collapsible FilterBar UI (space-efficient)
|
|
28
|
+
- Active filter count badge
|
|
29
|
+
- Real-time filtering as you type
|
|
30
|
+
|
|
31
|
+
**Grouping & Hierarchy:**
|
|
32
|
+
- Group by up to 3 columns simultaneously
|
|
33
|
+
- Expand/collapse groups with chevron buttons
|
|
34
|
+
- Visual indentation based on nesting level
|
|
35
|
+
- Item count per group
|
|
36
|
+
- Collapsible GroupBar UI
|
|
37
|
+
|
|
38
|
+
**Developer Experience:**
|
|
39
|
+
- 🎨 Headless design - style it your way
|
|
40
|
+
- 📦 Built on TanStack Table v8 (battle-tested, powerful)
|
|
41
|
+
- 🔒 Full TypeScript support
|
|
42
|
+
- 🎛️ Feature flags for granular control
|
|
43
|
+
- 🚀 Zero external dependencies (except TanStack Table)
|
|
44
|
+
- ♿ Accessible and keyboard-friendly
|
|
45
|
+
|
|
46
|
+
**AI-Ready:**
|
|
47
|
+
- 🤖 JSON-schema driven configuration
|
|
48
|
+
- 🧠 AI agents can generate table configs from natural language
|
|
49
|
+
- 📋 Preset configurations for common use cases
|
|
50
|
+
- 🔧 Programmatic table setup and state management
|
|
51
|
+
|
|
52
|
+
📅 **[View Development Roadmap](./ROADMAP.md)** - See what's coming next!
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 📦 Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install @sertantai/svelte-table-kit
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Or using pnpm:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pnpm add @sertantai/svelte-table-kit
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🚀 Quick Start
|
|
71
|
+
|
|
72
|
+
```svelte
|
|
73
|
+
<script>
|
|
74
|
+
import { TableKit } from '@sertantai/svelte-table-kit';
|
|
75
|
+
|
|
76
|
+
const data = [
|
|
77
|
+
{ id: 1, name: 'Alice', role: 'Developer', age: 28 },
|
|
78
|
+
{ id: 2, name: 'Bob', role: 'Designer', age: 32 },
|
|
79
|
+
{ id: 3, name: 'Charlie', role: 'Manager', age: 45 }
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
const columns = [
|
|
83
|
+
{ accessorKey: 'id', header: 'ID' },
|
|
84
|
+
{ accessorKey: 'name', header: 'Name' },
|
|
85
|
+
{ accessorKey: 'role', header: 'Role' },
|
|
86
|
+
{ accessorKey: 'age', header: 'Age' }
|
|
87
|
+
];
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<TableKit {data} {columns} storageKey="my-table" />
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 📚 Documentation
|
|
96
|
+
|
|
97
|
+
### Basic Usage
|
|
98
|
+
|
|
99
|
+
The simplest way to use TableKit:
|
|
100
|
+
|
|
101
|
+
```svelte
|
|
102
|
+
<TableKit {data} {columns} />
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### With Configuration
|
|
106
|
+
|
|
107
|
+
Use AI-generated or predefined configurations:
|
|
108
|
+
|
|
109
|
+
```svelte
|
|
110
|
+
<script>
|
|
111
|
+
import { TableKit, presets } from '@sertantai/svelte-table-kit';
|
|
112
|
+
|
|
113
|
+
const config = presets.dashboard; // or generate with AI
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<TableKit
|
|
117
|
+
{data}
|
|
118
|
+
{columns}
|
|
119
|
+
{config}
|
|
120
|
+
features={{
|
|
121
|
+
columnVisibility: true,
|
|
122
|
+
filtering: true,
|
|
123
|
+
sorting: true,
|
|
124
|
+
pagination: true
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Feature Flags
|
|
130
|
+
|
|
131
|
+
Control which features are enabled:
|
|
132
|
+
|
|
133
|
+
```svelte
|
|
134
|
+
<TableKit
|
|
135
|
+
{data}
|
|
136
|
+
{columns}
|
|
137
|
+
features={{
|
|
138
|
+
columnVisibility: true,
|
|
139
|
+
columnResizing: true,
|
|
140
|
+
columnReordering: true,
|
|
141
|
+
filtering: true,
|
|
142
|
+
sorting: true,
|
|
143
|
+
pagination: true,
|
|
144
|
+
rowSelection: false,
|
|
145
|
+
grouping: false
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Event Handlers
|
|
151
|
+
|
|
152
|
+
Listen to table events:
|
|
153
|
+
|
|
154
|
+
```svelte
|
|
155
|
+
<TableKit
|
|
156
|
+
{data}
|
|
157
|
+
{columns}
|
|
158
|
+
onRowClick={(row) => console.log('Clicked:', row)}
|
|
159
|
+
onRowSelect={(rows) => console.log('Selected:', rows)}
|
|
160
|
+
onStateChange={(state) => console.log('State:', state)}
|
|
161
|
+
/>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 🎨 Styling
|
|
167
|
+
|
|
168
|
+
TableKit is headless by default. You can:
|
|
169
|
+
|
|
170
|
+
1. **Use default styles** (coming soon)
|
|
171
|
+
2. **Customize with classNames**:
|
|
172
|
+
|
|
173
|
+
```svelte
|
|
174
|
+
<TableKit
|
|
175
|
+
{data}
|
|
176
|
+
{columns}
|
|
177
|
+
classNames={{
|
|
178
|
+
container: 'my-container',
|
|
179
|
+
table: 'my-table',
|
|
180
|
+
th: 'my-header'
|
|
181
|
+
}}
|
|
182
|
+
/>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
3. **Theme support**:
|
|
186
|
+
|
|
187
|
+
```svelte
|
|
188
|
+
<TableKit {data} {columns} theme="dark" />
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 🧬 API Reference
|
|
194
|
+
|
|
195
|
+
### Props
|
|
196
|
+
|
|
197
|
+
| Prop | Type | Default | Description |
|
|
198
|
+
|------|------|---------|-------------|
|
|
199
|
+
| `data` | `T[]` | `[]` | Table data array |
|
|
200
|
+
| `columns` | `ColumnDef<T>[]` | `[]` | Column definitions |
|
|
201
|
+
| `config` | `TableConfig` | `undefined` | AI-generated or preset config |
|
|
202
|
+
| `features` | `TableFeatures` | All enabled | Feature flags |
|
|
203
|
+
| `storageKey` | `string` | `undefined` | LocalStorage key for persistence |
|
|
204
|
+
| `persistState` | `boolean` | `true` | Enable state persistence |
|
|
205
|
+
| `theme` | `'light' \| 'dark' \| 'auto'` | `'light'` | Theme mode |
|
|
206
|
+
| `onRowClick` | `(row: T) => void` | `undefined` | Row click handler |
|
|
207
|
+
| `onRowSelect` | `(rows: T[]) => void` | `undefined` | Row selection handler |
|
|
208
|
+
| `onStateChange` | `(state: TableState) => void` | `undefined` | State change handler |
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## 🎯 Use Cases
|
|
213
|
+
|
|
214
|
+
- Enterprise dashboards and data visualization
|
|
215
|
+
- Admin panels and back-office tools
|
|
216
|
+
- Analytics interfaces with complex filtering
|
|
217
|
+
- Data exploration and reporting tools
|
|
218
|
+
- Any application needing Airtable/Baserow-like table UX
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 🤝 Contributing
|
|
223
|
+
|
|
224
|
+
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) (coming soon).
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## 📄 License
|
|
229
|
+
|
|
230
|
+
MIT © [Sertantai](https://github.com/shotleybuilder)
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 🔗 Links
|
|
235
|
+
|
|
236
|
+
- [GitHub Repository](https://github.com/shotleybuilder/svelte-table-kit)
|
|
237
|
+
- [npm Package](https://www.npmjs.com/package/@sertantai/svelte-table-kit)
|
|
238
|
+
- [Issue Tracker](https://github.com/shotleybuilder/svelte-table-kit/issues)
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 🙏 Acknowledgments
|
|
243
|
+
|
|
244
|
+
Built with:
|
|
245
|
+
- [TanStack Table](https://tanstack.com/table) - Headless table library
|
|
246
|
+
- [Svelte](https://svelte.dev) - Cybernetically enhanced web apps
|
|
247
|
+
- [SvelteKit](https://kit.svelte.dev) - The fastest way to build Svelte apps
|