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

@system-capabilities/lit

v1.1.1

Published

Lit components for system-capabilities detection and validation

Readme

@system-capabilities/lit

Componentes Lit (Web Components) para detección y validación de capacidades del sistema.

Instalación

Via npm

npm install @system-capabilities/lit

Via CDN (para sitios estáticos/SSG)

<!-- UMD Bundle (incluye todas las dependencias) -->
<script src="https://unpkg.com/@system-capabilities/[email protected]/dist/system-capabilities-lit.umd.min.js"></script>

<!-- O desde jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/@system-capabilities/[email protected]/dist/system-capabilities-lit.umd.min.js"></script>

<!-- Usar los componentes -->
<script>
  // Los componentes están automáticamente registrados
  const status = document.createElement('system-status');
  status.setAttribute('size', 'large');
  status.setAttribute('autoCheck', '');
  document.body.appendChild(status);
</script>

Componentes

SystemStatus

Círculo de estado que muestra el nivel de compatibilidad del sistema mediante colores:

  • 🟢 Verde: Sistema compatible
  • 🟡 Amarillo: Advertencias
  • 🔴 Rojo: Problemas críticos
<script type="module">
  import '@system-capabilities/lit';
</script>

<system-status
  .requirements=${{
    features: { webGL: true, localStorage: true },
    device: { minMemory: 4, minCores: 2 }
  }}
  size="medium"
  autoCheck
  showTooltip
></system-status>

Propiedades

  • requirements (Object): Requisitos del sistema a validar
  • size ('small' | 'medium' | 'large'): Tamaño del círculo
  • autoCheck (boolean): Verificar automáticamente al cargar
  • showTooltip (boolean): Mostrar tooltip con información

Eventos

  • status-change: Se dispara cuando cambia el estado
  • click: Se dispara al hacer click en el círculo
const status = document.querySelector('system-status');

status.addEventListener('status-change', (e) => {
  console.log('Estado:', e.detail.status);
  console.log('Fallos:', e.detail.failures);
});

status.addEventListener('click', (e) => {
  console.log('Capacidades:', e.detail.capabilities);
});

SystemChecker

Componente completo con modal para verificar requisitos y mostrar detalles.

<system-checker
  .requirements=${{
    features: { webGL: true },
    device: { minMemory: 4 }
  }}
  autoCheck
  showOnFail
></system-checker>

Propiedades

  • requirements (Object): Requisitos del sistema a validar
  • autoCheck (boolean): Verificar automáticamente al cargar
  • showOnFail (boolean): Mostrar modal si hay fallos
  • open (boolean): Si el modal debe estar abierto

Eventos

  • check-complete: Se dispara cuando completa la verificación
  • modal-open: Se dispara cuando se abre el modal
  • modal-close: Se dispara cuando se cierra el modal
const checker = document.querySelector('system-checker');

checker.addEventListener('check-complete', (e) => {
  console.log('Pasó:', e.detail.passed);
  console.log('Fallos:', e.detail.failures);
});

Métodos

// Verificar el sistema manualmente
checker.checkSystem();

// Abrir el modal manualmente
checker.openModal();

// Cerrar el modal
checker.closeModal();

Formato de requisitos

const requirements = {
  features: {
    webGL: true,
    localStorage: true,
    serviceWorker: true
  },
  device: {
    minMemory: 4,      // GB
    minCores: 2,       // Núcleos CPU
    mobile: false      // true/false
  },
  screen: {
    minWidth: 1024,    // pixels
    minHeight: 768
  },
  network: {
    minDownlink: 1.5,  // Mbps
    maxRTT: 300        // ms
  }
};

Uso en frameworks

Vanilla JS

<!DOCTYPE html>
<html>
<head>
  <script type="module">
    import '@system-capabilities/lit';

    const requirements = {
      features: { webGL: true }
    };

    const status = document.querySelector('system-status');
    status.requirements = requirements;
  </script>
</head>
<body>
  <system-status size="large" autoCheck></system-status>
</body>
</html>

React

import '@system-capabilities/lit';

function App() {
  const requirements = {
    features: { webGL: true }
  };

  return (
    <system-checker
      requirements={requirements}
      autoCheck={true}
      showOnFail={true}
    />
  );
}

Vue

<template>
  <system-status
    :requirements="requirements"
    size="medium"
    autoCheck
  />
</template>

<script setup>
import '@system-capabilities/lit';
import { ref } from 'vue';

const requirements = ref({
  features: { webGL: true }
});
</script>

Astro

---
// Este import puede estar en el servidor
---

<script>
  // Este código se ejecuta en el cliente
  import '@system-capabilities/lit';
</script>

<system-checker
  autoCheck
  showOnFail
  client:load
/>

Estilos personalizados

Los componentes usan Shadow DOM, pero exponen CSS custom properties:

system-status {
  --status-success-color: #43a047;
  --status-warning-color: #fb8c00;
  --status-error-color: #e53935;
}

Licencia

MIT