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

@blazorapp3/counter-element

v0.1.2

Published

Blazor WebAssembly custom element <counter-element> distribuido como paquete npm con wrapper React opcional.

Readme

@blazorapp3/counter-element

Paquete npm que distribuye el custom element <counter-element> generado por una app Blazor WebAssembly.

Instalación

npm install @blazorapp3/counter-element

Modos de uso

Este paquete soporta dos modos:

  1. External host (servidor propio): Sirves tú los assets publicados de Blazor bajo una ruta (por ej. /blazor/).
  2. Self-contained: Usas directamente los assets empacados en el paquete (quedan en dist/blazor/).

El build script ya copió todo wwwroot dentro del paquete, así que puedes usar self-contained inmediatamente.


1. External host

Publica tu proyecto Blazor (dotnet publish) y sirve la carpeta wwwroot resultante (por ejemplo bajo /blazor/). Asegúrate de incluir _framework/* y counter-element-events.js.

HTML (External host)

<script type="module">
  import { ensureBlazorStarted } from '@blazorapp3/counter-element';
  await ensureBlazorStarted({ base: '/blazor/', mode: 'external' });
</script>
<counter-element start="3" increment-step="2"></counter-element>

2. Self-contained

No necesitas servir tus propios assets. El loader usará los archivos empaquetados.

HTML (Self-contained)

<script type="module">
  import { ensureBlazorStarted } from '@blazorapp3/counter-element';
  await ensureBlazorStarted(); // mode self-contained por defecto
</script>
<counter-element start="1" increment-step="1"></counter-element>

Uso en React (External host)

import React, { useEffect } from 'react';
import { ensureBlazorStarted } from '@blazorapp3/counter-element';
import { CounterElement } from '@blazorapp3/counter-element/react';

export default function Demo() {
  useEffect(() => { ensureBlazorStarted({ base: '/blazor/', mode: 'external' }); }, []);
  return <CounterElement start={5} incrementStep={2} onCountChanged={v => console.log(v)} />;
}

Uso en React (Self-contained)

import React, { useEffect } from 'react';
import { ensureBlazorStarted } from '@blazorapp3/counter-element';
import { CounterElement } from '@blazorapp3/counter-element/react';

export default function Demo() {
  useEffect(() => { ensureBlazorStarted(); }, []); // self-contained
  return <CounterElement start={2} incrementStep={3} onCountChanged={v => console.log(v)} />;
}

Notas

  • El loader autodetecta modo: si no pasas base, asume self-contained.
  • Puedes forzar modo: ensureBlazorStarted({ mode: 'self-contained' }) o ensureBlazorStarted({ base: '/blazor/', mode: 'external' }).
  • Si reduces tamaño, podrías eliminar archivos no usados (iconos, sample-data) en el paso de copia.

Licencia

MIT