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

@damarkuncoro/agnostic-ui-contracts

v0.1.0

Published

Agnostic UI Contracts

Readme

@damarkuncoro/agnostic-ui-contracts

Kontrak UI untuk seluruh ekosistem Agnostic UI. Paket ini mendefinisikan tipe, konstanta, props, state, a11y, dan guard/validator yang menjadi sumber kebenaran untuk Base, Theme, Skin, serta adapter React/Vue.

Ringkas

  • Import via alias: @damarkuncoro/agnostic-ui/contracts
  • Ekspor utama: a11y, keyboard, state, ui/button
  • Build ke dist (source murni di src)
  • Dependency: tidak bergantung ke paket lain (Contract-first)

Instalasi & Import

Monorepo ini sudah memetakan alias ke source:

// Import tipe/kontrak
import {
  type UiButtonProps,
  type UiButtonVariant,
  type UiButtonSize,
} from '@damarkuncoro/agnostic-ui/contracts'

Alias diset di tsconfig.base.json agar IDE dan tooling resolve ke source: tsconfig.base.json:11

API Surface

  • a11y
    • Konstanta ARIA/Role dan tipe: A11Y_ROLES, A11Y_ATTRIBUTES
    • Sumber: src/a11y.ts
  • keyboard
    • Konstanta tombol: KEYBOARD_KEYS
    • Sumber: src/keyboard.ts
  • state
    • Konstanta state UI: UI_STATES
    • Sumber: src/state.ts
  • ui/button
    • Tipe dan kontrak tombol: varian, size, props, state, a11y, events, slots, guards, validate
    • Sumber: src/ui/button/* dan indeks src/ui/button/index.ts:1

Contoh Penggunaan

Di Base (logika)

import { assertUiButtonProps, type UiButtonProps } from '@damarkuncoro/agnostic-ui/contracts'

export function resolveUiButtonProps(props: UiButtonProps) {
  assertUiButtonProps(props)
  // gabungkan default + props pengguna
}

Di Skin (visual)

import { type UiButtonVariant, type UiButtonSize } from '@damarkuncoro/agnostic-ui/contracts'

export function getButtonClass(variant?: UiButtonVariant, size?: UiButtonSize) {
  // mapping varian/size → kelas Tailwind
}

Di Adapter React/Vue (komponen)

import { type UiButtonProps } from '@damarkuncoro/agnostic-ui/contracts'

Build

Jalankan build untuk menghasilkan dist:

pnpm --filter @damarkuncoro/agnostic-ui/contracts build

Konfigurasi build:

  • packages/agnostic-ui-contracts/package.jsonmain: dist/index.js, types: dist/index.d.ts
  • packages/agnostic-ui-contracts/tsconfig.jsonoutDir: dist, rootDir: src, declaration: true

Arsitektur & Aturan Dependency

  • Contract → ❌ tidak bergantung apa pun
  • Theme & Base → bergantung ke Contract
  • Skin → bergantung ke Contract + Theme
  • Adapter (React/Vue) → menggabungkan Base + Skin (+ Theme bila perlu)

Dengan pola ini, kontrak menjadi pusat stabilitas API, sementara layer lain dapat berevolusi tanpa memecah kesepakatan tipe/props.

Struktur Direktori

packages/agnostic-ui-contracts/
├─ src/
│  ├─ a11y.ts
│  ├─ keyboard.ts
│  ├─ state.ts
│  └─ ui/
│     └─ button/
│        ├─ ui-button.types.ts
│        ├─ ui-button.contract.ts
│        ├─ ui-button.props.ts
│        ├─ ui-button.state.ts
│        ├─ ui-button.a11y.ts
│        ├─ ui-button.events.ts
│        ├─ ui-button.slots.ts
│        ├─ ui-button.constants.ts
│        ├─ ui-button.guards.ts
│        ├─ ui-button.validate.ts
│        └─ index.ts
└─ dist/ (hasil build)

Catatan

  • Entry ekspor paket: packages/agnostic-ui-contracts/src/index.ts mengekspor seluruh modul inti.
  • Gunakan alias @damarkuncoro/agnostic-ui/contracts di seluruh paket agar konsisten dan aman terhadap perubahan internal.