# @cadcamfun/cad-cam-fun-plugin-sdk

> SDK for building plugins for CAD/CAM FUN platform

Latest version **1.0.0** (published 2025-04-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @cadcamfun/cad-cam-fun-plugin-sdk
pnpm add @cadcamfun/cad-cam-fun-plugin-sdk
yarn add @cadcamfun/cad-cam-fun-plugin-sdk
bun add @cadcamfun/cad-cam-fun-plugin-sdk
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2025-04-08 |
| First published | 2025-04-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 54.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | CAD/CAM FUN Team |
| Maintainers | cadcamfun |
| Keywords | cad, cam, plugin, sdk, typescript |

## Links

- npm: https://www.npmjs.com/package/@cadcamfun/cad-cam-fun-plugin-sdk
- Repository: https://github.com/nikomatt69/plugin-sdk
- Homepage: https://github.com/nikomatt69/plugin-sdk#readme
- Issues: https://github.com/nikomatt69/plugin-sdk/issues
- npm.io page: https://npm.io/package/@cadcamfun/cad-cam-fun-plugin-sdk

## Dependencies (2)

- [mitt](https://npm.io/package/mitt.md) ^3.0.0
- [zustand](https://npm.io/package/zustand.md) ^4.3.7

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2025-04-08

## README

# CAD/CAM FUN Plugin SDK

Official SDK for building plugins for the CAD/CAM FUN platform.

## Installation

```bash
npm install @cad-cam-fun/plugin-sdk
```

or

```bash
yarn add @cad-cam-fun/plugin-sdk
```

## Quick Start

```typescript
import { definePlugin, createExtension } from '@cad-cam-fun/plugin-sdk';

export default definePlugin((api) => {
  // Register sidebar extension
  api.registerExtension(
    createExtension({
      type: 'sidebar',
      component: () => import('./components/Sidebar'),
      metadata: {
        title: 'My Plugin',
        icon: 'settings'
      }
    })
  );
  
  return {
    onEnable: () => {
      console.log('Plugin enabled');
    },
    onDisable: () => {
      console.log('Plugin disabled');
    }
  };
});
```

## Plugin Structure

A typical plugin consists of:

1. **Main Entry Point**: Defines the plugin and its lifecycle methods
2. **UI Components**: React components for user interface extensions
3. **Business Logic**: Code for manipulating elements, layers, etc.

## Extension Points

You can extend the CAD/CAM FUN platform at these extension points:

- **sidebar**: Add a panel to the sidebar
- **toolbar**: Add buttons to the toolbar
- **rightSidebar**: Add content to the right sidebar
- **modal**: Create modal dialogs
- **overlay**: Add an overlay to the canvas
- **contextMenu**: Add items to context menus
- **cadTool**: Add custom CAD tools
- **camOperation**: Add custom CAM operations
- **importer**: Add file import capabilities
- **exporter**: Add file export capabilities
- **renderer**: Customize rendering

## Available Hooks

```typescript
// Access the plugin API
const api = usePluginAPI();

// Access canvas elements
const { elements, createElement, updateElement, deleteElement } = useElements();

// Access current selection
const { selectedIds, selectedElements } = useSelection();

// Access layers
const { layers } = useLayers();

// Access viewport
const viewport = useViewport();

// Subscribe to events
usePluginEvent('element:created', (event) => {
  console.log('Element created:', event.id);
});

// Access plugin settings
const { settings, updateSettings } = usePluginSettings();
```

## Documentation

For full documentation, visit our [documentation site](https://docs.cadcamfun.xyz/plugin-sdk).

## Examples

Check out the [examples directory](./examples) for sample plugins.

## Development

```bash
# Install dependencies
npm install

# Build the SDK
npm run build

# Watch for changes
npm run dev

# Run tests
npm test
```

## License

MIT © CAD/CAM FUN Team

---
_Source: https://npm.io/package/@cadcamfun/cad-cam-fun-plugin-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
