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

@x-via/intranet-shell

v0.2.1

Published

Chrome + componentes estruturais da intranet X-VIA (Header, PageLayout, PageHeader, DataTable, EmptyState) + XviaAuthProvider (dev/keycloak).

Readme

@x-via/intranet-shell

Chrome + componentes estruturais da intranet X-VIA e o provider de autenticação que tira o auth das mãos dos apps. O mesmo código roda em dev (usuário simulado, papel por seletor) e em produção (Keycloak, papel vindo do claim app_roles).

Instalação (npm público)

npm install @x-via/intranet-shell

Peer deps: react >=18, react-dom >=18, @supabase/supabase-js >=2. Requer o @x-via/tailwind-preset (tema/tokens) no app.

Autenticação

Envolva o app com o XviaAuthProvider (ele recebe o client do Supabase, não cria):

import { XviaAuthProvider, RequireAuth, PageLayout, useXviaAuth } from "@x-via/intranet-shell";
import { createClient } from "@supabase/supabase-js";

const supabase = createClient(import.meta.env.VITE_SUPABASE_URL, import.meta.env.VITE_SUPABASE_ANON_KEY);

export default function App() {
  return (
    <XviaAuthProvider client={supabase} slug="financeiro">
      <RequireAuth>
        <PageLayout appName="Financeiro" title="Lançamentos">
          <Conteudo />
        </PageLayout>
      </RequireAuth>
    </XviaAuthProvider>
  );
}

function Conteudo() {
  const { user, role, roles } = useXviaAuth();  // role = papel NESTE app
  return <p>{user?.email} — {role}</p>;
}

Variáveis de ambiente

| Variável | Valores | Default | Efeito | |---|---|---|---| | VITE_XVIA_AUTH_MODE | dev | keycloak | keycloak | Escolhe o modo | | VITE_APP_SLUG | ex.: financeiro | (usa a prop slug) | Slug; a prop tem precedência |

Travas de segurança: o default é sempre keycloak — ausência de variável nunca vira dev. Se VITE_XVIA_AUTH_MODE=dev e o build for de produção (import.meta.env.PROD), o provider lança erro na inicialização ("Modo dev de autenticação não é permitido em build de produção"). Em dev há um console.warn visível e o seletor de papel aparece no Header.

useXviaAuth()

{ loading, isAuthenticated, user, role, roles, signIn, signOut, mode }

role: 'viewer' | 'editor' | 'admin' | null (papel neste app, pelo slug). roles: Record<string,string> (claim app_roles completo).

Componentes estruturais

PageLayout (Header fixo + container), PageHeader (título/descrição/ações), DataTable (cabeçalho, zebra, densidade, loading, paginação), EmptyState (ícone/título/texto/ação), Header (logo, app, avatar, Sair, seletor de papel em dev). Todos consomem os tokens do @x-via/tailwind-preset (nenhuma cor literal) e aceitam className.

import { DataTable, EmptyState } from "@x-via/intranet-shell";

<DataTable
  columns={[{ key: "nome", header: "Nome" }, { key: "valor", header: "Valor", align: "right" }]}
  rows={rows}
  empty={<EmptyState title="Nada por aqui" description="Cadastre o primeiro item." />}
/>