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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jtejidov/timeline-library

v1.2.0

Published

A simple and flexible JavaScript library for creating timeline components. Supports both Vanilla JS and Angular implementations.

Readme

Timeline Library

Una librería JavaScript simple y flexible para crear componentes de línea de tiempo. Soporta tanto implementaciones en Vanilla JavaScript como en Angular.

🚀 Características

  • Vanilla JavaScript: Funciona en cualquier proyecto web
  • Angular Support: Componente nativo para Angular 12+
  • TypeScript: Completamente tipado para Angular
  • Responsive: Se adapta a diferentes tamaños de pantalla
  • Customizable: Múltiples temas y opciones de configuración
  • Interactivo: Eventos de click, eliminación y más
  • Ligero: Sin dependencias externas para la versión vanilla

Instalación

npm install @jtejidov/timeline-library

📖 Uso

Vanilla JavaScript

const { Timeline } = require('@jtejidov/timeline-library');

// Crear una nueva instancia de timeline
const timeline = new Timeline('#timeline-container', {
    orientation: 'vertical',
    showDates: true,
    dateFormat: 'DD/MM/YYYY'
});

// Agregar eventos
timeline.addEvent({
    title: 'Evento 1',
    date: '2023-01-15',
    description: 'Descripción del primer evento',
    type: 'success'
});

Angular

// app.module.ts
import { TimelineModule } from '@jtejidov/timeline-library/angular';

@NgModule({
  imports: [TimelineModule],
  // ...
})
export class AppModule { }
<!-- app.component.html -->
<lib-timeline
  [events]="events"
  [options]="{ orientation: 'vertical', showDates: true }"
  (eventClick)="onEventClick($event)"
></lib-timeline>
// app.component.ts
import { TimelineEvent } from '@jtejidov/timeline-library/angular';

export class AppComponent {
  events: TimelineEvent[] = [
    {
      id: 1,
      title: 'Evento 1',
      date: '2023-01-15',
      description: 'Descripción del evento',
      type: 'success'
    }
  ];

  onEventClick(event: TimelineEvent): void {
    console.log('Evento clickeado:', event);
  }
}

📚 Documentación Completa

Vanilla JavaScript

Angular

HTML

<!DOCTYPE html>
<html>
<head>
    <title>Mi Timeline</title>
</head>
<body>
    <div id="timeline-container"></div>
    
    <script src="path/to/your/bundle.js"></script>
</body>
</html>

JavaScript

const { Timeline } = require('@jtejidov/timeline-library');

// Crear una nueva instancia de timeline
const timeline = new Timeline('#timeline-container', {
    orientation: 'vertical', // 'vertical' o 'horizontal'
    theme: 'default',
    showDates: true,
    dateFormat: 'DD/MM/YYYY' // 'DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY-MM-DD'
});

// Agregar eventos
timeline.addEvent({
    title: 'Evento 1',
    date: '2023-01-15',
    description: 'Descripción del primer evento',
    type: 'success' // 'default', 'success', 'warning', 'danger'
});

timeline.addEvent({
    title: 'Evento 2',
    date: '2023-02-20',
    description: 'Descripción del segundo evento',
    type: 'warning'
});

API del Componente Timeline

Constructor

new Timeline(container, options)

Parámetros:

  • container (string|HTMLElement): Selector CSS o elemento DOM contenedor
  • options (Object): Opciones de configuración

Opciones disponibles:

  • orientation (string): 'vertical' o 'horizontal' (default: 'vertical')
  • theme (string): Tema visual (default: 'default')
  • showDates (boolean): Mostrar fechas (default: true)
  • dateFormat (string): Formato de fecha (default: 'YYYY-MM-DD')

Métodos

addEvent(event)

Agrega un evento a la línea de tiempo.

timeline.addEvent({
    id: 'evento-1', // opcional, se genera automáticamente si no se proporciona
    title: 'Título del evento',
    date: '2023-01-15', // fecha en formato válido
    description: 'Descripción opcional',
    type: 'success' // 'default', 'success', 'warning', 'danger'
});

removeEvent(eventId)

Elimina un evento por su ID.

timeline.removeEvent('evento-1');

getEvents()

Obtiene todos los eventos.

const events = timeline.getEvents();
console.log(events);

clearEvents()

Elimina todos los eventos.

timeline.clearEvents();

destroy()

Destruye la instancia y limpia el DOM.

timeline.destroy();

Utilidades

La librería también incluye funciones utilitarias:

const { utils } = require('@jtejidov/timeline-library');

// Validar evento
const isValid = utils.validateEvent({
    title: 'Mi evento',
    date: '2023-01-15'
});

// Ordenar eventos por fecha
const sortedEvents = utils.sortEventsByDate(events);

// Filtrar eventos por rango de fechas
const filteredEvents = utils.filterEventsByDateRange(
    events, 
    new Date('2023-01-01'), 
    new Date('2023-12-31')
);

// Agrupar eventos por año
const groupedEvents = utils.groupEventsByYear(events);

// Generar ID único
const uniqueId = utils.generateId();

Ejemplo Completo

const { Timeline, utils } = require('@jtejidov/timeline-library');

// Crear timeline
const timeline = new Timeline('#my-timeline', {
    orientation: 'vertical',
    showDates: true,
    dateFormat: 'DD/MM/YYYY'
});

// Datos de ejemplo
const events = [
    {
        title: 'Inicio del proyecto',
        date: '2023-01-01',
        description: 'Comenzamos el desarrollo',
        type: 'success'
    },
    {
        title: 'Primera release',
        date: '2023-06-15',
        description: 'Lanzamiento de la versión 1.0',
        type: 'success'
    },
    {
        title: 'Bug crítico encontrado',
        date: '2023-07-20',
        description: 'Se encontró un error que afecta la funcionalidad',
        type: 'danger'
    },
    {
        title: 'Parche de seguridad',
        date: '2023-07-25',
        description: 'Se aplicó el parche para resolver el bug',
        type: 'warning'
    }
];

// Agregar eventos
events.forEach(event => {
    if (utils.validateEvent(event)) {
        timeline.addEvent(event);
    }
});

Estilos CSS

La librería incluye estilos básicos, pero puedes personalizarlos sobrescribiendo las clases CSS:

/* Personalizar el contenedor */
.timeline-container {
    font-family: 'Tu fuente preferida', sans-serif;
}

/* Personalizar eventos */
.timeline-event {
    border-left: 4px solid #007bff;
}

/* Personalizar marcadores */
.timeline-marker {
    background: #custom-color;
}

Licencia

ISC

Autor

jtejidov