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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ariatype/ariatype

v1.0.1

Published

TypeScript type definitions for WAI-ARIA accessibility.

Downloads

7

Readme

@ariatype/ariatype

Ariatype provides TypeScript with complete type definitions for WAI-ARIA accessibility. The goal of this project is to further enhance developer experience and understanding of WAI-ARIA accessibility best practices.

Installation

npm install @ariatype/ariatype -D

Usage

import { AriaTypes } from "@ariatype/ariatype";

const aria: AriaTypes = {
  "aria-atomic": "true",
  role: "alert",
};

Requiring Aria Attributes

Use PartiallyRequiredAriaTypes to require WAI-Attributes for a TypeScript type:

import type { PartiallyRequiredAriaTypes } from "@ariatype/ariatype";

// Valid
const aria: PartiallyRequiredAriaTypes<"aria-atomic" | "role"> = {
  "aria-atomic": "true",
  role: "alert",
};

// Invalid
// Property "aria-atomic" missing
const aria: PartiallyRequiredAriaTypes<"aria-atomic" | "role"> = {
  role: "alert",
};

Example Use Case

The following example shows how Ariatype may be used to enforce type-safe WAI-ARIA attributes on a React component using PartiallyRequiredAriaTypes:

import type { PartiallyRequiredAriaTypes } from "@ariatype/ariatype";
import type { ReactNode } from "react";

interface Props extends
  PartiallyRequiredAriaTypes<"aria-atomic" | "role"> {
    children: ReactNode;
  };

export const Component = ({ children, ...props }: Props) =>
  <div {...props}>{children}</div>;

// Valid
<Component aria-atomic="true" role="alert">Component</Component>

// Missing the following properties from type 'Props':
// "aria-atomic", role
<Component>Component</Component>

Packages

Ariatype is a bundle of multiple packages:

  • @ariatype/aria-attributes:
    • ariaAttributes: all aria attributes
    • AriaAttribute: aria attribute type
    • AriaAttributes: aria attributes type
  • @ariatype/aria-attributes-drag-and-drop:
    • ariaAttributesDragAndDrop: all drag-and-drop aria attributes
    • AriaAttributeDragAndDrop: drag-and-drop aria attribute type
    • AriaAttributesDragAndDrop: drag-and-drop aria attributes type
  • @ariatype/aria-attributes-global:
    • ariaAttributesGlobal: all global aria attributes
    • AriaAttributeGlobal: global aria attribute type
    • AriaAttributesGlobal: global aria attributes type
  • @ariatype/aria-attributes-live-region:
    • ariaAttributesLiveRegion: all live region aria attributes
    • AriaAttributeLiveRegion: live region aria attribute type
    • AriaAttributesLiveRegion: live region aria attributes type
  • @ariatype/aria-attributes-relationship:
    • ariaAttributesRelationship: all relationship aria attributes
    • AriaAttributeRelationship: relationship aria attribute type
    • AriaAttributesRelationship: relationship aria attributes type
  • @ariatype/aria-attributes-widget:
    • ariaAttributesWidget: all widget aria attributes
    • AriaAttributeWidget: widget aria attribute type
    • AriaAttributesWidget: widget aria attributes type
  • @ariatype/aria-roles:
    • ariaRoles: all aria roles
    • AriaRole: aria roles type
    • AriaRoles: aria roles type
  • @ariatype/aria-roles-composite:
    • ariaRolesComposite: all composite aria roles
    • AriaRoleComposite: composite aria roles type
    • AriaRolesComposite: composite aria roles type
  • @ariatype/aria-roles-document-structure:
    • ariaRolesDocumentStructure: all document structure aria roles
    • AriaRoleDocumentStructure: document structure aria roles type
    • AriaRolesDocumentStructure: document structure aria roles type
  • @ariatype/aria-roles-generic:
    • ariaRolesGeneric: all generic aria roles
    • AriaRoleGeneric: generic aria roles type
    • AriaRolesGeneric: generic aria roles type
  • @ariatype/aria-roles-landmark:
    • ariaRolesLandmark: all landmark aria roles
    • AriaRoleLandmark: landmark aria roles type
    • AriaRolesLandmark: landmark aria roles type
  • @ariatype/aria-roles-live-region:
    • ariaRolesLiveRegion: all live region aria roles
    • AriaRoleLiveRegion: live region aria roles type
    • AriaRolesLiveRegion: live region aria roles type
  • @ariatype/aria-roles-widget:
    • ariaRolesWidget: all widget aria roles
    • AriaRoleWidget: widget aria roles type
    • AriaRolesWidget: widget aria roles type
  • @ariatype/aria-roles-window:
    • ariaRolesWindow: all window aria roles
    • AriaRoleWindow: window aria roles type
    • AriaRolesWindow: window aria roles type

Resources