npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@wavelet-programmer/ng-ui-common

v0.0.1

Published

Core utilities, services, and interfaces for BigLedger Angular UI components.

Readme

@bigledger/ng-ui-core

Core utilities, services, and interfaces for BigLedger Angular UI components.

Overview

This package provides the foundational utilities, services, and TypeScript interfaces that power all BigLedger Angular UI components. It includes state management, data handling, utility functions, and common interfaces.

Installation

# Configure npm for GitHub Packages
echo "@bigledger:registry=https://npm.pkg.github.com" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN" >> .npmrc

# Install the package
npm install @bigledger/ng-ui-core

Features

  • 🔧 State Management: Signal-based reactive state management
  • 📊 Data Services: Data manipulation and processing utilities
  • 🎯 Type Safety: Comprehensive TypeScript interfaces
  • Performance: Optimized utilities for large datasets
  • 🔄 Reactive: Built on Angular Signals for optimal performance

Key Exports

Services

import { 
  GridStateService,
  DataService,
  FilterService,
  SortService,
  ExportService
} from '@bigledger/ng-ui-core';

Interfaces

import {
  GridConfig,
  ColumnDefinition,
  DataSource,
  FilterModel,
  SortModel,
  SelectionModel
} from '@bigledger/ng-ui-core';

Utilities

import {
  createSignal,
  debounce,
  throttle,
  deepClone,
  formatValue,
  compareValues
} from '@bigledger/ng-ui-core';

Usage Examples

State Management

import { Component, inject } from '@angular/core';
import { GridStateService } from '@bigledger/ng-ui-core';

@Component({
  selector: 'app-example',
  providers: [GridStateService]
})
export class ExampleComponent {
  private gridState = inject(GridStateService);
  
  ngOnInit() {
    // Initialize state
    this.gridState.setColumns([
      { field: 'id', header: 'ID' },
      { field: 'name', header: 'Name' }
    ]);
    
    // Subscribe to state changes
    this.gridState.filteredData.subscribe(data => {
      console.log('Filtered data:', data);
    });
  }
}

Data Processing

import { DataService } from '@bigledger/ng-ui-core';

@Component({
  providers: [DataService]
})
export class DataComponent {
  private dataService = inject(DataService);
  
  processData(data: any[]) {
    // Sort data
    const sorted = this.dataService.sortData(data, [
      { field: 'name', direction: 'asc' }
    ]);
    
    // Filter data
    const filtered = this.dataService.filterData(sorted, {
      field: 'status',
      operator: 'equals',
      value: 'active'
    });
    
    return filtered;
  }
}

Custom Data Source

import { DataSource } from '@bigledger/ng-ui-core';
import { Observable } from 'rxjs';

export class ServerDataSource implements DataSource {
  getData(params: DataSourceParams): Observable<DataResult> {
    return this.http.get<DataResult>('/api/data', {
      params: {
        page: params.page,
        size: params.pageSize,
        sort: params.sortModel,
        filter: params.filterModel
      }
    });
  }
}

Core Interfaces

GridConfig

interface GridConfig {
  columns: ColumnDefinition[];
  data?: any[];
  dataSource?: DataSource;
  pagination?: PaginationConfig;
  sorting?: SortingConfig;
  filtering?: FilteringConfig;
  selection?: SelectionConfig;
  virtualScrolling?: VirtualScrollConfig;
  performance?: PerformanceConfig;
}

ColumnDefinition

interface ColumnDefinition {
  field: string;
  header?: string;
  width?: number | string;
  type?: DataType;
  sortable?: boolean;
  filterable?: boolean;
  editable?: boolean;
  cellRenderer?: CellRenderer;
  valueFormatter?: ValueFormatter;
  comparator?: Comparator;
}

DataSource

interface DataSource {
  getData(params: DataSourceParams): Observable<DataResult>;
  getTotalCount?(): Observable<number>;
  destroy?(): void;
}

State Management

The core package uses Angular Signals for reactive state management:

// Grid state signals
readonly columns = signal<ColumnDefinition[]>([]);
readonly data = signal<any[]>([]);
readonly filteredData = computed(() => this.applyFilters(this.data()));
readonly sortedData = computed(() => this.applySorting(this.filteredData()));
readonly paginatedData = computed(() => this.applyPagination(this.sortedData()));

Utilities

Data Manipulation

import { 
  sortData, 
  filterData, 
  groupData, 
  aggregateData 
} from '@bigledger/ng-ui-core';

// Sort data
const sorted = sortData(data, { field: 'name', direction: 'asc' });

// Filter data
const filtered = filterData(data, { field: 'age', operator: 'gt', value: 18 });

// Group data
const grouped = groupData(data, 'category');

// Aggregate data
const stats = aggregateData(data, 'amount', ['sum', 'avg', 'min', 'max']);

Performance Utilities

import { 
  debounce, 
  throttle, 
  memoize, 
  createTrackByFn 
} from '@bigledger/ng-ui-core';

// Debounced search
const debouncedSearch = debounce((term: string) => {
  this.search(term);
}, 300);

// Throttled scroll handler
const throttledScroll = throttle((event: Event) => {
  this.handleScroll(event);
}, 16);

// Memoized computation
const memoizedCalc = memoize((data: any[]) => {
  return expensiveCalculation(data);
});

// TrackBy function generator
const trackByFn = createTrackByFn<Item>('id');

Value Formatting

import { formatValue, parseValue } from '@bigledger/ng-ui-core';

// Format values for display
const formatted = formatValue(1234.56, {
  type: 'currency',
  currency: 'USD',
  locale: 'en-US'
});

// Parse string values
const parsed = parseValue('1,234.56', 'number');

Type Definitions

Events

interface GridEvent {
  type: string;
  data?: any;
  source?: any;
}

interface CellEditEvent extends GridEvent {
  rowIndex: number;
  field: string;
  oldValue: any;
  newValue: any;
}

interface SelectionEvent extends GridEvent {
  selectedRows: any[];
  selectedData: any[];
}

Configuration Types

type SortDirection = 'asc' | 'desc';
type FilterOperator = 'equals' | 'contains' | 'startsWith' | 'endsWith' | 'gt' | 'lt' | 'gte' | 'lte';
type SelectionMode = 'single' | 'multiple';
type DataType = 'text' | 'number' | 'date' | 'boolean' | 'currency';

Browser Support

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

Dependencies

Peer Dependencies

  • @angular/core: ^20.1.0
  • @angular/common: ^20.1.0
  • rxjs: ~7.8.0

Development

# Running unit tests
nx test core

# Build the library
nx build core

# Lint the code
nx lint core

License

MIT License - see LICENSE file for details.

Support