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

@canonical/anatomy-dsl

v0.2.2

Published

Anatomy DSL meta-model: TypeScript types mirroring the OWL ontology, and a YAML-to-Turtle transform

Downloads

641

Readme

Anatomy DSL

A YAML-based DSL for representing design system component anatomies — platform-agnostic structural primitives that precede implementation.

Quick Example

---
node:
  uri: global.component.button
  styles:
    layout.type: flow
    layout.direction: horizontal
    layout.align: center
    spacing.internal: spacing/medium
    appearance.background: color/surface/button
    appearance.radius: radius/button
  edges:
    - node:
        uri: global.subcomponent.button-icon
      relation:
        cardinality: "0..1"
        slotName: icon
    - node:
        role: label text
      relation:
        cardinality: "1"
        slotName: default

Style values are design token paths (spacing/medium, color/surface/button) — forward-slash delimited references resolved at runtime against the active theme. Primitives like flow and center are used for layout semantics that don't vary across themes.

Install

bun add -D @canonical/anatomy-dsl

Usage

import { parse } from "yaml";
import { parseAnatomyYAML, anatomyToTTL } from "@canonical/anatomy-dsl";

const raw = parse(readFileSync("Button.anatomy.yaml", "utf8"));
const spec = parseAnatomyYAML(raw);
const ttl = anatomyToTTL(spec);

The button example above produces:

@prefix : <http://anatomy-dsl.example.org/ontology#> .

[] a :Specification ;
    :rootNode [
        a :NamedNode ;
        :uri "global.component.button" ;
        :hasStyle
            [ :styleKey "layout.type" ; :styleValue "flow" ] ,
            [ :styleKey "layout.direction" ; :styleValue "horizontal" ] ,
            [ :styleKey "layout.align" ; :styleValue "center" ] ,
            [ :styleKey "spacing.internal" ; :styleValue "spacing/medium" ] ,
            [ :styleKey "appearance.background" ; :styleValue "color/surface/button" ] ,
            [ :styleKey "appearance.radius" ; :styleValue "radius/button" ] ;
        :hasEdge [
            a :Edge ;
            :edgeTarget [
                a :NamedNode ;
                :uri "global.subcomponent.button-icon"
            ] ;
            :hasRelation [
                a :Relation ;
                :cardinality "0..1" ;
                :slotName "icon"
            ]
        ] , [
            a :Edge ;
            :edgeTarget [
                a :AnonymousNode ;
                :role "label text"
            ] ;
            :hasRelation [
                a :Relation ;
                :cardinality "1" ;
                :slotName "default"
            ]
        ]
    ] .

API

parseAnatomyYAML(raw: unknown): Specification

Converts a parsed YAML object (from any YAML library) into the typed Specification structure. Handles field mapping between the YAML format and the TypeScript types.

anatomyToTTL(spec: Specification): string

Pure function. Takes a Specification, returns a Turtle (RDF) string. No I/O, no side effects.

Types

All types mirror the OWL ontology exactly:

| Type | Description | |------|-------------| | Specification | Root — contains exactly one NamedNode | | NamedNode | Design system entity with a uri | | AnonymousNode | Structural element with a role | | Node | NamedNode \| AnonymousNode (discriminated on type) | | Edge | Reified parent→child relationship | | Relation | Cardinality and optional slot name | | Style | Reified key-value tuple | | Switch | Polymorphic position (discriminator: props \| internal \| override) | | SwitchCase | One alternative within a switch |

Repository Structure

definitions/   Turtle ontology (OWL) + SHACL shapes
schemas/       JSON Schema for validating .anatomy.yaml files
docs/          API reference (merged WD404 + WD404.1)
examples/      Example anatomy files (YAML + Turtle pairs)
src/           TypeScript types, parser, and transform

Scope

The Anatomy DSL describes structure only. It does not handle:

  • Prop mapping — which props a component accepts and how they map to behaviour
  • State or state machines — component states, transitions, or interaction logic
  • Modifier descriptions — only design token references are supported, not semantic modifier definitions

Design Notes

Styles are modelled as reified key-value tuples (hasStyle [ styleKey "…" ; styleValue "…" ]). This keeps the ontology open-ended while remaining lossless. Frequently used style keys may be promoted to first-class datatype properties in a future version.

Specification Status

| Index | Title | Status | |---------|--------------------------|----------------| | WD404 | Anatomy DSL | Approved | | WD404.1 | Anatomy DSL — Addendum 1 | Pending Review |