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

react-dxf-coordinates

v0.1.1

Published

React component for viewing DXF files with area selection and coordinate extraction

Readme

React DXF Coordinates

dxf-sample

npm version License: MIT TypeScript React

A powerful, lightweight React component for viewing DXF files with interactive area selection and coordinate extraction.

FeaturesInstallationQuick StartDocumentationExamplesContributing


✨ Features

  • 🎯 Interactive Area Selection - Click and drag to select areas on DXF drawings
  • 📍 Real-time Coordinate Tracking - Get mouse coordinates as you move
  • TypeScript Support - Built with TypeScript for type safety
  • 🪝 Custom Hooks - Powerful useDxfCoordinates hook for state management
  • 🔧 Zero Dependencies - Lightweight with minimal external dependencies
  • 🚀 Performance Optimized - Smooth interactions even with complex drawings

🚀 Installation

npm install react-dxf-coordinates
yarn add react-dxf-coordinates
pnpm add react-dxf-coordinates

⚡ Quick Start

import React from 'react'
import { DxfCoordinates, useDxfCoordinates } from 'react-dxf-coordinates'

function App() {
  const [file, setFile] = useState<File | null>(null)
  const dxfState = useDxfCoordinates()

  console.log(dxfState.areas)

  return (
    <div>
      <input
        type='file'
        accept='.dxf'
        onChange={(e) => {
          const file = e.target.files?.[0] || null
          setFile(file)
        }}
      />

      <DxfCoordinates file={file} controller={dxfState} />
    </div>
  )
}

export default App

📖 Documentation

Components

<DxfCoordinates />

The main component for rendering DXF files with interactive capabilities.

Props:

| Prop | Type | Default | Description | |------|------|---------|-------------| | file | File | required | .dxf file | controller | UseDxfCoordinatesReturn | required | Controller object from useDxfCoordinates hook | | hasToolBar | boolean | true | Show toolbar |

Hooks

useDxfCoordinates()

A powerful hook that provides state management and controls for the DXF coordinates.

Returns:

type DxfCoordinatesHook = {
  mode: Mode
  setMode: React.Dispatch<React.SetStateAction<Mode>>
  areas: Area[]
  setAreas: React.Dispatch<React.SetStateAction<Area[]>>
  activeAreaIndex: number;
  setActiveAreaIndex: React.Dispatch<React.SetStateAction<number>>
}

Types

type Mode = 'pan' | 'select'

interface Area {
  x: number
  y: number
  width: number
  height: number
}

📋 Examples

Basic Usage

import { DxfCoordinates, useDxfCoordinates } from 'react-dxf-coordinates'

function BasicExample() {
  const [file, setFile] = useState<File | null>(null)
  const dxfState = useDxfCoordinates()

  return (
    <DxfCoordinates file={file} controller={dxfState} />
  )
}

🛠️ Development

Prerequisites

  • Node.js 22.0.0 or higher
  • npm, yarn, or pnpm

Setting up development environment

git clone https://github.com/CreamCheese-Ja/react-dxf-coordinates.git
cd react-dxf-coordinates
npm install

Running the example

npm run example

Building the library

npm run build

📄 Browser Support

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Process

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for your changes
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Reporting Issues

Please use the GitHub Issues page to report bugs or request features.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built with ❤️ for the React and CAD communities
  • Inspired by the need for better DXF visualization tools in web applications
  • Thanks to all contributors who help make this project better

📊 Stats

GitHub stars GitHub forks GitHub issues GitHub pull requests


⬆ Back to Top

Made with ❤️ by CreamCheese-Ja