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

@simmalugnt-se/consent-ui

v0.2.1

Published

`@simmalugnt-se/consent-ui` ger webbplatser samma gränssnitt och grundinställningar för c15t i offline-läge. Paketet innehåller banner, inställningsdialog, svenska och engelska standardtexter samt gemensam CSS.

Readme

Consent UI

@simmalugnt-se/consent-ui ger webbplatser samma gränssnitt och grundinställningar för c15t i offline-läge. Paketet innehåller banner, inställningsdialog, svenska och engelska standardtexter samt gemensam CSS.

Paketet hittar inte cookies eller externa tjänster. Webbplatsen måste ange vilka kategorier och skript den använder. Projektet consent-audit kontrollerar den publicerade webbplatsens beteende.

Installera paketet

Installera fasta versioner av Consent UI och c15t:

npm install --save-exact @simmalugnt-se/[email protected] @c15t/[email protected]

Importera stilen en gång i webbplatsens globala CSS eller rotlayout:

@import "@simmalugnt-se/consent-ui/styles.css";

Skapa webbplatsens konfiguration

Lägg webbplatsens namn, kategorier, texter och skript i en egen konfigurationsfil. En webbplats som bara använder nödvändig lagring behöver följande konfiguration:

import type { SiteConsentConfig } from "@simmalugnt-se/consent-ui";

export const consentConfig = {
	siteName: "Min webbplats",
	categories: ["necessary"],
} satisfies SiteConsentConfig;

necessary måste alltid finnas. Lägg bara till functionality, experience, measurement eller marketing när webbplatsen använder tjänster i den kategorin.

Lägg till en lokal provider

Den lokala providern kopplar webbplatsens konfiguration och språk till paketet. Den ger också webbplatsen en stabil integrationspunkt om konfigurationen ändras senare.

"use client";

import { SiteConsentProvider as SharedSiteConsentProvider } from "@simmalugnt-se/consent-ui";
import type { ReactNode } from "react";
import { consentConfig } from "./consent-config";

type Props = {
	children: ReactNode;
	locale?: string;
};

export function SiteConsentProvider({ children, locale }: Props) {
	return (
		<SharedSiteConsentProvider config={consentConfig} locale={locale}>
			{children}
		</SharedSiteConsentProvider>
	);
}

Lägg den lokala providern runt hela webbplatsen:

import type { ReactNode } from "react";
import { SiteConsentProvider } from "./site-consent-provider";

export function App({ children }: { children: ReactNode }) {
	return <SiteConsentProvider>{children}</SiteConsentProvider>;
}

Lägg till länken för cookieinställningar

Importera ConsentSettingsLink direkt i sidfoten. Komponenten renderar en knapp som öppnar inställningsdialogen.

import { ConsentSettingsLink } from "@simmalugnt-se/consent-ui";

export function Footer() {
	return (
		<footer>
			<ConsentSettingsLink>Cookieinställningar</ConsentSettingsLink>
		</footer>
	);
}

Länken måste ligga under SiteConsentProvider. Om konfigurationen har enabled: false ska webbplatsen inte rendera länken.

Lägg till skript som kräver samtycke

Installera c15t:s skriptadaptrar när webbplatsen använder en tjänst som ska starta efter samtycke:

npm install --save-exact @c15t/[email protected]

Lägg adaptern i webbplatsens konfiguration. Det här exemplet startar Google Tag Manager genom c15t:

import { googleTagManager } from "@c15t/scripts/google-tag-manager";
import type { SiteConsentConfig } from "@simmalugnt-se/consent-ui";

export const consentConfig = {
	siteName: "Min webbplats",
	categories: ["necessary", "measurement", "marketing"],
	scripts: [googleTagManager({ id: "GTM-XXXXXXX" })],
} satisfies SiteConsentConfig;

c15t styr bara skript som webbplatsen registrerar. Kontrollera därför den publicerade webbplatsen med consent-audit efter varje ny integration.

Anpassa texter och utseende

Använd messages i konfigurationen för att ersätta standardtexter. Använd följande CSS-variabler för webbplatsens utseende:

  • --consent-font
  • --consent-text
  • --consent-muted
  • --consent-surface
  • --consent-border
  • --consent-hover
  • --consent-accent
  • --consent-radius

Kontrollera installationen

Publicera webbplatsen och lägg dess URL i config/sites.yml. Kör sedan auditverktyget och granska den första rapporten.

Auditverktyget ändrar inte webbplatskod och godkänner inte nya fynd. Om rapporten visar en ny extern tjänst måste projektet först klassificera tjänsten och därefter styra dess laddning i koden.

Utveckla paketet lokalt

Installera paketet från ../consent-ui när du utvecklar paketet och webbplatsen samtidigt. Använd en publicerad, fast version i kod som ska driftsättas.

Paketet behåller lågnivåexporterna ConsentProvider, ConsentBanner, ConsentDialog och ConsentDialogLink för befintliga installationer.