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

tracking-module

v1.2.2

Published

Web Component para tracking de rutas y paquetes - Estilos completamente encapsulados en Shadow DOM

Downloads

11

Readme

Tracking Module

Web Component para tracking de rutas y paquetes de última milla. Verdadero Web Component independiente que funciona en cualquier proyecto.

✨ Características v1.2.0+

  • 100% Independiente - NO requiere React en tu proyecto
  • Compatible con cualquier versión de React (16, 17, 18, 19, o sin React)
  • Framework agnóstico - Vue, Angular, Vanilla JS, etc.
  • 🔒 Completamente aislado con Shadow DOM
  • React bundled internamente - Sin conflictos de dependencias
  • 📦 Gestión de estado con Zustand
  • 🎨 Estilos completamente encapsulados - NO afectan tu sitio web
  • 🚀 Múltiples instancias en la misma página
  • 🎯 Sin imports de CSS - Todo autocontenido

⚠️ IMPORTANTE v1.2.0:

  • NO importes el CSS manualmente - Los estilos están dentro del Shadow DOM
  • Los estilos del componente NO afectan tu sitio web
  • Los estilos de tu sitio NO afectan el componente

Instalación

npm install tracking-module

Uso

En HTML Vanilla (sin React)

<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tracking Module</title>
    <!-- ⚠️ NO importes el CSS - está dentro del Shadow DOM -->
</head>
<body>
    <!-- Usar el web component directamente -->
    <tracking-module
        api-url="https://tu-api.com/api/"
        api-key="tu-api-key-aqui"
        initial-date="2025-04-30"
        base-path="/tracking">
    </tracking-module>

    <!-- Cargar el módulo -->
    <script type="module">
        import 'tracking-module';
    </script>
</body>
</html>

En React (16, 17, 18, 19 - Todas las versiones)

import React from 'react';
// ⚠️ SOLO importa el JS - NO el CSS (está en Shadow DOM)
import 'tracking-module';

function App() {
    return (
        <div>
            <tracking-module
                api-url="https://tu-api.com/api/"
                api-key="tu-api-key-aqui"
                initial-date="2025-04-30"
                base-path="/tracking"
            />
        </div>
    );
}

export default App;

Para React 16 (class components):

import React from 'react';
// ⚠️ SOLO importa el JS - NO el CSS (está en Shadow DOM)
import 'tracking-module';

class App extends React.Component {
    render() {
        return (
            <tracking-module
                api-url="https://tu-api.com/api/"
                api-key="tu-api-key-aqui"
                initial-date="2025-04-30"
            />
        );
    }
}

export default App;

En Vue.js

<template>
    <div>
        <tracking-module
            api-url="https://tu-api.com/api/"
            api-key="tu-api-key-aqui"
            initial-date="2025-04-30"
            base-path="/tracking">
        </tracking-module>
    </div>
</template>

<script>
import 'tracking-module';

export default {
    name: 'TrackingPage',
    mounted() {
        // El componente ya está registrado
    }
}
</script>

En Angular

import { Component, OnInit, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import 'tracking-module';

@Component({
    selector: 'app-tracking',
    template: `
        <tracking-module
            api-url="https://tu-api.com/api/"
            api-key="tu-api-key-aqui"
            initial-date="2025-04-30"
            base-path="/tracking">
        </tracking-module>
    `,
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class TrackingComponent implements OnInit {
    ngOnInit() {
        // El componente ya está registrado
    }
}

Atributos del Componente

El web component <tracking-module> acepta los siguientes atributos:

| Atributo | Tipo | Requerido | Default | Descripción | |----------|------|-----------|---------|-------------| | api-url | String | No | https://api.bigsmart.mx/ | URL base del API | | api-key | String | No | - | API Key para autenticación | | initial-date | String | No | Fecha actual | Fecha inicial en formato YYYY-MM-DD | | base-path | String | No | /app/tracking | Path base para enrutamiento |

Configuración Avanzada

Autenticación

El componente soporta dos métodos de autenticación:

  1. API Key (recomendado para web components): Se pasa a través del atributo api-key
  2. Token de sesión: El componente buscará automáticamente un token en sessionStorage o localStorage bajo la clave big_token

Múltiples Instancias

Puedes tener múltiples instancias del componente en la misma página, cada una con su propia configuración:

<tracking-module
    api-url="https://api1.com/"
    api-key="key1">
</tracking-module>

<tracking-module
    api-url="https://api2.com/"
    api-key="key2">
</tracking-module>

Estilos Personalizados

El componente usa Shadow DOM, por lo que los estilos están completamente encapsulados. Para personalizar los colores principales, puedes modificar las variables CSS custom properties dentro del componente:

tracking-module::part(container) {
    --primary-color: rgb(96, 33, 102);
    --secondary-color: rgb(7, 184, 107);
}

Desarrollo

Requisitos

  • Node.js >= 20.15.1
  • npm >= 10.x

Instalación local

git clone https://github.com/christianirack/tracking-module.git
cd tracking-module
npm install

Scripts disponibles

# Desarrollo
npm start

# Build para producción (aplicación normal)
npm run build

# Build para librería (web component)
npm run build:lib

# Formatear código
npm run format

# Verificar formato
npm run format:check

Tecnologías

  • React 19.2
  • Vite 7.x
  • Zustand (gestión de estado)
  • React Bootstrap
  • Leaflet (mapas)
  • Axios
  • Moment.js

Licencia

MIT

Autor

Christian Irack

Contribuir

Las contribuciones son bienvenidas. Por favor, abre un issue o pull request en el repositorio.

Soporte

Para problemas o preguntas, por favor abre un issue en el repositorio de GitHub.