Skip to content

Enhanced Visual Parent/Child Relationships with Connecting Lines #31

Closed

Description

@malibio

Enhanced Visual Parent/Child Relationships with Connecting Lines

Implement modern hierarchical UI patterns with hover-revealed chevron controls and visual-only connecting lines for sophisticated tree navigation.

Dependencies

Related Issues

Requirements

Modern Chevron/Caret System

  • Hover-Revealed Interaction: Chevrons appear (opacity: 0 → 1) only on node hover with 150ms transition
  • Modern Icon Design: Contemporary chevron/caret (> → v) with 90-degree CSS rotation
  • Exclusive Click Target: Only chevron elements respond to clicks for expand/collapse operations
  • VS Code Pattern: Follows contemporary IDE standards for tree navigation
  • File Location: Enhance existing src/lib/design/components/BaseNode.svelte with chevron controls

Visual-Only Vertical Lines

  • Simple Implementation: border-left: 1px solid var(--color-border-subtle) on children containers
  • Non-Interactive Design: Lines are purely visual indicators with no click handlers or overlays
  • Clean Aesthetic: Based on Logseq's minimal approach without interactive border systems
  • Sibling Connection: Vertical lines connect siblings when parent node has children
  • Collapsed State Handling: Lines disappear when parent nodes are collapsed
  • File Location: Extend existing src/lib/components/NodeTree.svelte with line rendering

Design System Integration

  • Spacing: 24px indentation per nesting level using var(--ns-spacing-6)
  • Colors: var(--color-border-subtle) for connecting lines, var(--color-text-secondary) for chevrons
  • Typography: Leverage existing font system and icon components
  • Theming: Support both light and dark theme variants

Technical Implementation Notes

CSS Architecture Pattern

.node-children-container {
  position: relative;
  margin-left: var(--ns-spacing-6); /* 24px per nesting level */
}

.node-children {
  border-left: 1px solid var(--color-border-subtle);
}

.node-chevron {
  opacity: 0;
  transition: opacity 150ms ease-in-out, transform 150ms ease-in-out;
  transform-origin: center;
}

.node-container:hover .node-chevron {
  opacity: 1;
}

.node-chevron.expanded {
  transform: rotate(90deg);
}

Component Integration Pattern

  • BaseNode Enhancement: Add chevron control slot to existing BaseNode component structure
  • State Management: Extend current collapse/expand state with hover-based UI visibility
  • Event Handling: Click handlers exclusively on chevron elements, not connecting lines
  • Icon System: Leverage existing src/lib/design/components/icons/ SVG system for chevron rendering

Mock Data Structure Pattern

interface HierarchicalNodeData {
  id: string;
  content: string;
  parentId?: string;
  children: HierarchicalNodeData[];
  collapsed: boolean;
  depth: number;
  hasChildren: boolean;
}

const mockTreeData: HierarchicalNodeData[] = [
  {
    id: "project-root",
    content: "Project Planning",
    children: [
      {
        id: "research-phase",
        content: "Research Phase", 
        parentId: "project-root",
        children: [
          { id: "user-interviews", content: "User Interviews", parentId: "research-phase", children: [], collapsed: false, depth: 2, hasChildren: false },
          { id: "competitive-analysis", content: "Competitive Analysis", parentId: "research-phase", children: [], collapsed: false, depth: 2, hasChildren: false }
        ],
        collapsed: false,
        depth: 1,
        hasChildren: true
      }
    ],
    collapsed: false,
    depth: 0,
    hasChildren: true
  }
];

Acceptance Criteria

Visual Requirements

  • Chevrons appear on node hover with smooth 150ms fade-in transition
  • Chevrons disappear on mouse leave with smooth fade-out transition
  • Chevron rotates smoothly from > (collapsed) to v (expanded) state
  • Vertical lines connect sibling nodes when parent has children
  • Lines disappear when parent nodes are collapsed, maintaining clean hierarchy
  • Consistent 24px indentation per nesting level using design system spacing
  • Modern aesthetic matching VS Code and contemporary IDE tree patterns

Interaction Requirements

  • Only chevron elements respond to click events (not connecting lines or whitespace)
  • Hover state provides clear visual feedback before user interaction
  • Click on chevron immediately toggles expand/collapse state with animation
  • State changes persist across component re-renders and navigation
  • No unintended interactions from connecting lines, borders, or background areas

Accessibility Requirements

  • All chevron controls are keyboard accessible via standard Tab navigation
  • Space/Enter keys activate expand/collapse on focused chevron elements
  • Screen readers announce state changes with "expanded" or "collapsed" status
  • Focus indicators are clearly visible during keyboard navigation
  • ARIA attributes (aria-expanded, aria-controls, aria-label) provide semantic meaning
  • Minimum 44px touch targets for mobile device accessibility

Performance Requirements

  • Smooth 60fps animations during expand/collapse operations
  • No layout shift or visual jumping during hierarchy state changes
  • Efficient rendering for hierarchies containing 100+ nodes without performance degradation
  • Minimal impact on initial component mount and page load performance
  • GPU-accelerated CSS transforms where browser support is available

Integration Requirements

  • Seamless integration with existing BaseNode and TextNode component architecture
  • Compatible with current NodeTree.svelte implementation patterns
  • Maintains existing mock data service patterns and interfaces
  • No breaking changes to current node state management system
  • Consistent with established design system tokens and theming approach

Code Quality Requirements

  • All TypeScript compilation passes with strict type checking enabled
  • ESLint validation passes with no errors (warnings acceptable in development)
  • Prettier code formatting applied consistently throughout implementation
  • Svelte component validation passes with no accessibility violations
  • Unit test coverage >90% for new chevron and line rendering functionality

Resources & References

Existing Implementation Patterns

  • BaseNode Component: src/lib/design/components/BaseNode.svelte - Foundation for chevron integration
  • NodeTree Component: src/lib/components/NodeTree.svelte - Container for line rendering
  • Design System: src/lib/design/tokens/ - Spacing, color, and typography tokens
  • Icon System: src/lib/design/components/icons/ - SVG icon patterns for chevron rendering

Architecture Documentation

  • Component Structure: docs/architecture/components/design-system.md - Design system integration
  • State Management: docs/architecture/core/state-management.md - Component state patterns
  • Testing Strategy: docs/architecture/development/testing-patterns.md - Test implementation guidelines

UX Research References

  • Logseq Implementation: Research findings from /Users/malibio/Zed Projects/logseq analysis
  • Modern IDE Patterns: VS Code, GitHub, and contemporary tree navigation standards
  • Accessibility Standards: WCAG 2.1 compliance for hierarchical navigation interfaces

Definition of Done

Feature Completion

  • Feature works end-to-end in isolation with mock data
  • All acceptance criteria verified and demonstrated
  • Component handles edge cases appropriately (empty trees, single nodes, deep nesting)
  • Error states and loading states implemented where applicable
  • Keyboard navigation works throughout entire hierarchy
  • Mobile touch interaction patterns tested and validated

Code Quality

  • Follows established Svelte and TypeScript best practices
  • Component types are complete and accurate with no compilation errors
  • No browser console errors, warnings, or accessibility violations
  • Performance meets requirements (< 100ms for expand/collapse interactions)
  • Memory leaks prevented and cleanup implemented properly
  • Security considerations addressed (no XSS vectors, safe event handling)

Testing

  • Unit tests achieve >90% code coverage for new functionality
  • Integration tests cover main user workflows (expand/collapse, navigation)
  • Edge cases tested (empty states, maximum depth, rapid interactions)
  • Error conditions tested with appropriate fallback behavior
  • All tests pass consistently across multiple test runs
  • Test data cleanup and isolation implemented properly

Documentation

  • Component API documented with clear prop interfaces and examples
  • Usage examples provided showing common implementation patterns
  • Integration guide updated with hierarchical UI patterns
  • Accessibility documentation includes keyboard shortcuts and screen reader behavior
  • Code comments provided for complex logic (chevron positioning, line calculations)

Integration Readiness

  • Clean interfaces defined for future real data integration
  • No hard dependencies on incomplete or placeholder implementations
  • Mock implementations clearly documented and easily replaceable
  • Configuration options available for different hierarchy behaviors
  • Component ready for integration with upcoming LanceDB data layer

Activity

  1. added
    enhancement
    on Aug 10, 2025
  2. malibio commented on Aug 3, 2026

    @malibio
    CollaboratorAuthor

    Closing as substantially completed.

    The chevron system described here is shipped:

    • Chevron control with hover affordance, `aria-expanded`, and keyboard activation — `packages/desktop-app/src/lib/design/components/node-row.svelte:73-86`
    • Chevron positioning/styling (centered between parent and child circles) — `node-row.svelte:180-262`
    • Chevron icon asset — `packages/desktop-app/src/lib/design/icons/ui/chevron-right.ts`
    • Expansion state persistence and restoration — `packages/desktop-app/src/lib/services/node-expansion-coordinator.ts:169-254`
    • A second expand/collapse implementation exists in `packages/desktop-app/src/lib/components/node-tree.svelte:82-115`

    The one unimplemented piece is the visual connecting/indent-guide line between parent and children — indentation is currently margin-based, and there are no hits for indent-guide/hierarchy-line/connector styling. That is a small CSS addition, not a standing feature issue; it can be picked up as part of any hierarchy-visual polish work.

    Note also that this spec targets a file layout that no longer exists (`BaseNode.svelte`, `NodeTree.svelte`, `src/lib/design/tokens/`, in-repo `docs/`, LanceDB). The codebase is kebab-case with Svelte 5 runes, so the spec is not implementable as written regardless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions