@keenmate/svelte-treeview 5.0.0-rc08 → 5.0.0-rc09
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/CHANGELOG.md +41 -0
- package/README.md +33 -23
- package/ai/basic-setup.txt +336 -339
- package/ai/import-patterns.txt +290 -271
- package/ai/styling-theming.txt +355 -354
- package/component-variables.manifest.json +142 -0
- package/dist/components/Node.svelte +36 -26
- package/dist/components/Tree.svelte +49 -1
- package/dist/components/Tree.svelte.d.ts +36 -3
- package/dist/constants.generated.d.ts +1 -1
- package/dist/constants.generated.js +1 -1
- package/dist/core/TreeController.svelte.d.ts +45 -4
- package/dist/core/TreeController.svelte.js +270 -69
- package/dist/index.d.ts +1 -1
- package/dist/ltree/ltree.svelte.d.ts +1 -1
- package/dist/ltree/ltree.svelte.js +28 -7
- package/dist/ltree/types.d.ts +4 -0
- package/dist/styles/_base.css +41 -0
- package/dist/styles/_checkbox.css +83 -0
- package/dist/styles/_context-menu.css +134 -0
- package/dist/styles/_debug.css +45 -0
- package/dist/styles/_drag-drop.css +174 -0
- package/dist/styles/_drop-zones.css +270 -0
- package/dist/styles/_loading.css +40 -0
- package/dist/styles/_node.css +60 -0
- package/dist/styles/_states.css +92 -0
- package/dist/styles/_toggle-icons.css +97 -0
- package/dist/styles/_variables.css +189 -0
- package/dist/styles/main.css +37 -0
- package/dist/styles.css +651 -470
- package/package.json +103 -102
- package/dist/styles/main.scss +0 -1074
- package/dist/styles.css.map +0 -1
- package/dist/styles.scss +0 -2
package/ai/basic-setup.txt
CHANGED
|
@@ -1,339 +1,336 @@
|
|
|
1
|
-
BASIC SETUP
|
|
2
|
-
===========
|
|
3
|
-
|
|
4
|
-
CRITICAL: This is a Svelte 5 component using runes
|
|
5
|
-
- Requires Svelte 5.0.0 or higher
|
|
6
|
-
- Uses $state, $derived, $effect runes
|
|
7
|
-
- NOT compatible with Svelte 4 or earlier
|
|
8
|
-
- Works with SvelteKit, Vite, or any Svelte 5 setup
|
|
9
|
-
|
|
10
|
-
INSTALLATION
|
|
11
|
-
------------
|
|
12
|
-
npm install @keenmate/svelte-treeview
|
|
13
|
-
|
|
14
|
-
# Or yarn
|
|
15
|
-
yarn add @keenmate/svelte-treeview
|
|
16
|
-
|
|
17
|
-
# Or pnpm
|
|
18
|
-
pnpm add @keenmate/svelte-treeview
|
|
19
|
-
|
|
20
|
-
IMPORT STYLES
|
|
21
|
-
-------------
|
|
22
|
-
The component requires CSS to display correctly:
|
|
23
|
-
|
|
24
|
-
// In your main.js/main.ts or +layout.svelte
|
|
25
|
-
import '@keenmate/svelte-treeview/styles.css';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{ id: '
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
<
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
/>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
</
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
console.log('
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
-
|
|
221
|
-
-
|
|
222
|
-
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
✅
|
|
323
|
-
✅ Use
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
❌ Don't use
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
-
|
|
336
|
-
-
|
|
337
|
-
- Add search → search-features.txt
|
|
338
|
-
- Add context menu → context-menu.txt
|
|
339
|
-
- Optimize performance → performance.txt
|
|
1
|
+
BASIC SETUP
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
CRITICAL: This is a Svelte 5 component using runes
|
|
5
|
+
- Requires Svelte 5.0.0 or higher
|
|
6
|
+
- Uses $state, $derived, $effect runes
|
|
7
|
+
- NOT compatible with Svelte 4 or earlier
|
|
8
|
+
- Works with SvelteKit, Vite, or any Svelte 5 setup
|
|
9
|
+
|
|
10
|
+
INSTALLATION
|
|
11
|
+
------------
|
|
12
|
+
npm install @keenmate/svelte-treeview
|
|
13
|
+
|
|
14
|
+
# Or yarn
|
|
15
|
+
yarn add @keenmate/svelte-treeview
|
|
16
|
+
|
|
17
|
+
# Or pnpm
|
|
18
|
+
pnpm add @keenmate/svelte-treeview
|
|
19
|
+
|
|
20
|
+
IMPORT STYLES
|
|
21
|
+
-------------
|
|
22
|
+
The component requires CSS to display correctly:
|
|
23
|
+
|
|
24
|
+
// In your main.js/main.ts or +layout.svelte
|
|
25
|
+
import '@keenmate/svelte-treeview/styles.css';
|
|
26
|
+
|
|
27
|
+
MINIMAL EXAMPLE
|
|
28
|
+
---------------
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
import { Tree } from '@keenmate/svelte-treeview';
|
|
31
|
+
|
|
32
|
+
const data = [
|
|
33
|
+
{ id: '1', path: '1', name: 'Documents' },
|
|
34
|
+
{ id: '1.1', path: '1.1', name: 'Projects' },
|
|
35
|
+
{ id: '1.1.1', path: '1.1.1', name: 'Project A' },
|
|
36
|
+
{ id: '2', path: '2', name: 'Pictures' }
|
|
37
|
+
];
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<Tree
|
|
41
|
+
{data}
|
|
42
|
+
idMember="id"
|
|
43
|
+
pathMember="path"
|
|
44
|
+
displayValueMember="name"
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
REQUIRED PROPS
|
|
48
|
+
--------------
|
|
49
|
+
These props are required for the tree to work:
|
|
50
|
+
|
|
51
|
+
| Prop | Type | Description |
|
|
52
|
+
|------|------|-------------|
|
|
53
|
+
| data | T[] | Array of data objects |
|
|
54
|
+
| idMember | string | Property name for unique ID |
|
|
55
|
+
| pathMember | string | Property name for hierarchical path |
|
|
56
|
+
|
|
57
|
+
RECOMMENDED PROPS
|
|
58
|
+
-----------------
|
|
59
|
+
| Prop | Type | Default | Description |
|
|
60
|
+
|------|------|---------|-------------|
|
|
61
|
+
| displayValueMember | string | null | Property for display text |
|
|
62
|
+
| sortCallback | function | built-in | Custom sort function |
|
|
63
|
+
| expandLevel | number | 2 | Auto-expand nodes to this depth |
|
|
64
|
+
|
|
65
|
+
PATH STRUCTURE
|
|
66
|
+
--------------
|
|
67
|
+
CRITICAL: Data must use path-based hierarchy
|
|
68
|
+
|
|
69
|
+
The path defines the tree structure:
|
|
70
|
+
- Root level: "1", "2", "3"
|
|
71
|
+
- Second level: "1.1", "1.2", "2.1"
|
|
72
|
+
- Third level: "1.1.1", "1.2.1"
|
|
73
|
+
|
|
74
|
+
Parent path is derived from child path:
|
|
75
|
+
- "1.2.3" → parent is "1.2"
|
|
76
|
+
- "1.2" → parent is "1"
|
|
77
|
+
- "1" → no parent (root)
|
|
78
|
+
|
|
79
|
+
Custom separators:
|
|
80
|
+
<Tree treePathSeparator="/" ... />
|
|
81
|
+
// Paths: "1/2/3", "files/docs/readme"
|
|
82
|
+
|
|
83
|
+
BINDING SELECTED NODE
|
|
84
|
+
---------------------
|
|
85
|
+
<script>
|
|
86
|
+
let selectedNode = $state(null);
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<Tree
|
|
90
|
+
{data}
|
|
91
|
+
idMember="id"
|
|
92
|
+
pathMember="path"
|
|
93
|
+
bind:focusedNode
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
{#if selectedNode}
|
|
97
|
+
<p>Selected: {selectedNode.data.name}</p>
|
|
98
|
+
{/if}
|
|
99
|
+
|
|
100
|
+
BINDING SEARCH TEXT
|
|
101
|
+
-------------------
|
|
102
|
+
<script>
|
|
103
|
+
let searchText = $state('');
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<input bind:value={searchText} placeholder="Search..." />
|
|
107
|
+
|
|
108
|
+
<Tree
|
|
109
|
+
{data}
|
|
110
|
+
idMember="id"
|
|
111
|
+
pathMember="path"
|
|
112
|
+
bind:searchText
|
|
113
|
+
shouldUseInternalSearchIndex={true}
|
|
114
|
+
searchValueMember="name"
|
|
115
|
+
/>
|
|
116
|
+
|
|
117
|
+
CUSTOM NODE TEMPLATE
|
|
118
|
+
--------------------
|
|
119
|
+
<Tree
|
|
120
|
+
{data}
|
|
121
|
+
idMember="id"
|
|
122
|
+
pathMember="path"
|
|
123
|
+
>
|
|
124
|
+
{#snippet nodeTemplate(node)}
|
|
125
|
+
<div class="custom-node">
|
|
126
|
+
<span class="icon">{node.data.icon}</span>
|
|
127
|
+
<span class="name">{node.data.name}</span>
|
|
128
|
+
{#if node.data.count}
|
|
129
|
+
<span class="badge">{node.data.count}</span>
|
|
130
|
+
{/if}
|
|
131
|
+
</div>
|
|
132
|
+
{/snippet}
|
|
133
|
+
</Tree>
|
|
134
|
+
|
|
135
|
+
IMPORTANT: The snippet name is nodeTemplate (not nodeContent)
|
|
136
|
+
|
|
137
|
+
EXPAND/COLLAPSE CONTROL
|
|
138
|
+
-----------------------
|
|
139
|
+
Control initial expansion:
|
|
140
|
+
|
|
141
|
+
<Tree
|
|
142
|
+
{data}
|
|
143
|
+
expandLevel={3} <!-- Expand first 3 levels -->
|
|
144
|
+
/>
|
|
145
|
+
|
|
146
|
+
Programmatic control:
|
|
147
|
+
|
|
148
|
+
<script>
|
|
149
|
+
let treeRef;
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<Tree bind:this={treeRef} {data} ... />
|
|
153
|
+
|
|
154
|
+
<button onclick={() => treeRef.expandAll()}>Expand All</button>
|
|
155
|
+
<button onclick={() => treeRef.collapseAll()}>Collapse All</button>
|
|
156
|
+
<button onclick={() => treeRef.expandNodes('1.2')}>Expand 1.2</button>
|
|
157
|
+
|
|
158
|
+
CLICK HANDLING
|
|
159
|
+
--------------
|
|
160
|
+
<Tree
|
|
161
|
+
{data}
|
|
162
|
+
idMember="id"
|
|
163
|
+
pathMember="path"
|
|
164
|
+
onNodeClicked={(node) => {
|
|
165
|
+
console.log('Clicked:', node.data.name);
|
|
166
|
+
console.log('Path:', node.path);
|
|
167
|
+
}}
|
|
168
|
+
/>
|
|
169
|
+
|
|
170
|
+
Click behavior (default 'expand-and-focus'):
|
|
171
|
+
<Tree clickBehavior="select" ... />
|
|
172
|
+
<!-- 'select' = click selects, dblclick expands -->
|
|
173
|
+
<!-- 'expand' = click expands only -->
|
|
174
|
+
<!-- 'expand-and-focus' = click selects + expands -->
|
|
175
|
+
|
|
176
|
+
SCROLL TO NODE
|
|
177
|
+
--------------
|
|
178
|
+
<script>
|
|
179
|
+
let treeRef;
|
|
180
|
+
|
|
181
|
+
async function goToNode() {
|
|
182
|
+
await treeRef.scrollToPath('1.2.3', {
|
|
183
|
+
expand: true, // Expand parents first
|
|
184
|
+
highlight: true, // Highlight the node
|
|
185
|
+
containerScroll: true // Scroll only within container
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
</script>
|
|
189
|
+
|
|
190
|
+
<Tree bind:this={treeRef} {data} ... />
|
|
191
|
+
<button onclick={goToNode}>Go to 1.2.3</button>
|
|
192
|
+
|
|
193
|
+
TREE STATISTICS
|
|
194
|
+
---------------
|
|
195
|
+
<script>
|
|
196
|
+
let treeRef;
|
|
197
|
+
|
|
198
|
+
function showStats() {
|
|
199
|
+
const stats = treeRef.statistics;
|
|
200
|
+
console.log('Total nodes:', stats.nodeCount);
|
|
201
|
+
console.log('Max depth:', stats.maxLevel);
|
|
202
|
+
console.log('Filtered:', stats.filteredNodeCount);
|
|
203
|
+
console.log('Indexing:', stats.isIndexing);
|
|
204
|
+
}
|
|
205
|
+
</script>
|
|
206
|
+
|
|
207
|
+
DEBUG MODE
|
|
208
|
+
----------
|
|
209
|
+
Enable debug panel and console logging:
|
|
210
|
+
|
|
211
|
+
<Tree
|
|
212
|
+
{data}
|
|
213
|
+
shouldDisplayDebugInformation={true}
|
|
214
|
+
/>
|
|
215
|
+
|
|
216
|
+
Shows:
|
|
217
|
+
- Tree ID
|
|
218
|
+
- Node count
|
|
219
|
+
- Max depth
|
|
220
|
+
- Filtered count
|
|
221
|
+
- Indexing status
|
|
222
|
+
- Currently dragged node
|
|
223
|
+
|
|
224
|
+
EMPTY STATE
|
|
225
|
+
-----------
|
|
226
|
+
Custom message when tree is empty:
|
|
227
|
+
|
|
228
|
+
<Tree {data} ...>
|
|
229
|
+
{#snippet noDataFound()}
|
|
230
|
+
<div class="empty-state">
|
|
231
|
+
<p>No items found</p>
|
|
232
|
+
<button>Add First Item</button>
|
|
233
|
+
</div>
|
|
234
|
+
{/snippet}
|
|
235
|
+
</Tree>
|
|
236
|
+
|
|
237
|
+
LOADING STATE
|
|
238
|
+
-------------
|
|
239
|
+
Show a loading placeholder while data is being fetched:
|
|
240
|
+
|
|
241
|
+
<Tree {data} isLoading={isLoading}>
|
|
242
|
+
{#snippet loadingPlaceholder()}
|
|
243
|
+
<div class="loading">Loading tree data...</div>
|
|
244
|
+
{/snippet}
|
|
245
|
+
</Tree>
|
|
246
|
+
|
|
247
|
+
DROP PLACEHOLDER
|
|
248
|
+
----------------
|
|
249
|
+
Custom placeholder for empty trees that accept drops:
|
|
250
|
+
|
|
251
|
+
<Tree {data} dragDropMode="both">
|
|
252
|
+
{#snippet dropPlaceholder()}
|
|
253
|
+
<div class="drop-here">Drop items here to start</div>
|
|
254
|
+
{/snippet}
|
|
255
|
+
</Tree>
|
|
256
|
+
|
|
257
|
+
FRAMEWORK INTEGRATION
|
|
258
|
+
---------------------
|
|
259
|
+
SvelteKit:
|
|
260
|
+
// +page.svelte
|
|
261
|
+
<script>
|
|
262
|
+
import { Tree } from '@keenmate/svelte-treeview';
|
|
263
|
+
import '@keenmate/svelte-treeview/styles.css';
|
|
264
|
+
</script>
|
|
265
|
+
|
|
266
|
+
Vite + Svelte:
|
|
267
|
+
// App.svelte
|
|
268
|
+
<script>
|
|
269
|
+
import { Tree } from '@keenmate/svelte-treeview';
|
|
270
|
+
</script>
|
|
271
|
+
|
|
272
|
+
// main.js
|
|
273
|
+
import '@keenmate/svelte-treeview/styles.css';
|
|
274
|
+
|
|
275
|
+
COMMON SETUP PATTERNS
|
|
276
|
+
---------------------
|
|
277
|
+
File explorer:
|
|
278
|
+
<Tree
|
|
279
|
+
{data}
|
|
280
|
+
idMember="id"
|
|
281
|
+
pathMember="path"
|
|
282
|
+
displayValueMember="name"
|
|
283
|
+
expandLevel={1}
|
|
284
|
+
treePathSeparator="/"
|
|
285
|
+
/>
|
|
286
|
+
|
|
287
|
+
Organization tree:
|
|
288
|
+
<Tree
|
|
289
|
+
{data}
|
|
290
|
+
idMember="employeeId"
|
|
291
|
+
pathMember="orgPath"
|
|
292
|
+
displayValueMember="fullName"
|
|
293
|
+
expandLevel={3}
|
|
294
|
+
/>
|
|
295
|
+
|
|
296
|
+
With search and drag-drop:
|
|
297
|
+
<Tree
|
|
298
|
+
{data}
|
|
299
|
+
idMember="id"
|
|
300
|
+
pathMember="path"
|
|
301
|
+
bind:searchText
|
|
302
|
+
shouldUseInternalSearchIndex={true}
|
|
303
|
+
searchValueMember="name"
|
|
304
|
+
dragOverNodeClass="ltree-dragover-glow"
|
|
305
|
+
onNodeDrop={handleDrop}
|
|
306
|
+
/>
|
|
307
|
+
|
|
308
|
+
BROWSER SUPPORT
|
|
309
|
+
---------------
|
|
310
|
+
Requires modern browsers:
|
|
311
|
+
- Chrome/Edge 88+
|
|
312
|
+
- Firefox 78+
|
|
313
|
+
- Safari 14+
|
|
314
|
+
|
|
315
|
+
No IE11 support (Svelte 5 requirement)
|
|
316
|
+
|
|
317
|
+
CRITICAL REMINDERS
|
|
318
|
+
------------------
|
|
319
|
+
✅ Import styles (CSS or SCSS)
|
|
320
|
+
✅ Use Svelte 5.0.0 or higher
|
|
321
|
+
✅ Use path-based hierarchical data
|
|
322
|
+
✅ Set idMember and pathMember
|
|
323
|
+
✅ Use $state.raw() for large datasets (1000+ items)
|
|
324
|
+
|
|
325
|
+
❌ Don't use with Svelte 4 or earlier
|
|
326
|
+
❌ Don't forget to import styles
|
|
327
|
+
❌ Don't use non-path-based data structures
|
|
328
|
+
❌ Don't use $state() for large datasets (causes slowdown)
|
|
329
|
+
|
|
330
|
+
NEXT STEPS
|
|
331
|
+
----------
|
|
332
|
+
- Custom data structure → data-handling.txt
|
|
333
|
+
- Add drag and drop → drag-drop.txt
|
|
334
|
+
- Add search → search-features.txt
|
|
335
|
+
- Add context menu → context-menu.txt
|
|
336
|
+
- Optimize performance → performance.txt
|