@bimetal/tree-svelte-components 0.32.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 ADDED
@@ -0,0 +1,129 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Andreas Biederbeck (https://bimetal.dev)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncommercial Purposes
53
+
54
+ Any noncommercial purpose is a permitted purpose.
55
+
56
+ ## Personal Uses
57
+
58
+ Personal use for research, experiment, and testing for
59
+ the benefit of public knowledge, personal study, private
60
+ entertainment, hobby projects, amateur pursuits, or religious
61
+ observance, without any anticipated commercial application,
62
+ is use for a permitted purpose.
63
+
64
+ ## Noncommercial Organizations
65
+
66
+ Use by any charitable organization, educational institution,
67
+ public research organization, public safety or health
68
+ organization, environmental protection organization,
69
+ or government institution is use for a permitted purpose
70
+ regardless of the source of funding or obligations resulting
71
+ from the funding.
72
+
73
+ ## Fair Use
74
+
75
+ You may have "fair use" rights for the software under the
76
+ law. These terms do not limit them.
77
+
78
+ ## No Other Rights
79
+
80
+ These terms do not allow you to sublicense or transfer any of
81
+ your licenses to anyone else, or prevent the licensor from
82
+ granting licenses to anyone else. These terms do not imply
83
+ any other licenses.
84
+
85
+ ## Patent Defense
86
+
87
+ If you make any written claim that the software infringes or
88
+ contributes to infringement of any patent, your patent license
89
+ for the software granted under these terms ends immediately. If
90
+ your company makes such a claim, your patent license ends
91
+ immediately for work on behalf of your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or any agreement made under them,
97
+ you have 32 calendar days to come into compliance. If you come
98
+ into compliance, your licenses revive and continue as if you had
99
+ never violated.
100
+
101
+ ## No Liability
102
+
103
+ ***As far as the law allows, the software comes as is, without
104
+ any warranty or condition, and the licensor will not be liable
105
+ to you for any damages arising out of these terms or the use
106
+ or nature of the software, under any kind of legal claim.***
107
+
108
+ ## Definitions
109
+
110
+ The **licensor** is the individual or entity offering these
111
+ terms, and the **software** is the software the licensor makes
112
+ available under these terms.
113
+
114
+ **You** refers to the individual or entity agreeing to these
115
+ terms.
116
+
117
+ **Your company** is any legal entity, sole proprietorship,
118
+ or other kind of organization that you work for, plus all
119
+ organizations that have control over, are under the control of,
120
+ or are under common control with that organization. **Control**
121
+ means ownership of substantially all the assets of an entity,
122
+ or the power to direct its management and policies by vote,
123
+ contract, or otherwise. Control can be direct or indirect.
124
+
125
+ **Your licenses** are all the licenses granted to you for the
126
+ software under these terms.
127
+
128
+ **Use** means anything you do with the software requiring one
129
+ of your licenses.
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # @bimetal/tree-svelte-components
2
+
3
+ The default Svelte 5 **tree / treeview** — a thin binding over the canonical
4
+ `@bimetal/tree-headless` controller. Multi-select, expand/collapse, tri-state
5
+ checkboxes, drag-reorder, keyboard nav/move, rename, undo. Renders the canonical
6
+ `.bm-tree*` DOM with ARIA tree roles; styles ship from `@bimetal/tree-themes`.
7
+
8
+ ```
9
+ import { Tree } from '@bimetal/tree-svelte-components';
10
+
11
+ <Tree {store} treeId="docs" config={{ checkboxes: true }} title="Docs" />
12
+ ```
13
+
14
+ Every interaction decision lives in the controller — this binding only forwards DOM
15
+ events and applies `tabindex` from the controller-derived `navAnchor`. A `renderNode`
16
+ slot customizes ONLY the node content cell (icon/label/badge); the chevron, checkbox,
17
+ row structure and ARIA stay component-owned. A consumer who needs full control can
18
+ skip the component and drive `@bimetal/tree-headless` directly.
@@ -0,0 +1,180 @@
1
+ <script lang="ts">
2
+ import { onDestroy, untrack, type Snippet } from 'svelte';
3
+ import { createTreeControllerBinding } from '@bimetal/svelte';
4
+ import type { TreeStore } from '@bimetal/tree-data';
5
+ import type { TreeConfigInput, TreeController, TreeControllerSnapshot, TreeRowView } from '@bimetal/tree-headless';
6
+ import { treeRowIndent, treeCssVars } from '@bimetal/tree-headless';
7
+ import TreeDialog from './TreeDialog.svelte';
8
+ import { isEditableTarget } from '@bimetal/a11y-dom';
9
+
10
+ let {
11
+ controller,
12
+ store,
13
+ treeId,
14
+ config = undefined,
15
+ darkMode = false,
16
+ dir = undefined,
17
+ title = undefined,
18
+ tag = undefined,
19
+ ariaLabel = undefined,
20
+ onError = undefined,
21
+ onSelectionChange = undefined,
22
+ onCheckedChange = undefined,
23
+ renderNode = undefined,
24
+ }: {
25
+ /**
26
+ * BOUND (composition contract, F1): an already-owned controller. The component
27
+ * renders its snapshot and forwards intents — it NEVER creates, destroys, or
28
+ * setConfig it (binding stays null). Pass this OR the standalone props.
29
+ */
30
+ controller?: TreeController;
31
+ store?: TreeStore;
32
+ treeId?: string;
33
+ config?: TreeConfigInput;
34
+ darkMode?: boolean;
35
+ dir?: 'ltr' | 'rtl';
36
+ title?: string;
37
+ tag?: string;
38
+ ariaLabel?: string;
39
+ onError?: (err: unknown) => void;
40
+ /** OBSERVE hook (standalone only): fires when the selection changes (ordered selected node ids). */
41
+ onSelectionChange?: (selectedIds: readonly string[]) => void;
42
+ /** OBSERVE hook (standalone only): the SECOND independent axis — the checkbox
43
+ * axis, not a dedup of selection. Fires when the checked set changes. */
44
+ onCheckedChange?: (checkedIds: readonly string[]) => void;
45
+ /** Replace ONLY a row's content cell (icon/label/badge). */
46
+ renderNode?: Snippet<[TreeRowView]>;
47
+ } = $props();
48
+
49
+ // Dual-API: bound path uses the given controller (binding = null → never
50
+ // created/destroyed/setConfig here); standalone creates one ONCE under `untrack`.
51
+ const binding = untrack(() => (controller ? null : createTreeControllerBinding({ store: store!, treeId: treeId!, config, onError: (err) => onError?.(err), onSelectionChange, onCheckedChange })));
52
+ const ctrl = controller ?? binding!.ctrl;
53
+ // Snapshot store — sourced from `ctrl` so it works for both API halves (both are
54
+ // a `SnapshotSource`); the bound path never touches the owned controller's lifecycle.
55
+ const snapshotStore = { subscribe: (run: (s: TreeControllerSnapshot) => void) => { run(ctrl.getSnapshot()); return ctrl.subscribe(() => run(ctrl.getSnapshot())); } };
56
+
57
+ let listEl: HTMLDivElement | null = $state(null);
58
+ let suppressClick = false;
59
+
60
+ const onKey = (e: KeyboardEvent) =>
61
+ ctrl.handleKeydown({ key: e.key, ctrlKey: e.ctrlKey, metaKey: e.metaKey, shiftKey: e.shiftKey, isEditable: isEditableTarget(e.target), preventDefault: () => e.preventDefault() });
62
+ const onMove = (e: PointerEvent) => {
63
+ if (e.buttons === 0) return;
64
+ const rowEl = (document.elementFromPoint(e.clientX, e.clientY) as HTMLElement | null)?.closest('.bm-tree__row') as HTMLElement | null;
65
+ const id = rowEl?.dataset.nodeId;
66
+ let over: { nodeId: string; rect: { top: number; height: number } } | undefined;
67
+ // Instance-scoped: only accept a hit-test row belonging to THIS tree.
68
+ if (rowEl && id && listEl?.contains(rowEl)) { const r = rowEl.getBoundingClientRect(); over = { nodeId: id, rect: { top: r.top, height: r.height } }; }
69
+ ctrl.pointerMove({ x: e.clientX, y: e.clientY }, e.pointerId, over);
70
+ };
71
+ const onUp = (e: PointerEvent) => { if (ctrl.pointerUp(e.pointerId)) suppressClick = true; };
72
+ const onCancel = (e: PointerEvent) => { ctrl.pointerCancel(e.pointerId); };
73
+ // Global pointer listeners live in an $effect (browser-only, with cleanup) — never
74
+ // at instance-init, so import-time/SSR rendering doesn't touch `window`.
75
+ $effect(() => {
76
+ window.addEventListener('pointermove', onMove);
77
+ window.addEventListener('pointerup', onUp);
78
+ window.addEventListener('pointercancel', onCancel);
79
+ return () => {
80
+ window.removeEventListener('pointermove', onMove);
81
+ window.removeEventListener('pointerup', onUp);
82
+ window.removeEventListener('pointercancel', onCancel);
83
+ };
84
+ });
85
+ onDestroy(() => binding?.destroy());
86
+
87
+ // Roving focus: keep DOM focus on the focused row when focus is in the tree (scoped to this list).
88
+ $effect(() => {
89
+ const id = $snapshotStore.focusId;
90
+ if (!id || !listEl || !listEl.contains(document.activeElement)) return;
91
+ Array.from(listEl.querySelectorAll<HTMLElement>('.bm-tree__row')).find(r => r.dataset.nodeId === id)?.focus();
92
+ });
93
+
94
+ type Row = TreeControllerSnapshot['rows'][number];
95
+ const cssVars = (s: TreeControllerSnapshot) => Object.entries(treeCssVars(s)).map(([k, v]) => `${k}:${v}`).join(';');
96
+ function rowClass(s: TreeControllerSnapshot, r: Row): string {
97
+ let c = 'bm-tree__row';
98
+ if (r.selected) c += ' bm-tree__row--selected';
99
+ if (r.focused) c += ' bm-tree__row--focused';
100
+ if (r.matched) c += ' bm-tree__row--matched';
101
+ if (r.meta.disabled) c += ' bm-tree__row--disabled';
102
+ if (s.drag?.nodeId === r.node.id) c += ' bm-tree__row--dragging';
103
+ if (s.drag?.over?.targetId === r.node.id) c += ` bm-tree__row--drop-${s.drag.over.zone}`;
104
+ return c;
105
+ }
106
+ function onRowPointerDown(e: PointerEvent, id: string) { suppressClick = false; ctrl.pointerDownOnNode(id, { x: e.clientX, y: e.clientY }, e.pointerId); }
107
+ function onRowClick(e: MouseEvent, id: string) {
108
+ if (suppressClick) { suppressClick = false; return; }
109
+ if ((e.target as HTMLElement).closest('.bm-tree__checkbox')) { ctrl.toggleCheck(id); return; }
110
+ if ((e.target as HTMLElement).closest('.bm-tree__chevron')) ctrl.toggleExpand(id);
111
+ else ctrl.selectNode(id, { additive: e.ctrlKey || e.metaKey, range: e.shiftKey });
112
+ }
113
+ const checkboxClass = (state: string) => 'bm-tree__checkbox' + (state === 'checked' ? ' bm-tree__checkbox--checked' : state === 'indeterminate' ? ' bm-tree__checkbox--indeterminate' : '');
114
+ const rect = (e: MouseEvent) => (e.currentTarget as HTMLElement).getBoundingClientRect();
115
+ </script>
116
+
117
+ {#if $snapshotStore}
118
+ {@const snap = $snapshotStore}
119
+ {@const domFocus = snap.navAnchor}
120
+ <div class="bm-tree" data-theme={darkMode ? 'dark' : undefined} dir={dir} style={cssVars(snap)}>
121
+ <div class="bm-tree__toolbar">
122
+ {#if title}<h1 class="bm-tree__title">{title}</h1>{/if}
123
+ {#if tag}<span class="bm-tree__tag">{tag}</span>{/if}
124
+ <button class="bm-tree__btn bm-tree__btn--primary" type="button" disabled={snap.focusId === null} onclick={() => ctrl.voidAddChild(snap.focusId)}>+ {snap.config.locale.addChild}</button>
125
+ <button class="bm-tree__btn" type="button" disabled={snap.focusId === null} onclick={() => snap.focusId && ctrl.voidAddSibling(snap.focusId)}>+ {snap.config.locale.addSibling}</button>
126
+ <button class="bm-tree__btn" type="button" disabled={snap.focusId === null} onclick={(e) => snap.focusId && ctrl.openEdit(snap.focusId, rect(e))}>{snap.config.locale.rename}</button>
127
+ <button class="bm-tree__btn" type="button" disabled={snap.focusId === null} onclick={() => ctrl.voidDeleteSelection()}>{snap.config.locale.delete}</button>
128
+ <button class="bm-tree__btn" type="button" disabled={snap.focusId === null} onclick={() => snap.focusId && ctrl.voidDuplicate(snap.focusId)}>{snap.config.locale.duplicate}</button>
129
+ <button class="bm-tree__btn" type="button" onclick={() => ctrl.voidUndo()}>↶ {snap.config.locale.undo}</button>
130
+ <button class="bm-tree__btn" type="button" onclick={() => ctrl.expandAll()}>{snap.config.locale.expandAll}</button>
131
+ <button class="bm-tree__btn" type="button" onclick={() => ctrl.collapseAll()}>{snap.config.locale.collapseAll}</button>
132
+ <input class="bm-tree__search" type="search" placeholder={snap.config.locale.search} value={snap.filterQuery}
133
+ oninput={(e) => ctrl.setFilter((e.target as HTMLInputElement).value)} />
134
+ </div>
135
+
136
+ <!-- svelte-ignore a11y_interactive_supports_focus -->
137
+ <div class="bm-tree__list" role="tree" aria-label={ariaLabel ?? title ?? snap.config.locale.label} bind:this={listEl} onkeydown={onKey}>
138
+ {#each snap.rows as r (r.node.id)}
139
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
140
+ <div class={rowClass(snap, r)}
141
+ data-node-id={r.node.id}
142
+ role="treeitem"
143
+ aria-level={r.depth + 1}
144
+ aria-posinset={r.posinset}
145
+ aria-setsize={r.setsize}
146
+ aria-selected={r.selected}
147
+ aria-expanded={r.hasChildren ? r.expanded : undefined}
148
+ aria-disabled={r.meta.disabled || undefined}
149
+ tabindex={r.node.id === domFocus ? 0 : -1}
150
+ style="padding-left:{treeRowIndent(r.depth, snap) + 8}px"
151
+ onpointerdown={(e) => onRowPointerDown(e, r.node.id)}
152
+ onclick={(e) => onRowClick(e, r.node.id)}>
153
+ <span class={'bm-tree__chevron' + (r.hasChildren ? (r.expanded ? ' bm-tree__chevron--expanded' : '') : ' bm-tree__chevron--leaf')}>▶</span>
154
+ {#if snap.config.checkboxes}
155
+ <span class={checkboxClass(r.checkState)} role="checkbox" aria-checked={r.checkState === 'indeterminate' ? 'mixed' : r.checkState === 'checked'} aria-label={snap.config.locale.check}></span>
156
+ {/if}
157
+ {#if renderNode}{@render renderNode(r)}{:else}
158
+ {#if r.meta.icon}<span class="bm-tree__icon">{r.meta.icon}</span>{/if}
159
+ <span class="bm-tree__label">{r.node.title}</span>
160
+ {#if r.meta.badge}<span class="bm-tree__badge">{r.meta.badge}</span>{/if}
161
+ {/if}
162
+ </div>
163
+ {/each}
164
+ </div>
165
+
166
+ {#if snap.dialog}
167
+ {#key snap.dialog.node.id}
168
+ <TreeDialog dialog={snap.dialog} locale={snap.config.locale} rootFallback={() => listEl}
169
+ onsave={(d) => ctrl.voidSaveNode(d)} onclose={() => ctrl.closeDialog()} />
170
+ {/key}
171
+ {/if}
172
+
173
+ {#if snap.lastAction}
174
+ <div class="bm-tree__toast" role="status">
175
+ <span class="bm-tree__toast-msg">{snap.lastAction.description}</span>
176
+ <button class="bm-tree__toast-dismiss" type="button" onclick={() => ctrl.dismissUndo()}>×</button>
177
+ </div>
178
+ {/if}
179
+ </div>
180
+ {/if}
@@ -0,0 +1,31 @@
1
+ import { type Snippet } from 'svelte';
2
+ import type { TreeStore } from '@bimetal/tree-data';
3
+ import type { TreeConfigInput, TreeController, TreeRowView } from '@bimetal/tree-headless';
4
+ type $$ComponentProps = {
5
+ /**
6
+ * BOUND (composition contract, F1): an already-owned controller. The component
7
+ * renders its snapshot and forwards intents — it NEVER creates, destroys, or
8
+ * setConfig it (binding stays null). Pass this OR the standalone props.
9
+ */
10
+ controller?: TreeController;
11
+ store?: TreeStore;
12
+ treeId?: string;
13
+ config?: TreeConfigInput;
14
+ darkMode?: boolean;
15
+ dir?: 'ltr' | 'rtl';
16
+ title?: string;
17
+ tag?: string;
18
+ ariaLabel?: string;
19
+ onError?: (err: unknown) => void;
20
+ /** OBSERVE hook (standalone only): fires when the selection changes (ordered selected node ids). */
21
+ onSelectionChange?: (selectedIds: readonly string[]) => void;
22
+ /** OBSERVE hook (standalone only): the SECOND independent axis — the checkbox
23
+ * axis, not a dedup of selection. Fires when the checked set changes. */
24
+ onCheckedChange?: (checkedIds: readonly string[]) => void;
25
+ /** Replace ONLY a row's content cell (icon/label/badge). */
26
+ renderNode?: Snippet<[TreeRowView]>;
27
+ };
28
+ declare const Tree: import("svelte").Component<$$ComponentProps, {}, "">;
29
+ type Tree = ReturnType<typeof Tree>;
30
+ export default Tree;
31
+ //# sourceMappingURL=Tree.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tree.svelte.d.ts","sourceRoot":"","sources":["../src/Tree.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAA0B,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAOlH,KAAK,gBAAgB,GAAI;IACtB;;;;OAIG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,oGAAoG;IACpG,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;IAC7D;8EAC0E;IAC1E,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1D,4DAA4D;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;CACrC,CAAC;AAkJJ,QAAA,MAAM,IAAI,sDAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
@@ -0,0 +1,41 @@
1
+ <script lang="ts">
2
+ import { untrack } from 'svelte';
3
+ import { focusTrap } from '@bimetal/svelte';
4
+ import type { TreeDialogState, TreeLocale, NodeDraft } from '@bimetal/tree-headless';
5
+
6
+ let { dialog, locale, rootFallback, onsave, onclose }: {
7
+ dialog: TreeDialogState;
8
+ locale: TreeLocale;
9
+ /** INSTANCE-SCOPED restore target (the parent's own `.bm-tree__list`). */
10
+ rootFallback: () => HTMLElement | null;
11
+ onsave: (d: NodeDraft) => void;
12
+ onclose: () => void;
13
+ } = $props();
14
+
15
+ let title = $state(untrack(() => dialog.node.title));
16
+
17
+ function save() {
18
+ onsave({ title });
19
+ }
20
+ </script>
21
+
22
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
23
+ <div class="bm-tree__backdrop" role="presentation" onclick={onclose}>
24
+ <!-- Modal focus lifecycle via the shared (F3-hardened) `focusTrap` action. The dialog is a
25
+ sibling of `.bm-tree__list`; the parent passes an instance-scoped restore target. The trap
26
+ manages focus programmatically, so the dialog is intentionally not a static tab stop. -->
27
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
28
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
29
+ <!-- svelte-ignore a11y_interactive_supports_focus -->
30
+ <div class="bm-tree__dialog" role="dialog" aria-modal="true" aria-label={locale.rename} onclick={(e) => e.stopPropagation()}
31
+ use:focusTrap={{ onEscape: onclose, rootFallback }}>
32
+ <h2 class="bm-tree__dialog-heading">{locale.rename}</h2>
33
+ <input class="bm-tree__dialog-title" placeholder={locale.titlePlaceholder} bind:value={title}
34
+ onkeydown={(e) => { if (e.key === 'Enter') { e.preventDefault(); save(); } }} />
35
+ <div class="bm-tree__dialog-actions">
36
+ <span class="bm-tree__dialog-spacer"></span>
37
+ <button type="button" class="bm-tree__dialog-cancel" onclick={onclose}>{locale.cancel}</button>
38
+ <button type="button" class="bm-tree__dialog-save" onclick={save}>{locale.save}</button>
39
+ </div>
40
+ </div>
41
+ </div>
@@ -0,0 +1,13 @@
1
+ import type { TreeDialogState, TreeLocale, NodeDraft } from '@bimetal/tree-headless';
2
+ type $$ComponentProps = {
3
+ dialog: TreeDialogState;
4
+ locale: TreeLocale;
5
+ /** INSTANCE-SCOPED restore target (the parent's own `.bm-tree__list`). */
6
+ rootFallback: () => HTMLElement | null;
7
+ onsave: (d: NodeDraft) => void;
8
+ onclose: () => void;
9
+ };
10
+ declare const TreeDialog: import("svelte").Component<$$ComponentProps, {}, "">;
11
+ type TreeDialog = ReturnType<typeof TreeDialog>;
12
+ export default TreeDialog;
13
+ //# sourceMappingURL=TreeDialog.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeDialog.svelte.d.ts","sourceRoot":"","sources":["../src/TreeDialog.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEpF,KAAK,gBAAgB,GAAI;IACtB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,UAAU,CAAC;IACnB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAkCJ,QAAA,MAAM,UAAU,sDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @module @bimetal/tree-svelte-components
3
+ *
4
+ * The default Svelte 5 tree / treeview — instance #6 of the shipped component family
5
+ * (graduated from Option-1 to Option-2 in F4). A thin binding over the canonical
6
+ * `@bimetal/tree-headless` controller: multi-select, expand/collapse, tri-state
7
+ * checkboxes, drag-reorder, keyboard nav/move, rename, undo. Renders the canonical
8
+ * `.bm-tree*` DOM; styles ship from `@bimetal/tree-themes`.
9
+ */
10
+ export { default as Tree } from './Tree.svelte';
11
+ export * from '@bimetal/svelte';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,eAAe,CAAC;AAGhD,cAAc,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @module @bimetal/tree-svelte-components
3
+ *
4
+ * The default Svelte 5 tree / treeview — instance #6 of the shipped component family
5
+ * (graduated from Option-1 to Option-2 in F4). A thin binding over the canonical
6
+ * `@bimetal/tree-headless` controller: multi-select, expand/collapse, tri-state
7
+ * checkboxes, drag-reorder, keyboard nav/move, rename, undo. Renders the canonical
8
+ * `.bm-tree*` DOM; styles ship from `@bimetal/tree-themes`.
9
+ */
10
+ export { default as Tree } from './Tree.svelte';
11
+ // Re-export the generic Svelte bindings for convenience.
12
+ export * from '@bimetal/svelte';
@@ -0,0 +1 @@
1
+ @import '@bimetal/tree-themes';
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@bimetal/tree-svelte-components",
3
+ "version": "0.32.0",
4
+ "description": "Default Svelte 5 tree / treeview — multi-select, expand/collapse, tri-state checkboxes, drag-reorder, rename, undo, theming. A thin binding over the canonical tree controller.",
5
+ "type": "module",
6
+ "svelte": "./dist/index.js",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "svelte": "./dist/index.js",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./styles": "./dist/styles/index.css"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "scripts": {
23
+ "build": "svelte-package -i src -o dist && node scripts/copy-css.mjs",
24
+ "dev": "svelte-package -i src -o dist --watch",
25
+ "typecheck": "svelte-check --tsconfig ./tsconfig.json",
26
+ "test": "vitest run",
27
+ "prepublishOnly": "npm run build"
28
+ },
29
+ "dependencies": {
30
+ "@bimetal/svelte": "^0.32.0",
31
+ "@bimetal/tree-data": "^0.32.0",
32
+ "@bimetal/tree-headless": "^0.32.0",
33
+ "@bimetal/tree-themes": "^0.32.0",
34
+ "@bimetal/a11y-dom": "^0.32.0"
35
+ },
36
+ "peerDependencies": {
37
+ "svelte": "^5.46.4"
38
+ },
39
+ "devDependencies": {
40
+ "@sveltejs/package": "^2.5.0",
41
+ "@sveltejs/vite-plugin-svelte": "^5.0.3",
42
+ "@testing-library/svelte": "^5.2.7",
43
+ "happy-dom": "^18.0.1",
44
+ "svelte": "^5.46.4",
45
+ "svelte-check": "^4.0.0",
46
+ "typescript": "~5.9.3",
47
+ "vitest": "^3.2.4"
48
+ },
49
+ "sideEffects": [
50
+ "**/*.css"
51
+ ],
52
+ "license": "PolyForm-Noncommercial-1.0.0",
53
+ "author": "Andreas Biederbeck",
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "https://github.com/bimetal/bimetal.git",
57
+ "directory": "packages/tree/tree-svelte-components"
58
+ },
59
+ "keywords": [
60
+ "tree",
61
+ "treeview",
62
+ "svelte",
63
+ "components",
64
+ "multi-select",
65
+ "drag-reorder"
66
+ ]
67
+ }