CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-mdn-data

Open Web data by the Mozilla Developer Network containing structured JSON data for web technologies including CSS properties, selectors, functions, at-rules, Web API inheritance, and localization strings used in MDN Web Docs

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

css-data.mddocs/

CSS Data

Comprehensive CSS specification data including properties, functions, selectors, types, units, syntaxes, and at-rules with detailed metadata for each CSS feature.

Capabilities

CSS Properties Data

Complete data for all CSS properties including syntax, inheritance, animation behavior, and specification details.

/**
 * CSS properties data with complete specification metadata
 */
const properties: CSSPropertiesData;

interface CSSPropertiesData {
  [propertyName: string]: CSSPropertyEntry;
}

interface CSSPropertyEntry {
  /** CSS syntax definition for the property value */
  syntax: string;
  /** Media type where the property applies (e.g., "visual", "all") */
  media: string;
  /** Whether the property is inherited by child elements */
  inherited: boolean;
  /** How the property behaves during CSS animations */
  animationType: string;
  /** How percentage values are handled */
  percentages: string;
  /** CSS specification groups this property belongs to */
  groups: string[];
  /** Initial/default value of the property */
  initial: string;
  /** Elements this property applies to */
  appliesto: string;
  /** How the computed value is determined */
  computed: string;
  /** Grammar ordering requirements */
  order: string;
  /** Standardization status (standard, experimental, nonstandard, etc.) */
  status: string;
  /** MDN documentation URL (optional) */
  mdn_url?: string;
}

Usage Examples:

const { css } = require('mdn-data');

// Get information about the color property
const colorProperty = css.properties.color;
console.log(colorProperty);
// Output: {
//   "syntax": "<color>",
//   "media": "visual", 
//   "inherited": true,
//   "animationType": "color",
//   "percentages": "no",
//   "groups": ["CSS Color"],
//   "initial": "Varies from one user agent to another",
//   "appliesto": "allElements",
//   "computed": "asSpecified",
//   "order": "uniqueOrder",
//   "status": "standard",
//   "mdn_url": "https://developer.mozilla.org/docs/Web/CSS/color"
// }

// Find all inherited CSS properties
const inheritedProperties = Object.entries(css.properties)
  .filter(([name, data]) => data.inherited)
  .map(([name]) => name);

// Find experimental CSS properties
const experimentalProperties = Object.entries(css.properties)
  .filter(([name, data]) => data.status === 'experimental')
  .map(([name]) => name);

CSS Functions Data

Data for all CSS functions including syntax and specification details.

/**
 * CSS functions data with syntax and specification metadata
 */
const functions: CSSFunctionsData;

interface CSSFunctionsData {
  [functionName: string]: CSSFunctionEntry;
}

interface CSSFunctionEntry {
  /** CSS syntax definition for the function */
  syntax: string;
  /** CSS specification groups this function belongs to */
  groups: string[];
  /** Standardization status */
  status: string;
  /** MDN documentation URL (optional) */
  mdn_url?: string;
}

Usage Examples:

// Get RGB function information
const rgbFunction = css.functions['rgb()'];
console.log(rgbFunction.syntax);
// Output: "rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? )"

// Find all color-related functions
const colorFunctions = Object.entries(css.functions)
  .filter(([name, data]) => data.groups.includes('CSS Color'))
  .map(([name]) => name);

CSS Selectors Data

Data for CSS selectors including syntax and specification details.

/**
 * CSS selectors data with syntax and specification metadata
 */
const selectors: CSSSelectorsData;

interface CSSSelectorsData {
  [selectorName: string]: CSSSelectorEntry;
}

interface CSSSelectorEntry {
  /** CSS syntax definition for the selector */
  syntax: string;
  /** CSS specification groups this selector belongs to */
  groups: string[];
  /** Standardization status */
  status: string;
  /** MDN documentation URL (optional) */
  mdn_url?: string;
}

CSS Types Data

Data for CSS data types and value definitions.

/**
 * CSS types data with syntax definitions
 */
const types: CSSTypesData;

interface CSSTypesData {
  [typeName: string]: CSSTypeEntry;
}

interface CSSTypeEntry {
  /** CSS syntax definition for the type */
  syntax: string;
  /** CSS specification groups this type belongs to */
  groups: string[];
  /** Standardization status */
  status: string;
  /** MDN documentation URL (optional) */
  mdn_url?: string;
}

CSS Units Data

Data for CSS units with categorization and specification details.

/**
 * CSS units data with categorization
 */
const units: CSSUnitsData;

interface CSSUnitsData {
  [unitName: string]: CSSUnitEntry;
}

interface CSSUnitEntry {
  /** CSS specification groups this unit belongs to */
  groups: string[];
  /** Standardization status */
  status: string;
  /** MDN documentation URL (optional) */
  mdn_url?: string;
}

CSS Syntaxes Data

Data for CSS syntax components used across other CSS features.

/**
 * CSS syntaxes data for grammar components
 */
const syntaxes: CSSSyntaxesData;

interface CSSSyntaxesData {
  [syntaxName: string]: CSSSyntaxEntry;
}

interface CSSSyntaxEntry {
  /** CSS syntax definition */
  syntax: string;
  /** CSS specification groups this syntax belongs to */
  groups: string[];
  /** Standardization status */
  status: string;
  /** MDN documentation URL (optional) */
  mdn_url?: string;
}

CSS At-Rules Data

Data for CSS at-rules including descriptors and specification details.

/**
 * CSS at-rules data with descriptors and specification metadata
 */
const atRules: CSSAtRulesData;

interface CSSAtRulesData {
  [atRuleName: string]: CSSAtRuleEntry;
}

interface CSSAtRuleEntry {
  /** CSS syntax definition for the at-rule */
  syntax: string;
  /** Associated CSS interfaces (optional) */
  interfaces?: string[];
  /** CSS specification groups this at-rule belongs to */
  groups: string[];
  /** Descriptors available within this at-rule (optional) */
  descriptors?: {
    [descriptorName: string]: {
      syntax: string;
      media: string;
      percentages: string;
      computed: string;
      order: string;
      status: string;
      mdn_url?: string;
    };
  };
  /** Standardization status */
  status: string;
  /** MDN documentation URL (optional) */
  mdn_url?: string;
}

Usage Examples:

// Get @media rule information
const mediaRule = css.atRules['@media'];
console.log(mediaRule.syntax);

// Get @font-face descriptors
const fontFaceRule = css.atRules['@font-face'];
console.log(Object.keys(fontFaceRule.descriptors || {}));
// Output: ['font-family', 'src', 'font-style', 'font-weight', ...]

Common Use Cases

  1. CSS Parser Development: Understanding complete CSS syntax for building parsers
  2. CSS Validation Tools: Validating CSS properties, values, and syntax
  3. IDE Support: Providing autocomplete and syntax highlighting for CSS
  4. Documentation Generation: Building comprehensive CSS reference documentation
  5. CSS Tooling: Building CSS preprocessors, minifiers, and optimization tools
  6. Browser Compatibility: Understanding which CSS features are standard vs experimental
  7. CSS Learning Tools: Building educational resources about CSS specifications

docs

api-data.md

css-data.md

index.md

l10n-data.md

tile.json