@styloviz/tree-view 0.2.0 → 0.4.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/README.md
CHANGED
|
@@ -7,10 +7,10 @@ Part of the **Styloviz UI Kit** — a premium Angular 21 + Tailwind CSS 4 dashbo
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install @styloviz/core @styloviz/tree-view
|
|
10
|
+
npm install @styloviz/core @styloviz/icons @styloviz/tree-view
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Requires `@angular/core` and `@angular/common` >= 21. Also needs `@styloviz/core` — listed above so no extra step is required on npm (on pnpm/yarn, list
|
|
13
|
+
Requires `@angular/core` and `@angular/common` >= 21. Also needs `@styloviz/core`, `@styloviz/icons` — listed above so no extra step is required on npm (on pnpm/yarn, list them yourself). Prefer everything at once? `@styloviz/all` installs the whole free tier in one command.
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, output, model, signal, inject, ElementRef, computed, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { SvIconComponent } from '@styloviz/icons';
|
|
3
4
|
import { SvSkeletonShellComponent, SvErrorShellComponent, SvEmptyShellComponent } from '@styloviz/core';
|
|
4
5
|
|
|
5
6
|
// ─── Component ────────────────────────────────────────────────────────────────
|
|
@@ -69,6 +70,12 @@ class SvTreeViewComponent {
|
|
|
69
70
|
if (ids.size)
|
|
70
71
|
this.expandedIds.set(ids);
|
|
71
72
|
// Seed the roving tabindex on the first node so the tree is tab-reachable.
|
|
73
|
+
// ★ UNREACHABLE BRANCH — the `?? null` right operand can never be taken.
|
|
74
|
+
// The guard four lines up already returned for `incoming.length === 0`,
|
|
75
|
+
// `_nodes` was set to `incoming` synchronously above, and `_flatten` of a
|
|
76
|
+
// non-empty list always yields at least one row — so `[0]` is defined and
|
|
77
|
+
// the `?.` never short-circuits. Kept because the expression is what
|
|
78
|
+
// makes the `activeId` type honest; counted as unreachable, not uncovered.
|
|
72
79
|
this.activeId.set(this.visibleNodes()[0]?.node.id ?? null);
|
|
73
80
|
});
|
|
74
81
|
}
|
|
@@ -86,6 +93,10 @@ class SvTreeViewComponent {
|
|
|
86
93
|
}
|
|
87
94
|
this.expandedIds.set(ids);
|
|
88
95
|
}
|
|
96
|
+
/** One entry per ancestor level, for the indentation spacers. */
|
|
97
|
+
depthArray(depth) {
|
|
98
|
+
return Array.from({ length: depth }, (_, i) => i);
|
|
99
|
+
}
|
|
89
100
|
select(node, depth) {
|
|
90
101
|
if (node.disabled || !this.selectable())
|
|
91
102
|
return;
|
|
@@ -233,7 +244,6 @@ class SvTreeViewComponent {
|
|
|
233
244
|
: isSelected(fn.node.id)
|
|
234
245
|
? 'py-1.5 bg-indigo-50 dark:bg-indigo-900/25'
|
|
235
246
|
: 'py-1.5 hover:bg-gray-100/70 dark:hover:bg-gray-800/50'"
|
|
236
|
-
[style.paddingLeft.px]="fn.depth * 20 + 4"
|
|
237
247
|
(click)="select(fn.node, fn.depth); setActive(fn.node.id)"
|
|
238
248
|
(keydown)="onKeydown($event, fn, $index)"
|
|
239
249
|
role="treeitem"
|
|
@@ -243,6 +253,23 @@ class SvTreeViewComponent {
|
|
|
243
253
|
[attr.aria-expanded]="fn.hasChildren ? fn.isExpanded : null"
|
|
244
254
|
[attr.aria-selected]="isSelected(fn.node.id)">
|
|
245
255
|
|
|
256
|
+
<!--
|
|
257
|
+
Depth spacers, one per level, carrying the optional connector guide.
|
|
258
|
+
Indentation used to be a paddingLeft on the row, which left
|
|
259
|
+
showLines - declared, documented, default true - with nothing to
|
|
260
|
+
hang a line on, so it did nothing at all. The Pro twin has rendered
|
|
261
|
+
these all along; this is the same 20px-per-level geometry.
|
|
262
|
+
(No backticks in here: this template is an inline JS literal.)
|
|
263
|
+
-->
|
|
264
|
+
@for (d of depthArray(fn.depth); track d) {
|
|
265
|
+
<span class="relative w-5 shrink-0 self-stretch" aria-hidden="true">
|
|
266
|
+
@if (showLines()) {
|
|
267
|
+
<span class="absolute inset-y-0 left-1/2 w-px -translate-x-1/2
|
|
268
|
+
bg-gray-200 dark:bg-gray-700/70"></span>
|
|
269
|
+
}
|
|
270
|
+
</span>
|
|
271
|
+
}
|
|
272
|
+
|
|
246
273
|
<!-- Chevron toggle -->
|
|
247
274
|
<button type="button"
|
|
248
275
|
class="flex h-5 w-5 shrink-0 items-center justify-center rounded
|
|
@@ -251,11 +278,9 @@ class SvTreeViewComponent {
|
|
|
251
278
|
[class.invisible]="!fn.hasChildren"
|
|
252
279
|
(click)="toggle(fn.node); $event.stopPropagation()"
|
|
253
280
|
[attr.aria-label]="fn.isExpanded ? 'Collapse' : 'Expand'">
|
|
254
|
-
<
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="m8.25 4.5 7.5 7.5-7.5 7.5"/>
|
|
258
|
-
</svg>
|
|
281
|
+
<sv-icon name="chevron-right"
|
|
282
|
+
[cssClass]="'h-3.5 w-3.5 transition-transform duration-150' + (fn.isExpanded ? ' rotate-90' : '')"
|
|
283
|
+
[strokeWidth]="2" />
|
|
259
284
|
</button>
|
|
260
285
|
|
|
261
286
|
<!-- Icon -->
|
|
@@ -288,12 +313,12 @@ class SvTreeViewComponent {
|
|
|
288
313
|
</div>
|
|
289
314
|
}
|
|
290
315
|
|
|
291
|
-
`, isInline: true, dependencies: [{ kind: "component", type: SvSkeletonShellComponent, selector: "sv-skeleton-shell", inputs: ["variant", "rows", "columns", "chartHeight", "ariaLabel", "customClass"] }, { kind: "component", type: SvErrorShellComponent, selector: "sv-error-shell", inputs: ["error", "title", "retryLabel", "retryable", "compact", "showStatus", "customClass"], outputs: ["retry"] }, { kind: "component", type: SvEmptyShellComponent, selector: "sv-empty-shell", inputs: ["reason", "title", "message", "actionLabel", "compact", "customClass"], outputs: ["action"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
316
|
+
`, isInline: true, dependencies: [{ kind: "component", type: SvIconComponent, selector: "sv-icon", inputs: ["name", "size", "strokeWidth", "weight", "title", "flip", "rotate", "cssClass"] }, { kind: "component", type: SvSkeletonShellComponent, selector: "sv-skeleton-shell", inputs: ["variant", "rows", "columns", "chartHeight", "ariaLabel", "customClass"] }, { kind: "component", type: SvErrorShellComponent, selector: "sv-error-shell", inputs: ["error", "title", "retryLabel", "retryable", "compact", "showStatus", "customClass"], outputs: ["retry"] }, { kind: "component", type: SvEmptyShellComponent, selector: "sv-empty-shell", inputs: ["reason", "title", "message", "actionLabel", "compact", "customClass"], outputs: ["action"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
292
317
|
}
|
|
293
318
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: SvTreeViewComponent, decorators: [{
|
|
294
319
|
type: Component,
|
|
295
320
|
args: [{
|
|
296
|
-
imports: [SvSkeletonShellComponent, SvErrorShellComponent, SvEmptyShellComponent],
|
|
321
|
+
imports: [SvIconComponent, SvSkeletonShellComponent, SvErrorShellComponent, SvEmptyShellComponent],
|
|
297
322
|
selector: 'sv-tree-view',
|
|
298
323
|
standalone: true,
|
|
299
324
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -319,7 +344,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImpo
|
|
|
319
344
|
: isSelected(fn.node.id)
|
|
320
345
|
? 'py-1.5 bg-indigo-50 dark:bg-indigo-900/25'
|
|
321
346
|
: 'py-1.5 hover:bg-gray-100/70 dark:hover:bg-gray-800/50'"
|
|
322
|
-
[style.paddingLeft.px]="fn.depth * 20 + 4"
|
|
323
347
|
(click)="select(fn.node, fn.depth); setActive(fn.node.id)"
|
|
324
348
|
(keydown)="onKeydown($event, fn, $index)"
|
|
325
349
|
role="treeitem"
|
|
@@ -329,6 +353,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImpo
|
|
|
329
353
|
[attr.aria-expanded]="fn.hasChildren ? fn.isExpanded : null"
|
|
330
354
|
[attr.aria-selected]="isSelected(fn.node.id)">
|
|
331
355
|
|
|
356
|
+
<!--
|
|
357
|
+
Depth spacers, one per level, carrying the optional connector guide.
|
|
358
|
+
Indentation used to be a paddingLeft on the row, which left
|
|
359
|
+
showLines - declared, documented, default true - with nothing to
|
|
360
|
+
hang a line on, so it did nothing at all. The Pro twin has rendered
|
|
361
|
+
these all along; this is the same 20px-per-level geometry.
|
|
362
|
+
(No backticks in here: this template is an inline JS literal.)
|
|
363
|
+
-->
|
|
364
|
+
@for (d of depthArray(fn.depth); track d) {
|
|
365
|
+
<span class="relative w-5 shrink-0 self-stretch" aria-hidden="true">
|
|
366
|
+
@if (showLines()) {
|
|
367
|
+
<span class="absolute inset-y-0 left-1/2 w-px -translate-x-1/2
|
|
368
|
+
bg-gray-200 dark:bg-gray-700/70"></span>
|
|
369
|
+
}
|
|
370
|
+
</span>
|
|
371
|
+
}
|
|
372
|
+
|
|
332
373
|
<!-- Chevron toggle -->
|
|
333
374
|
<button type="button"
|
|
334
375
|
class="flex h-5 w-5 shrink-0 items-center justify-center rounded
|
|
@@ -337,11 +378,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImpo
|
|
|
337
378
|
[class.invisible]="!fn.hasChildren"
|
|
338
379
|
(click)="toggle(fn.node); $event.stopPropagation()"
|
|
339
380
|
[attr.aria-label]="fn.isExpanded ? 'Collapse' : 'Expand'">
|
|
340
|
-
<
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="m8.25 4.5 7.5 7.5-7.5 7.5"/>
|
|
344
|
-
</svg>
|
|
381
|
+
<sv-icon name="chevron-right"
|
|
382
|
+
[cssClass]="'h-3.5 w-3.5 transition-transform duration-150' + (fn.isExpanded ? ' rotate-90' : '')"
|
|
383
|
+
[strokeWidth]="2" />
|
|
345
384
|
</button>
|
|
346
385
|
|
|
347
386
|
<!-- Icon -->
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styloviz-tree-view.mjs","sources":["../../../../projects/tree-view-free/src/lib/tree-view.component.ts","../../../../projects/tree-view-free/src/styloviz-tree-view.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport {\n SvEmptyShellComponent,\n SvErrorShellComponent,\n SvSkeletonShellComponent,\n type SvDataError,\n} from '@styloviz/core';\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport interface TreeNode {\n readonly id: string;\n readonly label: string;\n readonly icon?: string;\n children?: TreeNode[];\n readonly expanded?: boolean;\n readonly disabled?: boolean;\n readonly badge?: string;\n}\n\nexport interface FlatNode {\n readonly node: TreeNode;\n readonly depth: number;\n readonly isLast: boolean;\n readonly hasChildren: boolean;\n readonly isExpanded: boolean;\n}\n\nexport interface TreeNodeClickEvent {\n readonly node: TreeNode;\n readonly depth: number;\n}\n\n// ─── Component ────────────────────────────────────────────────────────────────\n\n/**\n * SvTreeViewComponent (Free) — Collapsible single-select tree.\n *\n * For the full 8-variant suite (file explorer, checkbox tri-state,\n * org chart, tree table, searchable, draggable, lazy-load) upgrade to\n * `@styloviz-pro/tree-view`.\n *\n * @example\n * ```html\n * <sv-tree-view [nodes]=\"nodes\" (nodeClick)=\"onNodeClick($event)\" />\n * ```\n */\n@Component({\n imports: [SvSkeletonShellComponent, SvErrorShellComponent, SvEmptyShellComponent],\n selector: 'sv-tree-view',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (loading()) {\n <div class=\"p-2\" data-sv-state=\"loading\">\n <sv-skeleton-shell variant=\"list\" [rows]=\"5\" ariaLabel=\"Loading tree\" />\n </div>\n } @else if (error()) {\n <sv-error-shell\n [error]=\"error()\"\n title=\"Could not load this tree\"\n (retry)=\"retry.emit()\"\n data-sv-state=\"error\"\n />\n } @else {\n\n <div class=\"sv-tree-view select-none\" role=\"tree\">\n @for (fn of visibleNodes(); track fn.node.id) {\n <div class=\"group flex items-center gap-1 rounded-lg px-1 outline-none transition-colors duration-100 cursor-pointer focus-visible:ring-2 focus-visible:ring-indigo-400\"\n [class]=\"fn.node.disabled\n ? 'opacity-40 cursor-not-allowed py-1.5'\n : isSelected(fn.node.id)\n ? 'py-1.5 bg-indigo-50 dark:bg-indigo-900/25'\n : 'py-1.5 hover:bg-gray-100/70 dark:hover:bg-gray-800/50'\"\n [style.paddingLeft.px]=\"fn.depth * 20 + 4\"\n (click)=\"select(fn.node, fn.depth); setActive(fn.node.id)\"\n (keydown)=\"onKeydown($event, fn, $index)\"\n role=\"treeitem\"\n [attr.data-tree-id]=\"fn.node.id\"\n [attr.tabindex]=\"treeTabIndex(fn.node.id)\"\n [attr.aria-level]=\"fn.depth + 1\"\n [attr.aria-expanded]=\"fn.hasChildren ? fn.isExpanded : null\"\n [attr.aria-selected]=\"isSelected(fn.node.id)\">\n\n <!-- Chevron toggle -->\n <button type=\"button\"\n class=\"flex h-5 w-5 shrink-0 items-center justify-center rounded\n text-gray-400 transition-all hover:text-gray-700 dark:hover:text-gray-200\n focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-indigo-400\"\n [class.invisible]=\"!fn.hasChildren\"\n (click)=\"toggle(fn.node); $event.stopPropagation()\"\n [attr.aria-label]=\"fn.isExpanded ? 'Collapse' : 'Expand'\">\n <svg class=\"h-3.5 w-3.5 transition-transform duration-150\"\n [class.rotate-90]=\"fn.isExpanded\"\n fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"m8.25 4.5 7.5 7.5-7.5 7.5\"/>\n </svg>\n </button>\n\n <!-- Icon -->\n @if (fn.node.icon) {\n <span class=\"shrink-0 text-sm\" aria-hidden=\"true\">{{ fn.node.icon }}</span>\n }\n\n <!-- Label -->\n <span class=\"flex-1 truncate text-[13px] font-medium\"\n [class]=\"isSelected(fn.node.id)\n ? 'text-indigo-700 dark:text-indigo-300'\n : 'text-gray-800 dark:text-gray-100'\">\n {{ fn.node.label }}\n </span>\n\n <!-- Badge -->\n @if (fn.node.badge) {\n <span class=\"ml-auto shrink-0 rounded-full bg-gray-100 px-1.5 py-px\n text-[10px] font-semibold text-gray-600\n dark:bg-gray-800 dark:text-gray-300\">\n {{ fn.node.badge }}\n </span>\n }\n </div>\n }\n\n @if (!visibleNodes().length) {\n <sv-empty-shell reason=\"no-data\" [title]=\"emptyText()\" data-sv-state=\"empty\" />\n }\n </div>\n }\n\n `,\n})\nexport class SvTreeViewComponent {\n /** Tree node data (nested children, optional icons). */\n readonly nodes = input<TreeNode[]>([]);\n /** Enable single-row selection highlight. @default true */\n readonly selectable = input<boolean>(true);\n /** Show vertical connector guide lines. @default true */\n readonly showLines = input<boolean>(true);\n\n /**\n * True while the tree is being fetched. Replaces it with a placeholder.\n * @default false\n */\n readonly loading = input<boolean>(false);\n\n /**\n * Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an\n * `HttpErrorResponse`.\n * @default null\n */\n readonly error = input<SvDataError | string | null>(null);\n\n /** Copy for the empty state. @default 'No items to display' */\n readonly emptyText = input<string>('No items to display');\n\n readonly nodeClick = output<TreeNodeClickEvent>();\n readonly nodeExpand = output<TreeNode>();\n readonly nodeCollapse = output<TreeNode>();\n readonly nodeSelect = output<TreeNode>();\n /** The host should re-run the failed load. */\n readonly retry = output<void>();\n\n /**\n * Expanded node ids. Two-way bindable, so an expansion state loaded from the\n * server — or restored from a URL — survives a reload.\n */\n readonly expandedIds = model<Set<string>>(new Set());\n /** The selected node id. Two-way bindable. */\n readonly selectedId = model<string | null>(null);\n /** The treeitem currently in the tab order (roving tabindex). */\n readonly activeId = signal<string | null>(null);\n\n private readonly _nodes = signal<TreeNode[]>([]);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly visibleNodes = computed<FlatNode[]>(() =>\n this._flatten(this._nodes(), 0, this.expandedIds())\n );\n\n /** Applied only on the first non-empty node set — after that the user owns it. */\n private _seededFromNodes = false;\n\n constructor() {\n // `nodes` used to be read once in ngOnInit, so a host that fetched the tree\n // asynchronously and bound the result saw an empty component forever.\n effect(() => {\n const incoming = this.nodes();\n this._nodes.set(incoming);\n if (this._seededFromNodes || incoming.length === 0) return;\n this._seededFromNodes = true;\n const ids = new Set<string>();\n this._collectExpanded(incoming, ids);\n if (ids.size) this.expandedIds.set(ids);\n // Seed the roving tabindex on the first node so the tree is tab-reachable.\n this.activeId.set(this.visibleNodes()[0]?.node.id ?? null);\n });\n }\n\n toggle(node: TreeNode): void {\n if (node.disabled) return;\n const ids = new Set(this.expandedIds());\n if (ids.has(node.id)) {\n ids.delete(node.id);\n this.nodeCollapse.emit(node);\n } else {\n ids.add(node.id);\n this.nodeExpand.emit(node);\n }\n this.expandedIds.set(ids);\n }\n\n select(node: TreeNode, depth: number): void {\n if (node.disabled || !this.selectable()) return;\n this.selectedId.set(node.id);\n this.nodeSelect.emit(node);\n this.nodeClick.emit({ node, depth });\n }\n\n isSelected(id: string): boolean { return this.selectedId() === id; }\n\n // ── Keyboard navigation (WAI-ARIA tree) ─────────────────────────────────────\n\n /** Roving tabindex: only the active treeitem is in the tab order. */\n treeTabIndex(id: string): number {\n const active = this.activeId() ?? this.visibleNodes()[0]?.node.id ?? null;\n return id === active ? 0 : -1;\n }\n\n setActive(id: string): void { this.activeId.set(id); }\n\n /**\n * Arrow / Home / End / Enter / Space handling per the WAI-ARIA tree pattern.\n * Arrow Up/Down move between visible rows; Right expands or steps into a\n * child; Left collapses or steps to the parent; Enter/Space selects.\n */\n onKeydown(event: KeyboardEvent, fn: FlatNode, index: number): void {\n const list = this.visibleNodes();\n switch (event.key) {\n case 'ArrowDown': event.preventDefault(); this._focusStep(list, index, +1); break;\n case 'ArrowUp': event.preventDefault(); this._focusStep(list, index, -1); break;\n case 'Home': event.preventDefault(); this._focusFrom(list, 0, +1); break;\n case 'End': event.preventDefault(); this._focusFrom(list, list.length - 1, -1); break;\n case 'ArrowRight':\n event.preventDefault();\n if (fn.hasChildren && !fn.isExpanded) { this.toggle(fn.node); }\n else if (fn.hasChildren && fn.isExpanded) { this._focusStep(list, index, +1); }\n break;\n case 'ArrowLeft':\n event.preventDefault();\n if (fn.hasChildren && fn.isExpanded) { this.toggle(fn.node); }\n else { this._focusParent(list, index, fn.depth); }\n break;\n case 'Enter':\n case ' ':\n event.preventDefault();\n this.select(fn.node, fn.depth);\n this.setActive(fn.node.id);\n break;\n default:\n return;\n }\n }\n\n /** Move focus by `dir` steps from `from`, skipping disabled rows. */\n private _focusStep(list: readonly FlatNode[], from: number, dir: 1 | -1): void {\n for (let i = from + dir; i >= 0 && i < list.length; i += dir) {\n if (!list[i].node.disabled) { this._focus(list[i].node.id); return; }\n }\n }\n\n /** From `start`, find the first enabled row in direction `dir` and focus it. */\n private _focusFrom(list: readonly FlatNode[], start: number, dir: 1 | -1): void {\n for (let i = start; i >= 0 && i < list.length; i += dir) {\n if (!list[i].node.disabled) { this._focus(list[i].node.id); return; }\n }\n }\n\n /** Focus the parent row (nearest previous row with a smaller depth). */\n private _focusParent(list: readonly FlatNode[], index: number, depth: number): void {\n for (let i = index - 1; i >= 0; i--) {\n if (list[i].depth < depth) { this._focus(list[i].node.id); return; }\n }\n }\n\n /** Set the active id and move DOM focus to that row (after any re-render). */\n private _focus(id: string): void {\n this.setActive(id);\n queueMicrotask(() => {\n const rows = this.host.nativeElement.querySelectorAll<HTMLElement>('[data-tree-id]');\n rows.forEach(el => { if (el.dataset['treeId'] === id) el.focus(); });\n });\n }\n\n private _flatten(nodes: TreeNode[], depth: number, expanded: Set<string>): FlatNode[] {\n const result: FlatNode[] = [];\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n const hasChildren = !!node.children?.length;\n const isExp = expanded.has(node.id);\n result.push({ node, depth, isLast: i === nodes.length - 1, hasChildren, isExpanded: isExp });\n if (isExp && node.children?.length) {\n result.push(...this._flatten(node.children, depth + 1, expanded));\n }\n }\n return result;\n }\n\n private _collectExpanded(nodes: TreeNode[], ids: Set<string>): void {\n for (const n of nodes) {\n if (n.expanded) ids.add(n.id);\n if (n.children) this._collectExpanded(n.children, ids);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AA4CA;AAEA;;;;;;;;;;;AAWG;MAqFU,mBAAmB,CAAA;;AAErB,IAAA,KAAK,GAAQ,KAAK,CAAa,EAAE,4EAAC;;AAElC,IAAA,UAAU,GAAG,KAAK,CAAU,IAAI,iFAAC;;AAEjC,IAAA,SAAS,GAAI,KAAK,CAAU,IAAI,gFAAC;AAE1C;;;AAGG;AACM,IAAA,OAAO,GAAG,KAAK,CAAU,KAAK,8EAAC;AAExC;;;;AAIG;AACM,IAAA,KAAK,GAAG,KAAK,CAA8B,IAAI,4EAAC;;AAGhD,IAAA,SAAS,GAAG,KAAK,CAAS,qBAAqB,gFAAC;IAEhD,SAAS,GAAM,MAAM,EAAsB;IAC3C,UAAU,GAAK,MAAM,EAAY;IACjC,YAAY,GAAG,MAAM,EAAY;IACjC,UAAU,GAAK,MAAM,EAAY;;IAEjC,KAAK,GAAU,MAAM,EAAQ;AAEtC;;;AAGG;AACM,IAAA,WAAW,GAAG,KAAK,CAAc,IAAI,GAAG,EAAE,kFAAC;;AAE3C,IAAA,UAAU,GAAI,KAAK,CAAgB,IAAI,iFAAC;;AAExC,IAAA,QAAQ,GAAM,MAAM,CAAgB,IAAI,+EAAC;AAEjC,IAAA,MAAM,GAAG,MAAM,CAAa,EAAE,6EAAC;AAC/B,IAAA,IAAI,GAAK,MAAM,CAA0B,UAAU,CAAC;IAE5D,YAAY,GAAG,QAAQ,CAAa,MAC3C,IAAI,CAAC,QAAQ,CAAC,IAAI,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A,EAAA,SAAA,EAAA,YAAA,EAAA,aAAA,CAAA,EAAA,OAAA,EAAA,CAAA,OAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,qBAAqB,EAAA,QAAA,EAAA,gBAAA,EAAA,MAAA,EAAA,CAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,aAAA,EAAA,SAAA,EAAA,aAAA,CAAA,EAAA,OAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAmFrE,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBApF/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,wBAAwB,EAAE,qBAAqB,EAAE,qBAAqB,CAAC;AACjF,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,UAAU,EAAE,IAAI;oBAChB,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6ET,EAAA,CAAA;AACF,iBAAA;;;AC7ID;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"styloviz-tree-view.mjs","sources":["../../../../projects/tree-view-free/src/lib/tree-view.component.ts","../../../../projects/tree-view-free/src/styloviz-tree-view.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport { SvIconComponent } from '@styloviz/icons';\nimport {\n SvEmptyShellComponent,\n SvErrorShellComponent,\n SvSkeletonShellComponent,\n type SvDataError,\n} from '@styloviz/core';\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport interface TreeNode {\n readonly id: string;\n readonly label: string;\n readonly icon?: string;\n children?: TreeNode[];\n readonly expanded?: boolean;\n readonly disabled?: boolean;\n readonly badge?: string;\n}\n\nexport interface FlatNode {\n readonly node: TreeNode;\n readonly depth: number;\n readonly isLast: boolean;\n readonly hasChildren: boolean;\n readonly isExpanded: boolean;\n}\n\nexport interface TreeNodeClickEvent {\n readonly node: TreeNode;\n readonly depth: number;\n}\n\n// ─── Component ────────────────────────────────────────────────────────────────\n\n/**\n * SvTreeViewComponent (Free) — Collapsible single-select tree.\n *\n * For the full 8-variant suite (file explorer, checkbox tri-state,\n * org chart, tree table, searchable, draggable, lazy-load) upgrade to\n * `@styloviz-pro/tree-view`.\n *\n * @example\n * ```html\n * <sv-tree-view [nodes]=\"nodes\" (nodeClick)=\"onNodeClick($event)\" />\n * ```\n */\n@Component({\n imports: [SvIconComponent, SvSkeletonShellComponent, SvErrorShellComponent, SvEmptyShellComponent],\n selector: 'sv-tree-view',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (loading()) {\n <div class=\"p-2\" data-sv-state=\"loading\">\n <sv-skeleton-shell variant=\"list\" [rows]=\"5\" ariaLabel=\"Loading tree\" />\n </div>\n } @else if (error()) {\n <sv-error-shell\n [error]=\"error()\"\n title=\"Could not load this tree\"\n (retry)=\"retry.emit()\"\n data-sv-state=\"error\"\n />\n } @else {\n\n <div class=\"sv-tree-view select-none\" role=\"tree\">\n @for (fn of visibleNodes(); track fn.node.id) {\n <div class=\"group flex items-center gap-1 rounded-lg px-1 outline-none transition-colors duration-100 cursor-pointer focus-visible:ring-2 focus-visible:ring-indigo-400\"\n [class]=\"fn.node.disabled\n ? 'opacity-40 cursor-not-allowed py-1.5'\n : isSelected(fn.node.id)\n ? 'py-1.5 bg-indigo-50 dark:bg-indigo-900/25'\n : 'py-1.5 hover:bg-gray-100/70 dark:hover:bg-gray-800/50'\"\n (click)=\"select(fn.node, fn.depth); setActive(fn.node.id)\"\n (keydown)=\"onKeydown($event, fn, $index)\"\n role=\"treeitem\"\n [attr.data-tree-id]=\"fn.node.id\"\n [attr.tabindex]=\"treeTabIndex(fn.node.id)\"\n [attr.aria-level]=\"fn.depth + 1\"\n [attr.aria-expanded]=\"fn.hasChildren ? fn.isExpanded : null\"\n [attr.aria-selected]=\"isSelected(fn.node.id)\">\n\n <!--\n Depth spacers, one per level, carrying the optional connector guide.\n Indentation used to be a paddingLeft on the row, which left\n showLines - declared, documented, default true - with nothing to\n hang a line on, so it did nothing at all. The Pro twin has rendered\n these all along; this is the same 20px-per-level geometry.\n (No backticks in here: this template is an inline JS literal.)\n -->\n @for (d of depthArray(fn.depth); track d) {\n <span class=\"relative w-5 shrink-0 self-stretch\" aria-hidden=\"true\">\n @if (showLines()) {\n <span class=\"absolute inset-y-0 left-1/2 w-px -translate-x-1/2\n bg-gray-200 dark:bg-gray-700/70\"></span>\n }\n </span>\n }\n\n <!-- Chevron toggle -->\n <button type=\"button\"\n class=\"flex h-5 w-5 shrink-0 items-center justify-center rounded\n text-gray-400 transition-all hover:text-gray-700 dark:hover:text-gray-200\n focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-indigo-400\"\n [class.invisible]=\"!fn.hasChildren\"\n (click)=\"toggle(fn.node); $event.stopPropagation()\"\n [attr.aria-label]=\"fn.isExpanded ? 'Collapse' : 'Expand'\">\n <sv-icon name=\"chevron-right\"\n [cssClass]=\"'h-3.5 w-3.5 transition-transform duration-150' + (fn.isExpanded ? ' rotate-90' : '')\"\n [strokeWidth]=\"2\" />\n </button>\n\n <!-- Icon -->\n @if (fn.node.icon) {\n <span class=\"shrink-0 text-sm\" aria-hidden=\"true\">{{ fn.node.icon }}</span>\n }\n\n <!-- Label -->\n <span class=\"flex-1 truncate text-[13px] font-medium\"\n [class]=\"isSelected(fn.node.id)\n ? 'text-indigo-700 dark:text-indigo-300'\n : 'text-gray-800 dark:text-gray-100'\">\n {{ fn.node.label }}\n </span>\n\n <!-- Badge -->\n @if (fn.node.badge) {\n <span class=\"ml-auto shrink-0 rounded-full bg-gray-100 px-1.5 py-px\n text-[10px] font-semibold text-gray-600\n dark:bg-gray-800 dark:text-gray-300\">\n {{ fn.node.badge }}\n </span>\n }\n </div>\n }\n\n @if (!visibleNodes().length) {\n <sv-empty-shell reason=\"no-data\" [title]=\"emptyText()\" data-sv-state=\"empty\" />\n }\n </div>\n }\n\n `,\n})\nexport class SvTreeViewComponent {\n /** Tree node data (nested children, optional icons). */\n readonly nodes = input<TreeNode[]>([]);\n /** Enable single-row selection highlight. @default true */\n readonly selectable = input<boolean>(true);\n /** Show vertical connector guide lines. @default true */\n readonly showLines = input<boolean>(true);\n\n /**\n * True while the tree is being fetched. Replaces it with a placeholder.\n * @default false\n */\n readonly loading = input<boolean>(false);\n\n /**\n * Load failure. Use `toSvDataError()` from `@styloviz/core` to normalize an\n * `HttpErrorResponse`.\n * @default null\n */\n readonly error = input<SvDataError | string | null>(null);\n\n /** Copy for the empty state. @default 'No items to display' */\n readonly emptyText = input<string>('No items to display');\n\n readonly nodeClick = output<TreeNodeClickEvent>();\n readonly nodeExpand = output<TreeNode>();\n readonly nodeCollapse = output<TreeNode>();\n readonly nodeSelect = output<TreeNode>();\n /** The host should re-run the failed load. */\n readonly retry = output<void>();\n\n /**\n * Expanded node ids. Two-way bindable, so an expansion state loaded from the\n * server — or restored from a URL — survives a reload.\n */\n readonly expandedIds = model<Set<string>>(new Set());\n /** The selected node id. Two-way bindable. */\n readonly selectedId = model<string | null>(null);\n /** The treeitem currently in the tab order (roving tabindex). */\n readonly activeId = signal<string | null>(null);\n\n private readonly _nodes = signal<TreeNode[]>([]);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly visibleNodes = computed<FlatNode[]>(() =>\n this._flatten(this._nodes(), 0, this.expandedIds())\n );\n\n /** Applied only on the first non-empty node set — after that the user owns it. */\n private _seededFromNodes = false;\n\n constructor() {\n // `nodes` used to be read once in ngOnInit, so a host that fetched the tree\n // asynchronously and bound the result saw an empty component forever.\n effect(() => {\n const incoming = this.nodes();\n this._nodes.set(incoming);\n if (this._seededFromNodes || incoming.length === 0) return;\n this._seededFromNodes = true;\n const ids = new Set<string>();\n this._collectExpanded(incoming, ids);\n if (ids.size) this.expandedIds.set(ids);\n // Seed the roving tabindex on the first node so the tree is tab-reachable.\n // ★ UNREACHABLE BRANCH — the `?? null` right operand can never be taken.\n // The guard four lines up already returned for `incoming.length === 0`,\n // `_nodes` was set to `incoming` synchronously above, and `_flatten` of a\n // non-empty list always yields at least one row — so `[0]` is defined and\n // the `?.` never short-circuits. Kept because the expression is what\n // makes the `activeId` type honest; counted as unreachable, not uncovered.\n this.activeId.set(this.visibleNodes()[0]?.node.id ?? null);\n });\n }\n\n toggle(node: TreeNode): void {\n if (node.disabled) return;\n const ids = new Set(this.expandedIds());\n if (ids.has(node.id)) {\n ids.delete(node.id);\n this.nodeCollapse.emit(node);\n } else {\n ids.add(node.id);\n this.nodeExpand.emit(node);\n }\n this.expandedIds.set(ids);\n }\n\n /** One entry per ancestor level, for the indentation spacers. */\n depthArray(depth: number): number[] {\n return Array.from({ length: depth }, (_, i) => i);\n }\n\n select(node: TreeNode, depth: number): void {\n if (node.disabled || !this.selectable()) return;\n this.selectedId.set(node.id);\n this.nodeSelect.emit(node);\n this.nodeClick.emit({ node, depth });\n }\n\n isSelected(id: string): boolean { return this.selectedId() === id; }\n\n // ── Keyboard navigation (WAI-ARIA tree) ─────────────────────────────────────\n\n /** Roving tabindex: only the active treeitem is in the tab order. */\n treeTabIndex(id: string): number {\n const active = this.activeId() ?? this.visibleNodes()[0]?.node.id ?? null;\n return id === active ? 0 : -1;\n }\n\n setActive(id: string): void { this.activeId.set(id); }\n\n /**\n * Arrow / Home / End / Enter / Space handling per the WAI-ARIA tree pattern.\n * Arrow Up/Down move between visible rows; Right expands or steps into a\n * child; Left collapses or steps to the parent; Enter/Space selects.\n */\n onKeydown(event: KeyboardEvent, fn: FlatNode, index: number): void {\n const list = this.visibleNodes();\n switch (event.key) {\n case 'ArrowDown': event.preventDefault(); this._focusStep(list, index, +1); break;\n case 'ArrowUp': event.preventDefault(); this._focusStep(list, index, -1); break;\n case 'Home': event.preventDefault(); this._focusFrom(list, 0, +1); break;\n case 'End': event.preventDefault(); this._focusFrom(list, list.length - 1, -1); break;\n case 'ArrowRight':\n event.preventDefault();\n if (fn.hasChildren && !fn.isExpanded) { this.toggle(fn.node); }\n else if (fn.hasChildren && fn.isExpanded) { this._focusStep(list, index, +1); }\n break;\n case 'ArrowLeft':\n event.preventDefault();\n if (fn.hasChildren && fn.isExpanded) { this.toggle(fn.node); }\n else { this._focusParent(list, index, fn.depth); }\n break;\n case 'Enter':\n case ' ':\n event.preventDefault();\n this.select(fn.node, fn.depth);\n this.setActive(fn.node.id);\n break;\n default:\n return;\n }\n }\n\n /** Move focus by `dir` steps from `from`, skipping disabled rows. */\n private _focusStep(list: readonly FlatNode[], from: number, dir: 1 | -1): void {\n for (let i = from + dir; i >= 0 && i < list.length; i += dir) {\n if (!list[i].node.disabled) { this._focus(list[i].node.id); return; }\n }\n }\n\n /** From `start`, find the first enabled row in direction `dir` and focus it. */\n private _focusFrom(list: readonly FlatNode[], start: number, dir: 1 | -1): void {\n for (let i = start; i >= 0 && i < list.length; i += dir) {\n if (!list[i].node.disabled) { this._focus(list[i].node.id); return; }\n }\n }\n\n /** Focus the parent row (nearest previous row with a smaller depth). */\n private _focusParent(list: readonly FlatNode[], index: number, depth: number): void {\n for (let i = index - 1; i >= 0; i--) {\n if (list[i].depth < depth) { this._focus(list[i].node.id); return; }\n }\n }\n\n /** Set the active id and move DOM focus to that row (after any re-render). */\n private _focus(id: string): void {\n this.setActive(id);\n queueMicrotask(() => {\n const rows = this.host.nativeElement.querySelectorAll<HTMLElement>('[data-tree-id]');\n rows.forEach(el => { if (el.dataset['treeId'] === id) el.focus(); });\n });\n }\n\n private _flatten(nodes: TreeNode[], depth: number, expanded: Set<string>): FlatNode[] {\n const result: FlatNode[] = [];\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n const hasChildren = !!node.children?.length;\n const isExp = expanded.has(node.id);\n result.push({ node, depth, isLast: i === nodes.length - 1, hasChildren, isExpanded: isExp });\n if (isExp && node.children?.length) {\n result.push(...this._flatten(node.children, depth + 1, expanded));\n }\n }\n return result;\n }\n\n private _collectExpanded(nodes: TreeNode[], ids: Set<string>): void {\n for (const n of nodes) {\n if (n.expanded) ids.add(n.id);\n if (n.children) this._collectExpanded(n.children, ids);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AA6CA;AAEA;;;;;;;;;;;AAWG;MAmGU,mBAAmB,CAAA;;AAErB,IAAA,KAAK,GAAQ,KAAK,CAAa,EAAE,4EAAC;;AAElC,IAAA,UAAU,GAAG,KAAK,CAAU,IAAI,iFAAC;;AAEjC,IAAA,SAAS,GAAI,KAAK,CAAU,IAAI,gFAAC;AAE1C;;;AAGG;AACM,IAAA,OAAO,GAAG,KAAK,CAAU,KAAK,8EAAC;AAExC;;;;AAIG;AACM,IAAA,KAAK,GAAG,KAAK,CAA8B,IAAI,4EAAC;;AAGhD,IAAA,SAAS,GAAG,KAAK,CAAS,qBAAqB,gFAAC;IAEhD,SAAS,GAAM,MAAM,EAAsB;IAC3C,UAAU,GAAK,MAAM,EAAY;IACjC,YAAY,GAAG,MAAM,EAAY;IACjC,UAAU,GAAK,MAAM,EAAY;;IAEjC,KAAK,GAAU,MAAM,EAAQ;AAEtC;;;AAGG;AACM,IAAA,WAAW,GAAG,KAAK,CAAc,IAAI,GAAG,EAAE,kFAAC;;AAE3C,IAAA,UAAU,GAAI,KAAK,CAAgB,IAAI,iFAAC;;AAExC,IAAA,QAAQ,GAAM,MAAM,CAAgB,IAAI,+EAAC;AAEjC,IAAA,MAAM,GAAG,MAAM,CAAa,EAAE,6EAAC;AAC/B,IAAA,IAAI,GAAK,MAAM,CAA0B,UAAU,CAAC;IAE5D,YAAY,GAAG,QAAQ,CAAa,MAC3C,IAAI,CAAC,QAAQ,CAAC,IAAI,CA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,EAAA,OAAA,EAAA,MAAA,EAAA,QAAA,EAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,wBAAwB,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,MAAA,EAAA,SAAA,EAAA,aAAA,EAAA,WAAA,EAAA,aAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,qBAAqB,8KAAE,qBAAqB,EAAA,QAAA,EAAA,gBAAA,EAAA,MAAA,EAAA,CAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,aAAA,EAAA,SAAA,EAAA,aAAA,CAAA,EAAA,OAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAiGtF,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAlG/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;oBACT,OAAO,EAAE,CAAC,eAAe,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,qBAAqB,CAAC;AAClG,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,UAAU,EAAE,IAAI;oBAChB,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2FT,EAAA,CAAA;AACF,iBAAA;;;AC5JD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@styloviz/tree-view",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "8 premium variants: collapsible tree, file explorer, tri-state checkboxes, org chart, tree table, searchable, drag & drop reordering and lazy load. Lazy loading, the tree-table columns and drag & drop reordering are Pro (`sv-tree-view-pro`); the free component renders the nodes you give it.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@angular/common": ">=21.0.0",
|
|
24
24
|
"@angular/core": ">=21.0.0",
|
|
25
|
-
"@styloviz/core": ">=0.1.0"
|
|
25
|
+
"@styloviz/core": ">=0.1.0",
|
|
26
|
+
"@styloviz/icons": ">=0.1.0"
|
|
26
27
|
},
|
|
27
28
|
"publishConfig": {
|
|
28
29
|
"access": "public"
|
|
@@ -75,6 +75,8 @@ declare class SvTreeViewComponent {
|
|
|
75
75
|
private _seededFromNodes;
|
|
76
76
|
constructor();
|
|
77
77
|
toggle(node: TreeNode): void;
|
|
78
|
+
/** One entry per ancestor level, for the indentation spacers. */
|
|
79
|
+
depthArray(depth: number): number[];
|
|
78
80
|
select(node: TreeNode, depth: number): void;
|
|
79
81
|
isSelected(id: string): boolean;
|
|
80
82
|
/** Roving tabindex: only the active treeitem is in the tab order. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styloviz-tree-view.d.ts","sources":["../../../../projects/tree-view-free/src/lib/tree-view.component.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"styloviz-tree-view.d.ts","sources":["../../../../projects/tree-view-free/src/lib/tree-view.component.ts"],"mappings":";;;UAsBiB,QAAQ;AACvB;AACA;AACA;AACA,eAAW,QAAQ;AACnB;AACA;AACA;AACD;UAEgB,QAAQ;AACvB,mBAAe,QAAQ;AACvB;AACA;AACA;AACA;AACD;UAEgB,kBAAkB;AACjC,mBAAe,QAAQ;AACvB;AACD;AAID;;;;;;;;;;;AAWG;AACH,cAkGa,mBAAmB;;oBAEhB,aAAA,CAAA,WAAA,CAAA,QAAA;;yBAEK,aAAA,CAAA,WAAA;;wBAED,aAAA,CAAA,WAAA;AAElB;;;AAGG;sBACa,aAAA,CAAA,WAAA;AAEhB;;;;AAIG;oBACW,aAAA,CAAA,WAAA,UAAA,WAAA;;wBAGI,aAAA,CAAA,WAAA;wBAEA,aAAA,CAAA,gBAAA,CAAA,kBAAA;yBACC,aAAA,CAAA,gBAAA,CAAA,QAAA;2BACE,aAAA,CAAA,gBAAA,CAAA,QAAA;yBACF,aAAA,CAAA,gBAAA,CAAA,QAAA;;oBAEL,aAAA,CAAA,gBAAA;AAEd;;;AAGG;0BACiB,aAAA,CAAA,WAAA,CAAA,GAAA;;yBAED,aAAA,CAAA,WAAA;;uBAEF,aAAA,CAAA,cAAA;AAEjB;AACA;2BAEqB,aAAA,CAAA,MAAA,CAAA,QAAA;;;;AA6BrB,iBAAa,QAAQ;;AAcrB;iBAIa,QAAQ;AAOrB;;AAKA;AAKA;AAEA;;;;AAIG;AACH,qBAAiB,aAAa,MAAM,QAAQ;;AA6B5C;;AAOA;;AAOA;;AAOA;AAQA;AAcA;oDA3LW,mBAAmB;sDAAnB,mBAAmB;AAiM/B;;;;","names":[]}
|