diff --git a/.claude/skills/floormap-expert.md b/.claude/skills/floormap-expert.md index e681acf..e8e6ef4 100644 --- a/.claude/skills/floormap-expert.md +++ b/.claude/skills/floormap-expert.md @@ -9,7 +9,7 @@ You are an expert on the **Floormap** codebase. Apply this context whenever work ## What Floormap is -A zero-dependency TypeScript toolkit for building interactive 2D editors (floor plans, seat maps, office layouts). It provides scene management, pan/zoom/selection/picking primitives, and pluggable renderers. It is a monorepo with two publishable packages: `@floormap/core` and `@floormap/svg`. +A zero-dependency TypeScript toolkit for building interactive 2D editors (floor plans, seat maps, office layouts). It provides scene management, pan/zoom/selection/picking primitives, and pluggable renderers. It is a monorepo with two publishable packages: `@floormap-tools/core` and `@floormap-tools/svg`. --- @@ -33,7 +33,7 @@ A zero-dependency TypeScript toolkit for building interactive 2D editors (floor ## Architecture rules to enforce -1. **No production deps** — `@floormap/core` and `@floormap/svg` must stay dependency-free. +1. **No production deps** — `@floormap-tools/core` and `@floormap-tools/svg` must stay dependency-free. 2. **Core is framework-agnostic** — no DOM, no React, no browser APIs in `packages/core/src/`. 3. **Branded types everywhere** — `EntityId` and `LayerId` are branded strings; never substitute with `string`. 4. **Immutable selection** — `applySelection` returns a new `Set`, never mutates the input. @@ -106,5 +106,5 @@ Test environment: **Node** for core, **jsdom** for svg. Tests live in `src/__tes - Forgetting `selectable: true` on entities → `hitTestPoint` returns null - Using `string` instead of `EntityId` / `LayerId` → type errors downstream - Mutating the `Set` from `applySelection` → breaks immutability contract -- Adding DOM code to `@floormap/core` → breaks the agnostic renderer model +- Adding DOM code to `@floormap-tools/core` → breaks the agnostic renderer model - Not updating `index.ts` after adding exports → new symbols invisible to consumers diff --git a/.github/workflows/deploy-examples.yml b/.github/workflows/deploy-examples.yml index 7925b74..5836c7c 100644 --- a/.github/workflows/deploy-examples.yml +++ b/.github/workflows/deploy-examples.yml @@ -55,11 +55,11 @@ jobs:

Interactive 2D editor toolkit — live examples

Vanilla JS - @floormap/core + @floormap/svg + @floormap-tools/core + @floormap-tools/svg React - @floormap/core + @floormap/react + @floormap-tools/core + @floormap-tools/react diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9ff698c..10e41cb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,7 +24,7 @@ jobs: node-version: 22 cache: pnpm registry-url: https://npm.pkg.github.com - scope: '@floormap' + scope: '@floormap-tools' - run: pnpm install --frozen-lockfile diff --git a/.npmrc b/.npmrc index 4d5310d..31496ae 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -@floormap:registry=https://npm.pkg.github.com +@floormap-tools:registry=https://npm.pkg.github.com diff --git a/CLAUDE.md b/CLAUDE.md index 5efd24e..6e97bde 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -15,10 +15,10 @@ Floormap is a zero-dependency TypeScript toolkit for building interactive 2D edi ``` packages/ - core/ @floormap/core — scene engine, viewport, selection, events, picking - svg/ @floormap/svg — SVG renderer + DOM event handlers + core/ @floormap-tools/core — scene engine, viewport, selection, events, picking + svg/ @floormap-tools/svg — SVG renderer + DOM event handlers adapters/ - react/ @floormap/react — React adapter (hooks + FloormapCanvas component) + react/ @floormap-tools/react — React adapter (hooks + FloormapCanvas component) examples/ js-vanilla/ vanilla JS example react/ React example @@ -47,7 +47,7 @@ Run from repo root. Per-package commands work inside each `packages/*` directory ## Architecture -### @floormap/core +### @floormap-tools/core | Module | Responsibility | |--------|---------------| @@ -71,7 +71,7 @@ Run from repo root. Per-package commands work inside each `packages/*` directory - `zoomAt` delta is multiplicative: `0.1` = +10%, `−0.1` = −10% - `panBy` takes screen-space delta; positive `x` shifts content left (pan moves right in world) -### @floormap/svg +### @floormap-tools/svg | Module | Responsibility | |--------|---------------| @@ -142,8 +142,8 @@ Run from repo root. Per-package commands work inside each `packages/*` directory ## What NOT to do -- Do not add production dependencies to `@floormap/core` or `@floormap/svg`. +- Do not add production dependencies to `@floormap-tools/core` or `@floormap-tools/svg`. - Do not bypass branded types with plain strings. - Do not mutate `Set` objects returned by `applySelection`. -- Do not add framework-specific code to `@floormap/core` (keep it agnostic). +- Do not add framework-specific code to `@floormap-tools/core` (keep it agnostic). - Do not skip typecheck — the build uses project references. diff --git a/README.md b/README.md index 9ebad8a..2bd64e1 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,9 @@ Floormap provides the low-level engine for pan/zoom, selection, hit testing, and | Package | Version | Description | |---------|---------|-------------| -| [`@floormap/core`](packages/core) | 0.1.0 | Scene engine, viewport, event bus, picking, selection | -| [`@floormap/svg`](packages/svg) | 0.1.0 | SVG renderer + DOM event handlers | -| [`@floormap/react`](packages/adapters/react) | 0.1.0 | React adapter — hooks and `FloormapCanvas` component | +| [`@floormap-tools/core`](packages/core) | 0.1.0 | Scene engine, viewport, event bus, picking, selection | +| [`@floormap-tools/svg`](packages/svg) | 0.1.0 | SVG renderer + DOM event handlers | +| [`@floormap-tools/react`](packages/adapters/react) | 0.1.0 | React adapter — hooks and `FloormapCanvas` component | --- @@ -30,13 +30,13 @@ Floormap provides the low-level engine for pan/zoom, selection, hit testing, and **Vanilla JS / framework-agnostic:** ```bash -npm install @floormap/core @floormap/svg +npm install @floormap-tools/core @floormap-tools/svg ``` **React:** ```bash -npm install @floormap/core @floormap/react +npm install @floormap-tools/core @floormap-tools/react ``` All packages ship dual **ESM + CJS** builds with full TypeScript declarations. @@ -47,14 +47,14 @@ All packages ship dual **ESM + CJS** builds with full TypeScript declarations. ```tsx import { useCallback, useEffect } from 'react'; -import { createEmptyScene, addEntity } from '@floormap/core'; -import type { Entity, EntityId, LayerId } from '@floormap/core'; +import { createEmptyScene, addEntity } from '@floormap-tools/core'; +import type { Entity, EntityId, LayerId } from '@floormap-tools/core'; import { FloormapCanvas, useFloormapCore, useSelection, useViewport, -} from '@floormap/react'; +} from '@floormap-tools/react'; const LAYER = 'main' as LayerId; @@ -208,9 +208,9 @@ useCoreEvent(core, 'entities:changed', ({ type, ids }) => { ## Quick start — Vanilla JS ```ts -import { createCore, createEmptyScene } from '@floormap/core'; -import { mountSvgRenderer } from '@floormap/svg'; -import type { EntityId, LayerId } from '@floormap/core'; +import { createCore, createEmptyScene } from '@floormap-tools/core'; +import { mountSvgRenderer } from '@floormap-tools/svg'; +import type { EntityId, LayerId } from '@floormap-tools/core'; // 1. Define layers (bottom → top z-order) const LAYERS = { @@ -290,7 +290,7 @@ renderer.destroy(); - `fitToBounds`, `fitToScene`, `centerOn` for programmatic camera control - Precise coordinate transforms: `worldToScreen` / `screenToWorld` -**Interaction** (via `@floormap/svg` or `@floormap/react`) +**Interaction** (via `@floormap-tools/svg` or `@floormap-tools/react`) - Mouse wheel zoom (configurable sensitivity) - Pointer drag-to-pan - Pinch-to-zoom on touch and pen devices @@ -298,13 +298,13 @@ renderer.destroy(); - Multi-select: Shift (add), Ctrl/Meta (toggle) - Drag-to-move selected entities -**Rendering** (via `@floormap/svg` or `@floormap/react`) +**Rendering** (via `@floormap-tools/svg` or `@floormap-tools/react`) - Bring-your-own-drawEntity callback — full SVG freedom - World-aligned background grid that stays crisp at any zoom - Built-in selection highlight overlay with customisable style - Automatic repaints on viewport, entity, and selection changes -**React adapter** (`@floormap/react`) +**React adapter** (`@floormap-tools/react`) - `FloormapCanvas` component — drop in an SVG canvas with zero boilerplate - `useFloormapCore` — lazy engine initialisation, stable across re-renders - `useSelection` / `useViewport` — fine-grained reactive subscriptions via `useSyncExternalStore` @@ -327,14 +327,14 @@ renderer.destroy(); └────────────────┬────────────────────────┘ │ FloormapCore API ┌───────────▼────────────┐ - │ @floormap/core │ + │ @floormap-tools/core │ │ scene · viewport │ │ events · picking │ │ selection · store │ └─────────┬──────────────┘ │ subscribes to events ┌─────────┴──────────────┬──────────────────────┐ - │ @floormap/svg │ @floormap/react │ + │ @floormap-tools/svg │ @floormap-tools/react │ │ DOM setup · renderer │ FloormapCanvas │ │ handlers · grid │ useFloormapCore │ │ selection overlay │ useSelection │ @@ -343,7 +343,7 @@ renderer.destroy(); └────────────────────┘ ``` -`@floormap/core` is fully framework-agnostic — no DOM, no browser APIs. `@floormap/svg` and `@floormap/react` are independent renderer/adapter layers that connect core to the browser. Use whichever fits your stack. +`@floormap-tools/core` is fully framework-agnostic — no DOM, no browser APIs. `@floormap-tools/svg` and `@floormap-tools/react` are independent renderer/adapter layers that connect core to the browser. Use whichever fits your stack. --- @@ -397,7 +397,7 @@ If you find a bug or want to suggest an improvement, please open an **issue**. For pull requests: - Keep the PR focused on a single change or feature - Run `pnpm typecheck && pnpm test && pnpm lint` before submitting -- Do not add production dependencies to `@floormap/core`, `@floormap/svg`, or `@floormap/react` +- Do not add production dependencies to `@floormap-tools/core`, `@floormap-tools/svg`, or `@floormap-tools/react` --- diff --git a/packages/adapters/react/CHANGELOG.md b/packages/adapters/react/CHANGELOG.md index 7fd6d6b..9c4074b 100644 --- a/packages/adapters/react/CHANGELOG.md +++ b/packages/adapters/react/CHANGELOG.md @@ -1,12 +1,12 @@ -# @floormap/react +# @floormap-tools/react ## 0.1.0 ### Minor Changes -- Initial release of @floormap/core, @floormap/svg, and @floormap/react. +- Initial release of @floormap-tools/core, @floormap-tools/svg, and @floormap-tools/react. ### Patch Changes - Updated dependencies - - @floormap/core@0.1.0 + - @floormap-tools/core@0.1.0 diff --git a/packages/adapters/react/README.md b/packages/adapters/react/README.md index b89b8ba..a650742 100644 --- a/packages/adapters/react/README.md +++ b/packages/adapters/react/README.md @@ -1,13 +1,13 @@ -# @floormap/react +# @floormap-tools/react -React adapter for [`@floormap/core`](../../core). Provides a drop-in `` component and hooks for building interactive 2D editors — floor plans, seat maps, office layouts — with zero boilerplate. +React adapter for [`@floormap-tools/core`](../../core). Provides a drop-in `` component and hooks for building interactive 2D editors — floor plans, seat maps, office layouts — with zero boilerplate. ## Installation ```bash -npm install @floormap/core @floormap/react +npm install @floormap-tools/core @floormap-tools/react # or -pnpm add @floormap/core @floormap/react +pnpm add @floormap-tools/core @floormap-tools/react ``` React 18 is required as a peer dependency. @@ -16,15 +16,15 @@ React 18 is required as a peer dependency. ```tsx import { useCallback, useEffect } from 'react'; -import { createEmptyScene } from '@floormap/core'; -import type { Entity, EntityId, LayerId } from '@floormap/core'; -import { FloormapCanvas, useFloormapCore, useSelection, useViewport } from '@floormap/react'; +import { createEmptyScene } from '@floormap-tools/core'; +import type { Entity, EntityId, LayerId } from '@floormap-tools/core'; +import { FloormapCanvas, useFloormapCore, useSelection, useViewport } from '@floormap-tools/react'; const LAYER = 'main' as LayerId; const initialScene = (() => { const scene = createEmptyScene({ width: 1200, height: 800 }, [LAYER]); - // addEntity is a store helper — import from @floormap/core if needed, + // addEntity is a store helper — import from @floormap-tools/core if needed, // or use core.add() after the core is created. return scene; })(); diff --git a/packages/adapters/react/package.json b/packages/adapters/react/package.json index 798ffa0..faf1b80 100644 --- a/packages/adapters/react/package.json +++ b/packages/adapters/react/package.json @@ -1,5 +1,5 @@ { - "name": "@floormap/react", + "name": "@floormap-tools/react", "version": "0.1.0", "private": false, "type": "module", @@ -26,7 +26,7 @@ "test:watch": "vitest" }, "devDependencies": { - "@floormap/core": "workspace:*", + "@floormap-tools/core": "workspace:*", "@testing-library/react": "^16.0.0", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", @@ -36,7 +36,7 @@ "vitest": "^2.0.0" }, "peerDependencies": { - "@floormap/core": "0.x", + "@floormap-tools/core": "0.x", "react": "^18.0.0" } } diff --git a/packages/adapters/react/src/FloormapCanvas.tsx b/packages/adapters/react/src/FloormapCanvas.tsx index 6a0642a..bb9186b 100644 --- a/packages/adapters/react/src/FloormapCanvas.tsx +++ b/packages/adapters/react/src/FloormapCanvas.tsx @@ -6,7 +6,7 @@ import { type CSSProperties, type ReactNode, } from 'react'; -import type { Entity, EntityId, FloormapCore, LayerId } from '@floormap/core'; +import type { Entity, EntityId, FloormapCore, LayerId } from '@floormap-tools/core'; import { attachHandlers } from './internal/attachHandlers'; import { useEntities } from './internal/useEntities'; import { useViewportTransform } from './internal/useViewportTransform'; diff --git a/packages/adapters/react/src/__tests__/FloormapCanvas.test.tsx b/packages/adapters/react/src/__tests__/FloormapCanvas.test.tsx index ad2f620..21ad401 100644 --- a/packages/adapters/react/src/__tests__/FloormapCanvas.test.tsx +++ b/packages/adapters/react/src/__tests__/FloormapCanvas.test.tsx @@ -1,8 +1,8 @@ // @vitest-environment jsdom import { describe, it, expect, vi, beforeAll } from 'vitest'; import { render, act } from '@testing-library/react'; -import { createCore, createEmptyScene } from '@floormap/core'; -import type { Entity, EntityId, LayerId } from '@floormap/core'; +import { createCore, createEmptyScene } from '@floormap-tools/core'; +import type { Entity, EntityId, LayerId } from '@floormap-tools/core'; import { FloormapCanvas } from '../FloormapCanvas'; beforeAll(() => { diff --git a/packages/adapters/react/src/__tests__/hooks.test.ts b/packages/adapters/react/src/__tests__/hooks.test.ts index 29a8ac9..23ac24b 100644 --- a/packages/adapters/react/src/__tests__/hooks.test.ts +++ b/packages/adapters/react/src/__tests__/hooks.test.ts @@ -1,8 +1,8 @@ // @vitest-environment jsdom import { describe, it, expect } from 'vitest'; import { renderHook, act } from '@testing-library/react'; -import { createCore, createEmptyScene } from '@floormap/core'; -import type { EntityId, LayerId } from '@floormap/core'; +import { createCore, createEmptyScene } from '@floormap-tools/core'; +import type { EntityId, LayerId } from '@floormap-tools/core'; import { useFloormapCore, useSelection, useViewport } from '../index'; function makeCore() { diff --git a/packages/adapters/react/src/hooks/useCoreEvent.ts b/packages/adapters/react/src/hooks/useCoreEvent.ts index 35538ad..e423baa 100644 --- a/packages/adapters/react/src/hooks/useCoreEvent.ts +++ b/packages/adapters/react/src/hooks/useCoreEvent.ts @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react'; -import type { FloormapCore } from '@floormap/core'; +import type { FloormapCore } from '@floormap-tools/core'; export function useCoreEvent( core: FloormapCore, diff --git a/packages/adapters/react/src/hooks/useFloormapCore.ts b/packages/adapters/react/src/hooks/useFloormapCore.ts index ae52504..7150a07 100644 --- a/packages/adapters/react/src/hooks/useFloormapCore.ts +++ b/packages/adapters/react/src/hooks/useFloormapCore.ts @@ -1,6 +1,6 @@ import { useRef } from 'react'; -import { createCore } from '@floormap/core'; -import type { FloormapCore, Scene, Viewport } from '@floormap/core'; +import { createCore } from '@floormap-tools/core'; +import type { FloormapCore, Scene, Viewport } from '@floormap-tools/core'; export interface FloormapCoreOptions { scene: Scene; diff --git a/packages/adapters/react/src/hooks/useSelection.ts b/packages/adapters/react/src/hooks/useSelection.ts index c998eb7..a448a4f 100644 --- a/packages/adapters/react/src/hooks/useSelection.ts +++ b/packages/adapters/react/src/hooks/useSelection.ts @@ -1,5 +1,5 @@ import { useCallback, useRef, useSyncExternalStore } from 'react'; -import type { EntityId, FloormapCore } from '@floormap/core'; +import type { EntityId, FloormapCore } from '@floormap-tools/core'; export function useSelection(core: FloormapCore): ReadonlySet { const snapshotRef = useRef>(new Set(core.selection)); diff --git a/packages/adapters/react/src/hooks/useViewport.ts b/packages/adapters/react/src/hooks/useViewport.ts index 2c35d43..fdae325 100644 --- a/packages/adapters/react/src/hooks/useViewport.ts +++ b/packages/adapters/react/src/hooks/useViewport.ts @@ -1,5 +1,5 @@ import { useCallback, useRef, useSyncExternalStore } from 'react'; -import type { FloormapCore, Viewport } from '@floormap/core'; +import type { FloormapCore, Viewport } from '@floormap-tools/core'; export function useViewport(core: FloormapCore): Viewport { const snapshotRef = useRef({ ...core.viewport, pan: { ...core.viewport.pan } }); diff --git a/packages/adapters/react/src/internal/GridLayer.tsx b/packages/adapters/react/src/internal/GridLayer.tsx index 8b6c042..fe2d3fb 100644 --- a/packages/adapters/react/src/internal/GridLayer.tsx +++ b/packages/adapters/react/src/internal/GridLayer.tsx @@ -1,5 +1,5 @@ import { memo, useEffect, useRef } from 'react'; -import type { FloormapCore, Viewport } from '@floormap/core'; +import type { FloormapCore, Viewport } from '@floormap-tools/core'; import type { GridOptions } from '../types'; interface GridLayerProps { diff --git a/packages/adapters/react/src/internal/SelectionOverlay.tsx b/packages/adapters/react/src/internal/SelectionOverlay.tsx index 1a40336..56d5de6 100644 --- a/packages/adapters/react/src/internal/SelectionOverlay.tsx +++ b/packages/adapters/react/src/internal/SelectionOverlay.tsx @@ -1,5 +1,5 @@ import { memo } from 'react'; -import type { Entity, EntityId } from '@floormap/core'; +import type { Entity, EntityId } from '@floormap-tools/core'; import type { SelectionOverlayStyle } from '../types'; interface SelectionOverlayProps { diff --git a/packages/adapters/react/src/internal/attachHandlers.ts b/packages/adapters/react/src/internal/attachHandlers.ts index 05031c0..fc0398b 100644 --- a/packages/adapters/react/src/internal/attachHandlers.ts +++ b/packages/adapters/react/src/internal/attachHandlers.ts @@ -1,4 +1,4 @@ -import type { FloormapCore, EntityId, Bounds } from '@floormap/core'; +import type { FloormapCore, EntityId, Bounds } from '@floormap-tools/core'; export type AttachHandlersOptions = { enableWheel: boolean; diff --git a/packages/adapters/react/src/internal/useEntities.ts b/packages/adapters/react/src/internal/useEntities.ts index df062c4..7cf4ef0 100644 --- a/packages/adapters/react/src/internal/useEntities.ts +++ b/packages/adapters/react/src/internal/useEntities.ts @@ -1,5 +1,5 @@ import { useCallback, useRef, useSyncExternalStore } from 'react'; -import type { Entity, FloormapCore } from '@floormap/core'; +import type { Entity, FloormapCore } from '@floormap-tools/core'; export function useEntities(core: FloormapCore): Entity[] { const snapshotRef = useRef([...core.scene.entities.values()]); diff --git a/packages/adapters/react/src/internal/useViewportTransform.ts b/packages/adapters/react/src/internal/useViewportTransform.ts index 54a2c7d..e6e71e7 100644 --- a/packages/adapters/react/src/internal/useViewportTransform.ts +++ b/packages/adapters/react/src/internal/useViewportTransform.ts @@ -1,5 +1,5 @@ import { type RefObject, useEffect } from 'react'; -import type { FloormapCore } from '@floormap/core'; +import type { FloormapCore } from '@floormap-tools/core'; export function useViewportTransform( core: FloormapCore, diff --git a/packages/adapters/react/vitest.config.ts b/packages/adapters/react/vitest.config.ts index 1038181..105f732 100644 --- a/packages/adapters/react/vitest.config.ts +++ b/packages/adapters/react/vitest.config.ts @@ -7,7 +7,7 @@ const __dirname = fileURLToPath(new URL('.', import.meta.url)); export default defineConfig({ resolve: { alias: { - '@floormap/core': resolve(__dirname, '../../core/src/index.ts'), + '@floormap-tools/core': resolve(__dirname, '../../core/src/index.ts'), }, }, test: { diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index b8728f8..fe67230 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,7 +1,7 @@ -# @floormap/core +# @floormap-tools/core ## 0.1.0 ### Minor Changes -- Initial release of @floormap/core, @floormap/svg, and @floormap/react. +- Initial release of @floormap-tools/core, @floormap-tools/svg, and @floormap-tools/react. diff --git a/packages/core/CLAUDE.md b/packages/core/CLAUDE.md index 78aca20..b3ab987 100644 --- a/packages/core/CLAUDE.md +++ b/packages/core/CLAUDE.md @@ -1,4 +1,4 @@ -# @floormap/core — Claude Code Guide +# @floormap-tools/core — Claude Code Guide Zero-dependency scene engine for 2D interactive editors. Manages entities, viewport transforms, event pub/sub, hit testing, and selection. Framework-agnostic — no DOM, no browser APIs anywhere in this package. @@ -9,7 +9,7 @@ Zero-dependency scene engine for 2D interactive editors. Manages entities, viewp Everything flows through `FloormapCore`, the object returned by `createCore()`. Renderers and adapters receive this object and subscribe to its events. ```ts -import { createCore, createEmptyScene } from '@floormap/core'; +import { createCore, createEmptyScene } from '@floormap-tools/core'; const scene = createEmptyScene({ width: 2000, height: 1500 }, ['floor' as LayerId, 'furniture' as LayerId]); const core = createCore({ diff --git a/packages/core/README.md b/packages/core/README.md index b9a33a8..b4a3687 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -1,20 +1,20 @@ -# @floormap/core +# @floormap-tools/core Scene engine for interactive 2D editors. Manages entities, viewport transforms, event pub/sub, hit testing, and selection. Framework-agnostic — no DOM, no browser APIs. ## Installation ```bash -npm install @floormap/core +npm install @floormap-tools/core # or -pnpm add @floormap/core +pnpm add @floormap-tools/core ``` ## Quick start ```ts -import { createCore, createEmptyScene } from '@floormap/core'; -import type { EntityId, LayerId } from '@floormap/core'; +import { createCore, createEmptyScene } from '@floormap-tools/core'; +import type { EntityId, LayerId } from '@floormap-tools/core'; const scene = createEmptyScene( { width: 2000, height: 1500 }, @@ -283,7 +283,7 @@ type SelectionMode = 'replace' | 'add' | 'toggle'; These are exported for use in renderers and application code: ```ts -import { createEmptyScene, clamp, containsPointAABB, expandBounds, unionBounds } from '@floormap/core'; +import { createEmptyScene, clamp, containsPointAABB, expandBounds, unionBounds } from '@floormap-tools/core'; clamp(value, min, max) // numeric clamp containsPointAABB(bounds, point) // true if point is inside bounds (inclusive) @@ -298,7 +298,7 @@ unionBounds(a, b) // smallest AABB containing both bounds ### Creating branded ids ```ts -import type { EntityId, LayerId } from '@floormap/core'; +import type { EntityId, LayerId } from '@floormap-tools/core'; // Option 1: cast at point of use core.add({ id: 'table-1' as EntityId, layer: 'furniture' as LayerId, ... }); diff --git a/packages/core/package.json b/packages/core/package.json index 1329d88..c5d3865 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,5 +1,5 @@ { - "name": "@floormap/core", + "name": "@floormap-tools/core", "version": "0.1.0", "private": false, "type": "module", diff --git a/packages/examples/js-vanilla/CHANGELOG.md b/packages/examples/js-vanilla/CHANGELOG.md index 4d87603..e036a91 100644 --- a/packages/examples/js-vanilla/CHANGELOG.md +++ b/packages/examples/js-vanilla/CHANGELOG.md @@ -1,9 +1,9 @@ -# @floormap/example-js-vanilla +# @floormap-tools/example-js-vanilla ## 0.0.1 ### Patch Changes - Updated dependencies - - @floormap/core@0.1.0 - - @floormap/svg@1.0.0 + - @floormap-tools/core@0.1.0 + - @floormap-tools/svg@1.0.0 diff --git a/packages/examples/js-vanilla/package.json b/packages/examples/js-vanilla/package.json index fcd48c8..87b5009 100644 --- a/packages/examples/js-vanilla/package.json +++ b/packages/examples/js-vanilla/package.json @@ -1,5 +1,5 @@ { - "name": "@floormap/example-js-vanilla", + "name": "@floormap-tools/example-js-vanilla", "version": "0.0.1", "private": true, "scripts": { @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@floormap/core": "workspace:*", - "@floormap/svg": "workspace:*" + "@floormap-tools/core": "workspace:*", + "@floormap-tools/svg": "workspace:*" }, "devDependencies": { "vite": "^6.0.0" diff --git a/packages/examples/js-vanilla/src/main.ts b/packages/examples/js-vanilla/src/main.ts index ae8d3f9..0b35383 100644 --- a/packages/examples/js-vanilla/src/main.ts +++ b/packages/examples/js-vanilla/src/main.ts @@ -1,9 +1,9 @@ -import { createCore, createEmptyScene } from '@floormap/core'; +import { createCore, createEmptyScene } from '@floormap-tools/core'; document.addEventListener('gesturestart', (e) => e.preventDefault(), { passive: false }); document.addEventListener('gesturechange', (e) => e.preventDefault(), { passive: false }); -import { mountSvgRenderer } from '@floormap/svg'; -import type { EntityId, LayerId } from '@floormap/core'; +import { mountSvgRenderer } from '@floormap-tools/svg'; +import type { EntityId, LayerId } from '@floormap-tools/core'; // ── Types ───────────────────────────────────────────────────────────────────── diff --git a/packages/examples/js-vanilla/vite.config.ts b/packages/examples/js-vanilla/vite.config.ts index 511f276..a0ef62c 100644 --- a/packages/examples/js-vanilla/vite.config.ts +++ b/packages/examples/js-vanilla/vite.config.ts @@ -8,8 +8,8 @@ export default defineConfig(({ command }) => ({ base: command === 'build' ? '/vanilla/' : '/', resolve: { alias: { - '@floormap/core': resolve(__dirname, '../../core/src/index.ts'), - '@floormap/svg': resolve(__dirname, '../../svg/src/index.ts'), + '@floormap-tools/core': resolve(__dirname, '../../core/src/index.ts'), + '@floormap-tools/svg': resolve(__dirname, '../../svg/src/index.ts'), }, }, })); diff --git a/packages/examples/react/CHANGELOG.md b/packages/examples/react/CHANGELOG.md index 34d7767..770b901 100644 --- a/packages/examples/react/CHANGELOG.md +++ b/packages/examples/react/CHANGELOG.md @@ -1,9 +1,9 @@ -# @floormap/example-react +# @floormap-tools/example-react ## 0.0.1 ### Patch Changes - Updated dependencies - - @floormap/core@0.1.0 - - @floormap/react@1.0.0 + - @floormap-tools/core@0.1.0 + - @floormap-tools/react@1.0.0 diff --git a/packages/examples/react/package.json b/packages/examples/react/package.json index 9d1b0a7..f6ee188 100644 --- a/packages/examples/react/package.json +++ b/packages/examples/react/package.json @@ -1,5 +1,5 @@ { - "name": "@floormap/example-react", + "name": "@floormap-tools/example-react", "version": "0.0.1", "private": true, "scripts": { @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@floormap/core": "workspace:*", - "@floormap/react": "workspace:*", + "@floormap-tools/core": "workspace:*", + "@floormap-tools/react": "workspace:*", "react": "^18.0.0", "react-dom": "^18.0.0" }, diff --git a/packages/examples/react/src/App.tsx b/packages/examples/react/src/App.tsx index 8b98a3c..b63f8af 100644 --- a/packages/examples/react/src/App.tsx +++ b/packages/examples/react/src/App.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useRef } from 'react'; -import { FloormapCanvas, useFloormapCore, useSelection, useViewport } from '@floormap/react'; -import { addEntity, createEmptyScene } from '@floormap/core'; -import type { Entity, EntityId, LayerId } from '@floormap/core'; +import { FloormapCanvas, useFloormapCore, useSelection, useViewport } from '@floormap-tools/react'; +import { addEntity, createEmptyScene } from '@floormap-tools/core'; +import type { Entity, EntityId, LayerId } from '@floormap-tools/core'; // ── Types ────────────────────────────────────────────────────────────────────── diff --git a/packages/examples/react/vite.config.ts b/packages/examples/react/vite.config.ts index e4bf04a..d7baec2 100644 --- a/packages/examples/react/vite.config.ts +++ b/packages/examples/react/vite.config.ts @@ -10,8 +10,8 @@ export default defineConfig(({ command }) => ({ base: command === 'build' ? '/react/' : '/', resolve: { alias: { - '@floormap/core': resolve(__dirname, '../../core/src/index.ts'), - '@floormap/react': resolve(__dirname, '../../adapters/react/src/index.ts'), + '@floormap-tools/core': resolve(__dirname, '../../core/src/index.ts'), + '@floormap-tools/react': resolve(__dirname, '../../adapters/react/src/index.ts'), }, }, })); diff --git a/packages/svg/CHANGELOG.md b/packages/svg/CHANGELOG.md index b02fc17..feaabcf 100644 --- a/packages/svg/CHANGELOG.md +++ b/packages/svg/CHANGELOG.md @@ -1,12 +1,12 @@ -# @floormap/svg +# @floormap-tools/svg ## 0.1.0 ### Minor Changes -- Initial release of @floormap/core, @floormap/svg, and @floormap/react. +- Initial release of @floormap-tools/core, @floormap-tools/svg, and @floormap-tools/react. ### Patch Changes - Updated dependencies - - @floormap/core@0.1.0 + - @floormap-tools/core@0.1.0 diff --git a/packages/svg/CLAUDE.md b/packages/svg/CLAUDE.md index c6134f6..362c525 100644 --- a/packages/svg/CLAUDE.md +++ b/packages/svg/CLAUDE.md @@ -1,13 +1,13 @@ -# @floormap/svg — Claude Code Guide +# @floormap-tools/svg — Claude Code Guide -SVG renderer and DOM event handlers for `@floormap/core`. Subscribes to core events and paints the scene into an `` element. No production dependencies. +SVG renderer and DOM event handlers for `@floormap-tools/core`. Subscribes to core events and paints the scene into an `` element. No production dependencies. --- ## Entry point ```ts -import { mountSvgRenderer } from '@floormap/svg'; +import { mountSvgRenderer } from '@floormap-tools/svg'; const renderer = mountSvgRenderer(core, { mount: svgElement, @@ -190,7 +190,7 @@ All SVG tests require jsdom. Use the `// @vitest-environment jsdom` pragma at th // @vitest-environment jsdom import { describe, it, expect, vi, beforeEach } from 'vitest'; import { mountSvgRenderer } from '../renderer'; -import { createCore } from '@floormap/core'; +import { createCore } from '@floormap-tools/core'; ``` **Required stubs** (jsdom doesn't implement these): diff --git a/packages/svg/README.md b/packages/svg/README.md index 8a1db3c..6a00c93 100644 --- a/packages/svg/README.md +++ b/packages/svg/README.md @@ -1,21 +1,21 @@ -# @floormap/svg +# @floormap-tools/svg -SVG renderer and DOM event handlers for [`@floormap/core`](../core). Mounts into any `` element, subscribes to core events, and paints the scene automatically. Includes wheel zoom, drag-to-pan, pinch-to-zoom, click-to-select, a background grid, and a selection highlight overlay. +SVG renderer and DOM event handlers for [`@floormap-tools/core`](../core). Mounts into any `` element, subscribes to core events, and paints the scene automatically. Includes wheel zoom, drag-to-pan, pinch-to-zoom, click-to-select, a background grid, and a selection highlight overlay. ## Installation ```bash -npm install @floormap/core @floormap/svg +npm install @floormap-tools/core @floormap-tools/svg # or -pnpm add @floormap/core @floormap/svg +pnpm add @floormap-tools/core @floormap-tools/svg ``` ## Quick start ```ts -import { createCore, createEmptyScene } from '@floormap/core'; -import { mountSvgRenderer } from '@floormap/svg'; -import type { EntityId, LayerId } from '@floormap/core'; +import { createCore, createEmptyScene } from '@floormap-tools/core'; +import { mountSvgRenderer } from '@floormap-tools/svg'; +import type { EntityId, LayerId } from '@floormap-tools/core'; const core = createCore({ scene: createEmptyScene({ width: 2000, height: 1500 }, ['layer' as LayerId]), diff --git a/packages/svg/package.json b/packages/svg/package.json index 308558d..9aa33e3 100644 --- a/packages/svg/package.json +++ b/packages/svg/package.json @@ -1,5 +1,5 @@ { - "name": "@floormap/svg", + "name": "@floormap-tools/svg", "version": "0.1.0", "private": false, "type": "module", @@ -26,11 +26,11 @@ "test:watch": "vitest" }, "devDependencies": { - "@floormap/core": "workspace:*", + "@floormap-tools/core": "workspace:*", "jsdom": "^27.2.0", "vitest": "^2.0.0" }, "peerDependencies": { - "@floormap/core": "0.x" + "@floormap-tools/core": "0.x" } } \ No newline at end of file diff --git a/packages/svg/src/__tests__/destroy.test.ts b/packages/svg/src/__tests__/destroy.test.ts index ffec9bf..401f516 100644 --- a/packages/svg/src/__tests__/destroy.test.ts +++ b/packages/svg/src/__tests__/destroy.test.ts @@ -1,7 +1,7 @@ // @vitest-environment jsdom import { describe, it, expect, beforeEach } from 'vitest'; import { mountSvgRenderer } from '../renderer'; -import { createCore } from '@floormap/core'; +import { createCore } from '@floormap-tools/core'; function makeSetup() { const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as SVGSVGElement; diff --git a/packages/svg/src/__tests__/grid.test.ts b/packages/svg/src/__tests__/grid.test.ts index 41e5799..003745e 100644 --- a/packages/svg/src/__tests__/grid.test.ts +++ b/packages/svg/src/__tests__/grid.test.ts @@ -1,7 +1,7 @@ // @vitest-environment jsdom import { describe, it, expect, beforeEach } from 'vitest'; import { mountSvgRenderer } from '../renderer'; -import { createCore } from '@floormap/core'; +import { createCore } from '@floormap-tools/core'; function makeSetup() { const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as SVGSVGElement; diff --git a/packages/svg/src/__tests__/handlers.test.ts b/packages/svg/src/__tests__/handlers.test.ts index 905062f..751f086 100644 --- a/packages/svg/src/__tests__/handlers.test.ts +++ b/packages/svg/src/__tests__/handlers.test.ts @@ -1,7 +1,7 @@ // @vitest-environment jsdom import { describe, it, expect, beforeEach } from 'vitest'; import { mountSvgRenderer } from '../renderer'; -import { createCore } from '@floormap/core'; +import { createCore } from '@floormap-tools/core'; function makesvg() { const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as SVGSVGElement; diff --git a/packages/svg/src/__tests__/pinch.test.ts b/packages/svg/src/__tests__/pinch.test.ts index 39ed16f..7b8f997 100644 --- a/packages/svg/src/__tests__/pinch.test.ts +++ b/packages/svg/src/__tests__/pinch.test.ts @@ -1,7 +1,7 @@ // @vitest-environment jsdom import { describe, it, expect, beforeEach } from 'vitest'; import { mountSvgRenderer } from '../renderer'; -import { createCore } from '@floormap/core'; +import { createCore } from '@floormap-tools/core'; function makeSetup() { const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as SVGSVGElement; diff --git a/packages/svg/src/__tests__/renderer.test.ts b/packages/svg/src/__tests__/renderer.test.ts index ed532a8..9c80911 100644 --- a/packages/svg/src/__tests__/renderer.test.ts +++ b/packages/svg/src/__tests__/renderer.test.ts @@ -1,7 +1,7 @@ // @vitest-environment jsdom import { describe, it, expect, vi, beforeEach } from 'vitest'; import { mountSvgRenderer } from '../renderer'; -import { createCore } from '@floormap/core'; +import { createCore } from '@floormap-tools/core'; function stubRect(svg: SVGSVGElement) { (svg as any).getBoundingClientRect = () => ({ diff --git a/packages/svg/src/__tests__/selection-overlay.test.ts b/packages/svg/src/__tests__/selection-overlay.test.ts index 9cab23b..30d0016 100644 --- a/packages/svg/src/__tests__/selection-overlay.test.ts +++ b/packages/svg/src/__tests__/selection-overlay.test.ts @@ -1,7 +1,7 @@ // @vitest-environment jsdom import { describe, it, expect, beforeEach } from 'vitest'; import { mountSvgRenderer } from '../renderer'; -import { createCore } from '@floormap/core'; +import { createCore } from '@floormap-tools/core'; function makeSetup() { const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as SVGSVGElement; diff --git a/packages/svg/src/__tests__/wheel.test.ts b/packages/svg/src/__tests__/wheel.test.ts index 1e0bdd1..81f5dc4 100644 --- a/packages/svg/src/__tests__/wheel.test.ts +++ b/packages/svg/src/__tests__/wheel.test.ts @@ -1,7 +1,7 @@ // @vitest-environment jsdom import { describe, it, expect, beforeEach } from 'vitest'; import { mountSvgRenderer } from '../renderer'; -import { createCore } from '@floormap/core'; +import { createCore } from '@floormap-tools/core'; function stubRect(svg: SVGSVGElement) { (svg as any).getBoundingClientRect = () => ({ diff --git a/packages/svg/src/grid.ts b/packages/svg/src/grid.ts index bd1a46b..ee56e4e 100644 --- a/packages/svg/src/grid.ts +++ b/packages/svg/src/grid.ts @@ -1,4 +1,4 @@ -import type { FloormapCore } from '@floormap/core'; +import type { FloormapCore } from '@floormap-tools/core'; import { clearChildren } from './dom'; export type GridOptions = { diff --git a/packages/svg/src/handlers.ts b/packages/svg/src/handlers.ts index d6ecb1e..18913dd 100644 --- a/packages/svg/src/handlers.ts +++ b/packages/svg/src/handlers.ts @@ -1,5 +1,5 @@ -import { FloormapCore, EntityId } from '@floormap/core'; -import type { Bounds } from '@floormap/core'; +import { FloormapCore, EntityId } from '@floormap-tools/core'; +import type { Bounds } from '@floormap-tools/core'; type AttachHandlersOptions = { enableWheel: boolean; diff --git a/packages/svg/src/index.ts b/packages/svg/src/index.ts index d70c907..bc11888 100644 --- a/packages/svg/src/index.ts +++ b/packages/svg/src/index.ts @@ -1,4 +1,4 @@ -import type { Entity, EntityId } from '@floormap/core'; +import type { Entity, EntityId } from '@floormap-tools/core'; import type { SelectionOverlayStyle } from './selection-overlay'; import type { GridOptions } from './grid'; diff --git a/packages/svg/src/renderer.ts b/packages/svg/src/renderer.ts index e9b1f3e..784b196 100644 --- a/packages/svg/src/renderer.ts +++ b/packages/svg/src/renderer.ts @@ -1,4 +1,4 @@ -import type { FloormapCore, Entity, LayerId } from '@floormap/core'; +import type { FloormapCore, Entity, LayerId } from '@floormap-tools/core'; import type { SvgRenderer, SvgRendererOptions } from './index'; import { setupSvgRoot, getGroups, clearChildren } from './dom'; import { attachHandlers } from './handlers'; diff --git a/packages/svg/src/selection-overlay.ts b/packages/svg/src/selection-overlay.ts index 1a8e86b..eb1674b 100644 --- a/packages/svg/src/selection-overlay.ts +++ b/packages/svg/src/selection-overlay.ts @@ -1,4 +1,4 @@ -import type { FloormapCore } from '@floormap/core'; +import type { FloormapCore } from '@floormap-tools/core'; import { clearChildren } from './dom'; export type SelectionOverlayStyle = { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d8521ab..fa12f33 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,7 +44,7 @@ importers: packages/adapters/react: devDependencies: - '@floormap/core': + '@floormap-tools/core': specifier: workspace:* version: link:../../core '@testing-library/react': @@ -77,10 +77,10 @@ importers: packages/examples/js-vanilla: dependencies: - '@floormap/core': + '@floormap-tools/core': specifier: workspace:* version: link:../../core - '@floormap/svg': + '@floormap-tools/svg': specifier: workspace:* version: link:../../svg devDependencies: @@ -90,10 +90,10 @@ importers: packages/examples/react: dependencies: - '@floormap/core': + '@floormap-tools/core': specifier: workspace:* version: link:../../core - '@floormap/react': + '@floormap-tools/react': specifier: workspace:* version: link:../../adapters/react react: @@ -118,7 +118,7 @@ importers: packages/svg: devDependencies: - '@floormap/core': + '@floormap-tools/core': specifier: workspace:* version: link:../core jsdom: diff --git a/tsconfig.json b/tsconfig.json index 6585da9..f5abe29 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,9 +5,9 @@ "jsx": "react-jsx", "lib": ["ES2020", "DOM", "DOM.Iterable"], "paths": { - "@floormap/core": ["./packages/core/src/index.ts"], - "@floormap/svg": ["./packages/svg/src/index.ts"], - "@floormap/react": ["./packages/adapters/react/src/index.ts"] + "@floormap-tools/core": ["./packages/core/src/index.ts"], + "@floormap-tools/svg": ["./packages/svg/src/index.ts"], + "@floormap-tools/react": ["./packages/adapters/react/src/index.ts"] } }, "include": [ diff --git a/vitest.config.ts b/vitest.config.ts index 110943d..2300628 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -7,9 +7,9 @@ const __dirname = fileURLToPath(new URL('.', import.meta.url)); export default defineConfig({ resolve: { alias: { - '@floormap/core': resolve(__dirname, 'packages/core/src/index.ts'), - '@floormap/svg': resolve(__dirname, 'packages/svg/src/index.ts'), - '@floormap/react': resolve(__dirname, 'packages/adapters/react/src/index.ts'), + '@floormap-tools/core': resolve(__dirname, 'packages/core/src/index.ts'), + '@floormap-tools/svg': resolve(__dirname, 'packages/svg/src/index.ts'), + '@floormap-tools/react': resolve(__dirname, 'packages/adapters/react/src/index.ts'), }, }, test: {