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

@devgateway/dvz-wp-commons

v1.3.0

Published

Common Utilities for Data Viz Wordpress that can be also used in other projects

Readme

@devgateway/dvz-wp-commons

Common utilities for Data Visualization in WordPress that can also be used in other projects.

npm version MIT License

Installation

npm install @devgateway/dvz-wp-commons
# or
yarn add @devgateway/dvz-wp-commons
# or
pnpm add @devgateway/dvz-wp-commons

Overview

This package provides a collection of reusable components, utilities, and type definitions for data-viz WordPress. It facilitates consistent handling of chart configurations, data formatting, API connections, and more.

This package is used internally by DevGateway projects and is designed to be compatible with the project customizer, allowing for easy integration and extension in custom implementations.

Components

API and Data Configuration

  • APIConfig: Configuration component for API connections.
  • CSVConfig: Configuration for CSV data sources.
  • MapCSVSourceConfig: Configuration for CSV data sources specific to maps.
  • DataFilters: Components for filtering data in visualizations.

Chart Components

  • ChartColors: Provides color schemes (categorical, sequential, diverging) for charts.
  • ChartLegends: Customizable legend components for charts.
  • ChartMeasures: Components for configuring chart measures.
  • Measures: Utilities for handling data measures.
  • Tooltip: Customizable tooltip component for charts.

Block Components

  • BlockEditWithAPIMetadata: Block editor component with API metadata support.
  • BlockEditWithFilters: Block editor component with filter capabilities.
  • ComponentWithSettings: Component wrapper with settings panel.
  • SizeConfig: Configuration component for size settings.

Formatting Components

  • Format: Advanced formatting utilities for chart data.

Post Type Components

  • Post: Components and utilities for handling WordPress post data.

Utilities

API Utilities

  • APIutils: Utility functions for API operations.
    • getTranslatedOptions
    • getTranslation
    • isSupersetAPI

Mobile Utilities

  • MobileConfigUtils: Utilities for mobile configurations.
    • extractAxisValues
    • getSelectedLabelsForApp
    • transformDataToAppObject
    • updateMeasureLabels
    • getSelectedItemsForApp
    • getStoredOrSetItem

UI Utilities

  • Util: General UI utilities.
    • panelFocus
    • togglePanel

Constants

  • BLOCKS_CATEGORY: Category definition for blocks.
  • BLOCKS_NS: Namespace for blocks.
  • DEFAULT_FORMAT_SETTINGS: Default settings for formatting.

Icons

  • GenericIcon: Generic icon component.
  • ChartIcon: Chart-specific icon component.

Types

Core Types

  • Options: Basic option type with label, value, and optional labels.
  • Dimension: Interface for data dimensions.
  • Category/CategoryItem: Types for data categorization.
  • Measure: Interface for data measures.
  • Filter: Interface for data filters.
  • FileContent: Interface for file content metadata.

Chart Types

  • ChartColorsProps: Props for chart colors component.
  • ChartLegendsProps: Props for chart legends component.
  • ChartMeasuresProps: Props for chart measures component.
  • FormatProps: Props for format component.
  • MeasuresProps: Props for measures component.
  • DataFiltersProps: Props for data filters component.
  • MapCSVSourceConfigProps: Props for map CSV source config component.

Block Types

  • BlockEditWithAPIMetadataProps/State: Props and state for BlockEditWithAPIMetadata.
  • BlockEditWithFiltersProps/State: Props and state for BlockEditWithFilters.
  • ComponentWithSettingsProps/State: Props and state for ComponentWithSettings.
  • SizeConfigProps: Props for SizeConfig component.

Data Types

  • DgSettings: Interface for global settings.
  • EurekaResponse: Interface for Eureka service responses.
  • Menu: Interface for menu structure.
  • Media: Interface for media attachments.
  • SearchResult/SearchResults: Types for search functionality.
  • Taxonomy/Taxonomies: Types for WordPress taxonomies.
  • Wp_Types: Types for WordPress content types.

Post Types

  • Post: Interface for WordPress posts.
  • PostContent: Interface for post content.
  • PostLinks: Interface for post links.
  • PostYoastHeadJSON: Interface for Yoast SEO data.
  • PotentialActionType: Enum for schema action types.
  • PostSchema: Interface for structured data schema.

Integration with Project Customizer

This package is designed to be integrated with the project customizer, allowing for:

  • Custom component configurations
  • Theme-specific styling overrides
  • Extension of data types for project-specific needs
  • Custom visualization implementations

When used with the project customizer, components from this package can be easily configured and extended to meet specific project requirements.

Usage Examples

Basic Chart Configuration

import { ChartColors, ChartLegends, Format } from '@devgateway/dvz-wp-commons';

const MyChartComponent = ({ attributes, setAttributes }) => {
  return (
    <div>
      <ChartColors
        attributes={attributes}
        setAttributes={setAttributes}
      />
      <ChartLegends
        attributes={attributes}
        setAttributes={setAttributes}
      />
      <Format
        attributes={attributes}
        setAttributes={setAttributes}
      />
    </div>
  );
};

API Configuration

import { APIConfig } from '@devgateway/dvz-wp-commons';

const MyAPIComponent = ({ attributes, setAttributes }) => {
  return (
    <APIConfig
      attributes={attributes}
      setAttributes={setAttributes}
    />
  );
};

License

MIT