Skip to content

feat(createNested): add active state management#137

Merged
johnleider merged 3 commits intomasterfrom
feat/nested-active
Feb 20, 2026
Merged

feat(createNested): add active state management#137
johnleider merged 3 commits intomasterfrom
feat/nested-active

Conversation

@johnleider
Copy link
Copy Markdown
Member

Summary

Adds active/highlighted state management to createNested, independent of selected (checked) and opened (expanded) states. This enables tree views, navigation drawers, and nested lists to track which item is currently "active" (e.g., the file open in an editor sidebar).

Three Independent States

State Controls Example
Selected (checked) v-model / checkbox Files checked for bulk delete
Opened (expanded) v-model:opened / toggle Folder showing children
Active (highlighted) v-model:active / activator Current file in sidebar

API Additions

Options

  • active: 'single' | 'multiple' — controls how many items can be active (default: 'single')

Context (tree-level)

  • activeIds — reactive Set<ID> of active item IDs
  • activeItems — computed Set of active item instances
  • activeIndexes — computed Set<number> of active item indexes (mirrors selectedIndexes)
  • activate(ids) — activate one or more items
  • deactivate(ids) — deactivate one or more items
  • activated(id) — check if an item is active
  • deactivateAll() — clear all active state

Ticket (per-item)

  • isActive — reactive ref
  • activate() — activate this item
  • deactivate() — deactivate this item

Registration

  • active: true — set initial active state on register

Behavior

  • Single mode: activating an item deactivates all others
  • Multiple mode: no limit on concurrent active items
  • Cleanup on unregister, clear, and cascade delete
  • Zero impact on existing selected/opened state

Checklist

  • TypeScript types updated
  • Implementation complete
  • All 2745 existing tests pass
  • Typecheck clean
  • Lint clean
  • Knip/Sherif clean

- Add activeIds, activeItems, activeIndexes reactive state
- Add activate/deactivate/activated/deactivateAll methods
- Add isActive/activate/deactivate to ticket interface
- Add NestedActiveMode type ('single' | 'multiple')
- Add active option to NestedOptions/NestedContextOptions
- Support initial active state via registration
- Clean up activeIds on unregister/clear
- Single mode: activating clears other active items
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 13, 2026

Open in StackBlitz

commit: ff9f8f2

@johnleider johnleider merged commit 51be2b4 into master Feb 20, 2026
11 checks passed
@johnleider johnleider deleted the feat/nested-active branch February 20, 2026 23:09
@johnleider johnleider self-assigned this Mar 10, 2026
@johnleider johnleider added this to the v0.1.x milestone Mar 10, 2026
johnleider added a commit that referenced this pull request Mar 21, 2026
* feat(createNested): add active state management

- Add activeIds, activeItems, activeIndexes reactive state
- Add activate/deactivate/activated/deactivateAll methods
- Add isActive/activate/deactivate to ticket interface
- Add NestedActiveMode type ('single' | 'multiple')
- Add active option to NestedOptions/NestedContextOptions
- Support initial active state via registration
- Clean up activeIds on unregister/clear
- Single mode: activating clears other active items

* chore(createNested): clean up comments

* feat(createNested): add active state tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant