diff --git a/.changeset/add-interactive-resize.md b/.changeset/add-interactive-resize.md index 01b03fc..b7c1f94 100644 --- a/.changeset/add-interactive-resize.md +++ b/.changeset/add-interactive-resize.md @@ -1,11 +1,11 @@ --- -"@spatialkit/core": minor -"@spatialkit/svg": minor -"@spatialkit/react": minor +"@spatial-kit/core": minor +"@spatial-kit/svg": minor +"@spatial-kit/react": minor --- Add interactive entity resizing via drag handles. -- `@spatialkit/core` exports a new `ResizeDirection` type (`'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw'`), `hitTestResizeHandles` to detect which handle is under the cursor in screen space, and `applyResizeDelta` to compute new bounds from a world-space drag delta (with optional snap-to-grid on the edge position) -- `@spatialkit/svg` adds `paintResizeHandles` painter that draws 8 handles around each selected entity at a consistent pixel size regardless of zoom, and wires resize drag into `attachHandlers` with a priority-over-entity-drag rule -- `@spatialkit/react` adds a `ResizeHandles` internal component that renders the same 8 handles declaratively, and wires resize drag into `attachHandlers` with the same state machine (`idle → pending → resize → idle`) +- `@spatial-kit/core` exports a new `ResizeDirection` type (`'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw'`), `hitTestResizeHandles` to detect which handle is under the cursor in screen space, and `applyResizeDelta` to compute new bounds from a world-space drag delta (with optional snap-to-grid on the edge position) +- `@spatial-kit/svg` adds `paintResizeHandles` painter that draws 8 handles around each selected entity at a consistent pixel size regardless of zoom, and wires resize drag into `attachHandlers` with a priority-over-entity-drag rule +- `@spatial-kit/react` adds a `ResizeHandles` internal component that renders the same 8 handles declaratively, and wires resize drag into `attachHandlers` with the same state machine (`idle → pending → resize → idle`) diff --git a/.changeset/add-snap-to-grid.md b/.changeset/add-snap-to-grid.md index e0ca254..827215e 100644 --- a/.changeset/add-snap-to-grid.md +++ b/.changeset/add-snap-to-grid.md @@ -1,11 +1,11 @@ --- -"@spatialkit/core": minor -"@spatialkit/svg": minor -"@spatialkit/react": minor +"@spatial-kit/core": minor +"@spatial-kit/svg": minor +"@spatial-kit/react": minor --- Add snap-to-grid support for entity drag. -- `@spatialkit/core` exports a new `snapToGrid(value, gridSize)` utility that rounds a world-space coordinate to the nearest grid multiple -- `@spatialkit/svg` accepts a `snapToGrid?: number` option on `mountSvgRenderer`; when set, entity positions are snapped on every drag frame -- `@spatialkit/react` accepts a `snapToGrid?: number` prop on `SpatialCanvas` with the same behavior +- `@spatial-kit/core` exports a new `snapToGrid(value, gridSize)` utility that rounds a world-space coordinate to the nearest grid multiple +- `@spatial-kit/svg` accepts a `snapToGrid?: number` option on `mountSvgRenderer`; when set, entity positions are snapped on every drag frame +- `@spatial-kit/react` accepts a `snapToGrid?: number` prop on `SpatialCanvas` with the same behavior diff --git a/.changeset/support-react-19.md b/.changeset/support-react-19.md index eab7252..6a31f6b 100644 --- a/.changeset/support-react-19.md +++ b/.changeset/support-react-19.md @@ -1,5 +1,5 @@ --- -'@spatialkit/react': minor +'@spatial-kit/react': minor --- Support React 19. The `react` peer dependency now accepts `^18.0.0 || ^19.0.0`. diff --git a/.claude/skills/issue.md b/.claude/skills/issue.md index f86123b..e72aea0 100644 --- a/.claude/skills/issue.md +++ b/.claude/skills/issue.md @@ -11,7 +11,7 @@ You are a GitHub issue creator and editor for the **spatialkit/spatial** reposit **Repo:** `spatialkit/spatial` **Owner:** `spatialkit` -**Packages:** `@spatialkit/core` · `@spatialkit/svg` · `@spatialkit/react` · cross-cutting +**Packages:** `@spatial-kit/core` · `@spatial-kit/svg` · `@spatial-kit/react` · cross-cutting **Milestones:** | # | Title | Scope | |---|-------|-------| @@ -53,7 +53,7 @@ Questions to ask in round 1: 2. "What type of issue is this?" (header: "Type") Options: Feature | Bug | Chore 3. "Which package does this affect?" (header: "Package") - Options: @spatialkit/core | @spatialkit/svg | @spatialkit/react | cross-cutting + Options: @spatial-kit/core | @spatial-kit/svg | @spatial-kit/react | cross-cutting 4. "Which milestone does this belong to?" (header: "Milestone") Options: M1 — Functional editor | M2 — Undo/Redo & Persistence | M3 — Extend & Optimize | M4 — Ecosystem | None ``` @@ -165,5 +165,5 @@ These fields can't be set via the API — open the issue in the project board to - Never skip the question rounds — always ask before writing the body. - Never invent code or file paths not derivable from the project context. -- Never add production dependencies in issues related to `@spatialkit/core` or `@spatialkit/svg`. +- Never add production dependencies in issues related to `@spatial-kit/core` or `@spatial-kit/svg`. - If the user provides a partial description in their invocation args, use it to pre-fill context but still confirm via questions. diff --git a/.claude/skills/spatial-expert.md b/.claude/skills/spatial-expert.md index ef4d53e..9286bfb 100644 --- a/.claude/skills/spatial-expert.md +++ b/.claude/skills/spatial-expert.md @@ -9,7 +9,7 @@ You are an expert on the **Spatial** codebase. Apply this context whenever worki ## What Spatial 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: `@spatialkit/core` and `@spatialkit/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: `@spatial-kit/core` and `@spatial-kit/svg`. --- @@ -33,7 +33,7 @@ A zero-dependency TypeScript toolkit for building interactive 2D editors (floor ## Architecture rules to enforce -1. **No production deps** — `@spatialkit/core` and `@spatialkit/svg` must stay dependency-free. +1. **No production deps** — `@spatial-kit/core` and `@spatial-kit/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 `@spatialkit/core` → breaks the agnostic renderer model +- Adding DOM code to `@spatial-kit/core` → breaks the agnostic renderer model - Not updating `index.ts` after adding exports → new symbols invisible to consumers diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 37f4414..4dd6830 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -12,9 +12,9 @@ body: label: Package multiple: true options: - - '@spatialkit/core' - - '@spatialkit/svg' - - '@spatialkit/react' + - '@spatial-kit/core' + - '@spatial-kit/svg' + - '@spatial-kit/react' - Not sure validations: required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index e181643..1ab2e16 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -8,9 +8,9 @@ body: label: Package multiple: true options: - - '@spatialkit/core' - - '@spatialkit/svg' - - '@spatialkit/react' + - '@spatial-kit/core' + - '@spatial-kit/svg' + - '@spatial-kit/react' - New package - Not sure validations: diff --git a/.github/workflows/deploy-examples.yml b/.github/workflows/deploy-examples.yml index d83d339..a8ee666 100644 --- a/.github/workflows/deploy-examples.yml +++ b/.github/workflows/deploy-examples.yml @@ -62,11 +62,11 @@ jobs:
Interactive 2D editor toolkit — live examples
Vanilla JS - @spatialkit/core + @spatialkit/svg + @spatial-kit/core + @spatial-kit/svg React - @spatialkit/core + @spatialkit/react + @spatial-kit/core + @spatial-kit/react